From 21ea5a74e700189b8d38a97d74a82ca34ce3ea47 Mon Sep 17 00:00:00 2001 From: Jean-François DEL NERO Date: Sat, 23 Jan 2016 13:28:58 +0100 Subject: New video chip support : Thomson EF9364 / Sescosem SFF96364 --- scripts/src/video.lua | 12 ++ src/devices/video/ef9364.cpp | 326 +++++++++++++++++++++++++++++++++++++++++++ src/devices/video/ef9364.h | 102 ++++++++++++++ 3 files changed, 440 insertions(+) create mode 100644 src/devices/video/ef9364.cpp create mode 100644 src/devices/video/ef9364.h diff --git a/scripts/src/video.lua b/scripts/src/video.lua index a09ef123fca..fafc07e37f6 100644 --- a/scripts/src/video.lua +++ b/scripts/src/video.lua @@ -154,6 +154,18 @@ if (VIDEOS["EF9345"]~=null) then } end +-------------------------------------------------- +-- +--@src/devices/video/ef9364.h,VIDEOS["EF9364"] = true +-------------------------------------------------- + +if (VIDEOS["EF9364"]~=null) then + files { + MAME_DIR .. "src/devices/video/ef9364.cpp", + MAME_DIR .. "src/devices/video/ef9364.h", + } +end + -------------------------------------------------- -- --@src/devices/video/ef9365.h,VIDEOS["EF9365"] = true diff --git a/src/devices/video/ef9364.cpp b/src/devices/video/ef9364.cpp new file mode 100644 index 00000000000..b44909571e5 --- /dev/null +++ b/src/devices/video/ef9364.cpp @@ -0,0 +1,326 @@ +// license:BSD-3-Clause +// copyright-holders:Jean-Francois DEL NERO + +/********************************************************************* + + ef9364.cpp + + Thomson EF9364 / Sescosem SFF96364 video controller emulator code + + This circuit is a simple black and white 8x8 character generator. + It display 64 columns * 16 rows text page. + It is able to do automatic text scrolling, page erase. + The characters font is stored into an external 1KB EPROM. + + To see how to use this driver, have a look to the Goupil machine + driver (goupil.cpp). + If you have any question or remark, don't hesitate to contact me + at the email present on this website : http://hxc2001.free.fr/ + + 01/20/2016 + Jean-Francois DEL NERO +*********************************************************************/ + +#include "emu.h" +#include "ef9364.h" + +// devices +const device_type EF9364 = &device_creator; + +//------------------------------------------------- +// default address map +//------------------------------------------------- +static ADDRESS_MAP_START( ef9364, AS_0, 8, ef9364_device ) + AM_RANGE(0x00000, ( ( EF9364_TXTPLANE_MAX_SIZE * EF9364_MAX_TXTPLANES ) - 1 ) ) AM_RAM +ADDRESS_MAP_END + +//------------------------------------------------- +// memory_space_config - return a description of +// any address spaces owned by this device +//------------------------------------------------- + +const address_space_config *ef9364_device::memory_space_config(address_spacenum spacenum) const +{ + return (spacenum == AS_0) ? &m_space_config : NULL; +} + +//************************************************************************** +// INLINE HELPERS +//************************************************************************** + +//************************************************************************** +// live device +//************************************************************************** + +//------------------------------------------------- +// ef9364_device - constructor +//------------------------------------------------- + +ef9364_device::ef9364_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, EF9364, "EF9364", tag, owner, clock, "ef9364", __FILE__), + device_memory_interface(mconfig, *this), + device_video_interface(mconfig, *this), + m_space_config("textram", ENDIANNESS_LITTLE, 8, 12, 0, nullptr, *ADDRESS_MAP_NAME(ef9364)), + m_palette(*this) +{ + clock_freq = clock; +} + +//------------------------------------------------- +// static_set_palette_tag: Set the tag of the +// palette device +//------------------------------------------------- + +void ef9364_device::static_set_palette_tag(device_t &device, const char *tag) +{ + downcast(device).m_palette.set_tag(tag); +} + +//------------------------------------------------- +// static_set_nb_of_pages: Set the number of hardware pages +//------------------------------------------------- + +void ef9364_device::static_set_nb_of_pages(device_t &device, int nb_of_pages ) +{ + if( nb_of_pages > 0 && nb_of_pages <= 8 ) + { + downcast(device).nb_of_pages = nb_of_pages; + } +} + +//------------------------------------------------- +// set_color_entry: Set the color value +// into the palette +//------------------------------------------------- + +void ef9364_device::set_color_entry( int index, UINT8 r, UINT8 g, UINT8 b ) +{ + if( index < 2 ) + { + palette[index] = rgb_t(r, g, b); + } + else + { + logerror("Invalid EF9364 Palette entry : %02x\n", index); + } +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ef9364_device::device_start() +{ + m_textram = &space(0); + m_charset = region(); + + bitplane_xres = EF9364_NB_OF_COLUMNS*8; + bitplane_yres = EF9364_NB_OF_ROWS*(8+4); + + vsync_scanline_pos = 250; + + // Default palette : Black and white + palette[0] = rgb_t(0, 0, 0); + palette[1] = rgb_t(255, 255, 255); + + m_screen_out.allocate( bitplane_xres, m_screen->height() ); + + save_item(NAME(m_border)); + + save_item(NAME(m_screen_out)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ef9364_device::device_reset() +{ + int i; + + x_curs_pos = 0; + y_curs_pos = 0; + + char_latch = 0x00; + + for(i=0;iwrite_byte ( i , 0x7F ); + } + + memset(m_border, 0, sizeof(m_border)); + + m_screen_out.fill(0); + + set_video_mode(); +} + +//------------------------------------------------- +// set_video_mode: Set output screen format +//------------------------------------------------- + +void ef9364_device::set_video_mode(void) +{ + UINT16 new_width = bitplane_xres; + + if (m_screen->width() != new_width) + { + rectangle visarea = m_screen->visible_area(); + visarea.max_x = new_width - 1; + + m_screen->configure(new_width, m_screen->height(), visarea, m_screen->frame_period().attoseconds()); + } + + //border color + memset(m_border, 0, sizeof(m_border)); +} + +//------------------------------------------------- +// draw_border: Draw the left and right borders +// ( No border for the moment ;) ) +//------------------------------------------------- + +void ef9364_device::draw_border(UINT16 line) +{ +} + +//------------------------------------------------- +// screen_update: Framebuffer video ouput +//------------------------------------------------- + +UINT32 ef9364_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int x,y,r; + unsigned char c; + + for( r = 0 ; r < EF9364_NB_OF_ROWS ; r++ ) + { + for( y = 0 ; y < 8 ; y++ ) + { + for( x = 0 ; x < EF9364_NB_OF_COLUMNS * 8 ; x++ ) + { + c = m_textram->read_byte( ( r * EF9364_NB_OF_COLUMNS ) + ( x>>3 ) ); + + if( m_charset->u8(((c&0x7F)<<3) + y ) & (0x80>>(x&7)) ) + m_screen_out.pix32((r*12)+y, x) = palette[1]; + else + m_screen_out.pix32((r*12)+y, x) = palette[0]; + } + } + } + + copybitmap(bitmap, m_screen_out, 0, 0, 0, 0, cliprect); + return 0; +} + +//------------------------------------------------- +// update_scanline: Scanline callback +//------------------------------------------------- + +void ef9364_device::update_scanline(UINT16 scanline) +{ + if (scanline == vsync_scanline_pos) + { + // vsync + } + + if (scanline == 0) + { + draw_border(0); + } +} + +//------------------------------------------------- +// data_w: Registers write access callback +//------------------------------------------------- + +void ef9364_device::command_w(UINT8 cmd) +{ + int x,y,i,j; + + switch( cmd&7 ) + { + case 0x0: // Page Erase Cursor hiom + for( y=0 ; y < EF9364_NB_OF_ROWS ; y++ ) + { + for( x=0 ; x < EF9364_NB_OF_COLUMNS ; x++ ) + { + m_textram->write_byte ( y * EF9364_NB_OF_COLUMNS + x , 0x7F ); + } + } + x_curs_pos = 0; + y_curs_pos = 0; + break; + + case 0x1: // Erase to end of the line and return cursor + for( ; x_curs_pos < EF9364_NB_OF_COLUMNS ; x_curs_pos++ ) + { + m_textram->write_byte ( y_curs_pos * EF9364_NB_OF_COLUMNS + x_curs_pos , 0x7F ); + } + x_curs_pos = 0; + break; + + case 0x2: // Line feed + y_curs_pos++; + if( y_curs_pos >= EF9364_NB_OF_ROWS ) + { + // Scroll + for( j = 1 ; j < EF9364_NB_OF_ROWS ; j++ ) + { + for( i = 0 ; i < EF9364_NB_OF_COLUMNS ; i++ ) + { + m_textram->write_byte ( (j-1) * EF9364_NB_OF_COLUMNS + i , m_textram->read_byte ( j * EF9364_NB_OF_COLUMNS + i ) ); + } + } + // Erase last line + for( i = 0 ; i < EF9364_NB_OF_COLUMNS ; i++ ) + { + m_textram->write_byte ( ( EF9364_NB_OF_ROWS - 1 ) * EF9364_NB_OF_COLUMNS + i , 0x7F ); + } + + y_curs_pos = EF9364_NB_OF_ROWS - 1; + } + break; + + case 0x3: // Nop + + break; + + case 0x4: // Cursor left + if(x_curs_pos) + x_curs_pos--; + break; + + case 0x5: // Erasure of cursor Line. + for( x = 0 ; x < EF9364_NB_OF_COLUMNS ; x++ ) + { + m_textram->write_byte ( y_curs_pos * EF9364_NB_OF_COLUMNS + x , 0x7F ); + } + break; + + case 0x6: // Cursor up + if(y_curs_pos) + y_curs_pos--; + break; + + case 0x7: // Write char + if(cmd&0x8) + m_textram->write_byte ( y_curs_pos * EF9364_NB_OF_COLUMNS + x_curs_pos , char_latch ); + + x_curs_pos++; + if( x_curs_pos >= EF9364_NB_OF_COLUMNS ) + { + x_curs_pos=0; + y_curs_pos++; + if( y_curs_pos >= EF9364_NB_OF_ROWS ) + y_curs_pos = EF9364_NB_OF_ROWS - 1; + } + break; + + } +} + +void ef9364_device::char_latch_w(UINT8 data) +{ + char_latch = data; +} diff --git a/src/devices/video/ef9364.h b/src/devices/video/ef9364.h new file mode 100644 index 00000000000..7456c9ad9e6 --- /dev/null +++ b/src/devices/video/ef9364.h @@ -0,0 +1,102 @@ +// license:BSD-3-Clause +// copyright-holders:Jean-Francois DEL NERO +/********************************************************************* + + ef9364.h + + Thomson EF9364 video controller + +*********************************************************************/ + +#pragma once + +#ifndef __EF9364_H__ +#define __EF9364_H__ + +#define EF9364_NB_OF_COLUMNS 64 +#define EF9364_NB_OF_ROWS 16 + +#define EF9364_TXTPLANE_MAX_SIZE ( EF9364_NB_OF_COLUMNS * EF9364_NB_OF_ROWS ) +#define EF9364_MAX_TXTPLANES 2 + +#define MCFG_EF9364_PALETTE(_palette_tag) \ + ef9364_device::static_set_palette_tag(*device, "^" _palette_tag); + +#define MCFG_EF9364_PAGES_CNT(_pages_number) \ + ef9364_device::static_set_nb_of_pages(*device,_pages_number); + +#define MCFG_EF9364_IRQ_HANDLER(_devcb) \ + devcb = &ef9364_device::set_irq_handler(*device, DEVCB_##_devcb); + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> ef9364_device + +class ef9364_device : public device_t, + public device_memory_interface, + public device_video_interface +{ +public: + // construction/destruction + ef9364_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // static configuration + static void static_set_palette_tag(device_t &device, const char *tag); + static void static_set_nb_of_pages(device_t &device, int nb_bitplanes ); + + // device interface + + void update_scanline(UINT16 scanline); + void set_color_entry( int index, UINT8 r, UINT8 g, UINT8 b ); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void char_latch_w(UINT8 data); + void command_w(UINT8 cmd); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // device_config_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; + + // address space configurations + const address_space_config m_space_config; + + // inline helper + +private: + void screen_scanning( int force_clear ); + void set_video_mode(void); + void draw_border(UINT16 line); + + // internal state + + memory_region *m_charset; + address_space *m_textram; + + UINT8 x_curs_pos; + UINT8 y_curs_pos; + UINT8 char_latch; + + UINT8 m_border[80]; //border color + + rgb_t palette[2]; + int nb_of_pages; + int bitplane_xres; + int bitplane_yres; + int vsync_scanline_pos; + + UINT32 clock_freq; + bitmap_rgb32 m_screen_out; + + required_device m_palette; +}; + +// device type definition +extern const device_type EF9364; + +#endif -- cgit v1.2.3-70-g09d2 From 9fbef59621ff6e833cdbad717b3ee1551be35ff1 Mon Sep 17 00:00:00 2001 From: Jean-François DEL NERO Date: Sun, 24 Jan 2016 22:47:05 +0100 Subject: Cursor support. --- src/devices/video/ef9364.cpp | 43 ++++++++++++++++++++++++++++++++++++++----- src/devices/video/ef9364.h | 2 ++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/devices/video/ef9364.cpp b/src/devices/video/ef9364.cpp index b44909571e5..b850f05d531 100644 --- a/src/devices/video/ef9364.cpp +++ b/src/devices/video/ef9364.cpp @@ -125,6 +125,9 @@ void ef9364_device::device_start() m_screen_out.allocate( bitplane_xres, m_screen->height() ); + cursor_cnt = 0; + cursor_state = 0; + save_item(NAME(m_border)); save_item(NAME(m_screen_out)); @@ -199,16 +202,30 @@ UINT32 ef9364_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for( x = 0 ; x < EF9364_NB_OF_COLUMNS * 8 ; x++ ) { - c = m_textram->read_byte( ( r * EF9364_NB_OF_COLUMNS ) + ( x>>3 ) ); + if( ( ( x >> 3 ) != x_curs_pos ) || ( r != y_curs_pos ) || !cursor_state) + { + c = m_textram->read_byte( ( r * EF9364_NB_OF_COLUMNS ) + ( x>>3 ) ); - if( m_charset->u8(((c&0x7F)<<3) + y ) & (0x80>>(x&7)) ) - m_screen_out.pix32((r*12)+y, x) = palette[1]; + if( m_charset->u8(((c&0x7F)<<3) + y ) & (0x80>>(x&7)) ) + m_screen_out.pix32((r*12)+y, x) = palette[1]; + else + m_screen_out.pix32((r*12)+y, x) = palette[0]; + } else - m_screen_out.pix32((r*12)+y, x) = palette[0]; + { + if(y != 7) + m_screen_out.pix32((r*12)+y, x) = palette[0]; + else + m_screen_out.pix32((r*12)+y, x) = palette[1]; + } } } } + cursor_cnt = (cursor_cnt + 1) % 13; + if(!cursor_cnt) + cursor_state ^= 1; + copybitmap(bitmap, m_screen_out, 0, 0, 0, 0, cliprect); return 0; } @@ -240,7 +257,7 @@ void ef9364_device::command_w(UINT8 cmd) switch( cmd&7 ) { - case 0x0: // Page Erase Cursor hiom + case 0x0: // Page Erase & Cursor home for( y=0 ; y < EF9364_NB_OF_ROWS ; y++ ) { for( x=0 ; x < EF9364_NB_OF_COLUMNS ; x++ ) @@ -313,7 +330,23 @@ void ef9364_device::command_w(UINT8 cmd) x_curs_pos=0; y_curs_pos++; if( y_curs_pos >= EF9364_NB_OF_ROWS ) + { + // Scroll + for( j = 1 ; j < EF9364_NB_OF_ROWS ; j++ ) + { + for( i = 0 ; i < EF9364_NB_OF_COLUMNS ; i++ ) + { + m_textram->write_byte ( (j-1) * EF9364_NB_OF_COLUMNS + i , m_textram->read_byte ( j * EF9364_NB_OF_COLUMNS + i ) ); + } + } + // Erase last line + for( i = 0 ; i < EF9364_NB_OF_COLUMNS ; i++ ) + { + m_textram->write_byte ( ( EF9364_NB_OF_ROWS - 1 ) * EF9364_NB_OF_COLUMNS + i , 0x7F ); + } + y_curs_pos = EF9364_NB_OF_ROWS - 1; + } } break; diff --git a/src/devices/video/ef9364.h b/src/devices/video/ef9364.h index 7456c9ad9e6..1519d817196 100644 --- a/src/devices/video/ef9364.h +++ b/src/devices/video/ef9364.h @@ -89,6 +89,8 @@ private: int bitplane_xres; int bitplane_yres; int vsync_scanline_pos; + int cursor_cnt; + int cursor_state; UINT32 clock_freq; bitmap_rgb32 m_screen_out; -- cgit v1.2.3-70-g09d2 From 1686fdd06ec9adadd851972d578f6e0d2c43eb86 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 27 Jan 2016 13:51:08 +0100 Subject: Fix error by ImJezze (nw) --- src/osd/modules/render/d3d/d3dhlsl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 507553ccc14..43d6ec9bc48 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -1367,7 +1367,7 @@ int shaders::phosphor_pass(render_target *rt, cache_target *ct, int source_index int next_index = source_index; // skip phosphor if no influencing settings - if (options->phosphor[0] == 0.0f && options->defocus[0] == 0.0f && options->defocus[1] == 0.0f) + if (options->phosphor[0] == 0.0f && options->phosphor[1] == 0.0f && options->phosphor[2] == 0.0f) { return next_index; } -- cgit v1.2.3-70-g09d2 From 8ab684a017b25ec2396394cd04b04e7f974fcbb2 Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Wed, 27 Jan 2016 08:36:37 -0500 Subject: proper graphic flag for pc_sjetm (nw) --- src/mame/drivers/playch10.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/playch10.cpp b/src/mame/drivers/playch10.cpp index 1a044e7e2ec..3de354d2a38 100644 --- a/src/mame/drivers/playch10.cpp +++ b/src/mame/drivers/playch10.cpp @@ -1726,7 +1726,7 @@ GAME( 1988, pc_pinbt, playch10, playch10_hboard, playch10, playch10_state, pchbo /* i-Board Games */ GAME( 1989, pc_cshwk, playch10, playch10, playch10, playch10_state, pciboard, ROT0, "Rare (Nintendo of America license)", "Captain Sky Hawk (PlayChoice-10)", 0 ) -GAME( 1990, pc_sjetm, playch10, playch10, playch10, playch10_state, pciboard, ROT0, "Rare", "Solar Jetman (PlayChoice-10)", 0 ) +GAME( 1990, pc_sjetm, playch10, playch10, playch10, playch10_state, pciboard, ROT0, "Rare", "Solar Jetman (PlayChoice-10)", MACHINE_IMPERFECT_GRAPHICS ) /* K-Board Games */ GAME( 1991, pc_moglf, playch10, playch10, playch10, playch10_state, pckboard, ROT0, "Nintendo", "Mario's Open Golf (PlayChoice-10)", 0 ) -- cgit v1.2.3-70-g09d2 From 1a6999a0e70871f3635844b7b5294114ab40f996 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 27 Jan 2016 15:32:40 +0100 Subject: removed generated files for m68k cpu core (nw) --- src/devices/cpu/m68000/m68kops.cpp | 34874 ----------------------------------- src/devices/cpu/m68000/m68kops.h | 1995 -- 2 files changed, 36869 deletions(-) delete mode 100644 src/devices/cpu/m68000/m68kops.cpp delete mode 100644 src/devices/cpu/m68000/m68kops.h diff --git a/src/devices/cpu/m68000/m68kops.cpp b/src/devices/cpu/m68000/m68kops.cpp deleted file mode 100644 index 0505f863c73..00000000000 --- a/src/devices/cpu/m68000/m68kops.cpp +++ /dev/null @@ -1,34874 +0,0 @@ -#include "emu.h" -#include "m68kcpu.h" -extern void m68040_fpu_op0(m68000_base_device *m68k); -extern void m68040_fpu_op1(m68000_base_device *m68k); -extern void m68881_mmu_ops(m68000_base_device *m68k); -extern void m68881_ftrap(m68000_base_device *m68k); - -/* ======================================================================== */ -/* ========================= INSTRUCTION HANDLERS ========================= */ -/* ======================================================================== */ - - -void m68000_base_device_ops::m68k_op_1010(m68000_base_device* mc68kcpu) -{ - m68ki_exception_1010(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_1111(m68000_base_device* mc68kcpu) -{ - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_040fpu0_32(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->has_fpu) - { - m68040_fpu_op0(mc68kcpu); - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_040fpu1_32(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->has_fpu) - { - m68040_fpu_op1(mc68kcpu); - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_abcd_8_rr(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = DY(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if(res > 9) - res += 6; - res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = (res > 0x99) << 8; - if((mc68kcpu)->c_flag) - res -= 0xa0; - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; -} - - -void m68000_base_device_ops::m68k_op_abcd_8_mm_ax7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if(res > 9) - res += 6; - res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = (res > 0x99) << 8; - if((mc68kcpu)->c_flag) - res -= 0xa0; - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_abcd_8_mm_ay7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if(res > 9) - res += 6; - res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = (res > 0x99) << 8; - if((mc68kcpu)->c_flag) - res -= 0xa0; - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_abcd_8_mm_axy7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if(res > 9) - res += 6; - res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = (res > 0x99) << 8; - if((mc68kcpu)->c_flag) - res -= 0xa0; - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_abcd_8_mm(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if(res > 9) - res += 6; - res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = (res > 0x99) << 8; - if((mc68kcpu)->c_flag) - res -= 0xa0; - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_add_8_er_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_AI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_pi7(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_A7_PI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_pd7(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_DI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_IX_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AW_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AL_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCDI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCIX_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_er_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(AY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_AI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PD_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_DI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_IX_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AW_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AL_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCDI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCIX_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_16_er_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = DY(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = AY(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_AI_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PI_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PD_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_DI_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_IX_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AW_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AL_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCDI_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCIX_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_32_er_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_add_8_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_8_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_8_re_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_8_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_8_re_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_8_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_8_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_8_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_8_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_16_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_16_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_16_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_16_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_16_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_16_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_16_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_32_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_32_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_32_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_32_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_32_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_32_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_add_32_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_adda_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + MAKE_INT_16(DY(mc68kcpu))); -} - - -void m68000_base_device_ops::m68k_op_adda_16_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + MAKE_INT_16(AY(mc68kcpu))); -} - - -void m68000_base_device_ops::m68k_op_adda_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AY_AI_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AY_PI_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AY_PD_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_16_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AY_DI_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AY_IX_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AW_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_16_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AL_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_16_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_PCDI_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_16_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_PCIX_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_16_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_I_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_32_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + DY(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_adda_32_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + AY(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_adda_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AY_AI_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AY_PI_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AY_PD_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_32_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AY_DI_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AY_IX_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AW_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_32_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AL_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_32_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_PCDI_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_32_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_PCIX_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_adda_32_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_I_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); -} - - -void m68000_base_device_ops::m68k_op_addi_8_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_addi_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_addi_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_32_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_addi_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addi_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_8_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_addq_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_addq_16_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AY(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1); -} - - -void m68000_base_device_ops::m68k_op_addq_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_32_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 dst = *r_dst; - UINT32 res = src + dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_addq_32_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AY(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst + ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1); -} - - -void m68000_base_device_ops::m68k_op_addq_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addq_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst; - - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_addx_8_rr(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src + dst + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; -} - - -void m68000_base_device_ops::m68k_op_addx_16_rr(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src + dst + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; -} - - -void m68000_base_device_ops::m68k_op_addx_32_rr(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = DY(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = src + dst + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - *r_dst = res; -} - - -void m68000_base_device_ops::m68k_op_addx_8_mm_ax7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_addx_8_mm_ay7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_addx_8_mm_axy7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_addx_8_mm(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = src + dst + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_ADD_8(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_addx_16_mm(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src + dst + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_ADD_16(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_addx_32_mm(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = src + dst + XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_ADD_32(src, dst, res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_ADD_32(src, dst, res); - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_and_8_er_d(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (DY(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_ai(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_AY_AI_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_pi(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_AY_PI_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_pi7(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_A7_PI_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_pd(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_AY_PD_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_pd7(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_A7_PD_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_di(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_AY_DI_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_ix(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_AY_IX_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_aw(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_AW_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_al(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_AL_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_pcdi(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_PCDI_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_pcix(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_PCIX_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_er_i(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DX(mc68kcpu) &= (OPER_I_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_16_er_d(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DX(mc68kcpu) &= (DY(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_16_er_ai(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DX(mc68kcpu) &= (OPER_AY_AI_16(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_16_er_pi(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DX(mc68kcpu) &= (OPER_AY_PI_16(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_16_er_pd(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DX(mc68kcpu) &= (OPER_AY_PD_16(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_16_er_di(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DX(mc68kcpu) &= (OPER_AY_DI_16(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_16_er_ix(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DX(mc68kcpu) &= (OPER_AY_IX_16(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_16_er_aw(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DX(mc68kcpu) &= (OPER_AW_16(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_16_er_al(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DX(mc68kcpu) &= (OPER_AL_16(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_16_er_pcdi(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DX(mc68kcpu) &= (OPER_PCDI_16(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_16_er_pcix(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DX(mc68kcpu) &= (OPER_PCIX_16(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_16_er_i(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DX(mc68kcpu) &= (OPER_I_16(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_32_er_d(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DX(mc68kcpu) &= DY(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_32_er_ai(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DX(mc68kcpu) &= OPER_AY_AI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_32_er_pi(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DX(mc68kcpu) &= OPER_AY_PI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_32_er_pd(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DX(mc68kcpu) &= OPER_AY_PD_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_32_er_di(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DX(mc68kcpu) &= OPER_AY_DI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_32_er_ix(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DX(mc68kcpu) &= OPER_AY_IX_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_32_er_aw(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DX(mc68kcpu) &= OPER_AW_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_32_er_al(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DX(mc68kcpu) &= OPER_AL_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_32_er_pcdi(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DX(mc68kcpu) &= OPER_PCDI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_32_er_pcix(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DX(mc68kcpu) &= OPER_PCIX_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_32_er_i(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DX(mc68kcpu) &= OPER_I_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_and_8_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_8_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_8_re_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_8_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_8_re_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_8_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_8_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_8_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_8_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_16_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_16_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_16_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_16_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_16_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_16_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_16_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_and_32_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_and_32_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_and_32_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_and_32_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_and_32_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_and_32_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_and_32_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_8_d(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(DY(mc68kcpu) &= (OPER_I_8(mc68kcpu) | 0xffffff00)); - - (mc68kcpu)->n_flag = NFLAG_8((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_andi_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 res = src & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 res = src & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 res = src & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 res = src & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 res = src & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 res = src & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 res = src & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 res = src & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 res = src & m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_16_d(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(DY(mc68kcpu) &= (OPER_I_16(mc68kcpu) | 0xffff0000)); - - (mc68kcpu)->n_flag = NFLAG_16((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_andi_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 res = src & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 res = src & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 res = src & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 res = src & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 res = src & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 res = src & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 res = src & m68ki_read_16((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_32_d(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DY(mc68kcpu) &= (OPER_I_32(mc68kcpu)); - - (mc68kcpu)->n_flag = NFLAG_32((mc68kcpu)->not_z_flag); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_andi_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 res = src & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 res = src & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 res = src & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 res = src & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 res = src & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 res = src & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 res = src & m68ki_read_32((mc68kcpu), ea); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_andi_16_toc(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), m68ki_get_ccr(mc68kcpu) & OPER_I_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_andi_16_tos(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 src = OPER_I_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), m68ki_get_sr(mc68kcpu) & src); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_asr_8_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src >> shift; - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(GET_MSB_8(src)) - res |= m68ki_shift_8_table[shift]; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << (9-shift); -} - - -void m68000_base_device_ops::m68k_op_asr_16_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src >> shift; - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(GET_MSB_16(src)) - res |= m68ki_shift_16_table[shift]; - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << (9-shift); -} - - -void m68000_base_device_ops::m68k_op_asr_32_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = *r_dst; - UINT32 res = src >> shift; - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(GET_MSB_32(src)) - res |= m68ki_shift_32_table[shift]; - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << (9-shift); -} - - -void m68000_base_device_ops::m68k_op_asr_8_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src >> shift; - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift < 8) - { - if(GET_MSB_8(src)) - res |= m68ki_shift_8_table[shift]; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << (9-shift); - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - if(GET_MSB_8(src)) - { - *r_dst |= 0xff; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - (mc68kcpu)->n_flag = NFLAG_SET; - (mc68kcpu)->not_z_flag = ZFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - *r_dst &= 0xffffff00; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_8(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_asr_16_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src >> shift; - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift < 16) - { - if(GET_MSB_16(src)) - res |= m68ki_shift_16_table[shift]; - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = (src >> (shift - 1))<<8; - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - if(GET_MSB_16(src)) - { - *r_dst |= 0xffff; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - (mc68kcpu)->n_flag = NFLAG_SET; - (mc68kcpu)->not_z_flag = ZFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - *r_dst &= 0xffff0000; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_16(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_asr_32_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = *r_dst; - UINT32 res = src >> shift; - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift < 32) - { - if(GET_MSB_32(src)) - res |= m68ki_shift_32_table[shift]; - - *r_dst = res; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = (src >> (shift - 1))<<8; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - if(GET_MSB_32(src)) - { - *r_dst = 0xffffffff; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - (mc68kcpu)->n_flag = NFLAG_SET; - (mc68kcpu)->not_z_flag = ZFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - *r_dst = 0; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_32(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_asr_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - if(GET_MSB_16(src)) - res |= 0x8000; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; -} - - -void m68000_base_device_ops::m68k_op_asr_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - if(GET_MSB_16(src)) - res |= 0x8000; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; -} - - -void m68000_base_device_ops::m68k_op_asr_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - if(GET_MSB_16(src)) - res |= 0x8000; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; -} - - -void m68000_base_device_ops::m68k_op_asr_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - if(GET_MSB_16(src)) - res |= 0x8000; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; -} - - -void m68000_base_device_ops::m68k_op_asr_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - if(GET_MSB_16(src)) - res |= 0x8000; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; -} - - -void m68000_base_device_ops::m68k_op_asr_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - if(GET_MSB_16(src)) - res |= 0x8000; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; -} - - -void m68000_base_device_ops::m68k_op_asr_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - if(GET_MSB_16(src)) - res |= 0x8000; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; -} - - -void m68000_base_device_ops::m68k_op_asl_8_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = MASK_OUT_ABOVE_8(src << shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << shift; - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - src &= m68ki_shift_8_table[shift + 1]; - (mc68kcpu)->v_flag = (!(src == 0 || (src == m68ki_shift_8_table[shift + 1] && shift < 8)))<<7; -} - - -void m68000_base_device_ops::m68k_op_asl_16_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = MASK_OUT_ABOVE_16(src << shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> (8-shift); - src &= m68ki_shift_16_table[shift + 1]; - (mc68kcpu)->v_flag = (!(src == 0 || src == m68ki_shift_16_table[shift + 1]))<<7; -} - - -void m68000_base_device_ops::m68k_op_asl_32_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = *r_dst; - UINT32 res = MASK_OUT_ABOVE_32(src << shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> (24-shift); - src &= m68ki_shift_32_table[shift + 1]; - (mc68kcpu)->v_flag = (!(src == 0 || src == m68ki_shift_32_table[shift + 1]))<<7; -} - - -void m68000_base_device_ops::m68k_op_asl_8_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = MASK_OUT_ABOVE_8(src << shift); - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift < 8) - { - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << shift; - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - src &= m68ki_shift_8_table[shift + 1]; - (mc68kcpu)->v_flag = (!(src == 0 || src == m68ki_shift_8_table[shift + 1]))<<7; - return; - } - - *r_dst &= 0xffffff00; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = ((shift == 8 ? src & 1 : 0))<<8; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = (!(src == 0))<<7; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_8(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_asl_16_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = MASK_OUT_ABOVE_16(src << shift); - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift < 16) - { - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = (src << shift) >> 8; - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - src &= m68ki_shift_16_table[shift + 1]; - (mc68kcpu)->v_flag = (!(src == 0 || src == m68ki_shift_16_table[shift + 1]))<<7; - return; - } - - *r_dst &= 0xffff0000; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = ((shift == 16 ? src & 1 : 0))<<8; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = (!(src == 0))<<7; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_16(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_asl_32_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = *r_dst; - UINT32 res = MASK_OUT_ABOVE_32(src << shift); - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift < 32) - { - *r_dst = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = (src >> (32 - shift)) << 8; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - src &= m68ki_shift_32_table[shift + 1]; - (mc68kcpu)->v_flag = (!(src == 0 || src == m68ki_shift_32_table[shift + 1]))<<7; - return; - } - - *r_dst = 0; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = ((shift == 32 ? src & 1 : 0))<<8; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = (!(src == 0))<<7; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_32(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_asl_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - src &= 0xc000; - (mc68kcpu)->v_flag = (!(src == 0 || src == 0xc000))<<7; -} - - -void m68000_base_device_ops::m68k_op_asl_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - src &= 0xc000; - (mc68kcpu)->v_flag = (!(src == 0 || src == 0xc000))<<7; -} - - -void m68000_base_device_ops::m68k_op_asl_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - src &= 0xc000; - (mc68kcpu)->v_flag = (!(src == 0 || src == 0xc000))<<7; -} - - -void m68000_base_device_ops::m68k_op_asl_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - src &= 0xc000; - (mc68kcpu)->v_flag = (!(src == 0 || src == 0xc000))<<7; -} - - -void m68000_base_device_ops::m68k_op_asl_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - src &= 0xc000; - (mc68kcpu)->v_flag = (!(src == 0 || src == 0xc000))<<7; -} - - -void m68000_base_device_ops::m68k_op_asl_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - src &= 0xc000; - (mc68kcpu)->v_flag = (!(src == 0 || src == 0xc000))<<7; -} - - -void m68000_base_device_ops::m68k_op_asl_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - src &= 0xc000; - (mc68kcpu)->v_flag = (!(src == 0 || src == 0xc000))<<7; -} - - -void m68000_base_device_ops::m68k_op_bhi_8(m68000_base_device* mc68kcpu) -{ - if(COND_HI(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_bls_8(m68000_base_device* mc68kcpu) -{ - if(COND_LS(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_bcc_8(m68000_base_device* mc68kcpu) -{ - if(COND_CC(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_bcs_8(m68000_base_device* mc68kcpu) -{ - if(COND_CS(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_bne_8(m68000_base_device* mc68kcpu) -{ - if(COND_NE(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_beq_8(m68000_base_device* mc68kcpu) -{ - if(COND_EQ(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_bvc_8(m68000_base_device* mc68kcpu) -{ - if(COND_VC(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_bvs_8(m68000_base_device* mc68kcpu) -{ - if(COND_VS(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_bpl_8(m68000_base_device* mc68kcpu) -{ - if(COND_PL(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_bmi_8(m68000_base_device* mc68kcpu) -{ - if(COND_MI(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_bge_8(m68000_base_device* mc68kcpu) -{ - if(COND_GE(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_blt_8(m68000_base_device* mc68kcpu) -{ - if(COND_LT(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_bgt_8(m68000_base_device* mc68kcpu) -{ - if(COND_GT(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_ble_8(m68000_base_device* mc68kcpu) -{ - if(COND_LE(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; -} - - -void m68000_base_device_ops::m68k_op_bhi_16(m68000_base_device* mc68kcpu) -{ - if(COND_HI(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_bls_16(m68000_base_device* mc68kcpu) -{ - if(COND_LS(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_bcc_16(m68000_base_device* mc68kcpu) -{ - if(COND_CC(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_bcs_16(m68000_base_device* mc68kcpu) -{ - if(COND_CS(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_bne_16(m68000_base_device* mc68kcpu) -{ - if(COND_NE(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_beq_16(m68000_base_device* mc68kcpu) -{ - if(COND_EQ(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_bvc_16(m68000_base_device* mc68kcpu) -{ - if(COND_VC(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_bvs_16(m68000_base_device* mc68kcpu) -{ - if(COND_VS(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_bpl_16(m68000_base_device* mc68kcpu) -{ - if(COND_PL(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_bmi_16(m68000_base_device* mc68kcpu) -{ - if(COND_MI(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_bge_16(m68000_base_device* mc68kcpu) -{ - if(COND_GE(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_blt_16(m68000_base_device* mc68kcpu) -{ - if(COND_LT(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_bgt_16(m68000_base_device* mc68kcpu) -{ - if(COND_GT(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_ble_16(m68000_base_device* mc68kcpu) -{ - if(COND_LE(mc68kcpu)) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_w; -} - - -void m68000_base_device_ops::m68k_op_bhi_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_HI(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_HI(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_bls_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LS(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_LS(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_bcc_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_CC(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_CC(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_bcs_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_CS(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_CS(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_bne_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_NE(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_NE(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_beq_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_EQ(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_EQ(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_bvc_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_VC(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_VC(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_bvs_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_VS(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_VS(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_bpl_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_PL(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_PL(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_bmi_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_MI(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_MI(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_bge_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_GE(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_GE(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_blt_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LT(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_LT(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_bgt_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_GT(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_GT(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_ble_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LE(mc68kcpu)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - else - { - if(COND_LE(mc68kcpu)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - return; - } - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_bcc_notake_b; - } -} - - -void m68000_base_device_ops::m68k_op_bchg_32_r_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 mask = 1 << (DX(mc68kcpu) & 0x1f); - - (mc68kcpu)->not_z_flag = *r_dst & mask; - *r_dst ^= mask; -} - - -void m68000_base_device_ops::m68k_op_bchg_8_r_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_r_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_r_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_r_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_r_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_r_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_r_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_r_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_r_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_32_s_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 0x1f); - - (mc68kcpu)->not_z_flag = *r_dst & mask; - *r_dst ^= mask; -} - - -void m68000_base_device_ops::m68k_op_bchg_8_s_ai(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_s_pi(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_s_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_s_pd(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_s_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_s_di(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_s_ix(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_s_aw(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bchg_8_s_al(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src ^ mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_32_r_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 mask = 1 << (DX(mc68kcpu) & 0x1f); - - (mc68kcpu)->not_z_flag = *r_dst & mask; - *r_dst &= ~mask; -} - - -void m68000_base_device_ops::m68k_op_bclr_8_r_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_r_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_r_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_r_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_r_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_r_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_r_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_r_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_r_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_32_s_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 0x1f); - - (mc68kcpu)->not_z_flag = *r_dst & mask; - *r_dst &= ~mask; -} - - -void m68000_base_device_ops::m68k_op_bclr_8_s_ai(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_s_pi(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_s_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_s_pd(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_s_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_s_di(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_s_ix(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_s_aw(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bclr_8_s_al(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src & ~mask); -} - - -void m68000_base_device_ops::m68k_op_bfchg_32_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32* data = &DY(mc68kcpu); - UINT64 mask; - - - if(BIT_B(word2)) - offset = REG_D(mc68kcpu)[offset&7]; - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - offset &= 31; - width = ((width-1) & 31) + 1; - - mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask = ROR_32(mask, offset); - - (mc68kcpu)->n_flag = NFLAG_32(*data<not_z_flag = *data & mask; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - *data ^= mask; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfchg_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_AI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long ^ mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte ^ mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfchg_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_DI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long ^ mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte ^ mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfchg_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_IX_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long ^ mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte ^ mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfchg_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AW_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long ^ mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte ^ mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfchg_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AL_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long ^ mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte ^ mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfclr_32_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32* data = &DY(mc68kcpu); - UINT64 mask; - - - if(BIT_B(word2)) - offset = REG_D(mc68kcpu)[offset&7]; - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - - offset &= 31; - width = ((width-1) & 31) + 1; - - - mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask = ROR_32(mask, offset); - - (mc68kcpu)->n_flag = NFLAG_32(*data<not_z_flag = *data & mask; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - *data &= ~mask; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfclr_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_AI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long & ~mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte & ~mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfclr_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_DI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long & ~mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte & ~mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfclr_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_IX_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long & ~mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte & ~mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfclr_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AW_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long & ~mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte & ~mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfclr_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AL_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long & ~mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte & ~mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfexts_32_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT64 data = DY(mc68kcpu); - - - if(BIT_B(word2)) - offset = REG_D(mc68kcpu)[offset&7]; - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - offset &= 31; - width = ((width-1) & 31) + 1; - - data = ROL_32(data, offset); - (mc68kcpu)->n_flag = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2>>12)&7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfexts_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_AY_AI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfexts_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_AY_DI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfexts_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_AY_IX_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfexts_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_AW_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfexts_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_AL_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfexts_32_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_PCDI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfexts_32_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_PCIX_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfextu_32_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT64 data = DY(mc68kcpu); - - - if(BIT_B(word2)) - offset = REG_D(mc68kcpu)[offset&7]; - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - offset &= 31; - width = ((width-1) & 31) + 1; - - data = ROL_32(data, offset); - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= 32 - width; - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2>>12)&7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfextu_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_AY_AI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfextu_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_AY_DI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfextu_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_AY_IX_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfextu_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_AW_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfextu_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_AL_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfextu_32_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_PCDI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfextu_32_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 data; - UINT32 ea = EA_PCIX_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - REG_D(mc68kcpu)[(word2 >> 12) & 7] = data; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfffo_32_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT64 data = DY(mc68kcpu); - UINT32 bit; - - - if(BIT_B(word2)) - offset = REG_D(mc68kcpu)[offset&7]; - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - offset &= 31; - width = ((width-1) & 31) + 1; - - data = ROL_32(data, offset); - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= 32 - width; - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; - - REG_D(mc68kcpu)[(word2>>12)&7] = offset; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfffo_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - INT32 local_offset; - UINT32 width = word2; - UINT32 data; - UINT32 bit; - UINT32 ea = EA_AY_AI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << local_offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; - - REG_D(mc68kcpu)[(word2>>12)&7] = offset; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfffo_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - INT32 local_offset; - UINT32 width = word2; - UINT32 data; - UINT32 bit; - UINT32 ea = EA_AY_DI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << local_offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; - - REG_D(mc68kcpu)[(word2>>12)&7] = offset; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfffo_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - INT32 local_offset; - UINT32 width = word2; - UINT32 data; - UINT32 bit; - UINT32 ea = EA_AY_IX_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << local_offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; - - REG_D(mc68kcpu)[(word2>>12)&7] = offset; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfffo_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - INT32 local_offset; - UINT32 width = word2; - UINT32 data; - UINT32 bit; - UINT32 ea = EA_AW_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << local_offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; - - REG_D(mc68kcpu)[(word2>>12)&7] = offset; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfffo_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - INT32 local_offset; - UINT32 width = word2; - UINT32 data; - UINT32 bit; - UINT32 ea = EA_AL_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << local_offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; - - REG_D(mc68kcpu)[(word2>>12)&7] = offset; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfffo_32_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - INT32 local_offset; - UINT32 width = word2; - UINT32 data; - UINT32 bit; - UINT32 ea = EA_PCDI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << local_offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; - - REG_D(mc68kcpu)[(word2>>12)&7] = offset; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfffo_32_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - INT32 local_offset; - UINT32 width = word2; - UINT32 data; - UINT32 bit; - UINT32 ea = EA_PCIX_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - data = (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8((mc68kcpu), ea+4) << local_offset) >> 8; - - (mc68kcpu)->n_flag = NFLAG_32(data); - data >>= (32 - width); - - (mc68kcpu)->not_z_flag = data; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; - - REG_D(mc68kcpu)[(word2>>12)&7] = offset; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfins_32_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32* data = &DY(mc68kcpu); - UINT64 mask; - UINT64 insert = REG_D(mc68kcpu)[(word2>>12)&7]; - - - if(BIT_B(word2)) - offset = REG_D(mc68kcpu)[offset&7]; - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - - offset &= 31; - width = ((width-1) & 31) + 1; - - - mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask = ROR_32(mask, offset); - - insert = MASK_OUT_ABOVE_32(insert << (32 - width)); - (mc68kcpu)->n_flag = NFLAG_32(insert); - (mc68kcpu)->not_z_flag = insert; - insert = ROR_32(insert, offset); - - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - *data &= ~mask; - *data |= insert; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfins_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 insert_base = REG_D(mc68kcpu)[(word2>>12)&7]; - UINT32 insert_long; - UINT32 insert_byte; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_AI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); - (mc68kcpu)->n_flag = NFLAG_32(insert_base); - (mc68kcpu)->not_z_flag = insert_base; - insert_long = insert_base >> offset; - - data_long = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) < 8) - { - m68ki_write_8((mc68kcpu), ea, ((data_long & ~mask_long) | insert_long) >> 24); - } - else if((width + offset) < 16) - { - m68ki_write_16((mc68kcpu), ea, ((data_long & ~mask_long) | insert_long) >> 16); - } - else - { - m68ki_write_32((mc68kcpu), ea, (data_long & ~mask_long) | insert_long); - } - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - insert_byte = MASK_OUT_ABOVE_8(insert_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (insert_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, (data_byte & ~mask_byte) | insert_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfins_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 insert_base = REG_D(mc68kcpu)[(word2>>12)&7]; - UINT32 insert_long; - UINT32 insert_byte; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_DI_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); - (mc68kcpu)->n_flag = NFLAG_32(insert_base); - (mc68kcpu)->not_z_flag = insert_base; - insert_long = insert_base >> offset; - - data_long = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) < 8) - { - m68ki_write_8((mc68kcpu), ea, ((data_long & ~mask_long) | insert_long) >> 24); - } - else if((width + offset) < 16) - { - m68ki_write_16((mc68kcpu), ea, ((data_long & ~mask_long) | insert_long) >> 16); - } - else - { - m68ki_write_32((mc68kcpu), ea, (data_long & ~mask_long) | insert_long); - } - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - insert_byte = MASK_OUT_ABOVE_8(insert_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (insert_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, (data_byte & ~mask_byte) | insert_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfins_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 insert_base = REG_D(mc68kcpu)[(word2>>12)&7]; - UINT32 insert_long; - UINT32 insert_byte; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_IX_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); - (mc68kcpu)->n_flag = NFLAG_32(insert_base); - (mc68kcpu)->not_z_flag = insert_base; - insert_long = insert_base >> offset; - - data_long = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) < 8) - { - m68ki_write_8((mc68kcpu), ea, ((data_long & ~mask_long) | insert_long) >> 24); - } - else if((width + offset) < 16) - { - m68ki_write_16((mc68kcpu), ea, ((data_long & ~mask_long) | insert_long) >> 16); - } - else - { - m68ki_write_32((mc68kcpu), ea, (data_long & ~mask_long) | insert_long); - } - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - insert_byte = MASK_OUT_ABOVE_8(insert_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (insert_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, (data_byte & ~mask_byte) | insert_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfins_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 insert_base = REG_D(mc68kcpu)[(word2>>12)&7]; - UINT32 insert_long; - UINT32 insert_byte; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AW_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); - (mc68kcpu)->n_flag = NFLAG_32(insert_base); - (mc68kcpu)->not_z_flag = insert_base; - insert_long = insert_base >> offset; - - data_long = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) < 8) - { - m68ki_write_8((mc68kcpu), ea, ((data_long & ~mask_long) | insert_long) >> 24); - } - else if((width + offset) < 16) - { - m68ki_write_16((mc68kcpu), ea, ((data_long & ~mask_long) | insert_long) >> 16); - } - else - { - m68ki_write_32((mc68kcpu), ea, (data_long & ~mask_long) | insert_long); - } - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - insert_byte = MASK_OUT_ABOVE_8(insert_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (insert_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, (data_byte & ~mask_byte) | insert_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfins_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 insert_base = REG_D(mc68kcpu)[(word2>>12)&7]; - UINT32 insert_long; - UINT32 insert_byte; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AL_8(mc68kcpu); - - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - if(BIT_B(word2)) - { - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); - (mc68kcpu)->n_flag = NFLAG_32(insert_base); - (mc68kcpu)->not_z_flag = insert_base; - insert_long = insert_base >> offset; - - data_long = (offset+width) < 8 ? (m68ki_read_8((mc68kcpu), ea) << 24) : - (offset+width) < 16 ? (m68ki_read_16((mc68kcpu), ea) << 16) : m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) < 8) - { - m68ki_write_8((mc68kcpu), ea, ((data_long & ~mask_long) | insert_long) >> 24); - } - else if((width + offset) < 16) - { - m68ki_write_16((mc68kcpu), ea, ((data_long & ~mask_long) | insert_long) >> 16); - } - else - { - m68ki_write_32((mc68kcpu), ea, (data_long & ~mask_long) | insert_long); - } - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - insert_byte = MASK_OUT_ABOVE_8(insert_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (insert_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, (data_byte & ~mask_byte) | insert_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfset_32_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32* data = &DY(mc68kcpu); - UINT64 mask; - - - if(BIT_B(word2)) - offset = REG_D(mc68kcpu)[offset&7]; - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - - offset &= 31; - width = ((width-1) & 31) + 1; - - - mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask = ROR_32(mask, offset); - - (mc68kcpu)->n_flag = NFLAG_32(*data<not_z_flag = *data & mask; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - *data |= mask; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfset_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_AI_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long | mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte | mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfset_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_DI_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long | mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte | mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfset_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_IX_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long | mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte | mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfset_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AW_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long | mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte | mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bfset_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AL_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = NFLAG_32(data_long << offset); - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - m68ki_write_32((mc68kcpu), ea, data_long | mask_long); - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - m68ki_write_8((mc68kcpu), ea+4, data_byte | mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bftst_32_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32* data = &DY(mc68kcpu); - UINT64 mask; - - - if(BIT_B(word2)) - offset = REG_D(mc68kcpu)[offset&7]; - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - - offset &= 31; - width = ((width-1) & 31) + 1; - - - mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask = ROR_32(mask, offset); - - (mc68kcpu)->n_flag = NFLAG_32(*data<not_z_flag = *data & mask; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bftst_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_AI_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = ((data_long & (0x80000000 >> offset))<>24; - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bftst_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_DI_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = ((data_long & (0x80000000 >> offset))<>24; - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bftst_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AY_IX_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = ((data_long & (0x80000000 >> offset))<>24; - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bftst_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AW_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = ((data_long & (0x80000000 >> offset))<>24; - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bftst_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_AL_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = ((data_long & (0x80000000 >> offset))<>24; - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bftst_32_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_PCDI_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = ((data_long & (0x80000000 >> offset))<>24; - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bftst_32_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - INT32 offset = (word2>>6)&31; - UINT32 width = word2; - UINT32 mask_base; - UINT32 data_long; - UINT32 mask_long; - UINT32 data_byte = 0; - UINT32 mask_byte = 0; - UINT32 ea = EA_PCIX_8(mc68kcpu); - - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D(mc68kcpu)[offset&7]); - if(BIT_5(word2)) - width = REG_D(mc68kcpu)[width&7]; - - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; - - - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; - - data_long = m68ki_read_32((mc68kcpu), ea); - (mc68kcpu)->n_flag = ((data_long & (0x80000000 >> offset))<>24; - (mc68kcpu)->not_z_flag = data_long & mask_long; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base) << (8-offset); - data_byte = m68ki_read_8((mc68kcpu), ea+4); - (mc68kcpu)->not_z_flag |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bkpt(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if (!(mc68kcpu)->bkpt_ack_callback.isnull()) - ((mc68kcpu)->bkpt_ack_callback)((*mc68kcpu->program), 0, CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type) ? (mc68kcpu)->ir & 7 : 0, 0xffffffff); - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_bra_8(m68000_base_device* mc68kcpu) -{ - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - if(REG_PC(mc68kcpu) == REG_PPC(mc68kcpu) && (mc68kcpu)->remaining_cycles > 0) - (mc68kcpu)->remaining_cycles = 0; -} - - -void m68000_base_device_ops::m68k_op_bra_16(m68000_base_device* mc68kcpu) -{ - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - if(REG_PC(mc68kcpu) == REG_PPC(mc68kcpu) && (mc68kcpu)->remaining_cycles > 0) - (mc68kcpu)->remaining_cycles = 0; -} - - -void m68000_base_device_ops::m68k_op_bra_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - REG_PC(mc68kcpu) -= 4; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32((mc68kcpu), offset); - if(REG_PC(mc68kcpu) == REG_PPC(mc68kcpu) && (mc68kcpu)->remaining_cycles > 0) - (mc68kcpu)->remaining_cycles = 0; - return; - } - else - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - if(REG_PC(mc68kcpu) == REG_PPC(mc68kcpu) && (mc68kcpu)->remaining_cycles > 0) - (mc68kcpu)->remaining_cycles = 0; - } -} - - -void m68000_base_device_ops::m68k_op_bset_32_r_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 mask = 1 << (DX(mc68kcpu) & 0x1f); - - (mc68kcpu)->not_z_flag = *r_dst & mask; - *r_dst |= mask; -} - - -void m68000_base_device_ops::m68k_op_bset_8_r_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_r_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_r_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_r_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_r_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_r_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_r_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_r_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_r_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 mask = 1 << (DX(mc68kcpu) & 7); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_32_s_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 0x1f); - - (mc68kcpu)->not_z_flag = *r_dst & mask; - *r_dst |= mask; -} - - -void m68000_base_device_ops::m68k_op_bset_8_s_ai(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_s_pi(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_s_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_s_pd(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_s_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_s_di(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_s_ix(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_s_aw(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bset_8_s_al(m68000_base_device* mc68kcpu) -{ - UINT32 mask = 1 << (OPER_I_8(mc68kcpu) & 7); - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = src & mask; - m68ki_write_8((mc68kcpu), ea, src | mask); -} - - -void m68000_base_device_ops::m68k_op_bsr_8(m68000_base_device* mc68kcpu) -{ - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32((mc68kcpu), REG_PC(mc68kcpu)); - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); -} - - -void m68000_base_device_ops::m68k_op_bsr_16(m68000_base_device* mc68kcpu) -{ - UINT32 offset = OPER_I_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32((mc68kcpu), REG_PC(mc68kcpu)); - REG_PC(mc68kcpu) -= 2; - m68ki_branch_16((mc68kcpu), offset); -} - - -void m68000_base_device_ops::m68k_op_bsr_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 offset = OPER_I_32(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32((mc68kcpu), REG_PC(mc68kcpu)); - REG_PC(mc68kcpu) -= 4; - m68ki_branch_32((mc68kcpu), offset); - return; - } - else - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32((mc68kcpu), REG_PC(mc68kcpu)); - m68ki_branch_8((mc68kcpu), MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - } -} - - -void m68000_base_device_ops::m68k_op_btst_32_r_d(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DY(mc68kcpu) & (1 << (DX(mc68kcpu) & 0x1f)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_ai(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_AY_AI_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_pi(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_AY_PI_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_pi7(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_A7_PI_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_pd(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_AY_PD_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_pd7(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_A7_PD_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_di(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_AY_DI_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_ix(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_AY_IX_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_aw(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_AW_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_al(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_AL_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_pcdi(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_PCDI_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_pcix(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_PCIX_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_r_i(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = OPER_I_8(mc68kcpu) & (1 << (DX(mc68kcpu) & 7)); -} - - -void m68000_base_device_ops::m68k_op_btst_32_s_d(m68000_base_device* mc68kcpu) -{ - (mc68kcpu)->not_z_flag = DY(mc68kcpu) & (1 << (OPER_I_8(mc68kcpu) & 0x1f)); -} - - -void m68000_base_device_ops::m68k_op_btst_8_s_ai(m68000_base_device* mc68kcpu) -{ - UINT32 bit = OPER_I_8(mc68kcpu) & 7; - - (mc68kcpu)->not_z_flag = OPER_AY_AI_8(mc68kcpu) & (1 << bit); -} - - -void m68000_base_device_ops::m68k_op_btst_8_s_pi(m68000_base_device* mc68kcpu) -{ - UINT32 bit = OPER_I_8(mc68kcpu) & 7; - - (mc68kcpu)->not_z_flag = OPER_AY_PI_8(mc68kcpu) & (1 << bit); -} - - -void m68000_base_device_ops::m68k_op_btst_8_s_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 bit = OPER_I_8(mc68kcpu) & 7; - - (mc68kcpu)->not_z_flag = OPER_A7_PI_8(mc68kcpu) & (1 << bit); -} - - -void m68000_base_device_ops::m68k_op_btst_8_s_pd(m68000_base_device* mc68kcpu) -{ - UINT32 bit = OPER_I_8(mc68kcpu) & 7; - - (mc68kcpu)->not_z_flag = OPER_AY_PD_8(mc68kcpu) & (1 << bit); -} - - -void m68000_base_device_ops::m68k_op_btst_8_s_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 bit = OPER_I_8(mc68kcpu) & 7; - - (mc68kcpu)->not_z_flag = OPER_A7_PD_8(mc68kcpu) & (1 << bit); -} - - -void m68000_base_device_ops::m68k_op_btst_8_s_di(m68000_base_device* mc68kcpu) -{ - UINT32 bit = OPER_I_8(mc68kcpu) & 7; - - (mc68kcpu)->not_z_flag = OPER_AY_DI_8(mc68kcpu) & (1 << bit); -} - - -void m68000_base_device_ops::m68k_op_btst_8_s_ix(m68000_base_device* mc68kcpu) -{ - UINT32 bit = OPER_I_8(mc68kcpu) & 7; - - (mc68kcpu)->not_z_flag = OPER_AY_IX_8(mc68kcpu) & (1 << bit); -} - - -void m68000_base_device_ops::m68k_op_btst_8_s_aw(m68000_base_device* mc68kcpu) -{ - UINT32 bit = OPER_I_8(mc68kcpu) & 7; - - (mc68kcpu)->not_z_flag = OPER_AW_8(mc68kcpu) & (1 << bit); -} - - -void m68000_base_device_ops::m68k_op_btst_8_s_al(m68000_base_device* mc68kcpu) -{ - UINT32 bit = OPER_I_8(mc68kcpu) & 7; - - (mc68kcpu)->not_z_flag = OPER_AL_8(mc68kcpu) & (1 << bit); -} - - -void m68000_base_device_ops::m68k_op_btst_8_s_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 bit = OPER_I_8(mc68kcpu) & 7; - - (mc68kcpu)->not_z_flag = OPER_PCDI_8(mc68kcpu) & (1 << bit); -} - - -void m68000_base_device_ops::m68k_op_btst_8_s_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 bit = OPER_I_8(mc68kcpu) & 7; - - (mc68kcpu)->not_z_flag = OPER_PCIX_8(mc68kcpu) & (1 << bit); -} - - -void m68000_base_device_ops::m68k_op_callm_32_ai(m68000_base_device* mc68kcpu) -{ - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - { - UINT32 ea = EA_AY_AI_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - REG_PC(mc68kcpu) += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (callm)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_callm_32_di(m68000_base_device* mc68kcpu) -{ - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - { - UINT32 ea = EA_AY_DI_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - REG_PC(mc68kcpu) += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (callm)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_callm_32_ix(m68000_base_device* mc68kcpu) -{ - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - { - UINT32 ea = EA_AY_IX_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - REG_PC(mc68kcpu) += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (callm)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_callm_32_aw(m68000_base_device* mc68kcpu) -{ - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - { - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - REG_PC(mc68kcpu) += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (callm)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_callm_32_al(m68000_base_device* mc68kcpu) -{ - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - { - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - REG_PC(mc68kcpu) += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (callm)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_callm_32_pcdi(m68000_base_device* mc68kcpu) -{ - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - { - UINT32 ea = EA_PCDI_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - REG_PC(mc68kcpu) += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (callm)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_callm_32_pcix(m68000_base_device* mc68kcpu) -{ - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - { - UINT32 ea = EA_PCIX_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - REG_PC(mc68kcpu) += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (callm)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_8_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 dest = m68ki_read_8((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_8(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_8(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_8_pi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 dest = m68ki_read_8((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_8(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_8(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_8_pi7(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 dest = m68ki_read_8((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_8(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_8(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_8_pd(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 dest = m68ki_read_8((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_8(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_8(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_8_pd7(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dest = m68ki_read_8((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_8(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_8(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_8_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 dest = m68ki_read_8((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_8(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_8(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_8_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 dest = m68ki_read_8((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_8(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_8(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_8_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 dest = m68ki_read_8((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_8(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_8(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_8_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 dest = m68ki_read_8((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_8(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_8(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_16_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 dest = m68ki_read_16((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_16(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_16(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_16_pi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 dest = m68ki_read_16((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_16(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_16(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_16_pd(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 dest = m68ki_read_16((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_16(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_16(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_16_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 dest = m68ki_read_16((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_16(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_16(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_16_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 dest = m68ki_read_16((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_16(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_16(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_16_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 dest = m68ki_read_16((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_16(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_16(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_16_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 dest = m68ki_read_16((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - MASK_OUT_ABOVE_16(*compare); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_16(res); - - if(COND_NE(mc68kcpu)) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_D(mc68kcpu)[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 dest = m68ki_read_32((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - *compare; - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(*compare, dest, res); - - if(COND_NE(mc68kcpu)) - *compare = dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_32((mc68kcpu), ea, REG_D(mc68kcpu)[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_32_pi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 dest = m68ki_read_32((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - *compare; - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(*compare, dest, res); - - if(COND_NE(mc68kcpu)) - *compare = dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_32((mc68kcpu), ea, REG_D(mc68kcpu)[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_32_pd(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 dest = m68ki_read_32((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - *compare; - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(*compare, dest, res); - - if(COND_NE(mc68kcpu)) - *compare = dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_32((mc68kcpu), ea, REG_D(mc68kcpu)[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 dest = m68ki_read_32((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - *compare; - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(*compare, dest, res); - - if(COND_NE(mc68kcpu)) - *compare = dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_32((mc68kcpu), ea, REG_D(mc68kcpu)[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 dest = m68ki_read_32((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - *compare; - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(*compare, dest, res); - - if(COND_NE(mc68kcpu)) - *compare = dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_32((mc68kcpu), ea, REG_D(mc68kcpu)[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 dest = m68ki_read_32((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - *compare; - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(*compare, dest, res); - - if(COND_NE(mc68kcpu)) - *compare = dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_32((mc68kcpu), ea, REG_D(mc68kcpu)[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 dest = m68ki_read_32((mc68kcpu), ea); - UINT32* compare = ®_D(mc68kcpu)[word2 & 7]; - UINT32 res = dest - *compare; - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(*compare, dest, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(*compare, dest, res); - - if(COND_NE(mc68kcpu)) - *compare = dest; - else - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_32((mc68kcpu), ea, REG_D(mc68kcpu)[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas2_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_32(mc68kcpu); - UINT32* compare1 = ®_D(mc68kcpu)[(word2 >> 16) & 7]; - UINT32 ea1 = REG_DA(mc68kcpu)[(word2 >> 28) & 15]; - UINT32 dest1 = m68ki_read_16((mc68kcpu), ea1); - UINT32 res1 = dest1 - MASK_OUT_ABOVE_16(*compare1); - UINT32* compare2 = ®_D(mc68kcpu)[word2 & 7]; - UINT32 ea2 = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - UINT32 dest2 = m68ki_read_16((mc68kcpu), ea2); - UINT32 res2; - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_16(res1); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res1); - (mc68kcpu)->v_flag = VFLAG_SUB_16(*compare1, dest1, res1); - (mc68kcpu)->c_flag = CFLAG_16(res1); - - if(COND_EQ(mc68kcpu)) - { - res2 = dest2 - MASK_OUT_ABOVE_16(*compare2); - - (mc68kcpu)->n_flag = NFLAG_16(res2); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res2); - (mc68kcpu)->v_flag = VFLAG_SUB_16(*compare2, dest2, res2); - (mc68kcpu)->c_flag = CFLAG_16(res2); - - if(COND_EQ(mc68kcpu)) - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_16((mc68kcpu), ea1, REG_D(mc68kcpu)[(word2 >> 22) & 7]); - m68ki_write_16((mc68kcpu), ea2, REG_D(mc68kcpu)[(word2 >> 6) & 7]); - return; - } - } - *compare1 = BIT_1F(word2) ? MAKE_INT_16(dest1) : MASK_OUT_BELOW_16(*compare1) | dest1; - *compare2 = BIT_F(word2) ? MAKE_INT_16(dest2) : MASK_OUT_BELOW_16(*compare2) | dest2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cas2_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_32(mc68kcpu); - UINT32* compare1 = ®_D(mc68kcpu)[(word2 >> 16) & 7]; - UINT32 ea1 = REG_DA(mc68kcpu)[(word2 >> 28) & 15]; - UINT32 dest1 = m68ki_read_32((mc68kcpu), ea1); - UINT32 res1 = dest1 - *compare1; - UINT32* compare2 = ®_D(mc68kcpu)[word2 & 7]; - UINT32 ea2 = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - UINT32 dest2 = m68ki_read_32((mc68kcpu), ea2); - UINT32 res2; - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->n_flag = NFLAG_32(res1); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res1); - (mc68kcpu)->v_flag = VFLAG_SUB_32(*compare1, dest1, res1); - (mc68kcpu)->c_flag = CFLAG_SUB_32(*compare1, dest1, res1); - - if(COND_EQ(mc68kcpu)) - { - res2 = dest2 - *compare2; - - (mc68kcpu)->n_flag = NFLAG_32(res2); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res2); - (mc68kcpu)->v_flag = VFLAG_SUB_32(*compare2, dest2, res2); - (mc68kcpu)->c_flag = CFLAG_SUB_32(*compare2, dest2, res2); - - if(COND_EQ(mc68kcpu)) - { - (mc68kcpu)->remaining_cycles -= 3; - m68ki_write_32((mc68kcpu), ea1, REG_D(mc68kcpu)[(word2 >> 22) & 7]); - m68ki_write_32((mc68kcpu), ea2, REG_D(mc68kcpu)[(word2 >> 6) & 7]); - return; - } - } - *compare1 = dest1; - *compare2 = dest2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk_16_d(m68000_base_device* mc68kcpu) -{ - INT32 src = MAKE_INT_16(DX(mc68kcpu)); - INT32 bound = MAKE_INT_16(DY(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_16(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); -} - - -void m68000_base_device_ops::m68k_op_chk_16_ai(m68000_base_device* mc68kcpu) -{ - INT32 src = MAKE_INT_16(DX(mc68kcpu)); - INT32 bound = MAKE_INT_16(OPER_AY_AI_16(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_16(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); -} - - -void m68000_base_device_ops::m68k_op_chk_16_pi(m68000_base_device* mc68kcpu) -{ - INT32 src = MAKE_INT_16(DX(mc68kcpu)); - INT32 bound = MAKE_INT_16(OPER_AY_PI_16(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_16(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); -} - - -void m68000_base_device_ops::m68k_op_chk_16_pd(m68000_base_device* mc68kcpu) -{ - INT32 src = MAKE_INT_16(DX(mc68kcpu)); - INT32 bound = MAKE_INT_16(OPER_AY_PD_16(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_16(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); -} - - -void m68000_base_device_ops::m68k_op_chk_16_di(m68000_base_device* mc68kcpu) -{ - INT32 src = MAKE_INT_16(DX(mc68kcpu)); - INT32 bound = MAKE_INT_16(OPER_AY_DI_16(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_16(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); -} - - -void m68000_base_device_ops::m68k_op_chk_16_ix(m68000_base_device* mc68kcpu) -{ - INT32 src = MAKE_INT_16(DX(mc68kcpu)); - INT32 bound = MAKE_INT_16(OPER_AY_IX_16(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_16(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); -} - - -void m68000_base_device_ops::m68k_op_chk_16_aw(m68000_base_device* mc68kcpu) -{ - INT32 src = MAKE_INT_16(DX(mc68kcpu)); - INT32 bound = MAKE_INT_16(OPER_AW_16(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_16(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); -} - - -void m68000_base_device_ops::m68k_op_chk_16_al(m68000_base_device* mc68kcpu) -{ - INT32 src = MAKE_INT_16(DX(mc68kcpu)); - INT32 bound = MAKE_INT_16(OPER_AL_16(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_16(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); -} - - -void m68000_base_device_ops::m68k_op_chk_16_pcdi(m68000_base_device* mc68kcpu) -{ - INT32 src = MAKE_INT_16(DX(mc68kcpu)); - INT32 bound = MAKE_INT_16(OPER_PCDI_16(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_16(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); -} - - -void m68000_base_device_ops::m68k_op_chk_16_pcix(m68000_base_device* mc68kcpu) -{ - INT32 src = MAKE_INT_16(DX(mc68kcpu)); - INT32 bound = MAKE_INT_16(OPER_PCIX_16(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_16(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); -} - - -void m68000_base_device_ops::m68k_op_chk_16_i(m68000_base_device* mc68kcpu) -{ - INT32 src = MAKE_INT_16(DX(mc68kcpu)); - INT32 bound = MAKE_INT_16(OPER_I_16(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_16(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); -} - - -void m68000_base_device_ops::m68k_op_chk_32_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - INT32 src = MAKE_INT_32(DX(mc68kcpu)); - INT32 bound = MAKE_INT_32(DY(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_32(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - INT32 src = MAKE_INT_32(DX(mc68kcpu)); - INT32 bound = MAKE_INT_32(OPER_AY_AI_32(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_32(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk_32_pi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - INT32 src = MAKE_INT_32(DX(mc68kcpu)); - INT32 bound = MAKE_INT_32(OPER_AY_PI_32(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_32(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk_32_pd(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - INT32 src = MAKE_INT_32(DX(mc68kcpu)); - INT32 bound = MAKE_INT_32(OPER_AY_PD_32(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_32(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - INT32 src = MAKE_INT_32(DX(mc68kcpu)); - INT32 bound = MAKE_INT_32(OPER_AY_DI_32(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_32(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - INT32 src = MAKE_INT_32(DX(mc68kcpu)); - INT32 bound = MAKE_INT_32(OPER_AY_IX_32(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_32(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - INT32 src = MAKE_INT_32(DX(mc68kcpu)); - INT32 bound = MAKE_INT_32(OPER_AW_32(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_32(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - INT32 src = MAKE_INT_32(DX(mc68kcpu)); - INT32 bound = MAKE_INT_32(OPER_AL_32(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_32(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk_32_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - INT32 src = MAKE_INT_32(DX(mc68kcpu)); - INT32 bound = MAKE_INT_32(OPER_PCDI_32(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_32(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk_32_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - INT32 src = MAKE_INT_32(DX(mc68kcpu)); - INT32 bound = MAKE_INT_32(OPER_PCIX_32(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_32(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk_32_i(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - INT32 src = MAKE_INT_32(DX(mc68kcpu)); - INT32 bound = MAKE_INT_32(OPER_I_32(mc68kcpu)); - - (mc68kcpu)->not_z_flag = ZFLAG_32(src); /* Undocumented */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undocumented */ - (mc68kcpu)->c_flag = CFLAG_CLEAR; /* Undocumented */ - - if(src >= 0 && src <= bound) - { - return; - } - (mc68kcpu)->n_flag = (src < 0)<<7; - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_8_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xff; - UINT32 ea = EA_PCDI_8(mc68kcpu); - UINT32 lower_bound = m68ki_read_pcrel_8((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_pcrel_8((mc68kcpu), ea + 1); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_8_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xff; - UINT32 ea = EA_PCIX_8(mc68kcpu); - UINT32 lower_bound = m68ki_read_pcrel_8((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_pcrel_8((mc68kcpu), ea + 1); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_8_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xff; - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 lower_bound = m68ki_read_8((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_8((mc68kcpu), ea + 1); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_8_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xff; - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 lower_bound = m68ki_read_8((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_8((mc68kcpu), ea + 1); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_8_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xff; - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 lower_bound = m68ki_read_8((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_8((mc68kcpu), ea + 1); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_8_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xff; - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 lower_bound = m68ki_read_8((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_8((mc68kcpu), ea + 1); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_8_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xff; - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 lower_bound = m68ki_read_8((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_8((mc68kcpu), ea + 1); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_16_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xffff; - UINT32 ea = EA_PCDI_16(mc68kcpu); - UINT32 lower_bound = m68ki_read_pcrel_16((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_pcrel_16((mc68kcpu), ea + 2); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - (mc68kcpu)->c_flag = upper_bound - compare; - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_16_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xffff; - UINT32 ea = EA_PCIX_16(mc68kcpu); - UINT32 lower_bound = m68ki_read_pcrel_16((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_pcrel_16((mc68kcpu), ea + 2); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - (mc68kcpu)->c_flag = upper_bound - compare; - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_16_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xffff; - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 lower_bound = m68ki_read_16((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_16((mc68kcpu), ea + 2); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - (mc68kcpu)->c_flag = upper_bound - compare; - - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_16_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xffff; - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 lower_bound = m68ki_read_16((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_16((mc68kcpu), ea + 2); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - (mc68kcpu)->c_flag = upper_bound - compare; - - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_16_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xffff; - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 lower_bound = m68ki_read_16((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_16((mc68kcpu), ea + 2); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - (mc68kcpu)->c_flag = upper_bound - compare; - - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_16_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xffff; - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 lower_bound = m68ki_read_16((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_16((mc68kcpu), ea + 2); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - (mc68kcpu)->c_flag = upper_bound - compare; - - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_16_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]&0xffff; - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 lower_bound = m68ki_read_16((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_16((mc68kcpu), ea + 2); - - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - (mc68kcpu)->c_flag = compare - lower_bound; - - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - if(!BIT_F(word2)) - (mc68kcpu)->c_flag = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - (mc68kcpu)->c_flag = upper_bound - compare; - - (mc68kcpu)->c_flag = CFLAG_16((mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_32_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - UINT32 ea = EA_PCDI_32(mc68kcpu); - UINT32 lower_bound = m68ki_read_pcrel_32((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_pcrel_32((mc68kcpu), ea + 4); - - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_SUB_32(lower_bound, compare, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - (mc68kcpu)->c_flag = CFLAG_SUB_32(compare, upper_bound, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_32_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - UINT32 ea = EA_PCIX_32(mc68kcpu); - UINT32 lower_bound = m68ki_read_pcrel_32((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_pcrel_32((mc68kcpu), ea + 4); - - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_SUB_32(lower_bound, compare, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - (mc68kcpu)->c_flag = CFLAG_SUB_32(compare, upper_bound, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 lower_bound = m68ki_read_32((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_32((mc68kcpu), ea + 4); - - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_SUB_32(lower_bound, compare, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - (mc68kcpu)->c_flag = CFLAG_SUB_32(compare, upper_bound, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 lower_bound = m68ki_read_32((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_32((mc68kcpu), ea + 4); - - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_SUB_32(lower_bound, compare, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - (mc68kcpu)->c_flag = CFLAG_SUB_32(compare, upper_bound, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 lower_bound = m68ki_read_32((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_32((mc68kcpu), ea + 4); - - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_SUB_32(lower_bound, compare, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - (mc68kcpu)->c_flag = CFLAG_SUB_32(compare, upper_bound, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 lower_bound = m68ki_read_32((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_32((mc68kcpu), ea + 4); - - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_SUB_32(lower_bound, compare, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - (mc68kcpu)->c_flag = CFLAG_SUB_32(compare, upper_bound, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_chk2cmp2_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 compare = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 lower_bound = m68ki_read_32((mc68kcpu), ea); - UINT32 upper_bound = m68ki_read_32((mc68kcpu), ea + 4); - - (mc68kcpu)->c_flag = compare - lower_bound; - (mc68kcpu)->not_z_flag = !((upper_bound==compare) | (lower_bound==compare)); - (mc68kcpu)->c_flag = CFLAG_SUB_32(lower_bound, compare, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu)) - { - if(BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - - (mc68kcpu)->c_flag = upper_bound - compare; - (mc68kcpu)->c_flag = CFLAG_SUB_32(compare, upper_bound, (mc68kcpu)->c_flag); - if(COND_CS(mc68kcpu) && BIT_B(word2)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_clr_8_d(m68000_base_device* mc68kcpu) -{ - DY(mc68kcpu) &= 0xffffff00; - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_8((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_8((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_8((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_8((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_8((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_8((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_8((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_8((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_8((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_8((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_8((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_8((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_8((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_8((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_8((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_8((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_8((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_8((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_16_d(m68000_base_device* mc68kcpu) -{ - DY(mc68kcpu) &= 0xffff0000; - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_16((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_16((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_16((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_16((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_16((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_16((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_16((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_16((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_16((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_16((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_16((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_16((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_16((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_16((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_32_d(m68000_base_device* mc68kcpu) -{ - DY(mc68kcpu) = 0; - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_32(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_32((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_32((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_32(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_32((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_32((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_32(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_32((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_32((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_32((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_32((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_32(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_32((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_32((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_32(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_32((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_32((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_clr_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_32(mc68kcpu); - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - m68ki_read_32((mc68kcpu), ea); /* the 68000 does a dummy read, the value is discarded */ - } - - m68ki_write_32((mc68kcpu), ea, 0); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; -} - - -void m68000_base_device_ops::m68k_op_cmp_8_d(m68000_base_device* mc68kcpu) -{ - UINT32 src = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_AI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_DI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_IX_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AW_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AL_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_PCDI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_PCIX_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_8_i(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_d(m68000_base_device* mc68kcpu) -{ - UINT32 src = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_a(m68000_base_device* mc68kcpu) -{ - UINT32 src = MASK_OUT_ABOVE_16(AY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_AI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_DI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_IX_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AW_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AL_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_PCDI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_PCIX_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_16_i(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_d(m68000_base_device* mc68kcpu) -{ - UINT32 src = DY(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_a(m68000_base_device* mc68kcpu) -{ - UINT32 src = AY(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_AI_32(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PI_32(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_32(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_DI_32(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_IX_32(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AW_32(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AL_32(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_PCDI_32(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_PCIX_32(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmp_32_i(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = DX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_d(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(DY(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_a(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(AY(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(OPER_AY_AI_16(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(OPER_AY_PI_16(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(OPER_AY_PD_16(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(OPER_AY_DI_16(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(OPER_AY_IX_16(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(OPER_AW_16(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(OPER_AL_16(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(OPER_PCDI_16(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(OPER_PCIX_16(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_16_i(m68000_base_device* mc68kcpu) -{ - UINT32 src = MAKE_INT_16(OPER_I_16(mc68kcpu)); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_d(m68000_base_device* mc68kcpu) -{ - UINT32 src = DY(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_a(m68000_base_device* mc68kcpu) -{ - UINT32 src = AY(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_AI_32(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PI_32(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_32(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_DI_32(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_IX_32(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AW_32(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AL_32(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_PCDI_32(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_PCIX_32(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpa_32_i(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = AX(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_d(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = OPER_AY_AI_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = OPER_AY_PI_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = OPER_A7_PI_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = OPER_AY_PD_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = OPER_A7_PD_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = OPER_AY_DI_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = OPER_AY_IX_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = OPER_AW_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = OPER_AL_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = OPER_PCDI_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cmpi_8_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = OPER_PCIX_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cmpi_16_d(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = OPER_AY_AI_16(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = OPER_AY_PI_16(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = OPER_AY_PD_16(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = OPER_AY_DI_16(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = OPER_AY_IX_16(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = OPER_AW_16(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = OPER_AL_16(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_16_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = OPER_PCDI_16(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cmpi_16_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = OPER_PCIX_16(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cmpi_32_d(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = DY(mc68kcpu); - UINT32 res = dst - src; - - if (!(mc68kcpu)->cmpild_instr_callback.isnull()) - ((mc68kcpu)->cmpild_instr_callback)(*(mc68kcpu)->program, (mc68kcpu)->ir & 7, src, 0xffffffff); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = OPER_AY_AI_32(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = OPER_AY_PI_32(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = OPER_AY_PD_32(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = OPER_AY_DI_32(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = OPER_AY_IX_32(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = OPER_AW_32(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = OPER_AL_32(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cmpi_32_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = OPER_PCDI_32(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cmpi_32_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = OPER_PCIX_32(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cmpm_8_ax7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PI_8(mc68kcpu); - UINT32 dst = OPER_A7_PI_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpm_8_ay7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PI_8(mc68kcpu); - UINT32 dst = OPER_AX_PI_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpm_8_axy7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PI_8(mc68kcpu); - UINT32 dst = OPER_A7_PI_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpm_8(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PI_8(mc68kcpu); - UINT32 dst = OPER_AX_PI_8(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_8(res); -} - - -void m68000_base_device_ops::m68k_op_cmpm_16(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PI_16(mc68kcpu); - UINT32 dst = OPER_AX_PI_16(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_16(res); -} - - -void m68000_base_device_ops::m68k_op_cmpm_32(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PI_32(mc68kcpu); - UINT32 dst = OPER_AX_PI_32(mc68kcpu); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); -} - - -void m68000_base_device_ops::m68k_op_cpbcc_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (cpbcc)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cpdbcc_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (cpdbcc)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cpgen_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type) && (mc68kcpu->has_fpu || mc68kcpu->has_pmmu)) - { - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (cpgen)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cpscc_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (cpscc)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cptrapcc_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (cptrapcc)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_ftrapcc_32(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->has_fpu) - { - m68881_ftrap(mc68kcpu); - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_dbt_16(m68000_base_device* mc68kcpu) -{ - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbf_16(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; -} - - -void m68000_base_device_ops::m68k_op_dbhi_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_HI(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbls_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_LS(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbcc_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_CC(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbcs_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_CS(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbne_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_NE(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbeq_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_EQ(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbvc_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_VC(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbvs_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_VS(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbpl_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_PL(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbmi_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_MI(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbge_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_GE(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dblt_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_LT(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dbgt_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_GT(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_dble_16(m68000_base_device* mc68kcpu) -{ - if(COND_NOT_LE(mc68kcpu)) - { - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(*r_dst - 1); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - UINT32 offset = OPER_I_16(mc68kcpu); - REG_PC(mc68kcpu) -= 2; - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16((mc68kcpu), offset); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_noexp; - return; - } - REG_PC(mc68kcpu) += 2; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_dbcc_f_exp; - return; - } - REG_PC(mc68kcpu) += 2; -} - - -void m68000_base_device_ops::m68k_op_divs_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - INT32 src = MAKE_INT_16(DY(mc68kcpu)); - INT32 quotient; - INT32 remainder; - - if(src != 0) - { - if((UINT32)*r_dst == 0x80000000 && src == -1) - { - (mc68kcpu)->not_z_flag = 0; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = 0; - return; - } - - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; - - if(quotient == MAKE_INT_16(quotient)) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divs_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - INT32 src = MAKE_INT_16(OPER_AY_AI_16(mc68kcpu)); - INT32 quotient; - INT32 remainder; - - if(src != 0) - { - if((UINT32)*r_dst == 0x80000000 && src == -1) - { - (mc68kcpu)->not_z_flag = 0; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = 0; - return; - } - - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; - - if(quotient == MAKE_INT_16(quotient)) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divs_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - INT32 src = MAKE_INT_16(OPER_AY_PI_16(mc68kcpu)); - INT32 quotient; - INT32 remainder; - - if(src != 0) - { - if((UINT32)*r_dst == 0x80000000 && src == -1) - { - (mc68kcpu)->not_z_flag = 0; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = 0; - return; - } - - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; - - if(quotient == MAKE_INT_16(quotient)) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divs_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - INT32 src = MAKE_INT_16(OPER_AY_PD_16(mc68kcpu)); - INT32 quotient; - INT32 remainder; - - if(src != 0) - { - if((UINT32)*r_dst == 0x80000000 && src == -1) - { - (mc68kcpu)->not_z_flag = 0; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = 0; - return; - } - - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; - - if(quotient == MAKE_INT_16(quotient)) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divs_16_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - INT32 src = MAKE_INT_16(OPER_AY_DI_16(mc68kcpu)); - INT32 quotient; - INT32 remainder; - - if(src != 0) - { - if((UINT32)*r_dst == 0x80000000 && src == -1) - { - (mc68kcpu)->not_z_flag = 0; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = 0; - return; - } - - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; - - if(quotient == MAKE_INT_16(quotient)) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divs_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - INT32 src = MAKE_INT_16(OPER_AY_IX_16(mc68kcpu)); - INT32 quotient; - INT32 remainder; - - if(src != 0) - { - if((UINT32)*r_dst == 0x80000000 && src == -1) - { - (mc68kcpu)->not_z_flag = 0; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = 0; - return; - } - - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; - - if(quotient == MAKE_INT_16(quotient)) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divs_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - INT32 src = MAKE_INT_16(OPER_AW_16(mc68kcpu)); - INT32 quotient; - INT32 remainder; - - if(src != 0) - { - if((UINT32)*r_dst == 0x80000000 && src == -1) - { - (mc68kcpu)->not_z_flag = 0; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = 0; - return; - } - - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; - - if(quotient == MAKE_INT_16(quotient)) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divs_16_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - INT32 src = MAKE_INT_16(OPER_AL_16(mc68kcpu)); - INT32 quotient; - INT32 remainder; - - if(src != 0) - { - if((UINT32)*r_dst == 0x80000000 && src == -1) - { - (mc68kcpu)->not_z_flag = 0; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = 0; - return; - } - - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; - - if(quotient == MAKE_INT_16(quotient)) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divs_16_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - INT32 src = MAKE_INT_16(OPER_PCDI_16(mc68kcpu)); - INT32 quotient; - INT32 remainder; - - if(src != 0) - { - if((UINT32)*r_dst == 0x80000000 && src == -1) - { - (mc68kcpu)->not_z_flag = 0; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = 0; - return; - } - - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; - - if(quotient == MAKE_INT_16(quotient)) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divs_16_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - INT32 src = MAKE_INT_16(OPER_PCIX_16(mc68kcpu)); - INT32 quotient; - INT32 remainder; - - if(src != 0) - { - if((UINT32)*r_dst == 0x80000000 && src == -1) - { - (mc68kcpu)->not_z_flag = 0; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = 0; - return; - } - - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; - - if(quotient == MAKE_INT_16(quotient)) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divs_16_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - INT32 src = MAKE_INT_16(OPER_I_16(mc68kcpu)); - INT32 quotient; - INT32 remainder; - - if(src != 0) - { - if((UINT32)*r_dst == 0x80000000 && src == -1) - { - (mc68kcpu)->not_z_flag = 0; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = 0; - return; - } - - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; - - if(quotient == MAKE_INT_16(quotient)) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divu_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - - if(src != 0) - { - UINT32 quotient = *r_dst / src; - UINT32 remainder = *r_dst % src; - - if(quotient < 0x10000) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divu_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_AI_16(mc68kcpu); - - if(src != 0) - { - UINT32 quotient = *r_dst / src; - UINT32 remainder = *r_dst % src; - - if(quotient < 0x10000) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divu_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PI_16(mc68kcpu); - - if(src != 0) - { - UINT32 quotient = *r_dst / src; - UINT32 remainder = *r_dst % src; - - if(quotient < 0x10000) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divu_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PD_16(mc68kcpu); - - if(src != 0) - { - UINT32 quotient = *r_dst / src; - UINT32 remainder = *r_dst % src; - - if(quotient < 0x10000) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divu_16_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_DI_16(mc68kcpu); - - if(src != 0) - { - UINT32 quotient = *r_dst / src; - UINT32 remainder = *r_dst % src; - - if(quotient < 0x10000) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divu_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_IX_16(mc68kcpu); - - if(src != 0) - { - UINT32 quotient = *r_dst / src; - UINT32 remainder = *r_dst % src; - - if(quotient < 0x10000) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divu_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AW_16(mc68kcpu); - - if(src != 0) - { - UINT32 quotient = *r_dst / src; - UINT32 remainder = *r_dst % src; - - if(quotient < 0x10000) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divu_16_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AL_16(mc68kcpu); - - if(src != 0) - { - UINT32 quotient = *r_dst / src; - UINT32 remainder = *r_dst % src; - - if(quotient < 0x10000) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divu_16_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCDI_16(mc68kcpu); - - if(src != 0) - { - UINT32 quotient = *r_dst / src; - UINT32 remainder = *r_dst % src; - - if(quotient < 0x10000) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divu_16_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCIX_16(mc68kcpu); - - if(src != 0) - { - UINT32 quotient = *r_dst / src; - UINT32 remainder = *r_dst % src; - - if(quotient < 0x10000) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divu_16_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_I_16(mc68kcpu); - - if(src != 0) - { - UINT32 quotient = *r_dst / src; - UINT32 remainder = *r_dst % src; - - if(quotient < 0x10000) - { - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->n_flag = NFLAG_16(quotient); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); -} - - -void m68000_base_device_ops::m68k_op_divl_32_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 divisor = DY(mc68kcpu); - UINT64 dividend = 0; - UINT64 quotient = 0; - UINT64 remainder = 0; - - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D(mc68kcpu)[word2 & 7]; - dividend <<= 32; - dividend |= REG_D(mc68kcpu)[(word2 >> 12) & 7]; - - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)dividend / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)dividend % (INT64)((INT32)divisor)); - if((INT64)quotient != (INT64)((INT32)quotient)) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)((INT32)dividend) / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)((INT32)dividend) % (INT64)((INT32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } - - REG_D(mc68kcpu)[word2 & 7] = remainder; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = quotient; - - (mc68kcpu)->n_flag = NFLAG_32(quotient); - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_divl_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 divisor = OPER_AY_AI_32(mc68kcpu); - UINT64 dividend = 0; - UINT64 quotient = 0; - UINT64 remainder = 0; - - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D(mc68kcpu)[word2 & 7]; - dividend <<= 32; - dividend |= REG_D(mc68kcpu)[(word2 >> 12) & 7]; - - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)dividend / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)dividend % (INT64)((INT32)divisor)); - if((INT64)quotient != (INT64)((INT32)quotient)) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)((INT32)dividend) / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)((INT32)dividend) % (INT64)((INT32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } - - REG_D(mc68kcpu)[word2 & 7] = remainder; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = quotient; - - (mc68kcpu)->n_flag = NFLAG_32(quotient); - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_divl_32_pi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 divisor = OPER_AY_PI_32(mc68kcpu); - UINT64 dividend = 0; - UINT64 quotient = 0; - UINT64 remainder = 0; - - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D(mc68kcpu)[word2 & 7]; - dividend <<= 32; - dividend |= REG_D(mc68kcpu)[(word2 >> 12) & 7]; - - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)dividend / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)dividend % (INT64)((INT32)divisor)); - if((INT64)quotient != (INT64)((INT32)quotient)) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)((INT32)dividend) / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)((INT32)dividend) % (INT64)((INT32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } - - REG_D(mc68kcpu)[word2 & 7] = remainder; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = quotient; - - (mc68kcpu)->n_flag = NFLAG_32(quotient); - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_divl_32_pd(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 divisor = OPER_AY_PD_32(mc68kcpu); - UINT64 dividend = 0; - UINT64 quotient = 0; - UINT64 remainder = 0; - - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D(mc68kcpu)[word2 & 7]; - dividend <<= 32; - dividend |= REG_D(mc68kcpu)[(word2 >> 12) & 7]; - - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)dividend / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)dividend % (INT64)((INT32)divisor)); - if((INT64)quotient != (INT64)((INT32)quotient)) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)((INT32)dividend) / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)((INT32)dividend) % (INT64)((INT32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } - - REG_D(mc68kcpu)[word2 & 7] = remainder; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = quotient; - - (mc68kcpu)->n_flag = NFLAG_32(quotient); - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_divl_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 divisor = OPER_AY_DI_32(mc68kcpu); - UINT64 dividend = 0; - UINT64 quotient = 0; - UINT64 remainder = 0; - - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D(mc68kcpu)[word2 & 7]; - dividend <<= 32; - dividend |= REG_D(mc68kcpu)[(word2 >> 12) & 7]; - - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)dividend / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)dividend % (INT64)((INT32)divisor)); - if((INT64)quotient != (INT64)((INT32)quotient)) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)((INT32)dividend) / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)((INT32)dividend) % (INT64)((INT32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } - - REG_D(mc68kcpu)[word2 & 7] = remainder; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = quotient; - - (mc68kcpu)->n_flag = NFLAG_32(quotient); - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_divl_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 divisor = OPER_AY_IX_32(mc68kcpu); - UINT64 dividend = 0; - UINT64 quotient = 0; - UINT64 remainder = 0; - - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D(mc68kcpu)[word2 & 7]; - dividend <<= 32; - dividend |= REG_D(mc68kcpu)[(word2 >> 12) & 7]; - - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)dividend / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)dividend % (INT64)((INT32)divisor)); - if((INT64)quotient != (INT64)((INT32)quotient)) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)((INT32)dividend) / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)((INT32)dividend) % (INT64)((INT32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } - - REG_D(mc68kcpu)[word2 & 7] = remainder; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = quotient; - - (mc68kcpu)->n_flag = NFLAG_32(quotient); - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_divl_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 divisor = OPER_AW_32(mc68kcpu); - UINT64 dividend = 0; - UINT64 quotient = 0; - UINT64 remainder = 0; - - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D(mc68kcpu)[word2 & 7]; - dividend <<= 32; - dividend |= REG_D(mc68kcpu)[(word2 >> 12) & 7]; - - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)dividend / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)dividend % (INT64)((INT32)divisor)); - if((INT64)quotient != (INT64)((INT32)quotient)) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)((INT32)dividend) / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)((INT32)dividend) % (INT64)((INT32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } - - REG_D(mc68kcpu)[word2 & 7] = remainder; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = quotient; - - (mc68kcpu)->n_flag = NFLAG_32(quotient); - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_divl_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 divisor = OPER_AL_32(mc68kcpu); - UINT64 dividend = 0; - UINT64 quotient = 0; - UINT64 remainder = 0; - - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D(mc68kcpu)[word2 & 7]; - dividend <<= 32; - dividend |= REG_D(mc68kcpu)[(word2 >> 12) & 7]; - - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)dividend / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)dividend % (INT64)((INT32)divisor)); - if((INT64)quotient != (INT64)((INT32)quotient)) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)((INT32)dividend) / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)((INT32)dividend) % (INT64)((INT32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } - - REG_D(mc68kcpu)[word2 & 7] = remainder; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = quotient; - - (mc68kcpu)->n_flag = NFLAG_32(quotient); - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_divl_32_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 divisor = OPER_PCDI_32(mc68kcpu); - UINT64 dividend = 0; - UINT64 quotient = 0; - UINT64 remainder = 0; - - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D(mc68kcpu)[word2 & 7]; - dividend <<= 32; - dividend |= REG_D(mc68kcpu)[(word2 >> 12) & 7]; - - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)dividend / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)dividend % (INT64)((INT32)divisor)); - if((INT64)quotient != (INT64)((INT32)quotient)) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)((INT32)dividend) / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)((INT32)dividend) % (INT64)((INT32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } - - REG_D(mc68kcpu)[word2 & 7] = remainder; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = quotient; - - (mc68kcpu)->n_flag = NFLAG_32(quotient); - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_divl_32_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 divisor = OPER_PCIX_32(mc68kcpu); - UINT64 dividend = 0; - UINT64 quotient = 0; - UINT64 remainder = 0; - - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D(mc68kcpu)[word2 & 7]; - dividend <<= 32; - dividend |= REG_D(mc68kcpu)[(word2 >> 12) & 7]; - - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)dividend / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)dividend % (INT64)((INT32)divisor)); - if((INT64)quotient != (INT64)((INT32)quotient)) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)((INT32)dividend) / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)((INT32)dividend) % (INT64)((INT32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } - - REG_D(mc68kcpu)[word2 & 7] = remainder; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = quotient; - - (mc68kcpu)->n_flag = NFLAG_32(quotient); - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_divl_32_i(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 divisor = OPER_I_32(mc68kcpu); - UINT64 dividend = 0; - UINT64 quotient = 0; - UINT64 remainder = 0; - - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D(mc68kcpu)[word2 & 7]; - dividend <<= 32; - dividend |= REG_D(mc68kcpu)[(word2 >> 12) & 7]; - - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)dividend / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)dividend % (INT64)((INT32)divisor)); - if((INT64)quotient != (INT64)((INT32)quotient)) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - (mc68kcpu)->v_flag = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (UINT64)((INT64)((INT32)dividend) / (INT64)((INT32)divisor)); - remainder = (UINT64)((INT64)((INT32)dividend) % (INT64)((INT32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } - - REG_D(mc68kcpu)[word2 & 7] = remainder; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = quotient; - - (mc68kcpu)->n_flag = NFLAG_32(quotient); - (mc68kcpu)->not_z_flag = quotient; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_eor_8_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu) ^= MASK_OUT_ABOVE_8(DX(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) ^ m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) ^ m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) ^ m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) ^ m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) ^ m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) ^ m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) ^ m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) ^ m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) ^ m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_16_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu) ^= MASK_OUT_ABOVE_16(DX(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) ^ m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) ^ m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) ^ m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) ^ m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) ^ m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) ^ m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) ^ m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_32_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu) ^= DX(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eor_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_8_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu) ^= OPER_I_8(mc68kcpu)); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 res = src ^ m68ki_read_8((mc68kcpu), ea); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 res = src ^ m68ki_read_8((mc68kcpu), ea); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 res = src ^ m68ki_read_8((mc68kcpu), ea); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 res = src ^ m68ki_read_8((mc68kcpu), ea); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 res = src ^ m68ki_read_8((mc68kcpu), ea); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 res = src ^ m68ki_read_8((mc68kcpu), ea); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 res = src ^ m68ki_read_8((mc68kcpu), ea); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 res = src ^ m68ki_read_8((mc68kcpu), ea); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 res = src ^ m68ki_read_8((mc68kcpu), ea); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_16_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu) ^= OPER_I_16(mc68kcpu)); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 res = src ^ m68ki_read_16((mc68kcpu), ea); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 res = src ^ m68ki_read_16((mc68kcpu), ea); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 res = src ^ m68ki_read_16((mc68kcpu), ea); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 res = src ^ m68ki_read_16((mc68kcpu), ea); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 res = src ^ m68ki_read_16((mc68kcpu), ea); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 res = src ^ m68ki_read_16((mc68kcpu), ea); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 res = src ^ m68ki_read_16((mc68kcpu), ea); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_32_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu) ^= OPER_I_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 res = src ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 res = src ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 res = src ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 res = src ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 res = src ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 res = src ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 res = src ^ m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_eori_16_toc(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), m68ki_get_ccr(mc68kcpu) ^ OPER_I_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_eori_16_tos(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 src = OPER_I_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), m68ki_get_sr(mc68kcpu) ^ src); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_exg_32_dd(m68000_base_device* mc68kcpu) -{ - UINT32* reg_a = &DX(mc68kcpu); - UINT32* reg_b = &DY(mc68kcpu); - UINT32 tmp = *reg_a; - *reg_a = *reg_b; - *reg_b = tmp; -} - - -void m68000_base_device_ops::m68k_op_exg_32_aa(m68000_base_device* mc68kcpu) -{ - UINT32* reg_a = &AX(mc68kcpu); - UINT32* reg_b = &AY(mc68kcpu); - UINT32 tmp = *reg_a; - *reg_a = *reg_b; - *reg_b = tmp; -} - - -void m68000_base_device_ops::m68k_op_exg_32_da(m68000_base_device* mc68kcpu) -{ - UINT32* reg_a = &DX(mc68kcpu); - UINT32* reg_b = &AY(mc68kcpu); - UINT32 tmp = *reg_a; - *reg_a = *reg_b; - *reg_b = tmp; -} - - -void m68000_base_device_ops::m68k_op_ext_16(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | MASK_OUT_ABOVE_8(*r_dst) | (GET_MSB_8(*r_dst) ? 0xff00 : 0); - - (mc68kcpu)->n_flag = NFLAG_16(*r_dst); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(*r_dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ext_32(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_16(*r_dst) | (GET_MSB_16(*r_dst) ? 0xffff0000 : 0); - - (mc68kcpu)->n_flag = NFLAG_32(*r_dst); - (mc68kcpu)->not_z_flag = *r_dst; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_extb_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32* r_dst = &DY(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_8(*r_dst) | (GET_MSB_8(*r_dst) ? 0xffffff00 : 0); - - (mc68kcpu)->n_flag = NFLAG_32(*r_dst); - (mc68kcpu)->not_z_flag = *r_dst; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_illegal(m68000_base_device* mc68kcpu) -{ - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_jmp_32_ai(m68000_base_device* mc68kcpu) -{ - m68ki_jump((mc68kcpu), EA_AY_AI_32(mc68kcpu)); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(REG_PC(mc68kcpu) == REG_PPC(mc68kcpu) && (mc68kcpu)->remaining_cycles > 0) - (mc68kcpu)->remaining_cycles = 0; -} - - -void m68000_base_device_ops::m68k_op_jmp_32_di(m68000_base_device* mc68kcpu) -{ - m68ki_jump((mc68kcpu), EA_AY_DI_32(mc68kcpu)); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(REG_PC(mc68kcpu) == REG_PPC(mc68kcpu) && (mc68kcpu)->remaining_cycles > 0) - (mc68kcpu)->remaining_cycles = 0; -} - - -void m68000_base_device_ops::m68k_op_jmp_32_ix(m68000_base_device* mc68kcpu) -{ - m68ki_jump((mc68kcpu), EA_AY_IX_32(mc68kcpu)); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(REG_PC(mc68kcpu) == REG_PPC(mc68kcpu) && (mc68kcpu)->remaining_cycles > 0) - (mc68kcpu)->remaining_cycles = 0; -} - - -void m68000_base_device_ops::m68k_op_jmp_32_aw(m68000_base_device* mc68kcpu) -{ - m68ki_jump((mc68kcpu), EA_AW_32(mc68kcpu)); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(REG_PC(mc68kcpu) == REG_PPC(mc68kcpu) && (mc68kcpu)->remaining_cycles > 0) - (mc68kcpu)->remaining_cycles = 0; -} - - -void m68000_base_device_ops::m68k_op_jmp_32_al(m68000_base_device* mc68kcpu) -{ - m68ki_jump((mc68kcpu), EA_AL_32(mc68kcpu)); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(REG_PC(mc68kcpu) == REG_PPC(mc68kcpu) && (mc68kcpu)->remaining_cycles > 0) - (mc68kcpu)->remaining_cycles = 0; -} - - -void m68000_base_device_ops::m68k_op_jmp_32_pcdi(m68000_base_device* mc68kcpu) -{ - m68ki_jump((mc68kcpu), EA_PCDI_32(mc68kcpu)); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(REG_PC(mc68kcpu) == REG_PPC(mc68kcpu) && (mc68kcpu)->remaining_cycles > 0) - (mc68kcpu)->remaining_cycles = 0; -} - - -void m68000_base_device_ops::m68k_op_jmp_32_pcix(m68000_base_device* mc68kcpu) -{ - m68ki_jump((mc68kcpu), EA_PCIX_32(mc68kcpu)); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(REG_PC(mc68kcpu) == REG_PPC(mc68kcpu) && (mc68kcpu)->remaining_cycles > 0) - (mc68kcpu)->remaining_cycles = 0; -} - - -void m68000_base_device_ops::m68k_op_jsr_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_32(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32((mc68kcpu), REG_PC(mc68kcpu)); - m68ki_jump((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_jsr_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32((mc68kcpu), REG_PC(mc68kcpu)); - m68ki_jump((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_jsr_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_32(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32((mc68kcpu), REG_PC(mc68kcpu)); - m68ki_jump((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_jsr_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_32(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32((mc68kcpu), REG_PC(mc68kcpu)); - m68ki_jump((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_jsr_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_32(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32((mc68kcpu), REG_PC(mc68kcpu)); - m68ki_jump((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_jsr_32_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_PCDI_32(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32((mc68kcpu), REG_PC(mc68kcpu)); - m68ki_jump((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_jsr_32_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_PCIX_32(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32((mc68kcpu), REG_PC(mc68kcpu)); - m68ki_jump((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_lea_32_ai(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = EA_AY_AI_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_lea_32_di(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = EA_AY_DI_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_lea_32_ix(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = EA_AY_IX_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_lea_32_aw(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = EA_AW_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_lea_32_al(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = EA_AL_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_lea_32_pcdi(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = EA_PCDI_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_lea_32_pcix(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = EA_PCIX_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_link_16_a7(m68000_base_device* mc68kcpu) -{ - REG_A(mc68kcpu)[7] -= 4; - m68ki_write_32((mc68kcpu), REG_A(mc68kcpu)[7], REG_A(mc68kcpu)[7]); - REG_A(mc68kcpu)[7] = MASK_OUT_ABOVE_32(REG_A(mc68kcpu)[7] + MAKE_INT_16(OPER_I_16(mc68kcpu))); -} - - -void m68000_base_device_ops::m68k_op_link_16(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AY(mc68kcpu); - - m68ki_push_32((mc68kcpu), *r_dst); - *r_dst = REG_A(mc68kcpu)[7]; - REG_A(mc68kcpu)[7] = MASK_OUT_ABOVE_32(REG_A(mc68kcpu)[7] + MAKE_INT_16(OPER_I_16(mc68kcpu))); -} - - -void m68000_base_device_ops::m68k_op_link_32_a7(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - REG_A(mc68kcpu)[7] -= 4; - m68ki_write_32((mc68kcpu), REG_A(mc68kcpu)[7], REG_A(mc68kcpu)[7]); - REG_A(mc68kcpu)[7] = MASK_OUT_ABOVE_32(REG_A(mc68kcpu)[7] + OPER_I_32(mc68kcpu)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_link_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32* r_dst = &AY(mc68kcpu); - - m68ki_push_32((mc68kcpu), *r_dst); - *r_dst = REG_A(mc68kcpu)[7]; - REG_A(mc68kcpu)[7] = MASK_OUT_ABOVE_32(REG_A(mc68kcpu)[7] + OPER_I_32(mc68kcpu)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_lsr_8_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src >> shift; - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << (9-shift); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_16_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src >> shift; - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << (9-shift); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_32_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = *r_dst; - UINT32 res = src >> shift; - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << (9-shift); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_8_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = src >> shift; - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift <= 8) - { - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << (9-shift); - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - *r_dst &= 0xffffff00; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_8(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_16_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = src >> shift; - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift <= 16) - { - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = (src >> (shift - 1))<<8; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - *r_dst &= 0xffff0000; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_16(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_32_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = *r_dst; - UINT32 res = src >> shift; - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift < 32) - { - *r_dst = res; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = (src >> (shift - 1))<<8; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - *r_dst = 0; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = (shift == 32 ? GET_MSB_32(src)>>23 : 0); - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_32(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsr_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = src >> 1; - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_8_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = MASK_OUT_ABOVE_8(src << shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << shift; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_16_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = MASK_OUT_ABOVE_16(src << shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> (8-shift); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_32_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = *r_dst; - UINT32 res = MASK_OUT_ABOVE_32(src << shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> (24-shift); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_8_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = MASK_OUT_ABOVE_8(src << shift); - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift <= 8) - { - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src << shift; - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - *r_dst &= 0xffffff00; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_8(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_16_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = MASK_OUT_ABOVE_16(src << shift); - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift <= 16) - { - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = (src << shift) >> 8; - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - *r_dst &= 0xffff0000; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_16(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_32_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = DX(mc68kcpu) & 0x3f; - UINT32 src = *r_dst; - UINT32 res = MASK_OUT_ABOVE_32(src << shift); - - if(shift != 0) - { - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - if(shift < 32) - { - *r_dst = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = (src >> (32 - shift)) << 8; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - *r_dst = 0; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = ((shift == 32 ? src & 1 : 0))<<8; - (mc68kcpu)->n_flag = NFLAG_CLEAR; - (mc68kcpu)->not_z_flag = ZFLAG_SET; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_32(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_lsl_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(src << 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PI_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PD_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_d_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_8(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PI_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ai_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AX_AI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PI_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi7_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PI_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pi_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AX_PI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PI_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd7_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PI_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_pd_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PI_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_di_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AX_DI_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PI_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_ix_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AX_IX_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PI_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_aw_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PI_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_8_al_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(AY(mc68kcpu)); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_d_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(AY(mc68kcpu)); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_16(mc68kcpu); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_16(mc68kcpu); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_16(mc68kcpu); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_16(mc68kcpu); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_16(mc68kcpu); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_16(mc68kcpu); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_16(mc68kcpu); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_16(mc68kcpu); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_16(mc68kcpu); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ai_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AX_AI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(AY(mc68kcpu)); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_16(mc68kcpu); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_16(mc68kcpu); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_16(mc68kcpu); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_16(mc68kcpu); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_16(mc68kcpu); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_16(mc68kcpu); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_16(mc68kcpu); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_16(mc68kcpu); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_16(mc68kcpu); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pi_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AX_PI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(AY(mc68kcpu)); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_pd_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(AY(mc68kcpu)); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_16(mc68kcpu); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_16(mc68kcpu); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_16(mc68kcpu); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_16(mc68kcpu); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_16(mc68kcpu); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_16(mc68kcpu); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_16(mc68kcpu); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_16(mc68kcpu); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_16(mc68kcpu); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_di_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AX_DI_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(AY(mc68kcpu)); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_16(mc68kcpu); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_16(mc68kcpu); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_16(mc68kcpu); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_16(mc68kcpu); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_16(mc68kcpu); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_16(mc68kcpu); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_16(mc68kcpu); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_16(mc68kcpu); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_16(mc68kcpu); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_ix_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AX_IX_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(AY(mc68kcpu)); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_aw_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(AY(mc68kcpu)); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_16_al_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = AY(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_32(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_32(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_32(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_32(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_32(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_32(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_32(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_32(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_32(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_d_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_32(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = AY(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_32(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_32(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_32(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_32(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_32(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_32(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_32(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_32(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_32(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ai_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AX_AI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = AY(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_32(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_32(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_32(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_32(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_32(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_32(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_32(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_32(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_32(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pi_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AX_PI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = AY(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_pd_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - - m68ki_write_16((mc68kcpu), ea+2, res & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (res >> 16) & 0xFFFF ); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = AY(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_32(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_32(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_32(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_32(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_32(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_32(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_32(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_32(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_32(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_di_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AX_DI_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = AY(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_32(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_32(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_32(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_32(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_32(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_32(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_32(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_32(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_32(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_ix_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AX_IX_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = AY(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_aw_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_a(m68000_base_device* mc68kcpu) -{ - UINT32 res = AY(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCDI_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_PCIX_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move_32_al_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_movea_16_d(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(DY(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_16_a(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(AY(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_16_ai(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(OPER_AY_AI_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_16_pi(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(OPER_AY_PI_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_16_pd(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(OPER_AY_PD_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_16_di(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(OPER_AY_DI_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_16_ix(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(OPER_AY_IX_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_16_aw(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(OPER_AW_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_16_al(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(OPER_AL_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_16_pcdi(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(OPER_PCDI_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_16_pcix(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(OPER_PCIX_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_16_i(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = MAKE_INT_16(OPER_I_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_movea_32_d(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = DY(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movea_32_a(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = AY(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movea_32_ai(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = OPER_AY_AI_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movea_32_pi(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = OPER_AY_PI_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movea_32_pd(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = OPER_AY_PD_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movea_32_di(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = OPER_AY_DI_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movea_32_ix(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = OPER_AY_IX_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movea_32_aw(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = OPER_AW_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movea_32_al(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = OPER_AL_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movea_32_pcdi(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = OPER_PCDI_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movea_32_pcix(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = OPER_PCIX_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movea_32_i(m68000_base_device* mc68kcpu) -{ - AX(mc68kcpu) = OPER_I_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frc_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - DY(mc68kcpu) = MASK_OUT_BELOW_16(DY(mc68kcpu)) | m68ki_get_ccr(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frc_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - m68ki_write_16((mc68kcpu), EA_AY_AI_16(mc68kcpu), m68ki_get_ccr(mc68kcpu)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frc_pi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - m68ki_write_16((mc68kcpu), EA_AY_PI_16(mc68kcpu), m68ki_get_ccr(mc68kcpu)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frc_pd(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - m68ki_write_16((mc68kcpu), EA_AY_PD_16(mc68kcpu), m68ki_get_ccr(mc68kcpu)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frc_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - m68ki_write_16((mc68kcpu), EA_AY_DI_16(mc68kcpu), m68ki_get_ccr(mc68kcpu)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frc_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - m68ki_write_16((mc68kcpu), EA_AY_IX_16(mc68kcpu), m68ki_get_ccr(mc68kcpu)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frc_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - m68ki_write_16((mc68kcpu), EA_AW_16(mc68kcpu), m68ki_get_ccr(mc68kcpu)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frc_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - m68ki_write_16((mc68kcpu), EA_AL_16(mc68kcpu), m68ki_get_ccr(mc68kcpu)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_toc_d(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), DY(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_move_16_toc_ai(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), OPER_AY_AI_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_move_16_toc_pi(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), OPER_AY_PI_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_move_16_toc_pd(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), OPER_AY_PD_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_move_16_toc_di(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), OPER_AY_DI_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_move_16_toc_ix(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), OPER_AY_IX_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_move_16_toc_aw(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), OPER_AW_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_move_16_toc_al(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), OPER_AL_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_move_16_toc_pcdi(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), OPER_PCDI_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_move_16_toc_pcix(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), OPER_PCIX_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_move_16_toc_i(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), OPER_I_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_move_16_frs_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type) || (mc68kcpu)->s_flag) /* NS990408 */ - { - DY(mc68kcpu) = MASK_OUT_BELOW_16(DY(mc68kcpu)) | m68ki_get_sr(mc68kcpu); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frs_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type) || (mc68kcpu)->s_flag) /* NS990408 */ - { - UINT32 ea = EA_AY_AI_16(mc68kcpu); - m68ki_write_16((mc68kcpu), ea, m68ki_get_sr(mc68kcpu)); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frs_pi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type) || (mc68kcpu)->s_flag) /* NS990408 */ - { - UINT32 ea = EA_AY_PI_16(mc68kcpu); - m68ki_write_16((mc68kcpu), ea, m68ki_get_sr(mc68kcpu)); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frs_pd(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type) || (mc68kcpu)->s_flag) /* NS990408 */ - { - UINT32 ea = EA_AY_PD_16(mc68kcpu); - m68ki_write_16((mc68kcpu), ea, m68ki_get_sr(mc68kcpu)); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frs_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type) || (mc68kcpu)->s_flag) /* NS990408 */ - { - UINT32 ea = EA_AY_DI_16(mc68kcpu); - m68ki_write_16((mc68kcpu), ea, m68ki_get_sr(mc68kcpu)); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frs_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type) || (mc68kcpu)->s_flag) /* NS990408 */ - { - UINT32 ea = EA_AY_IX_16(mc68kcpu); - m68ki_write_16((mc68kcpu), ea, m68ki_get_sr(mc68kcpu)); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frs_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type) || (mc68kcpu)->s_flag) /* NS990408 */ - { - UINT32 ea = EA_AW_16(mc68kcpu); - m68ki_write_16((mc68kcpu), ea, m68ki_get_sr(mc68kcpu)); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_frs_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type) || (mc68kcpu)->s_flag) /* NS990408 */ - { - UINT32 ea = EA_AL_16(mc68kcpu); - m68ki_write_16((mc68kcpu), ea, m68ki_get_sr(mc68kcpu)); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_tos_d(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - m68ki_set_sr((mc68kcpu), DY(mc68kcpu)); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_tos_ai(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr = OPER_AY_AI_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), new_sr); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_tos_pi(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr = OPER_AY_PI_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), new_sr); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_tos_pd(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr = OPER_AY_PD_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), new_sr); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_tos_di(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr = OPER_AY_DI_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), new_sr); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_tos_ix(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr = OPER_AY_IX_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), new_sr); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_tos_aw(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr = OPER_AW_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), new_sr); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_tos_al(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr = OPER_AL_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), new_sr); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_tos_pcdi(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr = OPER_PCDI_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), new_sr); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_tos_pcix(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr = OPER_PCIX_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), new_sr); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_16_tos_i(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr = OPER_I_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), new_sr); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_32_fru(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - AY(mc68kcpu) = REG_USP(mc68kcpu); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_move_32_tou(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - REG_USP(mc68kcpu) = AY(mc68kcpu); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movec_32_cr(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - switch (word2 & 0xfff) - { - case 0x000: /* SFC */ - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = (mc68kcpu)->sfc; - return; - case 0x001: /* DFC */ - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = (mc68kcpu)->dfc; - return; - case 0x002: /* CACR */ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = (mc68kcpu)->cacr; - return; - } - return; - case 0x800: /* USP */ - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = REG_USP(mc68kcpu); - return; - case 0x801: /* VBR */ - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = (mc68kcpu)->vbr; - return; - case 0x802: /* CAAR */ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = (mc68kcpu)->caar; - return; - } - m68ki_exception_illegal(mc68kcpu); - break; - case 0x803: /* MSP */ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = (mc68kcpu)->m_flag ? REG_SP(mc68kcpu) : REG_MSP(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x804: /* ISP */ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = (mc68kcpu)->m_flag ? REG_ISP(mc68kcpu) : REG_SP(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x003: /* TC */ - if(CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_tc; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x004: /* ITT0 (040+, ACR0 on ColdFire) */ - if(CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_itt0; - return; - } - else if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_acr0; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x005: /* ITT1 (040+, ACR1 on ColdFire) */ - if(CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_itt1; - return; - } - else if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_acr1; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x006: /* DTT0 */ - if(CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_dtt0; - return; - } - else if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_acr2; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x007: /* DTT1 */ - if(CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_dtt1; - return; - } - else if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_acr3; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x805: /* MMUSR */ - if(CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_sr_040; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x806: /* URP */ - if(CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_urp_aptr; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x807: /* SRP */ - if(CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = mc68kcpu->mmu_srp_aptr; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc00: // ROMBAR0 - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc01: // ROMBAR1 - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc04: // RAMBAR0 - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc05: // RAMBAR1 - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc0c: // MPCR - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc0d: // EDRAMBAR - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc0e: // SECMBAR - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc0f: // MBAR - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - default: - m68ki_exception_illegal(mc68kcpu); - return; - } - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movec_32_rc(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - switch (word2 & 0xfff) - { - case 0x000: /* SFC */ - (mc68kcpu)->sfc = REG_DA(mc68kcpu)[(word2 >> 12) & 15] & 7; - return; - case 0x001: /* DFC */ - (mc68kcpu)->dfc = REG_DA(mc68kcpu)[(word2 >> 12) & 15] & 7; - return; - case 0x002: /* CACR */ - /* Only EC020 and later have CACR */ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - /* 68030 can write all bits except 5-7, 040 can write all */ - if (CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - (mc68kcpu)->cacr = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - } - else if (CPU_TYPE_IS_030_PLUS((mc68kcpu)->cpu_type)) - { - (mc68kcpu)->cacr = REG_DA(mc68kcpu)[(word2 >> 12) & 15] & 0xff1f; - } - else - { - (mc68kcpu)->cacr = REG_DA(mc68kcpu)[(word2 >> 12) & 15] & 0x0f; - } - -// mc68kcpu->logerror("movec to cacr=%04x\n", (mc68kcpu)->cacr); - if ((mc68kcpu)->cacr & (M68K_CACR_CI | M68K_CACR_CEI)) - { - m68ki_ic_clear(mc68kcpu); - } - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x800: /* USP */ - REG_USP(mc68kcpu) = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - case 0x801: /* VBR */ - (mc68kcpu)->vbr = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - case 0x802: /* CAAR */ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - (mc68kcpu)->caar = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x803: /* MSP */ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - /* we are in supervisor mode so just check for M flag */ - if(!(mc68kcpu)->m_flag) - { - REG_MSP(mc68kcpu) = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - REG_SP(mc68kcpu) = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x804: /* ISP */ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(!(mc68kcpu)->m_flag) - { - REG_SP(mc68kcpu) = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - REG_ISP(mc68kcpu) = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x003: /* TC */ - if (CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_tc = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - - if (mc68kcpu->mmu_tc & 0x8000) - { - mc68kcpu->pmmu_enabled = 1; - } - else - { - mc68kcpu->pmmu_enabled = 0; - } - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x004: /* ITT0 */ - if (CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_itt0 = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - else if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_acr0 = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x005: /* ITT1 */ - if (CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_itt1 = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - else if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_acr1 = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x006: /* DTT0 */ - if (CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_dtt0 = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - else if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_acr2 = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x007: /* DTT1 */ - if (CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_dtt1 = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - else if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_acr3 = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x805: /* MMUSR */ - if (CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_sr_040 = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x806: /* URP */ - if (CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_urp_aptr = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0x807: /* SRP */ - if (CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->mmu_srp_aptr = REG_DA(mc68kcpu)[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc00: // ROMBAR0 - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc01: // ROMBAR1 - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc04: // RAMBAR0 - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc05: // RAMBAR1 - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc0c: // MPCR - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc0d: // EDRAMBAR - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc0e: // SECMBAR - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - case 0xc0f: // MBAR - if(CPU_TYPE_IS_COLDFIRE((mc68kcpu)->cpu_type)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(mc68kcpu); - return; - default: - m68ki_exception_illegal(mc68kcpu); - return; - } - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_movem_16_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = AY(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - ea -= 2; - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[15-i])); - count++; - } - AY(mc68kcpu) = ea; - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[i])); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[i])); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[i])); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[i])); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - m68ki_write_16((mc68kcpu), ea, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[i])); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_32_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = AY(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - ea -= 4; - m68ki_write_16((mc68kcpu), ea+2, REG_DA(mc68kcpu)[15-i] & 0xFFFF ); - m68ki_write_16((mc68kcpu), ea, (REG_DA(mc68kcpu)[15-i] >> 16) & 0xFFFF ); - count++; - } - AY(mc68kcpu) = ea; - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - m68ki_write_32((mc68kcpu), ea, REG_DA(mc68kcpu)[i]); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - m68ki_write_32((mc68kcpu), ea, REG_DA(mc68kcpu)[i]); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - m68ki_write_32((mc68kcpu), ea, REG_DA(mc68kcpu)[i]); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - m68ki_write_32((mc68kcpu), ea, REG_DA(mc68kcpu)[i]); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - m68ki_write_32((mc68kcpu), ea, REG_DA(mc68kcpu)[i]); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_16_er_pi(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = AY(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_16((mc68kcpu), ea))); - ea += 2; - count++; - } - AY(mc68kcpu) = ea; - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_er_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_PCDI_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_pcrel_16((mc68kcpu), ea))); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_er_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_PCIX_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_pcrel_16((mc68kcpu), ea))); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_er_ai(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_16((mc68kcpu), ea))); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_er_di(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_16((mc68kcpu), ea))); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_er_ix(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_16((mc68kcpu), ea))); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_er_aw(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_16((mc68kcpu), ea))); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_16_er_al(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = MAKE_INT_16(MASK_OUT_ABOVE_16(m68ki_read_16((mc68kcpu), ea))); - ea += 2; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_w; -} - - -void m68000_base_device_ops::m68k_op_movem_32_er_pi(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = AY(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = m68ki_read_32((mc68kcpu), ea); - ea += 4; - count++; - } - AY(mc68kcpu) = ea; - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_er_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_PCDI_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = m68ki_read_pcrel_32((mc68kcpu), ea); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_er_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_PCIX_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = m68ki_read_pcrel_32((mc68kcpu), ea); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_er_ai(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = m68ki_read_32((mc68kcpu), ea); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_er_di(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = m68ki_read_32((mc68kcpu), ea); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_er_ix(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = m68ki_read_32((mc68kcpu), ea); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_er_aw(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = m68ki_read_32((mc68kcpu), ea); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movem_32_er_al(m68000_base_device* mc68kcpu) -{ - UINT32 i = 0; - UINT32 register_list = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 count = 0; - - for(; i < 16; i++) - if(register_list & (1 << i)) - { - REG_DA(mc68kcpu)[i] = m68ki_read_32((mc68kcpu), ea); - ea += 4; - count++; - } - - (mc68kcpu)->remaining_cycles -= count<<(mc68kcpu)->cyc_movem_l; -} - - -void m68000_base_device_ops::m68k_op_movep_16_re(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = DX(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(src >> 8)); - m68ki_write_8((mc68kcpu), ea += 2, MASK_OUT_ABOVE_8(src)); -} - - -void m68000_base_device_ops::m68k_op_movep_32_re(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(src >> 24)); - m68ki_write_8((mc68kcpu), ea += 2, MASK_OUT_ABOVE_8(src >> 16)); - m68ki_write_8((mc68kcpu), ea += 2, MASK_OUT_ABOVE_8(src >> 8)); - m68ki_write_8((mc68kcpu), ea += 2, MASK_OUT_ABOVE_8(src)); -} - - -void m68000_base_device_ops::m68k_op_movep_16_er(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | ((m68ki_read_8((mc68kcpu), ea) << 8) + m68ki_read_8((mc68kcpu), ea + 2)); -} - - -void m68000_base_device_ops::m68k_op_movep_32_er(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - - DX(mc68kcpu) = (m68ki_read_8((mc68kcpu), ea) << 24) + (m68ki_read_8((mc68kcpu), ea + 2) << 16) - + (m68ki_read_8((mc68kcpu), ea + 4) << 8) + m68ki_read_8((mc68kcpu), ea + 6); -} - - -void m68000_base_device_ops::m68k_op_moves_8_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_8(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_8(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_8_pi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PI_8(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_8(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_8_pi7(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_8(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_8_pd(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PD_8(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_8(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_8_pd7(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_8(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_8_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_8(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_8(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_8_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_8(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_8(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_8_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_8(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_8_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_8(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_8_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_16_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_16(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_16_pi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PI_16(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_16_pd(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PD_16(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_16_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_16(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_16_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_16(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_16_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_16_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc((mc68kcpu), ea, (mc68kcpu)->dfc, MASK_OUT_ABOVE_16(REG_DA(mc68kcpu)[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A(mc68kcpu)[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc)); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to data register */ - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D(mc68kcpu)[(word2 >> 12) & 7]) | m68ki_read_16_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc((mc68kcpu), ea, (mc68kcpu)->dfc, REG_DA(mc68kcpu)[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to register */ - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = m68ki_read_32_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_32_pi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PI_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc((mc68kcpu), ea, (mc68kcpu)->dfc, REG_DA(mc68kcpu)[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to register */ - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = m68ki_read_32_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_32_pd(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PD_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc((mc68kcpu), ea, (mc68kcpu)->dfc, REG_DA(mc68kcpu)[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to register */ - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = m68ki_read_32_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc((mc68kcpu), ea, (mc68kcpu)->dfc, REG_DA(mc68kcpu)[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to register */ - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = m68ki_read_32_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc((mc68kcpu), ea, (mc68kcpu)->dfc, REG_DA(mc68kcpu)[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to register */ - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = m68ki_read_32_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc((mc68kcpu), ea, (mc68kcpu)->dfc, REG_DA(mc68kcpu)[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to register */ - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = m68ki_read_32_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moves_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - if((mc68kcpu)->s_flag) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc((mc68kcpu), ea, (mc68kcpu)->dfc, REG_DA(mc68kcpu)[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - /* Memory to register */ - REG_DA(mc68kcpu)[(word2 >> 12) & 15] = m68ki_read_32_fc((mc68kcpu), ea, (mc68kcpu)->sfc); - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - (mc68kcpu)->remaining_cycles -= 2; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_moveq_32(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) = MAKE_INT_8(MASK_OUT_ABOVE_8((mc68kcpu)->ir)); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_move16_32(m68000_base_device* mc68kcpu) -{ - UINT16 w2 = OPER_I_16(mc68kcpu); - int ax = (mc68kcpu)->ir & 7; - int ay = (w2 >> 12) & 7; - m68ki_write_32((mc68kcpu), REG_A(mc68kcpu)[ay], m68ki_read_32((mc68kcpu), REG_A(mc68kcpu)[ax])); - m68ki_write_32((mc68kcpu), REG_A(mc68kcpu)[ay]+4, m68ki_read_32((mc68kcpu), REG_A(mc68kcpu)[ax]+4)); - m68ki_write_32((mc68kcpu), REG_A(mc68kcpu)[ay]+8, m68ki_read_32((mc68kcpu), REG_A(mc68kcpu)[ax]+8)); - m68ki_write_32((mc68kcpu), REG_A(mc68kcpu)[ay]+12, m68ki_read_32((mc68kcpu), REG_A(mc68kcpu)[ax]+12)); - - REG_A(mc68kcpu)[ax] += 16; - REG_A(mc68kcpu)[ay] += 16; -} - - -void m68000_base_device_ops::m68k_op_muls_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(MAKE_INT_16(DY(mc68kcpu)) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_muls_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_AI_16(mc68kcpu)) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_muls_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_PI_16(mc68kcpu)) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_muls_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_PD_16(mc68kcpu)) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_muls_16_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_DI_16(mc68kcpu)) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_muls_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_IX_16(mc68kcpu)) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_muls_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AW_16(mc68kcpu)) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_muls_16_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AL_16(mc68kcpu)) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_muls_16_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_PCDI_16(mc68kcpu)) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_muls_16_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_PCIX_16(mc68kcpu)) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_muls_16_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_I_16(mc68kcpu)) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mulu_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu)) * MASK_OUT_ABOVE_16(*r_dst); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mulu_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = OPER_AY_AI_16(mc68kcpu) * MASK_OUT_ABOVE_16(*r_dst); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mulu_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = OPER_AY_PI_16(mc68kcpu) * MASK_OUT_ABOVE_16(*r_dst); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mulu_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = OPER_AY_PD_16(mc68kcpu) * MASK_OUT_ABOVE_16(*r_dst); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mulu_16_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = OPER_AY_DI_16(mc68kcpu) * MASK_OUT_ABOVE_16(*r_dst); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mulu_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = OPER_AY_IX_16(mc68kcpu) * MASK_OUT_ABOVE_16(*r_dst); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mulu_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = OPER_AW_16(mc68kcpu) * MASK_OUT_ABOVE_16(*r_dst); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mulu_16_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = OPER_AL_16(mc68kcpu) * MASK_OUT_ABOVE_16(*r_dst); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mulu_16_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = OPER_PCDI_16(mc68kcpu) * MASK_OUT_ABOVE_16(*r_dst); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mulu_16_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = OPER_PCIX_16(mc68kcpu) * MASK_OUT_ABOVE_16(*r_dst); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mulu_16_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 res = OPER_I_16(mc68kcpu) * MASK_OUT_ABOVE_16(*r_dst); - - *r_dst = res; - - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_mull_32_d(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 src = DY(mc68kcpu); - UINT64 dst = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - UINT64 res; - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if(BIT_B(word2)) /* signed */ - { - res = (INT64)((INT32)src) * (INT64)((INT32)dst); - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = ((INT64)res != (INT32)res)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - - res = src * dst; - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = (res > 0xffffffff)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_mull_32_ai(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 src = OPER_AY_AI_32(mc68kcpu); - UINT64 dst = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - UINT64 res; - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if(BIT_B(word2)) /* signed */ - { - res = (INT64)((INT32)src) * (INT64)((INT32)dst); - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = ((INT64)res != (INT32)res)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - - res = src * dst; - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = (res > 0xffffffff)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_mull_32_pi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 src = OPER_AY_PI_32(mc68kcpu); - UINT64 dst = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - UINT64 res; - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if(BIT_B(word2)) /* signed */ - { - res = (INT64)((INT32)src) * (INT64)((INT32)dst); - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = ((INT64)res != (INT32)res)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - - res = src * dst; - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = (res > 0xffffffff)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_mull_32_pd(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 src = OPER_AY_PD_32(mc68kcpu); - UINT64 dst = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - UINT64 res; - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if(BIT_B(word2)) /* signed */ - { - res = (INT64)((INT32)src) * (INT64)((INT32)dst); - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = ((INT64)res != (INT32)res)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - - res = src * dst; - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = (res > 0xffffffff)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_mull_32_di(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 src = OPER_AY_DI_32(mc68kcpu); - UINT64 dst = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - UINT64 res; - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if(BIT_B(word2)) /* signed */ - { - res = (INT64)((INT32)src) * (INT64)((INT32)dst); - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = ((INT64)res != (INT32)res)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - - res = src * dst; - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = (res > 0xffffffff)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_mull_32_ix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 src = OPER_AY_IX_32(mc68kcpu); - UINT64 dst = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - UINT64 res; - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if(BIT_B(word2)) /* signed */ - { - res = (INT64)((INT32)src) * (INT64)((INT32)dst); - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = ((INT64)res != (INT32)res)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - - res = src * dst; - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = (res > 0xffffffff)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_mull_32_aw(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 src = OPER_AW_32(mc68kcpu); - UINT64 dst = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - UINT64 res; - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if(BIT_B(word2)) /* signed */ - { - res = (INT64)((INT32)src) * (INT64)((INT32)dst); - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = ((INT64)res != (INT32)res)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - - res = src * dst; - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = (res > 0xffffffff)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_mull_32_al(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 src = OPER_AL_32(mc68kcpu); - UINT64 dst = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - UINT64 res; - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if(BIT_B(word2)) /* signed */ - { - res = (INT64)((INT32)src) * (INT64)((INT32)dst); - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = ((INT64)res != (INT32)res)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - - res = src * dst; - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = (res > 0xffffffff)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_mull_32_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 src = OPER_PCDI_32(mc68kcpu); - UINT64 dst = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - UINT64 res; - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if(BIT_B(word2)) /* signed */ - { - res = (INT64)((INT32)src) * (INT64)((INT32)dst); - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = ((INT64)res != (INT32)res)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - - res = src * dst; - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = (res > 0xffffffff)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_mull_32_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 src = OPER_PCIX_32(mc68kcpu); - UINT64 dst = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - UINT64 res; - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if(BIT_B(word2)) /* signed */ - { - res = (INT64)((INT32)src) * (INT64)((INT32)dst); - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = ((INT64)res != (INT32)res)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - - res = src * dst; - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = (res > 0xffffffff)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_mull_32_i(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 word2 = OPER_I_16(mc68kcpu); - UINT64 src = OPER_I_32(mc68kcpu); - UINT64 dst = REG_D(mc68kcpu)[(word2 >> 12) & 7]; - UINT64 res; - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - if(BIT_B(word2)) /* signed */ - { - res = (INT64)((INT32)src) * (INT64)((INT32)dst); - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = ((INT64)res != (INT32)res)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - - res = src * dst; - if(!BIT_A(word2)) - { - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->v_flag = (res > 0xffffffff)<<7; - REG_D(mc68kcpu)[(word2 >> 12) & 7] = (mc68kcpu)->not_z_flag; - return; - } - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res) | (res>>32); - (mc68kcpu)->n_flag = NFLAG_64(res); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - REG_D(mc68kcpu)[word2 & 7] = (res >> 32); - REG_D(mc68kcpu)[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_nbcd_8_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1(mc68kcpu)); - - if(res != 0x9a) - { - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; - - res = MASK_OUT_ABOVE_8(res); - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->not_z_flag |= res; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - } - else - { - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - } - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ -} - - -void m68000_base_device_ops::m68k_op_nbcd_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1(mc68kcpu)); - - if(res != 0x9a) - { - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; - - res = MASK_OUT_ABOVE_8(res); - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(res)); - - (mc68kcpu)->not_z_flag |= res; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - } - else - { - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - } - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ -} - - -void m68000_base_device_ops::m68k_op_nbcd_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1(mc68kcpu)); - - if(res != 0x9a) - { - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; - - res = MASK_OUT_ABOVE_8(res); - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(res)); - - (mc68kcpu)->not_z_flag |= res; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - } - else - { - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - } - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ -} - - -void m68000_base_device_ops::m68k_op_nbcd_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1(mc68kcpu)); - - if(res != 0x9a) - { - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; - - res = MASK_OUT_ABOVE_8(res); - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(res)); - - (mc68kcpu)->not_z_flag |= res; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - } - else - { - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - } - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ -} - - -void m68000_base_device_ops::m68k_op_nbcd_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1(mc68kcpu)); - - if(res != 0x9a) - { - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; - - res = MASK_OUT_ABOVE_8(res); - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(res)); - - (mc68kcpu)->not_z_flag |= res; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - } - else - { - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - } - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ -} - - -void m68000_base_device_ops::m68k_op_nbcd_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1(mc68kcpu)); - - if(res != 0x9a) - { - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; - - res = MASK_OUT_ABOVE_8(res); - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(res)); - - (mc68kcpu)->not_z_flag |= res; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - } - else - { - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - } - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ -} - - -void m68000_base_device_ops::m68k_op_nbcd_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1(mc68kcpu)); - - if(res != 0x9a) - { - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; - - res = MASK_OUT_ABOVE_8(res); - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(res)); - - (mc68kcpu)->not_z_flag |= res; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - } - else - { - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - } - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ -} - - -void m68000_base_device_ops::m68k_op_nbcd_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1(mc68kcpu)); - - if(res != 0x9a) - { - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; - - res = MASK_OUT_ABOVE_8(res); - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(res)); - - (mc68kcpu)->not_z_flag |= res; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - } - else - { - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - } - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ -} - - -void m68000_base_device_ops::m68k_op_nbcd_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1(mc68kcpu)); - - if(res != 0x9a) - { - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; - - res = MASK_OUT_ABOVE_8(res); - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(res)); - - (mc68kcpu)->not_z_flag |= res; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - } - else - { - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - } - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ -} - - -void m68000_base_device_ops::m68k_op_nbcd_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1(mc68kcpu)); - - if(res != 0x9a) - { - (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; - - res = MASK_OUT_ABOVE_8(res); - - (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ - - m68ki_write_8((mc68kcpu), ea, MASK_OUT_ABOVE_8(res)); - - (mc68kcpu)->not_z_flag |= res; - (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->x_flag = XFLAG_SET; - } - else - { - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->x_flag = XFLAG_CLEAR; - } - (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ -} - - -void m68000_base_device_ops::m68k_op_neg_8_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = 0 - MASK_OUT_ABOVE_8(*r_dst); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = *r_dst & res; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_neg_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = 0 - MASK_OUT_ABOVE_16(*r_dst); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (*r_dst & res)>>8; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_neg_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_32_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = 0 - *r_dst; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_SUB_32(*r_dst, 0, res); - (mc68kcpu)->v_flag = (*r_dst & res)>>24; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_neg_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_neg_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_negx_8_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = 0 - MASK_OUT_ABOVE_8(*r_dst) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = *r_dst & res; - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; -} - - -void m68000_base_device_ops::m68k_op_negx_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea); - UINT32 res = 0 - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = src & res; - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = 0 - MASK_OUT_ABOVE_16(*r_dst) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (*r_dst & res)>>8; - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; -} - - -void m68000_base_device_ops::m68k_op_negx_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = (src & res)>>8; - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_32_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = 0 - MASK_OUT_ABOVE_32(*r_dst) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(*r_dst, 0, res); - (mc68kcpu)->v_flag = (*r_dst & res)>>24; - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - *r_dst = res; -} - - -void m68000_base_device_ops::m68k_op_negx_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_negx_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 src = m68ki_read_32((mc68kcpu), ea); - UINT32 res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, 0, res); - (mc68kcpu)->v_flag = (src & res)>>24; - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_nop(m68000_base_device* mc68kcpu) -{ - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ -} - - -void m68000_base_device_ops::m68k_op_not_8_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(~*r_dst); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(~m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(~m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(~m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(~m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(~m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(~m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(~m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(~m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(~m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(~*r_dst); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(~m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(~m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(~m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(~m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(~m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(~m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(~m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_32_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 res = *r_dst = MASK_OUT_ABOVE_32(~*r_dst); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(~m68ki_read_32((mc68kcpu), ea)); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(~m68ki_read_32((mc68kcpu), ea)); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(~m68ki_read_32((mc68kcpu), ea)); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(~m68ki_read_32((mc68kcpu), ea)); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(~m68ki_read_32((mc68kcpu), ea)); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(~m68ki_read_32((mc68kcpu), ea)); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_not_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_32(~m68ki_read_32((mc68kcpu), ea)); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= MASK_OUT_ABOVE_8(DY(mc68kcpu)))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_AY_AI_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_AY_PI_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_A7_PI_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_AY_PD_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_A7_PD_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_AY_DI_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_AY_IX_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_AW_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_AL_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_PCDI_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_PCIX_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_er_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DX(mc68kcpu) |= OPER_I_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_er_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16((DX(mc68kcpu) |= MASK_OUT_ABOVE_16(DY(mc68kcpu)))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_er_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16((DX(mc68kcpu) |= OPER_AY_AI_16(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_er_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16((DX(mc68kcpu) |= OPER_AY_PI_16(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_er_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16((DX(mc68kcpu) |= OPER_AY_PD_16(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_er_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16((DX(mc68kcpu) |= OPER_AY_DI_16(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_er_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16((DX(mc68kcpu) |= OPER_AY_IX_16(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_er_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16((DX(mc68kcpu) |= OPER_AW_16(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_er_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16((DX(mc68kcpu) |= OPER_AL_16(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_er_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16((DX(mc68kcpu) |= OPER_PCDI_16(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_er_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16((DX(mc68kcpu) |= OPER_PCIX_16(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_er_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16((DX(mc68kcpu) |= OPER_I_16(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_er_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) |= DY(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_er_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) |= OPER_AY_AI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_er_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) |= OPER_AY_PI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_er_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) |= OPER_AY_PD_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_er_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) |= OPER_AY_DI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_er_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) |= OPER_AY_IX_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_er_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) |= OPER_AW_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_er_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) |= OPER_AL_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_er_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) |= OPER_PCDI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_er_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) |= OPER_PCIX_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_er_i(m68000_base_device* mc68kcpu) -{ - UINT32 res = DX(mc68kcpu) |= OPER_I_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_re_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_re_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_8_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(DX(mc68kcpu) | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_16_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(DX(mc68kcpu) | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_or_32_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 res = DX(mc68kcpu) | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_8_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8((DY(mc68kcpu) |= OPER_I_8(mc68kcpu))); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(src | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(src | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(src | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(src | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(src | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(src | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(src | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(src | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_8(src | m68ki_read_8((mc68kcpu), ea)); - - m68ki_write_8((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_16_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu) |= OPER_I_16(mc68kcpu)); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(src | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(src | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(src | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(src | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(src | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(src | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 res = MASK_OUT_ABOVE_16(src | m68ki_read_16((mc68kcpu), ea)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_32_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu) |= OPER_I_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 res = src | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 res = src | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 res = src | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 res = src | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 res = src | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 res = src | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 res = src | m68ki_read_32((mc68kcpu), ea); - - m68ki_write_32((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ori_16_toc(m68000_base_device* mc68kcpu) -{ - m68ki_set_ccr((mc68kcpu), m68ki_get_ccr(mc68kcpu) | OPER_I_16(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_ori_16_tos(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 src = OPER_I_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr((mc68kcpu), m68ki_get_sr(mc68kcpu) | src); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_pack_16_rr(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - /* Note: DX(mc68kcpu) and DY(mc68kcpu) are reversed in Motorola's docs */ - UINT32 src = DY(mc68kcpu) + OPER_I_16(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | ((src >> 4) & 0x00f0) | (src & 0x000f); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_pack_16_mm_ax7(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - UINT32 ea_src = EA_AY_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea_src); - ea_src = EA_AY_PD_8(mc68kcpu); - src = ((src << 8) | m68ki_read_8((mc68kcpu), ea_src)) + OPER_I_16(mc68kcpu); - - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), ((src >> 8) & 0x000f) | ((src<<4) & 0x00f0)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_pack_16_mm_ay7(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - UINT32 ea_src = EA_A7_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea_src); - ea_src = EA_A7_PD_8(mc68kcpu); - src = ((src << 8) | m68ki_read_8((mc68kcpu), ea_src)) + OPER_I_16(mc68kcpu); - - m68ki_write_8((mc68kcpu), EA_AX_PD_8(mc68kcpu), ((src >> 8) & 0x000f) | ((src<<4) & 0x00f0)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_pack_16_mm_axy7(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 ea_src = EA_A7_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea_src); - ea_src = EA_A7_PD_8(mc68kcpu); - src = ((src << 8) | m68ki_read_8((mc68kcpu), ea_src)) + OPER_I_16(mc68kcpu); - - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), ((src >> 8) & 0x000f) | ((src<<4) & 0x00f0)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_pack_16_mm(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - UINT32 ea_src = EA_AY_PD_8(mc68kcpu); - UINT32 src = m68ki_read_8((mc68kcpu), ea_src); - ea_src = EA_AY_PD_8(mc68kcpu); - src = ((src << 8) | m68ki_read_8((mc68kcpu), ea_src)) + OPER_I_16(mc68kcpu); - - m68ki_write_8((mc68kcpu), EA_AX_PD_8(mc68kcpu), ((src >> 8) & 0x000f) | ((src<<4) & 0x00f0)); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_pea_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_32(mc68kcpu); - - m68ki_push_32((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_pea_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - - m68ki_push_32((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_pea_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_32(mc68kcpu); - - m68ki_push_32((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_pea_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_32(mc68kcpu); - - m68ki_push_32((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_pea_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_32(mc68kcpu); - - m68ki_push_32((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_pea_32_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_PCDI_32(mc68kcpu); - - m68ki_push_32((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_pea_32_pcix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_PCIX_32(mc68kcpu); - - m68ki_push_32((mc68kcpu), ea); -} - - -void m68000_base_device_ops::m68k_op_pflusha_32(m68000_base_device* mc68kcpu) -{ - if ((CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) && ((mc68kcpu)->has_pmmu)) - { - mc68kcpu->logerror("68040: unhandled PFLUSHA (ir=%04x)\n", mc68kcpu->ir); - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_pflushan_32(m68000_base_device* mc68kcpu) -{ - if ((CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) && ((mc68kcpu)->has_pmmu)) - { - mc68kcpu->logerror("68040: unhandled PFLUSHAN (ir=%04x)\n", mc68kcpu->ir); - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_pmmu_32(m68000_base_device* mc68kcpu) -{ - if ((CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) && ((mc68kcpu)->has_pmmu)) - { - m68881_mmu_ops(mc68kcpu); - } - else - { - m68ki_exception_1111(mc68kcpu); - } -} - - -void m68000_base_device_ops::m68k_op_ptest_32(m68000_base_device* mc68kcpu) -{ - if ((CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) && ((mc68kcpu)->has_pmmu)) - { - mc68kcpu->logerror("68040: unhandled PTEST\n"); - return; - } - else - { - m68ki_exception_1111(mc68kcpu); - } -} - - -void m68000_base_device_ops::m68k_op_reset(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - if (!(mc68kcpu)->reset_instr_callback.isnull()) - ((mc68kcpu)->reset_instr_callback)(1); - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_reset; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_ror_8_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 shift = orig_shift & 7; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = ROR_8(src, shift); - - if(orig_shift != 0) - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src << (9-orig_shift); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_16_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = ROR_16(src, shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src << (9-shift); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_32_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT64 src = *r_dst; - UINT32 res = ROR_32(src, shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src << (9-shift); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_8_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - UINT32 shift = orig_shift & 7; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = ROR_8(src, shift); - - if(orig_shift != 0) - { - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - (mc68kcpu)->c_flag = src << (8-((shift-1)&7)); - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_8(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_16_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - UINT32 shift = orig_shift & 15; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = ROR_16(src, shift); - - if(orig_shift != 0) - { - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - (mc68kcpu)->c_flag = (src >> ((shift - 1) & 15)) << 8; - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_16(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_32_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - UINT32 shift = orig_shift & 31; - UINT64 src = *r_dst; - UINT32 res = ROR_32(src, shift); - - if(orig_shift != 0) - { - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - *r_dst = res; - (mc68kcpu)->c_flag = (src >> ((shift - 1) & 31)) << 8; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_32(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_16(src, 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_16(src, 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_16(src, 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_16(src, 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_16(src, 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_16(src, 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_ror_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_16(src, 1); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src << 8; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_8_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 shift = orig_shift & 7; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = ROL_8(src, shift); - - if(orig_shift != 0) - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src << orig_shift; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_16_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = ROL_16(src, shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src >> (8-shift); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_32_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT64 src = *r_dst; - UINT32 res = ROL_32(src, shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src >> (24-shift); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_8_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - UINT32 shift = orig_shift & 7; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = ROL_8(src, shift); - - if(orig_shift != 0) - { - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - if(shift != 0) - { - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - (mc68kcpu)->c_flag = src << shift; - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - (mc68kcpu)->c_flag = (src & 1)<<8; - (mc68kcpu)->n_flag = NFLAG_8(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_8(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_16_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - UINT32 shift = orig_shift & 15; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = MASK_OUT_ABOVE_16(ROL_16(src, shift)); - - if(orig_shift != 0) - { - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - if(shift != 0) - { - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - (mc68kcpu)->c_flag = (src << shift) >> 8; - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - (mc68kcpu)->c_flag = (src & 1)<<8; - (mc68kcpu)->n_flag = NFLAG_16(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_16(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_32_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - UINT32 shift = orig_shift & 31; - UINT64 src = *r_dst; - UINT32 res = ROL_32(src, shift); - - if(orig_shift != 0) - { - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - *r_dst = res; - - (mc68kcpu)->c_flag = (src >> ((32 - shift) & 0x1f)) << 8; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->n_flag = NFLAG_32(src); - (mc68kcpu)->not_z_flag = src; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rol_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->c_flag = src >> 7; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_8_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = ROR_9(src | (XFLAG_AS_1(mc68kcpu) << 8), shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res; - res = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_16_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = ROR_17(src | (XFLAG_AS_1(mc68kcpu) << 16), shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_32_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT64 src = *r_dst; - UINT64 res = src | (((UINT64)XFLAG_AS_1(mc68kcpu)) << 32); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - res = ROR_33_64(res, shift); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 24; - res = MASK_OUT_ABOVE_32(res); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_8_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - - if(orig_shift != 0) - { - UINT32 shift = orig_shift % 9; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = ROR_9(src | (XFLAG_AS_1(mc68kcpu) << 8), shift); - - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res; - res = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag; - (mc68kcpu)->n_flag = NFLAG_8(*r_dst); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(*r_dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_16_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - - if(orig_shift != 0) - { - UINT32 shift = orig_shift % 17; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = ROR_17(src | (XFLAG_AS_1(mc68kcpu) << 16), shift); - - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag; - (mc68kcpu)->n_flag = NFLAG_16(*r_dst); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(*r_dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_32_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - - if(orig_shift != 0) - { - UINT32 shift = orig_shift % 33; - UINT64 src = *r_dst; - UINT64 res = src | (((UINT64)XFLAG_AS_1(mc68kcpu)) << 32); - - res = ROR_33_64(res, shift); - - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 24; - res = MASK_OUT_ABOVE_32(res); - - *r_dst = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag; - (mc68kcpu)->n_flag = NFLAG_32(*r_dst); - (mc68kcpu)->not_z_flag = *r_dst; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxr_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROR_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_8_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = ROL_9(src | (XFLAG_AS_1(mc68kcpu) << 8), shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res; - res = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_16_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = ROL_17(src | (XFLAG_AS_1(mc68kcpu) << 16), shift); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_32_s(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 shift = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT64 src = *r_dst; - UINT64 res = src | (((UINT64)XFLAG_AS_1(mc68kcpu)) << 32); - - if(shift != 0) - (mc68kcpu)->remaining_cycles -= shift<<(mc68kcpu)->cyc_shift; - - res = ROL_33_64(res, shift); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 24; - res = MASK_OUT_ABOVE_32(res); - - *r_dst = res; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_8_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - - - if(orig_shift != 0) - { - UINT32 shift = orig_shift % 9; - UINT32 src = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = ROL_9(src | (XFLAG_AS_1(mc68kcpu) << 8), shift); - - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res; - res = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag; - (mc68kcpu)->n_flag = NFLAG_8(*r_dst); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(*r_dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_16_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - - if(orig_shift != 0) - { - UINT32 shift = orig_shift % 17; - UINT32 src = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = ROL_17(src | (XFLAG_AS_1(mc68kcpu) << 16), shift); - - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag; - (mc68kcpu)->n_flag = NFLAG_16(*r_dst); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(*r_dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_32_r(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 orig_shift = DX(mc68kcpu) & 0x3f; - - if(orig_shift != 0) - { - UINT32 shift = orig_shift % 33; - UINT64 src = *r_dst; - UINT64 res = src | (((UINT64)XFLAG_AS_1(mc68kcpu)) << 32); - - res = ROL_33_64(res, shift); - - (mc68kcpu)->remaining_cycles -= orig_shift<<(mc68kcpu)->cyc_shift; - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 24; - res = MASK_OUT_ABOVE_32(res); - - *r_dst = res; - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - return; - } - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag; - (mc68kcpu)->n_flag = NFLAG_32(*r_dst); - (mc68kcpu)->not_z_flag = *r_dst; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROL_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROL_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROL_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROL_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROL_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROL_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_roxl_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = m68ki_read_16((mc68kcpu), ea); - UINT32 res = ROL_17(src | (XFLAG_AS_1(mc68kcpu) << 16), 1); - - (mc68kcpu)->c_flag = (mc68kcpu)->x_flag = res >> 8; - res = MASK_OUT_ABOVE_16(res); - - m68ki_write_16((mc68kcpu), ea, res); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_rtd_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_010_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 new_pc = m68ki_pull_32(mc68kcpu); - - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - REG_A(mc68kcpu)[7] = MASK_OUT_ABOVE_32(REG_A(mc68kcpu)[7] + MAKE_INT_16(OPER_I_16(mc68kcpu))); - m68ki_jump((mc68kcpu), new_pc); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_rte_32(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr; - UINT32 new_pc; - UINT32 format_word; - - if (!(mc68kcpu)->rte_instr_callback.isnull()) - ((mc68kcpu)->rte_instr_callback)(1); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - - if(CPU_TYPE_IS_000((mc68kcpu)->cpu_type)) - { - new_sr = m68ki_pull_16(mc68kcpu); - new_pc = m68ki_pull_32(mc68kcpu); - m68ki_jump((mc68kcpu), new_pc); - m68ki_set_sr((mc68kcpu), new_sr); - - (mc68kcpu)->instr_mode = INSTRUCTION_YES; - (mc68kcpu)->run_mode = RUN_MODE_NORMAL; - - return; - } - - if(CPU_TYPE_IS_010((mc68kcpu)->cpu_type)) - { - format_word = m68ki_read_16((mc68kcpu), REG_A(mc68kcpu)[7]+6) >> 12; - if(format_word == 0) - { - new_sr = m68ki_pull_16(mc68kcpu); - new_pc = m68ki_pull_32(mc68kcpu); - m68ki_fake_pull_16(mc68kcpu); /* format word */ - m68ki_jump((mc68kcpu), new_pc); - m68ki_set_sr((mc68kcpu), new_sr); - (mc68kcpu)->instr_mode = INSTRUCTION_YES; - (mc68kcpu)->run_mode = RUN_MODE_NORMAL; - return; - } - (mc68kcpu)->instr_mode = INSTRUCTION_YES; - (mc68kcpu)->run_mode = RUN_MODE_NORMAL; - /* Not handling bus fault (9) */ - m68ki_exception_format_error(mc68kcpu); - return; - } - - /* Otherwise it's 020 */ -rte_loop: - format_word = m68ki_read_16((mc68kcpu), REG_A(mc68kcpu)[7]+6) >> 12; - switch(format_word) - { - case 0: /* Normal */ - new_sr = m68ki_pull_16(mc68kcpu); - new_pc = m68ki_pull_32(mc68kcpu); - m68ki_fake_pull_16(mc68kcpu); /* format word */ - m68ki_jump((mc68kcpu), new_pc); - m68ki_set_sr((mc68kcpu), new_sr); - (mc68kcpu)->instr_mode = INSTRUCTION_YES; - (mc68kcpu)->run_mode = RUN_MODE_NORMAL; - return; - case 1: /* Throwaway */ - new_sr = m68ki_pull_16(mc68kcpu); - m68ki_fake_pull_32(mc68kcpu); /* program counter */ - m68ki_fake_pull_16(mc68kcpu); /* format word */ - m68ki_set_sr_noint((mc68kcpu), new_sr); - goto rte_loop; - case 2: /* Trap */ - new_sr = m68ki_pull_16(mc68kcpu); - new_pc = m68ki_pull_32(mc68kcpu); - m68ki_fake_pull_16(mc68kcpu); /* format word */ - m68ki_fake_pull_32(mc68kcpu); /* address */ - m68ki_jump((mc68kcpu), new_pc); - m68ki_set_sr((mc68kcpu), new_sr); - (mc68kcpu)->instr_mode = INSTRUCTION_YES; - (mc68kcpu)->run_mode = RUN_MODE_NORMAL; - return; - case 7: /* 68040 access error */ - new_sr = m68ki_pull_16(mc68kcpu); - new_pc = m68ki_pull_32(mc68kcpu); - m68ki_fake_pull_16(mc68kcpu); /* $06: format word */ - m68ki_fake_pull_32(mc68kcpu); /* $08: effective address */ - m68ki_fake_pull_16(mc68kcpu); /* $0c: special status word */ - m68ki_fake_pull_16(mc68kcpu); /* $0e: wb3s */ - m68ki_fake_pull_16(mc68kcpu); /* $10: wb2s */ - m68ki_fake_pull_16(mc68kcpu); /* $12: wb1s */ - m68ki_fake_pull_32(mc68kcpu); /* $14: data fault address */ - m68ki_fake_pull_32(mc68kcpu); /* $18: wb3a */ - m68ki_fake_pull_32(mc68kcpu); /* $1c: wb3d */ - m68ki_fake_pull_32(mc68kcpu); /* $20: wb2a */ - m68ki_fake_pull_32(mc68kcpu); /* $24: wb2d */ - m68ki_fake_pull_32(mc68kcpu); /* $28: wb1a */ - m68ki_fake_pull_32(mc68kcpu); /* $2c: wb1d/pd0 */ - m68ki_fake_pull_32(mc68kcpu); /* $30: pd1 */ - m68ki_fake_pull_32(mc68kcpu); /* $34: pd2 */ - m68ki_fake_pull_32(mc68kcpu); /* $38: pd3 */ - m68ki_jump((mc68kcpu), new_pc); - m68ki_set_sr((mc68kcpu), new_sr); - (mc68kcpu)->instr_mode = INSTRUCTION_YES; - (mc68kcpu)->run_mode = RUN_MODE_NORMAL; - return; - - case 0x0a: /* Bus Error at instruction boundary */ - new_sr = m68ki_pull_16(mc68kcpu); - new_pc = m68ki_pull_32(mc68kcpu); - m68ki_fake_pull_16(mc68kcpu); /* $06: format word */ - m68ki_fake_pull_16(mc68kcpu); /* $08: internal register */ - m68ki_fake_pull_16(mc68kcpu); /* $0a: special status word */ - m68ki_fake_pull_16(mc68kcpu); /* $0c: instruction pipe stage c */ - m68ki_fake_pull_16(mc68kcpu); /* $0e: instruction pipe stage b */ - m68ki_fake_pull_32(mc68kcpu); /* $10: data fault address */ - m68ki_fake_pull_32(mc68kcpu); /* $14: internal registers */ - m68ki_fake_pull_32(mc68kcpu); /* $18: data output buffer */ - m68ki_fake_pull_32(mc68kcpu); /* $1c: internal registers */ - - m68ki_jump((mc68kcpu), new_pc); - m68ki_set_sr((mc68kcpu), new_sr); - (mc68kcpu)->instr_mode = INSTRUCTION_YES; - (mc68kcpu)->run_mode = RUN_MODE_NORMAL; - return; - case 0x0b: /* Bus Error - Instruction Execution in Progress */ - new_sr = m68ki_pull_16(mc68kcpu); - new_pc = m68ki_pull_32(mc68kcpu); - m68ki_fake_pull_16(mc68kcpu); /* $06: format word */ - m68ki_fake_pull_16(mc68kcpu); /* $08: internal register */ - m68ki_fake_pull_16(mc68kcpu); /* $0a: special status word */ - m68ki_fake_pull_16(mc68kcpu); /* $0c: instruction pipe stage c */ - m68ki_fake_pull_16(mc68kcpu); /* $0e: instruction pipe stage b */ - m68ki_fake_pull_32(mc68kcpu); /* $10: data fault address */ - m68ki_fake_pull_32(mc68kcpu); /* $14: internal registers */ - m68ki_fake_pull_32(mc68kcpu); /* $18: data output buffer */ - m68ki_fake_pull_32(mc68kcpu); /* $1c: internal registers */ - m68ki_fake_pull_32(mc68kcpu); /* $20: */ - m68ki_fake_pull_32(mc68kcpu); /* $24: stage B address */ - m68ki_fake_pull_32(mc68kcpu); /* $28: */ - m68ki_fake_pull_32(mc68kcpu); /* $2c: data input buffer */ - m68ki_fake_pull_32(mc68kcpu); /* $30: */ - m68ki_fake_pull_16(mc68kcpu); /* $34: */ - m68ki_fake_pull_16(mc68kcpu); /* $36: version #, internal information */ - m68ki_fake_pull_32(mc68kcpu); /* $38: */ - m68ki_fake_pull_32(mc68kcpu); /* $3c: */ - m68ki_fake_pull_32(mc68kcpu); /* $40: */ - m68ki_fake_pull_32(mc68kcpu); /* $44: */ - m68ki_fake_pull_32(mc68kcpu); /* $48: */ - m68ki_fake_pull_32(mc68kcpu); /* $4c: */ - m68ki_fake_pull_32(mc68kcpu); /* $50: */ - m68ki_fake_pull_32(mc68kcpu); /* $54: */ - m68ki_fake_pull_32(mc68kcpu); /* $58: */ - - m68ki_jump((mc68kcpu), new_pc); - m68ki_set_sr((mc68kcpu), new_sr); - (mc68kcpu)->instr_mode = INSTRUCTION_YES; - (mc68kcpu)->run_mode = RUN_MODE_NORMAL; - return; - } - /* Not handling long or short bus fault */ - (mc68kcpu)->instr_mode = INSTRUCTION_YES; - (mc68kcpu)->run_mode = RUN_MODE_NORMAL; - m68ki_exception_format_error(mc68kcpu); - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_rtm_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_020_VARIANT((mc68kcpu)->cpu_type)) - { - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (rtm)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_rtr_32(m68000_base_device* mc68kcpu) -{ - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_set_ccr((mc68kcpu), m68ki_pull_16(mc68kcpu)); - m68ki_jump((mc68kcpu), m68ki_pull_32(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_rts_32(m68000_base_device* mc68kcpu) -{ - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - m68ki_jump((mc68kcpu), m68ki_pull_32(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_sbcd_8_rr(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = DY(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(mc68kcpu); - -// (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to assume cleared. */ - - if(res > 9) - res -= 6; - res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); - if(res > 0x99) - { - res += 0xa0; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->n_flag = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ - } - else - (mc68kcpu)->n_flag = (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = 0; - - res = MASK_OUT_ABOVE_8(res); - -// (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ -// (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ - (mc68kcpu)->not_z_flag |= res; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; -} - - -void m68000_base_device_ops::m68k_op_sbcd_8_mm_ax7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(mc68kcpu); - -// (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ - - if(res > 9) - res -= 6; - res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); - if(res > 0x99) - { - res += 0xa0; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->n_flag = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ - } - else - (mc68kcpu)->n_flag = (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = 0; - - res = MASK_OUT_ABOVE_8(res); - -// (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ -// (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_sbcd_8_mm_ay7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(mc68kcpu); - -// (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ - - if(res > 9) - res -= 6; - res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); - if(res > 0x99) - { - res += 0xa0; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->n_flag = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ - } - else - (mc68kcpu)->n_flag = (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = 0; - - res = MASK_OUT_ABOVE_8(res); - -// (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ -// (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_sbcd_8_mm_axy7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(mc68kcpu); - -// (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ - - if(res > 9) - res -= 6; - res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); - if(res > 0x99) - { - res += 0xa0; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->n_flag = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ - } - else - (mc68kcpu)->n_flag = (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = 0; - - res = MASK_OUT_ABOVE_8(res); - -// (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ -// (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_sbcd_8_mm(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(mc68kcpu); - -// (mc68kcpu)->v_flag = ~res; /* Undefined V behavior */ - (mc68kcpu)->v_flag = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ - - if(res > 9) - res -= 6; - res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); - if(res > 0x99) - { - res += 0xa0; - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SET; - (mc68kcpu)->n_flag = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ - } - else - (mc68kcpu)->n_flag = (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = 0; - - res = MASK_OUT_ABOVE_8(res); - -// (mc68kcpu)->v_flag &= res; /* Undefined V behavior part II */ -// (mc68kcpu)->n_flag = NFLAG_8(res); /* Undefined N behavior */ - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_st_8_d(m68000_base_device* mc68kcpu) -{ - DY(mc68kcpu) |= 0xff; -} - - -void m68000_base_device_ops::m68k_op_st_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), 0xff); -} - - -void m68000_base_device_ops::m68k_op_st_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), 0xff); -} - - -void m68000_base_device_ops::m68k_op_st_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), 0xff); -} - - -void m68000_base_device_ops::m68k_op_st_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), 0xff); -} - - -void m68000_base_device_ops::m68k_op_st_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), 0xff); -} - - -void m68000_base_device_ops::m68k_op_st_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), 0xff); -} - - -void m68000_base_device_ops::m68k_op_st_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), 0xff); -} - - -void m68000_base_device_ops::m68k_op_st_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), 0xff); -} - - -void m68000_base_device_ops::m68k_op_st_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), 0xff); -} - - -void m68000_base_device_ops::m68k_op_sf_8_d(m68000_base_device* mc68kcpu) -{ - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_sf_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), 0); -} - - -void m68000_base_device_ops::m68k_op_sf_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), 0); -} - - -void m68000_base_device_ops::m68k_op_sf_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), 0); -} - - -void m68000_base_device_ops::m68k_op_sf_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), 0); -} - - -void m68000_base_device_ops::m68k_op_sf_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), 0); -} - - -void m68000_base_device_ops::m68k_op_sf_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), 0); -} - - -void m68000_base_device_ops::m68k_op_sf_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), 0); -} - - -void m68000_base_device_ops::m68k_op_sf_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), 0); -} - - -void m68000_base_device_ops::m68k_op_sf_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), 0); -} - - -void m68000_base_device_ops::m68k_op_shi_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_HI(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_sls_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_LS(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_scc_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_CC(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_scs_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_CS(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_sne_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_NE(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_seq_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_EQ(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_svc_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_VC(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_svs_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_VS(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_spl_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_PL(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_smi_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_MI(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_sge_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_GE(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_slt_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_LT(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_sgt_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_GT(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_sle_8_d(m68000_base_device* mc68kcpu) -{ - if(COND_LE(mc68kcpu)) - { - DY(mc68kcpu) |= 0xff; - (mc68kcpu)->remaining_cycles -= (mc68kcpu)->cyc_scc_r_true; - return; - } - DY(mc68kcpu) &= 0xffffff00; -} - - -void m68000_base_device_ops::m68k_op_shi_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_HI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_shi_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_HI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_shi_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_HI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_shi_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_HI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_shi_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_HI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_shi_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_HI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_shi_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_HI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_shi_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_HI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_shi_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_HI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sls_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_LS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sls_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_LS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sls_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_LS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sls_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_LS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sls_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_LS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sls_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_LS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sls_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_LS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sls_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_LS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sls_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_LS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scc_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_CC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scc_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_CC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scc_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_CC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scc_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_CC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scc_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_CC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scc_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_CC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scc_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_CC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scc_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_CC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scc_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_CC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scs_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_CS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scs_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_CS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scs_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_CS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scs_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_CS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scs_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_CS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scs_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_CS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scs_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_CS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scs_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_CS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_scs_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_CS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sne_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_NE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sne_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_NE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sne_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_NE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sne_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_NE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sne_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_NE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sne_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_NE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sne_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_NE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sne_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_NE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sne_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_NE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_seq_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_EQ(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_seq_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_EQ(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_seq_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_EQ(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_seq_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_EQ(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_seq_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_EQ(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_seq_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_EQ(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_seq_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_EQ(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_seq_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_EQ(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_seq_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_EQ(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svc_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_VC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svc_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_VC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svc_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_VC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svc_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_VC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svc_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_VC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svc_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_VC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svc_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_VC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svc_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_VC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svc_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_VC(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svs_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_VS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svs_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_VS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svs_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_VS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svs_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_VS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svs_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_VS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svs_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_VS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svs_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_VS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svs_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_VS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_svs_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_VS(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_spl_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_PL(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_spl_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_PL(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_spl_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_PL(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_spl_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_PL(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_spl_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_PL(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_spl_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_PL(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_spl_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_PL(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_spl_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_PL(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_spl_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_PL(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_smi_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_MI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_smi_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_MI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_smi_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_MI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_smi_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_MI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_smi_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_MI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_smi_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_MI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_smi_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_MI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_smi_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_MI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_smi_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_MI(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sge_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_GE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sge_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_GE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sge_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_GE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sge_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_GE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sge_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_GE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sge_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_GE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sge_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_GE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sge_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_GE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sge_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_GE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_slt_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_LT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_slt_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_LT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_slt_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_LT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_slt_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_LT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_slt_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_LT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_slt_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_LT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_slt_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_LT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_slt_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_LT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_slt_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_LT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sgt_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_GT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sgt_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_GT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sgt_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_GT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sgt_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_GT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sgt_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_GT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sgt_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_GT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sgt_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_GT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sgt_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_GT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sgt_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_GT(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sle_8_ai(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_AI_8(mc68kcpu), COND_LE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sle_8_pi(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PI_8(mc68kcpu), COND_LE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sle_8_pi7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PI_8(mc68kcpu), COND_LE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sle_8_pd(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_PD_8(mc68kcpu), COND_LE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sle_8_pd7(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_A7_PD_8(mc68kcpu), COND_LE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sle_8_di(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_DI_8(mc68kcpu), COND_LE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sle_8_ix(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AY_IX_8(mc68kcpu), COND_LE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sle_8_aw(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AW_8(mc68kcpu), COND_LE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_sle_8_al(m68000_base_device* mc68kcpu) -{ - m68ki_write_8((mc68kcpu), EA_AL_8(mc68kcpu), COND_LE(mc68kcpu) ? 0xff : 0); -} - - -void m68000_base_device_ops::m68k_op_stop(m68000_base_device* mc68kcpu) -{ - if((mc68kcpu)->s_flag) - { - UINT32 new_sr = OPER_I_16(mc68kcpu); - m68ki_trace_t0(mc68kcpu); /* auto-disable (see m68kcpu.h) */ - (mc68kcpu)->stopped |= STOP_LEVEL_STOP; - m68ki_set_sr((mc68kcpu), new_sr); - (mc68kcpu)->remaining_cycles = 0; - return; - } - m68ki_exception_privilege_violation(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_AI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_pi7(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_A7_PI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_pd7(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_DI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_IX_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AW_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AL_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCDI_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCIX_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_er_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(AY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_AI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PD_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_DI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_IX_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AW_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AL_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCDI_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCIX_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_16_er_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = DY(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = AY(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_AI_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PI_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_PD_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_DI_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AY_IX_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AW_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_AL_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCDI_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_PCIX_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_32_er_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_sub_8_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_8_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_8_re_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_8_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_8_re_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_8_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_8_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_8_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_8_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DX(mc68kcpu)); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_16_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_16_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_16_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_16_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_16_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_16_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_16_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DX(mc68kcpu)); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_32_re_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_32_re_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_32_re_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_32_re_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_32_re_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_32_re_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_sub_32_re_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 src = DX(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_suba_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - MAKE_INT_16(DY(mc68kcpu))); -} - - -void m68000_base_device_ops::m68k_op_suba_16_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - MAKE_INT_16(AY(mc68kcpu))); -} - - -void m68000_base_device_ops::m68k_op_suba_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AY_AI_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AY_PI_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AY_PD_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_16_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AY_DI_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AY_IX_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AW_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_16_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_AL_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_16_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_PCDI_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_16_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_PCIX_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_16_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = MAKE_INT_16(OPER_I_16(mc68kcpu)); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_32_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - DY(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_suba_32_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - AY(mc68kcpu)); -} - - -void m68000_base_device_ops::m68k_op_suba_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AY_AI_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AY_PI_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AY_PD_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_32_di(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AY_DI_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AY_IX_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AW_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_32_al(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_AL_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_32_pcdi(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_PCDI_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_32_pcix(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_PCIX_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_suba_32_i(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AX(mc68kcpu); - UINT32 src = OPER_I_32(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); -} - - -void m68000_base_device_ops::m68k_op_subi_8_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_subi_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_8(mc68kcpu); - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_subi_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_16(mc68kcpu); - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_32_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_subi_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subi_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_I_32(mc68kcpu); - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_8_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_subq_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - m68ki_write_8((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_16_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_subq_16_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AY(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - (((((mc68kcpu)->ir >> 9) - 1) & 7) + 1)); -} - - -void m68000_base_device_ops::m68k_op_subq_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_AI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PD_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_DI_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_IX_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AW_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AL_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - m68ki_write_16((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_32_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 dst = *r_dst; - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - *r_dst = (mc68kcpu)->not_z_flag; -} - - -void m68000_base_device_ops::m68k_op_subq_32_a(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AY(mc68kcpu); - - *r_dst = MASK_OUT_ABOVE_32(*r_dst - (((((mc68kcpu)->ir >> 9) - 1) & 7) + 1)); -} - - -void m68000_base_device_ops::m68k_op_subq_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_AI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_PD_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_DI_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AY_IX_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AW_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subq_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 src = ((((mc68kcpu)->ir >> 9) - 1) & 7) + 1; - UINT32 ea = EA_AL_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src; - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - m68ki_write_32((mc68kcpu), ea, (mc68kcpu)->not_z_flag); -} - - -void m68000_base_device_ops::m68k_op_subx_8_rr(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_8(*r_dst); - UINT32 res = dst - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; -} - - -void m68000_base_device_ops::m68k_op_subx_16_rr(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - UINT32 dst = MASK_OUT_ABOVE_16(*r_dst); - UINT32 res = dst - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; -} - - -void m68000_base_device_ops::m68k_op_subx_32_rr(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DX(mc68kcpu); - UINT32 src = DY(mc68kcpu); - UINT32 dst = *r_dst; - UINT32 res = dst - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - *r_dst = res; -} - - -void m68000_base_device_ops::m68k_op_subx_8_mm_ax7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_subx_8_mm_ay7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_subx_8_mm_axy7(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_subx_8_mm(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 ea = EA_AX_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - UINT32 res = dst - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_8(res); - (mc68kcpu)->v_flag = VFLAG_SUB_8(src, dst, res); - - res = MASK_OUT_ABOVE_8(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_8((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_subx_16_mm(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_16(mc68kcpu); - UINT32 ea = EA_AX_PD_16(mc68kcpu); - UINT32 dst = m68ki_read_16((mc68kcpu), ea); - UINT32 res = dst - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_16(res); - (mc68kcpu)->v_flag = VFLAG_SUB_16(src, dst, res); - - res = MASK_OUT_ABOVE_16(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_16((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_subx_32_mm(m68000_base_device* mc68kcpu) -{ - UINT32 src = OPER_AY_PD_32(mc68kcpu); - UINT32 ea = EA_AX_PD_32(mc68kcpu); - UINT32 dst = m68ki_read_32((mc68kcpu), ea); - UINT32 res = dst - src - XFLAG_AS_1(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->x_flag = (mc68kcpu)->c_flag = CFLAG_SUB_32(src, dst, res); - (mc68kcpu)->v_flag = VFLAG_SUB_32(src, dst, res); - - res = MASK_OUT_ABOVE_32(res); - (mc68kcpu)->not_z_flag |= res; - - m68ki_write_32((mc68kcpu), ea, res); -} - - -void m68000_base_device_ops::m68k_op_swap_32(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_32(*r_dst<<16); - *r_dst = (*r_dst>>16) | (mc68kcpu)->not_z_flag; - - (mc68kcpu)->not_z_flag = *r_dst; - (mc68kcpu)->n_flag = NFLAG_32(*r_dst); - (mc68kcpu)->c_flag = CFLAG_CLEAR; - (mc68kcpu)->v_flag = VFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tas_8_d(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &DY(mc68kcpu); - - (mc68kcpu)->not_z_flag = MASK_OUT_ABOVE_8(*r_dst); - (mc68kcpu)->n_flag = NFLAG_8(*r_dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - *r_dst |= 0x80; -} - - -void m68000_base_device_ops::m68k_op_tas_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_AI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = dst; - (mc68kcpu)->n_flag = NFLAG_8(dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - /* On the 68000 and 68010, the TAS instruction uses a unique bus cycle that may have - side effects (e.g. delaying DMA) or may fail to write back at all depending on the - bus implementation. - In particular, the Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS - to fail to write back in order to function properly. */ - if (CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type) && !(mc68kcpu)->tas_write_callback.isnull()) - ((mc68kcpu)->tas_write_callback)(*(mc68kcpu)->program, ea, dst | 0x80, 0xff); - else - m68ki_write_8((mc68kcpu), ea, dst | 0x80); -} - - -void m68000_base_device_ops::m68k_op_tas_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = dst; - (mc68kcpu)->n_flag = NFLAG_8(dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - /* On the 68000 and 68010, the TAS instruction uses a unique bus cycle that may have - side effects (e.g. delaying DMA) or may fail to write back at all depending on the - bus implementation. - In particular, the Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS - to fail to write back in order to function properly. */ - if (CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type) && !(mc68kcpu)->tas_write_callback.isnull()) - ((mc68kcpu)->tas_write_callback)(*(mc68kcpu)->program, ea, dst | 0x80, 0xff); - else - m68ki_write_8((mc68kcpu), ea, dst | 0x80); -} - - -void m68000_base_device_ops::m68k_op_tas_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = dst; - (mc68kcpu)->n_flag = NFLAG_8(dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - /* On the 68000 and 68010, the TAS instruction uses a unique bus cycle that may have - side effects (e.g. delaying DMA) or may fail to write back at all depending on the - bus implementation. - In particular, the Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS - to fail to write back in order to function properly. */ - if (CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type) && !(mc68kcpu)->tas_write_callback.isnull()) - ((mc68kcpu)->tas_write_callback)(*(mc68kcpu)->program, ea, dst | 0x80, 0xff); - else - m68ki_write_8((mc68kcpu), ea, dst | 0x80); -} - - -void m68000_base_device_ops::m68k_op_tas_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = dst; - (mc68kcpu)->n_flag = NFLAG_8(dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - /* On the 68000 and 68010, the TAS instruction uses a unique bus cycle that may have - side effects (e.g. delaying DMA) or may fail to write back at all depending on the - bus implementation. - In particular, the Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS - to fail to write back in order to function properly. */ - if (CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type) && !(mc68kcpu)->tas_write_callback.isnull()) - ((mc68kcpu)->tas_write_callback)(*(mc68kcpu)->program, ea, dst | 0x80, 0xff); - else - m68ki_write_8((mc68kcpu), ea, dst | 0x80); -} - - -void m68000_base_device_ops::m68k_op_tas_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_A7_PD_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = dst; - (mc68kcpu)->n_flag = NFLAG_8(dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - /* On the 68000 and 68010, the TAS instruction uses a unique bus cycle that may have - side effects (e.g. delaying DMA) or may fail to write back at all depending on the - bus implementation. - In particular, the Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS - to fail to write back in order to function properly. */ - if (CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type) && !(mc68kcpu)->tas_write_callback.isnull()) - ((mc68kcpu)->tas_write_callback)(*(mc68kcpu)->program, ea, dst | 0x80, 0xff); - else - m68ki_write_8((mc68kcpu), ea, dst | 0x80); -} - - -void m68000_base_device_ops::m68k_op_tas_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_DI_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = dst; - (mc68kcpu)->n_flag = NFLAG_8(dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - /* On the 68000 and 68010, the TAS instruction uses a unique bus cycle that may have - side effects (e.g. delaying DMA) or may fail to write back at all depending on the - bus implementation. - In particular, the Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS - to fail to write back in order to function properly. */ - if (CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type) && !(mc68kcpu)->tas_write_callback.isnull()) - ((mc68kcpu)->tas_write_callback)(*(mc68kcpu)->program, ea, dst | 0x80, 0xff); - else - m68ki_write_8((mc68kcpu), ea, dst | 0x80); -} - - -void m68000_base_device_ops::m68k_op_tas_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AY_IX_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = dst; - (mc68kcpu)->n_flag = NFLAG_8(dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - /* On the 68000 and 68010, the TAS instruction uses a unique bus cycle that may have - side effects (e.g. delaying DMA) or may fail to write back at all depending on the - bus implementation. - In particular, the Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS - to fail to write back in order to function properly. */ - if (CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type) && !(mc68kcpu)->tas_write_callback.isnull()) - ((mc68kcpu)->tas_write_callback)(*(mc68kcpu)->program, ea, dst | 0x80, 0xff); - else - m68ki_write_8((mc68kcpu), ea, dst | 0x80); -} - - -void m68000_base_device_ops::m68k_op_tas_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AW_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = dst; - (mc68kcpu)->n_flag = NFLAG_8(dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - /* On the 68000 and 68010, the TAS instruction uses a unique bus cycle that may have - side effects (e.g. delaying DMA) or may fail to write back at all depending on the - bus implementation. - In particular, the Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS - to fail to write back in order to function properly. */ - if (CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type) && !(mc68kcpu)->tas_write_callback.isnull()) - ((mc68kcpu)->tas_write_callback)(*(mc68kcpu)->program, ea, dst | 0x80, 0xff); - else - m68ki_write_8((mc68kcpu), ea, dst | 0x80); -} - - -void m68000_base_device_ops::m68k_op_tas_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 ea = EA_AL_8(mc68kcpu); - UINT32 dst = m68ki_read_8((mc68kcpu), ea); - - (mc68kcpu)->not_z_flag = dst; - (mc68kcpu)->n_flag = NFLAG_8(dst); - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - - /* On the 68000 and 68010, the TAS instruction uses a unique bus cycle that may have - side effects (e.g. delaying DMA) or may fail to write back at all depending on the - bus implementation. - In particular, the Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS - to fail to write back in order to function properly. */ - if (CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type) && !(mc68kcpu)->tas_write_callback.isnull()) - ((mc68kcpu)->tas_write_callback)(*(mc68kcpu)->program, ea, dst | 0x80, 0xff); - else - m68ki_write_8((mc68kcpu), ea, dst | 0x80); -} - - -void m68000_base_device_ops::m68k_op_trap(m68000_base_device* mc68kcpu) -{ - /* Trap#n stacks exception frame type 0 */ - m68ki_exception_trapN((mc68kcpu), EXCEPTION_TRAP_BASE + ((mc68kcpu)->ir & 0xf)); /* HJB 990403 */ -} - - -void m68000_base_device_ops::m68k_op_trapt(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapt_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapt_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapf(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapf_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapf_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_traphi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_HI(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapls(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LS(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapcc(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_CC(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapcs(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_CS(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapne(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_NE(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapeq(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_EQ(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapvc(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_VC(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapvs(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_VS(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trappl(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_PL(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapmi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_MI(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapge(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_GE(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_traplt(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LT(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapgt(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_GT(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_traple(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LE(mc68kcpu)) - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_traphi_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_HI(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapls_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LS(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapcc_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_CC(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapcs_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_CS(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapne_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_NE(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapeq_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_EQ(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapvc_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_VC(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapvs_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_VS(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trappl_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_PL(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapmi_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_MI(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapge_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_GE(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_traplt_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LT(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapgt_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_GT(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_traple_16(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LE(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 2; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_traphi_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_HI(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapls_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LS(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapcc_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_CC(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapcs_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_CS(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapne_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_NE(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapeq_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_EQ(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapvc_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_VC(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapvs_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_VS(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trappl_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_PL(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapmi_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_MI(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapge_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_GE(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_traplt_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LT(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapgt_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_GT(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_traple_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - if(COND_LE(mc68kcpu)) - { - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC(mc68kcpu) += 4; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_trapv(m68000_base_device* mc68kcpu) -{ - if(COND_VC(mc68kcpu)) - { - return; - } - m68ki_exception_trap((mc68kcpu), EXCEPTION_TRAPV); /* HJB 990403 */ -} - - -void m68000_base_device_ops::m68k_op_tst_8_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_8(DY(mc68kcpu)); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_8_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_8_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_8_pi7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PI_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_8_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_8_pd7(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_A7_PD_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_8_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_8_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_8_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_8_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_8_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 res = OPER_PCDI_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_tst_8_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 res = OPER_PCIX_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_tst_8_i(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 res = OPER_I_8(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_8(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_tst_16_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = MASK_OUT_ABOVE_16(DY(mc68kcpu)); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_16_a(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 res = MAKE_INT_16(AY(mc68kcpu)); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_tst_16_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_16(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_16_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_16(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_16_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_16(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_16_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_16(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_16_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_16(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_16_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_16(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_16_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_16(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_16_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 res = OPER_PCDI_16(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_tst_16_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 res = OPER_PCIX_16(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_tst_16_i(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 res = OPER_I_16(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_16(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_tst_32_d(m68000_base_device* mc68kcpu) -{ - UINT32 res = DY(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_32_a(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 res = AY(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_tst_32_ai(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_AI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_32_pi(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_32_pd(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_PD_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_32_di(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_DI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_32_ix(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AY_IX_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_32_aw(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AW_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_32_al(m68000_base_device* mc68kcpu) -{ - UINT32 res = OPER_AL_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; -} - - -void m68000_base_device_ops::m68k_op_tst_32_pcdi(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 res = OPER_PCDI_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_tst_32_pcix(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 res = OPER_PCIX_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_tst_32_i(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 res = OPER_I_32(mc68kcpu); - - (mc68kcpu)->n_flag = NFLAG_32(res); - (mc68kcpu)->not_z_flag = res; - (mc68kcpu)->v_flag = VFLAG_CLEAR; - (mc68kcpu)->c_flag = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_unlk_32_a7(m68000_base_device* mc68kcpu) -{ - REG_A(mc68kcpu)[7] = m68ki_read_32((mc68kcpu), REG_A(mc68kcpu)[7]); -} - - -void m68000_base_device_ops::m68k_op_unlk_32(m68000_base_device* mc68kcpu) -{ - UINT32* r_dst = &AY(mc68kcpu); - - REG_A(mc68kcpu)[7] = *r_dst; - *r_dst = m68ki_pull_32(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_unpk_16_rr(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - /* Note: DX(mc68kcpu) and DY(mc68kcpu) are reversed in Motorola's docs */ - UINT32 src = DY(mc68kcpu); - UINT32* r_dst = &DX(mc68kcpu); - - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (((((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(mc68kcpu)) & 0xffff); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_unpk_16_mm_ax7(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 ea_dst; - - src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(mc68kcpu); - ea_dst = EA_A7_PD_8(mc68kcpu); - m68ki_write_8((mc68kcpu), ea_dst, src & 0xff); - ea_dst = EA_A7_PD_8(mc68kcpu); - m68ki_write_8((mc68kcpu), ea_dst, (src >> 8) & 0xff); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_unpk_16_mm_ay7(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 ea_dst; - - src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(mc68kcpu); - ea_dst = EA_AX_PD_8(mc68kcpu); - m68ki_write_8((mc68kcpu), ea_dst, src & 0xff); - ea_dst = EA_AX_PD_8(mc68kcpu); - m68ki_write_8((mc68kcpu), ea_dst, (src >> 8) & 0xff); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_unpk_16_mm_axy7(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - UINT32 src = OPER_A7_PD_8(mc68kcpu); - UINT32 ea_dst; - - src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(mc68kcpu); - ea_dst = EA_A7_PD_8(mc68kcpu); - m68ki_write_8((mc68kcpu), ea_dst, src & 0xff); - ea_dst = EA_A7_PD_8(mc68kcpu); - m68ki_write_8((mc68kcpu), ea_dst, (src >> 8) & 0xff); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_unpk_16_mm(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_EC020_PLUS((mc68kcpu)->cpu_type)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - UINT32 src = OPER_AY_PD_8(mc68kcpu); - UINT32 ea_dst; - - src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(mc68kcpu); - ea_dst = EA_AX_PD_8(mc68kcpu); - m68ki_write_8((mc68kcpu), ea_dst, src & 0xff); - ea_dst = EA_AX_PD_8(mc68kcpu); - m68ki_write_8((mc68kcpu), ea_dst, (src >> 8) & 0xff); - return; - } - m68ki_exception_illegal(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cinv_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - UINT16 ir = mc68kcpu->ir; - UINT8 cache = (ir >> 6) & 3; -// UINT8 scope = (ir >> 3) & 3; -// mc68kcpu->logerror("68040 %s: pc=%08x ir=%04x cache=%d scope=%d register=%d\n", ir & 0x0020 ? "cpush" : "cinv", REG_PPC(mc68kcpu), ir, cache, scope, ir & 7); - switch (cache) - { - case 2: - case 3: - // we invalidate/push the whole instruction cache - m68ki_ic_clear(mc68kcpu); - } - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -void m68000_base_device_ops::m68k_op_cpush_32(m68000_base_device* mc68kcpu) -{ - if(CPU_TYPE_IS_040_PLUS((mc68kcpu)->cpu_type)) - { - mc68kcpu->logerror("%s at %08x: called unimplemented instruction %04x (cpush)\n", - (mc68kcpu)->tag(), REG_PC(mc68kcpu) - 2, (mc68kcpu)->ir); - return; - } - m68ki_exception_1111(mc68kcpu); -} - - -/* ======================================================================== */ -/* ============================== END OF FILE ============================= */ -/* ======================================================================== */ - - -/* ======================================================================== */ -/* ========================= OPCODE TABLE BUILDER ========================= */ -/* ======================================================================== */ - -#include "m68kops.h" - -#define NUM_CPU_TYPES 7 - -void (*m68ki_instruction_jump_table[NUM_CPU_TYPES][0x10000])(m68000_base_device *m68k); /* opcode handler jump table */ -unsigned char m68ki_cycles[NUM_CPU_TYPES][0x10000]; /* Cycles used by CPU type */ - -/* This is used to generate the opcode handler jump table */ -struct opcode_handler_struct -{ - void (*opcode_handler)(m68000_base_device *m68k); /* handler function */ - unsigned int mask; /* mask on opcode */ - unsigned int match; /* what to match after masking */ - unsigned char cycles[NUM_CPU_TYPES]; /* cycles each cpu type takes */ -}; - - -/* Opcode handler table */ -static const opcode_handler_struct m68k_opcode_handler_table[] = -{ -/* function mask match 000 010 020 040 */ - - - {m68000_base_device_ops::m68k_op_1010, 0xf000, 0xa000, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_1111, 0xf000, 0xf000, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_moveq_32, 0xf100, 0x7000, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cpbcc_32, 0xf180, 0xf080, {255, 255, 4, 4, 255, 255, 255}}, - {m68000_base_device_ops::m68k_op_cpgen_32, 0xf1c0, 0xf000, {255, 255, 4, 4, 255, 255, 255}}, - {m68000_base_device_ops::m68k_op_cpscc_32, 0xf1c0, 0xf040, {255, 255, 4, 4, 255, 255, 255}}, - {m68000_base_device_ops::m68k_op_pmmu_32, 0xfe00, 0xf000, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_bra_8, 0xff00, 0x6000, { 10, 10, 10, 10, 10, 10, 10}}, - {m68000_base_device_ops::m68k_op_bsr_8, 0xff00, 0x6100, { 18, 18, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_bhi_8, 0xff00, 0x6200, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bls_8, 0xff00, 0x6300, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bcc_8, 0xff00, 0x6400, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bcs_8, 0xff00, 0x6500, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bne_8, 0xff00, 0x6600, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_beq_8, 0xff00, 0x6700, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bvc_8, 0xff00, 0x6800, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bvs_8, 0xff00, 0x6900, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bpl_8, 0xff00, 0x6a00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bmi_8, 0xff00, 0x6b00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bge_8, 0xff00, 0x6c00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_blt_8, 0xff00, 0x6d00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bgt_8, 0xff00, 0x6e00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_ble_8, 0xff00, 0x6f00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_040fpu0_32, 0xff00, 0xf200, {255, 255, 0, 0, 0, 0, 255}}, - {m68000_base_device_ops::m68k_op_040fpu1_32, 0xff00, 0xf300, {255, 255, 0, 0, 0, 0, 255}}, - {m68000_base_device_ops::m68k_op_cinv_32, 0xff20, 0xf400, {255, 255, 255, 255, 16, 255, 255}}, - {m68000_base_device_ops::m68k_op_cpush_32, 0xff20, 0xf420, {255, 255, 255, 255, 16, 255, 255}}, - {m68000_base_device_ops::m68k_op_btst_32_r_d, 0xf1f8, 0x0100, { 6, 6, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_movep_16_er, 0xf1f8, 0x0108, { 16, 16, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_btst_8_r_ai, 0xf1f8, 0x0110, { 8, 8, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_r_pi, 0xf1f8, 0x0118, { 8, 8, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_r_pd, 0xf1f8, 0x0120, { 10, 10, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_r_di, 0xf1f8, 0x0128, { 12, 12, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_r_ix, 0xf1f8, 0x0130, { 14, 14, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_bchg_32_r_d, 0xf1f8, 0x0140, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_movep_32_er, 0xf1f8, 0x0148, { 24, 24, 18, 18, 18, 18, 18}}, - {m68000_base_device_ops::m68k_op_bchg_8_r_ai, 0xf1f8, 0x0150, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_r_pi, 0xf1f8, 0x0158, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_r_pd, 0xf1f8, 0x0160, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_r_di, 0xf1f8, 0x0168, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_r_ix, 0xf1f8, 0x0170, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_bclr_32_r_d, 0xf1f8, 0x0180, { 10, 10, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_movep_16_re, 0xf1f8, 0x0188, { 16, 16, 11, 11, 11, 11, 11}}, - {m68000_base_device_ops::m68k_op_bclr_8_r_ai, 0xf1f8, 0x0190, { 12, 14, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_r_pi, 0xf1f8, 0x0198, { 12, 14, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_r_pd, 0xf1f8, 0x01a0, { 14, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_r_di, 0xf1f8, 0x01a8, { 16, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_r_ix, 0xf1f8, 0x01b0, { 18, 20, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_bset_32_r_d, 0xf1f8, 0x01c0, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_movep_32_re, 0xf1f8, 0x01c8, { 24, 24, 17, 17, 17, 17, 17}}, - {m68000_base_device_ops::m68k_op_bset_8_r_ai, 0xf1f8, 0x01d0, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_r_pi, 0xf1f8, 0x01d8, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_r_pd, 0xf1f8, 0x01e0, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_r_di, 0xf1f8, 0x01e8, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_r_ix, 0xf1f8, 0x01f0, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_8_d_d, 0xf1f8, 0x1000, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_move_8_d_ai, 0xf1f8, 0x1010, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_8_d_pi, 0xf1f8, 0x1018, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_8_d_pd, 0xf1f8, 0x1020, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_move_8_d_di, 0xf1f8, 0x1028, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_move_8_d_ix, 0xf1f8, 0x1030, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_move_8_ai_d, 0xf1f8, 0x1080, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_8_ai_ai, 0xf1f8, 0x1090, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_ai_pi, 0xf1f8, 0x1098, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_ai_pd, 0xf1f8, 0x10a0, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_ai_di, 0xf1f8, 0x10a8, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_ai_ix, 0xf1f8, 0x10b0, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_d, 0xf1f8, 0x10c0, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_ai, 0xf1f8, 0x10d0, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_pi, 0xf1f8, 0x10d8, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_pd, 0xf1f8, 0x10e0, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_di, 0xf1f8, 0x10e8, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_ix, 0xf1f8, 0x10f0, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pd_d, 0xf1f8, 0x1100, { 8, 8, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd_ai, 0xf1f8, 0x1110, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd_pi, 0xf1f8, 0x1118, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd_pd, 0xf1f8, 0x1120, { 14, 14, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd_di, 0xf1f8, 0x1128, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd_ix, 0xf1f8, 0x1130, { 18, 18, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_d, 0xf1f8, 0x1140, { 12, 12, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_ai, 0xf1f8, 0x1150, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_pi, 0xf1f8, 0x1158, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_pd, 0xf1f8, 0x1160, { 18, 18, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_di, 0xf1f8, 0x1168, { 20, 20, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_ix, 0xf1f8, 0x1170, { 22, 22, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_8_ix_d, 0xf1f8, 0x1180, { 14, 14, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_move_8_ix_ai, 0xf1f8, 0x1190, { 18, 18, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_8_ix_pi, 0xf1f8, 0x1198, { 18, 18, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_8_ix_pd, 0xf1f8, 0x11a0, { 20, 20, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_move_8_ix_di, 0xf1f8, 0x11a8, { 22, 22, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_move_8_ix_ix, 0xf1f8, 0x11b0, { 24, 24, 14, 14, 14, 14, 7}}, - {m68000_base_device_ops::m68k_op_move_32_d_d, 0xf1f8, 0x2000, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_move_32_d_a, 0xf1f8, 0x2008, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_move_32_d_ai, 0xf1f8, 0x2010, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_32_d_pi, 0xf1f8, 0x2018, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_32_d_pd, 0xf1f8, 0x2020, { 14, 14, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_move_32_d_di, 0xf1f8, 0x2028, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_move_32_d_ix, 0xf1f8, 0x2030, { 18, 18, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_d, 0xf1f8, 0x2040, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_a, 0xf1f8, 0x2048, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_ai, 0xf1f8, 0x2050, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_pi, 0xf1f8, 0x2058, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_pd, 0xf1f8, 0x2060, { 14, 14, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_di, 0xf1f8, 0x2068, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_ix, 0xf1f8, 0x2070, { 18, 18, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_move_32_ai_d, 0xf1f8, 0x2080, { 12, 12, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_32_ai_a, 0xf1f8, 0x2088, { 12, 12, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_32_ai_ai, 0xf1f8, 0x2090, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_ai_pi, 0xf1f8, 0x2098, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_ai_pd, 0xf1f8, 0x20a0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_32_ai_di, 0xf1f8, 0x20a8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_32_ai_ix, 0xf1f8, 0x20b0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_d, 0xf1f8, 0x20c0, { 12, 12, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_a, 0xf1f8, 0x20c8, { 12, 12, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_ai, 0xf1f8, 0x20d0, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_pi, 0xf1f8, 0x20d8, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_pd, 0xf1f8, 0x20e0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_di, 0xf1f8, 0x20e8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_ix, 0xf1f8, 0x20f0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pd_d, 0xf1f8, 0x2100, { 12, 14, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_move_32_pd_a, 0xf1f8, 0x2108, { 12, 14, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_move_32_pd_ai, 0xf1f8, 0x2110, { 20, 22, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_32_pd_pi, 0xf1f8, 0x2118, { 20, 22, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_32_pd_pd, 0xf1f8, 0x2120, { 22, 24, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_32_pd_di, 0xf1f8, 0x2128, { 24, 26, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_32_pd_ix, 0xf1f8, 0x2130, { 26, 28, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_d, 0xf1f8, 0x2140, { 16, 16, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_a, 0xf1f8, 0x2148, { 16, 16, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_ai, 0xf1f8, 0x2150, { 24, 24, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_pi, 0xf1f8, 0x2158, { 24, 24, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_pd, 0xf1f8, 0x2160, { 26, 26, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_di, 0xf1f8, 0x2168, { 28, 28, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_ix, 0xf1f8, 0x2170, { 30, 30, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_32_ix_d, 0xf1f8, 0x2180, { 18, 18, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_move_32_ix_a, 0xf1f8, 0x2188, { 18, 18, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_move_32_ix_ai, 0xf1f8, 0x2190, { 26, 26, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_32_ix_pi, 0xf1f8, 0x2198, { 26, 26, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_32_ix_pd, 0xf1f8, 0x21a0, { 28, 28, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_move_32_ix_di, 0xf1f8, 0x21a8, { 30, 30, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_move_32_ix_ix, 0xf1f8, 0x21b0, { 32, 32, 14, 14, 14, 14, 7}}, - {m68000_base_device_ops::m68k_op_move_16_d_d, 0xf1f8, 0x3000, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_move_16_d_a, 0xf1f8, 0x3008, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_move_16_d_ai, 0xf1f8, 0x3010, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_16_d_pi, 0xf1f8, 0x3018, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_16_d_pd, 0xf1f8, 0x3020, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_move_16_d_di, 0xf1f8, 0x3028, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_move_16_d_ix, 0xf1f8, 0x3030, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_d, 0xf1f8, 0x3040, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_a, 0xf1f8, 0x3048, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_ai, 0xf1f8, 0x3050, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_pi, 0xf1f8, 0x3058, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_pd, 0xf1f8, 0x3060, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_di, 0xf1f8, 0x3068, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_ix, 0xf1f8, 0x3070, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_move_16_ai_d, 0xf1f8, 0x3080, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_16_ai_a, 0xf1f8, 0x3088, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_16_ai_ai, 0xf1f8, 0x3090, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_ai_pi, 0xf1f8, 0x3098, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_ai_pd, 0xf1f8, 0x30a0, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_ai_di, 0xf1f8, 0x30a8, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_ai_ix, 0xf1f8, 0x30b0, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_d, 0xf1f8, 0x30c0, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_a, 0xf1f8, 0x30c8, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_ai, 0xf1f8, 0x30d0, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_pi, 0xf1f8, 0x30d8, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_pd, 0xf1f8, 0x30e0, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_di, 0xf1f8, 0x30e8, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_ix, 0xf1f8, 0x30f0, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pd_d, 0xf1f8, 0x3100, { 8, 8, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_move_16_pd_a, 0xf1f8, 0x3108, { 8, 8, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_move_16_pd_ai, 0xf1f8, 0x3110, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_16_pd_pi, 0xf1f8, 0x3118, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_16_pd_pd, 0xf1f8, 0x3120, { 14, 14, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_16_pd_di, 0xf1f8, 0x3128, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_16_pd_ix, 0xf1f8, 0x3130, { 18, 18, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_d, 0xf1f8, 0x3140, { 12, 12, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_a, 0xf1f8, 0x3148, { 12, 12, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_ai, 0xf1f8, 0x3150, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_pi, 0xf1f8, 0x3158, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_pd, 0xf1f8, 0x3160, { 18, 18, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_di, 0xf1f8, 0x3168, { 20, 20, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_ix, 0xf1f8, 0x3170, { 22, 22, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_16_ix_d, 0xf1f8, 0x3180, { 14, 14, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_move_16_ix_a, 0xf1f8, 0x3188, { 14, 14, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_move_16_ix_ai, 0xf1f8, 0x3190, { 18, 18, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_16_ix_pi, 0xf1f8, 0x3198, { 18, 18, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_16_ix_pd, 0xf1f8, 0x31a0, { 20, 20, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_move_16_ix_di, 0xf1f8, 0x31a8, { 22, 22, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_move_16_ix_ix, 0xf1f8, 0x31b0, { 24, 24, 14, 14, 14, 14, 7}}, - {m68000_base_device_ops::m68k_op_chk_32_d, 0xf1f8, 0x4100, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_chk_32_ai, 0xf1f8, 0x4110, {255, 255, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_chk_32_pi, 0xf1f8, 0x4118, {255, 255, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_chk_32_pd, 0xf1f8, 0x4120, {255, 255, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_chk_32_di, 0xf1f8, 0x4128, {255, 255, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_chk_32_ix, 0xf1f8, 0x4130, {255, 255, 15, 15, 15, 15, 8}}, - {m68000_base_device_ops::m68k_op_chk_16_d, 0xf1f8, 0x4180, { 10, 8, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_chk_16_ai, 0xf1f8, 0x4190, { 14, 12, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_chk_16_pi, 0xf1f8, 0x4198, { 14, 12, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_chk_16_pd, 0xf1f8, 0x41a0, { 16, 14, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_chk_16_di, 0xf1f8, 0x41a8, { 18, 16, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_chk_16_ix, 0xf1f8, 0x41b0, { 20, 18, 15, 15, 15, 15, 8}}, - {m68000_base_device_ops::m68k_op_lea_32_ai, 0xf1f8, 0x41d0, { 4, 4, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_lea_32_di, 0xf1f8, 0x41e8, { 8, 8, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_lea_32_ix, 0xf1f8, 0x41f0, { 12, 12, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_addq_8_d, 0xf1f8, 0x5000, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_addq_8_ai, 0xf1f8, 0x5010, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_8_pi, 0xf1f8, 0x5018, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_8_pd, 0xf1f8, 0x5020, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addq_8_di, 0xf1f8, 0x5028, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addq_8_ix, 0xf1f8, 0x5030, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_addq_16_d, 0xf1f8, 0x5040, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_addq_16_a, 0xf1f8, 0x5048, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_addq_16_ai, 0xf1f8, 0x5050, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_16_pi, 0xf1f8, 0x5058, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_16_pd, 0xf1f8, 0x5060, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addq_16_di, 0xf1f8, 0x5068, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addq_16_ix, 0xf1f8, 0x5070, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_addq_32_d, 0xf1f8, 0x5080, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_addq_32_a, 0xf1f8, 0x5088, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_addq_32_ai, 0xf1f8, 0x5090, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_32_pi, 0xf1f8, 0x5098, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_32_pd, 0xf1f8, 0x50a0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addq_32_di, 0xf1f8, 0x50a8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addq_32_ix, 0xf1f8, 0x50b0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_subq_8_d, 0xf1f8, 0x5100, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_subq_8_ai, 0xf1f8, 0x5110, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_8_pi, 0xf1f8, 0x5118, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_8_pd, 0xf1f8, 0x5120, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subq_8_di, 0xf1f8, 0x5128, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subq_8_ix, 0xf1f8, 0x5130, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_subq_16_d, 0xf1f8, 0x5140, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_subq_16_a, 0xf1f8, 0x5148, { 8, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_subq_16_ai, 0xf1f8, 0x5150, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_16_pi, 0xf1f8, 0x5158, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_16_pd, 0xf1f8, 0x5160, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subq_16_di, 0xf1f8, 0x5168, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subq_16_ix, 0xf1f8, 0x5170, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_subq_32_d, 0xf1f8, 0x5180, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_subq_32_a, 0xf1f8, 0x5188, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_subq_32_ai, 0xf1f8, 0x5190, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_32_pi, 0xf1f8, 0x5198, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_32_pd, 0xf1f8, 0x51a0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subq_32_di, 0xf1f8, 0x51a8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subq_32_ix, 0xf1f8, 0x51b0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_or_8_er_d, 0xf1f8, 0x8000, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_or_8_er_ai, 0xf1f8, 0x8010, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_8_er_pi, 0xf1f8, 0x8018, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_8_er_pd, 0xf1f8, 0x8020, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_or_8_er_di, 0xf1f8, 0x8028, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_or_8_er_ix, 0xf1f8, 0x8030, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_or_16_er_d, 0xf1f8, 0x8040, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_or_16_er_ai, 0xf1f8, 0x8050, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_16_er_pi, 0xf1f8, 0x8058, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_16_er_pd, 0xf1f8, 0x8060, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_or_16_er_di, 0xf1f8, 0x8068, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_or_16_er_ix, 0xf1f8, 0x8070, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_or_32_er_d, 0xf1f8, 0x8080, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_or_32_er_ai, 0xf1f8, 0x8090, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_32_er_pi, 0xf1f8, 0x8098, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_32_er_pd, 0xf1f8, 0x80a0, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_or_32_er_di, 0xf1f8, 0x80a8, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_or_32_er_ix, 0xf1f8, 0x80b0, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_divu_16_d, 0xf1f8, 0x80c0, {140, 108, 44, 44, 44, 44, 44}}, - {m68000_base_device_ops::m68k_op_divu_16_ai, 0xf1f8, 0x80d0, {144, 112, 48, 48, 48, 48, 44}}, - {m68000_base_device_ops::m68k_op_divu_16_pi, 0xf1f8, 0x80d8, {144, 112, 48, 48, 48, 48, 44}}, - {m68000_base_device_ops::m68k_op_divu_16_pd, 0xf1f8, 0x80e0, {146, 114, 49, 49, 49, 49, 44}}, - {m68000_base_device_ops::m68k_op_divu_16_di, 0xf1f8, 0x80e8, {148, 116, 49, 49, 49, 49, 44}}, - {m68000_base_device_ops::m68k_op_divu_16_ix, 0xf1f8, 0x80f0, {150, 118, 51, 51, 51, 51, 44}}, - {m68000_base_device_ops::m68k_op_sbcd_8_rr, 0xf1f8, 0x8100, { 6, 6, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_sbcd_8_mm, 0xf1f8, 0x8108, { 18, 18, 16, 16, 16, 16, 16}}, - {m68000_base_device_ops::m68k_op_or_8_re_ai, 0xf1f8, 0x8110, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_or_8_re_pi, 0xf1f8, 0x8118, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_or_8_re_pd, 0xf1f8, 0x8120, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_or_8_re_di, 0xf1f8, 0x8128, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_or_8_re_ix, 0xf1f8, 0x8130, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_pack_16_rr, 0xf1f8, 0x8140, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_pack_16_mm, 0xf1f8, 0x8148, {255, 255, 13, 13, 13, 13, 13}}, - {m68000_base_device_ops::m68k_op_or_16_re_ai, 0xf1f8, 0x8150, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_or_16_re_pi, 0xf1f8, 0x8158, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_or_16_re_pd, 0xf1f8, 0x8160, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_or_16_re_di, 0xf1f8, 0x8168, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_or_16_re_ix, 0xf1f8, 0x8170, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_unpk_16_rr, 0xf1f8, 0x8180, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_unpk_16_mm, 0xf1f8, 0x8188, {255, 255, 13, 13, 13, 13, 13}}, - {m68000_base_device_ops::m68k_op_or_32_re_ai, 0xf1f8, 0x8190, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_or_32_re_pi, 0xf1f8, 0x8198, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_or_32_re_pd, 0xf1f8, 0x81a0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_or_32_re_di, 0xf1f8, 0x81a8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_or_32_re_ix, 0xf1f8, 0x81b0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_divs_16_d, 0xf1f8, 0x81c0, {158, 122, 56, 56, 56, 56, 56}}, - {m68000_base_device_ops::m68k_op_divs_16_ai, 0xf1f8, 0x81d0, {162, 126, 60, 60, 60, 60, 56}}, - {m68000_base_device_ops::m68k_op_divs_16_pi, 0xf1f8, 0x81d8, {162, 126, 60, 60, 60, 60, 56}}, - {m68000_base_device_ops::m68k_op_divs_16_pd, 0xf1f8, 0x81e0, {164, 128, 61, 61, 61, 61, 56}}, - {m68000_base_device_ops::m68k_op_divs_16_di, 0xf1f8, 0x81e8, {166, 130, 61, 61, 61, 61, 56}}, - {m68000_base_device_ops::m68k_op_divs_16_ix, 0xf1f8, 0x81f0, {168, 132, 63, 63, 63, 63, 56}}, - {m68000_base_device_ops::m68k_op_sub_8_er_d, 0xf1f8, 0x9000, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_sub_8_er_ai, 0xf1f8, 0x9010, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_8_er_pi, 0xf1f8, 0x9018, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_8_er_pd, 0xf1f8, 0x9020, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_sub_8_er_di, 0xf1f8, 0x9028, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_sub_8_er_ix, 0xf1f8, 0x9030, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_d, 0xf1f8, 0x9040, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_a, 0xf1f8, 0x9048, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_ai, 0xf1f8, 0x9050, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_pi, 0xf1f8, 0x9058, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_pd, 0xf1f8, 0x9060, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_di, 0xf1f8, 0x9068, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_ix, 0xf1f8, 0x9070, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_d, 0xf1f8, 0x9080, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_a, 0xf1f8, 0x9088, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_ai, 0xf1f8, 0x9090, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_pi, 0xf1f8, 0x9098, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_pd, 0xf1f8, 0x90a0, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_di, 0xf1f8, 0x90a8, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_ix, 0xf1f8, 0x90b0, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_d, 0xf1f8, 0x90c0, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_a, 0xf1f8, 0x90c8, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_ai, 0xf1f8, 0x90d0, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_pi, 0xf1f8, 0x90d8, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_pd, 0xf1f8, 0x90e0, { 14, 14, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_di, 0xf1f8, 0x90e8, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_ix, 0xf1f8, 0x90f0, { 18, 18, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_subx_8_rr, 0xf1f8, 0x9100, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_subx_8_mm, 0xf1f8, 0x9108, { 18, 18, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_sub_8_re_ai, 0xf1f8, 0x9110, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_8_re_pi, 0xf1f8, 0x9118, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_8_re_pd, 0xf1f8, 0x9120, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_sub_8_re_di, 0xf1f8, 0x9128, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_sub_8_re_ix, 0xf1f8, 0x9130, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_subx_16_rr, 0xf1f8, 0x9140, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_subx_16_mm, 0xf1f8, 0x9148, { 18, 18, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_sub_16_re_ai, 0xf1f8, 0x9150, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_16_re_pi, 0xf1f8, 0x9158, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_16_re_pd, 0xf1f8, 0x9160, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_sub_16_re_di, 0xf1f8, 0x9168, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_sub_16_re_ix, 0xf1f8, 0x9170, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_subx_32_rr, 0xf1f8, 0x9180, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_subx_32_mm, 0xf1f8, 0x9188, { 30, 30, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_sub_32_re_ai, 0xf1f8, 0x9190, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_32_re_pi, 0xf1f8, 0x9198, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_32_re_pd, 0xf1f8, 0x91a0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_sub_32_re_di, 0xf1f8, 0x91a8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_sub_32_re_ix, 0xf1f8, 0x91b0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_suba_32_d, 0xf1f8, 0x91c0, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_suba_32_a, 0xf1f8, 0x91c8, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_suba_32_ai, 0xf1f8, 0x91d0, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_suba_32_pi, 0xf1f8, 0x91d8, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_suba_32_pd, 0xf1f8, 0x91e0, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_suba_32_di, 0xf1f8, 0x91e8, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_suba_32_ix, 0xf1f8, 0x91f0, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_d, 0xf1f8, 0xb000, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_ai, 0xf1f8, 0xb010, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_pi, 0xf1f8, 0xb018, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_pd, 0xf1f8, 0xb020, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_di, 0xf1f8, 0xb028, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_ix, 0xf1f8, 0xb030, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_d, 0xf1f8, 0xb040, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_a, 0xf1f8, 0xb048, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_ai, 0xf1f8, 0xb050, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_pi, 0xf1f8, 0xb058, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_pd, 0xf1f8, 0xb060, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_di, 0xf1f8, 0xb068, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_ix, 0xf1f8, 0xb070, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_d, 0xf1f8, 0xb080, { 6, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_a, 0xf1f8, 0xb088, { 6, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_ai, 0xf1f8, 0xb090, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_pi, 0xf1f8, 0xb098, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_pd, 0xf1f8, 0xb0a0, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_di, 0xf1f8, 0xb0a8, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_ix, 0xf1f8, 0xb0b0, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_cmpa_16_d, 0xf1f8, 0xb0c0, { 6, 6, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_16_a, 0xf1f8, 0xb0c8, { 6, 6, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_16_ai, 0xf1f8, 0xb0d0, { 10, 10, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_16_pi, 0xf1f8, 0xb0d8, { 10, 10, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_16_pd, 0xf1f8, 0xb0e0, { 12, 12, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_16_di, 0xf1f8, 0xb0e8, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_16_ix, 0xf1f8, 0xb0f0, { 16, 16, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_eor_8_d, 0xf1f8, 0xb100, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cmpm_8, 0xf1f8, 0xb108, { 12, 12, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_eor_8_ai, 0xf1f8, 0xb110, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_8_pi, 0xf1f8, 0xb118, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_8_pd, 0xf1f8, 0xb120, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eor_8_di, 0xf1f8, 0xb128, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eor_8_ix, 0xf1f8, 0xb130, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_eor_16_d, 0xf1f8, 0xb140, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cmpm_16, 0xf1f8, 0xb148, { 12, 12, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_eor_16_ai, 0xf1f8, 0xb150, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_16_pi, 0xf1f8, 0xb158, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_16_pd, 0xf1f8, 0xb160, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eor_16_di, 0xf1f8, 0xb168, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eor_16_ix, 0xf1f8, 0xb170, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_eor_32_d, 0xf1f8, 0xb180, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cmpm_32, 0xf1f8, 0xb188, { 20, 20, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_eor_32_ai, 0xf1f8, 0xb190, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_32_pi, 0xf1f8, 0xb198, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_32_pd, 0xf1f8, 0xb1a0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eor_32_di, 0xf1f8, 0xb1a8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eor_32_ix, 0xf1f8, 0xb1b0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_d, 0xf1f8, 0xb1c0, { 6, 6, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_a, 0xf1f8, 0xb1c8, { 6, 6, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_ai, 0xf1f8, 0xb1d0, { 14, 14, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_pi, 0xf1f8, 0xb1d8, { 14, 14, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_pd, 0xf1f8, 0xb1e0, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_di, 0xf1f8, 0xb1e8, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_ix, 0xf1f8, 0xb1f0, { 20, 20, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_and_8_er_d, 0xf1f8, 0xc000, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_and_8_er_ai, 0xf1f8, 0xc010, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_8_er_pi, 0xf1f8, 0xc018, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_8_er_pd, 0xf1f8, 0xc020, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_and_8_er_di, 0xf1f8, 0xc028, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_and_8_er_ix, 0xf1f8, 0xc030, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_and_16_er_d, 0xf1f8, 0xc040, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_and_16_er_ai, 0xf1f8, 0xc050, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_16_er_pi, 0xf1f8, 0xc058, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_16_er_pd, 0xf1f8, 0xc060, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_and_16_er_di, 0xf1f8, 0xc068, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_and_16_er_ix, 0xf1f8, 0xc070, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_and_32_er_d, 0xf1f8, 0xc080, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_and_32_er_ai, 0xf1f8, 0xc090, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_32_er_pi, 0xf1f8, 0xc098, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_32_er_pd, 0xf1f8, 0xc0a0, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_and_32_er_di, 0xf1f8, 0xc0a8, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_and_32_er_ix, 0xf1f8, 0xc0b0, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_mulu_16_d, 0xf1f8, 0xc0c0, { 54, 30, 27, 27, 27, 27, 27}}, - {m68000_base_device_ops::m68k_op_mulu_16_ai, 0xf1f8, 0xc0d0, { 58, 34, 31, 31, 31, 31, 27}}, - {m68000_base_device_ops::m68k_op_mulu_16_pi, 0xf1f8, 0xc0d8, { 58, 34, 31, 31, 31, 31, 27}}, - {m68000_base_device_ops::m68k_op_mulu_16_pd, 0xf1f8, 0xc0e0, { 60, 36, 32, 32, 32, 32, 27}}, - {m68000_base_device_ops::m68k_op_mulu_16_di, 0xf1f8, 0xc0e8, { 62, 38, 32, 32, 32, 32, 27}}, - {m68000_base_device_ops::m68k_op_mulu_16_ix, 0xf1f8, 0xc0f0, { 64, 40, 34, 34, 34, 34, 27}}, - {m68000_base_device_ops::m68k_op_abcd_8_rr, 0xf1f8, 0xc100, { 6, 6, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_abcd_8_mm, 0xf1f8, 0xc108, { 18, 18, 16, 16, 16, 16, 16}}, - {m68000_base_device_ops::m68k_op_and_8_re_ai, 0xf1f8, 0xc110, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_8_re_pi, 0xf1f8, 0xc118, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_8_re_pd, 0xf1f8, 0xc120, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_and_8_re_di, 0xf1f8, 0xc128, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_and_8_re_ix, 0xf1f8, 0xc130, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_exg_32_dd, 0xf1f8, 0xc140, { 6, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_exg_32_aa, 0xf1f8, 0xc148, { 6, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_and_16_re_ai, 0xf1f8, 0xc150, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_16_re_pi, 0xf1f8, 0xc158, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_16_re_pd, 0xf1f8, 0xc160, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_and_16_re_di, 0xf1f8, 0xc168, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_and_16_re_ix, 0xf1f8, 0xc170, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_exg_32_da, 0xf1f8, 0xc188, { 6, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_and_32_re_ai, 0xf1f8, 0xc190, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_32_re_pi, 0xf1f8, 0xc198, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_32_re_pd, 0xf1f8, 0xc1a0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_and_32_re_di, 0xf1f8, 0xc1a8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_and_32_re_ix, 0xf1f8, 0xc1b0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_muls_16_d, 0xf1f8, 0xc1c0, { 54, 32, 27, 27, 27, 27, 27}}, - {m68000_base_device_ops::m68k_op_muls_16_ai, 0xf1f8, 0xc1d0, { 58, 36, 31, 31, 31, 31, 27}}, - {m68000_base_device_ops::m68k_op_muls_16_pi, 0xf1f8, 0xc1d8, { 58, 36, 31, 31, 31, 31, 27}}, - {m68000_base_device_ops::m68k_op_muls_16_pd, 0xf1f8, 0xc1e0, { 60, 38, 32, 32, 32, 32, 27}}, - {m68000_base_device_ops::m68k_op_muls_16_di, 0xf1f8, 0xc1e8, { 62, 40, 32, 32, 32, 32, 27}}, - {m68000_base_device_ops::m68k_op_muls_16_ix, 0xf1f8, 0xc1f0, { 64, 42, 34, 34, 34, 34, 27}}, - {m68000_base_device_ops::m68k_op_add_8_er_d, 0xf1f8, 0xd000, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_add_8_er_ai, 0xf1f8, 0xd010, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_8_er_pi, 0xf1f8, 0xd018, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_8_er_pd, 0xf1f8, 0xd020, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_add_8_er_di, 0xf1f8, 0xd028, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_add_8_er_ix, 0xf1f8, 0xd030, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_d, 0xf1f8, 0xd040, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_a, 0xf1f8, 0xd048, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_ai, 0xf1f8, 0xd050, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_pi, 0xf1f8, 0xd058, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_pd, 0xf1f8, 0xd060, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_di, 0xf1f8, 0xd068, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_ix, 0xf1f8, 0xd070, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_d, 0xf1f8, 0xd080, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_a, 0xf1f8, 0xd088, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_ai, 0xf1f8, 0xd090, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_pi, 0xf1f8, 0xd098, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_pd, 0xf1f8, 0xd0a0, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_di, 0xf1f8, 0xd0a8, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_ix, 0xf1f8, 0xd0b0, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_d, 0xf1f8, 0xd0c0, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_a, 0xf1f8, 0xd0c8, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_ai, 0xf1f8, 0xd0d0, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_pi, 0xf1f8, 0xd0d8, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_pd, 0xf1f8, 0xd0e0, { 14, 14, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_di, 0xf1f8, 0xd0e8, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_ix, 0xf1f8, 0xd0f0, { 18, 18, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_addx_8_rr, 0xf1f8, 0xd100, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_addx_8_mm, 0xf1f8, 0xd108, { 18, 18, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_add_8_re_ai, 0xf1f8, 0xd110, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_8_re_pi, 0xf1f8, 0xd118, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_8_re_pd, 0xf1f8, 0xd120, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_add_8_re_di, 0xf1f8, 0xd128, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_add_8_re_ix, 0xf1f8, 0xd130, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_addx_16_rr, 0xf1f8, 0xd140, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_addx_16_mm, 0xf1f8, 0xd148, { 18, 18, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_add_16_re_ai, 0xf1f8, 0xd150, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_16_re_pi, 0xf1f8, 0xd158, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_16_re_pd, 0xf1f8, 0xd160, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_add_16_re_di, 0xf1f8, 0xd168, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_add_16_re_ix, 0xf1f8, 0xd170, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_addx_32_rr, 0xf1f8, 0xd180, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_addx_32_mm, 0xf1f8, 0xd188, { 30, 30, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_add_32_re_ai, 0xf1f8, 0xd190, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_32_re_pi, 0xf1f8, 0xd198, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_32_re_pd, 0xf1f8, 0xd1a0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_add_32_re_di, 0xf1f8, 0xd1a8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_add_32_re_ix, 0xf1f8, 0xd1b0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_adda_32_d, 0xf1f8, 0xd1c0, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_adda_32_a, 0xf1f8, 0xd1c8, { 8, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_adda_32_ai, 0xf1f8, 0xd1d0, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_adda_32_pi, 0xf1f8, 0xd1d8, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_adda_32_pd, 0xf1f8, 0xd1e0, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_adda_32_di, 0xf1f8, 0xd1e8, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_adda_32_ix, 0xf1f8, 0xd1f0, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_asr_8_s, 0xf1f8, 0xe000, { 6, 6, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_lsr_8_s, 0xf1f8, 0xe008, { 6, 6, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_roxr_8_s, 0xf1f8, 0xe010, { 6, 6, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_ror_8_s, 0xf1f8, 0xe018, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_asr_8_r, 0xf1f8, 0xe020, { 6, 6, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_lsr_8_r, 0xf1f8, 0xe028, { 6, 6, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_roxr_8_r, 0xf1f8, 0xe030, { 6, 6, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_ror_8_r, 0xf1f8, 0xe038, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_asr_16_s, 0xf1f8, 0xe040, { 6, 6, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_lsr_16_s, 0xf1f8, 0xe048, { 6, 6, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_roxr_16_s, 0xf1f8, 0xe050, { 6, 6, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_ror_16_s, 0xf1f8, 0xe058, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_asr_16_r, 0xf1f8, 0xe060, { 6, 6, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_lsr_16_r, 0xf1f8, 0xe068, { 6, 6, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_roxr_16_r, 0xf1f8, 0xe070, { 6, 6, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_ror_16_r, 0xf1f8, 0xe078, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_asr_32_s, 0xf1f8, 0xe080, { 8, 8, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_lsr_32_s, 0xf1f8, 0xe088, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_roxr_32_s, 0xf1f8, 0xe090, { 8, 8, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_ror_32_s, 0xf1f8, 0xe098, { 8, 8, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_asr_32_r, 0xf1f8, 0xe0a0, { 8, 8, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_lsr_32_r, 0xf1f8, 0xe0a8, { 8, 8, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_roxr_32_r, 0xf1f8, 0xe0b0, { 8, 8, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_ror_32_r, 0xf1f8, 0xe0b8, { 8, 8, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_asl_8_s, 0xf1f8, 0xe100, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_lsl_8_s, 0xf1f8, 0xe108, { 6, 6, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_roxl_8_s, 0xf1f8, 0xe110, { 6, 6, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_rol_8_s, 0xf1f8, 0xe118, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_asl_8_r, 0xf1f8, 0xe120, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_lsl_8_r, 0xf1f8, 0xe128, { 6, 6, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_roxl_8_r, 0xf1f8, 0xe130, { 6, 6, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_rol_8_r, 0xf1f8, 0xe138, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_asl_16_s, 0xf1f8, 0xe140, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_lsl_16_s, 0xf1f8, 0xe148, { 6, 6, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_roxl_16_s, 0xf1f8, 0xe150, { 6, 6, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_rol_16_s, 0xf1f8, 0xe158, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_asl_16_r, 0xf1f8, 0xe160, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_lsl_16_r, 0xf1f8, 0xe168, { 6, 6, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_roxl_16_r, 0xf1f8, 0xe170, { 6, 6, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_rol_16_r, 0xf1f8, 0xe178, { 6, 6, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_asl_32_s, 0xf1f8, 0xe180, { 8, 8, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_lsl_32_s, 0xf1f8, 0xe188, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_roxl_32_s, 0xf1f8, 0xe190, { 8, 8, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_rol_32_s, 0xf1f8, 0xe198, { 8, 8, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_asl_32_r, 0xf1f8, 0xe1a0, { 8, 8, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_lsl_32_r, 0xf1f8, 0xe1a8, { 8, 8, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_roxl_32_r, 0xf1f8, 0xe1b0, { 8, 8, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_rol_32_r, 0xf1f8, 0xe1b8, { 8, 8, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_cpdbcc_32, 0xf1f8, 0xf048, {255, 255, 4, 4, 255, 255, 255}}, - {m68000_base_device_ops::m68k_op_cptrapcc_32, 0xf1f8, 0xf078, {255, 255, 4, 4, 255, 255, 255}}, - {m68000_base_device_ops::m68k_op_ptest_32, 0xffd8, 0xf548, {255, 255, 255, 255, 8, 255, 255}}, - {m68000_base_device_ops::m68k_op_rtm_32, 0xfff0, 0x06c0, {255, 255, 19, 19, 19, 19, 19}}, - {m68000_base_device_ops::m68k_op_trap, 0xfff0, 0x4e40, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_r_pi7, 0xf1ff, 0x011f, { 8, 8, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_r_pd7, 0xf1ff, 0x0127, { 10, 10, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_r_aw, 0xf1ff, 0x0138, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_r_al, 0xf1ff, 0x0139, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_r_pcdi, 0xf1ff, 0x013a, { 12, 12, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_r_pcix, 0xf1ff, 0x013b, { 14, 14, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_r_i, 0xf1ff, 0x013c, { 8, 8, 6, 6, 6, 6, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_r_pi7, 0xf1ff, 0x015f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_r_pd7, 0xf1ff, 0x0167, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_r_aw, 0xf1ff, 0x0178, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_r_al, 0xf1ff, 0x0179, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_r_pi7, 0xf1ff, 0x019f, { 12, 14, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_r_pd7, 0xf1ff, 0x01a7, { 14, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_r_aw, 0xf1ff, 0x01b8, { 16, 18, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_r_al, 0xf1ff, 0x01b9, { 20, 22, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_r_pi7, 0xf1ff, 0x01df, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_r_pd7, 0xf1ff, 0x01e7, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_r_aw, 0xf1ff, 0x01f8, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_r_al, 0xf1ff, 0x01f9, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_d_pi7, 0xf1ff, 0x101f, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_8_d_pd7, 0xf1ff, 0x1027, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_move_8_d_aw, 0xf1ff, 0x1038, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_8_d_al, 0xf1ff, 0x1039, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_8_d_pcdi, 0xf1ff, 0x103a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_move_8_d_pcix, 0xf1ff, 0x103b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_move_8_d_i, 0xf1ff, 0x103c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_move_8_ai_pi7, 0xf1ff, 0x109f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_ai_pd7, 0xf1ff, 0x10a7, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_ai_aw, 0xf1ff, 0x10b8, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_ai_al, 0xf1ff, 0x10b9, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_ai_pcdi, 0xf1ff, 0x10ba, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_ai_pcix, 0xf1ff, 0x10bb, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_8_ai_i, 0xf1ff, 0x10bc, { 12, 12, 6, 6, 6, 6, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_pi7, 0xf1ff, 0x10df, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_pd7, 0xf1ff, 0x10e7, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_aw, 0xf1ff, 0x10f8, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_al, 0xf1ff, 0x10f9, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_pcdi, 0xf1ff, 0x10fa, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_pcix, 0xf1ff, 0x10fb, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi_i, 0xf1ff, 0x10fc, { 12, 12, 6, 6, 6, 6, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pd_pi7, 0xf1ff, 0x111f, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd_pd7, 0xf1ff, 0x1127, { 14, 14, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd_aw, 0xf1ff, 0x1138, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd_al, 0xf1ff, 0x1139, { 20, 20, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd_pcdi, 0xf1ff, 0x113a, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd_pcix, 0xf1ff, 0x113b, { 18, 18, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd_i, 0xf1ff, 0x113c, { 12, 12, 7, 7, 7, 7, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_pi7, 0xf1ff, 0x115f, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_pd7, 0xf1ff, 0x1167, { 18, 18, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_aw, 0xf1ff, 0x1178, { 20, 20, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_al, 0xf1ff, 0x1179, { 24, 24, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_pcdi, 0xf1ff, 0x117a, { 20, 20, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_pcix, 0xf1ff, 0x117b, { 22, 22, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_8_di_i, 0xf1ff, 0x117c, { 16, 16, 7, 7, 7, 7, 5}}, - {m68000_base_device_ops::m68k_op_move_8_ix_pi7, 0xf1ff, 0x119f, { 18, 18, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_8_ix_pd7, 0xf1ff, 0x11a7, { 20, 20, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_move_8_ix_aw, 0xf1ff, 0x11b8, { 22, 22, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_8_ix_al, 0xf1ff, 0x11b9, { 26, 26, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_8_ix_pcdi, 0xf1ff, 0x11ba, { 22, 22, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_move_8_ix_pcix, 0xf1ff, 0x11bb, { 24, 24, 14, 14, 14, 14, 7}}, - {m68000_base_device_ops::m68k_op_move_8_ix_i, 0xf1ff, 0x11bc, { 18, 18, 9, 9, 9, 9, 7}}, - {m68000_base_device_ops::m68k_op_move_32_d_aw, 0xf1ff, 0x2038, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_32_d_al, 0xf1ff, 0x2039, { 20, 20, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_32_d_pcdi, 0xf1ff, 0x203a, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_move_32_d_pcix, 0xf1ff, 0x203b, { 18, 18, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_move_32_d_i, 0xf1ff, 0x203c, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_aw, 0xf1ff, 0x2078, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_al, 0xf1ff, 0x2079, { 20, 20, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_pcdi, 0xf1ff, 0x207a, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_pcix, 0xf1ff, 0x207b, { 18, 18, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_movea_32_i, 0xf1ff, 0x207c, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_32_ai_aw, 0xf1ff, 0x20b8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_ai_al, 0xf1ff, 0x20b9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_ai_pcdi, 0xf1ff, 0x20ba, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_32_ai_pcix, 0xf1ff, 0x20bb, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_32_ai_i, 0xf1ff, 0x20bc, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_aw, 0xf1ff, 0x20f8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_al, 0xf1ff, 0x20f9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_pcdi, 0xf1ff, 0x20fa, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_pcix, 0xf1ff, 0x20fb, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pi_i, 0xf1ff, 0x20fc, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_pd_aw, 0xf1ff, 0x2138, { 24, 26, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_32_pd_al, 0xf1ff, 0x2139, { 28, 30, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_32_pd_pcdi, 0xf1ff, 0x213a, { 24, 26, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_32_pd_pcix, 0xf1ff, 0x213b, { 26, 28, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_32_pd_i, 0xf1ff, 0x213c, { 20, 22, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_aw, 0xf1ff, 0x2178, { 28, 28, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_al, 0xf1ff, 0x2179, { 32, 32, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_pcdi, 0xf1ff, 0x217a, { 28, 28, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_pcix, 0xf1ff, 0x217b, { 30, 30, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_32_di_i, 0xf1ff, 0x217c, { 24, 24, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_32_ix_aw, 0xf1ff, 0x21b8, { 30, 30, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_32_ix_al, 0xf1ff, 0x21b9, { 34, 34, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_32_ix_pcdi, 0xf1ff, 0x21ba, { 30, 30, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_move_32_ix_pcix, 0xf1ff, 0x21bb, { 32, 32, 14, 14, 14, 14, 7}}, - {m68000_base_device_ops::m68k_op_move_32_ix_i, 0xf1ff, 0x21bc, { 26, 26, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_16_d_aw, 0xf1ff, 0x3038, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_16_d_al, 0xf1ff, 0x3039, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_move_16_d_pcdi, 0xf1ff, 0x303a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_move_16_d_pcix, 0xf1ff, 0x303b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_move_16_d_i, 0xf1ff, 0x303c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_aw, 0xf1ff, 0x3078, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_al, 0xf1ff, 0x3079, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_pcdi, 0xf1ff, 0x307a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_pcix, 0xf1ff, 0x307b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_movea_16_i, 0xf1ff, 0x307c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_move_16_ai_aw, 0xf1ff, 0x30b8, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_ai_al, 0xf1ff, 0x30b9, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_ai_pcdi, 0xf1ff, 0x30ba, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_ai_pcix, 0xf1ff, 0x30bb, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_16_ai_i, 0xf1ff, 0x30bc, { 12, 12, 6, 6, 6, 6, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_aw, 0xf1ff, 0x30f8, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_al, 0xf1ff, 0x30f9, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_pcdi, 0xf1ff, 0x30fa, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_pcix, 0xf1ff, 0x30fb, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pi_i, 0xf1ff, 0x30fc, { 12, 12, 6, 6, 6, 6, 4}}, - {m68000_base_device_ops::m68k_op_move_16_pd_aw, 0xf1ff, 0x3138, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_16_pd_al, 0xf1ff, 0x3139, { 20, 20, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_16_pd_pcdi, 0xf1ff, 0x313a, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_16_pd_pcix, 0xf1ff, 0x313b, { 18, 18, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_16_pd_i, 0xf1ff, 0x313c, { 12, 12, 7, 7, 7, 7, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_aw, 0xf1ff, 0x3178, { 20, 20, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_al, 0xf1ff, 0x3179, { 24, 24, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_pcdi, 0xf1ff, 0x317a, { 20, 20, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_pcix, 0xf1ff, 0x317b, { 22, 22, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_16_di_i, 0xf1ff, 0x317c, { 16, 16, 7, 7, 7, 7, 5}}, - {m68000_base_device_ops::m68k_op_move_16_ix_aw, 0xf1ff, 0x31b8, { 22, 22, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_16_ix_al, 0xf1ff, 0x31b9, { 26, 26, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_move_16_ix_pcdi, 0xf1ff, 0x31ba, { 22, 22, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_move_16_ix_pcix, 0xf1ff, 0x31bb, { 24, 24, 14, 14, 14, 14, 7}}, - {m68000_base_device_ops::m68k_op_move_16_ix_i, 0xf1ff, 0x31bc, { 18, 18, 9, 9, 9, 9, 7}}, - {m68000_base_device_ops::m68k_op_chk_32_aw, 0xf1ff, 0x4138, {255, 255, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_chk_32_al, 0xf1ff, 0x4139, {255, 255, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_chk_32_pcdi, 0xf1ff, 0x413a, {255, 255, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_chk_32_pcix, 0xf1ff, 0x413b, {255, 255, 15, 15, 15, 15, 8}}, - {m68000_base_device_ops::m68k_op_chk_32_i, 0xf1ff, 0x413c, {255, 255, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_chk_16_aw, 0xf1ff, 0x41b8, { 18, 16, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_chk_16_al, 0xf1ff, 0x41b9, { 22, 20, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_chk_16_pcdi, 0xf1ff, 0x41ba, { 18, 16, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_chk_16_pcix, 0xf1ff, 0x41bb, { 20, 18, 15, 15, 15, 15, 8}}, - {m68000_base_device_ops::m68k_op_chk_16_i, 0xf1ff, 0x41bc, { 14, 12, 10, 10, 10, 10, 8}}, - {m68000_base_device_ops::m68k_op_lea_32_aw, 0xf1ff, 0x41f8, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_lea_32_al, 0xf1ff, 0x41f9, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_lea_32_pcdi, 0xf1ff, 0x41fa, { 8, 8, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_lea_32_pcix, 0xf1ff, 0x41fb, { 12, 12, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_addq_8_pi7, 0xf1ff, 0x501f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_8_pd7, 0xf1ff, 0x5027, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addq_8_aw, 0xf1ff, 0x5038, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_8_al, 0xf1ff, 0x5039, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_16_aw, 0xf1ff, 0x5078, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_16_al, 0xf1ff, 0x5079, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_32_aw, 0xf1ff, 0x50b8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addq_32_al, 0xf1ff, 0x50b9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_8_pi7, 0xf1ff, 0x511f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_8_pd7, 0xf1ff, 0x5127, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subq_8_aw, 0xf1ff, 0x5138, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_8_al, 0xf1ff, 0x5139, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_16_aw, 0xf1ff, 0x5178, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_16_al, 0xf1ff, 0x5179, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_32_aw, 0xf1ff, 0x51b8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subq_32_al, 0xf1ff, 0x51b9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_or_8_er_pi7, 0xf1ff, 0x801f, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_8_er_pd7, 0xf1ff, 0x8027, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_or_8_er_aw, 0xf1ff, 0x8038, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_8_er_al, 0xf1ff, 0x8039, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_8_er_pcdi, 0xf1ff, 0x803a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_or_8_er_pcix, 0xf1ff, 0x803b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_or_8_er_i, 0xf1ff, 0x803c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_or_16_er_aw, 0xf1ff, 0x8078, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_16_er_al, 0xf1ff, 0x8079, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_16_er_pcdi, 0xf1ff, 0x807a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_or_16_er_pcix, 0xf1ff, 0x807b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_or_16_er_i, 0xf1ff, 0x807c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_or_32_er_aw, 0xf1ff, 0x80b8, { 18, 18, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_32_er_al, 0xf1ff, 0x80b9, { 22, 22, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_or_32_er_pcdi, 0xf1ff, 0x80ba, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_or_32_er_pcix, 0xf1ff, 0x80bb, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_or_32_er_i, 0xf1ff, 0x80bc, { 16, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_divu_16_aw, 0xf1ff, 0x80f8, {148, 116, 48, 48, 48, 48, 44}}, - {m68000_base_device_ops::m68k_op_divu_16_al, 0xf1ff, 0x80f9, {152, 120, 48, 48, 48, 48, 44}}, - {m68000_base_device_ops::m68k_op_divu_16_pcdi, 0xf1ff, 0x80fa, {148, 116, 49, 49, 49, 49, 44}}, - {m68000_base_device_ops::m68k_op_divu_16_pcix, 0xf1ff, 0x80fb, {150, 118, 51, 51, 51, 51, 44}}, - {m68000_base_device_ops::m68k_op_divu_16_i, 0xf1ff, 0x80fc, {144, 112, 46, 46, 46, 46, 44}}, - {m68000_base_device_ops::m68k_op_sbcd_8_mm_ay7, 0xf1ff, 0x810f, { 18, 18, 16, 16, 16, 16, 16}}, - {m68000_base_device_ops::m68k_op_or_8_re_pi7, 0xf1ff, 0x811f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_or_8_re_pd7, 0xf1ff, 0x8127, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_or_8_re_aw, 0xf1ff, 0x8138, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_or_8_re_al, 0xf1ff, 0x8139, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_pack_16_mm_ay7, 0xf1ff, 0x814f, {255, 255, 13, 13, 13, 13, 13}}, - {m68000_base_device_ops::m68k_op_or_16_re_aw, 0xf1ff, 0x8178, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_or_16_re_al, 0xf1ff, 0x8179, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_unpk_16_mm_ay7, 0xf1ff, 0x818f, {255, 255, 13, 13, 13, 13, 13}}, - {m68000_base_device_ops::m68k_op_or_32_re_aw, 0xf1ff, 0x81b8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_or_32_re_al, 0xf1ff, 0x81b9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_divs_16_aw, 0xf1ff, 0x81f8, {166, 130, 60, 60, 60, 60, 56}}, - {m68000_base_device_ops::m68k_op_divs_16_al, 0xf1ff, 0x81f9, {170, 134, 60, 60, 60, 60, 56}}, - {m68000_base_device_ops::m68k_op_divs_16_pcdi, 0xf1ff, 0x81fa, {166, 130, 61, 61, 61, 61, 56}}, - {m68000_base_device_ops::m68k_op_divs_16_pcix, 0xf1ff, 0x81fb, {168, 132, 63, 63, 63, 63, 56}}, - {m68000_base_device_ops::m68k_op_divs_16_i, 0xf1ff, 0x81fc, {162, 126, 58, 58, 58, 58, 56}}, - {m68000_base_device_ops::m68k_op_sub_8_er_pi7, 0xf1ff, 0x901f, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_8_er_pd7, 0xf1ff, 0x9027, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_sub_8_er_aw, 0xf1ff, 0x9038, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_8_er_al, 0xf1ff, 0x9039, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_8_er_pcdi, 0xf1ff, 0x903a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_sub_8_er_pcix, 0xf1ff, 0x903b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_sub_8_er_i, 0xf1ff, 0x903c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_aw, 0xf1ff, 0x9078, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_al, 0xf1ff, 0x9079, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_pcdi, 0xf1ff, 0x907a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_pcix, 0xf1ff, 0x907b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_sub_16_er_i, 0xf1ff, 0x907c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_aw, 0xf1ff, 0x90b8, { 18, 18, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_al, 0xf1ff, 0x90b9, { 22, 22, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_pcdi, 0xf1ff, 0x90ba, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_pcix, 0xf1ff, 0x90bb, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_sub_32_er_i, 0xf1ff, 0x90bc, { 16, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_aw, 0xf1ff, 0x90f8, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_al, 0xf1ff, 0x90f9, { 20, 20, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_pcdi, 0xf1ff, 0x90fa, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_pcix, 0xf1ff, 0x90fb, { 18, 18, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_suba_16_i, 0xf1ff, 0x90fc, { 12, 12, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_subx_8_mm_ay7, 0xf1ff, 0x910f, { 18, 18, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_sub_8_re_pi7, 0xf1ff, 0x911f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_8_re_pd7, 0xf1ff, 0x9127, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_sub_8_re_aw, 0xf1ff, 0x9138, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_8_re_al, 0xf1ff, 0x9139, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_16_re_aw, 0xf1ff, 0x9178, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_16_re_al, 0xf1ff, 0x9179, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_32_re_aw, 0xf1ff, 0x91b8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_sub_32_re_al, 0xf1ff, 0x91b9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_suba_32_aw, 0xf1ff, 0x91f8, { 18, 18, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_suba_32_al, 0xf1ff, 0x91f9, { 22, 22, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_suba_32_pcdi, 0xf1ff, 0x91fa, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_suba_32_pcix, 0xf1ff, 0x91fb, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_suba_32_i, 0xf1ff, 0x91fc, { 16, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_pi7, 0xf1ff, 0xb01f, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_pd7, 0xf1ff, 0xb027, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_aw, 0xf1ff, 0xb038, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_al, 0xf1ff, 0xb039, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_pcdi, 0xf1ff, 0xb03a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_pcix, 0xf1ff, 0xb03b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_cmp_8_i, 0xf1ff, 0xb03c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_aw, 0xf1ff, 0xb078, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_al, 0xf1ff, 0xb079, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_pcdi, 0xf1ff, 0xb07a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_pcix, 0xf1ff, 0xb07b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_cmp_16_i, 0xf1ff, 0xb07c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_aw, 0xf1ff, 0xb0b8, { 18, 18, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_al, 0xf1ff, 0xb0b9, { 22, 22, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_pcdi, 0xf1ff, 0xb0ba, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_pcix, 0xf1ff, 0xb0bb, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_cmp_32_i, 0xf1ff, 0xb0bc, { 14, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpa_16_aw, 0xf1ff, 0xb0f8, { 14, 14, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_16_al, 0xf1ff, 0xb0f9, { 18, 18, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_16_pcdi, 0xf1ff, 0xb0fa, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_16_pcix, 0xf1ff, 0xb0fb, { 16, 16, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_16_i, 0xf1ff, 0xb0fc, { 10, 10, 6, 6, 6, 6, 4}}, - {m68000_base_device_ops::m68k_op_cmpm_8_ay7, 0xf1ff, 0xb10f, { 12, 12, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_eor_8_pi7, 0xf1ff, 0xb11f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_8_pd7, 0xf1ff, 0xb127, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eor_8_aw, 0xf1ff, 0xb138, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_8_al, 0xf1ff, 0xb139, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_16_aw, 0xf1ff, 0xb178, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_16_al, 0xf1ff, 0xb179, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_32_aw, 0xf1ff, 0xb1b8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eor_32_al, 0xf1ff, 0xb1b9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_aw, 0xf1ff, 0xb1f8, { 18, 18, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_al, 0xf1ff, 0xb1f9, { 22, 22, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_pcdi, 0xf1ff, 0xb1fa, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_pcix, 0xf1ff, 0xb1fb, { 20, 20, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_cmpa_32_i, 0xf1ff, 0xb1fc, { 14, 14, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_8_er_pi7, 0xf1ff, 0xc01f, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_8_er_pd7, 0xf1ff, 0xc027, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_and_8_er_aw, 0xf1ff, 0xc038, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_8_er_al, 0xf1ff, 0xc039, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_8_er_pcdi, 0xf1ff, 0xc03a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_and_8_er_pcix, 0xf1ff, 0xc03b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_and_8_er_i, 0xf1ff, 0xc03c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_and_16_er_aw, 0xf1ff, 0xc078, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_16_er_al, 0xf1ff, 0xc079, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_16_er_pcdi, 0xf1ff, 0xc07a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_and_16_er_pcix, 0xf1ff, 0xc07b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_and_16_er_i, 0xf1ff, 0xc07c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_and_32_er_aw, 0xf1ff, 0xc0b8, { 18, 18, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_32_er_al, 0xf1ff, 0xc0b9, { 22, 22, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_and_32_er_pcdi, 0xf1ff, 0xc0ba, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_and_32_er_pcix, 0xf1ff, 0xc0bb, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_and_32_er_i, 0xf1ff, 0xc0bc, { 16, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_mulu_16_aw, 0xf1ff, 0xc0f8, { 62, 38, 31, 31, 31, 31, 27}}, - {m68000_base_device_ops::m68k_op_mulu_16_al, 0xf1ff, 0xc0f9, { 66, 42, 31, 31, 31, 31, 27}}, - {m68000_base_device_ops::m68k_op_mulu_16_pcdi, 0xf1ff, 0xc0fa, { 62, 38, 32, 32, 32, 32, 27}}, - {m68000_base_device_ops::m68k_op_mulu_16_pcix, 0xf1ff, 0xc0fb, { 64, 40, 34, 34, 34, 34, 27}}, - {m68000_base_device_ops::m68k_op_mulu_16_i, 0xf1ff, 0xc0fc, { 58, 34, 29, 29, 29, 29, 27}}, - {m68000_base_device_ops::m68k_op_abcd_8_mm_ay7, 0xf1ff, 0xc10f, { 18, 18, 16, 16, 16, 16, 16}}, - {m68000_base_device_ops::m68k_op_and_8_re_pi7, 0xf1ff, 0xc11f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_8_re_pd7, 0xf1ff, 0xc127, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_and_8_re_aw, 0xf1ff, 0xc138, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_8_re_al, 0xf1ff, 0xc139, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_16_re_aw, 0xf1ff, 0xc178, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_16_re_al, 0xf1ff, 0xc179, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_32_re_aw, 0xf1ff, 0xc1b8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_and_32_re_al, 0xf1ff, 0xc1b9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_muls_16_aw, 0xf1ff, 0xc1f8, { 62, 40, 31, 31, 31, 31, 27}}, - {m68000_base_device_ops::m68k_op_muls_16_al, 0xf1ff, 0xc1f9, { 66, 44, 31, 31, 31, 31, 27}}, - {m68000_base_device_ops::m68k_op_muls_16_pcdi, 0xf1ff, 0xc1fa, { 62, 40, 32, 32, 32, 32, 27}}, - {m68000_base_device_ops::m68k_op_muls_16_pcix, 0xf1ff, 0xc1fb, { 64, 42, 34, 34, 34, 34, 27}}, - {m68000_base_device_ops::m68k_op_muls_16_i, 0xf1ff, 0xc1fc, { 58, 36, 29, 29, 29, 29, 27}}, - {m68000_base_device_ops::m68k_op_add_8_er_pi7, 0xf1ff, 0xd01f, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_8_er_pd7, 0xf1ff, 0xd027, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_add_8_er_aw, 0xf1ff, 0xd038, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_8_er_al, 0xf1ff, 0xd039, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_8_er_pcdi, 0xf1ff, 0xd03a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_add_8_er_pcix, 0xf1ff, 0xd03b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_add_8_er_i, 0xf1ff, 0xd03c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_aw, 0xf1ff, 0xd078, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_al, 0xf1ff, 0xd079, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_pcdi, 0xf1ff, 0xd07a, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_pcix, 0xf1ff, 0xd07b, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_add_16_er_i, 0xf1ff, 0xd07c, { 8, 8, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_aw, 0xf1ff, 0xd0b8, { 18, 18, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_al, 0xf1ff, 0xd0b9, { 22, 22, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_pcdi, 0xf1ff, 0xd0ba, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_pcix, 0xf1ff, 0xd0bb, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_add_32_er_i, 0xf1ff, 0xd0bc, { 16, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_aw, 0xf1ff, 0xd0f8, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_al, 0xf1ff, 0xd0f9, { 20, 20, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_pcdi, 0xf1ff, 0xd0fa, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_pcix, 0xf1ff, 0xd0fb, { 18, 18, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_adda_16_i, 0xf1ff, 0xd0fc, { 12, 12, 4, 4, 4, 4, 2}}, - {m68000_base_device_ops::m68k_op_addx_8_mm_ay7, 0xf1ff, 0xd10f, { 18, 18, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_add_8_re_pi7, 0xf1ff, 0xd11f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_8_re_pd7, 0xf1ff, 0xd127, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_add_8_re_aw, 0xf1ff, 0xd138, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_8_re_al, 0xf1ff, 0xd139, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_16_re_aw, 0xf1ff, 0xd178, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_16_re_al, 0xf1ff, 0xd179, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_32_re_aw, 0xf1ff, 0xd1b8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_add_32_re_al, 0xf1ff, 0xd1b9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_adda_32_aw, 0xf1ff, 0xd1f8, { 18, 18, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_adda_32_al, 0xf1ff, 0xd1f9, { 22, 22, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_adda_32_pcdi, 0xf1ff, 0xd1fa, { 18, 18, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_adda_32_pcix, 0xf1ff, 0xd1fb, { 20, 20, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_adda_32_i, 0xf1ff, 0xd1fc, { 16, 14, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_ori_8_d, 0xfff8, 0x0000, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_ori_8_ai, 0xfff8, 0x0010, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_8_pi, 0xfff8, 0x0018, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_8_pd, 0xfff8, 0x0020, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_ori_8_di, 0xfff8, 0x0028, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_ori_8_ix, 0xfff8, 0x0030, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_ori_16_d, 0xfff8, 0x0040, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_ori_16_ai, 0xfff8, 0x0050, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_16_pi, 0xfff8, 0x0058, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_16_pd, 0xfff8, 0x0060, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_ori_16_di, 0xfff8, 0x0068, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_ori_16_ix, 0xfff8, 0x0070, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_ori_32_d, 0xfff8, 0x0080, { 16, 14, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_ori_32_ai, 0xfff8, 0x0090, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_32_pi, 0xfff8, 0x0098, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_32_pd, 0xfff8, 0x00a0, { 30, 30, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_ori_32_di, 0xfff8, 0x00a8, { 32, 32, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_ori_32_ix, 0xfff8, 0x00b0, { 34, 34, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_8_ai, 0xfff8, 0x00d0, {255, 255, 22, 22, 22, 22, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_8_di, 0xfff8, 0x00e8, {255, 255, 23, 23, 23, 23, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_8_ix, 0xfff8, 0x00f0, {255, 255, 25, 25, 25, 25, 18}}, - {m68000_base_device_ops::m68k_op_andi_8_d, 0xfff8, 0x0200, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_andi_8_ai, 0xfff8, 0x0210, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_8_pi, 0xfff8, 0x0218, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_8_pd, 0xfff8, 0x0220, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_andi_8_di, 0xfff8, 0x0228, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_andi_8_ix, 0xfff8, 0x0230, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_andi_16_d, 0xfff8, 0x0240, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_andi_16_ai, 0xfff8, 0x0250, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_16_pi, 0xfff8, 0x0258, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_16_pd, 0xfff8, 0x0260, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_andi_16_di, 0xfff8, 0x0268, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_andi_16_ix, 0xfff8, 0x0270, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_andi_32_d, 0xfff8, 0x0280, { 14, 14, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_andi_32_ai, 0xfff8, 0x0290, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_32_pi, 0xfff8, 0x0298, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_32_pd, 0xfff8, 0x02a0, { 30, 30, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_andi_32_di, 0xfff8, 0x02a8, { 32, 32, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_andi_32_ix, 0xfff8, 0x02b0, { 34, 34, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_16_ai, 0xfff8, 0x02d0, {255, 255, 22, 22, 22, 22, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_16_di, 0xfff8, 0x02e8, {255, 255, 23, 23, 23, 23, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_16_ix, 0xfff8, 0x02f0, {255, 255, 25, 25, 25, 25, 18}}, - {m68000_base_device_ops::m68k_op_subi_8_d, 0xfff8, 0x0400, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_subi_8_ai, 0xfff8, 0x0410, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_8_pi, 0xfff8, 0x0418, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_8_pd, 0xfff8, 0x0420, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subi_8_di, 0xfff8, 0x0428, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subi_8_ix, 0xfff8, 0x0430, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_subi_16_d, 0xfff8, 0x0440, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_subi_16_ai, 0xfff8, 0x0450, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_16_pi, 0xfff8, 0x0458, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_16_pd, 0xfff8, 0x0460, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subi_16_di, 0xfff8, 0x0468, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subi_16_ix, 0xfff8, 0x0470, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_subi_32_d, 0xfff8, 0x0480, { 16, 14, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_subi_32_ai, 0xfff8, 0x0490, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_32_pi, 0xfff8, 0x0498, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_32_pd, 0xfff8, 0x04a0, { 30, 30, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subi_32_di, 0xfff8, 0x04a8, { 32, 32, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subi_32_ix, 0xfff8, 0x04b0, { 34, 34, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_32_ai, 0xfff8, 0x04d0, {255, 255, 22, 22, 22, 22, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_32_di, 0xfff8, 0x04e8, {255, 255, 23, 23, 23, 23, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_32_ix, 0xfff8, 0x04f0, {255, 255, 25, 25, 25, 25, 18}}, - {m68000_base_device_ops::m68k_op_addi_8_d, 0xfff8, 0x0600, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_addi_8_ai, 0xfff8, 0x0610, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_8_pi, 0xfff8, 0x0618, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_8_pd, 0xfff8, 0x0620, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addi_8_di, 0xfff8, 0x0628, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addi_8_ix, 0xfff8, 0x0630, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_addi_16_d, 0xfff8, 0x0640, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_addi_16_ai, 0xfff8, 0x0650, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_16_pi, 0xfff8, 0x0658, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_16_pd, 0xfff8, 0x0660, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addi_16_di, 0xfff8, 0x0668, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addi_16_ix, 0xfff8, 0x0670, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_addi_32_d, 0xfff8, 0x0680, { 16, 14, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_addi_32_ai, 0xfff8, 0x0690, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_32_pi, 0xfff8, 0x0698, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_32_pd, 0xfff8, 0x06a0, { 30, 30, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addi_32_di, 0xfff8, 0x06a8, { 32, 32, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addi_32_ix, 0xfff8, 0x06b0, { 34, 34, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_callm_32_ai, 0xfff8, 0x06d0, {255, 255, 64, 64, 64, 64, 60}}, - {m68000_base_device_ops::m68k_op_callm_32_di, 0xfff8, 0x06e8, {255, 255, 65, 65, 65, 65, 60}}, - {m68000_base_device_ops::m68k_op_callm_32_ix, 0xfff8, 0x06f0, {255, 255, 67, 67, 67, 67, 60}}, - {m68000_base_device_ops::m68k_op_btst_32_s_d, 0xfff8, 0x0800, { 10, 10, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_s_ai, 0xfff8, 0x0810, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_s_pi, 0xfff8, 0x0818, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_s_pd, 0xfff8, 0x0820, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_s_di, 0xfff8, 0x0828, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_s_ix, 0xfff8, 0x0830, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_bchg_32_s_d, 0xfff8, 0x0840, { 12, 12, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_s_ai, 0xfff8, 0x0850, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_s_pi, 0xfff8, 0x0858, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_s_pd, 0xfff8, 0x0860, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_s_di, 0xfff8, 0x0868, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_s_ix, 0xfff8, 0x0870, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_bclr_32_s_d, 0xfff8, 0x0880, { 14, 14, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_s_ai, 0xfff8, 0x0890, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_s_pi, 0xfff8, 0x0898, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_s_pd, 0xfff8, 0x08a0, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_s_di, 0xfff8, 0x08a8, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_s_ix, 0xfff8, 0x08b0, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_bset_32_s_d, 0xfff8, 0x08c0, { 12, 12, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_s_ai, 0xfff8, 0x08d0, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_s_pi, 0xfff8, 0x08d8, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_s_pd, 0xfff8, 0x08e0, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_s_di, 0xfff8, 0x08e8, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_s_ix, 0xfff8, 0x08f0, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_eori_8_d, 0xfff8, 0x0a00, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_eori_8_ai, 0xfff8, 0x0a10, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_8_pi, 0xfff8, 0x0a18, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_8_pd, 0xfff8, 0x0a20, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eori_8_di, 0xfff8, 0x0a28, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eori_8_ix, 0xfff8, 0x0a30, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_eori_16_d, 0xfff8, 0x0a40, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_eori_16_ai, 0xfff8, 0x0a50, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_16_pi, 0xfff8, 0x0a58, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_16_pd, 0xfff8, 0x0a60, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eori_16_di, 0xfff8, 0x0a68, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eori_16_ix, 0xfff8, 0x0a70, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_eori_32_d, 0xfff8, 0x0a80, { 16, 14, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_eori_32_ai, 0xfff8, 0x0a90, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_32_pi, 0xfff8, 0x0a98, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_32_pd, 0xfff8, 0x0aa0, { 30, 30, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eori_32_di, 0xfff8, 0x0aa8, { 32, 32, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eori_32_ix, 0xfff8, 0x0ab0, { 34, 34, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_cas_8_ai, 0xfff8, 0x0ad0, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas_8_pi, 0xfff8, 0x0ad8, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas_8_pd, 0xfff8, 0x0ae0, {255, 255, 17, 17, 17, 17, 12}}, - {m68000_base_device_ops::m68k_op_cas_8_di, 0xfff8, 0x0ae8, {255, 255, 17, 17, 17, 17, 12}}, - {m68000_base_device_ops::m68k_op_cas_8_ix, 0xfff8, 0x0af0, {255, 255, 19, 19, 19, 19, 12}}, - {m68000_base_device_ops::m68k_op_cmpi_8_d, 0xfff8, 0x0c00, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_8_ai, 0xfff8, 0x0c10, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_8_pi, 0xfff8, 0x0c18, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_8_pd, 0xfff8, 0x0c20, { 14, 14, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_8_di, 0xfff8, 0x0c28, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_8_ix, 0xfff8, 0x0c30, { 18, 18, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_16_d, 0xfff8, 0x0c40, { 8, 8, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_16_ai, 0xfff8, 0x0c50, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_16_pi, 0xfff8, 0x0c58, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_16_pd, 0xfff8, 0x0c60, { 14, 14, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_16_di, 0xfff8, 0x0c68, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_16_ix, 0xfff8, 0x0c70, { 18, 18, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_32_d, 0xfff8, 0x0c80, { 14, 12, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_32_ai, 0xfff8, 0x0c90, { 20, 20, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_32_pi, 0xfff8, 0x0c98, { 20, 20, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_32_pd, 0xfff8, 0x0ca0, { 22, 22, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_32_di, 0xfff8, 0x0ca8, { 24, 24, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_32_ix, 0xfff8, 0x0cb0, { 26, 26, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_cas_16_ai, 0xfff8, 0x0cd0, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas_16_pi, 0xfff8, 0x0cd8, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas_16_pd, 0xfff8, 0x0ce0, {255, 255, 17, 17, 17, 17, 12}}, - {m68000_base_device_ops::m68k_op_cas_16_di, 0xfff8, 0x0ce8, {255, 255, 17, 17, 17, 17, 12}}, - {m68000_base_device_ops::m68k_op_cas_16_ix, 0xfff8, 0x0cf0, {255, 255, 19, 19, 19, 19, 12}}, - {m68000_base_device_ops::m68k_op_moves_8_ai, 0xfff8, 0x0e10, {255, 18, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_8_pi, 0xfff8, 0x0e18, {255, 18, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_8_pd, 0xfff8, 0x0e20, {255, 20, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_moves_8_di, 0xfff8, 0x0e28, {255, 26, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_moves_8_ix, 0xfff8, 0x0e30, {255, 30, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_moves_16_ai, 0xfff8, 0x0e50, {255, 18, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_16_pi, 0xfff8, 0x0e58, {255, 18, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_16_pd, 0xfff8, 0x0e60, {255, 20, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_moves_16_di, 0xfff8, 0x0e68, {255, 26, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_moves_16_ix, 0xfff8, 0x0e70, {255, 30, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_moves_32_ai, 0xfff8, 0x0e90, {255, 22, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_32_pi, 0xfff8, 0x0e98, {255, 22, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_32_pd, 0xfff8, 0x0ea0, {255, 28, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_moves_32_di, 0xfff8, 0x0ea8, {255, 32, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_moves_32_ix, 0xfff8, 0x0eb0, {255, 36, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_cas_32_ai, 0xfff8, 0x0ed0, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas_32_pi, 0xfff8, 0x0ed8, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas_32_pd, 0xfff8, 0x0ee0, {255, 255, 17, 17, 17, 17, 12}}, - {m68000_base_device_ops::m68k_op_cas_32_di, 0xfff8, 0x0ee8, {255, 255, 17, 17, 17, 17, 12}}, - {m68000_base_device_ops::m68k_op_cas_32_ix, 0xfff8, 0x0ef0, {255, 255, 19, 19, 19, 19, 12}}, - {m68000_base_device_ops::m68k_op_move_8_aw_d, 0xfff8, 0x11c0, { 12, 12, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_8_aw_ai, 0xfff8, 0x11d0, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_aw_pi, 0xfff8, 0x11d8, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_aw_pd, 0xfff8, 0x11e0, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_aw_di, 0xfff8, 0x11e8, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_aw_ix, 0xfff8, 0x11f0, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_8_al_d, 0xfff8, 0x13c0, { 16, 16, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_move_8_al_ai, 0xfff8, 0x13d0, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_8_al_pi, 0xfff8, 0x13d8, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_8_al_pd, 0xfff8, 0x13e0, { 22, 22, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_move_8_al_di, 0xfff8, 0x13e8, { 24, 24, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_move_8_al_ix, 0xfff8, 0x13f0, { 26, 26, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_d, 0xfff8, 0x1ec0, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_ai, 0xfff8, 0x1ed0, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_pi, 0xfff8, 0x1ed8, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_pd, 0xfff8, 0x1ee0, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_di, 0xfff8, 0x1ee8, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_ix, 0xfff8, 0x1ef0, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_d, 0xfff8, 0x1f00, { 8, 8, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_ai, 0xfff8, 0x1f10, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_pi, 0xfff8, 0x1f18, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_pd, 0xfff8, 0x1f20, { 14, 14, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_di, 0xfff8, 0x1f28, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_ix, 0xfff8, 0x1f30, { 18, 18, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_32_aw_d, 0xfff8, 0x21c0, { 16, 16, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_32_aw_a, 0xfff8, 0x21c8, { 16, 16, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_32_aw_ai, 0xfff8, 0x21d0, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_aw_pi, 0xfff8, 0x21d8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_aw_pd, 0xfff8, 0x21e0, { 26, 26, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_32_aw_di, 0xfff8, 0x21e8, { 28, 28, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_32_aw_ix, 0xfff8, 0x21f0, { 30, 30, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_32_al_d, 0xfff8, 0x23c0, { 20, 20, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_move_32_al_a, 0xfff8, 0x23c8, { 20, 20, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_move_32_al_ai, 0xfff8, 0x23d0, { 28, 28, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_32_al_pi, 0xfff8, 0x23d8, { 28, 28, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_32_al_pd, 0xfff8, 0x23e0, { 30, 30, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_move_32_al_di, 0xfff8, 0x23e8, { 32, 32, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_move_32_al_ix, 0xfff8, 0x23f0, { 34, 34, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_move_16_aw_d, 0xfff8, 0x31c0, { 12, 12, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_16_aw_a, 0xfff8, 0x31c8, { 12, 12, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_16_aw_ai, 0xfff8, 0x31d0, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_aw_pi, 0xfff8, 0x31d8, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_aw_pd, 0xfff8, 0x31e0, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_aw_di, 0xfff8, 0x31e8, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_aw_ix, 0xfff8, 0x31f0, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_16_al_d, 0xfff8, 0x33c0, { 16, 16, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_move_16_al_a, 0xfff8, 0x33c8, { 16, 16, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_move_16_al_ai, 0xfff8, 0x33d0, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_16_al_pi, 0xfff8, 0x33d8, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_16_al_pd, 0xfff8, 0x33e0, { 22, 22, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_move_16_al_di, 0xfff8, 0x33e8, { 24, 24, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_move_16_al_ix, 0xfff8, 0x33f0, { 26, 26, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_negx_8_d, 0xfff8, 0x4000, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_negx_8_ai, 0xfff8, 0x4010, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_8_pi, 0xfff8, 0x4018, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_8_pd, 0xfff8, 0x4020, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_negx_8_di, 0xfff8, 0x4028, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_negx_8_ix, 0xfff8, 0x4030, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_negx_16_d, 0xfff8, 0x4040, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_negx_16_ai, 0xfff8, 0x4050, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_16_pi, 0xfff8, 0x4058, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_16_pd, 0xfff8, 0x4060, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_negx_16_di, 0xfff8, 0x4068, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_negx_16_ix, 0xfff8, 0x4070, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_negx_32_d, 0xfff8, 0x4080, { 6, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_negx_32_ai, 0xfff8, 0x4090, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_32_pi, 0xfff8, 0x4098, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_32_pd, 0xfff8, 0x40a0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_negx_32_di, 0xfff8, 0x40a8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_negx_32_ix, 0xfff8, 0x40b0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_16_frs_d, 0xfff8, 0x40c0, { 6, 4, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_move_16_frs_ai, 0xfff8, 0x40d0, { 12, 12, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_move_16_frs_pi, 0xfff8, 0x40d8, { 12, 12, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_move_16_frs_pd, 0xfff8, 0x40e0, { 14, 14, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_move_16_frs_di, 0xfff8, 0x40e8, { 16, 16, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_move_16_frs_ix, 0xfff8, 0x40f0, { 18, 18, 15, 15, 15, 15, 8}}, - {m68000_base_device_ops::m68k_op_clr_8_d, 0xfff8, 0x4200, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_clr_8_ai, 0xfff8, 0x4210, { 12, 8, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_8_pi, 0xfff8, 0x4218, { 12, 8, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_8_pd, 0xfff8, 0x4220, { 14, 10, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_clr_8_di, 0xfff8, 0x4228, { 16, 12, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_clr_8_ix, 0xfff8, 0x4230, { 18, 14, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_clr_16_d, 0xfff8, 0x4240, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_clr_16_ai, 0xfff8, 0x4250, { 12, 8, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_16_pi, 0xfff8, 0x4258, { 12, 8, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_16_pd, 0xfff8, 0x4260, { 14, 10, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_clr_16_di, 0xfff8, 0x4268, { 16, 12, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_clr_16_ix, 0xfff8, 0x4270, { 18, 14, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_clr_32_d, 0xfff8, 0x4280, { 6, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_clr_32_ai, 0xfff8, 0x4290, { 20, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_32_pi, 0xfff8, 0x4298, { 20, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_32_pd, 0xfff8, 0x42a0, { 22, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_clr_32_di, 0xfff8, 0x42a8, { 24, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_clr_32_ix, 0xfff8, 0x42b0, { 26, 20, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_16_frc_d, 0xfff8, 0x42c0, {255, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_16_frc_ai, 0xfff8, 0x42d0, {255, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_frc_pi, 0xfff8, 0x42d8, {255, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_frc_pd, 0xfff8, 0x42e0, {255, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_frc_di, 0xfff8, 0x42e8, {255, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_frc_ix, 0xfff8, 0x42f0, {255, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_neg_8_d, 0xfff8, 0x4400, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_neg_8_ai, 0xfff8, 0x4410, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_8_pi, 0xfff8, 0x4418, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_8_pd, 0xfff8, 0x4420, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_neg_8_di, 0xfff8, 0x4428, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_neg_8_ix, 0xfff8, 0x4430, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_neg_16_d, 0xfff8, 0x4440, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_neg_16_ai, 0xfff8, 0x4450, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_16_pi, 0xfff8, 0x4458, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_16_pd, 0xfff8, 0x4460, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_neg_16_di, 0xfff8, 0x4468, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_neg_16_ix, 0xfff8, 0x4470, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_neg_32_d, 0xfff8, 0x4480, { 6, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_neg_32_ai, 0xfff8, 0x4490, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_32_pi, 0xfff8, 0x4498, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_32_pd, 0xfff8, 0x44a0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_neg_32_di, 0xfff8, 0x44a8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_neg_32_ix, 0xfff8, 0x44b0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_16_toc_d, 0xfff8, 0x44c0, { 12, 12, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move_16_toc_ai, 0xfff8, 0x44d0, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_toc_pi, 0xfff8, 0x44d8, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_toc_pd, 0xfff8, 0x44e0, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_toc_di, 0xfff8, 0x44e8, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_toc_ix, 0xfff8, 0x44f0, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_not_8_d, 0xfff8, 0x4600, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_not_8_ai, 0xfff8, 0x4610, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_8_pi, 0xfff8, 0x4618, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_8_pd, 0xfff8, 0x4620, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_not_8_di, 0xfff8, 0x4628, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_not_8_ix, 0xfff8, 0x4630, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_not_16_d, 0xfff8, 0x4640, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_not_16_ai, 0xfff8, 0x4650, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_16_pi, 0xfff8, 0x4658, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_16_pd, 0xfff8, 0x4660, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_not_16_di, 0xfff8, 0x4668, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_not_16_ix, 0xfff8, 0x4670, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_not_32_d, 0xfff8, 0x4680, { 6, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_not_32_ai, 0xfff8, 0x4690, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_32_pi, 0xfff8, 0x4698, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_32_pd, 0xfff8, 0x46a0, { 22, 22, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_not_32_di, 0xfff8, 0x46a8, { 24, 24, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_not_32_ix, 0xfff8, 0x46b0, { 26, 26, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_16_tos_d, 0xfff8, 0x46c0, { 12, 12, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_move_16_tos_ai, 0xfff8, 0x46d0, { 16, 16, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_move_16_tos_pi, 0xfff8, 0x46d8, { 16, 16, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_move_16_tos_pd, 0xfff8, 0x46e0, { 18, 18, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_move_16_tos_di, 0xfff8, 0x46e8, { 20, 20, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_move_16_tos_ix, 0xfff8, 0x46f0, { 22, 22, 15, 15, 15, 15, 8}}, - {m68000_base_device_ops::m68k_op_nbcd_8_d, 0xfff8, 0x4800, { 6, 6, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_link_32, 0xfff8, 0x4808, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_nbcd_8_ai, 0xfff8, 0x4810, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_nbcd_8_pi, 0xfff8, 0x4818, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_nbcd_8_pd, 0xfff8, 0x4820, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_nbcd_8_di, 0xfff8, 0x4828, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_nbcd_8_ix, 0xfff8, 0x4830, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_swap_32, 0xfff8, 0x4840, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_bkpt, 0xfff8, 0x4848, {255, 10, 10, 10, 10, 10, 10}}, - {m68000_base_device_ops::m68k_op_pea_32_ai, 0xfff8, 0x4850, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_pea_32_di, 0xfff8, 0x4868, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_pea_32_ix, 0xfff8, 0x4870, { 20, 20, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_ext_16, 0xfff8, 0x4880, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_movem_16_re_ai, 0xfff8, 0x4890, { 8, 8, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_movem_16_re_pd, 0xfff8, 0x48a0, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_movem_16_re_di, 0xfff8, 0x48a8, { 12, 12, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_movem_16_re_ix, 0xfff8, 0x48b0, { 14, 14, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_ext_32, 0xfff8, 0x48c0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_movem_32_re_ai, 0xfff8, 0x48d0, { 8, 8, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_movem_32_re_pd, 0xfff8, 0x48e0, { 8, 8, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_movem_32_re_di, 0xfff8, 0x48e8, { 12, 12, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_movem_32_re_ix, 0xfff8, 0x48f0, { 14, 14, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_extb_32, 0xfff8, 0x49c0, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_tst_8_d, 0xfff8, 0x4a00, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_tst_8_ai, 0xfff8, 0x4a10, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_8_pi, 0xfff8, 0x4a18, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_8_pd, 0xfff8, 0x4a20, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_tst_8_di, 0xfff8, 0x4a28, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_tst_8_ix, 0xfff8, 0x4a30, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_tst_16_d, 0xfff8, 0x4a40, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_tst_16_a, 0xfff8, 0x4a48, {255, 255, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_tst_16_ai, 0xfff8, 0x4a50, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_16_pi, 0xfff8, 0x4a58, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_16_pd, 0xfff8, 0x4a60, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_tst_16_di, 0xfff8, 0x4a68, { 12, 12, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_tst_16_ix, 0xfff8, 0x4a70, { 14, 14, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_tst_32_d, 0xfff8, 0x4a80, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_tst_32_a, 0xfff8, 0x4a88, {255, 255, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_tst_32_ai, 0xfff8, 0x4a90, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_32_pi, 0xfff8, 0x4a98, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_32_pd, 0xfff8, 0x4aa0, { 14, 14, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_tst_32_di, 0xfff8, 0x4aa8, { 16, 16, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_tst_32_ix, 0xfff8, 0x4ab0, { 18, 18, 9, 9, 9, 9, 2}}, - {m68000_base_device_ops::m68k_op_tas_8_d, 0xfff8, 0x4ac0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_tas_8_ai, 0xfff8, 0x4ad0, { 18, 18, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_tas_8_pi, 0xfff8, 0x4ad8, { 18, 18, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_tas_8_pd, 0xfff8, 0x4ae0, { 20, 20, 17, 17, 17, 17, 12}}, - {m68000_base_device_ops::m68k_op_tas_8_di, 0xfff8, 0x4ae8, { 22, 22, 17, 17, 17, 17, 12}}, - {m68000_base_device_ops::m68k_op_tas_8_ix, 0xfff8, 0x4af0, { 24, 24, 19, 19, 19, 19, 12}}, - {m68000_base_device_ops::m68k_op_mull_32_d, 0xfff8, 0x4c00, {255, 255, 43, 43, 43, 43, 43}}, - {m68000_base_device_ops::m68k_op_mull_32_ai, 0xfff8, 0x4c10, {255, 255, 47, 47, 47, 47, 43}}, - {m68000_base_device_ops::m68k_op_mull_32_pi, 0xfff8, 0x4c18, {255, 255, 47, 47, 47, 47, 43}}, - {m68000_base_device_ops::m68k_op_mull_32_pd, 0xfff8, 0x4c20, {255, 255, 48, 48, 48, 48, 43}}, - {m68000_base_device_ops::m68k_op_mull_32_di, 0xfff8, 0x4c28, {255, 255, 48, 48, 48, 48, 43}}, - {m68000_base_device_ops::m68k_op_mull_32_ix, 0xfff8, 0x4c30, {255, 255, 50, 50, 50, 50, 43}}, - {m68000_base_device_ops::m68k_op_divl_32_d, 0xfff8, 0x4c40, {255, 255, 84, 84, 84, 84, 84}}, - {m68000_base_device_ops::m68k_op_divl_32_ai, 0xfff8, 0x4c50, {255, 255, 88, 88, 88, 88, 84}}, - {m68000_base_device_ops::m68k_op_divl_32_pi, 0xfff8, 0x4c58, {255, 255, 88, 88, 88, 88, 84}}, - {m68000_base_device_ops::m68k_op_divl_32_pd, 0xfff8, 0x4c60, {255, 255, 89, 89, 89, 89, 84}}, - {m68000_base_device_ops::m68k_op_divl_32_di, 0xfff8, 0x4c68, {255, 255, 89, 89, 89, 89, 84}}, - {m68000_base_device_ops::m68k_op_divl_32_ix, 0xfff8, 0x4c70, {255, 255, 91, 91, 91, 91, 84}}, - {m68000_base_device_ops::m68k_op_movem_16_er_ai, 0xfff8, 0x4c90, { 12, 12, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_movem_16_er_pi, 0xfff8, 0x4c98, { 12, 12, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_movem_16_er_di, 0xfff8, 0x4ca8, { 16, 16, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_movem_16_er_ix, 0xfff8, 0x4cb0, { 18, 18, 15, 15, 15, 15, 8}}, - {m68000_base_device_ops::m68k_op_movem_32_er_ai, 0xfff8, 0x4cd0, { 12, 12, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_movem_32_er_pi, 0xfff8, 0x4cd8, { 12, 12, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_movem_32_er_di, 0xfff8, 0x4ce8, { 16, 16, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_movem_32_er_ix, 0xfff8, 0x4cf0, { 18, 18, 15, 15, 15, 15, 8}}, - {m68000_base_device_ops::m68k_op_link_16, 0xfff8, 0x4e50, { 16, 16, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_unlk_32, 0xfff8, 0x4e58, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_move_32_tou, 0xfff8, 0x4e60, { 4, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_move_32_fru, 0xfff8, 0x4e68, { 4, 6, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_jsr_32_ai, 0xfff8, 0x4e90, { 16, 16, 4, 4, 4, 4, 0}}, - {m68000_base_device_ops::m68k_op_jsr_32_di, 0xfff8, 0x4ea8, { 18, 18, 5, 5, 5, 5, 0}}, - {m68000_base_device_ops::m68k_op_jsr_32_ix, 0xfff8, 0x4eb0, { 22, 22, 7, 7, 7, 7, 0}}, - {m68000_base_device_ops::m68k_op_jmp_32_ai, 0xfff8, 0x4ed0, { 8, 8, 4, 4, 4, 4, 0}}, - {m68000_base_device_ops::m68k_op_jmp_32_di, 0xfff8, 0x4ee8, { 10, 10, 5, 5, 5, 5, 0}}, - {m68000_base_device_ops::m68k_op_jmp_32_ix, 0xfff8, 0x4ef0, { 14, 14, 7, 7, 7, 7, 0}}, - {m68000_base_device_ops::m68k_op_st_8_d, 0xfff8, 0x50c0, { 6, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbt_16, 0xfff8, 0x50c8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_st_8_ai, 0xfff8, 0x50d0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_st_8_pi, 0xfff8, 0x50d8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_st_8_pd, 0xfff8, 0x50e0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_st_8_di, 0xfff8, 0x50e8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_st_8_ix, 0xfff8, 0x50f0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_sf_8_d, 0xfff8, 0x51c0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbf_16, 0xfff8, 0x51c8, { 12, 12, 6, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_sf_8_ai, 0xfff8, 0x51d0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sf_8_pi, 0xfff8, 0x51d8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sf_8_pd, 0xfff8, 0x51e0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sf_8_di, 0xfff8, 0x51e8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sf_8_ix, 0xfff8, 0x51f0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_shi_8_d, 0xfff8, 0x52c0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbhi_16, 0xfff8, 0x52c8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_shi_8_ai, 0xfff8, 0x52d0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_shi_8_pi, 0xfff8, 0x52d8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_shi_8_pd, 0xfff8, 0x52e0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_shi_8_di, 0xfff8, 0x52e8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_shi_8_ix, 0xfff8, 0x52f0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_sls_8_d, 0xfff8, 0x53c0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbls_16, 0xfff8, 0x53c8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_sls_8_ai, 0xfff8, 0x53d0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sls_8_pi, 0xfff8, 0x53d8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sls_8_pd, 0xfff8, 0x53e0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sls_8_di, 0xfff8, 0x53e8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sls_8_ix, 0xfff8, 0x53f0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_scc_8_d, 0xfff8, 0x54c0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbcc_16, 0xfff8, 0x54c8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_scc_8_ai, 0xfff8, 0x54d0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_scc_8_pi, 0xfff8, 0x54d8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_scc_8_pd, 0xfff8, 0x54e0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_scc_8_di, 0xfff8, 0x54e8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_scc_8_ix, 0xfff8, 0x54f0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_scs_8_d, 0xfff8, 0x55c0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbcs_16, 0xfff8, 0x55c8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_scs_8_ai, 0xfff8, 0x55d0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_scs_8_pi, 0xfff8, 0x55d8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_scs_8_pd, 0xfff8, 0x55e0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_scs_8_di, 0xfff8, 0x55e8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_scs_8_ix, 0xfff8, 0x55f0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_sne_8_d, 0xfff8, 0x56c0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbne_16, 0xfff8, 0x56c8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_sne_8_ai, 0xfff8, 0x56d0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sne_8_pi, 0xfff8, 0x56d8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sne_8_pd, 0xfff8, 0x56e0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sne_8_di, 0xfff8, 0x56e8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sne_8_ix, 0xfff8, 0x56f0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_seq_8_d, 0xfff8, 0x57c0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbeq_16, 0xfff8, 0x57c8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_seq_8_ai, 0xfff8, 0x57d0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_seq_8_pi, 0xfff8, 0x57d8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_seq_8_pd, 0xfff8, 0x57e0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_seq_8_di, 0xfff8, 0x57e8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_seq_8_ix, 0xfff8, 0x57f0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_svc_8_d, 0xfff8, 0x58c0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbvc_16, 0xfff8, 0x58c8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_svc_8_ai, 0xfff8, 0x58d0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_svc_8_pi, 0xfff8, 0x58d8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_svc_8_pd, 0xfff8, 0x58e0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_svc_8_di, 0xfff8, 0x58e8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_svc_8_ix, 0xfff8, 0x58f0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_svs_8_d, 0xfff8, 0x59c0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbvs_16, 0xfff8, 0x59c8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_svs_8_ai, 0xfff8, 0x59d0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_svs_8_pi, 0xfff8, 0x59d8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_svs_8_pd, 0xfff8, 0x59e0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_svs_8_di, 0xfff8, 0x59e8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_svs_8_ix, 0xfff8, 0x59f0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_spl_8_d, 0xfff8, 0x5ac0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbpl_16, 0xfff8, 0x5ac8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_spl_8_ai, 0xfff8, 0x5ad0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_spl_8_pi, 0xfff8, 0x5ad8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_spl_8_pd, 0xfff8, 0x5ae0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_spl_8_di, 0xfff8, 0x5ae8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_spl_8_ix, 0xfff8, 0x5af0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_smi_8_d, 0xfff8, 0x5bc0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbmi_16, 0xfff8, 0x5bc8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_smi_8_ai, 0xfff8, 0x5bd0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_smi_8_pi, 0xfff8, 0x5bd8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_smi_8_pd, 0xfff8, 0x5be0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_smi_8_di, 0xfff8, 0x5be8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_smi_8_ix, 0xfff8, 0x5bf0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_sge_8_d, 0xfff8, 0x5cc0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbge_16, 0xfff8, 0x5cc8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_sge_8_ai, 0xfff8, 0x5cd0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sge_8_pi, 0xfff8, 0x5cd8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sge_8_pd, 0xfff8, 0x5ce0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sge_8_di, 0xfff8, 0x5ce8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sge_8_ix, 0xfff8, 0x5cf0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_slt_8_d, 0xfff8, 0x5dc0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dblt_16, 0xfff8, 0x5dc8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_slt_8_ai, 0xfff8, 0x5dd0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_slt_8_pi, 0xfff8, 0x5dd8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_slt_8_pd, 0xfff8, 0x5de0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_slt_8_di, 0xfff8, 0x5de8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_slt_8_ix, 0xfff8, 0x5df0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_sgt_8_d, 0xfff8, 0x5ec0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dbgt_16, 0xfff8, 0x5ec8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_sgt_8_ai, 0xfff8, 0x5ed0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sgt_8_pi, 0xfff8, 0x5ed8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sgt_8_pd, 0xfff8, 0x5ee0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sgt_8_di, 0xfff8, 0x5ee8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sgt_8_ix, 0xfff8, 0x5ef0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_sle_8_d, 0xfff8, 0x5fc0, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_dble_16, 0xfff8, 0x5fc8, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_sle_8_ai, 0xfff8, 0x5fd0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sle_8_pi, 0xfff8, 0x5fd8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sle_8_pd, 0xfff8, 0x5fe0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sle_8_di, 0xfff8, 0x5fe8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sle_8_ix, 0xfff8, 0x5ff0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_sbcd_8_mm_ax7, 0xfff8, 0x8f08, { 18, 18, 16, 16, 16, 16, 16}}, - {m68000_base_device_ops::m68k_op_pack_16_mm_ax7, 0xfff8, 0x8f48, {255, 255, 13, 13, 13, 13, 13}}, - {m68000_base_device_ops::m68k_op_unpk_16_mm_ax7, 0xfff8, 0x8f88, {255, 255, 13, 13, 13, 13, 13}}, - {m68000_base_device_ops::m68k_op_subx_8_mm_ax7, 0xfff8, 0x9f08, { 18, 18, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_cmpm_8_ax7, 0xfff8, 0xbf08, { 12, 12, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_abcd_8_mm_ax7, 0xfff8, 0xcf08, { 18, 18, 16, 16, 16, 16, 16}}, - {m68000_base_device_ops::m68k_op_addx_8_mm_ax7, 0xfff8, 0xdf08, { 18, 18, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_asr_16_ai, 0xfff8, 0xe0d0, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_asr_16_pi, 0xfff8, 0xe0d8, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_asr_16_pd, 0xfff8, 0xe0e0, { 14, 14, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_asr_16_di, 0xfff8, 0xe0e8, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_asr_16_ix, 0xfff8, 0xe0f0, { 18, 18, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_asl_16_ai, 0xfff8, 0xe1d0, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_asl_16_pi, 0xfff8, 0xe1d8, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_asl_16_pd, 0xfff8, 0xe1e0, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_asl_16_di, 0xfff8, 0xe1e8, { 16, 16, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_asl_16_ix, 0xfff8, 0xe1f0, { 18, 18, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_lsr_16_ai, 0xfff8, 0xe2d0, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_lsr_16_pi, 0xfff8, 0xe2d8, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_lsr_16_pd, 0xfff8, 0xe2e0, { 14, 14, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_lsr_16_di, 0xfff8, 0xe2e8, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_lsr_16_ix, 0xfff8, 0xe2f0, { 18, 18, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_lsl_16_ai, 0xfff8, 0xe3d0, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_lsl_16_pi, 0xfff8, 0xe3d8, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_lsl_16_pd, 0xfff8, 0xe3e0, { 14, 14, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_lsl_16_di, 0xfff8, 0xe3e8, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_lsl_16_ix, 0xfff8, 0xe3f0, { 18, 18, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_roxr_16_ai, 0xfff8, 0xe4d0, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_roxr_16_pi, 0xfff8, 0xe4d8, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_roxr_16_pd, 0xfff8, 0xe4e0, { 14, 14, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_roxr_16_di, 0xfff8, 0xe4e8, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_roxr_16_ix, 0xfff8, 0xe4f0, { 18, 18, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_roxl_16_ai, 0xfff8, 0xe5d0, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_roxl_16_pi, 0xfff8, 0xe5d8, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_roxl_16_pd, 0xfff8, 0xe5e0, { 14, 14, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_roxl_16_di, 0xfff8, 0xe5e8, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_roxl_16_ix, 0xfff8, 0xe5f0, { 18, 18, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_ror_16_ai, 0xfff8, 0xe6d0, { 12, 12, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_ror_16_pi, 0xfff8, 0xe6d8, { 12, 12, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_ror_16_pd, 0xfff8, 0xe6e0, { 14, 14, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_ror_16_di, 0xfff8, 0xe6e8, { 16, 16, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_ror_16_ix, 0xfff8, 0xe6f0, { 18, 18, 14, 14, 14, 14, 7}}, - {m68000_base_device_ops::m68k_op_rol_16_ai, 0xfff8, 0xe7d0, { 12, 12, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_rol_16_pi, 0xfff8, 0xe7d8, { 12, 12, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_rol_16_pd, 0xfff8, 0xe7e0, { 14, 14, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_rol_16_di, 0xfff8, 0xe7e8, { 16, 16, 12, 12, 12, 12, 7}}, - {m68000_base_device_ops::m68k_op_rol_16_ix, 0xfff8, 0xe7f0, { 18, 18, 14, 14, 14, 14, 7}}, - {m68000_base_device_ops::m68k_op_bftst_32_d, 0xfff8, 0xe8c0, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bftst_32_ai, 0xfff8, 0xe8d0, {255, 255, 17, 17, 17, 17, 13}}, - {m68000_base_device_ops::m68k_op_bftst_32_di, 0xfff8, 0xe8e8, {255, 255, 18, 18, 18, 18, 13}}, - {m68000_base_device_ops::m68k_op_bftst_32_ix, 0xfff8, 0xe8f0, {255, 255, 20, 20, 20, 20, 13}}, - {m68000_base_device_ops::m68k_op_bfextu_32_d, 0xfff8, 0xe9c0, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_bfextu_32_ai, 0xfff8, 0xe9d0, {255, 255, 19, 19, 19, 19, 15}}, - {m68000_base_device_ops::m68k_op_bfextu_32_di, 0xfff8, 0xe9e8, {255, 255, 20, 20, 20, 20, 15}}, - {m68000_base_device_ops::m68k_op_bfextu_32_ix, 0xfff8, 0xe9f0, {255, 255, 22, 22, 22, 22, 15}}, - {m68000_base_device_ops::m68k_op_bfchg_32_d, 0xfff8, 0xeac0, {255, 255, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_bfchg_32_ai, 0xfff8, 0xead0, {255, 255, 24, 24, 24, 24, 20}}, - {m68000_base_device_ops::m68k_op_bfchg_32_di, 0xfff8, 0xeae8, {255, 255, 25, 25, 25, 25, 20}}, - {m68000_base_device_ops::m68k_op_bfchg_32_ix, 0xfff8, 0xeaf0, {255, 255, 27, 27, 27, 27, 20}}, - {m68000_base_device_ops::m68k_op_bfexts_32_d, 0xfff8, 0xebc0, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_bfexts_32_ai, 0xfff8, 0xebd0, {255, 255, 19, 19, 19, 19, 15}}, - {m68000_base_device_ops::m68k_op_bfexts_32_di, 0xfff8, 0xebe8, {255, 255, 20, 20, 20, 20, 15}}, - {m68000_base_device_ops::m68k_op_bfexts_32_ix, 0xfff8, 0xebf0, {255, 255, 22, 22, 22, 22, 15}}, - {m68000_base_device_ops::m68k_op_bfclr_32_d, 0xfff8, 0xecc0, {255, 255, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_bfclr_32_ai, 0xfff8, 0xecd0, {255, 255, 24, 24, 24, 24, 20}}, - {m68000_base_device_ops::m68k_op_bfclr_32_di, 0xfff8, 0xece8, {255, 255, 25, 25, 25, 25, 20}}, - {m68000_base_device_ops::m68k_op_bfclr_32_ix, 0xfff8, 0xecf0, {255, 255, 27, 27, 27, 27, 20}}, - {m68000_base_device_ops::m68k_op_bfffo_32_d, 0xfff8, 0xedc0, {255, 255, 18, 18, 18, 18, 18}}, - {m68000_base_device_ops::m68k_op_bfffo_32_ai, 0xfff8, 0xedd0, {255, 255, 32, 32, 32, 32, 28}}, - {m68000_base_device_ops::m68k_op_bfffo_32_di, 0xfff8, 0xede8, {255, 255, 33, 33, 33, 33, 28}}, - {m68000_base_device_ops::m68k_op_bfffo_32_ix, 0xfff8, 0xedf0, {255, 255, 35, 35, 35, 35, 28}}, - {m68000_base_device_ops::m68k_op_bfset_32_d, 0xfff8, 0xeec0, {255, 255, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_bfset_32_ai, 0xfff8, 0xeed0, {255, 255, 24, 24, 24, 24, 20}}, - {m68000_base_device_ops::m68k_op_bfset_32_di, 0xfff8, 0xeee8, {255, 255, 25, 25, 25, 25, 20}}, - {m68000_base_device_ops::m68k_op_bfset_32_ix, 0xfff8, 0xeef0, {255, 255, 27, 27, 27, 27, 20}}, - {m68000_base_device_ops::m68k_op_bfins_32_d, 0xfff8, 0xefc0, {255, 255, 10, 10, 10, 10, 10}}, - {m68000_base_device_ops::m68k_op_bfins_32_ai, 0xfff8, 0xefd0, {255, 255, 21, 21, 21, 21, 17}}, - {m68000_base_device_ops::m68k_op_bfins_32_di, 0xfff8, 0xefe8, {255, 255, 22, 22, 22, 22, 17}}, - {m68000_base_device_ops::m68k_op_bfins_32_ix, 0xfff8, 0xeff0, {255, 255, 24, 24, 24, 24, 17}}, - {m68000_base_device_ops::m68k_op_ftrapcc_32, 0xfff8, 0xf278, {255, 255, 4, 4, 255, 255, 255}}, - {m68000_base_device_ops::m68k_op_pflushan_32, 0xfff8, 0xf510, {255, 255, 255, 255, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_pflusha_32, 0xfff8, 0xf518, {255, 255, 255, 255, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_move16_32, 0xfff8, 0xf620, {255, 255, 255, 255, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_ori_8_pi7, 0xffff, 0x001f, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_8_pd7, 0xffff, 0x0027, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_ori_8_aw, 0xffff, 0x0038, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_8_al, 0xffff, 0x0039, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_16_toc, 0xffff, 0x003c, { 20, 16, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_ori_16_aw, 0xffff, 0x0078, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_16_al, 0xffff, 0x0079, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_16_tos, 0xffff, 0x007c, { 20, 16, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_ori_32_aw, 0xffff, 0x00b8, { 32, 32, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_ori_32_al, 0xffff, 0x00b9, { 36, 36, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_8_aw, 0xffff, 0x00f8, {255, 255, 22, 22, 22, 22, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_8_al, 0xffff, 0x00f9, {255, 255, 22, 22, 22, 22, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_8_pcdi, 0xffff, 0x00fa, {255, 255, 23, 23, 23, 23, 23}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_8_pcix, 0xffff, 0x00fb, {255, 255, 23, 23, 23, 23, 23}}, - {m68000_base_device_ops::m68k_op_andi_8_pi7, 0xffff, 0x021f, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_8_pd7, 0xffff, 0x0227, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_andi_8_aw, 0xffff, 0x0238, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_8_al, 0xffff, 0x0239, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_16_toc, 0xffff, 0x023c, { 20, 16, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_andi_16_aw, 0xffff, 0x0278, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_16_al, 0xffff, 0x0279, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_16_tos, 0xffff, 0x027c, { 20, 16, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_andi_32_aw, 0xffff, 0x02b8, { 32, 32, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_andi_32_al, 0xffff, 0x02b9, { 36, 36, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_16_aw, 0xffff, 0x02f8, {255, 255, 22, 22, 22, 22, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_16_al, 0xffff, 0x02f9, {255, 255, 22, 22, 22, 22, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_16_pcdi, 0xffff, 0x02fa, {255, 255, 23, 23, 23, 23, 23}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_16_pcix, 0xffff, 0x02fb, {255, 255, 23, 23, 23, 23, 23}}, - {m68000_base_device_ops::m68k_op_subi_8_pi7, 0xffff, 0x041f, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_8_pd7, 0xffff, 0x0427, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_subi_8_aw, 0xffff, 0x0438, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_8_al, 0xffff, 0x0439, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_16_aw, 0xffff, 0x0478, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_16_al, 0xffff, 0x0479, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_32_aw, 0xffff, 0x04b8, { 32, 32, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_subi_32_al, 0xffff, 0x04b9, { 36, 36, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_32_aw, 0xffff, 0x04f8, {255, 255, 22, 22, 22, 22, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_32_al, 0xffff, 0x04f9, {255, 255, 22, 22, 22, 22, 18}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_32_pcdi, 0xffff, 0x04fa, {255, 255, 23, 23, 23, 23, 23}}, - {m68000_base_device_ops::m68k_op_chk2cmp2_32_pcix, 0xffff, 0x04fb, {255, 255, 23, 23, 23, 23, 23}}, - {m68000_base_device_ops::m68k_op_addi_8_pi7, 0xffff, 0x061f, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_8_pd7, 0xffff, 0x0627, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_addi_8_aw, 0xffff, 0x0638, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_8_al, 0xffff, 0x0639, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_16_aw, 0xffff, 0x0678, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_16_al, 0xffff, 0x0679, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_32_aw, 0xffff, 0x06b8, { 32, 32, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_addi_32_al, 0xffff, 0x06b9, { 36, 36, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_callm_32_aw, 0xffff, 0x06f8, {255, 255, 64, 64, 64, 64, 60}}, - {m68000_base_device_ops::m68k_op_callm_32_al, 0xffff, 0x06f9, {255, 255, 64, 64, 64, 64, 60}}, - {m68000_base_device_ops::m68k_op_callm_32_pcdi, 0xffff, 0x06fa, {255, 255, 65, 65, 65, 65, 60}}, - {m68000_base_device_ops::m68k_op_callm_32_pcix, 0xffff, 0x06fb, {255, 255, 67, 67, 67, 67, 60}}, - {m68000_base_device_ops::m68k_op_btst_8_s_pi7, 0xffff, 0x081f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_s_pd7, 0xffff, 0x0827, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_s_aw, 0xffff, 0x0838, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_s_al, 0xffff, 0x0839, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_s_pcdi, 0xffff, 0x083a, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_btst_8_s_pcix, 0xffff, 0x083b, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_s_pi7, 0xffff, 0x085f, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_s_pd7, 0xffff, 0x0867, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_s_aw, 0xffff, 0x0878, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bchg_8_s_al, 0xffff, 0x0879, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_s_pi7, 0xffff, 0x089f, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_s_pd7, 0xffff, 0x08a7, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_s_aw, 0xffff, 0x08b8, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bclr_8_s_al, 0xffff, 0x08b9, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_s_pi7, 0xffff, 0x08df, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_s_pd7, 0xffff, 0x08e7, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_s_aw, 0xffff, 0x08f8, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_bset_8_s_al, 0xffff, 0x08f9, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_8_pi7, 0xffff, 0x0a1f, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_8_pd7, 0xffff, 0x0a27, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_eori_8_aw, 0xffff, 0x0a38, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_8_al, 0xffff, 0x0a39, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_16_toc, 0xffff, 0x0a3c, { 20, 16, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_eori_16_aw, 0xffff, 0x0a78, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_16_al, 0xffff, 0x0a79, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_16_tos, 0xffff, 0x0a7c, { 20, 16, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_eori_32_aw, 0xffff, 0x0ab8, { 32, 32, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_eori_32_al, 0xffff, 0x0ab9, { 36, 36, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_cas_8_pi7, 0xffff, 0x0adf, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas_8_pd7, 0xffff, 0x0ae7, {255, 255, 17, 17, 17, 17, 12}}, - {m68000_base_device_ops::m68k_op_cas_8_aw, 0xffff, 0x0af8, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas_8_al, 0xffff, 0x0af9, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cmpi_8_pi7, 0xffff, 0x0c1f, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_8_pd7, 0xffff, 0x0c27, { 14, 14, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_8_aw, 0xffff, 0x0c38, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_8_al, 0xffff, 0x0c39, { 20, 20, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_8_pcdi, 0xffff, 0x0c3a, {255, 255, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_cmpi_8_pcix, 0xffff, 0x0c3b, {255, 255, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_cmpi_16_aw, 0xffff, 0x0c78, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_16_al, 0xffff, 0x0c79, { 20, 20, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_16_pcdi, 0xffff, 0x0c7a, {255, 255, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_cmpi_16_pcix, 0xffff, 0x0c7b, {255, 255, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_cmpi_32_aw, 0xffff, 0x0cb8, { 24, 24, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_32_al, 0xffff, 0x0cb9, { 28, 28, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_cmpi_32_pcdi, 0xffff, 0x0cba, {255, 255, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_cmpi_32_pcix, 0xffff, 0x0cbb, {255, 255, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_cas_16_aw, 0xffff, 0x0cf8, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas_16_al, 0xffff, 0x0cf9, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas2_16, 0xffff, 0x0cfc, {255, 255, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_moves_8_pi7, 0xffff, 0x0e1f, {255, 18, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_8_pd7, 0xffff, 0x0e27, {255, 20, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_moves_8_aw, 0xffff, 0x0e38, {255, 26, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_8_al, 0xffff, 0x0e39, {255, 30, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_16_aw, 0xffff, 0x0e78, {255, 26, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_16_al, 0xffff, 0x0e79, {255, 30, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_32_aw, 0xffff, 0x0eb8, {255, 32, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_moves_32_al, 0xffff, 0x0eb9, {255, 36, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_cas_32_aw, 0xffff, 0x0ef8, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas_32_al, 0xffff, 0x0ef9, {255, 255, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_cas2_32, 0xffff, 0x0efc, {255, 255, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_move_8_aw_pi7, 0xffff, 0x11df, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_aw_pd7, 0xffff, 0x11e7, { 18, 18, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_aw_aw, 0xffff, 0x11f8, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_aw_al, 0xffff, 0x11f9, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_aw_pcdi, 0xffff, 0x11fa, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_aw_pcix, 0xffff, 0x11fb, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_8_aw_i, 0xffff, 0x11fc, { 16, 16, 6, 6, 6, 6, 4}}, - {m68000_base_device_ops::m68k_op_move_8_al_pi7, 0xffff, 0x13df, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_8_al_pd7, 0xffff, 0x13e7, { 22, 22, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_move_8_al_aw, 0xffff, 0x13f8, { 24, 24, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_8_al_al, 0xffff, 0x13f9, { 28, 28, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_8_al_pcdi, 0xffff, 0x13fa, { 24, 24, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_move_8_al_pcix, 0xffff, 0x13fb, { 26, 26, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_move_8_al_i, 0xffff, 0x13fc, { 20, 20, 8, 8, 8, 8, 6}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_pi7, 0xffff, 0x1edf, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_pd7, 0xffff, 0x1ee7, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_aw, 0xffff, 0x1ef8, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_al, 0xffff, 0x1ef9, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_pcdi, 0xffff, 0x1efa, { 16, 16, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_pcix, 0xffff, 0x1efb, { 18, 18, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pi7_i, 0xffff, 0x1efc, { 12, 12, 6, 6, 6, 6, 4}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_pi7, 0xffff, 0x1f1f, { 12, 12, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_pd7, 0xffff, 0x1f27, { 14, 14, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_aw, 0xffff, 0x1f38, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_al, 0xffff, 0x1f39, { 20, 20, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_pcdi, 0xffff, 0x1f3a, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_pcix, 0xffff, 0x1f3b, { 18, 18, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_move_8_pd7_i, 0xffff, 0x1f3c, { 12, 12, 7, 7, 7, 7, 5}}, - {m68000_base_device_ops::m68k_op_move_32_aw_aw, 0xffff, 0x21f8, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_aw_al, 0xffff, 0x21f9, { 32, 32, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_aw_pcdi, 0xffff, 0x21fa, { 28, 28, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_32_aw_pcix, 0xffff, 0x21fb, { 30, 30, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_32_aw_i, 0xffff, 0x21fc, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_32_al_aw, 0xffff, 0x23f8, { 32, 32, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_32_al_al, 0xffff, 0x23f9, { 36, 36, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_32_al_pcdi, 0xffff, 0x23fa, { 32, 32, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_move_32_al_pcix, 0xffff, 0x23fb, { 34, 34, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_move_32_al_i, 0xffff, 0x23fc, { 28, 28, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_16_aw_aw, 0xffff, 0x31f8, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_aw_al, 0xffff, 0x31f9, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_aw_pcdi, 0xffff, 0x31fa, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_aw_pcix, 0xffff, 0x31fb, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_16_aw_i, 0xffff, 0x31fc, { 16, 16, 6, 6, 6, 6, 4}}, - {m68000_base_device_ops::m68k_op_move_16_al_aw, 0xffff, 0x33f8, { 24, 24, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_16_al_al, 0xffff, 0x33f9, { 28, 28, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_move_16_al_pcdi, 0xffff, 0x33fa, { 24, 24, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_move_16_al_pcix, 0xffff, 0x33fb, { 26, 26, 13, 13, 13, 13, 6}}, - {m68000_base_device_ops::m68k_op_move_16_al_i, 0xffff, 0x33fc, { 20, 20, 8, 8, 8, 8, 6}}, - {m68000_base_device_ops::m68k_op_negx_8_pi7, 0xffff, 0x401f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_8_pd7, 0xffff, 0x4027, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_negx_8_aw, 0xffff, 0x4038, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_8_al, 0xffff, 0x4039, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_16_aw, 0xffff, 0x4078, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_16_al, 0xffff, 0x4079, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_32_aw, 0xffff, 0x40b8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_negx_32_al, 0xffff, 0x40b9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_frs_aw, 0xffff, 0x40f8, { 16, 16, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_move_16_frs_al, 0xffff, 0x40f9, { 20, 20, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_clr_8_pi7, 0xffff, 0x421f, { 12, 8, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_8_pd7, 0xffff, 0x4227, { 14, 10, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_clr_8_aw, 0xffff, 0x4238, { 16, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_8_al, 0xffff, 0x4239, { 20, 14, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_16_aw, 0xffff, 0x4278, { 16, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_16_al, 0xffff, 0x4279, { 20, 14, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_32_aw, 0xffff, 0x42b8, { 24, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_clr_32_al, 0xffff, 0x42b9, { 28, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_frc_aw, 0xffff, 0x42f8, {255, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_frc_al, 0xffff, 0x42f9, {255, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_8_pi7, 0xffff, 0x441f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_8_pd7, 0xffff, 0x4427, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_neg_8_aw, 0xffff, 0x4438, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_8_al, 0xffff, 0x4439, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_16_aw, 0xffff, 0x4478, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_16_al, 0xffff, 0x4479, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_32_aw, 0xffff, 0x44b8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_neg_32_al, 0xffff, 0x44b9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_toc_aw, 0xffff, 0x44f8, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_toc_al, 0xffff, 0x44f9, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_toc_pcdi, 0xffff, 0x44fa, { 20, 20, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_move_16_toc_pcix, 0xffff, 0x44fb, { 22, 22, 11, 11, 11, 11, 4}}, - {m68000_base_device_ops::m68k_op_move_16_toc_i, 0xffff, 0x44fc, { 16, 16, 6, 6, 6, 6, 4}}, - {m68000_base_device_ops::m68k_op_not_8_pi7, 0xffff, 0x461f, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_8_pd7, 0xffff, 0x4627, { 14, 14, 9, 9, 9, 9, 4}}, - {m68000_base_device_ops::m68k_op_not_8_aw, 0xffff, 0x4638, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_8_al, 0xffff, 0x4639, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_16_aw, 0xffff, 0x4678, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_16_al, 0xffff, 0x4679, { 20, 20, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_32_aw, 0xffff, 0x46b8, { 24, 24, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_not_32_al, 0xffff, 0x46b9, { 28, 28, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_move_16_tos_aw, 0xffff, 0x46f8, { 20, 20, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_move_16_tos_al, 0xffff, 0x46f9, { 24, 24, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_move_16_tos_pcdi, 0xffff, 0x46fa, { 20, 20, 13, 13, 13, 13, 8}}, - {m68000_base_device_ops::m68k_op_move_16_tos_pcix, 0xffff, 0x46fb, { 22, 22, 15, 15, 15, 15, 8}}, - {m68000_base_device_ops::m68k_op_move_16_tos_i, 0xffff, 0x46fc, { 16, 16, 10, 10, 10, 10, 8}}, - {m68000_base_device_ops::m68k_op_link_32_a7, 0xffff, 0x480f, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_nbcd_8_pi7, 0xffff, 0x481f, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_nbcd_8_pd7, 0xffff, 0x4827, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_nbcd_8_aw, 0xffff, 0x4838, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_nbcd_8_al, 0xffff, 0x4839, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_pea_32_aw, 0xffff, 0x4878, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_pea_32_al, 0xffff, 0x4879, { 20, 20, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_pea_32_pcdi, 0xffff, 0x487a, { 16, 16, 10, 10, 10, 10, 5}}, - {m68000_base_device_ops::m68k_op_pea_32_pcix, 0xffff, 0x487b, { 20, 20, 12, 12, 12, 12, 5}}, - {m68000_base_device_ops::m68k_op_movem_16_re_aw, 0xffff, 0x48b8, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_movem_16_re_al, 0xffff, 0x48b9, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_movem_32_re_aw, 0xffff, 0x48f8, { 12, 12, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_movem_32_re_al, 0xffff, 0x48f9, { 16, 16, 8, 8, 8, 8, 4}}, - {m68000_base_device_ops::m68k_op_tst_8_pi7, 0xffff, 0x4a1f, { 8, 8, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_8_pd7, 0xffff, 0x4a27, { 10, 10, 7, 7, 7, 7, 2}}, - {m68000_base_device_ops::m68k_op_tst_8_aw, 0xffff, 0x4a38, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_8_al, 0xffff, 0x4a39, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_8_pcdi, 0xffff, 0x4a3a, {255, 255, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_tst_8_pcix, 0xffff, 0x4a3b, {255, 255, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_tst_8_i, 0xffff, 0x4a3c, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_tst_16_aw, 0xffff, 0x4a78, { 12, 12, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_16_al, 0xffff, 0x4a79, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_16_pcdi, 0xffff, 0x4a7a, {255, 255, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_tst_16_pcix, 0xffff, 0x4a7b, {255, 255, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_tst_16_i, 0xffff, 0x4a7c, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_tst_32_aw, 0xffff, 0x4ab8, { 16, 16, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_32_al, 0xffff, 0x4ab9, { 20, 20, 6, 6, 6, 6, 2}}, - {m68000_base_device_ops::m68k_op_tst_32_pcdi, 0xffff, 0x4aba, {255, 255, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_tst_32_pcix, 0xffff, 0x4abb, {255, 255, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_tst_32_i, 0xffff, 0x4abc, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_tas_8_pi7, 0xffff, 0x4adf, { 18, 18, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_tas_8_pd7, 0xffff, 0x4ae7, { 20, 20, 17, 17, 17, 17, 12}}, - {m68000_base_device_ops::m68k_op_tas_8_aw, 0xffff, 0x4af8, { 22, 22, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_tas_8_al, 0xffff, 0x4af9, { 26, 26, 16, 16, 16, 16, 12}}, - {m68000_base_device_ops::m68k_op_illegal, 0xffff, 0x4afc, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_mull_32_aw, 0xffff, 0x4c38, {255, 255, 47, 47, 47, 47, 43}}, - {m68000_base_device_ops::m68k_op_mull_32_al, 0xffff, 0x4c39, {255, 255, 47, 47, 47, 47, 43}}, - {m68000_base_device_ops::m68k_op_mull_32_pcdi, 0xffff, 0x4c3a, {255, 255, 48, 48, 48, 48, 43}}, - {m68000_base_device_ops::m68k_op_mull_32_pcix, 0xffff, 0x4c3b, {255, 255, 50, 50, 50, 50, 43}}, - {m68000_base_device_ops::m68k_op_mull_32_i, 0xffff, 0x4c3c, {255, 255, 47, 47, 47, 47, 43}}, - {m68000_base_device_ops::m68k_op_divl_32_aw, 0xffff, 0x4c78, {255, 255, 88, 88, 88, 88, 84}}, - {m68000_base_device_ops::m68k_op_divl_32_al, 0xffff, 0x4c79, {255, 255, 88, 88, 88, 88, 84}}, - {m68000_base_device_ops::m68k_op_divl_32_pcdi, 0xffff, 0x4c7a, {255, 255, 89, 89, 89, 89, 84}}, - {m68000_base_device_ops::m68k_op_divl_32_pcix, 0xffff, 0x4c7b, {255, 255, 91, 91, 91, 91, 84}}, - {m68000_base_device_ops::m68k_op_divl_32_i, 0xffff, 0x4c7c, {255, 255, 88, 88, 88, 88, 84}}, - {m68000_base_device_ops::m68k_op_movem_16_er_aw, 0xffff, 0x4cb8, { 16, 16, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_movem_16_er_al, 0xffff, 0x4cb9, { 20, 20, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_movem_16_er_pcdi, 0xffff, 0x4cba, { 16, 16, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_movem_16_er_pcix, 0xffff, 0x4cbb, { 18, 18, 11, 11, 11, 11, 11}}, - {m68000_base_device_ops::m68k_op_movem_32_er_aw, 0xffff, 0x4cf8, { 16, 16, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_movem_32_er_al, 0xffff, 0x4cf9, { 20, 20, 12, 12, 12, 12, 8}}, - {m68000_base_device_ops::m68k_op_movem_32_er_pcdi, 0xffff, 0x4cfa, { 16, 16, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_movem_32_er_pcix, 0xffff, 0x4cfb, { 18, 18, 11, 11, 11, 11, 11}}, - {m68000_base_device_ops::m68k_op_link_16_a7, 0xffff, 0x4e57, { 16, 16, 5, 5, 5, 5, 5}}, - {m68000_base_device_ops::m68k_op_unlk_32_a7, 0xffff, 0x4e5f, { 12, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_reset, 0xffff, 0x4e70, { 0, 0, 0, 0, 0, 0, 0}}, - {m68000_base_device_ops::m68k_op_nop, 0xffff, 0x4e71, { 4, 4, 2, 2, 2, 2, 2}}, - {m68000_base_device_ops::m68k_op_stop, 0xffff, 0x4e72, { 4, 4, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_rte_32, 0xffff, 0x4e73, { 20, 24, 20, 20, 20, 20, 20}}, - {m68000_base_device_ops::m68k_op_rtd_32, 0xffff, 0x4e74, {255, 16, 10, 10, 10, 10, 10}}, - {m68000_base_device_ops::m68k_op_rts_32, 0xffff, 0x4e75, { 16, 16, 10, 10, 10, 10, 10}}, - {m68000_base_device_ops::m68k_op_trapv, 0xffff, 0x4e76, { 4, 4, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_rtr_32, 0xffff, 0x4e77, { 20, 20, 14, 14, 14, 14, 14}}, - {m68000_base_device_ops::m68k_op_movec_32_cr, 0xffff, 0x4e7a, {255, 12, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_movec_32_rc, 0xffff, 0x4e7b, {255, 10, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_jsr_32_aw, 0xffff, 0x4eb8, { 18, 18, 4, 4, 4, 4, 0}}, - {m68000_base_device_ops::m68k_op_jsr_32_al, 0xffff, 0x4eb9, { 20, 20, 4, 4, 4, 4, 0}}, - {m68000_base_device_ops::m68k_op_jsr_32_pcdi, 0xffff, 0x4eba, { 18, 18, 5, 5, 5, 5, 0}}, - {m68000_base_device_ops::m68k_op_jsr_32_pcix, 0xffff, 0x4ebb, { 22, 22, 7, 7, 7, 7, 0}}, - {m68000_base_device_ops::m68k_op_jmp_32_aw, 0xffff, 0x4ef8, { 10, 10, 4, 4, 4, 4, 0}}, - {m68000_base_device_ops::m68k_op_jmp_32_al, 0xffff, 0x4ef9, { 12, 12, 4, 4, 4, 4, 0}}, - {m68000_base_device_ops::m68k_op_jmp_32_pcdi, 0xffff, 0x4efa, { 10, 10, 5, 5, 5, 5, 0}}, - {m68000_base_device_ops::m68k_op_jmp_32_pcix, 0xffff, 0x4efb, { 14, 14, 7, 7, 7, 7, 0}}, - {m68000_base_device_ops::m68k_op_st_8_pi7, 0xffff, 0x50df, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_st_8_pd7, 0xffff, 0x50e7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_st_8_aw, 0xffff, 0x50f8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_st_8_al, 0xffff, 0x50f9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapt_16, 0xffff, 0x50fa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapt_32, 0xffff, 0x50fb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapt, 0xffff, 0x50fc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_sf_8_pi7, 0xffff, 0x51df, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sf_8_pd7, 0xffff, 0x51e7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sf_8_aw, 0xffff, 0x51f8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sf_8_al, 0xffff, 0x51f9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapf_16, 0xffff, 0x51fa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapf_32, 0xffff, 0x51fb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapf, 0xffff, 0x51fc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_shi_8_pi7, 0xffff, 0x52df, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_shi_8_pd7, 0xffff, 0x52e7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_shi_8_aw, 0xffff, 0x52f8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_shi_8_al, 0xffff, 0x52f9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_traphi_16, 0xffff, 0x52fa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_traphi_32, 0xffff, 0x52fb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_traphi, 0xffff, 0x52fc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_sls_8_pi7, 0xffff, 0x53df, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sls_8_pd7, 0xffff, 0x53e7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sls_8_aw, 0xffff, 0x53f8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sls_8_al, 0xffff, 0x53f9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapls_16, 0xffff, 0x53fa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapls_32, 0xffff, 0x53fb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapls, 0xffff, 0x53fc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_scc_8_pi7, 0xffff, 0x54df, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_scc_8_pd7, 0xffff, 0x54e7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_scc_8_aw, 0xffff, 0x54f8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_scc_8_al, 0xffff, 0x54f9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapcc_16, 0xffff, 0x54fa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapcc_32, 0xffff, 0x54fb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapcc, 0xffff, 0x54fc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_scs_8_pi7, 0xffff, 0x55df, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_scs_8_pd7, 0xffff, 0x55e7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_scs_8_aw, 0xffff, 0x55f8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_scs_8_al, 0xffff, 0x55f9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapcs_16, 0xffff, 0x55fa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapcs_32, 0xffff, 0x55fb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapcs, 0xffff, 0x55fc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_sne_8_pi7, 0xffff, 0x56df, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sne_8_pd7, 0xffff, 0x56e7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sne_8_aw, 0xffff, 0x56f8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sne_8_al, 0xffff, 0x56f9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapne_16, 0xffff, 0x56fa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapne_32, 0xffff, 0x56fb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapne, 0xffff, 0x56fc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_seq_8_pi7, 0xffff, 0x57df, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_seq_8_pd7, 0xffff, 0x57e7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_seq_8_aw, 0xffff, 0x57f8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_seq_8_al, 0xffff, 0x57f9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapeq_16, 0xffff, 0x57fa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapeq_32, 0xffff, 0x57fb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapeq, 0xffff, 0x57fc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_svc_8_pi7, 0xffff, 0x58df, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_svc_8_pd7, 0xffff, 0x58e7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_svc_8_aw, 0xffff, 0x58f8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_svc_8_al, 0xffff, 0x58f9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapvc_16, 0xffff, 0x58fa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapvc_32, 0xffff, 0x58fb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapvc, 0xffff, 0x58fc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_svs_8_pi7, 0xffff, 0x59df, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_svs_8_pd7, 0xffff, 0x59e7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_svs_8_aw, 0xffff, 0x59f8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_svs_8_al, 0xffff, 0x59f9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapvs_16, 0xffff, 0x59fa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapvs_32, 0xffff, 0x59fb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapvs, 0xffff, 0x59fc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_spl_8_pi7, 0xffff, 0x5adf, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_spl_8_pd7, 0xffff, 0x5ae7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_spl_8_aw, 0xffff, 0x5af8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_spl_8_al, 0xffff, 0x5af9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trappl_16, 0xffff, 0x5afa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trappl_32, 0xffff, 0x5afb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trappl, 0xffff, 0x5afc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_smi_8_pi7, 0xffff, 0x5bdf, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_smi_8_pd7, 0xffff, 0x5be7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_smi_8_aw, 0xffff, 0x5bf8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_smi_8_al, 0xffff, 0x5bf9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapmi_16, 0xffff, 0x5bfa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapmi_32, 0xffff, 0x5bfb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapmi, 0xffff, 0x5bfc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_sge_8_pi7, 0xffff, 0x5cdf, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sge_8_pd7, 0xffff, 0x5ce7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sge_8_aw, 0xffff, 0x5cf8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sge_8_al, 0xffff, 0x5cf9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapge_16, 0xffff, 0x5cfa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapge_32, 0xffff, 0x5cfb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapge, 0xffff, 0x5cfc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_slt_8_pi7, 0xffff, 0x5ddf, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_slt_8_pd7, 0xffff, 0x5de7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_slt_8_aw, 0xffff, 0x5df8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_slt_8_al, 0xffff, 0x5df9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_traplt_16, 0xffff, 0x5dfa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_traplt_32, 0xffff, 0x5dfb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_traplt, 0xffff, 0x5dfc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_sgt_8_pi7, 0xffff, 0x5edf, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sgt_8_pd7, 0xffff, 0x5ee7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sgt_8_aw, 0xffff, 0x5ef8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sgt_8_al, 0xffff, 0x5ef9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_trapgt_16, 0xffff, 0x5efa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_trapgt_32, 0xffff, 0x5efb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_trapgt, 0xffff, 0x5efc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_sle_8_pi7, 0xffff, 0x5fdf, { 12, 12, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sle_8_pd7, 0xffff, 0x5fe7, { 14, 14, 11, 11, 11, 11, 6}}, - {m68000_base_device_ops::m68k_op_sle_8_aw, 0xffff, 0x5ff8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_sle_8_al, 0xffff, 0x5ff9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_traple_16, 0xffff, 0x5ffa, {255, 255, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_traple_32, 0xffff, 0x5ffb, {255, 255, 8, 8, 8, 8, 8}}, - {m68000_base_device_ops::m68k_op_traple, 0xffff, 0x5ffc, {255, 255, 4, 4, 4, 4, 4}}, - {m68000_base_device_ops::m68k_op_bra_16, 0xffff, 0x6000, { 10, 10, 10, 10, 10, 10, 10}}, - {m68000_base_device_ops::m68k_op_bra_32, 0xffff, 0x60ff, { 10, 10, 10, 10, 10, 10, 10}}, - {m68000_base_device_ops::m68k_op_bsr_16, 0xffff, 0x6100, { 18, 18, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_bsr_32, 0xffff, 0x61ff, { 18, 18, 7, 7, 7, 7, 7}}, - {m68000_base_device_ops::m68k_op_bhi_16, 0xffff, 0x6200, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bhi_32, 0xffff, 0x62ff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bls_16, 0xffff, 0x6300, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bls_32, 0xffff, 0x63ff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bcc_16, 0xffff, 0x6400, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bcc_32, 0xffff, 0x64ff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bcs_16, 0xffff, 0x6500, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bcs_32, 0xffff, 0x65ff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bne_16, 0xffff, 0x6600, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bne_32, 0xffff, 0x66ff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_beq_16, 0xffff, 0x6700, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_beq_32, 0xffff, 0x67ff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bvc_16, 0xffff, 0x6800, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bvc_32, 0xffff, 0x68ff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bvs_16, 0xffff, 0x6900, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bvs_32, 0xffff, 0x69ff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bpl_16, 0xffff, 0x6a00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bpl_32, 0xffff, 0x6aff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bmi_16, 0xffff, 0x6b00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bmi_32, 0xffff, 0x6bff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bge_16, 0xffff, 0x6c00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bge_32, 0xffff, 0x6cff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_blt_16, 0xffff, 0x6d00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_blt_32, 0xffff, 0x6dff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bgt_16, 0xffff, 0x6e00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_bgt_32, 0xffff, 0x6eff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_ble_16, 0xffff, 0x6f00, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_ble_32, 0xffff, 0x6fff, { 10, 10, 6, 6, 6, 6, 6}}, - {m68000_base_device_ops::m68k_op_sbcd_8_mm_axy7, 0xffff, 0x8f0f, { 18, 18, 16, 16, 16, 16, 16}}, - {m68000_base_device_ops::m68k_op_pack_16_mm_axy7, 0xffff, 0x8f4f, {255, 255, 13, 13, 13, 13, 13}}, - {m68000_base_device_ops::m68k_op_unpk_16_mm_axy7, 0xffff, 0x8f8f, {255, 255, 13, 13, 13, 13, 13}}, - {m68000_base_device_ops::m68k_op_subx_8_mm_axy7, 0xffff, 0x9f0f, { 18, 18, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_cmpm_8_axy7, 0xffff, 0xbf0f, { 12, 12, 9, 9, 9, 9, 9}}, - {m68000_base_device_ops::m68k_op_abcd_8_mm_axy7, 0xffff, 0xcf0f, { 18, 18, 16, 16, 16, 16, 16}}, - {m68000_base_device_ops::m68k_op_addx_8_mm_axy7, 0xffff, 0xdf0f, { 18, 18, 12, 12, 12, 12, 12}}, - {m68000_base_device_ops::m68k_op_asr_16_aw, 0xffff, 0xe0f8, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_asr_16_al, 0xffff, 0xe0f9, { 20, 20, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_asl_16_aw, 0xffff, 0xe1f8, { 16, 16, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_asl_16_al, 0xffff, 0xe1f9, { 20, 20, 10, 10, 10, 10, 6}}, - {m68000_base_device_ops::m68k_op_lsr_16_aw, 0xffff, 0xe2f8, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_lsr_16_al, 0xffff, 0xe2f9, { 20, 20, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_lsl_16_aw, 0xffff, 0xe3f8, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_lsl_16_al, 0xffff, 0xe3f9, { 20, 20, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_roxr_16_aw, 0xffff, 0xe4f8, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_roxr_16_al, 0xffff, 0xe4f9, { 20, 20, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_roxl_16_aw, 0xffff, 0xe5f8, { 16, 16, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_roxl_16_al, 0xffff, 0xe5f9, { 20, 20, 9, 9, 9, 9, 5}}, - {m68000_base_device_ops::m68k_op_ror_16_aw, 0xffff, 0xe6f8, { 16, 16, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_ror_16_al, 0xffff, 0xe6f9, { 20, 20, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_rol_16_aw, 0xffff, 0xe7f8, { 16, 16, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_rol_16_al, 0xffff, 0xe7f9, { 20, 20, 11, 11, 11, 11, 7}}, - {m68000_base_device_ops::m68k_op_bftst_32_aw, 0xffff, 0xe8f8, {255, 255, 17, 17, 17, 17, 13}}, - {m68000_base_device_ops::m68k_op_bftst_32_al, 0xffff, 0xe8f9, {255, 255, 17, 17, 17, 17, 13}}, - {m68000_base_device_ops::m68k_op_bftst_32_pcdi, 0xffff, 0xe8fa, {255, 255, 18, 18, 18, 18, 13}}, - {m68000_base_device_ops::m68k_op_bftst_32_pcix, 0xffff, 0xe8fb, {255, 255, 20, 20, 20, 20, 13}}, - {m68000_base_device_ops::m68k_op_bfextu_32_aw, 0xffff, 0xe9f8, {255, 255, 19, 19, 19, 19, 15}}, - {m68000_base_device_ops::m68k_op_bfextu_32_al, 0xffff, 0xe9f9, {255, 255, 19, 19, 19, 19, 15}}, - {m68000_base_device_ops::m68k_op_bfextu_32_pcdi, 0xffff, 0xe9fa, {255, 255, 20, 20, 20, 20, 15}}, - {m68000_base_device_ops::m68k_op_bfextu_32_pcix, 0xffff, 0xe9fb, {255, 255, 22, 22, 22, 22, 15}}, - {m68000_base_device_ops::m68k_op_bfchg_32_aw, 0xffff, 0xeaf8, {255, 255, 24, 24, 24, 24, 20}}, - {m68000_base_device_ops::m68k_op_bfchg_32_al, 0xffff, 0xeaf9, {255, 255, 24, 24, 24, 24, 20}}, - {m68000_base_device_ops::m68k_op_bfexts_32_aw, 0xffff, 0xebf8, {255, 255, 19, 19, 19, 19, 15}}, - {m68000_base_device_ops::m68k_op_bfexts_32_al, 0xffff, 0xebf9, {255, 255, 19, 19, 19, 19, 15}}, - {m68000_base_device_ops::m68k_op_bfexts_32_pcdi, 0xffff, 0xebfa, {255, 255, 20, 20, 20, 20, 15}}, - {m68000_base_device_ops::m68k_op_bfexts_32_pcix, 0xffff, 0xebfb, {255, 255, 22, 22, 22, 22, 15}}, - {m68000_base_device_ops::m68k_op_bfclr_32_aw, 0xffff, 0xecf8, {255, 255, 24, 24, 24, 24, 20}}, - {m68000_base_device_ops::m68k_op_bfclr_32_al, 0xffff, 0xecf9, {255, 255, 24, 24, 24, 24, 20}}, - {m68000_base_device_ops::m68k_op_bfffo_32_aw, 0xffff, 0xedf8, {255, 255, 32, 32, 32, 32, 28}}, - {m68000_base_device_ops::m68k_op_bfffo_32_al, 0xffff, 0xedf9, {255, 255, 32, 32, 32, 32, 28}}, - {m68000_base_device_ops::m68k_op_bfffo_32_pcdi, 0xffff, 0xedfa, {255, 255, 33, 33, 33, 33, 28}}, - {m68000_base_device_ops::m68k_op_bfffo_32_pcix, 0xffff, 0xedfb, {255, 255, 35, 35, 35, 35, 28}}, - {m68000_base_device_ops::m68k_op_bfset_32_aw, 0xffff, 0xeef8, {255, 255, 24, 24, 24, 24, 20}}, - {m68000_base_device_ops::m68k_op_bfset_32_al, 0xffff, 0xeef9, {255, 255, 24, 24, 24, 24, 20}}, - {m68000_base_device_ops::m68k_op_bfins_32_aw, 0xffff, 0xeff8, {255, 255, 21, 21, 21, 21, 17}}, - {m68000_base_device_ops::m68k_op_bfins_32_al, 0xffff, 0xeff9, {255, 255, 21, 21, 21, 21, 17}}, - {nullptr, 0, 0, {0, 0, 0, 0, 0}} -}; - - -/* Build the opcode handler jump table */ - -static void m68ki_set_one(unsigned short opcode, const opcode_handler_struct *s) -{ - for(int i=0; icycles[i] != 0xff) { - m68ki_cycles[i][opcode] = s->cycles[i]; - m68ki_instruction_jump_table[i][opcode] = s->opcode_handler; - } -} - -void m68ki_build_opcode_table(void) -{ - const opcode_handler_struct *ostruct; - int i; - int j; - int k; - - for(i = 0; i < 0x10000; i++) - { - /* default to illegal */ - for(k=0;kmask != 0xff00) - { - for(i = 0;i < 0x10000;i++) - { - if((i & ostruct->mask) == ostruct->match) - m68ki_set_one(i, ostruct); - } - ostruct++; - } - while(ostruct->mask == 0xff00) - { - for(i = 0;i <= 0xff;i++) - m68ki_set_one(ostruct->match | i, ostruct); - ostruct++; - } - while(ostruct->mask == 0xff20) - { - for(i = 0;i < 4;i++) - { - for(j = 0;j < 32;j++) - { - m68ki_set_one(ostruct->match | (i << 6) | j, ostruct); - } - } - ostruct++; - } - while(ostruct->mask == 0xf1f8) - { - for(i = 0;i < 8;i++) - { - for(j = 0;j < 8;j++) - m68ki_set_one(ostruct->match | (i << 9) | j, ostruct); - } - ostruct++; - } - while(ostruct->mask == 0xffd8) - { - for(i = 0;i < 2;i++) - { - for(j = 0;j < 8;j++) - { - m68ki_set_one(ostruct->match | (i << 5) | j, ostruct); - } - } - ostruct++; - } - while(ostruct->mask == 0xfff0) - { - for(i = 0;i <= 0x0f;i++) - m68ki_set_one(ostruct->match | i, ostruct); - ostruct++; - } - while(ostruct->mask == 0xf1ff) - { - for(i = 0;i <= 0x07;i++) - m68ki_set_one(ostruct->match | (i << 9), ostruct); - ostruct++; - } - while(ostruct->mask == 0xfff8) - { - for(i = 0;i <= 0x07;i++) - m68ki_set_one(ostruct->match | i, ostruct); - ostruct++; - } - while(ostruct->mask == 0xffff) - { - m68ki_set_one(ostruct->match, ostruct); - ostruct++; - } - - // if we fell all the way through with a non-zero mask, the opcode table wasn't built properly - if (ostruct->mask != 0) - { - fatalerror("m68ki_build_opcode_table: unhandled opcode mask %x (match %x), m68k core will not function!\n", ostruct->mask, ostruct->match); - } -} - - -/* ======================================================================== */ -/* ============================== END OF FILE ============================= */ -/* ======================================================================== */ diff --git a/src/devices/cpu/m68000/m68kops.h b/src/devices/cpu/m68000/m68kops.h deleted file mode 100644 index 3f936f646f2..00000000000 --- a/src/devices/cpu/m68000/m68kops.h +++ /dev/null @@ -1,1995 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Karl Stenerud -/* ======================================================================== */ -/* ============================ OPCODE HANDLERS =========================== */ -/* ======================================================================== */ - - -#ifdef OPCODE_PROTOTYPES - -static void m68k_op_1010(m68000_base_device* mc68kcpu); -static void m68k_op_1111(m68000_base_device* mc68kcpu); -static void m68k_op_040fpu0_32(m68000_base_device* mc68kcpu); -static void m68k_op_040fpu1_32(m68000_base_device* mc68kcpu); -static void m68k_op_abcd_8_rr(m68000_base_device* mc68kcpu); -static void m68k_op_abcd_8_mm_ax7(m68000_base_device* mc68kcpu); -static void m68k_op_abcd_8_mm_ay7(m68000_base_device* mc68kcpu); -static void m68k_op_abcd_8_mm_axy7(m68000_base_device* mc68kcpu); -static void m68k_op_abcd_8_mm(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_a(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_a(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_re_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_re_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_add_8_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_add_16_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_add_32_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_a(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_adda_16_i(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_a(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_adda_32_i(m68000_base_device* mc68kcpu); -static void m68k_op_addi_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_addi_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_addi_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_addi_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_addi_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_addi_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_addi_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_addi_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_addi_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_addi_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_addi_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_addi_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_addi_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_addi_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_addi_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_addi_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_addi_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_addi_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_addi_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_addi_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_addi_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_addi_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_addi_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_addi_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_addi_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_addi_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_addq_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_addq_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_addq_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_addq_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_addq_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_addq_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_addq_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_addq_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_addq_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_addq_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_addq_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_addq_16_a(m68000_base_device* mc68kcpu); -static void m68k_op_addq_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_addq_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_addq_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_addq_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_addq_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_addq_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_addq_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_addq_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_addq_32_a(m68000_base_device* mc68kcpu); -static void m68k_op_addq_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_addq_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_addq_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_addq_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_addq_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_addq_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_addq_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_addx_8_rr(m68000_base_device* mc68kcpu); -static void m68k_op_addx_16_rr(m68000_base_device* mc68kcpu); -static void m68k_op_addx_32_rr(m68000_base_device* mc68kcpu); -static void m68k_op_addx_8_mm_ax7(m68000_base_device* mc68kcpu); -static void m68k_op_addx_8_mm_ay7(m68000_base_device* mc68kcpu); -static void m68k_op_addx_8_mm_axy7(m68000_base_device* mc68kcpu); -static void m68k_op_addx_8_mm(m68000_base_device* mc68kcpu); -static void m68k_op_addx_16_mm(m68000_base_device* mc68kcpu); -static void m68k_op_addx_32_mm(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_re_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_re_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_and_8_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_and_16_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_and_32_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_andi_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_andi_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_andi_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_andi_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_andi_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_andi_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_andi_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_andi_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_andi_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_andi_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_andi_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_andi_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_andi_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_andi_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_andi_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_andi_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_andi_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_andi_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_andi_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_andi_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_andi_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_andi_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_andi_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_andi_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_andi_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_andi_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_andi_16_toc(m68000_base_device* mc68kcpu); -static void m68k_op_andi_16_tos(m68000_base_device* mc68kcpu); -static void m68k_op_asr_8_s(m68000_base_device* mc68kcpu); -static void m68k_op_asr_16_s(m68000_base_device* mc68kcpu); -static void m68k_op_asr_32_s(m68000_base_device* mc68kcpu); -static void m68k_op_asr_8_r(m68000_base_device* mc68kcpu); -static void m68k_op_asr_16_r(m68000_base_device* mc68kcpu); -static void m68k_op_asr_32_r(m68000_base_device* mc68kcpu); -static void m68k_op_asr_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_asr_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_asr_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_asr_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_asr_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_asr_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_asr_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_asl_8_s(m68000_base_device* mc68kcpu); -static void m68k_op_asl_16_s(m68000_base_device* mc68kcpu); -static void m68k_op_asl_32_s(m68000_base_device* mc68kcpu); -static void m68k_op_asl_8_r(m68000_base_device* mc68kcpu); -static void m68k_op_asl_16_r(m68000_base_device* mc68kcpu); -static void m68k_op_asl_32_r(m68000_base_device* mc68kcpu); -static void m68k_op_asl_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_asl_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_asl_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_asl_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_asl_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_asl_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_asl_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_bhi_8(m68000_base_device* mc68kcpu); -static void m68k_op_bls_8(m68000_base_device* mc68kcpu); -static void m68k_op_bcc_8(m68000_base_device* mc68kcpu); -static void m68k_op_bcs_8(m68000_base_device* mc68kcpu); -static void m68k_op_bne_8(m68000_base_device* mc68kcpu); -static void m68k_op_beq_8(m68000_base_device* mc68kcpu); -static void m68k_op_bvc_8(m68000_base_device* mc68kcpu); -static void m68k_op_bvs_8(m68000_base_device* mc68kcpu); -static void m68k_op_bpl_8(m68000_base_device* mc68kcpu); -static void m68k_op_bmi_8(m68000_base_device* mc68kcpu); -static void m68k_op_bge_8(m68000_base_device* mc68kcpu); -static void m68k_op_blt_8(m68000_base_device* mc68kcpu); -static void m68k_op_bgt_8(m68000_base_device* mc68kcpu); -static void m68k_op_ble_8(m68000_base_device* mc68kcpu); -static void m68k_op_bhi_16(m68000_base_device* mc68kcpu); -static void m68k_op_bls_16(m68000_base_device* mc68kcpu); -static void m68k_op_bcc_16(m68000_base_device* mc68kcpu); -static void m68k_op_bcs_16(m68000_base_device* mc68kcpu); -static void m68k_op_bne_16(m68000_base_device* mc68kcpu); -static void m68k_op_beq_16(m68000_base_device* mc68kcpu); -static void m68k_op_bvc_16(m68000_base_device* mc68kcpu); -static void m68k_op_bvs_16(m68000_base_device* mc68kcpu); -static void m68k_op_bpl_16(m68000_base_device* mc68kcpu); -static void m68k_op_bmi_16(m68000_base_device* mc68kcpu); -static void m68k_op_bge_16(m68000_base_device* mc68kcpu); -static void m68k_op_blt_16(m68000_base_device* mc68kcpu); -static void m68k_op_bgt_16(m68000_base_device* mc68kcpu); -static void m68k_op_ble_16(m68000_base_device* mc68kcpu); -static void m68k_op_bhi_32(m68000_base_device* mc68kcpu); -static void m68k_op_bls_32(m68000_base_device* mc68kcpu); -static void m68k_op_bcc_32(m68000_base_device* mc68kcpu); -static void m68k_op_bcs_32(m68000_base_device* mc68kcpu); -static void m68k_op_bne_32(m68000_base_device* mc68kcpu); -static void m68k_op_beq_32(m68000_base_device* mc68kcpu); -static void m68k_op_bvc_32(m68000_base_device* mc68kcpu); -static void m68k_op_bvs_32(m68000_base_device* mc68kcpu); -static void m68k_op_bpl_32(m68000_base_device* mc68kcpu); -static void m68k_op_bmi_32(m68000_base_device* mc68kcpu); -static void m68k_op_bge_32(m68000_base_device* mc68kcpu); -static void m68k_op_blt_32(m68000_base_device* mc68kcpu); -static void m68k_op_bgt_32(m68000_base_device* mc68kcpu); -static void m68k_op_ble_32(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_32_r_d(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_r_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_r_pi(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_r_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_r_pd(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_r_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_r_di(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_r_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_r_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_r_al(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_32_s_d(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_s_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_s_pi(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_s_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_s_pd(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_s_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_s_di(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_s_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_s_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bchg_8_s_al(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_32_r_d(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_r_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_r_pi(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_r_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_r_pd(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_r_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_r_di(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_r_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_r_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_r_al(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_32_s_d(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_s_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_s_pi(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_s_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_s_pd(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_s_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_s_di(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_s_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_s_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bclr_8_s_al(m68000_base_device* mc68kcpu); -static void m68k_op_bfchg_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_bfchg_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bfchg_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_bfchg_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bfchg_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bfchg_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_bfclr_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_bfclr_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bfclr_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_bfclr_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bfclr_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bfclr_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_bfexts_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_bfexts_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bfexts_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_bfexts_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bfexts_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bfexts_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_bfexts_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_bfexts_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_bfextu_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_bfextu_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bfextu_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_bfextu_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bfextu_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bfextu_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_bfextu_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_bfextu_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_bfffo_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_bfffo_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bfffo_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_bfffo_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bfffo_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bfffo_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_bfffo_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_bfffo_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_bfins_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_bfins_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bfins_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_bfins_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bfins_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bfins_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_bfset_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_bfset_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bfset_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_bfset_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bfset_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bfset_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_bftst_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_bftst_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bftst_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_bftst_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bftst_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bftst_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_bftst_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_bftst_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_bkpt(m68000_base_device* mc68kcpu); -static void m68k_op_bra_8(m68000_base_device* mc68kcpu); -static void m68k_op_bra_16(m68000_base_device* mc68kcpu); -static void m68k_op_bra_32(m68000_base_device* mc68kcpu); -static void m68k_op_bset_32_r_d(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_r_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_r_pi(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_r_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_r_pd(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_r_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_r_di(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_r_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_r_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_r_al(m68000_base_device* mc68kcpu); -static void m68k_op_bset_32_s_d(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_s_ai(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_s_pi(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_s_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_s_pd(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_s_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_s_di(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_s_ix(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_s_aw(m68000_base_device* mc68kcpu); -static void m68k_op_bset_8_s_al(m68000_base_device* mc68kcpu); -static void m68k_op_bsr_8(m68000_base_device* mc68kcpu); -static void m68k_op_bsr_16(m68000_base_device* mc68kcpu); -static void m68k_op_bsr_32(m68000_base_device* mc68kcpu); -static void m68k_op_btst_32_r_d(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_ai(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_pi(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_pd(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_di(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_ix(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_aw(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_al(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_r_i(m68000_base_device* mc68kcpu); -static void m68k_op_btst_32_s_d(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_s_ai(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_s_pi(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_s_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_s_pd(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_s_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_s_di(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_s_ix(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_s_aw(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_s_al(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_s_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_btst_8_s_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_callm_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_callm_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_callm_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_callm_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_callm_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_callm_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_callm_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_cas_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_cas_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_cas_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_cas_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_cas_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_cas_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_cas_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_cas_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_cas_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_cas_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_cas_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_cas_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_cas_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_cas_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_cas_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_cas_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_cas_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_cas_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_cas_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_cas_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_cas_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_cas_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_cas_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_cas2_16(m68000_base_device* mc68kcpu); -static void m68k_op_cas2_32(m68000_base_device* mc68kcpu); -static void m68k_op_chk_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_chk_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_chk_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_chk_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_chk_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_chk_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_chk_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_chk_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_chk_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_chk_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_chk_16_i(m68000_base_device* mc68kcpu); -static void m68k_op_chk_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_chk_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_chk_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_chk_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_chk_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_chk_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_chk_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_chk_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_chk_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_chk_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_chk_32_i(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_8_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_8_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_chk2cmp2_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_clr_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_clr_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_clr_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_clr_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_clr_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_clr_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_clr_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_clr_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_clr_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_clr_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_clr_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_clr_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_clr_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_clr_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_clr_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_clr_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_clr_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_clr_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_clr_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_clr_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_clr_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_clr_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_clr_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_clr_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_clr_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_clr_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_8_i(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_a(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_16_i(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_a(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_cmp_32_i(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_a(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_16_i(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_a(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_cmpa_32_i(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_8_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_cmpi_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_cmpm_8_ax7(m68000_base_device* mc68kcpu); -static void m68k_op_cmpm_8_ay7(m68000_base_device* mc68kcpu); -static void m68k_op_cmpm_8_axy7(m68000_base_device* mc68kcpu); -static void m68k_op_cmpm_8(m68000_base_device* mc68kcpu); -static void m68k_op_cmpm_16(m68000_base_device* mc68kcpu); -static void m68k_op_cmpm_32(m68000_base_device* mc68kcpu); -static void m68k_op_cpbcc_32(m68000_base_device* mc68kcpu); -static void m68k_op_cpdbcc_32(m68000_base_device* mc68kcpu); -static void m68k_op_cpgen_32(m68000_base_device* mc68kcpu); -static void m68k_op_cpscc_32(m68000_base_device* mc68kcpu); -static void m68k_op_cptrapcc_32(m68000_base_device* mc68kcpu); -static void m68k_op_ftrapcc_32(m68000_base_device* mc68kcpu); -static void m68k_op_dbt_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbf_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbhi_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbls_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbcc_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbcs_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbne_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbeq_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbvc_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbvs_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbpl_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbmi_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbge_16(m68000_base_device* mc68kcpu); -static void m68k_op_dblt_16(m68000_base_device* mc68kcpu); -static void m68k_op_dbgt_16(m68000_base_device* mc68kcpu); -static void m68k_op_dble_16(m68000_base_device* mc68kcpu); -static void m68k_op_divs_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_divs_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_divs_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_divs_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_divs_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_divs_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_divs_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_divs_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_divs_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_divs_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_divs_16_i(m68000_base_device* mc68kcpu); -static void m68k_op_divu_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_divu_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_divu_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_divu_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_divu_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_divu_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_divu_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_divu_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_divu_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_divu_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_divu_16_i(m68000_base_device* mc68kcpu); -static void m68k_op_divl_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_divl_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_divl_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_divl_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_divl_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_divl_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_divl_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_divl_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_divl_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_divl_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_divl_32_i(m68000_base_device* mc68kcpu); -static void m68k_op_eor_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_eor_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_eor_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_eor_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_eor_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_eor_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_eor_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_eor_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_eor_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_eor_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_eor_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_eor_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_eor_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_eor_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_eor_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_eor_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_eor_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_eor_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_eor_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_eor_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_eor_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_eor_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_eor_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_eor_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_eor_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_eor_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_eori_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_eori_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_eori_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_eori_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_eori_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_eori_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_eori_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_eori_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_eori_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_eori_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_eori_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_eori_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_eori_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_eori_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_eori_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_eori_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_eori_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_eori_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_eori_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_eori_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_eori_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_eori_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_eori_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_eori_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_eori_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_eori_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_eori_16_toc(m68000_base_device* mc68kcpu); -static void m68k_op_eori_16_tos(m68000_base_device* mc68kcpu); -static void m68k_op_exg_32_dd(m68000_base_device* mc68kcpu); -static void m68k_op_exg_32_aa(m68000_base_device* mc68kcpu); -static void m68k_op_exg_32_da(m68000_base_device* mc68kcpu); -static void m68k_op_ext_16(m68000_base_device* mc68kcpu); -static void m68k_op_ext_32(m68000_base_device* mc68kcpu); -static void m68k_op_extb_32(m68000_base_device* mc68kcpu); -static void m68k_op_illegal(m68000_base_device* mc68kcpu); -static void m68k_op_jmp_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_jmp_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_jmp_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_jmp_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_jmp_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_jmp_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_jmp_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_jsr_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_jsr_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_jsr_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_jsr_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_jsr_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_jsr_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_jsr_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_lea_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_lea_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_lea_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_lea_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_lea_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_lea_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_lea_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_link_16_a7(m68000_base_device* mc68kcpu); -static void m68k_op_link_16(m68000_base_device* mc68kcpu); -static void m68k_op_link_32_a7(m68000_base_device* mc68kcpu); -static void m68k_op_link_32(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_8_s(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_16_s(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_32_s(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_8_r(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_16_r(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_32_r(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_lsr_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_8_s(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_16_s(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_32_s(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_8_r(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_16_r(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_32_r(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_lsl_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_d_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ai_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi7_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pi_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd7_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_pd_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_di_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_ix_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_aw_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_8_al_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_d_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ai_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pi_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_pd_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_di_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_ix_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_aw_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_al_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_d_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ai_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pi_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_pd_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_di_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_ix_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_aw_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_a(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_al_i(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_a(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_movea_16_i(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_a(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_movea_32_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frc_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frc_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frc_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frc_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frc_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frc_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frc_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frc_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_toc_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_toc_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_toc_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_toc_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_toc_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_toc_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_toc_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_toc_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_toc_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_toc_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_toc_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frs_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frs_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frs_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frs_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frs_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frs_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frs_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_frs_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_tos_d(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_tos_ai(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_tos_pi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_tos_pd(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_tos_di(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_tos_ix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_tos_aw(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_tos_al(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_tos_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_tos_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_move_16_tos_i(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_fru(m68000_base_device* mc68kcpu); -static void m68k_op_move_32_tou(m68000_base_device* mc68kcpu); -static void m68k_op_movec_32_cr(m68000_base_device* mc68kcpu); -static void m68k_op_movec_32_rc(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_movem_16_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_movem_32_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_movep_16_re(m68000_base_device* mc68kcpu); -static void m68k_op_movep_32_re(m68000_base_device* mc68kcpu); -static void m68k_op_movep_16_er(m68000_base_device* mc68kcpu); -static void m68k_op_movep_32_er(m68000_base_device* mc68kcpu); -static void m68k_op_moves_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_moves_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_moves_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_moves_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_moves_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_moves_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_moves_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_moves_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_moves_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_moves_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_moves_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_moves_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_moves_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_moves_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_moves_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_moves_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_moves_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_moves_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_moves_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_moves_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_moves_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_moves_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_moves_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_moveq_32(m68000_base_device* mc68kcpu); -static void m68k_op_move16_32(m68000_base_device* mc68kcpu); -static void m68k_op_muls_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_muls_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_muls_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_muls_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_muls_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_muls_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_muls_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_muls_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_muls_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_muls_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_muls_16_i(m68000_base_device* mc68kcpu); -static void m68k_op_mulu_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_mulu_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_mulu_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_mulu_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_mulu_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_mulu_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_mulu_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_mulu_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_mulu_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_mulu_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_mulu_16_i(m68000_base_device* mc68kcpu); -static void m68k_op_mull_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_mull_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_mull_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_mull_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_mull_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_mull_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_mull_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_mull_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_mull_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_mull_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_mull_32_i(m68000_base_device* mc68kcpu); -static void m68k_op_nbcd_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_nbcd_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_nbcd_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_nbcd_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_nbcd_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_nbcd_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_nbcd_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_nbcd_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_nbcd_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_nbcd_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_neg_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_neg_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_neg_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_neg_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_neg_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_neg_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_neg_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_neg_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_neg_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_neg_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_neg_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_neg_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_neg_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_neg_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_neg_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_neg_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_neg_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_neg_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_neg_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_neg_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_neg_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_neg_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_neg_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_neg_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_neg_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_neg_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_negx_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_negx_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_negx_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_negx_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_negx_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_negx_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_negx_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_negx_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_negx_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_negx_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_negx_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_negx_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_negx_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_negx_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_negx_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_negx_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_negx_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_negx_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_negx_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_negx_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_negx_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_negx_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_negx_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_negx_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_negx_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_negx_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_nop(m68000_base_device* mc68kcpu); -static void m68k_op_not_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_not_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_not_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_not_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_not_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_not_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_not_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_not_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_not_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_not_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_not_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_not_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_not_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_not_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_not_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_not_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_not_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_not_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_not_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_not_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_not_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_not_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_not_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_not_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_not_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_not_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_re_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_re_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_or_8_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_or_16_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_or_32_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_ori_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_ori_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_ori_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_ori_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_ori_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_ori_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_ori_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_ori_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_ori_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_ori_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_ori_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_ori_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_ori_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_ori_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_ori_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_ori_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_ori_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_ori_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_ori_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_ori_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_ori_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_ori_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_ori_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_ori_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_ori_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_ori_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_ori_16_toc(m68000_base_device* mc68kcpu); -static void m68k_op_ori_16_tos(m68000_base_device* mc68kcpu); -static void m68k_op_pack_16_rr(m68000_base_device* mc68kcpu); -static void m68k_op_pack_16_mm_ax7(m68000_base_device* mc68kcpu); -static void m68k_op_pack_16_mm_ay7(m68000_base_device* mc68kcpu); -static void m68k_op_pack_16_mm_axy7(m68000_base_device* mc68kcpu); -static void m68k_op_pack_16_mm(m68000_base_device* mc68kcpu); -static void m68k_op_pea_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_pea_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_pea_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_pea_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_pea_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_pea_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_pea_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_pflusha_32(m68000_base_device* mc68kcpu); -static void m68k_op_pflushan_32(m68000_base_device* mc68kcpu); -static void m68k_op_pmmu_32(m68000_base_device* mc68kcpu); -static void m68k_op_ptest_32(m68000_base_device* mc68kcpu); -static void m68k_op_reset(m68000_base_device* mc68kcpu); -static void m68k_op_ror_8_s(m68000_base_device* mc68kcpu); -static void m68k_op_ror_16_s(m68000_base_device* mc68kcpu); -static void m68k_op_ror_32_s(m68000_base_device* mc68kcpu); -static void m68k_op_ror_8_r(m68000_base_device* mc68kcpu); -static void m68k_op_ror_16_r(m68000_base_device* mc68kcpu); -static void m68k_op_ror_32_r(m68000_base_device* mc68kcpu); -static void m68k_op_ror_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_ror_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_ror_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_ror_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_ror_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_ror_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_ror_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_rol_8_s(m68000_base_device* mc68kcpu); -static void m68k_op_rol_16_s(m68000_base_device* mc68kcpu); -static void m68k_op_rol_32_s(m68000_base_device* mc68kcpu); -static void m68k_op_rol_8_r(m68000_base_device* mc68kcpu); -static void m68k_op_rol_16_r(m68000_base_device* mc68kcpu); -static void m68k_op_rol_32_r(m68000_base_device* mc68kcpu); -static void m68k_op_rol_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_rol_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_rol_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_rol_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_rol_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_rol_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_rol_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_8_s(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_16_s(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_32_s(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_8_r(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_16_r(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_32_r(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_roxr_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_8_s(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_16_s(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_32_s(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_8_r(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_16_r(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_32_r(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_roxl_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_rtd_32(m68000_base_device* mc68kcpu); -static void m68k_op_rte_32(m68000_base_device* mc68kcpu); -static void m68k_op_rtm_32(m68000_base_device* mc68kcpu); -static void m68k_op_rtr_32(m68000_base_device* mc68kcpu); -static void m68k_op_rts_32(m68000_base_device* mc68kcpu); -static void m68k_op_sbcd_8_rr(m68000_base_device* mc68kcpu); -static void m68k_op_sbcd_8_mm_ax7(m68000_base_device* mc68kcpu); -static void m68k_op_sbcd_8_mm_ay7(m68000_base_device* mc68kcpu); -static void m68k_op_sbcd_8_mm_axy7(m68000_base_device* mc68kcpu); -static void m68k_op_sbcd_8_mm(m68000_base_device* mc68kcpu); -static void m68k_op_st_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_st_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_st_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_st_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_st_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_st_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_st_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_st_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_st_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_st_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_sf_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_sf_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sf_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sf_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_sf_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sf_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_sf_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_sf_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sf_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sf_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_shi_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_sls_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_scc_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_scs_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_sne_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_seq_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_svc_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_svs_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_spl_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_smi_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_sge_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_slt_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_sgt_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_sle_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_shi_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_shi_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_shi_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_shi_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_shi_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_shi_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_shi_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_shi_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_shi_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_sls_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sls_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sls_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_sls_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sls_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_sls_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_sls_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sls_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sls_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_scc_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_scc_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_scc_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_scc_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_scc_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_scc_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_scc_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_scc_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_scc_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_scs_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_scs_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_scs_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_scs_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_scs_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_scs_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_scs_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_scs_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_scs_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_sne_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sne_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sne_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_sne_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sne_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_sne_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_sne_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sne_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sne_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_seq_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_seq_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_seq_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_seq_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_seq_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_seq_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_seq_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_seq_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_seq_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_svc_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_svc_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_svc_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_svc_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_svc_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_svc_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_svc_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_svc_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_svc_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_svs_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_svs_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_svs_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_svs_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_svs_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_svs_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_svs_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_svs_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_svs_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_spl_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_spl_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_spl_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_spl_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_spl_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_spl_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_spl_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_spl_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_spl_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_smi_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_smi_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_smi_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_smi_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_smi_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_smi_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_smi_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_smi_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_smi_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_sge_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sge_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sge_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_sge_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sge_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_sge_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_sge_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sge_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sge_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_slt_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_slt_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_slt_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_slt_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_slt_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_slt_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_slt_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_slt_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_slt_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_sgt_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sgt_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sgt_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_sgt_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sgt_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_sgt_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_sgt_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sgt_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sgt_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_sle_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sle_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sle_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_sle_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sle_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_sle_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_sle_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sle_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sle_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_stop(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_a(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_d(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_a(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_di(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_al(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_er_i(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_re_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_re_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sub_8_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sub_16_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_re_ai(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_re_pi(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_re_pd(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_re_di(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_re_ix(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_re_aw(m68000_base_device* mc68kcpu); -static void m68k_op_sub_32_re_al(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_a(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_suba_16_i(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_a(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_suba_32_i(m68000_base_device* mc68kcpu); -static void m68k_op_subi_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_subi_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_subi_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_subi_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_subi_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_subi_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_subi_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_subi_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_subi_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_subi_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_subi_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_subi_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_subi_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_subi_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_subi_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_subi_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_subi_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_subi_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_subi_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_subi_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_subi_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_subi_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_subi_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_subi_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_subi_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_subi_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_subq_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_subq_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_subq_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_subq_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_subq_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_subq_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_subq_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_subq_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_subq_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_subq_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_subq_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_subq_16_a(m68000_base_device* mc68kcpu); -static void m68k_op_subq_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_subq_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_subq_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_subq_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_subq_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_subq_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_subq_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_subq_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_subq_32_a(m68000_base_device* mc68kcpu); -static void m68k_op_subq_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_subq_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_subq_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_subq_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_subq_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_subq_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_subq_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_subx_8_rr(m68000_base_device* mc68kcpu); -static void m68k_op_subx_16_rr(m68000_base_device* mc68kcpu); -static void m68k_op_subx_32_rr(m68000_base_device* mc68kcpu); -static void m68k_op_subx_8_mm_ax7(m68000_base_device* mc68kcpu); -static void m68k_op_subx_8_mm_ay7(m68000_base_device* mc68kcpu); -static void m68k_op_subx_8_mm_axy7(m68000_base_device* mc68kcpu); -static void m68k_op_subx_8_mm(m68000_base_device* mc68kcpu); -static void m68k_op_subx_16_mm(m68000_base_device* mc68kcpu); -static void m68k_op_subx_32_mm(m68000_base_device* mc68kcpu); -static void m68k_op_swap_32(m68000_base_device* mc68kcpu); -static void m68k_op_tas_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_tas_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_tas_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_tas_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_tas_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_tas_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_tas_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_tas_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_tas_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_tas_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_trap(m68000_base_device* mc68kcpu); -static void m68k_op_trapt(m68000_base_device* mc68kcpu); -static void m68k_op_trapt_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapt_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapf(m68000_base_device* mc68kcpu); -static void m68k_op_trapf_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapf_32(m68000_base_device* mc68kcpu); -static void m68k_op_traphi(m68000_base_device* mc68kcpu); -static void m68k_op_trapls(m68000_base_device* mc68kcpu); -static void m68k_op_trapcc(m68000_base_device* mc68kcpu); -static void m68k_op_trapcs(m68000_base_device* mc68kcpu); -static void m68k_op_trapne(m68000_base_device* mc68kcpu); -static void m68k_op_trapeq(m68000_base_device* mc68kcpu); -static void m68k_op_trapvc(m68000_base_device* mc68kcpu); -static void m68k_op_trapvs(m68000_base_device* mc68kcpu); -static void m68k_op_trappl(m68000_base_device* mc68kcpu); -static void m68k_op_trapmi(m68000_base_device* mc68kcpu); -static void m68k_op_trapge(m68000_base_device* mc68kcpu); -static void m68k_op_traplt(m68000_base_device* mc68kcpu); -static void m68k_op_trapgt(m68000_base_device* mc68kcpu); -static void m68k_op_traple(m68000_base_device* mc68kcpu); -static void m68k_op_traphi_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapls_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapcc_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapcs_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapne_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapeq_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapvc_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapvs_16(m68000_base_device* mc68kcpu); -static void m68k_op_trappl_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapmi_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapge_16(m68000_base_device* mc68kcpu); -static void m68k_op_traplt_16(m68000_base_device* mc68kcpu); -static void m68k_op_trapgt_16(m68000_base_device* mc68kcpu); -static void m68k_op_traple_16(m68000_base_device* mc68kcpu); -static void m68k_op_traphi_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapls_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapcc_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapcs_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapne_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapeq_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapvc_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapvs_32(m68000_base_device* mc68kcpu); -static void m68k_op_trappl_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapmi_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapge_32(m68000_base_device* mc68kcpu); -static void m68k_op_traplt_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapgt_32(m68000_base_device* mc68kcpu); -static void m68k_op_traple_32(m68000_base_device* mc68kcpu); -static void m68k_op_trapv(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_d(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_ai(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_pi(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_pi7(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_pd(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_pd7(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_di(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_ix(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_aw(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_al(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_tst_8_i(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_d(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_a(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_ai(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_pi(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_pd(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_di(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_ix(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_aw(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_al(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_tst_16_i(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_d(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_a(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_ai(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_pi(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_pd(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_di(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_ix(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_aw(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_al(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_pcdi(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_pcix(m68000_base_device* mc68kcpu); -static void m68k_op_tst_32_i(m68000_base_device* mc68kcpu); -static void m68k_op_unlk_32_a7(m68000_base_device* mc68kcpu); -static void m68k_op_unlk_32(m68000_base_device* mc68kcpu); -static void m68k_op_unpk_16_rr(m68000_base_device* mc68kcpu); -static void m68k_op_unpk_16_mm_ax7(m68000_base_device* mc68kcpu); -static void m68k_op_unpk_16_mm_ay7(m68000_base_device* mc68kcpu); -static void m68k_op_unpk_16_mm_axy7(m68000_base_device* mc68kcpu); -static void m68k_op_unpk_16_mm(m68000_base_device* mc68kcpu); -static void m68k_op_cinv_32(m68000_base_device* mc68kcpu); -static void m68k_op_cpush_32(m68000_base_device* mc68kcpu); -#else -/* Build the opcode handler table */ -void m68ki_build_opcode_table(void); - -extern void (*m68ki_instruction_jump_table[][0x10000])(m68000_base_device *m68k); /* opcode handler jump table */ -extern unsigned char m68ki_cycles[][0x10000]; - - -/* ======================================================================== */ -/* ============================== END OF FILE ============================= */ -/* ======================================================================== */ - - -#endif -- cgit v1.2.3-70-g09d2 From 3f2add802dd33bb61a4634bba61191823e0d41c5 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 27 Jan 2016 15:34:31 +0100 Subject: Updated makefile to generate m68k files (nw) --- .gitignore | 4 ++++ makefile | 6 +++++- src/devices/cpu/m68000/makefile | 12 ++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index a9154ad4011..1e1afa52def 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,7 @@ regtests/chdman/temp regtests/jedutil/output *.pyc /CMakeLists.txt +/src/devices/cpu/m68000/m68kops.cpp +/src/devices/cpu/m68000/m68kops.h +/src/devices/cpu/m68000/m68kmake.* +!/src/devices/cpu/m68000/m68kmake.cpp \ No newline at end of file diff --git a/makefile b/makefile index 7818353125d..5086356729e 100644 --- a/makefile +++ b/makefile @@ -1233,6 +1233,7 @@ clean: @echo Cleaning... -@rm -rf $(BUILDDIR) $(SILENT) $(MAKE) $(MAKEPARAMS) -C 3rdparty/genie/build/gmake.$(GENIEOS) -f genie.make clean + $(SILENT) $(MAKE) -C $(SRC)/devices/cpu/m68000 clean GEN_FOLDERS := $(GENDIR)/$(TARGET)/layout/ $(GENDIR)/$(TARGET)/$(SUBTARGET)/ @@ -1252,12 +1253,15 @@ $(GEN_FOLDERS): generate: \ $(GENIE) \ $(GEN_FOLDERS) \ - $(patsubst $(SRC)/%.lay,$(GENDIR)/%.lh,$(LAYOUTS)) + $(patsubst $(SRC)/%.lay,$(GENDIR)/%.lh,$(LAYOUTS)) \ + $(SRC)/devices/cpu/m68000/m68kops.cpp $(GENDIR)/%.lh: $(SRC)/%.lay scripts/build/file2str.py | $(GEN_FOLDERS) @echo Converting $<... $(SILENT)$(PYTHON) scripts/build/file2str.py $< $@ layout_$(basename $(notdir $<)) +$(SRC)/devices/cpu/m68000/m68kops.cpp: $(SRC)/devices/cpu/m68000/m68k_in.cpp $(SRC)/devices/cpu/m68000/m68kmake.cpp + $(SILENT) $(MAKE) -C $(SRC)/devices/cpu/m68000 #------------------------------------------------- # Regression tests diff --git a/src/devices/cpu/m68000/makefile b/src/devices/cpu/m68000/makefile index 12b29fa267a..e16787e70d6 100644 --- a/src/devices/cpu/m68000/makefile +++ b/src/devices/cpu/m68000/makefile @@ -10,22 +10,22 @@ endif .PHONY: all clean -all : m68kmake$(EXE) m68kops.c clean +all : m68kmake$(EXE) m68kops.cpp clean: @echo Cleaning... -@rm -f m68kmake$(EXE) -@rm -f m68kmake.o + -@rm -f m68kops.* -m68kmake.o: m68kmake.c - @echo $(notdir $<) - @gcc -x c++ -std=gnu++98 -o "$@" -c "$<" +m68kmake.o: m68kmake.cpp + @gcc -x c++ -std=c++11 -o "$@" -c "$<" m68kmake$(EXE) : m68kmake.o @echo Linking $@... @g++ -lstdc++ $^ -o $@ -m68kops.c: m68kmake$(EXE) m68k_in.c +m68kops.cpp: m68kmake$(EXE) m68k_in.cpp @echo Generating M68K source files... - @m68kmake$(EXE) . m68k_in.c + @m68kmake$(EXE) . m68k_in.cpp -- cgit v1.2.3-70-g09d2 From a1629ac21b51b7c7f1a37113942178372c6aec32 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 27 Jan 2016 16:31:54 +0100 Subject: fix to work on osx and linux as well (nw) --- src/devices/cpu/m68000/makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/cpu/m68000/makefile b/src/devices/cpu/m68000/makefile index e16787e70d6..fbf49c6ce0e 100644 --- a/src/devices/cpu/m68000/makefile +++ b/src/devices/cpu/m68000/makefile @@ -27,5 +27,5 @@ m68kmake$(EXE) : m68kmake.o m68kops.cpp: m68kmake$(EXE) m68k_in.cpp @echo Generating M68K source files... - @m68kmake$(EXE) . m68k_in.cpp + @./m68kmake$(EXE) . m68k_in.cpp -- cgit v1.2.3-70-g09d2 From 8cbabcd9ad143e210169493a8aa9d276322586c4 Mon Sep 17 00:00:00 2001 From: hap Date: Wed, 27 Jan 2016 16:53:04 +0100 Subject: fidel6502: added SC12 cartridge handling --- hash/fidel_scc.xml | 20 ++++++++++++++++ src/mame/drivers/fidel6502.cpp | 54 ++++++++++++++++++++++++++++++++++++++---- src/mame/drivers/fidelz80.cpp | 40 ++++++++++++++++++++++++------- src/mame/drivers/hh_tms1k.cpp | 5 ++++ 4 files changed, 106 insertions(+), 13 deletions(-) create mode 100644 hash/fidel_scc.xml diff --git a/hash/fidel_scc.xml b/hash/fidel_scc.xml new file mode 100644 index 00000000000..d6afe1e7d07 --- /dev/null +++ b/hash/fidel_scc.xml @@ -0,0 +1,20 @@ + + + + + + + + + Challenger Book Openings 2 + 1982 + Fidelity Electronics + + + + + + + + + diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 2a17baa6590..8ccf47506a9 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -16,6 +16,9 @@ #include "cpu/m6502/m65sc02.h" #include "machine/6821pia.h" #include "sound/speaker.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "softlist.h" #include "includes/fidelz80.h" @@ -32,12 +35,14 @@ public: fidel6502_state(const machine_config &mconfig, device_type type, const char *tag) : fidelz80base_state(mconfig, type, tag), m_6821pia(*this, "6821pia"), + m_cart(*this, "cartslot"), m_speaker(*this, "speaker"), m_irq_off(*this, "irq_off") { } // devices/pointers optional_device m_6821pia; + optional_device m_cart; optional_device m_speaker; optional_device m_irq_off; @@ -57,6 +62,8 @@ public: DECLARE_READ_LINE_MEMBER(csc_pia1_cb1_r); // model SC12 + DECLARE_MACHINE_START(sc12); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(scc_cartridge); TIMER_DEVICE_CALLBACK_MEMBER(irq_off); TIMER_DEVICE_CALLBACK_MEMBER(sc12_irq); DECLARE_WRITE8_MEMBER(sc12_control_w); @@ -203,6 +210,34 @@ WRITE_LINE_MEMBER(fidel6502_state::csc_pia1_ca2_w) SC12 ******************************************************************************/ +// cartridge + +DEVICE_IMAGE_LOAD_MEMBER(fidel6502_state, scc_cartridge) +{ + UINT32 size = m_cart->common_get_size("rom"); + + // max size is 16KB + if (size > 0x4000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +MACHINE_START_MEMBER(fidel6502_state, sc12) +{ + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + + fidelz80base_state::machine_start(); +} + + // interrupt handling TIMER_DEVICE_CALLBACK_MEMBER(fidel6502_state::irq_off) @@ -331,7 +366,7 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) // level + PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) PORT_START("IN.4") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) @@ -384,8 +419,8 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bishop") PORT_CODE(KEYCODE_4) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Queen") PORT_CODE(KEYCODE_5) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) // clear - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) // reset + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_UNUSED INPUT_PORTS_END @@ -477,8 +512,8 @@ static INPUT_PORTS_START( sc12 ) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV / Rook") PORT_CODE(KEYCODE_4) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PV / Queen") PORT_CODE(KEYCODE_5) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PB / King") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) // clear - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) // reset + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) INPUT_PORTS_END @@ -533,10 +568,19 @@ static MACHINE_CONFIG_START( sc12, fidel6502_state ) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_sc12) + MCFG_MACHINE_START_OVERRIDE(fidel6502_state, sc12) + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fidel_scc") + MCFG_GENERIC_EXTENSIONS("bin,dat") + MCFG_GENERIC_LOAD(fidel6502_state, scc_cartridge) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_scc") MACHINE_CONFIG_END static MACHINE_CONFIG_START( fev, fidel6502_state ) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 6e3e5cb725e..8c5c3fdbf5d 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -3,18 +3,41 @@ /****************************************************************************** Fidelity Electronics Z80 based board driver - for 6502 based boards, see drivers/fidel6502.cpp - - Detailed RE work done by Kevin 'kevtris' Horton, except where noted + for 6502 based boards, see drivers/fidel6502.cpp (documentation is in this driver) TODO: - Figure out why it says the first speech line twice; it shouldn't? It sometimes does this on Voice Sensory Chess Challenger real hardware. It can also be heard on Advanced Voice Chess Challenger real hardware, but not the whole line: "I I am Fidelity's chess challenger", instead. - - Get rom locations from pcb (done for UVC, VCC is probably similar) - correctly hook up VBRC speech so that the z80 is halted while words are being spoken + Read the official manual(s) on how to play. + + Keypad legend: + - RE: Reset + - CL: Clear + - EN: Enter + - PB: Problem Mode + - PV: Position Verification + - LV: Playing Levels + - TB: Take Back + - DM: Display Move/Double Move + - RV: Reverse + + Peripherals, compatible with various boards: + - Fidelity Challenger Printer - thermal printer, MCU=? + + Program/data cartridges, for various boards, some cross-compatible: + - CG6: Greatest Chess Games 1 + - CAC: Challenger Advanced Chess - 8KB 101-1038A01 + - CB9: Challenger Book Openings 1 - 8KB? + - CB16: Challenger Book Openings 2 - 8+8KB 101-1042A01,02 + - others are alt. titles of these? + + Board hardware descriptions below. + Detailed RE work done by Kevin 'kevtris' Horton, except where noted + *********************************************************************** Voice Chess Challenger (VCC) (version A and B?) @@ -305,7 +328,7 @@ A detailed description of the hardware can be found also in the patent 4,373,719 ****************************************************************************** -Champion Sensory Chess Challenger (CSC) (6502 based -> fidel6502.cpp driver) +Champion Sensory Chess Challenger (CSC) --------------------------------------- Memory map: @@ -594,10 +617,11 @@ expect that the software reads these once on startup only. ****************************************************************************** -Sensory Chess Challenger (SC12-B) (6502 based -> fidel6502.cpp driver) +Sensory Chess Challenger (SC12-B) +4 versions are known to exist: A,B,C, and X, with increasing CPU speed. --------------------------------- -RE information by Berger +RE information from netlist by Berger 8*(8+1) buttons, 8+8+2 red LEDs DIN 41524C printer port @@ -637,7 +661,7 @@ If control Q4 is set, printer data can be read from I0. ****************************************************************************** -Voice Excellence (FEV, model 6092) (6502 based -> fidel6502.cpp driver) +Voice Excellence (FEV, model 6092) ---------------------------------- PCB 1: 510.1117A02, appears to be identical to other "Excellence" boards diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 9670ab8be9f..d87600f8326 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -14,15 +14,19 @@ @CP0904A TMS0970 1977, Milton Bradley Comp IV @MP0905B TMS0970 1977, Parker Brothers Codename Sector *MP0057 TMS1000 1978, APH Student Speech+ (same ROM contents as TSI Speech+?) + *MP0158 TMS1000 1979, Entex Soccer *MP0168 TMS1000? 1979, Conic Basketball + *MP0170 TMS1000? 1979, E.R.S. Football @MP0914 TMS1000 1979, Entex Baseball 1 @MP0923 TMS1000 1979, Entex Baseball 2 @MP1030 TMS1100 1980, APF Mathemagician @MP1133 TMS1470 1979, Kosmos Astro @MP1180 TMS1100 1980, Tomy Power House Pinball + *MP1181 TMS1100 1979, Conic Football 2 @MP1204 TMS1100 1980, Entex Baseball 3 (6007) @MP1211 TMS1100 1980, Entex Space Invader @MP1218 TMS1100 1980, Entex Basketball 2 (6010) + *MP1219 TMS1100 1980, U.S. Games Super Sports 4 @MP1221 TMS1100 1980, Entex Raise The Devil *MP1296 TMS1100? 1982, Entex Black Knight *MP1312 TMS1100 198?, Tandy/RadioShack Science Fair Microcomputer Trainer @@ -59,6 +63,7 @@ MP3496 TMS1100 1980, MicroVision cartridge: Sea Duel M34009 TMS1100 1981, MicroVision cartridge: Alien Raiders (note: MP3498, MP3499, M3400x..) @M34012 TMS1100 1980, Mattel Dungeons & Dragons - Computer Labyrinth Game + *M34014 TMS1100 1981, Coleco Bowlatronic M34017 TMS1100 1981, MicroVision cartridge: Cosmic Hunter M34047 TMS1100 1982, MicroVision cartridge: Super Blockbuster *M34078A TMS1100 1983, Milton Bradley Arcade Mania -- cgit v1.2.3-70-g09d2 From d7d14c0b350469fd9870d28c807c4017a9a08317 Mon Sep 17 00:00:00 2001 From: hap Date: Wed, 27 Jan 2016 19:25:06 +0100 Subject: fidel*: small fix with VSC/CSC sound --- src/mame/drivers/fidel6502.cpp | 21 +++++++++++++++------ src/mame/drivers/fidelz80.cpp | 24 +++++++++--------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 8ccf47506a9..ed4f53cf112 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -45,8 +45,9 @@ public: optional_device m_cart; optional_device m_speaker; optional_device m_irq_off; - + // model CSC + void csc_update_7442(); void csc_prepare_display(); DECLARE_READ8_MEMBER(csc_speech_r); DECLARE_WRITE8_MEMBER(csc_pia0_pa_w); @@ -80,10 +81,18 @@ public: // misc handlers +void fidel6502_state::csc_update_7442() +{ + // 7442 0-8: led select, input mux + m_inp_mux = 1 << m_led_select & 0x3ff; + + // 7442 9: buzzer speaker out + m_speaker->level_w(m_inp_mux >> 9 & 1); +} + void fidel6502_state::csc_prepare_display() { - // 7442 output, also update input mux (9 is unused) - m_inp_mux = (1 << m_led_select) & 0x1ff; + csc_update_7442(); // 4 7seg leds + H for (int i = 0; i < 4; i++) @@ -126,9 +135,9 @@ WRITE8_MEMBER(fidel6502_state::csc_pia0_pb_w) // d1: TSI START line m_speech->start_w(data >> 1 & 1); - - // d4: tone line - m_speaker->level_w(data >> 4 & 1); + + // d4: lower TSI volume + m_speech->set_output_gain(0, (data & 0x10) ? 0.5 : 1.0); } READ8_MEMBER(fidel6502_state::csc_pia0_pb_r) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 8c5c3fdbf5d..7af61a91577 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -366,10 +366,10 @@ PA6 - 7seg segments B PA7 - 7seg segments A PB0 - A12 on speech ROM (if used... not used on this model, ROM is 4K) -PB1 - START line on S14001A +PB1 - START line on TSI PB2 - white wire -PB3 - BUSY line from S14001A -PB4 - Tone line (toggle to make a tone in the speaker) +PB3 - BUSY line from TSI +PB4 - hi/lo TSI speaker volume PB5 - button row 9 PB6 - selection jumper (resistor to 5V) PB7 - selection jumper (resistor to ground) @@ -422,7 +422,7 @@ output # (selected turns this column on, and all others off) 6 - LED column G, button column G 7 - LED column H, button column H 8 - button column I -9 - +9 - Tone line (toggle to make a tone in the buzzer) The rows/columns are indicated on the game board: @@ -593,7 +593,7 @@ PA.7 - button row 8 PB.0 - button column I PB.1 - button column J -PB.2 - Tone line (toggle to make tone in the speaker) +PB.2 - hi/lo TSI speaker volume PB.3 - violet wire PB.4 - white wire (and TSI BUSY line) PB.5 - selection jumper input (see below) @@ -703,7 +703,6 @@ ROM A11 is however tied to the CPU's XYZ #include "machine/i8255.h" #include "machine/i8243.h" #include "machine/z80pio.h" -#include "sound/speaker.h" #include "sound/beep.h" #include "includes/fidelz80.h" @@ -724,7 +723,6 @@ public: m_z80pio(*this, "z80pio"), m_ppi8255(*this, "ppi8255"), m_i8243(*this, "i8243"), - m_speaker(*this, "speaker"), m_beeper_off(*this, "beeper_off"), m_beeper(*this, "beeper") { } @@ -734,7 +732,6 @@ public: optional_device m_z80pio; optional_device m_ppi8255; optional_device m_i8243; - optional_device m_speaker; optional_device m_beeper_off; optional_device m_beeper; @@ -1102,11 +1099,11 @@ WRITE8_MEMBER(fidelz80_state::vsc_pio_portb_w) // d0,d1: input mux highest bits m_inp_mux = (m_inp_mux & 0xff) | (data << 8 & 0x300); - // d2: tone line - m_speaker->level_w(data >> 2 & 1); - // d6: TSI START line m_speech->start_w(data >> 6 & 1); + + // d2: lower TSI volume + m_speech->set_output_gain(0, (data & 4) ? 0.5 : 1.0); } @@ -1274,7 +1271,7 @@ static INPUT_PORTS_START( fidelz80 ) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_E) PORT_START("IN.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CB") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_B) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_F) @@ -1541,9 +1538,6 @@ static MACHINE_CONFIG_START( vsc, fidelz80_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("speech", S14001A, 25000) // R/C circuit, around 25khz MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END static MACHINE_CONFIG_START( vbrc, fidelz80_state ) -- cgit v1.2.3-70-g09d2 From c193eba5db538e05098bfd6283c271669f16443f Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 27 Jan 2016 19:05:52 -0300 Subject: Pyon Pyon Jump: Create derivative machine driver. [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 64 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index a9354ecea56..657ed41977a 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -363,6 +363,16 @@ static ADDRESS_MAP_START( kurukuru_io, AS_IO, 8, kurukuru_state ) AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_DEVWRITE("ym2149", ay8910_device, data_w) ADDRESS_MAP_END +static ADDRESS_MAP_START( ppj_map, AS_PROGRAM, 8, kurukuru_state ) + AM_RANGE(0x0000, 0x5fff) AM_ROM + AM_RANGE(0x6000, 0xdfff) AM_ROMBANK("bank1") + AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE("nvram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ppj_io, AS_IO, 8, kurukuru_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + // Audio CPU @@ -401,12 +411,12 @@ READ8_MEMBER(kurukuru_state::kurukuru_adpcm_timer_irqack_r) } -static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, kurukuru_state ) +static ADDRESS_MAP_START( kurukuru_audio_map, AS_PROGRAM, 8, kurukuru_state ) AM_RANGE(0x0000, 0xf7ff) AM_ROM AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END -static ADDRESS_MAP_START( audio_io, AS_IO, 8, kurukuru_state ) +static ADDRESS_MAP_START( kurukuru_audio_io, AS_IO, 8, kurukuru_state ) ADDRESS_MAP_GLOBAL_MASK(0x7f) AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_WRITE(kurukuru_adpcm_data_w) AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_WRITE(kurukuru_adpcm_reset_w) @@ -414,6 +424,15 @@ static ADDRESS_MAP_START( audio_io, AS_IO, 8, kurukuru_state ) AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) AM_READ(kurukuru_adpcm_timer_irqack_r) ADDRESS_MAP_END +static ADDRESS_MAP_START( ppj_audio_map, AS_PROGRAM, 8, kurukuru_state ) + AM_RANGE(0x0000, 0xf7ff) AM_ROM + AM_RANGE(0xf800, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ppj_audio_io, AS_IO, 8, kurukuru_state ) + ADDRESS_MAP_GLOBAL_MASK(0x7f) +ADDRESS_MAP_END + /* YM2149 ports */ WRITE8_MEMBER(kurukuru_state::ym2149_aout_w) @@ -537,8 +556,43 @@ static MACHINE_CONFIG_START( kurukuru, kurukuru_state ) MCFG_CPU_IO_MAP(kurukuru_io) MCFG_CPU_ADD("audiocpu", Z80, CPU_CLOCK) - MCFG_CPU_PROGRAM_MAP(audio_map) - MCFG_CPU_IO_MAP(audio_io) + MCFG_CPU_PROGRAM_MAP(kurukuru_audio_map) + MCFG_CPU_IO_MAP(kurukuru_audio_io) + + MCFG_NVRAM_ADD_0FILL("nvram") + + /* video hardware */ + MCFG_V9938_ADD("v9938", "screen", VDP_MEM, MAIN_CLOCK) + MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(kurukuru_state,kurukuru_vdp_interrupt)) + MCFG_V99X8_SCREEN_ADD_NTSC("screen", "v9938", MAIN_CLOCK) + + MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(HOPPER_PULSE), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ym2149", YM2149, YM2149_CLOCK) + MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW2")) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(kurukuru_state, ym2149_aout_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(kurukuru_state, ym2149_bout_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + + MCFG_SOUND_ADD("adpcm", MSM5205, M5205_CLOCK) + MCFG_MSM5205_VCLK_CB(WRITELINE(kurukuru_state, kurukuru_msm5205_vck)) + MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S48_4B) /* changed on the fly */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( ppj, kurukuru_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, CPU_CLOCK) + MCFG_CPU_PROGRAM_MAP(ppj_map) + MCFG_CPU_IO_MAP(ppj_io) + + MCFG_CPU_ADD("audiocpu", Z80, CPU_CLOCK) + MCFG_CPU_PROGRAM_MAP(ppj_audio_map) + MCFG_CPU_IO_MAP(ppj_audio_io) MCFG_NVRAM_ADD_0FILL("nvram") @@ -613,4 +667,4 @@ ROM_END /* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS */ GAME( 199?, kurukuru, 0, kurukuru, kurukuru, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Kuru Kuru Pyon Pyon (Japan)", 0 ) -GAME( 199?, ppj, 0, kurukuru, kurukuru, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jump (Japan)", MACHINE_NOT_WORKING ) +GAME( 199?, ppj, 0, ppj, kurukuru, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jump (Japan)", MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From 53d2810cb1eb2d1f41cc2afef4798d967c3d8fb2 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 27 Jan 2016 19:12:25 -0300 Subject: Pyon Pyon Jump: Hooked the V9938 Yamaha VDP. [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index 657ed41977a..547062d0a24 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -370,6 +370,7 @@ static ADDRESS_MAP_START( ppj_map, AS_PROGRAM, 8, kurukuru_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( ppj_io, AS_IO, 8, kurukuru_state ) + AM_RANGE(0x10, 0x13) AM_MIRROR(0x0c) AM_DEVREADWRITE( "v9938", v9938_device, read, write ) ADDRESS_MAP_GLOBAL_MASK(0xff) ADDRESS_MAP_END -- cgit v1.2.3-70-g09d2 From ed724353ec054bee309cdaacc583b33a652d5554 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 27 Jan 2016 19:16:40 -0300 Subject: Pyon Pyon Jump: Added the DIP switches bank #1. [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index 547062d0a24..f73df11e1e6 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -371,6 +371,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ppj_io, AS_IO, 8, kurukuru_state ) AM_RANGE(0x10, 0x13) AM_MIRROR(0x0c) AM_DEVREADWRITE( "v9938", v9938_device, read, write ) + AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_READ_PORT("DSW1") ADDRESS_MAP_GLOBAL_MASK(0xff) ADDRESS_MAP_END -- cgit v1.2.3-70-g09d2 From 341d4d8a8cbb3af7684f95975cc9da5da906d372 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 27 Jan 2016 19:22:13 -0300 Subject: Pyon Pyon Jump: Hooked the system input ports. [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index f73df11e1e6..965e08e016c 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -372,6 +372,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ppj_io, AS_IO, 8, kurukuru_state ) AM_RANGE(0x10, 0x13) AM_MIRROR(0x0c) AM_DEVREADWRITE( "v9938", v9938_device, read, write ) AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_READ_PORT("DSW1") + AM_RANGE(0x60, 0x60) AM_MIRROR(0x0f) AM_READ_PORT("IN1") + AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) AM_READ_PORT("IN0") ADDRESS_MAP_GLOBAL_MASK(0xff) ADDRESS_MAP_END -- cgit v1.2.3-70-g09d2 From 50808583fa7aa98cb5d7cc7425a33900c8eb1310 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 27 Jan 2016 19:28:16 -0300 Subject: Pyon Pyon Jump: Added support for Yamaha YM2149. [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index 965e08e016c..5526a9ad7d7 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -374,6 +374,8 @@ static ADDRESS_MAP_START( ppj_io, AS_IO, 8, kurukuru_state ) AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_READ_PORT("DSW1") AM_RANGE(0x60, 0x60) AM_MIRROR(0x0f) AM_READ_PORT("IN1") AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) AM_READ_PORT("IN0") + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVWRITE("ym2149", ay8910_device, address_w) + AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_DEVWRITE("ym2149", ay8910_device, data_w) ADDRESS_MAP_GLOBAL_MASK(0xff) ADDRESS_MAP_END -- cgit v1.2.3-70-g09d2 From 0bce13f84bb156ab55fe5c901f883fca032ffb91 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 27 Jan 2016 19:32:01 -0300 Subject: Pyon Pyon Jump: Decoupled the YM2149 data read. [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index 5526a9ad7d7..01fbce9edd9 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -375,6 +375,7 @@ static ADDRESS_MAP_START( ppj_io, AS_IO, 8, kurukuru_state ) AM_RANGE(0x60, 0x60) AM_MIRROR(0x0f) AM_READ_PORT("IN1") AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) AM_READ_PORT("IN0") AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVWRITE("ym2149", ay8910_device, address_w) + AM_RANGE(0xc8, 0xc8) AM_MIRROR(0x0f) AM_DEVREAD("ym2149", ay8910_device, data_r) AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_DEVWRITE("ym2149", ay8910_device, data_w) ADDRESS_MAP_GLOBAL_MASK(0xff) ADDRESS_MAP_END -- cgit v1.2.3-70-g09d2 From c9feaa71e86610add7c4499d283ea3a1cb3bcdae Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 27 Jan 2016 20:05:43 -0300 Subject: Pyon Pyon Jump: Correct bankswitching. [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index 01fbce9edd9..39e80fca9ed 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -370,6 +370,7 @@ static ADDRESS_MAP_START( ppj_map, AS_PROGRAM, 8, kurukuru_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( ppj_io, AS_IO, 8, kurukuru_state ) + AM_RANGE(0x00, 0x00) AM_MIRROR(0x0f) AM_WRITE(kurukuru_bankswitch_w) AM_RANGE(0x10, 0x13) AM_MIRROR(0x0c) AM_DEVREADWRITE( "v9938", v9938_device, read, write ) AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_READ_PORT("DSW1") AM_RANGE(0x60, 0x60) AM_MIRROR(0x0f) AM_READ_PORT("IN1") -- cgit v1.2.3-70-g09d2 From 312dfd514bbe2c6c02ae4d657d8d79a3546d7c4a Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 27 Jan 2016 20:11:55 -0300 Subject: Pyon Pyon Jump: Added sound latch & output port. [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index 39e80fca9ed..4385c35a7ea 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -370,17 +370,37 @@ static ADDRESS_MAP_START( ppj_map, AS_PROGRAM, 8, kurukuru_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( ppj_io, AS_IO, 8, kurukuru_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_MIRROR(0x0f) AM_WRITE(kurukuru_bankswitch_w) AM_RANGE(0x10, 0x13) AM_MIRROR(0x0c) AM_DEVREADWRITE( "v9938", v9938_device, read, write ) + AM_RANGE(0x30, 0x30) AM_MIRROR(0x0f) AM_WRITE(kurukuru_soundlatch_w) AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_READ_PORT("DSW1") + AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_WRITE(kurukuru_out_latch_w) AM_RANGE(0x60, 0x60) AM_MIRROR(0x0f) AM_READ_PORT("IN1") AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) AM_READ_PORT("IN0") AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVWRITE("ym2149", ay8910_device, address_w) AM_RANGE(0xc8, 0xc8) AM_MIRROR(0x0f) AM_DEVREAD("ym2149", ay8910_device, data_r) AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_DEVWRITE("ym2149", ay8910_device, data_w) - ADDRESS_MAP_GLOBAL_MASK(0xff) ADDRESS_MAP_END +/* + + 00h W --> bankswitching reg... + + 10h W --> 00's \ + 11h W --> 02 8f 20 91... > V9938 OK + 13h W --> / + 30h W --> soundlatch... + 40h R --> (very begining) seems DSW1 + 50h W --> Output port (counters) + 60h R --> Input port + 70h R --> Input port + + C0h W --> YM2149 address W + C8h R --> YM2149 data R --> DSW2 + D0h W --> YM2149 data W + +*/ // Audio CPU -- cgit v1.2.3-70-g09d2 From 12ce574a3edec530da8fcfa882251affc912afd1 Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 28 Jan 2016 00:37:02 +0100 Subject: fidelz80: added UVC german/french/spanish --- src/mame/drivers/fidelz80.cpp | 134 +++++++++++++++++++++++++++++++++--------- src/mame/mess.lst | 3 + 2 files changed, 109 insertions(+), 28 deletions(-) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 7af61a91577..5f85a1e49a4 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -1263,7 +1263,7 @@ ADDRESS_MAP_END Input Ports ******************************************************************************/ -static INPUT_PORTS_START( fidelz80 ) +static INPUT_PORTS_START( vcc_base ) PORT_START("IN.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) @@ -1288,23 +1288,68 @@ static INPUT_PORTS_START( fidelz80 ) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_D) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_H) - PORT_START("IN.4") // TODO: hardcode this - PORT_CONFNAME( 0x0f, 0x00, "Language" ) - PORT_CONFSETTING( 0x00, "English" ) - PORT_CONFSETTING( 0x01, "French" ) - PORT_CONFSETTING( 0x02, "Spanish" ) - PORT_CONFSETTING( 0x04, "German" ) - PORT_CONFSETTING( 0x08, "Special" ) - PORT_START("RESET") // is not on matrix IN.0 d0 PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, fidelz80_state, reset_button, 0) +INPUT_PORTS_END + +static INPUT_PORTS_START( cc10 ) + PORT_INCLUDE( vcc_base ) - PORT_START("LEVEL") // cc10 only, TODO: hardcode this - PORT_CONFNAME( 0x80, 0x00, "Number of levels" ) + PORT_START("IN.4") + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LEVEL") // factory setting + PORT_CONFNAME( 0x80, 0x00, "PPI.B.7: Maximum Levels" ) PORT_CONFSETTING( 0x00, "10" ) PORT_CONFSETTING( 0x80, "3" ) INPUT_PORTS_END +static INPUT_PORTS_START( vcc ) + PORT_INCLUDE( vcc_base ) + + PORT_START("IN.4") // not consumer accessible + PORT_CONFNAME( 0x01, 0x00, "PCB Jumper: French" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) + PORT_CONFNAME( 0x02, 0x00, "PCB Jumper: Spanish" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x02, DEF_STR( On ) ) + PORT_CONFNAME( 0x04, 0x00, "PCB Jumper: German" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x04, DEF_STR( On ) ) + PORT_CONFNAME( 0x08, 0x00, "PCB Jumper: Special" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x08, DEF_STR( On ) ) +INPUT_PORTS_END + +static INPUT_PORTS_START( vccfr ) + PORT_INCLUDE( vcc ) + + PORT_MODIFY("IN.4") + PORT_CONFNAME( 0x01, 0x01, "PCB Jumper: French" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) +INPUT_PORTS_END + +static INPUT_PORTS_START( vccsp ) + PORT_INCLUDE( vcc ) + + PORT_MODIFY("IN.4") + PORT_CONFNAME( 0x02, 0x02, "PCB Jumper: Spanish" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x02, DEF_STR( On ) ) +INPUT_PORTS_END + +static INPUT_PORTS_START( vccg ) + PORT_INCLUDE( vcc ) + + PORT_MODIFY("IN.4") + PORT_CONFNAME( 0x04, 0x04, "PCB Jumper: German" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x04, DEF_STR( On ) ) +INPUT_PORTS_END + + static INPUT_PORTS_START( vsc ) PORT_START("IN.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) @@ -1585,34 +1630,34 @@ ROM_START( vcc ) ROM_RELOAD( 0x1000, 0x1000) ROM_END -ROM_START( vccg ) +ROM_START( vccsp ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD("101-32103.bin", 0x0000, 0x1000, CRC(257bb5ab) SHA1(f7589225bb8e5f3eac55f23e2bd526be780b38b5) ) ROM_LOAD("vcc2.bin", 0x1000, 0x1000, CRC(f33095e7) SHA1(692fcab1b88c910b74d04fe4d0660367aee3f4f0) ) ROM_LOAD("vcc3.bin", 0x2000, 0x1000, CRC(624f0cd5) SHA1(7c1a4f4497fe5882904de1d6fecf510c07ee6fc6) ) ROM_REGION( 0x2000, "speech", 0 ) - ROM_LOAD("vcc-german.bin", 0x0000, 0x2000, BAD_DUMP CRC(6c85e310) SHA1(20d1d6543c1e6a1f04184a2df2a468f33faec3ff) ) // taken from fexcelv + ROM_LOAD("vcc-spanish.bin", 0x0000, 0x2000, CRC(8766e128) SHA1(78c7413bf240159720b131ab70bfbdf4e86eb1e9) ) // dumped from Spanish VCC, is same as data in fexcelv ROM_END -ROM_START( vccfr ) +ROM_START( vccg ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD("101-32103.bin", 0x0000, 0x1000, CRC(257bb5ab) SHA1(f7589225bb8e5f3eac55f23e2bd526be780b38b5) ) ROM_LOAD("vcc2.bin", 0x1000, 0x1000, CRC(f33095e7) SHA1(692fcab1b88c910b74d04fe4d0660367aee3f4f0) ) ROM_LOAD("vcc3.bin", 0x2000, 0x1000, CRC(624f0cd5) SHA1(7c1a4f4497fe5882904de1d6fecf510c07ee6fc6) ) ROM_REGION( 0x2000, "speech", 0 ) - ROM_LOAD("vcc-french.bin", 0x0000, 0x2000, BAD_DUMP CRC(fe8c5c18) SHA1(2b64279ab3747ee81c86963c13e78321c6cfa3a3) ) // taken from fexcelv + ROM_LOAD("vcc-german.bin", 0x0000, 0x2000, BAD_DUMP CRC(6c85e310) SHA1(20d1d6543c1e6a1f04184a2df2a468f33faec3ff) ) // taken from fexcelv, assume correct ROM_END -ROM_START( vccsp ) +ROM_START( vccfr ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD("101-32103.bin", 0x0000, 0x1000, CRC(257bb5ab) SHA1(f7589225bb8e5f3eac55f23e2bd526be780b38b5) ) ROM_LOAD("vcc2.bin", 0x1000, 0x1000, CRC(f33095e7) SHA1(692fcab1b88c910b74d04fe4d0660367aee3f4f0) ) ROM_LOAD("vcc3.bin", 0x2000, 0x1000, CRC(624f0cd5) SHA1(7c1a4f4497fe5882904de1d6fecf510c07ee6fc6) ) ROM_REGION( 0x2000, "speech", 0 ) - ROM_LOAD("vcc-spanish.bin", 0x0000, 0x2000, CRC(8766e128) SHA1(78c7413bf240159720b131ab70bfbdf4e86eb1e9) ) + ROM_LOAD("vcc-french.bin", 0x0000, 0x2000, BAD_DUMP CRC(fe8c5c18) SHA1(2b64279ab3747ee81c86963c13e78321c6cfa3a3) ) // taken from fexcelv, assume correct ROM_END @@ -1621,8 +1666,36 @@ ROM_START( uvc ) ROM_LOAD("101-64017.b3", 0x0000, 0x2000, CRC(f1133abf) SHA1(09dd85051c4e7d364d43507c1cfea5c2d08d37f4) ) // "MOS // 101-64017 // 3880" ROM_LOAD("101-32010.a1", 0x2000, 0x1000, CRC(624f0cd5) SHA1(7c1a4f4497fe5882904de1d6fecf510c07ee6fc6) ) // "NEC P9Z021 // D2332C 228 // 101-32010", == vcc3.bin on vcc - ROM_REGION( 0x1000, "speech", 0 ) + ROM_REGION( 0x2000, "speech", 0 ) ROM_LOAD("101-32107.c4", 0x0000, 0x1000, CRC(f35784f9) SHA1(348e54a7fa1e8091f89ac656b4da22f28ca2e44d) ) // "NEC P9Y019 // D2332C 229 // 101-32107", == vcc-engl.bin on vcc + ROM_RELOAD( 0x1000, 0x1000) +ROM_END + +ROM_START( uvcsp ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("101-64017.b3", 0x0000, 0x2000, CRC(f1133abf) SHA1(09dd85051c4e7d364d43507c1cfea5c2d08d37f4) ) + ROM_LOAD("101-32010.a1", 0x2000, 0x1000, CRC(624f0cd5) SHA1(7c1a4f4497fe5882904de1d6fecf510c07ee6fc6) ) + + ROM_REGION( 0x2000, "speech", 0 ) + ROM_LOAD("vcc-spanish.bin", 0x0000, 0x2000, CRC(8766e128) SHA1(78c7413bf240159720b131ab70bfbdf4e86eb1e9) ) +ROM_END + +ROM_START( uvcg ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("101-64017.b3", 0x0000, 0x2000, CRC(f1133abf) SHA1(09dd85051c4e7d364d43507c1cfea5c2d08d37f4) ) + ROM_LOAD("101-32010.a1", 0x2000, 0x1000, CRC(624f0cd5) SHA1(7c1a4f4497fe5882904de1d6fecf510c07ee6fc6) ) + + ROM_REGION( 0x2000, "speech", 0 ) + ROM_LOAD("vcc-german.bin", 0x0000, 0x2000, BAD_DUMP CRC(6c85e310) SHA1(20d1d6543c1e6a1f04184a2df2a468f33faec3ff) ) // taken from fexcelv, assume correct +ROM_END + +ROM_START( uvcfr ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("101-64017.b3", 0x0000, 0x2000, CRC(f1133abf) SHA1(09dd85051c4e7d364d43507c1cfea5c2d08d37f4) ) + ROM_LOAD("101-32010.a1", 0x2000, 0x1000, CRC(624f0cd5) SHA1(7c1a4f4497fe5882904de1d6fecf510c07ee6fc6) ) + + ROM_REGION( 0x2000, "speech", 0 ) + ROM_LOAD("vcc-french.bin", 0x0000, 0x2000, BAD_DUMP CRC(fe8c5c18) SHA1(2b64279ab3747ee81c86963c13e78321c6cfa3a3) ) // taken from fexcelv, assume correct ROM_END @@ -1671,15 +1744,20 @@ ROM_END Drivers ******************************************************************************/ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1978, cc10, 0, 0, cc10, fidelz80, driver_device, 0, "Fidelity Electronics", "Chess Challenger 10 (version B)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1979, vcc, 0, 0, vcc, fidelz80, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (English)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1979, vccg, vcc, 0, vcc, fidelz80, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1979, vccfr, vcc, 0, vcc, fidelz80, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1979, vccsp, vcc, 0, vcc, fidelz80, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1980, uvc, vcc, 0, vcc, fidelz80, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +COMP( 1978, cc10, 0, 0, cc10, cc10, driver_device, 0, "Fidelity Electronics", "Chess Challenger 10 (version B)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) + +COMP( 1979, vcc, 0, 0, vcc, vcc, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (English)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +COMP( 1979, vccsp, vcc, 0, vcc, vccsp, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +COMP( 1979, vccg, vcc, 0, vcc, vccg, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +COMP( 1979, vccfr, vcc, 0, vcc, vccfr, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) + +COMP( 1980, uvc, vcc, 0, vcc, vcc, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (English)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +COMP( 1980, uvcsp, vcc, 0, vcc, vccsp, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +COMP( 1980, uvcg, vcc, 0, vcc, vccg, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +COMP( 1980, uvcfr, vcc, 0, vcc, vccfr, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1980, vsc, 0, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1980, vsc, 0, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1979, vbrc, 0, 0, vbrc, vbrc, driver_device, 0, "Fidelity Electronics", "Voice Bridge Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1980, bridgec3, vbrc, 0, vbrc, vbrc, driver_device, 0, "Fidelity Electronics", "Voice Bridge Challenger III", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +COMP( 1979, vbrc, 0, 0, vbrc, vbrc, driver_device, 0, "Fidelity Electronics", "Voice Bridge Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +COMP( 1980, bridgec3, vbrc, 0, vbrc, vbrc, driver_device, 0, "Fidelity Electronics", "Voice Bridge Challenger III", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mame/mess.lst b/src/mame/mess.lst index a8ae22b6af3..48389c18b54 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2147,6 +2147,9 @@ vccg vccfr vccsp uvc +uvcg +uvcfr +uvcsp bridgec3 vbrc vsc -- cgit v1.2.3-70-g09d2 From 9d3f9aa4ad47dcfcc9d77b92d4ca5cc71d212406 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Thu, 28 Jan 2016 11:31:53 +1100 Subject: pulsarlb: added extra bios --- src/mame/drivers/pulsar.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/pulsar.cpp b/src/mame/drivers/pulsar.cpp index 48030adce83..eda3535ee2d 100644 --- a/src/mame/drivers/pulsar.cpp +++ b/src/mame/drivers/pulsar.cpp @@ -254,7 +254,10 @@ MACHINE_CONFIG_END /* ROM definition */ ROM_START( pulsarlb ) ROM_REGION( 0x10800, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mp7a.bin", 0x10000, 0x800, CRC(726b8a19) SHA1(43b2af84d5622c1f67584c501b730acf002a6113) ) + ROM_SYSTEM_BIOS(0, "mon7", "MP7A") + ROMX_LOAD( "mp7a.bin", 0x10000, 0x800, CRC(726b8a19) SHA1(43b2af84d5622c1f67584c501b730acf002a6113), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "mon6", "LBOOT6") // Blank screen until floppy boots + ROMX_LOAD( "lboot6.rom", 0x10000, 0x800, CRC(3bca9096) SHA1(ff99288e51a9e832785ce8e3ab5a9452b1064231), ROM_BIOS(2)) ROM_END /* Driver */ -- cgit v1.2.3-70-g09d2 From b09d458305eaeb52e833ffb029a901bb39f23bb5 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Thu, 28 Jan 2016 00:10:30 -0300 Subject: Pyon Pyon Jump: Version added to the game description. [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index 4385c35a7ea..b6ed9fcfa4b 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -652,6 +652,8 @@ MACHINE_CONFIG_END ***************************************************************************/ +/* Kuru Kuru Pyon Pyon. +*/ ROM_START( kurukuru ) ROM_REGION( 0x08000, "maincpu", 0 ) ROM_LOAD( "kp_17l.ic17", 0x00000, 0x08000, CRC(9b552ebc) SHA1(07d0e62b7fdad381963a345376b72ad31eb7b96d) ) // program code @@ -672,6 +674,9 @@ ROM_START( kurukuru ) ROM_LOAD( "7908b-4.ic32", 0x0600, 0x0034, CRC(bddf925e) SHA1(861cf5966444d0c0392241e5cfa08db475fb439a) ) ROM_END +/* Pyon Pyon Jump. + Ver 1.40. +*/ ROM_START( ppj ) ROM_REGION( 0x08000, "maincpu", 0 ) ROM_LOAD( "ppj17.ic17", 0x00000, 0x08000, CRC(5d9c9ceb) SHA1(0f52c8a0aaaf978afeb07e56493399133b4ce781) ) // program code @@ -693,6 +698,6 @@ ROM_START( ppj ) ROM_END -/* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS */ -GAME( 199?, kurukuru, 0, kurukuru, kurukuru, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Kuru Kuru Pyon Pyon (Japan)", 0 ) -GAME( 199?, ppj, 0, ppj, kurukuru, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jump (Japan)", MACHINE_NOT_WORKING ) +/* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS */ +GAME( 199?, kurukuru, 0, kurukuru, kurukuru, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Kuru Kuru Pyon Pyon (Japan)", 0 ) +GAME( 199?, ppj, 0, ppj, kurukuru, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jump (V1.40, Japan)", MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From c276e966c6c3f6294c2685aa65e3fb5d6da1605f Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Thu, 28 Jan 2016 00:20:50 -0300 Subject: Pyon Pyon Jump: Proper inputs + DIP switches support. [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 81 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index b6ed9fcfa4b..f3fd1fc5d8f 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -488,8 +488,8 @@ static INPUT_PORTS_START( kurukuru ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("3rd (Pyoko)") PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("4th (Kunio)") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("5th (Pyon Pyon)") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_N) PORT_NAME("Unknown A0h - bit5") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_CODE(KEYCODE_M) PORT_NAME("Unknown A0h - bit6") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_N) PORT_NAME("Unknown A0h - bit5") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_M) PORT_NAME("Unknown A0h - bit6") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) PORT_START("IN1") @@ -558,6 +558,81 @@ static INPUT_PORTS_START( kurukuru ) INPUT_PORTS_END +static INPUT_PORTS_START( ppj ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) PORT_NAME("1st (Boketa)") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) PORT_NAME("2nd (Kunio)") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("3rd (Pyon-Pyon)") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) PORT_NAME("4th (Pyokorin)") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_NAME("5th (Botechin)") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_S) PORT_NAME("Unknown 70h - bit5") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_D) PORT_NAME("Unknown 70h - bit6") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) + + PORT_START("IN1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Bookkeeping") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_NAME("Medal In") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Reset Button") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_A) PORT_NAME("Unknown 60h - bit4") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE (2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r) // hopper feedback + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) + + PORT_START("DSW1") // found in the PCB: 00000000 (arranged for sale since they are uncommon settings) + PORT_DIPNAME( 0x07, 0x03, "Coinage A (100 Y)" ) PORT_DIPLOCATION("DSW1:1,2,3") + PORT_DIPSETTING( 0x00, "1 Coin / 1 Medal" ) + PORT_DIPSETTING( 0x04, "1 Coin / 2 Medal" ) + PORT_DIPSETTING( 0x02, "1 Coin / 3 Medal" ) + PORT_DIPSETTING( 0x06, "1 Coin / 4 Medal" ) + PORT_DIPSETTING( 0x01, "1 Coin / 5 Medal" ) + PORT_DIPSETTING( 0x05, "1 Coin / 6 Medal" ) + PORT_DIPSETTING( 0x03, "1 Coin / 10 Medal" ) + PORT_DIPSETTING( 0x07, "1 Coin / 11 Medal" ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:4") + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, "Unknown (related to coin1/payout)") PORT_DIPLOCATION("DSW1:5") + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, "Coinage Config" ) PORT_DIPLOCATION("DSW1:6") + PORT_DIPSETTING( 0x00, "Coin 1 = Normal" ) + PORT_DIPSETTING( 0x20, "Coin 1 = Payout" ) + PORT_DIPNAME( 0x40, 0x00, "Payout Mode" ) PORT_DIPLOCATION("DSW1:7") + PORT_DIPSETTING( 0x40, "Manual" ) + PORT_DIPSETTING( 0x00, "Automatic" ) + PORT_DIPNAME( 0x80, 0x00, "Repeat Last Bet") PORT_DIPLOCATION("DSW1:8") + PORT_DIPSETTING( 0x80, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + + PORT_START("DSW2") // found in the PCB: 00000000 (arranged for sale since they are uncommon settings) + PORT_DIPNAME( 0x07, 0x01, "Percentage" ) PORT_DIPLOCATION("DSW2:1,2,3") + PORT_DIPSETTING( 0x07, "50%" ) + PORT_DIPSETTING( 0x03, "60%" ) + PORT_DIPSETTING( 0x05, "70%" ) + PORT_DIPSETTING( 0x01, "75%" ) + PORT_DIPSETTING( 0x06, "80%" ) + PORT_DIPSETTING( 0x02, "85%" ) + PORT_DIPSETTING( 0x04, "90%" ) + PORT_DIPSETTING( 0x00, "95%" ) + PORT_DIPNAME( 0x08, 0x00, "Winwave" ) PORT_DIPLOCATION("DSW2:4") + PORT_DIPSETTING( 0x08, "Small" ) + PORT_DIPSETTING( 0x00, "Big" ) + PORT_DIPNAME( 0x10, 0x00, "M.Medal" ) PORT_DIPLOCATION("DSW2:5") + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x60, 0x60, "HG" ) PORT_DIPLOCATION("DSW2:6,7") + PORT_DIPSETTING( 0x60, "20-1" ) + PORT_DIPSETTING( 0x20, "50-1" ) + PORT_DIPSETTING( 0x40, "100-1" ) + PORT_DIPSETTING( 0x00, "200-1" ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + +INPUT_PORTS_END + + /************************************************* * Machine Start & Reset Routines * *************************************************/ @@ -700,4 +775,4 @@ ROM_END /* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS */ GAME( 199?, kurukuru, 0, kurukuru, kurukuru, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Kuru Kuru Pyon Pyon (Japan)", 0 ) -GAME( 199?, ppj, 0, ppj, kurukuru, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jump (V1.40, Japan)", MACHINE_NOT_WORKING ) +GAME( 199?, ppj, 0, ppj, ppj, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jump (V1.40, Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From 38287f8d4ce072c89d1d1a61d3d481e790d49b00 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Thu, 28 Jan 2016 00:34:37 -0300 Subject: Pyon Pyon Jump: Second CPU IRQ ack. Promoted to working. [Roberto Fresca] New machines added or promoted from NOT_WORKING status ------------------------------------------------------ Pyon Pyon Jump (V1.40, Japan) [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index f3fd1fc5d8f..daa3907d28d 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -459,8 +459,14 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ppj_audio_io, AS_IO, 8, kurukuru_state ) ADDRESS_MAP_GLOBAL_MASK(0x7f) + AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_READ(kurukuru_adpcm_timer_irqack_r) // to verify. I'm currently analyzing the code. ADDRESS_MAP_END +/* + 30h -W --> 0x0b + 40h R- --> soundlatch?... + 50h R- --> adpcm irq ack +*/ /* YM2149 ports */ WRITE8_MEMBER(kurukuru_state::ym2149_aout_w) @@ -775,4 +781,4 @@ ROM_END /* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS */ GAME( 199?, kurukuru, 0, kurukuru, kurukuru, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Kuru Kuru Pyon Pyon (Japan)", 0 ) -GAME( 199?, ppj, 0, ppj, ppj, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jump (V1.40, Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) +GAME( 199?, ppj, 0, ppj, ppj, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jump (V1.40, Japan)", MACHINE_IMPERFECT_SOUND) -- cgit v1.2.3-70-g09d2 From 1319453a84718ec50aafdb030eca3bac201995e3 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Thu, 28 Jan 2016 00:42:18 -0300 Subject: Pyon Pyon Jump: OKI M5205 ADPCM samples support. [Roberto Fresca] --- src/mame/drivers/kurukuru.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index daa3907d28d..edb288cb4e1 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -459,13 +459,15 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ppj_audio_io, AS_IO, 8, kurukuru_state ) ADDRESS_MAP_GLOBAL_MASK(0x7f) - AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_READ(kurukuru_adpcm_timer_irqack_r) // to verify. I'm currently analyzing the code. + AM_RANGE(0x20, 0x20) AM_MIRROR(0x0f) AM_WRITE(kurukuru_adpcm_data_w) + AM_RANGE(0x30, 0x30) AM_MIRROR(0x0f) AM_WRITE(kurukuru_adpcm_reset_w) + AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_READ(kurukuru_soundlatch_r) + AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_READ(kurukuru_adpcm_timer_irqack_r) ADDRESS_MAP_END /* 30h -W --> 0x0b - 40h R- --> soundlatch?... + 40h R- --> soundlatch... 50h R- --> adpcm irq ack - */ /* YM2149 ports */ @@ -781,4 +783,4 @@ ROM_END /* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS */ GAME( 199?, kurukuru, 0, kurukuru, kurukuru, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Kuru Kuru Pyon Pyon (Japan)", 0 ) -GAME( 199?, ppj, 0, ppj, ppj, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jump (V1.40, Japan)", MACHINE_IMPERFECT_SOUND) +GAME( 199?, ppj, 0, ppj, ppj, driver_device, 0, ROT0, "Success / Taiyo Jidoki", "Pyon Pyon Jump (V1.40, Japan)", 0 ) -- cgit v1.2.3-70-g09d2 From 664196e04755d8f0f3ef06229a7afbe0d143542c Mon Sep 17 00:00:00 2001 From: Ted Green Date: Thu, 28 Jan 2016 09:01:32 -0700 Subject: Carnival King now working --- src/mame/drivers/iteagle.cpp | 24 +++++++++++----------- src/mame/machine/iteagle_fpga.cpp | 43 +++++++++++++++++++++------------------ src/mame/machine/iteagle_fpga.h | 2 +- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/mame/drivers/iteagle.cpp b/src/mame/drivers/iteagle.cpp index 2ff0a30f1bb..ff6b387bc45 100644 --- a/src/mame/drivers/iteagle.cpp +++ b/src/mame/drivers/iteagle.cpp @@ -179,7 +179,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( gtfore01, iteagle ) MCFG_DEVICE_MODIFY(PCI_ID_FPGA) - MCFG_ITEAGLE_FPGA_INIT(0x01000401, 0x0b0b0b) + MCFG_ITEAGLE_FPGA_INIT(0x00000401, 0x0b0b0b) MCFG_DEVICE_MODIFY(PCI_ID_EEPROM) MCFG_ITEAGLE_EEPROM_INIT(0x0401, 0x7) MACHINE_CONFIG_END @@ -187,7 +187,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( gtfore02, iteagle ) MCFG_DEVICE_MODIFY(PCI_ID_FPGA) MCFG_ITEAGLE_FPGA_INIT(0x01000402, 0x020201) - MCFG_DEVICE_MODIFY(":pci:0a.0") + MCFG_DEVICE_MODIFY(PCI_ID_EEPROM) MCFG_ITEAGLE_EEPROM_INIT(0x0402, 0x7) MACHINE_CONFIG_END @@ -215,28 +215,28 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( gtfore06, iteagle ) MCFG_DEVICE_MODIFY(PCI_ID_FPGA) MCFG_ITEAGLE_FPGA_INIT(0x01000406, 0x0c0b0d) - MCFG_DEVICE_MODIFY(":pci:0a.0") + MCFG_DEVICE_MODIFY(PCI_ID_EEPROM) MCFG_ITEAGLE_EEPROM_INIT(0x0406, 0x9); MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( carnking, iteagle ) MCFG_DEVICE_MODIFY(PCI_ID_FPGA) - MCFG_ITEAGLE_FPGA_INIT(0x01000603, 0x0c0b0d) + MCFG_ITEAGLE_FPGA_INIT(0x01000a01, 0x0e0a0a) MCFG_DEVICE_MODIFY(PCI_ID_EEPROM) - MCFG_ITEAGLE_EEPROM_INIT(0x0603, 0x9) + MCFG_ITEAGLE_EEPROM_INIT(0x0a01, 0x9) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( bbhsc, iteagle ) MCFG_DEVICE_MODIFY(PCI_ID_FPGA) - MCFG_ITEAGLE_FPGA_INIT(0x01000600, 0x0c0a0a) + MCFG_ITEAGLE_FPGA_INIT(0x02000600, 0x0c0a0a) MCFG_DEVICE_MODIFY(PCI_ID_EEPROM) - MCFG_ITEAGLE_EEPROM_INIT(0x0600, 0x9) + MCFG_ITEAGLE_EEPROM_INIT(0x0000, 0x7) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( bbhcotw, iteagle ) MCFG_DEVICE_MODIFY(PCI_ID_FPGA) MCFG_ITEAGLE_FPGA_INIT(0x02000603, 0x080704) - MCFG_DEVICE_MODIFY(":pci:0a.0") + MCFG_DEVICE_MODIFY(PCI_ID_EEPROM) MCFG_ITEAGLE_EEPROM_INIT(0x0603, 0x9) MACHINE_CONFIG_END @@ -331,7 +331,7 @@ static INPUT_PORTS_START( virtpool ) INPUT_PORTS_END -static INPUT_PORTS_START( bbhcotw ) +static INPUT_PORTS_START( bbh ) PORT_INCLUDE( iteagle ) PORT_MODIFY("IN1") @@ -557,7 +557,7 @@ ROM_END GAME( 2000, iteagle, 0, iteagle, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Eagle BIOS", MACHINE_IS_BIOS_ROOT ) GAME( 1998, virtpool, iteagle, virtpool, virtpool, driver_device, 0, ROT0, "Incredible Technologies", "Virtual Pool", MACHINE_NOT_WORKING ) // random lockups on loading screens -GAME( 2002, carnking, iteagle, carnking, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Carnival King (v1.00.11)", MACHINE_NOT_WORKING ) +GAME( 2002, carnking, iteagle, carnking, bbh, driver_device, 0, ROT0, "Incredible Technologies", "Carnival King (v1.00.11)", 0 ) GAME( 2000, gtfore01, iteagle, gtfore01, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Golden Tee Fore! (v1.00.25)", 0 ) GAME( 2001, gtfore02, iteagle, gtfore02, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Golden Tee Fore! 2002 (v2.01.06)", 0 ) GAME( 2002, gtfore03, iteagle, gtfore03, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Golden Tee Fore! 2003 (v3.00.10)", 0 ) @@ -569,5 +569,5 @@ GAME( 2004, gtfore05a, gtfore05, gtfore05, iteagle, driver_device, 0, ROT0, "I GAME( 2004, gtfore05b, gtfore05, gtfore05, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Golden Tee Fore! 2005 Extra (v5.01.00)", 0 ) GAME( 2004, gtfore05c, gtfore05, gtfore05, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Golden Tee Fore! 2005 Extra (v5.00.00)", 0 ) GAME( 2005, gtfore06, iteagle, gtfore06, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Golden Tee Fore! 2006 Complete (v6.00.01)", 0 ) -GAME( 2002, bbhsc, iteagle, bbhsc, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Big Buck Hunter - Shooter's Challenge (v1.50.07)", MACHINE_NOT_WORKING ) // doesn't boot -GAME( 2006, bbhcotw, iteagle, bbhcotw, bbhcotw, driver_device, 0, ROT0, "Incredible Technologies", "Big Buck Hunter Call of the Wild (v3.02.5)", MACHINE_NOT_WORKING ) // random lockups +GAME( 2002, bbhsc, iteagle, bbhsc, bbh, driver_device, 0, ROT0, "Incredible Technologies", "Big Buck Hunter - Shooter's Challenge (v1.50.07)", MACHINE_NOT_WORKING ) // doesn't boot +GAME( 2006, bbhcotw, iteagle, bbhcotw, bbh, driver_device, 0, ROT0, "Incredible Technologies", "Big Buck Hunter Call of the Wild (v3.02.5)", MACHINE_NOT_WORKING ) // random lockups diff --git a/src/mame/machine/iteagle_fpga.cpp b/src/mame/machine/iteagle_fpga.cpp index 9fa7cef6da8..40e1a9bb19e 100644 --- a/src/mame/machine/iteagle_fpga.cpp +++ b/src/mame/machine/iteagle_fpga.cpp @@ -4,6 +4,7 @@ #include "coreutil.h" #define LOG_FPGA (0) +#define LOG_SERIAL (0) #define LOG_RTC (0) #define LOG_RAM (0) #define LOG_EEPROM (0) @@ -80,14 +81,14 @@ void iteagle_fpga_device::device_reset() m_serial_str.clear(); m_serial_idx = 0; m_serial_data = false; + memset(m_serial_com0, 0, sizeof(m_serial_com0)); memset(m_serial_com1, 0, sizeof(m_serial_com1)); memset(m_serial_com2, 0, sizeof(m_serial_com2)); memset(m_serial_com3, 0, sizeof(m_serial_com3)); - memset(m_serial_com4, 0, sizeof(m_serial_com4)); + m_serial_com0[0] = 0x2c; m_serial_com1[0] = 0x2c; m_serial_com2[0] = 0x2c; m_serial_com3[0] = 0x2c; - m_serial_com4[0] = 0x2c; } void iteagle_fpga_device::update_sequence(UINT32 data) @@ -130,12 +131,10 @@ void iteagle_fpga_device::update_sequence_eg1(UINT32 data) val1 = ((m_seq & 0x2)<<6) | ((m_seq & 0x4)<<4) | ((m_seq & 0x8)<<2) | ((m_seq & 0x10)<<0) | ((m_seq & 0x20)>>2) | ((m_seq & 0x40)>>4) | ((m_seq & 0x80)>>6) | ((m_seq & 0x100)>>8); m_seq = (m_seq>>8) | ((feed&0xff)<<16); - //m_fpga_regs[offset] = (m_fpga_regs[offset]&0xFFFFFF00) | ((val1 + m_seq_rem1)&0xFF); m_fpga_regs[offset] = (m_fpga_regs[offset]&0xFFFFFF00) | ((val1 + m_seq_rem1 + m_seq_rem2)&0xFF); } else if (data & 0x2) { val1 = ((m_seq & 0x2)<<1) | ((m_seq & 0x4)>>1) | ((m_seq & 0x8)>>3); m_seq_rem1 = ((m_seq & 0x10)) | ((m_seq & 0x20)>>2) | ((m_seq & 0x40)>>4); - //m_seq_rem2 = ((m_seq & 0x80)>>1) | ((m_seq & 0x100)>>3) | ((m_seq & 0x200)>>5); m_seq = (m_seq>>6) | ((feed&0x3f)<<18); m_fpga_regs[offset] = (m_fpga_regs[offset]&0xFFFFFF00) | ((val1 + m_seq_rem1 + m_seq_rem2)&0xFF); } else { @@ -197,16 +196,16 @@ READ32_MEMBER( iteagle_fpga_device::fpga_r ) logerror("%s:fpga_r offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, result, mem_mask); break; case 0x0c/4: // 1d = modem byte - result = (result & 0xFFFF0000) | ((m_serial_com2[m_serial_idx]&0xff)<<8) | (m_serial_com1[m_serial_idx]&0xff); + result = (result & 0xFFFF0000) | ((m_serial_com1[m_serial_idx]&0xff)<<8) | (m_serial_com0[m_serial_idx]&0xff); if (ACCESSING_BITS_0_15) { m_serial_data = false; m_serial_idx = 0; } - if (LOG_FPGA) + if (0 && LOG_FPGA) logerror("%s:fpga_r offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, result, mem_mask); break; case 0x1c/4: // 1d = modem byte - result = (result & 0xFFFF0000) | ((m_serial_com4[m_serial_idx]&0xff)<<8) | (m_serial_com3[m_serial_idx]&0xff); + result = (result & 0xFFFF0000) | ((m_serial_com3[m_serial_idx]&0xff)<<8) | (m_serial_com2[m_serial_idx]&0xff); if (ACCESSING_BITS_0_15) { m_serial_data = false; m_serial_idx = 0; @@ -233,8 +232,8 @@ WRITE32_MEMBER( iteagle_fpga_device::fpga_w ) if ((m_version & 0xff00) == 0x0200) update_sequence_eg1(data & 0xff); else - // ATMEL Chip access. Returns version id's when bit 7 is set. - update_sequence(data & 0xff); + // ATMEL Chip access. Returns version id's when bit 7 is set. + update_sequence(data & 0xff); if (0 && LOG_FPGA) logerror("%s:fpga_w offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, data, mem_mask); } @@ -242,7 +241,7 @@ WRITE32_MEMBER( iteagle_fpga_device::fpga_w ) if (ACCESSING_BITS_24_31 && (data & 0x01000000)) { m_cpu->set_input_line(m_irq_num, CLEAR_LINE); // Not sure what value to use here, needed for lightgun - m_timer->adjust(attotime::from_hz(25)); + m_timer->adjust(attotime::from_hz(59)); if (LOG_FPGA) logerror("%s:fpga_w offset %04X = %08X & %08X Clearing interrupt(%i)\n", machine().describe_context(), offset*4, data, mem_mask, m_irq_num); } else { @@ -269,7 +268,7 @@ WRITE32_MEMBER( iteagle_fpga_device::fpga_w ) if (!m_serial_data) { m_serial_idx = data&0xf; } else { - m_serial_com1[m_serial_idx] = data&0xff; + m_serial_com0[m_serial_idx] = data&0xff; m_serial_idx = 0; } m_serial_data = !m_serial_data; @@ -278,29 +277,31 @@ WRITE32_MEMBER( iteagle_fpga_device::fpga_w ) if (!m_serial_data) { m_serial_idx = (data&0x0f00)>>8; } else { - m_serial_com2[m_serial_idx] = (data&0xff00)>>8; + m_serial_com1[m_serial_idx] = (data&0xff00)>>8; } m_serial_data = !m_serial_data; } if (ACCESSING_BITS_16_23) { if (m_serial_str.size()==0) - m_serial_str = "com1: "; + m_serial_str = "com0: "; m_serial_str += (data>>16)&0xff; if (((data>>16)&0xff)==0xd) { + if (LOG_SERIAL) logerror("%s\n", m_serial_str.c_str()); osd_printf_debug("%s\n", m_serial_str.c_str()); m_serial_str.clear(); } } if (ACCESSING_BITS_24_31) { if (m_serial_str.size()==0) - m_serial_str = "com2: "; + m_serial_str = "com1: "; m_serial_str += (data>>24)&0xff; if (1 || ((data>>24)&0xff)==0xd) { + if (LOG_SERIAL) logerror("%s\n", m_serial_str.c_str()); osd_printf_debug("%s\n", m_serial_str.c_str()); m_serial_str.clear(); } } - if (LOG_FPGA) + if (0 && LOG_FPGA) logerror("%s:fpga_w offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, data, mem_mask); break; case 0x1c/4: @@ -308,7 +309,7 @@ WRITE32_MEMBER( iteagle_fpga_device::fpga_w ) if (!m_serial_data) { m_serial_idx = data&0xf; } else { - m_serial_com3[m_serial_idx] = data&0xff; + m_serial_com2[m_serial_idx] = data&0xff; m_serial_idx = 0; } m_serial_data = !m_serial_data; @@ -317,24 +318,26 @@ WRITE32_MEMBER( iteagle_fpga_device::fpga_w ) if (!m_serial_data) { m_serial_idx = (data&0x0f00)>>8; } else { - m_serial_com4[m_serial_idx] = (data&0xff00)>>8; + m_serial_com3[m_serial_idx] = (data&0xff00)>>8; } m_serial_data = !m_serial_data; } if (ACCESSING_BITS_16_23) { if (m_serial_str.size()==0) - m_serial_str = "com3: "; + m_serial_str = "com2: "; m_serial_str += (data>>16)&0xff; if (1 || ((data>>16)&0xff)==0xd) { + if (LOG_SERIAL) logerror("%s\n", m_serial_str.c_str()); osd_printf_debug("%s\n", m_serial_str.c_str()); m_serial_str.clear(); } } if (ACCESSING_BITS_24_31) { if (m_serial_str.size()==0) - m_serial_str = "com4: "; + m_serial_str = "com3: "; m_serial_str += (data>>24)&0xff; if (((data>>24)&0xff)==0xd) { + if (LOG_SERIAL) logerror("%s\n", m_serial_str.c_str()); osd_printf_debug("%s\n", m_serial_str.c_str()); m_serial_str.clear(); } @@ -649,7 +652,7 @@ void iteagle_ide_device::device_reset() { pci_device::device_reset(); memset(m_ctrl_regs, 0, sizeof(m_ctrl_regs)); - m_ctrl_regs[0x10/4] = 0x00000000; // 0x6=No SIMM, 0x2, 0x1, 0x0 = SIMM . Top 16 bits are compared to 0x3. + m_ctrl_regs[0x10/4] = 0x00070000; // 0x6=No SIMM, 0x2, 0x1, 0x0 = SIMM . Top 16 bits are compared to 0x3. Bit 0 might be lan chip present. memset(m_rtc_regs, 0, sizeof(m_rtc_regs)); m_rtc_regs[0xa] = 0x20; // 32.768 MHz m_rtc_regs[0xb] = 0x02; // 24-hour format diff --git a/src/mame/machine/iteagle_fpga.h b/src/mame/machine/iteagle_fpga.h index 5d150e66116..fe5f9a76687 100644 --- a/src/mame/machine/iteagle_fpga.h +++ b/src/mame/machine/iteagle_fpga.h @@ -63,10 +63,10 @@ private: std::string m_serial_str; UINT8 m_serial_idx; bool m_serial_data; + UINT8 m_serial_com0[0x10]; UINT8 m_serial_com1[0x10]; UINT8 m_serial_com2[0x10]; UINT8 m_serial_com3[0x10]; - UINT8 m_serial_com4[0x10]; UINT32 m_version; UINT32 m_seq_init; -- cgit v1.2.3-70-g09d2 From 688069fcf86036e0990e0beb8ab927baeede7ebc Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 28 Jan 2016 19:02:30 +0100 Subject: mmodular: removed gen32_oc custom MESS overclocked version of gen32_41 --- src/mame/drivers/mmodular.cpp | 26 +++----------------------- src/mame/mess.lst | 1 - 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/mame/drivers/mmodular.cpp b/src/mame/drivers/mmodular.cpp index aa1b5b6a236..eb1e9b4d6d7 100644 --- a/src/mame/drivers/mmodular.cpp +++ b/src/mame/drivers/mmodular.cpp @@ -15,7 +15,6 @@ Vancouver 68020 12Mhz Genius 68030 V4.00 33.333 Mhz Genius 68030 V4.01 33.333 Mhz - Genius 68030 V4.01 33.333x2 Mhz (custom MESS overclocked version for higher ELO) Berlin Pro 68020 24.576 Mhz (not modular board, but otherwise close to milano) Berlin Pro (London) 68020 24.576 Mhz (not modular board, but otherwise close to milano) London 68030 V5.00k 33.333 Mhz (probably the Genius 3/4 update ROM) @@ -998,16 +997,12 @@ TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::timer_update_irq_academy) MACHINE_START_MEMBER(polgar_state,van32) { // patch LCD delay loop on the 68030 machines until waitstates and/or opcode timings are fixed in MAME core -// patches gen32 gen32_41 gen32_oc lond030 +// patches gen32 gen32_41 lond030 UINT8 *rom = memregion("maincpu")->base(); - if(rom[0x870] == 0x0c && rom[0x871] == 0x78) { - if (!strcmp(machine().system().name,"gen32_oc")) { - rom[0x870] = 0x6c; - } else { - rom[0x870] = 0x38; - } + if(rom[0x870] == 0x0c && rom[0x871] == 0x78) + rom[0x870] = 0x38; } } @@ -1692,15 +1687,6 @@ static MACHINE_CONFIG_START( gen32, polgar_state ) MCFG_NVRAM_ADD_0FILL("nvram") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( gen32_oc, gen32 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK( XTAL_33_333MHz * 2 ) - MCFG_DEVICE_REMOVE("int_timer") - MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(500)) - - MACHINE_CONFIG_END static MACHINE_CONFIG_START( bpl32, polgar_state ) @@ -1851,11 +1837,6 @@ ROM_START( gen32_41 ) ROM_LOAD("gen32_41.bin", 0x00000, 0x40000,CRC(ea9938c0) SHA1(645cf0b5b831b48104ad6cec8d78c63dbb6a588c)) ROM_END -ROM_START( gen32_oc ) - ROM_REGION32_BE( 0x40000, "maincpu", 0 ) - ROM_LOAD("gen32_41.bin", 0x00000, 0x40000,CRC(ea9938c0) SHA1(645cf0b5b831b48104ad6cec8d78c63dbb6a588c)) -ROM_END - ROM_START( berlinp ) ROM_REGION32_BE( 0x40000, "maincpu", 0 ) ROM_LOAD("berlinp.bin", 0x00000, 0x40000,CRC(82FBAF6E) SHA1(729B7CEF3DFAECC4594A6178FC4BA6015AFA6202)) @@ -1904,7 +1885,6 @@ DRIVER_INIT_MEMBER(polgar_state,polgar) CONS( 1992, risc, 0, 0, risc, van16, driver_device, 0, "Saitek", "RISC2500", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) CONS( 1993, gen32, van16, 0, gen32, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 V4.00", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) CONS( 1993, gen32_41, van16, 0, gen32, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 V4.01", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1993, gen32_oc, van16, 0, gen32_oc, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 V4.01OC", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK|MACHINE_UNOFFICIAL | MACHINE_CLICKABLE_ARTWORK ) CONS( 1994, berlinp, van16, 0, bpl32, bpl32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Berlin Pro 68020", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) CONS( 1996, bpl32, van16, 0, bpl32, bpl32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Berlin Pro London Upgrade V5.00", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) CONS( 1996, lond020, van16, 0, van32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto London 68020 32 Bit", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 48389c18b54..8bcee333384 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2187,7 +2187,6 @@ van16 // 1991 Mephisto Vancouver 68000 van32 // 1991 Mephisto Vancouver 68020 gen32 // 1993 Mephisto Genius030 V4.00 gen32_41 // 1993 Mephisto Genius030 V4.01 -gen32_oc // 1993 Mephisto Genius030 V4.01OC berlinp // 1994 Mephisto Berlin Pro 68020 bpl32 // 1996 Mephisto Berlin Pro London Upgrade V5.00 lond020 // 1996 Mephisto London 68020 32 Bit -- cgit v1.2.3-70-g09d2 From 681a5e48fe687ca61e2b0393a78ee87c6c8ffcef Mon Sep 17 00:00:00 2001 From: cracyc Date: Thu, 28 Jan 2016 12:18:48 -0600 Subject: i86: fix notes (nw) --- src/devices/cpu/i86/i86.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/devices/cpu/i86/i86.txt b/src/devices/cpu/i86/i86.txt index 39b54d6a8d0..fb27b8526fe 100644 --- a/src/devices/cpu/i86/i86.txt +++ b/src/devices/cpu/i86/i86.txt @@ -29,6 +29,7 @@ mov sreg, doesnot disable until next operation is executed 8086/8088 --------- "mov cs, " causes unconditional jump! +0xd6 is salc (sbb al,al) as all other intel x86-16 and -32 cpus 80C86/80C88 ----------- @@ -36,9 +37,10 @@ mov sreg, doesnot disable until next operation is executed 80186/80188 ----------- -integrated pic8259, pit8253, dma8253 (but not at standard pc addresses) +integrated pic, timer and dmac entirely incompatible with 8259, 825[3,4] and 82[3,5]7 additional instructions -"mov cs, " ? +#BR/bound/int 5, #UD/illegal instruction/int 6, #NM/coprocessor unavailable/int 7 support +"mov cs, " ignored (likely causes int 6) shift count anded with 0x1f 80188 @@ -52,6 +54,7 @@ although it is based on 80186 instruction set, some behaviours follow 8086 8080 emulation mode "mov cs, " ignored shift count not anded (acts like 8086) +0xd6 is xlat alias NEC 70116 (V30) --------------- @@ -69,11 +72,11 @@ no 8080 emulation mode NEC V40 ------- -pinout, integrated peripherals as 80186 +pinout, integrated peripherals 8259,54,37 clones at nonpc compatible addresses NEC V50 ------- -pinout, integrated peripherals as 80188 +pinout, integrated peripherals as v40 NEC V33? -------- @@ -92,9 +95,9 @@ v30? emulation mode (without 8080 emulation mode) 80286 ----- -80186 with additional instructions +80186 with additional instructions but no peripherals 24 bit address bus, -protected mode +protected mode selector/descriptor 80386 and later --------------- -- cgit v1.2.3-70-g09d2 From b0cc7ab9e0985bf80cffad27fcd67f383573b688 Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 28 Jan 2016 22:05:17 +0100 Subject: fidelz80: added VSC foreign language sets --- src/mame/drivers/fidelz80.cpp | 91 +++++++++++++++++++++++++++++++++---------- src/mame/includes/fidelz80.h | 2 +- src/mame/mess.lst | 3 ++ 3 files changed, 75 insertions(+), 21 deletions(-) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 5f85a1e49a4..71f36d55537 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -598,7 +598,7 @@ PB.3 - violet wire PB.4 - white wire (and TSI BUSY line) PB.5 - selection jumper input (see below) PB.6 - TSI start line -PB.7 - TSI ROM D0 line +PB.7 - TSI ROM A12 line selection jumpers: @@ -1070,7 +1070,7 @@ WRITE8_MEMBER(fidelz80_state::vsc_ppi_portc_w) { // d0-d3: select digits // d0-d7: select leds, input mux low bits - m_inp_mux = (m_inp_mux & 0x300) | data; + m_inp_mux = (m_inp_mux & ~0xff) | data; m_led_select = data; vsc_prepare_display(); } @@ -1081,7 +1081,8 @@ WRITE8_MEMBER(fidelz80_state::vsc_ppi_portc_w) READ8_MEMBER(fidelz80_state::vsc_pio_porta_r) { // d0-d7: multiplexed inputs - return read_inputs(10); + return read_inputs(11); + } READ8_MEMBER(fidelz80_state::vsc_pio_portb_r) @@ -1090,18 +1091,26 @@ READ8_MEMBER(fidelz80_state::vsc_pio_portb_r) // d4: TSI BUSY line ret |= (m_speech->busy_r()) ? 0 : 0x10; - + return ret; } WRITE8_MEMBER(fidelz80_state::vsc_pio_portb_w) { // d0,d1: input mux highest bits - m_inp_mux = (m_inp_mux & 0xff) | (data << 8 & 0x300); - + // d5: enable language switch + m_inp_mux = (m_inp_mux & ~0x700) | (data << 8 & 0x300) | (data << 5 & 0x400); + + //if (m_inp_mux & 0x400) debugger_break(machine()); + + // d7: TSI ROM A12 + + m_speech->force_update(); // update stream to now + m_speech_bank = data >> 7 & 1; + // d6: TSI START line m_speech->start_w(data >> 6 & 1); - + // d2: lower TSI volume m_speech->set_output_gain(0, (data & 4) ? 0.5 : 1.0); } @@ -1298,26 +1307,26 @@ static INPUT_PORTS_START( cc10 ) PORT_START("IN.4") PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("LEVEL") // factory setting - PORT_CONFNAME( 0x80, 0x00, "PPI.B.7: Maximum Levels" ) - PORT_CONFSETTING( 0x00, "10" ) + PORT_START("LEVEL") // hardwired (VCC/GND?) + PORT_CONFNAME( 0x80, 0x00, "Maximum Levels" ) + PORT_CONFSETTING( 0x00, "10" ) // factory setting PORT_CONFSETTING( 0x80, "3" ) INPUT_PORTS_END static INPUT_PORTS_START( vcc ) PORT_INCLUDE( vcc_base ) - PORT_START("IN.4") // not consumer accessible - PORT_CONFNAME( 0x01, 0x00, "PCB Jumper: French" ) + PORT_START("IN.4") // PCB jumpers, not consumer accessible + PORT_CONFNAME( 0x01, 0x00, "Language: French" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - PORT_CONFNAME( 0x02, 0x00, "PCB Jumper: Spanish" ) + PORT_CONFNAME( 0x02, 0x00, "Language: Spanish" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x02, DEF_STR( On ) ) - PORT_CONFNAME( 0x04, 0x00, "PCB Jumper: German" ) + PORT_CONFNAME( 0x04, 0x00, "Language: German" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x04, DEF_STR( On ) ) - PORT_CONFNAME( 0x08, 0x00, "PCB Jumper: Special" ) + PORT_CONFNAME( 0x08, 0x00, "Language: Special" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x08, DEF_STR( On ) ) INPUT_PORTS_END @@ -1326,7 +1335,7 @@ static INPUT_PORTS_START( vccfr ) PORT_INCLUDE( vcc ) PORT_MODIFY("IN.4") - PORT_CONFNAME( 0x01, 0x01, "PCB Jumper: French" ) + PORT_CONFNAME( 0x01, 0x01, "Language: French" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x01, DEF_STR( On ) ) INPUT_PORTS_END @@ -1335,7 +1344,7 @@ static INPUT_PORTS_START( vccsp ) PORT_INCLUDE( vcc ) PORT_MODIFY("IN.4") - PORT_CONFNAME( 0x02, 0x02, "PCB Jumper: Spanish" ) + PORT_CONFNAME( 0x02, 0x02, "Language: Spanish" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x02, DEF_STR( On ) ) INPUT_PORTS_END @@ -1344,7 +1353,7 @@ static INPUT_PORTS_START( vccg ) PORT_INCLUDE( vcc ) PORT_MODIFY("IN.4") - PORT_CONFNAME( 0x04, 0x04, "PCB Jumper: German" ) + PORT_CONFNAME( 0x04, 0x04, "Language: German" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x04, DEF_STR( On ) ) INPUT_PORTS_END @@ -1449,6 +1458,13 @@ static INPUT_PORTS_START( vsc ) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("IN.10") // hardwired (2 diodes) + PORT_CONFNAME( 0x03, 0x00, "Language" ) + PORT_CONFSETTING( 0x00, "English" ) + PORT_CONFSETTING( 0x01, "1" ) // todo: game dasm says it checks against 0/not0, 2, 3.. which language is which? + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFSETTING( 0x03, "3" ) INPUT_PORTS_END static INPUT_PORTS_START( vbrc ) @@ -1582,6 +1598,7 @@ static MACHINE_CONFIG_START( vsc, fidelz80_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("speech", S14001A, 25000) // R/C circuit, around 25khz + MCFG_S14001A_EXT_READ_HANDLER(READ8(fidelz80_state, vcc_speech_r)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) MACHINE_CONFIG_END @@ -1705,8 +1722,39 @@ ROM_START( vsc ) ROM_LOAD("101-64109.bin", 0x2000, 0x2000, CRC(08a3577c) SHA1(69fe379d21a9d4b57c84c3832d7b3e7431eec341) ) ROM_LOAD("101-32024.bin", 0x4000, 0x1000, CRC(2a078676) SHA1(db2f0aba7e8ac0f84a17bae7155210cdf0813afb) ) - ROM_REGION( 0x1000, "speech", 0 ) + ROM_REGION( 0x2000, "speech", 0 ) ROM_LOAD("101-32107.bin", 0x0000, 0x1000, CRC(f35784f9) SHA1(348e54a7fa1e8091f89ac656b4da22f28ca2e44d) ) + ROM_RELOAD( 0x1000, 0x1000) +ROM_END + +ROM_START( vscsp ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("101-64108.bin", 0x0000, 0x2000, CRC(c9c98490) SHA1(e6db883df088d60463e75db51433a4b01a3e7626) ) + ROM_LOAD("101-64109.bin", 0x2000, 0x2000, CRC(08a3577c) SHA1(69fe379d21a9d4b57c84c3832d7b3e7431eec341) ) + ROM_LOAD("101-32024.bin", 0x4000, 0x1000, CRC(2a078676) SHA1(db2f0aba7e8ac0f84a17bae7155210cdf0813afb) ) + + ROM_REGION( 0x2000, "speech", 0 ) + ROM_LOAD("vcc-spanish.bin", 0x0000, 0x2000, BAD_DUMP CRC(8766e128) SHA1(78c7413bf240159720b131ab70bfbdf4e86eb1e9) ) // taken from vcc/fexcelv, assume correct +ROM_END + +ROM_START( vscg ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("101-64108.bin", 0x0000, 0x2000, CRC(c9c98490) SHA1(e6db883df088d60463e75db51433a4b01a3e7626) ) + ROM_LOAD("101-64109.bin", 0x2000, 0x2000, CRC(08a3577c) SHA1(69fe379d21a9d4b57c84c3832d7b3e7431eec341) ) + ROM_LOAD("101-32024.bin", 0x4000, 0x1000, CRC(2a078676) SHA1(db2f0aba7e8ac0f84a17bae7155210cdf0813afb) ) + + ROM_REGION( 0x2000, "speech", 0 ) + ROM_LOAD("vcc-german.bin", 0x0000, 0x2000, BAD_DUMP CRC(6c85e310) SHA1(20d1d6543c1e6a1f04184a2df2a468f33faec3ff) ) // taken from fexcelv, assume correct +ROM_END + +ROM_START( vscfr ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("101-64108.bin", 0x0000, 0x2000, CRC(c9c98490) SHA1(e6db883df088d60463e75db51433a4b01a3e7626) ) + ROM_LOAD("101-64109.bin", 0x2000, 0x2000, CRC(08a3577c) SHA1(69fe379d21a9d4b57c84c3832d7b3e7431eec341) ) + ROM_LOAD("101-32024.bin", 0x4000, 0x1000, CRC(2a078676) SHA1(db2f0aba7e8ac0f84a17bae7155210cdf0813afb) ) + + ROM_REGION( 0x2000, "speech", 0 ) + ROM_LOAD("vcc-french.bin", 0x0000, 0x2000, BAD_DUMP CRC(fe8c5c18) SHA1(2b64279ab3747ee81c86963c13e78321c6cfa3a3) ) // taken from fexcelv, assume correct ROM_END @@ -1757,7 +1805,10 @@ COMP( 1980, uvcsp, vcc, 0, vcc, vccsp, driver_device, 0, "Fideli COMP( 1980, uvcg, vcc, 0, vcc, vccg, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) COMP( 1980, uvcfr, vcc, 0, vcc, vccfr, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1980, vsc, 0, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1980, vsc, 0, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (English)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1980, vscsp, vsc, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1980, vscg, vsc, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1980, vscfr, vsc, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) COMP( 1979, vbrc, 0, 0, vbrc, vbrc, driver_device, 0, "Fidelity Electronics", "Voice Bridge Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) COMP( 1980, bridgec3, vbrc, 0, vbrc, vbrc, driver_device, 0, "Fidelity Electronics", "Voice Bridge Challenger III", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mame/includes/fidelz80.h b/src/mame/includes/fidelz80.h index c9aea6bafc4..a27f4e7aabc 100644 --- a/src/mame/includes/fidelz80.h +++ b/src/mame/includes/fidelz80.h @@ -25,7 +25,7 @@ public: // devices/pointers required_device m_maincpu; - optional_ioport_array<10> m_inp_matrix; // max 10 + optional_ioport_array<11> m_inp_matrix; // max 11 optional_device m_speech; optional_region_ptr m_speech_rom; diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 8bcee333384..b98dc063fd4 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2153,6 +2153,9 @@ uvcsp bridgec3 vbrc vsc +vscg +vscfr +vscsp csc fscc12 fexcelv -- cgit v1.2.3-70-g09d2 From cb1d7fe7fc942677c6aae668e283073f08a11199 Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 28 Jan 2016 22:07:40 +0100 Subject: woop --- src/mame/drivers/mmodular.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/mmodular.cpp b/src/mame/drivers/mmodular.cpp index eb1e9b4d6d7..09e83e6dcf6 100644 --- a/src/mame/drivers/mmodular.cpp +++ b/src/mame/drivers/mmodular.cpp @@ -1001,7 +1001,7 @@ MACHINE_START_MEMBER(polgar_state,van32) UINT8 *rom = memregion("maincpu")->base(); - if(rom[0x870] == 0x0c && rom[0x871] == 0x78) + if(rom[0x870] == 0x0c && rom[0x871] == 0x78) { rom[0x870] = 0x38; } } -- cgit v1.2.3-70-g09d2 From 361d32d37ffbe133760fcbfa314f60ccd4a8e8a8 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Fri, 29 Jan 2016 00:43:18 +0100 Subject: Small code cleanup: - corealloc.h: added macro definition for global_alloc (nothrow) memory allocation. - textbuf.cpp / wavwrite.cpp: removed pointless cast. - debugcmd.cpp / luaengine.cpp / render.cpp: avoid strlen calls in a loop. - diimage.cpp: simplified "device_image_interface::set_image_filename" function. - miscmenu.cpp / selgame.h / video.cpp(h): replaced int with bool where applicable. - ui.cpp: removed unused code. --- src/emu/debug/debugcmd.cpp | 5 +++-- src/emu/debug/textbuf.cpp | 6 +++--- src/emu/diimage.cpp | 26 ++++++++++++-------------- src/emu/luaengine.cpp | 2 +- src/emu/render.cpp | 3 ++- src/emu/sound/wavwrite.cpp | 2 +- src/emu/ui/miscmenu.cpp | 6 +++--- src/emu/ui/selgame.h | 2 +- src/emu/ui/ui.cpp | 3 +-- src/emu/video.cpp | 2 +- src/emu/video.h | 2 +- src/lib/util/corealloc.h | 2 ++ 12 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 4558413b2c3..7ad039806ea 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -2381,11 +2381,12 @@ static void execute_find(running_machine &machine, int ref, int params, const ch for (int i = 2; i < params; i++) { const char *pdata = param[i]; + size_t pdatalen = strlen(pdata) - 1; /* check for a string */ - if (pdata[0] == '"' && pdata[strlen(pdata) - 1] == '"') + if (pdata[0] == '"' && pdata[pdatalen] == '"') { - for (j = 1; j < strlen(pdata) - 1; j++) + for (j = 1; j < pdatalen; j++) { data_to_find[data_count] = pdata[j]; data_size[data_count++] = 1; diff --git a/src/emu/debug/textbuf.cpp b/src/emu/debug/textbuf.cpp index e7daf96571a..476fe6e1efc 100644 --- a/src/emu/debug/textbuf.cpp +++ b/src/emu/debug/textbuf.cpp @@ -86,12 +86,12 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines) text_buffer *text; /* allocate memory for the text buffer object */ - text = (text_buffer *)global_alloc(text_buffer); + text = global_alloc_nothrow(text_buffer); if (!text) return nullptr; /* allocate memory for the buffer itself */ - text->buffer = (char *)global_alloc_array(char, bytes); + text->buffer = global_alloc_array_nothrow(char, bytes); if (!text->buffer) { global_free(text); @@ -99,7 +99,7 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines) } /* allocate memory for the lines array */ - text->lineoffs = (INT32 *)global_alloc_array(INT32, lines); + text->lineoffs = global_alloc_array_nothrow(INT32, lines); if (!text->lineoffs) { global_free_array(text->buffer); diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index 392da316dbb..d33bdb1d78b 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -161,29 +161,27 @@ image_error_t device_image_interface::set_image_filename(const char *filename) zippath_parent(m_working_directory, filename); m_basename.assign(m_image_name); - int loc1 = m_image_name.find_last_of('\\'); - int loc2 = m_image_name.find_last_of('/'); - int loc3 = m_image_name.find_last_of(':'); - int loc = MAX(loc1,MAX(loc2,loc3)); - if (loc!=-1) { + size_t loc1 = m_image_name.find_last_of('\\'); + size_t loc2 = m_image_name.find_last_of('/'); + size_t loc3 = m_image_name.find_last_of(':'); + size_t loc = MAX(loc1,MAX(loc2, loc3)); + if (loc != -1) { if (loc == loc3) { // temp workaround for softlists now that m_image_name contains the part name too (e.g. list:gamename:cart) m_basename = m_basename.substr(0, loc); - std::string tmpstr = std::string(m_basename); - int tmploc = tmpstr.find_last_of(':'); - m_basename = m_basename.substr(tmploc + 1,loc-tmploc); + size_t tmploc = m_basename.find_last_of(':'); + m_basename = m_basename.substr(tmploc + 1, loc - tmploc); } else - m_basename = m_basename.substr(loc + 1, m_basename.length() - loc); + m_basename = m_basename.substr(loc + 1); } - m_basename_noext = m_basename.assign(m_basename); + m_basename_noext = m_basename; m_filetype = ""; loc = m_basename_noext.find_last_of('.'); - if (loc!=-1) { - m_basename_noext = m_basename_noext.substr(0,loc); - m_filetype = m_basename.assign(m_basename); - m_filetype = m_filetype.substr(loc + 1, m_filetype.length() - loc); + if (loc != -1) { + m_basename_noext = m_basename_noext.substr(0, loc); + m_filetype = m_basename.substr(loc + 1); } return IMAGE_ERROR_SUCCESS; diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index 733c99537c7..f1d12757ed7 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -1049,7 +1049,7 @@ void lua_engine::periodic_check() osd_lock_acquire(lock); if (msg.ready == 1) { lua_settop(m_lua_state, 0); - int status = luaL_loadbuffer(m_lua_state, msg.text.c_str(), strlen(msg.text.c_str()), "=stdin"); + int status = luaL_loadbuffer(m_lua_state, msg.text.c_str(), msg.text.length(), "=stdin"); if (incomplete(status)==0) /* cannot try to add lines? */ { if (status == LUA_OK) status = docall(0, LUA_MULTRET); diff --git a/src/emu/render.cpp b/src/emu/render.cpp index baa5aa8db1b..1f8e5d0be1f 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -1055,8 +1055,9 @@ int render_target::configured_view(const char *viewname, int targetindex, int nu if (strcmp(viewname, "auto") != 0) { // scan for a matching view name + size_t viewlen = strlen(viewname); for (view = view_by_index(viewindex = 0); view != nullptr; view = view_by_index(++viewindex)) - if (core_strnicmp(view->name(), viewname, strlen(viewname)) == 0) + if (core_strnicmp(view->name(), viewname, viewlen) == 0) break; } diff --git a/src/emu/sound/wavwrite.cpp b/src/emu/sound/wavwrite.cpp index 210b1bcc9d5..b535e91a675 100644 --- a/src/emu/sound/wavwrite.cpp +++ b/src/emu/sound/wavwrite.cpp @@ -18,7 +18,7 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels) UINT16 align, temp16; /* allocate memory for the wav struct */ - wav = (wav_file *) global_alloc(wav_file); + wav = global_alloc(wav_file); if (!wav) return nullptr; diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp index 1eaa9fe1366..9d96692a15a 100644 --- a/src/emu/ui/miscmenu.cpp +++ b/src/emu/ui/miscmenu.cpp @@ -434,9 +434,9 @@ void ui_menu_crosshair::populate() file_enumerator path(machine().options().crosshair_path()); const osd_directory_entry *dir; /* reset search flags */ - int using_default = false; - int finished = false; - int found = false; + bool using_default = false; + bool finished = false; + bool found = false; /* if we are using the default, then we just need to find the first in the list */ if (*(settings.name) == 0) diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h index b5e6687c4f3..006f972b22b 100644 --- a/src/emu/ui/selgame.h +++ b/src/emu/ui/selgame.h @@ -31,7 +31,7 @@ private: // internal state enum { VISIBLE_GAMES_IN_LIST = 15 }; UINT8 m_error; - UINT8 m_rerandomize; + bool m_rerandomize; char m_search[40]; int m_matchlist[VISIBLE_GAMES_IN_LIST]; std::vector m_driverlist; diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 3f2d252c107..e9a03243eae 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -236,7 +236,7 @@ ui_manager::ui_manager(running_machine &machine) m_handler_param = 0; m_single_step = false; m_showfps = false; - m_showfps_end = false; + m_showfps_end = 0; m_show_profiler = false; m_popup_text_end = 0; m_use_natural_keyboard = false; @@ -1503,7 +1503,6 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co // first draw the FPS counter if (machine.ui().show_fps_counter()) { - std::string tempstring; machine.ui().draw_text_full(container, machine.video().speed_text().c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); } diff --git a/src/emu/video.cpp b/src/emu/video.cpp index 41fb5e1726e..d05a1b8327c 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -584,7 +584,7 @@ void video_manager::postload() // forward //------------------------------------------------- -inline int video_manager::effective_autoframeskip() const +inline bool video_manager::effective_autoframeskip() const { // if we're fast forwarding or paused, autoframeskip is disabled if (m_fastforward || machine().paused()) diff --git a/src/emu/video.h b/src/emu/video.h index 4938cf67f34..aef70a57f15 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -100,7 +100,7 @@ private: void postload(); // effective value helpers - int effective_autoframeskip() const; + bool effective_autoframeskip() const; int effective_frameskip() const; bool effective_throttle() const; diff --git a/src/lib/util/corealloc.h b/src/lib/util/corealloc.h index 4f0b961eb59..2c1df6dd46c 100644 --- a/src/lib/util/corealloc.h +++ b/src/lib/util/corealloc.h @@ -27,7 +27,9 @@ // global allocation helpers -- use these instead of new and delete #define global_alloc(_type) new _type +#define global_alloc_nothrow(_type) new (std::nothrow) _type #define global_alloc_array(_type, _num) new _type[_num] +#define global_alloc_array_nothrow(_type, _num) new (std::nothrow) _type[_num] #define global_free(_ptr) do { delete _ptr; } while (0) #define global_free_array(_ptr) do { delete[] _ptr; } while (0) -- cgit v1.2.3-70-g09d2 From 1e8d53c167439502c84b8bd9b7108af7f99eb2b5 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Fri, 29 Jan 2016 00:47:01 +0100 Subject: wavwrite.cpp: call to nothrow allocation. --- src/emu/sound/wavwrite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emu/sound/wavwrite.cpp b/src/emu/sound/wavwrite.cpp index b535e91a675..173962ea46c 100644 --- a/src/emu/sound/wavwrite.cpp +++ b/src/emu/sound/wavwrite.cpp @@ -18,7 +18,7 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels) UINT16 align, temp16; /* allocate memory for the wav struct */ - wav = global_alloc(wav_file); + wav = global_alloc_nothrow(wav_file); if (!wav) return nullptr; -- cgit v1.2.3-70-g09d2 From c4a66568e7fb1f5a55819974e69eb097bc7fe629 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 29 Jan 2016 01:16:42 +0100 Subject: make internal mousepointer(that big orange one) smaller and less jaggies --- src/emu/ui/ui.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 3f2d252c107..c741d31e970 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -183,7 +183,8 @@ static inline int is_breakable_char(unicode_char ch) CORE IMPLEMENTATION ***************************************************************************/ -static const UINT32 mouse_bitmap[] = { +static const UINT32 mouse_bitmap[32*32] = +{ 0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff, 0x09a46f30,0x81ac7c43,0x24af8049,0x00ad7d45,0x00a8753a,0x00a46f30,0x009f6725,0x009b611c,0x00985b14,0x0095560d,0x00935308,0x00915004,0x00904e02,0x008f4e01,0x008f4d00,0x008f4d00,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff, 0x00a16a29,0xa2aa783d,0xffbb864a,0xc0b0824c,0x5aaf7f48,0x09ac7b42,0x00a9773c,0x00a67134,0x00a26b2b,0x009e6522,0x009a5e19,0x00965911,0x0094550b,0x00925207,0x00915004,0x008f4e01,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff,0x00ffffff, @@ -457,7 +458,7 @@ void ui_manager::update_and_render(render_container *container) { float mouse_y=-1,mouse_x=-1; if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y)) { - container->add_quad(mouse_x,mouse_y,mouse_x + 0.05f*container->manager().ui_aspect(container),mouse_y + 0.05f,UI_TEXT_COLOR,m_mouse_arrow_texture,PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + container->add_quad(mouse_x,mouse_y,mouse_x + 0.02f*container->manager().ui_aspect(container),mouse_y + 0.02f,UI_TEXT_COLOR,m_mouse_arrow_texture,PRIMFLAG_ANTIALIAS(1)|PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); } } } -- cgit v1.2.3-70-g09d2 From 8baa2b6b69c6183670b97026d4785a2afc05ae74 Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 28 Jan 2016 23:33:46 +0100 Subject: overdriv.cpp: screen raw params. --- src/mame/drivers/overdriv.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index c611c2b32eb..d4feb91680c 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -297,10 +297,7 @@ static MACHINE_CONFIG_START( overdriv, overdriv_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(59) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(64*8, 40*8) - MCFG_SCREEN_VISIBLE_AREA(13*8, (64-13)*8-1, 0*8, 32*8-1 ) + MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/4,384,0,305,264,0,224) MCFG_SCREEN_UPDATE_DRIVER(overdriv_state, screen_update_overdriv) MCFG_SCREEN_PALETTE("palette") -- cgit v1.2.3-70-g09d2 From 2323219c5c7b80fefe78c79d14f80a5a1322446d Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 28 Jan 2016 23:49:55 +0100 Subject: Added sound irq ack, removed hack (doesn't seem necessary) --- src/mame/drivers/overdriv.cpp | 17 +++++++++++++---- src/mame/includes/overdriv.h | 4 +--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index d4feb91680c..6af30811242 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -127,9 +127,10 @@ WRITE16_MEMBER(overdriv_state::cpuB_ctrl_w) WRITE16_MEMBER(overdriv_state::overdriv_soundirq_w) { - m_audiocpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE); + m_audiocpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE); } + WRITE16_MEMBER(overdriv_state::overdriv_cpuB_irq_x_w) { m_subcpu->set_input_line(5, HOLD_LINE); // likely wrong @@ -167,7 +168,7 @@ static ADDRESS_MAP_START( overdriv_master_map, AS_PROGRAM, 16, overdriv_state ) AM_RANGE(0x238000, 0x238001) AM_WRITE(overdriv_cpuB_irq_x_w) ADDRESS_MAP_END -// HACK ALERT +#if UNUSED_FUNCTION WRITE16_MEMBER( overdriv_state::overdriv_k053246_word_w ) { m_k053246->k053246_word_w(space,offset,data,mem_mask); @@ -190,6 +191,7 @@ WRITE16_MEMBER( overdriv_state::overdriv_k053246_word_w ) //printf("%02x %04x %04x\n", offset, data, mem_mask); } +#endif static ADDRESS_MAP_START( overdriv_slave_map, AS_PROGRAM, 16, overdriv_state ) AM_RANGE(0x000000, 0x03ffff) AM_ROM @@ -197,17 +199,24 @@ static ADDRESS_MAP_START( overdriv_slave_map, AS_PROGRAM, 16, overdriv_state ) AM_RANGE(0x0c0000, 0x0c1fff) AM_RAM //AM_DEVREADWRITE("k053250_1", k053250_device, ram_r, ram_w) AM_RANGE(0x100000, 0x10000f) AM_DEVREADWRITE("k053250_1", k053250_device, reg_r, reg_w) AM_RANGE(0x108000, 0x10800f) AM_DEVREADWRITE("k053250_2", k053250_device, reg_r, reg_w) - AM_RANGE(0x118000, 0x118fff) AM_RAM AM_SHARE("sprram") //AM_DEVREADWRITE("k053246", k053247_device, k053247_word_r, k053247_word_w) // data gets copied to sprite chip with DMA.. + AM_RANGE(0x118000, 0x118fff) AM_DEVREADWRITE("k053246", k053247_device, k053247_word_r, k053247_word_w) // data gets copied to sprite chip with DMA.. AM_RANGE(0x120000, 0x120001) AM_DEVREAD("k053246", k053247_device, k053246_word_r) AM_RANGE(0x128000, 0x128001) AM_READWRITE(cpuB_ctrl_r, cpuB_ctrl_w) /* enable K053247 ROM reading, plus something else */ - AM_RANGE(0x130000, 0x130007) AM_WRITE(overdriv_k053246_word_w) // AM_DEVWRITE("k053246", k053247_device, k053246_word_w) + AM_RANGE(0x130000, 0x130007) AM_DEVREADWRITE8("k053246", k053247_device, k053246_r,k053246_w,0xffff) AM_RANGE(0x200000, 0x203fff) AM_RAM AM_SHARE("share1") AM_RANGE(0x208000, 0x20bfff) AM_RAM AM_RANGE(0x218000, 0x219fff) AM_DEVREAD("k053250_1", k053250_device, rom_r) AM_RANGE(0x220000, 0x221fff) AM_DEVREAD("k053250_2", k053250_device, rom_r) ADDRESS_MAP_END +WRITE8_MEMBER(overdriv_state::sound_ack_w) +{ + m_audiocpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE); +} + static ADDRESS_MAP_START( overdriv_sound_map, AS_PROGRAM, 8, overdriv_state ) + AM_RANGE(0x0000, 0x0000) AM_WRITE(sound_ack_w) + // 0x180 AM_RANGE(0x0200, 0x0201) AM_DEVREADWRITE("ymsnd", ym2151_device,read,write) AM_RANGE(0x0400, 0x042f) AM_DEVREADWRITE("k053260_1", k053260_device, read, write) AM_RANGE(0x0600, 0x062f) AM_DEVREADWRITE("k053260_2", k053260_device, read, write) diff --git a/src/mame/includes/overdriv.h b/src/mame/includes/overdriv.h index ad0cceba7a7..21652d9f1c8 100644 --- a/src/mame/includes/overdriv.h +++ b/src/mame/includes/overdriv.h @@ -24,7 +24,6 @@ public: m_k053246(*this, "k053246"), m_k053251(*this, "k053251"), m_k053252(*this, "k053252"), - m_sprram(*this, "sprram"), m_screen(*this, "screen") { } @@ -45,13 +44,13 @@ public: required_device m_k053246; required_device m_k053251; required_device m_k053252; - required_shared_ptr m_sprram; required_device m_screen; DECLARE_WRITE16_MEMBER(eeprom_w); DECLARE_WRITE16_MEMBER(cpuA_ctrl_w); DECLARE_READ16_MEMBER(cpuB_ctrl_r); DECLARE_WRITE16_MEMBER(cpuB_ctrl_w); DECLARE_WRITE16_MEMBER(overdriv_soundirq_w); + DECLARE_WRITE8_MEMBER(sound_ack_w); DECLARE_WRITE16_MEMBER(overdriv_cpuB_irq_x_w); DECLARE_WRITE16_MEMBER(overdriv_cpuB_irq_y_w); virtual void machine_start() override; @@ -60,7 +59,6 @@ public: INTERRUPT_GEN_MEMBER(cpuB_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(overdriv_cpuA_scanline); - DECLARE_WRITE16_MEMBER( overdriv_k053246_word_w ); K051316_CB_MEMBER(zoom_callback_1); K051316_CB_MEMBER(zoom_callback_2); K053246_CB_MEMBER(sprite_callback); -- cgit v1.2.3-70-g09d2 From 96c5f17b7372865c855f6d8a1a81797cc89de505 Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 28 Jan 2016 23:57:24 +0100 Subject: Seems to work fine like this, guess that crashing issue is caused by master irqs ... --- src/mame/drivers/overdriv.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index 6af30811242..bfe2fdee79a 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -83,8 +83,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(overdriv_state::overdriv_cpuA_scanline) INTERRUPT_GEN_MEMBER(overdriv_state::cpuB_interrupt) { // this doesn't get turned on until the irq has happened? wrong irq? -// if (m_k053246->k053246_is_irq_enabled()) - m_subcpu->set_input_line(4, HOLD_LINE); // likely wrong + if (m_k053246->k053246_is_irq_enabled()) + m_subcpu->set_input_line(4, HOLD_LINE); // likely wrong } @@ -168,7 +168,7 @@ static ADDRESS_MAP_START( overdriv_master_map, AS_PROGRAM, 16, overdriv_state ) AM_RANGE(0x238000, 0x238001) AM_WRITE(overdriv_cpuB_irq_x_w) ADDRESS_MAP_END -#if UNUSED_FUNCTION +#ifdef UNUSED_FUNCTION WRITE16_MEMBER( overdriv_state::overdriv_k053246_word_w ) { m_k053246->k053246_word_w(space,offset,data,mem_mask); -- cgit v1.2.3-70-g09d2 From 4ad98de1dcdd989df43d6621662224534beb53d8 Mon Sep 17 00:00:00 2001 From: angelosa Date: Fri, 29 Jan 2016 02:01:14 +0100 Subject: Fixed gearbox input, flipped around irqs for testing. --- src/mame/drivers/overdriv.cpp | 28 ++++++++++++++++++++-------- src/mame/includes/overdriv.h | 3 ++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index bfe2fdee79a..be7f0dcbadf 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -70,21 +70,32 @@ WRITE16_MEMBER(overdriv_state::eeprom_w) TIMER_DEVICE_CALLBACK_MEMBER(overdriv_state::overdriv_cpuA_scanline) { + const int timer_threshold = 160; int scanline = param; - - /* TODO: irqs routines are TOO slow right now, it ends up firing spurious irqs for whatever reason (shared ram fighting?) */ - /* this is a temporary solution to get rid of deprecat lib and the crashes, but also makes the game timer to be too slow */ - if(scanline == 256 && m_screen->frame_number() & 1) // vblank-out irq + + m_fake_timer ++; + + // TODO: irqs routines are TOO slow right now, it ends up firing spurious irqs for whatever reason (shared ram fighting?) + // this is a temporary solution to get rid of deprecat lib and the crashes, but also makes the game timer to be too slow. + // Update: gameplay is actually too fast compared to timer, first attract mode shouldn't even surpass first blue car on right. + if(scanline == 256) // vblank-out irq + { + // m_screen->frame_number() & 1 m_maincpu->set_input_line(4, HOLD_LINE); - else if((scanline % 128) == 0) // timer irq + m_subcpu->set_input_line(4, HOLD_LINE); // likely wrong + } + else if(m_fake_timer >= timer_threshold) // timer irq + { + m_fake_timer -= timer_threshold; m_maincpu->set_input_line(5, HOLD_LINE); + } } INTERRUPT_GEN_MEMBER(overdriv_state::cpuB_interrupt) { // this doesn't get turned on until the irq has happened? wrong irq? if (m_k053246->k053246_is_irq_enabled()) - m_subcpu->set_input_line(4, HOLD_LINE); // likely wrong + m_subcpu->set_input_line(6, HOLD_LINE); // likely wrong } @@ -138,7 +149,6 @@ WRITE16_MEMBER(overdriv_state::overdriv_cpuB_irq_x_w) WRITE16_MEMBER(overdriv_state::overdriv_cpuB_irq_y_w) { - m_subcpu->set_input_line(6, HOLD_LINE); // likely wrong } static ADDRESS_MAP_START( overdriv_master_map, AS_PROGRAM, 16, overdriv_state ) @@ -203,6 +213,7 @@ static ADDRESS_MAP_START( overdriv_slave_map, AS_PROGRAM, 16, overdriv_state ) AM_RANGE(0x120000, 0x120001) AM_DEVREAD("k053246", k053247_device, k053246_word_r) AM_RANGE(0x128000, 0x128001) AM_READWRITE(cpuB_ctrl_r, cpuB_ctrl_w) /* enable K053247 ROM reading, plus something else */ AM_RANGE(0x130000, 0x130007) AM_DEVREADWRITE8("k053246", k053247_device, k053246_r,k053246_w,0xffff) + //AM_RANGE(0x140000, 0x140001) used in later stages AM_RANGE(0x200000, 0x203fff) AM_RAM AM_SHARE("share1") AM_RANGE(0x208000, 0x20bfff) AM_RAM AM_RANGE(0x218000, 0x219fff) AM_DEVREAD("k053250_1", k053250_device, rom_r) @@ -216,6 +227,7 @@ WRITE8_MEMBER(overdriv_state::sound_ack_w) static ADDRESS_MAP_START( overdriv_sound_map, AS_PROGRAM, 8, overdriv_state ) AM_RANGE(0x0000, 0x0000) AM_WRITE(sound_ack_w) + // 0x012 read during explosions // 0x180 AM_RANGE(0x0200, 0x0201) AM_DEVREADWRITE("ymsnd", ym2151_device,read,write) AM_RANGE(0x0400, 0x042f) AM_DEVREADWRITE("k053260_1", k053260_device, read, write) @@ -231,7 +243,7 @@ ADDRESS_MAP_END static INPUT_PORTS_START( overdriv ) PORT_START("INPUTS") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_TOGGLE + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_TOGGLE PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) diff --git a/src/mame/includes/overdriv.h b/src/mame/includes/overdriv.h index 21652d9f1c8..b5a7c8fa2e0 100644 --- a/src/mame/includes/overdriv.h +++ b/src/mame/includes/overdriv.h @@ -58,7 +58,8 @@ public: UINT32 screen_update_overdriv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(cpuB_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(overdriv_cpuA_scanline); - + int m_fake_timer; + K051316_CB_MEMBER(zoom_callback_1); K051316_CB_MEMBER(zoom_callback_2); K053246_CB_MEMBER(sprite_callback); -- cgit v1.2.3-70-g09d2 From d6eb0aff225e14cdb09a0668dd38f86db93c56f0 Mon Sep 17 00:00:00 2001 From: angelosa Date: Fri, 29 Jan 2016 02:12:45 +0100 Subject: Raw guessing, nw --- src/mame/drivers/overdriv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index be7f0dcbadf..0dd10fd84e6 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -70,7 +70,7 @@ WRITE16_MEMBER(overdriv_state::eeprom_w) TIMER_DEVICE_CALLBACK_MEMBER(overdriv_state::overdriv_cpuA_scanline) { - const int timer_threshold = 160; + const int timer_threshold = 168; // fwiw matches 0 on mask ROM check, so IF it's a timer irq then should be close ... int scanline = param; m_fake_timer ++; -- cgit v1.2.3-70-g09d2 From d207322c523704f8dbeec4e4566fee2edf7c0ca3 Mon Sep 17 00:00:00 2001 From: angelosa Date: Fri, 29 Jan 2016 02:19:29 +0100 Subject: Note about versions, nw --- src/mame/drivers/overdriv.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index 0dd10fd84e6..7d14ae9aca0 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -493,6 +493,6 @@ ROM_START( overdrivb ) ROM_LOAD( "789e02.f1", 0x100000, 0x100000, CRC(bdd3b5c6) SHA1(412332d64052c0a3714f4002c944b0e7d32980a4) ) ROM_END -GAMEL( 1990, overdriv, 0, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE, layout_overdriv ) -GAMEL( 1990, overdriva, overdriv, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE, layout_overdriv ) -GAMEL( 1990, overdrivb, overdriv, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 3)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE, layout_overdriv ) +GAMEL( 1990, overdriv, 0, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE, layout_overdriv ) // US version +GAMEL( 1990, overdriva, overdriv, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE, layout_overdriv ) // Overseas? +GAMEL( 1990, overdrivb, overdriv, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 3)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE, layout_overdriv ) // Overseas? -- cgit v1.2.3-70-g09d2 From 81c5bc7afcac8b626cdc69c5fd4ee112d7a2eade Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 29 Jan 2016 09:18:07 +0100 Subject: added clickable artwork flag to some game drivers --- src/mame/drivers/fidel6502.cpp | 34 ++++++++++------------------------ src/mame/drivers/hh_cop400.cpp | 2 +- src/mame/drivers/hh_tms1k.cpp | 10 +++++----- src/mame/drivers/tispeak.cpp | 8 ++++---- 4 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index ed4f53cf112..eb7f45070a8 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -36,16 +36,17 @@ public: : fidelz80base_state(mconfig, type, tag), m_6821pia(*this, "6821pia"), m_cart(*this, "cartslot"), - m_speaker(*this, "speaker"), - m_irq_off(*this, "irq_off") + m_speaker(*this, "speaker") { } // devices/pointers optional_device m_6821pia; optional_device m_cart; optional_device m_speaker; - optional_device m_irq_off; + TIMER_DEVICE_CALLBACK_MEMBER(irq_on) { m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); } + TIMER_DEVICE_CALLBACK_MEMBER(irq_off) { m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); } + // model CSC void csc_update_7442(); void csc_prepare_display(); @@ -65,8 +66,6 @@ public: // model SC12 DECLARE_MACHINE_START(sc12); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(scc_cartridge); - TIMER_DEVICE_CALLBACK_MEMBER(irq_off); - TIMER_DEVICE_CALLBACK_MEMBER(sc12_irq); DECLARE_WRITE8_MEMBER(sc12_control_w); DECLARE_READ8_MEMBER(sc12_input_r); }; @@ -247,20 +246,6 @@ MACHINE_START_MEMBER(fidel6502_state, sc12) } -// interrupt handling - -TIMER_DEVICE_CALLBACK_MEMBER(fidel6502_state::irq_off) -{ - m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); -} - -TIMER_DEVICE_CALLBACK_MEMBER(fidel6502_state::sc12_irq) -{ - m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); - m_irq_off->adjust(attotime::from_nsec(15250)); // active low for 15.25us -} - - // TTL WRITE8_MEMBER(fidel6502_state::sc12_control_w) @@ -571,8 +556,9 @@ static MACHINE_CONFIG_START( sc12, fidel6502_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", R65C02, XTAL_4MHz) MCFG_CPU_PROGRAM_MAP(sc12_map) - MCFG_TIMER_DRIVER_ADD_PERIODIC("sc12_irq", fidel6502_state, sc12_irq, attotime::from_hz(780)) // from 556 timer - MCFG_TIMER_DRIVER_ADD("irq_off", fidel6502_state, irq_off) + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(780)) // from 556 timer + MCFG_TIMER_START_DELAY(attotime::from_hz(780) - attotime::from_nsec(15250)) // active for 15.25us + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel6502_state, irq_off, attotime::from_hz(780)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_sc12) @@ -595,7 +581,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_START( fev, fidel6502_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M65SC02, XTAL_3MHz) // M65SC102 (CMD) + MCFG_CPU_ADD("maincpu", M65SC02, XTAL_12MHz/4) // G65SC102 MCFG_CPU_PROGRAM_MAP(fev_map) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) @@ -649,6 +635,6 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ COMP( 1981, csc, 0, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_NOT_WORKING ) +COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1987, fexcelv, 0, 0, fev, csc, driver_device, 0, "Fidelity Electronics", "Voice Excellence", MACHINE_NOT_WORKING ) +COMP( 1987, fexcelv, 0, 0, fev, csc, driver_device, 0, "Fidelity Electronics", "Voice Excellence", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/hh_cop400.cpp b/src/mame/drivers/hh_cop400.cpp index 486f6882b28..a4605bbace2 100644 --- a/src/mame/drivers/hh_cop400.cpp +++ b/src/mame/drivers/hh_cop400.cpp @@ -824,4 +824,4 @@ CONS( 1979, funjacks, 0, 0, funjacks, funjacks, driver_device, 0, "Mat CONS( 1979, funrlgl, 0, 0, funrlgl, funrlgl, driver_device, 0, "Mattel", "Funtronics Red Light Green Light", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) CONS( 1980, plus1, 0, 0, plus1, plus1, driver_device, 0, "Milton Bradley", "Plus One", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -CONS( 1981, lightfgt, 0, 0, lightfgt, lightfgt, driver_device, 0, "Milton Bradley", "Lightfight", MACHINE_SUPPORTS_SAVE ) +CONS( 1981, lightfgt, 0, 0, lightfgt, lightfgt, driver_device, 0, "Milton Bradley", "Lightfight", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index d87600f8326..11e09d59804 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -4909,19 +4909,19 @@ COMP( 1979, astro, 0, 0, astro, astro, driver_device, 0, "Kos CONS( 1980, mdndclab, 0, 0, mdndclab, mdndclab, driver_device, 0, "Mattel", "Dungeons & Dragons - Computer Labyrinth Game", MACHINE_SUPPORTS_SAVE ) // *** CONS( 1977, comp4, 0, 0, comp4, comp4, driver_device, 0, "Milton Bradley", "Comp IV", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -CONS( 1978, simon, 0, 0, simon, simon, driver_device, 0, "Milton Bradley", "Simon (Rev. A)", MACHINE_SUPPORTS_SAVE ) -CONS( 1979, ssimon, 0, 0, ssimon, ssimon, driver_device, 0, "Milton Bradley", "Super Simon", MACHINE_SUPPORTS_SAVE ) +CONS( 1978, simon, 0, 0, simon, simon, driver_device, 0, "Milton Bradley", "Simon (Rev. A)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1979, ssimon, 0, 0, ssimon, ssimon, driver_device, 0, "Milton Bradley", "Super Simon", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) CONS( 1979, bigtrak, 0, 0, bigtrak, bigtrak, driver_device, 0, "Milton Bradley", "Big Trak", MACHINE_SUPPORTS_SAVE | MACHINE_MECHANICAL ) // *** CONS( 1977, cnsector, 0, 0, cnsector, cnsector, driver_device, 0, "Parker Brothers", "Code Name: Sector", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) // *** -CONS( 1978, merlin, 0, 0, merlin, merlin, driver_device, 0, "Parker Brothers", "Merlin - The Electronic Wizard", MACHINE_SUPPORTS_SAVE ) +CONS( 1978, merlin, 0, 0, merlin, merlin, driver_device, 0, "Parker Brothers", "Merlin - The Electronic Wizard", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) CONS( 1979, stopthie, 0, 0, stopthief, stopthief, driver_device, 0, "Parker Brothers", "Stop Thief (Electronic Crime Scanner)", MACHINE_SUPPORTS_SAVE ) // *** CONS( 1979, stopthiep, stopthie, 0, stopthief, stopthief, driver_device, 0, "Parker Brothers", "Stop Thief (Electronic Crime Scanner) (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) CONS( 1980, bankshot, 0, 0, bankshot, bankshot, driver_device, 0, "Parker Brothers", "Bank Shot - Electronic Pool", MACHINE_SUPPORTS_SAVE ) CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", MACHINE_SUPPORTS_SAVE ) -CONS( 1982, mmerlin, 0, 0, mmerlin, mmerlin, driver_device, 0, "Parker Brothers", "Master Merlin", MACHINE_SUPPORTS_SAVE ) +CONS( 1982, mmerlin, 0, 0, mmerlin, mmerlin, driver_device, 0, "Parker Brothers", "Master Merlin", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1981, tandy12, 0, 0, tandy12, tandy12, driver_device, 0, "Tandy Radio Shack", "Tandy-12: Computerized Arcade", MACHINE_SUPPORTS_SAVE ) // some of the minigames: *** +CONS( 1981, tandy12, 0, 0, tandy12, tandy12, driver_device, 0, "Tandy Radio Shack", "Tandy-12: Computerized Arcade", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // some of the minigames: *** CONS( 1979, tbreakup, 0, 0, tbreakup, tbreakup, driver_device, 0, "Tomy", "Break Up (Tomy)", MACHINE_SUPPORTS_SAVE ) CONS( 1980, phpball, 0, 0, phpball, phpball, driver_device, 0, "Tomy", "Power House Pinball", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index 205574b0a5e..124edffd379 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -1558,9 +1558,9 @@ COMP( 1980, snread, 0, 0, snread, snread, tispeak_state, sn COMP( 1979, lantutor, 0, 0, lantutor, lantutor, tispeak_state, lantutor, "Texas Instruments", "Language Tutor (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) -COMP( 1981, tntell, 0, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (US, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) // assume there is an older version too, with CD8010 MCU -COMP( 1980, tntellp, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) -COMP( 1981, tntelluk, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (UK)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) -COMP( 1981, tntellfr, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Le Livre Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) +COMP( 1981, tntell, 0, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (US, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK | MACHINE_REQUIRES_ARTWORK ) // assume there is an older version too, with CD8010 MCU +COMP( 1980, tntellp, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) +COMP( 1981, tntelluk, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (UK)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK | MACHINE_REQUIRES_ARTWORK ) +COMP( 1981, tntellfr, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Le Livre Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK | MACHINE_REQUIRES_ARTWORK ) COMP( 1982, vocaid, 0, 0, vocaid, tntell, driver_device, 0, "Texas Instruments", "Vocaid", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) -- cgit v1.2.3-70-g09d2 From e0da1a72887864ee7fbc9914c54216fb28646d56 Mon Sep 17 00:00:00 2001 From: mahlemiut Date: Fri, 29 Jan 2016 22:20:39 +1300 Subject: SDL: if binding, listening or connecting to a socket fails, then close the socket handle. --- src/osd/sdl/sdlfile.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/osd/sdl/sdlfile.cpp b/src/osd/sdl/sdlfile.cpp index b6088c8aa54..1f6832b03dd 100644 --- a/src/osd/sdl/sdlfile.cpp +++ b/src/osd/sdl/sdlfile.cpp @@ -134,6 +134,8 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64 { (*file)->type = SDLFILE_SOCKET; filerr = sdl_open_socket(path, openflags, file, filesize); + if(filerr != FILERR_NONE && (*file)->socket != -1) + close((*file)->socket); goto error; } -- cgit v1.2.3-70-g09d2 From 042050ef67a0d320469a6f8ca74bd8684ec4c409 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 29 Jan 2016 11:47:40 +0100 Subject: Added Google Benchmark library (nw) Included sample benchmark for eminline for native and noasm Made GoogleTest compile only if tests are compiled --- .gitignore | 1 + 3rdparty/benchmark/.gitignore | 46 ++ 3rdparty/benchmark/.travis-setup.sh | 26 + 3rdparty/benchmark/.travis.yml | 41 + 3rdparty/benchmark/.ycm_extra_conf.py | 115 +++ 3rdparty/benchmark/AUTHORS | 30 + 3rdparty/benchmark/CMakeLists.txt | 112 +++ 3rdparty/benchmark/CONTRIBUTING.md | 58 ++ 3rdparty/benchmark/CONTRIBUTORS | 46 ++ 3rdparty/benchmark/LICENSE | 202 +++++ 3rdparty/benchmark/README.md | 295 +++++++ 3rdparty/benchmark/appveyor.yml | 55 ++ 3rdparty/benchmark/cmake/AddCXXCompilerFlag.cmake | 37 + 3rdparty/benchmark/cmake/CXXFeatureCheck.cmake | 39 + 3rdparty/benchmark/cmake/GetGitVersion.cmake | 51 ++ 3rdparty/benchmark/cmake/gnu_posix_regex.cpp | 12 + 3rdparty/benchmark/cmake/posix_regex.cpp | 12 + 3rdparty/benchmark/cmake/std_regex.cpp | 10 + 3rdparty/benchmark/cmake/steady_clock.cpp | 7 + .../benchmark/cmake/thread_safety_attributes.cpp | 4 + 3rdparty/benchmark/include/benchmark/benchmark.h | 21 + .../benchmark/include/benchmark/benchmark_api.h | 602 ++++++++++++++ 3rdparty/benchmark/include/benchmark/macros.h | 48 ++ 3rdparty/benchmark/include/benchmark/reporter.h | 122 +++ 3rdparty/benchmark/mingw.py | 320 +++++++ 3rdparty/benchmark/src/CMakeLists.txt | 51 ++ 3rdparty/benchmark/src/arraysize.h | 34 + 3rdparty/benchmark/src/benchmark.cc | 919 +++++++++++++++++++++ 3rdparty/benchmark/src/check.h | 60 ++ 3rdparty/benchmark/src/colorprint.cc | 116 +++ 3rdparty/benchmark/src/colorprint.h | 19 + 3rdparty/benchmark/src/commandlineflags.cc | 220 +++++ 3rdparty/benchmark/src/commandlineflags.h | 76 ++ 3rdparty/benchmark/src/console_reporter.cc | 116 +++ 3rdparty/benchmark/src/csv_reporter.cc | 105 +++ 3rdparty/benchmark/src/cycleclock.h | 137 +++ 3rdparty/benchmark/src/internal_macros.h | 40 + 3rdparty/benchmark/src/json_reporter.cc | 159 ++++ 3rdparty/benchmark/src/log.cc | 40 + 3rdparty/benchmark/src/log.h | 28 + 3rdparty/benchmark/src/mutex.h | 142 ++++ 3rdparty/benchmark/src/re.h | 60 ++ 3rdparty/benchmark/src/re_posix.cc | 59 ++ 3rdparty/benchmark/src/re_std.cc | 44 + 3rdparty/benchmark/src/reporter.cc | 86 ++ 3rdparty/benchmark/src/sleep.cc | 50 ++ 3rdparty/benchmark/src/sleep.h | 17 + 3rdparty/benchmark/src/stat.h | 307 +++++++ 3rdparty/benchmark/src/string_util.cc | 169 ++++ 3rdparty/benchmark/src/string_util.h | 44 + 3rdparty/benchmark/src/sysinfo.cc | 416 ++++++++++ 3rdparty/benchmark/src/sysinfo.h | 12 + 3rdparty/benchmark/src/walltime.cc | 263 ++++++ 3rdparty/benchmark/src/walltime.h | 17 + 3rdparty/benchmark/test/CMakeLists.txt | 89 ++ 3rdparty/benchmark/test/basic_test.cc | 102 +++ 3rdparty/benchmark/test/benchmark_test.cc | 154 ++++ 3rdparty/benchmark/test/cxx03_test.cc | 31 + 3rdparty/benchmark/test/filter_test.cc | 91 ++ 3rdparty/benchmark/test/fixture_test.cc | 42 + 3rdparty/benchmark/test/options_test.cc | 26 + benchmarks/eminline_native.cpp | 15 + benchmarks/eminline_noasm.cpp | 24 + benchmarks/main.cpp | 6 + makefile | 6 + scripts/genie.lua | 10 + scripts/src/3rdparty.lua | 36 - scripts/src/benchmarks.lua | 74 ++ scripts/src/tests.lua | 98 ++- 69 files changed, 6855 insertions(+), 67 deletions(-) create mode 100644 3rdparty/benchmark/.gitignore create mode 100644 3rdparty/benchmark/.travis-setup.sh create mode 100644 3rdparty/benchmark/.travis.yml create mode 100644 3rdparty/benchmark/.ycm_extra_conf.py create mode 100644 3rdparty/benchmark/AUTHORS create mode 100644 3rdparty/benchmark/CMakeLists.txt create mode 100644 3rdparty/benchmark/CONTRIBUTING.md create mode 100644 3rdparty/benchmark/CONTRIBUTORS create mode 100644 3rdparty/benchmark/LICENSE create mode 100644 3rdparty/benchmark/README.md create mode 100644 3rdparty/benchmark/appveyor.yml create mode 100644 3rdparty/benchmark/cmake/AddCXXCompilerFlag.cmake create mode 100644 3rdparty/benchmark/cmake/CXXFeatureCheck.cmake create mode 100644 3rdparty/benchmark/cmake/GetGitVersion.cmake create mode 100644 3rdparty/benchmark/cmake/gnu_posix_regex.cpp create mode 100644 3rdparty/benchmark/cmake/posix_regex.cpp create mode 100644 3rdparty/benchmark/cmake/std_regex.cpp create mode 100644 3rdparty/benchmark/cmake/steady_clock.cpp create mode 100644 3rdparty/benchmark/cmake/thread_safety_attributes.cpp create mode 100644 3rdparty/benchmark/include/benchmark/benchmark.h create mode 100644 3rdparty/benchmark/include/benchmark/benchmark_api.h create mode 100644 3rdparty/benchmark/include/benchmark/macros.h create mode 100644 3rdparty/benchmark/include/benchmark/reporter.h create mode 100644 3rdparty/benchmark/mingw.py create mode 100644 3rdparty/benchmark/src/CMakeLists.txt create mode 100644 3rdparty/benchmark/src/arraysize.h create mode 100644 3rdparty/benchmark/src/benchmark.cc create mode 100644 3rdparty/benchmark/src/check.h create mode 100644 3rdparty/benchmark/src/colorprint.cc create mode 100644 3rdparty/benchmark/src/colorprint.h create mode 100644 3rdparty/benchmark/src/commandlineflags.cc create mode 100644 3rdparty/benchmark/src/commandlineflags.h create mode 100644 3rdparty/benchmark/src/console_reporter.cc create mode 100644 3rdparty/benchmark/src/csv_reporter.cc create mode 100644 3rdparty/benchmark/src/cycleclock.h create mode 100644 3rdparty/benchmark/src/internal_macros.h create mode 100644 3rdparty/benchmark/src/json_reporter.cc create mode 100644 3rdparty/benchmark/src/log.cc create mode 100644 3rdparty/benchmark/src/log.h create mode 100644 3rdparty/benchmark/src/mutex.h create mode 100644 3rdparty/benchmark/src/re.h create mode 100644 3rdparty/benchmark/src/re_posix.cc create mode 100644 3rdparty/benchmark/src/re_std.cc create mode 100644 3rdparty/benchmark/src/reporter.cc create mode 100644 3rdparty/benchmark/src/sleep.cc create mode 100644 3rdparty/benchmark/src/sleep.h create mode 100644 3rdparty/benchmark/src/stat.h create mode 100644 3rdparty/benchmark/src/string_util.cc create mode 100644 3rdparty/benchmark/src/string_util.h create mode 100644 3rdparty/benchmark/src/sysinfo.cc create mode 100644 3rdparty/benchmark/src/sysinfo.h create mode 100644 3rdparty/benchmark/src/walltime.cc create mode 100644 3rdparty/benchmark/src/walltime.h create mode 100644 3rdparty/benchmark/test/CMakeLists.txt create mode 100644 3rdparty/benchmark/test/basic_test.cc create mode 100644 3rdparty/benchmark/test/benchmark_test.cc create mode 100644 3rdparty/benchmark/test/cxx03_test.cc create mode 100644 3rdparty/benchmark/test/filter_test.cc create mode 100644 3rdparty/benchmark/test/fixture_test.cc create mode 100644 3rdparty/benchmark/test/options_test.cc create mode 100644 benchmarks/eminline_native.cpp create mode 100644 benchmarks/eminline_noasm.cpp create mode 100644 benchmarks/main.cpp create mode 100644 scripts/src/benchmarks.lua diff --git a/.gitignore b/.gitignore index 1e1afa52def..e3efcc2cd0a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /* /*/ !/3rdparty/ +!/benchmarks/ !/artwork/ !/docs/ !/hash/ diff --git a/3rdparty/benchmark/.gitignore b/3rdparty/benchmark/.gitignore new file mode 100644 index 00000000000..3c1b4f2183e --- /dev/null +++ b/3rdparty/benchmark/.gitignore @@ -0,0 +1,46 @@ +*.a +*.so +*.so.?* +*.dll +*.exe +*.dylib +*.cmake +!/cmake/*.cmake +*~ +*.pyc +__pycache__ + +# lcov +*.lcov +/lcov + +# cmake files. +/Testing +CMakeCache.txt +CMakeFiles/ +cmake_install.cmake + +# makefiles. +Makefile + +# in-source build. +bin/ +lib/ +/test/*_test + +# exuberant ctags. +tags + +# YouCompleteMe configuration. +.ycm_extra_conf.pyc + +# ninja generated files. +.ninja_deps +.ninja_log +build.ninja +install_manifest.txt +rules.ninja + +# out-of-source build top-level folders. +build/ +_build/ diff --git a/3rdparty/benchmark/.travis-setup.sh b/3rdparty/benchmark/.travis-setup.sh new file mode 100644 index 00000000000..c900fa9331a --- /dev/null +++ b/3rdparty/benchmark/.travis-setup.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# Before install + +sudo add-apt-repository -y ppa:kalakris/cmake +if [ "$STD" = "c++11" ]; then + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + if [ "$CXX" = "clang++" ]; then + wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository -y "deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.6 main" + fi +fi +sudo apt-get update -qq + +# Install +sudo apt-get install -qq cmake +if [ "$STD" = "c++11" ] && [ "$CXX" = "g++" ]; then + sudo apt-get install -qq gcc-4.8 g++-4.8 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90 +elif [ "$CXX" = "clang++" ]; then + sudo apt-get install -qq clang-3.6 + sudo update-alternatives --install /usr/local/bin/clang clang /usr/bin/clang-3.6 90 + sudo update-alternatives --install /usr/local/bin/clang++ clang++ /usr/bin/clang++-3.6 90 + export PATH=/usr/local/bin:$PATH +fi diff --git a/3rdparty/benchmark/.travis.yml b/3rdparty/benchmark/.travis.yml new file mode 100644 index 00000000000..8b138ce134d --- /dev/null +++ b/3rdparty/benchmark/.travis.yml @@ -0,0 +1,41 @@ +language: cpp + +# NOTE: The COMPILER variable is unused. It simply makes the display on +# travis-ci.org more readable. +matrix: + include: + - compiler: gcc + env: COMPILER=g++-4.6 STD=c++0x BUILD_TYPE=Coverage + - compiler: gcc + env: COMPILER=g++-4.6 STD=c++0x BUILD_TYPE=Debug + - compiler: gcc + env: COMPILER=g++-4.6 STD=c++0x BUILD_TYPE=Release + - compiler: gcc + env: COMPILER=g++-4.8 STD=c++11 BUILD_TYPE=Debug + - compiler: gcc + env: COMPILER=g++-4.8 STD=c++11 BUILD_TYPE=Release + - compiler: clang + env: COMPILER=clang++-3.6 STD=c++11 BUILD_TYPE=Debug + - compiler: clang + env: COMPILER=clang++-3.6 STD=c++11 BUILD_TYPE=Release + +before_script: + - source .travis-setup.sh + - mkdir build && cd build + +install: + - if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then + PATH=~/.local/bin:${PATH}; + pip install --user --upgrade pip; + pip install --user cpp-coveralls; + fi + +script: + - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="-std=${STD}" + - make + - make CTEST_OUTPUT_ON_FAILURE=1 test + +after_success: + - if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then + coveralls --include src --include include --gcov-options '\-lp' --root .. --build-root .; + fi diff --git a/3rdparty/benchmark/.ycm_extra_conf.py b/3rdparty/benchmark/.ycm_extra_conf.py new file mode 100644 index 00000000000..86194357da6 --- /dev/null +++ b/3rdparty/benchmark/.ycm_extra_conf.py @@ -0,0 +1,115 @@ +import os +import ycm_core + +# These are the compilation flags that will be used in case there's no +# compilation database set (by default, one is not set). +# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. +flags = [ +'-Wall', +'-Werror', +'-pendantic-errors', +'-std=c++0x', +'-fno-strict-aliasing', +'-O3', +'-DNDEBUG', +# ...and the same thing goes for the magic -x option which specifies the +# language that the files to be compiled are written in. This is mostly +# relevant for c++ headers. +# For a C project, you would set this to 'c' instead of 'c++'. +'-x', 'c++', +'-I', 'include', +'-isystem', '/usr/include', +'-isystem', '/usr/local/include', +] + + +# Set this to the absolute path to the folder (NOT the file!) containing the +# compile_commands.json file to use that instead of 'flags'. See here for +# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html +# +# Most projects will NOT need to set this to anything; you can just change the +# 'flags' list of compilation flags. Notice that YCM itself uses that approach. +compilation_database_folder = '' + +if os.path.exists( compilation_database_folder ): + database = ycm_core.CompilationDatabase( compilation_database_folder ) +else: + database = None + +SOURCE_EXTENSIONS = [ '.cc' ] + +def DirectoryOfThisScript(): + return os.path.dirname( os.path.abspath( __file__ ) ) + + +def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): + if not working_directory: + return list( flags ) + new_flags = [] + make_next_absolute = False + path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ] + for flag in flags: + new_flag = flag + + if make_next_absolute: + make_next_absolute = False + if not flag.startswith( '/' ): + new_flag = os.path.join( working_directory, flag ) + + for path_flag in path_flags: + if flag == path_flag: + make_next_absolute = True + break + + if flag.startswith( path_flag ): + path = flag[ len( path_flag ): ] + new_flag = path_flag + os.path.join( working_directory, path ) + break + + if new_flag: + new_flags.append( new_flag ) + return new_flags + + +def IsHeaderFile( filename ): + extension = os.path.splitext( filename )[ 1 ] + return extension in [ '.h', '.hxx', '.hpp', '.hh' ] + + +def GetCompilationInfoForFile( filename ): + # The compilation_commands.json file generated by CMake does not have entries + # for header files. So we do our best by asking the db for flags for a + # corresponding source file, if any. If one exists, the flags for that file + # should be good enough. + if IsHeaderFile( filename ): + basename = os.path.splitext( filename )[ 0 ] + for extension in SOURCE_EXTENSIONS: + replacement_file = basename + extension + if os.path.exists( replacement_file ): + compilation_info = database.GetCompilationInfoForFile( + replacement_file ) + if compilation_info.compiler_flags_: + return compilation_info + return None + return database.GetCompilationInfoForFile( filename ) + + +def FlagsForFile( filename, **kwargs ): + if database: + # Bear in mind that compilation_info.compiler_flags_ does NOT return a + # python list, but a "list-like" StringVec object + compilation_info = GetCompilationInfoForFile( filename ) + if not compilation_info: + return None + + final_flags = MakeRelativePathsInFlagsAbsolute( + compilation_info.compiler_flags_, + compilation_info.compiler_working_dir_ ) + else: + relative_to = DirectoryOfThisScript() + final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to ) + + return { + 'flags': final_flags, + 'do_cache': True + } diff --git a/3rdparty/benchmark/AUTHORS b/3rdparty/benchmark/AUTHORS new file mode 100644 index 00000000000..5a4b35535e2 --- /dev/null +++ b/3rdparty/benchmark/AUTHORS @@ -0,0 +1,30 @@ +# This is the official list of benchmark authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS files. +# See the latter for an explanation. +# +# Names should be added to this file as: +# Name or Organization +# The email address is not required for organizations. +# +# Please keep the list sorted. + +Arne Beer +Christopher Seymour +David Coeurjolly +Dominic Hamon +Eugene Zhuk +Evgeny Safronov +Felix Homann +Google Inc. +JianXiong Zhou +Kaito Udagawa +Lei Xu +Matt Clarkson +Oleksandr Sochka +Paul Redmond +Radoslav Yovchev +Shuo Chen +Yusuke Suzuki +Dirac Research +Zbigniew Skowron +Dominik Czarnota diff --git a/3rdparty/benchmark/CMakeLists.txt b/3rdparty/benchmark/CMakeLists.txt new file mode 100644 index 00000000000..a753ad64b35 --- /dev/null +++ b/3rdparty/benchmark/CMakeLists.txt @@ -0,0 +1,112 @@ +cmake_minimum_required (VERSION 2.8.11) +project (benchmark) + +option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON) +option(BENCHMARK_ENABLE_LTO "Enable link time optimisation of the benchmark library." OFF) +# Make sure we can import out CMake functions +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +# Read the git tags to determine the project version +include(GetGitVersion) +get_git_version(GIT_VERSION) + +# Tell the user what versions we are using +string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION ${GIT_VERSION}) +message("-- Version: ${VERSION}") + +# The version of the libraries +set(GENERIC_LIB_VERSION ${VERSION}) +string(SUBSTRING ${VERSION} 0 1 GENERIC_LIB_SOVERSION) + +# Import our CMake modules +include(CheckCXXCompilerFlag) +include(AddCXXCompilerFlag) +include(CXXFeatureCheck) + +# Try and enable C++11. Don't use C++14 because it doesn't work in some +# configurations. +add_cxx_compiler_flag(-std=c++11) +if (NOT HAVE_CXX_FLAG_STD_CXX11) + add_cxx_compiler_flag(-std=c++0x) +endif() + +# Turn compiler warnings up to 11 +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_cxx_compiler_flag(-W4) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +else() + add_cxx_compiler_flag(-Wall) +endif() +add_cxx_compiler_flag(-Wextra) +add_cxx_compiler_flag(-Wshadow) +add_cxx_compiler_flag(-Werror RELEASE) +add_cxx_compiler_flag(-pedantic) +add_cxx_compiler_flag(-pedantic-errors) +add_cxx_compiler_flag(-Wshorten-64-to-32) +add_cxx_compiler_flag(-Wfloat-equal) +add_cxx_compiler_flag(-Wzero-as-null-pointer-constant) +add_cxx_compiler_flag(-fstrict-aliasing) +if (HAVE_CXX_FLAG_FSTRICT_ALIASING) + add_cxx_compiler_flag(-Wstrict-aliasing) +endif() +add_cxx_compiler_flag(-Wthread-safety) +if (HAVE_WTHREAD_SAFETY) + add_definitions(-DHAVE_WTHREAD_SAFETY) + cxx_feature_check(THREAD_SAFETY_ATTRIBUTES) +endif() + +# Link time optimisation +if (BENCHMARK_ENABLE_LTO) + add_cxx_compiler_flag(-flto) + if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + find_program(GCC_AR gcc-ar) + if (GCC_AR) + set(CMAKE_AR ${GCC_AR}) + endif() + find_program(GCC_RANLIB gcc-ranlib) + if (GCC_RANLIB) + set(CMAKE_RANLIB ${GCC_RANLIB}) + endif() + endif() +endif() + +# Coverage build type +set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING + "Flags used by the C++ compiler during coverage builds." + FORCE) +set(CMAKE_EXE_LINKER_FLAGS_COVERAGE + "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING + "Flags used for linking binaries during coverage builds." + FORCE) +set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE + "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING + "Flags used by the shared libraries linker during coverage builds." + FORCE) +mark_as_advanced( + CMAKE_CXX_FLAGS_COVERAGE + CMAKE_EXE_LINKER_FLAGS_COVERAGE + CMAKE_SHARED_LINKER_FLAGS_COVERAGE) +set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage." + FORCE) +add_cxx_compiler_flag(--coverage COVERAGE) + +# C++ feature checks +cxx_feature_check(STD_REGEX) +cxx_feature_check(GNU_POSIX_REGEX) +cxx_feature_check(POSIX_REGEX) +cxx_feature_check(STEADY_CLOCK) + +# Ensure we have pthreads +find_package(Threads REQUIRED) + +# Set up directories +include_directories(${PROJECT_SOURCE_DIR}/include) + +# Build the targets +add_subdirectory(src) + +if (BENCHMARK_ENABLE_TESTING) + enable_testing() + add_subdirectory(test) +endif() diff --git a/3rdparty/benchmark/CONTRIBUTING.md b/3rdparty/benchmark/CONTRIBUTING.md new file mode 100644 index 00000000000..43de4c9d470 --- /dev/null +++ b/3rdparty/benchmark/CONTRIBUTING.md @@ -0,0 +1,58 @@ +# How to contribute # + +We'd love to accept your patches and contributions to this project. There are +a just a few small guidelines you need to follow. + + +## Contributor License Agreement ## + +Contributions to any Google project must be accompanied by a Contributor +License Agreement. This is not a copyright **assignment**, it simply gives +Google permission to use and redistribute your contributions as part of the +project. + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual + CLA][]. + + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA][]. + +You generally only need to submit a CLA once, so if you've already submitted +one (even if it was for a different project), you probably don't need to do it +again. + +[individual CLA]: https://developers.google.com/open-source/cla/individual +[corporate CLA]: https://developers.google.com/open-source/cla/corporate + +Once your CLA is submitted (or if you already submitted one for +another Google project), make a commit adding yourself to the +[AUTHORS][] and [CONTRIBUTORS][] files. This commit can be part +of your first [pull request][]. + +[AUTHORS]: AUTHORS +[CONTRIBUTORS]: CONTRIBUTORS + + +## Submitting a patch ## + + 1. It's generally best to start by opening a new issue describing the bug or + feature you're intending to fix. Even if you think it's relatively minor, + it's helpful to know what people are working on. Mention in the initial + issue that you are planning to work on that bug or feature so that it can + be assigned to you. + + 1. Follow the normal process of [forking][] the project, and setup a new + branch to work in. It's important that each group of changes be done in + separate branches in order to ensure that a pull request only includes the + commits related to that bug or feature. + + 1. Do your best to have [well-formed commit messages][] for each change. + This provides consistency throughout the project, and ensures that commit + messages are able to be formatted properly by various git tools. + + 1. Finally, push the commits to your fork and submit a [pull request][]. + +[forking]: https://help.github.com/articles/fork-a-repo +[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html +[pull request]: https://help.github.com/articles/creating-a-pull-request diff --git a/3rdparty/benchmark/CONTRIBUTORS b/3rdparty/benchmark/CONTRIBUTORS new file mode 100644 index 00000000000..ed55bcf2767 --- /dev/null +++ b/3rdparty/benchmark/CONTRIBUTORS @@ -0,0 +1,46 @@ +# People who have agreed to one of the CLAs and can contribute patches. +# The AUTHORS file lists the copyright holders; this file +# lists people. For example, Google employees are listed here +# but not in AUTHORS, because Google holds the copyright. +# +# Names should be added to this file only after verifying that +# the individual or the individual's organization has agreed to +# the appropriate Contributor License Agreement, found here: +# +# https://developers.google.com/open-source/cla/individual +# https://developers.google.com/open-source/cla/corporate +# +# The agreement for individuals can be filled out on the web. +# +# When adding J Random Contributor's name to this file, +# either J's name or J's organization's name should be +# added to the AUTHORS file, depending on whether the +# individual or corporate CLA was used. +# +# Names should be added to this file as: +# Name +# +# Please keep the list sorted. + +Arne Beer +Chris Kennelly +Christopher Seymour +David Coeurjolly +Dominic Hamon +Eugene Zhuk +Evgeny Safronov +Felix Homann +JianXiong Zhou +Kaito Udagawa +Lei Xu +Matt Clarkson +Oleksandr Sochka +Pascal Leroy +Paul Redmond +Pierre Phaneuf +Radoslav Yovchev +Shuo Chen +Yusuke Suzuki +Tobias Ulvgård +Zbigniew Skowron +Dominik Czarnota diff --git a/3rdparty/benchmark/LICENSE b/3rdparty/benchmark/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/3rdparty/benchmark/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/3rdparty/benchmark/README.md b/3rdparty/benchmark/README.md new file mode 100644 index 00000000000..1fa7186ec40 --- /dev/null +++ b/3rdparty/benchmark/README.md @@ -0,0 +1,295 @@ +benchmark +========= +[![Build Status](https://travis-ci.org/google/benchmark.svg?branch=master)](https://travis-ci.org/google/benchmark) +[![Build status](https://ci.appveyor.com/api/projects/status/u0qsyp7t1tk7cpxs/branch/master?svg=true)](https://ci.appveyor.com/project/google/benchmark/branch/master) +[![Coverage Status](https://coveralls.io/repos/google/benchmark/badge.svg)](https://coveralls.io/r/google/benchmark) + +A library to support the benchmarking of functions, similar to unit-tests. + +Discussion group: https://groups.google.com/d/forum/benchmark-discuss + +IRC channel: https://freenode.net #googlebenchmark + +Example usage +------------- +Define a function that executes the code to be measured a +specified number of times: + +```c++ +static void BM_StringCreation(benchmark::State& state) { + while (state.KeepRunning()) + std::string empty_string; +} +// Register the function as a benchmark +BENCHMARK(BM_StringCreation); + +// Define another benchmark +static void BM_StringCopy(benchmark::State& state) { + std::string x = "hello"; + while (state.KeepRunning()) + std::string copy(x); +} +BENCHMARK(BM_StringCopy); + +BENCHMARK_MAIN(); +``` + +Sometimes a family of microbenchmarks can be implemented with +just one routine that takes an extra argument to specify which +one of the family of benchmarks to run. For example, the following +code defines a family of microbenchmarks for measuring the speed +of `memcpy()` calls of different lengths: + +```c++ +static void BM_memcpy(benchmark::State& state) { + char* src = new char[state.range_x()]; char* dst = new char[state.range_x()]; + memset(src, 'x', state.range_x()); + while (state.KeepRunning()) + memcpy(dst, src, state.range_x()); + state.SetBytesProcessed(int64_t(state.iterations()) * + int64_t(state.range_x())); + delete[] src; + delete[] dst; +} +BENCHMARK(BM_memcpy)->Arg(8)->Arg(64)->Arg(512)->Arg(1<<10)->Arg(8<<10); +``` + +The preceding code is quite repetitive, and can be replaced with the +following short-hand. The following invocation will pick a few +appropriate arguments in the specified range and will generate a +microbenchmark for each such argument. + +```c++ +BENCHMARK(BM_memcpy)->Range(8, 8<<10); +``` + +You might have a microbenchmark that depends on two inputs. For +example, the following code defines a family of microbenchmarks for +measuring the speed of set insertion. + +```c++ +static void BM_SetInsert(benchmark::State& state) { + while (state.KeepRunning()) { + state.PauseTiming(); + std::set data = ConstructRandomSet(state.range_x()); + state.ResumeTiming(); + for (int j = 0; j < state.range_y(); ++j) + data.insert(RandomNumber()); + } +} +BENCHMARK(BM_SetInsert) + ->ArgPair(1<<10, 1) + ->ArgPair(1<<10, 8) + ->ArgPair(1<<10, 64) + ->ArgPair(1<<10, 512) + ->ArgPair(8<<10, 1) + ->ArgPair(8<<10, 8) + ->ArgPair(8<<10, 64) + ->ArgPair(8<<10, 512); +``` + +The preceding code is quite repetitive, and can be replaced with +the following short-hand. The following macro will pick a few +appropriate arguments in the product of the two specified ranges +and will generate a microbenchmark for each such pair. + +```c++ +BENCHMARK(BM_SetInsert)->RangePair(1<<10, 8<<10, 1, 512); +``` + +For more complex patterns of inputs, passing a custom function +to Apply allows programmatic specification of an +arbitrary set of arguments to run the microbenchmark on. +The following example enumerates a dense range on one parameter, +and a sparse range on the second. + +```c++ +static void CustomArguments(benchmark::internal::Benchmark* b) { + for (int i = 0; i <= 10; ++i) + for (int j = 32; j <= 1024*1024; j *= 8) + b->ArgPair(i, j); +} +BENCHMARK(BM_SetInsert)->Apply(CustomArguments); +``` + +Templated microbenchmarks work the same way: +Produce then consume 'size' messages 'iters' times +Measures throughput in the absence of multiprogramming. + +```c++ +template int BM_Sequential(benchmark::State& state) { + Q q; + typename Q::value_type v; + while (state.KeepRunning()) { + for (int i = state.range_x(); i--; ) + q.push(v); + for (int e = state.range_x(); e--; ) + q.Wait(&v); + } + // actually messages, not bytes: + state.SetBytesProcessed( + static_cast(state.iterations())*state.range_x()); +} +BENCHMARK_TEMPLATE(BM_Sequential, WaitQueue)->Range(1<<0, 1<<10); +``` + +Three macros are provided for adding benchmark templates. + +```c++ +#if __cplusplus >= 201103L // C++11 and greater. +#define BENCHMARK_TEMPLATE(func, ...) // Takes any number of parameters. +#else // C++ < C++11 +#define BENCHMARK_TEMPLATE(func, arg1) +#endif +#define BENCHMARK_TEMPLATE1(func, arg1) +#define BENCHMARK_TEMPLATE2(func, arg1, arg2) +``` + +In a multithreaded test (benchmark invoked by multiple threads simultaneously), +it is guaranteed that none of the threads will start until all have called +KeepRunning, and all will have finished before KeepRunning returns false. As +such, any global setup or teardown you want to do can be +wrapped in a check against the thread index: + +```c++ +static void BM_MultiThreaded(benchmark::State& state) { + if (state.thread_index == 0) { + // Setup code here. + } + while (state.KeepRunning()) { + // Run the test as normal. + } + if (state.thread_index == 0) { + // Teardown code here. + } +} +BENCHMARK(BM_MultiThreaded)->Threads(2); +``` + +If the benchmarked code itself uses threads and you want to compare it to +single-threaded code, you may want to use real-time ("wallclock") measurements +for latency comparisons: + +```c++ +BENCHMARK(BM_test)->Range(8, 8<<10)->UseRealTime(); +``` + +Without `UseRealTime`, CPU time is used by default. + +To prevent a value or expression from being optimized away by the compiler +the `benchmark::DoNotOptimize(...)` function can be used. + +```c++ +static void BM_test(benchmark::State& state) { + while (state.KeepRunning()) { + int x = 0; + for (int i=0; i < 64; ++i) { + benchmark::DoNotOptimize(x += i); + } + } +} +``` + +Benchmark Fixtures +------------------ +Fixture tests are created by +first defining a type that derives from ::benchmark::Fixture and then +creating/registering the tests using the following macros: + +* `BENCHMARK_F(ClassName, Method)` +* `BENCHMARK_DEFINE_F(ClassName, Method)` +* `BENCHMARK_REGISTER_F(ClassName, Method)` + +For Example: + +```c++ +class MyFixture : public benchmark::Fixture {}; + +BENCHMARK_F(MyFixture, FooTest)(benchmark::State& st) { + while (st.KeepRunning()) { + ... + } +} + +BENCHMARK_DEFINE_F(MyFixture, BarTest)(benchmark::State& st) { + while (st.KeepRunning()) { + ... + } +} +/* BarTest is NOT registered */ +BENCHMARK_REGISTER_F(MyFixture, BarTest)->Threads(2); +/* BarTest is now registered */ +``` + +Output Formats +-------------- +The library supports multiple output formats. Use the +`--benchmark_format=` flag to set the format type. `tabular` is +the default format. + +The Tabular format is intended to be a human readable format. By default +the format generates color output. Context is output on stderr and the +tabular data on stdout. Example tabular output looks like: +``` +Benchmark Time(ns) CPU(ns) Iterations +---------------------------------------------------------------------- +BM_SetInsert/1024/1 28928 29349 23853 133.097kB/s 33.2742k items/s +BM_SetInsert/1024/8 32065 32913 21375 949.487kB/s 237.372k items/s +BM_SetInsert/1024/10 33157 33648 21431 1.13369MB/s 290.225k items/s +``` + +The JSON format outputs human readable json split into two top level attributes. +The `context` attribute contains information about the run in general, including +information about the CPU and the date. +The `benchmarks` attribute contains a list of ever benchmark run. Example json +output looks like: +``` +{ + "context": { + "date": "2015/03/17-18:40:25", + "num_cpus": 40, + "mhz_per_cpu": 2801, + "cpu_scaling_enabled": false, + "build_type": "debug" + }, + "benchmarks": [ + { + "name": "BM_SetInsert/1024/1", + "iterations": 94877, + "real_time": 29275, + "cpu_time": 29836, + "bytes_per_second": 134066, + "items_per_second": 33516 + }, + { + "name": "BM_SetInsert/1024/8", + "iterations": 21609, + "real_time": 32317, + "cpu_time": 32429, + "bytes_per_second": 986770, + "items_per_second": 246693 + }, + { + "name": "BM_SetInsert/1024/10", + "iterations": 21393, + "real_time": 32724, + "cpu_time": 33355, + "bytes_per_second": 1199226, + "items_per_second": 299807 + } + ] +} +``` + +The CSV format outputs comma-separated values. The `context` is output on stderr +and the CSV itself on stdout. Example CSV output looks like: +``` +name,iterations,real_time,cpu_time,bytes_per_second,items_per_second,label +"BM_SetInsert/1024/1",65465,17890.7,8407.45,475768,118942, +"BM_SetInsert/1024/8",116606,18810.1,9766.64,3.27646e+06,819115, +"BM_SetInsert/1024/10",106365,17238.4,8421.53,4.74973e+06,1.18743e+06, +``` + +Linking against the library +--------------------------- +When using gcc, it is necessary to link against pthread to avoid runtime exceptions. This is due to how gcc implements std::thread. See [issue #67](https://github.com/google/benchmark/issues/67) for more details. diff --git a/3rdparty/benchmark/appveyor.yml b/3rdparty/benchmark/appveyor.yml new file mode 100644 index 00000000000..5368a4ac009 --- /dev/null +++ b/3rdparty/benchmark/appveyor.yml @@ -0,0 +1,55 @@ +version: '{build}' + +configuration: + - Static Debug + - Static Release +# - Shared Debug +# - Shared Release + +platform: + - x86 + - x64 + +environment: + matrix: + - compiler: gcc-4.9.2-posix +# - compiler: gcc-4.8.4-posix +# - compiler: msvc-12-seh + +install: + # derive some extra information + - for /f "tokens=1-2" %%a in ("%configuration%") do (@set "linkage=%%a") + - for /f "tokens=1-2" %%a in ("%configuration%") do (@set "variant=%%b") + - if "%linkage%"=="Shared" (set shared=YES) else (set shared=NO) + - for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_name=%%a") + - for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_version=%%b") + - for /f "tokens=1-3 delims=-" %%a in ("%compiler%") do (@set "compiler_threading=%%c") + - if "%platform%"=="x64" (set arch=x86_64) + - if "%platform%"=="x86" (set arch=i686) + # download the specific version of MinGW + - if "%compiler_name%"=="gcc" (for /f %%a in ('python mingw.py --quiet --version "%compiler_version%" --arch "%arch%" --threading "%compiler_threading%" --location "C:\mingw-builds"') do @set "compiler_path=%%a") + +before_build: + # Set up mingw commands + - if "%compiler_name%"=="gcc" (set "generator=MinGW Makefiles") + - if "%compiler_name%"=="gcc" (set "build=mingw32-make -j4") + - if "%compiler_name%"=="gcc" (set "test=mingw32-make CTEST_OUTPUT_ON_FAILURE=1 test") + # msvc specific commands + # TODO :) + # add the compiler path if needed + - if not "%compiler_path%"=="" (set "PATH=%PATH%;%compiler_path%") + # git bash conflicts with MinGW makefiles + - if "%generator%"=="MinGW Makefiles" (set "PATH=%PATH:C:\Program Files (x86)\Git\bin=%") + +build_script: + - cmake -G "%generator%" "-DCMAKE_BUILD_TYPE=%variant%" "-DBUILD_SHARED_LIBS=%shared%" + - cmd /c "%build%" + +test_script: + - cmd /c "%test%" + +matrix: + fast_finish: true + +cache: + - C:\mingw-builds diff --git a/3rdparty/benchmark/cmake/AddCXXCompilerFlag.cmake b/3rdparty/benchmark/cmake/AddCXXCompilerFlag.cmake new file mode 100644 index 00000000000..870f11ae4d8 --- /dev/null +++ b/3rdparty/benchmark/cmake/AddCXXCompilerFlag.cmake @@ -0,0 +1,37 @@ +# - Adds a compiler flag if it is supported by the compiler +# +# This function checks that the supplied compiler flag is supported and then +# adds it to the corresponding compiler flags +# +# add_cxx_compiler_flag( []) +# +# - Example +# +# include(AddCXXCompilerFlag) +# add_cxx_compiler_flag(-Wall) +# add_cxx_compiler_flag(-no-strict-aliasing RELEASE) +# Requires CMake 2.6+ + +if(__add_cxx_compiler_flag) + return() +endif() +set(__add_cxx_compiler_flag INCLUDED) + +include(CheckCXXCompilerFlag) + +function(add_cxx_compiler_flag FLAG) + string(TOUPPER "HAVE_CXX_FLAG_${FLAG}" SANITIZED_FLAG) + string(REPLACE "+" "X" SANITIZED_FLAG ${SANITIZED_FLAG}) + string(REGEX REPLACE "[^A-Za-z_0-9]" "_" SANITIZED_FLAG ${SANITIZED_FLAG}) + string(REGEX REPLACE "_+" "_" SANITIZED_FLAG ${SANITIZED_FLAG}) + set(CMAKE_REQUIRED_FLAGS "${FLAG}") + check_cxx_compiler_flag("" ${SANITIZED_FLAG}) + if(${SANITIZED_FLAG}) + set(VARIANT ${ARGV1}) + if(ARGV1) + string(TOUPPER "_${VARIANT}" VARIANT) + endif() + set(CMAKE_CXX_FLAGS${VARIANT} "${CMAKE_CXX_FLAGS${VARIANT}} ${FLAG}" PARENT_SCOPE) + endif() +endfunction() + diff --git a/3rdparty/benchmark/cmake/CXXFeatureCheck.cmake b/3rdparty/benchmark/cmake/CXXFeatureCheck.cmake new file mode 100644 index 00000000000..23ee8ac6572 --- /dev/null +++ b/3rdparty/benchmark/cmake/CXXFeatureCheck.cmake @@ -0,0 +1,39 @@ +# - Compile and run code to check for C++ features +# +# This functions compiles a source file under the `cmake` folder +# and adds the corresponding `HAVE_[FILENAME]` flag to the CMake +# environment +# +# cxx_feature_check( []) +# +# - Example +# +# include(CXXFeatureCheck) +# cxx_feature_check(STD_REGEX) +# Requires CMake 2.6+ + +if(__cxx_feature_check) + return() +endif() +set(__cxx_feature_check INCLUDED) + +function(cxx_feature_check FILE) + string(TOLOWER ${FILE} FILE) + string(TOUPPER ${FILE} VAR) + string(TOUPPER "HAVE_${VAR}" FEATURE) + message("-- Performing Test ${FEATURE}") + try_run(RUN_${FEATURE} COMPILE_${FEATURE} + ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp) + if(RUN_${FEATURE} EQUAL 0) + message("-- Performing Test ${FEATURE} -- success") + set(HAVE_${VAR} 1 PARENT_SCOPE) + add_definitions(-DHAVE_${VAR}) + else() + if(NOT COMPILE_${FEATURE}) + message("-- Performing Test ${FEATURE} -- failed to compile") + else() + message("-- Performing Test ${FEATURE} -- compiled but failed to run") + endif() + endif() +endfunction() + diff --git a/3rdparty/benchmark/cmake/GetGitVersion.cmake b/3rdparty/benchmark/cmake/GetGitVersion.cmake new file mode 100644 index 00000000000..8dd94800459 --- /dev/null +++ b/3rdparty/benchmark/cmake/GetGitVersion.cmake @@ -0,0 +1,51 @@ +# - Returns a version string from Git tags +# +# This function inspects the annotated git tags for the project and returns a string +# into a CMake variable +# +# get_git_version() +# +# - Example +# +# include(GetGitVersion) +# get_git_version(GIT_VERSION) +# +# Requires CMake 2.8.11+ +find_package(Git) + +if(__get_git_version) + return() +endif() +set(__get_git_version INCLUDED) + +function(get_git_version var) + if(GIT_EXECUTABLE) + execute_process(COMMAND ${GIT_EXECUTABLE} describe --match "v[0-9]*.[0-9]*.[0-9]*" --abbrev=8 + RESULT_VARIABLE status + OUTPUT_VARIABLE GIT_VERSION + ERROR_QUIET) + if(${status}) + set(GIT_VERSION "v0.0.0") + else() + string(STRIP ${GIT_VERSION} GIT_VERSION) + string(REGEX REPLACE "-[0-9]+-g" "-" GIT_VERSION ${GIT_VERSION}) + endif() + + # Work out if the repository is dirty + execute_process(COMMAND ${GIT_EXECUTABLE} update-index -q --refresh + OUTPUT_QUIET + ERROR_QUIET) + execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD -- + OUTPUT_VARIABLE GIT_DIFF_INDEX + ERROR_QUIET) + string(COMPARE NOTEQUAL "${GIT_DIFF_INDEX}" "" GIT_DIRTY) + if (${GIT_DIRTY}) + set(GIT_VERSION "${GIT_VERSION}-dirty") + endif() + else() + set(GIT_VERSION "v0.0.0") + endif() + + message("-- git Version: ${GIT_VERSION}") + set(${var} ${GIT_VERSION} PARENT_SCOPE) +endfunction() diff --git a/3rdparty/benchmark/cmake/gnu_posix_regex.cpp b/3rdparty/benchmark/cmake/gnu_posix_regex.cpp new file mode 100644 index 00000000000..b5b91cdab7c --- /dev/null +++ b/3rdparty/benchmark/cmake/gnu_posix_regex.cpp @@ -0,0 +1,12 @@ +#include +#include +int main() { + std::string str = "test0159"; + regex_t re; + int ec = regcomp(&re, "^[a-z]+[0-9]+$", REG_EXTENDED | REG_NOSUB); + if (ec != 0) { + return ec; + } + return regexec(&re, str.c_str(), 0, nullptr, 0) ? -1 : 0; +} + diff --git a/3rdparty/benchmark/cmake/posix_regex.cpp b/3rdparty/benchmark/cmake/posix_regex.cpp new file mode 100644 index 00000000000..a31af80481a --- /dev/null +++ b/3rdparty/benchmark/cmake/posix_regex.cpp @@ -0,0 +1,12 @@ +#include +#include +int main() { + std::string str = "test0159"; + regex_t re; + int ec = regcomp(&re, "^[a-z]+[0-9]+$", REG_EXTENDED | REG_NOSUB); + if (ec != 0) { + return ec; + } + return regexec(&re, str.c_str(), 0, nullptr, 0) ? -1 : 0; +} + diff --git a/3rdparty/benchmark/cmake/std_regex.cpp b/3rdparty/benchmark/cmake/std_regex.cpp new file mode 100644 index 00000000000..696f2a26bce --- /dev/null +++ b/3rdparty/benchmark/cmake/std_regex.cpp @@ -0,0 +1,10 @@ +#include +#include +int main() { + const std::string str = "test0159"; + std::regex re; + re = std::regex("^[a-z]+[0-9]+$", + std::regex_constants::extended | std::regex_constants::nosubs); + return std::regex_search(str, re) ? 0 : -1; +} + diff --git a/3rdparty/benchmark/cmake/steady_clock.cpp b/3rdparty/benchmark/cmake/steady_clock.cpp new file mode 100644 index 00000000000..66d50d17e9e --- /dev/null +++ b/3rdparty/benchmark/cmake/steady_clock.cpp @@ -0,0 +1,7 @@ +#include + +int main() { + typedef std::chrono::steady_clock Clock; + Clock::time_point tp = Clock::now(); + ((void)tp); +} diff --git a/3rdparty/benchmark/cmake/thread_safety_attributes.cpp b/3rdparty/benchmark/cmake/thread_safety_attributes.cpp new file mode 100644 index 00000000000..46161babdb1 --- /dev/null +++ b/3rdparty/benchmark/cmake/thread_safety_attributes.cpp @@ -0,0 +1,4 @@ +#define HAVE_THREAD_SAFETY_ATTRIBUTES +#include "../src/mutex.h" + +int main() {} diff --git a/3rdparty/benchmark/include/benchmark/benchmark.h b/3rdparty/benchmark/include/benchmark/benchmark.h new file mode 100644 index 00000000000..18aa9e634cb --- /dev/null +++ b/3rdparty/benchmark/include/benchmark/benchmark.h @@ -0,0 +1,21 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef BENCHMARK_BENCHMARK_H_ +#define BENCHMARK_BENCHMARK_H_ + +#include "macros.h" +#include "benchmark_api.h" +#include "reporter.h" + +#endif // BENCHMARK_BENCHMARK_H_ diff --git a/3rdparty/benchmark/include/benchmark/benchmark_api.h b/3rdparty/benchmark/include/benchmark/benchmark_api.h new file mode 100644 index 00000000000..5523587834a --- /dev/null +++ b/3rdparty/benchmark/include/benchmark/benchmark_api.h @@ -0,0 +1,602 @@ +// Support for registering benchmarks for functions. + +/* Example usage: +// Define a function that executes the code to be measured a +// specified number of times: +static void BM_StringCreation(benchmark::State& state) { + while (state.KeepRunning()) + std::string empty_string; +} + +// Register the function as a benchmark +BENCHMARK(BM_StringCreation); + +// Define another benchmark +static void BM_StringCopy(benchmark::State& state) { + std::string x = "hello"; + while (state.KeepRunning()) + std::string copy(x); +} +BENCHMARK(BM_StringCopy); + +// Augment the main() program to invoke benchmarks if specified +// via the --benchmarks command line flag. E.g., +// my_unittest --benchmark_filter=all +// my_unittest --benchmark_filter=BM_StringCreation +// my_unittest --benchmark_filter=String +// my_unittest --benchmark_filter='Copy|Creation' +int main(int argc, char** argv) { + benchmark::Initialize(&argc, argv); + benchmark::RunSpecifiedBenchmarks(); + return 0; +} + +// Sometimes a family of microbenchmarks can be implemented with +// just one routine that takes an extra argument to specify which +// one of the family of benchmarks to run. For example, the following +// code defines a family of microbenchmarks for measuring the speed +// of memcpy() calls of different lengths: + +static void BM_memcpy(benchmark::State& state) { + char* src = new char[state.range_x()]; char* dst = new char[state.range_x()]; + memset(src, 'x', state.range_x()); + while (state.KeepRunning()) + memcpy(dst, src, state.range_x()); + state.SetBytesProcessed(int64_t(state.iterations()) * + int64_t(state.range_x())); + delete[] src; delete[] dst; +} +BENCHMARK(BM_memcpy)->Arg(8)->Arg(64)->Arg(512)->Arg(1<<10)->Arg(8<<10); + +// The preceding code is quite repetitive, and can be replaced with the +// following short-hand. The following invocation will pick a few +// appropriate arguments in the specified range and will generate a +// microbenchmark for each such argument. +BENCHMARK(BM_memcpy)->Range(8, 8<<10); + +// You might have a microbenchmark that depends on two inputs. For +// example, the following code defines a family of microbenchmarks for +// measuring the speed of set insertion. +static void BM_SetInsert(benchmark::State& state) { + while (state.KeepRunning()) { + state.PauseTiming(); + set data = ConstructRandomSet(state.range_x()); + state.ResumeTiming(); + for (int j = 0; j < state.range_y(); ++j) + data.insert(RandomNumber()); + } +} +BENCHMARK(BM_SetInsert) + ->ArgPair(1<<10, 1) + ->ArgPair(1<<10, 8) + ->ArgPair(1<<10, 64) + ->ArgPair(1<<10, 512) + ->ArgPair(8<<10, 1) + ->ArgPair(8<<10, 8) + ->ArgPair(8<<10, 64) + ->ArgPair(8<<10, 512); + +// The preceding code is quite repetitive, and can be replaced with +// the following short-hand. The following macro will pick a few +// appropriate arguments in the product of the two specified ranges +// and will generate a microbenchmark for each such pair. +BENCHMARK(BM_SetInsert)->RangePair(1<<10, 8<<10, 1, 512); + +// For more complex patterns of inputs, passing a custom function +// to Apply allows programmatic specification of an +// arbitrary set of arguments to run the microbenchmark on. +// The following example enumerates a dense range on +// one parameter, and a sparse range on the second. +static void CustomArguments(benchmark::internal::Benchmark* b) { + for (int i = 0; i <= 10; ++i) + for (int j = 32; j <= 1024*1024; j *= 8) + b->ArgPair(i, j); +} +BENCHMARK(BM_SetInsert)->Apply(CustomArguments); + +// Templated microbenchmarks work the same way: +// Produce then consume 'size' messages 'iters' times +// Measures throughput in the absence of multiprogramming. +template int BM_Sequential(benchmark::State& state) { + Q q; + typename Q::value_type v; + while (state.KeepRunning()) { + for (int i = state.range_x(); i--; ) + q.push(v); + for (int e = state.range_x(); e--; ) + q.Wait(&v); + } + // actually messages, not bytes: + state.SetBytesProcessed( + static_cast(state.iterations())*state.range_x()); +} +BENCHMARK_TEMPLATE(BM_Sequential, WaitQueue)->Range(1<<0, 1<<10); + +Use `Benchmark::MinTime(double t)` to set the minimum time used to run the +benchmark. This option overrides the `benchmark_min_time` flag. + +void BM_test(benchmark::State& state) { + ... body ... +} +BENCHMARK(BM_test)->MinTime(2.0); // Run for at least 2 seconds. + +In a multithreaded test, it is guaranteed that none of the threads will start +until all have called KeepRunning, and all will have finished before KeepRunning +returns false. As such, any global setup or teardown you want to do can be +wrapped in a check against the thread index: + +static void BM_MultiThreaded(benchmark::State& state) { + if (state.thread_index == 0) { + // Setup code here. + } + while (state.KeepRunning()) { + // Run the test as normal. + } + if (state.thread_index == 0) { + // Teardown code here. + } +} +BENCHMARK(BM_MultiThreaded)->Threads(4); +*/ + +#ifndef BENCHMARK_BENCHMARK_API_H_ +#define BENCHMARK_BENCHMARK_API_H_ + +#include +#include +#include + +#include "macros.h" + +namespace benchmark { +class BenchmarkReporter; + +void Initialize(int* argc, char** argv); + +// Otherwise, run all benchmarks specified by the --benchmark_filter flag, +// and exit after running the benchmarks. +void RunSpecifiedBenchmarks(); +void RunSpecifiedBenchmarks(BenchmarkReporter* reporter); + +// If this routine is called, peak memory allocation past this point in the +// benchmark is reported at the end of the benchmark report line. (It is +// computed by running the benchmark once with a single iteration and a memory +// tracer.) +// TODO(dominic) +// void MemoryUsage(); + +namespace internal { +class Benchmark; +class BenchmarkImp; +class BenchmarkFamilies; + +template struct Voider { + typedef void type; +}; + +template +struct EnableIfString {}; + +template +struct EnableIfString::type> { + typedef int type; +}; + +void UseCharPointer(char const volatile*); + +// Take ownership of the pointer and register the benchmark. Return the +// registered benchmark. +Benchmark* RegisterBenchmarkInternal(Benchmark*); + +} // end namespace internal + + +// The DoNotOptimize(...) function can be used to prevent a value or +// expression from being optimized away by the compiler. This function is +// intented to add little to no overhead. +// See: http://stackoverflow.com/questions/28287064 +#if defined(__clang__) && defined(__GNUC__) +// TODO(ericwf): Clang has a bug where it tries to always use a register +// even if value must be stored in memory. This causes codegen to fail. +// To work around this we remove the "r" modifier so the operand is always +// loaded into memory. +template +inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) { + asm volatile("" : "+m" (const_cast(value))); +} +#elif defined(__GNUC__) +template +inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) { + asm volatile("" : "+rm" (const_cast(value))); +} +#else +template +inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) { + internal::UseCharPointer(&reinterpret_cast(value)); +} +#endif + + +// State is passed to a running Benchmark and contains state for the +// benchmark to use. +class State { +public: + State(size_t max_iters, bool has_x, int x, bool has_y, int y, int thread_i); + + // Returns true iff the benchmark should continue through another iteration. + // NOTE: A benchmark may not return from the test until KeepRunning() has + // returned false. + bool KeepRunning() { + if (BENCHMARK_BUILTIN_EXPECT(!started_, false)) { + ResumeTiming(); + started_ = true; + } + bool const res = total_iterations_++ < max_iterations; + if (BENCHMARK_BUILTIN_EXPECT(!res, false)) { + assert(started_); + PauseTiming(); + // Total iterations now is one greater than max iterations. Fix this. + total_iterations_ = max_iterations; + } + return res; + } + + // REQUIRES: timer is running + // Stop the benchmark timer. If not called, the timer will be + // automatically stopped after KeepRunning() returns false for the first time. + // + // For threaded benchmarks the PauseTiming() function acts + // like a barrier. I.e., the ith call by a particular thread to this + // function will block until all threads have made their ith call. + // The timer will stop when the last thread has called this function. + // + // NOTE: PauseTiming()/ResumeTiming() are relatively + // heavyweight, and so their use should generally be avoided + // within each benchmark iteration, if possible. + void PauseTiming(); + + // REQUIRES: timer is not running + // Start the benchmark timer. The timer is NOT running on entrance to the + // benchmark function. It begins running after the first call to KeepRunning() + // + // For threaded benchmarks the ResumeTiming() function acts + // like a barrier. I.e., the ith call by a particular thread to this + // function will block until all threads have made their ith call. + // The timer will start when the last thread has called this function. + // + // NOTE: PauseTiming()/ResumeTiming() are relatively + // heavyweight, and so their use should generally be avoided + // within each benchmark iteration, if possible. + void ResumeTiming(); + + // Set the number of bytes processed by the current benchmark + // execution. This routine is typically called once at the end of a + // throughput oriented benchmark. If this routine is called with a + // value > 0, the report is printed in MB/sec instead of nanoseconds + // per iteration. + // + // REQUIRES: a benchmark has exited its KeepRunning loop. + BENCHMARK_ALWAYS_INLINE + void SetBytesProcessed(size_t bytes) { + bytes_processed_ = bytes; + } + + BENCHMARK_ALWAYS_INLINE + size_t bytes_processed() const { + return bytes_processed_; + } + + // If this routine is called with items > 0, then an items/s + // label is printed on the benchmark report line for the currently + // executing benchmark. It is typically called at the end of a processing + // benchmark where a processing items/second output is desired. + // + // REQUIRES: a benchmark has exited its KeepRunning loop. + BENCHMARK_ALWAYS_INLINE + void SetItemsProcessed(size_t items) { + items_processed_ = items; + } + + BENCHMARK_ALWAYS_INLINE + size_t items_processed() const { + return items_processed_; + } + + // If this routine is called, the specified label is printed at the + // end of the benchmark report line for the currently executing + // benchmark. Example: + // static void BM_Compress(int iters) { + // ... + // double compress = input_size / output_size; + // benchmark::SetLabel(StringPrintf("compress:%.1f%%", 100.0*compression)); + // } + // Produces output that looks like: + // BM_Compress 50 50 14115038 compress:27.3% + // + // REQUIRES: a benchmark has exited its KeepRunning loop. + void SetLabel(const char* label); + + // Allow the use of std::string without actually including . + // This function does not participate in overload resolution unless StringType + // has the nested typename `basic_string`. This typename should be provided + // as an injected class name in the case of std::string. + template + void SetLabel(StringType const & str, + typename internal::EnableIfString::type = 1) { + this->SetLabel(str.c_str()); + } + + // Range arguments for this run. CHECKs if the argument has been set. + BENCHMARK_ALWAYS_INLINE + int range_x() const { + assert(has_range_x_); + ((void)has_range_x_); // Prevent unused warning. + return range_x_; + } + + BENCHMARK_ALWAYS_INLINE + int range_y() const { + assert(has_range_y_); + ((void)has_range_y_); // Prevent unused warning. + return range_y_; + } + + BENCHMARK_ALWAYS_INLINE + size_t iterations() const { return total_iterations_; } + +private: + bool started_; + size_t total_iterations_; + + bool has_range_x_; + int range_x_; + + bool has_range_y_; + int range_y_; + + size_t bytes_processed_; + size_t items_processed_; + +public: + const int thread_index; + const size_t max_iterations; + +private: + BENCHMARK_DISALLOW_COPY_AND_ASSIGN(State); +}; + +namespace internal { + +typedef void(Function)(State&); + +// ------------------------------------------------------ +// Benchmark registration object. The BENCHMARK() macro expands +// into an internal::Benchmark* object. Various methods can +// be called on this object to change the properties of the benchmark. +// Each method returns "this" so that multiple method calls can +// chained into one expression. +class Benchmark { +public: + virtual ~Benchmark(); + + // Note: the following methods all return "this" so that multiple + // method calls can be chained together in one expression. + + // Run this benchmark once with "x" as the extra argument passed + // to the function. + // REQUIRES: The function passed to the constructor must accept an arg1. + Benchmark* Arg(int x); + + // Run this benchmark once for a number of values picked from the + // range [start..limit]. (start and limit are always picked.) + // REQUIRES: The function passed to the constructor must accept an arg1. + Benchmark* Range(int start, int limit); + + // Run this benchmark once for every value in the range [start..limit] + // REQUIRES: The function passed to the constructor must accept an arg1. + Benchmark* DenseRange(int start, int limit); + + // Run this benchmark once with "x,y" as the extra arguments passed + // to the function. + // REQUIRES: The function passed to the constructor must accept arg1,arg2. + Benchmark* ArgPair(int x, int y); + + // Pick a set of values A from the range [lo1..hi1] and a set + // of values B from the range [lo2..hi2]. Run the benchmark for + // every pair of values in the cartesian product of A and B + // (i.e., for all combinations of the values in A and B). + // REQUIRES: The function passed to the constructor must accept arg1,arg2. + Benchmark* RangePair(int lo1, int hi1, int lo2, int hi2); + + // Pass this benchmark object to *func, which can customize + // the benchmark by calling various methods like Arg, ArgPair, + // Threads, etc. + Benchmark* Apply(void (*func)(Benchmark* benchmark)); + + // Set the minimum amount of time to use when running this benchmark. This + // option overrides the `benchmark_min_time` flag. + Benchmark* MinTime(double t); + + // If a particular benchmark is I/O bound, runs multiple threads internally or + // if for some reason CPU timings are not representative, call this method. If + // called, the elapsed time will be used to control how many iterations are + // run, and in the printing of items/second or MB/seconds values. If not + // called, the cpu time used by the benchmark will be used. + Benchmark* UseRealTime(); + + // Support for running multiple copies of the same benchmark concurrently + // in multiple threads. This may be useful when measuring the scaling + // of some piece of code. + + // Run one instance of this benchmark concurrently in t threads. + Benchmark* Threads(int t); + + // Pick a set of values T from [min_threads,max_threads]. + // min_threads and max_threads are always included in T. Run this + // benchmark once for each value in T. The benchmark run for a + // particular value t consists of t threads running the benchmark + // function concurrently. For example, consider: + // BENCHMARK(Foo)->ThreadRange(1,16); + // This will run the following benchmarks: + // Foo in 1 thread + // Foo in 2 threads + // Foo in 4 threads + // Foo in 8 threads + // Foo in 16 threads + Benchmark* ThreadRange(int min_threads, int max_threads); + + // Equivalent to ThreadRange(NumCPUs(), NumCPUs()) + Benchmark* ThreadPerCpu(); + + virtual void Run(State& state) = 0; + + // Used inside the benchmark implementation + struct Instance; + +protected: + explicit Benchmark(const char* name); + Benchmark(Benchmark const&); + void SetName(const char* name); + +private: + friend class BenchmarkFamilies; + BenchmarkImp* imp_; + + Benchmark& operator=(Benchmark const&); +}; + +// The class used to hold all Benchmarks created from static function. +// (ie those created using the BENCHMARK(...) macros. +class FunctionBenchmark : public Benchmark { +public: + FunctionBenchmark(const char* name, Function* func) + : Benchmark(name), func_(func) + {} + + virtual void Run(State& st); +private: + Function* func_; +}; + +} // end namespace internal + +// The base class for all fixture tests. +class Fixture: public internal::Benchmark { +public: + Fixture() : internal::Benchmark("") {} + + virtual void Run(State& st) { + this->SetUp(); + this->BenchmarkCase(st); + this->TearDown(); + } + + virtual void SetUp() {} + virtual void TearDown() {} + +protected: + virtual void BenchmarkCase(State&) = 0; +}; + +} // end namespace benchmark + + +// ------------------------------------------------------ +// Macro to register benchmarks + +// Check that __COUNTER__ is defined and that __COUNTER__ increases by 1 +// every time it is expanded. X + 1 == X + 0 is used in case X is defined to be +// empty. If X is empty the expression becomes (+1 == +0). +#if defined(__COUNTER__) && (__COUNTER__ + 1 == __COUNTER__ + 0) +#define BENCHMARK_PRIVATE_UNIQUE_ID __COUNTER__ +#else +#define BENCHMARK_PRIVATE_UNIQUE_ID __LINE__ +#endif + +// Helpers for generating unique variable names +#define BENCHMARK_PRIVATE_NAME(n) \ + BENCHMARK_PRIVATE_CONCAT(_benchmark_, BENCHMARK_PRIVATE_UNIQUE_ID, n) +#define BENCHMARK_PRIVATE_CONCAT(a, b, c) BENCHMARK_PRIVATE_CONCAT2(a, b, c) +#define BENCHMARK_PRIVATE_CONCAT2(a, b, c) a##b##c + +#define BENCHMARK_PRIVATE_DECLARE(n) \ + static ::benchmark::internal::Benchmark* \ + BENCHMARK_PRIVATE_NAME(n) BENCHMARK_UNUSED + +#define BENCHMARK(n) \ + BENCHMARK_PRIVATE_DECLARE(n) = \ + (::benchmark::internal::RegisterBenchmarkInternal( \ + new ::benchmark::internal::FunctionBenchmark(#n, n))) + +// Old-style macros +#define BENCHMARK_WITH_ARG(n, a) BENCHMARK(n)->Arg((a)) +#define BENCHMARK_WITH_ARG2(n, a1, a2) BENCHMARK(n)->ArgPair((a1), (a2)) +#define BENCHMARK_RANGE(n, lo, hi) BENCHMARK(n)->Range((lo), (hi)) +#define BENCHMARK_RANGE2(n, l1, h1, l2, h2) \ + BENCHMARK(n)->RangePair((l1), (h1), (l2), (h2)) + +// This will register a benchmark for a templatized function. For example: +// +// template +// void BM_Foo(int iters); +// +// BENCHMARK_TEMPLATE(BM_Foo, 1); +// +// will register BM_Foo<1> as a benchmark. +#define BENCHMARK_TEMPLATE1(n, a) \ + BENCHMARK_PRIVATE_DECLARE(n) = \ + (::benchmark::internal::RegisterBenchmarkInternal( \ + new ::benchmark::internal::FunctionBenchmark(#n "<" #a ">", n))) + +#define BENCHMARK_TEMPLATE2(n, a, b) \ + BENCHMARK_PRIVATE_DECLARE(n) = \ + (::benchmark::internal::RegisterBenchmarkInternal( \ + new ::benchmark::internal::FunctionBenchmark( \ + #n "<" #a "," #b ">", n))) + +#if __cplusplus >= 201103L +#define BENCHMARK_TEMPLATE(n, ...) \ + BENCHMARK_PRIVATE_DECLARE(n) = \ + (::benchmark::internal::RegisterBenchmarkInternal( \ + new ::benchmark::internal::FunctionBenchmark( \ + #n "<" #__VA_ARGS__ ">", n<__VA_ARGS__>))) +#else +#define BENCHMARK_TEMPLATE(n, a) BENCHMARK_TEMPLATE1(n, a) +#endif + + +#define BENCHMARK_PRIVATE_DECLARE_F(BaseClass, Method) \ +class BaseClass##_##Method##_Benchmark : public BaseClass { \ +public: \ + BaseClass##_##Method##_Benchmark() : BaseClass() { \ + this->SetName(#BaseClass "/" #Method);} \ +protected: \ + virtual void BenchmarkCase(::benchmark::State&); \ +}; + +#define BENCHMARK_DEFINE_F(BaseClass, Method) \ + BENCHMARK_PRIVATE_DECLARE_F(BaseClass, Method) \ + void BaseClass##_##Method##_Benchmark::BenchmarkCase + +#define BENCHMARK_REGISTER_F(BaseClass, Method) \ + BENCHMARK_PRIVATE_REGISTER_F(BaseClass##_##Method##_Benchmark) + +#define BENCHMARK_PRIVATE_REGISTER_F(TestName) \ + BENCHMARK_PRIVATE_DECLARE(TestName) = \ + (::benchmark::internal::RegisterBenchmarkInternal(new TestName())) + +// This macro will define and register a benchmark within a fixture class. +#define BENCHMARK_F(BaseClass, Method) \ + BENCHMARK_PRIVATE_DECLARE_F(BaseClass, Method) \ + BENCHMARK_REGISTER_F(BaseClass, Method); \ + void BaseClass##_##Method##_Benchmark::BenchmarkCase + + +// Helper macro to create a main routine in a test that runs the benchmarks +#define BENCHMARK_MAIN() \ + int main(int argc, char** argv) { \ + ::benchmark::Initialize(&argc, argv); \ + ::benchmark::RunSpecifiedBenchmarks(); \ + } + +#endif // BENCHMARK_BENCHMARK_API_H_ diff --git a/3rdparty/benchmark/include/benchmark/macros.h b/3rdparty/benchmark/include/benchmark/macros.h new file mode 100644 index 00000000000..3e9540edc44 --- /dev/null +++ b/3rdparty/benchmark/include/benchmark/macros.h @@ -0,0 +1,48 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef BENCHMARK_MACROS_H_ +#define BENCHMARK_MACROS_H_ + +#if __cplusplus < 201103L +# define BENCHMARK_DISALLOW_COPY_AND_ASSIGN(TypeName) \ + TypeName(const TypeName&); \ + TypeName& operator=(const TypeName&) +#else +# define BENCHMARK_DISALLOW_COPY_AND_ASSIGN(TypeName) \ + TypeName(const TypeName&) = delete; \ + TypeName& operator=(const TypeName&) = delete +#endif + +#if defined(__GNUC__) +# define BENCHMARK_UNUSED __attribute__((unused)) +# define BENCHMARK_ALWAYS_INLINE __attribute__((always_inline)) +# define BENCHMARK_NOEXCEPT noexcept +#elif defined(_MSC_VER) && !defined(__clang__) +# define BENCHMARK_UNUSED +# define BENCHMARK_ALWAYS_INLINE __forceinline +# define BENCHMARK_NOEXCEPT +# define __func__ __FUNCTION__ +#else +# define BENCHMARK_UNUSED +# define BENCHMARK_ALWAYS_INLINE +# define BENCHMARK_NOEXCEPT +#endif + +#if defined(__GNUC__) +# define BENCHMARK_BUILTIN_EXPECT(x, y) __builtin_expect(x, y) +#else +# define BENCHMARK_BUILTIN_EXPECT(x, y) x +#endif + +#endif // BENCHMARK_MACROS_H_ diff --git a/3rdparty/benchmark/include/benchmark/reporter.h b/3rdparty/benchmark/include/benchmark/reporter.h new file mode 100644 index 00000000000..d23ab6574d7 --- /dev/null +++ b/3rdparty/benchmark/include/benchmark/reporter.h @@ -0,0 +1,122 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef BENCHMARK_REPORTER_H_ +#define BENCHMARK_REPORTER_H_ + +#include +#include +#include + +#include "benchmark_api.h" // For forward declaration of BenchmarkReporter + +namespace benchmark { + +// Interface for custom benchmark result printers. +// By default, benchmark reports are printed to stdout. However an application +// can control the destination of the reports by calling +// RunSpecifiedBenchmarks and passing it a custom reporter object. +// The reporter object must implement the following interface. +class BenchmarkReporter { + public: + struct Context { + int num_cpus; + double mhz_per_cpu; + bool cpu_scaling_enabled; + + // The number of chars in the longest benchmark name. + size_t name_field_width; + }; + + struct Run { + Run() : + iterations(1), + real_accumulated_time(0), + cpu_accumulated_time(0), + bytes_per_second(0), + items_per_second(0), + max_heapbytes_used(0) {} + + std::string benchmark_name; + std::string report_label; // Empty if not set by benchmark. + int64_t iterations; + double real_accumulated_time; + double cpu_accumulated_time; + + // Zero if not set by benchmark. + double bytes_per_second; + double items_per_second; + + // This is set to 0.0 if memory tracing is not enabled. + double max_heapbytes_used; + }; + + // Called once for every suite of benchmarks run. + // The parameter "context" contains information that the + // reporter may wish to use when generating its report, for example the + // platform under which the benchmarks are running. The benchmark run is + // never started if this function returns false, allowing the reporter + // to skip runs based on the context information. + virtual bool ReportContext(const Context& context) = 0; + + // Called once for each group of benchmark runs, gives information about + // cpu-time and heap memory usage during the benchmark run. + // Note that all the grouped benchmark runs should refer to the same + // benchmark, thus have the same name. + virtual void ReportRuns(const std::vector& report) = 0; + + // Called once and only once after ever group of benchmarks is run and + // reported. + virtual void Finalize(); + + virtual ~BenchmarkReporter(); +protected: + static void ComputeStats(std::vector const& reports, Run* mean, Run* stddev); +}; + +// Simple reporter that outputs benchmark data to the console. This is the +// default reporter used by RunSpecifiedBenchmarks(). +class ConsoleReporter : public BenchmarkReporter { + public: + virtual bool ReportContext(const Context& context); + virtual void ReportRuns(const std::vector& reports); +protected: + virtual void PrintRunData(const Run& report); + + size_t name_field_width_; +}; + +class JSONReporter : public BenchmarkReporter { +public: + JSONReporter() : first_report_(true) {} + virtual bool ReportContext(const Context& context); + virtual void ReportRuns(const std::vector& reports); + virtual void Finalize(); + +private: + void PrintRunData(const Run& report); + + bool first_report_; +}; + +class CSVReporter : public BenchmarkReporter { +public: + virtual bool ReportContext(const Context& context); + virtual void ReportRuns(const std::vector& reports); + +private: + void PrintRunData(const Run& report); +}; + +} // end namespace benchmark +#endif // BENCHMARK_REPORTER_H_ diff --git a/3rdparty/benchmark/mingw.py b/3rdparty/benchmark/mingw.py new file mode 100644 index 00000000000..706ad559db9 --- /dev/null +++ b/3rdparty/benchmark/mingw.py @@ -0,0 +1,320 @@ +#! /usr/bin/env python +# encoding: utf-8 + +import argparse +import errno +import logging +import os +import platform +import re +import sys +import subprocess +import tempfile + +try: + import winreg +except ImportError: + import _winreg as winreg +try: + import urllib.request as request +except ImportError: + import urllib as request +try: + import urllib.parse as parse +except ImportError: + import urlparse as parse + +class EmptyLogger(object): + ''' + Provides an implementation that performs no logging + ''' + def debug(self, *k, **kw): + pass + def info(self, *k, **kw): + pass + def warn(self, *k, **kw): + pass + def error(self, *k, **kw): + pass + def critical(self, *k, **kw): + pass + def setLevel(self, *k, **kw): + pass + +urls = ( + 'http://downloads.sourceforge.net/project/mingw-w64/Toolchains%20' + 'targetting%20Win32/Personal%20Builds/mingw-builds/installer/' + 'repository.txt', + 'http://downloads.sourceforge.net/project/mingwbuilds/host-windows/' + 'repository.txt' +) +''' +A list of mingw-build repositories +''' + +def repository(urls = urls, log = EmptyLogger()): + ''' + Downloads and parse mingw-build repository files and parses them + ''' + log.info('getting mingw-builds repository') + versions = {} + re_sourceforge = re.compile(r'http://sourceforge.net/projects/([^/]+)/files') + re_sub = r'http://downloads.sourceforge.net/project/\1' + for url in urls: + log.debug(' - requesting: %s', url) + socket = request.urlopen(url) + repo = socket.read() + if not isinstance(repo, str): + repo = repo.decode(); + socket.close() + for entry in repo.split('\n')[:-1]: + value = entry.split('|') + version = tuple([int(n) for n in value[0].strip().split('.')]) + version = versions.setdefault(version, {}) + arch = value[1].strip() + if arch == 'x32': + arch = 'i686' + elif arch == 'x64': + arch = 'x86_64' + arch = version.setdefault(arch, {}) + threading = arch.setdefault(value[2].strip(), {}) + exceptions = threading.setdefault(value[3].strip(), {}) + revision = exceptions.setdefault(int(value[4].strip()[3:]), + re_sourceforge.sub(re_sub, value[5].strip())) + return versions + +def find_in_path(file, path=None): + ''' + Attempts to find an executable in the path + ''' + if platform.system() == 'Windows': + file += '.exe' + if path is None: + path = os.environ.get('PATH', '') + if type(path) is type(''): + path = path.split(os.pathsep) + return list(filter(os.path.exists, + map(lambda dir, file=file: os.path.join(dir, file), path))) + +def find_7zip(log = EmptyLogger()): + ''' + Attempts to find 7zip for unpacking the mingw-build archives + ''' + log.info('finding 7zip') + path = find_in_path('7z') + if not path: + key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\7-Zip') + path, _ = winreg.QueryValueEx(key, 'Path') + path = [os.path.join(path, '7z.exe')] + log.debug('found \'%s\'', path[0]) + return path[0] + +find_7zip() + +def unpack(archive, location, log = EmptyLogger()): + ''' + Unpacks a mingw-builds archive + ''' + sevenzip = find_7zip(log) + log.info('unpacking %s', os.path.basename(archive)) + cmd = [sevenzip, 'x', archive, '-o' + location, '-y'] + log.debug(' - %r', cmd) + with open(os.devnull, 'w') as devnull: + subprocess.check_call(cmd, stdout = devnull) + +def download(url, location, log = EmptyLogger()): + ''' + Downloads and unpacks a mingw-builds archive + ''' + log.info('downloading MinGW') + log.debug(' - url: %s', url) + log.debug(' - location: %s', location) + + re_content = re.compile(r'attachment;[ \t]*filename=(")?([^"]*)(")?[\r\n]*') + + stream = request.urlopen(url) + try: + content = stream.getheader('Content-Disposition') or '' + except AttributeError: + content = stream.headers.getheader('Content-Disposition') or '' + matches = re_content.match(content) + if matches: + filename = matches.group(2) + else: + parsed = parse.urlparse(stream.geturl()) + filename = os.path.basename(parsed.path) + + try: + os.makedirs(location) + except OSError as e: + if e.errno == errno.EEXIST and os.path.isdir(location): + pass + else: + raise + + archive = os.path.join(location, filename) + with open(archive, 'wb') as out: + while True: + buf = stream.read(1024) + if not buf: + break + out.write(buf) + unpack(archive, location, log = log) + os.remove(archive) + + possible = os.path.join(location, 'mingw64') + if not os.path.exists(possible): + possible = os.path.join(location, 'mingw32') + if not os.path.exists(possible): + raise ValueError('Failed to find unpacked MinGW: ' + possible) + return possible + +def root(location = None, arch = None, version = None, threading = None, + exceptions = None, revision = None, log = EmptyLogger()): + ''' + Returns the root folder of a specific version of the mingw-builds variant + of gcc. Will download the compiler if needed + ''' + + # Get the repository if we don't have all the information + if not (arch and version and threading and exceptions and revision): + versions = repository(log = log) + + # Determine some defaults + version = version or max(versions.keys()) + if not arch: + arch = platform.machine().lower() + if arch == 'x86': + arch = 'i686' + elif arch == 'amd64': + arch = 'x86_64' + if not threading: + keys = versions[version][arch].keys() + if 'posix' in keys: + threading = 'posix' + elif 'win32' in keys: + threading = 'win32' + else: + threading = keys[0] + if not exceptions: + keys = versions[version][arch][threading].keys() + if 'seh' in keys: + exceptions = 'seh' + elif 'sjlj' in keys: + exceptions = 'sjlj' + else: + exceptions = keys[0] + if revision == None: + revision = max(versions[version][arch][threading][exceptions].keys()) + if not location: + location = os.path.join(tempfile.gettempdir(), 'mingw-builds') + + # Get the download url + url = versions[version][arch][threading][exceptions][revision] + + # Tell the user whatzzup + log.info('finding MinGW %s', '.'.join(str(v) for v in version)) + log.debug(' - arch: %s', arch) + log.debug(' - threading: %s', threading) + log.debug(' - exceptions: %s', exceptions) + log.debug(' - revision: %s', revision) + log.debug(' - url: %s', url) + + # Store each specific revision differently + slug = '{version}-{arch}-{threading}-{exceptions}-rev{revision}' + slug = slug.format( + version = '.'.join(str(v) for v in version), + arch = arch, + threading = threading, + exceptions = exceptions, + revision = revision + ) + if arch == 'x86_64': + root_dir = os.path.join(location, slug, 'mingw64') + elif arch == 'i686': + root_dir = os.path.join(location, slug, 'mingw32') + else: + raise ValueError('Unknown MinGW arch: ' + arch) + + # Download if needed + if not os.path.exists(root_dir): + downloaded = download(url, os.path.join(location, slug), log = log) + if downloaded != root_dir: + raise ValueError('The location of mingw did not match\n%s\n%s' + % (downloaded, root_dir)) + + return root_dir + +def str2ver(string): + ''' + Converts a version string into a tuple + ''' + try: + version = tuple(int(v) for v in string.split('.')) + if len(version) is not 3: + raise ValueError() + except ValueError: + raise argparse.ArgumentTypeError( + 'please provide a three digit version string') + return version + +def main(): + ''' + Invoked when the script is run directly by the python interpreter + ''' + parser = argparse.ArgumentParser( + description = 'Downloads a specific version of MinGW', + formatter_class = argparse.ArgumentDefaultsHelpFormatter + ) + parser.add_argument('--location', + help = 'the location to download the compiler to', + default = os.path.join(tempfile.gettempdir(), 'mingw-builds')) + parser.add_argument('--arch', required = True, choices = ['i686', 'x86_64'], + help = 'the target MinGW architecture string') + parser.add_argument('--version', type = str2ver, + help = 'the version of GCC to download') + parser.add_argument('--threading', choices = ['posix', 'win32'], + help = 'the threading type of the compiler') + parser.add_argument('--exceptions', choices = ['sjlj', 'seh', 'dwarf'], + help = 'the method to throw exceptions') + parser.add_argument('--revision', type=int, + help = 'the revision of the MinGW release') + group = parser.add_mutually_exclusive_group() + group.add_argument('-v', '--verbose', action='store_true', + help='increase the script output verbosity') + group.add_argument('-q', '--quiet', action='store_true', + help='only print errors and warning') + args = parser.parse_args() + + # Create the logger + logger = logging.getLogger('mingw') + handler = logging.StreamHandler() + formatter = logging.Formatter('%(message)s') + handler.setFormatter(formatter) + logger.addHandler(handler) + logger.setLevel(logging.INFO) + if args.quiet: + logger.setLevel(logging.WARN) + if args.verbose: + logger.setLevel(logging.DEBUG) + + # Get MinGW + root_dir = root(location = args.location, arch = args.arch, + version = args.version, threading = args.threading, + exceptions = args.exceptions, revision = args.revision, + log = logger) + + sys.stdout.write('%s\n' % os.path.join(root_dir, 'bin')) + +if __name__ == '__main__': + try: + main() + except IOError as e: + sys.stderr.write('IO error: %s\n' % e) + sys.exit(1) + except OSError as e: + sys.stderr.write('OS error: %s\n' % e) + sys.exit(1) + except KeyboardInterrupt as e: + sys.stderr.write('Killed\n') + sys.exit(1) diff --git a/3rdparty/benchmark/src/CMakeLists.txt b/3rdparty/benchmark/src/CMakeLists.txt new file mode 100644 index 00000000000..811d075575a --- /dev/null +++ b/3rdparty/benchmark/src/CMakeLists.txt @@ -0,0 +1,51 @@ +# Allow the source files to find headers in src/ +include_directories(${PROJECT_SOURCE_DIR}/src) + +# Define the source files +set(SOURCE_FILES "benchmark.cc" "colorprint.cc" "commandlineflags.cc" + "console_reporter.cc" "csv_reporter.cc" "json_reporter.cc" + "log.cc" "reporter.cc" "sleep.cc" "string_util.cc" + "sysinfo.cc" "walltime.cc") +# Determine the correct regular expression engine to use +if(HAVE_STD_REGEX) + set(RE_FILES "re_std.cc") +elseif(HAVE_GNU_POSIX_REGEX) + set(RE_FILES "re_posix.cc") +elseif(HAVE_POSIX_REGEX) + set(RE_FILES "re_posix.cc") +else() + message(FATAL_ERROR "Failed to determine the source files for the regular expression backend") +endif() + +add_library(benchmark ${SOURCE_FILES} ${RE_FILES}) + + +set_target_properties(benchmark PROPERTIES + OUTPUT_NAME "benchmark" + VERSION ${GENERIC_LIB_VERSION} + SOVERSION ${GENERIC_LIB_SOVERSION} +) + +# Link threads. +target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT}) + +# We need extra libraries on Windows +if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + target_link_libraries(benchmark Shlwapi) +endif() + +# Expose public API +target_include_directories(benchmark PUBLIC ${PROJECT_SOURCE_DIR}/include) + +# Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable) +install( + TARGETS benchmark + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + COMPONENT library) + +install( + DIRECTORY "${PROJECT_SOURCE_DIR}/include/benchmark" + DESTINATION include + FILES_MATCHING PATTERN "*.*h") diff --git a/3rdparty/benchmark/src/arraysize.h b/3rdparty/benchmark/src/arraysize.h new file mode 100644 index 00000000000..638a52a0ecb --- /dev/null +++ b/3rdparty/benchmark/src/arraysize.h @@ -0,0 +1,34 @@ +#ifndef BENCHMARK_ARRAYSIZE_H_ +#define BENCHMARK_ARRAYSIZE_H_ + +#include "internal_macros.h" + +namespace benchmark { +namespace internal { +// The arraysize(arr) macro returns the # of elements in an array arr. +// The expression is a compile-time constant, and therefore can be +// used in defining new arrays, for example. If you use arraysize on +// a pointer by mistake, you will get a compile-time error. +// + + +// This template function declaration is used in defining arraysize. +// Note that the function doesn't need an implementation, as we only +// use its type. +template +char (&ArraySizeHelper(T (&array)[N]))[N]; + +// That gcc wants both of these prototypes seems mysterious. VC, for +// its part, can't decide which to use (another mystery). Matching of +// template overloads: the final frontier. +#ifndef COMPILER_MSVC +template +char (&ArraySizeHelper(const T (&array)[N]))[N]; +#endif + +#define arraysize(array) (sizeof(::benchmark::internal::ArraySizeHelper(array))) + +} // end namespace internal +} // end namespace benchmark + +#endif // BENCHMARK_ARRAYSIZE_H_ diff --git a/3rdparty/benchmark/src/benchmark.cc b/3rdparty/benchmark/src/benchmark.cc new file mode 100644 index 00000000000..269b7978023 --- /dev/null +++ b/3rdparty/benchmark/src/benchmark.cc @@ -0,0 +1,919 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "benchmark/benchmark.h" +#include "internal_macros.h" + +#ifndef BENCHMARK_OS_WINDOWS +#include +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "check.h" +#include "commandlineflags.h" +#include "log.h" +#include "mutex.h" +#include "re.h" +#include "stat.h" +#include "string_util.h" +#include "sysinfo.h" +#include "walltime.h" + +DEFINE_bool(benchmark_list_tests, false, + "Print a list of benchmarks. This option overrides all other " + "options."); + +DEFINE_string(benchmark_filter, ".", + "A regular expression that specifies the set of benchmarks " + "to execute. If this flag is empty, no benchmarks are run. " + "If this flag is the string \"all\", all benchmarks linked " + "into the process are run."); + +DEFINE_double(benchmark_min_time, 0.5, + "Minimum number of seconds we should run benchmark before " + "results are considered significant. For cpu-time based " + "tests, this is the lower bound on the total cpu time " + "used by all threads that make up the test. For real-time " + "based tests, this is the lower bound on the elapsed time " + "of the benchmark execution, regardless of number of " + "threads."); + +DEFINE_int32(benchmark_repetitions, 1, + "The number of runs of each benchmark. If greater than 1, the " + "mean and standard deviation of the runs will be reported."); + +DEFINE_string(benchmark_format, "tabular", + "The format to use for console output. Valid values are " + "'tabular', 'json', or 'csv'."); + +DEFINE_bool(color_print, true, "Enables colorized logging."); + +DEFINE_int32(v, 0, "The level of verbose logging to output"); + + +namespace benchmark { + +namespace internal { + +void UseCharPointer(char const volatile*) {} + +// NOTE: This is a dummy "mutex" type used to denote the actual mutex +// returned by GetBenchmarkLock(). This is only used to placate the thread +// safety warnings by giving the return of GetBenchmarkLock() a name. +struct CAPABILITY("mutex") BenchmarkLockType {}; +BenchmarkLockType BenchmarkLockVar; + +} // end namespace internal + +inline Mutex& RETURN_CAPABILITY(::benchmark::internal::BenchmarkLockVar) +GetBenchmarkLock() +{ + static Mutex lock; + return lock; +} + +namespace { + +bool IsZero(double n) { + return std::abs(n) < std::numeric_limits::epsilon(); +} + +// For non-dense Range, intermediate values are powers of kRangeMultiplier. +static const int kRangeMultiplier = 8; +static const size_t kMaxIterations = 1000000000; + +bool running_benchmark = false; + +// Global variable so that a benchmark can cause a little extra printing +std::string* GetReportLabel() { + static std::string label GUARDED_BY(GetBenchmarkLock()); + return &label; +} + +// TODO(ericwf): support MallocCounter. +//static benchmark::MallocCounter *benchmark_mc; + +struct ThreadStats { + ThreadStats() : bytes_processed(0), items_processed(0) {} + int64_t bytes_processed; + int64_t items_processed; +}; + +// Timer management class +class TimerManager { + public: + TimerManager(int num_threads, Notification* done) + : num_threads_(num_threads), + done_(done), + running_(false), + real_time_used_(0), + cpu_time_used_(0), + num_finalized_(0), + phase_number_(0), + entered_(0) { + } + + // Called by each thread + void StartTimer() EXCLUDES(lock_) { + bool last_thread = false; + { + MutexLock ml(lock_); + last_thread = Barrier(ml); + if (last_thread) { + CHECK(!running_) << "Called StartTimer when timer is already running"; + running_ = true; + start_real_time_ = walltime::Now(); + start_cpu_time_ = MyCPUUsage() + ChildrenCPUUsage(); + } + } + if (last_thread) { + phase_condition_.notify_all(); + } + } + + // Called by each thread + void StopTimer() EXCLUDES(lock_) { + bool last_thread = false; + { + MutexLock ml(lock_); + last_thread = Barrier(ml); + if (last_thread) { + CHECK(running_) << "Called StopTimer when timer is already stopped"; + InternalStop(); + } + } + if (last_thread) { + phase_condition_.notify_all(); + } + } + + // Called by each thread + void Finalize() EXCLUDES(lock_) { + MutexLock l(lock_); + num_finalized_++; + if (num_finalized_ == num_threads_) { + CHECK(!running_) << + "The timer should be stopped before the timer is finalized"; + done_->Notify(); + } + } + + // REQUIRES: timer is not running + double real_time_used() EXCLUDES(lock_) { + MutexLock l(lock_); + CHECK(!running_); + return real_time_used_; + } + + // REQUIRES: timer is not running + double cpu_time_used() EXCLUDES(lock_) { + MutexLock l(lock_); + CHECK(!running_); + return cpu_time_used_; + } + + private: + Mutex lock_; + Condition phase_condition_; + int num_threads_; + Notification* done_; + + bool running_; // Is the timer running + double start_real_time_; // If running_ + double start_cpu_time_; // If running_ + + // Accumulated time so far (does not contain current slice if running_) + double real_time_used_; + double cpu_time_used_; + + // How many threads have called Finalize() + int num_finalized_; + + // State for barrier management + int phase_number_; + int entered_; // Number of threads that have entered this barrier + + void InternalStop() REQUIRES(lock_) { + CHECK(running_); + running_ = false; + real_time_used_ += walltime::Now() - start_real_time_; + cpu_time_used_ += ((MyCPUUsage() + ChildrenCPUUsage()) + - start_cpu_time_); + } + + // Enter the barrier and wait until all other threads have also + // entered the barrier. Returns iff this is the last thread to + // enter the barrier. + bool Barrier(MutexLock& ml) REQUIRES(lock_) { + CHECK_LT(entered_, num_threads_); + entered_++; + if (entered_ < num_threads_) { + // Wait for all threads to enter + int phase_number_cp = phase_number_; + auto cb = [this, phase_number_cp]() { + return this->phase_number_ > phase_number_cp; + }; + phase_condition_.wait(ml.native_handle(), cb); + return false; // I was not the last one + } else { + // Last thread has reached the barrier + phase_number_++; + entered_ = 0; + return true; + } + } +}; + +// TimerManager for current run. +static std::unique_ptr timer_manager = nullptr; + +} // end namespace + +namespace internal { + +// Information kept per benchmark we may want to run +struct Benchmark::Instance { + std::string name; + Benchmark* benchmark; + bool has_arg1; + int arg1; + bool has_arg2; + int arg2; + bool use_real_time; + double min_time; + int threads; // Number of concurrent threads to use + bool multithreaded; // Is benchmark multi-threaded? +}; + +// Class for managing registered benchmarks. Note that each registered +// benchmark identifies a family of related benchmarks to run. +class BenchmarkFamilies { + public: + static BenchmarkFamilies* GetInstance(); + + // Registers a benchmark family and returns the index assigned to it. + size_t AddBenchmark(std::unique_ptr family); + + // Extract the list of benchmark instances that match the specified + // regular expression. + bool FindBenchmarks(const std::string& re, + std::vector* benchmarks); + private: + BenchmarkFamilies() {} + + std::vector> families_; + Mutex mutex_; +}; + + +class BenchmarkImp { +public: + explicit BenchmarkImp(const char* name); + ~BenchmarkImp(); + + void Arg(int x); + void Range(int start, int limit); + void DenseRange(int start, int limit); + void ArgPair(int start, int limit); + void RangePair(int lo1, int hi1, int lo2, int hi2); + void MinTime(double n); + void UseRealTime(); + void Threads(int t); + void ThreadRange(int min_threads, int max_threads); + void ThreadPerCpu(); + void SetName(const char* name); + + static void AddRange(std::vector* dst, int lo, int hi, int mult); + +private: + friend class BenchmarkFamilies; + + std::string name_; + int arg_count_; + std::vector< std::pair > args_; // Args for all benchmark runs + double min_time_; + bool use_real_time_; + std::vector thread_counts_; + + BenchmarkImp& operator=(BenchmarkImp const&); +}; + +BenchmarkFamilies* BenchmarkFamilies::GetInstance() { + static BenchmarkFamilies instance; + return &instance; +} + + +size_t BenchmarkFamilies::AddBenchmark(std::unique_ptr family) { + MutexLock l(mutex_); + size_t index = families_.size(); + families_.push_back(std::move(family)); + return index; +} + +bool BenchmarkFamilies::FindBenchmarks( + const std::string& spec, + std::vector* benchmarks) { + // Make regular expression out of command-line flag + std::string error_msg; + Regex re; + if (!re.Init(spec, &error_msg)) { + std::cerr << "Could not compile benchmark re: " << error_msg << std::endl; + return false; + } + + // Special list of thread counts to use when none are specified + std::vector one_thread; + one_thread.push_back(1); + + MutexLock l(mutex_); + for (std::unique_ptr& bench_family : families_) { + // Family was deleted or benchmark doesn't match + if (!bench_family) continue; + BenchmarkImp* family = bench_family->imp_; + + if (family->arg_count_ == -1) { + family->arg_count_ = 0; + family->args_.emplace_back(-1, -1); + } + for (auto const& args : family->args_) { + const std::vector* thread_counts = + (family->thread_counts_.empty() + ? &one_thread + : &family->thread_counts_); + for (int num_threads : *thread_counts) { + + Benchmark::Instance instance; + instance.name = family->name_; + instance.benchmark = bench_family.get(); + instance.has_arg1 = family->arg_count_ >= 1; + instance.arg1 = args.first; + instance.has_arg2 = family->arg_count_ == 2; + instance.arg2 = args.second; + instance.min_time = family->min_time_; + instance.use_real_time = family->use_real_time_; + instance.threads = num_threads; + instance.multithreaded = !(family->thread_counts_.empty()); + + // Add arguments to instance name + if (family->arg_count_ >= 1) { + AppendHumanReadable(instance.arg1, &instance.name); + } + if (family->arg_count_ >= 2) { + AppendHumanReadable(instance.arg2, &instance.name); + } + if (!IsZero(family->min_time_)) { + instance.name += StringPrintF("/min_time:%0.3f", family->min_time_); + } + if (family->use_real_time_) { + instance.name += "/real_time"; + } + + // Add the number of threads used to the name + if (!family->thread_counts_.empty()) { + instance.name += StringPrintF("/threads:%d", instance.threads); + } + + if (re.Match(instance.name)) { + benchmarks->push_back(instance); + } + } + } + } + return true; +} + +BenchmarkImp::BenchmarkImp(const char* name) + : name_(name), arg_count_(-1), + min_time_(0.0), use_real_time_(false) { +} + +BenchmarkImp::~BenchmarkImp() { +} + +void BenchmarkImp::Arg(int x) { + CHECK(arg_count_ == -1 || arg_count_ == 1); + arg_count_ = 1; + args_.emplace_back(x, -1); +} + +void BenchmarkImp::Range(int start, int limit) { + CHECK(arg_count_ == -1 || arg_count_ == 1); + arg_count_ = 1; + std::vector arglist; + AddRange(&arglist, start, limit, kRangeMultiplier); + + for (int i : arglist) { + args_.emplace_back(i, -1); + } +} + +void BenchmarkImp::DenseRange(int start, int limit) { + CHECK(arg_count_ == -1 || arg_count_ == 1); + arg_count_ = 1; + CHECK_GE(start, 0); + CHECK_LE(start, limit); + for (int arg = start; arg <= limit; arg++) { + args_.emplace_back(arg, -1); + } +} + +void BenchmarkImp::ArgPair(int x, int y) { + CHECK(arg_count_ == -1 || arg_count_ == 2); + arg_count_ = 2; + args_.emplace_back(x, y); +} + +void BenchmarkImp::RangePair(int lo1, int hi1, int lo2, int hi2) { + CHECK(arg_count_ == -1 || arg_count_ == 2); + arg_count_ = 2; + std::vector arglist1, arglist2; + AddRange(&arglist1, lo1, hi1, kRangeMultiplier); + AddRange(&arglist2, lo2, hi2, kRangeMultiplier); + + for (int i : arglist1) { + for (int j : arglist2) { + args_.emplace_back(i, j); + } + } +} + +void BenchmarkImp::MinTime(double t) { + CHECK(t > 0.0); + min_time_ = t; +} + +void BenchmarkImp::UseRealTime() { + use_real_time_ = true; +} + +void BenchmarkImp::Threads(int t) { + CHECK_GT(t, 0); + thread_counts_.push_back(t); +} + +void BenchmarkImp::ThreadRange(int min_threads, int max_threads) { + CHECK_GT(min_threads, 0); + CHECK_GE(max_threads, min_threads); + + AddRange(&thread_counts_, min_threads, max_threads, 2); +} + +void BenchmarkImp::ThreadPerCpu() { + static int num_cpus = NumCPUs(); + thread_counts_.push_back(num_cpus); +} + +void BenchmarkImp::SetName(const char* name) { + name_ = name; +} + +void BenchmarkImp::AddRange(std::vector* dst, int lo, int hi, int mult) { + CHECK_GE(lo, 0); + CHECK_GE(hi, lo); + + // Add "lo" + dst->push_back(lo); + + static const int kint32max = std::numeric_limits::max(); + + // Now space out the benchmarks in multiples of "mult" + for (int32_t i = 1; i < kint32max/mult; i *= mult) { + if (i >= hi) break; + if (i > lo) { + dst->push_back(i); + } + } + // Add "hi" (if different from "lo") + if (hi != lo) { + dst->push_back(hi); + } +} + +Benchmark::Benchmark(const char* name) + : imp_(new BenchmarkImp(name)) +{ +} + +Benchmark::~Benchmark() { + delete imp_; +} + +Benchmark::Benchmark(Benchmark const& other) + : imp_(new BenchmarkImp(*other.imp_)) +{ +} + +Benchmark* Benchmark::Arg(int x) { + imp_->Arg(x); + return this; +} + +Benchmark* Benchmark::Range(int start, int limit) { + imp_->Range(start, limit); + return this; +} + +Benchmark* Benchmark::DenseRange(int start, int limit) { + imp_->DenseRange(start, limit); + return this; +} + +Benchmark* Benchmark::ArgPair(int x, int y) { + imp_->ArgPair(x, y); + return this; +} + +Benchmark* Benchmark::RangePair(int lo1, int hi1, int lo2, int hi2) { + imp_->RangePair(lo1, hi1, lo2, hi2); + return this; +} + +Benchmark* Benchmark::Apply(void (*custom_arguments)(Benchmark* benchmark)) { + custom_arguments(this); + return this; +} + +Benchmark* Benchmark::MinTime(double t) { + imp_->MinTime(t); + return this; +} + +Benchmark* Benchmark::UseRealTime() { + imp_->UseRealTime(); + return this; +} + +Benchmark* Benchmark::Threads(int t) { + imp_->Threads(t); + return this; +} + +Benchmark* Benchmark::ThreadRange(int min_threads, int max_threads) { + imp_->ThreadRange(min_threads, max_threads); + return this; +} + +Benchmark* Benchmark::ThreadPerCpu() { + imp_->ThreadPerCpu(); + return this; +} + +void Benchmark::SetName(const char* name) { + imp_->SetName(name); +} + +void FunctionBenchmark::Run(State& st) { + func_(st); +} + +} // end namespace internal + +namespace { + + +// Execute one thread of benchmark b for the specified number of iterations. +// Adds the stats collected for the thread into *total. +void RunInThread(const benchmark::internal::Benchmark::Instance* b, + size_t iters, int thread_id, + ThreadStats* total) EXCLUDES(GetBenchmarkLock()) { + State st(iters, b->has_arg1, b->arg1, b->has_arg2, b->arg2, thread_id); + b->benchmark->Run(st); + CHECK(st.iterations() == st.max_iterations) << + "Benchmark returned before State::KeepRunning() returned false!"; + { + MutexLock l(GetBenchmarkLock()); + total->bytes_processed += st.bytes_processed(); + total->items_processed += st.items_processed(); + } + + timer_manager->Finalize(); +} + +void RunBenchmark(const benchmark::internal::Benchmark::Instance& b, + BenchmarkReporter* br) EXCLUDES(GetBenchmarkLock()) { + size_t iters = 1; + + std::vector reports; + + std::vector pool; + if (b.multithreaded) + pool.resize(b.threads); + + for (int i = 0; i < FLAGS_benchmark_repetitions; i++) { + std::string mem; + for (;;) { + // Try benchmark + VLOG(2) << "Running " << b.name << " for " << iters << "\n"; + + { + MutexLock l(GetBenchmarkLock()); + GetReportLabel()->clear(); + } + + Notification done; + timer_manager = std::unique_ptr(new TimerManager(b.threads, &done)); + + ThreadStats total; + running_benchmark = true; + if (b.multithreaded) { + // If this is out first iteration of the while(true) loop then the + // threads haven't been started and can't be joined. Otherwise we need + // to join the thread before replacing them. + for (std::thread& thread : pool) { + if (thread.joinable()) + thread.join(); + } + for (std::size_t ti = 0; ti < pool.size(); ++ti) { + pool[ti] = std::thread(&RunInThread, &b, iters, ti, &total); + } + } else { + // Run directly in this thread + RunInThread(&b, iters, 0, &total); + } + done.WaitForNotification(); + running_benchmark = false; + + const double cpu_accumulated_time = timer_manager->cpu_time_used(); + const double real_accumulated_time = timer_manager->real_time_used(); + timer_manager.reset(); + + VLOG(2) << "Ran in " << cpu_accumulated_time << "/" + << real_accumulated_time << "\n"; + + // Base decisions off of real time if requested by this benchmark. + double seconds = cpu_accumulated_time; + if (b.use_real_time) { + seconds = real_accumulated_time; + } + + std::string label; + { + MutexLock l(GetBenchmarkLock()); + label = *GetReportLabel(); + } + + const double min_time = !IsZero(b.min_time) ? b.min_time + : FLAGS_benchmark_min_time; + + // If this was the first run, was elapsed time or cpu time large enough? + // If this is not the first run, go with the current value of iter. + if ((i > 0) || + (iters >= kMaxIterations) || + (seconds >= min_time) || + (real_accumulated_time >= 5*min_time)) { + double bytes_per_second = 0; + if (total.bytes_processed > 0 && seconds > 0.0) { + bytes_per_second = (total.bytes_processed / seconds); + } + double items_per_second = 0; + if (total.items_processed > 0 && seconds > 0.0) { + items_per_second = (total.items_processed / seconds); + } + + // Create report about this benchmark run. + BenchmarkReporter::Run report; + report.benchmark_name = b.name; + report.report_label = label; + // Report the total iterations across all threads. + report.iterations = static_cast(iters) * b.threads; + report.real_accumulated_time = real_accumulated_time; + report.cpu_accumulated_time = cpu_accumulated_time; + report.bytes_per_second = bytes_per_second; + report.items_per_second = items_per_second; + reports.push_back(report); + break; + } + + // See how much iterations should be increased by + // Note: Avoid division by zero with max(seconds, 1ns). + double multiplier = min_time * 1.4 / std::max(seconds, 1e-9); + // If our last run was at least 10% of FLAGS_benchmark_min_time then we + // use the multiplier directly. Otherwise we use at most 10 times + // expansion. + // NOTE: When the last run was at least 10% of the min time the max + // expansion should be 14x. + bool is_significant = (seconds / min_time) > 0.1; + multiplier = is_significant ? multiplier : std::min(10.0, multiplier); + if (multiplier <= 1.0) multiplier = 2.0; + double next_iters = std::max(multiplier * iters, iters + 1.0); + if (next_iters > kMaxIterations) { + next_iters = kMaxIterations; + } + VLOG(3) << "Next iters: " << next_iters << ", " << multiplier << "\n"; + iters = static_cast(next_iters + 0.5); + } + } + br->ReportRuns(reports); + if (b.multithreaded) { + for (std::thread& thread : pool) + thread.join(); + } +} + +} // namespace + +State::State(size_t max_iters, bool has_x, int x, bool has_y, int y, + int thread_i) + : started_(false), total_iterations_(0), + has_range_x_(has_x), range_x_(x), + has_range_y_(has_y), range_y_(y), + bytes_processed_(0), items_processed_(0), + thread_index(thread_i), + max_iterations(max_iters) +{ + CHECK(max_iterations != 0) << "At least one iteration must be run"; +} + +void State::PauseTiming() { + // Add in time accumulated so far + CHECK(running_benchmark); + timer_manager->StopTimer(); +} + +void State::ResumeTiming() { + CHECK(running_benchmark); + timer_manager->StartTimer(); +} + +void State::SetLabel(const char* label) { + CHECK(running_benchmark); + MutexLock l(GetBenchmarkLock()); + *GetReportLabel() = label; +} + +namespace internal { +namespace { + +void PrintBenchmarkList() { + std::vector benchmarks; + auto families = BenchmarkFamilies::GetInstance(); + if (!families->FindBenchmarks(".", &benchmarks)) return; + + for (const internal::Benchmark::Instance& benchmark : benchmarks) { + std::cout << benchmark.name << "\n"; + } +} + +void RunMatchingBenchmarks(const std::string& spec, + BenchmarkReporter* reporter) { + CHECK(reporter != nullptr); + if (spec.empty()) return; + + std::vector benchmarks; + auto families = BenchmarkFamilies::GetInstance(); + if (!families->FindBenchmarks(spec, &benchmarks)) return; + + // Determine the width of the name field using a minimum width of 10. + size_t name_field_width = 10; + for (const Benchmark::Instance& benchmark : benchmarks) { + name_field_width = + std::max(name_field_width, benchmark.name.size()); + } + if (FLAGS_benchmark_repetitions > 1) + name_field_width += std::strlen("_stddev"); + + // Print header here + BenchmarkReporter::Context context; + context.num_cpus = NumCPUs(); + context.mhz_per_cpu = CyclesPerSecond() / 1000000.0f; + + context.cpu_scaling_enabled = CpuScalingEnabled(); + context.name_field_width = name_field_width; + + if (reporter->ReportContext(context)) { + for (const auto& benchmark : benchmarks) { + RunBenchmark(benchmark, reporter); + } + } +} + +std::unique_ptr GetDefaultReporter() { + typedef std::unique_ptr PtrType; + if (FLAGS_benchmark_format == "tabular") { + return PtrType(new ConsoleReporter); + } else if (FLAGS_benchmark_format == "json") { + return PtrType(new JSONReporter); + } else if (FLAGS_benchmark_format == "csv") { + return PtrType(new CSVReporter); + } else { + std::cerr << "Unexpected format: '" << FLAGS_benchmark_format << "'\n"; + std::exit(1); + } +} + +} // end namespace +} // end namespace internal + +void RunSpecifiedBenchmarks() { + RunSpecifiedBenchmarks(nullptr); +} + +void RunSpecifiedBenchmarks(BenchmarkReporter* reporter) { + if (FLAGS_benchmark_list_tests) { + internal::PrintBenchmarkList(); + return; + } + std::string spec = FLAGS_benchmark_filter; + if (spec.empty() || spec == "all") + spec = "."; // Regexp that matches all benchmarks + + std::unique_ptr default_reporter; + if (!reporter) { + default_reporter = internal::GetDefaultReporter(); + reporter = default_reporter.get(); + } + internal::RunMatchingBenchmarks(spec, reporter); + reporter->Finalize(); +} + +namespace internal { + +void PrintUsageAndExit() { + fprintf(stdout, + "benchmark" + " [--benchmark_list_tests={true|false}]\n" + " [--benchmark_filter=]\n" + " [--benchmark_min_time=]\n" + " [--benchmark_repetitions=]\n" + " [--benchmark_format=]\n" + " [--color_print={true|false}]\n" + " [--v=]\n"); + exit(0); +} + +void ParseCommandLineFlags(int* argc, char** argv) { + using namespace benchmark; + for (int i = 1; i < *argc; ++i) { + if ( + ParseBoolFlag(argv[i], "benchmark_list_tests", + &FLAGS_benchmark_list_tests) || + ParseStringFlag(argv[i], "benchmark_filter", + &FLAGS_benchmark_filter) || + ParseDoubleFlag(argv[i], "benchmark_min_time", + &FLAGS_benchmark_min_time) || + ParseInt32Flag(argv[i], "benchmark_repetitions", + &FLAGS_benchmark_repetitions) || + ParseStringFlag(argv[i], "benchmark_format", + &FLAGS_benchmark_format) || + ParseBoolFlag(argv[i], "color_print", + &FLAGS_color_print) || + ParseInt32Flag(argv[i], "v", &FLAGS_v)) { + for (int j = i; j != *argc; ++j) argv[j] = argv[j + 1]; + + --(*argc); + --i; + } else if (IsFlag(argv[i], "help")) { + PrintUsageAndExit(); + } + } + if (FLAGS_benchmark_format != "tabular" && + FLAGS_benchmark_format != "json" && + FLAGS_benchmark_format != "csv") { + PrintUsageAndExit(); + } +} + +Benchmark* RegisterBenchmarkInternal(Benchmark* bench) { + std::unique_ptr bench_ptr(bench); + BenchmarkFamilies* families = BenchmarkFamilies::GetInstance(); + families->AddBenchmark(std::move(bench_ptr)); + return bench; +} + +} // end namespace internal + +void Initialize(int* argc, char** argv) { + internal::ParseCommandLineFlags(argc, argv); + internal::SetLogLevel(FLAGS_v); + // TODO remove this. It prints some output the first time it is called. + // We don't want to have this ouput printed during benchmarking. + MyCPUUsage(); + // The first call to walltime::Now initialized it. Call it once to + // prevent the initialization from happening in a benchmark. + walltime::Now(); +} + +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/check.h b/3rdparty/benchmark/src/check.h new file mode 100644 index 00000000000..12933f347fa --- /dev/null +++ b/3rdparty/benchmark/src/check.h @@ -0,0 +1,60 @@ +#ifndef CHECK_H_ +#define CHECK_H_ + +#include +#include + +#include "internal_macros.h" +#include "log.h" + +namespace benchmark { +namespace internal { + +// CheckHandler is the class constructed by failing CHECK macros. CheckHandler +// will log information about the failures and abort when it is destructed. +class CheckHandler { +public: + CheckHandler(const char* check, const char* file, const char* func, int line) + : log_(GetErrorLogInstance()) + { + log_ << file << ":" << line << ": " << func << ": Check `" + << check << "' failed. "; + } + + std::ostream& GetLog() { + return log_; + } + + BENCHMARK_NORETURN ~CheckHandler() { + log_ << std::endl; + std::abort(); + } + + CheckHandler & operator=(const CheckHandler&) = delete; + CheckHandler(const CheckHandler&) = delete; + CheckHandler() = delete; +private: + std::ostream& log_; +}; + +} // end namespace internal +} // end namespace benchmark + +// The CHECK macro returns a std::ostream object that can have extra information +// written to it. +#ifndef NDEBUG +# define CHECK(b) (b ? ::benchmark::internal::GetNullLogInstance() \ + : ::benchmark::internal::CheckHandler( \ + #b, __FILE__, __func__, __LINE__).GetLog()) +#else +# define CHECK(b) ::benchmark::internal::GetNullLogInstance() +#endif + +#define CHECK_EQ(a, b) CHECK((a) == (b)) +#define CHECK_NE(a, b) CHECK((a) != (b)) +#define CHECK_GE(a, b) CHECK((a) >= (b)) +#define CHECK_LE(a, b) CHECK((a) <= (b)) +#define CHECK_GT(a, b) CHECK((a) > (b)) +#define CHECK_LT(a, b) CHECK((a) < (b)) + +#endif // CHECK_H_ diff --git a/3rdparty/benchmark/src/colorprint.cc b/3rdparty/benchmark/src/colorprint.cc new file mode 100644 index 00000000000..81f917b2676 --- /dev/null +++ b/3rdparty/benchmark/src/colorprint.cc @@ -0,0 +1,116 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "colorprint.h" + +#include +#include + +#include "commandlineflags.h" +#include "internal_macros.h" + +#ifdef BENCHMARK_OS_WINDOWS +#include +#endif + +DECLARE_bool(color_print); + +namespace benchmark { +namespace { +#ifdef BENCHMARK_OS_WINDOWS +typedef WORD PlatformColorCode; +#else +typedef const char* PlatformColorCode; +#endif + +PlatformColorCode GetPlatformColorCode(LogColor color) { +#ifdef BENCHMARK_OS_WINDOWS + switch (color) { + case COLOR_RED: + return FOREGROUND_RED; + case COLOR_GREEN: + return FOREGROUND_GREEN; + case COLOR_YELLOW: + return FOREGROUND_RED | FOREGROUND_GREEN; + case COLOR_BLUE: + return FOREGROUND_BLUE; + case COLOR_MAGENTA: + return FOREGROUND_BLUE | FOREGROUND_RED; + case COLOR_CYAN: + return FOREGROUND_BLUE | FOREGROUND_GREEN; + case COLOR_WHITE: // fall through to default + default: + return 0; + } +#else + switch (color) { + case COLOR_RED: + return "1"; + case COLOR_GREEN: + return "2"; + case COLOR_YELLOW: + return "3"; + case COLOR_BLUE: + return "4"; + case COLOR_MAGENTA: + return "5"; + case COLOR_CYAN: + return "6"; + case COLOR_WHITE: + return "7"; + default: + return nullptr; + }; +#endif +} +} // end namespace + +void ColorPrintf(LogColor color, const char* fmt, ...) { + va_list args; + va_start(args, fmt); + + if (!FLAGS_color_print) { + vprintf(fmt, args); + va_end(args); + return; + } + +#ifdef BENCHMARK_OS_WINDOWS + const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); + + // Gets the current text color. + CONSOLE_SCREEN_BUFFER_INFO buffer_info; + GetConsoleScreenBufferInfo(stdout_handle, &buffer_info); + const WORD old_color_attrs = buffer_info.wAttributes; + + // We need to flush the stream buffers into the console before each + // SetConsoleTextAttribute call lest it affect the text that is already + // printed but has not yet reached the console. + fflush(stdout); + SetConsoleTextAttribute(stdout_handle, + GetPlatformColorCode(color) | FOREGROUND_INTENSITY); + vprintf(fmt, args); + + fflush(stdout); + // Restores the text color. + SetConsoleTextAttribute(stdout_handle, old_color_attrs); +#else + const char* color_code = GetPlatformColorCode(color); + if (color_code) fprintf(stdout, "\033[0;3%sm", color_code); + vprintf(fmt, args); + printf("\033[m"); // Resets the terminal to default. +#endif + va_end(args); +} +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/colorprint.h b/3rdparty/benchmark/src/colorprint.h new file mode 100644 index 00000000000..54d1f664b3b --- /dev/null +++ b/3rdparty/benchmark/src/colorprint.h @@ -0,0 +1,19 @@ +#ifndef BENCHMARK_COLORPRINT_H_ +#define BENCHMARK_COLORPRINT_H_ + +namespace benchmark { +enum LogColor { + COLOR_DEFAULT, + COLOR_RED, + COLOR_GREEN, + COLOR_YELLOW, + COLOR_BLUE, + COLOR_MAGENTA, + COLOR_CYAN, + COLOR_WHITE +}; + +void ColorPrintf(LogColor color, const char* fmt, ...); +} // end namespace benchmark + +#endif // BENCHMARK_COLORPRINT_H_ diff --git a/3rdparty/benchmark/src/commandlineflags.cc b/3rdparty/benchmark/src/commandlineflags.cc new file mode 100644 index 00000000000..3e9a37a71d6 --- /dev/null +++ b/3rdparty/benchmark/src/commandlineflags.cc @@ -0,0 +1,220 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "commandlineflags.h" + +#include +#include +#include +#include + +namespace benchmark { +// Parses 'str' for a 32-bit signed integer. If successful, writes +// the result to *value and returns true; otherwise leaves *value +// unchanged and returns false. +bool ParseInt32(const std::string& src_text, const char* str, int32_t* value) { + // Parses the environment variable as a decimal integer. + char* end = nullptr; + const long long_value = strtol(str, &end, 10); // NOLINT + + // Has strtol() consumed all characters in the string? + if (*end != '\0') { + // No - an invalid character was encountered. + std::cerr << src_text << " is expected to be a 32-bit integer, " + << "but actually has value \"" << str << "\".\n"; + return false; + } + + // Is the parsed value in the range of an Int32? + const int32_t result = static_cast(long_value); + if (long_value == std::numeric_limits::max() || + long_value == std::numeric_limits::min() || + // The parsed value overflows as a long. (strtol() returns + // LONG_MAX or LONG_MIN when the input overflows.) + result != long_value + // The parsed value overflows as an Int32. + ) { + std::cerr << src_text << " is expected to be a 32-bit integer, " + << "but actually has value \"" << str << "\", " + << "which overflows.\n"; + return false; + } + + *value = result; + return true; +} + +// Parses 'str' for a double. If successful, writes the result to *value and +// returns true; otherwise leaves *value unchanged and returns false. +bool ParseDouble(const std::string& src_text, const char* str, double* value) { + // Parses the environment variable as a decimal integer. + char* end = nullptr; + const double double_value = strtod(str, &end); // NOLINT + + // Has strtol() consumed all characters in the string? + if (*end != '\0') { + // No - an invalid character was encountered. + std::cerr << src_text << " is expected to be a double, " + << "but actually has value \"" << str << "\".\n"; + return false; + } + + *value = double_value; + return true; +} + +inline const char* GetEnv(const char* name) { +#if defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9) + // Environment variables which we programmatically clear will be set to the + // empty string rather than unset (nullptr). Handle that case. + const char* const env = getenv(name); + return (env != nullptr && env[0] != '\0') ? env : nullptr; +#else + return getenv(name); +#endif +} + +// Returns the name of the environment variable corresponding to the +// given flag. For example, FlagToEnvVar("foo") will return +// "BENCHMARK_FOO" in the open-source version. +static std::string FlagToEnvVar(const char* flag) { + const std::string flag_str(flag); + + std::string env_var; + for (size_t i = 0; i != flag_str.length(); ++i) + env_var += static_cast(::toupper(flag_str.c_str()[i])); + + return "BENCHMARK_" + env_var; +} + +// Reads and returns the Boolean environment variable corresponding to +// the given flag; if it's not set, returns default_value. +// +// The value is considered true iff it's not "0". +bool BoolFromEnv(const char* flag, bool default_value) { + const std::string env_var = FlagToEnvVar(flag); + const char* const string_value = GetEnv(env_var.c_str()); + return string_value == nullptr ? default_value : strcmp(string_value, "0") != 0; +} + +// Reads and returns a 32-bit integer stored in the environment +// variable corresponding to the given flag; if it isn't set or +// doesn't represent a valid 32-bit integer, returns default_value. +int32_t Int32FromEnv(const char* flag, int32_t default_value) { + const std::string env_var = FlagToEnvVar(flag); + const char* const string_value = GetEnv(env_var.c_str()); + if (string_value == nullptr) { + // The environment variable is not set. + return default_value; + } + + int32_t result = default_value; + if (!ParseInt32(std::string("Environment variable ") + env_var, string_value, + &result)) { + std::cout << "The default value " << default_value << " is used.\n"; + return default_value; + } + + return result; +} + +// Reads and returns the string environment variable corresponding to +// the given flag; if it's not set, returns default_value. +const char* StringFromEnv(const char* flag, const char* default_value) { + const std::string env_var = FlagToEnvVar(flag); + const char* const value = GetEnv(env_var.c_str()); + return value == nullptr ? default_value : value; +} + +// Parses a string as a command line flag. The string should have +// the format "--flag=value". When def_optional is true, the "=value" +// part can be omitted. +// +// Returns the value of the flag, or nullptr if the parsing failed. +const char* ParseFlagValue(const char* str, const char* flag, + bool def_optional) { + // str and flag must not be nullptr. + if (str == nullptr || flag == nullptr) return nullptr; + + // The flag must start with "--". + const std::string flag_str = std::string("--") + std::string(flag); + const size_t flag_len = flag_str.length(); + if (strncmp(str, flag_str.c_str(), flag_len) != 0) return nullptr; + + // Skips the flag name. + const char* flag_end = str + flag_len; + + // When def_optional is true, it's OK to not have a "=value" part. + if (def_optional && (flag_end[0] == '\0')) return flag_end; + + // If def_optional is true and there are more characters after the + // flag name, or if def_optional is false, there must be a '=' after + // the flag name. + if (flag_end[0] != '=') return nullptr; + + // Returns the string after "=". + return flag_end + 1; +} + +bool ParseBoolFlag(const char* str, const char* flag, bool* value) { + // Gets the value of the flag as a string. + const char* const value_str = ParseFlagValue(str, flag, true); + + // Aborts if the parsing failed. + if (value_str == nullptr) return false; + + // Converts the string value to a bool. + *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F'); + return true; +} + +bool ParseInt32Flag(const char* str, const char* flag, int32_t* value) { + // Gets the value of the flag as a string. + const char* const value_str = ParseFlagValue(str, flag, false); + + // Aborts if the parsing failed. + if (value_str == nullptr) return false; + + // Sets *value to the value of the flag. + return ParseInt32(std::string("The value of flag --") + flag, value_str, + value); +} + +bool ParseDoubleFlag(const char* str, const char* flag, double* value) { + // Gets the value of the flag as a string. + const char* const value_str = ParseFlagValue(str, flag, false); + + // Aborts if the parsing failed. + if (value_str == nullptr) return false; + + // Sets *value to the value of the flag. + return ParseDouble(std::string("The value of flag --") + flag, value_str, + value); +} + +bool ParseStringFlag(const char* str, const char* flag, std::string* value) { + // Gets the value of the flag as a string. + const char* const value_str = ParseFlagValue(str, flag, false); + + // Aborts if the parsing failed. + if (value_str == nullptr) return false; + + *value = value_str; + return true; +} + +bool IsFlag(const char* str, const char* flag) { + return (ParseFlagValue(str, flag, true) != nullptr); +} +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/commandlineflags.h b/3rdparty/benchmark/src/commandlineflags.h new file mode 100644 index 00000000000..34b9c6f30e9 --- /dev/null +++ b/3rdparty/benchmark/src/commandlineflags.h @@ -0,0 +1,76 @@ +#ifndef BENCHMARK_COMMANDLINEFLAGS_H_ +#define BENCHMARK_COMMANDLINEFLAGS_H_ + +#include +#include + +// Macro for referencing flags. +#define FLAG(name) FLAGS_##name + +// Macros for declaring flags. +#define DECLARE_bool(name) extern bool FLAG(name) +#define DECLARE_int32(name) extern int32_t FLAG(name) +#define DECLARE_int64(name) extern int64_t FLAG(name) +#define DECLARE_double(name) extern double FLAG(name) +#define DECLARE_string(name) extern std::string FLAG(name) + +// Macros for defining flags. +#define DEFINE_bool(name, default_val, doc) bool FLAG(name) = (default_val) +#define DEFINE_int32(name, default_val, doc) int32_t FLAG(name) = (default_val) +#define DEFINE_int64(name, default_val, doc) int64_t FLAG(name) = (default_val) +#define DEFINE_double(name, default_val, doc) double FLAG(name) = (default_val) +#define DEFINE_string(name, default_val, doc) \ + std::string FLAG(name) = (default_val) + +namespace benchmark { +// Parses 'str' for a 32-bit signed integer. If successful, writes the result +// to *value and returns true; otherwise leaves *value unchanged and returns +// false. +bool ParseInt32(const std::string& src_text, const char* str, int32_t* value); + +// Parses a bool/Int32/string from the environment variable +// corresponding to the given Google Test flag. +bool BoolFromEnv(const char* flag, bool default_val); +int32_t Int32FromEnv(const char* flag, int32_t default_val); +double DoubleFromEnv(const char* flag, double default_val); +const char* StringFromEnv(const char* flag, const char* default_val); + +// Parses a string for a bool flag, in the form of either +// "--flag=value" or "--flag". +// +// In the former case, the value is taken as true as long as it does +// not start with '0', 'f', or 'F'. +// +// In the latter case, the value is taken as true. +// +// On success, stores the value of the flag in *value, and returns +// true. On failure, returns false without changing *value. +bool ParseBoolFlag(const char* str, const char* flag, bool* value); + +// Parses a string for an Int32 flag, in the form of +// "--flag=value". +// +// On success, stores the value of the flag in *value, and returns +// true. On failure, returns false without changing *value. +bool ParseInt32Flag(const char* str, const char* flag, int32_t* value); + +// Parses a string for a Double flag, in the form of +// "--flag=value". +// +// On success, stores the value of the flag in *value, and returns +// true. On failure, returns false without changing *value. +bool ParseDoubleFlag(const char* str, const char* flag, double* value); + +// Parses a string for a string flag, in the form of +// "--flag=value". +// +// On success, stores the value of the flag in *value, and returns +// true. On failure, returns false without changing *value. +bool ParseStringFlag(const char* str, const char* flag, std::string* value); + +// Returns true if the string matches the flag. +bool IsFlag(const char* str, const char* flag); + +} // end namespace benchmark + +#endif // BENCHMARK_COMMANDLINEFLAGS_H_ diff --git a/3rdparty/benchmark/src/console_reporter.cc b/3rdparty/benchmark/src/console_reporter.cc new file mode 100644 index 00000000000..bee3c8576c0 --- /dev/null +++ b/3rdparty/benchmark/src/console_reporter.cc @@ -0,0 +1,116 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "benchmark/reporter.h" + +#include +#include +#include +#include +#include + +#include "check.h" +#include "colorprint.h" +#include "string_util.h" +#include "walltime.h" + +namespace benchmark { + +bool ConsoleReporter::ReportContext(const Context& context) { + name_field_width_ = context.name_field_width; + + std::cerr << "Run on (" << context.num_cpus << " X " << context.mhz_per_cpu + << " MHz CPU " << ((context.num_cpus > 1) ? "s" : "") << ")\n"; + + std::cerr << LocalDateTimeString() << "\n"; + + if (context.cpu_scaling_enabled) { + std::cerr << "***WARNING*** CPU scaling is enabled, the benchmark " + "real time measurements may be noisy and will incure extra " + "overhead.\n"; + } + +#ifndef NDEBUG + std::cerr << "***WARNING*** Library was built as DEBUG. Timings may be " + "affected.\n"; +#endif + + int output_width = fprintf(stdout, "%-*s %10s %10s %10s\n", + static_cast(name_field_width_), "Benchmark", + "Time(ns)", "CPU(ns)", "Iterations"); + std::cout << std::string(output_width - 1, '-') << "\n"; + + return true; +} + +void ConsoleReporter::ReportRuns(const std::vector& reports) { + if (reports.empty()) { + return; + } + + for (Run const& run : reports) { + CHECK_EQ(reports[0].benchmark_name, run.benchmark_name); + PrintRunData(run); + } + + if (reports.size() < 2) { + // We don't report aggregated data if there was a single run. + return; + } + + Run mean_data; + Run stddev_data; + BenchmarkReporter::ComputeStats(reports, &mean_data, &stddev_data); + + // Output using PrintRun. + PrintRunData(mean_data); + PrintRunData(stddev_data); +} + +void ConsoleReporter::PrintRunData(const Run& result) { + // Format bytes per second + std::string rate; + if (result.bytes_per_second > 0) { + rate = StrCat(" ", HumanReadableNumber(result.bytes_per_second), "B/s"); + } + + // Format items per second + std::string items; + if (result.items_per_second > 0) { + items = StrCat(" ", HumanReadableNumber(result.items_per_second), + " items/s"); + } + + double const multiplier = 1e9; // nano second multiplier + ColorPrintf(COLOR_GREEN, "%-*s ", + name_field_width_, result.benchmark_name.c_str()); + if (result.iterations == 0) { + ColorPrintf(COLOR_YELLOW, "%10.0f %10.0f ", + result.real_accumulated_time * multiplier, + result.cpu_accumulated_time * multiplier); + } else { + ColorPrintf(COLOR_YELLOW, "%10.0f %10.0f ", + (result.real_accumulated_time * multiplier) / + (static_cast(result.iterations)), + (result.cpu_accumulated_time * multiplier) / + (static_cast(result.iterations))); + } + ColorPrintf(COLOR_CYAN, "%10lld", result.iterations); + ColorPrintf(COLOR_DEFAULT, "%*s %*s %s\n", + 13, rate.c_str(), + 18, items.c_str(), + result.report_label.c_str()); +} + +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/csv_reporter.cc b/3rdparty/benchmark/src/csv_reporter.cc new file mode 100644 index 00000000000..a83694338bd --- /dev/null +++ b/3rdparty/benchmark/src/csv_reporter.cc @@ -0,0 +1,105 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "benchmark/reporter.h" + +#include +#include +#include +#include + +#include "string_util.h" +#include "walltime.h" + +// File format reference: http://edoceo.com/utilitas/csv-file-format. + +namespace benchmark { + +bool CSVReporter::ReportContext(const Context& context) { + std::cerr << "Run on (" << context.num_cpus << " X " << context.mhz_per_cpu + << " MHz CPU " << ((context.num_cpus > 1) ? "s" : "") << ")\n"; + + std::cerr << LocalDateTimeString() << "\n"; + + if (context.cpu_scaling_enabled) { + std::cerr << "***WARNING*** CPU scaling is enabled, the benchmark " + "real time measurements may be noisy and will incure extra " + "overhead.\n"; + } + +#ifndef NDEBUG + std::cerr << "***WARNING*** Library was built as DEBUG. Timings may be " + "affected.\n"; +#endif + std::cout << "name,iterations,real_time,cpu_time,bytes_per_second," + "items_per_second,label\n"; + return true; +} + +void CSVReporter::ReportRuns(std::vector const& reports) { + if (reports.empty()) { + return; + } + + std::vector reports_cp = reports; + if (reports.size() >= 2) { + Run mean_data; + Run stddev_data; + BenchmarkReporter::ComputeStats(reports, &mean_data, &stddev_data); + reports_cp.push_back(mean_data); + reports_cp.push_back(stddev_data); + } + for (auto it = reports_cp.begin(); it != reports_cp.end(); ++it) { + PrintRunData(*it); + } +} + +void CSVReporter::PrintRunData(Run const& run) { + double const multiplier = 1e9; // nano second multiplier + double cpu_time = run.cpu_accumulated_time * multiplier; + double real_time = run.real_accumulated_time * multiplier; + if (run.iterations != 0) { + real_time = real_time / static_cast(run.iterations); + cpu_time = cpu_time / static_cast(run.iterations); + } + + // Field with embedded double-quote characters must be doubled and the field + // delimited with double-quotes. + std::string name = run.benchmark_name; + ReplaceAll(&name, "\"", "\"\""); + std::cout << "\"" << name << "\","; + + std::cout << run.iterations << ","; + std::cout << real_time << ","; + std::cout << cpu_time << ","; + + if (run.bytes_per_second > 0.0) { + std::cout << run.bytes_per_second; + } + std::cout << ","; + if (run.items_per_second > 0.0) { + std::cout << run.items_per_second; + } + std::cout << ","; + if (!run.report_label.empty()) { + // Field with embedded double-quote characters must be doubled and the field + // delimited with double-quotes. + std::string label = run.report_label; + ReplaceAll(&label, "\"", "\"\""); + std::cout << "\"" << label << "\""; + } + std::cout << '\n'; +} + +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/cycleclock.h b/3rdparty/benchmark/src/cycleclock.h new file mode 100644 index 00000000000..42541dafc88 --- /dev/null +++ b/3rdparty/benchmark/src/cycleclock.h @@ -0,0 +1,137 @@ +// ---------------------------------------------------------------------- +// CycleClock +// A CycleClock tells you the current time in Cycles. The "time" +// is actually time since power-on. This is like time() but doesn't +// involve a system call and is much more precise. +// +// NOTE: Not all cpu/platform/kernel combinations guarantee that this +// clock increments at a constant rate or is synchronized across all logical +// cpus in a system. +// +// If you need the above guarantees, please consider using a different +// API. There are efforts to provide an interface which provides a millisecond +// granularity and implemented as a memory read. A memory read is generally +// cheaper than the CycleClock for many architectures. +// +// Also, in some out of order CPU implementations, the CycleClock is not +// serializing. So if you're trying to count at cycles granularity, your +// data might be inaccurate due to out of order instruction execution. +// ---------------------------------------------------------------------- + +#ifndef BENCHMARK_CYCLECLOCK_H_ +#define BENCHMARK_CYCLECLOCK_H_ + +#include + +#include "benchmark/macros.h" +#include "internal_macros.h" + +#if defined(BENCHMARK_OS_MACOSX) +#include +#endif +// For MSVC, we want to use '_asm rdtsc' when possible (since it works +// with even ancient MSVC compilers), and when not possible the +// __rdtsc intrinsic, declared in . Unfortunately, in some +// environments, and have conflicting +// declarations of some other intrinsics, breaking compilation. +// Therefore, we simply declare __rdtsc ourselves. See also +// http://connect.microsoft.com/VisualStudio/feedback/details/262047 +#if defined(COMPILER_MSVC) && !defined(_M_IX86) +extern "C" uint64_t __rdtsc(); +#pragma intrinsic(__rdtsc) +#endif + +#ifndef BENCHMARK_OS_WINDOWS +#include +#endif + +namespace benchmark { +// NOTE: only i386 and x86_64 have been well tested. +// PPC, sparc, alpha, and ia64 are based on +// http://peter.kuscsik.com/wordpress/?p=14 +// with modifications by m3b. See also +// https://setisvn.ssl.berkeley.edu/svn/lib/fftw-3.0.1/kernel/cycle.h +namespace cycleclock { +// This should return the number of cycles since power-on. Thread-safe. +inline BENCHMARK_ALWAYS_INLINE int64_t Now() { +#if defined(BENCHMARK_OS_MACOSX) + // this goes at the top because we need ALL Macs, regardless of + // architecture, to return the number of "mach time units" that + // have passed since startup. See sysinfo.cc where + // InitializeSystemInfo() sets the supposed cpu clock frequency of + // macs to the number of mach time units per second, not actual + // CPU clock frequency (which can change in the face of CPU + // frequency scaling). Also note that when the Mac sleeps, this + // counter pauses; it does not continue counting, nor does it + // reset to zero. + return mach_absolute_time(); +#elif defined(__i386__) + int64_t ret; + __asm__ volatile("rdtsc" : "=A"(ret)); + return ret; +#elif defined(__x86_64__) || defined(__amd64__) + uint64_t low, high; + __asm__ volatile("rdtsc" : "=a"(low), "=d"(high)); + return (high << 32) | low; +#elif defined(__powerpc__) || defined(__ppc__) + // This returns a time-base, which is not always precisely a cycle-count. + int64_t tbl, tbu0, tbu1; + asm("mftbu %0" : "=r"(tbu0)); + asm("mftb %0" : "=r"(tbl)); + asm("mftbu %0" : "=r"(tbu1)); + tbl &= -static_cast(tbu0 == tbu1); + // high 32 bits in tbu1; low 32 bits in tbl (tbu0 is garbage) + return (tbu1 << 32) | tbl; +#elif defined(__sparc__) + int64_t tick; + asm(".byte 0x83, 0x41, 0x00, 0x00"); + asm("mov %%g1, %0" : "=r"(tick)); + return tick; +#elif defined(__ia64__) + int64_t itc; + asm("mov %0 = ar.itc" : "=r"(itc)); + return itc; +#elif defined(COMPILER_MSVC) && defined(_M_IX86) + // Older MSVC compilers (like 7.x) don't seem to support the + // __rdtsc intrinsic properly, so I prefer to use _asm instead + // when I know it will work. Otherwise, I'll use __rdtsc and hope + // the code is being compiled with a non-ancient compiler. + _asm rdtsc +#elif defined(COMPILER_MSVC) + return __rdtsc(); +#elif defined(__ARM_ARCH) +#if (__ARM_ARCH >= 6) // V6 is the earliest arch that has a standard cyclecount + uint32_t pmccntr; + uint32_t pmuseren; + uint32_t pmcntenset; + // Read the user mode perf monitor counter access permissions. + asm("mrc p15, 0, %0, c9, c14, 0" : "=r"(pmuseren)); + if (pmuseren & 1) { // Allows reading perfmon counters for user mode code. + asm("mrc p15, 0, %0, c9, c12, 1" : "=r"(pmcntenset)); + if (pmcntenset & 0x80000000ul) { // Is it counting? + asm("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr)); + // The counter is set up to count every 64th cycle + return static_cast(pmccntr) * 64; // Should optimize to << 6 + } + } +#endif + struct timeval tv; + gettimeofday(&tv, nullptr); + return static_cast(tv.tv_sec) * 1000000 + tv.tv_usec; +#elif defined(__mips__) + // mips apparently only allows rdtsc for superusers, so we fall + // back to gettimeofday. It's possible clock_gettime would be better. + struct timeval tv; + gettimeofday(&tv, nullptr); + return static_cast(tv.tv_sec) * 1000000 + tv.tv_usec; +#else +// The soft failover to a generic implementation is automatic only for ARM. +// For other platforms the developer is expected to make an attempt to create +// a fast implementation and use generic version if nothing better is available. +#error You need to define CycleTimer for your OS and CPU +#endif +} +} // end namespace cycleclock +} // end namespace benchmark + +#endif // BENCHMARK_CYCLECLOCK_H_ diff --git a/3rdparty/benchmark/src/internal_macros.h b/3rdparty/benchmark/src/internal_macros.h new file mode 100644 index 00000000000..1080ac9435a --- /dev/null +++ b/3rdparty/benchmark/src/internal_macros.h @@ -0,0 +1,40 @@ +#ifndef BENCHMARK_INTERNAL_MACROS_H_ +#define BENCHMARK_INTERNAL_MACROS_H_ + +#include "benchmark/macros.h" + +#ifndef __has_feature +# define __has_feature(x) 0 +#endif + +#if __has_feature(cxx_attributes) +# define BENCHMARK_NORETURN [[noreturn]] +#elif defined(__GNUC__) +# define BENCHMARK_NORETURN __attribute__((noreturn)) +#else +# define BENCHMARK_NORETURN +#endif + +#if defined(__CYGWIN__) +# define BENCHMARK_OS_CYGWIN 1 +#elif defined(_WIN32) +# define BENCHMARK_OS_WINDOWS 1 +#elif defined(__APPLE__) +// TODO(ericwf) This doesn't actually check that it is a Mac OSX system. Just +// that it is an apple system. +# define BENCHMARK_OS_MACOSX 1 +#elif defined(__FreeBSD__) +# define BENCHMARK_OS_FREEBSD 1 +#elif defined(__linux__) +# define BENCHMARK_OS_LINUX 1 +#endif + +#if defined(__clang__) +# define COMPILER_CLANG +#elif defined(_MSC_VER) +# define COMPILER_MSVC +#elif defined(__GNUC__) +# define COMPILER_GCC +#endif + +#endif // BENCHMARK_INTERNAL_MACROS_H_ diff --git a/3rdparty/benchmark/src/json_reporter.cc b/3rdparty/benchmark/src/json_reporter.cc new file mode 100644 index 00000000000..def50ac49cf --- /dev/null +++ b/3rdparty/benchmark/src/json_reporter.cc @@ -0,0 +1,159 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "benchmark/reporter.h" + +#include +#include +#include +#include + +#include "string_util.h" +#include "walltime.h" + +namespace benchmark { + +namespace { + +std::string FormatKV(std::string const& key, std::string const& value) { + return StringPrintF("\"%s\": \"%s\"", key.c_str(), value.c_str()); +} + +std::string FormatKV(std::string const& key, const char* value) { + return StringPrintF("\"%s\": \"%s\"", key.c_str(), value); +} + +std::string FormatKV(std::string const& key, bool value) { + return StringPrintF("\"%s\": %s", key.c_str(), value ? "true" : "false"); +} + +std::string FormatKV(std::string const& key, int64_t value) { + std::stringstream ss; + ss << '"' << key << "\": " << value; + return ss.str(); +} + +int64_t RoundDouble(double v) { + return static_cast(v + 0.5); +} + +} // end namespace + +bool JSONReporter::ReportContext(const Context& context) { + std::ostream& out = std::cout; + + out << "{\n"; + std::string inner_indent(2, ' '); + + // Open context block and print context information. + out << inner_indent << "\"context\": {\n"; + std::string indent(4, ' '); + + std::string walltime_value = LocalDateTimeString(); + out << indent << FormatKV("date", walltime_value) << ",\n"; + + out << indent + << FormatKV("num_cpus", static_cast(context.num_cpus)) + << ",\n"; + out << indent + << FormatKV("mhz_per_cpu", RoundDouble(context.mhz_per_cpu)) + << ",\n"; + out << indent + << FormatKV("cpu_scaling_enabled", context.cpu_scaling_enabled) + << ",\n"; + +#if defined(NDEBUG) + const char build_type[] = "release"; +#else + const char build_type[] = "debug"; +#endif + out << indent << FormatKV("library_build_type", build_type) << "\n"; + // Close context block and open the list of benchmarks. + out << inner_indent << "},\n"; + out << inner_indent << "\"benchmarks\": [\n"; + return true; +} + +void JSONReporter::ReportRuns(std::vector const& reports) { + if (reports.empty()) { + return; + } + std::string indent(4, ' '); + std::ostream& out = std::cout; + if (!first_report_) { + out << ",\n"; + } + first_report_ = false; + std::vector reports_cp = reports; + if (reports.size() >= 2) { + Run mean_data; + Run stddev_data; + BenchmarkReporter::ComputeStats(reports, &mean_data, &stddev_data); + reports_cp.push_back(mean_data); + reports_cp.push_back(stddev_data); + } + for (auto it = reports_cp.begin(); it != reports_cp.end(); ++it) { + out << indent << "{\n"; + PrintRunData(*it); + out << indent << '}'; + auto it_cp = it; + if (++it_cp != reports_cp.end()) { + out << ",\n"; + } + } +} + +void JSONReporter::Finalize() { + // Close the list of benchmarks and the top level object. + std::cout << "\n ]\n}\n"; +} + +void JSONReporter::PrintRunData(Run const& run) { + double const multiplier = 1e9; // nano second multiplier + double cpu_time = run.cpu_accumulated_time * multiplier; + double real_time = run.real_accumulated_time * multiplier; + if (run.iterations != 0) { + real_time = real_time / static_cast(run.iterations); + cpu_time = cpu_time / static_cast(run.iterations); + } + + std::string indent(6, ' '); + std::ostream& out = std::cout; + out << indent + << FormatKV("name", run.benchmark_name) + << ",\n"; + out << indent + << FormatKV("iterations", run.iterations) + << ",\n"; + out << indent + << FormatKV("real_time", RoundDouble(real_time)) + << ",\n"; + out << indent + << FormatKV("cpu_time", RoundDouble(cpu_time)); + if (run.bytes_per_second > 0.0) { + out << ",\n" << indent + << FormatKV("bytes_per_second", RoundDouble(run.bytes_per_second)); + } + if (run.items_per_second > 0.0) { + out << ",\n" << indent + << FormatKV("items_per_second", RoundDouble(run.items_per_second)); + } + if (!run.report_label.empty()) { + out << ",\n" << indent + << FormatKV("label", run.report_label); + } + out << '\n'; +} + +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/log.cc b/3rdparty/benchmark/src/log.cc new file mode 100644 index 00000000000..b660309d324 --- /dev/null +++ b/3rdparty/benchmark/src/log.cc @@ -0,0 +1,40 @@ +#include "log.h" + +#include + +namespace benchmark { +namespace internal { + +int& LoggingLevelImp() { + static int level = 0; + return level; +} + +void SetLogLevel(int value) { + LoggingLevelImp() = value; +} + +int GetLogLevel() { + return LoggingLevelImp(); +} + +class NullLogBuffer : public std::streambuf +{ +public: + int overflow(int c) { + return c; + } +}; + +std::ostream& GetNullLogInstance() { + static NullLogBuffer log_buff; + static std::ostream null_log(&log_buff); + return null_log; +} + +std::ostream& GetErrorLogInstance() { + return std::clog; +} + +} // end namespace internal +} // end namespace benchmark \ No newline at end of file diff --git a/3rdparty/benchmark/src/log.h b/3rdparty/benchmark/src/log.h new file mode 100644 index 00000000000..3777810e1c9 --- /dev/null +++ b/3rdparty/benchmark/src/log.h @@ -0,0 +1,28 @@ +#ifndef BENCHMARK_LOG_H_ +#define BENCHMARK_LOG_H_ + +#include + +namespace benchmark { +namespace internal { + +int GetLogLevel(); +void SetLogLevel(int level); + +std::ostream& GetNullLogInstance(); +std::ostream& GetErrorLogInstance(); + +inline std::ostream& GetLogInstanceForLevel(int level) { + if (level <= GetLogLevel()) { + return GetErrorLogInstance(); + } + return GetNullLogInstance(); +} + +} // end namespace internal +} // end namespace benchmark + +#define VLOG(x) (::benchmark::internal::GetLogInstanceForLevel(x) \ + << "-- LOG(" << x << "): ") + +#endif \ No newline at end of file diff --git a/3rdparty/benchmark/src/mutex.h b/3rdparty/benchmark/src/mutex.h new file mode 100644 index 00000000000..f37ec35b3a4 --- /dev/null +++ b/3rdparty/benchmark/src/mutex.h @@ -0,0 +1,142 @@ +#ifndef BENCHMARK_MUTEX_H_ +#define BENCHMARK_MUTEX_H_ + +#include +#include + +// Enable thread safety attributes only with clang. +// The attributes can be safely erased when compiling with other compilers. +#if defined(HAVE_THREAD_SAFETY_ATTRIBUTES) +#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) +#else +#define THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op +#endif + +#define CAPABILITY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(capability(x)) + +#define SCOPED_CAPABILITY \ + THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) + +#define GUARDED_BY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) + +#define PT_GUARDED_BY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x)) + +#define ACQUIRED_BEFORE(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__)) + +#define ACQUIRED_AFTER(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__)) + +#define REQUIRES(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(__VA_ARGS__)) + +#define REQUIRES_SHARED(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(requires_shared_capability(__VA_ARGS__)) + +#define ACQUIRE(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(__VA_ARGS__)) + +#define ACQUIRE_SHARED(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(acquire_shared_capability(__VA_ARGS__)) + +#define RELEASE(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(release_capability(__VA_ARGS__)) + +#define RELEASE_SHARED(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(__VA_ARGS__)) + +#define TRY_ACQUIRE(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_capability(__VA_ARGS__)) + +#define TRY_ACQUIRE_SHARED(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_shared_capability(__VA_ARGS__)) + +#define EXCLUDES(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__)) + +#define ASSERT_CAPABILITY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x)) + +#define ASSERT_SHARED_CAPABILITY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x)) + +#define RETURN_CAPABILITY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) + +#define NO_THREAD_SAFETY_ANALYSIS \ + THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) + + +namespace benchmark { + +typedef std::condition_variable Condition; + +// NOTE: Wrappers for std::mutex and std::unique_lock are provided so that +// we can annotate them with thread safety attributes and use the +// -Wthread-safety warning with clang. The standard library types cannot be +// used directly because they do not provided the required annotations. +class CAPABILITY("mutex") Mutex +{ +public: + Mutex() {} + + void lock() ACQUIRE() { mut_.lock(); } + void unlock() RELEASE() { mut_.unlock(); } + std::mutex& native_handle() { + return mut_; + } +private: + std::mutex mut_; +}; + + +class SCOPED_CAPABILITY MutexLock +{ + typedef std::unique_lock MutexLockImp; +public: + MutexLock(Mutex& m) ACQUIRE(m) : ml_(m.native_handle()) + { } + ~MutexLock() RELEASE() {} + MutexLockImp& native_handle() { return ml_; } +private: + MutexLockImp ml_; +}; + + +class Notification +{ +public: + Notification() : notified_yet_(false) { } + + void WaitForNotification() const EXCLUDES(mutex_) { + MutexLock m_lock(mutex_); + auto notified_fn = [this]() REQUIRES(mutex_) { + return this->HasBeenNotified(); + }; + cv_.wait(m_lock.native_handle(), notified_fn); + } + + void Notify() EXCLUDES(mutex_) { + { + MutexLock lock(mutex_); + notified_yet_ = 1; + } + cv_.notify_all(); + } + +private: + bool HasBeenNotified() const REQUIRES(mutex_) { + return notified_yet_; + } + + mutable Mutex mutex_; + mutable std::condition_variable cv_; + bool notified_yet_ GUARDED_BY(mutex_); +}; + +} // end namespace benchmark + +#endif // BENCHMARK_MUTEX_H_ diff --git a/3rdparty/benchmark/src/re.h b/3rdparty/benchmark/src/re.h new file mode 100644 index 00000000000..af57a39cffb --- /dev/null +++ b/3rdparty/benchmark/src/re.h @@ -0,0 +1,60 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef BENCHMARK_RE_H_ +#define BENCHMARK_RE_H_ + +#if defined(HAVE_STD_REGEX) +#include +#elif defined(HAVE_GNU_POSIX_REGEX) +#include +#elif defined(HAVE_POSIX_REGEX) +#include +#else +#error No regular expression backend was found! +#endif +#include + +namespace benchmark { + +// A wrapper around the POSIX regular expression API that provides automatic +// cleanup +class Regex { + public: + Regex(); + ~Regex(); + + // Compile a regular expression matcher from spec. Returns true on success. + // + // On failure (and if error is not nullptr), error is populated with a human + // readable error message if an error occurs. + bool Init(const std::string& spec, std::string* error); + + // Returns whether str matches the compiled regular expression. + bool Match(const std::string& str); + private: + bool init_; + // Underlying regular expression object +#if defined(HAVE_STD_REGEX) + std::regex re_; +#elif defined(HAVE_POSIX_REGEX) || defined(HAVE_GNU_POSIX_REGEX) + regex_t re_; +#else +# error No regular expression backend implementation available +#endif +}; + +} // end namespace benchmark + +#endif // BENCHMARK_RE_H_ diff --git a/3rdparty/benchmark/src/re_posix.cc b/3rdparty/benchmark/src/re_posix.cc new file mode 100644 index 00000000000..95b086ffd6d --- /dev/null +++ b/3rdparty/benchmark/src/re_posix.cc @@ -0,0 +1,59 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "check.h" +#include "re.h" + +namespace benchmark { + +Regex::Regex() : init_(false) { } + +bool Regex::Init(const std::string& spec, std::string* error) { + int ec = regcomp(&re_, spec.c_str(), REG_EXTENDED | REG_NOSUB); + if (ec != 0) { + if (error) { + size_t needed = regerror(ec, &re_, nullptr, 0); + char* errbuf = new char[needed]; + regerror(ec, &re_, errbuf, needed); + + // regerror returns the number of bytes necessary to null terminate + // the string, so we move that when assigning to error. + CHECK_NE(needed, 0); + error->assign(errbuf, needed - 1); + + delete[] errbuf; + } + + return false; + } + + init_ = true; + return true; +} + +Regex::~Regex() { + if (init_) { + regfree(&re_); + } +} + +bool Regex::Match(const std::string& str) { + if (!init_) { + return false; + } + + return regexec(&re_, str.c_str(), 0, nullptr, 0) == 0; +} + +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/re_std.cc b/3rdparty/benchmark/src/re_std.cc new file mode 100644 index 00000000000..cfd7a218ab4 --- /dev/null +++ b/3rdparty/benchmark/src/re_std.cc @@ -0,0 +1,44 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "re.h" + +namespace benchmark { + +Regex::Regex() : init_(false) { } + +bool Regex::Init(const std::string& spec, std::string* error) { + try { + re_ = std::regex(spec, std::regex_constants::extended); + + init_ = true; + } catch (const std::regex_error& e) { + if (error) { + *error = e.what(); + } + } + return init_; +} + +Regex::~Regex() { } + +bool Regex::Match(const std::string& str) { + if (!init_) { + return false; + } + + return std::regex_search(str, re_); +} + +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/reporter.cc b/3rdparty/benchmark/src/reporter.cc new file mode 100644 index 00000000000..4b47e3d556c --- /dev/null +++ b/3rdparty/benchmark/src/reporter.cc @@ -0,0 +1,86 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "benchmark/reporter.h" + +#include +#include + +#include "check.h" +#include "stat.h" + +namespace benchmark { + +void BenchmarkReporter::ComputeStats( + const std::vector& reports, + Run* mean_data, Run* stddev_data) { + CHECK(reports.size() >= 2) << "Cannot compute stats for less than 2 reports"; + // Accumulators. + Stat1_d real_accumulated_time_stat; + Stat1_d cpu_accumulated_time_stat; + Stat1_d bytes_per_second_stat; + Stat1_d items_per_second_stat; + // All repetitions should be run with the same number of iterations so we + // can take this information from the first benchmark. + int64_t const run_iterations = reports.front().iterations; + + // Populate the accumulators. + for (Run const& run : reports) { + CHECK_EQ(reports[0].benchmark_name, run.benchmark_name); + CHECK_EQ(run_iterations, run.iterations); + real_accumulated_time_stat += + Stat1_d(run.real_accumulated_time/run.iterations, run.iterations); + cpu_accumulated_time_stat += + Stat1_d(run.cpu_accumulated_time/run.iterations, run.iterations); + items_per_second_stat += Stat1_d(run.items_per_second, run.iterations); + bytes_per_second_stat += Stat1_d(run.bytes_per_second, run.iterations); + } + + // Get the data from the accumulator to BenchmarkReporter::Run's. + mean_data->benchmark_name = reports[0].benchmark_name + "_mean"; + mean_data->iterations = run_iterations; + mean_data->real_accumulated_time = real_accumulated_time_stat.Mean() * + run_iterations; + mean_data->cpu_accumulated_time = cpu_accumulated_time_stat.Mean() * + run_iterations; + mean_data->bytes_per_second = bytes_per_second_stat.Mean(); + mean_data->items_per_second = items_per_second_stat.Mean(); + + // Only add label to mean/stddev if it is same for all runs + mean_data->report_label = reports[0].report_label; + for (std::size_t i = 1; i < reports.size(); i++) { + if (reports[i].report_label != reports[0].report_label) { + mean_data->report_label = ""; + break; + } + } + + stddev_data->benchmark_name = reports[0].benchmark_name + "_stddev"; + stddev_data->report_label = mean_data->report_label; + stddev_data->iterations = 0; + stddev_data->real_accumulated_time = + real_accumulated_time_stat.StdDev(); + stddev_data->cpu_accumulated_time = + cpu_accumulated_time_stat.StdDev(); + stddev_data->bytes_per_second = bytes_per_second_stat.StdDev(); + stddev_data->items_per_second = items_per_second_stat.StdDev(); +} + +void BenchmarkReporter::Finalize() { +} + +BenchmarkReporter::~BenchmarkReporter() { +} + +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/sleep.cc b/3rdparty/benchmark/src/sleep.cc new file mode 100644 index 00000000000..918abc485dc --- /dev/null +++ b/3rdparty/benchmark/src/sleep.cc @@ -0,0 +1,50 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "sleep.h" + +#include +#include + +#include "internal_macros.h" + +#ifdef BENCHMARK_OS_WINDOWS +#include +#endif + +namespace benchmark { +#ifdef BENCHMARK_OS_WINDOWS +// Window's Sleep takes milliseconds argument. +void SleepForMilliseconds(int milliseconds) { Sleep(milliseconds); } +void SleepForSeconds(double seconds) { + SleepForMilliseconds(static_cast(kNumMillisPerSecond * seconds)); +} +#else // BENCHMARK_OS_WINDOWS +void SleepForMicroseconds(int microseconds) { + struct timespec sleep_time; + sleep_time.tv_sec = microseconds / kNumMicrosPerSecond; + sleep_time.tv_nsec = (microseconds % kNumMicrosPerSecond) * kNumNanosPerMicro; + while (nanosleep(&sleep_time, &sleep_time) != 0 && errno == EINTR) + ; // Ignore signals and wait for the full interval to elapse. +} + +void SleepForMilliseconds(int milliseconds) { + SleepForMicroseconds(static_cast(milliseconds) * kNumMicrosPerMilli); +} + +void SleepForSeconds(double seconds) { + SleepForMicroseconds(static_cast(seconds * kNumMicrosPerSecond)); +} +#endif // BENCHMARK_OS_WINDOWS +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/sleep.h b/3rdparty/benchmark/src/sleep.h new file mode 100644 index 00000000000..f1e515ca4f3 --- /dev/null +++ b/3rdparty/benchmark/src/sleep.h @@ -0,0 +1,17 @@ +#ifndef BENCHMARK_SLEEP_H_ +#define BENCHMARK_SLEEP_H_ + +#include + +namespace benchmark { +const int64_t kNumMillisPerSecond = 1000LL; +const int64_t kNumMicrosPerMilli = 1000LL; +const int64_t kNumMicrosPerSecond = kNumMillisPerSecond * 1000LL; +const int64_t kNumNanosPerMicro = 1000LL; +const int64_t kNumNanosPerSecond = kNumNanosPerMicro * kNumMicrosPerSecond; + +void SleepForMilliseconds(int milliseconds); +void SleepForSeconds(double seconds); +} // end namespace benchmark + +#endif // BENCHMARK_SLEEP_H_ diff --git a/3rdparty/benchmark/src/stat.h b/3rdparty/benchmark/src/stat.h new file mode 100644 index 00000000000..c4ecfe8e044 --- /dev/null +++ b/3rdparty/benchmark/src/stat.h @@ -0,0 +1,307 @@ +#ifndef BENCHMARK_STAT_H_ +#define BENCHMARK_STAT_H_ + +#include +#include +#include +#include + + +namespace benchmark { + +template +class Stat1; + +template +class Stat1MinMax; + +typedef Stat1 Stat1_f; +typedef Stat1 Stat1_d; +typedef Stat1MinMax Stat1MinMax_f; +typedef Stat1MinMax Stat1MinMax_d; + +template +class Vector2; +template +class Vector3; +template +class Vector4; + +template +class Stat1 { + public: + typedef Stat1 Self; + + Stat1() { Clear(); } + // Create a sample of value dat and weight 1 + explicit Stat1(const VType &dat) { + sum_ = dat; + sum_squares_ = Sqr(dat); + numsamples_ = 1; + } + // Create statistics for all the samples between begin (included) + // and end(excluded) + explicit Stat1(const VType *begin, const VType *end) { + Clear(); + for (const VType *item = begin; item < end; ++item) { + (*this) += Stat1(*item); + } + } + // Create a sample of value dat and weight w + Stat1(const VType &dat, const NumType &w) { + sum_ = w * dat; + sum_squares_ = w * Sqr(dat); + numsamples_ = w; + } + // Copy operator + Stat1(const Self &stat) { + sum_ = stat.sum_; + sum_squares_ = stat.sum_squares_; + numsamples_ = stat.numsamples_; + } + + void Clear() { + numsamples_ = NumType(); + sum_squares_ = sum_ = VType(); + } + + Self &operator=(const Self &stat) { + sum_ = stat.sum_; + sum_squares_ = stat.sum_squares_; + numsamples_ = stat.numsamples_; + return (*this); + } + // Merge statistics from two sample sets. + Self &operator+=(const Self &stat) { + sum_ += stat.sum_; + sum_squares_ += stat.sum_squares_; + numsamples_ += stat.numsamples_; + return (*this); + } + // The operation opposite to += + Self &operator-=(const Self &stat) { + sum_ -= stat.sum_; + sum_squares_ -= stat.sum_squares_; + numsamples_ -= stat.numsamples_; + return (*this); + } + // Multiply the weight of the set of samples by a factor k + Self &operator*=(const VType &k) { + sum_ *= k; + sum_squares_ *= k; + numsamples_ *= k; + return (*this); + } + + // Merge statistics from two sample sets. + Self operator+(const Self &stat) const { return Self(*this) += stat; } + + // The operation opposite to + + Self operator-(const Self &stat) const { return Self(*this) -= stat; } + + // Multiply the weight of the set of samples by a factor k + Self operator*(const VType &k) const { return Self(*this) *= k; } + + // Return the total weight of this sample set + NumType numSamples() const { return numsamples_; } + + // Return the sum of this sample set + VType Sum() const { return sum_; } + + // Return the mean of this sample set + VType Mean() const { + if (numsamples_ == 0) return VType(); + return sum_ * (1.0 / numsamples_); + } + + // Return the mean of this sample set and compute the standard deviation at + // the same time. + VType Mean(VType *stddev) const { + if (numsamples_ == 0) return VType(); + VType mean = sum_ * (1.0 / numsamples_); + if (stddev) { + VType avg_squares = sum_squares_ * (1.0 / numsamples_); + *stddev = Sqrt(avg_squares - Sqr(mean)); + } + return mean; + } + + // Return the standard deviation of the sample set + VType StdDev() const { + if (numsamples_ == 0) return VType(); + VType mean = Mean(); + VType avg_squares = sum_squares_ * (1.0 / numsamples_); + return Sqrt(avg_squares - Sqr(mean)); + } + + private: + static_assert(std::is_integral::value && + !std::is_same::value, + "NumType must be an integral type that is not bool."); + // Let i be the index of the samples provided (using +=) + // and weight[i],value[i] be the data of sample #i + // then the variables have the following meaning: + NumType numsamples_; // sum of weight[i]; + VType sum_; // sum of weight[i]*value[i]; + VType sum_squares_; // sum of weight[i]*value[i]^2; + + // Template function used to square a number. + // For a vector we square all components + template + static inline SType Sqr(const SType &dat) { + return dat * dat; + } + + template + static inline Vector2 Sqr(const Vector2 &dat) { + return dat.MulComponents(dat); + } + + template + static inline Vector3 Sqr(const Vector3 &dat) { + return dat.MulComponents(dat); + } + + template + static inline Vector4 Sqr(const Vector4 &dat) { + return dat.MulComponents(dat); + } + + // Template function used to take the square root of a number. + // For a vector we square all components + template + static inline SType Sqrt(const SType &dat) { + // Avoid NaN due to imprecision in the calculations + if (dat < 0) return 0; + return sqrt(dat); + } + + template + static inline Vector2 Sqrt(const Vector2 &dat) { + // Avoid NaN due to imprecision in the calculations + return Max(dat, Vector2()).Sqrt(); + } + + template + static inline Vector3 Sqrt(const Vector3 &dat) { + // Avoid NaN due to imprecision in the calculations + return Max(dat, Vector3()).Sqrt(); + } + + template + static inline Vector4 Sqrt(const Vector4 &dat) { + // Avoid NaN due to imprecision in the calculations + return Max(dat, Vector4()).Sqrt(); + } +}; + +// Useful printing function +template +std::ostream &operator<<(std::ostream &out, const Stat1 &s) { + out << "{ avg = " << s.Mean() << " std = " << s.StdDev() + << " nsamples = " << s.NumSamples() << "}"; + return out; +} + +// Stat1MinMax: same as Stat1, but it also +// keeps the Min and Max values; the "-" +// operator is disabled because it cannot be implemented +// efficiently +template +class Stat1MinMax : public Stat1 { + public: + typedef Stat1MinMax Self; + + Stat1MinMax() { Clear(); } + // Create a sample of value dat and weight 1 + explicit Stat1MinMax(const VType &dat) : Stat1(dat) { + max_ = dat; + min_ = dat; + } + // Create statistics for all the samples between begin (included) + // and end(excluded) + explicit Stat1MinMax(const VType *begin, const VType *end) { + Clear(); + for (const VType *item = begin; item < end; ++item) { + (*this) += Stat1MinMax(*item); + } + } + // Create a sample of value dat and weight w + Stat1MinMax(const VType &dat, const NumType &w) + : Stat1(dat, w) { + max_ = dat; + min_ = dat; + } + // Copy operator + Stat1MinMax(const Self &stat) : Stat1(stat) { + max_ = stat.max_; + min_ = stat.min_; + } + + void Clear() { + Stat1::Clear(); + if (std::numeric_limits::has_infinity) { + min_ = std::numeric_limits::infinity(); + max_ = -std::numeric_limits::infinity(); + } else { + min_ = std::numeric_limits::max(); + max_ = std::numeric_limits::min(); + } + } + + Self &operator=(const Self &stat) { + this->Stat1::operator=(stat); + max_ = stat.max_; + min_ = stat.min_; + return (*this); + } + // Merge statistics from two sample sets. + Self &operator+=(const Self &stat) { + this->Stat1::operator+=(stat); + if (stat.max_ > max_) max_ = stat.max_; + if (stat.min_ < min_) min_ = stat.min_; + return (*this); + } + // Multiply the weight of the set of samples by a factor k + Self &operator*=(const VType &stat) { + this->Stat1::operator*=(stat); + return (*this); + } + // Merge statistics from two sample sets. + Self operator+(const Self &stat) const { return Self(*this) += stat; } + // Multiply the weight of the set of samples by a factor k + Self operator*(const VType &k) const { return Self(*this) *= k; } + + // Return the maximal value in this sample set + VType Max() const { return max_; } + // Return the minimal value in this sample set + VType Min() const { return min_; } + + private: + // The - operation makes no sense with Min/Max + // unless we keep the full list of values (but we don't) + // make it private, and let it undefined so nobody can call it + Self &operator-=(const Self &stat); // senseless. let it undefined. + + // The operation opposite to - + Self operator-(const Self &stat) const; // senseless. let it undefined. + + // Let i be the index of the samples provided (using +=) + // and weight[i],value[i] be the data of sample #i + // then the variables have the following meaning: + VType max_; // max of value[i] + VType min_; // min of value[i] +}; + +// Useful printing function +template +std::ostream &operator<<(std::ostream &out, + const Stat1MinMax &s) { + out << "{ avg = " << s.Mean() << " std = " << s.StdDev() + << " nsamples = " << s.NumSamples() << " min = " << s.Min() + << " max = " << s.Max() << "}"; + return out; +} +} // end namespace benchmark + +#endif // BENCHMARK_STAT_H_ diff --git a/3rdparty/benchmark/src/string_util.cc b/3rdparty/benchmark/src/string_util.cc new file mode 100644 index 00000000000..30d130500d3 --- /dev/null +++ b/3rdparty/benchmark/src/string_util.cc @@ -0,0 +1,169 @@ +#include "string_util.h" + +#include +#include +#include +#include +#include +#include + +#include "arraysize.h" + +namespace benchmark { +namespace { + +// kilo, Mega, Giga, Tera, Peta, Exa, Zetta, Yotta. +const char kBigSIUnits[] = "kMGTPEZY"; +// Kibi, Mebi, Gibi, Tebi, Pebi, Exbi, Zebi, Yobi. +const char kBigIECUnits[] = "KMGTPEZY"; +// milli, micro, nano, pico, femto, atto, zepto, yocto. +const char kSmallSIUnits[] = "munpfazy"; + +// We require that all three arrays have the same size. +static_assert(arraysize(kBigSIUnits) == arraysize(kBigIECUnits), + "SI and IEC unit arrays must be the same size"); +static_assert(arraysize(kSmallSIUnits) == arraysize(kBigSIUnits), + "Small SI and Big SI unit arrays must be the same size"); + +static const int64_t kUnitsSize = arraysize(kBigSIUnits); + +} // end anonymous namespace + +void ToExponentAndMantissa(double val, double thresh, int precision, + double one_k, std::string* mantissa, + int64_t* exponent) { + std::stringstream mantissa_stream; + + if (val < 0) { + mantissa_stream << "-"; + val = -val; + } + + // Adjust threshold so that it never excludes things which can't be rendered + // in 'precision' digits. + const double adjusted_threshold = + std::max(thresh, 1.0 / std::pow(10.0, precision)); + const double big_threshold = adjusted_threshold * one_k; + const double small_threshold = adjusted_threshold; + + if (val > big_threshold) { + // Positive powers + double scaled = val; + for (size_t i = 0; i < arraysize(kBigSIUnits); ++i) { + scaled /= one_k; + if (scaled <= big_threshold) { + mantissa_stream << scaled; + *exponent = i + 1; + *mantissa = mantissa_stream.str(); + return; + } + } + mantissa_stream << val; + *exponent = 0; + } else if (val < small_threshold) { + // Negative powers + double scaled = val; + for (size_t i = 0; i < arraysize(kSmallSIUnits); ++i) { + scaled *= one_k; + if (scaled >= small_threshold) { + mantissa_stream << scaled; + *exponent = -static_cast(i + 1); + *mantissa = mantissa_stream.str(); + return; + } + } + mantissa_stream << val; + *exponent = 0; + } else { + mantissa_stream << val; + *exponent = 0; + } + *mantissa = mantissa_stream.str(); +} + +std::string ExponentToPrefix(int64_t exponent, bool iec) { + if (exponent == 0) return ""; + + const int64_t index = (exponent > 0 ? exponent - 1 : -exponent - 1); + if (index >= kUnitsSize) return ""; + + const char* array = + (exponent > 0 ? (iec ? kBigIECUnits : kBigSIUnits) : kSmallSIUnits); + if (iec) + return array[index] + std::string("i"); + else + return std::string(1, array[index]); +} + +std::string ToBinaryStringFullySpecified(double value, double threshold, + int precision) { + std::string mantissa; + int64_t exponent; + ToExponentAndMantissa(value, threshold, precision, 1024.0, &mantissa, + &exponent); + return mantissa + ExponentToPrefix(exponent, false); +} + +void AppendHumanReadable(int n, std::string* str) { + std::stringstream ss; + // Round down to the nearest SI prefix. + ss << "/" << ToBinaryStringFullySpecified(n, 1.0, 0); + *str += ss.str(); +} + +std::string HumanReadableNumber(double n) { + // 1.1 means that figures up to 1.1k should be shown with the next unit down; + // this softens edge effects. + // 1 means that we should show one decimal place of precision. + return ToBinaryStringFullySpecified(n, 1.1, 1); +} + +std::string StringPrintFImp(const char *msg, va_list args) +{ + // we might need a second shot at this, so pre-emptivly make a copy + va_list args_cp; + va_copy(args_cp, args); + + // TODO(ericwf): use std::array for first attempt to avoid one memory + // allocation guess what the size might be + std::array local_buff; + std::size_t size = local_buff.size(); + // 2015-10-08: vsnprintf is used instead of snd::vsnprintf due to a limitation in the android-ndk + auto ret = vsnprintf(local_buff.data(), size, msg, args_cp); + + va_end(args_cp); + + // handle empty expansion + if (ret == 0) + return std::string{}; + if (static_cast(ret) < size) + return std::string(local_buff.data()); + + // we did not provide a long enough buffer on our first attempt. + // add 1 to size to account for null-byte in size cast to prevent overflow + size = static_cast(ret) + 1; + auto buff_ptr = std::unique_ptr(new char[size]); + // 2015-10-08: vsnprintf is used instead of snd::vsnprintf due to a limitation in the android-ndk + ret = vsnprintf(buff_ptr.get(), size, msg, args); + return std::string(buff_ptr.get()); +} + +std::string StringPrintF(const char* format, ...) +{ + va_list args; + va_start(args, format); + std::string tmp = StringPrintFImp(format, args); + va_end(args); + return tmp; +} + +void ReplaceAll(std::string* str, const std::string& from, + const std::string& to) { + std::size_t start = 0; + while((start = str->find(from, start)) != std::string::npos) { + str->replace(start, from.length(), to); + start += to.length(); + } +} + +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/string_util.h b/3rdparty/benchmark/src/string_util.h new file mode 100644 index 00000000000..b89fef5ff36 --- /dev/null +++ b/3rdparty/benchmark/src/string_util.h @@ -0,0 +1,44 @@ +#ifndef BENCHMARK_STRING_UTIL_H_ +#define BENCHMARK_STRING_UTIL_H_ + +#include +#include +#include +#include "internal_macros.h" + +namespace benchmark { + +void AppendHumanReadable(int n, std::string* str); + +std::string HumanReadableNumber(double n); + +std::string StringPrintF(const char* format, ...); + +inline std::ostream& +StringCatImp(std::ostream& out) BENCHMARK_NOEXCEPT +{ + return out; +} + +template +inline std::ostream& +StringCatImp(std::ostream& out, First&& f, Rest&&... rest) +{ + out << std::forward(f); + return StringCatImp(out, std::forward(rest)...); +} + +template +inline std::string StrCat(Args&&... args) +{ + std::ostringstream ss; + StringCatImp(ss, std::forward(args)...); + return ss.str(); +} + +void ReplaceAll(std::string* str, const std::string& from, + const std::string& to); + +} // end namespace benchmark + +#endif // BENCHMARK_STRING_UTIL_H_ diff --git a/3rdparty/benchmark/src/sysinfo.cc b/3rdparty/benchmark/src/sysinfo.cc new file mode 100644 index 00000000000..d1f312024d3 --- /dev/null +++ b/3rdparty/benchmark/src/sysinfo.cc @@ -0,0 +1,416 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "sysinfo.h" +#include "internal_macros.h" + +#ifdef BENCHMARK_OS_WINDOWS +#include +#include +#include +#else +#include +#include +#include // this header must be included before 'sys/sysctl.h' to avoid compilation error on FreeBSD +#include +#include +#if defined BENCHMARK_OS_FREEBSD || defined BENCHMARK_OS_MACOSX +#include +#endif +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "arraysize.h" +#include "check.h" +#include "cycleclock.h" +#include "internal_macros.h" +#include "log.h" +#include "sleep.h" +#include "string_util.h" + +namespace benchmark { +namespace { +std::once_flag cpuinfo_init; +double cpuinfo_cycles_per_second = 1.0; +int cpuinfo_num_cpus = 1; // Conservative guess +std::mutex cputimens_mutex; + +#if !defined BENCHMARK_OS_MACOSX +const int64_t estimate_time_ms = 1000; + +// Helper function estimates cycles/sec by observing cycles elapsed during +// sleep(). Using small sleep time decreases accuracy significantly. +int64_t EstimateCyclesPerSecond() { + const int64_t start_ticks = cycleclock::Now(); + SleepForMilliseconds(estimate_time_ms); + return cycleclock::Now() - start_ticks; +} +#endif + +#if defined BENCHMARK_OS_LINUX || defined BENCHMARK_OS_CYGWIN +// Helper function for reading an int from a file. Returns true if successful +// and the memory location pointed to by value is set to the value read. +bool ReadIntFromFile(const char* file, long* value) { + bool ret = false; + int fd = open(file, O_RDONLY); + if (fd != -1) { + char line[1024]; + char* err; + memset(line, '\0', sizeof(line)); + CHECK(read(fd, line, sizeof(line) - 1)); + const long temp_value = strtol(line, &err, 10); + if (line[0] != '\0' && (*err == '\n' || *err == '\0')) { + *value = temp_value; + ret = true; + } + close(fd); + } + return ret; +} +#endif + +void InitializeSystemInfo() { +#if defined BENCHMARK_OS_LINUX || defined BENCHMARK_OS_CYGWIN + char line[1024]; + char* err; + long freq; + + bool saw_mhz = false; + + // If the kernel is exporting the tsc frequency use that. There are issues + // where cpuinfo_max_freq cannot be relied on because the BIOS may be + // exporintg an invalid p-state (on x86) or p-states may be used to put the + // processor in a new mode (turbo mode). Essentially, those frequencies + // cannot always be relied upon. The same reasons apply to /proc/cpuinfo as + // well. + if (!saw_mhz && + ReadIntFromFile("/sys/devices/system/cpu/cpu0/tsc_freq_khz", &freq)) { + // The value is in kHz (as the file name suggests). For example, on a + // 2GHz warpstation, the file contains the value "2000000". + cpuinfo_cycles_per_second = freq * 1000.0; + saw_mhz = true; + } + + // If CPU scaling is in effect, we want to use the *maximum* frequency, + // not whatever CPU speed some random processor happens to be using now. + if (!saw_mhz && + ReadIntFromFile("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq", + &freq)) { + // The value is in kHz. For example, on a 2GHz warpstation, the file + // contains the value "2000000". + cpuinfo_cycles_per_second = freq * 1000.0; + saw_mhz = true; + } + + // Read /proc/cpuinfo for other values, and if there is no cpuinfo_max_freq. + const char* pname = "/proc/cpuinfo"; + int fd = open(pname, O_RDONLY); + if (fd == -1) { + perror(pname); + if (!saw_mhz) { + cpuinfo_cycles_per_second = static_cast(EstimateCyclesPerSecond()); + } + return; + } + + double bogo_clock = 1.0; + bool saw_bogo = false; + long max_cpu_id = 0; + int num_cpus = 0; + line[0] = line[1] = '\0'; + size_t chars_read = 0; + do { // we'll exit when the last read didn't read anything + // Move the next line to the beginning of the buffer + const size_t oldlinelen = strlen(line); + if (sizeof(line) == oldlinelen + 1) // oldlinelen took up entire line + line[0] = '\0'; + else // still other lines left to save + memmove(line, line + oldlinelen + 1, sizeof(line) - (oldlinelen + 1)); + // Terminate the new line, reading more if we can't find the newline + char* newline = strchr(line, '\n'); + if (newline == nullptr) { + const size_t linelen = strlen(line); + const size_t bytes_to_read = sizeof(line) - 1 - linelen; + CHECK(bytes_to_read > 0); // because the memmove recovered >=1 bytes + chars_read = read(fd, line + linelen, bytes_to_read); + line[linelen + chars_read] = '\0'; + newline = strchr(line, '\n'); + } + if (newline != nullptr) *newline = '\0'; + + // When parsing the "cpu MHz" and "bogomips" (fallback) entries, we only + // accept postive values. Some environments (virtual machines) report zero, + // which would cause infinite looping in WallTime_Init. + if (!saw_mhz && strncasecmp(line, "cpu MHz", sizeof("cpu MHz") - 1) == 0) { + const char* freqstr = strchr(line, ':'); + if (freqstr) { + cpuinfo_cycles_per_second = strtod(freqstr + 1, &err) * 1000000.0; + if (freqstr[1] != '\0' && *err == '\0' && cpuinfo_cycles_per_second > 0) + saw_mhz = true; + } + } else if (strncasecmp(line, "bogomips", sizeof("bogomips") - 1) == 0) { + const char* freqstr = strchr(line, ':'); + if (freqstr) { + bogo_clock = strtod(freqstr + 1, &err) * 1000000.0; + if (freqstr[1] != '\0' && *err == '\0' && bogo_clock > 0) + saw_bogo = true; + } + } else if (strncasecmp(line, "processor", sizeof("processor") - 1) == 0) { + num_cpus++; // count up every time we see an "processor :" entry + const char* freqstr = strchr(line, ':'); + if (freqstr) { + const long cpu_id = strtol(freqstr + 1, &err, 10); + if (freqstr[1] != '\0' && *err == '\0' && max_cpu_id < cpu_id) + max_cpu_id = cpu_id; + } + } + } while (chars_read > 0); + close(fd); + + if (!saw_mhz) { + if (saw_bogo) { + // If we didn't find anything better, we'll use bogomips, but + // we're not happy about it. + cpuinfo_cycles_per_second = bogo_clock; + } else { + // If we don't even have bogomips, we'll use the slow estimation. + cpuinfo_cycles_per_second = static_cast(EstimateCyclesPerSecond()); + } + } + if (num_cpus == 0) { + fprintf(stderr, "Failed to read num. CPUs correctly from /proc/cpuinfo\n"); + } else { + if ((max_cpu_id + 1) != num_cpus) { + fprintf(stderr, + "CPU ID assignments in /proc/cpuinfo seems messed up." + " This is usually caused by a bad BIOS.\n"); + } + cpuinfo_num_cpus = num_cpus; + } + +#elif defined BENCHMARK_OS_FREEBSD +// For this sysctl to work, the machine must be configured without +// SMP, APIC, or APM support. hz should be 64-bit in freebsd 7.0 +// and later. Before that, it's a 32-bit quantity (and gives the +// wrong answer on machines faster than 2^32 Hz). See +// http://lists.freebsd.org/pipermail/freebsd-i386/2004-November/001846.html +// But also compare FreeBSD 7.0: +// http://fxr.watson.org/fxr/source/i386/i386/tsc.c?v=RELENG70#L223 +// 231 error = sysctl_handle_quad(oidp, &freq, 0, req); +// To FreeBSD 6.3 (it's the same in 6-STABLE): +// http://fxr.watson.org/fxr/source/i386/i386/tsc.c?v=RELENG6#L131 +// 139 error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); +#if __FreeBSD__ >= 7 + uint64_t hz = 0; +#else + unsigned int hz = 0; +#endif + size_t sz = sizeof(hz); + const char* sysctl_path = "machdep.tsc_freq"; + if (sysctlbyname(sysctl_path, &hz, &sz, nullptr, 0) != 0) { + fprintf(stderr, "Unable to determine clock rate from sysctl: %s: %s\n", + sysctl_path, strerror(errno)); + cpuinfo_cycles_per_second = static_cast(EstimateCyclesPerSecond()); + } else { + cpuinfo_cycles_per_second = hz; + } +// TODO: also figure out cpuinfo_num_cpus + +#elif defined BENCHMARK_OS_WINDOWS + // In NT, read MHz from the registry. If we fail to do so or we're in win9x + // then make a crude estimate. + DWORD data, data_size = sizeof(data); + if (IsWindowsXPOrGreater() && + SUCCEEDED( + SHGetValueA(HKEY_LOCAL_MACHINE, + "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", + "~MHz", nullptr, &data, &data_size))) + cpuinfo_cycles_per_second = static_cast((int64_t)data * (int64_t)(1000 * 1000)); // was mhz + else + cpuinfo_cycles_per_second = static_cast(EstimateCyclesPerSecond()); +// TODO: also figure out cpuinfo_num_cpus + +#elif defined BENCHMARK_OS_MACOSX + // returning "mach time units" per second. the current number of elapsed + // mach time units can be found by calling uint64 mach_absolute_time(); + // while not as precise as actual CPU cycles, it is accurate in the face + // of CPU frequency scaling and multi-cpu/core machines. + // Our mac users have these types of machines, and accuracy + // (i.e. correctness) trumps precision. + // See cycleclock.h: CycleClock::Now(), which returns number of mach time + // units on Mac OS X. + mach_timebase_info_data_t timebase_info; + mach_timebase_info(&timebase_info); + double mach_time_units_per_nanosecond = + static_cast(timebase_info.denom) / + static_cast(timebase_info.numer); + cpuinfo_cycles_per_second = mach_time_units_per_nanosecond * 1e9; + + int num_cpus = 0; + size_t size = sizeof(num_cpus); + int numcpus_name[] = {CTL_HW, HW_NCPU}; + if (::sysctl(numcpus_name, arraysize(numcpus_name), &num_cpus, &size, nullptr, 0) == + 0 && + (size == sizeof(num_cpus))) + cpuinfo_num_cpus = num_cpus; + +#else + // Generic cycles per second counter + cpuinfo_cycles_per_second = static_cast(EstimateCyclesPerSecond()); +#endif +} +} // end namespace + +// getrusage() based implementation of MyCPUUsage +static double MyCPUUsageRUsage() { +#ifndef BENCHMARK_OS_WINDOWS + struct rusage ru; + if (getrusage(RUSAGE_SELF, &ru) == 0) { + return (static_cast(ru.ru_utime.tv_sec) + + static_cast(ru.ru_utime.tv_usec) * 1e-6 + + static_cast(ru.ru_stime.tv_sec) + + static_cast(ru.ru_stime.tv_usec) * 1e-6); + } else { + return 0.0; + } +#else + HANDLE proc = GetCurrentProcess(); + FILETIME creation_time; + FILETIME exit_time; + FILETIME kernel_time; + FILETIME user_time; + ULARGE_INTEGER kernel; + ULARGE_INTEGER user; + GetProcessTimes(proc, &creation_time, &exit_time, &kernel_time, &user_time); + kernel.HighPart = kernel_time.dwHighDateTime; + kernel.LowPart = kernel_time.dwLowDateTime; + user.HighPart = user_time.dwHighDateTime; + user.LowPart = user_time.dwLowDateTime; + return (static_cast(kernel.QuadPart) + + static_cast(user.QuadPart)) * 1e-7; +#endif // OS_WINDOWS +} + +#ifndef BENCHMARK_OS_WINDOWS +static bool MyCPUUsageCPUTimeNsLocked(double* cputime) { + static int cputime_fd = -1; + if (cputime_fd == -1) { + cputime_fd = open("/proc/self/cputime_ns", O_RDONLY); + if (cputime_fd < 0) { + cputime_fd = -1; + return false; + } + } + char buff[64]; + memset(buff, 0, sizeof(buff)); + if (pread(cputime_fd, buff, sizeof(buff) - 1, 0) <= 0) { + close(cputime_fd); + cputime_fd = -1; + return false; + } + unsigned long long result = strtoull(buff, nullptr, 0); + if (result == (std::numeric_limits::max)()) { + close(cputime_fd); + cputime_fd = -1; + return false; + } + *cputime = static_cast(result) / 1e9; + return true; +} +#endif // OS_WINDOWS + +double MyCPUUsage() { +#ifndef BENCHMARK_OS_WINDOWS + { + std::lock_guard l(cputimens_mutex); + static bool use_cputime_ns = true; + if (use_cputime_ns) { + double value; + if (MyCPUUsageCPUTimeNsLocked(&value)) { + return value; + } + // Once MyCPUUsageCPUTimeNsLocked fails once fall back to getrusage(). + VLOG(1) << "Reading /proc/self/cputime_ns failed. Using getrusage().\n"; + use_cputime_ns = false; + } + } +#endif // OS_WINDOWS + return MyCPUUsageRUsage(); +} + +double ChildrenCPUUsage() { +#ifndef BENCHMARK_OS_WINDOWS + struct rusage ru; + if (getrusage(RUSAGE_CHILDREN, &ru) == 0) { + return (static_cast(ru.ru_utime.tv_sec) + + static_cast(ru.ru_utime.tv_usec) * 1e-6 + + static_cast(ru.ru_stime.tv_sec) + + static_cast(ru.ru_stime.tv_usec) * 1e-6); + } else { + return 0.0; + } +#else + // TODO: Not sure what this even means on Windows + return 0.0; +#endif // OS_WINDOWS +} + +double CyclesPerSecond(void) { + std::call_once(cpuinfo_init, InitializeSystemInfo); + return cpuinfo_cycles_per_second; +} + +int NumCPUs(void) { + std::call_once(cpuinfo_init, InitializeSystemInfo); + return cpuinfo_num_cpus; +} + +// The ""'s catch people who don't pass in a literal for "str" +#define strliterallen(str) (sizeof("" str "") - 1) + +// Must use a string literal for prefix. +#define memprefix(str, len, prefix) \ + ((((len) >= strliterallen(prefix)) && \ + std::memcmp(str, prefix, strliterallen(prefix)) == 0) \ + ? str + strliterallen(prefix) \ + : nullptr) + +bool CpuScalingEnabled() { +#ifndef BENCHMARK_OS_WINDOWS + // On Linux, the CPUfreq subsystem exposes CPU information as files on the + // local file system. If reading the exported files fails, then we may not be + // running on Linux, so we silently ignore all the read errors. + for (int cpu = 0, num_cpus = NumCPUs(); cpu < num_cpus; ++cpu) { + std::string governor_file = StrCat("/sys/devices/system/cpu/cpu", cpu, + "/cpufreq/scaling_governor"); + FILE* file = fopen(governor_file.c_str(), "r"); + if (!file) break; + char buff[16]; + size_t bytes_read = fread(buff, 1, sizeof(buff), file); + fclose(file); + if (memprefix(buff, bytes_read, "performance") == nullptr) return true; + } +#endif + return false; +} + +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/sysinfo.h b/3rdparty/benchmark/src/sysinfo.h new file mode 100644 index 00000000000..eaf77e07ccb --- /dev/null +++ b/3rdparty/benchmark/src/sysinfo.h @@ -0,0 +1,12 @@ +#ifndef BENCHMARK_SYSINFO_H_ +#define BENCHMARK_SYSINFO_H_ + +namespace benchmark { +double MyCPUUsage(); +double ChildrenCPUUsage(); +int NumCPUs(); +double CyclesPerSecond(); +bool CpuScalingEnabled(); +} // end namespace benchmark + +#endif // BENCHMARK_SYSINFO_H_ diff --git a/3rdparty/benchmark/src/walltime.cc b/3rdparty/benchmark/src/walltime.cc new file mode 100644 index 00000000000..4bdbaa59859 --- /dev/null +++ b/3rdparty/benchmark/src/walltime.cc @@ -0,0 +1,263 @@ +// Copyright 2015 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "benchmark/macros.h" +#include "internal_macros.h" +#include "walltime.h" + +#if defined(BENCHMARK_OS_WINDOWS) +#include +#include // for timeval +#else +#include +#endif + +#include +#include +#include +#include + +#include +#include +#include + +#include "arraysize.h" +#include "check.h" +#include "cycleclock.h" +#include "log.h" +#include "sysinfo.h" + +namespace benchmark { +namespace walltime { + +namespace { + +#if defined(HAVE_STEADY_CLOCK) +template +struct ChooseSteadyClock { + typedef std::chrono::high_resolution_clock type; +}; + +template <> +struct ChooseSteadyClock { + typedef std::chrono::steady_clock type; +}; +#endif + +struct ChooseClockType { +#if defined(HAVE_STEADY_CLOCK) + typedef ChooseSteadyClock<>::type type; +#else + typedef std::chrono::high_resolution_clock type; +#endif +}; + +class WallTimeImp +{ +public: + WallTime Now(); + + static WallTimeImp& GetWallTimeImp() { + static WallTimeImp* imp = new WallTimeImp(); + return *imp; + } + +private: + WallTimeImp(); + // Helper routines to load/store a float from an AtomicWord. Required because + // g++ < 4.7 doesn't support std::atomic correctly. I cannot wait to + // get rid of this horror show. + void SetDrift(float f) { + int32_t w; + memcpy(&w, &f, sizeof(f)); + std::atomic_store(&drift_adjust_, w); + } + + float GetDrift() const { + float f; + int32_t w = std::atomic_load(&drift_adjust_); + memcpy(&f, &w, sizeof(f)); + return f; + } + + WallTime Slow() const { + struct timeval tv; +#if defined(BENCHMARK_OS_WINDOWS) + FILETIME file_time; + SYSTEMTIME system_time; + ULARGE_INTEGER ularge; + const unsigned __int64 epoch = 116444736000000000LL; + + GetSystemTime(&system_time); + SystemTimeToFileTime(&system_time, &file_time); + ularge.LowPart = file_time.dwLowDateTime; + ularge.HighPart = file_time.dwHighDateTime; + + tv.tv_sec = (long)((ularge.QuadPart - epoch) / (10L * 1000 * 1000)); + tv.tv_usec = (long)(system_time.wMilliseconds * 1000); +#else + gettimeofday(&tv, nullptr); +#endif + return tv.tv_sec + tv.tv_usec * 1e-6; + } + +private: + static_assert(sizeof(float) <= sizeof(int32_t), + "type sizes don't allow the drift_adjust hack"); + + WallTime base_walltime_; + int64_t base_cycletime_; + int64_t cycles_per_second_; + double seconds_per_cycle_; + uint32_t last_adjust_time_; + std::atomic drift_adjust_; + int64_t max_interval_cycles_; + + BENCHMARK_DISALLOW_COPY_AND_ASSIGN(WallTimeImp); +}; + + +WallTime WallTimeImp::Now() { + WallTime now = 0.0; + WallTime result = 0.0; + int64_t ct = 0; + uint32_t top_bits = 0; + do { + ct = cycleclock::Now(); + int64_t cycle_delta = ct - base_cycletime_; + result = base_walltime_ + cycle_delta * seconds_per_cycle_; + + top_bits = static_cast(uint64_t(ct) >> 32); + // Recompute drift no more often than every 2^32 cycles. + // I.e., @2GHz, ~ every two seconds + if (top_bits == last_adjust_time_) { // don't need to recompute drift + return result + GetDrift(); + } + + now = Slow(); + } while (cycleclock::Now() - ct > max_interval_cycles_); + // We are now sure that "now" and "result" were produced within + // kMaxErrorInterval of one another. + + SetDrift(static_cast(now - result)); + last_adjust_time_ = top_bits; + return now; +} + + +WallTimeImp::WallTimeImp() + : base_walltime_(0.0), base_cycletime_(0), + cycles_per_second_(0), seconds_per_cycle_(0.0), + last_adjust_time_(0), drift_adjust_(0), + max_interval_cycles_(0) { + const double kMaxErrorInterval = 100e-6; + cycles_per_second_ = static_cast(CyclesPerSecond()); + CHECK(cycles_per_second_ != 0); + seconds_per_cycle_ = 1.0 / cycles_per_second_; + max_interval_cycles_ = + static_cast(cycles_per_second_ * kMaxErrorInterval); + do { + base_cycletime_ = cycleclock::Now(); + base_walltime_ = Slow(); + } while (cycleclock::Now() - base_cycletime_ > max_interval_cycles_); + // We are now sure that "base_walltime" and "base_cycletime" were produced + // within kMaxErrorInterval of one another. + + SetDrift(0.0); + last_adjust_time_ = static_cast(uint64_t(base_cycletime_) >> 32); +} + +WallTime CPUWalltimeNow() { + static WallTimeImp& imp = WallTimeImp::GetWallTimeImp(); + return imp.Now(); +} + +WallTime ChronoWalltimeNow() { + typedef ChooseClockType::type Clock; + typedef std::chrono::duration + FPSeconds; + static_assert(std::chrono::treat_as_floating_point::value, + "This type must be treated as a floating point type."); + auto now = Clock::now().time_since_epoch(); + return std::chrono::duration_cast(now).count(); +} + +bool UseCpuCycleClock() { + bool useWallTime = !CpuScalingEnabled(); + if (useWallTime) { + VLOG(1) << "Using the CPU cycle clock to provide walltime::Now().\n"; + } else { + VLOG(1) << "Using std::chrono to provide walltime::Now().\n"; + } + return useWallTime; +} + + +} // end anonymous namespace + +// WallTimeImp doesn't work when CPU Scaling is enabled. If CPU Scaling is +// enabled at the start of the program then std::chrono::system_clock is used +// instead. +WallTime Now() +{ + static bool useCPUClock = UseCpuCycleClock(); + if (useCPUClock) { + return CPUWalltimeNow(); + } else { + return ChronoWalltimeNow(); + } +} + +} // end namespace walltime + + +namespace { + +std::string DateTimeString(bool local) { + typedef std::chrono::system_clock Clock; + std::time_t now = Clock::to_time_t(Clock::now()); + char storage[128]; + std::size_t written; + + if (local) { +#if defined(BENCHMARK_OS_WINDOWS) + written = std::strftime(storage, sizeof(storage), "%x %X", ::localtime(&now)); +#else + std::tm timeinfo; + std::memset(&timeinfo, 0, sizeof(std::tm)); + ::localtime_r(&now, &timeinfo); + written = std::strftime(storage, sizeof(storage), "%F %T", &timeinfo); +#endif + } else { +#if defined(BENCHMARK_OS_WINDOWS) + written = std::strftime(storage, sizeof(storage), "%x %X", ::gmtime(&now)); +#else + std::tm timeinfo; + std::memset(&timeinfo, 0, sizeof(std::tm)); + ::gmtime_r(&now, &timeinfo); + written = std::strftime(storage, sizeof(storage), "%F %T", &timeinfo); +#endif + } + CHECK(written < arraysize(storage)); + ((void)written); // prevent unused variable in optimized mode. + return std::string(storage); +} + +} // end namespace + +std::string LocalDateTimeString() { + return DateTimeString(true); +} + +} // end namespace benchmark diff --git a/3rdparty/benchmark/src/walltime.h b/3rdparty/benchmark/src/walltime.h new file mode 100644 index 00000000000..38c26f33213 --- /dev/null +++ b/3rdparty/benchmark/src/walltime.h @@ -0,0 +1,17 @@ +#ifndef BENCHMARK_WALLTIME_H_ +#define BENCHMARK_WALLTIME_H_ + +#include + +namespace benchmark { +typedef double WallTime; + +namespace walltime { +WallTime Now(); +} // end namespace walltime + +std::string LocalDateTimeString(); + +} // end namespace benchmark + +#endif // BENCHMARK_WALLTIME_H_ diff --git a/3rdparty/benchmark/test/CMakeLists.txt b/3rdparty/benchmark/test/CMakeLists.txt new file mode 100644 index 00000000000..7e4f4854710 --- /dev/null +++ b/3rdparty/benchmark/test/CMakeLists.txt @@ -0,0 +1,89 @@ +# Enable the tests + +find_package(Threads REQUIRED) + +set(CXX03_FLAGS "${CMAKE_CXX_FLAGS}") +string(REPLACE "-std=c++11" "-std=c++03" CXX03_FLAGS "${CXX03_FLAGS}") +string(REPLACE "-std=c++0x" "-std=c++03" CXX03_FLAGS "${CXX03_FLAGS}") + +macro(compile_benchmark_test name) + add_executable(${name} "${name}.cc") + target_link_libraries(${name} benchmark ${CMAKE_THREAD_LIBS_INIT}) +endmacro(compile_benchmark_test) + +# Demonstration executable +compile_benchmark_test(benchmark_test) +add_test(benchmark benchmark_test --benchmark_min_time=0.01) + +compile_benchmark_test(filter_test) +macro(add_filter_test name filter expect) + add_test(${name} filter_test --benchmark_min_time=0.01 --benchmark_filter=${filter} ${expect}) +endmacro(add_filter_test) + +add_filter_test(filter_simple "Foo" 3) +add_filter_test(filter_suffix "BM_.*" 4) +add_filter_test(filter_regex_all ".*" 5) +add_filter_test(filter_regex_blank "" 5) +add_filter_test(filter_regex_none "monkey" 0) +add_filter_test(filter_regex_wildcard ".*Foo.*" 3) +add_filter_test(filter_regex_begin "^BM_.*" 4) +add_filter_test(filter_regex_begin2 "^N" 1) +add_filter_test(filter_regex_end ".*Ba$" 1) + +compile_benchmark_test(options_test) +add_test(options_benchmarks options_test --benchmark_min_time=0.01) + +compile_benchmark_test(basic_test) +add_test(basic_benchmark basic_test --benchmark_min_time=0.01) + +compile_benchmark_test(fixture_test) +add_test(fixture_test fixture_test --benchmark_min_time=0.01) + +compile_benchmark_test(cxx03_test) +set_target_properties(cxx03_test + PROPERTIES COMPILE_FLAGS "${CXX03_FLAGS}") +add_test(cxx03 cxx03_test --benchmark_min_time=0.01) + +# Add the coverage command(s) +if(CMAKE_BUILD_TYPE) + string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER) +endif() +if (${CMAKE_BUILD_TYPE_LOWER} MATCHES "coverage") + find_program(GCOV gcov) + find_program(LCOV lcov) + find_program(GENHTML genhtml) + find_program(CTEST ctest) + if (GCOV AND LCOV AND GENHTML AND CTEST AND HAVE_CXX_FLAG_COVERAGE) + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/lcov/index.html + COMMAND ${LCOV} -q -z -d . + COMMAND ${LCOV} -q --no-external -c -b "${CMAKE_SOURCE_DIR}" -d . -o before.lcov -i + COMMAND ${CTEST} --force-new-ctest-process + COMMAND ${LCOV} -q --no-external -c -b "${CMAKE_SOURCE_DIR}" -d . -o after.lcov + COMMAND ${LCOV} -q -a before.lcov -a after.lcov --output-file final.lcov + COMMAND ${LCOV} -q -r final.lcov "'${CMAKE_SOURCE_DIR}/test/*'" -o final.lcov + COMMAND ${GENHTML} final.lcov -o lcov --demangle-cpp --sort -p "${CMAKE_BINARY_DIR}" -t benchmark + DEPENDS filter_test benchmark_test options_test basic_test fixture_test cxx03_test + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Running LCOV" + ) + add_custom_target(coverage + DEPENDS ${CMAKE_BINARY_DIR}/lcov/index.html + COMMENT "LCOV report at lcov/index.html" + ) + message(STATUS "Coverage command added") + else() + if (HAVE_CXX_FLAG_COVERAGE) + set(CXX_FLAG_COVERAGE_MESSAGE supported) + else() + set(CXX_FLAG_COVERAGE_MESSAGE unavailable) + endif() + message(WARNING + "Coverage not available:\n" + " gcov: ${GCOV}\n" + " lcov: ${LCOV}\n" + " genhtml: ${GENHTML}\n" + " ctest: ${CTEST}\n" + " --coverage flag: ${CXX_FLAG_COVERAGE_MESSAGE}") + endif() +endif() diff --git a/3rdparty/benchmark/test/basic_test.cc b/3rdparty/benchmark/test/basic_test.cc new file mode 100644 index 00000000000..3435415447f --- /dev/null +++ b/3rdparty/benchmark/test/basic_test.cc @@ -0,0 +1,102 @@ + +#include "benchmark/benchmark_api.h" + +#define BASIC_BENCHMARK_TEST(x) \ + BENCHMARK(x)->Arg(8)->Arg(512)->Arg(8192) + +void BM_empty(benchmark::State& state) { + while (state.KeepRunning()) { + benchmark::DoNotOptimize(state.iterations()); + } +} +BENCHMARK(BM_empty); +BENCHMARK(BM_empty)->ThreadPerCpu(); + +void BM_spin_empty(benchmark::State& state) { + while (state.KeepRunning()) { + for (int x = 0; x < state.range_x(); ++x) { + benchmark::DoNotOptimize(x); + } + } +} +BASIC_BENCHMARK_TEST(BM_spin_empty); +BASIC_BENCHMARK_TEST(BM_spin_empty)->ThreadPerCpu(); + +void BM_spin_pause_before(benchmark::State& state) { + for (int i = 0; i < state.range_x(); ++i) { + benchmark::DoNotOptimize(i); + } + while(state.KeepRunning()) { + for (int i = 0; i < state.range_x(); ++i) { + benchmark::DoNotOptimize(i); + } + } +} +BASIC_BENCHMARK_TEST(BM_spin_pause_before); +BASIC_BENCHMARK_TEST(BM_spin_pause_before)->ThreadPerCpu(); + + +void BM_spin_pause_during(benchmark::State& state) { + while(state.KeepRunning()) { + state.PauseTiming(); + for (int i = 0; i < state.range_x(); ++i) { + benchmark::DoNotOptimize(i); + } + state.ResumeTiming(); + for (int i = 0; i < state.range_x(); ++i) { + benchmark::DoNotOptimize(i); + } + } +} +BASIC_BENCHMARK_TEST(BM_spin_pause_during); +BASIC_BENCHMARK_TEST(BM_spin_pause_during)->ThreadPerCpu(); + +void BM_pause_during(benchmark::State& state) { + while(state.KeepRunning()) { + state.PauseTiming(); + state.ResumeTiming(); + } +} +BENCHMARK(BM_pause_during); +BENCHMARK(BM_pause_during)->ThreadPerCpu(); +BENCHMARK(BM_pause_during)->UseRealTime(); +BENCHMARK(BM_pause_during)->UseRealTime()->ThreadPerCpu(); + +void BM_spin_pause_after(benchmark::State& state) { + while(state.KeepRunning()) { + for (int i = 0; i < state.range_x(); ++i) { + benchmark::DoNotOptimize(i); + } + } + for (int i = 0; i < state.range_x(); ++i) { + benchmark::DoNotOptimize(i); + } +} +BASIC_BENCHMARK_TEST(BM_spin_pause_after); +BASIC_BENCHMARK_TEST(BM_spin_pause_after)->ThreadPerCpu(); + + +void BM_spin_pause_before_and_after(benchmark::State& state) { + for (int i = 0; i < state.range_x(); ++i) { + benchmark::DoNotOptimize(i); + } + while(state.KeepRunning()) { + for (int i = 0; i < state.range_x(); ++i) { + benchmark::DoNotOptimize(i); + } + } + for (int i = 0; i < state.range_x(); ++i) { + benchmark::DoNotOptimize(i); + } +} +BASIC_BENCHMARK_TEST(BM_spin_pause_before_and_after); +BASIC_BENCHMARK_TEST(BM_spin_pause_before_and_after)->ThreadPerCpu(); + + +void BM_empty_stop_start(benchmark::State& state) { + while (state.KeepRunning()) { } +} +BENCHMARK(BM_empty_stop_start); +BENCHMARK(BM_empty_stop_start)->ThreadPerCpu(); + +BENCHMARK_MAIN() diff --git a/3rdparty/benchmark/test/benchmark_test.cc b/3rdparty/benchmark/test/benchmark_test.cc new file mode 100644 index 00000000000..2d268ce4121 --- /dev/null +++ b/3rdparty/benchmark/test/benchmark_test.cc @@ -0,0 +1,154 @@ +#include "benchmark/benchmark.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(__GNUC__) +# define BENCHMARK_NOINLINE __attribute__((noinline)) +#else +# define BENCHMARK_NOINLINE +#endif + +namespace { + +int BENCHMARK_NOINLINE Factorial(uint32_t n) { + return (n == 1) ? 1 : n * Factorial(n - 1); +} + +double CalculatePi(int depth) { + double pi = 0.0; + for (int i = 0; i < depth; ++i) { + double numerator = static_cast(((i % 2) * 2) - 1); + double denominator = static_cast((2 * i) - 1); + pi += numerator / denominator; + } + return (pi - 1.0) * 4; +} + +std::set ConstructRandomSet(int size) { + std::set s; + for (int i = 0; i < size; ++i) + s.insert(i); + return s; +} + +std::mutex test_vector_mu; +std::vector* test_vector = nullptr; + +} // end namespace + +static void BM_Factorial(benchmark::State& state) { + int fac_42 = 0; + while (state.KeepRunning()) + fac_42 = Factorial(8); + // Prevent compiler optimizations + std::stringstream ss; + ss << fac_42; + state.SetLabel(ss.str()); +} +BENCHMARK(BM_Factorial); +BENCHMARK(BM_Factorial)->UseRealTime(); + +static void BM_CalculatePiRange(benchmark::State& state) { + double pi = 0.0; + while (state.KeepRunning()) + pi = CalculatePi(state.range_x()); + std::stringstream ss; + ss << pi; + state.SetLabel(ss.str()); +} +BENCHMARK_RANGE(BM_CalculatePiRange, 1, 1024 * 1024); + +static void BM_CalculatePi(benchmark::State& state) { + static const int depth = 1024; + while (state.KeepRunning()) { + benchmark::DoNotOptimize(CalculatePi(depth)); + } +} +BENCHMARK(BM_CalculatePi)->Threads(8); +BENCHMARK(BM_CalculatePi)->ThreadRange(1, 32); +BENCHMARK(BM_CalculatePi)->ThreadPerCpu(); + +static void BM_SetInsert(benchmark::State& state) { + while (state.KeepRunning()) { + state.PauseTiming(); + std::set data = ConstructRandomSet(state.range_x()); + state.ResumeTiming(); + for (int j = 0; j < state.range_y(); ++j) + data.insert(rand()); + } + state.SetItemsProcessed(state.iterations() * state.range_y()); + state.SetBytesProcessed(state.iterations() * state.range_y() * sizeof(int)); +} +BENCHMARK(BM_SetInsert)->RangePair(1<<10,8<<10, 1,10); + +template +static void BM_Sequential(benchmark::State& state) { + ValueType v = 42; + while (state.KeepRunning()) { + Container c; + for (int i = state.range_x(); --i; ) + c.push_back(v); + } + const size_t items_processed = state.iterations() * state.range_x(); + state.SetItemsProcessed(items_processed); + state.SetBytesProcessed(items_processed * sizeof(v)); +} +BENCHMARK_TEMPLATE2(BM_Sequential, std::vector, int)->Range(1 << 0, 1 << 10); +BENCHMARK_TEMPLATE(BM_Sequential, std::list)->Range(1 << 0, 1 << 10); +// Test the variadic version of BENCHMARK_TEMPLATE in C++11 and beyond. +#if __cplusplus >= 201103L +BENCHMARK_TEMPLATE(BM_Sequential, std::vector, int)->Arg(512); +#endif + +static void BM_StringCompare(benchmark::State& state) { + std::string s1(state.range_x(), '-'); + std::string s2(state.range_x(), '-'); + while (state.KeepRunning()) + benchmark::DoNotOptimize(s1.compare(s2)); +} +BENCHMARK(BM_StringCompare)->Range(1, 1<<20); + +static void BM_SetupTeardown(benchmark::State& state) { + if (state.thread_index == 0) { + // No need to lock test_vector_mu here as this is running single-threaded. + test_vector = new std::vector(); + } + int i = 0; + while (state.KeepRunning()) { + std::lock_guard l(test_vector_mu); + if (i%2 == 0) + test_vector->push_back(i); + else + test_vector->pop_back(); + ++i; + } + if (state.thread_index == 0) { + delete test_vector; + } +} +BENCHMARK(BM_SetupTeardown)->ThreadPerCpu(); + +static void BM_LongTest(benchmark::State& state) { + double tracker = 0.0; + while (state.KeepRunning()) { + for (int i = 0; i < state.range_x(); ++i) + benchmark::DoNotOptimize(tracker += i); + } +} +BENCHMARK(BM_LongTest)->Range(1<<16,1<<28); + +BENCHMARK_MAIN() + diff --git a/3rdparty/benchmark/test/cxx03_test.cc b/3rdparty/benchmark/test/cxx03_test.cc new file mode 100644 index 00000000000..56779d66021 --- /dev/null +++ b/3rdparty/benchmark/test/cxx03_test.cc @@ -0,0 +1,31 @@ + +#include + +#include "benchmark/benchmark.h" + +#if __cplusplus >= 201103L +#error C++11 or greater detected. Should be C++03. +#endif + +void BM_empty(benchmark::State& state) { + while (state.KeepRunning()) { + volatile std::size_t x = state.iterations(); + ((void)x); + } +} +BENCHMARK(BM_empty); + +template +void BM_template2(benchmark::State& state) { + BM_empty(state); +} +BENCHMARK_TEMPLATE2(BM_template2, int, long); + +template +void BM_template1(benchmark::State& state) { + BM_empty(state); +} +BENCHMARK_TEMPLATE(BM_template1, long); +BENCHMARK_TEMPLATE1(BM_template1, int); + +BENCHMARK_MAIN() diff --git a/3rdparty/benchmark/test/filter_test.cc b/3rdparty/benchmark/test/filter_test.cc new file mode 100644 index 00000000000..2a278ff4a77 --- /dev/null +++ b/3rdparty/benchmark/test/filter_test.cc @@ -0,0 +1,91 @@ +#include "benchmark/benchmark.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace { + +class TestReporter : public benchmark::ConsoleReporter { + public: + virtual bool ReportContext(const Context& context) { + return ConsoleReporter::ReportContext(context); + }; + + virtual void ReportRuns(const std::vector& report) { + ++count_; + ConsoleReporter::ReportRuns(report); + }; + + TestReporter() : count_(0) {} + + virtual ~TestReporter() {} + + size_t GetCount() const { + return count_; + } + + private: + mutable size_t count_; +}; + +} // end namespace + + +static void NoPrefix(benchmark::State& state) { + while (state.KeepRunning()) {} +} +BENCHMARK(NoPrefix); + +static void BM_Foo(benchmark::State& state) { + while (state.KeepRunning()) {} +} +BENCHMARK(BM_Foo); + + +static void BM_Bar(benchmark::State& state) { + while (state.KeepRunning()) {} +} +BENCHMARK(BM_Bar); + + +static void BM_FooBar(benchmark::State& state) { + while (state.KeepRunning()) {} +} +BENCHMARK(BM_FooBar); + + +static void BM_FooBa(benchmark::State& state) { + while (state.KeepRunning()) {} +} +BENCHMARK(BM_FooBa); + + + +int main(int argc, char* argv[]) { + benchmark::Initialize(&argc, argv); + + TestReporter test_reporter; + benchmark::RunSpecifiedBenchmarks(&test_reporter); + + if (argc == 2) { + // Make sure we ran all of the tests + std::stringstream ss(argv[1]); + size_t expected; + ss >> expected; + + const size_t count = test_reporter.GetCount(); + if (count != expected) { + std::cerr << "ERROR: Expected " << expected << " tests to be ran but only " + << count << " completed" << std::endl; + return -1; + } + } + return 0; +} diff --git a/3rdparty/benchmark/test/fixture_test.cc b/3rdparty/benchmark/test/fixture_test.cc new file mode 100644 index 00000000000..8aea6ef0601 --- /dev/null +++ b/3rdparty/benchmark/test/fixture_test.cc @@ -0,0 +1,42 @@ + +#include "benchmark/benchmark.h" + +#include + +class MyFixture : public ::benchmark::Fixture +{ +public: + void SetUp() { + data = new int(42); + } + + void TearDown() { + assert(data != nullptr); + delete data; + data = nullptr; + } + + ~MyFixture() { + assert(data == nullptr); + } + + int* data; +}; + + +BENCHMARK_F(MyFixture, Foo)(benchmark::State& st) { + assert(data != nullptr); + assert(*data == 42); + while (st.KeepRunning()) { + } +} + +BENCHMARK_DEFINE_F(MyFixture, Bar)(benchmark::State& st) { + while (st.KeepRunning()) { + } + st.SetItemsProcessed(st.range_x()); +} +BENCHMARK_REGISTER_F(MyFixture, Bar)->Arg(42); + + +BENCHMARK_MAIN() diff --git a/3rdparty/benchmark/test/options_test.cc b/3rdparty/benchmark/test/options_test.cc new file mode 100644 index 00000000000..d4c682d4ece --- /dev/null +++ b/3rdparty/benchmark/test/options_test.cc @@ -0,0 +1,26 @@ +#include "benchmark/benchmark_api.h" + +void BM_basic(benchmark::State& state) { + while (state.KeepRunning()) { + } +} +BENCHMARK(BM_basic); +BENCHMARK(BM_basic)->Arg(42); +BENCHMARK(BM_basic)->Range(1, 8); +BENCHMARK(BM_basic)->DenseRange(10, 15); +BENCHMARK(BM_basic)->ArgPair(42, 42); +BENCHMARK(BM_basic)->RangePair(64, 512, 64, 512); +BENCHMARK(BM_basic)->MinTime(0.7); +BENCHMARK(BM_basic)->UseRealTime(); +BENCHMARK(BM_basic)->ThreadRange(2, 4); +BENCHMARK(BM_basic)->ThreadPerCpu(); + +void CustomArgs(benchmark::internal::Benchmark* b) { + for (int i = 0; i < 10; ++i) { + b->Arg(i); + } +} + +BENCHMARK(BM_basic)->Apply(CustomArgs); + +BENCHMARK_MAIN() diff --git a/benchmarks/eminline_native.cpp b/benchmarks/eminline_native.cpp new file mode 100644 index 00000000000..07bfa02bb1d --- /dev/null +++ b/benchmarks/eminline_native.cpp @@ -0,0 +1,15 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic + +#include "benchmark/benchmark_api.h" +#include "osdcomm.h" +#include "eminline.h" +static void BM_count_leading_zeros_native(benchmark::State& state) { + UINT32 cnt = 0x332533; + while (state.KeepRunning()) { + (void)count_leading_zeros(cnt); + cnt++; + } +} +// Register the function as a benchmark +BENCHMARK(BM_count_leading_zeros_native); diff --git a/benchmarks/eminline_noasm.cpp b/benchmarks/eminline_noasm.cpp new file mode 100644 index 00000000000..43c9e36b020 --- /dev/null +++ b/benchmarks/eminline_noasm.cpp @@ -0,0 +1,24 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic + +#include "benchmark/benchmark_api.h" +#include +#include "osdcore.h" +#include "osdcomm.h" +#define MAME_NOASM 1 +osd_ticks_t osd_ticks(void) +{ + // use the standard library clock function + return clock(); +} +#include "eminline.h" + +static void BM_count_leading_zeros_noasm(benchmark::State& state) { + UINT32 cnt = 0x332533; + while (state.KeepRunning()) { + (void)count_leading_zeros(cnt); + cnt++; + } +} +// Register the function as a benchmark +BENCHMARK(BM_count_leading_zeros_noasm); diff --git a/benchmarks/main.cpp b/benchmarks/main.cpp new file mode 100644 index 00000000000..c859b918976 --- /dev/null +++ b/benchmarks/main.cpp @@ -0,0 +1,6 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic + +#include "benchmark/benchmark_api.h" + +BENCHMARK_MAIN(); \ No newline at end of file diff --git a/makefile b/makefile index 5086356729e..00ad643427f 100644 --- a/makefile +++ b/makefile @@ -20,6 +20,7 @@ # SUBTARGET = tiny # TOOLS = 1 # TESTS = 1 +# BENCHMARKS = 1 # OSD = sdl # USE_BGFX = 1 @@ -473,6 +474,10 @@ ifdef TESTS PARAMS += --with-tests endif +ifdef BENCHMARKS +PARAMS += --with-benchmarks +endif + ifdef SYMBOLS PARAMS += --SYMBOLS='$(SYMBOLS)' endif @@ -698,6 +703,7 @@ SCRIPTS = scripts/genie.lua \ scripts/src/sound.lua \ scripts/src/tools.lua \ scripts/src/tests.lua \ + scripts/src/benchmarks.lua \ scripts/src/video.lua \ scripts/src/bus.lua \ scripts/src/netlist.lua \ diff --git a/scripts/genie.lua b/scripts/genie.lua index 2fcfb323653..0e8ce5e63aa 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -82,6 +82,11 @@ newoption { description = "Enable building tests.", } +newoption { + trigger = "with-benchmarks", + description = "Enable building benchmarks.", +} + newoption { trigger = "osd", description = "Choose OSD layer implementation", @@ -1296,3 +1301,8 @@ if _OPTIONS["with-tests"] then group "tests" dofile(path.join("src", "tests.lua")) end + +if _OPTIONS["with-benchmarks"] then + group "benchmarks" + dofile(path.join("src", "benchmarks.lua")) +end diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 2bee6477f01..66fba9f2144 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -917,39 +917,3 @@ links { "portaudio", } end - --------------------------------------------------- --- GoogleTest library objects --------------------------------------------------- - -project "gtest" - uuid "fa306a8d-fb10-4d4a-9d2e-fdb9076407b4" - kind "StaticLib" - - configuration { "gmake" } - buildoptions { - "-Wno-undef", - "-Wno-unused-variable", - } - - configuration { "mingw-clang" } - buildoptions { - "-O0", -- crash of compiler when doing optimization - } - - configuration { "vs*" } -if _OPTIONS["vs"]=="intel-15" then - buildoptions { - "/Qwd1195", -- error #1195: conversion from integer to smaller pointer - } -end - - configuration { } - - includedirs { - MAME_DIR .. "3rdparty/googletest/googletest/include", - MAME_DIR .. "3rdparty/googletest/googletest", - } - files { - MAME_DIR .. "3rdparty/googletest/googletest/src/gtest-all.cc", - } diff --git a/scripts/src/benchmarks.lua b/scripts/src/benchmarks.lua new file mode 100644 index 00000000000..f774e3f45ca --- /dev/null +++ b/scripts/src/benchmarks.lua @@ -0,0 +1,74 @@ +-- license:BSD-3-Clause +-- copyright-holders:MAMEdev Team + +--------------------------------------------------------------------------- +-- +-- benchmarks.lua +-- +-- Rules for building benchmarks +-- +--------------------------------------------------------------------------- + +-------------------------------------------------- +-- Google Benchmark library objects +-------------------------------------------------- + +project "benchmark" + uuid "60a7e05c-8b4f-497c-bfda-2949a009ba0d" + kind "StaticLib" + + configuration { } + defines { + "HAVE_STD_REGEX", + } + + includedirs { + MAME_DIR .. "3rdparty/benchmark/include", + } + files { + MAME_DIR .. "3rdparty/benchmark/src/benchmark.cc", + MAME_DIR .. "3rdparty/benchmark/src/colorprint.cc", + MAME_DIR .. "3rdparty/benchmark/src/commandlineflags.cc", + MAME_DIR .. "3rdparty/benchmark/src/console_reporter.cc", + MAME_DIR .. "3rdparty/benchmark/src/csv_reporter.cc", + MAME_DIR .. "3rdparty/benchmark/src/json_reporter.cc", + MAME_DIR .. "3rdparty/benchmark/src/log.cc", + MAME_DIR .. "3rdparty/benchmark/src/reporter.cc", + MAME_DIR .. "3rdparty/benchmark/src/sleep.cc", + MAME_DIR .. "3rdparty/benchmark/src/string_util.cc", + MAME_DIR .. "3rdparty/benchmark/src/sysinfo.cc", + MAME_DIR .. "3rdparty/benchmark/src/walltime.cc", + MAME_DIR .. "3rdparty/benchmark/src/re_std.cc", + } + + + +project("benchmarks") + uuid ("a9750a48-d283-4a6d-b126-31c7ce049af1") + kind "ConsoleApp" + + flags { + "Symbols", -- always include minimum symbols for executables + } + + if _OPTIONS["SEPARATE_BIN"]~="1" then + targetdir(MAME_DIR) + end + + configuration { } + + links { + "benchmark", + } + + includedirs { + MAME_DIR .. "3rdparty/benchmark/include", + MAME_DIR .. "src/osd", + } + + files { + MAME_DIR .. "benchmarks/main.cpp", + MAME_DIR .. "benchmarks/eminline_native.cpp", + MAME_DIR .. "benchmarks/eminline_noasm.cpp", + } + diff --git a/scripts/src/tests.lua b/scripts/src/tests.lua index 99d82fcb6cb..d30cff64df2 100644 --- a/scripts/src/tests.lua +++ b/scripts/src/tests.lua @@ -8,42 +8,78 @@ -- Rules for building tests -- --------------------------------------------------------------------------- +-------------------------------------------------- +-- GoogleTest library objects +-------------------------------------------------- -project("tests") -uuid ("66d4c639-196b-4065-a411-7ee9266564f5") -kind "ConsoleApp" +project "gtest" + uuid "fa306a8d-fb10-4d4a-9d2e-fdb9076407b4" + kind "StaticLib" + + configuration { "gmake" } + buildoptions { + "-Wno-undef", + "-Wno-unused-variable", + } -flags { - "Symbols", -- always include minimum symbols for executables -} + configuration { "mingw-clang" } + buildoptions { + "-O0", -- crash of compiler when doing optimization + } -if _OPTIONS["SEPARATE_BIN"]~="1" then - targetdir(MAME_DIR) + configuration { "vs*" } +if _OPTIONS["vs"]=="intel-15" then + buildoptions { + "/Qwd1195", -- error #1195: conversion from integer to smaller pointer + } end -configuration { "gmake" } - buildoptions { - "-Wno-undef", + configuration { } + + includedirs { + MAME_DIR .. "3rdparty/googletest/googletest/include", + MAME_DIR .. "3rdparty/googletest/googletest", + } + files { + MAME_DIR .. "3rdparty/googletest/googletest/src/gtest-all.cc", + } + + +project("tests") + uuid ("66d4c639-196b-4065-a411-7ee9266564f5") + kind "ConsoleApp" + + flags { + "Symbols", -- always include minimum symbols for executables } -configuration { } - -links { - "gtest", - "utils", - "expat", - "zlib", - "ocore_" .. _OPTIONS["osd"], -} - -includedirs { - MAME_DIR .. "3rdparty/googletest/googletest/include", - MAME_DIR .. "src/osd", - MAME_DIR .. "src/lib/util", -} - -files { - MAME_DIR .. "tests/main.cpp", - MAME_DIR .. "tests/lib/util/corestr.cpp", -} + if _OPTIONS["SEPARATE_BIN"]~="1" then + targetdir(MAME_DIR) + end + + configuration { "gmake" } + buildoptions { + "-Wno-undef", + } + + configuration { } + + links { + "gtest", + "utils", + "expat", + "zlib", + "ocore_" .. _OPTIONS["osd"], + } + + includedirs { + MAME_DIR .. "3rdparty/googletest/googletest/include", + MAME_DIR .. "src/osd", + MAME_DIR .. "src/lib/util", + } + + files { + MAME_DIR .. "tests/main.cpp", + MAME_DIR .. "tests/lib/util/corestr.cpp", + } -- cgit v1.2.3-70-g09d2 From f1bd6127a41c17c82efc2c23d1cd3006204b7d0e Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 29 Jan 2016 13:54:00 +0000 Subject: new clones 1000 Miglia: Great 1000 Miles Rally (94/05/10) [Corrado Tomaselli] --- src/mame/arcade.lst | 1 + src/mame/drivers/kaneko16.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 90ab4bd4d2d..e43a3a63ad4 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -9270,6 +9270,7 @@ oedfight // (c) 1994 Kaneko bonkadv // (c) 1994 Kaneko gtmr // (c) 1994 Kaneko gtmra // (c) 1994 Kaneko +gtmro // (c) 1994 Kaneko gtmre // (c) 1994 Kaneko gtmrusa // (c) 1994 Kaneko (US) gtmr2 // (c) 1995 Kaneko diff --git a/src/mame/drivers/kaneko16.cpp b/src/mame/drivers/kaneko16.cpp index 494b5db608e..ca2a754857e 100644 --- a/src/mame/drivers/kaneko16.cpp +++ b/src/mame/drivers/kaneko16.cpp @@ -3342,6 +3342,40 @@ ROM_START( gtmra ) /* Not present on this board */ ROM_END + +ROM_START( gtmro ) + ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "u514.bin", 0x000000, 0x080000, CRC(2e857685) SHA1(43b6d88df51a3b4fb0cb910f63a5ec26b06e216a) ) + ROM_LOAD16_BYTE( "u513.bin", 0x000001, 0x080000, CRC(d5003870) SHA1(6a4353fa8f94a119c23f232861d790f50be26ea8) ) + + ROM_REGION( 0x020000, "mcudata", 0 ) /* MCU Code */ + ROM_LOAD16_WORD_SWAP( "mmd0x0.u124", 0x000000, 0x020000, CRC(e1f6159e) SHA1(e4af85036756482d6fa27494842699e2647809c7) ) + + ROM_REGION( 0x800000, "gfx1", 0 ) /* Sprites */ + ROM_LOAD16_BYTE( "mm200-e.bin", 0x000000, 0x100000, CRC(eb104408) SHA1(a7805597161dc5acd2804d607dd0acac0c40111d) ) + ROM_LOAD16_BYTE( "mm200-o.bin", 0x000001, 0x100000, CRC(b6d04e7c) SHA1(1fa9d6b967724ed0c9e6ae3eda7089a081120d54) ) + ROM_LOAD16_BYTE( "mm201-e.bin", 0x200000, 0x100000, CRC(b8c64e14) SHA1(8e2b19f0ba715dfdf0d423a41989e715145adbeb) ) + ROM_LOAD16_BYTE( "mm201-o.bin", 0x200001, 0x100000, CRC(3ecd6c0a) SHA1(cb48564e2bd3014eeaad9cfa589bdef3f828c282) ) + ROM_LOAD16_BYTE( "mm202-e.bin", 0x400000, 0x100000, CRC(f0fd5688) SHA1(a3f5edfef253c81b27434519b0b9527f6c9a6e82) ) + ROM_LOAD16_BYTE( "mm202-o.bin", 0x400001, 0x100000, CRC(e0fe1b2b) SHA1(e66bd09eed6dfea524d8610a3c7e1792a1ff6286) ) + ROM_LOAD16_BYTE( "mm203-e.bin", 0x600000, 0x100000, CRC(b9001f28) SHA1(b112c17b960a535a543565ca2e22734c7c510f18) ) + ROM_LOAD16_BYTE( "mm203-o.bin", 0x600001, 0x100000, CRC(2ed6227d) SHA1(d9abbb739ef15437194c90cd01d5d82dbd4b7859) ) + + ROM_REGION( 0x200000, "gfx2", 0 ) /* Tiles (scrambled) */ + ROM_LOAD16_BYTE( "mm300-e.u53", 0x000000, 0x100000, CRC(f9ee708d) SHA1(4c11a9574ea815a87d7e4af04db4368b14bf7530) ) + ROM_LOAD16_BYTE( "mm300-o.u54", 0x000001, 0x100000, CRC(76299353) SHA1(01997905ba019d770ac1998633f4ebf6f91a3945) ) + + ROM_REGION( 0x200000, "gfx3", 0 ) /* Tiles (scrambled) */ + ROM_COPY("gfx2",0x000000,0,0x200000) // it isn't on the board twice. + + ROM_REGION( 0x400000, "oki1", 0 ) /* Samples, plus room for expansion */ + ROM_LOAD( "mm-100-401-e0.bin", 0x000000, 0x100000, CRC(b9cbfbee) SHA1(051d48a68477ef9c29bd5cc0bb7955d513a0ab94) ) // 16 x $10000 + + ROM_REGION( 0x100000, "oki2", ROMREGION_ERASE00 ) /* Samples */ + /* Not present on this board */ +ROM_END + + /* The evolution and USA versions seem to be more like GTMR 1.5, they have some fairly significant changes */ /* This version displays: @@ -4348,6 +4382,7 @@ GAME( 1994, bloodwar, 0, bloodwar, bloodwar, kaneko16_gtmr_state, gtm GAME( 1994, oedfight, bloodwar, bloodwar, bloodwar, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "Oedo Fight (Japan Bloodshed Ver.)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, gtmr, 0, gtmr, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "1000 Miglia: Great 1000 Miles Rally (94/07/18)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, gtmra, gtmr, gtmr, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "1000 Miglia: Great 1000 Miles Rally (94/06/13)", MACHINE_SUPPORTS_SAVE ) +GAME( 1994, gtmro, gtmr, gtmr, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "1000 Miglia: Great 1000 Miles Rally (94/05/10)", MACHINE_SUPPORTS_SAVE ) // possible prototype GAME( 1994, gtmre, gtmr, gtmre, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "Great 1000 Miles Rally: Evolution Model!!! (94/09/06)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, gtmrusa, gtmr, gtmre, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "Great 1000 Miles Rally: U.S.A Version! (94/09/06)", MACHINE_SUPPORTS_SAVE ) // U.S.A version seems part of the title, rather than region GAME( 1995, gtmr2, 0, gtmr2, gtmr2, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "Mille Miglia 2: Great 1000 Miles Rally (95/05/24)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From b8307512e3848669bc782becbdb5d32e76e1cb12 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 29 Jan 2016 15:11:30 +0100 Subject: fidel6502: added CSC foreign language sets --- src/mame/drivers/fidel6502.cpp | 86 ++++++++++++++++++++++++++++++++---------- src/mame/drivers/fidelz80.cpp | 32 +++++++--------- src/mame/mess.lst | 32 +++++++++------- 3 files changed, 98 insertions(+), 52 deletions(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index eb7f45070a8..d080b4b015d 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -149,12 +149,9 @@ READ8_MEMBER(fidel6502_state::csc_pia0_pb_r) data |= 0x08; // d5: button row 8 (active low) - if (!(read_inputs(9) & 0x100)) - data |= 0x20; - // d6,d7: language switches - data|=0xc0; - + data |= (~read_inputs(9) >> 3 & 0x20) | (m_inp_matrix[9]->read() << 6 & 0xc0); + return data; } @@ -327,7 +324,7 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) PORT_START("IN.1") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) @@ -338,7 +335,7 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV") PORT_CODE(KEYCODE_V) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV") PORT_CODE(KEYCODE_V) PORT_START("IN.2") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) @@ -349,7 +346,7 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TM") PORT_CODE(KEYCODE_T) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TM") PORT_CODE(KEYCODE_T) PORT_START("IN.3") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) @@ -360,7 +357,7 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) PORT_START("IN.4") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) @@ -371,7 +368,7 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) PORT_START("IN.5") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) @@ -382,7 +379,7 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) PORT_START("IN.6") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) @@ -393,7 +390,7 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("IN.7") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) @@ -404,7 +401,7 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("IN.8") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) @@ -415,7 +412,14 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) - PORT_BIT(0x100,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_UNUSED + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("IN.9") // hardwired + PORT_CONFNAME( 0x03, 0x03, "Language" ) + PORT_CONFSETTING( 0x03, "English" ) + PORT_CONFSETTING( 0x02, "2" ) // todo.. + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x00, "0" ) INPUT_PORTS_END static INPUT_PORTS_START( sc12 ) @@ -574,15 +578,17 @@ static MACHINE_CONFIG_START( sc12, fidel6502_state ) MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fidel_scc") MCFG_GENERIC_EXTENSIONS("bin,dat") MCFG_GENERIC_LOAD(fidel6502_state, scc_cartridge) - MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_scc") MACHINE_CONFIG_END static MACHINE_CONFIG_START( fev, fidel6502_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M65SC02, XTAL_12MHz/4) // G65SC102 + MCFG_CPU_ADD("maincpu", M65SC02, XTAL_12MHz/4) // G65SC102P-3, 12.0M ceramic resonator MCFG_CPU_PROGRAM_MAP(fev_map) + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(780)) // from 556 timer, PCB photo suggests it's same as sc12 + MCFG_TIMER_START_DELAY(attotime::from_hz(780) - attotime::from_nsec(15250)) // active for 15.25us + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel6502_state, irq_off, attotime::from_hz(780)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_fev) @@ -613,6 +619,43 @@ ROM_START( csc ) ROM_RELOAD( 0x1000, 0x1000) ROM_END +ROM_START( cscsp ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("101-64109.bin", 0x2000, 0x2000, CRC(08a3577c) SHA1(69fe379d21a9d4b57c84c3832d7b3e7431eec341) ) + ROM_LOAD("1025a03.bin", 0xa000, 0x2000, CRC(63982c07) SHA1(5ed4356323d5c80df216da55994abe94ba4aa94c) ) + ROM_LOAD("1025a02.bin", 0xc000, 0x2000, CRC(9e6e7c69) SHA1(4f1ed9141b6596f4d2b1217d7a4ba48229f3f1b0) ) + ROM_LOAD("1025a01.bin", 0xe000, 0x2000, CRC(57f068c3) SHA1(7d2ac4b9a2fba19556782863bdd89e2d2d94e97b) ) + ROM_LOAD("74s474.bin", 0xfe00, 0x0200, CRC(4511ba31) SHA1(e275b1739f8c3aa445cccb6a2b597475f507e456) ) + + ROM_REGION( 0x2000, "speech", 0 ) + ROM_LOAD("vcc-spanish.bin", 0x0000, 0x2000, BAD_DUMP CRC(8766e128) SHA1(78c7413bf240159720b131ab70bfbdf4e86eb1e9) ) // taken from vcc/fexcelv, assume correct +ROM_END + +ROM_START( cscg ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("101-64109.bin", 0x2000, 0x2000, CRC(08a3577c) SHA1(69fe379d21a9d4b57c84c3832d7b3e7431eec341) ) + ROM_LOAD("1025a03.bin", 0xa000, 0x2000, CRC(63982c07) SHA1(5ed4356323d5c80df216da55994abe94ba4aa94c) ) + ROM_LOAD("1025a02.bin", 0xc000, 0x2000, CRC(9e6e7c69) SHA1(4f1ed9141b6596f4d2b1217d7a4ba48229f3f1b0) ) + ROM_LOAD("1025a01.bin", 0xe000, 0x2000, CRC(57f068c3) SHA1(7d2ac4b9a2fba19556782863bdd89e2d2d94e97b) ) + ROM_LOAD("74s474.bin", 0xfe00, 0x0200, CRC(4511ba31) SHA1(e275b1739f8c3aa445cccb6a2b597475f507e456) ) + + ROM_REGION( 0x2000, "speech", 0 ) + ROM_LOAD("vcc-german.bin", 0x0000, 0x2000, BAD_DUMP CRC(6c85e310) SHA1(20d1d6543c1e6a1f04184a2df2a468f33faec3ff) ) // taken from fexcelv, assume correct +ROM_END + +ROM_START( cscfr ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("101-64109.bin", 0x2000, 0x2000, CRC(08a3577c) SHA1(69fe379d21a9d4b57c84c3832d7b3e7431eec341) ) + ROM_LOAD("1025a03.bin", 0xa000, 0x2000, CRC(63982c07) SHA1(5ed4356323d5c80df216da55994abe94ba4aa94c) ) + ROM_LOAD("1025a02.bin", 0xc000, 0x2000, CRC(9e6e7c69) SHA1(4f1ed9141b6596f4d2b1217d7a4ba48229f3f1b0) ) + ROM_LOAD("1025a01.bin", 0xe000, 0x2000, CRC(57f068c3) SHA1(7d2ac4b9a2fba19556782863bdd89e2d2d94e97b) ) + ROM_LOAD("74s474.bin", 0xfe00, 0x0200, CRC(4511ba31) SHA1(e275b1739f8c3aa445cccb6a2b597475f507e456) ) + + ROM_REGION( 0x2000, "speech", 0 ) + ROM_LOAD("vcc-french.bin", 0x0000, 0x2000, BAD_DUMP CRC(fe8c5c18) SHA1(2b64279ab3747ee81c86963c13e78321c6cfa3a3) ) // taken from fexcelv, assume correct +ROM_END + + ROM_START( fscc12 ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD("101-1068a01", 0x8000, 0x2000, CRC(63c76cdd) SHA1(e0771c98d4483a6b1620791cb99a7e46b0db95c4) ) // SSS SCM23C65E4 @@ -632,9 +675,12 @@ ROM_END Drivers ******************************************************************************/ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1981, csc, 0, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +COMP( 1981, csc, 0, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (English)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1981, cscsp, csc, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (Spanish)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1981, cscg, csc, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (German)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1981, cscfr, csc, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (French)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1987, fexcelv, 0, 0, fev, csc, driver_device, 0, "Fidelity Electronics", "Voice Excellence", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1987, fexcelv, 0, 0, fev, csc, driver_device, 0, "Fidelity Electronics", "Voice Excellence", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 71f36d55537..4f81b9ab7cd 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -1082,29 +1082,25 @@ READ8_MEMBER(fidelz80_state::vsc_pio_porta_r) { // d0-d7: multiplexed inputs return read_inputs(11); - } READ8_MEMBER(fidelz80_state::vsc_pio_portb_r) { - UINT8 ret = 0; + UINT8 data = 0; // d4: TSI BUSY line - ret |= (m_speech->busy_r()) ? 0 : 0x10; + data |= (m_speech->busy_r()) ? 0 : 0x10; - return ret; + return data; } WRITE8_MEMBER(fidelz80_state::vsc_pio_portb_w) { // d0,d1: input mux highest bits // d5: enable language switch - m_inp_mux = (m_inp_mux & ~0x700) | (data << 8 & 0x300) | (data << 5 & 0x400); - - //if (m_inp_mux & 0x400) debugger_break(machine()); + m_inp_mux = (m_inp_mux & 0xff) | (data << 8 & 0x300) | (data << 5 & 0x400); // d7: TSI ROM A12 - m_speech->force_update(); // update stream to now m_speech_bank = data >> 7 & 1; @@ -1209,13 +1205,13 @@ ADDRESS_MAP_END // VSC io: A2 is 8255 _CE, A3 is Z80 PIO _CE - in theory, both chips can be accessed simultaneously READ8_MEMBER(fidelz80_state::vsc_io_trampoline_r) { - UINT8 ret = 0xff; // open bus + UINT8 data = 0xff; // open bus if (~offset & 4) - ret &= m_ppi8255->read(space, offset & 3); + data &= m_ppi8255->read(space, offset & 3); if (~offset & 8) - ret &= m_z80pio->read(space, offset & 3); + data &= m_z80pio->read(space, offset & 3); - return ret; + return data; } WRITE8_MEMBER(fidelz80_state::vsc_io_trampoline_w) @@ -1309,8 +1305,8 @@ static INPUT_PORTS_START( cc10 ) PORT_START("LEVEL") // hardwired (VCC/GND?) PORT_CONFNAME( 0x80, 0x00, "Maximum Levels" ) - PORT_CONFSETTING( 0x00, "10" ) // factory setting - PORT_CONFSETTING( 0x80, "3" ) + PORT_CONFSETTING( 0x00, "10" ) // factory setting + PORT_CONFSETTING( 0x80, "3" ) INPUT_PORTS_END static INPUT_PORTS_START( vcc ) @@ -1461,10 +1457,10 @@ static INPUT_PORTS_START( vsc ) PORT_START("IN.10") // hardwired (2 diodes) PORT_CONFNAME( 0x03, 0x00, "Language" ) - PORT_CONFSETTING( 0x00, "English" ) - PORT_CONFSETTING( 0x01, "1" ) // todo: game dasm says it checks against 0/not0, 2, 3.. which language is which? - PORT_CONFSETTING( 0x02, "2" ) - PORT_CONFSETTING( 0x03, "3" ) + PORT_CONFSETTING( 0x00, "English" ) + PORT_CONFSETTING( 0x01, "1" ) // todo: game dasm says it checks against 0/not0, 2, 3.. which language is which? + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFSETTING( 0x03, "3" ) INPUT_PORTS_END static INPUT_PORTS_START( vbrc ) diff --git a/src/mame/mess.lst b/src/mame/mess.lst index b98dc063fd4..608b88c02f6 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2142,21 +2142,25 @@ diablo68 // 1991 Novag Diablo 68000 Chess Computer // Fidelity cc10 -vcc -vccg -vccfr -vccsp -uvc -uvcg -uvcfr -uvcsp -bridgec3 +vcc // VCC: Voice Chess Challenger (English) +vccg // * Spanish +vccfr // * German +vccsp // * French +uvc // UVC: Advanced Voice Chess Challenger (English) +uvcsp // * Spanish +uvcg // * German +uvcfr // * French +vsc // VSC: Voice Sensory Chess Challenger (English) +vscsp // * Spanish +vscg // * German +vscfr // * French vbrc -vsc -vscg -vscfr -vscsp -csc +bridgec3 + +csc // CSC: Champion Sensory Chess Challenger (English) +cscsp // * Spanish +cscg // * German +cscfr // * French fscc12 fexcelv -- cgit v1.2.3-70-g09d2 From 94fd4929056ea50c4dba3990c60386eac9f853d5 Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 29 Jan 2016 11:03:59 -0500 Subject: Modernize sound volume setting code in various Atari drivers This lets atarigen.cpp shed legacy sound routines using the archaic method of looking up sound devices by types rather than tags (which until 0.126u2 they weren't required to provide and often didn't have). --- src/mame/drivers/arcadecl.cpp | 2 +- src/mame/drivers/atarisy2.cpp | 54 ++++++++++++++++++--------------------- src/mame/drivers/gauntlet.cpp | 31 ++++++++++------------- src/mame/drivers/rampart.cpp | 6 ++--- src/mame/drivers/relief.cpp | 6 ++--- src/mame/includes/arcadecl.h | 3 +++ src/mame/includes/atarisy1.h | 5 ++++ src/mame/includes/atarisy2.h | 14 +++++++++- src/mame/includes/badlands.h | 5 ++++ src/mame/includes/cyberbal.h | 2 ++ src/mame/includes/gauntlet.h | 14 ++++++++++ src/mame/includes/rampart.h | 3 +++ src/mame/includes/relief.h | 6 +++++ src/mame/machine/atarigen.cpp | 59 ------------------------------------------- src/mame/machine/atarigen.h | 12 --------- 15 files changed, 97 insertions(+), 125 deletions(-) diff --git a/src/mame/drivers/arcadecl.cpp b/src/mame/drivers/arcadecl.cpp index dd261cac975..1e821db2466 100644 --- a/src/mame/drivers/arcadecl.cpp +++ b/src/mame/drivers/arcadecl.cpp @@ -131,7 +131,7 @@ WRITE16_MEMBER(arcadecl_state::latch_w) if (ACCESSING_BITS_0_7) { m_oki->set_bank_base((data & 0x80) ? 0x40000 : 0x00000); - set_oki6295_volume((data & 0x001f) * 100 / 0x1f); + m_oki->set_output_gain(ALL_OUTPUTS, (data & 0x001f) / 31.0f); } } diff --git a/src/mame/drivers/atarisy2.cpp b/src/mame/drivers/atarisy2.cpp index 539e86f5a05..4fa506ddb52 100644 --- a/src/mame/drivers/atarisy2.cpp +++ b/src/mame/drivers/atarisy2.cpp @@ -127,9 +127,6 @@ #include "emu.h" #include "includes/atarisy2.h" -#include "sound/tms5220.h" -#include "sound/2151intf.h" -#include "sound/pokey.h" #define MASTER_CLOCK XTAL_20MHz @@ -328,7 +325,7 @@ READ8_MEMBER(atarisy2_state::switch_6502_r) { int result = ioport("1840")->read(); - if ((m_has_tms5220) && (machine().device("tms")->readyq_r() == 0)) + if (m_tms5220.found() && (m_tms5220->readyq_r() == 0)) result &= ~0x04; if (!(ioport("1801")->read() & 0x80)) result |= 0x10; @@ -340,10 +337,10 @@ WRITE8_MEMBER(atarisy2_state::switch_6502_w) { output().set_led_value(0, data & 0x04); output().set_led_value(1, data & 0x08); - if (m_has_tms5220) + if (m_tms5220.found()) { data = 12 | ((data >> 5) & 1); - machine().device("tms")->set_frequency(MASTER_CLOCK/4 / (16 - data) / 2); + m_tms5220->set_frequency(MASTER_CLOCK/4 / (16 - data) / 2); } } @@ -629,7 +626,7 @@ WRITE8_MEMBER(atarisy2_state::mixer_w) if (!(data & 0x02)) rbott += 1.0/47; if (!(data & 0x04)) rbott += 1.0/22; gain = (rbott == 0) ? 1.0 : ((1.0/rbott) / (rtop + (1.0/rbott))); - set_ym2151_volume(gain * 100); + m_ym2151->set_output_gain(ALL_OUTPUTS, gain); /* bits 3-4 control the volume of the POKEYs, using 47k and 100k resistors */ rtop = 1.0/(1.0/100 + 1.0/100); @@ -637,16 +634,20 @@ WRITE8_MEMBER(atarisy2_state::mixer_w) if (!(data & 0x08)) rbott += 1.0/47; if (!(data & 0x10)) rbott += 1.0/22; gain = (rbott == 0) ? 1.0 : ((1.0/rbott) / (rtop + (1.0/rbott))); - set_pokey_volume(gain * 100); + m_pokey1->set_output_gain(ALL_OUTPUTS, gain); + m_pokey2->set_output_gain(ALL_OUTPUTS, gain); /* bits 5-7 control the volume of the TMS5220, using 22k, 47k, and 100k resistors */ - rtop = 1.0/(1.0/100 + 1.0/100); - rbott = 0; - if (!(data & 0x20)) rbott += 1.0/100; - if (!(data & 0x40)) rbott += 1.0/47; - if (!(data & 0x80)) rbott += 1.0/22; - gain = (rbott == 0) ? 1.0 : ((1.0/rbott) / (rtop + (1.0/rbott))); - set_tms5220_volume(gain * 100); + if (m_tms5220.found()) + { + rtop = 1.0/(1.0/100 + 1.0/100); + rbott = 0; + if (!(data & 0x20)) rbott += 1.0/100; + if (!(data & 0x40)) rbott += 1.0/47; + if (!(data & 0x80)) rbott += 1.0/22; + gain = (rbott == 0) ? 1.0 : ((1.0/rbott) / (rtop + (1.0/rbott))); + m_tms5220->set_output_gain(ALL_OUTPUTS, gain); + } } @@ -664,9 +665,9 @@ WRITE8_MEMBER(atarisy2_state::sound_reset_w) /* a large number of signals are reset when this happens */ m_soundcomm->reset(); machine().device("ymsnd")->reset(); - if (m_has_tms5220) + if (m_tms5220.found()) { - machine().device("tms")->reset(); // technically what happens is the tms5220 gets a long stream of 0xFF written to it when sound_reset_state is 0 which halts the chip after a few frames, but this works just as well, even if it isn't exactly true to hardware... The hardware may not have worked either, the resistors to pull input to 0xFF are fighting against the ls263 gate holding the latched value to be sent to the chip. + m_tms5220->reset(); // technically what happens is the tms5220 gets a long stream of 0xFF written to it when sound_reset_state is 0 which halts the chip after a few frames, but this works just as well, even if it isn't exactly true to hardware... The hardware may not have worked either, the resistors to pull input to 0xFF are fighting against the ls263 gate holding the latched value to be sent to the chip. } mixer_w(space, 0, 0); } @@ -714,17 +715,17 @@ READ8_MEMBER(atarisy2_state::sound_6502_r) WRITE8_MEMBER(atarisy2_state::tms5220_w) { - if (m_has_tms5220) + if (m_tms5220.found()) { - machine().device("tms")->data_w(space, 0, data); + m_tms5220->data_w(space, 0, data); } } WRITE8_MEMBER(atarisy2_state::tms5220_strobe_w) { - if (m_has_tms5220) + if (m_tms5220.found()) { - machine().device("tms")->wsq_w(1-(offset & 1)); + m_tms5220->wsq_w(1-(offset & 1)); } } @@ -3142,8 +3143,7 @@ DRIVER_INIT_MEMBER(atarisy2_state,paperboy) } m_pedal_count = 0; - m_has_tms5220 = 1; - machine().device("tms")->rsq_w(1); // /RS is tied high on sys2 hw + m_tms5220->rsq_w(1); // /RS is tied high on sys2 hw } @@ -3155,8 +3155,7 @@ DRIVER_INIT_MEMBER(atarisy2_state,720) m_slapstic->slapstic_init(machine(), 107); m_pedal_count = -1; - m_has_tms5220 = 1; - machine().device("tms")->rsq_w(1); // /RS is tied high on sys2 hw + m_tms5220->rsq_w(1); // /RS is tied high on sys2 hw } @@ -3172,7 +3171,6 @@ DRIVER_INIT_MEMBER(atarisy2_state,ssprint) memcpy(&cpu1[i + 0x10000], &cpu1[i], 0x10000); m_pedal_count = 3; - m_has_tms5220 = 0; } @@ -3188,7 +3186,6 @@ DRIVER_INIT_MEMBER(atarisy2_state,csprint) memcpy(&cpu1[i + 0x10000], &cpu1[i], 0x10000); m_pedal_count = 2; - m_has_tms5220 = 0; } @@ -3197,8 +3194,7 @@ DRIVER_INIT_MEMBER(atarisy2_state,apb) m_slapstic->slapstic_init(machine(), 110); m_pedal_count = 2; - m_has_tms5220 = 1; - machine().device("tms")->rsq_w(1); // /RS is tied high on sys2 hw + m_tms5220->rsq_w(1); // /RS is tied high on sys2 hw } diff --git a/src/mame/drivers/gauntlet.cpp b/src/mame/drivers/gauntlet.cpp index 3bf38312812..7c1839e7227 100644 --- a/src/mame/drivers/gauntlet.cpp +++ b/src/mame/drivers/gauntlet.cpp @@ -191,13 +191,12 @@ WRITE16_MEMBER(gauntlet_state::sound_reset_w) m_soundcomm->sound_cpu_reset(); if (m_sound_reset_val & 1) { - machine().device("ymsnd")->reset(); - tms5220_device *tms5220 = machine().device("tms"); - tms5220->reset(); - tms5220->set_frequency(ATARI_CLOCK_14MHz/2 / 11); - set_ym2151_volume(0); - set_pokey_volume(0); - set_tms5220_volume(0); + m_ym2151->reset(); + m_tms5220->reset(); + m_tms5220->set_frequency(ATARI_CLOCK_14MHz/2 / 11); + m_ym2151->set_output_gain(ALL_OUTPUTS, 0.0f); + m_pokey->set_output_gain(ALL_OUTPUTS, 0.0f); + m_tms5220->set_output_gain(ALL_OUTPUTS, 0.0f); } } } @@ -213,12 +212,11 @@ WRITE16_MEMBER(gauntlet_state::sound_reset_w) READ8_MEMBER(gauntlet_state::switch_6502_r) { - tms5220_device *tms5220 = machine().device("tms"); int temp = 0x30; if (m_soundcomm->main_to_sound_ready()) temp ^= 0x80; if (m_soundcomm->sound_to_main_ready()) temp ^= 0x40; - if (!tms5220->readyq_r()) temp ^= 0x20; + if (!m_tms5220->readyq_r()) temp ^= 0x20; if (!(ioport("803008")->read() & 0x0008)) temp ^= 0x10; return temp; @@ -233,24 +231,23 @@ READ8_MEMBER(gauntlet_state::switch_6502_r) WRITE8_MEMBER(gauntlet_state::sound_ctl_w) { - tms5220_device *tms5220 = machine().device("tms"); switch (offset & 7) { case 0: /* music reset, bit D7, low reset */ - if (((data>>7)&1) == 0) machine().device("ymsnd")->reset(); + if (((data>>7)&1) == 0) m_ym2151->reset(); break; case 1: /* speech write, bit D7, active low */ - tms5220->wsq_w(data >> 7); + m_tms5220->wsq_w(data >> 7); break; case 2: /* speech reset, bit D7, active low */ - tms5220->rsq_w(data >> 7); + m_tms5220->rsq_w(data >> 7); break; case 3: /* speech squeak, bit D7 */ data = 5 | ((data >> 6) & 2); - tms5220->set_frequency(ATARI_CLOCK_14MHz/2 / (16 - data)); + m_tms5220->set_frequency(ATARI_CLOCK_14MHz/2 / (16 - data)); break; } } @@ -265,9 +262,9 @@ WRITE8_MEMBER(gauntlet_state::sound_ctl_w) WRITE8_MEMBER(gauntlet_state::mixer_w) { - set_ym2151_volume((data & 7) * 100 / 7); - set_pokey_volume(((data >> 3) & 3) * 100 / 3); - set_tms5220_volume(((data >> 5) & 7) * 100 / 7); + m_ym2151->set_output_gain(ALL_OUTPUTS, (data & 7) / 7.0f); + m_pokey->set_output_gain(ALL_OUTPUTS, ((data >> 3) & 3) / 3.0f); + m_tms5220->set_output_gain(ALL_OUTPUTS, ((data >> 5) & 7) / 7.0f); } diff --git a/src/mame/drivers/rampart.cpp b/src/mame/drivers/rampart.cpp index 523650d5915..d8e38499191 100644 --- a/src/mame/drivers/rampart.cpp +++ b/src/mame/drivers/rampart.cpp @@ -105,12 +105,12 @@ WRITE16_MEMBER(rampart_state::latch_w) /* lower byte being modified? */ if (ACCESSING_BITS_0_7) { - set_oki6295_volume((data & 0x0020) ? 100 : 0); + m_oki->set_output_gain(ALL_OUTPUTS, (data & 0x0020) ? 1.0f : 0.0f); if (!(data & 0x0010)) m_oki->reset(); - set_ym2413_volume(((data >> 1) & 7) * 100 / 7); + m_ym2413->set_output_gain(ALL_OUTPUTS, ((data >> 1) & 7) / 7.0f); if (!(data & 0x0001)) - machine().device("ymsnd")->reset(); + m_ym2413->reset(); } } diff --git a/src/mame/drivers/relief.cpp b/src/mame/drivers/relief.cpp index b1ba6031cc9..82915064d71 100644 --- a/src/mame/drivers/relief.cpp +++ b/src/mame/drivers/relief.cpp @@ -84,7 +84,7 @@ WRITE16_MEMBER(relief_state::audio_control_w) if (ACCESSING_BITS_0_7) { m_ym2413_volume = (data >> 1) & 15; - set_ym2413_volume((m_ym2413_volume * m_overall_volume * 100) / (127 * 15)); + m_ym2413->set_output_gain(ALL_OUTPUTS, (m_ym2413_volume * m_overall_volume) / (127.0f * 15.0f)); m_adpcm_bank = ((data >> 6) & 3) | (m_adpcm_bank & 4); } if (ACCESSING_BITS_8_15) @@ -99,8 +99,8 @@ WRITE16_MEMBER(relief_state::audio_volume_w) if (ACCESSING_BITS_0_7) { m_overall_volume = data & 127; - set_ym2413_volume((m_ym2413_volume * m_overall_volume * 100) / (127 * 15)); - set_oki6295_volume(m_overall_volume * 100 / 127); + m_ym2413->set_output_gain(ALL_OUTPUTS, (m_ym2413_volume * m_overall_volume) / (127.0f * 15.0f)); + m_oki->set_output_gain(ALL_OUTPUTS, m_overall_volume / 127.0f); } } diff --git a/src/mame/includes/arcadecl.h b/src/mame/includes/arcadecl.h index 7a580d012c1..056875df906 100644 --- a/src/mame/includes/arcadecl.h +++ b/src/mame/includes/arcadecl.h @@ -8,15 +8,18 @@ #include "machine/atarigen.h" #include "video/atarimo.h" +#include "sound/okim6295.h" class arcadecl_state : public atarigen_state { public: arcadecl_state(const machine_config &mconfig, device_type type, const char *tag) : atarigen_state(mconfig, type, tag), + m_oki(*this, "oki"), m_mob(*this, "mob"), m_bitmap(*this, "bitmap") { } + required_device m_oki; optional_device m_mob; required_shared_ptr m_bitmap; diff --git a/src/mame/includes/atarisy1.h b/src/mame/includes/atarisy1.h index a2e27c24704..b90f10d3abe 100644 --- a/src/mame/includes/atarisy1.h +++ b/src/mame/includes/atarisy1.h @@ -15,6 +15,8 @@ class atarisy1_state : public atarigen_state public: atarisy1_state(const machine_config &mconfig, device_type type, const char *tag) : atarigen_state(mconfig, type, tag), + m_audiocpu(*this, "audiocpu"), + m_soundcomm(*this, "soundcomm"), m_bankselect(*this, "bankselect"), m_mob(*this, "mob"), m_joystick_timer(*this, "joystick_timer"), @@ -25,6 +27,9 @@ public: m_int3off_timer(*this, "int3off_timer"), m_tms(*this, "tms") { } + required_device m_audiocpu; + required_device m_soundcomm; + required_shared_ptr m_bankselect; required_device m_mob; diff --git a/src/mame/includes/atarisy2.h b/src/mame/includes/atarisy2.h index 21be1d85549..3fefb6a7130 100644 --- a/src/mame/includes/atarisy2.h +++ b/src/mame/includes/atarisy2.h @@ -10,6 +10,9 @@ #include "video/atarimo.h" #include "cpu/m6502/m6502.h" #include "cpu/t11/t11.h" +#include "sound/2151intf.h" +#include "sound/pokey.h" +#include "sound/tms5220.h" #include "slapstic.h" class atarisy2_state : public atarigen_state @@ -23,6 +26,11 @@ public: m_slapstic_base(*this, "slapstic_base"), m_playfield_tilemap(*this, "playfield"), m_alpha_tilemap(*this, "alpha"), + m_soundcomm(*this, "soundcomm"), + m_ym2151(*this, "ymsnd"), + m_pokey1(*this, "pokey1"), + m_pokey2(*this, "pokey2"), + m_tms5220(*this, "tms"), m_rombank1(*this, "rombank1"), m_rombank2(*this, "rombank2"), m_slapstic(*this, "slapstic") @@ -40,7 +48,11 @@ public: INT8 m_pedal_count; - UINT8 m_has_tms5220; + required_device m_soundcomm; + required_device m_ym2151; + required_device m_pokey1; + required_device m_pokey2; + optional_device m_tms5220; UINT8 m_which_adc; diff --git a/src/mame/includes/badlands.h b/src/mame/includes/badlands.h index dca560b4466..a23ec09a2c3 100644 --- a/src/mame/includes/badlands.h +++ b/src/mame/includes/badlands.h @@ -14,9 +14,14 @@ class badlands_state : public atarigen_state public: badlands_state(const machine_config &mconfig, device_type type, const char *tag) : atarigen_state(mconfig, type, tag), + m_audiocpu(*this, "audiocpu"), + m_soundcomm(*this, "soundcomm"), m_playfield_tilemap(*this, "playfield"), m_mob(*this, "mob") { } + optional_device m_audiocpu; + optional_device m_soundcomm; + required_device m_playfield_tilemap; required_device m_mob; diff --git a/src/mame/includes/cyberbal.h b/src/mame/includes/cyberbal.h index 0bc65bccb57..37508ad0581 100644 --- a/src/mame/includes/cyberbal.h +++ b/src/mame/includes/cyberbal.h @@ -24,6 +24,7 @@ public: m_daccpu(*this, "dac"), m_dac1(*this, "dac1"), m_dac2(*this, "dac2"), + m_soundcomm(*this, "soundcomm"), m_jsa(*this, "jsa"), m_playfield_tilemap(*this, "playfield"), m_alpha_tilemap(*this, "alpha"), @@ -40,6 +41,7 @@ public: optional_device m_daccpu; optional_device m_dac1; optional_device m_dac2; + optional_device m_soundcomm; optional_device m_jsa; required_device m_playfield_tilemap; required_device m_alpha_tilemap; diff --git a/src/mame/includes/gauntlet.h b/src/mame/includes/gauntlet.h index 685021ebaa8..c945d96b956 100644 --- a/src/mame/includes/gauntlet.h +++ b/src/mame/includes/gauntlet.h @@ -8,16 +8,30 @@ #include "machine/atarigen.h" #include "video/atarimo.h" +#include "sound/2151intf.h" +#include "sound/pokey.h" +#include "sound/tms5220.h" class gauntlet_state : public atarigen_state { public: gauntlet_state(const machine_config &mconfig, device_type type, const char *tag) : atarigen_state(mconfig, type, tag), + m_audiocpu(*this, "audiocpu"), + m_soundcomm(*this, "soundcomm"), + m_ym2151(*this, "ymsnd"), + m_pokey(*this, "pokey"), + m_tms5220(*this, "tms"), m_playfield_tilemap(*this, "playfield"), m_alpha_tilemap(*this, "alpha"), m_mob(*this, "mob") { } + required_device m_audiocpu; + required_device m_soundcomm; + required_device m_ym2151; + required_device m_pokey; + required_device m_tms5220; + required_device m_playfield_tilemap; required_device m_alpha_tilemap; required_device m_mob; diff --git a/src/mame/includes/rampart.h b/src/mame/includes/rampart.h index d7e62bc9b39..964befa8056 100644 --- a/src/mame/includes/rampart.h +++ b/src/mame/includes/rampart.h @@ -8,6 +8,7 @@ #include "machine/atarigen.h" #include "sound/okim6295.h" +#include "sound/2413intf.h" #include "video/atarimo.h" class rampart_state : public atarigen_state @@ -17,10 +18,12 @@ public: : atarigen_state(mconfig, type, tag), m_mob(*this, "mob"), m_oki(*this, "oki"), + m_ym2413(*this, "ymsnd"), m_bitmap(*this, "bitmap") { } required_device m_mob; required_device m_oki; + required_device m_ym2413; required_shared_ptr m_bitmap; diff --git a/src/mame/includes/relief.h b/src/mame/includes/relief.h index cae4ad37e3d..7d80ef07569 100644 --- a/src/mame/includes/relief.h +++ b/src/mame/includes/relief.h @@ -8,6 +8,8 @@ #include "machine/atarigen.h" #include "video/atarimo.h" +#include "sound/okim6295.h" +#include "sound/2413intf.h" class relief_state : public atarigen_state { @@ -15,10 +17,14 @@ public: relief_state(const machine_config &mconfig, device_type type, const char *tag) : atarigen_state(mconfig, type, tag), m_vad(*this, "vad"), + m_oki(*this, "oki"), + m_ym2413(*this, "ymsnd"), m_okibank(*this, "okibank") { } required_device m_vad; + required_device m_oki; + required_device m_ym2413; required_memory_bank m_okibank; UINT8 m_ym2413_volume; diff --git a/src/mame/machine/atarigen.cpp b/src/mame/machine/atarigen.cpp index 287342585f6..90d422f6c25 100644 --- a/src/mame/machine/atarigen.cpp +++ b/src/mame/machine/atarigen.cpp @@ -10,11 +10,6 @@ #include "emu.h" #include "cpu/m6502/m6502.h" -#include "sound/2151intf.h" -#include "sound/2413intf.h" -#include "sound/tms5220.h" -#include "sound/okim6295.h" -#include "sound/pokey.h" #include "video/atarimo.h" #include "atarigen.h" @@ -965,9 +960,6 @@ atarigen_state::atarigen_state(const machine_config &mconfig, device_type type, m_slapstic_mirror(0), m_scanlines_per_callback(0), m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_oki(*this, "oki"), - m_soundcomm(*this, "soundcomm"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), @@ -1291,57 +1283,6 @@ READ16_MEMBER(atarigen_state::slapstic_r) -/*************************************************************************** - SOUND HELPERS -***************************************************************************/ - -//------------------------------------------------- -// set_volume_by_type: Scans for a particular -// sound chip and changes the volume on all -// channels associated with it. -//------------------------------------------------- - -void atarigen_state::set_volume_by_type(int volume, device_type type) -{ - sound_interface_iterator iter(*this); - for (device_sound_interface *sound = iter.first(); sound != nullptr; sound = iter.next()) - if (sound->device().type() == type) - sound->set_output_gain(ALL_OUTPUTS, volume / 100.0); -} - - -//------------------------------------------------- -// set_XXXXX_volume: Sets the volume for a given -// type of chip. -//------------------------------------------------- - -void atarigen_state::set_ym2151_volume(int volume) -{ - set_volume_by_type(volume, YM2151); -} - -void atarigen_state::set_ym2413_volume(int volume) -{ - set_volume_by_type(volume, YM2413); -} - -void atarigen_state::set_pokey_volume(int volume) -{ - set_volume_by_type(volume, POKEY); -} - -void atarigen_state::set_tms5220_volume(int volume) -{ - set_volume_by_type(volume, TMS5220); -} - -void atarigen_state::set_oki6295_volume(int volume) -{ - set_volume_by_type(volume, OKIM6295); -} - - - /*************************************************************************** SCANLINE TIMING ***************************************************************************/ diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h index 0adeb414a0b..c618e5b3d07 100644 --- a/src/mame/machine/atarigen.h +++ b/src/mame/machine/atarigen.h @@ -14,7 +14,6 @@ #include "machine/eeprompar.h" #include "video/atarimo.h" #include "cpu/m6502/m6502.h" -#include "sound/okim6295.h" #include "includes/slapstic.h" @@ -362,14 +361,6 @@ public: DECLARE_WRITE16_MEMBER(slapstic_w); DECLARE_READ16_MEMBER(slapstic_r); - // sound helpers - void set_volume_by_type(int volume, device_type type); - void set_ym2151_volume(int volume); - void set_ym2413_volume(int volume); - void set_pokey_volume(int volume); - void set_tms5220_volume(int volume); - void set_oki6295_volume(int volume); - // scanline timing void scanline_timer_reset(screen_device &screen, int frequency); void scanline_timer(emu_timer &timer, screen_device &screen, int scanline); @@ -412,10 +403,7 @@ public: atarigen_screen_timer m_screen_timer[2]; required_device m_maincpu; - optional_device m_audiocpu; - optional_device m_oki; - optional_device m_soundcomm; optional_device m_gfxdecode; optional_device m_screen; optional_device m_palette; -- cgit v1.2.3-70-g09d2 From bd754ed6f22111c087189ba4e3ecb76c5d2cc1a3 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Fri, 29 Jan 2016 15:54:49 -0500 Subject: Fix F3 soft-reset on Arkanoid sets with MCU [Lord Nightmare] --- src/mame/drivers/arkanoid.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mame/drivers/arkanoid.cpp b/src/mame/drivers/arkanoid.cpp index 03dedcd5c4d..09318ad84eb 100644 --- a/src/mame/drivers/arkanoid.cpp +++ b/src/mame/drivers/arkanoid.cpp @@ -1283,8 +1283,7 @@ void arkanoid_state::machine_reset() // the following 3 are all part of the 74ls74 at ic26 and are cleared on reset m_z80HasWritten = 0; m_68705HasWritten = 0; - //if (m_bootleg_id == 0) m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE); // arkatayt will crash if this line is uncommented, but without this line present, arkanoid will watchdog-reset itself as soon as a level starts after pressing f3/soft reset. - // TODO: this can be better dealt with by having a separate machine_reset function for the mculess vs mcu sets. + if (m_mcu.found()) m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE); m_port_a_in = 0; m_port_a_out = 0; -- cgit v1.2.3-70-g09d2 From 99fb3c0c22ad8f4f1fb481079220fb4d8c641a91 Mon Sep 17 00:00:00 2001 From: briantro Date: Fri, 29 Jan 2016 22:04:54 -0600 Subject: segas16b.cpp: Minor doc update - NW --- src/mame/drivers/segas16b.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp index aa15bad1857..dfb04f270a3 100644 --- a/src/mame/drivers/segas16b.cpp +++ b/src/mame/drivers/segas16b.cpp @@ -7143,6 +7143,7 @@ ROM_END // Sonic Boom, Sega System 16B // CPU: FD1094 (317-0053) // ROM Board type: 171-5358 +// Sega ID# for ROM board: 834-6532-01 // // Pos. Silk Type Part Pos. Silk Type Part // -- cgit v1.2.3-70-g09d2 From 048fd105db8dec41dd3340555d27b2288a32e51f Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Fri, 29 Jan 2016 22:41:21 -0700 Subject: osdmini: fixes build issues --- scripts/src/osd/osdmini.lua | 1 + scripts/src/osd/osdmini_cfg.lua | 2 ++ src/osd/osdmini/minimisc.cpp | 4 +--- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/src/osd/osdmini.lua b/scripts/src/osd/osdmini.lua index 803b7413014..0795ccdb4bd 100644 --- a/scripts/src/osd/osdmini.lua +++ b/scripts/src/osd/osdmini.lua @@ -79,6 +79,7 @@ project ("osd_" .. _OPTIONS["osd"]) MAME_DIR .. "src/osd/modules/sound/coreaudio_sound.cpp", MAME_DIR .. "src/osd/modules/sound/sdl_sound.cpp", MAME_DIR .. "src/osd/modules/sound/none.cpp", + MAME_DIR .. "src/osd/modules/sound/xaudio2_sound.cpp", } project ("ocore_" .. _OPTIONS["osd"]) diff --git a/scripts/src/osd/osdmini_cfg.lua b/scripts/src/osd/osdmini_cfg.lua index ff9539066b2..586075d3cac 100644 --- a/scripts/src/osd/osdmini_cfg.lua +++ b/scripts/src/osd/osdmini_cfg.lua @@ -7,4 +7,6 @@ defines { "USE_SDL", "SDLMAME_NOASM=1", "USE_OPENGL=0", + "NO_USE_MIDI=1", + "USE_XAUDIO2=0", } diff --git a/src/osd/osdmini/minimisc.cpp b/src/osd/osdmini/minimisc.cpp index 2bf613b0b7c..9891447359b 100644 --- a/src/osd/osdmini/minimisc.cpp +++ b/src/osd/osdmini/minimisc.cpp @@ -103,11 +103,9 @@ int osd_setenv(const char *name, const char *value, int overwrite) //============================================================ // osd_subst_env //============================================================ -int osd_subst_env(char **dst, const char *src) +void osd_subst_env(char **dst, const char *src) { *dst = (char *)osd_malloc_array(strlen(src) + 1); if (*dst != nullptr) strcpy(*dst, src); - - return 0; } -- cgit v1.2.3-70-g09d2 From 8403f5b234b937a8d1fba614c27be51a7823016a Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 30 Jan 2016 01:24:08 -0500 Subject: One small step toward slapstic modernization (nw) - Make chip number part of device configuration, not init param - Correct mainpcb slapstic number in racedrivpan - Remove many unused slapstics - Hopefully no regressions --- src/mame/drivers/atarig1.cpp | 94 ++++++++++++++++++++++----------- src/mame/drivers/atarisy1.cpp | 111 +++++++++++++++++++++----------------- src/mame/drivers/atarisy2.cpp | 120 +++++++++++++++++++++++++----------------- src/mame/drivers/atetris.cpp | 6 +-- src/mame/drivers/cyberbal.cpp | 31 ++++------- src/mame/drivers/gauntlet.cpp | 73 +++++++++++++------------ src/mame/drivers/harddriv.cpp | 22 +++++--- src/mame/drivers/rampart.cpp | 4 +- src/mame/drivers/starwars.cpp | 11 ++-- src/mame/drivers/xybots.cpp | 4 +- src/mame/includes/atarig1.h | 4 -- src/mame/includes/atarisy1.h | 3 +- src/mame/includes/cyberbal.h | 2 - src/mame/includes/gauntlet.h | 4 +- src/mame/includes/slapstic.h | 22 ++++++-- src/mame/machine/atarigen.cpp | 53 ++++++++----------- src/mame/machine/atarigen.h | 2 +- src/mame/machine/harddriv.cpp | 32 +++++------ src/mame/machine/slapstic.cpp | 19 +++---- 19 files changed, 344 insertions(+), 273 deletions(-) diff --git a/src/mame/drivers/atarig1.cpp b/src/mame/drivers/atarig1.cpp index a3ad029f96b..b060c183f77 100644 --- a/src/mame/drivers/atarig1.cpp +++ b/src/mame/drivers/atarig1.cpp @@ -428,8 +428,6 @@ static MACHINE_CONFIG_START( atarig1, atarig1_state ) MCFG_CPU_PROGRAM_MAP(main_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen) - MCFG_SLAPSTIC_ADD("slapstic") - MCFG_MACHINE_START_OVERRIDE(atarig1_state,atarig1) MCFG_MACHINE_RESET_OVERRIDE(atarig1_state,atarig1) @@ -461,12 +459,44 @@ static MACHINE_CONFIG_START( atarig1, atarig1_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( hydra, atarig1 ) MCFG_ATARIRLE_ADD("rle", modesc_hydra) + MCFG_SLAPSTIC_ADD("slapstic", 116) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( hydrap, hydra ) + MCFG_DEVICE_REMOVE("slapstic") MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pitfight9, atarig1 ) + MCFG_ATARIRLE_ADD("rle", modesc_pitfight) + MCFG_SLAPSTIC_ADD("slapstic", 114) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( pitfight7, atarig1 ) + MCFG_ATARIRLE_ADD("rle", modesc_pitfight) + MCFG_SLAPSTIC_ADD("slapstic", 112) +MACHINE_CONFIG_END + + static MACHINE_CONFIG_DERIVED( pitfight, atarig1 ) MCFG_ATARIRLE_ADD("rle", modesc_pitfight) + MCFG_SLAPSTIC_ADD("slapstic", 111) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( pitfightj, atarig1 ) + MCFG_ATARIRLE_ADD("rle", modesc_pitfight) + MCFG_SLAPSTIC_ADD("slapstic", 113) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( pitfightb, atarig1 ) + MCFG_ATARIRLE_ADD("rle", modesc_pitfight) MACHINE_CONFIG_END @@ -1198,28 +1228,30 @@ ROM_END * *************************************/ -void atarig1_state::init_common(offs_t slapstic_base, int slapstic, bool is_pitfight) +DRIVER_INIT_MEMBER(atarig1_state,hydra) { - if (slapstic == -1) - { - pitfightb_cheap_slapstic_init(); - save_item(NAME(m_bslapstic_bank)); - save_item(NAME(m_bslapstic_primed)); - } - else if (slapstic != 0) - slapstic_configure(*m_maincpu, slapstic_base, 0, slapstic); + slapstic_configure(*m_maincpu, 0x078000, 0); + m_is_pitfight = 0; +} - m_is_pitfight = is_pitfight; +DRIVER_INIT_MEMBER(atarig1_state,hydrap) +{ + m_is_pitfight = 0; } -DRIVER_INIT_MEMBER(atarig1_state,hydra) { init_common(0x078000, 116, 0); } -DRIVER_INIT_MEMBER(atarig1_state,hydrap) { init_common(0x000000, 0, 0); } +DRIVER_INIT_MEMBER(atarig1_state,pitfight) +{ + slapstic_configure(*m_maincpu, 0x038000, 0); + m_is_pitfight = 1; +} -DRIVER_INIT_MEMBER(atarig1_state,pitfight9) { init_common(0x038000, 114, 1); } -DRIVER_INIT_MEMBER(atarig1_state,pitfight7) { init_common(0x038000, 112, 1); } -DRIVER_INIT_MEMBER(atarig1_state,pitfight) { init_common(0x038000, 111, 1); } -DRIVER_INIT_MEMBER(atarig1_state,pitfightj) { init_common(0x038000, 113, 1); } -DRIVER_INIT_MEMBER(atarig1_state,pitfightb) { init_common(0x038000, -1, 1); } +DRIVER_INIT_MEMBER(atarig1_state,pitfightb) +{ + pitfightb_cheap_slapstic_init(); + save_item(NAME(m_bslapstic_bank)); + save_item(NAME(m_bslapstic_primed)); + m_is_pitfight = 1; +} /************************************* @@ -1228,15 +1260,15 @@ DRIVER_INIT_MEMBER(atarig1_state,pitfightb) { init_common(0x038000, -1, 1); } * *************************************/ -GAME( 1990, hydra, 0, hydra, hydra, atarig1_state, hydra, ROT0, "Atari Games", "Hydra", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, hydrap, hydra, hydra, hydra, atarig1_state, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/14/90)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, hydrap2, hydra, hydra, hydra, atarig1_state, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/25/90)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1990, pitfight, 0, pitfight, pitfight, atarig1_state, pitfight9, ROT0, "Atari Games", "Pit Fighter (rev 9)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, pitfight7, pitfight, pitfight, pitfight, atarig1_state, pitfight7, ROT0, "Atari Games", "Pit Fighter (rev 7)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, pitfight6, pitfight, pitfight, pitfight, atarig1_state, pitfightj, ROT0, "Atari Games", "Pit Fighter (rev 6)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, pitfight5, pitfight, pitfight, pitfight, atarig1_state, pitfight7, ROT0, "Atari Games", "Pit Fighter (rev 5)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, pitfight4, pitfight, pitfight, pitfight, atarig1_state, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, pitfight3, pitfight, pitfight, pitfight, atarig1_state, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, pitfightj, pitfight, pitfight, pitfightj, atarig1_state,pitfightj, ROT0, "Atari Games", "Pit Fighter (Japan, 2 players)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, pitfightb, pitfight, pitfight, pitfight, atarig1_state, pitfightb, ROT0, "bootleg", "Pit Fighter (bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, hydra, 0, hydra, hydra, atarig1_state, hydra, ROT0, "Atari Games", "Hydra", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, hydrap, hydra, hydrap, hydra, atarig1_state, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/14/90)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, hydrap2, hydra, hydrap, hydra, atarig1_state, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/25/90)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1990, pitfight, 0, pitfight9, pitfight, atarig1_state, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 9)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, pitfight7, pitfight, pitfight7, pitfight, atarig1_state, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 7)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, pitfight6, pitfight, pitfightj, pitfight, atarig1_state, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 6)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, pitfight5, pitfight, pitfight7, pitfight, atarig1_state, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 5)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, pitfight4, pitfight, pitfight, pitfight, atarig1_state, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, pitfight3, pitfight, pitfight, pitfight, atarig1_state, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, pitfightj, pitfight, pitfightj, pitfightj, atarig1_state,pitfight, ROT0, "Atari Games", "Pit Fighter (Japan, 2 players)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, pitfightb, pitfight, pitfightb, pitfight, atarig1_state, pitfightb, ROT0, "bootleg", "Pit Fighter (bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/atarisy1.cpp b/src/mame/drivers/atarisy1.cpp index bc643691371..faf9e1d9562 100644 --- a/src/mame/drivers/atarisy1.cpp +++ b/src/mame/drivers/atarisy1.cpp @@ -713,8 +713,6 @@ static MACHINE_CONFIG_START( atarisy1, atarisy1_state ) MCFG_CPU_PROGRAM_MAP(main_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen) - MCFG_SLAPSTIC_ADD("slapstic") - MCFG_CPU_ADD("audiocpu", M6502, ATARI_CLOCK_14MHz/8) MCFG_CPU_PROGRAM_MAP(sound_map) @@ -775,6 +773,30 @@ static MACHINE_CONFIG_START( atarisy1, atarisy1_state ) MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(atarisy1_state, via_pb_w)) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( marble, atarisy1 ) + MCFG_SLAPSTIC_ADD("slapstic", 103) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( peterpak, atarisy1 ) + MCFG_SLAPSTIC_ADD("slapstic", 107) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( indytemp, atarisy1 ) + MCFG_SLAPSTIC_ADD("slapstic", 105) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( roadrunn, atarisy1 ) + MCFG_SLAPSTIC_ADD("slapstic", 108) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( roadb109, atarisy1 ) + MCFG_SLAPSTIC_ADD("slapstic", 109) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( roadb110, atarisy1 ) + MCFG_SLAPSTIC_ADD("slapstic", 110) +MACHINE_CONFIG_END + /************************************* @@ -2405,7 +2427,7 @@ ROM_END DRIVER_INIT_MEMBER(atarisy1_state,marble) { - slapstic_configure(*m_maincpu, 0x080000, 0, 103); + slapstic_configure(*m_maincpu, 0x080000, 0); m_joystick_type = 0; /* none */ m_trackball_type = 1; /* rotated */ @@ -2414,7 +2436,7 @@ DRIVER_INIT_MEMBER(atarisy1_state,marble) DRIVER_INIT_MEMBER(atarisy1_state,peterpak) { - slapstic_configure(*m_maincpu, 0x080000, 0, 107); + slapstic_configure(*m_maincpu, 0x080000, 0); m_joystick_type = 1; /* digital */ m_trackball_type = 0; /* none */ @@ -2423,7 +2445,7 @@ DRIVER_INIT_MEMBER(atarisy1_state,peterpak) DRIVER_INIT_MEMBER(atarisy1_state,indytemp) { - slapstic_configure(*m_maincpu, 0x080000, 0, 105); + slapstic_configure(*m_maincpu, 0x080000, 0); m_joystick_type = 1; /* digital */ m_trackball_type = 0; /* none */ @@ -2432,25 +2454,16 @@ DRIVER_INIT_MEMBER(atarisy1_state,indytemp) DRIVER_INIT_MEMBER(atarisy1_state,roadrunn) { - slapstic_configure(*m_maincpu, 0x080000, 0, 108); + slapstic_configure(*m_maincpu, 0x080000, 0); m_joystick_type = 2; /* analog */ m_trackball_type = 0; /* none */ } -DRIVER_INIT_MEMBER(atarisy1_state,roadb109) -{ - slapstic_configure(*m_maincpu, 0x080000, 0, 109); - - m_joystick_type = 3; /* pedal */ - m_trackball_type = 2; /* steering wheel */ -} - - -DRIVER_INIT_MEMBER(atarisy1_state,roadb110) +DRIVER_INIT_MEMBER(atarisy1_state,roadblst) { - slapstic_configure(*m_maincpu, 0x080000, 0, 110); + slapstic_configure(*m_maincpu, 0x080000, 0); m_joystick_type = 3; /* pedal */ m_trackball_type = 2; /* steering wheel */ @@ -2464,35 +2477,35 @@ DRIVER_INIT_MEMBER(atarisy1_state,roadb110) * *************************************/ -GAME( 1984, atarisy1, 0, atarisy1, peterpak, atarisy1_state, peterpak, ROT0, "Atari Games", "Atari System 1 BIOS", MACHINE_IS_BIOS_ROOT ) - -GAME( 1984, marble, atarisy1, atarisy1, marble, atarisy1_state, marble, ROT0, "Atari Games", "Marble Madness (set 1)", 0 ) -GAME( 1984, marble2, marble, atarisy1, marble, atarisy1_state, marble, ROT0, "Atari Games", "Marble Madness (set 2)", 0 ) -GAME( 1984, marble3, marble, atarisy1, marble, atarisy1_state, marble, ROT0, "Atari Games", "Marble Madness (set 3)", 0 ) -GAME( 1984, marble4, marble, atarisy1, marble, atarisy1_state, marble, ROT0, "Atari Games", "Marble Madness (set 4)", 0 ) -GAME( 1984, marble5, marble, atarisy1, marble, atarisy1_state, marble, ROT0, "Atari Games", "Marble Madness (set 5 - LSI Cartridge)", 0 ) - -GAME( 1984, peterpak, atarisy1, atarisy1, peterpak, atarisy1_state, peterpak, ROT0, "Atari Games", "Peter Pack-Rat", 0 ) - -GAME( 1985, indytemp, atarisy1, atarisy1, indytemp, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (set 1)", 0 ) -GAME( 1985, indytemp2,indytemp, atarisy1, indytemp, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (set 2)", 0 ) -GAME( 1985, indytemp3,indytemp, atarisy1, indytemp, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (set 3)", 0 ) -GAME( 1985, indytemp4,indytemp, atarisy1, indytemp, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (set 4)", 0 ) -GAME( 1985, indytempd,indytemp, atarisy1, indytemp, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (German)", 0 ) -GAME( 1985, indytempc,indytemp, atarisy1, indytemc, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (Cocktail)", MACHINE_IMPERFECT_GRAPHICS ) - -GAME( 1985, roadrunn, atarisy1, atarisy1, roadrunn, atarisy1_state, roadrunn, ROT0, "Atari Games", "Road Runner (rev 2)", 0 ) -GAME( 1985, roadrunn2,roadrunn, atarisy1, roadrunn, atarisy1_state, roadrunn, ROT0, "Atari Games", "Road Runner (rev 1+)", 0 ) -GAME( 1985, roadrunn1,roadrunn, atarisy1, roadrunn, atarisy1_state, roadrunn, ROT0, "Atari Games", "Road Runner (rev 1)", 0 ) - -GAME( 1987, roadblst, atarisy1, atarisy1, roadblst, atarisy1_state, roadb110, ROT0, "Atari Games", "Road Blasters (upright, rev 4)", 0 ) -GAME( 1987, roadblstg, roadblst, atarisy1, roadblst, atarisy1_state, roadb109, ROT0, "Atari Games", "Road Blasters (upright, German, rev 3)", 0 ) -GAME( 1987, roadblst3, roadblst, atarisy1, roadblst, atarisy1_state, roadb109, ROT0, "Atari Games", "Road Blasters (upright, rev 3)", 0 ) -GAME( 1987, roadblstg2, roadblst, atarisy1, roadblst, atarisy1_state, roadb110, ROT0, "Atari Games", "Road Blasters (upright, German, rev 2)", 0 ) -GAME( 1987, roadblst2, roadblst, atarisy1, roadblst, atarisy1_state, roadb110, ROT0, "Atari Games", "Road Blasters (upright, rev 2)", 0 ) -GAME( 1987, roadblstg1, roadblst, atarisy1, roadblst, atarisy1_state, roadb109, ROT0, "Atari Games", "Road Blasters (upright, German, rev 1)", 0 ) -GAME( 1987, roadblst1, roadblst, atarisy1, roadblst, atarisy1_state, roadb109, ROT0, "Atari Games", "Road Blasters (upright, rev 1)", 0 ) -GAME( 1987, roadblstc, roadblst, atarisy1, roadblst, atarisy1_state, roadb110, ROT0, "Atari Games", "Road Blasters (cockpit, rev 2)", 0 ) -GAME( 1987, roadblstcg, roadblst, atarisy1, roadblst, atarisy1_state, roadb109, ROT0, "Atari Games", "Road Blasters (cockpit, German, rev 1)", MACHINE_IMPERFECT_GRAPHICS ) -GAME( 1987, roadblstc1, roadblst, atarisy1, roadblst, atarisy1_state, roadb109, ROT0, "Atari Games", "Road Blasters (cockpit, rev 1)", MACHINE_IMPERFECT_GRAPHICS ) -GAME( 1987, roadblstgu, roadblst, atarisy1, roadblst, atarisy1_state, roadb109, ROT0, "Atari Games", "Road Blasters (upright, German, rev ?)", 0 ) +GAME( 1984, atarisy1, 0, peterpak, peterpak, atarisy1_state, peterpak, ROT0, "Atari Games", "Atari System 1 BIOS", MACHINE_IS_BIOS_ROOT ) + +GAME( 1984, marble, atarisy1, marble, marble, atarisy1_state, marble, ROT0, "Atari Games", "Marble Madness (set 1)", 0 ) +GAME( 1984, marble2, marble, marble, marble, atarisy1_state, marble, ROT0, "Atari Games", "Marble Madness (set 2)", 0 ) +GAME( 1984, marble3, marble, marble, marble, atarisy1_state, marble, ROT0, "Atari Games", "Marble Madness (set 3)", 0 ) +GAME( 1984, marble4, marble, marble, marble, atarisy1_state, marble, ROT0, "Atari Games", "Marble Madness (set 4)", 0 ) +GAME( 1984, marble5, marble, marble, marble, atarisy1_state, marble, ROT0, "Atari Games", "Marble Madness (set 5 - LSI Cartridge)", 0 ) + +GAME( 1984, peterpak, atarisy1, peterpak, peterpak, atarisy1_state, peterpak, ROT0, "Atari Games", "Peter Pack-Rat", 0 ) + +GAME( 1985, indytemp, atarisy1, indytemp, indytemp, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (set 1)", 0 ) +GAME( 1985, indytemp2,indytemp, indytemp, indytemp, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (set 2)", 0 ) +GAME( 1985, indytemp3,indytemp, indytemp, indytemp, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (set 3)", 0 ) +GAME( 1985, indytemp4,indytemp, indytemp, indytemp, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (set 4)", 0 ) +GAME( 1985, indytempd,indytemp, indytemp, indytemp, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (German)", 0 ) +GAME( 1985, indytempc,indytemp, indytemp, indytemc, atarisy1_state, indytemp, ROT0, "Atari Games", "Indiana Jones and the Temple of Doom (Cocktail)", MACHINE_IMPERFECT_GRAPHICS ) + +GAME( 1985, roadrunn, atarisy1, roadrunn, roadrunn, atarisy1_state, roadrunn, ROT0, "Atari Games", "Road Runner (rev 2)", 0 ) +GAME( 1985, roadrunn2,roadrunn, roadrunn, roadrunn, atarisy1_state, roadrunn, ROT0, "Atari Games", "Road Runner (rev 1+)", 0 ) +GAME( 1985, roadrunn1,roadrunn, roadrunn, roadrunn, atarisy1_state, roadrunn, ROT0, "Atari Games", "Road Runner (rev 1)", 0 ) + +GAME( 1987, roadblst, atarisy1, roadb110, roadblst, atarisy1_state, roadblst, ROT0, "Atari Games", "Road Blasters (upright, rev 4)", 0 ) +GAME( 1987, roadblstg, roadblst, roadb109, roadblst, atarisy1_state, roadblst, ROT0, "Atari Games", "Road Blasters (upright, German, rev 3)", 0 ) +GAME( 1987, roadblst3, roadblst, roadb109, roadblst, atarisy1_state, roadblst, ROT0, "Atari Games", "Road Blasters (upright, rev 3)", 0 ) +GAME( 1987, roadblstg2, roadblst, roadb110, roadblst, atarisy1_state, roadblst, ROT0, "Atari Games", "Road Blasters (upright, German, rev 2)", 0 ) +GAME( 1987, roadblst2, roadblst, roadb110, roadblst, atarisy1_state, roadblst, ROT0, "Atari Games", "Road Blasters (upright, rev 2)", 0 ) +GAME( 1987, roadblstg1, roadblst, roadb109, roadblst, atarisy1_state, roadblst, ROT0, "Atari Games", "Road Blasters (upright, German, rev 1)", 0 ) +GAME( 1987, roadblst1, roadblst, roadb109, roadblst, atarisy1_state, roadblst, ROT0, "Atari Games", "Road Blasters (upright, rev 1)", 0 ) +GAME( 1987, roadblstc, roadblst, roadb110, roadblst, atarisy1_state, roadblst, ROT0, "Atari Games", "Road Blasters (cockpit, rev 2)", 0 ) +GAME( 1987, roadblstcg, roadblst, roadb109, roadblst, atarisy1_state, roadblst, ROT0, "Atari Games", "Road Blasters (cockpit, German, rev 1)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1987, roadblstc1, roadblst, roadb109, roadblst, atarisy1_state, roadblst, ROT0, "Atari Games", "Road Blasters (cockpit, rev 1)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1987, roadblstgu, roadblst, roadb109, roadblst, atarisy1_state, roadblst, ROT0, "Atari Games", "Road Blasters (upright, German, rev ?)", 0 ) diff --git a/src/mame/drivers/atarisy2.cpp b/src/mame/drivers/atarisy2.cpp index 4fa506ddb52..72161c4ca03 100644 --- a/src/mame/drivers/atarisy2.cpp +++ b/src/mame/drivers/atarisy2.cpp @@ -1194,8 +1194,6 @@ static MACHINE_CONFIG_START( atarisy2, atarisy2_state ) MCFG_CPU_PROGRAM_MAP(sound_map) MCFG_DEVICE_PERIODIC_INT_DEVICE("soundcomm", atari_sound_comm_device, sound_irq_gen, (double)MASTER_CLOCK/2/16/16/16/10) - MCFG_SLAPSTIC_ADD("slapstic") - MCFG_MACHINE_START_OVERRIDE(atarisy2_state,atarisy2) MCFG_MACHINE_RESET_OVERRIDE(atarisy2_state,atarisy2) @@ -1241,15 +1239,42 @@ static MACHINE_CONFIG_START( atarisy2, atarisy2_state ) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( sprint, atarisy2 ) +static MACHINE_CONFIG_DERIVED( paperboy, atarisy2 ) + MCFG_SLAPSTIC_ADD("slapstic", 105) +MACHINE_CONFIG_END - /* basic machine hardware */ + +static MACHINE_CONFIG_DERIVED( 720, atarisy2 ) + /* without the default EEPROM, 720 hangs at startup due to communication + issues with the sound CPU; temporarily increasing the sound CPU frequency + to ~2.2MHz "fixes" the problem */ + + MCFG_SLAPSTIC_ADD("slapstic", 107) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ssprint, atarisy2 ) + MCFG_SLAPSTIC_ADD("slapstic", 108) + + /* sound hardware */ + MCFG_DEVICE_REMOVE("tms") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( csprint, atarisy2 ) + MCFG_SLAPSTIC_ADD("slapstic", 109) /* sound hardware */ MCFG_DEVICE_REMOVE("tms") MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( apb, atarisy2 ) + MCFG_SLAPSTIC_ADD("slapstic", 110) +MACHINE_CONFIG_END + + + /************************************* * @@ -3132,7 +3157,7 @@ DRIVER_INIT_MEMBER(atarisy2_state,paperboy) int i; UINT8 *cpu1 = memregion("maincpu")->base(); - m_slapstic->slapstic_init(machine(), 105); + m_slapstic->slapstic_init(); /* expand the 16k program ROMs into full 64k chunks */ for (i = 0x10000; i < 0x90000; i += 0x20000) @@ -3149,10 +3174,7 @@ DRIVER_INIT_MEMBER(atarisy2_state,paperboy) DRIVER_INIT_MEMBER(atarisy2_state,720) { - /* without the default EEPROM, 720 hangs at startup due to communication - issues with the sound CPU; temporarily increasing the sound CPU frequency - to ~2.2MHz "fixes" the problem */ - m_slapstic->slapstic_init(machine(), 107); + m_slapstic->slapstic_init(); m_pedal_count = -1; m_tms5220->rsq_w(1); // /RS is tied high on sys2 hw @@ -3164,7 +3186,7 @@ DRIVER_INIT_MEMBER(atarisy2_state,ssprint) int i; UINT8 *cpu1 = memregion("maincpu")->base(); - m_slapstic->slapstic_init(machine(), 108); + m_slapstic->slapstic_init(); /* expand the 32k program ROMs into full 64k chunks */ for (i = 0x10000; i < 0x90000; i += 0x20000) @@ -3179,7 +3201,7 @@ DRIVER_INIT_MEMBER(atarisy2_state,csprint) int i; UINT8 *cpu1 = memregion("maincpu")->base(); - m_slapstic->slapstic_init(machine(), 109); + m_slapstic->slapstic_init(); /* expand the 32k program ROMs into full 64k chunks */ for (i = 0x10000; i < 0x90000; i += 0x20000) @@ -3191,7 +3213,7 @@ DRIVER_INIT_MEMBER(atarisy2_state,csprint) DRIVER_INIT_MEMBER(atarisy2_state,apb) { - m_slapstic->slapstic_init(machine(), 110); + m_slapstic->slapstic_init(); m_pedal_count = 2; m_tms5220->rsq_w(1); // /RS is tied high on sys2 hw @@ -3205,40 +3227,40 @@ DRIVER_INIT_MEMBER(atarisy2_state,apb) * *************************************/ -GAME( 1984, paperboy, 0, atarisy2, paperboy, atarisy2_state, paperboy, ROT0, "Atari Games", "Paperboy (rev 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, paperboyr2,paperboy, atarisy2, paperboy, atarisy2_state, paperboy, ROT0, "Atari Games", "Paperboy (rev 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, paperboyr1,paperboy, atarisy2, paperboy, atarisy2_state, paperboy, ROT0, "Atari Games", "Paperboy (rev 1)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1986, 720, 0, atarisy2, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (rev 4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, 720r3, 720, atarisy2, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (rev 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, 720r2, 720, atarisy2, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (rev 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, 720r1, 720, atarisy2, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (rev 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, 720g, 720, atarisy2, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (German, rev 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, 720gr1, 720, atarisy2, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (German, rev 1)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1986, ssprint, 0, sprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (rev 4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, ssprint3, ssprint, sprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (rev 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, ssprint1, ssprint, sprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (rev 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, ssprintg, ssprint, sprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (German, rev 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, ssprintg1,ssprint, sprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (German, rev 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, ssprintf, ssprint, sprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (French)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, ssprints, ssprint, sprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (Spanish)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1986, csprint, 0, sprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (rev 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, csprint2, csprint, sprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (rev 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, csprint1, csprint, sprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (rev 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, csprintg, csprint, sprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (German, rev 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, csprintg1,csprint, sprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (German, rev 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, csprintf, csprint, sprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (French)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, csprints, csprint, sprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (Spanish, rev 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, csprints1,csprint, sprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (Spanish, rev 1)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1987, apb, 0, atarisy2, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 7)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, apb6, apb, atarisy2, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 6)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, apb5, apb, atarisy2, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 5)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, apb4, apb, atarisy2, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, apb3, apb, atarisy2, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, apb2, apb, atarisy2, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, apb1, apb, atarisy2, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, apbg, apb, atarisy2, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (German)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, apbf, apb, atarisy2, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (French)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, paperboy, 0, paperboy, paperboy, atarisy2_state, paperboy, ROT0, "Atari Games", "Paperboy (rev 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, paperboyr2,paperboy, paperboy, paperboy, atarisy2_state, paperboy, ROT0, "Atari Games", "Paperboy (rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, paperboyr1,paperboy, paperboy, paperboy, atarisy2_state, paperboy, ROT0, "Atari Games", "Paperboy (rev 1)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1986, 720, 0, 720, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (rev 4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, 720r3, 720, 720, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (rev 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, 720r2, 720, 720, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, 720r1, 720, 720, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (rev 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, 720g, 720, 720, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (German, rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, 720gr1, 720, 720, 720, atarisy2_state, 720, ROT0, "Atari Games", "720 Degrees (German, rev 1)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1986, ssprint, 0, ssprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (rev 4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, ssprint3, ssprint, ssprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (rev 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, ssprint1, ssprint, ssprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (rev 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, ssprintg, ssprint, ssprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (German, rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, ssprintg1,ssprint, ssprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (German, rev 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, ssprintf, ssprint, ssprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (French)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, ssprints, ssprint, ssprint, ssprint, atarisy2_state, ssprint, ROT0, "Atari Games", "Super Sprint (Spanish)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1986, csprint, 0, csprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (rev 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, csprint2, csprint, csprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, csprint1, csprint, csprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (rev 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, csprintg, csprint, csprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (German, rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, csprintg1,csprint, csprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (German, rev 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, csprintf, csprint, csprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (French)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, csprints, csprint, csprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (Spanish, rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, csprints1,csprint, csprint, csprint, atarisy2_state, csprint, ROT0, "Atari Games", "Championship Sprint (Spanish, rev 1)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1987, apb, 0, apb, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 7)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, apb6, apb, apb, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 6)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, apb5, apb, apb, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 5)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, apb4, apb, apb, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, apb3, apb, apb, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, apb2, apb, apb, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, apb1, apb, apb, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (rev 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, apbg, apb, apb, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (German)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, apbf, apb, apb, apb, atarisy2_state, apb, ROT270, "Atari Games", "APB - All Points Bulletin (French)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/atetris.cpp b/src/mame/drivers/atetris.cpp index 61892668c33..a4f0365d896 100644 --- a/src/mame/drivers/atetris.cpp +++ b/src/mame/drivers/atetris.cpp @@ -330,7 +330,7 @@ static MACHINE_CONFIG_START( atetris, atetris_state ) MCFG_CPU_ADD("maincpu", M6502,MASTER_CLOCK/8) MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_SLAPSTIC_ADD("slapstic") + MCFG_SLAPSTIC_ADD("slapstic", 101) MCFG_NVRAM_ADD_1FILL("nvram") @@ -367,7 +367,7 @@ static MACHINE_CONFIG_START( atetrisb2, atetris_state ) MCFG_CPU_ADD("maincpu", M6502,BOOTLEG_CLOCK/8) MCFG_CPU_PROGRAM_MAP(atetrisb2_map) - MCFG_SLAPSTIC_ADD("slapstic") + MCFG_SLAPSTIC_ADD("slapstic", 101) MCFG_NVRAM_ADD_1FILL("nvram") @@ -544,7 +544,7 @@ DRIVER_INIT_MEMBER(atetris_state,atetris) { UINT8 *rgn = memregion("maincpu")->base(); - m_slapstic_device->slapstic_init(machine(), 101); + m_slapstic_device->slapstic_init(); m_slapstic_source = &rgn[0x10000]; m_slapstic_base = &rgn[0x04000]; } diff --git a/src/mame/drivers/cyberbal.cpp b/src/mame/drivers/cyberbal.cpp index 0a1a01a4ebc..f7d8d0a0466 100644 --- a/src/mame/drivers/cyberbal.cpp +++ b/src/mame/drivers/cyberbal.cpp @@ -389,8 +389,6 @@ static MACHINE_CONFIG_START( cyberbal, cyberbal_state ) MCFG_CPU_ADD("maincpu", M68000, ATARI_CLOCK_14MHz/2) MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_SLAPSTIC_ADD("slapstic") - MCFG_CPU_ADD("audiocpu", M6502, ATARI_CLOCK_14MHz/8) MCFG_CPU_PROGRAM_MAP(sound_map) MCFG_DEVICE_PERIODIC_INT_DEVICE("soundcomm", atari_sound_comm_device, sound_irq_gen, (double)ATARI_CLOCK_14MHz/4/4/16/16/14) @@ -466,6 +464,8 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( cyberbalt, cyberbal ) MCFG_DEVICE_REMOVE("eeprom") MCFG_ATARI_EEPROM_2816_ADD("eeprom") + + MCFG_SLAPSTIC_ADD("slapstic", 116) MACHINE_CONFIG_END @@ -997,20 +997,9 @@ ROM_END * *************************************/ -DRIVER_INIT_MEMBER(cyberbal_state,cyberbal) -{ - slapstic_configure(*m_maincpu, 0x018000, 0, 0); -} - - DRIVER_INIT_MEMBER(cyberbal_state,cyberbalt) { - slapstic_configure(*m_maincpu, 0x018000, 0, 116); -} - - -DRIVER_INIT_MEMBER(cyberbal_state,cyberbal2p) -{ + slapstic_configure(*m_maincpu, 0x018000, 0); } @@ -1021,14 +1010,14 @@ DRIVER_INIT_MEMBER(cyberbal_state,cyberbal2p) * *************************************/ -GAMEL(1988, cyberbal, 0, cyberbal, cyberbal, cyberbal_state, cyberbal, ROT0, "Atari Games", "Cyberball (rev 4)", 0, layout_dualhsxs ) -GAMEL(1988, cyberbal2, cyberbal, cyberbal, cyberbal, cyberbal_state, cyberbal, ROT0, "Atari Games", "Cyberball (rev 2)", 0, layout_dualhsxs ) -GAMEL(1988, cyberbalp, cyberbal, cyberbal, cyberbal, cyberbal_state, cyberbal, ROT0, "Atari Games", "Cyberball (prototype)", 0, layout_dualhsxs ) +GAMEL(1988, cyberbal, 0, cyberbal, cyberbal, driver_device, 0, ROT0, "Atari Games", "Cyberball (rev 4)", 0, layout_dualhsxs ) +GAMEL(1988, cyberbal2, cyberbal, cyberbal, cyberbal, driver_device, 0, ROT0, "Atari Games", "Cyberball (rev 2)", 0, layout_dualhsxs ) +GAMEL(1988, cyberbalp, cyberbal, cyberbal, cyberbal, driver_device, 0, ROT0, "Atari Games", "Cyberball (prototype)", 0, layout_dualhsxs ) -GAME( 1989, cyberbal2p, cyberbal, cyberbal2p, cyberbal2p, cyberbal_state, cyberbal2p, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 4)", 0 ) -GAME( 1989, cyberbal2p3, cyberbal, cyberbal2p, cyberbal2p, cyberbal_state, cyberbal2p, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 3)", 0 ) -GAME( 1989, cyberbal2p2, cyberbal, cyberbal2p, cyberbal2p, cyberbal_state, cyberbal2p, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 2)", 0 ) -GAME( 1989, cyberbal2p1, cyberbal, cyberbal2p, cyberbal2p, cyberbal_state, cyberbal2p, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 1)", 0 ) +GAME( 1989, cyberbal2p, cyberbal, cyberbal2p, cyberbal2p, driver_device, 0, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 4)", 0 ) +GAME( 1989, cyberbal2p3, cyberbal, cyberbal2p, cyberbal2p, driver_device, 0, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 3)", 0 ) +GAME( 1989, cyberbal2p2, cyberbal, cyberbal2p, cyberbal2p, driver_device, 0, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 2)", 0 ) +GAME( 1989, cyberbal2p1, cyberbal, cyberbal2p, cyberbal2p, driver_device, 0, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 1)", 0 ) GAMEL(1989, cyberbalt, cyberbal, cyberbalt, cyberbal, cyberbal_state, cyberbalt, ROT0, "Atari Games", "Tournament Cyberball 2072 (rev 2)", 0, layout_dualhsxs ) GAMEL(1989, cyberbalt1, cyberbal, cyberbalt, cyberbal, cyberbal_state, cyberbalt, ROT0, "Atari Games", "Tournament Cyberball 2072 (rev 1)", 0, layout_dualhsxs ) diff --git a/src/mame/drivers/gauntlet.cpp b/src/mame/drivers/gauntlet.cpp index 7c1839e7227..f10375d51fe 100644 --- a/src/mame/drivers/gauntlet.cpp +++ b/src/mame/drivers/gauntlet.cpp @@ -489,15 +489,13 @@ GFXDECODE_END * *************************************/ -static MACHINE_CONFIG_START( gauntlet, gauntlet_state ) +static MACHINE_CONFIG_START( gauntlet_base, gauntlet_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68010, ATARI_CLOCK_14MHz/2) MCFG_CPU_PROGRAM_MAP(main_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen) - MCFG_SLAPSTIC_ADD("slapstic") - MCFG_CPU_ADD("audiocpu", M6502, ATARI_CLOCK_14MHz/8) MCFG_CPU_PROGRAM_MAP(sound_map) @@ -545,6 +543,27 @@ static MACHINE_CONFIG_START( gauntlet, gauntlet_state ) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( gauntlet, gauntlet_base ) + MCFG_SLAPSTIC_ADD("slapstic", 104) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( gaunt2p, gauntlet_base ) + MCFG_SLAPSTIC_ADD("slapstic", 107) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( gauntlet2, gauntlet_base ) + MCFG_SLAPSTIC_ADD("slapstic", 106) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( vindctr2, gauntlet_base ) + MCFG_SLAPSTIC_ADD("slapstic", 118) +MACHINE_CONFIG_END + + + /************************************* * @@ -1624,10 +1643,10 @@ void gauntlet_state::swap_memory(void *ptr1, void *ptr2, int bytes) } } -void gauntlet_state::common_init(int slapstic, int vindctr2) +void gauntlet_state::common_init(int vindctr2) { UINT8 *rom = memregion("maincpu")->base(); - slapstic_configure(*m_maincpu, 0x038000, 0, slapstic); + slapstic_configure(*m_maincpu, 0x038000, 0); /* swap the top and bottom halves of the main CPU ROM images */ swap_memory(rom + 0x000000, rom + 0x008000, 0x8000); @@ -1643,19 +1662,7 @@ void gauntlet_state::common_init(int slapstic, int vindctr2) DRIVER_INIT_MEMBER(gauntlet_state,gauntlet) { - common_init(104, 0); -} - - -DRIVER_INIT_MEMBER(gauntlet_state,gaunt2p) -{ - common_init(107, 0); -} - - -DRIVER_INIT_MEMBER(gauntlet_state,gauntlet2) -{ - common_init(106, 0); + common_init(0); } @@ -1665,7 +1672,7 @@ DRIVER_INIT_MEMBER(gauntlet_state,vindctr2) dynamic_buffer data(0x8000); int i; - common_init(118, 1); + common_init(1); /* highly strange -- the address bits on the chip at 2J (and only that chip) are scrambled -- this is verified on the schematics! */ @@ -1701,20 +1708,20 @@ GAME( 1985, gauntletgr3, gauntlet, gauntlet, gauntlet, gauntlet_state, gauntlet, GAME( 1985, gauntletr2, gauntlet, gauntlet, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet (rev 2)", 0 ) GAME( 1985, gauntletr1, gauntlet, gauntlet, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet (rev 1)", 0 ) -GAME( 1985, gauntlet2p, gauntlet, gauntlet, gauntlet, gauntlet_state, gaunt2p, ROT0, "Atari Games", "Gauntlet (2 Players, rev 6)", 0 ) -GAME( 1985, gauntlet2pj, gauntlet, gauntlet, gauntlet, gauntlet_state, gaunt2p, ROT0, "Atari Games", "Gauntlet (2 Players, Japanese, rev 5)", 0 ) -GAME( 1985, gauntlet2pg, gauntlet, gauntlet, gauntlet, gauntlet_state, gaunt2p, ROT0, "Atari Games", "Gauntlet (2 Players, German, rev 4)", 0 ) -GAME( 1985, gauntlet2pr3, gauntlet, gauntlet, gauntlet, gauntlet_state, gaunt2p, ROT0, "Atari Games", "Gauntlet (2 Players, rev 3)", 0 ) -GAME( 1985, gauntlet2pj2, gauntlet, gauntlet, gauntlet, gauntlet_state, gaunt2p, ROT0, "Atari Games", "Gauntlet (2 Players, Japanese, rev 2)", 0 ) -GAME( 1985, gauntlet2pg1, gauntlet, gauntlet, gauntlet, gauntlet_state, gaunt2p, ROT0, "Atari Games", "Gauntlet (2 Players, German, rev 1)", 0 ) +GAME( 1985, gauntlet2p, gauntlet, gaunt2p, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet (2 Players, rev 6)", 0 ) +GAME( 1985, gauntlet2pj, gauntlet, gaunt2p, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet (2 Players, Japanese, rev 5)", 0 ) +GAME( 1985, gauntlet2pg, gauntlet, gaunt2p, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet (2 Players, German, rev 4)", 0 ) +GAME( 1985, gauntlet2pr3, gauntlet, gaunt2p, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet (2 Players, rev 3)", 0 ) +GAME( 1985, gauntlet2pj2, gauntlet, gaunt2p, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet (2 Players, Japanese, rev 2)", 0 ) +GAME( 1985, gauntlet2pg1, gauntlet, gaunt2p, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet (2 Players, German, rev 1)", 0 ) -GAME( 1986, gaunt2, 0, gauntlet, gauntlet, gauntlet_state, gauntlet2, ROT0, "Atari Games", "Gauntlet II", 0 ) -GAME( 1986, gaunt2g, gaunt2, gauntlet, gauntlet, gauntlet_state, gauntlet2, ROT0, "Atari Games", "Gauntlet II (German)", 0 ) +GAME( 1986, gaunt2, 0, gauntlet2, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet II", 0 ) +GAME( 1986, gaunt2g, gaunt2, gauntlet2, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet II (German)", 0 ) -GAME( 1986, gaunt22p, gaunt2, gauntlet, gauntlet, gauntlet_state, gauntlet2, ROT0, "Atari Games", "Gauntlet II (2 Players, rev 2)", 0 ) -GAME( 1986, gaunt22p1, gaunt2, gauntlet, gauntlet, gauntlet_state, gauntlet2, ROT0, "Atari Games", "Gauntlet II (2 Players, rev 1)", 0 ) -GAME( 1986, gaunt22pg, gaunt2, gauntlet, gauntlet, gauntlet_state, gauntlet2, ROT0, "Atari Games", "Gauntlet II (2 Players, German)", 0 ) +GAME( 1986, gaunt22p, gaunt2, gauntlet2, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet II (2 Players, rev 2)", 0 ) +GAME( 1986, gaunt22p1, gaunt2, gauntlet2, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet II (2 Players, rev 1)", 0 ) +GAME( 1986, gaunt22pg, gaunt2, gauntlet2, gauntlet, gauntlet_state, gauntlet, ROT0, "Atari Games", "Gauntlet II (2 Players, German)", 0 ) -GAME( 1988, vindctr2, 0, gauntlet, vindctr2, gauntlet_state, vindctr2, ROT0, "Atari Games", "Vindicators Part II (rev 3)", 0 ) -GAME( 1988, vindctr2r2, vindctr2, gauntlet, vindctr2, gauntlet_state, vindctr2, ROT0, "Atari Games", "Vindicators Part II (rev 2)", 0 ) -GAME( 1988, vindctr2r1, vindctr2, gauntlet, vindctr2, gauntlet_state, vindctr2, ROT0, "Atari Games", "Vindicators Part II (rev 1)", 0 ) +GAME( 1988, vindctr2, 0, vindctr2, vindctr2, gauntlet_state, vindctr2, ROT0, "Atari Games", "Vindicators Part II (rev 3)", 0 ) +GAME( 1988, vindctr2r2, vindctr2, vindctr2, vindctr2, gauntlet_state, vindctr2, ROT0, "Atari Games", "Vindicators Part II (rev 2)", 0 ) +GAME( 1988, vindctr2r1, vindctr2, vindctr2, vindctr2, gauntlet_state, vindctr2, ROT0, "Atari Games", "Vindicators Part II (rev 1)", 0 ) diff --git a/src/mame/drivers/harddriv.cpp b/src/mame/drivers/harddriv.cpp index e6b881a60f4..e5eb4267425 100644 --- a/src/mame/drivers/harddriv.cpp +++ b/src/mame/drivers/harddriv.cpp @@ -1425,7 +1425,7 @@ static MACHINE_CONFIG_FRAGMENT( driver_nomsp ) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", harddriv_state, video_int_gen) MCFG_CPU_PERIODIC_INT_DRIVER(harddriv_state, hd68k_irq_gen, (double)HARDDRIV_MASTER_CLOCK/16/16/16/16/2) - MCFG_SLAPSTIC_ADD("slapstic") + MCFG_SLAPSTIC_ADD("slapstic", 117) MCFG_SLAPSTIC_68K_ACCESS(1) MCFG_CPU_ADD("gsp", TMS34010, HARDDRIV_GSP_CLOCK) @@ -1472,6 +1472,7 @@ static MACHINE_CONFIG_FRAGMENT( driver_msp ) MCFG_TMS340X0_OUTPUT_INT_CB(WRITELINE(harddriv_state, hdmsp_irq_gen)) MCFG_VIDEO_SET_SCREEN("screen") + MCFG_DEVICE_REMOVE("slapstic") MACHINE_CONFIG_END @@ -1510,6 +1511,7 @@ static MACHINE_CONFIG_FRAGMENT( multisync_msp ) MCFG_TMS340X0_OUTPUT_INT_CB(WRITELINE(harddriv_state, hdmsp_irq_gen)) MCFG_VIDEO_SET_SCREEN("screen") + MCFG_DEVICE_REMOVE("slapstic") MACHINE_CONFIG_END @@ -1524,6 +1526,8 @@ static MACHINE_CONFIG_FRAGMENT( multisync2 ) MCFG_CPU_MODIFY("gsp") MCFG_CPU_PROGRAM_MAP(multisync2_gsp_map) + + MCFG_DEVICE_REMOVE("slapstic") MACHINE_CONFIG_END @@ -1682,6 +1686,7 @@ static MACHINE_CONFIG_FRAGMENT( stunrun ) MCFG_CPU_MODIFY("gsp") MCFG_TMS340X0_PIXEL_CLOCK(5000000) /* pixel clock */ MCFG_FRAGMENT_ADD( adsp ) /* ADSP board */ + MCFG_DEVICE_REMOVE("slapstic") /* video hardware */ MCFG_SCREEN_MODIFY("screen") @@ -2018,6 +2023,10 @@ static MACHINE_CONFIG_START( racedriv_panorama_machine, harddriv_new_state ) MCFG_DEVICE_MODIFY("mainpcb:duartn68681") MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE(DEVICE_SELF_OWNER, harddriv_new_state,tx_a)) + // boots with 'PROGRAM OK' when using standard Hard Drivin' board type (needs 137412-115 slapstic) + MCFG_DEVICE_MODIFY("mainpcb:slapstic") + MCFG_SLAPSTIC_NUM(115) + MCFG_TIMER_DRIVER_ADD_PERIODIC("hack_timer", harddriv_new_state, hack_timer, attotime::from_hz(60)) // MCFG_QUANTUM_TIME(attotime::from_hz(60000)) MACHINE_CONFIG_END @@ -4070,7 +4079,6 @@ Filename Location Label Board ROM_START( racedrivpan ) ROM_REGION( 0x200000, "mainpcb:maincpu", 0 ) /* 2MB for 68000 code */ // Multisync PBB A045988 - Central Monitor - // boots with 'PROGRAM OK' when using standard Hard Drivin' board type (needs 137412-115 slapstic) ROM_LOAD16_BYTE( "088-1002.bin", 0x000000, 0x010000, CRC(49a97391) SHA1(dbe4086cd87669a02d2a2133d0d9e2895946b383) ) ROM_LOAD16_BYTE( "088-1001.bin", 0x000001, 0x010000, CRC(4473accc) SHA1(099bda6cfe31d4e53cbe74046679ddf8b874982d) ) ROM_LOAD16_BYTE( "088-1004.bin", 0x020000, 0x010000, CRC(33b84ca6) SHA1(9e3cafadfb23bfc4a44e503043cc05db27d939a9) ) @@ -4652,7 +4660,7 @@ void harddriv_state::init_multisync(int compact_inputs) m_gsp_multisync = TRUE; // if we have a JSA board, install the read/write handlers - if (m_jsa != nullptr) + if (m_jsa.found()) m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x600000, 0x603fff, read8_delegate(FUNC(atari_jsa_base_device::main_response_r),m_jsa.target()), write8_delegate(FUNC(atari_jsa_base_device::main_command_w),m_jsa.target()), 0xff00); /* install handlers for the compact driving games' inputs */ @@ -4936,7 +4944,7 @@ void harddriv_state::init_racedriv(void) init_driver_sound(); /* set up the slapstic */ - m_slapstic_device->slapstic_init(machine(), 117); + m_slapstic_device->slapstic_init(); m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); /* synchronization */ @@ -4957,7 +4965,7 @@ void harddriv_state::racedrivc_init_common(offs_t gsp_protection) init_driver_sound(); /* set up the slapstic */ - m_slapstic_device->slapstic_init(machine(), 117); + m_slapstic_device->slapstic_init(); m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); /* synchronization */ @@ -4987,7 +4995,7 @@ void harddriv_state::init_racedrivc_panorama_side() init_adsp(); /* set up the slapstic */ - m_slapstic_device->slapstic_init(machine(), 117); + m_slapstic_device->slapstic_init(); m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); /* set up protection hacks */ @@ -5079,7 +5087,7 @@ void harddriv_state::init_strtdriv(void) init_dsk(); /* set up the slapstic */ - m_slapstic_device->slapstic_init(machine(), 117); + m_slapstic_device->slapstic_init(); m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); m_maincpu->space(AS_PROGRAM).install_read_handler(0xa80000, 0xafffff, read16_delegate(FUNC(harddriv_state::hda68k_port1_r), this)); diff --git a/src/mame/drivers/rampart.cpp b/src/mame/drivers/rampart.cpp index d8e38499191..9c0827a39bc 100644 --- a/src/mame/drivers/rampart.cpp +++ b/src/mame/drivers/rampart.cpp @@ -339,7 +339,7 @@ static MACHINE_CONFIG_START( rampart, rampart_state ) MCFG_CPU_PROGRAM_MAP(main_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen) - MCFG_SLAPSTIC_ADD("slapstic") + MCFG_SLAPSTIC_ADD("slapstic", 118) MCFG_MACHINE_RESET_OVERRIDE(rampart_state,rampart) @@ -481,7 +481,7 @@ DRIVER_INIT_MEMBER(rampart_state,rampart) UINT8 *rom = memregion("maincpu")->base(); memcpy(&rom[0x140000], &rom[0x40000], 0x8000); - slapstic_configure(*m_maincpu, 0x140000, 0x438000, 118); + slapstic_configure(*m_maincpu, 0x140000, 0x438000); } diff --git a/src/mame/drivers/starwars.cpp b/src/mame/drivers/starwars.cpp index 9fdc3c45be0..986d1c6d671 100644 --- a/src/mame/drivers/starwars.cpp +++ b/src/mame/drivers/starwars.cpp @@ -333,8 +333,6 @@ static MACHINE_CONFIG_START( starwars, starwars_state ) MCFG_CPU_PERIODIC_INT_DRIVER(starwars_state, irq0_line_assert, CLOCK_3KHZ / 12) MCFG_WATCHDOG_TIME_INIT(attotime::from_hz(CLOCK_3KHZ / 128)) - MCFG_SLAPSTIC_ADD("slapstic") - MCFG_CPU_ADD("audiocpu", M6809, MASTER_CLOCK / 8) MCFG_CPU_PROGRAM_MAP(sound_map) @@ -378,6 +376,11 @@ static MACHINE_CONFIG_START( starwars, starwars_state ) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( esb, starwars ) + MCFG_SLAPSTIC_ADD("slapstic", 101) +MACHINE_CONFIG_END + + /************************************* * @@ -558,7 +561,7 @@ DRIVER_INIT_MEMBER(starwars_state,esb) UINT8 *rom = memregion("maincpu")->base(); /* init the slapstic */ - m_slapstic_device->slapstic_init(machine(), 101); + m_slapstic_device->slapstic_init(); m_slapstic_source = &rom[0x14000]; m_slapstic_base = &rom[0x08000]; @@ -603,4 +606,4 @@ GAME( 1983, starwarso,starwars, starwars, starwars, starwars_state, starwars, RO GAME( 1983, tomcatsw, tomcat, starwars, starwars, starwars_state, starwars, ROT0, "Atari", "TomCat (Star Wars hardware, prototype)", MACHINE_NO_SOUND ) -GAME( 1985, esb, 0, starwars, esb, starwars_state, esb, ROT0, "Atari Games", "The Empire Strikes Back", 0 ) +GAME( 1985, esb, 0, esb, esb, starwars_state, esb, ROT0, "Atari Games", "The Empire Strikes Back", 0 ) diff --git a/src/mame/drivers/xybots.cpp b/src/mame/drivers/xybots.cpp index 948e7aa33ae..9cb32712bd2 100644 --- a/src/mame/drivers/xybots.cpp +++ b/src/mame/drivers/xybots.cpp @@ -184,7 +184,7 @@ static MACHINE_CONFIG_START( xybots, xybots_state ) MCFG_CPU_PROGRAM_MAP(main_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen) - MCFG_SLAPSTIC_ADD("slapstic") + MCFG_SLAPSTIC_ADD("slapstic", 107) MCFG_MACHINE_RESET_OVERRIDE(xybots_state,xybots) @@ -395,7 +395,7 @@ ROM_END DRIVER_INIT_MEMBER(xybots_state,xybots) { m_h256 = 0x0400; - slapstic_configure(*m_maincpu, 0x008000, 0, 107); + slapstic_configure(*m_maincpu, 0x008000, 0); } diff --git a/src/mame/includes/atarig1.h b/src/mame/includes/atarig1.h index 3cef67afe31..01e9b3e9e82 100644 --- a/src/mame/includes/atarig1.h +++ b/src/mame/includes/atarig1.h @@ -55,9 +55,6 @@ public: void update_bank(int bank); DECLARE_DRIVER_INIT(hydrap); DECLARE_DRIVER_INIT(hydra); - DECLARE_DRIVER_INIT(pitfight9); - DECLARE_DRIVER_INIT(pitfight7); - DECLARE_DRIVER_INIT(pitfightj); DECLARE_DRIVER_INIT(pitfight); DECLARE_DRIVER_INIT(pitfightb); TILE_GET_INFO_MEMBER(get_alpha_tile_info); @@ -67,6 +64,5 @@ public: DECLARE_VIDEO_START(atarig1); UINT32 screen_update_atarig1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); private: - void init_common(offs_t slapstic_base, int slapstic, bool is_pitfight); void pitfightb_cheap_slapstic_init(); }; diff --git a/src/mame/includes/atarisy1.h b/src/mame/includes/atarisy1.h index b90f10d3abe..3c0c0d5e4ec 100644 --- a/src/mame/includes/atarisy1.h +++ b/src/mame/includes/atarisy1.h @@ -72,8 +72,7 @@ public: DECLARE_READ8_MEMBER(via_pa_r); DECLARE_WRITE8_MEMBER(via_pb_w); DECLARE_READ8_MEMBER(via_pb_r); - DECLARE_DRIVER_INIT(roadb110); - DECLARE_DRIVER_INIT(roadb109); + DECLARE_DRIVER_INIT(roadblst); DECLARE_DRIVER_INIT(peterpak); DECLARE_DRIVER_INIT(marble); DECLARE_DRIVER_INIT(roadrunn); diff --git a/src/mame/includes/cyberbal.h b/src/mame/includes/cyberbal.h index 37508ad0581..aca6711a0ae 100644 --- a/src/mame/includes/cyberbal.h +++ b/src/mame/includes/cyberbal.h @@ -78,8 +78,6 @@ public: DECLARE_WRITE16_MEMBER(sound_68k_w); DECLARE_WRITE16_MEMBER(sound_68k_dac_w); DECLARE_DRIVER_INIT(cyberbalt); - DECLARE_DRIVER_INIT(cyberbal2p); - DECLARE_DRIVER_INIT(cyberbal); TILE_GET_INFO_MEMBER(get_alpha_tile_info); TILE_GET_INFO_MEMBER(get_playfield_tile_info); DECLARE_MACHINE_START(cyberbal); diff --git a/src/mame/includes/gauntlet.h b/src/mame/includes/gauntlet.h index c945d96b956..e14e72776a2 100644 --- a/src/mame/includes/gauntlet.h +++ b/src/mame/includes/gauntlet.h @@ -47,9 +47,7 @@ public: DECLARE_WRITE8_MEMBER(sound_ctl_w); DECLARE_WRITE8_MEMBER(mixer_w); void swap_memory(void *ptr1, void *ptr2, int bytes); - void common_init(int slapstic, int vindctr2); - DECLARE_DRIVER_INIT(gauntlet2); - DECLARE_DRIVER_INIT(gaunt2p); + void common_init(int vindctr2); DECLARE_DRIVER_INIT(gauntlet); DECLARE_DRIVER_INIT(vindctr2); TILE_GET_INFO_MEMBER(get_alpha_tile_info); diff --git a/src/mame/includes/slapstic.h b/src/mame/includes/slapstic.h index cfcfcce890e..27328fc4c04 100644 --- a/src/mame/includes/slapstic.h +++ b/src/mame/includes/slapstic.h @@ -23,8 +23,9 @@ extern const device_type SLAPSTIC; -#define MCFG_SLAPSTIC_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, SLAPSTIC, 0) +#define MCFG_SLAPSTIC_ADD(_tag, _chip) \ + MCFG_DEVICE_ADD(_tag, SLAPSTIC, 0) \ + MCFG_SLAPSTIC_NUM(_chip) /************************************* @@ -123,6 +124,9 @@ enum }; +#define MCFG_SLAPSTIC_NUM(_chipnum) \ + atari_slapstic_device::static_set_chipnum(*device, _chipnum); + #define MCFG_SLAPSTIC_68K_ACCESS(_type) \ atari_slapstic_device::static_set_access68k(*device, _type); @@ -134,10 +138,10 @@ public: // construction/destruction atari_slapstic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - void slapstic_init(running_machine &machine, int chip); - void slapstic_reset(void); + void slapstic_init(); + void slapstic_reset(); - int slapstic_bank(void); + int slapstic_bank(); int slapstic_tweak(address_space &space, offs_t offset); int alt2_kludge(address_space &space, offs_t offset); @@ -148,6 +152,13 @@ public: dev.access_68k = type; } + static void static_set_chipnum(device_t &device, int chipnum) + { + atari_slapstic_device &dev = downcast(device); + dev.m_chipnum = chipnum; + } + + int m_chipnum; UINT8 state; UINT8 current_bank; @@ -168,6 +179,7 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; + virtual void device_validity_check(validity_checker &valid) const override; private: diff --git a/src/mame/machine/atarigen.cpp b/src/mame/machine/atarigen.cpp index 90d422f6c25..2d55560cee8 100644 --- a/src/mame/machine/atarigen.cpp +++ b/src/mame/machine/atarigen.cpp @@ -1004,7 +1004,7 @@ void atarigen_state::machine_reset() // reset the slapstic if (m_slapstic_num != 0) { - if (!m_slapstic_device) + if (!m_slapstic_device.found()) fatalerror("Slapstic device is missing?\n"); m_slapstic_device->slapstic_reset(); @@ -1179,8 +1179,8 @@ void atarigen_state::device_post_load() { if (m_slapstic_num != 0) { - if (!m_slapstic_device) - fatalerror("Slapstic device is missing?\n"); + if (!m_slapstic_device.found()) + fatalerror("Slapstic device is missing?\n"); slapstic_update_bank(m_slapstic_device->slapstic_bank()); } @@ -1214,37 +1214,30 @@ DIRECT_UPDATE_MEMBER(atarigen_state::slapstic_setdirect) // slapstic and sets the chip number. //------------------------------------------------- -void atarigen_state::slapstic_configure(cpu_device &device, offs_t base, offs_t mirror, int chipnum) +void atarigen_state::slapstic_configure(cpu_device &device, offs_t base, offs_t mirror) { - // reset in case we have no state - m_slapstic_num = chipnum; - m_slapstic = nullptr; + if (!m_slapstic_device.found()) + fatalerror("Slapstic device is missing\n"); - // if we have a chip, install it - if (chipnum != 0) - { - if (!m_slapstic_device) - fatalerror("Slapstic device is missing\n"); + // initialize the slapstic + m_slapstic_num = m_slapstic_device->m_chipnum; + m_slapstic_device->slapstic_init(); - // initialize the slapstic - m_slapstic_device->slapstic_init(machine(), chipnum); + // install the memory handlers + address_space &program = device.space(AS_PROGRAM); + m_slapstic = program.install_readwrite_handler(base, base + 0x7fff, 0, mirror, read16_delegate(FUNC(atarigen_state::slapstic_r), this), write16_delegate(FUNC(atarigen_state::slapstic_w), this)); + program.set_direct_update_handler(direct_update_delegate(FUNC(atarigen_state::slapstic_setdirect), this)); - // install the memory handlers - address_space &program = device.space(AS_PROGRAM); - m_slapstic = program.install_readwrite_handler(base, base + 0x7fff, 0, mirror, read16_delegate(FUNC(atarigen_state::slapstic_r), this), write16_delegate(FUNC(atarigen_state::slapstic_w), this)); - program.set_direct_update_handler(direct_update_delegate(FUNC(atarigen_state::slapstic_setdirect), this)); + // allocate memory for a copy of bank 0 + m_slapstic_bank0.resize(0x2000); + memcpy(&m_slapstic_bank0[0], m_slapstic, 0x2000); - // allocate memory for a copy of bank 0 - m_slapstic_bank0.resize(0x2000); - memcpy(&m_slapstic_bank0[0], m_slapstic, 0x2000); + // ensure we recopy memory for the bank + m_slapstic_bank = 0xff; - // ensure we recopy memory for the bank - m_slapstic_bank = 0xff; - - // install an opcode base handler if we are a 68000 or variant - m_slapstic_base = base; - m_slapstic_mirror = mirror; - } + // install an opcode base handler if we are a 68000 or variant + m_slapstic_base = base; + m_slapstic_mirror = mirror; } @@ -1256,7 +1249,7 @@ void atarigen_state::slapstic_configure(cpu_device &device, offs_t base, offs_t WRITE16_MEMBER(atarigen_state::slapstic_w) { - if (!m_slapstic_device) + if (!m_slapstic_device.found()) fatalerror("Slapstic device is missing?\n"); slapstic_update_bank(m_slapstic_device->slapstic_tweak(space, offset)); @@ -1270,7 +1263,7 @@ WRITE16_MEMBER(atarigen_state::slapstic_w) READ16_MEMBER(atarigen_state::slapstic_r) { - if (!m_slapstic_device) + if (!m_slapstic_device.found()) fatalerror("Slapstic device is missing?\n"); // fetch the result from the current bank first diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h index c618e5b3d07..0266d2bd458 100644 --- a/src/mame/machine/atarigen.h +++ b/src/mame/machine/atarigen.h @@ -355,7 +355,7 @@ public: DECLARE_WRITE16_MEMBER(video_int_ack_w); // slapstic helpers - void slapstic_configure(cpu_device &device, offs_t base, offs_t mirror, int chipnum); + void slapstic_configure(cpu_device &device, offs_t base, offs_t mirror); void slapstic_update_bank(int bank); DECLARE_DIRECT_UPDATE_MEMBER(slapstic_setdirect); DECLARE_WRITE16_MEMBER(slapstic_w); diff --git a/src/mame/machine/harddriv.cpp b/src/mame/machine/harddriv.cpp index 9dc14a34438..a9653cf34ea 100644 --- a/src/mame/machine/harddriv.cpp +++ b/src/mame/machine/harddriv.cpp @@ -54,11 +54,11 @@ void harddriv_state::device_reset() { /* generic reset */ //atarigen_state::machine_reset(); - m_slapstic_device->slapstic_reset(); + if (m_slapstic_device.found()) m_slapstic_device->slapstic_reset(); /* halt several of the DSPs to start */ - if (m_adsp != nullptr) m_adsp->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - if (m_dsp32 != nullptr) m_dsp32->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + if (m_adsp.found()) m_adsp->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + if (m_dsp32.found()) m_dsp32->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); m_last_gsp_shiftreg = 0; @@ -72,14 +72,14 @@ void harddriv_state::device_reset() m_adsp_br = 0; m_adsp_xflag = 0; - if (m_ds3sdsp != nullptr) + if (m_ds3sdsp.found()) { m_ds3sdsp->load_boot_data(m_ds3sdsp->region()->base(), m_ds3sdsp_pgm_memory); m_ds3sdsp_timer_en = 0; m_ds3sdsp_internal_timer->adjust(attotime::never); } - if (m_ds3xdsp != nullptr) + if (m_ds3xdsp.found()) { m_ds3xdsp->load_boot_data(m_ds3xdsp->region()->base(), m_ds3xdsp_pgm_memory); m_ds3xdsp_timer_en = 0; @@ -173,7 +173,7 @@ READ16_MEMBER( harddriv_state::hd68k_msp_io_r ) UINT16 result; offset = (offset / 2) ^ 1; m_hd34010_host_access = TRUE; - result = (m_msp != nullptr) ? m_msp->host_r(space, offset, 0xffff) : 0xffff; + result = m_msp.found() ? m_msp->host_r(space, offset, 0xffff) : 0xffff; m_hd34010_host_access = FALSE; return result; } @@ -182,7 +182,7 @@ READ16_MEMBER( harddriv_state::hd68k_msp_io_r ) WRITE16_MEMBER( harddriv_state::hd68k_msp_io_w ) { offset = (offset / 2) ^ 1; - if (m_msp != nullptr) + if (m_msp.found()) { m_hd34010_host_access = TRUE; m_msp->host_w(space, offset, data, 0xffff); @@ -302,7 +302,7 @@ READ16_MEMBER( harddriv_state::hd68k_adc12_r ) READ16_MEMBER( harddriv_state::hd68k_sound_reset_r ) { - if (m_jsa != nullptr) + if (m_jsa.found()) m_jsa->reset(); return ~0; } @@ -404,12 +404,12 @@ WRITE16_MEMBER( harddriv_state::hd68k_nwr_w ) break; case 6: /* /GSPRES */ logerror("Write to /GSPRES(%d)\n", data); - if (m_gsp != nullptr) + if (m_gsp.found()) m_gsp->set_input_line(INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE); break; case 7: /* /MSPRES */ logerror("Write to /MSPRES(%d)\n", data); - if (m_msp != nullptr) + if (m_msp.found()) m_msp->set_input_line(INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE); break; } @@ -859,7 +859,7 @@ WRITE16_MEMBER( harddriv_state::hd68k_ds3_control_w ) { case 0: /* SRES - reset sound CPU */ - if (m_ds3sdsp) + if (m_ds3sdsp.found()) { m_ds3sdsp->set_input_line(INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE); m_ds3sdsp->load_boot_data(m_ds3sdsp->region()->base(), m_ds3sdsp_pgm_memory); @@ -879,7 +879,7 @@ WRITE16_MEMBER( harddriv_state::hd68k_ds3_control_w ) case 1: /* XRES - reset sound helper CPU */ - if (m_ds3xdsp) + if (m_ds3xdsp.found()) { m_ds3xdsp->set_input_line(INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE); m_ds3xdsp->load_boot_data(m_ds3xdsp->region()->base(), m_ds3xdsp_pgm_memory); @@ -1510,11 +1510,11 @@ WRITE16_MEMBER( harddriv_state::hd68k_dsk_control_w ) switch (offset & 7) { case 0: /* DSPRESTN */ - if (m_dsp32) m_dsp32->set_input_line(INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE); + if (m_dsp32.found()) m_dsp32->set_input_line(INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE); break; case 1: /* DSPZN */ - if (m_dsp32) m_dsp32->set_input_line(INPUT_LINE_HALT, val ? CLEAR_LINE : ASSERT_LINE); + if (m_dsp32.found()) m_dsp32->set_input_line(INPUT_LINE_HALT, val ? CLEAR_LINE : ASSERT_LINE); break; case 2: /* ZW1 */ @@ -1578,7 +1578,7 @@ READ16_MEMBER( harddriv_state::hd68k_dsk_rom_r ) WRITE16_MEMBER( harddriv_state::hd68k_dsk_dsp32_w ) { m_dsk_pio_access = TRUE; - if (m_dsp32) m_dsp32->pio_w(offset, data); + if (m_dsp32.found()) m_dsp32->pio_w(offset, data); m_dsk_pio_access = FALSE; } @@ -1587,7 +1587,7 @@ READ16_MEMBER( harddriv_state::hd68k_dsk_dsp32_r ) { UINT16 result; m_dsk_pio_access = TRUE; - if (m_dsp32) result = m_dsp32->pio_r(offset); + if (m_dsp32.found()) result = m_dsp32->pio_r(offset); else result = 0x00; m_dsk_pio_access = FALSE; diff --git a/src/mame/machine/slapstic.cpp b/src/mame/machine/slapstic.cpp index 4ff2fe4a2e3..2d1e83aae67 100644 --- a/src/mame/machine/slapstic.cpp +++ b/src/mame/machine/slapstic.cpp @@ -182,6 +182,7 @@ #include "includes/slapstic.h" +#include "validity.h" extern const device_type SLAPSTIC = &device_creator; @@ -736,6 +737,12 @@ static const struct slapstic_data *const slapstic_table[] = }; +void atari_slapstic_device::device_validity_check(validity_checker &valid) const +{ + // only a small number of chips are known to exist + if (m_chipnum < 101 || m_chipnum > 118 || !slapstic_table[m_chipnum - 101]) + osd_printf_error("Unknown slapstic number: %d\n", m_chipnum); +} /************************************* @@ -744,23 +751,17 @@ static const struct slapstic_data *const slapstic_table[] = * *************************************/ -void atari_slapstic_device::slapstic_init(running_machine &machine, int chip) +void atari_slapstic_device::slapstic_init() { if (access_68k == -1) { /* see if we're 68k or 6502/6809 based */ - device_type cputype = machine.device(":maincpu")->type(); + device_type cputype = machine().device(":maincpu")->type(); access_68k = (cputype == M68000 || cputype == M68010); } - /* only a small number of chips are known to exist */ - if (chip < 101 || chip > 118) - return; - /* set up the parameters */ - if (!slapstic_table[chip - 101]) - return; - slapstic = *slapstic_table[chip - 101]; + slapstic = *slapstic_table[m_chipnum - 101]; /* reset the chip */ slapstic_reset(); -- cgit v1.2.3-70-g09d2 From dbb6c113130adc59b23d92ff38a2e02cb1d71e2f Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 30 Jan 2016 08:11:57 +0100 Subject: makefile should inherit CC and GCC if set in parent makefile (nw) --- src/devices/cpu/m68000/makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/devices/cpu/m68000/makefile b/src/devices/cpu/m68000/makefile index fbf49c6ce0e..be25a067a78 100644 --- a/src/devices/cpu/m68000/makefile +++ b/src/devices/cpu/m68000/makefile @@ -8,6 +8,12 @@ ifeq ($(OS),os2) EXE := .exe endif +ifndef verbose + SILENT = @ +endif +CC = gcc +CXX = g++ + .PHONY: all clean all : m68kmake$(EXE) m68kops.cpp @@ -19,13 +25,13 @@ clean: -@rm -f m68kops.* m68kmake.o: m68kmake.cpp - @gcc -x c++ -std=c++11 -o "$@" -c "$<" + $(SILENT) $(CC) -x c++ -std=c++11 -o "$@" -c "$<" m68kmake$(EXE) : m68kmake.o @echo Linking $@... - @g++ -lstdc++ $^ -o $@ + $(SILENT) $(CXX) -lstdc++ $^ -o $@ m68kops.cpp: m68kmake$(EXE) m68k_in.cpp @echo Generating M68K source files... - @./m68kmake$(EXE) . m68k_in.cpp + $(SILENT) ./m68kmake$(EXE) . m68k_in.cpp -- cgit v1.2.3-70-g09d2 From 29ba71768c9b0503a17648056742ba9a4684bfc1 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Sat, 30 Jan 2016 09:31:46 +0100 Subject: Use nothrow allocation in these circumstance. --- src/osd/modules/render/drawdd.cpp | 2 +- src/osd/windows/input.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osd/modules/render/drawdd.cpp b/src/osd/modules/render/drawdd.cpp index fb82dff3c1f..f15b70691c2 100644 --- a/src/osd/modules/render/drawdd.cpp +++ b/src/osd/modules/render/drawdd.cpp @@ -566,7 +566,7 @@ int renderer_dd::ddraw_create_surfaces() { membuffersize = blitwidth * blitheight * 4; global_free_array(membuffer); - membuffer = global_alloc_array(UINT8, membuffersize); + membuffer = global_alloc_array_nothrow(UINT8, membuffersize); } if (membuffer == NULL) goto error; diff --git a/src/osd/windows/input.cpp b/src/osd/windows/input.cpp index 0165e4820f0..77adda7a2ca 100644 --- a/src/osd/windows/input.cpp +++ b/src/osd/windows/input.cpp @@ -661,7 +661,7 @@ BOOL wininput_handle_raw(HANDLE device) // if necessary, allocate a temporary buffer and fetch the data if (size > sizeof(small_buffer)) { - data = global_alloc_array(BYTE, size); + data = global_alloc_array_nothrow(BYTE, size); if (data == NULL) return result; } -- cgit v1.2.3-70-g09d2 From 118d70ac755e005a1c4ad6f2a599ddb7f62694de Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 30 Jan 2016 12:41:20 +0100 Subject: New not working clones added: IGT Multistar 7 2c [Miodrag Milanovic] --- src/mame/arcade.lst | 1 + src/mame/drivers/gkigt.cpp | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index e43a3a63ad4..09de7daca36 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -11954,6 +11954,7 @@ pexmp030 // (c) 1997 IGT - International Game Technology pexmp030a // (c) 1997 IGT - International Game Technology // IGT Game King +ms72c gkigt4 gkigt4ms gkigt43 diff --git a/src/mame/drivers/gkigt.cpp b/src/mame/drivers/gkigt.cpp index 07bd4c982ea..867514520b8 100644 --- a/src/mame/drivers/gkigt.cpp +++ b/src/mame/drivers/gkigt.cpp @@ -172,7 +172,7 @@ GFXDECODE_END static MACHINE_CONFIG_START( igt_gameking, igt_gameking_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I960, 20000000) // ?? Mhz + MCFG_CPU_ADD("maincpu", I960, XTAL_24MHz) MCFG_CPU_PROGRAM_MAP(igt_gameking_mem) @@ -185,6 +185,7 @@ static MACHINE_CONFIG_START( igt_gameking, igt_gameking_state ) MCFG_SCREEN_VISIBLE_AREA(8*8, 48*8-1, 2*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(igt_gameking_state, screen_update_igt_gameking) MCFG_SCREEN_PALETTE("palette") + // Xilinx used as video chip XTAL_26_66666MHz on board MCFG_PALETTE_ADD("palette", 0x200) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) @@ -198,6 +199,26 @@ static MACHINE_CONFIG_START( igt_gameking, igt_gameking_state ) MACHINE_CONFIG_END +ROM_START( ms72c ) + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_LOAD( "3B5019FA MULTISTAR 7 2c CONFIG.u8", 0x00000, 0x80000, CRC(6c326a31) SHA1(cd8ecc814ef4f379946ab3654dddd508c24ae56c) ) + + ROM_REGION32_LE( 0x200000, "game", 0 ) + ROM_LOAD16_BYTE( "DA5001FA Gamebase GME1.u21", 0x000000, 0x100000, CRC(4cd63b5f) SHA1(440302a6ac844b453573e358b29c64f2e8ece80e) ) + ROM_LOAD16_BYTE( "DA5001FA Gamebase GME2.u5", 0x000001, 0x100000, CRC(663df2fe) SHA1(d2ac3129a346450168a9f76431b0fa8b78db3b37) ) + + ROM_REGION( 0x100000, "cg", 0 ) + ROM_LOAD16_BYTE( "1G5019FA Multistar 7 PUB.u48", 0x000000, 0x80000, CRC(ac50a155) SHA1(50d07ba5ca176c97adde169fda6e6385c8ec8299) ) + ROM_LOAD16_BYTE( "1G5019FA Multistar 7 PUB.u47", 0x000001, 0x80000, CRC(5fee078b) SHA1(a41591d14fbc12c68d773fbd1ac340d9427d68e9) ) + + ROM_REGION( 0x200000, "plx", 0 ) + ROM_LOAD16_BYTE( "1G5019FA Multistar 7 PUB.u20", 0x000000, 0x100000, CRC(806ec7d4) SHA1(b9263f942b3d7101797bf87ad18cfddac9582791) ) + ROM_LOAD16_BYTE( "1G5019FA Multistar 7 PUB.u4", 0x000001, 0x100000, CRC(2e1e9c8a) SHA1(b6992f013f43debf43f4704396fc71e88449e365) ) + + ROM_REGION( 0x200000, "snd", 0 ) + ROM_LOAD( "1H5008FA Multistar 7.u6", 0x000000, 0x100000, CRC(69656637) SHA1(28c2cf48856ee4f820146fdbd0f3c7e307892dc6) ) +ROM_END + ROM_START( gkigt4 ) ROM_REGION( 0x80000, "maincpu", 0 ) @@ -369,6 +390,7 @@ ROM_START( gkkey ) ROM_END +GAME( 1994, ms72c, 0, igt_gameking, igt_gameking, driver_device, 0, ROT0, "IGT", "Multistar 7 2c", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) GAME( 2003, gkigt4, 0, igt_gameking, igt_gameking, driver_device, 0, ROT0, "IGT", "Game King (v4.x)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) GAME( 2003, gkigt4ms, gkigt4, igt_gameking, igt_gameking, driver_device, 0, ROT0, "IGT", "Game King (v4.x, MS)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) GAME( 2003, gkigt43, gkigt4, igt_gameking, igt_gameking, driver_device, 0, ROT0, "IGT", "Game King (v4.3)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -- cgit v1.2.3-70-g09d2 From 0be7219fbb56709f08c6c246e5bf89aceb68eb65 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 30 Jan 2016 13:46:26 +0100 Subject: user overriden parameters for compiling mc68k core (nw) --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index 00ad643427f..d56314ebd07 100644 --- a/makefile +++ b/makefile @@ -1267,7 +1267,7 @@ $(GENDIR)/%.lh: $(SRC)/%.lay scripts/build/file2str.py | $(GEN_FOLDERS) $(SILENT)$(PYTHON) scripts/build/file2str.py $< $@ layout_$(basename $(notdir $<)) $(SRC)/devices/cpu/m68000/m68kops.cpp: $(SRC)/devices/cpu/m68000/m68k_in.cpp $(SRC)/devices/cpu/m68000/m68kmake.cpp - $(SILENT) $(MAKE) -C $(SRC)/devices/cpu/m68000 + $(SILENT) $(MAKE) -C $(SRC)/devices/cpu/m68000 CC=$(CC) CXX=$(CXX) #------------------------------------------------- # Regression tests -- cgit v1.2.3-70-g09d2 From 37adee5d3eaf57ef1a7554781349eb6724326776 Mon Sep 17 00:00:00 2001 From: Ville Linde Date: Sat, 30 Jan 2016 16:16:42 +0200 Subject: cobra: register 0x114 is fb read pix/line count (nw) --- src/mame/drivers/cobra.cpp | 56 +++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/src/mame/drivers/cobra.cpp b/src/mame/drivers/cobra.cpp index c7b749278e5..848862363b2 100644 --- a/src/mame/drivers/cobra.cpp +++ b/src/mame/drivers/cobra.cpp @@ -155,7 +155,8 @@ 0x000a4: Viewport height / 2? 0x000ac: Viewport center Y - 0x00114: High word: framebuffer pitch? Low word: framebuffer pixel size? + 0x00114: xxxxxxxx xxxxxxxx -------- -------- Framebuffer pixel read line count + -------- -------- xxxxxxxx xxxxxxxx Framebuffer pixel read pixel count 0x00118: xxxxxxxx xxxxxxxx -------- -------- Framebuffer pixel read X pos -------- -------- xxxxxxxx xxxxxxxx Framebuffer pixel read Y pos @@ -1631,6 +1632,10 @@ WRITE64_MEMBER(cobra_state::main_fifo_w) gfx_ram[(0x38632c^4) / 4] = 0x38600000; // skip check_one_scene() } + // racjamdx + else if (strcmp(space.machine().system().name, "racjamdx") == 0) + { + } } m_main_debug_state = 0; @@ -2639,33 +2644,42 @@ void cobra_renderer::gfx_fifo_exec() { // Read a specified pixel position from a pixelbuffer -// printf("GFX: FB read X: %d, Y: %d\n", (UINT16)(m_gfx_gram[0x118/4] >> 16), (UINT16)(m_gfx_gram[0x118/4])); +// printf("GFX: FB read X: %d, Y: %d, %08X\n", (UINT16)(m_gfx_gram[0x118/4] >> 16), (UINT16)(m_gfx_gram[0x118/4]), m_gfx_gram[0x114/4]); int x = (m_gfx_gram[0x118/4] >> 16) & 0xffff; int y = m_gfx_gram[0x118/4] & 0xffff; - UINT32 *buffer; - switch (m_gfx_gram[0x80104/4]) - { - case 0x800000: buffer = &m_framebuffer->pix32(y); break; - case 0x200000: buffer = &m_backbuffer->pix32(y); break; - case 0x0e0000: buffer = &m_overlay->pix32(y); break; - case 0x000800: buffer = &m_zbuffer->pix32(y); break; - case 0x000200: buffer = &m_stencil->pix32(y); break; - - default: - { - fatalerror("gfxfifo_exec: fb read from buffer %08X!\n", m_gfx_gram[0x80100/4]); - } - } + int pix_count = m_gfx_gram[0x114/4] & 0xffff; + int line_count = (m_gfx_gram[0x114/4] >> 16) & 0xffff; // flush fifo_out so we have fresh data at top fifo_out->flush(); - fifo_out->push(nullptr, buffer[x+0]); - fifo_out->push(nullptr, buffer[x+1]); - fifo_out->push(nullptr, buffer[x+2]); - fifo_out->push(nullptr, buffer[x+3]); + if (pix_count != 4) + fatalerror("GFX: fb read line count %d, pix count %d\n", line_count, pix_count); + + for (int i=0; i < line_count; i++) + { + UINT32 *buffer; + switch (m_gfx_gram[0x80104/4]) + { + case 0x800000: buffer = &m_framebuffer->pix32(y+i); break; + case 0x200000: buffer = &m_backbuffer->pix32(y+i); break; + case 0x0e0000: buffer = &m_overlay->pix32(y+i); break; + case 0x000800: buffer = &m_zbuffer->pix32(y+i); break; + case 0x000200: buffer = &m_stencil->pix32(y+i); break; + + default: + { + fatalerror("gfxfifo_exec: fb read from buffer %08X!\n", m_gfx_gram[0x80100/4]); + } + } + + fifo_out->push(nullptr, buffer[x+0]); + fifo_out->push(nullptr, buffer[x+1]); + fifo_out->push(nullptr, buffer[x+2]); + fifo_out->push(nullptr, buffer[x+3]); + } cobra->m_gfx_re_status = RE_STATUS_IDLE; break; @@ -3022,7 +3036,7 @@ WRITE64_MEMBER(cobra_state::gfx_buf_w) // teximage_load() / mbuslib_prc_read(): 0x00A00001 0x10520800 -// printf("prc_read %08X%08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), activecpu_get_pc()); +// printf("prc_read %08X%08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), space.device().safe_pc()); m_renderer->gfx_fifo_exec(); -- cgit v1.2.3-70-g09d2 From 83e6738a0a26282606b21848a027963d63ef8f78 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 30 Jan 2016 13:25:32 -0500 Subject: Add macros for alignment checking (nw) --- src/devices/bus/ti99_peb/bwg.cpp | 2 +- src/devices/bus/ti99_peb/hfdc.cpp | 4 +- src/devices/cpu/arm/arm.cpp | 6 +-- src/devices/cpu/asap/asap.cpp | 8 ++-- src/devices/cpu/dsp32/dsp32.cpp | 12 ++++-- src/devices/cpu/hd61700/hd61700.cpp | 4 +- src/devices/cpu/i386/i386priv.h | 20 ++++----- src/devices/cpu/i8089/i8089.cpp | 4 +- src/devices/cpu/i960/i960.cpp | 8 ++-- src/devices/cpu/m37710/m37710il.h | 8 ++-- src/devices/cpu/m68000/m68kcpu.cpp | 36 ++++++++-------- src/devices/cpu/m68000/m68kcpu.h | 4 +- src/devices/cpu/se3208/se3208.cpp | 32 +++++--------- src/devices/video/i82730.cpp | 4 +- src/emu/debug/debugcpu.cpp | 18 ++++---- src/emu/luaengine.cpp | 12 +++--- src/emu/memory.cpp | 86 ++++++++++++++++++------------------- src/emu/memory.h | 6 +++ src/mame/drivers/cobra.cpp | 4 +- src/mame/drivers/magictg.cpp | 4 +- src/mame/machine/n64.cpp | 2 +- src/mame/video/seibuspi.cpp | 6 +-- 22 files changed, 144 insertions(+), 146 deletions(-) diff --git a/src/devices/bus/ti99_peb/bwg.cpp b/src/devices/bus/ti99_peb/bwg.cpp index 4085dcfe230..4716ccedf8a 100644 --- a/src/devices/bus/ti99_peb/bwg.cpp +++ b/src/devices/bus/ti99_peb/bwg.cpp @@ -151,7 +151,7 @@ SETADDRESS_DBIN_MEMBER( snug_bwg_device::setaddress_dbin ) && ((state==ASSERT_LINE && ((m_address & 0x1ff8)==0x1ff0)) // read || (state==CLEAR_LINE && ((m_address & 0x1ff8)==0x1ff8))); // write - m_WDsel = m_WDsel0 && ((m_address & 1)==0); + m_WDsel = m_WDsel0 && WORD_ALIGNED(m_address); // Is the RTC selected on the card? (even addr) m_RTCsel = m_inDsrArea && m_rtc_enabled && ((m_address & 0x1fe1)==0x1fe0); diff --git a/src/devices/bus/ti99_peb/hfdc.cpp b/src/devices/bus/ti99_peb/hfdc.cpp index c3e4779c1ef..46ca7a1b819 100644 --- a/src/devices/bus/ti99_peb/hfdc.cpp +++ b/src/devices/bus/ti99_peb/hfdc.cpp @@ -232,7 +232,7 @@ READ8Z_MEMBER(myarc_hfdc_device::readz) if (m_dip == CLEAR_LINE) *value = m_buffer_ram[(m_ram_page[bank]<<10) | (m_address & 0x03ff)]; if (TRACE_RAM) { - if ((m_address & 1)==0) // only show even addresses with words + if (WORD_ALIGNED(m_address)) { int valword = (((*value) << 8) | m_buffer_ram[(m_ram_page[bank]<<10) | ((m_address+1) & 0x03ff)])&0xffff; logerror("%s: %04x[%02x] -> %04x\n", tag(), m_address & 0xffff, m_ram_page[bank], valword); @@ -246,7 +246,7 @@ READ8Z_MEMBER(myarc_hfdc_device::readz) *value = m_dsrrom[(m_rom_page << 12) | (m_address & 0x0fff)]; if (TRACE_ROM) { - if ((m_address & 1)==0) // only show even addresses with words + if (WORD_ALIGNED(m_address)) { int valword = (((*value) << 8) | m_dsrrom[(m_rom_page << 12) | ((m_address + 1) & 0x0fff)])&0xffff; logerror("%s: %04x[%02x] -> %04x\n", tag(), m_address & 0xffff, m_rom_page, valword); diff --git a/src/devices/cpu/arm/arm.cpp b/src/devices/cpu/arm/arm.cpp index 41724668f53..34dc1635639 100644 --- a/src/devices/cpu/arm/arm.cpp +++ b/src/devices/cpu/arm/arm.cpp @@ -259,7 +259,7 @@ void arm_cpu_device::cpu_write32( int addr, UINT32 data ) { /* Unaligned writes are treated as normal writes */ m_program->write_dword(addr&ADDRESS_MASK,data); - if (ARM_DEBUG_CORE && addr&3) logerror("%08x: Unaligned write %08x\n",R15,addr); + if (ARM_DEBUG_CORE && !DWORD_ALIGNED(addr)) logerror("%08x: Unaligned write %08x\n",R15,addr); } void arm_cpu_device::cpu_write8( int addr, UINT8 data ) @@ -272,9 +272,9 @@ UINT32 arm_cpu_device::cpu_read32( int addr ) UINT32 result = m_program->read_dword(addr&ADDRESS_MASK); /* Unaligned reads rotate the word, they never combine words */ - if (addr&3) + if (!DWORD_ALIGNED(addr)) { - if (ARM_DEBUG_CORE && addr&1) + if (ARM_DEBUG_CORE && !WORD_ALIGNED(addr)) logerror("%08x: Unaligned byte read %08x\n",R15,addr); if ((addr&3)==1) diff --git a/src/devices/cpu/asap/asap.cpp b/src/devices/cpu/asap/asap.cpp index c22d0cdcee2..b369ab6d07b 100644 --- a/src/devices/cpu/asap/asap.cpp +++ b/src/devices/cpu/asap/asap.cpp @@ -364,7 +364,7 @@ inline UINT8 asap_device::readbyte(offs_t address) inline UINT16 asap_device::readword(offs_t address) { // aligned reads are easy - if (!(address & 1)) + if (WORD_ALIGNED(address)) return m_program->read_word(address); // misaligned reads are tricky @@ -379,7 +379,7 @@ inline UINT16 asap_device::readword(offs_t address) inline UINT32 asap_device::readlong(offs_t address) { // aligned reads are easy - if (!(address & 3)) + if (DWORD_ALIGNED(address)) return m_program->read_dword(address); // misaligned reads are tricky @@ -405,7 +405,7 @@ inline void asap_device::writebyte(offs_t address, UINT8 data) inline void asap_device::writeword(offs_t address, UINT16 data) { // aligned writes are easy - if (!(address & 1)) + if (WORD_ALIGNED(address)) { m_program->write_word(address, data); return; @@ -429,7 +429,7 @@ inline void asap_device::writeword(offs_t address, UINT16 data) inline void asap_device::writelong(offs_t address, UINT32 data) { // aligned writes are easy - if (!(address & 3)) + if (DWORD_ALIGNED(address)) { m_program->write_dword(address, data); return; diff --git a/src/devices/cpu/dsp32/dsp32.cpp b/src/devices/cpu/dsp32/dsp32.cpp index f060e81d13c..98640f7d1b4 100644 --- a/src/devices/cpu/dsp32/dsp32.cpp +++ b/src/devices/cpu/dsp32/dsp32.cpp @@ -452,7 +452,8 @@ inline void dsp32c_device::WBYTE(offs_t addr, UINT8 data) inline UINT16 dsp32c_device::RWORD(offs_t addr) { #if DETECT_MISALIGNED_MEMORY - if (addr & 1) fprintf(stderr, "Unaligned word read @ %06X, PC=%06X\n", addr, PC); + if (!WORD_ALIGNED(addr)) + osd_printf_error("Unaligned word read @ %06X, PC=%06X\n", addr, PC); #endif return m_program->read_word(addr); } @@ -460,7 +461,8 @@ inline UINT16 dsp32c_device::RWORD(offs_t addr) inline UINT32 dsp32c_device::RLONG(offs_t addr) { #if DETECT_MISALIGNED_MEMORY - if (addr & 3) fprintf(stderr, "Unaligned long read @ %06X, PC=%06X\n", addr, PC); + if (!DWORD_ALIGNED(addr)) + osd_printf_error("Unaligned long read @ %06X, PC=%06X\n", addr, PC); #endif return m_program->read_dword(addr); } @@ -468,7 +470,8 @@ inline UINT32 dsp32c_device::RLONG(offs_t addr) inline void dsp32c_device::WWORD(offs_t addr, UINT16 data) { #if DETECT_MISALIGNED_MEMORY - if (addr & 1) fprintf(stderr, "Unaligned word write @ %06X, PC=%06X\n", addr, PC); + if (!WORD_ALIGNED(addr)) + osd_printf_error("Unaligned word write @ %06X, PC=%06X\n", addr, PC); #endif m_program->write_word(addr, data); } @@ -476,7 +479,8 @@ inline void dsp32c_device::WWORD(offs_t addr, UINT16 data) inline void dsp32c_device::WLONG(offs_t addr, UINT32 data) { #if DETECT_MISALIGNED_MEMORY - if (addr & 3) fprintf(stderr, "Unaligned long write @ %06X, PC=%06X\n", addr, PC); + if (!DWORD_ALIGNED(addr)) + osd_printf_error("Unaligned long write @ %06X, PC=%06X\n", addr, PC); #endif m_program->write_dword(addr, data); } diff --git a/src/devices/cpu/hd61700/hd61700.cpp b/src/devices/cpu/hd61700/hd61700.cpp index c786c7235ba..4e8d2c6590d 100644 --- a/src/devices/cpu/hd61700/hd61700.cpp +++ b/src/devices/cpu/hd61700/hd61700.cpp @@ -2654,7 +2654,7 @@ void hd61700_cpu_device::execute_run() } //if is in the internal ROM align the pc - if ((m_fetch_addr&1) && m_pc < INT_ROM) + if (!WORD_ALIGNED(m_fetch_addr) && m_pc < INT_ROM) set_pc((m_fetch_addr+1)>>1); m_icount -= 3; @@ -2871,7 +2871,7 @@ inline void hd61700_cpu_device::check_optional_jr(UINT8 arg) { if (arg & 0x80) { - if (m_pc < INT_ROM && !(m_fetch_addr&1)) read_op(); + if (m_pc < INT_ROM && WORD_ALIGNED(m_fetch_addr)) read_op(); UINT8 arg1 = read_op(); diff --git a/src/devices/cpu/i386/i386priv.h b/src/devices/cpu/i386/i386priv.h index 9913d851fa2..fa7ae0d4945 100644 --- a/src/devices/cpu/i386/i386priv.h +++ b/src/devices/cpu/i386/i386priv.h @@ -557,7 +557,7 @@ UINT16 i386_device::FETCH16() UINT16 value; UINT32 address = m_pc, error; - if( address & 0x1 ) { /* Unaligned read */ + if( !WORD_ALIGNED(address) ) { /* Unaligned read */ value = (FETCH() << 0); value |= (FETCH() << 8); } else { @@ -575,7 +575,7 @@ UINT32 i386_device::FETCH32() UINT32 value; UINT32 address = m_pc, error; - if( m_pc & 0x3 ) { /* Unaligned read */ + if( !DWORD_ALIGNED(m_pc) ) { /* Unaligned read */ value = (FETCH() << 0); value |= (FETCH() << 8); value |= (FETCH() << 16); @@ -607,7 +607,7 @@ UINT16 i386_device::READ16(UINT32 ea) UINT16 value; UINT32 address = ea, error; - if( ea & 0x1 ) { /* Unaligned read */ + if( !WORD_ALIGNED(ea) ) { /* Unaligned read */ value = (READ8( address+0 ) << 0); value |= (READ8( address+1 ) << 8); } else { @@ -624,7 +624,7 @@ UINT32 i386_device::READ32(UINT32 ea) UINT32 value; UINT32 address = ea, error; - if( ea & 0x3 ) { /* Unaligned read */ + if( !DWORD_ALIGNED(ea) ) { /* Unaligned read */ value = (READ8( address+0 ) << 0); value |= (READ8( address+1 ) << 8); value |= (READ8( address+2 ) << 16), @@ -644,7 +644,7 @@ UINT64 i386_device::READ64(UINT32 ea) UINT64 value; UINT32 address = ea, error; - if( ea & 0x7 ) { /* Unaligned read */ + if( !QWORD_ALIGNED(ea) ) { /* Unaligned read */ value = (((UINT64) READ8( address+0 )) << 0); value |= (((UINT64) READ8( address+1 )) << 8); value |= (((UINT64) READ8( address+2 )) << 16); @@ -678,7 +678,7 @@ UINT16 i386_device::READ16PL0(UINT32 ea) UINT16 value; UINT32 address = ea, error; - if( ea & 0x1 ) { /* Unaligned read */ + if( !WORD_ALIGNED(ea) ) { /* Unaligned read */ value = (READ8PL0( address+0 ) << 0); value |= (READ8PL0( address+1 ) << 8); } else { @@ -696,7 +696,7 @@ UINT32 i386_device::READ32PL0(UINT32 ea) UINT32 value; UINT32 address = ea, error; - if( ea & 0x3 ) { /* Unaligned read */ + if( !DWORD_ALIGNED(ea) ) { /* Unaligned read */ value = (READ8PL0( address+0 ) << 0); value |= (READ8PL0( address+1 ) << 8); value |= (READ8PL0( address+2 ) << 16); @@ -732,7 +732,7 @@ void i386_device::WRITE16(UINT32 ea, UINT16 value) { UINT32 address = ea, error; - if( ea & 0x1 ) { /* Unaligned write */ + if( !WORD_ALIGNED(ea) ) { /* Unaligned write */ WRITE8( address+0, value & 0xff ); WRITE8( address+1, (value >> 8) & 0xff ); } else { @@ -747,7 +747,7 @@ void i386_device::WRITE32(UINT32 ea, UINT32 value) { UINT32 address = ea, error; - if( ea & 0x3 ) { /* Unaligned write */ + if( !DWORD_ALIGNED(ea) ) { /* Unaligned write */ WRITE8( address+0, value & 0xff ); WRITE8( address+1, (value >> 8) & 0xff ); WRITE8( address+2, (value >> 16) & 0xff ); @@ -765,7 +765,7 @@ void i386_device::WRITE64(UINT32 ea, UINT64 value) { UINT32 address = ea, error; - if( ea & 0x7 ) { /* Unaligned write */ + if( !QWORD_ALIGNED(ea) ) { /* Unaligned write */ WRITE8( address+0, value & 0xff ); WRITE8( address+1, (value >> 8) & 0xff ); WRITE8( address+2, (value >> 16) & 0xff ); diff --git a/src/devices/cpu/i8089/i8089.cpp b/src/devices/cpu/i8089/i8089.cpp index 22494cfdd2f..ade9e4f768b 100644 --- a/src/devices/cpu/i8089/i8089.cpp +++ b/src/devices/cpu/i8089/i8089.cpp @@ -289,7 +289,7 @@ UINT16 i8089_device::read_word(bool space, offs_t address) UINT16 data; address_space *aspace = (space ? m_io : m_mem); - if (sysbus_width() && !(address & 1)) + if (sysbus_width() && WORD_ALIGNED(address)) { data = aspace->read_word(address); } @@ -311,7 +311,7 @@ void i8089_device::write_word(bool space, offs_t address, UINT16 data) { address_space *aspace = (space ? m_io : m_mem); - if (sysbus_width() && !(address & 1)) + if (sysbus_width() && WORD_ALIGNED(address)) { aspace->write_word(address, data); } diff --git a/src/devices/cpu/i960/i960.cpp b/src/devices/cpu/i960/i960.cpp index 224b844387c..f754445379b 100644 --- a/src/devices/cpu/i960/i960.cpp +++ b/src/devices/cpu/i960/i960.cpp @@ -26,7 +26,7 @@ i960_cpu_device::i960_cpu_device(const machine_config &mconfig, const char *tag, UINT32 i960_cpu_device::i960_read_dword_unaligned(UINT32 address) { - if (address & 3) + if (!DWORD_ALIGNED(address)) return m_program->read_byte(address) | m_program->read_byte(address+1)<<8 | m_program->read_byte(address+2)<<16 | m_program->read_byte(address+3)<<24; else return m_program->read_dword(address); @@ -34,7 +34,7 @@ UINT32 i960_cpu_device::i960_read_dword_unaligned(UINT32 address) UINT16 i960_cpu_device::i960_read_word_unaligned(UINT32 address) { - if (address & 1) + if (!WORD_ALIGNED(address)) return m_program->read_byte(address) | m_program->read_byte(address+1)<<8; else return m_program->read_word(address); @@ -42,7 +42,7 @@ UINT16 i960_cpu_device::i960_read_word_unaligned(UINT32 address) void i960_cpu_device::i960_write_dword_unaligned(UINT32 address, UINT32 data) { - if (address & 3) + if (!DWORD_ALIGNED(address)) { m_program->write_byte(address, data & 0xff); m_program->write_byte(address+1, (data>>8)&0xff); @@ -57,7 +57,7 @@ void i960_cpu_device::i960_write_dword_unaligned(UINT32 address, UINT32 data) void i960_cpu_device::i960_write_word_unaligned(UINT32 address, UINT16 data) { - if (address & 1) + if (!WORD_ALIGNED(address)) { m_program->write_byte(address, data & 0xff); m_program->write_byte(address+1, (data>>8)&0xff); diff --git a/src/devices/cpu/m37710/m37710il.h b/src/devices/cpu/m37710/m37710il.h index ffc1aed0a7a..eb79f0fddd6 100644 --- a/src/devices/cpu/m37710/m37710il.h +++ b/src/devices/cpu/m37710/m37710il.h @@ -42,7 +42,7 @@ inline UINT32 m37710_cpu_device::m37710i_read_16_normal(UINT32 address) inline UINT32 m37710_cpu_device::m37710i_read_16_immediate(UINT32 address) { - if (address & 1) + if (!WORD_ALIGNED(address)) return m37710_read_8_immediate(address) | (m37710_read_8_immediate(address+1)<<8); else return m37710_read_16_immediate(address); @@ -65,7 +65,7 @@ inline void m37710_cpu_device::m37710i_write_16_direct(UINT32 address, UINT32 va inline UINT32 m37710_cpu_device::m37710i_read_24_normal(UINT32 address) { - if (address & 1) + if (!WORD_ALIGNED(address)) return m37710_read_8(address) | (m37710_read_16(address+1)<<8); else return m37710_read_16(address) | (m37710_read_8(address+2)<<16); @@ -73,7 +73,7 @@ inline UINT32 m37710_cpu_device::m37710i_read_24_normal(UINT32 address) inline UINT32 m37710_cpu_device::m37710i_read_24_immediate(UINT32 address) { - if (address & 1) + if (!WORD_ALIGNED(address)) return m37710_read_8_immediate(address) | (m37710_read_16_immediate(address+1)<<8); else return m37710_read_16_immediate(address) | (m37710_read_8_immediate(address+2)<<16); @@ -81,7 +81,7 @@ inline UINT32 m37710_cpu_device::m37710i_read_24_immediate(UINT32 address) inline UINT32 m37710_cpu_device::m37710i_read_24_direct(UINT32 address) { - if (address & 1) + if (!WORD_ALIGNED(address)) return m37710_read_8(address) | (m37710_read_16(address+1)<<8); else return m37710_read_16(address) | (m37710_read_8(address+2)<<16); diff --git a/src/devices/cpu/m68000/m68kcpu.cpp b/src/devices/cpu/m68000/m68kcpu.cpp index dc7e0b14a6f..aaa1db079cf 100644 --- a/src/devices/cpu/m68000/m68kcpu.cpp +++ b/src/devices/cpu/m68000/m68kcpu.cpp @@ -1383,7 +1383,7 @@ UINT16 m68000_base_device::readword_d32_mmu(offs_t address) UINT32 address0 = pmmu_translate_addr(this, address); if (mmu_tmp_buserror_occurred) { return ~0; - } else if (!(address & 1)) { + } else if (WORD_ALIGNED(address)) { return m_space->read_word(address0); } else { UINT32 address1 = pmmu_translate_addr(this, address + 1); @@ -1396,7 +1396,7 @@ UINT16 m68000_base_device::readword_d32_mmu(offs_t address) } } - if (!(address & 1)) + if (WORD_ALIGNED(address)) return m_space->read_word(address); result = m_space->read_byte(address) << 8; return result | m_space->read_byte(address + 1); @@ -1410,7 +1410,7 @@ void m68000_base_device::writeword_d32_mmu(offs_t address, UINT16 data) UINT32 address0 = pmmu_translate_addr(this, address); if (mmu_tmp_buserror_occurred) { return; - } else if (!(address & 1)) { + } else if (WORD_ALIGNED(address)) { m_space->write_word(address0, data); return; } else { @@ -1425,7 +1425,7 @@ void m68000_base_device::writeword_d32_mmu(offs_t address, UINT16 data) } } - if (!(address & 1)) + if (WORD_ALIGNED(address)) { m_space->write_word(address, data); return; @@ -1447,13 +1447,13 @@ UINT32 m68000_base_device::readlong_d32_mmu(offs_t address) } else if ((address +3) & 0xfc) { // not at page boundary; use default code address = address0; - } else if (!(address & 3)) { // 0 + } else if (DWORD_ALIGNED(address)) { // 0 return m_space->read_dword(address0); } else { UINT32 address2 = pmmu_translate_addr(this, address+2); if (mmu_tmp_buserror_occurred) { return ~0; - } else if (!(address & 1)) { // 2 + } else if (WORD_ALIGNED(address)) { // 2 result = m_space->read_word(address0) << 16; return result | m_space->read_word(address2); } else { @@ -1470,9 +1470,9 @@ UINT32 m68000_base_device::readlong_d32_mmu(offs_t address) } } - if (!(address & 3)) + if (DWORD_ALIGNED(address)) return m_space->read_dword(address); - else if (!(address & 1)) + else if (WORD_ALIGNED(address)) { result = m_space->read_word(address) << 16; return result | m_space->read_word(address + 2); @@ -1493,14 +1493,14 @@ void m68000_base_device::writelong_d32_mmu(offs_t address, UINT32 data) } else if ((address +3) & 0xfc) { // not at page boundary; use default code address = address0; - } else if (!(address & 3)) { // 0 + } else if (DWORD_ALIGNED(address)) { // 0 m_space->write_dword(address0, data); return; } else { UINT32 address2 = pmmu_translate_addr(this, address+2); if (mmu_tmp_buserror_occurred) { return; - } else if (!(address & 1)) { // 2 + } else if (WORD_ALIGNED(address)) { // 2 m_space->write_word(address0, data >> 16); m_space->write_word(address2, data); return; @@ -1519,12 +1519,12 @@ void m68000_base_device::writelong_d32_mmu(offs_t address, UINT32 data) } } - if (!(address & 3)) + if (DWORD_ALIGNED(address)) { m_space->write_dword(address, data); return; } - else if (!(address & 1)) + else if (WORD_ALIGNED(address)) { m_space->write_word(address, data >> 16); m_space->write_word(address + 2, data); @@ -1594,7 +1594,7 @@ UINT16 m68000_base_device::readword_d32_hmmu(offs_t address) address = hmmu_translate_addr(this, address); } - if (!(address & 1)) + if (WORD_ALIGNED(address)) return m_space->read_word(address); result = m_space->read_byte(address) << 8; return result | m_space->read_byte(address + 1); @@ -1608,7 +1608,7 @@ void m68000_base_device::writeword_d32_hmmu(offs_t address, UINT16 data) address = hmmu_translate_addr(this, address); } - if (!(address & 1)) + if (WORD_ALIGNED(address)) { m_space->write_word(address, data); return; @@ -1627,9 +1627,9 @@ UINT32 m68000_base_device::readlong_d32_hmmu(offs_t address) address = hmmu_translate_addr(this, address); } - if (!(address & 3)) + if (DWORD_ALIGNED(address)) return m_space->read_dword(address); - else if (!(address & 1)) + else if (WORD_ALIGNED(address)) { result = m_space->read_word(address) << 16; return result | m_space->read_word(address + 2); @@ -1647,12 +1647,12 @@ void m68000_base_device::writelong_d32_hmmu(offs_t address, UINT32 data) address = hmmu_translate_addr(this, address); } - if (!(address & 3)) + if (DWORD_ALIGNED(address)) { m_space->write_dword(address, data); return; } - else if (!(address & 1)) + else if (WORD_ALIGNED(address)) { m_space->write_word(address, data >> 16); m_space->write_word(address + 2, data); diff --git a/src/devices/cpu/m68000/m68kcpu.h b/src/devices/cpu/m68000/m68kcpu.h index 5cec889e002..7860298988f 100644 --- a/src/devices/cpu/m68000/m68kcpu.h +++ b/src/devices/cpu/m68000/m68kcpu.h @@ -626,7 +626,7 @@ static inline unsigned int m68k_read_pcrelative_8(m68000_base_device *m68k, unsi static inline unsigned int m68k_read_pcrelative_16(m68000_base_device *m68k, unsigned int address) { - if(address & 1) + if (!WORD_ALIGNED(address)) return (m68k->readimm16(address-1) << 8) | (m68k->readimm16(address+1) >> 8); @@ -638,7 +638,7 @@ static inline unsigned int m68k_read_pcrelative_16(m68000_base_device *m68k, uns static inline unsigned int m68k_read_pcrelative_32(m68000_base_device *m68k, unsigned int address) { - if(address & 1) + if (!WORD_ALIGNED(address)) return (m68k->readimm16(address-1) << 24) | (m68k->readimm16(address+1) << 8) | diff --git a/src/devices/cpu/se3208/se3208.cpp b/src/devices/cpu/se3208/se3208.cpp index 011cc103909..45c4c38cc86 100644 --- a/src/devices/cpu/se3208/se3208.cpp +++ b/src/devices/cpu/se3208/se3208.cpp @@ -54,27 +54,22 @@ se3208_device::se3208_device(const machine_config &mconfig, const char *tag, dev UINT32 se3208_device::read_dword_unaligned(address_space &space, UINT32 address) { - switch (address & 3) - { - case 0: + if (DWORD_ALIGNED(address)) return space.read_dword(address); - case 1: - case 2: - case 3: - printf("%08x: dword READ unaligned %08x\n", m_PC, address); + else + { + osd_printf_debug("%08x: dword READ unaligned %08x\n", m_PC, address); #if ALLOW_UNALIGNED_DWORD_ACCESS return space.read_byte(address) | space.read_byte(address + 1) << 8 | space.read_byte(address + 2) << 16 | space.read_byte(address + 3) << 24; #else return 0; #endif } - - return 0; } UINT16 se3208_device::read_word_unaligned(address_space &space, UINT32 address) { - if (address & 1) + if (!WORD_ALIGNED(address)) return space.read_byte(address) | space.read_byte(address+1)<<8; else return space.read_word(address); @@ -82,31 +77,24 @@ UINT16 se3208_device::read_word_unaligned(address_space &space, UINT32 address) void se3208_device::write_dword_unaligned(address_space &space, UINT32 address, UINT32 data) { - switch (address & 3) - { - case 0: + if (DWORD_ALIGNED(address)) space.write_dword(address, data); - break; - - case 1: - case 2: - case 3: + else + { #if ALLOW_UNALIGNED_DWORD_ACCESS space.write_byte(address, data & 0xff); space.write_byte(address + 1, (data >> 8) & 0xff); space.write_byte(address + 2, (data >> 16) & 0xff); space.write_byte(address + 3, (data >> 24) & 0xff); #endif - printf("%08x: dword WRITE unaligned %08x\n", m_PC, address); - - break; + osd_printf_debug("%08x: dword WRITE unaligned %08x\n", m_PC, address); } } void se3208_device::write_word_unaligned(address_space &space, UINT32 address, UINT16 data) { - if (address & 1) + if (!WORD_ALIGNED(address)) { space.write_byte(address, data & 0xff); space.write_byte(address+1, (data>>8)&0xff); diff --git a/src/devices/video/i82730.cpp b/src/devices/video/i82730.cpp index d344c7006ef..8cd78863df3 100644 --- a/src/devices/video/i82730.cpp +++ b/src/devices/video/i82730.cpp @@ -128,7 +128,7 @@ UINT16 i82730_device::read_word(offs_t address) { UINT16 data; - if (sysbus_16bit() && !(address & 1)) + if (sysbus_16bit() && WORD_ALIGNED(address)) { data = m_program->read_word(address); } @@ -148,7 +148,7 @@ void i82730_device::write_byte(offs_t address, UINT8 data) void i82730_device::write_word(offs_t address, UINT16 data) { - if (sysbus_16bit() && !(address & 1)) + if (sysbus_16bit() && WORD_ALIGNED(address)) { m_program->write_word(address, data); } diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 82c175251fe..293657b1f45 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -486,7 +486,7 @@ UINT16 debug_read_word(address_space &space, offs_t address, int apply_translati address &= space.logbytemask(); /* if this is misaligned read, or if there are no word readers, just read two bytes */ - if ((address & 1) != 0) + if (!WORD_ALIGNED(address)) { UINT8 byte0 = debug_read_byte(space, address + 0, apply_translation); UINT8 byte1 = debug_read_byte(space, address + 1, apply_translation); @@ -540,7 +540,7 @@ UINT32 debug_read_dword(address_space &space, offs_t address, int apply_translat address &= space.logbytemask(); /* if this is misaligned read, or if there are no dword readers, just read two words */ - if ((address & 3) != 0) + if (!DWORD_ALIGNED(address)) { UINT16 word0 = debug_read_word(space, address + 0, apply_translation); UINT16 word1 = debug_read_word(space, address + 2, apply_translation); @@ -594,7 +594,7 @@ UINT64 debug_read_qword(address_space &space, offs_t address, int apply_translat address &= space.logbytemask(); /* if this is misaligned read, or if there are no qword readers, just read two dwords */ - if ((address & 7) != 0) + if (!QWORD_ALIGNED(address)) { UINT32 dword0 = debug_read_dword(space, address + 0, apply_translation); UINT32 dword1 = debug_read_dword(space, address + 4, apply_translation); @@ -699,7 +699,7 @@ void debug_write_word(address_space &space, offs_t address, UINT16 data, int app address &= space.logbytemask(); /* if this is a misaligned write, or if there are no word writers, just read two bytes */ - if ((address & 1) != 0) + if (!WORD_ALIGNED(address)) { if (space.endianness() == ENDIANNESS_LITTLE) { @@ -751,7 +751,7 @@ void debug_write_dword(address_space &space, offs_t address, UINT32 data, int ap address &= space.logbytemask(); /* if this is a misaligned write, or if there are no dword writers, just read two words */ - if ((address & 3) != 0) + if (!DWORD_ALIGNED(address)) { if (space.endianness() == ENDIANNESS_LITTLE) { @@ -803,7 +803,7 @@ void debug_write_qword(address_space &space, offs_t address, UINT64 data, int ap address &= space.logbytemask(); /* if this is a misaligned write, or if there are no qword writers, just read two dwords */ - if ((address & 7) != 0) + if (!QWORD_ALIGNED(address)) { if (space.endianness() == ENDIANNESS_LITTLE) { @@ -966,7 +966,7 @@ UINT64 debug_read_opcode(address_space &space, offs_t address, int size) case 2: result = space.direct().read_word(address & ~1, addrxor); - if ((address & 1) != 0) + if (!WORD_ALIGNED(address)) { result2 = space.direct().read_word((address & ~1) + 2, addrxor); if (space.endianness() == ENDIANNESS_LITTLE) @@ -979,7 +979,7 @@ UINT64 debug_read_opcode(address_space &space, offs_t address, int size) case 4: result = space.direct().read_dword(address & ~3, addrxor); - if ((address & 3) != 0) + if (!DWORD_ALIGNED(address)) { result2 = space.direct().read_dword((address & ~3) + 4, addrxor); if (space.endianness() == ENDIANNESS_LITTLE) @@ -992,7 +992,7 @@ UINT64 debug_read_opcode(address_space &space, offs_t address, int size) case 8: result = space.direct().read_qword(address & ~7, addrxor); - if ((address & 7) != 0) + if (!QWORD_ALIGNED(address)) { result2 = space.direct().read_qword((address & ~7) + 8, addrxor); if (space.endianness() == ENDIANNESS_LITTLE) diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index f1d12757ed7..f8ec7023bc6 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -505,21 +505,21 @@ int lua_engine::lua_addr_space::l_mem_read(lua_State *L) mem_content = sp.read_byte(address); break; case 16: - if ((address & 1) == 0) { + if (WORD_ALIGNED(address)) { mem_content = sp.read_word(address); } else { mem_content = sp.read_word_unaligned(address); } break; case 32: - if ((address & 3) == 0) { + if (DWORD_ALIGNED(address)) { mem_content = sp.read_dword(address); } else { mem_content = sp.read_dword_unaligned(address); } break; case 64: - if ((address & 7) == 0) { + if (QWORD_ALIGNED(address)) { mem_content = sp.read_qword(address); } else { mem_content = sp.read_qword_unaligned(address); @@ -558,21 +558,21 @@ int lua_engine::lua_addr_space::l_mem_write(lua_State *L) sp.write_byte(address, val); break; case 16: - if ((address & 1) == 0) { + if (WORD_ALIGNED(address)) { sp.write_word(address, val); } else { sp.read_word_unaligned(address, val); } break; case 32: - if ((address & 3) == 0) { + if (DWORD_ALIGNED(address)) { sp.write_dword(address, val); } else { sp.write_dword_unaligned(address, val); } break; case 64: - if ((address & 7) == 0) { + if (QWORD_ALIGNED(address)) { sp.write_qword(address, val); } else { sp.write_qword_unaligned(address, val); diff --git a/src/emu/memory.cpp b/src/emu/memory.cpp index 598ffab9ac6..656c00fd626 100644 --- a/src/emu/memory.cpp +++ b/src/emu/memory.cpp @@ -896,9 +896,9 @@ public: printf(" read_byte = "); printf("%02X\n", result8 = read_byte(address)); assert(result8 == expected8); // validate word accesses (if aligned) - if (address % 2 == 0) { printf(" read_word = "); printf("%04X\n", result16 = read_word(address)); assert(result16 == expected16); } - if (address % 2 == 0) { printf(" read_word (0xff00) = "); printf("%04X\n", result16 = read_word(address, 0xff00)); assert((result16 & 0xff00) == (expected16 & 0xff00)); } - if (address % 2 == 0) { printf(" (0x00ff) = "); printf("%04X\n", result16 = read_word(address, 0x00ff)); assert((result16 & 0x00ff) == (expected16 & 0x00ff)); } + if (WORD_ALIGNED(address)) { printf(" read_word = "); printf("%04X\n", result16 = read_word(address)); assert(result16 == expected16); } + if (WORD_ALIGNED(address)) { printf(" read_word (0xff00) = "); printf("%04X\n", result16 = read_word(address, 0xff00)); assert((result16 & 0xff00) == (expected16 & 0xff00)); } + if (WORD_ALIGNED(address)) { printf(" (0x00ff) = "); printf("%04X\n", result16 = read_word(address, 0x00ff)); assert((result16 & 0x00ff) == (expected16 & 0x00ff)); } // validate unaligned word accesses printf(" read_word_unaligned = "); printf("%04X\n", result16 = read_word_unaligned(address)); assert(result16 == expected16); @@ -906,15 +906,15 @@ public: printf(" (0x00ff) = "); printf("%04X\n", result16 = read_word_unaligned(address, 0x00ff)); assert((result16 & 0x00ff) == (expected16 & 0x00ff)); // validate dword acceses (if aligned) - if (address % 4 == 0) { printf(" read_dword = "); printf("%08X\n", result32 = read_dword(address)); assert(result32 == expected32); } - if (address % 4 == 0) { printf(" read_dword (0xff000000) = "); printf("%08X\n", result32 = read_dword(address, 0xff000000)); assert((result32 & 0xff000000) == (expected32 & 0xff000000)); } - if (address % 4 == 0) { printf(" (0x00ff0000) = "); printf("%08X\n", result32 = read_dword(address, 0x00ff0000)); assert((result32 & 0x00ff0000) == (expected32 & 0x00ff0000)); } - if (address % 4 == 0) { printf(" (0x0000ff00) = "); printf("%08X\n", result32 = read_dword(address, 0x0000ff00)); assert((result32 & 0x0000ff00) == (expected32 & 0x0000ff00)); } - if (address % 4 == 0) { printf(" (0x000000ff) = "); printf("%08X\n", result32 = read_dword(address, 0x000000ff)); assert((result32 & 0x000000ff) == (expected32 & 0x000000ff)); } - if (address % 4 == 0) { printf(" (0xffff0000) = "); printf("%08X\n", result32 = read_dword(address, 0xffff0000)); assert((result32 & 0xffff0000) == (expected32 & 0xffff0000)); } - if (address % 4 == 0) { printf(" (0x0000ffff) = "); printf("%08X\n", result32 = read_dword(address, 0x0000ffff)); assert((result32 & 0x0000ffff) == (expected32 & 0x0000ffff)); } - if (address % 4 == 0) { printf(" (0xffffff00) = "); printf("%08X\n", result32 = read_dword(address, 0xffffff00)); assert((result32 & 0xffffff00) == (expected32 & 0xffffff00)); } - if (address % 4 == 0) { printf(" (0x00ffffff) = "); printf("%08X\n", result32 = read_dword(address, 0x00ffffff)); assert((result32 & 0x00ffffff) == (expected32 & 0x00ffffff)); } + if (DWORD_ALIGNED(address)) { printf(" read_dword = "); printf("%08X\n", result32 = read_dword(address)); assert(result32 == expected32); } + if (DWORD_ALIGNED(address)) { printf(" read_dword (0xff000000) = "); printf("%08X\n", result32 = read_dword(address, 0xff000000)); assert((result32 & 0xff000000) == (expected32 & 0xff000000)); } + if (DWORD_ALIGNED(address)) { printf(" (0x00ff0000) = "); printf("%08X\n", result32 = read_dword(address, 0x00ff0000)); assert((result32 & 0x00ff0000) == (expected32 & 0x00ff0000)); } + if (DWORD_ALIGNED(address)) { printf(" (0x0000ff00) = "); printf("%08X\n", result32 = read_dword(address, 0x0000ff00)); assert((result32 & 0x0000ff00) == (expected32 & 0x0000ff00)); } + if (DWORD_ALIGNED(address)) { printf(" (0x000000ff) = "); printf("%08X\n", result32 = read_dword(address, 0x000000ff)); assert((result32 & 0x000000ff) == (expected32 & 0x000000ff)); } + if (DWORD_ALIGNED(address)) { printf(" (0xffff0000) = "); printf("%08X\n", result32 = read_dword(address, 0xffff0000)); assert((result32 & 0xffff0000) == (expected32 & 0xffff0000)); } + if (DWORD_ALIGNED(address)) { printf(" (0x0000ffff) = "); printf("%08X\n", result32 = read_dword(address, 0x0000ffff)); assert((result32 & 0x0000ffff) == (expected32 & 0x0000ffff)); } + if (DWORD_ALIGNED(address)) { printf(" (0xffffff00) = "); printf("%08X\n", result32 = read_dword(address, 0xffffff00)); assert((result32 & 0xffffff00) == (expected32 & 0xffffff00)); } + if (DWORD_ALIGNED(address)) { printf(" (0x00ffffff) = "); printf("%08X\n", result32 = read_dword(address, 0x00ffffff)); assert((result32 & 0x00ffffff) == (expected32 & 0x00ffffff)); } // validate unaligned dword accesses printf(" read_dword_unaligned = "); printf("%08X\n", result32 = read_dword_unaligned(address)); assert(result32 == expected32); @@ -928,37 +928,37 @@ public: printf(" (0x00ffffff) = "); printf("%08X\n", result32 = read_dword_unaligned(address, 0x00ffffff)); assert((result32 & 0x00ffffff) == (expected32 & 0x00ffffff)); // validate qword acceses (if aligned) - if (address % 8 == 0) { printf(" read_qword = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address), 16)); assert(result64 == expected64); } - if (address % 8 == 0) { printf(" read_qword (0xff00000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xff00000000000000)), 16)); assert((result64 & U64(0xff00000000000000)) == (expected64 & U64(0xff00000000000000))); } - if (address % 8 == 0) { printf(" (0x00ff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ff000000000000)), 16)); assert((result64 & U64(0x00ff000000000000)) == (expected64 & U64(0x00ff000000000000))); } - if (address % 8 == 0) { printf(" (0x0000ff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ff0000000000)), 16)); assert((result64 & U64(0x0000ff0000000000)) == (expected64 & U64(0x0000ff0000000000))); } - if (address % 8 == 0) { printf(" (0x000000ff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ff00000000)), 16)); assert((result64 & U64(0x000000ff00000000)) == (expected64 & U64(0x000000ff00000000))); } - if (address % 8 == 0) { printf(" (0x00000000ff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ff000000)), 16)); assert((result64 & U64(0x00000000ff000000)) == (expected64 & U64(0x00000000ff000000))); } - if (address % 8 == 0) { printf(" (0x0000000000ff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000000000ff0000)), 16)); assert((result64 & U64(0x0000000000ff0000)) == (expected64 & U64(0x0000000000ff0000))); } - if (address % 8 == 0) { printf(" (0x000000000000ff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000000000ff00)), 16)); assert((result64 & U64(0x000000000000ff00)) == (expected64 & U64(0x000000000000ff00))); } - if (address % 8 == 0) { printf(" (0x00000000000000ff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000000000ff)), 16)); assert((result64 & U64(0x00000000000000ff)) == (expected64 & U64(0x00000000000000ff))); } - if (address % 8 == 0) { printf(" (0xffff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffff000000000000)), 16)); assert((result64 & U64(0xffff000000000000)) == (expected64 & U64(0xffff000000000000))); } - if (address % 8 == 0) { printf(" (0x0000ffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffff00000000)), 16)); assert((result64 & U64(0x0000ffff00000000)) == (expected64 & U64(0x0000ffff00000000))); } - if (address % 8 == 0) { printf(" (0x00000000ffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ffff0000)), 16)); assert((result64 & U64(0x00000000ffff0000)) == (expected64 & U64(0x00000000ffff0000))); } - if (address % 8 == 0) { printf(" (0x000000000000ffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000000000ffff)), 16)); assert((result64 & U64(0x000000000000ffff)) == (expected64 & U64(0x000000000000ffff))); } - if (address % 8 == 0) { printf(" (0xffffff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffff0000000000)), 16)); assert((result64 & U64(0xffffff0000000000)) == (expected64 & U64(0xffffff0000000000))); } - if (address % 8 == 0) { printf(" (0x0000ffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffff000000)), 16)); assert((result64 & U64(0x0000ffffff000000)) == (expected64 & U64(0x0000ffffff000000))); } - if (address % 8 == 0) { printf(" (0x000000ffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffff0000)), 16)); assert((result64 & U64(0x000000ffffff0000)) == (expected64 & U64(0x000000ffffff0000))); } - if (address % 8 == 0) { printf(" (0x0000000000ffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000000000ffffff)), 16)); assert((result64 & U64(0x0000000000ffffff)) == (expected64 & U64(0x0000000000ffffff))); } - if (address % 8 == 0) { printf(" (0xffffffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffff00000000)), 16)); assert((result64 & U64(0xffffffff00000000)) == (expected64 & U64(0xffffffff00000000))); } - if (address % 8 == 0) { printf(" (0x00ffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffff000000)), 16)); assert((result64 & U64(0x00ffffffff000000)) == (expected64 & U64(0x00ffffffff000000))); } - if (address % 8 == 0) { printf(" (0x0000ffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffff0000)), 16)); assert((result64 & U64(0x0000ffffffff0000)) == (expected64 & U64(0x0000ffffffff0000))); } - if (address % 8 == 0) { printf(" (0x000000ffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffffff00)), 16)); assert((result64 & U64(0x000000ffffffff00)) == (expected64 & U64(0x000000ffffffff00))); } - if (address % 8 == 0) { printf(" (0x00000000ffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ffffffff)), 16)); assert((result64 & U64(0x00000000ffffffff)) == (expected64 & U64(0x00000000ffffffff))); } - if (address % 8 == 0) { printf(" (0xffffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffff000000)), 16)); assert((result64 & U64(0xffffffffff000000)) == (expected64 & U64(0xffffffffff000000))); } - if (address % 8 == 0) { printf(" (0x00ffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffff0000)), 16)); assert((result64 & U64(0x00ffffffffff0000)) == (expected64 & U64(0x00ffffffffff0000))); } - if (address % 8 == 0) { printf(" (0x0000ffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffffff00)), 16)); assert((result64 & U64(0x0000ffffffffff00)) == (expected64 & U64(0x0000ffffffffff00))); } - if (address % 8 == 0) { printf(" (0x000000ffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffffffff)), 16)); assert((result64 & U64(0x000000ffffffffff)) == (expected64 & U64(0x000000ffffffffff))); } - if (address % 8 == 0) { printf(" (0xffffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffffff0000)), 16)); assert((result64 & U64(0xffffffffffff0000)) == (expected64 & U64(0xffffffffffff0000))); } - if (address % 8 == 0) { printf(" (0x00ffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffffff00)), 16)); assert((result64 & U64(0x00ffffffffffff00)) == (expected64 & U64(0x00ffffffffffff00))); } - if (address % 8 == 0) { printf(" (0x0000ffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffffffff)), 16)); assert((result64 & U64(0x0000ffffffffffff)) == (expected64 & U64(0x0000ffffffffffff))); } - if (address % 8 == 0) { printf(" (0xffffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffffffff00)), 16)); assert((result64 & U64(0xffffffffffffff00)) == (expected64 & U64(0xffffffffffffff00))); } - if (address % 8 == 0) { printf(" (0x00ffffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffffffff)), 16)); assert((result64 & U64(0x00ffffffffffffff)) == (expected64 & U64(0x00ffffffffffffff))); } + if (QWORD_ALIGNED(address)) { printf(" read_qword = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address), 16)); assert(result64 == expected64); } + if (QWORD_ALIGNED(address)) { printf(" read_qword (0xff00000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xff00000000000000)), 16)); assert((result64 & U64(0xff00000000000000)) == (expected64 & U64(0xff00000000000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x00ff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ff000000000000)), 16)); assert((result64 & U64(0x00ff000000000000)) == (expected64 & U64(0x00ff000000000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ff0000000000)), 16)); assert((result64 & U64(0x0000ff0000000000)) == (expected64 & U64(0x0000ff0000000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000ff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ff00000000)), 16)); assert((result64 & U64(0x000000ff00000000)) == (expected64 & U64(0x000000ff00000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x00000000ff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ff000000)), 16)); assert((result64 & U64(0x00000000ff000000)) == (expected64 & U64(0x00000000ff000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000000000ff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000000000ff0000)), 16)); assert((result64 & U64(0x0000000000ff0000)) == (expected64 & U64(0x0000000000ff0000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000000000ff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000000000ff00)), 16)); assert((result64 & U64(0x000000000000ff00)) == (expected64 & U64(0x000000000000ff00))); } + if (QWORD_ALIGNED(address)) { printf(" (0x00000000000000ff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000000000ff)), 16)); assert((result64 & U64(0x00000000000000ff)) == (expected64 & U64(0x00000000000000ff))); } + if (QWORD_ALIGNED(address)) { printf(" (0xffff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffff000000000000)), 16)); assert((result64 & U64(0xffff000000000000)) == (expected64 & U64(0xffff000000000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffff00000000)), 16)); assert((result64 & U64(0x0000ffff00000000)) == (expected64 & U64(0x0000ffff00000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x00000000ffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ffff0000)), 16)); assert((result64 & U64(0x00000000ffff0000)) == (expected64 & U64(0x00000000ffff0000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000000000ffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000000000ffff)), 16)); assert((result64 & U64(0x000000000000ffff)) == (expected64 & U64(0x000000000000ffff))); } + if (QWORD_ALIGNED(address)) { printf(" (0xffffff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffff0000000000)), 16)); assert((result64 & U64(0xffffff0000000000)) == (expected64 & U64(0xffffff0000000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffff000000)), 16)); assert((result64 & U64(0x0000ffffff000000)) == (expected64 & U64(0x0000ffffff000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000ffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffff0000)), 16)); assert((result64 & U64(0x000000ffffff0000)) == (expected64 & U64(0x000000ffffff0000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000000000ffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000000000ffffff)), 16)); assert((result64 & U64(0x0000000000ffffff)) == (expected64 & U64(0x0000000000ffffff))); } + if (QWORD_ALIGNED(address)) { printf(" (0xffffffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffff00000000)), 16)); assert((result64 & U64(0xffffffff00000000)) == (expected64 & U64(0xffffffff00000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffff000000)), 16)); assert((result64 & U64(0x00ffffffff000000)) == (expected64 & U64(0x00ffffffff000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffff0000)), 16)); assert((result64 & U64(0x0000ffffffff0000)) == (expected64 & U64(0x0000ffffffff0000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000ffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffffff00)), 16)); assert((result64 & U64(0x000000ffffffff00)) == (expected64 & U64(0x000000ffffffff00))); } + if (QWORD_ALIGNED(address)) { printf(" (0x00000000ffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ffffffff)), 16)); assert((result64 & U64(0x00000000ffffffff)) == (expected64 & U64(0x00000000ffffffff))); } + if (QWORD_ALIGNED(address)) { printf(" (0xffffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffff000000)), 16)); assert((result64 & U64(0xffffffffff000000)) == (expected64 & U64(0xffffffffff000000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffff0000)), 16)); assert((result64 & U64(0x00ffffffffff0000)) == (expected64 & U64(0x00ffffffffff0000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffffff00)), 16)); assert((result64 & U64(0x0000ffffffffff00)) == (expected64 & U64(0x0000ffffffffff00))); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000ffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffffffff)), 16)); assert((result64 & U64(0x000000ffffffffff)) == (expected64 & U64(0x000000ffffffffff))); } + if (QWORD_ALIGNED(address)) { printf(" (0xffffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffffff0000)), 16)); assert((result64 & U64(0xffffffffffff0000)) == (expected64 & U64(0xffffffffffff0000))); } + if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffffff00)), 16)); assert((result64 & U64(0x00ffffffffffff00)) == (expected64 & U64(0x00ffffffffffff00))); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffffffff)), 16)); assert((result64 & U64(0x0000ffffffffffff)) == (expected64 & U64(0x0000ffffffffffff))); } + if (QWORD_ALIGNED(address)) { printf(" (0xffffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffffffff00)), 16)); assert((result64 & U64(0xffffffffffffff00)) == (expected64 & U64(0xffffffffffffff00))); } + if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffffffff)), 16)); assert((result64 & U64(0x00ffffffffffffff)) == (expected64 & U64(0x00ffffffffffffff))); } // validate unaligned qword accesses printf(" read_qword_unaligned = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address), 16)); assert(result64 == expected64); diff --git a/src/emu/memory.h b/src/emu/memory.h index 3b46ac33449..34a060a51b6 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -866,6 +866,12 @@ private: #define DWORD_XOR_LE(a) ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(0,4)) +// helpers for checking address alignment +#define WORD_ALIGNED(a) (((a) & 1) == 0) +#define DWORD_ALIGNED(a) (((a) & 3) == 0) +#define QWORD_ALIGNED(a) (((a) & 7) == 0) + + //************************************************************************** // INLINE FUNCTIONS diff --git a/src/mame/drivers/cobra.cpp b/src/mame/drivers/cobra.cpp index 848862363b2..8062af06612 100644 --- a/src/mame/drivers/cobra.cpp +++ b/src/mame/drivers/cobra.cpp @@ -2128,7 +2128,7 @@ void cobra_renderer::gfx_reset() UINT32 cobra_renderer::gfx_read_gram(UINT32 address) { - if (address & 3) + if (!DWORD_ALIGNED(address)) { printf("gfx_read_gram: %08X, not dword aligned!\n", address); return 0; @@ -2186,7 +2186,7 @@ void cobra_renderer::gfx_write_gram(UINT32 address, UINT32 mask, UINT32 data) } } - if (address & 3) + if (!DWORD_ALIGNED(address)) { printf("gfx_write_gram: %08X, %08X, not dword aligned!\n", address, data); return; diff --git a/src/mame/drivers/magictg.cpp b/src/mame/drivers/magictg.cpp index 63b0df20394..0235da41a9a 100644 --- a/src/mame/drivers/magictg.cpp +++ b/src/mame/drivers/magictg.cpp @@ -601,8 +601,8 @@ WRITE32_MEMBER( magictg_state::f0_w ) UINT32 dst_addr = m_dma_ch[ch].dst_addr; //device_t *voodoo = dst_addr > 0xa000000 voodoo0 : voodoo1; - assert((src_addr & 3) == 0); - assert((dst_addr & 3) == 0); + assert(DWORD_ALIGNED(src_addr)); + assert(DWORD_ALIGNED(dst_addr)); while (m_dma_ch[ch].count > 3) { diff --git a/src/mame/machine/n64.cpp b/src/mame/machine/n64.cpp index a3e256a080c..5f0d8a6b4d2 100644 --- a/src/mame/machine/n64.cpp +++ b/src/mame/machine/n64.cpp @@ -2089,7 +2089,7 @@ void n64_periphs::si_dma_tick() void n64_periphs::pif_dma(int direction) { - if (si_dram_addr & 0x3) + if (!DWORD_ALIGNED(si_dram_addr)) { fatalerror("pif_dma: si_dram_addr unaligned: %08X\n", si_dram_addr); } diff --git a/src/mame/video/seibuspi.cpp b/src/mame/video/seibuspi.cpp index cb267167789..42e683c70b2 100644 --- a/src/mame/video/seibuspi.cpp +++ b/src/mame/video/seibuspi.cpp @@ -111,7 +111,7 @@ WRITE32_MEMBER(seibuspi_state::tilemap_dma_start_w) int dma_length_real = (m_video_dma_length + 1) * 2; // ideally we should be using this, let's check if we have to: if (m_video_dma_length != 0 && dma_length_user != dma_length_real) popmessage("Tile LEN %X %X, contact MAMEdev", dma_length_user, dma_length_real); // shouldn't happen - else if ((m_video_dma_address & 3) != 0 || (m_video_dma_length & 3) != 3 || (m_video_dma_address + dma_length_user) > 0x40000) + else if (!DWORD_ALIGNED(m_video_dma_address) || (m_video_dma_length & 3) != 3 || (m_video_dma_address + dma_length_user) > 0x40000) popmessage("Tile DMA %X %X, contact MAMEdev", m_video_dma_address, m_video_dma_length); // shouldn't happen if (m_video_dma_address < 0x800) logerror("tilemap_dma_start_w in I/O area: %X\n", m_video_dma_address); @@ -198,7 +198,7 @@ WRITE32_MEMBER(seibuspi_state::palette_dma_start_w) int dma_length = (m_video_dma_length + 1) * 2; // safety check - if ((m_video_dma_address & 3) != 0 || (m_video_dma_length & 3) != 3 || dma_length > m_palette_ram_size || (m_video_dma_address + dma_length) > 0x40000) + if (!DWORD_ALIGNED(m_video_dma_address) || (m_video_dma_length & 3) != 3 || dma_length > m_palette_ram_size || (m_video_dma_address + dma_length) > 0x40000) popmessage("Pal DMA %X %X, contact MAMEdev", m_video_dma_address, m_video_dma_length); // shouldn't happen if (m_video_dma_address < 0x800) logerror("palette_dma_start_w in I/O area: %X\n", m_video_dma_address); @@ -219,7 +219,7 @@ WRITE32_MEMBER(seibuspi_state::palette_dma_start_w) WRITE16_MEMBER(seibuspi_state::sprite_dma_start_w) { // safety check - if ((m_video_dma_address & 3) != 0 || (m_video_dma_address + m_sprite_ram_size) > 0x40000) + if (!DWORD_ALIGNED(m_video_dma_address) || (m_video_dma_address + m_sprite_ram_size) > 0x40000) popmessage("Sprite DMA %X, contact MAMEdev", m_video_dma_address); // shouldn't happen if (m_video_dma_address < 0x800) logerror("sprite_dma_start_w in I/O area: %X\n", m_video_dma_address); -- cgit v1.2.3-70-g09d2 From 42622cfe8effd40c0bf63030738e43feaa6999d6 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 30 Jan 2016 20:43:50 +0100 Subject: replace osd_lock with std::mutex [Miodrag Milanovic] --- scripts/src/osd/osdmini.lua | 1 - src/emu/debug/debugvw.cpp | 22 +-- src/emu/debug/dvstate.cpp | 18 +- src/emu/emualloc.cpp | 29 +--- src/emu/emualloc.h | 3 +- src/emu/luaengine.cpp | 49 +++--- src/emu/render.cpp | 4 - src/emu/render.h | 7 +- src/emu/ui/filemngr.cpp | 4 +- src/emu/ui/imgcntrl.cpp | 14 +- src/emu/ui/inputmap.cpp | 2 +- src/emu/ui/mainmenu.cpp | 44 ++--- src/emu/ui/menu.cpp | 14 +- src/emu/ui/selgame.cpp | 8 +- src/emu/ui/sliders.cpp | 2 +- src/emu/ui/slotopt.cpp | 2 +- src/emu/ui/swlist.cpp | 2 +- src/emu/ui/videoopt.cpp | 2 +- src/mame/includes/chihiro.h | 5 +- src/mame/video/chihiro.cpp | 3 +- src/osd/modules/sound/xaudio2_sound.cpp | 40 +---- src/osd/modules/sync/osdsync.h | 16 +- src/osd/modules/sync/sync_mini.cpp | 57 ------- src/osd/modules/sync/sync_ntc.cpp | 279 ------------------------------- src/osd/modules/sync/sync_os2.cpp | 280 -------------------------------- src/osd/modules/sync/sync_sdl.cpp | 132 --------------- src/osd/modules/sync/sync_tc.cpp | 117 ------------- src/osd/modules/sync/sync_windows.cpp | 177 -------------------- src/osd/modules/sync/work_osd.cpp | 43 +++-- src/osd/osdcore.h | 87 ---------- src/osd/osdmini/minisync.cpp | 66 -------- src/osd/sdl/input.cpp | 16 +- src/osd/windows/input.cpp | 32 +--- src/osd/windows/window.cpp | 18 +- src/osd/windows/window.h | 3 +- 35 files changed, 152 insertions(+), 1446 deletions(-) delete mode 100644 src/osd/osdmini/minisync.cpp diff --git a/scripts/src/osd/osdmini.lua b/scripts/src/osd/osdmini.lua index 0795ccdb4bd..b05839e7873 100644 --- a/scripts/src/osd/osdmini.lua +++ b/scripts/src/osd/osdmini.lua @@ -125,7 +125,6 @@ project ("ocore_" .. _OPTIONS["osd"]) MAME_DIR .. "src/osd/osdmini/minidir.cpp", MAME_DIR .. "src/osd/osdmini/minifile.cpp", MAME_DIR .. "src/osd/osdmini/minimisc.cpp", - MAME_DIR .. "src/osd/osdmini/minisync.cpp", MAME_DIR .. "src/osd/osdmini/minitime.cpp", MAME_DIR .. "src/osd/modules/sync/work_mini.cpp", } diff --git a/src/emu/debug/debugvw.cpp b/src/emu/debug/debugvw.cpp index eea867f3a63..0fcf1f4b2fd 100644 --- a/src/emu/debug/debugvw.cpp +++ b/src/emu/debug/debugvw.cpp @@ -331,7 +331,7 @@ debug_view_manager::~debug_view_manager() { debug_view *oldhead = m_viewlist; m_viewlist = oldhead->m_next; - auto_free(machine(), oldhead); + global_free(oldhead); } } @@ -345,31 +345,31 @@ debug_view *debug_view_manager::alloc_view(debug_view_type type, debug_view_osd_ switch (type) { case DVT_CONSOLE: - return append(auto_alloc(machine(), debug_view_console(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_console(machine(), osdupdate, osdprivate))); case DVT_STATE: - return append(auto_alloc(machine(), debug_view_state(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_state(machine(), osdupdate, osdprivate))); case DVT_DISASSEMBLY: - return append(auto_alloc(machine(), debug_view_disasm(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_disasm(machine(), osdupdate, osdprivate))); case DVT_MEMORY: - return append(auto_alloc(machine(), debug_view_memory(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_memory(machine(), osdupdate, osdprivate))); case DVT_LOG: - return append(auto_alloc(machine(), debug_view_log(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_log(machine(), osdupdate, osdprivate))); case DVT_TIMERS: -// return append(auto_alloc(machine(), debug_view_timers(machine(), osdupdate, osdprivate))); +// return append(global_alloc(debug_view_timers(machine(), osdupdate, osdprivate))); case DVT_ALLOCS: -// return append(auto_alloc(machine(), debug_view_allocs(machine(), osdupdate, osdprivate))); +// return append(global_alloc(debug_view_allocs(machine(), osdupdate, osdprivate))); case DVT_BREAK_POINTS: - return append(auto_alloc(machine(), debug_view_breakpoints(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_breakpoints(machine(), osdupdate, osdprivate))); case DVT_WATCH_POINTS: - return append(auto_alloc(machine(), debug_view_watchpoints(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_watchpoints(machine(), osdupdate, osdprivate))); default: fatalerror("Attempt to create invalid debug view type %d\n", type); @@ -389,7 +389,7 @@ void debug_view_manager::free_view(debug_view &view) if (*viewptr == &view) { *viewptr = view.m_next; - auto_free(machine(), &view); + global_free(&view); break; } } diff --git a/src/emu/debug/dvstate.cpp b/src/emu/debug/dvstate.cpp index 578b423725d..d0d741ed21e 100644 --- a/src/emu/debug/dvstate.cpp +++ b/src/emu/debug/dvstate.cpp @@ -98,7 +98,7 @@ void debug_view_state::reset() { state_item *oldhead = m_state_list; m_state_list = oldhead->m_next; - auto_free(machine(), oldhead); + global_free(oldhead); } } @@ -117,39 +117,39 @@ void debug_view_state::recompute() // add a cycles entry: cycles:99999999 state_item **tailptr = &m_state_list; - *tailptr = auto_alloc(machine(), state_item(REG_CYCLES, "cycles", 8)); + *tailptr = global_alloc(state_item(REG_CYCLES, "cycles", 8)); tailptr = &(*tailptr)->m_next; // add a beam entry: beamx:1234 - *tailptr = auto_alloc(machine(), state_item(REG_BEAMX, "beamx", 4)); + *tailptr = global_alloc(state_item(REG_BEAMX, "beamx", 4)); tailptr = &(*tailptr)->m_next; // add a beam entry: beamy:5678 - *tailptr = auto_alloc(machine(), state_item(REG_BEAMY, "beamy", 4)); + *tailptr = global_alloc(state_item(REG_BEAMY, "beamy", 4)); tailptr = &(*tailptr)->m_next; // add a beam entry: frame:123456 - *tailptr = auto_alloc(machine(), state_item(REG_FRAME, "frame", 6)); + *tailptr = global_alloc(state_item(REG_FRAME, "frame", 6)); tailptr = &(*tailptr)->m_next; // add a flags entry: flags:xxxxxxxx - *tailptr = auto_alloc(machine(), state_item(STATE_GENFLAGS, "flags", source.m_stateintf->state_string_max_length(STATE_GENFLAGS))); + *tailptr = global_alloc(state_item(STATE_GENFLAGS, "flags", source.m_stateintf->state_string_max_length(STATE_GENFLAGS))); tailptr = &(*tailptr)->m_next; // add a divider entry - *tailptr = auto_alloc(machine(), state_item(REG_DIVIDER, "", 0)); + *tailptr = global_alloc(state_item(REG_DIVIDER, "", 0)); tailptr = &(*tailptr)->m_next; // add all registers into it for (const device_state_entry *entry = source.m_stateintf->state_first(); entry != nullptr; entry = entry->next()) if (entry->divider()) { - *tailptr = auto_alloc(machine(), state_item(REG_DIVIDER, "", 0)); + *tailptr = global_alloc(state_item(REG_DIVIDER, "", 0)); tailptr = &(*tailptr)->m_next; } else if (entry->visible()) { - *tailptr = auto_alloc(machine(), state_item(entry->index(), entry->symbol(), source.m_stateintf->state_string_max_length(entry->index()))); + *tailptr = global_alloc(state_item(entry->index(), entry->symbol(), source.m_stateintf->state_string_max_length(entry->index()))); tailptr = &(*tailptr)->m_next; } diff --git a/src/emu/emualloc.cpp b/src/emu/emualloc.cpp index a43faae522c..f424bca39cb 100644 --- a/src/emu/emualloc.cpp +++ b/src/emu/emualloc.cpp @@ -38,7 +38,6 @@ UINT64 resource_pool::s_id = 0; resource_pool::resource_pool(int hash_size) : m_hash_size(hash_size), - m_listlock(osd_lock_alloc()), m_hash(hash_size), m_ordered_head(nullptr), m_ordered_tail(nullptr) @@ -56,8 +55,6 @@ resource_pool::resource_pool(int hash_size) resource_pool::~resource_pool() { clear(); - if (m_listlock != nullptr) - osd_lock_free(m_listlock); } @@ -67,7 +64,7 @@ resource_pool::~resource_pool() void resource_pool::add(resource_pool_item &item, size_t size, const char *type) { - osd_lock_acquire(m_listlock); + std::lock_guard lock(m_listlock); // insert into hash table int hashval = reinterpret_cast(item.m_ptr) % m_hash_size; @@ -107,8 +104,6 @@ void resource_pool::add(resource_pool_item &item, size_t size, const char *type) item.m_ordered_prev = nullptr; m_ordered_head = &item; } - - osd_lock_release(m_listlock); } @@ -124,7 +119,7 @@ void resource_pool::remove(void *ptr) return; // search for the item - osd_lock_acquire(m_listlock); + std::lock_guard lock(m_listlock); int hashval = reinterpret_cast(ptr) % m_hash_size; for (resource_pool_item **scanptr = &m_hash[hashval]; *scanptr != nullptr; scanptr = &(*scanptr)->m_next) @@ -152,8 +147,6 @@ void resource_pool::remove(void *ptr) global_free(deleteme); break; } - - osd_lock_release(m_listlock); } @@ -165,7 +158,7 @@ void resource_pool::remove(void *ptr) resource_pool_item *resource_pool::find(void *ptr) { // search for the item - osd_lock_acquire(m_listlock); + std::lock_guard lock(m_listlock); int hashval = reinterpret_cast(ptr) % m_hash_size; resource_pool_item *item; @@ -173,8 +166,6 @@ resource_pool_item *resource_pool::find(void *ptr) if (item->m_ptr == ptr) break; - osd_lock_release(m_listlock); - return item; } @@ -190,7 +181,7 @@ bool resource_pool::contains(void *_ptrstart, void *_ptrend) UINT8 *ptrend = reinterpret_cast(_ptrend); // search for the item - osd_lock_acquire(m_listlock); + std::lock_guard lock(m_listlock); resource_pool_item *item = nullptr; for (item = m_ordered_head; item != nullptr; item = item->m_ordered_next) @@ -198,13 +189,9 @@ bool resource_pool::contains(void *_ptrstart, void *_ptrend) UINT8 *objstart = reinterpret_cast(item->m_ptr); UINT8 *objend = objstart + item->m_size; if (ptrstart >= objstart && ptrend <= objend) - goto found; + return true; } - -found: - osd_lock_release(m_listlock); - - return (item != nullptr); + return false; } @@ -214,12 +201,8 @@ found: void resource_pool::clear() { - osd_lock_acquire(m_listlock); - // important: delete from earliest to latest; this allows objects to clean up after // themselves if they wish while (m_ordered_head != nullptr) remove(m_ordered_head->m_ptr); - - osd_lock_release(m_listlock); } diff --git a/src/emu/emualloc.h b/src/emu/emualloc.h index 4571762054f..37b5c63d860 100644 --- a/src/emu/emualloc.h +++ b/src/emu/emualloc.h @@ -14,6 +14,7 @@ #define __EMUALLOC_H__ #include +#include #include "osdcore.h" #include "coretmpl.h" @@ -124,7 +125,7 @@ public: private: int m_hash_size; - osd_lock * m_listlock; + std::mutex m_listlock; std::vector m_hash; resource_pool_item * m_ordered_head; resource_pool_item * m_ordered_tail; diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index f8ec7023bc6..f487c02bed6 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -17,6 +17,7 @@ #include "drivenum.h" #include "ui/ui.h" #include "luaengine.h" +#include //************************************************************************** // LUA ENGINE @@ -808,7 +809,7 @@ struct msg { int done; } msg; -osd_lock *lock; +static std::mutex g_mutex; void lua_engine::serve_lua() { @@ -826,37 +827,39 @@ void lua_engine::serve_lua() fgets(buff, LUA_MAXINPUT, stdin); // Create message - osd_lock_acquire(lock); - if (msg.ready == 0) { - msg.text = oldbuff; - if (oldbuff.length()!=0) msg.text.append("\n"); - msg.text.append(buff); - msg.ready = 1; - msg.done = 0; + { + std::lock_guard lock(g_mutex); + if (msg.ready == 0) { + msg.text = oldbuff; + if (oldbuff.length() != 0) msg.text.append("\n"); + msg.text.append(buff); + msg.ready = 1; + msg.done = 0; + } } - osd_lock_release(lock); // Wait for response int done; do { osd_sleep(osd_ticks_per_second() / 1000); - osd_lock_acquire(lock); + std::lock_guard lock(g_mutex); done = msg.done; - osd_lock_release(lock); } while (done==0); // Do action on client side - osd_lock_acquire(lock); - if (msg.status == -1){ - b = LUA_PROMPT2; - oldbuff = msg.response; - } - else { - b = LUA_PROMPT; - oldbuff = ""; + { + osd_sleep(osd_ticks_per_second() / 1000); + + if (msg.status == -1) { + b = LUA_PROMPT2; + oldbuff = msg.response; + } + else { + b = LUA_PROMPT; + oldbuff = ""; + } + msg.done = 0; } - msg.done = 0; - osd_lock_release(lock); } while (1); } @@ -891,7 +894,6 @@ lua_engine::lua_engine() msg.ready = 0; msg.status = 0; msg.done = 0; - lock = osd_lock_alloc(); } //------------------------------------------------- @@ -1046,7 +1048,7 @@ bool lua_engine::frame_hook() void lua_engine::periodic_check() { - osd_lock_acquire(lock); + std::lock_guard lock(g_mutex); if (msg.ready == 1) { lua_settop(m_lua_state, 0); int status = luaL_loadbuffer(m_lua_state, msg.text.c_str(), msg.text.length(), "=stdin"); @@ -1075,7 +1077,6 @@ void lua_engine::periodic_check() msg.ready = 0; msg.done = 1; } - osd_lock_release(lock); } //------------------------------------------------- diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 1f8e5d0be1f..e25f62a8e13 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -227,7 +227,6 @@ void render_primitive::reset() //------------------------------------------------- render_primitive_list::render_primitive_list() - : m_lock(osd_lock_alloc()) { } @@ -239,7 +238,6 @@ render_primitive_list::render_primitive_list() render_primitive_list::~render_primitive_list() { release_all(); - osd_lock_free(m_lock); } @@ -296,10 +294,8 @@ inline render_primitive *render_primitive_list::alloc(render_primitive::primitiv void render_primitive_list::release_all() { // release all the live items while under the lock - acquire_lock(); m_primitive_allocator.reclaim_all(m_primlist); m_reference_allocator.reclaim_all(m_reflist); - release_lock(); } diff --git a/src/emu/render.h b/src/emu/render.h index df8896b712b..5be63b085b5 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -49,6 +49,7 @@ //#include "osdepend.h" #include +#include //************************************************************************** @@ -358,8 +359,8 @@ public: render_primitive *first() const { return m_primlist.first(); } // lock management - void acquire_lock() { osd_lock_acquire(m_lock); } - void release_lock() { osd_lock_release(m_lock); } + void acquire_lock() { m_lock.lock(); } + void release_lock() { m_lock.unlock(); } // reference management void add_reference(void *refptr); @@ -388,7 +389,7 @@ private: fixed_allocator m_primitive_allocator;// allocator for primitives fixed_allocator m_reference_allocator; // allocator for references - osd_lock * m_lock; // lock to protect list accesses + std::mutex m_lock; // lock to protect list accesses }; diff --git a/src/emu/ui/filemngr.cpp b/src/emu/ui/filemngr.cpp index d277d0bd847..cccc92888c4 100644 --- a/src/emu/ui/filemngr.cpp +++ b/src/emu/ui/filemngr.cpp @@ -195,10 +195,10 @@ void ui_menu_file_manager::force_file_manager(running_machine &machine, render_c ui_menu::stack_reset(machine); // add the quit entry followed by the game select entry - ui_menu *quit = auto_alloc_clear(machine, (machine, container)); + ui_menu *quit = global_alloc_clear(machine, container); quit->set_special_main_menu(true); ui_menu::stack_push(quit); - ui_menu::stack_push(auto_alloc_clear(machine, (machine, container, warnings))); + ui_menu::stack_push(global_alloc_clear(machine, container, warnings)); // force the menus on machine.ui().show_menu(); diff --git a/src/emu/ui/imgcntrl.cpp b/src/emu/ui/imgcntrl.cpp index 3bb77723726..8f3dbeca75b 100644 --- a/src/emu/ui/imgcntrl.cpp +++ b/src/emu/ui/imgcntrl.cpp @@ -190,20 +190,20 @@ void ui_menu_control_device_image::handle() zippath_closedir(directory); } submenu_result = -1; - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, image, current_directory, current_file, true, image->image_interface()!=nullptr, can_create, &submenu_result))); + ui_menu::stack_push(global_alloc_clear(machine(), container, image, current_directory, current_file, true, image->image_interface()!=nullptr, can_create, &submenu_result)); state = SELECT_FILE; break; } case START_SOFTLIST: sld = nullptr; - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, image->image_interface(), &sld))); + ui_menu::stack_push(global_alloc_clear(machine(), container, image->image_interface(), &sld)); state = SELECT_SOFTLIST; break; case START_OTHER_PART: { submenu_result = -1; - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, swi, swp->interface(), &swp, true, &submenu_result))); + ui_menu::stack_push(global_alloc_clear(machine(), container, swi, swp->interface(), &swp, true, &submenu_result)); state = SELECT_OTHER_PART; break; } @@ -214,7 +214,7 @@ void ui_menu_control_device_image::handle() break; } software_info_name = ""; - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, sld, image->image_interface(), software_info_name))); + ui_menu::stack_push(global_alloc_clear(machine(), container, sld, image->image_interface(), software_info_name)); state = SELECT_PARTLIST; break; @@ -226,7 +226,7 @@ void ui_menu_control_device_image::handle() { submenu_result = -1; swp = nullptr; - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, swi, image->image_interface(), &swp, false, &submenu_result))); + ui_menu::stack_push(global_alloc_clear(machine(), container, swi, image->image_interface(), &swp, false, &submenu_result)); state = SELECT_ONE_PART; } else @@ -290,7 +290,7 @@ void ui_menu_control_device_image::handle() break; case ui_menu_file_selector::R_CREATE: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, image, current_directory, current_file, &create_ok))); + ui_menu::stack_push(global_alloc_clear(machine(), container, image, current_directory, current_file, &create_ok)); state = CHECK_CREATE; break; @@ -310,7 +310,7 @@ void ui_menu_control_device_image::handle() test_create(can_create, need_confirm); if(can_create) { if(need_confirm) { - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, &create_confirmed))); + ui_menu::stack_push(global_alloc_clear(machine(), container, &create_confirmed)); state = CREATE_CONFIRM; } else { state = DO_CREATE; diff --git a/src/emu/ui/inputmap.cpp b/src/emu/ui/inputmap.cpp index 1fc0d046e1f..f3ffe9b0e59 100644 --- a/src/emu/ui/inputmap.cpp +++ b/src/emu/ui/inputmap.cpp @@ -73,7 +73,7 @@ void ui_menu_input_groups::handle() /* process the menu */ const ui_menu_event *menu_event = process(0); if (menu_event != nullptr && menu_event->iptkey == IPT_UI_SELECT) - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, int((long long)(menu_event->itemref)-1)))); + ui_menu::stack_push(global_alloc_clear(machine(), container, int((long long)(menu_event->itemref)-1))); } diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp index 415ad118811..75f16b3d9ba 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/emu/ui/mainmenu.cpp @@ -152,91 +152,91 @@ void ui_menu_main::handle() if (menu_event != nullptr && menu_event->iptkey == IPT_UI_SELECT) { switch((long long)(menu_event->itemref)) { case INPUT_GROUPS: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case INPUT_SPECIFIC: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case SETTINGS_DIP_SWITCHES: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case SETTINGS_DRIVER_CONFIG: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case ANALOG: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case BOOKKEEPING: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case GAME_INFO: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case IMAGE_MENU_IMAGE_INFO: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case IMAGE_MENU_FILE_MANAGER: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, nullptr))); + ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); break; case TAPE_CONTROL: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, nullptr))); + ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); break; case PTY_INFO: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case SLOT_DEVICES: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case NETWORK_DEVICES: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case KEYBOARD_MODE: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case SLIDERS: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, false))); + ui_menu::stack_push(global_alloc_clear(machine(), container, false)); break; case VIDEO_TARGETS: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case VIDEO_OPTIONS: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, machine().render().first_target()))); + ui_menu::stack_push(global_alloc_clear(machine(), container, machine().render().first_target())); break; case CROSSHAIR: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case CHEAT: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case SELECT_GAME: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, nullptr))); + ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); break; case BIOS_SELECTION: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case BARCODE_READ: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, nullptr))); + ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); break; default: diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index 069b05aa913..33604fbbe62 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -148,12 +148,12 @@ ui_menu::~ui_menu() { ui_menu_pool *ppool = pool; pool = pool->next; - auto_free(machine(), ppool); + global_free(ppool); } // free the item array if (item) - auto_free(machine(), item); + global_free(item); } @@ -247,10 +247,10 @@ void ui_menu::item_append(const char *text, const char *subtext, UINT32 flags, v { int olditems = allocitems; allocitems += UI_MENU_ALLOC_ITEMS; - ui_menu_item *newitems = auto_alloc_array(machine(), ui_menu_item, allocitems); + ui_menu_item *newitems = global_alloc_array(ui_menu_item, allocitems); for (int itemnum = 0; itemnum < olditems; itemnum++) newitems[itemnum] = item[itemnum]; - auto_free(machine(), item); + global_free(item); item = newitems; } index = numitems++; @@ -338,7 +338,7 @@ void *ui_menu::m_pool_alloc(size_t size) } // allocate a new pool - ppool = (ui_menu_pool *)auto_alloc_array_clear(machine(), UINT8, sizeof(*ppool) + UI_MENU_POOL_SIZE); + ppool = (ui_menu_pool *)global_alloc_array_clear(sizeof(*ppool) + UI_MENU_POOL_SIZE); // wire it up ppool->next = pool; @@ -948,7 +948,7 @@ void ui_menu::clear_free_list(running_machine &machine) { ui_menu *menu = menu_free; menu_free = menu->parent; - auto_free(machine, menu); + global_free(menu); } } @@ -1037,7 +1037,7 @@ UINT32 ui_menu::ui_handler(running_machine &machine, render_container *container { // if we have no menus stacked up, start with the main menu if (menu_stack == nullptr) - stack_push(auto_alloc_clear(machine, (machine, container))); + stack_push(global_alloc_clear(machine, container)); // update the menu state if (menu_stack != nullptr) diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 9a080df6655..19af6e607d8 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -141,7 +141,7 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *menu_event) // special case for configure inputs if ((FPTR)driver == 1) - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container))); + ui_menu::stack_push(global_alloc_clear(machine(), container)); // anything else is a driver else @@ -180,7 +180,7 @@ void ui_menu_select_game::inkey_cancel(const ui_menu_event *menu_event) if (m_search[0] != 0) { // since we have already been popped, we must recreate ourself from scratch - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, nullptr))); + ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); } } @@ -429,10 +429,10 @@ void ui_menu_select_game::force_game_select(running_machine &machine, render_con ui_menu::stack_reset(machine); // add the quit entry followed by the game select entry - ui_menu *quit = auto_alloc_clear(machine, (machine, container)); + ui_menu *quit = global_alloc_clear(machine, container); quit->set_special_main_menu(true); ui_menu::stack_push(quit); - ui_menu::stack_push(auto_alloc_clear(machine, (machine, container, gamename))); + ui_menu::stack_push(global_alloc_clear(machine, container, gamename)); // force the menus on machine.ui().show_menu(); diff --git a/src/emu/ui/sliders.cpp b/src/emu/ui/sliders.cpp index 26da6327202..23bd9013dba 100644 --- a/src/emu/ui/sliders.cpp +++ b/src/emu/ui/sliders.cpp @@ -242,7 +242,7 @@ UINT32 ui_menu_sliders::ui_handler(running_machine &machine, render_container *c /* if this is the first call, push the sliders menu */ if (state) - ui_menu::stack_push(auto_alloc_clear(machine, (machine, container, true))); + ui_menu::stack_push(global_alloc_clear(machine, container, true)); /* handle standard menus */ result = ui_menu::ui_handler(machine, container, state); diff --git a/src/emu/ui/slotopt.cpp b/src/emu/ui/slotopt.cpp index cce17353532..a3b6352ac2b 100644 --- a/src/emu/ui/slotopt.cpp +++ b/src/emu/ui/slotopt.cpp @@ -204,7 +204,7 @@ void ui_menu_slot_devices::handle() device_slot_interface *slot = (device_slot_interface *)menu_event->itemref; device_slot_option *option = slot_get_current_option(slot); if (option) - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, slot, option))); + ui_menu::stack_push(global_alloc_clear(machine(), container, slot, option)); } } } diff --git a/src/emu/ui/swlist.cpp b/src/emu/ui/swlist.cpp index 64eb5109fae..d57c91fae40 100644 --- a/src/emu/ui/swlist.cpp +++ b/src/emu/ui/swlist.cpp @@ -448,7 +448,7 @@ void ui_menu_software::handle() const ui_menu_event *event = process(0); if (event != nullptr && event->iptkey == IPT_UI_SELECT) { - // ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, (software_list_config *)event->itemref, image))); + // ui_menu::stack_push(global_alloc_clear(machine(), container, (software_list_config *)event->itemref, image)); *m_result = (software_list_device *)event->itemref; ui_menu::stack_pop(machine()); } diff --git a/src/emu/ui/videoopt.cpp b/src/emu/ui/videoopt.cpp index e76c27305c8..aa3bc21dd5f 100644 --- a/src/emu/ui/videoopt.cpp +++ b/src/emu/ui/videoopt.cpp @@ -24,7 +24,7 @@ void ui_menu_video_targets::handle() /* process the menu */ const ui_menu_event *menu_event = process(0); if (menu_event != nullptr && menu_event->iptkey == IPT_UI_SELECT) - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, static_cast(menu_event->itemref)))); + ui_menu::stack_push(global_alloc_clear(machine(), container, static_cast(menu_event->itemref))); } diff --git a/src/mame/includes/chihiro.h b/src/mame/includes/chihiro.h index a9efcc711e3..0f68747059a 100644 --- a/src/mame/includes/chihiro.h +++ b/src/mame/includes/chihiro.h @@ -3,6 +3,8 @@ /* * geforce 3d (NV2A) vertex program disassembler */ +#include + class vertex_program_disassembler { static const char *srctypes[]; static const char *scaops[]; @@ -357,7 +359,6 @@ public: objectdata = &(object_data_alloc()); objectdata->data = this; combiner.used = 0; - combiner.lock = osd_lock_alloc(); enabled_vertex_attributes = 0; indexesleft_count = 0; vertex_pipeline = 4; @@ -626,7 +627,7 @@ public: } final; int stages; int used; - osd_lock *lock; + std::mutex lock; } combiner; UINT32 color_mask; bool alpha_test_enabled; diff --git a/src/mame/video/chihiro.cpp b/src/mame/video/chihiro.cpp index 9f803c45651..e6c8e578bb6 100644 --- a/src/mame/video/chihiro.cpp +++ b/src/mame/video/chihiro.cpp @@ -1953,7 +1953,7 @@ void nv2a_renderer::render_register_combiners(INT32 scanline, const extent_t &ex if ((extent.startx < 0) || (extent.stopx > 640)) return; - osd_lock_acquire(combiner.lock); // needed since multithreading is not supported yet + std::lock_guard lock(combiner.lock); // needed since multithreading is not supported yet x = extent.stopx - extent.startx - 1; // number of pixels to draw while (x >= 0) { xp = extent.startx + x; @@ -1998,7 +1998,6 @@ void nv2a_renderer::render_register_combiners(INT32 scanline, const extent_t &ex write_pixel(xp, scanline, a8r8g8b8, z); x--; } - osd_lock_release(combiner.lock); } #if 0 diff --git a/src/osd/modules/sound/xaudio2_sound.cpp b/src/osd/modules/sound/xaudio2_sound.cpp index 7df854c0364..9dc3d0461be 100644 --- a/src/osd/modules/sound/xaudio2_sound.cpp +++ b/src/osd/modules/sound/xaudio2_sound.cpp @@ -14,6 +14,7 @@ // standard windows headers #define WIN32_LEAN_AND_MEAN #include +#include #pragma warning( push ) #pragma warning( disable: 4068 ) @@ -124,21 +125,12 @@ public: obj->DestroyVoice(); } } - - void operator()(osd_lock* obj) const - { - if (obj != nullptr) - { - osd_lock_free(obj); - } - } }; // Typedefs for smart pointers used with customer deleters typedef std::unique_ptr xaudio2_ptr; typedef std::unique_ptr mastering_voice_ptr; typedef std::unique_ptr src_voice_ptr; -typedef std::unique_ptr osd_lock_ptr; // Typedef for pointer to XAudio2Create typedef HRESULT(__stdcall* PFN_XAUDIO2CREATE)(IXAudio2**, UINT32, XAUDIO2_PROCESSOR); @@ -147,27 +139,6 @@ typedef HRESULT(__stdcall* PFN_XAUDIO2CREATE)(IXAudio2**, UINT32, XAUDIO2_PROCES // Helper classes //============================================================ -// Helper for locking within a particular scope without having to manually release -class osd_scoped_lock -{ -private: - osd_lock * m_lock; -public: - osd_scoped_lock(osd_lock* lock) - { - m_lock = lock; - osd_lock_acquire(m_lock); - } - - ~osd_scoped_lock() - { - if (m_lock != nullptr) - { - osd_lock_release(m_lock); - } - } -}; - // Provides a pool of buffers class bufferpool { @@ -233,7 +204,7 @@ private: DWORD m_buffer_size; DWORD m_buffer_count; DWORD m_writepos; - osd_lock_ptr m_buffer_lock; + std::mutex m_buffer_lock; HANDLE m_hEventBufferCompleted; HANDLE m_hEventDataAvailable; HANDLE m_hEventExiting; @@ -258,7 +229,6 @@ public: m_buffer_size(0), m_buffer_count(0), m_writepos(0), - m_buffer_lock(osd_lock_alloc()), m_hEventBufferCompleted(NULL), m_hEventDataAvailable(NULL), m_hEventExiting(NULL), @@ -389,7 +359,7 @@ void sound_xaudio2::update_audio_stream( UINT32 const bytes_this_frame = samples_this_frame * m_sample_bytes; - osd_scoped_lock scope_lock(m_buffer_lock.get()); + std::lock_guard lock(m_buffer_lock); UINT32 bytes_left = bytes_this_frame; @@ -446,7 +416,7 @@ void sound_xaudio2::OnBufferEnd(void *pBufferContext) BYTE* completed_buffer = (BYTE*)pBufferContext; if (completed_buffer != nullptr) { - auto scoped_lock = osd_scoped_lock(m_buffer_lock.get()); + std::lock_guard lock(m_buffer_lock); m_buffer_pool->return_to_pool(completed_buffer); } @@ -625,7 +595,7 @@ void sound_xaudio2::submit_needed() if (state.BuffersQueued >= 1) return; - osd_scoped_lock lock_scope(m_buffer_lock.get()); + std::lock_guard lock(m_buffer_lock); // Roll the buffer roll_buffer(); diff --git a/src/osd/modules/sync/osdsync.h b/src/osd/modules/sync/osdsync.h index 46d32b09135..e6e5e2f99c9 100644 --- a/src/osd/modules/sync/osdsync.h +++ b/src/osd/modules/sync/osdsync.h @@ -24,7 +24,7 @@ struct osd_event; /*----------------------------------------------------------------------------- - osd_lock_event_alloc: allocate a new event + osd_event_alloc: allocate a new event Parameters: @@ -174,18 +174,4 @@ int osd_thread_cpu_affinity(osd_thread *thread, UINT32 mask); -----------------------------------------------------------------------------*/ void osd_thread_wait_free(osd_thread *thread); -//============================================================ -// Scalable Locks -//============================================================ - -struct osd_scalable_lock; - -osd_scalable_lock *osd_scalable_lock_alloc(void); - -INT32 osd_scalable_lock_acquire(osd_scalable_lock *lock); - -void osd_scalable_lock_release(osd_scalable_lock *lock, INT32 myslot); - -void osd_scalable_lock_free(osd_scalable_lock *lock); - #endif /* __OSDSYNC__ */ diff --git a/src/osd/modules/sync/sync_mini.cpp b/src/osd/modules/sync/sync_mini.cpp index f5e6accb0c7..5829eb6d63c 100644 --- a/src/osd/modules/sync/sync_mini.cpp +++ b/src/osd/modules/sync/sync_mini.cpp @@ -19,63 +19,6 @@ struct _osd_thread { }; -//============================================================ -// osd_lock_alloc -//============================================================ - -osd_lock *osd_lock_alloc(void) -{ - // the minimal implementation does not support threading - // just return a dummy value here - return (osd_lock *)1; -} - - -//============================================================ -// osd_lock_acquire -//============================================================ - -void osd_lock_acquire(osd_lock *lock) -{ - // the minimal implementation does not support threading - // the acquire always "succeeds" -} - - -//============================================================ -// osd_lock_try -//============================================================ - -int osd_lock_try(osd_lock *lock) -{ - // the minimal implementation does not support threading - // the acquire always "succeeds" - return TRUE; -} - - -//============================================================ -// osd_lock_release -//============================================================ - -void osd_lock_release(osd_lock *lock) -{ - // the minimal implementation does not support threading - // do nothing here -} - - -//============================================================ -// osd_lock_free -//============================================================ - -void osd_lock_free(osd_lock *lock) -{ - // the minimal implementation does not support threading - // do nothing here -} - - //============================================================ // osd_event_alloc //============================================================ diff --git a/src/osd/modules/sync/sync_ntc.cpp b/src/osd/modules/sync/sync_ntc.cpp index 462c56ee434..c78f67ce64a 100644 --- a/src/osd/modules/sync/sync_ntc.cpp +++ b/src/osd/modules/sync/sync_ntc.cpp @@ -38,16 +38,6 @@ #include #include -struct osd_lock { - volatile pthread_t holder; - INT32 count; -#ifdef PTR64 - INT8 padding[52]; // Fill a 64-byte cache line -#else - INT8 padding[56]; // A bit more padding -#endif -}; - struct osd_event { pthread_mutex_t mutex; pthread_cond_t cond; @@ -69,275 +59,6 @@ struct osd_thread { pthread_t thread; }; -struct osd_scalable_lock -{ - struct - { - volatile INT32 haslock; // do we have the lock? - INT32 filler[64/4-1]; // assumes a 64-byte cache line - } slot[WORK_MAX_THREADS]; // one slot per thread - volatile INT32 nextindex; // index of next slot to use -}; - - -//============================================================ -// Scalable Locks -//============================================================ - -osd_scalable_lock *osd_scalable_lock_alloc(void) -{ - osd_scalable_lock *lock; - - lock = (osd_scalable_lock *)calloc(1, sizeof(*lock)); - if (lock == NULL) - return NULL; - - memset(lock, 0, sizeof(*lock)); - lock->slot[0].haslock = TRUE; - return lock; -} - - -INT32 osd_scalable_lock_acquire(osd_scalable_lock *lock) -{ - INT32 myslot = (atomic_increment32(&lock->nextindex) - 1) & (WORK_MAX_THREADS - 1); - -#if defined(__i386__) || defined(__x86_64__) - register INT32 tmp; - __asm__ __volatile__ ( - "1: clr %[tmp] ;" - " xchg %[haslock], %[tmp] ;" - " test %[tmp], %[tmp] ;" - " jne 3f ;" - "2: mov %[haslock], %[tmp] ;" - " test %[tmp], %[tmp] ;" - " jne 1b ;" - " pause ;" - " jmp 2b ;" - "3: " - : [haslock] "+m" (lock->slot[myslot].haslock) - , [tmp] "=&r" (tmp) - : - : "cc" - ); -#elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__) - register INT32 tmp; - __asm__ __volatile__ ( - "1: lwarx %[tmp], 0, %[haslock] \n" - " cmpwi %[tmp], 0 \n" - " bne 3f \n" - "2: lwzx %[tmp], 0, %[haslock] \n" - " cmpwi %[tmp], 0 \n" - " bne 1b \n" - " nop \n" - " nop \n" - " b 2b \n" - "3: li %[tmp], 0 \n" - " stwcx. %[tmp], 0, %[haslock] \n" - " bne- 1b \n" - " lwsync \n" - : [tmp] "=&r" (tmp) - : [haslock] "r" (&lock->slot[myslot].haslock) - : "cr0" - ); -#else - INT32 backoff = 1; - while (!osd_compare_exchange32(&lock->slot[myslot].haslock, TRUE, FALSE)) - { - INT32 backcount; - for (backcount = 0; backcount < backoff; backcount++) - osd_yield_processor(); - backoff <<= 1; - } -#endif - return myslot; -} - - -void osd_scalable_lock_release(osd_scalable_lock *lock, INT32 myslot) -{ -#if defined(__i386__) || defined(__x86_64__) - register INT32 tmp = TRUE; - __asm__ __volatile__ ( - " xchg %[haslock], %[tmp] ;" - : [haslock] "+m" (lock->slot[(myslot + 1) & (WORK_MAX_THREADS - 1)].haslock) - , [tmp] "+r" (tmp) - : - ); -#elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__) - lock->slot[(myslot + 1) & (WORK_MAX_THREADS - 1)].haslock = TRUE; - __asm__ __volatile__ ( " lwsync " : : ); -#else - osd_exchange32(&lock->slot[(myslot + 1) & (WORK_MAX_THREADS - 1)].haslock, TRUE); -#endif -} - -void osd_scalable_lock_free(osd_scalable_lock *lock) -{ - free(lock); -} - -static inline pthread_t osd_compare_exchange_pthread_t(pthread_t volatile *ptr, pthread_t compare, pthread_t exchange) -{ -#ifdef PTR64 - INT64 result = compare_exchange64((INT64 volatile *)ptr, (INT64)compare, (INT64)exchange); -#else - INT32 result = compare_exchange32((INT32 volatile *)ptr, (INT32)compare, (INT32)exchange); -#endif - return (pthread_t)result; -} - -static inline pthread_t osd_exchange_pthread_t(pthread_t volatile *ptr, pthread_t exchange) -{ -#ifdef PTR64 - INT64 result = osd_exchange64((INT64 volatile *)ptr, (INT64)exchange); -#else - INT32 result = atomic_exchange32((INT32 volatile *)ptr, (INT32)exchange); -#endif - return (pthread_t)result; -} - - -//============================================================ -// osd_lock_alloc -//============================================================ - -osd_lock *osd_lock_alloc(void) -{ - osd_lock *lock; - - lock = (osd_lock *)calloc(1, sizeof(osd_lock)); - if (lock == NULL) - return NULL; - - lock->holder = 0; - lock->count = 0; - - return lock; -} - -//============================================================ -// osd_lock_acquire -//============================================================ - -void osd_lock_acquire(osd_lock *lock) -{ - pthread_t current, prev; - - current = pthread_self(); - prev = osd_compare_exchange_pthread_t(&lock->holder, 0, current); - if (prev != nullptr && prev != current) - { - do { - register INT32 spin = 10000; // Convenient spin count - register pthread_t tmp; -#if defined(__i386__) || defined(__x86_64__) - __asm__ __volatile__ ( - "1: pause ;" - " mov %[holder], %[tmp] ;" - " test %[tmp], %[tmp] ;" - " loopne 1b ;" - : [spin] "+c" (spin) - , [tmp] "=&r" (tmp) - : [holder] "m" (lock->holder) - : "cc" - ); -#elif defined(__ppc__) || defined(__PPC__) - __asm__ __volatile__ ( - "1: nop \n" - " nop \n" - " lwzx %[tmp], 0, %[holder] \n" - " cmpwi %[tmp], 0 \n" - " bdnzt eq, 1b \n" - : [spin] "+c" (spin) - , [tmp] "=&r" (tmp) - : [holder] "r" (&lock->holder) - : "cr0" - ); -#elif defined(__ppc64__) || defined(__PPC64__) - __asm__ __volatile__ ( - "1: nop \n" - " nop \n" - " ldx %[tmp], 0, %[holder] \n" - " cmpdi %[tmp], 0 \n" - " bdnzt eq, 1b \n" - : [spin] "+c" (spin) - , [tmp] "=&r" (tmp) - : [holder] "r" (&lock->holder) - : "cr0" - ); -#else - while (--spin > 0 && lock->holder != NULL) - osd_yield_processor(); -#endif -#if 0 - /* If you mean to use locks as a blocking mechanism for extended - * periods of time, you should do something like this. However, - * it kills the performance of gaelco3d. - */ - if (spin == 0) - { - struct timespec sleep = { 0, 100000 }, remaining; - nanosleep(&sleep, &remaining); // sleep for 100us - } -#endif - } while (osd_compare_exchange_pthread_t(&lock->holder, 0, current) != nullptr); - } - lock->count++; -} - -//============================================================ -// osd_lock_try -//============================================================ - -int osd_lock_try(osd_lock *lock) -{ - pthread_t current, prev; - - current = pthread_self(); - prev = osd_compare_exchange_pthread_t(&lock->holder, 0, current); - if (prev == nullptr || prev == current) - { - lock->count++; - return 1; - } - return 0; -} - -//============================================================ -// osd_lock_release -//============================================================ - -void osd_lock_release(osd_lock *lock) -{ - pthread_t current; - - current = pthread_self(); - if (lock->holder == current) - { - if (--lock->count == 0) -#if defined(__ppc__) || defined(__PPC__) || defined(__ppc64__) || defined(__PPC64__) - lock->holder = 0; - __asm__ __volatile__( " lwsync " : : ); -#else - osd_exchange_pthread_t(&lock->holder, 0); -#endif - return; - } - - // trying to release a lock you don't hold is bad! -// assert(lock->holder == pthread_self()); -} - -//============================================================ -// osd_lock_free -//============================================================ - -void osd_lock_free(osd_lock *lock) -{ - free(lock); -} - //============================================================ // osd_event_alloc //============================================================ diff --git a/src/osd/modules/sync/sync_os2.cpp b/src/osd/modules/sync/sync_os2.cpp index dba34065610..6e3265bb198 100644 --- a/src/osd/modules/sync/sync_os2.cpp +++ b/src/osd/modules/sync/sync_os2.cpp @@ -31,16 +31,6 @@ #define pthread_t int #define pthread_self _gettid -struct osd_lock { - volatile pthread_t holder; - INT32 count; -#ifdef PTR64 - INT8 padding[52]; // Fill a 64-byte cache line -#else - INT8 padding[56]; // A bit more padding -#endif -}; - struct osd_event { HMTX hmtx; HEV hev; @@ -58,276 +48,6 @@ struct osd_thread { void *param; }; -struct osd_scalable_lock -{ - struct - { - volatile INT32 haslock; // do we have the lock? - INT32 filler[64/4-1]; // assumes a 64-byte cache line - } slot[WORK_MAX_THREADS]; // one slot per thread - volatile INT32 nextindex; // index of next slot to use -}; - - -//============================================================ -// Scalable Locks -//============================================================ - -osd_scalable_lock *osd_scalable_lock_alloc(void) -{ - osd_scalable_lock *lock; - - lock = (osd_scalable_lock *)calloc(1, sizeof(*lock)); - if (lock == NULL) - return NULL; - - memset(lock, 0, sizeof(*lock)); - lock->slot[0].haslock = TRUE; - return lock; -} - - -INT32 osd_scalable_lock_acquire(osd_scalable_lock *lock) -{ - INT32 myslot = (atomic_increment32(&lock->nextindex) - 1) & (WORK_MAX_THREADS - 1); - -#if defined(__i386__) || defined(__x86_64__) - register INT32 tmp; - __asm__ __volatile__ ( - "1: clr %[tmp] ;" - " xchg %[haslock], %[tmp] ;" - " test %[tmp], %[tmp] ;" - " jne 3f ;" - "2: mov %[haslock], %[tmp] ;" - " test %[tmp], %[tmp] ;" - " jne 1b ;" - " pause ;" - " jmp 2b ;" - "3: " - : [haslock] "+m" (lock->slot[myslot].haslock) - , [tmp] "=&r" (tmp) - : - : "%cc" - ); -#elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__) - register INT32 tmp; - __asm__ __volatile__ ( - "1: lwarx %[tmp], 0, %[haslock] \n" - " cmpwi %[tmp], 0 \n" - " bne 3f \n" - "2: lwzx %[tmp], 0, %[haslock] \n" - " cmpwi %[tmp], 0 \n" - " bne 1b \n" - " nop \n" - " nop \n" - " b 2b \n" - "3: li %[tmp], 0 \n" - " sync \n" - " stwcx. %[tmp], 0, %[haslock] \n" - " bne- 1b \n" - " eieio \n" - : [tmp] "=&r" (tmp) - : [haslock] "r" (&lock->slot[myslot].haslock) - : "cr0" - ); -#else - INT32 backoff = 1; - while (!osd_compare_exchange32(&lock->slot[myslot].haslock, TRUE, FALSE)) - { - INT32 backcount; - for (backcount = 0; backcount < backoff; backcount++) - osd_yield_processor(); - backoff <<= 1; - } -#endif - return myslot; -} - - -void osd_scalable_lock_release(osd_scalable_lock *lock, INT32 myslot) -{ -#if defined(__i386__) || defined(__x86_64__) - register INT32 tmp = TRUE; - __asm__ __volatile__ ( - " xchg %[haslock], %[tmp] ;" - : [haslock] "+m" (lock->slot[(myslot + 1) & (WORK_MAX_THREADS - 1)].haslock) - , [tmp] "+r" (tmp) - : - ); -#elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__) - lock->slot[(myslot + 1) & (WORK_MAX_THREADS - 1)].haslock = TRUE; - __asm__ __volatile__ ( " eieio " : : ); -#else - osd_exchange32(&lock->slot[(myslot + 1) & (WORK_MAX_THREADS - 1)].haslock, TRUE); -#endif -} - -void osd_scalable_lock_free(osd_scalable_lock *lock) -{ - free(lock); -} - -static inline pthread_t osd_compare_exchange_pthread_t(pthread_t volatile *ptr, pthread_t compare, pthread_t exchange) -{ -#ifdef PTR64 - INT64 result = compare_exchange64((INT64 volatile *)ptr, (INT64)compare, (INT64)exchange); -#else - INT32 result = compare_exchange32((INT32 volatile *)ptr, (INT32)compare, (INT32)exchange); -#endif - return (pthread_t)result; -} - -static inline pthread_t osd_exchange_pthread_t(pthread_t volatile *ptr, pthread_t exchange) -{ -#ifdef PTR64 - INT64 result = osd_exchange64((INT64 volatile *)ptr, (INT64)exchange); -#else - INT32 result = atomic_exchange32((INT32 volatile *)ptr, (INT32)exchange); -#endif - return (pthread_t)result; -} - - -//============================================================ -// osd_lock_alloc -//============================================================ - -osd_lock *osd_lock_alloc(void) -{ - osd_lock *lock; - - lock = (osd_lock *)calloc(1, sizeof(osd_lock)); - if (lock == NULL) - return NULL; - - lock->holder = 0; - lock->count = 0; - - return lock; -} - -//============================================================ -// osd_lock_acquire -//============================================================ - -void osd_lock_acquire(osd_lock *lock) -{ - pthread_t current, prev; - - current = pthread_self(); - prev = osd_compare_exchange_pthread_t(&lock->holder, 0, current); - if (prev != (size_t)NULL && prev != current) - { - do { - register INT32 spin = 10000; // Convenient spin count - register pthread_t tmp; -#if defined(__i386__) || defined(__x86_64__) - __asm__ __volatile__ ( - "1: pause ;" - " mov %[holder], %[tmp] ;" - " test %[tmp], %[tmp] ;" - " loopne 1b ;" - : [spin] "+c" (spin) - , [tmp] "=&r" (tmp) - : [holder] "m" (lock->holder) - : "%cc" - ); -#elif defined(__ppc__) || defined(__PPC__) - __asm__ __volatile__ ( - "1: nop \n" - " nop \n" - " lwzx %[tmp], 0, %[holder] \n" - " cmpwi %[tmp], 0 \n" - " bdnzt eq, 1b \n" - : [spin] "+c" (spin) - , [tmp] "=&r" (tmp) - : [holder] "r" (&lock->holder) - : "cr0" - ); -#elif defined(__ppc64__) || defined(__PPC64__) - __asm__ __volatile__ ( - "1: nop \n" - " nop \n" - " ldx %[tmp], 0, %[holder] \n" - " cmpdi %[tmp], 0 \n" - " bdnzt eq, 1b \n" - : [spin] "+c" (spin) - , [tmp] "=&r" (tmp) - : [holder] "r" (&lock->holder) - : "cr0" - ); -#else - while (--spin > 0 && lock->holder != NULL) - osd_yield_processor(); -#endif -#if 0 - /* If you mean to use locks as a blocking mechanism for extended - * periods of time, you should do something like this. However, - * it kills the performance of gaelco3d. - */ - if (spin == 0) - { - struct timespec sleep = { 0, 100000 }, remaining; - nanosleep(&sleep, &remaining); // sleep for 100us - } -#endif - } while (osd_compare_exchange_pthread_t(&lock->holder, 0, current) != (size_t)NULL); - } - lock->count++; -} - -//============================================================ -// osd_lock_try -//============================================================ - -int osd_lock_try(osd_lock *lock) -{ - pthread_t current, prev; - - current = pthread_self(); - prev = osd_compare_exchange_pthread_t(&lock->holder, 0, current); - if (prev == (size_t)NULL || prev == current) - { - lock->count++; - return 1; - } - return 0; -} - -//============================================================ -// osd_lock_release -//============================================================ - -void osd_lock_release(osd_lock *lock) -{ - pthread_t current; - - current = pthread_self(); - if (lock->holder == current) - { - if (--lock->count == 0) -#if defined(__ppc__) || defined(__PPC__) || defined(__ppc64__) || defined(__PPC64__) - lock->holder = 0; - __asm__ __volatile__( " eieio " : : ); -#else - osd_exchange_pthread_t(&lock->holder, 0); -#endif - return; - } - - // trying to release a lock you don't hold is bad! -// assert(lock->holder == pthread_self()); -} - -//============================================================ -// osd_lock_free -//============================================================ - -void osd_lock_free(osd_lock *lock) -{ - free(lock); -} - //============================================================ // osd_event_alloc //============================================================ diff --git a/src/osd/modules/sync/sync_sdl.cpp b/src/osd/modules/sync/sync_sdl.cpp index 90969b2a068..8a525723a45 100644 --- a/src/osd/modules/sync/sync_sdl.cpp +++ b/src/osd/modules/sync/sync_sdl.cpp @@ -51,138 +51,6 @@ struct osd_thread { void *param; }; -struct osd_scalable_lock -{ - SDL_mutex * mutex; -}; - -//============================================================ -// Scalable Locks -//============================================================ - -osd_scalable_lock *osd_scalable_lock_alloc(void) -{ - osd_scalable_lock *lock; - - lock = (osd_scalable_lock *)calloc(1, sizeof(*lock)); - if (lock == NULL) - return NULL; - - lock->mutex = SDL_CreateMutex(); - return lock; -} - - -INT32 osd_scalable_lock_acquire(osd_scalable_lock *lock) -{ - SDL_mutexP(lock->mutex); - return 0; -} - - -void osd_scalable_lock_release(osd_scalable_lock *lock, INT32 myslot) -{ - SDL_mutexV(lock->mutex); -} - -void osd_scalable_lock_free(osd_scalable_lock *lock) -{ - SDL_DestroyMutex(lock->mutex); - free(lock); -} - -//============================================================ -// osd_lock_alloc -//============================================================ - -osd_lock *osd_lock_alloc(void) -{ - hidden_mutex_t *mutex; - - mutex = (hidden_mutex_t *)calloc(1, sizeof(hidden_mutex_t)); - if (mutex == NULL) - return NULL; - - mutex->id = SDL_CreateMutex(); - - return (osd_lock *)mutex; -} - -//============================================================ -// osd_lock_acquire -//============================================================ - -void osd_lock_acquire(osd_lock *lock) -{ - hidden_mutex_t *mutex = (hidden_mutex_t *) lock; - - LOG(("osd_lock_acquire")); - /* get the lock */ - mutex->locked++; /* signal that we are *about* to lock - prevent osd_lock_try */ - SDL_mutexP(mutex->id); - mutex->threadid = SDL_ThreadID(); -} - -//============================================================ -// osd_lock_try -//============================================================ - -int osd_lock_try(osd_lock *lock) -{ - hidden_mutex_t *mutex = (hidden_mutex_t *) lock; - - LOG(("osd_lock_try")); - if (mutex->locked && mutex->threadid == SDL_ThreadID()) - { - /* get the lock */ - SDL_mutexP(mutex->id); - mutex->locked++; - mutex->threadid = SDL_ThreadID(); - return 1; - } - else if ((mutex->locked == 0)) - { - /* get the lock */ - mutex->locked++; - SDL_mutexP(mutex->id); - mutex->threadid = SDL_ThreadID(); - return 1; - } - else - { - /* fail */ - return 0; - } -} - -//============================================================ -// osd_lock_release -//============================================================ - -void osd_lock_release(osd_lock *lock) -{ - hidden_mutex_t *mutex = (hidden_mutex_t *) lock; - - LOG(("osd_lock_release")); - mutex->locked--; - if (mutex->locked == 0) - mutex->threadid = -1; - SDL_mutexV(mutex->id); -} - -//============================================================ -// osd_lock_free -//============================================================ - -void osd_lock_free(osd_lock *lock) -{ - hidden_mutex_t *mutex = (hidden_mutex_t *) lock; - - LOG(("osd_lock_free")); - //osd_lock_release(lock); - SDL_DestroyMutex(mutex->id); - free(mutex); -} //============================================================ // osd_event_alloc diff --git a/src/osd/modules/sync/sync_tc.cpp b/src/osd/modules/sync/sync_tc.cpp index 06dc699edce..64a6a760e96 100644 --- a/src/osd/modules/sync/sync_tc.cpp +++ b/src/osd/modules/sync/sync_tc.cpp @@ -58,123 +58,6 @@ struct osd_thread { pthread_t thread; }; -struct osd_scalable_lock -{ - osd_lock *lock; -}; - -//============================================================ -// Scalable Locks -//============================================================ - -osd_scalable_lock *osd_scalable_lock_alloc(void) -{ - osd_scalable_lock *lock; - - lock = (osd_scalable_lock *)calloc(1, sizeof(*lock)); - if (lock == NULL) - return NULL; - - lock->lock = osd_lock_alloc(); - return lock; -} - - -INT32 osd_scalable_lock_acquire(osd_scalable_lock *lock) -{ - osd_lock_acquire(lock->lock); - return 0; -} - - -void osd_scalable_lock_release(osd_scalable_lock *lock, INT32 myslot) -{ - osd_lock_release(lock->lock); -} - -void osd_scalable_lock_free(osd_scalable_lock *lock) -{ - osd_lock_free(lock->lock); - free(lock); -} - - -//============================================================ -// osd_lock_alloc -//============================================================ - -osd_lock *osd_lock_alloc(void) -{ - hidden_mutex_t *mutex; - pthread_mutexattr_t mtxattr; - - mutex = (hidden_mutex_t *)calloc(1, sizeof(hidden_mutex_t)); - if (mutex == NULL) - return NULL; - - pthread_mutexattr_init(&mtxattr); - pthread_mutexattr_settype(&mtxattr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&mutex->id, &mtxattr); - - return (osd_lock *)mutex; -} - -//============================================================ -// osd_lock_acquire -//============================================================ - -void osd_lock_acquire(osd_lock *lock) -{ - hidden_mutex_t *mutex = (hidden_mutex_t *) lock; - int r; - - r = pthread_mutex_lock(&mutex->id); - if (r==0) - return; - //osd_printf_error("Error on lock: %d: %s\n", r, strerror(r)); -} - -//============================================================ -// osd_lock_try -//============================================================ - -int osd_lock_try(osd_lock *lock) -{ - hidden_mutex_t *mutex = (hidden_mutex_t *) lock; - int r; - - r = pthread_mutex_trylock(&mutex->id); - if (r==0) - return 1; - //if (r!=EBUSY) - // osd_printf_error("Error on trylock: %d: %s\n", r, strerror(r)); - return 0; -} - -//============================================================ -// osd_lock_release -//============================================================ - -void osd_lock_release(osd_lock *lock) -{ - hidden_mutex_t *mutex = (hidden_mutex_t *) lock; - - pthread_mutex_unlock(&mutex->id); -} - -//============================================================ -// osd_lock_free -//============================================================ - -void osd_lock_free(osd_lock *lock) -{ - hidden_mutex_t *mutex = (hidden_mutex_t *) lock; - - //pthread_mutex_unlock(&mutex->id); - pthread_mutex_destroy(&mutex->id); - free(mutex); -} - //============================================================ // osd_event_alloc //============================================================ diff --git a/src/osd/modules/sync/sync_windows.cpp b/src/osd/modules/sync/sync_windows.cpp index 9439d68b72c..c744f345e6f 100644 --- a/src/osd/modules/sync/sync_windows.cpp +++ b/src/osd/modules/sync/sync_windows.cpp @@ -23,8 +23,6 @@ //============================================================ #define DEBUG_SLOW_LOCKS 0 -#define USE_SCALABLE_LOCKS (0) - //============================================================ @@ -33,11 +31,6 @@ typedef BOOL (WINAPI *try_enter_critical_section_ptr)(LPCRITICAL_SECTION lpCriticalSection); -struct osd_lock -{ - CRITICAL_SECTION critsect; -}; - struct osd_event { void * ptr; @@ -49,113 +42,6 @@ struct osd_thread { void *param; }; -struct osd_scalable_lock -{ -#if USE_SCALABLE_LOCKS - struct - { - volatile INT32 haslock; // do we have the lock? - INT32 filler[64/4-1]; // assumes a 64-byte cache line - } slot[WORK_MAX_THREADS]; // one slot per thread - volatile INT32 nextindex; // index of next slot to use -#else - CRITICAL_SECTION section; -#endif -}; - - -//============================================================ -// GLOBAL VARIABLES -//============================================================ - -static try_enter_critical_section_ptr try_enter_critical_section = nullptr; -static int checked_for_try_enter = FALSE; - - - -//============================================================ -// osd_lock_alloc -//============================================================ - -osd_lock *osd_lock_alloc(void) -{ - osd_lock *lock = (osd_lock *)malloc(sizeof(*lock)); - if (lock == nullptr) - return nullptr; - InitializeCriticalSection(&lock->critsect); - return lock; -} - - -//============================================================ -// osd_lock_acquire -//============================================================ - -void osd_lock_acquire(osd_lock *lock) -{ -#if DEBUG_SLOW_LOCKS - osd_ticks_t ticks = osd_ticks(); -#endif - - // block until we can acquire the lock - EnterCriticalSection(&lock->critsect); - -#if DEBUG_SLOW_LOCKS - // log any locks that take more than 1ms - ticks = osd_ticks() - ticks; - if (ticks > osd_ticks_per_second() / 1000) osd_printf_debug("Blocked %d ticks on lock acquire\n", (int)ticks); -#endif -} - - -//============================================================ -// osd_lock_try -//============================================================ - -int osd_lock_try(osd_lock *lock) -{ - int result = TRUE; - - // if we haven't yet checked for the TryEnter API, do it now - if (!checked_for_try_enter) - { - // see if we can use TryEnterCriticalSection - HMODULE library = LoadLibrary(TEXT("kernel32.dll")); - if (library != nullptr) - try_enter_critical_section = (try_enter_critical_section_ptr)GetProcAddress(library, "TryEnterCriticalSection"); - checked_for_try_enter = TRUE; - } - - // if we have it, use it, otherwise just block - if (try_enter_critical_section != nullptr) - result = (*try_enter_critical_section)(&lock->critsect); - else - EnterCriticalSection(&lock->critsect); - return result; -} - - -//============================================================ -// osd_lock_release -//============================================================ - -void osd_lock_release(osd_lock *lock) -{ - LeaveCriticalSection(&lock->critsect); -} - - -//============================================================ -// osd_lock_free -//============================================================ - -void osd_lock_free(osd_lock *lock) -{ - DeleteCriticalSection(&lock->critsect); - free(lock); -} - - //============================================================ // win_compare_exchange32 //============================================================ @@ -317,66 +203,3 @@ int osd_thread_cpu_affinity(osd_thread *thread, UINT32 mask) { return TRUE; } - -//============================================================ -// Scalable Locks -//============================================================ - -osd_scalable_lock *osd_scalable_lock_alloc(void) -{ - osd_scalable_lock *lock; - - lock = (osd_scalable_lock *)calloc(1, sizeof(*lock)); - if (lock == nullptr) - return nullptr; - - memset(lock, 0, sizeof(*lock)); -#if USE_SCALABLE_LOCKS - lock->slot[0].haslock = TRUE; -#else - InitializeCriticalSection(&lock->section); -#endif - return lock; -} - - -INT32 osd_scalable_lock_acquire(osd_scalable_lock *lock) -{ -#if USE_SCALABLE_LOCKS - INT32 myslot = (atomic_increment32(&lock->nextindex) - 1) & (WORK_MAX_THREADS - 1); - INT32 backoff = 1; - - while (!lock->slot[myslot].haslock) - { - INT32 backcount; - for (backcount = 0; backcount < backoff; backcount++) - osd_yield_processor(); - backoff <<= 1; - } - lock->slot[myslot].haslock = FALSE; - return myslot; -#else - EnterCriticalSection(&lock->section); - return 0; -#endif -} - - -void osd_scalable_lock_release(osd_scalable_lock *lock, INT32 myslot) -{ -#if USE_SCALABLE_LOCKS - atomic_exchange32(&lock->slot[(myslot + 1) & (WORK_MAX_THREADS - 1)].haslock, TRUE); -#else - LeaveCriticalSection(&lock->section); -#endif -} - - -void osd_scalable_lock_free(osd_scalable_lock *lock) -{ -#if USE_SCALABLE_LOCKS -#else - DeleteCriticalSection(&lock->section); -#endif - free(lock); -} diff --git a/src/osd/modules/sync/work_osd.cpp b/src/osd/modules/sync/work_osd.cpp index e5582584666..2d37feb0c56 100644 --- a/src/osd/modules/sync/work_osd.cpp +++ b/src/osd/modules/sync/work_osd.cpp @@ -18,6 +18,7 @@ #include #endif #endif +#include // MAME headers #include "osdcore.h" @@ -109,7 +110,7 @@ struct work_thread_info struct osd_work_queue { - osd_scalable_lock * lock; // lock for protecting the queue + std::mutex *lock; // lock for protecting the queue osd_work_item * volatile list; // list of items in the queue osd_work_item ** volatile tailptr; // pointer to the tail pointer of work items in the queue osd_work_item * volatile free; // free list of work items @@ -188,7 +189,7 @@ osd_work_queue *osd_work_queue_alloc(int flags) goto error; // initialize the critical section - queue->lock = osd_scalable_lock_alloc(); + queue->lock = new std::mutex(); if (queue->lock == NULL) goto error; @@ -421,7 +422,7 @@ void osd_work_queue_free(osd_work_queue *queue) printf("Spin loops = %9d\n", queue->spinloops); #endif - osd_scalable_lock_free(queue->lock); + delete queue->lock; // free the queue itself osd_free(queue); } @@ -435,7 +436,6 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call { osd_work_item *itemlist = NULL, *lastitem = NULL; osd_work_item **item_tailptr = &itemlist; - INT32 lockslot; int itemnum; // loop over items, building up a local list of work @@ -444,12 +444,13 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call osd_work_item *item; // first allocate a new work item; try the free list first - INT32 myslot = osd_scalable_lock_acquire(queue->lock); - do { - item = (osd_work_item *)queue->free; - } while (item != NULL && compare_exchange_ptr((PVOID volatile *)&queue->free, item, item->next) != item); - osd_scalable_lock_release(queue->lock, myslot); + std::lock_guard(*queue->lock); + do + { + item = (osd_work_item *)queue->free; + } while (item != NULL && compare_exchange_ptr((PVOID volatile *)&queue->free, item, item->next) != item); + } // if nothing, allocate something new if (item == NULL) @@ -482,10 +483,11 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call } // enqueue the whole thing within the critical section - lockslot = osd_scalable_lock_acquire(queue->lock); - *queue->tailptr = itemlist; - queue->tailptr = item_tailptr; - osd_scalable_lock_release(queue->lock, lockslot); + { + std::lock_guard(*queue->lock); + *queue->tailptr = itemlist; + queue->tailptr = item_tailptr; + } // increment the number of items in the queue atomic_add32(&queue->items, numitems); @@ -539,9 +541,8 @@ int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout) // if we don't have an event, create one if (item->event == NULL) { - INT32 lockslot = osd_scalable_lock_acquire(item->queue->lock); + std::lock_guard(*item->queue->lock); item->event = osd_event_alloc(TRUE, FALSE); // manual reset, not signalled - osd_scalable_lock_release(item->queue->lock, lockslot); } else osd_event_reset(item->event); @@ -584,13 +585,12 @@ void osd_work_item_release(osd_work_item *item) osd_work_item_wait(item, 100 * osd_ticks_per_second()); // add us to the free list on our queue - INT32 lockslot = osd_scalable_lock_acquire(item->queue->lock); + std::lock_guard(*item->queue->lock); do { next = (osd_work_item *)item->queue->free; item->next = next; } while (compare_exchange_ptr((PVOID volatile *)&item->queue->free, next, item) != next); - osd_scalable_lock_release(item->queue->lock, lockslot); } @@ -711,7 +711,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa // use a critical section to synchronize the removal of items { - INT32 lockslot = osd_scalable_lock_acquire(queue->lock); + std::lock_guard(*queue->lock); if (queue->list == NULL) { end_loop = true; @@ -727,7 +727,6 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa queue->tailptr = (osd_work_item **)&queue->list; } } - osd_scalable_lock_release(queue->lock, lockslot); } if (end_loop) @@ -753,13 +752,12 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa // set the result and signal the event else { - INT32 lockslot = osd_scalable_lock_acquire(item->queue->lock); + std::lock_guard(*queue->lock); if (item->event != NULL) { osd_event_set(item->event); add_to_stat(&item->queue->setevents, 1); } - osd_scalable_lock_release(item->queue->lock, lockslot); } // if we removed an item and there's still work to do, bump the stats @@ -780,8 +778,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa bool queue_has_list_items(osd_work_queue *queue) { - INT32 lockslot = osd_scalable_lock_acquire(queue->lock); + std::lock_guard(*queue->lock); bool has_list_items = (queue->list != NULL); - osd_scalable_lock_release(queue->lock, lockslot); return has_list_items; } diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h index 0a4f351e5e9..cd08fa8aa4e 100644 --- a/src/osd/osdcore.h +++ b/src/osd/osdcore.h @@ -440,93 +440,6 @@ osd_ticks_t osd_ticks_per_second(void); -----------------------------------------------------------------------------*/ void osd_sleep(osd_ticks_t duration); - - -/*************************************************************************** - SYNCHRONIZATION INTERFACES -***************************************************************************/ - -/* osd_lock is an opaque type which represents a recursive lock/mutex */ -struct osd_lock; - - -/*----------------------------------------------------------------------------- - osd_lock_alloc: allocate a new lock - - Parameters: - - None. - - Return value: - - A pointer to the allocated lock. ------------------------------------------------------------------------------*/ -osd_lock *osd_lock_alloc(void); - - -/*----------------------------------------------------------------------------- - osd_lock_acquire: acquire a lock, blocking until it can be acquired - - Parameters: - - lock - a pointer to a previously allocated osd_lock. - - Return value: - - None. - - Notes: - - osd_locks are defined to be recursive. If the current thread already - owns the lock, this function should return immediately. ------------------------------------------------------------------------------*/ -void osd_lock_acquire(osd_lock *lock); - - -/*----------------------------------------------------------------------------- - osd_lock_try: attempt to acquire a lock - - Parameters: - - lock - a pointer to a previously allocated osd_lock. - - Return value: - - TRUE if the lock was available and was acquired successfully. - FALSE if the lock was already in used by another thread. ------------------------------------------------------------------------------*/ -int osd_lock_try(osd_lock *lock); - - -/*----------------------------------------------------------------------------- - osd_lock_release: release control of a lock that has been acquired - - Parameters: - - lock - a pointer to a previously allocated osd_lock. - - Return value: - - None. ------------------------------------------------------------------------------*/ -void osd_lock_release(osd_lock *lock); - - -/*----------------------------------------------------------------------------- - osd_lock_free: free the memory and resources associated with an osd_lock - - Parameters: - - lock - a pointer to a previously allocated osd_lock. - - Return value: - - None. ------------------------------------------------------------------------------*/ -void osd_lock_free(osd_lock *lock); - - - /*************************************************************************** WORK ITEM INTERFACES ***************************************************************************/ diff --git a/src/osd/osdmini/minisync.cpp b/src/osd/osdmini/minisync.cpp deleted file mode 100644 index a78765f29ed..00000000000 --- a/src/osd/osdmini/minisync.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -//============================================================ -// -// minisync.c - Minimal core synchronization functions -// -//============================================================ - -#include "osdcore.h" - - -//============================================================ -// osd_lock_alloc -//============================================================ - -osd_lock *osd_lock_alloc(void) -{ - // the minimal implementation does not support threading - // just return a dummy value here - return (osd_lock *)1; -} - - -//============================================================ -// osd_lock_acquire -//============================================================ - -void osd_lock_acquire(osd_lock *lock) -{ - // the minimal implementation does not support threading - // the acquire always "succeeds" -} - - -//============================================================ -// osd_lock_try -//============================================================ - -int osd_lock_try(osd_lock *lock) -{ - // the minimal implementation does not support threading - // the acquire always "succeeds" - return TRUE; -} - - -//============================================================ -// osd_lock_release -//============================================================ - -void osd_lock_release(osd_lock *lock) -{ - // the minimal implementation does not support threading - // do nothing here -} - - -//============================================================ -// osd_lock_free -//============================================================ - -void osd_lock_free(osd_lock *lock) -{ - // the minimal implementation does not support threading - // do nothing here -} diff --git a/src/osd/sdl/input.cpp b/src/osd/sdl/input.cpp index 4dfb5bd0ad0..b0d4d8c1096 100644 --- a/src/osd/sdl/input.cpp +++ b/src/osd/sdl/input.cpp @@ -15,6 +15,7 @@ #include "sdlinc.h" #include #include +#include #if USE_XINPUT // for xinput @@ -154,7 +155,7 @@ struct device_info //============================================================ // global states -static osd_lock * input_lock; +static std::mutex input_lock; static UINT8 input_paused; static sdl_window_info * focus_window = NULL; @@ -1380,10 +1381,6 @@ bool sdl_osd_interface::input_init() app_has_mouse_focus = 1; - // allocate a lock for input synchronizations - input_lock = osd_lock_alloc(); - assert_always(input_lock != NULL, "Failed to allocate input_lock"); - // register the keyboards sdlinput_register_keyboards(machine()); @@ -1441,9 +1438,6 @@ void sdl_osd_interface::input_resume() void sdl_osd_interface::input_exit() { - // free the lock - osd_lock_free(input_lock); - // deregister sdlinput_deregister_joysticks(machine()); @@ -1568,7 +1562,7 @@ void sdlinput_process_events_buf() if (SDLMAME_EVENTS_IN_WORKER_THREAD) { - osd_lock_acquire(input_lock); + std::lock_guard lock(input_lock); #if (SDLMAME_SDL2) /* Make sure we get all pending events */ SDL_PumpEvents(); @@ -1580,7 +1574,6 @@ void sdlinput_process_events_buf() else osd_printf_warning("Event Buffer Overflow!\n"); } - osd_lock_release(input_lock); } else SDL_PumpEvents(); @@ -1709,11 +1702,10 @@ void sdlinput_poll(running_machine &machine) if (SDLMAME_EVENTS_IN_WORKER_THREAD) { - osd_lock_acquire(input_lock); + std::lock_guard lock(input_lock); memcpy(loc_event_buf, event_buf, sizeof(event_buf)); loc_event_buf_count = event_buf_count; event_buf_count = 0; - osd_lock_release(input_lock); bufp = 0; } diff --git a/src/osd/windows/input.cpp b/src/osd/windows/input.cpp index 77adda7a2ca..9157036ffd5 100644 --- a/src/osd/windows/input.cpp +++ b/src/osd/windows/input.cpp @@ -39,6 +39,7 @@ #include "config.h" #include "winutil.h" +#include //============================================================ // PARAMETERS @@ -166,7 +167,7 @@ typedef /*WINUSERAPI*/ BOOL (WINAPI *register_rawinput_devices_ptr)(IN PCRAWINPU // global states static bool input_enabled; -static osd_lock * input_lock; +static std::mutex input_lock; static bool input_paused; static DWORD last_poll; @@ -469,10 +470,6 @@ static inline INT32 normalize_absolute_axis(INT32 raw, INT32 rawmin, INT32 rawma bool windows_osd_interface::input_init() { - // allocate a lock for input synchronizations, since messages sometimes come from another thread - input_lock = osd_lock_alloc(); - assert_always(input_lock != NULL, "Failed to allocate input_lock"); - // decode the options lightgun_shared_axis_mode = downcast(machine().options()).dual_lightgun(); @@ -512,15 +509,8 @@ void windows_osd_interface::input_resume() void windows_osd_interface::input_exit() { // acquire the lock and turn off input (this ensures everyone is done) - if (input_lock != NULL) - { - osd_lock_acquire(input_lock); - input_enabled = false; - osd_lock_release(input_lock); - - // free the lock - osd_lock_free(input_lock); - } + std::lock_guard lock(input_lock); + input_enabled = false; } @@ -613,7 +603,7 @@ BOOL wininput_handle_mouse_button(int button, int down, int x, int y) } // take the lock - osd_lock_acquire(input_lock); + std::lock_guard lock(input_lock); // set the button state devinfo->mouse.state.rgbButtons[button] = down ? 0x80 : 0x00; @@ -632,9 +622,6 @@ BOOL wininput_handle_mouse_button(int button, int down, int x, int y) devinfo->mouse.state.lX = normalize_absolute_axis(mousepos.x, client_rect.left, client_rect.right); devinfo->mouse.state.lY = normalize_absolute_axis(mousepos.y, client_rect.top, client_rect.bottom); } - - // release the lock - osd_lock_release(input_lock); return TRUE; } @@ -675,18 +662,16 @@ BOOL wininput_handle_raw(HANDLE device) // handle keyboard input if (input->header.dwType == RIM_TYPEKEYBOARD) { - osd_lock_acquire(input_lock); + std::lock_guard lock(input_lock); rawinput_keyboard_update(input->header.hDevice, &input->data.keyboard); - osd_lock_release(input_lock); result = TRUE; } // handle mouse input else if (input->header.dwType == RIM_TYPEMOUSE) { - osd_lock_acquire(input_lock); + std::lock_guard lock(input_lock); rawinput_mouse_update(input->header.hDevice, &input->data.mouse); - osd_lock_release(input_lock); result = TRUE; } } @@ -2201,14 +2186,13 @@ static void rawinput_mouse_poll(device_info *devinfo) poll_if_necessary(devinfo->machine()); // copy the accumulated raw state to the actual state - osd_lock_acquire(input_lock); + std::lock_guard lock(input_lock); devinfo->mouse.state.lX = devinfo->mouse.raw_x; devinfo->mouse.state.lY = devinfo->mouse.raw_y; devinfo->mouse.state.lZ = devinfo->mouse.raw_z; devinfo->mouse.raw_x = 0; devinfo->mouse.raw_y = 0; devinfo->mouse.raw_z = 0; - osd_lock_release(input_lock); } diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 6111859a255..046211d4f29 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -300,7 +300,6 @@ win_window_info::win_window_info(running_machine &machine) m_fullscreen(0), m_fullscreen_safe(0), m_aspect(0), - m_render_lock(NULL), m_target(NULL), m_targetview(0), m_targetorient(0), @@ -672,9 +671,6 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in *last_window_ptr = window; last_window_ptr = &window->m_next; - // create a lock that we can use to skip blitting - window->m_render_lock = osd_lock_alloc(); - // load the layout window->m_target = machine.render().target_alloc(); @@ -746,11 +742,6 @@ void win_window_info::destroy() // free the render target machine().render().target_free(m_target); - - // FIXME: move to destructor - // free the lock - osd_lock_free(m_render_lock); - } @@ -798,9 +789,9 @@ void win_window_info::update() // only block if we're throttled if (machine().video().throttled() || timeGetTime() - last_update_time > 250) - osd_lock_acquire(m_render_lock); + m_render_lock.lock(); else - got_lock = osd_lock_try(m_render_lock); + got_lock = m_render_lock.try_lock(); // only render if we were able to get the lock if (got_lock) @@ -810,7 +801,7 @@ void win_window_info::update() mtlog_add("winwindow_video_window_update: got lock"); // don't hold the lock; we just used it to see if rendering was still happening - osd_lock_release(m_render_lock); + m_render_lock.unlock(); // ensure the target bounds are up-to-date, and then get the primitives primlist = m_renderer->get_primitives(); @@ -1492,7 +1483,7 @@ void win_window_info::draw_video_contents(HDC dc, int update) mtlog_add("draw_video_contents: begin"); mtlog_add("draw_video_contents: render lock acquire"); - osd_lock_acquire(m_render_lock); + std::lock_guard lock(m_render_lock); mtlog_add("draw_video_contents: render lock acquired"); // if we're iconic, don't bother @@ -1516,7 +1507,6 @@ void win_window_info::draw_video_contents(HDC dc, int update) } } - osd_lock_release(m_render_lock); mtlog_add("draw_video_contents: render lock released"); mtlog_add("draw_video_contents: end"); diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h index 62d4f57db55..6a925494f93 100644 --- a/src/osd/windows/window.h +++ b/src/osd/windows/window.h @@ -9,6 +9,7 @@ #ifndef __WIN_WINDOW__ #define __WIN_WINDOW__ +#include #include "video.h" #include "render.h" @@ -92,7 +93,7 @@ public: float m_aspect; // rendering info - osd_lock * m_render_lock; + std::mutex m_render_lock; render_target * m_target; int m_targetview; int m_targetorient; -- cgit v1.2.3-70-g09d2 From 5f3e6c8bdc4784d55615b9340e5e09a2214d2ae2 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 30 Jan 2016 20:53:28 +0100 Subject: fixed clang compile of m68kmake(nw) --- .gitignore | 1 + src/devices/cpu/m68000/m68kmake.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e3efcc2cd0a..0edfb01a5b7 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,5 @@ regtests/jedutil/output /src/devices/cpu/m68000/m68kops.cpp /src/devices/cpu/m68000/m68kops.h /src/devices/cpu/m68000/m68kmake.* +/src/devices/cpu/m68000/m68kmake !/src/devices/cpu/m68000/m68kmake.cpp \ No newline at end of file diff --git a/src/devices/cpu/m68000/m68kmake.cpp b/src/devices/cpu/m68000/m68kmake.cpp index f36797d76ba..941ae23f0aa 100644 --- a/src/devices/cpu/m68000/m68kmake.cpp +++ b/src/devices/cpu/m68000/m68kmake.cpp @@ -670,7 +670,7 @@ static opcode_struct* find_opcode(char* name, int size, char* spec_proc, char* s opcode_struct* op; - for(op = g_opcode_input_table;op->name != nullptr;op++) + for(op = g_opcode_input_table;op->name[0] != 0;op++) { if( strcmp(name, op->name) == 0 && (size == op->size) && -- cgit v1.2.3-70-g09d2 From c8bef31f09e65c6a9968d0eec65e7e87ab3dd2ac Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Sat, 30 Jan 2016 20:59:42 +0100 Subject: This fix VS2015 warning (and building) about uninitialized variable. (note: I don't think is right initialized to 0, but I don't have the skills necessary to determine the proper value.) --- src/devices/video/ef9365.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/video/ef9365.cpp b/src/devices/video/ef9365.cpp index f923cfd0813..5f81d7f45b5 100644 --- a/src/devices/video/ef9365.cpp +++ b/src/devices/video/ef9365.cpp @@ -938,7 +938,7 @@ void ef9365_device::screen_scanning( int force_clear ) void ef9365_device::ef9365_exec(UINT8 cmd) { int tmp_delta_x,tmp_delta_y; - int busy_cycles; + int busy_cycles = 0; m_state = 0; if( ( cmd>>4 ) == 0 ) -- cgit v1.2.3-70-g09d2 From 7951505891c5a69e087d5b76453de0bec910e15b Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 30 Jan 2016 22:21:23 +0100 Subject: fidel*: added(rather, much improved) internal artwork for VSC,CSC,SC12 --- src/mame/drivers/fidel6502.cpp | 265 ++++++++-------- src/mame/drivers/fidelz80.cpp | 134 ++++---- src/mame/layout/fidel_csc.lay | 492 +++++++++++++++++++++++++++++ src/mame/layout/fidel_sc12.lay | 508 ++++++++++++++++++++++++++++-- src/mame/layout/fidel_vsc.lay | 682 +++++++++++++++++++++++++++-------------- 5 files changed, 1632 insertions(+), 449 deletions(-) create mode 100644 src/mame/layout/fidel_csc.lay diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index d080b4b015d..783ec11f5e1 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -23,10 +23,9 @@ #include "includes/fidelz80.h" // internal artwork -#include "fidel_sc12.lh" +#include "fidel_csc.lh" // clickable #include "fidel_fev.lh" - -extern const char layout_fidel_vsc[]; // same layout as fidelz80/vsc +#include "fidel_sc12.lh" // clickable class fidel6502_state : public fidelz80base_state @@ -316,91 +315,91 @@ ADDRESS_MAP_END static INPUT_PORTS_START( csc ) PORT_START("IN.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a8") PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) PORT_START("IN.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b8") PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV") PORT_CODE(KEYCODE_V) PORT_START("IN.2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c8") PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TM") PORT_CODE(KEYCODE_T) PORT_START("IN.3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d8") PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) PORT_START("IN.4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e8") PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) PORT_START("IN.5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f8") PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) PORT_START("IN.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g8") PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("IN.7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h8") PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("IN.8") @@ -424,84 +423,84 @@ INPUT_PORTS_END static INPUT_PORTS_START( sc12 ) PORT_START("IN.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a8") PORT_START("IN.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b8") PORT_START("IN.2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c8") PORT_START("IN.3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d8") PORT_START("IN.4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e8") PORT_START("IN.5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f8") PORT_START("IN.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g8") PORT_START("IN.7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h8") PORT_START("IN.8") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV / Pawn") PORT_CODE(KEYCODE_1) @@ -543,7 +542,7 @@ static MACHINE_CONFIG_START( csc, fidel6502_state ) MCFG_PIA_CB2_HANDLER(WRITELINE(fidel6502_state, csc_pia1_cb2_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_fidel_vsc) + MCFG_DEFAULT_LAYOUT(layout_fidel_csc) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -681,6 +680,6 @@ COMP( 1981, cscsp, csc, 0, csc, csc, driver_device, 0, "Fidelit COMP( 1981, cscg, csc, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (German)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) COMP( 1981, cscfr, csc, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (French)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) COMP( 1987, fexcelv, 0, 0, fev, csc, driver_device, 0, "Fidelity Electronics", "Voice Excellence", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 4f81b9ab7cd..c0bef6fdc2d 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -12,6 +12,8 @@ "I I am Fidelity's chess challenger", instead. - correctly hook up VBRC speech so that the z80 is halted while words are being spoken + Chess pieces are required, but theoretically blindfold chess is possible. + Chessboard artwork is provided for boards with pressure/magnet sensors. Read the official manual(s) on how to play. Keypad legend: @@ -24,6 +26,8 @@ - TB: Take Back - DM: Display Move/Double Move - RV: Reverse + - ST: Set/Stop + - TM: Time Peripherals, compatible with various boards: - Fidelity Challenger Printer - thermal printer, MCU=? @@ -710,8 +714,8 @@ ROM A11 is however tied to the CPU's XYZ // internal artwork #include "fidel_cc.lh" #include "fidel_vcc.lh" -#include "fidel_vsc.lh" #include "fidel_vbrc.lh" +#include "fidel_vsc.lh" // clickable class fidelz80_state : public fidelz80base_state @@ -1357,84 +1361,84 @@ INPUT_PORTS_END static INPUT_PORTS_START( vsc ) PORT_START("IN.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a8") PORT_START("IN.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b8") PORT_START("IN.2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c8") PORT_START("IN.3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d8") PORT_START("IN.4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e8") PORT_START("IN.5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f8") PORT_START("IN.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g8") PORT_START("IN.7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h8") PORT_START("IN.8") // buttons on the right PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) diff --git a/src/mame/layout/fidel_csc.lay b/src/mame/layout/fidel_csc.lay new file mode 100644 index 00000000000..34545563175 --- /dev/null +++ b/src/mame/layout/fidel_csc.lay @@ -0,0 +1,492 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/fidel_sc12.lay b/src/mame/layout/fidel_sc12.lay index b765ef5ddd1..dd653679a7e 100644 --- a/src/mame/layout/fidel_sc12.lay +++ b/src/mame/layout/fidel_sc12.lay @@ -3,37 +3,497 @@ + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/fidel_vsc.lay b/src/mame/layout/fidel_vsc.lay index c56ae1b11db..ab55048ba0e 100644 --- a/src/mame/layout/fidel_vsc.lay +++ b/src/mame/layout/fidel_vsc.lay @@ -1,262 +1,490 @@ + + + + + - - - + + + + + + + + + + + - + + - - + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - - - - - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-70-g09d2 From f5be205f6ecb1916cde9228d638a8d61239743ec Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 30 Jan 2016 23:52:58 +0100 Subject: fix a mutex regression (this doesn't fix the lockups i'm seeing) --- src/emu/luaengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index f487c02bed6..c4136cd744a 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -848,7 +848,7 @@ void lua_engine::serve_lua() // Do action on client side { - osd_sleep(osd_ticks_per_second() / 1000); + std::lock_guard lock(g_mutex); if (msg.status == -1) { b = LUA_PROMPT2; -- cgit v1.2.3-70-g09d2 From 16d9f27d0636246493ee95869d93c6a18763c7a2 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Sun, 31 Jan 2016 00:00:43 +0100 Subject: Some missed in menu conversion. --- src/devices/imagedev/floppy.cpp | 8 ++++---- src/emu/diimage.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp index 2d6eb4d5460..cb7e184f811 100644 --- a/src/devices/imagedev/floppy.cpp +++ b/src/devices/imagedev/floppy.cpp @@ -933,7 +933,7 @@ UINT32 floppy_image_device::get_variant() const ui_menu *floppy_image_device::get_selection_menu(running_machine &machine, render_container *container) { - return auto_alloc_clear(machine, (machine, container, this)); + return global_alloc_clear(machine, container, this); } ui_menu_control_floppy_image::ui_menu_control_floppy_image(running_machine &machine, render_container *container, device_image_interface *_image) : ui_menu_control_device_image(machine, container, _image) @@ -1010,7 +1010,7 @@ void ui_menu_control_floppy_image::hook_load(std::string filename, bool softlist can_in_place = false; } submenu_result = -1; - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, can_in_place, &submenu_result))); + ui_menu::stack_push(global_alloc_clear(machine(), container, can_in_place, &submenu_result)); state = SELECT_RW; } @@ -1036,7 +1036,7 @@ void ui_menu_control_floppy_image::handle() format_array[total_usable++] = i; } submenu_result = -1; - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, format_array, ext_match, total_usable, &submenu_result))); + ui_menu::stack_push(global_alloc_clear(machine(), container, format_array, ext_match, total_usable, &submenu_result)); state = SELECT_FORMAT; break; @@ -1073,7 +1073,7 @@ void ui_menu_control_floppy_image::handle() break; case ui_menu_select_rw::WRITE_OTHER: - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, image, current_directory, current_file, &create_ok))); + ui_menu::stack_push(global_alloc_clear(machine(), container, image, current_directory, current_file, &create_ok)); state = CHECK_CREATE; break; diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index d33bdb1d78b..6cc9b0fb41a 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -1379,7 +1379,7 @@ std::string device_image_interface::software_get_default_slot(const char *defaul ui_menu *device_image_interface::get_selection_menu(running_machine &machine, render_container *container) { - return auto_alloc_clear(machine, (machine, container, this)); + return global_alloc_clear(machine, container, this); } /* ----------------------------------------------------------------------- */ -- cgit v1.2.3-70-g09d2 From 1a76d2d5a56b596d9cbea170174825e81c43d700 Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 31 Jan 2016 00:25:05 +0100 Subject: hh_tms1k: note --- src/mame/drivers/hh_tms1k.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 11e09d59804..7c30ff3ca3f 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -65,6 +65,7 @@ @M34012 TMS1100 1980, Mattel Dungeons & Dragons - Computer Labyrinth Game *M34014 TMS1100 1981, Coleco Bowlatronic M34017 TMS1100 1981, MicroVision cartridge: Cosmic Hunter + *M34038 TMS1100 1982, Parker Brothers Lost Treasure M34047 TMS1100 1982, MicroVision cartridge: Super Blockbuster *M34078A TMS1100 1983, Milton Bradley Arcade Mania @MP6100A TMS0980 1979, Ideal Electronic Detective -- cgit v1.2.3-70-g09d2 From 22941d57defeaa17c2ef1cbe2dab67d96d9808a4 Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 31 Jan 2016 01:51:33 +0100 Subject: osd/windows: small cleanup --- src/osd/windows/window.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 046211d4f29..5b102dd359b 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -133,11 +133,11 @@ struct mtlog }; static mtlog mtlog[100000]; -static volatile LONG mtlogindex; +static volatile INT32 mtlogindex; void mtlog_add(const char *event) { - int index = atomic_increment32((LONG *) &mtlogindex) - 1; + int index = atomic_increment32((INT32 *) &mtlogindex) - 1; if (index < ARRAY_LENGTH(mtlog)) { mtlog[index].timestamp = osd_ticks(); @@ -262,7 +262,6 @@ void windows_osd_interface::window_exit() win_window_list = temp->m_next; temp->destroy(); global_free(temp); - } // kill the drawers @@ -783,7 +782,7 @@ void win_window_info::update() // if we're visible and running and not in the middle of a resize, draw if (m_hwnd != NULL && m_target != NULL && m_renderer != NULL) { - int got_lock = TRUE; + bool got_lock = true; mtlog_add("winwindow_video_window_update: try lock"); -- cgit v1.2.3-70-g09d2 From 6649c76bef39cc5e4d5e8f2bff095a284236dab6 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Sat, 30 Jan 2016 23:18:17 -0300 Subject: New machines marked as NOT_WORKING ---------------------------------- Unknown Nibble game [Team Europe, Marcus Jendroska, Y~K, Smitdogg, Roberto Fresca, The Dumping Union] --- scripts/target/mame/arcade.lua | 1 + src/mame/arcade.lst | 3 ++ src/mame/drivers/nibble.cpp | 112 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 src/mame/drivers/nibble.cpp diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index c00c3d4731c..e7599d3f935 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -4411,6 +4411,7 @@ files { MAME_DIR .. "src/mame/includes/news.h", MAME_DIR .. "src/mame/video/news.cpp", MAME_DIR .. "src/mame/drivers/nexus3d.cpp", + MAME_DIR .. "src/mame/drivers/nibble.cpp", MAME_DIR .. "src/mame/drivers/norautp.cpp", MAME_DIR .. "src/mame/includes/norautp.h", MAME_DIR .. "src/mame/audio/norautp.cpp", diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 09de7daca36..149af1f186b 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -32682,3 +32682,6 @@ clowndwn // Elwood Clown Roll Down fi6845 fi8275 + +l9nibble // unknown Nibble game. + \ No newline at end of file diff --git a/src/mame/drivers/nibble.cpp b/src/mame/drivers/nibble.cpp new file mode 100644 index 00000000000..657e0457d15 --- /dev/null +++ b/src/mame/drivers/nibble.cpp @@ -0,0 +1,112 @@ +// license:BSD-3-Clause +// copyright-holders:Roberto Fresca +/************************************************************************* + + Unknown 'Nibble' game + + Preliminary driver by Roberto Fresca. + +************************************************************************** + + Specs: + + 1x UM6845 + 1x AY38910A/p + + 3x HY6264P-12 + 2x IMSG171P-50G + + 2 Chips with no markings! + + 8x 64K Graphics ROMs. + 1x 64K Program ROM. + 1x 128K unknown ROM. + + 2x XTAL - 11.98135 KDS9C + 2x 8 DIP switches banks. + + +************************************************************************** + + Tech notes... + + About the unknown ICs: + DIP64 CPU with Xtal tied to pins 30 % 31. --> TMS9900? (ROM 9) + DIP40 CPU or sound IC driving 128k (ROM 10) data? (pin 20 tied to GND) + + +*************************************************************************/ + +#define MASTER_CLOCK XTAL_12MHz + +#include "emu.h" +#include "sound/ay8910.h" +#include "video/mc6845.h" + + +class nibble_state : public driver_device +{ +public: + nibble_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + // ,m_maincpu(*this, "maincpu") + { } + + virtual void machine_start() override; + virtual void machine_reset() override; + +// required_device m_maincpu; + +}; + +static INPUT_PORTS_START( nibble ) +INPUT_PORTS_END + + +void nibble_state::machine_start() +{ +} + +void nibble_state::machine_reset() +{ +} + + +static MACHINE_CONFIG_START( nibble, nibble_state ) + + /* basic machine hardware */ +// MCFG_CPU_ADD("maincpu", ??, 3000000) // unknown DIP64 CPU +// MCFG_CPU_PROGRAM_MAP(nibble_map) +// MCFG_CPU_IO_MAP(nibble_io) +// MCFG_CPU_VBLANK_INT_DRIVER("screen", nibble_state, irq0_line_hold) + + /* sound hardware */ +// MCFG_SPEAKER_STANDARD_MONO("mono") + +// MCFG_SOUND_ADD("aysnd", AY8910, MASTER_CLOCK/8) +// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) +MACHINE_CONFIG_END + + +ROM_START( l9nibble ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "09.U123", 0x00000, 0x10000, CRC(dfef685d) SHA1(0aeb4257e408e8549df629a0cdb5f2b6790e32de) ) // unknown + + ROM_REGION( 0x80000, "oki", 0 ) + ROM_LOAD( "01.U139", 0x00000, 0x10000, CRC(aba06e58) SHA1(5841beec122613eed2ba9f48cb1d51bfa0ff450c) ) + ROM_LOAD( "02.U141", 0x00000, 0x10000, CRC(a1e5d6d1) SHA1(8ec85b0544dd75bcb13600bae503ad2b20978281) ) + ROM_LOAD( "03.U149", 0x00000, 0x10000, CRC(ae66f77c) SHA1(6c9e98cc00b72252cb238f14686c0faef47134df) ) + ROM_LOAD( "04.U147", 0x00000, 0x10000, CRC(f1864094) SHA1(b439f9e8c2cc4575f9edbda45b9e724257015a73) ) + ROM_LOAD( "05.U137", 0x00000, 0x10000, CRC(2e8ae9de) SHA1(5f2831f71b351e34df82af37041c9aa815eb372c) ) + ROM_LOAD( "06.U143", 0x00000, 0x10000, CRC(8a56f324) SHA1(68790a12ca57c999bd7b7f26adc206aab3c06976) ) + ROM_LOAD( "07.U145", 0x00000, 0x10000, CRC(4f757912) SHA1(63e5fc2672552463060680b7a5a94df45f3d4b68) ) + ROM_LOAD( "08.U152", 0x00000, 0x10000, CRC(4f878ee4) SHA1(215f3ead0c358cc09c21515981cbb0a1e58c2ca6) ) + + ROM_REGION( 0x20000, "user", 0 ) + ROM_LOAD( "10.U138", 0x00000, 0x20000, CRC(ed831d2a) SHA1(ce5c3b24979d220215d7f0e8d50f45550aec15bd) ) + +ROM_END + + +/* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS... */ +GAME( 19??, l9nibble, 0, nibble, nibble, driver_device, 0, ROT0, "Nibble?", "Unknown Nibble game", MACHINE_IS_SKELETON ) -- cgit v1.2.3-70-g09d2 From d3eecba525738c97e7172317ef5dfd7350b64361 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 30 Jan 2016 22:49:08 -0500 Subject: Software list entries can now supply slot option defaults This feature is enabled when executing 'mame driver software'. After the specified software is found in the software list and attached to an appropriate image device, the software part's feature list is examined for any feature whose name is that of a slot device with _default appended. The feature's value field becomes the slot's default option, which overrides any driver-specified default and can be overridden by user-specified options. No software lists have been updated to use this feature at the moment. --- src/emu/clifront.cpp | 2 +- src/emu/emuopts.cpp | 59 +++++++++++++++++++++++++++++--------------------- src/emu/emuopts.h | 11 ++++++---- src/emu/ui/slotopt.cpp | 2 +- 4 files changed, 43 insertions(+), 31 deletions(-) diff --git a/src/emu/clifront.cpp b/src/emu/clifront.cpp index 05b0ace6116..50e8464a14c 100644 --- a/src/emu/clifront.cpp +++ b/src/emu/clifront.cpp @@ -148,7 +148,7 @@ int cli_frontend::execute(int argc, char **argv) strprintf(val, "%s:%s:%s", swlistdev->list_name(), m_options.software_name(), swpart->name()); // call this in order to set slot devices according to mounting - m_options.parse_slot_devices(argc, argv, option_errors, image->instance_name(), val.c_str()); + m_options.parse_slot_devices(argc, argv, option_errors, image->instance_name(), val.c_str(), swpart); break; } } diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index aa1b0482edc..725f002aa00 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -11,6 +11,7 @@ #include "emu.h" #include "emuopts.h" #include "drivenum.h" +#include "softlist.h" #include @@ -205,6 +206,8 @@ emu_options::emu_options() , m_joystick_contradictory(false) , m_sleep(true) , m_refresh_speed(false) +, m_slot_options(0) +, m_device_options(0) { add_entries(emu_options::s_option_entries); } @@ -215,18 +218,17 @@ emu_options::emu_options() // options for the configured system //------------------------------------------------- -bool emu_options::add_slot_options(bool isfirstpass) +bool emu_options::add_slot_options(const software_part *swpart) { // look up the system configured by name; if no match, do nothing const game_driver *cursystem = system(); if (cursystem == nullptr) return false; + + // create the configuration machine_config config(*cursystem, *this); // iterate through all slot devices - bool first = true; - - // create the configuration int starting_count = options_count(); slot_interface_iterator iter(config.root_device()); for (const device_slot_interface *slot = iter.first(); slot != nullptr; slot = iter.next()) @@ -236,9 +238,8 @@ bool emu_options::add_slot_options(bool isfirstpass) continue; // first device? add the header as to be pretty - if (isfirstpass && first) + if (m_slot_options++ == 0) add_entry(nullptr, "SLOT DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE); - first = false; // retrieve info about the device instance const char *name = slot->device().tag() + 1; @@ -255,6 +256,15 @@ bool emu_options::add_slot_options(bool isfirstpass) } add_entry(name, nullptr, flags, defvalue, true); } + + // allow software lists to supply their own defaults + if (swpart != nullptr) + { + std::string featurename = std::string(name).append("_default"); + const char *value = swpart->feature(featurename.c_str()); + if (value != nullptr) + set_default_value(name, value); + } } return (options_count() != starting_count); } @@ -265,7 +275,7 @@ bool emu_options::add_slot_options(bool isfirstpass) // depending of image mounted //------------------------------------------------- -void emu_options::update_slot_options() +void emu_options::update_slot_options(const software_part *swpart) { // look up the system configured by name; if no match, do nothing const game_driver *cursystem = system(); @@ -290,8 +300,8 @@ void emu_options::update_slot_options() } } } - while (add_slot_options(false)) { } - add_device_options(false); + while (add_slot_options(swpart)) { } + add_device_options(); } @@ -300,7 +310,7 @@ void emu_options::update_slot_options() // options for the configured system //------------------------------------------------- -void emu_options::add_device_options(bool isfirstpass) +void emu_options::add_device_options() { // look up the system configured by name; if no match, do nothing const game_driver *cursystem = system(); @@ -309,14 +319,12 @@ void emu_options::add_device_options(bool isfirstpass) machine_config config(*cursystem, *this); // iterate through all image devices - bool first = true; image_interface_iterator iter(config.root_device()); for (const device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) { // first device? add the header as to be pretty - if (first && isfirstpass) + if (m_device_options++ == 0) add_entry(nullptr, "IMAGE DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE); - first = false; // retrieve info about the device instance std::string option_name; @@ -348,6 +356,10 @@ void emu_options::remove_device_options() if ((curentry->flags() & OPTION_FLAG_DEVICE) != 0) remove_entry(*curentry); } + + // reset counters + m_slot_options = 0; + m_device_options = 0; } @@ -356,7 +368,7 @@ void emu_options::remove_device_options() // and update slot and image devices //------------------------------------------------- -bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name, const char *value) +bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name, const char *value, const software_part *swpart) { // an initial parse to capture the initial set of values bool result; @@ -364,15 +376,13 @@ bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_ core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); // keep adding slot options until we stop seeing new stuff - bool isfirstpass = true; - while (add_slot_options(isfirstpass)) - { + m_slot_options = 0; + while (add_slot_options(swpart)) core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); - isfirstpass = false; - } // add device options and reparse - add_device_options(true); + m_device_options = 0; + add_device_options(); if (name != nullptr && exists(name)) set_value(name, value, OPTION_PRIORITY_CMDLINE, error_string); core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); @@ -380,7 +390,7 @@ bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_ int num; do { num = options_count(); - update_slot_options(); + update_slot_options(swpart); result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); } while (num != options_count()); @@ -399,7 +409,7 @@ bool emu_options::parse_command_line(int argc, char *argv[], std::string &error_ { // parse as normal core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); - bool result = parse_slot_devices(argc, argv, error_string, nullptr, nullptr); + bool result = parse_slot_devices(argc, argv, error_string); update_cached_options(); return result; } @@ -523,11 +533,10 @@ void emu_options::set_system_name(const char *name) // remove any existing device options and then add them afresh remove_device_options(); - if (add_slot_options(true)) - while (add_slot_options(false)) { } + while (add_slot_options()) { } // then add the options - add_device_options(true); + add_device_options(); int num; do { num = options_count(); diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index 14597d0e67d..ea279ca3982 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -197,6 +197,7 @@ enum // forward references struct game_driver; +class software_part; class emu_options : public core_options @@ -210,7 +211,7 @@ public: // parsing wrappers bool parse_command_line(int argc, char *argv[], std::string &error_string); void parse_standard_inis(std::string &error_string); - bool parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name, const char *value); + bool parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name = nullptr, const char *value = nullptr, const software_part *swpart = nullptr); // core options const char *system_name() const { return value(OPTION_SYSTEMNAME); } @@ -370,12 +371,12 @@ public: std::string main_value(const char *option) const; std::string sub_value(const char *name, const char *subname) const; - bool add_slot_options(bool isfirst); + bool add_slot_options(const software_part *swpart = nullptr); private: // device-specific option handling - void add_device_options(bool isfirst); - void update_slot_options(); + void add_device_options(); + void update_slot_options(const software_part *swpart = nullptr); // INI parsing helper bool parse_one_ini(const char *basename, int priority, std::string *error_string = nullptr); @@ -390,6 +391,8 @@ private: bool m_joystick_contradictory; bool m_sleep; bool m_refresh_speed; + int m_slot_options; + int m_device_options; }; diff --git a/src/emu/ui/slotopt.cpp b/src/emu/ui/slotopt.cpp index a3b6352ac2b..959fef74adc 100644 --- a/src/emu/ui/slotopt.cpp +++ b/src/emu/ui/slotopt.cpp @@ -189,7 +189,7 @@ void ui_menu_slot_devices::handle() { if ((FPTR)menu_event->itemref == 1 && menu_event->iptkey == IPT_UI_SELECT) { - machine().options().add_slot_options(false); + machine().options().add_slot_options(); machine().schedule_hard_reset(); } else if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) -- cgit v1.2.3-70-g09d2 From f5be481030eb6630d8657423b07aaef562d37b2d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 31 Jan 2016 08:23:30 +0100 Subject: Fix regression with some drivers like fidelz80, for render we just need to keep mutex per thread (nw) --- src/emu/render.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emu/render.h b/src/emu/render.h index 5be63b085b5..e40c86b1c3c 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -389,7 +389,7 @@ private: fixed_allocator m_primitive_allocator;// allocator for primitives fixed_allocator m_reference_allocator; // allocator for references - std::mutex m_lock; // lock to protect list accesses + std::recursive_mutex m_lock; // lock to protect list accesses }; -- cgit v1.2.3-70-g09d2 From ec3faa35633b5515e9a1ad1ca86d22688bdb237a Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 31 Jan 2016 11:53:15 +0100 Subject: Machines promoted to WORKING ------------ Fidelity Chess Challenger 10 [hap, Berger] Fidelity Sensory Chess Challenger 12-B [hap, Berger] Fidelity Voice Chess Challenger [hap] Fidelity Voice Sensory Chess Challenger [hap] Fidelity Champion Sensory Chess Challenger [hap] --- src/mame/drivers/fidel6502.cpp | 45 +++++++++++++++--------- src/mame/drivers/fidelz80.cpp | 79 ++++++++++++++++++++++++------------------ 2 files changed, 73 insertions(+), 51 deletions(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 783ec11f5e1..cf5b7bb4a8f 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -149,7 +149,7 @@ READ8_MEMBER(fidel6502_state::csc_pia0_pb_r) // d5: button row 8 (active low) // d6,d7: language switches - data |= (~read_inputs(9) >> 3 & 0x20) | (m_inp_matrix[9]->read() << 6 & 0xc0); + data |= (~read_inputs(9) >> 3 & 0x20) | (~m_inp_matrix[9]->read() << 6 & 0xc0); return data; } @@ -414,13 +414,24 @@ static INPUT_PORTS_START( csc ) PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("IN.9") // hardwired - PORT_CONFNAME( 0x03, 0x03, "Language" ) - PORT_CONFSETTING( 0x03, "English" ) - PORT_CONFSETTING( 0x02, "2" ) // todo.. - PORT_CONFSETTING( 0x01, "1" ) - PORT_CONFSETTING( 0x00, "0" ) + PORT_CONFNAME( 0x01, 0x00, "Language" ) + PORT_CONFSETTING( 0x00, "English" ) + PORT_CONFSETTING( 0x01, "Other" ) + PORT_CONFNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x02, DEF_STR( On ) ) INPUT_PORTS_END +static INPUT_PORTS_START( cscg ) + PORT_INCLUDE( csc ) + + PORT_MODIFY("IN.9") + PORT_CONFNAME( 0x01, 0x01, "Language" ) + PORT_CONFSETTING( 0x00, "English" ) + PORT_CONFSETTING( 0x01, "Other" ) +INPUT_PORTS_END + + static INPUT_PORTS_START( sc12 ) PORT_START("IN.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a1") @@ -503,12 +514,12 @@ static INPUT_PORTS_START( sc12 ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h8") PORT_START("IN.8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV / Pawn") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM / Knight") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TB / Bishop") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV / Rook") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PV / Queen") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PB / King") PORT_CODE(KEYCODE_6) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV / Pawn") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM / Knight") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TB / Bishop") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV / Rook") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PV / Queen") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PB / King") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) INPUT_PORTS_END @@ -675,11 +686,11 @@ ROM_END ******************************************************************************/ /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1981, csc, 0, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (English)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1981, cscsp, csc, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (Spanish)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1981, cscg, csc, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (German)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1981, cscfr, csc, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (French)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1981, csc, 0, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (English)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1981, cscsp, csc, 0, csc, cscg, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1981, cscg, csc, 0, csc, cscg, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1981, cscfr, csc, 0, csc, cscg, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) COMP( 1987, fexcelv, 0, 0, fev, csc, driver_device, 0, "Fidelity Electronics", "Voice Excellence", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index c0bef6fdc2d..2269f3eead8 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -1276,26 +1276,26 @@ static INPUT_PORTS_START( vcc_base ) PORT_START("IN.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_A) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_E) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_A) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(KEYCODE_E) PORT_START("IN.1") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_B) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_F) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_F) PORT_START("IN.2") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PB") PORT_CODE(KEYCODE_P) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_C) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_G) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_C) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_G) PORT_START("IN.3") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("EN") PORT_CODE(KEYCODE_ENTER) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PV") PORT_CODE(KEYCODE_O) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_D) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_H) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_D) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_H) PORT_START("RESET") // is not on matrix IN.0 d0 PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, fidelz80_state, reset_button, 0) @@ -1441,12 +1441,12 @@ static INPUT_PORTS_START( vsc ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h8") PORT_START("IN.8") // buttons on the right - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Rook") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Knight") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bishop") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Queen") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Rook") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Knight") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bishop") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Queen") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) @@ -1460,13 +1460,24 @@ static INPUT_PORTS_START( vsc ) PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("IN.10") // hardwired (2 diodes) - PORT_CONFNAME( 0x03, 0x00, "Language" ) + PORT_CONFNAME( 0x01, 0x00, "Language" ) PORT_CONFSETTING( 0x00, "English" ) - PORT_CONFSETTING( 0x01, "1" ) // todo: game dasm says it checks against 0/not0, 2, 3.. which language is which? - PORT_CONFSETTING( 0x02, "2" ) - PORT_CONFSETTING( 0x03, "3" ) + PORT_CONFSETTING( 0x01, "Other" ) + PORT_CONFNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x02, DEF_STR( On ) ) INPUT_PORTS_END +static INPUT_PORTS_START( vscg ) + PORT_INCLUDE( vsc ) + + PORT_MODIFY("IN.10") + PORT_CONFNAME( 0x01, 0x01, "Language" ) + PORT_CONFSETTING( 0x00, "English" ) + PORT_CONFSETTING( 0x01, "Other" ) +INPUT_PORTS_END + + static INPUT_PORTS_START( vbrc ) PORT_START("IN.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A") PORT_CODE(KEYCODE_A) @@ -1793,22 +1804,22 @@ ROM_END ******************************************************************************/ /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1978, cc10, 0, 0, cc10, cc10, driver_device, 0, "Fidelity Electronics", "Chess Challenger 10 (version B)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) - -COMP( 1979, vcc, 0, 0, vcc, vcc, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (English)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1979, vccsp, vcc, 0, vcc, vccsp, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1979, vccg, vcc, 0, vcc, vccg, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1979, vccfr, vcc, 0, vcc, vccfr, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) - -COMP( 1980, uvc, vcc, 0, vcc, vcc, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (English)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1980, uvcsp, vcc, 0, vcc, vccsp, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1980, uvcg, vcc, 0, vcc, vccg, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -COMP( 1980, uvcfr, vcc, 0, vcc, vccfr, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) - -COMP( 1980, vsc, 0, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (English)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1980, vscsp, vsc, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1980, vscg, vsc, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1980, vscfr, vsc, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1978, cc10, 0, 0, cc10, cc10, driver_device, 0, "Fidelity Electronics", "Chess Challenger 10 (version B)", MACHINE_SUPPORTS_SAVE ) + +COMP( 1979, vcc, 0, 0, vcc, vcc, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (English)", MACHINE_SUPPORTS_SAVE ) +COMP( 1979, vccsp, vcc, 0, vcc, vccsp, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE ) +COMP( 1979, vccg, vcc, 0, vcc, vccg, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (German)", MACHINE_SUPPORTS_SAVE ) +COMP( 1979, vccfr, vcc, 0, vcc, vccfr, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (French)", MACHINE_SUPPORTS_SAVE ) + +COMP( 1980, uvc, vcc, 0, vcc, vcc, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (English)", MACHINE_SUPPORTS_SAVE ) +COMP( 1980, uvcsp, vcc, 0, vcc, vccsp, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE ) +COMP( 1980, uvcg, vcc, 0, vcc, vccg, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (German)", MACHINE_SUPPORTS_SAVE ) +COMP( 1980, uvcfr, vcc, 0, vcc, vccfr, driver_device, 0, "Fidelity Electronics", "Advanced Voice Chess Challenger (French)", MACHINE_SUPPORTS_SAVE ) + +COMP( 1980, vsc, 0, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (English)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1980, vscsp, vsc, 0, vsc, vscg, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1980, vscg, vsc, 0, vsc, vscg, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1980, vscfr, vsc, 0, vsc, vscg, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) COMP( 1979, vbrc, 0, 0, vbrc, vbrc, driver_device, 0, "Fidelity Electronics", "Voice Bridge Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) COMP( 1980, bridgec3, vbrc, 0, vbrc, vbrc, driver_device, 0, "Fidelity Electronics", "Voice Bridge Challenger III", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From 12f9fcebaa41ebf5fdc0e95e1471b3113a61a022 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 31 Jan 2016 15:25:07 +0100 Subject: added libuv library (nw) --- 3rdparty/libuv/.gitignore | 75 + 3rdparty/libuv/.mailmap | 39 + 3rdparty/libuv/AUTHORS | 242 + 3rdparty/libuv/CONTRIBUTING.md | 166 + 3rdparty/libuv/ChangeLog | 2372 ++++++++++ 3rdparty/libuv/LICENSE | 46 + 3rdparty/libuv/MAINTAINERS.md | 36 + 3rdparty/libuv/Makefile.am | 344 ++ 3rdparty/libuv/Makefile.mingw | 84 + 3rdparty/libuv/README.md | 245 + 3rdparty/libuv/android-configure | 20 + 3rdparty/libuv/appveyor.yml | 36 + 3rdparty/libuv/autogen.sh | 46 + 3rdparty/libuv/checksparse.sh | 234 + 3rdparty/libuv/common.gypi | 210 + 3rdparty/libuv/configure.ac | 68 + 3rdparty/libuv/docs/Makefile | 178 + 3rdparty/libuv/docs/make.bat | 243 + 3rdparty/libuv/docs/src/async.rst | 57 + 3rdparty/libuv/docs/src/check.rst | 46 + 3rdparty/libuv/docs/src/conf.py | 348 ++ 3rdparty/libuv/docs/src/design.rst | 137 + 3rdparty/libuv/docs/src/dll.rst | 44 + 3rdparty/libuv/docs/src/dns.rst | 108 + 3rdparty/libuv/docs/src/errors.rst | 331 ++ 3rdparty/libuv/docs/src/fs.rst | 300 ++ 3rdparty/libuv/docs/src/fs_event.rst | 108 + 3rdparty/libuv/docs/src/fs_poll.rst | 72 + 3rdparty/libuv/docs/src/handle.rst | 181 + 3rdparty/libuv/docs/src/idle.rst | 54 + 3rdparty/libuv/docs/src/index.rst | 95 + 3rdparty/libuv/docs/src/loop.rst | 166 + 3rdparty/libuv/docs/src/migration_010_100.rst | 244 + 3rdparty/libuv/docs/src/misc.rst | 328 ++ 3rdparty/libuv/docs/src/pipe.rst | 104 + 3rdparty/libuv/docs/src/poll.rst | 103 + 3rdparty/libuv/docs/src/prepare.rst | 46 + 3rdparty/libuv/docs/src/process.rst | 225 + 3rdparty/libuv/docs/src/request.rst | 82 + 3rdparty/libuv/docs/src/signal.rst | 77 + 3rdparty/libuv/docs/src/sphinx-plugins/manpage.py | 46 + 3rdparty/libuv/docs/src/static/architecture.png | Bin 0 -> 206767 bytes .../docs/src/static/diagrams.key/Data/st0-311.jpg | Bin 0 -> 19328 bytes .../docs/src/static/diagrams.key/Data/st1-475.jpg | Bin 0 -> 12655 bytes .../libuv/docs/src/static/diagrams.key/Index.zip | Bin 0 -> 71160 bytes .../Metadata/BuildVersionHistory.plist | 8 + .../diagrams.key/Metadata/DocumentIdentifier | 1 + .../static/diagrams.key/Metadata/Properties.plist | Bin 0 -> 340 bytes .../docs/src/static/diagrams.key/preview-micro.jpg | Bin 0 -> 1425 bytes .../docs/src/static/diagrams.key/preview-web.jpg | Bin 0 -> 8106 bytes .../libuv/docs/src/static/diagrams.key/preview.jpg | Bin 0 -> 107456 bytes 3rdparty/libuv/docs/src/static/favicon.ico | Bin 0 -> 15086 bytes 3rdparty/libuv/docs/src/static/logo.png | Bin 0 -> 33545 bytes 3rdparty/libuv/docs/src/static/loop_iteration.png | Bin 0 -> 80528 bytes 3rdparty/libuv/docs/src/stream.rst | 219 + 3rdparty/libuv/docs/src/tcp.rst | 108 + 3rdparty/libuv/docs/src/threading.rst | 160 + 3rdparty/libuv/docs/src/threadpool.rst | 67 + 3rdparty/libuv/docs/src/timer.rst | 76 + 3rdparty/libuv/docs/src/tty.rst | 93 + 3rdparty/libuv/docs/src/udp.rst | 295 ++ 3rdparty/libuv/docs/src/version.rst | 60 + 3rdparty/libuv/gyp_uv.py | 93 + 3rdparty/libuv/img/banner.png | Bin 0 -> 44102 bytes 3rdparty/libuv/img/logos.svg | 152 + 3rdparty/libuv/include/android-ifaddrs.h | 54 + 3rdparty/libuv/include/pthread-fixes.h | 72 + 3rdparty/libuv/include/stdint-msvc2008.h | 247 + 3rdparty/libuv/include/tree.h | 768 ++++ 3rdparty/libuv/include/uv-aix.h | 32 + 3rdparty/libuv/include/uv-bsd.h | 34 + 3rdparty/libuv/include/uv-darwin.h | 61 + 3rdparty/libuv/include/uv-errno.h | 418 ++ 3rdparty/libuv/include/uv-linux.h | 34 + 3rdparty/libuv/include/uv-sunos.h | 44 + 3rdparty/libuv/include/uv-threadpool.h | 37 + 3rdparty/libuv/include/uv-unix.h | 383 ++ 3rdparty/libuv/include/uv-version.h | 43 + 3rdparty/libuv/include/uv-win.h | 653 +++ 3rdparty/libuv/include/uv.h | 1482 ++++++ 3rdparty/libuv/libuv.nsi | 86 + 3rdparty/libuv/libuv.pc.in | 11 + 3rdparty/libuv/m4/.gitignore | 4 + 3rdparty/libuv/m4/as_case.m4 | 21 + 3rdparty/libuv/m4/libuv-check-flags.m4 | 319 ++ 3rdparty/libuv/samples/.gitignore | 22 + 3rdparty/libuv/samples/socks5-proxy/.gitignore | 21 + 3rdparty/libuv/samples/socks5-proxy/LICENSE | 53 + 3rdparty/libuv/samples/socks5-proxy/Makefile | 46 + 3rdparty/libuv/samples/socks5-proxy/build.gyp | 46 + 3rdparty/libuv/samples/socks5-proxy/client.c | 737 +++ 3rdparty/libuv/samples/socks5-proxy/defs.h | 139 + 3rdparty/libuv/samples/socks5-proxy/getopt.c | 131 + 3rdparty/libuv/samples/socks5-proxy/main.c | 99 + 3rdparty/libuv/samples/socks5-proxy/s5.c | 271 ++ 3rdparty/libuv/samples/socks5-proxy/s5.h | 94 + 3rdparty/libuv/samples/socks5-proxy/server.c | 241 + 3rdparty/libuv/samples/socks5-proxy/util.c | 72 + 3rdparty/libuv/src/fs-poll.c | 255 ++ 3rdparty/libuv/src/heap-inl.h | 245 + 3rdparty/libuv/src/inet.c | 309 ++ 3rdparty/libuv/src/queue.h | 108 + 3rdparty/libuv/src/threadpool.c | 303 ++ 3rdparty/libuv/src/unix/aix.c | 1158 +++++ 3rdparty/libuv/src/unix/android-ifaddrs.c | 703 +++ 3rdparty/libuv/src/unix/async.c | 290 ++ 3rdparty/libuv/src/unix/atomic-ops.h | 77 + 3rdparty/libuv/src/unix/core.c | 1104 +++++ 3rdparty/libuv/src/unix/darwin-proctitle.c | 206 + 3rdparty/libuv/src/unix/darwin.c | 335 ++ 3rdparty/libuv/src/unix/dl.c | 80 + 3rdparty/libuv/src/unix/freebsd.c | 450 ++ 3rdparty/libuv/src/unix/fs.c | 1310 ++++++ 3rdparty/libuv/src/unix/fsevents.c | 904 ++++ 3rdparty/libuv/src/unix/getaddrinfo.c | 202 + 3rdparty/libuv/src/unix/getnameinfo.c | 120 + 3rdparty/libuv/src/unix/internal.h | 316 ++ 3rdparty/libuv/src/unix/kqueue.c | 426 ++ 3rdparty/libuv/src/unix/linux-core.c | 899 ++++ 3rdparty/libuv/src/unix/linux-inotify.c | 285 ++ 3rdparty/libuv/src/unix/linux-syscalls.c | 471 ++ 3rdparty/libuv/src/unix/linux-syscalls.h | 158 + 3rdparty/libuv/src/unix/loop-watcher.c | 68 + 3rdparty/libuv/src/unix/loop.c | 155 + 3rdparty/libuv/src/unix/netbsd.c | 370 ++ 3rdparty/libuv/src/unix/openbsd.c | 386 ++ 3rdparty/libuv/src/unix/pipe.c | 288 ++ 3rdparty/libuv/src/unix/poll.c | 113 + 3rdparty/libuv/src/unix/process.c | 563 +++ 3rdparty/libuv/src/unix/proctitle.c | 102 + 3rdparty/libuv/src/unix/pthread-fixes.c | 104 + 3rdparty/libuv/src/unix/signal.c | 467 ++ 3rdparty/libuv/src/unix/spinlock.h | 53 + 3rdparty/libuv/src/unix/stream.c | 1615 +++++++ 3rdparty/libuv/src/unix/sunos.c | 765 ++++ 3rdparty/libuv/src/unix/tcp.c | 362 ++ 3rdparty/libuv/src/unix/thread.c | 525 +++ 3rdparty/libuv/src/unix/timer.c | 172 + 3rdparty/libuv/src/unix/tty.c | 279 ++ 3rdparty/libuv/src/unix/udp.c | 873 ++++ 3rdparty/libuv/src/uv-common.c | 627 +++ 3rdparty/libuv/src/uv-common.h | 227 + 3rdparty/libuv/src/version.c | 45 + 3rdparty/libuv/src/win/async.c | 99 + 3rdparty/libuv/src/win/atomicops-inl.h | 56 + 3rdparty/libuv/src/win/core.c | 457 ++ 3rdparty/libuv/src/win/dl.c | 113 + 3rdparty/libuv/src/win/error.c | 170 + 3rdparty/libuv/src/win/fs-event.c | 552 +++ 3rdparty/libuv/src/win/fs.c | 2468 ++++++++++ 3rdparty/libuv/src/win/getaddrinfo.c | 358 ++ 3rdparty/libuv/src/win/getnameinfo.c | 150 + 3rdparty/libuv/src/win/handle-inl.h | 179 + 3rdparty/libuv/src/win/handle.c | 154 + 3rdparty/libuv/src/win/internal.h | 382 ++ 3rdparty/libuv/src/win/loop-watcher.c | 122 + 3rdparty/libuv/src/win/pipe.c | 2118 +++++++++ 3rdparty/libuv/src/win/poll.c | 635 +++ 3rdparty/libuv/src/win/process-stdio.c | 510 +++ 3rdparty/libuv/src/win/process.c | 1247 ++++++ 3rdparty/libuv/src/win/req-inl.h | 224 + 3rdparty/libuv/src/win/req.c | 25 + 3rdparty/libuv/src/win/signal.c | 356 ++ 3rdparty/libuv/src/win/snprintf.c | 42 + 3rdparty/libuv/src/win/stream-inl.h | 56 + 3rdparty/libuv/src/win/stream.c | 249 ++ 3rdparty/libuv/src/win/tcp.c | 1507 +++++++ 3rdparty/libuv/src/win/thread.c | 697 +++ 3rdparty/libuv/src/win/timer.c | 200 + 3rdparty/libuv/src/win/tty.c | 2084 +++++++++ 3rdparty/libuv/src/win/udp.c | 926 ++++ 3rdparty/libuv/src/win/util.c | 1232 +++++ 3rdparty/libuv/src/win/winapi.c | 146 + 3rdparty/libuv/src/win/winapi.h | 4710 ++++++++++++++++++++ 3rdparty/libuv/src/win/winsock.c | 561 +++ 3rdparty/libuv/src/win/winsock.h | 190 + 3rdparty/libuv/test/benchmark-async-pummel.c | 119 + 3rdparty/libuv/test/benchmark-async.c | 141 + 3rdparty/libuv/test/benchmark-fs-stat.c | 136 + 3rdparty/libuv/test/benchmark-getaddrinfo.c | 92 + 3rdparty/libuv/test/benchmark-list.h | 163 + 3rdparty/libuv/test/benchmark-loop-count.c | 92 + 3rdparty/libuv/test/benchmark-million-async.c | 112 + 3rdparty/libuv/test/benchmark-million-timers.c | 86 + 3rdparty/libuv/test/benchmark-multi-accept.c | 447 ++ 3rdparty/libuv/test/benchmark-ping-pongs.c | 221 + 3rdparty/libuv/test/benchmark-pound.c | 351 ++ 3rdparty/libuv/test/benchmark-pump.c | 476 ++ 3rdparty/libuv/test/benchmark-sizes.c | 46 + 3rdparty/libuv/test/benchmark-spawn.c | 164 + 3rdparty/libuv/test/benchmark-tcp-write-batch.c | 144 + 3rdparty/libuv/test/benchmark-thread.c | 64 + 3rdparty/libuv/test/benchmark-udp-pummel.c | 243 + 3rdparty/libuv/test/blackhole-server.c | 121 + 3rdparty/libuv/test/dns-server.c | 340 ++ 3rdparty/libuv/test/echo-server.c | 378 ++ 3rdparty/libuv/test/fixtures/empty_file | 0 3rdparty/libuv/test/fixtures/load_error.node | 1 + 3rdparty/libuv/test/run-benchmarks.c | 65 + 3rdparty/libuv/test/run-tests.c | 181 + 3rdparty/libuv/test/runner-unix.c | 400 ++ 3rdparty/libuv/test/runner-unix.h | 36 + 3rdparty/libuv/test/runner-win.c | 371 ++ 3rdparty/libuv/test/runner-win.h | 39 + 3rdparty/libuv/test/runner.c | 466 ++ 3rdparty/libuv/test/runner.h | 178 + 3rdparty/libuv/test/task.h | 220 + 3rdparty/libuv/test/test-active.c | 84 + 3rdparty/libuv/test/test-async-null-cb.c | 55 + 3rdparty/libuv/test/test-async.c | 134 + 3rdparty/libuv/test/test-barrier.c | 106 + 3rdparty/libuv/test/test-callback-order.c | 77 + 3rdparty/libuv/test/test-callback-stack.c | 205 + 3rdparty/libuv/test/test-close-fd.c | 76 + 3rdparty/libuv/test/test-close-order.c | 80 + 3rdparty/libuv/test/test-condvar.c | 173 + 3rdparty/libuv/test/test-connection-fail.c | 151 + 3rdparty/libuv/test/test-cwd-and-chdir.c | 51 + 3rdparty/libuv/test/test-default-loop-close.c | 59 + 3rdparty/libuv/test/test-delayed-accept.c | 189 + 3rdparty/libuv/test/test-dlerror.c | 55 + 3rdparty/libuv/test/test-embed.c | 138 + 3rdparty/libuv/test/test-emfile.c | 110 + 3rdparty/libuv/test/test-error.c | 50 + 3rdparty/libuv/test/test-fail-always.c | 29 + 3rdparty/libuv/test/test-fs-event.c | 907 ++++ 3rdparty/libuv/test/test-fs-poll.c | 186 + 3rdparty/libuv/test/test-fs.c | 2664 +++++++++++ 3rdparty/libuv/test/test-get-currentexe.c | 86 + 3rdparty/libuv/test/test-get-loadavg.c | 35 + 3rdparty/libuv/test/test-get-memory.c | 38 + 3rdparty/libuv/test/test-getaddrinfo.c | 184 + 3rdparty/libuv/test/test-getnameinfo.c | 101 + 3rdparty/libuv/test/test-getsockname.c | 361 ++ 3rdparty/libuv/test/test-handle-fileno.c | 121 + 3rdparty/libuv/test/test-homedir.c | 49 + 3rdparty/libuv/test/test-hrtime.c | 54 + 3rdparty/libuv/test/test-idle.c | 99 + 3rdparty/libuv/test/test-ip4-addr.c | 46 + 3rdparty/libuv/test/test-ip6-addr.c | 141 + 3rdparty/libuv/test/test-ipc-send-recv.c | 411 ++ 3rdparty/libuv/test/test-ipc.c | 779 ++++ 3rdparty/libuv/test/test-list.h | 732 +++ 3rdparty/libuv/test/test-loop-alive.c | 67 + 3rdparty/libuv/test/test-loop-close.c | 53 + 3rdparty/libuv/test/test-loop-configure.c | 38 + 3rdparty/libuv/test/test-loop-handles.c | 337 ++ 3rdparty/libuv/test/test-loop-stop.c | 71 + 3rdparty/libuv/test/test-loop-time.c | 63 + 3rdparty/libuv/test/test-multiple-listen.c | 109 + 3rdparty/libuv/test/test-mutexes.c | 162 + 3rdparty/libuv/test/test-osx-select.c | 140 + 3rdparty/libuv/test/test-pass-always.c | 28 + 3rdparty/libuv/test/test-ping-pong.c | 270 ++ 3rdparty/libuv/test/test-pipe-bind-error.c | 136 + .../libuv/test/test-pipe-close-stdout-read-stdin.c | 104 + 3rdparty/libuv/test/test-pipe-connect-error.c | 95 + 3rdparty/libuv/test/test-pipe-connect-multiple.c | 104 + 3rdparty/libuv/test/test-pipe-connect-prepare.c | 83 + 3rdparty/libuv/test/test-pipe-getsockname.c | 263 ++ 3rdparty/libuv/test/test-pipe-pending-instances.c | 59 + 3rdparty/libuv/test/test-pipe-sendmsg.c | 169 + 3rdparty/libuv/test/test-pipe-server-close.c | 91 + 3rdparty/libuv/test/test-pipe-set-non-blocking.c | 99 + 3rdparty/libuv/test/test-platform-output.c | 126 + .../test/test-poll-close-doesnt-corrupt-stack.c | 114 + 3rdparty/libuv/test/test-poll-close.c | 73 + 3rdparty/libuv/test/test-poll-closesocket.c | 89 + 3rdparty/libuv/test/test-poll.c | 560 +++ 3rdparty/libuv/test/test-process-title.c | 53 + 3rdparty/libuv/test/test-queue-foreach-delete.c | 200 + 3rdparty/libuv/test/test-ref.c | 442 ++ 3rdparty/libuv/test/test-run-nowait.c | 45 + 3rdparty/libuv/test/test-run-once.c | 48 + 3rdparty/libuv/test/test-semaphore.c | 111 + 3rdparty/libuv/test/test-shutdown-close.c | 108 + 3rdparty/libuv/test/test-shutdown-eof.c | 182 + 3rdparty/libuv/test/test-shutdown-twice.c | 84 + 3rdparty/libuv/test/test-signal-multiple-loops.c | 290 ++ 3rdparty/libuv/test/test-signal.c | 152 + 3rdparty/libuv/test/test-socket-buffer-size.c | 77 + 3rdparty/libuv/test/test-spawn.c | 1706 +++++++ 3rdparty/libuv/test/test-stdio-over-pipes.c | 255 ++ 3rdparty/libuv/test/test-tcp-bind-error.c | 216 + 3rdparty/libuv/test/test-tcp-bind6-error.c | 176 + 3rdparty/libuv/test/test-tcp-close-accept.c | 188 + .../libuv/test/test-tcp-close-while-connecting.c | 86 + 3rdparty/libuv/test/test-tcp-close.c | 136 + .../test/test-tcp-connect-error-after-write.c | 98 + 3rdparty/libuv/test/test-tcp-connect-error.c | 73 + 3rdparty/libuv/test/test-tcp-connect-timeout.c | 91 + 3rdparty/libuv/test/test-tcp-connect6-error.c | 71 + 3rdparty/libuv/test/test-tcp-create-socket-early.c | 206 + 3rdparty/libuv/test/test-tcp-flags.c | 52 + 3rdparty/libuv/test/test-tcp-oob.c | 128 + 3rdparty/libuv/test/test-tcp-open.c | 220 + 3rdparty/libuv/test/test-tcp-read-stop.c | 76 + .../libuv/test/test-tcp-shutdown-after-write.c | 138 + 3rdparty/libuv/test/test-tcp-try-write.c | 135 + 3rdparty/libuv/test/test-tcp-unexpected-read.c | 117 + 3rdparty/libuv/test/test-tcp-write-after-connect.c | 68 + 3rdparty/libuv/test/test-tcp-write-fail.c | 115 + 3rdparty/libuv/test/test-tcp-write-queue-order.c | 137 + .../test/test-tcp-write-to-half-open-connection.c | 141 + 3rdparty/libuv/test/test-tcp-writealot.c | 176 + 3rdparty/libuv/test/test-thread-equal.c | 45 + 3rdparty/libuv/test/test-thread.c | 211 + 3rdparty/libuv/test/test-threadpool-cancel.c | 362 ++ 3rdparty/libuv/test/test-threadpool.c | 76 + 3rdparty/libuv/test/test-timer-again.c | 141 + 3rdparty/libuv/test/test-timer-from-check.c | 80 + 3rdparty/libuv/test/test-timer.c | 303 ++ 3rdparty/libuv/test/test-tty.c | 184 + 3rdparty/libuv/test/test-udp-bind.c | 93 + 3rdparty/libuv/test/test-udp-create-socket-early.c | 132 + 3rdparty/libuv/test/test-udp-dgram-too-big.c | 91 + 3rdparty/libuv/test/test-udp-ipv6.c | 193 + 3rdparty/libuv/test/test-udp-multicast-interface.c | 99 + .../libuv/test/test-udp-multicast-interface6.c | 103 + 3rdparty/libuv/test/test-udp-multicast-join.c | 150 + 3rdparty/libuv/test/test-udp-multicast-join6.c | 161 + 3rdparty/libuv/test/test-udp-multicast-ttl.c | 94 + 3rdparty/libuv/test/test-udp-open.c | 204 + 3rdparty/libuv/test/test-udp-options.c | 126 + 3rdparty/libuv/test/test-udp-send-and-recv.c | 214 + 3rdparty/libuv/test/test-udp-send-immediate.c | 148 + 3rdparty/libuv/test/test-udp-send-unreachable.c | 150 + 3rdparty/libuv/test/test-udp-try-send.c | 133 + 3rdparty/libuv/test/test-walk-handles.c | 77 + 3rdparty/libuv/test/test-watcher-cross-stop.c | 103 + 3rdparty/libuv/uv.gyp | 508 +++ 3rdparty/libuv/vcbuild.bat | 153 + 332 files changed, 87084 insertions(+) create mode 100644 3rdparty/libuv/.gitignore create mode 100644 3rdparty/libuv/.mailmap create mode 100644 3rdparty/libuv/AUTHORS create mode 100644 3rdparty/libuv/CONTRIBUTING.md create mode 100644 3rdparty/libuv/ChangeLog create mode 100644 3rdparty/libuv/LICENSE create mode 100644 3rdparty/libuv/MAINTAINERS.md create mode 100644 3rdparty/libuv/Makefile.am create mode 100644 3rdparty/libuv/Makefile.mingw create mode 100644 3rdparty/libuv/README.md create mode 100644 3rdparty/libuv/android-configure create mode 100644 3rdparty/libuv/appveyor.yml create mode 100644 3rdparty/libuv/autogen.sh create mode 100644 3rdparty/libuv/checksparse.sh create mode 100644 3rdparty/libuv/common.gypi create mode 100644 3rdparty/libuv/configure.ac create mode 100644 3rdparty/libuv/docs/Makefile create mode 100644 3rdparty/libuv/docs/make.bat create mode 100644 3rdparty/libuv/docs/src/async.rst create mode 100644 3rdparty/libuv/docs/src/check.rst create mode 100644 3rdparty/libuv/docs/src/conf.py create mode 100644 3rdparty/libuv/docs/src/design.rst create mode 100644 3rdparty/libuv/docs/src/dll.rst create mode 100644 3rdparty/libuv/docs/src/dns.rst create mode 100644 3rdparty/libuv/docs/src/errors.rst create mode 100644 3rdparty/libuv/docs/src/fs.rst create mode 100644 3rdparty/libuv/docs/src/fs_event.rst create mode 100644 3rdparty/libuv/docs/src/fs_poll.rst create mode 100644 3rdparty/libuv/docs/src/handle.rst create mode 100644 3rdparty/libuv/docs/src/idle.rst create mode 100644 3rdparty/libuv/docs/src/index.rst create mode 100644 3rdparty/libuv/docs/src/loop.rst create mode 100644 3rdparty/libuv/docs/src/migration_010_100.rst create mode 100644 3rdparty/libuv/docs/src/misc.rst create mode 100644 3rdparty/libuv/docs/src/pipe.rst create mode 100644 3rdparty/libuv/docs/src/poll.rst create mode 100644 3rdparty/libuv/docs/src/prepare.rst create mode 100644 3rdparty/libuv/docs/src/process.rst create mode 100644 3rdparty/libuv/docs/src/request.rst create mode 100644 3rdparty/libuv/docs/src/signal.rst create mode 100644 3rdparty/libuv/docs/src/sphinx-plugins/manpage.py create mode 100644 3rdparty/libuv/docs/src/static/architecture.png create mode 100644 3rdparty/libuv/docs/src/static/diagrams.key/Data/st0-311.jpg create mode 100644 3rdparty/libuv/docs/src/static/diagrams.key/Data/st1-475.jpg create mode 100644 3rdparty/libuv/docs/src/static/diagrams.key/Index.zip create mode 100644 3rdparty/libuv/docs/src/static/diagrams.key/Metadata/BuildVersionHistory.plist create mode 100644 3rdparty/libuv/docs/src/static/diagrams.key/Metadata/DocumentIdentifier create mode 100644 3rdparty/libuv/docs/src/static/diagrams.key/Metadata/Properties.plist create mode 100644 3rdparty/libuv/docs/src/static/diagrams.key/preview-micro.jpg create mode 100644 3rdparty/libuv/docs/src/static/diagrams.key/preview-web.jpg create mode 100644 3rdparty/libuv/docs/src/static/diagrams.key/preview.jpg create mode 100644 3rdparty/libuv/docs/src/static/favicon.ico create mode 100644 3rdparty/libuv/docs/src/static/logo.png create mode 100644 3rdparty/libuv/docs/src/static/loop_iteration.png create mode 100644 3rdparty/libuv/docs/src/stream.rst create mode 100644 3rdparty/libuv/docs/src/tcp.rst create mode 100644 3rdparty/libuv/docs/src/threading.rst create mode 100644 3rdparty/libuv/docs/src/threadpool.rst create mode 100644 3rdparty/libuv/docs/src/timer.rst create mode 100644 3rdparty/libuv/docs/src/tty.rst create mode 100644 3rdparty/libuv/docs/src/udp.rst create mode 100644 3rdparty/libuv/docs/src/version.rst create mode 100644 3rdparty/libuv/gyp_uv.py create mode 100644 3rdparty/libuv/img/banner.png create mode 100644 3rdparty/libuv/img/logos.svg create mode 100644 3rdparty/libuv/include/android-ifaddrs.h create mode 100644 3rdparty/libuv/include/pthread-fixes.h create mode 100644 3rdparty/libuv/include/stdint-msvc2008.h create mode 100644 3rdparty/libuv/include/tree.h create mode 100644 3rdparty/libuv/include/uv-aix.h create mode 100644 3rdparty/libuv/include/uv-bsd.h create mode 100644 3rdparty/libuv/include/uv-darwin.h create mode 100644 3rdparty/libuv/include/uv-errno.h create mode 100644 3rdparty/libuv/include/uv-linux.h create mode 100644 3rdparty/libuv/include/uv-sunos.h create mode 100644 3rdparty/libuv/include/uv-threadpool.h create mode 100644 3rdparty/libuv/include/uv-unix.h create mode 100644 3rdparty/libuv/include/uv-version.h create mode 100644 3rdparty/libuv/include/uv-win.h create mode 100644 3rdparty/libuv/include/uv.h create mode 100644 3rdparty/libuv/libuv.nsi create mode 100644 3rdparty/libuv/libuv.pc.in create mode 100644 3rdparty/libuv/m4/.gitignore create mode 100644 3rdparty/libuv/m4/as_case.m4 create mode 100644 3rdparty/libuv/m4/libuv-check-flags.m4 create mode 100644 3rdparty/libuv/samples/.gitignore create mode 100644 3rdparty/libuv/samples/socks5-proxy/.gitignore create mode 100644 3rdparty/libuv/samples/socks5-proxy/LICENSE create mode 100644 3rdparty/libuv/samples/socks5-proxy/Makefile create mode 100644 3rdparty/libuv/samples/socks5-proxy/build.gyp create mode 100644 3rdparty/libuv/samples/socks5-proxy/client.c create mode 100644 3rdparty/libuv/samples/socks5-proxy/defs.h create mode 100644 3rdparty/libuv/samples/socks5-proxy/getopt.c create mode 100644 3rdparty/libuv/samples/socks5-proxy/main.c create mode 100644 3rdparty/libuv/samples/socks5-proxy/s5.c create mode 100644 3rdparty/libuv/samples/socks5-proxy/s5.h create mode 100644 3rdparty/libuv/samples/socks5-proxy/server.c create mode 100644 3rdparty/libuv/samples/socks5-proxy/util.c create mode 100644 3rdparty/libuv/src/fs-poll.c create mode 100644 3rdparty/libuv/src/heap-inl.h create mode 100644 3rdparty/libuv/src/inet.c create mode 100644 3rdparty/libuv/src/queue.h create mode 100644 3rdparty/libuv/src/threadpool.c create mode 100644 3rdparty/libuv/src/unix/aix.c create mode 100644 3rdparty/libuv/src/unix/android-ifaddrs.c create mode 100644 3rdparty/libuv/src/unix/async.c create mode 100644 3rdparty/libuv/src/unix/atomic-ops.h create mode 100644 3rdparty/libuv/src/unix/core.c create mode 100644 3rdparty/libuv/src/unix/darwin-proctitle.c create mode 100644 3rdparty/libuv/src/unix/darwin.c create mode 100644 3rdparty/libuv/src/unix/dl.c create mode 100644 3rdparty/libuv/src/unix/freebsd.c create mode 100644 3rdparty/libuv/src/unix/fs.c create mode 100644 3rdparty/libuv/src/unix/fsevents.c create mode 100644 3rdparty/libuv/src/unix/getaddrinfo.c create mode 100644 3rdparty/libuv/src/unix/getnameinfo.c create mode 100644 3rdparty/libuv/src/unix/internal.h create mode 100644 3rdparty/libuv/src/unix/kqueue.c create mode 100644 3rdparty/libuv/src/unix/linux-core.c create mode 100644 3rdparty/libuv/src/unix/linux-inotify.c create mode 100644 3rdparty/libuv/src/unix/linux-syscalls.c create mode 100644 3rdparty/libuv/src/unix/linux-syscalls.h create mode 100644 3rdparty/libuv/src/unix/loop-watcher.c create mode 100644 3rdparty/libuv/src/unix/loop.c create mode 100644 3rdparty/libuv/src/unix/netbsd.c create mode 100644 3rdparty/libuv/src/unix/openbsd.c create mode 100644 3rdparty/libuv/src/unix/pipe.c create mode 100644 3rdparty/libuv/src/unix/poll.c create mode 100644 3rdparty/libuv/src/unix/process.c create mode 100644 3rdparty/libuv/src/unix/proctitle.c create mode 100644 3rdparty/libuv/src/unix/pthread-fixes.c create mode 100644 3rdparty/libuv/src/unix/signal.c create mode 100644 3rdparty/libuv/src/unix/spinlock.h create mode 100644 3rdparty/libuv/src/unix/stream.c create mode 100644 3rdparty/libuv/src/unix/sunos.c create mode 100644 3rdparty/libuv/src/unix/tcp.c create mode 100644 3rdparty/libuv/src/unix/thread.c create mode 100644 3rdparty/libuv/src/unix/timer.c create mode 100644 3rdparty/libuv/src/unix/tty.c create mode 100644 3rdparty/libuv/src/unix/udp.c create mode 100644 3rdparty/libuv/src/uv-common.c create mode 100644 3rdparty/libuv/src/uv-common.h create mode 100644 3rdparty/libuv/src/version.c create mode 100644 3rdparty/libuv/src/win/async.c create mode 100644 3rdparty/libuv/src/win/atomicops-inl.h create mode 100644 3rdparty/libuv/src/win/core.c create mode 100644 3rdparty/libuv/src/win/dl.c create mode 100644 3rdparty/libuv/src/win/error.c create mode 100644 3rdparty/libuv/src/win/fs-event.c create mode 100644 3rdparty/libuv/src/win/fs.c create mode 100644 3rdparty/libuv/src/win/getaddrinfo.c create mode 100644 3rdparty/libuv/src/win/getnameinfo.c create mode 100644 3rdparty/libuv/src/win/handle-inl.h create mode 100644 3rdparty/libuv/src/win/handle.c create mode 100644 3rdparty/libuv/src/win/internal.h create mode 100644 3rdparty/libuv/src/win/loop-watcher.c create mode 100644 3rdparty/libuv/src/win/pipe.c create mode 100644 3rdparty/libuv/src/win/poll.c create mode 100644 3rdparty/libuv/src/win/process-stdio.c create mode 100644 3rdparty/libuv/src/win/process.c create mode 100644 3rdparty/libuv/src/win/req-inl.h create mode 100644 3rdparty/libuv/src/win/req.c create mode 100644 3rdparty/libuv/src/win/signal.c create mode 100644 3rdparty/libuv/src/win/snprintf.c create mode 100644 3rdparty/libuv/src/win/stream-inl.h create mode 100644 3rdparty/libuv/src/win/stream.c create mode 100644 3rdparty/libuv/src/win/tcp.c create mode 100644 3rdparty/libuv/src/win/thread.c create mode 100644 3rdparty/libuv/src/win/timer.c create mode 100644 3rdparty/libuv/src/win/tty.c create mode 100644 3rdparty/libuv/src/win/udp.c create mode 100644 3rdparty/libuv/src/win/util.c create mode 100644 3rdparty/libuv/src/win/winapi.c create mode 100644 3rdparty/libuv/src/win/winapi.h create mode 100644 3rdparty/libuv/src/win/winsock.c create mode 100644 3rdparty/libuv/src/win/winsock.h create mode 100644 3rdparty/libuv/test/benchmark-async-pummel.c create mode 100644 3rdparty/libuv/test/benchmark-async.c create mode 100644 3rdparty/libuv/test/benchmark-fs-stat.c create mode 100644 3rdparty/libuv/test/benchmark-getaddrinfo.c create mode 100644 3rdparty/libuv/test/benchmark-list.h create mode 100644 3rdparty/libuv/test/benchmark-loop-count.c create mode 100644 3rdparty/libuv/test/benchmark-million-async.c create mode 100644 3rdparty/libuv/test/benchmark-million-timers.c create mode 100644 3rdparty/libuv/test/benchmark-multi-accept.c create mode 100644 3rdparty/libuv/test/benchmark-ping-pongs.c create mode 100644 3rdparty/libuv/test/benchmark-pound.c create mode 100644 3rdparty/libuv/test/benchmark-pump.c create mode 100644 3rdparty/libuv/test/benchmark-sizes.c create mode 100644 3rdparty/libuv/test/benchmark-spawn.c create mode 100644 3rdparty/libuv/test/benchmark-tcp-write-batch.c create mode 100644 3rdparty/libuv/test/benchmark-thread.c create mode 100644 3rdparty/libuv/test/benchmark-udp-pummel.c create mode 100644 3rdparty/libuv/test/blackhole-server.c create mode 100644 3rdparty/libuv/test/dns-server.c create mode 100644 3rdparty/libuv/test/echo-server.c create mode 100644 3rdparty/libuv/test/fixtures/empty_file create mode 100644 3rdparty/libuv/test/fixtures/load_error.node create mode 100644 3rdparty/libuv/test/run-benchmarks.c create mode 100644 3rdparty/libuv/test/run-tests.c create mode 100644 3rdparty/libuv/test/runner-unix.c create mode 100644 3rdparty/libuv/test/runner-unix.h create mode 100644 3rdparty/libuv/test/runner-win.c create mode 100644 3rdparty/libuv/test/runner-win.h create mode 100644 3rdparty/libuv/test/runner.c create mode 100644 3rdparty/libuv/test/runner.h create mode 100644 3rdparty/libuv/test/task.h create mode 100644 3rdparty/libuv/test/test-active.c create mode 100644 3rdparty/libuv/test/test-async-null-cb.c create mode 100644 3rdparty/libuv/test/test-async.c create mode 100644 3rdparty/libuv/test/test-barrier.c create mode 100644 3rdparty/libuv/test/test-callback-order.c create mode 100644 3rdparty/libuv/test/test-callback-stack.c create mode 100644 3rdparty/libuv/test/test-close-fd.c create mode 100644 3rdparty/libuv/test/test-close-order.c create mode 100644 3rdparty/libuv/test/test-condvar.c create mode 100644 3rdparty/libuv/test/test-connection-fail.c create mode 100644 3rdparty/libuv/test/test-cwd-and-chdir.c create mode 100644 3rdparty/libuv/test/test-default-loop-close.c create mode 100644 3rdparty/libuv/test/test-delayed-accept.c create mode 100644 3rdparty/libuv/test/test-dlerror.c create mode 100644 3rdparty/libuv/test/test-embed.c create mode 100644 3rdparty/libuv/test/test-emfile.c create mode 100644 3rdparty/libuv/test/test-error.c create mode 100644 3rdparty/libuv/test/test-fail-always.c create mode 100644 3rdparty/libuv/test/test-fs-event.c create mode 100644 3rdparty/libuv/test/test-fs-poll.c create mode 100644 3rdparty/libuv/test/test-fs.c create mode 100644 3rdparty/libuv/test/test-get-currentexe.c create mode 100644 3rdparty/libuv/test/test-get-loadavg.c create mode 100644 3rdparty/libuv/test/test-get-memory.c create mode 100644 3rdparty/libuv/test/test-getaddrinfo.c create mode 100644 3rdparty/libuv/test/test-getnameinfo.c create mode 100644 3rdparty/libuv/test/test-getsockname.c create mode 100644 3rdparty/libuv/test/test-handle-fileno.c create mode 100644 3rdparty/libuv/test/test-homedir.c create mode 100644 3rdparty/libuv/test/test-hrtime.c create mode 100644 3rdparty/libuv/test/test-idle.c create mode 100644 3rdparty/libuv/test/test-ip4-addr.c create mode 100644 3rdparty/libuv/test/test-ip6-addr.c create mode 100644 3rdparty/libuv/test/test-ipc-send-recv.c create mode 100644 3rdparty/libuv/test/test-ipc.c create mode 100644 3rdparty/libuv/test/test-list.h create mode 100644 3rdparty/libuv/test/test-loop-alive.c create mode 100644 3rdparty/libuv/test/test-loop-close.c create mode 100644 3rdparty/libuv/test/test-loop-configure.c create mode 100644 3rdparty/libuv/test/test-loop-handles.c create mode 100644 3rdparty/libuv/test/test-loop-stop.c create mode 100644 3rdparty/libuv/test/test-loop-time.c create mode 100644 3rdparty/libuv/test/test-multiple-listen.c create mode 100644 3rdparty/libuv/test/test-mutexes.c create mode 100644 3rdparty/libuv/test/test-osx-select.c create mode 100644 3rdparty/libuv/test/test-pass-always.c create mode 100644 3rdparty/libuv/test/test-ping-pong.c create mode 100644 3rdparty/libuv/test/test-pipe-bind-error.c create mode 100644 3rdparty/libuv/test/test-pipe-close-stdout-read-stdin.c create mode 100644 3rdparty/libuv/test/test-pipe-connect-error.c create mode 100644 3rdparty/libuv/test/test-pipe-connect-multiple.c create mode 100644 3rdparty/libuv/test/test-pipe-connect-prepare.c create mode 100644 3rdparty/libuv/test/test-pipe-getsockname.c create mode 100644 3rdparty/libuv/test/test-pipe-pending-instances.c create mode 100644 3rdparty/libuv/test/test-pipe-sendmsg.c create mode 100644 3rdparty/libuv/test/test-pipe-server-close.c create mode 100644 3rdparty/libuv/test/test-pipe-set-non-blocking.c create mode 100644 3rdparty/libuv/test/test-platform-output.c create mode 100644 3rdparty/libuv/test/test-poll-close-doesnt-corrupt-stack.c create mode 100644 3rdparty/libuv/test/test-poll-close.c create mode 100644 3rdparty/libuv/test/test-poll-closesocket.c create mode 100644 3rdparty/libuv/test/test-poll.c create mode 100644 3rdparty/libuv/test/test-process-title.c create mode 100644 3rdparty/libuv/test/test-queue-foreach-delete.c create mode 100644 3rdparty/libuv/test/test-ref.c create mode 100644 3rdparty/libuv/test/test-run-nowait.c create mode 100644 3rdparty/libuv/test/test-run-once.c create mode 100644 3rdparty/libuv/test/test-semaphore.c create mode 100644 3rdparty/libuv/test/test-shutdown-close.c create mode 100644 3rdparty/libuv/test/test-shutdown-eof.c create mode 100644 3rdparty/libuv/test/test-shutdown-twice.c create mode 100644 3rdparty/libuv/test/test-signal-multiple-loops.c create mode 100644 3rdparty/libuv/test/test-signal.c create mode 100644 3rdparty/libuv/test/test-socket-buffer-size.c create mode 100644 3rdparty/libuv/test/test-spawn.c create mode 100644 3rdparty/libuv/test/test-stdio-over-pipes.c create mode 100644 3rdparty/libuv/test/test-tcp-bind-error.c create mode 100644 3rdparty/libuv/test/test-tcp-bind6-error.c create mode 100644 3rdparty/libuv/test/test-tcp-close-accept.c create mode 100644 3rdparty/libuv/test/test-tcp-close-while-connecting.c create mode 100644 3rdparty/libuv/test/test-tcp-close.c create mode 100644 3rdparty/libuv/test/test-tcp-connect-error-after-write.c create mode 100644 3rdparty/libuv/test/test-tcp-connect-error.c create mode 100644 3rdparty/libuv/test/test-tcp-connect-timeout.c create mode 100644 3rdparty/libuv/test/test-tcp-connect6-error.c create mode 100644 3rdparty/libuv/test/test-tcp-create-socket-early.c create mode 100644 3rdparty/libuv/test/test-tcp-flags.c create mode 100644 3rdparty/libuv/test/test-tcp-oob.c create mode 100644 3rdparty/libuv/test/test-tcp-open.c create mode 100644 3rdparty/libuv/test/test-tcp-read-stop.c create mode 100644 3rdparty/libuv/test/test-tcp-shutdown-after-write.c create mode 100644 3rdparty/libuv/test/test-tcp-try-write.c create mode 100644 3rdparty/libuv/test/test-tcp-unexpected-read.c create mode 100644 3rdparty/libuv/test/test-tcp-write-after-connect.c create mode 100644 3rdparty/libuv/test/test-tcp-write-fail.c create mode 100644 3rdparty/libuv/test/test-tcp-write-queue-order.c create mode 100644 3rdparty/libuv/test/test-tcp-write-to-half-open-connection.c create mode 100644 3rdparty/libuv/test/test-tcp-writealot.c create mode 100644 3rdparty/libuv/test/test-thread-equal.c create mode 100644 3rdparty/libuv/test/test-thread.c create mode 100644 3rdparty/libuv/test/test-threadpool-cancel.c create mode 100644 3rdparty/libuv/test/test-threadpool.c create mode 100644 3rdparty/libuv/test/test-timer-again.c create mode 100644 3rdparty/libuv/test/test-timer-from-check.c create mode 100644 3rdparty/libuv/test/test-timer.c create mode 100644 3rdparty/libuv/test/test-tty.c create mode 100644 3rdparty/libuv/test/test-udp-bind.c create mode 100644 3rdparty/libuv/test/test-udp-create-socket-early.c create mode 100644 3rdparty/libuv/test/test-udp-dgram-too-big.c create mode 100644 3rdparty/libuv/test/test-udp-ipv6.c create mode 100644 3rdparty/libuv/test/test-udp-multicast-interface.c create mode 100644 3rdparty/libuv/test/test-udp-multicast-interface6.c create mode 100644 3rdparty/libuv/test/test-udp-multicast-join.c create mode 100644 3rdparty/libuv/test/test-udp-multicast-join6.c create mode 100644 3rdparty/libuv/test/test-udp-multicast-ttl.c create mode 100644 3rdparty/libuv/test/test-udp-open.c create mode 100644 3rdparty/libuv/test/test-udp-options.c create mode 100644 3rdparty/libuv/test/test-udp-send-and-recv.c create mode 100644 3rdparty/libuv/test/test-udp-send-immediate.c create mode 100644 3rdparty/libuv/test/test-udp-send-unreachable.c create mode 100644 3rdparty/libuv/test/test-udp-try-send.c create mode 100644 3rdparty/libuv/test/test-walk-handles.c create mode 100644 3rdparty/libuv/test/test-watcher-cross-stop.c create mode 100644 3rdparty/libuv/uv.gyp create mode 100644 3rdparty/libuv/vcbuild.bat diff --git a/3rdparty/libuv/.gitignore b/3rdparty/libuv/.gitignore new file mode 100644 index 00000000000..86a8a5b7b85 --- /dev/null +++ b/3rdparty/libuv/.gitignore @@ -0,0 +1,75 @@ +*.swp +*.[oa] +*.l[oa] +*.opensdf +*.orig +*.pyc +*.sdf +*.suo +core +vgcore.* +.buildstamp +.dirstamp +.deps/ +/.libs/ +/aclocal.m4 +/ar-lib +/autom4te.cache/ +/compile +/config.guess +/config.log +/config.status +/config.sub +/configure +/depcomp +/install-sh +/libtool +/libuv.a +/libuv.dylib +/libuv.pc +/libuv.so +/ltmain.sh +/missing +/test-driver +Makefile +Makefile.in + +# Generated by gyp for android +*.target.mk + +/out/ +/build/gyp + +/test/.libs/ +/test/run-tests +/test/run-tests.exe +/test/run-tests.dSYM +/test/run-benchmarks +/test/run-benchmarks.exe +/test/run-benchmarks.dSYM + +*.sln +*.sln.cache +*.ncb +*.vcproj +*.vcproj*.user +*.vcxproj +*.vcxproj.filters +*.vcxproj.user +_UpgradeReport_Files/ +UpgradeLog*.XML +Debug +Release +ipch + +# sphinx generated files +/docs/build/ + +# Clion / IntelliJ project files +/.idea/ + +*.xcodeproj +*.xcworkspace + +# make dist output +libuv-*.tar.* diff --git a/3rdparty/libuv/.mailmap b/3rdparty/libuv/.mailmap new file mode 100644 index 00000000000..7a51588c0b7 --- /dev/null +++ b/3rdparty/libuv/.mailmap @@ -0,0 +1,39 @@ +Aaron Bieber +Alan Gutierrez +Andrius Bentkus +Bert Belder +Bert Belder +Brandon Philips +Brian White +Brian White +Caleb James DeLisle +Christoph Iserlohn +Devchandra Meetei Leishangthem +Fedor Indutny +Frank Denis +Isaac Z. Schlueter +Jason Williams +Justin Venus +Keno Fischer +Keno Fischer +Leith Bade +Leonard Hecker +Maciej Małecki +Marc Schlaich +Michael +Michael Neumann +Nicholas Vavilov +Rasmus Christian Pedersen +Rasmus Christian Pedersen +Robert Mustacchi +Ryan Dahl +Ryan Emery +Sam Roberts +San-Tai Hsu +Santiago Gimeno +Saúl Ibarra Corretgé +Shigeki Ohtsu +Timothy J. Fontaine +Yasuhiro Matsumoto +Yazhong Liu +Yuki Okumura diff --git a/3rdparty/libuv/AUTHORS b/3rdparty/libuv/AUTHORS new file mode 100644 index 00000000000..8dc3955cad5 --- /dev/null +++ b/3rdparty/libuv/AUTHORS @@ -0,0 +1,242 @@ +# Authors ordered by first contribution. +Ryan Dahl +Bert Belder +Josh Roesslein +Alan Gutierrez +Joshua Peek +Igor Zinkovsky +San-Tai Hsu +Ben Noordhuis +Henry Rawas +Robert Mustacchi +Matt Stevens +Paul Querna +Shigeki Ohtsu +Tom Hughes +Peter Bright +Jeroen Janssen +Andrea Lattuada +Augusto Henrique Hentz +Clifford Heath +Jorge Chamorro Bieling +Luis Lavena +Matthew Sporleder +Erick Tryzelaar +Isaac Z. Schlueter +Pieter Noordhuis +Marek Jelen +Fedor Indutny +Saúl Ibarra Corretgé +Felix Geisendörfer +Yuki Okumura +Roman Shtylman +Frank Denis +Carter Allen +Tj Holowaychuk +Shimon Doodkin +Ryan Emery +Bruce Mitchener +Maciej Małecki +Yasuhiro Matsumoto +Daisuke Murase +Paddy Byers +Dan VerWeire +Brandon Benvie +Brandon Philips +Nathan Rajlich +Charlie McConnell +Vladimir Dronnikov +Aaron Bieber +Bulat Shakirzyanov +Brian White +Erik Dubbelboer +Keno Fischer +Ira Cooper +Andrius Bentkus +Iñaki Baz Castillo +Mark Cavage +George Yohng +Xidorn Quan +Roman Neuhauser +Shuhei Tanuma +Bryan Cantrill +Trond Norbye +Tim Holy +Prancesco Pertugio +Leonard Hecker +Andrew Paprocki +Luigi Grilli +Shannen Saez +Artur Adib +Hiroaki Nakamura +Ting-Yu Lin +Stephen Gallagher +Shane Holloway +Andrew Shaffer +Vlad Tudose +Ben Leslie +Tim Bradshaw +Timothy J. Fontaine +Marc Schlaich +Brian Mazza +Elliot Saba +Ben Kelly +Nils Maier +Nicholas Vavilov +Miroslav Bajtoš +Sean Silva +Wynn Wilkes +Andrei Sedoi +Alex Crichton +Brent Cook +Brian Kaisner +Luca Bruno +Reini Urban +Maks Naumov +Sean Farrell +Chris Bank +Geert Jansen +Christoph Iserlohn +Steven Kabbes +Alex Gaynor +huxingyi +Tenor Biel +Andrej Manduch +Joshua Neuheisel +Alexis Campailla +Yazhong Liu +Sam Roberts +River Tarnell +Nathan Sweet +Trevor Norris +Oguz Bastemur +Dylan Cali +Austin Foxley +Benjamin Saunders +Geoffry Song +Rasmus Christian Pedersen +William Light +Oleg Efimov +Lars Gierth +Rasmus Christian Pedersen +Justin Venus +Kristian Evensen +Linus Mårtensson +Navaneeth Kedaram Nambiathan +Yorkie +StarWing +thierry-FreeBSD +Isaiah Norton +Raul Martins +David Capello +Paul Tan +Javier Hernández +Tonis Tiigi +Norio Kobota +李港平 +Chernyshev Viacheslav +Stephen von Takach +JD Ballard +Luka Perkov +Ryan Cole +HungMingWu +Jay Satiro +Leith Bade +Peter Atashian +Tim Cooper +Caleb James DeLisle +Jameson Nash +Graham Lee +Andrew Low +Pavel Platto +Tony Kelman +John Firebaugh +lilohuang +Paul Goldsmith +Julien Gilli +Michael Hudson-Doyle +Recep ASLANTAS +Rob Adams +Zachary Newman +Robin Hahling +Jeff Widman +cjihrig +Tomasz Kołodziejski +Unknown W. Brackets +Emmanuel Odeke +Mikhail Mukovnikov +Thorsten Lorenz +Yuri D'Elia +Manos Nikolaidis +Elijah Andrews +Michael Ira Krufky +Helge Deller +Joey Geralnik +Tim Caswell +Logan Rosen +Kenneth Perry +John Marino +Alexey Melnichuk +Johan Bergström +Alex Mo +Luis Martinez de Bartolome +Michael Penick +Michael +Massimiliano Torromeo +TomCrypto +Brett Vickers +Ole André Vadla Ravnås +Kazuho Oku +Ryan Phillips +Brian Green +Devchandra Meetei Leishangthem +Corey Farrell +Per Nilsson +Alan Rogers +Daryl Haresign +Rui Abreu Ferreira +João Reis +farblue68 +Jason Williams +Igor Soarez +Miodrag Milanovic +Cheng Zhao +Michael Neumann +Stefano Cristiano +heshamsafi +A. Hauptmann +John McNamee +Yosuke Furukawa +Santiago Gimeno +guworks +RossBencina +Roger A. Light +chenttuuvv +Richard Lau +ronkorving +Corbin Simpson +Zachary Hamm +Karl Skomski +Jeremy Whitlock +Willem Thiart +Ben Trask +Jianghua Yang +Colin Snover +Sakthipriyan Vairamani +Eli Skeggs +nmushell +Gireesh Punathil +Ryan Johnston +Adam Stylinski +Nathan Corvino +Wink Saville +Angel Leon +Louis DeJardin +Imran Iqbal +Petka Antonov +Ian Kronquist +kkdaemon +Yuval Brik +Joran Dirk Greef +Andrey Mazo +sztomi diff --git a/3rdparty/libuv/CONTRIBUTING.md b/3rdparty/libuv/CONTRIBUTING.md new file mode 100644 index 00000000000..b46edd492aa --- /dev/null +++ b/3rdparty/libuv/CONTRIBUTING.md @@ -0,0 +1,166 @@ +# CONTRIBUTING + +The libuv project welcomes new contributors. This document will guide you +through the process. + + +### FORK + +Fork the project [on GitHub](https://github.com/libuv/libuv) and check out +your copy. + +``` +$ git clone https://github.com/username/libuv.git +$ cd libuv +$ git remote add upstream https://github.com/libuv/libuv.git +``` + +Now decide if you want your feature or bug fix to go into the master branch +or the stable branch. As a rule of thumb, bug fixes go into the stable branch +while new features go into the master branch. + +The stable branch is effectively frozen; patches that change the libuv +API/ABI or affect the run-time behavior of applications get rejected. + +In case of doubt, open an issue in the [issue tracker][], post your question +to the [libuv mailing list], or contact one of project maintainers +(@bnoordhuis, @piscisaureus, @indutny or @saghul) on [IRC][]. + +Especially do so if you plan to work on something big. Nothing is more +frustrating than seeing your hard work go to waste because your vision +does not align with that of a project maintainers. + + +### BRANCH + +Okay, so you have decided on the proper branch. Create a feature branch +and start hacking: + +``` +$ git checkout -b my-feature-branch -t origin/v1.x +``` + +(Where v1.x is the latest stable branch as of this writing.) + +### CODE + +Please adhere to libuv's code style. In general it follows the conventions from +the [Google C/C++ style guide]. Some of the key points, as well as some +additional guidelines, are enumerated below. + +* Code that is specific to unix-y platforms should be placed in `src/unix`, and + declarations go into `include/uv-unix.h`. + +* Source code that is Windows-specific goes into `src/win`, and related + publicly exported types, functions and macro declarations should generally + be declared in `include/uv-win.h`. + +* Names should be descriptive and concise. + +* All the symbols and types that libuv makes available publicly should be + prefixed with `uv_` (or `UV_` in case of macros). + +* Internal, non-static functions should be prefixed with `uv__`. + +* Use two spaces and no tabs. + +* Lines should be wrapped at 80 characters. + +* Ensure that lines have no trailing whitespace, and use unix-style (LF) line + endings. + +* Use C89-compliant syntax. In other words, variables can only be declared at + the top of a scope (function, if/for/while-block). + +* When writing comments, use properly constructed sentences, including + punctuation. + +* When documenting APIs and/or source code, don't make assumptions or make + implications about race, gender, religion, political orientation or anything + else that isn't relevant to the project. + +* Remember that source code usually gets written once and read often: ensure + the reader doesn't have to make guesses. Make sure that the purpose and inner + logic are either obvious to a reasonably skilled professional, or add a + comment that explains it. + + +### COMMIT + +Make sure git knows your name and email address: + +``` +$ git config --global user.name "J. Random User" +$ git config --global user.email "j.random.user@example.com" +``` + +Writing good commit logs is important. A commit log should describe what +changed and why. Follow these guidelines when writing one: + +1. The first line should be 50 characters or less and contain a short + description of the change prefixed with the name of the changed + subsystem (e.g. "net: add localAddress and localPort to Socket"). +2. Keep the second line blank. +3. Wrap all other lines at 72 columns. + +A good commit log looks like this: + +``` +subsystem: explaining the commit in one line + +Body of commit message is a few lines of text, explaining things +in more detail, possibly giving some background about the issue +being fixed, etc etc. + +The body of the commit message can be several paragraphs, and +please do proper word-wrap and keep columns shorter than about +72 characters or so. That way `git log` will show things +nicely even when it is indented. +``` + +The header line should be meaningful; it is what other people see when they +run `git shortlog` or `git log --oneline`. + +Check the output of `git log --oneline files_that_you_changed` to find out +what subsystem (or subsystems) your changes touch. + + +### REBASE + +Use `git rebase` (not `git merge`) to sync your work from time to time. + +``` +$ git fetch upstream +$ git rebase upstream/v1.x # or upstream/master +``` + + +### TEST + +Bug fixes and features should come with tests. Add your tests in the +`test/` directory. Tests also need to be registered in `test/test-list.h`. +Look at other tests to see how they should be structured (license boilerplate, +the way entry points are declared, etc.). + +Check README.md file to find out how to run the test suite and make sure that +there are no test regressions. + +### PUSH + +``` +$ git push origin my-feature-branch +``` + +Go to https://github.com/username/libuv and select your feature branch. Click +the 'Pull Request' button and fill out the form. + +Pull requests are usually reviewed within a few days. If there are comments +to address, apply your changes in a separate commit and push that to your +feature branch. Post a comment in the pull request afterwards; GitHub does +not send out notifications when you add commits. + + +[issue tracker]: https://github.com/libuv/libuv/issues +[libuv mailing list]: http://groups.google.com/group/libuv +[IRC]: http://webchat.freelibuv.net/?channels=libuv +[Google C/C++ style guide]: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml diff --git a/3rdparty/libuv/ChangeLog b/3rdparty/libuv/ChangeLog new file mode 100644 index 00000000000..d5f95404a56 --- /dev/null +++ b/3rdparty/libuv/ChangeLog @@ -0,0 +1,2372 @@ +2015.12.15, Version 1.8.0 (Stable) + +Changes since version 1.7.5: + +* unix: fix memory leak in uv_interface_addresses (Jianghua Yang) + +* unix: make uv_guess_handle work properly for AIX (Gireesh Punathil) + +* fs: undo uv__req_init when uv__malloc failed (Jianghua Yang) + +* build: remove unused 'component' GYP option (Saúl Ibarra Corretgé) + +* include: remove duplicate extern declaration (Jianghua Yang) + +* win: use the MSVC provided snprintf where possible (Jason Williams) + +* win, test: fix compilation warning (Saúl Ibarra Corretgé) + +* win: fix compilation with VS < 2012 (Ryan Johnston) + +* stream: support empty uv_try_write on unix (Fedor Indutny) + +* unix: fix request handle leak in uv__udp_send (Jianghua Yang) + +* src: replace QUEUE_SPLIT with QUEUE_MOVE (Ben Noordhuis) + +* unix: use QUEUE_MOVE when iterating over lists (Ben Noordhuis) + +* unix: squelch harmless valgrind warning (Ben Noordhuis) + +* test: don't abort on setrlimit() failure (Ben Noordhuis) + +* unix: only undo fs req registration in async mode (Ben Noordhuis) + +* unix: fix uv__getiovmax return value (HungMingWu) + +* unix: make work with Solaris Studio. (Adam Stylinski) + +* test: fix fs_event_watch_file_currentdir flakiness (Santiago Gimeno) + +* unix: skip prohibited syscalls on tvOS and watchOS (Nathan Corvino) + +* test: use FQDN in getaddrinfo_fail test (Wink Saville) + +* docs: clarify documentation of uv_tcp_init_ex (Andrius Bentkus) + +* win: fix comment (Miodrag Milanovic) + +* doc: fix typo in README (Angel Leon) + +* darwin: abort() if (un)locking fs mutex fails (Ben Noordhuis) + +* pipe: enable inprocess uv_write2 on Windows (Louis DeJardin) + +* win: properly return UV_EBADF when _close() fails (Nicholas Vavilov) + +* test: skip process_title for AIX (Imran Iqbal) + +* misc: expose handle print APIs (Petka Antonov) + +* include: add stdio.h to uv.h (Saúl Ibarra Corretgé) + +* misc: remove unnecessary null pointer checks (Ian Kronquist) + +* test,freebsd: skip udp_dual_stack if not supported (Santiago Gimeno) + +* linux: don't retry dup2/dup3 on EINTR (Ben Noordhuis) + +* unix: don't retry dup2/dup3 on EINTR (Ben Noordhuis) + +* test: fix -Wtautological-pointer-compare warnings (Saúl Ibarra Corretgé) + +* win: map ERROR_BAD_PATHNAME to UV_ENOENT (Tony Kelman) + +* test: fix test/test-tty.c for AIX (Imran Iqbal) + +* android: support api level less than 21 (kkdaemon) + +* fsevents: fix race on simultaneous init+close (Fedor Indutny) + +* linux,fs: fix p{read,write}v with a 64bit offset (Saúl Ibarra Corretgé) + +* fs: add uv_fs_realpath() (Yuval Brik) + +* win: fix path for removed and renamed fs events (Joran Dirk Greef) + +* win: do not read more from stream than available (Jeremy Whitlock) + +* test: test that uv_close() doesn't corrupt QUEUE (Andrey Mazo) + +* unix: fix uv_fs_event_stop() from fs_event_cb (Andrey Mazo) + +* test: fix self-deadlocks in thread_rwlock_trylock (Ben Noordhuis) + +* src: remove non ascii character (sztomi) + +* test: fix test udp_multicast_join6 for AIX (Imran Iqbal) + + +2015.09.23, Version 1.7.5 (Stable), a8c1136de2cabf25b143021488cbaab05834daa8 + +Changes since version 1.7.4: + +* unix: Support atomic compare & swap xlC on AIX (nmushell) + +* unix: Fix including uv-aix.h on AIX (nmushell) + +* unix: consolidate rwlock tryrdlock trywrlock errors (Saúl Ibarra Corretgé) + +* unix, win: consolidate mutex trylock errors (Saúl Ibarra Corretgé) + +* darwin: fix memory leak in uv_cpu_info (Jianghua Yang) + +* test: add tests for the uv_rwlock implementation (Bert Belder) + +* win: redo/fix the uv_rwlock APIs (Bert Belder) + +* win: don't fetch function pointers to SRWLock APIs (Bert Belder) + + +2015.09.12, Version 1.7.4 (Stable), a7ad4f52189d89cfcba35f78bfc5ff3b1f4105c4 + +Changes since version 1.7.3: + +* doc: uv_read_start and uv_read_cb clarifications (Ben Trask) + +* freebsd: obtain true uptime through clock_gettime() (Jianghua Yang) + +* win, tty: do not convert \r to \r\n (Colin Snover) + +* build,gyp: add DragonFly to the list of OSes (Michael Neumann) + +* fs: fix bug in sendfile for DragonFly (Michael Neumann) + +* doc: add uv_dlsym() return type (Brian White) + +* tests: fix fs tests run w/o full getdents support (Jeremy Whitlock) + +* doc: fix typo (Devchandra Meetei Leishangthem) + +* doc: fix uv-unix.h location (Sakthipriyan Vairamani) + +* unix: fix error check when closing process pipe fd (Ben Noordhuis) + +* test,freebsd: fix ipc_listen_xx_write tests (Santiago Gimeno) + +* win: fix unsavory rwlock fallback implementation (Bert Belder) + +* doc: clarify repeat timer behavior (Eli Skeggs) + + +2015.08.28, Version 1.7.3 (Stable), 93877b11c8b86e0a6befcda83a54555c1e36e4f0 + +Changes since version 1.7.2: + +* threadpool: fix thread starvation bug (Ben Noordhuis) + + +2015.08.25, Version 1.7.2 (Stable), 4d13a013fcfa72311f0102751fdc7951873f466c + +Changes since version 1.7.1: + +* unix, win: make uv_loop_init return on error (Willem Thiart) + +* win: reset pipe handle for pipe servers (Saúl Ibarra Corretgé) + +* win: fix replacing pipe handle for pipe servers (Saúl Ibarra Corretgé) + +* win: fix setting pipe pending instances after bind (Saúl Ibarra Corretgé) + + +2015.08.20, Version 1.7.1 (Stable), 44f4b6bd82d8ae4583ccc4768a83af778ef69f85 + +Changes since version 1.7.0: + +* doc: document the procedure for verifying releases (Saúl Ibarra Corretgé) + +* doc: add note about Windows binaries to the README (Saúl Ibarra Corretgé) + +* doc: use long GPG IDs in MAINTAINERS.md (Saúl Ibarra Corretgé) + +* Revert "stream: squelch ECONNRESET error if already closed" (Saúl Ibarra + Corretgé) + +* doc: clarify uv_read_stop() is idempotent (Corbin Simpson) + +* unix: OpenBSD's setsockopt needs an unsigned char for multicast (Zachary + Hamm) + +* test: Fix two memory leaks (Karl Skomski) + +* unix,win: return EINVAL on nullptr args in uv_fs_{read,write} (Karl Skomski) + +* win: set accepted TCP sockets as non-inheritable (Saúl Ibarra Corretgé) + +* unix: remove superfluous parentheses in fs macros (Ben Noordhuis) + +* unix: don't copy arguments for sync fs requests (Ben Noordhuis) + +* test: plug small memory leak in unix test runner (Ben Noordhuis) + +* unix,windows: allow NULL loop for sync fs requests (Ben Noordhuis) + +* unix,windows: don't assert on unknown error code (Ben Noordhuis) + +* stream: retry write on EPROTOTYPE on OSX (Brian White) + +* common: fix use of snprintf on Windows (Saúl Ibarra Corretgé) + +* tests: refactored fs watch_dir tests for stability (Jeremy Whitlock) + + +2015.08.06, Version 1.7.0 (Stable), 415a865d6365ba58d02b92b89d46ba5d7744ec8b + +Changes since version 1.6.1: + +* win,stream: add slot to remember CRT fd (Bert Belder) + +* win,pipe: properly close when created from CRT fd (Bert Belder) + +* win,pipe: don't close fd 0-2 (Bert Belder) + +* win,tty: convert fd -> handle safely (Bert Belder) + +* win,tty: properly close when created from CRT fd (Bert Belder) + +* win,tty: don't close fd 0-2 (Bert Belder) + +* win,fs: don't close fd 0-2 (Bert Belder) + +* win: include "malloc.h" (Cheng Zhao) + +* windows: MSVC 2015 has C99 inline (Jason Williams) + +* dragonflybsd: fixes for nonblocking and cloexec (Michael Neumann) + +* dragonflybsd: use sendfile(2) for uv_fs_sendfile (Michael Neumann) + +* dragonflybsd: fix uv_exepath (Michael Neumann) + +* win,fs: Fixes align(8) directive on mingw (Stefano Cristiano) + +* unix, win: prevent replacing fd in uv_{udp,tcp,pipe}_t (Saúl Ibarra Corretgé) + +* win: move logic to set socket non-inheritable to uv_tcp_set_socket (Saúl + Ibarra Corretgé) + +* unix, win: add ability to create tcp/udp sockets early (Saúl Ibarra Corretgé) + +* test: retry select() on EINTR, honor milliseconds (Ben Noordhuis) + +* unix: consolidate tcp and udp bind error (Saúl Ibarra Corretgé) + +* test: conditionally skip udp_ipv6_multicast_join6 (heshamsafi) + +* core: add UV_VERSION_HEX macro (Saúl Ibarra Corretgé) + +* doc: add section with version-checking macros and functions (Saúl Ibarra + Corretgé) + +* tty: cleanup handle if uv_tty_init fails (Saúl Ibarra Corretgé) + +* darwin: save a fd when FSEvents is used (Saúl Ibarra Corretgé) + +* win: fix returning thread id in uv_thread_self (Saúl Ibarra Corretgé) + +* common: use offsetof for QUEUE_DATA (Saúl Ibarra Corretgé) + +* win: remove UV_HANDLE_CONNECTED (A. Hauptmann) + +* docs: add Windows specific note for uv_fs_open (Saúl Ibarra Corretgé) + +* doc: add note about uv_fs_scandir (Saúl Ibarra Corretgé) + +* test,unix: reduce stack size of watchdog threads (Ben Noordhuis) + +* win: add support for recursive file watching (Saúl Ibarra Corretgé) + +* win,tty: support consoles with non-default colors (John McNamee) + +* doc: add missing variable name (Yosuke Furukawa) + +* stream: squelch ECONNRESET error if already closed (Santiago Gimeno) + +* build: remove ancient condition from common.gypi (Saúl Ibarra Corretgé) + +* tests: skip some tests when network is unreachable (Luca Bruno) + +* build: proper support for android cross compilation (guworks) + +* android: add missing include to pthread-fixes.c (RossBencina) + +* test: fix compilation warning (Saúl Ibarra Corretgé) + +* doc: add a note about uv_dirent_t.type (Saúl Ibarra Corretgé) + +* win,test: fix shared library build (Saúl Ibarra Corretgé) + +* test: fix compilation warning (Santiago Gimeno) + +* build: add experimental Windows installer (Roger A. Light) + +* threadpool: send signal only when queue is empty (chenttuuvv) + +* aix: fix uv_exepath with relative paths (Richard Lau) + +* build: fix version syntax in AppVeyor file (Saúl Ibarra Corretgé) + +* unix: allow nbufs > IOV_MAX in uv_fs_{read,write} (ronkorving) + + +2015.06.06, Version 1.6.1 (Stable), 30c8be07bb78a66fdee5141626bf53a49a17094a + +Changes since version 1.6.0: + +* unix: handle invalid _SC_GETPW_R_SIZE_MAX values (cjihrig) + + +2015.06.04, Version 1.6.0 (Stable), adfccad76456061dfcf79b8df8e7dbfee51791d7 + +Changes since version 1.5.0: + +* aix: fix setsockopt for multicast options (Michael) + +* unix: don't block for io if any io handle is primed (Saúl Ibarra Corretgé) + +* windows: MSVC 2015 has snprintf() (Rui Abreu Ferreira) + +* windows: Add VS2015 support to vcbuild.bat (Jason Williams) + +* doc: fix typo in tcp.rst (Igor Soarez) + +* linux: work around epoll bug in kernels < 2.6.37 (Ben Noordhuis) + +* unix,win: add uv_os_homedir() (cjihrig) + +* stream: fix `select()` race condition (Fedor Indutny) + +* unix: prevent infinite loop in uv__run_pending (Saúl Ibarra Corretgé) + +* unix: make sure UDP send callbacks are asynchronous (Saúl Ibarra Corretgé) + +* test: fix `platform_output` netmask printing. (Andrew Paprocki) + +* aix: add ahafs autoconf detection and README notes (Andrew Paprocki) + +* core: add ability to customize memory allocator (Saúl Ibarra Corretgé) + + +2015.05.07, Version 1.5.0 (Stable), 4e77f74c7b95b639b3397095db1bc5bcc016c203 + +Changes since version 1.4.2: + +* doc: clarify that the thread pool primites are not thread safe (Andrius + Bentkus) + +* aix: always deregister closing fds from epoll (Michael) + +* unix: fix glibc-2.20+ macro incompatibility (Massimiliano Torromeo) + +* doc: add Sphinx plugin for generating links to man pages (Saúl Ibarra + Corretgé) + +* doc: link system and library calls to man pages (Saúl Ibarra Corretgé) + +* doc: document uv_getnameinfo_t.{host|service} (Saúl Ibarra Corretgé) + +* build: update the location of gyp (Stephen von Takach) + +* win: name all anonymous structs and unions (TomCrypto) + +* linux: work around epoll bug in kernels 3.10-3.19 (Ben Noordhuis) + +* darwin: fix size calculation in select() fallback (Ole André Vadla Ravnås) + +* solaris: fix setsockopt for multicast options (Julien Gilli) + +* test: fix race condition in multithreaded test (Ben Noordhuis) + +* doc: fix long lines in tty.rst (Ben Noordhuis) + +* test: use UV_TTY_MODE_* values in tty test (Ben Noordhuis) + +* unix: don't clobber errno in uv_tty_reset_mode() (Ben Noordhuis) + +* unix: reject non-tty fds in uv_tty_init() (Ben Noordhuis) + +* win: fix pipe blocking writes (Alexis Campailla) + +* build: fix cross-compiling for iOS (Steven Kabbes) + +* win: remove unnecessary malloc.h + +* include: use `extern "c++"` for defining C++ code (Kazuho Oku) + +* unix: reap child on execvp() failure (Ryan Phillips) + +* windows: fix handle leak on EMFILE (Brian Green) + +* test: fix tty_file, close handle if initialized (Saúl Ibarra Corretgé) + +* doc: clarify what uv_*_open accepts (Saúl Ibarra Corretgé) + +* doc: clarify that we don't maintain external doc resources (Saúl Ibarra + Corretgé) + +* build: add documentation for ninja support (Devchandra Meetei Leishangthem) + +* doc: document uv_buf_t members (Corey Farrell) + +* linux: fix epoll_pwait() fallback on arm64 (Ben Noordhuis) + +* android: fix compilation warning (Saúl Ibarra Corretgé) + +* unix: don't close the fds we just setup (Sam Roberts) + +* test: spawn child replacing std{out,err} to stderr (Saúl Ibarra Corretgé) + +* unix: fix swapping fds order in uv_spawn (Saúl Ibarra Corretgé) + +* unix: fix potential bug if dup2 fails in uv_spawn (Saúl Ibarra Corretgé) + +* test: remove LOG and LOGF variadic macros (Saúl Ibarra Corretgé) + +* win: fix uv_fs_access on directories (Saúl Ibarra Corretgé) + +* win: fix of double free in uv_uptime (Per Nilsson) + +* unix: open "/dev/null" instead of "/" for emfile_fd (Alan Rogers) + +* docs: add some missing words (Daryl Haresign) + +* unix: clean up uv_fs_open() O_CLOEXEC logic (Ben Noordhuis) + +* build: set SONAME for shared library in uv.gyp (Rui Abreu Ferreira) + +* windows: define snprintf replacement as inline instead of static (Rui Abreu + Ferreira) + +* win: fix unlink of readonly files (João Reis) + +* doc: fix uv_run(UV_RUN_DEFAULT) description (Ben Noordhuis) + +* linux: intercept syscall when running under memory sanitizer (Keno Fischer) + +* aix: fix uv_interface_addresses return value (farblue68) + +* windows: defer reporting TCP write failure until next tick (Saúl Ibarra + Corretgé) + +* test: add test for deferred TCP write failure (Saúl Ibarra Corretgé) + + +2015.02.27, Version 1.4.2 (Stable), 1a7391348a11d5450c0f69c828d5302e2cb842eb + +Changes since version 1.4.1: + +* stream: ignore EINVAL for SO_OOBINLINE on OS X (Fedor Indutny) + + +2015.02.25, Version 1.4.1 (Stable), e8e3fc5789cc0f02937879d141cca0411274093c + +Changes since version 1.4.0: + +* win: don't use inline keyword in thread.c (Ben Noordhuis) + +* windows: fix setting dirent types on uv_fs_scandir_next (Saúl Ibarra + Corretgé) + +* unix,windows: make uv_thread_create() return errno (Ben Noordhuis) + +* tty: fix build for SmartOS (Julien Gilli) + +* unix: fix for uv_async data race (Michael Penick) + +* unix, windows: map EHOSTDOWN errno (Ben Noordhuis) + +* stream: use SO_OOBINLINE on OS X (Fedor Indutny) + + +2015.02.10, Version 1.4.0 (Stable), 19fb8a90648f3763240db004b77ab984264409be + +Changes since version 1.3.0: + +* unix: check Android support for pthread_cond_timedwait_monotonic_np (Leith + Bade) + +* test: use modified path in test (cjihrig) + +* unix: implement uv_stream_set_blocking() (Ben Noordhuis) + + +2015.01.29, Version 1.3.0 (Stable), 165685b2a9a42cf96501d79cd6d48a18aaa16e3b + +Changes since version 1.2.1: + +* unix, windows: set non-block mode in uv_poll_init (Saúl Ibarra Corretgé) + +* doc: clarify which flags are supported in uv_fs_event_start (Saúl Ibarra + Corretgé) + +* win,unix: move loop functions which have identical implementations (Andrius + Bentkus) + +* doc: explain how the threadpool is allocated (Alex Mo) + +* doc: clarify uv_default_loop (Saúl Ibarra Corretgé) + +* unix: fix implicit declaration compiler warning (Ben Noordhuis) + +* unix: fix long line introduced in commit 94e628fa (Ben Noordhuis) + +* unix, win: add synchronous uv_get{addr,name}info (Saúl Ibarra Corretgé) + +* linux: fix epoll_pwait() regression with < 2.6.19 (Ben Noordhuis) + +* build: compile -D_GNU_SOURCE on linux (Ben Noordhuis) + +* build: use -fvisibility=hidden in autotools build (Ben Noordhuis) + +* fs, pipe: no trailing terminator in exact sized buffers (Andrius Bentkus) + +* style: rename buf to buffer and len to size for consistency (Andrius Bentkus) + +* test: fix test-spawn on MinGW32 (Luis Martinez de Bartolome) + +* win, pipe: fix assertion when destroying timer (Andrius Bentkus) + +* win, unix: add pipe_peername implementation (Andrius Bentkus) + + +2015.01.29, Version 0.10.33 (Stable), 7a2253d33ad8215a26c1b34f1952aee7242dd687 + +Changes since version 0.10.32: + +* linux: fix epoll_pwait() regression with < 2.6.19 (Ben Noordhuis) + +* test: back-port uv_loop_configure() test (Ben Noordhuis) + + +2015.01.15, Version 1.2.1 (Stable), 4ca78e989062a1099dc4b9ad182a98e8374134b1 + +Changes since version 1.2.0: + +* unix: remove unused dtrace file (Saúl Ibarra Corretgé) + +* test: skip TTY select test if /dev/tty can't be opened (Saúl Ibarra Corretgé) + +* doc: clarify the behavior of uv_tty_init (Saúl Ibarra Corretgé) + +* doc: clarify how uv_async_send behaves (Saúl Ibarra Corretgé) + +* build: make dist now generates a full tarball (Johan Bergström) + +* freebsd: make uv_exepath more resilient (Saúl Ibarra Corretgé) + +* unix: make setting the tty mode to the same value a no-op (Saúl Ibarra + Corretgé) + +* win,tcp: support uv_try_write (Bert Belder) + +* test: enable test-tcp-try-write on windows (Bert Belder) + +* win,tty: support uv_try_write (Bert Belder) + +* unix: set non-block mode in uv_{pipe,tcp,udp}_open (Ben Noordhuis) + + +2015.01.06, Version 1.2.0 (Stable), 09f25b13cd149c7981108fc1a75611daf1277f83 + +Changes since version 1.1.0: + +* linux: fix epoll_pwait() sigmask size calculation (Ben Noordhuis) + +* tty: implement binary I/O terminal mode (Yuri D'Elia) + +* test: fix spawn test with autotools build (Ben Noordhuis) + +* test: skip ipv6 tests when ipv6 is not supported (Ben Noordhuis) + +* common: move STATIC_ASSERT to uv-common.h (Alexey Melnichuk) + +* win/thread: store thread handle in a TLS slot (Alexey Melnichuk) + +* unix: fix ttl, multicast ttl and loop options on IPv6 (Saúl Ibarra Corretgé) + +* linux: fix support for preadv/pwritev-less kernels (Ben Noordhuis) + +* unix: make uv_exepath(size=0) return UV_EINVAL (Ben Noordhuis) + +* darwin: fix uv_exepath(smallbuf) UV_EPERM error (Ben Noordhuis) + +* openbsd: fix uv_exepath(smallbuf) UV_EINVAL error (Ben Noordhuis) + +* linux: fix uv_exepath(size=1) UV_EINVAL error (Ben Noordhuis) + +* sunos: preemptively fix uv_exepath(size=1) (Ben Noordhuis) + +* win: fix and clarify comments in winapi.h (Bert Belder) + +* win: make available NtQueryDirectoryFile (Bert Belder) + +* win: add definitions for directory information types (Bert Belder) + +* win: use NtQueryDirectoryFile to implement uv_fs_scandir (Bert Belder) + +* unix: don't unlink unix socket on bind error (Ben Noordhuis) + +* build: fix bad comment in autogen.sh (Ben Noordhuis) + +* build: add AC_PROG_LIBTOOL to configure.ac (Ben Noordhuis) + +* test: skip udp_options6 if there no IPv6 support (Saúl Ibarra Corretgé) + +* win: add definitions for MUI errors mingw lacks (Bert Belder) + +* build: enable warnings in autotools build (Ben Noordhuis) + +* build: remove -Wno-dollar-in-identifier-extension (Ben Noordhuis) + +* build: move flags from Makefile.am to configure.ac (Ben Noordhuis) + + +2015.01.06, Version 0.10.32 (Stable), 378de30c59aef5fdb6d130fa5cfcb0a68fce571c + +Changes since version 0.10.31: + +* linux: fix epoll_pwait() sigmask size calculation (Ben Noordhuis) + + +2014.12.25, Version 1.1.0 (Stable), 9572f3e74a167f59a8017e57ca3ebe91ffd88e18 + +Changes since version 1.0.2: + +* test: test that closing a poll handle doesn't corrupt the stack (Bert Belder) + +* win: fix compilation of tests (Marc Schlaich) + +* Revert "win: keep a reference to AFD_POLL_INFO in cancel poll" (Bert Belder) + +* win: avoid stack corruption when closing a poll handle (Bert Belder) + +* test: fix test-fs-file-loop on Windows (Bert Belder) + +* test: fix test-cwd-and-chdir (Bert Belder) + +* doc: indicate what version uv_loop_configure was added on (Saúl Ibarra + Corretgé) + +* doc: fix sphinx warning (Saúl Ibarra Corretgé) + +* test: skip spawn_setuid_setgid if we get EACCES (Saúl Ibarra Corretgé) + +* test: silence some Clang warnings (Saúl Ibarra Corretgé) + +* test: relax osx_select_many_fds (Saúl Ibarra Corretgé) + +* test: fix compilation warnings when building with Clang (Saúl Ibarra + Corretgé) + +* win: fix autotools build of tests (Luis Lavena) + +* gitignore: ignore Visual Studio files (Marc Schlaich) + +* win: set fallback message if FormatMessage fails (Marc Schlaich) + +* win: fall back to default language in uv_dlerror (Marc Schlaich) + +* test: improve compatibility for dlerror test (Marc Schlaich) + +* test: check dlerror is "no error" in no error case (Marc Schlaich) + +* unix: change uv_cwd not to return a trailing slash (Saúl Ibarra Corretgé) + +* test: fix cwd_and_chdir test on Unix (Saúl Ibarra Corretgé) + +* test: add uv_cwd output to platform_output test (Saúl Ibarra Corretgé) + +* build: fix dragonflybsd autotools build (John Marino) + +* win: scandir use 'ls' for formatting long strings (Kenneth Perry) + +* build: remove clang and gcc_version gyp defines (Ben Noordhuis) + +* unix, windows: don't treat uv_run_mode as a bitmask (Saúl Ibarra Corretgé) + +* unix, windows: fix UV_RUN_ONCE mode if progress was made (Saúl Ibarra + Corretgé) + + +2014.12.25, Version 0.10.31 (Stable), 4dbd27e2219069a6daa769fb37f98673b77b4261 + +Changes since version 0.10.30: + +* test: test that closing a poll handle doesn't corrupt the stack (Bert Belder) + +* win: fix compilation of tests (Marc Schlaich) + +* Revert "win: keep a reference to AFD_POLL_INFO in cancel poll" (Bert Belder) + +* win: avoid stack corruption when closing a poll handle (Bert Belder) + +* gitignore: ignore Visual Studio files (Marc Schlaich) + +* win: set fallback message if FormatMessage fails (Marc Schlaich) + +* win: fall back to default language in uv_dlerror (Marc Schlaich) + +* test: improve compatibility for dlerror test (Marc Schlaich) + +* test: check dlerror is "no error" in no error case (Marc Schlaich) + +* build: link against -pthread (Logan Rosen) + +* win: scandir use 'ls' for formatting long strings (Kenneth Perry) + + +2014.12.10, Version 1.0.2 (Stable), eec671f0059953505f9a3c9aeb7f9f31466dd7cd + +Changes since version 1.0.1: + +* linux: fix sigmask size arg in epoll_pwait() call (Ben Noordhuis) + +* linux: handle O_NONBLOCK != SOCK_NONBLOCK case (Helge Deller) + +* doc: fix spelling (Joey Geralnik) + +* unix, windows: fix typos in comments (Joey Geralnik) + +* test: canonicalize test runner path (Ben Noordhuis) + +* test: fix compilation warnings (Saúl Ibarra Corretgé) + +* test: skip tty test if detected width and height are 0 (Saúl Ibarra Corretgé) + +* doc: update README with IRC channel (Saúl Ibarra Corretgé) + +* Revert "unix: use cfmakeraw() for setting raw TTY mode" (Ben Noordhuis) + +* doc: document how to get result of uv_fs_mkdtemp (Tim Caswell) + +* unix: add flag for blocking SIGPROF during poll (Ben Noordhuis) + +* unix, windows: add uv_loop_configure() function (Ben Noordhuis) + +* win: keep a reference to AFD_POLL_INFO in cancel poll (Marc Schlaich) + +* test: raise fd limit for OSX select test (Saúl Ibarra Corretgé) + +* unix: remove overzealous assert in uv_read_stop (Saúl Ibarra Corretgé) + +* unix: reset the reading flag when a stream gets EOF (Saúl Ibarra Corretgé) + +* unix: stop reading if an error is produced (Saúl Ibarra Corretgé) + +* cleanup: remove all dead assignments (Maciej Małecki) + +* linux: return early if we have no interfaces (Maciej Małecki) + +* cleanup: remove a dead increment (Maciej Małecki) + + +2014.12.10, Version 0.10.30 (Stable), 5a63f5e9546dca482eeebc3054139b21f509f21f + +Changes since version 0.10.29: + +* linux: fix sigmask size arg in epoll_pwait() call (Ben Noordhuis) + +* linux: handle O_NONBLOCK != SOCK_NONBLOCK case (Helge Deller) + +* doc: update project links (Ben Noordhuis) + +* windows: fix compilation of tests (Marc Schlaich) + +* unix: add flag for blocking SIGPROF during poll (Ben Noordhuis) + +* unix, windows: add uv_loop_configure() function (Ben Noordhuis) + +* win: keep a reference to AFD_POLL_INFO in cancel poll (Marc Schlaich) + + +2014.11.27, Version 1.0.1 (Stable), 0a8e81374e861d425b56c45c8599595d848911d2 + +Changes since version 1.0.0: + +* readme: remove Rust from users (Elijah Andrews) + +* doc,build,include: update project links (Ben Noordhuis) + +* doc: fix typo: Strcutures -> Structures (Michael Ira Krufky) + +* unix: fix processing process handles queue (Saúl Ibarra Corretgé) + +* win: replace non-ansi characters in source file (Bert Belder) + + +2014.11.21, Version 1.0.0 (Stable), feb2a9e6947d892f449b2770c4090f7d8c88381b + +Changes since version 1.0.0-rc2: + +* doc: fix git/svn url for gyp repo in README (Emmanuel Odeke) + +* windows: fix fs_read with nbufs > 1 and offset (Unknown W. Brackets) + +* win: add missing IP_ADAPTER_UNICAST_ADDRESS_LH definition for MinGW + (huxingyi) + +* doc: mention homebrew in README (Mikhail Mukovnikov) + +* doc: add learnuv workshop to README (Thorsten Lorenz) + +* doc: fix parameter name in uv_fs_access (Saúl Ibarra Corretgé) + +* unix: use cfmakeraw() for setting raw TTY mode (Yuri D'Elia) + +* win: fix uv_thread_self() (Alexis Campailla) + +* build: add x32 support to gyp build (Ben Noordhuis) + +* build: remove dtrace probes (Ben Noordhuis) + +* doc: fix link in misc.rst (Manos Nikolaidis) + +* mailmap: remove duplicated entries (Saúl Ibarra Corretgé) + +* gyp: fix comment regarding version info location (Saúl Ibarra Corretgé) + + +2014.10.21, Version 1.0.0-rc2 (Pre-release) + +Changes since version 1.0.0-rc1: + +* build: add missing fixtures to distribution tarball (Rob Adams) + +* doc: update references to current stable branch (Zachary Newman) + +* fs: fix readdir on empty directory (Fedor Indutny) + +* fs: rename uv_fs_readdir to uv_fs_scandir (Saúl Ibarra Corretgé) + +* doc: document uv_alloc_cb (Saúl Ibarra Corretgé) + +* doc: add migration guide from version 0.10 (Saúl Ibarra Corretgé) + +* build: add DragonFly BSD support in autotools (Robin Hahling) + +* doc: document missing stream related structures (Saúl Ibarra Corretgé) + +* doc: clarify uv_loop_t.data field lifetime (Saúl Ibarra Corretgé) + +* doc: add documentation for missing functions and structures (Saúl Ibarra + Corretgé) + +* doc: fix punctuation and grammar in README (Jeff Widman) + +* windows: return libuv error codes in uv_poll_init() (cjihrig) + +* unix, windows: add uv_fs_access() (cjihrig) + +* windows: fix netmask detection (Alexis Campailla) + +* unix, windows: don't include null byte in uv_cwd size (Saúl Ibarra Corretgé) + +* unix, windows: add uv_thread_equal (Tomasz Kołodziejski) + +* windows: fix fs_write with nbufs > 1 and offset (Unknown W. Brackets) + + +2014.10.21, Version 0.10.29 (Stable), 2d728542d3790183417f8f122a110693cd85db14 + +Changes since version 0.10.28: + +* darwin: allocate enough space for select() hack (Fedor Indutny) + +* linux: try epoll_pwait if epoll_wait is missing (Michael Hudson-Doyle) + +* windows: map ERROR_INVALID_DRIVE to UV_ENOENT (Saúl Ibarra Corretgé) + + +2014.09.18, Version 1.0.0-rc1 (Unstable), 0c28bbf7b42882853d1799ab96ff68b07f7f8d49 + +Changes since version 0.11.29: + +* windows: improve timer precision (Alexis Campailla) + +* build, gyp: set xcode flags (Recep ASLANTAS) + +* ignore: include m4 files which are created manually (Recep ASLANTAS) + +* build: add m4 for feature/flag-testing (Recep ASLANTAS) + +* ignore: ignore Xcode project and workspace files (Recep ASLANTAS) + +* unix: fix warnings about dollar symbol usage in identifiers (Recep ASLANTAS) + +* unix: fix warnings when loading functions with dlsym (Recep ASLANTAS) + +* linux: try epoll_pwait if epoll_wait is missing (Michael Hudson-Doyle) + +* test: add test for closing and recreating default loop (Saúl Ibarra Corretgé) + +* windows: properly close the default loop (Saúl Ibarra Corretgé) + +* version: add ability to specify a version suffix (Saúl Ibarra Corretgé) + +* doc: add API documentation (Saúl Ibarra Corretgé) + +* test: don't close connection on write error (Trevor Norris) + +* windows: further simplify the code for timers (Saúl Ibarra Corretgé) + +* gyp: remove UNLIMITED_SELECT from dependent define (Fedor Indutny) + +* darwin: allocate enough space for select() hack (Fedor Indutny) + +* unix, windows: don't allow a NULL callback on timers (Saúl Ibarra Corretgé) + +* windows: simplify code in uv_timer_again (Saúl Ibarra Corretgé) + +* test: use less requests on tcp-write-queue-order (Saúl Ibarra Corretgé) + +* unix: stop child process watcher after last one exits (Saúl Ibarra Corretgé) + +* unix: simplify how process handle queue is managed (Saúl Ibarra Corretgé) + +* windows: remove duplicated field (mattn) + +* core: add a reserved field to uv_handle_t and uv_req_t (Saúl Ibarra Corretgé) + +* windows: fix buffer leak after failed udp send (Bert Belder) + +* windows: make sure sockets and handles are reset on close (Saúl Ibarra Corretgé) + +* unix, windows: add uv_fileno (Saúl Ibarra Corretgé) + +* build: use same CFLAGS in autotools build as in gyp (Saúl Ibarra Corretgé) + +* build: remove unneeded define in uv.gyp (Saúl Ibarra Corretgé) + +* test: fix watcher_cross_stop on Windows (Saúl Ibarra Corretgé) + +* unix, windows: move includes for EAI constants (Saúl Ibarra Corretgé) + +* unix: fix exposing EAI_* glibc-isms (Saúl Ibarra Corretgé) + +* unix: fix tcp write after bad connect freezing (Andrius Bentkus) + + +2014.08.20, Version 0.11.29 (Unstable), 35451fed830807095bbae8ef981af004a4b9259e + +Changes since version 0.11.28: + +* windows: make uv_read_stop immediately stop reading (Jameson Nash) + +* windows: fix uv__getaddrinfo_translate_error (Alexis Campailla) + +* netbsd: fix build (Saúl Ibarra Corretgé) + +* unix, windows: add uv_recv_buffer_size and uv_send_buffer_size (Andrius + Bentkus) + +* windows: add support for UNC paths on uv_spawn (Paul Goldsmith) + +* windows: replace use of inet_addr with uv_inet_pton (Saúl Ibarra Corretgé) + +* unix: replace some asserts with returning errors (Andrius Bentkus) + +* windows: use OpenBSD implementation for uv_fs_mkdtemp (Pavel Platto) + +* windows: fix GetNameInfoW error handling (Alexis Campailla) + +* fs: introduce uv_readdir_next() and report types (Fedor Indutny) + +* fs: extend reported types in uv_fs_readdir_next (Saúl Ibarra Corretgé) + +* unix: read on stream even when UV__POLLHUP set. (Julien Gilli) + + +2014.08.08, Version 0.11.28 (Unstable), fc9e2a0bc487b299c0cd3b2c9a23aeb554b5d8d1 + +Changes since version 0.11.27: + +* unix, windows: const-ify handle in uv_udp_getsockname (Rasmus Pedersen) + +* windows: use UV_ECANCELED for aborted TCP writes (Saúl Ibarra Corretgé) + +* windows: add more required environment variables (Jameson Nash) + +* windows: sort environment variables before calling CreateProcess (Jameson + Nash) + +* unix, windows: move uv_loop_close out of assert (John Firebaugh) + +* windows: fix buffer overflow on uv__getnameinfo_work() (lilohuang) + +* windows: add uv_backend_timeout (Jameson Nash) + +* test: disable tcp_close_accept on Windows (Saúl Ibarra Corretgé) + +* windows: read the PATH env var of the child (Alex Crichton) + +* include: avoid using C++ 'template' reserved word (Iñaki Baz Castillo) + +* include: fix version number (Saúl Ibarra Corretgé) + + +2014.07.32, Version 0.11.27 (Unstable), ffe24f955032d060968ea0289af365006afed55e + +Changes since version 0.11.26: + +* unix, windows: use the same threadpool implementation (Saúl Ibarra Corretgé) + +* unix: use struct sockaddr_storage for target UDP addr (Saúl Ibarra Corretgé) + +* doc: add documentation to uv_udp_start_recv (Andrius Bentkus) + +* common: use common uv__count_bufs code (Andrius Bentkus) + +* unix, win: add send_queue_size and send_queue_count to uv_udp_t (Andrius + Bentkus) + +* unix, win: add uv_udp_try_send (Andrius Bentkus) + +* unix: return UV_EAGAIN if uv_try_write cannot write any data (Saúl Ibarra + Corretgé) + +* windows: fix compatibility with cygwin pipes (Jameson Nash) + +* windows: count queued bytes even if request completed immediately (Saúl + Ibarra Corretgé) + +* windows: disable CRT debug handler on MinGW32 (Saúl Ibarra Corretgé) + +* windows: map ERROR_INVALID_DRIVE to UV_ENOENT (Saúl Ibarra Corretgé) + +* unix: try to write immediately in uv_udp_send (Saúl Ibarra Corretgé) + +* unix: remove incorrect assert (Saúl Ibarra Corretgé) + +* openbsd: avoid requiring privileges for uv_resident_set_memory (Aaron Bieber) + +* unix: guarantee write queue cb execution order in streams (Andrius Bentkus) + +* img: add logo files (Saúl Ibarra Corretgé) + +* aix: improve AIX compatibility (Andrew Low) + +* windows: return bind error immediately when implicitly binding (Saúl Ibarra + Corretgé) + +* windows: don't use atexit for cleaning up the threadpool (Saúl Ibarra + Corretgé) + +* windows: destroy work queue elements when colsing a loop (Saúl Ibarra + Corretgé) + +* unix, windows: add uv_fs_mkdtemp (Pavel Platto) + +* build: handle platforms without multiprocessing.synchronize (Saúl Ibarra + Corretgé) + +* windows: change GENERIC_ALL to GENERIC_WRITE in fs__create_junction (Tony + Kelman) + +* windows: relay TCP bind errors via ipc (Alexis Campailla) + + +2014.07.32, Version 0.10.28 (Stable), 9c14b616f5fb84bfd7d45707bab4bbb85894443e + +Changes since version 0.10.27: + +* windows: fix handling closed socket while poll handle is closing (Saúl Ibarra + Corretgé) + +* unix: return system error on EAI_SYSTEM (Saúl Ibarra Corretgé) + +* unix: fix bogus structure field name (Saúl Ibarra Corretgé) + +* darwin: invoke `mach_timebase_info` only once (Fedor Indutny) + + +2014.06.28, Version 0.11.26 (Unstable), 115281a1058c4034d5c5ccedacb667fe3f6327ea + +Changes since version 0.11.25: + +* windows: add VT100 codes ?25l and ?25h (JD Ballard) + +* windows: add invert ANSI (7 / 27) emulation (JD Ballard) + +* unix: fix handling error on UDP socket creation (Saúl Ibarra Corretgé) + +* unix, windows: getnameinfo implementation (Rasmus Pedersen) + +* heap: fix `heap_remove()` (Fedor Indutny) + +* unix, windows: fix parsing scoped IPv6 addresses (Saúl Ibarra Corretgé) + +* windows: fix handling closed socket while poll handle is closing (Saúl Ibarra + Corretgé) + +* thread: barrier functions (Ben Noordhuis) + +* windows: fix PYTHON environment variable usage (Jay Satiro) + +* unix, windows: return system error on EAI_SYSTEM (Saúl Ibarra Corretgé) + +* windows: fix handling closed socket while poll handle is closing (Saúl Ibarra + Corretgé) + +* unix: don't run i/o callbacks after prepare callbacks (Saúl Ibarra Corretgé) + +* windows: add tty unicode support for input (Peter Atashian) + +* header: introduce `uv_loop_size()` (Andrius Bentkus) + +* darwin: invoke `mach_timebase_info` only once (Fedor Indutny) + + +2014.05.02, Version 0.11.25 (Unstable), 2acd544cff7142e06aa3b09ec64b4a33dd9ab996 + +Changes since version 0.11.24: + +* osx: pass const handle pointer to uv___stream_fd (Chernyshev Viacheslav) + +* unix, windows: pass const handle ptr to uv_tcp_get*name (Chernyshev + Viacheslav) + +* common: pass const sockaddr ptr to uv_ip*_name (Chernyshev Viacheslav) + +* unix, windows: validate flags on uv_udp|tcp_bind (Saúl Ibarra Corretgé) + +* unix: handle case when addr is not initialized after recvmsg (Saúl Ibarra + Corretgé) + +* unix, windows: uv_now constness (Rasmus Pedersen) + + +2014.04.15, Version 0.11.24 (Unstable), ed948c29f6e8c290f79325a6f0bc9ef35bcde644 + +Changes since version 0.11.23: + +* linux: reduce file descriptor count of async pipe (Ben Noordhuis) + +* sunos: support IPv6 qualified link-local addresses (Saúl Ibarra Corretgé) + +* windows: fix opening of read-only stdin pipes (Alexis Campailla) + +* windows: Fix an infinite loop in uv_spawn (Alex Crichton) + +* windows: fix console signal handler refcount (李港平) + +* inet: allow scopeid in uv_inet_pton (Fedor Indutny) + + +2014.04.07, Version 0.11.23 (Unstable), e54de537efcacd593f36fcaaf8b4cb9e64313275 + +Changes since version 0.11.22: + +* fs: avoid using readv/writev where possible (Fedor Indutny) + +* mingw: fix build with autotools (Saúl Ibarra Corretgé) + +* bsd: support IPv6 qualified link-local addresses (Saúl Ibarra Corretgé) + +* unix: add UV_HANDLE_IPV6 flag to tcp and udp handles (Saúl Ibarra Corretgé) + +* unix, windows: do not set SO_REUSEADDR by default on udp (Saúl Ibarra + Corretgé) + +* windows: fix check in uv_tty_endgame() (Maks Naumov) + +* unix, windows: add IPv6 support for uv_udp_multicast_interface (Saúl Ibarra + Corretgé) + +* unix: fallback to blocking writes if reopening a tty fails (Saúl Ibarra + Corretgé) + +* unix: fix handling uv__open_cloexec failure (Saúl Ibarra Corretgé) + +* unix, windows: add IPv6 support to uv_udp_set_membership (Saúl Ibarra + Corretgé) + +* unix, windows: removed unused status parameter (Saúl Ibarra Corretgé) + +* android: add support of ifaddrs in android (Javier Hernández) + +* build: fix SunOS and AIX build with autotools (Saúl Ibarra Corretgé) + +* build: freebsd link with libelf if dtrace enabled (Saúl Ibarra Corretgé) + +* stream: do not leak `alloc_cb` buffers on error (Fedor Indutny) + +* unix: fix setting written size on uv_wd (Saúl Ibarra Corretgé) + + +2014.03.11, Version 0.11.22 (Unstable), cd0c19b1d3c56acf0ade7687006e12e75fbda36d + +Changes since version 0.11.21: + +* unix, windows: map ERANGE errno (Saúl Ibarra Corretgé) + +* unix, windows: make uv_cwd be consistent with uv_exepath (Saúl Ibarra + Corretgé) + +* process: remove debug perror() prints (Fedor Indutny) + +* windows: fall back for volume info query (Isaiah Norton) + +* pipe: allow queueing pending handles (Fedor Indutny) + +* windows: fix winsock status codes for address errors (Raul Martins) + +* windows: Remove unused variable from uv__pipe_insert_pending_socket (David + Capello) + +* unix: workaround broken pthread_sigmask on Android (Paul Tan) + +* error: add ENXIO for O_NONBLOCK FIFO open() (Fedor Indutny) + +* freebsd: use accept4, introduced in version 10 (Saúl Ibarra Corretgé) + +* windows: fix warnings of MinGW -Wall -O3 (StarWing) + +* openbsd, osx: fix compilation warning on scandir (Saúl Ibarra Corretgé) + +* linux: always deregister closing fds from epoll (Geoffry Song) + +* unix: reopen tty as /dev/tty (Saúl Ibarra Corretgé) + +* kqueue: invalidate fd in uv_fs_event_t (Fedor Indutny) + + +2014.02.28, Version 0.11.21 (Unstable), 3ef958158ae1019e027ebaa93114160099db5206 + +Changes since version 0.11.20: + +* unix: fix uv_fs_write when using an empty buffer (Saúl Ibarra Corretgé) + +* unix, windows: add assertion in uv_loop_delete (Saúl Ibarra Corretgé) + + +2014.02.27, Version 0.11.20 (Unstable), 88355e081b51c69ee1e2b6b0015a4e3d38bd0579 + +Changes since version 0.11.19: + +* stream: start thread after assignments (Oguz Bastemur) + +* fs: `uv__cloexec()` opened fd (Fedor Indutny) + +* gyp: qualify `library` variable (Fedor Indutny) + +* unix, win: add uv_udp_set_multicast_interface() (Austin Foxley) + +* unix: fix uv_tcp_nodelay return value in case of error (Saúl Ibarra Corretgé) + +* unix: call setgoups before calling setuid/setgid (Saúl Ibarra Corretgé) + +* include: mark close_cb field as private (Saúl Ibarra Corretgé) + +* unix, windows: map EFBIG errno (Saúl Ibarra Corretgé) + +* unix: correct error when calling uv_shutdown twice (Keno Fischer) + +* windows: fix building on MinGW (Alex Crichton) + +* windows: always initialize uv_process_t (Alex Crichton) + +* include: expose libuv version in header files (Saúl Ibarra Corretgé) + +* fs: vectored IO API for filesystem read/write (Benjamin Saunders) + +* windows: freeze in uv_tcp_endgame (Alexis Campailla) + +* sunos: handle rearm errors (Fedor Indutny) + +* unix: use a heap for timers (Ben Noordhuis) + +* linux: always deregister closing fds from epoll (Geoffry Song) + +* linux: include grp.h for setgroups() (William Light) + +* unix, windows: add uv_loop_init and uv_loop_close (Saúl Ibarra Corretgé) + +* unix, windows: add uv_getrusage() function (Oleg Efimov) + +* win: minor error handle fix to uv_pipe_write_impl (Rasmus Pedersen) + +* heap: fix node removal (Keno Fischer) + +* win: fix C99/C++ comment (Rasmus Pedersen) + +* fs: vectored IO API for filesystem read/write (Benjamin Saunders) + +* unix, windows: add uv_pipe_getsockname (Saúl Ibarra Corretgé) + +* unix, windows: map ENOPROTOOPT errno (Saúl Ibarra Corretgé) + +* errno: add ETXTBSY (Fedor Indutny) + +* fsevent: rename filename field to path (Saúl Ibarra Corretgé) + +* unix, windows: add uv_fs_event_getpath (Saúl Ibarra Corretgé) + +* unix, windows: add uv_fs_poll_getpath (Saúl Ibarra Corretgé) + +* unix, windows: map ERANGE errno (Saúl Ibarra Corretgé) + +* unix, windows: set required size on UV_ENOBUFS (Saúl Ibarra Corretgé) + +* unix, windows: clarify what uv_stream_set_blocking does (Saúl Ibarra + Corretgé) + +* fs: use preadv on Linux if available (Brian White) + + +2014.01.30, Version 0.11.19 (Unstable), 336a1825309744f920230ec3e427e78571772347 + +Changes since version 0.11.18: + +* linux: move sscanf() out of the assert() (Trevor Norris) + +* linux: fix C99/C++ comment (Fedor Indutny) + + +2014.05.02, Version 0.10.27 (Stable), 6e24ce23b1e7576059f85a608eca13b766458a01 + +Changes since version 0.10.26: + +* windows: fix console signal handler refcount (Saúl Ibarra Corretgé) + +* win: always leave crit section in get_proc_title (Fedor Indutny) + + +2014.04.07, Version 0.10.26 (Stable), d864907611c25ec986c5e77d4d6d6dee88f26926 + +Changes since version 0.10.25: + +* process: don't close stdio fds during spawn (Tonis Tiigi) + +* build, windows: do not fail on Windows SDK Prompt (Marc Schlaich) + +* build, windows: fix x64 configuration issue (Marc Schlaich) + +* win: fix buffer leak on error in pipe.c (Fedor Indutny) + +* kqueue: invalidate fd in uv_fs_event_t (Fedor Indutny) + +* linux: always deregister closing fds from epoll (Geoffry Song) + +* error: add ENXIO for O_NONBLOCK FIFO open() (Fedor Indutny) + + +2014.02.19, Version 0.10.25 (Stable), d778dc588507588b12b9f9d2905078db542ed751 + +Changes since version 0.10.24: + +* stream: start thread after assignments (Oguz Bastemur) + +* unix: correct error when calling uv_shutdown twice (Saúl Ibarra Corretgé) + +2014.01.30, Version 0.10.24 (Stable), aecd296b6bce9b40f06a61c5c94e43d45ac7308a + +Changes since version 0.10.23: + +* linux: move sscanf() out of the assert() (Trevor Norris) + +* linux: fix C99/C++ comment (Fedor Indutny) + + +2014.01.23, Version 0.11.18 (Unstable), d47962e9d93d4a55a9984623feaf546406c9cdbb + +Changes since version 0.11.17: + +* osx: Fix a possible segfault in uv__io_poll (Alex Crichton) + +* windows: improved handling of invalid FDs (Alexis Campailla) + +* doc: adding ARCHS flag to OS X build command (Nathan Sweet) + +* tcp: reveal bind-time errors before listen (Alexis Campailla) + +* tcp: uv_tcp_dualstack() (Fedor Indutny) + +* linux: relax assumption on /proc/stat parsing (Luca Bruno) + +* openbsd: fix obvious bug in uv_cpu_info (Fedor Indutny) + +* process: close stdio after dup2'ing it (Fedor Indutny) + +* linux: move sscanf() out of the assert() (Trevor Norris) + + +2014.01.23, Version 0.10.23 (Stable), dbd218e699fec8be311d85e4788be9e28ae884f8 + +Changes since version 0.10.22: + +* linux: relax assumption on /proc/stat parsing (Luca Bruno) + +* openbsd: fix obvious bug in uv_cpu_info (Fedor Indutny) + +* process: close stdio after dup2'ing it (Fedor Indutny) + + +2014.01.08, Version 0.10.22 (Stable), f526c90eeff271d9323a9107b9a64a4671fd3103 + +Changes since version 0.10.21: + +* windows: avoid assertion failure when pipe server is closed (Bert Belder) + + +2013.12.32, Version 0.11.17 (Unstable), 589c224d4c2e79fec65db01d361948f1e4976858 + +Changes since version 0.11.16: + +* stream: allow multiple buffers for uv_try_write (Fedor Indutny) + +* unix: fix a possible memory leak in uv_fs_readdir (Alex Crichton) + +* unix, windows: add uv_loop_alive() function (Sam Roberts) + +* windows: avoid assertion failure when pipe server is closed (Bert Belder) + +* osx: Fix a possible segfault in uv__io_poll (Alex Crichton) + +* stream: fix uv__stream_osx_select (Fedor Indutny) + + +2013.12.14, Version 0.11.16 (Unstable), ae0ed8c49d0d313c935c22077511148b6e8408a4 + +Changes since version 0.11.15: + +* fsevents: remove kFSEventStreamCreateFlagNoDefer polyfill (ci-innoq) + +* libuv: add more getaddrinfo errors (Steven Kabbes) + +* unix: fix accept() EMFILE error handling (Ben Noordhuis) + +* linux: fix up SO_REUSEPORT back-port (Ben Noordhuis) + +* fsevents: fix subfolder check (Fedor Indutny) + +* fsevents: fix invalid memory access (huxingyi) + +* windows/timer: fix uv_hrtime discontinuity (Bert Belder) + +* unix: fix various memory leaks and undef behavior (Fedor Indutny) + +* unix, windows: always update loop time (Saúl Ibarra Corretgé) + +* windows: translate system errors in uv_spawn (Alexis Campailla) + +* windows: uv_spawn code refactor (Alexis Campailla) + +* unix, windows: detect errors in uv_ip4/6_addr (Yorkie) + +* stream: introduce uv_try_write(...) (Fedor Indutny) + + +2013.12.13, Version 0.10.20 (Stable), 04141464dd0fba90ace9aa6f7003ce139b888a40 + +Changes since version 0.10.19: + +* linux: fix up SO_REUSEPORT back-port (Ben Noordhuis) + +* fs-event: fix invalid memory access (huxingyi) + + +2013.11.21, Version 0.11.15 (Unstable), bfe645ed7e99ca5670d9279ad472b604c129d2e5 + +Changes since version 0.11.14: + +* fsevents: report errors to user (Fedor Indutny) + +* include: UV_FS_EVENT_RECURSIVE is a flag (Fedor Indutny) + +* linux: use CLOCK_MONOTONIC_COARSE if available (Ben Noordhuis) + +* build: make systemtap probes work with gyp build (Ben Noordhuis) + +* unix: update events from pevents between polls (Fedor Indutny) + +* fsevents: support japaneese characters in path (Chris Bank) + +* linux: don't turn on SO_REUSEPORT socket option (Ben Noordhuis) + +* queue: strengthen type checks (Ben Noordhuis) + +* include: remove uv_strlcat() and uv_strlcpy() (Ben Noordhuis) + +* build: fix windows smp build with gyp (Geert Jansen) + +* unix: return exec errors from uv_spawn, not async (Alex Crichton) + +* fsevents: use native character encoding file paths (Ben Noordhuis) + +* linux: handle EPOLLHUP without EPOLLIN/EPOLLOUT (Ben Noordhuis) + +* windows: use _snwprintf(), not swprintf() (Ben Noordhuis) + +* fsevents: use FlagNoDefer for FSEventStreamCreate (Fedor Indutny) + +* unix: fix reopened fd bug (Fedor Indutny) + +* core: fix fake watcher list and count preservation (Fedor Indutny) + +* unix: set close-on-exec flag on received fds (Ben Noordhuis) + +* netbsd, openbsd: enable futimes() wrapper (Ben Noordhuis) + +* unix: nicer error message when kqueue() fails (Ben Noordhuis) + +* samples: add socks5 proxy sample application (Ben Noordhuis) + + +2013.11.13, Version 0.10.19 (Stable), 33959f7524090b8d2c6c41e2400ca77e31755059 + +Changes since version 0.10.18: + +* darwin: avoid calling GetCurrentProcess (Fedor Indutny) + +* unix: update events from pevents between polls (Fedor Indutny) + +* fsevents: support japaneese characters in path (Chris Bank) + +* linux: don't turn on SO_REUSEPORT socket option (Ben Noordhuis) + +* build: fix windows smp build with gyp (Geert Jansen) + +* linux: handle EPOLLHUP without EPOLLIN/EPOLLOUT (Ben Noordhuis) + +* unix: fix reopened fd bug (Fedor Indutny) + +* core: fix fake watcher list and count preservation (Fedor Indutny) + + +2013.10.30, Version 0.11.14 (Unstable), d7a6482f45c1b4eb4a853dbe1a9ce8090a35633a + +Changes since version 0.11.13: + +* darwin: create fsevents thread on demand (Ben Noordhuis) + +* fsevents: FSEvents is most likely not thread-safe (Fedor Indutny) + +* fsevents: use shared FSEventStream (Fedor Indutny) + +* windows: make uv_fs_chmod() report errors correctly (Bert Belder) + +* windows: make uv_shutdown() for write-only pipes work (Bert Belder) + +* windows/fs: wrap multi-statement macros in do..while block (Bert Belder) + +* windows/fs: make uv_fs_open() report EINVAL correctly (Bert Belder) + +* windows/fs: handle _open_osfhandle() failure correctly (Bert Belder) + +* windows/fs: wrap multi-statement macros in do..while block (Bert Belder) + +* windows/fs: make uv_fs_open() report EINVAL correctly (Bert Belder) + +* windows/fs: handle _open_osfhandle() failure correctly (Bert Belder) + +* build: clarify instructions for Windows (Brian Kaisner) + +* build: remove GCC_WARN_ABOUT_MISSING_NEWLINE (Ben Noordhuis) + +* darwin: fix 10.6 build error in fsevents.c (Ben Noordhuis) + +* windows: run close callbacks after polling for i/o (Saúl Ibarra Corretgé) + +* include: clarify uv_tcp_bind() behavior (Ben Noordhuis) + +* include: clean up includes in uv.h (Ben Noordhuis) + +* include: remove UV_IO_PRIVATE_FIELDS macro (Ben Noordhuis) + +* include: fix typo in comment in uv.h (Ben Noordhuis) + +* include: update uv_is_active() documentation (Ben Noordhuis) + +* include: make uv_process_options_t.cwd const (Ben Noordhuis) + +* unix: wrap long lines at 80 columns (Ben Noordhuis) + +* unix, windows: make uv_is_*() always return 0 or 1 (Ben Noordhuis) + +* bench: measure total/init/dispatch/cleanup times (Ben Noordhuis) + +* build: use -pthread on sunos (Timothy J. Fontaine) + +* windows: remove duplicate check in stream.c (Ben Noordhuis) + +* unix: sanity-check fds before closing (Ben Noordhuis) + +* unix: remove uv__pipe_accept() (Ben Noordhuis) + +* unix: fix uv_spawn() NULL pointer deref on ENOMEM (Ben Noordhuis) + +* unix: don't close inherited fds on uv_spawn() fail (Ben Noordhuis) + +* unix: revert recent FSEvent changes (Ben Noordhuis) + +* fsevents: fix clever rescheduling (Fedor Indutny) + +* linux: ignore fractional time in uv_uptime() (Ben Noordhuis) + +* unix: fix SIGCHLD waitpid() race in process.c (Ben Noordhuis) + +* unix, windows: add uv_fs_event_start/stop functions (Saúl Ibarra Corretgé) + +* unix: fix non-synchronized access in signal.c (Ben Noordhuis) + +* unix: add atomic-ops.h (Ben Noordhuis) + +* unix: add spinlock.h (Ben Noordhuis) + +* unix: clean up uv_tty_set_mode() a little (Ben Noordhuis) + +* unix: make uv_tty_reset_mode() async signal-safe (Ben Noordhuis) + +* include: add E2BIG status code mapping (Ben Noordhuis) + +* windows: fix duplicate case build error (Ben Noordhuis) + +* windows: remove unneeded check (Saúl Ibarra Corretgé) + +* include: document pipe path truncation behavior (Ben Noordhuis) + +* fsevents: increase stack size for OSX 10.9 (Fedor Indutny) + +* windows: _snprintf expected wrong parameter type in string (Maks Naumov) + +* windows: "else" keyword is missing (Maks Naumov) + +* windows: incorrect check for SOCKET_ERROR (Maks Naumov) + +* windows: add stdlib.h to satisfy reference to abort (Sean Farrell) + +* build: fix check target for mingw (Sean Farrell) + +* unix: move uv_shutdown() assertion (Keno Fischer) + +* darwin: avoid calling GetCurrentProcess (Fedor Indutny) + + +2013.10.19, Version 0.10.18 (Stable), 9ec52963b585e822e87bdc5de28d6143aff0d2e5 + +Changes since version 0.10.17: + +* unix: fix uv_spawn() NULL pointer deref on ENOMEM (Ben Noordhuis) + +* unix: don't close inherited fds on uv_spawn() fail (Ben Noordhuis) + +* unix: revert recent FSEvent changes (Ben Noordhuis) + +* unix: fix non-synchronized access in signal.c (Ben Noordhuis) + + +2013.09.25, Version 0.10.17 (Stable), 9670e0a93540c2f0d86c84a375f2303383c11e7e + +Changes since version 0.10.16: + +* build: remove GCC_WARN_ABOUT_MISSING_NEWLINE (Ben Noordhuis) + +* darwin: fix 10.6 build error in fsevents.c (Ben Noordhuis) + + +2013.09.06, Version 0.10.16 (Stable), 2bce230d81f4853a23662cbeb26fe98010b1084b + +Changes since version 0.10.15: + +* windows: make uv_shutdown() for write-only pipes work (Bert Belder) + +* windows: make uv_fs_open() report EINVAL when invalid arguments are passed + (Bert Belder) + +* windows: make uv_fs_open() report _open_osfhandle() failure correctly (Bert + Belder) + +* windows: make uv_fs_chmod() report errors correctly (Bert Belder) + +* windows: wrap multi-statement macros in do..while block (Bert Belder) + + +2013.09.05, Version 0.11.13 (Unstable), f5b6db6c1d7f93d28281207fd47c3841c9a9792e + +Changes since version 0.11.12: + +* unix: define _GNU_SOURCE, exposes glibc-isms (Ben Noordhuis) + +* windows: check for nonconforming swprintf arguments (Brent Cook) + +* build: include internal headers in source list (Brent Cook) + +* include: merge uv_tcp_bind and uv_tcp_bind6 (Ben Noordhuis) + +* include: merge uv_tcp_connect and uv_tcp_connect6 (Ben Noordhuis) + +* include: merge uv_udp_bind and uv_udp_bind6 (Ben Noordhuis) + +* include: merge uv_udp_send and uv_udp_send6 (Ben Noordhuis) + + +2013.09.03, Version 0.11.12 (Unstable), 82d01d5f6780d178f5176a01425ec297583c0811 + +Changes since version 0.11.11: + +* test: fix epoll_wait() usage in test-embed.c (Ben Noordhuis) + +* include: uv_alloc_cb now takes uv_buf_t* (Ben Noordhuis) + +* include: uv_read{2}_cb now takes const uv_buf_t* (Ben Noordhuis) + +* include: uv_ip[46]_addr now takes sockaddr_in* (Ben Noordhuis) + +* include: uv_tcp_bind{6} now takes sockaddr_in* (Ben Noordhuis) + +* include: uv_tcp_connect{6} now takes sockaddr_in* (Ben Noordhuis) + +* include: uv_udp_recv_cb now takes const uv_buf_t* (Ben Noordhuis) + +* include: uv_udp_bind{6} now takes sockaddr_in* (Ben Noordhuis) + +* include: uv_udp_send{6} now takes sockaddr_in* (Ben Noordhuis) + +* include: uv_spawn takes const uv_process_options_t* (Ben Noordhuis) + +* include: make uv_write{2} const correct (Ben Noordhuis) + +* windows: fix flags assignment in uv_fs_readdir() (Ben Noordhuis) + +* windows: fix stray comments (Ben Noordhuis) + +* windows: remove unused is_path_dir() function (Ben Noordhuis) + + +2013.08.30, Version 0.11.11 (Unstable), ba876d53539ed0427c52039012419cd9374c6f0d + +Changes since version 0.11.10: + +* unix, windows: add thread-local storage API (Ben Noordhuis) + +* linux: don't turn on SO_REUSEPORT socket option (Ben Noordhuis) + +* darwin: fix 10.6 build error in fsevents.c (Ben Noordhuis) + +* windows: make uv_shutdown() for write-only pipes work (Bert Belder) + +* include: update uv_udp_open() / uv_udp_bind() docs (Ben Noordhuis) + +* unix: req queue must be empty when destroying loop (Ben Noordhuis) + +* unix: move loop functions from core.c to loop.c (Ben Noordhuis) + +* darwin: remove CoreFoundation dependency (Ben Noordhuis) + +* windows: make autotools build system work with mingw (Keno Fischer) + +* windows: fix mingw build (Alex Crichton) + +* windows: tweak Makefile.mingw for easier usage (Alex Crichton) + +* build: remove _GNU_SOURCE macro definition (Ben Noordhuis) + + +2013.08.25, Version 0.11.10 (Unstable), 742dadcb7154cc7bb89c0c228a223b767a36cf0d + +* windows: Re-implement uv_fs_stat. The st_ctime field now contains the change + time, not the creation time, like on unix systems. st_dev, st_ino, st_blocks + and st_blksize are now also filled out. (Bert Belder) + +* linux: fix setsockopt(SO_REUSEPORT) error handling (Ben Noordhuis) + +* windows: report uv_process_t exit code correctly (Bert Belder) + +* windows: make uv_fs_chmod() report errors correctly (Bert Belder) + +* windows: make some more NT apis available for libuv's internal use (Bert + Belder) + +* windows: squelch some compiler warnings (Bert Belder) + + +2013.08.24, Version 0.11.9 (Unstable), a2d29b5b068cbac93dc16138fb30a74e2669daad + +Changes since version 0.11.8: + +* fsevents: share FSEventStream between multiple FS watchers, which removes a + limit on the maximum number of file watchers that can be created on OS X. + (Fedor Indutny) + +* process: the `exit_status` parameter for a uv_process_t's exit callback now + is an int64_t, and no longer an int. (Bert Belder) + +* process: make uv_spawn() return some types of errors immediately on windows, + instead of passing the error code the the exit callback. This brings it on + par with libuv's behavior on unix. (Bert Belder) + + +2013.08.24, Version 0.10.15 (Stable), 221078a8fdd9b853c6b557b3d9a5dd744b4fdd6b + +Changes since version 0.10.14: + +* fsevents: create FSEvents thread on demand (Ben Noordhuis) + +* fsevents: use a single thread for interacting with FSEvents, because it's not + thread-safe. (Fedor Indutny) + +* fsevents: share FSEventStream between multiple FS watchers, which removes a + limit on the maximum number of file watchers that can be created on OS X. + (Fedor Indutny) + + +2013.08.22, Version 0.11.8 (Unstable), a5260462db80ab0deab6b9e6a8991dd8f5a9a2f8 + +Changes since version 0.11.7: + +* unix: fix missing return value warning in stream.c (Ben Noordhuis) + +* build: serial-tests was added in automake v1.12 (Ben Noordhuis) + +* windows: fix uninitialized local variable warning (Ben Noordhuis) + +* windows: fix missing return value warning (Ben Noordhuis) + +* build: fix string comparisons in autogen.sh (Ben Noordhuis) + +* windows: move INLINE macro, remove UNUSED (Ben Noordhuis) + +* unix: clean up __attribute__((quux)) usage (Ben Noordhuis) + +* sunos: remove futimes() macro (Ben Noordhuis) + +* unix: fix uv__signal_unlock() prototype (Ben Noordhuis) + +* unix, windows: allow NULL async callback (Ben Noordhuis) + +* build: apply dtrace -G to all object files (Timothy J. Fontaine) + +* darwin: fix indentation in uv__hrtime() (Ben Noordhuis) + +* darwin: create fsevents thread on demand (Ben Noordhuis) + +* darwin: reduce fsevents thread stack size (Ben Noordhuis) + +* darwin: call pthread_setname_np() if available (Ben Noordhuis) + +* build: fix automake serial-tests check again (Ben Noordhuis) + +* unix: retry waitpid() on EINTR (Ben Noordhuis) + +* darwin: fix ios build error (Ben Noordhuis) + +* darwin: fix ios compiler warning (Ben Noordhuis) + +* test: simplify test-ip6-addr.c (Ben Noordhuis) + +* unix, windows: fix ipv6 link-local address parsing (Ben Noordhuis) + +* fsevents: FSEvents is most likely not thread-safe (Fedor Indutny) + +* windows: omit stdint.h, fix msvc 2008 build error (Ben Noordhuis) + + +2013.08.22, Version 0.10.14 (Stable), 15d64132151c18b26346afa892444b95e2addad0 + +Changes since version 0.10.13: + +* unix: retry waitpid() on EINTR (Ben Noordhuis) + + +2013.08.07, Version 0.11.7 (Unstable), 3cad361f8776f70941b39d65bd9426bcb1aa817b + +Changes since version 0.11.6: + +* unix, windows: fix uv_fs_chown() function prototype (Ben Noordhuis) + +* unix, windows: remove unused variables (Brian White) + +* test: fix signed/unsigned comparison warnings (Ben Noordhuis) + +* build: dtrace shouldn't break out of tree builds (Timothy J. Fontaine) + +* unix, windows: don't read/recv if buf.len==0 (Ben Noordhuis) + +* build: add mingw makefile (Ben Noordhuis) + +* unix, windows: add MAC to uv_interface_addresses() (Brian White) + +* build: enable AM_INIT_AUTOMAKE([subdir-objects]) (Ben Noordhuis) + +* unix, windows: make buf arg to uv_fs_write const (Ben Noordhuis) + +* sunos: fix build breakage introduced in e3a657c (Ben Noordhuis) + +* aix: fix build breakage introduced in 3ee4d3f (Ben Noordhuis) + +* windows: fix mingw32 build, define JOB_OBJECT_XXX (Yasuhiro Matsumoto) + +* windows: fix mingw32 build, include limits.h (Yasuhiro Matsumoto) + +* test: replace sprintf() with snprintf() (Ben Noordhuis) + +* test: replace strcpy() with strncpy() (Ben Noordhuis) + +* openbsd: fix uv_ip6_addr() unused variable warnings (Ben Noordhuis) + +* openbsd: fix dlerror() const correctness warning (Ben Noordhuis) + +* openbsd: fix uv_fs_sendfile() unused variable warnings (Ben Noordhuis) + +* build: disable parallel automake tests (Ben Noordhuis) + +* test: add windows-only snprintf() function (Ben Noordhuis) + +* build: add automake serial-tests version check (Ben Noordhuis) + + +2013.07.26, Version 0.10.13 (Stable), 381312e1fe6fecbabc943ccd56f0e7d114b3d064 + +Changes since version 0.10.12: + +* unix, windows: fix uv_fs_chown() function prototype (Ben Noordhuis) + + +2013.07.21, Version 0.11.6 (Unstable), 6645b93273e0553d23823c576573b82b129bf28c + +Changes since version 0.11.5: + +* test: open stdout fd in write-only mode (Ben Noordhuis) + +* windows: uv_spawn shouldn't reject reparse points (Bert Belder) + +* windows: use WSAGetLastError(), not errno (Ben Noordhuis) + +* build: darwin: disable -fstrict-aliasing warnings (Ben Noordhuis) + +* test: fix signed/unsigned compiler warning (Ben Noordhuis) + +* test: add 'start timer from check handle' test (Ben Noordhuis) + +* build: `all` now builds static and dynamic lib (Ben Noordhuis) + +* unix, windows: add extra fields to uv_stat_t (Saúl Ibarra Corretgé) + +* build: add install target to the makefile (Navaneeth Kedaram Nambiathan) + +* build: switch to autotools (Ben Noordhuis) + +* build: use AM_PROG_AR conditionally (Ben Noordhuis) + +* test: fix fs_fstat test on sunos (Ben Noordhuis) + +* test: fix fs_chown when running as root (Ben Noordhuis) + +* test: fix spawn_setgid_fails and spawn_setuid_fails (Ben Noordhuis) + +* build: use AM_SILENT_RULES conditionally (Ben Noordhuis) + +* build: add DTrace detection for autotools (Timothy J. Fontaine) + +* linux,darwin,win: link-local IPv6 addresses (Miroslav Bajtoš) + +* unix: fix build when !defined(PTHREAD_MUTEX_ERRORCHECK) (Ben Noordhuis) + +* unix, windows: return error codes directly (Ben Noordhuis) + + +2013.07.10, Version 0.10.12 (Stable), 58a46221bba726746887a661a9f36fe9ff204209 + +Changes since version 0.10.11: + +* linux: add support for MIPS (Andrei Sedoi) + +* windows: uv_spawn shouldn't reject reparse points (Bert Belder) + +* windows: use WSAGetLastError(), not errno (Ben Noordhuis) + +* build: darwin: disable -fstrict-aliasing warnings (Ben Noordhuis) + +* build: `all` now builds static and dynamic lib (Ben Noordhuis) + +* unix: fix build when !defined(PTHREAD_MUTEX_ERRORCHECK) (Ben Noordhuis) + + +2013.06.27, Version 0.11.5 (Unstable), e3c63ff1627a14e96f54c1c62b0d68b446d8425b + +Changes since version 0.11.4: + +* build: remove CSTDFLAG, use only CFLAGS (Ben Noordhuis) + +* unix: support for android builds (Linus Mårtensson) + +* unix: avoid extra read, short-circuit on POLLHUP (Ben Noordhuis) + +* uv: support android libuv standalone build (Linus Mårtensson) + +* src: make queue.h c++ compatible (Ben Noordhuis) + +* unix: s/ngx-queue.h/queue.h/ in checksparse.sh (Ben Noordhuis) + +* unix: unconditionally stop handle on close (Ben Noordhuis) + +* freebsd: don't enable dtrace if it's not available (Brian White) + +* build: make HAVE_DTRACE=0 should disable dtrace (Timothy J. Fontaine) + +* unix: remove overzealous assert (Ben Noordhuis) + +* unix: remove unused function uv_fatal_error() (Ben Noordhuis) + +* unix, windows: clean up uv_thread_create() (Ben Noordhuis) + +* queue: fix pointer truncation on LLP64 platforms (Bert Belder) + +* build: set OS=="android" for android builds (Linus Mårtensson) + +* windows: don't use uppercase in include filename (Ben Noordhuis) + +* stream: add an API to make streams do blocking writes (Henry Rawas) + +* windows: use WSAGetLastError(), not errno (Ben Noordhuis) + + +2013.06.13, Version 0.10.11 (Stable), c3b75406a66a10222a589cb173e8f469e9665c7e + +Changes since version 0.10.10: + +* unix: unconditionally stop handle on close (Ben Noordhuis) + +* freebsd: don't enable dtrace if it's not available (Brian White) + +* build: make HAVE_DTRACE=0 should disable dtrace (Timothy J. Fontaine) + +* unix: remove overzealous assert (Ben Noordhuis) + +* unix: clear UV_STREAM_SHUTTING after shutdown() (Ben Noordhuis) + +* unix: fix busy loop, write if POLLERR or POLLHUP (Ben Noordhuis) + + +2013.06.05, Version 0.10.10 (Stable), 0d95a88bd35fce93863c57a460be613aea34d2c5 + +Changes since version 0.10.9: + +* include: document uv_update_time() and uv_now() (Ben Noordhuis) + +* linux: fix cpu model parsing on newer arm kernels (Ben Noordhuis) + +* linux: fix a memory leak in uv_cpu_info() error path (Ben Noordhuis) + +* linux: don't ignore out-of-memory errors in uv_cpu_info() (Ben Noordhuis) + +* unix, windows: move uv_now() to uv-common.c (Ben Noordhuis) + +* test: fix a compilation problem in test-osx-select.c that was caused by the + use of c-style comments (Bert Belder) + +* darwin: use uv_fs_sendfile() use the sendfile api correctly (Wynn Wilkes) + + +2013.05.30, Version 0.11.4 (Unstable), e43e5b3d954a0989db5588aa110e1fe4fe6e0219 + +Changes since version 0.11.3: + +* windows: make uv_spawn not fail when the libuv embedding application is run + under external job control (Bert Belder) + +* darwin: assume CFRunLoopStop() isn't thread-safe, fixing a race condition + when stopping the 'stdin select hack' thread (Fedor Indutny) + +* win: fix UV_EALREADY not being reported correctly to the libuv user in some + cases (Bert Belder) + +* darwin: make the uv__cf_loop_runner and uv__cf_loop_cb functions static (Ben + Noordhuis) + +* darwin: task_info() cannot fail (Ben Noordhuis) + +* unix: add error mapping for ENETDOWN (Ben Noordhuis) + +* unix: implicitly signal write errors to the libuv user (Ben Noordhuis) + +* unix: fix assertion error on signal pipe overflow (Bert Belder) + +* unix: turn off POLLOUT after stream connect (Ben Noordhuis) + +* unix: fix stream refcounting buglet (Ben Noordhuis) + +* unix: remove assert statements that are no longer correct (Ben Noordhuis) + +* unix: appease warning about non-standard `inline` (Sean Silva) + +* unix: add uv__is_closing() macro (Ben Noordhuis) + +* unix: stop stream POLLOUT watcher on write error (Ben Noordhuis) + +* include: document uv_update_time() and uv_now() (Ben Noordhuis) + +* linux: fix cpu model parsing on newer arm kernels (Ben Noordhuis) + +* linux: fix a memory leak in uv_cpu_info() error path (Ben Noordhuis) + +* linux: don't ignore out-of-memory errors in uv_cpu_info() (Ben Noordhuis) + +* unix, windows: move uv_now() to uv-common.c (Ben Noordhuis) + +* test: fix a compilation problem in test-osx-select.c that was caused by the + use of c-style comments (Bert Belder) + +* darwin: use uv_fs_sendfile() use the sendfile api correctly (Wynn Wilkes) + +* windows: call idle handles on every loop iteration, something the unix + implementation already did (Bert Belder) + +* test: update the idle-starvation test to verify that idle handles are called + in every loop iteration (Bert Belder) + +* unix, windows: ensure that uv_run() in RUN_ONCE mode calls timers that expire + after blocking (Ben Noordhuis) + + +2013.05.29, Version 0.10.9 (Stable), a195f9ace23d92345baf57582678bfc3017e6632 + +Changes since version 0.10.8: + +* unix: fix stream refcounting buglet (Ben Noordhuis) + +* unix: remove erroneous asserts (Ben Noordhuis) + +* unix: add uv__is_closing() macro (Ben Noordhuis) + +* unix: stop stream POLLOUT watcher on write error (Ben Noordhuis) + + +2013.05.25, Version 0.10.8 (Stable), 0f39be12926fe2d8766a9f025797a473003e6504 + +Changes since version 0.10.7: + +* windows: make uv_spawn not fail under job control (Bert Belder) + +* darwin: assume CFRunLoopStop() isn't thread-safe (Fedor Indutny) + +* win: fix UV_EALREADY incorrectly set (Bert Belder) + +* darwin: make two uv__cf_*() functions static (Ben Noordhuis) + +* darwin: task_info() cannot fail (Ben Noordhuis) + +* unix: add mapping for ENETDOWN (Ben Noordhuis) + +* unix: implicitly signal write errors to libuv user (Ben Noordhuis) + +* unix: fix assert on signal pipe overflow (Bert Belder) + +* unix: turn off POLLOUT after stream connect (Ben Noordhuis) + + +2013.05.16, Version 0.11.3 (Unstable), 0a48c05b5988aea84c605751900926fa25443b34 + +Changes since version 0.11.2: + +* unix: clean up uv_accept() (Ben Noordhuis) + +* unix: remove errno preserving code (Ben Noordhuis) + +* darwin: fix ios build, don't require ApplicationServices (Ben Noordhuis) + +* windows: kill child processes when the parent dies (Bert Belder) + +* build: set soname in shared library (Ben Noordhuis) + +* build: make `make test` link against .a again (Ben Noordhuis) + +* build: only set soname on shared object builds (Timothy J. Fontaine) + +* build: convert predefined $PLATFORM to lower case (Elliot Saba) + +* test: fix process_title failing on linux (Miroslav Bajtoš) + +* test, sunos: disable process_title test (Miroslav Bajtoš) + +* test: add error logging to tty unit test (Miroslav Bajtoš) + + +2013.05.15, Version 0.10.7 (Stable), 028baaf0846b686a81e992cb2f2f5a9b8e841fcf + +Changes since version 0.10.6: + +* windows: kill child processes when the parent dies (Bert Belder) + + +2013.05.15, Version 0.10.6 (Stable), 11e6613e6260d95c8cf11bf89a2759c24649319a + +Changes since version 0.10.5: + +* stream: fix osx select hack (Fedor Indutny) + +* stream: fix small nit in select hack, add test (Fedor Indutny) + +* build: link with libkvm on openbsd (Ben Noordhuis) + +* stream: use harder sync restrictions for osx-hack (Fedor Indutny) + +* unix: fix EMFILE error handling (Ben Noordhuis) + +* darwin: fix unnecessary include headers (Daisuke Murase) + +* darwin: rename darwin-getproctitle.m (Ben Noordhuis) + +* build: convert predefined $PLATFORM to lower case (Elliot Saba) + +* build: set soname in shared library (Ben Noordhuis) + +* build: make `make test` link against .a again (Ben Noordhuis) + +* darwin: fix ios build, don't require ApplicationServices (Ben Noordhuis) + +* build: only set soname on shared object builds (Timothy J. Fontaine) + + +2013.05.11, Version 0.11.2 (Unstable), 3fba0bf65f091b91a9760530c05c6339c658d88b + +Changes since version 0.11.1: + +* darwin: look up file path with F_GETPATH (Ben Noordhuis) + +* unix, windows: add uv_has_ref() function (Saúl Ibarra Corretgé) + +* build: avoid double / in paths for dtrace (Timothy J. Fontaine) + +* unix: remove src/unix/cygwin.c (Ben Noordhuis) + +* windows: deal with the fact that GetTickCount might lag (Bert Belder) + +* unix: silence STATIC_ASSERT compiler warnings (Ben Noordhuis) + +* linux: don't use fopen() in uv_resident_set_memory() (Ben Noordhuis) + + +2013.04.24, Version 0.10.5 (Stable), 6595a7732c52eb4f8e57c88655f72997a8567a67 + +Changes since version 0.10.4: + +* unix: silence STATIC_ASSERT compiler warnings (Ben Noordhuis) + +* windows: make timers handle large timeouts (Miroslav Bajtoš) + +* windows: remove superfluous assert statement (Bert Belder) + +* unix: silence STATIC_ASSERT compiler warnings (Ben Noordhuis) + +* linux: don't use fopen() in uv_resident_set_memory() (Ben Noordhuis) + + +2013.04.12, Version 0.10.4 (Stable), 85827e26403ac6dfa331af8ec9916ea7e27bd833 + +Changes since version 0.10.3: + +* include: update uv_backend_fd() documentation (Ben Noordhuis) + +* unix: include uv.h in src/version.c (Ben Noordhuis) + +* unix: don't write more than IOV_MAX iovecs (Fedor Indutny) + +* mingw-w64: don't call _set_invalid_parameter_handler (Nils Maier) + +* build: gyp disable thin archives (Timothy J. Fontaine) + +* sunos: re-export entire library when static (Timothy J. Fontaine) + +* unix: dtrace probes for tick-start and tick-stop (Timothy J. Fontaine) + +* windows: fix memory leak in fs__sendfile (Shannen Saez) + +* windows: remove double initialization in uv_tty_init (Shannen Saez) + +* build: fix dtrace-enabled out of tree build (Ben Noordhuis) + +* build: squelch -Wdollar-in-identifier-extension warnings (Ben Noordhuis) + +* inet: snprintf returns int, not size_t (Brian White) + +* win: refactor uv_cpu_info (Bert Belder) + +* build: add support for Visual Studio 2012 (Nicholas Vavilov) + +* build: -Wno-dollar-in-identifier-extension is clang only (Ben Noordhuis) + + +2013.04.11, Version 0.11.1 (Unstable), 5c10e82ae0bc99eff86d4b9baff1f1aa0bf84c0a + +This is the first versioned release from the current unstable libuv branch. + +Changes since Node.js v0.11.0: + +* all platforms: nanosecond resolution support for uv_fs_[fl]stat (Timothy J. + Fontaine) + +* all platforms: add netmask to uv_interface_address (Ben Kelly) + +* unix: make sure the `status` parameter passed to the `uv_getaddrinfo` is 0 or + -1 (Ben Noordhuis) + +* unix: limit the number of iovecs written in a single `writev` syscall to + IOV_MAX (Fedor Indutny) + +* unix: add dtrace probes for tick-start and tick-stop (Timothy J. Fontaine) + +* mingw-w64: don't call _set_invalid_parameter_handler (Nils Maier) + +* windows: fix memory leak in fs__sendfile (Shannen Saez) + +* windows: fix edge case bugs in uv_cpu_info (Bert Belder) + +* include: no longer ship with / include ngx-queue.h (Ben Noordhuis) + +* include: remove UV_VERSION_* macros from uv.h (Ben Noordhuis) + +* documentation updates (Kristian Evensen, Ben Kelly, Ben Noordhuis) + +* build: fix dtrace-enabled builds (Ben Noordhuis, Timothy J. Fontaine) + +* build: gyp disable thin archives (Timothy J. Fontaine) + +* build: add support for Visual Studio 2012 (Nicholas Vavilov) + + +2013.03.28, Version 0.10.3 (Stable), 31ebe23973dd98fd8a24c042b606f37a794e99d0 + +Changes since version 0.10.2: + +* include: remove extraneous const from uv_version() (Ben Noordhuis) + +* doc: update README, replace `OS` by `PLATFORM` (Ben Noordhuis) + +* build: simplify .buildstamp rule (Ben Noordhuis) + +* build: disable -Wstrict-aliasing on darwin (Ben Noordhuis) + +* darwin: don't select(&exceptfds) in fallback path (Ben Noordhuis) + +* unix: don't clear flags after closing UDP handle (Saúl Ibarra Corretgé) + + +2013.03.25, Version 0.10.2 (Stable), 0f36a00568f3e7608f97f6c6cdb081f4800a50c9 + +This is the first officially versioned release of libuv. Starting now +libuv will make releases independently of Node.js. + +Changes since Node.js v0.10.0: + +* test: add tap output for windows (Timothy J. Fontaine) + +* unix: fix uv_tcp_simultaneous_accepts() logic (Ben Noordhuis) + +* include: bump UV_VERSION_MINOR (Ben Noordhuis) + +* unix: improve uv_guess_handle() implementation (Ben Noordhuis) + +* stream: run try_select only for pipes and ttys (Fedor Indutny) + +Changes since Node.js v0.10.1: + +* build: rename OS to PLATFORM (Ben Noordhuis) + +* unix: make uv_timer_init() initialize repeat (Brian Mazza) + +* unix: make timers handle large timeouts (Ben Noordhuis) + +* build: add OBJC makefile var (Ben Noordhuis) + +* Add `uv_version()` and `uv_version_string()` APIs (Bert Belder) diff --git a/3rdparty/libuv/LICENSE b/3rdparty/libuv/LICENSE new file mode 100644 index 00000000000..4d411670e3f --- /dev/null +++ b/3rdparty/libuv/LICENSE @@ -0,0 +1,46 @@ +libuv is part of the Node project: http://nodejs.org/ +libuv may be distributed alone under Node's license: + +==== + +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + +==== + +This license applies to all parts of libuv that are not externally +maintained libraries. + +The externally maintained libraries used by libuv are: + + - tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license. + + - inet_pton and inet_ntop implementations, contained in src/inet.c, are + copyright the Internet Systems Consortium, Inc., and licensed under the ISC + license. + + - stdint-msvc2008.h (from msinttypes), copyright Alexander Chemeris. Three + clause BSD license. + + - pthread-fixes.h, pthread-fixes.c, copyright Google Inc. and Sony Mobile + Communications AB. Three clause BSD license. + + - android-ifaddrs.h, android-ifaddrs.c, copyright Berkeley Software Design + Inc, Kenneth MacKay and Emergya (Cloud4all, FP7/2007-2013, grant agreement + n° 289016). Three clause BSD license. diff --git a/3rdparty/libuv/MAINTAINERS.md b/3rdparty/libuv/MAINTAINERS.md new file mode 100644 index 00000000000..4db2f5130c0 --- /dev/null +++ b/3rdparty/libuv/MAINTAINERS.md @@ -0,0 +1,36 @@ + +# Project Maintainers + +libuv is currently managed by the following individuals: + +* **Ben Noordhuis** ([@bnoordhuis](https://github.com/bnoordhuis)) + - GPG key: D77B 1E34 243F BAF0 5F8E 9CC3 4F55 C8C8 46AB 89B9 (pubkey-bnoordhuis) +* **Bert Belder** ([@piscisaureus](https://github.com/piscisaureus)) +* **Fedor Indutny** ([@indutny](https://github.com/indutny)) + - GPG key: AF2E EA41 EC34 47BF DD86 FED9 D706 3CCE 19B7 E890 (pubkey-indutny) +* **Saúl Ibarra Corretgé** ([@saghul](https://github.com/saghul)) + - GPG key: FDF5 1936 4458 319F A823 3DC9 410E 5553 AE9B C059 (pubkey-saghul) + +## Storing a maintainer key in Git + +It's quite handy to store a maintainer's signature as a git blob, and have +that object tagged and signed with such key. + +Export your public key: + + $ gpg --armor --export saghul@gmail.com > saghul.asc + +Store it as a blob on the repo: + + $ git hash-object -w saghul.asc + +The previous command returns a hash, copy it. For the sake of this explanation, +we'll assume it's 'abcd1234'. Storing the blob in git is not enough, it could +be garbage collected since nothing references it, so we'll create a tag for it: + + $ git tag -s pubkey-saghul abcd1234 + +Commit the changes and push: + + $ git push origin pubkey-saghul + diff --git a/3rdparty/libuv/Makefile.am b/3rdparty/libuv/Makefile.am new file mode 100644 index 00000000000..0ef781ff198 --- /dev/null +++ b/3rdparty/libuv/Makefile.am @@ -0,0 +1,344 @@ +# Copyright (c) 2013, Ben Noordhuis +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +ACLOCAL_AMFLAGS = -I m4 + +AM_CPPFLAGS = -I$(top_srcdir)/include \ + -I$(top_srcdir)/src + +include_HEADERS=include/uv.h include/uv-errno.h include/uv-threadpool.h include/uv-version.h + +CLEANFILES = + +lib_LTLIBRARIES = libuv.la +libuv_la_CFLAGS = @CFLAGS@ +libuv_la_LDFLAGS = -no-undefined -version-info 1:0:0 +libuv_la_SOURCES = src/fs-poll.c \ + src/heap-inl.h \ + src/inet.c \ + src/queue.h \ + src/threadpool.c \ + src/uv-common.c \ + src/uv-common.h \ + src/version.c + +if SUNOS +# Can't be turned into a CC_CHECK_CFLAGS in configure.ac, it makes compilers +# on other platforms complain that the argument is unused during compilation. +libuv_la_CFLAGS += -pthread +endif + +if WINNT + +include_HEADERS += include/uv-win.h include/tree.h +AM_CPPFLAGS += -I$(top_srcdir)/src/win \ + -DWIN32_LEAN_AND_MEAN \ + -D_WIN32_WINNT=0x0600 +LIBS += -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv +libuv_la_SOURCES += src/win/async.c \ + src/win/atomicops-inl.h \ + src/win/core.c \ + src/win/dl.c \ + src/win/error.c \ + src/win/fs-event.c \ + src/win/fs.c \ + src/win/getaddrinfo.c \ + src/win/getnameinfo.c \ + src/win/handle.c \ + src/win/handle-inl.h \ + src/win/internal.h \ + src/win/loop-watcher.c \ + src/win/pipe.c \ + src/win/poll.c \ + src/win/process-stdio.c \ + src/win/process.c \ + src/win/req.c \ + src/win/req-inl.h \ + src/win/signal.c \ + src/win/stream.c \ + src/win/stream-inl.h \ + src/win/tcp.c \ + src/win/thread.c \ + src/win/timer.c \ + src/win/tty.c \ + src/win/udp.c \ + src/win/util.c \ + src/win/winapi.c \ + src/win/winapi.h \ + src/win/winsock.c \ + src/win/winsock.h + +else # WINNT + +include_HEADERS += include/uv-unix.h +AM_CPPFLAGS += -I$(top_srcdir)/src/unix +libuv_la_SOURCES += src/unix/async.c \ + src/unix/atomic-ops.h \ + src/unix/core.c \ + src/unix/dl.c \ + src/unix/fs.c \ + src/unix/getaddrinfo.c \ + src/unix/getnameinfo.c \ + src/unix/internal.h \ + src/unix/loop-watcher.c \ + src/unix/loop.c \ + src/unix/pipe.c \ + src/unix/poll.c \ + src/unix/process.c \ + src/unix/signal.c \ + src/unix/spinlock.h \ + src/unix/stream.c \ + src/unix/tcp.c \ + src/unix/thread.c \ + src/unix/timer.c \ + src/unix/tty.c \ + src/unix/udp.c + +endif # WINNT + +EXTRA_DIST = test/fixtures/empty_file \ + test/fixtures/load_error.node \ + include \ + test \ + docs \ + img \ + samples \ + android-configure \ + CONTRIBUTING.md \ + LICENSE \ + README.md \ + checksparse.sh \ + vcbuild.bat \ + Makefile.mingw \ + common.gypi \ + gyp_uv.py \ + uv.gyp + + + +TESTS = test/run-tests +check_PROGRAMS = test/run-tests +test_run_tests_CFLAGS = +test_run_tests_SOURCES = test/blackhole-server.c \ + test/dns-server.c \ + test/echo-server.c \ + test/run-tests.c \ + test/runner.c \ + test/runner.h \ + test/task.h \ + test/test-active.c \ + test/test-async.c \ + test/test-async-null-cb.c \ + test/test-barrier.c \ + test/test-callback-order.c \ + test/test-callback-stack.c \ + test/test-close-fd.c \ + test/test-close-order.c \ + test/test-condvar.c \ + test/test-connection-fail.c \ + test/test-cwd-and-chdir.c \ + test/test-default-loop-close.c \ + test/test-delayed-accept.c \ + test/test-dlerror.c \ + test/test-embed.c \ + test/test-emfile.c \ + test/test-error.c \ + test/test-fail-always.c \ + test/test-fs-event.c \ + test/test-fs-poll.c \ + test/test-fs.c \ + test/test-get-currentexe.c \ + test/test-get-loadavg.c \ + test/test-get-memory.c \ + test/test-getaddrinfo.c \ + test/test-getnameinfo.c \ + test/test-getsockname.c \ + test/test-handle-fileno.c \ + test/test-homedir.c \ + test/test-hrtime.c \ + test/test-idle.c \ + test/test-ip4-addr.c \ + test/test-ip6-addr.c \ + test/test-ipc-send-recv.c \ + test/test-ipc.c \ + test/test-list.h \ + test/test-loop-handles.c \ + test/test-loop-alive.c \ + test/test-loop-close.c \ + test/test-loop-stop.c \ + test/test-loop-time.c \ + test/test-loop-configure.c \ + test/test-multiple-listen.c \ + test/test-mutexes.c \ + test/test-osx-select.c \ + test/test-pass-always.c \ + test/test-ping-pong.c \ + test/test-pipe-bind-error.c \ + test/test-pipe-connect-error.c \ + test/test-pipe-connect-multiple.c \ + test/test-pipe-connect-prepare.c \ + test/test-pipe-getsockname.c \ + test/test-pipe-pending-instances.c \ + test/test-pipe-sendmsg.c \ + test/test-pipe-server-close.c \ + test/test-pipe-close-stdout-read-stdin.c \ + test/test-pipe-set-non-blocking.c \ + test/test-platform-output.c \ + test/test-poll-close.c \ + test/test-poll-close-doesnt-corrupt-stack.c \ + test/test-poll-closesocket.c \ + test/test-poll.c \ + test/test-process-title.c \ + test/test-queue-foreach-delete.c \ + test/test-ref.c \ + test/test-run-nowait.c \ + test/test-run-once.c \ + test/test-semaphore.c \ + test/test-shutdown-close.c \ + test/test-shutdown-eof.c \ + test/test-shutdown-twice.c \ + test/test-signal-multiple-loops.c \ + test/test-signal.c \ + test/test-socket-buffer-size.c \ + test/test-spawn.c \ + test/test-stdio-over-pipes.c \ + test/test-tcp-bind-error.c \ + test/test-tcp-bind6-error.c \ + test/test-tcp-close-accept.c \ + test/test-tcp-close-while-connecting.c \ + test/test-tcp-close.c \ + test/test-tcp-create-socket-early.c \ + test/test-tcp-connect-error-after-write.c \ + test/test-tcp-connect-error.c \ + test/test-tcp-connect-timeout.c \ + test/test-tcp-connect6-error.c \ + test/test-tcp-flags.c \ + test/test-tcp-open.c \ + test/test-tcp-read-stop.c \ + test/test-tcp-shutdown-after-write.c \ + test/test-tcp-unexpected-read.c \ + test/test-tcp-oob.c \ + test/test-tcp-write-to-half-open-connection.c \ + test/test-tcp-write-after-connect.c \ + test/test-tcp-writealot.c \ + test/test-tcp-write-fail.c \ + test/test-tcp-try-write.c \ + test/test-tcp-write-queue-order.c \ + test/test-thread-equal.c \ + test/test-thread.c \ + test/test-threadpool-cancel.c \ + test/test-threadpool.c \ + test/test-timer-again.c \ + test/test-timer-from-check.c \ + test/test-timer.c \ + test/test-tty.c \ + test/test-udp-bind.c \ + test/test-udp-create-socket-early.c \ + test/test-udp-dgram-too-big.c \ + test/test-udp-ipv6.c \ + test/test-udp-multicast-interface.c \ + test/test-udp-multicast-interface6.c \ + test/test-udp-multicast-join.c \ + test/test-udp-multicast-join6.c \ + test/test-udp-multicast-ttl.c \ + test/test-udp-open.c \ + test/test-udp-options.c \ + test/test-udp-send-and-recv.c \ + test/test-udp-send-immediate.c \ + test/test-udp-send-unreachable.c \ + test/test-udp-try-send.c \ + test/test-walk-handles.c \ + test/test-watcher-cross-stop.c +test_run_tests_LDADD = libuv.la + +if WINNT +test_run_tests_SOURCES += test/runner-win.c \ + test/runner-win.h +else +test_run_tests_SOURCES += test/runner-unix.c \ + test/runner-unix.h +endif + +if AIX +test_run_tests_CFLAGS += -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT +endif + +if SUNOS +test_run_tests_CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 +endif + + +if AIX +libuv_la_CFLAGS += -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT +include_HEADERS += include/uv-aix.h +libuv_la_SOURCES += src/unix/aix.c +endif + +if ANDROID +include_HEADERS += include/android-ifaddrs.h \ + include/pthread-fixes.h +libuv_la_SOURCES += src/unix/android-ifaddrs.c \ + src/unix/pthread-fixes.c +endif + +if DARWIN +include_HEADERS += include/uv-darwin.h +libuv_la_CFLAGS += -D_DARWIN_USE_64_BIT_INODE=1 +libuv_la_CFLAGS += -D_DARWIN_UNLIMITED_SELECT=1 +libuv_la_SOURCES += src/unix/darwin.c \ + src/unix/darwin-proctitle.c \ + src/unix/fsevents.c \ + src/unix/kqueue.c \ + src/unix/proctitle.c +endif + +if DRAGONFLY +include_HEADERS += include/uv-bsd.h +endif + +if FREEBSD +include_HEADERS += include/uv-bsd.h +libuv_la_SOURCES += src/unix/freebsd.c src/unix/kqueue.c +endif + +if LINUX +include_HEADERS += include/uv-linux.h +libuv_la_CFLAGS += -D_GNU_SOURCE +libuv_la_SOURCES += src/unix/linux-core.c \ + src/unix/linux-inotify.c \ + src/unix/linux-syscalls.c \ + src/unix/linux-syscalls.h \ + src/unix/proctitle.c +endif + +if NETBSD +include_HEADERS += include/uv-bsd.h +libuv_la_SOURCES += src/unix/kqueue.c src/unix/netbsd.c +endif + +if OPENBSD +include_HEADERS += include/uv-bsd.h +libuv_la_SOURCES += src/unix/kqueue.c src/unix/openbsd.c +endif + +if SUNOS +include_HEADERS += include/uv-sunos.h +libuv_la_CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 +libuv_la_SOURCES += src/unix/sunos.c +endif + +if HAVE_PKG_CONFIG +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = @PACKAGE_NAME@.pc +endif diff --git a/3rdparty/libuv/Makefile.mingw b/3rdparty/libuv/Makefile.mingw new file mode 100644 index 00000000000..156f15dab15 --- /dev/null +++ b/3rdparty/libuv/Makefile.mingw @@ -0,0 +1,84 @@ +# Copyright (c) 2013, Ben Noordhuis +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +CC ?= gcc + +CFLAGS += -Wall \ + -Wextra \ + -Wno-unused-parameter \ + -Iinclude \ + -Isrc \ + -Isrc/win \ + -DWIN32_LEAN_AND_MEAN \ + -D_WIN32_WINNT=0x0600 + +INCLUDES = include/stdint-msvc2008.h \ + include/tree.h \ + include/uv-errno.h \ + include/uv-threadpool.h \ + include/uv-version.h \ + include/uv-win.h \ + include/uv.h \ + src/heap-inl.h \ + src/queue.h \ + src/uv-common.h \ + src/win/atomicops-inl.h \ + src/win/handle-inl.h \ + src/win/internal.h \ + src/win/req-inl.h \ + src/win/stream-inl.h \ + src/win/winapi.h \ + src/win/winsock.h + +OBJS = src/fs-poll.o \ + src/inet.o \ + src/threadpool.o \ + src/uv-common.o \ + src/version.o \ + src/win/async.o \ + src/win/core.o \ + src/win/dl.o \ + src/win/error.o \ + src/win/fs-event.o \ + src/win/fs.o \ + src/win/getaddrinfo.o \ + src/win/getnameinfo.o \ + src/win/handle.o \ + src/win/loop-watcher.o \ + src/win/pipe.o \ + src/win/poll.o \ + src/win/process-stdio.o \ + src/win/process.o \ + src/win/req.o \ + src/win/signal.o \ + src/win/stream.o \ + src/win/tcp.o \ + src/win/thread.o \ + src/win/timer.o \ + src/win/tty.o \ + src/win/udp.o \ + src/win/util.o \ + src/win/winapi.o \ + src/win/winsock.o + +all: libuv.a + +clean: + -$(RM) $(OBJS) libuv.a + +libuv.a: $(OBJS) + $(AR) crs $@ $^ + +$(OBJS): %.o : %.c $(INCLUDES) + $(CC) $(CFLAGS) -c -o $@ $< diff --git a/3rdparty/libuv/README.md b/3rdparty/libuv/README.md new file mode 100644 index 00000000000..dfd24ba79d1 --- /dev/null +++ b/3rdparty/libuv/README.md @@ -0,0 +1,245 @@ +![libuv][libuv_banner] + +## Overview + +libuv is a multi-platform support library with a focus on asynchronous I/O. It +was primarily developed for use by [Node.js](http://nodejs.org), but it's also +used by [Luvit](http://luvit.io/), [Julia](http://julialang.org/), +[pyuv](https://github.com/saghul/pyuv), and [others](https://github.com/libuv/libuv/wiki/Projects-that-use-libuv). + +## Feature highlights + + * Full-featured event loop backed by epoll, kqueue, IOCP, event ports. + + * Asynchronous TCP and UDP sockets + + * Asynchronous DNS resolution + + * Asynchronous file and file system operations + + * File system events + + * ANSI escape code controlled TTY + + * IPC with socket sharing, using Unix domain sockets or named pipes (Windows) + + * Child processes + + * Thread pool + + * Signal handling + + * High resolution clock + + * Threading and synchronization primitives + +## Versioning + +Starting with version 1.0.0 libuv follows the [semantic versioning](http://semver.org/) +scheme. The API change and backwards compatibility rules are those indicated by +SemVer. libuv will keep a stable ABI across major releases. + +## Community + + * [Mailing list](http://groups.google.com/group/libuv) + * [IRC chatroom (#libuv@irc.freenode.org)](http://webchat.freenode.net?channels=libuv&uio=d4) + +## Documentation + +### Official API documentation + +Located in the docs/ subdirectory. It uses the [Sphinx](http://sphinx-doc.org/) +framework, which makes it possible to build the documentation in multiple +formats. + +Show different supported building options: + + $ make help + +Build documentation as HTML: + + $ make html + +Build documentation as man pages: + + $ make man + +Build documentation as ePub: + + $ make epub + +NOTE: Windows users need to use make.bat instead of plain 'make'. + +Documentation can be browsed online [here](http://docs.libuv.org). + +The [tests and benchmarks](https://github.com/libuv/libuv/tree/master/test) +also serve as API specification and usage examples. + +### Other resources + + * [An Introduction to libuv](http://nikhilm.github.com/uvbook/) + — An overview of libuv with tutorials. + * [LXJS 2012 talk](http://www.youtube.com/watch?v=nGn60vDSxQ4) + — High-level introductory talk about libuv. + * [libuv-dox](https://github.com/thlorenz/libuv-dox) + — Documenting types and methods of libuv, mostly by reading uv.h. + * [learnuv](https://github.com/thlorenz/learnuv) + — Learn uv for fun and profit, a self guided workshop to libuv. + +These resources are not handled by libuv maintainers and might be out of +date. Please verify it before opening new issues. + +## Downloading + +libuv can be downloaded either from the +[GitHub repository](https://github.com/libuv/libuv) +or from the [downloads site](http://dist.libuv.org/dist/). + +Starting with libuv 1.7.0, binaries for Windows are also provided. This is to +be considered EXPERIMENTAL. + +Before verifying the git tags or signature files, importing the relevant keys +is necessary. Key IDs are listed in the +[MAINTAINERS](https://github.com/libuv/libuv/blob/master/MAINTAINERS.md) +file, but are also available as git blob objects for easier use. + +Importing a key the usual way: + + $ gpg --keyserver pool.sks-keyservers.net \ + --recv-keys AE9BC059 + +Importing a key from a git blob object: + + $ git show pubkey-saghul | gpg --import + +### Verifying releases + +Git tags are signed with the developer's key, they can be verified as follows: + + $ git verify-tag v1.6.1 + +Starting with libuv 1.7.0, the tarballs stored in the +[downloads site](http://dist.libuv.org/dist/) are signed and an accompanying +signature file sit alongside each. Once both the release tarball and the +signature file are downloaded, the file can be verified as follows: + + $ gpg --verify libuv-1.7.0.tar.gz.sign + +## Build Instructions + +For GCC there are two build methods: via autotools or via [GYP][]. +GYP is a meta-build system which can generate MSVS, Makefile, and XCode +backends. It is best used for integration into other projects. + +To build with autotools: + + $ sh autogen.sh + $ ./configure + $ make + $ make check + $ make install + +### Windows + +First, [Python][] 2.6 or 2.7 must be installed as it is required by [GYP][]. +If python is not in your path, set the environment variable `PYTHON` to its +location. For example: `set PYTHON=C:\Python27\python.exe` + +To build with Visual Studio, launch a git shell (e.g. Cmd or PowerShell) +and run vcbuild.bat which will checkout the GYP code into build/gyp and +generate uv.sln as well as related project files. + +To have GYP generate build script for another system, checkout GYP into the +project tree manually: + + $ git clone https://chromium.googlesource.com/external/gyp.git build/gyp + +### Unix + +Run: + + $ ./gyp_uv.py -f make + $ make -C out + +Run `./gyp_uv.py -f make -Dtarget_arch=x32` to build [x32][] binaries. + +### OS X + +Run: + + $ ./gyp_uv.py -f xcode + $ xcodebuild -ARCHS="x86_64" -project uv.xcodeproj \ + -configuration Release -target All + +Using Homebrew: + + $ brew install --HEAD libuv + +Note to OS X users: + +Make sure that you specify the architecture you wish to build for in the +"ARCHS" flag. You can specify more than one by delimiting with a space +(e.g. "x86_64 i386"). + +### Android + +Run: + + $ source ./android-configure NDK_PATH gyp + $ make -C out + +Note for UNIX users: compile your project with `-D_LARGEFILE_SOURCE` and +`-D_FILE_OFFSET_BITS=64`. GYP builds take care of that automatically. + +### Using Ninja + +To use ninja for build on ninja supported platforms, run: + + $ ./gyp_uv.py -f ninja + $ ninja -C out/Debug #for debug build OR + $ ninja -C out/Release + + +### Running tests + +Run: + + $ ./gyp_uv.py -f make + $ make -C out + $ ./out/Debug/run-tests + +## Supported Platforms + +Microsoft Windows operating systems since Windows XP SP2. It can be built +with either Visual Studio or MinGW. Consider using +[Visual Studio Express 2010][] or later if you do not have a full Visual +Studio license. + +Linux using the GCC toolchain. + +OS X using the GCC or XCode toolchain. + +Solaris 121 and later using GCC toolchain. + +AIX 6 and later using GCC toolchain (see notes). + +### AIX Notes + +AIX support for filesystem events requires the non-default IBM `bos.ahafs` +package to be installed. This package provides the AIX Event Infrastructure +that is detected by `autoconf`. +[IBM documentation](http://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/) +describes the package in more detail. + +AIX support for filesystem events is not compiled when building with `gyp`. + +## Patches + +See the [guidelines for contributing][]. + +[node.js]: http://nodejs.org/ +[GYP]: http://code.google.com/p/gyp/ +[Python]: https://www.python.org/downloads/ +[Visual Studio Express 2010]: http://www.microsoft.com/visualstudio/eng/products/visual-studio-2010-express +[guidelines for contributing]: https://github.com/libuv/libuv/blob/master/CONTRIBUTING.md +[libuv_banner]: https://raw.githubusercontent.com/libuv/libuv/master/img/banner.png diff --git a/3rdparty/libuv/android-configure b/3rdparty/libuv/android-configure new file mode 100644 index 00000000000..e0b250fb634 --- /dev/null +++ b/3rdparty/libuv/android-configure @@ -0,0 +1,20 @@ +#!/bin/bash + +export TOOLCHAIN=$PWD/android-toolchain +mkdir -p $TOOLCHAIN +$1/build/tools/make-standalone-toolchain.sh \ + --toolchain=arm-linux-androideabi-4.8 \ + --arch=arm \ + --install-dir=$TOOLCHAIN \ + --platform=android-21 +export PATH=$TOOLCHAIN/bin:$PATH +export AR=arm-linux-androideabi-ar +export CC=arm-linux-androideabi-gcc +export CXX=arm-linux-androideabi-g++ +export LINK=arm-linux-androideabi-g++ +export PLATFORM=android + +if [ $2 -a $2 == 'gyp' ] + then + ./gyp_uv.py -Dtarget_arch=arm -DOS=android -f make-android +fi diff --git a/3rdparty/libuv/appveyor.yml b/3rdparty/libuv/appveyor.yml new file mode 100644 index 00000000000..9aa63c5a5d2 --- /dev/null +++ b/3rdparty/libuv/appveyor.yml @@ -0,0 +1,36 @@ +version: v1.8.0.build{build} + +install: + - cinst -y nsis + +matrix: + fast_finish: true + allow_failures: + - platform: x86 + configuration: Release + - platform: x64 + configuration: Release + +platform: + - x86 + - x64 + +configuration: + - Release + +build_script: + # Fixed tag version number if using a tag. + - cmd: if "%APPVEYOR_REPO_TAG%" == "true" set APPVEYOR_BUILD_VERSION=%APPVEYOR_REPO_TAG_NAME% + # vcbuild overwrites the platform variable. + - cmd: set ARCH=%platform% + - cmd: vcbuild.bat release %ARCH% shared + +after_build: + - '"%PROGRAMFILES(x86)%\NSIS\makensis" /DVERSION=%APPVEYOR_BUILD_VERSION% /DARCH=%ARCH% libuv.nsi' + +artifacts: + - name: Installer + path: 'libuv-*.exe' + +cache: + - C:\projects\libuv\build\gyp diff --git a/3rdparty/libuv/autogen.sh b/3rdparty/libuv/autogen.sh new file mode 100644 index 00000000000..0574778a4e1 --- /dev/null +++ b/3rdparty/libuv/autogen.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +# Copyright (c) 2013, Ben Noordhuis +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +cd `dirname "$0"` + +if [ "$LIBTOOLIZE" = "" ] && [ "`uname`" = "Darwin" ]; then + LIBTOOLIZE=glibtoolize +fi + +ACLOCAL=${ACLOCAL:-aclocal} +AUTOCONF=${AUTOCONF:-autoconf} +AUTOMAKE=${AUTOMAKE:-automake} +LIBTOOLIZE=${LIBTOOLIZE:-libtoolize} + +automake_version=`"$AUTOMAKE" --version | head -n 1 | sed 's/[^.0-9]//g'` +automake_version_major=`echo "$automake_version" | cut -d. -f1` +automake_version_minor=`echo "$automake_version" | cut -d. -f2` + +UV_EXTRA_AUTOMAKE_FLAGS= +if test "$automake_version_major" -gt 1 || \ + test "$automake_version_major" -eq 1 && \ + test "$automake_version_minor" -gt 11; then + # serial-tests is available in v1.12 and newer. + UV_EXTRA_AUTOMAKE_FLAGS="$UV_EXTRA_AUTOMAKE_FLAGS serial-tests" +fi +echo "m4_define([UV_EXTRA_AUTOMAKE_FLAGS], [$UV_EXTRA_AUTOMAKE_FLAGS])" \ + > m4/libuv-extra-automake-flags.m4 + +set -ex +"$LIBTOOLIZE" +"$ACLOCAL" -I m4 +"$AUTOCONF" +"$AUTOMAKE" --add-missing --copy diff --git a/3rdparty/libuv/checksparse.sh b/3rdparty/libuv/checksparse.sh new file mode 100644 index 00000000000..619cf6f8b67 --- /dev/null +++ b/3rdparty/libuv/checksparse.sh @@ -0,0 +1,234 @@ +#!/bin/sh + +# Copyright (c) 2013, Ben Noordhuis +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +SPARSE=${SPARSE:-sparse} + +SPARSE_FLAGS=${SPARSE_FLAGS:-" +-D__POSIX__ +-Wsparse-all +-Wno-do-while +-Wno-transparent-union +-Iinclude +-Isrc +"} + +SOURCES=" +include/tree.h +include/uv-unix.h +include/uv.h +src/fs-poll.c +src/inet.c +src/queue.h +src/unix/async.c +src/unix/core.c +src/unix/dl.c +src/unix/fs.c +src/unix/getaddrinfo.c +src/unix/internal.h +src/unix/loop-watcher.c +src/unix/loop.c +src/unix/pipe.c +src/unix/poll.c +src/unix/process.c +src/unix/signal.c +src/unix/stream.c +src/unix/tcp.c +src/unix/thread.c +src/unix/threadpool.c +src/unix/timer.c +src/unix/tty.c +src/unix/udp.c +src/uv-common.c +src/uv-common.h +" + +TESTS=" +test/benchmark-async-pummel.c +test/benchmark-async.c +test/benchmark-fs-stat.c +test/benchmark-getaddrinfo.c +test/benchmark-loop-count.c +test/benchmark-million-async.c +test/benchmark-million-timers.c +test/benchmark-multi-accept.c +test/benchmark-ping-pongs.c +test/benchmark-pound.c +test/benchmark-pump.c +test/benchmark-sizes.c +test/benchmark-spawn.c +test/benchmark-tcp-write-batch.c +test/benchmark-thread.c +test/benchmark-udp-pummel.c +test/blackhole-server.c +test/dns-server.c +test/echo-server.c +test/run-benchmarks.c +test/run-tests.c +test/runner-unix.c +test/runner-unix.h +test/runner.c +test/runner.h +test/task.h +test/test-active.c +test/test-async.c +test/test-barrier.c +test/test-callback-order.c +test/test-callback-stack.c +test/test-condvar.c +test/test-connection-fail.c +test/test-cwd-and-chdir.c +test/test-delayed-accept.c +test/test-dlerror.c +test/test-embed.c +test/test-error.c +test/test-fail-always.c +test/test-fs-event.c +test/test-fs-poll.c +test/test-fs.c +test/test-get-currentexe.c +test/test-get-loadavg.c +test/test-get-memory.c +test/test-getaddrinfo.c +test/test-getsockname.c +test/test-homedir.c +test/test-hrtime.c +test/test-idle.c +test/test-ip6-addr.c +test/test-ipc-send-recv.c +test/test-ipc.c +test/test-loop-handles.c +test/test-multiple-listen.c +test/test-mutexes.c +test/test-pass-always.c +test/test-ping-pong.c +test/test-pipe-bind-error.c +test/test-pipe-connect-error.c +test/test-pipe-sendmsg.c +test/test-pipe-server-close.c +test/test-platform-output.c +test/test-poll-close.c +test/test-poll.c +test/test-process-title.c +test/test-ref.c +test/test-run-nowait.c +test/test-run-once.c +test/test-semaphore.c +test/test-shutdown-close.c +test/test-shutdown-eof.c +test/test-signal-multiple-loops.c +test/test-signal.c +test/test-spawn.c +test/test-stdio-over-pipes.c +test/test-tcp-bind-error.c +test/test-tcp-bind6-error.c +test/test-tcp-close-while-connecting.c +test/test-tcp-close-accept.c +test/test-tcp-close.c +test/test-tcp-connect-error-after-write.c +test/test-tcp-connect-error.c +test/test-tcp-connect-timeout.c +test/test-tcp-connect6-error.c +test/test-tcp-flags.c +test/test-tcp-open.c +test/test-tcp-read-stop.c +test/test-tcp-shutdown-after-write.c +test/test-tcp-unexpected-read.c +test/test-tcp-oob.c +test/test-tcp-write-error.c +test/test-tcp-write-to-half-open-connection.c +test/test-tcp-writealot.c +test/test-thread.c +test/test-threadpool-cancel.c +test/test-threadpool.c +test/test-timer-again.c +test/test-timer.c +test/test-tty.c +test/test-udp-dgram-too-big.c +test/test-udp-ipv6.c +test/test-udp-multicast-join.c +test/test-udp-multicast-ttl.c +test/test-udp-open.c +test/test-udp-options.c +test/test-udp-send-and-recv.c +test/test-walk-handles.c +test/test-watcher-cross-stop.c +" + +case `uname -s` in +AIX) + SPARSE_FLAGS="$SPARSE_FLAGS -D_AIX=1" + SOURCES="$SOURCES + src/unix/aix.c" + ;; +Darwin) + SPARSE_FLAGS="$SPARSE_FLAGS -D__APPLE__=1" + SOURCES="$SOURCES + include/uv-bsd.h + src/unix/darwin.c + src/unix/kqueue.c + src/unix/fsevents.c" + ;; +DragonFly) + SPARSE_FLAGS="$SPARSE_FLAGS -D__DragonFly__=1" + SOURCES="$SOURCES + include/uv-bsd.h + src/unix/kqueue.c + src/unix/freebsd.c" + ;; +FreeBSD) + SPARSE_FLAGS="$SPARSE_FLAGS -D__FreeBSD__=1" + SOURCES="$SOURCES + include/uv-bsd.h + src/unix/kqueue.c + src/unix/freebsd.c" + ;; +Linux) + SPARSE_FLAGS="$SPARSE_FLAGS -D__linux__=1" + SOURCES="$SOURCES + include/uv-linux.h + src/unix/linux-inotify.c + src/unix/linux-core.c + src/unix/linux-syscalls.c + src/unix/linux-syscalls.h" + ;; +NetBSD) + SPARSE_FLAGS="$SPARSE_FLAGS -D__NetBSD__=1" + SOURCES="$SOURCES + include/uv-bsd.h + src/unix/kqueue.c + src/unix/netbsd.c" + ;; +OpenBSD) + SPARSE_FLAGS="$SPARSE_FLAGS -D__OpenBSD__=1" + SOURCES="$SOURCES + include/uv-bsd.h + src/unix/kqueue.c + src/unix/openbsd.c" + ;; +SunOS) + SPARSE_FLAGS="$SPARSE_FLAGS -D__sun=1" + SOURCES="$SOURCES + include/uv-sunos.h + src/unix/sunos.c" + ;; +esac + +for ARCH in __i386__ __x86_64__ __arm__ __mips__; do + $SPARSE $SPARSE_FLAGS -D$ARCH=1 $SOURCES +done + +# Tests are architecture independent. +$SPARSE $SPARSE_FLAGS -Itest $TESTS diff --git a/3rdparty/libuv/common.gypi b/3rdparty/libuv/common.gypi new file mode 100644 index 00000000000..7cebcde5f89 --- /dev/null +++ b/3rdparty/libuv/common.gypi @@ -0,0 +1,210 @@ +{ + 'variables': { + 'visibility%': 'hidden', # V8's visibility setting + 'target_arch%': 'ia32', # set v8's target architecture + 'host_arch%': 'ia32', # set v8's host architecture + 'uv_library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds + 'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way + }, + + 'target_defaults': { + 'default_configuration': 'Debug', + 'configurations': { + 'Debug': { + 'defines': [ 'DEBUG', '_DEBUG' ], + 'cflags': [ '-g', '-O0', '-fwrapv' ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'target_conditions': [ + ['uv_library=="static_library"', { + 'RuntimeLibrary': 1, # static debug + }, { + 'RuntimeLibrary': 3, # DLL debug + }], + ], + 'Optimization': 0, # /Od, no optimization + 'MinimalRebuild': 'false', + 'OmitFramePointers': 'false', + 'BasicRuntimeChecks': 3, # /RTC1 + }, + 'VCLinkerTool': { + 'LinkIncremental': 2, # enable incremental linking + }, + }, + 'xcode_settings': { + 'GCC_OPTIMIZATION_LEVEL': '0', + 'OTHER_CFLAGS': [ '-Wno-strict-aliasing' ], + }, + 'conditions': [ + ['OS == "android"', { + 'cflags': [ '-fPIE' ], + 'ldflags': [ '-fPIE', '-pie' ] + }] + ] + }, + 'Release': { + 'defines': [ 'NDEBUG' ], + 'cflags': [ + '-O3', + '-fstrict-aliasing', + '-fomit-frame-pointer', + '-fdata-sections', + '-ffunction-sections', + ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'target_conditions': [ + ['uv_library=="static_library"', { + 'RuntimeLibrary': 0, # static release + }, { + 'RuntimeLibrary': 2, # debug release + }], + ], + 'Optimization': 3, # /Ox, full optimization + 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size + 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible + 'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG + 'OmitFramePointers': 'true', + 'EnableFunctionLevelLinking': 'true', + 'EnableIntrinsicFunctions': 'true', + }, + 'VCLibrarianTool': { + 'AdditionalOptions': [ + '/LTCG', # link time code generation + ], + }, + 'VCLinkerTool': { + 'LinkTimeCodeGeneration': 1, # link-time code generation + 'OptimizeReferences': 2, # /OPT:REF + 'EnableCOMDATFolding': 2, # /OPT:ICF + 'LinkIncremental': 1, # disable incremental linking + }, + }, + } + }, + 'msvs_settings': { + 'VCCLCompilerTool': { + 'StringPooling': 'true', # pool string literals + 'DebugInformationFormat': 3, # Generate a PDB + 'WarningLevel': 3, + 'BufferSecurityCheck': 'true', + 'ExceptionHandling': 1, # /EHsc + 'SuppressStartupBanner': 'true', + 'WarnAsError': 'false', + 'AdditionalOptions': [ + '/MP', # compile across multiple CPUs + ], + }, + 'VCLibrarianTool': { + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + 'RandomizedBaseAddress': 2, # enable ASLR + 'DataExecutionPrevention': 2, # enable DEP + 'AllowIsolation': 'true', + 'SuppressStartupBanner': 'true', + 'target_conditions': [ + ['_type=="executable"', { + 'SubSystem': 1, # console executable + }], + ], + }, + }, + 'conditions': [ + ['OS == "win"', { + 'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin + 'defines': [ + 'WIN32', + # we don't really want VC++ warning us about + # how dangerous C functions are... + '_CRT_SECURE_NO_DEPRECATE', + # ... or that C implementations shouldn't use + # POSIX names + '_CRT_NONSTDC_NO_DEPRECATE', + ], + 'target_conditions': [ + ['target_arch=="x64"', { + 'msvs_configuration_platform': 'x64' + }] + ] + }], + ['OS in "freebsd dragonflybsd linux openbsd solaris android"', { + 'cflags': [ '-Wall' ], + 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ], + 'target_conditions': [ + ['_type=="static_library"', { + 'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19 + }], + ], + 'conditions': [ + [ 'host_arch != target_arch and target_arch=="ia32"', { + 'cflags': [ '-m32' ], + 'ldflags': [ '-m32' ], + }], + [ 'target_arch=="x32"', { + 'cflags': [ '-mx32' ], + 'ldflags': [ '-mx32' ], + }], + [ 'OS=="linux"', { + 'cflags': [ '-ansi' ], + }], + [ 'OS=="solaris"', { + 'cflags': [ '-pthreads' ], + 'ldflags': [ '-pthreads' ], + }], + [ 'OS not in "solaris android"', { + 'cflags': [ '-pthread' ], + 'ldflags': [ '-pthread' ], + }], + [ 'visibility=="hidden"', { + 'cflags': [ '-fvisibility=hidden' ], + }], + ], + }], + ['OS=="mac"', { + 'xcode_settings': { + 'ALWAYS_SEARCH_USER_PATHS': 'NO', + 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks + 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic + # (Equivalent to -fPIC) + 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions + 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti + 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings + # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden + 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', + 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden + 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics + 'PREBINDING': 'NO', # No -Wl,-prebind + 'USE_HEADERMAP': 'NO', + 'OTHER_CFLAGS': [ + '-fstrict-aliasing', + ], + 'WARNING_CFLAGS': [ + '-Wall', + '-Wendif-labels', + '-W', + '-Wno-unused-parameter', + ], + }, + 'conditions': [ + ['target_arch=="ia32"', { + 'xcode_settings': {'ARCHS': ['i386']}, + }], + ['target_arch=="x64"', { + 'xcode_settings': {'ARCHS': ['x86_64']}, + }], + ], + 'target_conditions': [ + ['_type!="static_library"', { + 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']}, + }], + ], + }], + ['OS=="solaris"', { + 'cflags': [ '-fno-omit-frame-pointer' ], + # pull in V8's postmortem metadata + 'ldflags': [ '-Wl,-z,allextract' ] + }], + ], + }, +} diff --git a/3rdparty/libuv/configure.ac b/3rdparty/libuv/configure.ac new file mode 100644 index 00000000000..011bee2a891 --- /dev/null +++ b/3rdparty/libuv/configure.ac @@ -0,0 +1,68 @@ +# Copyright (c) 2013, Ben Noordhuis +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +AC_PREREQ(2.57) +AC_INIT([libuv], [1.8.0], [https://github.com/libuv/libuv/issues]) +AC_CONFIG_MACRO_DIR([m4]) +m4_include([m4/libuv-extra-automake-flags.m4]) +m4_include([m4/as_case.m4]) +m4_include([m4/libuv-check-flags.m4]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects] UV_EXTRA_AUTOMAKE_FLAGS) +AC_CANONICAL_HOST +AC_ENABLE_SHARED +AC_ENABLE_STATIC +AC_PROG_CC +AM_PROG_CC_C_O +CC_CHECK_CFLAGS_APPEND([-fvisibility=hidden]) +CC_CHECK_CFLAGS_APPEND([-g]) +CC_CHECK_CFLAGS_APPEND([-std=gnu89]) +CC_CHECK_CFLAGS_APPEND([-pedantic]) +CC_CHECK_CFLAGS_APPEND([-Wall]) +CC_CHECK_CFLAGS_APPEND([-Wextra]) +CC_CHECK_CFLAGS_APPEND([-Wno-unused-parameter]) +# AM_PROG_AR is not available in automake v0.11 but it's essential in v0.12. +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +# autoconf complains if AC_PROG_LIBTOOL precedes AM_PROG_AR. +AC_PROG_LIBTOOL +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +LT_INIT +# TODO(bnoordhuis) Check for -pthread vs. -pthreads +AC_CHECK_LIB([dl], [dlopen]) +AC_CHECK_LIB([kstat], [kstat_lookup]) +AC_CHECK_LIB([kvm], [kvm_open]) +AC_CHECK_LIB([nsl], [gethostbyname]) +AC_CHECK_LIB([perfstat], [perfstat_cpu]) +AC_CHECK_LIB([pthread], [pthread_mutex_init]) +AC_CHECK_LIB([rt], [clock_gettime]) +AC_CHECK_LIB([sendfile], [sendfile]) +AC_CHECK_LIB([socket], [socket]) +AC_SYS_LARGEFILE +AM_CONDITIONAL([AIX], [AS_CASE([$host_os],[aix*], [true], [false])]) +AM_CONDITIONAL([ANDROID], [AS_CASE([$host_os],[linux-android*],[true], [false])]) +AM_CONDITIONAL([DARWIN], [AS_CASE([$host_os],[darwin*], [true], [false])]) +AM_CONDITIONAL([DRAGONFLY],[AS_CASE([$host_os],[dragonfly*], [true], [false])]) +AM_CONDITIONAL([FREEBSD], [AS_CASE([$host_os],[freebsd*], [true], [false])]) +AM_CONDITIONAL([LINUX], [AS_CASE([$host_os],[linux*], [true], [false])]) +AM_CONDITIONAL([NETBSD], [AS_CASE([$host_os],[netbsd*], [true], [false])]) +AM_CONDITIONAL([OPENBSD], [AS_CASE([$host_os],[openbsd*], [true], [false])]) +AM_CONDITIONAL([SUNOS], [AS_CASE([$host_os],[solaris*], [true], [false])]) +AM_CONDITIONAL([WINNT], [AS_CASE([$host_os],[mingw*], [true], [false])]) +AC_CHECK_HEADERS([sys/ahafs_evProds.h]) +AC_CHECK_PROG(PKG_CONFIG, pkg-config, yes) +AM_CONDITIONAL([HAVE_PKG_CONFIG], [test "x$PKG_CONFIG" != "x"]) +AS_IF([test "x$PKG_CONFIG" != "x"], [ + AC_CONFIG_FILES([libuv.pc]) +]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/3rdparty/libuv/docs/Makefile b/3rdparty/libuv/docs/Makefile new file mode 100644 index 00000000000..1e0fc8f0220 --- /dev/null +++ b/3rdparty/libuv/docs/Makefile @@ -0,0 +1,178 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build +SRCDIR = src + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRCDIR) +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRCDIR) + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/libuv.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/libuv.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/libuv" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/libuv" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/3rdparty/libuv/docs/make.bat b/3rdparty/libuv/docs/make.bat new file mode 100644 index 00000000000..10eb94b013b --- /dev/null +++ b/3rdparty/libuv/docs/make.bat @@ -0,0 +1,243 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=build +set SRCDIR=src +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% %SRCDIR% +set I18NSPHINXOPTS=%SPHINXOPTS% %SRCDIR% +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. texinfo to make Texinfo files + echo. gettext to make PO message catalogs + echo. changes to make an overview over all changed/added/deprecated items + echo. xml to make Docutils-native XML files + echo. pseudoxml to make pseudoxml-XML files for display purposes + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + + +%SPHINXBUILD% 2> nul +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\libuv.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\libuv.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdf" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdfja" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf-ja + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "texinfo" ( + %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. + goto end +) + +if "%1" == "gettext" ( + %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The message catalogs are in %BUILDDIR%/locale. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +if "%1" == "xml" ( + %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The XML files are in %BUILDDIR%/xml. + goto end +) + +if "%1" == "pseudoxml" ( + %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. + goto end +) + +:end diff --git a/3rdparty/libuv/docs/src/async.rst b/3rdparty/libuv/docs/src/async.rst new file mode 100644 index 00000000000..5c400458244 --- /dev/null +++ b/3rdparty/libuv/docs/src/async.rst @@ -0,0 +1,57 @@ + +.. _async: + +:c:type:`uv_async_t` --- Async handle +===================================== + +Async handles allow the user to "wakeup" the event loop and get a callback +called from another thread. + + +Data types +---------- + +.. c:type:: uv_async_t + + Async handle type. + +.. c:type:: void (*uv_async_cb)(uv_async_t* handle) + + Type definition for callback passed to :c:func:`uv_async_init`. + + +Public members +^^^^^^^^^^^^^^ + +N/A + +.. seealso:: The :c:type:`uv_handle_t` members also apply. + + +API +--- + +.. c:function:: int uv_async_init(uv_loop_t* loop, uv_async_t* async, uv_async_cb async_cb) + + Initialize the handle. A NULL callback is allowed. + + .. note:: + Unlike other handle initialization functions, it immediately starts the handle. + +.. c:function:: int uv_async_send(uv_async_t* async) + + Wakeup the event loop and call the async handle's callback. + + .. note:: + It's safe to call this function from any thread. The callback will be called on the + loop thread. + + .. warning:: + libuv will coalesce calls to :c:func:`uv_async_send`, that is, not every call to it will + yield an execution of the callback. For example: if :c:func:`uv_async_send` is called 5 + times in a row before the callback is called, the callback will only be called once. If + :c:func:`uv_async_send` is called again after the callback was called, it will be called + again. + +.. seealso:: + The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/check.rst b/3rdparty/libuv/docs/src/check.rst new file mode 100644 index 00000000000..36c93cf03d9 --- /dev/null +++ b/3rdparty/libuv/docs/src/check.rst @@ -0,0 +1,46 @@ + +.. _check: + +:c:type:`uv_check_t` --- Check handle +===================================== + +Check handles will run the given callback once per loop iteration, right +after polling for i/o. + + +Data types +---------- + +.. c:type:: uv_check_t + + Check handle type. + +.. c:type:: void (*uv_check_cb)(uv_check_t* handle) + + Type definition for callback passed to :c:func:`uv_check_start`. + + +Public members +^^^^^^^^^^^^^^ + +N/A + +.. seealso:: The :c:type:`uv_handle_t` members also apply. + + +API +--- + +.. c:function:: int uv_check_init(uv_loop_t* loop, uv_check_t* check) + + Initialize the handle. + +.. c:function:: int uv_check_start(uv_check_t* check, uv_check_cb cb) + + Start the handle with the given callback. + +.. c:function:: int uv_check_stop(uv_check_t* check) + + Stop the handle, the callback will no longer be called. + +.. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/conf.py b/3rdparty/libuv/docs/src/conf.py new file mode 100644 index 00000000000..b9eaa137432 --- /dev/null +++ b/3rdparty/libuv/docs/src/conf.py @@ -0,0 +1,348 @@ +# -*- coding: utf-8 -*- +# +# libuv API documentation documentation build configuration file, created by +# sphinx-quickstart on Sun Jul 27 11:47:51 2014. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import os +import re +import sys + + +def get_libuv_version(): + with open('../../include/uv-version.h') as f: + data = f.read() + try: + m = re.search(r"""^#define UV_VERSION_MAJOR (\d)$""", data, re.MULTILINE) + major = int(m.group(1)) + m = re.search(r"""^#define UV_VERSION_MINOR (\d)$""", data, re.MULTILINE) + minor = int(m.group(1)) + m = re.search(r"""^#define UV_VERSION_PATCH (\d)$""", data, re.MULTILINE) + patch = int(m.group(1)) + m = re.search(r"""^#define UV_VERSION_IS_RELEASE (\d)$""", data, re.MULTILINE) + is_release = int(m.group(1)) + m = re.search(r"""^#define UV_VERSION_SUFFIX \"(\w*)\"$""", data, re.MULTILINE) + suffix = m.group(1) + return '%d.%d.%d%s' % (major, minor, patch, '-%s' % suffix if not is_release else '') + except Exception: + return 'unknown' + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath('sphinx-plugins')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['manpage'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'libuv API documentation' +copyright = u'libuv contributors' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = get_libuv_version() +# The full version, including alpha/beta/rc tags. +release = version + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'nature' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +html_title = 'libuv API documentation' + +# A shorter title for the navigation bar. Default is the same as html_title. +html_short_title = 'libuv %s API documentation' % version + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +html_logo = 'static/logo.png' + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +html_favicon = 'static/favicon.ico' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'libuv' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ('index', 'libuv.tex', u'libuv API documentation', + u'libuv contributors', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'libuv', u'libuv API documentation', + [u'libuv contributors'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'libuv', u'libuv API documentation', + u'libuv contributors', 'libuv', 'Cross-platform asynchronous I/O', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + + +# -- Options for Epub output ---------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = u'libuv API documentation' +epub_author = u'libuv contributors' +epub_publisher = u'libuv contributors' +epub_copyright = u'2014, libuv contributors' + +# The basename for the epub file. It defaults to the project name. +epub_basename = u'libuv' + +# The HTML theme for the epub output. Since the default themes are not optimized +# for small screen space, using the same theme for HTML and epub output is +# usually not wise. This defaults to 'epub', a theme designed to save visual +# space. +#epub_theme = 'epub' + +# The language of the text. It defaults to the language option +# or en if the language is not set. +#epub_language = '' + +# The scheme of the identifier. Typical schemes are ISBN or URL. +#epub_scheme = '' + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +#epub_identifier = '' + +# A unique identification for the text. +#epub_uid = '' + +# A tuple containing the cover image and cover page html template filenames. +#epub_cover = () + +# A sequence of (type, uri, title) tuples for the guide element of content.opf. +#epub_guide = () + +# HTML files that should be inserted before the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_pre_files = [] + +# HTML files shat should be inserted after the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_post_files = [] + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] + +# The depth of the table of contents in toc.ncx. +#epub_tocdepth = 3 + +# Allow duplicate toc entries. +#epub_tocdup = True + +# Choose between 'default' and 'includehidden'. +#epub_tocscope = 'default' + +# Fix unsupported image types using the PIL. +#epub_fix_images = False + +# Scale large images. +#epub_max_image_width = 0 + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#epub_show_urls = 'inline' + +# If false, no index is generated. +#epub_use_index = True diff --git a/3rdparty/libuv/docs/src/design.rst b/3rdparty/libuv/docs/src/design.rst new file mode 100644 index 00000000000..34c3cff68e5 --- /dev/null +++ b/3rdparty/libuv/docs/src/design.rst @@ -0,0 +1,137 @@ + +.. _design: + +Design overview +=============== + +libuv is cross-platform support library which was originally written for NodeJS. It's designed +around the event-driven asynchronous I/O model. + +The library provides much more than simply abstraction over different I/O polling mechanisms: +'handles' and 'streams' provide a high level abstraction for sockets and other entities; +cross-platform file I/O and threading functionality is also provided, amongst other things. + +Here is a diagram illustrating the different parts that compose libuv and what subsystem they +relate to: + +.. image:: static/architecture.png + :scale: 75% + :align: center + + +Handles and requests +^^^^^^^^^^^^^^^^^^^^ + +libuv provides users with 2 abstractions to work with, in combination with the event loop: +handles and requests. + +Handles represent long-lived objects capable of performing certain operations while active. Some +examples: a prepare handle gets its callback called once every loop iteration when active, and +a TCP server handle get its connection callback called every time there is a new connection. + +Requests represent (typically) short-lived operations. These operations can be performed over a +handle: write requests are used to write data on a handle; or standalone: getaddrinfo requests +don't need a handle they run directly on the loop. + + +The I/O loop +^^^^^^^^^^^^ + +The I/O (or event) loop is the central part of libuv. It establishes the content for all I/O +operations, and it's meant to be tied to a single thread. One can run multiple event loops +as long as each runs in a different thread. The libuv event loop (or any other API involving +the loop or handles, for that matter) **is not thread-safe** except where stated otherwise. + +The event loop follows the rather usual single threaded asynchronous I/O approach: all (network) +I/O is performed on non-blocking sockets which are polled using the best mechanism available +on the given platform: epoll on Linux, kqueue on OSX and other BSDs, event ports on SunOS and IOCP +on Windows. As part of a loop iteration the loop will block waiting for I/O activity on sockets +which have been added to the poller and callbacks will be fired indicating socket conditions +(readable, writable hangup) so handles can read, write or perform the desired I/O operation. + +In order to better understand how the event loop operates, the following diagram illustrates all +stages of a loop iteration: + +.. image:: static/loop_iteration.png + :scale: 75% + :align: center + + +#. The loop concept of 'now' is updated. The event loop caches the current time at the start of + the event loop tick in order to reduce the number of time-related system calls. + +#. If the loop is *alive* an iteration is started, otherwise the loop will exit immediately. So, + when is a loop considered to be *alive*? If a loop has active and ref'd handles, active + requests or closing handles it's considered to be *alive*. + +#. Due timers are run. All active timers scheduled for a time before the loop's concept of *now* + get their callbacks called. + +#. Pending callbacks are called. All I/O callbacks are called right after polling for I/O, for the + most part. There are cases, however, in which calling such a callback is deferred for the next + loop iteration. If the previous iteration deferred any I/O callback it will be run at this point. + +#. Idle handle callbacks are called. Despite the unfortunate name, idle handles are run on every + loop iteration, if they are active. + +#. Prepare handle callbacks are called. Prepare handles get their callbacks called right before + the loop will block for I/O. + +#. Poll timeout is calculated. Before blocking for I/O the loop calculates for how long it should + block. These are the rules when calculating the timeout: + + * If the loop was run with the ``UV_RUN_NOWAIT`` flag, the timeout is 0. + * If the loop is going to be stopped (:c:func:`uv_stop` was called), the timeout is 0. + * If there are no active handles or requests, the timeout is 0. + * If there are any idle handles active, the timeout is 0. + * If there are any handles pending to be closed, the timeout is 0. + * If none of the above cases was matched, the timeout of the closest timer is taken, or + if there are no active timers, infinity. + +#. The loop blocks for I/O. At this point the loop will block for I/O for the timeout calculated + on the previous step. All I/O related handles that were monitoring a given file descriptor + for a read or write operation get their callbacks called at this point. + +#. Check handle callbacks are called. Check handles get their callbacks called right after the + loop has blocked for I/O. Check handles are essentially the counterpart of prepare handles. + +#. Close callbacks are called. If a handle was closed by calling :c:func:`uv_close` it will + get the close callback called. + +#. Special case in case the loop was run with ``UV_RUN_ONCE``, as it implies forward progress. + It's possible that no I/O callbacks were fired after blocking for I/O, but some time has passed + so there might be timers which are due, those timers get their callbacks called. + +#. Iteration ends. If the loop was run with ``UV_RUN_NOWAIT`` or ``UV_RUN_ONCE`` modes the + iteration is ended and :c:func:`uv_run` will return. If the loop was run with ``UV_RUN_DEFAULT`` + it will continue from the start if it's still *alive*, otherwise it will also end. + + +.. important:: + libuv uses a thread pool to make asynchronous file I/O operations possible, but + network I/O is **always** performed in a single thread, each loop's thread. + +.. note:: + While the polling mechanism is different, libuv makes the execution model consistent + across Unix systems and Windows. + + +File I/O +^^^^^^^^ + +Unlike network I/O, there are no platform-specific file I/O primitives libuv could rely on, +so the current approach is to run blocking file I/O operations in a thread pool. + +For a thorough explanation of the cross-platform file I/O landscape, checkout +`this post `_. + +libuv currently uses a global thread pool on which all loops can queue work on. 3 types of +operations are currently run on this pool: + + * Filesystem operations + * DNS functions (getaddrinfo and getnameinfo) + * User specified code via :c:func:`uv_queue_work` + +.. warning:: + See the :c:ref:`threadpool` section for more details, but keep in mind the thread pool size + is quite limited. diff --git a/3rdparty/libuv/docs/src/dll.rst b/3rdparty/libuv/docs/src/dll.rst new file mode 100644 index 00000000000..fb13f908159 --- /dev/null +++ b/3rdparty/libuv/docs/src/dll.rst @@ -0,0 +1,44 @@ + +.. _dll: + +Shared library handling +======================= + +libuv provides cross platform utilities for loading shared libraries and +retrieving symbols from them, using the following API. + + +Data types +---------- + +.. c:type:: uv_lib_t + + Shared library data type. + + +Public members +^^^^^^^^^^^^^^ + +N/A + + +API +--- + +.. c:function:: int uv_dlopen(const char* filename, uv_lib_t* lib) + + Opens a shared library. The filename is in utf-8. Returns 0 on success and + -1 on error. Call :c:func:`uv_dlerror` to get the error message. + +.. c:function:: void uv_dlclose(uv_lib_t* lib) + + Close the shared library. + +.. c:function:: int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr) + + Retrieves a data pointer from a dynamic library. It is legal for a symbol + to map to NULL. Returns 0 on success and -1 if the symbol was not found. + +.. c:function:: const char* uv_dlerror(const uv_lib_t* lib) + + Returns the last uv_dlopen() or uv_dlsym() error message. diff --git a/3rdparty/libuv/docs/src/dns.rst b/3rdparty/libuv/docs/src/dns.rst new file mode 100644 index 00000000000..1d881580966 --- /dev/null +++ b/3rdparty/libuv/docs/src/dns.rst @@ -0,0 +1,108 @@ + +.. _dns: + +DNS utility functions +===================== + +libuv provides asynchronous variants of `getaddrinfo` and `getnameinfo`. + + +Data types +---------- + +.. c:type:: uv_getaddrinfo_t + + `getaddrinfo` request type. + +.. c:type:: void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* req, int status, struct addrinfo* res) + + Callback which will be called with the getaddrinfo request result once + complete. In case it was cancelled, `status` will have a value of + ``UV_ECANCELED``. + +.. c:type:: uv_getnameinfo_t + + `getnameinfo` request type. + +.. c:type:: void (*uv_getnameinfo_cb)(uv_getnameinfo_t* req, int status, const char* hostname, const char* service) + + Callback which will be called with the getnameinfo request result once + complete. In case it was cancelled, `status` will have a value of + ``UV_ECANCELED``. + + +Public members +^^^^^^^^^^^^^^ + +.. c:member:: uv_loop_t* uv_getaddrinfo_t.loop + + Loop that started this getaddrinfo request and where completion will be + reported. Readonly. + +.. c:member:: struct addrinfo* uv_getaddrinfo_t.addrinfo + + Pointer to a `struct addrinfo` containing the result. Must be freed by the user + with :c:func:`uv_freeaddrinfo`. + + .. versionchanged:: 1.3.0 the field is declared as public. + +.. c:member:: uv_loop_t* uv_getnameinfo_t.loop + + Loop that started this getnameinfo request and where completion will be + reported. Readonly. + +.. c:member:: char[NI_MAXHOST] uv_getnameinfo_t.host + + Char array containing the resulting host. It's null terminated. + + .. versionchanged:: 1.3.0 the field is declared as public. + +.. c:member:: char[NI_MAXSERV] uv_getnameinfo_t.service + + Char array containing the resulting service. It's null terminated. + + .. versionchanged:: 1.3.0 the field is declared as public. + +.. seealso:: The :c:type:`uv_req_t` members also apply. + + +API +--- + +.. c:function:: int uv_getaddrinfo(uv_loop_t* loop, uv_getaddrinfo_t* req, uv_getaddrinfo_cb getaddrinfo_cb, const char* node, const char* service, const struct addrinfo* hints) + + Asynchronous :man:`getaddrinfo(3)`. + + Either node or service may be NULL but not both. + + `hints` is a pointer to a struct addrinfo with additional address type + constraints, or NULL. Consult `man -s 3 getaddrinfo` for more details. + + Returns 0 on success or an error code < 0 on failure. If successful, the + callback will get called sometime in the future with the lookup result, + which is either: + + * status == 0, the res argument points to a valid `struct addrinfo`, or + * status < 0, the res argument is NULL. See the UV_EAI_* constants. + + Call :c:func:`uv_freeaddrinfo` to free the addrinfo structure. + + .. versionchanged:: 1.3.0 the callback parameter is now allowed to be NULL, + in which case the request will run **synchronously**. + +.. c:function:: void uv_freeaddrinfo(struct addrinfo* ai) + + Free the struct addrinfo. Passing NULL is allowed and is a no-op. + +.. c:function:: int uv_getnameinfo(uv_loop_t* loop, uv_getnameinfo_t* req, uv_getnameinfo_cb getnameinfo_cb, const struct sockaddr* addr, int flags) + + Asynchronous :man:`getnameinfo(3)`. + + Returns 0 on success or an error code < 0 on failure. If successful, the + callback will get called sometime in the future with the lookup result. + Consult `man -s 3 getnameinfo` for more details. + + .. versionchanged:: 1.3.0 the callback parameter is now allowed to be NULL, + in which case the request will run **synchronously**. + +.. seealso:: The :c:type:`uv_req_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/errors.rst b/3rdparty/libuv/docs/src/errors.rst new file mode 100644 index 00000000000..cec25f5187e --- /dev/null +++ b/3rdparty/libuv/docs/src/errors.rst @@ -0,0 +1,331 @@ + +.. _errors: + +Error handling +============== + +In libuv errors are negative numbered constants. As a rule of thumb, whenever +there is a status parameter, or an API functions returns an integer, a negative +number will imply an error. + +.. note:: + Implementation detail: on Unix error codes are the negated `errno` (or `-errno`), while on + Windows they are defined by libuv to arbitrary negative numbers. + + +Error constants +--------------- + +.. c:macro:: UV_E2BIG + + argument list too long + +.. c:macro:: UV_EACCES + + permission denied + +.. c:macro:: UV_EADDRINUSE + + address already in use + +.. c:macro:: UV_EADDRNOTAVAIL + + address not available + +.. c:macro:: UV_EAFNOSUPPORT + + address family not supported + +.. c:macro:: UV_EAGAIN + + resource temporarily unavailable + +.. c:macro:: UV_EAI_ADDRFAMILY + + address family not supported + +.. c:macro:: UV_EAI_AGAIN + + temporary failure + +.. c:macro:: UV_EAI_BADFLAGS + + bad ai_flags value + +.. c:macro:: UV_EAI_BADHINTS + + invalid value for hints + +.. c:macro:: UV_EAI_CANCELED + + request canceled + +.. c:macro:: UV_EAI_FAIL + + permanent failure + +.. c:macro:: UV_EAI_FAMILY + + ai_family not supported + +.. c:macro:: UV_EAI_MEMORY + + out of memory + +.. c:macro:: UV_EAI_NODATA + + no address + +.. c:macro:: UV_EAI_NONAME + + unknown node or service + +.. c:macro:: UV_EAI_OVERFLOW + + argument buffer overflow + +.. c:macro:: UV_EAI_PROTOCOL + + resolved protocol is unknown + +.. c:macro:: UV_EAI_SERVICE + + service not available for socket type + +.. c:macro:: UV_EAI_SOCKTYPE + + socket type not supported + +.. c:macro:: UV_EALREADY + + connection already in progress + +.. c:macro:: UV_EBADF + + bad file descriptor + +.. c:macro:: UV_EBUSY + + resource busy or locked + +.. c:macro:: UV_ECANCELED + + operation canceled + +.. c:macro:: UV_ECHARSET + + invalid Unicode character + +.. c:macro:: UV_ECONNABORTED + + software caused connection abort + +.. c:macro:: UV_ECONNREFUSED + + connection refused + +.. c:macro:: UV_ECONNRESET + + connection reset by peer + +.. c:macro:: UV_EDESTADDRREQ + + destination address required + +.. c:macro:: UV_EEXIST + + file already exists + +.. c:macro:: UV_EFAULT + + bad address in system call argument + +.. c:macro:: UV_EFBIG + + file too large + +.. c:macro:: UV_EHOSTUNREACH + + host is unreachable + +.. c:macro:: UV_EINTR + + interrupted system call + +.. c:macro:: UV_EINVAL + + invalid argument + +.. c:macro:: UV_EIO + + i/o error + +.. c:macro:: UV_EISCONN + + socket is already connected + +.. c:macro:: UV_EISDIR + + illegal operation on a directory + +.. c:macro:: UV_ELOOP + + too many symbolic links encountered + +.. c:macro:: UV_EMFILE + + too many open files + +.. c:macro:: UV_EMSGSIZE + + message too long + +.. c:macro:: UV_ENAMETOOLONG + + name too long + +.. c:macro:: UV_ENETDOWN + + network is down + +.. c:macro:: UV_ENETUNREACH + + network is unreachable + +.. c:macro:: UV_ENFILE + + file table overflow + +.. c:macro:: UV_ENOBUFS + + no buffer space available + +.. c:macro:: UV_ENODEV + + no such device + +.. c:macro:: UV_ENOENT + + no such file or directory + +.. c:macro:: UV_ENOMEM + + not enough memory + +.. c:macro:: UV_ENONET + + machine is not on the network + +.. c:macro:: UV_ENOPROTOOPT + + protocol not available + +.. c:macro:: UV_ENOSPC + + no space left on device + +.. c:macro:: UV_ENOSYS + + function not implemented + +.. c:macro:: UV_ENOTCONN + + socket is not connected + +.. c:macro:: UV_ENOTDIR + + not a directory + +.. c:macro:: UV_ENOTEMPTY + + directory not empty + +.. c:macro:: UV_ENOTSOCK + + socket operation on non-socket + +.. c:macro:: UV_ENOTSUP + + operation not supported on socket + +.. c:macro:: UV_EPERM + + operation not permitted + +.. c:macro:: UV_EPIPE + + broken pipe + +.. c:macro:: UV_EPROTO + + protocol error + +.. c:macro:: UV_EPROTONOSUPPORT + + protocol not supported + +.. c:macro:: UV_EPROTOTYPE + + protocol wrong type for socket + +.. c:macro:: UV_ERANGE + + result too large + +.. c:macro:: UV_EROFS + + read-only file system + +.. c:macro:: UV_ESHUTDOWN + + cannot send after transport endpoint shutdown + +.. c:macro:: UV_ESPIPE + + invalid seek + +.. c:macro:: UV_ESRCH + + no such process + +.. c:macro:: UV_ETIMEDOUT + + connection timed out + +.. c:macro:: UV_ETXTBSY + + text file is busy + +.. c:macro:: UV_EXDEV + + cross-device link not permitted + +.. c:macro:: UV_UNKNOWN + + unknown error + +.. c:macro:: UV_EOF + + end of file + +.. c:macro:: UV_ENXIO + + no such device or address + +.. c:macro:: UV_EMLINK + + too many links + + +API +--- + +.. c:function:: const char* uv_strerror(int err) + + Returns the error message for the given error code. Leaks a few bytes + of memory when you call it with an unknown error code. + +.. c:function:: const char* uv_err_name(int err) + + Returns the error name for the given error code. Leaks a few bytes + of memory when you call it with an unknown error code. diff --git a/3rdparty/libuv/docs/src/fs.rst b/3rdparty/libuv/docs/src/fs.rst new file mode 100644 index 00000000000..69e283f4c67 --- /dev/null +++ b/3rdparty/libuv/docs/src/fs.rst @@ -0,0 +1,300 @@ + +.. _fs: + +Filesystem operations +===================== + +libuv provides a wide variety of cross-platform sync and async filesystem +operations. All functions defined in this document take a callback, which is +allowed to be NULL. If the callback is NULL the request is completed synchronously, +otherwise it will be performed asynchronously. + +All file operations are run on the threadpool, see :ref:`threadpool` for information +on the threadpool size. + + +Data types +---------- + +.. c:type:: uv_fs_t + + Filesystem request type. + +.. c:type:: uv_timespec_t + + Portable equivalent of ``struct timespec``. + + :: + + typedef struct { + long tv_sec; + long tv_nsec; + } uv_timespec_t; + +.. c:type:: uv_stat_t + + Portable equivalent of ``struct stat``. + + :: + + typedef struct { + uint64_t st_dev; + uint64_t st_mode; + uint64_t st_nlink; + uint64_t st_uid; + uint64_t st_gid; + uint64_t st_rdev; + uint64_t st_ino; + uint64_t st_size; + uint64_t st_blksize; + uint64_t st_blocks; + uint64_t st_flags; + uint64_t st_gen; + uv_timespec_t st_atim; + uv_timespec_t st_mtim; + uv_timespec_t st_ctim; + uv_timespec_t st_birthtim; + } uv_stat_t; + +.. c:type:: uv_fs_type + + Filesystem request type. + + :: + + typedef enum { + UV_FS_UNKNOWN = -1, + UV_FS_CUSTOM, + UV_FS_OPEN, + UV_FS_CLOSE, + UV_FS_READ, + UV_FS_WRITE, + UV_FS_SENDFILE, + UV_FS_STAT, + UV_FS_LSTAT, + UV_FS_FSTAT, + UV_FS_FTRUNCATE, + UV_FS_UTIME, + UV_FS_FUTIME, + UV_FS_ACCESS, + UV_FS_CHMOD, + UV_FS_FCHMOD, + UV_FS_FSYNC, + UV_FS_FDATASYNC, + UV_FS_UNLINK, + UV_FS_RMDIR, + UV_FS_MKDIR, + UV_FS_MKDTEMP, + UV_FS_RENAME, + UV_FS_SCANDIR, + UV_FS_LINK, + UV_FS_SYMLINK, + UV_FS_READLINK, + UV_FS_CHOWN, + UV_FS_FCHOWN + } uv_fs_type; + +.. c:type:: uv_dirent_t + + Cross platform (reduced) equivalent of ``struct dirent``. + Used in :c:func:`uv_fs_scandir_next`. + + :: + + typedef enum { + UV_DIRENT_UNKNOWN, + UV_DIRENT_FILE, + UV_DIRENT_DIR, + UV_DIRENT_LINK, + UV_DIRENT_FIFO, + UV_DIRENT_SOCKET, + UV_DIRENT_CHAR, + UV_DIRENT_BLOCK + } uv_dirent_type_t; + + typedef struct uv_dirent_s { + const char* name; + uv_dirent_type_t type; + } uv_dirent_t; + + +Public members +^^^^^^^^^^^^^^ + +.. c:member:: uv_loop_t* uv_fs_t.loop + + Loop that started this request and where completion will be reported. + Readonly. + +.. c:member:: uv_fs_type uv_fs_t.fs_type + + FS request type. + +.. c:member:: const char* uv_fs_t.path + + Path affecting the request. + +.. c:member:: ssize_t uv_fs_t.result + + Result of the request. < 0 means error, success otherwise. On requests such + as :c:func:`uv_fs_read` or :c:func:`uv_fs_write` it indicates the amount of + data that was read or written, respectively. + +.. c:member:: uv_stat_t uv_fs_t.statbuf + + Stores the result of :c:func:`uv_fs_stat` and other stat requests. + +.. c:member:: void* uv_fs_t.ptr + + Stores the result of :c:func:`uv_fs_readlink` and serves as an alias to + `statbuf`. + +.. seealso:: The :c:type:`uv_req_t` members also apply. + + +API +--- + +.. c:function:: void uv_fs_req_cleanup(uv_fs_t* req) + + Cleanup request. Must be called after a request is finished to deallocate + any memory libuv might have allocated. + +.. c:function:: int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) + + Equivalent to :man:`close(2)`. + +.. c:function:: int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, int mode, uv_fs_cb cb) + + Equivalent to :man:`open(2)`. + + .. note:: + On Windows libuv uses `CreateFileW` and thus the file is always opened + in binary mode. Because of this the O_BINARY and O_TEXT flags are not + supported. + +.. c:function:: int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file, const uv_buf_t bufs[], unsigned int nbufs, int64_t offset, uv_fs_cb cb) + + Equivalent to :man:`preadv(2)`. + +.. c:function:: int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) + + Equivalent to :man:`unlink(2)`. + +.. c:function:: int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, const uv_buf_t bufs[], unsigned int nbufs, int64_t offset, uv_fs_cb cb) + + Equivalent to :man:`pwritev(2)`. + +.. c:function:: int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, uv_fs_cb cb) + + Equivalent to :man:`mkdir(2)`. + + .. note:: + `mode` is currently not implemented on Windows. + +.. c:function:: int uv_fs_mkdtemp(uv_loop_t* loop, uv_fs_t* req, const char* tpl, uv_fs_cb cb) + + Equivalent to :man:`mkdtemp(3)`. + + .. note:: + The result can be found as a null terminated string at `req->path`. + +.. c:function:: int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) + + Equivalent to :man:`rmdir(2)`. + +.. c:function:: int uv_fs_scandir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, uv_fs_cb cb) +.. c:function:: int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent) + + Equivalent to :man:`scandir(3)`, with a slightly different API. Once the callback + for the request is called, the user can use :c:func:`uv_fs_scandir_next` to + get `ent` populated with the next directory entry data. When there are no + more entries ``UV_EOF`` will be returned. + + .. note:: + Unlike `scandir(3)`, this function does not return the "." and ".." entries. + + .. note:: + On Linux, getting the type of an entry is only supported by some filesystems (btrfs, ext2, + ext3 and ext4 at the time of this writing), check the :man:`getdents(2)` man page. + +.. c:function:: int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) +.. c:function:: int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) +.. c:function:: int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) + + Equivalent to :man:`stat(2)`, :man:`fstat(2)` and :man:`fstat(2)` respectively. + +.. c:function:: int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, uv_fs_cb cb) + + Equivalent to :man:`rename(2)`. + +.. c:function:: int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) + + Equivalent to :man:`fsync(2)`. + +.. c:function:: int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) + + Equivalent to :man:`fdatasync(2)`. + +.. c:function:: int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file, int64_t offset, uv_fs_cb cb) + + Equivalent to :man:`ftruncate(2)`. + +.. c:function:: int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd, uv_file in_fd, int64_t in_offset, size_t length, uv_fs_cb cb) + + Limited equivalent to :man:`sendfile(2)`. + +.. c:function:: int uv_fs_access(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, uv_fs_cb cb) + + Equivalent to :man:`access(2)` on Unix. Windows uses ``GetFileAttributesW()``. + +.. c:function:: int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, uv_fs_cb cb) +.. c:function:: int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file file, int mode, uv_fs_cb cb) + + Equivalent to :man:`chmod(2)` and :man:`fchmod(2)` respectively. + +.. c:function:: int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime, double mtime, uv_fs_cb cb) +.. c:function:: int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file file, double atime, double mtime, uv_fs_cb cb) + + Equivalent to :man:`utime(2)` and :man:`futime(2)` respectively. + +.. c:function:: int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, uv_fs_cb cb) + + Equivalent to :man:`link(2)`. + +.. c:function:: int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, int flags, uv_fs_cb cb) + + Equivalent to :man:`symlink(2)`. + + .. note:: + On Windows the `flags` parameter can be specified to control how the symlink will + be created: + + * ``UV_FS_SYMLINK_DIR``: indicates that `path` points to a directory. + + * ``UV_FS_SYMLINK_JUNCTION``: request that the symlink is created + using junction points. + +.. c:function:: int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) + + Equivalent to :man:`readlink(2)`. + +.. c:function:: int uv_fs_realpath(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) + + Equivalent to :man:`realpath(3)` on Unix. Windows uses ``GetFinalPathNameByHandle()``. + + .. note:: + This function is not implemented on Windows XP and Windows Server 2003. + On these systems, UV_ENOSYS is returned. + + .. versionadded:: 1.8.0 + +.. c:function:: int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, uv_gid_t gid, uv_fs_cb cb) +.. c:function:: int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_uid_t uid, uv_gid_t gid, uv_fs_cb cb) + + Equivalent to :man:`chown(2)` and :man:`fchown(2)` respectively. + + .. note:: + These functions are not implemented on Windows. + +.. seealso:: The :c:type:`uv_req_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/fs_event.rst b/3rdparty/libuv/docs/src/fs_event.rst new file mode 100644 index 00000000000..c2d7f520236 --- /dev/null +++ b/3rdparty/libuv/docs/src/fs_event.rst @@ -0,0 +1,108 @@ + +.. _fs_event: + +:c:type:`uv_fs_event_t` --- FS Event handle +=========================================== + +FS Event handles allow the user to monitor a given path for changes, for example, +if the file was renamed or there was a generic change in it. This handle uses +the best backend for the job on each platform. + + +Data types +---------- + +.. c:type:: uv_fs_event_t + + FS Event handle type. + +.. c:type:: void (*uv_fs_event_cb)(uv_fs_event_t* handle, const char* filename, int events, int status) + + Callback passed to :c:func:`uv_fs_event_start` which will be called repeatedly + after the handle is started. If the handle was started with a directory the + `filename` parameter will be a relative path to a file contained in the directory. + The `events` parameter is an ORed mask of :c:type:`uv_fs_event` elements. + +.. c:type:: uv_fs_event + + Event types that :c:type:`uv_fs_event_t` handles monitor. + + :: + + enum uv_fs_event { + UV_RENAME = 1, + UV_CHANGE = 2 + }; + +.. c:type:: uv_fs_event_flags + + Flags that can be passed to :c:func:`uv_fs_event_start` to control its + behavior. + + :: + + enum uv_fs_event_flags { + /* + * By default, if the fs event watcher is given a directory name, we will + * watch for all events in that directory. This flags overrides this behavior + * and makes fs_event report only changes to the directory entry itself. This + * flag does not affect individual files watched. + * This flag is currently not implemented yet on any backend. + */ + UV_FS_EVENT_WATCH_ENTRY = 1, + /* + * By default uv_fs_event will try to use a kernel interface such as inotify + * or kqueue to detect events. This may not work on remote filesystems such + * as NFS mounts. This flag makes fs_event fall back to calling stat() on a + * regular interval. + * This flag is currently not implemented yet on any backend. + */ + UV_FS_EVENT_STAT = 2, + /* + * By default, event watcher, when watching directory, is not registering + * (is ignoring) changes in it's subdirectories. + * This flag will override this behaviour on platforms that support it. + */ + UV_FS_EVENT_RECURSIVE = 4 + }; + + +Public members +^^^^^^^^^^^^^^ + +N/A + +.. seealso:: The :c:type:`uv_handle_t` members also apply. + + +API +--- + +.. c:function:: int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) + + Initialize the handle. + +.. c:function:: int uv_fs_event_start(uv_fs_event_t* handle, uv_fs_event_cb cb, const char* path, unsigned int flags) + + Start the handle with the given callback, which will watch the specified + `path` for changes. `flags` can be an ORed mask of :c:type:`uv_fs_event_flags`. + + .. note:: Currently the only supported flag is ``UV_FS_EVENT_RECURSIVE`` and + only on OSX and Windows. + +.. c:function:: int uv_fs_event_stop(uv_fs_event_t* handle) + + Stop the handle, the callback will no longer be called. + +.. c:function:: int uv_fs_event_getpath(uv_fs_event_t* handle, char* buffer, size_t* size) + + Get the path being monitored by the handle. The buffer must be preallocated + by the user. Returns 0 on success or an error code < 0 in case of failure. + On success, `buffer` will contain the path and `size` its length. If the buffer + is not big enough UV_ENOBUFS will be returned and len will be set to the + required size. + + .. versionchanged:: 1.3.0 the returned length no longer includes the terminating null byte, + and the buffer is not null terminated. + +.. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/fs_poll.rst b/3rdparty/libuv/docs/src/fs_poll.rst new file mode 100644 index 00000000000..4efb2440e0b --- /dev/null +++ b/3rdparty/libuv/docs/src/fs_poll.rst @@ -0,0 +1,72 @@ + +.. _fs_poll: + +:c:type:`uv_fs_poll_t` --- FS Poll handle +========================================= + +FS Poll handles allow the user to monitor a given path for changes. Unlike +:c:type:`uv_fs_event_t`, fs poll handles use `stat` to detect when a file has +changed so they can work on file systems where fs event handles can't. + + +Data types +---------- + +.. c:type:: uv_fs_poll_t + + FS Poll handle type. + +.. c:type:: void (*uv_fs_poll_cb)(uv_fs_poll_t* handle, int status, const uv_stat_t* prev, const uv_stat_t* curr) + + Callback passed to :c:func:`uv_fs_poll_start` which will be called repeatedly + after the handle is started, when any change happens to the monitored path. + + The callback is invoked with `status < 0` if `path` does not exist + or is inaccessible. The watcher is *not* stopped but your callback is + not called again until something changes (e.g. when the file is created + or the error reason changes). + + When `status == 0`, the callback receives pointers to the old and new + :c:type:`uv_stat_t` structs. They are valid for the duration of the + callback only. + + +Public members +^^^^^^^^^^^^^^ + +N/A + +.. seealso:: The :c:type:`uv_handle_t` members also apply. + + +API +--- + +.. c:function:: int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle) + + Initialize the handle. + +.. c:function:: int uv_fs_poll_start(uv_fs_poll_t* handle, uv_fs_poll_cb poll_cb, const char* path, unsigned int interval) + + Check the file at `path` for changes every `interval` milliseconds. + + .. note:: + For maximum portability, use multi-second intervals. Sub-second intervals will not detect + all changes on many file systems. + +.. c:function:: int uv_fs_poll_stop(uv_fs_poll_t* handle) + + Stop the handle, the callback will no longer be called. + +.. c:function:: int uv_fs_poll_getpath(uv_fs_poll_t* handle, char* buffer, size_t* size) + + Get the path being monitored by the handle. The buffer must be preallocated + by the user. Returns 0 on success or an error code < 0 in case of failure. + On success, `buffer` will contain the path and `size` its length. If the buffer + is not big enough UV_ENOBUFS will be returned and len will be set to the + required size. + + .. versionchanged:: 1.3.0 the returned length no longer includes the terminating null byte, + and the buffer is not null terminated. + +.. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/handle.rst b/3rdparty/libuv/docs/src/handle.rst new file mode 100644 index 00000000000..6ba597a21ab --- /dev/null +++ b/3rdparty/libuv/docs/src/handle.rst @@ -0,0 +1,181 @@ + +.. _handle: + +:c:type:`uv_handle_t` --- Base handle +===================================== + +`uv_handle_t` is the base type for all libuv handle types. + +Structures are aligned so that any libuv handle can be cast to `uv_handle_t`. +All API functions defined here work with any handle type. + + +Data types +---------- + +.. c:type:: uv_handle_t + + The base libuv handle type. + +.. c:type:: uv_any_handle + + Union of all handle types. + +.. c:type:: void (*uv_alloc_cb)(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) + + Type definition for callback passed to :c:func:`uv_read_start` and + :c:func:`uv_udp_recv_start`. The user must fill the supplied :c:type:`uv_buf_t` + structure with whatever size, as long as it's > 0. A suggested size (65536 at the moment) + is provided, but it doesn't need to be honored. Setting the buffer's length to 0 + will trigger a ``UV_ENOBUFS`` error in the :c:type:`uv_udp_recv_cb` or + :c:type:`uv_read_cb` callback. + +.. c:type:: void (*uv_close_cb)(uv_handle_t* handle) + + Type definition for callback passed to :c:func:`uv_close`. + + +Public members +^^^^^^^^^^^^^^ + +.. c:member:: uv_loop_t* uv_handle_t.loop + + Pointer to the :c:type:`uv_loop_t` where the handle is running on. Readonly. + +.. c:member:: void* uv_handle_t.data + + Space for user-defined arbitrary data. libuv does not use this field. + + +API +--- + +.. c:function:: int uv_is_active(const uv_handle_t* handle) + + Returns non-zero if the handle is active, zero if it's inactive. What + "active" means depends on the type of handle: + + - A uv_async_t handle is always active and cannot be deactivated, except + by closing it with uv_close(). + + - A uv_pipe_t, uv_tcp_t, uv_udp_t, etc. handle - basically any handle that + deals with i/o - is active when it is doing something that involves i/o, + like reading, writing, connecting, accepting new connections, etc. + + - A uv_check_t, uv_idle_t, uv_timer_t, etc. handle is active when it has + been started with a call to uv_check_start(), uv_idle_start(), etc. + + Rule of thumb: if a handle of type `uv_foo_t` has a `uv_foo_start()` + function, then it's active from the moment that function is called. + Likewise, `uv_foo_stop()` deactivates the handle again. + +.. c:function:: int uv_is_closing(const uv_handle_t* handle) + + Returns non-zero if the handle is closing or closed, zero otherwise. + + .. note:: + This function should only be used between the initialization of the handle and the + arrival of the close callback. + +.. c:function:: void uv_close(uv_handle_t* handle, uv_close_cb close_cb) + + Request handle to be closed. `close_cb` will be called asynchronously after + this call. This MUST be called on each handle before memory is released. + + Handles that wrap file descriptors are closed immediately but + `close_cb` will still be deferred to the next iteration of the event loop. + It gives you a chance to free up any resources associated with the handle. + + In-progress requests, like uv_connect_t or uv_write_t, are cancelled and + have their callbacks called asynchronously with status=UV_ECANCELED. + +.. c:function:: void uv_ref(uv_handle_t* handle) + + Reference the given handle. References are idempotent, that is, if a handle + is already referenced calling this function again will have no effect. + + See :ref:`refcount`. + +.. c:function:: void uv_unref(uv_handle_t* handle) + + Un-reference the given handle. References are idempotent, that is, if a handle + is not referenced calling this function again will have no effect. + + See :ref:`refcount`. + +.. c:function:: int uv_has_ref(const uv_handle_t* handle) + + Returns non-zero if the handle referenced, zero otherwise. + + See :ref:`refcount`. + +.. c:function:: size_t uv_handle_size(uv_handle_type type) + + Returns the size of the given handle type. Useful for FFI binding writers + who don't want to know the structure layout. + + +Miscellaneous API functions +--------------------------- + +The following API functions take a :c:type:`uv_handle_t` argument but they work +just for some handle types. + +.. c:function:: int uv_send_buffer_size(uv_handle_t* handle, int* value) + + Gets or sets the size of the send buffer that the operating + system uses for the socket. + + If `*value` == 0, it will return the current send buffer size, + otherwise it will use `*value` to set the new send buffer size. + + This function works for TCP, pipe and UDP handles on Unix and for TCP and + UDP handles on Windows. + + .. note:: + Linux will set double the size and return double the size of the original set value. + +.. c:function:: int uv_recv_buffer_size(uv_handle_t* handle, int* value) + + Gets or sets the size of the receive buffer that the operating + system uses for the socket. + + If `*value` == 0, it will return the current receive buffer size, + otherwise it will use `*value` to set the new receive buffer size. + + This function works for TCP, pipe and UDP handles on Unix and for TCP and + UDP handles on Windows. + + .. note:: + Linux will set double the size and return double the size of the original set value. + +.. c:function:: int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd) + + Gets the platform dependent file descriptor equivalent. + + The following handles are supported: TCP, pipes, TTY, UDP and poll. Passing + any other handle type will fail with `UV_EINVAL`. + + If a handle doesn't have an attached file descriptor yet or the handle + itself has been closed, this function will return `UV_EBADF`. + + .. warning:: + Be very careful when using this function. libuv assumes it's in control of the file + descriptor so any change to it may lead to malfunction. + + +.. _refcount: + +Reference counting +------------------ + +The libuv event loop (if run in the default mode) will run until there are no +active `and` referenced handles left. The user can force the loop to exit early +by unreferencing handles which are active, for example by calling :c:func:`uv_unref` +after calling :c:func:`uv_timer_start`. + +A handle can be referenced or unreferenced, the refcounting scheme doesn't use +a counter, so both operations are idempotent. + +All handles are referenced when active by default, see :c:func:`uv_is_active` +for a more detailed explanation on what being `active` involves. diff --git a/3rdparty/libuv/docs/src/idle.rst b/3rdparty/libuv/docs/src/idle.rst new file mode 100644 index 00000000000..1f51c4a19e4 --- /dev/null +++ b/3rdparty/libuv/docs/src/idle.rst @@ -0,0 +1,54 @@ + +.. _idle: + +:c:type:`uv_idle_t` --- Idle handle +=================================== + +Idle handles will run the given callback once per loop iteration, right +before the :c:type:`uv_prepare_t` handles. + +.. note:: + The notable difference with prepare handles is that when there are active idle handles, + the loop will perform a zero timeout poll instead of blocking for i/o. + +.. warning:: + Despite the name, idle handles will get their callbacks called on every loop iteration, + not when the loop is actually "idle". + + +Data types +---------- + +.. c:type:: uv_idle_t + + Idle handle type. + +.. c:type:: void (*uv_idle_cb)(uv_idle_t* handle) + + Type definition for callback passed to :c:func:`uv_idle_start`. + + +Public members +^^^^^^^^^^^^^^ + +N/A + +.. seealso:: The :c:type:`uv_handle_t` members also apply. + + +API +--- + +.. c:function:: int uv_idle_init(uv_loop_t* loop, uv_idle_t* idle) + + Initialize the handle. + +.. c:function:: int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb) + + Start the handle with the given callback. + +.. c:function:: int uv_idle_stop(uv_idle_t* idle) + + Stop the handle, the callback will no longer be called. + +.. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/index.rst b/3rdparty/libuv/docs/src/index.rst new file mode 100644 index 00000000000..fa89c4bffe5 --- /dev/null +++ b/3rdparty/libuv/docs/src/index.rst @@ -0,0 +1,95 @@ + +Welcome to the libuv API documentation +====================================== + +Overview +-------- + +libuv is a multi-platform support library with a focus on asynchronous I/O. It +was primarily developed for use by `Node.js`_, but it's also used by `Luvit`_, +`Julia`_, `pyuv`_, and `others`_. + +.. note:: + In case you find errors in this documentation you can help by sending + `pull requests `_! + +.. _Node.js: http://nodejs.org +.. _Luvit: http://luvit.io +.. _Julia: http://julialang.org +.. _pyuv: https://github.com/saghul/pyuv +.. _others: https://github.com/libuv/libuv/wiki/Projects-that-use-libuv + + +Features +-------- + +* Full-featured event loop backed by epoll, kqueue, IOCP, event ports. +* Asynchronous TCP and UDP sockets +* Asynchronous DNS resolution +* Asynchronous file and file system operations +* File system events +* ANSI escape code controlled TTY +* IPC with socket sharing, using Unix domain sockets or named pipes (Windows) +* Child processes +* Thread pool +* Signal handling +* High resolution clock +* Threading and synchronization primitives + + +Downloads +--------- + +libuv can be downloaded from `here `_. + + +Installation +------------ + +Installation instructions can be found on `the README `_. + + +Upgrading +--------- + +Migration guides for different libuv versions, starting with 1.0. + +.. toctree:: + :maxdepth: 1 + + migration_010_100 + + +Documentation +------------- + +.. toctree:: + :maxdepth: 1 + + design + errors + version + loop + handle + request + timer + prepare + check + idle + async + poll + signal + process + stream + tcp + pipe + tty + udp + fs_event + fs_poll + fs + threadpool + dns + dll + threading + misc diff --git a/3rdparty/libuv/docs/src/loop.rst b/3rdparty/libuv/docs/src/loop.rst new file mode 100644 index 00000000000..2a01d796375 --- /dev/null +++ b/3rdparty/libuv/docs/src/loop.rst @@ -0,0 +1,166 @@ + +.. _loop: + +:c:type:`uv_loop_t` --- Event loop +================================== + +The event loop is the central part of libuv's functionality. It takes care +of polling for i/o and scheduling callbacks to be run based on different sources +of events. + + +Data types +---------- + +.. c:type:: uv_loop_t + + Loop data type. + +.. c:type:: uv_run_mode + + Mode used to run the loop with :c:func:`uv_run`. + + :: + + typedef enum { + UV_RUN_DEFAULT = 0, + UV_RUN_ONCE, + UV_RUN_NOWAIT + } uv_run_mode; + +.. c:type:: void (*uv_walk_cb)(uv_handle_t* handle, void* arg) + + Type definition for callback passed to :c:func:`uv_walk`. + + +Public members +^^^^^^^^^^^^^^ + +.. c:member:: void* uv_loop_t.data + + Space for user-defined arbitrary data. libuv does not use this field. libuv does, however, + initialize it to NULL in :c:func:`uv_loop_init`, and it poisons the value (on debug builds) + on :c:func:`uv_loop_close`. + + +API +--- + +.. c:function:: int uv_loop_init(uv_loop_t* loop) + + Initializes the given `uv_loop_t` structure. + +.. c:function:: int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...) + + .. versionadded:: 1.0.2 + + Set additional loop options. You should normally call this before the + first call to :c:func:`uv_run` unless mentioned otherwise. + + Returns 0 on success or a UV_E* error code on failure. Be prepared to + handle UV_ENOSYS; it means the loop option is not supported by the platform. + + Supported options: + + - UV_LOOP_BLOCK_SIGNAL: Block a signal when polling for new events. The + second argument to :c:func:`uv_loop_configure` is the signal number. + + This operation is currently only implemented for SIGPROF signals, + to suppress unnecessary wakeups when using a sampling profiler. + Requesting other signals will fail with UV_EINVAL. + +.. c:function:: int uv_loop_close(uv_loop_t* loop) + + Closes all internal loop resources. This function must only be called once + the loop has finished its execution or it will return UV_EBUSY. After this + function returns the user shall free the memory allocated for the loop. + +.. c:function:: uv_loop_t* uv_default_loop(void) + + Returns the initialized default loop. It may return NULL in case of + allocation failure. + + This function is just a convenient way for having a global loop throughout + an application, the default loop is in no way different than the ones + initialized with :c:func:`uv_loop_init`. As such, the default loop can (and + should) be closed with :c:func:`uv_loop_close` so the resources associated + with it are freed. + +.. c:function:: int uv_run(uv_loop_t* loop, uv_run_mode mode) + + This function runs the event loop. It will act differently depending on the + specified mode: + + - UV_RUN_DEFAULT: Runs the event loop until there are no more active and + referenced handles or requests. Returns non-zero if :c:func:`uv_stop` + was called and there are still active handles or requests. Returns + zero in all other cases. + - UV_RUN_ONCE: Poll for i/o once. Note that this function blocks if + there are no pending callbacks. Returns zero when done (no active handles + or requests left), or non-zero if more callbacks are expected (meaning + you should run the event loop again sometime in the future). + - UV_RUN_NOWAIT: Poll for i/o once but don't block if there are no + pending callbacks. Returns zero if done (no active handles + or requests left), or non-zero if more callbacks are expected (meaning + you should run the event loop again sometime in the future). + +.. c:function:: int uv_loop_alive(const uv_loop_t* loop) + + Returns non-zero if there are active handles or request in the loop. + +.. c:function:: void uv_stop(uv_loop_t* loop) + + Stop the event loop, causing :c:func:`uv_run` to end as soon as + possible. This will happen not sooner than the next loop iteration. + If this function was called before blocking for i/o, the loop won't block + for i/o on this iteration. + +.. c:function:: size_t uv_loop_size(void) + + Returns the size of the `uv_loop_t` structure. Useful for FFI binding + writers who don't want to know the structure layout. + +.. c:function:: int uv_backend_fd(const uv_loop_t* loop) + + Get backend file descriptor. Only kqueue, epoll and event ports are + supported. + + This can be used in conjunction with `uv_run(loop, UV_RUN_NOWAIT)` to + poll in one thread and run the event loop's callbacks in another see + test/test-embed.c for an example. + + .. note:: + Embedding a kqueue fd in another kqueue pollset doesn't work on all platforms. It's not + an error to add the fd but it never generates events. + +.. c:function:: int uv_backend_timeout(const uv_loop_t* loop) + + Get the poll timeout. The return value is in milliseconds, or -1 for no + timeout. + +.. c:function:: uint64_t uv_now(const uv_loop_t* loop) + + Return the current timestamp in milliseconds. The timestamp is cached at + the start of the event loop tick, see :c:func:`uv_update_time` for details + and rationale. + + The timestamp increases monotonically from some arbitrary point in time. + Don't make assumptions about the starting point, you will only get + disappointed. + + .. note:: + Use :c:func:`uv_hrtime` if you need sub-millisecond granularity. + +.. c:function:: void uv_update_time(uv_loop_t* loop) + + Update the event loop's concept of "now". Libuv caches the current time + at the start of the event loop tick in order to reduce the number of + time-related system calls. + + You won't normally need to call this function unless you have callbacks + that block the event loop for longer periods of time, where "longer" is + somewhat subjective but probably on the order of a millisecond or more. + +.. c:function:: void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) + + Walk the list of handles: `walk_cb` will be executed with the given `arg`. diff --git a/3rdparty/libuv/docs/src/migration_010_100.rst b/3rdparty/libuv/docs/src/migration_010_100.rst new file mode 100644 index 00000000000..bb6ac1a8092 --- /dev/null +++ b/3rdparty/libuv/docs/src/migration_010_100.rst @@ -0,0 +1,244 @@ + +.. _migration_010_100: + +libuv 0.10 -> 1.0.0 migration guide +=================================== + +Some APIs changed quite a bit throughout the 1.0.0 development process. Here +is a migration guide for the most significant changes that happened after 0.10 +was released. + + +Loop initialization and closing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In libuv 0.10 (and previous versions), loops were created with `uv_loop_new`, which +allocated memory for a new loop and initialized it; and destroyed with `uv_loop_delete`, +which destroyed the loop and freed the memory. Starting with 1.0, those are deprecated +and the user is responsible for allocating the memory and then initializing the loop. + +libuv 0.10 + +:: + + uv_loop_t* loop = uv_loop_new(); + ... + uv_loop_delete(loop); + +libuv 1.0 + +:: + + uv_loop_t* loop = malloc(sizeof *loop); + uv_loop_init(loop); + ... + uv_loop_close(loop); + free(loop); + +.. note:: + Error handling was omitted for brevity. Check the documentation for :c:func:`uv_loop_init` + and :c:func:`uv_loop_close`. + + +Error handling +~~~~~~~~~~~~~~ + +Error handling had a major overhaul in libuv 1.0. In general, functions and status parameters +would get 0 for success and -1 for failure on libuv 0.10, and the user had to use `uv_last_error` +to fetch the error code, which was a positive number. + +In 1.0, functions and status parameters contain the actual error code, which is 0 for success, or +a negative number in case of error. + +libuv 0.10 + +:: + + ... assume 'server' is a TCP server which is already listening + r = uv_listen((uv_stream_t*) server, 511, NULL); + if (r == -1) { + uv_err_t err = uv_last_error(uv_default_loop()); + /* err.code contains UV_EADDRINUSE */ + } + +libuv 1.0 + +:: + + ... assume 'server' is a TCP server which is already listening + r = uv_listen((uv_stream_t*) server, 511, NULL); + if (r < 0) { + /* r contains UV_EADDRINUSE */ + } + + +Threadpool changes +~~~~~~~~~~~~~~~~~~ + +In libuv 0.10 Unix used a threadpool which defaulted to 4 threads, while Windows used the +`QueueUserWorkItem` API, which uses a Windows internal threadpool, which defaults to 512 +threads per process. + +In 1.0, we unified both implementations, so Windows now uses the same implementation Unix +does. The threadpool size can be set by exporting the ``UV_THREADPOOL_SIZE`` environment +variable. See :c:ref:`threadpool`. + + +Allocation callback API change +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In libuv 0.10 the callback had to return a filled :c:type:`uv_buf_t` by value: + +:: + + uv_buf_t alloc_cb(uv_handle_t* handle, size_t size) { + return uv_buf_init(malloc(size), size); + } + +In libuv 1.0 a pointer to a buffer is passed to the callback, which the user +needs to fill: + +:: + + void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + buf->base = malloc(size); + buf->len = size; + } + + +Unification of IPv4 / IPv6 APIs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +libuv 1.0 unified the IPv4 and IPv6 APIS. There is no longer a `uv_tcp_bind` and `uv_tcp_bind6` +duality, there is only :c:func:`uv_tcp_bind` now. + +IPv4 functions took ``struct sockaddr_in`` structures by value, and IPv6 functions took +``struct sockaddr_in6``. Now functions take a ``struct sockaddr*`` (note it's a pointer). +It can be stack allocated. + +libuv 0.10 + +:: + + struct sockaddr_in addr = uv_ip4_addr("0.0.0.0", 1234); + ... + uv_tcp_bind(&server, addr) + +libuv 1.0 + +:: + + struct sockaddr_in addr; + uv_ip4_addr("0.0.0.0", 1234, &addr) + ... + uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); + +The IPv4 and IPv6 struct creating functions (:c:func:`uv_ip4_addr` and :c:func:`uv_ip6_addr`) +have also changed, make sure you check the documentation. + +..note:: + This change applies to all functions that made a distinction between IPv4 and IPv6 + addresses. + + +Streams / UDP data receive callback API change +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The streams and UDP data receive callbacks now get a pointer to a :c:type:`uv_buf_t` buffer, +not a structure by value. + +libuv 0.10 + +:: + + void on_read(uv_stream_t* handle, + ssize_t nread, + uv_buf_t buf) { + ... + } + + void recv_cb(uv_udp_t* handle, + ssize_t nread, + uv_buf_t buf, + struct sockaddr* addr, + unsigned flags) { + ... + } + +libuv 1.0 + +:: + + void on_read(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + ... + } + + void recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags) { + ... + } + + +Receiving handles over pipes API change +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In libuv 0.10 (and earlier versions) the `uv_read2_start` function was used to start reading +data on a pipe, which could also result in the reception of handles over it. The callback +for such function looked like this: + +:: + + void on_read(uv_pipe_t* pipe, + ssize_t nread, + uv_buf_t buf, + uv_handle_type pending) { + ... + } + +In libuv 1.0, `uv_read2_start` was removed, and the user needs to check if there are pending +handles using :c:func:`uv_pipe_pending_count` and :c:func:`uv_pipe_pending_type` while in +the read callback: + +:: + + void on_read(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + ... + while (uv_pipe_pending_count((uv_pipe_t*) handle) != 0) { + pending = uv_pipe_pending_type((uv_pipe_t*) handle); + ... + } + ... + } + + +Extracting the file descriptor out of a handle +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +While it wasn't supported by the API, users often accessed the libuv internals in +order to get access to the file descriptor of a TCP handle, for example. + +:: + + fd = handle->io_watcher.fd; + +This is now properly exposed through the :c:func:`uv_fileno` function. + + +uv_fs_readdir rename and API change +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`uv_fs_readdir` returned a list of strings in the `req->ptr` field upon completion in +libuv 0.10. In 1.0, this function got renamed to :c:func:`uv_fs_scandir`, since it's +actually implemented using ``scandir(3)``. + +In addition, instead of allocating a full list strings, the user is able to get one +result at a time by using the :c:func:`uv_fs_scandir_next` function. This function +does not need to make a roundtrip to the threadpool, because libuv will keep the +list of *dents* returned by ``scandir(3)`` around. diff --git a/3rdparty/libuv/docs/src/misc.rst b/3rdparty/libuv/docs/src/misc.rst new file mode 100644 index 00000000000..2ce0887db0c --- /dev/null +++ b/3rdparty/libuv/docs/src/misc.rst @@ -0,0 +1,328 @@ + +.. _misc: + +Miscellaneous utilities +======================= + +This section contains miscellaneous functions that don't really belong in any +other section. + + +Data types +---------- + +.. c:type:: uv_buf_t + + Buffer data type. + + .. c:member:: char* uv_buf_t.base + + Pointer to the base of the buffer. Readonly. + + .. c:member:: size_t uv_buf_t.len + + Total bytes in the buffer. Readonly. + + .. note:: + On Windows this field is ULONG. + +.. c:type:: void* (*uv_malloc_func)(size_t size) + + Replacement function for :man:`malloc(3)`. + See :c:func:`uv_replace_allocator`. + +.. c:type:: void* (*uv_realloc_func)(void* ptr, size_t size) + + Replacement function for :man:`realloc(3)`. + See :c:func:`uv_replace_allocator`. + +.. c:type:: void* (*uv_calloc_func)(size_t count, size_t size) + + Replacement function for :man:`calloc(3)`. + See :c:func:`uv_replace_allocator`. + +.. c:type:: void (*uv_free_func)(void* ptr) + + Replacement function for :man:`free(3)`. + See :c:func:`uv_replace_allocator`. + +.. c:type:: uv_file + + Cross platform representation of a file handle. + +.. c:type:: uv_os_sock_t + + Cross platform representation of a socket handle. + +.. c:type:: uv_os_fd_t + + Abstract representation of a file descriptor. On Unix systems this is a + `typedef` of `int` and on Windows a `HANDLE`. + +.. c:type:: uv_rusage_t + + Data type for resource usage results. + + :: + + typedef struct { + uv_timeval_t ru_utime; /* user CPU time used */ + uv_timeval_t ru_stime; /* system CPU time used */ + uint64_t ru_maxrss; /* maximum resident set size */ + uint64_t ru_ixrss; /* integral shared memory size */ + uint64_t ru_idrss; /* integral unshared data size */ + uint64_t ru_isrss; /* integral unshared stack size */ + uint64_t ru_minflt; /* page reclaims (soft page faults) */ + uint64_t ru_majflt; /* page faults (hard page faults) */ + uint64_t ru_nswap; /* swaps */ + uint64_t ru_inblock; /* block input operations */ + uint64_t ru_oublock; /* block output operations */ + uint64_t ru_msgsnd; /* IPC messages sent */ + uint64_t ru_msgrcv; /* IPC messages received */ + uint64_t ru_nsignals; /* signals received */ + uint64_t ru_nvcsw; /* voluntary context switches */ + uint64_t ru_nivcsw; /* involuntary context switches */ + } uv_rusage_t; + +.. c:type:: uv_cpu_info_t + + Data type for CPU information. + + :: + + typedef struct uv_cpu_info_s { + char* model; + int speed; + struct uv_cpu_times_s { + uint64_t user; + uint64_t nice; + uint64_t sys; + uint64_t idle; + uint64_t irq; + } cpu_times; + } uv_cpu_info_t; + +.. c:type:: uv_interface_address_t + + Data type for interface addresses. + + :: + + typedef struct uv_interface_address_s { + char* name; + char phys_addr[6]; + int is_internal; + union { + struct sockaddr_in address4; + struct sockaddr_in6 address6; + } address; + union { + struct sockaddr_in netmask4; + struct sockaddr_in6 netmask6; + } netmask; + } uv_interface_address_t; + + +API +--- + +.. c:function:: uv_handle_type uv_guess_handle(uv_file file) + + Used to detect what type of stream should be used with a given file + descriptor. Usually this will be used during initialization to guess the + type of the stdio streams. + + For :man:`isatty(3)` equivalent functionality use this function and test + for ``UV_TTY``. + +.. c:function:: int uv_replace_allocator(uv_malloc_func malloc_func, uv_realloc_func realloc_func, uv_calloc_func calloc_func, uv_free_func free_func) + + .. versionadded:: 1.6.0 + + Override the use of the standard library's :man:`malloc(3)`, + :man:`calloc(3)`, :man:`realloc(3)`, :man:`free(3)`, memory allocation + functions. + + This function must be called before any other libuv function is called or + after all resources have been freed and thus libuv doesn't reference + any allocated memory chunk. + + On success, it returns 0, if any of the function pointers is NULL it + returns UV_EINVAL. + + .. warning:: There is no protection against changing the allocator multiple + times. If the user changes it they are responsible for making + sure the allocator is changed while no memory was allocated with + the previous allocator, or that they are compatible. + +.. c:function:: uv_buf_t uv_buf_init(char* base, unsigned int len) + + Constructor for :c:type:`uv_buf_t`. + + Due to platform differences the user cannot rely on the ordering of the + `base` and `len` members of the uv_buf_t struct. The user is responsible for + freeing `base` after the uv_buf_t is done. Return struct passed by value. + +.. c:function:: char** uv_setup_args(int argc, char** argv) + + Store the program arguments. Required for getting / setting the process title. + +.. c:function:: int uv_get_process_title(char* buffer, size_t size) + + Gets the title of the current process. + +.. c:function:: int uv_set_process_title(const char* title) + + Sets the current process title. + +.. c:function:: int uv_resident_set_memory(size_t* rss) + + Gets the resident set size (RSS) for the current process. + +.. c:function:: int uv_uptime(double* uptime) + + Gets the current system uptime. + +.. c:function:: int uv_getrusage(uv_rusage_t* rusage) + + Gets the resource usage measures for the current process. + + .. note:: + On Windows not all fields are set, the unsupported fields are filled with zeroes. + +.. c:function:: int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) + + Gets information about the CPUs on the system. The `cpu_infos` array will + have `count` elements and needs to be freed with :c:func:`uv_free_cpu_info`. + +.. c:function:: void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) + + Frees the `cpu_infos` array previously allocated with :c:func:`uv_cpu_info`. + +.. c:function:: int uv_interface_addresses(uv_interface_address_t** addresses, int* count) + + Gets address information about the network interfaces on the system. An + array of `count` elements is allocated and returned in `addresses`. It must + be freed by the user, calling :c:func:`uv_free_interface_addresses`. + +.. c:function:: void uv_free_interface_addresses(uv_interface_address_t* addresses, int count) + + Free an array of :c:type:`uv_interface_address_t` which was returned by + :c:func:`uv_interface_addresses`. + +.. c:function:: void uv_loadavg(double avg[3]) + + Gets the load average. See: ``_ + + .. note:: + Returns [0,0,0] on Windows (i.e., it's not implemented). + +.. c:function:: int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr) + + Convert a string containing an IPv4 addresses to a binary structure. + +.. c:function:: int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr) + + Convert a string containing an IPv6 addresses to a binary structure. + +.. c:function:: int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size) + + Convert a binary structure containing an IPv4 address to a string. + +.. c:function:: int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size) + + Convert a binary structure containing an IPv6 address to a string. + +.. c:function:: int uv_inet_ntop(int af, const void* src, char* dst, size_t size) +.. c:function:: int uv_inet_pton(int af, const char* src, void* dst) + + Cross-platform IPv6-capable implementation of :man:`inet_ntop(3)` + and :man:`inet_pton(3)`. On success they return 0. In case of error + the target `dst` pointer is unmodified. + +.. c:function:: int uv_exepath(char* buffer, size_t* size) + + Gets the executable path. + +.. c:function:: int uv_cwd(char* buffer, size_t* size) + + Gets the current working directory. + + .. versionchanged:: 1.1.0 + + On Unix the path no longer ends in a slash. + +.. c:function:: int uv_chdir(const char* dir) + + Changes the current working directory. + +.. c:function:: int uv_os_homedir(char* buffer, size_t* size) + + Gets the current user's home directory. On Windows, `uv_os_homedir()` first + checks the `USERPROFILE` environment variable using + `GetEnvironmentVariableW()`. If `USERPROFILE` is not set, + `GetUserProfileDirectoryW()` is called. On all other operating systems, + `uv_os_homedir()` first checks the `HOME` environment variable using + :man:`getenv(3)`. If `HOME` is not set, :man:`getpwuid_r(3)` is called. The + user's home directory is stored in `buffer`. When `uv_os_homedir()` is + called, `size` indicates the maximum size of `buffer`. On success or + `UV_ENOBUFS` failure, `size` is set to the string length of `buffer`. + + .. warning:: + `uv_os_homedir()` is not thread safe. + + .. versionadded:: 1.6.0 + +.. uint64_t uv_get_free_memory(void) +.. c:function:: uint64_t uv_get_total_memory(void) + + Gets memory information (in bytes). + +.. c:function:: uint64_t uv_hrtime(void) + + Returns the current high-resolution real time. This is expressed in + nanoseconds. It is relative to an arbitrary time in the past. It is not + related to the time of day and therefore not subject to clock drift. The + primary use is for measuring performance between intervals. + + .. note:: + Not every platform can support nanosecond resolution; however, this value will always + be in nanoseconds. + +.. c:function:: void uv_print_all_handles(uv_loop_t* loop, FILE* stream) + + Prints all handles associated with the given `loop` to the given `stream`. + + Example: + + :: + + uv_print_all_handles(uv_default_loop(), stderr); + /* + [--I] signal 0x1a25ea8 + [-AI] async 0x1a25cf0 + [R--] idle 0x1a7a8c8 + */ + + The format is `[flags] handle-type handle-address`. For `flags`: + + - `R` is printed for a handle that is referenced + - `A` is printed for a handle that is active + - `I` is printed for a handle that is internal + + .. warning:: + This function is meant for ad hoc debugging, there is no API/ABI + stability guarantees. + + .. versionadded:: 1.8.0 + +.. c:function:: void uv_print_active_handles(uv_loop_t* loop, FILE* stream) + + This is the same as :c:func:`uv_print_all_handles` except only active handles + are printed. + + .. warning:: + This function is meant for ad hoc debugging, there is no API/ABI + stability guarantees. + + .. versionadded:: 1.8.0 diff --git a/3rdparty/libuv/docs/src/pipe.rst b/3rdparty/libuv/docs/src/pipe.rst new file mode 100644 index 00000000000..d33b0f2b977 --- /dev/null +++ b/3rdparty/libuv/docs/src/pipe.rst @@ -0,0 +1,104 @@ + +.. _pipe: + +:c:type:`uv_pipe_t` --- Pipe handle +=================================== + +Pipe handles provide an abstraction over local domain sockets on Unix and named +pipes on Windows. + +:c:type:`uv_pipe_t` is a 'subclass' of :c:type:`uv_stream_t`. + + +Data types +---------- + +.. c:type:: uv_pipe_t + + Pipe handle type. + + +Public members +^^^^^^^^^^^^^^ + +N/A + +.. seealso:: The :c:type:`uv_stream_t` members also apply. + + +API +--- + +.. c:function:: int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) + + Initialize a pipe handle. The `ipc` argument is a boolean to indicate if + this pipe will be used for handle passing between processes. + +.. c:function:: int uv_pipe_open(uv_pipe_t* handle, uv_file file) + + Open an existing file descriptor or HANDLE as a pipe. + + .. versionchanged:: 1.2.1 the file descriptor is set to non-blocking mode. + + .. note:: + The passed file descriptor or HANDLE is not checked for its type, but + it's required that it represents a valid pipe. + +.. c:function:: int uv_pipe_bind(uv_pipe_t* handle, const char* name) + + Bind the pipe to a file path (Unix) or a name (Windows). + + .. note:: + Paths on Unix get truncated to ``sizeof(sockaddr_un.sun_path)`` bytes, typically between + 92 and 108 bytes. + +.. c:function:: void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, const char* name, uv_connect_cb cb) + + Connect to the Unix domain socket or the named pipe. + + .. note:: + Paths on Unix get truncated to ``sizeof(sockaddr_un.sun_path)`` bytes, typically between + 92 and 108 bytes. + +.. c:function:: int uv_pipe_getsockname(const uv_pipe_t* handle, char* buffer, size_t* size) + + Get the name of the Unix domain socket or the named pipe. + + A preallocated buffer must be provided. The size parameter holds the length + of the buffer and it's set to the number of bytes written to the buffer on + output. If the buffer is not big enough ``UV_ENOBUFS`` will be returned and + len will contain the required size. + + .. versionchanged:: 1.3.0 the returned length no longer includes the terminating null byte, + and the buffer is not null terminated. + +.. c:function:: int uv_pipe_getpeername(const uv_pipe_t* handle, char* buffer, size_t* size) + + Get the name of the Unix domain socket or the named pipe to which the handle + is connected. + + A preallocated buffer must be provided. The size parameter holds the length + of the buffer and it's set to the number of bytes written to the buffer on + output. If the buffer is not big enough ``UV_ENOBUFS`` will be returned and + len will contain the required size. + + .. versionadded:: 1.3.0 + +.. c:function:: void uv_pipe_pending_instances(uv_pipe_t* handle, int count) + + Set the number of pending pipe instance handles when the pipe server is + waiting for connections. + + .. note:: + This setting applies to Windows only. + +.. c:function:: int uv_pipe_pending_count(uv_pipe_t* handle) +.. c:function:: uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) + + Used to receive handles over IPC pipes. + + First - call :c:func:`uv_pipe_pending_count`, if it's > 0 then initialize + a handle of the given `type`, returned by :c:func:`uv_pipe_pending_type` + and call ``uv_accept(pipe, handle)``. + +.. seealso:: The :c:type:`uv_stream_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/poll.rst b/3rdparty/libuv/docs/src/poll.rst new file mode 100644 index 00000000000..6dc41839ac1 --- /dev/null +++ b/3rdparty/libuv/docs/src/poll.rst @@ -0,0 +1,103 @@ + +.. _poll: + +:c:type:`uv_poll_t` --- Poll handle +=================================== + +Poll handles are used to watch file descriptors for readability and +writability, similar to the purpose of :man:`poll(2)`. + +The purpose of poll handles is to enable integrating external libraries that +rely on the event loop to signal it about the socket status changes, like +c-ares or libssh2. Using uv_poll_t for any other purpose is not recommended; +:c:type:`uv_tcp_t`, :c:type:`uv_udp_t`, etc. provide an implementation that is faster and +more scalable than what can be achieved with :c:type:`uv_poll_t`, especially on +Windows. + +It is possible that poll handles occasionally signal that a file descriptor is +readable or writable even when it isn't. The user should therefore always +be prepared to handle EAGAIN or equivalent when it attempts to read from or +write to the fd. + +It is not okay to have multiple active poll handles for the same socket, this +can cause libuv to busyloop or otherwise malfunction. + +The user should not close a file descriptor while it is being polled by an +active poll handle. This can cause the handle to report an error, +but it might also start polling another socket. However the fd can be safely +closed immediately after a call to :c:func:`uv_poll_stop` or :c:func:`uv_close`. + +.. note:: + On windows only sockets can be polled with poll handles. On Unix any file + descriptor that would be accepted by :man:`poll(2)` can be used. + + +Data types +---------- + +.. c:type:: uv_poll_t + + Poll handle type. + +.. c:type:: void (*uv_poll_cb)(uv_poll_t* handle, int status, int events) + + Type definition for callback passed to :c:func:`uv_poll_start`. + +.. c:type:: uv_poll_event + + Poll event types + + :: + + enum uv_poll_event { + UV_READABLE = 1, + UV_WRITABLE = 2 + }; + + +Public members +^^^^^^^^^^^^^^ + +N/A + +.. seealso:: The :c:type:`uv_handle_t` members also apply. + + +API +--- + +.. c:function:: int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) + + Initialize the handle using a file descriptor. + + .. versionchanged:: 1.2.2 the file descriptor is set to non-blocking mode. + +.. c:function:: int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle, uv_os_sock_t socket) + + Initialize the handle using a socket descriptor. On Unix this is identical + to :c:func:`uv_poll_init`. On windows it takes a SOCKET handle. + + .. versionchanged:: 1.2.2 the socket is set to non-blocking mode. + +.. c:function:: int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb) + + Starts polling the file descriptor. `events` is a bitmask consisting made up + of UV_READABLE and UV_WRITABLE. As soon as an event is detected the callback + will be called with `status` set to 0, and the detected events set on the + `events` field. + + If an error happens while polling, `status` will be < 0 and corresponds + with one of the UV_E* error codes (see :ref:`errors`). The user should + not close the socket while the handle is active. If the user does that + anyway, the callback *may* be called reporting an error status, but this + is **not** guaranteed. + + .. note:: + Calling :c:func:`uv_poll_start` on a handle that is already active is fine. Doing so + will update the events mask that is being watched for. + +.. c:function:: int uv_poll_stop(uv_poll_t* poll) + + Stop polling the file descriptor, the callback will no longer be called. + +.. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/prepare.rst b/3rdparty/libuv/docs/src/prepare.rst new file mode 100644 index 00000000000..aca58155809 --- /dev/null +++ b/3rdparty/libuv/docs/src/prepare.rst @@ -0,0 +1,46 @@ + +.. _prepare: + +:c:type:`uv_prepare_t` --- Prepare handle +========================================= + +Prepare handles will run the given callback once per loop iteration, right +before polling for i/o. + + +Data types +---------- + +.. c:type:: uv_prepare_t + + Prepare handle type. + +.. c:type:: void (*uv_prepare_cb)(uv_prepare_t* handle) + + Type definition for callback passed to :c:func:`uv_prepare_start`. + + +Public members +^^^^^^^^^^^^^^ + +N/A + +.. seealso:: The :c:type:`uv_handle_t` members also apply. + + +API +--- + +.. c:function:: int uv_prepare_init(uv_loop_t* loop, uv_prepare_t* prepare) + + Initialize the handle. + +.. c:function:: int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb) + + Start the handle with the given callback. + +.. c:function:: int uv_prepare_stop(uv_prepare_t* prepare) + + Stop the handle, the callback will no longer be called. + +.. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/process.rst b/3rdparty/libuv/docs/src/process.rst new file mode 100644 index 00000000000..b0380ddfb72 --- /dev/null +++ b/3rdparty/libuv/docs/src/process.rst @@ -0,0 +1,225 @@ + +.. _process: + +:c:type:`uv_process_t` --- Process handle +========================================= + +Process handles will spawn a new process and allow the user to control it and +establish communication channels with it using streams. + + +Data types +---------- + +.. c:type:: uv_process_t + + Process handle type. + +.. c:type:: uv_process_options_t + + Options for spawning the process (passed to :c:func:`uv_spawn`. + + :: + + typedef struct uv_process_options_s { + uv_exit_cb exit_cb; + const char* file; + char** args; + char** env; + const char* cwd; + unsigned int flags; + int stdio_count; + uv_stdio_container_t* stdio; + uv_uid_t uid; + uv_gid_t gid; + } uv_process_options_t; + +.. c:type:: void (*uv_exit_cb)(uv_process_t*, int64_t exit_status, int term_signal) + + Type definition for callback passed in :c:type:`uv_process_options_t` which + will indicate the exit status and the signal that caused the process to + terminate, if any. + +.. c:type:: uv_process_flags + + Flags to be set on the flags field of :c:type:`uv_process_options_t`. + + :: + + enum uv_process_flags { + /* + * Set the child process' user id. + */ + UV_PROCESS_SETUID = (1 << 0), + /* + * Set the child process' group id. + */ + UV_PROCESS_SETGID = (1 << 1), + /* + * Do not wrap any arguments in quotes, or perform any other escaping, when + * converting the argument list into a command line string. This option is + * only meaningful on Windows systems. On Unix it is silently ignored. + */ + UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS = (1 << 2), + /* + * Spawn the child process in a detached state - this will make it a process + * group leader, and will effectively enable the child to keep running after + * the parent exits. Note that the child process will still keep the + * parent's event loop alive unless the parent process calls uv_unref() on + * the child's process handle. + */ + UV_PROCESS_DETACHED = (1 << 3), + /* + * Hide the subprocess console window that would normally be created. This + * option is only meaningful on Windows systems. On Unix it is silently + * ignored. + */ + UV_PROCESS_WINDOWS_HIDE = (1 << 4) + }; + +.. c:type:: uv_stdio_container_t + + Container for each stdio handle or fd passed to a child process. + + :: + + typedef struct uv_stdio_container_s { + uv_stdio_flags flags; + union { + uv_stream_t* stream; + int fd; + } data; + } uv_stdio_container_t; + +.. c:type:: uv_stdio_flags + + Flags specifying how a stdio should be transmitted to the child process. + + :: + + typedef enum { + UV_IGNORE = 0x00, + UV_CREATE_PIPE = 0x01, + UV_INHERIT_FD = 0x02, + UV_INHERIT_STREAM = 0x04, + /* + * When UV_CREATE_PIPE is specified, UV_READABLE_PIPE and UV_WRITABLE_PIPE + * determine the direction of flow, from the child process' perspective. Both + * flags may be specified to create a duplex data stream. + */ + UV_READABLE_PIPE = 0x10, + UV_WRITABLE_PIPE = 0x20 + } uv_stdio_flags; + + +Public members +^^^^^^^^^^^^^^ + +.. c:member:: uv_process_t.pid + + The PID of the spawned process. It's set after calling :c:func:`uv_spawn`. + +.. note:: + The :c:type:`uv_handle_t` members also apply. + +.. c:member:: uv_process_options_t.exit_cb + + Callback called after the process exits. + +.. c:member:: uv_process_options_t.file + + Path pointing to the program to be executed. + +.. c:member:: uv_process_options_t.args + + Command line arguments. args[0] should be the path to the program. On + Windows this uses `CreateProcess` which concatenates the arguments into a + string this can cause some strange errors. See the + ``UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS`` flag on :c:type:`uv_process_flags`. + +.. c:member:: uv_process_options_t.env + + Environment for the new process. If NULL the parents environment is used. + +.. c:member:: uv_process_options_t.cwd + + Current working directory for the subprocess. + +.. c:member:: uv_process_options_t.flags + + Various flags that control how :c:func:`uv_spawn` behaves. See + :c:type:`uv_process_flags`. + +.. c:member:: uv_process_options_t.stdio_count +.. c:member:: uv_process_options_t.stdio + + The `stdio` field points to an array of :c:type:`uv_stdio_container_t` + structs that describe the file descriptors that will be made available to + the child process. The convention is that stdio[0] points to stdin, + fd 1 is used for stdout, and fd 2 is stderr. + + .. note:: + On Windows file descriptors greater than 2 are available to the child process only if + the child processes uses the MSVCRT runtime. + +.. c:member:: uv_process_options_t.uid +.. c:member:: uv_process_options_t.gid + + Libuv can change the child process' user/group id. This happens only when + the appropriate bits are set in the flags fields. + + .. note:: + This is not supported on Windows, :c:func:`uv_spawn` will fail and set the error + to ``UV_ENOTSUP``. + +.. c:member:: uv_stdio_container_t.flags + + Flags specifying how the stdio container should be passed to the child. See + :c:type:`uv_stdio_flags`. + +.. c:member:: uv_stdio_container_t.data + + Union containing either the stream or fd to be passed on to the child + process. + + +API +--- + +.. c:function:: void uv_disable_stdio_inheritance(void) + + Disables inheritance for file descriptors / handles that this process + inherited from its parent. The effect is that child processes spawned by + this process don't accidentally inherit these handles. + + It is recommended to call this function as early in your program as possible, + before the inherited file descriptors can be closed or duplicated. + + .. note:: + This function works on a best-effort basis: there is no guarantee that libuv can discover + all file descriptors that were inherited. In general it does a better job on Windows than + it does on Unix. + +.. c:function:: int uv_spawn(uv_loop_t* loop, uv_process_t* handle, const uv_process_options_t* options) + + Initializes the process handle and starts the process. If the process is + successfully spawned, this function will return 0. Otherwise, the + negative error code corresponding to the reason it couldn't spawn is + returned. + + Possible reasons for failing to spawn would include (but not be limited to) + the file to execute not existing, not having permissions to use the setuid or + setgid specified, or not having enough memory to allocate for the new + process. + +.. c:function:: int uv_process_kill(uv_process_t* handle, int signum) + + Sends the specified signal to the given process handle. Check the documentation + on :c:ref:`signal` for signal support, specially on Windows. + +.. c:function:: int uv_kill(int pid, int signum) + + Sends the specified signal to the given PID. Check the documentation + on :c:ref:`signal` for signal support, specially on Windows. + +.. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/request.rst b/3rdparty/libuv/docs/src/request.rst new file mode 100644 index 00000000000..660b80ae957 --- /dev/null +++ b/3rdparty/libuv/docs/src/request.rst @@ -0,0 +1,82 @@ + +.. _request: + +:c:type:`uv_req_t` --- Base request +=================================== + +`uv_req_t` is the base type for all libuv request types. + +Structures are aligned so that any libuv request can be cast to `uv_req_t`. +All API functions defined here work with any request type. + + +Data types +---------- + +.. c:type:: uv_req_t + + The base libuv request structure. + +.. c:type:: uv_any_req + + Union of all request types. + + +Public members +^^^^^^^^^^^^^^ + +.. c:member:: void* uv_req_t.data + + Space for user-defined arbitrary data. libuv does not use this field. + +.. c:member:: uv_req_type uv_req_t.type + + Indicated the type of request. Readonly. + + :: + + typedef enum { + UV_UNKNOWN_REQ = 0, + UV_REQ, + UV_CONNECT, + UV_WRITE, + UV_SHUTDOWN, + UV_UDP_SEND, + UV_FS, + UV_WORK, + UV_GETADDRINFO, + UV_GETNAMEINFO, + UV_REQ_TYPE_PRIVATE, + UV_REQ_TYPE_MAX, + } uv_req_type; + + +API +--- + +.. c:function:: int uv_cancel(uv_req_t* req) + + Cancel a pending request. Fails if the request is executing or has finished + executing. + + Returns 0 on success, or an error code < 0 on failure. + + Only cancellation of :c:type:`uv_fs_t`, :c:type:`uv_getaddrinfo_t`, + :c:type:`uv_getnameinfo_t` and :c:type:`uv_work_t` requests is + currently supported. + + Cancelled requests have their callbacks invoked some time in the future. + It's **not** safe to free the memory associated with the request until the + callback is called. + + Here is how cancellation is reported to the callback: + + * A :c:type:`uv_fs_t` request has its req->result field set to `UV_ECANCELED`. + + * A :c:type:`uv_work_t`, :c:type:`uv_getaddrinfo_t` or c:type:`uv_getnameinfo_t` + request has its callback invoked with status == `UV_ECANCELED`. + +.. c:function:: size_t uv_req_size(uv_req_type type) + + Returns the size of the given request type. Useful for FFI binding writers + who don't want to know the structure layout. diff --git a/3rdparty/libuv/docs/src/signal.rst b/3rdparty/libuv/docs/src/signal.rst new file mode 100644 index 00000000000..dc1223b90ac --- /dev/null +++ b/3rdparty/libuv/docs/src/signal.rst @@ -0,0 +1,77 @@ + +.. _signal: + +:c:type:`uv_signal_t` --- Signal handle +======================================= + +Signal handles implement Unix style signal handling on a per-event loop bases. + +Reception of some signals is emulated on Windows: + +* SIGINT is normally delivered when the user presses CTRL+C. However, like + on Unix, it is not generated when terminal raw mode is enabled. + +* SIGBREAK is delivered when the user pressed CTRL + BREAK. + +* SIGHUP is generated when the user closes the console window. On SIGHUP the + program is given approximately 10 seconds to perform cleanup. After that + Windows will unconditionally terminate it. + +* SIGWINCH is raised whenever libuv detects that the console has been + resized. SIGWINCH is emulated by libuv when the program uses a :c:type:`uv_tty_t` + handle to write to the console. SIGWINCH may not always be delivered in a + timely manner; libuv will only detect size changes when the cursor is + being moved. When a readable :c:type:`uv_tty_t` handle is used in raw mode, + resizing the console buffer will also trigger a SIGWINCH signal. + +Watchers for other signals can be successfully created, but these signals +are never received. These signals are: `SIGILL`, `SIGABRT`, `SIGFPE`, `SIGSEGV`, +`SIGTERM` and `SIGKILL.` + +Calls to raise() or abort() to programmatically raise a signal are +not detected by libuv; these will not trigger a signal watcher. + +.. note:: + On Linux SIGRT0 and SIGRT1 (signals 32 and 33) are used by the NPTL pthreads library to + manage threads. Installing watchers for those signals will lead to unpredictable behavior + and is strongly discouraged. Future versions of libuv may simply reject them. + + +Data types +---------- + +.. c:type:: uv_signal_t + + Signal handle type. + +.. c:type:: void (*uv_signal_cb)(uv_signal_t* handle, int signum) + + Type definition for callback passed to :c:func:`uv_signal_start`. + + +Public members +^^^^^^^^^^^^^^ + +.. c:member:: int uv_signal_t.signum + + Signal being monitored by this handle. Readonly. + +.. seealso:: The :c:type:`uv_handle_t` members also apply. + + +API +--- + +.. c:function:: int uv_signal_init(uv_loop_t* loop, uv_signal_t* signal) + + Initialize the handle. + +.. c:function:: int uv_signal_start(uv_signal_t* signal, uv_signal_cb cb, int signum) + + Start the handle with the given callback, watching for the given signal. + +.. c:function:: int uv_signal_stop(uv_signal_t* signal) + + Stop the handle, the callback will no longer be called. + +.. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/sphinx-plugins/manpage.py b/3rdparty/libuv/docs/src/sphinx-plugins/manpage.py new file mode 100644 index 00000000000..1d1dc379f41 --- /dev/null +++ b/3rdparty/libuv/docs/src/sphinx-plugins/manpage.py @@ -0,0 +1,46 @@ +# encoding: utf-8 + +# +# Copyright (c) 2013 Dariusz Dwornikowski. All rights reserved. +# +# Adapted from https://github.com/tdi/sphinxcontrib-manpage +# License: Apache 2 +# + + +import re + +from docutils import nodes, utils +from docutils.parsers.rst.roles import set_classes +from string import Template + + +def make_link_node(rawtext, app, name, manpage_num, options): + ref = app.config.man_url_regex + if not ref: + ref = "http://linux.die.net/man/%s/%s" % (manpage_num, name) + else: + s = Template(ref) + ref = s.substitute(num=manpage_num, topic=name) + set_classes(options) + node = nodes.reference(rawtext, "%s(%s)" % (name, manpage_num), refuri=ref, **options) + return node + + +def man_role(name, rawtext, text, lineno, inliner, options={}, content=[]): + app = inliner.document.settings.env.app + p = re.compile("([a-zA-Z0-9_\.-_]+)\((\d)\)") + m = p.match(text) + + manpage_num = m.group(2) + name = m.group(1) + node = make_link_node(rawtext, app, name, manpage_num, options) + return [node], [] + + +def setup(app): + app.info('Initializing manpage plugin') + app.add_role('man', man_role) + app.add_config_value('man_url_regex', None, 'env') + return + diff --git a/3rdparty/libuv/docs/src/static/architecture.png b/3rdparty/libuv/docs/src/static/architecture.png new file mode 100644 index 00000000000..81e8749f249 Binary files /dev/null and b/3rdparty/libuv/docs/src/static/architecture.png differ diff --git a/3rdparty/libuv/docs/src/static/diagrams.key/Data/st0-311.jpg b/3rdparty/libuv/docs/src/static/diagrams.key/Data/st0-311.jpg new file mode 100644 index 00000000000..439f5810936 Binary files /dev/null and b/3rdparty/libuv/docs/src/static/diagrams.key/Data/st0-311.jpg differ diff --git a/3rdparty/libuv/docs/src/static/diagrams.key/Data/st1-475.jpg b/3rdparty/libuv/docs/src/static/diagrams.key/Data/st1-475.jpg new file mode 100644 index 00000000000..ffb21ff2245 Binary files /dev/null and b/3rdparty/libuv/docs/src/static/diagrams.key/Data/st1-475.jpg differ diff --git a/3rdparty/libuv/docs/src/static/diagrams.key/Index.zip b/3rdparty/libuv/docs/src/static/diagrams.key/Index.zip new file mode 100644 index 00000000000..17aedace14f Binary files /dev/null and b/3rdparty/libuv/docs/src/static/diagrams.key/Index.zip differ diff --git a/3rdparty/libuv/docs/src/static/diagrams.key/Metadata/BuildVersionHistory.plist b/3rdparty/libuv/docs/src/static/diagrams.key/Metadata/BuildVersionHistory.plist new file mode 100644 index 00000000000..39dd4fe62fb --- /dev/null +++ b/3rdparty/libuv/docs/src/static/diagrams.key/Metadata/BuildVersionHistory.plist @@ -0,0 +1,8 @@ + + + + + Template: White (2014-02-28 09:41) + M6.2.2-1878-1 + + diff --git a/3rdparty/libuv/docs/src/static/diagrams.key/Metadata/DocumentIdentifier b/3rdparty/libuv/docs/src/static/diagrams.key/Metadata/DocumentIdentifier new file mode 100644 index 00000000000..ddb18f01f99 --- /dev/null +++ b/3rdparty/libuv/docs/src/static/diagrams.key/Metadata/DocumentIdentifier @@ -0,0 +1 @@ +F69E9CD9-EEF1-4223-9DA4-A1EA7FE112BA \ No newline at end of file diff --git a/3rdparty/libuv/docs/src/static/diagrams.key/Metadata/Properties.plist b/3rdparty/libuv/docs/src/static/diagrams.key/Metadata/Properties.plist new file mode 100644 index 00000000000..74bc69317de Binary files /dev/null and b/3rdparty/libuv/docs/src/static/diagrams.key/Metadata/Properties.plist differ diff --git a/3rdparty/libuv/docs/src/static/diagrams.key/preview-micro.jpg b/3rdparty/libuv/docs/src/static/diagrams.key/preview-micro.jpg new file mode 100644 index 00000000000..dd8decd6303 Binary files /dev/null and b/3rdparty/libuv/docs/src/static/diagrams.key/preview-micro.jpg differ diff --git a/3rdparty/libuv/docs/src/static/diagrams.key/preview-web.jpg b/3rdparty/libuv/docs/src/static/diagrams.key/preview-web.jpg new file mode 100644 index 00000000000..aadd401f1f0 Binary files /dev/null and b/3rdparty/libuv/docs/src/static/diagrams.key/preview-web.jpg differ diff --git a/3rdparty/libuv/docs/src/static/diagrams.key/preview.jpg b/3rdparty/libuv/docs/src/static/diagrams.key/preview.jpg new file mode 100644 index 00000000000..fc80025a4be Binary files /dev/null and b/3rdparty/libuv/docs/src/static/diagrams.key/preview.jpg differ diff --git a/3rdparty/libuv/docs/src/static/favicon.ico b/3rdparty/libuv/docs/src/static/favicon.ico new file mode 100644 index 00000000000..2c40694cd28 Binary files /dev/null and b/3rdparty/libuv/docs/src/static/favicon.ico differ diff --git a/3rdparty/libuv/docs/src/static/logo.png b/3rdparty/libuv/docs/src/static/logo.png new file mode 100644 index 00000000000..eaf1eee577b Binary files /dev/null and b/3rdparty/libuv/docs/src/static/logo.png differ diff --git a/3rdparty/libuv/docs/src/static/loop_iteration.png b/3rdparty/libuv/docs/src/static/loop_iteration.png new file mode 100644 index 00000000000..e769cf338b4 Binary files /dev/null and b/3rdparty/libuv/docs/src/static/loop_iteration.png differ diff --git a/3rdparty/libuv/docs/src/stream.rst b/3rdparty/libuv/docs/src/stream.rst new file mode 100644 index 00000000000..9f0aacd1643 --- /dev/null +++ b/3rdparty/libuv/docs/src/stream.rst @@ -0,0 +1,219 @@ + +.. _stream: + +:c:type:`uv_stream_t` --- Stream handle +======================================= + +Stream handles provide an abstraction of a duplex communication channel. +:c:type:`uv_stream_t` is an abstract type, libuv provides 3 stream implementations +in the for of :c:type:`uv_tcp_t`, :c:type:`uv_pipe_t` and :c:type:`uv_tty_t`. + + +Data types +---------- + +.. c:type:: uv_stream_t + + Stream handle type. + +.. c:type:: uv_connect_t + + Connect request type. + +.. c:type:: uv_shutdown_t + + Shutdown request type. + +.. c:type:: uv_write_t + + Write request type. + +.. c:type:: void (*uv_read_cb)(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) + + Callback called when data was read on a stream. + + `nread` is > 0 if there is data available or < 0 on error. When we've + reached EOF, `nread` will be set to ``UV_EOF``. When `nread` < 0, + the `buf` parameter might not point to a valid buffer; in that case + `buf.len` and `buf.base` are both set to 0. + + .. note:: + `nread` might be 0, which does *not* indicate an error or EOF. This + is equivalent to ``EAGAIN`` or ``EWOULDBLOCK`` under ``read(2)``. + + The callee is responsible for stopping closing the stream when an error happens + by calling :c:func:`uv_read_stop` or :c:func:`uv_close`. Trying to read + from the stream again is undefined. + + The callee is responsible for freeing the buffer, libuv does not reuse it. + The buffer may be a null buffer (where buf->base=NULL and buf->len=0) on + error. + +.. c:type:: void (*uv_write_cb)(uv_write_t* req, int status) + + Callback called after data was written on a stream. `status` will be 0 in + case of success, < 0 otherwise. + +.. c:type:: void (*uv_connect_cb)(uv_connect_t* req, int status) + + Callback called after a connection started by :c:func:`uv_connect` is done. + `status` will be 0 in case of success, < 0 otherwise. + +.. c:type:: void (*uv_shutdown_cb)(uv_shutdown_t* req, int status) + + Callback called after s shutdown request has been completed. `status` will + be 0 in case of success, < 0 otherwise. + +.. c:type:: void (*uv_connection_cb)(uv_stream_t* server, int status) + + Callback called when a stream server has received an incoming connection. + The user can accept the connection by calling :c:func:`uv_accept`. + `status` will be 0 in case of success, < 0 otherwise. + + +Public members +^^^^^^^^^^^^^^ + +.. c:member:: size_t uv_stream_t.write_queue_size + + Contains the amount of queued bytes waiting to be sent. Readonly. + +.. c:member:: uv_stream_t* uv_connect_t.handle + + Pointer to the stream where this connection request is running. + +.. c:member:: uv_stream_t* uv_shutdown_t.handle + + Pointer to the stream where this shutdown request is running. + +.. c:member:: uv_stream_t* uv_write_t.handle + + Pointer to the stream where this write request is running. + +.. c:member:: uv_stream_t* uv_write_t.send_handle + + Pointer to the stream being sent using this write request.. + +.. seealso:: The :c:type:`uv_handle_t` members also apply. + + +API +--- + +.. c:function:: int uv_shutdown(uv_shutdown_t* req, uv_stream_t* handle, uv_shutdown_cb cb) + + Shutdown the outgoing (write) side of a duplex stream. It waits for pending + write requests to complete. The `handle` should refer to a initialized stream. + `req` should be an uninitialized shutdown request struct. The `cb` is called + after shutdown is complete. + +.. c:function:: int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb) + + Start listening for incoming connections. `backlog` indicates the number of + connections the kernel might queue, same as :man:`listen(2)`. When a new + incoming connection is received the :c:type:`uv_connection_cb` callback is + called. + +.. c:function:: int uv_accept(uv_stream_t* server, uv_stream_t* client) + + This call is used in conjunction with :c:func:`uv_listen` to accept incoming + connections. Call this function after receiving a :c:type:`uv_connection_cb` + to accept the connection. Before calling this function the client handle must + be initialized. < 0 return value indicates an error. + + When the :c:type:`uv_connection_cb` callback is called it is guaranteed that + this function will complete successfully the first time. If you attempt to use + it more than once, it may fail. It is suggested to only call this function once + per :c:type:`uv_connection_cb` call. + + .. note:: + `server` and `client` must be handles running on the same loop. + +.. c:function:: int uv_read_start(uv_stream_t* stream, uv_alloc_cb alloc_cb, uv_read_cb read_cb) + + Read data from an incoming stream. The :c:type:`uv_read_cb` callback will + be made several times until there is no more data to read or + :c:func:`uv_read_stop` is called. + +.. c:function:: int uv_read_stop(uv_stream_t*) + + Stop reading data from the stream. The :c:type:`uv_read_cb` callback will + no longer be called. + + This function is idempotent and may be safely called on a stopped stream. + +.. c:function:: int uv_write(uv_write_t* req, uv_stream_t* handle, const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb) + + Write data to stream. Buffers are written in order. Example: + + :: + + uv_buf_t a[] = { + { .base = "1", .len = 1 }, + { .base = "2", .len = 1 } + }; + + uv_buf_t b[] = { + { .base = "3", .len = 1 }, + { .base = "4", .len = 1 } + }; + + uv_write_t req1; + uv_write_t req2; + + /* writes "1234" */ + uv_write(&req1, stream, a, 2); + uv_write(&req2, stream, b, 2); + +.. c:function:: int uv_write2(uv_write_t* req, uv_stream_t* handle, const uv_buf_t bufs[], unsigned int nbufs, uv_stream_t* send_handle, uv_write_cb cb) + + Extended write function for sending handles over a pipe. The pipe must be + initialized with `ipc` == 1. + + .. note:: + `send_handle` must be a TCP socket or pipe, which is a server or a connection (listening + or connected state). Bound sockets or pipes will be assumed to be servers. + +.. c:function:: int uv_try_write(uv_stream_t* handle, const uv_buf_t bufs[], unsigned int nbufs) + + Same as :c:func:`uv_write`, but won't queue a write request if it can't be + completed immediately. + + Will return either: + + * > 0: number of bytes written (can be less than the supplied buffer size). + * < 0: negative error code (``UV_EAGAIN`` is returned if no data can be sent + immediately). + +.. c:function:: int uv_is_readable(const uv_stream_t* handle) + + Returns 1 if the stream is readable, 0 otherwise. + +.. c:function:: int uv_is_writable(const uv_stream_t* handle) + + Returns 1 if the stream is writable, 0 otherwise. + +.. c:function:: int uv_stream_set_blocking(uv_stream_t* handle, int blocking) + + Enable or disable blocking mode for a stream. + + When blocking mode is enabled all writes complete synchronously. The + interface remains unchanged otherwise, e.g. completion or failure of the + operation will still be reported through a callback which is made + asynchronously. + + .. warning:: + Relying too much on this API is not recommended. It is likely to change + significantly in the future. + + Currently only works on Windows for :c:type:`uv_pipe_t` handles. + On UNIX platforms, all :c:type:`uv_stream_t` handles are supported. + + Also libuv currently makes no ordering guarantee when the blocking mode + is changed after write requests have already been submitted. Therefore it is + recommended to set the blocking mode immediately after opening or creating + the stream. + + .. versionchanged:: 1.4.0 UNIX implementation added. + +.. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/tcp.rst b/3rdparty/libuv/docs/src/tcp.rst new file mode 100644 index 00000000000..ca0c9b4ac5a --- /dev/null +++ b/3rdparty/libuv/docs/src/tcp.rst @@ -0,0 +1,108 @@ + +.. _tcp: + +:c:type:`uv_tcp_t` --- TCP handle +================================= + +TCP handles are used to represent both TCP streams and servers. + +:c:type:`uv_tcp_t` is a 'subclass' of :c:type:`uv_stream_t`. + + +Data types +---------- + +.. c:type:: uv_tcp_t + + TCP handle type. + + +Public members +^^^^^^^^^^^^^^ + +N/A + +.. seealso:: The :c:type:`uv_stream_t` members also apply. + + +API +--- + +.. c:function:: int uv_tcp_init(uv_loop_t* loop, uv_tcp_t* handle) + + Initialize the handle. No socket is created as of yet. + +.. c:function:: int uv_tcp_init_ex(uv_loop_t* loop, uv_tcp_t* handle, unsigned int flags) + + Initialize the handle with the specified flags. At the moment only the lower 8 bits + of the `flags` parameter are used as the socket domain. A socket will be created + for the given domain. If the specified domain is ``AF_UNSPEC`` no socket is created, + just like :c:func:`uv_tcp_init`. + + .. versionadded:: 1.7.0 + +.. c:function:: int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock) + + Open an existing file descriptor or SOCKET as a TCP handle. + + .. versionchanged:: 1.2.1 the file descriptor is set to non-blocking mode. + + .. note:: + The passed file descriptor or SOCKET is not checked for its type, but + it's required that it represents a valid stream socket. + +.. c:function:: int uv_tcp_nodelay(uv_tcp_t* handle, int enable) + + Enable / disable Nagle's algorithm. + +.. c:function:: int uv_tcp_keepalive(uv_tcp_t* handle, int enable, unsigned int delay) + + Enable / disable TCP keep-alive. `delay` is the initial delay in seconds, + ignored when `enable` is zero. + +.. c:function:: int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) + + Enable / disable simultaneous asynchronous accept requests that are + queued by the operating system when listening for new TCP connections. + + This setting is used to tune a TCP server for the desired performance. + Having simultaneous accepts can significantly improve the rate of accepting + connections (which is why it is enabled by default) but may lead to uneven + load distribution in multi-process setups. + +.. c:function:: int uv_tcp_bind(uv_tcp_t* handle, const struct sockaddr* addr, unsigned int flags) + + Bind the handle to an address and port. `addr` should point to an + initialized ``struct sockaddr_in`` or ``struct sockaddr_in6``. + + When the port is already taken, you can expect to see an ``UV_EADDRINUSE`` + error from either :c:func:`uv_tcp_bind`, :c:func:`uv_listen` or + :c:func:`uv_tcp_connect`. That is, a successful call to this function does + not guarantee that the call to :c:func:`uv_listen` or :c:func:`uv_tcp_connect` + will succeed as well. + + `flags` can contain ``UV_TCP_IPV6ONLY``, in which case dual-stack support + is disabled and only IPv6 is used. + +.. c:function:: int uv_tcp_getsockname(const uv_tcp_t* handle, struct sockaddr* name, int* namelen) + + Get the current address to which the handle is bound. `addr` must point to + a valid and big enough chunk of memory, ``struct sockaddr_storage`` is + recommended for IPv4 and IPv6 support. + +.. c:function:: int uv_tcp_getpeername(const uv_tcp_t* handle, struct sockaddr* name, int* namelen) + + Get the address of the peer connected to the handle. `addr` must point to + a valid and big enough chunk of memory, ``struct sockaddr_storage`` is + recommended for IPv4 and IPv6 support. + +.. c:function:: int uv_tcp_connect(uv_connect_t* req, uv_tcp_t* handle, const struct sockaddr* addr, uv_connect_cb cb) + + Establish an IPv4 or IPv6 TCP connection. Provide an initialized TCP handle + and an uninitialized :c:type:`uv_connect_t`. `addr` should point to an + initialized ``struct sockaddr_in`` or ``struct sockaddr_in6``. + + The callback is made when the connection has been established or when a + connection error happened. + +.. seealso:: The :c:type:`uv_stream_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/threading.rst b/3rdparty/libuv/docs/src/threading.rst new file mode 100644 index 00000000000..e876dde1256 --- /dev/null +++ b/3rdparty/libuv/docs/src/threading.rst @@ -0,0 +1,160 @@ + +.. _threading: + +Threading and synchronization utilities +======================================= + +libuv provides cross-platform implementations for multiple threading and +synchronization primitives. The API largely follows the pthreads API. + + +Data types +---------- + +.. c:type:: uv_thread_t + + Thread data type. + +.. c:type:: void (*uv_thread_cb)(void* arg) + + Callback that is invoked to initialize thread execution. `arg` is the same + value that was passed to :c:func:`uv_thread_create`. + +.. c:type:: uv_key_t + + Thread-local key data type. + +.. c:type:: uv_once_t + + Once-only initializer data type. + +.. c:type:: uv_mutex_t + + Mutex data type. + +.. c:type:: uv_rwlock_t + + Read-write lock data type. + +.. c:type:: uv_sem_t + + Semaphore data type. + +.. c:type:: uv_cond_t + + Condition data type. + +.. c:type:: uv_barrier_t + + Barrier data type. + + +API +--- + +Threads +^^^^^^^ + +.. c:function:: int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg) + + .. versionchanged:: 1.4.1 returns a UV_E* error code on failure + +.. c:function:: uv_thread_t uv_thread_self(void) +.. c:function:: int uv_thread_join(uv_thread_t *tid) +.. c:function:: int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2) + +Thread-local storage +^^^^^^^^^^^^^^^^^^^^ + +.. note:: + The total thread-local storage size may be limited. That is, it may not be possible to + create many TLS keys. + +.. c:function:: int uv_key_create(uv_key_t* key) +.. c:function:: void uv_key_delete(uv_key_t* key) +.. c:function:: void* uv_key_get(uv_key_t* key) +.. c:function:: void uv_key_set(uv_key_t* key, void* value) + +Once-only initialization +^^^^^^^^^^^^^^^^^^^^^^^^ + +Runs a function once and only once. Concurrent calls to :c:func:`uv_once` with the +same guard will block all callers except one (it's unspecified which one). +The guard should be initialized statically with the UV_ONCE_INIT macro. + +.. c:function:: void uv_once(uv_once_t* guard, void (*callback)(void)) + +Mutex locks +^^^^^^^^^^^ + +Functions return 0 on success or an error code < 0 (unless the +return type is void, of course). + +.. c:function:: int uv_mutex_init(uv_mutex_t* handle) +.. c:function:: void uv_mutex_destroy(uv_mutex_t* handle) +.. c:function:: void uv_mutex_lock(uv_mutex_t* handle) +.. c:function:: int uv_mutex_trylock(uv_mutex_t* handle) +.. c:function:: void uv_mutex_unlock(uv_mutex_t* handle) + +Read-write locks +^^^^^^^^^^^^^^^^ + +Functions return 0 on success or an error code < 0 (unless the +return type is void, of course). + +.. c:function:: int uv_rwlock_init(uv_rwlock_t* rwlock) +.. c:function:: void uv_rwlock_destroy(uv_rwlock_t* rwlock) +.. c:function:: void uv_rwlock_rdlock(uv_rwlock_t* rwlock) +.. c:function:: int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock) +.. c:function:: void uv_rwlock_rdunlock(uv_rwlock_t* rwlock) +.. c:function:: void uv_rwlock_wrlock(uv_rwlock_t* rwlock) +.. c:function:: int uv_rwlock_trywrlock(uv_rwlock_t* rwlock) +.. c:function:: void uv_rwlock_wrunlock(uv_rwlock_t* rwlock) + +Semaphores +^^^^^^^^^^ + +Functions return 0 on success or an error code < 0 (unless the +return type is void, of course). + +.. c:function:: int uv_sem_init(uv_sem_t* sem, unsigned int value) +.. c:function:: void uv_sem_destroy(uv_sem_t* sem) +.. c:function:: void uv_sem_post(uv_sem_t* sem) +.. c:function:: void uv_sem_wait(uv_sem_t* sem) +.. c:function:: int uv_sem_trywait(uv_sem_t* sem) + +Conditions +^^^^^^^^^^ + +Functions return 0 on success or an error code < 0 (unless the +return type is void, of course). + +.. note:: + Callers should be prepared to deal with spurious wakeups on :c:func:`uv_cond_wait` and + :c:func:`uv_cond_timedwait`. + +.. c:function:: int uv_cond_init(uv_cond_t* cond) +.. c:function:: void uv_cond_destroy(uv_cond_t* cond) +.. c:function:: void uv_cond_signal(uv_cond_t* cond) +.. c:function:: void uv_cond_broadcast(uv_cond_t* cond) +.. c:function:: void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex) +.. c:function:: int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) + +Barriers +^^^^^^^^ + +Functions return 0 on success or an error code < 0 (unless the +return type is void, of course). + +.. note:: + :c:func:`uv_barrier_wait` returns a value > 0 to an arbitrarily chosen "serializer" thread + to facilitate cleanup, i.e. + + :: + + if (uv_barrier_wait(&barrier) > 0) + uv_barrier_destroy(&barrier); + +.. c:function:: int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) +.. c:function:: void uv_barrier_destroy(uv_barrier_t* barrier) +.. c:function:: int uv_barrier_wait(uv_barrier_t* barrier) diff --git a/3rdparty/libuv/docs/src/threadpool.rst b/3rdparty/libuv/docs/src/threadpool.rst new file mode 100644 index 00000000000..18949507e75 --- /dev/null +++ b/3rdparty/libuv/docs/src/threadpool.rst @@ -0,0 +1,67 @@ + +.. _threadpool: + +Thread pool work scheduling +=========================== + +libuv provides a threadpool which can be used to run user code and get notified +in the loop thread. This thread pool is internally used to run all filesystem +operations, as well as getaddrinfo and getnameinfo requests. + +Its default size is 4, but it can be changed at startup time by setting the +``UV_THREADPOOL_SIZE`` environment variable to any value (the absolute maximum +is 128). + +The threadpool is global and shared across all event loops. When a particular +function makes use of the threadpool (i.e. when using :c:func:`uv_queue_work`) +libuv preallocates and initializes the maximum number of threads allowed by +``UV_THREADPOOL_SIZE``. This causes a relatively minor memory overhead +(~1MB for 128 threads) but increases the performance of threading at runtime. + +.. note:: + Note that even though a global thread pool which is shared across all events + loops is used, the functions are not thread safe. + + +Data types +---------- + +.. c:type:: uv_work_t + + Work request type. + +.. c:type:: void (*uv_work_cb)(uv_work_t* req) + + Callback passed to :c:func:`uv_queue_work` which will be run on the thread + pool. + +.. c:type:: void (*uv_after_work_cb)(uv_work_t* req, int status) + + Callback passed to :c:func:`uv_queue_work` which will be called on the loop + thread after the work on the threadpool has been completed. If the work + was cancelled using :c:func:`uv_cancel` `status` will be ``UV_ECANCELED``. + + +Public members +^^^^^^^^^^^^^^ + +.. c:member:: uv_loop_t* uv_work_t.loop + + Loop that started this request and where completion will be reported. + Readonly. + +.. seealso:: The :c:type:`uv_req_t` members also apply. + + +API +--- + +.. c:function:: int uv_queue_work(uv_loop_t* loop, uv_work_t* req, uv_work_cb work_cb, uv_after_work_cb after_work_cb) + + Initializes a work request which will run the given `work_cb` in a thread + from the threadpool. Once `work_cb` is completed, `after_work_cb` will be + called on the loop thread. + + This request can be cancelled with :c:func:`uv_cancel`. + +.. seealso:: The :c:type:`uv_req_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/timer.rst b/3rdparty/libuv/docs/src/timer.rst new file mode 100644 index 00000000000..31d733efc39 --- /dev/null +++ b/3rdparty/libuv/docs/src/timer.rst @@ -0,0 +1,76 @@ + +.. _timer: + +:c:type:`uv_timer_t` --- Timer handle +===================================== + +Timer handles are used to schedule callbacks to be called in the future. + + +Data types +---------- + +.. c:type:: uv_timer_t + + Timer handle type. + +.. c:type:: void (*uv_timer_cb)(uv_timer_t* handle) + + Type definition for callback passed to :c:func:`uv_timer_start`. + + +Public members +^^^^^^^^^^^^^^ + +N/A + +.. seealso:: The :c:type:`uv_handle_t` members also apply. + + +API +--- + +.. c:function:: int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) + + Initialize the handle. + +.. c:function:: int uv_timer_start(uv_timer_t* handle, uv_timer_cb cb, uint64_t timeout, uint64_t repeat) + + Start the timer. `timeout` and `repeat` are in milliseconds. + + If `timeout` is zero, the callback fires on the next event loop iteration. + If `repeat` is non-zero, the callback fires first after `timeout` + milliseconds and then repeatedly after `repeat` milliseconds. + +.. c:function:: int uv_timer_stop(uv_timer_t* handle) + + Stop the timer, the callback will not be called anymore. + +.. c:function:: int uv_timer_again(uv_timer_t* handle) + + Stop the timer, and if it is repeating restart it using the repeat value + as the timeout. If the timer has never been started before it returns + UV_EINVAL. + +.. c:function:: void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat) + + Set the repeat interval value in milliseconds. The timer will be scheduled + to run on the given interval, regardless of the callback execution + duration, and will follow normal timer semantics in the case of a + time-slice overrun. + + For example, if a 50ms repeating timer first runs for 17ms, it will be + scheduled to run again 33ms later. If other tasks consume more than the + 33ms following the first timer callback, then the callback will run as soon + as possible. + + .. note:: + If the repeat value is set from a timer callback it does not immediately take effect. + If the timer was non-repeating before, it will have been stopped. If it was repeating, + then the old repeat value will have been used to schedule the next timeout. + +.. c:function:: uint64_t uv_timer_get_repeat(const uv_timer_t* handle) + + Get the timer repeat value. + +.. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/tty.rst b/3rdparty/libuv/docs/src/tty.rst new file mode 100644 index 00000000000..655dca9ca20 --- /dev/null +++ b/3rdparty/libuv/docs/src/tty.rst @@ -0,0 +1,93 @@ + +.. _tty: + +:c:type:`uv_tty_t` --- TTY handle +================================= + +TTY handles represent a stream for the console. + +:c:type:`uv_tty_t` is a 'subclass' of :c:type:`uv_stream_t`. + + +Data types +---------- + +.. c:type:: uv_tty_t + + TTY handle type. + +.. c:type:: uv_tty_mode_t + + .. versionadded:: 1.2.0 + + TTY mode type: + + :: + + typedef enum { + /* Initial/normal terminal mode */ + UV_TTY_MODE_NORMAL, + /* Raw input mode (On Windows, ENABLE_WINDOW_INPUT is also enabled) */ + UV_TTY_MODE_RAW, + /* Binary-safe I/O mode for IPC (Unix-only) */ + UV_TTY_MODE_IO + } uv_tty_mode_t; + + + +Public members +^^^^^^^^^^^^^^ + +N/A + +.. seealso:: The :c:type:`uv_stream_t` members also apply. + + +API +--- + +.. c:function:: int uv_tty_init(uv_loop_t* loop, uv_tty_t* handle, uv_file fd, int readable) + + Initialize a new TTY stream with the given file descriptor. Usually the + file descriptor will be: + + * 0 = stdin + * 1 = stdout + * 2 = stderr + + `readable`, specifies if you plan on calling :c:func:`uv_read_start` with + this stream. stdin is readable, stdout is not. + + On Unix this function will try to open ``/dev/tty`` and use it if the passed + file descriptor refers to a TTY. This lets libuv put the tty in non-blocking + mode without affecting other processes that share the tty. + + .. note:: + If opening ``/dev/tty`` fails, libuv falls back to blocking writes for + non-readable TTY streams. + + .. versionchanged:: 1.5.0: trying to initialize a TTY stream with a file + descriptor that refers to a file returns `UV_EINVAL` + on UNIX. + +.. c:function:: int uv_tty_set_mode(uv_tty_t* handle, uv_tty_mode_t mode) + + .. versionchanged:: 1.2.0: the mode is specified as a + :c:type:`uv_tty_mode_t` value. + + Set the TTY using the specified terminal mode. + +.. c:function:: int uv_tty_reset_mode(void) + + To be called when the program exits. Resets TTY settings to default + values for the next process to take over. + + This function is async signal-safe on Unix platforms but can fail with error + code ``UV_EBUSY`` if you call it when execution is inside + :c:func:`uv_tty_set_mode`. + +.. c:function:: int uv_tty_get_winsize(uv_tty_t* handle, int* width, int* height) + + Gets the current Window size. On success it returns 0. + +.. seealso:: The :c:type:`uv_stream_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/udp.rst b/3rdparty/libuv/docs/src/udp.rst new file mode 100644 index 00000000000..dd46603394e --- /dev/null +++ b/3rdparty/libuv/docs/src/udp.rst @@ -0,0 +1,295 @@ + +.. _udp: + +:c:type:`uv_udp_t` --- UDP handle +================================= + +UDP handles encapsulate UDP communication for both clients and servers. + + +Data types +---------- + +.. c:type:: uv_udp_t + + UDP handle type. + +.. c:type:: uv_udp_send_t + + UDP send request type. + +.. c:type:: uv_udp_flags + + Flags used in :c:func:`uv_udp_bind` and :c:type:`uv_udp_recv_cb`.. + + :: + + enum uv_udp_flags { + /* Disables dual stack mode. */ + UV_UDP_IPV6ONLY = 1, + /* + * Indicates message was truncated because read buffer was too small. The + * remainder was discarded by the OS. Used in uv_udp_recv_cb. + */ + UV_UDP_PARTIAL = 2, + /* + * Indicates if SO_REUSEADDR will be set when binding the handle in + * uv_udp_bind. + * This sets the SO_REUSEPORT socket flag on the BSDs and OS X. On other + * Unix platforms, it sets the SO_REUSEADDR flag. What that means is that + * multiple threads or processes can bind to the same address without error + * (provided they all set the flag) but only the last one to bind will receive + * any traffic, in effect "stealing" the port from the previous listener. + */ + UV_UDP_REUSEADDR = 4 + }; + +.. c:type:: void (*uv_udp_send_cb)(uv_udp_send_t* req, int status) + + Type definition for callback passed to :c:func:`uv_udp_send`, which is + called after the data was sent. + +.. c:type:: void (*uv_udp_recv_cb)(uv_udp_t* handle, ssize_t nread, const uv_buf_t* buf, const struct sockaddr* addr, unsigned flags) + + Type definition for callback passed to :c:func:`uv_udp_recv_start`, which + is called when the endpoint receives data. + + * `handle`: UDP handle + * `nread`: Number of bytes that have been received. + 0 if there is no more data to read. You may discard or repurpose + the read buffer. Note that 0 may also mean that an empty datagram + was received (in this case `addr` is not NULL). < 0 if a transmission + error was detected. + * `buf`: :c:type:`uv_buf_t` with the received data. + * `addr`: ``struct sockaddr*`` containing the address of the sender. + Can be NULL. Valid for the duration of the callback only. + * `flags`: One or more or'ed UV_UDP_* constants. Right now only + ``UV_UDP_PARTIAL`` is used. + + .. note:: + The receive callback will be called with `nread` == 0 and `addr` == NULL when there is + nothing to read, and with `nread` == 0 and `addr` != NULL when an empty UDP packet is + received. + +.. c:type:: uv_membership + + Membership type for a multicast address. + + :: + + typedef enum { + UV_LEAVE_GROUP = 0, + UV_JOIN_GROUP + } uv_membership; + + +Public members +^^^^^^^^^^^^^^ + +.. c:member:: size_t uv_udp_t.send_queue_size + + Number of bytes queued for sending. This field strictly shows how much + information is currently queued. + +.. c:member:: size_t uv_udp_t.send_queue_count + + Number of send requests currently in the queue awaiting to be processed. + +.. c:member:: uv_udp_t* uv_udp_send_t.handle + + UDP handle where this send request is taking place. + +.. seealso:: The :c:type:`uv_handle_t` members also apply. + + +API +--- + +.. c:function:: int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) + + Initialize a new UDP handle. The actual socket is created lazily. + Returns 0 on success. + +.. c:function:: int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) + + Initialize the handle with the specified flags. At the moment the lower 8 bits + of the `flags` parameter are used as the socket domain. A socket will be created + for the given domain. If the specified domain is ``AF_UNSPEC`` no socket is created, + just like :c:func:`uv_udp_init`. + + .. versionadded:: 1.7.0 + +.. c:function:: int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) + + Opens an existing file descriptor or Windows SOCKET as a UDP handle. + + Unix only: + The only requirement of the `sock` argument is that it follows the datagram + contract (works in unconnected mode, supports sendmsg()/recvmsg(), etc). + In other words, other datagram-type sockets like raw sockets or netlink + sockets can also be passed to this function. + + .. versionchanged:: 1.2.1 the file descriptor is set to non-blocking mode. + + .. note:: + The passed file descriptor or SOCKET is not checked for its type, but + it's required that it represents a valid datagram socket. + +.. c:function:: int uv_udp_bind(uv_udp_t* handle, const struct sockaddr* addr, unsigned int flags) + + Bind the UDP handle to an IP address and port. + + :param handle: UDP handle. Should have been initialized with + :c:func:`uv_udp_init`. + + :param addr: `struct sockaddr_in` or `struct sockaddr_in6` + with the address and port to bind to. + + :param flags: Indicate how the socket will be bound, + ``UV_UDP_IPV6ONLY`` and ``UV_UDP_REUSEADDR`` are supported. + + :returns: 0 on success, or an error code < 0 on failure. + +.. c:function:: int uv_udp_getsockname(const uv_udp_t* handle, struct sockaddr* name, int* namelen) + + Get the local IP and port of the UDP handle. + + :param handle: UDP handle. Should have been initialized with + :c:func:`uv_udp_init` and bound. + + :param name: Pointer to the structure to be filled with the address data. + In order to support IPv4 and IPv6 `struct sockaddr_storage` should be + used. + + :param namelen: On input it indicates the data of the `name` field. On + output it indicates how much of it was filled. + + :returns: 0 on success, or an error code < 0 on failure. + +.. c:function:: int uv_udp_set_membership(uv_udp_t* handle, const char* multicast_addr, const char* interface_addr, uv_membership membership) + + Set membership for a multicast address + + :param handle: UDP handle. Should have been initialized with + :c:func:`uv_udp_init`. + + :param multicast_addr: Multicast address to set membership for. + + :param interface_addr: Interface address. + + :param membership: Should be ``UV_JOIN_GROUP`` or ``UV_LEAVE_GROUP``. + + :returns: 0 on success, or an error code < 0 on failure. + +.. c:function:: int uv_udp_set_multicast_loop(uv_udp_t* handle, int on) + + Set IP multicast loop flag. Makes multicast packets loop back to + local sockets. + + :param handle: UDP handle. Should have been initialized with + :c:func:`uv_udp_init`. + + :param on: 1 for on, 0 for off. + + :returns: 0 on success, or an error code < 0 on failure. + +.. c:function:: int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) + + Set the multicast ttl. + + :param handle: UDP handle. Should have been initialized with + :c:func:`uv_udp_init`. + + :param ttl: 1 through 255. + + :returns: 0 on success, or an error code < 0 on failure. + +.. c:function:: int uv_udp_set_multicast_interface(uv_udp_t* handle, const char* interface_addr) + + Set the multicast interface to send or receive data on. + + :param handle: UDP handle. Should have been initialized with + :c:func:`uv_udp_init`. + + :param interface_addr: interface address. + + :returns: 0 on success, or an error code < 0 on failure. + +.. c:function:: int uv_udp_set_broadcast(uv_udp_t* handle, int on) + + Set broadcast on or off. + + :param handle: UDP handle. Should have been initialized with + :c:func:`uv_udp_init`. + + :param on: 1 for on, 0 for off. + + :returns: 0 on success, or an error code < 0 on failure. + +.. c:function:: int uv_udp_set_ttl(uv_udp_t* handle, int ttl) + + Set the time to live. + + :param handle: UDP handle. Should have been initialized with + :c:func:`uv_udp_init`. + + :param ttl: 1 through 255. + + :returns: 0 on success, or an error code < 0 on failure. + +.. c:function:: int uv_udp_send(uv_udp_send_t* req, uv_udp_t* handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr* addr, uv_udp_send_cb send_cb) + + Send data over the UDP socket. If the socket has not previously been bound + with :c:func:`uv_udp_bind` it will be bound to 0.0.0.0 + (the "all interfaces" IPv4 address) and a random port number. + + :param req: UDP request handle. Need not be initialized. + + :param handle: UDP handle. Should have been initialized with + :c:func:`uv_udp_init`. + + :param bufs: List of buffers to send. + + :param nbufs: Number of buffers in `bufs`. + + :param addr: `struct sockaddr_in` or `struct sockaddr_in6` with the + address and port of the remote peer. + + :param send_cb: Callback to invoke when the data has been sent out. + + :returns: 0 on success, or an error code < 0 on failure. + +.. c:function:: int uv_udp_try_send(uv_udp_t* handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr* addr) + + Same as :c:func:`uv_udp_send`, but won't queue a send request if it can't + be completed immediately. + + :returns: >= 0: number of bytes sent (it matches the given buffer size). + < 0: negative error code (``UV_EAGAIN`` is returned when the message + can't be sent immediately). + +.. c:function:: int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb, uv_udp_recv_cb recv_cb) + + Prepare for receiving data. If the socket has not previously been bound + with :c:func:`uv_udp_bind` it is bound to 0.0.0.0 (the "all interfaces" + IPv4 address) and a random port number. + + :param handle: UDP handle. Should have been initialized with + :c:func:`uv_udp_init`. + + :param alloc_cb: Callback to invoke when temporary storage is needed. + + :param recv_cb: Callback to invoke with received data. + + :returns: 0 on success, or an error code < 0 on failure. + +.. c:function:: int uv_udp_recv_stop(uv_udp_t* handle) + + Stop listening for incoming datagrams. + + :param handle: UDP handle. Should have been initialized with + :c:func:`uv_udp_init`. + + :returns: 0 on success, or an error code < 0 on failure. + +.. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/3rdparty/libuv/docs/src/version.rst b/3rdparty/libuv/docs/src/version.rst new file mode 100644 index 00000000000..e1715b2d3c5 --- /dev/null +++ b/3rdparty/libuv/docs/src/version.rst @@ -0,0 +1,60 @@ + +.. _version: + +Version-checking macros and functions +===================================== + +Starting with version 1.0.0 libuv follows the `semantic versioning`_ +scheme. This means that new APIs can be introduced throughout the lifetime of +a major release. In this section you'll find all macros and functions that +will allow you to write or compile code conditionally, in order to work with +multiple libuv versions. + +.. _semantic versioning: http://semver.org + + +Macros +------ + +.. c:macro:: UV_VERSION_MAJOR + + libuv version's major number. + +.. c:macro:: UV_VERSION_MINOR + + libuv version's minor number. + +.. c:macro:: UV_VERSION_PATCH + + libuv version's patch number. + +.. c:macro:: UV_VERSION_IS_RELEASE + + Set to 1 to indicate a release version of libuv, 0 for a development + snapshot. + +.. c:macro:: UV_VERSION_SUFFIX + + libuv version suffix. Certain development releases such as Release Candidates + might have a suffix such as "rc". + +.. c:macro:: UV_VERSION_HEX + + Returns the libuv version packed into a single integer. 8 bits are used for + each component, with the patch number stored in the 8 least significant + bits. E.g. for libuv 1.2.3 this would be 0x010203. + + .. versionadded:: 1.7.0 + + +Functions +--------- + +.. c:function:: unsigned int uv_version(void) + + Returns :c:macro:`UV_VERSION_HEX`. + +.. c:function:: const char* uv_version_string(void) + + Returns the libuv version number as a string. For non-release versions the + version suffix is included. diff --git a/3rdparty/libuv/gyp_uv.py b/3rdparty/libuv/gyp_uv.py new file mode 100644 index 00000000000..39933f624d5 --- /dev/null +++ b/3rdparty/libuv/gyp_uv.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python + +import os +import platform +import sys + +try: + import multiprocessing.synchronize + gyp_parallel_support = True +except ImportError: + gyp_parallel_support = False + + +CC = os.environ.get('CC', 'cc') +script_dir = os.path.dirname(__file__) +uv_root = os.path.normpath(script_dir) +output_dir = os.path.join(os.path.abspath(uv_root), 'out') + +sys.path.insert(0, os.path.join(uv_root, 'build', 'gyp', 'pylib')) +try: + import gyp +except ImportError: + print('You need to install gyp in build/gyp first. See the README.') + sys.exit(42) + + +def host_arch(): + machine = platform.machine() + if machine == 'i386': return 'ia32' + if machine == 'x86_64': return 'x64' + if machine.startswith('arm'): return 'arm' + if machine.startswith('mips'): return 'mips' + return machine # Return as-is and hope for the best. + + +def run_gyp(args): + rc = gyp.main(args) + if rc != 0: + print 'Error running GYP' + sys.exit(rc) + + +if __name__ == '__main__': + args = sys.argv[1:] + + # GYP bug. + # On msvs it will crash if it gets an absolute path. + # On Mac/make it will crash if it doesn't get an absolute path. + if sys.platform == 'win32': + args.append(os.path.join(uv_root, 'uv.gyp')) + common_fn = os.path.join(uv_root, 'common.gypi') + options_fn = os.path.join(uv_root, 'options.gypi') + # we force vs 2010 over 2008 which would otherwise be the default for gyp + if not os.environ.get('GYP_MSVS_VERSION'): + os.environ['GYP_MSVS_VERSION'] = '2010' + else: + args.append(os.path.join(os.path.abspath(uv_root), 'uv.gyp')) + common_fn = os.path.join(os.path.abspath(uv_root), 'common.gypi') + options_fn = os.path.join(os.path.abspath(uv_root), 'options.gypi') + + if os.path.exists(common_fn): + args.extend(['-I', common_fn]) + + if os.path.exists(options_fn): + args.extend(['-I', options_fn]) + + args.append('--depth=' + uv_root) + + # There's a bug with windows which doesn't allow this feature. + if sys.platform != 'win32': + if '-f' not in args: + args.extend('-f make'.split()) + if 'eclipse' not in args and 'ninja' not in args: + args.extend(['-Goutput_dir=' + output_dir]) + args.extend(['--generator-output', output_dir]) + + if not any(a.startswith('-Dhost_arch=') for a in args): + args.append('-Dhost_arch=%s' % host_arch()) + + if not any(a.startswith('-Dtarget_arch=') for a in args): + args.append('-Dtarget_arch=%s' % host_arch()) + + if not any(a.startswith('-Duv_library=') for a in args): + args.append('-Duv_library=static_library') + + # Some platforms (OpenBSD for example) don't have multiprocessing.synchronize + # so gyp must be run with --no-parallel + if not gyp_parallel_support: + args.append('--no-parallel') + + gyp_args = list(args) + print gyp_args + run_gyp(gyp_args) diff --git a/3rdparty/libuv/img/banner.png b/3rdparty/libuv/img/banner.png new file mode 100644 index 00000000000..7187daa2e57 Binary files /dev/null and b/3rdparty/libuv/img/banner.png differ diff --git a/3rdparty/libuv/img/logos.svg b/3rdparty/libuv/img/logos.svg new file mode 100644 index 00000000000..d6185f8b191 --- /dev/null +++ b/3rdparty/libuv/img/logos.svg @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3rdparty/libuv/include/android-ifaddrs.h b/3rdparty/libuv/include/android-ifaddrs.h new file mode 100644 index 00000000000..9cd19fec129 --- /dev/null +++ b/3rdparty/libuv/include/android-ifaddrs.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 1995, 1999 + * Berkeley Software Design, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp + */ + +#ifndef _IFADDRS_H_ +#define _IFADDRS_H_ + +struct ifaddrs { + struct ifaddrs *ifa_next; + char *ifa_name; + unsigned int ifa_flags; + struct sockaddr *ifa_addr; + struct sockaddr *ifa_netmask; + struct sockaddr *ifa_dstaddr; + void *ifa_data; +}; + +/* + * This may have been defined in . Note that if is + * to be included it must be included before this header file. + */ +#ifndef ifa_broadaddr +#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ +#endif + +#include + +__BEGIN_DECLS +extern int getifaddrs(struct ifaddrs **ifap); +extern void freeifaddrs(struct ifaddrs *ifa); +__END_DECLS + +#endif diff --git a/3rdparty/libuv/include/pthread-fixes.h b/3rdparty/libuv/include/pthread-fixes.h new file mode 100644 index 00000000000..88c6b66987a --- /dev/null +++ b/3rdparty/libuv/include/pthread-fixes.h @@ -0,0 +1,72 @@ +/* Copyright (c) 2013, Sony Mobile Communications AB + * Copyright (c) 2012, Google Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_TESTING_PTHREAD_FIXES_H +#define GOOGLE_BREAKPAD_COMMON_ANDROID_TESTING_PTHREAD_FIXES_H + +#include + + +/*Android doesn't provide pthread_barrier_t for now.*/ +#ifndef PTHREAD_BARRIER_SERIAL_THREAD + +/* Anything except 0 will do here.*/ +#define PTHREAD_BARRIER_SERIAL_THREAD 0x12345 + +typedef struct { + pthread_mutex_t mutex; + pthread_cond_t cond; + unsigned count; +} pthread_barrier_t; + +int pthread_barrier_init(pthread_barrier_t* barrier, + const void* barrier_attr, + unsigned count); + +int pthread_barrier_wait(pthread_barrier_t* barrier); +int pthread_barrier_destroy(pthread_barrier_t *barrier); +#endif /* defined(PTHREAD_BARRIER_SERIAL_THREAD) */ + +int pthread_yield(void); + +/* Workaround pthread_sigmask() returning EINVAL on versions < 4.1 by + * replacing all calls to pthread_sigmask with sigprocmask. See: + * https://android.googlesource.com/platform/bionic/+/9bf330b5 + * https://code.google.com/p/android/issues/detail?id=15337 + */ +int uv__pthread_sigmask(int how, const sigset_t* set, sigset_t* oset); + +#ifdef pthread_sigmask +#undef pthread_sigmask +#endif +#define pthread_sigmask(how, set, oldset) uv__pthread_sigmask(how, set, oldset) + +#endif /* GOOGLE_BREAKPAD_COMMON_ANDROID_TESTING_PTHREAD_FIXES_H */ diff --git a/3rdparty/libuv/include/stdint-msvc2008.h b/3rdparty/libuv/include/stdint-msvc2008.h new file mode 100644 index 00000000000..d02608a5972 --- /dev/null +++ b/3rdparty/libuv/include/stdint-msvc2008.h @@ -0,0 +1,247 @@ +// ISO C9x compliant stdint.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2008 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_STDINT_H_ // [ +#define _MSC_STDINT_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include + +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when +// compiling for ARM we should wrap include with 'extern "C++" {}' +// or compiler give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#ifdef __cplusplus +extern "C" { +#endif +# include +#ifdef __cplusplus +} +#endif + +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +// Visual Studio 6 and Embedded Visual C++ 4 doesn't +// realize that, e.g. char has the same size as __int8 +// so we give up on __intX for them. +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + + +// 7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// 7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ + typedef signed __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +# ifdef _WIN64 // [ +# define SIZE_MAX _UI64_MAX +# else // _WIN64 ][ +# define SIZE_MAX _UI32_MAX +# endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in +#ifndef WCHAR_MIN // [ +# define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +#define INTMAX_C INT64_C +#define UINTMAX_C UINT64_C + +#endif // __STDC_CONSTANT_MACROS ] + + +#endif // _MSC_STDINT_H_ ] diff --git a/3rdparty/libuv/include/tree.h b/3rdparty/libuv/include/tree.h new file mode 100644 index 00000000000..f936416e3d8 --- /dev/null +++ b/3rdparty/libuv/include/tree.h @@ -0,0 +1,768 @@ +/*- + * Copyright 2002 Niels Provos + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef UV_TREE_H_ +#define UV_TREE_H_ + +#ifndef UV__UNUSED +# if __GNUC__ +# define UV__UNUSED __attribute__((unused)) +# else +# define UV__UNUSED +# endif +#endif + +/* + * This file defines data structures for different types of trees: + * splay trees and red-black trees. + * + * A splay tree is a self-organizing data structure. Every operation + * on the tree causes a splay to happen. The splay moves the requested + * node to the root of the tree and partly rebalances it. + * + * This has the benefit that request locality causes faster lookups as + * the requested nodes move to the top of the tree. On the other hand, + * every lookup causes memory writes. + * + * The Balance Theorem bounds the total access time for m operations + * and n inserts on an initially empty tree as O((m + n)lg n). The + * amortized cost for a sequence of m accesses to a splay tree is O(lg n); + * + * A red-black tree is a binary search tree with the node color as an + * extra attribute. It fulfills a set of conditions: + * - every search path from the root to a leaf consists of the + * same number of black nodes, + * - each red node (except for the root) has a black parent, + * - each leaf node is black. + * + * Every operation on a red-black tree is bounded as O(lg n). + * The maximum height of a red-black tree is 2lg (n+1). + */ + +#define SPLAY_HEAD(name, type) \ +struct name { \ + struct type *sph_root; /* root of the tree */ \ +} + +#define SPLAY_INITIALIZER(root) \ + { NULL } + +#define SPLAY_INIT(root) do { \ + (root)->sph_root = NULL; \ +} while (/*CONSTCOND*/ 0) + +#define SPLAY_ENTRY(type) \ +struct { \ + struct type *spe_left; /* left element */ \ + struct type *spe_right; /* right element */ \ +} + +#define SPLAY_LEFT(elm, field) (elm)->field.spe_left +#define SPLAY_RIGHT(elm, field) (elm)->field.spe_right +#define SPLAY_ROOT(head) (head)->sph_root +#define SPLAY_EMPTY(head) (SPLAY_ROOT(head) == NULL) + +/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */ +#define SPLAY_ROTATE_RIGHT(head, tmp, field) do { \ + SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \ + SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ + (head)->sph_root = tmp; \ +} while (/*CONSTCOND*/ 0) + +#define SPLAY_ROTATE_LEFT(head, tmp, field) do { \ + SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \ + SPLAY_LEFT(tmp, field) = (head)->sph_root; \ + (head)->sph_root = tmp; \ +} while (/*CONSTCOND*/ 0) + +#define SPLAY_LINKLEFT(head, tmp, field) do { \ + SPLAY_LEFT(tmp, field) = (head)->sph_root; \ + tmp = (head)->sph_root; \ + (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \ +} while (/*CONSTCOND*/ 0) + +#define SPLAY_LINKRIGHT(head, tmp, field) do { \ + SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ + tmp = (head)->sph_root; \ + (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \ +} while (/*CONSTCOND*/ 0) + +#define SPLAY_ASSEMBLE(head, node, left, right, field) do { \ + SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \ + SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field); \ + SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \ + SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \ +} while (/*CONSTCOND*/ 0) + +/* Generates prototypes and inline functions */ + +#define SPLAY_PROTOTYPE(name, type, field, cmp) \ +void name##_SPLAY(struct name *, struct type *); \ +void name##_SPLAY_MINMAX(struct name *, int); \ +struct type *name##_SPLAY_INSERT(struct name *, struct type *); \ +struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \ + \ +/* Finds the node with the same key as elm */ \ +static __inline struct type * \ +name##_SPLAY_FIND(struct name *head, struct type *elm) \ +{ \ + if (SPLAY_EMPTY(head)) \ + return(NULL); \ + name##_SPLAY(head, elm); \ + if ((cmp)(elm, (head)->sph_root) == 0) \ + return (head->sph_root); \ + return (NULL); \ +} \ + \ +static __inline struct type * \ +name##_SPLAY_NEXT(struct name *head, struct type *elm) \ +{ \ + name##_SPLAY(head, elm); \ + if (SPLAY_RIGHT(elm, field) != NULL) { \ + elm = SPLAY_RIGHT(elm, field); \ + while (SPLAY_LEFT(elm, field) != NULL) { \ + elm = SPLAY_LEFT(elm, field); \ + } \ + } else \ + elm = NULL; \ + return (elm); \ +} \ + \ +static __inline struct type * \ +name##_SPLAY_MIN_MAX(struct name *head, int val) \ +{ \ + name##_SPLAY_MINMAX(head, val); \ + return (SPLAY_ROOT(head)); \ +} + +/* Main splay operation. + * Moves node close to the key of elm to top + */ +#define SPLAY_GENERATE(name, type, field, cmp) \ +struct type * \ +name##_SPLAY_INSERT(struct name *head, struct type *elm) \ +{ \ + if (SPLAY_EMPTY(head)) { \ + SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \ + } else { \ + int __comp; \ + name##_SPLAY(head, elm); \ + __comp = (cmp)(elm, (head)->sph_root); \ + if(__comp < 0) { \ + SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field); \ + SPLAY_RIGHT(elm, field) = (head)->sph_root; \ + SPLAY_LEFT((head)->sph_root, field) = NULL; \ + } else if (__comp > 0) { \ + SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field); \ + SPLAY_LEFT(elm, field) = (head)->sph_root; \ + SPLAY_RIGHT((head)->sph_root, field) = NULL; \ + } else \ + return ((head)->sph_root); \ + } \ + (head)->sph_root = (elm); \ + return (NULL); \ +} \ + \ +struct type * \ +name##_SPLAY_REMOVE(struct name *head, struct type *elm) \ +{ \ + struct type *__tmp; \ + if (SPLAY_EMPTY(head)) \ + return (NULL); \ + name##_SPLAY(head, elm); \ + if ((cmp)(elm, (head)->sph_root) == 0) { \ + if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \ + (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \ + } else { \ + __tmp = SPLAY_RIGHT((head)->sph_root, field); \ + (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \ + name##_SPLAY(head, elm); \ + SPLAY_RIGHT((head)->sph_root, field) = __tmp; \ + } \ + return (elm); \ + } \ + return (NULL); \ +} \ + \ +void \ +name##_SPLAY(struct name *head, struct type *elm) \ +{ \ + struct type __node, *__left, *__right, *__tmp; \ + int __comp; \ + \ + SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL; \ + __left = __right = &__node; \ + \ + while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) { \ + if (__comp < 0) { \ + __tmp = SPLAY_LEFT((head)->sph_root, field); \ + if (__tmp == NULL) \ + break; \ + if ((cmp)(elm, __tmp) < 0){ \ + SPLAY_ROTATE_RIGHT(head, __tmp, field); \ + if (SPLAY_LEFT((head)->sph_root, field) == NULL) \ + break; \ + } \ + SPLAY_LINKLEFT(head, __right, field); \ + } else if (__comp > 0) { \ + __tmp = SPLAY_RIGHT((head)->sph_root, field); \ + if (__tmp == NULL) \ + break; \ + if ((cmp)(elm, __tmp) > 0){ \ + SPLAY_ROTATE_LEFT(head, __tmp, field); \ + if (SPLAY_RIGHT((head)->sph_root, field) == NULL) \ + break; \ + } \ + SPLAY_LINKRIGHT(head, __left, field); \ + } \ + } \ + SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ +} \ + \ +/* Splay with either the minimum or the maximum element \ + * Used to find minimum or maximum element in tree. \ + */ \ +void name##_SPLAY_MINMAX(struct name *head, int __comp) \ +{ \ + struct type __node, *__left, *__right, *__tmp; \ + \ + SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL; \ + __left = __right = &__node; \ + \ + while (1) { \ + if (__comp < 0) { \ + __tmp = SPLAY_LEFT((head)->sph_root, field); \ + if (__tmp == NULL) \ + break; \ + if (__comp < 0){ \ + SPLAY_ROTATE_RIGHT(head, __tmp, field); \ + if (SPLAY_LEFT((head)->sph_root, field) == NULL) \ + break; \ + } \ + SPLAY_LINKLEFT(head, __right, field); \ + } else if (__comp > 0) { \ + __tmp = SPLAY_RIGHT((head)->sph_root, field); \ + if (__tmp == NULL) \ + break; \ + if (__comp > 0) { \ + SPLAY_ROTATE_LEFT(head, __tmp, field); \ + if (SPLAY_RIGHT((head)->sph_root, field) == NULL) \ + break; \ + } \ + SPLAY_LINKRIGHT(head, __left, field); \ + } \ + } \ + SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ +} + +#define SPLAY_NEGINF -1 +#define SPLAY_INF 1 + +#define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y) +#define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y) +#define SPLAY_FIND(name, x, y) name##_SPLAY_FIND(x, y) +#define SPLAY_NEXT(name, x, y) name##_SPLAY_NEXT(x, y) +#define SPLAY_MIN(name, x) (SPLAY_EMPTY(x) ? NULL \ + : name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF)) +#define SPLAY_MAX(name, x) (SPLAY_EMPTY(x) ? NULL \ + : name##_SPLAY_MIN_MAX(x, SPLAY_INF)) + +#define SPLAY_FOREACH(x, name, head) \ + for ((x) = SPLAY_MIN(name, head); \ + (x) != NULL; \ + (x) = SPLAY_NEXT(name, head, x)) + +/* Macros that define a red-black tree */ +#define RB_HEAD(name, type) \ +struct name { \ + struct type *rbh_root; /* root of the tree */ \ +} + +#define RB_INITIALIZER(root) \ + { NULL } + +#define RB_INIT(root) do { \ + (root)->rbh_root = NULL; \ +} while (/*CONSTCOND*/ 0) + +#define RB_BLACK 0 +#define RB_RED 1 +#define RB_ENTRY(type) \ +struct { \ + struct type *rbe_left; /* left element */ \ + struct type *rbe_right; /* right element */ \ + struct type *rbe_parent; /* parent element */ \ + int rbe_color; /* node color */ \ +} + +#define RB_LEFT(elm, field) (elm)->field.rbe_left +#define RB_RIGHT(elm, field) (elm)->field.rbe_right +#define RB_PARENT(elm, field) (elm)->field.rbe_parent +#define RB_COLOR(elm, field) (elm)->field.rbe_color +#define RB_ROOT(head) (head)->rbh_root +#define RB_EMPTY(head) (RB_ROOT(head) == NULL) + +#define RB_SET(elm, parent, field) do { \ + RB_PARENT(elm, field) = parent; \ + RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ + RB_COLOR(elm, field) = RB_RED; \ +} while (/*CONSTCOND*/ 0) + +#define RB_SET_BLACKRED(black, red, field) do { \ + RB_COLOR(black, field) = RB_BLACK; \ + RB_COLOR(red, field) = RB_RED; \ +} while (/*CONSTCOND*/ 0) + +#ifndef RB_AUGMENT +#define RB_AUGMENT(x) do {} while (0) +#endif + +#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ + (tmp) = RB_RIGHT(elm, field); \ + if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \ + RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \ + } \ + RB_AUGMENT(elm); \ + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ + if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ + RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ + else \ + RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ + } else \ + (head)->rbh_root = (tmp); \ + RB_LEFT(tmp, field) = (elm); \ + RB_PARENT(elm, field) = (tmp); \ + RB_AUGMENT(tmp); \ + if ((RB_PARENT(tmp, field))) \ + RB_AUGMENT(RB_PARENT(tmp, field)); \ +} while (/*CONSTCOND*/ 0) + +#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ + (tmp) = RB_LEFT(elm, field); \ + if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \ + RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \ + } \ + RB_AUGMENT(elm); \ + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ + if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ + RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ + else \ + RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ + } else \ + (head)->rbh_root = (tmp); \ + RB_RIGHT(tmp, field) = (elm); \ + RB_PARENT(elm, field) = (tmp); \ + RB_AUGMENT(tmp); \ + if ((RB_PARENT(tmp, field))) \ + RB_AUGMENT(RB_PARENT(tmp, field)); \ +} while (/*CONSTCOND*/ 0) + +/* Generates prototypes and inline functions */ +#define RB_PROTOTYPE(name, type, field, cmp) \ + RB_PROTOTYPE_INTERNAL(name, type, field, cmp,) +#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ + RB_PROTOTYPE_INTERNAL(name, type, field, cmp, UV__UNUSED static) +#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ +attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \ +attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ +attr struct type *name##_RB_REMOVE(struct name *, struct type *); \ +attr struct type *name##_RB_INSERT(struct name *, struct type *); \ +attr struct type *name##_RB_FIND(struct name *, struct type *); \ +attr struct type *name##_RB_NFIND(struct name *, struct type *); \ +attr struct type *name##_RB_NEXT(struct type *); \ +attr struct type *name##_RB_PREV(struct type *); \ +attr struct type *name##_RB_MINMAX(struct name *, int); \ + \ + +/* Main rb operation. + * Moves node close to the key of elm to top + */ +#define RB_GENERATE(name, type, field, cmp) \ + RB_GENERATE_INTERNAL(name, type, field, cmp,) +#define RB_GENERATE_STATIC(name, type, field, cmp) \ + RB_GENERATE_INTERNAL(name, type, field, cmp, UV__UNUSED static) +#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ +attr void \ +name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ +{ \ + struct type *parent, *gparent, *tmp; \ + while ((parent = RB_PARENT(elm, field)) != NULL && \ + RB_COLOR(parent, field) == RB_RED) { \ + gparent = RB_PARENT(parent, field); \ + if (parent == RB_LEFT(gparent, field)) { \ + tmp = RB_RIGHT(gparent, field); \ + if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ + RB_COLOR(tmp, field) = RB_BLACK; \ + RB_SET_BLACKRED(parent, gparent, field); \ + elm = gparent; \ + continue; \ + } \ + if (RB_RIGHT(parent, field) == elm) { \ + RB_ROTATE_LEFT(head, parent, tmp, field); \ + tmp = parent; \ + parent = elm; \ + elm = tmp; \ + } \ + RB_SET_BLACKRED(parent, gparent, field); \ + RB_ROTATE_RIGHT(head, gparent, tmp, field); \ + } else { \ + tmp = RB_LEFT(gparent, field); \ + if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ + RB_COLOR(tmp, field) = RB_BLACK; \ + RB_SET_BLACKRED(parent, gparent, field); \ + elm = gparent; \ + continue; \ + } \ + if (RB_LEFT(parent, field) == elm) { \ + RB_ROTATE_RIGHT(head, parent, tmp, field); \ + tmp = parent; \ + parent = elm; \ + elm = tmp; \ + } \ + RB_SET_BLACKRED(parent, gparent, field); \ + RB_ROTATE_LEFT(head, gparent, tmp, field); \ + } \ + } \ + RB_COLOR(head->rbh_root, field) = RB_BLACK; \ +} \ + \ +attr void \ +name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, \ + struct type *elm) \ +{ \ + struct type *tmp; \ + while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \ + elm != RB_ROOT(head)) { \ + if (RB_LEFT(parent, field) == elm) { \ + tmp = RB_RIGHT(parent, field); \ + if (RB_COLOR(tmp, field) == RB_RED) { \ + RB_SET_BLACKRED(tmp, parent, field); \ + RB_ROTATE_LEFT(head, parent, tmp, field); \ + tmp = RB_RIGHT(parent, field); \ + } \ + if ((RB_LEFT(tmp, field) == NULL || \ + RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \ + (RB_RIGHT(tmp, field) == NULL || \ + RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \ + RB_COLOR(tmp, field) = RB_RED; \ + elm = parent; \ + parent = RB_PARENT(elm, field); \ + } else { \ + if (RB_RIGHT(tmp, field) == NULL || \ + RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) { \ + struct type *oleft; \ + if ((oleft = RB_LEFT(tmp, field)) \ + != NULL) \ + RB_COLOR(oleft, field) = RB_BLACK; \ + RB_COLOR(tmp, field) = RB_RED; \ + RB_ROTATE_RIGHT(head, tmp, oleft, field); \ + tmp = RB_RIGHT(parent, field); \ + } \ + RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ + RB_COLOR(parent, field) = RB_BLACK; \ + if (RB_RIGHT(tmp, field)) \ + RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK; \ + RB_ROTATE_LEFT(head, parent, tmp, field); \ + elm = RB_ROOT(head); \ + break; \ + } \ + } else { \ + tmp = RB_LEFT(parent, field); \ + if (RB_COLOR(tmp, field) == RB_RED) { \ + RB_SET_BLACKRED(tmp, parent, field); \ + RB_ROTATE_RIGHT(head, parent, tmp, field); \ + tmp = RB_LEFT(parent, field); \ + } \ + if ((RB_LEFT(tmp, field) == NULL || \ + RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \ + (RB_RIGHT(tmp, field) == NULL || \ + RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \ + RB_COLOR(tmp, field) = RB_RED; \ + elm = parent; \ + parent = RB_PARENT(elm, field); \ + } else { \ + if (RB_LEFT(tmp, field) == NULL || \ + RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) { \ + struct type *oright; \ + if ((oright = RB_RIGHT(tmp, field)) \ + != NULL) \ + RB_COLOR(oright, field) = RB_BLACK; \ + RB_COLOR(tmp, field) = RB_RED; \ + RB_ROTATE_LEFT(head, tmp, oright, field); \ + tmp = RB_LEFT(parent, field); \ + } \ + RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ + RB_COLOR(parent, field) = RB_BLACK; \ + if (RB_LEFT(tmp, field)) \ + RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK; \ + RB_ROTATE_RIGHT(head, parent, tmp, field); \ + elm = RB_ROOT(head); \ + break; \ + } \ + } \ + } \ + if (elm) \ + RB_COLOR(elm, field) = RB_BLACK; \ +} \ + \ +attr struct type * \ +name##_RB_REMOVE(struct name *head, struct type *elm) \ +{ \ + struct type *child, *parent, *old = elm; \ + int color; \ + if (RB_LEFT(elm, field) == NULL) \ + child = RB_RIGHT(elm, field); \ + else if (RB_RIGHT(elm, field) == NULL) \ + child = RB_LEFT(elm, field); \ + else { \ + struct type *left; \ + elm = RB_RIGHT(elm, field); \ + while ((left = RB_LEFT(elm, field)) != NULL) \ + elm = left; \ + child = RB_RIGHT(elm, field); \ + parent = RB_PARENT(elm, field); \ + color = RB_COLOR(elm, field); \ + if (child) \ + RB_PARENT(child, field) = parent; \ + if (parent) { \ + if (RB_LEFT(parent, field) == elm) \ + RB_LEFT(parent, field) = child; \ + else \ + RB_RIGHT(parent, field) = child; \ + RB_AUGMENT(parent); \ + } else \ + RB_ROOT(head) = child; \ + if (RB_PARENT(elm, field) == old) \ + parent = elm; \ + (elm)->field = (old)->field; \ + if (RB_PARENT(old, field)) { \ + if (RB_LEFT(RB_PARENT(old, field), field) == old) \ + RB_LEFT(RB_PARENT(old, field), field) = elm; \ + else \ + RB_RIGHT(RB_PARENT(old, field), field) = elm; \ + RB_AUGMENT(RB_PARENT(old, field)); \ + } else \ + RB_ROOT(head) = elm; \ + RB_PARENT(RB_LEFT(old, field), field) = elm; \ + if (RB_RIGHT(old, field)) \ + RB_PARENT(RB_RIGHT(old, field), field) = elm; \ + if (parent) { \ + left = parent; \ + do { \ + RB_AUGMENT(left); \ + } while ((left = RB_PARENT(left, field)) != NULL); \ + } \ + goto color; \ + } \ + parent = RB_PARENT(elm, field); \ + color = RB_COLOR(elm, field); \ + if (child) \ + RB_PARENT(child, field) = parent; \ + if (parent) { \ + if (RB_LEFT(parent, field) == elm) \ + RB_LEFT(parent, field) = child; \ + else \ + RB_RIGHT(parent, field) = child; \ + RB_AUGMENT(parent); \ + } else \ + RB_ROOT(head) = child; \ +color: \ + if (color == RB_BLACK) \ + name##_RB_REMOVE_COLOR(head, parent, child); \ + return (old); \ +} \ + \ +/* Inserts a node into the RB tree */ \ +attr struct type * \ +name##_RB_INSERT(struct name *head, struct type *elm) \ +{ \ + struct type *tmp; \ + struct type *parent = NULL; \ + int comp = 0; \ + tmp = RB_ROOT(head); \ + while (tmp) { \ + parent = tmp; \ + comp = (cmp)(elm, parent); \ + if (comp < 0) \ + tmp = RB_LEFT(tmp, field); \ + else if (comp > 0) \ + tmp = RB_RIGHT(tmp, field); \ + else \ + return (tmp); \ + } \ + RB_SET(elm, parent, field); \ + if (parent != NULL) { \ + if (comp < 0) \ + RB_LEFT(parent, field) = elm; \ + else \ + RB_RIGHT(parent, field) = elm; \ + RB_AUGMENT(parent); \ + } else \ + RB_ROOT(head) = elm; \ + name##_RB_INSERT_COLOR(head, elm); \ + return (NULL); \ +} \ + \ +/* Finds the node with the same key as elm */ \ +attr struct type * \ +name##_RB_FIND(struct name *head, struct type *elm) \ +{ \ + struct type *tmp = RB_ROOT(head); \ + int comp; \ + while (tmp) { \ + comp = cmp(elm, tmp); \ + if (comp < 0) \ + tmp = RB_LEFT(tmp, field); \ + else if (comp > 0) \ + tmp = RB_RIGHT(tmp, field); \ + else \ + return (tmp); \ + } \ + return (NULL); \ +} \ + \ +/* Finds the first node greater than or equal to the search key */ \ +attr struct type * \ +name##_RB_NFIND(struct name *head, struct type *elm) \ +{ \ + struct type *tmp = RB_ROOT(head); \ + struct type *res = NULL; \ + int comp; \ + while (tmp) { \ + comp = cmp(elm, tmp); \ + if (comp < 0) { \ + res = tmp; \ + tmp = RB_LEFT(tmp, field); \ + } \ + else if (comp > 0) \ + tmp = RB_RIGHT(tmp, field); \ + else \ + return (tmp); \ + } \ + return (res); \ +} \ + \ +/* ARGSUSED */ \ +attr struct type * \ +name##_RB_NEXT(struct type *elm) \ +{ \ + if (RB_RIGHT(elm, field)) { \ + elm = RB_RIGHT(elm, field); \ + while (RB_LEFT(elm, field)) \ + elm = RB_LEFT(elm, field); \ + } else { \ + if (RB_PARENT(elm, field) && \ + (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ + elm = RB_PARENT(elm, field); \ + else { \ + while (RB_PARENT(elm, field) && \ + (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ + elm = RB_PARENT(elm, field); \ + elm = RB_PARENT(elm, field); \ + } \ + } \ + return (elm); \ +} \ + \ +/* ARGSUSED */ \ +attr struct type * \ +name##_RB_PREV(struct type *elm) \ +{ \ + if (RB_LEFT(elm, field)) { \ + elm = RB_LEFT(elm, field); \ + while (RB_RIGHT(elm, field)) \ + elm = RB_RIGHT(elm, field); \ + } else { \ + if (RB_PARENT(elm, field) && \ + (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ + elm = RB_PARENT(elm, field); \ + else { \ + while (RB_PARENT(elm, field) && \ + (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ + elm = RB_PARENT(elm, field); \ + elm = RB_PARENT(elm, field); \ + } \ + } \ + return (elm); \ +} \ + \ +attr struct type * \ +name##_RB_MINMAX(struct name *head, int val) \ +{ \ + struct type *tmp = RB_ROOT(head); \ + struct type *parent = NULL; \ + while (tmp) { \ + parent = tmp; \ + if (val < 0) \ + tmp = RB_LEFT(tmp, field); \ + else \ + tmp = RB_RIGHT(tmp, field); \ + } \ + return (parent); \ +} + +#define RB_NEGINF -1 +#define RB_INF 1 + +#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y) +#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y) +#define RB_FIND(name, x, y) name##_RB_FIND(x, y) +#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y) +#define RB_NEXT(name, x, y) name##_RB_NEXT(y) +#define RB_PREV(name, x, y) name##_RB_PREV(y) +#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF) +#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF) + +#define RB_FOREACH(x, name, head) \ + for ((x) = RB_MIN(name, head); \ + (x) != NULL; \ + (x) = name##_RB_NEXT(x)) + +#define RB_FOREACH_FROM(x, name, y) \ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_SAFE(x, name, head, y) \ + for ((x) = RB_MIN(name, head); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_REVERSE(x, name, head) \ + for ((x) = RB_MAX(name, head); \ + (x) != NULL; \ + (x) = name##_RB_PREV(x)) + +#define RB_FOREACH_REVERSE_FROM(x, name, y) \ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \ + for ((x) = RB_MAX(name, head); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ + (x) = (y)) + +#endif /* UV_TREE_H_ */ diff --git a/3rdparty/libuv/include/uv-aix.h b/3rdparty/libuv/include/uv-aix.h new file mode 100644 index 00000000000..7dc992fa6d7 --- /dev/null +++ b/3rdparty/libuv/include/uv-aix.h @@ -0,0 +1,32 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_AIX_H +#define UV_AIX_H + +#define UV_PLATFORM_LOOP_FIELDS \ + int fs_fd; \ + +#define UV_PLATFORM_FS_EVENT_FIELDS \ + uv__io_t event_watcher; \ + char *dir_filename; \ + +#endif /* UV_AIX_H */ diff --git a/3rdparty/libuv/include/uv-bsd.h b/3rdparty/libuv/include/uv-bsd.h new file mode 100644 index 00000000000..2d72b3d7711 --- /dev/null +++ b/3rdparty/libuv/include/uv-bsd.h @@ -0,0 +1,34 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_BSD_H +#define UV_BSD_H + +#define UV_PLATFORM_FS_EVENT_FIELDS \ + uv__io_t event_watcher; \ + +#define UV_IO_PRIVATE_PLATFORM_FIELDS \ + int rcount; \ + int wcount; \ + +#define UV_HAVE_KQUEUE 1 + +#endif /* UV_BSD_H */ diff --git a/3rdparty/libuv/include/uv-darwin.h b/3rdparty/libuv/include/uv-darwin.h new file mode 100644 index 00000000000..d226415820b --- /dev/null +++ b/3rdparty/libuv/include/uv-darwin.h @@ -0,0 +1,61 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_DARWIN_H +#define UV_DARWIN_H + +#if defined(__APPLE__) && defined(__MACH__) +# include +# include +# include +# include +# define UV_PLATFORM_SEM_T semaphore_t +#endif + +#define UV_IO_PRIVATE_PLATFORM_FIELDS \ + int rcount; \ + int wcount; \ + +#define UV_PLATFORM_LOOP_FIELDS \ + uv_thread_t cf_thread; \ + void* _cf_reserved; \ + void* cf_state; \ + uv_mutex_t cf_mutex; \ + uv_sem_t cf_sem; \ + void* cf_signals[2]; \ + +#define UV_PLATFORM_FS_EVENT_FIELDS \ + uv__io_t event_watcher; \ + char* realpath; \ + int realpath_len; \ + int cf_flags; \ + uv_async_t* cf_cb; \ + void* cf_events[2]; \ + void* cf_member[2]; \ + int cf_error; \ + uv_mutex_t cf_mutex; \ + +#define UV_STREAM_PRIVATE_PLATFORM_FIELDS \ + void* select; \ + +#define UV_HAVE_KQUEUE 1 + +#endif /* UV_DARWIN_H */ diff --git a/3rdparty/libuv/include/uv-errno.h b/3rdparty/libuv/include/uv-errno.h new file mode 100644 index 00000000000..53f30296c1c --- /dev/null +++ b/3rdparty/libuv/include/uv-errno.h @@ -0,0 +1,418 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_ERRNO_H_ +#define UV_ERRNO_H_ + +#include + +#define UV__EOF (-4095) +#define UV__UNKNOWN (-4094) + +#define UV__EAI_ADDRFAMILY (-3000) +#define UV__EAI_AGAIN (-3001) +#define UV__EAI_BADFLAGS (-3002) +#define UV__EAI_CANCELED (-3003) +#define UV__EAI_FAIL (-3004) +#define UV__EAI_FAMILY (-3005) +#define UV__EAI_MEMORY (-3006) +#define UV__EAI_NODATA (-3007) +#define UV__EAI_NONAME (-3008) +#define UV__EAI_OVERFLOW (-3009) +#define UV__EAI_SERVICE (-3010) +#define UV__EAI_SOCKTYPE (-3011) +#define UV__EAI_BADHINTS (-3013) +#define UV__EAI_PROTOCOL (-3014) + +/* Only map to the system errno on non-Windows platforms. It's apparently + * a fairly common practice for Windows programmers to redefine errno codes. + */ +#if defined(E2BIG) && !defined(_WIN32) +# define UV__E2BIG (-E2BIG) +#else +# define UV__E2BIG (-4093) +#endif + +#if defined(EACCES) && !defined(_WIN32) +# define UV__EACCES (-EACCES) +#else +# define UV__EACCES (-4092) +#endif + +#if defined(EADDRINUSE) && !defined(_WIN32) +# define UV__EADDRINUSE (-EADDRINUSE) +#else +# define UV__EADDRINUSE (-4091) +#endif + +#if defined(EADDRNOTAVAIL) && !defined(_WIN32) +# define UV__EADDRNOTAVAIL (-EADDRNOTAVAIL) +#else +# define UV__EADDRNOTAVAIL (-4090) +#endif + +#if defined(EAFNOSUPPORT) && !defined(_WIN32) +# define UV__EAFNOSUPPORT (-EAFNOSUPPORT) +#else +# define UV__EAFNOSUPPORT (-4089) +#endif + +#if defined(EAGAIN) && !defined(_WIN32) +# define UV__EAGAIN (-EAGAIN) +#else +# define UV__EAGAIN (-4088) +#endif + +#if defined(EALREADY) && !defined(_WIN32) +# define UV__EALREADY (-EALREADY) +#else +# define UV__EALREADY (-4084) +#endif + +#if defined(EBADF) && !defined(_WIN32) +# define UV__EBADF (-EBADF) +#else +# define UV__EBADF (-4083) +#endif + +#if defined(EBUSY) && !defined(_WIN32) +# define UV__EBUSY (-EBUSY) +#else +# define UV__EBUSY (-4082) +#endif + +#if defined(ECANCELED) && !defined(_WIN32) +# define UV__ECANCELED (-ECANCELED) +#else +# define UV__ECANCELED (-4081) +#endif + +#if defined(ECHARSET) && !defined(_WIN32) +# define UV__ECHARSET (-ECHARSET) +#else +# define UV__ECHARSET (-4080) +#endif + +#if defined(ECONNABORTED) && !defined(_WIN32) +# define UV__ECONNABORTED (-ECONNABORTED) +#else +# define UV__ECONNABORTED (-4079) +#endif + +#if defined(ECONNREFUSED) && !defined(_WIN32) +# define UV__ECONNREFUSED (-ECONNREFUSED) +#else +# define UV__ECONNREFUSED (-4078) +#endif + +#if defined(ECONNRESET) && !defined(_WIN32) +# define UV__ECONNRESET (-ECONNRESET) +#else +# define UV__ECONNRESET (-4077) +#endif + +#if defined(EDESTADDRREQ) && !defined(_WIN32) +# define UV__EDESTADDRREQ (-EDESTADDRREQ) +#else +# define UV__EDESTADDRREQ (-4076) +#endif + +#if defined(EEXIST) && !defined(_WIN32) +# define UV__EEXIST (-EEXIST) +#else +# define UV__EEXIST (-4075) +#endif + +#if defined(EFAULT) && !defined(_WIN32) +# define UV__EFAULT (-EFAULT) +#else +# define UV__EFAULT (-4074) +#endif + +#if defined(EHOSTUNREACH) && !defined(_WIN32) +# define UV__EHOSTUNREACH (-EHOSTUNREACH) +#else +# define UV__EHOSTUNREACH (-4073) +#endif + +#if defined(EINTR) && !defined(_WIN32) +# define UV__EINTR (-EINTR) +#else +# define UV__EINTR (-4072) +#endif + +#if defined(EINVAL) && !defined(_WIN32) +# define UV__EINVAL (-EINVAL) +#else +# define UV__EINVAL (-4071) +#endif + +#if defined(EIO) && !defined(_WIN32) +# define UV__EIO (-EIO) +#else +# define UV__EIO (-4070) +#endif + +#if defined(EISCONN) && !defined(_WIN32) +# define UV__EISCONN (-EISCONN) +#else +# define UV__EISCONN (-4069) +#endif + +#if defined(EISDIR) && !defined(_WIN32) +# define UV__EISDIR (-EISDIR) +#else +# define UV__EISDIR (-4068) +#endif + +#if defined(ELOOP) && !defined(_WIN32) +# define UV__ELOOP (-ELOOP) +#else +# define UV__ELOOP (-4067) +#endif + +#if defined(EMFILE) && !defined(_WIN32) +# define UV__EMFILE (-EMFILE) +#else +# define UV__EMFILE (-4066) +#endif + +#if defined(EMSGSIZE) && !defined(_WIN32) +# define UV__EMSGSIZE (-EMSGSIZE) +#else +# define UV__EMSGSIZE (-4065) +#endif + +#if defined(ENAMETOOLONG) && !defined(_WIN32) +# define UV__ENAMETOOLONG (-ENAMETOOLONG) +#else +# define UV__ENAMETOOLONG (-4064) +#endif + +#if defined(ENETDOWN) && !defined(_WIN32) +# define UV__ENETDOWN (-ENETDOWN) +#else +# define UV__ENETDOWN (-4063) +#endif + +#if defined(ENETUNREACH) && !defined(_WIN32) +# define UV__ENETUNREACH (-ENETUNREACH) +#else +# define UV__ENETUNREACH (-4062) +#endif + +#if defined(ENFILE) && !defined(_WIN32) +# define UV__ENFILE (-ENFILE) +#else +# define UV__ENFILE (-4061) +#endif + +#if defined(ENOBUFS) && !defined(_WIN32) +# define UV__ENOBUFS (-ENOBUFS) +#else +# define UV__ENOBUFS (-4060) +#endif + +#if defined(ENODEV) && !defined(_WIN32) +# define UV__ENODEV (-ENODEV) +#else +# define UV__ENODEV (-4059) +#endif + +#if defined(ENOENT) && !defined(_WIN32) +# define UV__ENOENT (-ENOENT) +#else +# define UV__ENOENT (-4058) +#endif + +#if defined(ENOMEM) && !defined(_WIN32) +# define UV__ENOMEM (-ENOMEM) +#else +# define UV__ENOMEM (-4057) +#endif + +#if defined(ENONET) && !defined(_WIN32) +# define UV__ENONET (-ENONET) +#else +# define UV__ENONET (-4056) +#endif + +#if defined(ENOSPC) && !defined(_WIN32) +# define UV__ENOSPC (-ENOSPC) +#else +# define UV__ENOSPC (-4055) +#endif + +#if defined(ENOSYS) && !defined(_WIN32) +# define UV__ENOSYS (-ENOSYS) +#else +# define UV__ENOSYS (-4054) +#endif + +#if defined(ENOTCONN) && !defined(_WIN32) +# define UV__ENOTCONN (-ENOTCONN) +#else +# define UV__ENOTCONN (-4053) +#endif + +#if defined(ENOTDIR) && !defined(_WIN32) +# define UV__ENOTDIR (-ENOTDIR) +#else +# define UV__ENOTDIR (-4052) +#endif + +#if defined(ENOTEMPTY) && !defined(_WIN32) +# define UV__ENOTEMPTY (-ENOTEMPTY) +#else +# define UV__ENOTEMPTY (-4051) +#endif + +#if defined(ENOTSOCK) && !defined(_WIN32) +# define UV__ENOTSOCK (-ENOTSOCK) +#else +# define UV__ENOTSOCK (-4050) +#endif + +#if defined(ENOTSUP) && !defined(_WIN32) +# define UV__ENOTSUP (-ENOTSUP) +#else +# define UV__ENOTSUP (-4049) +#endif + +#if defined(EPERM) && !defined(_WIN32) +# define UV__EPERM (-EPERM) +#else +# define UV__EPERM (-4048) +#endif + +#if defined(EPIPE) && !defined(_WIN32) +# define UV__EPIPE (-EPIPE) +#else +# define UV__EPIPE (-4047) +#endif + +#if defined(EPROTO) && !defined(_WIN32) +# define UV__EPROTO (-EPROTO) +#else +# define UV__EPROTO (-4046) +#endif + +#if defined(EPROTONOSUPPORT) && !defined(_WIN32) +# define UV__EPROTONOSUPPORT (-EPROTONOSUPPORT) +#else +# define UV__EPROTONOSUPPORT (-4045) +#endif + +#if defined(EPROTOTYPE) && !defined(_WIN32) +# define UV__EPROTOTYPE (-EPROTOTYPE) +#else +# define UV__EPROTOTYPE (-4044) +#endif + +#if defined(EROFS) && !defined(_WIN32) +# define UV__EROFS (-EROFS) +#else +# define UV__EROFS (-4043) +#endif + +#if defined(ESHUTDOWN) && !defined(_WIN32) +# define UV__ESHUTDOWN (-ESHUTDOWN) +#else +# define UV__ESHUTDOWN (-4042) +#endif + +#if defined(ESPIPE) && !defined(_WIN32) +# define UV__ESPIPE (-ESPIPE) +#else +# define UV__ESPIPE (-4041) +#endif + +#if defined(ESRCH) && !defined(_WIN32) +# define UV__ESRCH (-ESRCH) +#else +# define UV__ESRCH (-4040) +#endif + +#if defined(ETIMEDOUT) && !defined(_WIN32) +# define UV__ETIMEDOUT (-ETIMEDOUT) +#else +# define UV__ETIMEDOUT (-4039) +#endif + +#if defined(ETXTBSY) && !defined(_WIN32) +# define UV__ETXTBSY (-ETXTBSY) +#else +# define UV__ETXTBSY (-4038) +#endif + +#if defined(EXDEV) && !defined(_WIN32) +# define UV__EXDEV (-EXDEV) +#else +# define UV__EXDEV (-4037) +#endif + +#if defined(EFBIG) && !defined(_WIN32) +# define UV__EFBIG (-EFBIG) +#else +# define UV__EFBIG (-4036) +#endif + +#if defined(ENOPROTOOPT) && !defined(_WIN32) +# define UV__ENOPROTOOPT (-ENOPROTOOPT) +#else +# define UV__ENOPROTOOPT (-4035) +#endif + +#if defined(ERANGE) && !defined(_WIN32) +# define UV__ERANGE (-ERANGE) +#else +# define UV__ERANGE (-4034) +#endif + +#if defined(ENXIO) && !defined(_WIN32) +# define UV__ENXIO (-ENXIO) +#else +# define UV__ENXIO (-4033) +#endif + +#if defined(EMLINK) && !defined(_WIN32) +# define UV__EMLINK (-EMLINK) +#else +# define UV__EMLINK (-4032) +#endif + +/* EHOSTDOWN is not visible on BSD-like systems when _POSIX_C_SOURCE is + * defined. Fortunately, its value is always 64 so it's possible albeit + * icky to hard-code it. + */ +#if defined(EHOSTDOWN) && !defined(_WIN32) +# define UV__EHOSTDOWN (-EHOSTDOWN) +#elif defined(__APPLE__) || \ + defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__NetBSD__) || \ + defined(__OpenBSD__) +# define UV__EHOSTDOWN (-64) +#else +# define UV__EHOSTDOWN (-4031) +#endif + +#endif /* UV_ERRNO_H_ */ diff --git a/3rdparty/libuv/include/uv-linux.h b/3rdparty/libuv/include/uv-linux.h new file mode 100644 index 00000000000..9b38405a190 --- /dev/null +++ b/3rdparty/libuv/include/uv-linux.h @@ -0,0 +1,34 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_LINUX_H +#define UV_LINUX_H + +#define UV_PLATFORM_LOOP_FIELDS \ + uv__io_t inotify_read_watcher; \ + void* inotify_watchers; \ + int inotify_fd; \ + +#define UV_PLATFORM_FS_EVENT_FIELDS \ + void* watchers[2]; \ + int wd; \ + +#endif /* UV_LINUX_H */ diff --git a/3rdparty/libuv/include/uv-sunos.h b/3rdparty/libuv/include/uv-sunos.h new file mode 100644 index 00000000000..042166424e5 --- /dev/null +++ b/3rdparty/libuv/include/uv-sunos.h @@ -0,0 +1,44 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_SUNOS_H +#define UV_SUNOS_H + +#include +#include + +/* For the sake of convenience and reduced #ifdef-ery in src/unix/sunos.c, + * add the fs_event fields even when this version of SunOS doesn't support + * file watching. + */ +#define UV_PLATFORM_LOOP_FIELDS \ + uv__io_t fs_event_watcher; \ + int fs_fd; \ + +#if defined(PORT_SOURCE_FILE) + +# define UV_PLATFORM_FS_EVENT_FIELDS \ + file_obj_t fo; \ + int fd; \ + +#endif /* defined(PORT_SOURCE_FILE) */ + +#endif /* UV_SUNOS_H */ diff --git a/3rdparty/libuv/include/uv-threadpool.h b/3rdparty/libuv/include/uv-threadpool.h new file mode 100644 index 00000000000..9708ebdd530 --- /dev/null +++ b/3rdparty/libuv/include/uv-threadpool.h @@ -0,0 +1,37 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* + * This file is private to libuv. It provides common functionality to both + * Windows and Unix backends. + */ + +#ifndef UV_THREADPOOL_H_ +#define UV_THREADPOOL_H_ + +struct uv__work { + void (*work)(struct uv__work *w); + void (*done)(struct uv__work *w, int status); + struct uv_loop_s* loop; + void* wq[2]; +}; + +#endif /* UV_THREADPOOL_H_ */ diff --git a/3rdparty/libuv/include/uv-unix.h b/3rdparty/libuv/include/uv-unix.h new file mode 100644 index 00000000000..82d193bdca4 --- /dev/null +++ b/3rdparty/libuv/include/uv-unix.h @@ -0,0 +1,383 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_UNIX_H +#define UV_UNIX_H + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#ifdef __ANDROID__ +#include "pthread-fixes.h" +#endif +#include + +#include "uv-threadpool.h" + +#if defined(__linux__) +# include "uv-linux.h" +#elif defined(_AIX) +# include "uv-aix.h" +#elif defined(__sun) +# include "uv-sunos.h" +#elif defined(__APPLE__) +# include "uv-darwin.h" +#elif defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) +# include "uv-bsd.h" +#endif + +#ifndef NI_MAXHOST +# define NI_MAXHOST 1025 +#endif + +#ifndef NI_MAXSERV +# define NI_MAXSERV 32 +#endif + +#ifndef UV_IO_PRIVATE_PLATFORM_FIELDS +# define UV_IO_PRIVATE_PLATFORM_FIELDS /* empty */ +#endif + +struct uv__io_s; +struct uv__async; +struct uv_loop_s; + +typedef void (*uv__io_cb)(struct uv_loop_s* loop, + struct uv__io_s* w, + unsigned int events); +typedef struct uv__io_s uv__io_t; + +struct uv__io_s { + uv__io_cb cb; + void* pending_queue[2]; + void* watcher_queue[2]; + unsigned int pevents; /* Pending event mask i.e. mask at next tick. */ + unsigned int events; /* Current event mask. */ + int fd; + UV_IO_PRIVATE_PLATFORM_FIELDS +}; + +typedef void (*uv__async_cb)(struct uv_loop_s* loop, + struct uv__async* w, + unsigned int nevents); + +struct uv__async { + uv__async_cb cb; + uv__io_t io_watcher; + int wfd; +}; + +#ifndef UV_PLATFORM_SEM_T +# define UV_PLATFORM_SEM_T sem_t +#endif + +#ifndef UV_PLATFORM_LOOP_FIELDS +# define UV_PLATFORM_LOOP_FIELDS /* empty */ +#endif + +#ifndef UV_PLATFORM_FS_EVENT_FIELDS +# define UV_PLATFORM_FS_EVENT_FIELDS /* empty */ +#endif + +#ifndef UV_STREAM_PRIVATE_PLATFORM_FIELDS +# define UV_STREAM_PRIVATE_PLATFORM_FIELDS /* empty */ +#endif + +/* Note: May be cast to struct iovec. See writev(2). */ +typedef struct uv_buf_t { + char* base; + size_t len; +} uv_buf_t; + +typedef int uv_file; +typedef int uv_os_sock_t; +typedef int uv_os_fd_t; + +#define UV_ONCE_INIT PTHREAD_ONCE_INIT + +typedef pthread_once_t uv_once_t; +typedef pthread_t uv_thread_t; +typedef pthread_mutex_t uv_mutex_t; +typedef pthread_rwlock_t uv_rwlock_t; +typedef UV_PLATFORM_SEM_T uv_sem_t; +typedef pthread_cond_t uv_cond_t; +typedef pthread_key_t uv_key_t; + +#if defined(__APPLE__) && defined(__MACH__) + +typedef struct { + unsigned int n; + unsigned int count; + uv_mutex_t mutex; + uv_sem_t turnstile1; + uv_sem_t turnstile2; +} uv_barrier_t; + +#else /* defined(__APPLE__) && defined(__MACH__) */ + +typedef pthread_barrier_t uv_barrier_t; + +#endif /* defined(__APPLE__) && defined(__MACH__) */ + +/* Platform-specific definitions for uv_spawn support. */ +typedef gid_t uv_gid_t; +typedef uid_t uv_uid_t; + +typedef struct dirent uv__dirent_t; + +#if defined(DT_UNKNOWN) +# define HAVE_DIRENT_TYPES +# if defined(DT_REG) +# define UV__DT_FILE DT_REG +# else +# define UV__DT_FILE -1 +# endif +# if defined(DT_DIR) +# define UV__DT_DIR DT_DIR +# else +# define UV__DT_DIR -2 +# endif +# if defined(DT_LNK) +# define UV__DT_LINK DT_LNK +# else +# define UV__DT_LINK -3 +# endif +# if defined(DT_FIFO) +# define UV__DT_FIFO DT_FIFO +# else +# define UV__DT_FIFO -4 +# endif +# if defined(DT_SOCK) +# define UV__DT_SOCKET DT_SOCK +# else +# define UV__DT_SOCKET -5 +# endif +# if defined(DT_CHR) +# define UV__DT_CHAR DT_CHR +# else +# define UV__DT_CHAR -6 +# endif +# if defined(DT_BLK) +# define UV__DT_BLOCK DT_BLK +# else +# define UV__DT_BLOCK -7 +# endif +#endif + +/* Platform-specific definitions for uv_dlopen support. */ +#define UV_DYNAMIC /* empty */ + +typedef struct { + void* handle; + char* errmsg; +} uv_lib_t; + +#define UV_LOOP_PRIVATE_FIELDS \ + unsigned long flags; \ + int backend_fd; \ + void* pending_queue[2]; \ + void* watcher_queue[2]; \ + uv__io_t** watchers; \ + unsigned int nwatchers; \ + unsigned int nfds; \ + void* wq[2]; \ + uv_mutex_t wq_mutex; \ + uv_async_t wq_async; \ + uv_rwlock_t cloexec_lock; \ + uv_handle_t* closing_handles; \ + void* process_handles[2]; \ + void* prepare_handles[2]; \ + void* check_handles[2]; \ + void* idle_handles[2]; \ + void* async_handles[2]; \ + struct uv__async async_watcher; \ + struct { \ + void* min; \ + unsigned int nelts; \ + } timer_heap; \ + uint64_t timer_counter; \ + uint64_t time; \ + int signal_pipefd[2]; \ + uv__io_t signal_io_watcher; \ + uv_signal_t child_watcher; \ + int emfile_fd; \ + UV_PLATFORM_LOOP_FIELDS \ + +#define UV_REQ_TYPE_PRIVATE /* empty */ + +#define UV_REQ_PRIVATE_FIELDS /* empty */ + +#define UV_PRIVATE_REQ_TYPES /* empty */ + +#define UV_WRITE_PRIVATE_FIELDS \ + void* queue[2]; \ + unsigned int write_index; \ + uv_buf_t* bufs; \ + unsigned int nbufs; \ + int error; \ + uv_buf_t bufsml[4]; \ + +#define UV_CONNECT_PRIVATE_FIELDS \ + void* queue[2]; \ + +#define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */ + +#define UV_UDP_SEND_PRIVATE_FIELDS \ + void* queue[2]; \ + struct sockaddr_storage addr; \ + unsigned int nbufs; \ + uv_buf_t* bufs; \ + ssize_t status; \ + uv_udp_send_cb send_cb; \ + uv_buf_t bufsml[4]; \ + +#define UV_HANDLE_PRIVATE_FIELDS \ + uv_handle_t* next_closing; \ + unsigned int flags; \ + +#define UV_STREAM_PRIVATE_FIELDS \ + uv_connect_t *connect_req; \ + uv_shutdown_t *shutdown_req; \ + uv__io_t io_watcher; \ + void* write_queue[2]; \ + void* write_completed_queue[2]; \ + uv_connection_cb connection_cb; \ + int delayed_error; \ + int accepted_fd; \ + void* queued_fds; \ + UV_STREAM_PRIVATE_PLATFORM_FIELDS \ + +#define UV_TCP_PRIVATE_FIELDS /* empty */ + +#define UV_UDP_PRIVATE_FIELDS \ + uv_alloc_cb alloc_cb; \ + uv_udp_recv_cb recv_cb; \ + uv__io_t io_watcher; \ + void* write_queue[2]; \ + void* write_completed_queue[2]; \ + +#define UV_PIPE_PRIVATE_FIELDS \ + const char* pipe_fname; /* strdup'ed */ + +#define UV_POLL_PRIVATE_FIELDS \ + uv__io_t io_watcher; + +#define UV_PREPARE_PRIVATE_FIELDS \ + uv_prepare_cb prepare_cb; \ + void* queue[2]; \ + +#define UV_CHECK_PRIVATE_FIELDS \ + uv_check_cb check_cb; \ + void* queue[2]; \ + +#define UV_IDLE_PRIVATE_FIELDS \ + uv_idle_cb idle_cb; \ + void* queue[2]; \ + +#define UV_ASYNC_PRIVATE_FIELDS \ + uv_async_cb async_cb; \ + void* queue[2]; \ + int pending; \ + +#define UV_TIMER_PRIVATE_FIELDS \ + uv_timer_cb timer_cb; \ + void* heap_node[3]; \ + uint64_t timeout; \ + uint64_t repeat; \ + uint64_t start_id; + +#define UV_GETADDRINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getaddrinfo_cb cb; \ + struct addrinfo* hints; \ + char* hostname; \ + char* service; \ + struct addrinfo* addrinfo; \ + int retcode; + +#define UV_GETNAMEINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getnameinfo_cb getnameinfo_cb; \ + struct sockaddr_storage storage; \ + int flags; \ + char host[NI_MAXHOST]; \ + char service[NI_MAXSERV]; \ + int retcode; + +#define UV_PROCESS_PRIVATE_FIELDS \ + void* queue[2]; \ + int status; \ + +#define UV_FS_PRIVATE_FIELDS \ + const char *new_path; \ + uv_file file; \ + int flags; \ + mode_t mode; \ + unsigned int nbufs; \ + uv_buf_t* bufs; \ + off_t off; \ + uv_uid_t uid; \ + uv_gid_t gid; \ + double atime; \ + double mtime; \ + struct uv__work work_req; \ + uv_buf_t bufsml[4]; \ + +#define UV_WORK_PRIVATE_FIELDS \ + struct uv__work work_req; + +#define UV_TTY_PRIVATE_FIELDS \ + struct termios orig_termios; \ + int mode; + +#define UV_SIGNAL_PRIVATE_FIELDS \ + /* RB_ENTRY(uv_signal_s) tree_entry; */ \ + struct { \ + struct uv_signal_s* rbe_left; \ + struct uv_signal_s* rbe_right; \ + struct uv_signal_s* rbe_parent; \ + int rbe_color; \ + } tree_entry; \ + /* Use two counters here so we don have to fiddle with atomics. */ \ + unsigned int caught_signals; \ + unsigned int dispatched_signals; + +#define UV_FS_EVENT_PRIVATE_FIELDS \ + uv_fs_event_cb cb; \ + UV_PLATFORM_FS_EVENT_FIELDS \ + +#endif /* UV_UNIX_H */ diff --git a/3rdparty/libuv/include/uv-version.h b/3rdparty/libuv/include/uv-version.h new file mode 100644 index 00000000000..6e61f55ed20 --- /dev/null +++ b/3rdparty/libuv/include/uv-version.h @@ -0,0 +1,43 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_VERSION_H +#define UV_VERSION_H + + /* + * Versions with the same major number are ABI stable. API is allowed to + * evolve between minor releases, but only in a backwards compatible way. + * Make sure you update the -soname directives in configure.ac + * and uv.gyp whenever you bump UV_VERSION_MAJOR or UV_VERSION_MINOR (but + * not UV_VERSION_PATCH.) + */ + +#define UV_VERSION_MAJOR 1 +#define UV_VERSION_MINOR 8 +#define UV_VERSION_PATCH 0 +#define UV_VERSION_IS_RELEASE 1 +#define UV_VERSION_SUFFIX "" + +#define UV_VERSION_HEX ((UV_VERSION_MAJOR << 16) | \ + (UV_VERSION_MINOR << 8) | \ + (UV_VERSION_PATCH)) + +#endif /* UV_VERSION_H */ diff --git a/3rdparty/libuv/include/uv-win.h b/3rdparty/libuv/include/uv-win.h new file mode 100644 index 00000000000..300be476203 --- /dev/null +++ b/3rdparty/libuv/include/uv-win.h @@ -0,0 +1,653 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0502 +#endif + +#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) +typedef intptr_t ssize_t; +# define _SSIZE_T_ +# define _SSIZE_T_DEFINED +#endif + +#include + +#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) +typedef struct pollfd { + SOCKET fd; + short events; + short revents; +} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD; +#endif + +#ifndef LOCALE_INVARIANT +# define LOCALE_INVARIANT 0x007f +#endif + +#include +#include +#include + +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1600 +# include "stdint-msvc2008.h" +#else +# include +#endif + +#include "tree.h" +#include "uv-threadpool.h" + +#define MAX_PIPENAME_LEN 256 + +#ifndef S_IFLNK +# define S_IFLNK 0xA000 +#endif + +/* Additional signals supported by uv_signal and or uv_kill. The CRT defines + * the following signals already: + * + * #define SIGINT 2 + * #define SIGILL 4 + * #define SIGABRT_COMPAT 6 + * #define SIGFPE 8 + * #define SIGSEGV 11 + * #define SIGTERM 15 + * #define SIGBREAK 21 + * #define SIGABRT 22 + * + * The additional signals have values that are common on other Unix + * variants (Linux and Darwin) + */ +#define SIGHUP 1 +#define SIGKILL 9 +#define SIGWINCH 28 + +/* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many */ +/* unix-like platforms. However MinGW doesn't define it, so we do. */ +#ifndef SIGABRT_COMPAT +# define SIGABRT_COMPAT 6 +#endif + +/* + * Guids and typedefs for winsock extension functions + * Mingw32 doesn't have these :-( + */ +#ifndef WSAID_ACCEPTEX +# define WSAID_ACCEPTEX \ + {0xb5367df1, 0xcbac, 0x11cf, \ + {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} + +# define WSAID_CONNECTEX \ + {0x25a207b9, 0xddf3, 0x4660, \ + {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}} + +# define WSAID_GETACCEPTEXSOCKADDRS \ + {0xb5367df2, 0xcbac, 0x11cf, \ + {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} + +# define WSAID_DISCONNECTEX \ + {0x7fda2e11, 0x8630, 0x436f, \ + {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}} + +# define WSAID_TRANSMITFILE \ + {0xb5367df0, 0xcbac, 0x11cf, \ + {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} + + typedef BOOL PASCAL (*LPFN_ACCEPTEX) + (SOCKET sListenSocket, + SOCKET sAcceptSocket, + PVOID lpOutputBuffer, + DWORD dwReceiveDataLength, + DWORD dwLocalAddressLength, + DWORD dwRemoteAddressLength, + LPDWORD lpdwBytesReceived, + LPOVERLAPPED lpOverlapped); + + typedef BOOL PASCAL (*LPFN_CONNECTEX) + (SOCKET s, + const struct sockaddr* name, + int namelen, + PVOID lpSendBuffer, + DWORD dwSendDataLength, + LPDWORD lpdwBytesSent, + LPOVERLAPPED lpOverlapped); + + typedef void PASCAL (*LPFN_GETACCEPTEXSOCKADDRS) + (PVOID lpOutputBuffer, + DWORD dwReceiveDataLength, + DWORD dwLocalAddressLength, + DWORD dwRemoteAddressLength, + LPSOCKADDR* LocalSockaddr, + LPINT LocalSockaddrLength, + LPSOCKADDR* RemoteSockaddr, + LPINT RemoteSockaddrLength); + + typedef BOOL PASCAL (*LPFN_DISCONNECTEX) + (SOCKET hSocket, + LPOVERLAPPED lpOverlapped, + DWORD dwFlags, + DWORD reserved); + + typedef BOOL PASCAL (*LPFN_TRANSMITFILE) + (SOCKET hSocket, + HANDLE hFile, + DWORD nNumberOfBytesToWrite, + DWORD nNumberOfBytesPerSend, + LPOVERLAPPED lpOverlapped, + LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, + DWORD dwFlags); + + typedef PVOID RTL_SRWLOCK; + typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; +#endif + +typedef int (WSAAPI* LPFN_WSARECV) + (SOCKET socket, + LPWSABUF buffers, + DWORD buffer_count, + LPDWORD bytes, + LPDWORD flags, + LPWSAOVERLAPPED overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); + +typedef int (WSAAPI* LPFN_WSARECVFROM) + (SOCKET socket, + LPWSABUF buffers, + DWORD buffer_count, + LPDWORD bytes, + LPDWORD flags, + struct sockaddr* addr, + LPINT addr_len, + LPWSAOVERLAPPED overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); + +#ifndef _NTDEF_ + typedef LONG NTSTATUS; + typedef NTSTATUS *PNTSTATUS; +#endif + +#ifndef RTL_CONDITION_VARIABLE_INIT + typedef PVOID CONDITION_VARIABLE, *PCONDITION_VARIABLE; +#endif + +typedef struct _AFD_POLL_HANDLE_INFO { + HANDLE Handle; + ULONG Events; + NTSTATUS Status; +} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO; + +typedef struct _AFD_POLL_INFO { + LARGE_INTEGER Timeout; + ULONG NumberOfHandles; + ULONG Exclusive; + AFD_POLL_HANDLE_INFO Handles[1]; +} AFD_POLL_INFO, *PAFD_POLL_INFO; + +#define UV_MSAFD_PROVIDER_COUNT 3 + + +/** + * It should be possible to cast uv_buf_t[] to WSABUF[] + * see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx + */ +typedef struct uv_buf_t { + ULONG len; + char* base; +} uv_buf_t; + +typedef int uv_file; +typedef SOCKET uv_os_sock_t; +typedef HANDLE uv_os_fd_t; + +typedef HANDLE uv_thread_t; + +typedef HANDLE uv_sem_t; + +typedef CRITICAL_SECTION uv_mutex_t; + +/* This condition variable implementation is based on the SetEvent solution + * (section 3.2) at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html + * We could not use the SignalObjectAndWait solution (section 3.4) because + * it want the 2nd argument (type uv_mutex_t) of uv_cond_wait() and + * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs. + */ + +typedef union { + CONDITION_VARIABLE cond_var; + struct { + unsigned int waiters_count; + CRITICAL_SECTION waiters_count_lock; + HANDLE signal_event; + HANDLE broadcast_event; + } fallback; +} uv_cond_t; + +typedef union { + struct { + unsigned int num_readers_; + CRITICAL_SECTION num_readers_lock_; + HANDLE write_semaphore_; + } state_; + /* TODO: remove me in v2.x. */ + struct { + SRWLOCK unused_; + } unused1_; + /* TODO: remove me in v2.x. */ + struct { + uv_mutex_t unused1_; + uv_mutex_t unused2_; + } unused2_; +} uv_rwlock_t; + +typedef struct { + unsigned int n; + unsigned int count; + uv_mutex_t mutex; + uv_sem_t turnstile1; + uv_sem_t turnstile2; +} uv_barrier_t; + +typedef struct { + DWORD tls_index; +} uv_key_t; + +#define UV_ONCE_INIT { 0, NULL } + +typedef struct uv_once_s { + unsigned char ran; + HANDLE event; +} uv_once_t; + +/* Platform-specific definitions for uv_spawn support. */ +typedef unsigned char uv_uid_t; +typedef unsigned char uv_gid_t; + +typedef struct uv__dirent_s { + int d_type; + char d_name[1]; +} uv__dirent_t; + +#define HAVE_DIRENT_TYPES +#define UV__DT_DIR UV_DIRENT_DIR +#define UV__DT_FILE UV_DIRENT_FILE +#define UV__DT_LINK UV_DIRENT_LINK +#define UV__DT_FIFO UV_DIRENT_FIFO +#define UV__DT_SOCKET UV_DIRENT_SOCKET +#define UV__DT_CHAR UV_DIRENT_CHAR +#define UV__DT_BLOCK UV_DIRENT_BLOCK + +/* Platform-specific definitions for uv_dlopen support. */ +#define UV_DYNAMIC FAR WINAPI +typedef struct { + HMODULE handle; + char* errmsg; +} uv_lib_t; + +RB_HEAD(uv_timer_tree_s, uv_timer_s); + +#define UV_LOOP_PRIVATE_FIELDS \ + /* The loop's I/O completion port */ \ + HANDLE iocp; \ + /* The current time according to the event loop. in msecs. */ \ + uint64_t time; \ + /* Tail of a single-linked circular queue of pending reqs. If the queue */ \ + /* is empty, tail_ is NULL. If there is only one item, */ \ + /* tail_->next_req == tail_ */ \ + uv_req_t* pending_reqs_tail; \ + /* Head of a single-linked list of closed handles */ \ + uv_handle_t* endgame_handles; \ + /* The head of the timers tree */ \ + struct uv_timer_tree_s timers; \ + /* Lists of active loop (prepare / check / idle) watchers */ \ + uv_prepare_t* prepare_handles; \ + uv_check_t* check_handles; \ + uv_idle_t* idle_handles; \ + /* This pointer will refer to the prepare/check/idle handle whose */ \ + /* callback is scheduled to be called next. This is needed to allow */ \ + /* safe removal from one of the lists above while that list being */ \ + /* iterated over. */ \ + uv_prepare_t* next_prepare_handle; \ + uv_check_t* next_check_handle; \ + uv_idle_t* next_idle_handle; \ + /* This handle holds the peer sockets for the fast variant of uv_poll_t */ \ + SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \ + /* Counter to keep track of active tcp streams */ \ + unsigned int active_tcp_streams; \ + /* Counter to keep track of active udp streams */ \ + unsigned int active_udp_streams; \ + /* Counter to started timer */ \ + uint64_t timer_counter; \ + /* Threadpool */ \ + void* wq[2]; \ + uv_mutex_t wq_mutex; \ + uv_async_t wq_async; + +#define UV_REQ_TYPE_PRIVATE \ + /* TODO: remove the req suffix */ \ + UV_ACCEPT, \ + UV_FS_EVENT_REQ, \ + UV_POLL_REQ, \ + UV_PROCESS_EXIT, \ + UV_READ, \ + UV_UDP_RECV, \ + UV_WAKEUP, \ + UV_SIGNAL_REQ, + +#define UV_REQ_PRIVATE_FIELDS \ + union { \ + /* Used by I/O operations */ \ + struct { \ + OVERLAPPED overlapped; \ + size_t queued_bytes; \ + } io; \ + } u; \ + struct uv_req_s* next_req; + +#define UV_WRITE_PRIVATE_FIELDS \ + int ipc_header; \ + uv_buf_t write_buffer; \ + HANDLE event_handle; \ + HANDLE wait_handle; + +#define UV_CONNECT_PRIVATE_FIELDS \ + /* empty */ + +#define UV_SHUTDOWN_PRIVATE_FIELDS \ + /* empty */ + +#define UV_UDP_SEND_PRIVATE_FIELDS \ + /* empty */ + +#define UV_PRIVATE_REQ_TYPES \ + typedef struct uv_pipe_accept_s { \ + UV_REQ_FIELDS \ + HANDLE pipeHandle; \ + struct uv_pipe_accept_s* next_pending; \ + } uv_pipe_accept_t; \ + \ + typedef struct uv_tcp_accept_s { \ + UV_REQ_FIELDS \ + SOCKET accept_socket; \ + char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \ + HANDLE event_handle; \ + HANDLE wait_handle; \ + struct uv_tcp_accept_s* next_pending; \ + } uv_tcp_accept_t; \ + \ + typedef struct uv_read_s { \ + UV_REQ_FIELDS \ + HANDLE event_handle; \ + HANDLE wait_handle; \ + } uv_read_t; + +#define uv_stream_connection_fields \ + unsigned int write_reqs_pending; \ + uv_shutdown_t* shutdown_req; + +#define uv_stream_server_fields \ + uv_connection_cb connection_cb; + +#define UV_STREAM_PRIVATE_FIELDS \ + unsigned int reqs_pending; \ + int activecnt; \ + uv_read_t read_req; \ + union { \ + struct { uv_stream_connection_fields } conn; \ + struct { uv_stream_server_fields } serv; \ + } stream; + +#define uv_tcp_server_fields \ + uv_tcp_accept_t* accept_reqs; \ + unsigned int processed_accepts; \ + uv_tcp_accept_t* pending_accepts; \ + LPFN_ACCEPTEX func_acceptex; + +#define uv_tcp_connection_fields \ + uv_buf_t read_buffer; \ + LPFN_CONNECTEX func_connectex; + +#define UV_TCP_PRIVATE_FIELDS \ + SOCKET socket; \ + int delayed_error; \ + union { \ + struct { uv_tcp_server_fields } serv; \ + struct { uv_tcp_connection_fields } conn; \ + } tcp; + +#define UV_UDP_PRIVATE_FIELDS \ + SOCKET socket; \ + unsigned int reqs_pending; \ + int activecnt; \ + uv_req_t recv_req; \ + uv_buf_t recv_buffer; \ + struct sockaddr_storage recv_from; \ + int recv_from_len; \ + uv_udp_recv_cb recv_cb; \ + uv_alloc_cb alloc_cb; \ + LPFN_WSARECV func_wsarecv; \ + LPFN_WSARECVFROM func_wsarecvfrom; + +#define uv_pipe_server_fields \ + int pending_instances; \ + uv_pipe_accept_t* accept_reqs; \ + uv_pipe_accept_t* pending_accepts; + +#define uv_pipe_connection_fields \ + uv_timer_t* eof_timer; \ + uv_write_t ipc_header_write_req; \ + int ipc_pid; \ + uint64_t remaining_ipc_rawdata_bytes; \ + struct { \ + void* queue[2]; \ + int queue_len; \ + } pending_ipc_info; \ + uv_write_t* non_overlapped_writes_tail; \ + uv_mutex_t readfile_mutex; \ + volatile HANDLE readfile_thread; + +#define UV_PIPE_PRIVATE_FIELDS \ + HANDLE handle; \ + WCHAR* name; \ + union { \ + struct { uv_pipe_server_fields } serv; \ + struct { uv_pipe_connection_fields } conn; \ + } pipe; + +/* TODO: put the parser states in an union - TTY handles are always */ +/* half-duplex so read-state can safely overlap write-state. */ +#define UV_TTY_PRIVATE_FIELDS \ + HANDLE handle; \ + union { \ + struct { \ + /* Used for readable TTY handles */ \ + HANDLE read_line_handle; \ + uv_buf_t read_line_buffer; \ + HANDLE read_raw_wait; \ + /* Fields used for translating win keystrokes into vt100 characters */ \ + char last_key[8]; \ + unsigned char last_key_offset; \ + unsigned char last_key_len; \ + WCHAR last_utf16_high_surrogate; \ + INPUT_RECORD last_input_record; \ + } rd; \ + struct { \ + /* Used for writable TTY handles */ \ + /* utf8-to-utf16 conversion state */ \ + unsigned int utf8_codepoint; \ + unsigned char utf8_bytes_left; \ + /* eol conversion state */ \ + unsigned char previous_eol; \ + /* ansi parser state */ \ + unsigned char ansi_parser_state; \ + unsigned char ansi_csi_argc; \ + unsigned short ansi_csi_argv[4]; \ + COORD saved_position; \ + WORD saved_attributes; \ + } wr; \ + } tty; + +#define UV_POLL_PRIVATE_FIELDS \ + SOCKET socket; \ + /* Used in fast mode */ \ + SOCKET peer_socket; \ + AFD_POLL_INFO afd_poll_info_1; \ + AFD_POLL_INFO afd_poll_info_2; \ + /* Used in fast and slow mode. */ \ + uv_req_t poll_req_1; \ + uv_req_t poll_req_2; \ + unsigned char submitted_events_1; \ + unsigned char submitted_events_2; \ + unsigned char mask_events_1; \ + unsigned char mask_events_2; \ + unsigned char events; + +#define UV_TIMER_PRIVATE_FIELDS \ + RB_ENTRY(uv_timer_s) tree_entry; \ + uint64_t due; \ + uint64_t repeat; \ + uint64_t start_id; \ + uv_timer_cb timer_cb; + +#define UV_ASYNC_PRIVATE_FIELDS \ + struct uv_req_s async_req; \ + uv_async_cb async_cb; \ + /* char to avoid alignment issues */ \ + char volatile async_sent; + +#define UV_PREPARE_PRIVATE_FIELDS \ + uv_prepare_t* prepare_prev; \ + uv_prepare_t* prepare_next; \ + uv_prepare_cb prepare_cb; + +#define UV_CHECK_PRIVATE_FIELDS \ + uv_check_t* check_prev; \ + uv_check_t* check_next; \ + uv_check_cb check_cb; + +#define UV_IDLE_PRIVATE_FIELDS \ + uv_idle_t* idle_prev; \ + uv_idle_t* idle_next; \ + uv_idle_cb idle_cb; + +#define UV_HANDLE_PRIVATE_FIELDS \ + uv_handle_t* endgame_next; \ + unsigned int flags; + +#define UV_GETADDRINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getaddrinfo_cb getaddrinfo_cb; \ + void* alloc; \ + WCHAR* node; \ + WCHAR* service; \ + /* The addrinfoW field is used to store a pointer to the hints, and */ \ + /* later on to store the result of GetAddrInfoW. The final result will */ \ + /* be converted to struct addrinfo* and stored in the addrinfo field. */ \ + struct addrinfoW* addrinfow; \ + struct addrinfo* addrinfo; \ + int retcode; + +#define UV_GETNAMEINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getnameinfo_cb getnameinfo_cb; \ + struct sockaddr_storage storage; \ + int flags; \ + char host[NI_MAXHOST]; \ + char service[NI_MAXSERV]; \ + int retcode; + +#define UV_PROCESS_PRIVATE_FIELDS \ + struct uv_process_exit_s { \ + UV_REQ_FIELDS \ + } exit_req; \ + BYTE* child_stdio_buffer; \ + int exit_signal; \ + HANDLE wait_handle; \ + HANDLE process_handle; \ + volatile char exit_cb_pending; + +#define UV_FS_PRIVATE_FIELDS \ + struct uv__work work_req; \ + int flags; \ + DWORD sys_errno_; \ + union { \ + /* TODO: remove me in 0.9. */ \ + WCHAR* pathw; \ + int fd; \ + } file; \ + union { \ + struct { \ + int mode; \ + WCHAR* new_pathw; \ + int file_flags; \ + int fd_out; \ + unsigned int nbufs; \ + uv_buf_t* bufs; \ + int64_t offset; \ + uv_buf_t bufsml[4]; \ + } info; \ + struct { \ + double atime; \ + double mtime; \ + } time; \ + } fs; + +#define UV_WORK_PRIVATE_FIELDS \ + struct uv__work work_req; + +#define UV_FS_EVENT_PRIVATE_FIELDS \ + struct uv_fs_event_req_s { \ + UV_REQ_FIELDS \ + } req; \ + HANDLE dir_handle; \ + int req_pending; \ + uv_fs_event_cb cb; \ + WCHAR* filew; \ + WCHAR* short_filew; \ + WCHAR* dirw; \ + char* buffer; + +#define UV_SIGNAL_PRIVATE_FIELDS \ + RB_ENTRY(uv_signal_s) tree_entry; \ + struct uv_req_s signal_req; \ + unsigned long pending_signum; + +int uv_utf16_to_utf8(const WCHAR* utf16Buffer, size_t utf16Size, + char* utf8Buffer, size_t utf8Size); +int uv_utf8_to_utf16(const char* utf8Buffer, WCHAR* utf16Buffer, + size_t utf16Size); + +#ifndef F_OK +#define F_OK 0 +#endif +#ifndef R_OK +#define R_OK 4 +#endif +#ifndef W_OK +#define W_OK 2 +#endif +#ifndef X_OK +#define X_OK 1 +#endif diff --git a/3rdparty/libuv/include/uv.h b/3rdparty/libuv/include/uv.h new file mode 100644 index 00000000000..dd3111a960e --- /dev/null +++ b/3rdparty/libuv/include/uv.h @@ -0,0 +1,1482 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* See https://github.com/libuv/libuv#documentation for documentation. */ + +#ifndef UV_H +#define UV_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WIN32 + /* Windows - set up dll import/export decorators. */ +# if defined(BUILDING_UV_SHARED) + /* Building shared library. */ +# define UV_EXTERN __declspec(dllexport) +# elif defined(USING_UV_SHARED) + /* Using shared library. */ +# define UV_EXTERN __declspec(dllimport) +# else + /* Building static library. */ +# define UV_EXTERN /* nothing */ +# endif +#elif __GNUC__ >= 4 +# define UV_EXTERN __attribute__((visibility("default"))) +#else +# define UV_EXTERN /* nothing */ +#endif + +#include "uv-errno.h" +#include "uv-version.h" +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1600 +# include "stdint-msvc2008.h" +#else +# include +#endif + +#if defined(_WIN32) +# include "uv-win.h" +#else +# include "uv-unix.h" +#endif + +/* Expand this list if necessary. */ +#define UV_ERRNO_MAP(XX) \ + XX(E2BIG, "argument list too long") \ + XX(EACCES, "permission denied") \ + XX(EADDRINUSE, "address already in use") \ + XX(EADDRNOTAVAIL, "address not available") \ + XX(EAFNOSUPPORT, "address family not supported") \ + XX(EAGAIN, "resource temporarily unavailable") \ + XX(EAI_ADDRFAMILY, "address family not supported") \ + XX(EAI_AGAIN, "temporary failure") \ + XX(EAI_BADFLAGS, "bad ai_flags value") \ + XX(EAI_BADHINTS, "invalid value for hints") \ + XX(EAI_CANCELED, "request canceled") \ + XX(EAI_FAIL, "permanent failure") \ + XX(EAI_FAMILY, "ai_family not supported") \ + XX(EAI_MEMORY, "out of memory") \ + XX(EAI_NODATA, "no address") \ + XX(EAI_NONAME, "unknown node or service") \ + XX(EAI_OVERFLOW, "argument buffer overflow") \ + XX(EAI_PROTOCOL, "resolved protocol is unknown") \ + XX(EAI_SERVICE, "service not available for socket type") \ + XX(EAI_SOCKTYPE, "socket type not supported") \ + XX(EALREADY, "connection already in progress") \ + XX(EBADF, "bad file descriptor") \ + XX(EBUSY, "resource busy or locked") \ + XX(ECANCELED, "operation canceled") \ + XX(ECHARSET, "invalid Unicode character") \ + XX(ECONNABORTED, "software caused connection abort") \ + XX(ECONNREFUSED, "connection refused") \ + XX(ECONNRESET, "connection reset by peer") \ + XX(EDESTADDRREQ, "destination address required") \ + XX(EEXIST, "file already exists") \ + XX(EFAULT, "bad address in system call argument") \ + XX(EFBIG, "file too large") \ + XX(EHOSTUNREACH, "host is unreachable") \ + XX(EINTR, "interrupted system call") \ + XX(EINVAL, "invalid argument") \ + XX(EIO, "i/o error") \ + XX(EISCONN, "socket is already connected") \ + XX(EISDIR, "illegal operation on a directory") \ + XX(ELOOP, "too many symbolic links encountered") \ + XX(EMFILE, "too many open files") \ + XX(EMSGSIZE, "message too long") \ + XX(ENAMETOOLONG, "name too long") \ + XX(ENETDOWN, "network is down") \ + XX(ENETUNREACH, "network is unreachable") \ + XX(ENFILE, "file table overflow") \ + XX(ENOBUFS, "no buffer space available") \ + XX(ENODEV, "no such device") \ + XX(ENOENT, "no such file or directory") \ + XX(ENOMEM, "not enough memory") \ + XX(ENONET, "machine is not on the network") \ + XX(ENOPROTOOPT, "protocol not available") \ + XX(ENOSPC, "no space left on device") \ + XX(ENOSYS, "function not implemented") \ + XX(ENOTCONN, "socket is not connected") \ + XX(ENOTDIR, "not a directory") \ + XX(ENOTEMPTY, "directory not empty") \ + XX(ENOTSOCK, "socket operation on non-socket") \ + XX(ENOTSUP, "operation not supported on socket") \ + XX(EPERM, "operation not permitted") \ + XX(EPIPE, "broken pipe") \ + XX(EPROTO, "protocol error") \ + XX(EPROTONOSUPPORT, "protocol not supported") \ + XX(EPROTOTYPE, "protocol wrong type for socket") \ + XX(ERANGE, "result too large") \ + XX(EROFS, "read-only file system") \ + XX(ESHUTDOWN, "cannot send after transport endpoint shutdown") \ + XX(ESPIPE, "invalid seek") \ + XX(ESRCH, "no such process") \ + XX(ETIMEDOUT, "connection timed out") \ + XX(ETXTBSY, "text file is busy") \ + XX(EXDEV, "cross-device link not permitted") \ + XX(UNKNOWN, "unknown error") \ + XX(EOF, "end of file") \ + XX(ENXIO, "no such device or address") \ + XX(EMLINK, "too many links") \ + XX(EHOSTDOWN, "host is down") \ + +#define UV_HANDLE_TYPE_MAP(XX) \ + XX(ASYNC, async) \ + XX(CHECK, check) \ + XX(FS_EVENT, fs_event) \ + XX(FS_POLL, fs_poll) \ + XX(HANDLE, handle) \ + XX(IDLE, idle) \ + XX(NAMED_PIPE, pipe) \ + XX(POLL, poll) \ + XX(PREPARE, prepare) \ + XX(PROCESS, process) \ + XX(STREAM, stream) \ + XX(TCP, tcp) \ + XX(TIMER, timer) \ + XX(TTY, tty) \ + XX(UDP, udp) \ + XX(SIGNAL, signal) \ + +#define UV_REQ_TYPE_MAP(XX) \ + XX(REQ, req) \ + XX(CONNECT, connect) \ + XX(WRITE, write) \ + XX(SHUTDOWN, shutdown) \ + XX(UDP_SEND, udp_send) \ + XX(FS, fs) \ + XX(WORK, work) \ + XX(GETADDRINFO, getaddrinfo) \ + XX(GETNAMEINFO, getnameinfo) \ + +typedef enum { +#define XX(code, _) UV_ ## code = UV__ ## code, + UV_ERRNO_MAP(XX) +#undef XX + UV_ERRNO_MAX = UV__EOF - 1 +} uv_errno_t; + +typedef enum { + UV_UNKNOWN_HANDLE = 0, +#define XX(uc, lc) UV_##uc, + UV_HANDLE_TYPE_MAP(XX) +#undef XX + UV_FILE, + UV_HANDLE_TYPE_MAX +} uv_handle_type; + +typedef enum { + UV_UNKNOWN_REQ = 0, +#define XX(uc, lc) UV_##uc, + UV_REQ_TYPE_MAP(XX) +#undef XX + UV_REQ_TYPE_PRIVATE + UV_REQ_TYPE_MAX +} uv_req_type; + + +/* Handle types. */ +typedef struct uv_loop_s uv_loop_t; +typedef struct uv_handle_s uv_handle_t; +typedef struct uv_stream_s uv_stream_t; +typedef struct uv_tcp_s uv_tcp_t; +typedef struct uv_udp_s uv_udp_t; +typedef struct uv_pipe_s uv_pipe_t; +typedef struct uv_tty_s uv_tty_t; +typedef struct uv_poll_s uv_poll_t; +typedef struct uv_timer_s uv_timer_t; +typedef struct uv_prepare_s uv_prepare_t; +typedef struct uv_check_s uv_check_t; +typedef struct uv_idle_s uv_idle_t; +typedef struct uv_async_s uv_async_t; +typedef struct uv_process_s uv_process_t; +typedef struct uv_fs_event_s uv_fs_event_t; +typedef struct uv_fs_poll_s uv_fs_poll_t; +typedef struct uv_signal_s uv_signal_t; + +/* Request types. */ +typedef struct uv_req_s uv_req_t; +typedef struct uv_getaddrinfo_s uv_getaddrinfo_t; +typedef struct uv_getnameinfo_s uv_getnameinfo_t; +typedef struct uv_shutdown_s uv_shutdown_t; +typedef struct uv_write_s uv_write_t; +typedef struct uv_connect_s uv_connect_t; +typedef struct uv_udp_send_s uv_udp_send_t; +typedef struct uv_fs_s uv_fs_t; +typedef struct uv_work_s uv_work_t; + +/* None of the above. */ +typedef struct uv_cpu_info_s uv_cpu_info_t; +typedef struct uv_interface_address_s uv_interface_address_t; +typedef struct uv_dirent_s uv_dirent_t; + +typedef enum { + UV_LOOP_BLOCK_SIGNAL +} uv_loop_option; + +typedef enum { + UV_RUN_DEFAULT = 0, + UV_RUN_ONCE, + UV_RUN_NOWAIT +} uv_run_mode; + + +UV_EXTERN unsigned int uv_version(void); +UV_EXTERN const char* uv_version_string(void); + +typedef void* (*uv_malloc_func)(size_t size); +typedef void* (*uv_realloc_func)(void* ptr, size_t size); +typedef void* (*uv_calloc_func)(size_t count, size_t size); +typedef void (*uv_free_func)(void* ptr); + +UV_EXTERN int uv_replace_allocator(uv_malloc_func malloc_func, + uv_realloc_func realloc_func, + uv_calloc_func calloc_func, + uv_free_func free_func); + +UV_EXTERN uv_loop_t* uv_default_loop(void); +UV_EXTERN int uv_loop_init(uv_loop_t* loop); +UV_EXTERN int uv_loop_close(uv_loop_t* loop); +/* + * NOTE: + * This function is DEPRECATED (to be removed after 0.12), users should + * allocate the loop manually and use uv_loop_init instead. + */ +UV_EXTERN uv_loop_t* uv_loop_new(void); +/* + * NOTE: + * This function is DEPRECATED (to be removed after 0.12). Users should use + * uv_loop_close and free the memory manually instead. + */ +UV_EXTERN void uv_loop_delete(uv_loop_t*); +UV_EXTERN size_t uv_loop_size(void); +UV_EXTERN int uv_loop_alive(const uv_loop_t* loop); +UV_EXTERN int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...); + +UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode); +UV_EXTERN void uv_stop(uv_loop_t*); + +UV_EXTERN void uv_ref(uv_handle_t*); +UV_EXTERN void uv_unref(uv_handle_t*); +UV_EXTERN int uv_has_ref(const uv_handle_t*); + +UV_EXTERN void uv_update_time(uv_loop_t*); +UV_EXTERN uint64_t uv_now(const uv_loop_t*); + +UV_EXTERN int uv_backend_fd(const uv_loop_t*); +UV_EXTERN int uv_backend_timeout(const uv_loop_t*); + +typedef void (*uv_alloc_cb)(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf); +typedef void (*uv_read_cb)(uv_stream_t* stream, + ssize_t nread, + const uv_buf_t* buf); +typedef void (*uv_write_cb)(uv_write_t* req, int status); +typedef void (*uv_connect_cb)(uv_connect_t* req, int status); +typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status); +typedef void (*uv_connection_cb)(uv_stream_t* server, int status); +typedef void (*uv_close_cb)(uv_handle_t* handle); +typedef void (*uv_poll_cb)(uv_poll_t* handle, int status, int events); +typedef void (*uv_timer_cb)(uv_timer_t* handle); +typedef void (*uv_async_cb)(uv_async_t* handle); +typedef void (*uv_prepare_cb)(uv_prepare_t* handle); +typedef void (*uv_check_cb)(uv_check_t* handle); +typedef void (*uv_idle_cb)(uv_idle_t* handle); +typedef void (*uv_exit_cb)(uv_process_t*, int64_t exit_status, int term_signal); +typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg); +typedef void (*uv_fs_cb)(uv_fs_t* req); +typedef void (*uv_work_cb)(uv_work_t* req); +typedef void (*uv_after_work_cb)(uv_work_t* req, int status); +typedef void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* req, + int status, + struct addrinfo* res); +typedef void (*uv_getnameinfo_cb)(uv_getnameinfo_t* req, + int status, + const char* hostname, + const char* service); + +typedef struct { + long tv_sec; + long tv_nsec; +} uv_timespec_t; + + +typedef struct { + uint64_t st_dev; + uint64_t st_mode; + uint64_t st_nlink; + uint64_t st_uid; + uint64_t st_gid; + uint64_t st_rdev; + uint64_t st_ino; + uint64_t st_size; + uint64_t st_blksize; + uint64_t st_blocks; + uint64_t st_flags; + uint64_t st_gen; + uv_timespec_t st_atim; + uv_timespec_t st_mtim; + uv_timespec_t st_ctim; + uv_timespec_t st_birthtim; +} uv_stat_t; + + +typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle, + const char* filename, + int events, + int status); + +typedef void (*uv_fs_poll_cb)(uv_fs_poll_t* handle, + int status, + const uv_stat_t* prev, + const uv_stat_t* curr); + +typedef void (*uv_signal_cb)(uv_signal_t* handle, int signum); + + +typedef enum { + UV_LEAVE_GROUP = 0, + UV_JOIN_GROUP +} uv_membership; + + +UV_EXTERN const char* uv_strerror(int err); +UV_EXTERN const char* uv_err_name(int err); + + +#define UV_REQ_FIELDS \ + /* public */ \ + void* data; \ + /* read-only */ \ + uv_req_type type; \ + /* private */ \ + void* active_queue[2]; \ + void* reserved[4]; \ + UV_REQ_PRIVATE_FIELDS \ + +/* Abstract base class of all requests. */ +struct uv_req_s { + UV_REQ_FIELDS +}; + + +/* Platform-specific request types. */ +UV_PRIVATE_REQ_TYPES + + +UV_EXTERN int uv_shutdown(uv_shutdown_t* req, + uv_stream_t* handle, + uv_shutdown_cb cb); + +struct uv_shutdown_s { + UV_REQ_FIELDS + uv_stream_t* handle; + uv_shutdown_cb cb; + UV_SHUTDOWN_PRIVATE_FIELDS +}; + + +#define UV_HANDLE_FIELDS \ + /* public */ \ + void* data; \ + /* read-only */ \ + uv_loop_t* loop; \ + uv_handle_type type; \ + /* private */ \ + uv_close_cb close_cb; \ + void* handle_queue[2]; \ + union { \ + int fd; \ + void* reserved[4]; \ + } u; \ + UV_HANDLE_PRIVATE_FIELDS \ + +/* The abstract base class of all handles. */ +struct uv_handle_s { + UV_HANDLE_FIELDS +}; + +UV_EXTERN size_t uv_handle_size(uv_handle_type type); +UV_EXTERN size_t uv_req_size(uv_req_type type); + +UV_EXTERN int uv_is_active(const uv_handle_t* handle); + +UV_EXTERN void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg); + +/* Helpers for ad hoc debugging, no API/ABI stability guaranteed. */ +UV_EXTERN void uv_print_all_handles(uv_loop_t* loop, FILE* stream); +UV_EXTERN void uv_print_active_handles(uv_loop_t* loop, FILE* stream); + +UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb); + +UV_EXTERN int uv_send_buffer_size(uv_handle_t* handle, int* value); +UV_EXTERN int uv_recv_buffer_size(uv_handle_t* handle, int* value); + +UV_EXTERN int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd); + +UV_EXTERN uv_buf_t uv_buf_init(char* base, unsigned int len); + + +#define UV_STREAM_FIELDS \ + /* number of bytes queued for writing */ \ + size_t write_queue_size; \ + uv_alloc_cb alloc_cb; \ + uv_read_cb read_cb; \ + /* private */ \ + UV_STREAM_PRIVATE_FIELDS + +/* + * uv_stream_t is a subclass of uv_handle_t. + * + * uv_stream is an abstract class. + * + * uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t and uv_tty_t. + */ +struct uv_stream_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS +}; + +UV_EXTERN int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb); +UV_EXTERN int uv_accept(uv_stream_t* server, uv_stream_t* client); + +UV_EXTERN int uv_read_start(uv_stream_t*, + uv_alloc_cb alloc_cb, + uv_read_cb read_cb); +UV_EXTERN int uv_read_stop(uv_stream_t*); + +UV_EXTERN int uv_write(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_write_cb cb); +UV_EXTERN int uv_write2(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_stream_t* send_handle, + uv_write_cb cb); +UV_EXTERN int uv_try_write(uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs); + +/* uv_write_t is a subclass of uv_req_t. */ +struct uv_write_s { + UV_REQ_FIELDS + uv_write_cb cb; + uv_stream_t* send_handle; + uv_stream_t* handle; + UV_WRITE_PRIVATE_FIELDS +}; + + +UV_EXTERN int uv_is_readable(const uv_stream_t* handle); +UV_EXTERN int uv_is_writable(const uv_stream_t* handle); + +UV_EXTERN int uv_stream_set_blocking(uv_stream_t* handle, int blocking); + +UV_EXTERN int uv_is_closing(const uv_handle_t* handle); + + +/* + * uv_tcp_t is a subclass of uv_stream_t. + * + * Represents a TCP stream or TCP server. + */ +struct uv_tcp_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS + UV_TCP_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle); +UV_EXTERN int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, unsigned int flags); +UV_EXTERN int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock); +UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable); +UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle, + int enable, + unsigned int delay); +UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable); + +enum uv_tcp_flags { + /* Used with uv_tcp_bind, when an IPv6 address is used. */ + UV_TCP_IPV6ONLY = 1 +}; + +UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle, + const struct sockaddr* addr, + unsigned int flags); +UV_EXTERN int uv_tcp_getsockname(const uv_tcp_t* handle, + struct sockaddr* name, + int* namelen); +UV_EXTERN int uv_tcp_getpeername(const uv_tcp_t* handle, + struct sockaddr* name, + int* namelen); +UV_EXTERN int uv_tcp_connect(uv_connect_t* req, + uv_tcp_t* handle, + const struct sockaddr* addr, + uv_connect_cb cb); + +/* uv_connect_t is a subclass of uv_req_t. */ +struct uv_connect_s { + UV_REQ_FIELDS + uv_connect_cb cb; + uv_stream_t* handle; + UV_CONNECT_PRIVATE_FIELDS +}; + + +/* + * UDP support. + */ + +enum uv_udp_flags { + /* Disables dual stack mode. */ + UV_UDP_IPV6ONLY = 1, + /* + * Indicates message was truncated because read buffer was too small. The + * remainder was discarded by the OS. Used in uv_udp_recv_cb. + */ + UV_UDP_PARTIAL = 2, + /* + * Indicates if SO_REUSEADDR will be set when binding the handle. + * This sets the SO_REUSEPORT socket flag on the BSDs and OS X. On other + * Unix platforms, it sets the SO_REUSEADDR flag. What that means is that + * multiple threads or processes can bind to the same address without error + * (provided they all set the flag) but only the last one to bind will receive + * any traffic, in effect "stealing" the port from the previous listener. + */ + UV_UDP_REUSEADDR = 4 +}; + +typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status); +typedef void (*uv_udp_recv_cb)(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags); + +/* uv_udp_t is a subclass of uv_handle_t. */ +struct uv_udp_s { + UV_HANDLE_FIELDS + /* read-only */ + /* + * Number of bytes queued for sending. This field strictly shows how much + * information is currently queued. + */ + size_t send_queue_size; + /* + * Number of send requests currently in the queue awaiting to be processed. + */ + size_t send_queue_count; + UV_UDP_PRIVATE_FIELDS +}; + +/* uv_udp_send_t is a subclass of uv_req_t. */ +struct uv_udp_send_s { + UV_REQ_FIELDS + uv_udp_t* handle; + uv_udp_send_cb cb; + UV_UDP_SEND_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle); +UV_EXTERN int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, unsigned int flags); +UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock); +UV_EXTERN int uv_udp_bind(uv_udp_t* handle, + const struct sockaddr* addr, + unsigned int flags); + +UV_EXTERN int uv_udp_getsockname(const uv_udp_t* handle, + struct sockaddr* name, + int* namelen); +UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle, + const char* multicast_addr, + const char* interface_addr, + uv_membership membership); +UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on); +UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl); +UV_EXTERN int uv_udp_set_multicast_interface(uv_udp_t* handle, + const char* interface_addr); +UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on); +UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl); +UV_EXTERN int uv_udp_send(uv_udp_send_t* req, + uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + uv_udp_send_cb send_cb); +UV_EXTERN int uv_udp_try_send(uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr); +UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, + uv_alloc_cb alloc_cb, + uv_udp_recv_cb recv_cb); +UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle); + + +/* + * uv_tty_t is a subclass of uv_stream_t. + * + * Representing a stream for the console. + */ +struct uv_tty_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS + UV_TTY_PRIVATE_FIELDS +}; + +typedef enum { + /* Initial/normal terminal mode */ + UV_TTY_MODE_NORMAL, + /* Raw input mode (On Windows, ENABLE_WINDOW_INPUT is also enabled) */ + UV_TTY_MODE_RAW, + /* Binary-safe I/O mode for IPC (Unix-only) */ + UV_TTY_MODE_IO +} uv_tty_mode_t; + +UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable); +UV_EXTERN int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode); +UV_EXTERN int uv_tty_reset_mode(void); +UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height); + +#ifdef __cplusplus +extern "C++" { + +inline int uv_tty_set_mode(uv_tty_t* handle, int mode) { + return uv_tty_set_mode(handle, static_cast(mode)); +} + +} +#endif + +UV_EXTERN uv_handle_type uv_guess_handle(uv_file file); + +/* + * uv_pipe_t is a subclass of uv_stream_t. + * + * Representing a pipe stream or pipe server. On Windows this is a Named + * Pipe. On Unix this is a Unix domain socket. + */ +struct uv_pipe_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS + int ipc; /* non-zero if this pipe is used for passing handles */ + UV_PIPE_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int ipc); +UV_EXTERN int uv_pipe_open(uv_pipe_t*, uv_file file); +UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name); +UV_EXTERN void uv_pipe_connect(uv_connect_t* req, + uv_pipe_t* handle, + const char* name, + uv_connect_cb cb); +UV_EXTERN int uv_pipe_getsockname(const uv_pipe_t* handle, + char* buffer, + size_t* size); +UV_EXTERN int uv_pipe_getpeername(const uv_pipe_t* handle, + char* buffer, + size_t* size); +UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count); +UV_EXTERN int uv_pipe_pending_count(uv_pipe_t* handle); +UV_EXTERN uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle); + + +struct uv_poll_s { + UV_HANDLE_FIELDS + uv_poll_cb poll_cb; + UV_POLL_PRIVATE_FIELDS +}; + +enum uv_poll_event { + UV_READABLE = 1, + UV_WRITABLE = 2 +}; + +UV_EXTERN int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd); +UV_EXTERN int uv_poll_init_socket(uv_loop_t* loop, + uv_poll_t* handle, + uv_os_sock_t socket); +UV_EXTERN int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb); +UV_EXTERN int uv_poll_stop(uv_poll_t* handle); + + +struct uv_prepare_s { + UV_HANDLE_FIELDS + UV_PREPARE_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_prepare_init(uv_loop_t*, uv_prepare_t* prepare); +UV_EXTERN int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb); +UV_EXTERN int uv_prepare_stop(uv_prepare_t* prepare); + + +struct uv_check_s { + UV_HANDLE_FIELDS + UV_CHECK_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_check_init(uv_loop_t*, uv_check_t* check); +UV_EXTERN int uv_check_start(uv_check_t* check, uv_check_cb cb); +UV_EXTERN int uv_check_stop(uv_check_t* check); + + +struct uv_idle_s { + UV_HANDLE_FIELDS + UV_IDLE_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_idle_init(uv_loop_t*, uv_idle_t* idle); +UV_EXTERN int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb); +UV_EXTERN int uv_idle_stop(uv_idle_t* idle); + + +struct uv_async_s { + UV_HANDLE_FIELDS + UV_ASYNC_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_async_init(uv_loop_t*, + uv_async_t* async, + uv_async_cb async_cb); +UV_EXTERN int uv_async_send(uv_async_t* async); + + +/* + * uv_timer_t is a subclass of uv_handle_t. + * + * Used to get woken up at a specified time in the future. + */ +struct uv_timer_s { + UV_HANDLE_FIELDS + UV_TIMER_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* handle); +UV_EXTERN int uv_timer_start(uv_timer_t* handle, + uv_timer_cb cb, + uint64_t timeout, + uint64_t repeat); +UV_EXTERN int uv_timer_stop(uv_timer_t* handle); +UV_EXTERN int uv_timer_again(uv_timer_t* handle); +UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat); +UV_EXTERN uint64_t uv_timer_get_repeat(const uv_timer_t* handle); + + +/* + * uv_getaddrinfo_t is a subclass of uv_req_t. + * + * Request object for uv_getaddrinfo. + */ +struct uv_getaddrinfo_s { + UV_REQ_FIELDS + /* read-only */ + uv_loop_t* loop; + /* struct addrinfo* addrinfo is marked as private, but it really isn't. */ + UV_GETADDRINFO_PRIVATE_FIELDS +}; + + +UV_EXTERN int uv_getaddrinfo(uv_loop_t* loop, + uv_getaddrinfo_t* req, + uv_getaddrinfo_cb getaddrinfo_cb, + const char* node, + const char* service, + const struct addrinfo* hints); +UV_EXTERN void uv_freeaddrinfo(struct addrinfo* ai); + + +/* +* uv_getnameinfo_t is a subclass of uv_req_t. +* +* Request object for uv_getnameinfo. +*/ +struct uv_getnameinfo_s { + UV_REQ_FIELDS + /* read-only */ + uv_loop_t* loop; + /* host and service are marked as private, but they really aren't. */ + UV_GETNAMEINFO_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_getnameinfo(uv_loop_t* loop, + uv_getnameinfo_t* req, + uv_getnameinfo_cb getnameinfo_cb, + const struct sockaddr* addr, + int flags); + + +/* uv_spawn() options. */ +typedef enum { + UV_IGNORE = 0x00, + UV_CREATE_PIPE = 0x01, + UV_INHERIT_FD = 0x02, + UV_INHERIT_STREAM = 0x04, + + /* + * When UV_CREATE_PIPE is specified, UV_READABLE_PIPE and UV_WRITABLE_PIPE + * determine the direction of flow, from the child process' perspective. Both + * flags may be specified to create a duplex data stream. + */ + UV_READABLE_PIPE = 0x10, + UV_WRITABLE_PIPE = 0x20 +} uv_stdio_flags; + +typedef struct uv_stdio_container_s { + uv_stdio_flags flags; + + union { + uv_stream_t* stream; + int fd; + } data; +} uv_stdio_container_t; + +typedef struct uv_process_options_s { + uv_exit_cb exit_cb; /* Called after the process exits. */ + const char* file; /* Path to program to execute. */ + /* + * Command line arguments. args[0] should be the path to the program. On + * Windows this uses CreateProcess which concatenates the arguments into a + * string this can cause some strange errors. See the note at + * windows_verbatim_arguments. + */ + char** args; + /* + * This will be set as the environ variable in the subprocess. If this is + * NULL then the parents environ will be used. + */ + char** env; + /* + * If non-null this represents a directory the subprocess should execute + * in. Stands for current working directory. + */ + const char* cwd; + /* + * Various flags that control how uv_spawn() behaves. See the definition of + * `enum uv_process_flags` below. + */ + unsigned int flags; + /* + * The `stdio` field points to an array of uv_stdio_container_t structs that + * describe the file descriptors that will be made available to the child + * process. The convention is that stdio[0] points to stdin, fd 1 is used for + * stdout, and fd 2 is stderr. + * + * Note that on windows file descriptors greater than 2 are available to the + * child process only if the child processes uses the MSVCRT runtime. + */ + int stdio_count; + uv_stdio_container_t* stdio; + /* + * Libuv can change the child process' user/group id. This happens only when + * the appropriate bits are set in the flags fields. This is not supported on + * windows; uv_spawn() will fail and set the error to UV_ENOTSUP. + */ + uv_uid_t uid; + uv_gid_t gid; +} uv_process_options_t; + +/* + * These are the flags that can be used for the uv_process_options.flags field. + */ +enum uv_process_flags { + /* + * Set the child process' user id. The user id is supplied in the `uid` field + * of the options struct. This does not work on windows; setting this flag + * will cause uv_spawn() to fail. + */ + UV_PROCESS_SETUID = (1 << 0), + /* + * Set the child process' group id. The user id is supplied in the `gid` + * field of the options struct. This does not work on windows; setting this + * flag will cause uv_spawn() to fail. + */ + UV_PROCESS_SETGID = (1 << 1), + /* + * Do not wrap any arguments in quotes, or perform any other escaping, when + * converting the argument list into a command line string. This option is + * only meaningful on Windows systems. On Unix it is silently ignored. + */ + UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS = (1 << 2), + /* + * Spawn the child process in a detached state - this will make it a process + * group leader, and will effectively enable the child to keep running after + * the parent exits. Note that the child process will still keep the + * parent's event loop alive unless the parent process calls uv_unref() on + * the child's process handle. + */ + UV_PROCESS_DETACHED = (1 << 3), + /* + * Hide the subprocess console window that would normally be created. This + * option is only meaningful on Windows systems. On Unix it is silently + * ignored. + */ + UV_PROCESS_WINDOWS_HIDE = (1 << 4) +}; + +/* + * uv_process_t is a subclass of uv_handle_t. + */ +struct uv_process_s { + UV_HANDLE_FIELDS + uv_exit_cb exit_cb; + int pid; + UV_PROCESS_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_spawn(uv_loop_t* loop, + uv_process_t* handle, + const uv_process_options_t* options); +UV_EXTERN int uv_process_kill(uv_process_t*, int signum); +UV_EXTERN int uv_kill(int pid, int signum); + + +/* + * uv_work_t is a subclass of uv_req_t. + */ +struct uv_work_s { + UV_REQ_FIELDS + uv_loop_t* loop; + uv_work_cb work_cb; + uv_after_work_cb after_work_cb; + UV_WORK_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_queue_work(uv_loop_t* loop, + uv_work_t* req, + uv_work_cb work_cb, + uv_after_work_cb after_work_cb); + +UV_EXTERN int uv_cancel(uv_req_t* req); + + +struct uv_cpu_info_s { + char* model; + int speed; + struct uv_cpu_times_s { + uint64_t user; + uint64_t nice; + uint64_t sys; + uint64_t idle; + uint64_t irq; + } cpu_times; +}; + +struct uv_interface_address_s { + char* name; + char phys_addr[6]; + int is_internal; + union { + struct sockaddr_in address4; + struct sockaddr_in6 address6; + } address; + union { + struct sockaddr_in netmask4; + struct sockaddr_in6 netmask6; + } netmask; +}; + +typedef enum { + UV_DIRENT_UNKNOWN, + UV_DIRENT_FILE, + UV_DIRENT_DIR, + UV_DIRENT_LINK, + UV_DIRENT_FIFO, + UV_DIRENT_SOCKET, + UV_DIRENT_CHAR, + UV_DIRENT_BLOCK +} uv_dirent_type_t; + +struct uv_dirent_s { + const char* name; + uv_dirent_type_t type; +}; + +UV_EXTERN char** uv_setup_args(int argc, char** argv); +UV_EXTERN int uv_get_process_title(char* buffer, size_t size); +UV_EXTERN int uv_set_process_title(const char* title); +UV_EXTERN int uv_resident_set_memory(size_t* rss); +UV_EXTERN int uv_uptime(double* uptime); + +typedef struct { + long tv_sec; + long tv_usec; +} uv_timeval_t; + +typedef struct { + uv_timeval_t ru_utime; /* user CPU time used */ + uv_timeval_t ru_stime; /* system CPU time used */ + uint64_t ru_maxrss; /* maximum resident set size */ + uint64_t ru_ixrss; /* integral shared memory size */ + uint64_t ru_idrss; /* integral unshared data size */ + uint64_t ru_isrss; /* integral unshared stack size */ + uint64_t ru_minflt; /* page reclaims (soft page faults) */ + uint64_t ru_majflt; /* page faults (hard page faults) */ + uint64_t ru_nswap; /* swaps */ + uint64_t ru_inblock; /* block input operations */ + uint64_t ru_oublock; /* block output operations */ + uint64_t ru_msgsnd; /* IPC messages sent */ + uint64_t ru_msgrcv; /* IPC messages received */ + uint64_t ru_nsignals; /* signals received */ + uint64_t ru_nvcsw; /* voluntary context switches */ + uint64_t ru_nivcsw; /* involuntary context switches */ +} uv_rusage_t; + +UV_EXTERN int uv_getrusage(uv_rusage_t* rusage); + +UV_EXTERN int uv_os_homedir(char* buffer, size_t* size); + +UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); +UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count); + +UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses, + int* count); +UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count); + + +typedef enum { + UV_FS_UNKNOWN = -1, + UV_FS_CUSTOM, + UV_FS_OPEN, + UV_FS_CLOSE, + UV_FS_READ, + UV_FS_WRITE, + UV_FS_SENDFILE, + UV_FS_STAT, + UV_FS_LSTAT, + UV_FS_FSTAT, + UV_FS_FTRUNCATE, + UV_FS_UTIME, + UV_FS_FUTIME, + UV_FS_ACCESS, + UV_FS_CHMOD, + UV_FS_FCHMOD, + UV_FS_FSYNC, + UV_FS_FDATASYNC, + UV_FS_UNLINK, + UV_FS_RMDIR, + UV_FS_MKDIR, + UV_FS_MKDTEMP, + UV_FS_RENAME, + UV_FS_SCANDIR, + UV_FS_LINK, + UV_FS_SYMLINK, + UV_FS_READLINK, + UV_FS_CHOWN, + UV_FS_FCHOWN, + UV_FS_REALPATH +} uv_fs_type; + +/* uv_fs_t is a subclass of uv_req_t. */ +struct uv_fs_s { + UV_REQ_FIELDS + uv_fs_type fs_type; + uv_loop_t* loop; + uv_fs_cb cb; + ssize_t result; + void* ptr; + const char* path; + uv_stat_t statbuf; /* Stores the result of uv_fs_stat() and uv_fs_fstat(). */ + UV_FS_PRIVATE_FIELDS +}; + +UV_EXTERN void uv_fs_req_cleanup(uv_fs_t* req); +UV_EXTERN int uv_fs_close(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_open(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_read(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t offset, + uv_fs_cb cb); +UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_write(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t offset, + uv_fs_cb cb); +UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_mkdtemp(uv_loop_t* loop, + uv_fs_t* req, + const char* tpl, + uv_fs_cb cb); +UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_scandir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + uv_fs_cb cb); +UV_EXTERN int uv_fs_scandir_next(uv_fs_t* req, + uv_dirent_t* ent); +UV_EXTERN int uv_fs_stat(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fstat(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_rename(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fsync(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + int64_t offset, + uv_fs_cb cb); +UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop, + uv_fs_t* req, + uv_file out_fd, + uv_file in_fd, + int64_t in_offset, + size_t length, + uv_fs_cb cb); +UV_EXTERN int uv_fs_access(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_chmod(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_utime(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + double atime, + double mtime, + uv_fs_cb cb); +UV_EXTERN int uv_fs_futime(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + double atime, + double mtime, + uv_fs_cb cb); +UV_EXTERN int uv_fs_lstat(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_link(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + uv_fs_cb cb); + +/* + * This flag can be used with uv_fs_symlink() on Windows to specify whether + * path argument points to a directory. + */ +#define UV_FS_SYMLINK_DIR 0x0001 + +/* + * This flag can be used with uv_fs_symlink() on Windows to specify whether + * the symlink is to be created using junction points. + */ +#define UV_FS_SYMLINK_JUNCTION 0x0002 + +UV_EXTERN int uv_fs_symlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + int flags, + uv_fs_cb cb); +UV_EXTERN int uv_fs_readlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_realpath(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_chown(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fchown(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb); + + +enum uv_fs_event { + UV_RENAME = 1, + UV_CHANGE = 2 +}; + + +struct uv_fs_event_s { + UV_HANDLE_FIELDS + /* private */ + char* path; + UV_FS_EVENT_PRIVATE_FIELDS +}; + + +/* + * uv_fs_stat() based polling file watcher. + */ +struct uv_fs_poll_s { + UV_HANDLE_FIELDS + /* Private, don't touch. */ + void* poll_ctx; +}; + +UV_EXTERN int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle); +UV_EXTERN int uv_fs_poll_start(uv_fs_poll_t* handle, + uv_fs_poll_cb poll_cb, + const char* path, + unsigned int interval); +UV_EXTERN int uv_fs_poll_stop(uv_fs_poll_t* handle); +UV_EXTERN int uv_fs_poll_getpath(uv_fs_poll_t* handle, + char* buffer, + size_t* size); + + +struct uv_signal_s { + UV_HANDLE_FIELDS + uv_signal_cb signal_cb; + int signum; + UV_SIGNAL_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle); +UV_EXTERN int uv_signal_start(uv_signal_t* handle, + uv_signal_cb signal_cb, + int signum); +UV_EXTERN int uv_signal_stop(uv_signal_t* handle); + +UV_EXTERN void uv_loadavg(double avg[3]); + + +/* + * Flags to be passed to uv_fs_event_start(). + */ +enum uv_fs_event_flags { + /* + * By default, if the fs event watcher is given a directory name, we will + * watch for all events in that directory. This flags overrides this behavior + * and makes fs_event report only changes to the directory entry itself. This + * flag does not affect individual files watched. + * This flag is currently not implemented yet on any backend. + */ + UV_FS_EVENT_WATCH_ENTRY = 1, + + /* + * By default uv_fs_event will try to use a kernel interface such as inotify + * or kqueue to detect events. This may not work on remote filesystems such + * as NFS mounts. This flag makes fs_event fall back to calling stat() on a + * regular interval. + * This flag is currently not implemented yet on any backend. + */ + UV_FS_EVENT_STAT = 2, + + /* + * By default, event watcher, when watching directory, is not registering + * (is ignoring) changes in it's subdirectories. + * This flag will override this behaviour on platforms that support it. + */ + UV_FS_EVENT_RECURSIVE = 4 +}; + + +UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle); +UV_EXTERN int uv_fs_event_start(uv_fs_event_t* handle, + uv_fs_event_cb cb, + const char* path, + unsigned int flags); +UV_EXTERN int uv_fs_event_stop(uv_fs_event_t* handle); +UV_EXTERN int uv_fs_event_getpath(uv_fs_event_t* handle, + char* buffer, + size_t* size); + +UV_EXTERN int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr); +UV_EXTERN int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr); + +UV_EXTERN int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size); +UV_EXTERN int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size); + +UV_EXTERN int uv_inet_ntop(int af, const void* src, char* dst, size_t size); +UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst); + +UV_EXTERN int uv_exepath(char* buffer, size_t* size); + +UV_EXTERN int uv_cwd(char* buffer, size_t* size); + +UV_EXTERN int uv_chdir(const char* dir); + +UV_EXTERN uint64_t uv_get_free_memory(void); +UV_EXTERN uint64_t uv_get_total_memory(void); + +UV_EXTERN uint64_t uv_hrtime(void); + +UV_EXTERN void uv_disable_stdio_inheritance(void); + +UV_EXTERN int uv_dlopen(const char* filename, uv_lib_t* lib); +UV_EXTERN void uv_dlclose(uv_lib_t* lib); +UV_EXTERN int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr); +UV_EXTERN const char* uv_dlerror(const uv_lib_t* lib); + +UV_EXTERN int uv_mutex_init(uv_mutex_t* handle); +UV_EXTERN void uv_mutex_destroy(uv_mutex_t* handle); +UV_EXTERN void uv_mutex_lock(uv_mutex_t* handle); +UV_EXTERN int uv_mutex_trylock(uv_mutex_t* handle); +UV_EXTERN void uv_mutex_unlock(uv_mutex_t* handle); + +UV_EXTERN int uv_rwlock_init(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_destroy(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_rdlock(uv_rwlock_t* rwlock); +UV_EXTERN int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_rdunlock(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock); +UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock); + +UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value); +UV_EXTERN void uv_sem_destroy(uv_sem_t* sem); +UV_EXTERN void uv_sem_post(uv_sem_t* sem); +UV_EXTERN void uv_sem_wait(uv_sem_t* sem); +UV_EXTERN int uv_sem_trywait(uv_sem_t* sem); + +UV_EXTERN int uv_cond_init(uv_cond_t* cond); +UV_EXTERN void uv_cond_destroy(uv_cond_t* cond); +UV_EXTERN void uv_cond_signal(uv_cond_t* cond); +UV_EXTERN void uv_cond_broadcast(uv_cond_t* cond); + +UV_EXTERN int uv_barrier_init(uv_barrier_t* barrier, unsigned int count); +UV_EXTERN void uv_barrier_destroy(uv_barrier_t* barrier); +UV_EXTERN int uv_barrier_wait(uv_barrier_t* barrier); + +UV_EXTERN void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex); +UV_EXTERN int uv_cond_timedwait(uv_cond_t* cond, + uv_mutex_t* mutex, + uint64_t timeout); + +UV_EXTERN void uv_once(uv_once_t* guard, void (*callback)(void)); + +UV_EXTERN int uv_key_create(uv_key_t* key); +UV_EXTERN void uv_key_delete(uv_key_t* key); +UV_EXTERN void* uv_key_get(uv_key_t* key); +UV_EXTERN void uv_key_set(uv_key_t* key, void* value); + +typedef void (*uv_thread_cb)(void* arg); + +UV_EXTERN int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg); +UV_EXTERN uv_thread_t uv_thread_self(void); +UV_EXTERN int uv_thread_join(uv_thread_t *tid); +UV_EXTERN int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2); + +/* The presence of these unions force similar struct layout. */ +#define XX(_, name) uv_ ## name ## _t name; +union uv_any_handle { + UV_HANDLE_TYPE_MAP(XX) +}; + +union uv_any_req { + UV_REQ_TYPE_MAP(XX) +}; +#undef XX + + +struct uv_loop_s { + /* User data - use this for whatever. */ + void* data; + /* Loop reference counting. */ + unsigned int active_handles; + void* handle_queue[2]; + void* active_reqs[2]; + /* Internal flag to signal loop stop. */ + unsigned int stop_flag; + UV_LOOP_PRIVATE_FIELDS +}; + + +/* Don't export the private CPP symbols. */ +#undef UV_HANDLE_TYPE_PRIVATE +#undef UV_REQ_TYPE_PRIVATE +#undef UV_REQ_PRIVATE_FIELDS +#undef UV_STREAM_PRIVATE_FIELDS +#undef UV_TCP_PRIVATE_FIELDS +#undef UV_PREPARE_PRIVATE_FIELDS +#undef UV_CHECK_PRIVATE_FIELDS +#undef UV_IDLE_PRIVATE_FIELDS +#undef UV_ASYNC_PRIVATE_FIELDS +#undef UV_TIMER_PRIVATE_FIELDS +#undef UV_GETADDRINFO_PRIVATE_FIELDS +#undef UV_GETNAMEINFO_PRIVATE_FIELDS +#undef UV_FS_REQ_PRIVATE_FIELDS +#undef UV_WORK_PRIVATE_FIELDS +#undef UV_FS_EVENT_PRIVATE_FIELDS +#undef UV_SIGNAL_PRIVATE_FIELDS +#undef UV_LOOP_PRIVATE_FIELDS +#undef UV_LOOP_PRIVATE_PLATFORM_FIELDS + +#ifdef __cplusplus +} +#endif +#endif /* UV_H */ diff --git a/3rdparty/libuv/libuv.nsi b/3rdparty/libuv/libuv.nsi new file mode 100644 index 00000000000..159756e196c --- /dev/null +++ b/3rdparty/libuv/libuv.nsi @@ -0,0 +1,86 @@ +; NSIS installer script for libuv + +!include "MUI2.nsh" + +Name "libuv" +OutFile "libuv-${ARCH}-${VERSION}.exe" + +!include "x64.nsh" +# Default install location, for 32-bit files +InstallDir "$PROGRAMFILES\libuv" + +# Override install and registry locations if this is a 64-bit install. +function .onInit + ${If} ${ARCH} == "x64" + SetRegView 64 + StrCpy $INSTDIR "$PROGRAMFILES64\libuv" + ${EndIf} +functionEnd + +;-------------------------------- +; Installer pages +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH + + +;-------------------------------- +; Uninstaller pages +!insertmacro MUI_UNPAGE_WELCOME +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + +;-------------------------------- +; Languages +!insertmacro MUI_LANGUAGE "English" + +;-------------------------------- +; Installer sections + +Section "Files" SecInstall + SectionIn RO + SetOutPath "$INSTDIR" + File "Release\*.dll" + File "Release\*.lib" + File "LICENSE" + File "README.md" + + SetOutPath "$INSTDIR\include" + File "include\uv.h" + File "include\uv-errno.h" + File "include\uv-threadpool.h" + File "include\uv-version.h" + File "include\uv-win.h" + File "include\tree.h" + + WriteUninstaller "$INSTDIR\Uninstall.exe" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libuv-${ARCH}-${VERSION}" "DisplayName" "libuv-${ARCH}-${VERSION}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libuv-${ARCH}-${VERSION}" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libuv-${ARCH}-${VERSION}" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libuv-${ARCH}-${VERSION}" "HelpLink" "http://libuv.org/" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libuv-${ARCH}-${VERSION}" "URLInfoAbout" "http://libuv.org/" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libuv-${ARCH}-${VERSION}" "DisplayVersion" "${VERSION}" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libuv-${ARCH}-${VERSION}" "NoModify" "1" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libuv-${ARCH}-${VERSION}" "NoRepair" "1" +SectionEnd + +Section "Uninstall" + Delete "$INSTDIR\libuv.dll" + Delete "$INSTDIR\libuv.lib" + Delete "$INSTDIR\LICENSE" + Delete "$INSTDIR\README.md" + + Delete "$INSTDIR\include\uv.h" + Delete "$INSTDIR\include\uv-errno.h" + Delete "$INSTDIR\include\uv-threadpool.h" + Delete "$INSTDIR\include\uv-version.h" + Delete "$INSTDIR\include\uv-win.h" + Delete "$INSTDIR\include\tree.h" + + Delete "$INSTDIR\Uninstall.exe" + RMDir "$INSTDIR" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libuv-${ARCH}-${VERSION}" +SectionEnd + diff --git a/3rdparty/libuv/libuv.pc.in b/3rdparty/libuv/libuv.pc.in new file mode 100644 index 00000000000..2933ec22526 --- /dev/null +++ b/3rdparty/libuv/libuv.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: @PACKAGE_NAME@ +Version: @PACKAGE_VERSION@ +Description: multi-platform support library with a focus on asynchronous I/O. + +Libs: -L${libdir} -luv @LIBS@ +Cflags: -I${includedir} diff --git a/3rdparty/libuv/m4/.gitignore b/3rdparty/libuv/m4/.gitignore new file mode 100644 index 00000000000..c44e4c2929a --- /dev/null +++ b/3rdparty/libuv/m4/.gitignore @@ -0,0 +1,4 @@ +# Ignore libtoolize-generated files. +*.m4 +!as_case.m4 +!libuv-check-flags.m4 diff --git a/3rdparty/libuv/m4/as_case.m4 b/3rdparty/libuv/m4/as_case.m4 new file mode 100644 index 00000000000..c7ae0f0f5ed --- /dev/null +++ b/3rdparty/libuv/m4/as_case.m4 @@ -0,0 +1,21 @@ +# AS_CASE(WORD, [PATTERN1], [IF-MATCHED1]...[DEFAULT]) +# ---------------------------------------------------- +# Expand into +# | case WORD in +# | PATTERN1) IF-MATCHED1 ;; +# | ... +# | *) DEFAULT ;; +# | esac +m4_define([_AS_CASE], +[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [ *) $1 ;;], + [$#], 2, [ $1) m4_default([$2], [:]) ;;], + [ $1) m4_default([$2], [:]) ;; +$0(m4_shiftn(2, $@))])dnl +]) +m4_defun([AS_CASE], +[m4_ifval([$2$3], +[case $1 in +_AS_CASE(m4_shift($@)) +esac])]) + diff --git a/3rdparty/libuv/m4/libuv-check-flags.m4 b/3rdparty/libuv/m4/libuv-check-flags.m4 new file mode 100644 index 00000000000..59c30635577 --- /dev/null +++ b/3rdparty/libuv/m4/libuv-check-flags.m4 @@ -0,0 +1,319 @@ +dnl Macros to check the presence of generic (non-typed) symbols. +dnl Copyright (c) 2006-2008 Diego Pettenà +dnl Copyright (c) 2006-2008 xine project +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 3, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +dnl 02110-1301, USA. +dnl +dnl As a special exception, the copyright owners of the +dnl macro gives unlimited permission to copy, distribute and modify the +dnl configure scripts that are the output of Autoconf when processing the +dnl Macro. You need not follow the terms of the GNU General Public +dnl License when using or distributing such scripts, even though portions +dnl of the text of the Macro appear in them. The GNU General Public +dnl License (GPL) does govern all other use of the material that +dnl constitutes the Autoconf Macro. +dnl +dnl This special exception to the GPL applies to versions of the +dnl Autoconf Macro released by this project. When you make and +dnl distribute a modified version of the Autoconf Macro, you may extend +dnl this special exception to the GPL to apply to your modified version as +dnl well. + +dnl Check if the flag is supported by compiler +dnl CC_CHECK_CFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) + +AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [ + AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]), + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a;])], + [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"], + [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"]) + CFLAGS="$ac_save_CFLAGS" + ]) + + AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], + [$2], [$3]) +]) + +dnl Check if the flag is supported by compiler (cacheable) +dnl CC_CHECK_CFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) + +AC_DEFUN([CC_CHECK_CFLAGS], [ + AC_CACHE_CHECK([if $CC supports $1 flag], + AS_TR_SH([cc_cv_cflags_$1]), + CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here! + ) + + AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], + [$2], [$3]) +]) + +dnl CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found]) +dnl Check for CFLAG and appends them to CFLAGS if supported +AC_DEFUN([CC_CHECK_CFLAG_APPEND], [ + AC_CACHE_CHECK([if $CC supports $1 flag], + AS_TR_SH([cc_cv_cflags_$1]), + CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here! + ) + + AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], + [CFLAGS="$CFLAGS $1"; DEBUG_CFLAGS="$DEBUG_CFLAGS $1"; $2], [$3]) +]) + +dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not]) +AC_DEFUN([CC_CHECK_CFLAGS_APPEND], [ + for flag in $1; do + CC_CHECK_CFLAG_APPEND($flag, [$2], [$3]) + done +]) + +dnl Check if the flag is supported by linker (cacheable) +dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) + +AC_DEFUN([CC_CHECK_LDFLAGS], [ + AC_CACHE_CHECK([if $CC supports $1 flag], + AS_TR_SH([cc_cv_ldflags_$1]), + [ac_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $1" + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])], + [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"], + [eval "AS_TR_SH([cc_cv_ldflags_$1])="]) + AC_LANG_POP([C]) + LDFLAGS="$ac_save_LDFLAGS" + ]) + + AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes], + [$2], [$3]) +]) + +dnl define the LDFLAGS_NOUNDEFINED variable with the correct value for +dnl the current linker to avoid undefined references in a shared object. +AC_DEFUN([CC_NOUNDEFINED], [ + dnl We check $host for which systems to enable this for. + AC_REQUIRE([AC_CANONICAL_HOST]) + + case $host in + dnl FreeBSD (et al.) does not complete linking for shared objects when pthreads + dnl are requested, as different implementations are present; to avoid problems + dnl use -Wl,-z,defs only for those platform not behaving this way. + *-freebsd* | *-openbsd*) ;; + *) + dnl First of all check for the --no-undefined variant of GNU ld. This allows + dnl for a much more readable commandline, so that people can understand what + dnl it does without going to look for what the heck -z defs does. + for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do + CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"]) + break + done + ;; + esac + + AC_SUBST([LDFLAGS_NOUNDEFINED]) +]) + +dnl Check for a -Werror flag or equivalent. -Werror is the GCC +dnl and ICC flag that tells the compiler to treat all the warnings +dnl as fatal. We usually need this option to make sure that some +dnl constructs (like attributes) are not simply ignored. +dnl +dnl Other compilers don't support -Werror per se, but they support +dnl an equivalent flag: +dnl - Sun Studio compiler supports -errwarn=%all +AC_DEFUN([CC_CHECK_WERROR], [ + AC_CACHE_CHECK( + [for $CC way to treat warnings as errors], + [cc_cv_werror], + [CC_CHECK_CFLAGS_SILENT([-Werror], [cc_cv_werror=-Werror], + [CC_CHECK_CFLAGS_SILENT([-errwarn=%all], [cc_cv_werror=-errwarn=%all])]) + ]) +]) + +AC_DEFUN([CC_CHECK_ATTRIBUTE], [ + AC_REQUIRE([CC_CHECK_WERROR]) + AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))], + AS_TR_SH([cc_cv_attribute_$1]), + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])], + [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"], + [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"]) + AC_LANG_POP([C]) + CFLAGS="$ac_save_CFLAGS" + ]) + + AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes], + [AC_DEFINE( + AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1, + [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))] + ) + $4], + [$5]) +]) + +AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [ + CC_CHECK_ATTRIBUTE( + [constructor],, + [void __attribute__((constructor)) ctor() { int a; }], + [$1], [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_FORMAT], [ + CC_CHECK_ATTRIBUTE( + [format], [format(printf, n, n)], + [void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }], + [$1], [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [ + CC_CHECK_ATTRIBUTE( + [format_arg], [format_arg(printf)], + [char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }], + [$1], [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [ + CC_CHECK_ATTRIBUTE( + [visibility_$1], [visibility("$1")], + [void __attribute__((visibility("$1"))) $1_function() { }], + [$2], [$3]) +]) + +AC_DEFUN([CC_ATTRIBUTE_NONNULL], [ + CC_CHECK_ATTRIBUTE( + [nonnull], [nonnull()], + [void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }], + [$1], [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_UNUSED], [ + CC_CHECK_ATTRIBUTE( + [unused], , + [void some_function(void *foo, __attribute__((unused)) void *bar);], + [$1], [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [ + CC_CHECK_ATTRIBUTE( + [sentinel], , + [void some_function(void *foo, ...) __attribute__((sentinel));], + [$1], [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [ + CC_CHECK_ATTRIBUTE( + [deprecated], , + [void some_function(void *foo, ...) __attribute__((deprecated));], + [$1], [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_ALIAS], [ + CC_CHECK_ATTRIBUTE( + [alias], [weak, alias], + [void other_function(void *foo) { } + void some_function(void *foo) __attribute__((weak, alias("other_function")));], + [$1], [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_MALLOC], [ + CC_CHECK_ATTRIBUTE( + [malloc], , + [void * __attribute__((malloc)) my_alloc(int n);], + [$1], [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_PACKED], [ + CC_CHECK_ATTRIBUTE( + [packed], , + [struct astructure { char a; int b; long c; void *d; } __attribute__((packed));], + [$1], [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_CONST], [ + CC_CHECK_ATTRIBUTE( + [const], , + [int __attribute__((const)) twopow(int n) { return 1 << n; } ], + [$1], [$2]) +]) + +AC_DEFUN([CC_FLAG_VISIBILITY], [ + AC_REQUIRE([CC_CHECK_WERROR]) + AC_CACHE_CHECK([if $CC supports -fvisibility=hidden], + [cc_cv_flag_visibility], + [cc_flag_visibility_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden], + cc_cv_flag_visibility='yes', + cc_cv_flag_visibility='no') + CFLAGS="$cc_flag_visibility_save_CFLAGS"]) + + AS_IF([test "x$cc_cv_flag_visibility" = "xyes"], + [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, + [Define this if the compiler supports the -fvisibility flag]) + $1], + [$2]) +]) + +AC_DEFUN([CC_FUNC_EXPECT], [ + AC_REQUIRE([CC_CHECK_WERROR]) + AC_CACHE_CHECK([if compiler has __builtin_expect function], + [cc_cv_func_expect], + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [int some_function() { + int a = 3; + return (int)__builtin_expect(a, 3); + }])], + [cc_cv_func_expect=yes], + [cc_cv_func_expect=no]) + AC_LANG_POP([C]) + CFLAGS="$ac_save_CFLAGS" + ]) + + AS_IF([test "x$cc_cv_func_expect" = "xyes"], + [AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1, + [Define this if the compiler supports __builtin_expect() function]) + $1], + [$2]) +]) + +AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ + AC_REQUIRE([CC_CHECK_WERROR]) + AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported], + [cc_cv_attribute_aligned], + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + AC_LANG_PUSH([C]) + for cc_attribute_align_try in 64 32 16 8 4 2; do + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + int main() { + static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0; + return c; + }])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break]) + done + AC_LANG_POP([C]) + CFLAGS="$ac_save_CFLAGS" + ]) + + if test "x$cc_cv_attribute_aligned" != "x"; then + AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [$cc_cv_attribute_aligned], + [Define the highest alignment supported]) + fi +]) \ No newline at end of file diff --git a/3rdparty/libuv/samples/.gitignore b/3rdparty/libuv/samples/.gitignore new file mode 100644 index 00000000000..f868091ba32 --- /dev/null +++ b/3rdparty/libuv/samples/.gitignore @@ -0,0 +1,22 @@ +# Copyright StrongLoop, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +*.mk +*.Makefile diff --git a/3rdparty/libuv/samples/socks5-proxy/.gitignore b/3rdparty/libuv/samples/socks5-proxy/.gitignore new file mode 100644 index 00000000000..c177f374510 --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/.gitignore @@ -0,0 +1,21 @@ +# Copyright StrongLoop, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +/build/ diff --git a/3rdparty/libuv/samples/socks5-proxy/LICENSE b/3rdparty/libuv/samples/socks5-proxy/LICENSE new file mode 100644 index 00000000000..63c1447fc55 --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/LICENSE @@ -0,0 +1,53 @@ +Files: * +======== + +Copyright StrongLoop, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + + +Files: getopt.c +=============== + +Copyright (c) 1987, 1993, 1994 +The Regents of the University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. diff --git a/3rdparty/libuv/samples/socks5-proxy/Makefile b/3rdparty/libuv/samples/socks5-proxy/Makefile new file mode 100644 index 00000000000..ca43985ec80 --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/Makefile @@ -0,0 +1,46 @@ +# Copyright StrongLoop, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +BUILDTYPE ?= Debug +BUILDDIR ?= build +GYP ?= gyp +V ?= + +SOURCES := client.c defs.h getopt.c main.c s5.c s5.h server.c util.c + +.PHONY: all clean + +all: $(BUILDDIR)/$(BUILDTYPE)/s5-proxy + +clean: + $(RM) $(BUILDDIR) + +$(BUILDDIR)/$(BUILDTYPE)/s5-proxy: $(BUILDDIR)/Makefile $(SOURCES) + $(MAKE) -C $(BUILDDIR) V=$(V) + +$(BUILDDIR)/Makefile: ../../common.gypi build.gyp + $(GYP) \ + -Duv_library=static_library \ + -Goutput_dir=. \ + -I../../common.gypi \ + -f make \ + --depth=. \ + --generator-output=$(BUILDDIR) \ + build.gyp diff --git a/3rdparty/libuv/samples/socks5-proxy/build.gyp b/3rdparty/libuv/samples/socks5-proxy/build.gyp new file mode 100644 index 00000000000..771a1e146db --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/build.gyp @@ -0,0 +1,46 @@ +# Copyright StrongLoop, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +{ + 'targets': [ + { + 'dependencies': ['../../uv.gyp:libuv'], + 'target_name': 's5-proxy', + 'type': 'executable', + 'sources': [ + 'client.c', + 'defs.h', + 'main.c', + 's5.c', + 's5.h', + 'server.c', + 'util.c', + ], + 'conditions': [ + ['OS=="win"', { + 'defines': ['HAVE_UNISTD_H=0'], + 'sources': ['getopt.c'] + }, { + 'defines': ['HAVE_UNISTD_H=1'] + }] + ] + } + ] +} diff --git a/3rdparty/libuv/samples/socks5-proxy/client.c b/3rdparty/libuv/samples/socks5-proxy/client.c new file mode 100644 index 00000000000..ae9913a1c6e --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/client.c @@ -0,0 +1,737 @@ +/* Copyright StrongLoop, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "defs.h" +#include +#include +#include + +/* A connection is modeled as an abstraction on top of two simple state + * machines, one for reading and one for writing. Either state machine + * is, when active, in one of three states: busy, done or stop; the fourth + * and final state, dead, is an end state and only relevant when shutting + * down the connection. A short overview: + * + * busy done stop + * ----------|---------------------------|--------------------|------| + * readable | waiting for incoming data | have incoming data | idle | + * writable | busy writing out data | completed write | idle | + * + * We could remove the done state from the writable state machine. For our + * purposes, it's functionally equivalent to the stop state. + * + * When the connection with upstream has been established, the client_ctx + * moves into a state where incoming data from the client is sent upstream + * and vice versa, incoming data from upstream is sent to the client. In + * other words, we're just piping data back and forth. See conn_cycle() + * for details. + * + * An interesting deviation from libuv's I/O model is that reads are discrete + * rather than continuous events. In layman's terms, when a read operation + * completes, the connection stops reading until further notice. + * + * The rationale for this approach is that we have to wait until the data + * has been sent out again before we can reuse the read buffer. + * + * It also pleasingly unifies with the request model that libuv uses for + * writes and everything else; libuv may switch to a request model for + * reads in the future. + */ +enum conn_state { + c_busy, /* Busy; waiting for incoming data or for a write to complete. */ + c_done, /* Done; read incoming data or write finished. */ + c_stop, /* Stopped. */ + c_dead +}; + +/* Session states. */ +enum sess_state { + s_handshake, /* Wait for client handshake. */ + s_handshake_auth, /* Wait for client authentication data. */ + s_req_start, /* Start waiting for request data. */ + s_req_parse, /* Wait for request data. */ + s_req_lookup, /* Wait for upstream hostname DNS lookup to complete. */ + s_req_connect, /* Wait for uv_tcp_connect() to complete. */ + s_proxy_start, /* Connected. Start piping data. */ + s_proxy, /* Connected. Pipe data back and forth. */ + s_kill, /* Tear down session. */ + s_almost_dead_0, /* Waiting for finalizers to complete. */ + s_almost_dead_1, /* Waiting for finalizers to complete. */ + s_almost_dead_2, /* Waiting for finalizers to complete. */ + s_almost_dead_3, /* Waiting for finalizers to complete. */ + s_almost_dead_4, /* Waiting for finalizers to complete. */ + s_dead /* Dead. Safe to free now. */ +}; + +static void do_next(client_ctx *cx); +static int do_handshake(client_ctx *cx); +static int do_handshake_auth(client_ctx *cx); +static int do_req_start(client_ctx *cx); +static int do_req_parse(client_ctx *cx); +static int do_req_lookup(client_ctx *cx); +static int do_req_connect_start(client_ctx *cx); +static int do_req_connect(client_ctx *cx); +static int do_proxy_start(client_ctx *cx); +static int do_proxy(client_ctx *cx); +static int do_kill(client_ctx *cx); +static int do_almost_dead(client_ctx *cx); +static int conn_cycle(const char *who, conn *a, conn *b); +static void conn_timer_reset(conn *c); +static void conn_timer_expire(uv_timer_t *handle, int status); +static void conn_getaddrinfo(conn *c, const char *hostname); +static void conn_getaddrinfo_done(uv_getaddrinfo_t *req, + int status, + struct addrinfo *ai); +static int conn_connect(conn *c); +static void conn_connect_done(uv_connect_t *req, int status); +static void conn_read(conn *c); +static void conn_read_done(uv_stream_t *handle, + ssize_t nread, + const uv_buf_t *buf); +static void conn_alloc(uv_handle_t *handle, size_t size, uv_buf_t *buf); +static void conn_write(conn *c, const void *data, unsigned int len); +static void conn_write_done(uv_write_t *req, int status); +static void conn_close(conn *c); +static void conn_close_done(uv_handle_t *handle); + +/* |incoming| has been initialized by server.c when this is called. */ +void client_finish_init(server_ctx *sx, client_ctx *cx) { + conn *incoming; + conn *outgoing; + + cx->sx = sx; + cx->state = s_handshake; + s5_init(&cx->parser); + + incoming = &cx->incoming; + incoming->client = cx; + incoming->result = 0; + incoming->rdstate = c_stop; + incoming->wrstate = c_stop; + incoming->idle_timeout = sx->idle_timeout; + CHECK(0 == uv_timer_init(sx->loop, &incoming->timer_handle)); + + outgoing = &cx->outgoing; + outgoing->client = cx; + outgoing->result = 0; + outgoing->rdstate = c_stop; + outgoing->wrstate = c_stop; + outgoing->idle_timeout = sx->idle_timeout; + CHECK(0 == uv_tcp_init(cx->sx->loop, &outgoing->handle.tcp)); + CHECK(0 == uv_timer_init(cx->sx->loop, &outgoing->timer_handle)); + + /* Wait for the initial packet. */ + conn_read(incoming); +} + +/* This is the core state machine that drives the client <-> upstream proxy. + * We move through the initial handshake and authentication steps first and + * end up (if all goes well) in the proxy state where we're just proxying + * data between the client and upstream. + */ +static void do_next(client_ctx *cx) { + int new_state; + + ASSERT(cx->state != s_dead); + switch (cx->state) { + case s_handshake: + new_state = do_handshake(cx); + break; + case s_handshake_auth: + new_state = do_handshake_auth(cx); + break; + case s_req_start: + new_state = do_req_start(cx); + break; + case s_req_parse: + new_state = do_req_parse(cx); + break; + case s_req_lookup: + new_state = do_req_lookup(cx); + break; + case s_req_connect: + new_state = do_req_connect(cx); + break; + case s_proxy_start: + new_state = do_proxy_start(cx); + break; + case s_proxy: + new_state = do_proxy(cx); + break; + case s_kill: + new_state = do_kill(cx); + break; + case s_almost_dead_0: + case s_almost_dead_1: + case s_almost_dead_2: + case s_almost_dead_3: + case s_almost_dead_4: + new_state = do_almost_dead(cx); + break; + default: + UNREACHABLE(); + } + cx->state = new_state; + + if (cx->state == s_dead) { + if (DEBUG_CHECKS) { + memset(cx, -1, sizeof(*cx)); + } + free(cx); + } +} + +static int do_handshake(client_ctx *cx) { + unsigned int methods; + conn *incoming; + s5_ctx *parser; + uint8_t *data; + size_t size; + int err; + + parser = &cx->parser; + incoming = &cx->incoming; + ASSERT(incoming->rdstate == c_done); + ASSERT(incoming->wrstate == c_stop); + incoming->rdstate = c_stop; + + if (incoming->result < 0) { + pr_err("read error: %s", uv_strerror(incoming->result)); + return do_kill(cx); + } + + data = (uint8_t *) incoming->t.buf; + size = (size_t) incoming->result; + err = s5_parse(parser, &data, &size); + if (err == s5_ok) { + conn_read(incoming); + return s_handshake; /* Need more data. */ + } + + if (size != 0) { + /* Could allow a round-trip saving shortcut here if the requested auth + * method is S5_AUTH_NONE (provided unauthenticated traffic is allowed.) + * Requires client support however. + */ + pr_err("junk in handshake"); + return do_kill(cx); + } + + if (err != s5_auth_select) { + pr_err("handshake error: %s", s5_strerror(err)); + return do_kill(cx); + } + + methods = s5_auth_methods(parser); + if ((methods & S5_AUTH_NONE) && can_auth_none(cx->sx, cx)) { + s5_select_auth(parser, S5_AUTH_NONE); + conn_write(incoming, "\5\0", 2); /* No auth required. */ + return s_req_start; + } + + if ((methods & S5_AUTH_PASSWD) && can_auth_passwd(cx->sx, cx)) { + /* TODO(bnoordhuis) Implement username/password auth. */ + } + + conn_write(incoming, "\5\377", 2); /* No acceptable auth. */ + return s_kill; +} + +/* TODO(bnoordhuis) Implement username/password auth. */ +static int do_handshake_auth(client_ctx *cx) { + UNREACHABLE(); + return do_kill(cx); +} + +static int do_req_start(client_ctx *cx) { + conn *incoming; + + incoming = &cx->incoming; + ASSERT(incoming->rdstate == c_stop); + ASSERT(incoming->wrstate == c_done); + incoming->wrstate = c_stop; + + if (incoming->result < 0) { + pr_err("write error: %s", uv_strerror(incoming->result)); + return do_kill(cx); + } + + conn_read(incoming); + return s_req_parse; +} + +static int do_req_parse(client_ctx *cx) { + conn *incoming; + conn *outgoing; + s5_ctx *parser; + uint8_t *data; + size_t size; + int err; + + parser = &cx->parser; + incoming = &cx->incoming; + outgoing = &cx->outgoing; + ASSERT(incoming->rdstate == c_done); + ASSERT(incoming->wrstate == c_stop); + ASSERT(outgoing->rdstate == c_stop); + ASSERT(outgoing->wrstate == c_stop); + incoming->rdstate = c_stop; + + if (incoming->result < 0) { + pr_err("read error: %s", uv_strerror(incoming->result)); + return do_kill(cx); + } + + data = (uint8_t *) incoming->t.buf; + size = (size_t) incoming->result; + err = s5_parse(parser, &data, &size); + if (err == s5_ok) { + conn_read(incoming); + return s_req_parse; /* Need more data. */ + } + + if (size != 0) { + pr_err("junk in request %u", (unsigned) size); + return do_kill(cx); + } + + if (err != s5_exec_cmd) { + pr_err("request error: %s", s5_strerror(err)); + return do_kill(cx); + } + + if (parser->cmd == s5_cmd_tcp_bind) { + /* Not supported but relatively straightforward to implement. */ + pr_warn("BIND requests are not supported."); + return do_kill(cx); + } + + if (parser->cmd == s5_cmd_udp_assoc) { + /* Not supported. Might be hard to implement because libuv has no + * functionality for detecting the MTU size which the RFC mandates. + */ + pr_warn("UDP ASSOC requests are not supported."); + return do_kill(cx); + } + ASSERT(parser->cmd == s5_cmd_tcp_connect); + + if (parser->atyp == s5_atyp_host) { + conn_getaddrinfo(outgoing, (const char *) parser->daddr); + return s_req_lookup; + } + + if (parser->atyp == s5_atyp_ipv4) { + memset(&outgoing->t.addr4, 0, sizeof(outgoing->t.addr4)); + outgoing->t.addr4.sin_family = AF_INET; + outgoing->t.addr4.sin_port = htons(parser->dport); + memcpy(&outgoing->t.addr4.sin_addr, + parser->daddr, + sizeof(outgoing->t.addr4.sin_addr)); + } else if (parser->atyp == s5_atyp_ipv6) { + memset(&outgoing->t.addr6, 0, sizeof(outgoing->t.addr6)); + outgoing->t.addr6.sin6_family = AF_INET6; + outgoing->t.addr6.sin6_port = htons(parser->dport); + memcpy(&outgoing->t.addr6.sin6_addr, + parser->daddr, + sizeof(outgoing->t.addr6.sin6_addr)); + } else { + UNREACHABLE(); + } + + return do_req_connect_start(cx); +} + +static int do_req_lookup(client_ctx *cx) { + s5_ctx *parser; + conn *incoming; + conn *outgoing; + + parser = &cx->parser; + incoming = &cx->incoming; + outgoing = &cx->outgoing; + ASSERT(incoming->rdstate == c_stop); + ASSERT(incoming->wrstate == c_stop); + ASSERT(outgoing->rdstate == c_stop); + ASSERT(outgoing->wrstate == c_stop); + + if (outgoing->result < 0) { + /* TODO(bnoordhuis) Escape control characters in parser->daddr. */ + pr_err("lookup error for \"%s\": %s", + parser->daddr, + uv_strerror(outgoing->result)); + /* Send back a 'Host unreachable' reply. */ + conn_write(incoming, "\5\4\0\1\0\0\0\0\0\0", 10); + return s_kill; + } + + /* Don't make assumptions about the offset of sin_port/sin6_port. */ + switch (outgoing->t.addr.sa_family) { + case AF_INET: + outgoing->t.addr4.sin_port = htons(parser->dport); + break; + case AF_INET6: + outgoing->t.addr6.sin6_port = htons(parser->dport); + break; + default: + UNREACHABLE(); + } + + return do_req_connect_start(cx); +} + +/* Assumes that cx->outgoing.t.sa contains a valid AF_INET/AF_INET6 address. */ +static int do_req_connect_start(client_ctx *cx) { + conn *incoming; + conn *outgoing; + int err; + + incoming = &cx->incoming; + outgoing = &cx->outgoing; + ASSERT(incoming->rdstate == c_stop); + ASSERT(incoming->wrstate == c_stop); + ASSERT(outgoing->rdstate == c_stop); + ASSERT(outgoing->wrstate == c_stop); + + if (!can_access(cx->sx, cx, &outgoing->t.addr)) { + pr_warn("connection not allowed by ruleset"); + /* Send a 'Connection not allowed by ruleset' reply. */ + conn_write(incoming, "\5\2\0\1\0\0\0\0\0\0", 10); + return s_kill; + } + + err = conn_connect(outgoing); + if (err != 0) { + pr_err("connect error: %s\n", uv_strerror(err)); + return do_kill(cx); + } + + return s_req_connect; +} + +static int do_req_connect(client_ctx *cx) { + const struct sockaddr_in6 *in6; + const struct sockaddr_in *in; + char addr_storage[sizeof(*in6)]; + conn *incoming; + conn *outgoing; + uint8_t *buf; + int addrlen; + + incoming = &cx->incoming; + outgoing = &cx->outgoing; + ASSERT(incoming->rdstate == c_stop); + ASSERT(incoming->wrstate == c_stop); + ASSERT(outgoing->rdstate == c_stop); + ASSERT(outgoing->wrstate == c_stop); + + /* Build and send the reply. Not very pretty but gets the job done. */ + buf = (uint8_t *) incoming->t.buf; + if (outgoing->result == 0) { + /* The RFC mandates that the SOCKS server must include the local port + * and address in the reply. So that's what we do. + */ + addrlen = sizeof(addr_storage); + CHECK(0 == uv_tcp_getsockname(&outgoing->handle.tcp, + (struct sockaddr *) addr_storage, + &addrlen)); + buf[0] = 5; /* Version. */ + buf[1] = 0; /* Success. */ + buf[2] = 0; /* Reserved. */ + if (addrlen == sizeof(*in)) { + buf[3] = 1; /* IPv4. */ + in = (const struct sockaddr_in *) &addr_storage; + memcpy(buf + 4, &in->sin_addr, 4); + memcpy(buf + 8, &in->sin_port, 2); + conn_write(incoming, buf, 10); + } else if (addrlen == sizeof(*in6)) { + buf[3] = 4; /* IPv6. */ + in6 = (const struct sockaddr_in6 *) &addr_storage; + memcpy(buf + 4, &in6->sin6_addr, 16); + memcpy(buf + 20, &in6->sin6_port, 2); + conn_write(incoming, buf, 22); + } else { + UNREACHABLE(); + } + return s_proxy_start; + } else { + pr_err("upstream connection error: %s\n", uv_strerror(outgoing->result)); + /* Send a 'Connection refused' reply. */ + conn_write(incoming, "\5\5\0\1\0\0\0\0\0\0", 10); + return s_kill; + } + + UNREACHABLE(); + return s_kill; +} + +static int do_proxy_start(client_ctx *cx) { + conn *incoming; + conn *outgoing; + + incoming = &cx->incoming; + outgoing = &cx->outgoing; + ASSERT(incoming->rdstate == c_stop); + ASSERT(incoming->wrstate == c_done); + ASSERT(outgoing->rdstate == c_stop); + ASSERT(outgoing->wrstate == c_stop); + incoming->wrstate = c_stop; + + if (incoming->result < 0) { + pr_err("write error: %s", uv_strerror(incoming->result)); + return do_kill(cx); + } + + conn_read(incoming); + conn_read(outgoing); + return s_proxy; +} + +/* Proxy incoming data back and forth. */ +static int do_proxy(client_ctx *cx) { + if (conn_cycle("client", &cx->incoming, &cx->outgoing)) { + return do_kill(cx); + } + + if (conn_cycle("upstream", &cx->outgoing, &cx->incoming)) { + return do_kill(cx); + } + + return s_proxy; +} + +static int do_kill(client_ctx *cx) { + int new_state; + + if (cx->state >= s_almost_dead_0) { + return cx->state; + } + + /* Try to cancel the request. The callback still runs but if the + * cancellation succeeded, it gets called with status=UV_ECANCELED. + */ + new_state = s_almost_dead_1; + if (cx->state == s_req_lookup) { + new_state = s_almost_dead_0; + uv_cancel(&cx->outgoing.t.req); + } + + conn_close(&cx->incoming); + conn_close(&cx->outgoing); + return new_state; +} + +static int do_almost_dead(client_ctx *cx) { + ASSERT(cx->state >= s_almost_dead_0); + return cx->state + 1; /* Another finalizer completed. */ +} + +static int conn_cycle(const char *who, conn *a, conn *b) { + if (a->result < 0) { + if (a->result != UV_EOF) { + pr_err("%s error: %s", who, uv_strerror(a->result)); + } + return -1; + } + + if (b->result < 0) { + return -1; + } + + if (a->wrstate == c_done) { + a->wrstate = c_stop; + } + + /* The logic is as follows: read when we don't write and write when we don't + * read. That gives us back-pressure handling for free because if the peer + * sends data faster than we consume it, TCP congestion control kicks in. + */ + if (a->wrstate == c_stop) { + if (b->rdstate == c_stop) { + conn_read(b); + } else if (b->rdstate == c_done) { + conn_write(a, b->t.buf, b->result); + b->rdstate = c_stop; /* Triggers the call to conn_read() above. */ + } + } + + return 0; +} + +static void conn_timer_reset(conn *c) { + CHECK(0 == uv_timer_start(&c->timer_handle, + conn_timer_expire, + c->idle_timeout, + 0)); +} + +static void conn_timer_expire(uv_timer_t *handle, int status) { + conn *c; + + CHECK(0 == status); + c = CONTAINER_OF(handle, conn, timer_handle); + c->result = UV_ETIMEDOUT; + do_next(c->client); +} + +static void conn_getaddrinfo(conn *c, const char *hostname) { + struct addrinfo hints; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + CHECK(0 == uv_getaddrinfo(c->client->sx->loop, + &c->t.addrinfo_req, + conn_getaddrinfo_done, + hostname, + NULL, + &hints)); + conn_timer_reset(c); +} + +static void conn_getaddrinfo_done(uv_getaddrinfo_t *req, + int status, + struct addrinfo *ai) { + conn *c; + + c = CONTAINER_OF(req, conn, t.addrinfo_req); + c->result = status; + + if (status == 0) { + /* FIXME(bnoordhuis) Should try all addresses. */ + if (ai->ai_family == AF_INET) { + c->t.addr4 = *(const struct sockaddr_in *) ai->ai_addr; + } else if (ai->ai_family == AF_INET6) { + c->t.addr6 = *(const struct sockaddr_in6 *) ai->ai_addr; + } else { + UNREACHABLE(); + } + } + + uv_freeaddrinfo(ai); + do_next(c->client); +} + +/* Assumes that c->t.sa contains a valid AF_INET or AF_INET6 address. */ +static int conn_connect(conn *c) { + ASSERT(c->t.addr.sa_family == AF_INET || + c->t.addr.sa_family == AF_INET6); + conn_timer_reset(c); + return uv_tcp_connect(&c->t.connect_req, + &c->handle.tcp, + &c->t.addr, + conn_connect_done); +} + +static void conn_connect_done(uv_connect_t *req, int status) { + conn *c; + + if (status == UV_ECANCELED) { + return; /* Handle has been closed. */ + } + + c = CONTAINER_OF(req, conn, t.connect_req); + c->result = status; + do_next(c->client); +} + +static void conn_read(conn *c) { + ASSERT(c->rdstate == c_stop); + CHECK(0 == uv_read_start(&c->handle.stream, conn_alloc, conn_read_done)); + c->rdstate = c_busy; + conn_timer_reset(c); +} + +static void conn_read_done(uv_stream_t *handle, + ssize_t nread, + const uv_buf_t *buf) { + conn *c; + + c = CONTAINER_OF(handle, conn, handle); + ASSERT(c->t.buf == buf->base); + ASSERT(c->rdstate == c_busy); + c->rdstate = c_done; + c->result = nread; + + uv_read_stop(&c->handle.stream); + do_next(c->client); +} + +static void conn_alloc(uv_handle_t *handle, size_t size, uv_buf_t *buf) { + conn *c; + + c = CONTAINER_OF(handle, conn, handle); + ASSERT(c->rdstate == c_busy); + buf->base = c->t.buf; + buf->len = sizeof(c->t.buf); +} + +static void conn_write(conn *c, const void *data, unsigned int len) { + uv_buf_t buf; + + ASSERT(c->wrstate == c_stop || c->wrstate == c_done); + c->wrstate = c_busy; + + /* It's okay to cast away constness here, uv_write() won't modify the + * memory. + */ + buf.base = (char *) data; + buf.len = len; + + CHECK(0 == uv_write(&c->write_req, + &c->handle.stream, + &buf, + 1, + conn_write_done)); + conn_timer_reset(c); +} + +static void conn_write_done(uv_write_t *req, int status) { + conn *c; + + if (status == UV_ECANCELED) { + return; /* Handle has been closed. */ + } + + c = CONTAINER_OF(req, conn, write_req); + ASSERT(c->wrstate == c_busy); + c->wrstate = c_done; + c->result = status; + do_next(c->client); +} + +static void conn_close(conn *c) { + ASSERT(c->rdstate != c_dead); + ASSERT(c->wrstate != c_dead); + c->rdstate = c_dead; + c->wrstate = c_dead; + c->timer_handle.data = c; + c->handle.handle.data = c; + uv_close(&c->handle.handle, conn_close_done); + uv_close((uv_handle_t *) &c->timer_handle, conn_close_done); +} + +static void conn_close_done(uv_handle_t *handle) { + conn *c; + + c = handle->data; + do_next(c->client); +} diff --git a/3rdparty/libuv/samples/socks5-proxy/defs.h b/3rdparty/libuv/samples/socks5-proxy/defs.h new file mode 100644 index 00000000000..99ee8160c8a --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/defs.h @@ -0,0 +1,139 @@ +/* Copyright StrongLoop, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef DEFS_H_ +#define DEFS_H_ + +#include "s5.h" +#include "uv.h" + +#include +#include /* sockaddr_in, sockaddr_in6 */ +#include /* size_t, ssize_t */ +#include +#include /* sockaddr */ + +struct client_ctx; + +typedef struct { + const char *bind_host; + unsigned short bind_port; + unsigned int idle_timeout; +} server_config; + +typedef struct { + unsigned int idle_timeout; /* Connection idle timeout in ms. */ + uv_tcp_t tcp_handle; + uv_loop_t *loop; +} server_ctx; + +typedef struct { + unsigned char rdstate; + unsigned char wrstate; + unsigned int idle_timeout; + struct client_ctx *client; /* Backlink to owning client context. */ + ssize_t result; + union { + uv_handle_t handle; + uv_stream_t stream; + uv_tcp_t tcp; + uv_udp_t udp; + } handle; + uv_timer_t timer_handle; /* For detecting timeouts. */ + uv_write_t write_req; + /* We only need one of these at a time so make them share memory. */ + union { + uv_getaddrinfo_t addrinfo_req; + uv_connect_t connect_req; + uv_req_t req; + struct sockaddr_in6 addr6; + struct sockaddr_in addr4; + struct sockaddr addr; + char buf[2048]; /* Scratch space. Used to read data into. */ + } t; +} conn; + +typedef struct client_ctx { + unsigned int state; + server_ctx *sx; /* Backlink to owning server context. */ + s5_ctx parser; /* The SOCKS protocol parser. */ + conn incoming; /* Connection with the SOCKS client. */ + conn outgoing; /* Connection with upstream. */ +} client_ctx; + +/* server.c */ +int server_run(const server_config *cf, uv_loop_t *loop); +int can_auth_none(const server_ctx *sx, const client_ctx *cx); +int can_auth_passwd(const server_ctx *sx, const client_ctx *cx); +int can_access(const server_ctx *sx, + const client_ctx *cx, + const struct sockaddr *addr); + +/* client.c */ +void client_finish_init(server_ctx *sx, client_ctx *cx); + +/* util.c */ +#if defined(__GNUC__) +# define ATTRIBUTE_FORMAT_PRINTF(a, b) __attribute__((format(printf, a, b))) +#else +# define ATTRIBUTE_FORMAT_PRINTF(a, b) +#endif +void pr_info(const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2); +void pr_warn(const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2); +void pr_err(const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2); +void *xmalloc(size_t size); + +/* main.c */ +const char *_getprogname(void); + +/* getopt.c */ +#if !HAVE_UNISTD_H +extern char *optarg; +int getopt(int argc, char **argv, const char *options); +#endif + +/* ASSERT() is for debug checks, CHECK() for run-time sanity checks. + * DEBUG_CHECKS is for expensive debug checks that we only want to + * enable in debug builds but still want type-checked by the compiler + * in release builds. + */ +#if defined(NDEBUG) +# define ASSERT(exp) +# define CHECK(exp) do { if (!(exp)) abort(); } while (0) +# define DEBUG_CHECKS (0) +#else +# define ASSERT(exp) assert(exp) +# define CHECK(exp) assert(exp) +# define DEBUG_CHECKS (1) +#endif + +#define UNREACHABLE() CHECK(!"Unreachable code reached.") + +/* This macro looks complicated but it's not: it calculates the address + * of the embedding struct through the address of the embedded struct. + * In other words, if struct A embeds struct B, then we can obtain + * the address of A by taking the address of B and subtracting the + * field offset of B in A. + */ +#define CONTAINER_OF(ptr, type, field) \ + ((type *) ((char *) (ptr) - ((char *) &((type *) 0)->field))) + +#endif /* DEFS_H_ */ diff --git a/3rdparty/libuv/samples/socks5-proxy/getopt.c b/3rdparty/libuv/samples/socks5-proxy/getopt.c new file mode 100644 index 00000000000..8481b2264f2 --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/getopt.c @@ -0,0 +1,131 @@ +/* $NetBSD: getopt.c,v 1.26 2003/08/07 16:43:40 agc Exp $ */ + +/* + * Copyright (c) 1987, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include + +extern const char *_getprogname(void); + +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG "" + +/* + * getopt -- + * Parse argc/argv argument vector. + */ +int +getopt(nargc, nargv, ostr) + int nargc; + char * const nargv[]; + const char *ostr; +{ + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + + if (optreset || *place == 0) { /* update scanning pointer */ + optreset = 0; + place = nargv[optind]; + if (optind >= nargc || *place++ != '-') { + /* Argument is absent or is not an option */ + place = EMSG; + return (-1); + } + optopt = *place++; + if (optopt == '-' && *place == 0) { + /* "--" => end of options */ + ++optind; + place = EMSG; + return (-1); + } + if (optopt == 0) { + /* Solitary '-', treat as a '-' option + if the program (eg su) is looking for it. */ + place = EMSG; + if (strchr(ostr, '-') == NULL) + return (-1); + optopt = '-'; + } + } else + optopt = *place++; + + /* See if option letter is one the caller wanted... */ + if (optopt == ':' || (oli = strchr(ostr, optopt)) == NULL) { + if (*place == 0) + ++optind; + if (opterr && *ostr != ':') + (void)fprintf(stderr, + "%s: illegal option -- %c\n", _getprogname(), + optopt); + return (BADCH); + } + + /* Does this option need an argument? */ + if (oli[1] != ':') { + /* don't need argument */ + optarg = NULL; + if (*place == 0) + ++optind; + } else { + /* Option-argument is either the rest of this argument or the + entire next argument. */ + if (*place) + optarg = place; + else if (nargc > ++optind) + optarg = nargv[optind]; + else { + /* option-argument absent */ + place = EMSG; + if (*ostr == ':') + return (BADARG); + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + _getprogname(), optopt); + return (BADCH); + } + place = EMSG; + ++optind; + } + return (optopt); /* return option letter */ +} diff --git a/3rdparty/libuv/samples/socks5-proxy/main.c b/3rdparty/libuv/samples/socks5-proxy/main.c new file mode 100644 index 00000000000..04020cbd3ad --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/main.c @@ -0,0 +1,99 @@ +/* Copyright StrongLoop, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "defs.h" +#include +#include +#include + +#if HAVE_UNISTD_H +#include /* getopt */ +#endif + +#define DEFAULT_BIND_HOST "127.0.0.1" +#define DEFAULT_BIND_PORT 1080 +#define DEFAULT_IDLE_TIMEOUT (60 * 1000) + +static void parse_opts(server_config *cf, int argc, char **argv); +static void usage(void); + +static const char *progname = __FILE__; /* Reset in main(). */ + +int main(int argc, char **argv) { + server_config config; + int err; + + progname = argv[0]; + memset(&config, 0, sizeof(config)); + config.bind_host = DEFAULT_BIND_HOST; + config.bind_port = DEFAULT_BIND_PORT; + config.idle_timeout = DEFAULT_IDLE_TIMEOUT; + parse_opts(&config, argc, argv); + + err = server_run(&config, uv_default_loop()); + if (err) { + exit(1); + } + + return 0; +} + +const char *_getprogname(void) { + return progname; +} + +static void parse_opts(server_config *cf, int argc, char **argv) { + int opt; + + while (-1 != (opt = getopt(argc, argv, "H:hp:"))) { + switch (opt) { + case 'H': + cf->bind_host = optarg; + break; + + case 'p': + if (1 != sscanf(optarg, "%hu", &cf->bind_port)) { + pr_err("bad port number: %s", optarg); + usage(); + } + break; + + default: + usage(); + } + } +} + +static void usage(void) { + printf("Usage:\n" + "\n" + " %s [-b
[-h] [-p ]\n" + "\n" + "Options:\n" + "\n" + " -b Bind to this address or hostname.\n" + " Default: \"127.0.0.1\"\n" + " -h Show this help message.\n" + " -p Bind to this port number. Default: 1080\n" + "", + progname); + exit(1); +} diff --git a/3rdparty/libuv/samples/socks5-proxy/s5.c b/3rdparty/libuv/samples/socks5-proxy/s5.c new file mode 100644 index 00000000000..4f08e345247 --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/s5.c @@ -0,0 +1,271 @@ +/* Copyright StrongLoop, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "s5.h" +#include +#include +#include /* abort() */ +#include /* memset() */ + +enum { + s5_version, + s5_nmethods, + s5_methods, + s5_auth_pw_version, + s5_auth_pw_userlen, + s5_auth_pw_username, + s5_auth_pw_passlen, + s5_auth_pw_password, + s5_req_version, + s5_req_cmd, + s5_req_reserved, + s5_req_atyp, + s5_req_atyp_host, + s5_req_daddr, + s5_req_dport0, + s5_req_dport1, + s5_dead +}; + +void s5_init(s5_ctx *cx) { + memset(cx, 0, sizeof(*cx)); + cx->state = s5_version; +} + +s5_err s5_parse(s5_ctx *cx, uint8_t **data, size_t *size) { + s5_err err; + uint8_t *p; + uint8_t c; + size_t i; + size_t n; + + p = *data; + n = *size; + i = 0; + + while (i < n) { + c = p[i]; + i += 1; + switch (cx->state) { + case s5_version: + if (c != 5) { + err = s5_bad_version; + goto out; + } + cx->state = s5_nmethods; + break; + + case s5_nmethods: + cx->arg0 = 0; + cx->arg1 = c; /* Number of bytes to read. */ + cx->state = s5_methods; + break; + + case s5_methods: + if (cx->arg0 < cx->arg1) { + switch (c) { + case 0: + cx->methods |= S5_AUTH_NONE; + break; + case 1: + cx->methods |= S5_AUTH_GSSAPI; + break; + case 2: + cx->methods |= S5_AUTH_PASSWD; + break; + /* Ignore everything we don't understand. */ + } + cx->arg0 += 1; + } + if (cx->arg0 == cx->arg1) { + err = s5_auth_select; + goto out; + } + break; + + case s5_auth_pw_version: + if (c != 1) { + err = s5_bad_version; + goto out; + } + cx->state = s5_auth_pw_userlen; + break; + + case s5_auth_pw_userlen: + cx->arg0 = 0; + cx->userlen = c; + cx->state = s5_auth_pw_username; + break; + + case s5_auth_pw_username: + if (cx->arg0 < cx->userlen) { + cx->username[cx->arg0] = c; + cx->arg0 += 1; + } + if (cx->arg0 == cx->userlen) { + cx->username[cx->userlen] = '\0'; + cx->state = s5_auth_pw_passlen; + } + break; + + case s5_auth_pw_passlen: + cx->arg0 = 0; + cx->passlen = c; + cx->state = s5_auth_pw_password; + break; + + case s5_auth_pw_password: + if (cx->arg0 < cx->passlen) { + cx->password[cx->arg0] = c; + cx->arg0 += 1; + } + if (cx->arg0 == cx->passlen) { + cx->password[cx->passlen] = '\0'; + cx->state = s5_req_version; + err = s5_auth_verify; + goto out; + } + break; + + case s5_req_version: + if (c != 5) { + err = s5_bad_version; + goto out; + } + cx->state = s5_req_cmd; + break; + + case s5_req_cmd: + switch (c) { + case 1: /* TCP connect */ + cx->cmd = s5_cmd_tcp_connect; + break; + case 3: /* UDP associate */ + cx->cmd = s5_cmd_udp_assoc; + break; + default: + err = s5_bad_cmd; + goto out; + } + cx->state = s5_req_reserved; + break; + + case s5_req_reserved: + cx->state = s5_req_atyp; + break; + + case s5_req_atyp: + cx->arg0 = 0; + switch (c) { + case 1: /* IPv4, four octets. */ + cx->state = s5_req_daddr; + cx->atyp = s5_atyp_ipv4; + cx->arg1 = 4; + break; + case 3: /* Hostname. First byte is length. */ + cx->state = s5_req_atyp_host; + cx->atyp = s5_atyp_host; + cx->arg1 = 0; + break; + case 4: /* IPv6, sixteen octets. */ + cx->state = s5_req_daddr; + cx->atyp = s5_atyp_ipv6; + cx->arg1 = 16; + break; + default: + err = s5_bad_atyp; + goto out; + } + break; + + case s5_req_atyp_host: + cx->arg1 = c; + cx->state = s5_req_daddr; + break; + + case s5_req_daddr: + if (cx->arg0 < cx->arg1) { + cx->daddr[cx->arg0] = c; + cx->arg0 += 1; + } + if (cx->arg0 == cx->arg1) { + cx->daddr[cx->arg1] = '\0'; + cx->state = s5_req_dport0; + } + break; + + case s5_req_dport0: + cx->dport = c << 8; + cx->state = s5_req_dport1; + break; + + case s5_req_dport1: + cx->dport |= c; + cx->state = s5_dead; + err = s5_exec_cmd; + goto out; + + case s5_dead: + break; + + default: + abort(); + } + } + err = s5_ok; + +out: + *data = p + i; + *size = n - i; + return err; +} + +unsigned int s5_auth_methods(const s5_ctx *cx) { + return cx->methods; +} + +int s5_select_auth(s5_ctx *cx, s5_auth_method method) { + int err; + + err = 0; + switch (method) { + case S5_AUTH_NONE: + cx->state = s5_req_version; + break; + case S5_AUTH_PASSWD: + cx->state = s5_auth_pw_version; + break; + default: + err = -EINVAL; + } + + return err; +} + +const char *s5_strerror(s5_err err) { +#define S5_ERR_GEN(_, name, errmsg) case s5_ ## name: return errmsg; + switch (err) { + S5_ERR_MAP(S5_ERR_GEN) + default: ; /* Silence s5_max_errors -Wswitch warning. */ + } +#undef S5_ERR_GEN + return "Unknown error."; +} diff --git a/3rdparty/libuv/samples/socks5-proxy/s5.h b/3rdparty/libuv/samples/socks5-proxy/s5.h new file mode 100644 index 00000000000..715f322287d --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/s5.h @@ -0,0 +1,94 @@ +/* Copyright StrongLoop, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef S5_H_ +#define S5_H_ + +#include +#include + +#define S5_ERR_MAP(V) \ + V(-1, bad_version, "Bad protocol version.") \ + V(-2, bad_cmd, "Bad protocol command.") \ + V(-3, bad_atyp, "Bad address type.") \ + V(0, ok, "No error.") \ + V(1, auth_select, "Select authentication method.") \ + V(2, auth_verify, "Verify authentication.") \ + V(3, exec_cmd, "Execute command.") \ + +typedef enum { +#define S5_ERR_GEN(code, name, _) s5_ ## name = code, + S5_ERR_MAP(S5_ERR_GEN) +#undef S5_ERR_GEN + s5_max_errors +} s5_err; + +typedef enum { + S5_AUTH_NONE = 1 << 0, + S5_AUTH_GSSAPI = 1 << 1, + S5_AUTH_PASSWD = 1 << 2 +} s5_auth_method; + +typedef enum { + s5_auth_allow, + s5_auth_deny +} s5_auth_result; + +typedef enum { + s5_atyp_ipv4, + s5_atyp_ipv6, + s5_atyp_host +} s5_atyp; + +typedef enum { + s5_cmd_tcp_connect, + s5_cmd_tcp_bind, + s5_cmd_udp_assoc +} s5_cmd; + +typedef struct { + uint32_t arg0; /* Scratch space for the state machine. */ + uint32_t arg1; /* Scratch space for the state machine. */ + uint8_t state; + uint8_t methods; + uint8_t cmd; + uint8_t atyp; + uint8_t userlen; + uint8_t passlen; + uint16_t dport; + uint8_t username[257]; + uint8_t password[257]; + uint8_t daddr[257]; /* TODO(bnoordhuis) Merge with username/password. */ +} s5_ctx; + +void s5_init(s5_ctx *ctx); + +s5_err s5_parse(s5_ctx *cx, uint8_t **data, size_t *size); + +/* Only call after s5_parse() has returned s5_want_auth_method. */ +unsigned int s5_auth_methods(const s5_ctx *cx); + +/* Call after s5_parse() has returned s5_want_auth_method. */ +int s5_select_auth(s5_ctx *cx, s5_auth_method method); + +const char *s5_strerror(s5_err err); + +#endif /* S5_H_ */ diff --git a/3rdparty/libuv/samples/socks5-proxy/server.c b/3rdparty/libuv/samples/socks5-proxy/server.c new file mode 100644 index 00000000000..3f1ba42c9e1 --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/server.c @@ -0,0 +1,241 @@ +/* Copyright StrongLoop, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "defs.h" +#include /* INET6_ADDRSTRLEN */ +#include +#include + +#ifndef INET6_ADDRSTRLEN +# define INET6_ADDRSTRLEN 63 +#endif + +typedef struct { + uv_getaddrinfo_t getaddrinfo_req; + server_config config; + server_ctx *servers; + uv_loop_t *loop; +} server_state; + +static void do_bind(uv_getaddrinfo_t *req, int status, struct addrinfo *ai); +static void on_connection(uv_stream_t *server, int status); + +int server_run(const server_config *cf, uv_loop_t *loop) { + struct addrinfo hints; + server_state state; + int err; + + memset(&state, 0, sizeof(state)); + state.servers = NULL; + state.config = *cf; + state.loop = loop; + + /* Resolve the address of the interface that we should bind to. + * The getaddrinfo callback starts the server and everything else. + */ + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + + err = uv_getaddrinfo(loop, + &state.getaddrinfo_req, + do_bind, + cf->bind_host, + NULL, + &hints); + if (err != 0) { + pr_err("getaddrinfo: %s", uv_strerror(err)); + return err; + } + + /* Start the event loop. Control continues in do_bind(). */ + if (uv_run(loop, UV_RUN_DEFAULT)) { + abort(); + } + + /* Please Valgrind. */ + uv_loop_delete(loop); + free(state.servers); + return 0; +} + +/* Bind a server to each address that getaddrinfo() reported. */ +static void do_bind(uv_getaddrinfo_t *req, int status, struct addrinfo *addrs) { + char addrbuf[INET6_ADDRSTRLEN + 1]; + unsigned int ipv4_naddrs; + unsigned int ipv6_naddrs; + server_state *state; + server_config *cf; + struct addrinfo *ai; + const void *addrv; + const char *what; + uv_loop_t *loop; + server_ctx *sx; + unsigned int n; + int err; + union { + struct sockaddr addr; + struct sockaddr_in addr4; + struct sockaddr_in6 addr6; + } s; + + state = CONTAINER_OF(req, server_state, getaddrinfo_req); + loop = state->loop; + cf = &state->config; + + if (status < 0) { + pr_err("getaddrinfo(\"%s\"): %s", cf->bind_host, uv_strerror(status)); + uv_freeaddrinfo(addrs); + return; + } + + ipv4_naddrs = 0; + ipv6_naddrs = 0; + for (ai = addrs; ai != NULL; ai = ai->ai_next) { + if (ai->ai_family == AF_INET) { + ipv4_naddrs += 1; + } else if (ai->ai_family == AF_INET6) { + ipv6_naddrs += 1; + } + } + + if (ipv4_naddrs == 0 && ipv6_naddrs == 0) { + pr_err("%s has no IPv4/6 addresses", cf->bind_host); + uv_freeaddrinfo(addrs); + return; + } + + state->servers = + xmalloc((ipv4_naddrs + ipv6_naddrs) * sizeof(state->servers[0])); + + n = 0; + for (ai = addrs; ai != NULL; ai = ai->ai_next) { + if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) { + continue; + } + + if (ai->ai_family == AF_INET) { + s.addr4 = *(const struct sockaddr_in *) ai->ai_addr; + s.addr4.sin_port = htons(cf->bind_port); + addrv = &s.addr4.sin_addr; + } else if (ai->ai_family == AF_INET6) { + s.addr6 = *(const struct sockaddr_in6 *) ai->ai_addr; + s.addr6.sin6_port = htons(cf->bind_port); + addrv = &s.addr6.sin6_addr; + } else { + UNREACHABLE(); + } + + if (uv_inet_ntop(s.addr.sa_family, addrv, addrbuf, sizeof(addrbuf))) { + UNREACHABLE(); + } + + sx = state->servers + n; + sx->loop = loop; + sx->idle_timeout = state->config.idle_timeout; + CHECK(0 == uv_tcp_init(loop, &sx->tcp_handle)); + + what = "uv_tcp_bind"; + err = uv_tcp_bind(&sx->tcp_handle, &s.addr, 0); + if (err == 0) { + what = "uv_listen"; + err = uv_listen((uv_stream_t *) &sx->tcp_handle, 128, on_connection); + } + + if (err != 0) { + pr_err("%s(\"%s:%hu\"): %s", + what, + addrbuf, + cf->bind_port, + uv_strerror(err)); + while (n > 0) { + n -= 1; + uv_close((uv_handle_t *) (state->servers + n), NULL); + } + break; + } + + pr_info("listening on %s:%hu", addrbuf, cf->bind_port); + n += 1; + } + + uv_freeaddrinfo(addrs); +} + +static void on_connection(uv_stream_t *server, int status) { + server_ctx *sx; + client_ctx *cx; + + CHECK(status == 0); + sx = CONTAINER_OF(server, server_ctx, tcp_handle); + cx = xmalloc(sizeof(*cx)); + CHECK(0 == uv_tcp_init(sx->loop, &cx->incoming.handle.tcp)); + CHECK(0 == uv_accept(server, &cx->incoming.handle.stream)); + client_finish_init(sx, cx); +} + +int can_auth_none(const server_ctx *sx, const client_ctx *cx) { + return 1; +} + +int can_auth_passwd(const server_ctx *sx, const client_ctx *cx) { + return 0; +} + +int can_access(const server_ctx *sx, + const client_ctx *cx, + const struct sockaddr *addr) { + const struct sockaddr_in6 *addr6; + const struct sockaddr_in *addr4; + const uint32_t *p; + uint32_t a; + uint32_t b; + uint32_t c; + uint32_t d; + + /* TODO(bnoordhuis) Implement proper access checks. For now, just reject + * traffic to localhost. + */ + if (addr->sa_family == AF_INET) { + addr4 = (const struct sockaddr_in *) addr; + d = ntohl(addr4->sin_addr.s_addr); + return (d >> 24) != 0x7F; + } + + if (addr->sa_family == AF_INET6) { + addr6 = (const struct sockaddr_in6 *) addr; + p = (const uint32_t *) &addr6->sin6_addr.s6_addr; + a = ntohl(p[0]); + b = ntohl(p[1]); + c = ntohl(p[2]); + d = ntohl(p[3]); + if (a == 0 && b == 0 && c == 0 && d == 1) { + return 0; /* "::1" style address. */ + } + if (a == 0 && b == 0 && c == 0xFFFF && (d >> 24) == 0x7F) { + return 0; /* "::ffff:127.x.x.x" style address. */ + } + return 1; + } + + return 0; +} diff --git a/3rdparty/libuv/samples/socks5-proxy/util.c b/3rdparty/libuv/samples/socks5-proxy/util.c new file mode 100644 index 00000000000..af34f055936 --- /dev/null +++ b/3rdparty/libuv/samples/socks5-proxy/util.c @@ -0,0 +1,72 @@ +/* Copyright StrongLoop, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "defs.h" +#include +#include +#include + +static void pr_do(FILE *stream, + const char *label, + const char *fmt, + va_list ap); + +void *xmalloc(size_t size) { + void *ptr; + + ptr = malloc(size); + if (ptr == NULL) { + pr_err("out of memory, need %lu bytes", (unsigned long) size); + exit(1); + } + + return ptr; +} + +void pr_info(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + pr_do(stdout, "info", fmt, ap); + va_end(ap); +} + +void pr_warn(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + pr_do(stderr, "warn", fmt, ap); + va_end(ap); +} + +void pr_err(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + pr_do(stderr, "error", fmt, ap); + va_end(ap); +} + +static void pr_do(FILE *stream, + const char *label, + const char *fmt, + va_list ap) { + char fmtbuf[1024]; + vsnprintf(fmtbuf, sizeof(fmtbuf), fmt, ap); + fprintf(stream, "%s:%s: %s\n", _getprogname(), label, fmtbuf); +} diff --git a/3rdparty/libuv/src/fs-poll.c b/3rdparty/libuv/src/fs-poll.c new file mode 100644 index 00000000000..44d47b88ed2 --- /dev/null +++ b/3rdparty/libuv/src/fs-poll.c @@ -0,0 +1,255 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "uv-common.h" + +#include +#include +#include + +struct poll_ctx { + uv_fs_poll_t* parent_handle; /* NULL if parent has been stopped or closed */ + int busy_polling; + unsigned int interval; + uint64_t start_time; + uv_loop_t* loop; + uv_fs_poll_cb poll_cb; + uv_timer_t timer_handle; + uv_fs_t fs_req; /* TODO(bnoordhuis) mark fs_req internal */ + uv_stat_t statbuf; + char path[1]; /* variable length */ +}; + +static int statbuf_eq(const uv_stat_t* a, const uv_stat_t* b); +static void poll_cb(uv_fs_t* req); +static void timer_cb(uv_timer_t* timer); +static void timer_close_cb(uv_handle_t* handle); + +static uv_stat_t zero_statbuf; + + +int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle) { + uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_POLL); + return 0; +} + + +int uv_fs_poll_start(uv_fs_poll_t* handle, + uv_fs_poll_cb cb, + const char* path, + unsigned int interval) { + struct poll_ctx* ctx; + uv_loop_t* loop; + size_t len; + int err; + + if (uv__is_active(handle)) + return 0; + + loop = handle->loop; + len = strlen(path); + ctx = uv__calloc(1, sizeof(*ctx) + len); + + if (ctx == NULL) + return UV_ENOMEM; + + ctx->loop = loop; + ctx->poll_cb = cb; + ctx->interval = interval ? interval : 1; + ctx->start_time = uv_now(loop); + ctx->parent_handle = handle; + memcpy(ctx->path, path, len + 1); + + err = uv_timer_init(loop, &ctx->timer_handle); + if (err < 0) + goto error; + + ctx->timer_handle.flags |= UV__HANDLE_INTERNAL; + uv__handle_unref(&ctx->timer_handle); + + err = uv_fs_stat(loop, &ctx->fs_req, ctx->path, poll_cb); + if (err < 0) + goto error; + + handle->poll_ctx = ctx; + uv__handle_start(handle); + + return 0; + +error: + uv__free(ctx); + return err; +} + + +int uv_fs_poll_stop(uv_fs_poll_t* handle) { + struct poll_ctx* ctx; + + if (!uv__is_active(handle)) + return 0; + + ctx = handle->poll_ctx; + assert(ctx != NULL); + assert(ctx->parent_handle != NULL); + ctx->parent_handle = NULL; + handle->poll_ctx = NULL; + + /* Close the timer if it's active. If it's inactive, there's a stat request + * in progress and poll_cb will take care of the cleanup. + */ + if (uv__is_active(&ctx->timer_handle)) + uv_close((uv_handle_t*)&ctx->timer_handle, timer_close_cb); + + uv__handle_stop(handle); + + return 0; +} + + +int uv_fs_poll_getpath(uv_fs_poll_t* handle, char* buffer, size_t* size) { + struct poll_ctx* ctx; + size_t required_len; + + if (!uv__is_active(handle)) { + *size = 0; + return UV_EINVAL; + } + + ctx = handle->poll_ctx; + assert(ctx != NULL); + + required_len = strlen(ctx->path); + if (required_len > *size) { + *size = required_len; + return UV_ENOBUFS; + } + + memcpy(buffer, ctx->path, required_len); + *size = required_len; + + return 0; +} + + +void uv__fs_poll_close(uv_fs_poll_t* handle) { + uv_fs_poll_stop(handle); +} + + +static void timer_cb(uv_timer_t* timer) { + struct poll_ctx* ctx; + + ctx = container_of(timer, struct poll_ctx, timer_handle); + assert(ctx->parent_handle != NULL); + assert(ctx->parent_handle->poll_ctx == ctx); + ctx->start_time = uv_now(ctx->loop); + + if (uv_fs_stat(ctx->loop, &ctx->fs_req, ctx->path, poll_cb)) + abort(); +} + + +static void poll_cb(uv_fs_t* req) { + uv_stat_t* statbuf; + struct poll_ctx* ctx; + uint64_t interval; + + ctx = container_of(req, struct poll_ctx, fs_req); + + if (ctx->parent_handle == NULL) { /* handle has been stopped or closed */ + uv_close((uv_handle_t*)&ctx->timer_handle, timer_close_cb); + uv_fs_req_cleanup(req); + return; + } + + if (req->result != 0) { + if (ctx->busy_polling != req->result) { + ctx->poll_cb(ctx->parent_handle, + req->result, + &ctx->statbuf, + &zero_statbuf); + ctx->busy_polling = req->result; + } + goto out; + } + + statbuf = &req->statbuf; + + if (ctx->busy_polling != 0) + if (ctx->busy_polling < 0 || !statbuf_eq(&ctx->statbuf, statbuf)) + ctx->poll_cb(ctx->parent_handle, 0, &ctx->statbuf, statbuf); + + ctx->statbuf = *statbuf; + ctx->busy_polling = 1; + +out: + uv_fs_req_cleanup(req); + + if (ctx->parent_handle == NULL) { /* handle has been stopped by callback */ + uv_close((uv_handle_t*)&ctx->timer_handle, timer_close_cb); + return; + } + + /* Reschedule timer, subtract the delay from doing the stat(). */ + interval = ctx->interval; + interval -= (uv_now(ctx->loop) - ctx->start_time) % interval; + + if (uv_timer_start(&ctx->timer_handle, timer_cb, interval, 0)) + abort(); +} + + +static void timer_close_cb(uv_handle_t* handle) { + uv__free(container_of(handle, struct poll_ctx, timer_handle)); +} + + +static int statbuf_eq(const uv_stat_t* a, const uv_stat_t* b) { + return a->st_ctim.tv_nsec == b->st_ctim.tv_nsec + && a->st_mtim.tv_nsec == b->st_mtim.tv_nsec + && a->st_birthtim.tv_nsec == b->st_birthtim.tv_nsec + && a->st_ctim.tv_sec == b->st_ctim.tv_sec + && a->st_mtim.tv_sec == b->st_mtim.tv_sec + && a->st_birthtim.tv_sec == b->st_birthtim.tv_sec + && a->st_size == b->st_size + && a->st_mode == b->st_mode + && a->st_uid == b->st_uid + && a->st_gid == b->st_gid + && a->st_ino == b->st_ino + && a->st_dev == b->st_dev + && a->st_flags == b->st_flags + && a->st_gen == b->st_gen; +} + + +#if defined(_WIN32) + +#include "win/internal.h" +#include "win/handle-inl.h" + +void uv__fs_poll_endgame(uv_loop_t* loop, uv_fs_poll_t* handle) { + assert(handle->flags & UV__HANDLE_CLOSING); + assert(!(handle->flags & UV_HANDLE_CLOSED)); + uv__handle_close(handle); +} + +#endif /* _WIN32 */ diff --git a/3rdparty/libuv/src/heap-inl.h b/3rdparty/libuv/src/heap-inl.h new file mode 100644 index 00000000000..1e2ed60e094 --- /dev/null +++ b/3rdparty/libuv/src/heap-inl.h @@ -0,0 +1,245 @@ +/* Copyright (c) 2013, Ben Noordhuis + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef UV_SRC_HEAP_H_ +#define UV_SRC_HEAP_H_ + +#include /* NULL */ + +#if defined(__GNUC__) +# define HEAP_EXPORT(declaration) __attribute__((unused)) static declaration +#else +# define HEAP_EXPORT(declaration) static declaration +#endif + +struct heap_node { + struct heap_node* left; + struct heap_node* right; + struct heap_node* parent; +}; + +/* A binary min heap. The usual properties hold: the root is the lowest + * element in the set, the height of the tree is at most log2(nodes) and + * it's always a complete binary tree. + * + * The heap function try hard to detect corrupted tree nodes at the cost + * of a minor reduction in performance. Compile with -DNDEBUG to disable. + */ +struct heap { + struct heap_node* min; + unsigned int nelts; +}; + +/* Return non-zero if a < b. */ +typedef int (*heap_compare_fn)(const struct heap_node* a, + const struct heap_node* b); + +/* Public functions. */ +HEAP_EXPORT(void heap_init(struct heap* heap)); +HEAP_EXPORT(struct heap_node* heap_min(const struct heap* heap)); +HEAP_EXPORT(void heap_insert(struct heap* heap, + struct heap_node* newnode, + heap_compare_fn less_than)); +HEAP_EXPORT(void heap_remove(struct heap* heap, + struct heap_node* node, + heap_compare_fn less_than)); +HEAP_EXPORT(void heap_dequeue(struct heap* heap, heap_compare_fn less_than)); + +/* Implementation follows. */ + +HEAP_EXPORT(void heap_init(struct heap* heap)) { + heap->min = NULL; + heap->nelts = 0; +} + +HEAP_EXPORT(struct heap_node* heap_min(const struct heap* heap)) { + return heap->min; +} + +/* Swap parent with child. Child moves closer to the root, parent moves away. */ +static void heap_node_swap(struct heap* heap, + struct heap_node* parent, + struct heap_node* child) { + struct heap_node* sibling; + struct heap_node t; + + t = *parent; + *parent = *child; + *child = t; + + parent->parent = child; + if (child->left == child) { + child->left = parent; + sibling = child->right; + } else { + child->right = parent; + sibling = child->left; + } + if (sibling != NULL) + sibling->parent = child; + + if (parent->left != NULL) + parent->left->parent = parent; + if (parent->right != NULL) + parent->right->parent = parent; + + if (child->parent == NULL) + heap->min = child; + else if (child->parent->left == parent) + child->parent->left = child; + else + child->parent->right = child; +} + +HEAP_EXPORT(void heap_insert(struct heap* heap, + struct heap_node* newnode, + heap_compare_fn less_than)) { + struct heap_node** parent; + struct heap_node** child; + unsigned int path; + unsigned int n; + unsigned int k; + + newnode->left = NULL; + newnode->right = NULL; + newnode->parent = NULL; + + /* Calculate the path from the root to the insertion point. This is a min + * heap so we always insert at the left-most free node of the bottom row. + */ + path = 0; + for (k = 0, n = 1 + heap->nelts; n >= 2; k += 1, n /= 2) + path = (path << 1) | (n & 1); + + /* Now traverse the heap using the path we calculated in the previous step. */ + parent = child = &heap->min; + while (k > 0) { + parent = child; + if (path & 1) + child = &(*child)->right; + else + child = &(*child)->left; + path >>= 1; + k -= 1; + } + + /* Insert the new node. */ + newnode->parent = *parent; + *child = newnode; + heap->nelts += 1; + + /* Walk up the tree and check at each node if the heap property holds. + * It's a min heap so parent < child must be true. + */ + while (newnode->parent != NULL && less_than(newnode, newnode->parent)) + heap_node_swap(heap, newnode->parent, newnode); +} + +HEAP_EXPORT(void heap_remove(struct heap* heap, + struct heap_node* node, + heap_compare_fn less_than)) { + struct heap_node* smallest; + struct heap_node** max; + struct heap_node* child; + unsigned int path; + unsigned int k; + unsigned int n; + + if (heap->nelts == 0) + return; + + /* Calculate the path from the min (the root) to the max, the left-most node + * of the bottom row. + */ + path = 0; + for (k = 0, n = heap->nelts; n >= 2; k += 1, n /= 2) + path = (path << 1) | (n & 1); + + /* Now traverse the heap using the path we calculated in the previous step. */ + max = &heap->min; + while (k > 0) { + if (path & 1) + max = &(*max)->right; + else + max = &(*max)->left; + path >>= 1; + k -= 1; + } + + heap->nelts -= 1; + + /* Unlink the max node. */ + child = *max; + *max = NULL; + + if (child == node) { + /* We're removing either the max or the last node in the tree. */ + if (child == heap->min) { + heap->min = NULL; + } + return; + } + + /* Replace the to be deleted node with the max node. */ + child->left = node->left; + child->right = node->right; + child->parent = node->parent; + + if (child->left != NULL) { + child->left->parent = child; + } + + if (child->right != NULL) { + child->right->parent = child; + } + + if (node->parent == NULL) { + heap->min = child; + } else if (node->parent->left == node) { + node->parent->left = child; + } else { + node->parent->right = child; + } + + /* Walk down the subtree and check at each node if the heap property holds. + * It's a min heap so parent < child must be true. If the parent is bigger, + * swap it with the smallest child. + */ + for (;;) { + smallest = child; + if (child->left != NULL && less_than(child->left, smallest)) + smallest = child->left; + if (child->right != NULL && less_than(child->right, smallest)) + smallest = child->right; + if (smallest == child) + break; + heap_node_swap(heap, child, smallest); + } + + /* Walk up the subtree and check that each parent is less than the node + * this is required, because `max` node is not guaranteed to be the + * actual maximum in tree + */ + while (child->parent != NULL && less_than(child, child->parent)) + heap_node_swap(heap, child->parent, child); +} + +HEAP_EXPORT(void heap_dequeue(struct heap* heap, heap_compare_fn less_than)) { + heap_remove(heap, heap->min, less_than); +} + +#undef HEAP_EXPORT + +#endif /* UV_SRC_HEAP_H_ */ diff --git a/3rdparty/libuv/src/inet.c b/3rdparty/libuv/src/inet.c new file mode 100644 index 00000000000..da63a688c4e --- /dev/null +++ b/3rdparty/libuv/src/inet.c @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1600 +# include "stdint-msvc2008.h" +#else +# include +#endif + +#include "uv.h" +#include "uv-common.h" + +#define UV__INET_ADDRSTRLEN 16 +#define UV__INET6_ADDRSTRLEN 46 + + +static int inet_ntop4(const unsigned char *src, char *dst, size_t size); +static int inet_ntop6(const unsigned char *src, char *dst, size_t size); +static int inet_pton4(const char *src, unsigned char *dst); +static int inet_pton6(const char *src, unsigned char *dst); + + +int uv_inet_ntop(int af, const void* src, char* dst, size_t size) { + switch (af) { + case AF_INET: + return (inet_ntop4(src, dst, size)); + case AF_INET6: + return (inet_ntop6(src, dst, size)); + default: + return UV_EAFNOSUPPORT; + } + /* NOTREACHED */ +} + + +static int inet_ntop4(const unsigned char *src, char *dst, size_t size) { + static const char fmt[] = "%u.%u.%u.%u"; + char tmp[UV__INET_ADDRSTRLEN]; + int l; + + l = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]); + if (l <= 0 || (size_t) l >= size) { + return UV_ENOSPC; + } + strncpy(dst, tmp, size); + dst[size - 1] = '\0'; + return 0; +} + + +static int inet_ntop6(const unsigned char *src, char *dst, size_t size) { + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[UV__INET6_ADDRSTRLEN], *tp; + struct { int base, len; } best, cur; + unsigned int words[sizeof(struct in6_addr) / sizeof(uint16_t)]; + int i; + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof words); + for (i = 0; i < (int) sizeof(struct in6_addr); i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + best.base = -1; + best.len = 0; + cur.base = -1; + cur.len = 0; + for (i = 0; i < (int) ARRAY_SIZE(words); i++) { + if (words[i] == 0) { + if (cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* + * Format the result. + */ + tp = tmp; + for (i = 0; i < (int) ARRAY_SIZE(words); i++) { + /* Are we inside the best run of 0x00's? */ + if (best.base != -1 && i >= best.base && + i < (best.base + best.len)) { + if (i == best.base) + *tp++ = ':'; + continue; + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) + *tp++ = ':'; + /* Is this address an encapsulated IPv4? */ + if (i == 6 && best.base == 0 && (best.len == 6 || + (best.len == 7 && words[7] != 0x0001) || + (best.len == 5 && words[5] == 0xffff))) { + int err = inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)); + if (err) + return err; + tp += strlen(tp); + break; + } + tp += sprintf(tp, "%x", words[i]); + } + /* Was it a trailing run of 0x00's? */ + if (best.base != -1 && (best.base + best.len) == ARRAY_SIZE(words)) + *tp++ = ':'; + *tp++ = '\0'; + + /* + * Check for overflow, copy, and we're done. + */ + if ((size_t)(tp - tmp) > size) { + return UV_ENOSPC; + } + strcpy(dst, tmp); + return 0; +} + + +int uv_inet_pton(int af, const char* src, void* dst) { + if (src == NULL || dst == NULL) + return UV_EINVAL; + + switch (af) { + case AF_INET: + return (inet_pton4(src, dst)); + case AF_INET6: { + int len; + char tmp[UV__INET6_ADDRSTRLEN], *s, *p; + s = (char*) src; + p = strchr(src, '%'); + if (p != NULL) { + s = tmp; + len = p - src; + if (len > UV__INET6_ADDRSTRLEN-1) + return UV_EINVAL; + memcpy(s, src, len); + s[len] = '\0'; + } + return inet_pton6(s, dst); + } + default: + return UV_EAFNOSUPPORT; + } + /* NOTREACHED */ +} + + +static int inet_pton4(const char *src, unsigned char *dst) { + static const char digits[] = "0123456789"; + int saw_digit, octets, ch; + unsigned char tmp[sizeof(struct in_addr)], *tp; + + saw_digit = 0; + octets = 0; + *(tp = tmp) = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr(digits, ch)) != NULL) { + unsigned int nw = *tp * 10 + (pch - digits); + + if (saw_digit && *tp == 0) + return UV_EINVAL; + if (nw > 255) + return UV_EINVAL; + *tp = nw; + if (!saw_digit) { + if (++octets > 4) + return UV_EINVAL; + saw_digit = 1; + } + } else if (ch == '.' && saw_digit) { + if (octets == 4) + return UV_EINVAL; + *++tp = 0; + saw_digit = 0; + } else + return UV_EINVAL; + } + if (octets < 4) + return UV_EINVAL; + memcpy(dst, tmp, sizeof(struct in_addr)); + return 0; +} + + +static int inet_pton6(const char *src, unsigned char *dst) { + static const char xdigits_l[] = "0123456789abcdef", + xdigits_u[] = "0123456789ABCDEF"; + unsigned char tmp[sizeof(struct in6_addr)], *tp, *endp, *colonp; + const char *xdigits, *curtok; + int ch, seen_xdigits; + unsigned int val; + + memset((tp = tmp), '\0', sizeof tmp); + endp = tp + sizeof tmp; + colonp = NULL; + /* Leading :: requires some special handling. */ + if (*src == ':') + if (*++src != ':') + return UV_EINVAL; + curtok = src; + seen_xdigits = 0; + val = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) + pch = strchr((xdigits = xdigits_u), ch); + if (pch != NULL) { + val <<= 4; + val |= (pch - xdigits); + if (++seen_xdigits > 4) + return UV_EINVAL; + continue; + } + if (ch == ':') { + curtok = src; + if (!seen_xdigits) { + if (colonp) + return UV_EINVAL; + colonp = tp; + continue; + } else if (*src == '\0') { + return UV_EINVAL; + } + if (tp + sizeof(uint16_t) > endp) + return UV_EINVAL; + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; + seen_xdigits = 0; + val = 0; + continue; + } + if (ch == '.' && ((tp + sizeof(struct in_addr)) <= endp)) { + int err = inet_pton4(curtok, tp); + if (err == 0) { + tp += sizeof(struct in_addr); + seen_xdigits = 0; + break; /*%< '\\0' was seen by inet_pton4(). */ + } + } + return UV_EINVAL; + } + if (seen_xdigits) { + if (tp + sizeof(uint16_t) > endp) + return UV_EINVAL; + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; + } + if (colonp != NULL) { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const int n = tp - colonp; + int i; + + if (tp == endp) + return UV_EINVAL; + for (i = 1; i <= n; i++) { + endp[- i] = colonp[n - i]; + colonp[n - i] = 0; + } + tp = endp; + } + if (tp != endp) + return UV_EINVAL; + memcpy(dst, tmp, sizeof tmp); + return 0; +} diff --git a/3rdparty/libuv/src/queue.h b/3rdparty/libuv/src/queue.h new file mode 100644 index 00000000000..ff3540a0a51 --- /dev/null +++ b/3rdparty/libuv/src/queue.h @@ -0,0 +1,108 @@ +/* Copyright (c) 2013, Ben Noordhuis + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef QUEUE_H_ +#define QUEUE_H_ + +#include + +typedef void *QUEUE[2]; + +/* Private macros. */ +#define QUEUE_NEXT(q) (*(QUEUE **) &((*(q))[0])) +#define QUEUE_PREV(q) (*(QUEUE **) &((*(q))[1])) +#define QUEUE_PREV_NEXT(q) (QUEUE_NEXT(QUEUE_PREV(q))) +#define QUEUE_NEXT_PREV(q) (QUEUE_PREV(QUEUE_NEXT(q))) + +/* Public macros. */ +#define QUEUE_DATA(ptr, type, field) \ + ((type *) ((char *) (ptr) - offsetof(type, field))) + +/* Important note: mutating the list while QUEUE_FOREACH is + * iterating over its elements results in undefined behavior. + */ +#define QUEUE_FOREACH(q, h) \ + for ((q) = QUEUE_NEXT(h); (q) != (h); (q) = QUEUE_NEXT(q)) + +#define QUEUE_EMPTY(q) \ + ((const QUEUE *) (q) == (const QUEUE *) QUEUE_NEXT(q)) + +#define QUEUE_HEAD(q) \ + (QUEUE_NEXT(q)) + +#define QUEUE_INIT(q) \ + do { \ + QUEUE_NEXT(q) = (q); \ + QUEUE_PREV(q) = (q); \ + } \ + while (0) + +#define QUEUE_ADD(h, n) \ + do { \ + QUEUE_PREV_NEXT(h) = QUEUE_NEXT(n); \ + QUEUE_NEXT_PREV(n) = QUEUE_PREV(h); \ + QUEUE_PREV(h) = QUEUE_PREV(n); \ + QUEUE_PREV_NEXT(h) = (h); \ + } \ + while (0) + +#define QUEUE_SPLIT(h, q, n) \ + do { \ + QUEUE_PREV(n) = QUEUE_PREV(h); \ + QUEUE_PREV_NEXT(n) = (n); \ + QUEUE_NEXT(n) = (q); \ + QUEUE_PREV(h) = QUEUE_PREV(q); \ + QUEUE_PREV_NEXT(h) = (h); \ + QUEUE_PREV(q) = (n); \ + } \ + while (0) + +#define QUEUE_MOVE(h, n) \ + do { \ + if (QUEUE_EMPTY(h)) \ + QUEUE_INIT(n); \ + else { \ + QUEUE* q = QUEUE_HEAD(h); \ + QUEUE_SPLIT(h, q, n); \ + } \ + } \ + while (0) + +#define QUEUE_INSERT_HEAD(h, q) \ + do { \ + QUEUE_NEXT(q) = QUEUE_NEXT(h); \ + QUEUE_PREV(q) = (h); \ + QUEUE_NEXT_PREV(q) = (q); \ + QUEUE_NEXT(h) = (q); \ + } \ + while (0) + +#define QUEUE_INSERT_TAIL(h, q) \ + do { \ + QUEUE_NEXT(q) = (h); \ + QUEUE_PREV(q) = QUEUE_PREV(h); \ + QUEUE_PREV_NEXT(q) = (q); \ + QUEUE_PREV(h) = (q); \ + } \ + while (0) + +#define QUEUE_REMOVE(q) \ + do { \ + QUEUE_PREV_NEXT(q) = QUEUE_NEXT(q); \ + QUEUE_NEXT_PREV(q) = QUEUE_PREV(q); \ + } \ + while (0) + +#endif /* QUEUE_H_ */ diff --git a/3rdparty/libuv/src/threadpool.c b/3rdparty/libuv/src/threadpool.c new file mode 100644 index 00000000000..2c5152b4200 --- /dev/null +++ b/3rdparty/libuv/src/threadpool.c @@ -0,0 +1,303 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv-common.h" + +#if !defined(_WIN32) +# include "unix/internal.h" +#else +# include "win/req-inl.h" +/* TODO(saghul): unify internal req functions */ +static void uv__req_init(uv_loop_t* loop, + uv_req_t* req, + uv_req_type type) { + uv_req_init(loop, req); + req->type = type; + uv__req_register(loop, req); +} +# define uv__req_init(loop, req, type) \ + uv__req_init((loop), (uv_req_t*)(req), (type)) +#endif + +#include + +#define MAX_THREADPOOL_SIZE 128 + +static uv_once_t once = UV_ONCE_INIT; +static uv_cond_t cond; +static uv_mutex_t mutex; +static unsigned int idle_threads; +static unsigned int nthreads; +static uv_thread_t* threads; +static uv_thread_t default_threads[4]; +static QUEUE exit_message; +static QUEUE wq; +static volatile int initialized; + + +static void uv__cancelled(struct uv__work* w) { + abort(); +} + + +/* To avoid deadlock with uv_cancel() it's crucial that the worker + * never holds the global mutex and the loop-local mutex at the same time. + */ +static void worker(void* arg) { + struct uv__work* w; + QUEUE* q; + + (void) arg; + + for (;;) { + uv_mutex_lock(&mutex); + + while (QUEUE_EMPTY(&wq)) { + idle_threads += 1; + uv_cond_wait(&cond, &mutex); + idle_threads -= 1; + } + + q = QUEUE_HEAD(&wq); + + if (q == &exit_message) + uv_cond_signal(&cond); + else { + QUEUE_REMOVE(q); + QUEUE_INIT(q); /* Signal uv_cancel() that the work req is + executing. */ + } + + uv_mutex_unlock(&mutex); + + if (q == &exit_message) + break; + + w = QUEUE_DATA(q, struct uv__work, wq); + w->work(w); + + uv_mutex_lock(&w->loop->wq_mutex); + w->work = NULL; /* Signal uv_cancel() that the work req is done + executing. */ + QUEUE_INSERT_TAIL(&w->loop->wq, &w->wq); + uv_async_send(&w->loop->wq_async); + uv_mutex_unlock(&w->loop->wq_mutex); + } +} + + +static void post(QUEUE* q) { + uv_mutex_lock(&mutex); + QUEUE_INSERT_TAIL(&wq, q); + if (idle_threads > 0) + uv_cond_signal(&cond); + uv_mutex_unlock(&mutex); +} + + +#ifndef _WIN32 +UV_DESTRUCTOR(static void cleanup(void)) { + unsigned int i; + + if (initialized == 0) + return; + + post(&exit_message); + + for (i = 0; i < nthreads; i++) + if (uv_thread_join(threads + i)) + abort(); + + if (threads != default_threads) + uv__free(threads); + + uv_mutex_destroy(&mutex); + uv_cond_destroy(&cond); + + threads = NULL; + nthreads = 0; + initialized = 0; +} +#endif + + +static void init_once(void) { + unsigned int i; + const char* val; + + nthreads = ARRAY_SIZE(default_threads); + val = getenv("UV_THREADPOOL_SIZE"); + if (val != NULL) + nthreads = atoi(val); + if (nthreads == 0) + nthreads = 1; + if (nthreads > MAX_THREADPOOL_SIZE) + nthreads = MAX_THREADPOOL_SIZE; + + threads = default_threads; + if (nthreads > ARRAY_SIZE(default_threads)) { + threads = uv__malloc(nthreads * sizeof(threads[0])); + if (threads == NULL) { + nthreads = ARRAY_SIZE(default_threads); + threads = default_threads; + } + } + + if (uv_cond_init(&cond)) + abort(); + + if (uv_mutex_init(&mutex)) + abort(); + + QUEUE_INIT(&wq); + + for (i = 0; i < nthreads; i++) + if (uv_thread_create(threads + i, worker, NULL)) + abort(); + + initialized = 1; +} + + +void uv__work_submit(uv_loop_t* loop, + struct uv__work* w, + void (*work)(struct uv__work* w), + void (*done)(struct uv__work* w, int status)) { + uv_once(&once, init_once); + w->loop = loop; + w->work = work; + w->done = done; + post(&w->wq); +} + + +static int uv__work_cancel(uv_loop_t* loop, uv_req_t* req, struct uv__work* w) { + int cancelled; + + uv_mutex_lock(&mutex); + uv_mutex_lock(&w->loop->wq_mutex); + + cancelled = !QUEUE_EMPTY(&w->wq) && w->work != NULL; + if (cancelled) + QUEUE_REMOVE(&w->wq); + + uv_mutex_unlock(&w->loop->wq_mutex); + uv_mutex_unlock(&mutex); + + if (!cancelled) + return UV_EBUSY; + + w->work = uv__cancelled; + uv_mutex_lock(&loop->wq_mutex); + QUEUE_INSERT_TAIL(&loop->wq, &w->wq); + uv_async_send(&loop->wq_async); + uv_mutex_unlock(&loop->wq_mutex); + + return 0; +} + + +void uv__work_done(uv_async_t* handle) { + struct uv__work* w; + uv_loop_t* loop; + QUEUE* q; + QUEUE wq; + int err; + + loop = container_of(handle, uv_loop_t, wq_async); + uv_mutex_lock(&loop->wq_mutex); + QUEUE_MOVE(&loop->wq, &wq); + uv_mutex_unlock(&loop->wq_mutex); + + while (!QUEUE_EMPTY(&wq)) { + q = QUEUE_HEAD(&wq); + QUEUE_REMOVE(q); + + w = container_of(q, struct uv__work, wq); + err = (w->work == uv__cancelled) ? UV_ECANCELED : 0; + w->done(w, err); + } +} + + +static void uv__queue_work(struct uv__work* w) { + uv_work_t* req = container_of(w, uv_work_t, work_req); + + req->work_cb(req); +} + + +static void uv__queue_done(struct uv__work* w, int err) { + uv_work_t* req; + + req = container_of(w, uv_work_t, work_req); + uv__req_unregister(req->loop, req); + + if (req->after_work_cb == NULL) + return; + + req->after_work_cb(req, err); +} + + +int uv_queue_work(uv_loop_t* loop, + uv_work_t* req, + uv_work_cb work_cb, + uv_after_work_cb after_work_cb) { + if (work_cb == NULL) + return UV_EINVAL; + + uv__req_init(loop, req, UV_WORK); + req->loop = loop; + req->work_cb = work_cb; + req->after_work_cb = after_work_cb; + uv__work_submit(loop, &req->work_req, uv__queue_work, uv__queue_done); + return 0; +} + + +int uv_cancel(uv_req_t* req) { + struct uv__work* wreq; + uv_loop_t* loop; + + switch (req->type) { + case UV_FS: + loop = ((uv_fs_t*) req)->loop; + wreq = &((uv_fs_t*) req)->work_req; + break; + case UV_GETADDRINFO: + loop = ((uv_getaddrinfo_t*) req)->loop; + wreq = &((uv_getaddrinfo_t*) req)->work_req; + break; + case UV_GETNAMEINFO: + loop = ((uv_getnameinfo_t*) req)->loop; + wreq = &((uv_getnameinfo_t*) req)->work_req; + break; + case UV_WORK: + loop = ((uv_work_t*) req)->loop; + wreq = &((uv_work_t*) req)->work_req; + break; + default: + return UV_EINVAL; + } + + return uv__work_cancel(loop, req, wreq); +} diff --git a/3rdparty/libuv/src/unix/aix.c b/3rdparty/libuv/src/unix/aix.c new file mode 100644 index 00000000000..c90b7e5cb9b --- /dev/null +++ b/3rdparty/libuv/src/unix/aix.c @@ -0,0 +1,1158 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#ifdef HAVE_SYS_AHAFS_EVPRODS_H +#include +#endif + +#include +#include +#include +#include +#include + +#define RDWR_BUF_SIZE 4096 +#define EQ(a,b) (strcmp(a,b) == 0) + +int uv__platform_loop_init(uv_loop_t* loop) { + loop->fs_fd = -1; + + /* Passing maxfd of -1 should mean the limit is determined + * by the user's ulimit or the global limit as per the doc */ + loop->backend_fd = pollset_create(-1); + + if (loop->backend_fd == -1) + return -1; + + return 0; +} + + +void uv__platform_loop_delete(uv_loop_t* loop) { + if (loop->fs_fd != -1) { + uv__close(loop->fs_fd); + loop->fs_fd = -1; + } + + if (loop->backend_fd != -1) { + pollset_destroy(loop->backend_fd); + loop->backend_fd = -1; + } +} + + +void uv__io_poll(uv_loop_t* loop, int timeout) { + struct pollfd events[1024]; + struct pollfd pqry; + struct pollfd* pe; + struct poll_ctl pc; + QUEUE* q; + uv__io_t* w; + uint64_t base; + uint64_t diff; + int nevents; + int count; + int nfds; + int i; + int rc; + int add_failed; + + if (loop->nfds == 0) { + assert(QUEUE_EMPTY(&loop->watcher_queue)); + return; + } + + while (!QUEUE_EMPTY(&loop->watcher_queue)) { + q = QUEUE_HEAD(&loop->watcher_queue); + QUEUE_REMOVE(q); + QUEUE_INIT(q); + + w = QUEUE_DATA(q, uv__io_t, watcher_queue); + assert(w->pevents != 0); + assert(w->fd >= 0); + assert(w->fd < (int) loop->nwatchers); + + pc.events = w->pevents; + pc.fd = w->fd; + + add_failed = 0; + if (w->events == 0) { + pc.cmd = PS_ADD; + if (pollset_ctl(loop->backend_fd, &pc, 1)) { + if (errno != EINVAL) { + assert(0 && "Failed to add file descriptor (pc.fd) to pollset"); + abort(); + } + /* Check if the fd is already in the pollset */ + pqry.fd = pc.fd; + rc = pollset_query(loop->backend_fd, &pqry); + switch (rc) { + case -1: + assert(0 && "Failed to query pollset for file descriptor"); + abort(); + case 0: + assert(0 && "Pollset does not contain file descriptor"); + abort(); + } + /* If we got here then the pollset already contained the file descriptor even though + * we didn't think it should. This probably shouldn't happen, but we can continue. */ + add_failed = 1; + } + } + if (w->events != 0 || add_failed) { + /* Modify, potentially removing events -- need to delete then add. + * Could maybe mod if we knew for sure no events are removed, but + * content of w->events is handled above as not reliable (falls back) + * so may require a pollset_query() which would have to be pretty cheap + * compared to a PS_DELETE to be worth optimizing. Alternatively, could + * lazily remove events, squelching them in the mean time. */ + pc.cmd = PS_DELETE; + if (pollset_ctl(loop->backend_fd, &pc, 1)) { + assert(0 && "Failed to delete file descriptor (pc.fd) from pollset"); + abort(); + } + pc.cmd = PS_ADD; + if (pollset_ctl(loop->backend_fd, &pc, 1)) { + assert(0 && "Failed to add file descriptor (pc.fd) to pollset"); + abort(); + } + } + + w->events = w->pevents; + } + + assert(timeout >= -1); + base = loop->time; + count = 48; /* Benchmarks suggest this gives the best throughput. */ + + for (;;) { + nfds = pollset_poll(loop->backend_fd, + events, + ARRAY_SIZE(events), + timeout); + + /* Update loop->time unconditionally. It's tempting to skip the update when + * timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the + * operating system didn't reschedule our process while in the syscall. + */ + SAVE_ERRNO(uv__update_time(loop)); + + if (nfds == 0) { + assert(timeout != -1); + return; + } + + if (nfds == -1) { + if (errno != EINTR) { + abort(); + } + + if (timeout == -1) + continue; + + if (timeout == 0) + return; + + /* Interrupted by a signal. Update timeout and poll again. */ + goto update_timeout; + } + + nevents = 0; + + assert(loop->watchers != NULL); + loop->watchers[loop->nwatchers] = (void*) events; + loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds; + + for (i = 0; i < nfds; i++) { + pe = events + i; + pc.cmd = PS_DELETE; + pc.fd = pe->fd; + + /* Skip invalidated events, see uv__platform_invalidate_fd */ + if (pc.fd == -1) + continue; + + assert(pc.fd >= 0); + assert((unsigned) pc.fd < loop->nwatchers); + + w = loop->watchers[pc.fd]; + + if (w == NULL) { + /* File descriptor that we've stopped watching, disarm it. + * + * Ignore all errors because we may be racing with another thread + * when the file descriptor is closed. + */ + pollset_ctl(loop->backend_fd, &pc, 1); + continue; + } + + w->cb(loop, w, pe->revents); + nevents++; + } + + loop->watchers[loop->nwatchers] = NULL; + loop->watchers[loop->nwatchers + 1] = NULL; + + if (nevents != 0) { + if (nfds == ARRAY_SIZE(events) && --count != 0) { + /* Poll for more events but don't block this time. */ + timeout = 0; + continue; + } + return; + } + + if (timeout == 0) + return; + + if (timeout == -1) + continue; + +update_timeout: + assert(timeout > 0); + + diff = loop->time - base; + if (diff >= (uint64_t) timeout) + return; + + timeout -= diff; + } +} + + +uint64_t uv__hrtime(uv_clocktype_t type) { + uint64_t G = 1000000000; + timebasestruct_t t; + read_wall_time(&t, TIMEBASE_SZ); + time_base_to_time(&t, TIMEBASE_SZ); + return (uint64_t) t.tb_high * G + t.tb_low; +} + + +/* + * We could use a static buffer for the path manipulations that we need outside + * of the function, but this function could be called by multiple consumers and + * we don't want to potentially create a race condition in the use of snprintf. + * There is no direct way of getting the exe path in AIX - either through /procfs + * or through some libc APIs. The below approach is to parse the argv[0]'s pattern + * and use it in conjunction with PATH environment variable to craft one. + */ +int uv_exepath(char* buffer, size_t* size) { + int res; + char args[PATH_MAX]; + char abspath[PATH_MAX]; + size_t abspath_size; + struct procsinfo pi; + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + pi.pi_pid = getpid(); + res = getargs(&pi, sizeof(pi), args, sizeof(args)); + if (res < 0) + return -EINVAL; + + /* + * Possibilities for args: + * i) an absolute path such as: /home/user/myprojects/nodejs/node + * ii) a relative path such as: ./node or ../myprojects/nodejs/node + * iii) a bare filename such as "node", after exporting PATH variable + * to its location. + */ + + /* Case i) and ii) absolute or relative paths */ + if (strchr(args, '/') != NULL) { + if (realpath(args, abspath) != abspath) + return -errno; + + abspath_size = strlen(abspath); + + *size -= 1; + if (*size > abspath_size) + *size = abspath_size; + + memcpy(buffer, abspath, *size); + buffer[*size] = '\0'; + + return 0; + } else { + /* Case iii). Search PATH environment variable */ + char trypath[PATH_MAX]; + char *clonedpath = NULL; + char *token = NULL; + char *path = getenv("PATH"); + + if (path == NULL) + return -EINVAL; + + clonedpath = uv__strdup(path); + if (clonedpath == NULL) + return -ENOMEM; + + token = strtok(clonedpath, ":"); + while (token != NULL) { + snprintf(trypath, sizeof(trypath) - 1, "%s/%s", token, args); + if (realpath(trypath, abspath) == abspath) { + /* Check the match is executable */ + if (access(abspath, X_OK) == 0) { + abspath_size = strlen(abspath); + + *size -= 1; + if (*size > abspath_size) + *size = abspath_size; + + memcpy(buffer, abspath, *size); + buffer[*size] = '\0'; + + uv__free(clonedpath); + return 0; + } + } + token = strtok(NULL, ":"); + } + uv__free(clonedpath); + + /* Out of tokens (path entries), and no match found */ + return -EINVAL; + } +} + + +uint64_t uv_get_free_memory(void) { + perfstat_memory_total_t mem_total; + int result = perfstat_memory_total(NULL, &mem_total, sizeof(mem_total), 1); + if (result == -1) { + return 0; + } + return mem_total.real_free * 4096; +} + + +uint64_t uv_get_total_memory(void) { + perfstat_memory_total_t mem_total; + int result = perfstat_memory_total(NULL, &mem_total, sizeof(mem_total), 1); + if (result == -1) { + return 0; + } + return mem_total.real_total * 4096; +} + + +void uv_loadavg(double avg[3]) { + perfstat_cpu_total_t ps_total; + int result = perfstat_cpu_total(NULL, &ps_total, sizeof(ps_total), 1); + if (result == -1) { + avg[0] = 0.; avg[1] = 0.; avg[2] = 0.; + return; + } + avg[0] = ps_total.loadavg[0] / (double)(1 << SBITS); + avg[1] = ps_total.loadavg[1] / (double)(1 << SBITS); + avg[2] = ps_total.loadavg[2] / (double)(1 << SBITS); +} + + +#ifdef HAVE_SYS_AHAFS_EVPRODS_H +static char *uv__rawname(char *cp) { + static char rawbuf[FILENAME_MAX+1]; + char *dp = rindex(cp, '/'); + + if (dp == 0) + return 0; + + *dp = 0; + strcpy(rawbuf, cp); + *dp = '/'; + strcat(rawbuf, "/r"); + strcat(rawbuf, dp+1); + return rawbuf; +} + + +/* + * Determine whether given pathname is a directory + * Returns 0 if the path is a directory, -1 if not + * + * Note: Opportunity here for more detailed error information but + * that requires changing callers of this function as well + */ +static int uv__path_is_a_directory(char* filename) { + struct stat statbuf; + + if (stat(filename, &statbuf) < 0) + return -1; /* failed: not a directory, assume it is a file */ + + if (statbuf.st_type == VDIR) + return 0; + + return -1; +} + + +/* + * Check whether AHAFS is mounted. + * Returns 0 if AHAFS is mounted, or an error code < 0 on failure + */ +static int uv__is_ahafs_mounted(void){ + int rv, i = 2; + struct vmount *p; + int size_multiplier = 10; + size_t siz = sizeof(struct vmount)*size_multiplier; + struct vmount *vmt; + const char *dev = "/aha"; + char *obj, *stub; + + p = uv__malloc(siz); + if (p == NULL) + return -errno; + + /* Retrieve all mounted filesystems */ + rv = mntctl(MCTL_QUERY, siz, (char*)p); + if (rv < 0) + return -errno; + if (rv == 0) { + /* buffer was not large enough, reallocate to correct size */ + siz = *(int*)p; + uv__free(p); + p = uv__malloc(siz); + if (p == NULL) + return -errno; + rv = mntctl(MCTL_QUERY, siz, (char*)p); + if (rv < 0) + return -errno; + } + + /* Look for dev in filesystems mount info */ + for(vmt = p, i = 0; i < rv; i++) { + obj = vmt2dataptr(vmt, VMT_OBJECT); /* device */ + stub = vmt2dataptr(vmt, VMT_STUB); /* mount point */ + + if (EQ(obj, dev) || EQ(uv__rawname(obj), dev) || EQ(stub, dev)) { + uv__free(p); /* Found a match */ + return 0; + } + vmt = (struct vmount *) ((char *) vmt + vmt->vmt_length); + } + + /* /aha is required for monitoring filesystem changes */ + return -1; +} + +/* + * Recursive call to mkdir() to create intermediate folders, if any + * Returns code from mkdir call + */ +static int uv__makedir_p(const char *dir) { + char tmp[256]; + char *p = NULL; + size_t len; + int err; + + snprintf(tmp, sizeof(tmp),"%s",dir); + len = strlen(tmp); + if (tmp[len - 1] == '/') + tmp[len - 1] = 0; + for (p = tmp + 1; *p; p++) { + if (*p == '/') { + *p = 0; + err = mkdir(tmp, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + if(err != 0) + return err; + *p = '/'; + } + } + return mkdir(tmp, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); +} + +/* + * Creates necessary subdirectories in the AIX Event Infrastructure + * file system for monitoring the object specified. + * Returns code from mkdir call + */ +static int uv__make_subdirs_p(const char *filename) { + char cmd[2048]; + char *p; + int rc = 0; + + /* Strip off the monitor file name */ + p = strrchr(filename, '/'); + + if (p == NULL) + return 0; + + if (uv__path_is_a_directory((char*)filename) == 0) { + sprintf(cmd, "/aha/fs/modDir.monFactory"); + } else { + sprintf(cmd, "/aha/fs/modFile.monFactory"); + } + + strncat(cmd, filename, (p - filename)); + rc = uv__makedir_p(cmd); + + if (rc == -1 && errno != EEXIST){ + return -errno; + } + + return rc; +} + + +/* + * Checks if /aha is mounted, then proceeds to set up the monitoring + * objects for the specified file. + * Returns 0 on success, or an error code < 0 on failure + */ +static int uv__setup_ahafs(const char* filename, int *fd) { + int rc = 0; + char mon_file_write_string[RDWR_BUF_SIZE]; + char mon_file[PATH_MAX]; + int file_is_directory = 0; /* -1 == NO, 0 == YES */ + + /* Create monitor file name for object */ + file_is_directory = uv__path_is_a_directory((char*)filename); + + if (file_is_directory == 0) + sprintf(mon_file, "/aha/fs/modDir.monFactory"); + else + sprintf(mon_file, "/aha/fs/modFile.monFactory"); + + if ((strlen(mon_file) + strlen(filename) + 5) > PATH_MAX) + return -ENAMETOOLONG; + + /* Make the necessary subdirectories for the monitor file */ + rc = uv__make_subdirs_p(filename); + if (rc == -1 && errno != EEXIST) + return rc; + + strcat(mon_file, filename); + strcat(mon_file, ".mon"); + + *fd = 0; errno = 0; + + /* Open the monitor file, creating it if necessary */ + *fd = open(mon_file, O_CREAT|O_RDWR); + if (*fd < 0) + return -errno; + + /* Write out the monitoring specifications. + * In this case, we are monitoring for a state change event type + * CHANGED=YES + * We will be waiting in select call, rather than a read: + * WAIT_TYPE=WAIT_IN_SELECT + * We only want minimal information for files: + * INFO_LVL=1 + * For directories, we want more information to track what file + * caused the change + * INFO_LVL=2 + */ + + if (file_is_directory == 0) + sprintf(mon_file_write_string, "CHANGED=YES;WAIT_TYPE=WAIT_IN_SELECT;INFO_LVL=2"); + else + sprintf(mon_file_write_string, "CHANGED=YES;WAIT_TYPE=WAIT_IN_SELECT;INFO_LVL=1"); + + rc = write(*fd, mon_file_write_string, strlen(mon_file_write_string)+1); + if (rc < 0) + return -errno; + + return 0; +} + +/* + * Skips a specified number of lines in the buffer passed in. + * Walks the buffer pointed to by p and attempts to skip n lines. + * Returns the total number of lines skipped + */ +static int uv__skip_lines(char **p, int n) { + int lines = 0; + + while(n > 0) { + *p = strchr(*p, '\n'); + if (!p) + return lines; + + (*p)++; + n--; + lines++; + } + return lines; +} + + +/* + * Parse the event occurrence data to figure out what event just occurred + * and take proper action. + * + * The buf is a pointer to the buffer containing the event occurrence data + * Returns 0 on success, -1 if unrecoverable error in parsing + * + */ +static int uv__parse_data(char *buf, int *events, uv_fs_event_t* handle) { + int evp_rc, i; + char *p; + char filename[PATH_MAX]; /* To be used when handling directories */ + + p = buf; + *events = 0; + + /* Clean the filename buffer*/ + for(i = 0; i < PATH_MAX; i++) { + filename[i] = 0; + } + i = 0; + + /* Check for BUF_WRAP */ + if (strncmp(buf, "BUF_WRAP", strlen("BUF_WRAP")) == 0) { + assert(0 && "Buffer wrap detected, Some event occurrences lost!"); + return 0; + } + + /* Since we are using the default buffer size (4K), and have specified + * INFO_LVL=1, we won't see any EVENT_OVERFLOW conditions. Applications + * should check for this keyword if they are using an INFO_LVL of 2 or + * higher, and have a buffer size of <= 4K + */ + + /* Skip to RC_FROM_EVPROD */ + if (uv__skip_lines(&p, 9) != 9) + return -1; + + if (sscanf(p, "RC_FROM_EVPROD=%d\nEND_EVENT_DATA", &evp_rc) == 1) { + if (uv__path_is_a_directory(handle->path) == 0) { /* Directory */ + if (evp_rc == AHAFS_MODDIR_UNMOUNT || evp_rc == AHAFS_MODDIR_REMOVE_SELF) { + /* The directory is no longer available for monitoring */ + *events = UV_RENAME; + handle->dir_filename = NULL; + } else { + /* A file was added/removed inside the directory */ + *events = UV_CHANGE; + + /* Get the EVPROD_INFO */ + if (uv__skip_lines(&p, 1) != 1) + return -1; + + /* Scan out the name of the file that triggered the event*/ + if (sscanf(p, "BEGIN_EVPROD_INFO\n%sEND_EVPROD_INFO", filename) == 1) { + handle->dir_filename = uv__strdup((const char*)&filename); + } else + return -1; + } + } else { /* Regular File */ + if (evp_rc == AHAFS_MODFILE_RENAME) + *events = UV_RENAME; + else + *events = UV_CHANGE; + } + } + else + return -1; + + return 0; +} + + +/* This is the internal callback */ +static void uv__ahafs_event(uv_loop_t* loop, uv__io_t* event_watch, unsigned int fflags) { + char result_data[RDWR_BUF_SIZE]; + int bytes, rc = 0; + uv_fs_event_t* handle; + int events = 0; + int i = 0; + char fname[PATH_MAX]; + char *p; + + handle = container_of(event_watch, uv_fs_event_t, event_watcher); + + /* Clean all the buffers*/ + for(i = 0; i < PATH_MAX; i++) { + fname[i] = 0; + } + i = 0; + + /* At this point, we assume that polling has been done on the + * file descriptor, so we can just read the AHAFS event occurrence + * data and parse its results without having to block anything + */ + bytes = pread(event_watch->fd, result_data, RDWR_BUF_SIZE, 0); + + assert((bytes <= 0) && "uv__ahafs_event - Error reading monitor file"); + + /* Parse the data */ + if(bytes > 0) + rc = uv__parse_data(result_data, &events, handle); + + /* For directory changes, the name of the files that triggered the change + * are never absolute pathnames + */ + if (uv__path_is_a_directory(handle->path) == 0) { + p = handle->dir_filename; + while(*p != NULL){ + fname[i]= *p; + i++; + p++; + } + } else { + /* For file changes, figure out whether filename is absolute or not */ + if (handle->path[0] == '/') { + p = strrchr(handle->path, '/'); + p++; + + while(*p != NULL) { + fname[i]= *p; + i++; + p++; + } + } + } + + /* Unrecoverable error */ + if (rc == -1) + return; + else /* Call the actual JavaScript callback function */ + handle->cb(handle, (const char*)&fname, events, 0); +} +#endif + + +int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { +#ifdef HAVE_SYS_AHAFS_EVPRODS_H + uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT); + return 0; +#else + return -ENOSYS; +#endif +} + + +int uv_fs_event_start(uv_fs_event_t* handle, + uv_fs_event_cb cb, + const char* filename, + unsigned int flags) { +#ifdef HAVE_SYS_AHAFS_EVPRODS_H + int fd, rc, i = 0, res = 0; + char cwd[PATH_MAX]; + char absolute_path[PATH_MAX]; + char fname[PATH_MAX]; + char *p; + + /* Clean all the buffers*/ + for(i = 0; i < PATH_MAX; i++) { + cwd[i] = 0; + absolute_path[i] = 0; + fname[i] = 0; + } + i = 0; + + /* Figure out whether filename is absolute or not */ + if (filename[0] == '/') { + /* We have absolute pathname, create the relative pathname*/ + sprintf(absolute_path, filename); + p = strrchr(filename, '/'); + p++; + } else { + if (filename[0] == '.' && filename[1] == '/') { + /* We have a relative pathname, compose the absolute pathname */ + sprintf(fname, filename); + snprintf(cwd, PATH_MAX-1, "/proc/%lu/cwd", (unsigned long) getpid()); + res = readlink(cwd, absolute_path, sizeof(absolute_path) - 1); + if (res < 0) + return res; + p = strrchr(absolute_path, '/'); + p++; + p++; + } else { + /* We have a relative pathname, compose the absolute pathname */ + sprintf(fname, filename); + snprintf(cwd, PATH_MAX-1, "/proc/%lu/cwd", (unsigned long) getpid()); + res = readlink(cwd, absolute_path, sizeof(absolute_path) - 1); + if (res < 0) + return res; + p = strrchr(absolute_path, '/'); + p++; + } + /* Copy to filename buffer */ + while(filename[i] != NULL) { + *p = filename[i]; + i++; + p++; + } + } + + if (uv__is_ahafs_mounted() < 0) /* /aha checks failed */ + return UV_ENOSYS; + + /* Setup ahafs */ + rc = uv__setup_ahafs((const char *)absolute_path, &fd); + if (rc != 0) + return rc; + + /* Setup/Initialize all the libuv routines */ + uv__handle_start(handle); + uv__io_init(&handle->event_watcher, uv__ahafs_event, fd); + handle->path = uv__strdup((const char*)&absolute_path); + handle->cb = cb; + + uv__io_start(handle->loop, &handle->event_watcher, UV__POLLIN); + + return 0; +#else + return -ENOSYS; +#endif +} + + +int uv_fs_event_stop(uv_fs_event_t* handle) { +#ifdef HAVE_SYS_AHAFS_EVPRODS_H + if (!uv__is_active(handle)) + return 0; + + uv__io_close(handle->loop, &handle->event_watcher); + uv__handle_stop(handle); + + if (uv__path_is_a_directory(handle->path) == 0) { + uv__free(handle->dir_filename); + handle->dir_filename = NULL; + } + + uv__free(handle->path); + handle->path = NULL; + uv__close(handle->event_watcher.fd); + handle->event_watcher.fd = -1; + + return 0; +#else + return -ENOSYS; +#endif +} + + +void uv__fs_event_close(uv_fs_event_t* handle) { +#ifdef HAVE_SYS_AHAFS_EVPRODS_H + uv_fs_event_stop(handle); +#else + UNREACHABLE(); +#endif +} + + +char** uv_setup_args(int argc, char** argv) { + return argv; +} + + +int uv_set_process_title(const char* title) { + return 0; +} + + +int uv_get_process_title(char* buffer, size_t size) { + if (size > 0) { + buffer[0] = '\0'; + } + return 0; +} + + +int uv_resident_set_memory(size_t* rss) { + char pp[64]; + psinfo_t psinfo; + int err; + int fd; + + snprintf(pp, sizeof(pp), "/proc/%lu/psinfo", (unsigned long) getpid()); + + fd = open(pp, O_RDONLY); + if (fd == -1) + return -errno; + + /* FIXME(bnoordhuis) Handle EINTR. */ + err = -EINVAL; + if (read(fd, &psinfo, sizeof(psinfo)) == sizeof(psinfo)) { + *rss = (size_t)psinfo.pr_rssize * 1024; + err = 0; + } + uv__close(fd); + + return err; +} + + +int uv_uptime(double* uptime) { + struct utmp *utmp_buf; + size_t entries = 0; + time_t boot_time; + + utmpname(UTMP_FILE); + + setutent(); + + while ((utmp_buf = getutent()) != NULL) { + if (utmp_buf->ut_user[0] && utmp_buf->ut_type == USER_PROCESS) + ++entries; + if (utmp_buf->ut_type == BOOT_TIME) + boot_time = utmp_buf->ut_time; + } + + endutent(); + + if (boot_time == 0) + return -ENOSYS; + + *uptime = time(NULL) - boot_time; + return 0; +} + + +int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { + uv_cpu_info_t* cpu_info; + perfstat_cpu_total_t ps_total; + perfstat_cpu_t* ps_cpus; + perfstat_id_t cpu_id; + int result, ncpus, idx = 0; + + result = perfstat_cpu_total(NULL, &ps_total, sizeof(ps_total), 1); + if (result == -1) { + return -ENOSYS; + } + + ncpus = result = perfstat_cpu(NULL, NULL, sizeof(perfstat_cpu_t), 0); + if (result == -1) { + return -ENOSYS; + } + + ps_cpus = (perfstat_cpu_t*) uv__malloc(ncpus * sizeof(perfstat_cpu_t)); + if (!ps_cpus) { + return -ENOMEM; + } + + strcpy(cpu_id.name, FIRST_CPU); + result = perfstat_cpu(&cpu_id, ps_cpus, sizeof(perfstat_cpu_t), ncpus); + if (result == -1) { + uv__free(ps_cpus); + return -ENOSYS; + } + + *cpu_infos = (uv_cpu_info_t*) uv__malloc(ncpus * sizeof(uv_cpu_info_t)); + if (!*cpu_infos) { + uv__free(ps_cpus); + return -ENOMEM; + } + + *count = ncpus; + + cpu_info = *cpu_infos; + while (idx < ncpus) { + cpu_info->speed = (int)(ps_total.processorHZ / 1000000); + cpu_info->model = uv__strdup(ps_total.description); + cpu_info->cpu_times.user = ps_cpus[idx].user; + cpu_info->cpu_times.sys = ps_cpus[idx].sys; + cpu_info->cpu_times.idle = ps_cpus[idx].idle; + cpu_info->cpu_times.irq = ps_cpus[idx].wait; + cpu_info->cpu_times.nice = 0; + cpu_info++; + idx++; + } + + uv__free(ps_cpus); + return 0; +} + + +void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { + int i; + + for (i = 0; i < count; ++i) { + uv__free(cpu_infos[i].model); + } + + uv__free(cpu_infos); +} + + +int uv_interface_addresses(uv_interface_address_t** addresses, + int* count) { + uv_interface_address_t* address; + int sockfd, size = 1; + struct ifconf ifc; + struct ifreq *ifr, *p, flg; + + *count = 0; + + if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) { + return -errno; + } + + if (ioctl(sockfd, SIOCGSIZIFCONF, &size) == -1) { + SAVE_ERRNO(uv__close(sockfd)); + return -errno; + } + + ifc.ifc_req = (struct ifreq*)uv__malloc(size); + ifc.ifc_len = size; + if (ioctl(sockfd, SIOCGIFCONF, &ifc) == -1) { + SAVE_ERRNO(uv__close(sockfd)); + return -errno; + } + +#define ADDR_SIZE(p) MAX((p).sa_len, sizeof(p)) + + /* Count all up and running ipv4/ipv6 addresses */ + ifr = ifc.ifc_req; + while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { + p = ifr; + ifr = (struct ifreq*) + ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); + + if (!(p->ifr_addr.sa_family == AF_INET6 || + p->ifr_addr.sa_family == AF_INET)) + continue; + + memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name)); + if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) { + SAVE_ERRNO(uv__close(sockfd)); + return -errno; + } + + if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING)) + continue; + + (*count)++; + } + + /* Alloc the return interface structs */ + *addresses = (uv_interface_address_t*) + uv__malloc(*count * sizeof(uv_interface_address_t)); + if (!(*addresses)) { + uv__close(sockfd); + return -ENOMEM; + } + address = *addresses; + + ifr = ifc.ifc_req; + while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { + p = ifr; + ifr = (struct ifreq*) + ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); + + if (!(p->ifr_addr.sa_family == AF_INET6 || + p->ifr_addr.sa_family == AF_INET)) + continue; + + memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name)); + if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) { + uv__close(sockfd); + return -ENOSYS; + } + + if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING)) + continue; + + /* All conditions above must match count loop */ + + address->name = uv__strdup(p->ifr_name); + + if (p->ifr_addr.sa_family == AF_INET6) { + address->address.address6 = *((struct sockaddr_in6*) &p->ifr_addr); + } else { + address->address.address4 = *((struct sockaddr_in*) &p->ifr_addr); + } + + /* TODO: Retrieve netmask using SIOCGIFNETMASK ioctl */ + + address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0; + + address++; + } + +#undef ADDR_SIZE + + uv__close(sockfd); + return 0; +} + + +void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count) { + int i; + + for (i = 0; i < count; ++i) { + uv__free(addresses[i].name); + } + + uv__free(addresses); +} + +void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { + struct pollfd* events; + uintptr_t i; + uintptr_t nfds; + struct poll_ctl pc; + + assert(loop->watchers != NULL); + + events = (struct pollfd*) loop->watchers[loop->nwatchers]; + nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1]; + + if (events != NULL) + /* Invalidate events with same file descriptor */ + for (i = 0; i < nfds; i++) + if ((int) events[i].fd == fd) + events[i].fd = -1; + + /* Remove the file descriptor from the poll set */ + pc.events = 0; + pc.cmd = PS_DELETE; + pc.fd = fd; + if(loop->backend_fd >= 0) + pollset_ctl(loop->backend_fd, &pc, 1); +} diff --git a/3rdparty/libuv/src/unix/android-ifaddrs.c b/3rdparty/libuv/src/unix/android-ifaddrs.c new file mode 100644 index 00000000000..30f681b7d04 --- /dev/null +++ b/3rdparty/libuv/src/unix/android-ifaddrs.c @@ -0,0 +1,703 @@ +/* +Copyright (c) 2013, Kenneth MacKay +Copyright (c) 2014, Emergya (Cloud4all, FP7/2007-2013 grant agreement #289016) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "android-ifaddrs.h" +#include "uv-common.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef struct NetlinkList +{ + struct NetlinkList *m_next; + struct nlmsghdr *m_data; + unsigned int m_size; +} NetlinkList; + +static int netlink_socket(void) +{ + struct sockaddr_nl l_addr; + + int l_socket = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); + if(l_socket < 0) + { + return -1; + } + + memset(&l_addr, 0, sizeof(l_addr)); + l_addr.nl_family = AF_NETLINK; + if(bind(l_socket, (struct sockaddr *)&l_addr, sizeof(l_addr)) < 0) + { + close(l_socket); + return -1; + } + + return l_socket; +} + +static int netlink_send(int p_socket, int p_request) +{ + char l_buffer[NLMSG_ALIGN(sizeof(struct nlmsghdr)) + NLMSG_ALIGN(sizeof(struct rtgenmsg))]; + + struct nlmsghdr *l_hdr; + struct rtgenmsg *l_msg; + struct sockaddr_nl l_addr; + + memset(l_buffer, 0, sizeof(l_buffer)); + + l_hdr = (struct nlmsghdr *)l_buffer; + l_msg = (struct rtgenmsg *)NLMSG_DATA(l_hdr); + + l_hdr->nlmsg_len = NLMSG_LENGTH(sizeof(*l_msg)); + l_hdr->nlmsg_type = p_request; + l_hdr->nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; + l_hdr->nlmsg_pid = 0; + l_hdr->nlmsg_seq = p_socket; + l_msg->rtgen_family = AF_UNSPEC; + + memset(&l_addr, 0, sizeof(l_addr)); + l_addr.nl_family = AF_NETLINK; + return (sendto(p_socket, l_hdr, l_hdr->nlmsg_len, 0, (struct sockaddr *)&l_addr, sizeof(l_addr))); +} + +static int netlink_recv(int p_socket, void *p_buffer, size_t p_len) +{ + struct sockaddr_nl l_addr; + struct msghdr l_msg; + + struct iovec l_iov; + l_iov.iov_base = p_buffer; + l_iov.iov_len = p_len; + + for(;;) + { + int l_result; + l_msg.msg_name = (void *)&l_addr; + l_msg.msg_namelen = sizeof(l_addr); + l_msg.msg_iov = &l_iov; + l_msg.msg_iovlen = 1; + l_msg.msg_control = NULL; + l_msg.msg_controllen = 0; + l_msg.msg_flags = 0; + l_result = recvmsg(p_socket, &l_msg, 0); + + if(l_result < 0) + { + if(errno == EINTR) + { + continue; + } + return -2; + } + + /* Buffer was too small */ + if(l_msg.msg_flags & MSG_TRUNC) + { + return -1; + } + return l_result; + } +} + +static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_done) +{ + size_t l_size = 4096; + void *l_buffer = NULL; + + for(;;) + { + int l_read; + + uv__free(l_buffer); + l_buffer = uv__malloc(l_size); + if (l_buffer == NULL) + { + return NULL; + } + + l_read = netlink_recv(p_socket, l_buffer, l_size); + *p_size = l_read; + if(l_read == -2) + { + uv__free(l_buffer); + return NULL; + } + if(l_read >= 0) + { + pid_t l_pid = getpid(); + struct nlmsghdr *l_hdr; + for(l_hdr = (struct nlmsghdr *)l_buffer; NLMSG_OK(l_hdr, (unsigned int)l_read); l_hdr = (struct nlmsghdr *)NLMSG_NEXT(l_hdr, l_read)) + { + if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) + { + continue; + } + + if(l_hdr->nlmsg_type == NLMSG_DONE) + { + *p_done = 1; + break; + } + + if(l_hdr->nlmsg_type == NLMSG_ERROR) + { + uv__free(l_buffer); + return NULL; + } + } + return l_buffer; + } + + l_size *= 2; + } +} + +static NetlinkList *newListItem(struct nlmsghdr *p_data, unsigned int p_size) +{ + NetlinkList *l_item = uv__malloc(sizeof(NetlinkList)); + if (l_item == NULL) + { + return NULL; + } + + l_item->m_next = NULL; + l_item->m_data = p_data; + l_item->m_size = p_size; + return l_item; +} + +static void freeResultList(NetlinkList *p_list) +{ + NetlinkList *l_cur; + while(p_list) + { + l_cur = p_list; + p_list = p_list->m_next; + uv__free(l_cur->m_data); + uv__free(l_cur); + } +} + +static NetlinkList *getResultList(int p_socket, int p_request) +{ + int l_size; + int l_done; + NetlinkList *l_list; + NetlinkList *l_end; + + if(netlink_send(p_socket, p_request) < 0) + { + return NULL; + } + + l_list = NULL; + l_end = NULL; + + l_done = 0; + while(!l_done) + { + NetlinkList *l_item; + + struct nlmsghdr *l_hdr = getNetlinkResponse(p_socket, &l_size, &l_done); + /* Error */ + if(!l_hdr) + { + freeResultList(l_list); + return NULL; + } + + l_item = newListItem(l_hdr, l_size); + if (!l_item) + { + freeResultList(l_list); + return NULL; + } + if(!l_list) + { + l_list = l_item; + } + else + { + l_end->m_next = l_item; + } + l_end = l_item; + } + return l_list; +} + +static size_t maxSize(size_t a, size_t b) +{ + return (a > b ? a : b); +} + +static size_t calcAddrLen(sa_family_t p_family, int p_dataSize) +{ + switch(p_family) + { + case AF_INET: + return sizeof(struct sockaddr_in); + case AF_INET6: + return sizeof(struct sockaddr_in6); + case AF_PACKET: + return maxSize(sizeof(struct sockaddr_ll), offsetof(struct sockaddr_ll, sll_addr) + p_dataSize); + default: + return maxSize(sizeof(struct sockaddr), offsetof(struct sockaddr, sa_data) + p_dataSize); + } +} + +static void makeSockaddr(sa_family_t p_family, struct sockaddr *p_dest, void *p_data, size_t p_size) +{ + switch(p_family) + { + case AF_INET: + memcpy(&((struct sockaddr_in*)p_dest)->sin_addr, p_data, p_size); + break; + case AF_INET6: + memcpy(&((struct sockaddr_in6*)p_dest)->sin6_addr, p_data, p_size); + break; + case AF_PACKET: + memcpy(((struct sockaddr_ll*)p_dest)->sll_addr, p_data, p_size); + ((struct sockaddr_ll*)p_dest)->sll_halen = p_size; + break; + default: + memcpy(p_dest->sa_data, p_data, p_size); + break; + } + p_dest->sa_family = p_family; +} + +static void addToEnd(struct ifaddrs **p_resultList, struct ifaddrs *p_entry) +{ + if(!*p_resultList) + { + *p_resultList = p_entry; + } + else + { + struct ifaddrs *l_cur = *p_resultList; + while(l_cur->ifa_next) + { + l_cur = l_cur->ifa_next; + } + l_cur->ifa_next = p_entry; + } +} + +static int interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList) +{ + struct ifaddrs *l_entry; + + char *l_index; + char *l_name; + char *l_addr; + char *l_data; + + struct ifinfomsg *l_info = (struct ifinfomsg *)NLMSG_DATA(p_hdr); + + size_t l_nameSize = 0; + size_t l_addrSize = 0; + size_t l_dataSize = 0; + + size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg)); + struct rtattr *l_rta; + for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) + { + size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); + switch(l_rta->rta_type) + { + case IFLA_ADDRESS: + case IFLA_BROADCAST: + l_addrSize += NLMSG_ALIGN(calcAddrLen(AF_PACKET, l_rtaDataSize)); + break; + case IFLA_IFNAME: + l_nameSize += NLMSG_ALIGN(l_rtaSize + 1); + break; + case IFLA_STATS: + l_dataSize += NLMSG_ALIGN(l_rtaSize); + break; + default: + break; + } + } + + l_entry = uv__malloc(sizeof(struct ifaddrs) + sizeof(int) + l_nameSize + l_addrSize + l_dataSize); + if (l_entry == NULL) + { + return -1; + } + memset(l_entry, 0, sizeof(struct ifaddrs)); + l_entry->ifa_name = ""; + + l_index = ((char *)l_entry) + sizeof(struct ifaddrs); + l_name = l_index + sizeof(int); + l_addr = l_name + l_nameSize; + l_data = l_addr + l_addrSize; + + /* Save the interface index so we can look it up when handling the + * addresses. + */ + memcpy(l_index, &l_info->ifi_index, sizeof(int)); + + l_entry->ifa_flags = l_info->ifi_flags; + + l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg)); + for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) + { + void *l_rtaData = RTA_DATA(l_rta); + size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); + switch(l_rta->rta_type) + { + case IFLA_ADDRESS: + case IFLA_BROADCAST: + { + size_t l_addrLen = calcAddrLen(AF_PACKET, l_rtaDataSize); + makeSockaddr(AF_PACKET, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize); + ((struct sockaddr_ll *)l_addr)->sll_ifindex = l_info->ifi_index; + ((struct sockaddr_ll *)l_addr)->sll_hatype = l_info->ifi_type; + if(l_rta->rta_type == IFLA_ADDRESS) + { + l_entry->ifa_addr = (struct sockaddr *)l_addr; + } + else + { + l_entry->ifa_broadaddr = (struct sockaddr *)l_addr; + } + l_addr += NLMSG_ALIGN(l_addrLen); + break; + } + case IFLA_IFNAME: + strncpy(l_name, l_rtaData, l_rtaDataSize); + l_name[l_rtaDataSize] = '\0'; + l_entry->ifa_name = l_name; + break; + case IFLA_STATS: + memcpy(l_data, l_rtaData, l_rtaDataSize); + l_entry->ifa_data = l_data; + break; + default: + break; + } + } + + addToEnd(p_resultList, l_entry); + return 0; +} + +static struct ifaddrs *findInterface(int p_index, struct ifaddrs **p_links, int p_numLinks) +{ + int l_num = 0; + struct ifaddrs *l_cur = *p_links; + while(l_cur && l_num < p_numLinks) + { + char *l_indexPtr = ((char *)l_cur) + sizeof(struct ifaddrs); + int l_index; + memcpy(&l_index, l_indexPtr, sizeof(int)); + if(l_index == p_index) + { + return l_cur; + } + + l_cur = l_cur->ifa_next; + ++l_num; + } + return NULL; +} + +static int interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList, int p_numLinks) +{ + struct ifaddrmsg *l_info = (struct ifaddrmsg *)NLMSG_DATA(p_hdr); + struct ifaddrs *l_interface = findInterface(l_info->ifa_index, p_resultList, p_numLinks); + + size_t l_nameSize = 0; + size_t l_addrSize = 0; + + int l_addedNetmask = 0; + + size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg)); + struct rtattr *l_rta; + struct ifaddrs *l_entry; + + char *l_name; + char *l_addr; + + for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) + { + size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); + if(l_info->ifa_family == AF_PACKET) + { + continue; + } + + switch(l_rta->rta_type) + { + case IFA_ADDRESS: + case IFA_LOCAL: + if((l_info->ifa_family == AF_INET || l_info->ifa_family == AF_INET6) && !l_addedNetmask) + { + /* Make room for netmask */ + l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize)); + l_addedNetmask = 1; + } + case IFA_BROADCAST: + l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize)); + break; + case IFA_LABEL: + l_nameSize += NLMSG_ALIGN(l_rtaSize + 1); + break; + default: + break; + } + } + + l_entry = uv__malloc(sizeof(struct ifaddrs) + l_nameSize + l_addrSize); + if (l_entry == NULL) + { + return -1; + } + memset(l_entry, 0, sizeof(struct ifaddrs)); + l_entry->ifa_name = (l_interface ? l_interface->ifa_name : ""); + + l_name = ((char *)l_entry) + sizeof(struct ifaddrs); + l_addr = l_name + l_nameSize; + + l_entry->ifa_flags = l_info->ifa_flags; + if(l_interface) + { + l_entry->ifa_flags |= l_interface->ifa_flags; + } + + l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg)); + for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) + { + void *l_rtaData = RTA_DATA(l_rta); + size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); + switch(l_rta->rta_type) + { + case IFA_ADDRESS: + case IFA_BROADCAST: + case IFA_LOCAL: + { + size_t l_addrLen = calcAddrLen(l_info->ifa_family, l_rtaDataSize); + makeSockaddr(l_info->ifa_family, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize); + if(l_info->ifa_family == AF_INET6) + { + if(IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)l_rtaData) || IN6_IS_ADDR_MC_LINKLOCAL((struct in6_addr *)l_rtaData)) + { + ((struct sockaddr_in6 *)l_addr)->sin6_scope_id = l_info->ifa_index; + } + } + + /* Apparently in a point-to-point network IFA_ADDRESS contains + * the dest address and IFA_LOCAL contains the local address + */ + if(l_rta->rta_type == IFA_ADDRESS) + { + if(l_entry->ifa_addr) + { + l_entry->ifa_dstaddr = (struct sockaddr *)l_addr; + } + else + { + l_entry->ifa_addr = (struct sockaddr *)l_addr; + } + } + else if(l_rta->rta_type == IFA_LOCAL) + { + if(l_entry->ifa_addr) + { + l_entry->ifa_dstaddr = l_entry->ifa_addr; + } + l_entry->ifa_addr = (struct sockaddr *)l_addr; + } + else + { + l_entry->ifa_broadaddr = (struct sockaddr *)l_addr; + } + l_addr += NLMSG_ALIGN(l_addrLen); + break; + } + case IFA_LABEL: + strncpy(l_name, l_rtaData, l_rtaDataSize); + l_name[l_rtaDataSize] = '\0'; + l_entry->ifa_name = l_name; + break; + default: + break; + } + } + + if(l_entry->ifa_addr && (l_entry->ifa_addr->sa_family == AF_INET || l_entry->ifa_addr->sa_family == AF_INET6)) + { + unsigned l_maxPrefix = (l_entry->ifa_addr->sa_family == AF_INET ? 32 : 128); + unsigned l_prefix = (l_info->ifa_prefixlen > l_maxPrefix ? l_maxPrefix : l_info->ifa_prefixlen); + char l_mask[16] = {0}; + unsigned i; + for(i=0; i<(l_prefix/8); ++i) + { + l_mask[i] = 0xff; + } + if(l_prefix % 8) + { + l_mask[i] = 0xff << (8 - (l_prefix % 8)); + } + + makeSockaddr(l_entry->ifa_addr->sa_family, (struct sockaddr *)l_addr, l_mask, l_maxPrefix / 8); + l_entry->ifa_netmask = (struct sockaddr *)l_addr; + } + + addToEnd(p_resultList, l_entry); + return 0; +} + +static int interpretLinks(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs **p_resultList) +{ + + int l_numLinks = 0; + pid_t l_pid = getpid(); + for(; p_netlinkList; p_netlinkList = p_netlinkList->m_next) + { + unsigned int l_nlsize = p_netlinkList->m_size; + struct nlmsghdr *l_hdr; + for(l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize)) + { + if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) + { + continue; + } + + if(l_hdr->nlmsg_type == NLMSG_DONE) + { + break; + } + + if(l_hdr->nlmsg_type == RTM_NEWLINK) + { + if(interpretLink(l_hdr, p_resultList) == -1) + { + return -1; + } + ++l_numLinks; + } + } + } + return l_numLinks; +} + +static int interpretAddrs(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs **p_resultList, int p_numLinks) +{ + pid_t l_pid = getpid(); + for(; p_netlinkList; p_netlinkList = p_netlinkList->m_next) + { + unsigned int l_nlsize = p_netlinkList->m_size; + struct nlmsghdr *l_hdr; + for(l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize)) + { + if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) + { + continue; + } + + if(l_hdr->nlmsg_type == NLMSG_DONE) + { + break; + } + + if(l_hdr->nlmsg_type == RTM_NEWADDR) + { + if (interpretAddr(l_hdr, p_resultList, p_numLinks) == -1) + { + return -1; + } + } + } + } + return 0; +} + +int getifaddrs(struct ifaddrs **ifap) +{ + int l_socket; + int l_result; + int l_numLinks; + NetlinkList *l_linkResults; + NetlinkList *l_addrResults; + + if(!ifap) + { + return -1; + } + *ifap = NULL; + + l_socket = netlink_socket(); + if(l_socket < 0) + { + return -1; + } + + l_linkResults = getResultList(l_socket, RTM_GETLINK); + if(!l_linkResults) + { + close(l_socket); + return -1; + } + + l_addrResults = getResultList(l_socket, RTM_GETADDR); + if(!l_addrResults) + { + close(l_socket); + freeResultList(l_linkResults); + return -1; + } + + l_result = 0; + l_numLinks = interpretLinks(l_socket, l_linkResults, ifap); + if(l_numLinks == -1 || interpretAddrs(l_socket, l_addrResults, ifap, l_numLinks) == -1) + { + l_result = -1; + } + + freeResultList(l_linkResults); + freeResultList(l_addrResults); + close(l_socket); + return l_result; +} + +void freeifaddrs(struct ifaddrs *ifa) +{ + struct ifaddrs *l_cur; + while(ifa) + { + l_cur = ifa; + ifa = ifa->ifa_next; + uv__free(l_cur); + } +} diff --git a/3rdparty/libuv/src/unix/async.c b/3rdparty/libuv/src/unix/async.c new file mode 100644 index 00000000000..184b598126e --- /dev/null +++ b/3rdparty/libuv/src/unix/async.c @@ -0,0 +1,290 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* This file contains both the uv__async internal infrastructure and the + * user-facing uv_async_t functions. + */ + +#include "uv.h" +#include "internal.h" +#include "atomic-ops.h" + +#include +#include /* snprintf() */ +#include +#include +#include +#include + +static void uv__async_event(uv_loop_t* loop, + struct uv__async* w, + unsigned int nevents); +static int uv__async_eventfd(void); + + +int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) { + int err; + + err = uv__async_start(loop, &loop->async_watcher, uv__async_event); + if (err) + return err; + + uv__handle_init(loop, (uv_handle_t*)handle, UV_ASYNC); + handle->async_cb = async_cb; + handle->pending = 0; + + QUEUE_INSERT_TAIL(&loop->async_handles, &handle->queue); + uv__handle_start(handle); + + return 0; +} + + +int uv_async_send(uv_async_t* handle) { + /* Do a cheap read first. */ + if (ACCESS_ONCE(int, handle->pending) != 0) + return 0; + + if (cmpxchgi(&handle->pending, 0, 1) == 0) + uv__async_send(&handle->loop->async_watcher); + + return 0; +} + + +void uv__async_close(uv_async_t* handle) { + QUEUE_REMOVE(&handle->queue); + uv__handle_stop(handle); +} + + +static void uv__async_event(uv_loop_t* loop, + struct uv__async* w, + unsigned int nevents) { + QUEUE queue; + QUEUE* q; + uv_async_t* h; + + QUEUE_MOVE(&loop->async_handles, &queue); + while (!QUEUE_EMPTY(&queue)) { + q = QUEUE_HEAD(&queue); + h = QUEUE_DATA(q, uv_async_t, queue); + + QUEUE_REMOVE(q); + QUEUE_INSERT_TAIL(&loop->async_handles, q); + + if (cmpxchgi(&h->pending, 1, 0) == 0) + continue; + + if (h->async_cb == NULL) + continue; + h->async_cb(h); + } +} + + +static void uv__async_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { + struct uv__async* wa; + char buf[1024]; + unsigned n; + ssize_t r; + + n = 0; + for (;;) { + r = read(w->fd, buf, sizeof(buf)); + + if (r > 0) + n += r; + + if (r == sizeof(buf)) + continue; + + if (r != -1) + break; + + if (errno == EAGAIN || errno == EWOULDBLOCK) + break; + + if (errno == EINTR) + continue; + + abort(); + } + + wa = container_of(w, struct uv__async, io_watcher); + +#if defined(__linux__) + if (wa->wfd == -1) { + uint64_t val; + assert(n == sizeof(val)); + memcpy(&val, buf, sizeof(val)); /* Avoid alignment issues. */ + wa->cb(loop, wa, val); + return; + } +#endif + + wa->cb(loop, wa, n); +} + + +void uv__async_send(struct uv__async* wa) { + const void* buf; + ssize_t len; + int fd; + int r; + + buf = ""; + len = 1; + fd = wa->wfd; + +#if defined(__linux__) + if (fd == -1) { + static const uint64_t val = 1; + buf = &val; + len = sizeof(val); + fd = wa->io_watcher.fd; /* eventfd */ + } +#endif + + do + r = write(fd, buf, len); + while (r == -1 && errno == EINTR); + + if (r == len) + return; + + if (r == -1) + if (errno == EAGAIN || errno == EWOULDBLOCK) + return; + + abort(); +} + + +void uv__async_init(struct uv__async* wa) { + wa->io_watcher.fd = -1; + wa->wfd = -1; +} + + +int uv__async_start(uv_loop_t* loop, struct uv__async* wa, uv__async_cb cb) { + int pipefd[2]; + int err; + + if (wa->io_watcher.fd != -1) + return 0; + + err = uv__async_eventfd(); + if (err >= 0) { + pipefd[0] = err; + pipefd[1] = -1; + } + else if (err == -ENOSYS) { + err = uv__make_pipe(pipefd, UV__F_NONBLOCK); +#if defined(__linux__) + /* Save a file descriptor by opening one of the pipe descriptors as + * read/write through the procfs. That file descriptor can then + * function as both ends of the pipe. + */ + if (err == 0) { + char buf[32]; + int fd; + + snprintf(buf, sizeof(buf), "/proc/self/fd/%d", pipefd[0]); + fd = uv__open_cloexec(buf, O_RDWR); + if (fd >= 0) { + uv__close(pipefd[0]); + uv__close(pipefd[1]); + pipefd[0] = fd; + pipefd[1] = fd; + } + } +#endif + } + + if (err < 0) + return err; + + uv__io_init(&wa->io_watcher, uv__async_io, pipefd[0]); + uv__io_start(loop, &wa->io_watcher, UV__POLLIN); + wa->wfd = pipefd[1]; + wa->cb = cb; + + return 0; +} + + +void uv__async_stop(uv_loop_t* loop, struct uv__async* wa) { + if (wa->io_watcher.fd == -1) + return; + + if (wa->wfd != -1) { + if (wa->wfd != wa->io_watcher.fd) + uv__close(wa->wfd); + wa->wfd = -1; + } + + uv__io_stop(loop, &wa->io_watcher, UV__POLLIN); + uv__close(wa->io_watcher.fd); + wa->io_watcher.fd = -1; +} + + +static int uv__async_eventfd() { +#if defined(__linux__) + static int no_eventfd2; + static int no_eventfd; + int fd; + + if (no_eventfd2) + goto skip_eventfd2; + + fd = uv__eventfd2(0, UV__EFD_CLOEXEC | UV__EFD_NONBLOCK); + if (fd != -1) + return fd; + + if (errno != ENOSYS) + return -errno; + + no_eventfd2 = 1; + +skip_eventfd2: + + if (no_eventfd) + goto skip_eventfd; + + fd = uv__eventfd(0); + if (fd != -1) { + uv__cloexec(fd, 1); + uv__nonblock(fd, 1); + return fd; + } + + if (errno != ENOSYS) + return -errno; + + no_eventfd = 1; + +skip_eventfd: + +#endif + + return -ENOSYS; +} diff --git a/3rdparty/libuv/src/unix/atomic-ops.h b/3rdparty/libuv/src/unix/atomic-ops.h new file mode 100644 index 00000000000..84e471838be --- /dev/null +++ b/3rdparty/libuv/src/unix/atomic-ops.h @@ -0,0 +1,77 @@ +/* Copyright (c) 2013, Ben Noordhuis + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef UV_ATOMIC_OPS_H_ +#define UV_ATOMIC_OPS_H_ + +#include "internal.h" /* UV_UNUSED */ + +#if defined(__SUNPRO_C) || defined(__SUNPRO_CC) +#include +#define __sync_val_compare_and_swap(p, o, n) atomic_cas_ptr(p, o, n) +#endif + +UV_UNUSED(static int cmpxchgi(int* ptr, int oldval, int newval)); +UV_UNUSED(static long cmpxchgl(long* ptr, long oldval, long newval)); +UV_UNUSED(static void cpu_relax(void)); + +/* Prefer hand-rolled assembly over the gcc builtins because the latter also + * issue full memory barriers. + */ +UV_UNUSED(static int cmpxchgi(int* ptr, int oldval, int newval)) { +#if defined(__i386__) || defined(__x86_64__) + int out; + __asm__ __volatile__ ("lock; cmpxchg %2, %1;" + : "=a" (out), "+m" (*(volatile int*) ptr) + : "r" (newval), "0" (oldval) + : "memory"); + return out; +#elif defined(_AIX) && defined(__xlC__) + const int out = (*(volatile int*) ptr); + __compare_and_swap(ptr, &oldval, newval); + return out; +#else + return __sync_val_compare_and_swap(ptr, oldval, newval); +#endif +} + +UV_UNUSED(static long cmpxchgl(long* ptr, long oldval, long newval)) { +#if defined(__i386__) || defined(__x86_64__) + long out; + __asm__ __volatile__ ("lock; cmpxchg %2, %1;" + : "=a" (out), "+m" (*(volatile long*) ptr) + : "r" (newval), "0" (oldval) + : "memory"); + return out; +#elif defined(_AIX) && defined(__xlC__) + const long out = (*(volatile int*) ptr); +# if defined(__64BIT__) + __compare_and_swaplp(ptr, &oldval, newval); +# else + __compare_and_swap(ptr, &oldval, newval); +# endif /* if defined(__64BIT__) */ + return out; +#else + return __sync_val_compare_and_swap(ptr, oldval, newval); +#endif +} + +UV_UNUSED(static void cpu_relax(void)) { +#if defined(__i386__) || defined(__x86_64__) + __asm__ __volatile__ ("rep; nop"); /* a.k.a. PAUSE */ +#endif +} + +#endif /* UV_ATOMIC_OPS_H_ */ diff --git a/3rdparty/libuv/src/unix/core.c b/3rdparty/libuv/src/unix/core.c new file mode 100644 index 00000000000..cedd86ed34a --- /dev/null +++ b/3rdparty/libuv/src/unix/core.c @@ -0,0 +1,1104 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include /* NULL */ +#include /* printf */ +#include +#include /* strerror */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* INT_MAX, PATH_MAX, IOV_MAX */ +#include /* writev */ +#include /* getrusage */ +#include + +#ifdef __linux__ +# include +#endif + +#ifdef __sun +# include +# include +#endif + +#ifdef __APPLE__ +# include /* _NSGetExecutablePath */ +# include +# include +#endif + +#if defined(__FreeBSD__) || defined(__DragonFly__) +# include +# include +# include +# include +# define UV__O_CLOEXEC O_CLOEXEC +# if defined(__FreeBSD__) && __FreeBSD__ >= 10 +# define uv__accept4 accept4 +# define UV__SOCK_NONBLOCK SOCK_NONBLOCK +# define UV__SOCK_CLOEXEC SOCK_CLOEXEC +# endif +# if !defined(F_DUP2FD_CLOEXEC) && defined(_F_DUP2FD_CLOEXEC) +# define F_DUP2FD_CLOEXEC _F_DUP2FD_CLOEXEC +# endif +#endif + +#ifdef _AIX +#include +#endif + +#if defined(__ANDROID_API__) && __ANDROID_API__ < 21 +# include /* for dlsym */ +#endif + +static int uv__run_pending(uv_loop_t* loop); + +/* Verify that uv_buf_t is ABI-compatible with struct iovec. */ +STATIC_ASSERT(sizeof(uv_buf_t) == sizeof(struct iovec)); +STATIC_ASSERT(sizeof(&((uv_buf_t*) 0)->base) == + sizeof(((struct iovec*) 0)->iov_base)); +STATIC_ASSERT(sizeof(&((uv_buf_t*) 0)->len) == + sizeof(((struct iovec*) 0)->iov_len)); +STATIC_ASSERT(offsetof(uv_buf_t, base) == offsetof(struct iovec, iov_base)); +STATIC_ASSERT(offsetof(uv_buf_t, len) == offsetof(struct iovec, iov_len)); + + +uint64_t uv_hrtime(void) { + return uv__hrtime(UV_CLOCK_PRECISE); +} + + +void uv_close(uv_handle_t* handle, uv_close_cb close_cb) { + assert(!(handle->flags & (UV_CLOSING | UV_CLOSED))); + + handle->flags |= UV_CLOSING; + handle->close_cb = close_cb; + + switch (handle->type) { + case UV_NAMED_PIPE: + uv__pipe_close((uv_pipe_t*)handle); + break; + + case UV_TTY: + uv__stream_close((uv_stream_t*)handle); + break; + + case UV_TCP: + uv__tcp_close((uv_tcp_t*)handle); + break; + + case UV_UDP: + uv__udp_close((uv_udp_t*)handle); + break; + + case UV_PREPARE: + uv__prepare_close((uv_prepare_t*)handle); + break; + + case UV_CHECK: + uv__check_close((uv_check_t*)handle); + break; + + case UV_IDLE: + uv__idle_close((uv_idle_t*)handle); + break; + + case UV_ASYNC: + uv__async_close((uv_async_t*)handle); + break; + + case UV_TIMER: + uv__timer_close((uv_timer_t*)handle); + break; + + case UV_PROCESS: + uv__process_close((uv_process_t*)handle); + break; + + case UV_FS_EVENT: + uv__fs_event_close((uv_fs_event_t*)handle); + break; + + case UV_POLL: + uv__poll_close((uv_poll_t*)handle); + break; + + case UV_FS_POLL: + uv__fs_poll_close((uv_fs_poll_t*)handle); + break; + + case UV_SIGNAL: + uv__signal_close((uv_signal_t*) handle); + /* Signal handles may not be closed immediately. The signal code will */ + /* itself close uv__make_close_pending whenever appropriate. */ + return; + + default: + assert(0); + } + + uv__make_close_pending(handle); +} + +int uv__socket_sockopt(uv_handle_t* handle, int optname, int* value) { + int r; + int fd; + socklen_t len; + + if (handle == NULL || value == NULL) + return -EINVAL; + + if (handle->type == UV_TCP || handle->type == UV_NAMED_PIPE) + fd = uv__stream_fd((uv_stream_t*) handle); + else if (handle->type == UV_UDP) + fd = ((uv_udp_t *) handle)->io_watcher.fd; + else + return -ENOTSUP; + + len = sizeof(*value); + + if (*value == 0) + r = getsockopt(fd, SOL_SOCKET, optname, value, &len); + else + r = setsockopt(fd, SOL_SOCKET, optname, (const void*) value, len); + + if (r < 0) + return -errno; + + return 0; +} + +void uv__make_close_pending(uv_handle_t* handle) { + assert(handle->flags & UV_CLOSING); + assert(!(handle->flags & UV_CLOSED)); + handle->next_closing = handle->loop->closing_handles; + handle->loop->closing_handles = handle; +} + +int uv__getiovmax(void) { +#if defined(IOV_MAX) + return IOV_MAX; +#elif defined(_SC_IOV_MAX) + static int iovmax = -1; + if (iovmax == -1) { + iovmax = sysconf(_SC_IOV_MAX); + /* On some embedded devices (arm-linux-uclibc based ip camera), + * sysconf(_SC_IOV_MAX) can not get the correct value. The return + * value is -1 and the errno is EINPROGRESS. Degrade the value to 1. + */ + if (iovmax == -1) iovmax = 1; + } + return iovmax; +#else + return 1024; +#endif +} + + +static void uv__finish_close(uv_handle_t* handle) { + /* Note: while the handle is in the UV_CLOSING state now, it's still possible + * for it to be active in the sense that uv__is_active() returns true. + * A good example is when the user calls uv_shutdown(), immediately followed + * by uv_close(). The handle is considered active at this point because the + * completion of the shutdown req is still pending. + */ + assert(handle->flags & UV_CLOSING); + assert(!(handle->flags & UV_CLOSED)); + handle->flags |= UV_CLOSED; + + switch (handle->type) { + case UV_PREPARE: + case UV_CHECK: + case UV_IDLE: + case UV_ASYNC: + case UV_TIMER: + case UV_PROCESS: + case UV_FS_EVENT: + case UV_FS_POLL: + case UV_POLL: + case UV_SIGNAL: + break; + + case UV_NAMED_PIPE: + case UV_TCP: + case UV_TTY: + uv__stream_destroy((uv_stream_t*)handle); + break; + + case UV_UDP: + uv__udp_finish_close((uv_udp_t*)handle); + break; + + default: + assert(0); + break; + } + + uv__handle_unref(handle); + QUEUE_REMOVE(&handle->handle_queue); + + if (handle->close_cb) { + handle->close_cb(handle); + } +} + + +static void uv__run_closing_handles(uv_loop_t* loop) { + uv_handle_t* p; + uv_handle_t* q; + + p = loop->closing_handles; + loop->closing_handles = NULL; + + while (p) { + q = p->next_closing; + uv__finish_close(p); + p = q; + } +} + + +int uv_is_closing(const uv_handle_t* handle) { + return uv__is_closing(handle); +} + + +int uv_backend_fd(const uv_loop_t* loop) { + return loop->backend_fd; +} + + +int uv_backend_timeout(const uv_loop_t* loop) { + if (loop->stop_flag != 0) + return 0; + + if (!uv__has_active_handles(loop) && !uv__has_active_reqs(loop)) + return 0; + + if (!QUEUE_EMPTY(&loop->idle_handles)) + return 0; + + if (!QUEUE_EMPTY(&loop->pending_queue)) + return 0; + + if (loop->closing_handles) + return 0; + + return uv__next_timeout(loop); +} + + +static int uv__loop_alive(const uv_loop_t* loop) { + return uv__has_active_handles(loop) || + uv__has_active_reqs(loop) || + loop->closing_handles != NULL; +} + + +int uv_loop_alive(const uv_loop_t* loop) { + return uv__loop_alive(loop); +} + + +int uv_run(uv_loop_t* loop, uv_run_mode mode) { + int timeout; + int r; + int ran_pending; + + r = uv__loop_alive(loop); + if (!r) + uv__update_time(loop); + + while (r != 0 && loop->stop_flag == 0) { + uv__update_time(loop); + uv__run_timers(loop); + ran_pending = uv__run_pending(loop); + uv__run_idle(loop); + uv__run_prepare(loop); + + timeout = 0; + if ((mode == UV_RUN_ONCE && !ran_pending) || mode == UV_RUN_DEFAULT) + timeout = uv_backend_timeout(loop); + + uv__io_poll(loop, timeout); + uv__run_check(loop); + uv__run_closing_handles(loop); + + if (mode == UV_RUN_ONCE) { + /* UV_RUN_ONCE implies forward progress: at least one callback must have + * been invoked when it returns. uv__io_poll() can return without doing + * I/O (meaning: no callbacks) when its timeout expires - which means we + * have pending timers that satisfy the forward progress constraint. + * + * UV_RUN_NOWAIT makes no guarantees about progress so it's omitted from + * the check. + */ + uv__update_time(loop); + uv__run_timers(loop); + } + + r = uv__loop_alive(loop); + if (mode == UV_RUN_ONCE || mode == UV_RUN_NOWAIT) + break; + } + + /* The if statement lets gcc compile it to a conditional store. Avoids + * dirtying a cache line. + */ + if (loop->stop_flag != 0) + loop->stop_flag = 0; + + return r; +} + + +void uv_update_time(uv_loop_t* loop) { + uv__update_time(loop); +} + + +int uv_is_active(const uv_handle_t* handle) { + return uv__is_active(handle); +} + + +/* Open a socket in non-blocking close-on-exec mode, atomically if possible. */ +int uv__socket(int domain, int type, int protocol) { + int sockfd; + int err; + +#if defined(SOCK_NONBLOCK) && defined(SOCK_CLOEXEC) + sockfd = socket(domain, type | SOCK_NONBLOCK | SOCK_CLOEXEC, protocol); + if (sockfd != -1) + return sockfd; + + if (errno != EINVAL) + return -errno; +#endif + + sockfd = socket(domain, type, protocol); + if (sockfd == -1) + return -errno; + + err = uv__nonblock(sockfd, 1); + if (err == 0) + err = uv__cloexec(sockfd, 1); + + if (err) { + uv__close(sockfd); + return err; + } + +#if defined(SO_NOSIGPIPE) + { + int on = 1; + setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &on, sizeof(on)); + } +#endif + + return sockfd; +} + + +int uv__accept(int sockfd) { + int peerfd; + int err; + + assert(sockfd >= 0); + + while (1) { +#if defined(__linux__) || __FreeBSD__ >= 10 + static int no_accept4; + + if (no_accept4) + goto skip; + + peerfd = uv__accept4(sockfd, + NULL, + NULL, + UV__SOCK_NONBLOCK|UV__SOCK_CLOEXEC); + if (peerfd != -1) + return peerfd; + + if (errno == EINTR) + continue; + + if (errno != ENOSYS) + return -errno; + + no_accept4 = 1; +skip: +#endif + + peerfd = accept(sockfd, NULL, NULL); + if (peerfd == -1) { + if (errno == EINTR) + continue; + return -errno; + } + + err = uv__cloexec(peerfd, 1); + if (err == 0) + err = uv__nonblock(peerfd, 1); + + if (err) { + uv__close(peerfd); + return err; + } + + return peerfd; + } +} + + +int uv__close(int fd) { + int saved_errno; + int rc; + + assert(fd > -1); /* Catch uninitialized io_watcher.fd bugs. */ + assert(fd > STDERR_FILENO); /* Catch stdio close bugs. */ + + saved_errno = errno; + rc = close(fd); + if (rc == -1) { + rc = -errno; + if (rc == -EINTR) + rc = -EINPROGRESS; /* For platform/libc consistency. */ + errno = saved_errno; + } + + return rc; +} + + +#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || \ + defined(_AIX) || defined(__DragonFly__) + +int uv__nonblock(int fd, int set) { + int r; + + do + r = ioctl(fd, FIONBIO, &set); + while (r == -1 && errno == EINTR); + + if (r) + return -errno; + + return 0; +} + + +int uv__cloexec(int fd, int set) { + int r; + + do + r = ioctl(fd, set ? FIOCLEX : FIONCLEX); + while (r == -1 && errno == EINTR); + + if (r) + return -errno; + + return 0; +} + +#else /* !(defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || \ + defined(_AIX) || defined(__DragonFly__)) */ + +int uv__nonblock(int fd, int set) { + int flags; + int r; + + do + r = fcntl(fd, F_GETFL); + while (r == -1 && errno == EINTR); + + if (r == -1) + return -errno; + + /* Bail out now if already set/clear. */ + if (!!(r & O_NONBLOCK) == !!set) + return 0; + + if (set) + flags = r | O_NONBLOCK; + else + flags = r & ~O_NONBLOCK; + + do + r = fcntl(fd, F_SETFL, flags); + while (r == -1 && errno == EINTR); + + if (r) + return -errno; + + return 0; +} + + +int uv__cloexec(int fd, int set) { + int flags; + int r; + + do + r = fcntl(fd, F_GETFD); + while (r == -1 && errno == EINTR); + + if (r == -1) + return -errno; + + /* Bail out now if already set/clear. */ + if (!!(r & FD_CLOEXEC) == !!set) + return 0; + + if (set) + flags = r | FD_CLOEXEC; + else + flags = r & ~FD_CLOEXEC; + + do + r = fcntl(fd, F_SETFD, flags); + while (r == -1 && errno == EINTR); + + if (r) + return -errno; + + return 0; +} + +#endif /* defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || \ + defined(_AIX) || defined(__DragonFly__) */ + + +/* This function is not execve-safe, there is a race window + * between the call to dup() and fcntl(FD_CLOEXEC). + */ +int uv__dup(int fd) { + int err; + + fd = dup(fd); + + if (fd == -1) + return -errno; + + err = uv__cloexec(fd, 1); + if (err) { + uv__close(fd); + return err; + } + + return fd; +} + + +ssize_t uv__recvmsg(int fd, struct msghdr* msg, int flags) { + struct cmsghdr* cmsg; + ssize_t rc; + int* pfd; + int* end; +#if defined(__linux__) + static int no_msg_cmsg_cloexec; + if (no_msg_cmsg_cloexec == 0) { + rc = recvmsg(fd, msg, flags | 0x40000000); /* MSG_CMSG_CLOEXEC */ + if (rc != -1) + return rc; + if (errno != EINVAL) + return -errno; + rc = recvmsg(fd, msg, flags); + if (rc == -1) + return -errno; + no_msg_cmsg_cloexec = 1; + } else { + rc = recvmsg(fd, msg, flags); + } +#else + rc = recvmsg(fd, msg, flags); +#endif + if (rc == -1) + return -errno; + if (msg->msg_controllen == 0) + return rc; + for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) + if (cmsg->cmsg_type == SCM_RIGHTS) + for (pfd = (int*) CMSG_DATA(cmsg), + end = (int*) ((char*) cmsg + cmsg->cmsg_len); + pfd < end; + pfd += 1) + uv__cloexec(*pfd, 1); + return rc; +} + + +int uv_cwd(char* buffer, size_t* size) { + if (buffer == NULL || size == NULL) + return -EINVAL; + + if (getcwd(buffer, *size) == NULL) + return -errno; + + *size = strlen(buffer); + if (*size > 1 && buffer[*size - 1] == '/') { + buffer[*size-1] = '\0'; + (*size)--; + } + + return 0; +} + + +int uv_chdir(const char* dir) { + if (chdir(dir)) + return -errno; + + return 0; +} + + +void uv_disable_stdio_inheritance(void) { + int fd; + + /* Set the CLOEXEC flag on all open descriptors. Unconditionally try the + * first 16 file descriptors. After that, bail out after the first error. + */ + for (fd = 0; ; fd++) + if (uv__cloexec(fd, 1) && fd > 15) + break; +} + + +int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd) { + int fd_out; + + switch (handle->type) { + case UV_TCP: + case UV_NAMED_PIPE: + case UV_TTY: + fd_out = uv__stream_fd((uv_stream_t*) handle); + break; + + case UV_UDP: + fd_out = ((uv_udp_t *) handle)->io_watcher.fd; + break; + + case UV_POLL: + fd_out = ((uv_poll_t *) handle)->io_watcher.fd; + break; + + default: + return -EINVAL; + } + + if (uv__is_closing(handle) || fd_out == -1) + return -EBADF; + + *fd = fd_out; + return 0; +} + + +static int uv__run_pending(uv_loop_t* loop) { + QUEUE* q; + QUEUE pq; + uv__io_t* w; + + if (QUEUE_EMPTY(&loop->pending_queue)) + return 0; + + QUEUE_MOVE(&loop->pending_queue, &pq); + + while (!QUEUE_EMPTY(&pq)) { + q = QUEUE_HEAD(&pq); + QUEUE_REMOVE(q); + QUEUE_INIT(q); + w = QUEUE_DATA(q, uv__io_t, pending_queue); + w->cb(loop, w, UV__POLLOUT); + } + + return 1; +} + + +static unsigned int next_power_of_two(unsigned int val) { + val -= 1; + val |= val >> 1; + val |= val >> 2; + val |= val >> 4; + val |= val >> 8; + val |= val >> 16; + val += 1; + return val; +} + +static void maybe_resize(uv_loop_t* loop, unsigned int len) { + uv__io_t** watchers; + void* fake_watcher_list; + void* fake_watcher_count; + unsigned int nwatchers; + unsigned int i; + + if (len <= loop->nwatchers) + return; + + /* Preserve fake watcher list and count at the end of the watchers */ + if (loop->watchers != NULL) { + fake_watcher_list = loop->watchers[loop->nwatchers]; + fake_watcher_count = loop->watchers[loop->nwatchers + 1]; + } else { + fake_watcher_list = NULL; + fake_watcher_count = NULL; + } + + nwatchers = next_power_of_two(len + 2) - 2; + watchers = uv__realloc(loop->watchers, + (nwatchers + 2) * sizeof(loop->watchers[0])); + + if (watchers == NULL) + abort(); + for (i = loop->nwatchers; i < nwatchers; i++) + watchers[i] = NULL; + watchers[nwatchers] = fake_watcher_list; + watchers[nwatchers + 1] = fake_watcher_count; + + loop->watchers = watchers; + loop->nwatchers = nwatchers; +} + + +void uv__io_init(uv__io_t* w, uv__io_cb cb, int fd) { + assert(cb != NULL); + assert(fd >= -1); + QUEUE_INIT(&w->pending_queue); + QUEUE_INIT(&w->watcher_queue); + w->cb = cb; + w->fd = fd; + w->events = 0; + w->pevents = 0; + +#if defined(UV_HAVE_KQUEUE) + w->rcount = 0; + w->wcount = 0; +#endif /* defined(UV_HAVE_KQUEUE) */ +} + + +void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) { + assert(0 == (events & ~(UV__POLLIN | UV__POLLOUT))); + assert(0 != events); + assert(w->fd >= 0); + assert(w->fd < INT_MAX); + + w->pevents |= events; + maybe_resize(loop, w->fd + 1); + +#if !defined(__sun) + /* The event ports backend needs to rearm all file descriptors on each and + * every tick of the event loop but the other backends allow us to + * short-circuit here if the event mask is unchanged. + */ + if (w->events == w->pevents) { + if (w->events == 0 && !QUEUE_EMPTY(&w->watcher_queue)) { + QUEUE_REMOVE(&w->watcher_queue); + QUEUE_INIT(&w->watcher_queue); + } + return; + } +#endif + + if (QUEUE_EMPTY(&w->watcher_queue)) + QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue); + + if (loop->watchers[w->fd] == NULL) { + loop->watchers[w->fd] = w; + loop->nfds++; + } +} + + +void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) { + assert(0 == (events & ~(UV__POLLIN | UV__POLLOUT))); + assert(0 != events); + + if (w->fd == -1) + return; + + assert(w->fd >= 0); + + /* Happens when uv__io_stop() is called on a handle that was never started. */ + if ((unsigned) w->fd >= loop->nwatchers) + return; + + w->pevents &= ~events; + + if (w->pevents == 0) { + QUEUE_REMOVE(&w->watcher_queue); + QUEUE_INIT(&w->watcher_queue); + + if (loop->watchers[w->fd] != NULL) { + assert(loop->watchers[w->fd] == w); + assert(loop->nfds > 0); + loop->watchers[w->fd] = NULL; + loop->nfds--; + w->events = 0; + } + } + else if (QUEUE_EMPTY(&w->watcher_queue)) + QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue); +} + + +void uv__io_close(uv_loop_t* loop, uv__io_t* w) { + uv__io_stop(loop, w, UV__POLLIN | UV__POLLOUT); + QUEUE_REMOVE(&w->pending_queue); + + /* Remove stale events for this file descriptor */ + uv__platform_invalidate_fd(loop, w->fd); +} + + +void uv__io_feed(uv_loop_t* loop, uv__io_t* w) { + if (QUEUE_EMPTY(&w->pending_queue)) + QUEUE_INSERT_TAIL(&loop->pending_queue, &w->pending_queue); +} + + +int uv__io_active(const uv__io_t* w, unsigned int events) { + assert(0 == (events & ~(UV__POLLIN | UV__POLLOUT))); + assert(0 != events); + return 0 != (w->pevents & events); +} + + +int uv_getrusage(uv_rusage_t* rusage) { + struct rusage usage; + + if (getrusage(RUSAGE_SELF, &usage)) + return -errno; + + rusage->ru_utime.tv_sec = usage.ru_utime.tv_sec; + rusage->ru_utime.tv_usec = usage.ru_utime.tv_usec; + + rusage->ru_stime.tv_sec = usage.ru_stime.tv_sec; + rusage->ru_stime.tv_usec = usage.ru_stime.tv_usec; + + rusage->ru_maxrss = usage.ru_maxrss; + rusage->ru_ixrss = usage.ru_ixrss; + rusage->ru_idrss = usage.ru_idrss; + rusage->ru_isrss = usage.ru_isrss; + rusage->ru_minflt = usage.ru_minflt; + rusage->ru_majflt = usage.ru_majflt; + rusage->ru_nswap = usage.ru_nswap; + rusage->ru_inblock = usage.ru_inblock; + rusage->ru_oublock = usage.ru_oublock; + rusage->ru_msgsnd = usage.ru_msgsnd; + rusage->ru_msgrcv = usage.ru_msgrcv; + rusage->ru_nsignals = usage.ru_nsignals; + rusage->ru_nvcsw = usage.ru_nvcsw; + rusage->ru_nivcsw = usage.ru_nivcsw; + + return 0; +} + + +int uv__open_cloexec(const char* path, int flags) { + int err; + int fd; + +#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD__ >= 9) || \ + defined(__DragonFly__) + static int no_cloexec; + + if (!no_cloexec) { + fd = open(path, flags | UV__O_CLOEXEC); + if (fd != -1) + return fd; + + if (errno != EINVAL) + return -errno; + + /* O_CLOEXEC not supported. */ + no_cloexec = 1; + } +#endif + + fd = open(path, flags); + if (fd == -1) + return -errno; + + err = uv__cloexec(fd, 1); + if (err) { + uv__close(fd); + return err; + } + + return fd; +} + + +int uv__dup2_cloexec(int oldfd, int newfd) { + int r; +#if defined(__FreeBSD__) && __FreeBSD__ >= 10 + r = dup3(oldfd, newfd, O_CLOEXEC); + if (r == -1) + return -errno; + return r; +#elif defined(__FreeBSD__) && defined(F_DUP2FD_CLOEXEC) + r = fcntl(oldfd, F_DUP2FD_CLOEXEC, newfd); + if (r != -1) + return r; + if (errno != EINVAL) + return -errno; + /* Fall through. */ +#elif defined(__linux__) + static int no_dup3; + if (!no_dup3) { + do + r = uv__dup3(oldfd, newfd, UV__O_CLOEXEC); + while (r == -1 && errno == EBUSY); + if (r != -1) + return r; + if (errno != ENOSYS) + return -errno; + /* Fall through. */ + no_dup3 = 1; + } +#endif + { + int err; + do + r = dup2(oldfd, newfd); +#if defined(__linux__) + while (r == -1 && errno == EBUSY); +#else + while (0); /* Never retry. */ +#endif + + if (r == -1) + return -errno; + + err = uv__cloexec(newfd, 1); + if (err) { + uv__close(newfd); + return err; + } + + return r; + } +} + + +int uv_os_homedir(char* buffer, size_t* size) { + struct passwd pw; + struct passwd* result; + char* buf; + uid_t uid; + size_t bufsize; + size_t len; + long initsize; + int r; +#if defined(__ANDROID_API__) && __ANDROID_API__ < 21 + int (*getpwuid_r)(uid_t, struct passwd*, char*, size_t, struct passwd**); +#endif + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + /* Check if the HOME environment variable is set first */ + buf = getenv("HOME"); + + if (buf != NULL) { + len = strlen(buf); + + if (len >= *size) { + *size = len; + return -ENOBUFS; + } + + memcpy(buffer, buf, len + 1); + *size = len; + + return 0; + } + +#if defined(__ANDROID_API__) && __ANDROID_API__ < 21 + getpwuid_r = dlsym(RTLD_DEFAULT, "getpwuid_r"); + if (getpwuid_r == NULL) + return -ENOSYS; +#endif + + /* HOME is not set, so call getpwuid() */ + initsize = sysconf(_SC_GETPW_R_SIZE_MAX); + + if (initsize <= 0) + bufsize = 4096; + else + bufsize = (size_t) initsize; + + uid = getuid(); + buf = NULL; + + for (;;) { + uv__free(buf); + buf = uv__malloc(bufsize); + + if (buf == NULL) + return -ENOMEM; + + r = getpwuid_r(uid, &pw, buf, bufsize, &result); + + if (r != ERANGE) + break; + + bufsize *= 2; + } + + if (r != 0) { + uv__free(buf); + return -r; + } + + if (result == NULL) { + uv__free(buf); + return -ENOENT; + } + + len = strlen(pw.pw_dir); + + if (len >= *size) { + *size = len; + uv__free(buf); + return -ENOBUFS; + } + + memcpy(buffer, pw.pw_dir, len + 1); + *size = len; + uv__free(buf); + + return 0; +} diff --git a/3rdparty/libuv/src/unix/darwin-proctitle.c b/3rdparty/libuv/src/unix/darwin-proctitle.c new file mode 100644 index 00000000000..1142311609f --- /dev/null +++ b/3rdparty/libuv/src/unix/darwin-proctitle.c @@ -0,0 +1,206 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include + +#include + +#if !TARGET_OS_IPHONE +# include +# include +#endif + + +static int uv__pthread_setname_np(const char* name) { + int (*dynamic_pthread_setname_np)(const char* name); + char namebuf[64]; /* MAXTHREADNAMESIZE */ + int err; + + /* pthread_setname_np() first appeared in OS X 10.6 and iOS 3.2. */ + *(void **)(&dynamic_pthread_setname_np) = + dlsym(RTLD_DEFAULT, "pthread_setname_np"); + + if (dynamic_pthread_setname_np == NULL) + return -ENOSYS; + + strncpy(namebuf, name, sizeof(namebuf) - 1); + namebuf[sizeof(namebuf) - 1] = '\0'; + + err = dynamic_pthread_setname_np(namebuf); + if (err) + return -err; + + return 0; +} + + +int uv__set_process_title(const char* title) { +#if TARGET_OS_IPHONE + return uv__pthread_setname_np(title); +#else + CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, + const char*, + CFStringEncoding); + CFBundleRef (*pCFBundleGetBundleWithIdentifier)(CFStringRef); + void *(*pCFBundleGetDataPointerForName)(CFBundleRef, CFStringRef); + void *(*pCFBundleGetFunctionPointerForName)(CFBundleRef, CFStringRef); + CFTypeRef (*pLSGetCurrentApplicationASN)(void); + OSStatus (*pLSSetApplicationInformationItem)(int, + CFTypeRef, + CFStringRef, + CFStringRef, + CFDictionaryRef*); + void* application_services_handle; + void* core_foundation_handle; + CFBundleRef launch_services_bundle; + CFStringRef* display_name_key; + CFDictionaryRef (*pCFBundleGetInfoDictionary)(CFBundleRef); + CFBundleRef (*pCFBundleGetMainBundle)(void); + CFBundleRef hi_services_bundle; + OSStatus (*pSetApplicationIsDaemon)(int); + CFDictionaryRef (*pLSApplicationCheckIn)(int, CFDictionaryRef); + void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(uint64_t, + void*); + CFTypeRef asn; + int err; + + err = -ENOENT; + application_services_handle = dlopen("/System/Library/Frameworks/" + "ApplicationServices.framework/" + "Versions/A/ApplicationServices", + RTLD_LAZY | RTLD_LOCAL); + core_foundation_handle = dlopen("/System/Library/Frameworks/" + "CoreFoundation.framework/" + "Versions/A/CoreFoundation", + RTLD_LAZY | RTLD_LOCAL); + + if (application_services_handle == NULL || core_foundation_handle == NULL) + goto out; + + *(void **)(&pCFStringCreateWithCString) = + dlsym(core_foundation_handle, "CFStringCreateWithCString"); + *(void **)(&pCFBundleGetBundleWithIdentifier) = + dlsym(core_foundation_handle, "CFBundleGetBundleWithIdentifier"); + *(void **)(&pCFBundleGetDataPointerForName) = + dlsym(core_foundation_handle, "CFBundleGetDataPointerForName"); + *(void **)(&pCFBundleGetFunctionPointerForName) = + dlsym(core_foundation_handle, "CFBundleGetFunctionPointerForName"); + + if (pCFStringCreateWithCString == NULL || + pCFBundleGetBundleWithIdentifier == NULL || + pCFBundleGetDataPointerForName == NULL || + pCFBundleGetFunctionPointerForName == NULL) { + goto out; + } + +#define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8) + + launch_services_bundle = + pCFBundleGetBundleWithIdentifier(S("com.apple.LaunchServices")); + + if (launch_services_bundle == NULL) + goto out; + + *(void **)(&pLSGetCurrentApplicationASN) = + pCFBundleGetFunctionPointerForName(launch_services_bundle, + S("_LSGetCurrentApplicationASN")); + + if (pLSGetCurrentApplicationASN == NULL) + goto out; + + *(void **)(&pLSSetApplicationInformationItem) = + pCFBundleGetFunctionPointerForName(launch_services_bundle, + S("_LSSetApplicationInformationItem")); + + if (pLSSetApplicationInformationItem == NULL) + goto out; + + display_name_key = pCFBundleGetDataPointerForName(launch_services_bundle, + S("_kLSDisplayNameKey")); + + if (display_name_key == NULL || *display_name_key == NULL) + goto out; + + *(void **)(&pCFBundleGetInfoDictionary) = dlsym(core_foundation_handle, + "CFBundleGetInfoDictionary"); + *(void **)(&pCFBundleGetMainBundle) = dlsym(core_foundation_handle, + "CFBundleGetMainBundle"); + if (pCFBundleGetInfoDictionary == NULL || pCFBundleGetMainBundle == NULL) + goto out; + + /* Black 10.9 magic, to remove (Not responding) mark in Activity Monitor */ + hi_services_bundle = + pCFBundleGetBundleWithIdentifier(S("com.apple.HIServices")); + err = -ENOENT; + if (hi_services_bundle == NULL) + goto out; + + *(void **)(&pSetApplicationIsDaemon) = pCFBundleGetFunctionPointerForName( + hi_services_bundle, + S("SetApplicationIsDaemon")); + *(void **)(&pLSApplicationCheckIn) = pCFBundleGetFunctionPointerForName( + launch_services_bundle, + S("_LSApplicationCheckIn")); + *(void **)(&pLSSetApplicationLaunchServicesServerConnectionStatus) = + pCFBundleGetFunctionPointerForName( + launch_services_bundle, + S("_LSSetApplicationLaunchServicesServerConnectionStatus")); + if (pSetApplicationIsDaemon == NULL || + pLSApplicationCheckIn == NULL || + pLSSetApplicationLaunchServicesServerConnectionStatus == NULL) { + goto out; + } + + if (pSetApplicationIsDaemon(1) != noErr) + goto out; + + pLSSetApplicationLaunchServicesServerConnectionStatus(0, NULL); + + /* Check into process manager?! */ + pLSApplicationCheckIn(-2, + pCFBundleGetInfoDictionary(pCFBundleGetMainBundle())); + + asn = pLSGetCurrentApplicationASN(); + + err = -EINVAL; + if (pLSSetApplicationInformationItem(-2, /* Magic value. */ + asn, + *display_name_key, + S(title), + NULL) != noErr) { + goto out; + } + + uv__pthread_setname_np(title); /* Don't care if it fails. */ + err = 0; + +out: + if (core_foundation_handle != NULL) + dlclose(core_foundation_handle); + + if (application_services_handle != NULL) + dlclose(application_services_handle); + + return err; +#endif /* !TARGET_OS_IPHONE */ +} diff --git a/3rdparty/libuv/src/unix/darwin.c b/3rdparty/libuv/src/unix/darwin.c new file mode 100644 index 00000000000..cf95da21693 --- /dev/null +++ b/3rdparty/libuv/src/unix/darwin.c @@ -0,0 +1,335 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include /* _NSGetExecutablePath */ +#include +#include +#include /* sysconf */ + + +int uv__platform_loop_init(uv_loop_t* loop) { + loop->cf_state = NULL; + + if (uv__kqueue_init(loop)) + return -errno; + + return 0; +} + + +void uv__platform_loop_delete(uv_loop_t* loop) { + uv__fsevents_loop_delete(loop); +} + + +uint64_t uv__hrtime(uv_clocktype_t type) { + static mach_timebase_info_data_t info; + + if ((ACCESS_ONCE(uint32_t, info.numer) == 0 || + ACCESS_ONCE(uint32_t, info.denom) == 0) && + mach_timebase_info(&info) != KERN_SUCCESS) + abort(); + + return mach_absolute_time() * info.numer / info.denom; +} + + +int uv_exepath(char* buffer, size_t* size) { + /* realpath(exepath) may be > PATH_MAX so double it to be on the safe side. */ + char abspath[PATH_MAX * 2 + 1]; + char exepath[PATH_MAX + 1]; + uint32_t exepath_size; + size_t abspath_size; + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + exepath_size = sizeof(exepath); + if (_NSGetExecutablePath(exepath, &exepath_size)) + return -EIO; + + if (realpath(exepath, abspath) != abspath) + return -errno; + + abspath_size = strlen(abspath); + if (abspath_size == 0) + return -EIO; + + *size -= 1; + if (*size > abspath_size) + *size = abspath_size; + + memcpy(buffer, abspath, *size); + buffer[*size] = '\0'; + + return 0; +} + + +uint64_t uv_get_free_memory(void) { + vm_statistics_data_t info; + mach_msg_type_number_t count = sizeof(info) / sizeof(integer_t); + + if (host_statistics(mach_host_self(), HOST_VM_INFO, + (host_info_t)&info, &count) != KERN_SUCCESS) { + return -EINVAL; /* FIXME(bnoordhuis) Translate error. */ + } + + return (uint64_t) info.free_count * sysconf(_SC_PAGESIZE); +} + + +uint64_t uv_get_total_memory(void) { + uint64_t info; + int which[] = {CTL_HW, HW_MEMSIZE}; + size_t size = sizeof(info); + + if (sysctl(which, 2, &info, &size, NULL, 0)) + return -errno; + + return (uint64_t) info; +} + + +void uv_loadavg(double avg[3]) { + struct loadavg info; + size_t size = sizeof(info); + int which[] = {CTL_VM, VM_LOADAVG}; + + if (sysctl(which, 2, &info, &size, NULL, 0) < 0) return; + + avg[0] = (double) info.ldavg[0] / info.fscale; + avg[1] = (double) info.ldavg[1] / info.fscale; + avg[2] = (double) info.ldavg[2] / info.fscale; +} + + +int uv_resident_set_memory(size_t* rss) { + mach_msg_type_number_t count; + task_basic_info_data_t info; + kern_return_t err; + + count = TASK_BASIC_INFO_COUNT; + err = task_info(mach_task_self(), + TASK_BASIC_INFO, + (task_info_t) &info, + &count); + (void) &err; + /* task_info(TASK_BASIC_INFO) cannot really fail. Anything other than + * KERN_SUCCESS implies a libuv bug. + */ + assert(err == KERN_SUCCESS); + *rss = info.resident_size; + + return 0; +} + + +int uv_uptime(double* uptime) { + time_t now; + struct timeval info; + size_t size = sizeof(info); + static int which[] = {CTL_KERN, KERN_BOOTTIME}; + + if (sysctl(which, 2, &info, &size, NULL, 0)) + return -errno; + + now = time(NULL); + *uptime = now - info.tv_sec; + + return 0; +} + +int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { + unsigned int ticks = (unsigned int)sysconf(_SC_CLK_TCK), + multiplier = ((uint64_t)1000L / ticks); + char model[512]; + uint64_t cpuspeed; + size_t size; + unsigned int i; + natural_t numcpus; + mach_msg_type_number_t msg_type; + processor_cpu_load_info_data_t *info; + uv_cpu_info_t* cpu_info; + + size = sizeof(model); + if (sysctlbyname("machdep.cpu.brand_string", &model, &size, NULL, 0) && + sysctlbyname("hw.model", &model, &size, NULL, 0)) { + return -errno; + } + + size = sizeof(cpuspeed); + if (sysctlbyname("hw.cpufrequency", &cpuspeed, &size, NULL, 0)) + return -errno; + + if (host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &numcpus, + (processor_info_array_t*)&info, + &msg_type) != KERN_SUCCESS) { + return -EINVAL; /* FIXME(bnoordhuis) Translate error. */ + } + + *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos)); + if (!(*cpu_infos)) { + vm_deallocate(mach_task_self(), (vm_address_t)info, msg_type); + return -ENOMEM; + } + + *count = numcpus; + + for (i = 0; i < numcpus; i++) { + cpu_info = &(*cpu_infos)[i]; + + cpu_info->cpu_times.user = (uint64_t)(info[i].cpu_ticks[0]) * multiplier; + cpu_info->cpu_times.nice = (uint64_t)(info[i].cpu_ticks[3]) * multiplier; + cpu_info->cpu_times.sys = (uint64_t)(info[i].cpu_ticks[1]) * multiplier; + cpu_info->cpu_times.idle = (uint64_t)(info[i].cpu_ticks[2]) * multiplier; + cpu_info->cpu_times.irq = 0; + + cpu_info->model = uv__strdup(model); + cpu_info->speed = cpuspeed/1000000; + } + vm_deallocate(mach_task_self(), (vm_address_t)info, msg_type); + + return 0; +} + + +void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(cpu_infos[i].model); + } + + uv__free(cpu_infos); +} + + +int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { + struct ifaddrs *addrs, *ent; + uv_interface_address_t* address; + int i; + struct sockaddr_dl *sa_addr; + + if (getifaddrs(&addrs)) + return -errno; + + *count = 0; + + /* Count the number of interfaces */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family == AF_LINK)) { + continue; + } + + (*count)++; + } + + *addresses = uv__malloc(*count * sizeof(**addresses)); + if (!(*addresses)) { + freeifaddrs(addrs); + return -ENOMEM; + } + + address = *addresses; + + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING))) + continue; + + if (ent->ifa_addr == NULL) + continue; + + /* + * On Mac OS X getifaddrs returns information related to Mac Addresses for + * various devices, such as firewire, etc. These are not relevant here. + */ + if (ent->ifa_addr->sa_family == AF_LINK) + continue; + + address->name = uv__strdup(ent->ifa_name); + + if (ent->ifa_addr->sa_family == AF_INET6) { + address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr); + } else { + address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr); + } + + if (ent->ifa_netmask->sa_family == AF_INET6) { + address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask); + } else { + address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask); + } + + address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK); + + address++; + } + + /* Fill in physical addresses for each interface */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family != AF_LINK)) { + continue; + } + + address = *addresses; + + for (i = 0; i < (*count); i++) { + if (strcmp(address->name, ent->ifa_name) == 0) { + sa_addr = (struct sockaddr_dl*)(ent->ifa_addr); + memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); + } + address++; + } + } + + freeifaddrs(addrs); + + return 0; +} + + +void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(addresses[i].name); + } + + uv__free(addresses); +} diff --git a/3rdparty/libuv/src/unix/dl.c b/3rdparty/libuv/src/unix/dl.c new file mode 100644 index 00000000000..fc1c052bb81 --- /dev/null +++ b/3rdparty/libuv/src/unix/dl.c @@ -0,0 +1,80 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include + +static int uv__dlerror(uv_lib_t* lib); + + +int uv_dlopen(const char* filename, uv_lib_t* lib) { + dlerror(); /* Reset error status. */ + lib->errmsg = NULL; + lib->handle = dlopen(filename, RTLD_LAZY); + return lib->handle ? 0 : uv__dlerror(lib); +} + + +void uv_dlclose(uv_lib_t* lib) { + uv__free(lib->errmsg); + lib->errmsg = NULL; + + if (lib->handle) { + /* Ignore errors. No good way to signal them without leaking memory. */ + dlclose(lib->handle); + lib->handle = NULL; + } +} + + +int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr) { + dlerror(); /* Reset error status. */ + *ptr = dlsym(lib->handle, name); + return uv__dlerror(lib); +} + + +const char* uv_dlerror(const uv_lib_t* lib) { + return lib->errmsg ? lib->errmsg : "no error"; +} + + +static int uv__dlerror(uv_lib_t* lib) { + const char* errmsg; + + uv__free(lib->errmsg); + + errmsg = dlerror(); + + if (errmsg) { + lib->errmsg = uv__strdup(errmsg); + return -1; + } + else { + lib->errmsg = NULL; + return 0; + } +} diff --git a/3rdparty/libuv/src/unix/freebsd.c b/3rdparty/libuv/src/unix/freebsd.c new file mode 100644 index 00000000000..b747abdf5bc --- /dev/null +++ b/3rdparty/libuv/src/unix/freebsd.c @@ -0,0 +1,450 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include /* VM_LOADAVG */ +#include +#include +#include /* sysconf */ +#include + +#undef NANOSEC +#define NANOSEC ((uint64_t) 1e9) + +#ifndef CPUSTATES +# define CPUSTATES 5U +#endif +#ifndef CP_USER +# define CP_USER 0 +# define CP_NICE 1 +# define CP_SYS 2 +# define CP_IDLE 3 +# define CP_INTR 4 +#endif + +static char *process_title; + + +int uv__platform_loop_init(uv_loop_t* loop) { + return uv__kqueue_init(loop); +} + + +void uv__platform_loop_delete(uv_loop_t* loop) { +} + + +uint64_t uv__hrtime(uv_clocktype_t type) { + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); +} + + +#ifdef __DragonFly__ +int uv_exepath(char* buffer, size_t* size) { + char abspath[PATH_MAX * 2 + 1]; + ssize_t abspath_size; + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + abspath_size = readlink("/proc/curproc/file", abspath, sizeof(abspath)); + if (abspath_size < 0) + return -errno; + + assert(abspath_size > 0); + *size -= 1; + + if (*size > abspath_size) + *size = abspath_size; + + memcpy(buffer, abspath, *size); + buffer[*size] = '\0'; + + return 0; +} +#else +int uv_exepath(char* buffer, size_t* size) { + char abspath[PATH_MAX * 2 + 1]; + int mib[4]; + size_t abspath_size; + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PATHNAME; + mib[3] = -1; + + abspath_size = sizeof abspath; + if (sysctl(mib, 4, abspath, &abspath_size, NULL, 0)) + return -errno; + + assert(abspath_size > 0); + abspath_size -= 1; + *size -= 1; + + if (*size > abspath_size) + *size = abspath_size; + + memcpy(buffer, abspath, *size); + buffer[*size] = '\0'; + + return 0; +} +#endif + +uint64_t uv_get_free_memory(void) { + int freecount; + size_t size = sizeof(freecount); + + if (sysctlbyname("vm.stats.vm.v_free_count", &freecount, &size, NULL, 0)) + return -errno; + + return (uint64_t) freecount * sysconf(_SC_PAGESIZE); + +} + + +uint64_t uv_get_total_memory(void) { + unsigned long info; + int which[] = {CTL_HW, HW_PHYSMEM}; + + size_t size = sizeof(info); + + if (sysctl(which, 2, &info, &size, NULL, 0)) + return -errno; + + return (uint64_t) info; +} + + +void uv_loadavg(double avg[3]) { + struct loadavg info; + size_t size = sizeof(info); + int which[] = {CTL_VM, VM_LOADAVG}; + + if (sysctl(which, 2, &info, &size, NULL, 0) < 0) return; + + avg[0] = (double) info.ldavg[0] / info.fscale; + avg[1] = (double) info.ldavg[1] / info.fscale; + avg[2] = (double) info.ldavg[2] / info.fscale; +} + + +char** uv_setup_args(int argc, char** argv) { + process_title = argc ? uv__strdup(argv[0]) : NULL; + return argv; +} + + +int uv_set_process_title(const char* title) { + int oid[4]; + + uv__free(process_title); + process_title = uv__strdup(title); + + oid[0] = CTL_KERN; + oid[1] = KERN_PROC; + oid[2] = KERN_PROC_ARGS; + oid[3] = getpid(); + + sysctl(oid, + ARRAY_SIZE(oid), + NULL, + NULL, + process_title, + strlen(process_title) + 1); + + return 0; +} + + +int uv_get_process_title(char* buffer, size_t size) { + if (process_title) { + strncpy(buffer, process_title, size); + } else { + if (size > 0) { + buffer[0] = '\0'; + } + } + + return 0; +} + + +int uv_resident_set_memory(size_t* rss) { + kvm_t *kd = NULL; + struct kinfo_proc *kinfo = NULL; + pid_t pid; + int nprocs; + size_t page_size = getpagesize(); + + pid = getpid(); + + kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open"); + if (kd == NULL) goto error; + + kinfo = kvm_getprocs(kd, KERN_PROC_PID, pid, &nprocs); + if (kinfo == NULL) goto error; + +#ifdef __DragonFly__ + *rss = kinfo->kp_vm_rssize * page_size; +#else + *rss = kinfo->ki_rssize * page_size; +#endif + + kvm_close(kd); + + return 0; + +error: + if (kd) kvm_close(kd); + return -EPERM; +} + + +int uv_uptime(double* uptime) { + int r; + struct timespec sp; + r = clock_gettime(CLOCK_MONOTONIC, &sp); + if (r) + return -errno; + + *uptime = sp.tv_sec; + return 0; +} + + +int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { + unsigned int ticks = (unsigned int)sysconf(_SC_CLK_TCK), + multiplier = ((uint64_t)1000L / ticks), cpuspeed, maxcpus, + cur = 0; + uv_cpu_info_t* cpu_info; + const char* maxcpus_key; + const char* cptimes_key; + char model[512]; + long* cp_times; + int numcpus; + size_t size; + int i; + +#if defined(__DragonFly__) + /* This is not quite correct but DragonFlyBSD doesn't seem to have anything + * comparable to kern.smp.maxcpus or kern.cp_times (kern.cp_time is a total, + * not per CPU). At least this stops uv_cpu_info() from failing completely. + */ + maxcpus_key = "hw.ncpu"; + cptimes_key = "kern.cp_time"; +#else + maxcpus_key = "kern.smp.maxcpus"; + cptimes_key = "kern.cp_times"; +#endif + + size = sizeof(model); + if (sysctlbyname("hw.model", &model, &size, NULL, 0)) + return -errno; + + size = sizeof(numcpus); + if (sysctlbyname("hw.ncpu", &numcpus, &size, NULL, 0)) + return -errno; + + *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos)); + if (!(*cpu_infos)) + return -ENOMEM; + + *count = numcpus; + + size = sizeof(cpuspeed); + if (sysctlbyname("hw.clockrate", &cpuspeed, &size, NULL, 0)) { + SAVE_ERRNO(uv__free(*cpu_infos)); + return -errno; + } + + /* kern.cp_times on FreeBSD i386 gives an array up to maxcpus instead of + * ncpu. + */ + size = sizeof(maxcpus); + if (sysctlbyname(maxcpus_key, &maxcpus, &size, NULL, 0)) { + SAVE_ERRNO(uv__free(*cpu_infos)); + return -errno; + } + + size = maxcpus * CPUSTATES * sizeof(long); + + cp_times = uv__malloc(size); + if (cp_times == NULL) { + uv__free(*cpu_infos); + return -ENOMEM; + } + + if (sysctlbyname(cptimes_key, cp_times, &size, NULL, 0)) { + SAVE_ERRNO(uv__free(cp_times)); + SAVE_ERRNO(uv__free(*cpu_infos)); + return -errno; + } + + for (i = 0; i < numcpus; i++) { + cpu_info = &(*cpu_infos)[i]; + + cpu_info->cpu_times.user = (uint64_t)(cp_times[CP_USER+cur]) * multiplier; + cpu_info->cpu_times.nice = (uint64_t)(cp_times[CP_NICE+cur]) * multiplier; + cpu_info->cpu_times.sys = (uint64_t)(cp_times[CP_SYS+cur]) * multiplier; + cpu_info->cpu_times.idle = (uint64_t)(cp_times[CP_IDLE+cur]) * multiplier; + cpu_info->cpu_times.irq = (uint64_t)(cp_times[CP_INTR+cur]) * multiplier; + + cpu_info->model = uv__strdup(model); + cpu_info->speed = cpuspeed; + + cur+=CPUSTATES; + } + + uv__free(cp_times); + return 0; +} + + +void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(cpu_infos[i].model); + } + + uv__free(cpu_infos); +} + + +int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { + struct ifaddrs *addrs, *ent; + uv_interface_address_t* address; + int i; + struct sockaddr_dl *sa_addr; + + if (getifaddrs(&addrs)) + return -errno; + + *count = 0; + + /* Count the number of interfaces */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family == AF_LINK)) { + continue; + } + + (*count)++; + } + + *addresses = uv__malloc(*count * sizeof(**addresses)); + if (!(*addresses)) { + freeifaddrs(addrs); + return -ENOMEM; + } + + address = *addresses; + + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING))) + continue; + + if (ent->ifa_addr == NULL) + continue; + + /* + * On FreeBSD getifaddrs returns information related to the raw underlying + * devices. We're not interested in this information yet. + */ + if (ent->ifa_addr->sa_family == AF_LINK) + continue; + + address->name = uv__strdup(ent->ifa_name); + + if (ent->ifa_addr->sa_family == AF_INET6) { + address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr); + } else { + address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr); + } + + if (ent->ifa_netmask->sa_family == AF_INET6) { + address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask); + } else { + address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask); + } + + address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK); + + address++; + } + + /* Fill in physical addresses for each interface */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family != AF_LINK)) { + continue; + } + + address = *addresses; + + for (i = 0; i < (*count); i++) { + if (strcmp(address->name, ent->ifa_name) == 0) { + sa_addr = (struct sockaddr_dl*)(ent->ifa_addr); + memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); + } + address++; + } + } + + freeifaddrs(addrs); + + return 0; +} + + +void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(addresses[i].name); + } + + uv__free(addresses); +} diff --git a/3rdparty/libuv/src/unix/fs.c b/3rdparty/libuv/src/unix/fs.c new file mode 100644 index 00000000000..57b65be25a8 --- /dev/null +++ b/3rdparty/libuv/src/unix/fs.c @@ -0,0 +1,1310 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* Caveat emptor: this file deviates from the libuv convention of returning + * negated errno codes. Most uv_fs_*() functions map directly to the system + * call of the same name. For more complex wrappers, it's easier to just + * return -1 with errno set. The dispatcher in uv__fs_work() takes care of + * getting the errno to the right place (req->result or as the return value.) + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) +# define HAVE_PREADV 1 +#else +# define HAVE_PREADV 0 +#endif + +#if defined(__linux__) || defined(__sun) +# include +#endif + +#define INIT(subtype) \ + do { \ + req->type = UV_FS; \ + if (cb != NULL) \ + uv__req_init(loop, req, UV_FS); \ + req->fs_type = UV_FS_ ## subtype; \ + req->result = 0; \ + req->ptr = NULL; \ + req->loop = loop; \ + req->path = NULL; \ + req->new_path = NULL; \ + req->cb = cb; \ + } \ + while (0) + +#define PATH \ + do { \ + assert(path != NULL); \ + if (cb == NULL) { \ + req->path = path; \ + } else { \ + req->path = uv__strdup(path); \ + if (req->path == NULL) { \ + uv__req_unregister(loop, req); \ + return -ENOMEM; \ + } \ + } \ + } \ + while (0) + +#define PATH2 \ + do { \ + if (cb == NULL) { \ + req->path = path; \ + req->new_path = new_path; \ + } else { \ + size_t path_len; \ + size_t new_path_len; \ + path_len = strlen(path) + 1; \ + new_path_len = strlen(new_path) + 1; \ + req->path = uv__malloc(path_len + new_path_len); \ + if (req->path == NULL) { \ + uv__req_unregister(loop, req); \ + return -ENOMEM; \ + } \ + req->new_path = req->path + path_len; \ + memcpy((void*) req->path, path, path_len); \ + memcpy((void*) req->new_path, new_path, new_path_len); \ + } \ + } \ + while (0) + +#define POST \ + do { \ + if (cb != NULL) { \ + uv__work_submit(loop, &req->work_req, uv__fs_work, uv__fs_done); \ + return 0; \ + } \ + else { \ + uv__fs_work(&req->work_req); \ + return req->result; \ + } \ + } \ + while (0) + + +static ssize_t uv__fs_fdatasync(uv_fs_t* req) { +#if defined(__linux__) || defined(__sun) || defined(__NetBSD__) + return fdatasync(req->file); +#elif defined(__APPLE__) && defined(F_FULLFSYNC) + return fcntl(req->file, F_FULLFSYNC); +#else + return fsync(req->file); +#endif +} + + +static ssize_t uv__fs_futime(uv_fs_t* req) { +#if defined(__linux__) + /* utimesat() has nanosecond resolution but we stick to microseconds + * for the sake of consistency with other platforms. + */ + static int no_utimesat; + struct timespec ts[2]; + struct timeval tv[2]; + char path[sizeof("/proc/self/fd/") + 3 * sizeof(int)]; + int r; + + if (no_utimesat) + goto skip; + + ts[0].tv_sec = req->atime; + ts[0].tv_nsec = (unsigned long)(req->atime * 1000000) % 1000000 * 1000; + ts[1].tv_sec = req->mtime; + ts[1].tv_nsec = (unsigned long)(req->mtime * 1000000) % 1000000 * 1000; + + r = uv__utimesat(req->file, NULL, ts, 0); + if (r == 0) + return r; + + if (errno != ENOSYS) + return r; + + no_utimesat = 1; + +skip: + + tv[0].tv_sec = req->atime; + tv[0].tv_usec = (unsigned long)(req->atime * 1000000) % 1000000; + tv[1].tv_sec = req->mtime; + tv[1].tv_usec = (unsigned long)(req->mtime * 1000000) % 1000000; + snprintf(path, sizeof(path), "/proc/self/fd/%d", (int) req->file); + + r = utimes(path, tv); + if (r == 0) + return r; + + switch (errno) { + case ENOENT: + if (fcntl(req->file, F_GETFL) == -1 && errno == EBADF) + break; + /* Fall through. */ + + case EACCES: + case ENOTDIR: + errno = ENOSYS; + break; + } + + return r; + +#elif defined(__APPLE__) \ + || defined(__DragonFly__) \ + || defined(__FreeBSD__) \ + || defined(__NetBSD__) \ + || defined(__OpenBSD__) \ + || defined(__sun) + struct timeval tv[2]; + tv[0].tv_sec = req->atime; + tv[0].tv_usec = (unsigned long)(req->atime * 1000000) % 1000000; + tv[1].tv_sec = req->mtime; + tv[1].tv_usec = (unsigned long)(req->mtime * 1000000) % 1000000; +# if defined(__sun) + return futimesat(req->file, NULL, tv); +# else + return futimes(req->file, tv); +# endif +#else + errno = ENOSYS; + return -1; +#endif +} + + +static ssize_t uv__fs_mkdtemp(uv_fs_t* req) { + return mkdtemp((char*) req->path) ? 0 : -1; +} + + +static ssize_t uv__fs_open(uv_fs_t* req) { + static int no_cloexec_support; + int r; + + /* Try O_CLOEXEC before entering locks */ + if (no_cloexec_support == 0) { +#ifdef O_CLOEXEC + r = open(req->path, req->flags | O_CLOEXEC, req->mode); + if (r >= 0) + return r; + if (errno != EINVAL) + return r; + no_cloexec_support = 1; +#endif /* O_CLOEXEC */ + } + + if (req->cb != NULL) + uv_rwlock_rdlock(&req->loop->cloexec_lock); + + r = open(req->path, req->flags, req->mode); + + /* In case of failure `uv__cloexec` will leave error in `errno`, + * so it is enough to just set `r` to `-1`. + */ + if (r >= 0 && uv__cloexec(r, 1) != 0) { + r = uv__close(r); + if (r != 0 && r != -EINPROGRESS) + abort(); + r = -1; + } + + if (req->cb != NULL) + uv_rwlock_rdunlock(&req->loop->cloexec_lock); + + return r; +} + + +static ssize_t uv__fs_read(uv_fs_t* req) { +#if defined(__linux__) + static int no_preadv; +#endif + ssize_t result; + +#if defined(_AIX) + struct stat buf; + if(fstat(req->file, &buf)) + return -1; + if(S_ISDIR(buf.st_mode)) { + errno = EISDIR; + return -1; + } +#endif /* defined(_AIX) */ + if (req->off < 0) { + if (req->nbufs == 1) + result = read(req->file, req->bufs[0].base, req->bufs[0].len); + else + result = readv(req->file, (struct iovec*) req->bufs, req->nbufs); + } else { + if (req->nbufs == 1) { + result = pread(req->file, req->bufs[0].base, req->bufs[0].len, req->off); + goto done; + } + +#if HAVE_PREADV + result = preadv(req->file, (struct iovec*) req->bufs, req->nbufs, req->off); +#else +# if defined(__linux__) + if (no_preadv) retry: +# endif + { + off_t nread; + size_t index; + + nread = 0; + index = 0; + result = 1; + do { + if (req->bufs[index].len > 0) { + result = pread(req->file, + req->bufs[index].base, + req->bufs[index].len, + req->off + nread); + if (result > 0) + nread += result; + } + index++; + } while (index < req->nbufs && result > 0); + if (nread > 0) + result = nread; + } +# if defined(__linux__) + else { + result = uv__preadv(req->file, + (struct iovec*)req->bufs, + req->nbufs, + req->off); + if (result == -1 && errno == ENOSYS) { + no_preadv = 1; + goto retry; + } + } +# endif +#endif + } + +done: + return result; +} + + +#if defined(__OpenBSD__) || (defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_8)) +static int uv__fs_scandir_filter(uv__dirent_t* dent) { +#else +static int uv__fs_scandir_filter(const uv__dirent_t* dent) { +#endif + return strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0; +} + + +static ssize_t uv__fs_scandir(uv_fs_t* req) { + uv__dirent_t **dents; + int saved_errno; + int n; + + dents = NULL; + n = scandir(req->path, &dents, uv__fs_scandir_filter, alphasort); + + /* NOTE: We will use nbufs as an index field */ + req->nbufs = 0; + + if (n == 0) + goto out; /* osx still needs to deallocate some memory */ + else if (n == -1) + return n; + + req->ptr = dents; + + return n; + +out: + saved_errno = errno; + if (dents != NULL) { + int i; + + for (i = 0; i < n; i++) + uv__free(dents[i]); + uv__free(dents); + } + errno = saved_errno; + + req->ptr = NULL; + + return n; +} + + +static ssize_t uv__fs_pathmax_size(const char* path) { + ssize_t pathmax; + + pathmax = pathconf(path, _PC_PATH_MAX); + + if (pathmax == -1) { +#if defined(PATH_MAX) + return PATH_MAX; +#else + return 4096; +#endif + } + + return pathmax; +} + +static ssize_t uv__fs_readlink(uv_fs_t* req) { + ssize_t len; + char* buf; + + len = uv__fs_pathmax_size(req->path); + buf = uv__malloc(len + 1); + + if (buf == NULL) { + errno = ENOMEM; + return -1; + } + + len = readlink(req->path, buf, len); + + if (len == -1) { + uv__free(buf); + return -1; + } + + buf[len] = '\0'; + req->ptr = buf; + + return 0; +} + +static ssize_t uv__fs_realpath(uv_fs_t* req) { + ssize_t len; + char* buf; + + len = uv__fs_pathmax_size(req->path); + buf = uv__malloc(len + 1); + + if (buf == NULL) { + errno = ENOMEM; + return -1; + } + + if (realpath(req->path, buf) == NULL) { + uv__free(buf); + return -1; + } + + req->ptr = buf; + + return 0; +} + +static ssize_t uv__fs_sendfile_emul(uv_fs_t* req) { + struct pollfd pfd; + int use_pread; + off_t offset; + ssize_t nsent; + ssize_t nread; + ssize_t nwritten; + size_t buflen; + size_t len; + ssize_t n; + int in_fd; + int out_fd; + char buf[8192]; + + len = req->bufsml[0].len; + in_fd = req->flags; + out_fd = req->file; + offset = req->off; + use_pread = 1; + + /* Here are the rules regarding errors: + * + * 1. Read errors are reported only if nsent==0, otherwise we return nsent. + * The user needs to know that some data has already been sent, to stop + * them from sending it twice. + * + * 2. Write errors are always reported. Write errors are bad because they + * mean data loss: we've read data but now we can't write it out. + * + * We try to use pread() and fall back to regular read() if the source fd + * doesn't support positional reads, for example when it's a pipe fd. + * + * If we get EAGAIN when writing to the target fd, we poll() on it until + * it becomes writable again. + * + * FIXME: If we get a write error when use_pread==1, it should be safe to + * return the number of sent bytes instead of an error because pread() + * is, in theory, idempotent. However, special files in /dev or /proc + * may support pread() but not necessarily return the same data on + * successive reads. + * + * FIXME: There is no way now to signal that we managed to send *some* data + * before a write error. + */ + for (nsent = 0; (size_t) nsent < len; ) { + buflen = len - nsent; + + if (buflen > sizeof(buf)) + buflen = sizeof(buf); + + do + if (use_pread) + nread = pread(in_fd, buf, buflen, offset); + else + nread = read(in_fd, buf, buflen); + while (nread == -1 && errno == EINTR); + + if (nread == 0) + goto out; + + if (nread == -1) { + if (use_pread && nsent == 0 && (errno == EIO || errno == ESPIPE)) { + use_pread = 0; + continue; + } + + if (nsent == 0) + nsent = -1; + + goto out; + } + + for (nwritten = 0; nwritten < nread; ) { + do + n = write(out_fd, buf + nwritten, nread - nwritten); + while (n == -1 && errno == EINTR); + + if (n != -1) { + nwritten += n; + continue; + } + + if (errno != EAGAIN && errno != EWOULDBLOCK) { + nsent = -1; + goto out; + } + + pfd.fd = out_fd; + pfd.events = POLLOUT; + pfd.revents = 0; + + do + n = poll(&pfd, 1, -1); + while (n == -1 && errno == EINTR); + + if (n == -1 || (pfd.revents & ~POLLOUT) != 0) { + errno = EIO; + nsent = -1; + goto out; + } + } + + offset += nread; + nsent += nread; + } + +out: + if (nsent != -1) + req->off = offset; + + return nsent; +} + + +static ssize_t uv__fs_sendfile(uv_fs_t* req) { + int in_fd; + int out_fd; + + in_fd = req->flags; + out_fd = req->file; + +#if defined(__linux__) || defined(__sun) + { + off_t off; + ssize_t r; + + off = req->off; + r = sendfile(out_fd, in_fd, &off, req->bufsml[0].len); + + /* sendfile() on SunOS returns EINVAL if the target fd is not a socket but + * it still writes out data. Fortunately, we can detect it by checking if + * the offset has been updated. + */ + if (r != -1 || off > req->off) { + r = off - req->off; + req->off = off; + return r; + } + + if (errno == EINVAL || + errno == EIO || + errno == ENOTSOCK || + errno == EXDEV) { + errno = 0; + return uv__fs_sendfile_emul(req); + } + + return -1; + } +#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) + { + off_t len; + ssize_t r; + + /* sendfile() on FreeBSD and Darwin returns EAGAIN if the target fd is in + * non-blocking mode and not all data could be written. If a non-zero + * number of bytes have been sent, we don't consider it an error. + */ + +#if defined(__FreeBSD__) || defined(__DragonFly__) + len = 0; + r = sendfile(in_fd, out_fd, req->off, req->bufsml[0].len, NULL, &len, 0); +#else + /* The darwin sendfile takes len as an input for the length to send, + * so make sure to initialize it with the caller's value. */ + len = req->bufsml[0].len; + r = sendfile(in_fd, out_fd, req->off, &len, NULL, 0); +#endif + + /* + * The man page for sendfile(2) on DragonFly states that `len` contains + * a meaningful value ONLY in case of EAGAIN and EINTR. + * Nothing is said about it's value in case of other errors, so better + * not depend on the potential wrong assumption that is was not modified + * by the syscall. + */ + if (r == 0 || ((errno == EAGAIN || errno == EINTR) && len != 0)) { + req->off += len; + return (ssize_t) len; + } + + if (errno == EINVAL || + errno == EIO || + errno == ENOTSOCK || + errno == EXDEV) { + errno = 0; + return uv__fs_sendfile_emul(req); + } + + return -1; + } +#else + /* Squelch compiler warnings. */ + (void) &in_fd; + (void) &out_fd; + + return uv__fs_sendfile_emul(req); +#endif +} + + +static ssize_t uv__fs_utime(uv_fs_t* req) { + struct utimbuf buf; + buf.actime = req->atime; + buf.modtime = req->mtime; + return utime(req->path, &buf); /* TODO use utimes() where available */ +} + + +static ssize_t uv__fs_write(uv_fs_t* req) { +#if defined(__linux__) + static int no_pwritev; +#endif + ssize_t r; + + /* Serialize writes on OS X, concurrent write() and pwrite() calls result in + * data loss. We can't use a per-file descriptor lock, the descriptor may be + * a dup(). + */ +#if defined(__APPLE__) + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + + if (pthread_mutex_lock(&lock)) + abort(); +#endif + + if (req->off < 0) { + if (req->nbufs == 1) + r = write(req->file, req->bufs[0].base, req->bufs[0].len); + else + r = writev(req->file, (struct iovec*) req->bufs, req->nbufs); + } else { + if (req->nbufs == 1) { + r = pwrite(req->file, req->bufs[0].base, req->bufs[0].len, req->off); + goto done; + } +#if HAVE_PREADV + r = pwritev(req->file, (struct iovec*) req->bufs, req->nbufs, req->off); +#else +# if defined(__linux__) + if (no_pwritev) retry: +# endif + { + off_t written; + size_t index; + + written = 0; + index = 0; + r = 0; + do { + if (req->bufs[index].len > 0) { + r = pwrite(req->file, + req->bufs[index].base, + req->bufs[index].len, + req->off + written); + if (r > 0) + written += r; + } + index++; + } while (index < req->nbufs && r >= 0); + if (written > 0) + r = written; + } +# if defined(__linux__) + else { + r = uv__pwritev(req->file, + (struct iovec*) req->bufs, + req->nbufs, + req->off); + if (r == -1 && errno == ENOSYS) { + no_pwritev = 1; + goto retry; + } + } +# endif +#endif + } + +done: +#if defined(__APPLE__) + if (pthread_mutex_unlock(&lock)) + abort(); +#endif + + return r; +} + +static void uv__to_stat(struct stat* src, uv_stat_t* dst) { + dst->st_dev = src->st_dev; + dst->st_mode = src->st_mode; + dst->st_nlink = src->st_nlink; + dst->st_uid = src->st_uid; + dst->st_gid = src->st_gid; + dst->st_rdev = src->st_rdev; + dst->st_ino = src->st_ino; + dst->st_size = src->st_size; + dst->st_blksize = src->st_blksize; + dst->st_blocks = src->st_blocks; + +#if defined(__APPLE__) + dst->st_atim.tv_sec = src->st_atimespec.tv_sec; + dst->st_atim.tv_nsec = src->st_atimespec.tv_nsec; + dst->st_mtim.tv_sec = src->st_mtimespec.tv_sec; + dst->st_mtim.tv_nsec = src->st_mtimespec.tv_nsec; + dst->st_ctim.tv_sec = src->st_ctimespec.tv_sec; + dst->st_ctim.tv_nsec = src->st_ctimespec.tv_nsec; + dst->st_birthtim.tv_sec = src->st_birthtimespec.tv_sec; + dst->st_birthtim.tv_nsec = src->st_birthtimespec.tv_nsec; + dst->st_flags = src->st_flags; + dst->st_gen = src->st_gen; +#elif defined(__ANDROID__) + dst->st_atim.tv_sec = src->st_atime; + dst->st_atim.tv_nsec = src->st_atime_nsec; + dst->st_mtim.tv_sec = src->st_mtime; + dst->st_mtim.tv_nsec = src->st_mtime_nsec; + dst->st_ctim.tv_sec = src->st_ctime; + dst->st_ctim.tv_nsec = src->st_ctime_nsec; + dst->st_birthtim.tv_sec = src->st_ctime; + dst->st_birthtim.tv_nsec = src->st_ctime_nsec; + dst->st_flags = 0; + dst->st_gen = 0; +#elif !defined(_AIX) && ( \ + defined(_BSD_SOURCE) || \ + defined(_SVID_SOURCE) || \ + defined(_XOPEN_SOURCE) || \ + defined(_DEFAULT_SOURCE)) + dst->st_atim.tv_sec = src->st_atim.tv_sec; + dst->st_atim.tv_nsec = src->st_atim.tv_nsec; + dst->st_mtim.tv_sec = src->st_mtim.tv_sec; + dst->st_mtim.tv_nsec = src->st_mtim.tv_nsec; + dst->st_ctim.tv_sec = src->st_ctim.tv_sec; + dst->st_ctim.tv_nsec = src->st_ctim.tv_nsec; +# if defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) + dst->st_birthtim.tv_sec = src->st_birthtim.tv_sec; + dst->st_birthtim.tv_nsec = src->st_birthtim.tv_nsec; + dst->st_flags = src->st_flags; + dst->st_gen = src->st_gen; +# else + dst->st_birthtim.tv_sec = src->st_ctim.tv_sec; + dst->st_birthtim.tv_nsec = src->st_ctim.tv_nsec; + dst->st_flags = 0; + dst->st_gen = 0; +# endif +#else + dst->st_atim.tv_sec = src->st_atime; + dst->st_atim.tv_nsec = 0; + dst->st_mtim.tv_sec = src->st_mtime; + dst->st_mtim.tv_nsec = 0; + dst->st_ctim.tv_sec = src->st_ctime; + dst->st_ctim.tv_nsec = 0; + dst->st_birthtim.tv_sec = src->st_ctime; + dst->st_birthtim.tv_nsec = 0; + dst->st_flags = 0; + dst->st_gen = 0; +#endif +} + + +static int uv__fs_stat(const char *path, uv_stat_t *buf) { + struct stat pbuf; + int ret; + ret = stat(path, &pbuf); + uv__to_stat(&pbuf, buf); + return ret; +} + + +static int uv__fs_lstat(const char *path, uv_stat_t *buf) { + struct stat pbuf; + int ret; + ret = lstat(path, &pbuf); + uv__to_stat(&pbuf, buf); + return ret; +} + + +static int uv__fs_fstat(int fd, uv_stat_t *buf) { + struct stat pbuf; + int ret; + ret = fstat(fd, &pbuf); + uv__to_stat(&pbuf, buf); + return ret; +} + + +typedef ssize_t (*uv__fs_buf_iter_processor)(uv_fs_t* req); +static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) { + unsigned int iovmax; + unsigned int nbufs; + uv_buf_t* bufs; + ssize_t total; + ssize_t result; + + iovmax = uv__getiovmax(); + nbufs = req->nbufs; + bufs = req->bufs; + total = 0; + + while (nbufs > 0) { + req->nbufs = nbufs; + if (req->nbufs > iovmax) + req->nbufs = iovmax; + + result = process(req); + if (result <= 0) { + if (total == 0) + total = result; + break; + } + + if (req->off >= 0) + req->off += result; + + req->bufs += req->nbufs; + nbufs -= req->nbufs; + total += result; + } + + if (bufs != req->bufsml) + uv__free(bufs); + req->bufs = NULL; + + return total; +} + + +static void uv__fs_work(struct uv__work* w) { + int retry_on_eintr; + uv_fs_t* req; + ssize_t r; + + req = container_of(w, uv_fs_t, work_req); + retry_on_eintr = !(req->fs_type == UV_FS_CLOSE); + + do { + errno = 0; + +#define X(type, action) \ + case UV_FS_ ## type: \ + r = action; \ + break; + + switch (req->fs_type) { + X(ACCESS, access(req->path, req->flags)); + X(CHMOD, chmod(req->path, req->mode)); + X(CHOWN, chown(req->path, req->uid, req->gid)); + X(CLOSE, close(req->file)); + X(FCHMOD, fchmod(req->file, req->mode)); + X(FCHOWN, fchown(req->file, req->uid, req->gid)); + X(FDATASYNC, uv__fs_fdatasync(req)); + X(FSTAT, uv__fs_fstat(req->file, &req->statbuf)); + X(FSYNC, fsync(req->file)); + X(FTRUNCATE, ftruncate(req->file, req->off)); + X(FUTIME, uv__fs_futime(req)); + X(LSTAT, uv__fs_lstat(req->path, &req->statbuf)); + X(LINK, link(req->path, req->new_path)); + X(MKDIR, mkdir(req->path, req->mode)); + X(MKDTEMP, uv__fs_mkdtemp(req)); + X(OPEN, uv__fs_open(req)); + X(READ, uv__fs_buf_iter(req, uv__fs_read)); + X(SCANDIR, uv__fs_scandir(req)); + X(READLINK, uv__fs_readlink(req)); + X(REALPATH, uv__fs_realpath(req)); + X(RENAME, rename(req->path, req->new_path)); + X(RMDIR, rmdir(req->path)); + X(SENDFILE, uv__fs_sendfile(req)); + X(STAT, uv__fs_stat(req->path, &req->statbuf)); + X(SYMLINK, symlink(req->path, req->new_path)); + X(UNLINK, unlink(req->path)); + X(UTIME, uv__fs_utime(req)); + X(WRITE, uv__fs_buf_iter(req, uv__fs_write)); + default: abort(); + } +#undef X + } while (r == -1 && errno == EINTR && retry_on_eintr); + + if (r == -1) + req->result = -errno; + else + req->result = r; + + if (r == 0 && (req->fs_type == UV_FS_STAT || + req->fs_type == UV_FS_FSTAT || + req->fs_type == UV_FS_LSTAT)) { + req->ptr = &req->statbuf; + } +} + + +static void uv__fs_done(struct uv__work* w, int status) { + uv_fs_t* req; + + req = container_of(w, uv_fs_t, work_req); + uv__req_unregister(req->loop, req); + + if (status == -ECANCELED) { + assert(req->result == 0); + req->result = -ECANCELED; + } + + req->cb(req); +} + + +int uv_fs_access(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + uv_fs_cb cb) { + INIT(ACCESS); + PATH; + req->flags = flags; + POST; +} + + +int uv_fs_chmod(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb) { + INIT(CHMOD); + PATH; + req->mode = mode; + POST; +} + + +int uv_fs_chown(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb) { + INIT(CHOWN); + PATH; + req->uid = uid; + req->gid = gid; + POST; +} + + +int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) { + INIT(CLOSE); + req->file = file; + POST; +} + + +int uv_fs_fchmod(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + int mode, + uv_fs_cb cb) { + INIT(FCHMOD); + req->file = file; + req->mode = mode; + POST; +} + + +int uv_fs_fchown(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb) { + INIT(FCHOWN); + req->file = file; + req->uid = uid; + req->gid = gid; + POST; +} + + +int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) { + INIT(FDATASYNC); + req->file = file; + POST; +} + + +int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) { + INIT(FSTAT); + req->file = file; + POST; +} + + +int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) { + INIT(FSYNC); + req->file = file; + POST; +} + + +int uv_fs_ftruncate(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + int64_t off, + uv_fs_cb cb) { + INIT(FTRUNCATE); + req->file = file; + req->off = off; + POST; +} + + +int uv_fs_futime(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + double atime, + double mtime, + uv_fs_cb cb) { + INIT(FUTIME); + req->file = file; + req->atime = atime; + req->mtime = mtime; + POST; +} + + +int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { + INIT(LSTAT); + PATH; + POST; +} + + +int uv_fs_link(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + uv_fs_cb cb) { + INIT(LINK); + PATH2; + POST; +} + + +int uv_fs_mkdir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb) { + INIT(MKDIR); + PATH; + req->mode = mode; + POST; +} + + +int uv_fs_mkdtemp(uv_loop_t* loop, + uv_fs_t* req, + const char* tpl, + uv_fs_cb cb) { + INIT(MKDTEMP); + req->path = uv__strdup(tpl); + if (req->path == NULL) { + if (cb != NULL) + uv__req_unregister(loop, req); + return -ENOMEM; + } + POST; +} + + +int uv_fs_open(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + int mode, + uv_fs_cb cb) { + INIT(OPEN); + PATH; + req->flags = flags; + req->mode = mode; + POST; +} + + +int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, + uv_file file, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t off, + uv_fs_cb cb) { + if (bufs == NULL || nbufs == 0) + return -EINVAL; + + INIT(READ); + req->file = file; + + req->nbufs = nbufs; + req->bufs = req->bufsml; + if (nbufs > ARRAY_SIZE(req->bufsml)) + req->bufs = uv__malloc(nbufs * sizeof(*bufs)); + + if (req->bufs == NULL) { + if (cb != NULL) + uv__req_unregister(loop, req); + return -ENOMEM; + } + + memcpy(req->bufs, bufs, nbufs * sizeof(*bufs)); + + req->off = off; + POST; +} + + +int uv_fs_scandir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + uv_fs_cb cb) { + INIT(SCANDIR); + PATH; + req->flags = flags; + POST; +} + + +int uv_fs_readlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb) { + INIT(READLINK); + PATH; + POST; +} + + +int uv_fs_realpath(uv_loop_t* loop, + uv_fs_t* req, + const char * path, + uv_fs_cb cb) { + INIT(REALPATH); + PATH; + POST; +} + + +int uv_fs_rename(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + uv_fs_cb cb) { + INIT(RENAME); + PATH2; + POST; +} + + +int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { + INIT(RMDIR); + PATH; + POST; +} + + +int uv_fs_sendfile(uv_loop_t* loop, + uv_fs_t* req, + uv_file out_fd, + uv_file in_fd, + int64_t off, + size_t len, + uv_fs_cb cb) { + INIT(SENDFILE); + req->flags = in_fd; /* hack */ + req->file = out_fd; + req->off = off; + req->bufsml[0].len = len; + POST; +} + + +int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { + INIT(STAT); + PATH; + POST; +} + + +int uv_fs_symlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + int flags, + uv_fs_cb cb) { + INIT(SYMLINK); + PATH2; + req->flags = flags; + POST; +} + + +int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { + INIT(UNLINK); + PATH; + POST; +} + + +int uv_fs_utime(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + double atime, + double mtime, + uv_fs_cb cb) { + INIT(UTIME); + PATH; + req->atime = atime; + req->mtime = mtime; + POST; +} + + +int uv_fs_write(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t off, + uv_fs_cb cb) { + if (bufs == NULL || nbufs == 0) + return -EINVAL; + + INIT(WRITE); + req->file = file; + + req->nbufs = nbufs; + req->bufs = req->bufsml; + if (nbufs > ARRAY_SIZE(req->bufsml)) + req->bufs = uv__malloc(nbufs * sizeof(*bufs)); + + if (req->bufs == NULL) { + if (cb != NULL) + uv__req_unregister(loop, req); + return -ENOMEM; + } + + memcpy(req->bufs, bufs, nbufs * sizeof(*bufs)); + + req->off = off; + POST; +} + + +void uv_fs_req_cleanup(uv_fs_t* req) { + /* Only necessary for asychronous requests, i.e., requests with a callback. + * Synchronous ones don't copy their arguments and have req->path and + * req->new_path pointing to user-owned memory. UV_FS_MKDTEMP is the + * exception to the rule, it always allocates memory. + */ + if (req->path != NULL && (req->cb != NULL || req->fs_type == UV_FS_MKDTEMP)) + uv__free((void*) req->path); /* Memory is shared with req->new_path. */ + + req->path = NULL; + req->new_path = NULL; + + if (req->fs_type == UV_FS_SCANDIR && req->ptr != NULL) + uv__fs_scandir_cleanup(req); + + if (req->ptr != &req->statbuf) + uv__free(req->ptr); + req->ptr = NULL; +} diff --git a/3rdparty/libuv/src/unix/fsevents.c b/3rdparty/libuv/src/unix/fsevents.c new file mode 100644 index 00000000000..d331a131726 --- /dev/null +++ b/3rdparty/libuv/src/unix/fsevents.c @@ -0,0 +1,904 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#if TARGET_OS_IPHONE + +/* iOS (currently) doesn't provide the FSEvents-API (nor CoreServices) */ + +int uv__fsevents_init(uv_fs_event_t* handle) { + return 0; +} + + +int uv__fsevents_close(uv_fs_event_t* handle) { + return 0; +} + + +void uv__fsevents_loop_delete(uv_loop_t* loop) { +} + +#else /* TARGET_OS_IPHONE */ + +#include +#include +#include +#include + +#include +#include + +/* These are macros to avoid "initializer element is not constant" errors + * with old versions of gcc. + */ +#define kFSEventsModified (kFSEventStreamEventFlagItemFinderInfoMod | \ + kFSEventStreamEventFlagItemModified | \ + kFSEventStreamEventFlagItemInodeMetaMod | \ + kFSEventStreamEventFlagItemChangeOwner | \ + kFSEventStreamEventFlagItemXattrMod) + +#define kFSEventsRenamed (kFSEventStreamEventFlagItemCreated | \ + kFSEventStreamEventFlagItemRemoved | \ + kFSEventStreamEventFlagItemRenamed) + +#define kFSEventsSystem (kFSEventStreamEventFlagUserDropped | \ + kFSEventStreamEventFlagKernelDropped | \ + kFSEventStreamEventFlagEventIdsWrapped | \ + kFSEventStreamEventFlagHistoryDone | \ + kFSEventStreamEventFlagMount | \ + kFSEventStreamEventFlagUnmount | \ + kFSEventStreamEventFlagRootChanged) + +typedef struct uv__fsevents_event_s uv__fsevents_event_t; +typedef struct uv__cf_loop_signal_s uv__cf_loop_signal_t; +typedef struct uv__cf_loop_state_s uv__cf_loop_state_t; + +enum uv__cf_loop_signal_type_e { + kUVCFLoopSignalRegular, + kUVCFLoopSignalClosing +}; +typedef enum uv__cf_loop_signal_type_e uv__cf_loop_signal_type_t; + +struct uv__cf_loop_signal_s { + QUEUE member; + uv_fs_event_t* handle; + uv__cf_loop_signal_type_t type; +}; + +struct uv__fsevents_event_s { + QUEUE member; + int events; + char path[1]; +}; + +struct uv__cf_loop_state_s { + CFRunLoopRef loop; + CFRunLoopSourceRef signal_source; + int fsevent_need_reschedule; + FSEventStreamRef fsevent_stream; + uv_sem_t fsevent_sem; + uv_mutex_t fsevent_mutex; + void* fsevent_handles[2]; + unsigned int fsevent_handle_count; +}; + +/* Forward declarations */ +static void uv__cf_loop_cb(void* arg); +static void* uv__cf_loop_runner(void* arg); +static int uv__cf_loop_signal(uv_loop_t* loop, + uv_fs_event_t* handle, + uv__cf_loop_signal_type_t type); + +/* Lazy-loaded by uv__fsevents_global_init(). */ +static CFArrayRef (*pCFArrayCreate)(CFAllocatorRef, + const void**, + CFIndex, + const CFArrayCallBacks*); +static void (*pCFRelease)(CFTypeRef); +static void (*pCFRunLoopAddSource)(CFRunLoopRef, + CFRunLoopSourceRef, + CFStringRef); +static CFRunLoopRef (*pCFRunLoopGetCurrent)(void); +static void (*pCFRunLoopRemoveSource)(CFRunLoopRef, + CFRunLoopSourceRef, + CFStringRef); +static void (*pCFRunLoopRun)(void); +static CFRunLoopSourceRef (*pCFRunLoopSourceCreate)(CFAllocatorRef, + CFIndex, + CFRunLoopSourceContext*); +static void (*pCFRunLoopSourceSignal)(CFRunLoopSourceRef); +static void (*pCFRunLoopStop)(CFRunLoopRef); +static void (*pCFRunLoopWakeUp)(CFRunLoopRef); +static CFStringRef (*pCFStringCreateWithFileSystemRepresentation)( + CFAllocatorRef, + const char*); +static CFStringEncoding (*pCFStringGetSystemEncoding)(void); +static CFStringRef (*pkCFRunLoopDefaultMode); +static FSEventStreamRef (*pFSEventStreamCreate)(CFAllocatorRef, + FSEventStreamCallback, + FSEventStreamContext*, + CFArrayRef, + FSEventStreamEventId, + CFTimeInterval, + FSEventStreamCreateFlags); +static void (*pFSEventStreamFlushSync)(FSEventStreamRef); +static void (*pFSEventStreamInvalidate)(FSEventStreamRef); +static void (*pFSEventStreamRelease)(FSEventStreamRef); +static void (*pFSEventStreamScheduleWithRunLoop)(FSEventStreamRef, + CFRunLoopRef, + CFStringRef); +static Boolean (*pFSEventStreamStart)(FSEventStreamRef); +static void (*pFSEventStreamStop)(FSEventStreamRef); + +#define UV__FSEVENTS_PROCESS(handle, block) \ + do { \ + QUEUE events; \ + QUEUE* q; \ + uv__fsevents_event_t* event; \ + int err; \ + uv_mutex_lock(&(handle)->cf_mutex); \ + /* Split-off all events and empty original queue */ \ + QUEUE_MOVE(&(handle)->cf_events, &events); \ + /* Get error (if any) and zero original one */ \ + err = (handle)->cf_error; \ + (handle)->cf_error = 0; \ + uv_mutex_unlock(&(handle)->cf_mutex); \ + /* Loop through events, deallocating each after processing */ \ + while (!QUEUE_EMPTY(&events)) { \ + q = QUEUE_HEAD(&events); \ + event = QUEUE_DATA(q, uv__fsevents_event_t, member); \ + QUEUE_REMOVE(q); \ + /* NOTE: Checking uv__is_active() is required here, because handle \ + * callback may close handle and invoking it after it will lead to \ + * incorrect behaviour */ \ + if (!uv__is_closing((handle)) && uv__is_active((handle))) \ + block \ + /* Free allocated data */ \ + uv__free(event); \ + } \ + if (err != 0 && !uv__is_closing((handle)) && uv__is_active((handle))) \ + (handle)->cb((handle), NULL, 0, err); \ + } while (0) + + +/* Runs in UV loop's thread, when there're events to report to handle */ +static void uv__fsevents_cb(uv_async_t* cb) { + uv_fs_event_t* handle; + + handle = cb->data; + + UV__FSEVENTS_PROCESS(handle, { + handle->cb(handle, event->path[0] ? event->path : NULL, event->events, 0); + }); +} + + +/* Runs in CF thread, pushed event into handle's event list */ +static void uv__fsevents_push_event(uv_fs_event_t* handle, + QUEUE* events, + int err) { + assert(events != NULL || err != 0); + uv_mutex_lock(&handle->cf_mutex); + + /* Concatenate two queues */ + if (events != NULL) + QUEUE_ADD(&handle->cf_events, events); + + /* Propagate error */ + if (err != 0) + handle->cf_error = err; + uv_mutex_unlock(&handle->cf_mutex); + + uv_async_send(handle->cf_cb); +} + + +/* Runs in CF thread, when there're events in FSEventStream */ +static void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef, + void* info, + size_t numEvents, + void* eventPaths, + const FSEventStreamEventFlags eventFlags[], + const FSEventStreamEventId eventIds[]) { + size_t i; + int len; + char** paths; + char* path; + char* pos; + uv_fs_event_t* handle; + QUEUE* q; + uv_loop_t* loop; + uv__cf_loop_state_t* state; + uv__fsevents_event_t* event; + QUEUE head; + + loop = info; + state = loop->cf_state; + assert(state != NULL); + paths = eventPaths; + + /* For each handle */ + uv_mutex_lock(&state->fsevent_mutex); + QUEUE_FOREACH(q, &state->fsevent_handles) { + handle = QUEUE_DATA(q, uv_fs_event_t, cf_member); + QUEUE_INIT(&head); + + /* Process and filter out events */ + for (i = 0; i < numEvents; i++) { + /* Ignore system events */ + if (eventFlags[i] & kFSEventsSystem) + continue; + + path = paths[i]; + len = strlen(path); + + /* Filter out paths that are outside handle's request */ + if (strncmp(path, handle->realpath, handle->realpath_len) != 0) + continue; + + if (handle->realpath_len > 1 || *handle->realpath != '/') { + path += handle->realpath_len; + len -= handle->realpath_len; + + /* Skip forward slash */ + if (*path != '\0') { + path++; + len--; + } + } + +#ifdef MAC_OS_X_VERSION_10_7 + /* Ignore events with path equal to directory itself */ + if (len == 0) + continue; +#endif /* MAC_OS_X_VERSION_10_7 */ + + /* Do not emit events from subdirectories (without option set) */ + if ((handle->cf_flags & UV_FS_EVENT_RECURSIVE) == 0 && *path != 0) { + pos = strchr(path + 1, '/'); + if (pos != NULL) + continue; + } + +#ifndef MAC_OS_X_VERSION_10_7 + path = ""; + len = 0; +#endif /* MAC_OS_X_VERSION_10_7 */ + + event = uv__malloc(sizeof(*event) + len); + if (event == NULL) + break; + + memset(event, 0, sizeof(*event)); + memcpy(event->path, path, len + 1); + + if ((eventFlags[i] & kFSEventsModified) != 0 && + (eventFlags[i] & kFSEventsRenamed) == 0) + event->events = UV_CHANGE; + else + event->events = UV_RENAME; + + QUEUE_INSERT_TAIL(&head, &event->member); + } + + if (!QUEUE_EMPTY(&head)) + uv__fsevents_push_event(handle, &head, 0); + } + uv_mutex_unlock(&state->fsevent_mutex); +} + + +/* Runs in CF thread */ +static int uv__fsevents_create_stream(uv_loop_t* loop, CFArrayRef paths) { + uv__cf_loop_state_t* state; + FSEventStreamContext ctx; + FSEventStreamRef ref; + CFAbsoluteTime latency; + FSEventStreamCreateFlags flags; + + /* Initialize context */ + ctx.version = 0; + ctx.info = loop; + ctx.retain = NULL; + ctx.release = NULL; + ctx.copyDescription = NULL; + + latency = 0.05; + + /* Explanation of selected flags: + * 1. NoDefer - without this flag, events that are happening continuously + * (i.e. each event is happening after time interval less than `latency`, + * counted from previous event), will be deferred and passed to callback + * once they'll either fill whole OS buffer, or when this continuous stream + * will stop (i.e. there'll be delay between events, bigger than + * `latency`). + * Specifying this flag will invoke callback after `latency` time passed + * since event. + * 2. FileEvents - fire callback for file changes too (by default it is firing + * it only for directory changes). + */ + flags = kFSEventStreamCreateFlagNoDefer | kFSEventStreamCreateFlagFileEvents; + + /* + * NOTE: It might sound like a good idea to remember last seen StreamEventId, + * but in reality one dir might have last StreamEventId less than, the other, + * that is being watched now. Which will cause FSEventStream API to report + * changes to files from the past. + */ + ref = pFSEventStreamCreate(NULL, + &uv__fsevents_event_cb, + &ctx, + paths, + kFSEventStreamEventIdSinceNow, + latency, + flags); + assert(ref != NULL); + + state = loop->cf_state; + pFSEventStreamScheduleWithRunLoop(ref, + state->loop, + *pkCFRunLoopDefaultMode); + if (!pFSEventStreamStart(ref)) { + pFSEventStreamInvalidate(ref); + pFSEventStreamRelease(ref); + return -EMFILE; + } + + state->fsevent_stream = ref; + return 0; +} + + +/* Runs in CF thread */ +static void uv__fsevents_destroy_stream(uv_loop_t* loop) { + uv__cf_loop_state_t* state; + + state = loop->cf_state; + + if (state->fsevent_stream == NULL) + return; + + /* Flush all accumulated events */ + pFSEventStreamFlushSync(state->fsevent_stream); + + /* Stop emitting events */ + pFSEventStreamStop(state->fsevent_stream); + + /* Release stream */ + pFSEventStreamInvalidate(state->fsevent_stream); + pFSEventStreamRelease(state->fsevent_stream); + state->fsevent_stream = NULL; +} + + +/* Runs in CF thread, when there're new fsevent handles to add to stream */ +static void uv__fsevents_reschedule(uv_fs_event_t* handle, + uv__cf_loop_signal_type_t type) { + uv__cf_loop_state_t* state; + QUEUE* q; + uv_fs_event_t* curr; + CFArrayRef cf_paths; + CFStringRef* paths; + unsigned int i; + int err; + unsigned int path_count; + + state = handle->loop->cf_state; + paths = NULL; + cf_paths = NULL; + err = 0; + /* NOTE: `i` is used in deallocation loop below */ + i = 0; + + /* Optimization to prevent O(n^2) time spent when starting to watch + * many files simultaneously + */ + uv_mutex_lock(&state->fsevent_mutex); + if (state->fsevent_need_reschedule == 0) { + uv_mutex_unlock(&state->fsevent_mutex); + goto final; + } + state->fsevent_need_reschedule = 0; + uv_mutex_unlock(&state->fsevent_mutex); + + /* Destroy previous FSEventStream */ + uv__fsevents_destroy_stream(handle->loop); + + /* Any failure below will be a memory failure */ + err = -ENOMEM; + + /* Create list of all watched paths */ + uv_mutex_lock(&state->fsevent_mutex); + path_count = state->fsevent_handle_count; + if (path_count != 0) { + paths = uv__malloc(sizeof(*paths) * path_count); + if (paths == NULL) { + uv_mutex_unlock(&state->fsevent_mutex); + goto final; + } + + q = &state->fsevent_handles; + for (; i < path_count; i++) { + q = QUEUE_NEXT(q); + assert(q != &state->fsevent_handles); + curr = QUEUE_DATA(q, uv_fs_event_t, cf_member); + + assert(curr->realpath != NULL); + paths[i] = + pCFStringCreateWithFileSystemRepresentation(NULL, curr->realpath); + if (paths[i] == NULL) { + uv_mutex_unlock(&state->fsevent_mutex); + goto final; + } + } + } + uv_mutex_unlock(&state->fsevent_mutex); + err = 0; + + if (path_count != 0) { + /* Create new FSEventStream */ + cf_paths = pCFArrayCreate(NULL, (const void**) paths, path_count, NULL); + if (cf_paths == NULL) { + err = -ENOMEM; + goto final; + } + err = uv__fsevents_create_stream(handle->loop, cf_paths); + } + +final: + /* Deallocate all paths in case of failure */ + if (err != 0) { + if (cf_paths == NULL) { + while (i != 0) + pCFRelease(paths[--i]); + uv__free(paths); + } else { + /* CFArray takes ownership of both strings and original C-array */ + pCFRelease(cf_paths); + } + + /* Broadcast error to all handles */ + uv_mutex_lock(&state->fsevent_mutex); + QUEUE_FOREACH(q, &state->fsevent_handles) { + curr = QUEUE_DATA(q, uv_fs_event_t, cf_member); + uv__fsevents_push_event(curr, NULL, err); + } + uv_mutex_unlock(&state->fsevent_mutex); + } + + /* + * Main thread will block until the removal of handle from the list, + * we must tell it when we're ready. + * + * NOTE: This is coupled with `uv_sem_wait()` in `uv__fsevents_close` + */ + if (type == kUVCFLoopSignalClosing) + uv_sem_post(&state->fsevent_sem); +} + + +static int uv__fsevents_global_init(void) { + static pthread_mutex_t global_init_mutex = PTHREAD_MUTEX_INITIALIZER; + static void* core_foundation_handle; + static void* core_services_handle; + int err; + + err = 0; + pthread_mutex_lock(&global_init_mutex); + if (core_foundation_handle != NULL) + goto out; + + /* The libraries are never unloaded because we currently don't have a good + * mechanism for keeping a reference count. It's unlikely to be an issue + * but if it ever becomes one, we can turn the dynamic library handles into + * per-event loop properties and have the dynamic linker keep track for us. + */ + err = -ENOSYS; + core_foundation_handle = dlopen("/System/Library/Frameworks/" + "CoreFoundation.framework/" + "Versions/A/CoreFoundation", + RTLD_LAZY | RTLD_LOCAL); + if (core_foundation_handle == NULL) + goto out; + + core_services_handle = dlopen("/System/Library/Frameworks/" + "CoreServices.framework/" + "Versions/A/CoreServices", + RTLD_LAZY | RTLD_LOCAL); + if (core_services_handle == NULL) + goto out; + + err = -ENOENT; +#define V(handle, symbol) \ + do { \ + *(void **)(&p ## symbol) = dlsym((handle), #symbol); \ + if (p ## symbol == NULL) \ + goto out; \ + } \ + while (0) + V(core_foundation_handle, CFArrayCreate); + V(core_foundation_handle, CFRelease); + V(core_foundation_handle, CFRunLoopAddSource); + V(core_foundation_handle, CFRunLoopGetCurrent); + V(core_foundation_handle, CFRunLoopRemoveSource); + V(core_foundation_handle, CFRunLoopRun); + V(core_foundation_handle, CFRunLoopSourceCreate); + V(core_foundation_handle, CFRunLoopSourceSignal); + V(core_foundation_handle, CFRunLoopStop); + V(core_foundation_handle, CFRunLoopWakeUp); + V(core_foundation_handle, CFStringCreateWithFileSystemRepresentation); + V(core_foundation_handle, CFStringGetSystemEncoding); + V(core_foundation_handle, kCFRunLoopDefaultMode); + V(core_services_handle, FSEventStreamCreate); + V(core_services_handle, FSEventStreamFlushSync); + V(core_services_handle, FSEventStreamInvalidate); + V(core_services_handle, FSEventStreamRelease); + V(core_services_handle, FSEventStreamScheduleWithRunLoop); + V(core_services_handle, FSEventStreamStart); + V(core_services_handle, FSEventStreamStop); +#undef V + err = 0; + +out: + if (err && core_services_handle != NULL) { + dlclose(core_services_handle); + core_services_handle = NULL; + } + + if (err && core_foundation_handle != NULL) { + dlclose(core_foundation_handle); + core_foundation_handle = NULL; + } + + pthread_mutex_unlock(&global_init_mutex); + return err; +} + + +/* Runs in UV loop */ +static int uv__fsevents_loop_init(uv_loop_t* loop) { + CFRunLoopSourceContext ctx; + uv__cf_loop_state_t* state; + pthread_attr_t attr_storage; + pthread_attr_t* attr; + int err; + + if (loop->cf_state != NULL) + return 0; + + err = uv__fsevents_global_init(); + if (err) + return err; + + state = uv__calloc(1, sizeof(*state)); + if (state == NULL) + return -ENOMEM; + + err = uv_mutex_init(&loop->cf_mutex); + if (err) + goto fail_mutex_init; + + err = uv_sem_init(&loop->cf_sem, 0); + if (err) + goto fail_sem_init; + + QUEUE_INIT(&loop->cf_signals); + + err = uv_sem_init(&state->fsevent_sem, 0); + if (err) + goto fail_fsevent_sem_init; + + err = uv_mutex_init(&state->fsevent_mutex); + if (err) + goto fail_fsevent_mutex_init; + + QUEUE_INIT(&state->fsevent_handles); + state->fsevent_need_reschedule = 0; + state->fsevent_handle_count = 0; + + memset(&ctx, 0, sizeof(ctx)); + ctx.info = loop; + ctx.perform = uv__cf_loop_cb; + state->signal_source = pCFRunLoopSourceCreate(NULL, 0, &ctx); + if (state->signal_source == NULL) { + err = -ENOMEM; + goto fail_signal_source_create; + } + + /* In the unlikely event that pthread_attr_init() fails, create the thread + * with the default stack size. We'll use a little more address space but + * that in itself is not a fatal error. + */ + attr = &attr_storage; + if (pthread_attr_init(attr)) + attr = NULL; + + if (attr != NULL) + if (pthread_attr_setstacksize(attr, 4 * PTHREAD_STACK_MIN)) + abort(); + + loop->cf_state = state; + + /* uv_thread_t is an alias for pthread_t. */ + err = -pthread_create(&loop->cf_thread, attr, uv__cf_loop_runner, loop); + + if (attr != NULL) + pthread_attr_destroy(attr); + + if (err) + goto fail_thread_create; + + /* Synchronize threads */ + uv_sem_wait(&loop->cf_sem); + return 0; + +fail_thread_create: + loop->cf_state = NULL; + +fail_signal_source_create: + uv_mutex_destroy(&state->fsevent_mutex); + +fail_fsevent_mutex_init: + uv_sem_destroy(&state->fsevent_sem); + +fail_fsevent_sem_init: + uv_sem_destroy(&loop->cf_sem); + +fail_sem_init: + uv_mutex_destroy(&loop->cf_mutex); + +fail_mutex_init: + uv__free(state); + return err; +} + + +/* Runs in UV loop */ +void uv__fsevents_loop_delete(uv_loop_t* loop) { + uv__cf_loop_signal_t* s; + uv__cf_loop_state_t* state; + QUEUE* q; + + if (loop->cf_state == NULL) + return; + + if (uv__cf_loop_signal(loop, NULL, kUVCFLoopSignalRegular) != 0) + abort(); + + uv_thread_join(&loop->cf_thread); + uv_sem_destroy(&loop->cf_sem); + uv_mutex_destroy(&loop->cf_mutex); + + /* Free any remaining data */ + while (!QUEUE_EMPTY(&loop->cf_signals)) { + q = QUEUE_HEAD(&loop->cf_signals); + s = QUEUE_DATA(q, uv__cf_loop_signal_t, member); + QUEUE_REMOVE(q); + uv__free(s); + } + + /* Destroy state */ + state = loop->cf_state; + uv_sem_destroy(&state->fsevent_sem); + uv_mutex_destroy(&state->fsevent_mutex); + pCFRelease(state->signal_source); + uv__free(state); + loop->cf_state = NULL; +} + + +/* Runs in CF thread. This is the CF loop's body */ +static void* uv__cf_loop_runner(void* arg) { + uv_loop_t* loop; + uv__cf_loop_state_t* state; + + loop = arg; + state = loop->cf_state; + state->loop = pCFRunLoopGetCurrent(); + + pCFRunLoopAddSource(state->loop, + state->signal_source, + *pkCFRunLoopDefaultMode); + + uv_sem_post(&loop->cf_sem); + + pCFRunLoopRun(); + pCFRunLoopRemoveSource(state->loop, + state->signal_source, + *pkCFRunLoopDefaultMode); + + return NULL; +} + + +/* Runs in CF thread, executed after `uv__cf_loop_signal()` */ +static void uv__cf_loop_cb(void* arg) { + uv_loop_t* loop; + uv__cf_loop_state_t* state; + QUEUE* item; + QUEUE split_head; + uv__cf_loop_signal_t* s; + + loop = arg; + state = loop->cf_state; + + uv_mutex_lock(&loop->cf_mutex); + QUEUE_MOVE(&loop->cf_signals, &split_head); + uv_mutex_unlock(&loop->cf_mutex); + + while (!QUEUE_EMPTY(&split_head)) { + item = QUEUE_HEAD(&split_head); + QUEUE_REMOVE(item); + + s = QUEUE_DATA(item, uv__cf_loop_signal_t, member); + + /* This was a termination signal */ + if (s->handle == NULL) + pCFRunLoopStop(state->loop); + else + uv__fsevents_reschedule(s->handle, s->type); + + uv__free(s); + } +} + + +/* Runs in UV loop to notify CF thread */ +int uv__cf_loop_signal(uv_loop_t* loop, + uv_fs_event_t* handle, + uv__cf_loop_signal_type_t type) { + uv__cf_loop_signal_t* item; + uv__cf_loop_state_t* state; + + item = uv__malloc(sizeof(*item)); + if (item == NULL) + return -ENOMEM; + + item->handle = handle; + item->type = type; + + uv_mutex_lock(&loop->cf_mutex); + QUEUE_INSERT_TAIL(&loop->cf_signals, &item->member); + uv_mutex_unlock(&loop->cf_mutex); + + state = loop->cf_state; + assert(state != NULL); + pCFRunLoopSourceSignal(state->signal_source); + pCFRunLoopWakeUp(state->loop); + + return 0; +} + + +/* Runs in UV loop to initialize handle */ +int uv__fsevents_init(uv_fs_event_t* handle) { + int err; + uv__cf_loop_state_t* state; + + err = uv__fsevents_loop_init(handle->loop); + if (err) + return err; + + /* Get absolute path to file */ + handle->realpath = realpath(handle->path, NULL); + if (handle->realpath == NULL) + return -errno; + handle->realpath_len = strlen(handle->realpath); + + /* Initialize event queue */ + QUEUE_INIT(&handle->cf_events); + handle->cf_error = 0; + + /* + * Events will occur in other thread. + * Initialize callback for getting them back into event loop's thread + */ + handle->cf_cb = uv__malloc(sizeof(*handle->cf_cb)); + if (handle->cf_cb == NULL) { + err = -ENOMEM; + goto fail_cf_cb_malloc; + } + + handle->cf_cb->data = handle; + uv_async_init(handle->loop, handle->cf_cb, uv__fsevents_cb); + handle->cf_cb->flags |= UV__HANDLE_INTERNAL; + uv_unref((uv_handle_t*) handle->cf_cb); + + err = uv_mutex_init(&handle->cf_mutex); + if (err) + goto fail_cf_mutex_init; + + /* Insert handle into the list */ + state = handle->loop->cf_state; + uv_mutex_lock(&state->fsevent_mutex); + QUEUE_INSERT_TAIL(&state->fsevent_handles, &handle->cf_member); + state->fsevent_handle_count++; + state->fsevent_need_reschedule = 1; + uv_mutex_unlock(&state->fsevent_mutex); + + /* Reschedule FSEventStream */ + assert(handle != NULL); + err = uv__cf_loop_signal(handle->loop, handle, kUVCFLoopSignalRegular); + if (err) + goto fail_loop_signal; + + return 0; + +fail_loop_signal: + uv_mutex_destroy(&handle->cf_mutex); + +fail_cf_mutex_init: + uv__free(handle->cf_cb); + handle->cf_cb = NULL; + +fail_cf_cb_malloc: + uv__free(handle->realpath); + handle->realpath = NULL; + handle->realpath_len = 0; + + return err; +} + + +/* Runs in UV loop to de-initialize handle */ +int uv__fsevents_close(uv_fs_event_t* handle) { + int err; + uv__cf_loop_state_t* state; + + if (handle->cf_cb == NULL) + return -EINVAL; + + /* Remove handle from the list */ + state = handle->loop->cf_state; + uv_mutex_lock(&state->fsevent_mutex); + QUEUE_REMOVE(&handle->cf_member); + state->fsevent_handle_count--; + state->fsevent_need_reschedule = 1; + uv_mutex_unlock(&state->fsevent_mutex); + + /* Reschedule FSEventStream */ + assert(handle != NULL); + err = uv__cf_loop_signal(handle->loop, handle, kUVCFLoopSignalClosing); + if (err) + return -err; + + /* Wait for deinitialization */ + uv_sem_wait(&state->fsevent_sem); + + uv_close((uv_handle_t*) handle->cf_cb, (uv_close_cb) uv__free); + handle->cf_cb = NULL; + + /* Free data in queue */ + UV__FSEVENTS_PROCESS(handle, { + /* NOP */ + }); + + uv_mutex_destroy(&handle->cf_mutex); + uv__free(handle->realpath); + handle->realpath = NULL; + handle->realpath_len = 0; + + return 0; +} + +#endif /* TARGET_OS_IPHONE */ diff --git a/3rdparty/libuv/src/unix/getaddrinfo.c b/3rdparty/libuv/src/unix/getaddrinfo.c new file mode 100644 index 00000000000..2049aea2f38 --- /dev/null +++ b/3rdparty/libuv/src/unix/getaddrinfo.c @@ -0,0 +1,202 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* Expose glibc-specific EAI_* error codes. Needs to be defined before we + * include any headers. + */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif + +#include "uv.h" +#include "internal.h" + +#include +#include /* NULL */ +#include +#include + +/* EAI_* constants. */ +#include + + +int uv__getaddrinfo_translate_error(int sys_err) { + switch (sys_err) { + case 0: return 0; +#if defined(EAI_ADDRFAMILY) + case EAI_ADDRFAMILY: return UV_EAI_ADDRFAMILY; +#endif +#if defined(EAI_AGAIN) + case EAI_AGAIN: return UV_EAI_AGAIN; +#endif +#if defined(EAI_BADFLAGS) + case EAI_BADFLAGS: return UV_EAI_BADFLAGS; +#endif +#if defined(EAI_BADHINTS) + case EAI_BADHINTS: return UV_EAI_BADHINTS; +#endif +#if defined(EAI_CANCELED) + case EAI_CANCELED: return UV_EAI_CANCELED; +#endif +#if defined(EAI_FAIL) + case EAI_FAIL: return UV_EAI_FAIL; +#endif +#if defined(EAI_FAMILY) + case EAI_FAMILY: return UV_EAI_FAMILY; +#endif +#if defined(EAI_MEMORY) + case EAI_MEMORY: return UV_EAI_MEMORY; +#endif +#if defined(EAI_NODATA) + case EAI_NODATA: return UV_EAI_NODATA; +#endif +#if defined(EAI_NONAME) +# if !defined(EAI_NODATA) || EAI_NODATA != EAI_NONAME + case EAI_NONAME: return UV_EAI_NONAME; +# endif +#endif +#if defined(EAI_OVERFLOW) + case EAI_OVERFLOW: return UV_EAI_OVERFLOW; +#endif +#if defined(EAI_PROTOCOL) + case EAI_PROTOCOL: return UV_EAI_PROTOCOL; +#endif +#if defined(EAI_SERVICE) + case EAI_SERVICE: return UV_EAI_SERVICE; +#endif +#if defined(EAI_SOCKTYPE) + case EAI_SOCKTYPE: return UV_EAI_SOCKTYPE; +#endif +#if defined(EAI_SYSTEM) + case EAI_SYSTEM: return -errno; +#endif + } + assert(!"unknown EAI_* error code"); + abort(); + return 0; /* Pacify compiler. */ +} + + +static void uv__getaddrinfo_work(struct uv__work* w) { + uv_getaddrinfo_t* req; + int err; + + req = container_of(w, uv_getaddrinfo_t, work_req); + err = getaddrinfo(req->hostname, req->service, req->hints, &req->addrinfo); + req->retcode = uv__getaddrinfo_translate_error(err); +} + + +static void uv__getaddrinfo_done(struct uv__work* w, int status) { + uv_getaddrinfo_t* req; + + req = container_of(w, uv_getaddrinfo_t, work_req); + uv__req_unregister(req->loop, req); + + /* See initialization in uv_getaddrinfo(). */ + if (req->hints) + uv__free(req->hints); + else if (req->service) + uv__free(req->service); + else if (req->hostname) + uv__free(req->hostname); + else + assert(0); + + req->hints = NULL; + req->service = NULL; + req->hostname = NULL; + + if (status == -ECANCELED) { + assert(req->retcode == 0); + req->retcode = UV_EAI_CANCELED; + } + + if (req->cb) + req->cb(req, req->retcode, req->addrinfo); +} + + +int uv_getaddrinfo(uv_loop_t* loop, + uv_getaddrinfo_t* req, + uv_getaddrinfo_cb cb, + const char* hostname, + const char* service, + const struct addrinfo* hints) { + size_t hostname_len; + size_t service_len; + size_t hints_len; + size_t len; + char* buf; + + if (req == NULL || (hostname == NULL && service == NULL)) + return -EINVAL; + + hostname_len = hostname ? strlen(hostname) + 1 : 0; + service_len = service ? strlen(service) + 1 : 0; + hints_len = hints ? sizeof(*hints) : 0; + buf = uv__malloc(hostname_len + service_len + hints_len); + + if (buf == NULL) + return -ENOMEM; + + uv__req_init(loop, req, UV_GETADDRINFO); + req->loop = loop; + req->cb = cb; + req->addrinfo = NULL; + req->hints = NULL; + req->service = NULL; + req->hostname = NULL; + req->retcode = 0; + + /* order matters, see uv_getaddrinfo_done() */ + len = 0; + + if (hints) { + req->hints = memcpy(buf + len, hints, sizeof(*hints)); + len += sizeof(*hints); + } + + if (service) { + req->service = memcpy(buf + len, service, service_len); + len += service_len; + } + + if (hostname) + req->hostname = memcpy(buf + len, hostname, hostname_len); + + if (cb) { + uv__work_submit(loop, + &req->work_req, + uv__getaddrinfo_work, + uv__getaddrinfo_done); + return 0; + } else { + uv__getaddrinfo_work(&req->work_req); + uv__getaddrinfo_done(&req->work_req, 0); + return req->retcode; + } +} + + +void uv_freeaddrinfo(struct addrinfo* ai) { + if (ai) + freeaddrinfo(ai); +} diff --git a/3rdparty/libuv/src/unix/getnameinfo.c b/3rdparty/libuv/src/unix/getnameinfo.c new file mode 100644 index 00000000000..daa798a450e --- /dev/null +++ b/3rdparty/libuv/src/unix/getnameinfo.c @@ -0,0 +1,120 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to +* deal in the Software without restriction, including without limitation the +* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +* sell copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +*/ + +#include +#include +#include +#include + +#include "uv.h" +#include "internal.h" + + +static void uv__getnameinfo_work(struct uv__work* w) { + uv_getnameinfo_t* req; + int err; + socklen_t salen; + + req = container_of(w, uv_getnameinfo_t, work_req); + + if (req->storage.ss_family == AF_INET) + salen = sizeof(struct sockaddr_in); + else if (req->storage.ss_family == AF_INET6) + salen = sizeof(struct sockaddr_in6); + else + abort(); + + err = getnameinfo((struct sockaddr*) &req->storage, + salen, + req->host, + sizeof(req->host), + req->service, + sizeof(req->service), + req->flags); + req->retcode = uv__getaddrinfo_translate_error(err); +} + +static void uv__getnameinfo_done(struct uv__work* w, int status) { + uv_getnameinfo_t* req; + char* host; + char* service; + + req = container_of(w, uv_getnameinfo_t, work_req); + uv__req_unregister(req->loop, req); + host = service = NULL; + + if (status == -ECANCELED) { + assert(req->retcode == 0); + req->retcode = UV_EAI_CANCELED; + } else if (req->retcode == 0) { + host = req->host; + service = req->service; + } + + if (req->getnameinfo_cb) + req->getnameinfo_cb(req, req->retcode, host, service); +} + +/* +* Entry point for getnameinfo +* return 0 if a callback will be made +* return error code if validation fails +*/ +int uv_getnameinfo(uv_loop_t* loop, + uv_getnameinfo_t* req, + uv_getnameinfo_cb getnameinfo_cb, + const struct sockaddr* addr, + int flags) { + if (req == NULL || addr == NULL) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) { + memcpy(&req->storage, + addr, + sizeof(struct sockaddr_in)); + } else if (addr->sa_family == AF_INET6) { + memcpy(&req->storage, + addr, + sizeof(struct sockaddr_in6)); + } else { + return UV_EINVAL; + } + + uv__req_init(loop, (uv_req_t*)req, UV_GETNAMEINFO); + + req->getnameinfo_cb = getnameinfo_cb; + req->flags = flags; + req->type = UV_GETNAMEINFO; + req->loop = loop; + req->retcode = 0; + + if (getnameinfo_cb) { + uv__work_submit(loop, + &req->work_req, + uv__getnameinfo_work, + uv__getnameinfo_done); + return 0; + } else { + uv__getnameinfo_work(&req->work_req); + uv__getnameinfo_done(&req->work_req, 0); + return req->retcode; + } +} diff --git a/3rdparty/libuv/src/unix/internal.h b/3rdparty/libuv/src/unix/internal.h new file mode 100644 index 00000000000..741fa57d69c --- /dev/null +++ b/3rdparty/libuv/src/unix/internal.h @@ -0,0 +1,316 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_UNIX_INTERNAL_H_ +#define UV_UNIX_INTERNAL_H_ + +#include "uv-common.h" + +#include +#include /* abort */ +#include /* strrchr */ +#include /* O_CLOEXEC, may be */ + +#if defined(__STRICT_ANSI__) +# define inline __inline +#endif + +#if defined(__linux__) +# include "linux-syscalls.h" +#endif /* __linux__ */ + +#if defined(__sun) +# include +# include +#endif /* __sun */ + +#if defined(_AIX) +#define reqevents events +#define rtnevents revents +#include +#endif /* _AIX */ + +#if defined(__APPLE__) && !TARGET_OS_IPHONE +# include +#endif + +#define ACCESS_ONCE(type, var) \ + (*(volatile type*) &(var)) + +#define ROUND_UP(a, b) \ + ((a) % (b) ? ((a) + (b)) - ((a) % (b)) : (a)) + +#define UNREACHABLE() \ + do { \ + assert(0 && "unreachable code"); \ + abort(); \ + } \ + while (0) + +#define SAVE_ERRNO(block) \ + do { \ + int _saved_errno = errno; \ + do { block; } while (0); \ + errno = _saved_errno; \ + } \ + while (0) + +/* The __clang__ and __INTEL_COMPILER checks are superfluous because they + * define __GNUC__. They are here to convey to you, dear reader, that these + * macros are enabled when compiling with clang or icc. + */ +#if defined(__clang__) || \ + defined(__GNUC__) || \ + defined(__INTEL_COMPILER) || \ + defined(__SUNPRO_C) +# define UV_DESTRUCTOR(declaration) __attribute__((destructor)) declaration +# define UV_UNUSED(declaration) __attribute__((unused)) declaration +#else +# define UV_DESTRUCTOR(declaration) declaration +# define UV_UNUSED(declaration) declaration +#endif + +#if defined(__linux__) +# define UV__POLLIN UV__EPOLLIN +# define UV__POLLOUT UV__EPOLLOUT +# define UV__POLLERR UV__EPOLLERR +# define UV__POLLHUP UV__EPOLLHUP +#endif + +#if defined(__sun) || defined(_AIX) +# define UV__POLLIN POLLIN +# define UV__POLLOUT POLLOUT +# define UV__POLLERR POLLERR +# define UV__POLLHUP POLLHUP +#endif + +#ifndef UV__POLLIN +# define UV__POLLIN 1 +#endif + +#ifndef UV__POLLOUT +# define UV__POLLOUT 2 +#endif + +#ifndef UV__POLLERR +# define UV__POLLERR 4 +#endif + +#ifndef UV__POLLHUP +# define UV__POLLHUP 8 +#endif + +#if !defined(O_CLOEXEC) && defined(__FreeBSD__) +/* + * It may be that we are just missing `__POSIX_VISIBLE >= 200809`. + * Try using fixed value const and give up, if it doesn't work + */ +# define O_CLOEXEC 0x00100000 +#endif + +typedef struct uv__stream_queued_fds_s uv__stream_queued_fds_t; + +/* handle flags */ +enum { + UV_CLOSING = 0x01, /* uv_close() called but not finished. */ + UV_CLOSED = 0x02, /* close(2) finished. */ + UV_STREAM_READING = 0x04, /* uv_read_start() called. */ + UV_STREAM_SHUTTING = 0x08, /* uv_shutdown() called but not complete. */ + UV_STREAM_SHUT = 0x10, /* Write side closed. */ + UV_STREAM_READABLE = 0x20, /* The stream is readable */ + UV_STREAM_WRITABLE = 0x40, /* The stream is writable */ + UV_STREAM_BLOCKING = 0x80, /* Synchronous writes. */ + UV_STREAM_READ_PARTIAL = 0x100, /* read(2) read less than requested. */ + UV_STREAM_READ_EOF = 0x200, /* read(2) read EOF. */ + UV_TCP_NODELAY = 0x400, /* Disable Nagle. */ + UV_TCP_KEEPALIVE = 0x800, /* Turn on keep-alive. */ + UV_TCP_SINGLE_ACCEPT = 0x1000, /* Only accept() when idle. */ + UV_HANDLE_IPV6 = 0x10000, /* Handle is bound to a IPv6 socket. */ + UV_UDP_PROCESSING = 0x20000 /* Handle is running the send callback queue. */ +}; + +/* loop flags */ +enum { + UV_LOOP_BLOCK_SIGPROF = 1 +}; + +typedef enum { + UV_CLOCK_PRECISE = 0, /* Use the highest resolution clock available. */ + UV_CLOCK_FAST = 1 /* Use the fastest clock with <= 1ms granularity. */ +} uv_clocktype_t; + +struct uv__stream_queued_fds_s { + unsigned int size; + unsigned int offset; + int fds[1]; +}; + + +/* core */ +int uv__nonblock(int fd, int set); +int uv__close(int fd); +int uv__cloexec(int fd, int set); +int uv__socket(int domain, int type, int protocol); +int uv__dup(int fd); +ssize_t uv__recvmsg(int fd, struct msghdr *msg, int flags); +void uv__make_close_pending(uv_handle_t* handle); +int uv__getiovmax(void); + +void uv__io_init(uv__io_t* w, uv__io_cb cb, int fd); +void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events); +void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events); +void uv__io_close(uv_loop_t* loop, uv__io_t* w); +void uv__io_feed(uv_loop_t* loop, uv__io_t* w); +int uv__io_active(const uv__io_t* w, unsigned int events); +void uv__io_poll(uv_loop_t* loop, int timeout); /* in milliseconds or -1 */ + +/* async */ +void uv__async_send(struct uv__async* wa); +void uv__async_init(struct uv__async* wa); +int uv__async_start(uv_loop_t* loop, struct uv__async* wa, uv__async_cb cb); +void uv__async_stop(uv_loop_t* loop, struct uv__async* wa); + +/* loop */ +void uv__run_idle(uv_loop_t* loop); +void uv__run_check(uv_loop_t* loop); +void uv__run_prepare(uv_loop_t* loop); + +/* stream */ +void uv__stream_init(uv_loop_t* loop, uv_stream_t* stream, + uv_handle_type type); +int uv__stream_open(uv_stream_t*, int fd, int flags); +void uv__stream_destroy(uv_stream_t* stream); +#if defined(__APPLE__) +int uv__stream_try_select(uv_stream_t* stream, int* fd); +#endif /* defined(__APPLE__) */ +void uv__server_io(uv_loop_t* loop, uv__io_t* w, unsigned int events); +int uv__accept(int sockfd); +int uv__dup2_cloexec(int oldfd, int newfd); +int uv__open_cloexec(const char* path, int flags); + +/* tcp */ +int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb); +int uv__tcp_nodelay(int fd, int on); +int uv__tcp_keepalive(int fd, int on, unsigned int delay); + +/* pipe */ +int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb); + +/* timer */ +void uv__run_timers(uv_loop_t* loop); +int uv__next_timeout(const uv_loop_t* loop); + +/* signal */ +void uv__signal_close(uv_signal_t* handle); +void uv__signal_global_once_init(void); +void uv__signal_loop_cleanup(uv_loop_t* loop); + +/* platform specific */ +uint64_t uv__hrtime(uv_clocktype_t type); +int uv__kqueue_init(uv_loop_t* loop); +int uv__platform_loop_init(uv_loop_t* loop); +void uv__platform_loop_delete(uv_loop_t* loop); +void uv__platform_invalidate_fd(uv_loop_t* loop, int fd); + +/* various */ +void uv__async_close(uv_async_t* handle); +void uv__check_close(uv_check_t* handle); +void uv__fs_event_close(uv_fs_event_t* handle); +void uv__idle_close(uv_idle_t* handle); +void uv__pipe_close(uv_pipe_t* handle); +void uv__poll_close(uv_poll_t* handle); +void uv__prepare_close(uv_prepare_t* handle); +void uv__process_close(uv_process_t* handle); +void uv__stream_close(uv_stream_t* handle); +void uv__tcp_close(uv_tcp_t* handle); +void uv__timer_close(uv_timer_t* handle); +void uv__udp_close(uv_udp_t* handle); +void uv__udp_finish_close(uv_udp_t* handle); +uv_handle_type uv__handle_type(int fd); + +#if defined(__APPLE__) +int uv___stream_fd(const uv_stream_t* handle); +#define uv__stream_fd(handle) (uv___stream_fd((const uv_stream_t*) (handle))) +#else +#define uv__stream_fd(handle) ((handle)->io_watcher.fd) +#endif /* defined(__APPLE__) */ + +#ifdef UV__O_NONBLOCK +# define UV__F_NONBLOCK UV__O_NONBLOCK +#else +# define UV__F_NONBLOCK 1 +#endif + +int uv__make_socketpair(int fds[2], int flags); +int uv__make_pipe(int fds[2], int flags); + +#if defined(__APPLE__) + +int uv__fsevents_init(uv_fs_event_t* handle); +int uv__fsevents_close(uv_fs_event_t* handle); +void uv__fsevents_loop_delete(uv_loop_t* loop); + +/* OSX < 10.7 has no file events, polyfill them */ +#ifndef MAC_OS_X_VERSION_10_7 + +static const int kFSEventStreamCreateFlagFileEvents = 0x00000010; +static const int kFSEventStreamEventFlagItemCreated = 0x00000100; +static const int kFSEventStreamEventFlagItemRemoved = 0x00000200; +static const int kFSEventStreamEventFlagItemInodeMetaMod = 0x00000400; +static const int kFSEventStreamEventFlagItemRenamed = 0x00000800; +static const int kFSEventStreamEventFlagItemModified = 0x00001000; +static const int kFSEventStreamEventFlagItemFinderInfoMod = 0x00002000; +static const int kFSEventStreamEventFlagItemChangeOwner = 0x00004000; +static const int kFSEventStreamEventFlagItemXattrMod = 0x00008000; +static const int kFSEventStreamEventFlagItemIsFile = 0x00010000; +static const int kFSEventStreamEventFlagItemIsDir = 0x00020000; +static const int kFSEventStreamEventFlagItemIsSymlink = 0x00040000; + +#endif /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070 */ + +#endif /* defined(__APPLE__) */ + +UV_UNUSED(static void uv__req_init(uv_loop_t* loop, + uv_req_t* req, + uv_req_type type)) { + req->type = type; + uv__req_register(loop, req); +} +#define uv__req_init(loop, req, type) \ + uv__req_init((loop), (uv_req_t*)(req), (type)) + +UV_UNUSED(static void uv__update_time(uv_loop_t* loop)) { + /* Use a fast time source if available. We only need millisecond precision. + */ + loop->time = uv__hrtime(UV_CLOCK_FAST) / 1000000; +} + +UV_UNUSED(static char* uv__basename_r(const char* path)) { + char* s; + + s = strrchr(path, '/'); + if (s == NULL) + return (char*) path; + + return s + 1; +} + +#endif /* UV_UNIX_INTERNAL_H_ */ diff --git a/3rdparty/libuv/src/unix/kqueue.c b/3rdparty/libuv/src/unix/kqueue.c new file mode 100644 index 00000000000..495f20d285f --- /dev/null +++ b/3rdparty/libuv/src/unix/kqueue.c @@ -0,0 +1,426 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static void uv__fs_event(uv_loop_t* loop, uv__io_t* w, unsigned int fflags); + + +int uv__kqueue_init(uv_loop_t* loop) { + loop->backend_fd = kqueue(); + if (loop->backend_fd == -1) + return -errno; + + uv__cloexec(loop->backend_fd, 1); + + return 0; +} + + +void uv__io_poll(uv_loop_t* loop, int timeout) { + struct kevent events[1024]; + struct kevent* ev; + struct timespec spec; + unsigned int nevents; + unsigned int revents; + QUEUE* q; + uv__io_t* w; + sigset_t* pset; + sigset_t set; + uint64_t base; + uint64_t diff; + int filter; + int fflags; + int count; + int nfds; + int fd; + int op; + int i; + + if (loop->nfds == 0) { + assert(QUEUE_EMPTY(&loop->watcher_queue)); + return; + } + + nevents = 0; + + while (!QUEUE_EMPTY(&loop->watcher_queue)) { + q = QUEUE_HEAD(&loop->watcher_queue); + QUEUE_REMOVE(q); + QUEUE_INIT(q); + + w = QUEUE_DATA(q, uv__io_t, watcher_queue); + assert(w->pevents != 0); + assert(w->fd >= 0); + assert(w->fd < (int) loop->nwatchers); + + if ((w->events & UV__POLLIN) == 0 && (w->pevents & UV__POLLIN) != 0) { + filter = EVFILT_READ; + fflags = 0; + op = EV_ADD; + + if (w->cb == uv__fs_event) { + filter = EVFILT_VNODE; + fflags = NOTE_ATTRIB | NOTE_WRITE | NOTE_RENAME + | NOTE_DELETE | NOTE_EXTEND | NOTE_REVOKE; + op = EV_ADD | EV_ONESHOT; /* Stop the event from firing repeatedly. */ + } + + EV_SET(events + nevents, w->fd, filter, op, fflags, 0, 0); + + if (++nevents == ARRAY_SIZE(events)) { + if (kevent(loop->backend_fd, events, nevents, NULL, 0, NULL)) + abort(); + nevents = 0; + } + } + + if ((w->events & UV__POLLOUT) == 0 && (w->pevents & UV__POLLOUT) != 0) { + EV_SET(events + nevents, w->fd, EVFILT_WRITE, EV_ADD, 0, 0, 0); + + if (++nevents == ARRAY_SIZE(events)) { + if (kevent(loop->backend_fd, events, nevents, NULL, 0, NULL)) + abort(); + nevents = 0; + } + } + + w->events = w->pevents; + } + + pset = NULL; + if (loop->flags & UV_LOOP_BLOCK_SIGPROF) { + pset = &set; + sigemptyset(pset); + sigaddset(pset, SIGPROF); + } + + assert(timeout >= -1); + base = loop->time; + count = 48; /* Benchmarks suggest this gives the best throughput. */ + + for (;; nevents = 0) { + if (timeout != -1) { + spec.tv_sec = timeout / 1000; + spec.tv_nsec = (timeout % 1000) * 1000000; + } + + if (pset != NULL) + pthread_sigmask(SIG_BLOCK, pset, NULL); + + nfds = kevent(loop->backend_fd, + events, + nevents, + events, + ARRAY_SIZE(events), + timeout == -1 ? NULL : &spec); + + if (pset != NULL) + pthread_sigmask(SIG_UNBLOCK, pset, NULL); + + /* Update loop->time unconditionally. It's tempting to skip the update when + * timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the + * operating system didn't reschedule our process while in the syscall. + */ + SAVE_ERRNO(uv__update_time(loop)); + + if (nfds == 0) { + assert(timeout != -1); + return; + } + + if (nfds == -1) { + if (errno != EINTR) + abort(); + + if (timeout == 0) + return; + + if (timeout == -1) + continue; + + /* Interrupted by a signal. Update timeout and poll again. */ + goto update_timeout; + } + + nevents = 0; + + assert(loop->watchers != NULL); + loop->watchers[loop->nwatchers] = (void*) events; + loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds; + for (i = 0; i < nfds; i++) { + ev = events + i; + fd = ev->ident; + /* Skip invalidated events, see uv__platform_invalidate_fd */ + if (fd == -1) + continue; + w = loop->watchers[fd]; + + if (w == NULL) { + /* File descriptor that we've stopped watching, disarm it. */ + /* TODO batch up */ + struct kevent events[1]; + + EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0); + if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL)) + if (errno != EBADF && errno != ENOENT) + abort(); + + continue; + } + + if (ev->filter == EVFILT_VNODE) { + assert(w->events == UV__POLLIN); + assert(w->pevents == UV__POLLIN); + w->cb(loop, w, ev->fflags); /* XXX always uv__fs_event() */ + nevents++; + continue; + } + + revents = 0; + + if (ev->filter == EVFILT_READ) { + if (w->pevents & UV__POLLIN) { + revents |= UV__POLLIN; + w->rcount = ev->data; + } else { + /* TODO batch up */ + struct kevent events[1]; + EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0); + if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL)) + if (errno != ENOENT) + abort(); + } + } + + if (ev->filter == EVFILT_WRITE) { + if (w->pevents & UV__POLLOUT) { + revents |= UV__POLLOUT; + w->wcount = ev->data; + } else { + /* TODO batch up */ + struct kevent events[1]; + EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0); + if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL)) + if (errno != ENOENT) + abort(); + } + } + + if (ev->flags & EV_ERROR) + revents |= UV__POLLERR; + + if (revents == 0) + continue; + + w->cb(loop, w, revents); + nevents++; + } + loop->watchers[loop->nwatchers] = NULL; + loop->watchers[loop->nwatchers + 1] = NULL; + + if (nevents != 0) { + if (nfds == ARRAY_SIZE(events) && --count != 0) { + /* Poll for more events but don't block this time. */ + timeout = 0; + continue; + } + return; + } + + if (timeout == 0) + return; + + if (timeout == -1) + continue; + +update_timeout: + assert(timeout > 0); + + diff = loop->time - base; + if (diff >= (uint64_t) timeout) + return; + + timeout -= diff; + } +} + + +void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { + struct kevent* events; + uintptr_t i; + uintptr_t nfds; + + assert(loop->watchers != NULL); + + events = (struct kevent*) loop->watchers[loop->nwatchers]; + nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1]; + if (events == NULL) + return; + + /* Invalidate events with same file descriptor */ + for (i = 0; i < nfds; i++) + if ((int) events[i].ident == fd) + events[i].ident = -1; +} + + +static void uv__fs_event(uv_loop_t* loop, uv__io_t* w, unsigned int fflags) { + uv_fs_event_t* handle; + struct kevent ev; + int events; + const char* path; +#if defined(F_GETPATH) + /* MAXPATHLEN == PATH_MAX but the former is what XNU calls it internally. */ + char pathbuf[MAXPATHLEN]; +#endif + + handle = container_of(w, uv_fs_event_t, event_watcher); + + if (fflags & (NOTE_ATTRIB | NOTE_EXTEND)) + events = UV_CHANGE; + else + events = UV_RENAME; + + path = NULL; +#if defined(F_GETPATH) + /* Also works when the file has been unlinked from the file system. Passing + * in the path when the file has been deleted is arguably a little strange + * but it's consistent with what the inotify backend does. + */ + if (fcntl(handle->event_watcher.fd, F_GETPATH, pathbuf) == 0) + path = uv__basename_r(pathbuf); +#endif + handle->cb(handle, path, events, 0); + + if (handle->event_watcher.fd == -1) + return; + + /* Watcher operates in one-shot mode, re-arm it. */ + fflags = NOTE_ATTRIB | NOTE_WRITE | NOTE_RENAME + | NOTE_DELETE | NOTE_EXTEND | NOTE_REVOKE; + + EV_SET(&ev, w->fd, EVFILT_VNODE, EV_ADD | EV_ONESHOT, fflags, 0, 0); + + if (kevent(loop->backend_fd, &ev, 1, NULL, 0, NULL)) + abort(); +} + + +int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { + uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT); + return 0; +} + + +int uv_fs_event_start(uv_fs_event_t* handle, + uv_fs_event_cb cb, + const char* path, + unsigned int flags) { +#if defined(__APPLE__) + struct stat statbuf; +#endif /* defined(__APPLE__) */ + int fd; + + if (uv__is_active(handle)) + return -EINVAL; + + /* TODO open asynchronously - but how do we report back errors? */ + fd = open(path, O_RDONLY); + if (fd == -1) + return -errno; + + uv__handle_start(handle); + uv__io_init(&handle->event_watcher, uv__fs_event, fd); + handle->path = uv__strdup(path); + handle->cb = cb; + +#if defined(__APPLE__) + /* Nullify field to perform checks later */ + handle->cf_cb = NULL; + handle->realpath = NULL; + handle->realpath_len = 0; + handle->cf_flags = flags; + + if (fstat(fd, &statbuf)) + goto fallback; + /* FSEvents works only with directories */ + if (!(statbuf.st_mode & S_IFDIR)) + goto fallback; + + /* The fallback fd is no longer needed */ + uv__close(fd); + handle->event_watcher.fd = -1; + + return uv__fsevents_init(handle); + +fallback: +#endif /* defined(__APPLE__) */ + + uv__io_start(handle->loop, &handle->event_watcher, UV__POLLIN); + + return 0; +} + + +int uv_fs_event_stop(uv_fs_event_t* handle) { + if (!uv__is_active(handle)) + return 0; + + uv__handle_stop(handle); + +#if defined(__APPLE__) + if (uv__fsevents_close(handle)) +#endif /* defined(__APPLE__) */ + { + uv__io_close(handle->loop, &handle->event_watcher); + } + + uv__free(handle->path); + handle->path = NULL; + + if (handle->event_watcher.fd != -1) { + /* When FSEvents is used, we don't use the event_watcher's fd under certain + * confitions. (see uv_fs_event_start) */ + uv__close(handle->event_watcher.fd); + handle->event_watcher.fd = -1; + } + + return 0; +} + + +void uv__fs_event_close(uv_fs_event_t* handle) { + uv_fs_event_stop(handle); +} diff --git a/3rdparty/libuv/src/unix/linux-core.c b/3rdparty/libuv/src/unix/linux-core.c new file mode 100644 index 00000000000..3ff6fb15e93 --- /dev/null +++ b/3rdparty/libuv/src/unix/linux-core.c @@ -0,0 +1,899 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define HAVE_IFADDRS_H 1 + +#ifdef __UCLIBC__ +# if __UCLIBC_MAJOR__ < 0 || __UCLIBC_MINOR__ < 9 || __UCLIBC_SUBLEVEL__ < 32 +# undef HAVE_IFADDRS_H +# endif +#endif + +#ifdef HAVE_IFADDRS_H +# if defined(__ANDROID__) +# include "android-ifaddrs.h" +# else +# include +# endif +# include +# include +# include +#endif /* HAVE_IFADDRS_H */ + +/* Available from 2.6.32 onwards. */ +#ifndef CLOCK_MONOTONIC_COARSE +# define CLOCK_MONOTONIC_COARSE 6 +#endif + +/* This is rather annoying: CLOCK_BOOTTIME lives in but we can't + * include that file because it conflicts with . We'll just have to + * define it ourselves. + */ +#ifndef CLOCK_BOOTTIME +# define CLOCK_BOOTTIME 7 +#endif + +static int read_models(unsigned int numcpus, uv_cpu_info_t* ci); +static int read_times(unsigned int numcpus, uv_cpu_info_t* ci); +static void read_speeds(unsigned int numcpus, uv_cpu_info_t* ci); +static unsigned long read_cpufreq(unsigned int cpunum); + + +int uv__platform_loop_init(uv_loop_t* loop) { + int fd; + + fd = uv__epoll_create1(UV__EPOLL_CLOEXEC); + + /* epoll_create1() can fail either because it's not implemented (old kernel) + * or because it doesn't understand the EPOLL_CLOEXEC flag. + */ + if (fd == -1 && (errno == ENOSYS || errno == EINVAL)) { + fd = uv__epoll_create(256); + + if (fd != -1) + uv__cloexec(fd, 1); + } + + loop->backend_fd = fd; + loop->inotify_fd = -1; + loop->inotify_watchers = NULL; + + if (fd == -1) + return -errno; + + return 0; +} + + +void uv__platform_loop_delete(uv_loop_t* loop) { + if (loop->inotify_fd == -1) return; + uv__io_stop(loop, &loop->inotify_read_watcher, UV__POLLIN); + uv__close(loop->inotify_fd); + loop->inotify_fd = -1; +} + + +void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { + struct uv__epoll_event* events; + struct uv__epoll_event dummy; + uintptr_t i; + uintptr_t nfds; + + assert(loop->watchers != NULL); + + events = (struct uv__epoll_event*) loop->watchers[loop->nwatchers]; + nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1]; + if (events != NULL) + /* Invalidate events with same file descriptor */ + for (i = 0; i < nfds; i++) + if ((int) events[i].data == fd) + events[i].data = -1; + + /* Remove the file descriptor from the epoll. + * This avoids a problem where the same file description remains open + * in another process, causing repeated junk epoll events. + * + * We pass in a dummy epoll_event, to work around a bug in old kernels. + */ + if (loop->backend_fd >= 0) { + /* Work around a bug in kernels 3.10 to 3.19 where passing a struct that + * has the EPOLLWAKEUP flag set generates spurious audit syslog warnings. + */ + memset(&dummy, 0, sizeof(dummy)); + uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_DEL, fd, &dummy); + } +} + + +void uv__io_poll(uv_loop_t* loop, int timeout) { + /* A bug in kernels < 2.6.37 makes timeouts larger than ~30 minutes + * effectively infinite on 32 bits architectures. To avoid blocking + * indefinitely, we cap the timeout and poll again if necessary. + * + * Note that "30 minutes" is a simplification because it depends on + * the value of CONFIG_HZ. The magic constant assumes CONFIG_HZ=1200, + * that being the largest value I have seen in the wild (and only once.) + */ + static const int max_safe_timeout = 1789569; + static int no_epoll_pwait; + static int no_epoll_wait; + struct uv__epoll_event events[1024]; + struct uv__epoll_event* pe; + struct uv__epoll_event e; + int real_timeout; + QUEUE* q; + uv__io_t* w; + sigset_t sigset; + uint64_t sigmask; + uint64_t base; + int nevents; + int count; + int nfds; + int fd; + int op; + int i; + + if (loop->nfds == 0) { + assert(QUEUE_EMPTY(&loop->watcher_queue)); + return; + } + + while (!QUEUE_EMPTY(&loop->watcher_queue)) { + q = QUEUE_HEAD(&loop->watcher_queue); + QUEUE_REMOVE(q); + QUEUE_INIT(q); + + w = QUEUE_DATA(q, uv__io_t, watcher_queue); + assert(w->pevents != 0); + assert(w->fd >= 0); + assert(w->fd < (int) loop->nwatchers); + + e.events = w->pevents; + e.data = w->fd; + + if (w->events == 0) + op = UV__EPOLL_CTL_ADD; + else + op = UV__EPOLL_CTL_MOD; + + /* XXX Future optimization: do EPOLL_CTL_MOD lazily if we stop watching + * events, skip the syscall and squelch the events after epoll_wait(). + */ + if (uv__epoll_ctl(loop->backend_fd, op, w->fd, &e)) { + if (errno != EEXIST) + abort(); + + assert(op == UV__EPOLL_CTL_ADD); + + /* We've reactivated a file descriptor that's been watched before. */ + if (uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_MOD, w->fd, &e)) + abort(); + } + + w->events = w->pevents; + } + + sigmask = 0; + if (loop->flags & UV_LOOP_BLOCK_SIGPROF) { + sigemptyset(&sigset); + sigaddset(&sigset, SIGPROF); + sigmask |= 1 << (SIGPROF - 1); + } + + assert(timeout >= -1); + base = loop->time; + count = 48; /* Benchmarks suggest this gives the best throughput. */ + real_timeout = timeout; + + for (;;) { + /* See the comment for max_safe_timeout for an explanation of why + * this is necessary. Executive summary: kernel bug workaround. + */ + if (sizeof(int32_t) == sizeof(long) && timeout >= max_safe_timeout) + timeout = max_safe_timeout; + + if (sigmask != 0 && no_epoll_pwait != 0) + if (pthread_sigmask(SIG_BLOCK, &sigset, NULL)) + abort(); + + if (no_epoll_wait != 0 || (sigmask != 0 && no_epoll_pwait == 0)) { + nfds = uv__epoll_pwait(loop->backend_fd, + events, + ARRAY_SIZE(events), + timeout, + sigmask); + if (nfds == -1 && errno == ENOSYS) + no_epoll_pwait = 1; + } else { + nfds = uv__epoll_wait(loop->backend_fd, + events, + ARRAY_SIZE(events), + timeout); + if (nfds == -1 && errno == ENOSYS) + no_epoll_wait = 1; + } + + if (sigmask != 0 && no_epoll_pwait != 0) + if (pthread_sigmask(SIG_UNBLOCK, &sigset, NULL)) + abort(); + + /* Update loop->time unconditionally. It's tempting to skip the update when + * timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the + * operating system didn't reschedule our process while in the syscall. + */ + SAVE_ERRNO(uv__update_time(loop)); + + if (nfds == 0) { + assert(timeout != -1); + + timeout = real_timeout - timeout; + if (timeout > 0) + continue; + + return; + } + + if (nfds == -1) { + if (errno == ENOSYS) { + /* epoll_wait() or epoll_pwait() failed, try the other system call. */ + assert(no_epoll_wait == 0 || no_epoll_pwait == 0); + continue; + } + + if (errno != EINTR) + abort(); + + if (timeout == -1) + continue; + + if (timeout == 0) + return; + + /* Interrupted by a signal. Update timeout and poll again. */ + goto update_timeout; + } + + nevents = 0; + + assert(loop->watchers != NULL); + loop->watchers[loop->nwatchers] = (void*) events; + loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds; + for (i = 0; i < nfds; i++) { + pe = events + i; + fd = pe->data; + + /* Skip invalidated events, see uv__platform_invalidate_fd */ + if (fd == -1) + continue; + + assert(fd >= 0); + assert((unsigned) fd < loop->nwatchers); + + w = loop->watchers[fd]; + + if (w == NULL) { + /* File descriptor that we've stopped watching, disarm it. + * + * Ignore all errors because we may be racing with another thread + * when the file descriptor is closed. + */ + uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_DEL, fd, pe); + continue; + } + + /* Give users only events they're interested in. Prevents spurious + * callbacks when previous callback invocation in this loop has stopped + * the current watcher. Also, filters out events that users has not + * requested us to watch. + */ + pe->events &= w->pevents | UV__POLLERR | UV__POLLHUP; + + /* Work around an epoll quirk where it sometimes reports just the + * EPOLLERR or EPOLLHUP event. In order to force the event loop to + * move forward, we merge in the read/write events that the watcher + * is interested in; uv__read() and uv__write() will then deal with + * the error or hangup in the usual fashion. + * + * Note to self: happens when epoll reports EPOLLIN|EPOLLHUP, the user + * reads the available data, calls uv_read_stop(), then sometime later + * calls uv_read_start() again. By then, libuv has forgotten about the + * hangup and the kernel won't report EPOLLIN again because there's + * nothing left to read. If anything, libuv is to blame here. The + * current hack is just a quick bandaid; to properly fix it, libuv + * needs to remember the error/hangup event. We should get that for + * free when we switch over to edge-triggered I/O. + */ + if (pe->events == UV__EPOLLERR || pe->events == UV__EPOLLHUP) + pe->events |= w->pevents & (UV__EPOLLIN | UV__EPOLLOUT); + + if (pe->events != 0) { + w->cb(loop, w, pe->events); + nevents++; + } + } + loop->watchers[loop->nwatchers] = NULL; + loop->watchers[loop->nwatchers + 1] = NULL; + + if (nevents != 0) { + if (nfds == ARRAY_SIZE(events) && --count != 0) { + /* Poll for more events but don't block this time. */ + timeout = 0; + continue; + } + return; + } + + if (timeout == 0) + return; + + if (timeout == -1) + continue; + +update_timeout: + assert(timeout > 0); + + real_timeout -= (loop->time - base); + if (real_timeout <= 0) + return; + + timeout = real_timeout; + } +} + + +uint64_t uv__hrtime(uv_clocktype_t type) { + static clock_t fast_clock_id = -1; + struct timespec t; + clock_t clock_id; + + /* Prefer CLOCK_MONOTONIC_COARSE if available but only when it has + * millisecond granularity or better. CLOCK_MONOTONIC_COARSE is + * serviced entirely from the vDSO, whereas CLOCK_MONOTONIC may + * decide to make a costly system call. + */ + /* TODO(bnoordhuis) Use CLOCK_MONOTONIC_COARSE for UV_CLOCK_PRECISE + * when it has microsecond granularity or better (unlikely). + */ + if (type == UV_CLOCK_FAST && fast_clock_id == -1) { + if (clock_getres(CLOCK_MONOTONIC_COARSE, &t) == 0 && + t.tv_nsec <= 1 * 1000 * 1000) { + fast_clock_id = CLOCK_MONOTONIC_COARSE; + } else { + fast_clock_id = CLOCK_MONOTONIC; + } + } + + clock_id = CLOCK_MONOTONIC; + if (type == UV_CLOCK_FAST) + clock_id = fast_clock_id; + + if (clock_gettime(clock_id, &t)) + return 0; /* Not really possible. */ + + return t.tv_sec * (uint64_t) 1e9 + t.tv_nsec; +} + + +void uv_loadavg(double avg[3]) { + struct sysinfo info; + + if (sysinfo(&info) < 0) return; + + avg[0] = (double) info.loads[0] / 65536.0; + avg[1] = (double) info.loads[1] / 65536.0; + avg[2] = (double) info.loads[2] / 65536.0; +} + + +int uv_exepath(char* buffer, size_t* size) { + ssize_t n; + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + n = *size - 1; + if (n > 0) + n = readlink("/proc/self/exe", buffer, n); + + if (n == -1) + return -errno; + + buffer[n] = '\0'; + *size = n; + + return 0; +} + + +uint64_t uv_get_free_memory(void) { + return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_AVPHYS_PAGES); +} + + +uint64_t uv_get_total_memory(void) { + return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_PHYS_PAGES); +} + + +int uv_resident_set_memory(size_t* rss) { + char buf[1024]; + const char* s; + ssize_t n; + long val; + int fd; + int i; + + do + fd = open("/proc/self/stat", O_RDONLY); + while (fd == -1 && errno == EINTR); + + if (fd == -1) + return -errno; + + do + n = read(fd, buf, sizeof(buf) - 1); + while (n == -1 && errno == EINTR); + + uv__close(fd); + if (n == -1) + return -errno; + buf[n] = '\0'; + + s = strchr(buf, ' '); + if (s == NULL) + goto err; + + s += 1; + if (*s != '(') + goto err; + + s = strchr(s, ')'); + if (s == NULL) + goto err; + + for (i = 1; i <= 22; i++) { + s = strchr(s + 1, ' '); + if (s == NULL) + goto err; + } + + errno = 0; + val = strtol(s, NULL, 10); + if (errno != 0) + goto err; + if (val < 0) + goto err; + + *rss = val * getpagesize(); + return 0; + +err: + return -EINVAL; +} + + +int uv_uptime(double* uptime) { + static volatile int no_clock_boottime; + struct timespec now; + int r; + + /* Try CLOCK_BOOTTIME first, fall back to CLOCK_MONOTONIC if not available + * (pre-2.6.39 kernels). CLOCK_MONOTONIC doesn't increase when the system + * is suspended. + */ + if (no_clock_boottime) { + retry: r = clock_gettime(CLOCK_MONOTONIC, &now); + } + else if ((r = clock_gettime(CLOCK_BOOTTIME, &now)) && errno == EINVAL) { + no_clock_boottime = 1; + goto retry; + } + + if (r) + return -errno; + + *uptime = now.tv_sec; + return 0; +} + + +int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { + unsigned int numcpus; + uv_cpu_info_t* ci; + int err; + + *cpu_infos = NULL; + *count = 0; + + numcpus = sysconf(_SC_NPROCESSORS_ONLN); + assert(numcpus != (unsigned int) -1); + assert(numcpus != 0); + + ci = uv__calloc(numcpus, sizeof(*ci)); + if (ci == NULL) + return -ENOMEM; + + err = read_models(numcpus, ci); + if (err == 0) + err = read_times(numcpus, ci); + + if (err) { + uv_free_cpu_info(ci, numcpus); + return err; + } + + /* read_models() on x86 also reads the CPU speed from /proc/cpuinfo. + * We don't check for errors here. Worst case, the field is left zero. + */ + if (ci[0].speed == 0) + read_speeds(numcpus, ci); + + *cpu_infos = ci; + *count = numcpus; + + return 0; +} + + +static void read_speeds(unsigned int numcpus, uv_cpu_info_t* ci) { + unsigned int num; + + for (num = 0; num < numcpus; num++) + ci[num].speed = read_cpufreq(num) / 1000; +} + + +/* Also reads the CPU frequency on x86. The other architectures only have + * a BogoMIPS field, which may not be very accurate. + * + * Note: Simply returns on error, uv_cpu_info() takes care of the cleanup. + */ +static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) { + static const char model_marker[] = "model name\t: "; + static const char speed_marker[] = "cpu MHz\t\t: "; + const char* inferred_model; + unsigned int model_idx; + unsigned int speed_idx; + char buf[1024]; + char* model; + FILE* fp; + + /* Most are unused on non-ARM, non-MIPS and non-x86 architectures. */ + (void) &model_marker; + (void) &speed_marker; + (void) &speed_idx; + (void) &model; + (void) &buf; + (void) &fp; + + model_idx = 0; + speed_idx = 0; + +#if defined(__arm__) || \ + defined(__i386__) || \ + defined(__mips__) || \ + defined(__x86_64__) + fp = fopen("/proc/cpuinfo", "r"); + if (fp == NULL) + return -errno; + + while (fgets(buf, sizeof(buf), fp)) { + if (model_idx < numcpus) { + if (strncmp(buf, model_marker, sizeof(model_marker) - 1) == 0) { + model = buf + sizeof(model_marker) - 1; + model = uv__strndup(model, strlen(model) - 1); /* Strip newline. */ + if (model == NULL) { + fclose(fp); + return -ENOMEM; + } + ci[model_idx++].model = model; + continue; + } + } +#if defined(__arm__) || defined(__mips__) + if (model_idx < numcpus) { +#if defined(__arm__) + /* Fallback for pre-3.8 kernels. */ + static const char model_marker[] = "Processor\t: "; +#else /* defined(__mips__) */ + static const char model_marker[] = "cpu model\t\t: "; +#endif + if (strncmp(buf, model_marker, sizeof(model_marker) - 1) == 0) { + model = buf + sizeof(model_marker) - 1; + model = uv__strndup(model, strlen(model) - 1); /* Strip newline. */ + if (model == NULL) { + fclose(fp); + return -ENOMEM; + } + ci[model_idx++].model = model; + continue; + } + } +#else /* !__arm__ && !__mips__ */ + if (speed_idx < numcpus) { + if (strncmp(buf, speed_marker, sizeof(speed_marker) - 1) == 0) { + ci[speed_idx++].speed = atoi(buf + sizeof(speed_marker) - 1); + continue; + } + } +#endif /* __arm__ || __mips__ */ + } + + fclose(fp); +#endif /* __arm__ || __i386__ || __mips__ || __x86_64__ */ + + /* Now we want to make sure that all the models contain *something* because + * it's not safe to leave them as null. Copy the last entry unless there + * isn't one, in that case we simply put "unknown" into everything. + */ + inferred_model = "unknown"; + if (model_idx > 0) + inferred_model = ci[model_idx - 1].model; + + while (model_idx < numcpus) { + model = uv__strndup(inferred_model, strlen(inferred_model)); + if (model == NULL) + return -ENOMEM; + ci[model_idx++].model = model; + } + + return 0; +} + + +static int read_times(unsigned int numcpus, uv_cpu_info_t* ci) { + unsigned long clock_ticks; + struct uv_cpu_times_s ts; + unsigned long user; + unsigned long nice; + unsigned long sys; + unsigned long idle; + unsigned long dummy; + unsigned long irq; + unsigned int num; + unsigned int len; + char buf[1024]; + FILE* fp; + + clock_ticks = sysconf(_SC_CLK_TCK); + assert(clock_ticks != (unsigned long) -1); + assert(clock_ticks != 0); + + fp = fopen("/proc/stat", "r"); + if (fp == NULL) + return -errno; + + if (!fgets(buf, sizeof(buf), fp)) + abort(); + + num = 0; + + while (fgets(buf, sizeof(buf), fp)) { + if (num >= numcpus) + break; + + if (strncmp(buf, "cpu", 3)) + break; + + /* skip "cpu " marker */ + { + unsigned int n; + int r = sscanf(buf, "cpu%u ", &n); + assert(r == 1); + (void) r; /* silence build warning */ + for (len = sizeof("cpu0"); n /= 10; len++); + } + + /* Line contains user, nice, system, idle, iowait, irq, softirq, steal, + * guest, guest_nice but we're only interested in the first four + irq. + * + * Don't use %*s to skip fields or %ll to read straight into the uint64_t + * fields, they're not allowed in C89 mode. + */ + if (6 != sscanf(buf + len, + "%lu %lu %lu %lu %lu %lu", + &user, + &nice, + &sys, + &idle, + &dummy, + &irq)) + abort(); + + ts.user = clock_ticks * user; + ts.nice = clock_ticks * nice; + ts.sys = clock_ticks * sys; + ts.idle = clock_ticks * idle; + ts.irq = clock_ticks * irq; + ci[num++].cpu_times = ts; + } + fclose(fp); + assert(num == numcpus); + + return 0; +} + + +static unsigned long read_cpufreq(unsigned int cpunum) { + unsigned long val; + char buf[1024]; + FILE* fp; + + snprintf(buf, + sizeof(buf), + "/sys/devices/system/cpu/cpu%u/cpufreq/scaling_cur_freq", + cpunum); + + fp = fopen(buf, "r"); + if (fp == NULL) + return 0; + + if (fscanf(fp, "%lu", &val) != 1) + val = 0; + + fclose(fp); + + return val; +} + + +void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(cpu_infos[i].model); + } + + uv__free(cpu_infos); +} + + +int uv_interface_addresses(uv_interface_address_t** addresses, + int* count) { +#ifndef HAVE_IFADDRS_H + return -ENOSYS; +#else + struct ifaddrs *addrs, *ent; + uv_interface_address_t* address; + int i; + struct sockaddr_ll *sll; + + if (getifaddrs(&addrs)) + return -errno; + + *count = 0; + *addresses = NULL; + + /* Count the number of interfaces */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family == PF_PACKET)) { + continue; + } + + (*count)++; + } + + if (*count == 0) + return 0; + + *addresses = uv__malloc(*count * sizeof(**addresses)); + if (!(*addresses)) { + freeifaddrs(addrs); + return -ENOMEM; + } + + address = *addresses; + + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING))) + continue; + + if (ent->ifa_addr == NULL) + continue; + + /* + * On Linux getifaddrs returns information related to the raw underlying + * devices. We're not interested in this information yet. + */ + if (ent->ifa_addr->sa_family == PF_PACKET) + continue; + + address->name = uv__strdup(ent->ifa_name); + + if (ent->ifa_addr->sa_family == AF_INET6) { + address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr); + } else { + address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr); + } + + if (ent->ifa_netmask->sa_family == AF_INET6) { + address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask); + } else { + address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask); + } + + address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK); + + address++; + } + + /* Fill in physical addresses for each interface */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family != PF_PACKET)) { + continue; + } + + address = *addresses; + + for (i = 0; i < (*count); i++) { + if (strcmp(address->name, ent->ifa_name) == 0) { + sll = (struct sockaddr_ll*)ent->ifa_addr; + memcpy(address->phys_addr, sll->sll_addr, sizeof(address->phys_addr)); + } + address++; + } + } + + freeifaddrs(addrs); + + return 0; +#endif +} + + +void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(addresses[i].name); + } + + uv__free(addresses); +} + + +void uv__set_process_title(const char* title) { +#if defined(PR_SET_NAME) + prctl(PR_SET_NAME, title); /* Only copies first 16 characters. */ +#endif +} diff --git a/3rdparty/libuv/src/unix/linux-inotify.c b/3rdparty/libuv/src/unix/linux-inotify.c new file mode 100644 index 00000000000..282912115d8 --- /dev/null +++ b/3rdparty/libuv/src/unix/linux-inotify.c @@ -0,0 +1,285 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "tree.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +struct watcher_list { + RB_ENTRY(watcher_list) entry; + QUEUE watchers; + int iterating; + char* path; + int wd; +}; + +struct watcher_root { + struct watcher_list* rbh_root; +}; +#define CAST(p) ((struct watcher_root*)(p)) + + +static int compare_watchers(const struct watcher_list* a, + const struct watcher_list* b) { + if (a->wd < b->wd) return -1; + if (a->wd > b->wd) return 1; + return 0; +} + + +RB_GENERATE_STATIC(watcher_root, watcher_list, entry, compare_watchers) + + +static void uv__inotify_read(uv_loop_t* loop, + uv__io_t* w, + unsigned int revents); + + +static int new_inotify_fd(void) { + int err; + int fd; + + fd = uv__inotify_init1(UV__IN_NONBLOCK | UV__IN_CLOEXEC); + if (fd != -1) + return fd; + + if (errno != ENOSYS) + return -errno; + + fd = uv__inotify_init(); + if (fd == -1) + return -errno; + + err = uv__cloexec(fd, 1); + if (err == 0) + err = uv__nonblock(fd, 1); + + if (err) { + uv__close(fd); + return err; + } + + return fd; +} + + +static int init_inotify(uv_loop_t* loop) { + int err; + + if (loop->inotify_fd != -1) + return 0; + + err = new_inotify_fd(); + if (err < 0) + return err; + + loop->inotify_fd = err; + uv__io_init(&loop->inotify_read_watcher, uv__inotify_read, loop->inotify_fd); + uv__io_start(loop, &loop->inotify_read_watcher, UV__POLLIN); + + return 0; +} + + +static struct watcher_list* find_watcher(uv_loop_t* loop, int wd) { + struct watcher_list w; + w.wd = wd; + return RB_FIND(watcher_root, CAST(&loop->inotify_watchers), &w); +} + +static void maybe_free_watcher_list(struct watcher_list* w, uv_loop_t* loop) { + /* if the watcher_list->watchers is being iterated over, we can't free it. */ + if ((!w->iterating) && QUEUE_EMPTY(&w->watchers)) { + /* No watchers left for this path. Clean up. */ + RB_REMOVE(watcher_root, CAST(&loop->inotify_watchers), w); + uv__inotify_rm_watch(loop->inotify_fd, w->wd); + uv__free(w); + } +} + +static void uv__inotify_read(uv_loop_t* loop, + uv__io_t* dummy, + unsigned int events) { + const struct uv__inotify_event* e; + struct watcher_list* w; + uv_fs_event_t* h; + QUEUE queue; + QUEUE* q; + const char* path; + ssize_t size; + const char *p; + /* needs to be large enough for sizeof(inotify_event) + strlen(path) */ + char buf[4096]; + + while (1) { + do + size = read(loop->inotify_fd, buf, sizeof(buf)); + while (size == -1 && errno == EINTR); + + if (size == -1) { + assert(errno == EAGAIN || errno == EWOULDBLOCK); + break; + } + + assert(size > 0); /* pre-2.6.21 thing, size=0 == read buffer too small */ + + /* Now we have one or more inotify_event structs. */ + for (p = buf; p < buf + size; p += sizeof(*e) + e->len) { + e = (const struct uv__inotify_event*)p; + + events = 0; + if (e->mask & (UV__IN_ATTRIB|UV__IN_MODIFY)) + events |= UV_CHANGE; + if (e->mask & ~(UV__IN_ATTRIB|UV__IN_MODIFY)) + events |= UV_RENAME; + + w = find_watcher(loop, e->wd); + if (w == NULL) + continue; /* Stale event, no watchers left. */ + + /* inotify does not return the filename when monitoring a single file + * for modifications. Repurpose the filename for API compatibility. + * I'm not convinced this is a good thing, maybe it should go. + */ + path = e->len ? (const char*) (e + 1) : uv__basename_r(w->path); + + /* We're about to iterate over the queue and call user's callbacks. + * What can go wrong? + * A callback could call uv_fs_event_stop() + * and the queue can change under our feet. + * So, we use QUEUE_MOVE() trick to safely iterate over the queue. + * And we don't free the watcher_list until we're done iterating. + * + * First, + * tell uv_fs_event_stop() (that could be called from a user's callback) + * not to free watcher_list. + */ + w->iterating = 1; + QUEUE_MOVE(&w->watchers, &queue); + while (!QUEUE_EMPTY(&queue)) { + q = QUEUE_HEAD(&queue); + h = QUEUE_DATA(q, uv_fs_event_t, watchers); + + QUEUE_REMOVE(q); + QUEUE_INSERT_TAIL(&w->watchers, q); + + h->cb(h, path, events, 0); + } + /* done iterating, time to (maybe) free empty watcher_list */ + w->iterating = 0; + maybe_free_watcher_list(w, loop); + } + } +} + + +int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { + uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT); + return 0; +} + + +int uv_fs_event_start(uv_fs_event_t* handle, + uv_fs_event_cb cb, + const char* path, + unsigned int flags) { + struct watcher_list* w; + int events; + int err; + int wd; + + if (uv__is_active(handle)) + return -EINVAL; + + err = init_inotify(handle->loop); + if (err) + return err; + + events = UV__IN_ATTRIB + | UV__IN_CREATE + | UV__IN_MODIFY + | UV__IN_DELETE + | UV__IN_DELETE_SELF + | UV__IN_MOVE_SELF + | UV__IN_MOVED_FROM + | UV__IN_MOVED_TO; + + wd = uv__inotify_add_watch(handle->loop->inotify_fd, path, events); + if (wd == -1) + return -errno; + + w = find_watcher(handle->loop, wd); + if (w) + goto no_insert; + + w = uv__malloc(sizeof(*w) + strlen(path) + 1); + if (w == NULL) + return -ENOMEM; + + w->wd = wd; + w->path = strcpy((char*)(w + 1), path); + QUEUE_INIT(&w->watchers); + w->iterating = 0; + RB_INSERT(watcher_root, CAST(&handle->loop->inotify_watchers), w); + +no_insert: + uv__handle_start(handle); + QUEUE_INSERT_TAIL(&w->watchers, &handle->watchers); + handle->path = w->path; + handle->cb = cb; + handle->wd = wd; + + return 0; +} + + +int uv_fs_event_stop(uv_fs_event_t* handle) { + struct watcher_list* w; + + if (!uv__is_active(handle)) + return 0; + + w = find_watcher(handle->loop, handle->wd); + assert(w != NULL); + + handle->wd = -1; + handle->path = NULL; + uv__handle_stop(handle); + QUEUE_REMOVE(&handle->watchers); + + maybe_free_watcher_list(w, handle->loop); + + return 0; +} + + +void uv__fs_event_close(uv_fs_event_t* handle) { + uv_fs_event_stop(handle); +} diff --git a/3rdparty/libuv/src/unix/linux-syscalls.c b/3rdparty/libuv/src/unix/linux-syscalls.c new file mode 100644 index 00000000000..89998ded26b --- /dev/null +++ b/3rdparty/libuv/src/unix/linux-syscalls.c @@ -0,0 +1,471 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "linux-syscalls.h" +#include +#include +#include +#include +#include + +#if defined(__has_feature) +# if __has_feature(memory_sanitizer) +# define MSAN_ACTIVE 1 +# include +# endif +#endif + +#if defined(__i386__) +# ifndef __NR_socketcall +# define __NR_socketcall 102 +# endif +#endif + +#if defined(__arm__) +# if defined(__thumb__) || defined(__ARM_EABI__) +# define UV_SYSCALL_BASE 0 +# else +# define UV_SYSCALL_BASE 0x900000 +# endif +#endif /* __arm__ */ + +#ifndef __NR_accept4 +# if defined(__x86_64__) +# define __NR_accept4 288 +# elif defined(__i386__) + /* Nothing. Handled through socketcall(). */ +# elif defined(__arm__) +# define __NR_accept4 (UV_SYSCALL_BASE + 366) +# endif +#endif /* __NR_accept4 */ + +#ifndef __NR_eventfd +# if defined(__x86_64__) +# define __NR_eventfd 284 +# elif defined(__i386__) +# define __NR_eventfd 323 +# elif defined(__arm__) +# define __NR_eventfd (UV_SYSCALL_BASE + 351) +# endif +#endif /* __NR_eventfd */ + +#ifndef __NR_eventfd2 +# if defined(__x86_64__) +# define __NR_eventfd2 290 +# elif defined(__i386__) +# define __NR_eventfd2 328 +# elif defined(__arm__) +# define __NR_eventfd2 (UV_SYSCALL_BASE + 356) +# endif +#endif /* __NR_eventfd2 */ + +#ifndef __NR_epoll_create +# if defined(__x86_64__) +# define __NR_epoll_create 213 +# elif defined(__i386__) +# define __NR_epoll_create 254 +# elif defined(__arm__) +# define __NR_epoll_create (UV_SYSCALL_BASE + 250) +# endif +#endif /* __NR_epoll_create */ + +#ifndef __NR_epoll_create1 +# if defined(__x86_64__) +# define __NR_epoll_create1 291 +# elif defined(__i386__) +# define __NR_epoll_create1 329 +# elif defined(__arm__) +# define __NR_epoll_create1 (UV_SYSCALL_BASE + 357) +# endif +#endif /* __NR_epoll_create1 */ + +#ifndef __NR_epoll_ctl +# if defined(__x86_64__) +# define __NR_epoll_ctl 233 /* used to be 214 */ +# elif defined(__i386__) +# define __NR_epoll_ctl 255 +# elif defined(__arm__) +# define __NR_epoll_ctl (UV_SYSCALL_BASE + 251) +# endif +#endif /* __NR_epoll_ctl */ + +#ifndef __NR_epoll_wait +# if defined(__x86_64__) +# define __NR_epoll_wait 232 /* used to be 215 */ +# elif defined(__i386__) +# define __NR_epoll_wait 256 +# elif defined(__arm__) +# define __NR_epoll_wait (UV_SYSCALL_BASE + 252) +# endif +#endif /* __NR_epoll_wait */ + +#ifndef __NR_epoll_pwait +# if defined(__x86_64__) +# define __NR_epoll_pwait 281 +# elif defined(__i386__) +# define __NR_epoll_pwait 319 +# elif defined(__arm__) +# define __NR_epoll_pwait (UV_SYSCALL_BASE + 346) +# endif +#endif /* __NR_epoll_pwait */ + +#ifndef __NR_inotify_init +# if defined(__x86_64__) +# define __NR_inotify_init 253 +# elif defined(__i386__) +# define __NR_inotify_init 291 +# elif defined(__arm__) +# define __NR_inotify_init (UV_SYSCALL_BASE + 316) +# endif +#endif /* __NR_inotify_init */ + +#ifndef __NR_inotify_init1 +# if defined(__x86_64__) +# define __NR_inotify_init1 294 +# elif defined(__i386__) +# define __NR_inotify_init1 332 +# elif defined(__arm__) +# define __NR_inotify_init1 (UV_SYSCALL_BASE + 360) +# endif +#endif /* __NR_inotify_init1 */ + +#ifndef __NR_inotify_add_watch +# if defined(__x86_64__) +# define __NR_inotify_add_watch 254 +# elif defined(__i386__) +# define __NR_inotify_add_watch 292 +# elif defined(__arm__) +# define __NR_inotify_add_watch (UV_SYSCALL_BASE + 317) +# endif +#endif /* __NR_inotify_add_watch */ + +#ifndef __NR_inotify_rm_watch +# if defined(__x86_64__) +# define __NR_inotify_rm_watch 255 +# elif defined(__i386__) +# define __NR_inotify_rm_watch 293 +# elif defined(__arm__) +# define __NR_inotify_rm_watch (UV_SYSCALL_BASE + 318) +# endif +#endif /* __NR_inotify_rm_watch */ + +#ifndef __NR_pipe2 +# if defined(__x86_64__) +# define __NR_pipe2 293 +# elif defined(__i386__) +# define __NR_pipe2 331 +# elif defined(__arm__) +# define __NR_pipe2 (UV_SYSCALL_BASE + 359) +# endif +#endif /* __NR_pipe2 */ + +#ifndef __NR_recvmmsg +# if defined(__x86_64__) +# define __NR_recvmmsg 299 +# elif defined(__i386__) +# define __NR_recvmmsg 337 +# elif defined(__arm__) +# define __NR_recvmmsg (UV_SYSCALL_BASE + 365) +# endif +#endif /* __NR_recvmsg */ + +#ifndef __NR_sendmmsg +# if defined(__x86_64__) +# define __NR_sendmmsg 307 +# elif defined(__i386__) +# define __NR_sendmmsg 345 +# elif defined(__arm__) +# define __NR_sendmmsg (UV_SYSCALL_BASE + 374) +# endif +#endif /* __NR_sendmmsg */ + +#ifndef __NR_utimensat +# if defined(__x86_64__) +# define __NR_utimensat 280 +# elif defined(__i386__) +# define __NR_utimensat 320 +# elif defined(__arm__) +# define __NR_utimensat (UV_SYSCALL_BASE + 348) +# endif +#endif /* __NR_utimensat */ + +#ifndef __NR_preadv +# if defined(__x86_64__) +# define __NR_preadv 295 +# elif defined(__i386__) +# define __NR_preadv 333 +# elif defined(__arm__) +# define __NR_preadv (UV_SYSCALL_BASE + 361) +# endif +#endif /* __NR_preadv */ + +#ifndef __NR_pwritev +# if defined(__x86_64__) +# define __NR_pwritev 296 +# elif defined(__i386__) +# define __NR_pwritev 334 +# elif defined(__arm__) +# define __NR_pwritev (UV_SYSCALL_BASE + 362) +# endif +#endif /* __NR_pwritev */ + +#ifndef __NR_dup3 +# if defined(__x86_64__) +# define __NR_dup3 292 +# elif defined(__i386__) +# define __NR_dup3 330 +# elif defined(__arm__) +# define __NR_dup3 (UV_SYSCALL_BASE + 358) +# endif +#endif /* __NR_pwritev */ + + +int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags) { +#if defined(__i386__) + unsigned long args[4]; + int r; + + args[0] = (unsigned long) fd; + args[1] = (unsigned long) addr; + args[2] = (unsigned long) addrlen; + args[3] = (unsigned long) flags; + + r = syscall(__NR_socketcall, 18 /* SYS_ACCEPT4 */, args); + + /* socketcall() raises EINVAL when SYS_ACCEPT4 is not supported but so does + * a bad flags argument. Try to distinguish between the two cases. + */ + if (r == -1) + if (errno == EINVAL) + if ((flags & ~(UV__SOCK_CLOEXEC|UV__SOCK_NONBLOCK)) == 0) + errno = ENOSYS; + + return r; +#elif defined(__NR_accept4) + return syscall(__NR_accept4, fd, addr, addrlen, flags); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__eventfd(unsigned int count) { +#if defined(__NR_eventfd) + return syscall(__NR_eventfd, count); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__eventfd2(unsigned int count, int flags) { +#if defined(__NR_eventfd2) + return syscall(__NR_eventfd2, count, flags); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__epoll_create(int size) { +#if defined(__NR_epoll_create) + return syscall(__NR_epoll_create, size); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__epoll_create1(int flags) { +#if defined(__NR_epoll_create1) + return syscall(__NR_epoll_create1, flags); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__epoll_ctl(int epfd, int op, int fd, struct uv__epoll_event* events) { +#if defined(__NR_epoll_ctl) + return syscall(__NR_epoll_ctl, epfd, op, fd, events); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__epoll_wait(int epfd, + struct uv__epoll_event* events, + int nevents, + int timeout) { +#if defined(__NR_epoll_wait) + int result; + result = syscall(__NR_epoll_wait, epfd, events, nevents, timeout); +#if MSAN_ACTIVE + if (result > 0) + __msan_unpoison(events, sizeof(events[0]) * result); +#endif + return result; +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__epoll_pwait(int epfd, + struct uv__epoll_event* events, + int nevents, + int timeout, + uint64_t sigmask) { +#if defined(__NR_epoll_pwait) + int result; + result = syscall(__NR_epoll_pwait, + epfd, + events, + nevents, + timeout, + &sigmask, + sizeof(sigmask)); +#if MSAN_ACTIVE + if (result > 0) + __msan_unpoison(events, sizeof(events[0]) * result); +#endif + return result; +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__inotify_init(void) { +#if defined(__NR_inotify_init) + return syscall(__NR_inotify_init); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__inotify_init1(int flags) { +#if defined(__NR_inotify_init1) + return syscall(__NR_inotify_init1, flags); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__inotify_add_watch(int fd, const char* path, uint32_t mask) { +#if defined(__NR_inotify_add_watch) + return syscall(__NR_inotify_add_watch, fd, path, mask); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__inotify_rm_watch(int fd, int32_t wd) { +#if defined(__NR_inotify_rm_watch) + return syscall(__NR_inotify_rm_watch, fd, wd); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__pipe2(int pipefd[2], int flags) { +#if defined(__NR_pipe2) + int result; + result = syscall(__NR_pipe2, pipefd, flags); +#if MSAN_ACTIVE + if (!result) + __msan_unpoison(pipefd, sizeof(int[2])); +#endif + return result; +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__sendmmsg(int fd, + struct uv__mmsghdr* mmsg, + unsigned int vlen, + unsigned int flags) { +#if defined(__NR_sendmmsg) + return syscall(__NR_sendmmsg, fd, mmsg, vlen, flags); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__recvmmsg(int fd, + struct uv__mmsghdr* mmsg, + unsigned int vlen, + unsigned int flags, + struct timespec* timeout) { +#if defined(__NR_recvmmsg) + return syscall(__NR_recvmmsg, fd, mmsg, vlen, flags, timeout); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__utimesat(int dirfd, + const char* path, + const struct timespec times[2], + int flags) +{ +#if defined(__NR_utimensat) + return syscall(__NR_utimensat, dirfd, path, times, flags); +#else + return errno = ENOSYS, -1; +#endif +} + + +ssize_t uv__preadv(int fd, const struct iovec *iov, int iovcnt, int64_t offset) { +#if defined(__NR_preadv) + return syscall(__NR_preadv, fd, iov, iovcnt, (long)offset, (long)(offset >> 32)); +#else + return errno = ENOSYS, -1; +#endif +} + + +ssize_t uv__pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset) { +#if defined(__NR_pwritev) + return syscall(__NR_pwritev, fd, iov, iovcnt, (long)offset, (long)(offset >> 32)); +#else + return errno = ENOSYS, -1; +#endif +} + + +int uv__dup3(int oldfd, int newfd, int flags) { +#if defined(__NR_dup3) + return syscall(__NR_dup3, oldfd, newfd, flags); +#else + return errno = ENOSYS, -1; +#endif +} diff --git a/3rdparty/libuv/src/unix/linux-syscalls.h b/3rdparty/libuv/src/unix/linux-syscalls.h new file mode 100644 index 00000000000..96e79439cf0 --- /dev/null +++ b/3rdparty/libuv/src/unix/linux-syscalls.h @@ -0,0 +1,158 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_LINUX_SYSCALL_H_ +#define UV_LINUX_SYSCALL_H_ + +#undef _GNU_SOURCE +#define _GNU_SOURCE + +#include +#include +#include +#include +#include + +#if defined(__alpha__) +# define UV__O_CLOEXEC 0x200000 +#elif defined(__hppa__) +# define UV__O_CLOEXEC 0x200000 +#elif defined(__sparc__) +# define UV__O_CLOEXEC 0x400000 +#else +# define UV__O_CLOEXEC 0x80000 +#endif + +#if defined(__alpha__) +# define UV__O_NONBLOCK 0x4 +#elif defined(__hppa__) +# define UV__O_NONBLOCK O_NONBLOCK +#elif defined(__mips__) +# define UV__O_NONBLOCK 0x80 +#elif defined(__sparc__) +# define UV__O_NONBLOCK 0x4000 +#else +# define UV__O_NONBLOCK 0x800 +#endif + +#define UV__EFD_CLOEXEC UV__O_CLOEXEC +#define UV__EFD_NONBLOCK UV__O_NONBLOCK + +#define UV__IN_CLOEXEC UV__O_CLOEXEC +#define UV__IN_NONBLOCK UV__O_NONBLOCK + +#define UV__SOCK_CLOEXEC UV__O_CLOEXEC +#if defined(SOCK_NONBLOCK) +# define UV__SOCK_NONBLOCK SOCK_NONBLOCK +#else +# define UV__SOCK_NONBLOCK UV__O_NONBLOCK +#endif + +/* epoll flags */ +#define UV__EPOLL_CLOEXEC UV__O_CLOEXEC +#define UV__EPOLL_CTL_ADD 1 +#define UV__EPOLL_CTL_DEL 2 +#define UV__EPOLL_CTL_MOD 3 + +#define UV__EPOLLIN 1 +#define UV__EPOLLOUT 4 +#define UV__EPOLLERR 8 +#define UV__EPOLLHUP 16 +#define UV__EPOLLONESHOT 0x40000000 +#define UV__EPOLLET 0x80000000 + +/* inotify flags */ +#define UV__IN_ACCESS 0x001 +#define UV__IN_MODIFY 0x002 +#define UV__IN_ATTRIB 0x004 +#define UV__IN_CLOSE_WRITE 0x008 +#define UV__IN_CLOSE_NOWRITE 0x010 +#define UV__IN_OPEN 0x020 +#define UV__IN_MOVED_FROM 0x040 +#define UV__IN_MOVED_TO 0x080 +#define UV__IN_CREATE 0x100 +#define UV__IN_DELETE 0x200 +#define UV__IN_DELETE_SELF 0x400 +#define UV__IN_MOVE_SELF 0x800 + +#if defined(__x86_64__) +struct uv__epoll_event { + uint32_t events; + uint64_t data; +} __attribute__((packed)); +#else +struct uv__epoll_event { + uint32_t events; + uint64_t data; +}; +#endif + +struct uv__inotify_event { + int32_t wd; + uint32_t mask; + uint32_t cookie; + uint32_t len; + /* char name[0]; */ +}; + +struct uv__mmsghdr { + struct msghdr msg_hdr; + unsigned int msg_len; +}; + +int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags); +int uv__eventfd(unsigned int count); +int uv__epoll_create(int size); +int uv__epoll_create1(int flags); +int uv__epoll_ctl(int epfd, int op, int fd, struct uv__epoll_event *ev); +int uv__epoll_wait(int epfd, + struct uv__epoll_event* events, + int nevents, + int timeout); +int uv__epoll_pwait(int epfd, + struct uv__epoll_event* events, + int nevents, + int timeout, + uint64_t sigmask); +int uv__eventfd2(unsigned int count, int flags); +int uv__inotify_init(void); +int uv__inotify_init1(int flags); +int uv__inotify_add_watch(int fd, const char* path, uint32_t mask); +int uv__inotify_rm_watch(int fd, int32_t wd); +int uv__pipe2(int pipefd[2], int flags); +int uv__recvmmsg(int fd, + struct uv__mmsghdr* mmsg, + unsigned int vlen, + unsigned int flags, + struct timespec* timeout); +int uv__sendmmsg(int fd, + struct uv__mmsghdr* mmsg, + unsigned int vlen, + unsigned int flags); +int uv__utimesat(int dirfd, + const char* path, + const struct timespec times[2], + int flags); +ssize_t uv__preadv(int fd, const struct iovec *iov, int iovcnt, int64_t offset); +ssize_t uv__pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset); +int uv__dup3(int oldfd, int newfd, int flags); + +#endif /* UV_LINUX_SYSCALL_H_ */ diff --git a/3rdparty/libuv/src/unix/loop-watcher.c b/3rdparty/libuv/src/unix/loop-watcher.c new file mode 100644 index 00000000000..340bb0dfa11 --- /dev/null +++ b/3rdparty/libuv/src/unix/loop-watcher.c @@ -0,0 +1,68 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#define UV_LOOP_WATCHER_DEFINE(name, type) \ + int uv_##name##_init(uv_loop_t* loop, uv_##name##_t* handle) { \ + uv__handle_init(loop, (uv_handle_t*)handle, UV_##type); \ + handle->name##_cb = NULL; \ + return 0; \ + } \ + \ + int uv_##name##_start(uv_##name##_t* handle, uv_##name##_cb cb) { \ + if (uv__is_active(handle)) return 0; \ + if (cb == NULL) return -EINVAL; \ + QUEUE_INSERT_HEAD(&handle->loop->name##_handles, &handle->queue); \ + handle->name##_cb = cb; \ + uv__handle_start(handle); \ + return 0; \ + } \ + \ + int uv_##name##_stop(uv_##name##_t* handle) { \ + if (!uv__is_active(handle)) return 0; \ + QUEUE_REMOVE(&handle->queue); \ + uv__handle_stop(handle); \ + return 0; \ + } \ + \ + void uv__run_##name(uv_loop_t* loop) { \ + uv_##name##_t* h; \ + QUEUE queue; \ + QUEUE* q; \ + QUEUE_MOVE(&loop->name##_handles, &queue); \ + while (!QUEUE_EMPTY(&queue)) { \ + q = QUEUE_HEAD(&queue); \ + h = QUEUE_DATA(q, uv_##name##_t, queue); \ + QUEUE_REMOVE(q); \ + QUEUE_INSERT_TAIL(&loop->name##_handles, q); \ + h->name##_cb(h); \ + } \ + } \ + \ + void uv__##name##_close(uv_##name##_t* handle) { \ + uv_##name##_stop(handle); \ + } + +UV_LOOP_WATCHER_DEFINE(prepare, PREPARE) +UV_LOOP_WATCHER_DEFINE(check, CHECK) +UV_LOOP_WATCHER_DEFINE(idle, IDLE) diff --git a/3rdparty/libuv/src/unix/loop.c b/3rdparty/libuv/src/unix/loop.c new file mode 100644 index 00000000000..92e96f09ed0 --- /dev/null +++ b/3rdparty/libuv/src/unix/loop.c @@ -0,0 +1,155 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "tree.h" +#include "internal.h" +#include "heap-inl.h" +#include +#include +#include + +int uv_loop_init(uv_loop_t* loop) { + int err; + + uv__signal_global_once_init(); + + memset(loop, 0, sizeof(*loop)); + heap_init((struct heap*) &loop->timer_heap); + QUEUE_INIT(&loop->wq); + QUEUE_INIT(&loop->active_reqs); + QUEUE_INIT(&loop->idle_handles); + QUEUE_INIT(&loop->async_handles); + QUEUE_INIT(&loop->check_handles); + QUEUE_INIT(&loop->prepare_handles); + QUEUE_INIT(&loop->handle_queue); + + loop->nfds = 0; + loop->watchers = NULL; + loop->nwatchers = 0; + QUEUE_INIT(&loop->pending_queue); + QUEUE_INIT(&loop->watcher_queue); + + loop->closing_handles = NULL; + uv__update_time(loop); + uv__async_init(&loop->async_watcher); + loop->signal_pipefd[0] = -1; + loop->signal_pipefd[1] = -1; + loop->backend_fd = -1; + loop->emfile_fd = -1; + + loop->timer_counter = 0; + loop->stop_flag = 0; + + err = uv__platform_loop_init(loop); + if (err) + return err; + + err = uv_signal_init(loop, &loop->child_watcher); + if (err) + goto fail_signal_init; + + uv__handle_unref(&loop->child_watcher); + loop->child_watcher.flags |= UV__HANDLE_INTERNAL; + QUEUE_INIT(&loop->process_handles); + + err = uv_rwlock_init(&loop->cloexec_lock); + if (err) + goto fail_rwlock_init; + + err = uv_mutex_init(&loop->wq_mutex); + if (err) + goto fail_mutex_init; + + err = uv_async_init(loop, &loop->wq_async, uv__work_done); + if (err) + goto fail_async_init; + + uv__handle_unref(&loop->wq_async); + loop->wq_async.flags |= UV__HANDLE_INTERNAL; + + return 0; + +fail_async_init: + uv_mutex_destroy(&loop->wq_mutex); + +fail_mutex_init: + uv_rwlock_destroy(&loop->cloexec_lock); + +fail_rwlock_init: + uv__signal_loop_cleanup(loop); + +fail_signal_init: + uv__platform_loop_delete(loop); + + return err; +} + + +void uv__loop_close(uv_loop_t* loop) { + uv__signal_loop_cleanup(loop); + uv__platform_loop_delete(loop); + uv__async_stop(loop, &loop->async_watcher); + + if (loop->emfile_fd != -1) { + uv__close(loop->emfile_fd); + loop->emfile_fd = -1; + } + + if (loop->backend_fd != -1) { + uv__close(loop->backend_fd); + loop->backend_fd = -1; + } + + uv_mutex_lock(&loop->wq_mutex); + assert(QUEUE_EMPTY(&loop->wq) && "thread pool work queue not empty!"); + assert(!uv__has_active_reqs(loop)); + uv_mutex_unlock(&loop->wq_mutex); + uv_mutex_destroy(&loop->wq_mutex); + + /* + * Note that all thread pool stuff is finished at this point and + * it is safe to just destroy rw lock + */ + uv_rwlock_destroy(&loop->cloexec_lock); + +#if 0 + assert(QUEUE_EMPTY(&loop->pending_queue)); + assert(QUEUE_EMPTY(&loop->watcher_queue)); + assert(loop->nfds == 0); +#endif + + uv__free(loop->watchers); + loop->watchers = NULL; + loop->nwatchers = 0; +} + + +int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) { + if (option != UV_LOOP_BLOCK_SIGNAL) + return UV_ENOSYS; + + if (va_arg(ap, int) != SIGPROF) + return UV_EINVAL; + + loop->flags |= UV_LOOP_BLOCK_SIGPROF; + return 0; +} diff --git a/3rdparty/libuv/src/unix/netbsd.c b/3rdparty/libuv/src/unix/netbsd.c new file mode 100644 index 00000000000..ca48550f9d9 --- /dev/null +++ b/3rdparty/libuv/src/unix/netbsd.c @@ -0,0 +1,370 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#undef NANOSEC +#define NANOSEC ((uint64_t) 1e9) + +static char *process_title; + + +int uv__platform_loop_init(uv_loop_t* loop) { + return uv__kqueue_init(loop); +} + + +void uv__platform_loop_delete(uv_loop_t* loop) { +} + + +uint64_t uv__hrtime(uv_clocktype_t type) { + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); +} + + +void uv_loadavg(double avg[3]) { + struct loadavg info; + size_t size = sizeof(info); + int which[] = {CTL_VM, VM_LOADAVG}; + + if (sysctl(which, 2, &info, &size, NULL, 0) == -1) return; + + avg[0] = (double) info.ldavg[0] / info.fscale; + avg[1] = (double) info.ldavg[1] / info.fscale; + avg[2] = (double) info.ldavg[2] / info.fscale; +} + + +int uv_exepath(char* buffer, size_t* size) { + int mib[4]; + size_t cb; + pid_t mypid; + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + mypid = getpid(); + mib[0] = CTL_KERN; + mib[1] = KERN_PROC_ARGS; + mib[2] = mypid; + mib[3] = KERN_PROC_ARGV; + + cb = *size; + if (sysctl(mib, 4, buffer, &cb, NULL, 0)) + return -errno; + *size = strlen(buffer); + + return 0; +} + + +uint64_t uv_get_free_memory(void) { + struct uvmexp info; + size_t size = sizeof(info); + int which[] = {CTL_VM, VM_UVMEXP}; + + if (sysctl(which, 2, &info, &size, NULL, 0)) + return -errno; + + return (uint64_t) info.free * sysconf(_SC_PAGESIZE); +} + + +uint64_t uv_get_total_memory(void) { +#if defined(HW_PHYSMEM64) + uint64_t info; + int which[] = {CTL_HW, HW_PHYSMEM64}; +#else + unsigned int info; + int which[] = {CTL_HW, HW_PHYSMEM}; +#endif + size_t size = sizeof(info); + + if (sysctl(which, 2, &info, &size, NULL, 0)) + return -errno; + + return (uint64_t) info; +} + + +char** uv_setup_args(int argc, char** argv) { + process_title = argc ? uv__strdup(argv[0]) : NULL; + return argv; +} + + +int uv_set_process_title(const char* title) { + if (process_title) uv__free(process_title); + + process_title = uv__strdup(title); + setproctitle("%s", title); + + return 0; +} + + +int uv_get_process_title(char* buffer, size_t size) { + if (process_title) { + strncpy(buffer, process_title, size); + } else { + if (size > 0) { + buffer[0] = '\0'; + } + } + + return 0; +} + + +int uv_resident_set_memory(size_t* rss) { + kvm_t *kd = NULL; + struct kinfo_proc2 *kinfo = NULL; + pid_t pid; + int nprocs; + int max_size = sizeof(struct kinfo_proc2); + int page_size; + + page_size = getpagesize(); + pid = getpid(); + + kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, "kvm_open"); + + if (kd == NULL) goto error; + + kinfo = kvm_getproc2(kd, KERN_PROC_PID, pid, max_size, &nprocs); + if (kinfo == NULL) goto error; + + *rss = kinfo->p_vm_rssize * page_size; + + kvm_close(kd); + + return 0; + +error: + if (kd) kvm_close(kd); + return -EPERM; +} + + +int uv_uptime(double* uptime) { + time_t now; + struct timeval info; + size_t size = sizeof(info); + static int which[] = {CTL_KERN, KERN_BOOTTIME}; + + if (sysctl(which, 2, &info, &size, NULL, 0)) + return -errno; + + now = time(NULL); + + *uptime = (double)(now - info.tv_sec); + return 0; +} + + +int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { + unsigned int ticks = (unsigned int)sysconf(_SC_CLK_TCK); + unsigned int multiplier = ((uint64_t)1000L / ticks); + unsigned int cur = 0; + uv_cpu_info_t* cpu_info; + u_int64_t* cp_times; + char model[512]; + u_int64_t cpuspeed; + int numcpus; + size_t size; + int i; + + size = sizeof(model); + if (sysctlbyname("machdep.cpu_brand", &model, &size, NULL, 0) && + sysctlbyname("hw.model", &model, &size, NULL, 0)) { + return -errno; + } + + size = sizeof(numcpus); + if (sysctlbyname("hw.ncpu", &numcpus, &size, NULL, 0)) + return -errno; + *count = numcpus; + + /* Only i386 and amd64 have machdep.tsc_freq */ + size = sizeof(cpuspeed); + if (sysctlbyname("machdep.tsc_freq", &cpuspeed, &size, NULL, 0)) + cpuspeed = 0; + + size = numcpus * CPUSTATES * sizeof(*cp_times); + cp_times = uv__malloc(size); + if (cp_times == NULL) + return -ENOMEM; + + if (sysctlbyname("kern.cp_time", cp_times, &size, NULL, 0)) + return -errno; + + *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos)); + if (!(*cpu_infos)) { + uv__free(cp_times); + uv__free(*cpu_infos); + return -ENOMEM; + } + + for (i = 0; i < numcpus; i++) { + cpu_info = &(*cpu_infos)[i]; + cpu_info->cpu_times.user = (uint64_t)(cp_times[CP_USER+cur]) * multiplier; + cpu_info->cpu_times.nice = (uint64_t)(cp_times[CP_NICE+cur]) * multiplier; + cpu_info->cpu_times.sys = (uint64_t)(cp_times[CP_SYS+cur]) * multiplier; + cpu_info->cpu_times.idle = (uint64_t)(cp_times[CP_IDLE+cur]) * multiplier; + cpu_info->cpu_times.irq = (uint64_t)(cp_times[CP_INTR+cur]) * multiplier; + cpu_info->model = uv__strdup(model); + cpu_info->speed = (int)(cpuspeed/(uint64_t) 1e6); + cur += CPUSTATES; + } + uv__free(cp_times); + return 0; +} + + +void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(cpu_infos[i].model); + } + + uv__free(cpu_infos); +} + + +int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { + struct ifaddrs *addrs, *ent; + uv_interface_address_t* address; + int i; + struct sockaddr_dl *sa_addr; + + if (getifaddrs(&addrs)) + return -errno; + + *count = 0; + + /* Count the number of interfaces */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family != PF_INET)) { + continue; + } + (*count)++; + } + + *addresses = uv__malloc(*count * sizeof(**addresses)); + + if (!(*addresses)) { + freeifaddrs(addrs); + return -ENOMEM; + } + + address = *addresses; + + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING))) + continue; + + if (ent->ifa_addr == NULL) + continue; + + if (ent->ifa_addr->sa_family != PF_INET) + continue; + + address->name = uv__strdup(ent->ifa_name); + + if (ent->ifa_addr->sa_family == AF_INET6) { + address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr); + } else { + address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr); + } + + if (ent->ifa_netmask->sa_family == AF_INET6) { + address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask); + } else { + address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask); + } + + address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK); + + address++; + } + + /* Fill in physical addresses for each interface */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family != AF_LINK)) { + continue; + } + + address = *addresses; + + for (i = 0; i < (*count); i++) { + if (strcmp(address->name, ent->ifa_name) == 0) { + sa_addr = (struct sockaddr_dl*)(ent->ifa_addr); + memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); + } + address++; + } + } + + freeifaddrs(addrs); + + return 0; +} + + +void uv_free_interface_addresses(uv_interface_address_t* addresses, int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(addresses[i].name); + } + + uv__free(addresses); +} diff --git a/3rdparty/libuv/src/unix/openbsd.c b/3rdparty/libuv/src/unix/openbsd.c new file mode 100644 index 00000000000..6a3909a666c --- /dev/null +++ b/3rdparty/libuv/src/unix/openbsd.c @@ -0,0 +1,386 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#undef NANOSEC +#define NANOSEC ((uint64_t) 1e9) + + +static char *process_title; + + +int uv__platform_loop_init(uv_loop_t* loop) { + return uv__kqueue_init(loop); +} + + +void uv__platform_loop_delete(uv_loop_t* loop) { +} + + +uint64_t uv__hrtime(uv_clocktype_t type) { + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); +} + + +void uv_loadavg(double avg[3]) { + struct loadavg info; + size_t size = sizeof(info); + int which[] = {CTL_VM, VM_LOADAVG}; + + if (sysctl(which, 2, &info, &size, NULL, 0) < 0) return; + + avg[0] = (double) info.ldavg[0] / info.fscale; + avg[1] = (double) info.ldavg[1] / info.fscale; + avg[2] = (double) info.ldavg[2] / info.fscale; +} + + +int uv_exepath(char* buffer, size_t* size) { + int mib[4]; + char **argsbuf = NULL; + char **argsbuf_tmp; + size_t argsbuf_size = 100U; + size_t exepath_size; + pid_t mypid; + int err; + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + mypid = getpid(); + for (;;) { + err = -ENOMEM; + argsbuf_tmp = uv__realloc(argsbuf, argsbuf_size); + if (argsbuf_tmp == NULL) + goto out; + argsbuf = argsbuf_tmp; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC_ARGS; + mib[2] = mypid; + mib[3] = KERN_PROC_ARGV; + if (sysctl(mib, 4, argsbuf, &argsbuf_size, NULL, 0) == 0) { + break; + } + if (errno != ENOMEM) { + err = -errno; + goto out; + } + argsbuf_size *= 2U; + } + + if (argsbuf[0] == NULL) { + err = -EINVAL; /* FIXME(bnoordhuis) More appropriate error. */ + goto out; + } + + *size -= 1; + exepath_size = strlen(argsbuf[0]); + if (*size > exepath_size) + *size = exepath_size; + + memcpy(buffer, argsbuf[0], *size); + buffer[*size] = '\0'; + err = 0; + +out: + uv__free(argsbuf); + + return err; +} + + +uint64_t uv_get_free_memory(void) { + struct uvmexp info; + size_t size = sizeof(info); + int which[] = {CTL_VM, VM_UVMEXP}; + + if (sysctl(which, 2, &info, &size, NULL, 0)) + return -errno; + + return (uint64_t) info.free * sysconf(_SC_PAGESIZE); +} + + +uint64_t uv_get_total_memory(void) { + uint64_t info; + int which[] = {CTL_HW, HW_PHYSMEM64}; + size_t size = sizeof(info); + + if (sysctl(which, 2, &info, &size, NULL, 0)) + return -errno; + + return (uint64_t) info; +} + + +char** uv_setup_args(int argc, char** argv) { + process_title = argc ? uv__strdup(argv[0]) : NULL; + return argv; +} + + +int uv_set_process_title(const char* title) { + uv__free(process_title); + process_title = uv__strdup(title); + setproctitle(title); + return 0; +} + + +int uv_get_process_title(char* buffer, size_t size) { + if (process_title) { + strncpy(buffer, process_title, size); + } else { + if (size > 0) { + buffer[0] = '\0'; + } + } + + return 0; +} + + +int uv_resident_set_memory(size_t* rss) { + struct kinfo_proc kinfo; + size_t page_size = getpagesize(); + size_t size = sizeof(struct kinfo_proc); + int mib[6]; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = getpid(); + mib[4] = sizeof(struct kinfo_proc); + mib[5] = 1; + + if (sysctl(mib, 6, &kinfo, &size, NULL, 0) < 0) + return -errno; + + *rss = kinfo.p_vm_rssize * page_size; + return 0; +} + + +int uv_uptime(double* uptime) { + time_t now; + struct timeval info; + size_t size = sizeof(info); + static int which[] = {CTL_KERN, KERN_BOOTTIME}; + + if (sysctl(which, 2, &info, &size, NULL, 0)) + return -errno; + + now = time(NULL); + + *uptime = (double)(now - info.tv_sec); + return 0; +} + + +int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { + unsigned int ticks = (unsigned int)sysconf(_SC_CLK_TCK), + multiplier = ((uint64_t)1000L / ticks), cpuspeed; + uint64_t info[CPUSTATES]; + char model[512]; + int numcpus = 1; + int which[] = {CTL_HW,HW_MODEL,0}; + size_t size; + int i; + uv_cpu_info_t* cpu_info; + + size = sizeof(model); + if (sysctl(which, 2, &model, &size, NULL, 0)) + return -errno; + + which[1] = HW_NCPU; + size = sizeof(numcpus); + if (sysctl(which, 2, &numcpus, &size, NULL, 0)) + return -errno; + + *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos)); + if (!(*cpu_infos)) + return -ENOMEM; + + *count = numcpus; + + which[1] = HW_CPUSPEED; + size = sizeof(cpuspeed); + if (sysctl(which, 2, &cpuspeed, &size, NULL, 0)) { + SAVE_ERRNO(uv__free(*cpu_infos)); + return -errno; + } + + size = sizeof(info); + which[0] = CTL_KERN; + which[1] = KERN_CPTIME2; + for (i = 0; i < numcpus; i++) { + which[2] = i; + size = sizeof(info); + if (sysctl(which, 3, &info, &size, NULL, 0)) { + SAVE_ERRNO(uv__free(*cpu_infos)); + return -errno; + } + + cpu_info = &(*cpu_infos)[i]; + + cpu_info->cpu_times.user = (uint64_t)(info[CP_USER]) * multiplier; + cpu_info->cpu_times.nice = (uint64_t)(info[CP_NICE]) * multiplier; + cpu_info->cpu_times.sys = (uint64_t)(info[CP_SYS]) * multiplier; + cpu_info->cpu_times.idle = (uint64_t)(info[CP_IDLE]) * multiplier; + cpu_info->cpu_times.irq = (uint64_t)(info[CP_INTR]) * multiplier; + + cpu_info->model = uv__strdup(model); + cpu_info->speed = cpuspeed; + } + + return 0; +} + + +void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(cpu_infos[i].model); + } + + uv__free(cpu_infos); +} + + +int uv_interface_addresses(uv_interface_address_t** addresses, + int* count) { + struct ifaddrs *addrs, *ent; + uv_interface_address_t* address; + int i; + struct sockaddr_dl *sa_addr; + + if (getifaddrs(&addrs) != 0) + return -errno; + + *count = 0; + + /* Count the number of interfaces */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family != PF_INET)) { + continue; + } + (*count)++; + } + + *addresses = uv__malloc(*count * sizeof(**addresses)); + + if (!(*addresses)) { + freeifaddrs(addrs); + return -ENOMEM; + } + + address = *addresses; + + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING))) + continue; + + if (ent->ifa_addr == NULL) + continue; + + if (ent->ifa_addr->sa_family != PF_INET) + continue; + + address->name = uv__strdup(ent->ifa_name); + + if (ent->ifa_addr->sa_family == AF_INET6) { + address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr); + } else { + address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr); + } + + if (ent->ifa_netmask->sa_family == AF_INET6) { + address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask); + } else { + address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask); + } + + address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK); + + address++; + } + + /* Fill in physical addresses for each interface */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family != AF_LINK)) { + continue; + } + + address = *addresses; + + for (i = 0; i < (*count); i++) { + if (strcmp(address->name, ent->ifa_name) == 0) { + sa_addr = (struct sockaddr_dl*)(ent->ifa_addr); + memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); + } + address++; + } + } + + freeifaddrs(addrs); + + return 0; +} + + +void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(addresses[i].name); + } + + uv__free(addresses); +} diff --git a/3rdparty/libuv/src/unix/pipe.c b/3rdparty/libuv/src/unix/pipe.c new file mode 100644 index 00000000000..7f87a713bf4 --- /dev/null +++ b/3rdparty/libuv/src/unix/pipe.c @@ -0,0 +1,288 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + + +int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) { + uv__stream_init(loop, (uv_stream_t*)handle, UV_NAMED_PIPE); + handle->shutdown_req = NULL; + handle->connect_req = NULL; + handle->pipe_fname = NULL; + handle->ipc = ipc; + return 0; +} + + +int uv_pipe_bind(uv_pipe_t* handle, const char* name) { + struct sockaddr_un saddr; + const char* pipe_fname; + int sockfd; + int err; + + pipe_fname = NULL; + sockfd = -1; + + /* Already bound? */ + if (uv__stream_fd(handle) >= 0) + return -EINVAL; + + /* Make a copy of the file name, it outlives this function's scope. */ + pipe_fname = uv__strdup(name); + if (pipe_fname == NULL) + return -ENOMEM; + + /* We've got a copy, don't touch the original any more. */ + name = NULL; + + err = uv__socket(AF_UNIX, SOCK_STREAM, 0); + if (err < 0) + goto err_socket; + sockfd = err; + + memset(&saddr, 0, sizeof saddr); + strncpy(saddr.sun_path, pipe_fname, sizeof(saddr.sun_path) - 1); + saddr.sun_path[sizeof(saddr.sun_path) - 1] = '\0'; + saddr.sun_family = AF_UNIX; + + if (bind(sockfd, (struct sockaddr*)&saddr, sizeof saddr)) { + err = -errno; + /* Convert ENOENT to EACCES for compatibility with Windows. */ + if (err == -ENOENT) + err = -EACCES; + goto err_bind; + } + + /* Success. */ + handle->pipe_fname = pipe_fname; /* Is a strdup'ed copy. */ + handle->io_watcher.fd = sockfd; + return 0; + +err_bind: + uv__close(sockfd); + +err_socket: + uv__free((void*)pipe_fname); + return err; +} + + +int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb) { + if (uv__stream_fd(handle) == -1) + return -EINVAL; + + if (listen(uv__stream_fd(handle), backlog)) + return -errno; + + handle->connection_cb = cb; + handle->io_watcher.cb = uv__server_io; + uv__io_start(handle->loop, &handle->io_watcher, UV__POLLIN); + return 0; +} + + +void uv__pipe_close(uv_pipe_t* handle) { + if (handle->pipe_fname) { + /* + * Unlink the file system entity before closing the file descriptor. + * Doing it the other way around introduces a race where our process + * unlinks a socket with the same name that's just been created by + * another thread or process. + */ + unlink(handle->pipe_fname); + uv__free((void*)handle->pipe_fname); + handle->pipe_fname = NULL; + } + + uv__stream_close((uv_stream_t*)handle); +} + + +int uv_pipe_open(uv_pipe_t* handle, uv_file fd) { + int err; + + err = uv__nonblock(fd, 1); + if (err) + return err; + +#if defined(__APPLE__) + err = uv__stream_try_select((uv_stream_t*) handle, &fd); + if (err) + return err; +#endif /* defined(__APPLE__) */ + + return uv__stream_open((uv_stream_t*)handle, + fd, + UV_STREAM_READABLE | UV_STREAM_WRITABLE); +} + + +void uv_pipe_connect(uv_connect_t* req, + uv_pipe_t* handle, + const char* name, + uv_connect_cb cb) { + struct sockaddr_un saddr; + int new_sock; + int err; + int r; + + new_sock = (uv__stream_fd(handle) == -1); + + if (new_sock) { + err = uv__socket(AF_UNIX, SOCK_STREAM, 0); + if (err < 0) + goto out; + handle->io_watcher.fd = err; + } + + memset(&saddr, 0, sizeof saddr); + strncpy(saddr.sun_path, name, sizeof(saddr.sun_path) - 1); + saddr.sun_path[sizeof(saddr.sun_path) - 1] = '\0'; + saddr.sun_family = AF_UNIX; + + do { + r = connect(uv__stream_fd(handle), + (struct sockaddr*)&saddr, sizeof saddr); + } + while (r == -1 && errno == EINTR); + + if (r == -1 && errno != EINPROGRESS) { + err = -errno; + goto out; + } + + err = 0; + if (new_sock) { + err = uv__stream_open((uv_stream_t*)handle, + uv__stream_fd(handle), + UV_STREAM_READABLE | UV_STREAM_WRITABLE); + } + + if (err == 0) + uv__io_start(handle->loop, &handle->io_watcher, UV__POLLIN | UV__POLLOUT); + +out: + handle->delayed_error = err; + handle->connect_req = req; + + uv__req_init(handle->loop, req, UV_CONNECT); + req->handle = (uv_stream_t*)handle; + req->cb = cb; + QUEUE_INIT(&req->queue); + + /* Force callback to run on next tick in case of error. */ + if (err) + uv__io_feed(handle->loop, &handle->io_watcher); + + /* Mimic the Windows pipe implementation, always + * return 0 and let the callback handle errors. + */ +} + + +typedef int (*uv__peersockfunc)(int, struct sockaddr*, socklen_t*); + + +static int uv__pipe_getsockpeername(const uv_pipe_t* handle, + uv__peersockfunc func, + char* buffer, + size_t* size) { + struct sockaddr_un sa; + socklen_t addrlen; + int err; + + addrlen = sizeof(sa); + memset(&sa, 0, addrlen); + err = func(uv__stream_fd(handle), (struct sockaddr*) &sa, &addrlen); + if (err < 0) { + *size = 0; + return -errno; + } + +#if defined(__linux__) + if (sa.sun_path[0] == 0) + /* Linux abstract namespace */ + addrlen -= offsetof(struct sockaddr_un, sun_path); + else +#endif + addrlen = strlen(sa.sun_path); + + + if (addrlen > *size) { + *size = addrlen; + return UV_ENOBUFS; + } + + memcpy(buffer, sa.sun_path, addrlen); + *size = addrlen; + + return 0; +} + + +int uv_pipe_getsockname(const uv_pipe_t* handle, char* buffer, size_t* size) { + return uv__pipe_getsockpeername(handle, getsockname, buffer, size); +} + + +int uv_pipe_getpeername(const uv_pipe_t* handle, char* buffer, size_t* size) { + return uv__pipe_getsockpeername(handle, getpeername, buffer, size); +} + + +void uv_pipe_pending_instances(uv_pipe_t* handle, int count) { +} + + +int uv_pipe_pending_count(uv_pipe_t* handle) { + uv__stream_queued_fds_t* queued_fds; + + if (!handle->ipc) + return 0; + + if (handle->accepted_fd == -1) + return 0; + + if (handle->queued_fds == NULL) + return 1; + + queued_fds = handle->queued_fds; + return queued_fds->offset + 1; +} + + +uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) { + if (!handle->ipc) + return UV_UNKNOWN_HANDLE; + + if (handle->accepted_fd == -1) + return UV_UNKNOWN_HANDLE; + else + return uv__handle_type(handle->accepted_fd); +} diff --git a/3rdparty/libuv/src/unix/poll.c b/3rdparty/libuv/src/unix/poll.c new file mode 100644 index 00000000000..37da3b95851 --- /dev/null +++ b/3rdparty/libuv/src/unix/poll.c @@ -0,0 +1,113 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include + + +static void uv__poll_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { + uv_poll_t* handle; + int pevents; + + handle = container_of(w, uv_poll_t, io_watcher); + + if (events & UV__POLLERR) { + uv__io_stop(loop, w, UV__POLLIN | UV__POLLOUT); + uv__handle_stop(handle); + handle->poll_cb(handle, -EBADF, 0); + return; + } + + pevents = 0; + if (events & UV__POLLIN) + pevents |= UV_READABLE; + if (events & UV__POLLOUT) + pevents |= UV_WRITABLE; + + handle->poll_cb(handle, 0, pevents); +} + + +int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) { + int err; + + err = uv__nonblock(fd, 1); + if (err) + return err; + + uv__handle_init(loop, (uv_handle_t*) handle, UV_POLL); + uv__io_init(&handle->io_watcher, uv__poll_io, fd); + handle->poll_cb = NULL; + return 0; +} + + +int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle, + uv_os_sock_t socket) { + return uv_poll_init(loop, handle, socket); +} + + +static void uv__poll_stop(uv_poll_t* handle) { + uv__io_stop(handle->loop, &handle->io_watcher, UV__POLLIN | UV__POLLOUT); + uv__handle_stop(handle); +} + + +int uv_poll_stop(uv_poll_t* handle) { + assert(!(handle->flags & (UV_CLOSING | UV_CLOSED))); + uv__poll_stop(handle); + return 0; +} + + +int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) { + int events; + + assert((pevents & ~(UV_READABLE | UV_WRITABLE)) == 0); + assert(!(handle->flags & (UV_CLOSING | UV_CLOSED))); + + uv__poll_stop(handle); + + if (pevents == 0) + return 0; + + events = 0; + if (pevents & UV_READABLE) + events |= UV__POLLIN; + if (pevents & UV_WRITABLE) + events |= UV__POLLOUT; + + uv__io_start(handle->loop, &handle->io_watcher, events); + uv__handle_start(handle); + handle->poll_cb = poll_cb; + + return 0; +} + + +void uv__poll_close(uv_poll_t* handle) { + uv__poll_stop(handle); +} diff --git a/3rdparty/libuv/src/unix/process.c b/3rdparty/libuv/src/unix/process.c new file mode 100644 index 00000000000..571f8cd778c --- /dev/null +++ b/3rdparty/libuv/src/unix/process.c @@ -0,0 +1,563 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if defined(__APPLE__) && !TARGET_OS_IPHONE +# include +# define environ (*_NSGetEnviron()) +#else +extern char **environ; +#endif + +#ifdef __linux__ +# include +#endif + + +static void uv__chld(uv_signal_t* handle, int signum) { + uv_process_t* process; + uv_loop_t* loop; + int exit_status; + int term_signal; + int status; + pid_t pid; + QUEUE pending; + QUEUE* q; + QUEUE* h; + + assert(signum == SIGCHLD); + + QUEUE_INIT(&pending); + loop = handle->loop; + + h = &loop->process_handles; + q = QUEUE_HEAD(h); + while (q != h) { + process = QUEUE_DATA(q, uv_process_t, queue); + q = QUEUE_NEXT(q); + + do + pid = waitpid(process->pid, &status, WNOHANG); + while (pid == -1 && errno == EINTR); + + if (pid == 0) + continue; + + if (pid == -1) { + if (errno != ECHILD) + abort(); + continue; + } + + process->status = status; + QUEUE_REMOVE(&process->queue); + QUEUE_INSERT_TAIL(&pending, &process->queue); + } + + h = &pending; + q = QUEUE_HEAD(h); + while (q != h) { + process = QUEUE_DATA(q, uv_process_t, queue); + q = QUEUE_NEXT(q); + + QUEUE_REMOVE(&process->queue); + QUEUE_INIT(&process->queue); + uv__handle_stop(process); + + if (process->exit_cb == NULL) + continue; + + exit_status = 0; + if (WIFEXITED(process->status)) + exit_status = WEXITSTATUS(process->status); + + term_signal = 0; + if (WIFSIGNALED(process->status)) + term_signal = WTERMSIG(process->status); + + process->exit_cb(process, exit_status, term_signal); + } + assert(QUEUE_EMPTY(&pending)); +} + + +int uv__make_socketpair(int fds[2], int flags) { +#if defined(__linux__) + static int no_cloexec; + + if (no_cloexec) + goto skip; + + if (socketpair(AF_UNIX, SOCK_STREAM | UV__SOCK_CLOEXEC | flags, 0, fds) == 0) + return 0; + + /* Retry on EINVAL, it means SOCK_CLOEXEC is not supported. + * Anything else is a genuine error. + */ + if (errno != EINVAL) + return -errno; + + no_cloexec = 1; + +skip: +#endif + + if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds)) + return -errno; + + uv__cloexec(fds[0], 1); + uv__cloexec(fds[1], 1); + + if (flags & UV__F_NONBLOCK) { + uv__nonblock(fds[0], 1); + uv__nonblock(fds[1], 1); + } + + return 0; +} + + +int uv__make_pipe(int fds[2], int flags) { +#if defined(__linux__) + static int no_pipe2; + + if (no_pipe2) + goto skip; + + if (uv__pipe2(fds, flags | UV__O_CLOEXEC) == 0) + return 0; + + if (errno != ENOSYS) + return -errno; + + no_pipe2 = 1; + +skip: +#endif + + if (pipe(fds)) + return -errno; + + uv__cloexec(fds[0], 1); + uv__cloexec(fds[1], 1); + + if (flags & UV__F_NONBLOCK) { + uv__nonblock(fds[0], 1); + uv__nonblock(fds[1], 1); + } + + return 0; +} + + +/* + * Used for initializing stdio streams like options.stdin_stream. Returns + * zero on success. See also the cleanup section in uv_spawn(). + */ +static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) { + int mask; + int fd; + + mask = UV_IGNORE | UV_CREATE_PIPE | UV_INHERIT_FD | UV_INHERIT_STREAM; + + switch (container->flags & mask) { + case UV_IGNORE: + return 0; + + case UV_CREATE_PIPE: + assert(container->data.stream != NULL); + if (container->data.stream->type != UV_NAMED_PIPE) + return -EINVAL; + else + return uv__make_socketpair(fds, 0); + + case UV_INHERIT_FD: + case UV_INHERIT_STREAM: + if (container->flags & UV_INHERIT_FD) + fd = container->data.fd; + else + fd = uv__stream_fd(container->data.stream); + + if (fd == -1) + return -EINVAL; + + fds[1] = fd; + return 0; + + default: + assert(0 && "Unexpected flags"); + return -EINVAL; + } +} + + +static int uv__process_open_stream(uv_stdio_container_t* container, + int pipefds[2], + int writable) { + int flags; + int err; + + if (!(container->flags & UV_CREATE_PIPE) || pipefds[0] < 0) + return 0; + + err = uv__close(pipefds[1]); + if (err != 0 && err != -EINPROGRESS) + abort(); + + pipefds[1] = -1; + uv__nonblock(pipefds[0], 1); + + if (container->data.stream->type == UV_NAMED_PIPE && + ((uv_pipe_t*)container->data.stream)->ipc) + flags = UV_STREAM_READABLE | UV_STREAM_WRITABLE; + else if (writable) + flags = UV_STREAM_WRITABLE; + else + flags = UV_STREAM_READABLE; + + return uv__stream_open(container->data.stream, pipefds[0], flags); +} + + +static void uv__process_close_stream(uv_stdio_container_t* container) { + if (!(container->flags & UV_CREATE_PIPE)) return; + uv__stream_close((uv_stream_t*)container->data.stream); +} + + +static void uv__write_int(int fd, int val) { + ssize_t n; + + do + n = write(fd, &val, sizeof(val)); + while (n == -1 && errno == EINTR); + + if (n == -1 && errno == EPIPE) + return; /* parent process has quit */ + + assert(n == sizeof(val)); +} + + +#if !(defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH)) +/* execvp is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED, so must be + * avoided. Since this isn't called on those targets, the function + * doesn't even need to be defined for them. + */ +static void uv__process_child_init(const uv_process_options_t* options, + int stdio_count, + int (*pipes)[2], + int error_fd) { + int close_fd; + int use_fd; + int fd; + + if (options->flags & UV_PROCESS_DETACHED) + setsid(); + + /* First duplicate low numbered fds, since it's not safe to duplicate them, + * they could get replaced. Example: swapping stdout and stderr; without + * this fd 2 (stderr) would be duplicated into fd 1, thus making both + * stdout and stderr go to the same fd, which was not the intention. */ + for (fd = 0; fd < stdio_count; fd++) { + use_fd = pipes[fd][1]; + if (use_fd < 0 || use_fd >= fd) + continue; + pipes[fd][1] = fcntl(use_fd, F_DUPFD, stdio_count); + if (pipes[fd][1] == -1) { + uv__write_int(error_fd, -errno); + _exit(127); + } + } + + for (fd = 0; fd < stdio_count; fd++) { + close_fd = pipes[fd][0]; + use_fd = pipes[fd][1]; + + if (use_fd < 0) { + if (fd >= 3) + continue; + else { + /* redirect stdin, stdout and stderr to /dev/null even if UV_IGNORE is + * set + */ + use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR); + close_fd = use_fd; + + if (use_fd == -1) { + uv__write_int(error_fd, -errno); + _exit(127); + } + } + } + + if (fd == use_fd) + uv__cloexec(use_fd, 0); + else + fd = dup2(use_fd, fd); + + if (fd == -1) { + uv__write_int(error_fd, -errno); + _exit(127); + } + + if (fd <= 2) + uv__nonblock(fd, 0); + + if (close_fd >= stdio_count) + uv__close(close_fd); + } + + for (fd = 0; fd < stdio_count; fd++) { + use_fd = pipes[fd][1]; + + if (use_fd >= stdio_count) + uv__close(use_fd); + } + + if (options->cwd != NULL && chdir(options->cwd)) { + uv__write_int(error_fd, -errno); + _exit(127); + } + + if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) { + /* When dropping privileges from root, the `setgroups` call will + * remove any extraneous groups. If we don't call this, then + * even though our uid has dropped, we may still have groups + * that enable us to do super-user things. This will fail if we + * aren't root, so don't bother checking the return value, this + * is just done as an optimistic privilege dropping function. + */ + SAVE_ERRNO(setgroups(0, NULL)); + } + + if ((options->flags & UV_PROCESS_SETGID) && setgid(options->gid)) { + uv__write_int(error_fd, -errno); + _exit(127); + } + + if ((options->flags & UV_PROCESS_SETUID) && setuid(options->uid)) { + uv__write_int(error_fd, -errno); + _exit(127); + } + + if (options->env != NULL) { + environ = options->env; + } + + execvp(options->file, options->args); + uv__write_int(error_fd, -errno); + _exit(127); +} +#endif + + +int uv_spawn(uv_loop_t* loop, + uv_process_t* process, + const uv_process_options_t* options) { +#if defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH) + /* fork is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED. */ + return -ENOSYS; +#else + int signal_pipe[2] = { -1, -1 }; + int (*pipes)[2]; + int stdio_count; + ssize_t r; + pid_t pid; + int err; + int exec_errorno; + int i; + int status; + + assert(options->file != NULL); + assert(!(options->flags & ~(UV_PROCESS_DETACHED | + UV_PROCESS_SETGID | + UV_PROCESS_SETUID | + UV_PROCESS_WINDOWS_HIDE | + UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS))); + + uv__handle_init(loop, (uv_handle_t*)process, UV_PROCESS); + QUEUE_INIT(&process->queue); + + stdio_count = options->stdio_count; + if (stdio_count < 3) + stdio_count = 3; + + err = -ENOMEM; + pipes = uv__malloc(stdio_count * sizeof(*pipes)); + if (pipes == NULL) + goto error; + + for (i = 0; i < stdio_count; i++) { + pipes[i][0] = -1; + pipes[i][1] = -1; + } + + for (i = 0; i < options->stdio_count; i++) { + err = uv__process_init_stdio(options->stdio + i, pipes[i]); + if (err) + goto error; + } + + /* This pipe is used by the parent to wait until + * the child has called `execve()`. We need this + * to avoid the following race condition: + * + * if ((pid = fork()) > 0) { + * kill(pid, SIGTERM); + * } + * else if (pid == 0) { + * execve("/bin/cat", argp, envp); + * } + * + * The parent sends a signal immediately after forking. + * Since the child may not have called `execve()` yet, + * there is no telling what process receives the signal, + * our fork or /bin/cat. + * + * To avoid ambiguity, we create a pipe with both ends + * marked close-on-exec. Then, after the call to `fork()`, + * the parent polls the read end until it EOFs or errors with EPIPE. + */ + err = uv__make_pipe(signal_pipe, 0); + if (err) + goto error; + + uv_signal_start(&loop->child_watcher, uv__chld, SIGCHLD); + + /* Acquire write lock to prevent opening new fds in worker threads */ + uv_rwlock_wrlock(&loop->cloexec_lock); + pid = fork(); + + if (pid == -1) { + err = -errno; + uv_rwlock_wrunlock(&loop->cloexec_lock); + uv__close(signal_pipe[0]); + uv__close(signal_pipe[1]); + goto error; + } + + if (pid == 0) { + uv__process_child_init(options, stdio_count, pipes, signal_pipe[1]); + abort(); + } + + /* Release lock in parent process */ + uv_rwlock_wrunlock(&loop->cloexec_lock); + uv__close(signal_pipe[1]); + + process->status = 0; + exec_errorno = 0; + do + r = read(signal_pipe[0], &exec_errorno, sizeof(exec_errorno)); + while (r == -1 && errno == EINTR); + + if (r == 0) + ; /* okay, EOF */ + else if (r == sizeof(exec_errorno)) { + do + err = waitpid(pid, &status, 0); /* okay, read errorno */ + while (err == -1 && errno == EINTR); + assert(err == pid); + } else if (r == -1 && errno == EPIPE) { + do + err = waitpid(pid, &status, 0); /* okay, got EPIPE */ + while (err == -1 && errno == EINTR); + assert(err == pid); + } else + abort(); + + uv__close(signal_pipe[0]); + + for (i = 0; i < options->stdio_count; i++) { + err = uv__process_open_stream(options->stdio + i, pipes[i], i == 0); + if (err == 0) + continue; + + while (i--) + uv__process_close_stream(options->stdio + i); + + goto error; + } + + /* Only activate this handle if exec() happened successfully */ + if (exec_errorno == 0) { + QUEUE_INSERT_TAIL(&loop->process_handles, &process->queue); + uv__handle_start(process); + } + + process->pid = pid; + process->exit_cb = options->exit_cb; + + uv__free(pipes); + return exec_errorno; + +error: + if (pipes != NULL) { + for (i = 0; i < stdio_count; i++) { + if (i < options->stdio_count) + if (options->stdio[i].flags & (UV_INHERIT_FD | UV_INHERIT_STREAM)) + continue; + if (pipes[i][0] != -1) + close(pipes[i][0]); + if (pipes[i][1] != -1) + close(pipes[i][1]); + } + uv__free(pipes); + } + + return err; +#endif +} + + +int uv_process_kill(uv_process_t* process, int signum) { + return uv_kill(process->pid, signum); +} + + +int uv_kill(int pid, int signum) { + if (kill(pid, signum)) + return -errno; + else + return 0; +} + + +void uv__process_close(uv_process_t* handle) { + QUEUE_REMOVE(&handle->queue); + uv__handle_stop(handle); + if (QUEUE_EMPTY(&handle->loop->process_handles)) + uv_signal_stop(&handle->loop->child_watcher); +} diff --git a/3rdparty/libuv/src/unix/proctitle.c b/3rdparty/libuv/src/unix/proctitle.c new file mode 100644 index 00000000000..19214e5ec97 --- /dev/null +++ b/3rdparty/libuv/src/unix/proctitle.c @@ -0,0 +1,102 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include + +extern void uv__set_process_title(const char* title); + +static void* args_mem; + +static struct { + char* str; + size_t len; +} process_title; + + +char** uv_setup_args(int argc, char** argv) { + char** new_argv; + size_t size; + char* s; + int i; + + if (argc <= 0) + return argv; + + /* Calculate how much memory we need for the argv strings. */ + size = 0; + for (i = 0; i < argc; i++) + size += strlen(argv[i]) + 1; + + process_title.str = argv[0]; + process_title.len = argv[argc - 1] + strlen(argv[argc - 1]) - argv[0]; + assert(process_title.len + 1 == size); /* argv memory should be adjacent. */ + + /* Add space for the argv pointers. */ + size += (argc + 1) * sizeof(char*); + + new_argv = uv__malloc(size); + if (new_argv == NULL) + return argv; + args_mem = new_argv; + + /* Copy over the strings and set up the pointer table. */ + s = (char*) &new_argv[argc + 1]; + for (i = 0; i < argc; i++) { + size = strlen(argv[i]) + 1; + memcpy(s, argv[i], size); + new_argv[i] = s; + s += size; + } + new_argv[i] = NULL; + + return new_argv; +} + + +int uv_set_process_title(const char* title) { + if (process_title.len == 0) + return 0; + + /* No need to terminate, byte after is always '\0'. */ + strncpy(process_title.str, title, process_title.len); + uv__set_process_title(title); + + return 0; +} + + +int uv_get_process_title(char* buffer, size_t size) { + if (process_title.len > 0) + strncpy(buffer, process_title.str, size); + else if (size > 0) + buffer[0] = '\0'; + + return 0; +} + + +UV_DESTRUCTOR(static void free_args_mem(void)) { + uv__free(args_mem); /* Keep valgrind happy. */ + args_mem = NULL; +} diff --git a/3rdparty/libuv/src/unix/pthread-fixes.c b/3rdparty/libuv/src/unix/pthread-fixes.c new file mode 100644 index 00000000000..3a71eb5aae7 --- /dev/null +++ b/3rdparty/libuv/src/unix/pthread-fixes.c @@ -0,0 +1,104 @@ +/* Copyright (c) 2013, Sony Mobile Communications AB + * Copyright (c) 2012, Google Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* Android versions < 4.1 have a broken pthread_sigmask. + * Note that this block of code must come before any inclusion of + * pthread-fixes.h so that the real pthread_sigmask can be referenced. + * */ +#include +#include +#include + +int uv__pthread_sigmask(int how, const sigset_t* set, sigset_t* oset) { + static int workaround; + + if (workaround) { + return sigprocmask(how, set, oset); + } else if (pthread_sigmask(how, set, oset)) { + if (errno == EINVAL && sigprocmask(how, set, oset) == 0) { + workaround = 1; + return 0; + } else { + return -1; + } + } else { + return 0; + } +} + +/*Android doesn't provide pthread_barrier_t for now.*/ +#ifndef PTHREAD_BARRIER_SERIAL_THREAD + +#include "pthread-fixes.h" + +int pthread_barrier_init(pthread_barrier_t* barrier, + const void* barrier_attr, + unsigned count) { + barrier->count = count; + pthread_mutex_init(&barrier->mutex, NULL); + pthread_cond_init(&barrier->cond, NULL); + return 0; +} + +int pthread_barrier_wait(pthread_barrier_t* barrier) { + /* Lock the mutex*/ + pthread_mutex_lock(&barrier->mutex); + /* Decrement the count. If this is the first thread to reach 0, wake up + waiters, unlock the mutex, then return PTHREAD_BARRIER_SERIAL_THREAD.*/ + if (--barrier->count == 0) { + /* First thread to reach the barrier */ + pthread_cond_broadcast(&barrier->cond); + pthread_mutex_unlock(&barrier->mutex); + return PTHREAD_BARRIER_SERIAL_THREAD; + } + /* Otherwise, wait for other threads until the count reaches 0, then + return 0 to indicate this is not the first thread.*/ + do { + pthread_cond_wait(&barrier->cond, &barrier->mutex); + } while (barrier->count > 0); + + pthread_mutex_unlock(&barrier->mutex); + return 0; +} + +int pthread_barrier_destroy(pthread_barrier_t *barrier) { + barrier->count = 0; + pthread_cond_destroy(&barrier->cond); + pthread_mutex_destroy(&barrier->mutex); + return 0; +} + +#endif /* defined(PTHREAD_BARRIER_SERIAL_THREAD) */ + +int pthread_yield(void) { + sched_yield(); + return 0; +} diff --git a/3rdparty/libuv/src/unix/signal.c b/3rdparty/libuv/src/unix/signal.c new file mode 100644 index 00000000000..edd9085d3f3 --- /dev/null +++ b/3rdparty/libuv/src/unix/signal.c @@ -0,0 +1,467 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + + +typedef struct { + uv_signal_t* handle; + int signum; +} uv__signal_msg_t; + +RB_HEAD(uv__signal_tree_s, uv_signal_s); + + +static int uv__signal_unlock(void); +static void uv__signal_event(uv_loop_t* loop, uv__io_t* w, unsigned int events); +static int uv__signal_compare(uv_signal_t* w1, uv_signal_t* w2); +static void uv__signal_stop(uv_signal_t* handle); + + +static pthread_once_t uv__signal_global_init_guard = PTHREAD_ONCE_INIT; +static struct uv__signal_tree_s uv__signal_tree = + RB_INITIALIZER(uv__signal_tree); +static int uv__signal_lock_pipefd[2]; + + +RB_GENERATE_STATIC(uv__signal_tree_s, + uv_signal_s, tree_entry, + uv__signal_compare) + + +static void uv__signal_global_init(void) { + if (uv__make_pipe(uv__signal_lock_pipefd, 0)) + abort(); + + if (uv__signal_unlock()) + abort(); +} + + +void uv__signal_global_once_init(void) { + pthread_once(&uv__signal_global_init_guard, uv__signal_global_init); +} + + + +static int uv__signal_lock(void) { + int r; + char data; + + do { + r = read(uv__signal_lock_pipefd[0], &data, sizeof data); + } while (r < 0 && errno == EINTR); + + return (r < 0) ? -1 : 0; +} + + +static int uv__signal_unlock(void) { + int r; + char data = 42; + + do { + r = write(uv__signal_lock_pipefd[1], &data, sizeof data); + } while (r < 0 && errno == EINTR); + + return (r < 0) ? -1 : 0; +} + + +static void uv__signal_block_and_lock(sigset_t* saved_sigmask) { + sigset_t new_mask; + + if (sigfillset(&new_mask)) + abort(); + + if (pthread_sigmask(SIG_SETMASK, &new_mask, saved_sigmask)) + abort(); + + if (uv__signal_lock()) + abort(); +} + + +static void uv__signal_unlock_and_unblock(sigset_t* saved_sigmask) { + if (uv__signal_unlock()) + abort(); + + if (pthread_sigmask(SIG_SETMASK, saved_sigmask, NULL)) + abort(); +} + + +static uv_signal_t* uv__signal_first_handle(int signum) { + /* This function must be called with the signal lock held. */ + uv_signal_t lookup; + uv_signal_t* handle; + + lookup.signum = signum; + lookup.loop = NULL; + + handle = RB_NFIND(uv__signal_tree_s, &uv__signal_tree, &lookup); + + if (handle != NULL && handle->signum == signum) + return handle; + + return NULL; +} + + +static void uv__signal_handler(int signum) { + uv__signal_msg_t msg; + uv_signal_t* handle; + int saved_errno; + + saved_errno = errno; + memset(&msg, 0, sizeof msg); + + if (uv__signal_lock()) { + errno = saved_errno; + return; + } + + for (handle = uv__signal_first_handle(signum); + handle != NULL && handle->signum == signum; + handle = RB_NEXT(uv__signal_tree_s, &uv__signal_tree, handle)) { + int r; + + msg.signum = signum; + msg.handle = handle; + + /* write() should be atomic for small data chunks, so the entire message + * should be written at once. In theory the pipe could become full, in + * which case the user is out of luck. + */ + do { + r = write(handle->loop->signal_pipefd[1], &msg, sizeof msg); + } while (r == -1 && errno == EINTR); + + assert(r == sizeof msg || + (r == -1 && (errno == EAGAIN || errno == EWOULDBLOCK))); + + if (r != -1) + handle->caught_signals++; + } + + uv__signal_unlock(); + errno = saved_errno; +} + + +static int uv__signal_register_handler(int signum) { + /* When this function is called, the signal lock must be held. */ + struct sigaction sa; + + /* XXX use a separate signal stack? */ + memset(&sa, 0, sizeof(sa)); + if (sigfillset(&sa.sa_mask)) + abort(); + sa.sa_handler = uv__signal_handler; + + /* XXX save old action so we can restore it later on? */ + if (sigaction(signum, &sa, NULL)) + return -errno; + + return 0; +} + + +static void uv__signal_unregister_handler(int signum) { + /* When this function is called, the signal lock must be held. */ + struct sigaction sa; + + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = SIG_DFL; + + /* sigaction can only fail with EINVAL or EFAULT; an attempt to deregister a + * signal implies that it was successfully registered earlier, so EINVAL + * should never happen. + */ + if (sigaction(signum, &sa, NULL)) + abort(); +} + + +static int uv__signal_loop_once_init(uv_loop_t* loop) { + int err; + + /* Return if already initialized. */ + if (loop->signal_pipefd[0] != -1) + return 0; + + err = uv__make_pipe(loop->signal_pipefd, UV__F_NONBLOCK); + if (err) + return err; + + uv__io_init(&loop->signal_io_watcher, + uv__signal_event, + loop->signal_pipefd[0]); + uv__io_start(loop, &loop->signal_io_watcher, UV__POLLIN); + + return 0; +} + + +void uv__signal_loop_cleanup(uv_loop_t* loop) { + QUEUE* q; + + /* Stop all the signal watchers that are still attached to this loop. This + * ensures that the (shared) signal tree doesn't contain any invalid entries + * entries, and that signal handlers are removed when appropriate. + * It's safe to use QUEUE_FOREACH here because the handles and the handle + * queue are not modified by uv__signal_stop(). + */ + QUEUE_FOREACH(q, &loop->handle_queue) { + uv_handle_t* handle = QUEUE_DATA(q, uv_handle_t, handle_queue); + + if (handle->type == UV_SIGNAL) + uv__signal_stop((uv_signal_t*) handle); + } + + if (loop->signal_pipefd[0] != -1) { + uv__close(loop->signal_pipefd[0]); + loop->signal_pipefd[0] = -1; + } + + if (loop->signal_pipefd[1] != -1) { + uv__close(loop->signal_pipefd[1]); + loop->signal_pipefd[1] = -1; + } +} + + +int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle) { + int err; + + err = uv__signal_loop_once_init(loop); + if (err) + return err; + + uv__handle_init(loop, (uv_handle_t*) handle, UV_SIGNAL); + handle->signum = 0; + handle->caught_signals = 0; + handle->dispatched_signals = 0; + + return 0; +} + + +void uv__signal_close(uv_signal_t* handle) { + + uv__signal_stop(handle); + + /* If there are any caught signals "trapped" in the signal pipe, we can't + * call the close callback yet. Otherwise, add the handle to the finish_close + * queue. + */ + if (handle->caught_signals == handle->dispatched_signals) { + uv__make_close_pending((uv_handle_t*) handle); + } +} + + +int uv_signal_start(uv_signal_t* handle, uv_signal_cb signal_cb, int signum) { + sigset_t saved_sigmask; + int err; + + assert(!(handle->flags & (UV_CLOSING | UV_CLOSED))); + + /* If the user supplies signum == 0, then return an error already. If the + * signum is otherwise invalid then uv__signal_register will find out + * eventually. + */ + if (signum == 0) + return -EINVAL; + + /* Short circuit: if the signal watcher is already watching {signum} don't + * go through the process of deregistering and registering the handler. + * Additionally, this avoids pending signals getting lost in the small time + * time frame that handle->signum == 0. + */ + if (signum == handle->signum) { + handle->signal_cb = signal_cb; + return 0; + } + + /* If the signal handler was already active, stop it first. */ + if (handle->signum != 0) { + uv__signal_stop(handle); + } + + uv__signal_block_and_lock(&saved_sigmask); + + /* If at this point there are no active signal watchers for this signum (in + * any of the loops), it's time to try and register a handler for it here. + */ + if (uv__signal_first_handle(signum) == NULL) { + err = uv__signal_register_handler(signum); + if (err) { + /* Registering the signal handler failed. Must be an invalid signal. */ + uv__signal_unlock_and_unblock(&saved_sigmask); + return err; + } + } + + handle->signum = signum; + RB_INSERT(uv__signal_tree_s, &uv__signal_tree, handle); + + uv__signal_unlock_and_unblock(&saved_sigmask); + + handle->signal_cb = signal_cb; + uv__handle_start(handle); + + return 0; +} + + +static void uv__signal_event(uv_loop_t* loop, + uv__io_t* w, + unsigned int events) { + uv__signal_msg_t* msg; + uv_signal_t* handle; + char buf[sizeof(uv__signal_msg_t) * 32]; + size_t bytes, end, i; + int r; + + bytes = 0; + end = 0; + + do { + r = read(loop->signal_pipefd[0], buf + bytes, sizeof(buf) - bytes); + + if (r == -1 && errno == EINTR) + continue; + + if (r == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) { + /* If there are bytes in the buffer already (which really is extremely + * unlikely if possible at all) we can't exit the function here. We'll + * spin until more bytes are read instead. + */ + if (bytes > 0) + continue; + + /* Otherwise, there was nothing there. */ + return; + } + + /* Other errors really should never happen. */ + if (r == -1) + abort(); + + bytes += r; + + /* `end` is rounded down to a multiple of sizeof(uv__signal_msg_t). */ + end = (bytes / sizeof(uv__signal_msg_t)) * sizeof(uv__signal_msg_t); + + for (i = 0; i < end; i += sizeof(uv__signal_msg_t)) { + msg = (uv__signal_msg_t*) (buf + i); + handle = msg->handle; + + if (msg->signum == handle->signum) { + assert(!(handle->flags & UV_CLOSING)); + handle->signal_cb(handle, handle->signum); + } + + handle->dispatched_signals++; + + /* If uv_close was called while there were caught signals that were not + * yet dispatched, the uv__finish_close was deferred. Make close pending + * now if this has happened. + */ + if ((handle->flags & UV_CLOSING) && + (handle->caught_signals == handle->dispatched_signals)) { + uv__make_close_pending((uv_handle_t*) handle); + } + } + + bytes -= end; + + /* If there are any "partial" messages left, move them to the start of the + * the buffer, and spin. This should not happen. + */ + if (bytes) { + memmove(buf, buf + end, bytes); + continue; + } + } while (end == sizeof buf); +} + + +static int uv__signal_compare(uv_signal_t* w1, uv_signal_t* w2) { + /* Compare signums first so all watchers with the same signnum end up + * adjacent. + */ + if (w1->signum < w2->signum) return -1; + if (w1->signum > w2->signum) return 1; + + /* Sort by loop pointer, so we can easily look up the first item after + * { .signum = x, .loop = NULL }. + */ + if (w1->loop < w2->loop) return -1; + if (w1->loop > w2->loop) return 1; + + if (w1 < w2) return -1; + if (w1 > w2) return 1; + + return 0; +} + + +int uv_signal_stop(uv_signal_t* handle) { + assert(!(handle->flags & (UV_CLOSING | UV_CLOSED))); + uv__signal_stop(handle); + return 0; +} + + +static void uv__signal_stop(uv_signal_t* handle) { + uv_signal_t* removed_handle; + sigset_t saved_sigmask; + + /* If the watcher wasn't started, this is a no-op. */ + if (handle->signum == 0) + return; + + uv__signal_block_and_lock(&saved_sigmask); + + removed_handle = RB_REMOVE(uv__signal_tree_s, &uv__signal_tree, handle); + assert(removed_handle == handle); + (void) removed_handle; + + /* Check if there are other active signal watchers observing this signal. If + * not, unregister the signal handler. + */ + if (uv__signal_first_handle(handle->signum) == NULL) + uv__signal_unregister_handler(handle->signum); + + uv__signal_unlock_and_unblock(&saved_sigmask); + + handle->signum = 0; + uv__handle_stop(handle); +} diff --git a/3rdparty/libuv/src/unix/spinlock.h b/3rdparty/libuv/src/unix/spinlock.h new file mode 100644 index 00000000000..a20c83cc601 --- /dev/null +++ b/3rdparty/libuv/src/unix/spinlock.h @@ -0,0 +1,53 @@ +/* Copyright (c) 2013, Ben Noordhuis + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef UV_SPINLOCK_H_ +#define UV_SPINLOCK_H_ + +#include "internal.h" /* ACCESS_ONCE, UV_UNUSED */ +#include "atomic-ops.h" + +#define UV_SPINLOCK_INITIALIZER { 0 } + +typedef struct { + int lock; +} uv_spinlock_t; + +UV_UNUSED(static void uv_spinlock_init(uv_spinlock_t* spinlock)); +UV_UNUSED(static void uv_spinlock_lock(uv_spinlock_t* spinlock)); +UV_UNUSED(static void uv_spinlock_unlock(uv_spinlock_t* spinlock)); +UV_UNUSED(static int uv_spinlock_trylock(uv_spinlock_t* spinlock)); + +UV_UNUSED(static void uv_spinlock_init(uv_spinlock_t* spinlock)) { + ACCESS_ONCE(int, spinlock->lock) = 0; +} + +UV_UNUSED(static void uv_spinlock_lock(uv_spinlock_t* spinlock)) { + while (!uv_spinlock_trylock(spinlock)) cpu_relax(); +} + +UV_UNUSED(static void uv_spinlock_unlock(uv_spinlock_t* spinlock)) { + ACCESS_ONCE(int, spinlock->lock) = 0; +} + +UV_UNUSED(static int uv_spinlock_trylock(uv_spinlock_t* spinlock)) { + /* TODO(bnoordhuis) Maybe change to a ticket lock to guarantee fair queueing. + * Not really critical until we have locks that are (frequently) contended + * for by several threads. + */ + return 0 == cmpxchgi(&spinlock->lock, 0, 1); +} + +#endif /* UV_SPINLOCK_H_ */ diff --git a/3rdparty/libuv/src/unix/stream.c b/3rdparty/libuv/src/unix/stream.c new file mode 100644 index 00000000000..7d7ab2633b6 --- /dev/null +++ b/3rdparty/libuv/src/unix/stream.c @@ -0,0 +1,1615 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include /* IOV_MAX */ + +#if defined(__APPLE__) +# include +# include +# include + +/* Forward declaration */ +typedef struct uv__stream_select_s uv__stream_select_t; + +struct uv__stream_select_s { + uv_stream_t* stream; + uv_thread_t thread; + uv_sem_t close_sem; + uv_sem_t async_sem; + uv_async_t async; + int events; + int fake_fd; + int int_fd; + int fd; + fd_set* sread; + size_t sread_sz; + fd_set* swrite; + size_t swrite_sz; +}; +#endif /* defined(__APPLE__) */ + +static void uv__stream_connect(uv_stream_t*); +static void uv__write(uv_stream_t* stream); +static void uv__read(uv_stream_t* stream); +static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events); +static void uv__write_callbacks(uv_stream_t* stream); +static size_t uv__write_req_size(uv_write_t* req); + + +void uv__stream_init(uv_loop_t* loop, + uv_stream_t* stream, + uv_handle_type type) { + int err; + + uv__handle_init(loop, (uv_handle_t*)stream, type); + stream->read_cb = NULL; + stream->alloc_cb = NULL; + stream->close_cb = NULL; + stream->connection_cb = NULL; + stream->connect_req = NULL; + stream->shutdown_req = NULL; + stream->accepted_fd = -1; + stream->queued_fds = NULL; + stream->delayed_error = 0; + QUEUE_INIT(&stream->write_queue); + QUEUE_INIT(&stream->write_completed_queue); + stream->write_queue_size = 0; + + if (loop->emfile_fd == -1) { + err = uv__open_cloexec("/dev/null", O_RDONLY); + if (err < 0) + /* In the rare case that "/dev/null" isn't mounted open "/" + * instead. + */ + err = uv__open_cloexec("/", O_RDONLY); + if (err >= 0) + loop->emfile_fd = err; + } + +#if defined(__APPLE__) + stream->select = NULL; +#endif /* defined(__APPLE_) */ + + uv__io_init(&stream->io_watcher, uv__stream_io, -1); +} + + +static void uv__stream_osx_interrupt_select(uv_stream_t* stream) { +#if defined(__APPLE__) + /* Notify select() thread about state change */ + uv__stream_select_t* s; + int r; + + s = stream->select; + if (s == NULL) + return; + + /* Interrupt select() loop + * NOTE: fake_fd and int_fd are socketpair(), thus writing to one will + * emit read event on other side + */ + do + r = write(s->fake_fd, "x", 1); + while (r == -1 && errno == EINTR); + + assert(r == 1); +#else /* !defined(__APPLE__) */ + /* No-op on any other platform */ +#endif /* !defined(__APPLE__) */ +} + + +#if defined(__APPLE__) +static void uv__stream_osx_select(void* arg) { + uv_stream_t* stream; + uv__stream_select_t* s; + char buf[1024]; + int events; + int fd; + int r; + int max_fd; + + stream = arg; + s = stream->select; + fd = s->fd; + + if (fd > s->int_fd) + max_fd = fd; + else + max_fd = s->int_fd; + + while (1) { + /* Terminate on semaphore */ + if (uv_sem_trywait(&s->close_sem) == 0) + break; + + /* Watch fd using select(2) */ + memset(s->sread, 0, s->sread_sz); + memset(s->swrite, 0, s->swrite_sz); + + if (uv__io_active(&stream->io_watcher, UV__POLLIN)) + FD_SET(fd, s->sread); + if (uv__io_active(&stream->io_watcher, UV__POLLOUT)) + FD_SET(fd, s->swrite); + FD_SET(s->int_fd, s->sread); + + /* Wait indefinitely for fd events */ + r = select(max_fd + 1, s->sread, s->swrite, NULL, NULL); + if (r == -1) { + if (errno == EINTR) + continue; + + /* XXX: Possible?! */ + abort(); + } + + /* Ignore timeouts */ + if (r == 0) + continue; + + /* Empty socketpair's buffer in case of interruption */ + if (FD_ISSET(s->int_fd, s->sread)) + while (1) { + r = read(s->int_fd, buf, sizeof(buf)); + + if (r == sizeof(buf)) + continue; + + if (r != -1) + break; + + if (errno == EAGAIN || errno == EWOULDBLOCK) + break; + + if (errno == EINTR) + continue; + + abort(); + } + + /* Handle events */ + events = 0; + if (FD_ISSET(fd, s->sread)) + events |= UV__POLLIN; + if (FD_ISSET(fd, s->swrite)) + events |= UV__POLLOUT; + + assert(events != 0 || FD_ISSET(s->int_fd, s->sread)); + if (events != 0) { + ACCESS_ONCE(int, s->events) = events; + + uv_async_send(&s->async); + uv_sem_wait(&s->async_sem); + + /* Should be processed at this stage */ + assert((s->events == 0) || (stream->flags & UV_CLOSING)); + } + } +} + + +static void uv__stream_osx_select_cb(uv_async_t* handle) { + uv__stream_select_t* s; + uv_stream_t* stream; + int events; + + s = container_of(handle, uv__stream_select_t, async); + stream = s->stream; + + /* Get and reset stream's events */ + events = s->events; + ACCESS_ONCE(int, s->events) = 0; + + assert(events != 0); + assert(events == (events & (UV__POLLIN | UV__POLLOUT))); + + /* Invoke callback on event-loop */ + if ((events & UV__POLLIN) && uv__io_active(&stream->io_watcher, UV__POLLIN)) + uv__stream_io(stream->loop, &stream->io_watcher, UV__POLLIN); + + if ((events & UV__POLLOUT) && uv__io_active(&stream->io_watcher, UV__POLLOUT)) + uv__stream_io(stream->loop, &stream->io_watcher, UV__POLLOUT); + + if (stream->flags & UV_CLOSING) + return; + + /* NOTE: It is important to do it here, otherwise `select()` might be called + * before the actual `uv__read()`, leading to the blocking syscall + */ + uv_sem_post(&s->async_sem); +} + + +static void uv__stream_osx_cb_close(uv_handle_t* async) { + uv__stream_select_t* s; + + s = container_of(async, uv__stream_select_t, async); + uv__free(s); +} + + +int uv__stream_try_select(uv_stream_t* stream, int* fd) { + /* + * kqueue doesn't work with some files from /dev mount on osx. + * select(2) in separate thread for those fds + */ + + struct kevent filter[1]; + struct kevent events[1]; + struct timespec timeout; + uv__stream_select_t* s; + int fds[2]; + int err; + int ret; + int kq; + int old_fd; + int max_fd; + size_t sread_sz; + size_t swrite_sz; + + kq = kqueue(); + if (kq == -1) { + perror("(libuv) kqueue()"); + return -errno; + } + + EV_SET(&filter[0], *fd, EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, 0); + + /* Use small timeout, because we only want to capture EINVALs */ + timeout.tv_sec = 0; + timeout.tv_nsec = 1; + + ret = kevent(kq, filter, 1, events, 1, &timeout); + uv__close(kq); + + if (ret == -1) + return -errno; + + if (ret == 0 || (events[0].flags & EV_ERROR) == 0 || events[0].data != EINVAL) + return 0; + + /* At this point we definitely know that this fd won't work with kqueue */ + + /* + * Create fds for io watcher and to interrupt the select() loop. + * NOTE: do it ahead of malloc below to allocate enough space for fd_sets + */ + if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds)) + return -errno; + + max_fd = *fd; + if (fds[1] > max_fd) + max_fd = fds[1]; + + sread_sz = ROUND_UP(max_fd + 1, sizeof(uint32_t) * NBBY) / NBBY; + swrite_sz = sread_sz; + + s = uv__malloc(sizeof(*s) + sread_sz + swrite_sz); + if (s == NULL) { + err = -ENOMEM; + goto failed_malloc; + } + + s->events = 0; + s->fd = *fd; + s->sread = (fd_set*) ((char*) s + sizeof(*s)); + s->sread_sz = sread_sz; + s->swrite = (fd_set*) ((char*) s->sread + sread_sz); + s->swrite_sz = swrite_sz; + + err = uv_async_init(stream->loop, &s->async, uv__stream_osx_select_cb); + if (err) + goto failed_async_init; + + s->async.flags |= UV__HANDLE_INTERNAL; + uv__handle_unref(&s->async); + + err = uv_sem_init(&s->close_sem, 0); + if (err != 0) + goto failed_close_sem_init; + + err = uv_sem_init(&s->async_sem, 0); + if (err != 0) + goto failed_async_sem_init; + + s->fake_fd = fds[0]; + s->int_fd = fds[1]; + + old_fd = *fd; + s->stream = stream; + stream->select = s; + *fd = s->fake_fd; + + err = uv_thread_create(&s->thread, uv__stream_osx_select, stream); + if (err != 0) + goto failed_thread_create; + + return 0; + +failed_thread_create: + s->stream = NULL; + stream->select = NULL; + *fd = old_fd; + + uv_sem_destroy(&s->async_sem); + +failed_async_sem_init: + uv_sem_destroy(&s->close_sem); + +failed_close_sem_init: + uv__close(fds[0]); + uv__close(fds[1]); + uv_close((uv_handle_t*) &s->async, uv__stream_osx_cb_close); + return err; + +failed_async_init: + uv__free(s); + +failed_malloc: + uv__close(fds[0]); + uv__close(fds[1]); + + return err; +} +#endif /* defined(__APPLE__) */ + + +int uv__stream_open(uv_stream_t* stream, int fd, int flags) { +#if defined(__APPLE__) + int enable; +#endif + + if (!(stream->io_watcher.fd == -1 || stream->io_watcher.fd == fd)) + return -EBUSY; + + assert(fd >= 0); + stream->flags |= flags; + + if (stream->type == UV_TCP) { + if ((stream->flags & UV_TCP_NODELAY) && uv__tcp_nodelay(fd, 1)) + return -errno; + + /* TODO Use delay the user passed in. */ + if ((stream->flags & UV_TCP_KEEPALIVE) && uv__tcp_keepalive(fd, 1, 60)) + return -errno; + } + +#if defined(__APPLE__) + enable = 1; + if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &enable, sizeof(enable)) && + errno != ENOTSOCK && + errno != EINVAL) { + return -errno; + } +#endif + + stream->io_watcher.fd = fd; + + return 0; +} + + +void uv__stream_flush_write_queue(uv_stream_t* stream, int error) { + uv_write_t* req; + QUEUE* q; + while (!QUEUE_EMPTY(&stream->write_queue)) { + q = QUEUE_HEAD(&stream->write_queue); + QUEUE_REMOVE(q); + + req = QUEUE_DATA(q, uv_write_t, queue); + req->error = error; + + QUEUE_INSERT_TAIL(&stream->write_completed_queue, &req->queue); + } +} + + +void uv__stream_destroy(uv_stream_t* stream) { + assert(!uv__io_active(&stream->io_watcher, UV__POLLIN | UV__POLLOUT)); + assert(stream->flags & UV_CLOSED); + + if (stream->connect_req) { + uv__req_unregister(stream->loop, stream->connect_req); + stream->connect_req->cb(stream->connect_req, -ECANCELED); + stream->connect_req = NULL; + } + + uv__stream_flush_write_queue(stream, -ECANCELED); + uv__write_callbacks(stream); + + if (stream->shutdown_req) { + /* The ECANCELED error code is a lie, the shutdown(2) syscall is a + * fait accompli at this point. Maybe we should revisit this in v0.11. + * A possible reason for leaving it unchanged is that it informs the + * callee that the handle has been destroyed. + */ + uv__req_unregister(stream->loop, stream->shutdown_req); + stream->shutdown_req->cb(stream->shutdown_req, -ECANCELED); + stream->shutdown_req = NULL; + } + + assert(stream->write_queue_size == 0); +} + + +/* Implements a best effort approach to mitigating accept() EMFILE errors. + * We have a spare file descriptor stashed away that we close to get below + * the EMFILE limit. Next, we accept all pending connections and close them + * immediately to signal the clients that we're overloaded - and we are, but + * we still keep on trucking. + * + * There is one caveat: it's not reliable in a multi-threaded environment. + * The file descriptor limit is per process. Our party trick fails if another + * thread opens a file or creates a socket in the time window between us + * calling close() and accept(). + */ +static int uv__emfile_trick(uv_loop_t* loop, int accept_fd) { + int err; + int emfile_fd; + + if (loop->emfile_fd == -1) + return -EMFILE; + + uv__close(loop->emfile_fd); + loop->emfile_fd = -1; + + do { + err = uv__accept(accept_fd); + if (err >= 0) + uv__close(err); + } while (err >= 0 || err == -EINTR); + + emfile_fd = uv__open_cloexec("/", O_RDONLY); + if (emfile_fd >= 0) + loop->emfile_fd = emfile_fd; + + return err; +} + + +#if defined(UV_HAVE_KQUEUE) +# define UV_DEC_BACKLOG(w) w->rcount--; +#else +# define UV_DEC_BACKLOG(w) /* no-op */ +#endif /* defined(UV_HAVE_KQUEUE) */ + + +void uv__server_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { + uv_stream_t* stream; + int err; + + stream = container_of(w, uv_stream_t, io_watcher); + assert(events == UV__POLLIN); + assert(stream->accepted_fd == -1); + assert(!(stream->flags & UV_CLOSING)); + + uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN); + + /* connection_cb can close the server socket while we're + * in the loop so check it on each iteration. + */ + while (uv__stream_fd(stream) != -1) { + assert(stream->accepted_fd == -1); + +#if defined(UV_HAVE_KQUEUE) + if (w->rcount <= 0) + return; +#endif /* defined(UV_HAVE_KQUEUE) */ + + err = uv__accept(uv__stream_fd(stream)); + if (err < 0) { + if (err == -EAGAIN || err == -EWOULDBLOCK) + return; /* Not an error. */ + + if (err == -ECONNABORTED) + continue; /* Ignore. Nothing we can do about that. */ + + if (err == -EMFILE || err == -ENFILE) { + err = uv__emfile_trick(loop, uv__stream_fd(stream)); + if (err == -EAGAIN || err == -EWOULDBLOCK) + break; + } + + stream->connection_cb(stream, err); + continue; + } + + UV_DEC_BACKLOG(w) + stream->accepted_fd = err; + stream->connection_cb(stream, 0); + + if (stream->accepted_fd != -1) { + /* The user hasn't yet accepted called uv_accept() */ + uv__io_stop(loop, &stream->io_watcher, UV__POLLIN); + return; + } + + if (stream->type == UV_TCP && (stream->flags & UV_TCP_SINGLE_ACCEPT)) { + /* Give other processes a chance to accept connections. */ + struct timespec timeout = { 0, 1 }; + nanosleep(&timeout, NULL); + } + } +} + + +#undef UV_DEC_BACKLOG + + +int uv_accept(uv_stream_t* server, uv_stream_t* client) { + int err; + + /* TODO document this */ + assert(server->loop == client->loop); + + if (server->accepted_fd == -1) + return -EAGAIN; + + switch (client->type) { + case UV_NAMED_PIPE: + case UV_TCP: + err = uv__stream_open(client, + server->accepted_fd, + UV_STREAM_READABLE | UV_STREAM_WRITABLE); + if (err) { + /* TODO handle error */ + uv__close(server->accepted_fd); + goto done; + } + break; + + case UV_UDP: + err = uv_udp_open((uv_udp_t*) client, server->accepted_fd); + if (err) { + uv__close(server->accepted_fd); + goto done; + } + break; + + default: + return -EINVAL; + } + +done: + /* Process queued fds */ + if (server->queued_fds != NULL) { + uv__stream_queued_fds_t* queued_fds; + + queued_fds = server->queued_fds; + + /* Read first */ + server->accepted_fd = queued_fds->fds[0]; + + /* All read, free */ + assert(queued_fds->offset > 0); + if (--queued_fds->offset == 0) { + uv__free(queued_fds); + server->queued_fds = NULL; + } else { + /* Shift rest */ + memmove(queued_fds->fds, + queued_fds->fds + 1, + queued_fds->offset * sizeof(*queued_fds->fds)); + } + } else { + server->accepted_fd = -1; + if (err == 0) + uv__io_start(server->loop, &server->io_watcher, UV__POLLIN); + } + return err; +} + + +int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb) { + int err; + + switch (stream->type) { + case UV_TCP: + err = uv_tcp_listen((uv_tcp_t*)stream, backlog, cb); + break; + + case UV_NAMED_PIPE: + err = uv_pipe_listen((uv_pipe_t*)stream, backlog, cb); + break; + + default: + err = -EINVAL; + } + + if (err == 0) + uv__handle_start(stream); + + return err; +} + + +static void uv__drain(uv_stream_t* stream) { + uv_shutdown_t* req; + int err; + + assert(QUEUE_EMPTY(&stream->write_queue)); + uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT); + uv__stream_osx_interrupt_select(stream); + + /* Shutdown? */ + if ((stream->flags & UV_STREAM_SHUTTING) && + !(stream->flags & UV_CLOSING) && + !(stream->flags & UV_STREAM_SHUT)) { + assert(stream->shutdown_req); + + req = stream->shutdown_req; + stream->shutdown_req = NULL; + stream->flags &= ~UV_STREAM_SHUTTING; + uv__req_unregister(stream->loop, req); + + err = 0; + if (shutdown(uv__stream_fd(stream), SHUT_WR)) + err = -errno; + + if (err == 0) + stream->flags |= UV_STREAM_SHUT; + + if (req->cb != NULL) + req->cb(req, err); + } +} + + +static size_t uv__write_req_size(uv_write_t* req) { + size_t size; + + assert(req->bufs != NULL); + size = uv__count_bufs(req->bufs + req->write_index, + req->nbufs - req->write_index); + assert(req->handle->write_queue_size >= size); + + return size; +} + + +static void uv__write_req_finish(uv_write_t* req) { + uv_stream_t* stream = req->handle; + + /* Pop the req off tcp->write_queue. */ + QUEUE_REMOVE(&req->queue); + + /* Only free when there was no error. On error, we touch up write_queue_size + * right before making the callback. The reason we don't do that right away + * is that a write_queue_size > 0 is our only way to signal to the user that + * they should stop writing - which they should if we got an error. Something + * to revisit in future revisions of the libuv API. + */ + if (req->error == 0) { + if (req->bufs != req->bufsml) + uv__free(req->bufs); + req->bufs = NULL; + } + + /* Add it to the write_completed_queue where it will have its + * callback called in the near future. + */ + QUEUE_INSERT_TAIL(&stream->write_completed_queue, &req->queue); + uv__io_feed(stream->loop, &stream->io_watcher); +} + + +static int uv__handle_fd(uv_handle_t* handle) { + switch (handle->type) { + case UV_NAMED_PIPE: + case UV_TCP: + return ((uv_stream_t*) handle)->io_watcher.fd; + + case UV_UDP: + return ((uv_udp_t*) handle)->io_watcher.fd; + + default: + return -1; + } +} + +static void uv__write(uv_stream_t* stream) { + struct iovec* iov; + QUEUE* q; + uv_write_t* req; + int iovmax; + int iovcnt; + ssize_t n; + +start: + + assert(uv__stream_fd(stream) >= 0); + + if (QUEUE_EMPTY(&stream->write_queue)) + return; + + q = QUEUE_HEAD(&stream->write_queue); + req = QUEUE_DATA(q, uv_write_t, queue); + assert(req->handle == stream); + + /* + * Cast to iovec. We had to have our own uv_buf_t instead of iovec + * because Windows's WSABUF is not an iovec. + */ + assert(sizeof(uv_buf_t) == sizeof(struct iovec)); + iov = (struct iovec*) &(req->bufs[req->write_index]); + iovcnt = req->nbufs - req->write_index; + + iovmax = uv__getiovmax(); + + /* Limit iov count to avoid EINVALs from writev() */ + if (iovcnt > iovmax) + iovcnt = iovmax; + + /* + * Now do the actual writev. Note that we've been updating the pointers + * inside the iov each time we write. So there is no need to offset it. + */ + + if (req->send_handle) { + struct msghdr msg; + struct cmsghdr *cmsg; + int fd_to_send = uv__handle_fd((uv_handle_t*) req->send_handle); + char scratch[64] = {0}; + + assert(fd_to_send >= 0); + + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_iov = iov; + msg.msg_iovlen = iovcnt; + msg.msg_flags = 0; + + msg.msg_control = (void*) scratch; + msg.msg_controllen = CMSG_SPACE(sizeof(fd_to_send)); + + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(fd_to_send)); + + /* silence aliasing warning */ + { + void* pv = CMSG_DATA(cmsg); + int* pi = pv; + *pi = fd_to_send; + } + + do { + n = sendmsg(uv__stream_fd(stream), &msg, 0); + } +#if defined(__APPLE__) + /* + * Due to a possible kernel bug at least in OS X 10.10 "Yosemite", + * EPROTOTYPE can be returned while trying to write to a socket that is + * shutting down. If we retry the write, we should get the expected EPIPE + * instead. + */ + while (n == -1 && (errno == EINTR || errno == EPROTOTYPE)); +#else + while (n == -1 && errno == EINTR); +#endif + } else { + do { + if (iovcnt == 1) { + n = write(uv__stream_fd(stream), iov[0].iov_base, iov[0].iov_len); + } else { + n = writev(uv__stream_fd(stream), iov, iovcnt); + } + } +#if defined(__APPLE__) + /* + * Due to a possible kernel bug at least in OS X 10.10 "Yosemite", + * EPROTOTYPE can be returned while trying to write to a socket that is + * shutting down. If we retry the write, we should get the expected EPIPE + * instead. + */ + while (n == -1 && (errno == EINTR || errno == EPROTOTYPE)); +#else + while (n == -1 && errno == EINTR); +#endif + } + + if (n < 0) { + if (errno != EAGAIN && errno != EWOULDBLOCK) { + /* Error */ + req->error = -errno; + uv__write_req_finish(req); + uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT); + if (!uv__io_active(&stream->io_watcher, UV__POLLIN)) + uv__handle_stop(stream); + uv__stream_osx_interrupt_select(stream); + return; + } else if (stream->flags & UV_STREAM_BLOCKING) { + /* If this is a blocking stream, try again. */ + goto start; + } + } else { + /* Successful write */ + + while (n >= 0) { + uv_buf_t* buf = &(req->bufs[req->write_index]); + size_t len = buf->len; + + assert(req->write_index < req->nbufs); + + if ((size_t)n < len) { + buf->base += n; + buf->len -= n; + stream->write_queue_size -= n; + n = 0; + + /* There is more to write. */ + if (stream->flags & UV_STREAM_BLOCKING) { + /* + * If we're blocking then we should not be enabling the write + * watcher - instead we need to try again. + */ + goto start; + } else { + /* Break loop and ensure the watcher is pending. */ + break; + } + + } else { + /* Finished writing the buf at index req->write_index. */ + req->write_index++; + + assert((size_t)n >= len); + n -= len; + + assert(stream->write_queue_size >= len); + stream->write_queue_size -= len; + + if (req->write_index == req->nbufs) { + /* Then we're done! */ + assert(n == 0); + uv__write_req_finish(req); + /* TODO: start trying to write the next request. */ + return; + } + } + } + } + + /* Either we've counted n down to zero or we've got EAGAIN. */ + assert(n == 0 || n == -1); + + /* Only non-blocking streams should use the write_watcher. */ + assert(!(stream->flags & UV_STREAM_BLOCKING)); + + /* We're not done. */ + uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT); + + /* Notify select() thread about state change */ + uv__stream_osx_interrupt_select(stream); +} + + +static void uv__write_callbacks(uv_stream_t* stream) { + uv_write_t* req; + QUEUE* q; + + while (!QUEUE_EMPTY(&stream->write_completed_queue)) { + /* Pop a req off write_completed_queue. */ + q = QUEUE_HEAD(&stream->write_completed_queue); + req = QUEUE_DATA(q, uv_write_t, queue); + QUEUE_REMOVE(q); + uv__req_unregister(stream->loop, req); + + if (req->bufs != NULL) { + stream->write_queue_size -= uv__write_req_size(req); + if (req->bufs != req->bufsml) + uv__free(req->bufs); + req->bufs = NULL; + } + + /* NOTE: call callback AFTER freeing the request data. */ + if (req->cb) + req->cb(req, req->error); + } + + assert(QUEUE_EMPTY(&stream->write_completed_queue)); +} + + +uv_handle_type uv__handle_type(int fd) { + struct sockaddr_storage ss; + socklen_t len; + int type; + + memset(&ss, 0, sizeof(ss)); + len = sizeof(ss); + + if (getsockname(fd, (struct sockaddr*)&ss, &len)) + return UV_UNKNOWN_HANDLE; + + len = sizeof type; + + if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &len)) + return UV_UNKNOWN_HANDLE; + + if (type == SOCK_STREAM) { + switch (ss.ss_family) { + case AF_UNIX: + return UV_NAMED_PIPE; + case AF_INET: + case AF_INET6: + return UV_TCP; + } + } + + if (type == SOCK_DGRAM && + (ss.ss_family == AF_INET || ss.ss_family == AF_INET6)) + return UV_UDP; + + return UV_UNKNOWN_HANDLE; +} + + +static void uv__stream_eof(uv_stream_t* stream, const uv_buf_t* buf) { + stream->flags |= UV_STREAM_READ_EOF; + uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN); + if (!uv__io_active(&stream->io_watcher, UV__POLLOUT)) + uv__handle_stop(stream); + uv__stream_osx_interrupt_select(stream); + stream->read_cb(stream, UV_EOF, buf); + stream->flags &= ~UV_STREAM_READING; +} + + +static int uv__stream_queue_fd(uv_stream_t* stream, int fd) { + uv__stream_queued_fds_t* queued_fds; + unsigned int queue_size; + + queued_fds = stream->queued_fds; + if (queued_fds == NULL) { + queue_size = 8; + queued_fds = uv__malloc((queue_size - 1) * sizeof(*queued_fds->fds) + + sizeof(*queued_fds)); + if (queued_fds == NULL) + return -ENOMEM; + queued_fds->size = queue_size; + queued_fds->offset = 0; + stream->queued_fds = queued_fds; + + /* Grow */ + } else if (queued_fds->size == queued_fds->offset) { + queue_size = queued_fds->size + 8; + queued_fds = uv__realloc(queued_fds, + (queue_size - 1) * sizeof(*queued_fds->fds) + + sizeof(*queued_fds)); + + /* + * Allocation failure, report back. + * NOTE: if it is fatal - sockets will be closed in uv__stream_close + */ + if (queued_fds == NULL) + return -ENOMEM; + queued_fds->size = queue_size; + stream->queued_fds = queued_fds; + } + + /* Put fd in a queue */ + queued_fds->fds[queued_fds->offset++] = fd; + + return 0; +} + + +#define UV__CMSG_FD_COUNT 64 +#define UV__CMSG_FD_SIZE (UV__CMSG_FD_COUNT * sizeof(int)) + + +static int uv__stream_recv_cmsg(uv_stream_t* stream, struct msghdr* msg) { + struct cmsghdr* cmsg; + + for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) { + char* start; + char* end; + int err; + void* pv; + int* pi; + unsigned int i; + unsigned int count; + + if (cmsg->cmsg_type != SCM_RIGHTS) { + fprintf(stderr, "ignoring non-SCM_RIGHTS ancillary data: %d\n", + cmsg->cmsg_type); + continue; + } + + /* silence aliasing warning */ + pv = CMSG_DATA(cmsg); + pi = pv; + + /* Count available fds */ + start = (char*) cmsg; + end = (char*) cmsg + cmsg->cmsg_len; + count = 0; + while (start + CMSG_LEN(count * sizeof(*pi)) < end) + count++; + assert(start + CMSG_LEN(count * sizeof(*pi)) == end); + + for (i = 0; i < count; i++) { + /* Already has accepted fd, queue now */ + if (stream->accepted_fd != -1) { + err = uv__stream_queue_fd(stream, pi[i]); + if (err != 0) { + /* Close rest */ + for (; i < count; i++) + uv__close(pi[i]); + return err; + } + } else { + stream->accepted_fd = pi[i]; + } + } + } + + return 0; +} + + +static void uv__read(uv_stream_t* stream) { + uv_buf_t buf; + ssize_t nread; + struct msghdr msg; + char cmsg_space[CMSG_SPACE(UV__CMSG_FD_SIZE)]; + int count; + int err; + int is_ipc; + + stream->flags &= ~UV_STREAM_READ_PARTIAL; + + /* Prevent loop starvation when the data comes in as fast as (or faster than) + * we can read it. XXX Need to rearm fd if we switch to edge-triggered I/O. + */ + count = 32; + + is_ipc = stream->type == UV_NAMED_PIPE && ((uv_pipe_t*) stream)->ipc; + + /* XXX: Maybe instead of having UV_STREAM_READING we just test if + * tcp->read_cb is NULL or not? + */ + while (stream->read_cb + && (stream->flags & UV_STREAM_READING) + && (count-- > 0)) { + assert(stream->alloc_cb != NULL); + + stream->alloc_cb((uv_handle_t*)stream, 64 * 1024, &buf); + if (buf.len == 0) { + /* User indicates it can't or won't handle the read. */ + stream->read_cb(stream, UV_ENOBUFS, &buf); + return; + } + + assert(buf.base != NULL); + assert(uv__stream_fd(stream) >= 0); + + if (!is_ipc) { + do { + nread = read(uv__stream_fd(stream), buf.base, buf.len); + } + while (nread < 0 && errno == EINTR); + } else { + /* ipc uses recvmsg */ + msg.msg_flags = 0; + msg.msg_iov = (struct iovec*) &buf; + msg.msg_iovlen = 1; + msg.msg_name = NULL; + msg.msg_namelen = 0; + /* Set up to receive a descriptor even if one isn't in the message */ + msg.msg_controllen = sizeof(cmsg_space); + msg.msg_control = cmsg_space; + + do { + nread = uv__recvmsg(uv__stream_fd(stream), &msg, 0); + } + while (nread < 0 && errno == EINTR); + } + + if (nread < 0) { + /* Error */ + if (errno == EAGAIN || errno == EWOULDBLOCK) { + /* Wait for the next one. */ + if (stream->flags & UV_STREAM_READING) { + uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN); + uv__stream_osx_interrupt_select(stream); + } + stream->read_cb(stream, 0, &buf); + } else { + /* Error. User should call uv_close(). */ + stream->read_cb(stream, -errno, &buf); + if (stream->flags & UV_STREAM_READING) { + stream->flags &= ~UV_STREAM_READING; + uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN); + if (!uv__io_active(&stream->io_watcher, UV__POLLOUT)) + uv__handle_stop(stream); + uv__stream_osx_interrupt_select(stream); + } + } + return; + } else if (nread == 0) { + uv__stream_eof(stream, &buf); + return; + } else { + /* Successful read */ + ssize_t buflen = buf.len; + + if (is_ipc) { + err = uv__stream_recv_cmsg(stream, &msg); + if (err != 0) { + stream->read_cb(stream, err, &buf); + return; + } + } + stream->read_cb(stream, nread, &buf); + + /* Return if we didn't fill the buffer, there is no more data to read. */ + if (nread < buflen) { + stream->flags |= UV_STREAM_READ_PARTIAL; + return; + } + } + } +} + + +#undef UV__CMSG_FD_COUNT +#undef UV__CMSG_FD_SIZE + + +int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) { + assert((stream->type == UV_TCP || stream->type == UV_NAMED_PIPE) && + "uv_shutdown (unix) only supports uv_handle_t right now"); + + if (!(stream->flags & UV_STREAM_WRITABLE) || + stream->flags & UV_STREAM_SHUT || + stream->flags & UV_STREAM_SHUTTING || + stream->flags & UV_CLOSED || + stream->flags & UV_CLOSING) { + return -ENOTCONN; + } + + assert(uv__stream_fd(stream) >= 0); + + /* Initialize request */ + uv__req_init(stream->loop, req, UV_SHUTDOWN); + req->handle = stream; + req->cb = cb; + stream->shutdown_req = req; + stream->flags |= UV_STREAM_SHUTTING; + + uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT); + uv__stream_osx_interrupt_select(stream); + + return 0; +} + + +static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { + uv_stream_t* stream; + + stream = container_of(w, uv_stream_t, io_watcher); + + assert(stream->type == UV_TCP || + stream->type == UV_NAMED_PIPE || + stream->type == UV_TTY); + assert(!(stream->flags & UV_CLOSING)); + + if (stream->connect_req) { + uv__stream_connect(stream); + return; + } + + assert(uv__stream_fd(stream) >= 0); + + /* Ignore POLLHUP here. Even it it's set, there may still be data to read. */ + if (events & (UV__POLLIN | UV__POLLERR | UV__POLLHUP)) + uv__read(stream); + + if (uv__stream_fd(stream) == -1) + return; /* read_cb closed stream. */ + + /* Short-circuit iff POLLHUP is set, the user is still interested in read + * events and uv__read() reported a partial read but not EOF. If the EOF + * flag is set, uv__read() called read_cb with err=UV_EOF and we don't + * have to do anything. If the partial read flag is not set, we can't + * report the EOF yet because there is still data to read. + */ + if ((events & UV__POLLHUP) && + (stream->flags & UV_STREAM_READING) && + (stream->flags & UV_STREAM_READ_PARTIAL) && + !(stream->flags & UV_STREAM_READ_EOF)) { + uv_buf_t buf = { NULL, 0 }; + uv__stream_eof(stream, &buf); + } + + if (uv__stream_fd(stream) == -1) + return; /* read_cb closed stream. */ + + if (events & (UV__POLLOUT | UV__POLLERR | UV__POLLHUP)) { + uv__write(stream); + uv__write_callbacks(stream); + + /* Write queue drained. */ + if (QUEUE_EMPTY(&stream->write_queue)) + uv__drain(stream); + } +} + + +/** + * We get called here from directly following a call to connect(2). + * In order to determine if we've errored out or succeeded must call + * getsockopt. + */ +static void uv__stream_connect(uv_stream_t* stream) { + int error; + uv_connect_t* req = stream->connect_req; + socklen_t errorsize = sizeof(int); + + assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE); + assert(req); + + if (stream->delayed_error) { + /* To smooth over the differences between unixes errors that + * were reported synchronously on the first connect can be delayed + * until the next tick--which is now. + */ + error = stream->delayed_error; + stream->delayed_error = 0; + } else { + /* Normal situation: we need to get the socket error from the kernel. */ + assert(uv__stream_fd(stream) >= 0); + getsockopt(uv__stream_fd(stream), + SOL_SOCKET, + SO_ERROR, + &error, + &errorsize); + error = -error; + } + + if (error == -EINPROGRESS) + return; + + stream->connect_req = NULL; + uv__req_unregister(stream->loop, req); + + if (error < 0 || QUEUE_EMPTY(&stream->write_queue)) { + uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT); + } + + if (req->cb) + req->cb(req, error); + + if (uv__stream_fd(stream) == -1) + return; + + if (error < 0) { + uv__stream_flush_write_queue(stream, -ECANCELED); + uv__write_callbacks(stream); + } +} + + +int uv_write2(uv_write_t* req, + uv_stream_t* stream, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_stream_t* send_handle, + uv_write_cb cb) { + int empty_queue; + + assert(nbufs > 0); + assert((stream->type == UV_TCP || + stream->type == UV_NAMED_PIPE || + stream->type == UV_TTY) && + "uv_write (unix) does not yet support other types of streams"); + + if (uv__stream_fd(stream) < 0) + return -EBADF; + + if (send_handle) { + if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc) + return -EINVAL; + + /* XXX We abuse uv_write2() to send over UDP handles to child processes. + * Don't call uv__stream_fd() on those handles, it's a macro that on OS X + * evaluates to a function that operates on a uv_stream_t with a couple of + * OS X specific fields. On other Unices it does (handle)->io_watcher.fd, + * which works but only by accident. + */ + if (uv__handle_fd((uv_handle_t*) send_handle) < 0) + return -EBADF; + } + + /* It's legal for write_queue_size > 0 even when the write_queue is empty; + * it means there are error-state requests in the write_completed_queue that + * will touch up write_queue_size later, see also uv__write_req_finish(). + * We could check that write_queue is empty instead but that implies making + * a write() syscall when we know that the handle is in error mode. + */ + empty_queue = (stream->write_queue_size == 0); + + /* Initialize the req */ + uv__req_init(stream->loop, req, UV_WRITE); + req->cb = cb; + req->handle = stream; + req->error = 0; + req->send_handle = send_handle; + QUEUE_INIT(&req->queue); + + req->bufs = req->bufsml; + if (nbufs > ARRAY_SIZE(req->bufsml)) + req->bufs = uv__malloc(nbufs * sizeof(bufs[0])); + + if (req->bufs == NULL) + return -ENOMEM; + + memcpy(req->bufs, bufs, nbufs * sizeof(bufs[0])); + req->nbufs = nbufs; + req->write_index = 0; + stream->write_queue_size += uv__count_bufs(bufs, nbufs); + + /* Append the request to write_queue. */ + QUEUE_INSERT_TAIL(&stream->write_queue, &req->queue); + + /* If the queue was empty when this function began, we should attempt to + * do the write immediately. Otherwise start the write_watcher and wait + * for the fd to become writable. + */ + if (stream->connect_req) { + /* Still connecting, do nothing. */ + } + else if (empty_queue) { + uv__write(stream); + } + else { + /* + * blocking streams should never have anything in the queue. + * if this assert fires then somehow the blocking stream isn't being + * sufficiently flushed in uv__write. + */ + assert(!(stream->flags & UV_STREAM_BLOCKING)); + uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT); + uv__stream_osx_interrupt_select(stream); + } + + return 0; +} + + +/* The buffers to be written must remain valid until the callback is called. + * This is not required for the uv_buf_t array. + */ +int uv_write(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_write_cb cb) { + return uv_write2(req, handle, bufs, nbufs, NULL, cb); +} + + +void uv_try_write_cb(uv_write_t* req, int status) { + /* Should not be called */ + abort(); +} + + +int uv_try_write(uv_stream_t* stream, + const uv_buf_t bufs[], + unsigned int nbufs) { + int r; + int has_pollout; + size_t written; + size_t req_size; + uv_write_t req; + + /* Connecting or already writing some data */ + if (stream->connect_req != NULL || stream->write_queue_size != 0) + return -EAGAIN; + + has_pollout = uv__io_active(&stream->io_watcher, UV__POLLOUT); + + r = uv_write(&req, stream, bufs, nbufs, uv_try_write_cb); + if (r != 0) + return r; + + /* Remove not written bytes from write queue size */ + written = uv__count_bufs(bufs, nbufs); + if (req.bufs != NULL) + req_size = uv__write_req_size(&req); + else + req_size = 0; + written -= req_size; + stream->write_queue_size -= req_size; + + /* Unqueue request, regardless of immediateness */ + QUEUE_REMOVE(&req.queue); + uv__req_unregister(stream->loop, &req); + if (req.bufs != req.bufsml) + uv__free(req.bufs); + req.bufs = NULL; + + /* Do not poll for writable, if we wasn't before calling this */ + if (!has_pollout) { + uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT); + uv__stream_osx_interrupt_select(stream); + } + + if (written == 0 && req_size != 0) + return -EAGAIN; + else + return written; +} + + +int uv_read_start(uv_stream_t* stream, + uv_alloc_cb alloc_cb, + uv_read_cb read_cb) { + assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE || + stream->type == UV_TTY); + + if (stream->flags & UV_CLOSING) + return -EINVAL; + + /* The UV_STREAM_READING flag is irrelevant of the state of the tcp - it just + * expresses the desired state of the user. + */ + stream->flags |= UV_STREAM_READING; + + /* TODO: try to do the read inline? */ + /* TODO: keep track of tcp state. If we've gotten a EOF then we should + * not start the IO watcher. + */ + assert(uv__stream_fd(stream) >= 0); + assert(alloc_cb); + + stream->read_cb = read_cb; + stream->alloc_cb = alloc_cb; + + uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN); + uv__handle_start(stream); + uv__stream_osx_interrupt_select(stream); + + return 0; +} + + +int uv_read_stop(uv_stream_t* stream) { + if (!(stream->flags & UV_STREAM_READING)) + return 0; + + stream->flags &= ~UV_STREAM_READING; + uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN); + if (!uv__io_active(&stream->io_watcher, UV__POLLOUT)) + uv__handle_stop(stream); + uv__stream_osx_interrupt_select(stream); + + stream->read_cb = NULL; + stream->alloc_cb = NULL; + return 0; +} + + +int uv_is_readable(const uv_stream_t* stream) { + return !!(stream->flags & UV_STREAM_READABLE); +} + + +int uv_is_writable(const uv_stream_t* stream) { + return !!(stream->flags & UV_STREAM_WRITABLE); +} + + +#if defined(__APPLE__) +int uv___stream_fd(const uv_stream_t* handle) { + const uv__stream_select_t* s; + + assert(handle->type == UV_TCP || + handle->type == UV_TTY || + handle->type == UV_NAMED_PIPE); + + s = handle->select; + if (s != NULL) + return s->fd; + + return handle->io_watcher.fd; +} +#endif /* defined(__APPLE__) */ + + +void uv__stream_close(uv_stream_t* handle) { + unsigned int i; + uv__stream_queued_fds_t* queued_fds; + +#if defined(__APPLE__) + /* Terminate select loop first */ + if (handle->select != NULL) { + uv__stream_select_t* s; + + s = handle->select; + + uv_sem_post(&s->close_sem); + uv_sem_post(&s->async_sem); + uv__stream_osx_interrupt_select(handle); + uv_thread_join(&s->thread); + uv_sem_destroy(&s->close_sem); + uv_sem_destroy(&s->async_sem); + uv__close(s->fake_fd); + uv__close(s->int_fd); + uv_close((uv_handle_t*) &s->async, uv__stream_osx_cb_close); + + handle->select = NULL; + } +#endif /* defined(__APPLE__) */ + + uv__io_close(handle->loop, &handle->io_watcher); + uv_read_stop(handle); + uv__handle_stop(handle); + + if (handle->io_watcher.fd != -1) { + /* Don't close stdio file descriptors. Nothing good comes from it. */ + if (handle->io_watcher.fd > STDERR_FILENO) + uv__close(handle->io_watcher.fd); + handle->io_watcher.fd = -1; + } + + if (handle->accepted_fd != -1) { + uv__close(handle->accepted_fd); + handle->accepted_fd = -1; + } + + /* Close all queued fds */ + if (handle->queued_fds != NULL) { + queued_fds = handle->queued_fds; + for (i = 0; i < queued_fds->offset; i++) + uv__close(queued_fds->fds[i]); + uv__free(handle->queued_fds); + handle->queued_fds = NULL; + } + + assert(!uv__io_active(&handle->io_watcher, UV__POLLIN | UV__POLLOUT)); +} + + +int uv_stream_set_blocking(uv_stream_t* handle, int blocking) { + /* Don't need to check the file descriptor, uv__nonblock() + * will fail with EBADF if it's not valid. + */ + return uv__nonblock(uv__stream_fd(handle), !blocking); +} diff --git a/3rdparty/libuv/src/unix/sunos.c b/3rdparty/libuv/src/unix/sunos.c new file mode 100644 index 00000000000..0c46817b446 --- /dev/null +++ b/3rdparty/libuv/src/unix/sunos.c @@ -0,0 +1,765 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + +#ifndef SUNOS_NO_IFADDRS +# include +#endif +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#define PORT_FIRED 0x69 +#define PORT_UNUSED 0x0 +#define PORT_LOADED 0x99 +#define PORT_DELETED -1 + +#if (!defined(_LP64)) && (_FILE_OFFSET_BITS - 0 == 64) +#define PROCFS_FILE_OFFSET_BITS_HACK 1 +#undef _FILE_OFFSET_BITS +#else +#define PROCFS_FILE_OFFSET_BITS_HACK 0 +#endif + +#include + +#if (PROCFS_FILE_OFFSET_BITS_HACK - 0 == 1) +#define _FILE_OFFSET_BITS 64 +#endif + + +int uv__platform_loop_init(uv_loop_t* loop) { + int err; + int fd; + + loop->fs_fd = -1; + loop->backend_fd = -1; + + fd = port_create(); + if (fd == -1) + return -errno; + + err = uv__cloexec(fd, 1); + if (err) { + uv__close(fd); + return err; + } + loop->backend_fd = fd; + + return 0; +} + + +void uv__platform_loop_delete(uv_loop_t* loop) { + if (loop->fs_fd != -1) { + uv__close(loop->fs_fd); + loop->fs_fd = -1; + } + + if (loop->backend_fd != -1) { + uv__close(loop->backend_fd); + loop->backend_fd = -1; + } +} + + +void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { + struct port_event* events; + uintptr_t i; + uintptr_t nfds; + + assert(loop->watchers != NULL); + + events = (struct port_event*) loop->watchers[loop->nwatchers]; + nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1]; + if (events == NULL) + return; + + /* Invalidate events with same file descriptor */ + for (i = 0; i < nfds; i++) + if ((int) events[i].portev_object == fd) + events[i].portev_object = -1; +} + + +void uv__io_poll(uv_loop_t* loop, int timeout) { + struct port_event events[1024]; + struct port_event* pe; + struct timespec spec; + QUEUE* q; + uv__io_t* w; + sigset_t* pset; + sigset_t set; + uint64_t base; + uint64_t diff; + unsigned int nfds; + unsigned int i; + int saved_errno; + int nevents; + int count; + int err; + int fd; + + if (loop->nfds == 0) { + assert(QUEUE_EMPTY(&loop->watcher_queue)); + return; + } + + while (!QUEUE_EMPTY(&loop->watcher_queue)) { + q = QUEUE_HEAD(&loop->watcher_queue); + QUEUE_REMOVE(q); + QUEUE_INIT(q); + + w = QUEUE_DATA(q, uv__io_t, watcher_queue); + assert(w->pevents != 0); + + if (port_associate(loop->backend_fd, PORT_SOURCE_FD, w->fd, w->pevents, 0)) + abort(); + + w->events = w->pevents; + } + + pset = NULL; + if (loop->flags & UV_LOOP_BLOCK_SIGPROF) { + pset = &set; + sigemptyset(pset); + sigaddset(pset, SIGPROF); + } + + assert(timeout >= -1); + base = loop->time; + count = 48; /* Benchmarks suggest this gives the best throughput. */ + + for (;;) { + if (timeout != -1) { + spec.tv_sec = timeout / 1000; + spec.tv_nsec = (timeout % 1000) * 1000000; + } + + /* Work around a kernel bug where nfds is not updated. */ + events[0].portev_source = 0; + + nfds = 1; + saved_errno = 0; + + if (pset != NULL) + pthread_sigmask(SIG_BLOCK, pset, NULL); + + err = port_getn(loop->backend_fd, + events, + ARRAY_SIZE(events), + &nfds, + timeout == -1 ? NULL : &spec); + + if (pset != NULL) + pthread_sigmask(SIG_UNBLOCK, pset, NULL); + + if (err) { + /* Work around another kernel bug: port_getn() may return events even + * on error. + */ + if (errno == EINTR || errno == ETIME) + saved_errno = errno; + else + abort(); + } + + /* Update loop->time unconditionally. It's tempting to skip the update when + * timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the + * operating system didn't reschedule our process while in the syscall. + */ + SAVE_ERRNO(uv__update_time(loop)); + + if (events[0].portev_source == 0) { + if (timeout == 0) + return; + + if (timeout == -1) + continue; + + goto update_timeout; + } + + if (nfds == 0) { + assert(timeout != -1); + return; + } + + nevents = 0; + + assert(loop->watchers != NULL); + loop->watchers[loop->nwatchers] = (void*) events; + loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds; + for (i = 0; i < nfds; i++) { + pe = events + i; + fd = pe->portev_object; + + /* Skip invalidated events, see uv__platform_invalidate_fd */ + if (fd == -1) + continue; + + assert(fd >= 0); + assert((unsigned) fd < loop->nwatchers); + + w = loop->watchers[fd]; + + /* File descriptor that we've stopped watching, ignore. */ + if (w == NULL) + continue; + + w->cb(loop, w, pe->portev_events); + nevents++; + + if (w != loop->watchers[fd]) + continue; /* Disabled by callback. */ + + /* Events Ports operates in oneshot mode, rearm timer on next run. */ + if (w->pevents != 0 && QUEUE_EMPTY(&w->watcher_queue)) + QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue); + } + loop->watchers[loop->nwatchers] = NULL; + loop->watchers[loop->nwatchers + 1] = NULL; + + if (nevents != 0) { + if (nfds == ARRAY_SIZE(events) && --count != 0) { + /* Poll for more events but don't block this time. */ + timeout = 0; + continue; + } + return; + } + + if (saved_errno == ETIME) { + assert(timeout != -1); + return; + } + + if (timeout == 0) + return; + + if (timeout == -1) + continue; + +update_timeout: + assert(timeout > 0); + + diff = loop->time - base; + if (diff >= (uint64_t) timeout) + return; + + timeout -= diff; + } +} + + +uint64_t uv__hrtime(uv_clocktype_t type) { + return gethrtime(); +} + + +/* + * We could use a static buffer for the path manipulations that we need outside + * of the function, but this function could be called by multiple consumers and + * we don't want to potentially create a race condition in the use of snprintf. + */ +int uv_exepath(char* buffer, size_t* size) { + ssize_t res; + char buf[128]; + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + snprintf(buf, sizeof(buf), "/proc/%lu/path/a.out", (unsigned long) getpid()); + + res = *size - 1; + if (res > 0) + res = readlink(buf, buffer, res); + + if (res == -1) + return -errno; + + buffer[res] = '\0'; + *size = res; + return 0; +} + + +uint64_t uv_get_free_memory(void) { + return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_AVPHYS_PAGES); +} + + +uint64_t uv_get_total_memory(void) { + return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_PHYS_PAGES); +} + + +void uv_loadavg(double avg[3]) { + (void) getloadavg(avg, 3); +} + + +#if defined(PORT_SOURCE_FILE) + +static int uv__fs_event_rearm(uv_fs_event_t *handle) { + if (handle->fd == -1) + return -EBADF; + + if (port_associate(handle->loop->fs_fd, + PORT_SOURCE_FILE, + (uintptr_t) &handle->fo, + FILE_ATTRIB | FILE_MODIFIED, + handle) == -1) { + return -errno; + } + handle->fd = PORT_LOADED; + + return 0; +} + + +static void uv__fs_event_read(uv_loop_t* loop, + uv__io_t* w, + unsigned int revents) { + uv_fs_event_t *handle = NULL; + timespec_t timeout; + port_event_t pe; + int events; + int r; + + (void) w; + (void) revents; + + do { + uint_t n = 1; + + /* + * Note that our use of port_getn() here (and not port_get()) is deliberate: + * there is a bug in event ports (Sun bug 6456558) whereby a zeroed timeout + * causes port_get() to return success instead of ETIME when there aren't + * actually any events (!); by using port_getn() in lieu of port_get(), + * we can at least workaround the bug by checking for zero returned events + * and treating it as we would ETIME. + */ + do { + memset(&timeout, 0, sizeof timeout); + r = port_getn(loop->fs_fd, &pe, 1, &n, &timeout); + } + while (r == -1 && errno == EINTR); + + if ((r == -1 && errno == ETIME) || n == 0) + break; + + handle = (uv_fs_event_t*) pe.portev_user; + assert((r == 0) && "unexpected port_get() error"); + + events = 0; + if (pe.portev_events & (FILE_ATTRIB | FILE_MODIFIED)) + events |= UV_CHANGE; + if (pe.portev_events & ~(FILE_ATTRIB | FILE_MODIFIED)) + events |= UV_RENAME; + assert(events != 0); + handle->fd = PORT_FIRED; + handle->cb(handle, NULL, events, 0); + + if (handle->fd != PORT_DELETED) { + r = uv__fs_event_rearm(handle); + if (r != 0) + handle->cb(handle, NULL, 0, r); + } + } + while (handle->fd != PORT_DELETED); +} + + +int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { + uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT); + return 0; +} + + +int uv_fs_event_start(uv_fs_event_t* handle, + uv_fs_event_cb cb, + const char* path, + unsigned int flags) { + int portfd; + int first_run; + int err; + + if (uv__is_active(handle)) + return -EINVAL; + + first_run = 0; + if (handle->loop->fs_fd == -1) { + portfd = port_create(); + if (portfd == -1) + return -errno; + handle->loop->fs_fd = portfd; + first_run = 1; + } + + uv__handle_start(handle); + handle->path = uv__strdup(path); + handle->fd = PORT_UNUSED; + handle->cb = cb; + + memset(&handle->fo, 0, sizeof handle->fo); + handle->fo.fo_name = handle->path; + err = uv__fs_event_rearm(handle); + if (err != 0) + return err; + + if (first_run) { + uv__io_init(&handle->loop->fs_event_watcher, uv__fs_event_read, portfd); + uv__io_start(handle->loop, &handle->loop->fs_event_watcher, UV__POLLIN); + } + + return 0; +} + + +int uv_fs_event_stop(uv_fs_event_t* handle) { + if (!uv__is_active(handle)) + return 0; + + if (handle->fd == PORT_FIRED || handle->fd == PORT_LOADED) { + port_dissociate(handle->loop->fs_fd, + PORT_SOURCE_FILE, + (uintptr_t) &handle->fo); + } + + handle->fd = PORT_DELETED; + uv__free(handle->path); + handle->path = NULL; + handle->fo.fo_name = NULL; + uv__handle_stop(handle); + + return 0; +} + +void uv__fs_event_close(uv_fs_event_t* handle) { + uv_fs_event_stop(handle); +} + +#else /* !defined(PORT_SOURCE_FILE) */ + +int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { + return -ENOSYS; +} + + +int uv_fs_event_start(uv_fs_event_t* handle, + uv_fs_event_cb cb, + const char* filename, + unsigned int flags) { + return -ENOSYS; +} + + +int uv_fs_event_stop(uv_fs_event_t* handle) { + return -ENOSYS; +} + + +void uv__fs_event_close(uv_fs_event_t* handle) { + UNREACHABLE(); +} + +#endif /* defined(PORT_SOURCE_FILE) */ + + +char** uv_setup_args(int argc, char** argv) { + return argv; +} + + +int uv_set_process_title(const char* title) { + return 0; +} + + +int uv_get_process_title(char* buffer, size_t size) { + if (size > 0) { + buffer[0] = '\0'; + } + return 0; +} + + +int uv_resident_set_memory(size_t* rss) { + psinfo_t psinfo; + int err; + int fd; + + fd = open("/proc/self/psinfo", O_RDONLY); + if (fd == -1) + return -errno; + + /* FIXME(bnoordhuis) Handle EINTR. */ + err = -EINVAL; + if (read(fd, &psinfo, sizeof(psinfo)) == sizeof(psinfo)) { + *rss = (size_t)psinfo.pr_rssize * 1024; + err = 0; + } + uv__close(fd); + + return err; +} + + +int uv_uptime(double* uptime) { + kstat_ctl_t *kc; + kstat_t *ksp; + kstat_named_t *knp; + + long hz = sysconf(_SC_CLK_TCK); + + kc = kstat_open(); + if (kc == NULL) + return -EPERM; + + ksp = kstat_lookup(kc, (char*) "unix", 0, (char*) "system_misc"); + if (kstat_read(kc, ksp, NULL) == -1) { + *uptime = -1; + } else { + knp = (kstat_named_t*) kstat_data_lookup(ksp, (char*) "clk_intr"); + *uptime = knp->value.ul / hz; + } + kstat_close(kc); + + return 0; +} + + +int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { + int lookup_instance; + kstat_ctl_t *kc; + kstat_t *ksp; + kstat_named_t *knp; + uv_cpu_info_t* cpu_info; + + kc = kstat_open(); + if (kc == NULL) + return -EPERM; + + /* Get count of cpus */ + lookup_instance = 0; + while ((ksp = kstat_lookup(kc, (char*) "cpu_info", lookup_instance, NULL))) { + lookup_instance++; + } + + *cpu_infos = uv__malloc(lookup_instance * sizeof(**cpu_infos)); + if (!(*cpu_infos)) { + kstat_close(kc); + return -ENOMEM; + } + + *count = lookup_instance; + + cpu_info = *cpu_infos; + lookup_instance = 0; + while ((ksp = kstat_lookup(kc, (char*) "cpu_info", lookup_instance, NULL))) { + if (kstat_read(kc, ksp, NULL) == -1) { + cpu_info->speed = 0; + cpu_info->model = NULL; + } else { + knp = kstat_data_lookup(ksp, (char*) "clock_MHz"); + assert(knp->data_type == KSTAT_DATA_INT32 || + knp->data_type == KSTAT_DATA_INT64); + cpu_info->speed = (knp->data_type == KSTAT_DATA_INT32) ? knp->value.i32 + : knp->value.i64; + + knp = kstat_data_lookup(ksp, (char*) "brand"); + assert(knp->data_type == KSTAT_DATA_STRING); + cpu_info->model = uv__strdup(KSTAT_NAMED_STR_PTR(knp)); + } + + lookup_instance++; + cpu_info++; + } + + cpu_info = *cpu_infos; + lookup_instance = 0; + for (;;) { + ksp = kstat_lookup(kc, (char*) "cpu", lookup_instance, (char*) "sys"); + + if (ksp == NULL) + break; + + if (kstat_read(kc, ksp, NULL) == -1) { + cpu_info->cpu_times.user = 0; + cpu_info->cpu_times.nice = 0; + cpu_info->cpu_times.sys = 0; + cpu_info->cpu_times.idle = 0; + cpu_info->cpu_times.irq = 0; + } else { + knp = kstat_data_lookup(ksp, (char*) "cpu_ticks_user"); + assert(knp->data_type == KSTAT_DATA_UINT64); + cpu_info->cpu_times.user = knp->value.ui64; + + knp = kstat_data_lookup(ksp, (char*) "cpu_ticks_kernel"); + assert(knp->data_type == KSTAT_DATA_UINT64); + cpu_info->cpu_times.sys = knp->value.ui64; + + knp = kstat_data_lookup(ksp, (char*) "cpu_ticks_idle"); + assert(knp->data_type == KSTAT_DATA_UINT64); + cpu_info->cpu_times.idle = knp->value.ui64; + + knp = kstat_data_lookup(ksp, (char*) "intr"); + assert(knp->data_type == KSTAT_DATA_UINT64); + cpu_info->cpu_times.irq = knp->value.ui64; + cpu_info->cpu_times.nice = 0; + } + + lookup_instance++; + cpu_info++; + } + + kstat_close(kc); + + return 0; +} + + +void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(cpu_infos[i].model); + } + + uv__free(cpu_infos); +} + + +int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { +#ifdef SUNOS_NO_IFADDRS + return -ENOSYS; +#else + uv_interface_address_t* address; + struct sockaddr_dl* sa_addr; + struct ifaddrs* addrs; + struct ifaddrs* ent; + int i; + + if (getifaddrs(&addrs)) + return -errno; + + *count = 0; + + /* Count the number of interfaces */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family == PF_PACKET)) { + continue; + } + + (*count)++; + } + + *addresses = uv__malloc(*count * sizeof(**addresses)); + if (!(*addresses)) { + freeifaddrs(addrs); + return -ENOMEM; + } + + address = *addresses; + + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING))) + continue; + + if (ent->ifa_addr == NULL) + continue; + + address->name = uv__strdup(ent->ifa_name); + + if (ent->ifa_addr->sa_family == AF_INET6) { + address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr); + } else { + address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr); + } + + if (ent->ifa_netmask->sa_family == AF_INET6) { + address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask); + } else { + address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask); + } + + address->is_internal = !!((ent->ifa_flags & IFF_PRIVATE) || + (ent->ifa_flags & IFF_LOOPBACK)); + + address++; + } + + /* Fill in physical addresses for each interface */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) || + (ent->ifa_addr == NULL) || + (ent->ifa_addr->sa_family != AF_LINK)) { + continue; + } + + address = *addresses; + + for (i = 0; i < (*count); i++) { + if (strcmp(address->name, ent->ifa_name) == 0) { + sa_addr = (struct sockaddr_dl*)(ent->ifa_addr); + memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); + } + address++; + } + } + + freeifaddrs(addrs); + + return 0; +#endif /* SUNOS_NO_IFADDRS */ +} + + +void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(addresses[i].name); + } + + uv__free(addresses); +} diff --git a/3rdparty/libuv/src/unix/tcp.c b/3rdparty/libuv/src/unix/tcp.c new file mode 100644 index 00000000000..6d213a49778 --- /dev/null +++ b/3rdparty/libuv/src/unix/tcp.c @@ -0,0 +1,362 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include + + +static int maybe_new_socket(uv_tcp_t* handle, int domain, int flags) { + int sockfd; + int err; + + if (domain == AF_UNSPEC || uv__stream_fd(handle) != -1) { + handle->flags |= flags; + return 0; + } + + err = uv__socket(domain, SOCK_STREAM, 0); + if (err < 0) + return err; + sockfd = err; + + err = uv__stream_open((uv_stream_t*) handle, sockfd, flags); + if (err) { + uv__close(sockfd); + return err; + } + + return 0; +} + + +int uv_tcp_init_ex(uv_loop_t* loop, uv_tcp_t* tcp, unsigned int flags) { + int domain; + + /* Use the lower 8 bits for the domain */ + domain = flags & 0xFF; + if (domain != AF_INET && domain != AF_INET6 && domain != AF_UNSPEC) + return -EINVAL; + + if (flags & ~0xFF) + return -EINVAL; + + uv__stream_init(loop, (uv_stream_t*)tcp, UV_TCP); + + /* If anything fails beyond this point we need to remove the handle from + * the handle queue, since it was added by uv__handle_init in uv_stream_init. + */ + + if (domain != AF_UNSPEC) { + int err = maybe_new_socket(tcp, domain, 0); + if (err) { + QUEUE_REMOVE(&tcp->handle_queue); + return err; + } + } + + return 0; +} + + +int uv_tcp_init(uv_loop_t* loop, uv_tcp_t* tcp) { + return uv_tcp_init_ex(loop, tcp, AF_UNSPEC); +} + + +int uv__tcp_bind(uv_tcp_t* tcp, + const struct sockaddr* addr, + unsigned int addrlen, + unsigned int flags) { + int err; + int on; + + /* Cannot set IPv6-only mode on non-IPv6 socket. */ + if ((flags & UV_TCP_IPV6ONLY) && addr->sa_family != AF_INET6) + return -EINVAL; + + err = maybe_new_socket(tcp, + addr->sa_family, + UV_STREAM_READABLE | UV_STREAM_WRITABLE); + if (err) + return err; + + on = 1; + if (setsockopt(tcp->io_watcher.fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) + return -errno; + +#ifdef IPV6_V6ONLY + if (addr->sa_family == AF_INET6) { + on = (flags & UV_TCP_IPV6ONLY) != 0; + if (setsockopt(tcp->io_watcher.fd, + IPPROTO_IPV6, + IPV6_V6ONLY, + &on, + sizeof on) == -1) { + return -errno; + } + } +#endif + + errno = 0; + if (bind(tcp->io_watcher.fd, addr, addrlen) && errno != EADDRINUSE) { + if (errno == EAFNOSUPPORT) + /* OSX, other BSDs and SunoS fail with EAFNOSUPPORT when binding a + * socket created with AF_INET to an AF_INET6 address or vice versa. */ + return -EINVAL; + return -errno; + } + tcp->delayed_error = -errno; + + if (addr->sa_family == AF_INET6) + tcp->flags |= UV_HANDLE_IPV6; + + return 0; +} + + +int uv__tcp_connect(uv_connect_t* req, + uv_tcp_t* handle, + const struct sockaddr* addr, + unsigned int addrlen, + uv_connect_cb cb) { + int err; + int r; + + assert(handle->type == UV_TCP); + + if (handle->connect_req != NULL) + return -EALREADY; /* FIXME(bnoordhuis) -EINVAL or maybe -EBUSY. */ + + err = maybe_new_socket(handle, + addr->sa_family, + UV_STREAM_READABLE | UV_STREAM_WRITABLE); + if (err) + return err; + + handle->delayed_error = 0; + + do + r = connect(uv__stream_fd(handle), addr, addrlen); + while (r == -1 && errno == EINTR); + + if (r == -1) { + if (errno == EINPROGRESS) + ; /* not an error */ + else if (errno == ECONNREFUSED) + /* If we get a ECONNREFUSED wait until the next tick to report the + * error. Solaris wants to report immediately--other unixes want to + * wait. + */ + handle->delayed_error = -errno; + else + return -errno; + } + + uv__req_init(handle->loop, req, UV_CONNECT); + req->cb = cb; + req->handle = (uv_stream_t*) handle; + QUEUE_INIT(&req->queue); + handle->connect_req = req; + + uv__io_start(handle->loop, &handle->io_watcher, UV__POLLOUT); + + if (handle->delayed_error) + uv__io_feed(handle->loop, &handle->io_watcher); + + return 0; +} + + +int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock) { + int err; + + err = uv__nonblock(sock, 1); + if (err) + return err; + + return uv__stream_open((uv_stream_t*)handle, + sock, + UV_STREAM_READABLE | UV_STREAM_WRITABLE); +} + + +int uv_tcp_getsockname(const uv_tcp_t* handle, + struct sockaddr* name, + int* namelen) { + socklen_t socklen; + + if (handle->delayed_error) + return handle->delayed_error; + + if (uv__stream_fd(handle) < 0) + return -EINVAL; /* FIXME(bnoordhuis) -EBADF */ + + /* sizeof(socklen_t) != sizeof(int) on some systems. */ + socklen = (socklen_t) *namelen; + + if (getsockname(uv__stream_fd(handle), name, &socklen)) + return -errno; + + *namelen = (int) socklen; + return 0; +} + + +int uv_tcp_getpeername(const uv_tcp_t* handle, + struct sockaddr* name, + int* namelen) { + socklen_t socklen; + + if (handle->delayed_error) + return handle->delayed_error; + + if (uv__stream_fd(handle) < 0) + return -EINVAL; /* FIXME(bnoordhuis) -EBADF */ + + /* sizeof(socklen_t) != sizeof(int) on some systems. */ + socklen = (socklen_t) *namelen; + + if (getpeername(uv__stream_fd(handle), name, &socklen)) + return -errno; + + *namelen = (int) socklen; + return 0; +} + + +int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) { + static int single_accept = -1; + int err; + + if (tcp->delayed_error) + return tcp->delayed_error; + + if (single_accept == -1) { + const char* val = getenv("UV_TCP_SINGLE_ACCEPT"); + single_accept = (val != NULL && atoi(val) != 0); /* Off by default. */ + } + + if (single_accept) + tcp->flags |= UV_TCP_SINGLE_ACCEPT; + + err = maybe_new_socket(tcp, AF_INET, UV_STREAM_READABLE); + if (err) + return err; + + if (listen(tcp->io_watcher.fd, backlog)) + return -errno; + + tcp->connection_cb = cb; + + /* Start listening for connections. */ + tcp->io_watcher.cb = uv__server_io; + uv__io_start(tcp->loop, &tcp->io_watcher, UV__POLLIN); + + return 0; +} + + +int uv__tcp_nodelay(int fd, int on) { + if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on))) + return -errno; + return 0; +} + + +int uv__tcp_keepalive(int fd, int on, unsigned int delay) { + if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on))) + return -errno; + +#ifdef TCP_KEEPIDLE + if (on && setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &delay, sizeof(delay))) + return -errno; +#endif + + /* Solaris/SmartOS, if you don't support keep-alive, + * then don't advertise it in your system headers... + */ + /* FIXME(bnoordhuis) That's possibly because sizeof(delay) should be 1. */ +#if defined(TCP_KEEPALIVE) && !defined(__sun) + if (on && setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &delay, sizeof(delay))) + return -errno; +#endif + + return 0; +} + + +int uv_tcp_nodelay(uv_tcp_t* handle, int on) { + int err; + + if (uv__stream_fd(handle) != -1) { + err = uv__tcp_nodelay(uv__stream_fd(handle), on); + if (err) + return err; + } + + if (on) + handle->flags |= UV_TCP_NODELAY; + else + handle->flags &= ~UV_TCP_NODELAY; + + return 0; +} + + +int uv_tcp_keepalive(uv_tcp_t* handle, int on, unsigned int delay) { + int err; + + if (uv__stream_fd(handle) != -1) { + err =uv__tcp_keepalive(uv__stream_fd(handle), on, delay); + if (err) + return err; + } + + if (on) + handle->flags |= UV_TCP_KEEPALIVE; + else + handle->flags &= ~UV_TCP_KEEPALIVE; + + /* TODO Store delay if uv__stream_fd(handle) == -1 but don't want to enlarge + * uv_tcp_t with an int that's almost never used... + */ + + return 0; +} + + +int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) { + if (enable) + handle->flags &= ~UV_TCP_SINGLE_ACCEPT; + else + handle->flags |= UV_TCP_SINGLE_ACCEPT; + return 0; +} + + +void uv__tcp_close(uv_tcp_t* handle) { + uv__stream_close((uv_stream_t*)handle); +} diff --git a/3rdparty/libuv/src/unix/thread.c b/3rdparty/libuv/src/unix/thread.c new file mode 100644 index 00000000000..c56a3170259 --- /dev/null +++ b/3rdparty/libuv/src/unix/thread.c @@ -0,0 +1,525 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include + +#include + +#undef NANOSEC +#define NANOSEC ((uint64_t) 1e9) + + +struct thread_ctx { + void (*entry)(void* arg); + void* arg; +}; + + +static void* uv__thread_start(void *arg) +{ + struct thread_ctx *ctx_p; + struct thread_ctx ctx; + + ctx_p = arg; + ctx = *ctx_p; + uv__free(ctx_p); + ctx.entry(ctx.arg); + + return 0; +} + + +int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) { + struct thread_ctx* ctx; + int err; + + ctx = uv__malloc(sizeof(*ctx)); + if (ctx == NULL) + return UV_ENOMEM; + + ctx->entry = entry; + ctx->arg = arg; + + err = pthread_create(tid, NULL, uv__thread_start, ctx); + + if (err) + uv__free(ctx); + + return -err; +} + + +uv_thread_t uv_thread_self(void) { + return pthread_self(); +} + +int uv_thread_join(uv_thread_t *tid) { + return -pthread_join(*tid, NULL); +} + + +int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2) { + return pthread_equal(*t1, *t2); +} + + +int uv_mutex_init(uv_mutex_t* mutex) { +#if defined(NDEBUG) || !defined(PTHREAD_MUTEX_ERRORCHECK) + return -pthread_mutex_init(mutex, NULL); +#else + pthread_mutexattr_t attr; + int err; + + if (pthread_mutexattr_init(&attr)) + abort(); + + if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK)) + abort(); + + err = pthread_mutex_init(mutex, &attr); + + if (pthread_mutexattr_destroy(&attr)) + abort(); + + return -err; +#endif +} + + +void uv_mutex_destroy(uv_mutex_t* mutex) { + if (pthread_mutex_destroy(mutex)) + abort(); +} + + +void uv_mutex_lock(uv_mutex_t* mutex) { + if (pthread_mutex_lock(mutex)) + abort(); +} + + +int uv_mutex_trylock(uv_mutex_t* mutex) { + int err; + + err = pthread_mutex_trylock(mutex); + if (err) { + if (err != EBUSY && err != EAGAIN) + abort(); + return -EBUSY; + } + + return 0; +} + + +void uv_mutex_unlock(uv_mutex_t* mutex) { + if (pthread_mutex_unlock(mutex)) + abort(); +} + + +int uv_rwlock_init(uv_rwlock_t* rwlock) { + return -pthread_rwlock_init(rwlock, NULL); +} + + +void uv_rwlock_destroy(uv_rwlock_t* rwlock) { + if (pthread_rwlock_destroy(rwlock)) + abort(); +} + + +void uv_rwlock_rdlock(uv_rwlock_t* rwlock) { + if (pthread_rwlock_rdlock(rwlock)) + abort(); +} + + +int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock) { + int err; + + err = pthread_rwlock_tryrdlock(rwlock); + if (err) { + if (err != EBUSY && err != EAGAIN) + abort(); + return -EBUSY; + } + + return 0; +} + + +void uv_rwlock_rdunlock(uv_rwlock_t* rwlock) { + if (pthread_rwlock_unlock(rwlock)) + abort(); +} + + +void uv_rwlock_wrlock(uv_rwlock_t* rwlock) { + if (pthread_rwlock_wrlock(rwlock)) + abort(); +} + + +int uv_rwlock_trywrlock(uv_rwlock_t* rwlock) { + int err; + + err = pthread_rwlock_trywrlock(rwlock); + if (err) { + if (err != EBUSY && err != EAGAIN) + abort(); + return -EBUSY; + } + + return 0; +} + + +void uv_rwlock_wrunlock(uv_rwlock_t* rwlock) { + if (pthread_rwlock_unlock(rwlock)) + abort(); +} + + +void uv_once(uv_once_t* guard, void (*callback)(void)) { + if (pthread_once(guard, callback)) + abort(); +} + +#if defined(__APPLE__) && defined(__MACH__) + +int uv_sem_init(uv_sem_t* sem, unsigned int value) { + kern_return_t err; + + err = semaphore_create(mach_task_self(), sem, SYNC_POLICY_FIFO, value); + if (err == KERN_SUCCESS) + return 0; + if (err == KERN_INVALID_ARGUMENT) + return -EINVAL; + if (err == KERN_RESOURCE_SHORTAGE) + return -ENOMEM; + + abort(); + return -EINVAL; /* Satisfy the compiler. */ +} + + +void uv_sem_destroy(uv_sem_t* sem) { + if (semaphore_destroy(mach_task_self(), *sem)) + abort(); +} + + +void uv_sem_post(uv_sem_t* sem) { + if (semaphore_signal(*sem)) + abort(); +} + + +void uv_sem_wait(uv_sem_t* sem) { + int r; + + do + r = semaphore_wait(*sem); + while (r == KERN_ABORTED); + + if (r != KERN_SUCCESS) + abort(); +} + + +int uv_sem_trywait(uv_sem_t* sem) { + mach_timespec_t interval; + kern_return_t err; + + interval.tv_sec = 0; + interval.tv_nsec = 0; + + err = semaphore_timedwait(*sem, interval); + if (err == KERN_SUCCESS) + return 0; + if (err == KERN_OPERATION_TIMED_OUT) + return -EAGAIN; + + abort(); + return -EINVAL; /* Satisfy the compiler. */ +} + +#else /* !(defined(__APPLE__) && defined(__MACH__)) */ + +int uv_sem_init(uv_sem_t* sem, unsigned int value) { + if (sem_init(sem, 0, value)) + return -errno; + return 0; +} + + +void uv_sem_destroy(uv_sem_t* sem) { + if (sem_destroy(sem)) + abort(); +} + + +void uv_sem_post(uv_sem_t* sem) { + if (sem_post(sem)) + abort(); +} + + +void uv_sem_wait(uv_sem_t* sem) { + int r; + + do + r = sem_wait(sem); + while (r == -1 && errno == EINTR); + + if (r) + abort(); +} + + +int uv_sem_trywait(uv_sem_t* sem) { + int r; + + do + r = sem_trywait(sem); + while (r == -1 && errno == EINTR); + + if (r) { + if (errno == EAGAIN) + return -EAGAIN; + abort(); + } + + return 0; +} + +#endif /* defined(__APPLE__) && defined(__MACH__) */ + + +#if defined(__APPLE__) && defined(__MACH__) + +int uv_cond_init(uv_cond_t* cond) { + return -pthread_cond_init(cond, NULL); +} + +#else /* !(defined(__APPLE__) && defined(__MACH__)) */ + +int uv_cond_init(uv_cond_t* cond) { + pthread_condattr_t attr; + int err; + + err = pthread_condattr_init(&attr); + if (err) + return -err; + +#if !(defined(__ANDROID__) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)) + err = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); + if (err) + goto error2; +#endif + + err = pthread_cond_init(cond, &attr); + if (err) + goto error2; + + err = pthread_condattr_destroy(&attr); + if (err) + goto error; + + return 0; + +error: + pthread_cond_destroy(cond); +error2: + pthread_condattr_destroy(&attr); + return -err; +} + +#endif /* defined(__APPLE__) && defined(__MACH__) */ + +void uv_cond_destroy(uv_cond_t* cond) { + if (pthread_cond_destroy(cond)) + abort(); +} + +void uv_cond_signal(uv_cond_t* cond) { + if (pthread_cond_signal(cond)) + abort(); +} + +void uv_cond_broadcast(uv_cond_t* cond) { + if (pthread_cond_broadcast(cond)) + abort(); +} + +void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex) { + if (pthread_cond_wait(cond, mutex)) + abort(); +} + + +int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) { + int r; + struct timespec ts; + +#if defined(__APPLE__) && defined(__MACH__) + ts.tv_sec = timeout / NANOSEC; + ts.tv_nsec = timeout % NANOSEC; + r = pthread_cond_timedwait_relative_np(cond, mutex, &ts); +#else + timeout += uv__hrtime(UV_CLOCK_PRECISE); + ts.tv_sec = timeout / NANOSEC; + ts.tv_nsec = timeout % NANOSEC; +#if defined(__ANDROID__) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC) + /* + * The bionic pthread implementation doesn't support CLOCK_MONOTONIC, + * but has this alternative function instead. + */ + r = pthread_cond_timedwait_monotonic_np(cond, mutex, &ts); +#else + r = pthread_cond_timedwait(cond, mutex, &ts); +#endif /* __ANDROID__ */ +#endif + + + if (r == 0) + return 0; + + if (r == ETIMEDOUT) + return -ETIMEDOUT; + + abort(); + return -EINVAL; /* Satisfy the compiler. */ +} + + +#if defined(__APPLE__) && defined(__MACH__) + +int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) { + int err; + + barrier->n = count; + barrier->count = 0; + + err = uv_mutex_init(&barrier->mutex); + if (err) + return -err; + + err = uv_sem_init(&barrier->turnstile1, 0); + if (err) + goto error2; + + err = uv_sem_init(&barrier->turnstile2, 1); + if (err) + goto error; + + return 0; + +error: + uv_sem_destroy(&barrier->turnstile1); +error2: + uv_mutex_destroy(&barrier->mutex); + return -err; + +} + + +void uv_barrier_destroy(uv_barrier_t* barrier) { + uv_sem_destroy(&barrier->turnstile2); + uv_sem_destroy(&barrier->turnstile1); + uv_mutex_destroy(&barrier->mutex); +} + + +int uv_barrier_wait(uv_barrier_t* barrier) { + int serial_thread; + + uv_mutex_lock(&barrier->mutex); + if (++barrier->count == barrier->n) { + uv_sem_wait(&barrier->turnstile2); + uv_sem_post(&barrier->turnstile1); + } + uv_mutex_unlock(&barrier->mutex); + + uv_sem_wait(&barrier->turnstile1); + uv_sem_post(&barrier->turnstile1); + + uv_mutex_lock(&barrier->mutex); + serial_thread = (--barrier->count == 0); + if (serial_thread) { + uv_sem_wait(&barrier->turnstile1); + uv_sem_post(&barrier->turnstile2); + } + uv_mutex_unlock(&barrier->mutex); + + uv_sem_wait(&barrier->turnstile2); + uv_sem_post(&barrier->turnstile2); + return serial_thread; +} + +#else /* !(defined(__APPLE__) && defined(__MACH__)) */ + +int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) { + return -pthread_barrier_init(barrier, NULL, count); +} + + +void uv_barrier_destroy(uv_barrier_t* barrier) { + if (pthread_barrier_destroy(barrier)) + abort(); +} + + +int uv_barrier_wait(uv_barrier_t* barrier) { + int r = pthread_barrier_wait(barrier); + if (r && r != PTHREAD_BARRIER_SERIAL_THREAD) + abort(); + return r == PTHREAD_BARRIER_SERIAL_THREAD; +} + +#endif /* defined(__APPLE__) && defined(__MACH__) */ + +int uv_key_create(uv_key_t* key) { + return -pthread_key_create(key, NULL); +} + + +void uv_key_delete(uv_key_t* key) { + if (pthread_key_delete(*key)) + abort(); +} + + +void* uv_key_get(uv_key_t* key) { + return pthread_getspecific(*key); +} + + +void uv_key_set(uv_key_t* key, void* value) { + if (pthread_setspecific(*key, value)) + abort(); +} diff --git a/3rdparty/libuv/src/unix/timer.c b/3rdparty/libuv/src/unix/timer.c new file mode 100644 index 00000000000..ca3ec3db957 --- /dev/null +++ b/3rdparty/libuv/src/unix/timer.c @@ -0,0 +1,172 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" +#include "heap-inl.h" + +#include +#include + + +static int timer_less_than(const struct heap_node* ha, + const struct heap_node* hb) { + const uv_timer_t* a; + const uv_timer_t* b; + + a = container_of(ha, const uv_timer_t, heap_node); + b = container_of(hb, const uv_timer_t, heap_node); + + if (a->timeout < b->timeout) + return 1; + if (b->timeout < a->timeout) + return 0; + + /* Compare start_id when both have the same timeout. start_id is + * allocated with loop->timer_counter in uv_timer_start(). + */ + if (a->start_id < b->start_id) + return 1; + if (b->start_id < a->start_id) + return 0; + + return 0; +} + + +int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) { + uv__handle_init(loop, (uv_handle_t*)handle, UV_TIMER); + handle->timer_cb = NULL; + handle->repeat = 0; + return 0; +} + + +int uv_timer_start(uv_timer_t* handle, + uv_timer_cb cb, + uint64_t timeout, + uint64_t repeat) { + uint64_t clamped_timeout; + + if (cb == NULL) + return -EINVAL; + + if (uv__is_active(handle)) + uv_timer_stop(handle); + + clamped_timeout = handle->loop->time + timeout; + if (clamped_timeout < timeout) + clamped_timeout = (uint64_t) -1; + + handle->timer_cb = cb; + handle->timeout = clamped_timeout; + handle->repeat = repeat; + /* start_id is the second index to be compared in uv__timer_cmp() */ + handle->start_id = handle->loop->timer_counter++; + + heap_insert((struct heap*) &handle->loop->timer_heap, + (struct heap_node*) &handle->heap_node, + timer_less_than); + uv__handle_start(handle); + + return 0; +} + + +int uv_timer_stop(uv_timer_t* handle) { + if (!uv__is_active(handle)) + return 0; + + heap_remove((struct heap*) &handle->loop->timer_heap, + (struct heap_node*) &handle->heap_node, + timer_less_than); + uv__handle_stop(handle); + + return 0; +} + + +int uv_timer_again(uv_timer_t* handle) { + if (handle->timer_cb == NULL) + return -EINVAL; + + if (handle->repeat) { + uv_timer_stop(handle); + uv_timer_start(handle, handle->timer_cb, handle->repeat, handle->repeat); + } + + return 0; +} + + +void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat) { + handle->repeat = repeat; +} + + +uint64_t uv_timer_get_repeat(const uv_timer_t* handle) { + return handle->repeat; +} + + +int uv__next_timeout(const uv_loop_t* loop) { + const struct heap_node* heap_node; + const uv_timer_t* handle; + uint64_t diff; + + heap_node = heap_min((const struct heap*) &loop->timer_heap); + if (heap_node == NULL) + return -1; /* block indefinitely */ + + handle = container_of(heap_node, const uv_timer_t, heap_node); + if (handle->timeout <= loop->time) + return 0; + + diff = handle->timeout - loop->time; + if (diff > INT_MAX) + diff = INT_MAX; + + return diff; +} + + +void uv__run_timers(uv_loop_t* loop) { + struct heap_node* heap_node; + uv_timer_t* handle; + + for (;;) { + heap_node = heap_min((struct heap*) &loop->timer_heap); + if (heap_node == NULL) + break; + + handle = container_of(heap_node, uv_timer_t, heap_node); + if (handle->timeout > loop->time) + break; + + uv_timer_stop(handle); + uv_timer_again(handle); + handle->timer_cb(handle); + } +} + + +void uv__timer_close(uv_timer_t* handle) { + uv_timer_stop(handle); +} diff --git a/3rdparty/libuv/src/unix/tty.c b/3rdparty/libuv/src/unix/tty.c new file mode 100644 index 00000000000..7cc5b714ed3 --- /dev/null +++ b/3rdparty/libuv/src/unix/tty.c @@ -0,0 +1,279 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" +#include "spinlock.h" + +#include +#include +#include +#include +#include + +static int orig_termios_fd = -1; +static struct termios orig_termios; +static uv_spinlock_t termios_spinlock = UV_SPINLOCK_INITIALIZER; + + +int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) { + uv_handle_type type; + int flags; + int newfd; + int r; + + /* File descriptors that refer to files cannot be monitored with epoll. + * That restriction also applies to character devices like /dev/random + * (but obviously not /dev/tty.) + */ + type = uv_guess_handle(fd); + if (type == UV_FILE || type == UV_UNKNOWN_HANDLE) + return -EINVAL; + + flags = 0; + newfd = -1; + + /* Reopen the file descriptor when it refers to a tty. This lets us put the + * tty in non-blocking mode without affecting other processes that share it + * with us. + * + * Example: `node | cat` - if we put our fd 0 in non-blocking mode, it also + * affects fd 1 of `cat` because both file descriptors refer to the same + * struct file in the kernel. When we reopen our fd 0, it points to a + * different struct file, hence changing its properties doesn't affect + * other processes. + */ + if (type == UV_TTY) { + r = uv__open_cloexec("/dev/tty", O_RDWR); + + if (r < 0) { + /* fallback to using blocking writes */ + if (!readable) + flags |= UV_STREAM_BLOCKING; + goto skip; + } + + newfd = r; + + r = uv__dup2_cloexec(newfd, fd); + if (r < 0 && r != -EINVAL) { + /* EINVAL means newfd == fd which could conceivably happen if another + * thread called close(fd) between our calls to isatty() and open(). + * That's a rather unlikely event but let's handle it anyway. + */ + uv__close(newfd); + return r; + } + + fd = newfd; + } + +skip: + uv__stream_init(loop, (uv_stream_t*) tty, UV_TTY); + + /* If anything fails beyond this point we need to remove the handle from + * the handle queue, since it was added by uv__handle_init in uv_stream_init. + */ + +#if defined(__APPLE__) + r = uv__stream_try_select((uv_stream_t*) tty, &fd); + if (r) { + if (newfd != -1) + uv__close(newfd); + QUEUE_REMOVE(&tty->handle_queue); + return r; + } +#endif + + if (readable) + flags |= UV_STREAM_READABLE; + else + flags |= UV_STREAM_WRITABLE; + + if (!(flags & UV_STREAM_BLOCKING)) + uv__nonblock(fd, 1); + + uv__stream_open((uv_stream_t*) tty, fd, flags); + tty->mode = UV_TTY_MODE_NORMAL; + + return 0; +} + +static void uv__tty_make_raw(struct termios* tio) { + assert(tio != NULL); + +#ifdef __sun + /* + * This implementation of cfmakeraw for Solaris and derivatives is taken from + * http://www.perkin.org.uk/posts/solaris-portability-cfmakeraw.html. + */ + tio->c_iflag &= ~(IMAXBEL | IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | + IGNCR | ICRNL | IXON); + tio->c_oflag &= ~OPOST; + tio->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + tio->c_cflag &= ~(CSIZE | PARENB); + tio->c_cflag |= CS8; +#else + cfmakeraw(tio); +#endif /* #ifdef __sun */ +} + +int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { + struct termios tmp; + int fd; + + if (tty->mode == (int) mode) + return 0; + + fd = uv__stream_fd(tty); + if (tty->mode == UV_TTY_MODE_NORMAL && mode != UV_TTY_MODE_NORMAL) { + if (tcgetattr(fd, &tty->orig_termios)) + return -errno; + + /* This is used for uv_tty_reset_mode() */ + uv_spinlock_lock(&termios_spinlock); + if (orig_termios_fd == -1) { + orig_termios = tty->orig_termios; + orig_termios_fd = fd; + } + uv_spinlock_unlock(&termios_spinlock); + } + + tmp = tty->orig_termios; + switch (mode) { + case UV_TTY_MODE_NORMAL: + break; + case UV_TTY_MODE_RAW: + tmp.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); + tmp.c_oflag |= (ONLCR); + tmp.c_cflag |= (CS8); + tmp.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); + tmp.c_cc[VMIN] = 1; + tmp.c_cc[VTIME] = 0; + break; + case UV_TTY_MODE_IO: + uv__tty_make_raw(&tmp); + break; + } + + /* Apply changes after draining */ + if (tcsetattr(fd, TCSADRAIN, &tmp)) + return -errno; + + tty->mode = mode; + return 0; +} + + +int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) { + struct winsize ws; + + if (ioctl(uv__stream_fd(tty), TIOCGWINSZ, &ws)) + return -errno; + + *width = ws.ws_col; + *height = ws.ws_row; + + return 0; +} + + +uv_handle_type uv_guess_handle(uv_file file) { + struct sockaddr sa; + struct stat s; + socklen_t len; + int type; + + if (file < 0) + return UV_UNKNOWN_HANDLE; + + if (isatty(file)) + return UV_TTY; + + if (fstat(file, &s)) + return UV_UNKNOWN_HANDLE; + + if (S_ISREG(s.st_mode)) + return UV_FILE; + + if (S_ISCHR(s.st_mode)) + return UV_FILE; /* XXX UV_NAMED_PIPE? */ + + if (S_ISFIFO(s.st_mode)) + return UV_NAMED_PIPE; + + if (!S_ISSOCK(s.st_mode)) + return UV_UNKNOWN_HANDLE; + + len = sizeof(type); + if (getsockopt(file, SOL_SOCKET, SO_TYPE, &type, &len)) + return UV_UNKNOWN_HANDLE; + + len = sizeof(sa); + if (getsockname(file, &sa, &len)) + return UV_UNKNOWN_HANDLE; + + if (type == SOCK_DGRAM) + if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6) + return UV_UDP; + + if (type == SOCK_STREAM) { +#if defined(_AIX) + /* on AIX the getsockname call returns an empty sa structure + * for sockets of type AF_UNIX. For all other types it will + * return a properly filled in structure. + */ + if (len == 0) + return UV_NAMED_PIPE; +#endif /* defined(_AIX) */ + + if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6) + return UV_TCP; + if (sa.sa_family == AF_UNIX) + return UV_NAMED_PIPE; + } + + return UV_UNKNOWN_HANDLE; +} + + +/* This function is async signal-safe, meaning that it's safe to call from + * inside a signal handler _unless_ execution was inside uv_tty_set_mode()'s + * critical section when the signal was raised. + */ +int uv_tty_reset_mode(void) { + int saved_errno; + int err; + + saved_errno = errno; + if (!uv_spinlock_trylock(&termios_spinlock)) + return -EBUSY; /* In uv_tty_set_mode(). */ + + err = 0; + if (orig_termios_fd != -1) + if (tcsetattr(orig_termios_fd, TCSANOW, &orig_termios)) + err = -errno; + + uv_spinlock_unlock(&termios_spinlock); + errno = saved_errno; + + return err; +} diff --git a/3rdparty/libuv/src/unix/udp.c b/3rdparty/libuv/src/unix/udp.c new file mode 100644 index 00000000000..39ade8de338 --- /dev/null +++ b/3rdparty/libuv/src/unix/udp.c @@ -0,0 +1,873 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include + +#if defined(IPV6_JOIN_GROUP) && !defined(IPV6_ADD_MEMBERSHIP) +# define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP +#endif + +#if defined(IPV6_LEAVE_GROUP) && !defined(IPV6_DROP_MEMBERSHIP) +# define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP +#endif + + +static void uv__udp_run_completed(uv_udp_t* handle); +static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents); +static void uv__udp_recvmsg(uv_udp_t* handle); +static void uv__udp_sendmsg(uv_udp_t* handle); +static int uv__udp_maybe_deferred_bind(uv_udp_t* handle, + int domain, + unsigned int flags); + + +void uv__udp_close(uv_udp_t* handle) { + uv__io_close(handle->loop, &handle->io_watcher); + uv__handle_stop(handle); + + if (handle->io_watcher.fd != -1) { + uv__close(handle->io_watcher.fd); + handle->io_watcher.fd = -1; + } +} + + +void uv__udp_finish_close(uv_udp_t* handle) { + uv_udp_send_t* req; + QUEUE* q; + + assert(!uv__io_active(&handle->io_watcher, UV__POLLIN | UV__POLLOUT)); + assert(handle->io_watcher.fd == -1); + + while (!QUEUE_EMPTY(&handle->write_queue)) { + q = QUEUE_HEAD(&handle->write_queue); + QUEUE_REMOVE(q); + + req = QUEUE_DATA(q, uv_udp_send_t, queue); + req->status = -ECANCELED; + QUEUE_INSERT_TAIL(&handle->write_completed_queue, &req->queue); + } + + uv__udp_run_completed(handle); + + assert(handle->send_queue_size == 0); + assert(handle->send_queue_count == 0); + + /* Now tear down the handle. */ + handle->recv_cb = NULL; + handle->alloc_cb = NULL; + /* but _do not_ touch close_cb */ +} + + +static void uv__udp_run_completed(uv_udp_t* handle) { + uv_udp_send_t* req; + QUEUE* q; + + assert(!(handle->flags & UV_UDP_PROCESSING)); + handle->flags |= UV_UDP_PROCESSING; + + while (!QUEUE_EMPTY(&handle->write_completed_queue)) { + q = QUEUE_HEAD(&handle->write_completed_queue); + QUEUE_REMOVE(q); + + req = QUEUE_DATA(q, uv_udp_send_t, queue); + uv__req_unregister(handle->loop, req); + + handle->send_queue_size -= uv__count_bufs(req->bufs, req->nbufs); + handle->send_queue_count--; + + if (req->bufs != req->bufsml) + uv__free(req->bufs); + req->bufs = NULL; + + if (req->send_cb == NULL) + continue; + + /* req->status >= 0 == bytes written + * req->status < 0 == errno + */ + if (req->status >= 0) + req->send_cb(req, 0); + else + req->send_cb(req, req->status); + } + + if (QUEUE_EMPTY(&handle->write_queue)) { + /* Pending queue and completion queue empty, stop watcher. */ + uv__io_stop(handle->loop, &handle->io_watcher, UV__POLLOUT); + if (!uv__io_active(&handle->io_watcher, UV__POLLIN)) + uv__handle_stop(handle); + } + + handle->flags &= ~UV_UDP_PROCESSING; +} + + +static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents) { + uv_udp_t* handle; + + handle = container_of(w, uv_udp_t, io_watcher); + assert(handle->type == UV_UDP); + + if (revents & UV__POLLIN) + uv__udp_recvmsg(handle); + + if (revents & UV__POLLOUT) { + uv__udp_sendmsg(handle); + uv__udp_run_completed(handle); + } +} + + +static void uv__udp_recvmsg(uv_udp_t* handle) { + struct sockaddr_storage peer; + struct msghdr h; + ssize_t nread; + uv_buf_t buf; + int flags; + int count; + + assert(handle->recv_cb != NULL); + assert(handle->alloc_cb != NULL); + + /* Prevent loop starvation when the data comes in as fast as (or faster than) + * we can read it. XXX Need to rearm fd if we switch to edge-triggered I/O. + */ + count = 32; + + memset(&h, 0, sizeof(h)); + h.msg_name = &peer; + + do { + handle->alloc_cb((uv_handle_t*) handle, 64 * 1024, &buf); + if (buf.len == 0) { + handle->recv_cb(handle, UV_ENOBUFS, &buf, NULL, 0); + return; + } + assert(buf.base != NULL); + + h.msg_namelen = sizeof(peer); + h.msg_iov = (void*) &buf; + h.msg_iovlen = 1; + + do { + nread = recvmsg(handle->io_watcher.fd, &h, 0); + } + while (nread == -1 && errno == EINTR); + + if (nread == -1) { + if (errno == EAGAIN || errno == EWOULDBLOCK) + handle->recv_cb(handle, 0, &buf, NULL, 0); + else + handle->recv_cb(handle, -errno, &buf, NULL, 0); + } + else { + const struct sockaddr *addr; + if (h.msg_namelen == 0) + addr = NULL; + else + addr = (const struct sockaddr*) &peer; + + flags = 0; + if (h.msg_flags & MSG_TRUNC) + flags |= UV_UDP_PARTIAL; + + handle->recv_cb(handle, nread, &buf, addr, flags); + } + } + /* recv_cb callback may decide to pause or close the handle */ + while (nread != -1 + && count-- > 0 + && handle->io_watcher.fd != -1 + && handle->recv_cb != NULL); +} + + +static void uv__udp_sendmsg(uv_udp_t* handle) { + uv_udp_send_t* req; + QUEUE* q; + struct msghdr h; + ssize_t size; + + while (!QUEUE_EMPTY(&handle->write_queue)) { + q = QUEUE_HEAD(&handle->write_queue); + assert(q != NULL); + + req = QUEUE_DATA(q, uv_udp_send_t, queue); + assert(req != NULL); + + memset(&h, 0, sizeof h); + h.msg_name = &req->addr; + h.msg_namelen = (req->addr.ss_family == AF_INET6 ? + sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)); + h.msg_iov = (struct iovec*) req->bufs; + h.msg_iovlen = req->nbufs; + + do { + size = sendmsg(handle->io_watcher.fd, &h, 0); + } while (size == -1 && errno == EINTR); + + if (size == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) + break; + + req->status = (size == -1 ? -errno : size); + + /* Sending a datagram is an atomic operation: either all data + * is written or nothing is (and EMSGSIZE is raised). That is + * why we don't handle partial writes. Just pop the request + * off the write queue and onto the completed queue, done. + */ + QUEUE_REMOVE(&req->queue); + QUEUE_INSERT_TAIL(&handle->write_completed_queue, &req->queue); + uv__io_feed(handle->loop, &handle->io_watcher); + } +} + + +/* On the BSDs, SO_REUSEPORT implies SO_REUSEADDR but with some additional + * refinements for programs that use multicast. + * + * Linux as of 3.9 has a SO_REUSEPORT socket option but with semantics that + * are different from the BSDs: it _shares_ the port rather than steal it + * from the current listener. While useful, it's not something we can emulate + * on other platforms so we don't enable it. + */ +static int uv__set_reuse(int fd) { + int yes; + +#if defined(SO_REUSEPORT) && !defined(__linux__) + yes = 1; + if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes))) + return -errno; +#else + yes = 1; + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes))) + return -errno; +#endif + + return 0; +} + + +int uv__udp_bind(uv_udp_t* handle, + const struct sockaddr* addr, + unsigned int addrlen, + unsigned int flags) { + int err; + int yes; + int fd; + + /* Check for bad flags. */ + if (flags & ~(UV_UDP_IPV6ONLY | UV_UDP_REUSEADDR)) + return -EINVAL; + + /* Cannot set IPv6-only mode on non-IPv6 socket. */ + if ((flags & UV_UDP_IPV6ONLY) && addr->sa_family != AF_INET6) + return -EINVAL; + + fd = handle->io_watcher.fd; + if (fd == -1) { + err = uv__socket(addr->sa_family, SOCK_DGRAM, 0); + if (err < 0) + return err; + fd = err; + handle->io_watcher.fd = fd; + } + + if (flags & UV_UDP_REUSEADDR) { + err = uv__set_reuse(fd); + if (err) + goto out; + } + + if (flags & UV_UDP_IPV6ONLY) { +#ifdef IPV6_V6ONLY + yes = 1; + if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof yes) == -1) { + err = -errno; + goto out; + } +#else + err = -ENOTSUP; + goto out; +#endif + } + + if (bind(fd, addr, addrlen)) { + err = -errno; + if (errno == EAFNOSUPPORT) + /* OSX, other BSDs and SunoS fail with EAFNOSUPPORT when binding a + * socket created with AF_INET to an AF_INET6 address or vice versa. */ + err = -EINVAL; + goto out; + } + + if (addr->sa_family == AF_INET6) + handle->flags |= UV_HANDLE_IPV6; + + return 0; + +out: + uv__close(handle->io_watcher.fd); + handle->io_watcher.fd = -1; + return err; +} + + +static int uv__udp_maybe_deferred_bind(uv_udp_t* handle, + int domain, + unsigned int flags) { + unsigned char taddr[sizeof(struct sockaddr_in6)]; + socklen_t addrlen; + + if (handle->io_watcher.fd != -1) + return 0; + + switch (domain) { + case AF_INET: + { + struct sockaddr_in* addr = (void*)&taddr; + memset(addr, 0, sizeof *addr); + addr->sin_family = AF_INET; + addr->sin_addr.s_addr = INADDR_ANY; + addrlen = sizeof *addr; + break; + } + case AF_INET6: + { + struct sockaddr_in6* addr = (void*)&taddr; + memset(addr, 0, sizeof *addr); + addr->sin6_family = AF_INET6; + addr->sin6_addr = in6addr_any; + addrlen = sizeof *addr; + break; + } + default: + assert(0 && "unsupported address family"); + abort(); + } + + return uv__udp_bind(handle, (const struct sockaddr*) &taddr, addrlen, flags); +} + + +int uv__udp_send(uv_udp_send_t* req, + uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + unsigned int addrlen, + uv_udp_send_cb send_cb) { + int err; + int empty_queue; + + assert(nbufs > 0); + + err = uv__udp_maybe_deferred_bind(handle, addr->sa_family, 0); + if (err) + return err; + + /* It's legal for send_queue_count > 0 even when the write_queue is empty; + * it means there are error-state requests in the write_completed_queue that + * will touch up send_queue_size/count later. + */ + empty_queue = (handle->send_queue_count == 0); + + uv__req_init(handle->loop, req, UV_UDP_SEND); + assert(addrlen <= sizeof(req->addr)); + memcpy(&req->addr, addr, addrlen); + req->send_cb = send_cb; + req->handle = handle; + req->nbufs = nbufs; + + req->bufs = req->bufsml; + if (nbufs > ARRAY_SIZE(req->bufsml)) + req->bufs = uv__malloc(nbufs * sizeof(bufs[0])); + + if (req->bufs == NULL) { + uv__req_unregister(handle->loop, req); + return -ENOMEM; + } + + memcpy(req->bufs, bufs, nbufs * sizeof(bufs[0])); + handle->send_queue_size += uv__count_bufs(req->bufs, req->nbufs); + handle->send_queue_count++; + QUEUE_INSERT_TAIL(&handle->write_queue, &req->queue); + uv__handle_start(handle); + + if (empty_queue && !(handle->flags & UV_UDP_PROCESSING)) { + uv__udp_sendmsg(handle); + } else { + uv__io_start(handle->loop, &handle->io_watcher, UV__POLLOUT); + } + + return 0; +} + + +int uv__udp_try_send(uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + unsigned int addrlen) { + int err; + struct msghdr h; + ssize_t size; + + assert(nbufs > 0); + + /* already sending a message */ + if (handle->send_queue_count != 0) + return -EAGAIN; + + err = uv__udp_maybe_deferred_bind(handle, addr->sa_family, 0); + if (err) + return err; + + memset(&h, 0, sizeof h); + h.msg_name = (struct sockaddr*) addr; + h.msg_namelen = addrlen; + h.msg_iov = (struct iovec*) bufs; + h.msg_iovlen = nbufs; + + do { + size = sendmsg(handle->io_watcher.fd, &h, 0); + } while (size == -1 && errno == EINTR); + + if (size == -1) { + if (errno == EAGAIN || errno == EWOULDBLOCK) + return -EAGAIN; + else + return -errno; + } + + return size; +} + + +static int uv__udp_set_membership4(uv_udp_t* handle, + const struct sockaddr_in* multicast_addr, + const char* interface_addr, + uv_membership membership) { + struct ip_mreq mreq; + int optname; + int err; + + memset(&mreq, 0, sizeof mreq); + + if (interface_addr) { + err = uv_inet_pton(AF_INET, interface_addr, &mreq.imr_interface.s_addr); + if (err) + return err; + } else { + mreq.imr_interface.s_addr = htonl(INADDR_ANY); + } + + mreq.imr_multiaddr.s_addr = multicast_addr->sin_addr.s_addr; + + switch (membership) { + case UV_JOIN_GROUP: + optname = IP_ADD_MEMBERSHIP; + break; + case UV_LEAVE_GROUP: + optname = IP_DROP_MEMBERSHIP; + break; + default: + return -EINVAL; + } + + if (setsockopt(handle->io_watcher.fd, + IPPROTO_IP, + optname, + &mreq, + sizeof(mreq))) { + return -errno; + } + + return 0; +} + + +static int uv__udp_set_membership6(uv_udp_t* handle, + const struct sockaddr_in6* multicast_addr, + const char* interface_addr, + uv_membership membership) { + int optname; + struct ipv6_mreq mreq; + struct sockaddr_in6 addr6; + + memset(&mreq, 0, sizeof mreq); + + if (interface_addr) { + if (uv_ip6_addr(interface_addr, 0, &addr6)) + return -EINVAL; + mreq.ipv6mr_interface = addr6.sin6_scope_id; + } else { + mreq.ipv6mr_interface = 0; + } + + mreq.ipv6mr_multiaddr = multicast_addr->sin6_addr; + + switch (membership) { + case UV_JOIN_GROUP: + optname = IPV6_ADD_MEMBERSHIP; + break; + case UV_LEAVE_GROUP: + optname = IPV6_DROP_MEMBERSHIP; + break; + default: + return -EINVAL; + } + + if (setsockopt(handle->io_watcher.fd, + IPPROTO_IPV6, + optname, + &mreq, + sizeof(mreq))) { + return -errno; + } + + return 0; +} + + +int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) { + int domain; + int err; + int fd; + + /* Use the lower 8 bits for the domain */ + domain = flags & 0xFF; + if (domain != AF_INET && domain != AF_INET6 && domain != AF_UNSPEC) + return -EINVAL; + + if (flags & ~0xFF) + return -EINVAL; + + if (domain != AF_UNSPEC) { + err = uv__socket(domain, SOCK_DGRAM, 0); + if (err < 0) + return err; + fd = err; + } else { + fd = -1; + } + + uv__handle_init(loop, (uv_handle_t*)handle, UV_UDP); + handle->alloc_cb = NULL; + handle->recv_cb = NULL; + handle->send_queue_size = 0; + handle->send_queue_count = 0; + uv__io_init(&handle->io_watcher, uv__udp_io, fd); + QUEUE_INIT(&handle->write_queue); + QUEUE_INIT(&handle->write_completed_queue); + return 0; +} + + +int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) { + return uv_udp_init_ex(loop, handle, AF_UNSPEC); +} + + +int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) { + int err; + + /* Check for already active socket. */ + if (handle->io_watcher.fd != -1) + return -EBUSY; + + err = uv__nonblock(sock, 1); + if (err) + return err; + + err = uv__set_reuse(sock); + if (err) + return err; + + handle->io_watcher.fd = sock; + return 0; +} + + +int uv_udp_set_membership(uv_udp_t* handle, + const char* multicast_addr, + const char* interface_addr, + uv_membership membership) { + int err; + struct sockaddr_in addr4; + struct sockaddr_in6 addr6; + + if (uv_ip4_addr(multicast_addr, 0, &addr4) == 0) { + err = uv__udp_maybe_deferred_bind(handle, AF_INET, UV_UDP_REUSEADDR); + if (err) + return err; + return uv__udp_set_membership4(handle, &addr4, interface_addr, membership); + } else if (uv_ip6_addr(multicast_addr, 0, &addr6) == 0) { + err = uv__udp_maybe_deferred_bind(handle, AF_INET6, UV_UDP_REUSEADDR); + if (err) + return err; + return uv__udp_set_membership6(handle, &addr6, interface_addr, membership); + } else { + return -EINVAL; + } +} + +static int uv__setsockopt(uv_udp_t* handle, + int option4, + int option6, + const void* val, + size_t size) { + int r; + + if (handle->flags & UV_HANDLE_IPV6) + r = setsockopt(handle->io_watcher.fd, + IPPROTO_IPV6, + option6, + val, + size); + else + r = setsockopt(handle->io_watcher.fd, + IPPROTO_IP, + option4, + val, + size); + if (r) + return -errno; + + return 0; +} + +static int uv__setsockopt_maybe_char(uv_udp_t* handle, + int option4, + int option6, + int val) { +#if defined(__sun) || defined(_AIX) + char arg = val; +#elif defined(__OpenBSD__) + unsigned char arg = val; +#else + int arg = val; +#endif + + if (val < 0 || val > 255) + return -EINVAL; + + return uv__setsockopt(handle, option4, option6, &arg, sizeof(arg)); +} + + +int uv_udp_set_broadcast(uv_udp_t* handle, int on) { + if (setsockopt(handle->io_watcher.fd, + SOL_SOCKET, + SO_BROADCAST, + &on, + sizeof(on))) { + return -errno; + } + + return 0; +} + + +int uv_udp_set_ttl(uv_udp_t* handle, int ttl) { + if (ttl < 1 || ttl > 255) + return -EINVAL; + +/* + * On Solaris and derivatives such as SmartOS, the length of socket options + * is sizeof(int) for IP_TTL and IPV6_UNICAST_HOPS, + * so hardcode the size of these options on this platform, + * and use the general uv__setsockopt_maybe_char call on other platforms. + */ +#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) + return uv__setsockopt(handle, + IP_TTL, + IPV6_UNICAST_HOPS, + &ttl, + sizeof(ttl)); +#endif /* defined(__sun) || defined(_AIX) || defined (__OpenBSD__) */ + + return uv__setsockopt_maybe_char(handle, + IP_TTL, + IPV6_UNICAST_HOPS, + ttl); +} + + +int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) { +/* + * On Solaris and derivatives such as SmartOS, the length of socket options + * is sizeof(int) for IPV6_MULTICAST_HOPS and sizeof(char) for + * IP_MULTICAST_TTL, so hardcode the size of the option in the IPv6 case, + * and use the general uv__setsockopt_maybe_char call otherwise. + */ +#if defined(__sun) || defined(_AIX) + if (handle->flags & UV_HANDLE_IPV6) + return uv__setsockopt(handle, + IP_MULTICAST_TTL, + IPV6_MULTICAST_HOPS, + &ttl, + sizeof(ttl)); +#endif /* defined(__sun) || defined(_AIX) */ + + return uv__setsockopt_maybe_char(handle, + IP_MULTICAST_TTL, + IPV6_MULTICAST_HOPS, + ttl); +} + + +int uv_udp_set_multicast_loop(uv_udp_t* handle, int on) { +/* + * On Solaris and derivatives such as SmartOS, the length of socket options + * is sizeof(int) for IPV6_MULTICAST_LOOP and sizeof(char) for + * IP_MULTICAST_LOOP, so hardcode the size of the option in the IPv6 case, + * and use the general uv__setsockopt_maybe_char call otherwise. + */ +#if defined(__sun) || defined(_AIX) + if (handle->flags & UV_HANDLE_IPV6) + return uv__setsockopt(handle, + IP_MULTICAST_LOOP, + IPV6_MULTICAST_LOOP, + &on, + sizeof(on)); +#endif /* defined(__sun) || defined(_AIX) */ + + return uv__setsockopt_maybe_char(handle, + IP_MULTICAST_LOOP, + IPV6_MULTICAST_LOOP, + on); +} + +int uv_udp_set_multicast_interface(uv_udp_t* handle, const char* interface_addr) { + struct sockaddr_storage addr_st; + struct sockaddr_in* addr4; + struct sockaddr_in6* addr6; + + addr4 = (struct sockaddr_in*) &addr_st; + addr6 = (struct sockaddr_in6*) &addr_st; + + if (!interface_addr) { + memset(&addr_st, 0, sizeof addr_st); + if (handle->flags & UV_HANDLE_IPV6) { + addr_st.ss_family = AF_INET6; + addr6->sin6_scope_id = 0; + } else { + addr_st.ss_family = AF_INET; + addr4->sin_addr.s_addr = htonl(INADDR_ANY); + } + } else if (uv_ip4_addr(interface_addr, 0, addr4) == 0) { + /* nothing, address was parsed */ + } else if (uv_ip6_addr(interface_addr, 0, addr6) == 0) { + /* nothing, address was parsed */ + } else { + return -EINVAL; + } + + if (addr_st.ss_family == AF_INET) { + if (setsockopt(handle->io_watcher.fd, + IPPROTO_IP, + IP_MULTICAST_IF, + (void*) &addr4->sin_addr, + sizeof(addr4->sin_addr)) == -1) { + return -errno; + } + } else if (addr_st.ss_family == AF_INET6) { + if (setsockopt(handle->io_watcher.fd, + IPPROTO_IPV6, + IPV6_MULTICAST_IF, + &addr6->sin6_scope_id, + sizeof(addr6->sin6_scope_id)) == -1) { + return -errno; + } + } else { + assert(0 && "unexpected address family"); + abort(); + } + + return 0; +} + + +int uv_udp_getsockname(const uv_udp_t* handle, + struct sockaddr* name, + int* namelen) { + socklen_t socklen; + + if (handle->io_watcher.fd == -1) + return -EINVAL; /* FIXME(bnoordhuis) -EBADF */ + + /* sizeof(socklen_t) != sizeof(int) on some systems. */ + socklen = (socklen_t) *namelen; + + if (getsockname(handle->io_watcher.fd, name, &socklen)) + return -errno; + + *namelen = (int) socklen; + return 0; +} + + +int uv__udp_recv_start(uv_udp_t* handle, + uv_alloc_cb alloc_cb, + uv_udp_recv_cb recv_cb) { + int err; + + if (alloc_cb == NULL || recv_cb == NULL) + return -EINVAL; + + if (uv__io_active(&handle->io_watcher, UV__POLLIN)) + return -EALREADY; /* FIXME(bnoordhuis) Should be -EBUSY. */ + + err = uv__udp_maybe_deferred_bind(handle, AF_INET, 0); + if (err) + return err; + + handle->alloc_cb = alloc_cb; + handle->recv_cb = recv_cb; + + uv__io_start(handle->loop, &handle->io_watcher, UV__POLLIN); + uv__handle_start(handle); + + return 0; +} + + +int uv__udp_recv_stop(uv_udp_t* handle) { + uv__io_stop(handle->loop, &handle->io_watcher, UV__POLLIN); + + if (!uv__io_active(&handle->io_watcher, UV__POLLOUT)) + uv__handle_stop(handle); + + handle->alloc_cb = NULL; + handle->recv_cb = NULL; + + return 0; +} diff --git a/3rdparty/libuv/src/uv-common.c b/3rdparty/libuv/src/uv-common.c new file mode 100644 index 00000000000..40ed28fec5a --- /dev/null +++ b/3rdparty/libuv/src/uv-common.c @@ -0,0 +1,627 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "uv-common.h" + +#include +#include +#include +#include /* NULL */ +#include /* malloc */ +#include /* memset */ + +#if defined(_WIN32) +# include /* malloc */ +#else +# include /* if_nametoindex */ +#endif + + +typedef struct { + uv_malloc_func local_malloc; + uv_realloc_func local_realloc; + uv_calloc_func local_calloc; + uv_free_func local_free; +} uv__allocator_t; + +static uv__allocator_t uv__allocator = { + malloc, + realloc, + calloc, + free, +}; + +char* uv__strdup(const char* s) { + size_t len = strlen(s) + 1; + char* m = uv__malloc(len); + if (m == NULL) + return NULL; + return memcpy(m, s, len); +} + +char* uv__strndup(const char* s, size_t n) { + char* m; + size_t len = strlen(s); + if (n < len) + len = n; + m = uv__malloc(len + 1); + if (m == NULL) + return NULL; + m[len] = '\0'; + return memcpy(m, s, len); +} + +void* uv__malloc(size_t size) { + return uv__allocator.local_malloc(size); +} + +void uv__free(void* ptr) { + uv__allocator.local_free(ptr); +} + +void* uv__calloc(size_t count, size_t size) { + return uv__allocator.local_calloc(count, size); +} + +void* uv__realloc(void* ptr, size_t size) { + return uv__allocator.local_realloc(ptr, size); +} + +int uv_replace_allocator(uv_malloc_func malloc_func, + uv_realloc_func realloc_func, + uv_calloc_func calloc_func, + uv_free_func free_func) { + if (malloc_func == NULL || realloc_func == NULL || + calloc_func == NULL || free_func == NULL) { + return UV_EINVAL; + } + + uv__allocator.local_malloc = malloc_func; + uv__allocator.local_realloc = realloc_func; + uv__allocator.local_calloc = calloc_func; + uv__allocator.local_free = free_func; + + return 0; +} + +#define XX(uc, lc) case UV_##uc: return sizeof(uv_##lc##_t); + +size_t uv_handle_size(uv_handle_type type) { + switch (type) { + UV_HANDLE_TYPE_MAP(XX) + default: + return -1; + } +} + +size_t uv_req_size(uv_req_type type) { + switch(type) { + UV_REQ_TYPE_MAP(XX) + default: + return -1; + } +} + +#undef XX + + +size_t uv_loop_size(void) { + return sizeof(uv_loop_t); +} + + +uv_buf_t uv_buf_init(char* base, unsigned int len) { + uv_buf_t buf; + buf.base = base; + buf.len = len; + return buf; +} + + +static const char* uv__unknown_err_code(int err) { + char buf[32]; + char* copy; + + snprintf(buf, sizeof(buf), "Unknown system error %d", err); + copy = uv__strdup(buf); + + return copy != NULL ? copy : "Unknown system error"; +} + + +#define UV_ERR_NAME_GEN(name, _) case UV_ ## name: return #name; +const char* uv_err_name(int err) { + switch (err) { + UV_ERRNO_MAP(UV_ERR_NAME_GEN) + } + return uv__unknown_err_code(err); +} +#undef UV_ERR_NAME_GEN + + +#define UV_STRERROR_GEN(name, msg) case UV_ ## name: return msg; +const char* uv_strerror(int err) { + switch (err) { + UV_ERRNO_MAP(UV_STRERROR_GEN) + } + return uv__unknown_err_code(err); +} +#undef UV_STRERROR_GEN + + +int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr) { + memset(addr, 0, sizeof(*addr)); + addr->sin_family = AF_INET; + addr->sin_port = htons(port); + return uv_inet_pton(AF_INET, ip, &(addr->sin_addr.s_addr)); +} + + +int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr) { + char address_part[40]; + size_t address_part_size; + const char* zone_index; + + memset(addr, 0, sizeof(*addr)); + addr->sin6_family = AF_INET6; + addr->sin6_port = htons(port); + + zone_index = strchr(ip, '%'); + if (zone_index != NULL) { + address_part_size = zone_index - ip; + if (address_part_size >= sizeof(address_part)) + address_part_size = sizeof(address_part) - 1; + + memcpy(address_part, ip, address_part_size); + address_part[address_part_size] = '\0'; + ip = address_part; + + zone_index++; /* skip '%' */ + /* NOTE: unknown interface (id=0) is silently ignored */ +#ifdef _WIN32 + addr->sin6_scope_id = atoi(zone_index); +#else + addr->sin6_scope_id = if_nametoindex(zone_index); +#endif + } + + return uv_inet_pton(AF_INET6, ip, &addr->sin6_addr); +} + + +int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size) { + return uv_inet_ntop(AF_INET, &src->sin_addr, dst, size); +} + + +int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size) { + return uv_inet_ntop(AF_INET6, &src->sin6_addr, dst, size); +} + + +int uv_tcp_bind(uv_tcp_t* handle, + const struct sockaddr* addr, + unsigned int flags) { + unsigned int addrlen; + + if (handle->type != UV_TCP) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) + addrlen = sizeof(struct sockaddr_in); + else if (addr->sa_family == AF_INET6) + addrlen = sizeof(struct sockaddr_in6); + else + return UV_EINVAL; + + return uv__tcp_bind(handle, addr, addrlen, flags); +} + + +int uv_udp_bind(uv_udp_t* handle, + const struct sockaddr* addr, + unsigned int flags) { + unsigned int addrlen; + + if (handle->type != UV_UDP) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) + addrlen = sizeof(struct sockaddr_in); + else if (addr->sa_family == AF_INET6) + addrlen = sizeof(struct sockaddr_in6); + else + return UV_EINVAL; + + return uv__udp_bind(handle, addr, addrlen, flags); +} + + +int uv_tcp_connect(uv_connect_t* req, + uv_tcp_t* handle, + const struct sockaddr* addr, + uv_connect_cb cb) { + unsigned int addrlen; + + if (handle->type != UV_TCP) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) + addrlen = sizeof(struct sockaddr_in); + else if (addr->sa_family == AF_INET6) + addrlen = sizeof(struct sockaddr_in6); + else + return UV_EINVAL; + + return uv__tcp_connect(req, handle, addr, addrlen, cb); +} + + +int uv_udp_send(uv_udp_send_t* req, + uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + uv_udp_send_cb send_cb) { + unsigned int addrlen; + + if (handle->type != UV_UDP) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) + addrlen = sizeof(struct sockaddr_in); + else if (addr->sa_family == AF_INET6) + addrlen = sizeof(struct sockaddr_in6); + else + return UV_EINVAL; + + return uv__udp_send(req, handle, bufs, nbufs, addr, addrlen, send_cb); +} + + +int uv_udp_try_send(uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr) { + unsigned int addrlen; + + if (handle->type != UV_UDP) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) + addrlen = sizeof(struct sockaddr_in); + else if (addr->sa_family == AF_INET6) + addrlen = sizeof(struct sockaddr_in6); + else + return UV_EINVAL; + + return uv__udp_try_send(handle, bufs, nbufs, addr, addrlen); +} + + +int uv_udp_recv_start(uv_udp_t* handle, + uv_alloc_cb alloc_cb, + uv_udp_recv_cb recv_cb) { + if (handle->type != UV_UDP || alloc_cb == NULL || recv_cb == NULL) + return UV_EINVAL; + else + return uv__udp_recv_start(handle, alloc_cb, recv_cb); +} + + +int uv_udp_recv_stop(uv_udp_t* handle) { + if (handle->type != UV_UDP) + return UV_EINVAL; + else + return uv__udp_recv_stop(handle); +} + + +void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) { + QUEUE queue; + QUEUE* q; + uv_handle_t* h; + + QUEUE_MOVE(&loop->handle_queue, &queue); + while (!QUEUE_EMPTY(&queue)) { + q = QUEUE_HEAD(&queue); + h = QUEUE_DATA(q, uv_handle_t, handle_queue); + + QUEUE_REMOVE(q); + QUEUE_INSERT_TAIL(&loop->handle_queue, q); + + if (h->flags & UV__HANDLE_INTERNAL) continue; + walk_cb(h, arg); + } +} + + +static void uv__print_handles(uv_loop_t* loop, int only_active, FILE* stream) { + const char* type; + QUEUE* q; + uv_handle_t* h; + + if (loop == NULL) + loop = uv_default_loop(); + + QUEUE_FOREACH(q, &loop->handle_queue) { + h = QUEUE_DATA(q, uv_handle_t, handle_queue); + + if (only_active && !uv__is_active(h)) + continue; + + switch (h->type) { +#define X(uc, lc) case UV_##uc: type = #lc; break; + UV_HANDLE_TYPE_MAP(X) +#undef X + default: type = ""; + } + + fprintf(stream, + "[%c%c%c] %-8s %p\n", + "R-"[!(h->flags & UV__HANDLE_REF)], + "A-"[!(h->flags & UV__HANDLE_ACTIVE)], + "I-"[!(h->flags & UV__HANDLE_INTERNAL)], + type, + (void*)h); + } +} + + +void uv_print_all_handles(uv_loop_t* loop, FILE* stream) { + uv__print_handles(loop, 0, stream); +} + + +void uv_print_active_handles(uv_loop_t* loop, FILE* stream) { + uv__print_handles(loop, 1, stream); +} + + +void uv_ref(uv_handle_t* handle) { + uv__handle_ref(handle); +} + + +void uv_unref(uv_handle_t* handle) { + uv__handle_unref(handle); +} + + +int uv_has_ref(const uv_handle_t* handle) { + return uv__has_ref(handle); +} + + +void uv_stop(uv_loop_t* loop) { + loop->stop_flag = 1; +} + + +uint64_t uv_now(const uv_loop_t* loop) { + return loop->time; +} + + + +size_t uv__count_bufs(const uv_buf_t bufs[], unsigned int nbufs) { + unsigned int i; + size_t bytes; + + bytes = 0; + for (i = 0; i < nbufs; i++) + bytes += (size_t) bufs[i].len; + + return bytes; +} + +int uv_recv_buffer_size(uv_handle_t* handle, int* value) { + return uv__socket_sockopt(handle, SO_RCVBUF, value); +} + +int uv_send_buffer_size(uv_handle_t* handle, int *value) { + return uv__socket_sockopt(handle, SO_SNDBUF, value); +} + +int uv_fs_event_getpath(uv_fs_event_t* handle, char* buffer, size_t* size) { + size_t required_len; + + if (!uv__is_active(handle)) { + *size = 0; + return UV_EINVAL; + } + + required_len = strlen(handle->path); + if (required_len > *size) { + *size = required_len; + return UV_ENOBUFS; + } + + memcpy(buffer, handle->path, required_len); + *size = required_len; + + return 0; +} + +/* The windows implementation does not have the same structure layout as + * the unix implementation (nbufs is not directly inside req but is + * contained in a nested union/struct) so this function locates it. +*/ +static unsigned int* uv__get_nbufs(uv_fs_t* req) { +#ifdef _WIN32 + return &req->fs.info.nbufs; +#else + return &req->nbufs; +#endif +} + +void uv__fs_scandir_cleanup(uv_fs_t* req) { + uv__dirent_t** dents; + + unsigned int* nbufs = uv__get_nbufs(req); + + dents = req->ptr; + if (*nbufs > 0 && *nbufs != (unsigned int) req->result) + (*nbufs)--; + for (; *nbufs < (unsigned int) req->result; (*nbufs)++) + uv__free(dents[*nbufs]); +} + + +int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent) { + uv__dirent_t** dents; + uv__dirent_t* dent; + + unsigned int* nbufs = uv__get_nbufs(req); + + dents = req->ptr; + + /* Free previous entity */ + if (*nbufs > 0) + uv__free(dents[*nbufs - 1]); + + /* End was already reached */ + if (*nbufs == (unsigned int) req->result) { + uv__free(dents); + req->ptr = NULL; + return UV_EOF; + } + + dent = dents[(*nbufs)++]; + + ent->name = dent->d_name; +#ifdef HAVE_DIRENT_TYPES + switch (dent->d_type) { + case UV__DT_DIR: + ent->type = UV_DIRENT_DIR; + break; + case UV__DT_FILE: + ent->type = UV_DIRENT_FILE; + break; + case UV__DT_LINK: + ent->type = UV_DIRENT_LINK; + break; + case UV__DT_FIFO: + ent->type = UV_DIRENT_FIFO; + break; + case UV__DT_SOCKET: + ent->type = UV_DIRENT_SOCKET; + break; + case UV__DT_CHAR: + ent->type = UV_DIRENT_CHAR; + break; + case UV__DT_BLOCK: + ent->type = UV_DIRENT_BLOCK; + break; + default: + ent->type = UV_DIRENT_UNKNOWN; + } +#else + ent->type = UV_DIRENT_UNKNOWN; +#endif + + return 0; +} + + +int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...) { + va_list ap; + int err; + + va_start(ap, option); + /* Any platform-agnostic options should be handled here. */ + err = uv__loop_configure(loop, option, ap); + va_end(ap); + + return err; +} + + +static uv_loop_t default_loop_struct; +static uv_loop_t* default_loop_ptr; + + +uv_loop_t* uv_default_loop(void) { + if (default_loop_ptr != NULL) + return default_loop_ptr; + + if (uv_loop_init(&default_loop_struct)) + return NULL; + + default_loop_ptr = &default_loop_struct; + return default_loop_ptr; +} + + +uv_loop_t* uv_loop_new(void) { + uv_loop_t* loop; + + loop = uv__malloc(sizeof(*loop)); + if (loop == NULL) + return NULL; + + if (uv_loop_init(loop)) { + uv__free(loop); + return NULL; + } + + return loop; +} + + +int uv_loop_close(uv_loop_t* loop) { + QUEUE* q; + uv_handle_t* h; + + if (!QUEUE_EMPTY(&(loop)->active_reqs)) + return UV_EBUSY; + + QUEUE_FOREACH(q, &loop->handle_queue) { + h = QUEUE_DATA(q, uv_handle_t, handle_queue); + if (!(h->flags & UV__HANDLE_INTERNAL)) + return UV_EBUSY; + } + + uv__loop_close(loop); + +#ifndef NDEBUG + memset(loop, -1, sizeof(*loop)); +#endif + if (loop == default_loop_ptr) + default_loop_ptr = NULL; + + return 0; +} + + +void uv_loop_delete(uv_loop_t* loop) { + uv_loop_t* default_loop; + int err; + + default_loop = default_loop_ptr; + + err = uv_loop_close(loop); + (void) err; /* Squelch compiler warnings. */ + assert(err == 0); + if (loop != default_loop) + uv__free(loop); +} diff --git a/3rdparty/libuv/src/uv-common.h b/3rdparty/libuv/src/uv-common.h new file mode 100644 index 00000000000..27902fdf864 --- /dev/null +++ b/3rdparty/libuv/src/uv-common.h @@ -0,0 +1,227 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* + * This file is private to libuv. It provides common functionality to both + * Windows and Unix backends. + */ + +#ifndef UV_COMMON_H_ +#define UV_COMMON_H_ + +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1600 +# include "stdint-msvc2008.h" +#else +# include +#endif + +#include "uv.h" +#include "tree.h" +#include "queue.h" + +#if !defined(snprintf) && defined(_MSC_VER) && _MSC_VER < 1900 +extern int snprintf(char*, size_t, const char*, ...); +#endif + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + +#define container_of(ptr, type, member) \ + ((type *) ((char *) (ptr) - offsetof(type, member))) + +#define STATIC_ASSERT(expr) \ + void uv__static_assert(int static_assert_failed[1 - 2 * !(expr)]) + +#ifndef _WIN32 +enum { + UV__HANDLE_INTERNAL = 0x8000, + UV__HANDLE_ACTIVE = 0x4000, + UV__HANDLE_REF = 0x2000, + UV__HANDLE_CLOSING = 0 /* no-op on unix */ +}; +#else +# define UV__HANDLE_INTERNAL 0x80 +# define UV__HANDLE_ACTIVE 0x40 +# define UV__HANDLE_REF 0x20 +# define UV__HANDLE_CLOSING 0x01 +#endif + +int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap); + +void uv__loop_close(uv_loop_t* loop); + +int uv__tcp_bind(uv_tcp_t* tcp, + const struct sockaddr* addr, + unsigned int addrlen, + unsigned int flags); + +int uv__tcp_connect(uv_connect_t* req, + uv_tcp_t* handle, + const struct sockaddr* addr, + unsigned int addrlen, + uv_connect_cb cb); + +int uv__udp_bind(uv_udp_t* handle, + const struct sockaddr* addr, + unsigned int addrlen, + unsigned int flags); + +int uv__udp_send(uv_udp_send_t* req, + uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + unsigned int addrlen, + uv_udp_send_cb send_cb); + +int uv__udp_try_send(uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + unsigned int addrlen); + +int uv__udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloccb, + uv_udp_recv_cb recv_cb); + +int uv__udp_recv_stop(uv_udp_t* handle); + +void uv__fs_poll_close(uv_fs_poll_t* handle); + +int uv__getaddrinfo_translate_error(int sys_err); /* EAI_* error. */ + +void uv__work_submit(uv_loop_t* loop, + struct uv__work *w, + void (*work)(struct uv__work *w), + void (*done)(struct uv__work *w, int status)); + +void uv__work_done(uv_async_t* handle); + +size_t uv__count_bufs(const uv_buf_t bufs[], unsigned int nbufs); + +int uv__socket_sockopt(uv_handle_t* handle, int optname, int* value); + +void uv__fs_scandir_cleanup(uv_fs_t* req); + +#define uv__has_active_reqs(loop) \ + (QUEUE_EMPTY(&(loop)->active_reqs) == 0) + +#define uv__req_register(loop, req) \ + do { \ + QUEUE_INSERT_TAIL(&(loop)->active_reqs, &(req)->active_queue); \ + } \ + while (0) + +#define uv__req_unregister(loop, req) \ + do { \ + assert(uv__has_active_reqs(loop)); \ + QUEUE_REMOVE(&(req)->active_queue); \ + } \ + while (0) + +#define uv__has_active_handles(loop) \ + ((loop)->active_handles > 0) + +#define uv__active_handle_add(h) \ + do { \ + (h)->loop->active_handles++; \ + } \ + while (0) + +#define uv__active_handle_rm(h) \ + do { \ + (h)->loop->active_handles--; \ + } \ + while (0) + +#define uv__is_active(h) \ + (((h)->flags & UV__HANDLE_ACTIVE) != 0) + +#define uv__is_closing(h) \ + (((h)->flags & (UV_CLOSING | UV_CLOSED)) != 0) + +#define uv__handle_start(h) \ + do { \ + assert(((h)->flags & UV__HANDLE_CLOSING) == 0); \ + if (((h)->flags & UV__HANDLE_ACTIVE) != 0) break; \ + (h)->flags |= UV__HANDLE_ACTIVE; \ + if (((h)->flags & UV__HANDLE_REF) != 0) uv__active_handle_add(h); \ + } \ + while (0) + +#define uv__handle_stop(h) \ + do { \ + assert(((h)->flags & UV__HANDLE_CLOSING) == 0); \ + if (((h)->flags & UV__HANDLE_ACTIVE) == 0) break; \ + (h)->flags &= ~UV__HANDLE_ACTIVE; \ + if (((h)->flags & UV__HANDLE_REF) != 0) uv__active_handle_rm(h); \ + } \ + while (0) + +#define uv__handle_ref(h) \ + do { \ + if (((h)->flags & UV__HANDLE_REF) != 0) break; \ + (h)->flags |= UV__HANDLE_REF; \ + if (((h)->flags & UV__HANDLE_CLOSING) != 0) break; \ + if (((h)->flags & UV__HANDLE_ACTIVE) != 0) uv__active_handle_add(h); \ + } \ + while (0) + +#define uv__handle_unref(h) \ + do { \ + if (((h)->flags & UV__HANDLE_REF) == 0) break; \ + (h)->flags &= ~UV__HANDLE_REF; \ + if (((h)->flags & UV__HANDLE_CLOSING) != 0) break; \ + if (((h)->flags & UV__HANDLE_ACTIVE) != 0) uv__active_handle_rm(h); \ + } \ + while (0) + +#define uv__has_ref(h) \ + (((h)->flags & UV__HANDLE_REF) != 0) + +#if defined(_WIN32) +# define uv__handle_platform_init(h) ((h)->u.fd = -1) +#else +# define uv__handle_platform_init(h) ((h)->next_closing = NULL) +#endif + +#define uv__handle_init(loop_, h, type_) \ + do { \ + (h)->loop = (loop_); \ + (h)->type = (type_); \ + (h)->flags = UV__HANDLE_REF; /* Ref the loop when active. */ \ + QUEUE_INSERT_TAIL(&(loop_)->handle_queue, &(h)->handle_queue); \ + uv__handle_platform_init(h); \ + } \ + while (0) + + +/* Allocator prototypes */ +void *uv__calloc(size_t count, size_t size); +char *uv__strdup(const char* s); +char *uv__strndup(const char* s, size_t n); +void* uv__malloc(size_t size); +void uv__free(void* ptr); +void* uv__realloc(void* ptr, size_t size); + +#endif /* UV_COMMON_H_ */ diff --git a/3rdparty/libuv/src/version.c b/3rdparty/libuv/src/version.c new file mode 100644 index 00000000000..686dedd98d6 --- /dev/null +++ b/3rdparty/libuv/src/version.c @@ -0,0 +1,45 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" + +#define UV_STRINGIFY(v) UV_STRINGIFY_HELPER(v) +#define UV_STRINGIFY_HELPER(v) #v + +#define UV_VERSION_STRING_BASE UV_STRINGIFY(UV_VERSION_MAJOR) "." \ + UV_STRINGIFY(UV_VERSION_MINOR) "." \ + UV_STRINGIFY(UV_VERSION_PATCH) + +#if UV_VERSION_IS_RELEASE +# define UV_VERSION_STRING UV_VERSION_STRING_BASE +#else +# define UV_VERSION_STRING UV_VERSION_STRING_BASE "-" UV_VERSION_SUFFIX +#endif + + +unsigned int uv_version(void) { + return UV_VERSION_HEX; +} + + +const char* uv_version_string(void) { + return UV_VERSION_STRING; +} diff --git a/3rdparty/libuv/src/win/async.c b/3rdparty/libuv/src/win/async.c new file mode 100644 index 00000000000..ad240ab8972 --- /dev/null +++ b/3rdparty/libuv/src/win/async.c @@ -0,0 +1,99 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include + +#include "uv.h" +#include "internal.h" +#include "atomicops-inl.h" +#include "handle-inl.h" +#include "req-inl.h" + + +void uv_async_endgame(uv_loop_t* loop, uv_async_t* handle) { + if (handle->flags & UV__HANDLE_CLOSING && + !handle->async_sent) { + assert(!(handle->flags & UV_HANDLE_CLOSED)); + uv__handle_close(handle); + } +} + + +int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) { + uv_req_t* req; + + uv__handle_init(loop, (uv_handle_t*) handle, UV_ASYNC); + handle->async_sent = 0; + handle->async_cb = async_cb; + + req = &handle->async_req; + uv_req_init(loop, req); + req->type = UV_WAKEUP; + req->data = handle; + + uv__handle_start(handle); + + return 0; +} + + +void uv_async_close(uv_loop_t* loop, uv_async_t* handle) { + if (!((uv_async_t*)handle)->async_sent) { + uv_want_endgame(loop, (uv_handle_t*) handle); + } + + uv__handle_closing(handle); +} + + +int uv_async_send(uv_async_t* handle) { + uv_loop_t* loop = handle->loop; + + if (handle->type != UV_ASYNC) { + /* Can't set errno because that's not thread-safe. */ + return -1; + } + + /* The user should make sure never to call uv_async_send to a closing */ + /* or closed handle. */ + assert(!(handle->flags & UV__HANDLE_CLOSING)); + + if (!uv__atomic_exchange_set(&handle->async_sent)) { + POST_COMPLETION_FOR_REQ(loop, &handle->async_req); + } + + return 0; +} + + +void uv_process_async_wakeup_req(uv_loop_t* loop, uv_async_t* handle, + uv_req_t* req) { + assert(handle->type == UV_ASYNC); + assert(req->type == UV_WAKEUP); + + handle->async_sent = 0; + + if (handle->flags & UV__HANDLE_CLOSING) { + uv_want_endgame(loop, (uv_handle_t*)handle); + } else if (handle->async_cb != NULL) { + handle->async_cb(handle); + } +} diff --git a/3rdparty/libuv/src/win/atomicops-inl.h b/3rdparty/libuv/src/win/atomicops-inl.h new file mode 100644 index 00000000000..61e006026c1 --- /dev/null +++ b/3rdparty/libuv/src/win/atomicops-inl.h @@ -0,0 +1,56 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_WIN_ATOMICOPS_INL_H_ +#define UV_WIN_ATOMICOPS_INL_H_ + +#include "uv.h" + + +/* Atomic set operation on char */ +#ifdef _MSC_VER /* MSVC */ + +/* _InterlockedOr8 is supported by MSVC on x32 and x64. It is slightly less */ +/* efficient than InterlockedExchange, but InterlockedExchange8 does not */ +/* exist, and interlocked operations on larger targets might require the */ +/* target to be aligned. */ +#pragma intrinsic(_InterlockedOr8) + +static char __declspec(inline) uv__atomic_exchange_set(char volatile* target) { + return _InterlockedOr8(target, 1); +} + +#else /* GCC */ + +/* Mingw-32 version, hopefully this works for 64-bit gcc as well. */ +static inline char uv__atomic_exchange_set(char volatile* target) { + const char one = 1; + char old_value; + __asm__ __volatile__ ("lock xchgb %0, %1\n\t" + : "=r"(old_value), "=m"(*target) + : "0"(one), "m"(*target) + : "memory"); + return old_value; +} + +#endif + +#endif /* UV_WIN_ATOMICOPS_INL_H_ */ diff --git a/3rdparty/libuv/src/win/core.c b/3rdparty/libuv/src/win/core.c new file mode 100644 index 00000000000..de0483e1023 --- /dev/null +++ b/3rdparty/libuv/src/win/core.c @@ -0,0 +1,457 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) +#include +#endif + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "req-inl.h" + + +static uv_loop_t default_loop_struct; +static uv_loop_t* default_loop_ptr; + +/* uv_once initialization guards */ +static uv_once_t uv_init_guard_ = UV_ONCE_INIT; + + +#if defined(_DEBUG) && (defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)) +/* Our crt debug report handler allows us to temporarily disable asserts + * just for the current thread. + */ + +UV_THREAD_LOCAL int uv__crt_assert_enabled = TRUE; + +static int uv__crt_dbg_report_handler(int report_type, char *message, int *ret_val) { + if (uv__crt_assert_enabled || report_type != _CRT_ASSERT) + return FALSE; + + if (ret_val) { + /* Set ret_val to 0 to continue with normal execution. + * Set ret_val to 1 to trigger a breakpoint. + */ + + if(IsDebuggerPresent()) + *ret_val = 1; + else + *ret_val = 0; + } + + /* Don't call _CrtDbgReport. */ + return TRUE; +} +#else +UV_THREAD_LOCAL int uv__crt_assert_enabled = FALSE; +#endif + + +#if !defined(__MINGW32__) || __MSVCRT_VERSION__ >= 0x800 +static void uv__crt_invalid_parameter_handler(const wchar_t* expression, + const wchar_t* function, const wchar_t * file, unsigned int line, + uintptr_t reserved) { + /* No-op. */ +} +#endif + + +static void uv_init(void) { + /* Tell Windows that we will handle critical errors. */ + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | + SEM_NOOPENFILEERRORBOX); + + /* Tell the CRT to not exit the application when an invalid parameter is + * passed. The main issue is that invalid FDs will trigger this behavior. + */ +#if !defined(__MINGW32__) || __MSVCRT_VERSION__ >= 0x800 + _set_invalid_parameter_handler(uv__crt_invalid_parameter_handler); +#endif + + /* We also need to setup our debug report handler because some CRT + * functions (eg _get_osfhandle) raise an assert when called with invalid + * FDs even though they return the proper error code in the release build. + */ +#if defined(_DEBUG) && (defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)) + _CrtSetReportHook(uv__crt_dbg_report_handler); +#endif + + /* Fetch winapi function pointers. This must be done first because other + * initialization code might need these function pointers to be loaded. + */ + uv_winapi_init(); + + /* Initialize winsock */ + uv_winsock_init(); + + /* Initialize FS */ + uv_fs_init(); + + /* Initialize signal stuff */ + uv_signals_init(); + + /* Initialize console */ + uv_console_init(); + + /* Initialize utilities */ + uv__util_init(); +} + + +int uv_loop_init(uv_loop_t* loop) { + int err; + + /* Initialize libuv itself first */ + uv__once_init(); + + /* Create an I/O completion port */ + loop->iocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 1); + if (loop->iocp == NULL) + return uv_translate_sys_error(GetLastError()); + + /* To prevent uninitialized memory access, loop->time must be initialized + * to zero before calling uv_update_time for the first time. + */ + loop->time = 0; + uv_update_time(loop); + + QUEUE_INIT(&loop->wq); + QUEUE_INIT(&loop->handle_queue); + QUEUE_INIT(&loop->active_reqs); + loop->active_handles = 0; + + loop->pending_reqs_tail = NULL; + + loop->endgame_handles = NULL; + + RB_INIT(&loop->timers); + + loop->check_handles = NULL; + loop->prepare_handles = NULL; + loop->idle_handles = NULL; + + loop->next_prepare_handle = NULL; + loop->next_check_handle = NULL; + loop->next_idle_handle = NULL; + + memset(&loop->poll_peer_sockets, 0, sizeof loop->poll_peer_sockets); + + loop->active_tcp_streams = 0; + loop->active_udp_streams = 0; + + loop->timer_counter = 0; + loop->stop_flag = 0; + + err = uv_mutex_init(&loop->wq_mutex); + if (err) + goto fail_mutex_init; + + err = uv_async_init(loop, &loop->wq_async, uv__work_done); + if (err) + goto fail_async_init; + + uv__handle_unref(&loop->wq_async); + loop->wq_async.flags |= UV__HANDLE_INTERNAL; + + return 0; + +fail_async_init: + uv_mutex_destroy(&loop->wq_mutex); + +fail_mutex_init: + CloseHandle(loop->iocp); + loop->iocp = INVALID_HANDLE_VALUE; + + return err; +} + + +void uv__once_init(void) { + uv_once(&uv_init_guard_, uv_init); +} + + +void uv__loop_close(uv_loop_t* loop) { + size_t i; + + /* close the async handle without needing an extra loop iteration */ + assert(!loop->wq_async.async_sent); + loop->wq_async.close_cb = NULL; + uv__handle_closing(&loop->wq_async); + uv__handle_close(&loop->wq_async); + + for (i = 0; i < ARRAY_SIZE(loop->poll_peer_sockets); i++) { + SOCKET sock = loop->poll_peer_sockets[i]; + if (sock != 0 && sock != INVALID_SOCKET) + closesocket(sock); + } + + uv_mutex_lock(&loop->wq_mutex); + assert(QUEUE_EMPTY(&loop->wq) && "thread pool work queue not empty!"); + assert(!uv__has_active_reqs(loop)); + uv_mutex_unlock(&loop->wq_mutex); + uv_mutex_destroy(&loop->wq_mutex); + + CloseHandle(loop->iocp); +} + + +int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) { + return UV_ENOSYS; +} + + +int uv_backend_fd(const uv_loop_t* loop) { + return -1; +} + + +int uv_backend_timeout(const uv_loop_t* loop) { + if (loop->stop_flag != 0) + return 0; + + if (!uv__has_active_handles(loop) && !uv__has_active_reqs(loop)) + return 0; + + if (loop->pending_reqs_tail) + return 0; + + if (loop->endgame_handles) + return 0; + + if (loop->idle_handles) + return 0; + + return uv__next_timeout(loop); +} + + +static void uv_poll(uv_loop_t* loop, DWORD timeout) { + DWORD bytes; + ULONG_PTR key; + OVERLAPPED* overlapped; + uv_req_t* req; + + GetQueuedCompletionStatus(loop->iocp, + &bytes, + &key, + &overlapped, + timeout); + + if (overlapped) { + /* Package was dequeued */ + req = uv_overlapped_to_req(overlapped); + uv_insert_pending_req(loop, req); + + /* Some time might have passed waiting for I/O, + * so update the loop time here. + */ + uv_update_time(loop); + } else if (GetLastError() != WAIT_TIMEOUT) { + /* Serious error */ + uv_fatal_error(GetLastError(), "GetQueuedCompletionStatus"); + } else if (timeout > 0) { + /* GetQueuedCompletionStatus can occasionally return a little early. + * Make sure that the desired timeout is reflected in the loop time. + */ + uv__time_forward(loop, timeout); + } +} + + +static void uv_poll_ex(uv_loop_t* loop, DWORD timeout) { + BOOL success; + uv_req_t* req; + OVERLAPPED_ENTRY overlappeds[128]; + ULONG count; + ULONG i; + + success = pGetQueuedCompletionStatusEx(loop->iocp, + overlappeds, + ARRAY_SIZE(overlappeds), + &count, + timeout, + FALSE); + + if (success) { + for (i = 0; i < count; i++) { + /* Package was dequeued */ + req = uv_overlapped_to_req(overlappeds[i].lpOverlapped); + uv_insert_pending_req(loop, req); + } + + /* Some time might have passed waiting for I/O, + * so update the loop time here. + */ + uv_update_time(loop); + } else if (GetLastError() != WAIT_TIMEOUT) { + /* Serious error */ + uv_fatal_error(GetLastError(), "GetQueuedCompletionStatusEx"); + } else if (timeout > 0) { + /* GetQueuedCompletionStatus can occasionally return a little early. + * Make sure that the desired timeout is reflected in the loop time. + */ + uv__time_forward(loop, timeout); + } +} + + +static int uv__loop_alive(const uv_loop_t* loop) { + return loop->active_handles > 0 || + !QUEUE_EMPTY(&loop->active_reqs) || + loop->endgame_handles != NULL; +} + + +int uv_loop_alive(const uv_loop_t* loop) { + return uv__loop_alive(loop); +} + + +int uv_run(uv_loop_t *loop, uv_run_mode mode) { + DWORD timeout; + int r; + int ran_pending; + void (*poll)(uv_loop_t* loop, DWORD timeout); + + if (pGetQueuedCompletionStatusEx) + poll = &uv_poll_ex; + else + poll = &uv_poll; + + r = uv__loop_alive(loop); + if (!r) + uv_update_time(loop); + + while (r != 0 && loop->stop_flag == 0) { + uv_update_time(loop); + uv_process_timers(loop); + + ran_pending = uv_process_reqs(loop); + uv_idle_invoke(loop); + uv_prepare_invoke(loop); + + timeout = 0; + if ((mode == UV_RUN_ONCE && !ran_pending) || mode == UV_RUN_DEFAULT) + timeout = uv_backend_timeout(loop); + + (*poll)(loop, timeout); + + uv_check_invoke(loop); + uv_process_endgames(loop); + + if (mode == UV_RUN_ONCE) { + /* UV_RUN_ONCE implies forward progress: at least one callback must have + * been invoked when it returns. uv__io_poll() can return without doing + * I/O (meaning: no callbacks) when its timeout expires - which means we + * have pending timers that satisfy the forward progress constraint. + * + * UV_RUN_NOWAIT makes no guarantees about progress so it's omitted from + * the check. + */ + uv_process_timers(loop); + } + + r = uv__loop_alive(loop); + if (mode == UV_RUN_ONCE || mode == UV_RUN_NOWAIT) + break; + } + + /* The if statement lets the compiler compile it to a conditional store. + * Avoids dirtying a cache line. + */ + if (loop->stop_flag != 0) + loop->stop_flag = 0; + + return r; +} + + +int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd) { + uv_os_fd_t fd_out; + + switch (handle->type) { + case UV_TCP: + fd_out = (uv_os_fd_t)((uv_tcp_t*) handle)->socket; + break; + + case UV_NAMED_PIPE: + fd_out = ((uv_pipe_t*) handle)->handle; + break; + + case UV_TTY: + fd_out = ((uv_tty_t*) handle)->handle; + break; + + case UV_UDP: + fd_out = (uv_os_fd_t)((uv_udp_t*) handle)->socket; + break; + + case UV_POLL: + fd_out = (uv_os_fd_t)((uv_poll_t*) handle)->socket; + break; + + default: + return UV_EINVAL; + } + + if (uv_is_closing(handle) || fd_out == INVALID_HANDLE_VALUE) + return UV_EBADF; + + *fd = fd_out; + return 0; +} + + +int uv__socket_sockopt(uv_handle_t* handle, int optname, int* value) { + int r; + int len; + SOCKET socket; + + if (handle == NULL || value == NULL) + return UV_EINVAL; + + if (handle->type == UV_TCP) + socket = ((uv_tcp_t*) handle)->socket; + else if (handle->type == UV_UDP) + socket = ((uv_udp_t*) handle)->socket; + else + return UV_ENOTSUP; + + len = sizeof(*value); + + if (*value == 0) + r = getsockopt(socket, SOL_SOCKET, optname, (char*) value, &len); + else + r = setsockopt(socket, SOL_SOCKET, optname, (const char*) value, len); + + if (r == SOCKET_ERROR) + return uv_translate_sys_error(WSAGetLastError()); + + return 0; +} diff --git a/3rdparty/libuv/src/win/dl.c b/3rdparty/libuv/src/win/dl.c new file mode 100644 index 00000000000..e5f3407f8eb --- /dev/null +++ b/3rdparty/libuv/src/win/dl.c @@ -0,0 +1,113 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +static int uv__dlerror(uv_lib_t* lib, int errorno); + + +int uv_dlopen(const char* filename, uv_lib_t* lib) { + WCHAR filename_w[32768]; + + lib->handle = NULL; + lib->errmsg = NULL; + + if (!uv_utf8_to_utf16(filename, filename_w, ARRAY_SIZE(filename_w))) { + return uv__dlerror(lib, GetLastError()); + } + + lib->handle = LoadLibraryExW(filename_w, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + if (lib->handle == NULL) { + return uv__dlerror(lib, GetLastError()); + } + + return 0; +} + + +void uv_dlclose(uv_lib_t* lib) { + if (lib->errmsg) { + LocalFree((void*)lib->errmsg); + lib->errmsg = NULL; + } + + if (lib->handle) { + /* Ignore errors. No good way to signal them without leaking memory. */ + FreeLibrary(lib->handle); + lib->handle = NULL; + } +} + + +int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr) { + *ptr = (void*) GetProcAddress(lib->handle, name); + return uv__dlerror(lib, *ptr ? 0 : GetLastError()); +} + + +const char* uv_dlerror(const uv_lib_t* lib) { + return lib->errmsg ? lib->errmsg : "no error"; +} + + +static void uv__format_fallback_error(uv_lib_t* lib, int errorno){ + DWORD_PTR args[1] = { (DWORD_PTR) errorno }; + LPSTR fallback_error = "error: %1!d!"; + + FormatMessageA(FORMAT_MESSAGE_FROM_STRING | + FORMAT_MESSAGE_ARGUMENT_ARRAY | + FORMAT_MESSAGE_ALLOCATE_BUFFER, + fallback_error, 0, 0, + (LPSTR) &lib->errmsg, + 0, (va_list*) args); +} + + + +static int uv__dlerror(uv_lib_t* lib, int errorno) { + DWORD res; + + if (lib->errmsg) { + LocalFree((void*)lib->errmsg); + lib->errmsg = NULL; + } + + if (errorno) { + res = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorno, + MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), + (LPSTR) &lib->errmsg, 0, NULL); + if (!res && GetLastError() == ERROR_MUI_FILE_NOT_FOUND) { + res = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorno, + 0, (LPSTR) &lib->errmsg, 0, NULL); + } + + if (!res) { + uv__format_fallback_error(lib, errorno); + } + } + + return errorno ? -1 : 0; +} diff --git a/3rdparty/libuv/src/win/error.c b/3rdparty/libuv/src/win/error.c new file mode 100644 index 00000000000..c512f35af97 --- /dev/null +++ b/3rdparty/libuv/src/win/error.c @@ -0,0 +1,170 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include + +#include "uv.h" +#include "internal.h" + + +/* + * Display an error message and abort the event loop. + */ +void uv_fatal_error(const int errorno, const char* syscall) { + char* buf = NULL; + const char* errmsg; + + FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorno, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&buf, 0, NULL); + + if (buf) { + errmsg = buf; + } else { + errmsg = "Unknown error"; + } + + /* FormatMessage messages include a newline character already, */ + /* so don't add another. */ + if (syscall) { + fprintf(stderr, "%s: (%d) %s", syscall, errorno, errmsg); + } else { + fprintf(stderr, "(%d) %s", errorno, errmsg); + } + + if (buf) { + LocalFree(buf); + } + + *((char*)NULL) = 0xff; /* Force debug break */ + abort(); +} + + +int uv_translate_sys_error(int sys_errno) { + if (sys_errno <= 0) { + return sys_errno; /* If < 0 then it's already a libuv error. */ + } + + switch (sys_errno) { + case ERROR_NOACCESS: return UV_EACCES; + case WSAEACCES: return UV_EACCES; + case ERROR_ADDRESS_ALREADY_ASSOCIATED: return UV_EADDRINUSE; + case WSAEADDRINUSE: return UV_EADDRINUSE; + case WSAEADDRNOTAVAIL: return UV_EADDRNOTAVAIL; + case WSAEAFNOSUPPORT: return UV_EAFNOSUPPORT; + case WSAEWOULDBLOCK: return UV_EAGAIN; + case WSAEALREADY: return UV_EALREADY; + case ERROR_INVALID_FLAGS: return UV_EBADF; + case ERROR_INVALID_HANDLE: return UV_EBADF; + case ERROR_LOCK_VIOLATION: return UV_EBUSY; + case ERROR_PIPE_BUSY: return UV_EBUSY; + case ERROR_SHARING_VIOLATION: return UV_EBUSY; + case ERROR_OPERATION_ABORTED: return UV_ECANCELED; + case WSAEINTR: return UV_ECANCELED; + case ERROR_NO_UNICODE_TRANSLATION: return UV_ECHARSET; + case ERROR_CONNECTION_ABORTED: return UV_ECONNABORTED; + case WSAECONNABORTED: return UV_ECONNABORTED; + case ERROR_CONNECTION_REFUSED: return UV_ECONNREFUSED; + case WSAECONNREFUSED: return UV_ECONNREFUSED; + case ERROR_NETNAME_DELETED: return UV_ECONNRESET; + case WSAECONNRESET: return UV_ECONNRESET; + case ERROR_ALREADY_EXISTS: return UV_EEXIST; + case ERROR_FILE_EXISTS: return UV_EEXIST; + case ERROR_BUFFER_OVERFLOW: return UV_EFAULT; + case WSAEFAULT: return UV_EFAULT; + case ERROR_HOST_UNREACHABLE: return UV_EHOSTUNREACH; + case WSAEHOSTUNREACH: return UV_EHOSTUNREACH; + case ERROR_INSUFFICIENT_BUFFER: return UV_EINVAL; + case ERROR_INVALID_DATA: return UV_EINVAL; + case ERROR_INVALID_PARAMETER: return UV_EINVAL; + case ERROR_SYMLINK_NOT_SUPPORTED: return UV_EINVAL; + case WSAEINVAL: return UV_EINVAL; + case WSAEPFNOSUPPORT: return UV_EINVAL; + case WSAESOCKTNOSUPPORT: return UV_EINVAL; + case ERROR_BEGINNING_OF_MEDIA: return UV_EIO; + case ERROR_BUS_RESET: return UV_EIO; + case ERROR_CRC: return UV_EIO; + case ERROR_DEVICE_DOOR_OPEN: return UV_EIO; + case ERROR_DEVICE_REQUIRES_CLEANING: return UV_EIO; + case ERROR_DISK_CORRUPT: return UV_EIO; + case ERROR_EOM_OVERFLOW: return UV_EIO; + case ERROR_FILEMARK_DETECTED: return UV_EIO; + case ERROR_GEN_FAILURE: return UV_EIO; + case ERROR_INVALID_BLOCK_LENGTH: return UV_EIO; + case ERROR_IO_DEVICE: return UV_EIO; + case ERROR_NO_DATA_DETECTED: return UV_EIO; + case ERROR_NO_SIGNAL_SENT: return UV_EIO; + case ERROR_OPEN_FAILED: return UV_EIO; + case ERROR_SETMARK_DETECTED: return UV_EIO; + case ERROR_SIGNAL_REFUSED: return UV_EIO; + case WSAEISCONN: return UV_EISCONN; + case ERROR_CANT_RESOLVE_FILENAME: return UV_ELOOP; + case ERROR_TOO_MANY_OPEN_FILES: return UV_EMFILE; + case WSAEMFILE: return UV_EMFILE; + case WSAEMSGSIZE: return UV_EMSGSIZE; + case ERROR_FILENAME_EXCED_RANGE: return UV_ENAMETOOLONG; + case ERROR_NETWORK_UNREACHABLE: return UV_ENETUNREACH; + case WSAENETUNREACH: return UV_ENETUNREACH; + case WSAENOBUFS: return UV_ENOBUFS; + case ERROR_BAD_PATHNAME: return UV_ENOENT; + case ERROR_DIRECTORY: return UV_ENOENT; + case ERROR_FILE_NOT_FOUND: return UV_ENOENT; + case ERROR_INVALID_NAME: return UV_ENOENT; + case ERROR_INVALID_DRIVE: return UV_ENOENT; + case ERROR_INVALID_REPARSE_DATA: return UV_ENOENT; + case ERROR_MOD_NOT_FOUND: return UV_ENOENT; + case ERROR_PATH_NOT_FOUND: return UV_ENOENT; + case WSAHOST_NOT_FOUND: return UV_ENOENT; + case WSANO_DATA: return UV_ENOENT; + case ERROR_NOT_ENOUGH_MEMORY: return UV_ENOMEM; + case ERROR_OUTOFMEMORY: return UV_ENOMEM; + case ERROR_CANNOT_MAKE: return UV_ENOSPC; + case ERROR_DISK_FULL: return UV_ENOSPC; + case ERROR_EA_TABLE_FULL: return UV_ENOSPC; + case ERROR_END_OF_MEDIA: return UV_ENOSPC; + case ERROR_HANDLE_DISK_FULL: return UV_ENOSPC; + case ERROR_NOT_CONNECTED: return UV_ENOTCONN; + case WSAENOTCONN: return UV_ENOTCONN; + case ERROR_DIR_NOT_EMPTY: return UV_ENOTEMPTY; + case WSAENOTSOCK: return UV_ENOTSOCK; + case ERROR_NOT_SUPPORTED: return UV_ENOTSUP; + case ERROR_BROKEN_PIPE: return UV_EOF; + case ERROR_ACCESS_DENIED: return UV_EPERM; + case ERROR_PRIVILEGE_NOT_HELD: return UV_EPERM; + case ERROR_BAD_PIPE: return UV_EPIPE; + case ERROR_NO_DATA: return UV_EPIPE; + case ERROR_PIPE_NOT_CONNECTED: return UV_EPIPE; + case WSAESHUTDOWN: return UV_EPIPE; + case WSAEPROTONOSUPPORT: return UV_EPROTONOSUPPORT; + case ERROR_WRITE_PROTECT: return UV_EROFS; + case ERROR_SEM_TIMEOUT: return UV_ETIMEDOUT; + case WSAETIMEDOUT: return UV_ETIMEDOUT; + case ERROR_NOT_SAME_DEVICE: return UV_EXDEV; + case ERROR_INVALID_FUNCTION: return UV_EISDIR; + case ERROR_META_EXPANSION_TOO_LONG: return UV_E2BIG; + default: return UV_UNKNOWN; + } +} diff --git a/3rdparty/libuv/src/win/fs-event.c b/3rdparty/libuv/src/win/fs-event.c new file mode 100644 index 00000000000..76ecfebaa24 --- /dev/null +++ b/3rdparty/libuv/src/win/fs-event.c @@ -0,0 +1,552 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "req-inl.h" + + +const unsigned int uv_directory_watcher_buffer_size = 4096; + + +static void uv_fs_event_queue_readdirchanges(uv_loop_t* loop, + uv_fs_event_t* handle) { + assert(handle->dir_handle != INVALID_HANDLE_VALUE); + assert(!handle->req_pending); + + memset(&(handle->req.u.io.overlapped), 0, + sizeof(handle->req.u.io.overlapped)); + if (!ReadDirectoryChangesW(handle->dir_handle, + handle->buffer, + uv_directory_watcher_buffer_size, + (handle->flags & UV_FS_EVENT_RECURSIVE) ? TRUE : FALSE, + FILE_NOTIFY_CHANGE_FILE_NAME | + FILE_NOTIFY_CHANGE_DIR_NAME | + FILE_NOTIFY_CHANGE_ATTRIBUTES | + FILE_NOTIFY_CHANGE_SIZE | + FILE_NOTIFY_CHANGE_LAST_WRITE | + FILE_NOTIFY_CHANGE_LAST_ACCESS | + FILE_NOTIFY_CHANGE_CREATION | + FILE_NOTIFY_CHANGE_SECURITY, + NULL, + &handle->req.u.io.overlapped, + NULL)) { + /* Make this req pending reporting an error. */ + SET_REQ_ERROR(&handle->req, GetLastError()); + uv_insert_pending_req(loop, (uv_req_t*)&handle->req); + } + + handle->req_pending = 1; +} + +static int uv_relative_path(const WCHAR* filename, + const WCHAR* dir, + WCHAR** relpath) { + int dirlen = wcslen(dir); + int filelen = wcslen(filename); + if (dir[dirlen - 1] == '\\') + dirlen--; + *relpath = uv__malloc((MAX_PATH + 1) * sizeof(WCHAR)); + if (!*relpath) + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + wcsncpy(*relpath, filename + dirlen + 1, filelen - dirlen - 1); + (*relpath)[filelen - dirlen - 1] = L'\0'; + return 0; +} + +static int uv_split_path(const WCHAR* filename, WCHAR** dir, + WCHAR** file) { + int len = wcslen(filename); + int i = len; + while (i > 0 && filename[--i] != '\\' && filename[i] != '/'); + + if (i == 0) { + if (dir) { + *dir = (WCHAR*)uv__malloc((MAX_PATH + 1) * sizeof(WCHAR)); + if (!*dir) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + if (!GetCurrentDirectoryW(MAX_PATH, *dir)) { + uv__free(*dir); + *dir = NULL; + return -1; + } + } + + *file = wcsdup(filename); + } else { + if (dir) { + *dir = (WCHAR*)uv__malloc((i + 1) * sizeof(WCHAR)); + if (!*dir) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + wcsncpy(*dir, filename, i); + (*dir)[i] = L'\0'; + } + + *file = (WCHAR*)uv__malloc((len - i) * sizeof(WCHAR)); + if (!*file) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + wcsncpy(*file, filename + i + 1, len - i - 1); + (*file)[len - i - 1] = L'\0'; + } + + return 0; +} + + +int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { + uv__handle_init(loop, (uv_handle_t*) handle, UV_FS_EVENT); + handle->dir_handle = INVALID_HANDLE_VALUE; + handle->buffer = NULL; + handle->req_pending = 0; + handle->filew = NULL; + handle->short_filew = NULL; + handle->dirw = NULL; + + uv_req_init(loop, (uv_req_t*)&handle->req); + handle->req.type = UV_FS_EVENT_REQ; + handle->req.data = handle; + + return 0; +} + + +int uv_fs_event_start(uv_fs_event_t* handle, + uv_fs_event_cb cb, + const char* path, + unsigned int flags) { + int name_size, is_path_dir; + DWORD attr, last_error; + WCHAR* dir = NULL, *dir_to_watch, *pathw = NULL; + WCHAR short_path[MAX_PATH]; + + if (uv__is_active(handle)) + return UV_EINVAL; + + handle->cb = cb; + handle->path = uv__strdup(path); + if (!handle->path) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + uv__handle_start(handle); + + /* Convert name to UTF16. */ + name_size = uv_utf8_to_utf16(path, NULL, 0) * sizeof(WCHAR); + pathw = (WCHAR*)uv__malloc(name_size); + if (!pathw) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + if (!uv_utf8_to_utf16(path, pathw, + name_size / sizeof(WCHAR))) { + return uv_translate_sys_error(GetLastError()); + } + + /* Determine whether path is a file or a directory. */ + attr = GetFileAttributesW(pathw); + if (attr == INVALID_FILE_ATTRIBUTES) { + last_error = GetLastError(); + goto error; + } + + is_path_dir = (attr & FILE_ATTRIBUTE_DIRECTORY) ? 1 : 0; + + if (is_path_dir) { + /* path is a directory, so that's the directory that we will watch. */ + handle->dirw = pathw; + dir_to_watch = pathw; + } else { + /* + * path is a file. So we split path into dir & file parts, and + * watch the dir directory. + */ + + /* Convert to short path. */ + if (!GetShortPathNameW(pathw, short_path, ARRAY_SIZE(short_path))) { + last_error = GetLastError(); + goto error; + } + + if (uv_split_path(pathw, &dir, &handle->filew) != 0) { + last_error = GetLastError(); + goto error; + } + + if (uv_split_path(short_path, NULL, &handle->short_filew) != 0) { + last_error = GetLastError(); + goto error; + } + + dir_to_watch = dir; + uv__free(pathw); + pathw = NULL; + } + + handle->dir_handle = CreateFileW(dir_to_watch, + FILE_LIST_DIRECTORY, + FILE_SHARE_READ | FILE_SHARE_DELETE | + FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | + FILE_FLAG_OVERLAPPED, + NULL); + + if (dir) { + uv__free(dir); + dir = NULL; + } + + if (handle->dir_handle == INVALID_HANDLE_VALUE) { + last_error = GetLastError(); + goto error; + } + + if (CreateIoCompletionPort(handle->dir_handle, + handle->loop->iocp, + (ULONG_PTR)handle, + 0) == NULL) { + last_error = GetLastError(); + goto error; + } + + if (!handle->buffer) { + handle->buffer = (char*)uv__malloc(uv_directory_watcher_buffer_size); + } + if (!handle->buffer) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + memset(&(handle->req.u.io.overlapped), 0, + sizeof(handle->req.u.io.overlapped)); + + if (!ReadDirectoryChangesW(handle->dir_handle, + handle->buffer, + uv_directory_watcher_buffer_size, + (flags & UV_FS_EVENT_RECURSIVE) ? TRUE : FALSE, + FILE_NOTIFY_CHANGE_FILE_NAME | + FILE_NOTIFY_CHANGE_DIR_NAME | + FILE_NOTIFY_CHANGE_ATTRIBUTES | + FILE_NOTIFY_CHANGE_SIZE | + FILE_NOTIFY_CHANGE_LAST_WRITE | + FILE_NOTIFY_CHANGE_LAST_ACCESS | + FILE_NOTIFY_CHANGE_CREATION | + FILE_NOTIFY_CHANGE_SECURITY, + NULL, + &handle->req.u.io.overlapped, + NULL)) { + last_error = GetLastError(); + goto error; + } + + handle->req_pending = 1; + return 0; + +error: + if (handle->path) { + uv__free(handle->path); + handle->path = NULL; + } + + if (handle->filew) { + uv__free(handle->filew); + handle->filew = NULL; + } + + if (handle->short_filew) { + uv__free(handle->short_filew); + handle->short_filew = NULL; + } + + uv__free(pathw); + + if (handle->dir_handle != INVALID_HANDLE_VALUE) { + CloseHandle(handle->dir_handle); + handle->dir_handle = INVALID_HANDLE_VALUE; + } + + if (handle->buffer) { + uv__free(handle->buffer); + handle->buffer = NULL; + } + + return uv_translate_sys_error(last_error); +} + + +int uv_fs_event_stop(uv_fs_event_t* handle) { + if (!uv__is_active(handle)) + return 0; + + if (handle->dir_handle != INVALID_HANDLE_VALUE) { + CloseHandle(handle->dir_handle); + handle->dir_handle = INVALID_HANDLE_VALUE; + } + + uv__handle_stop(handle); + + if (handle->filew) { + uv__free(handle->filew); + handle->filew = NULL; + } + + if (handle->short_filew) { + uv__free(handle->short_filew); + handle->short_filew = NULL; + } + + if (handle->path) { + uv__free(handle->path); + handle->path = NULL; + } + + if (handle->dirw) { + uv__free(handle->dirw); + handle->dirw = NULL; + } + + return 0; +} + + +void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, + uv_fs_event_t* handle) { + FILE_NOTIFY_INFORMATION* file_info; + int err, sizew, size, result; + char* filename = NULL; + WCHAR* filenamew, *long_filenamew = NULL; + DWORD offset = 0; + + assert(req->type == UV_FS_EVENT_REQ); + assert(handle->req_pending); + handle->req_pending = 0; + + /* Don't report any callbacks if: + * - We're closing, just push the handle onto the endgame queue + * - We are not active, just ignore the callback + */ + if (!uv__is_active(handle)) { + if (handle->flags & UV__HANDLE_CLOSING) { + uv_want_endgame(loop, (uv_handle_t*) handle); + } + return; + } + + file_info = (FILE_NOTIFY_INFORMATION*)(handle->buffer + offset); + + if (REQ_SUCCESS(req)) { + if (req->u.io.overlapped.InternalHigh > 0) { + do { + file_info = (FILE_NOTIFY_INFORMATION*)((char*)file_info + offset); + assert(!filename); + assert(!long_filenamew); + + /* + * Fire the event only if we were asked to watch a directory, + * or if the filename filter matches. + */ + if (handle->dirw || + _wcsnicmp(handle->filew, file_info->FileName, + file_info->FileNameLength / sizeof(WCHAR)) == 0 || + _wcsnicmp(handle->short_filew, file_info->FileName, + file_info->FileNameLength / sizeof(WCHAR)) == 0) { + + if (handle->dirw) { + /* + * We attempt to resolve the long form of the file name explicitly. + * We only do this for file names that might still exist on disk. + * If this fails, we use the name given by ReadDirectoryChangesW. + * This may be the long form or the 8.3 short name in some cases. + */ + if (file_info->Action != FILE_ACTION_REMOVED && + file_info->Action != FILE_ACTION_RENAMED_OLD_NAME) { + /* Construct a full path to the file. */ + size = wcslen(handle->dirw) + + file_info->FileNameLength / sizeof(WCHAR) + 2; + + filenamew = (WCHAR*)uv__malloc(size * sizeof(WCHAR)); + if (!filenamew) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + _snwprintf(filenamew, size, L"%s\\%.*s", handle->dirw, + file_info->FileNameLength / sizeof(WCHAR), + file_info->FileName); + + filenamew[size - 1] = L'\0'; + + /* Convert to long name. */ + size = GetLongPathNameW(filenamew, NULL, 0); + + if (size) { + long_filenamew = (WCHAR*)uv__malloc(size * sizeof(WCHAR)); + if (!long_filenamew) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + size = GetLongPathNameW(filenamew, long_filenamew, size); + if (size) { + long_filenamew[size] = '\0'; + } else { + uv__free(long_filenamew); + long_filenamew = NULL; + } + } + + uv__free(filenamew); + + if (long_filenamew) { + /* Get the file name out of the long path. */ + result = uv_relative_path(long_filenamew, + handle->dirw, + &filenamew); + uv__free(long_filenamew); + + if (result == 0) { + long_filenamew = filenamew; + sizew = -1; + } else { + long_filenamew = NULL; + } + } + + /* + * We could not resolve the long form explicitly. + * We therefore use the name given by ReadDirectoryChangesW. + * This may be the long form or the 8.3 short name in some cases. + */ + if (!long_filenamew) { + filenamew = file_info->FileName; + sizew = file_info->FileNameLength / sizeof(WCHAR); + } + } else { + /* + * Removed or renamed events cannot be resolved to the long form. + * We therefore use the name given by ReadDirectoryChangesW. + * This may be the long form or the 8.3 short name in some cases. + */ + if (!long_filenamew) { + filenamew = file_info->FileName; + sizew = file_info->FileNameLength / sizeof(WCHAR); + } + } + } else { + /* We already have the long name of the file, so just use it. */ + filenamew = handle->filew; + sizew = -1; + } + + if (filenamew) { + /* Convert the filename to utf8. */ + size = uv_utf16_to_utf8(filenamew, + sizew, + NULL, + 0); + if (size) { + filename = (char*)uv__malloc(size + 1); + if (!filename) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + size = uv_utf16_to_utf8(filenamew, + sizew, + filename, + size); + if (size) { + filename[size] = '\0'; + } else { + uv__free(filename); + filename = NULL; + } + } + } + + switch (file_info->Action) { + case FILE_ACTION_ADDED: + case FILE_ACTION_REMOVED: + case FILE_ACTION_RENAMED_OLD_NAME: + case FILE_ACTION_RENAMED_NEW_NAME: + handle->cb(handle, filename, UV_RENAME, 0); + break; + + case FILE_ACTION_MODIFIED: + handle->cb(handle, filename, UV_CHANGE, 0); + break; + } + + uv__free(filename); + filename = NULL; + uv__free(long_filenamew); + long_filenamew = NULL; + } + + offset = file_info->NextEntryOffset; + } while (offset && !(handle->flags & UV__HANDLE_CLOSING)); + } else { + handle->cb(handle, NULL, UV_CHANGE, 0); + } + } else { + err = GET_REQ_ERROR(req); + handle->cb(handle, NULL, 0, uv_translate_sys_error(err)); + } + + if (!(handle->flags & UV__HANDLE_CLOSING)) { + uv_fs_event_queue_readdirchanges(loop, handle); + } else { + uv_want_endgame(loop, (uv_handle_t*)handle); + } +} + + +void uv_fs_event_close(uv_loop_t* loop, uv_fs_event_t* handle) { + uv_fs_event_stop(handle); + + uv__handle_closing(handle); + + if (!handle->req_pending) { + uv_want_endgame(loop, (uv_handle_t*)handle); + } + +} + + +void uv_fs_event_endgame(uv_loop_t* loop, uv_fs_event_t* handle) { + if ((handle->flags & UV__HANDLE_CLOSING) && !handle->req_pending) { + assert(!(handle->flags & UV_HANDLE_CLOSED)); + + if (handle->buffer) { + uv__free(handle->buffer); + handle->buffer = NULL; + } + + uv__handle_close(handle); + } +} diff --git a/3rdparty/libuv/src/win/fs.c b/3rdparty/libuv/src/win/fs.c new file mode 100644 index 00000000000..a32b0127f7e --- /dev/null +++ b/3rdparty/libuv/src/win/fs.c @@ -0,0 +1,2468 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "uv.h" +#include "internal.h" +#include "req-inl.h" +#include "handle-inl.h" + +#include + + +#define UV_FS_FREE_PATHS 0x0002 +#define UV_FS_FREE_PTR 0x0008 +#define UV_FS_CLEANEDUP 0x0010 + + +#define QUEUE_FS_TP_JOB(loop, req) \ + do { \ + uv__req_register(loop, req); \ + uv__work_submit((loop), &(req)->work_req, uv__fs_work, uv__fs_done); \ + } while (0) + +#define SET_REQ_RESULT(req, result_value) \ + do { \ + req->result = (result_value); \ + if (req->result == -1) { \ + req->sys_errno_ = _doserrno; \ + req->result = uv_translate_sys_error(req->sys_errno_); \ + } \ + } while (0) + +#define SET_REQ_WIN32_ERROR(req, sys_errno) \ + do { \ + req->sys_errno_ = (sys_errno); \ + req->result = uv_translate_sys_error(req->sys_errno_); \ + } while (0) + +#define SET_REQ_UV_ERROR(req, uv_errno, sys_errno) \ + do { \ + req->result = (uv_errno); \ + req->sys_errno_ = (sys_errno); \ + } while (0) + +#define VERIFY_FD(fd, req) \ + if (fd == -1) { \ + req->result = UV_EBADF; \ + req->sys_errno_ = ERROR_INVALID_HANDLE; \ + return; \ + } + +#define FILETIME_TO_UINT(filetime) \ + (*((uint64_t*) &(filetime)) - 116444736000000000ULL) + +#define FILETIME_TO_TIME_T(filetime) \ + (FILETIME_TO_UINT(filetime) / 10000000ULL) + +#define FILETIME_TO_TIME_NS(filetime, secs) \ + ((FILETIME_TO_UINT(filetime) - (secs * 10000000ULL)) * 100) + +#define FILETIME_TO_TIMESPEC(ts, filetime) \ + do { \ + (ts).tv_sec = (long) FILETIME_TO_TIME_T(filetime); \ + (ts).tv_nsec = (long) FILETIME_TO_TIME_NS(filetime, (ts).tv_sec); \ + } while(0) + +#define TIME_T_TO_FILETIME(time, filetime_ptr) \ + do { \ + uint64_t bigtime = ((int64_t) (time) * 10000000LL) + \ + 116444736000000000ULL; \ + (filetime_ptr)->dwLowDateTime = bigtime & 0xFFFFFFFF; \ + (filetime_ptr)->dwHighDateTime = bigtime >> 32; \ + } while(0) + +#define IS_SLASH(c) ((c) == L'\\' || (c) == L'/') +#define IS_LETTER(c) (((c) >= L'a' && (c) <= L'z') || \ + ((c) >= L'A' && (c) <= L'Z')) + +const WCHAR JUNCTION_PREFIX[] = L"\\??\\"; +const WCHAR JUNCTION_PREFIX_LEN = 4; + +const WCHAR LONG_PATH_PREFIX[] = L"\\\\?\\"; +const WCHAR LONG_PATH_PREFIX_LEN = 4; + +const WCHAR UNC_PATH_PREFIX[] = L"\\\\?\\UNC\\"; +const WCHAR UNC_PATH_PREFIX_LEN = 8; + + +void uv_fs_init() { + _fmode = _O_BINARY; +} + + +INLINE static int fs__capture_path(uv_fs_t* req, const char* path, + const char* new_path, const int copy_path) { + char* buf; + char* pos; + ssize_t buf_sz = 0, path_len, pathw_len = 0, new_pathw_len = 0; + + /* new_path can only be set if path is also set. */ + assert(new_path == NULL || path != NULL); + + if (path != NULL) { + pathw_len = MultiByteToWideChar(CP_UTF8, + 0, + path, + -1, + NULL, + 0); + if (pathw_len == 0) { + return GetLastError(); + } + + buf_sz += pathw_len * sizeof(WCHAR); + } + + if (path != NULL && copy_path) { + path_len = 1 + strlen(path); + buf_sz += path_len; + } + + if (new_path != NULL) { + new_pathw_len = MultiByteToWideChar(CP_UTF8, + 0, + new_path, + -1, + NULL, + 0); + if (new_pathw_len == 0) { + return GetLastError(); + } + + buf_sz += new_pathw_len * sizeof(WCHAR); + } + + + if (buf_sz == 0) { + req->file.pathw = NULL; + req->fs.info.new_pathw = NULL; + req->path = NULL; + return 0; + } + + buf = (char*) uv__malloc(buf_sz); + if (buf == NULL) { + return ERROR_OUTOFMEMORY; + } + + pos = buf; + + if (path != NULL) { + DWORD r = MultiByteToWideChar(CP_UTF8, + 0, + path, + -1, + (WCHAR*) pos, + pathw_len); + assert(r == (DWORD) pathw_len); + req->file.pathw = (WCHAR*) pos; + pos += r * sizeof(WCHAR); + } else { + req->file.pathw = NULL; + } + + if (new_path != NULL) { + DWORD r = MultiByteToWideChar(CP_UTF8, + 0, + new_path, + -1, + (WCHAR*) pos, + new_pathw_len); + assert(r == (DWORD) new_pathw_len); + req->fs.info.new_pathw = (WCHAR*) pos; + pos += r * sizeof(WCHAR); + } else { + req->fs.info.new_pathw = NULL; + } + + if (!copy_path) { + req->path = path; + } else if (path) { + memcpy(pos, path, path_len); + assert(path_len == buf_sz - (pos - buf)); + req->path = pos; + } else { + req->path = NULL; + } + + req->flags |= UV_FS_FREE_PATHS; + + return 0; +} + + + +INLINE static void uv_fs_req_init(uv_loop_t* loop, uv_fs_t* req, + uv_fs_type fs_type, const uv_fs_cb cb) { + uv_req_init(loop, (uv_req_t*) req); + + req->type = UV_FS; + req->loop = loop; + req->flags = 0; + req->fs_type = fs_type; + req->result = 0; + req->ptr = NULL; + req->path = NULL; + req->cb = cb; +} + + +static int fs__wide_to_utf8(WCHAR* w_source_ptr, + DWORD w_source_len, + char** target_ptr, + uint64_t* target_len_ptr) { + int r; + int target_len; + char* target; + target_len = WideCharToMultiByte(CP_UTF8, + 0, + w_source_ptr, + w_source_len, + NULL, + 0, + NULL, + NULL); + + if (target_len == 0) { + return -1; + } + + if (target_len_ptr != NULL) { + *target_len_ptr = target_len; + } + + if (target_ptr == NULL) { + return 0; + } + + target = uv__malloc(target_len + 1); + if (target == NULL) { + SetLastError(ERROR_OUTOFMEMORY); + return -1; + } + + r = WideCharToMultiByte(CP_UTF8, + 0, + w_source_ptr, + w_source_len, + target, + target_len, + NULL, + NULL); + assert(r == target_len); + target[target_len] = '\0'; + *target_ptr = target; + return 0; +} + + +INLINE static int fs__readlink_handle(HANDLE handle, char** target_ptr, + uint64_t* target_len_ptr) { + char buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; + REPARSE_DATA_BUFFER* reparse_data = (REPARSE_DATA_BUFFER*) buffer; + WCHAR* w_target; + DWORD w_target_len; + DWORD bytes; + + if (!DeviceIoControl(handle, + FSCTL_GET_REPARSE_POINT, + NULL, + 0, + buffer, + sizeof buffer, + &bytes, + NULL)) { + return -1; + } + + if (reparse_data->ReparseTag == IO_REPARSE_TAG_SYMLINK) { + /* Real symlink */ + w_target = reparse_data->SymbolicLinkReparseBuffer.PathBuffer + + (reparse_data->SymbolicLinkReparseBuffer.SubstituteNameOffset / + sizeof(WCHAR)); + w_target_len = + reparse_data->SymbolicLinkReparseBuffer.SubstituteNameLength / + sizeof(WCHAR); + + /* Real symlinks can contain pretty much everything, but the only thing */ + /* we really care about is undoing the implicit conversion to an NT */ + /* namespaced path that CreateSymbolicLink will perform on absolute */ + /* paths. If the path is win32-namespaced then the user must have */ + /* explicitly made it so, and we better just return the unmodified */ + /* reparse data. */ + if (w_target_len >= 4 && + w_target[0] == L'\\' && + w_target[1] == L'?' && + w_target[2] == L'?' && + w_target[3] == L'\\') { + /* Starts with \??\ */ + if (w_target_len >= 6 && + ((w_target[4] >= L'A' && w_target[4] <= L'Z') || + (w_target[4] >= L'a' && w_target[4] <= L'z')) && + w_target[5] == L':' && + (w_target_len == 6 || w_target[6] == L'\\')) { + /* \??\:\ */ + w_target += 4; + w_target_len -= 4; + + } else if (w_target_len >= 8 && + (w_target[4] == L'U' || w_target[4] == L'u') && + (w_target[5] == L'N' || w_target[5] == L'n') && + (w_target[6] == L'C' || w_target[6] == L'c') && + w_target[7] == L'\\') { + /* \??\UNC\\\ - make sure the final path looks like */ + /* \\\\ */ + w_target += 6; + w_target[0] = L'\\'; + w_target_len -= 6; + } + } + + } else if (reparse_data->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { + /* Junction. */ + w_target = reparse_data->MountPointReparseBuffer.PathBuffer + + (reparse_data->MountPointReparseBuffer.SubstituteNameOffset / + sizeof(WCHAR)); + w_target_len = reparse_data->MountPointReparseBuffer.SubstituteNameLength / + sizeof(WCHAR); + + /* Only treat junctions that look like \??\:\ as symlink. */ + /* Junctions can also be used as mount points, like \??\Volume{}, */ + /* but that's confusing for programs since they wouldn't be able to */ + /* actually understand such a path when returned by uv_readlink(). */ + /* UNC paths are never valid for junctions so we don't care about them. */ + if (!(w_target_len >= 6 && + w_target[0] == L'\\' && + w_target[1] == L'?' && + w_target[2] == L'?' && + w_target[3] == L'\\' && + ((w_target[4] >= L'A' && w_target[4] <= L'Z') || + (w_target[4] >= L'a' && w_target[4] <= L'z')) && + w_target[5] == L':' && + (w_target_len == 6 || w_target[6] == L'\\'))) { + SetLastError(ERROR_SYMLINK_NOT_SUPPORTED); + return -1; + } + + /* Remove leading \??\ */ + w_target += 4; + w_target_len -= 4; + + } else { + /* Reparse tag does not indicate a symlink. */ + SetLastError(ERROR_SYMLINK_NOT_SUPPORTED); + return -1; + } + + return fs__wide_to_utf8(w_target, w_target_len, target_ptr, target_len_ptr); +} + + +void fs__open(uv_fs_t* req) { + DWORD access; + DWORD share; + DWORD disposition; + DWORD attributes = 0; + HANDLE file; + int fd, current_umask; + int flags = req->fs.info.file_flags; + + /* Obtain the active umask. umask() never fails and returns the previous */ + /* umask. */ + current_umask = umask(0); + umask(current_umask); + + /* convert flags and mode to CreateFile parameters */ + switch (flags & (_O_RDONLY | _O_WRONLY | _O_RDWR)) { + case _O_RDONLY: + access = FILE_GENERIC_READ; + attributes |= FILE_FLAG_BACKUP_SEMANTICS; + break; + case _O_WRONLY: + access = FILE_GENERIC_WRITE; + break; + case _O_RDWR: + access = FILE_GENERIC_READ | FILE_GENERIC_WRITE; + break; + default: + goto einval; + } + + if (flags & _O_APPEND) { + access &= ~FILE_WRITE_DATA; + access |= FILE_APPEND_DATA; + attributes &= ~FILE_FLAG_BACKUP_SEMANTICS; + } + + /* + * Here is where we deviate significantly from what CRT's _open() + * does. We indiscriminately use all the sharing modes, to match + * UNIX semantics. In particular, this ensures that the file can + * be deleted even whilst it's open, fixing issue #1449. + */ + share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; + + switch (flags & (_O_CREAT | _O_EXCL | _O_TRUNC)) { + case 0: + case _O_EXCL: + disposition = OPEN_EXISTING; + break; + case _O_CREAT: + disposition = OPEN_ALWAYS; + break; + case _O_CREAT | _O_EXCL: + case _O_CREAT | _O_TRUNC | _O_EXCL: + disposition = CREATE_NEW; + break; + case _O_TRUNC: + case _O_TRUNC | _O_EXCL: + disposition = TRUNCATE_EXISTING; + break; + case _O_CREAT | _O_TRUNC: + disposition = CREATE_ALWAYS; + break; + default: + goto einval; + } + + attributes |= FILE_ATTRIBUTE_NORMAL; + if (flags & _O_CREAT) { + if (!((req->fs.info.mode & ~current_umask) & _S_IWRITE)) { + attributes |= FILE_ATTRIBUTE_READONLY; + } + } + + if (flags & _O_TEMPORARY ) { + attributes |= FILE_FLAG_DELETE_ON_CLOSE | FILE_ATTRIBUTE_TEMPORARY; + access |= DELETE; + } + + if (flags & _O_SHORT_LIVED) { + attributes |= FILE_ATTRIBUTE_TEMPORARY; + } + + switch (flags & (_O_SEQUENTIAL | _O_RANDOM)) { + case 0: + break; + case _O_SEQUENTIAL: + attributes |= FILE_FLAG_SEQUENTIAL_SCAN; + break; + case _O_RANDOM: + attributes |= FILE_FLAG_RANDOM_ACCESS; + break; + default: + goto einval; + } + + /* Setting this flag makes it possible to open a directory. */ + attributes |= FILE_FLAG_BACKUP_SEMANTICS; + + file = CreateFileW(req->file.pathw, + access, + share, + NULL, + disposition, + attributes, + NULL); + if (file == INVALID_HANDLE_VALUE) { + DWORD error = GetLastError(); + if (error == ERROR_FILE_EXISTS && (flags & _O_CREAT) && + !(flags & _O_EXCL)) { + /* Special case: when ERROR_FILE_EXISTS happens and O_CREAT was */ + /* specified, it means the path referred to a directory. */ + SET_REQ_UV_ERROR(req, UV_EISDIR, error); + } else { + SET_REQ_WIN32_ERROR(req, GetLastError()); + } + return; + } + + fd = _open_osfhandle((intptr_t) file, flags); + if (fd < 0) { + /* The only known failure mode for _open_osfhandle() is EMFILE, in which + * case GetLastError() will return zero. However we'll try to handle other + * errors as well, should they ever occur. + */ + if (errno == EMFILE) + SET_REQ_UV_ERROR(req, UV_EMFILE, ERROR_TOO_MANY_OPEN_FILES); + else if (GetLastError() != ERROR_SUCCESS) + SET_REQ_WIN32_ERROR(req, GetLastError()); + else + SET_REQ_WIN32_ERROR(req, UV_UNKNOWN); + CloseHandle(file); + return; + } + + SET_REQ_RESULT(req, fd); + return; + + einval: + SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER); +} + +void fs__close(uv_fs_t* req) { + int fd = req->file.fd; + int result; + + VERIFY_FD(fd, req); + + if (fd > 2) + result = _close(fd); + else + result = 0; + + /* _close doesn't set _doserrno on failure, but it does always set errno + * to EBADF on failure. + */ + if (result == -1) { + assert(errno == EBADF); + SET_REQ_UV_ERROR(req, UV_EBADF, ERROR_INVALID_HANDLE); + } else { + req->result = 0; + } +} + + +void fs__read(uv_fs_t* req) { + int fd = req->file.fd; + int64_t offset = req->fs.info.offset; + HANDLE handle; + OVERLAPPED overlapped, *overlapped_ptr; + LARGE_INTEGER offset_; + DWORD bytes; + DWORD error; + int result; + unsigned int index; + + VERIFY_FD(fd, req); + + handle = uv__get_osfhandle(fd); + + if (handle == INVALID_HANDLE_VALUE) { + SET_REQ_WIN32_ERROR(req, ERROR_INVALID_HANDLE); + return; + } + + if (offset != -1) { + memset(&overlapped, 0, sizeof overlapped); + overlapped_ptr = &overlapped; + } else { + overlapped_ptr = NULL; + } + + index = 0; + bytes = 0; + do { + DWORD incremental_bytes; + + if (offset != -1) { + offset_.QuadPart = offset + bytes; + overlapped.Offset = offset_.LowPart; + overlapped.OffsetHigh = offset_.HighPart; + } + + result = ReadFile(handle, + req->fs.info.bufs[index].base, + req->fs.info.bufs[index].len, + &incremental_bytes, + overlapped_ptr); + bytes += incremental_bytes; + ++index; + } while (result && index < req->fs.info.nbufs); + + if (result || bytes > 0) { + SET_REQ_RESULT(req, bytes); + } else { + error = GetLastError(); + if (error == ERROR_HANDLE_EOF) { + SET_REQ_RESULT(req, bytes); + } else { + SET_REQ_WIN32_ERROR(req, error); + } + } +} + + +void fs__write(uv_fs_t* req) { + int fd = req->file.fd; + int64_t offset = req->fs.info.offset; + HANDLE handle; + OVERLAPPED overlapped, *overlapped_ptr; + LARGE_INTEGER offset_; + DWORD bytes; + int result; + unsigned int index; + + VERIFY_FD(fd, req); + + handle = uv__get_osfhandle(fd); + if (handle == INVALID_HANDLE_VALUE) { + SET_REQ_WIN32_ERROR(req, ERROR_INVALID_HANDLE); + return; + } + + if (offset != -1) { + memset(&overlapped, 0, sizeof overlapped); + overlapped_ptr = &overlapped; + } else { + overlapped_ptr = NULL; + } + + index = 0; + bytes = 0; + do { + DWORD incremental_bytes; + + if (offset != -1) { + offset_.QuadPart = offset + bytes; + overlapped.Offset = offset_.LowPart; + overlapped.OffsetHigh = offset_.HighPart; + } + + result = WriteFile(handle, + req->fs.info.bufs[index].base, + req->fs.info.bufs[index].len, + &incremental_bytes, + overlapped_ptr); + bytes += incremental_bytes; + ++index; + } while (result && index < req->fs.info.nbufs); + + if (result || bytes > 0) { + SET_REQ_RESULT(req, bytes); + } else { + SET_REQ_WIN32_ERROR(req, GetLastError()); + } +} + + +void fs__rmdir(uv_fs_t* req) { + int result = _wrmdir(req->file.pathw); + SET_REQ_RESULT(req, result); +} + + +void fs__unlink(uv_fs_t* req) { + const WCHAR* pathw = req->file.pathw; + HANDLE handle; + BY_HANDLE_FILE_INFORMATION info; + FILE_DISPOSITION_INFORMATION disposition; + IO_STATUS_BLOCK iosb; + NTSTATUS status; + + handle = CreateFileW(pathw, + FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | DELETE, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, + NULL); + + if (handle == INVALID_HANDLE_VALUE) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } + + if (!GetFileInformationByHandle(handle, &info)) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + CloseHandle(handle); + return; + } + + if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + /* Do not allow deletion of directories, unless it is a symlink. When */ + /* the path refers to a non-symlink directory, report EPERM as mandated */ + /* by POSIX.1. */ + + /* Check if it is a reparse point. If it's not, it's a normal directory. */ + if (!(info.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) { + SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED); + CloseHandle(handle); + return; + } + + /* Read the reparse point and check if it is a valid symlink. */ + /* If not, don't unlink. */ + if (fs__readlink_handle(handle, NULL, NULL) < 0) { + DWORD error = GetLastError(); + if (error == ERROR_SYMLINK_NOT_SUPPORTED) + error = ERROR_ACCESS_DENIED; + SET_REQ_WIN32_ERROR(req, error); + CloseHandle(handle); + return; + } + } + + if (info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) { + /* Remove read-only attribute */ + FILE_BASIC_INFORMATION basic = { 0 }; + + basic.FileAttributes = info.dwFileAttributes & ~(FILE_ATTRIBUTE_READONLY); + + status = pNtSetInformationFile(handle, + &iosb, + &basic, + sizeof basic, + FileBasicInformation); + if (!NT_SUCCESS(status)) { + SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(status)); + CloseHandle(handle); + return; + } + } + + /* Try to set the delete flag. */ + disposition.DeleteFile = TRUE; + status = pNtSetInformationFile(handle, + &iosb, + &disposition, + sizeof disposition, + FileDispositionInformation); + if (NT_SUCCESS(status)) { + SET_REQ_SUCCESS(req); + } else { + SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(status)); + } + + CloseHandle(handle); +} + + +void fs__mkdir(uv_fs_t* req) { + /* TODO: use req->mode. */ + int result = _wmkdir(req->file.pathw); + SET_REQ_RESULT(req, result); +} + + +/* OpenBSD original: lib/libc/stdio/mktemp.c */ +void fs__mkdtemp(uv_fs_t* req) { + static const WCHAR *tempchars = + L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + static const size_t num_chars = 62; + static const size_t num_x = 6; + WCHAR *cp, *ep; + unsigned int tries, i; + size_t len; + HCRYPTPROV h_crypt_prov; + uint64_t v; + BOOL released; + + len = wcslen(req->file.pathw); + ep = req->file.pathw + len; + if (len < num_x || wcsncmp(ep - num_x, L"XXXXXX", num_x)) { + SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER); + return; + } + + if (!CryptAcquireContext(&h_crypt_prov, NULL, NULL, PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT)) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } + + tries = TMP_MAX; + do { + if (!CryptGenRandom(h_crypt_prov, sizeof(v), (BYTE*) &v)) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + break; + } + + cp = ep - num_x; + for (i = 0; i < num_x; i++) { + *cp++ = tempchars[v % num_chars]; + v /= num_chars; + } + + if (_wmkdir(req->file.pathw) == 0) { + len = strlen(req->path); + wcstombs((char*) req->path + len - num_x, ep - num_x, num_x); + SET_REQ_RESULT(req, 0); + break; + } else if (errno != EEXIST) { + SET_REQ_RESULT(req, -1); + break; + } + } while (--tries); + + released = CryptReleaseContext(h_crypt_prov, 0); + assert(released); + if (tries == 0) { + SET_REQ_RESULT(req, -1); + } +} + + +void fs__scandir(uv_fs_t* req) { + static const size_t dirents_initial_size = 32; + + HANDLE dir_handle = INVALID_HANDLE_VALUE; + + uv__dirent_t** dirents = NULL; + size_t dirents_size = 0; + size_t dirents_used = 0; + + IO_STATUS_BLOCK iosb; + NTSTATUS status; + + /* Buffer to hold directory entries returned by NtQueryDirectoryFile. + * It's important that this buffer can hold at least one entry, regardless + * of the length of the file names present in the enumerated directory. + * A file name is at most 256 WCHARs long. + * According to MSDN, the buffer must be aligned at an 8-byte boundary. + */ +#if _MSC_VER + __declspec(align(8)) char buffer[8192]; +#else + __attribute__ ((aligned (8))) char buffer[8192]; +#endif + + STATIC_ASSERT(sizeof buffer >= + sizeof(FILE_DIRECTORY_INFORMATION) + 256 * sizeof(WCHAR)); + + /* Open the directory. */ + dir_handle = + CreateFileW(req->file.pathw, + FILE_LIST_DIRECTORY | SYNCHRONIZE, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + NULL); + if (dir_handle == INVALID_HANDLE_VALUE) + goto win32_error; + + /* Read the first chunk. */ + status = pNtQueryDirectoryFile(dir_handle, + NULL, + NULL, + NULL, + &iosb, + &buffer, + sizeof buffer, + FileDirectoryInformation, + FALSE, + NULL, + TRUE); + + /* If the handle is not a directory, we'll get STATUS_INVALID_PARAMETER. + * This should be reported back as UV_ENOTDIR. + */ + if (status == STATUS_INVALID_PARAMETER) + goto not_a_directory_error; + + while (NT_SUCCESS(status)) { + char* position = buffer; + size_t next_entry_offset = 0; + + do { + FILE_DIRECTORY_INFORMATION* info; + uv__dirent_t* dirent; + + size_t wchar_len; + size_t utf8_len; + + /* Obtain a pointer to the current directory entry. */ + position += next_entry_offset; + info = (FILE_DIRECTORY_INFORMATION*) position; + + /* Fetch the offset to the next directory entry. */ + next_entry_offset = info->NextEntryOffset; + + /* Compute the length of the filename in WCHARs. */ + wchar_len = info->FileNameLength / sizeof info->FileName[0]; + + /* Skip over '.' and '..' entries. */ + if (wchar_len == 1 && info->FileName[0] == L'.') + continue; + if (wchar_len == 2 && info->FileName[0] == L'.' && + info->FileName[1] == L'.') + continue; + + /* Compute the space required to store the filename as UTF-8. */ + utf8_len = WideCharToMultiByte( + CP_UTF8, 0, &info->FileName[0], wchar_len, NULL, 0, NULL, NULL); + if (utf8_len == 0) + goto win32_error; + + /* Resize the dirent array if needed. */ + if (dirents_used >= dirents_size) { + size_t new_dirents_size = + dirents_size == 0 ? dirents_initial_size : dirents_size << 1; + uv__dirent_t** new_dirents = + uv__realloc(dirents, new_dirents_size * sizeof *dirents); + + if (new_dirents == NULL) + goto out_of_memory_error; + + dirents_size = new_dirents_size; + dirents = new_dirents; + } + + /* Allocate space for the uv dirent structure. The dirent structure + * includes room for the first character of the filename, but `utf8_len` + * doesn't count the NULL terminator at this point. + */ + dirent = uv__malloc(sizeof *dirent + utf8_len); + if (dirent == NULL) + goto out_of_memory_error; + + dirents[dirents_used++] = dirent; + + /* Convert file name to UTF-8. */ + if (WideCharToMultiByte(CP_UTF8, + 0, + &info->FileName[0], + wchar_len, + &dirent->d_name[0], + utf8_len, + NULL, + NULL) == 0) + goto win32_error; + + /* Add a null terminator to the filename. */ + dirent->d_name[utf8_len] = '\0'; + + /* Fill out the type field. */ + if (info->FileAttributes & FILE_ATTRIBUTE_DEVICE) + dirent->d_type = UV__DT_CHAR; + else if (info->FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) + dirent->d_type = UV__DT_LINK; + else if (info->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) + dirent->d_type = UV__DT_DIR; + else + dirent->d_type = UV__DT_FILE; + } while (next_entry_offset != 0); + + /* Read the next chunk. */ + status = pNtQueryDirectoryFile(dir_handle, + NULL, + NULL, + NULL, + &iosb, + &buffer, + sizeof buffer, + FileDirectoryInformation, + FALSE, + NULL, + FALSE); + + /* After the first pNtQueryDirectoryFile call, the function may return + * STATUS_SUCCESS even if the buffer was too small to hold at least one + * directory entry. + */ + if (status == STATUS_SUCCESS && iosb.Information == 0) + status = STATUS_BUFFER_OVERFLOW; + } + + if (status != STATUS_NO_MORE_FILES) + goto nt_error; + + CloseHandle(dir_handle); + + /* Store the result in the request object. */ + req->ptr = dirents; + if (dirents != NULL) + req->flags |= UV_FS_FREE_PTR; + + SET_REQ_RESULT(req, dirents_used); + + /* `nbufs` will be used as index by uv_fs_scandir_next. */ + req->fs.info.nbufs = 0; + + return; + +nt_error: + SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(status)); + goto cleanup; + +win32_error: + SET_REQ_WIN32_ERROR(req, GetLastError()); + goto cleanup; + +not_a_directory_error: + SET_REQ_UV_ERROR(req, UV_ENOTDIR, ERROR_DIRECTORY); + goto cleanup; + +out_of_memory_error: + SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY); + goto cleanup; + +cleanup: + if (dir_handle != INVALID_HANDLE_VALUE) + CloseHandle(dir_handle); + while (dirents_used > 0) + uv__free(dirents[--dirents_used]); + if (dirents != NULL) + uv__free(dirents); +} + + +INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) { + FILE_ALL_INFORMATION file_info; + FILE_FS_VOLUME_INFORMATION volume_info; + NTSTATUS nt_status; + IO_STATUS_BLOCK io_status; + + nt_status = pNtQueryInformationFile(handle, + &io_status, + &file_info, + sizeof file_info, + FileAllInformation); + + /* Buffer overflow (a warning status code) is expected here. */ + if (NT_ERROR(nt_status)) { + SetLastError(pRtlNtStatusToDosError(nt_status)); + return -1; + } + + nt_status = pNtQueryVolumeInformationFile(handle, + &io_status, + &volume_info, + sizeof volume_info, + FileFsVolumeInformation); + + /* Buffer overflow (a warning status code) is expected here. */ + if (io_status.Status == STATUS_NOT_IMPLEMENTED) { + statbuf->st_dev = 0; + } else if (NT_ERROR(nt_status)) { + SetLastError(pRtlNtStatusToDosError(nt_status)); + return -1; + } else { + statbuf->st_dev = volume_info.VolumeSerialNumber; + } + + /* Todo: st_mode should probably always be 0666 for everyone. We might also + * want to report 0777 if the file is a .exe or a directory. + * + * Currently it's based on whether the 'readonly' attribute is set, which + * makes little sense because the semantics are so different: the 'read-only' + * flag is just a way for a user to protect against accidental deletion, and + * serves no security purpose. Windows uses ACLs for that. + * + * Also people now use uv_fs_chmod() to take away the writable bit for good + * reasons. Windows however just makes the file read-only, which makes it + * impossible to delete the file afterwards, since read-only files can't be + * deleted. + * + * IOW it's all just a clusterfuck and we should think of something that + * makes slightly more sense. + * + * And uv_fs_chmod should probably just fail on windows or be a total no-op. + * There's nothing sensible it can do anyway. + */ + statbuf->st_mode = 0; + + if (file_info.BasicInformation.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) { + statbuf->st_mode |= S_IFLNK; + if (fs__readlink_handle(handle, NULL, &statbuf->st_size) != 0) + return -1; + + } else if (file_info.BasicInformation.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + statbuf->st_mode |= _S_IFDIR; + statbuf->st_size = 0; + + } else { + statbuf->st_mode |= _S_IFREG; + statbuf->st_size = file_info.StandardInformation.EndOfFile.QuadPart; + } + + if (file_info.BasicInformation.FileAttributes & FILE_ATTRIBUTE_READONLY) + statbuf->st_mode |= _S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6); + else + statbuf->st_mode |= (_S_IREAD | _S_IWRITE) | ((_S_IREAD | _S_IWRITE) >> 3) | + ((_S_IREAD | _S_IWRITE) >> 6); + + FILETIME_TO_TIMESPEC(statbuf->st_atim, file_info.BasicInformation.LastAccessTime); + FILETIME_TO_TIMESPEC(statbuf->st_ctim, file_info.BasicInformation.ChangeTime); + FILETIME_TO_TIMESPEC(statbuf->st_mtim, file_info.BasicInformation.LastWriteTime); + FILETIME_TO_TIMESPEC(statbuf->st_birthtim, file_info.BasicInformation.CreationTime); + + statbuf->st_ino = file_info.InternalInformation.IndexNumber.QuadPart; + + /* st_blocks contains the on-disk allocation size in 512-byte units. */ + statbuf->st_blocks = + file_info.StandardInformation.AllocationSize.QuadPart >> 9ULL; + + statbuf->st_nlink = file_info.StandardInformation.NumberOfLinks; + + /* The st_blksize is supposed to be the 'optimal' number of bytes for reading + * and writing to the disk. That is, for any definition of 'optimal' - it's + * supposed to at least avoid read-update-write behavior when writing to the + * disk. + * + * However nobody knows this and even fewer people actually use this value, + * and in order to fill it out we'd have to make another syscall to query the + * volume for FILE_FS_SECTOR_SIZE_INFORMATION. + * + * Therefore we'll just report a sensible value that's quite commonly okay + * on modern hardware. + */ + statbuf->st_blksize = 2048; + + /* Todo: set st_flags to something meaningful. Also provide a wrapper for + * chattr(2). + */ + statbuf->st_flags = 0; + + /* Windows has nothing sensible to say about these values, so they'll just + * remain empty. + */ + statbuf->st_gid = 0; + statbuf->st_uid = 0; + statbuf->st_rdev = 0; + statbuf->st_gen = 0; + + return 0; +} + + +INLINE static void fs__stat_prepare_path(WCHAR* pathw) { + size_t len = wcslen(pathw); + + /* TODO: ignore namespaced paths. */ + if (len > 1 && pathw[len - 2] != L':' && + (pathw[len - 1] == L'\\' || pathw[len - 1] == L'/')) { + pathw[len - 1] = '\0'; + } +} + + +INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) { + HANDLE handle; + DWORD flags; + + flags = FILE_FLAG_BACKUP_SEMANTICS; + if (do_lstat) { + flags |= FILE_FLAG_OPEN_REPARSE_POINT; + } + + handle = CreateFileW(req->file.pathw, + FILE_READ_ATTRIBUTES, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + flags, + NULL); + if (handle == INVALID_HANDLE_VALUE) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } + + if (fs__stat_handle(handle, &req->statbuf) != 0) { + DWORD error = GetLastError(); + if (do_lstat && error == ERROR_SYMLINK_NOT_SUPPORTED) { + /* We opened a reparse point but it was not a symlink. Try again. */ + fs__stat_impl(req, 0); + + } else { + /* Stat failed. */ + SET_REQ_WIN32_ERROR(req, GetLastError()); + } + + CloseHandle(handle); + return; + } + + req->ptr = &req->statbuf; + req->result = 0; + CloseHandle(handle); +} + + +static void fs__stat(uv_fs_t* req) { + fs__stat_prepare_path(req->file.pathw); + fs__stat_impl(req, 0); +} + + +static void fs__lstat(uv_fs_t* req) { + fs__stat_prepare_path(req->file.pathw); + fs__stat_impl(req, 1); +} + + +static void fs__fstat(uv_fs_t* req) { + int fd = req->file.fd; + HANDLE handle; + + VERIFY_FD(fd, req); + + handle = uv__get_osfhandle(fd); + + if (handle == INVALID_HANDLE_VALUE) { + SET_REQ_WIN32_ERROR(req, ERROR_INVALID_HANDLE); + return; + } + + if (fs__stat_handle(handle, &req->statbuf) != 0) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } + + req->ptr = &req->statbuf; + req->result = 0; +} + + +static void fs__rename(uv_fs_t* req) { + if (!MoveFileExW(req->file.pathw, req->fs.info.new_pathw, MOVEFILE_REPLACE_EXISTING)) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } + + SET_REQ_RESULT(req, 0); +} + + +INLINE static void fs__sync_impl(uv_fs_t* req) { + int fd = req->file.fd; + int result; + + VERIFY_FD(fd, req); + + result = FlushFileBuffers(uv__get_osfhandle(fd)) ? 0 : -1; + if (result == -1) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + } else { + SET_REQ_RESULT(req, result); + } +} + + +static void fs__fsync(uv_fs_t* req) { + fs__sync_impl(req); +} + + +static void fs__fdatasync(uv_fs_t* req) { + fs__sync_impl(req); +} + + +static void fs__ftruncate(uv_fs_t* req) { + int fd = req->file.fd; + HANDLE handle; + NTSTATUS status; + IO_STATUS_BLOCK io_status; + FILE_END_OF_FILE_INFORMATION eof_info; + + VERIFY_FD(fd, req); + + handle = uv__get_osfhandle(fd); + + eof_info.EndOfFile.QuadPart = req->fs.info.offset; + + status = pNtSetInformationFile(handle, + &io_status, + &eof_info, + sizeof eof_info, + FileEndOfFileInformation); + + if (NT_SUCCESS(status)) { + SET_REQ_RESULT(req, 0); + } else { + SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(status)); + } +} + + +static void fs__sendfile(uv_fs_t* req) { + int fd_in = req->file.fd, fd_out = req->fs.info.fd_out; + size_t length = req->fs.info.bufsml[0].len; + int64_t offset = req->fs.info.offset; + const size_t max_buf_size = 65536; + size_t buf_size = length < max_buf_size ? length : max_buf_size; + int n, result = 0; + int64_t result_offset = 0; + char* buf = (char*) uv__malloc(buf_size); + if (!buf) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + if (offset != -1) { + result_offset = _lseeki64(fd_in, offset, SEEK_SET); + } + + if (result_offset == -1) { + result = -1; + } else { + while (length > 0) { + n = _read(fd_in, buf, length < buf_size ? length : buf_size); + if (n == 0) { + break; + } else if (n == -1) { + result = -1; + break; + } + + length -= n; + + n = _write(fd_out, buf, n); + if (n == -1) { + result = -1; + break; + } + + result += n; + } + } + + uv__free(buf); + + SET_REQ_RESULT(req, result); +} + + +static void fs__access(uv_fs_t* req) { + DWORD attr = GetFileAttributesW(req->file.pathw); + + if (attr == INVALID_FILE_ATTRIBUTES) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } + + /* + * Access is possible if + * - write access wasn't requested, + * - or the file isn't read-only, + * - or it's a directory. + * (Directories cannot be read-only on Windows.) + */ + if (!(req->flags & W_OK) || + !(attr & FILE_ATTRIBUTE_READONLY) || + (attr & FILE_ATTRIBUTE_DIRECTORY)) { + SET_REQ_RESULT(req, 0); + } else { + SET_REQ_WIN32_ERROR(req, UV_EPERM); + } + +} + + +static void fs__chmod(uv_fs_t* req) { + int result = _wchmod(req->file.pathw, req->fs.info.mode); + SET_REQ_RESULT(req, result); +} + + +static void fs__fchmod(uv_fs_t* req) { + int fd = req->file.fd; + HANDLE handle; + NTSTATUS nt_status; + IO_STATUS_BLOCK io_status; + FILE_BASIC_INFORMATION file_info; + + VERIFY_FD(fd, req); + + handle = uv__get_osfhandle(fd); + + nt_status = pNtQueryInformationFile(handle, + &io_status, + &file_info, + sizeof file_info, + FileBasicInformation); + + if (!NT_SUCCESS(nt_status)) { + SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status)); + return; + } + + if (req->fs.info.mode & _S_IWRITE) { + file_info.FileAttributes &= ~FILE_ATTRIBUTE_READONLY; + } else { + file_info.FileAttributes |= FILE_ATTRIBUTE_READONLY; + } + + nt_status = pNtSetInformationFile(handle, + &io_status, + &file_info, + sizeof file_info, + FileBasicInformation); + + if (!NT_SUCCESS(nt_status)) { + SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status)); + return; + } + + SET_REQ_SUCCESS(req); +} + + +INLINE static int fs__utime_handle(HANDLE handle, double atime, double mtime) { + FILETIME filetime_a, filetime_m; + + TIME_T_TO_FILETIME((time_t) atime, &filetime_a); + TIME_T_TO_FILETIME((time_t) mtime, &filetime_m); + + if (!SetFileTime(handle, NULL, &filetime_a, &filetime_m)) { + return -1; + } + + return 0; +} + + +static void fs__utime(uv_fs_t* req) { + HANDLE handle; + + handle = CreateFileW(req->file.pathw, + FILE_WRITE_ATTRIBUTES, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + NULL); + + if (handle == INVALID_HANDLE_VALUE) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } + + if (fs__utime_handle(handle, req->fs.time.atime, req->fs.time.mtime) != 0) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + CloseHandle(handle); + return; + } + + CloseHandle(handle); + + req->result = 0; +} + + +static void fs__futime(uv_fs_t* req) { + int fd = req->file.fd; + HANDLE handle; + VERIFY_FD(fd, req); + + handle = uv__get_osfhandle(fd); + + if (handle == INVALID_HANDLE_VALUE) { + SET_REQ_WIN32_ERROR(req, ERROR_INVALID_HANDLE); + return; + } + + if (fs__utime_handle(handle, req->fs.time.atime, req->fs.time.mtime) != 0) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } + + req->result = 0; +} + + +static void fs__link(uv_fs_t* req) { + DWORD r = CreateHardLinkW(req->fs.info.new_pathw, req->file.pathw, NULL); + if (r == 0) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + } else { + req->result = 0; + } +} + + +static void fs__create_junction(uv_fs_t* req, const WCHAR* path, + const WCHAR* new_path) { + HANDLE handle = INVALID_HANDLE_VALUE; + REPARSE_DATA_BUFFER *buffer = NULL; + int created = 0; + int target_len; + int is_absolute, is_long_path; + int needed_buf_size, used_buf_size, used_data_size, path_buf_len; + int start, len, i; + int add_slash; + DWORD bytes; + WCHAR* path_buf; + + target_len = wcslen(path); + is_long_path = wcsncmp(path, LONG_PATH_PREFIX, LONG_PATH_PREFIX_LEN) == 0; + + if (is_long_path) { + is_absolute = 1; + } else { + is_absolute = target_len >= 3 && IS_LETTER(path[0]) && + path[1] == L':' && IS_SLASH(path[2]); + } + + if (!is_absolute) { + /* Not supporting relative paths */ + SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_NOT_SUPPORTED); + return; + } + + /* Do a pessimistic calculation of the required buffer size */ + needed_buf_size = + FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer) + + JUNCTION_PREFIX_LEN * sizeof(WCHAR) + + 2 * (target_len + 2) * sizeof(WCHAR); + + /* Allocate the buffer */ + buffer = (REPARSE_DATA_BUFFER*)uv__malloc(needed_buf_size); + if (!buffer) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + /* Grab a pointer to the part of the buffer where filenames go */ + path_buf = (WCHAR*)&(buffer->MountPointReparseBuffer.PathBuffer); + path_buf_len = 0; + + /* Copy the substitute (internal) target path */ + start = path_buf_len; + + wcsncpy((WCHAR*)&path_buf[path_buf_len], JUNCTION_PREFIX, + JUNCTION_PREFIX_LEN); + path_buf_len += JUNCTION_PREFIX_LEN; + + add_slash = 0; + for (i = is_long_path ? LONG_PATH_PREFIX_LEN : 0; path[i] != L'\0'; i++) { + if (IS_SLASH(path[i])) { + add_slash = 1; + continue; + } + + if (add_slash) { + path_buf[path_buf_len++] = L'\\'; + add_slash = 0; + } + + path_buf[path_buf_len++] = path[i]; + } + path_buf[path_buf_len++] = L'\\'; + len = path_buf_len - start; + + /* Set the info about the substitute name */ + buffer->MountPointReparseBuffer.SubstituteNameOffset = start * sizeof(WCHAR); + buffer->MountPointReparseBuffer.SubstituteNameLength = len * sizeof(WCHAR); + + /* Insert null terminator */ + path_buf[path_buf_len++] = L'\0'; + + /* Copy the print name of the target path */ + start = path_buf_len; + add_slash = 0; + for (i = is_long_path ? LONG_PATH_PREFIX_LEN : 0; path[i] != L'\0'; i++) { + if (IS_SLASH(path[i])) { + add_slash = 1; + continue; + } + + if (add_slash) { + path_buf[path_buf_len++] = L'\\'; + add_slash = 0; + } + + path_buf[path_buf_len++] = path[i]; + } + len = path_buf_len - start; + if (len == 2) { + path_buf[path_buf_len++] = L'\\'; + len++; + } + + /* Set the info about the print name */ + buffer->MountPointReparseBuffer.PrintNameOffset = start * sizeof(WCHAR); + buffer->MountPointReparseBuffer.PrintNameLength = len * sizeof(WCHAR); + + /* Insert another null terminator */ + path_buf[path_buf_len++] = L'\0'; + + /* Calculate how much buffer space was actually used */ + used_buf_size = FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer) + + path_buf_len * sizeof(WCHAR); + used_data_size = used_buf_size - + FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer); + + /* Put general info in the data buffer */ + buffer->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; + buffer->ReparseDataLength = used_data_size; + buffer->Reserved = 0; + + /* Create a new directory */ + if (!CreateDirectoryW(new_path, NULL)) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + goto error; + } + created = 1; + + /* Open the directory */ + handle = CreateFileW(new_path, + GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | + FILE_FLAG_OPEN_REPARSE_POINT, + NULL); + if (handle == INVALID_HANDLE_VALUE) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + goto error; + } + + /* Create the actual reparse point */ + if (!DeviceIoControl(handle, + FSCTL_SET_REPARSE_POINT, + buffer, + used_buf_size, + NULL, + 0, + &bytes, + NULL)) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + goto error; + } + + /* Clean up */ + CloseHandle(handle); + uv__free(buffer); + + SET_REQ_RESULT(req, 0); + return; + +error: + uv__free(buffer); + + if (handle != INVALID_HANDLE_VALUE) { + CloseHandle(handle); + } + + if (created) { + RemoveDirectoryW(new_path); + } +} + + +static void fs__symlink(uv_fs_t* req) { + WCHAR* pathw = req->file.pathw; + WCHAR* new_pathw = req->fs.info.new_pathw; + int flags = req->fs.info.file_flags; + int result; + + + if (flags & UV_FS_SYMLINK_JUNCTION) { + fs__create_junction(req, pathw, new_pathw); + } else if (pCreateSymbolicLinkW) { + result = pCreateSymbolicLinkW(new_pathw, + pathw, + flags & UV_FS_SYMLINK_DIR ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0) ? 0 : -1; + if (result == -1) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + } else { + SET_REQ_RESULT(req, result); + } + } else { + SET_REQ_UV_ERROR(req, UV_ENOSYS, ERROR_NOT_SUPPORTED); + } +} + + +static void fs__readlink(uv_fs_t* req) { + HANDLE handle; + + handle = CreateFileW(req->file.pathw, + 0, + 0, + NULL, + OPEN_EXISTING, + FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, + NULL); + + if (handle == INVALID_HANDLE_VALUE) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } + + if (fs__readlink_handle(handle, (char**) &req->ptr, NULL) != 0) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + CloseHandle(handle); + return; + } + + req->flags |= UV_FS_FREE_PTR; + SET_REQ_RESULT(req, 0); + + CloseHandle(handle); +} + + +static size_t fs__realpath_handle(HANDLE handle, char** realpath_ptr) { + int r; + DWORD w_realpath_len; + WCHAR* w_realpath_ptr; + WCHAR* w_finalpath_ptr = NULL; + + w_realpath_len = pGetFinalPathNameByHandleW(handle, NULL, 0, VOLUME_NAME_DOS); + if (w_realpath_len == 0) { + return -1; + } + + w_realpath_ptr = uv__malloc((w_realpath_len + 1) * sizeof(WCHAR)); + if (w_realpath_ptr == NULL) { + SetLastError(ERROR_OUTOFMEMORY); + return -1; + } + + if (pGetFinalPathNameByHandleW(handle, + w_realpath_ptr, + w_realpath_len, + VOLUME_NAME_DOS) == 0) { + uv__free(w_realpath_ptr); + SetLastError(ERROR_INVALID_HANDLE); + return -1; + } + + /* convert UNC path to long path */ + if (wcsncmp(w_realpath_ptr, + UNC_PATH_PREFIX, + UNC_PATH_PREFIX_LEN) == 0) { + w_finalpath_ptr = w_realpath_ptr + 6; + *w_finalpath_ptr = L'\\'; + } else if (wcsncmp(w_realpath_ptr, + LONG_PATH_PREFIX, + LONG_PATH_PREFIX_LEN) == 0) { + w_finalpath_ptr = w_realpath_ptr + 4; + } else { + uv__free(w_realpath_ptr); + SetLastError(ERROR_INVALID_HANDLE); + return -1; + } + + r = fs__wide_to_utf8(w_finalpath_ptr, w_realpath_len, realpath_ptr, NULL); + uv__free(w_realpath_ptr); + return r; +} + +static void fs__realpath(uv_fs_t* req) { + HANDLE handle; + + if (!pGetFinalPathNameByHandleW) { + SET_REQ_UV_ERROR(req, UV_ENOSYS, ERROR_NOT_SUPPORTED); + return; + } + + handle = CreateFileW(req->file.pathw, + 0, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, + NULL); + if (handle == INVALID_HANDLE_VALUE) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } + + if (fs__realpath_handle(handle, (char**) &req->ptr) == -1) { + CloseHandle(handle); + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } + + CloseHandle(handle); + req->flags |= UV_FS_FREE_PTR; + SET_REQ_RESULT(req, 0); +} + + +static void fs__chown(uv_fs_t* req) { + req->result = 0; +} + + +static void fs__fchown(uv_fs_t* req) { + req->result = 0; +} + + +static void uv__fs_work(struct uv__work* w) { + uv_fs_t* req; + + req = container_of(w, uv_fs_t, work_req); + assert(req->type == UV_FS); + +#define XX(uc, lc) case UV_FS_##uc: fs__##lc(req); break; + switch (req->fs_type) { + XX(OPEN, open) + XX(CLOSE, close) + XX(READ, read) + XX(WRITE, write) + XX(SENDFILE, sendfile) + XX(STAT, stat) + XX(LSTAT, lstat) + XX(FSTAT, fstat) + XX(FTRUNCATE, ftruncate) + XX(UTIME, utime) + XX(FUTIME, futime) + XX(ACCESS, access) + XX(CHMOD, chmod) + XX(FCHMOD, fchmod) + XX(FSYNC, fsync) + XX(FDATASYNC, fdatasync) + XX(UNLINK, unlink) + XX(RMDIR, rmdir) + XX(MKDIR, mkdir) + XX(MKDTEMP, mkdtemp) + XX(RENAME, rename) + XX(SCANDIR, scandir) + XX(LINK, link) + XX(SYMLINK, symlink) + XX(READLINK, readlink) + XX(REALPATH, realpath) + XX(CHOWN, chown) + XX(FCHOWN, fchown); + default: + assert(!"bad uv_fs_type"); + } +} + + +static void uv__fs_done(struct uv__work* w, int status) { + uv_fs_t* req; + + req = container_of(w, uv_fs_t, work_req); + uv__req_unregister(req->loop, req); + + if (status == UV_ECANCELED) { + assert(req->result == 0); + req->result = UV_ECANCELED; + } + + req->cb(req); +} + + +void uv_fs_req_cleanup(uv_fs_t* req) { + if (req->flags & UV_FS_CLEANEDUP) + return; + + if (req->flags & UV_FS_FREE_PATHS) + uv__free(req->file.pathw); + + if (req->flags & UV_FS_FREE_PTR) + uv__free(req->ptr); + + req->path = NULL; + req->file.pathw = NULL; + req->fs.info.new_pathw = NULL; + req->ptr = NULL; + + req->flags |= UV_FS_CLEANEDUP; +} + + +int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, + int mode, uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_OPEN, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + req->fs.info.file_flags = flags; + req->fs.info.mode = mode; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__open(req); + return req->result; + } +} + + +int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_fs_cb cb) { + uv_fs_req_init(loop, req, UV_FS_CLOSE, cb); + req->file.fd = fd; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__close(req); + return req->result; + } +} + + +int uv_fs_read(uv_loop_t* loop, + uv_fs_t* req, + uv_file fd, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t offset, + uv_fs_cb cb) { + if (bufs == NULL || nbufs == 0) + return UV_EINVAL; + + uv_fs_req_init(loop, req, UV_FS_READ, cb); + + req->file.fd = fd; + + req->fs.info.nbufs = nbufs; + req->fs.info.bufs = req->fs.info.bufsml; + if (nbufs > ARRAY_SIZE(req->fs.info.bufsml)) + req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs)); + + if (req->fs.info.bufs == NULL) + return UV_ENOMEM; + + memcpy(req->fs.info.bufs, bufs, nbufs * sizeof(*bufs)); + + req->fs.info.offset = offset; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__read(req); + return req->result; + } +} + + +int uv_fs_write(uv_loop_t* loop, + uv_fs_t* req, + uv_file fd, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t offset, + uv_fs_cb cb) { + if (bufs == NULL || nbufs == 0) + return UV_EINVAL; + + uv_fs_req_init(loop, req, UV_FS_WRITE, cb); + + req->file.fd = fd; + + req->fs.info.nbufs = nbufs; + req->fs.info.bufs = req->fs.info.bufsml; + if (nbufs > ARRAY_SIZE(req->fs.info.bufsml)) + req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs)); + + if (req->fs.info.bufs == NULL) + return UV_ENOMEM; + + memcpy(req->fs.info.bufs, bufs, nbufs * sizeof(*bufs)); + + req->fs.info.offset = offset; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__write(req); + return req->result; + } +} + + +int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, + uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_UNLINK, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__unlink(req); + return req->result; + } +} + + +int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, + uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_MKDIR, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + req->fs.info.mode = mode; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__mkdir(req); + return req->result; + } +} + + +int uv_fs_mkdtemp(uv_loop_t* loop, uv_fs_t* req, const char* tpl, + uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_MKDTEMP, cb); + + err = fs__capture_path(req, tpl, NULL, TRUE); + if (err) + return uv_translate_sys_error(err); + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__mkdtemp(req); + return req->result; + } +} + + +int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_RMDIR, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__rmdir(req); + return req->result; + } +} + + +int uv_fs_scandir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, + uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_SCANDIR, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + req->fs.info.file_flags = flags; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__scandir(req); + return req->result; + } +} + + +int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path, + const char* new_path, uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_LINK, cb); + + err = fs__capture_path(req, path, new_path, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__link(req); + return req->result; + } +} + + +int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path, + const char* new_path, int flags, uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_SYMLINK, cb); + + err = fs__capture_path(req, path, new_path, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + req->fs.info.file_flags = flags; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__symlink(req); + return req->result; + } +} + + +int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path, + uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_READLINK, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__readlink(req); + return req->result; + } +} + + +int uv_fs_realpath(uv_loop_t* loop, uv_fs_t* req, const char* path, + uv_fs_cb cb) { + int err; + + if (!req || !path) { + return UV_EINVAL; + } + + uv_fs_req_init(loop, req, UV_FS_REALPATH, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__realpath(req); + return req->result; + } +} + + +int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, + uv_gid_t gid, uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_CHOWN, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__chown(req); + return req->result; + } +} + + +int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_uid_t uid, + uv_gid_t gid, uv_fs_cb cb) { + uv_fs_req_init(loop, req, UV_FS_FCHOWN, cb); + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__fchown(req); + return req->result; + } +} + + +int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_STAT, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__stat(req); + return req->result; + } +} + + +int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_LSTAT, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__lstat(req); + return req->result; + } +} + + +int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_fs_cb cb) { + uv_fs_req_init(loop, req, UV_FS_FSTAT, cb); + req->file.fd = fd; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__fstat(req); + return req->result; + } +} + + +int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, + const char* new_path, uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_RENAME, cb); + + err = fs__capture_path(req, path, new_path, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__rename(req); + return req->result; + } +} + + +int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_fs_cb cb) { + uv_fs_req_init(loop, req, UV_FS_FSYNC, cb); + req->file.fd = fd; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__fsync(req); + return req->result; + } +} + + +int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_fs_cb cb) { + uv_fs_req_init(loop, req, UV_FS_FDATASYNC, cb); + req->file.fd = fd; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__fdatasync(req); + return req->result; + } +} + + +int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file fd, + int64_t offset, uv_fs_cb cb) { + uv_fs_req_init(loop, req, UV_FS_FTRUNCATE, cb); + + req->file.fd = fd; + req->fs.info.offset = offset; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__ftruncate(req); + return req->result; + } +} + + + +int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file fd_out, + uv_file fd_in, int64_t in_offset, size_t length, uv_fs_cb cb) { + uv_fs_req_init(loop, req, UV_FS_SENDFILE, cb); + + req->file.fd = fd_in; + req->fs.info.fd_out = fd_out; + req->fs.info.offset = in_offset; + req->fs.info.bufsml[0].len = length; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__sendfile(req); + return req->result; + } +} + + +int uv_fs_access(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_ACCESS, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) + return uv_translate_sys_error(err); + + req->flags = flags; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } + + fs__access(req); + return req->result; +} + + +int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, + uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_CHMOD, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + req->fs.info.mode = mode; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__chmod(req); + return req->result; + } +} + + +int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file fd, int mode, + uv_fs_cb cb) { + uv_fs_req_init(loop, req, UV_FS_FCHMOD, cb); + + req->file.fd = fd; + req->fs.info.mode = mode; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__fchmod(req); + return req->result; + } +} + + +int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime, + double mtime, uv_fs_cb cb) { + int err; + + uv_fs_req_init(loop, req, UV_FS_UTIME, cb); + + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + + req->fs.time.atime = atime; + req->fs.time.mtime = mtime; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__utime(req); + return req->result; + } +} + + +int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file fd, double atime, + double mtime, uv_fs_cb cb) { + uv_fs_req_init(loop, req, UV_FS_FUTIME, cb); + + req->file.fd = fd; + req->fs.time.atime = atime; + req->fs.time.mtime = mtime; + + if (cb) { + QUEUE_FS_TP_JOB(loop, req); + return 0; + } else { + fs__futime(req); + return req->result; + } +} diff --git a/3rdparty/libuv/src/win/getaddrinfo.c b/3rdparty/libuv/src/win/getaddrinfo.c new file mode 100644 index 00000000000..ceed3b7638b --- /dev/null +++ b/3rdparty/libuv/src/win/getaddrinfo.c @@ -0,0 +1,358 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include + +#include "uv.h" +#include "internal.h" +#include "req-inl.h" + +/* EAI_* constants. */ +#include + + +int uv__getaddrinfo_translate_error(int sys_err) { + switch (sys_err) { + case 0: return 0; + case WSATRY_AGAIN: return UV_EAI_AGAIN; + case WSAEINVAL: return UV_EAI_BADFLAGS; + case WSANO_RECOVERY: return UV_EAI_FAIL; + case WSAEAFNOSUPPORT: return UV_EAI_FAMILY; + case WSA_NOT_ENOUGH_MEMORY: return UV_EAI_MEMORY; + case WSAHOST_NOT_FOUND: return UV_EAI_NONAME; + case WSATYPE_NOT_FOUND: return UV_EAI_SERVICE; + case WSAESOCKTNOSUPPORT: return UV_EAI_SOCKTYPE; + default: return uv_translate_sys_error(sys_err); + } +} + + +/* + * MinGW is missing this + */ +#if !defined(_MSC_VER) && !defined(__MINGW64_VERSION_MAJOR) + typedef struct addrinfoW { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + size_t ai_addrlen; + WCHAR* ai_canonname; + struct sockaddr* ai_addr; + struct addrinfoW* ai_next; + } ADDRINFOW, *PADDRINFOW; + + DECLSPEC_IMPORT int WSAAPI GetAddrInfoW(const WCHAR* node, + const WCHAR* service, + const ADDRINFOW* hints, + PADDRINFOW* result); + + DECLSPEC_IMPORT void WSAAPI FreeAddrInfoW(PADDRINFOW pAddrInfo); +#endif + + +/* adjust size value to be multiple of 4. Use to keep pointer aligned */ +/* Do we need different versions of this for different architectures? */ +#define ALIGNED_SIZE(X) ((((X) + 3) >> 2) << 2) + + +static void uv__getaddrinfo_work(struct uv__work* w) { + uv_getaddrinfo_t* req; + struct addrinfoW* hints; + int err; + + req = container_of(w, uv_getaddrinfo_t, work_req); + hints = req->addrinfow; + req->addrinfow = NULL; + err = GetAddrInfoW(req->node, req->service, hints, &req->addrinfow); + req->retcode = uv__getaddrinfo_translate_error(err); +} + + +/* + * Called from uv_run when complete. Call user specified callback + * then free returned addrinfo + * Returned addrinfo strings are converted from UTF-16 to UTF-8. + * + * To minimize allocation we calculate total size required, + * and copy all structs and referenced strings into the one block. + * Each size calculation is adjusted to avoid unaligned pointers. + */ +static void uv__getaddrinfo_done(struct uv__work* w, int status) { + uv_getaddrinfo_t* req; + int addrinfo_len = 0; + int name_len = 0; + size_t addrinfo_struct_len = ALIGNED_SIZE(sizeof(struct addrinfo)); + struct addrinfoW* addrinfow_ptr; + struct addrinfo* addrinfo_ptr; + char* alloc_ptr = NULL; + char* cur_ptr = NULL; + + req = container_of(w, uv_getaddrinfo_t, work_req); + + /* release input parameter memory */ + uv__free(req->alloc); + req->alloc = NULL; + + if (status == UV_ECANCELED) { + assert(req->retcode == 0); + req->retcode = UV_EAI_CANCELED; + goto complete; + } + + if (req->retcode == 0) { + /* convert addrinfoW to addrinfo */ + /* first calculate required length */ + addrinfow_ptr = req->addrinfow; + while (addrinfow_ptr != NULL) { + addrinfo_len += addrinfo_struct_len + + ALIGNED_SIZE(addrinfow_ptr->ai_addrlen); + if (addrinfow_ptr->ai_canonname != NULL) { + name_len = uv_utf16_to_utf8(addrinfow_ptr->ai_canonname, -1, NULL, 0); + if (name_len == 0) { + req->retcode = uv_translate_sys_error(GetLastError()); + goto complete; + } + addrinfo_len += ALIGNED_SIZE(name_len); + } + addrinfow_ptr = addrinfow_ptr->ai_next; + } + + /* allocate memory for addrinfo results */ + alloc_ptr = (char*)uv__malloc(addrinfo_len); + + /* do conversions */ + if (alloc_ptr != NULL) { + cur_ptr = alloc_ptr; + addrinfow_ptr = req->addrinfow; + + while (addrinfow_ptr != NULL) { + /* copy addrinfo struct data */ + assert(cur_ptr + addrinfo_struct_len <= alloc_ptr + addrinfo_len); + addrinfo_ptr = (struct addrinfo*)cur_ptr; + addrinfo_ptr->ai_family = addrinfow_ptr->ai_family; + addrinfo_ptr->ai_socktype = addrinfow_ptr->ai_socktype; + addrinfo_ptr->ai_protocol = addrinfow_ptr->ai_protocol; + addrinfo_ptr->ai_flags = addrinfow_ptr->ai_flags; + addrinfo_ptr->ai_addrlen = addrinfow_ptr->ai_addrlen; + addrinfo_ptr->ai_canonname = NULL; + addrinfo_ptr->ai_addr = NULL; + addrinfo_ptr->ai_next = NULL; + + cur_ptr += addrinfo_struct_len; + + /* copy sockaddr */ + if (addrinfo_ptr->ai_addrlen > 0) { + assert(cur_ptr + addrinfo_ptr->ai_addrlen <= + alloc_ptr + addrinfo_len); + memcpy(cur_ptr, addrinfow_ptr->ai_addr, addrinfo_ptr->ai_addrlen); + addrinfo_ptr->ai_addr = (struct sockaddr*)cur_ptr; + cur_ptr += ALIGNED_SIZE(addrinfo_ptr->ai_addrlen); + } + + /* convert canonical name to UTF-8 */ + if (addrinfow_ptr->ai_canonname != NULL) { + name_len = uv_utf16_to_utf8(addrinfow_ptr->ai_canonname, + -1, + NULL, + 0); + assert(name_len > 0); + assert(cur_ptr + name_len <= alloc_ptr + addrinfo_len); + name_len = uv_utf16_to_utf8(addrinfow_ptr->ai_canonname, + -1, + cur_ptr, + name_len); + assert(name_len > 0); + addrinfo_ptr->ai_canonname = cur_ptr; + cur_ptr += ALIGNED_SIZE(name_len); + } + assert(cur_ptr <= alloc_ptr + addrinfo_len); + + /* set next ptr */ + addrinfow_ptr = addrinfow_ptr->ai_next; + if (addrinfow_ptr != NULL) { + addrinfo_ptr->ai_next = (struct addrinfo*)cur_ptr; + } + } + req->addrinfo = (struct addrinfo*)alloc_ptr; + } else { + req->retcode = UV_EAI_MEMORY; + } + } + + /* return memory to system */ + if (req->addrinfow != NULL) { + FreeAddrInfoW(req->addrinfow); + req->addrinfow = NULL; + } + +complete: + uv__req_unregister(req->loop, req); + + /* finally do callback with converted result */ + if (req->getaddrinfo_cb) + req->getaddrinfo_cb(req, req->retcode, req->addrinfo); +} + + +void uv_freeaddrinfo(struct addrinfo* ai) { + char* alloc_ptr = (char*)ai; + + /* release copied result memory */ + uv__free(alloc_ptr); +} + + +/* + * Entry point for getaddrinfo + * we convert the UTF-8 strings to UNICODE + * and save the UNICODE string pointers in the req + * We also copy hints so that caller does not need to keep memory until the + * callback. + * return 0 if a callback will be made + * return error code if validation fails + * + * To minimize allocation we calculate total size required, + * and copy all structs and referenced strings into the one block. + * Each size calculation is adjusted to avoid unaligned pointers. + */ +int uv_getaddrinfo(uv_loop_t* loop, + uv_getaddrinfo_t* req, + uv_getaddrinfo_cb getaddrinfo_cb, + const char* node, + const char* service, + const struct addrinfo* hints) { + int nodesize = 0; + int servicesize = 0; + int hintssize = 0; + char* alloc_ptr = NULL; + int err; + + if (req == NULL || (node == NULL && service == NULL)) { + err = WSAEINVAL; + goto error; + } + + uv_req_init(loop, (uv_req_t*)req); + + req->getaddrinfo_cb = getaddrinfo_cb; + req->addrinfo = NULL; + req->type = UV_GETADDRINFO; + req->loop = loop; + req->retcode = 0; + + /* calculate required memory size for all input values */ + if (node != NULL) { + nodesize = ALIGNED_SIZE(uv_utf8_to_utf16(node, NULL, 0) * sizeof(WCHAR)); + if (nodesize == 0) { + err = GetLastError(); + goto error; + } + } + + if (service != NULL) { + servicesize = ALIGNED_SIZE(uv_utf8_to_utf16(service, NULL, 0) * + sizeof(WCHAR)); + if (servicesize == 0) { + err = GetLastError(); + goto error; + } + } + if (hints != NULL) { + hintssize = ALIGNED_SIZE(sizeof(struct addrinfoW)); + } + + /* allocate memory for inputs, and partition it as needed */ + alloc_ptr = (char*)uv__malloc(nodesize + servicesize + hintssize); + if (!alloc_ptr) { + err = WSAENOBUFS; + goto error; + } + + /* save alloc_ptr now so we can free if error */ + req->alloc = (void*)alloc_ptr; + + /* convert node string to UTF16 into allocated memory and save pointer in */ + /* the request. */ + if (node != NULL) { + req->node = (WCHAR*)alloc_ptr; + if (uv_utf8_to_utf16(node, + (WCHAR*) alloc_ptr, + nodesize / sizeof(WCHAR)) == 0) { + err = GetLastError(); + goto error; + } + alloc_ptr += nodesize; + } else { + req->node = NULL; + } + + /* convert service string to UTF16 into allocated memory and save pointer */ + /* in the req. */ + if (service != NULL) { + req->service = (WCHAR*)alloc_ptr; + if (uv_utf8_to_utf16(service, + (WCHAR*) alloc_ptr, + servicesize / sizeof(WCHAR)) == 0) { + err = GetLastError(); + goto error; + } + alloc_ptr += servicesize; + } else { + req->service = NULL; + } + + /* copy hints to allocated memory and save pointer in req */ + if (hints != NULL) { + req->addrinfow = (struct addrinfoW*)alloc_ptr; + req->addrinfow->ai_family = hints->ai_family; + req->addrinfow->ai_socktype = hints->ai_socktype; + req->addrinfow->ai_protocol = hints->ai_protocol; + req->addrinfow->ai_flags = hints->ai_flags; + req->addrinfow->ai_addrlen = 0; + req->addrinfow->ai_canonname = NULL; + req->addrinfow->ai_addr = NULL; + req->addrinfow->ai_next = NULL; + } else { + req->addrinfow = NULL; + } + + uv__req_register(loop, req); + + if (getaddrinfo_cb) { + uv__work_submit(loop, + &req->work_req, + uv__getaddrinfo_work, + uv__getaddrinfo_done); + return 0; + } else { + uv__getaddrinfo_work(&req->work_req); + uv__getaddrinfo_done(&req->work_req, 0); + return req->retcode; + } + +error: + if (req != NULL) { + uv__free(req->alloc); + req->alloc = NULL; + } + return uv_translate_sys_error(err); +} diff --git a/3rdparty/libuv/src/win/getnameinfo.c b/3rdparty/libuv/src/win/getnameinfo.c new file mode 100644 index 00000000000..66b64b88324 --- /dev/null +++ b/3rdparty/libuv/src/win/getnameinfo.c @@ -0,0 +1,150 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to +* deal in the Software without restriction, including without limitation the +* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +* sell copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +*/ + +#include +#include + +#include "uv.h" +#include "internal.h" +#include "req-inl.h" + +#ifndef GetNameInfo +int WSAAPI GetNameInfoW( + const SOCKADDR *pSockaddr, + socklen_t SockaddrLength, + PWCHAR pNodeBuffer, + DWORD NodeBufferSize, + PWCHAR pServiceBuffer, + DWORD ServiceBufferSize, + INT Flags +); +#endif + +static void uv__getnameinfo_work(struct uv__work* w) { + uv_getnameinfo_t* req; + WCHAR host[NI_MAXHOST]; + WCHAR service[NI_MAXSERV]; + int ret = 0; + + req = container_of(w, uv_getnameinfo_t, work_req); + if (GetNameInfoW((struct sockaddr*)&req->storage, + sizeof(req->storage), + host, + ARRAY_SIZE(host), + service, + ARRAY_SIZE(service), + req->flags)) { + ret = WSAGetLastError(); + } + req->retcode = uv__getaddrinfo_translate_error(ret); + + /* convert results to UTF-8 */ + WideCharToMultiByte(CP_UTF8, + 0, + host, + -1, + req->host, + sizeof(req->host), + NULL, + NULL); + + WideCharToMultiByte(CP_UTF8, + 0, + service, + -1, + req->service, + sizeof(req->service), + NULL, + NULL); +} + + +/* +* Called from uv_run when complete. +*/ +static void uv__getnameinfo_done(struct uv__work* w, int status) { + uv_getnameinfo_t* req; + char* host; + char* service; + + req = container_of(w, uv_getnameinfo_t, work_req); + uv__req_unregister(req->loop, req); + host = service = NULL; + + if (status == UV_ECANCELED) { + assert(req->retcode == 0); + req->retcode = UV_EAI_CANCELED; + } else if (req->retcode == 0) { + host = req->host; + service = req->service; + } + + if (req->getnameinfo_cb) + req->getnameinfo_cb(req, req->retcode, host, service); +} + + +/* +* Entry point for getnameinfo +* return 0 if a callback will be made +* return error code if validation fails +*/ +int uv_getnameinfo(uv_loop_t* loop, + uv_getnameinfo_t* req, + uv_getnameinfo_cb getnameinfo_cb, + const struct sockaddr* addr, + int flags) { + if (req == NULL || addr == NULL) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) { + memcpy(&req->storage, + addr, + sizeof(struct sockaddr_in)); + } else if (addr->sa_family == AF_INET6) { + memcpy(&req->storage, + addr, + sizeof(struct sockaddr_in6)); + } else { + return UV_EINVAL; + } + + uv_req_init(loop, (uv_req_t*)req); + uv__req_register(loop, req); + + req->getnameinfo_cb = getnameinfo_cb; + req->flags = flags; + req->type = UV_GETNAMEINFO; + req->loop = loop; + req->retcode = 0; + + if (getnameinfo_cb) { + uv__work_submit(loop, + &req->work_req, + uv__getnameinfo_work, + uv__getnameinfo_done); + return 0; + } else { + uv__getnameinfo_work(&req->work_req); + uv__getnameinfo_done(&req->work_req, 0); + return req->retcode; + } +} diff --git a/3rdparty/libuv/src/win/handle-inl.h b/3rdparty/libuv/src/win/handle-inl.h new file mode 100644 index 00000000000..8d0334cc52a --- /dev/null +++ b/3rdparty/libuv/src/win/handle-inl.h @@ -0,0 +1,179 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_WIN_HANDLE_INL_H_ +#define UV_WIN_HANDLE_INL_H_ + +#include +#include + +#include "uv.h" +#include "internal.h" + + +#define DECREASE_ACTIVE_COUNT(loop, handle) \ + do { \ + if (--(handle)->activecnt == 0 && \ + !((handle)->flags & UV__HANDLE_CLOSING)) { \ + uv__handle_stop((handle)); \ + } \ + assert((handle)->activecnt >= 0); \ + } while (0) + + +#define INCREASE_ACTIVE_COUNT(loop, handle) \ + do { \ + if ((handle)->activecnt++ == 0) { \ + uv__handle_start((handle)); \ + } \ + assert((handle)->activecnt > 0); \ + } while (0) + + +#define DECREASE_PENDING_REQ_COUNT(handle) \ + do { \ + assert(handle->reqs_pending > 0); \ + handle->reqs_pending--; \ + \ + if (handle->flags & UV__HANDLE_CLOSING && \ + handle->reqs_pending == 0) { \ + uv_want_endgame(loop, (uv_handle_t*)handle); \ + } \ + } while (0) + + +#define uv__handle_closing(handle) \ + do { \ + assert(!((handle)->flags & UV__HANDLE_CLOSING)); \ + \ + if (!(((handle)->flags & UV__HANDLE_ACTIVE) && \ + ((handle)->flags & UV__HANDLE_REF))) \ + uv__active_handle_add((uv_handle_t*) (handle)); \ + \ + (handle)->flags |= UV__HANDLE_CLOSING; \ + (handle)->flags &= ~UV__HANDLE_ACTIVE; \ + } while (0) + + +#define uv__handle_close(handle) \ + do { \ + QUEUE_REMOVE(&(handle)->handle_queue); \ + uv__active_handle_rm((uv_handle_t*) (handle)); \ + \ + (handle)->flags |= UV_HANDLE_CLOSED; \ + \ + if ((handle)->close_cb) \ + (handle)->close_cb((uv_handle_t*) (handle)); \ + } while (0) + + +INLINE static void uv_want_endgame(uv_loop_t* loop, uv_handle_t* handle) { + if (!(handle->flags & UV_HANDLE_ENDGAME_QUEUED)) { + handle->flags |= UV_HANDLE_ENDGAME_QUEUED; + + handle->endgame_next = loop->endgame_handles; + loop->endgame_handles = handle; + } +} + + +INLINE static void uv_process_endgames(uv_loop_t* loop) { + uv_handle_t* handle; + + while (loop->endgame_handles) { + handle = loop->endgame_handles; + loop->endgame_handles = handle->endgame_next; + + handle->flags &= ~UV_HANDLE_ENDGAME_QUEUED; + + switch (handle->type) { + case UV_TCP: + uv_tcp_endgame(loop, (uv_tcp_t*) handle); + break; + + case UV_NAMED_PIPE: + uv_pipe_endgame(loop, (uv_pipe_t*) handle); + break; + + case UV_TTY: + uv_tty_endgame(loop, (uv_tty_t*) handle); + break; + + case UV_UDP: + uv_udp_endgame(loop, (uv_udp_t*) handle); + break; + + case UV_POLL: + uv_poll_endgame(loop, (uv_poll_t*) handle); + break; + + case UV_TIMER: + uv_timer_endgame(loop, (uv_timer_t*) handle); + break; + + case UV_PREPARE: + case UV_CHECK: + case UV_IDLE: + uv_loop_watcher_endgame(loop, handle); + break; + + case UV_ASYNC: + uv_async_endgame(loop, (uv_async_t*) handle); + break; + + case UV_SIGNAL: + uv_signal_endgame(loop, (uv_signal_t*) handle); + break; + + case UV_PROCESS: + uv_process_endgame(loop, (uv_process_t*) handle); + break; + + case UV_FS_EVENT: + uv_fs_event_endgame(loop, (uv_fs_event_t*) handle); + break; + + case UV_FS_POLL: + uv__fs_poll_endgame(loop, (uv_fs_poll_t*) handle); + break; + + default: + assert(0); + break; + } + } +} + +INLINE static HANDLE uv__get_osfhandle(int fd) +{ + /* _get_osfhandle() raises an assert in debug builds if the FD is invalid. */ + /* But it also correctly checks the FD and returns INVALID_HANDLE_VALUE */ + /* for invalid FDs in release builds (or if you let the assert continue). */ + /* So this wrapper function disables asserts when calling _get_osfhandle. */ + + HANDLE handle; + UV_BEGIN_DISABLE_CRT_ASSERT(); + handle = (HANDLE) _get_osfhandle(fd); + UV_END_DISABLE_CRT_ASSERT(); + return handle; +} + +#endif /* UV_WIN_HANDLE_INL_H_ */ diff --git a/3rdparty/libuv/src/win/handle.c b/3rdparty/libuv/src/win/handle.c new file mode 100644 index 00000000000..72b49d97904 --- /dev/null +++ b/3rdparty/libuv/src/win/handle.c @@ -0,0 +1,154 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" + + +uv_handle_type uv_guess_handle(uv_file file) { + HANDLE handle; + DWORD mode; + + if (file < 0) { + return UV_UNKNOWN_HANDLE; + } + + handle = uv__get_osfhandle(file); + + switch (GetFileType(handle)) { + case FILE_TYPE_CHAR: + if (GetConsoleMode(handle, &mode)) { + return UV_TTY; + } else { + return UV_FILE; + } + + case FILE_TYPE_PIPE: + return UV_NAMED_PIPE; + + case FILE_TYPE_DISK: + return UV_FILE; + + default: + return UV_UNKNOWN_HANDLE; + } +} + + +int uv_is_active(const uv_handle_t* handle) { + return (handle->flags & UV__HANDLE_ACTIVE) && + !(handle->flags & UV__HANDLE_CLOSING); +} + + +void uv_close(uv_handle_t* handle, uv_close_cb cb) { + uv_loop_t* loop = handle->loop; + + if (handle->flags & UV__HANDLE_CLOSING) { + assert(0); + return; + } + + handle->close_cb = cb; + + /* Handle-specific close actions */ + switch (handle->type) { + case UV_TCP: + uv_tcp_close(loop, (uv_tcp_t*)handle); + return; + + case UV_NAMED_PIPE: + uv_pipe_close(loop, (uv_pipe_t*) handle); + return; + + case UV_TTY: + uv_tty_close((uv_tty_t*) handle); + return; + + case UV_UDP: + uv_udp_close(loop, (uv_udp_t*) handle); + return; + + case UV_POLL: + uv_poll_close(loop, (uv_poll_t*) handle); + return; + + case UV_TIMER: + uv_timer_stop((uv_timer_t*)handle); + uv__handle_closing(handle); + uv_want_endgame(loop, handle); + return; + + case UV_PREPARE: + uv_prepare_stop((uv_prepare_t*)handle); + uv__handle_closing(handle); + uv_want_endgame(loop, handle); + return; + + case UV_CHECK: + uv_check_stop((uv_check_t*)handle); + uv__handle_closing(handle); + uv_want_endgame(loop, handle); + return; + + case UV_IDLE: + uv_idle_stop((uv_idle_t*)handle); + uv__handle_closing(handle); + uv_want_endgame(loop, handle); + return; + + case UV_ASYNC: + uv_async_close(loop, (uv_async_t*) handle); + return; + + case UV_SIGNAL: + uv_signal_close(loop, (uv_signal_t*) handle); + return; + + case UV_PROCESS: + uv_process_close(loop, (uv_process_t*) handle); + return; + + case UV_FS_EVENT: + uv_fs_event_close(loop, (uv_fs_event_t*) handle); + return; + + case UV_FS_POLL: + uv__fs_poll_close((uv_fs_poll_t*) handle); + uv__handle_closing(handle); + uv_want_endgame(loop, handle); + return; + + default: + /* Not supported */ + abort(); + } +} + + +int uv_is_closing(const uv_handle_t* handle) { + return !!(handle->flags & (UV__HANDLE_CLOSING | UV_HANDLE_CLOSED)); +} diff --git a/3rdparty/libuv/src/win/internal.h b/3rdparty/libuv/src/win/internal.h new file mode 100644 index 00000000000..783f21af0fe --- /dev/null +++ b/3rdparty/libuv/src/win/internal.h @@ -0,0 +1,382 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_WIN_INTERNAL_H_ +#define UV_WIN_INTERNAL_H_ + +#include "uv.h" +#include "../uv-common.h" + +#include "tree.h" +#include "winapi.h" +#include "winsock.h" + +#ifdef _MSC_VER +# define INLINE __inline +# define UV_THREAD_LOCAL __declspec( thread ) +#else +# define INLINE inline +# define UV_THREAD_LOCAL __thread +#endif + + +#ifdef _DEBUG + +extern UV_THREAD_LOCAL int uv__crt_assert_enabled; + +#define UV_BEGIN_DISABLE_CRT_ASSERT() \ + { \ + int uv__saved_crt_assert_enabled = uv__crt_assert_enabled; \ + uv__crt_assert_enabled = FALSE; + + +#define UV_END_DISABLE_CRT_ASSERT() \ + uv__crt_assert_enabled = uv__saved_crt_assert_enabled; \ + } + +#else +#define UV_BEGIN_DISABLE_CRT_ASSERT() +#define UV_END_DISABLE_CRT_ASSERT() +#endif + +/* + * Handles + * (also see handle-inl.h) + */ + +/* Used by all handles. */ +#define UV_HANDLE_CLOSED 0x00000002 +#define UV_HANDLE_ENDGAME_QUEUED 0x00000008 + +/* uv-common.h: #define UV__HANDLE_CLOSING 0x00000001 */ +/* uv-common.h: #define UV__HANDLE_ACTIVE 0x00000040 */ +/* uv-common.h: #define UV__HANDLE_REF 0x00000020 */ +/* uv-common.h: #define UV_HANDLE_INTERNAL 0x00000080 */ + +/* Used by streams and UDP handles. */ +#define UV_HANDLE_READING 0x00000100 +#define UV_HANDLE_BOUND 0x00000200 +#define UV_HANDLE_LISTENING 0x00000800 +#define UV_HANDLE_CONNECTION 0x00001000 +#define UV_HANDLE_READABLE 0x00008000 +#define UV_HANDLE_WRITABLE 0x00010000 +#define UV_HANDLE_READ_PENDING 0x00020000 +#define UV_HANDLE_SYNC_BYPASS_IOCP 0x00040000 +#define UV_HANDLE_ZERO_READ 0x00080000 +#define UV_HANDLE_EMULATE_IOCP 0x00100000 +#define UV_HANDLE_BLOCKING_WRITES 0x00200000 + +/* Used by uv_tcp_t and uv_udp_t handles */ +#define UV_HANDLE_IPV6 0x01000000 + +/* Only used by uv_tcp_t handles. */ +#define UV_HANDLE_TCP_NODELAY 0x02000000 +#define UV_HANDLE_TCP_KEEPALIVE 0x04000000 +#define UV_HANDLE_TCP_SINGLE_ACCEPT 0x08000000 +#define UV_HANDLE_TCP_ACCEPT_STATE_CHANGING 0x10000000 +#define UV_HANDLE_TCP_SOCKET_CLOSED 0x20000000 +#define UV_HANDLE_SHARED_TCP_SOCKET 0x40000000 + +/* Only used by uv_pipe_t handles. */ +#define UV_HANDLE_NON_OVERLAPPED_PIPE 0x01000000 +#define UV_HANDLE_PIPESERVER 0x02000000 +#define UV_HANDLE_PIPE_READ_CANCELABLE 0x04000000 + +/* Only used by uv_tty_t handles. */ +#define UV_HANDLE_TTY_READABLE 0x01000000 +#define UV_HANDLE_TTY_RAW 0x02000000 +#define UV_HANDLE_TTY_SAVED_POSITION 0x04000000 +#define UV_HANDLE_TTY_SAVED_ATTRIBUTES 0x08000000 + +/* Only used by uv_poll_t handles. */ +#define UV_HANDLE_POLL_SLOW 0x02000000 + + +/* + * Requests: see req-inl.h + */ + + +/* + * Streams: see stream-inl.h + */ + + +/* + * TCP + */ + +typedef struct { + WSAPROTOCOL_INFOW socket_info; + int delayed_error; +} uv__ipc_socket_info_ex; + +int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb); +int uv_tcp_accept(uv_tcp_t* server, uv_tcp_t* client); +int uv_tcp_read_start(uv_tcp_t* handle, uv_alloc_cb alloc_cb, + uv_read_cb read_cb); +int uv_tcp_write(uv_loop_t* loop, uv_write_t* req, uv_tcp_t* handle, + const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); +int uv__tcp_try_write(uv_tcp_t* handle, const uv_buf_t bufs[], + unsigned int nbufs); + +void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, uv_req_t* req); +void uv_process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle, + uv_write_t* req); +void uv_process_tcp_accept_req(uv_loop_t* loop, uv_tcp_t* handle, + uv_req_t* req); +void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle, + uv_connect_t* req); + +void uv_tcp_close(uv_loop_t* loop, uv_tcp_t* tcp); +void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle); + +int uv_tcp_import(uv_tcp_t* tcp, uv__ipc_socket_info_ex* socket_info_ex, + int tcp_connection); + +int uv_tcp_duplicate_socket(uv_tcp_t* handle, int pid, + LPWSAPROTOCOL_INFOW protocol_info); + + +/* + * UDP + */ +void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle, uv_req_t* req); +void uv_process_udp_send_req(uv_loop_t* loop, uv_udp_t* handle, + uv_udp_send_t* req); + +void uv_udp_close(uv_loop_t* loop, uv_udp_t* handle); +void uv_udp_endgame(uv_loop_t* loop, uv_udp_t* handle); + + +/* + * Pipes + */ +int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access, + char* name, size_t nameSize); + +int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb); +int uv_pipe_accept(uv_pipe_t* server, uv_stream_t* client); +int uv_pipe_read_start(uv_pipe_t* handle, uv_alloc_cb alloc_cb, + uv_read_cb read_cb); +int uv_pipe_write(uv_loop_t* loop, uv_write_t* req, uv_pipe_t* handle, + const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); +int uv_pipe_write2(uv_loop_t* loop, uv_write_t* req, uv_pipe_t* handle, + const uv_buf_t bufs[], unsigned int nbufs, uv_stream_t* send_handle, + uv_write_cb cb); +void uv__pipe_pause_read(uv_pipe_t* handle); +void uv__pipe_unpause_read(uv_pipe_t* handle); +void uv__pipe_stop_read(uv_pipe_t* handle); + +void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_req_t* req); +void uv_process_pipe_write_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_write_t* req); +void uv_process_pipe_accept_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_req_t* raw_req); +void uv_process_pipe_connect_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_connect_t* req); +void uv_process_pipe_shutdown_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_shutdown_t* req); + +void uv_pipe_close(uv_loop_t* loop, uv_pipe_t* handle); +void uv_pipe_cleanup(uv_loop_t* loop, uv_pipe_t* handle); +void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle); + + +/* + * TTY + */ +void uv_console_init(); + +int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb, + uv_read_cb read_cb); +int uv_tty_read_stop(uv_tty_t* handle); +int uv_tty_write(uv_loop_t* loop, uv_write_t* req, uv_tty_t* handle, + const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); +int uv__tty_try_write(uv_tty_t* handle, const uv_buf_t bufs[], + unsigned int nbufs); +void uv_tty_close(uv_tty_t* handle); + +void uv_process_tty_read_req(uv_loop_t* loop, uv_tty_t* handle, + uv_req_t* req); +void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle, + uv_write_t* req); +/* TODO: remove me */ +void uv_process_tty_accept_req(uv_loop_t* loop, uv_tty_t* handle, + uv_req_t* raw_req); +/* TODO: remove me */ +void uv_process_tty_connect_req(uv_loop_t* loop, uv_tty_t* handle, + uv_connect_t* req); + +void uv_tty_endgame(uv_loop_t* loop, uv_tty_t* handle); + + +/* + * Poll watchers + */ +void uv_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, + uv_req_t* req); + +int uv_poll_close(uv_loop_t* loop, uv_poll_t* handle); +void uv_poll_endgame(uv_loop_t* loop, uv_poll_t* handle); + + +/* + * Timers + */ +void uv_timer_endgame(uv_loop_t* loop, uv_timer_t* handle); + +DWORD uv__next_timeout(const uv_loop_t* loop); +void uv__time_forward(uv_loop_t* loop, uint64_t msecs); +void uv_process_timers(uv_loop_t* loop); + + +/* + * Loop watchers + */ +void uv_loop_watcher_endgame(uv_loop_t* loop, uv_handle_t* handle); + +void uv_prepare_invoke(uv_loop_t* loop); +void uv_check_invoke(uv_loop_t* loop); +void uv_idle_invoke(uv_loop_t* loop); + +void uv__once_init(); + + +/* + * Async watcher + */ +void uv_async_close(uv_loop_t* loop, uv_async_t* handle); +void uv_async_endgame(uv_loop_t* loop, uv_async_t* handle); + +void uv_process_async_wakeup_req(uv_loop_t* loop, uv_async_t* handle, + uv_req_t* req); + + +/* + * Signal watcher + */ +void uv_signals_init(); +int uv__signal_dispatch(int signum); + +void uv_signal_close(uv_loop_t* loop, uv_signal_t* handle); +void uv_signal_endgame(uv_loop_t* loop, uv_signal_t* handle); + +void uv_process_signal_req(uv_loop_t* loop, uv_signal_t* handle, + uv_req_t* req); + + +/* + * Spawn + */ +void uv_process_proc_exit(uv_loop_t* loop, uv_process_t* handle); +void uv_process_close(uv_loop_t* loop, uv_process_t* handle); +void uv_process_endgame(uv_loop_t* loop, uv_process_t* handle); + + +/* + * Error + */ +int uv_translate_sys_error(int sys_errno); + + +/* + * FS + */ +void uv_fs_init(); + + +/* + * FS Event + */ +void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, + uv_fs_event_t* handle); +void uv_fs_event_close(uv_loop_t* loop, uv_fs_event_t* handle); +void uv_fs_event_endgame(uv_loop_t* loop, uv_fs_event_t* handle); + + +/* + * Stat poller. + */ +void uv__fs_poll_endgame(uv_loop_t* loop, uv_fs_poll_t* handle); + + +/* + * Utilities. + */ +void uv__util_init(); + +uint64_t uv__hrtime(double scale); +int uv_parent_pid(); +int uv_current_pid(); +__declspec(noreturn) void uv_fatal_error(const int errorno, const char* syscall); + + +/* + * Process stdio handles. + */ +int uv__stdio_create(uv_loop_t* loop, + const uv_process_options_t* options, + BYTE** buffer_ptr); +void uv__stdio_destroy(BYTE* buffer); +void uv__stdio_noinherit(BYTE* buffer); +int uv__stdio_verify(BYTE* buffer, WORD size); +WORD uv__stdio_size(BYTE* buffer); +HANDLE uv__stdio_handle(BYTE* buffer, int fd); + + +/* + * Winapi and ntapi utility functions + */ +void uv_winapi_init(); + + +/* + * Winsock utility functions + */ +void uv_winsock_init(); + +int uv_ntstatus_to_winsock_error(NTSTATUS status); + +BOOL uv_get_acceptex_function(SOCKET socket, LPFN_ACCEPTEX* target); +BOOL uv_get_connectex_function(SOCKET socket, LPFN_CONNECTEX* target); + +int WSAAPI uv_wsarecv_workaround(SOCKET socket, WSABUF* buffers, + DWORD buffer_count, DWORD* bytes, DWORD* flags, WSAOVERLAPPED *overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); +int WSAAPI uv_wsarecvfrom_workaround(SOCKET socket, WSABUF* buffers, + DWORD buffer_count, DWORD* bytes, DWORD* flags, struct sockaddr* addr, + int* addr_len, WSAOVERLAPPED *overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); + +int WSAAPI uv_msafd_poll(SOCKET socket, AFD_POLL_INFO* info_in, + AFD_POLL_INFO* info_out, OVERLAPPED* overlapped); + +/* Whether there are any non-IFS LSPs stacked on TCP */ +extern int uv_tcp_non_ifs_lsp_ipv4; +extern int uv_tcp_non_ifs_lsp_ipv6; + +/* Ip address used to bind to any port at any interface */ +extern struct sockaddr_in uv_addr_ip4_any_; +extern struct sockaddr_in6 uv_addr_ip6_any_; + +#endif /* UV_WIN_INTERNAL_H_ */ diff --git a/3rdparty/libuv/src/win/loop-watcher.c b/3rdparty/libuv/src/win/loop-watcher.c new file mode 100644 index 00000000000..20e4509f838 --- /dev/null +++ b/3rdparty/libuv/src/win/loop-watcher.c @@ -0,0 +1,122 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" + + +void uv_loop_watcher_endgame(uv_loop_t* loop, uv_handle_t* handle) { + if (handle->flags & UV__HANDLE_CLOSING) { + assert(!(handle->flags & UV_HANDLE_CLOSED)); + handle->flags |= UV_HANDLE_CLOSED; + uv__handle_close(handle); + } +} + + +#define UV_LOOP_WATCHER_DEFINE(name, NAME) \ + int uv_##name##_init(uv_loop_t* loop, uv_##name##_t* handle) { \ + uv__handle_init(loop, (uv_handle_t*) handle, UV_##NAME); \ + \ + return 0; \ + } \ + \ + \ + int uv_##name##_start(uv_##name##_t* handle, uv_##name##_cb cb) { \ + uv_loop_t* loop = handle->loop; \ + uv_##name##_t* old_head; \ + \ + assert(handle->type == UV_##NAME); \ + \ + if (uv__is_active(handle)) \ + return 0; \ + \ + if (cb == NULL) \ + return UV_EINVAL; \ + \ + old_head = loop->name##_handles; \ + \ + handle->name##_next = old_head; \ + handle->name##_prev = NULL; \ + \ + if (old_head) { \ + old_head->name##_prev = handle; \ + } \ + \ + loop->name##_handles = handle; \ + \ + handle->name##_cb = cb; \ + uv__handle_start(handle); \ + \ + return 0; \ + } \ + \ + \ + int uv_##name##_stop(uv_##name##_t* handle) { \ + uv_loop_t* loop = handle->loop; \ + \ + assert(handle->type == UV_##NAME); \ + \ + if (!uv__is_active(handle)) \ + return 0; \ + \ + /* Update loop head if needed */ \ + if (loop->name##_handles == handle) { \ + loop->name##_handles = handle->name##_next; \ + } \ + \ + /* Update the iterator-next pointer of needed */ \ + if (loop->next_##name##_handle == handle) { \ + loop->next_##name##_handle = handle->name##_next; \ + } \ + \ + if (handle->name##_prev) { \ + handle->name##_prev->name##_next = handle->name##_next; \ + } \ + if (handle->name##_next) { \ + handle->name##_next->name##_prev = handle->name##_prev; \ + } \ + \ + uv__handle_stop(handle); \ + \ + return 0; \ + } \ + \ + \ + void uv_##name##_invoke(uv_loop_t* loop) { \ + uv_##name##_t* handle; \ + \ + (loop)->next_##name##_handle = (loop)->name##_handles; \ + \ + while ((loop)->next_##name##_handle != NULL) { \ + handle = (loop)->next_##name##_handle; \ + (loop)->next_##name##_handle = handle->name##_next; \ + \ + handle->name##_cb(handle); \ + } \ + } + +UV_LOOP_WATCHER_DEFINE(prepare, PREPARE) +UV_LOOP_WATCHER_DEFINE(check, CHECK) +UV_LOOP_WATCHER_DEFINE(idle, IDLE) diff --git a/3rdparty/libuv/src/win/pipe.c b/3rdparty/libuv/src/win/pipe.c new file mode 100644 index 00000000000..bcce80c77e5 --- /dev/null +++ b/3rdparty/libuv/src/win/pipe.c @@ -0,0 +1,2118 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "stream-inl.h" +#include "req-inl.h" + +typedef struct uv__ipc_queue_item_s uv__ipc_queue_item_t; + +struct uv__ipc_queue_item_s { + /* + * NOTE: It is important for socket_info_ex to be the first field, + * because we will we assigning it to the pending_ipc_info.socket_info + */ + uv__ipc_socket_info_ex socket_info_ex; + QUEUE member; + int tcp_connection; +}; + +/* A zero-size buffer for use by uv_pipe_read */ +static char uv_zero_[] = ""; + +/* Null uv_buf_t */ +static const uv_buf_t uv_null_buf_ = { 0, NULL }; + +/* The timeout that the pipe will wait for the remote end to write data */ +/* when the local ends wants to shut it down. */ +static const int64_t eof_timeout = 50; /* ms */ + +static const int default_pending_pipe_instances = 4; + +/* Pipe prefix */ +static char pipe_prefix[] = "\\\\?\\pipe"; +static const int pipe_prefix_len = sizeof(pipe_prefix) - 1; + +/* IPC protocol flags. */ +#define UV_IPC_RAW_DATA 0x0001 +#define UV_IPC_TCP_SERVER 0x0002 +#define UV_IPC_TCP_CONNECTION 0x0004 + +/* IPC frame header. */ +typedef struct { + int flags; + uint64_t raw_data_length; +} uv_ipc_frame_header_t; + +/* IPC frame, which contains an imported TCP socket stream. */ +typedef struct { + uv_ipc_frame_header_t header; + uv__ipc_socket_info_ex socket_info_ex; +} uv_ipc_frame_uv_stream; + +static void eof_timer_init(uv_pipe_t* pipe); +static void eof_timer_start(uv_pipe_t* pipe); +static void eof_timer_stop(uv_pipe_t* pipe); +static void eof_timer_cb(uv_timer_t* timer); +static void eof_timer_destroy(uv_pipe_t* pipe); +static void eof_timer_close_cb(uv_handle_t* handle); + + +static void uv_unique_pipe_name(char* ptr, char* name, size_t size) { + snprintf(name, size, "\\\\?\\pipe\\uv\\%p-%u", ptr, GetCurrentProcessId()); +} + + +int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) { + uv_stream_init(loop, (uv_stream_t*)handle, UV_NAMED_PIPE); + + handle->reqs_pending = 0; + handle->handle = INVALID_HANDLE_VALUE; + handle->name = NULL; + handle->pipe.conn.ipc_pid = 0; + handle->pipe.conn.remaining_ipc_rawdata_bytes = 0; + QUEUE_INIT(&handle->pipe.conn.pending_ipc_info.queue); + handle->pipe.conn.pending_ipc_info.queue_len = 0; + handle->ipc = ipc; + handle->pipe.conn.non_overlapped_writes_tail = NULL; + handle->pipe.conn.readfile_thread = NULL; + + uv_req_init(loop, (uv_req_t*) &handle->pipe.conn.ipc_header_write_req); + + return 0; +} + + +static void uv_pipe_connection_init(uv_pipe_t* handle) { + uv_connection_init((uv_stream_t*) handle); + handle->read_req.data = handle; + handle->pipe.conn.eof_timer = NULL; + assert(!(handle->flags & UV_HANDLE_PIPESERVER)); + if (pCancelSynchronousIo && + handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) { + uv_mutex_init(&handle->pipe.conn.readfile_mutex); + handle->flags |= UV_HANDLE_PIPE_READ_CANCELABLE; + } +} + + +static HANDLE open_named_pipe(const WCHAR* name, DWORD* duplex_flags) { + HANDLE pipeHandle; + + /* + * Assume that we have a duplex pipe first, so attempt to + * connect with GENERIC_READ | GENERIC_WRITE. + */ + pipeHandle = CreateFileW(name, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + NULL); + if (pipeHandle != INVALID_HANDLE_VALUE) { + *duplex_flags = UV_HANDLE_READABLE | UV_HANDLE_WRITABLE; + return pipeHandle; + } + + /* + * If the pipe is not duplex CreateFileW fails with + * ERROR_ACCESS_DENIED. In that case try to connect + * as a read-only or write-only. + */ + if (GetLastError() == ERROR_ACCESS_DENIED) { + pipeHandle = CreateFileW(name, + GENERIC_READ | FILE_WRITE_ATTRIBUTES, + 0, + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + NULL); + + if (pipeHandle != INVALID_HANDLE_VALUE) { + *duplex_flags = UV_HANDLE_READABLE; + return pipeHandle; + } + } + + if (GetLastError() == ERROR_ACCESS_DENIED) { + pipeHandle = CreateFileW(name, + GENERIC_WRITE | FILE_READ_ATTRIBUTES, + 0, + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + NULL); + + if (pipeHandle != INVALID_HANDLE_VALUE) { + *duplex_flags = UV_HANDLE_WRITABLE; + return pipeHandle; + } + } + + return INVALID_HANDLE_VALUE; +} + + +static void close_pipe(uv_pipe_t* pipe) { + assert(pipe->u.fd == -1 || pipe->u.fd > 2); + if (pipe->u.fd == -1) + CloseHandle(pipe->handle); + else + close(pipe->u.fd); + + pipe->u.fd = -1; + pipe->handle = INVALID_HANDLE_VALUE; +} + + +int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access, + char* name, size_t nameSize) { + HANDLE pipeHandle; + int err; + char* ptr = (char*)handle; + + for (;;) { + uv_unique_pipe_name(ptr, name, nameSize); + + pipeHandle = CreateNamedPipeA(name, + access | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE, + PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 65536, 65536, 0, + NULL); + + if (pipeHandle != INVALID_HANDLE_VALUE) { + /* No name collisions. We're done. */ + break; + } + + err = GetLastError(); + if (err != ERROR_PIPE_BUSY && err != ERROR_ACCESS_DENIED) { + goto error; + } + + /* Pipe name collision. Increment the pointer and try again. */ + ptr++; + } + + if (CreateIoCompletionPort(pipeHandle, + loop->iocp, + (ULONG_PTR)handle, + 0) == NULL) { + err = GetLastError(); + goto error; + } + + uv_pipe_connection_init(handle); + handle->handle = pipeHandle; + + return 0; + + error: + if (pipeHandle != INVALID_HANDLE_VALUE) { + CloseHandle(pipeHandle); + } + + return err; +} + + +static int uv_set_pipe_handle(uv_loop_t* loop, + uv_pipe_t* handle, + HANDLE pipeHandle, + int fd, + DWORD duplex_flags) { + NTSTATUS nt_status; + IO_STATUS_BLOCK io_status; + FILE_MODE_INFORMATION mode_info; + DWORD mode = PIPE_READMODE_BYTE | PIPE_WAIT; + DWORD current_mode = 0; + DWORD err = 0; + + if (!(handle->flags & UV_HANDLE_PIPESERVER) && + handle->handle != INVALID_HANDLE_VALUE) + return UV_EBUSY; + + if (!SetNamedPipeHandleState(pipeHandle, &mode, NULL, NULL)) { + err = GetLastError(); + if (err == ERROR_ACCESS_DENIED) { + /* + * SetNamedPipeHandleState can fail if the handle doesn't have either + * GENERIC_WRITE or FILE_WRITE_ATTRIBUTES. + * But if the handle already has the desired wait and blocking modes + * we can continue. + */ + if (!GetNamedPipeHandleState(pipeHandle, ¤t_mode, NULL, NULL, + NULL, NULL, 0)) { + return -1; + } else if (current_mode & PIPE_NOWAIT) { + SetLastError(ERROR_ACCESS_DENIED); + return -1; + } + } else { + /* If this returns ERROR_INVALID_PARAMETER we probably opened + * something that is not a pipe. */ + if (err == ERROR_INVALID_PARAMETER) { + SetLastError(WSAENOTSOCK); + } + return -1; + } + } + + /* Check if the pipe was created with FILE_FLAG_OVERLAPPED. */ + nt_status = pNtQueryInformationFile(pipeHandle, + &io_status, + &mode_info, + sizeof(mode_info), + FileModeInformation); + if (nt_status != STATUS_SUCCESS) { + return -1; + } + + if (mode_info.Mode & FILE_SYNCHRONOUS_IO_ALERT || + mode_info.Mode & FILE_SYNCHRONOUS_IO_NONALERT) { + /* Non-overlapped pipe. */ + handle->flags |= UV_HANDLE_NON_OVERLAPPED_PIPE; + } else { + /* Overlapped pipe. Try to associate with IOCP. */ + if (CreateIoCompletionPort(pipeHandle, + loop->iocp, + (ULONG_PTR)handle, + 0) == NULL) { + handle->flags |= UV_HANDLE_EMULATE_IOCP; + } + } + + handle->handle = pipeHandle; + handle->u.fd = fd; + handle->flags |= duplex_flags; + + return 0; +} + + +static DWORD WINAPI pipe_shutdown_thread_proc(void* parameter) { + uv_loop_t* loop; + uv_pipe_t* handle; + uv_shutdown_t* req; + + req = (uv_shutdown_t*) parameter; + assert(req); + handle = (uv_pipe_t*) req->handle; + assert(handle); + loop = handle->loop; + assert(loop); + + FlushFileBuffers(handle->handle); + + /* Post completed */ + POST_COMPLETION_FOR_REQ(loop, req); + + return 0; +} + + +void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle) { + int err; + DWORD result; + uv_shutdown_t* req; + NTSTATUS nt_status; + IO_STATUS_BLOCK io_status; + FILE_PIPE_LOCAL_INFORMATION pipe_info; + uv__ipc_queue_item_t* item; + + if (handle->flags & UV_HANDLE_PIPE_READ_CANCELABLE) { + handle->flags &= ~UV_HANDLE_PIPE_READ_CANCELABLE; + uv_mutex_destroy(&handle->pipe.conn.readfile_mutex); + } + + if ((handle->flags & UV_HANDLE_CONNECTION) && + handle->stream.conn.shutdown_req != NULL && + handle->stream.conn.write_reqs_pending == 0) { + req = handle->stream.conn.shutdown_req; + + /* Clear the shutdown_req field so we don't go here again. */ + handle->stream.conn.shutdown_req = NULL; + + if (handle->flags & UV__HANDLE_CLOSING) { + UNREGISTER_HANDLE_REQ(loop, handle, req); + + /* Already closing. Cancel the shutdown. */ + if (req->cb) { + req->cb(req, UV_ECANCELED); + } + + DECREASE_PENDING_REQ_COUNT(handle); + return; + } + + /* Try to avoid flushing the pipe buffer in the thread pool. */ + nt_status = pNtQueryInformationFile(handle->handle, + &io_status, + &pipe_info, + sizeof pipe_info, + FilePipeLocalInformation); + + if (nt_status != STATUS_SUCCESS) { + /* Failure */ + UNREGISTER_HANDLE_REQ(loop, handle, req); + + handle->flags |= UV_HANDLE_WRITABLE; /* Questionable */ + if (req->cb) { + err = pRtlNtStatusToDosError(nt_status); + req->cb(req, uv_translate_sys_error(err)); + } + + DECREASE_PENDING_REQ_COUNT(handle); + return; + } + + if (pipe_info.OutboundQuota == pipe_info.WriteQuotaAvailable) { + /* Short-circuit, no need to call FlushFileBuffers. */ + uv_insert_pending_req(loop, (uv_req_t*) req); + return; + } + + /* Run FlushFileBuffers in the thread pool. */ + result = QueueUserWorkItem(pipe_shutdown_thread_proc, + req, + WT_EXECUTELONGFUNCTION); + if (result) { + return; + + } else { + /* Failure. */ + UNREGISTER_HANDLE_REQ(loop, handle, req); + + handle->flags |= UV_HANDLE_WRITABLE; /* Questionable */ + if (req->cb) { + err = GetLastError(); + req->cb(req, uv_translate_sys_error(err)); + } + + DECREASE_PENDING_REQ_COUNT(handle); + return; + } + } + + if (handle->flags & UV__HANDLE_CLOSING && + handle->reqs_pending == 0) { + assert(!(handle->flags & UV_HANDLE_CLOSED)); + + if (handle->flags & UV_HANDLE_CONNECTION) { + /* Free pending sockets */ + while (!QUEUE_EMPTY(&handle->pipe.conn.pending_ipc_info.queue)) { + QUEUE* q; + SOCKET socket; + + q = QUEUE_HEAD(&handle->pipe.conn.pending_ipc_info.queue); + QUEUE_REMOVE(q); + item = QUEUE_DATA(q, uv__ipc_queue_item_t, member); + + /* Materialize socket and close it */ + socket = WSASocketW(FROM_PROTOCOL_INFO, + FROM_PROTOCOL_INFO, + FROM_PROTOCOL_INFO, + &item->socket_info_ex.socket_info, + 0, + WSA_FLAG_OVERLAPPED); + uv__free(item); + + if (socket != INVALID_SOCKET) + closesocket(socket); + } + handle->pipe.conn.pending_ipc_info.queue_len = 0; + + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + if (handle->read_req.wait_handle != INVALID_HANDLE_VALUE) { + UnregisterWait(handle->read_req.wait_handle); + handle->read_req.wait_handle = INVALID_HANDLE_VALUE; + } + if (handle->read_req.event_handle) { + CloseHandle(handle->read_req.event_handle); + handle->read_req.event_handle = NULL; + } + } + } + + if (handle->flags & UV_HANDLE_PIPESERVER) { + assert(handle->pipe.serv.accept_reqs); + uv__free(handle->pipe.serv.accept_reqs); + handle->pipe.serv.accept_reqs = NULL; + } + + uv__handle_close(handle); + } +} + + +void uv_pipe_pending_instances(uv_pipe_t* handle, int count) { + if (handle->flags & UV_HANDLE_BOUND) + return; + handle->pipe.serv.pending_instances = count; + handle->flags |= UV_HANDLE_PIPESERVER; +} + + +/* Creates a pipe server. */ +int uv_pipe_bind(uv_pipe_t* handle, const char* name) { + uv_loop_t* loop = handle->loop; + int i, err, nameSize; + uv_pipe_accept_t* req; + + if (handle->flags & UV_HANDLE_BOUND) { + return UV_EINVAL; + } + + if (!name) { + return UV_EINVAL; + } + + if (!(handle->flags & UV_HANDLE_PIPESERVER)) { + handle->pipe.serv.pending_instances = default_pending_pipe_instances; + } + + handle->pipe.serv.accept_reqs = (uv_pipe_accept_t*) + uv__malloc(sizeof(uv_pipe_accept_t) * handle->pipe.serv.pending_instances); + if (!handle->pipe.serv.accept_reqs) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + for (i = 0; i < handle->pipe.serv.pending_instances; i++) { + req = &handle->pipe.serv.accept_reqs[i]; + uv_req_init(loop, (uv_req_t*) req); + req->type = UV_ACCEPT; + req->data = handle; + req->pipeHandle = INVALID_HANDLE_VALUE; + req->next_pending = NULL; + } + + /* Convert name to UTF16. */ + nameSize = uv_utf8_to_utf16(name, NULL, 0) * sizeof(WCHAR); + handle->name = (WCHAR*)uv__malloc(nameSize); + if (!handle->name) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + if (!uv_utf8_to_utf16(name, handle->name, nameSize / sizeof(WCHAR))) { + err = GetLastError(); + goto error; + } + + /* + * Attempt to create the first pipe with FILE_FLAG_FIRST_PIPE_INSTANCE. + * If this fails then there's already a pipe server for the given pipe name. + */ + handle->pipe.serv.accept_reqs[0].pipeHandle = CreateNamedPipeW(handle->name, + PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | + FILE_FLAG_FIRST_PIPE_INSTANCE, + PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, 65536, 65536, 0, NULL); + + if (handle->pipe.serv.accept_reqs[0].pipeHandle == INVALID_HANDLE_VALUE) { + err = GetLastError(); + if (err == ERROR_ACCESS_DENIED) { + err = WSAEADDRINUSE; /* Translates to UV_EADDRINUSE. */ + } else if (err == ERROR_PATH_NOT_FOUND || err == ERROR_INVALID_NAME) { + err = WSAEACCES; /* Translates to UV_EACCES. */ + } + goto error; + } + + if (uv_set_pipe_handle(loop, + handle, + handle->pipe.serv.accept_reqs[0].pipeHandle, + -1, + 0)) { + err = GetLastError(); + goto error; + } + + handle->pipe.serv.pending_accepts = NULL; + handle->flags |= UV_HANDLE_PIPESERVER; + handle->flags |= UV_HANDLE_BOUND; + + return 0; + +error: + if (handle->name) { + uv__free(handle->name); + handle->name = NULL; + } + + if (handle->pipe.serv.accept_reqs[0].pipeHandle != INVALID_HANDLE_VALUE) { + CloseHandle(handle->pipe.serv.accept_reqs[0].pipeHandle); + handle->pipe.serv.accept_reqs[0].pipeHandle = INVALID_HANDLE_VALUE; + } + + return uv_translate_sys_error(err); +} + + +static DWORD WINAPI pipe_connect_thread_proc(void* parameter) { + uv_loop_t* loop; + uv_pipe_t* handle; + uv_connect_t* req; + HANDLE pipeHandle = INVALID_HANDLE_VALUE; + DWORD duplex_flags; + + req = (uv_connect_t*) parameter; + assert(req); + handle = (uv_pipe_t*) req->handle; + assert(handle); + loop = handle->loop; + assert(loop); + + /* We're here because CreateFile on a pipe returned ERROR_PIPE_BUSY. */ + /* We wait for the pipe to become available with WaitNamedPipe. */ + while (WaitNamedPipeW(handle->name, 30000)) { + /* The pipe is now available, try to connect. */ + pipeHandle = open_named_pipe(handle->name, &duplex_flags); + if (pipeHandle != INVALID_HANDLE_VALUE) { + break; + } + + SwitchToThread(); + } + + if (pipeHandle != INVALID_HANDLE_VALUE && + !uv_set_pipe_handle(loop, handle, pipeHandle, -1, duplex_flags)) { + SET_REQ_SUCCESS(req); + } else { + SET_REQ_ERROR(req, GetLastError()); + } + + /* Post completed */ + POST_COMPLETION_FOR_REQ(loop, req); + + return 0; +} + + +void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, + const char* name, uv_connect_cb cb) { + uv_loop_t* loop = handle->loop; + int err, nameSize; + HANDLE pipeHandle = INVALID_HANDLE_VALUE; + DWORD duplex_flags; + + uv_req_init(loop, (uv_req_t*) req); + req->type = UV_CONNECT; + req->handle = (uv_stream_t*) handle; + req->cb = cb; + + /* Convert name to UTF16. */ + nameSize = uv_utf8_to_utf16(name, NULL, 0) * sizeof(WCHAR); + handle->name = (WCHAR*)uv__malloc(nameSize); + if (!handle->name) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + if (!uv_utf8_to_utf16(name, handle->name, nameSize / sizeof(WCHAR))) { + err = GetLastError(); + goto error; + } + + pipeHandle = open_named_pipe(handle->name, &duplex_flags); + if (pipeHandle == INVALID_HANDLE_VALUE) { + if (GetLastError() == ERROR_PIPE_BUSY) { + /* Wait for the server to make a pipe instance available. */ + if (!QueueUserWorkItem(&pipe_connect_thread_proc, + req, + WT_EXECUTELONGFUNCTION)) { + err = GetLastError(); + goto error; + } + + REGISTER_HANDLE_REQ(loop, handle, req); + handle->reqs_pending++; + + return; + } + + err = GetLastError(); + goto error; + } + + assert(pipeHandle != INVALID_HANDLE_VALUE); + + if (uv_set_pipe_handle(loop, + (uv_pipe_t*) req->handle, + pipeHandle, + -1, + duplex_flags)) { + err = GetLastError(); + goto error; + } + + SET_REQ_SUCCESS(req); + uv_insert_pending_req(loop, (uv_req_t*) req); + handle->reqs_pending++; + REGISTER_HANDLE_REQ(loop, handle, req); + return; + +error: + if (handle->name) { + uv__free(handle->name); + handle->name = NULL; + } + + if (pipeHandle != INVALID_HANDLE_VALUE) { + CloseHandle(pipeHandle); + } + + /* Make this req pending reporting an error. */ + SET_REQ_ERROR(req, err); + uv_insert_pending_req(loop, (uv_req_t*) req); + handle->reqs_pending++; + REGISTER_HANDLE_REQ(loop, handle, req); + return; +} + + +void uv__pipe_pause_read(uv_pipe_t* handle) { + if (handle->flags & UV_HANDLE_PIPE_READ_CANCELABLE) { + /* Pause the ReadFile task briefly, to work + around the Windows kernel bug that causes + any access to a NamedPipe to deadlock if + any process has called ReadFile */ + HANDLE h; + uv_mutex_lock(&handle->pipe.conn.readfile_mutex); + h = handle->pipe.conn.readfile_thread; + while (h) { + /* spinlock: we expect this to finish quickly, + or we are probably about to deadlock anyways + (in the kernel), so it doesn't matter */ + pCancelSynchronousIo(h); + SwitchToThread(); /* yield thread control briefly */ + h = handle->pipe.conn.readfile_thread; + } + } +} + + +void uv__pipe_unpause_read(uv_pipe_t* handle) { + if (handle->flags & UV_HANDLE_PIPE_READ_CANCELABLE) { + uv_mutex_unlock(&handle->pipe.conn.readfile_mutex); + } +} + + +void uv__pipe_stop_read(uv_pipe_t* handle) { + handle->flags &= ~UV_HANDLE_READING; + uv__pipe_pause_read((uv_pipe_t*)handle); + uv__pipe_unpause_read((uv_pipe_t*)handle); +} + + +/* Cleans up uv_pipe_t (server or connection) and all resources associated */ +/* with it. */ +void uv_pipe_cleanup(uv_loop_t* loop, uv_pipe_t* handle) { + int i; + HANDLE pipeHandle; + + uv__pipe_stop_read(handle); + + if (handle->name) { + uv__free(handle->name); + handle->name = NULL; + } + + if (handle->flags & UV_HANDLE_PIPESERVER) { + for (i = 0; i < handle->pipe.serv.pending_instances; i++) { + pipeHandle = handle->pipe.serv.accept_reqs[i].pipeHandle; + if (pipeHandle != INVALID_HANDLE_VALUE) { + CloseHandle(pipeHandle); + handle->pipe.serv.accept_reqs[i].pipeHandle = INVALID_HANDLE_VALUE; + } + } + handle->handle = INVALID_HANDLE_VALUE; + } + + if (handle->flags & UV_HANDLE_CONNECTION) { + handle->flags &= ~UV_HANDLE_WRITABLE; + eof_timer_destroy(handle); + } + + if ((handle->flags & UV_HANDLE_CONNECTION) + && handle->handle != INVALID_HANDLE_VALUE) + close_pipe(handle); +} + + +void uv_pipe_close(uv_loop_t* loop, uv_pipe_t* handle) { + if (handle->flags & UV_HANDLE_READING) { + handle->flags &= ~UV_HANDLE_READING; + DECREASE_ACTIVE_COUNT(loop, handle); + } + + if (handle->flags & UV_HANDLE_LISTENING) { + handle->flags &= ~UV_HANDLE_LISTENING; + DECREASE_ACTIVE_COUNT(loop, handle); + } + + uv_pipe_cleanup(loop, handle); + + if (handle->reqs_pending == 0) { + uv_want_endgame(loop, (uv_handle_t*) handle); + } + + handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); + uv__handle_closing(handle); +} + + +static void uv_pipe_queue_accept(uv_loop_t* loop, uv_pipe_t* handle, + uv_pipe_accept_t* req, BOOL firstInstance) { + assert(handle->flags & UV_HANDLE_LISTENING); + + if (!firstInstance) { + assert(req->pipeHandle == INVALID_HANDLE_VALUE); + + req->pipeHandle = CreateNamedPipeW(handle->name, + PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, + PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, 65536, 65536, 0, NULL); + + if (req->pipeHandle == INVALID_HANDLE_VALUE) { + SET_REQ_ERROR(req, GetLastError()); + uv_insert_pending_req(loop, (uv_req_t*) req); + handle->reqs_pending++; + return; + } + + if (uv_set_pipe_handle(loop, handle, req->pipeHandle, -1, 0)) { + CloseHandle(req->pipeHandle); + req->pipeHandle = INVALID_HANDLE_VALUE; + SET_REQ_ERROR(req, GetLastError()); + uv_insert_pending_req(loop, (uv_req_t*) req); + handle->reqs_pending++; + return; + } + } + + assert(req->pipeHandle != INVALID_HANDLE_VALUE); + + /* Prepare the overlapped structure. */ + memset(&(req->u.io.overlapped), 0, sizeof(req->u.io.overlapped)); + + if (!ConnectNamedPipe(req->pipeHandle, &req->u.io.overlapped) && + GetLastError() != ERROR_IO_PENDING) { + if (GetLastError() == ERROR_PIPE_CONNECTED) { + SET_REQ_SUCCESS(req); + } else { + CloseHandle(req->pipeHandle); + req->pipeHandle = INVALID_HANDLE_VALUE; + /* Make this req pending reporting an error. */ + SET_REQ_ERROR(req, GetLastError()); + } + uv_insert_pending_req(loop, (uv_req_t*) req); + handle->reqs_pending++; + return; + } + + handle->reqs_pending++; +} + + +int uv_pipe_accept(uv_pipe_t* server, uv_stream_t* client) { + uv_loop_t* loop = server->loop; + uv_pipe_t* pipe_client; + uv_pipe_accept_t* req; + QUEUE* q; + uv__ipc_queue_item_t* item; + int err; + + if (server->ipc) { + if (QUEUE_EMPTY(&server->pipe.conn.pending_ipc_info.queue)) { + /* No valid pending sockets. */ + return WSAEWOULDBLOCK; + } + + q = QUEUE_HEAD(&server->pipe.conn.pending_ipc_info.queue); + QUEUE_REMOVE(q); + server->pipe.conn.pending_ipc_info.queue_len--; + item = QUEUE_DATA(q, uv__ipc_queue_item_t, member); + + err = uv_tcp_import((uv_tcp_t*)client, + &item->socket_info_ex, + item->tcp_connection); + if (err != 0) + return err; + + uv__free(item); + + } else { + pipe_client = (uv_pipe_t*)client; + + /* Find a connection instance that has been connected, but not yet */ + /* accepted. */ + req = server->pipe.serv.pending_accepts; + + if (!req) { + /* No valid connections found, so we error out. */ + return WSAEWOULDBLOCK; + } + + /* Initialize the client handle and copy the pipeHandle to the client */ + uv_pipe_connection_init(pipe_client); + pipe_client->handle = req->pipeHandle; + pipe_client->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE; + + /* Prepare the req to pick up a new connection */ + server->pipe.serv.pending_accepts = req->next_pending; + req->next_pending = NULL; + req->pipeHandle = INVALID_HANDLE_VALUE; + + if (!(server->flags & UV__HANDLE_CLOSING)) { + uv_pipe_queue_accept(loop, server, req, FALSE); + } + } + + return 0; +} + + +/* Starts listening for connections for the given pipe. */ +int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb) { + uv_loop_t* loop = handle->loop; + int i; + + if (handle->flags & UV_HANDLE_LISTENING) { + handle->stream.serv.connection_cb = cb; + } + + if (!(handle->flags & UV_HANDLE_BOUND)) { + return WSAEINVAL; + } + + if (handle->flags & UV_HANDLE_READING) { + return WSAEISCONN; + } + + if (!(handle->flags & UV_HANDLE_PIPESERVER)) { + return ERROR_NOT_SUPPORTED; + } + + handle->flags |= UV_HANDLE_LISTENING; + INCREASE_ACTIVE_COUNT(loop, handle); + handle->stream.serv.connection_cb = cb; + + /* First pipe handle should have already been created in uv_pipe_bind */ + assert(handle->pipe.serv.accept_reqs[0].pipeHandle != INVALID_HANDLE_VALUE); + + for (i = 0; i < handle->pipe.serv.pending_instances; i++) { + uv_pipe_queue_accept(loop, handle, &handle->pipe.serv.accept_reqs[i], i == 0); + } + + return 0; +} + + +static DWORD WINAPI uv_pipe_zero_readfile_thread_proc(void* parameter) { + int result; + DWORD bytes; + uv_read_t* req = (uv_read_t*) parameter; + uv_pipe_t* handle = (uv_pipe_t*) req->data; + uv_loop_t* loop = handle->loop; + HANDLE hThread = NULL; + DWORD err; + uv_mutex_t *m = &handle->pipe.conn.readfile_mutex; + + assert(req != NULL); + assert(req->type == UV_READ); + assert(handle->type == UV_NAMED_PIPE); + + if (handle->flags & UV_HANDLE_PIPE_READ_CANCELABLE) { + uv_mutex_lock(m); /* mutex controls *setting* of readfile_thread */ + if (DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), + GetCurrentProcess(), &hThread, + 0, TRUE, DUPLICATE_SAME_ACCESS)) { + handle->pipe.conn.readfile_thread = hThread; + } else { + hThread = NULL; + } + uv_mutex_unlock(m); + } +restart_readfile: + result = ReadFile(handle->handle, + &uv_zero_, + 0, + &bytes, + NULL); + if (!result) { + err = GetLastError(); + if (err == ERROR_OPERATION_ABORTED && + handle->flags & UV_HANDLE_PIPE_READ_CANCELABLE) { + if (handle->flags & UV_HANDLE_READING) { + /* just a brief break to do something else */ + handle->pipe.conn.readfile_thread = NULL; + /* resume after it is finished */ + uv_mutex_lock(m); + handle->pipe.conn.readfile_thread = hThread; + uv_mutex_unlock(m); + goto restart_readfile; + } else { + result = 1; /* successfully stopped reading */ + } + } + } + if (hThread) { + assert(hThread == handle->pipe.conn.readfile_thread); + /* mutex does not control clearing readfile_thread */ + handle->pipe.conn.readfile_thread = NULL; + uv_mutex_lock(m); + /* only when we hold the mutex lock is it safe to + open or close the handle */ + CloseHandle(hThread); + uv_mutex_unlock(m); + } + + if (!result) { + SET_REQ_ERROR(req, err); + } + + POST_COMPLETION_FOR_REQ(loop, req); + return 0; +} + + +static DWORD WINAPI uv_pipe_writefile_thread_proc(void* parameter) { + int result; + DWORD bytes; + uv_write_t* req = (uv_write_t*) parameter; + uv_pipe_t* handle = (uv_pipe_t*) req->handle; + uv_loop_t* loop = handle->loop; + + assert(req != NULL); + assert(req->type == UV_WRITE); + assert(handle->type == UV_NAMED_PIPE); + assert(req->write_buffer.base); + + result = WriteFile(handle->handle, + req->write_buffer.base, + req->write_buffer.len, + &bytes, + NULL); + + if (!result) { + SET_REQ_ERROR(req, GetLastError()); + } + + POST_COMPLETION_FOR_REQ(loop, req); + return 0; +} + + +static void CALLBACK post_completion_read_wait(void* context, BOOLEAN timed_out) { + uv_read_t* req; + uv_tcp_t* handle; + + req = (uv_read_t*) context; + assert(req != NULL); + handle = (uv_tcp_t*)req->data; + assert(handle != NULL); + assert(!timed_out); + + if (!PostQueuedCompletionStatus(handle->loop->iocp, + req->u.io.overlapped.InternalHigh, + 0, + &req->u.io.overlapped)) { + uv_fatal_error(GetLastError(), "PostQueuedCompletionStatus"); + } +} + + +static void CALLBACK post_completion_write_wait(void* context, BOOLEAN timed_out) { + uv_write_t* req; + uv_tcp_t* handle; + + req = (uv_write_t*) context; + assert(req != NULL); + handle = (uv_tcp_t*)req->handle; + assert(handle != NULL); + assert(!timed_out); + + if (!PostQueuedCompletionStatus(handle->loop->iocp, + req->u.io.overlapped.InternalHigh, + 0, + &req->u.io.overlapped)) { + uv_fatal_error(GetLastError(), "PostQueuedCompletionStatus"); + } +} + + +static void uv_pipe_queue_read(uv_loop_t* loop, uv_pipe_t* handle) { + uv_read_t* req; + int result; + + assert(handle->flags & UV_HANDLE_READING); + assert(!(handle->flags & UV_HANDLE_READ_PENDING)); + + assert(handle->handle != INVALID_HANDLE_VALUE); + + req = &handle->read_req; + + if (handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) { + if (!QueueUserWorkItem(&uv_pipe_zero_readfile_thread_proc, + req, + WT_EXECUTELONGFUNCTION)) { + /* Make this req pending reporting an error. */ + SET_REQ_ERROR(req, GetLastError()); + goto error; + } + } else { + memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + req->u.io.overlapped.hEvent = (HANDLE) ((uintptr_t) req->event_handle | 1); + } + + /* Do 0-read */ + result = ReadFile(handle->handle, + &uv_zero_, + 0, + NULL, + &req->u.io.overlapped); + + if (!result && GetLastError() != ERROR_IO_PENDING) { + /* Make this req pending reporting an error. */ + SET_REQ_ERROR(req, GetLastError()); + goto error; + } + + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + if (!req->event_handle) { + req->event_handle = CreateEvent(NULL, 0, 0, NULL); + if (!req->event_handle) { + uv_fatal_error(GetLastError(), "CreateEvent"); + } + } + if (req->wait_handle == INVALID_HANDLE_VALUE) { + if (!RegisterWaitForSingleObject(&req->wait_handle, + req->u.io.overlapped.hEvent, post_completion_read_wait, (void*) req, + INFINITE, WT_EXECUTEINWAITTHREAD)) { + SET_REQ_ERROR(req, GetLastError()); + goto error; + } + } + } + } + + /* Start the eof timer if there is one */ + eof_timer_start(handle); + handle->flags |= UV_HANDLE_READ_PENDING; + handle->reqs_pending++; + return; + +error: + uv_insert_pending_req(loop, (uv_req_t*)req); + handle->flags |= UV_HANDLE_READ_PENDING; + handle->reqs_pending++; +} + + +int uv_pipe_read_start(uv_pipe_t* handle, + uv_alloc_cb alloc_cb, + uv_read_cb read_cb) { + uv_loop_t* loop = handle->loop; + + handle->flags |= UV_HANDLE_READING; + INCREASE_ACTIVE_COUNT(loop, handle); + handle->read_cb = read_cb; + handle->alloc_cb = alloc_cb; + + /* If reading was stopped and then started again, there could still be a */ + /* read request pending. */ + if (!(handle->flags & UV_HANDLE_READ_PENDING)) + uv_pipe_queue_read(loop, handle); + + return 0; +} + + +static void uv_insert_non_overlapped_write_req(uv_pipe_t* handle, + uv_write_t* req) { + req->next_req = NULL; + if (handle->pipe.conn.non_overlapped_writes_tail) { + req->next_req = + handle->pipe.conn.non_overlapped_writes_tail->next_req; + handle->pipe.conn.non_overlapped_writes_tail->next_req = (uv_req_t*)req; + handle->pipe.conn.non_overlapped_writes_tail = req; + } else { + req->next_req = (uv_req_t*)req; + handle->pipe.conn.non_overlapped_writes_tail = req; + } +} + + +static uv_write_t* uv_remove_non_overlapped_write_req(uv_pipe_t* handle) { + uv_write_t* req; + + if (handle->pipe.conn.non_overlapped_writes_tail) { + req = (uv_write_t*)handle->pipe.conn.non_overlapped_writes_tail->next_req; + + if (req == handle->pipe.conn.non_overlapped_writes_tail) { + handle->pipe.conn.non_overlapped_writes_tail = NULL; + } else { + handle->pipe.conn.non_overlapped_writes_tail->next_req = + req->next_req; + } + + return req; + } else { + /* queue empty */ + return NULL; + } +} + + +static void uv_queue_non_overlapped_write(uv_pipe_t* handle) { + uv_write_t* req = uv_remove_non_overlapped_write_req(handle); + if (req) { + if (!QueueUserWorkItem(&uv_pipe_writefile_thread_proc, + req, + WT_EXECUTELONGFUNCTION)) { + uv_fatal_error(GetLastError(), "QueueUserWorkItem"); + } + } +} + + +static int uv_pipe_write_impl(uv_loop_t* loop, + uv_write_t* req, + uv_pipe_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_stream_t* send_handle, + uv_write_cb cb) { + int err; + int result; + uv_tcp_t* tcp_send_handle; + uv_write_t* ipc_header_req = NULL; + uv_ipc_frame_uv_stream ipc_frame; + + if (nbufs != 1 && (nbufs != 0 || !send_handle)) { + return ERROR_NOT_SUPPORTED; + } + + /* Only TCP handles are supported for sharing. */ + if (send_handle && ((send_handle->type != UV_TCP) || + (!(send_handle->flags & UV_HANDLE_BOUND) && + !(send_handle->flags & UV_HANDLE_CONNECTION)))) { + return ERROR_NOT_SUPPORTED; + } + + assert(handle->handle != INVALID_HANDLE_VALUE); + + uv_req_init(loop, (uv_req_t*) req); + req->type = UV_WRITE; + req->handle = (uv_stream_t*) handle; + req->cb = cb; + req->ipc_header = 0; + req->event_handle = NULL; + req->wait_handle = INVALID_HANDLE_VALUE; + memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); + + if (handle->ipc) { + assert(!(handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE)); + ipc_frame.header.flags = 0; + + /* Use the IPC framing protocol. */ + if (send_handle) { + tcp_send_handle = (uv_tcp_t*)send_handle; + + if (handle->pipe.conn.ipc_pid == 0) { + handle->pipe.conn.ipc_pid = uv_current_pid(); + } + + err = uv_tcp_duplicate_socket(tcp_send_handle, handle->pipe.conn.ipc_pid, + &ipc_frame.socket_info_ex.socket_info); + if (err) { + return err; + } + + ipc_frame.socket_info_ex.delayed_error = tcp_send_handle->delayed_error; + + ipc_frame.header.flags |= UV_IPC_TCP_SERVER; + + if (tcp_send_handle->flags & UV_HANDLE_CONNECTION) { + ipc_frame.header.flags |= UV_IPC_TCP_CONNECTION; + } + } + + if (nbufs == 1) { + ipc_frame.header.flags |= UV_IPC_RAW_DATA; + ipc_frame.header.raw_data_length = bufs[0].len; + } + + /* + * Use the provided req if we're only doing a single write. + * If we're doing multiple writes, use ipc_header_write_req to do + * the first write, and then use the provided req for the second write. + */ + if (!(ipc_frame.header.flags & UV_IPC_RAW_DATA)) { + ipc_header_req = req; + } else { + /* + * Try to use the preallocated write req if it's available. + * Otherwise allocate a new one. + */ + if (handle->pipe.conn.ipc_header_write_req.type != UV_WRITE) { + ipc_header_req = (uv_write_t*)&handle->pipe.conn.ipc_header_write_req; + } else { + ipc_header_req = (uv_write_t*)uv__malloc(sizeof(uv_write_t)); + if (!ipc_header_req) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + } + + uv_req_init(loop, (uv_req_t*) ipc_header_req); + ipc_header_req->type = UV_WRITE; + ipc_header_req->handle = (uv_stream_t*) handle; + ipc_header_req->cb = NULL; + ipc_header_req->ipc_header = 1; + } + + /* Write the header or the whole frame. */ + memset(&ipc_header_req->u.io.overlapped, 0, + sizeof(ipc_header_req->u.io.overlapped)); + + /* Using overlapped IO, but wait for completion before returning. + This write is blocking because ipc_frame is on stack. */ + ipc_header_req->u.io.overlapped.hEvent = CreateEvent(NULL, 1, 0, NULL); + if (!ipc_header_req->u.io.overlapped.hEvent) { + uv_fatal_error(GetLastError(), "CreateEvent"); + } + + result = WriteFile(handle->handle, + &ipc_frame, + ipc_frame.header.flags & UV_IPC_TCP_SERVER ? + sizeof(ipc_frame) : sizeof(ipc_frame.header), + NULL, + &ipc_header_req->u.io.overlapped); + if (!result && GetLastError() != ERROR_IO_PENDING) { + err = GetLastError(); + CloseHandle(ipc_header_req->u.io.overlapped.hEvent); + return err; + } + + if (!result) { + /* Request not completed immediately. Wait for it.*/ + if (WaitForSingleObject(ipc_header_req->u.io.overlapped.hEvent, INFINITE) != + WAIT_OBJECT_0) { + err = GetLastError(); + CloseHandle(ipc_header_req->u.io.overlapped.hEvent); + return err; + } + } + ipc_header_req->u.io.queued_bytes = 0; + CloseHandle(ipc_header_req->u.io.overlapped.hEvent); + ipc_header_req->u.io.overlapped.hEvent = NULL; + + REGISTER_HANDLE_REQ(loop, handle, ipc_header_req); + handle->reqs_pending++; + handle->stream.conn.write_reqs_pending++; + + /* If we don't have any raw data to write - we're done. */ + if (!(ipc_frame.header.flags & UV_IPC_RAW_DATA)) { + return 0; + } + } + + if ((handle->flags & + (UV_HANDLE_BLOCKING_WRITES | UV_HANDLE_NON_OVERLAPPED_PIPE)) == + (UV_HANDLE_BLOCKING_WRITES | UV_HANDLE_NON_OVERLAPPED_PIPE)) { + DWORD bytes; + result = WriteFile(handle->handle, + bufs[0].base, + bufs[0].len, + &bytes, + NULL); + + if (!result) { + err = GetLastError(); + return err; + } else { + /* Request completed immediately. */ + req->u.io.queued_bytes = 0; + } + + REGISTER_HANDLE_REQ(loop, handle, req); + handle->reqs_pending++; + handle->stream.conn.write_reqs_pending++; + POST_COMPLETION_FOR_REQ(loop, req); + return 0; + } else if (handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) { + req->write_buffer = bufs[0]; + uv_insert_non_overlapped_write_req(handle, req); + if (handle->stream.conn.write_reqs_pending == 0) { + uv_queue_non_overlapped_write(handle); + } + + /* Request queued by the kernel. */ + req->u.io.queued_bytes = bufs[0].len; + handle->write_queue_size += req->u.io.queued_bytes; + } else if (handle->flags & UV_HANDLE_BLOCKING_WRITES) { + /* Using overlapped IO, but wait for completion before returning */ + req->u.io.overlapped.hEvent = CreateEvent(NULL, 1, 0, NULL); + if (!req->u.io.overlapped.hEvent) { + uv_fatal_error(GetLastError(), "CreateEvent"); + } + + result = WriteFile(handle->handle, + bufs[0].base, + bufs[0].len, + NULL, + &req->u.io.overlapped); + + if (!result && GetLastError() != ERROR_IO_PENDING) { + err = GetLastError(); + CloseHandle(req->u.io.overlapped.hEvent); + return err; + } + + if (result) { + /* Request completed immediately. */ + req->u.io.queued_bytes = 0; + } else { + /* Request queued by the kernel. */ + req->u.io.queued_bytes = bufs[0].len; + handle->write_queue_size += req->u.io.queued_bytes; + if (WaitForSingleObject(req->u.io.overlapped.hEvent, INFINITE) != + WAIT_OBJECT_0) { + err = GetLastError(); + CloseHandle(req->u.io.overlapped.hEvent); + return uv_translate_sys_error(err); + } + } + CloseHandle(req->u.io.overlapped.hEvent); + + REGISTER_HANDLE_REQ(loop, handle, req); + handle->reqs_pending++; + handle->stream.conn.write_reqs_pending++; + return 0; + } else { + result = WriteFile(handle->handle, + bufs[0].base, + bufs[0].len, + NULL, + &req->u.io.overlapped); + + if (!result && GetLastError() != ERROR_IO_PENDING) { + return GetLastError(); + } + + if (result) { + /* Request completed immediately. */ + req->u.io.queued_bytes = 0; + } else { + /* Request queued by the kernel. */ + req->u.io.queued_bytes = bufs[0].len; + handle->write_queue_size += req->u.io.queued_bytes; + } + + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + req->event_handle = CreateEvent(NULL, 0, 0, NULL); + if (!req->event_handle) { + uv_fatal_error(GetLastError(), "CreateEvent"); + } + if (!RegisterWaitForSingleObject(&req->wait_handle, + req->u.io.overlapped.hEvent, post_completion_write_wait, (void*) req, + INFINITE, WT_EXECUTEINWAITTHREAD)) { + return GetLastError(); + } + } + } + + REGISTER_HANDLE_REQ(loop, handle, req); + handle->reqs_pending++; + handle->stream.conn.write_reqs_pending++; + + return 0; +} + + +int uv_pipe_write(uv_loop_t* loop, + uv_write_t* req, + uv_pipe_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_write_cb cb) { + return uv_pipe_write_impl(loop, req, handle, bufs, nbufs, NULL, cb); +} + + +int uv_pipe_write2(uv_loop_t* loop, + uv_write_t* req, + uv_pipe_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_stream_t* send_handle, + uv_write_cb cb) { + if (!handle->ipc) { + return WSAEINVAL; + } + + return uv_pipe_write_impl(loop, req, handle, bufs, nbufs, send_handle, cb); +} + + +static void uv_pipe_read_eof(uv_loop_t* loop, uv_pipe_t* handle, + uv_buf_t buf) { + /* If there is an eof timer running, we don't need it any more, */ + /* so discard it. */ + eof_timer_destroy(handle); + + handle->flags &= ~UV_HANDLE_READABLE; + uv_read_stop((uv_stream_t*) handle); + + handle->read_cb((uv_stream_t*) handle, UV_EOF, &buf); +} + + +static void uv_pipe_read_error(uv_loop_t* loop, uv_pipe_t* handle, int error, + uv_buf_t buf) { + /* If there is an eof timer running, we don't need it any more, */ + /* so discard it. */ + eof_timer_destroy(handle); + + uv_read_stop((uv_stream_t*) handle); + + handle->read_cb((uv_stream_t*)handle, uv_translate_sys_error(error), &buf); +} + + +static void uv_pipe_read_error_or_eof(uv_loop_t* loop, uv_pipe_t* handle, + int error, uv_buf_t buf) { + if (error == ERROR_BROKEN_PIPE) { + uv_pipe_read_eof(loop, handle, buf); + } else { + uv_pipe_read_error(loop, handle, error, buf); + } +} + + +void uv__pipe_insert_pending_socket(uv_pipe_t* handle, + uv__ipc_socket_info_ex* info, + int tcp_connection) { + uv__ipc_queue_item_t* item; + + item = (uv__ipc_queue_item_t*) uv__malloc(sizeof(*item)); + if (item == NULL) + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + + memcpy(&item->socket_info_ex, info, sizeof(item->socket_info_ex)); + item->tcp_connection = tcp_connection; + QUEUE_INSERT_TAIL(&handle->pipe.conn.pending_ipc_info.queue, &item->member); + handle->pipe.conn.pending_ipc_info.queue_len++; +} + + +void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_req_t* req) { + DWORD bytes, avail; + uv_buf_t buf; + uv_ipc_frame_uv_stream ipc_frame; + + assert(handle->type == UV_NAMED_PIPE); + + handle->flags &= ~UV_HANDLE_READ_PENDING; + eof_timer_stop(handle); + + if (!REQ_SUCCESS(req)) { + /* An error occurred doing the 0-read. */ + if (handle->flags & UV_HANDLE_READING) { + uv_pipe_read_error_or_eof(loop, + handle, + GET_REQ_ERROR(req), + uv_null_buf_); + } + } else { + /* Do non-blocking reads until the buffer is empty */ + while (handle->flags & UV_HANDLE_READING) { + if (!PeekNamedPipe(handle->handle, + NULL, + 0, + NULL, + &avail, + NULL)) { + uv_pipe_read_error_or_eof(loop, handle, GetLastError(), uv_null_buf_); + break; + } + + if (avail == 0) { + /* There is nothing to read after all. */ + break; + } + + if (handle->ipc) { + /* Use the IPC framing protocol to read the incoming data. */ + if (handle->pipe.conn.remaining_ipc_rawdata_bytes == 0) { + /* We're reading a new frame. First, read the header. */ + assert(avail >= sizeof(ipc_frame.header)); + + if (!ReadFile(handle->handle, + &ipc_frame.header, + sizeof(ipc_frame.header), + &bytes, + NULL)) { + uv_pipe_read_error_or_eof(loop, handle, GetLastError(), + uv_null_buf_); + break; + } + + assert(bytes == sizeof(ipc_frame.header)); + assert(ipc_frame.header.flags <= (UV_IPC_TCP_SERVER | UV_IPC_RAW_DATA | + UV_IPC_TCP_CONNECTION)); + + if (ipc_frame.header.flags & UV_IPC_TCP_SERVER) { + assert(avail - sizeof(ipc_frame.header) >= + sizeof(ipc_frame.socket_info_ex)); + + /* Read the TCP socket info. */ + if (!ReadFile(handle->handle, + &ipc_frame.socket_info_ex, + sizeof(ipc_frame) - sizeof(ipc_frame.header), + &bytes, + NULL)) { + uv_pipe_read_error_or_eof(loop, handle, GetLastError(), + uv_null_buf_); + break; + } + + assert(bytes == sizeof(ipc_frame) - sizeof(ipc_frame.header)); + + /* Store the pending socket info. */ + uv__pipe_insert_pending_socket( + handle, + &ipc_frame.socket_info_ex, + ipc_frame.header.flags & UV_IPC_TCP_CONNECTION); + } + + if (ipc_frame.header.flags & UV_IPC_RAW_DATA) { + handle->pipe.conn.remaining_ipc_rawdata_bytes = + ipc_frame.header.raw_data_length; + continue; + } + } else { + avail = min(avail, (DWORD)handle->pipe.conn.remaining_ipc_rawdata_bytes); + } + } + + handle->alloc_cb((uv_handle_t*) handle, avail, &buf); + if (buf.len == 0) { + handle->read_cb((uv_stream_t*) handle, UV_ENOBUFS, &buf); + break; + } + assert(buf.base != NULL); + + if (ReadFile(handle->handle, + buf.base, + min(buf.len, avail), + &bytes, + NULL)) { + /* Successful read */ + if (handle->ipc) { + assert(handle->pipe.conn.remaining_ipc_rawdata_bytes >= bytes); + handle->pipe.conn.remaining_ipc_rawdata_bytes = + handle->pipe.conn.remaining_ipc_rawdata_bytes - bytes; + } + handle->read_cb((uv_stream_t*)handle, bytes, &buf); + + /* Read again only if bytes == buf.len */ + if (bytes <= buf.len) { + break; + } + } else { + uv_pipe_read_error_or_eof(loop, handle, GetLastError(), buf); + break; + } + } + + /* Post another 0-read if still reading and not closing. */ + if ((handle->flags & UV_HANDLE_READING) && + !(handle->flags & UV_HANDLE_READ_PENDING)) { + uv_pipe_queue_read(loop, handle); + } + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +void uv_process_pipe_write_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_write_t* req) { + int err; + + assert(handle->type == UV_NAMED_PIPE); + + assert(handle->write_queue_size >= req->u.io.queued_bytes); + handle->write_queue_size -= req->u.io.queued_bytes; + + UNREGISTER_HANDLE_REQ(loop, handle, req); + + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + if (req->wait_handle != INVALID_HANDLE_VALUE) { + UnregisterWait(req->wait_handle); + req->wait_handle = INVALID_HANDLE_VALUE; + } + if (req->event_handle) { + CloseHandle(req->event_handle); + req->event_handle = NULL; + } + } + + if (req->ipc_header) { + if (req == &handle->pipe.conn.ipc_header_write_req) { + req->type = UV_UNKNOWN_REQ; + } else { + uv__free(req); + } + } else { + if (req->cb) { + err = GET_REQ_ERROR(req); + req->cb(req, uv_translate_sys_error(err)); + } + } + + handle->stream.conn.write_reqs_pending--; + + if (handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE && + handle->pipe.conn.non_overlapped_writes_tail) { + assert(handle->stream.conn.write_reqs_pending > 0); + uv_queue_non_overlapped_write(handle); + } + + if (handle->stream.conn.shutdown_req != NULL && + handle->stream.conn.write_reqs_pending == 0) { + uv_want_endgame(loop, (uv_handle_t*)handle); + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +void uv_process_pipe_accept_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_req_t* raw_req) { + uv_pipe_accept_t* req = (uv_pipe_accept_t*) raw_req; + + assert(handle->type == UV_NAMED_PIPE); + + if (handle->flags & UV__HANDLE_CLOSING) { + /* The req->pipeHandle should be freed already in uv_pipe_cleanup(). */ + assert(req->pipeHandle == INVALID_HANDLE_VALUE); + DECREASE_PENDING_REQ_COUNT(handle); + return; + } + + if (REQ_SUCCESS(req)) { + assert(req->pipeHandle != INVALID_HANDLE_VALUE); + req->next_pending = handle->pipe.serv.pending_accepts; + handle->pipe.serv.pending_accepts = req; + + if (handle->stream.serv.connection_cb) { + handle->stream.serv.connection_cb((uv_stream_t*)handle, 0); + } + } else { + if (req->pipeHandle != INVALID_HANDLE_VALUE) { + CloseHandle(req->pipeHandle); + req->pipeHandle = INVALID_HANDLE_VALUE; + } + if (!(handle->flags & UV__HANDLE_CLOSING)) { + uv_pipe_queue_accept(loop, handle, req, FALSE); + } + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +void uv_process_pipe_connect_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_connect_t* req) { + int err; + + assert(handle->type == UV_NAMED_PIPE); + + UNREGISTER_HANDLE_REQ(loop, handle, req); + + if (req->cb) { + err = 0; + if (REQ_SUCCESS(req)) { + uv_pipe_connection_init(handle); + } else { + err = GET_REQ_ERROR(req); + } + req->cb(req, uv_translate_sys_error(err)); + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +void uv_process_pipe_shutdown_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_shutdown_t* req) { + assert(handle->type == UV_NAMED_PIPE); + + UNREGISTER_HANDLE_REQ(loop, handle, req); + + if (handle->flags & UV_HANDLE_READABLE) { + /* Initialize and optionally start the eof timer. Only do this if the */ + /* pipe is readable and we haven't seen EOF come in ourselves. */ + eof_timer_init(handle); + + /* If reading start the timer right now. */ + /* Otherwise uv_pipe_queue_read will start it. */ + if (handle->flags & UV_HANDLE_READ_PENDING) { + eof_timer_start(handle); + } + + } else { + /* This pipe is not readable. We can just close it to let the other end */ + /* know that we're done writing. */ + close_pipe(handle); + } + + if (req->cb) { + req->cb(req, 0); + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +static void eof_timer_init(uv_pipe_t* pipe) { + int r; + + assert(pipe->pipe.conn.eof_timer == NULL); + assert(pipe->flags & UV_HANDLE_CONNECTION); + + pipe->pipe.conn.eof_timer = (uv_timer_t*) uv__malloc(sizeof *pipe->pipe.conn.eof_timer); + + r = uv_timer_init(pipe->loop, pipe->pipe.conn.eof_timer); + assert(r == 0); /* timers can't fail */ + pipe->pipe.conn.eof_timer->data = pipe; + uv_unref((uv_handle_t*) pipe->pipe.conn.eof_timer); +} + + +static void eof_timer_start(uv_pipe_t* pipe) { + assert(pipe->flags & UV_HANDLE_CONNECTION); + + if (pipe->pipe.conn.eof_timer != NULL) { + uv_timer_start(pipe->pipe.conn.eof_timer, eof_timer_cb, eof_timeout, 0); + } +} + + +static void eof_timer_stop(uv_pipe_t* pipe) { + assert(pipe->flags & UV_HANDLE_CONNECTION); + + if (pipe->pipe.conn.eof_timer != NULL) { + uv_timer_stop(pipe->pipe.conn.eof_timer); + } +} + + +static void eof_timer_cb(uv_timer_t* timer) { + uv_pipe_t* pipe = (uv_pipe_t*) timer->data; + uv_loop_t* loop = timer->loop; + + assert(pipe->type == UV_NAMED_PIPE); + + /* This should always be true, since we start the timer only */ + /* in uv_pipe_queue_read after successfully calling ReadFile, */ + /* or in uv_process_pipe_shutdown_req if a read is pending, */ + /* and we always immediately stop the timer in */ + /* uv_process_pipe_read_req. */ + assert(pipe->flags & UV_HANDLE_READ_PENDING); + + /* If there are many packets coming off the iocp then the timer callback */ + /* may be called before the read request is coming off the queue. */ + /* Therefore we check here if the read request has completed but will */ + /* be processed later. */ + if ((pipe->flags & UV_HANDLE_READ_PENDING) && + HasOverlappedIoCompleted(&pipe->read_req.u.io.overlapped)) { + return; + } + + /* Force both ends off the pipe. */ + close_pipe(pipe); + + /* Stop reading, so the pending read that is going to fail will */ + /* not be reported to the user. */ + uv_read_stop((uv_stream_t*) pipe); + + /* Report the eof and update flags. This will get reported even if the */ + /* user stopped reading in the meantime. TODO: is that okay? */ + uv_pipe_read_eof(loop, pipe, uv_null_buf_); +} + + +static void eof_timer_destroy(uv_pipe_t* pipe) { + assert(pipe->flags & UV_HANDLE_CONNECTION); + + if (pipe->pipe.conn.eof_timer) { + uv_close((uv_handle_t*) pipe->pipe.conn.eof_timer, eof_timer_close_cb); + pipe->pipe.conn.eof_timer = NULL; + } +} + + +static void eof_timer_close_cb(uv_handle_t* handle) { + assert(handle->type == UV_TIMER); + uv__free(handle); +} + + +int uv_pipe_open(uv_pipe_t* pipe, uv_file file) { + HANDLE os_handle = uv__get_osfhandle(file); + NTSTATUS nt_status; + IO_STATUS_BLOCK io_status; + FILE_ACCESS_INFORMATION access; + DWORD duplex_flags = 0; + + if (os_handle == INVALID_HANDLE_VALUE) + return UV_EBADF; + + /* In order to avoid closing a stdio file descriptor 0-2, duplicate the + * underlying OS handle and forget about the original fd. + * We could also opt to use the original OS handle and just never close it, + * but then there would be no reliable way to cancel pending read operations + * upon close. + */ + if (file <= 2) { + if (!DuplicateHandle(INVALID_HANDLE_VALUE, + os_handle, + INVALID_HANDLE_VALUE, + &os_handle, + 0, + FALSE, + DUPLICATE_SAME_ACCESS)) + return uv_translate_sys_error(GetLastError()); + file = -1; + } + + /* Determine what kind of permissions we have on this handle. + * Cygwin opens the pipe in message mode, but we can support it, + * just query the access flags and set the stream flags accordingly. + */ + nt_status = pNtQueryInformationFile(os_handle, + &io_status, + &access, + sizeof(access), + FileAccessInformation); + if (nt_status != STATUS_SUCCESS) + return UV_EINVAL; + + if (pipe->ipc) { + if (!(access.AccessFlags & FILE_WRITE_DATA) || + !(access.AccessFlags & FILE_READ_DATA)) { + return UV_EINVAL; + } + } + + if (access.AccessFlags & FILE_WRITE_DATA) + duplex_flags |= UV_HANDLE_WRITABLE; + if (access.AccessFlags & FILE_READ_DATA) + duplex_flags |= UV_HANDLE_READABLE; + + if (os_handle == INVALID_HANDLE_VALUE || + uv_set_pipe_handle(pipe->loop, + pipe, + os_handle, + file, + duplex_flags) == -1) { + return UV_EINVAL; + } + + uv_pipe_connection_init(pipe); + + if (pipe->ipc) { + assert(!(pipe->flags & UV_HANDLE_NON_OVERLAPPED_PIPE)); + pipe->pipe.conn.ipc_pid = uv_parent_pid(); + assert(pipe->pipe.conn.ipc_pid != -1); + } + return 0; +} + + +static int uv__pipe_getname(const uv_pipe_t* handle, char* buffer, size_t* size) { + NTSTATUS nt_status; + IO_STATUS_BLOCK io_status; + FILE_NAME_INFORMATION tmp_name_info; + FILE_NAME_INFORMATION* name_info; + WCHAR* name_buf; + unsigned int addrlen; + unsigned int name_size; + unsigned int name_len; + int err; + + name_info = NULL; + + if (handle->handle == INVALID_HANDLE_VALUE) { + *size = 0; + return UV_EINVAL; + } + + uv__pipe_pause_read((uv_pipe_t*)handle); /* cast away const warning */ + + nt_status = pNtQueryInformationFile(handle->handle, + &io_status, + &tmp_name_info, + sizeof tmp_name_info, + FileNameInformation); + if (nt_status == STATUS_BUFFER_OVERFLOW) { + name_size = sizeof(*name_info) + tmp_name_info.FileNameLength; + name_info = uv__malloc(name_size); + if (!name_info) { + *size = 0; + err = UV_ENOMEM; + goto cleanup; + } + + nt_status = pNtQueryInformationFile(handle->handle, + &io_status, + name_info, + name_size, + FileNameInformation); + } + + if (nt_status != STATUS_SUCCESS) { + *size = 0; + err = uv_translate_sys_error(pRtlNtStatusToDosError(nt_status)); + goto error; + } + + if (!name_info) { + /* the struct on stack was used */ + name_buf = tmp_name_info.FileName; + name_len = tmp_name_info.FileNameLength; + } else { + name_buf = name_info->FileName; + name_len = name_info->FileNameLength; + } + + if (name_len == 0) { + *size = 0; + err = 0; + goto error; + } + + name_len /= sizeof(WCHAR); + + /* check how much space we need */ + addrlen = WideCharToMultiByte(CP_UTF8, + 0, + name_buf, + name_len, + NULL, + 0, + NULL, + NULL); + if (!addrlen) { + *size = 0; + err = uv_translate_sys_error(GetLastError()); + goto error; + } else if (pipe_prefix_len + addrlen > *size) { + /* "\\\\.\\pipe" + name */ + *size = pipe_prefix_len + addrlen; + err = UV_ENOBUFS; + goto error; + } + + memcpy(buffer, pipe_prefix, pipe_prefix_len); + addrlen = WideCharToMultiByte(CP_UTF8, + 0, + name_buf, + name_len, + buffer+pipe_prefix_len, + *size-pipe_prefix_len, + NULL, + NULL); + if (!addrlen) { + *size = 0; + err = uv_translate_sys_error(GetLastError()); + goto error; + } + + addrlen += pipe_prefix_len; + *size = addrlen; + + err = 0; + goto cleanup; + +error: + uv__free(name_info); + +cleanup: + uv__pipe_unpause_read((uv_pipe_t*)handle); /* cast away const warning */ + return err; +} + + +int uv_pipe_pending_count(uv_pipe_t* handle) { + if (!handle->ipc) + return 0; + return handle->pipe.conn.pending_ipc_info.queue_len; +} + + +int uv_pipe_getsockname(const uv_pipe_t* handle, char* buffer, size_t* size) { + if (handle->flags & UV_HANDLE_BOUND) + return uv__pipe_getname(handle, buffer, size); + + if (handle->flags & UV_HANDLE_CONNECTION || + handle->handle != INVALID_HANDLE_VALUE) { + *size = 0; + return 0; + } + + return UV_EBADF; +} + + +int uv_pipe_getpeername(const uv_pipe_t* handle, char* buffer, size_t* size) { + /* emulate unix behaviour */ + if (handle->flags & UV_HANDLE_BOUND) + return UV_ENOTCONN; + + if (handle->handle != INVALID_HANDLE_VALUE) + return uv__pipe_getname(handle, buffer, size); + + return UV_EBADF; +} + + +uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) { + if (!handle->ipc) + return UV_UNKNOWN_HANDLE; + if (handle->pipe.conn.pending_ipc_info.queue_len == 0) + return UV_UNKNOWN_HANDLE; + else + return UV_TCP; +} diff --git a/3rdparty/libuv/src/win/poll.c b/3rdparty/libuv/src/win/poll.c new file mode 100644 index 00000000000..ce861d6ffc4 --- /dev/null +++ b/3rdparty/libuv/src/win/poll.c @@ -0,0 +1,635 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "req-inl.h" + + +static const GUID uv_msafd_provider_ids[UV_MSAFD_PROVIDER_COUNT] = { + {0xe70f1aa0, 0xab8b, 0x11cf, + {0x8c, 0xa3, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}, + {0xf9eab0c0, 0x26d4, 0x11d0, + {0xbb, 0xbf, 0x00, 0xaa, 0x00, 0x6c, 0x34, 0xe4}}, + {0x9fc48064, 0x7298, 0x43e4, + {0xb7, 0xbd, 0x18, 0x1f, 0x20, 0x89, 0x79, 0x2a}} +}; + +typedef struct uv_single_fd_set_s { + unsigned int fd_count; + SOCKET fd_array[1]; +} uv_single_fd_set_t; + + +static OVERLAPPED overlapped_dummy_; +static uv_once_t overlapped_dummy_init_guard_ = UV_ONCE_INIT; + +static AFD_POLL_INFO afd_poll_info_dummy_; + + +static void uv__init_overlapped_dummy(void) { + HANDLE event; + + event = CreateEvent(NULL, TRUE, TRUE, NULL); + if (event == NULL) + uv_fatal_error(GetLastError(), "CreateEvent"); + + memset(&overlapped_dummy_, 0, sizeof overlapped_dummy_); + overlapped_dummy_.hEvent = (HANDLE) ((uintptr_t) event | 1); +} + + +static OVERLAPPED* uv__get_overlapped_dummy() { + uv_once(&overlapped_dummy_init_guard_, uv__init_overlapped_dummy); + return &overlapped_dummy_; +} + + +static AFD_POLL_INFO* uv__get_afd_poll_info_dummy() { + return &afd_poll_info_dummy_; +} + + +static void uv__fast_poll_submit_poll_req(uv_loop_t* loop, uv_poll_t* handle) { + uv_req_t* req; + AFD_POLL_INFO* afd_poll_info; + DWORD result; + + /* Find a yet unsubmitted req to submit. */ + if (handle->submitted_events_1 == 0) { + req = &handle->poll_req_1; + afd_poll_info = &handle->afd_poll_info_1; + handle->submitted_events_1 = handle->events; + handle->mask_events_1 = 0; + handle->mask_events_2 = handle->events; + } else if (handle->submitted_events_2 == 0) { + req = &handle->poll_req_2; + afd_poll_info = &handle->afd_poll_info_2; + handle->submitted_events_2 = handle->events; + handle->mask_events_1 = handle->events; + handle->mask_events_2 = 0; + } else { + assert(0); + return; + } + + /* Setting Exclusive to TRUE makes the other poll request return if there */ + /* is any. */ + afd_poll_info->Exclusive = TRUE; + afd_poll_info->NumberOfHandles = 1; + afd_poll_info->Timeout.QuadPart = INT64_MAX; + afd_poll_info->Handles[0].Handle = (HANDLE) handle->socket; + afd_poll_info->Handles[0].Status = 0; + afd_poll_info->Handles[0].Events = 0; + + if (handle->events & UV_READABLE) { + afd_poll_info->Handles[0].Events |= AFD_POLL_RECEIVE | + AFD_POLL_DISCONNECT | AFD_POLL_ACCEPT | AFD_POLL_ABORT; + } + if (handle->events & UV_WRITABLE) { + afd_poll_info->Handles[0].Events |= AFD_POLL_SEND | AFD_POLL_CONNECT_FAIL; + } + + memset(&req->u.io.overlapped, 0, sizeof req->u.io.overlapped); + + result = uv_msafd_poll((SOCKET) handle->peer_socket, + afd_poll_info, + afd_poll_info, + &req->u.io.overlapped); + if (result != 0 && WSAGetLastError() != WSA_IO_PENDING) { + /* Queue this req, reporting an error. */ + SET_REQ_ERROR(req, WSAGetLastError()); + uv_insert_pending_req(loop, req); + } +} + + +static int uv__fast_poll_cancel_poll_req(uv_loop_t* loop, uv_poll_t* handle) { + AFD_POLL_INFO afd_poll_info; + DWORD result; + + afd_poll_info.Exclusive = TRUE; + afd_poll_info.NumberOfHandles = 1; + afd_poll_info.Timeout.QuadPart = INT64_MAX; + afd_poll_info.Handles[0].Handle = (HANDLE) handle->socket; + afd_poll_info.Handles[0].Status = 0; + afd_poll_info.Handles[0].Events = AFD_POLL_ALL; + + result = uv_msafd_poll(handle->socket, + &afd_poll_info, + uv__get_afd_poll_info_dummy(), + uv__get_overlapped_dummy()); + + if (result == SOCKET_ERROR) { + DWORD error = WSAGetLastError(); + if (error != WSA_IO_PENDING) + return error; + } + + return 0; +} + + +static void uv__fast_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, + uv_req_t* req) { + unsigned char mask_events; + AFD_POLL_INFO* afd_poll_info; + + if (req == &handle->poll_req_1) { + afd_poll_info = &handle->afd_poll_info_1; + handle->submitted_events_1 = 0; + mask_events = handle->mask_events_1; + } else if (req == &handle->poll_req_2) { + afd_poll_info = &handle->afd_poll_info_2; + handle->submitted_events_2 = 0; + mask_events = handle->mask_events_2; + } else { + assert(0); + return; + } + + /* Report an error unless the select was just interrupted. */ + if (!REQ_SUCCESS(req)) { + DWORD error = GET_REQ_SOCK_ERROR(req); + if (error != WSAEINTR && handle->events != 0) { + handle->events = 0; /* Stop the watcher */ + handle->poll_cb(handle, uv_translate_sys_error(error), 0); + } + + } else if (afd_poll_info->NumberOfHandles >= 1) { + unsigned char events = 0; + + if ((afd_poll_info->Handles[0].Events & (AFD_POLL_RECEIVE | + AFD_POLL_DISCONNECT | AFD_POLL_ACCEPT | AFD_POLL_ABORT)) != 0) { + events |= UV_READABLE; + } + if ((afd_poll_info->Handles[0].Events & (AFD_POLL_SEND | + AFD_POLL_CONNECT_FAIL)) != 0) { + events |= UV_WRITABLE; + } + + events &= handle->events & ~mask_events; + + if (afd_poll_info->Handles[0].Events & AFD_POLL_LOCAL_CLOSE) { + /* Stop polling. */ + handle->events = 0; + if (uv__is_active(handle)) + uv__handle_stop(handle); + } + + if (events != 0) { + handle->poll_cb(handle, 0, events); + } + } + + if ((handle->events & ~(handle->submitted_events_1 | + handle->submitted_events_2)) != 0) { + uv__fast_poll_submit_poll_req(loop, handle); + } else if ((handle->flags & UV__HANDLE_CLOSING) && + handle->submitted_events_1 == 0 && + handle->submitted_events_2 == 0) { + uv_want_endgame(loop, (uv_handle_t*) handle); + } +} + + +static int uv__fast_poll_set(uv_loop_t* loop, uv_poll_t* handle, int events) { + assert(handle->type == UV_POLL); + assert(!(handle->flags & UV__HANDLE_CLOSING)); + assert((events & ~(UV_READABLE | UV_WRITABLE)) == 0); + + handle->events = events; + + if (handle->events != 0) { + uv__handle_start(handle); + } else { + uv__handle_stop(handle); + } + + if ((handle->events & ~(handle->submitted_events_1 | + handle->submitted_events_2)) != 0) { + uv__fast_poll_submit_poll_req(handle->loop, handle); + } + + return 0; +} + + +static int uv__fast_poll_close(uv_loop_t* loop, uv_poll_t* handle) { + handle->events = 0; + uv__handle_closing(handle); + + if (handle->submitted_events_1 == 0 && + handle->submitted_events_2 == 0) { + uv_want_endgame(loop, (uv_handle_t*) handle); + return 0; + } else { + /* Cancel outstanding poll requests by executing another, unique poll */ + /* request that forces the outstanding ones to return. */ + return uv__fast_poll_cancel_poll_req(loop, handle); + } +} + + +static SOCKET uv__fast_poll_create_peer_socket(HANDLE iocp, + WSAPROTOCOL_INFOW* protocol_info) { + SOCKET sock = 0; + + sock = WSASocketW(protocol_info->iAddressFamily, + protocol_info->iSocketType, + protocol_info->iProtocol, + protocol_info, + 0, + WSA_FLAG_OVERLAPPED); + if (sock == INVALID_SOCKET) { + return INVALID_SOCKET; + } + + if (!SetHandleInformation((HANDLE) sock, HANDLE_FLAG_INHERIT, 0)) { + goto error; + }; + + if (CreateIoCompletionPort((HANDLE) sock, + iocp, + (ULONG_PTR) sock, + 0) == NULL) { + goto error; + } + + return sock; + + error: + closesocket(sock); + return INVALID_SOCKET; +} + + +static SOCKET uv__fast_poll_get_peer_socket(uv_loop_t* loop, + WSAPROTOCOL_INFOW* protocol_info) { + int index, i; + SOCKET peer_socket; + + index = -1; + for (i = 0; (size_t) i < ARRAY_SIZE(uv_msafd_provider_ids); i++) { + if (memcmp((void*) &protocol_info->ProviderId, + (void*) &uv_msafd_provider_ids[i], + sizeof protocol_info->ProviderId) == 0) { + index = i; + } + } + + /* Check if the protocol uses an msafd socket. */ + if (index < 0) { + return INVALID_SOCKET; + } + + /* If we didn't (try) to create a peer socket yet, try to make one. Don't */ + /* try again if the peer socket creation failed earlier for the same */ + /* protocol. */ + peer_socket = loop->poll_peer_sockets[index]; + if (peer_socket == 0) { + peer_socket = uv__fast_poll_create_peer_socket(loop->iocp, protocol_info); + loop->poll_peer_sockets[index] = peer_socket; + } + + return peer_socket; +} + + +static DWORD WINAPI uv__slow_poll_thread_proc(void* arg) { + uv_req_t* req = (uv_req_t*) arg; + uv_poll_t* handle = (uv_poll_t*) req->data; + unsigned char reported_events; + int r; + uv_single_fd_set_t rfds, wfds, efds; + struct timeval timeout; + + assert(handle->type == UV_POLL); + assert(req->type == UV_POLL_REQ); + + if (handle->events & UV_READABLE) { + rfds.fd_count = 1; + rfds.fd_array[0] = handle->socket; + } else { + rfds.fd_count = 0; + } + + if (handle->events & UV_WRITABLE) { + wfds.fd_count = 1; + wfds.fd_array[0] = handle->socket; + efds.fd_count = 1; + efds.fd_array[0] = handle->socket; + } else { + wfds.fd_count = 0; + efds.fd_count = 0; + } + + /* Make the select() time out after 3 minutes. If select() hangs because */ + /* the user closed the socket, we will at least not hang indefinitely. */ + timeout.tv_sec = 3 * 60; + timeout.tv_usec = 0; + + r = select(1, (fd_set*) &rfds, (fd_set*) &wfds, (fd_set*) &efds, &timeout); + if (r == SOCKET_ERROR) { + /* Queue this req, reporting an error. */ + SET_REQ_ERROR(&handle->poll_req_1, WSAGetLastError()); + POST_COMPLETION_FOR_REQ(handle->loop, req); + return 0; + } + + reported_events = 0; + + if (r > 0) { + if (rfds.fd_count > 0) { + assert(rfds.fd_count == 1); + assert(rfds.fd_array[0] == handle->socket); + reported_events |= UV_READABLE; + } + + if (wfds.fd_count > 0) { + assert(wfds.fd_count == 1); + assert(wfds.fd_array[0] == handle->socket); + reported_events |= UV_WRITABLE; + } else if (efds.fd_count > 0) { + assert(efds.fd_count == 1); + assert(efds.fd_array[0] == handle->socket); + reported_events |= UV_WRITABLE; + } + } + + SET_REQ_SUCCESS(req); + req->u.io.overlapped.InternalHigh = (DWORD) reported_events; + POST_COMPLETION_FOR_REQ(handle->loop, req); + + return 0; +} + + +static void uv__slow_poll_submit_poll_req(uv_loop_t* loop, uv_poll_t* handle) { + uv_req_t* req; + + /* Find a yet unsubmitted req to submit. */ + if (handle->submitted_events_1 == 0) { + req = &handle->poll_req_1; + handle->submitted_events_1 = handle->events; + handle->mask_events_1 = 0; + handle->mask_events_2 = handle->events; + } else if (handle->submitted_events_2 == 0) { + req = &handle->poll_req_2; + handle->submitted_events_2 = handle->events; + handle->mask_events_1 = handle->events; + handle->mask_events_2 = 0; + } else { + assert(0); + return; + } + + if (!QueueUserWorkItem(uv__slow_poll_thread_proc, + (void*) req, + WT_EXECUTELONGFUNCTION)) { + /* Make this req pending, reporting an error. */ + SET_REQ_ERROR(req, GetLastError()); + uv_insert_pending_req(loop, req); + } +} + + + +static void uv__slow_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, + uv_req_t* req) { + unsigned char mask_events; + int err; + + if (req == &handle->poll_req_1) { + handle->submitted_events_1 = 0; + mask_events = handle->mask_events_1; + } else if (req == &handle->poll_req_2) { + handle->submitted_events_2 = 0; + mask_events = handle->mask_events_2; + } else { + assert(0); + return; + } + + if (!REQ_SUCCESS(req)) { + /* Error. */ + if (handle->events != 0) { + err = GET_REQ_ERROR(req); + handle->events = 0; /* Stop the watcher */ + handle->poll_cb(handle, uv_translate_sys_error(err), 0); + } + } else { + /* Got some events. */ + int events = req->u.io.overlapped.InternalHigh & handle->events & ~mask_events; + if (events != 0) { + handle->poll_cb(handle, 0, events); + } + } + + if ((handle->events & ~(handle->submitted_events_1 | + handle->submitted_events_2)) != 0) { + uv__slow_poll_submit_poll_req(loop, handle); + } else if ((handle->flags & UV__HANDLE_CLOSING) && + handle->submitted_events_1 == 0 && + handle->submitted_events_2 == 0) { + uv_want_endgame(loop, (uv_handle_t*) handle); + } +} + + +static int uv__slow_poll_set(uv_loop_t* loop, uv_poll_t* handle, int events) { + assert(handle->type == UV_POLL); + assert(!(handle->flags & UV__HANDLE_CLOSING)); + assert((events & ~(UV_READABLE | UV_WRITABLE)) == 0); + + handle->events = events; + + if (handle->events != 0) { + uv__handle_start(handle); + } else { + uv__handle_stop(handle); + } + + if ((handle->events & + ~(handle->submitted_events_1 | handle->submitted_events_2)) != 0) { + uv__slow_poll_submit_poll_req(handle->loop, handle); + } + + return 0; +} + + +static int uv__slow_poll_close(uv_loop_t* loop, uv_poll_t* handle) { + handle->events = 0; + uv__handle_closing(handle); + + if (handle->submitted_events_1 == 0 && + handle->submitted_events_2 == 0) { + uv_want_endgame(loop, (uv_handle_t*) handle); + } + + return 0; +} + + +int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) { + return uv_poll_init_socket(loop, handle, (SOCKET) uv__get_osfhandle(fd)); +} + + +int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle, + uv_os_sock_t socket) { + WSAPROTOCOL_INFOW protocol_info; + int len; + SOCKET peer_socket, base_socket; + DWORD bytes; + DWORD yes = 1; + + /* Set the socket to nonblocking mode */ + if (ioctlsocket(socket, FIONBIO, &yes) == SOCKET_ERROR) + return uv_translate_sys_error(WSAGetLastError()); + + /* Try to obtain a base handle for the socket. This increases this chances */ + /* that we find an AFD handle and are able to use the fast poll mechanism. */ + /* This will always fail on windows XP/2k3, since they don't support the */ + /* SIO_BASE_HANDLE ioctl. */ +#ifndef NDEBUG + base_socket = INVALID_SOCKET; +#endif + + if (WSAIoctl(socket, + SIO_BASE_HANDLE, + NULL, + 0, + &base_socket, + sizeof base_socket, + &bytes, + NULL, + NULL) == 0) { + assert(base_socket != 0 && base_socket != INVALID_SOCKET); + socket = base_socket; + } + + uv__handle_init(loop, (uv_handle_t*) handle, UV_POLL); + handle->socket = socket; + handle->events = 0; + + /* Obtain protocol information about the socket. */ + len = sizeof protocol_info; + if (getsockopt(socket, + SOL_SOCKET, + SO_PROTOCOL_INFOW, + (char*) &protocol_info, + &len) != 0) { + return uv_translate_sys_error(WSAGetLastError()); + } + + /* Get the peer socket that is needed to enable fast poll. If the returned */ + /* value is NULL, the protocol is not implemented by MSAFD and we'll have */ + /* to use slow mode. */ + peer_socket = uv__fast_poll_get_peer_socket(loop, &protocol_info); + + if (peer_socket != INVALID_SOCKET) { + /* Initialize fast poll specific fields. */ + handle->peer_socket = peer_socket; + } else { + /* Initialize slow poll specific fields. */ + handle->flags |= UV_HANDLE_POLL_SLOW; + } + + /* Initialize 2 poll reqs. */ + handle->submitted_events_1 = 0; + uv_req_init(loop, (uv_req_t*) &(handle->poll_req_1)); + handle->poll_req_1.type = UV_POLL_REQ; + handle->poll_req_1.data = handle; + + handle->submitted_events_2 = 0; + uv_req_init(loop, (uv_req_t*) &(handle->poll_req_2)); + handle->poll_req_2.type = UV_POLL_REQ; + handle->poll_req_2.data = handle; + + return 0; +} + + +int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb) { + int err; + + if (!(handle->flags & UV_HANDLE_POLL_SLOW)) { + err = uv__fast_poll_set(handle->loop, handle, events); + } else { + err = uv__slow_poll_set(handle->loop, handle, events); + } + + if (err) { + return uv_translate_sys_error(err); + } + + handle->poll_cb = cb; + + return 0; +} + + +int uv_poll_stop(uv_poll_t* handle) { + int err; + + if (!(handle->flags & UV_HANDLE_POLL_SLOW)) { + err = uv__fast_poll_set(handle->loop, handle, 0); + } else { + err = uv__slow_poll_set(handle->loop, handle, 0); + } + + return uv_translate_sys_error(err); +} + + +void uv_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, uv_req_t* req) { + if (!(handle->flags & UV_HANDLE_POLL_SLOW)) { + uv__fast_poll_process_poll_req(loop, handle, req); + } else { + uv__slow_poll_process_poll_req(loop, handle, req); + } +} + + +int uv_poll_close(uv_loop_t* loop, uv_poll_t* handle) { + if (!(handle->flags & UV_HANDLE_POLL_SLOW)) { + return uv__fast_poll_close(loop, handle); + } else { + return uv__slow_poll_close(loop, handle); + } +} + + +void uv_poll_endgame(uv_loop_t* loop, uv_poll_t* handle) { + assert(handle->flags & UV__HANDLE_CLOSING); + assert(!(handle->flags & UV_HANDLE_CLOSED)); + + assert(handle->submitted_events_1 == 0); + assert(handle->submitted_events_2 == 0); + + uv__handle_close(handle); +} diff --git a/3rdparty/libuv/src/win/process-stdio.c b/3rdparty/libuv/src/win/process-stdio.c new file mode 100644 index 00000000000..e3c06f57dea --- /dev/null +++ b/3rdparty/libuv/src/win/process-stdio.c @@ -0,0 +1,510 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" + + +/* + * The `child_stdio_buffer` buffer has the following layout: + * int number_of_fds + * unsigned char crt_flags[number_of_fds] + * HANDLE os_handle[number_of_fds] + */ +#define CHILD_STDIO_SIZE(count) \ + (sizeof(int) + \ + sizeof(unsigned char) * (count) + \ + sizeof(uintptr_t) * (count)) + +#define CHILD_STDIO_COUNT(buffer) \ + *((unsigned int*) (buffer)) + +#define CHILD_STDIO_CRT_FLAGS(buffer, fd) \ + *((unsigned char*) (buffer) + sizeof(int) + fd) + +#define CHILD_STDIO_HANDLE(buffer, fd) \ + *((HANDLE*) ((unsigned char*) (buffer) + \ + sizeof(int) + \ + sizeof(unsigned char) * \ + CHILD_STDIO_COUNT((buffer)) + \ + sizeof(HANDLE) * (fd))) + + +/* CRT file descriptor mode flags */ +#define FOPEN 0x01 +#define FEOFLAG 0x02 +#define FCRLF 0x04 +#define FPIPE 0x08 +#define FNOINHERIT 0x10 +#define FAPPEND 0x20 +#define FDEV 0x40 +#define FTEXT 0x80 + + +/* + * Clear the HANDLE_FLAG_INHERIT flag from all HANDLEs that were inherited + * the parent process. Don't check for errors - the stdio handles may not be + * valid, or may be closed already. There is no guarantee that this function + * does a perfect job. + */ +void uv_disable_stdio_inheritance(void) { + HANDLE handle; + STARTUPINFOW si; + + /* Make the windows stdio handles non-inheritable. */ + handle = GetStdHandle(STD_INPUT_HANDLE); + if (handle != NULL && handle != INVALID_HANDLE_VALUE) + SetHandleInformation(handle, HANDLE_FLAG_INHERIT, 0); + + handle = GetStdHandle(STD_OUTPUT_HANDLE); + if (handle != NULL && handle != INVALID_HANDLE_VALUE) + SetHandleInformation(handle, HANDLE_FLAG_INHERIT, 0); + + handle = GetStdHandle(STD_ERROR_HANDLE); + if (handle != NULL && handle != INVALID_HANDLE_VALUE) + SetHandleInformation(handle, HANDLE_FLAG_INHERIT, 0); + + /* Make inherited CRT FDs non-inheritable. */ + GetStartupInfoW(&si); + if (uv__stdio_verify(si.lpReserved2, si.cbReserved2)) + uv__stdio_noinherit(si.lpReserved2); +} + + +static int uv__create_stdio_pipe_pair(uv_loop_t* loop, + uv_pipe_t* server_pipe, HANDLE* child_pipe_ptr, unsigned int flags) { + char pipe_name[64]; + SECURITY_ATTRIBUTES sa; + DWORD server_access = 0; + DWORD client_access = 0; + HANDLE child_pipe = INVALID_HANDLE_VALUE; + int err; + + if (flags & UV_READABLE_PIPE) { + /* The server needs inbound access too, otherwise CreateNamedPipe() */ + /* won't give us the FILE_READ_ATTRIBUTES permission. We need that to */ + /* probe the state of the write buffer when we're trying to shutdown */ + /* the pipe. */ + server_access |= PIPE_ACCESS_OUTBOUND | PIPE_ACCESS_INBOUND; + client_access |= GENERIC_READ | FILE_WRITE_ATTRIBUTES; + } + if (flags & UV_WRITABLE_PIPE) { + server_access |= PIPE_ACCESS_INBOUND; + client_access |= GENERIC_WRITE | FILE_READ_ATTRIBUTES; + } + + /* Create server pipe handle. */ + err = uv_stdio_pipe_server(loop, + server_pipe, + server_access, + pipe_name, + sizeof(pipe_name)); + if (err) + goto error; + + /* Create child pipe handle. */ + sa.nLength = sizeof sa; + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; + + child_pipe = CreateFileA(pipe_name, + client_access, + 0, + &sa, + OPEN_EXISTING, + server_pipe->ipc ? FILE_FLAG_OVERLAPPED : 0, + NULL); + if (child_pipe == INVALID_HANDLE_VALUE) { + err = GetLastError(); + goto error; + } + +#ifndef NDEBUG + /* Validate that the pipe was opened in the right mode. */ + { + DWORD mode; + BOOL r = GetNamedPipeHandleState(child_pipe, + &mode, + NULL, + NULL, + NULL, + NULL, + 0); + assert(r == TRUE); + assert(mode == (PIPE_READMODE_BYTE | PIPE_WAIT)); + } +#endif + + /* Do a blocking ConnectNamedPipe. This should not block because we have */ + /* both ends of the pipe created. */ + if (!ConnectNamedPipe(server_pipe->handle, NULL)) { + if (GetLastError() != ERROR_PIPE_CONNECTED) { + err = GetLastError(); + goto error; + } + } + + /* The server end is now readable and/or writable. */ + if (flags & UV_READABLE_PIPE) + server_pipe->flags |= UV_HANDLE_WRITABLE; + if (flags & UV_WRITABLE_PIPE) + server_pipe->flags |= UV_HANDLE_READABLE; + + *child_pipe_ptr = child_pipe; + return 0; + + error: + if (server_pipe->handle != INVALID_HANDLE_VALUE) { + uv_pipe_cleanup(loop, server_pipe); + } + + if (child_pipe != INVALID_HANDLE_VALUE) { + CloseHandle(child_pipe); + } + + return err; +} + + +static int uv__duplicate_handle(uv_loop_t* loop, HANDLE handle, HANDLE* dup) { + HANDLE current_process; + + + /* _get_osfhandle will sometimes return -2 in case of an error. This seems */ + /* to happen when fd <= 2 and the process' corresponding stdio handle is */ + /* set to NULL. Unfortunately DuplicateHandle will happily duplicate */ + /* (HANDLE) -2, so this situation goes unnoticed until someone tries to */ + /* use the duplicate. Therefore we filter out known-invalid handles here. */ + if (handle == INVALID_HANDLE_VALUE || + handle == NULL || + handle == (HANDLE) -2) { + *dup = INVALID_HANDLE_VALUE; + return ERROR_INVALID_HANDLE; + } + + current_process = GetCurrentProcess(); + + if (!DuplicateHandle(current_process, + handle, + current_process, + dup, + 0, + TRUE, + DUPLICATE_SAME_ACCESS)) { + *dup = INVALID_HANDLE_VALUE; + return GetLastError(); + } + + return 0; +} + + +static int uv__duplicate_fd(uv_loop_t* loop, int fd, HANDLE* dup) { + HANDLE handle; + + if (fd == -1) { + *dup = INVALID_HANDLE_VALUE; + return ERROR_INVALID_HANDLE; + } + + handle = uv__get_osfhandle(fd); + return uv__duplicate_handle(loop, handle, dup); +} + + +int uv__create_nul_handle(HANDLE* handle_ptr, + DWORD access) { + HANDLE handle; + SECURITY_ATTRIBUTES sa; + + sa.nLength = sizeof sa; + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; + + handle = CreateFileW(L"NUL", + access, + FILE_SHARE_READ | FILE_SHARE_WRITE, + &sa, + OPEN_EXISTING, + 0, + NULL); + if (handle == INVALID_HANDLE_VALUE) { + return GetLastError(); + } + + *handle_ptr = handle; + return 0; +} + + +int uv__stdio_create(uv_loop_t* loop, + const uv_process_options_t* options, + BYTE** buffer_ptr) { + BYTE* buffer; + int count, i; + int err; + + count = options->stdio_count; + + if (count < 0 || count > 255) { + /* Only support FDs 0-255 */ + return ERROR_NOT_SUPPORTED; + } else if (count < 3) { + /* There should always be at least 3 stdio handles. */ + count = 3; + } + + /* Allocate the child stdio buffer */ + buffer = (BYTE*) uv__malloc(CHILD_STDIO_SIZE(count)); + if (buffer == NULL) { + return ERROR_OUTOFMEMORY; + } + + /* Prepopulate the buffer with INVALID_HANDLE_VALUE handles so we can */ + /* clean up on failure. */ + CHILD_STDIO_COUNT(buffer) = count; + for (i = 0; i < count; i++) { + CHILD_STDIO_CRT_FLAGS(buffer, i) = 0; + CHILD_STDIO_HANDLE(buffer, i) = INVALID_HANDLE_VALUE; + } + + for (i = 0; i < count; i++) { + uv_stdio_container_t fdopt; + if (i < options->stdio_count) { + fdopt = options->stdio[i]; + } else { + fdopt.flags = UV_IGNORE; + } + + switch (fdopt.flags & (UV_IGNORE | UV_CREATE_PIPE | UV_INHERIT_FD | + UV_INHERIT_STREAM)) { + case UV_IGNORE: + /* Starting a process with no stdin/stout/stderr can confuse it. */ + /* So no matter what the user specified, we make sure the first */ + /* three FDs are always open in their typical modes, e.g. stdin */ + /* be readable and stdout/err should be writable. For FDs > 2, don't */ + /* do anything - all handles in the stdio buffer are initialized with */ + /* INVALID_HANDLE_VALUE, which should be okay. */ + if (i <= 2) { + DWORD access = (i == 0) ? FILE_GENERIC_READ : + FILE_GENERIC_WRITE | FILE_READ_ATTRIBUTES; + + err = uv__create_nul_handle(&CHILD_STDIO_HANDLE(buffer, i), + access); + if (err) + goto error; + + CHILD_STDIO_CRT_FLAGS(buffer, i) = FOPEN | FDEV; + } + break; + + case UV_CREATE_PIPE: { + /* Create a pair of two connected pipe ends; one end is turned into */ + /* an uv_pipe_t for use by the parent. The other one is given to */ + /* the child. */ + uv_pipe_t* parent_pipe = (uv_pipe_t*) fdopt.data.stream; + HANDLE child_pipe = INVALID_HANDLE_VALUE; + + /* Create a new, connected pipe pair. stdio[i].stream should point */ + /* to an uninitialized, but not connected pipe handle. */ + assert(fdopt.data.stream->type == UV_NAMED_PIPE); + assert(!(fdopt.data.stream->flags & UV_HANDLE_CONNECTION)); + assert(!(fdopt.data.stream->flags & UV_HANDLE_PIPESERVER)); + + err = uv__create_stdio_pipe_pair(loop, + parent_pipe, + &child_pipe, + fdopt.flags); + if (err) + goto error; + + CHILD_STDIO_HANDLE(buffer, i) = child_pipe; + CHILD_STDIO_CRT_FLAGS(buffer, i) = FOPEN | FPIPE; + break; + } + + case UV_INHERIT_FD: { + /* Inherit a raw FD. */ + HANDLE child_handle; + + /* Make an inheritable duplicate of the handle. */ + err = uv__duplicate_fd(loop, fdopt.data.fd, &child_handle); + if (err) { + /* If fdopt.data.fd is not valid and fd fd <= 2, then ignore the */ + /* error. */ + if (fdopt.data.fd <= 2 && err == ERROR_INVALID_HANDLE) { + CHILD_STDIO_CRT_FLAGS(buffer, i) = 0; + CHILD_STDIO_HANDLE(buffer, i) = INVALID_HANDLE_VALUE; + break; + } + goto error; + } + + /* Figure out what the type is. */ + switch (GetFileType(child_handle)) { + case FILE_TYPE_DISK: + CHILD_STDIO_CRT_FLAGS(buffer, i) = FOPEN; + break; + + case FILE_TYPE_PIPE: + CHILD_STDIO_CRT_FLAGS(buffer, i) = FOPEN | FPIPE; + + case FILE_TYPE_CHAR: + case FILE_TYPE_REMOTE: + CHILD_STDIO_CRT_FLAGS(buffer, i) = FOPEN | FDEV; + break; + + case FILE_TYPE_UNKNOWN: + if (GetLastError() != 0) { + err = GetLastError(); + CloseHandle(child_handle); + goto error; + } + CHILD_STDIO_CRT_FLAGS(buffer, i) = FOPEN | FDEV; + break; + + default: + assert(0); + return -1; + } + + CHILD_STDIO_HANDLE(buffer, i) = child_handle; + break; + } + + case UV_INHERIT_STREAM: { + /* Use an existing stream as the stdio handle for the child. */ + HANDLE stream_handle, child_handle; + unsigned char crt_flags; + uv_stream_t* stream = fdopt.data.stream; + + /* Leech the handle out of the stream. */ + if (stream->type == UV_TTY) { + stream_handle = ((uv_tty_t*) stream)->handle; + crt_flags = FOPEN | FDEV; + } else if (stream->type == UV_NAMED_PIPE && + stream->flags & UV_HANDLE_CONNECTION) { + stream_handle = ((uv_pipe_t*) stream)->handle; + crt_flags = FOPEN | FPIPE; + } else { + stream_handle = INVALID_HANDLE_VALUE; + crt_flags = 0; + } + + if (stream_handle == NULL || + stream_handle == INVALID_HANDLE_VALUE) { + /* The handle is already closed, or not yet created, or the */ + /* stream type is not supported. */ + err = ERROR_NOT_SUPPORTED; + goto error; + } + + /* Make an inheritable copy of the handle. */ + err = uv__duplicate_handle(loop, stream_handle, &child_handle); + if (err) + goto error; + + CHILD_STDIO_HANDLE(buffer, i) = child_handle; + CHILD_STDIO_CRT_FLAGS(buffer, i) = crt_flags; + break; + } + + default: + assert(0); + return -1; + } + } + + *buffer_ptr = buffer; + return 0; + + error: + uv__stdio_destroy(buffer); + return err; +} + + +void uv__stdio_destroy(BYTE* buffer) { + int i, count; + + count = CHILD_STDIO_COUNT(buffer); + for (i = 0; i < count; i++) { + HANDLE handle = CHILD_STDIO_HANDLE(buffer, i); + if (handle != INVALID_HANDLE_VALUE) { + CloseHandle(handle); + } + } + + uv__free(buffer); +} + + +void uv__stdio_noinherit(BYTE* buffer) { + int i, count; + + count = CHILD_STDIO_COUNT(buffer); + for (i = 0; i < count; i++) { + HANDLE handle = CHILD_STDIO_HANDLE(buffer, i); + if (handle != INVALID_HANDLE_VALUE) { + SetHandleInformation(handle, HANDLE_FLAG_INHERIT, 0); + } + } +} + + +int uv__stdio_verify(BYTE* buffer, WORD size) { + unsigned int count; + + /* Check the buffer pointer. */ + if (buffer == NULL) + return 0; + + /* Verify that the buffer is at least big enough to hold the count. */ + if (size < CHILD_STDIO_SIZE(0)) + return 0; + + /* Verify if the count is within range. */ + count = CHILD_STDIO_COUNT(buffer); + if (count > 256) + return 0; + + /* Verify that the buffer size is big enough to hold info for N FDs. */ + if (size < CHILD_STDIO_SIZE(count)) + return 0; + + return 1; +} + + +WORD uv__stdio_size(BYTE* buffer) { + return (WORD) CHILD_STDIO_SIZE(CHILD_STDIO_COUNT((buffer))); +} + + +HANDLE uv__stdio_handle(BYTE* buffer, int fd) { + return CHILD_STDIO_HANDLE(buffer, fd); +} diff --git a/3rdparty/libuv/src/win/process.c b/3rdparty/libuv/src/win/process.c new file mode 100644 index 00000000000..855c3740816 --- /dev/null +++ b/3rdparty/libuv/src/win/process.c @@ -0,0 +1,1247 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include /* alloca */ + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "req-inl.h" + + +#define SIGKILL 9 + + +typedef struct env_var { + const WCHAR* const wide; + const WCHAR* const wide_eq; + const size_t len; /* including null or '=' */ +} env_var_t; + +#define E_V(str) { L##str, L##str L"=", sizeof(str) } + +static const env_var_t required_vars[] = { /* keep me sorted */ + E_V("HOMEDRIVE"), + E_V("HOMEPATH"), + E_V("LOGONSERVER"), + E_V("PATH"), + E_V("SYSTEMDRIVE"), + E_V("SYSTEMROOT"), + E_V("TEMP"), + E_V("USERDOMAIN"), + E_V("USERNAME"), + E_V("USERPROFILE"), + E_V("WINDIR"), +}; +static size_t n_required_vars = ARRAY_SIZE(required_vars); + + +static HANDLE uv_global_job_handle_; +static uv_once_t uv_global_job_handle_init_guard_ = UV_ONCE_INIT; + + +static void uv__init_global_job_handle(void) { + /* Create a job object and set it up to kill all contained processes when + * it's closed. Since this handle is made non-inheritable and we're not + * giving it to anyone, we're the only process holding a reference to it. + * That means that if this process exits it is closed and all the processes + * it contains are killed. All processes created with uv_spawn that are not + * spawned with the UV_PROCESS_DETACHED flag are assigned to this job. + * + * We're setting the JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK flag so only the + * processes that we explicitly add are affected, and *their* subprocesses + * are not. This ensures that our child processes are not limited in their + * ability to use job control on Windows versions that don't deal with + * nested jobs (prior to Windows 8 / Server 2012). It also lets our child + * processes created detached processes without explicitly breaking away + * from job control (which uv_spawn doesn't, either). + */ + SECURITY_ATTRIBUTES attr; + JOBOBJECT_EXTENDED_LIMIT_INFORMATION info; + + memset(&attr, 0, sizeof attr); + attr.bInheritHandle = FALSE; + + memset(&info, 0, sizeof info); + info.BasicLimitInformation.LimitFlags = + JOB_OBJECT_LIMIT_BREAKAWAY_OK | + JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK | + JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION | + JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; + + uv_global_job_handle_ = CreateJobObjectW(&attr, NULL); + if (uv_global_job_handle_ == NULL) + uv_fatal_error(GetLastError(), "CreateJobObjectW"); + + if (!SetInformationJobObject(uv_global_job_handle_, + JobObjectExtendedLimitInformation, + &info, + sizeof info)) + uv_fatal_error(GetLastError(), "SetInformationJobObject"); +} + + +static int uv_utf8_to_utf16_alloc(const char* s, WCHAR** ws_ptr) { + int ws_len, r; + WCHAR* ws; + + ws_len = MultiByteToWideChar(CP_UTF8, + 0, + s, + -1, + NULL, + 0); + if (ws_len <= 0) { + return GetLastError(); + } + + ws = (WCHAR*) uv__malloc(ws_len * sizeof(WCHAR)); + if (ws == NULL) { + return ERROR_OUTOFMEMORY; + } + + r = MultiByteToWideChar(CP_UTF8, + 0, + s, + -1, + ws, + ws_len); + assert(r == ws_len); + + *ws_ptr = ws; + return 0; +} + + +static void uv_process_init(uv_loop_t* loop, uv_process_t* handle) { + uv__handle_init(loop, (uv_handle_t*) handle, UV_PROCESS); + handle->exit_cb = NULL; + handle->pid = 0; + handle->exit_signal = 0; + handle->wait_handle = INVALID_HANDLE_VALUE; + handle->process_handle = INVALID_HANDLE_VALUE; + handle->child_stdio_buffer = NULL; + handle->exit_cb_pending = 0; + + uv_req_init(loop, (uv_req_t*)&handle->exit_req); + handle->exit_req.type = UV_PROCESS_EXIT; + handle->exit_req.data = handle; +} + + +/* + * Path search functions + */ + +/* + * Helper function for search_path + */ +static WCHAR* search_path_join_test(const WCHAR* dir, + size_t dir_len, + const WCHAR* name, + size_t name_len, + const WCHAR* ext, + size_t ext_len, + const WCHAR* cwd, + size_t cwd_len) { + WCHAR *result, *result_pos; + DWORD attrs; + if (dir_len > 2 && dir[0] == L'\\' && dir[1] == L'\\') { + /* It's a UNC path so ignore cwd */ + cwd_len = 0; + } else if (dir_len >= 1 && (dir[0] == L'/' || dir[0] == L'\\')) { + /* It's a full path without drive letter, use cwd's drive letter only */ + cwd_len = 2; + } else if (dir_len >= 2 && dir[1] == L':' && + (dir_len < 3 || (dir[2] != L'/' && dir[2] != L'\\'))) { + /* It's a relative path with drive letter (ext.g. D:../some/file) + * Replace drive letter in dir by full cwd if it points to the same drive, + * otherwise use the dir only. + */ + if (cwd_len < 2 || _wcsnicmp(cwd, dir, 2) != 0) { + cwd_len = 0; + } else { + dir += 2; + dir_len -= 2; + } + } else if (dir_len > 2 && dir[1] == L':') { + /* It's an absolute path with drive letter + * Don't use the cwd at all + */ + cwd_len = 0; + } + + /* Allocate buffer for output */ + result = result_pos = (WCHAR*)uv__malloc(sizeof(WCHAR) * + (cwd_len + 1 + dir_len + 1 + name_len + 1 + ext_len + 1)); + + /* Copy cwd */ + wcsncpy(result_pos, cwd, cwd_len); + result_pos += cwd_len; + + /* Add a path separator if cwd didn't end with one */ + if (cwd_len && wcsrchr(L"\\/:", result_pos[-1]) == NULL) { + result_pos[0] = L'\\'; + result_pos++; + } + + /* Copy dir */ + wcsncpy(result_pos, dir, dir_len); + result_pos += dir_len; + + /* Add a separator if the dir didn't end with one */ + if (dir_len && wcsrchr(L"\\/:", result_pos[-1]) == NULL) { + result_pos[0] = L'\\'; + result_pos++; + } + + /* Copy filename */ + wcsncpy(result_pos, name, name_len); + result_pos += name_len; + + if (ext_len) { + /* Add a dot if the filename didn't end with one */ + if (name_len && result_pos[-1] != '.') { + result_pos[0] = L'.'; + result_pos++; + } + + /* Copy extension */ + wcsncpy(result_pos, ext, ext_len); + result_pos += ext_len; + } + + /* Null terminator */ + result_pos[0] = L'\0'; + + attrs = GetFileAttributesW(result); + + if (attrs != INVALID_FILE_ATTRIBUTES && + !(attrs & FILE_ATTRIBUTE_DIRECTORY)) { + return result; + } + + uv__free(result); + return NULL; +} + + +/* + * Helper function for search_path + */ +static WCHAR* path_search_walk_ext(const WCHAR *dir, + size_t dir_len, + const WCHAR *name, + size_t name_len, + WCHAR *cwd, + size_t cwd_len, + int name_has_ext) { + WCHAR* result; + + /* If the name itself has a nonempty extension, try this extension first */ + if (name_has_ext) { + result = search_path_join_test(dir, dir_len, + name, name_len, + L"", 0, + cwd, cwd_len); + if (result != NULL) { + return result; + } + } + + /* Try .com extension */ + result = search_path_join_test(dir, dir_len, + name, name_len, + L"com", 3, + cwd, cwd_len); + if (result != NULL) { + return result; + } + + /* Try .exe extension */ + result = search_path_join_test(dir, dir_len, + name, name_len, + L"exe", 3, + cwd, cwd_len); + if (result != NULL) { + return result; + } + + return NULL; +} + + +/* + * search_path searches the system path for an executable filename - + * the windows API doesn't provide this as a standalone function nor as an + * option to CreateProcess. + * + * It tries to return an absolute filename. + * + * Furthermore, it tries to follow the semantics that cmd.exe, with this + * exception that PATHEXT environment variable isn't used. Since CreateProcess + * can start only .com and .exe files, only those extensions are tried. This + * behavior equals that of msvcrt's spawn functions. + * + * - Do not search the path if the filename already contains a path (either + * relative or absolute). + * + * - If there's really only a filename, check the current directory for file, + * then search all path directories. + * + * - If filename specified has *any* extension, search for the file with the + * specified extension first. + * + * - If the literal filename is not found in a directory, try *appending* + * (not replacing) .com first and then .exe. + * + * - The path variable may contain relative paths; relative paths are relative + * to the cwd. + * + * - Directories in path may or may not end with a trailing backslash. + * + * - CMD does not trim leading/trailing whitespace from path/pathex entries + * nor from the environment variables as a whole. + * + * - When cmd.exe cannot read a directory, it will just skip it and go on + * searching. However, unlike posix-y systems, it will happily try to run a + * file that is not readable/executable; if the spawn fails it will not + * continue searching. + * + * UNC path support: we are dealing with UNC paths in both the path and the + * filename. This is a deviation from what cmd.exe does (it does not let you + * start a program by specifying an UNC path on the command line) but this is + * really a pointless restriction. + * + */ +static WCHAR* search_path(const WCHAR *file, + WCHAR *cwd, + const WCHAR *path) { + int file_has_dir; + WCHAR* result = NULL; + WCHAR *file_name_start; + WCHAR *dot; + const WCHAR *dir_start, *dir_end, *dir_path; + size_t dir_len; + int name_has_ext; + + size_t file_len = wcslen(file); + size_t cwd_len = wcslen(cwd); + + /* If the caller supplies an empty filename, + * we're not gonna return c:\windows\.exe -- GFY! + */ + if (file_len == 0 + || (file_len == 1 && file[0] == L'.')) { + return NULL; + } + + /* Find the start of the filename so we can split the directory from the */ + /* name. */ + for (file_name_start = (WCHAR*)file + file_len; + file_name_start > file + && file_name_start[-1] != L'\\' + && file_name_start[-1] != L'/' + && file_name_start[-1] != L':'; + file_name_start--); + + file_has_dir = file_name_start != file; + + /* Check if the filename includes an extension */ + dot = wcschr(file_name_start, L'.'); + name_has_ext = (dot != NULL && dot[1] != L'\0'); + + if (file_has_dir) { + /* The file has a path inside, don't use path */ + result = path_search_walk_ext( + file, file_name_start - file, + file_name_start, file_len - (file_name_start - file), + cwd, cwd_len, + name_has_ext); + + } else { + dir_end = path; + + /* The file is really only a name; look in cwd first, then scan path */ + result = path_search_walk_ext(L"", 0, + file, file_len, + cwd, cwd_len, + name_has_ext); + + while (result == NULL) { + if (*dir_end == L'\0') { + break; + } + + /* Skip the separator that dir_end now points to */ + if (dir_end != path || *path == L';') { + dir_end++; + } + + /* Next slice starts just after where the previous one ended */ + dir_start = dir_end; + + /* Slice until the next ; or \0 is found */ + dir_end = wcschr(dir_start, L';'); + if (dir_end == NULL) { + dir_end = wcschr(dir_start, L'\0'); + } + + /* If the slice is zero-length, don't bother */ + if (dir_end - dir_start == 0) { + continue; + } + + dir_path = dir_start; + dir_len = dir_end - dir_start; + + /* Adjust if the path is quoted. */ + if (dir_path[0] == '"' || dir_path[0] == '\'') { + ++dir_path; + --dir_len; + } + + if (dir_path[dir_len - 1] == '"' || dir_path[dir_len - 1] == '\'') { + --dir_len; + } + + result = path_search_walk_ext(dir_path, dir_len, + file, file_len, + cwd, cwd_len, + name_has_ext); + } + } + + return result; +} + + +/* + * Quotes command line arguments + * Returns a pointer to the end (next char to be written) of the buffer + */ +WCHAR* quote_cmd_arg(const WCHAR *source, WCHAR *target) { + size_t len = wcslen(source); + size_t i; + int quote_hit; + WCHAR* start; + + if (len == 0) { + /* Need double quotation for empty argument */ + *(target++) = L'"'; + *(target++) = L'"'; + return target; + } + + if (NULL == wcspbrk(source, L" \t\"")) { + /* No quotation needed */ + wcsncpy(target, source, len); + target += len; + return target; + } + + if (NULL == wcspbrk(source, L"\"\\")) { + /* + * No embedded double quotes or backlashes, so I can just wrap + * quote marks around the whole thing. + */ + *(target++) = L'"'; + wcsncpy(target, source, len); + target += len; + *(target++) = L'"'; + return target; + } + + /* + * Expected input/output: + * input : hello"world + * output: "hello\"world" + * input : hello""world + * output: "hello\"\"world" + * input : hello\world + * output: hello\world + * input : hello\\world + * output: hello\\world + * input : hello\"world + * output: "hello\\\"world" + * input : hello\\"world + * output: "hello\\\\\"world" + * input : hello world\ + * output: "hello world\" + */ + + *(target++) = L'"'; + start = target; + quote_hit = 1; + + for (i = len; i > 0; --i) { + *(target++) = source[i - 1]; + + if (quote_hit && source[i - 1] == L'\\') { + *(target++) = L'\\'; + } else if(source[i - 1] == L'"') { + quote_hit = 1; + *(target++) = L'\\'; + } else { + quote_hit = 0; + } + } + target[0] = L'\0'; + wcsrev(start); + *(target++) = L'"'; + return target; +} + + +int make_program_args(char** args, int verbatim_arguments, WCHAR** dst_ptr) { + char** arg; + WCHAR* dst = NULL; + WCHAR* temp_buffer = NULL; + size_t dst_len = 0; + size_t temp_buffer_len = 0; + WCHAR* pos; + int arg_count = 0; + int err = 0; + + /* Count the required size. */ + for (arg = args; *arg; arg++) { + DWORD arg_len; + + arg_len = MultiByteToWideChar(CP_UTF8, + 0, + *arg, + -1, + NULL, + 0); + if (arg_len == 0) { + return GetLastError(); + } + + dst_len += arg_len; + + if (arg_len > temp_buffer_len) + temp_buffer_len = arg_len; + + arg_count++; + } + + /* Adjust for potential quotes. Also assume the worst-case scenario */ + /* that every character needs escaping, so we need twice as much space. */ + dst_len = dst_len * 2 + arg_count * 2; + + /* Allocate buffer for the final command line. */ + dst = (WCHAR*) uv__malloc(dst_len * sizeof(WCHAR)); + if (dst == NULL) { + err = ERROR_OUTOFMEMORY; + goto error; + } + + /* Allocate temporary working buffer. */ + temp_buffer = (WCHAR*) uv__malloc(temp_buffer_len * sizeof(WCHAR)); + if (temp_buffer == NULL) { + err = ERROR_OUTOFMEMORY; + goto error; + } + + pos = dst; + for (arg = args; *arg; arg++) { + DWORD arg_len; + + /* Convert argument to wide char. */ + arg_len = MultiByteToWideChar(CP_UTF8, + 0, + *arg, + -1, + temp_buffer, + (int) (dst + dst_len - pos)); + if (arg_len == 0) { + err = GetLastError(); + goto error; + } + + if (verbatim_arguments) { + /* Copy verbatim. */ + wcscpy(pos, temp_buffer); + pos += arg_len - 1; + } else { + /* Quote/escape, if needed. */ + pos = quote_cmd_arg(temp_buffer, pos); + } + + *pos++ = *(arg + 1) ? L' ' : L'\0'; + } + + uv__free(temp_buffer); + + *dst_ptr = dst; + return 0; + +error: + uv__free(dst); + uv__free(temp_buffer); + return err; +} + + +int env_strncmp(const wchar_t* a, int na, const wchar_t* b) { + wchar_t* a_eq; + wchar_t* b_eq; + wchar_t* A; + wchar_t* B; + int nb; + int r; + + if (na < 0) { + a_eq = wcschr(a, L'='); + assert(a_eq); + na = (int)(long)(a_eq - a); + } else { + na--; + } + b_eq = wcschr(b, L'='); + assert(b_eq); + nb = b_eq - b; + + A = alloca((na+1) * sizeof(wchar_t)); + B = alloca((nb+1) * sizeof(wchar_t)); + + r = LCMapStringW(LOCALE_INVARIANT, LCMAP_UPPERCASE, a, na, A, na); + assert(r==na); + A[na] = L'\0'; + r = LCMapStringW(LOCALE_INVARIANT, LCMAP_UPPERCASE, b, nb, B, nb); + assert(r==nb); + B[nb] = L'\0'; + + while (1) { + wchar_t AA = *A++; + wchar_t BB = *B++; + if (AA < BB) { + return -1; + } else if (AA > BB) { + return 1; + } else if (!AA && !BB) { + return 0; + } + } +} + + +static int qsort_wcscmp(const void *a, const void *b) { + wchar_t* astr = *(wchar_t* const*)a; + wchar_t* bstr = *(wchar_t* const*)b; + return env_strncmp(astr, -1, bstr); +} + + +/* + * The way windows takes environment variables is different than what C does; + * Windows wants a contiguous block of null-terminated strings, terminated + * with an additional null. + * + * Windows has a few "essential" environment variables. winsock will fail + * to initialize if SYSTEMROOT is not defined; some APIs make reference to + * TEMP. SYSTEMDRIVE is probably also important. We therefore ensure that + * these get defined if the input environment block does not contain any + * values for them. + * + * Also add variables known to Cygwin to be required for correct + * subprocess operation in many cases: + * https://github.com/Alexpux/Cygwin/blob/b266b04fbbd3a595f02ea149e4306d3ab9b1fe3d/winsup/cygwin/environ.cc#L955 + * + */ +int make_program_env(char* env_block[], WCHAR** dst_ptr) { + WCHAR* dst; + WCHAR* ptr; + char** env; + size_t env_len = 0; + int len; + size_t i; + DWORD var_size; + size_t env_block_count = 1; /* 1 for null-terminator */ + WCHAR* dst_copy; + WCHAR** ptr_copy; + WCHAR** env_copy; + DWORD* required_vars_value_len = alloca(n_required_vars * sizeof(DWORD*)); + + /* first pass: determine size in UTF-16 */ + for (env = env_block; *env; env++) { + int len; + if (strchr(*env, '=')) { + len = MultiByteToWideChar(CP_UTF8, + 0, + *env, + -1, + NULL, + 0); + if (len <= 0) { + return GetLastError(); + } + env_len += len; + env_block_count++; + } + } + + /* second pass: copy to UTF-16 environment block */ + dst_copy = (WCHAR*)uv__malloc(env_len * sizeof(WCHAR)); + if (!dst_copy) { + return ERROR_OUTOFMEMORY; + } + env_copy = alloca(env_block_count * sizeof(WCHAR*)); + + ptr = dst_copy; + ptr_copy = env_copy; + for (env = env_block; *env; env++) { + if (strchr(*env, '=')) { + len = MultiByteToWideChar(CP_UTF8, + 0, + *env, + -1, + ptr, + (int) (env_len - (ptr - dst_copy))); + if (len <= 0) { + DWORD err = GetLastError(); + uv__free(dst_copy); + return err; + } + *ptr_copy++ = ptr; + ptr += len; + } + } + *ptr_copy = NULL; + assert(env_len == ptr - dst_copy); + + /* sort our (UTF-16) copy */ + qsort(env_copy, env_block_count-1, sizeof(wchar_t*), qsort_wcscmp); + + /* third pass: check for required variables */ + for (ptr_copy = env_copy, i = 0; i < n_required_vars; ) { + int cmp; + if (!*ptr_copy) { + cmp = -1; + } else { + cmp = env_strncmp(required_vars[i].wide_eq, + required_vars[i].len, + *ptr_copy); + } + if (cmp < 0) { + /* missing required var */ + var_size = GetEnvironmentVariableW(required_vars[i].wide, NULL, 0); + required_vars_value_len[i] = var_size; + if (var_size != 0) { + env_len += required_vars[i].len; + env_len += var_size; + } + i++; + } else { + ptr_copy++; + if (cmp == 0) + i++; + } + } + + /* final pass: copy, in sort order, and inserting required variables */ + dst = uv__malloc((1+env_len) * sizeof(WCHAR)); + if (!dst) { + uv__free(dst_copy); + return ERROR_OUTOFMEMORY; + } + + for (ptr = dst, ptr_copy = env_copy, i = 0; + *ptr_copy || i < n_required_vars; + ptr += len) { + int cmp; + if (i >= n_required_vars) { + cmp = 1; + } else if (!*ptr_copy) { + cmp = -1; + } else { + cmp = env_strncmp(required_vars[i].wide_eq, + required_vars[i].len, + *ptr_copy); + } + if (cmp < 0) { + /* missing required var */ + len = required_vars_value_len[i]; + if (len) { + wcscpy(ptr, required_vars[i].wide_eq); + ptr += required_vars[i].len; + var_size = GetEnvironmentVariableW(required_vars[i].wide, + ptr, + (int) (env_len - (ptr - dst))); + if (var_size != len-1) { /* race condition? */ + uv_fatal_error(GetLastError(), "GetEnvironmentVariableW"); + } + } + i++; + } else { + /* copy var from env_block */ + len = wcslen(*ptr_copy) + 1; + wmemcpy(ptr, *ptr_copy, len); + ptr_copy++; + if (cmp == 0) + i++; + } + } + + /* Terminate with an extra NULL. */ + assert(env_len == (ptr - dst)); + *ptr = L'\0'; + + uv__free(dst_copy); + *dst_ptr = dst; + return 0; +} + +/* + * Attempt to find the value of the PATH environment variable in the child's + * preprocessed environment. + * + * If found, a pointer into `env` is returned. If not found, NULL is returned. + */ +static WCHAR* find_path(WCHAR *env) { + for (; env != NULL && *env != 0; env += wcslen(env) + 1) { + if (wcsncmp(env, L"PATH=", 5) == 0) + return &env[5]; + } + + return NULL; +} + +/* + * Called on Windows thread-pool thread to indicate that + * a child process has exited. + */ +static void CALLBACK exit_wait_callback(void* data, BOOLEAN didTimeout) { + uv_process_t* process = (uv_process_t*) data; + uv_loop_t* loop = process->loop; + + assert(didTimeout == FALSE); + assert(process); + assert(!process->exit_cb_pending); + + process->exit_cb_pending = 1; + + /* Post completed */ + POST_COMPLETION_FOR_REQ(loop, &process->exit_req); +} + + +/* Called on main thread after a child process has exited. */ +void uv_process_proc_exit(uv_loop_t* loop, uv_process_t* handle) { + int64_t exit_code; + DWORD status; + + assert(handle->exit_cb_pending); + handle->exit_cb_pending = 0; + + /* If we're closing, don't call the exit callback. Just schedule a close */ + /* callback now. */ + if (handle->flags & UV__HANDLE_CLOSING) { + uv_want_endgame(loop, (uv_handle_t*) handle); + return; + } + + /* Unregister from process notification. */ + if (handle->wait_handle != INVALID_HANDLE_VALUE) { + UnregisterWait(handle->wait_handle); + handle->wait_handle = INVALID_HANDLE_VALUE; + } + + /* Set the handle to inactive: no callbacks will be made after the exit */ + /* callback.*/ + uv__handle_stop(handle); + + if (GetExitCodeProcess(handle->process_handle, &status)) { + exit_code = status; + } else { + /* Unable to to obtain the exit code. This should never happen. */ + exit_code = uv_translate_sys_error(GetLastError()); + } + + /* Fire the exit callback. */ + if (handle->exit_cb) { + handle->exit_cb(handle, exit_code, handle->exit_signal); + } +} + + +void uv_process_close(uv_loop_t* loop, uv_process_t* handle) { + uv__handle_closing(handle); + + if (handle->wait_handle != INVALID_HANDLE_VALUE) { + /* This blocks until either the wait was cancelled, or the callback has */ + /* completed. */ + BOOL r = UnregisterWaitEx(handle->wait_handle, INVALID_HANDLE_VALUE); + if (!r) { + /* This should never happen, and if it happens, we can't recover... */ + uv_fatal_error(GetLastError(), "UnregisterWaitEx"); + } + + handle->wait_handle = INVALID_HANDLE_VALUE; + } + + if (!handle->exit_cb_pending) { + uv_want_endgame(loop, (uv_handle_t*)handle); + } +} + + +void uv_process_endgame(uv_loop_t* loop, uv_process_t* handle) { + assert(!handle->exit_cb_pending); + assert(handle->flags & UV__HANDLE_CLOSING); + assert(!(handle->flags & UV_HANDLE_CLOSED)); + + /* Clean-up the process handle. */ + CloseHandle(handle->process_handle); + + uv__handle_close(handle); +} + + +int uv_spawn(uv_loop_t* loop, + uv_process_t* process, + const uv_process_options_t* options) { + int i; + int err = 0; + WCHAR* path = NULL, *alloc_path = NULL; + BOOL result; + WCHAR* application_path = NULL, *application = NULL, *arguments = NULL, + *env = NULL, *cwd = NULL; + STARTUPINFOW startup; + PROCESS_INFORMATION info; + DWORD process_flags; + + uv_process_init(loop, process); + process->exit_cb = options->exit_cb; + + if (options->flags & (UV_PROCESS_SETGID | UV_PROCESS_SETUID)) { + return UV_ENOTSUP; + } + + if (options->file == NULL || + options->args == NULL) { + return UV_EINVAL; + } + + assert(options->file != NULL); + assert(!(options->flags & ~(UV_PROCESS_DETACHED | + UV_PROCESS_SETGID | + UV_PROCESS_SETUID | + UV_PROCESS_WINDOWS_HIDE | + UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS))); + + err = uv_utf8_to_utf16_alloc(options->file, &application); + if (err) + goto done; + + err = make_program_args( + options->args, + options->flags & UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS, + &arguments); + if (err) + goto done; + + if (options->env) { + err = make_program_env(options->env, &env); + if (err) + goto done; + } + + if (options->cwd) { + /* Explicit cwd */ + err = uv_utf8_to_utf16_alloc(options->cwd, &cwd); + if (err) + goto done; + + } else { + /* Inherit cwd */ + DWORD cwd_len, r; + + cwd_len = GetCurrentDirectoryW(0, NULL); + if (!cwd_len) { + err = GetLastError(); + goto done; + } + + cwd = (WCHAR*) uv__malloc(cwd_len * sizeof(WCHAR)); + if (cwd == NULL) { + err = ERROR_OUTOFMEMORY; + goto done; + } + + r = GetCurrentDirectoryW(cwd_len, cwd); + if (r == 0 || r >= cwd_len) { + err = GetLastError(); + goto done; + } + } + + /* Get PATH environment variable. */ + path = find_path(env); + if (path == NULL) { + DWORD path_len, r; + + path_len = GetEnvironmentVariableW(L"PATH", NULL, 0); + if (path_len == 0) { + err = GetLastError(); + goto done; + } + + alloc_path = (WCHAR*) uv__malloc(path_len * sizeof(WCHAR)); + if (alloc_path == NULL) { + err = ERROR_OUTOFMEMORY; + goto done; + } + path = alloc_path; + + r = GetEnvironmentVariableW(L"PATH", path, path_len); + if (r == 0 || r >= path_len) { + err = GetLastError(); + goto done; + } + } + + err = uv__stdio_create(loop, options, &process->child_stdio_buffer); + if (err) + goto done; + + application_path = search_path(application, + cwd, + path); + if (application_path == NULL) { + /* Not found. */ + err = ERROR_FILE_NOT_FOUND; + goto done; + } + + startup.cb = sizeof(startup); + startup.lpReserved = NULL; + startup.lpDesktop = NULL; + startup.lpTitle = NULL; + startup.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; + + startup.cbReserved2 = uv__stdio_size(process->child_stdio_buffer); + startup.lpReserved2 = (BYTE*) process->child_stdio_buffer; + + startup.hStdInput = uv__stdio_handle(process->child_stdio_buffer, 0); + startup.hStdOutput = uv__stdio_handle(process->child_stdio_buffer, 1); + startup.hStdError = uv__stdio_handle(process->child_stdio_buffer, 2); + + if (options->flags & UV_PROCESS_WINDOWS_HIDE) { + /* Use SW_HIDE to avoid any potential process window. */ + startup.wShowWindow = SW_HIDE; + } else { + startup.wShowWindow = SW_SHOWDEFAULT; + } + + process_flags = CREATE_UNICODE_ENVIRONMENT; + + if (options->flags & UV_PROCESS_DETACHED) { + /* Note that we're not setting the CREATE_BREAKAWAY_FROM_JOB flag. That + * means that libuv might not let you create a fully daemonized process + * when run under job control. However the type of job control that libuv + * itself creates doesn't trickle down to subprocesses so they can still + * daemonize. + * + * A reason to not do this is that CREATE_BREAKAWAY_FROM_JOB makes the + * CreateProcess call fail if we're under job control that doesn't allow + * breakaway. + */ + process_flags |= DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP; + } + + if (!CreateProcessW(application_path, + arguments, + NULL, + NULL, + 1, + process_flags, + env, + cwd, + &startup, + &info)) { + /* CreateProcessW failed. */ + err = GetLastError(); + goto done; + } + + /* Spawn succeeded */ + /* Beyond this point, failure is reported asynchronously. */ + + process->process_handle = info.hProcess; + process->pid = info.dwProcessId; + + /* If the process isn't spawned as detached, assign to the global job */ + /* object so windows will kill it when the parent process dies. */ + if (!(options->flags & UV_PROCESS_DETACHED)) { + uv_once(&uv_global_job_handle_init_guard_, uv__init_global_job_handle); + + if (!AssignProcessToJobObject(uv_global_job_handle_, info.hProcess)) { + /* AssignProcessToJobObject might fail if this process is under job + * control and the job doesn't have the + * JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK flag set, on a Windows version + * that doesn't support nested jobs. + * + * When that happens we just swallow the error and continue without + * establishing a kill-child-on-parent-exit relationship, otherwise + * there would be no way for libuv applications run under job control + * to spawn processes at all. + */ + DWORD err = GetLastError(); + if (err != ERROR_ACCESS_DENIED) + uv_fatal_error(err, "AssignProcessToJobObject"); + } + } + + /* Set IPC pid to all IPC pipes. */ + for (i = 0; i < options->stdio_count; i++) { + const uv_stdio_container_t* fdopt = &options->stdio[i]; + if (fdopt->flags & UV_CREATE_PIPE && + fdopt->data.stream->type == UV_NAMED_PIPE && + ((uv_pipe_t*) fdopt->data.stream)->ipc) { + ((uv_pipe_t*) fdopt->data.stream)->pipe.conn.ipc_pid = info.dwProcessId; + } + } + + /* Setup notifications for when the child process exits. */ + result = RegisterWaitForSingleObject(&process->wait_handle, + process->process_handle, exit_wait_callback, (void*)process, INFINITE, + WT_EXECUTEINWAITTHREAD | WT_EXECUTEONLYONCE); + if (!result) { + uv_fatal_error(GetLastError(), "RegisterWaitForSingleObject"); + } + + CloseHandle(info.hThread); + + assert(!err); + + /* Make the handle active. It will remain active until the exit callback */ + /* is made or the handle is closed, whichever happens first. */ + uv__handle_start(process); + + /* Cleanup, whether we succeeded or failed. */ + done: + uv__free(application); + uv__free(application_path); + uv__free(arguments); + uv__free(cwd); + uv__free(env); + uv__free(alloc_path); + + if (process->child_stdio_buffer != NULL) { + /* Clean up child stdio handles. */ + uv__stdio_destroy(process->child_stdio_buffer); + process->child_stdio_buffer = NULL; + } + + return uv_translate_sys_error(err); +} + + +static int uv__kill(HANDLE process_handle, int signum) { + switch (signum) { + case SIGTERM: + case SIGKILL: + case SIGINT: { + /* Unconditionally terminate the process. On Windows, killed processes */ + /* normally return 1. */ + DWORD status; + int err; + + if (TerminateProcess(process_handle, 1)) + return 0; + + /* If the process already exited before TerminateProcess was called, */ + /* TerminateProcess will fail with ERROR_ACCESS_DENIED. */ + err = GetLastError(); + if (err == ERROR_ACCESS_DENIED && + GetExitCodeProcess(process_handle, &status) && + status != STILL_ACTIVE) { + return UV_ESRCH; + } + + return uv_translate_sys_error(err); + } + + case 0: { + /* Health check: is the process still alive? */ + DWORD status; + + if (!GetExitCodeProcess(process_handle, &status)) + return uv_translate_sys_error(GetLastError()); + + if (status != STILL_ACTIVE) + return UV_ESRCH; + + return 0; + } + + default: + /* Unsupported signal. */ + return UV_ENOSYS; + } +} + + +int uv_process_kill(uv_process_t* process, int signum) { + int err; + + if (process->process_handle == INVALID_HANDLE_VALUE) { + return UV_EINVAL; + } + + err = uv__kill(process->process_handle, signum); + if (err) { + return err; /* err is already translated. */ + } + + process->exit_signal = signum; + + return 0; +} + + +int uv_kill(int pid, int signum) { + int err; + HANDLE process_handle = OpenProcess(PROCESS_TERMINATE | + PROCESS_QUERY_INFORMATION, FALSE, pid); + + if (process_handle == NULL) { + err = GetLastError(); + if (err == ERROR_INVALID_PARAMETER) { + return UV_ESRCH; + } else { + return uv_translate_sys_error(err); + } + } + + err = uv__kill(process_handle, signum); + CloseHandle(process_handle); + + return err; /* err is already translated. */ +} diff --git a/3rdparty/libuv/src/win/req-inl.h b/3rdparty/libuv/src/win/req-inl.h new file mode 100644 index 00000000000..b5e502eef55 --- /dev/null +++ b/3rdparty/libuv/src/win/req-inl.h @@ -0,0 +1,224 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_WIN_REQ_INL_H_ +#define UV_WIN_REQ_INL_H_ + +#include + +#include "uv.h" +#include "internal.h" + + +#define SET_REQ_STATUS(req, status) \ + (req)->u.io.overlapped.Internal = (ULONG_PTR) (status) + +#define SET_REQ_ERROR(req, error) \ + SET_REQ_STATUS((req), NTSTATUS_FROM_WIN32((error))) + +#define SET_REQ_SUCCESS(req) \ + SET_REQ_STATUS((req), STATUS_SUCCESS) + +#define GET_REQ_STATUS(req) \ + ((NTSTATUS) (req)->u.io.overlapped.Internal) + +#define REQ_SUCCESS(req) \ + (NT_SUCCESS(GET_REQ_STATUS((req)))) + +#define GET_REQ_ERROR(req) \ + (pRtlNtStatusToDosError(GET_REQ_STATUS((req)))) + +#define GET_REQ_SOCK_ERROR(req) \ + (uv_ntstatus_to_winsock_error(GET_REQ_STATUS((req)))) + + +#define REGISTER_HANDLE_REQ(loop, handle, req) \ + do { \ + INCREASE_ACTIVE_COUNT((loop), (handle)); \ + uv__req_register((loop), (req)); \ + } while (0) + +#define UNREGISTER_HANDLE_REQ(loop, handle, req) \ + do { \ + DECREASE_ACTIVE_COUNT((loop), (handle)); \ + uv__req_unregister((loop), (req)); \ + } while (0) + + +#define UV_SUCCEEDED_WITHOUT_IOCP(result) \ + ((result) && (handle->flags & UV_HANDLE_SYNC_BYPASS_IOCP)) + +#define UV_SUCCEEDED_WITH_IOCP(result) \ + ((result) || (GetLastError() == ERROR_IO_PENDING)) + + +#define POST_COMPLETION_FOR_REQ(loop, req) \ + if (!PostQueuedCompletionStatus((loop)->iocp, \ + 0, \ + 0, \ + &((req)->u.io.overlapped))) { \ + uv_fatal_error(GetLastError(), "PostQueuedCompletionStatus"); \ + } + + +INLINE static void uv_req_init(uv_loop_t* loop, uv_req_t* req) { + req->type = UV_UNKNOWN_REQ; + SET_REQ_SUCCESS(req); +} + + +INLINE static uv_req_t* uv_overlapped_to_req(OVERLAPPED* overlapped) { + return CONTAINING_RECORD(overlapped, uv_req_t, u.io.overlapped); +} + + +INLINE static void uv_insert_pending_req(uv_loop_t* loop, uv_req_t* req) { + req->next_req = NULL; + if (loop->pending_reqs_tail) { +#ifdef _DEBUG + /* Ensure the request is not already in the queue, or the queue + * will get corrupted. + */ + uv_req_t* current = loop->pending_reqs_tail; + do { + assert(req != current); + current = current->next_req; + } while(current != loop->pending_reqs_tail); +#endif + + req->next_req = loop->pending_reqs_tail->next_req; + loop->pending_reqs_tail->next_req = req; + loop->pending_reqs_tail = req; + } else { + req->next_req = req; + loop->pending_reqs_tail = req; + } +} + + +#define DELEGATE_STREAM_REQ(loop, req, method, handle_at) \ + do { \ + switch (((uv_handle_t*) (req)->handle_at)->type) { \ + case UV_TCP: \ + uv_process_tcp_##method##_req(loop, \ + (uv_tcp_t*) ((req)->handle_at), \ + req); \ + break; \ + \ + case UV_NAMED_PIPE: \ + uv_process_pipe_##method##_req(loop, \ + (uv_pipe_t*) ((req)->handle_at), \ + req); \ + break; \ + \ + case UV_TTY: \ + uv_process_tty_##method##_req(loop, \ + (uv_tty_t*) ((req)->handle_at), \ + req); \ + break; \ + \ + default: \ + assert(0); \ + } \ + } while (0) + + +INLINE static int uv_process_reqs(uv_loop_t* loop) { + uv_req_t* req; + uv_req_t* first; + uv_req_t* next; + + if (loop->pending_reqs_tail == NULL) + return 0; + + first = loop->pending_reqs_tail->next_req; + next = first; + loop->pending_reqs_tail = NULL; + + while (next != NULL) { + req = next; + next = req->next_req != first ? req->next_req : NULL; + + switch (req->type) { + case UV_READ: + DELEGATE_STREAM_REQ(loop, req, read, data); + break; + + case UV_WRITE: + DELEGATE_STREAM_REQ(loop, (uv_write_t*) req, write, handle); + break; + + case UV_ACCEPT: + DELEGATE_STREAM_REQ(loop, req, accept, data); + break; + + case UV_CONNECT: + DELEGATE_STREAM_REQ(loop, (uv_connect_t*) req, connect, handle); + break; + + case UV_SHUTDOWN: + /* Tcp shutdown requests don't come here. */ + assert(((uv_shutdown_t*) req)->handle->type == UV_NAMED_PIPE); + uv_process_pipe_shutdown_req( + loop, + (uv_pipe_t*) ((uv_shutdown_t*) req)->handle, + (uv_shutdown_t*) req); + break; + + case UV_UDP_RECV: + uv_process_udp_recv_req(loop, (uv_udp_t*) req->data, req); + break; + + case UV_UDP_SEND: + uv_process_udp_send_req(loop, + ((uv_udp_send_t*) req)->handle, + (uv_udp_send_t*) req); + break; + + case UV_WAKEUP: + uv_process_async_wakeup_req(loop, (uv_async_t*) req->data, req); + break; + + case UV_SIGNAL_REQ: + uv_process_signal_req(loop, (uv_signal_t*) req->data, req); + break; + + case UV_POLL_REQ: + uv_process_poll_req(loop, (uv_poll_t*) req->data, req); + break; + + case UV_PROCESS_EXIT: + uv_process_proc_exit(loop, (uv_process_t*) req->data); + break; + + case UV_FS_EVENT_REQ: + uv_process_fs_event_req(loop, req, (uv_fs_event_t*) req->data); + break; + + default: + assert(0); + } + } + + return 1; +} + +#endif /* UV_WIN_REQ_INL_H_ */ diff --git a/3rdparty/libuv/src/win/req.c b/3rdparty/libuv/src/win/req.c new file mode 100644 index 00000000000..111cc5e2893 --- /dev/null +++ b/3rdparty/libuv/src/win/req.c @@ -0,0 +1,25 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include + +#include "uv.h" +#include "internal.h" diff --git a/3rdparty/libuv/src/win/signal.c b/3rdparty/libuv/src/win/signal.c new file mode 100644 index 00000000000..2c64a55dc39 --- /dev/null +++ b/3rdparty/libuv/src/win/signal.c @@ -0,0 +1,356 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "req-inl.h" + + +RB_HEAD(uv_signal_tree_s, uv_signal_s); + +static struct uv_signal_tree_s uv__signal_tree = RB_INITIALIZER(uv__signal_tree); +static ssize_t volatile uv__signal_control_handler_refs = 0; +static CRITICAL_SECTION uv__signal_lock; + + +void uv_signals_init() { + InitializeCriticalSection(&uv__signal_lock); +} + + +static int uv__signal_compare(uv_signal_t* w1, uv_signal_t* w2) { + /* Compare signums first so all watchers with the same signnum end up */ + /* adjacent. */ + if (w1->signum < w2->signum) return -1; + if (w1->signum > w2->signum) return 1; + + /* Sort by loop pointer, so we can easily look up the first item after */ + /* { .signum = x, .loop = NULL } */ + if ((uintptr_t) w1->loop < (uintptr_t) w2->loop) return -1; + if ((uintptr_t) w1->loop > (uintptr_t) w2->loop) return 1; + + if ((uintptr_t) w1 < (uintptr_t) w2) return -1; + if ((uintptr_t) w1 > (uintptr_t) w2) return 1; + + return 0; +} + + +RB_GENERATE_STATIC(uv_signal_tree_s, uv_signal_s, tree_entry, uv__signal_compare); + + +/* + * Dispatches signal {signum} to all active uv_signal_t watchers in all loops. + * Returns 1 if the signal was dispatched to any watcher, or 0 if there were + * no active signal watchers observing this signal. + */ +int uv__signal_dispatch(int signum) { + uv_signal_t lookup; + uv_signal_t* handle; + int dispatched = 0; + + EnterCriticalSection(&uv__signal_lock); + + lookup.signum = signum; + lookup.loop = NULL; + + for (handle = RB_NFIND(uv_signal_tree_s, &uv__signal_tree, &lookup); + handle != NULL && handle->signum == signum; + handle = RB_NEXT(uv_signal_tree_s, &uv__signal_tree, handle)) { + unsigned long previous = InterlockedExchange( + (volatile LONG*) &handle->pending_signum, signum); + + if (!previous) { + POST_COMPLETION_FOR_REQ(handle->loop, &handle->signal_req); + } + + dispatched = 1; + } + + LeaveCriticalSection(&uv__signal_lock); + + return dispatched; +} + + +static BOOL WINAPI uv__signal_control_handler(DWORD type) { + switch (type) { + case CTRL_C_EVENT: + return uv__signal_dispatch(SIGINT); + + case CTRL_BREAK_EVENT: + return uv__signal_dispatch(SIGBREAK); + + case CTRL_CLOSE_EVENT: + if (uv__signal_dispatch(SIGHUP)) { + /* Windows will terminate the process after the control handler */ + /* returns. After that it will just terminate our process. Therefore */ + /* block the signal handler so the main loop has some time to pick */ + /* up the signal and do something for a few seconds. */ + Sleep(INFINITE); + return TRUE; + } + return FALSE; + + case CTRL_LOGOFF_EVENT: + case CTRL_SHUTDOWN_EVENT: + /* These signals are only sent to services. Services have their own */ + /* notification mechanism, so there's no point in handling these. */ + + default: + /* We don't handle these. */ + return FALSE; + } +} + + +static int uv__signal_register_control_handler() { + /* When this function is called, the uv__signal_lock must be held. */ + + /* If the console control handler has already been hooked, just add a */ + /* reference. */ + if (uv__signal_control_handler_refs > 0) { + uv__signal_control_handler_refs++; + return 0; + } + + if (!SetConsoleCtrlHandler(uv__signal_control_handler, TRUE)) + return GetLastError(); + + uv__signal_control_handler_refs++; + + return 0; +} + + +static void uv__signal_unregister_control_handler() { + /* When this function is called, the uv__signal_lock must be held. */ + BOOL r; + + /* Don't unregister if the number of console control handlers exceeds one. */ + /* Just remove a reference in that case. */ + if (uv__signal_control_handler_refs > 1) { + uv__signal_control_handler_refs--; + return; + } + + assert(uv__signal_control_handler_refs == 1); + + r = SetConsoleCtrlHandler(uv__signal_control_handler, FALSE); + /* This should never fail; if it does it is probably a bug in libuv. */ + assert(r); + + uv__signal_control_handler_refs--; +} + + +static int uv__signal_register(int signum) { + switch (signum) { + case SIGINT: + case SIGBREAK: + case SIGHUP: + return uv__signal_register_control_handler(); + + case SIGWINCH: + /* SIGWINCH is generated in tty.c. No need to register anything. */ + return 0; + + case SIGILL: + case SIGABRT_COMPAT: + case SIGFPE: + case SIGSEGV: + case SIGTERM: + case SIGABRT: + /* Signal is never raised. */ + return 0; + + default: + /* Invalid signal. */ + return ERROR_INVALID_PARAMETER; + } +} + + +static void uv__signal_unregister(int signum) { + switch (signum) { + case SIGINT: + case SIGBREAK: + case SIGHUP: + uv__signal_unregister_control_handler(); + return; + + case SIGWINCH: + /* SIGWINCH is generated in tty.c. No need to unregister anything. */ + return; + + case SIGILL: + case SIGABRT_COMPAT: + case SIGFPE: + case SIGSEGV: + case SIGTERM: + case SIGABRT: + /* Nothing is registered for this signal. */ + return; + + default: + /* Libuv bug. */ + assert(0 && "Invalid signum"); + return; + } +} + + +int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle) { + uv_req_t* req; + + uv__handle_init(loop, (uv_handle_t*) handle, UV_SIGNAL); + handle->pending_signum = 0; + handle->signum = 0; + handle->signal_cb = NULL; + + req = &handle->signal_req; + uv_req_init(loop, req); + req->type = UV_SIGNAL_REQ; + req->data = handle; + + return 0; +} + + +int uv_signal_stop(uv_signal_t* handle) { + uv_signal_t* removed_handle; + + /* If the watcher wasn't started, this is a no-op. */ + if (handle->signum == 0) + return 0; + + EnterCriticalSection(&uv__signal_lock); + + uv__signal_unregister(handle->signum); + + removed_handle = RB_REMOVE(uv_signal_tree_s, &uv__signal_tree, handle); + assert(removed_handle == handle); + + LeaveCriticalSection(&uv__signal_lock); + + handle->signum = 0; + uv__handle_stop(handle); + + return 0; +} + + +int uv_signal_start(uv_signal_t* handle, uv_signal_cb signal_cb, int signum) { + int err; + + /* If the user supplies signum == 0, then return an error already. If the */ + /* signum is otherwise invalid then uv__signal_register will find out */ + /* eventually. */ + if (signum == 0) { + return UV_EINVAL; + } + + /* Short circuit: if the signal watcher is already watching {signum} don't */ + /* go through the process of deregistering and registering the handler. */ + /* Additionally, this avoids pending signals getting lost in the (small) */ + /* time frame that handle->signum == 0. */ + if (signum == handle->signum) { + handle->signal_cb = signal_cb; + return 0; + } + + /* If the signal handler was already active, stop it first. */ + if (handle->signum != 0) { + int r = uv_signal_stop(handle); + /* uv_signal_stop is infallible. */ + assert(r == 0); + } + + EnterCriticalSection(&uv__signal_lock); + + err = uv__signal_register(signum); + if (err) { + /* Uh-oh, didn't work. */ + LeaveCriticalSection(&uv__signal_lock); + return uv_translate_sys_error(err); + } + + handle->signum = signum; + RB_INSERT(uv_signal_tree_s, &uv__signal_tree, handle); + + LeaveCriticalSection(&uv__signal_lock); + + handle->signal_cb = signal_cb; + uv__handle_start(handle); + + return 0; +} + + +void uv_process_signal_req(uv_loop_t* loop, uv_signal_t* handle, + uv_req_t* req) { + long dispatched_signum; + + assert(handle->type == UV_SIGNAL); + assert(req->type == UV_SIGNAL_REQ); + + dispatched_signum = InterlockedExchange( + (volatile LONG*) &handle->pending_signum, 0); + assert(dispatched_signum != 0); + + /* Check if the pending signal equals the signum that we are watching for. */ + /* These can get out of sync when the handler is stopped and restarted */ + /* while the signal_req is pending. */ + if (dispatched_signum == handle->signum) + handle->signal_cb(handle, dispatched_signum); + + if (handle->flags & UV__HANDLE_CLOSING) { + /* When it is closing, it must be stopped at this point. */ + assert(handle->signum == 0); + uv_want_endgame(loop, (uv_handle_t*) handle); + } +} + + +void uv_signal_close(uv_loop_t* loop, uv_signal_t* handle) { + uv_signal_stop(handle); + uv__handle_closing(handle); + + if (handle->pending_signum == 0) { + uv_want_endgame(loop, (uv_handle_t*) handle); + } +} + + +void uv_signal_endgame(uv_loop_t* loop, uv_signal_t* handle) { + assert(handle->flags & UV__HANDLE_CLOSING); + assert(!(handle->flags & UV_HANDLE_CLOSED)); + + assert(handle->signum == 0); + assert(handle->pending_signum == 0); + + handle->flags |= UV_HANDLE_CLOSED; + + uv__handle_close(handle); +} diff --git a/3rdparty/libuv/src/win/snprintf.c b/3rdparty/libuv/src/win/snprintf.c new file mode 100644 index 00000000000..776c0e39217 --- /dev/null +++ b/3rdparty/libuv/src/win/snprintf.c @@ -0,0 +1,42 @@ +/* Copyright the libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#if defined(_MSC_VER) && _MSC_VER < 1900 + +#include +#include + +/* Emulate snprintf() on MSVC<2015, _snprintf() doesn't zero-terminate the buffer + * on overflow... + */ +int snprintf(char* buf, size_t len, const char* fmt, ...) { + int n; + va_list ap; + va_start(ap, fmt); + + n = _vscprintf(fmt, ap); + vsnprintf_s(buf, len, _TRUNCATE, fmt, ap); + + va_end(ap); + return n; +} + +#endif diff --git a/3rdparty/libuv/src/win/stream-inl.h b/3rdparty/libuv/src/win/stream-inl.h new file mode 100644 index 00000000000..b7a3c11958c --- /dev/null +++ b/3rdparty/libuv/src/win/stream-inl.h @@ -0,0 +1,56 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_WIN_STREAM_INL_H_ +#define UV_WIN_STREAM_INL_H_ + +#include + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "req-inl.h" + + +INLINE static void uv_stream_init(uv_loop_t* loop, + uv_stream_t* handle, + uv_handle_type type) { + uv__handle_init(loop, (uv_handle_t*) handle, type); + handle->write_queue_size = 0; + handle->activecnt = 0; +} + + +INLINE static void uv_connection_init(uv_stream_t* handle) { + handle->flags |= UV_HANDLE_CONNECTION; + handle->stream.conn.write_reqs_pending = 0; + + uv_req_init(handle->loop, (uv_req_t*) &(handle->read_req)); + handle->read_req.event_handle = NULL; + handle->read_req.wait_handle = INVALID_HANDLE_VALUE; + handle->read_req.type = UV_READ; + handle->read_req.data = handle; + + handle->stream.conn.shutdown_req = NULL; +} + + +#endif /* UV_WIN_STREAM_INL_H_ */ diff --git a/3rdparty/libuv/src/win/stream.c b/3rdparty/libuv/src/win/stream.c new file mode 100644 index 00000000000..a2466e5e9db --- /dev/null +++ b/3rdparty/libuv/src/win/stream.c @@ -0,0 +1,249 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "req-inl.h" + + +int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb) { + int err; + + err = ERROR_INVALID_PARAMETER; + switch (stream->type) { + case UV_TCP: + err = uv_tcp_listen((uv_tcp_t*)stream, backlog, cb); + break; + case UV_NAMED_PIPE: + err = uv_pipe_listen((uv_pipe_t*)stream, backlog, cb); + break; + default: + assert(0); + } + + return uv_translate_sys_error(err); +} + + +int uv_accept(uv_stream_t* server, uv_stream_t* client) { + int err; + + err = ERROR_INVALID_PARAMETER; + switch (server->type) { + case UV_TCP: + err = uv_tcp_accept((uv_tcp_t*)server, (uv_tcp_t*)client); + break; + case UV_NAMED_PIPE: + err = uv_pipe_accept((uv_pipe_t*)server, client); + break; + default: + assert(0); + } + + return uv_translate_sys_error(err); +} + + +int uv_read_start(uv_stream_t* handle, uv_alloc_cb alloc_cb, + uv_read_cb read_cb) { + int err; + + if (handle->flags & UV_HANDLE_READING) { + return UV_EALREADY; + } + + if (!(handle->flags & UV_HANDLE_READABLE)) { + return UV_ENOTCONN; + } + + err = ERROR_INVALID_PARAMETER; + switch (handle->type) { + case UV_TCP: + err = uv_tcp_read_start((uv_tcp_t*)handle, alloc_cb, read_cb); + break; + case UV_NAMED_PIPE: + err = uv_pipe_read_start((uv_pipe_t*)handle, alloc_cb, read_cb); + break; + case UV_TTY: + err = uv_tty_read_start((uv_tty_t*) handle, alloc_cb, read_cb); + break; + default: + assert(0); + } + + return uv_translate_sys_error(err); +} + + +int uv_read_stop(uv_stream_t* handle) { + int err; + + if (!(handle->flags & UV_HANDLE_READING)) + return 0; + + err = 0; + if (handle->type == UV_TTY) { + err = uv_tty_read_stop((uv_tty_t*) handle); + } else { + if (handle->type == UV_NAMED_PIPE) { + uv__pipe_stop_read((uv_pipe_t*) handle); + } else { + handle->flags &= ~UV_HANDLE_READING; + } + DECREASE_ACTIVE_COUNT(handle->loop, handle); + } + + return uv_translate_sys_error(err); +} + + +int uv_write(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_write_cb cb) { + uv_loop_t* loop = handle->loop; + int err; + + if (!(handle->flags & UV_HANDLE_WRITABLE)) { + return UV_EPIPE; + } + + err = ERROR_INVALID_PARAMETER; + switch (handle->type) { + case UV_TCP: + err = uv_tcp_write(loop, req, (uv_tcp_t*) handle, bufs, nbufs, cb); + break; + case UV_NAMED_PIPE: + err = uv_pipe_write(loop, req, (uv_pipe_t*) handle, bufs, nbufs, cb); + break; + case UV_TTY: + err = uv_tty_write(loop, req, (uv_tty_t*) handle, bufs, nbufs, cb); + break; + default: + assert(0); + } + + return uv_translate_sys_error(err); +} + + +int uv_write2(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_stream_t* send_handle, + uv_write_cb cb) { + uv_loop_t* loop = handle->loop; + int err; + + if (!(handle->flags & UV_HANDLE_WRITABLE)) { + return UV_EPIPE; + } + + err = ERROR_INVALID_PARAMETER; + switch (handle->type) { + case UV_NAMED_PIPE: + err = uv_pipe_write2(loop, + req, + (uv_pipe_t*) handle, + bufs, + nbufs, + send_handle, + cb); + break; + default: + assert(0); + } + + return uv_translate_sys_error(err); +} + + +int uv_try_write(uv_stream_t* stream, + const uv_buf_t bufs[], + unsigned int nbufs) { + if (stream->flags & UV__HANDLE_CLOSING) + return UV_EBADF; + if (!(stream->flags & UV_HANDLE_WRITABLE)) + return UV_EPIPE; + + switch (stream->type) { + case UV_TCP: + return uv__tcp_try_write((uv_tcp_t*) stream, bufs, nbufs); + case UV_TTY: + return uv__tty_try_write((uv_tty_t*) stream, bufs, nbufs); + case UV_NAMED_PIPE: + return UV_EAGAIN; + default: + assert(0); + return UV_ENOSYS; + } +} + + +int uv_shutdown(uv_shutdown_t* req, uv_stream_t* handle, uv_shutdown_cb cb) { + uv_loop_t* loop = handle->loop; + + if (!(handle->flags & UV_HANDLE_WRITABLE)) { + return UV_EPIPE; + } + + uv_req_init(loop, (uv_req_t*) req); + req->type = UV_SHUTDOWN; + req->handle = handle; + req->cb = cb; + + handle->flags &= ~UV_HANDLE_WRITABLE; + handle->stream.conn.shutdown_req = req; + handle->reqs_pending++; + REGISTER_HANDLE_REQ(loop, handle, req); + + uv_want_endgame(loop, (uv_handle_t*)handle); + + return 0; +} + + +int uv_is_readable(const uv_stream_t* handle) { + return !!(handle->flags & UV_HANDLE_READABLE); +} + + +int uv_is_writable(const uv_stream_t* handle) { + return !!(handle->flags & UV_HANDLE_WRITABLE); +} + + +int uv_stream_set_blocking(uv_stream_t* handle, int blocking) { + if (handle->type != UV_NAMED_PIPE) + return UV_EINVAL; + + if (blocking != 0) + handle->flags |= UV_HANDLE_BLOCKING_WRITES; + else + handle->flags &= ~UV_HANDLE_BLOCKING_WRITES; + + return 0; +} diff --git a/3rdparty/libuv/src/win/tcp.c b/3rdparty/libuv/src/win/tcp.c new file mode 100644 index 00000000000..0f5654863e9 --- /dev/null +++ b/3rdparty/libuv/src/win/tcp.c @@ -0,0 +1,1507 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "stream-inl.h" +#include "req-inl.h" + + +/* + * Threshold of active tcp streams for which to preallocate tcp read buffers. + * (Due to node slab allocator performing poorly under this pattern, + * the optimization is temporarily disabled (threshold=0). This will be + * revisited once node allocator is improved.) + */ +const unsigned int uv_active_tcp_streams_threshold = 0; + +/* + * Number of simultaneous pending AcceptEx calls. + */ +const unsigned int uv_simultaneous_server_accepts = 32; + +/* A zero-size buffer for use by uv_tcp_read */ +static char uv_zero_[] = ""; + +static int uv__tcp_nodelay(uv_tcp_t* handle, SOCKET socket, int enable) { + if (setsockopt(socket, + IPPROTO_TCP, + TCP_NODELAY, + (const char*)&enable, + sizeof enable) == -1) { + return WSAGetLastError(); + } + return 0; +} + + +static int uv__tcp_keepalive(uv_tcp_t* handle, SOCKET socket, int enable, unsigned int delay) { + if (setsockopt(socket, + SOL_SOCKET, + SO_KEEPALIVE, + (const char*)&enable, + sizeof enable) == -1) { + return WSAGetLastError(); + } + + if (enable && setsockopt(socket, + IPPROTO_TCP, + TCP_KEEPALIVE, + (const char*)&delay, + sizeof delay) == -1) { + return WSAGetLastError(); + } + + return 0; +} + + +static int uv_tcp_set_socket(uv_loop_t* loop, + uv_tcp_t* handle, + SOCKET socket, + int family, + int imported) { + DWORD yes = 1; + int non_ifs_lsp; + int err; + + if (handle->socket != INVALID_SOCKET) + return UV_EBUSY; + + /* Set the socket to nonblocking mode */ + if (ioctlsocket(socket, FIONBIO, &yes) == SOCKET_ERROR) { + return WSAGetLastError(); + } + + /* Make the socket non-inheritable */ + if (!SetHandleInformation((HANDLE) socket, HANDLE_FLAG_INHERIT, 0)) + return GetLastError(); + + /* Associate it with the I/O completion port. */ + /* Use uv_handle_t pointer as completion key. */ + if (CreateIoCompletionPort((HANDLE)socket, + loop->iocp, + (ULONG_PTR)socket, + 0) == NULL) { + if (imported) { + handle->flags |= UV_HANDLE_EMULATE_IOCP; + } else { + return GetLastError(); + } + } + + if (family == AF_INET6) { + non_ifs_lsp = uv_tcp_non_ifs_lsp_ipv6; + } else { + non_ifs_lsp = uv_tcp_non_ifs_lsp_ipv4; + } + + if (pSetFileCompletionNotificationModes && + !(handle->flags & UV_HANDLE_EMULATE_IOCP) && !non_ifs_lsp) { + if (pSetFileCompletionNotificationModes((HANDLE) socket, + FILE_SKIP_SET_EVENT_ON_HANDLE | + FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) { + handle->flags |= UV_HANDLE_SYNC_BYPASS_IOCP; + } else if (GetLastError() != ERROR_INVALID_FUNCTION) { + return GetLastError(); + } + } + + if (handle->flags & UV_HANDLE_TCP_NODELAY) { + err = uv__tcp_nodelay(handle, socket, 1); + if (err) + return err; + } + + /* TODO: Use stored delay. */ + if (handle->flags & UV_HANDLE_TCP_KEEPALIVE) { + err = uv__tcp_keepalive(handle, socket, 1, 60); + if (err) + return err; + } + + handle->socket = socket; + + if (family == AF_INET6) { + handle->flags |= UV_HANDLE_IPV6; + } else { + assert(!(handle->flags & UV_HANDLE_IPV6)); + } + + return 0; +} + + +int uv_tcp_init_ex(uv_loop_t* loop, uv_tcp_t* handle, unsigned int flags) { + int domain; + + /* Use the lower 8 bits for the domain */ + domain = flags & 0xFF; + if (domain != AF_INET && domain != AF_INET6 && domain != AF_UNSPEC) + return UV_EINVAL; + + if (flags & ~0xFF) + return UV_EINVAL; + + uv_stream_init(loop, (uv_stream_t*) handle, UV_TCP); + handle->tcp.serv.accept_reqs = NULL; + handle->tcp.serv.pending_accepts = NULL; + handle->socket = INVALID_SOCKET; + handle->reqs_pending = 0; + handle->tcp.serv.func_acceptex = NULL; + handle->tcp.conn.func_connectex = NULL; + handle->tcp.serv.processed_accepts = 0; + handle->delayed_error = 0; + + /* If anything fails beyond this point we need to remove the handle from + * the handle queue, since it was added by uv__handle_init in uv_stream_init. + */ + + if (domain != AF_UNSPEC) { + SOCKET sock; + DWORD err; + + sock = socket(domain, SOCK_STREAM, 0); + if (sock == INVALID_SOCKET) { + err = WSAGetLastError(); + QUEUE_REMOVE(&handle->handle_queue); + return uv_translate_sys_error(err); + } + + err = uv_tcp_set_socket(handle->loop, handle, sock, domain, 0); + if (err) { + closesocket(sock); + QUEUE_REMOVE(&handle->handle_queue); + return uv_translate_sys_error(err); + } + + } + + return 0; +} + + +int uv_tcp_init(uv_loop_t* loop, uv_tcp_t* handle) { + return uv_tcp_init_ex(loop, handle, AF_UNSPEC); +} + + +void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle) { + int err; + unsigned int i; + uv_tcp_accept_t* req; + + if (handle->flags & UV_HANDLE_CONNECTION && + handle->stream.conn.shutdown_req != NULL && + handle->stream.conn.write_reqs_pending == 0) { + + UNREGISTER_HANDLE_REQ(loop, handle, handle->stream.conn.shutdown_req); + + err = 0; + if (handle->flags & UV__HANDLE_CLOSING) { + err = ERROR_OPERATION_ABORTED; + } else if (shutdown(handle->socket, SD_SEND) == SOCKET_ERROR) { + err = WSAGetLastError(); + } + + if (handle->stream.conn.shutdown_req->cb) { + handle->stream.conn.shutdown_req->cb(handle->stream.conn.shutdown_req, + uv_translate_sys_error(err)); + } + + handle->stream.conn.shutdown_req = NULL; + DECREASE_PENDING_REQ_COUNT(handle); + return; + } + + if (handle->flags & UV__HANDLE_CLOSING && + handle->reqs_pending == 0) { + assert(!(handle->flags & UV_HANDLE_CLOSED)); + + if (!(handle->flags & UV_HANDLE_TCP_SOCKET_CLOSED)) { + closesocket(handle->socket); + handle->socket = INVALID_SOCKET; + handle->flags |= UV_HANDLE_TCP_SOCKET_CLOSED; + } + + if (!(handle->flags & UV_HANDLE_CONNECTION) && handle->tcp.serv.accept_reqs) { + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + for (i = 0; i < uv_simultaneous_server_accepts; i++) { + req = &handle->tcp.serv.accept_reqs[i]; + if (req->wait_handle != INVALID_HANDLE_VALUE) { + UnregisterWait(req->wait_handle); + req->wait_handle = INVALID_HANDLE_VALUE; + } + if (req->event_handle) { + CloseHandle(req->event_handle); + req->event_handle = NULL; + } + } + } + + uv__free(handle->tcp.serv.accept_reqs); + handle->tcp.serv.accept_reqs = NULL; + } + + if (handle->flags & UV_HANDLE_CONNECTION && + handle->flags & UV_HANDLE_EMULATE_IOCP) { + if (handle->read_req.wait_handle != INVALID_HANDLE_VALUE) { + UnregisterWait(handle->read_req.wait_handle); + handle->read_req.wait_handle = INVALID_HANDLE_VALUE; + } + if (handle->read_req.event_handle) { + CloseHandle(handle->read_req.event_handle); + handle->read_req.event_handle = NULL; + } + } + + uv__handle_close(handle); + loop->active_tcp_streams--; + } +} + + +/* Unlike on Unix, here we don't set SO_REUSEADDR, because it doesn't just + * allow binding to addresses that are in use by sockets in TIME_WAIT, it + * effectively allows 'stealing' a port which is in use by another application. + * + * SO_EXCLUSIVEADDRUSE is also not good here because it does check all sockets, + * regardless of state, so we'd get an error even if the port is in use by a + * socket in TIME_WAIT state. + * + * See issue #1360. + * + */ +static int uv_tcp_try_bind(uv_tcp_t* handle, + const struct sockaddr* addr, + unsigned int addrlen, + unsigned int flags) { + DWORD err; + int r; + + if (handle->socket == INVALID_SOCKET) { + SOCKET sock; + + /* Cannot set IPv6-only mode on non-IPv6 socket. */ + if ((flags & UV_TCP_IPV6ONLY) && addr->sa_family != AF_INET6) + return ERROR_INVALID_PARAMETER; + + sock = socket(addr->sa_family, SOCK_STREAM, 0); + if (sock == INVALID_SOCKET) { + return WSAGetLastError(); + } + + err = uv_tcp_set_socket(handle->loop, handle, sock, addr->sa_family, 0); + if (err) { + closesocket(sock); + return err; + } + } + +#ifdef IPV6_V6ONLY + if (addr->sa_family == AF_INET6) { + int on; + + on = (flags & UV_TCP_IPV6ONLY) != 0; + + /* TODO: how to handle errors? This may fail if there is no ipv4 stack */ + /* available, or when run on XP/2003 which have no support for dualstack */ + /* sockets. For now we're silently ignoring the error. */ + setsockopt(handle->socket, + IPPROTO_IPV6, + IPV6_V6ONLY, + (const char*)&on, + sizeof on); + } +#endif + + r = bind(handle->socket, addr, addrlen); + + if (r == SOCKET_ERROR) { + err = WSAGetLastError(); + if (err == WSAEADDRINUSE) { + /* Some errors are not to be reported until connect() or listen() */ + handle->delayed_error = err; + } else { + return err; + } + } + + handle->flags |= UV_HANDLE_BOUND; + + return 0; +} + + +static void CALLBACK post_completion(void* context, BOOLEAN timed_out) { + uv_req_t* req; + uv_tcp_t* handle; + + req = (uv_req_t*) context; + assert(req != NULL); + handle = (uv_tcp_t*)req->data; + assert(handle != NULL); + assert(!timed_out); + + if (!PostQueuedCompletionStatus(handle->loop->iocp, + req->u.io.overlapped.InternalHigh, + 0, + &req->u.io.overlapped)) { + uv_fatal_error(GetLastError(), "PostQueuedCompletionStatus"); + } +} + + +static void CALLBACK post_write_completion(void* context, BOOLEAN timed_out) { + uv_write_t* req; + uv_tcp_t* handle; + + req = (uv_write_t*) context; + assert(req != NULL); + handle = (uv_tcp_t*)req->handle; + assert(handle != NULL); + assert(!timed_out); + + if (!PostQueuedCompletionStatus(handle->loop->iocp, + req->u.io.overlapped.InternalHigh, + 0, + &req->u.io.overlapped)) { + uv_fatal_error(GetLastError(), "PostQueuedCompletionStatus"); + } +} + + +static void uv_tcp_queue_accept(uv_tcp_t* handle, uv_tcp_accept_t* req) { + uv_loop_t* loop = handle->loop; + BOOL success; + DWORD bytes; + SOCKET accept_socket; + short family; + + assert(handle->flags & UV_HANDLE_LISTENING); + assert(req->accept_socket == INVALID_SOCKET); + + /* choose family and extension function */ + if (handle->flags & UV_HANDLE_IPV6) { + family = AF_INET6; + } else { + family = AF_INET; + } + + /* Open a socket for the accepted connection. */ + accept_socket = socket(family, SOCK_STREAM, 0); + if (accept_socket == INVALID_SOCKET) { + SET_REQ_ERROR(req, WSAGetLastError()); + uv_insert_pending_req(loop, (uv_req_t*)req); + handle->reqs_pending++; + return; + } + + /* Make the socket non-inheritable */ + if (!SetHandleInformation((HANDLE) accept_socket, HANDLE_FLAG_INHERIT, 0)) { + SET_REQ_ERROR(req, GetLastError()); + uv_insert_pending_req(loop, (uv_req_t*)req); + handle->reqs_pending++; + closesocket(accept_socket); + return; + } + + /* Prepare the overlapped structure. */ + memset(&(req->u.io.overlapped), 0, sizeof(req->u.io.overlapped)); + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + req->u.io.overlapped.hEvent = (HANDLE) ((ULONG_PTR) req->event_handle | 1); + } + + success = handle->tcp.serv.func_acceptex(handle->socket, + accept_socket, + (void*)req->accept_buffer, + 0, + sizeof(struct sockaddr_storage), + sizeof(struct sockaddr_storage), + &bytes, + &req->u.io.overlapped); + + if (UV_SUCCEEDED_WITHOUT_IOCP(success)) { + /* Process the req without IOCP. */ + req->accept_socket = accept_socket; + handle->reqs_pending++; + uv_insert_pending_req(loop, (uv_req_t*)req); + } else if (UV_SUCCEEDED_WITH_IOCP(success)) { + /* The req will be processed with IOCP. */ + req->accept_socket = accept_socket; + handle->reqs_pending++; + if (handle->flags & UV_HANDLE_EMULATE_IOCP && + req->wait_handle == INVALID_HANDLE_VALUE && + !RegisterWaitForSingleObject(&req->wait_handle, + req->event_handle, post_completion, (void*) req, + INFINITE, WT_EXECUTEINWAITTHREAD)) { + SET_REQ_ERROR(req, GetLastError()); + uv_insert_pending_req(loop, (uv_req_t*)req); + handle->reqs_pending++; + return; + } + } else { + /* Make this req pending reporting an error. */ + SET_REQ_ERROR(req, WSAGetLastError()); + uv_insert_pending_req(loop, (uv_req_t*)req); + handle->reqs_pending++; + /* Destroy the preallocated client socket. */ + closesocket(accept_socket); + /* Destroy the event handle */ + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + CloseHandle(req->u.io.overlapped.hEvent); + req->event_handle = NULL; + } + } +} + + +static void uv_tcp_queue_read(uv_loop_t* loop, uv_tcp_t* handle) { + uv_read_t* req; + uv_buf_t buf; + int result; + DWORD bytes, flags; + + assert(handle->flags & UV_HANDLE_READING); + assert(!(handle->flags & UV_HANDLE_READ_PENDING)); + + req = &handle->read_req; + memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); + + /* + * Preallocate a read buffer if the number of active streams is below + * the threshold. + */ + if (loop->active_tcp_streams < uv_active_tcp_streams_threshold) { + handle->flags &= ~UV_HANDLE_ZERO_READ; + handle->alloc_cb((uv_handle_t*) handle, 65536, &handle->tcp.conn.read_buffer); + if (handle->tcp.conn.read_buffer.len == 0) { + handle->read_cb((uv_stream_t*) handle, UV_ENOBUFS, &handle->tcp.conn.read_buffer); + return; + } + assert(handle->tcp.conn.read_buffer.base != NULL); + buf = handle->tcp.conn.read_buffer; + } else { + handle->flags |= UV_HANDLE_ZERO_READ; + buf.base = (char*) &uv_zero_; + buf.len = 0; + } + + /* Prepare the overlapped structure. */ + memset(&(req->u.io.overlapped), 0, sizeof(req->u.io.overlapped)); + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + assert(req->event_handle); + req->u.io.overlapped.hEvent = (HANDLE) ((ULONG_PTR) req->event_handle | 1); + } + + flags = 0; + result = WSARecv(handle->socket, + (WSABUF*)&buf, + 1, + &bytes, + &flags, + &req->u.io.overlapped, + NULL); + + if (UV_SUCCEEDED_WITHOUT_IOCP(result == 0)) { + /* Process the req without IOCP. */ + handle->flags |= UV_HANDLE_READ_PENDING; + req->u.io.overlapped.InternalHigh = bytes; + handle->reqs_pending++; + uv_insert_pending_req(loop, (uv_req_t*)req); + } else if (UV_SUCCEEDED_WITH_IOCP(result == 0)) { + /* The req will be processed with IOCP. */ + handle->flags |= UV_HANDLE_READ_PENDING; + handle->reqs_pending++; + if (handle->flags & UV_HANDLE_EMULATE_IOCP && + req->wait_handle == INVALID_HANDLE_VALUE && + !RegisterWaitForSingleObject(&req->wait_handle, + req->event_handle, post_completion, (void*) req, + INFINITE, WT_EXECUTEINWAITTHREAD)) { + SET_REQ_ERROR(req, GetLastError()); + uv_insert_pending_req(loop, (uv_req_t*)req); + } + } else { + /* Make this req pending reporting an error. */ + SET_REQ_ERROR(req, WSAGetLastError()); + uv_insert_pending_req(loop, (uv_req_t*)req); + handle->reqs_pending++; + } +} + + +int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) { + uv_loop_t* loop = handle->loop; + unsigned int i, simultaneous_accepts; + uv_tcp_accept_t* req; + int err; + + assert(backlog > 0); + + if (handle->flags & UV_HANDLE_LISTENING) { + handle->stream.serv.connection_cb = cb; + } + + if (handle->flags & UV_HANDLE_READING) { + return WSAEISCONN; + } + + if (handle->delayed_error) { + return handle->delayed_error; + } + + if (!(handle->flags & UV_HANDLE_BOUND)) { + err = uv_tcp_try_bind(handle, + (const struct sockaddr*) &uv_addr_ip4_any_, + sizeof(uv_addr_ip4_any_), + 0); + if (err) + return err; + if (handle->delayed_error) + return handle->delayed_error; + } + + if (!handle->tcp.serv.func_acceptex) { + if (!uv_get_acceptex_function(handle->socket, &handle->tcp.serv.func_acceptex)) { + return WSAEAFNOSUPPORT; + } + } + + if (!(handle->flags & UV_HANDLE_SHARED_TCP_SOCKET) && + listen(handle->socket, backlog) == SOCKET_ERROR) { + return WSAGetLastError(); + } + + handle->flags |= UV_HANDLE_LISTENING; + handle->stream.serv.connection_cb = cb; + INCREASE_ACTIVE_COUNT(loop, handle); + + simultaneous_accepts = handle->flags & UV_HANDLE_TCP_SINGLE_ACCEPT ? 1 + : uv_simultaneous_server_accepts; + + if(!handle->tcp.serv.accept_reqs) { + handle->tcp.serv.accept_reqs = (uv_tcp_accept_t*) + uv__malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t)); + if (!handle->tcp.serv.accept_reqs) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + for (i = 0; i < simultaneous_accepts; i++) { + req = &handle->tcp.serv.accept_reqs[i]; + uv_req_init(loop, (uv_req_t*)req); + req->type = UV_ACCEPT; + req->accept_socket = INVALID_SOCKET; + req->data = handle; + + req->wait_handle = INVALID_HANDLE_VALUE; + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + req->event_handle = CreateEvent(NULL, 0, 0, NULL); + if (!req->event_handle) { + uv_fatal_error(GetLastError(), "CreateEvent"); + } + } else { + req->event_handle = NULL; + } + + uv_tcp_queue_accept(handle, req); + } + + /* Initialize other unused requests too, because uv_tcp_endgame */ + /* doesn't know how how many requests were initialized, so it will */ + /* try to clean up {uv_simultaneous_server_accepts} requests. */ + for (i = simultaneous_accepts; i < uv_simultaneous_server_accepts; i++) { + req = &handle->tcp.serv.accept_reqs[i]; + uv_req_init(loop, (uv_req_t*) req); + req->type = UV_ACCEPT; + req->accept_socket = INVALID_SOCKET; + req->data = handle; + req->wait_handle = INVALID_HANDLE_VALUE; + req->event_handle = NULL; + } + } + + return 0; +} + + +int uv_tcp_accept(uv_tcp_t* server, uv_tcp_t* client) { + uv_loop_t* loop = server->loop; + int err = 0; + int family; + + uv_tcp_accept_t* req = server->tcp.serv.pending_accepts; + + if (!req) { + /* No valid connections found, so we error out. */ + return WSAEWOULDBLOCK; + } + + if (req->accept_socket == INVALID_SOCKET) { + return WSAENOTCONN; + } + + if (server->flags & UV_HANDLE_IPV6) { + family = AF_INET6; + } else { + family = AF_INET; + } + + err = uv_tcp_set_socket(client->loop, + client, + req->accept_socket, + family, + 0); + if (err) { + closesocket(req->accept_socket); + } else { + uv_connection_init((uv_stream_t*) client); + /* AcceptEx() implicitly binds the accepted socket. */ + client->flags |= UV_HANDLE_BOUND | UV_HANDLE_READABLE | UV_HANDLE_WRITABLE; + } + + /* Prepare the req to pick up a new connection */ + server->tcp.serv.pending_accepts = req->next_pending; + req->next_pending = NULL; + req->accept_socket = INVALID_SOCKET; + + if (!(server->flags & UV__HANDLE_CLOSING)) { + /* Check if we're in a middle of changing the number of pending accepts. */ + if (!(server->flags & UV_HANDLE_TCP_ACCEPT_STATE_CHANGING)) { + uv_tcp_queue_accept(server, req); + } else { + /* We better be switching to a single pending accept. */ + assert(server->flags & UV_HANDLE_TCP_SINGLE_ACCEPT); + + server->tcp.serv.processed_accepts++; + + if (server->tcp.serv.processed_accepts >= uv_simultaneous_server_accepts) { + server->tcp.serv.processed_accepts = 0; + /* + * All previously queued accept requests are now processed. + * We now switch to queueing just a single accept. + */ + uv_tcp_queue_accept(server, &server->tcp.serv.accept_reqs[0]); + server->flags &= ~UV_HANDLE_TCP_ACCEPT_STATE_CHANGING; + server->flags |= UV_HANDLE_TCP_SINGLE_ACCEPT; + } + } + } + + loop->active_tcp_streams++; + + return err; +} + + +int uv_tcp_read_start(uv_tcp_t* handle, uv_alloc_cb alloc_cb, + uv_read_cb read_cb) { + uv_loop_t* loop = handle->loop; + + handle->flags |= UV_HANDLE_READING; + handle->read_cb = read_cb; + handle->alloc_cb = alloc_cb; + INCREASE_ACTIVE_COUNT(loop, handle); + + /* If reading was stopped and then started again, there could still be a */ + /* read request pending. */ + if (!(handle->flags & UV_HANDLE_READ_PENDING)) { + if (handle->flags & UV_HANDLE_EMULATE_IOCP && + !handle->read_req.event_handle) { + handle->read_req.event_handle = CreateEvent(NULL, 0, 0, NULL); + if (!handle->read_req.event_handle) { + uv_fatal_error(GetLastError(), "CreateEvent"); + } + } + uv_tcp_queue_read(loop, handle); + } + + return 0; +} + + +static int uv_tcp_try_connect(uv_connect_t* req, + uv_tcp_t* handle, + const struct sockaddr* addr, + unsigned int addrlen, + uv_connect_cb cb) { + uv_loop_t* loop = handle->loop; + const struct sockaddr* bind_addr; + BOOL success; + DWORD bytes; + int err; + + if (handle->delayed_error) { + return handle->delayed_error; + } + + if (!(handle->flags & UV_HANDLE_BOUND)) { + if (addrlen == sizeof(uv_addr_ip4_any_)) { + bind_addr = (const struct sockaddr*) &uv_addr_ip4_any_; + } else if (addrlen == sizeof(uv_addr_ip6_any_)) { + bind_addr = (const struct sockaddr*) &uv_addr_ip6_any_; + } else { + abort(); + } + err = uv_tcp_try_bind(handle, bind_addr, addrlen, 0); + if (err) + return err; + if (handle->delayed_error) + return handle->delayed_error; + } + + if (!handle->tcp.conn.func_connectex) { + if (!uv_get_connectex_function(handle->socket, &handle->tcp.conn.func_connectex)) { + return WSAEAFNOSUPPORT; + } + } + + uv_req_init(loop, (uv_req_t*) req); + req->type = UV_CONNECT; + req->handle = (uv_stream_t*) handle; + req->cb = cb; + memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); + + success = handle->tcp.conn.func_connectex(handle->socket, + addr, + addrlen, + NULL, + 0, + &bytes, + &req->u.io.overlapped); + + if (UV_SUCCEEDED_WITHOUT_IOCP(success)) { + /* Process the req without IOCP. */ + handle->reqs_pending++; + REGISTER_HANDLE_REQ(loop, handle, req); + uv_insert_pending_req(loop, (uv_req_t*)req); + } else if (UV_SUCCEEDED_WITH_IOCP(success)) { + /* The req will be processed with IOCP. */ + handle->reqs_pending++; + REGISTER_HANDLE_REQ(loop, handle, req); + } else { + return WSAGetLastError(); + } + + return 0; +} + + +int uv_tcp_getsockname(const uv_tcp_t* handle, + struct sockaddr* name, + int* namelen) { + int result; + + if (handle->socket == INVALID_SOCKET) { + return UV_EINVAL; + } + + if (handle->delayed_error) { + return uv_translate_sys_error(handle->delayed_error); + } + + result = getsockname(handle->socket, name, namelen); + if (result != 0) { + return uv_translate_sys_error(WSAGetLastError()); + } + + return 0; +} + + +int uv_tcp_getpeername(const uv_tcp_t* handle, + struct sockaddr* name, + int* namelen) { + int result; + + if (handle->socket == INVALID_SOCKET) { + return UV_EINVAL; + } + + if (handle->delayed_error) { + return uv_translate_sys_error(handle->delayed_error); + } + + result = getpeername(handle->socket, name, namelen); + if (result != 0) { + return uv_translate_sys_error(WSAGetLastError()); + } + + return 0; +} + + +int uv_tcp_write(uv_loop_t* loop, + uv_write_t* req, + uv_tcp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_write_cb cb) { + int result; + DWORD bytes; + + uv_req_init(loop, (uv_req_t*) req); + req->type = UV_WRITE; + req->handle = (uv_stream_t*) handle; + req->cb = cb; + + /* Prepare the overlapped structure. */ + memset(&(req->u.io.overlapped), 0, sizeof(req->u.io.overlapped)); + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + req->event_handle = CreateEvent(NULL, 0, 0, NULL); + if (!req->event_handle) { + uv_fatal_error(GetLastError(), "CreateEvent"); + } + req->u.io.overlapped.hEvent = (HANDLE) ((ULONG_PTR) req->event_handle | 1); + req->wait_handle = INVALID_HANDLE_VALUE; + } + + result = WSASend(handle->socket, + (WSABUF*) bufs, + nbufs, + &bytes, + 0, + &req->u.io.overlapped, + NULL); + + if (UV_SUCCEEDED_WITHOUT_IOCP(result == 0)) { + /* Request completed immediately. */ + req->u.io.queued_bytes = 0; + handle->reqs_pending++; + handle->stream.conn.write_reqs_pending++; + REGISTER_HANDLE_REQ(loop, handle, req); + uv_insert_pending_req(loop, (uv_req_t*) req); + } else if (UV_SUCCEEDED_WITH_IOCP(result == 0)) { + /* Request queued by the kernel. */ + req->u.io.queued_bytes = uv__count_bufs(bufs, nbufs); + handle->reqs_pending++; + handle->stream.conn.write_reqs_pending++; + REGISTER_HANDLE_REQ(loop, handle, req); + handle->write_queue_size += req->u.io.queued_bytes; + if (handle->flags & UV_HANDLE_EMULATE_IOCP && + !RegisterWaitForSingleObject(&req->wait_handle, + req->event_handle, post_write_completion, (void*) req, + INFINITE, WT_EXECUTEINWAITTHREAD | WT_EXECUTEONLYONCE)) { + SET_REQ_ERROR(req, GetLastError()); + uv_insert_pending_req(loop, (uv_req_t*)req); + } + } else { + /* Send failed due to an error, report it later */ + req->u.io.queued_bytes = 0; + handle->reqs_pending++; + handle->stream.conn.write_reqs_pending++; + REGISTER_HANDLE_REQ(loop, handle, req); + SET_REQ_ERROR(req, WSAGetLastError()); + uv_insert_pending_req(loop, (uv_req_t*) req); + } + + return 0; +} + + +int uv__tcp_try_write(uv_tcp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs) { + int result; + DWORD bytes; + + if (handle->stream.conn.write_reqs_pending > 0) + return UV_EAGAIN; + + result = WSASend(handle->socket, + (WSABUF*) bufs, + nbufs, + &bytes, + 0, + NULL, + NULL); + + if (result == SOCKET_ERROR) + return uv_translate_sys_error(WSAGetLastError()); + else + return bytes; +} + + +void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, + uv_req_t* req) { + DWORD bytes, flags, err; + uv_buf_t buf; + + assert(handle->type == UV_TCP); + + handle->flags &= ~UV_HANDLE_READ_PENDING; + + if (!REQ_SUCCESS(req)) { + /* An error occurred doing the read. */ + if ((handle->flags & UV_HANDLE_READING) || + !(handle->flags & UV_HANDLE_ZERO_READ)) { + handle->flags &= ~UV_HANDLE_READING; + DECREASE_ACTIVE_COUNT(loop, handle); + buf = (handle->flags & UV_HANDLE_ZERO_READ) ? + uv_buf_init(NULL, 0) : handle->tcp.conn.read_buffer; + + err = GET_REQ_SOCK_ERROR(req); + + if (err == WSAECONNABORTED) { + /* + * Turn WSAECONNABORTED into UV_ECONNRESET to be consistent with Unix. + */ + err = WSAECONNRESET; + } + + handle->read_cb((uv_stream_t*)handle, + uv_translate_sys_error(err), + &buf); + } + } else { + if (!(handle->flags & UV_HANDLE_ZERO_READ)) { + /* The read was done with a non-zero buffer length. */ + if (req->u.io.overlapped.InternalHigh > 0) { + /* Successful read */ + handle->read_cb((uv_stream_t*)handle, + req->u.io.overlapped.InternalHigh, + &handle->tcp.conn.read_buffer); + /* Read again only if bytes == buf.len */ + if (req->u.io.overlapped.InternalHigh < handle->tcp.conn.read_buffer.len) { + goto done; + } + } else { + /* Connection closed */ + if (handle->flags & UV_HANDLE_READING) { + handle->flags &= ~UV_HANDLE_READING; + DECREASE_ACTIVE_COUNT(loop, handle); + } + handle->flags &= ~UV_HANDLE_READABLE; + + buf.base = 0; + buf.len = 0; + handle->read_cb((uv_stream_t*)handle, UV_EOF, &handle->tcp.conn.read_buffer); + goto done; + } + } + + /* Do nonblocking reads until the buffer is empty */ + while (handle->flags & UV_HANDLE_READING) { + handle->alloc_cb((uv_handle_t*) handle, 65536, &buf); + if (buf.len == 0) { + handle->read_cb((uv_stream_t*) handle, UV_ENOBUFS, &buf); + break; + } + assert(buf.base != NULL); + + flags = 0; + if (WSARecv(handle->socket, + (WSABUF*)&buf, + 1, + &bytes, + &flags, + NULL, + NULL) != SOCKET_ERROR) { + if (bytes > 0) { + /* Successful read */ + handle->read_cb((uv_stream_t*)handle, bytes, &buf); + /* Read again only if bytes == buf.len */ + if (bytes < buf.len) { + break; + } + } else { + /* Connection closed */ + handle->flags &= ~(UV_HANDLE_READING | UV_HANDLE_READABLE); + DECREASE_ACTIVE_COUNT(loop, handle); + + handle->read_cb((uv_stream_t*)handle, UV_EOF, &buf); + break; + } + } else { + err = WSAGetLastError(); + if (err == WSAEWOULDBLOCK) { + /* Read buffer was completely empty, report a 0-byte read. */ + handle->read_cb((uv_stream_t*)handle, 0, &buf); + } else { + /* Ouch! serious error. */ + handle->flags &= ~UV_HANDLE_READING; + DECREASE_ACTIVE_COUNT(loop, handle); + + if (err == WSAECONNABORTED) { + /* Turn WSAECONNABORTED into UV_ECONNRESET to be consistent with */ + /* Unix. */ + err = WSAECONNRESET; + } + + handle->read_cb((uv_stream_t*)handle, + uv_translate_sys_error(err), + &buf); + } + break; + } + } + +done: + /* Post another read if still reading and not closing. */ + if ((handle->flags & UV_HANDLE_READING) && + !(handle->flags & UV_HANDLE_READ_PENDING)) { + uv_tcp_queue_read(loop, handle); + } + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +void uv_process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle, + uv_write_t* req) { + int err; + + assert(handle->type == UV_TCP); + + assert(handle->write_queue_size >= req->u.io.queued_bytes); + handle->write_queue_size -= req->u.io.queued_bytes; + + UNREGISTER_HANDLE_REQ(loop, handle, req); + + if (handle->flags & UV_HANDLE_EMULATE_IOCP) { + if (req->wait_handle != INVALID_HANDLE_VALUE) { + UnregisterWait(req->wait_handle); + req->wait_handle = INVALID_HANDLE_VALUE; + } + if (req->event_handle) { + CloseHandle(req->event_handle); + req->event_handle = NULL; + } + } + + if (req->cb) { + err = uv_translate_sys_error(GET_REQ_SOCK_ERROR(req)); + if (err == UV_ECONNABORTED) { + /* use UV_ECANCELED for consistency with Unix */ + err = UV_ECANCELED; + } + req->cb(req, err); + } + + handle->stream.conn.write_reqs_pending--; + if (handle->stream.conn.shutdown_req != NULL && + handle->stream.conn.write_reqs_pending == 0) { + uv_want_endgame(loop, (uv_handle_t*)handle); + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +void uv_process_tcp_accept_req(uv_loop_t* loop, uv_tcp_t* handle, + uv_req_t* raw_req) { + uv_tcp_accept_t* req = (uv_tcp_accept_t*) raw_req; + int err; + + assert(handle->type == UV_TCP); + + /* If handle->accepted_socket is not a valid socket, then */ + /* uv_queue_accept must have failed. This is a serious error. We stop */ + /* accepting connections and report this error to the connection */ + /* callback. */ + if (req->accept_socket == INVALID_SOCKET) { + if (handle->flags & UV_HANDLE_LISTENING) { + handle->flags &= ~UV_HANDLE_LISTENING; + DECREASE_ACTIVE_COUNT(loop, handle); + if (handle->stream.serv.connection_cb) { + err = GET_REQ_SOCK_ERROR(req); + handle->stream.serv.connection_cb((uv_stream_t*)handle, + uv_translate_sys_error(err)); + } + } + } else if (REQ_SUCCESS(req) && + setsockopt(req->accept_socket, + SOL_SOCKET, + SO_UPDATE_ACCEPT_CONTEXT, + (char*)&handle->socket, + sizeof(handle->socket)) == 0) { + req->next_pending = handle->tcp.serv.pending_accepts; + handle->tcp.serv.pending_accepts = req; + + /* Accept and SO_UPDATE_ACCEPT_CONTEXT were successful. */ + if (handle->stream.serv.connection_cb) { + handle->stream.serv.connection_cb((uv_stream_t*)handle, 0); + } + } else { + /* Error related to accepted socket is ignored because the server */ + /* socket may still be healthy. If the server socket is broken */ + /* uv_queue_accept will detect it. */ + closesocket(req->accept_socket); + req->accept_socket = INVALID_SOCKET; + if (handle->flags & UV_HANDLE_LISTENING) { + uv_tcp_queue_accept(handle, req); + } + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle, + uv_connect_t* req) { + int err; + + assert(handle->type == UV_TCP); + + UNREGISTER_HANDLE_REQ(loop, handle, req); + + err = 0; + if (REQ_SUCCESS(req)) { + if (setsockopt(handle->socket, + SOL_SOCKET, + SO_UPDATE_CONNECT_CONTEXT, + NULL, + 0) == 0) { + uv_connection_init((uv_stream_t*)handle); + handle->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE; + loop->active_tcp_streams++; + } else { + err = WSAGetLastError(); + } + } else { + err = GET_REQ_SOCK_ERROR(req); + } + req->cb(req, uv_translate_sys_error(err)); + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +int uv_tcp_import(uv_tcp_t* tcp, uv__ipc_socket_info_ex* socket_info_ex, + int tcp_connection) { + int err; + SOCKET socket = WSASocketW(FROM_PROTOCOL_INFO, + FROM_PROTOCOL_INFO, + FROM_PROTOCOL_INFO, + &socket_info_ex->socket_info, + 0, + WSA_FLAG_OVERLAPPED); + + if (socket == INVALID_SOCKET) { + return WSAGetLastError(); + } + + err = uv_tcp_set_socket(tcp->loop, + tcp, + socket, + socket_info_ex->socket_info.iAddressFamily, + 1); + if (err) { + closesocket(socket); + return err; + } + + if (tcp_connection) { + uv_connection_init((uv_stream_t*)tcp); + tcp->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE; + } + + tcp->flags |= UV_HANDLE_BOUND; + tcp->flags |= UV_HANDLE_SHARED_TCP_SOCKET; + + tcp->delayed_error = socket_info_ex->delayed_error; + + tcp->loop->active_tcp_streams++; + return 0; +} + + +int uv_tcp_nodelay(uv_tcp_t* handle, int enable) { + int err; + + if (handle->socket != INVALID_SOCKET) { + err = uv__tcp_nodelay(handle, handle->socket, enable); + if (err) + return err; + } + + if (enable) { + handle->flags |= UV_HANDLE_TCP_NODELAY; + } else { + handle->flags &= ~UV_HANDLE_TCP_NODELAY; + } + + return 0; +} + + +int uv_tcp_keepalive(uv_tcp_t* handle, int enable, unsigned int delay) { + int err; + + if (handle->socket != INVALID_SOCKET) { + err = uv__tcp_keepalive(handle, handle->socket, enable, delay); + if (err) + return err; + } + + if (enable) { + handle->flags |= UV_HANDLE_TCP_KEEPALIVE; + } else { + handle->flags &= ~UV_HANDLE_TCP_KEEPALIVE; + } + + /* TODO: Store delay if handle->socket isn't created yet. */ + + return 0; +} + + +int uv_tcp_duplicate_socket(uv_tcp_t* handle, int pid, + LPWSAPROTOCOL_INFOW protocol_info) { + if (!(handle->flags & UV_HANDLE_CONNECTION)) { + /* + * We're about to share the socket with another process. Because + * this is a listening socket, we assume that the other process will + * be accepting connections on it. So, before sharing the socket + * with another process, we call listen here in the parent process. + */ + + if (!(handle->flags & UV_HANDLE_LISTENING)) { + if (!(handle->flags & UV_HANDLE_BOUND)) { + return ERROR_INVALID_PARAMETER; + } + + if (!(handle->delayed_error)) { + if (listen(handle->socket, SOMAXCONN) == SOCKET_ERROR) { + handle->delayed_error = WSAGetLastError(); + } + } + } + } + + if (WSADuplicateSocketW(handle->socket, pid, protocol_info)) { + return WSAGetLastError(); + } + + handle->flags |= UV_HANDLE_SHARED_TCP_SOCKET; + + return 0; +} + + +int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) { + if (handle->flags & UV_HANDLE_CONNECTION) { + return UV_EINVAL; + } + + /* Check if we're already in the desired mode. */ + if ((enable && !(handle->flags & UV_HANDLE_TCP_SINGLE_ACCEPT)) || + (!enable && handle->flags & UV_HANDLE_TCP_SINGLE_ACCEPT)) { + return 0; + } + + /* Don't allow switching from single pending accept to many. */ + if (enable) { + return UV_ENOTSUP; + } + + /* Check if we're in a middle of changing the number of pending accepts. */ + if (handle->flags & UV_HANDLE_TCP_ACCEPT_STATE_CHANGING) { + return 0; + } + + handle->flags |= UV_HANDLE_TCP_SINGLE_ACCEPT; + + /* Flip the changing flag if we have already queued multiple accepts. */ + if (handle->flags & UV_HANDLE_LISTENING) { + handle->flags |= UV_HANDLE_TCP_ACCEPT_STATE_CHANGING; + } + + return 0; +} + + +static int uv_tcp_try_cancel_io(uv_tcp_t* tcp) { + SOCKET socket = tcp->socket; + int non_ifs_lsp; + + /* Check if we have any non-IFS LSPs stacked on top of TCP */ + non_ifs_lsp = (tcp->flags & UV_HANDLE_IPV6) ? uv_tcp_non_ifs_lsp_ipv6 : + uv_tcp_non_ifs_lsp_ipv4; + + /* If there are non-ifs LSPs then try to obtain a base handle for the */ + /* socket. This will always fail on Windows XP/3k. */ + if (non_ifs_lsp) { + DWORD bytes; + if (WSAIoctl(socket, + SIO_BASE_HANDLE, + NULL, + 0, + &socket, + sizeof socket, + &bytes, + NULL, + NULL) != 0) { + /* Failed. We can't do CancelIo. */ + return -1; + } + } + + assert(socket != 0 && socket != INVALID_SOCKET); + + if (!CancelIo((HANDLE) socket)) { + return GetLastError(); + } + + /* It worked. */ + return 0; +} + + +void uv_tcp_close(uv_loop_t* loop, uv_tcp_t* tcp) { + int close_socket = 1; + + if (tcp->flags & UV_HANDLE_READ_PENDING) { + /* In order for winsock to do a graceful close there must not be any */ + /* any pending reads, or the socket must be shut down for writing */ + if (!(tcp->flags & UV_HANDLE_SHARED_TCP_SOCKET)) { + /* Just do shutdown on non-shared sockets, which ensures graceful close. */ + shutdown(tcp->socket, SD_SEND); + + } else if (uv_tcp_try_cancel_io(tcp) == 0) { + /* In case of a shared socket, we try to cancel all outstanding I/O, */ + /* If that works, don't close the socket yet - wait for the read req to */ + /* return and close the socket in uv_tcp_endgame. */ + close_socket = 0; + + } else { + /* When cancelling isn't possible - which could happen when an LSP is */ + /* present on an old Windows version, we will have to close the socket */ + /* with a read pending. That is not nice because trailing sent bytes */ + /* may not make it to the other side. */ + } + + } else if ((tcp->flags & UV_HANDLE_SHARED_TCP_SOCKET) && + tcp->tcp.serv.accept_reqs != NULL) { + /* Under normal circumstances closesocket() will ensure that all pending */ + /* accept reqs are canceled. However, when the socket is shared the */ + /* presence of another reference to the socket in another process will */ + /* keep the accept reqs going, so we have to ensure that these are */ + /* canceled. */ + if (uv_tcp_try_cancel_io(tcp) != 0) { + /* When cancellation is not possible, there is another option: we can */ + /* close the incoming sockets, which will also cancel the accept */ + /* operations. However this is not cool because we might inadvertently */ + /* close a socket that just accepted a new connection, which will */ + /* cause the connection to be aborted. */ + unsigned int i; + for (i = 0; i < uv_simultaneous_server_accepts; i++) { + uv_tcp_accept_t* req = &tcp->tcp.serv.accept_reqs[i]; + if (req->accept_socket != INVALID_SOCKET && + !HasOverlappedIoCompleted(&req->u.io.overlapped)) { + closesocket(req->accept_socket); + req->accept_socket = INVALID_SOCKET; + } + } + } + } + + if (tcp->flags & UV_HANDLE_READING) { + tcp->flags &= ~UV_HANDLE_READING; + DECREASE_ACTIVE_COUNT(loop, tcp); + } + + if (tcp->flags & UV_HANDLE_LISTENING) { + tcp->flags &= ~UV_HANDLE_LISTENING; + DECREASE_ACTIVE_COUNT(loop, tcp); + } + + if (close_socket) { + closesocket(tcp->socket); + tcp->socket = INVALID_SOCKET; + tcp->flags |= UV_HANDLE_TCP_SOCKET_CLOSED; + } + + tcp->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); + uv__handle_closing(tcp); + + if (tcp->reqs_pending == 0) { + uv_want_endgame(tcp->loop, (uv_handle_t*)tcp); + } +} + + +int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock) { + WSAPROTOCOL_INFOW protocol_info; + int opt_len; + int err; + + /* Detect the address family of the socket. */ + opt_len = (int) sizeof protocol_info; + if (getsockopt(sock, + SOL_SOCKET, + SO_PROTOCOL_INFOW, + (char*) &protocol_info, + &opt_len) == SOCKET_ERROR) { + return uv_translate_sys_error(GetLastError()); + } + + err = uv_tcp_set_socket(handle->loop, + handle, + sock, + protocol_info.iAddressFamily, + 1); + if (err) { + return uv_translate_sys_error(err); + } + + return 0; +} + + +/* This function is an egress point, i.e. it returns libuv errors rather than + * system errors. + */ +int uv__tcp_bind(uv_tcp_t* handle, + const struct sockaddr* addr, + unsigned int addrlen, + unsigned int flags) { + int err; + + err = uv_tcp_try_bind(handle, addr, addrlen, flags); + if (err) + return uv_translate_sys_error(err); + + return 0; +} + + +/* This function is an egress point, i.e. it returns libuv errors rather than + * system errors. + */ +int uv__tcp_connect(uv_connect_t* req, + uv_tcp_t* handle, + const struct sockaddr* addr, + unsigned int addrlen, + uv_connect_cb cb) { + int err; + + err = uv_tcp_try_connect(req, handle, addr, addrlen, cb); + if (err) + return uv_translate_sys_error(err); + + return 0; +} diff --git a/3rdparty/libuv/src/win/thread.c b/3rdparty/libuv/src/win/thread.c new file mode 100644 index 00000000000..91684e93875 --- /dev/null +++ b/3rdparty/libuv/src/win/thread.c @@ -0,0 +1,697 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include + +#include "uv.h" +#include "internal.h" + + +#define HAVE_CONDVAR_API() (pInitializeConditionVariable != NULL) + +static int uv_cond_fallback_init(uv_cond_t* cond); +static void uv_cond_fallback_destroy(uv_cond_t* cond); +static void uv_cond_fallback_signal(uv_cond_t* cond); +static void uv_cond_fallback_broadcast(uv_cond_t* cond); +static void uv_cond_fallback_wait(uv_cond_t* cond, uv_mutex_t* mutex); +static int uv_cond_fallback_timedwait(uv_cond_t* cond, + uv_mutex_t* mutex, uint64_t timeout); + +static int uv_cond_condvar_init(uv_cond_t* cond); +static void uv_cond_condvar_destroy(uv_cond_t* cond); +static void uv_cond_condvar_signal(uv_cond_t* cond); +static void uv_cond_condvar_broadcast(uv_cond_t* cond); +static void uv_cond_condvar_wait(uv_cond_t* cond, uv_mutex_t* mutex); +static int uv_cond_condvar_timedwait(uv_cond_t* cond, + uv_mutex_t* mutex, uint64_t timeout); + + +static void uv__once_inner(uv_once_t* guard, void (*callback)(void)) { + DWORD result; + HANDLE existing_event, created_event; + + created_event = CreateEvent(NULL, 1, 0, NULL); + if (created_event == 0) { + /* Could fail in a low-memory situation? */ + uv_fatal_error(GetLastError(), "CreateEvent"); + } + + existing_event = InterlockedCompareExchangePointer(&guard->event, + created_event, + NULL); + + if (existing_event == NULL) { + /* We won the race */ + callback(); + + result = SetEvent(created_event); + assert(result); + guard->ran = 1; + + } else { + /* We lost the race. Destroy the event we created and wait for the */ + /* existing one to become signaled. */ + CloseHandle(created_event); + result = WaitForSingleObject(existing_event, INFINITE); + assert(result == WAIT_OBJECT_0); + } +} + + +void uv_once(uv_once_t* guard, void (*callback)(void)) { + /* Fast case - avoid WaitForSingleObject. */ + if (guard->ran) { + return; + } + + uv__once_inner(guard, callback); +} + + +/* Verify that uv_thread_t can be stored in a TLS slot. */ +STATIC_ASSERT(sizeof(uv_thread_t) <= sizeof(void*)); + +static uv_key_t uv__current_thread_key; +static uv_once_t uv__current_thread_init_guard = UV_ONCE_INIT; + + +static void uv__init_current_thread_key(void) { + if (uv_key_create(&uv__current_thread_key)) + abort(); +} + + +struct thread_ctx { + void (*entry)(void* arg); + void* arg; + uv_thread_t self; +}; + + +static UINT __stdcall uv__thread_start(void* arg) { + struct thread_ctx *ctx_p; + struct thread_ctx ctx; + + ctx_p = arg; + ctx = *ctx_p; + uv__free(ctx_p); + + uv_once(&uv__current_thread_init_guard, uv__init_current_thread_key); + uv_key_set(&uv__current_thread_key, (void*) ctx.self); + + ctx.entry(ctx.arg); + + return 0; +} + + +int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) { + struct thread_ctx* ctx; + int err; + HANDLE thread; + + ctx = uv__malloc(sizeof(*ctx)); + if (ctx == NULL) + return UV_ENOMEM; + + ctx->entry = entry; + ctx->arg = arg; + + /* Create the thread in suspended state so we have a chance to pass + * its own creation handle to it */ + thread = (HANDLE) _beginthreadex(NULL, + 0, + uv__thread_start, + ctx, + CREATE_SUSPENDED, + NULL); + if (thread == NULL) { + err = errno; + uv__free(ctx); + } else { + err = 0; + *tid = thread; + ctx->self = thread; + ResumeThread(thread); + } + + switch (err) { + case 0: + return 0; + case EACCES: + return UV_EACCES; + case EAGAIN: + return UV_EAGAIN; + case EINVAL: + return UV_EINVAL; + } + + return UV_EIO; +} + + +uv_thread_t uv_thread_self(void) { + uv_once(&uv__current_thread_init_guard, uv__init_current_thread_key); + return (uv_thread_t) uv_key_get(&uv__current_thread_key); +} + + +int uv_thread_join(uv_thread_t *tid) { + if (WaitForSingleObject(*tid, INFINITE)) + return uv_translate_sys_error(GetLastError()); + else { + CloseHandle(*tid); + *tid = 0; + return 0; + } +} + + +int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2) { + return *t1 == *t2; +} + + +int uv_mutex_init(uv_mutex_t* mutex) { + InitializeCriticalSection(mutex); + return 0; +} + + +void uv_mutex_destroy(uv_mutex_t* mutex) { + DeleteCriticalSection(mutex); +} + + +void uv_mutex_lock(uv_mutex_t* mutex) { + EnterCriticalSection(mutex); +} + + +int uv_mutex_trylock(uv_mutex_t* mutex) { + if (TryEnterCriticalSection(mutex)) + return 0; + else + return UV_EBUSY; +} + + +void uv_mutex_unlock(uv_mutex_t* mutex) { + LeaveCriticalSection(mutex); +} + + +int uv_rwlock_init(uv_rwlock_t* rwlock) { + /* Initialize the semaphore that acts as the write lock. */ + HANDLE handle = CreateSemaphoreW(NULL, 1, 1, NULL); + if (handle == NULL) + return uv_translate_sys_error(GetLastError()); + rwlock->state_.write_semaphore_ = handle; + + /* Initialize the critical section protecting the reader count. */ + InitializeCriticalSection(&rwlock->state_.num_readers_lock_); + + /* Initialize the reader count. */ + rwlock->state_.num_readers_ = 0; + + return 0; +} + + +void uv_rwlock_destroy(uv_rwlock_t* rwlock) { + DeleteCriticalSection(&rwlock->state_.num_readers_lock_); + CloseHandle(rwlock->state_.write_semaphore_); +} + + +void uv_rwlock_rdlock(uv_rwlock_t* rwlock) { + /* Acquire the lock that protects the reader count. */ + EnterCriticalSection(&rwlock->state_.num_readers_lock_); + + /* Increase the reader count, and lock for write if this is the first + * reader. + */ + if (++rwlock->state_.num_readers_ == 1) { + DWORD r = WaitForSingleObject(rwlock->state_.write_semaphore_, INFINITE); + if (r != WAIT_OBJECT_0) + uv_fatal_error(GetLastError(), "WaitForSingleObject"); + } + + /* Release the lock that protects the reader count. */ + LeaveCriticalSection(&rwlock->state_.num_readers_lock_); +} + + +int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock) { + int err; + + if (!TryEnterCriticalSection(&rwlock->state_.num_readers_lock_)) + return UV_EBUSY; + + err = 0; + + if (rwlock->state_.num_readers_ == 0) { + /* Currently there are no other readers, which means that the write lock + * needs to be acquired. + */ + DWORD r = WaitForSingleObject(rwlock->state_.write_semaphore_, 0); + if (r == WAIT_OBJECT_0) + rwlock->state_.num_readers_++; + else if (r == WAIT_TIMEOUT) + err = UV_EBUSY; + else if (r == WAIT_FAILED) + uv_fatal_error(GetLastError(), "WaitForSingleObject"); + + } else { + /* The write lock has already been acquired because there are other + * active readers. + */ + rwlock->state_.num_readers_++; + } + + LeaveCriticalSection(&rwlock->state_.num_readers_lock_); + return err; +} + + +void uv_rwlock_rdunlock(uv_rwlock_t* rwlock) { + EnterCriticalSection(&rwlock->state_.num_readers_lock_); + + if (--rwlock->state_.num_readers_ == 0) { + if (!ReleaseSemaphore(rwlock->state_.write_semaphore_, 1, NULL)) + uv_fatal_error(GetLastError(), "ReleaseSemaphore"); + } + + LeaveCriticalSection(&rwlock->state_.num_readers_lock_); +} + + +void uv_rwlock_wrlock(uv_rwlock_t* rwlock) { + DWORD r = WaitForSingleObject(rwlock->state_.write_semaphore_, INFINITE); + if (r != WAIT_OBJECT_0) + uv_fatal_error(GetLastError(), "WaitForSingleObject"); +} + + +int uv_rwlock_trywrlock(uv_rwlock_t* rwlock) { + DWORD r = WaitForSingleObject(rwlock->state_.write_semaphore_, 0); + if (r == WAIT_OBJECT_0) + return 0; + else if (r == WAIT_TIMEOUT) + return UV_EBUSY; + else + uv_fatal_error(GetLastError(), "WaitForSingleObject"); +} + + +void uv_rwlock_wrunlock(uv_rwlock_t* rwlock) { + if (!ReleaseSemaphore(rwlock->state_.write_semaphore_, 1, NULL)) + uv_fatal_error(GetLastError(), "ReleaseSemaphore"); +} + + +int uv_sem_init(uv_sem_t* sem, unsigned int value) { + *sem = CreateSemaphore(NULL, value, INT_MAX, NULL); + if (*sem == NULL) + return uv_translate_sys_error(GetLastError()); + else + return 0; +} + + +void uv_sem_destroy(uv_sem_t* sem) { + if (!CloseHandle(*sem)) + abort(); +} + + +void uv_sem_post(uv_sem_t* sem) { + if (!ReleaseSemaphore(*sem, 1, NULL)) + abort(); +} + + +void uv_sem_wait(uv_sem_t* sem) { + if (WaitForSingleObject(*sem, INFINITE) != WAIT_OBJECT_0) + abort(); +} + + +int uv_sem_trywait(uv_sem_t* sem) { + DWORD r = WaitForSingleObject(*sem, 0); + + if (r == WAIT_OBJECT_0) + return 0; + + if (r == WAIT_TIMEOUT) + return UV_EAGAIN; + + abort(); + return -1; /* Satisfy the compiler. */ +} + + +/* This condition variable implementation is based on the SetEvent solution + * (section 3.2) at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html + * We could not use the SignalObjectAndWait solution (section 3.4) because + * it want the 2nd argument (type uv_mutex_t) of uv_cond_wait() and + * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs. + */ + +static int uv_cond_fallback_init(uv_cond_t* cond) { + int err; + + /* Initialize the count to 0. */ + cond->fallback.waiters_count = 0; + + InitializeCriticalSection(&cond->fallback.waiters_count_lock); + + /* Create an auto-reset event. */ + cond->fallback.signal_event = CreateEvent(NULL, /* no security */ + FALSE, /* auto-reset event */ + FALSE, /* non-signaled initially */ + NULL); /* unnamed */ + if (!cond->fallback.signal_event) { + err = GetLastError(); + goto error2; + } + + /* Create a manual-reset event. */ + cond->fallback.broadcast_event = CreateEvent(NULL, /* no security */ + TRUE, /* manual-reset */ + FALSE, /* non-signaled */ + NULL); /* unnamed */ + if (!cond->fallback.broadcast_event) { + err = GetLastError(); + goto error; + } + + return 0; + +error: + CloseHandle(cond->fallback.signal_event); +error2: + DeleteCriticalSection(&cond->fallback.waiters_count_lock); + return uv_translate_sys_error(err); +} + + +static int uv_cond_condvar_init(uv_cond_t* cond) { + pInitializeConditionVariable(&cond->cond_var); + return 0; +} + + +int uv_cond_init(uv_cond_t* cond) { + uv__once_init(); + + if (HAVE_CONDVAR_API()) + return uv_cond_condvar_init(cond); + else + return uv_cond_fallback_init(cond); +} + + +static void uv_cond_fallback_destroy(uv_cond_t* cond) { + if (!CloseHandle(cond->fallback.broadcast_event)) + abort(); + if (!CloseHandle(cond->fallback.signal_event)) + abort(); + DeleteCriticalSection(&cond->fallback.waiters_count_lock); +} + + +static void uv_cond_condvar_destroy(uv_cond_t* cond) { + /* nothing to do */ +} + + +void uv_cond_destroy(uv_cond_t* cond) { + if (HAVE_CONDVAR_API()) + uv_cond_condvar_destroy(cond); + else + uv_cond_fallback_destroy(cond); +} + + +static void uv_cond_fallback_signal(uv_cond_t* cond) { + int have_waiters; + + /* Avoid race conditions. */ + EnterCriticalSection(&cond->fallback.waiters_count_lock); + have_waiters = cond->fallback.waiters_count > 0; + LeaveCriticalSection(&cond->fallback.waiters_count_lock); + + if (have_waiters) + SetEvent(cond->fallback.signal_event); +} + + +static void uv_cond_condvar_signal(uv_cond_t* cond) { + pWakeConditionVariable(&cond->cond_var); +} + + +void uv_cond_signal(uv_cond_t* cond) { + if (HAVE_CONDVAR_API()) + uv_cond_condvar_signal(cond); + else + uv_cond_fallback_signal(cond); +} + + +static void uv_cond_fallback_broadcast(uv_cond_t* cond) { + int have_waiters; + + /* Avoid race conditions. */ + EnterCriticalSection(&cond->fallback.waiters_count_lock); + have_waiters = cond->fallback.waiters_count > 0; + LeaveCriticalSection(&cond->fallback.waiters_count_lock); + + if (have_waiters) + SetEvent(cond->fallback.broadcast_event); +} + + +static void uv_cond_condvar_broadcast(uv_cond_t* cond) { + pWakeAllConditionVariable(&cond->cond_var); +} + + +void uv_cond_broadcast(uv_cond_t* cond) { + if (HAVE_CONDVAR_API()) + uv_cond_condvar_broadcast(cond); + else + uv_cond_fallback_broadcast(cond); +} + + +static int uv_cond_wait_helper(uv_cond_t* cond, uv_mutex_t* mutex, + DWORD dwMilliseconds) { + DWORD result; + int last_waiter; + HANDLE handles[2] = { + cond->fallback.signal_event, + cond->fallback.broadcast_event + }; + + /* Avoid race conditions. */ + EnterCriticalSection(&cond->fallback.waiters_count_lock); + cond->fallback.waiters_count++; + LeaveCriticalSection(&cond->fallback.waiters_count_lock); + + /* It's ok to release the here since Win32 manual-reset events */ + /* maintain state when used with . This avoids the "lost wakeup" */ + /* bug. */ + uv_mutex_unlock(mutex); + + /* Wait for either event to become signaled due to being */ + /* called or being called. */ + result = WaitForMultipleObjects(2, handles, FALSE, dwMilliseconds); + + EnterCriticalSection(&cond->fallback.waiters_count_lock); + cond->fallback.waiters_count--; + last_waiter = result == WAIT_OBJECT_0 + 1 + && cond->fallback.waiters_count == 0; + LeaveCriticalSection(&cond->fallback.waiters_count_lock); + + /* Some thread called . */ + if (last_waiter) { + /* We're the last waiter to be notified or to stop waiting, so reset the */ + /* the manual-reset event. */ + ResetEvent(cond->fallback.broadcast_event); + } + + /* Reacquire the . */ + uv_mutex_lock(mutex); + + if (result == WAIT_OBJECT_0 || result == WAIT_OBJECT_0 + 1) + return 0; + + if (result == WAIT_TIMEOUT) + return UV_ETIMEDOUT; + + abort(); + return -1; /* Satisfy the compiler. */ +} + + +static void uv_cond_fallback_wait(uv_cond_t* cond, uv_mutex_t* mutex) { + if (uv_cond_wait_helper(cond, mutex, INFINITE)) + abort(); +} + + +static void uv_cond_condvar_wait(uv_cond_t* cond, uv_mutex_t* mutex) { + if (!pSleepConditionVariableCS(&cond->cond_var, mutex, INFINITE)) + abort(); +} + + +void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex) { + if (HAVE_CONDVAR_API()) + uv_cond_condvar_wait(cond, mutex); + else + uv_cond_fallback_wait(cond, mutex); +} + + +static int uv_cond_fallback_timedwait(uv_cond_t* cond, + uv_mutex_t* mutex, uint64_t timeout) { + return uv_cond_wait_helper(cond, mutex, (DWORD)(timeout / 1e6)); +} + + +static int uv_cond_condvar_timedwait(uv_cond_t* cond, + uv_mutex_t* mutex, uint64_t timeout) { + if (pSleepConditionVariableCS(&cond->cond_var, mutex, (DWORD)(timeout / 1e6))) + return 0; + if (GetLastError() != ERROR_TIMEOUT) + abort(); + return UV_ETIMEDOUT; +} + + +int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, + uint64_t timeout) { + if (HAVE_CONDVAR_API()) + return uv_cond_condvar_timedwait(cond, mutex, timeout); + else + return uv_cond_fallback_timedwait(cond, mutex, timeout); +} + + +int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) { + int err; + + barrier->n = count; + barrier->count = 0; + + err = uv_mutex_init(&barrier->mutex); + if (err) + return err; + + err = uv_sem_init(&barrier->turnstile1, 0); + if (err) + goto error2; + + err = uv_sem_init(&barrier->turnstile2, 1); + if (err) + goto error; + + return 0; + +error: + uv_sem_destroy(&barrier->turnstile1); +error2: + uv_mutex_destroy(&barrier->mutex); + return err; + +} + + +void uv_barrier_destroy(uv_barrier_t* barrier) { + uv_sem_destroy(&barrier->turnstile2); + uv_sem_destroy(&barrier->turnstile1); + uv_mutex_destroy(&barrier->mutex); +} + + +int uv_barrier_wait(uv_barrier_t* barrier) { + int serial_thread; + + uv_mutex_lock(&barrier->mutex); + if (++barrier->count == barrier->n) { + uv_sem_wait(&barrier->turnstile2); + uv_sem_post(&barrier->turnstile1); + } + uv_mutex_unlock(&barrier->mutex); + + uv_sem_wait(&barrier->turnstile1); + uv_sem_post(&barrier->turnstile1); + + uv_mutex_lock(&barrier->mutex); + serial_thread = (--barrier->count == 0); + if (serial_thread) { + uv_sem_wait(&barrier->turnstile1); + uv_sem_post(&barrier->turnstile2); + } + uv_mutex_unlock(&barrier->mutex); + + uv_sem_wait(&barrier->turnstile2); + uv_sem_post(&barrier->turnstile2); + return serial_thread; +} + + +int uv_key_create(uv_key_t* key) { + key->tls_index = TlsAlloc(); + if (key->tls_index == TLS_OUT_OF_INDEXES) + return UV_ENOMEM; + return 0; +} + + +void uv_key_delete(uv_key_t* key) { + if (TlsFree(key->tls_index) == FALSE) + abort(); + key->tls_index = TLS_OUT_OF_INDEXES; +} + + +void* uv_key_get(uv_key_t* key) { + void* value; + + value = TlsGetValue(key->tls_index); + if (value == NULL) + if (GetLastError() != ERROR_SUCCESS) + abort(); + + return value; +} + + +void uv_key_set(uv_key_t* key, void* value) { + if (TlsSetValue(key->tls_index, value) == FALSE) + abort(); +} diff --git a/3rdparty/libuv/src/win/timer.c b/3rdparty/libuv/src/win/timer.c new file mode 100644 index 00000000000..0da541a2c86 --- /dev/null +++ b/3rdparty/libuv/src/win/timer.c @@ -0,0 +1,200 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include + +#include "uv.h" +#include "internal.h" +#include "tree.h" +#include "handle-inl.h" + + +/* The number of milliseconds in one second. */ +#define UV__MILLISEC 1000 + + +void uv_update_time(uv_loop_t* loop) { + uint64_t new_time = uv__hrtime(UV__MILLISEC); + if (new_time > loop->time) { + loop->time = new_time; + } +} + +void uv__time_forward(uv_loop_t* loop, uint64_t msecs) { + loop->time += msecs; +} + + +static int uv_timer_compare(uv_timer_t* a, uv_timer_t* b) { + if (a->due < b->due) + return -1; + if (a->due > b->due) + return 1; + /* + * compare start_id when both has the same due. start_id is + * allocated with loop->timer_counter in uv_timer_start(). + */ + if (a->start_id < b->start_id) + return -1; + if (a->start_id > b->start_id) + return 1; + return 0; +} + + +RB_GENERATE_STATIC(uv_timer_tree_s, uv_timer_s, tree_entry, uv_timer_compare); + + +int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) { + uv__handle_init(loop, (uv_handle_t*) handle, UV_TIMER); + handle->timer_cb = NULL; + handle->repeat = 0; + + return 0; +} + + +void uv_timer_endgame(uv_loop_t* loop, uv_timer_t* handle) { + if (handle->flags & UV__HANDLE_CLOSING) { + assert(!(handle->flags & UV_HANDLE_CLOSED)); + uv__handle_close(handle); + } +} + + +static uint64_t get_clamped_due_time(uint64_t loop_time, uint64_t timeout) { + uint64_t clamped_timeout; + + clamped_timeout = loop_time + timeout; + if (clamped_timeout < timeout) + clamped_timeout = (uint64_t) -1; + + return clamped_timeout; +} + + +int uv_timer_start(uv_timer_t* handle, uv_timer_cb timer_cb, uint64_t timeout, + uint64_t repeat) { + uv_loop_t* loop = handle->loop; + uv_timer_t* old; + + if (timer_cb == NULL) + return UV_EINVAL; + + if (uv__is_active(handle)) + uv_timer_stop(handle); + + handle->timer_cb = timer_cb; + handle->due = get_clamped_due_time(loop->time, timeout); + handle->repeat = repeat; + uv__handle_start(handle); + + /* start_id is the second index to be compared in uv__timer_cmp() */ + handle->start_id = handle->loop->timer_counter++; + + old = RB_INSERT(uv_timer_tree_s, &loop->timers, handle); + assert(old == NULL); + + return 0; +} + + +int uv_timer_stop(uv_timer_t* handle) { + uv_loop_t* loop = handle->loop; + + if (!uv__is_active(handle)) + return 0; + + RB_REMOVE(uv_timer_tree_s, &loop->timers, handle); + uv__handle_stop(handle); + + return 0; +} + + +int uv_timer_again(uv_timer_t* handle) { + /* If timer_cb is NULL that means that the timer was never started. */ + if (!handle->timer_cb) { + return UV_EINVAL; + } + + if (handle->repeat) { + uv_timer_stop(handle); + uv_timer_start(handle, handle->timer_cb, handle->repeat, handle->repeat); + } + + return 0; +} + + +void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat) { + assert(handle->type == UV_TIMER); + handle->repeat = repeat; +} + + +uint64_t uv_timer_get_repeat(const uv_timer_t* handle) { + assert(handle->type == UV_TIMER); + return handle->repeat; +} + + +DWORD uv__next_timeout(const uv_loop_t* loop) { + uv_timer_t* timer; + int64_t delta; + + /* Check if there are any running timers + * Need to cast away const first, since RB_MIN doesn't know what we are + * going to do with this return value, it can't be marked const + */ + timer = RB_MIN(uv_timer_tree_s, &((uv_loop_t*)loop)->timers); + if (timer) { + delta = timer->due - loop->time; + if (delta >= UINT_MAX - 1) { + /* A timeout value of UINT_MAX means infinite, so that's no good. */ + return UINT_MAX - 1; + } else if (delta < 0) { + /* Negative timeout values are not allowed */ + return 0; + } else { + return (DWORD)delta; + } + } else { + /* No timers */ + return INFINITE; + } +} + + +void uv_process_timers(uv_loop_t* loop) { + uv_timer_t* timer; + + /* Call timer callbacks */ + for (timer = RB_MIN(uv_timer_tree_s, &loop->timers); + timer != NULL && timer->due <= loop->time; + timer = RB_MIN(uv_timer_tree_s, &loop->timers)) { + + uv_timer_stop(timer); + uv_timer_again(timer); + timer->timer_cb((uv_timer_t*) timer); + } +} diff --git a/3rdparty/libuv/src/win/tty.c b/3rdparty/libuv/src/win/tty.c new file mode 100644 index 00000000000..d87cc699097 --- /dev/null +++ b/3rdparty/libuv/src/win/tty.c @@ -0,0 +1,2084 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1600 +# include "stdint-msvc2008.h" +#else +# include +#endif + +#ifndef COMMON_LVB_REVERSE_VIDEO +# define COMMON_LVB_REVERSE_VIDEO 0x4000 +#endif + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "stream-inl.h" +#include "req-inl.h" + + +#define UNICODE_REPLACEMENT_CHARACTER (0xfffd) + +#define ANSI_NORMAL 0x00 +#define ANSI_ESCAPE_SEEN 0x02 +#define ANSI_CSI 0x04 +#define ANSI_ST_CONTROL 0x08 +#define ANSI_IGNORE 0x10 +#define ANSI_IN_ARG 0x20 +#define ANSI_IN_STRING 0x40 +#define ANSI_BACKSLASH_SEEN 0x80 + +#define MAX_INPUT_BUFFER_LENGTH 8192 + + +static void uv_tty_capture_initial_style(CONSOLE_SCREEN_BUFFER_INFO* info); +static void uv_tty_update_virtual_window(CONSOLE_SCREEN_BUFFER_INFO* info); + + +/* Null uv_buf_t */ +static const uv_buf_t uv_null_buf_ = { 0, NULL }; + + +/* + * The console virtual window. + * + * Normally cursor movement in windows is relative to the console screen buffer, + * e.g. the application is allowed to overwrite the 'history'. This is very + * inconvenient, it makes absolute cursor movement pretty useless. There is + * also the concept of 'client rect' which is defined by the actual size of + * the console window and the scroll position of the screen buffer, but it's + * very volatile because it changes when the user scrolls. + * + * To make cursor movement behave sensibly we define a virtual window to which + * cursor movement is confined. The virtual window is always as wide as the + * console screen buffer, but it's height is defined by the size of the + * console window. The top of the virtual window aligns with the position + * of the caret when the first stdout/err handle is created, unless that would + * mean that it would extend beyond the bottom of the screen buffer - in that + * that case it's located as far down as possible. + * + * When the user writes a long text or many newlines, such that the output + * reaches beyond the bottom of the virtual window, the virtual window is + * shifted downwards, but not resized. + * + * Since all tty i/o happens on the same console, this window is shared + * between all stdout/stderr handles. + */ + +static int uv_tty_virtual_offset = -1; +static int uv_tty_virtual_height = -1; +static int uv_tty_virtual_width = -1; + +static CRITICAL_SECTION uv_tty_output_lock; + +static HANDLE uv_tty_output_handle = INVALID_HANDLE_VALUE; + +static WORD uv_tty_default_text_attributes = + FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; + +static char uv_tty_default_fg_color = 7; +static char uv_tty_default_bg_color = 0; +static char uv_tty_default_fg_bright = 0; +static char uv_tty_default_bg_bright = 0; +static char uv_tty_default_inverse = 0; + + +void uv_console_init() { + InitializeCriticalSection(&uv_tty_output_lock); +} + + +int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) { + HANDLE handle; + CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info; + + handle = (HANDLE) uv__get_osfhandle(fd); + if (handle == INVALID_HANDLE_VALUE) + return UV_EBADF; + + if (fd <= 2) { + /* In order to avoid closing a stdio file descriptor 0-2, duplicate the + * underlying OS handle and forget about the original fd. + * We could also opt to use the original OS handle and just never close it, + * but then there would be no reliable way to cancel pending read operations + * upon close. + */ + if (!DuplicateHandle(INVALID_HANDLE_VALUE, + handle, + INVALID_HANDLE_VALUE, + &handle, + 0, + FALSE, + DUPLICATE_SAME_ACCESS)) + return uv_translate_sys_error(GetLastError()); + fd = -1; + } + + if (!readable) { + /* Obtain the screen buffer info with the output handle. */ + if (!GetConsoleScreenBufferInfo(handle, &screen_buffer_info)) { + return uv_translate_sys_error(GetLastError()); + } + + /* Obtain the the tty_output_lock because the virtual window state is */ + /* shared between all uv_tty_t handles. */ + EnterCriticalSection(&uv_tty_output_lock); + + /* Store the global tty output handle. This handle is used by TTY read */ + /* streams to update the virtual window when a CONSOLE_BUFFER_SIZE_EVENT */ + /* is received. */ + uv_tty_output_handle = handle; + + /* Remember the original console text attributes. */ + uv_tty_capture_initial_style(&screen_buffer_info); + + uv_tty_update_virtual_window(&screen_buffer_info); + + LeaveCriticalSection(&uv_tty_output_lock); + } + + + uv_stream_init(loop, (uv_stream_t*) tty, UV_TTY); + uv_connection_init((uv_stream_t*) tty); + + tty->handle = handle; + tty->u.fd = fd; + tty->reqs_pending = 0; + tty->flags |= UV_HANDLE_BOUND; + + if (readable) { + /* Initialize TTY input specific fields. */ + tty->flags |= UV_HANDLE_TTY_READABLE | UV_HANDLE_READABLE; + tty->tty.rd.read_line_handle = NULL; + tty->tty.rd.read_line_buffer = uv_null_buf_; + tty->tty.rd.read_raw_wait = NULL; + + /* Init keycode-to-vt100 mapper state. */ + tty->tty.rd.last_key_len = 0; + tty->tty.rd.last_key_offset = 0; + tty->tty.rd.last_utf16_high_surrogate = 0; + memset(&tty->tty.rd.last_input_record, 0, sizeof tty->tty.rd.last_input_record); + } else { + /* TTY output specific fields. */ + tty->flags |= UV_HANDLE_WRITABLE; + + /* Init utf8-to-utf16 conversion state. */ + tty->tty.wr.utf8_bytes_left = 0; + tty->tty.wr.utf8_codepoint = 0; + + /* Initialize eol conversion state */ + tty->tty.wr.previous_eol = 0; + + /* Init ANSI parser state. */ + tty->tty.wr.ansi_parser_state = ANSI_NORMAL; + } + + return 0; +} + + +/* Set the default console text attributes based on how the console was + * configured when libuv started. + */ +static void uv_tty_capture_initial_style(CONSOLE_SCREEN_BUFFER_INFO* info) { + static int style_captured = 0; + + /* Only do this once. + Assumption: Caller has acquired uv_tty_output_lock. */ + if (style_captured) + return; + + /* Save raw win32 attributes. */ + uv_tty_default_text_attributes = info->wAttributes; + + /* Convert black text on black background to use white text. */ + if (uv_tty_default_text_attributes == 0) + uv_tty_default_text_attributes = 7; + + /* Convert Win32 attributes to ANSI colors. */ + uv_tty_default_fg_color = 0; + uv_tty_default_bg_color = 0; + uv_tty_default_fg_bright = 0; + uv_tty_default_bg_bright = 0; + uv_tty_default_inverse = 0; + + if (uv_tty_default_text_attributes & FOREGROUND_RED) + uv_tty_default_fg_color |= 1; + + if (uv_tty_default_text_attributes & FOREGROUND_GREEN) + uv_tty_default_fg_color |= 2; + + if (uv_tty_default_text_attributes & FOREGROUND_BLUE) + uv_tty_default_fg_color |= 4; + + if (uv_tty_default_text_attributes & BACKGROUND_RED) + uv_tty_default_bg_color |= 1; + + if (uv_tty_default_text_attributes & BACKGROUND_GREEN) + uv_tty_default_bg_color |= 2; + + if (uv_tty_default_text_attributes & BACKGROUND_BLUE) + uv_tty_default_bg_color |= 4; + + if (uv_tty_default_text_attributes & FOREGROUND_INTENSITY) + uv_tty_default_fg_bright = 1; + + if (uv_tty_default_text_attributes & BACKGROUND_INTENSITY) + uv_tty_default_bg_bright = 1; + + if (uv_tty_default_text_attributes & COMMON_LVB_REVERSE_VIDEO) + uv_tty_default_inverse = 1; + + style_captured = 1; +} + + +int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { + DWORD flags; + unsigned char was_reading; + uv_alloc_cb alloc_cb; + uv_read_cb read_cb; + int err; + + if (!(tty->flags & UV_HANDLE_TTY_READABLE)) { + return UV_EINVAL; + } + + if (!!mode == !!(tty->flags & UV_HANDLE_TTY_RAW)) { + return 0; + } + + switch (mode) { + case UV_TTY_MODE_NORMAL: + flags = ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT; + break; + case UV_TTY_MODE_RAW: + flags = ENABLE_WINDOW_INPUT; + break; + case UV_TTY_MODE_IO: + return UV_ENOTSUP; + } + + if (!SetConsoleMode(tty->handle, flags)) { + return uv_translate_sys_error(GetLastError()); + } + + /* If currently reading, stop, and restart reading. */ + if (tty->flags & UV_HANDLE_READING) { + was_reading = 1; + alloc_cb = tty->alloc_cb; + read_cb = tty->read_cb; + + if (was_reading) { + err = uv_tty_read_stop(tty); + if (err) { + return uv_translate_sys_error(err); + } + } + } else { + was_reading = 0; + } + + /* Update flag. */ + tty->flags &= ~UV_HANDLE_TTY_RAW; + tty->flags |= mode ? UV_HANDLE_TTY_RAW : 0; + + /* If we just stopped reading, restart. */ + if (was_reading) { + err = uv_tty_read_start(tty, alloc_cb, read_cb); + if (err) { + return uv_translate_sys_error(err); + } + } + + return 0; +} + + +int uv_is_tty(uv_file file) { + DWORD result; + return GetConsoleMode((HANDLE) _get_osfhandle(file), &result) != 0; +} + + +int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) { + CONSOLE_SCREEN_BUFFER_INFO info; + + if (!GetConsoleScreenBufferInfo(tty->handle, &info)) { + return uv_translate_sys_error(GetLastError()); + } + + EnterCriticalSection(&uv_tty_output_lock); + uv_tty_update_virtual_window(&info); + LeaveCriticalSection(&uv_tty_output_lock); + + *width = uv_tty_virtual_width; + *height = uv_tty_virtual_height; + + return 0; +} + + +static void CALLBACK uv_tty_post_raw_read(void* data, BOOLEAN didTimeout) { + uv_loop_t* loop; + uv_tty_t* handle; + uv_req_t* req; + + assert(data); + assert(!didTimeout); + + req = (uv_req_t*) data; + handle = (uv_tty_t*) req->data; + loop = handle->loop; + + UnregisterWait(handle->tty.rd.read_raw_wait); + handle->tty.rd.read_raw_wait = NULL; + + SET_REQ_SUCCESS(req); + POST_COMPLETION_FOR_REQ(loop, req); +} + + +static void uv_tty_queue_read_raw(uv_loop_t* loop, uv_tty_t* handle) { + uv_read_t* req; + BOOL r; + + assert(handle->flags & UV_HANDLE_READING); + assert(!(handle->flags & UV_HANDLE_READ_PENDING)); + + assert(handle->handle && handle->handle != INVALID_HANDLE_VALUE); + + handle->tty.rd.read_line_buffer = uv_null_buf_; + + req = &handle->read_req; + memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); + + r = RegisterWaitForSingleObject(&handle->tty.rd.read_raw_wait, + handle->handle, + uv_tty_post_raw_read, + (void*) req, + INFINITE, + WT_EXECUTEINWAITTHREAD | WT_EXECUTEONLYONCE); + if (!r) { + handle->tty.rd.read_raw_wait = NULL; + SET_REQ_ERROR(req, GetLastError()); + uv_insert_pending_req(loop, (uv_req_t*)req); + } + + handle->flags |= UV_HANDLE_READ_PENDING; + handle->reqs_pending++; +} + + +static DWORD CALLBACK uv_tty_line_read_thread(void* data) { + uv_loop_t* loop; + uv_tty_t* handle; + uv_req_t* req; + DWORD bytes, read_bytes; + WCHAR utf16[MAX_INPUT_BUFFER_LENGTH / 3]; + DWORD chars, read_chars; + + assert(data); + + req = (uv_req_t*) data; + handle = (uv_tty_t*) req->data; + loop = handle->loop; + + assert(handle->tty.rd.read_line_buffer.base != NULL); + assert(handle->tty.rd.read_line_buffer.len > 0); + + /* ReadConsole can't handle big buffers. */ + if (handle->tty.rd.read_line_buffer.len < MAX_INPUT_BUFFER_LENGTH) { + bytes = handle->tty.rd.read_line_buffer.len; + } else { + bytes = MAX_INPUT_BUFFER_LENGTH; + } + + /* At last, unicode! */ + /* One utf-16 codeunit never takes more than 3 utf-8 codeunits to encode */ + chars = bytes / 3; + + if (ReadConsoleW(handle->tty.rd.read_line_handle, + (void*) utf16, + chars, + &read_chars, + NULL)) { + read_bytes = WideCharToMultiByte(CP_UTF8, + 0, + utf16, + read_chars, + handle->tty.rd.read_line_buffer.base, + bytes, + NULL, + NULL); + SET_REQ_SUCCESS(req); + req->u.io.overlapped.InternalHigh = read_bytes; + } else { + SET_REQ_ERROR(req, GetLastError()); + } + + POST_COMPLETION_FOR_REQ(loop, req); + return 0; +} + + +static void uv_tty_queue_read_line(uv_loop_t* loop, uv_tty_t* handle) { + uv_read_t* req; + BOOL r; + + assert(handle->flags & UV_HANDLE_READING); + assert(!(handle->flags & UV_HANDLE_READ_PENDING)); + assert(handle->handle && handle->handle != INVALID_HANDLE_VALUE); + + req = &handle->read_req; + memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); + + handle->alloc_cb((uv_handle_t*) handle, 8192, &handle->tty.rd.read_line_buffer); + if (handle->tty.rd.read_line_buffer.len == 0) { + handle->read_cb((uv_stream_t*) handle, + UV_ENOBUFS, + &handle->tty.rd.read_line_buffer); + return; + } + assert(handle->tty.rd.read_line_buffer.base != NULL); + + /* Duplicate the console handle, so if we want to cancel the read, we can */ + /* just close this handle duplicate. */ + if (handle->tty.rd.read_line_handle == NULL) { + HANDLE this_process = GetCurrentProcess(); + r = DuplicateHandle(this_process, + handle->handle, + this_process, + &handle->tty.rd.read_line_handle, + 0, + 0, + DUPLICATE_SAME_ACCESS); + if (!r) { + handle->tty.rd.read_line_handle = NULL; + SET_REQ_ERROR(req, GetLastError()); + uv_insert_pending_req(loop, (uv_req_t*)req); + goto out; + } + } + + r = QueueUserWorkItem(uv_tty_line_read_thread, + (void*) req, + WT_EXECUTELONGFUNCTION); + if (!r) { + SET_REQ_ERROR(req, GetLastError()); + uv_insert_pending_req(loop, (uv_req_t*)req); + } + + out: + handle->flags |= UV_HANDLE_READ_PENDING; + handle->reqs_pending++; +} + + +static void uv_tty_queue_read(uv_loop_t* loop, uv_tty_t* handle) { + if (handle->flags & UV_HANDLE_TTY_RAW) { + uv_tty_queue_read_raw(loop, handle); + } else { + uv_tty_queue_read_line(loop, handle); + } +} + + +static const char* get_vt100_fn_key(DWORD code, char shift, char ctrl, + size_t* len) { +#define VK_CASE(vk, normal_str, shift_str, ctrl_str, shift_ctrl_str) \ + case (vk): \ + if (shift && ctrl) { \ + *len = sizeof shift_ctrl_str; \ + return "\033" shift_ctrl_str; \ + } else if (shift) { \ + *len = sizeof shift_str ; \ + return "\033" shift_str; \ + } else if (ctrl) { \ + *len = sizeof ctrl_str; \ + return "\033" ctrl_str; \ + } else { \ + *len = sizeof normal_str; \ + return "\033" normal_str; \ + } + + switch (code) { + /* These mappings are the same as Cygwin's. Unmodified and alt-modified */ + /* keypad keys comply with linux console, modifiers comply with xterm */ + /* modifier usage. F1..f12 and shift-f1..f10 comply with linux console, */ + /* f6..f12 with and without modifiers comply with rxvt. */ + VK_CASE(VK_INSERT, "[2~", "[2;2~", "[2;5~", "[2;6~") + VK_CASE(VK_END, "[4~", "[4;2~", "[4;5~", "[4;6~") + VK_CASE(VK_DOWN, "[B", "[1;2B", "[1;5B", "[1;6B") + VK_CASE(VK_NEXT, "[6~", "[6;2~", "[6;5~", "[6;6~") + VK_CASE(VK_LEFT, "[D", "[1;2D", "[1;5D", "[1;6D") + VK_CASE(VK_CLEAR, "[G", "[1;2G", "[1;5G", "[1;6G") + VK_CASE(VK_RIGHT, "[C", "[1;2C", "[1;5C", "[1;6C") + VK_CASE(VK_UP, "[A", "[1;2A", "[1;5A", "[1;6A") + VK_CASE(VK_HOME, "[1~", "[1;2~", "[1;5~", "[1;6~") + VK_CASE(VK_PRIOR, "[5~", "[5;2~", "[5;5~", "[5;6~") + VK_CASE(VK_DELETE, "[3~", "[3;2~", "[3;5~", "[3;6~") + VK_CASE(VK_NUMPAD0, "[2~", "[2;2~", "[2;5~", "[2;6~") + VK_CASE(VK_NUMPAD1, "[4~", "[4;2~", "[4;5~", "[4;6~") + VK_CASE(VK_NUMPAD2, "[B", "[1;2B", "[1;5B", "[1;6B") + VK_CASE(VK_NUMPAD3, "[6~", "[6;2~", "[6;5~", "[6;6~") + VK_CASE(VK_NUMPAD4, "[D", "[1;2D", "[1;5D", "[1;6D") + VK_CASE(VK_NUMPAD5, "[G", "[1;2G", "[1;5G", "[1;6G") + VK_CASE(VK_NUMPAD6, "[C", "[1;2C", "[1;5C", "[1;6C") + VK_CASE(VK_NUMPAD7, "[A", "[1;2A", "[1;5A", "[1;6A") + VK_CASE(VK_NUMPAD8, "[1~", "[1;2~", "[1;5~", "[1;6~") + VK_CASE(VK_NUMPAD9, "[5~", "[5;2~", "[5;5~", "[5;6~") + VK_CASE(VK_DECIMAL, "[3~", "[3;2~", "[3;5~", "[3;6~") + VK_CASE(VK_F1, "[[A", "[23~", "[11^", "[23^" ) + VK_CASE(VK_F2, "[[B", "[24~", "[12^", "[24^" ) + VK_CASE(VK_F3, "[[C", "[25~", "[13^", "[25^" ) + VK_CASE(VK_F4, "[[D", "[26~", "[14^", "[26^" ) + VK_CASE(VK_F5, "[[E", "[28~", "[15^", "[28^" ) + VK_CASE(VK_F6, "[17~", "[29~", "[17^", "[29^" ) + VK_CASE(VK_F7, "[18~", "[31~", "[18^", "[31^" ) + VK_CASE(VK_F8, "[19~", "[32~", "[19^", "[32^" ) + VK_CASE(VK_F9, "[20~", "[33~", "[20^", "[33^" ) + VK_CASE(VK_F10, "[21~", "[34~", "[21^", "[34^" ) + VK_CASE(VK_F11, "[23~", "[23$", "[23^", "[23@" ) + VK_CASE(VK_F12, "[24~", "[24$", "[24^", "[24@" ) + + default: + *len = 0; + return NULL; + } +#undef VK_CASE +} + + +void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, + uv_req_t* req) { + /* Shortcut for handle->tty.rd.last_input_record.Event.KeyEvent. */ +#define KEV handle->tty.rd.last_input_record.Event.KeyEvent + + DWORD records_left, records_read; + uv_buf_t buf; + off_t buf_used; + + assert(handle->type == UV_TTY); + assert(handle->flags & UV_HANDLE_TTY_READABLE); + handle->flags &= ~UV_HANDLE_READ_PENDING; + + if (!(handle->flags & UV_HANDLE_READING) || + !(handle->flags & UV_HANDLE_TTY_RAW)) { + goto out; + } + + if (!REQ_SUCCESS(req)) { + /* An error occurred while waiting for the event. */ + if ((handle->flags & UV_HANDLE_READING)) { + handle->flags &= ~UV_HANDLE_READING; + handle->read_cb((uv_stream_t*)handle, + uv_translate_sys_error(GET_REQ_ERROR(req)), + &uv_null_buf_); + } + goto out; + } + + /* Fetch the number of events */ + if (!GetNumberOfConsoleInputEvents(handle->handle, &records_left)) { + handle->flags &= ~UV_HANDLE_READING; + DECREASE_ACTIVE_COUNT(loop, handle); + handle->read_cb((uv_stream_t*)handle, + uv_translate_sys_error(GetLastError()), + &uv_null_buf_); + goto out; + } + + /* Windows sends a lot of events that we're not interested in, so buf */ + /* will be allocated on demand, when there's actually something to emit. */ + buf = uv_null_buf_; + buf_used = 0; + + while ((records_left > 0 || handle->tty.rd.last_key_len > 0) && + (handle->flags & UV_HANDLE_READING)) { + if (handle->tty.rd.last_key_len == 0) { + /* Read the next input record */ + if (!ReadConsoleInputW(handle->handle, + &handle->tty.rd.last_input_record, + 1, + &records_read)) { + handle->flags &= ~UV_HANDLE_READING; + DECREASE_ACTIVE_COUNT(loop, handle); + handle->read_cb((uv_stream_t*) handle, + uv_translate_sys_error(GetLastError()), + &buf); + goto out; + } + records_left--; + + /* If the window was resized, recompute the virtual window size. This */ + /* will trigger a SIGWINCH signal if the window size changed in an */ + /* way that matters to libuv. */ + if (handle->tty.rd.last_input_record.EventType == WINDOW_BUFFER_SIZE_EVENT) { + CONSOLE_SCREEN_BUFFER_INFO info; + + EnterCriticalSection(&uv_tty_output_lock); + + if (uv_tty_output_handle != INVALID_HANDLE_VALUE && + GetConsoleScreenBufferInfo(uv_tty_output_handle, &info)) { + uv_tty_update_virtual_window(&info); + } + + LeaveCriticalSection(&uv_tty_output_lock); + + continue; + } + + /* Ignore other events that are not key or resize events. */ + if (handle->tty.rd.last_input_record.EventType != KEY_EVENT) { + continue; + } + + /* Ignore keyup events, unless the left alt key was held and a valid */ + /* unicode character was emitted. */ + if (!KEV.bKeyDown && !(((KEV.dwControlKeyState & LEFT_ALT_PRESSED) || + KEV.wVirtualKeyCode==VK_MENU) && KEV.uChar.UnicodeChar != 0)) { + continue; + } + + /* Ignore keypresses to numpad number keys if the left alt is held */ + /* because the user is composing a character, or windows simulating */ + /* this. */ + if ((KEV.dwControlKeyState & LEFT_ALT_PRESSED) && + !(KEV.dwControlKeyState & ENHANCED_KEY) && + (KEV.wVirtualKeyCode == VK_INSERT || + KEV.wVirtualKeyCode == VK_END || + KEV.wVirtualKeyCode == VK_DOWN || + KEV.wVirtualKeyCode == VK_NEXT || + KEV.wVirtualKeyCode == VK_LEFT || + KEV.wVirtualKeyCode == VK_CLEAR || + KEV.wVirtualKeyCode == VK_RIGHT || + KEV.wVirtualKeyCode == VK_HOME || + KEV.wVirtualKeyCode == VK_UP || + KEV.wVirtualKeyCode == VK_PRIOR || + KEV.wVirtualKeyCode == VK_NUMPAD0 || + KEV.wVirtualKeyCode == VK_NUMPAD1 || + KEV.wVirtualKeyCode == VK_NUMPAD2 || + KEV.wVirtualKeyCode == VK_NUMPAD3 || + KEV.wVirtualKeyCode == VK_NUMPAD4 || + KEV.wVirtualKeyCode == VK_NUMPAD5 || + KEV.wVirtualKeyCode == VK_NUMPAD6 || + KEV.wVirtualKeyCode == VK_NUMPAD7 || + KEV.wVirtualKeyCode == VK_NUMPAD8 || + KEV.wVirtualKeyCode == VK_NUMPAD9)) { + continue; + } + + if (KEV.uChar.UnicodeChar != 0) { + int prefix_len, char_len; + + /* Character key pressed */ + if (KEV.uChar.UnicodeChar >= 0xD800 && + KEV.uChar.UnicodeChar < 0xDC00) { + /* UTF-16 high surrogate */ + handle->tty.rd.last_utf16_high_surrogate = KEV.uChar.UnicodeChar; + continue; + } + + /* Prefix with \u033 if alt was held, but alt was not used as part */ + /* a compose sequence. */ + if ((KEV.dwControlKeyState & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) + && !(KEV.dwControlKeyState & (LEFT_CTRL_PRESSED | + RIGHT_CTRL_PRESSED)) && KEV.bKeyDown) { + handle->tty.rd.last_key[0] = '\033'; + prefix_len = 1; + } else { + prefix_len = 0; + } + + if (KEV.uChar.UnicodeChar >= 0xDC00 && + KEV.uChar.UnicodeChar < 0xE000) { + /* UTF-16 surrogate pair */ + WCHAR utf16_buffer[2] = { handle->tty.rd.last_utf16_high_surrogate, + KEV.uChar.UnicodeChar}; + char_len = WideCharToMultiByte(CP_UTF8, + 0, + utf16_buffer, + 2, + &handle->tty.rd.last_key[prefix_len], + sizeof handle->tty.rd.last_key, + NULL, + NULL); + } else { + /* Single UTF-16 character */ + char_len = WideCharToMultiByte(CP_UTF8, + 0, + &KEV.uChar.UnicodeChar, + 1, + &handle->tty.rd.last_key[prefix_len], + sizeof handle->tty.rd.last_key, + NULL, + NULL); + } + + /* Whatever happened, the last character wasn't a high surrogate. */ + handle->tty.rd.last_utf16_high_surrogate = 0; + + /* If the utf16 character(s) couldn't be converted something must */ + /* be wrong. */ + if (!char_len) { + handle->flags &= ~UV_HANDLE_READING; + DECREASE_ACTIVE_COUNT(loop, handle); + handle->read_cb((uv_stream_t*) handle, + uv_translate_sys_error(GetLastError()), + &buf); + goto out; + } + + handle->tty.rd.last_key_len = (unsigned char) (prefix_len + char_len); + handle->tty.rd.last_key_offset = 0; + continue; + + } else { + /* Function key pressed */ + const char* vt100; + size_t prefix_len, vt100_len; + + vt100 = get_vt100_fn_key(KEV.wVirtualKeyCode, + !!(KEV.dwControlKeyState & SHIFT_PRESSED), + !!(KEV.dwControlKeyState & ( + LEFT_CTRL_PRESSED | + RIGHT_CTRL_PRESSED)), + &vt100_len); + + /* If we were unable to map to a vt100 sequence, just ignore. */ + if (!vt100) { + continue; + } + + /* Prefix with \x033 when the alt key was held. */ + if (KEV.dwControlKeyState & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) { + handle->tty.rd.last_key[0] = '\033'; + prefix_len = 1; + } else { + prefix_len = 0; + } + + /* Copy the vt100 sequence to the handle buffer. */ + assert(prefix_len + vt100_len < sizeof handle->tty.rd.last_key); + memcpy(&handle->tty.rd.last_key[prefix_len], vt100, vt100_len); + + handle->tty.rd.last_key_len = (unsigned char) (prefix_len + vt100_len); + handle->tty.rd.last_key_offset = 0; + continue; + } + } else { + /* Copy any bytes left from the last keypress to the user buffer. */ + if (handle->tty.rd.last_key_offset < handle->tty.rd.last_key_len) { + /* Allocate a buffer if needed */ + if (buf_used == 0) { + handle->alloc_cb((uv_handle_t*) handle, 1024, &buf); + if (buf.len == 0) { + handle->read_cb((uv_stream_t*) handle, UV_ENOBUFS, &buf); + goto out; + } + assert(buf.base != NULL); + } + + buf.base[buf_used++] = handle->tty.rd.last_key[handle->tty.rd.last_key_offset++]; + + /* If the buffer is full, emit it */ + if ((size_t) buf_used == buf.len) { + handle->read_cb((uv_stream_t*) handle, buf_used, &buf); + buf = uv_null_buf_; + buf_used = 0; + } + + continue; + } + + /* Apply dwRepeat from the last input record. */ + if (--KEV.wRepeatCount > 0) { + handle->tty.rd.last_key_offset = 0; + continue; + } + + handle->tty.rd.last_key_len = 0; + continue; + } + } + + /* Send the buffer back to the user */ + if (buf_used > 0) { + handle->read_cb((uv_stream_t*) handle, buf_used, &buf); + } + + out: + /* Wait for more input events. */ + if ((handle->flags & UV_HANDLE_READING) && + !(handle->flags & UV_HANDLE_READ_PENDING)) { + uv_tty_queue_read(loop, handle); + } + + DECREASE_PENDING_REQ_COUNT(handle); + +#undef KEV +} + + + +void uv_process_tty_read_line_req(uv_loop_t* loop, uv_tty_t* handle, + uv_req_t* req) { + uv_buf_t buf; + + assert(handle->type == UV_TTY); + assert(handle->flags & UV_HANDLE_TTY_READABLE); + + buf = handle->tty.rd.read_line_buffer; + + handle->flags &= ~UV_HANDLE_READ_PENDING; + handle->tty.rd.read_line_buffer = uv_null_buf_; + + if (!REQ_SUCCESS(req)) { + /* Read was not successful */ + if ((handle->flags & UV_HANDLE_READING) && + handle->tty.rd.read_line_handle != NULL) { + /* Real error */ + handle->flags &= ~UV_HANDLE_READING; + DECREASE_ACTIVE_COUNT(loop, handle); + handle->read_cb((uv_stream_t*) handle, + uv_translate_sys_error(GET_REQ_ERROR(req)), + &buf); + } else { + /* The read was cancelled, or whatever we don't care */ + handle->read_cb((uv_stream_t*) handle, 0, &buf); + } + + } else { + /* Read successful */ + /* TODO: read unicode, convert to utf-8 */ + DWORD bytes = req->u.io.overlapped.InternalHigh; + handle->read_cb((uv_stream_t*) handle, bytes, &buf); + } + + /* Wait for more input events. */ + if ((handle->flags & UV_HANDLE_READING) && + !(handle->flags & UV_HANDLE_READ_PENDING)) { + uv_tty_queue_read(loop, handle); + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +void uv_process_tty_read_req(uv_loop_t* loop, uv_tty_t* handle, + uv_req_t* req) { + assert(handle->type == UV_TTY); + assert(handle->flags & UV_HANDLE_TTY_READABLE); + + /* If the read_line_buffer member is zero, it must have been an raw read. */ + /* Otherwise it was a line-buffered read. */ + /* FIXME: This is quite obscure. Use a flag or something. */ + if (handle->tty.rd.read_line_buffer.len == 0) { + uv_process_tty_read_raw_req(loop, handle, req); + } else { + uv_process_tty_read_line_req(loop, handle, req); + } +} + + +int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb, + uv_read_cb read_cb) { + uv_loop_t* loop = handle->loop; + + if (!(handle->flags & UV_HANDLE_TTY_READABLE)) { + return ERROR_INVALID_PARAMETER; + } + + handle->flags |= UV_HANDLE_READING; + INCREASE_ACTIVE_COUNT(loop, handle); + handle->read_cb = read_cb; + handle->alloc_cb = alloc_cb; + + /* If reading was stopped and then started again, there could still be a */ + /* read request pending. */ + if (handle->flags & UV_HANDLE_READ_PENDING) { + return 0; + } + + /* Maybe the user stopped reading half-way while processing key events. */ + /* Short-circuit if this could be the case. */ + if (handle->tty.rd.last_key_len > 0) { + SET_REQ_SUCCESS(&handle->read_req); + uv_insert_pending_req(handle->loop, (uv_req_t*) &handle->read_req); + return 0; + } + + uv_tty_queue_read(loop, handle); + + return 0; +} + + +int uv_tty_read_stop(uv_tty_t* handle) { + handle->flags &= ~UV_HANDLE_READING; + DECREASE_ACTIVE_COUNT(handle->loop, handle); + + /* Cancel raw read */ + if ((handle->flags & UV_HANDLE_READ_PENDING) && + (handle->flags & UV_HANDLE_TTY_RAW)) { + /* Write some bullshit event to force the console wait to return. */ + INPUT_RECORD record; + DWORD written; + memset(&record, 0, sizeof record); + if (!WriteConsoleInputW(handle->handle, &record, 1, &written)) { + return GetLastError(); + } + } + + /* Cancel line-buffered read */ + if (handle->tty.rd.read_line_handle != NULL) { + /* Closing this handle will cancel the ReadConsole operation */ + CloseHandle(handle->tty.rd.read_line_handle); + handle->tty.rd.read_line_handle = NULL; + } + + + return 0; +} + + +static void uv_tty_update_virtual_window(CONSOLE_SCREEN_BUFFER_INFO* info) { + int old_virtual_width = uv_tty_virtual_width; + int old_virtual_height = uv_tty_virtual_height; + + uv_tty_virtual_width = info->dwSize.X; + uv_tty_virtual_height = info->srWindow.Bottom - info->srWindow.Top + 1; + + /* Recompute virtual window offset row. */ + if (uv_tty_virtual_offset == -1) { + uv_tty_virtual_offset = info->dwCursorPosition.Y; + } else if (uv_tty_virtual_offset < info->dwCursorPosition.Y - + uv_tty_virtual_height + 1) { + /* If suddenly find the cursor outside of the virtual window, it must */ + /* have somehow scrolled. Update the virtual window offset. */ + uv_tty_virtual_offset = info->dwCursorPosition.Y - + uv_tty_virtual_height + 1; + } + if (uv_tty_virtual_offset + uv_tty_virtual_height > info->dwSize.Y) { + uv_tty_virtual_offset = info->dwSize.Y - uv_tty_virtual_height; + } + if (uv_tty_virtual_offset < 0) { + uv_tty_virtual_offset = 0; + } + + /* If the virtual window size changed, emit a SIGWINCH signal. Don't emit */ + /* if this was the first time the virtual window size was computed. */ + if (old_virtual_width != -1 && old_virtual_height != -1 && + (uv_tty_virtual_width != old_virtual_width || + uv_tty_virtual_height != old_virtual_height)) { + uv__signal_dispatch(SIGWINCH); + } +} + + +static COORD uv_tty_make_real_coord(uv_tty_t* handle, + CONSOLE_SCREEN_BUFFER_INFO* info, int x, unsigned char x_relative, int y, + unsigned char y_relative) { + COORD result; + + uv_tty_update_virtual_window(info); + + /* Adjust y position */ + if (y_relative) { + y = info->dwCursorPosition.Y + y; + } else { + y = uv_tty_virtual_offset + y; + } + /* Clip y to virtual client rectangle */ + if (y < uv_tty_virtual_offset) { + y = uv_tty_virtual_offset; + } else if (y >= uv_tty_virtual_offset + uv_tty_virtual_height) { + y = uv_tty_virtual_offset + uv_tty_virtual_height - 1; + } + + /* Adjust x */ + if (x_relative) { + x = info->dwCursorPosition.X + x; + } + /* Clip x */ + if (x < 0) { + x = 0; + } else if (x >= uv_tty_virtual_width) { + x = uv_tty_virtual_width - 1; + } + + result.X = (unsigned short) x; + result.Y = (unsigned short) y; + return result; +} + + +static int uv_tty_emit_text(uv_tty_t* handle, WCHAR buffer[], DWORD length, + DWORD* error) { + DWORD written; + + if (*error != ERROR_SUCCESS) { + return -1; + } + + if (!WriteConsoleW(handle->handle, + (void*) buffer, + length, + &written, + NULL)) { + *error = GetLastError(); + return -1; + } + + return 0; +} + + +static int uv_tty_move_caret(uv_tty_t* handle, int x, unsigned char x_relative, + int y, unsigned char y_relative, DWORD* error) { + CONSOLE_SCREEN_BUFFER_INFO info; + COORD pos; + + if (*error != ERROR_SUCCESS) { + return -1; + } + + retry: + if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { + *error = GetLastError(); + } + + pos = uv_tty_make_real_coord(handle, &info, x, x_relative, y, y_relative); + + if (!SetConsoleCursorPosition(handle->handle, pos)) { + if (GetLastError() == ERROR_INVALID_PARAMETER) { + /* The console may be resized - retry */ + goto retry; + } else { + *error = GetLastError(); + return -1; + } + } + + return 0; +} + + +static int uv_tty_reset(uv_tty_t* handle, DWORD* error) { + const COORD origin = {0, 0}; + const WORD char_attrs = uv_tty_default_text_attributes; + CONSOLE_SCREEN_BUFFER_INFO info; + DWORD count, written; + + if (*error != ERROR_SUCCESS) { + return -1; + } + + /* Reset original text attributes. */ + if (!SetConsoleTextAttribute(handle->handle, char_attrs)) { + *error = GetLastError(); + return -1; + } + + /* Move the cursor position to (0, 0). */ + if (!SetConsoleCursorPosition(handle->handle, origin)) { + *error = GetLastError(); + return -1; + } + + /* Clear the screen buffer. */ + retry: + if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { + *error = GetLastError(); + return -1; + } + + count = info.dwSize.X * info.dwSize.Y; + + if (!(FillConsoleOutputCharacterW(handle->handle, + L'\x20', + count, + origin, + &written) && + FillConsoleOutputAttribute(handle->handle, + char_attrs, + written, + origin, + &written))) { + if (GetLastError() == ERROR_INVALID_PARAMETER) { + /* The console may be resized - retry */ + goto retry; + } else { + *error = GetLastError(); + return -1; + } + } + + /* Move the virtual window up to the top. */ + uv_tty_virtual_offset = 0; + uv_tty_update_virtual_window(&info); + + return 0; +} + + +static int uv_tty_clear(uv_tty_t* handle, int dir, char entire_screen, + DWORD* error) { + CONSOLE_SCREEN_BUFFER_INFO info; + COORD start, end; + DWORD count, written; + + int x1, x2, y1, y2; + int x1r, x2r, y1r, y2r; + + if (*error != ERROR_SUCCESS) { + return -1; + } + + if (dir == 0) { + /* Clear from current position */ + x1 = 0; + x1r = 1; + } else { + /* Clear from column 0 */ + x1 = 0; + x1r = 0; + } + + if (dir == 1) { + /* Clear to current position */ + x2 = 0; + x2r = 1; + } else { + /* Clear to end of row. We pretend the console is 65536 characters wide, */ + /* uv_tty_make_real_coord will clip it to the actual console width. */ + x2 = 0xffff; + x2r = 0; + } + + if (!entire_screen) { + /* Stay on our own row */ + y1 = y2 = 0; + y1r = y2r = 1; + } else { + /* Apply columns direction to row */ + y1 = x1; + y1r = x1r; + y2 = x2; + y2r = x2r; + } + + retry: + if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { + *error = GetLastError(); + return -1; + } + + start = uv_tty_make_real_coord(handle, &info, x1, x1r, y1, y1r); + end = uv_tty_make_real_coord(handle, &info, x2, x2r, y2, y2r); + count = (end.Y * info.dwSize.X + end.X) - + (start.Y * info.dwSize.X + start.X) + 1; + + if (!(FillConsoleOutputCharacterW(handle->handle, + L'\x20', + count, + start, + &written) && + FillConsoleOutputAttribute(handle->handle, + info.wAttributes, + written, + start, + &written))) { + if (GetLastError() == ERROR_INVALID_PARAMETER) { + /* The console may be resized - retry */ + goto retry; + } else { + *error = GetLastError(); + return -1; + } + } + + return 0; +} + +#define FLIP_FGBG \ + do { \ + WORD fg = info.wAttributes & 0xF; \ + WORD bg = info.wAttributes & 0xF0; \ + info.wAttributes &= 0xFF00; \ + info.wAttributes |= fg << 4; \ + info.wAttributes |= bg >> 4; \ + } while (0) + +static int uv_tty_set_style(uv_tty_t* handle, DWORD* error) { + unsigned short argc = handle->tty.wr.ansi_csi_argc; + unsigned short* argv = handle->tty.wr.ansi_csi_argv; + int i; + CONSOLE_SCREEN_BUFFER_INFO info; + + char fg_color = -1, bg_color = -1; + char fg_bright = -1, bg_bright = -1; + char inverse = -1; + + if (argc == 0) { + /* Reset mode */ + fg_color = uv_tty_default_fg_color; + bg_color = uv_tty_default_bg_color; + fg_bright = uv_tty_default_fg_bright; + bg_bright = uv_tty_default_bg_bright; + inverse = uv_tty_default_inverse; + } + + for (i = 0; i < argc; i++) { + short arg = argv[i]; + + if (arg == 0) { + /* Reset mode */ + fg_color = uv_tty_default_fg_color; + bg_color = uv_tty_default_bg_color; + fg_bright = uv_tty_default_fg_bright; + bg_bright = uv_tty_default_bg_bright; + inverse = uv_tty_default_inverse; + + } else if (arg == 1) { + /* Foreground bright on */ + fg_bright = 1; + + } else if (arg == 2) { + /* Both bright off */ + fg_bright = 0; + bg_bright = 0; + + } else if (arg == 5) { + /* Background bright on */ + bg_bright = 1; + + } else if (arg == 7) { + /* Inverse: on */ + inverse = 1; + + } else if (arg == 21 || arg == 22) { + /* Foreground bright off */ + fg_bright = 0; + + } else if (arg == 25) { + /* Background bright off */ + bg_bright = 0; + + } else if (arg == 27) { + /* Inverse: off */ + inverse = 0; + + } else if (arg >= 30 && arg <= 37) { + /* Set foreground color */ + fg_color = arg - 30; + + } else if (arg == 39) { + /* Default text color */ + fg_color = uv_tty_default_fg_color; + fg_bright = uv_tty_default_fg_bright; + + } else if (arg >= 40 && arg <= 47) { + /* Set background color */ + bg_color = arg - 40; + + } else if (arg == 49) { + /* Default background color */ + bg_color = uv_tty_default_bg_color; + bg_bright = uv_tty_default_bg_bright; + + } else if (arg >= 90 && arg <= 97) { + /* Set bold foreground color */ + fg_bright = 1; + fg_color = arg - 90; + + } else if (arg >= 100 && arg <= 107) { + /* Set bold background color */ + bg_bright = 1; + bg_color = arg - 100; + + } + } + + if (fg_color == -1 && bg_color == -1 && fg_bright == -1 && + bg_bright == -1 && inverse == -1) { + /* Nothing changed */ + return 0; + } + + if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { + *error = GetLastError(); + return -1; + } + + if ((info.wAttributes & COMMON_LVB_REVERSE_VIDEO) > 0) { + FLIP_FGBG; + } + + if (fg_color != -1) { + info.wAttributes &= ~(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); + if (fg_color & 1) info.wAttributes |= FOREGROUND_RED; + if (fg_color & 2) info.wAttributes |= FOREGROUND_GREEN; + if (fg_color & 4) info.wAttributes |= FOREGROUND_BLUE; + } + + if (fg_bright != -1) { + if (fg_bright) { + info.wAttributes |= FOREGROUND_INTENSITY; + } else { + info.wAttributes &= ~FOREGROUND_INTENSITY; + } + } + + if (bg_color != -1) { + info.wAttributes &= ~(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE); + if (bg_color & 1) info.wAttributes |= BACKGROUND_RED; + if (bg_color & 2) info.wAttributes |= BACKGROUND_GREEN; + if (bg_color & 4) info.wAttributes |= BACKGROUND_BLUE; + } + + if (bg_bright != -1) { + if (bg_bright) { + info.wAttributes |= BACKGROUND_INTENSITY; + } else { + info.wAttributes &= ~BACKGROUND_INTENSITY; + } + } + + if (inverse != -1) { + if (inverse) { + info.wAttributes |= COMMON_LVB_REVERSE_VIDEO; + } else { + info.wAttributes &= ~COMMON_LVB_REVERSE_VIDEO; + } + } + + if ((info.wAttributes & COMMON_LVB_REVERSE_VIDEO) > 0) { + FLIP_FGBG; + } + + if (!SetConsoleTextAttribute(handle->handle, info.wAttributes)) { + *error = GetLastError(); + return -1; + } + + return 0; +} + + +static int uv_tty_save_state(uv_tty_t* handle, unsigned char save_attributes, + DWORD* error) { + CONSOLE_SCREEN_BUFFER_INFO info; + + if (*error != ERROR_SUCCESS) { + return -1; + } + + if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { + *error = GetLastError(); + return -1; + } + + uv_tty_update_virtual_window(&info); + + handle->tty.wr.saved_position.X = info.dwCursorPosition.X; + handle->tty.wr.saved_position.Y = info.dwCursorPosition.Y - uv_tty_virtual_offset; + handle->flags |= UV_HANDLE_TTY_SAVED_POSITION; + + if (save_attributes) { + handle->tty.wr.saved_attributes = info.wAttributes & + (FOREGROUND_INTENSITY | BACKGROUND_INTENSITY); + handle->flags |= UV_HANDLE_TTY_SAVED_ATTRIBUTES; + } + + return 0; +} + + +static int uv_tty_restore_state(uv_tty_t* handle, + unsigned char restore_attributes, DWORD* error) { + CONSOLE_SCREEN_BUFFER_INFO info; + WORD new_attributes; + + if (*error != ERROR_SUCCESS) { + return -1; + } + + if (handle->flags & UV_HANDLE_TTY_SAVED_POSITION) { + if (uv_tty_move_caret(handle, + handle->tty.wr.saved_position.X, + 0, + handle->tty.wr.saved_position.Y, + 0, + error) != 0) { + return -1; + } + } + + if (restore_attributes && + (handle->flags & UV_HANDLE_TTY_SAVED_ATTRIBUTES)) { + if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { + *error = GetLastError(); + return -1; + } + + new_attributes = info.wAttributes; + new_attributes &= ~(FOREGROUND_INTENSITY | BACKGROUND_INTENSITY); + new_attributes |= handle->tty.wr.saved_attributes; + + if (!SetConsoleTextAttribute(handle->handle, new_attributes)) { + *error = GetLastError(); + return -1; + } + } + + return 0; +} + +static int uv_tty_set_cursor_visibility(uv_tty_t* handle, + BOOL visible, + DWORD* error) { + CONSOLE_CURSOR_INFO cursor_info; + + if (!GetConsoleCursorInfo(handle->handle, &cursor_info)) { + *error = GetLastError(); + return -1; + } + + cursor_info.bVisible = visible; + + if (!SetConsoleCursorInfo(handle->handle, &cursor_info)) { + *error = GetLastError(); + return -1; + } + + return 0; +} + +static int uv_tty_write_bufs(uv_tty_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + DWORD* error) { + /* We can only write 8k characters at a time. Windows can't handle */ + /* much more characters in a single console write anyway. */ + WCHAR utf16_buf[8192]; + DWORD utf16_buf_used = 0; + unsigned int i; + +#define FLUSH_TEXT() \ + do { \ + if (utf16_buf_used > 0) { \ + uv_tty_emit_text(handle, utf16_buf, utf16_buf_used, error); \ + utf16_buf_used = 0; \ + } \ + } while (0) + +#define ENSURE_BUFFER_SPACE(wchars_needed) \ + if (wchars_needed > ARRAY_SIZE(utf16_buf) - utf16_buf_used) { \ + FLUSH_TEXT(); \ + } + + /* Cache for fast access */ + unsigned char utf8_bytes_left = handle->tty.wr.utf8_bytes_left; + unsigned int utf8_codepoint = handle->tty.wr.utf8_codepoint; + unsigned char previous_eol = handle->tty.wr.previous_eol; + unsigned char ansi_parser_state = handle->tty.wr.ansi_parser_state; + + /* Store the error here. If we encounter an error, stop trying to do i/o */ + /* but keep parsing the buffer so we leave the parser in a consistent */ + /* state. */ + *error = ERROR_SUCCESS; + + EnterCriticalSection(&uv_tty_output_lock); + + for (i = 0; i < nbufs; i++) { + uv_buf_t buf = bufs[i]; + unsigned int j; + + for (j = 0; j < buf.len; j++) { + unsigned char c = buf.base[j]; + + /* Run the character through the utf8 decoder We happily accept non */ + /* shortest form encodings and invalid code points - there's no real */ + /* harm that can be done. */ + if (utf8_bytes_left == 0) { + /* Read utf-8 start byte */ + DWORD first_zero_bit; + unsigned char not_c = ~c; +#ifdef _MSC_VER /* msvc */ + if (_BitScanReverse(&first_zero_bit, not_c)) { +#else /* assume gcc */ + if (c != 0) { + first_zero_bit = (sizeof(int) * 8) - 1 - __builtin_clz(not_c); +#endif + if (first_zero_bit == 7) { + /* Ascii - pass right through */ + utf8_codepoint = (unsigned int) c; + + } else if (first_zero_bit <= 5) { + /* Multibyte sequence */ + utf8_codepoint = (0xff >> (8 - first_zero_bit)) & c; + utf8_bytes_left = (char) (6 - first_zero_bit); + + } else { + /* Invalid continuation */ + utf8_codepoint = UNICODE_REPLACEMENT_CHARACTER; + } + + } else { + /* 0xff -- invalid */ + utf8_codepoint = UNICODE_REPLACEMENT_CHARACTER; + } + + } else if ((c & 0xc0) == 0x80) { + /* Valid continuation of utf-8 multibyte sequence */ + utf8_bytes_left--; + utf8_codepoint <<= 6; + utf8_codepoint |= ((unsigned int) c & 0x3f); + + } else { + /* Start byte where continuation was expected. */ + utf8_bytes_left = 0; + utf8_codepoint = UNICODE_REPLACEMENT_CHARACTER; + /* Patch buf offset so this character will be parsed again as a */ + /* start byte. */ + j--; + } + + /* Maybe we need to parse more bytes to find a character. */ + if (utf8_bytes_left != 0) { + continue; + } + + /* Parse vt100/ansi escape codes */ + if (ansi_parser_state == ANSI_NORMAL) { + switch (utf8_codepoint) { + case '\033': + ansi_parser_state = ANSI_ESCAPE_SEEN; + continue; + + case 0233: + ansi_parser_state = ANSI_CSI; + handle->tty.wr.ansi_csi_argc = 0; + continue; + } + + } else if (ansi_parser_state == ANSI_ESCAPE_SEEN) { + switch (utf8_codepoint) { + case '[': + ansi_parser_state = ANSI_CSI; + handle->tty.wr.ansi_csi_argc = 0; + continue; + + case '^': + case '_': + case 'P': + case ']': + /* Not supported, but we'll have to parse until we see a stop */ + /* code, e.g. ESC \ or BEL. */ + ansi_parser_state = ANSI_ST_CONTROL; + continue; + + case '\033': + /* Ignore double escape. */ + continue; + + case 'c': + /* Full console reset. */ + FLUSH_TEXT(); + uv_tty_reset(handle, error); + ansi_parser_state = ANSI_NORMAL; + continue; + + case '7': + /* Save the cursor position and text attributes. */ + FLUSH_TEXT(); + uv_tty_save_state(handle, 1, error); + ansi_parser_state = ANSI_NORMAL; + continue; + + case '8': + /* Restore the cursor position and text attributes */ + FLUSH_TEXT(); + uv_tty_restore_state(handle, 1, error); + ansi_parser_state = ANSI_NORMAL; + continue; + + default: + if (utf8_codepoint >= '@' && utf8_codepoint <= '_') { + /* Single-char control. */ + ansi_parser_state = ANSI_NORMAL; + continue; + } else { + /* Invalid - proceed as normal, */ + ansi_parser_state = ANSI_NORMAL; + } + } + + } else if (ansi_parser_state & ANSI_CSI) { + if (!(ansi_parser_state & ANSI_IGNORE)) { + if (utf8_codepoint >= '0' && utf8_codepoint <= '9') { + /* Parsing a numerical argument */ + + if (!(ansi_parser_state & ANSI_IN_ARG)) { + /* We were not currently parsing a number */ + + /* Check for too many arguments */ + if (handle->tty.wr.ansi_csi_argc >= ARRAY_SIZE(handle->tty.wr.ansi_csi_argv)) { + ansi_parser_state |= ANSI_IGNORE; + continue; + } + + ansi_parser_state |= ANSI_IN_ARG; + handle->tty.wr.ansi_csi_argc++; + handle->tty.wr.ansi_csi_argv[handle->tty.wr.ansi_csi_argc - 1] = + (unsigned short) utf8_codepoint - '0'; + continue; + } else { + /* We were already parsing a number. Parse next digit. */ + uint32_t value = 10 * + handle->tty.wr.ansi_csi_argv[handle->tty.wr.ansi_csi_argc - 1]; + + /* Check for overflow. */ + if (value > UINT16_MAX) { + ansi_parser_state |= ANSI_IGNORE; + continue; + } + + handle->tty.wr.ansi_csi_argv[handle->tty.wr.ansi_csi_argc - 1] = + (unsigned short) value + (utf8_codepoint - '0'); + continue; + } + + } else if (utf8_codepoint == ';') { + /* Denotes the end of an argument. */ + if (ansi_parser_state & ANSI_IN_ARG) { + ansi_parser_state &= ~ANSI_IN_ARG; + continue; + + } else { + /* If ANSI_IN_ARG is not set, add another argument and */ + /* default it to 0. */ + /* Check for too many arguments */ + if (handle->tty.wr.ansi_csi_argc >= ARRAY_SIZE(handle->tty.wr.ansi_csi_argv)) { + ansi_parser_state |= ANSI_IGNORE; + continue; + } + + handle->tty.wr.ansi_csi_argc++; + handle->tty.wr.ansi_csi_argv[handle->tty.wr.ansi_csi_argc - 1] = 0; + continue; + } + + } else if (utf8_codepoint == '?' && !(ansi_parser_state & ANSI_IN_ARG) && + handle->tty.wr.ansi_csi_argc == 0) { + /* Ignores '?' if it is the first character after CSI[ */ + /* This is an extension character from the VT100 codeset */ + /* that is supported and used by most ANSI terminals today. */ + continue; + + } else if (utf8_codepoint >= '@' && utf8_codepoint <= '~' && + (handle->tty.wr.ansi_csi_argc > 0 || utf8_codepoint != '[')) { + int x, y, d; + + /* Command byte */ + switch (utf8_codepoint) { + case 'A': + /* cursor up */ + FLUSH_TEXT(); + y = -(handle->tty.wr.ansi_csi_argc ? handle->tty.wr.ansi_csi_argv[0] : 1); + uv_tty_move_caret(handle, 0, 1, y, 1, error); + break; + + case 'B': + /* cursor down */ + FLUSH_TEXT(); + y = handle->tty.wr.ansi_csi_argc ? handle->tty.wr.ansi_csi_argv[0] : 1; + uv_tty_move_caret(handle, 0, 1, y, 1, error); + break; + + case 'C': + /* cursor forward */ + FLUSH_TEXT(); + x = handle->tty.wr.ansi_csi_argc ? handle->tty.wr.ansi_csi_argv[0] : 1; + uv_tty_move_caret(handle, x, 1, 0, 1, error); + break; + + case 'D': + /* cursor back */ + FLUSH_TEXT(); + x = -(handle->tty.wr.ansi_csi_argc ? handle->tty.wr.ansi_csi_argv[0] : 1); + uv_tty_move_caret(handle, x, 1, 0, 1, error); + break; + + case 'E': + /* cursor next line */ + FLUSH_TEXT(); + y = handle->tty.wr.ansi_csi_argc ? handle->tty.wr.ansi_csi_argv[0] : 1; + uv_tty_move_caret(handle, 0, 0, y, 1, error); + break; + + case 'F': + /* cursor previous line */ + FLUSH_TEXT(); + y = -(handle->tty.wr.ansi_csi_argc ? handle->tty.wr.ansi_csi_argv[0] : 1); + uv_tty_move_caret(handle, 0, 0, y, 1, error); + break; + + case 'G': + /* cursor horizontal move absolute */ + FLUSH_TEXT(); + x = (handle->tty.wr.ansi_csi_argc >= 1 && handle->tty.wr.ansi_csi_argv[0]) + ? handle->tty.wr.ansi_csi_argv[0] - 1 : 0; + uv_tty_move_caret(handle, x, 0, 0, 1, error); + break; + + case 'H': + case 'f': + /* cursor move absolute */ + FLUSH_TEXT(); + y = (handle->tty.wr.ansi_csi_argc >= 1 && handle->tty.wr.ansi_csi_argv[0]) + ? handle->tty.wr.ansi_csi_argv[0] - 1 : 0; + x = (handle->tty.wr.ansi_csi_argc >= 2 && handle->tty.wr.ansi_csi_argv[1]) + ? handle->tty.wr.ansi_csi_argv[1] - 1 : 0; + uv_tty_move_caret(handle, x, 0, y, 0, error); + break; + + case 'J': + /* Erase screen */ + FLUSH_TEXT(); + d = handle->tty.wr.ansi_csi_argc ? handle->tty.wr.ansi_csi_argv[0] : 0; + if (d >= 0 && d <= 2) { + uv_tty_clear(handle, d, 1, error); + } + break; + + case 'K': + /* Erase line */ + FLUSH_TEXT(); + d = handle->tty.wr.ansi_csi_argc ? handle->tty.wr.ansi_csi_argv[0] : 0; + if (d >= 0 && d <= 2) { + uv_tty_clear(handle, d, 0, error); + } + break; + + case 'm': + /* Set style */ + FLUSH_TEXT(); + uv_tty_set_style(handle, error); + break; + + case 's': + /* Save the cursor position. */ + FLUSH_TEXT(); + uv_tty_save_state(handle, 0, error); + break; + + case 'u': + /* Restore the cursor position */ + FLUSH_TEXT(); + uv_tty_restore_state(handle, 0, error); + break; + + case 'l': + /* Hide the cursor */ + if (handle->tty.wr.ansi_csi_argc == 1 && + handle->tty.wr.ansi_csi_argv[0] == 25) { + FLUSH_TEXT(); + uv_tty_set_cursor_visibility(handle, 0, error); + } + break; + + case 'h': + /* Show the cursor */ + if (handle->tty.wr.ansi_csi_argc == 1 && + handle->tty.wr.ansi_csi_argv[0] == 25) { + FLUSH_TEXT(); + uv_tty_set_cursor_visibility(handle, 1, error); + } + break; + } + + /* Sequence ended - go back to normal state. */ + ansi_parser_state = ANSI_NORMAL; + continue; + + } else { + /* We don't support commands that use private mode characters or */ + /* intermediaries. Ignore the rest of the sequence. */ + ansi_parser_state |= ANSI_IGNORE; + continue; + } + } else { + /* We're ignoring this command. Stop only on command character. */ + if (utf8_codepoint >= '@' && utf8_codepoint <= '~') { + ansi_parser_state = ANSI_NORMAL; + } + continue; + } + + } else if (ansi_parser_state & ANSI_ST_CONTROL) { + /* Unsupported control code */ + /* Ignore everything until we see BEL or ESC \ */ + if (ansi_parser_state & ANSI_IN_STRING) { + if (!(ansi_parser_state & ANSI_BACKSLASH_SEEN)) { + if (utf8_codepoint == '"') { + ansi_parser_state &= ~ANSI_IN_STRING; + } else if (utf8_codepoint == '\\') { + ansi_parser_state |= ANSI_BACKSLASH_SEEN; + } + } else { + ansi_parser_state &= ~ANSI_BACKSLASH_SEEN; + } + } else { + if (utf8_codepoint == '\007' || (utf8_codepoint == '\\' && + (ansi_parser_state & ANSI_ESCAPE_SEEN))) { + /* End of sequence */ + ansi_parser_state = ANSI_NORMAL; + } else if (utf8_codepoint == '\033') { + /* Escape character */ + ansi_parser_state |= ANSI_ESCAPE_SEEN; + } else if (utf8_codepoint == '"') { + /* String starting */ + ansi_parser_state |= ANSI_IN_STRING; + ansi_parser_state &= ~ANSI_ESCAPE_SEEN; + ansi_parser_state &= ~ANSI_BACKSLASH_SEEN; + } else { + ansi_parser_state &= ~ANSI_ESCAPE_SEEN; + } + } + continue; + } else { + /* Inconsistent state */ + abort(); + } + + /* We wouldn't mind emitting utf-16 surrogate pairs. Too bad, the */ + /* windows console doesn't really support UTF-16, so just emit the */ + /* replacement character. */ + if (utf8_codepoint > 0xffff) { + utf8_codepoint = UNICODE_REPLACEMENT_CHARACTER; + } + + if (utf8_codepoint == 0x0a || utf8_codepoint == 0x0d) { + /* EOL conversion - emit \r\n when we see \n. */ + + if (utf8_codepoint == 0x0a && previous_eol != 0x0d) { + /* \n was not preceded by \r; print \r\n. */ + ENSURE_BUFFER_SPACE(2); + utf16_buf[utf16_buf_used++] = L'\r'; + utf16_buf[utf16_buf_used++] = L'\n'; + } else if (utf8_codepoint == 0x0d && previous_eol == 0x0a) { + /* \n was followed by \r; do not print the \r, since */ + /* the source was either \r\n\r (so the second \r is */ + /* redundant) or was \n\r (so the \n was processed */ + /* by the last case and an \r automatically inserted). */ + } else { + /* \r without \n; print \r as-is. */ + ENSURE_BUFFER_SPACE(1); + utf16_buf[utf16_buf_used++] = (WCHAR) utf8_codepoint; + } + + previous_eol = (char) utf8_codepoint; + + } else if (utf8_codepoint <= 0xffff) { + /* Encode character into utf-16 buffer. */ + ENSURE_BUFFER_SPACE(1); + utf16_buf[utf16_buf_used++] = (WCHAR) utf8_codepoint; + previous_eol = 0; + } + } + } + + /* Flush remaining characters */ + FLUSH_TEXT(); + + /* Copy cached values back to struct. */ + handle->tty.wr.utf8_bytes_left = utf8_bytes_left; + handle->tty.wr.utf8_codepoint = utf8_codepoint; + handle->tty.wr.previous_eol = previous_eol; + handle->tty.wr.ansi_parser_state = ansi_parser_state; + + LeaveCriticalSection(&uv_tty_output_lock); + + if (*error == STATUS_SUCCESS) { + return 0; + } else { + return -1; + } + +#undef FLUSH_TEXT +} + + +int uv_tty_write(uv_loop_t* loop, + uv_write_t* req, + uv_tty_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_write_cb cb) { + DWORD error; + + uv_req_init(loop, (uv_req_t*) req); + req->type = UV_WRITE; + req->handle = (uv_stream_t*) handle; + req->cb = cb; + + handle->reqs_pending++; + handle->stream.conn.write_reqs_pending++; + REGISTER_HANDLE_REQ(loop, handle, req); + + req->u.io.queued_bytes = 0; + + if (!uv_tty_write_bufs(handle, bufs, nbufs, &error)) { + SET_REQ_SUCCESS(req); + } else { + SET_REQ_ERROR(req, error); + } + + uv_insert_pending_req(loop, (uv_req_t*) req); + + return 0; +} + + +int uv__tty_try_write(uv_tty_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs) { + DWORD error; + + if (handle->stream.conn.write_reqs_pending > 0) + return UV_EAGAIN; + + if (uv_tty_write_bufs(handle, bufs, nbufs, &error)) + return uv_translate_sys_error(error); + + return uv__count_bufs(bufs, nbufs); +} + + +void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle, + uv_write_t* req) { + int err; + + handle->write_queue_size -= req->u.io.queued_bytes; + UNREGISTER_HANDLE_REQ(loop, handle, req); + + if (req->cb) { + err = GET_REQ_ERROR(req); + req->cb(req, uv_translate_sys_error(err)); + } + + handle->stream.conn.write_reqs_pending--; + if (handle->stream.conn.shutdown_req != NULL && + handle->stream.conn.write_reqs_pending == 0) { + uv_want_endgame(loop, (uv_handle_t*)handle); + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +void uv_tty_close(uv_tty_t* handle) { + assert(handle->u.fd == -1 || handle->u.fd > 2); + if (handle->u.fd == -1) + CloseHandle(handle->handle); + else + close(handle->u.fd); + + if (handle->flags & UV_HANDLE_READING) + uv_tty_read_stop(handle); + + handle->u.fd = -1; + handle->handle = INVALID_HANDLE_VALUE; + handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); + uv__handle_closing(handle); + + if (handle->reqs_pending == 0) { + uv_want_endgame(handle->loop, (uv_handle_t*) handle); + } +} + + +void uv_tty_endgame(uv_loop_t* loop, uv_tty_t* handle) { + if (!(handle->flags & UV_HANDLE_TTY_READABLE) && + handle->stream.conn.shutdown_req != NULL && + handle->stream.conn.write_reqs_pending == 0) { + UNREGISTER_HANDLE_REQ(loop, handle, handle->stream.conn.shutdown_req); + + /* TTY shutdown is really just a no-op */ + if (handle->stream.conn.shutdown_req->cb) { + if (handle->flags & UV__HANDLE_CLOSING) { + handle->stream.conn.shutdown_req->cb(handle->stream.conn.shutdown_req, UV_ECANCELED); + } else { + handle->stream.conn.shutdown_req->cb(handle->stream.conn.shutdown_req, 0); + } + } + + handle->stream.conn.shutdown_req = NULL; + + DECREASE_PENDING_REQ_COUNT(handle); + return; + } + + if (handle->flags & UV__HANDLE_CLOSING && + handle->reqs_pending == 0) { + /* The console handle duplicate used for line reading should be destroyed */ + /* by uv_tty_read_stop. */ + assert(!(handle->flags & UV_HANDLE_TTY_READABLE) || + handle->tty.rd.read_line_handle == NULL); + + /* The wait handle used for raw reading should be unregistered when the */ + /* wait callback runs. */ + assert(!(handle->flags & UV_HANDLE_TTY_READABLE) || + handle->tty.rd.read_raw_wait == NULL); + + assert(!(handle->flags & UV_HANDLE_CLOSED)); + uv__handle_close(handle); + } +} + + +/* TODO: remove me */ +void uv_process_tty_accept_req(uv_loop_t* loop, uv_tty_t* handle, + uv_req_t* raw_req) { + abort(); +} + + +/* TODO: remove me */ +void uv_process_tty_connect_req(uv_loop_t* loop, uv_tty_t* handle, + uv_connect_t* req) { + abort(); +} + + +int uv_tty_reset_mode(void) { + /* Not necessary to do anything. */ + return 0; +} diff --git a/3rdparty/libuv/src/win/udp.c b/3rdparty/libuv/src/win/udp.c new file mode 100644 index 00000000000..24792ec067e --- /dev/null +++ b/3rdparty/libuv/src/win/udp.c @@ -0,0 +1,926 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "stream-inl.h" +#include "req-inl.h" + + +/* + * Threshold of active udp streams for which to preallocate udp read buffers. + */ +const unsigned int uv_active_udp_streams_threshold = 0; + +/* A zero-size buffer for use by uv_udp_read */ +static char uv_zero_[] = ""; + +int uv_udp_getsockname(const uv_udp_t* handle, + struct sockaddr* name, + int* namelen) { + int result; + + if (handle->socket == INVALID_SOCKET) { + return UV_EINVAL; + } + + result = getsockname(handle->socket, name, namelen); + if (result != 0) { + return uv_translate_sys_error(WSAGetLastError()); + } + + return 0; +} + + +static int uv_udp_set_socket(uv_loop_t* loop, uv_udp_t* handle, SOCKET socket, + int family) { + DWORD yes = 1; + WSAPROTOCOL_INFOW info; + int opt_len; + + if (handle->socket != INVALID_SOCKET) + return UV_EBUSY; + + /* Set the socket to nonblocking mode */ + if (ioctlsocket(socket, FIONBIO, &yes) == SOCKET_ERROR) { + return WSAGetLastError(); + } + + /* Make the socket non-inheritable */ + if (!SetHandleInformation((HANDLE)socket, HANDLE_FLAG_INHERIT, 0)) { + return GetLastError(); + } + + /* Associate it with the I/O completion port. */ + /* Use uv_handle_t pointer as completion key. */ + if (CreateIoCompletionPort((HANDLE)socket, + loop->iocp, + (ULONG_PTR)socket, + 0) == NULL) { + return GetLastError(); + } + + if (pSetFileCompletionNotificationModes) { + /* All known Windows that support SetFileCompletionNotificationModes */ + /* have a bug that makes it impossible to use this function in */ + /* conjunction with datagram sockets. We can work around that but only */ + /* if the user is using the default UDP driver (AFD) and has no other */ + /* LSPs stacked on top. Here we check whether that is the case. */ + opt_len = (int) sizeof info; + if (getsockopt(socket, + SOL_SOCKET, + SO_PROTOCOL_INFOW, + (char*) &info, + &opt_len) == SOCKET_ERROR) { + return GetLastError(); + } + + if (info.ProtocolChain.ChainLen == 1) { + if (pSetFileCompletionNotificationModes((HANDLE)socket, + FILE_SKIP_SET_EVENT_ON_HANDLE | + FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) { + handle->flags |= UV_HANDLE_SYNC_BYPASS_IOCP; + handle->func_wsarecv = uv_wsarecv_workaround; + handle->func_wsarecvfrom = uv_wsarecvfrom_workaround; + } else if (GetLastError() != ERROR_INVALID_FUNCTION) { + return GetLastError(); + } + } + } + + handle->socket = socket; + + if (family == AF_INET6) { + handle->flags |= UV_HANDLE_IPV6; + } else { + assert(!(handle->flags & UV_HANDLE_IPV6)); + } + + return 0; +} + + +int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) { + int domain; + + /* Use the lower 8 bits for the domain */ + domain = flags & 0xFF; + if (domain != AF_INET && domain != AF_INET6 && domain != AF_UNSPEC) + return UV_EINVAL; + + if (flags & ~0xFF) + return UV_EINVAL; + + uv__handle_init(loop, (uv_handle_t*) handle, UV_UDP); + handle->socket = INVALID_SOCKET; + handle->reqs_pending = 0; + handle->activecnt = 0; + handle->func_wsarecv = WSARecv; + handle->func_wsarecvfrom = WSARecvFrom; + handle->send_queue_size = 0; + handle->send_queue_count = 0; + uv_req_init(loop, (uv_req_t*) &(handle->recv_req)); + handle->recv_req.type = UV_UDP_RECV; + handle->recv_req.data = handle; + + /* If anything fails beyond this point we need to remove the handle from + * the handle queue, since it was added by uv__handle_init. + */ + + if (domain != AF_UNSPEC) { + SOCKET sock; + DWORD err; + + sock = socket(domain, SOCK_DGRAM, 0); + if (sock == INVALID_SOCKET) { + err = WSAGetLastError(); + QUEUE_REMOVE(&handle->handle_queue); + return uv_translate_sys_error(err); + } + + err = uv_udp_set_socket(handle->loop, handle, sock, domain); + if (err) { + closesocket(sock); + QUEUE_REMOVE(&handle->handle_queue); + return uv_translate_sys_error(err); + } + } + + return 0; +} + + +int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) { + return uv_udp_init_ex(loop, handle, AF_UNSPEC); +} + + +void uv_udp_close(uv_loop_t* loop, uv_udp_t* handle) { + uv_udp_recv_stop(handle); + closesocket(handle->socket); + handle->socket = INVALID_SOCKET; + + uv__handle_closing(handle); + + if (handle->reqs_pending == 0) { + uv_want_endgame(loop, (uv_handle_t*) handle); + } +} + + +void uv_udp_endgame(uv_loop_t* loop, uv_udp_t* handle) { + if (handle->flags & UV__HANDLE_CLOSING && + handle->reqs_pending == 0) { + assert(!(handle->flags & UV_HANDLE_CLOSED)); + uv__handle_close(handle); + } +} + + +static int uv_udp_maybe_bind(uv_udp_t* handle, + const struct sockaddr* addr, + unsigned int addrlen, + unsigned int flags) { + int r; + int err; + DWORD no = 0; + + if (handle->flags & UV_HANDLE_BOUND) + return 0; + + if ((flags & UV_UDP_IPV6ONLY) && addr->sa_family != AF_INET6) { + /* UV_UDP_IPV6ONLY is supported only for IPV6 sockets */ + return ERROR_INVALID_PARAMETER; + } + + if (handle->socket == INVALID_SOCKET) { + SOCKET sock = socket(addr->sa_family, SOCK_DGRAM, 0); + if (sock == INVALID_SOCKET) { + return WSAGetLastError(); + } + + err = uv_udp_set_socket(handle->loop, handle, sock, addr->sa_family); + if (err) { + closesocket(sock); + return err; + } + } + + if (flags & UV_UDP_REUSEADDR) { + DWORD yes = 1; + /* Set SO_REUSEADDR on the socket. */ + if (setsockopt(handle->socket, + SOL_SOCKET, + SO_REUSEADDR, + (char*) &yes, + sizeof yes) == SOCKET_ERROR) { + err = WSAGetLastError(); + return err; + } + } + + if (addr->sa_family == AF_INET6) + handle->flags |= UV_HANDLE_IPV6; + + if (addr->sa_family == AF_INET6 && !(flags & UV_UDP_IPV6ONLY)) { + /* On windows IPV6ONLY is on by default. */ + /* If the user doesn't specify it libuv turns it off. */ + + /* TODO: how to handle errors? This may fail if there is no ipv4 stack */ + /* available, or when run on XP/2003 which have no support for dualstack */ + /* sockets. For now we're silently ignoring the error. */ + setsockopt(handle->socket, + IPPROTO_IPV6, + IPV6_V6ONLY, + (char*) &no, + sizeof no); + } + + r = bind(handle->socket, addr, addrlen); + if (r == SOCKET_ERROR) { + return WSAGetLastError(); + } + + handle->flags |= UV_HANDLE_BOUND; + + return 0; +} + + +static void uv_udp_queue_recv(uv_loop_t* loop, uv_udp_t* handle) { + uv_req_t* req; + uv_buf_t buf; + DWORD bytes, flags; + int result; + + assert(handle->flags & UV_HANDLE_READING); + assert(!(handle->flags & UV_HANDLE_READ_PENDING)); + + req = &handle->recv_req; + memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); + + /* + * Preallocate a read buffer if the number of active streams is below + * the threshold. + */ + if (loop->active_udp_streams < uv_active_udp_streams_threshold) { + handle->flags &= ~UV_HANDLE_ZERO_READ; + + handle->alloc_cb((uv_handle_t*) handle, 65536, &handle->recv_buffer); + if (handle->recv_buffer.len == 0) { + handle->recv_cb(handle, UV_ENOBUFS, &handle->recv_buffer, NULL, 0); + return; + } + assert(handle->recv_buffer.base != NULL); + + buf = handle->recv_buffer; + memset(&handle->recv_from, 0, sizeof handle->recv_from); + handle->recv_from_len = sizeof handle->recv_from; + flags = 0; + + result = handle->func_wsarecvfrom(handle->socket, + (WSABUF*) &buf, + 1, + &bytes, + &flags, + (struct sockaddr*) &handle->recv_from, + &handle->recv_from_len, + &req->u.io.overlapped, + NULL); + + if (UV_SUCCEEDED_WITHOUT_IOCP(result == 0)) { + /* Process the req without IOCP. */ + handle->flags |= UV_HANDLE_READ_PENDING; + req->u.io.overlapped.InternalHigh = bytes; + handle->reqs_pending++; + uv_insert_pending_req(loop, req); + } else if (UV_SUCCEEDED_WITH_IOCP(result == 0)) { + /* The req will be processed with IOCP. */ + handle->flags |= UV_HANDLE_READ_PENDING; + handle->reqs_pending++; + } else { + /* Make this req pending reporting an error. */ + SET_REQ_ERROR(req, WSAGetLastError()); + uv_insert_pending_req(loop, req); + handle->reqs_pending++; + } + + } else { + handle->flags |= UV_HANDLE_ZERO_READ; + + buf.base = (char*) uv_zero_; + buf.len = 0; + flags = MSG_PEEK; + + result = handle->func_wsarecv(handle->socket, + (WSABUF*) &buf, + 1, + &bytes, + &flags, + &req->u.io.overlapped, + NULL); + + if (UV_SUCCEEDED_WITHOUT_IOCP(result == 0)) { + /* Process the req without IOCP. */ + handle->flags |= UV_HANDLE_READ_PENDING; + req->u.io.overlapped.InternalHigh = bytes; + handle->reqs_pending++; + uv_insert_pending_req(loop, req); + } else if (UV_SUCCEEDED_WITH_IOCP(result == 0)) { + /* The req will be processed with IOCP. */ + handle->flags |= UV_HANDLE_READ_PENDING; + handle->reqs_pending++; + } else { + /* Make this req pending reporting an error. */ + SET_REQ_ERROR(req, WSAGetLastError()); + uv_insert_pending_req(loop, req); + handle->reqs_pending++; + } + } +} + + +int uv__udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb, + uv_udp_recv_cb recv_cb) { + uv_loop_t* loop = handle->loop; + int err; + + if (handle->flags & UV_HANDLE_READING) { + return WSAEALREADY; + } + + err = uv_udp_maybe_bind(handle, + (const struct sockaddr*) &uv_addr_ip4_any_, + sizeof(uv_addr_ip4_any_), + 0); + if (err) + return err; + + handle->flags |= UV_HANDLE_READING; + INCREASE_ACTIVE_COUNT(loop, handle); + loop->active_udp_streams++; + + handle->recv_cb = recv_cb; + handle->alloc_cb = alloc_cb; + + /* If reading was stopped and then started again, there could still be a */ + /* recv request pending. */ + if (!(handle->flags & UV_HANDLE_READ_PENDING)) + uv_udp_queue_recv(loop, handle); + + return 0; +} + + +int uv__udp_recv_stop(uv_udp_t* handle) { + if (handle->flags & UV_HANDLE_READING) { + handle->flags &= ~UV_HANDLE_READING; + handle->loop->active_udp_streams--; + DECREASE_ACTIVE_COUNT(loop, handle); + } + + return 0; +} + + +static int uv__send(uv_udp_send_t* req, + uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + unsigned int addrlen, + uv_udp_send_cb cb) { + uv_loop_t* loop = handle->loop; + DWORD result, bytes; + + uv_req_init(loop, (uv_req_t*) req); + req->type = UV_UDP_SEND; + req->handle = handle; + req->cb = cb; + memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); + + result = WSASendTo(handle->socket, + (WSABUF*)bufs, + nbufs, + &bytes, + 0, + addr, + addrlen, + &req->u.io.overlapped, + NULL); + + if (UV_SUCCEEDED_WITHOUT_IOCP(result == 0)) { + /* Request completed immediately. */ + req->u.io.queued_bytes = 0; + handle->reqs_pending++; + handle->send_queue_size += req->u.io.queued_bytes; + handle->send_queue_count++; + REGISTER_HANDLE_REQ(loop, handle, req); + uv_insert_pending_req(loop, (uv_req_t*)req); + } else if (UV_SUCCEEDED_WITH_IOCP(result == 0)) { + /* Request queued by the kernel. */ + req->u.io.queued_bytes = uv__count_bufs(bufs, nbufs); + handle->reqs_pending++; + handle->send_queue_size += req->u.io.queued_bytes; + handle->send_queue_count++; + REGISTER_HANDLE_REQ(loop, handle, req); + } else { + /* Send failed due to an error. */ + return WSAGetLastError(); + } + + return 0; +} + + +void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle, + uv_req_t* req) { + uv_buf_t buf; + int partial; + + assert(handle->type == UV_UDP); + + handle->flags &= ~UV_HANDLE_READ_PENDING; + + if (!REQ_SUCCESS(req)) { + DWORD err = GET_REQ_SOCK_ERROR(req); + if (err == WSAEMSGSIZE) { + /* Not a real error, it just indicates that the received packet */ + /* was bigger than the receive buffer. */ + } else if (err == WSAECONNRESET || err == WSAENETRESET) { + /* A previous sendto operation failed; ignore this error. If */ + /* zero-reading we need to call WSARecv/WSARecvFrom _without_ the */ + /* MSG_PEEK flag to clear out the error queue. For nonzero reads, */ + /* immediately queue a new receive. */ + if (!(handle->flags & UV_HANDLE_ZERO_READ)) { + goto done; + } + } else { + /* A real error occurred. Report the error to the user only if we're */ + /* currently reading. */ + if (handle->flags & UV_HANDLE_READING) { + uv_udp_recv_stop(handle); + buf = (handle->flags & UV_HANDLE_ZERO_READ) ? + uv_buf_init(NULL, 0) : handle->recv_buffer; + handle->recv_cb(handle, uv_translate_sys_error(err), &buf, NULL, 0); + } + goto done; + } + } + + if (!(handle->flags & UV_HANDLE_ZERO_READ)) { + /* Successful read */ + partial = !REQ_SUCCESS(req); + handle->recv_cb(handle, + req->u.io.overlapped.InternalHigh, + &handle->recv_buffer, + (const struct sockaddr*) &handle->recv_from, + partial ? UV_UDP_PARTIAL : 0); + } else if (handle->flags & UV_HANDLE_READING) { + DWORD bytes, err, flags; + struct sockaddr_storage from; + int from_len; + + /* Do a nonblocking receive */ + /* TODO: try to read multiple datagrams at once. FIONREAD maybe? */ + handle->alloc_cb((uv_handle_t*) handle, 65536, &buf); + if (buf.len == 0) { + handle->recv_cb(handle, UV_ENOBUFS, &buf, NULL, 0); + goto done; + } + assert(buf.base != NULL); + + memset(&from, 0, sizeof from); + from_len = sizeof from; + + flags = 0; + + if (WSARecvFrom(handle->socket, + (WSABUF*)&buf, + 1, + &bytes, + &flags, + (struct sockaddr*) &from, + &from_len, + NULL, + NULL) != SOCKET_ERROR) { + + /* Message received */ + handle->recv_cb(handle, bytes, &buf, (const struct sockaddr*) &from, 0); + } else { + err = WSAGetLastError(); + if (err == WSAEMSGSIZE) { + /* Message truncated */ + handle->recv_cb(handle, + bytes, + &buf, + (const struct sockaddr*) &from, + UV_UDP_PARTIAL); + } else if (err == WSAEWOULDBLOCK) { + /* Kernel buffer empty */ + handle->recv_cb(handle, 0, &buf, NULL, 0); + } else if (err == WSAECONNRESET || err == WSAENETRESET) { + /* WSAECONNRESET/WSANETRESET is ignored because this just indicates + * that a previous sendto operation failed. + */ + handle->recv_cb(handle, 0, &buf, NULL, 0); + } else { + /* Any other error that we want to report back to the user. */ + uv_udp_recv_stop(handle); + handle->recv_cb(handle, uv_translate_sys_error(err), &buf, NULL, 0); + } + } + } + +done: + /* Post another read if still reading and not closing. */ + if ((handle->flags & UV_HANDLE_READING) && + !(handle->flags & UV_HANDLE_READ_PENDING)) { + uv_udp_queue_recv(loop, handle); + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +void uv_process_udp_send_req(uv_loop_t* loop, uv_udp_t* handle, + uv_udp_send_t* req) { + int err; + + assert(handle->type == UV_UDP); + + assert(handle->send_queue_size >= req->u.io.queued_bytes); + assert(handle->send_queue_count >= 1); + handle->send_queue_size -= req->u.io.queued_bytes; + handle->send_queue_count--; + + UNREGISTER_HANDLE_REQ(loop, handle, req); + + if (req->cb) { + err = 0; + if (!REQ_SUCCESS(req)) { + err = GET_REQ_SOCK_ERROR(req); + } + req->cb(req, uv_translate_sys_error(err)); + } + + DECREASE_PENDING_REQ_COUNT(handle); +} + + +static int uv__udp_set_membership4(uv_udp_t* handle, + const struct sockaddr_in* multicast_addr, + const char* interface_addr, + uv_membership membership) { + int err; + int optname; + struct ip_mreq mreq; + + if (handle->flags & UV_HANDLE_IPV6) + return UV_EINVAL; + + /* If the socket is unbound, bind to inaddr_any. */ + err = uv_udp_maybe_bind(handle, + (const struct sockaddr*) &uv_addr_ip4_any_, + sizeof(uv_addr_ip4_any_), + UV_UDP_REUSEADDR); + if (err) + return uv_translate_sys_error(err); + + memset(&mreq, 0, sizeof mreq); + + if (interface_addr) { + err = uv_inet_pton(AF_INET, interface_addr, &mreq.imr_interface.s_addr); + if (err) + return err; + } else { + mreq.imr_interface.s_addr = htonl(INADDR_ANY); + } + + mreq.imr_multiaddr.s_addr = multicast_addr->sin_addr.s_addr; + + switch (membership) { + case UV_JOIN_GROUP: + optname = IP_ADD_MEMBERSHIP; + break; + case UV_LEAVE_GROUP: + optname = IP_DROP_MEMBERSHIP; + break; + default: + return UV_EINVAL; + } + + if (setsockopt(handle->socket, + IPPROTO_IP, + optname, + (char*) &mreq, + sizeof mreq) == SOCKET_ERROR) { + return uv_translate_sys_error(WSAGetLastError()); + } + + return 0; +} + + +int uv__udp_set_membership6(uv_udp_t* handle, + const struct sockaddr_in6* multicast_addr, + const char* interface_addr, + uv_membership membership) { + int optname; + int err; + struct ipv6_mreq mreq; + struct sockaddr_in6 addr6; + + if ((handle->flags & UV_HANDLE_BOUND) && !(handle->flags & UV_HANDLE_IPV6)) + return UV_EINVAL; + + err = uv_udp_maybe_bind(handle, + (const struct sockaddr*) &uv_addr_ip6_any_, + sizeof(uv_addr_ip6_any_), + UV_UDP_REUSEADDR); + + if (err) + return uv_translate_sys_error(err); + + memset(&mreq, 0, sizeof(mreq)); + + if (interface_addr) { + if (uv_ip6_addr(interface_addr, 0, &addr6)) + return UV_EINVAL; + mreq.ipv6mr_interface = addr6.sin6_scope_id; + } else { + mreq.ipv6mr_interface = 0; + } + + mreq.ipv6mr_multiaddr = multicast_addr->sin6_addr; + + switch (membership) { + case UV_JOIN_GROUP: + optname = IPV6_ADD_MEMBERSHIP; + break; + case UV_LEAVE_GROUP: + optname = IPV6_DROP_MEMBERSHIP; + break; + default: + return UV_EINVAL; + } + + if (setsockopt(handle->socket, + IPPROTO_IPV6, + optname, + (char*) &mreq, + sizeof mreq) == SOCKET_ERROR) { + return uv_translate_sys_error(WSAGetLastError()); + } + + return 0; +} + + +int uv_udp_set_membership(uv_udp_t* handle, + const char* multicast_addr, + const char* interface_addr, + uv_membership membership) { + struct sockaddr_in addr4; + struct sockaddr_in6 addr6; + + if (uv_ip4_addr(multicast_addr, 0, &addr4) == 0) + return uv__udp_set_membership4(handle, &addr4, interface_addr, membership); + else if (uv_ip6_addr(multicast_addr, 0, &addr6) == 0) + return uv__udp_set_membership6(handle, &addr6, interface_addr, membership); + else + return UV_EINVAL; +} + + +int uv_udp_set_multicast_interface(uv_udp_t* handle, const char* interface_addr) { + struct sockaddr_storage addr_st; + struct sockaddr_in* addr4; + struct sockaddr_in6* addr6; + + addr4 = (struct sockaddr_in*) &addr_st; + addr6 = (struct sockaddr_in6*) &addr_st; + + if (!interface_addr) { + memset(&addr_st, 0, sizeof addr_st); + if (handle->flags & UV_HANDLE_IPV6) { + addr_st.ss_family = AF_INET6; + addr6->sin6_scope_id = 0; + } else { + addr_st.ss_family = AF_INET; + addr4->sin_addr.s_addr = htonl(INADDR_ANY); + } + } else if (uv_ip4_addr(interface_addr, 0, addr4) == 0) { + /* nothing, address was parsed */ + } else if (uv_ip6_addr(interface_addr, 0, addr6) == 0) { + /* nothing, address was parsed */ + } else { + return UV_EINVAL; + } + + if (!(handle->flags & UV_HANDLE_BOUND)) + return UV_EBADF; + + if (addr_st.ss_family == AF_INET) { + if (setsockopt(handle->socket, + IPPROTO_IP, + IP_MULTICAST_IF, + (char*) &addr4->sin_addr, + sizeof(addr4->sin_addr)) == SOCKET_ERROR) { + return uv_translate_sys_error(WSAGetLastError()); + } + } else if (addr_st.ss_family == AF_INET6) { + if (setsockopt(handle->socket, + IPPROTO_IPV6, + IPV6_MULTICAST_IF, + (char*) &addr6->sin6_scope_id, + sizeof(addr6->sin6_scope_id)) == SOCKET_ERROR) { + return uv_translate_sys_error(WSAGetLastError()); + } + } else { + assert(0 && "unexpected address family"); + abort(); + } + + return 0; +} + + +int uv_udp_set_broadcast(uv_udp_t* handle, int value) { + BOOL optval = (BOOL) value; + + if (!(handle->flags & UV_HANDLE_BOUND)) + return UV_EBADF; + + if (setsockopt(handle->socket, + SOL_SOCKET, + SO_BROADCAST, + (char*) &optval, + sizeof optval)) { + return uv_translate_sys_error(WSAGetLastError()); + } + + return 0; +} + + +int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) { + WSAPROTOCOL_INFOW protocol_info; + int opt_len; + int err; + + /* Detect the address family of the socket. */ + opt_len = (int) sizeof protocol_info; + if (getsockopt(sock, + SOL_SOCKET, + SO_PROTOCOL_INFOW, + (char*) &protocol_info, + &opt_len) == SOCKET_ERROR) { + return uv_translate_sys_error(GetLastError()); + } + + err = uv_udp_set_socket(handle->loop, + handle, + sock, + protocol_info.iAddressFamily); + return uv_translate_sys_error(err); +} + + +#define SOCKOPT_SETTER(name, option4, option6, validate) \ + int uv_udp_set_##name(uv_udp_t* handle, int value) { \ + DWORD optval = (DWORD) value; \ + \ + if (!(validate(value))) { \ + return UV_EINVAL; \ + } \ + \ + if (!(handle->flags & UV_HANDLE_BOUND)) \ + return UV_EBADF; \ + \ + if (!(handle->flags & UV_HANDLE_IPV6)) { \ + /* Set IPv4 socket option */ \ + if (setsockopt(handle->socket, \ + IPPROTO_IP, \ + option4, \ + (char*) &optval, \ + sizeof optval)) { \ + return uv_translate_sys_error(WSAGetLastError()); \ + } \ + } else { \ + /* Set IPv6 socket option */ \ + if (setsockopt(handle->socket, \ + IPPROTO_IPV6, \ + option6, \ + (char*) &optval, \ + sizeof optval)) { \ + return uv_translate_sys_error(WSAGetLastError()); \ + } \ + } \ + return 0; \ + } + +#define VALIDATE_TTL(value) ((value) >= 1 && (value) <= 255) +#define VALIDATE_MULTICAST_TTL(value) ((value) >= -1 && (value) <= 255) +#define VALIDATE_MULTICAST_LOOP(value) (1) + +SOCKOPT_SETTER(ttl, + IP_TTL, + IPV6_HOPLIMIT, + VALIDATE_TTL) +SOCKOPT_SETTER(multicast_ttl, + IP_MULTICAST_TTL, + IPV6_MULTICAST_HOPS, + VALIDATE_MULTICAST_TTL) +SOCKOPT_SETTER(multicast_loop, + IP_MULTICAST_LOOP, + IPV6_MULTICAST_LOOP, + VALIDATE_MULTICAST_LOOP) + +#undef SOCKOPT_SETTER +#undef VALIDATE_TTL +#undef VALIDATE_MULTICAST_TTL +#undef VALIDATE_MULTICAST_LOOP + + +/* This function is an egress point, i.e. it returns libuv errors rather than + * system errors. + */ +int uv__udp_bind(uv_udp_t* handle, + const struct sockaddr* addr, + unsigned int addrlen, + unsigned int flags) { + int err; + + err = uv_udp_maybe_bind(handle, addr, addrlen, flags); + if (err) + return uv_translate_sys_error(err); + + return 0; +} + + +/* This function is an egress point, i.e. it returns libuv errors rather than + * system errors. + */ +int uv__udp_send(uv_udp_send_t* req, + uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + unsigned int addrlen, + uv_udp_send_cb send_cb) { + const struct sockaddr* bind_addr; + int err; + + if (!(handle->flags & UV_HANDLE_BOUND)) { + if (addrlen == sizeof(uv_addr_ip4_any_)) { + bind_addr = (const struct sockaddr*) &uv_addr_ip4_any_; + } else if (addrlen == sizeof(uv_addr_ip6_any_)) { + bind_addr = (const struct sockaddr*) &uv_addr_ip6_any_; + } else { + abort(); + } + err = uv_udp_maybe_bind(handle, bind_addr, addrlen, 0); + if (err) + return uv_translate_sys_error(err); + } + + err = uv__send(req, handle, bufs, nbufs, addr, addrlen, send_cb); + if (err) + return uv_translate_sys_error(err); + + return 0; +} + + +int uv__udp_try_send(uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + unsigned int addrlen) { + return UV_ENOSYS; +} diff --git a/3rdparty/libuv/src/win/util.c b/3rdparty/libuv/src/win/util.c new file mode 100644 index 00000000000..cb247513046 --- /dev/null +++ b/3rdparty/libuv/src/win/util.c @@ -0,0 +1,1232 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include +#include + + +/* + * Max title length; the only thing MSDN tells us about the maximum length + * of the console title is that it is smaller than 64K. However in practice + * it is much smaller, and there is no way to figure out what the exact length + * of the title is or can be, at least not on XP. To make it even more + * annoying, GetConsoleTitle fails when the buffer to be read into is bigger + * than the actual maximum length. So we make a conservative guess here; + * just don't put the novel you're writing in the title, unless the plot + * survives truncation. + */ +#define MAX_TITLE_LENGTH 8192 + +/* The number of nanoseconds in one second. */ +#define UV__NANOSEC 1000000000 + + +/* Cached copy of the process title, plus a mutex guarding it. */ +static char *process_title; +static CRITICAL_SECTION process_title_lock; + +/* Cached copy of the process id, written once. */ +static DWORD current_pid = 0; + + +/* Interval (in seconds) of the high-resolution clock. */ +static double hrtime_interval_ = 0; + + +/* + * One-time initialization code for functionality defined in util.c. + */ +void uv__util_init() { + LARGE_INTEGER perf_frequency; + + /* Initialize process title access mutex. */ + InitializeCriticalSection(&process_title_lock); + + /* Retrieve high-resolution timer frequency + * and precompute its reciprocal. + */ + if (QueryPerformanceFrequency(&perf_frequency)) { + hrtime_interval_ = 1.0 / perf_frequency.QuadPart; + } else { + hrtime_interval_= 0; + } +} + + +int uv_utf16_to_utf8(const WCHAR* utf16Buffer, size_t utf16Size, + char* utf8Buffer, size_t utf8Size) { + return WideCharToMultiByte(CP_UTF8, + 0, + utf16Buffer, + utf16Size, + utf8Buffer, + utf8Size, + NULL, + NULL); +} + + +int uv_utf8_to_utf16(const char* utf8Buffer, WCHAR* utf16Buffer, + size_t utf16Size) { + return MultiByteToWideChar(CP_UTF8, + 0, + utf8Buffer, + -1, + utf16Buffer, + utf16Size); +} + + +int uv_exepath(char* buffer, size_t* size_ptr) { + int utf8_len, utf16_buffer_len, utf16_len; + WCHAR* utf16_buffer; + int err; + + if (buffer == NULL || size_ptr == NULL || *size_ptr == 0) { + return UV_EINVAL; + } + + if (*size_ptr > 32768) { + /* Windows paths can never be longer than this. */ + utf16_buffer_len = 32768; + } else { + utf16_buffer_len = (int) *size_ptr; + } + + utf16_buffer = (WCHAR*) uv__malloc(sizeof(WCHAR) * utf16_buffer_len); + if (!utf16_buffer) { + return UV_ENOMEM; + } + + /* Get the path as UTF-16. */ + utf16_len = GetModuleFileNameW(NULL, utf16_buffer, utf16_buffer_len); + if (utf16_len <= 0) { + err = GetLastError(); + goto error; + } + + /* utf16_len contains the length, *not* including the terminating null. */ + utf16_buffer[utf16_len] = L'\0'; + + /* Convert to UTF-8 */ + utf8_len = WideCharToMultiByte(CP_UTF8, + 0, + utf16_buffer, + -1, + buffer, + *size_ptr > INT_MAX ? INT_MAX : (int) *size_ptr, + NULL, + NULL); + if (utf8_len == 0) { + err = GetLastError(); + goto error; + } + + uv__free(utf16_buffer); + + /* utf8_len *does* include the terminating null at this point, but the */ + /* returned size shouldn't. */ + *size_ptr = utf8_len - 1; + return 0; + + error: + uv__free(utf16_buffer); + return uv_translate_sys_error(err); +} + + +int uv_cwd(char* buffer, size_t* size) { + DWORD utf16_len; + WCHAR utf16_buffer[MAX_PATH]; + int r; + + if (buffer == NULL || size == NULL) { + return UV_EINVAL; + } + + utf16_len = GetCurrentDirectoryW(MAX_PATH, utf16_buffer); + if (utf16_len == 0) { + return uv_translate_sys_error(GetLastError()); + } else if (utf16_len > MAX_PATH) { + /* This should be impossible; however the CRT has a code path to deal */ + /* with this scenario, so I added a check anyway. */ + return UV_EIO; + } + + /* utf16_len contains the length, *not* including the terminating null. */ + utf16_buffer[utf16_len] = L'\0'; + + /* The returned directory should not have a trailing slash, unless it */ + /* points at a drive root, like c:\. Remove it if needed.*/ + if (utf16_buffer[utf16_len - 1] == L'\\' && + !(utf16_len == 3 && utf16_buffer[1] == L':')) { + utf16_len--; + utf16_buffer[utf16_len] = L'\0'; + } + + /* Check how much space we need */ + r = WideCharToMultiByte(CP_UTF8, + 0, + utf16_buffer, + -1, + NULL, + 0, + NULL, + NULL); + if (r == 0) { + return uv_translate_sys_error(GetLastError()); + } else if (r > (int) *size) { + *size = r -1; + return UV_ENOBUFS; + } + + /* Convert to UTF-8 */ + r = WideCharToMultiByte(CP_UTF8, + 0, + utf16_buffer, + -1, + buffer, + *size > INT_MAX ? INT_MAX : (int) *size, + NULL, + NULL); + if (r == 0) { + return uv_translate_sys_error(GetLastError()); + } + + *size = r - 1; + return 0; +} + + +int uv_chdir(const char* dir) { + WCHAR utf16_buffer[MAX_PATH]; + size_t utf16_len; + WCHAR drive_letter, env_var[4]; + + if (dir == NULL) { + return UV_EINVAL; + } + + if (MultiByteToWideChar(CP_UTF8, + 0, + dir, + -1, + utf16_buffer, + MAX_PATH) == 0) { + DWORD error = GetLastError(); + /* The maximum length of the current working directory is 260 chars, */ + /* including terminating null. If it doesn't fit, the path name must be */ + /* too long. */ + if (error == ERROR_INSUFFICIENT_BUFFER) { + return UV_ENAMETOOLONG; + } else { + return uv_translate_sys_error(error); + } + } + + if (!SetCurrentDirectoryW(utf16_buffer)) { + return uv_translate_sys_error(GetLastError()); + } + + /* Windows stores the drive-local path in an "hidden" environment variable, */ + /* which has the form "=C:=C:\Windows". SetCurrentDirectory does not */ + /* update this, so we'll have to do it. */ + utf16_len = GetCurrentDirectoryW(MAX_PATH, utf16_buffer); + if (utf16_len == 0) { + return uv_translate_sys_error(GetLastError()); + } else if (utf16_len > MAX_PATH) { + return UV_EIO; + } + + /* The returned directory should not have a trailing slash, unless it */ + /* points at a drive root, like c:\. Remove it if needed. */ + if (utf16_buffer[utf16_len - 1] == L'\\' && + !(utf16_len == 3 && utf16_buffer[1] == L':')) { + utf16_len--; + utf16_buffer[utf16_len] = L'\0'; + } + + if (utf16_len < 2 || utf16_buffer[1] != L':') { + /* Doesn't look like a drive letter could be there - probably an UNC */ + /* path. TODO: Need to handle win32 namespaces like \\?\C:\ ? */ + drive_letter = 0; + } else if (utf16_buffer[0] >= L'A' && utf16_buffer[0] <= L'Z') { + drive_letter = utf16_buffer[0]; + } else if (utf16_buffer[0] >= L'a' && utf16_buffer[0] <= L'z') { + /* Convert to uppercase. */ + drive_letter = utf16_buffer[0] - L'a' + L'A'; + } else { + /* Not valid. */ + drive_letter = 0; + } + + if (drive_letter != 0) { + /* Construct the environment variable name and set it. */ + env_var[0] = L'='; + env_var[1] = drive_letter; + env_var[2] = L':'; + env_var[3] = L'\0'; + + if (!SetEnvironmentVariableW(env_var, utf16_buffer)) { + return uv_translate_sys_error(GetLastError()); + } + } + + return 0; +} + + +void uv_loadavg(double avg[3]) { + /* Can't be implemented */ + avg[0] = avg[1] = avg[2] = 0; +} + + +uint64_t uv_get_free_memory(void) { + MEMORYSTATUSEX memory_status; + memory_status.dwLength = sizeof(memory_status); + + if (!GlobalMemoryStatusEx(&memory_status)) { + return -1; + } + + return (uint64_t)memory_status.ullAvailPhys; +} + + +uint64_t uv_get_total_memory(void) { + MEMORYSTATUSEX memory_status; + memory_status.dwLength = sizeof(memory_status); + + if (!GlobalMemoryStatusEx(&memory_status)) { + return -1; + } + + return (uint64_t)memory_status.ullTotalPhys; +} + + +int uv_parent_pid() { + int parent_pid = -1; + HANDLE handle; + PROCESSENTRY32 pe; + DWORD current_pid = GetCurrentProcessId(); + + pe.dwSize = sizeof(PROCESSENTRY32); + handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + + if (Process32First(handle, &pe)) { + do { + if (pe.th32ProcessID == current_pid) { + parent_pid = pe.th32ParentProcessID; + break; + } + } while( Process32Next(handle, &pe)); + } + + CloseHandle(handle); + return parent_pid; +} + + +int uv_current_pid() { + if (current_pid == 0) { + current_pid = GetCurrentProcessId(); + } + return current_pid; +} + + +char** uv_setup_args(int argc, char** argv) { + return argv; +} + + +int uv_set_process_title(const char* title) { + int err; + int length; + WCHAR* title_w = NULL; + + uv__once_init(); + + /* Find out how big the buffer for the wide-char title must be */ + length = uv_utf8_to_utf16(title, NULL, 0); + if (!length) { + err = GetLastError(); + goto done; + } + + /* Convert to wide-char string */ + title_w = (WCHAR*)uv__malloc(sizeof(WCHAR) * length); + if (!title_w) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + length = uv_utf8_to_utf16(title, title_w, length); + if (!length) { + err = GetLastError(); + goto done; + } + + /* If the title must be truncated insert a \0 terminator there */ + if (length > MAX_TITLE_LENGTH) { + title_w[MAX_TITLE_LENGTH - 1] = L'\0'; + } + + if (!SetConsoleTitleW(title_w)) { + err = GetLastError(); + goto done; + } + + EnterCriticalSection(&process_title_lock); + uv__free(process_title); + process_title = uv__strdup(title); + LeaveCriticalSection(&process_title_lock); + + err = 0; + +done: + uv__free(title_w); + return uv_translate_sys_error(err); +} + + +static int uv__get_process_title() { + WCHAR title_w[MAX_TITLE_LENGTH]; + int length; + + if (!GetConsoleTitleW(title_w, sizeof(title_w) / sizeof(WCHAR))) { + return -1; + } + + /* Find out what the size of the buffer is that we need */ + length = uv_utf16_to_utf8(title_w, -1, NULL, 0); + if (!length) { + return -1; + } + + assert(!process_title); + process_title = (char*)uv__malloc(length); + if (!process_title) { + uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); + } + + /* Do utf16 -> utf8 conversion here */ + if (!uv_utf16_to_utf8(title_w, -1, process_title, length)) { + uv__free(process_title); + return -1; + } + + return 0; +} + + +int uv_get_process_title(char* buffer, size_t size) { + uv__once_init(); + + EnterCriticalSection(&process_title_lock); + /* + * If the process_title was never read before nor explicitly set, + * we must query it with getConsoleTitleW + */ + if (!process_title && uv__get_process_title() == -1) { + LeaveCriticalSection(&process_title_lock); + return uv_translate_sys_error(GetLastError()); + } + + assert(process_title); + strncpy(buffer, process_title, size); + LeaveCriticalSection(&process_title_lock); + + return 0; +} + + +uint64_t uv_hrtime(void) { + uv__once_init(); + return uv__hrtime(UV__NANOSEC); +} + +uint64_t uv__hrtime(double scale) { + LARGE_INTEGER counter; + + /* If the performance interval is zero, there's no support. */ + if (hrtime_interval_ == 0) { + return 0; + } + + if (!QueryPerformanceCounter(&counter)) { + return 0; + } + + /* Because we have no guarantee about the order of magnitude of the + * performance counter interval, integer math could cause this computation + * to overflow. Therefore we resort to floating point math. + */ + return (uint64_t) ((double) counter.QuadPart * hrtime_interval_ * scale); +} + + +int uv_resident_set_memory(size_t* rss) { + HANDLE current_process; + PROCESS_MEMORY_COUNTERS pmc; + + current_process = GetCurrentProcess(); + + if (!GetProcessMemoryInfo(current_process, &pmc, sizeof(pmc))) { + return uv_translate_sys_error(GetLastError()); + } + + *rss = pmc.WorkingSetSize; + + return 0; +} + + +int uv_uptime(double* uptime) { + BYTE stack_buffer[4096]; + BYTE* malloced_buffer = NULL; + BYTE* buffer = (BYTE*) stack_buffer; + size_t buffer_size = sizeof(stack_buffer); + DWORD data_size; + + PERF_DATA_BLOCK* data_block; + PERF_OBJECT_TYPE* object_type; + PERF_COUNTER_DEFINITION* counter_definition; + + DWORD i; + + for (;;) { + LONG result; + + data_size = (DWORD) buffer_size; + result = RegQueryValueExW(HKEY_PERFORMANCE_DATA, + L"2", + NULL, + NULL, + buffer, + &data_size); + if (result == ERROR_SUCCESS) { + break; + } else if (result != ERROR_MORE_DATA) { + *uptime = 0; + return uv_translate_sys_error(result); + } + + buffer_size *= 2; + /* Don't let the buffer grow infinitely. */ + if (buffer_size > 1 << 20) { + goto internalError; + } + + uv__free(malloced_buffer); + + buffer = malloced_buffer = (BYTE*) uv__malloc(buffer_size); + if (malloced_buffer == NULL) { + *uptime = 0; + return UV_ENOMEM; + } + } + + if (data_size < sizeof(*data_block)) + goto internalError; + + data_block = (PERF_DATA_BLOCK*) buffer; + + if (wmemcmp(data_block->Signature, L"PERF", 4) != 0) + goto internalError; + + if (data_size < data_block->HeaderLength + sizeof(*object_type)) + goto internalError; + + object_type = (PERF_OBJECT_TYPE*) (buffer + data_block->HeaderLength); + + if (object_type->NumInstances != PERF_NO_INSTANCES) + goto internalError; + + counter_definition = (PERF_COUNTER_DEFINITION*) (buffer + + data_block->HeaderLength + object_type->HeaderLength); + for (i = 0; i < object_type->NumCounters; i++) { + if ((BYTE*) counter_definition + sizeof(*counter_definition) > + buffer + data_size) { + break; + } + + if (counter_definition->CounterNameTitleIndex == 674 && + counter_definition->CounterSize == sizeof(uint64_t)) { + if (counter_definition->CounterOffset + sizeof(uint64_t) > data_size || + !(counter_definition->CounterType & PERF_OBJECT_TIMER)) { + goto internalError; + } else { + BYTE* address = (BYTE*) object_type + object_type->DefinitionLength + + counter_definition->CounterOffset; + uint64_t value = *((uint64_t*) address); + *uptime = (double) (object_type->PerfTime.QuadPart - value) / + (double) object_type->PerfFreq.QuadPart; + uv__free(malloced_buffer); + return 0; + } + } + + counter_definition = (PERF_COUNTER_DEFINITION*) + ((BYTE*) counter_definition + counter_definition->ByteLength); + } + + /* If we get here, the uptime value was not found. */ + uv__free(malloced_buffer); + *uptime = 0; + return UV_ENOSYS; + + internalError: + uv__free(malloced_buffer); + *uptime = 0; + return UV_EIO; +} + + +int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) { + uv_cpu_info_t* cpu_infos; + SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* sppi; + DWORD sppi_size; + SYSTEM_INFO system_info; + DWORD cpu_count, r, i; + NTSTATUS status; + ULONG result_size; + int err; + uv_cpu_info_t* cpu_info; + + cpu_infos = NULL; + cpu_count = 0; + sppi = NULL; + + uv__once_init(); + + GetSystemInfo(&system_info); + cpu_count = system_info.dwNumberOfProcessors; + + cpu_infos = uv__calloc(cpu_count, sizeof *cpu_infos); + if (cpu_infos == NULL) { + err = ERROR_OUTOFMEMORY; + goto error; + } + + sppi_size = cpu_count * sizeof(*sppi); + sppi = uv__malloc(sppi_size); + if (sppi == NULL) { + err = ERROR_OUTOFMEMORY; + goto error; + } + + status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, + sppi, + sppi_size, + &result_size); + if (!NT_SUCCESS(status)) { + err = pRtlNtStatusToDosError(status); + goto error; + } + + assert(result_size == sppi_size); + + for (i = 0; i < cpu_count; i++) { + WCHAR key_name[128]; + HKEY processor_key; + DWORD cpu_speed; + DWORD cpu_speed_size = sizeof(cpu_speed); + WCHAR cpu_brand[256]; + DWORD cpu_brand_size = sizeof(cpu_brand); + size_t len; + + len = _snwprintf(key_name, + ARRAY_SIZE(key_name), + L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%d", + i); + + assert(len > 0 && len < ARRAY_SIZE(key_name)); + + r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + key_name, + 0, + KEY_QUERY_VALUE, + &processor_key); + if (r != ERROR_SUCCESS) { + err = GetLastError(); + goto error; + } + + if (RegQueryValueExW(processor_key, + L"~MHz", + NULL, + NULL, + (BYTE*) &cpu_speed, + &cpu_speed_size) != ERROR_SUCCESS) { + err = GetLastError(); + RegCloseKey(processor_key); + goto error; + } + + if (RegQueryValueExW(processor_key, + L"ProcessorNameString", + NULL, + NULL, + (BYTE*) &cpu_brand, + &cpu_brand_size) != ERROR_SUCCESS) { + err = GetLastError(); + RegCloseKey(processor_key); + goto error; + } + + RegCloseKey(processor_key); + + cpu_info = &cpu_infos[i]; + cpu_info->speed = cpu_speed; + cpu_info->cpu_times.user = sppi[i].UserTime.QuadPart / 10000; + cpu_info->cpu_times.sys = (sppi[i].KernelTime.QuadPart - + sppi[i].IdleTime.QuadPart) / 10000; + cpu_info->cpu_times.idle = sppi[i].IdleTime.QuadPart / 10000; + cpu_info->cpu_times.irq = sppi[i].InterruptTime.QuadPart / 10000; + cpu_info->cpu_times.nice = 0; + + + len = WideCharToMultiByte(CP_UTF8, + 0, + cpu_brand, + cpu_brand_size / sizeof(WCHAR), + NULL, + 0, + NULL, + NULL); + if (len == 0) { + err = GetLastError(); + goto error; + } + + assert(len > 0); + + /* Allocate 1 extra byte for the null terminator. */ + cpu_info->model = uv__malloc(len + 1); + if (cpu_info->model == NULL) { + err = ERROR_OUTOFMEMORY; + goto error; + } + + if (WideCharToMultiByte(CP_UTF8, + 0, + cpu_brand, + cpu_brand_size / sizeof(WCHAR), + cpu_info->model, + len, + NULL, + NULL) == 0) { + err = GetLastError(); + goto error; + } + + /* Ensure that cpu_info->model is null terminated. */ + cpu_info->model[len] = '\0'; + } + + uv__free(sppi); + + *cpu_count_ptr = cpu_count; + *cpu_infos_ptr = cpu_infos; + + return 0; + + error: + /* This is safe because the cpu_infos array is zeroed on allocation. */ + for (i = 0; i < cpu_count; i++) + uv__free(cpu_infos[i].model); + + uv__free(cpu_infos); + uv__free(sppi); + + return uv_translate_sys_error(err); +} + + +void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(cpu_infos[i].model); + } + + uv__free(cpu_infos); +} + + +static int is_windows_version_or_greater(DWORD os_major, + DWORD os_minor, + WORD service_pack_major, + WORD service_pack_minor) { + OSVERSIONINFOEX osvi; + DWORDLONG condition_mask = 0; + int op = VER_GREATER_EQUAL; + + /* Initialize the OSVERSIONINFOEX structure. */ + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + osvi.dwMajorVersion = os_major; + osvi.dwMinorVersion = os_minor; + osvi.wServicePackMajor = service_pack_major; + osvi.wServicePackMinor = service_pack_minor; + + /* Initialize the condition mask. */ + VER_SET_CONDITION(condition_mask, VER_MAJORVERSION, op); + VER_SET_CONDITION(condition_mask, VER_MINORVERSION, op); + VER_SET_CONDITION(condition_mask, VER_SERVICEPACKMAJOR, op); + VER_SET_CONDITION(condition_mask, VER_SERVICEPACKMINOR, op); + + /* Perform the test. */ + return (int) VerifyVersionInfo( + &osvi, + VER_MAJORVERSION | VER_MINORVERSION | + VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR, + condition_mask); +} + + +static int address_prefix_match(int family, + struct sockaddr* address, + struct sockaddr* prefix_address, + int prefix_len) { + uint8_t* address_data; + uint8_t* prefix_address_data; + int i; + + assert(address->sa_family == family); + assert(prefix_address->sa_family == family); + + if (family == AF_INET6) { + address_data = (uint8_t*) &(((struct sockaddr_in6 *) address)->sin6_addr); + prefix_address_data = + (uint8_t*) &(((struct sockaddr_in6 *) prefix_address)->sin6_addr); + } else { + address_data = (uint8_t*) &(((struct sockaddr_in *) address)->sin_addr); + prefix_address_data = + (uint8_t*) &(((struct sockaddr_in *) prefix_address)->sin_addr); + } + + for (i = 0; i < prefix_len >> 3; i++) { + if (address_data[i] != prefix_address_data[i]) + return 0; + } + + if (prefix_len % 8) + return prefix_address_data[i] == + (address_data[i] & (0xff << (8 - prefix_len % 8))); + + return 1; +} + + +int uv_interface_addresses(uv_interface_address_t** addresses_ptr, + int* count_ptr) { + IP_ADAPTER_ADDRESSES* win_address_buf; + ULONG win_address_buf_size; + IP_ADAPTER_ADDRESSES* adapter; + + uv_interface_address_t* uv_address_buf; + char* name_buf; + size_t uv_address_buf_size; + uv_interface_address_t* uv_address; + + int count; + + int is_vista_or_greater; + ULONG flags; + + is_vista_or_greater = is_windows_version_or_greater(6, 0, 0, 0); + if (is_vista_or_greater) { + flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | + GAA_FLAG_SKIP_DNS_SERVER; + } else { + /* We need at least XP SP1. */ + if (!is_windows_version_or_greater(5, 1, 1, 0)) + return UV_ENOTSUP; + + flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | + GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_INCLUDE_PREFIX; + } + + + /* Fetch the size of the adapters reported by windows, and then get the */ + /* list itself. */ + win_address_buf_size = 0; + win_address_buf = NULL; + + for (;;) { + ULONG r; + + /* If win_address_buf is 0, then GetAdaptersAddresses will fail with */ + /* ERROR_BUFFER_OVERFLOW, and the required buffer size will be stored in */ + /* win_address_buf_size. */ + r = GetAdaptersAddresses(AF_UNSPEC, + flags, + NULL, + win_address_buf, + &win_address_buf_size); + + if (r == ERROR_SUCCESS) + break; + + uv__free(win_address_buf); + + switch (r) { + case ERROR_BUFFER_OVERFLOW: + /* This happens when win_address_buf is NULL or too small to hold */ + /* all adapters. */ + win_address_buf = uv__malloc(win_address_buf_size); + if (win_address_buf == NULL) + return UV_ENOMEM; + + continue; + + case ERROR_NO_DATA: { + /* No adapters were found. */ + uv_address_buf = uv__malloc(1); + if (uv_address_buf == NULL) + return UV_ENOMEM; + + *count_ptr = 0; + *addresses_ptr = uv_address_buf; + + return 0; + } + + case ERROR_ADDRESS_NOT_ASSOCIATED: + return UV_EAGAIN; + + case ERROR_INVALID_PARAMETER: + /* MSDN says: + * "This error is returned for any of the following conditions: the + * SizePointer parameter is NULL, the Address parameter is not + * AF_INET, AF_INET6, or AF_UNSPEC, or the address information for + * the parameters requested is greater than ULONG_MAX." + * Since the first two conditions are not met, it must be that the + * adapter data is too big. + */ + return UV_ENOBUFS; + + default: + /* Other (unspecified) errors can happen, but we don't have any */ + /* special meaning for them. */ + assert(r != ERROR_SUCCESS); + return uv_translate_sys_error(r); + } + } + + /* Count the number of enabled interfaces and compute how much space is */ + /* needed to store their info. */ + count = 0; + uv_address_buf_size = 0; + + for (adapter = win_address_buf; + adapter != NULL; + adapter = adapter->Next) { + IP_ADAPTER_UNICAST_ADDRESS* unicast_address; + int name_size; + + /* Interfaces that are not 'up' should not be reported. Also skip */ + /* interfaces that have no associated unicast address, as to avoid */ + /* allocating space for the name for this interface. */ + if (adapter->OperStatus != IfOperStatusUp || + adapter->FirstUnicastAddress == NULL) + continue; + + /* Compute the size of the interface name. */ + name_size = WideCharToMultiByte(CP_UTF8, + 0, + adapter->FriendlyName, + -1, + NULL, + 0, + NULL, + FALSE); + if (name_size <= 0) { + uv__free(win_address_buf); + return uv_translate_sys_error(GetLastError()); + } + uv_address_buf_size += name_size; + + /* Count the number of addresses associated with this interface, and */ + /* compute the size. */ + for (unicast_address = (IP_ADAPTER_UNICAST_ADDRESS*) + adapter->FirstUnicastAddress; + unicast_address != NULL; + unicast_address = unicast_address->Next) { + count++; + uv_address_buf_size += sizeof(uv_interface_address_t); + } + } + + /* Allocate space to store interface data plus adapter names. */ + uv_address_buf = uv__malloc(uv_address_buf_size); + if (uv_address_buf == NULL) { + uv__free(win_address_buf); + return UV_ENOMEM; + } + + /* Compute the start of the uv_interface_address_t array, and the place in */ + /* the buffer where the interface names will be stored. */ + uv_address = uv_address_buf; + name_buf = (char*) (uv_address_buf + count); + + /* Fill out the output buffer. */ + for (adapter = win_address_buf; + adapter != NULL; + adapter = adapter->Next) { + IP_ADAPTER_UNICAST_ADDRESS* unicast_address; + int name_size; + size_t max_name_size; + + if (adapter->OperStatus != IfOperStatusUp || + adapter->FirstUnicastAddress == NULL) + continue; + + /* Convert the interface name to UTF8. */ + max_name_size = (char*) uv_address_buf + uv_address_buf_size - name_buf; + if (max_name_size > (size_t) INT_MAX) + max_name_size = INT_MAX; + name_size = WideCharToMultiByte(CP_UTF8, + 0, + adapter->FriendlyName, + -1, + name_buf, + (int) max_name_size, + NULL, + FALSE); + if (name_size <= 0) { + uv__free(win_address_buf); + uv__free(uv_address_buf); + return uv_translate_sys_error(GetLastError()); + } + + /* Add an uv_interface_address_t element for every unicast address. */ + for (unicast_address = (IP_ADAPTER_UNICAST_ADDRESS*) + adapter->FirstUnicastAddress; + unicast_address != NULL; + unicast_address = unicast_address->Next) { + struct sockaddr* sa; + ULONG prefix_len; + + sa = unicast_address->Address.lpSockaddr; + + /* XP has no OnLinkPrefixLength field. */ + if (is_vista_or_greater) { + prefix_len = + ((IP_ADAPTER_UNICAST_ADDRESS_LH*) unicast_address)->OnLinkPrefixLength; + } else { + /* Prior to Windows Vista the FirstPrefix pointed to the list with + * single prefix for each IP address assigned to the adapter. + * Order of FirstPrefix does not match order of FirstUnicastAddress, + * so we need to find corresponding prefix. + */ + IP_ADAPTER_PREFIX* prefix; + prefix_len = 0; + + for (prefix = adapter->FirstPrefix; prefix; prefix = prefix->Next) { + /* We want the longest matching prefix. */ + if (prefix->Address.lpSockaddr->sa_family != sa->sa_family || + prefix->PrefixLength <= prefix_len) + continue; + + if (address_prefix_match(sa->sa_family, sa, + prefix->Address.lpSockaddr, prefix->PrefixLength)) { + prefix_len = prefix->PrefixLength; + } + } + + /* If there is no matching prefix information, return a single-host + * subnet mask (e.g. 255.255.255.255 for IPv4). + */ + if (!prefix_len) + prefix_len = (sa->sa_family == AF_INET6) ? 128 : 32; + } + + memset(uv_address, 0, sizeof *uv_address); + + uv_address->name = name_buf; + + if (adapter->PhysicalAddressLength == sizeof(uv_address->phys_addr)) { + memcpy(uv_address->phys_addr, + adapter->PhysicalAddress, + sizeof(uv_address->phys_addr)); + } + + uv_address->is_internal = + (adapter->IfType == IF_TYPE_SOFTWARE_LOOPBACK); + + if (sa->sa_family == AF_INET6) { + uv_address->address.address6 = *((struct sockaddr_in6 *) sa); + + uv_address->netmask.netmask6.sin6_family = AF_INET6; + memset(uv_address->netmask.netmask6.sin6_addr.s6_addr, 0xff, prefix_len >> 3); + /* This check ensures that we don't write past the size of the data. */ + if (prefix_len % 8) { + uv_address->netmask.netmask6.sin6_addr.s6_addr[prefix_len >> 3] = + 0xff << (8 - prefix_len % 8); + } + + } else { + uv_address->address.address4 = *((struct sockaddr_in *) sa); + + uv_address->netmask.netmask4.sin_family = AF_INET; + uv_address->netmask.netmask4.sin_addr.s_addr = (prefix_len > 0) ? + htonl(0xffffffff << (32 - prefix_len)) : 0; + } + + uv_address++; + } + + name_buf += name_size; + } + + uv__free(win_address_buf); + + *addresses_ptr = uv_address_buf; + *count_ptr = count; + + return 0; +} + + +void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count) { + uv__free(addresses); +} + + +int uv_getrusage(uv_rusage_t *uv_rusage) { + FILETIME createTime, exitTime, kernelTime, userTime; + SYSTEMTIME kernelSystemTime, userSystemTime; + int ret; + + ret = GetProcessTimes(GetCurrentProcess(), &createTime, &exitTime, &kernelTime, &userTime); + if (ret == 0) { + return uv_translate_sys_error(GetLastError()); + } + + ret = FileTimeToSystemTime(&kernelTime, &kernelSystemTime); + if (ret == 0) { + return uv_translate_sys_error(GetLastError()); + } + + ret = FileTimeToSystemTime(&userTime, &userSystemTime); + if (ret == 0) { + return uv_translate_sys_error(GetLastError()); + } + + memset(uv_rusage, 0, sizeof(*uv_rusage)); + + uv_rusage->ru_utime.tv_sec = userSystemTime.wHour * 3600 + + userSystemTime.wMinute * 60 + + userSystemTime.wSecond; + uv_rusage->ru_utime.tv_usec = userSystemTime.wMilliseconds * 1000; + + uv_rusage->ru_stime.tv_sec = kernelSystemTime.wHour * 3600 + + kernelSystemTime.wMinute * 60 + + kernelSystemTime.wSecond; + uv_rusage->ru_stime.tv_usec = kernelSystemTime.wMilliseconds * 1000; + + return 0; +} + + +int uv_os_homedir(char* buffer, size_t* size) { + HANDLE token; + wchar_t path[MAX_PATH]; + DWORD bufsize; + size_t len; + int r; + + if (buffer == NULL || size == NULL || *size == 0) + return UV_EINVAL; + + /* Check if the USERPROFILE environment variable is set first */ + len = GetEnvironmentVariableW(L"USERPROFILE", path, MAX_PATH); + + if (len == 0) { + r = GetLastError(); + /* Don't return an error if USERPROFILE was not found */ + if (r != ERROR_ENVVAR_NOT_FOUND) + return uv_translate_sys_error(r); + } else if (len > MAX_PATH) { + /* This should not be possible */ + return UV_EIO; + } else { + goto convert_buffer; + } + + /* USERPROFILE is not set, so call GetUserProfileDirectoryW() */ + if (OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &token) == 0) + return uv_translate_sys_error(GetLastError()); + + bufsize = MAX_PATH; + if (!GetUserProfileDirectoryW(token, path, &bufsize)) { + r = GetLastError(); + CloseHandle(token); + + /* This should not be possible */ + if (r == ERROR_INSUFFICIENT_BUFFER) + return UV_EIO; + + return uv_translate_sys_error(r); + } + + CloseHandle(token); + +convert_buffer: + + /* Check how much space we need */ + bufsize = uv_utf16_to_utf8(path, -1, NULL, 0); + if (bufsize == 0) { + return uv_translate_sys_error(GetLastError()); + } else if (bufsize > *size) { + *size = bufsize - 1; + return UV_ENOBUFS; + } + + /* Convert to UTF-8 */ + bufsize = uv_utf16_to_utf8(path, -1, buffer, *size); + if (bufsize == 0) + return uv_translate_sys_error(GetLastError()); + + *size = bufsize - 1; + return 0; +} diff --git a/3rdparty/libuv/src/win/winapi.c b/3rdparty/libuv/src/win/winapi.c new file mode 100644 index 00000000000..26bd0648668 --- /dev/null +++ b/3rdparty/libuv/src/win/winapi.c @@ -0,0 +1,146 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include + +#include "uv.h" +#include "internal.h" + + +/* Ntdll function pointers */ +sRtlNtStatusToDosError pRtlNtStatusToDosError; +sNtDeviceIoControlFile pNtDeviceIoControlFile; +sNtQueryInformationFile pNtQueryInformationFile; +sNtSetInformationFile pNtSetInformationFile; +sNtQueryVolumeInformationFile pNtQueryVolumeInformationFile; +sNtQueryDirectoryFile pNtQueryDirectoryFile; +sNtQuerySystemInformation pNtQuerySystemInformation; + + +/* Kernel32 function pointers */ +sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx; +sSetFileCompletionNotificationModes pSetFileCompletionNotificationModes; +sCreateSymbolicLinkW pCreateSymbolicLinkW; +sCancelIoEx pCancelIoEx; +sInitializeConditionVariable pInitializeConditionVariable; +sSleepConditionVariableCS pSleepConditionVariableCS; +sSleepConditionVariableSRW pSleepConditionVariableSRW; +sWakeAllConditionVariable pWakeAllConditionVariable; +sWakeConditionVariable pWakeConditionVariable; +sCancelSynchronousIo pCancelSynchronousIo; +sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW; + + +void uv_winapi_init() { + HMODULE ntdll_module; + HMODULE kernel32_module; + + ntdll_module = GetModuleHandleA("ntdll.dll"); + if (ntdll_module == NULL) { + uv_fatal_error(GetLastError(), "GetModuleHandleA"); + } + + pRtlNtStatusToDosError = (sRtlNtStatusToDosError) GetProcAddress( + ntdll_module, + "RtlNtStatusToDosError"); + if (pRtlNtStatusToDosError == NULL) { + uv_fatal_error(GetLastError(), "GetProcAddress"); + } + + pNtDeviceIoControlFile = (sNtDeviceIoControlFile) GetProcAddress( + ntdll_module, + "NtDeviceIoControlFile"); + if (pNtDeviceIoControlFile == NULL) { + uv_fatal_error(GetLastError(), "GetProcAddress"); + } + + pNtQueryInformationFile = (sNtQueryInformationFile) GetProcAddress( + ntdll_module, + "NtQueryInformationFile"); + if (pNtQueryInformationFile == NULL) { + uv_fatal_error(GetLastError(), "GetProcAddress"); + } + + pNtSetInformationFile = (sNtSetInformationFile) GetProcAddress( + ntdll_module, + "NtSetInformationFile"); + if (pNtSetInformationFile == NULL) { + uv_fatal_error(GetLastError(), "GetProcAddress"); + } + + pNtQueryVolumeInformationFile = (sNtQueryVolumeInformationFile) + GetProcAddress(ntdll_module, "NtQueryVolumeInformationFile"); + if (pNtQueryVolumeInformationFile == NULL) { + uv_fatal_error(GetLastError(), "GetProcAddress"); + } + + pNtQueryDirectoryFile = (sNtQueryDirectoryFile) + GetProcAddress(ntdll_module, "NtQueryDirectoryFile"); + if (pNtQueryVolumeInformationFile == NULL) { + uv_fatal_error(GetLastError(), "GetProcAddress"); + } + + pNtQuerySystemInformation = (sNtQuerySystemInformation) GetProcAddress( + ntdll_module, + "NtQuerySystemInformation"); + if (pNtQuerySystemInformation == NULL) { + uv_fatal_error(GetLastError(), "GetProcAddress"); + } + + kernel32_module = GetModuleHandleA("kernel32.dll"); + if (kernel32_module == NULL) { + uv_fatal_error(GetLastError(), "GetModuleHandleA"); + } + + pGetQueuedCompletionStatusEx = (sGetQueuedCompletionStatusEx) GetProcAddress( + kernel32_module, + "GetQueuedCompletionStatusEx"); + + pSetFileCompletionNotificationModes = (sSetFileCompletionNotificationModes) + GetProcAddress(kernel32_module, "SetFileCompletionNotificationModes"); + + pCreateSymbolicLinkW = (sCreateSymbolicLinkW) + GetProcAddress(kernel32_module, "CreateSymbolicLinkW"); + + pCancelIoEx = (sCancelIoEx) + GetProcAddress(kernel32_module, "CancelIoEx"); + + pInitializeConditionVariable = (sInitializeConditionVariable) + GetProcAddress(kernel32_module, "InitializeConditionVariable"); + + pSleepConditionVariableCS = (sSleepConditionVariableCS) + GetProcAddress(kernel32_module, "SleepConditionVariableCS"); + + pSleepConditionVariableSRW = (sSleepConditionVariableSRW) + GetProcAddress(kernel32_module, "SleepConditionVariableSRW"); + + pWakeAllConditionVariable = (sWakeAllConditionVariable) + GetProcAddress(kernel32_module, "WakeAllConditionVariable"); + + pWakeConditionVariable = (sWakeConditionVariable) + GetProcAddress(kernel32_module, "WakeConditionVariable"); + + pCancelSynchronousIo = (sCancelSynchronousIo) + GetProcAddress(kernel32_module, "CancelSynchronousIo"); + + pGetFinalPathNameByHandleW = (sGetFinalPathNameByHandleW) + GetProcAddress(kernel32_module, "GetFinalPathNameByHandleW"); +} diff --git a/3rdparty/libuv/src/win/winapi.h b/3rdparty/libuv/src/win/winapi.h new file mode 100644 index 00000000000..122198a6d48 --- /dev/null +++ b/3rdparty/libuv/src/win/winapi.h @@ -0,0 +1,4710 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_WIN_WINAPI_H_ +#define UV_WIN_WINAPI_H_ + +#include + + +/* + * Ntdll headers + */ +#ifndef STATUS_SEVERITY_SUCCESS +# define STATUS_SEVERITY_SUCCESS 0x0 +#endif + +#ifndef STATUS_SEVERITY_INFORMATIONAL +# define STATUS_SEVERITY_INFORMATIONAL 0x1 +#endif + +#ifndef STATUS_SEVERITY_WARNING +# define STATUS_SEVERITY_WARNING 0x2 +#endif + +#ifndef STATUS_SEVERITY_ERROR +# define STATUS_SEVERITY_ERROR 0x3 +#endif + +#ifndef FACILITY_NTWIN32 +# define FACILITY_NTWIN32 0x7 +#endif + +#ifndef NT_SUCCESS +# define NT_SUCCESS(status) (((NTSTATUS) (status)) >= 0) +#endif + +#ifndef NT_INFORMATION +# define NT_INFORMATION(status) ((((ULONG) (status)) >> 30) == 1) +#endif + +#ifndef NT_WARNING +# define NT_WARNING(status) ((((ULONG) (status)) >> 30) == 2) +#endif + +#ifndef NT_ERROR +# define NT_ERROR(status) ((((ULONG) (status)) >> 30) == 3) +#endif + +#ifndef STATUS_SUCCESS +# define STATUS_SUCCESS ((NTSTATUS) 0x00000000L) +#endif + +#ifndef STATUS_WAIT_0 +# define STATUS_WAIT_0 ((NTSTATUS) 0x00000000L) +#endif + +#ifndef STATUS_WAIT_1 +# define STATUS_WAIT_1 ((NTSTATUS) 0x00000001L) +#endif + +#ifndef STATUS_WAIT_2 +# define STATUS_WAIT_2 ((NTSTATUS) 0x00000002L) +#endif + +#ifndef STATUS_WAIT_3 +# define STATUS_WAIT_3 ((NTSTATUS) 0x00000003L) +#endif + +#ifndef STATUS_WAIT_63 +# define STATUS_WAIT_63 ((NTSTATUS) 0x0000003FL) +#endif + +#ifndef STATUS_ABANDONED +# define STATUS_ABANDONED ((NTSTATUS) 0x00000080L) +#endif + +#ifndef STATUS_ABANDONED_WAIT_0 +# define STATUS_ABANDONED_WAIT_0 ((NTSTATUS) 0x00000080L) +#endif + +#ifndef STATUS_ABANDONED_WAIT_63 +# define STATUS_ABANDONED_WAIT_63 ((NTSTATUS) 0x000000BFL) +#endif + +#ifndef STATUS_USER_APC +# define STATUS_USER_APC ((NTSTATUS) 0x000000C0L) +#endif + +#ifndef STATUS_KERNEL_APC +# define STATUS_KERNEL_APC ((NTSTATUS) 0x00000100L) +#endif + +#ifndef STATUS_ALERTED +# define STATUS_ALERTED ((NTSTATUS) 0x00000101L) +#endif + +#ifndef STATUS_TIMEOUT +# define STATUS_TIMEOUT ((NTSTATUS) 0x00000102L) +#endif + +#ifndef STATUS_PENDING +# define STATUS_PENDING ((NTSTATUS) 0x00000103L) +#endif + +#ifndef STATUS_REPARSE +# define STATUS_REPARSE ((NTSTATUS) 0x00000104L) +#endif + +#ifndef STATUS_MORE_ENTRIES +# define STATUS_MORE_ENTRIES ((NTSTATUS) 0x00000105L) +#endif + +#ifndef STATUS_NOT_ALL_ASSIGNED +# define STATUS_NOT_ALL_ASSIGNED ((NTSTATUS) 0x00000106L) +#endif + +#ifndef STATUS_SOME_NOT_MAPPED +# define STATUS_SOME_NOT_MAPPED ((NTSTATUS) 0x00000107L) +#endif + +#ifndef STATUS_OPLOCK_BREAK_IN_PROGRESS +# define STATUS_OPLOCK_BREAK_IN_PROGRESS ((NTSTATUS) 0x00000108L) +#endif + +#ifndef STATUS_VOLUME_MOUNTED +# define STATUS_VOLUME_MOUNTED ((NTSTATUS) 0x00000109L) +#endif + +#ifndef STATUS_RXACT_COMMITTED +# define STATUS_RXACT_COMMITTED ((NTSTATUS) 0x0000010AL) +#endif + +#ifndef STATUS_NOTIFY_CLEANUP +# define STATUS_NOTIFY_CLEANUP ((NTSTATUS) 0x0000010BL) +#endif + +#ifndef STATUS_NOTIFY_ENUM_DIR +# define STATUS_NOTIFY_ENUM_DIR ((NTSTATUS) 0x0000010CL) +#endif + +#ifndef STATUS_NO_QUOTAS_FOR_ACCOUNT +# define STATUS_NO_QUOTAS_FOR_ACCOUNT ((NTSTATUS) 0x0000010DL) +#endif + +#ifndef STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED +# define STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED ((NTSTATUS) 0x0000010EL) +#endif + +#ifndef STATUS_PAGE_FAULT_TRANSITION +# define STATUS_PAGE_FAULT_TRANSITION ((NTSTATUS) 0x00000110L) +#endif + +#ifndef STATUS_PAGE_FAULT_DEMAND_ZERO +# define STATUS_PAGE_FAULT_DEMAND_ZERO ((NTSTATUS) 0x00000111L) +#endif + +#ifndef STATUS_PAGE_FAULT_COPY_ON_WRITE +# define STATUS_PAGE_FAULT_COPY_ON_WRITE ((NTSTATUS) 0x00000112L) +#endif + +#ifndef STATUS_PAGE_FAULT_GUARD_PAGE +# define STATUS_PAGE_FAULT_GUARD_PAGE ((NTSTATUS) 0x00000113L) +#endif + +#ifndef STATUS_PAGE_FAULT_PAGING_FILE +# define STATUS_PAGE_FAULT_PAGING_FILE ((NTSTATUS) 0x00000114L) +#endif + +#ifndef STATUS_CACHE_PAGE_LOCKED +# define STATUS_CACHE_PAGE_LOCKED ((NTSTATUS) 0x00000115L) +#endif + +#ifndef STATUS_CRASH_DUMP +# define STATUS_CRASH_DUMP ((NTSTATUS) 0x00000116L) +#endif + +#ifndef STATUS_BUFFER_ALL_ZEROS +# define STATUS_BUFFER_ALL_ZEROS ((NTSTATUS) 0x00000117L) +#endif + +#ifndef STATUS_REPARSE_OBJECT +# define STATUS_REPARSE_OBJECT ((NTSTATUS) 0x00000118L) +#endif + +#ifndef STATUS_RESOURCE_REQUIREMENTS_CHANGED +# define STATUS_RESOURCE_REQUIREMENTS_CHANGED ((NTSTATUS) 0x00000119L) +#endif + +#ifndef STATUS_TRANSLATION_COMPLETE +# define STATUS_TRANSLATION_COMPLETE ((NTSTATUS) 0x00000120L) +#endif + +#ifndef STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY +# define STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY ((NTSTATUS) 0x00000121L) +#endif + +#ifndef STATUS_NOTHING_TO_TERMINATE +# define STATUS_NOTHING_TO_TERMINATE ((NTSTATUS) 0x00000122L) +#endif + +#ifndef STATUS_PROCESS_NOT_IN_JOB +# define STATUS_PROCESS_NOT_IN_JOB ((NTSTATUS) 0x00000123L) +#endif + +#ifndef STATUS_PROCESS_IN_JOB +# define STATUS_PROCESS_IN_JOB ((NTSTATUS) 0x00000124L) +#endif + +#ifndef STATUS_VOLSNAP_HIBERNATE_READY +# define STATUS_VOLSNAP_HIBERNATE_READY ((NTSTATUS) 0x00000125L) +#endif + +#ifndef STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY +# define STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY ((NTSTATUS) 0x00000126L) +#endif + +#ifndef STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED +# define STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED ((NTSTATUS) 0x00000127L) +#endif + +#ifndef STATUS_INTERRUPT_STILL_CONNECTED +# define STATUS_INTERRUPT_STILL_CONNECTED ((NTSTATUS) 0x00000128L) +#endif + +#ifndef STATUS_PROCESS_CLONED +# define STATUS_PROCESS_CLONED ((NTSTATUS) 0x00000129L) +#endif + +#ifndef STATUS_FILE_LOCKED_WITH_ONLY_READERS +# define STATUS_FILE_LOCKED_WITH_ONLY_READERS ((NTSTATUS) 0x0000012AL) +#endif + +#ifndef STATUS_FILE_LOCKED_WITH_WRITERS +# define STATUS_FILE_LOCKED_WITH_WRITERS ((NTSTATUS) 0x0000012BL) +#endif + +#ifndef STATUS_RESOURCEMANAGER_READ_ONLY +# define STATUS_RESOURCEMANAGER_READ_ONLY ((NTSTATUS) 0x00000202L) +#endif + +#ifndef STATUS_RING_PREVIOUSLY_EMPTY +# define STATUS_RING_PREVIOUSLY_EMPTY ((NTSTATUS) 0x00000210L) +#endif + +#ifndef STATUS_RING_PREVIOUSLY_FULL +# define STATUS_RING_PREVIOUSLY_FULL ((NTSTATUS) 0x00000211L) +#endif + +#ifndef STATUS_RING_PREVIOUSLY_ABOVE_QUOTA +# define STATUS_RING_PREVIOUSLY_ABOVE_QUOTA ((NTSTATUS) 0x00000212L) +#endif + +#ifndef STATUS_RING_NEWLY_EMPTY +# define STATUS_RING_NEWLY_EMPTY ((NTSTATUS) 0x00000213L) +#endif + +#ifndef STATUS_RING_SIGNAL_OPPOSITE_ENDPOINT +# define STATUS_RING_SIGNAL_OPPOSITE_ENDPOINT ((NTSTATUS) 0x00000214L) +#endif + +#ifndef STATUS_OPLOCK_SWITCHED_TO_NEW_HANDLE +# define STATUS_OPLOCK_SWITCHED_TO_NEW_HANDLE ((NTSTATUS) 0x00000215L) +#endif + +#ifndef STATUS_OPLOCK_HANDLE_CLOSED +# define STATUS_OPLOCK_HANDLE_CLOSED ((NTSTATUS) 0x00000216L) +#endif + +#ifndef STATUS_WAIT_FOR_OPLOCK +# define STATUS_WAIT_FOR_OPLOCK ((NTSTATUS) 0x00000367L) +#endif + +#ifndef STATUS_OBJECT_NAME_EXISTS +# define STATUS_OBJECT_NAME_EXISTS ((NTSTATUS) 0x40000000L) +#endif + +#ifndef STATUS_THREAD_WAS_SUSPENDED +# define STATUS_THREAD_WAS_SUSPENDED ((NTSTATUS) 0x40000001L) +#endif + +#ifndef STATUS_WORKING_SET_LIMIT_RANGE +# define STATUS_WORKING_SET_LIMIT_RANGE ((NTSTATUS) 0x40000002L) +#endif + +#ifndef STATUS_IMAGE_NOT_AT_BASE +# define STATUS_IMAGE_NOT_AT_BASE ((NTSTATUS) 0x40000003L) +#endif + +#ifndef STATUS_RXACT_STATE_CREATED +# define STATUS_RXACT_STATE_CREATED ((NTSTATUS) 0x40000004L) +#endif + +#ifndef STATUS_SEGMENT_NOTIFICATION +# define STATUS_SEGMENT_NOTIFICATION ((NTSTATUS) 0x40000005L) +#endif + +#ifndef STATUS_LOCAL_USER_SESSION_KEY +# define STATUS_LOCAL_USER_SESSION_KEY ((NTSTATUS) 0x40000006L) +#endif + +#ifndef STATUS_BAD_CURRENT_DIRECTORY +# define STATUS_BAD_CURRENT_DIRECTORY ((NTSTATUS) 0x40000007L) +#endif + +#ifndef STATUS_SERIAL_MORE_WRITES +# define STATUS_SERIAL_MORE_WRITES ((NTSTATUS) 0x40000008L) +#endif + +#ifndef STATUS_REGISTRY_RECOVERED +# define STATUS_REGISTRY_RECOVERED ((NTSTATUS) 0x40000009L) +#endif + +#ifndef STATUS_FT_READ_RECOVERY_FROM_BACKUP +# define STATUS_FT_READ_RECOVERY_FROM_BACKUP ((NTSTATUS) 0x4000000AL) +#endif + +#ifndef STATUS_FT_WRITE_RECOVERY +# define STATUS_FT_WRITE_RECOVERY ((NTSTATUS) 0x4000000BL) +#endif + +#ifndef STATUS_SERIAL_COUNTER_TIMEOUT +# define STATUS_SERIAL_COUNTER_TIMEOUT ((NTSTATUS) 0x4000000CL) +#endif + +#ifndef STATUS_NULL_LM_PASSWORD +# define STATUS_NULL_LM_PASSWORD ((NTSTATUS) 0x4000000DL) +#endif + +#ifndef STATUS_IMAGE_MACHINE_TYPE_MISMATCH +# define STATUS_IMAGE_MACHINE_TYPE_MISMATCH ((NTSTATUS) 0x4000000EL) +#endif + +#ifndef STATUS_RECEIVE_PARTIAL +# define STATUS_RECEIVE_PARTIAL ((NTSTATUS) 0x4000000FL) +#endif + +#ifndef STATUS_RECEIVE_EXPEDITED +# define STATUS_RECEIVE_EXPEDITED ((NTSTATUS) 0x40000010L) +#endif + +#ifndef STATUS_RECEIVE_PARTIAL_EXPEDITED +# define STATUS_RECEIVE_PARTIAL_EXPEDITED ((NTSTATUS) 0x40000011L) +#endif + +#ifndef STATUS_EVENT_DONE +# define STATUS_EVENT_DONE ((NTSTATUS) 0x40000012L) +#endif + +#ifndef STATUS_EVENT_PENDING +# define STATUS_EVENT_PENDING ((NTSTATUS) 0x40000013L) +#endif + +#ifndef STATUS_CHECKING_FILE_SYSTEM +# define STATUS_CHECKING_FILE_SYSTEM ((NTSTATUS) 0x40000014L) +#endif + +#ifndef STATUS_FATAL_APP_EXIT +# define STATUS_FATAL_APP_EXIT ((NTSTATUS) 0x40000015L) +#endif + +#ifndef STATUS_PREDEFINED_HANDLE +# define STATUS_PREDEFINED_HANDLE ((NTSTATUS) 0x40000016L) +#endif + +#ifndef STATUS_WAS_UNLOCKED +# define STATUS_WAS_UNLOCKED ((NTSTATUS) 0x40000017L) +#endif + +#ifndef STATUS_SERVICE_NOTIFICATION +# define STATUS_SERVICE_NOTIFICATION ((NTSTATUS) 0x40000018L) +#endif + +#ifndef STATUS_WAS_LOCKED +# define STATUS_WAS_LOCKED ((NTSTATUS) 0x40000019L) +#endif + +#ifndef STATUS_LOG_HARD_ERROR +# define STATUS_LOG_HARD_ERROR ((NTSTATUS) 0x4000001AL) +#endif + +#ifndef STATUS_ALREADY_WIN32 +# define STATUS_ALREADY_WIN32 ((NTSTATUS) 0x4000001BL) +#endif + +#ifndef STATUS_WX86_UNSIMULATE +# define STATUS_WX86_UNSIMULATE ((NTSTATUS) 0x4000001CL) +#endif + +#ifndef STATUS_WX86_CONTINUE +# define STATUS_WX86_CONTINUE ((NTSTATUS) 0x4000001DL) +#endif + +#ifndef STATUS_WX86_SINGLE_STEP +# define STATUS_WX86_SINGLE_STEP ((NTSTATUS) 0x4000001EL) +#endif + +#ifndef STATUS_WX86_BREAKPOINT +# define STATUS_WX86_BREAKPOINT ((NTSTATUS) 0x4000001FL) +#endif + +#ifndef STATUS_WX86_EXCEPTION_CONTINUE +# define STATUS_WX86_EXCEPTION_CONTINUE ((NTSTATUS) 0x40000020L) +#endif + +#ifndef STATUS_WX86_EXCEPTION_LASTCHANCE +# define STATUS_WX86_EXCEPTION_LASTCHANCE ((NTSTATUS) 0x40000021L) +#endif + +#ifndef STATUS_WX86_EXCEPTION_CHAIN +# define STATUS_WX86_EXCEPTION_CHAIN ((NTSTATUS) 0x40000022L) +#endif + +#ifndef STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE +# define STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE ((NTSTATUS) 0x40000023L) +#endif + +#ifndef STATUS_NO_YIELD_PERFORMED +# define STATUS_NO_YIELD_PERFORMED ((NTSTATUS) 0x40000024L) +#endif + +#ifndef STATUS_TIMER_RESUME_IGNORED +# define STATUS_TIMER_RESUME_IGNORED ((NTSTATUS) 0x40000025L) +#endif + +#ifndef STATUS_ARBITRATION_UNHANDLED +# define STATUS_ARBITRATION_UNHANDLED ((NTSTATUS) 0x40000026L) +#endif + +#ifndef STATUS_CARDBUS_NOT_SUPPORTED +# define STATUS_CARDBUS_NOT_SUPPORTED ((NTSTATUS) 0x40000027L) +#endif + +#ifndef STATUS_WX86_CREATEWX86TIB +# define STATUS_WX86_CREATEWX86TIB ((NTSTATUS) 0x40000028L) +#endif + +#ifndef STATUS_MP_PROCESSOR_MISMATCH +# define STATUS_MP_PROCESSOR_MISMATCH ((NTSTATUS) 0x40000029L) +#endif + +#ifndef STATUS_HIBERNATED +# define STATUS_HIBERNATED ((NTSTATUS) 0x4000002AL) +#endif + +#ifndef STATUS_RESUME_HIBERNATION +# define STATUS_RESUME_HIBERNATION ((NTSTATUS) 0x4000002BL) +#endif + +#ifndef STATUS_FIRMWARE_UPDATED +# define STATUS_FIRMWARE_UPDATED ((NTSTATUS) 0x4000002CL) +#endif + +#ifndef STATUS_DRIVERS_LEAKING_LOCKED_PAGES +# define STATUS_DRIVERS_LEAKING_LOCKED_PAGES ((NTSTATUS) 0x4000002DL) +#endif + +#ifndef STATUS_MESSAGE_RETRIEVED +# define STATUS_MESSAGE_RETRIEVED ((NTSTATUS) 0x4000002EL) +#endif + +#ifndef STATUS_SYSTEM_POWERSTATE_TRANSITION +# define STATUS_SYSTEM_POWERSTATE_TRANSITION ((NTSTATUS) 0x4000002FL) +#endif + +#ifndef STATUS_ALPC_CHECK_COMPLETION_LIST +# define STATUS_ALPC_CHECK_COMPLETION_LIST ((NTSTATUS) 0x40000030L) +#endif + +#ifndef STATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION +# define STATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION ((NTSTATUS) 0x40000031L) +#endif + +#ifndef STATUS_ACCESS_AUDIT_BY_POLICY +# define STATUS_ACCESS_AUDIT_BY_POLICY ((NTSTATUS) 0x40000032L) +#endif + +#ifndef STATUS_ABANDON_HIBERFILE +# define STATUS_ABANDON_HIBERFILE ((NTSTATUS) 0x40000033L) +#endif + +#ifndef STATUS_BIZRULES_NOT_ENABLED +# define STATUS_BIZRULES_NOT_ENABLED ((NTSTATUS) 0x40000034L) +#endif + +#ifndef STATUS_GUARD_PAGE_VIOLATION +# define STATUS_GUARD_PAGE_VIOLATION ((NTSTATUS) 0x80000001L) +#endif + +#ifndef STATUS_DATATYPE_MISALIGNMENT +# define STATUS_DATATYPE_MISALIGNMENT ((NTSTATUS) 0x80000002L) +#endif + +#ifndef STATUS_BREAKPOINT +# define STATUS_BREAKPOINT ((NTSTATUS) 0x80000003L) +#endif + +#ifndef STATUS_SINGLE_STEP +# define STATUS_SINGLE_STEP ((NTSTATUS) 0x80000004L) +#endif + +#ifndef STATUS_BUFFER_OVERFLOW +# define STATUS_BUFFER_OVERFLOW ((NTSTATUS) 0x80000005L) +#endif + +#ifndef STATUS_NO_MORE_FILES +# define STATUS_NO_MORE_FILES ((NTSTATUS) 0x80000006L) +#endif + +#ifndef STATUS_WAKE_SYSTEM_DEBUGGER +# define STATUS_WAKE_SYSTEM_DEBUGGER ((NTSTATUS) 0x80000007L) +#endif + +#ifndef STATUS_HANDLES_CLOSED +# define STATUS_HANDLES_CLOSED ((NTSTATUS) 0x8000000AL) +#endif + +#ifndef STATUS_NO_INHERITANCE +# define STATUS_NO_INHERITANCE ((NTSTATUS) 0x8000000BL) +#endif + +#ifndef STATUS_GUID_SUBSTITUTION_MADE +# define STATUS_GUID_SUBSTITUTION_MADE ((NTSTATUS) 0x8000000CL) +#endif + +#ifndef STATUS_PARTIAL_COPY +# define STATUS_PARTIAL_COPY ((NTSTATUS) 0x8000000DL) +#endif + +#ifndef STATUS_DEVICE_PAPER_EMPTY +# define STATUS_DEVICE_PAPER_EMPTY ((NTSTATUS) 0x8000000EL) +#endif + +#ifndef STATUS_DEVICE_POWERED_OFF +# define STATUS_DEVICE_POWERED_OFF ((NTSTATUS) 0x8000000FL) +#endif + +#ifndef STATUS_DEVICE_OFF_LINE +# define STATUS_DEVICE_OFF_LINE ((NTSTATUS) 0x80000010L) +#endif + +#ifndef STATUS_DEVICE_BUSY +# define STATUS_DEVICE_BUSY ((NTSTATUS) 0x80000011L) +#endif + +#ifndef STATUS_NO_MORE_EAS +# define STATUS_NO_MORE_EAS ((NTSTATUS) 0x80000012L) +#endif + +#ifndef STATUS_INVALID_EA_NAME +# define STATUS_INVALID_EA_NAME ((NTSTATUS) 0x80000013L) +#endif + +#ifndef STATUS_EA_LIST_INCONSISTENT +# define STATUS_EA_LIST_INCONSISTENT ((NTSTATUS) 0x80000014L) +#endif + +#ifndef STATUS_INVALID_EA_FLAG +# define STATUS_INVALID_EA_FLAG ((NTSTATUS) 0x80000015L) +#endif + +#ifndef STATUS_VERIFY_REQUIRED +# define STATUS_VERIFY_REQUIRED ((NTSTATUS) 0x80000016L) +#endif + +#ifndef STATUS_EXTRANEOUS_INFORMATION +# define STATUS_EXTRANEOUS_INFORMATION ((NTSTATUS) 0x80000017L) +#endif + +#ifndef STATUS_RXACT_COMMIT_NECESSARY +# define STATUS_RXACT_COMMIT_NECESSARY ((NTSTATUS) 0x80000018L) +#endif + +#ifndef STATUS_NO_MORE_ENTRIES +# define STATUS_NO_MORE_ENTRIES ((NTSTATUS) 0x8000001AL) +#endif + +#ifndef STATUS_FILEMARK_DETECTED +# define STATUS_FILEMARK_DETECTED ((NTSTATUS) 0x8000001BL) +#endif + +#ifndef STATUS_MEDIA_CHANGED +# define STATUS_MEDIA_CHANGED ((NTSTATUS) 0x8000001CL) +#endif + +#ifndef STATUS_BUS_RESET +# define STATUS_BUS_RESET ((NTSTATUS) 0x8000001DL) +#endif + +#ifndef STATUS_END_OF_MEDIA +# define STATUS_END_OF_MEDIA ((NTSTATUS) 0x8000001EL) +#endif + +#ifndef STATUS_BEGINNING_OF_MEDIA +# define STATUS_BEGINNING_OF_MEDIA ((NTSTATUS) 0x8000001FL) +#endif + +#ifndef STATUS_MEDIA_CHECK +# define STATUS_MEDIA_CHECK ((NTSTATUS) 0x80000020L) +#endif + +#ifndef STATUS_SETMARK_DETECTED +# define STATUS_SETMARK_DETECTED ((NTSTATUS) 0x80000021L) +#endif + +#ifndef STATUS_NO_DATA_DETECTED +# define STATUS_NO_DATA_DETECTED ((NTSTATUS) 0x80000022L) +#endif + +#ifndef STATUS_REDIRECTOR_HAS_OPEN_HANDLES +# define STATUS_REDIRECTOR_HAS_OPEN_HANDLES ((NTSTATUS) 0x80000023L) +#endif + +#ifndef STATUS_SERVER_HAS_OPEN_HANDLES +# define STATUS_SERVER_HAS_OPEN_HANDLES ((NTSTATUS) 0x80000024L) +#endif + +#ifndef STATUS_ALREADY_DISCONNECTED +# define STATUS_ALREADY_DISCONNECTED ((NTSTATUS) 0x80000025L) +#endif + +#ifndef STATUS_LONGJUMP +# define STATUS_LONGJUMP ((NTSTATUS) 0x80000026L) +#endif + +#ifndef STATUS_CLEANER_CARTRIDGE_INSTALLED +# define STATUS_CLEANER_CARTRIDGE_INSTALLED ((NTSTATUS) 0x80000027L) +#endif + +#ifndef STATUS_PLUGPLAY_QUERY_VETOED +# define STATUS_PLUGPLAY_QUERY_VETOED ((NTSTATUS) 0x80000028L) +#endif + +#ifndef STATUS_UNWIND_CONSOLIDATE +# define STATUS_UNWIND_CONSOLIDATE ((NTSTATUS) 0x80000029L) +#endif + +#ifndef STATUS_REGISTRY_HIVE_RECOVERED +# define STATUS_REGISTRY_HIVE_RECOVERED ((NTSTATUS) 0x8000002AL) +#endif + +#ifndef STATUS_DLL_MIGHT_BE_INSECURE +# define STATUS_DLL_MIGHT_BE_INSECURE ((NTSTATUS) 0x8000002BL) +#endif + +#ifndef STATUS_DLL_MIGHT_BE_INCOMPATIBLE +# define STATUS_DLL_MIGHT_BE_INCOMPATIBLE ((NTSTATUS) 0x8000002CL) +#endif + +#ifndef STATUS_STOPPED_ON_SYMLINK +# define STATUS_STOPPED_ON_SYMLINK ((NTSTATUS) 0x8000002DL) +#endif + +#ifndef STATUS_CANNOT_GRANT_REQUESTED_OPLOCK +# define STATUS_CANNOT_GRANT_REQUESTED_OPLOCK ((NTSTATUS) 0x8000002EL) +#endif + +#ifndef STATUS_NO_ACE_CONDITION +# define STATUS_NO_ACE_CONDITION ((NTSTATUS) 0x8000002FL) +#endif + +#ifndef STATUS_UNSUCCESSFUL +# define STATUS_UNSUCCESSFUL ((NTSTATUS) 0xC0000001L) +#endif + +#ifndef STATUS_NOT_IMPLEMENTED +# define STATUS_NOT_IMPLEMENTED ((NTSTATUS) 0xC0000002L) +#endif + +#ifndef STATUS_INVALID_INFO_CLASS +# define STATUS_INVALID_INFO_CLASS ((NTSTATUS) 0xC0000003L) +#endif + +#ifndef STATUS_INFO_LENGTH_MISMATCH +# define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS) 0xC0000004L) +#endif + +#ifndef STATUS_ACCESS_VIOLATION +# define STATUS_ACCESS_VIOLATION ((NTSTATUS) 0xC0000005L) +#endif + +#ifndef STATUS_IN_PAGE_ERROR +# define STATUS_IN_PAGE_ERROR ((NTSTATUS) 0xC0000006L) +#endif + +#ifndef STATUS_PAGEFILE_QUOTA +# define STATUS_PAGEFILE_QUOTA ((NTSTATUS) 0xC0000007L) +#endif + +#ifndef STATUS_INVALID_HANDLE +# define STATUS_INVALID_HANDLE ((NTSTATUS) 0xC0000008L) +#endif + +#ifndef STATUS_BAD_INITIAL_STACK +# define STATUS_BAD_INITIAL_STACK ((NTSTATUS) 0xC0000009L) +#endif + +#ifndef STATUS_BAD_INITIAL_PC +# define STATUS_BAD_INITIAL_PC ((NTSTATUS) 0xC000000AL) +#endif + +#ifndef STATUS_INVALID_CID +# define STATUS_INVALID_CID ((NTSTATUS) 0xC000000BL) +#endif + +#ifndef STATUS_TIMER_NOT_CANCELED +# define STATUS_TIMER_NOT_CANCELED ((NTSTATUS) 0xC000000CL) +#endif + +#ifndef STATUS_INVALID_PARAMETER +# define STATUS_INVALID_PARAMETER ((NTSTATUS) 0xC000000DL) +#endif + +#ifndef STATUS_NO_SUCH_DEVICE +# define STATUS_NO_SUCH_DEVICE ((NTSTATUS) 0xC000000EL) +#endif + +#ifndef STATUS_NO_SUCH_FILE +# define STATUS_NO_SUCH_FILE ((NTSTATUS) 0xC000000FL) +#endif + +#ifndef STATUS_INVALID_DEVICE_REQUEST +# define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS) 0xC0000010L) +#endif + +#ifndef STATUS_END_OF_FILE +# define STATUS_END_OF_FILE ((NTSTATUS) 0xC0000011L) +#endif + +#ifndef STATUS_WRONG_VOLUME +# define STATUS_WRONG_VOLUME ((NTSTATUS) 0xC0000012L) +#endif + +#ifndef STATUS_NO_MEDIA_IN_DEVICE +# define STATUS_NO_MEDIA_IN_DEVICE ((NTSTATUS) 0xC0000013L) +#endif + +#ifndef STATUS_UNRECOGNIZED_MEDIA +# define STATUS_UNRECOGNIZED_MEDIA ((NTSTATUS) 0xC0000014L) +#endif + +#ifndef STATUS_NONEXISTENT_SECTOR +# define STATUS_NONEXISTENT_SECTOR ((NTSTATUS) 0xC0000015L) +#endif + +#ifndef STATUS_MORE_PROCESSING_REQUIRED +# define STATUS_MORE_PROCESSING_REQUIRED ((NTSTATUS) 0xC0000016L) +#endif + +#ifndef STATUS_NO_MEMORY +# define STATUS_NO_MEMORY ((NTSTATUS) 0xC0000017L) +#endif + +#ifndef STATUS_CONFLICTING_ADDRESSES +# define STATUS_CONFLICTING_ADDRESSES ((NTSTATUS) 0xC0000018L) +#endif + +#ifndef STATUS_NOT_MAPPED_VIEW +# define STATUS_NOT_MAPPED_VIEW ((NTSTATUS) 0xC0000019L) +#endif + +#ifndef STATUS_UNABLE_TO_FREE_VM +# define STATUS_UNABLE_TO_FREE_VM ((NTSTATUS) 0xC000001AL) +#endif + +#ifndef STATUS_UNABLE_TO_DELETE_SECTION +# define STATUS_UNABLE_TO_DELETE_SECTION ((NTSTATUS) 0xC000001BL) +#endif + +#ifndef STATUS_INVALID_SYSTEM_SERVICE +# define STATUS_INVALID_SYSTEM_SERVICE ((NTSTATUS) 0xC000001CL) +#endif + +#ifndef STATUS_ILLEGAL_INSTRUCTION +# define STATUS_ILLEGAL_INSTRUCTION ((NTSTATUS) 0xC000001DL) +#endif + +#ifndef STATUS_INVALID_LOCK_SEQUENCE +# define STATUS_INVALID_LOCK_SEQUENCE ((NTSTATUS) 0xC000001EL) +#endif + +#ifndef STATUS_INVALID_VIEW_SIZE +# define STATUS_INVALID_VIEW_SIZE ((NTSTATUS) 0xC000001FL) +#endif + +#ifndef STATUS_INVALID_FILE_FOR_SECTION +# define STATUS_INVALID_FILE_FOR_SECTION ((NTSTATUS) 0xC0000020L) +#endif + +#ifndef STATUS_ALREADY_COMMITTED +# define STATUS_ALREADY_COMMITTED ((NTSTATUS) 0xC0000021L) +#endif + +#ifndef STATUS_ACCESS_DENIED +# define STATUS_ACCESS_DENIED ((NTSTATUS) 0xC0000022L) +#endif + +#ifndef STATUS_BUFFER_TOO_SMALL +# define STATUS_BUFFER_TOO_SMALL ((NTSTATUS) 0xC0000023L) +#endif + +#ifndef STATUS_OBJECT_TYPE_MISMATCH +# define STATUS_OBJECT_TYPE_MISMATCH ((NTSTATUS) 0xC0000024L) +#endif + +#ifndef STATUS_NONCONTINUABLE_EXCEPTION +# define STATUS_NONCONTINUABLE_EXCEPTION ((NTSTATUS) 0xC0000025L) +#endif + +#ifndef STATUS_INVALID_DISPOSITION +# define STATUS_INVALID_DISPOSITION ((NTSTATUS) 0xC0000026L) +#endif + +#ifndef STATUS_UNWIND +# define STATUS_UNWIND ((NTSTATUS) 0xC0000027L) +#endif + +#ifndef STATUS_BAD_STACK +# define STATUS_BAD_STACK ((NTSTATUS) 0xC0000028L) +#endif + +#ifndef STATUS_INVALID_UNWIND_TARGET +# define STATUS_INVALID_UNWIND_TARGET ((NTSTATUS) 0xC0000029L) +#endif + +#ifndef STATUS_NOT_LOCKED +# define STATUS_NOT_LOCKED ((NTSTATUS) 0xC000002AL) +#endif + +#ifndef STATUS_PARITY_ERROR +# define STATUS_PARITY_ERROR ((NTSTATUS) 0xC000002BL) +#endif + +#ifndef STATUS_UNABLE_TO_DECOMMIT_VM +# define STATUS_UNABLE_TO_DECOMMIT_VM ((NTSTATUS) 0xC000002CL) +#endif + +#ifndef STATUS_NOT_COMMITTED +# define STATUS_NOT_COMMITTED ((NTSTATUS) 0xC000002DL) +#endif + +#ifndef STATUS_INVALID_PORT_ATTRIBUTES +# define STATUS_INVALID_PORT_ATTRIBUTES ((NTSTATUS) 0xC000002EL) +#endif + +#ifndef STATUS_PORT_MESSAGE_TOO_LONG +# define STATUS_PORT_MESSAGE_TOO_LONG ((NTSTATUS) 0xC000002FL) +#endif + +#ifndef STATUS_INVALID_PARAMETER_MIX +# define STATUS_INVALID_PARAMETER_MIX ((NTSTATUS) 0xC0000030L) +#endif + +#ifndef STATUS_INVALID_QUOTA_LOWER +# define STATUS_INVALID_QUOTA_LOWER ((NTSTATUS) 0xC0000031L) +#endif + +#ifndef STATUS_DISK_CORRUPT_ERROR +# define STATUS_DISK_CORRUPT_ERROR ((NTSTATUS) 0xC0000032L) +#endif + +#ifndef STATUS_OBJECT_NAME_INVALID +# define STATUS_OBJECT_NAME_INVALID ((NTSTATUS) 0xC0000033L) +#endif + +#ifndef STATUS_OBJECT_NAME_NOT_FOUND +# define STATUS_OBJECT_NAME_NOT_FOUND ((NTSTATUS) 0xC0000034L) +#endif + +#ifndef STATUS_OBJECT_NAME_COLLISION +# define STATUS_OBJECT_NAME_COLLISION ((NTSTATUS) 0xC0000035L) +#endif + +#ifndef STATUS_PORT_DISCONNECTED +# define STATUS_PORT_DISCONNECTED ((NTSTATUS) 0xC0000037L) +#endif + +#ifndef STATUS_DEVICE_ALREADY_ATTACHED +# define STATUS_DEVICE_ALREADY_ATTACHED ((NTSTATUS) 0xC0000038L) +#endif + +#ifndef STATUS_OBJECT_PATH_INVALID +# define STATUS_OBJECT_PATH_INVALID ((NTSTATUS) 0xC0000039L) +#endif + +#ifndef STATUS_OBJECT_PATH_NOT_FOUND +# define STATUS_OBJECT_PATH_NOT_FOUND ((NTSTATUS) 0xC000003AL) +#endif + +#ifndef STATUS_OBJECT_PATH_SYNTAX_BAD +# define STATUS_OBJECT_PATH_SYNTAX_BAD ((NTSTATUS) 0xC000003BL) +#endif + +#ifndef STATUS_DATA_OVERRUN +# define STATUS_DATA_OVERRUN ((NTSTATUS) 0xC000003CL) +#endif + +#ifndef STATUS_DATA_LATE_ERROR +# define STATUS_DATA_LATE_ERROR ((NTSTATUS) 0xC000003DL) +#endif + +#ifndef STATUS_DATA_ERROR +# define STATUS_DATA_ERROR ((NTSTATUS) 0xC000003EL) +#endif + +#ifndef STATUS_CRC_ERROR +# define STATUS_CRC_ERROR ((NTSTATUS) 0xC000003FL) +#endif + +#ifndef STATUS_SECTION_TOO_BIG +# define STATUS_SECTION_TOO_BIG ((NTSTATUS) 0xC0000040L) +#endif + +#ifndef STATUS_PORT_CONNECTION_REFUSED +# define STATUS_PORT_CONNECTION_REFUSED ((NTSTATUS) 0xC0000041L) +#endif + +#ifndef STATUS_INVALID_PORT_HANDLE +# define STATUS_INVALID_PORT_HANDLE ((NTSTATUS) 0xC0000042L) +#endif + +#ifndef STATUS_SHARING_VIOLATION +# define STATUS_SHARING_VIOLATION ((NTSTATUS) 0xC0000043L) +#endif + +#ifndef STATUS_QUOTA_EXCEEDED +# define STATUS_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000044L) +#endif + +#ifndef STATUS_INVALID_PAGE_PROTECTION +# define STATUS_INVALID_PAGE_PROTECTION ((NTSTATUS) 0xC0000045L) +#endif + +#ifndef STATUS_MUTANT_NOT_OWNED +# define STATUS_MUTANT_NOT_OWNED ((NTSTATUS) 0xC0000046L) +#endif + +#ifndef STATUS_SEMAPHORE_LIMIT_EXCEEDED +# define STATUS_SEMAPHORE_LIMIT_EXCEEDED ((NTSTATUS) 0xC0000047L) +#endif + +#ifndef STATUS_PORT_ALREADY_SET +# define STATUS_PORT_ALREADY_SET ((NTSTATUS) 0xC0000048L) +#endif + +#ifndef STATUS_SECTION_NOT_IMAGE +# define STATUS_SECTION_NOT_IMAGE ((NTSTATUS) 0xC0000049L) +#endif + +#ifndef STATUS_SUSPEND_COUNT_EXCEEDED +# define STATUS_SUSPEND_COUNT_EXCEEDED ((NTSTATUS) 0xC000004AL) +#endif + +#ifndef STATUS_THREAD_IS_TERMINATING +# define STATUS_THREAD_IS_TERMINATING ((NTSTATUS) 0xC000004BL) +#endif + +#ifndef STATUS_BAD_WORKING_SET_LIMIT +# define STATUS_BAD_WORKING_SET_LIMIT ((NTSTATUS) 0xC000004CL) +#endif + +#ifndef STATUS_INCOMPATIBLE_FILE_MAP +# define STATUS_INCOMPATIBLE_FILE_MAP ((NTSTATUS) 0xC000004DL) +#endif + +#ifndef STATUS_SECTION_PROTECTION +# define STATUS_SECTION_PROTECTION ((NTSTATUS) 0xC000004EL) +#endif + +#ifndef STATUS_EAS_NOT_SUPPORTED +# define STATUS_EAS_NOT_SUPPORTED ((NTSTATUS) 0xC000004FL) +#endif + +#ifndef STATUS_EA_TOO_LARGE +# define STATUS_EA_TOO_LARGE ((NTSTATUS) 0xC0000050L) +#endif + +#ifndef STATUS_NONEXISTENT_EA_ENTRY +# define STATUS_NONEXISTENT_EA_ENTRY ((NTSTATUS) 0xC0000051L) +#endif + +#ifndef STATUS_NO_EAS_ON_FILE +# define STATUS_NO_EAS_ON_FILE ((NTSTATUS) 0xC0000052L) +#endif + +#ifndef STATUS_EA_CORRUPT_ERROR +# define STATUS_EA_CORRUPT_ERROR ((NTSTATUS) 0xC0000053L) +#endif + +#ifndef STATUS_FILE_LOCK_CONFLICT +# define STATUS_FILE_LOCK_CONFLICT ((NTSTATUS) 0xC0000054L) +#endif + +#ifndef STATUS_LOCK_NOT_GRANTED +# define STATUS_LOCK_NOT_GRANTED ((NTSTATUS) 0xC0000055L) +#endif + +#ifndef STATUS_DELETE_PENDING +# define STATUS_DELETE_PENDING ((NTSTATUS) 0xC0000056L) +#endif + +#ifndef STATUS_CTL_FILE_NOT_SUPPORTED +# define STATUS_CTL_FILE_NOT_SUPPORTED ((NTSTATUS) 0xC0000057L) +#endif + +#ifndef STATUS_UNKNOWN_REVISION +# define STATUS_UNKNOWN_REVISION ((NTSTATUS) 0xC0000058L) +#endif + +#ifndef STATUS_REVISION_MISMATCH +# define STATUS_REVISION_MISMATCH ((NTSTATUS) 0xC0000059L) +#endif + +#ifndef STATUS_INVALID_OWNER +# define STATUS_INVALID_OWNER ((NTSTATUS) 0xC000005AL) +#endif + +#ifndef STATUS_INVALID_PRIMARY_GROUP +# define STATUS_INVALID_PRIMARY_GROUP ((NTSTATUS) 0xC000005BL) +#endif + +#ifndef STATUS_NO_IMPERSONATION_TOKEN +# define STATUS_NO_IMPERSONATION_TOKEN ((NTSTATUS) 0xC000005CL) +#endif + +#ifndef STATUS_CANT_DISABLE_MANDATORY +# define STATUS_CANT_DISABLE_MANDATORY ((NTSTATUS) 0xC000005DL) +#endif + +#ifndef STATUS_NO_LOGON_SERVERS +# define STATUS_NO_LOGON_SERVERS ((NTSTATUS) 0xC000005EL) +#endif + +#ifndef STATUS_NO_SUCH_LOGON_SESSION +# define STATUS_NO_SUCH_LOGON_SESSION ((NTSTATUS) 0xC000005FL) +#endif + +#ifndef STATUS_NO_SUCH_PRIVILEGE +# define STATUS_NO_SUCH_PRIVILEGE ((NTSTATUS) 0xC0000060L) +#endif + +#ifndef STATUS_PRIVILEGE_NOT_HELD +# define STATUS_PRIVILEGE_NOT_HELD ((NTSTATUS) 0xC0000061L) +#endif + +#ifndef STATUS_INVALID_ACCOUNT_NAME +# define STATUS_INVALID_ACCOUNT_NAME ((NTSTATUS) 0xC0000062L) +#endif + +#ifndef STATUS_USER_EXISTS +# define STATUS_USER_EXISTS ((NTSTATUS) 0xC0000063L) +#endif + +#ifndef STATUS_NO_SUCH_USER +# define STATUS_NO_SUCH_USER ((NTSTATUS) 0xC0000064L) +#endif + +#ifndef STATUS_GROUP_EXISTS +# define STATUS_GROUP_EXISTS ((NTSTATUS) 0xC0000065L) +#endif + +#ifndef STATUS_NO_SUCH_GROUP +# define STATUS_NO_SUCH_GROUP ((NTSTATUS) 0xC0000066L) +#endif + +#ifndef STATUS_MEMBER_IN_GROUP +# define STATUS_MEMBER_IN_GROUP ((NTSTATUS) 0xC0000067L) +#endif + +#ifndef STATUS_MEMBER_NOT_IN_GROUP +# define STATUS_MEMBER_NOT_IN_GROUP ((NTSTATUS) 0xC0000068L) +#endif + +#ifndef STATUS_LAST_ADMIN +# define STATUS_LAST_ADMIN ((NTSTATUS) 0xC0000069L) +#endif + +#ifndef STATUS_WRONG_PASSWORD +# define STATUS_WRONG_PASSWORD ((NTSTATUS) 0xC000006AL) +#endif + +#ifndef STATUS_ILL_FORMED_PASSWORD +# define STATUS_ILL_FORMED_PASSWORD ((NTSTATUS) 0xC000006BL) +#endif + +#ifndef STATUS_PASSWORD_RESTRICTION +# define STATUS_PASSWORD_RESTRICTION ((NTSTATUS) 0xC000006CL) +#endif + +#ifndef STATUS_LOGON_FAILURE +# define STATUS_LOGON_FAILURE ((NTSTATUS) 0xC000006DL) +#endif + +#ifndef STATUS_ACCOUNT_RESTRICTION +# define STATUS_ACCOUNT_RESTRICTION ((NTSTATUS) 0xC000006EL) +#endif + +#ifndef STATUS_INVALID_LOGON_HOURS +# define STATUS_INVALID_LOGON_HOURS ((NTSTATUS) 0xC000006FL) +#endif + +#ifndef STATUS_INVALID_WORKSTATION +# define STATUS_INVALID_WORKSTATION ((NTSTATUS) 0xC0000070L) +#endif + +#ifndef STATUS_PASSWORD_EXPIRED +# define STATUS_PASSWORD_EXPIRED ((NTSTATUS) 0xC0000071L) +#endif + +#ifndef STATUS_ACCOUNT_DISABLED +# define STATUS_ACCOUNT_DISABLED ((NTSTATUS) 0xC0000072L) +#endif + +#ifndef STATUS_NONE_MAPPED +# define STATUS_NONE_MAPPED ((NTSTATUS) 0xC0000073L) +#endif + +#ifndef STATUS_TOO_MANY_LUIDS_REQUESTED +# define STATUS_TOO_MANY_LUIDS_REQUESTED ((NTSTATUS) 0xC0000074L) +#endif + +#ifndef STATUS_LUIDS_EXHAUSTED +# define STATUS_LUIDS_EXHAUSTED ((NTSTATUS) 0xC0000075L) +#endif + +#ifndef STATUS_INVALID_SUB_AUTHORITY +# define STATUS_INVALID_SUB_AUTHORITY ((NTSTATUS) 0xC0000076L) +#endif + +#ifndef STATUS_INVALID_ACL +# define STATUS_INVALID_ACL ((NTSTATUS) 0xC0000077L) +#endif + +#ifndef STATUS_INVALID_SID +# define STATUS_INVALID_SID ((NTSTATUS) 0xC0000078L) +#endif + +#ifndef STATUS_INVALID_SECURITY_DESCR +# define STATUS_INVALID_SECURITY_DESCR ((NTSTATUS) 0xC0000079L) +#endif + +#ifndef STATUS_PROCEDURE_NOT_FOUND +# define STATUS_PROCEDURE_NOT_FOUND ((NTSTATUS) 0xC000007AL) +#endif + +#ifndef STATUS_INVALID_IMAGE_FORMAT +# define STATUS_INVALID_IMAGE_FORMAT ((NTSTATUS) 0xC000007BL) +#endif + +#ifndef STATUS_NO_TOKEN +# define STATUS_NO_TOKEN ((NTSTATUS) 0xC000007CL) +#endif + +#ifndef STATUS_BAD_INHERITANCE_ACL +# define STATUS_BAD_INHERITANCE_ACL ((NTSTATUS) 0xC000007DL) +#endif + +#ifndef STATUS_RANGE_NOT_LOCKED +# define STATUS_RANGE_NOT_LOCKED ((NTSTATUS) 0xC000007EL) +#endif + +#ifndef STATUS_DISK_FULL +# define STATUS_DISK_FULL ((NTSTATUS) 0xC000007FL) +#endif + +#ifndef STATUS_SERVER_DISABLED +# define STATUS_SERVER_DISABLED ((NTSTATUS) 0xC0000080L) +#endif + +#ifndef STATUS_SERVER_NOT_DISABLED +# define STATUS_SERVER_NOT_DISABLED ((NTSTATUS) 0xC0000081L) +#endif + +#ifndef STATUS_TOO_MANY_GUIDS_REQUESTED +# define STATUS_TOO_MANY_GUIDS_REQUESTED ((NTSTATUS) 0xC0000082L) +#endif + +#ifndef STATUS_GUIDS_EXHAUSTED +# define STATUS_GUIDS_EXHAUSTED ((NTSTATUS) 0xC0000083L) +#endif + +#ifndef STATUS_INVALID_ID_AUTHORITY +# define STATUS_INVALID_ID_AUTHORITY ((NTSTATUS) 0xC0000084L) +#endif + +#ifndef STATUS_AGENTS_EXHAUSTED +# define STATUS_AGENTS_EXHAUSTED ((NTSTATUS) 0xC0000085L) +#endif + +#ifndef STATUS_INVALID_VOLUME_LABEL +# define STATUS_INVALID_VOLUME_LABEL ((NTSTATUS) 0xC0000086L) +#endif + +#ifndef STATUS_SECTION_NOT_EXTENDED +# define STATUS_SECTION_NOT_EXTENDED ((NTSTATUS) 0xC0000087L) +#endif + +#ifndef STATUS_NOT_MAPPED_DATA +# define STATUS_NOT_MAPPED_DATA ((NTSTATUS) 0xC0000088L) +#endif + +#ifndef STATUS_RESOURCE_DATA_NOT_FOUND +# define STATUS_RESOURCE_DATA_NOT_FOUND ((NTSTATUS) 0xC0000089L) +#endif + +#ifndef STATUS_RESOURCE_TYPE_NOT_FOUND +# define STATUS_RESOURCE_TYPE_NOT_FOUND ((NTSTATUS) 0xC000008AL) +#endif + +#ifndef STATUS_RESOURCE_NAME_NOT_FOUND +# define STATUS_RESOURCE_NAME_NOT_FOUND ((NTSTATUS) 0xC000008BL) +#endif + +#ifndef STATUS_ARRAY_BOUNDS_EXCEEDED +# define STATUS_ARRAY_BOUNDS_EXCEEDED ((NTSTATUS) 0xC000008CL) +#endif + +#ifndef STATUS_FLOAT_DENORMAL_OPERAND +# define STATUS_FLOAT_DENORMAL_OPERAND ((NTSTATUS) 0xC000008DL) +#endif + +#ifndef STATUS_FLOAT_DIVIDE_BY_ZERO +# define STATUS_FLOAT_DIVIDE_BY_ZERO ((NTSTATUS) 0xC000008EL) +#endif + +#ifndef STATUS_FLOAT_INEXACT_RESULT +# define STATUS_FLOAT_INEXACT_RESULT ((NTSTATUS) 0xC000008FL) +#endif + +#ifndef STATUS_FLOAT_INVALID_OPERATION +# define STATUS_FLOAT_INVALID_OPERATION ((NTSTATUS) 0xC0000090L) +#endif + +#ifndef STATUS_FLOAT_OVERFLOW +# define STATUS_FLOAT_OVERFLOW ((NTSTATUS) 0xC0000091L) +#endif + +#ifndef STATUS_FLOAT_STACK_CHECK +# define STATUS_FLOAT_STACK_CHECK ((NTSTATUS) 0xC0000092L) +#endif + +#ifndef STATUS_FLOAT_UNDERFLOW +# define STATUS_FLOAT_UNDERFLOW ((NTSTATUS) 0xC0000093L) +#endif + +#ifndef STATUS_INTEGER_DIVIDE_BY_ZERO +# define STATUS_INTEGER_DIVIDE_BY_ZERO ((NTSTATUS) 0xC0000094L) +#endif + +#ifndef STATUS_INTEGER_OVERFLOW +# define STATUS_INTEGER_OVERFLOW ((NTSTATUS) 0xC0000095L) +#endif + +#ifndef STATUS_PRIVILEGED_INSTRUCTION +# define STATUS_PRIVILEGED_INSTRUCTION ((NTSTATUS) 0xC0000096L) +#endif + +#ifndef STATUS_TOO_MANY_PAGING_FILES +# define STATUS_TOO_MANY_PAGING_FILES ((NTSTATUS) 0xC0000097L) +#endif + +#ifndef STATUS_FILE_INVALID +# define STATUS_FILE_INVALID ((NTSTATUS) 0xC0000098L) +#endif + +#ifndef STATUS_ALLOTTED_SPACE_EXCEEDED +# define STATUS_ALLOTTED_SPACE_EXCEEDED ((NTSTATUS) 0xC0000099L) +#endif + +#ifndef STATUS_INSUFFICIENT_RESOURCES +# define STATUS_INSUFFICIENT_RESOURCES ((NTSTATUS) 0xC000009AL) +#endif + +#ifndef STATUS_DFS_EXIT_PATH_FOUND +# define STATUS_DFS_EXIT_PATH_FOUND ((NTSTATUS) 0xC000009BL) +#endif + +#ifndef STATUS_DEVICE_DATA_ERROR +# define STATUS_DEVICE_DATA_ERROR ((NTSTATUS) 0xC000009CL) +#endif + +#ifndef STATUS_DEVICE_NOT_CONNECTED +# define STATUS_DEVICE_NOT_CONNECTED ((NTSTATUS) 0xC000009DL) +#endif + +#ifndef STATUS_DEVICE_POWER_FAILURE +# define STATUS_DEVICE_POWER_FAILURE ((NTSTATUS) 0xC000009EL) +#endif + +#ifndef STATUS_FREE_VM_NOT_AT_BASE +# define STATUS_FREE_VM_NOT_AT_BASE ((NTSTATUS) 0xC000009FL) +#endif + +#ifndef STATUS_MEMORY_NOT_ALLOCATED +# define STATUS_MEMORY_NOT_ALLOCATED ((NTSTATUS) 0xC00000A0L) +#endif + +#ifndef STATUS_WORKING_SET_QUOTA +# define STATUS_WORKING_SET_QUOTA ((NTSTATUS) 0xC00000A1L) +#endif + +#ifndef STATUS_MEDIA_WRITE_PROTECTED +# define STATUS_MEDIA_WRITE_PROTECTED ((NTSTATUS) 0xC00000A2L) +#endif + +#ifndef STATUS_DEVICE_NOT_READY +# define STATUS_DEVICE_NOT_READY ((NTSTATUS) 0xC00000A3L) +#endif + +#ifndef STATUS_INVALID_GROUP_ATTRIBUTES +# define STATUS_INVALID_GROUP_ATTRIBUTES ((NTSTATUS) 0xC00000A4L) +#endif + +#ifndef STATUS_BAD_IMPERSONATION_LEVEL +# define STATUS_BAD_IMPERSONATION_LEVEL ((NTSTATUS) 0xC00000A5L) +#endif + +#ifndef STATUS_CANT_OPEN_ANONYMOUS +# define STATUS_CANT_OPEN_ANONYMOUS ((NTSTATUS) 0xC00000A6L) +#endif + +#ifndef STATUS_BAD_VALIDATION_CLASS +# define STATUS_BAD_VALIDATION_CLASS ((NTSTATUS) 0xC00000A7L) +#endif + +#ifndef STATUS_BAD_TOKEN_TYPE +# define STATUS_BAD_TOKEN_TYPE ((NTSTATUS) 0xC00000A8L) +#endif + +#ifndef STATUS_BAD_MASTER_BOOT_RECORD +# define STATUS_BAD_MASTER_BOOT_RECORD ((NTSTATUS) 0xC00000A9L) +#endif + +#ifndef STATUS_INSTRUCTION_MISALIGNMENT +# define STATUS_INSTRUCTION_MISALIGNMENT ((NTSTATUS) 0xC00000AAL) +#endif + +#ifndef STATUS_INSTANCE_NOT_AVAILABLE +# define STATUS_INSTANCE_NOT_AVAILABLE ((NTSTATUS) 0xC00000ABL) +#endif + +#ifndef STATUS_PIPE_NOT_AVAILABLE +# define STATUS_PIPE_NOT_AVAILABLE ((NTSTATUS) 0xC00000ACL) +#endif + +#ifndef STATUS_INVALID_PIPE_STATE +# define STATUS_INVALID_PIPE_STATE ((NTSTATUS) 0xC00000ADL) +#endif + +#ifndef STATUS_PIPE_BUSY +# define STATUS_PIPE_BUSY ((NTSTATUS) 0xC00000AEL) +#endif + +#ifndef STATUS_ILLEGAL_FUNCTION +# define STATUS_ILLEGAL_FUNCTION ((NTSTATUS) 0xC00000AFL) +#endif + +#ifndef STATUS_PIPE_DISCONNECTED +# define STATUS_PIPE_DISCONNECTED ((NTSTATUS) 0xC00000B0L) +#endif + +#ifndef STATUS_PIPE_CLOSING +# define STATUS_PIPE_CLOSING ((NTSTATUS) 0xC00000B1L) +#endif + +#ifndef STATUS_PIPE_CONNECTED +# define STATUS_PIPE_CONNECTED ((NTSTATUS) 0xC00000B2L) +#endif + +#ifndef STATUS_PIPE_LISTENING +# define STATUS_PIPE_LISTENING ((NTSTATUS) 0xC00000B3L) +#endif + +#ifndef STATUS_INVALID_READ_MODE +# define STATUS_INVALID_READ_MODE ((NTSTATUS) 0xC00000B4L) +#endif + +#ifndef STATUS_IO_TIMEOUT +# define STATUS_IO_TIMEOUT ((NTSTATUS) 0xC00000B5L) +#endif + +#ifndef STATUS_FILE_FORCED_CLOSED +# define STATUS_FILE_FORCED_CLOSED ((NTSTATUS) 0xC00000B6L) +#endif + +#ifndef STATUS_PROFILING_NOT_STARTED +# define STATUS_PROFILING_NOT_STARTED ((NTSTATUS) 0xC00000B7L) +#endif + +#ifndef STATUS_PROFILING_NOT_STOPPED +# define STATUS_PROFILING_NOT_STOPPED ((NTSTATUS) 0xC00000B8L) +#endif + +#ifndef STATUS_COULD_NOT_INTERPRET +# define STATUS_COULD_NOT_INTERPRET ((NTSTATUS) 0xC00000B9L) +#endif + +#ifndef STATUS_FILE_IS_A_DIRECTORY +# define STATUS_FILE_IS_A_DIRECTORY ((NTSTATUS) 0xC00000BAL) +#endif + +#ifndef STATUS_NOT_SUPPORTED +# define STATUS_NOT_SUPPORTED ((NTSTATUS) 0xC00000BBL) +#endif + +#ifndef STATUS_REMOTE_NOT_LISTENING +# define STATUS_REMOTE_NOT_LISTENING ((NTSTATUS) 0xC00000BCL) +#endif + +#ifndef STATUS_DUPLICATE_NAME +# define STATUS_DUPLICATE_NAME ((NTSTATUS) 0xC00000BDL) +#endif + +#ifndef STATUS_BAD_NETWORK_PATH +# define STATUS_BAD_NETWORK_PATH ((NTSTATUS) 0xC00000BEL) +#endif + +#ifndef STATUS_NETWORK_BUSY +# define STATUS_NETWORK_BUSY ((NTSTATUS) 0xC00000BFL) +#endif + +#ifndef STATUS_DEVICE_DOES_NOT_EXIST +# define STATUS_DEVICE_DOES_NOT_EXIST ((NTSTATUS) 0xC00000C0L) +#endif + +#ifndef STATUS_TOO_MANY_COMMANDS +# define STATUS_TOO_MANY_COMMANDS ((NTSTATUS) 0xC00000C1L) +#endif + +#ifndef STATUS_ADAPTER_HARDWARE_ERROR +# define STATUS_ADAPTER_HARDWARE_ERROR ((NTSTATUS) 0xC00000C2L) +#endif + +#ifndef STATUS_INVALID_NETWORK_RESPONSE +# define STATUS_INVALID_NETWORK_RESPONSE ((NTSTATUS) 0xC00000C3L) +#endif + +#ifndef STATUS_UNEXPECTED_NETWORK_ERROR +# define STATUS_UNEXPECTED_NETWORK_ERROR ((NTSTATUS) 0xC00000C4L) +#endif + +#ifndef STATUS_BAD_REMOTE_ADAPTER +# define STATUS_BAD_REMOTE_ADAPTER ((NTSTATUS) 0xC00000C5L) +#endif + +#ifndef STATUS_PRINT_QUEUE_FULL +# define STATUS_PRINT_QUEUE_FULL ((NTSTATUS) 0xC00000C6L) +#endif + +#ifndef STATUS_NO_SPOOL_SPACE +# define STATUS_NO_SPOOL_SPACE ((NTSTATUS) 0xC00000C7L) +#endif + +#ifndef STATUS_PRINT_CANCELLED +# define STATUS_PRINT_CANCELLED ((NTSTATUS) 0xC00000C8L) +#endif + +#ifndef STATUS_NETWORK_NAME_DELETED +# define STATUS_NETWORK_NAME_DELETED ((NTSTATUS) 0xC00000C9L) +#endif + +#ifndef STATUS_NETWORK_ACCESS_DENIED +# define STATUS_NETWORK_ACCESS_DENIED ((NTSTATUS) 0xC00000CAL) +#endif + +#ifndef STATUS_BAD_DEVICE_TYPE +# define STATUS_BAD_DEVICE_TYPE ((NTSTATUS) 0xC00000CBL) +#endif + +#ifndef STATUS_BAD_NETWORK_NAME +# define STATUS_BAD_NETWORK_NAME ((NTSTATUS) 0xC00000CCL) +#endif + +#ifndef STATUS_TOO_MANY_NAMES +# define STATUS_TOO_MANY_NAMES ((NTSTATUS) 0xC00000CDL) +#endif + +#ifndef STATUS_TOO_MANY_SESSIONS +# define STATUS_TOO_MANY_SESSIONS ((NTSTATUS) 0xC00000CEL) +#endif + +#ifndef STATUS_SHARING_PAUSED +# define STATUS_SHARING_PAUSED ((NTSTATUS) 0xC00000CFL) +#endif + +#ifndef STATUS_REQUEST_NOT_ACCEPTED +# define STATUS_REQUEST_NOT_ACCEPTED ((NTSTATUS) 0xC00000D0L) +#endif + +#ifndef STATUS_REDIRECTOR_PAUSED +# define STATUS_REDIRECTOR_PAUSED ((NTSTATUS) 0xC00000D1L) +#endif + +#ifndef STATUS_NET_WRITE_FAULT +# define STATUS_NET_WRITE_FAULT ((NTSTATUS) 0xC00000D2L) +#endif + +#ifndef STATUS_PROFILING_AT_LIMIT +# define STATUS_PROFILING_AT_LIMIT ((NTSTATUS) 0xC00000D3L) +#endif + +#ifndef STATUS_NOT_SAME_DEVICE +# define STATUS_NOT_SAME_DEVICE ((NTSTATUS) 0xC00000D4L) +#endif + +#ifndef STATUS_FILE_RENAMED +# define STATUS_FILE_RENAMED ((NTSTATUS) 0xC00000D5L) +#endif + +#ifndef STATUS_VIRTUAL_CIRCUIT_CLOSED +# define STATUS_VIRTUAL_CIRCUIT_CLOSED ((NTSTATUS) 0xC00000D6L) +#endif + +#ifndef STATUS_NO_SECURITY_ON_OBJECT +# define STATUS_NO_SECURITY_ON_OBJECT ((NTSTATUS) 0xC00000D7L) +#endif + +#ifndef STATUS_CANT_WAIT +# define STATUS_CANT_WAIT ((NTSTATUS) 0xC00000D8L) +#endif + +#ifndef STATUS_PIPE_EMPTY +# define STATUS_PIPE_EMPTY ((NTSTATUS) 0xC00000D9L) +#endif + +#ifndef STATUS_CANT_ACCESS_DOMAIN_INFO +# define STATUS_CANT_ACCESS_DOMAIN_INFO ((NTSTATUS) 0xC00000DAL) +#endif + +#ifndef STATUS_CANT_TERMINATE_SELF +# define STATUS_CANT_TERMINATE_SELF ((NTSTATUS) 0xC00000DBL) +#endif + +#ifndef STATUS_INVALID_SERVER_STATE +# define STATUS_INVALID_SERVER_STATE ((NTSTATUS) 0xC00000DCL) +#endif + +#ifndef STATUS_INVALID_DOMAIN_STATE +# define STATUS_INVALID_DOMAIN_STATE ((NTSTATUS) 0xC00000DDL) +#endif + +#ifndef STATUS_INVALID_DOMAIN_ROLE +# define STATUS_INVALID_DOMAIN_ROLE ((NTSTATUS) 0xC00000DEL) +#endif + +#ifndef STATUS_NO_SUCH_DOMAIN +# define STATUS_NO_SUCH_DOMAIN ((NTSTATUS) 0xC00000DFL) +#endif + +#ifndef STATUS_DOMAIN_EXISTS +# define STATUS_DOMAIN_EXISTS ((NTSTATUS) 0xC00000E0L) +#endif + +#ifndef STATUS_DOMAIN_LIMIT_EXCEEDED +# define STATUS_DOMAIN_LIMIT_EXCEEDED ((NTSTATUS) 0xC00000E1L) +#endif + +#ifndef STATUS_OPLOCK_NOT_GRANTED +# define STATUS_OPLOCK_NOT_GRANTED ((NTSTATUS) 0xC00000E2L) +#endif + +#ifndef STATUS_INVALID_OPLOCK_PROTOCOL +# define STATUS_INVALID_OPLOCK_PROTOCOL ((NTSTATUS) 0xC00000E3L) +#endif + +#ifndef STATUS_INTERNAL_DB_CORRUPTION +# define STATUS_INTERNAL_DB_CORRUPTION ((NTSTATUS) 0xC00000E4L) +#endif + +#ifndef STATUS_INTERNAL_ERROR +# define STATUS_INTERNAL_ERROR ((NTSTATUS) 0xC00000E5L) +#endif + +#ifndef STATUS_GENERIC_NOT_MAPPED +# define STATUS_GENERIC_NOT_MAPPED ((NTSTATUS) 0xC00000E6L) +#endif + +#ifndef STATUS_BAD_DESCRIPTOR_FORMAT +# define STATUS_BAD_DESCRIPTOR_FORMAT ((NTSTATUS) 0xC00000E7L) +#endif + +#ifndef STATUS_INVALID_USER_BUFFER +# define STATUS_INVALID_USER_BUFFER ((NTSTATUS) 0xC00000E8L) +#endif + +#ifndef STATUS_UNEXPECTED_IO_ERROR +# define STATUS_UNEXPECTED_IO_ERROR ((NTSTATUS) 0xC00000E9L) +#endif + +#ifndef STATUS_UNEXPECTED_MM_CREATE_ERR +# define STATUS_UNEXPECTED_MM_CREATE_ERR ((NTSTATUS) 0xC00000EAL) +#endif + +#ifndef STATUS_UNEXPECTED_MM_MAP_ERROR +# define STATUS_UNEXPECTED_MM_MAP_ERROR ((NTSTATUS) 0xC00000EBL) +#endif + +#ifndef STATUS_UNEXPECTED_MM_EXTEND_ERR +# define STATUS_UNEXPECTED_MM_EXTEND_ERR ((NTSTATUS) 0xC00000ECL) +#endif + +#ifndef STATUS_NOT_LOGON_PROCESS +# define STATUS_NOT_LOGON_PROCESS ((NTSTATUS) 0xC00000EDL) +#endif + +#ifndef STATUS_LOGON_SESSION_EXISTS +# define STATUS_LOGON_SESSION_EXISTS ((NTSTATUS) 0xC00000EEL) +#endif + +#ifndef STATUS_INVALID_PARAMETER_1 +# define STATUS_INVALID_PARAMETER_1 ((NTSTATUS) 0xC00000EFL) +#endif + +#ifndef STATUS_INVALID_PARAMETER_2 +# define STATUS_INVALID_PARAMETER_2 ((NTSTATUS) 0xC00000F0L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_3 +# define STATUS_INVALID_PARAMETER_3 ((NTSTATUS) 0xC00000F1L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_4 +# define STATUS_INVALID_PARAMETER_4 ((NTSTATUS) 0xC00000F2L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_5 +# define STATUS_INVALID_PARAMETER_5 ((NTSTATUS) 0xC00000F3L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_6 +# define STATUS_INVALID_PARAMETER_6 ((NTSTATUS) 0xC00000F4L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_7 +# define STATUS_INVALID_PARAMETER_7 ((NTSTATUS) 0xC00000F5L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_8 +# define STATUS_INVALID_PARAMETER_8 ((NTSTATUS) 0xC00000F6L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_9 +# define STATUS_INVALID_PARAMETER_9 ((NTSTATUS) 0xC00000F7L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_10 +# define STATUS_INVALID_PARAMETER_10 ((NTSTATUS) 0xC00000F8L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_11 +# define STATUS_INVALID_PARAMETER_11 ((NTSTATUS) 0xC00000F9L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_12 +# define STATUS_INVALID_PARAMETER_12 ((NTSTATUS) 0xC00000FAL) +#endif + +#ifndef STATUS_REDIRECTOR_NOT_STARTED +# define STATUS_REDIRECTOR_NOT_STARTED ((NTSTATUS) 0xC00000FBL) +#endif + +#ifndef STATUS_REDIRECTOR_STARTED +# define STATUS_REDIRECTOR_STARTED ((NTSTATUS) 0xC00000FCL) +#endif + +#ifndef STATUS_STACK_OVERFLOW +# define STATUS_STACK_OVERFLOW ((NTSTATUS) 0xC00000FDL) +#endif + +#ifndef STATUS_NO_SUCH_PACKAGE +# define STATUS_NO_SUCH_PACKAGE ((NTSTATUS) 0xC00000FEL) +#endif + +#ifndef STATUS_BAD_FUNCTION_TABLE +# define STATUS_BAD_FUNCTION_TABLE ((NTSTATUS) 0xC00000FFL) +#endif + +#ifndef STATUS_VARIABLE_NOT_FOUND +# define STATUS_VARIABLE_NOT_FOUND ((NTSTATUS) 0xC0000100L) +#endif + +#ifndef STATUS_DIRECTORY_NOT_EMPTY +# define STATUS_DIRECTORY_NOT_EMPTY ((NTSTATUS) 0xC0000101L) +#endif + +#ifndef STATUS_FILE_CORRUPT_ERROR +# define STATUS_FILE_CORRUPT_ERROR ((NTSTATUS) 0xC0000102L) +#endif + +#ifndef STATUS_NOT_A_DIRECTORY +# define STATUS_NOT_A_DIRECTORY ((NTSTATUS) 0xC0000103L) +#endif + +#ifndef STATUS_BAD_LOGON_SESSION_STATE +# define STATUS_BAD_LOGON_SESSION_STATE ((NTSTATUS) 0xC0000104L) +#endif + +#ifndef STATUS_LOGON_SESSION_COLLISION +# define STATUS_LOGON_SESSION_COLLISION ((NTSTATUS) 0xC0000105L) +#endif + +#ifndef STATUS_NAME_TOO_LONG +# define STATUS_NAME_TOO_LONG ((NTSTATUS) 0xC0000106L) +#endif + +#ifndef STATUS_FILES_OPEN +# define STATUS_FILES_OPEN ((NTSTATUS) 0xC0000107L) +#endif + +#ifndef STATUS_CONNECTION_IN_USE +# define STATUS_CONNECTION_IN_USE ((NTSTATUS) 0xC0000108L) +#endif + +#ifndef STATUS_MESSAGE_NOT_FOUND +# define STATUS_MESSAGE_NOT_FOUND ((NTSTATUS) 0xC0000109L) +#endif + +#ifndef STATUS_PROCESS_IS_TERMINATING +# define STATUS_PROCESS_IS_TERMINATING ((NTSTATUS) 0xC000010AL) +#endif + +#ifndef STATUS_INVALID_LOGON_TYPE +# define STATUS_INVALID_LOGON_TYPE ((NTSTATUS) 0xC000010BL) +#endif + +#ifndef STATUS_NO_GUID_TRANSLATION +# define STATUS_NO_GUID_TRANSLATION ((NTSTATUS) 0xC000010CL) +#endif + +#ifndef STATUS_CANNOT_IMPERSONATE +# define STATUS_CANNOT_IMPERSONATE ((NTSTATUS) 0xC000010DL) +#endif + +#ifndef STATUS_IMAGE_ALREADY_LOADED +# define STATUS_IMAGE_ALREADY_LOADED ((NTSTATUS) 0xC000010EL) +#endif + +#ifndef STATUS_ABIOS_NOT_PRESENT +# define STATUS_ABIOS_NOT_PRESENT ((NTSTATUS) 0xC000010FL) +#endif + +#ifndef STATUS_ABIOS_LID_NOT_EXIST +# define STATUS_ABIOS_LID_NOT_EXIST ((NTSTATUS) 0xC0000110L) +#endif + +#ifndef STATUS_ABIOS_LID_ALREADY_OWNED +# define STATUS_ABIOS_LID_ALREADY_OWNED ((NTSTATUS) 0xC0000111L) +#endif + +#ifndef STATUS_ABIOS_NOT_LID_OWNER +# define STATUS_ABIOS_NOT_LID_OWNER ((NTSTATUS) 0xC0000112L) +#endif + +#ifndef STATUS_ABIOS_INVALID_COMMAND +# define STATUS_ABIOS_INVALID_COMMAND ((NTSTATUS) 0xC0000113L) +#endif + +#ifndef STATUS_ABIOS_INVALID_LID +# define STATUS_ABIOS_INVALID_LID ((NTSTATUS) 0xC0000114L) +#endif + +#ifndef STATUS_ABIOS_SELECTOR_NOT_AVAILABLE +# define STATUS_ABIOS_SELECTOR_NOT_AVAILABLE ((NTSTATUS) 0xC0000115L) +#endif + +#ifndef STATUS_ABIOS_INVALID_SELECTOR +# define STATUS_ABIOS_INVALID_SELECTOR ((NTSTATUS) 0xC0000116L) +#endif + +#ifndef STATUS_NO_LDT +# define STATUS_NO_LDT ((NTSTATUS) 0xC0000117L) +#endif + +#ifndef STATUS_INVALID_LDT_SIZE +# define STATUS_INVALID_LDT_SIZE ((NTSTATUS) 0xC0000118L) +#endif + +#ifndef STATUS_INVALID_LDT_OFFSET +# define STATUS_INVALID_LDT_OFFSET ((NTSTATUS) 0xC0000119L) +#endif + +#ifndef STATUS_INVALID_LDT_DESCRIPTOR +# define STATUS_INVALID_LDT_DESCRIPTOR ((NTSTATUS) 0xC000011AL) +#endif + +#ifndef STATUS_INVALID_IMAGE_NE_FORMAT +# define STATUS_INVALID_IMAGE_NE_FORMAT ((NTSTATUS) 0xC000011BL) +#endif + +#ifndef STATUS_RXACT_INVALID_STATE +# define STATUS_RXACT_INVALID_STATE ((NTSTATUS) 0xC000011CL) +#endif + +#ifndef STATUS_RXACT_COMMIT_FAILURE +# define STATUS_RXACT_COMMIT_FAILURE ((NTSTATUS) 0xC000011DL) +#endif + +#ifndef STATUS_MAPPED_FILE_SIZE_ZERO +# define STATUS_MAPPED_FILE_SIZE_ZERO ((NTSTATUS) 0xC000011EL) +#endif + +#ifndef STATUS_TOO_MANY_OPENED_FILES +# define STATUS_TOO_MANY_OPENED_FILES ((NTSTATUS) 0xC000011FL) +#endif + +#ifndef STATUS_CANCELLED +# define STATUS_CANCELLED ((NTSTATUS) 0xC0000120L) +#endif + +#ifndef STATUS_CANNOT_DELETE +# define STATUS_CANNOT_DELETE ((NTSTATUS) 0xC0000121L) +#endif + +#ifndef STATUS_INVALID_COMPUTER_NAME +# define STATUS_INVALID_COMPUTER_NAME ((NTSTATUS) 0xC0000122L) +#endif + +#ifndef STATUS_FILE_DELETED +# define STATUS_FILE_DELETED ((NTSTATUS) 0xC0000123L) +#endif + +#ifndef STATUS_SPECIAL_ACCOUNT +# define STATUS_SPECIAL_ACCOUNT ((NTSTATUS) 0xC0000124L) +#endif + +#ifndef STATUS_SPECIAL_GROUP +# define STATUS_SPECIAL_GROUP ((NTSTATUS) 0xC0000125L) +#endif + +#ifndef STATUS_SPECIAL_USER +# define STATUS_SPECIAL_USER ((NTSTATUS) 0xC0000126L) +#endif + +#ifndef STATUS_MEMBERS_PRIMARY_GROUP +# define STATUS_MEMBERS_PRIMARY_GROUP ((NTSTATUS) 0xC0000127L) +#endif + +#ifndef STATUS_FILE_CLOSED +# define STATUS_FILE_CLOSED ((NTSTATUS) 0xC0000128L) +#endif + +#ifndef STATUS_TOO_MANY_THREADS +# define STATUS_TOO_MANY_THREADS ((NTSTATUS) 0xC0000129L) +#endif + +#ifndef STATUS_THREAD_NOT_IN_PROCESS +# define STATUS_THREAD_NOT_IN_PROCESS ((NTSTATUS) 0xC000012AL) +#endif + +#ifndef STATUS_TOKEN_ALREADY_IN_USE +# define STATUS_TOKEN_ALREADY_IN_USE ((NTSTATUS) 0xC000012BL) +#endif + +#ifndef STATUS_PAGEFILE_QUOTA_EXCEEDED +# define STATUS_PAGEFILE_QUOTA_EXCEEDED ((NTSTATUS) 0xC000012CL) +#endif + +#ifndef STATUS_COMMITMENT_LIMIT +# define STATUS_COMMITMENT_LIMIT ((NTSTATUS) 0xC000012DL) +#endif + +#ifndef STATUS_INVALID_IMAGE_LE_FORMAT +# define STATUS_INVALID_IMAGE_LE_FORMAT ((NTSTATUS) 0xC000012EL) +#endif + +#ifndef STATUS_INVALID_IMAGE_NOT_MZ +# define STATUS_INVALID_IMAGE_NOT_MZ ((NTSTATUS) 0xC000012FL) +#endif + +#ifndef STATUS_INVALID_IMAGE_PROTECT +# define STATUS_INVALID_IMAGE_PROTECT ((NTSTATUS) 0xC0000130L) +#endif + +#ifndef STATUS_INVALID_IMAGE_WIN_16 +# define STATUS_INVALID_IMAGE_WIN_16 ((NTSTATUS) 0xC0000131L) +#endif + +#ifndef STATUS_LOGON_SERVER_CONFLICT +# define STATUS_LOGON_SERVER_CONFLICT ((NTSTATUS) 0xC0000132L) +#endif + +#ifndef STATUS_TIME_DIFFERENCE_AT_DC +# define STATUS_TIME_DIFFERENCE_AT_DC ((NTSTATUS) 0xC0000133L) +#endif + +#ifndef STATUS_SYNCHRONIZATION_REQUIRED +# define STATUS_SYNCHRONIZATION_REQUIRED ((NTSTATUS) 0xC0000134L) +#endif + +#ifndef STATUS_DLL_NOT_FOUND +# define STATUS_DLL_NOT_FOUND ((NTSTATUS) 0xC0000135L) +#endif + +#ifndef STATUS_OPEN_FAILED +# define STATUS_OPEN_FAILED ((NTSTATUS) 0xC0000136L) +#endif + +#ifndef STATUS_IO_PRIVILEGE_FAILED +# define STATUS_IO_PRIVILEGE_FAILED ((NTSTATUS) 0xC0000137L) +#endif + +#ifndef STATUS_ORDINAL_NOT_FOUND +# define STATUS_ORDINAL_NOT_FOUND ((NTSTATUS) 0xC0000138L) +#endif + +#ifndef STATUS_ENTRYPOINT_NOT_FOUND +# define STATUS_ENTRYPOINT_NOT_FOUND ((NTSTATUS) 0xC0000139L) +#endif + +#ifndef STATUS_CONTROL_C_EXIT +# define STATUS_CONTROL_C_EXIT ((NTSTATUS) 0xC000013AL) +#endif + +#ifndef STATUS_LOCAL_DISCONNECT +# define STATUS_LOCAL_DISCONNECT ((NTSTATUS) 0xC000013BL) +#endif + +#ifndef STATUS_REMOTE_DISCONNECT +# define STATUS_REMOTE_DISCONNECT ((NTSTATUS) 0xC000013CL) +#endif + +#ifndef STATUS_REMOTE_RESOURCES +# define STATUS_REMOTE_RESOURCES ((NTSTATUS) 0xC000013DL) +#endif + +#ifndef STATUS_LINK_FAILED +# define STATUS_LINK_FAILED ((NTSTATUS) 0xC000013EL) +#endif + +#ifndef STATUS_LINK_TIMEOUT +# define STATUS_LINK_TIMEOUT ((NTSTATUS) 0xC000013FL) +#endif + +#ifndef STATUS_INVALID_CONNECTION +# define STATUS_INVALID_CONNECTION ((NTSTATUS) 0xC0000140L) +#endif + +#ifndef STATUS_INVALID_ADDRESS +# define STATUS_INVALID_ADDRESS ((NTSTATUS) 0xC0000141L) +#endif + +#ifndef STATUS_DLL_INIT_FAILED +# define STATUS_DLL_INIT_FAILED ((NTSTATUS) 0xC0000142L) +#endif + +#ifndef STATUS_MISSING_SYSTEMFILE +# define STATUS_MISSING_SYSTEMFILE ((NTSTATUS) 0xC0000143L) +#endif + +#ifndef STATUS_UNHANDLED_EXCEPTION +# define STATUS_UNHANDLED_EXCEPTION ((NTSTATUS) 0xC0000144L) +#endif + +#ifndef STATUS_APP_INIT_FAILURE +# define STATUS_APP_INIT_FAILURE ((NTSTATUS) 0xC0000145L) +#endif + +#ifndef STATUS_PAGEFILE_CREATE_FAILED +# define STATUS_PAGEFILE_CREATE_FAILED ((NTSTATUS) 0xC0000146L) +#endif + +#ifndef STATUS_NO_PAGEFILE +# define STATUS_NO_PAGEFILE ((NTSTATUS) 0xC0000147L) +#endif + +#ifndef STATUS_INVALID_LEVEL +# define STATUS_INVALID_LEVEL ((NTSTATUS) 0xC0000148L) +#endif + +#ifndef STATUS_WRONG_PASSWORD_CORE +# define STATUS_WRONG_PASSWORD_CORE ((NTSTATUS) 0xC0000149L) +#endif + +#ifndef STATUS_ILLEGAL_FLOAT_CONTEXT +# define STATUS_ILLEGAL_FLOAT_CONTEXT ((NTSTATUS) 0xC000014AL) +#endif + +#ifndef STATUS_PIPE_BROKEN +# define STATUS_PIPE_BROKEN ((NTSTATUS) 0xC000014BL) +#endif + +#ifndef STATUS_REGISTRY_CORRUPT +# define STATUS_REGISTRY_CORRUPT ((NTSTATUS) 0xC000014CL) +#endif + +#ifndef STATUS_REGISTRY_IO_FAILED +# define STATUS_REGISTRY_IO_FAILED ((NTSTATUS) 0xC000014DL) +#endif + +#ifndef STATUS_NO_EVENT_PAIR +# define STATUS_NO_EVENT_PAIR ((NTSTATUS) 0xC000014EL) +#endif + +#ifndef STATUS_UNRECOGNIZED_VOLUME +# define STATUS_UNRECOGNIZED_VOLUME ((NTSTATUS) 0xC000014FL) +#endif + +#ifndef STATUS_SERIAL_NO_DEVICE_INITED +# define STATUS_SERIAL_NO_DEVICE_INITED ((NTSTATUS) 0xC0000150L) +#endif + +#ifndef STATUS_NO_SUCH_ALIAS +# define STATUS_NO_SUCH_ALIAS ((NTSTATUS) 0xC0000151L) +#endif + +#ifndef STATUS_MEMBER_NOT_IN_ALIAS +# define STATUS_MEMBER_NOT_IN_ALIAS ((NTSTATUS) 0xC0000152L) +#endif + +#ifndef STATUS_MEMBER_IN_ALIAS +# define STATUS_MEMBER_IN_ALIAS ((NTSTATUS) 0xC0000153L) +#endif + +#ifndef STATUS_ALIAS_EXISTS +# define STATUS_ALIAS_EXISTS ((NTSTATUS) 0xC0000154L) +#endif + +#ifndef STATUS_LOGON_NOT_GRANTED +# define STATUS_LOGON_NOT_GRANTED ((NTSTATUS) 0xC0000155L) +#endif + +#ifndef STATUS_TOO_MANY_SECRETS +# define STATUS_TOO_MANY_SECRETS ((NTSTATUS) 0xC0000156L) +#endif + +#ifndef STATUS_SECRET_TOO_LONG +# define STATUS_SECRET_TOO_LONG ((NTSTATUS) 0xC0000157L) +#endif + +#ifndef STATUS_INTERNAL_DB_ERROR +# define STATUS_INTERNAL_DB_ERROR ((NTSTATUS) 0xC0000158L) +#endif + +#ifndef STATUS_FULLSCREEN_MODE +# define STATUS_FULLSCREEN_MODE ((NTSTATUS) 0xC0000159L) +#endif + +#ifndef STATUS_TOO_MANY_CONTEXT_IDS +# define STATUS_TOO_MANY_CONTEXT_IDS ((NTSTATUS) 0xC000015AL) +#endif + +#ifndef STATUS_LOGON_TYPE_NOT_GRANTED +# define STATUS_LOGON_TYPE_NOT_GRANTED ((NTSTATUS) 0xC000015BL) +#endif + +#ifndef STATUS_NOT_REGISTRY_FILE +# define STATUS_NOT_REGISTRY_FILE ((NTSTATUS) 0xC000015CL) +#endif + +#ifndef STATUS_NT_CROSS_ENCRYPTION_REQUIRED +# define STATUS_NT_CROSS_ENCRYPTION_REQUIRED ((NTSTATUS) 0xC000015DL) +#endif + +#ifndef STATUS_DOMAIN_CTRLR_CONFIG_ERROR +# define STATUS_DOMAIN_CTRLR_CONFIG_ERROR ((NTSTATUS) 0xC000015EL) +#endif + +#ifndef STATUS_FT_MISSING_MEMBER +# define STATUS_FT_MISSING_MEMBER ((NTSTATUS) 0xC000015FL) +#endif + +#ifndef STATUS_ILL_FORMED_SERVICE_ENTRY +# define STATUS_ILL_FORMED_SERVICE_ENTRY ((NTSTATUS) 0xC0000160L) +#endif + +#ifndef STATUS_ILLEGAL_CHARACTER +# define STATUS_ILLEGAL_CHARACTER ((NTSTATUS) 0xC0000161L) +#endif + +#ifndef STATUS_UNMAPPABLE_CHARACTER +# define STATUS_UNMAPPABLE_CHARACTER ((NTSTATUS) 0xC0000162L) +#endif + +#ifndef STATUS_UNDEFINED_CHARACTER +# define STATUS_UNDEFINED_CHARACTER ((NTSTATUS) 0xC0000163L) +#endif + +#ifndef STATUS_FLOPPY_VOLUME +# define STATUS_FLOPPY_VOLUME ((NTSTATUS) 0xC0000164L) +#endif + +#ifndef STATUS_FLOPPY_ID_MARK_NOT_FOUND +# define STATUS_FLOPPY_ID_MARK_NOT_FOUND ((NTSTATUS) 0xC0000165L) +#endif + +#ifndef STATUS_FLOPPY_WRONG_CYLINDER +# define STATUS_FLOPPY_WRONG_CYLINDER ((NTSTATUS) 0xC0000166L) +#endif + +#ifndef STATUS_FLOPPY_UNKNOWN_ERROR +# define STATUS_FLOPPY_UNKNOWN_ERROR ((NTSTATUS) 0xC0000167L) +#endif + +#ifndef STATUS_FLOPPY_BAD_REGISTERS +# define STATUS_FLOPPY_BAD_REGISTERS ((NTSTATUS) 0xC0000168L) +#endif + +#ifndef STATUS_DISK_RECALIBRATE_FAILED +# define STATUS_DISK_RECALIBRATE_FAILED ((NTSTATUS) 0xC0000169L) +#endif + +#ifndef STATUS_DISK_OPERATION_FAILED +# define STATUS_DISK_OPERATION_FAILED ((NTSTATUS) 0xC000016AL) +#endif + +#ifndef STATUS_DISK_RESET_FAILED +# define STATUS_DISK_RESET_FAILED ((NTSTATUS) 0xC000016BL) +#endif + +#ifndef STATUS_SHARED_IRQ_BUSY +# define STATUS_SHARED_IRQ_BUSY ((NTSTATUS) 0xC000016CL) +#endif + +#ifndef STATUS_FT_ORPHANING +# define STATUS_FT_ORPHANING ((NTSTATUS) 0xC000016DL) +#endif + +#ifndef STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT +# define STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT ((NTSTATUS) 0xC000016EL) +#endif + +#ifndef STATUS_PARTITION_FAILURE +# define STATUS_PARTITION_FAILURE ((NTSTATUS) 0xC0000172L) +#endif + +#ifndef STATUS_INVALID_BLOCK_LENGTH +# define STATUS_INVALID_BLOCK_LENGTH ((NTSTATUS) 0xC0000173L) +#endif + +#ifndef STATUS_DEVICE_NOT_PARTITIONED +# define STATUS_DEVICE_NOT_PARTITIONED ((NTSTATUS) 0xC0000174L) +#endif + +#ifndef STATUS_UNABLE_TO_LOCK_MEDIA +# define STATUS_UNABLE_TO_LOCK_MEDIA ((NTSTATUS) 0xC0000175L) +#endif + +#ifndef STATUS_UNABLE_TO_UNLOAD_MEDIA +# define STATUS_UNABLE_TO_UNLOAD_MEDIA ((NTSTATUS) 0xC0000176L) +#endif + +#ifndef STATUS_EOM_OVERFLOW +# define STATUS_EOM_OVERFLOW ((NTSTATUS) 0xC0000177L) +#endif + +#ifndef STATUS_NO_MEDIA +# define STATUS_NO_MEDIA ((NTSTATUS) 0xC0000178L) +#endif + +#ifndef STATUS_NO_SUCH_MEMBER +# define STATUS_NO_SUCH_MEMBER ((NTSTATUS) 0xC000017AL) +#endif + +#ifndef STATUS_INVALID_MEMBER +# define STATUS_INVALID_MEMBER ((NTSTATUS) 0xC000017BL) +#endif + +#ifndef STATUS_KEY_DELETED +# define STATUS_KEY_DELETED ((NTSTATUS) 0xC000017CL) +#endif + +#ifndef STATUS_NO_LOG_SPACE +# define STATUS_NO_LOG_SPACE ((NTSTATUS) 0xC000017DL) +#endif + +#ifndef STATUS_TOO_MANY_SIDS +# define STATUS_TOO_MANY_SIDS ((NTSTATUS) 0xC000017EL) +#endif + +#ifndef STATUS_LM_CROSS_ENCRYPTION_REQUIRED +# define STATUS_LM_CROSS_ENCRYPTION_REQUIRED ((NTSTATUS) 0xC000017FL) +#endif + +#ifndef STATUS_KEY_HAS_CHILDREN +# define STATUS_KEY_HAS_CHILDREN ((NTSTATUS) 0xC0000180L) +#endif + +#ifndef STATUS_CHILD_MUST_BE_VOLATILE +# define STATUS_CHILD_MUST_BE_VOLATILE ((NTSTATUS) 0xC0000181L) +#endif + +#ifndef STATUS_DEVICE_CONFIGURATION_ERROR +# define STATUS_DEVICE_CONFIGURATION_ERROR ((NTSTATUS) 0xC0000182L) +#endif + +#ifndef STATUS_DRIVER_INTERNAL_ERROR +# define STATUS_DRIVER_INTERNAL_ERROR ((NTSTATUS) 0xC0000183L) +#endif + +#ifndef STATUS_INVALID_DEVICE_STATE +# define STATUS_INVALID_DEVICE_STATE ((NTSTATUS) 0xC0000184L) +#endif + +#ifndef STATUS_IO_DEVICE_ERROR +# define STATUS_IO_DEVICE_ERROR ((NTSTATUS) 0xC0000185L) +#endif + +#ifndef STATUS_DEVICE_PROTOCOL_ERROR +# define STATUS_DEVICE_PROTOCOL_ERROR ((NTSTATUS) 0xC0000186L) +#endif + +#ifndef STATUS_BACKUP_CONTROLLER +# define STATUS_BACKUP_CONTROLLER ((NTSTATUS) 0xC0000187L) +#endif + +#ifndef STATUS_LOG_FILE_FULL +# define STATUS_LOG_FILE_FULL ((NTSTATUS) 0xC0000188L) +#endif + +#ifndef STATUS_TOO_LATE +# define STATUS_TOO_LATE ((NTSTATUS) 0xC0000189L) +#endif + +#ifndef STATUS_NO_TRUST_LSA_SECRET +# define STATUS_NO_TRUST_LSA_SECRET ((NTSTATUS) 0xC000018AL) +#endif + +#ifndef STATUS_NO_TRUST_SAM_ACCOUNT +# define STATUS_NO_TRUST_SAM_ACCOUNT ((NTSTATUS) 0xC000018BL) +#endif + +#ifndef STATUS_TRUSTED_DOMAIN_FAILURE +# define STATUS_TRUSTED_DOMAIN_FAILURE ((NTSTATUS) 0xC000018CL) +#endif + +#ifndef STATUS_TRUSTED_RELATIONSHIP_FAILURE +# define STATUS_TRUSTED_RELATIONSHIP_FAILURE ((NTSTATUS) 0xC000018DL) +#endif + +#ifndef STATUS_EVENTLOG_FILE_CORRUPT +# define STATUS_EVENTLOG_FILE_CORRUPT ((NTSTATUS) 0xC000018EL) +#endif + +#ifndef STATUS_EVENTLOG_CANT_START +# define STATUS_EVENTLOG_CANT_START ((NTSTATUS) 0xC000018FL) +#endif + +#ifndef STATUS_TRUST_FAILURE +# define STATUS_TRUST_FAILURE ((NTSTATUS) 0xC0000190L) +#endif + +#ifndef STATUS_MUTANT_LIMIT_EXCEEDED +# define STATUS_MUTANT_LIMIT_EXCEEDED ((NTSTATUS) 0xC0000191L) +#endif + +#ifndef STATUS_NETLOGON_NOT_STARTED +# define STATUS_NETLOGON_NOT_STARTED ((NTSTATUS) 0xC0000192L) +#endif + +#ifndef STATUS_ACCOUNT_EXPIRED +# define STATUS_ACCOUNT_EXPIRED ((NTSTATUS) 0xC0000193L) +#endif + +#ifndef STATUS_POSSIBLE_DEADLOCK +# define STATUS_POSSIBLE_DEADLOCK ((NTSTATUS) 0xC0000194L) +#endif + +#ifndef STATUS_NETWORK_CREDENTIAL_CONFLICT +# define STATUS_NETWORK_CREDENTIAL_CONFLICT ((NTSTATUS) 0xC0000195L) +#endif + +#ifndef STATUS_REMOTE_SESSION_LIMIT +# define STATUS_REMOTE_SESSION_LIMIT ((NTSTATUS) 0xC0000196L) +#endif + +#ifndef STATUS_EVENTLOG_FILE_CHANGED +# define STATUS_EVENTLOG_FILE_CHANGED ((NTSTATUS) 0xC0000197L) +#endif + +#ifndef STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT +# define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT ((NTSTATUS) 0xC0000198L) +#endif + +#ifndef STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT +# define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT ((NTSTATUS) 0xC0000199L) +#endif + +#ifndef STATUS_NOLOGON_SERVER_TRUST_ACCOUNT +# define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT ((NTSTATUS) 0xC000019AL) +#endif + +#ifndef STATUS_DOMAIN_TRUST_INCONSISTENT +# define STATUS_DOMAIN_TRUST_INCONSISTENT ((NTSTATUS) 0xC000019BL) +#endif + +#ifndef STATUS_FS_DRIVER_REQUIRED +# define STATUS_FS_DRIVER_REQUIRED ((NTSTATUS) 0xC000019CL) +#endif + +#ifndef STATUS_IMAGE_ALREADY_LOADED_AS_DLL +# define STATUS_IMAGE_ALREADY_LOADED_AS_DLL ((NTSTATUS) 0xC000019DL) +#endif + +#ifndef STATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING +# define STATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING ((NTSTATUS) 0xC000019EL) +#endif + +#ifndef STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME +# define STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME ((NTSTATUS) 0xC000019FL) +#endif + +#ifndef STATUS_SECURITY_STREAM_IS_INCONSISTENT +# define STATUS_SECURITY_STREAM_IS_INCONSISTENT ((NTSTATUS) 0xC00001A0L) +#endif + +#ifndef STATUS_INVALID_LOCK_RANGE +# define STATUS_INVALID_LOCK_RANGE ((NTSTATUS) 0xC00001A1L) +#endif + +#ifndef STATUS_INVALID_ACE_CONDITION +# define STATUS_INVALID_ACE_CONDITION ((NTSTATUS) 0xC00001A2L) +#endif + +#ifndef STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT +# define STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT ((NTSTATUS) 0xC00001A3L) +#endif + +#ifndef STATUS_NOTIFICATION_GUID_ALREADY_DEFINED +# define STATUS_NOTIFICATION_GUID_ALREADY_DEFINED ((NTSTATUS) 0xC00001A4L) +#endif + +#ifndef STATUS_NETWORK_OPEN_RESTRICTION +# define STATUS_NETWORK_OPEN_RESTRICTION ((NTSTATUS) 0xC0000201L) +#endif + +#ifndef STATUS_NO_USER_SESSION_KEY +# define STATUS_NO_USER_SESSION_KEY ((NTSTATUS) 0xC0000202L) +#endif + +#ifndef STATUS_USER_SESSION_DELETED +# define STATUS_USER_SESSION_DELETED ((NTSTATUS) 0xC0000203L) +#endif + +#ifndef STATUS_RESOURCE_LANG_NOT_FOUND +# define STATUS_RESOURCE_LANG_NOT_FOUND ((NTSTATUS) 0xC0000204L) +#endif + +#ifndef STATUS_INSUFF_SERVER_RESOURCES +# define STATUS_INSUFF_SERVER_RESOURCES ((NTSTATUS) 0xC0000205L) +#endif + +#ifndef STATUS_INVALID_BUFFER_SIZE +# define STATUS_INVALID_BUFFER_SIZE ((NTSTATUS) 0xC0000206L) +#endif + +#ifndef STATUS_INVALID_ADDRESS_COMPONENT +# define STATUS_INVALID_ADDRESS_COMPONENT ((NTSTATUS) 0xC0000207L) +#endif + +#ifndef STATUS_INVALID_ADDRESS_WILDCARD +# define STATUS_INVALID_ADDRESS_WILDCARD ((NTSTATUS) 0xC0000208L) +#endif + +#ifndef STATUS_TOO_MANY_ADDRESSES +# define STATUS_TOO_MANY_ADDRESSES ((NTSTATUS) 0xC0000209L) +#endif + +#ifndef STATUS_ADDRESS_ALREADY_EXISTS +# define STATUS_ADDRESS_ALREADY_EXISTS ((NTSTATUS) 0xC000020AL) +#endif + +#ifndef STATUS_ADDRESS_CLOSED +# define STATUS_ADDRESS_CLOSED ((NTSTATUS) 0xC000020BL) +#endif + +#ifndef STATUS_CONNECTION_DISCONNECTED +# define STATUS_CONNECTION_DISCONNECTED ((NTSTATUS) 0xC000020CL) +#endif + +#ifndef STATUS_CONNECTION_RESET +# define STATUS_CONNECTION_RESET ((NTSTATUS) 0xC000020DL) +#endif + +#ifndef STATUS_TOO_MANY_NODES +# define STATUS_TOO_MANY_NODES ((NTSTATUS) 0xC000020EL) +#endif + +#ifndef STATUS_TRANSACTION_ABORTED +# define STATUS_TRANSACTION_ABORTED ((NTSTATUS) 0xC000020FL) +#endif + +#ifndef STATUS_TRANSACTION_TIMED_OUT +# define STATUS_TRANSACTION_TIMED_OUT ((NTSTATUS) 0xC0000210L) +#endif + +#ifndef STATUS_TRANSACTION_NO_RELEASE +# define STATUS_TRANSACTION_NO_RELEASE ((NTSTATUS) 0xC0000211L) +#endif + +#ifndef STATUS_TRANSACTION_NO_MATCH +# define STATUS_TRANSACTION_NO_MATCH ((NTSTATUS) 0xC0000212L) +#endif + +#ifndef STATUS_TRANSACTION_RESPONDED +# define STATUS_TRANSACTION_RESPONDED ((NTSTATUS) 0xC0000213L) +#endif + +#ifndef STATUS_TRANSACTION_INVALID_ID +# define STATUS_TRANSACTION_INVALID_ID ((NTSTATUS) 0xC0000214L) +#endif + +#ifndef STATUS_TRANSACTION_INVALID_TYPE +# define STATUS_TRANSACTION_INVALID_TYPE ((NTSTATUS) 0xC0000215L) +#endif + +#ifndef STATUS_NOT_SERVER_SESSION +# define STATUS_NOT_SERVER_SESSION ((NTSTATUS) 0xC0000216L) +#endif + +#ifndef STATUS_NOT_CLIENT_SESSION +# define STATUS_NOT_CLIENT_SESSION ((NTSTATUS) 0xC0000217L) +#endif + +#ifndef STATUS_CANNOT_LOAD_REGISTRY_FILE +# define STATUS_CANNOT_LOAD_REGISTRY_FILE ((NTSTATUS) 0xC0000218L) +#endif + +#ifndef STATUS_DEBUG_ATTACH_FAILED +# define STATUS_DEBUG_ATTACH_FAILED ((NTSTATUS) 0xC0000219L) +#endif + +#ifndef STATUS_SYSTEM_PROCESS_TERMINATED +# define STATUS_SYSTEM_PROCESS_TERMINATED ((NTSTATUS) 0xC000021AL) +#endif + +#ifndef STATUS_DATA_NOT_ACCEPTED +# define STATUS_DATA_NOT_ACCEPTED ((NTSTATUS) 0xC000021BL) +#endif + +#ifndef STATUS_NO_BROWSER_SERVERS_FOUND +# define STATUS_NO_BROWSER_SERVERS_FOUND ((NTSTATUS) 0xC000021CL) +#endif + +#ifndef STATUS_VDM_HARD_ERROR +# define STATUS_VDM_HARD_ERROR ((NTSTATUS) 0xC000021DL) +#endif + +#ifndef STATUS_DRIVER_CANCEL_TIMEOUT +# define STATUS_DRIVER_CANCEL_TIMEOUT ((NTSTATUS) 0xC000021EL) +#endif + +#ifndef STATUS_REPLY_MESSAGE_MISMATCH +# define STATUS_REPLY_MESSAGE_MISMATCH ((NTSTATUS) 0xC000021FL) +#endif + +#ifndef STATUS_MAPPED_ALIGNMENT +# define STATUS_MAPPED_ALIGNMENT ((NTSTATUS) 0xC0000220L) +#endif + +#ifndef STATUS_IMAGE_CHECKSUM_MISMATCH +# define STATUS_IMAGE_CHECKSUM_MISMATCH ((NTSTATUS) 0xC0000221L) +#endif + +#ifndef STATUS_LOST_WRITEBEHIND_DATA +# define STATUS_LOST_WRITEBEHIND_DATA ((NTSTATUS) 0xC0000222L) +#endif + +#ifndef STATUS_CLIENT_SERVER_PARAMETERS_INVALID +# define STATUS_CLIENT_SERVER_PARAMETERS_INVALID ((NTSTATUS) 0xC0000223L) +#endif + +#ifndef STATUS_PASSWORD_MUST_CHANGE +# define STATUS_PASSWORD_MUST_CHANGE ((NTSTATUS) 0xC0000224L) +#endif + +#ifndef STATUS_NOT_FOUND +# define STATUS_NOT_FOUND ((NTSTATUS) 0xC0000225L) +#endif + +#ifndef STATUS_NOT_TINY_STREAM +# define STATUS_NOT_TINY_STREAM ((NTSTATUS) 0xC0000226L) +#endif + +#ifndef STATUS_RECOVERY_FAILURE +# define STATUS_RECOVERY_FAILURE ((NTSTATUS) 0xC0000227L) +#endif + +#ifndef STATUS_STACK_OVERFLOW_READ +# define STATUS_STACK_OVERFLOW_READ ((NTSTATUS) 0xC0000228L) +#endif + +#ifndef STATUS_FAIL_CHECK +# define STATUS_FAIL_CHECK ((NTSTATUS) 0xC0000229L) +#endif + +#ifndef STATUS_DUPLICATE_OBJECTID +# define STATUS_DUPLICATE_OBJECTID ((NTSTATUS) 0xC000022AL) +#endif + +#ifndef STATUS_OBJECTID_EXISTS +# define STATUS_OBJECTID_EXISTS ((NTSTATUS) 0xC000022BL) +#endif + +#ifndef STATUS_CONVERT_TO_LARGE +# define STATUS_CONVERT_TO_LARGE ((NTSTATUS) 0xC000022CL) +#endif + +#ifndef STATUS_RETRY +# define STATUS_RETRY ((NTSTATUS) 0xC000022DL) +#endif + +#ifndef STATUS_FOUND_OUT_OF_SCOPE +# define STATUS_FOUND_OUT_OF_SCOPE ((NTSTATUS) 0xC000022EL) +#endif + +#ifndef STATUS_ALLOCATE_BUCKET +# define STATUS_ALLOCATE_BUCKET ((NTSTATUS) 0xC000022FL) +#endif + +#ifndef STATUS_PROPSET_NOT_FOUND +# define STATUS_PROPSET_NOT_FOUND ((NTSTATUS) 0xC0000230L) +#endif + +#ifndef STATUS_MARSHALL_OVERFLOW +# define STATUS_MARSHALL_OVERFLOW ((NTSTATUS) 0xC0000231L) +#endif + +#ifndef STATUS_INVALID_VARIANT +# define STATUS_INVALID_VARIANT ((NTSTATUS) 0xC0000232L) +#endif + +#ifndef STATUS_DOMAIN_CONTROLLER_NOT_FOUND +# define STATUS_DOMAIN_CONTROLLER_NOT_FOUND ((NTSTATUS) 0xC0000233L) +#endif + +#ifndef STATUS_ACCOUNT_LOCKED_OUT +# define STATUS_ACCOUNT_LOCKED_OUT ((NTSTATUS) 0xC0000234L) +#endif + +#ifndef STATUS_HANDLE_NOT_CLOSABLE +# define STATUS_HANDLE_NOT_CLOSABLE ((NTSTATUS) 0xC0000235L) +#endif + +#ifndef STATUS_CONNECTION_REFUSED +# define STATUS_CONNECTION_REFUSED ((NTSTATUS) 0xC0000236L) +#endif + +#ifndef STATUS_GRACEFUL_DISCONNECT +# define STATUS_GRACEFUL_DISCONNECT ((NTSTATUS) 0xC0000237L) +#endif + +#ifndef STATUS_ADDRESS_ALREADY_ASSOCIATED +# define STATUS_ADDRESS_ALREADY_ASSOCIATED ((NTSTATUS) 0xC0000238L) +#endif + +#ifndef STATUS_ADDRESS_NOT_ASSOCIATED +# define STATUS_ADDRESS_NOT_ASSOCIATED ((NTSTATUS) 0xC0000239L) +#endif + +#ifndef STATUS_CONNECTION_INVALID +# define STATUS_CONNECTION_INVALID ((NTSTATUS) 0xC000023AL) +#endif + +#ifndef STATUS_CONNECTION_ACTIVE +# define STATUS_CONNECTION_ACTIVE ((NTSTATUS) 0xC000023BL) +#endif + +#ifndef STATUS_NETWORK_UNREACHABLE +# define STATUS_NETWORK_UNREACHABLE ((NTSTATUS) 0xC000023CL) +#endif + +#ifndef STATUS_HOST_UNREACHABLE +# define STATUS_HOST_UNREACHABLE ((NTSTATUS) 0xC000023DL) +#endif + +#ifndef STATUS_PROTOCOL_UNREACHABLE +# define STATUS_PROTOCOL_UNREACHABLE ((NTSTATUS) 0xC000023EL) +#endif + +#ifndef STATUS_PORT_UNREACHABLE +# define STATUS_PORT_UNREACHABLE ((NTSTATUS) 0xC000023FL) +#endif + +#ifndef STATUS_REQUEST_ABORTED +# define STATUS_REQUEST_ABORTED ((NTSTATUS) 0xC0000240L) +#endif + +#ifndef STATUS_CONNECTION_ABORTED +# define STATUS_CONNECTION_ABORTED ((NTSTATUS) 0xC0000241L) +#endif + +#ifndef STATUS_BAD_COMPRESSION_BUFFER +# define STATUS_BAD_COMPRESSION_BUFFER ((NTSTATUS) 0xC0000242L) +#endif + +#ifndef STATUS_USER_MAPPED_FILE +# define STATUS_USER_MAPPED_FILE ((NTSTATUS) 0xC0000243L) +#endif + +#ifndef STATUS_AUDIT_FAILED +# define STATUS_AUDIT_FAILED ((NTSTATUS) 0xC0000244L) +#endif + +#ifndef STATUS_TIMER_RESOLUTION_NOT_SET +# define STATUS_TIMER_RESOLUTION_NOT_SET ((NTSTATUS) 0xC0000245L) +#endif + +#ifndef STATUS_CONNECTION_COUNT_LIMIT +# define STATUS_CONNECTION_COUNT_LIMIT ((NTSTATUS) 0xC0000246L) +#endif + +#ifndef STATUS_LOGIN_TIME_RESTRICTION +# define STATUS_LOGIN_TIME_RESTRICTION ((NTSTATUS) 0xC0000247L) +#endif + +#ifndef STATUS_LOGIN_WKSTA_RESTRICTION +# define STATUS_LOGIN_WKSTA_RESTRICTION ((NTSTATUS) 0xC0000248L) +#endif + +#ifndef STATUS_IMAGE_MP_UP_MISMATCH +# define STATUS_IMAGE_MP_UP_MISMATCH ((NTSTATUS) 0xC0000249L) +#endif + +#ifndef STATUS_INSUFFICIENT_LOGON_INFO +# define STATUS_INSUFFICIENT_LOGON_INFO ((NTSTATUS) 0xC0000250L) +#endif + +#ifndef STATUS_BAD_DLL_ENTRYPOINT +# define STATUS_BAD_DLL_ENTRYPOINT ((NTSTATUS) 0xC0000251L) +#endif + +#ifndef STATUS_BAD_SERVICE_ENTRYPOINT +# define STATUS_BAD_SERVICE_ENTRYPOINT ((NTSTATUS) 0xC0000252L) +#endif + +#ifndef STATUS_LPC_REPLY_LOST +# define STATUS_LPC_REPLY_LOST ((NTSTATUS) 0xC0000253L) +#endif + +#ifndef STATUS_IP_ADDRESS_CONFLICT1 +# define STATUS_IP_ADDRESS_CONFLICT1 ((NTSTATUS) 0xC0000254L) +#endif + +#ifndef STATUS_IP_ADDRESS_CONFLICT2 +# define STATUS_IP_ADDRESS_CONFLICT2 ((NTSTATUS) 0xC0000255L) +#endif + +#ifndef STATUS_REGISTRY_QUOTA_LIMIT +# define STATUS_REGISTRY_QUOTA_LIMIT ((NTSTATUS) 0xC0000256L) +#endif + +#ifndef STATUS_PATH_NOT_COVERED +# define STATUS_PATH_NOT_COVERED ((NTSTATUS) 0xC0000257L) +#endif + +#ifndef STATUS_NO_CALLBACK_ACTIVE +# define STATUS_NO_CALLBACK_ACTIVE ((NTSTATUS) 0xC0000258L) +#endif + +#ifndef STATUS_LICENSE_QUOTA_EXCEEDED +# define STATUS_LICENSE_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000259L) +#endif + +#ifndef STATUS_PWD_TOO_SHORT +# define STATUS_PWD_TOO_SHORT ((NTSTATUS) 0xC000025AL) +#endif + +#ifndef STATUS_PWD_TOO_RECENT +# define STATUS_PWD_TOO_RECENT ((NTSTATUS) 0xC000025BL) +#endif + +#ifndef STATUS_PWD_HISTORY_CONFLICT +# define STATUS_PWD_HISTORY_CONFLICT ((NTSTATUS) 0xC000025CL) +#endif + +#ifndef STATUS_PLUGPLAY_NO_DEVICE +# define STATUS_PLUGPLAY_NO_DEVICE ((NTSTATUS) 0xC000025EL) +#endif + +#ifndef STATUS_UNSUPPORTED_COMPRESSION +# define STATUS_UNSUPPORTED_COMPRESSION ((NTSTATUS) 0xC000025FL) +#endif + +#ifndef STATUS_INVALID_HW_PROFILE +# define STATUS_INVALID_HW_PROFILE ((NTSTATUS) 0xC0000260L) +#endif + +#ifndef STATUS_INVALID_PLUGPLAY_DEVICE_PATH +# define STATUS_INVALID_PLUGPLAY_DEVICE_PATH ((NTSTATUS) 0xC0000261L) +#endif + +#ifndef STATUS_DRIVER_ORDINAL_NOT_FOUND +# define STATUS_DRIVER_ORDINAL_NOT_FOUND ((NTSTATUS) 0xC0000262L) +#endif + +#ifndef STATUS_DRIVER_ENTRYPOINT_NOT_FOUND +# define STATUS_DRIVER_ENTRYPOINT_NOT_FOUND ((NTSTATUS) 0xC0000263L) +#endif + +#ifndef STATUS_RESOURCE_NOT_OWNED +# define STATUS_RESOURCE_NOT_OWNED ((NTSTATUS) 0xC0000264L) +#endif + +#ifndef STATUS_TOO_MANY_LINKS +# define STATUS_TOO_MANY_LINKS ((NTSTATUS) 0xC0000265L) +#endif + +#ifndef STATUS_QUOTA_LIST_INCONSISTENT +# define STATUS_QUOTA_LIST_INCONSISTENT ((NTSTATUS) 0xC0000266L) +#endif + +#ifndef STATUS_FILE_IS_OFFLINE +# define STATUS_FILE_IS_OFFLINE ((NTSTATUS) 0xC0000267L) +#endif + +#ifndef STATUS_EVALUATION_EXPIRATION +# define STATUS_EVALUATION_EXPIRATION ((NTSTATUS) 0xC0000268L) +#endif + +#ifndef STATUS_ILLEGAL_DLL_RELOCATION +# define STATUS_ILLEGAL_DLL_RELOCATION ((NTSTATUS) 0xC0000269L) +#endif + +#ifndef STATUS_LICENSE_VIOLATION +# define STATUS_LICENSE_VIOLATION ((NTSTATUS) 0xC000026AL) +#endif + +#ifndef STATUS_DLL_INIT_FAILED_LOGOFF +# define STATUS_DLL_INIT_FAILED_LOGOFF ((NTSTATUS) 0xC000026BL) +#endif + +#ifndef STATUS_DRIVER_UNABLE_TO_LOAD +# define STATUS_DRIVER_UNABLE_TO_LOAD ((NTSTATUS) 0xC000026CL) +#endif + +#ifndef STATUS_DFS_UNAVAILABLE +# define STATUS_DFS_UNAVAILABLE ((NTSTATUS) 0xC000026DL) +#endif + +#ifndef STATUS_VOLUME_DISMOUNTED +# define STATUS_VOLUME_DISMOUNTED ((NTSTATUS) 0xC000026EL) +#endif + +#ifndef STATUS_WX86_INTERNAL_ERROR +# define STATUS_WX86_INTERNAL_ERROR ((NTSTATUS) 0xC000026FL) +#endif + +#ifndef STATUS_WX86_FLOAT_STACK_CHECK +# define STATUS_WX86_FLOAT_STACK_CHECK ((NTSTATUS) 0xC0000270L) +#endif + +#ifndef STATUS_VALIDATE_CONTINUE +# define STATUS_VALIDATE_CONTINUE ((NTSTATUS) 0xC0000271L) +#endif + +#ifndef STATUS_NO_MATCH +# define STATUS_NO_MATCH ((NTSTATUS) 0xC0000272L) +#endif + +#ifndef STATUS_NO_MORE_MATCHES +# define STATUS_NO_MORE_MATCHES ((NTSTATUS) 0xC0000273L) +#endif + +#ifndef STATUS_NOT_A_REPARSE_POINT +# define STATUS_NOT_A_REPARSE_POINT ((NTSTATUS) 0xC0000275L) +#endif + +#ifndef STATUS_IO_REPARSE_TAG_INVALID +# define STATUS_IO_REPARSE_TAG_INVALID ((NTSTATUS) 0xC0000276L) +#endif + +#ifndef STATUS_IO_REPARSE_TAG_MISMATCH +# define STATUS_IO_REPARSE_TAG_MISMATCH ((NTSTATUS) 0xC0000277L) +#endif + +#ifndef STATUS_IO_REPARSE_DATA_INVALID +# define STATUS_IO_REPARSE_DATA_INVALID ((NTSTATUS) 0xC0000278L) +#endif + +#ifndef STATUS_IO_REPARSE_TAG_NOT_HANDLED +# define STATUS_IO_REPARSE_TAG_NOT_HANDLED ((NTSTATUS) 0xC0000279L) +#endif + +#ifndef STATUS_REPARSE_POINT_NOT_RESOLVED +# define STATUS_REPARSE_POINT_NOT_RESOLVED ((NTSTATUS) 0xC0000280L) +#endif + +#ifndef STATUS_DIRECTORY_IS_A_REPARSE_POINT +# define STATUS_DIRECTORY_IS_A_REPARSE_POINT ((NTSTATUS) 0xC0000281L) +#endif + +#ifndef STATUS_RANGE_LIST_CONFLICT +# define STATUS_RANGE_LIST_CONFLICT ((NTSTATUS) 0xC0000282L) +#endif + +#ifndef STATUS_SOURCE_ELEMENT_EMPTY +# define STATUS_SOURCE_ELEMENT_EMPTY ((NTSTATUS) 0xC0000283L) +#endif + +#ifndef STATUS_DESTINATION_ELEMENT_FULL +# define STATUS_DESTINATION_ELEMENT_FULL ((NTSTATUS) 0xC0000284L) +#endif + +#ifndef STATUS_ILLEGAL_ELEMENT_ADDRESS +# define STATUS_ILLEGAL_ELEMENT_ADDRESS ((NTSTATUS) 0xC0000285L) +#endif + +#ifndef STATUS_MAGAZINE_NOT_PRESENT +# define STATUS_MAGAZINE_NOT_PRESENT ((NTSTATUS) 0xC0000286L) +#endif + +#ifndef STATUS_REINITIALIZATION_NEEDED +# define STATUS_REINITIALIZATION_NEEDED ((NTSTATUS) 0xC0000287L) +#endif + +#ifndef STATUS_DEVICE_REQUIRES_CLEANING +# define STATUS_DEVICE_REQUIRES_CLEANING ((NTSTATUS) 0x80000288L) +#endif + +#ifndef STATUS_DEVICE_DOOR_OPEN +# define STATUS_DEVICE_DOOR_OPEN ((NTSTATUS) 0x80000289L) +#endif + +#ifndef STATUS_ENCRYPTION_FAILED +# define STATUS_ENCRYPTION_FAILED ((NTSTATUS) 0xC000028AL) +#endif + +#ifndef STATUS_DECRYPTION_FAILED +# define STATUS_DECRYPTION_FAILED ((NTSTATUS) 0xC000028BL) +#endif + +#ifndef STATUS_RANGE_NOT_FOUND +# define STATUS_RANGE_NOT_FOUND ((NTSTATUS) 0xC000028CL) +#endif + +#ifndef STATUS_NO_RECOVERY_POLICY +# define STATUS_NO_RECOVERY_POLICY ((NTSTATUS) 0xC000028DL) +#endif + +#ifndef STATUS_NO_EFS +# define STATUS_NO_EFS ((NTSTATUS) 0xC000028EL) +#endif + +#ifndef STATUS_WRONG_EFS +# define STATUS_WRONG_EFS ((NTSTATUS) 0xC000028FL) +#endif + +#ifndef STATUS_NO_USER_KEYS +# define STATUS_NO_USER_KEYS ((NTSTATUS) 0xC0000290L) +#endif + +#ifndef STATUS_FILE_NOT_ENCRYPTED +# define STATUS_FILE_NOT_ENCRYPTED ((NTSTATUS) 0xC0000291L) +#endif + +#ifndef STATUS_NOT_EXPORT_FORMAT +# define STATUS_NOT_EXPORT_FORMAT ((NTSTATUS) 0xC0000292L) +#endif + +#ifndef STATUS_FILE_ENCRYPTED +# define STATUS_FILE_ENCRYPTED ((NTSTATUS) 0xC0000293L) +#endif + +#ifndef STATUS_WAKE_SYSTEM +# define STATUS_WAKE_SYSTEM ((NTSTATUS) 0x40000294L) +#endif + +#ifndef STATUS_WMI_GUID_NOT_FOUND +# define STATUS_WMI_GUID_NOT_FOUND ((NTSTATUS) 0xC0000295L) +#endif + +#ifndef STATUS_WMI_INSTANCE_NOT_FOUND +# define STATUS_WMI_INSTANCE_NOT_FOUND ((NTSTATUS) 0xC0000296L) +#endif + +#ifndef STATUS_WMI_ITEMID_NOT_FOUND +# define STATUS_WMI_ITEMID_NOT_FOUND ((NTSTATUS) 0xC0000297L) +#endif + +#ifndef STATUS_WMI_TRY_AGAIN +# define STATUS_WMI_TRY_AGAIN ((NTSTATUS) 0xC0000298L) +#endif + +#ifndef STATUS_SHARED_POLICY +# define STATUS_SHARED_POLICY ((NTSTATUS) 0xC0000299L) +#endif + +#ifndef STATUS_POLICY_OBJECT_NOT_FOUND +# define STATUS_POLICY_OBJECT_NOT_FOUND ((NTSTATUS) 0xC000029AL) +#endif + +#ifndef STATUS_POLICY_ONLY_IN_DS +# define STATUS_POLICY_ONLY_IN_DS ((NTSTATUS) 0xC000029BL) +#endif + +#ifndef STATUS_VOLUME_NOT_UPGRADED +# define STATUS_VOLUME_NOT_UPGRADED ((NTSTATUS) 0xC000029CL) +#endif + +#ifndef STATUS_REMOTE_STORAGE_NOT_ACTIVE +# define STATUS_REMOTE_STORAGE_NOT_ACTIVE ((NTSTATUS) 0xC000029DL) +#endif + +#ifndef STATUS_REMOTE_STORAGE_MEDIA_ERROR +# define STATUS_REMOTE_STORAGE_MEDIA_ERROR ((NTSTATUS) 0xC000029EL) +#endif + +#ifndef STATUS_NO_TRACKING_SERVICE +# define STATUS_NO_TRACKING_SERVICE ((NTSTATUS) 0xC000029FL) +#endif + +#ifndef STATUS_SERVER_SID_MISMATCH +# define STATUS_SERVER_SID_MISMATCH ((NTSTATUS) 0xC00002A0L) +#endif + +#ifndef STATUS_DS_NO_ATTRIBUTE_OR_VALUE +# define STATUS_DS_NO_ATTRIBUTE_OR_VALUE ((NTSTATUS) 0xC00002A1L) +#endif + +#ifndef STATUS_DS_INVALID_ATTRIBUTE_SYNTAX +# define STATUS_DS_INVALID_ATTRIBUTE_SYNTAX ((NTSTATUS) 0xC00002A2L) +#endif + +#ifndef STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED +# define STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED ((NTSTATUS) 0xC00002A3L) +#endif + +#ifndef STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS +# define STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS ((NTSTATUS) 0xC00002A4L) +#endif + +#ifndef STATUS_DS_BUSY +# define STATUS_DS_BUSY ((NTSTATUS) 0xC00002A5L) +#endif + +#ifndef STATUS_DS_UNAVAILABLE +# define STATUS_DS_UNAVAILABLE ((NTSTATUS) 0xC00002A6L) +#endif + +#ifndef STATUS_DS_NO_RIDS_ALLOCATED +# define STATUS_DS_NO_RIDS_ALLOCATED ((NTSTATUS) 0xC00002A7L) +#endif + +#ifndef STATUS_DS_NO_MORE_RIDS +# define STATUS_DS_NO_MORE_RIDS ((NTSTATUS) 0xC00002A8L) +#endif + +#ifndef STATUS_DS_INCORRECT_ROLE_OWNER +# define STATUS_DS_INCORRECT_ROLE_OWNER ((NTSTATUS) 0xC00002A9L) +#endif + +#ifndef STATUS_DS_RIDMGR_INIT_ERROR +# define STATUS_DS_RIDMGR_INIT_ERROR ((NTSTATUS) 0xC00002AAL) +#endif + +#ifndef STATUS_DS_OBJ_CLASS_VIOLATION +# define STATUS_DS_OBJ_CLASS_VIOLATION ((NTSTATUS) 0xC00002ABL) +#endif + +#ifndef STATUS_DS_CANT_ON_NON_LEAF +# define STATUS_DS_CANT_ON_NON_LEAF ((NTSTATUS) 0xC00002ACL) +#endif + +#ifndef STATUS_DS_CANT_ON_RDN +# define STATUS_DS_CANT_ON_RDN ((NTSTATUS) 0xC00002ADL) +#endif + +#ifndef STATUS_DS_CANT_MOD_OBJ_CLASS +# define STATUS_DS_CANT_MOD_OBJ_CLASS ((NTSTATUS) 0xC00002AEL) +#endif + +#ifndef STATUS_DS_CROSS_DOM_MOVE_FAILED +# define STATUS_DS_CROSS_DOM_MOVE_FAILED ((NTSTATUS) 0xC00002AFL) +#endif + +#ifndef STATUS_DS_GC_NOT_AVAILABLE +# define STATUS_DS_GC_NOT_AVAILABLE ((NTSTATUS) 0xC00002B0L) +#endif + +#ifndef STATUS_DIRECTORY_SERVICE_REQUIRED +# define STATUS_DIRECTORY_SERVICE_REQUIRED ((NTSTATUS) 0xC00002B1L) +#endif + +#ifndef STATUS_REPARSE_ATTRIBUTE_CONFLICT +# define STATUS_REPARSE_ATTRIBUTE_CONFLICT ((NTSTATUS) 0xC00002B2L) +#endif + +#ifndef STATUS_CANT_ENABLE_DENY_ONLY +# define STATUS_CANT_ENABLE_DENY_ONLY ((NTSTATUS) 0xC00002B3L) +#endif + +#ifndef STATUS_FLOAT_MULTIPLE_FAULTS +# define STATUS_FLOAT_MULTIPLE_FAULTS ((NTSTATUS) 0xC00002B4L) +#endif + +#ifndef STATUS_FLOAT_MULTIPLE_TRAPS +# define STATUS_FLOAT_MULTIPLE_TRAPS ((NTSTATUS) 0xC00002B5L) +#endif + +#ifndef STATUS_DEVICE_REMOVED +# define STATUS_DEVICE_REMOVED ((NTSTATUS) 0xC00002B6L) +#endif + +#ifndef STATUS_JOURNAL_DELETE_IN_PROGRESS +# define STATUS_JOURNAL_DELETE_IN_PROGRESS ((NTSTATUS) 0xC00002B7L) +#endif + +#ifndef STATUS_JOURNAL_NOT_ACTIVE +# define STATUS_JOURNAL_NOT_ACTIVE ((NTSTATUS) 0xC00002B8L) +#endif + +#ifndef STATUS_NOINTERFACE +# define STATUS_NOINTERFACE ((NTSTATUS) 0xC00002B9L) +#endif + +#ifndef STATUS_DS_ADMIN_LIMIT_EXCEEDED +# define STATUS_DS_ADMIN_LIMIT_EXCEEDED ((NTSTATUS) 0xC00002C1L) +#endif + +#ifndef STATUS_DRIVER_FAILED_SLEEP +# define STATUS_DRIVER_FAILED_SLEEP ((NTSTATUS) 0xC00002C2L) +#endif + +#ifndef STATUS_MUTUAL_AUTHENTICATION_FAILED +# define STATUS_MUTUAL_AUTHENTICATION_FAILED ((NTSTATUS) 0xC00002C3L) +#endif + +#ifndef STATUS_CORRUPT_SYSTEM_FILE +# define STATUS_CORRUPT_SYSTEM_FILE ((NTSTATUS) 0xC00002C4L) +#endif + +#ifndef STATUS_DATATYPE_MISALIGNMENT_ERROR +# define STATUS_DATATYPE_MISALIGNMENT_ERROR ((NTSTATUS) 0xC00002C5L) +#endif + +#ifndef STATUS_WMI_READ_ONLY +# define STATUS_WMI_READ_ONLY ((NTSTATUS) 0xC00002C6L) +#endif + +#ifndef STATUS_WMI_SET_FAILURE +# define STATUS_WMI_SET_FAILURE ((NTSTATUS) 0xC00002C7L) +#endif + +#ifndef STATUS_COMMITMENT_MINIMUM +# define STATUS_COMMITMENT_MINIMUM ((NTSTATUS) 0xC00002C8L) +#endif + +#ifndef STATUS_REG_NAT_CONSUMPTION +# define STATUS_REG_NAT_CONSUMPTION ((NTSTATUS) 0xC00002C9L) +#endif + +#ifndef STATUS_TRANSPORT_FULL +# define STATUS_TRANSPORT_FULL ((NTSTATUS) 0xC00002CAL) +#endif + +#ifndef STATUS_DS_SAM_INIT_FAILURE +# define STATUS_DS_SAM_INIT_FAILURE ((NTSTATUS) 0xC00002CBL) +#endif + +#ifndef STATUS_ONLY_IF_CONNECTED +# define STATUS_ONLY_IF_CONNECTED ((NTSTATUS) 0xC00002CCL) +#endif + +#ifndef STATUS_DS_SENSITIVE_GROUP_VIOLATION +# define STATUS_DS_SENSITIVE_GROUP_VIOLATION ((NTSTATUS) 0xC00002CDL) +#endif + +#ifndef STATUS_PNP_RESTART_ENUMERATION +# define STATUS_PNP_RESTART_ENUMERATION ((NTSTATUS) 0xC00002CEL) +#endif + +#ifndef STATUS_JOURNAL_ENTRY_DELETED +# define STATUS_JOURNAL_ENTRY_DELETED ((NTSTATUS) 0xC00002CFL) +#endif + +#ifndef STATUS_DS_CANT_MOD_PRIMARYGROUPID +# define STATUS_DS_CANT_MOD_PRIMARYGROUPID ((NTSTATUS) 0xC00002D0L) +#endif + +#ifndef STATUS_SYSTEM_IMAGE_BAD_SIGNATURE +# define STATUS_SYSTEM_IMAGE_BAD_SIGNATURE ((NTSTATUS) 0xC00002D1L) +#endif + +#ifndef STATUS_PNP_REBOOT_REQUIRED +# define STATUS_PNP_REBOOT_REQUIRED ((NTSTATUS) 0xC00002D2L) +#endif + +#ifndef STATUS_POWER_STATE_INVALID +# define STATUS_POWER_STATE_INVALID ((NTSTATUS) 0xC00002D3L) +#endif + +#ifndef STATUS_DS_INVALID_GROUP_TYPE +# define STATUS_DS_INVALID_GROUP_TYPE ((NTSTATUS) 0xC00002D4L) +#endif + +#ifndef STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN +# define STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN ((NTSTATUS) 0xC00002D5L) +#endif + +#ifndef STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN +# define STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN ((NTSTATUS) 0xC00002D6L) +#endif + +#ifndef STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER +# define STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER ((NTSTATUS) 0xC00002D7L) +#endif + +#ifndef STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER +# define STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER ((NTSTATUS) 0xC00002D8L) +#endif + +#ifndef STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER +# define STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER ((NTSTATUS) 0xC00002D9L) +#endif + +#ifndef STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER +# define STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER ((NTSTATUS) 0xC00002DAL) +#endif + +#ifndef STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER +# define STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER ((NTSTATUS) 0xC00002DBL) +#endif + +#ifndef STATUS_DS_HAVE_PRIMARY_MEMBERS +# define STATUS_DS_HAVE_PRIMARY_MEMBERS ((NTSTATUS) 0xC00002DCL) +#endif + +#ifndef STATUS_WMI_NOT_SUPPORTED +# define STATUS_WMI_NOT_SUPPORTED ((NTSTATUS) 0xC00002DDL) +#endif + +#ifndef STATUS_INSUFFICIENT_POWER +# define STATUS_INSUFFICIENT_POWER ((NTSTATUS) 0xC00002DEL) +#endif + +#ifndef STATUS_SAM_NEED_BOOTKEY_PASSWORD +# define STATUS_SAM_NEED_BOOTKEY_PASSWORD ((NTSTATUS) 0xC00002DFL) +#endif + +#ifndef STATUS_SAM_NEED_BOOTKEY_FLOPPY +# define STATUS_SAM_NEED_BOOTKEY_FLOPPY ((NTSTATUS) 0xC00002E0L) +#endif + +#ifndef STATUS_DS_CANT_START +# define STATUS_DS_CANT_START ((NTSTATUS) 0xC00002E1L) +#endif + +#ifndef STATUS_DS_INIT_FAILURE +# define STATUS_DS_INIT_FAILURE ((NTSTATUS) 0xC00002E2L) +#endif + +#ifndef STATUS_SAM_INIT_FAILURE +# define STATUS_SAM_INIT_FAILURE ((NTSTATUS) 0xC00002E3L) +#endif + +#ifndef STATUS_DS_GC_REQUIRED +# define STATUS_DS_GC_REQUIRED ((NTSTATUS) 0xC00002E4L) +#endif + +#ifndef STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY +# define STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY ((NTSTATUS) 0xC00002E5L) +#endif + +#ifndef STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS +# define STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS ((NTSTATUS) 0xC00002E6L) +#endif + +#ifndef STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED +# define STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED ((NTSTATUS) 0xC00002E7L) +#endif + +#ifndef STATUS_MULTIPLE_FAULT_VIOLATION +# define STATUS_MULTIPLE_FAULT_VIOLATION ((NTSTATUS) 0xC00002E8L) +#endif + +#ifndef STATUS_CURRENT_DOMAIN_NOT_ALLOWED +# define STATUS_CURRENT_DOMAIN_NOT_ALLOWED ((NTSTATUS) 0xC00002E9L) +#endif + +#ifndef STATUS_CANNOT_MAKE +# define STATUS_CANNOT_MAKE ((NTSTATUS) 0xC00002EAL) +#endif + +#ifndef STATUS_SYSTEM_SHUTDOWN +# define STATUS_SYSTEM_SHUTDOWN ((NTSTATUS) 0xC00002EBL) +#endif + +#ifndef STATUS_DS_INIT_FAILURE_CONSOLE +# define STATUS_DS_INIT_FAILURE_CONSOLE ((NTSTATUS) 0xC00002ECL) +#endif + +#ifndef STATUS_DS_SAM_INIT_FAILURE_CONSOLE +# define STATUS_DS_SAM_INIT_FAILURE_CONSOLE ((NTSTATUS) 0xC00002EDL) +#endif + +#ifndef STATUS_UNFINISHED_CONTEXT_DELETED +# define STATUS_UNFINISHED_CONTEXT_DELETED ((NTSTATUS) 0xC00002EEL) +#endif + +#ifndef STATUS_NO_TGT_REPLY +# define STATUS_NO_TGT_REPLY ((NTSTATUS) 0xC00002EFL) +#endif + +#ifndef STATUS_OBJECTID_NOT_FOUND +# define STATUS_OBJECTID_NOT_FOUND ((NTSTATUS) 0xC00002F0L) +#endif + +#ifndef STATUS_NO_IP_ADDRESSES +# define STATUS_NO_IP_ADDRESSES ((NTSTATUS) 0xC00002F1L) +#endif + +#ifndef STATUS_WRONG_CREDENTIAL_HANDLE +# define STATUS_WRONG_CREDENTIAL_HANDLE ((NTSTATUS) 0xC00002F2L) +#endif + +#ifndef STATUS_CRYPTO_SYSTEM_INVALID +# define STATUS_CRYPTO_SYSTEM_INVALID ((NTSTATUS) 0xC00002F3L) +#endif + +#ifndef STATUS_MAX_REFERRALS_EXCEEDED +# define STATUS_MAX_REFERRALS_EXCEEDED ((NTSTATUS) 0xC00002F4L) +#endif + +#ifndef STATUS_MUST_BE_KDC +# define STATUS_MUST_BE_KDC ((NTSTATUS) 0xC00002F5L) +#endif + +#ifndef STATUS_STRONG_CRYPTO_NOT_SUPPORTED +# define STATUS_STRONG_CRYPTO_NOT_SUPPORTED ((NTSTATUS) 0xC00002F6L) +#endif + +#ifndef STATUS_TOO_MANY_PRINCIPALS +# define STATUS_TOO_MANY_PRINCIPALS ((NTSTATUS) 0xC00002F7L) +#endif + +#ifndef STATUS_NO_PA_DATA +# define STATUS_NO_PA_DATA ((NTSTATUS) 0xC00002F8L) +#endif + +#ifndef STATUS_PKINIT_NAME_MISMATCH +# define STATUS_PKINIT_NAME_MISMATCH ((NTSTATUS) 0xC00002F9L) +#endif + +#ifndef STATUS_SMARTCARD_LOGON_REQUIRED +# define STATUS_SMARTCARD_LOGON_REQUIRED ((NTSTATUS) 0xC00002FAL) +#endif + +#ifndef STATUS_KDC_INVALID_REQUEST +# define STATUS_KDC_INVALID_REQUEST ((NTSTATUS) 0xC00002FBL) +#endif + +#ifndef STATUS_KDC_UNABLE_TO_REFER +# define STATUS_KDC_UNABLE_TO_REFER ((NTSTATUS) 0xC00002FCL) +#endif + +#ifndef STATUS_KDC_UNKNOWN_ETYPE +# define STATUS_KDC_UNKNOWN_ETYPE ((NTSTATUS) 0xC00002FDL) +#endif + +#ifndef STATUS_SHUTDOWN_IN_PROGRESS +# define STATUS_SHUTDOWN_IN_PROGRESS ((NTSTATUS) 0xC00002FEL) +#endif + +#ifndef STATUS_SERVER_SHUTDOWN_IN_PROGRESS +# define STATUS_SERVER_SHUTDOWN_IN_PROGRESS ((NTSTATUS) 0xC00002FFL) +#endif + +#ifndef STATUS_NOT_SUPPORTED_ON_SBS +# define STATUS_NOT_SUPPORTED_ON_SBS ((NTSTATUS) 0xC0000300L) +#endif + +#ifndef STATUS_WMI_GUID_DISCONNECTED +# define STATUS_WMI_GUID_DISCONNECTED ((NTSTATUS) 0xC0000301L) +#endif + +#ifndef STATUS_WMI_ALREADY_DISABLED +# define STATUS_WMI_ALREADY_DISABLED ((NTSTATUS) 0xC0000302L) +#endif + +#ifndef STATUS_WMI_ALREADY_ENABLED +# define STATUS_WMI_ALREADY_ENABLED ((NTSTATUS) 0xC0000303L) +#endif + +#ifndef STATUS_MFT_TOO_FRAGMENTED +# define STATUS_MFT_TOO_FRAGMENTED ((NTSTATUS) 0xC0000304L) +#endif + +#ifndef STATUS_COPY_PROTECTION_FAILURE +# define STATUS_COPY_PROTECTION_FAILURE ((NTSTATUS) 0xC0000305L) +#endif + +#ifndef STATUS_CSS_AUTHENTICATION_FAILURE +# define STATUS_CSS_AUTHENTICATION_FAILURE ((NTSTATUS) 0xC0000306L) +#endif + +#ifndef STATUS_CSS_KEY_NOT_PRESENT +# define STATUS_CSS_KEY_NOT_PRESENT ((NTSTATUS) 0xC0000307L) +#endif + +#ifndef STATUS_CSS_KEY_NOT_ESTABLISHED +# define STATUS_CSS_KEY_NOT_ESTABLISHED ((NTSTATUS) 0xC0000308L) +#endif + +#ifndef STATUS_CSS_SCRAMBLED_SECTOR +# define STATUS_CSS_SCRAMBLED_SECTOR ((NTSTATUS) 0xC0000309L) +#endif + +#ifndef STATUS_CSS_REGION_MISMATCH +# define STATUS_CSS_REGION_MISMATCH ((NTSTATUS) 0xC000030AL) +#endif + +#ifndef STATUS_CSS_RESETS_EXHAUSTED +# define STATUS_CSS_RESETS_EXHAUSTED ((NTSTATUS) 0xC000030BL) +#endif + +#ifndef STATUS_PKINIT_FAILURE +# define STATUS_PKINIT_FAILURE ((NTSTATUS) 0xC0000320L) +#endif + +#ifndef STATUS_SMARTCARD_SUBSYSTEM_FAILURE +# define STATUS_SMARTCARD_SUBSYSTEM_FAILURE ((NTSTATUS) 0xC0000321L) +#endif + +#ifndef STATUS_NO_KERB_KEY +# define STATUS_NO_KERB_KEY ((NTSTATUS) 0xC0000322L) +#endif + +#ifndef STATUS_HOST_DOWN +# define STATUS_HOST_DOWN ((NTSTATUS) 0xC0000350L) +#endif + +#ifndef STATUS_UNSUPPORTED_PREAUTH +# define STATUS_UNSUPPORTED_PREAUTH ((NTSTATUS) 0xC0000351L) +#endif + +#ifndef STATUS_EFS_ALG_BLOB_TOO_BIG +# define STATUS_EFS_ALG_BLOB_TOO_BIG ((NTSTATUS) 0xC0000352L) +#endif + +#ifndef STATUS_PORT_NOT_SET +# define STATUS_PORT_NOT_SET ((NTSTATUS) 0xC0000353L) +#endif + +#ifndef STATUS_DEBUGGER_INACTIVE +# define STATUS_DEBUGGER_INACTIVE ((NTSTATUS) 0xC0000354L) +#endif + +#ifndef STATUS_DS_VERSION_CHECK_FAILURE +# define STATUS_DS_VERSION_CHECK_FAILURE ((NTSTATUS) 0xC0000355L) +#endif + +#ifndef STATUS_AUDITING_DISABLED +# define STATUS_AUDITING_DISABLED ((NTSTATUS) 0xC0000356L) +#endif + +#ifndef STATUS_PRENT4_MACHINE_ACCOUNT +# define STATUS_PRENT4_MACHINE_ACCOUNT ((NTSTATUS) 0xC0000357L) +#endif + +#ifndef STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER +# define STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER ((NTSTATUS) 0xC0000358L) +#endif + +#ifndef STATUS_INVALID_IMAGE_WIN_32 +# define STATUS_INVALID_IMAGE_WIN_32 ((NTSTATUS) 0xC0000359L) +#endif + +#ifndef STATUS_INVALID_IMAGE_WIN_64 +# define STATUS_INVALID_IMAGE_WIN_64 ((NTSTATUS) 0xC000035AL) +#endif + +#ifndef STATUS_BAD_BINDINGS +# define STATUS_BAD_BINDINGS ((NTSTATUS) 0xC000035BL) +#endif + +#ifndef STATUS_NETWORK_SESSION_EXPIRED +# define STATUS_NETWORK_SESSION_EXPIRED ((NTSTATUS) 0xC000035CL) +#endif + +#ifndef STATUS_APPHELP_BLOCK +# define STATUS_APPHELP_BLOCK ((NTSTATUS) 0xC000035DL) +#endif + +#ifndef STATUS_ALL_SIDS_FILTERED +# define STATUS_ALL_SIDS_FILTERED ((NTSTATUS) 0xC000035EL) +#endif + +#ifndef STATUS_NOT_SAFE_MODE_DRIVER +# define STATUS_NOT_SAFE_MODE_DRIVER ((NTSTATUS) 0xC000035FL) +#endif + +#ifndef STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT +# define STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT ((NTSTATUS) 0xC0000361L) +#endif + +#ifndef STATUS_ACCESS_DISABLED_BY_POLICY_PATH +# define STATUS_ACCESS_DISABLED_BY_POLICY_PATH ((NTSTATUS) 0xC0000362L) +#endif + +#ifndef STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER +# define STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER ((NTSTATUS) 0xC0000363L) +#endif + +#ifndef STATUS_ACCESS_DISABLED_BY_POLICY_OTHER +# define STATUS_ACCESS_DISABLED_BY_POLICY_OTHER ((NTSTATUS) 0xC0000364L) +#endif + +#ifndef STATUS_FAILED_DRIVER_ENTRY +# define STATUS_FAILED_DRIVER_ENTRY ((NTSTATUS) 0xC0000365L) +#endif + +#ifndef STATUS_DEVICE_ENUMERATION_ERROR +# define STATUS_DEVICE_ENUMERATION_ERROR ((NTSTATUS) 0xC0000366L) +#endif + +#ifndef STATUS_MOUNT_POINT_NOT_RESOLVED +# define STATUS_MOUNT_POINT_NOT_RESOLVED ((NTSTATUS) 0xC0000368L) +#endif + +#ifndef STATUS_INVALID_DEVICE_OBJECT_PARAMETER +# define STATUS_INVALID_DEVICE_OBJECT_PARAMETER ((NTSTATUS) 0xC0000369L) +#endif + +#ifndef STATUS_MCA_OCCURED +# define STATUS_MCA_OCCURED ((NTSTATUS) 0xC000036AL) +#endif + +#ifndef STATUS_DRIVER_BLOCKED_CRITICAL +# define STATUS_DRIVER_BLOCKED_CRITICAL ((NTSTATUS) 0xC000036BL) +#endif + +#ifndef STATUS_DRIVER_BLOCKED +# define STATUS_DRIVER_BLOCKED ((NTSTATUS) 0xC000036CL) +#endif + +#ifndef STATUS_DRIVER_DATABASE_ERROR +# define STATUS_DRIVER_DATABASE_ERROR ((NTSTATUS) 0xC000036DL) +#endif + +#ifndef STATUS_SYSTEM_HIVE_TOO_LARGE +# define STATUS_SYSTEM_HIVE_TOO_LARGE ((NTSTATUS) 0xC000036EL) +#endif + +#ifndef STATUS_INVALID_IMPORT_OF_NON_DLL +# define STATUS_INVALID_IMPORT_OF_NON_DLL ((NTSTATUS) 0xC000036FL) +#endif + +#ifndef STATUS_DS_SHUTTING_DOWN +# define STATUS_DS_SHUTTING_DOWN ((NTSTATUS) 0x40000370L) +#endif + +#ifndef STATUS_NO_SECRETS +# define STATUS_NO_SECRETS ((NTSTATUS) 0xC0000371L) +#endif + +#ifndef STATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY +# define STATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY ((NTSTATUS) 0xC0000372L) +#endif + +#ifndef STATUS_FAILED_STACK_SWITCH +# define STATUS_FAILED_STACK_SWITCH ((NTSTATUS) 0xC0000373L) +#endif + +#ifndef STATUS_HEAP_CORRUPTION +# define STATUS_HEAP_CORRUPTION ((NTSTATUS) 0xC0000374L) +#endif + +#ifndef STATUS_SMARTCARD_WRONG_PIN +# define STATUS_SMARTCARD_WRONG_PIN ((NTSTATUS) 0xC0000380L) +#endif + +#ifndef STATUS_SMARTCARD_CARD_BLOCKED +# define STATUS_SMARTCARD_CARD_BLOCKED ((NTSTATUS) 0xC0000381L) +#endif + +#ifndef STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED +# define STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED ((NTSTATUS) 0xC0000382L) +#endif + +#ifndef STATUS_SMARTCARD_NO_CARD +# define STATUS_SMARTCARD_NO_CARD ((NTSTATUS) 0xC0000383L) +#endif + +#ifndef STATUS_SMARTCARD_NO_KEY_CONTAINER +# define STATUS_SMARTCARD_NO_KEY_CONTAINER ((NTSTATUS) 0xC0000384L) +#endif + +#ifndef STATUS_SMARTCARD_NO_CERTIFICATE +# define STATUS_SMARTCARD_NO_CERTIFICATE ((NTSTATUS) 0xC0000385L) +#endif + +#ifndef STATUS_SMARTCARD_NO_KEYSET +# define STATUS_SMARTCARD_NO_KEYSET ((NTSTATUS) 0xC0000386L) +#endif + +#ifndef STATUS_SMARTCARD_IO_ERROR +# define STATUS_SMARTCARD_IO_ERROR ((NTSTATUS) 0xC0000387L) +#endif + +#ifndef STATUS_DOWNGRADE_DETECTED +# define STATUS_DOWNGRADE_DETECTED ((NTSTATUS) 0xC0000388L) +#endif + +#ifndef STATUS_SMARTCARD_CERT_REVOKED +# define STATUS_SMARTCARD_CERT_REVOKED ((NTSTATUS) 0xC0000389L) +#endif + +#ifndef STATUS_ISSUING_CA_UNTRUSTED +# define STATUS_ISSUING_CA_UNTRUSTED ((NTSTATUS) 0xC000038AL) +#endif + +#ifndef STATUS_REVOCATION_OFFLINE_C +# define STATUS_REVOCATION_OFFLINE_C ((NTSTATUS) 0xC000038BL) +#endif + +#ifndef STATUS_PKINIT_CLIENT_FAILURE +# define STATUS_PKINIT_CLIENT_FAILURE ((NTSTATUS) 0xC000038CL) +#endif + +#ifndef STATUS_SMARTCARD_CERT_EXPIRED +# define STATUS_SMARTCARD_CERT_EXPIRED ((NTSTATUS) 0xC000038DL) +#endif + +#ifndef STATUS_DRIVER_FAILED_PRIOR_UNLOAD +# define STATUS_DRIVER_FAILED_PRIOR_UNLOAD ((NTSTATUS) 0xC000038EL) +#endif + +#ifndef STATUS_SMARTCARD_SILENT_CONTEXT +# define STATUS_SMARTCARD_SILENT_CONTEXT ((NTSTATUS) 0xC000038FL) +#endif + +#ifndef STATUS_PER_USER_TRUST_QUOTA_EXCEEDED +# define STATUS_PER_USER_TRUST_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000401L) +#endif + +#ifndef STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED +# define STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000402L) +#endif + +#ifndef STATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED +# define STATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000403L) +#endif + +#ifndef STATUS_DS_NAME_NOT_UNIQUE +# define STATUS_DS_NAME_NOT_UNIQUE ((NTSTATUS) 0xC0000404L) +#endif + +#ifndef STATUS_DS_DUPLICATE_ID_FOUND +# define STATUS_DS_DUPLICATE_ID_FOUND ((NTSTATUS) 0xC0000405L) +#endif + +#ifndef STATUS_DS_GROUP_CONVERSION_ERROR +# define STATUS_DS_GROUP_CONVERSION_ERROR ((NTSTATUS) 0xC0000406L) +#endif + +#ifndef STATUS_VOLSNAP_PREPARE_HIBERNATE +# define STATUS_VOLSNAP_PREPARE_HIBERNATE ((NTSTATUS) 0xC0000407L) +#endif + +#ifndef STATUS_USER2USER_REQUIRED +# define STATUS_USER2USER_REQUIRED ((NTSTATUS) 0xC0000408L) +#endif + +#ifndef STATUS_STACK_BUFFER_OVERRUN +# define STATUS_STACK_BUFFER_OVERRUN ((NTSTATUS) 0xC0000409L) +#endif + +#ifndef STATUS_NO_S4U_PROT_SUPPORT +# define STATUS_NO_S4U_PROT_SUPPORT ((NTSTATUS) 0xC000040AL) +#endif + +#ifndef STATUS_CROSSREALM_DELEGATION_FAILURE +# define STATUS_CROSSREALM_DELEGATION_FAILURE ((NTSTATUS) 0xC000040BL) +#endif + +#ifndef STATUS_REVOCATION_OFFLINE_KDC +# define STATUS_REVOCATION_OFFLINE_KDC ((NTSTATUS) 0xC000040CL) +#endif + +#ifndef STATUS_ISSUING_CA_UNTRUSTED_KDC +# define STATUS_ISSUING_CA_UNTRUSTED_KDC ((NTSTATUS) 0xC000040DL) +#endif + +#ifndef STATUS_KDC_CERT_EXPIRED +# define STATUS_KDC_CERT_EXPIRED ((NTSTATUS) 0xC000040EL) +#endif + +#ifndef STATUS_KDC_CERT_REVOKED +# define STATUS_KDC_CERT_REVOKED ((NTSTATUS) 0xC000040FL) +#endif + +#ifndef STATUS_PARAMETER_QUOTA_EXCEEDED +# define STATUS_PARAMETER_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000410L) +#endif + +#ifndef STATUS_HIBERNATION_FAILURE +# define STATUS_HIBERNATION_FAILURE ((NTSTATUS) 0xC0000411L) +#endif + +#ifndef STATUS_DELAY_LOAD_FAILED +# define STATUS_DELAY_LOAD_FAILED ((NTSTATUS) 0xC0000412L) +#endif + +#ifndef STATUS_AUTHENTICATION_FIREWALL_FAILED +# define STATUS_AUTHENTICATION_FIREWALL_FAILED ((NTSTATUS) 0xC0000413L) +#endif + +#ifndef STATUS_VDM_DISALLOWED +# define STATUS_VDM_DISALLOWED ((NTSTATUS) 0xC0000414L) +#endif + +#ifndef STATUS_HUNG_DISPLAY_DRIVER_THREAD +# define STATUS_HUNG_DISPLAY_DRIVER_THREAD ((NTSTATUS) 0xC0000415L) +#endif + +#ifndef STATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE +# define STATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE ((NTSTATUS) 0xC0000416L) +#endif + +#ifndef STATUS_INVALID_CRUNTIME_PARAMETER +# define STATUS_INVALID_CRUNTIME_PARAMETER ((NTSTATUS) 0xC0000417L) +#endif + +#ifndef STATUS_NTLM_BLOCKED +# define STATUS_NTLM_BLOCKED ((NTSTATUS) 0xC0000418L) +#endif + +#ifndef STATUS_DS_SRC_SID_EXISTS_IN_FOREST +# define STATUS_DS_SRC_SID_EXISTS_IN_FOREST ((NTSTATUS) 0xC0000419L) +#endif + +#ifndef STATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST +# define STATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST ((NTSTATUS) 0xC000041AL) +#endif + +#ifndef STATUS_DS_FLAT_NAME_EXISTS_IN_FOREST +# define STATUS_DS_FLAT_NAME_EXISTS_IN_FOREST ((NTSTATUS) 0xC000041BL) +#endif + +#ifndef STATUS_INVALID_USER_PRINCIPAL_NAME +# define STATUS_INVALID_USER_PRINCIPAL_NAME ((NTSTATUS) 0xC000041CL) +#endif + +#ifndef STATUS_FATAL_USER_CALLBACK_EXCEPTION +# define STATUS_FATAL_USER_CALLBACK_EXCEPTION ((NTSTATUS) 0xC000041DL) +#endif + +#ifndef STATUS_ASSERTION_FAILURE +# define STATUS_ASSERTION_FAILURE ((NTSTATUS) 0xC0000420L) +#endif + +#ifndef STATUS_VERIFIER_STOP +# define STATUS_VERIFIER_STOP ((NTSTATUS) 0xC0000421L) +#endif + +#ifndef STATUS_CALLBACK_POP_STACK +# define STATUS_CALLBACK_POP_STACK ((NTSTATUS) 0xC0000423L) +#endif + +#ifndef STATUS_INCOMPATIBLE_DRIVER_BLOCKED +# define STATUS_INCOMPATIBLE_DRIVER_BLOCKED ((NTSTATUS) 0xC0000424L) +#endif + +#ifndef STATUS_HIVE_UNLOADED +# define STATUS_HIVE_UNLOADED ((NTSTATUS) 0xC0000425L) +#endif + +#ifndef STATUS_COMPRESSION_DISABLED +# define STATUS_COMPRESSION_DISABLED ((NTSTATUS) 0xC0000426L) +#endif + +#ifndef STATUS_FILE_SYSTEM_LIMITATION +# define STATUS_FILE_SYSTEM_LIMITATION ((NTSTATUS) 0xC0000427L) +#endif + +#ifndef STATUS_INVALID_IMAGE_HASH +# define STATUS_INVALID_IMAGE_HASH ((NTSTATUS) 0xC0000428L) +#endif + +#ifndef STATUS_NOT_CAPABLE +# define STATUS_NOT_CAPABLE ((NTSTATUS) 0xC0000429L) +#endif + +#ifndef STATUS_REQUEST_OUT_OF_SEQUENCE +# define STATUS_REQUEST_OUT_OF_SEQUENCE ((NTSTATUS) 0xC000042AL) +#endif + +#ifndef STATUS_IMPLEMENTATION_LIMIT +# define STATUS_IMPLEMENTATION_LIMIT ((NTSTATUS) 0xC000042BL) +#endif + +#ifndef STATUS_ELEVATION_REQUIRED +# define STATUS_ELEVATION_REQUIRED ((NTSTATUS) 0xC000042CL) +#endif + +#ifndef STATUS_NO_SECURITY_CONTEXT +# define STATUS_NO_SECURITY_CONTEXT ((NTSTATUS) 0xC000042DL) +#endif + +#ifndef STATUS_PKU2U_CERT_FAILURE +# define STATUS_PKU2U_CERT_FAILURE ((NTSTATUS) 0xC000042FL) +#endif + +#ifndef STATUS_BEYOND_VDL +# define STATUS_BEYOND_VDL ((NTSTATUS) 0xC0000432L) +#endif + +#ifndef STATUS_ENCOUNTERED_WRITE_IN_PROGRESS +# define STATUS_ENCOUNTERED_WRITE_IN_PROGRESS ((NTSTATUS) 0xC0000433L) +#endif + +#ifndef STATUS_PTE_CHANGED +# define STATUS_PTE_CHANGED ((NTSTATUS) 0xC0000434L) +#endif + +#ifndef STATUS_PURGE_FAILED +# define STATUS_PURGE_FAILED ((NTSTATUS) 0xC0000435L) +#endif + +#ifndef STATUS_CRED_REQUIRES_CONFIRMATION +# define STATUS_CRED_REQUIRES_CONFIRMATION ((NTSTATUS) 0xC0000440L) +#endif + +#ifndef STATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE +# define STATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE ((NTSTATUS) 0xC0000441L) +#endif + +#ifndef STATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER +# define STATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER ((NTSTATUS) 0xC0000442L) +#endif + +#ifndef STATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE +# define STATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE ((NTSTATUS) 0xC0000443L) +#endif + +#ifndef STATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE +# define STATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE ((NTSTATUS) 0xC0000444L) +#endif + +#ifndef STATUS_CS_ENCRYPTION_FILE_NOT_CSE +# define STATUS_CS_ENCRYPTION_FILE_NOT_CSE ((NTSTATUS) 0xC0000445L) +#endif + +#ifndef STATUS_INVALID_LABEL +# define STATUS_INVALID_LABEL ((NTSTATUS) 0xC0000446L) +#endif + +#ifndef STATUS_DRIVER_PROCESS_TERMINATED +# define STATUS_DRIVER_PROCESS_TERMINATED ((NTSTATUS) 0xC0000450L) +#endif + +#ifndef STATUS_AMBIGUOUS_SYSTEM_DEVICE +# define STATUS_AMBIGUOUS_SYSTEM_DEVICE ((NTSTATUS) 0xC0000451L) +#endif + +#ifndef STATUS_SYSTEM_DEVICE_NOT_FOUND +# define STATUS_SYSTEM_DEVICE_NOT_FOUND ((NTSTATUS) 0xC0000452L) +#endif + +#ifndef STATUS_RESTART_BOOT_APPLICATION +# define STATUS_RESTART_BOOT_APPLICATION ((NTSTATUS) 0xC0000453L) +#endif + +#ifndef STATUS_INSUFFICIENT_NVRAM_RESOURCES +# define STATUS_INSUFFICIENT_NVRAM_RESOURCES ((NTSTATUS) 0xC0000454L) +#endif + +#ifndef STATUS_INVALID_TASK_NAME +# define STATUS_INVALID_TASK_NAME ((NTSTATUS) 0xC0000500L) +#endif + +#ifndef STATUS_INVALID_TASK_INDEX +# define STATUS_INVALID_TASK_INDEX ((NTSTATUS) 0xC0000501L) +#endif + +#ifndef STATUS_THREAD_ALREADY_IN_TASK +# define STATUS_THREAD_ALREADY_IN_TASK ((NTSTATUS) 0xC0000502L) +#endif + +#ifndef STATUS_CALLBACK_BYPASS +# define STATUS_CALLBACK_BYPASS ((NTSTATUS) 0xC0000503L) +#endif + +#ifndef STATUS_FAIL_FAST_EXCEPTION +# define STATUS_FAIL_FAST_EXCEPTION ((NTSTATUS) 0xC0000602L) +#endif + +#ifndef STATUS_IMAGE_CERT_REVOKED +# define STATUS_IMAGE_CERT_REVOKED ((NTSTATUS) 0xC0000603L) +#endif + +#ifndef STATUS_PORT_CLOSED +# define STATUS_PORT_CLOSED ((NTSTATUS) 0xC0000700L) +#endif + +#ifndef STATUS_MESSAGE_LOST +# define STATUS_MESSAGE_LOST ((NTSTATUS) 0xC0000701L) +#endif + +#ifndef STATUS_INVALID_MESSAGE +# define STATUS_INVALID_MESSAGE ((NTSTATUS) 0xC0000702L) +#endif + +#ifndef STATUS_REQUEST_CANCELED +# define STATUS_REQUEST_CANCELED ((NTSTATUS) 0xC0000703L) +#endif + +#ifndef STATUS_RECURSIVE_DISPATCH +# define STATUS_RECURSIVE_DISPATCH ((NTSTATUS) 0xC0000704L) +#endif + +#ifndef STATUS_LPC_RECEIVE_BUFFER_EXPECTED +# define STATUS_LPC_RECEIVE_BUFFER_EXPECTED ((NTSTATUS) 0xC0000705L) +#endif + +#ifndef STATUS_LPC_INVALID_CONNECTION_USAGE +# define STATUS_LPC_INVALID_CONNECTION_USAGE ((NTSTATUS) 0xC0000706L) +#endif + +#ifndef STATUS_LPC_REQUESTS_NOT_ALLOWED +# define STATUS_LPC_REQUESTS_NOT_ALLOWED ((NTSTATUS) 0xC0000707L) +#endif + +#ifndef STATUS_RESOURCE_IN_USE +# define STATUS_RESOURCE_IN_USE ((NTSTATUS) 0xC0000708L) +#endif + +#ifndef STATUS_HARDWARE_MEMORY_ERROR +# define STATUS_HARDWARE_MEMORY_ERROR ((NTSTATUS) 0xC0000709L) +#endif + +#ifndef STATUS_THREADPOOL_HANDLE_EXCEPTION +# define STATUS_THREADPOOL_HANDLE_EXCEPTION ((NTSTATUS) 0xC000070AL) +#endif + +#ifndef STATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED +# define STATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED ((NTSTATUS) 0xC000070BL) +#endif + +#ifndef STATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED +# define STATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED ((NTSTATUS) 0xC000070CL) +#endif + +#ifndef STATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED +# define STATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED ((NTSTATUS) 0xC000070DL) +#endif + +#ifndef STATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED +# define STATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED ((NTSTATUS) 0xC000070EL) +#endif + +#ifndef STATUS_THREADPOOL_RELEASED_DURING_OPERATION +# define STATUS_THREADPOOL_RELEASED_DURING_OPERATION ((NTSTATUS) 0xC000070FL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING +# define STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING ((NTSTATUS) 0xC0000710L) +#endif + +#ifndef STATUS_APC_RETURNED_WHILE_IMPERSONATING +# define STATUS_APC_RETURNED_WHILE_IMPERSONATING ((NTSTATUS) 0xC0000711L) +#endif + +#ifndef STATUS_PROCESS_IS_PROTECTED +# define STATUS_PROCESS_IS_PROTECTED ((NTSTATUS) 0xC0000712L) +#endif + +#ifndef STATUS_MCA_EXCEPTION +# define STATUS_MCA_EXCEPTION ((NTSTATUS) 0xC0000713L) +#endif + +#ifndef STATUS_CERTIFICATE_MAPPING_NOT_UNIQUE +# define STATUS_CERTIFICATE_MAPPING_NOT_UNIQUE ((NTSTATUS) 0xC0000714L) +#endif + +#ifndef STATUS_SYMLINK_CLASS_DISABLED +# define STATUS_SYMLINK_CLASS_DISABLED ((NTSTATUS) 0xC0000715L) +#endif + +#ifndef STATUS_INVALID_IDN_NORMALIZATION +# define STATUS_INVALID_IDN_NORMALIZATION ((NTSTATUS) 0xC0000716L) +#endif + +#ifndef STATUS_NO_UNICODE_TRANSLATION +# define STATUS_NO_UNICODE_TRANSLATION ((NTSTATUS) 0xC0000717L) +#endif + +#ifndef STATUS_ALREADY_REGISTERED +# define STATUS_ALREADY_REGISTERED ((NTSTATUS) 0xC0000718L) +#endif + +#ifndef STATUS_CONTEXT_MISMATCH +# define STATUS_CONTEXT_MISMATCH ((NTSTATUS) 0xC0000719L) +#endif + +#ifndef STATUS_PORT_ALREADY_HAS_COMPLETION_LIST +# define STATUS_PORT_ALREADY_HAS_COMPLETION_LIST ((NTSTATUS) 0xC000071AL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_THREAD_PRIORITY +# define STATUS_CALLBACK_RETURNED_THREAD_PRIORITY ((NTSTATUS) 0xC000071BL) +#endif + +#ifndef STATUS_INVALID_THREAD +# define STATUS_INVALID_THREAD ((NTSTATUS) 0xC000071CL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_TRANSACTION +# define STATUS_CALLBACK_RETURNED_TRANSACTION ((NTSTATUS) 0xC000071DL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_LDR_LOCK +# define STATUS_CALLBACK_RETURNED_LDR_LOCK ((NTSTATUS) 0xC000071EL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_LANG +# define STATUS_CALLBACK_RETURNED_LANG ((NTSTATUS) 0xC000071FL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_PRI_BACK +# define STATUS_CALLBACK_RETURNED_PRI_BACK ((NTSTATUS) 0xC0000720L) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_THREAD_AFFINITY +# define STATUS_CALLBACK_RETURNED_THREAD_AFFINITY ((NTSTATUS) 0xC0000721L) +#endif + +#ifndef STATUS_DISK_REPAIR_DISABLED +# define STATUS_DISK_REPAIR_DISABLED ((NTSTATUS) 0xC0000800L) +#endif + +#ifndef STATUS_DS_DOMAIN_RENAME_IN_PROGRESS +# define STATUS_DS_DOMAIN_RENAME_IN_PROGRESS ((NTSTATUS) 0xC0000801L) +#endif + +#ifndef STATUS_DISK_QUOTA_EXCEEDED +# define STATUS_DISK_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000802L) +#endif + +#ifndef STATUS_DATA_LOST_REPAIR +# define STATUS_DATA_LOST_REPAIR ((NTSTATUS) 0x80000803L) +#endif + +#ifndef STATUS_CONTENT_BLOCKED +# define STATUS_CONTENT_BLOCKED ((NTSTATUS) 0xC0000804L) +#endif + +#ifndef STATUS_BAD_CLUSTERS +# define STATUS_BAD_CLUSTERS ((NTSTATUS) 0xC0000805L) +#endif + +#ifndef STATUS_VOLUME_DIRTY +# define STATUS_VOLUME_DIRTY ((NTSTATUS) 0xC0000806L) +#endif + +#ifndef STATUS_FILE_CHECKED_OUT +# define STATUS_FILE_CHECKED_OUT ((NTSTATUS) 0xC0000901L) +#endif + +#ifndef STATUS_CHECKOUT_REQUIRED +# define STATUS_CHECKOUT_REQUIRED ((NTSTATUS) 0xC0000902L) +#endif + +#ifndef STATUS_BAD_FILE_TYPE +# define STATUS_BAD_FILE_TYPE ((NTSTATUS) 0xC0000903L) +#endif + +#ifndef STATUS_FILE_TOO_LARGE +# define STATUS_FILE_TOO_LARGE ((NTSTATUS) 0xC0000904L) +#endif + +#ifndef STATUS_FORMS_AUTH_REQUIRED +# define STATUS_FORMS_AUTH_REQUIRED ((NTSTATUS) 0xC0000905L) +#endif + +#ifndef STATUS_VIRUS_INFECTED +# define STATUS_VIRUS_INFECTED ((NTSTATUS) 0xC0000906L) +#endif + +#ifndef STATUS_VIRUS_DELETED +# define STATUS_VIRUS_DELETED ((NTSTATUS) 0xC0000907L) +#endif + +#ifndef STATUS_BAD_MCFG_TABLE +# define STATUS_BAD_MCFG_TABLE ((NTSTATUS) 0xC0000908L) +#endif + +#ifndef STATUS_CANNOT_BREAK_OPLOCK +# define STATUS_CANNOT_BREAK_OPLOCK ((NTSTATUS) 0xC0000909L) +#endif + +#ifndef STATUS_WOW_ASSERTION +# define STATUS_WOW_ASSERTION ((NTSTATUS) 0xC0009898L) +#endif + +#ifndef STATUS_INVALID_SIGNATURE +# define STATUS_INVALID_SIGNATURE ((NTSTATUS) 0xC000A000L) +#endif + +#ifndef STATUS_HMAC_NOT_SUPPORTED +# define STATUS_HMAC_NOT_SUPPORTED ((NTSTATUS) 0xC000A001L) +#endif + +#ifndef STATUS_AUTH_TAG_MISMATCH +# define STATUS_AUTH_TAG_MISMATCH ((NTSTATUS) 0xC000A002L) +#endif + +#ifndef STATUS_IPSEC_QUEUE_OVERFLOW +# define STATUS_IPSEC_QUEUE_OVERFLOW ((NTSTATUS) 0xC000A010L) +#endif + +#ifndef STATUS_ND_QUEUE_OVERFLOW +# define STATUS_ND_QUEUE_OVERFLOW ((NTSTATUS) 0xC000A011L) +#endif + +#ifndef STATUS_HOPLIMIT_EXCEEDED +# define STATUS_HOPLIMIT_EXCEEDED ((NTSTATUS) 0xC000A012L) +#endif + +#ifndef STATUS_PROTOCOL_NOT_SUPPORTED +# define STATUS_PROTOCOL_NOT_SUPPORTED ((NTSTATUS) 0xC000A013L) +#endif + +#ifndef STATUS_FASTPATH_REJECTED +# define STATUS_FASTPATH_REJECTED ((NTSTATUS) 0xC000A014L) +#endif + +#ifndef STATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED +# define STATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED ((NTSTATUS) 0xC000A080L) +#endif + +#ifndef STATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR +# define STATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR ((NTSTATUS) 0xC000A081L) +#endif + +#ifndef STATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR +# define STATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR ((NTSTATUS) 0xC000A082L) +#endif + +#ifndef STATUS_XML_PARSE_ERROR +# define STATUS_XML_PARSE_ERROR ((NTSTATUS) 0xC000A083L) +#endif + +#ifndef STATUS_XMLDSIG_ERROR +# define STATUS_XMLDSIG_ERROR ((NTSTATUS) 0xC000A084L) +#endif + +#ifndef STATUS_WRONG_COMPARTMENT +# define STATUS_WRONG_COMPARTMENT ((NTSTATUS) 0xC000A085L) +#endif + +#ifndef STATUS_AUTHIP_FAILURE +# define STATUS_AUTHIP_FAILURE ((NTSTATUS) 0xC000A086L) +#endif + +#ifndef STATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS +# define STATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS ((NTSTATUS) 0xC000A087L) +#endif + +#ifndef STATUS_DS_OID_NOT_FOUND +# define STATUS_DS_OID_NOT_FOUND ((NTSTATUS) 0xC000A088L) +#endif + +#ifndef STATUS_HASH_NOT_SUPPORTED +# define STATUS_HASH_NOT_SUPPORTED ((NTSTATUS) 0xC000A100L) +#endif + +#ifndef STATUS_HASH_NOT_PRESENT +# define STATUS_HASH_NOT_PRESENT ((NTSTATUS) 0xC000A101L) +#endif + +/* This is not the NTSTATUS_FROM_WIN32 that the DDK provides, because the */ +/* DDK got it wrong! */ +#ifdef NTSTATUS_FROM_WIN32 +# undef NTSTATUS_FROM_WIN32 +#endif +#define NTSTATUS_FROM_WIN32(error) ((NTSTATUS) (error) <= 0 ? \ + ((NTSTATUS) (error)) : ((NTSTATUS) (((error) & 0x0000FFFF) | \ + (FACILITY_NTWIN32 << 16) | ERROR_SEVERITY_WARNING))) + +#ifndef JOB_OBJECT_LIMIT_PROCESS_MEMORY +# define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x00000100 +#endif +#ifndef JOB_OBJECT_LIMIT_JOB_MEMORY +# define JOB_OBJECT_LIMIT_JOB_MEMORY 0x00000200 +#endif +#ifndef JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION +# define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x00000400 +#endif +#ifndef JOB_OBJECT_LIMIT_BREAKAWAY_OK +# define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x00000800 +#endif +#ifndef JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK +# define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x00001000 +#endif +#ifndef JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE +# define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000 +#endif + +/* from winternl.h */ +typedef struct _UNICODE_STRING { + USHORT Length; + USHORT MaximumLength; + PWSTR Buffer; +} UNICODE_STRING, *PUNICODE_STRING; + +typedef const UNICODE_STRING *PCUNICODE_STRING; + +/* from ntifs.h */ +#ifndef DEVICE_TYPE +# define DEVICE_TYPE DWORD +#endif + +/* MinGW already has a definition for REPARSE_DATA_BUFFER, but mingw-w64 does + * not. + */ +#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) + typedef struct _REPARSE_DATA_BUFFER { + ULONG ReparseTag; + USHORT ReparseDataLength; + USHORT Reserved; + union { + struct { + USHORT SubstituteNameOffset; + USHORT SubstituteNameLength; + USHORT PrintNameOffset; + USHORT PrintNameLength; + ULONG Flags; + WCHAR PathBuffer[1]; + } SymbolicLinkReparseBuffer; + struct { + USHORT SubstituteNameOffset; + USHORT SubstituteNameLength; + USHORT PrintNameOffset; + USHORT PrintNameLength; + WCHAR PathBuffer[1]; + } MountPointReparseBuffer; + struct { + UCHAR DataBuffer[1]; + } GenericReparseBuffer; + } DUMMYUNIONNAME; + } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; +#endif + +typedef struct _IO_STATUS_BLOCK { + union { + NTSTATUS Status; + PVOID Pointer; + } DUMMYUNIONNAME; + ULONG_PTR Information; +} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; + +typedef enum _FILE_INFORMATION_CLASS { + FileDirectoryInformation = 1, + FileFullDirectoryInformation, + FileBothDirectoryInformation, + FileBasicInformation, + FileStandardInformation, + FileInternalInformation, + FileEaInformation, + FileAccessInformation, + FileNameInformation, + FileRenameInformation, + FileLinkInformation, + FileNamesInformation, + FileDispositionInformation, + FilePositionInformation, + FileFullEaInformation, + FileModeInformation, + FileAlignmentInformation, + FileAllInformation, + FileAllocationInformation, + FileEndOfFileInformation, + FileAlternateNameInformation, + FileStreamInformation, + FilePipeInformation, + FilePipeLocalInformation, + FilePipeRemoteInformation, + FileMailslotQueryInformation, + FileMailslotSetInformation, + FileCompressionInformation, + FileObjectIdInformation, + FileCompletionInformation, + FileMoveClusterInformation, + FileQuotaInformation, + FileReparsePointInformation, + FileNetworkOpenInformation, + FileAttributeTagInformation, + FileTrackingInformation, + FileIdBothDirectoryInformation, + FileIdFullDirectoryInformation, + FileValidDataLengthInformation, + FileShortNameInformation, + FileIoCompletionNotificationInformation, + FileIoStatusBlockRangeInformation, + FileIoPriorityHintInformation, + FileSfioReserveInformation, + FileSfioVolumeInformation, + FileHardLinkInformation, + FileProcessIdsUsingFileInformation, + FileNormalizedNameInformation, + FileNetworkPhysicalNameInformation, + FileIdGlobalTxDirectoryInformation, + FileIsRemoteDeviceInformation, + FileAttributeCacheInformation, + FileNumaNodeInformation, + FileStandardLinkInformation, + FileRemoteProtocolInformation, + FileMaximumInformation +} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; + +typedef struct _FILE_DIRECTORY_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + WCHAR FileName[1]; +} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION; + +typedef struct _FILE_BOTH_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + CCHAR ShortNameLength; + WCHAR ShortName[12]; + WCHAR FileName[1]; +} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION; + +typedef struct _FILE_BASIC_INFORMATION { + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + DWORD FileAttributes; +} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION; + +typedef struct _FILE_STANDARD_INFORMATION { + LARGE_INTEGER AllocationSize; + LARGE_INTEGER EndOfFile; + ULONG NumberOfLinks; + BOOLEAN DeletePending; + BOOLEAN Directory; +} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION; + +typedef struct _FILE_INTERNAL_INFORMATION { + LARGE_INTEGER IndexNumber; +} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION; + +typedef struct _FILE_EA_INFORMATION { + ULONG EaSize; +} FILE_EA_INFORMATION, *PFILE_EA_INFORMATION; + +typedef struct _FILE_ACCESS_INFORMATION { + ACCESS_MASK AccessFlags; +} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION; + +typedef struct _FILE_POSITION_INFORMATION { + LARGE_INTEGER CurrentByteOffset; +} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION; + +typedef struct _FILE_MODE_INFORMATION { + ULONG Mode; +} FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION; + +typedef struct _FILE_ALIGNMENT_INFORMATION { + ULONG AlignmentRequirement; +} FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION; + +typedef struct _FILE_NAME_INFORMATION { + ULONG FileNameLength; + WCHAR FileName[1]; +} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; + +typedef struct _FILE_END_OF_FILE_INFORMATION { + LARGE_INTEGER EndOfFile; +} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION; + +typedef struct _FILE_ALL_INFORMATION { + FILE_BASIC_INFORMATION BasicInformation; + FILE_STANDARD_INFORMATION StandardInformation; + FILE_INTERNAL_INFORMATION InternalInformation; + FILE_EA_INFORMATION EaInformation; + FILE_ACCESS_INFORMATION AccessInformation; + FILE_POSITION_INFORMATION PositionInformation; + FILE_MODE_INFORMATION ModeInformation; + FILE_ALIGNMENT_INFORMATION AlignmentInformation; + FILE_NAME_INFORMATION NameInformation; +} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION; + +typedef struct _FILE_DISPOSITION_INFORMATION { + BOOLEAN DeleteFile; +} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; + +typedef struct _FILE_PIPE_LOCAL_INFORMATION { + ULONG NamedPipeType; + ULONG NamedPipeConfiguration; + ULONG MaximumInstances; + ULONG CurrentInstances; + ULONG InboundQuota; + ULONG ReadDataAvailable; + ULONG OutboundQuota; + ULONG WriteQuotaAvailable; + ULONG NamedPipeState; + ULONG NamedPipeEnd; +} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION; + +#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010 +#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020 + +typedef enum _FS_INFORMATION_CLASS { + FileFsVolumeInformation = 1, + FileFsLabelInformation = 2, + FileFsSizeInformation = 3, + FileFsDeviceInformation = 4, + FileFsAttributeInformation = 5, + FileFsControlInformation = 6, + FileFsFullSizeInformation = 7, + FileFsObjectIdInformation = 8, + FileFsDriverPathInformation = 9, + FileFsVolumeFlagsInformation = 10, + FileFsSectorSizeInformation = 11 +} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS; + +typedef struct _FILE_FS_VOLUME_INFORMATION { + LARGE_INTEGER VolumeCreationTime; + ULONG VolumeSerialNumber; + ULONG VolumeLabelLength; + BOOLEAN SupportsObjects; + WCHAR VolumeLabel[1]; +} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION; + +typedef struct _FILE_FS_LABEL_INFORMATION { + ULONG VolumeLabelLength; + WCHAR VolumeLabel[1]; +} FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION; + +typedef struct _FILE_FS_SIZE_INFORMATION { + LARGE_INTEGER TotalAllocationUnits; + LARGE_INTEGER AvailableAllocationUnits; + ULONG SectorsPerAllocationUnit; + ULONG BytesPerSector; +} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION; + +typedef struct _FILE_FS_DEVICE_INFORMATION { + DEVICE_TYPE DeviceType; + ULONG Characteristics; +} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION; + +typedef struct _FILE_FS_ATTRIBUTE_INFORMATION { + ULONG FileSystemAttributes; + LONG MaximumComponentNameLength; + ULONG FileSystemNameLength; + WCHAR FileSystemName[1]; +} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION; + +typedef struct _FILE_FS_CONTROL_INFORMATION { + LARGE_INTEGER FreeSpaceStartFiltering; + LARGE_INTEGER FreeSpaceThreshold; + LARGE_INTEGER FreeSpaceStopFiltering; + LARGE_INTEGER DefaultQuotaThreshold; + LARGE_INTEGER DefaultQuotaLimit; + ULONG FileSystemControlFlags; +} FILE_FS_CONTROL_INFORMATION, *PFILE_FS_CONTROL_INFORMATION; + +typedef struct _FILE_FS_FULL_SIZE_INFORMATION { + LARGE_INTEGER TotalAllocationUnits; + LARGE_INTEGER CallerAvailableAllocationUnits; + LARGE_INTEGER ActualAvailableAllocationUnits; + ULONG SectorsPerAllocationUnit; + ULONG BytesPerSector; +} FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION; + +typedef struct _FILE_FS_OBJECTID_INFORMATION { + UCHAR ObjectId[16]; + UCHAR ExtendedInfo[48]; +} FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION; + +typedef struct _FILE_FS_DRIVER_PATH_INFORMATION { + BOOLEAN DriverInPath; + ULONG DriverNameLength; + WCHAR DriverName[1]; +} FILE_FS_DRIVER_PATH_INFORMATION, *PFILE_FS_DRIVER_PATH_INFORMATION; + +typedef struct _FILE_FS_VOLUME_FLAGS_INFORMATION { + ULONG Flags; +} FILE_FS_VOLUME_FLAGS_INFORMATION, *PFILE_FS_VOLUME_FLAGS_INFORMATION; + +typedef struct _FILE_FS_SECTOR_SIZE_INFORMATION { + ULONG LogicalBytesPerSector; + ULONG PhysicalBytesPerSectorForAtomicity; + ULONG PhysicalBytesPerSectorForPerformance; + ULONG FileSystemEffectivePhysicalBytesPerSectorForAtomicity; + ULONG Flags; + ULONG ByteOffsetForSectorAlignment; + ULONG ByteOffsetForPartitionAlignment; +} FILE_FS_SECTOR_SIZE_INFORMATION, *PFILE_FS_SECTOR_SIZE_INFORMATION; + +typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION { + LARGE_INTEGER IdleTime; + LARGE_INTEGER KernelTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER DpcTime; + LARGE_INTEGER InterruptTime; + ULONG InterruptCount; +} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; + +#ifndef SystemProcessorPerformanceInformation +# define SystemProcessorPerformanceInformation 8 +#endif + +#ifndef FILE_DEVICE_FILE_SYSTEM +# define FILE_DEVICE_FILE_SYSTEM 0x00000009 +#endif + +#ifndef FILE_DEVICE_NETWORK +# define FILE_DEVICE_NETWORK 0x00000012 +#endif + +#ifndef METHOD_BUFFERED +# define METHOD_BUFFERED 0 +#endif + +#ifndef METHOD_IN_DIRECT +# define METHOD_IN_DIRECT 1 +#endif + +#ifndef METHOD_OUT_DIRECT +# define METHOD_OUT_DIRECT 2 +#endif + +#ifndef METHOD_NEITHER +#define METHOD_NEITHER 3 +#endif + +#ifndef METHOD_DIRECT_TO_HARDWARE +# define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT +#endif + +#ifndef METHOD_DIRECT_FROM_HARDWARE +# define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT +#endif + +#ifndef FILE_ANY_ACCESS +# define FILE_ANY_ACCESS 0 +#endif + +#ifndef FILE_SPECIAL_ACCESS +# define FILE_SPECIAL_ACCESS (FILE_ANY_ACCESS) +#endif + +#ifndef FILE_READ_ACCESS +# define FILE_READ_ACCESS 0x0001 +#endif + +#ifndef FILE_WRITE_ACCESS +# define FILE_WRITE_ACCESS 0x0002 +#endif + +#ifndef CTL_CODE +# define CTL_CODE(device_type, function, method, access) \ + (((device_type) << 16) | ((access) << 14) | ((function) << 2) | (method)) +#endif + +#ifndef FSCTL_SET_REPARSE_POINT +# define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, \ + 41, \ + METHOD_BUFFERED, \ + FILE_SPECIAL_ACCESS) +#endif + +#ifndef FSCTL_GET_REPARSE_POINT +# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, \ + 42, \ + METHOD_BUFFERED, \ + FILE_ANY_ACCESS) +#endif + +#ifndef FSCTL_DELETE_REPARSE_POINT +# define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, \ + 43, \ + METHOD_BUFFERED, \ + FILE_SPECIAL_ACCESS) +#endif + +#ifndef IO_REPARSE_TAG_SYMLINK +# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) +#endif + +typedef VOID (NTAPI *PIO_APC_ROUTINE) + (PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + ULONG Reserved); + +typedef ULONG (NTAPI *sRtlNtStatusToDosError) + (NTSTATUS Status); + +typedef NTSTATUS (NTAPI *sNtDeviceIoControlFile) + (HANDLE FileHandle, + HANDLE Event, + PIO_APC_ROUTINE ApcRoutine, + PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + ULONG IoControlCode, + PVOID InputBuffer, + ULONG InputBufferLength, + PVOID OutputBuffer, + ULONG OutputBufferLength); + +typedef NTSTATUS (NTAPI *sNtQueryInformationFile) + (HANDLE FileHandle, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + FILE_INFORMATION_CLASS FileInformationClass); + +typedef NTSTATUS (NTAPI *sNtSetInformationFile) + (HANDLE FileHandle, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + FILE_INFORMATION_CLASS FileInformationClass); + +typedef NTSTATUS (NTAPI *sNtQueryVolumeInformationFile) + (HANDLE FileHandle, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FsInformation, + ULONG Length, + FS_INFORMATION_CLASS FsInformationClass); + +typedef NTSTATUS (NTAPI *sNtQuerySystemInformation) + (UINT SystemInformationClass, + PVOID SystemInformation, + ULONG SystemInformationLength, + PULONG ReturnLength); + +typedef NTSTATUS (NTAPI *sNtQueryDirectoryFile) + (HANDLE FileHandle, + HANDLE Event, + PIO_APC_ROUTINE ApcRoutine, + PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + FILE_INFORMATION_CLASS FileInformationClass, + BOOLEAN ReturnSingleEntry, + PUNICODE_STRING FileName, + BOOLEAN RestartScan + ); + +/* + * Kernel32 headers + */ +#ifndef FILE_SKIP_COMPLETION_PORT_ON_SUCCESS +# define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1 +#endif + +#ifndef FILE_SKIP_SET_EVENT_ON_HANDLE +# define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2 +#endif + +#ifndef SYMBOLIC_LINK_FLAG_DIRECTORY +# define SYMBOLIC_LINK_FLAG_DIRECTORY 0x1 +#endif + +#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) + typedef struct _OVERLAPPED_ENTRY { + ULONG_PTR lpCompletionKey; + LPOVERLAPPED lpOverlapped; + ULONG_PTR Internal; + DWORD dwNumberOfBytesTransferred; + } OVERLAPPED_ENTRY, *LPOVERLAPPED_ENTRY; +#endif + +/* from wincon.h */ +#ifndef ENABLE_INSERT_MODE +# define ENABLE_INSERT_MODE 0x20 +#endif + +#ifndef ENABLE_QUICK_EDIT_MODE +# define ENABLE_QUICK_EDIT_MODE 0x40 +#endif + +#ifndef ENABLE_EXTENDED_FLAGS +# define ENABLE_EXTENDED_FLAGS 0x80 +#endif + +/* from winerror.h */ +#ifndef ERROR_SYMLINK_NOT_SUPPORTED +# define ERROR_SYMLINK_NOT_SUPPORTED 1464 +#endif + +#ifndef ERROR_MUI_FILE_NOT_FOUND +# define ERROR_MUI_FILE_NOT_FOUND 15100 +#endif + +#ifndef ERROR_MUI_INVALID_FILE +# define ERROR_MUI_INVALID_FILE 15101 +#endif + +#ifndef ERROR_MUI_INVALID_RC_CONFIG +# define ERROR_MUI_INVALID_RC_CONFIG 15102 +#endif + +#ifndef ERROR_MUI_INVALID_LOCALE_NAME +# define ERROR_MUI_INVALID_LOCALE_NAME 15103 +#endif + +#ifndef ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME +# define ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME 15104 +#endif + +#ifndef ERROR_MUI_FILE_NOT_LOADED +# define ERROR_MUI_FILE_NOT_LOADED 15105 +#endif + +typedef BOOL (WINAPI *sGetQueuedCompletionStatusEx) + (HANDLE CompletionPort, + LPOVERLAPPED_ENTRY lpCompletionPortEntries, + ULONG ulCount, + PULONG ulNumEntriesRemoved, + DWORD dwMilliseconds, + BOOL fAlertable); + +typedef BOOL (WINAPI* sSetFileCompletionNotificationModes) + (HANDLE FileHandle, + UCHAR Flags); + +typedef BOOLEAN (WINAPI* sCreateSymbolicLinkW) + (LPCWSTR lpSymlinkFileName, + LPCWSTR lpTargetFileName, + DWORD dwFlags); + +typedef BOOL (WINAPI* sCancelIoEx) + (HANDLE hFile, + LPOVERLAPPED lpOverlapped); + +typedef VOID (WINAPI* sInitializeConditionVariable) + (PCONDITION_VARIABLE ConditionVariable); + +typedef BOOL (WINAPI* sSleepConditionVariableCS) + (PCONDITION_VARIABLE ConditionVariable, + PCRITICAL_SECTION CriticalSection, + DWORD dwMilliseconds); + +typedef BOOL (WINAPI* sSleepConditionVariableSRW) + (PCONDITION_VARIABLE ConditionVariable, + PSRWLOCK SRWLock, + DWORD dwMilliseconds, + ULONG Flags); + +typedef VOID (WINAPI* sWakeAllConditionVariable) + (PCONDITION_VARIABLE ConditionVariable); + +typedef VOID (WINAPI* sWakeConditionVariable) + (PCONDITION_VARIABLE ConditionVariable); + +typedef BOOL (WINAPI* sCancelSynchronousIo) + (HANDLE hThread); + +typedef DWORD (WINAPI* sGetFinalPathNameByHandleW) + (HANDLE hFile, + LPWSTR lpszFilePath, + DWORD cchFilePath, + DWORD dwFlags); + +/* Ntdll function pointers */ +extern sRtlNtStatusToDosError pRtlNtStatusToDosError; +extern sNtDeviceIoControlFile pNtDeviceIoControlFile; +extern sNtQueryInformationFile pNtQueryInformationFile; +extern sNtSetInformationFile pNtSetInformationFile; +extern sNtQueryVolumeInformationFile pNtQueryVolumeInformationFile; +extern sNtQueryDirectoryFile pNtQueryDirectoryFile; +extern sNtQuerySystemInformation pNtQuerySystemInformation; + + +/* Kernel32 function pointers */ +extern sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx; +extern sSetFileCompletionNotificationModes pSetFileCompletionNotificationModes; +extern sCreateSymbolicLinkW pCreateSymbolicLinkW; +extern sCancelIoEx pCancelIoEx; +extern sInitializeConditionVariable pInitializeConditionVariable; +extern sSleepConditionVariableCS pSleepConditionVariableCS; +extern sSleepConditionVariableSRW pSleepConditionVariableSRW; +extern sWakeAllConditionVariable pWakeAllConditionVariable; +extern sWakeConditionVariable pWakeConditionVariable; +extern sCancelSynchronousIo pCancelSynchronousIo; +extern sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW; + +#endif /* UV_WIN_WINAPI_H_ */ diff --git a/3rdparty/libuv/src/win/winsock.c b/3rdparty/libuv/src/win/winsock.c new file mode 100644 index 00000000000..d2e667e9f75 --- /dev/null +++ b/3rdparty/libuv/src/win/winsock.c @@ -0,0 +1,561 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include + +#include "uv.h" +#include "internal.h" + + +/* Whether there are any non-IFS LSPs stacked on TCP */ +int uv_tcp_non_ifs_lsp_ipv4; +int uv_tcp_non_ifs_lsp_ipv6; + +/* Ip address used to bind to any port at any interface */ +struct sockaddr_in uv_addr_ip4_any_; +struct sockaddr_in6 uv_addr_ip6_any_; + + +/* + * Retrieves the pointer to a winsock extension function. + */ +static BOOL uv_get_extension_function(SOCKET socket, GUID guid, + void **target) { + int result; + DWORD bytes; + + result = WSAIoctl(socket, + SIO_GET_EXTENSION_FUNCTION_POINTER, + &guid, + sizeof(guid), + (void*)target, + sizeof(*target), + &bytes, + NULL, + NULL); + + if (result == SOCKET_ERROR) { + *target = NULL; + return FALSE; + } else { + return TRUE; + } +} + + +BOOL uv_get_acceptex_function(SOCKET socket, LPFN_ACCEPTEX* target) { + const GUID wsaid_acceptex = WSAID_ACCEPTEX; + return uv_get_extension_function(socket, wsaid_acceptex, (void**)target); +} + + +BOOL uv_get_connectex_function(SOCKET socket, LPFN_CONNECTEX* target) { + const GUID wsaid_connectex = WSAID_CONNECTEX; + return uv_get_extension_function(socket, wsaid_connectex, (void**)target); +} + + +static int error_means_no_support(DWORD error) { + return error == WSAEPROTONOSUPPORT || error == WSAESOCKTNOSUPPORT || + error == WSAEPFNOSUPPORT || error == WSAEAFNOSUPPORT; +} + + +void uv_winsock_init() { + WSADATA wsa_data; + int errorno; + SOCKET dummy; + WSAPROTOCOL_INFOW protocol_info; + int opt_len; + + /* Initialize winsock */ + errorno = WSAStartup(MAKEWORD(2, 2), &wsa_data); + if (errorno != 0) { + uv_fatal_error(errorno, "WSAStartup"); + } + + /* Set implicit binding address used by connectEx */ + if (uv_ip4_addr("0.0.0.0", 0, &uv_addr_ip4_any_)) { + abort(); + } + + if (uv_ip6_addr("::", 0, &uv_addr_ip6_any_)) { + abort(); + } + + /* Detect non-IFS LSPs */ + dummy = socket(AF_INET, SOCK_STREAM, IPPROTO_IP); + + if (dummy != INVALID_SOCKET) { + opt_len = (int) sizeof protocol_info; + if (getsockopt(dummy, + SOL_SOCKET, + SO_PROTOCOL_INFOW, + (char*) &protocol_info, + &opt_len) == SOCKET_ERROR) + uv_fatal_error(WSAGetLastError(), "getsockopt"); + + if (!(protocol_info.dwServiceFlags1 & XP1_IFS_HANDLES)) + uv_tcp_non_ifs_lsp_ipv4 = 1; + + if (closesocket(dummy) == SOCKET_ERROR) + uv_fatal_error(WSAGetLastError(), "closesocket"); + + } else if (!error_means_no_support(WSAGetLastError())) { + /* Any error other than "socket type not supported" is fatal. */ + uv_fatal_error(WSAGetLastError(), "socket"); + } + + /* Detect IPV6 support and non-IFS LSPs */ + dummy = socket(AF_INET6, SOCK_STREAM, IPPROTO_IP); + + if (dummy != INVALID_SOCKET) { + opt_len = (int) sizeof protocol_info; + if (getsockopt(dummy, + SOL_SOCKET, + SO_PROTOCOL_INFOW, + (char*) &protocol_info, + &opt_len) == SOCKET_ERROR) + uv_fatal_error(WSAGetLastError(), "getsockopt"); + + if (!(protocol_info.dwServiceFlags1 & XP1_IFS_HANDLES)) + uv_tcp_non_ifs_lsp_ipv6 = 1; + + if (closesocket(dummy) == SOCKET_ERROR) + uv_fatal_error(WSAGetLastError(), "closesocket"); + + } else if (!error_means_no_support(WSAGetLastError())) { + /* Any error other than "socket type not supported" is fatal. */ + uv_fatal_error(WSAGetLastError(), "socket"); + } +} + + +int uv_ntstatus_to_winsock_error(NTSTATUS status) { + switch (status) { + case STATUS_SUCCESS: + return ERROR_SUCCESS; + + case STATUS_PENDING: + return ERROR_IO_PENDING; + + case STATUS_INVALID_HANDLE: + case STATUS_OBJECT_TYPE_MISMATCH: + return WSAENOTSOCK; + + case STATUS_INSUFFICIENT_RESOURCES: + case STATUS_PAGEFILE_QUOTA: + case STATUS_COMMITMENT_LIMIT: + case STATUS_WORKING_SET_QUOTA: + case STATUS_NO_MEMORY: + case STATUS_QUOTA_EXCEEDED: + case STATUS_TOO_MANY_PAGING_FILES: + case STATUS_REMOTE_RESOURCES: + return WSAENOBUFS; + + case STATUS_TOO_MANY_ADDRESSES: + case STATUS_SHARING_VIOLATION: + case STATUS_ADDRESS_ALREADY_EXISTS: + return WSAEADDRINUSE; + + case STATUS_LINK_TIMEOUT: + case STATUS_IO_TIMEOUT: + case STATUS_TIMEOUT: + return WSAETIMEDOUT; + + case STATUS_GRACEFUL_DISCONNECT: + return WSAEDISCON; + + case STATUS_REMOTE_DISCONNECT: + case STATUS_CONNECTION_RESET: + case STATUS_LINK_FAILED: + case STATUS_CONNECTION_DISCONNECTED: + case STATUS_PORT_UNREACHABLE: + case STATUS_HOPLIMIT_EXCEEDED: + return WSAECONNRESET; + + case STATUS_LOCAL_DISCONNECT: + case STATUS_TRANSACTION_ABORTED: + case STATUS_CONNECTION_ABORTED: + return WSAECONNABORTED; + + case STATUS_BAD_NETWORK_PATH: + case STATUS_NETWORK_UNREACHABLE: + case STATUS_PROTOCOL_UNREACHABLE: + return WSAENETUNREACH; + + case STATUS_HOST_UNREACHABLE: + return WSAEHOSTUNREACH; + + case STATUS_CANCELLED: + case STATUS_REQUEST_ABORTED: + return WSAEINTR; + + case STATUS_BUFFER_OVERFLOW: + case STATUS_INVALID_BUFFER_SIZE: + return WSAEMSGSIZE; + + case STATUS_BUFFER_TOO_SMALL: + case STATUS_ACCESS_VIOLATION: + return WSAEFAULT; + + case STATUS_DEVICE_NOT_READY: + case STATUS_REQUEST_NOT_ACCEPTED: + return WSAEWOULDBLOCK; + + case STATUS_INVALID_NETWORK_RESPONSE: + case STATUS_NETWORK_BUSY: + case STATUS_NO_SUCH_DEVICE: + case STATUS_NO_SUCH_FILE: + case STATUS_OBJECT_PATH_NOT_FOUND: + case STATUS_OBJECT_NAME_NOT_FOUND: + case STATUS_UNEXPECTED_NETWORK_ERROR: + return WSAENETDOWN; + + case STATUS_INVALID_CONNECTION: + return WSAENOTCONN; + + case STATUS_REMOTE_NOT_LISTENING: + case STATUS_CONNECTION_REFUSED: + return WSAECONNREFUSED; + + case STATUS_PIPE_DISCONNECTED: + return WSAESHUTDOWN; + + case STATUS_CONFLICTING_ADDRESSES: + case STATUS_INVALID_ADDRESS: + case STATUS_INVALID_ADDRESS_COMPONENT: + return WSAEADDRNOTAVAIL; + + case STATUS_NOT_SUPPORTED: + case STATUS_NOT_IMPLEMENTED: + return WSAEOPNOTSUPP; + + case STATUS_ACCESS_DENIED: + return WSAEACCES; + + default: + if ((status & (FACILITY_NTWIN32 << 16)) == (FACILITY_NTWIN32 << 16) && + (status & (ERROR_SEVERITY_ERROR | ERROR_SEVERITY_WARNING))) { + /* It's a windows error that has been previously mapped to an */ + /* ntstatus code. */ + return (DWORD) (status & 0xffff); + } else { + /* The default fallback for unmappable ntstatus codes. */ + return WSAEINVAL; + } + } +} + + +/* + * This function provides a workaround for a bug in the winsock implementation + * of WSARecv. The problem is that when SetFileCompletionNotificationModes is + * used to avoid IOCP notifications of completed reads, WSARecv does not + * reliably indicate whether we can expect a completion package to be posted + * when the receive buffer is smaller than the received datagram. + * + * However it is desirable to use SetFileCompletionNotificationModes because + * it yields a massive performance increase. + * + * This function provides a workaround for that bug, but it only works for the + * specific case that we need it for. E.g. it assumes that the "avoid iocp" + * bit has been set, and supports only overlapped operation. It also requires + * the user to use the default msafd driver, doesn't work when other LSPs are + * stacked on top of it. + */ +int WSAAPI uv_wsarecv_workaround(SOCKET socket, WSABUF* buffers, + DWORD buffer_count, DWORD* bytes, DWORD* flags, WSAOVERLAPPED *overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine) { + NTSTATUS status; + void* apc_context; + IO_STATUS_BLOCK* iosb = (IO_STATUS_BLOCK*) &overlapped->Internal; + AFD_RECV_INFO info; + DWORD error; + + if (overlapped == NULL || completion_routine != NULL) { + WSASetLastError(WSAEINVAL); + return SOCKET_ERROR; + } + + info.BufferArray = buffers; + info.BufferCount = buffer_count; + info.AfdFlags = AFD_OVERLAPPED; + info.TdiFlags = TDI_RECEIVE_NORMAL; + + if (*flags & MSG_PEEK) { + info.TdiFlags |= TDI_RECEIVE_PEEK; + } + + if (*flags & MSG_PARTIAL) { + info.TdiFlags |= TDI_RECEIVE_PARTIAL; + } + + if (!((intptr_t) overlapped->hEvent & 1)) { + apc_context = (void*) overlapped; + } else { + apc_context = NULL; + } + + iosb->Status = STATUS_PENDING; + iosb->Pointer = 0; + + status = pNtDeviceIoControlFile((HANDLE) socket, + overlapped->hEvent, + NULL, + apc_context, + iosb, + IOCTL_AFD_RECEIVE, + &info, + sizeof(info), + NULL, + 0); + + *flags = 0; + *bytes = (DWORD) iosb->Information; + + switch (status) { + case STATUS_SUCCESS: + error = ERROR_SUCCESS; + break; + + case STATUS_PENDING: + error = WSA_IO_PENDING; + break; + + case STATUS_BUFFER_OVERFLOW: + error = WSAEMSGSIZE; + break; + + case STATUS_RECEIVE_EXPEDITED: + error = ERROR_SUCCESS; + *flags = MSG_OOB; + break; + + case STATUS_RECEIVE_PARTIAL_EXPEDITED: + error = ERROR_SUCCESS; + *flags = MSG_PARTIAL | MSG_OOB; + break; + + case STATUS_RECEIVE_PARTIAL: + error = ERROR_SUCCESS; + *flags = MSG_PARTIAL; + break; + + default: + error = uv_ntstatus_to_winsock_error(status); + break; + } + + WSASetLastError(error); + + if (error == ERROR_SUCCESS) { + return 0; + } else { + return SOCKET_ERROR; + } +} + + +/* See description of uv_wsarecv_workaround. */ +int WSAAPI uv_wsarecvfrom_workaround(SOCKET socket, WSABUF* buffers, + DWORD buffer_count, DWORD* bytes, DWORD* flags, struct sockaddr* addr, + int* addr_len, WSAOVERLAPPED *overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine) { + NTSTATUS status; + void* apc_context; + IO_STATUS_BLOCK* iosb = (IO_STATUS_BLOCK*) &overlapped->Internal; + AFD_RECV_DATAGRAM_INFO info; + DWORD error; + + if (overlapped == NULL || addr == NULL || addr_len == NULL || + completion_routine != NULL) { + WSASetLastError(WSAEINVAL); + return SOCKET_ERROR; + } + + info.BufferArray = buffers; + info.BufferCount = buffer_count; + info.AfdFlags = AFD_OVERLAPPED; + info.TdiFlags = TDI_RECEIVE_NORMAL; + info.Address = addr; + info.AddressLength = addr_len; + + if (*flags & MSG_PEEK) { + info.TdiFlags |= TDI_RECEIVE_PEEK; + } + + if (*flags & MSG_PARTIAL) { + info.TdiFlags |= TDI_RECEIVE_PARTIAL; + } + + if (!((intptr_t) overlapped->hEvent & 1)) { + apc_context = (void*) overlapped; + } else { + apc_context = NULL; + } + + iosb->Status = STATUS_PENDING; + iosb->Pointer = 0; + + status = pNtDeviceIoControlFile((HANDLE) socket, + overlapped->hEvent, + NULL, + apc_context, + iosb, + IOCTL_AFD_RECEIVE_DATAGRAM, + &info, + sizeof(info), + NULL, + 0); + + *flags = 0; + *bytes = (DWORD) iosb->Information; + + switch (status) { + case STATUS_SUCCESS: + error = ERROR_SUCCESS; + break; + + case STATUS_PENDING: + error = WSA_IO_PENDING; + break; + + case STATUS_BUFFER_OVERFLOW: + error = WSAEMSGSIZE; + break; + + case STATUS_RECEIVE_EXPEDITED: + error = ERROR_SUCCESS; + *flags = MSG_OOB; + break; + + case STATUS_RECEIVE_PARTIAL_EXPEDITED: + error = ERROR_SUCCESS; + *flags = MSG_PARTIAL | MSG_OOB; + break; + + case STATUS_RECEIVE_PARTIAL: + error = ERROR_SUCCESS; + *flags = MSG_PARTIAL; + break; + + default: + error = uv_ntstatus_to_winsock_error(status); + break; + } + + WSASetLastError(error); + + if (error == ERROR_SUCCESS) { + return 0; + } else { + return SOCKET_ERROR; + } +} + + +int WSAAPI uv_msafd_poll(SOCKET socket, AFD_POLL_INFO* info_in, + AFD_POLL_INFO* info_out, OVERLAPPED* overlapped) { + IO_STATUS_BLOCK iosb; + IO_STATUS_BLOCK* iosb_ptr; + HANDLE event = NULL; + void* apc_context; + NTSTATUS status; + DWORD error; + + if (overlapped != NULL) { + /* Overlapped operation. */ + iosb_ptr = (IO_STATUS_BLOCK*) &overlapped->Internal; + event = overlapped->hEvent; + + /* Do not report iocp completion if hEvent is tagged. */ + if ((uintptr_t) event & 1) { + event = (HANDLE)((uintptr_t) event & ~(uintptr_t) 1); + apc_context = NULL; + } else { + apc_context = overlapped; + } + + } else { + /* Blocking operation. */ + iosb_ptr = &iosb; + event = CreateEvent(NULL, FALSE, FALSE, NULL); + if (event == NULL) { + return SOCKET_ERROR; + } + apc_context = NULL; + } + + iosb_ptr->Status = STATUS_PENDING; + status = pNtDeviceIoControlFile((HANDLE) socket, + event, + NULL, + apc_context, + iosb_ptr, + IOCTL_AFD_POLL, + info_in, + sizeof *info_in, + info_out, + sizeof *info_out); + + if (overlapped == NULL) { + /* If this is a blocking operation, wait for the event to become */ + /* signaled, and then grab the real status from the io status block. */ + if (status == STATUS_PENDING) { + DWORD r = WaitForSingleObject(event, INFINITE); + + if (r == WAIT_FAILED) { + DWORD saved_error = GetLastError(); + CloseHandle(event); + WSASetLastError(saved_error); + return SOCKET_ERROR; + } + + status = iosb.Status; + } + + CloseHandle(event); + } + + switch (status) { + case STATUS_SUCCESS: + error = ERROR_SUCCESS; + break; + + case STATUS_PENDING: + error = WSA_IO_PENDING; + break; + + default: + error = uv_ntstatus_to_winsock_error(status); + break; + } + + WSASetLastError(error); + + if (error == ERROR_SUCCESS) { + return 0; + } else { + return SOCKET_ERROR; + } +} diff --git a/3rdparty/libuv/src/win/winsock.h b/3rdparty/libuv/src/win/winsock.h new file mode 100644 index 00000000000..7c007ab4934 --- /dev/null +++ b/3rdparty/libuv/src/win/winsock.h @@ -0,0 +1,190 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_WIN_WINSOCK_H_ +#define UV_WIN_WINSOCK_H_ + +#include +#include +#include +#include +#include + +#include "winapi.h" + + +/* + * MinGW is missing these too + */ +#ifndef SO_UPDATE_CONNECT_CONTEXT +# define SO_UPDATE_CONNECT_CONTEXT 0x7010 +#endif + +#ifndef TCP_KEEPALIVE +# define TCP_KEEPALIVE 3 +#endif + +#ifndef IPV6_V6ONLY +# define IPV6_V6ONLY 27 +#endif + +#ifndef IPV6_HOPLIMIT +# define IPV6_HOPLIMIT 21 +#endif + +#ifndef SIO_BASE_HANDLE +# define SIO_BASE_HANDLE 0x48000022 +#endif + +/* + * TDI defines that are only in the DDK. + * We only need receive flags so far. + */ +#ifndef TDI_RECEIVE_NORMAL + #define TDI_RECEIVE_BROADCAST 0x00000004 + #define TDI_RECEIVE_MULTICAST 0x00000008 + #define TDI_RECEIVE_PARTIAL 0x00000010 + #define TDI_RECEIVE_NORMAL 0x00000020 + #define TDI_RECEIVE_EXPEDITED 0x00000040 + #define TDI_RECEIVE_PEEK 0x00000080 + #define TDI_RECEIVE_NO_RESPONSE_EXP 0x00000100 + #define TDI_RECEIVE_COPY_LOOKAHEAD 0x00000200 + #define TDI_RECEIVE_ENTIRE_MESSAGE 0x00000400 + #define TDI_RECEIVE_AT_DISPATCH_LEVEL 0x00000800 + #define TDI_RECEIVE_CONTROL_INFO 0x00001000 + #define TDI_RECEIVE_FORCE_INDICATION 0x00002000 + #define TDI_RECEIVE_NO_PUSH 0x00004000 +#endif + +/* + * The "Auxiliary Function Driver" is the windows kernel-mode driver that does + * TCP, UDP etc. Winsock is just a layer that dispatches requests to it. + * Having these definitions allows us to bypass winsock and make an AFD kernel + * call directly, avoiding a bug in winsock's recvfrom implementation. + */ + +#define AFD_NO_FAST_IO 0x00000001 +#define AFD_OVERLAPPED 0x00000002 +#define AFD_IMMEDIATE 0x00000004 + +#define AFD_POLL_RECEIVE_BIT 0 +#define AFD_POLL_RECEIVE (1 << AFD_POLL_RECEIVE_BIT) +#define AFD_POLL_RECEIVE_EXPEDITED_BIT 1 +#define AFD_POLL_RECEIVE_EXPEDITED (1 << AFD_POLL_RECEIVE_EXPEDITED_BIT) +#define AFD_POLL_SEND_BIT 2 +#define AFD_POLL_SEND (1 << AFD_POLL_SEND_BIT) +#define AFD_POLL_DISCONNECT_BIT 3 +#define AFD_POLL_DISCONNECT (1 << AFD_POLL_DISCONNECT_BIT) +#define AFD_POLL_ABORT_BIT 4 +#define AFD_POLL_ABORT (1 << AFD_POLL_ABORT_BIT) +#define AFD_POLL_LOCAL_CLOSE_BIT 5 +#define AFD_POLL_LOCAL_CLOSE (1 << AFD_POLL_LOCAL_CLOSE_BIT) +#define AFD_POLL_CONNECT_BIT 6 +#define AFD_POLL_CONNECT (1 << AFD_POLL_CONNECT_BIT) +#define AFD_POLL_ACCEPT_BIT 7 +#define AFD_POLL_ACCEPT (1 << AFD_POLL_ACCEPT_BIT) +#define AFD_POLL_CONNECT_FAIL_BIT 8 +#define AFD_POLL_CONNECT_FAIL (1 << AFD_POLL_CONNECT_FAIL_BIT) +#define AFD_POLL_QOS_BIT 9 +#define AFD_POLL_QOS (1 << AFD_POLL_QOS_BIT) +#define AFD_POLL_GROUP_QOS_BIT 10 +#define AFD_POLL_GROUP_QOS (1 << AFD_POLL_GROUP_QOS_BIT) + +#define AFD_NUM_POLL_EVENTS 11 +#define AFD_POLL_ALL ((1 << AFD_NUM_POLL_EVENTS) - 1) + +typedef struct _AFD_RECV_DATAGRAM_INFO { + LPWSABUF BufferArray; + ULONG BufferCount; + ULONG AfdFlags; + ULONG TdiFlags; + struct sockaddr* Address; + int* AddressLength; +} AFD_RECV_DATAGRAM_INFO, *PAFD_RECV_DATAGRAM_INFO; + +typedef struct _AFD_RECV_INFO { + LPWSABUF BufferArray; + ULONG BufferCount; + ULONG AfdFlags; + ULONG TdiFlags; +} AFD_RECV_INFO, *PAFD_RECV_INFO; + + +#define _AFD_CONTROL_CODE(operation, method) \ + ((FSCTL_AFD_BASE) << 12 | (operation << 2) | method) + +#define FSCTL_AFD_BASE FILE_DEVICE_NETWORK + +#define AFD_RECEIVE 5 +#define AFD_RECEIVE_DATAGRAM 6 +#define AFD_POLL 9 + +#define IOCTL_AFD_RECEIVE \ + _AFD_CONTROL_CODE(AFD_RECEIVE, METHOD_NEITHER) + +#define IOCTL_AFD_RECEIVE_DATAGRAM \ + _AFD_CONTROL_CODE(AFD_RECEIVE_DATAGRAM, METHOD_NEITHER) + +#define IOCTL_AFD_POLL \ + _AFD_CONTROL_CODE(AFD_POLL, METHOD_BUFFERED) + +#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) +typedef struct _IP_ADAPTER_UNICAST_ADDRESS_XP { + /* FIXME: __C89_NAMELESS was removed */ + /* __C89_NAMELESS */ union { + ULONGLONG Alignment; + /* __C89_NAMELESS */ struct { + ULONG Length; + DWORD Flags; + }; + }; + struct _IP_ADAPTER_UNICAST_ADDRESS_XP *Next; + SOCKET_ADDRESS Address; + IP_PREFIX_ORIGIN PrefixOrigin; + IP_SUFFIX_ORIGIN SuffixOrigin; + IP_DAD_STATE DadState; + ULONG ValidLifetime; + ULONG PreferredLifetime; + ULONG LeaseLifetime; +} IP_ADAPTER_UNICAST_ADDRESS_XP,*PIP_ADAPTER_UNICAST_ADDRESS_XP; + +typedef struct _IP_ADAPTER_UNICAST_ADDRESS_LH { + union { + ULONGLONG Alignment; + struct { + ULONG Length; + DWORD Flags; + }; + }; + struct _IP_ADAPTER_UNICAST_ADDRESS_LH *Next; + SOCKET_ADDRESS Address; + IP_PREFIX_ORIGIN PrefixOrigin; + IP_SUFFIX_ORIGIN SuffixOrigin; + IP_DAD_STATE DadState; + ULONG ValidLifetime; + ULONG PreferredLifetime; + ULONG LeaseLifetime; + UINT8 OnLinkPrefixLength; +} IP_ADAPTER_UNICAST_ADDRESS_LH,*PIP_ADAPTER_UNICAST_ADDRESS_LH; + +#endif + +#endif /* UV_WIN_WINSOCK_H_ */ diff --git a/3rdparty/libuv/test/benchmark-async-pummel.c b/3rdparty/libuv/test/benchmark-async-pummel.c new file mode 100644 index 00000000000..cca3de1062b --- /dev/null +++ b/3rdparty/libuv/test/benchmark-async-pummel.c @@ -0,0 +1,119 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "uv.h" + +#include +#include + +#define NUM_PINGS (1000 * 1000) +#define ACCESS_ONCE(type, var) (*(volatile type*) &(var)) + +static unsigned int callbacks; +static volatile int done; + +static const char running[] = "running"; +static const char stop[] = "stop"; +static const char stopped[] = "stopped"; + + +static void async_cb(uv_async_t* handle) { + if (++callbacks == NUM_PINGS) { + /* Tell the pummel thread to stop. */ + ACCESS_ONCE(const char*, handle->data) = stop; + + /* Wait for for the pummel thread to acknowledge that it has stoppped. */ + while (ACCESS_ONCE(const char*, handle->data) != stopped) + uv_sleep(0); + + uv_close((uv_handle_t*) handle, NULL); + } +} + + +static void pummel(void* arg) { + uv_async_t* handle = (uv_async_t*) arg; + + while (ACCESS_ONCE(const char*, handle->data) == running) + uv_async_send(handle); + + /* Acknowledge that we've seen handle->data change. */ + ACCESS_ONCE(const char*, handle->data) = stopped; +} + + +static int test_async_pummel(int nthreads) { + uv_thread_t* tids; + uv_async_t handle; + uint64_t time; + int i; + + tids = calloc(nthreads, sizeof(tids[0])); + ASSERT(tids != NULL); + + ASSERT(0 == uv_async_init(uv_default_loop(), &handle, async_cb)); + ACCESS_ONCE(const char*, handle.data) = running; + + for (i = 0; i < nthreads; i++) + ASSERT(0 == uv_thread_create(tids + i, pummel, &handle)); + + time = uv_hrtime(); + + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + time = uv_hrtime() - time; + done = 1; + + for (i = 0; i < nthreads; i++) + ASSERT(0 == uv_thread_join(tids + i)); + + printf("async_pummel_%d: %s callbacks in %.2f seconds (%s/sec)\n", + nthreads, + fmt(callbacks), + time / 1e9, + fmt(callbacks / (time / 1e9))); + + free(tids); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +BENCHMARK_IMPL(async_pummel_1) { + return test_async_pummel(1); +} + + +BENCHMARK_IMPL(async_pummel_2) { + return test_async_pummel(2); +} + + +BENCHMARK_IMPL(async_pummel_4) { + return test_async_pummel(4); +} + + +BENCHMARK_IMPL(async_pummel_8) { + return test_async_pummel(8); +} diff --git a/3rdparty/libuv/test/benchmark-async.c b/3rdparty/libuv/test/benchmark-async.c new file mode 100644 index 00000000000..e44165f2b81 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-async.c @@ -0,0 +1,141 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "uv.h" + +#include +#include + +#define NUM_PINGS (1000 * 1000) + +struct ctx { + uv_loop_t loop; + uv_thread_t thread; + uv_async_t main_async; /* wake up main thread */ + uv_async_t worker_async; /* wake up worker */ + unsigned int nthreads; + unsigned int main_sent; + unsigned int main_seen; + unsigned int worker_sent; + unsigned int worker_seen; +}; + + +static void worker_async_cb(uv_async_t* handle) { + struct ctx* ctx = container_of(handle, struct ctx, worker_async); + + ASSERT(0 == uv_async_send(&ctx->main_async)); + ctx->worker_sent++; + ctx->worker_seen++; + + if (ctx->worker_sent >= NUM_PINGS) + uv_close((uv_handle_t*) &ctx->worker_async, NULL); +} + + +static void main_async_cb(uv_async_t* handle) { + struct ctx* ctx = container_of(handle, struct ctx, main_async); + + ASSERT(0 == uv_async_send(&ctx->worker_async)); + ctx->main_sent++; + ctx->main_seen++; + + if (ctx->main_sent >= NUM_PINGS) + uv_close((uv_handle_t*) &ctx->main_async, NULL); +} + + +static void worker(void* arg) { + struct ctx* ctx = arg; + ASSERT(0 == uv_async_send(&ctx->main_async)); + ASSERT(0 == uv_run(&ctx->loop, UV_RUN_DEFAULT)); + uv_loop_close(&ctx->loop); +} + + +static int test_async(int nthreads) { + struct ctx* threads; + struct ctx* ctx; + uint64_t time; + int i; + + threads = calloc(nthreads, sizeof(threads[0])); + ASSERT(threads != NULL); + + for (i = 0; i < nthreads; i++) { + ctx = threads + i; + ctx->nthreads = nthreads; + ASSERT(0 == uv_loop_init(&ctx->loop)); + ASSERT(0 == uv_async_init(&ctx->loop, &ctx->worker_async, worker_async_cb)); + ASSERT(0 == uv_async_init(uv_default_loop(), + &ctx->main_async, + main_async_cb)); + ASSERT(0 == uv_thread_create(&ctx->thread, worker, ctx)); + } + + time = uv_hrtime(); + + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + for (i = 0; i < nthreads; i++) + ASSERT(0 == uv_thread_join(&threads[i].thread)); + + time = uv_hrtime() - time; + + for (i = 0; i < nthreads; i++) { + ctx = threads + i; + ASSERT(ctx->worker_sent == NUM_PINGS); + ASSERT(ctx->worker_seen == NUM_PINGS); + ASSERT(ctx->main_sent == (unsigned int) NUM_PINGS); + ASSERT(ctx->main_seen == (unsigned int) NUM_PINGS); + } + + printf("async%d: %.2f sec (%s/sec)\n", + nthreads, + time / 1e9, + fmt(NUM_PINGS / (time / 1e9))); + + free(threads); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +BENCHMARK_IMPL(async1) { + return test_async(1); +} + + +BENCHMARK_IMPL(async2) { + return test_async(2); +} + + +BENCHMARK_IMPL(async4) { + return test_async(4); +} + + +BENCHMARK_IMPL(async8) { + return test_async(8); +} diff --git a/3rdparty/libuv/test/benchmark-fs-stat.c b/3rdparty/libuv/test/benchmark-fs-stat.c new file mode 100644 index 00000000000..32d2589586c --- /dev/null +++ b/3rdparty/libuv/test/benchmark-fs-stat.c @@ -0,0 +1,136 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "uv.h" + +#include +#include + +#define NUM_SYNC_REQS (10 * 1e5) +#define NUM_ASYNC_REQS (1 * (int) 1e5) +#define MAX_CONCURRENT_REQS 32 + +#define sync_stat(req, path) \ + do { \ + uv_fs_stat(NULL, (req), (path), NULL); \ + uv_fs_req_cleanup((req)); \ + } \ + while (0) + +struct async_req { + const char* path; + uv_fs_t fs_req; + int* count; +}; + + +static void warmup(const char* path) { + uv_fs_t reqs[MAX_CONCURRENT_REQS]; + unsigned int i; + + /* warm up the thread pool */ + for (i = 0; i < ARRAY_SIZE(reqs); i++) + uv_fs_stat(uv_default_loop(), reqs + i, path, uv_fs_req_cleanup); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + /* warm up the OS dirent cache */ + for (i = 0; i < 16; i++) + sync_stat(reqs + 0, path); +} + + +static void sync_bench(const char* path) { + uint64_t before; + uint64_t after; + uv_fs_t req; + int i; + + /* do the sync benchmark */ + before = uv_hrtime(); + + for (i = 0; i < NUM_SYNC_REQS; i++) + sync_stat(&req, path); + + after = uv_hrtime(); + + printf("%s stats (sync): %.2fs (%s/s)\n", + fmt(1.0 * NUM_SYNC_REQS), + (after - before) / 1e9, + fmt((1.0 * NUM_SYNC_REQS) / ((after - before) / 1e9))); + fflush(stdout); +} + + +static void stat_cb(uv_fs_t* fs_req) { + struct async_req* req = container_of(fs_req, struct async_req, fs_req); + uv_fs_req_cleanup(&req->fs_req); + if (*req->count == 0) return; + uv_fs_stat(uv_default_loop(), &req->fs_req, req->path, stat_cb); + (*req->count)--; +} + + +static void async_bench(const char* path) { + struct async_req reqs[MAX_CONCURRENT_REQS]; + struct async_req* req; + uint64_t before; + uint64_t after; + int count; + int i; + + for (i = 1; i <= MAX_CONCURRENT_REQS; i++) { + count = NUM_ASYNC_REQS; + + for (req = reqs; req < reqs + i; req++) { + req->path = path; + req->count = &count; + uv_fs_stat(uv_default_loop(), &req->fs_req, req->path, stat_cb); + } + + before = uv_hrtime(); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + after = uv_hrtime(); + + printf("%s stats (%d concurrent): %.2fs (%s/s)\n", + fmt(1.0 * NUM_ASYNC_REQS), + i, + (after - before) / 1e9, + fmt((1.0 * NUM_ASYNC_REQS) / ((after - before) / 1e9))); + fflush(stdout); + } +} + + +/* This benchmark aims to measure the overhead of doing I/O syscalls from + * the thread pool. The stat() syscall was chosen because its results are + * easy for the operating system to cache, taking the actual I/O overhead + * out of the equation. + */ +BENCHMARK_IMPL(fs_stat) { + const char path[] = "."; + warmup(path); + sync_bench(path); + async_bench(path); + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/benchmark-getaddrinfo.c b/3rdparty/libuv/test/benchmark-getaddrinfo.c new file mode 100644 index 00000000000..1dbc23ddba0 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-getaddrinfo.c @@ -0,0 +1,92 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include + +#define CONCURRENT_CALLS 10 +#define TOTAL_CALLS 10000 + +static const char* name = "localhost"; + +static uv_loop_t* loop; + +static uv_getaddrinfo_t handles[CONCURRENT_CALLS]; + +static int calls_initiated = 0; +static int calls_completed = 0; +static int64_t start_time; +static int64_t end_time; + + +static void getaddrinfo_initiate(uv_getaddrinfo_t* handle); + + +static void getaddrinfo_cb(uv_getaddrinfo_t* handle, int status, + struct addrinfo* res) { + ASSERT(status == 0); + calls_completed++; + if (calls_initiated < TOTAL_CALLS) { + getaddrinfo_initiate(handle); + } + + uv_freeaddrinfo(res); +} + + +static void getaddrinfo_initiate(uv_getaddrinfo_t* handle) { + int r; + + calls_initiated++; + + r = uv_getaddrinfo(loop, handle, &getaddrinfo_cb, name, NULL, NULL); + ASSERT(r == 0); +} + + +BENCHMARK_IMPL(getaddrinfo) { + int i; + + loop = uv_default_loop(); + + uv_update_time(loop); + start_time = uv_now(loop); + + for (i = 0; i < CONCURRENT_CALLS; i++) { + getaddrinfo_initiate(&handles[i]); + } + + uv_run(loop, UV_RUN_DEFAULT); + + uv_update_time(loop); + end_time = uv_now(loop); + + ASSERT(calls_initiated == TOTAL_CALLS); + ASSERT(calls_completed == TOTAL_CALLS); + + fprintf(stderr, "getaddrinfo: %.0f req/s\n", + (double) calls_completed / (double) (end_time - start_time) * 1000.0); + fflush(stderr); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/benchmark-list.h b/3rdparty/libuv/test/benchmark-list.h new file mode 100644 index 00000000000..1e843071c01 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-list.h @@ -0,0 +1,163 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +BENCHMARK_DECLARE (sizes) +BENCHMARK_DECLARE (loop_count) +BENCHMARK_DECLARE (loop_count_timed) +BENCHMARK_DECLARE (ping_pongs) +BENCHMARK_DECLARE (tcp_write_batch) +BENCHMARK_DECLARE (tcp4_pound_100) +BENCHMARK_DECLARE (tcp4_pound_1000) +BENCHMARK_DECLARE (pipe_pound_100) +BENCHMARK_DECLARE (pipe_pound_1000) +BENCHMARK_DECLARE (tcp_pump100_client) +BENCHMARK_DECLARE (tcp_pump1_client) +BENCHMARK_DECLARE (pipe_pump100_client) +BENCHMARK_DECLARE (pipe_pump1_client) + +BENCHMARK_DECLARE (tcp_multi_accept2) +BENCHMARK_DECLARE (tcp_multi_accept4) +BENCHMARK_DECLARE (tcp_multi_accept8) + +/* Run until X packets have been sent/received. */ +BENCHMARK_DECLARE (udp_pummel_1v1) +BENCHMARK_DECLARE (udp_pummel_1v10) +BENCHMARK_DECLARE (udp_pummel_1v100) +BENCHMARK_DECLARE (udp_pummel_1v1000) +BENCHMARK_DECLARE (udp_pummel_10v10) +BENCHMARK_DECLARE (udp_pummel_10v100) +BENCHMARK_DECLARE (udp_pummel_10v1000) +BENCHMARK_DECLARE (udp_pummel_100v100) +BENCHMARK_DECLARE (udp_pummel_100v1000) +BENCHMARK_DECLARE (udp_pummel_1000v1000) + +/* Run until X seconds have elapsed. */ +BENCHMARK_DECLARE (udp_timed_pummel_1v1) +BENCHMARK_DECLARE (udp_timed_pummel_1v10) +BENCHMARK_DECLARE (udp_timed_pummel_1v100) +BENCHMARK_DECLARE (udp_timed_pummel_1v1000) +BENCHMARK_DECLARE (udp_timed_pummel_10v10) +BENCHMARK_DECLARE (udp_timed_pummel_10v100) +BENCHMARK_DECLARE (udp_timed_pummel_10v1000) +BENCHMARK_DECLARE (udp_timed_pummel_100v100) +BENCHMARK_DECLARE (udp_timed_pummel_100v1000) +BENCHMARK_DECLARE (udp_timed_pummel_1000v1000) + +BENCHMARK_DECLARE (getaddrinfo) +BENCHMARK_DECLARE (fs_stat) +BENCHMARK_DECLARE (async1) +BENCHMARK_DECLARE (async2) +BENCHMARK_DECLARE (async4) +BENCHMARK_DECLARE (async8) +BENCHMARK_DECLARE (async_pummel_1) +BENCHMARK_DECLARE (async_pummel_2) +BENCHMARK_DECLARE (async_pummel_4) +BENCHMARK_DECLARE (async_pummel_8) +BENCHMARK_DECLARE (spawn) +BENCHMARK_DECLARE (thread_create) +BENCHMARK_DECLARE (million_async) +BENCHMARK_DECLARE (million_timers) +HELPER_DECLARE (tcp4_blackhole_server) +HELPER_DECLARE (tcp_pump_server) +HELPER_DECLARE (pipe_pump_server) +HELPER_DECLARE (tcp4_echo_server) +HELPER_DECLARE (pipe_echo_server) +HELPER_DECLARE (dns_server) + +TASK_LIST_START + BENCHMARK_ENTRY (sizes) + BENCHMARK_ENTRY (loop_count) + BENCHMARK_ENTRY (loop_count_timed) + + BENCHMARK_ENTRY (ping_pongs) + BENCHMARK_HELPER (ping_pongs, tcp4_echo_server) + + BENCHMARK_ENTRY (tcp_write_batch) + BENCHMARK_HELPER (tcp_write_batch, tcp4_blackhole_server) + + BENCHMARK_ENTRY (tcp_pump100_client) + BENCHMARK_HELPER (tcp_pump100_client, tcp_pump_server) + + BENCHMARK_ENTRY (tcp_pump1_client) + BENCHMARK_HELPER (tcp_pump1_client, tcp_pump_server) + + BENCHMARK_ENTRY (tcp4_pound_100) + BENCHMARK_HELPER (tcp4_pound_100, tcp4_echo_server) + + BENCHMARK_ENTRY (tcp4_pound_1000) + BENCHMARK_HELPER (tcp4_pound_1000, tcp4_echo_server) + + BENCHMARK_ENTRY (pipe_pump100_client) + BENCHMARK_HELPER (pipe_pump100_client, pipe_pump_server) + + BENCHMARK_ENTRY (pipe_pump1_client) + BENCHMARK_HELPER (pipe_pump1_client, pipe_pump_server) + + BENCHMARK_ENTRY (pipe_pound_100) + BENCHMARK_HELPER (pipe_pound_100, pipe_echo_server) + + BENCHMARK_ENTRY (pipe_pound_1000) + BENCHMARK_HELPER (pipe_pound_1000, pipe_echo_server) + + BENCHMARK_ENTRY (tcp_multi_accept2) + BENCHMARK_ENTRY (tcp_multi_accept4) + BENCHMARK_ENTRY (tcp_multi_accept8) + + BENCHMARK_ENTRY (udp_pummel_1v1) + BENCHMARK_ENTRY (udp_pummel_1v10) + BENCHMARK_ENTRY (udp_pummel_1v100) + BENCHMARK_ENTRY (udp_pummel_1v1000) + BENCHMARK_ENTRY (udp_pummel_10v10) + BENCHMARK_ENTRY (udp_pummel_10v100) + BENCHMARK_ENTRY (udp_pummel_10v1000) + BENCHMARK_ENTRY (udp_pummel_100v100) + BENCHMARK_ENTRY (udp_pummel_100v1000) + BENCHMARK_ENTRY (udp_pummel_1000v1000) + + BENCHMARK_ENTRY (udp_timed_pummel_1v1) + BENCHMARK_ENTRY (udp_timed_pummel_1v10) + BENCHMARK_ENTRY (udp_timed_pummel_1v100) + BENCHMARK_ENTRY (udp_timed_pummel_1v1000) + BENCHMARK_ENTRY (udp_timed_pummel_10v10) + BENCHMARK_ENTRY (udp_timed_pummel_10v100) + BENCHMARK_ENTRY (udp_timed_pummel_10v1000) + BENCHMARK_ENTRY (udp_timed_pummel_100v100) + BENCHMARK_ENTRY (udp_timed_pummel_100v1000) + BENCHMARK_ENTRY (udp_timed_pummel_1000v1000) + + BENCHMARK_ENTRY (getaddrinfo) + + BENCHMARK_ENTRY (fs_stat) + + BENCHMARK_ENTRY (async1) + BENCHMARK_ENTRY (async2) + BENCHMARK_ENTRY (async4) + BENCHMARK_ENTRY (async8) + BENCHMARK_ENTRY (async_pummel_1) + BENCHMARK_ENTRY (async_pummel_2) + BENCHMARK_ENTRY (async_pummel_4) + BENCHMARK_ENTRY (async_pummel_8) + + BENCHMARK_ENTRY (spawn) + BENCHMARK_ENTRY (thread_create) + BENCHMARK_ENTRY (million_async) + BENCHMARK_ENTRY (million_timers) +TASK_LIST_END diff --git a/3rdparty/libuv/test/benchmark-loop-count.c b/3rdparty/libuv/test/benchmark-loop-count.c new file mode 100644 index 00000000000..970a94c2fec --- /dev/null +++ b/3rdparty/libuv/test/benchmark-loop-count.c @@ -0,0 +1,92 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "uv.h" + +#include +#include + +#define NUM_TICKS (2 * 1000 * 1000) + +static unsigned long ticks; +static uv_idle_t idle_handle; +static uv_timer_t timer_handle; + + +static void idle_cb(uv_idle_t* handle) { + if (++ticks == NUM_TICKS) + uv_idle_stop(handle); +} + + +static void idle2_cb(uv_idle_t* handle) { + ticks++; +} + + +static void timer_cb(uv_timer_t* handle) { + uv_idle_stop(&idle_handle); + uv_timer_stop(&timer_handle); +} + + +BENCHMARK_IMPL(loop_count) { + uv_loop_t* loop = uv_default_loop(); + uint64_t ns; + + uv_idle_init(loop, &idle_handle); + uv_idle_start(&idle_handle, idle_cb); + + ns = uv_hrtime(); + uv_run(loop, UV_RUN_DEFAULT); + ns = uv_hrtime() - ns; + + ASSERT(ticks == NUM_TICKS); + + fprintf(stderr, "loop_count: %d ticks in %.2fs (%.0f/s)\n", + NUM_TICKS, + ns / 1e9, + NUM_TICKS / (ns / 1e9)); + fflush(stderr); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +BENCHMARK_IMPL(loop_count_timed) { + uv_loop_t* loop = uv_default_loop(); + + uv_idle_init(loop, &idle_handle); + uv_idle_start(&idle_handle, idle2_cb); + + uv_timer_init(loop, &timer_handle); + uv_timer_start(&timer_handle, timer_cb, 5000, 0); + + uv_run(loop, UV_RUN_DEFAULT); + + fprintf(stderr, "loop_count: %lu ticks (%.0f ticks/s)\n", ticks, ticks / 5.0); + fflush(stderr); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/benchmark-million-async.c b/3rdparty/libuv/test/benchmark-million-async.c new file mode 100644 index 00000000000..5395ed54bab --- /dev/null +++ b/3rdparty/libuv/test/benchmark-million-async.c @@ -0,0 +1,112 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "uv.h" + +struct async_container { + unsigned async_events; + unsigned handles_seen; + uv_async_t async_handles[1024 * 1024]; +}; + +static volatile int done; +static uv_thread_t thread_id; +static struct async_container* container; + + +static unsigned fastrand(void) { + static unsigned g = 0; + g = g * 214013 + 2531011; + return g; +} + + +static void thread_cb(void* arg) { + unsigned i; + + while (done == 0) { + i = fastrand() % ARRAY_SIZE(container->async_handles); + uv_async_send(container->async_handles + i); + } +} + + +static void async_cb(uv_async_t* handle) { + container->async_events++; + handle->data = handle; +} + + +static void timer_cb(uv_timer_t* handle) { + unsigned i; + + done = 1; + ASSERT(0 == uv_thread_join(&thread_id)); + + for (i = 0; i < ARRAY_SIZE(container->async_handles); i++) { + uv_async_t* handle = container->async_handles + i; + + if (handle->data != NULL) + container->handles_seen++; + + uv_close((uv_handle_t*) handle, NULL); + } + + uv_close((uv_handle_t*) handle, NULL); +} + + +BENCHMARK_IMPL(million_async) { + uv_timer_t timer_handle; + uv_async_t* handle; + uv_loop_t* loop; + int timeout; + unsigned i; + + loop = uv_default_loop(); + timeout = 5000; + + container = malloc(sizeof(*container)); + ASSERT(container != NULL); + container->async_events = 0; + container->handles_seen = 0; + + for (i = 0; i < ARRAY_SIZE(container->async_handles); i++) { + handle = container->async_handles + i; + ASSERT(0 == uv_async_init(loop, handle, async_cb)); + handle->data = NULL; + } + + ASSERT(0 == uv_timer_init(loop, &timer_handle)); + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, timeout, 0)); + ASSERT(0 == uv_thread_create(&thread_id, thread_cb, NULL)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + printf("%s async events in %.1f seconds (%s/s, %s unique handles seen)\n", + fmt(container->async_events), + timeout / 1000., + fmt(container->async_events / (timeout / 1000.)), + fmt(container->handles_seen)); + free(container); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/benchmark-million-timers.c b/3rdparty/libuv/test/benchmark-million-timers.c new file mode 100644 index 00000000000..60a308bef13 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-million-timers.c @@ -0,0 +1,86 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "uv.h" + +#define NUM_TIMERS (10 * 1000 * 1000) + +static int timer_cb_called; +static int close_cb_called; + + +static void timer_cb(uv_timer_t* handle) { + timer_cb_called++; +} + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +BENCHMARK_IMPL(million_timers) { + uv_timer_t* timers; + uv_loop_t* loop; + uint64_t before_all; + uint64_t before_run; + uint64_t after_run; + uint64_t after_all; + int timeout; + int i; + + timers = malloc(NUM_TIMERS * sizeof(timers[0])); + ASSERT(timers != NULL); + + loop = uv_default_loop(); + timeout = 0; + + before_all = uv_hrtime(); + for (i = 0; i < NUM_TIMERS; i++) { + if (i % 1000 == 0) timeout++; + ASSERT(0 == uv_timer_init(loop, timers + i)); + ASSERT(0 == uv_timer_start(timers + i, timer_cb, timeout, 0)); + } + + before_run = uv_hrtime(); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + after_run = uv_hrtime(); + + for (i = 0; i < NUM_TIMERS; i++) + uv_close((uv_handle_t*) (timers + i), close_cb); + + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + after_all = uv_hrtime(); + + ASSERT(timer_cb_called == NUM_TIMERS); + ASSERT(close_cb_called == NUM_TIMERS); + free(timers); + + fprintf(stderr, "%.2f seconds total\n", (after_all - before_all) / 1e9); + fprintf(stderr, "%.2f seconds init\n", (before_run - before_all) / 1e9); + fprintf(stderr, "%.2f seconds dispatch\n", (after_run - before_run) / 1e9); + fprintf(stderr, "%.2f seconds cleanup\n", (after_all - after_run) / 1e9); + fflush(stderr); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/benchmark-multi-accept.c b/3rdparty/libuv/test/benchmark-multi-accept.c new file mode 100644 index 00000000000..2f32c0caf4a --- /dev/null +++ b/3rdparty/libuv/test/benchmark-multi-accept.c @@ -0,0 +1,447 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "uv.h" + +#define IPC_PIPE_NAME TEST_PIPENAME +#define NUM_CONNECTS (250 * 1000) + +union stream_handle { + uv_pipe_t pipe; + uv_tcp_t tcp; +}; + +/* Use as (uv_stream_t *) &handle_storage -- it's kind of clunky but it + * avoids aliasing warnings. + */ +typedef unsigned char handle_storage_t[sizeof(union stream_handle)]; + +/* Used for passing around the listen handle, not part of the benchmark proper. + * We have an overabundance of server types here. It works like this: + * + * 1. The main thread starts an IPC pipe server. + * 2. The worker threads connect to the IPC server and obtain a listen handle. + * 3. The worker threads start accepting requests on the listen handle. + * 4. The main thread starts connecting repeatedly. + * + * Step #4 should perhaps be farmed out over several threads. + */ +struct ipc_server_ctx { + handle_storage_t server_handle; + unsigned int num_connects; + uv_pipe_t ipc_pipe; +}; + +struct ipc_peer_ctx { + handle_storage_t peer_handle; + uv_write_t write_req; +}; + +struct ipc_client_ctx { + uv_connect_t connect_req; + uv_stream_t* server_handle; + uv_pipe_t ipc_pipe; + char scratch[16]; +}; + +/* Used in the actual benchmark. */ +struct server_ctx { + handle_storage_t server_handle; + unsigned int num_connects; + uv_async_t async_handle; + uv_thread_t thread_id; + uv_sem_t semaphore; +}; + +struct client_ctx { + handle_storage_t client_handle; + unsigned int num_connects; + uv_connect_t connect_req; + uv_idle_t idle_handle; +}; + +static void ipc_connection_cb(uv_stream_t* ipc_pipe, int status); +static void ipc_write_cb(uv_write_t* req, int status); +static void ipc_close_cb(uv_handle_t* handle); +static void ipc_connect_cb(uv_connect_t* req, int status); +static void ipc_read_cb(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf); +static void ipc_alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf); + +static void sv_async_cb(uv_async_t* handle); +static void sv_connection_cb(uv_stream_t* server_handle, int status); +static void sv_read_cb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf); +static void sv_alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf); + +static void cl_connect_cb(uv_connect_t* req, int status); +static void cl_idle_cb(uv_idle_t* handle); +static void cl_close_cb(uv_handle_t* handle); + +static struct sockaddr_in listen_addr; + + +static void ipc_connection_cb(uv_stream_t* ipc_pipe, int status) { + struct ipc_server_ctx* sc; + struct ipc_peer_ctx* pc; + uv_loop_t* loop; + uv_buf_t buf; + + loop = ipc_pipe->loop; + buf = uv_buf_init("PING", 4); + sc = container_of(ipc_pipe, struct ipc_server_ctx, ipc_pipe); + pc = calloc(1, sizeof(*pc)); + ASSERT(pc != NULL); + + if (ipc_pipe->type == UV_TCP) + ASSERT(0 == uv_tcp_init(loop, (uv_tcp_t*) &pc->peer_handle)); + else if (ipc_pipe->type == UV_NAMED_PIPE) + ASSERT(0 == uv_pipe_init(loop, (uv_pipe_t*) &pc->peer_handle, 1)); + else + ASSERT(0); + + ASSERT(0 == uv_accept(ipc_pipe, (uv_stream_t*) &pc->peer_handle)); + ASSERT(0 == uv_write2(&pc->write_req, + (uv_stream_t*) &pc->peer_handle, + &buf, + 1, + (uv_stream_t*) &sc->server_handle, + ipc_write_cb)); + + if (--sc->num_connects == 0) + uv_close((uv_handle_t*) ipc_pipe, NULL); +} + + +static void ipc_write_cb(uv_write_t* req, int status) { + struct ipc_peer_ctx* ctx; + ctx = container_of(req, struct ipc_peer_ctx, write_req); + uv_close((uv_handle_t*) &ctx->peer_handle, ipc_close_cb); +} + + +static void ipc_close_cb(uv_handle_t* handle) { + struct ipc_peer_ctx* ctx; + ctx = container_of(handle, struct ipc_peer_ctx, peer_handle); + free(ctx); +} + + +static void ipc_connect_cb(uv_connect_t* req, int status) { + struct ipc_client_ctx* ctx; + ctx = container_of(req, struct ipc_client_ctx, connect_req); + ASSERT(0 == status); + ASSERT(0 == uv_read_start((uv_stream_t*) &ctx->ipc_pipe, + ipc_alloc_cb, + ipc_read_cb)); +} + + +static void ipc_alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + struct ipc_client_ctx* ctx; + ctx = container_of(handle, struct ipc_client_ctx, ipc_pipe); + buf->base = ctx->scratch; + buf->len = sizeof(ctx->scratch); +} + + +static void ipc_read_cb(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + struct ipc_client_ctx* ctx; + uv_loop_t* loop; + uv_handle_type type; + uv_pipe_t* ipc_pipe; + + ipc_pipe = (uv_pipe_t*) handle; + ctx = container_of(ipc_pipe, struct ipc_client_ctx, ipc_pipe); + loop = ipc_pipe->loop; + + ASSERT(1 == uv_pipe_pending_count(ipc_pipe)); + type = uv_pipe_pending_type(ipc_pipe); + if (type == UV_TCP) + ASSERT(0 == uv_tcp_init(loop, (uv_tcp_t*) ctx->server_handle)); + else if (type == UV_NAMED_PIPE) + ASSERT(0 == uv_pipe_init(loop, (uv_pipe_t*) ctx->server_handle, 0)); + else + ASSERT(0); + + ASSERT(0 == uv_accept(handle, ctx->server_handle)); + uv_close((uv_handle_t*) &ctx->ipc_pipe, NULL); +} + + +/* Set up an IPC pipe server that hands out listen sockets to the worker + * threads. It's kind of cumbersome for such a simple operation, maybe we + * should revive uv_import() and uv_export(). + */ +static void send_listen_handles(uv_handle_type type, + unsigned int num_servers, + struct server_ctx* servers) { + struct ipc_server_ctx ctx; + uv_loop_t* loop; + unsigned int i; + + loop = uv_default_loop(); + ctx.num_connects = num_servers; + + if (type == UV_TCP) { + ASSERT(0 == uv_tcp_init(loop, (uv_tcp_t*) &ctx.server_handle)); + ASSERT(0 == uv_tcp_bind((uv_tcp_t*) &ctx.server_handle, + (const struct sockaddr*) &listen_addr, + 0)); + } + else + ASSERT(0); + + ASSERT(0 == uv_pipe_init(loop, &ctx.ipc_pipe, 1)); + ASSERT(0 == uv_pipe_bind(&ctx.ipc_pipe, IPC_PIPE_NAME)); + ASSERT(0 == uv_listen((uv_stream_t*) &ctx.ipc_pipe, 128, ipc_connection_cb)); + + for (i = 0; i < num_servers; i++) + uv_sem_post(&servers[i].semaphore); + + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + uv_close((uv_handle_t*) &ctx.server_handle, NULL); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + for (i = 0; i < num_servers; i++) + uv_sem_wait(&servers[i].semaphore); +} + + +static void get_listen_handle(uv_loop_t* loop, uv_stream_t* server_handle) { + struct ipc_client_ctx ctx; + + ctx.server_handle = server_handle; + ctx.server_handle->data = "server handle"; + + ASSERT(0 == uv_pipe_init(loop, &ctx.ipc_pipe, 1)); + uv_pipe_connect(&ctx.connect_req, + &ctx.ipc_pipe, + IPC_PIPE_NAME, + ipc_connect_cb); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); +} + + +static void server_cb(void *arg) { + struct server_ctx *ctx; + uv_loop_t loop; + + ctx = arg; + ASSERT(0 == uv_loop_init(&loop)); + + ASSERT(0 == uv_async_init(&loop, &ctx->async_handle, sv_async_cb)); + uv_unref((uv_handle_t*) &ctx->async_handle); + + /* Wait until the main thread is ready. */ + uv_sem_wait(&ctx->semaphore); + get_listen_handle(&loop, (uv_stream_t*) &ctx->server_handle); + uv_sem_post(&ctx->semaphore); + + /* Now start the actual benchmark. */ + ASSERT(0 == uv_listen((uv_stream_t*) &ctx->server_handle, + 128, + sv_connection_cb)); + ASSERT(0 == uv_run(&loop, UV_RUN_DEFAULT)); + + uv_loop_close(&loop); +} + + +static void sv_async_cb(uv_async_t* handle) { + struct server_ctx* ctx; + ctx = container_of(handle, struct server_ctx, async_handle); + uv_close((uv_handle_t*) &ctx->server_handle, NULL); + uv_close((uv_handle_t*) &ctx->async_handle, NULL); +} + + +static void sv_connection_cb(uv_stream_t* server_handle, int status) { + handle_storage_t* storage; + struct server_ctx* ctx; + + ctx = container_of(server_handle, struct server_ctx, server_handle); + ASSERT(status == 0); + + storage = malloc(sizeof(*storage)); + ASSERT(storage != NULL); + + if (server_handle->type == UV_TCP) + ASSERT(0 == uv_tcp_init(server_handle->loop, (uv_tcp_t*) storage)); + else if (server_handle->type == UV_NAMED_PIPE) + ASSERT(0 == uv_pipe_init(server_handle->loop, (uv_pipe_t*) storage, 0)); + else + ASSERT(0); + + ASSERT(0 == uv_accept(server_handle, (uv_stream_t*) storage)); + ASSERT(0 == uv_read_start((uv_stream_t*) storage, sv_alloc_cb, sv_read_cb)); + ctx->num_connects++; +} + + +static void sv_alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[32]; + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void sv_read_cb(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + ASSERT(nread == UV_EOF); + uv_close((uv_handle_t*) handle, (uv_close_cb) free); +} + + +static void cl_connect_cb(uv_connect_t* req, int status) { + struct client_ctx* ctx = container_of(req, struct client_ctx, connect_req); + uv_idle_start(&ctx->idle_handle, cl_idle_cb); + ASSERT(0 == status); +} + + +static void cl_idle_cb(uv_idle_t* handle) { + struct client_ctx* ctx = container_of(handle, struct client_ctx, idle_handle); + uv_close((uv_handle_t*) &ctx->client_handle, cl_close_cb); + uv_idle_stop(&ctx->idle_handle); +} + + +static void cl_close_cb(uv_handle_t* handle) { + struct client_ctx* ctx; + + ctx = container_of(handle, struct client_ctx, client_handle); + + if (--ctx->num_connects == 0) { + uv_close((uv_handle_t*) &ctx->idle_handle, NULL); + return; + } + + ASSERT(0 == uv_tcp_init(handle->loop, (uv_tcp_t*) &ctx->client_handle)); + ASSERT(0 == uv_tcp_connect(&ctx->connect_req, + (uv_tcp_t*) &ctx->client_handle, + (const struct sockaddr*) &listen_addr, + cl_connect_cb)); +} + + +static int test_tcp(unsigned int num_servers, unsigned int num_clients) { + struct server_ctx* servers; + struct client_ctx* clients; + uv_loop_t* loop; + uv_tcp_t* handle; + unsigned int i; + double time; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &listen_addr)); + loop = uv_default_loop(); + + servers = calloc(num_servers, sizeof(servers[0])); + clients = calloc(num_clients, sizeof(clients[0])); + ASSERT(servers != NULL); + ASSERT(clients != NULL); + + /* We're making the assumption here that from the perspective of the + * OS scheduler, threads are functionally equivalent to and interchangeable + * with full-blown processes. + */ + for (i = 0; i < num_servers; i++) { + struct server_ctx* ctx = servers + i; + ASSERT(0 == uv_sem_init(&ctx->semaphore, 0)); + ASSERT(0 == uv_thread_create(&ctx->thread_id, server_cb, ctx)); + } + + send_listen_handles(UV_TCP, num_servers, servers); + + for (i = 0; i < num_clients; i++) { + struct client_ctx* ctx = clients + i; + ctx->num_connects = NUM_CONNECTS / num_clients; + handle = (uv_tcp_t*) &ctx->client_handle; + handle->data = "client handle"; + ASSERT(0 == uv_tcp_init(loop, handle)); + ASSERT(0 == uv_tcp_connect(&ctx->connect_req, + handle, + (const struct sockaddr*) &listen_addr, + cl_connect_cb)); + ASSERT(0 == uv_idle_init(loop, &ctx->idle_handle)); + } + + { + uint64_t t = uv_hrtime(); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + t = uv_hrtime() - t; + time = t / 1e9; + } + + for (i = 0; i < num_servers; i++) { + struct server_ctx* ctx = servers + i; + uv_async_send(&ctx->async_handle); + ASSERT(0 == uv_thread_join(&ctx->thread_id)); + uv_sem_destroy(&ctx->semaphore); + } + + printf("accept%u: %.0f accepts/sec (%u total)\n", + num_servers, + NUM_CONNECTS / time, + NUM_CONNECTS); + + for (i = 0; i < num_servers; i++) { + struct server_ctx* ctx = servers + i; + printf(" thread #%u: %.0f accepts/sec (%u total, %.1f%%)\n", + i, + ctx->num_connects / time, + ctx->num_connects, + ctx->num_connects * 100.0 / NUM_CONNECTS); + } + + free(clients); + free(servers); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +BENCHMARK_IMPL(tcp_multi_accept2) { + return test_tcp(2, 40); +} + + +BENCHMARK_IMPL(tcp_multi_accept4) { + return test_tcp(4, 40); +} + + +BENCHMARK_IMPL(tcp_multi_accept8) { + return test_tcp(8, 40); +} diff --git a/3rdparty/libuv/test/benchmark-ping-pongs.c b/3rdparty/libuv/test/benchmark-ping-pongs.c new file mode 100644 index 00000000000..646a7df9447 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-ping-pongs.c @@ -0,0 +1,221 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +/* Run the benchmark for this many ms */ +#define TIME 5000 + + +typedef struct { + int pongs; + int state; + uv_tcp_t tcp; + uv_connect_t connect_req; + uv_shutdown_t shutdown_req; +} pinger_t; + +typedef struct buf_s { + uv_buf_t uv_buf_t; + struct buf_s* next; +} buf_t; + + +static char PING[] = "PING\n"; + +static uv_loop_t* loop; + +static buf_t* buf_freelist = NULL; +static int pinger_shutdown_cb_called; +static int completed_pingers = 0; +static int64_t start_time; + + +static void buf_alloc(uv_handle_t* tcp, size_t size, uv_buf_t* buf) { + buf_t* ab; + + ab = buf_freelist; + if (ab != NULL) + buf_freelist = ab->next; + else { + ab = malloc(size + sizeof(*ab)); + ab->uv_buf_t.len = size; + ab->uv_buf_t.base = (char*) (ab + 1); + } + + *buf = ab->uv_buf_t; +} + + +static void buf_free(const uv_buf_t* buf) { + buf_t* ab = (buf_t*) buf->base - 1; + ab->next = buf_freelist; + buf_freelist = ab; +} + + +static void pinger_close_cb(uv_handle_t* handle) { + pinger_t* pinger; + + pinger = (pinger_t*)handle->data; + fprintf(stderr, "ping_pongs: %d roundtrips/s\n", (1000 * pinger->pongs) / TIME); + fflush(stderr); + + free(pinger); + + completed_pingers++; +} + + +static void pinger_write_cb(uv_write_t* req, int status) { + ASSERT(status == 0); + + free(req); +} + + +static void pinger_write_ping(pinger_t* pinger) { + uv_write_t* req; + uv_buf_t buf; + + buf = uv_buf_init(PING, sizeof(PING) - 1); + + req = malloc(sizeof *req); + if (uv_write(req, (uv_stream_t*) &pinger->tcp, &buf, 1, pinger_write_cb)) { + FATAL("uv_write failed"); + } +} + + +static void pinger_shutdown_cb(uv_shutdown_t* req, int status) { + ASSERT(status == 0); + pinger_shutdown_cb_called++; + + /* + * The close callback has not been triggered yet. We must wait for EOF + * until we close the connection. + */ + ASSERT(completed_pingers == 0); +} + + +static void pinger_read_cb(uv_stream_t* tcp, + ssize_t nread, + const uv_buf_t* buf) { + ssize_t i; + pinger_t* pinger; + + pinger = (pinger_t*)tcp->data; + + if (nread < 0) { + ASSERT(nread == UV_EOF); + + if (buf->base) { + buf_free(buf); + } + + ASSERT(pinger_shutdown_cb_called == 1); + uv_close((uv_handle_t*)tcp, pinger_close_cb); + + return; + } + + /* Now we count the pings */ + for (i = 0; i < nread; i++) { + ASSERT(buf->base[i] == PING[pinger->state]); + pinger->state = (pinger->state + 1) % (sizeof(PING) - 1); + if (pinger->state == 0) { + pinger->pongs++; + if (uv_now(loop) - start_time > TIME) { + uv_shutdown(&pinger->shutdown_req, + (uv_stream_t*) tcp, + pinger_shutdown_cb); + break; + } else { + pinger_write_ping(pinger); + } + } + } + + buf_free(buf); +} + + +static void pinger_connect_cb(uv_connect_t* req, int status) { + pinger_t *pinger = (pinger_t*)req->handle->data; + + ASSERT(status == 0); + + pinger_write_ping(pinger); + + if (uv_read_start(req->handle, buf_alloc, pinger_read_cb)) { + FATAL("uv_read_start failed"); + } +} + + +static void pinger_new(void) { + struct sockaddr_in client_addr; + struct sockaddr_in server_addr; + pinger_t *pinger; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", 0, &client_addr)); + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &server_addr)); + pinger = malloc(sizeof(*pinger)); + pinger->state = 0; + pinger->pongs = 0; + + /* Try to connect to the server and do NUM_PINGS ping-pongs. */ + r = uv_tcp_init(loop, &pinger->tcp); + ASSERT(!r); + + pinger->tcp.data = pinger; + + ASSERT(0 == uv_tcp_bind(&pinger->tcp, + (const struct sockaddr*) &client_addr, + 0)); + + r = uv_tcp_connect(&pinger->connect_req, + &pinger->tcp, + (const struct sockaddr*) &server_addr, + pinger_connect_cb); + ASSERT(!r); +} + + +BENCHMARK_IMPL(ping_pongs) { + loop = uv_default_loop(); + + start_time = uv_now(loop); + + pinger_new(); + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(completed_pingers == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/benchmark-pound.c b/3rdparty/libuv/test/benchmark-pound.c new file mode 100644 index 00000000000..79f36345037 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-pound.c @@ -0,0 +1,351 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "uv.h" + +/* Update this is you're going to run > 1000 concurrent requests. */ +#define MAX_CONNS 1000 + +#undef NANOSEC +#define NANOSEC ((uint64_t) 1e9) + +#undef DEBUG +#define DEBUG 0 + +struct conn_rec_s; + +typedef void (*setup_fn)(int num, void* arg); +typedef void (*make_connect_fn)(struct conn_rec_s* conn); +typedef int (*connect_fn)(int num, make_connect_fn make_connect, void* arg); + +/* Base class for tcp_conn_rec and pipe_conn_rec. + * The ordering of fields matters! + */ +typedef struct conn_rec_s { + int i; + uv_connect_t conn_req; + uv_write_t write_req; + make_connect_fn make_connect; + uv_stream_t stream; +} conn_rec; + +typedef struct { + int i; + uv_connect_t conn_req; + uv_write_t write_req; + make_connect_fn make_connect; + uv_tcp_t stream; +} tcp_conn_rec; + +typedef struct { + int i; + uv_connect_t conn_req; + uv_write_t write_req; + make_connect_fn make_connect; + uv_pipe_t stream; +} pipe_conn_rec; + +static char buffer[] = "QS"; + +static uv_loop_t* loop; + +static tcp_conn_rec tcp_conns[MAX_CONNS]; +static pipe_conn_rec pipe_conns[MAX_CONNS]; + +static uint64_t start; /* in ms */ +static int closed_streams; +static int conns_failed; + +static void alloc_cb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf); +static void connect_cb(uv_connect_t* conn_req, int status); +static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); +static void close_cb(uv_handle_t* handle); + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void after_write(uv_write_t* req, int status) { + if (status != 0) { + fprintf(stderr, "write error %s\n", uv_err_name(status)); + uv_close((uv_handle_t*)req->handle, close_cb); + conns_failed++; + return; + } +} + + +static void connect_cb(uv_connect_t* req, int status) { + conn_rec* conn; + uv_buf_t buf; + int r; + + if (status != 0) { +#if DEBUG + fprintf(stderr, "connect error %s\n", uv_err_name(status)); +#endif + uv_close((uv_handle_t*)req->handle, close_cb); + conns_failed++; + return; + } + + ASSERT(req != NULL); + ASSERT(status == 0); + + conn = (conn_rec*)req->data; + ASSERT(conn != NULL); + +#if DEBUG + printf("connect_cb %d\n", conn->i); +#endif + + r = uv_read_start(&conn->stream, alloc_cb, read_cb); + ASSERT(r == 0); + + buf.base = buffer; + buf.len = sizeof(buffer) - 1; + + r = uv_write(&conn->write_req, &conn->stream, &buf, 1, after_write); + ASSERT(r == 0); +} + + +static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { + + ASSERT(stream != NULL); + +#if DEBUG + printf("read_cb %d\n", p->i); +#endif + + uv_close((uv_handle_t*)stream, close_cb); + + if (nread < 0) { + if (nread == UV_EOF) { + ; + } else if (nread == UV_ECONNRESET) { + conns_failed++; + } else { + fprintf(stderr, "read error %s\n", uv_err_name(nread)); + ASSERT(0); + } + } +} + + +static void close_cb(uv_handle_t* handle) { + conn_rec* p = (conn_rec*)handle->data; + + ASSERT(handle != NULL); + closed_streams++; + +#if DEBUG + printf("close_cb %d\n", p->i); +#endif + + if (uv_now(loop) - start < 10000) { + p->make_connect(p); + } +} + + +static void tcp_do_setup(int num, void* arg) { + int i; + + for (i = 0; i < num; i++) { + tcp_conns[i].i = i; + } +} + + +static void pipe_do_setup(int num, void* arg) { + int i; + + for (i = 0; i < num; i++) { + pipe_conns[i].i = i; + } +} + + +static void tcp_make_connect(conn_rec* p) { + struct sockaddr_in addr; + tcp_conn_rec* tp; + int r; + + tp = (tcp_conn_rec*) p; + + r = uv_tcp_init(loop, (uv_tcp_t*)&p->stream); + ASSERT(r == 0); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_connect(&tp->conn_req, + (uv_tcp_t*) &p->stream, + (const struct sockaddr*) &addr, + connect_cb); + if (r) { + fprintf(stderr, "uv_tcp_connect error %s\n", uv_err_name(r)); + ASSERT(0); + } + +#if DEBUG + printf("make connect %d\n", p->i); +#endif + + p->conn_req.data = p; + p->write_req.data = p; + p->stream.data = p; +} + + +static void pipe_make_connect(conn_rec* p) { + int r; + + r = uv_pipe_init(loop, (uv_pipe_t*)&p->stream, 0); + ASSERT(r == 0); + + uv_pipe_connect(&((pipe_conn_rec*) p)->conn_req, + (uv_pipe_t*) &p->stream, + TEST_PIPENAME, + connect_cb); + +#if DEBUG + printf("make connect %d\n", p->i); +#endif + + p->conn_req.data = p; + p->write_req.data = p; + p->stream.data = p; +} + + +static int tcp_do_connect(int num, make_connect_fn make_connect, void* arg) { + int i; + + for (i = 0; i < num; i++) { + tcp_make_connect((conn_rec*)&tcp_conns[i]); + tcp_conns[i].make_connect = make_connect; + } + + return 0; +} + + +static int pipe_do_connect(int num, make_connect_fn make_connect, void* arg) { + int i; + + for (i = 0; i < num; i++) { + pipe_make_connect((conn_rec*)&pipe_conns[i]); + pipe_conns[i].make_connect = make_connect; + } + + return 0; +} + + +static int pound_it(int concurrency, + const char* type, + setup_fn do_setup, + connect_fn do_connect, + make_connect_fn make_connect, + void* arg) { + double secs; + int r; + uint64_t start_time; /* in ns */ + uint64_t end_time; + + loop = uv_default_loop(); + + uv_update_time(loop); + start = uv_now(loop); + + /* Run benchmark for at least five seconds. */ + start_time = uv_hrtime(); + + do_setup(concurrency, arg); + + r = do_connect(concurrency, make_connect, arg); + ASSERT(!r); + + uv_run(loop, UV_RUN_DEFAULT); + + end_time = uv_hrtime(); + + /* Number of fractional seconds it took to run the benchmark. */ + secs = (double)(end_time - start_time) / NANOSEC; + + fprintf(stderr, "%s-conn-pound-%d: %.0f accepts/s (%d failed)\n", + type, + concurrency, + closed_streams / secs, + conns_failed); + fflush(stderr); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +BENCHMARK_IMPL(tcp4_pound_100) { + return pound_it(100, + "tcp", + tcp_do_setup, + tcp_do_connect, + tcp_make_connect, + NULL); +} + + +BENCHMARK_IMPL(tcp4_pound_1000) { + return pound_it(1000, + "tcp", + tcp_do_setup, + tcp_do_connect, + tcp_make_connect, + NULL); +} + + +BENCHMARK_IMPL(pipe_pound_100) { + return pound_it(100, + "pipe", + pipe_do_setup, + pipe_do_connect, + pipe_make_connect, + NULL); +} + + +BENCHMARK_IMPL(pipe_pound_1000) { + return pound_it(1000, + "pipe", + pipe_do_setup, + pipe_do_connect, + pipe_make_connect, + NULL); +} diff --git a/3rdparty/libuv/test/benchmark-pump.c b/3rdparty/libuv/test/benchmark-pump.c new file mode 100644 index 00000000000..88f2dc5c658 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-pump.c @@ -0,0 +1,476 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "uv.h" + +#include +#include + + +static int TARGET_CONNECTIONS; +#define WRITE_BUFFER_SIZE 8192 +#define MAX_SIMULTANEOUS_CONNECTS 100 + +#define PRINT_STATS 0 +#define STATS_INTERVAL 1000 /* msec */ +#define STATS_COUNT 5 + + +static void do_write(uv_stream_t*); +static void maybe_connect_some(); + +static uv_req_t* req_alloc(); +static void req_free(uv_req_t* uv_req); + +static void buf_alloc(uv_handle_t* handle, size_t size, uv_buf_t* buf); +static void buf_free(const uv_buf_t* buf); + +static uv_loop_t* loop; + +static uv_tcp_t tcpServer; +static uv_pipe_t pipeServer; +static uv_stream_t* server; +static struct sockaddr_in listen_addr; +static struct sockaddr_in connect_addr; + +static int64_t start_time; + +static int max_connect_socket = 0; +static int max_read_sockets = 0; +static int read_sockets = 0; +static int write_sockets = 0; + +static int64_t nrecv = 0; +static int64_t nrecv_total = 0; +static int64_t nsent = 0; +static int64_t nsent_total = 0; + +static int stats_left = 0; + +static char write_buffer[WRITE_BUFFER_SIZE]; + +/* Make this as large as you need. */ +#define MAX_WRITE_HANDLES 1000 + +static stream_type type; + +static uv_tcp_t tcp_write_handles[MAX_WRITE_HANDLES]; +static uv_pipe_t pipe_write_handles[MAX_WRITE_HANDLES]; + +static uv_timer_t timer_handle; + + +static double gbit(int64_t bytes, int64_t passed_ms) { + double gbits = ((double)bytes / (1024 * 1024 * 1024)) * 8; + return gbits / ((double)passed_ms / 1000); +} + + +static void show_stats(uv_timer_t* handle) { + int64_t diff; + int i; + +#if PRINT_STATS + fprintf(stderr, "connections: %d, write: %.1f gbit/s\n", + write_sockets, + gbit(nsent, STATS_INTERVAL)); + fflush(stderr); +#endif + + /* Exit if the show is over */ + if (!--stats_left) { + + uv_update_time(loop); + diff = uv_now(loop) - start_time; + + fprintf(stderr, "%s_pump%d_client: %.1f gbit/s\n", + type == TCP ? "tcp" : "pipe", + write_sockets, + gbit(nsent_total, diff)); + fflush(stderr); + + for (i = 0; i < write_sockets; i++) { + if (type == TCP) + uv_close((uv_handle_t*) &tcp_write_handles[i], NULL); + else + uv_close((uv_handle_t*) &pipe_write_handles[i], NULL); + } + + exit(0); + } + + /* Reset read and write counters */ + nrecv = 0; + nsent = 0; +} + + +static void read_show_stats(void) { + int64_t diff; + + uv_update_time(loop); + diff = uv_now(loop) - start_time; + + fprintf(stderr, "%s_pump%d_server: %.1f gbit/s\n", + type == TCP ? "tcp" : "pipe", + max_read_sockets, + gbit(nrecv_total, diff)); + fflush(stderr); +} + + + +static void read_sockets_close_cb(uv_handle_t* handle) { + free(handle); + read_sockets--; + + /* If it's past the first second and everyone has closed their connection + * Then print stats. + */ + if (uv_now(loop) - start_time > 1000 && read_sockets == 0) { + read_show_stats(); + uv_close((uv_handle_t*)server, NULL); + } +} + + +static void start_stats_collection(void) { + int r; + + /* Show-stats timer */ + stats_left = STATS_COUNT; + r = uv_timer_init(loop, &timer_handle); + ASSERT(r == 0); + r = uv_timer_start(&timer_handle, show_stats, STATS_INTERVAL, STATS_INTERVAL); + ASSERT(r == 0); + + uv_update_time(loop); + start_time = uv_now(loop); +} + + +static void read_cb(uv_stream_t* stream, ssize_t bytes, const uv_buf_t* buf) { + if (nrecv_total == 0) { + ASSERT(start_time == 0); + uv_update_time(loop); + start_time = uv_now(loop); + } + + if (bytes < 0) { + uv_close((uv_handle_t*)stream, read_sockets_close_cb); + return; + } + + buf_free(buf); + + nrecv += bytes; + nrecv_total += bytes; +} + + +static void write_cb(uv_write_t* req, int status) { + ASSERT(status == 0); + + req_free((uv_req_t*) req); + + nsent += sizeof write_buffer; + nsent_total += sizeof write_buffer; + + do_write((uv_stream_t*) req->handle); +} + + +static void do_write(uv_stream_t* stream) { + uv_write_t* req; + uv_buf_t buf; + int r; + + buf.base = (char*) &write_buffer; + buf.len = sizeof write_buffer; + + req = (uv_write_t*) req_alloc(); + r = uv_write(req, stream, &buf, 1, write_cb); + ASSERT(r == 0); +} + + +static void connect_cb(uv_connect_t* req, int status) { + int i; + + if (status) { + fprintf(stderr, "%s", uv_strerror(status)); + fflush(stderr); + } + ASSERT(status == 0); + + write_sockets++; + req_free((uv_req_t*) req); + + maybe_connect_some(); + + if (write_sockets == TARGET_CONNECTIONS) { + start_stats_collection(); + + /* Yay! start writing */ + for (i = 0; i < write_sockets; i++) { + if (type == TCP) + do_write((uv_stream_t*) &tcp_write_handles[i]); + else + do_write((uv_stream_t*) &pipe_write_handles[i]); + } + } +} + + +static void maybe_connect_some(void) { + uv_connect_t* req; + uv_tcp_t* tcp; + uv_pipe_t* pipe; + int r; + + while (max_connect_socket < TARGET_CONNECTIONS && + max_connect_socket < write_sockets + MAX_SIMULTANEOUS_CONNECTS) { + if (type == TCP) { + tcp = &tcp_write_handles[max_connect_socket++]; + + r = uv_tcp_init(loop, tcp); + ASSERT(r == 0); + + req = (uv_connect_t*) req_alloc(); + r = uv_tcp_connect(req, + tcp, + (const struct sockaddr*) &connect_addr, + connect_cb); + ASSERT(r == 0); + } else { + pipe = &pipe_write_handles[max_connect_socket++]; + + r = uv_pipe_init(loop, pipe, 0); + ASSERT(r == 0); + + req = (uv_connect_t*) req_alloc(); + uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb); + } + } +} + + +static void connection_cb(uv_stream_t* s, int status) { + uv_stream_t* stream; + int r; + + ASSERT(server == s); + ASSERT(status == 0); + + if (type == TCP) { + stream = (uv_stream_t*)malloc(sizeof(uv_tcp_t)); + r = uv_tcp_init(loop, (uv_tcp_t*)stream); + ASSERT(r == 0); + } else { + stream = (uv_stream_t*)malloc(sizeof(uv_pipe_t)); + r = uv_pipe_init(loop, (uv_pipe_t*)stream, 0); + ASSERT(r == 0); + } + + r = uv_accept(s, stream); + ASSERT(r == 0); + + r = uv_read_start(stream, buf_alloc, read_cb); + ASSERT(r == 0); + + read_sockets++; + max_read_sockets++; +} + + +/* + * Request allocator + */ + +typedef struct req_list_s { + union uv_any_req uv_req; + struct req_list_s* next; +} req_list_t; + + +static req_list_t* req_freelist = NULL; + + +static uv_req_t* req_alloc(void) { + req_list_t* req; + + req = req_freelist; + if (req != NULL) { + req_freelist = req->next; + return (uv_req_t*) req; + } + + req = (req_list_t*) malloc(sizeof *req); + return (uv_req_t*) req; +} + + +static void req_free(uv_req_t* uv_req) { + req_list_t* req = (req_list_t*) uv_req; + + req->next = req_freelist; + req_freelist = req; +} + + +/* + * Buffer allocator + */ + +typedef struct buf_list_s { + uv_buf_t uv_buf_t; + struct buf_list_s* next; +} buf_list_t; + + +static buf_list_t* buf_freelist = NULL; + + +static void buf_alloc(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + buf_list_t* ab; + + ab = buf_freelist; + if (ab != NULL) + buf_freelist = ab->next; + else { + ab = malloc(size + sizeof(*ab)); + ab->uv_buf_t.len = size; + ab->uv_buf_t.base = (char*) (ab + 1); + } + + *buf = ab->uv_buf_t; +} + + +static void buf_free(const uv_buf_t* buf) { + buf_list_t* ab = (buf_list_t*) buf->base - 1; + ab->next = buf_freelist; + buf_freelist = ab; +} + + +HELPER_IMPL(tcp_pump_server) { + int r; + + type = TCP; + loop = uv_default_loop(); + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &listen_addr)); + + /* Server */ + server = (uv_stream_t*)&tcpServer; + r = uv_tcp_init(loop, &tcpServer); + ASSERT(r == 0); + r = uv_tcp_bind(&tcpServer, (const struct sockaddr*) &listen_addr, 0); + ASSERT(r == 0); + r = uv_listen((uv_stream_t*)&tcpServer, MAX_WRITE_HANDLES, connection_cb); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + + return 0; +} + + +HELPER_IMPL(pipe_pump_server) { + int r; + type = PIPE; + + loop = uv_default_loop(); + + /* Server */ + server = (uv_stream_t*)&pipeServer; + r = uv_pipe_init(loop, &pipeServer, 0); + ASSERT(r == 0); + r = uv_pipe_bind(&pipeServer, TEST_PIPENAME); + ASSERT(r == 0); + r = uv_listen((uv_stream_t*)&pipeServer, MAX_WRITE_HANDLES, connection_cb); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +static void tcp_pump(int n) { + ASSERT(n <= MAX_WRITE_HANDLES); + TARGET_CONNECTIONS = n; + type = TCP; + + loop = uv_default_loop(); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &connect_addr)); + + /* Start making connections */ + maybe_connect_some(); + + uv_run(loop, UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); +} + + +static void pipe_pump(int n) { + ASSERT(n <= MAX_WRITE_HANDLES); + TARGET_CONNECTIONS = n; + type = PIPE; + + loop = uv_default_loop(); + + /* Start making connections */ + maybe_connect_some(); + + uv_run(loop, UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); +} + + +BENCHMARK_IMPL(tcp_pump100_client) { + tcp_pump(100); + return 0; +} + + +BENCHMARK_IMPL(tcp_pump1_client) { + tcp_pump(1); + return 0; +} + + +BENCHMARK_IMPL(pipe_pump100_client) { + pipe_pump(100); + return 0; +} + + +BENCHMARK_IMPL(pipe_pump1_client) { + pipe_pump(1); + return 0; +} diff --git a/3rdparty/libuv/test/benchmark-sizes.c b/3rdparty/libuv/test/benchmark-sizes.c new file mode 100644 index 00000000000..9bf42f91537 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-sizes.c @@ -0,0 +1,46 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "uv.h" + + +BENCHMARK_IMPL(sizes) { + fprintf(stderr, "uv_shutdown_t: %u bytes\n", (unsigned int) sizeof(uv_shutdown_t)); + fprintf(stderr, "uv_write_t: %u bytes\n", (unsigned int) sizeof(uv_write_t)); + fprintf(stderr, "uv_connect_t: %u bytes\n", (unsigned int) sizeof(uv_connect_t)); + fprintf(stderr, "uv_udp_send_t: %u bytes\n", (unsigned int) sizeof(uv_udp_send_t)); + fprintf(stderr, "uv_tcp_t: %u bytes\n", (unsigned int) sizeof(uv_tcp_t)); + fprintf(stderr, "uv_pipe_t: %u bytes\n", (unsigned int) sizeof(uv_pipe_t)); + fprintf(stderr, "uv_tty_t: %u bytes\n", (unsigned int) sizeof(uv_tty_t)); + fprintf(stderr, "uv_prepare_t: %u bytes\n", (unsigned int) sizeof(uv_prepare_t)); + fprintf(stderr, "uv_check_t: %u bytes\n", (unsigned int) sizeof(uv_check_t)); + fprintf(stderr, "uv_idle_t: %u bytes\n", (unsigned int) sizeof(uv_idle_t)); + fprintf(stderr, "uv_async_t: %u bytes\n", (unsigned int) sizeof(uv_async_t)); + fprintf(stderr, "uv_timer_t: %u bytes\n", (unsigned int) sizeof(uv_timer_t)); + fprintf(stderr, "uv_fs_poll_t: %u bytes\n", (unsigned int) sizeof(uv_fs_poll_t)); + fprintf(stderr, "uv_fs_event_t: %u bytes\n", (unsigned int) sizeof(uv_fs_event_t)); + fprintf(stderr, "uv_process_t: %u bytes\n", (unsigned int) sizeof(uv_process_t)); + fprintf(stderr, "uv_poll_t: %u bytes\n", (unsigned int) sizeof(uv_poll_t)); + fprintf(stderr, "uv_loop_t: %u bytes\n", (unsigned int) sizeof(uv_loop_t)); + fflush(stderr); + return 0; +} diff --git a/3rdparty/libuv/test/benchmark-spawn.c b/3rdparty/libuv/test/benchmark-spawn.c new file mode 100644 index 00000000000..ed9ad608f37 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-spawn.c @@ -0,0 +1,164 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* This benchmark spawns itself 1000 times. */ + +#include "task.h" +#include "uv.h" + +static uv_loop_t* loop; + +static int N = 1000; +static int done; + +static uv_process_t process; +static uv_process_options_t options; +static char exepath[1024]; +static size_t exepath_size = 1024; +static char* args[3]; +static uv_pipe_t out; + +#define OUTPUT_SIZE 1024 +static char output[OUTPUT_SIZE]; +static int output_used; + +static int process_open; +static int pipe_open; + + +static void spawn(void); + + +static void maybe_spawn(void) { + if (process_open == 0 && pipe_open == 0) { + done++; + if (done < N) { + spawn(); + } + } +} + + +static void process_close_cb(uv_handle_t* handle) { + ASSERT(process_open == 1); + process_open = 0; + maybe_spawn(); +} + + +static void exit_cb(uv_process_t* process, + int64_t exit_status, + int term_signal) { + ASSERT(exit_status == 42); + ASSERT(term_signal == 0); + uv_close((uv_handle_t*)process, process_close_cb); +} + + +static void on_alloc(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + buf->base = output + output_used; + buf->len = OUTPUT_SIZE - output_used; +} + + +static void pipe_close_cb(uv_handle_t* pipe) { + ASSERT(pipe_open == 1); + pipe_open = 0; + maybe_spawn(); +} + + +static void on_read(uv_stream_t* pipe, ssize_t nread, const uv_buf_t* buf) { + if (nread > 0) { + ASSERT(pipe_open == 1); + output_used += nread; + } else if (nread < 0) { + if (nread == UV_EOF) { + uv_close((uv_handle_t*)pipe, pipe_close_cb); + } + } +} + + +static void spawn(void) { + uv_stdio_container_t stdio[2]; + int r; + + ASSERT(process_open == 0); + ASSERT(pipe_open == 0); + + args[0] = exepath; + args[1] = "spawn_helper"; + args[2] = NULL; + options.file = exepath; + options.args = args; + options.exit_cb = exit_cb; + + uv_pipe_init(loop, &out, 0); + + options.stdio = stdio; + options.stdio_count = 2; + options.stdio[0].flags = UV_IGNORE; + options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + options.stdio[1].data.stream = (uv_stream_t*)&out; + + r = uv_spawn(loop, &process, &options); + ASSERT(r == 0); + + process_open = 1; + pipe_open = 1; + output_used = 0; + + r = uv_read_start((uv_stream_t*) &out, on_alloc, on_read); + ASSERT(r == 0); +} + + +BENCHMARK_IMPL(spawn) { + int r; + static int64_t start_time, end_time; + + loop = uv_default_loop(); + + r = uv_exepath(exepath, &exepath_size); + ASSERT(r == 0); + exepath[exepath_size] = '\0'; + + uv_update_time(loop); + start_time = uv_now(loop); + + spawn(); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + uv_update_time(loop); + end_time = uv_now(loop); + + fprintf(stderr, "spawn: %.0f spawns/s\n", + (double) N / (double) (end_time - start_time) * 1000.0); + fflush(stderr); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/benchmark-tcp-write-batch.c b/3rdparty/libuv/test/benchmark-tcp-write-batch.c new file mode 100644 index 00000000000..96921b70db5 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-tcp-write-batch.c @@ -0,0 +1,144 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +#define WRITE_REQ_DATA "Hello, world." +#define NUM_WRITE_REQS (1000 * 1000) + +typedef struct { + uv_write_t req; + uv_buf_t buf; +} write_req; + + +static write_req* write_reqs; +static uv_tcp_t tcp_client; +static uv_connect_t connect_req; +static uv_shutdown_t shutdown_req; + +static int shutdown_cb_called = 0; +static int connect_cb_called = 0; +static int write_cb_called = 0; +static int close_cb_called = 0; + +static void connect_cb(uv_connect_t* req, int status); +static void write_cb(uv_write_t* req, int status); +static void shutdown_cb(uv_shutdown_t* req, int status); +static void close_cb(uv_handle_t* handle); + + +static void connect_cb(uv_connect_t* req, int status) { + write_req* w; + int i; + int r; + + ASSERT(req->handle == (uv_stream_t*)&tcp_client); + + for (i = 0; i < NUM_WRITE_REQS; i++) { + w = &write_reqs[i]; + r = uv_write(&w->req, req->handle, &w->buf, 1, write_cb); + ASSERT(r == 0); + } + + r = uv_shutdown(&shutdown_req, req->handle, shutdown_cb); + ASSERT(r == 0); + + connect_cb_called++; +} + + +static void write_cb(uv_write_t* req, int status) { + ASSERT(req != NULL); + ASSERT(status == 0); + write_cb_called++; +} + + +static void shutdown_cb(uv_shutdown_t* req, int status) { + ASSERT(req->handle == (uv_stream_t*)&tcp_client); + ASSERT(req->handle->write_queue_size == 0); + + uv_close((uv_handle_t*)req->handle, close_cb); + free(write_reqs); + + shutdown_cb_called++; +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle == (uv_handle_t*)&tcp_client); + close_cb_called++; +} + + +BENCHMARK_IMPL(tcp_write_batch) { + struct sockaddr_in addr; + uv_loop_t* loop; + uint64_t start; + uint64_t stop; + int i; + int r; + + write_reqs = malloc(sizeof(*write_reqs) * NUM_WRITE_REQS); + ASSERT(write_reqs != NULL); + + /* Prepare the data to write out. */ + for (i = 0; i < NUM_WRITE_REQS; i++) { + write_reqs[i].buf = uv_buf_init(WRITE_REQ_DATA, + sizeof(WRITE_REQ_DATA) - 1); + } + + loop = uv_default_loop(); + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_init(loop, &tcp_client); + ASSERT(r == 0); + + r = uv_tcp_connect(&connect_req, + &tcp_client, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); + + start = uv_hrtime(); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + stop = uv_hrtime(); + + ASSERT(connect_cb_called == 1); + ASSERT(write_cb_called == NUM_WRITE_REQS); + ASSERT(shutdown_cb_called == 1); + ASSERT(close_cb_called == 1); + + printf("%ld write requests in %.2fs.\n", + (long)NUM_WRITE_REQS, + (stop - start) / 1e9); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/benchmark-thread.c b/3rdparty/libuv/test/benchmark-thread.c new file mode 100644 index 00000000000..b37a7fd6d01 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-thread.c @@ -0,0 +1,64 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +#define NUM_THREADS (20 * 1000) + +static volatile int num_threads; + + +static void thread_entry(void* arg) { + ASSERT(arg == (void *) 42); + num_threads++; + /* FIXME write barrier? */ +} + + +BENCHMARK_IMPL(thread_create) { + uint64_t start_time; + double duration; + uv_thread_t tid; + int i, r; + + start_time = uv_hrtime(); + + for (i = 0; i < NUM_THREADS; i++) { + r = uv_thread_create(&tid, thread_entry, (void *) 42); + ASSERT(r == 0); + + r = uv_thread_join(&tid); + ASSERT(r == 0); + } + + duration = (uv_hrtime() - start_time) / 1e9; + + ASSERT(num_threads == NUM_THREADS); + + printf("%d threads created in %.2f seconds (%.0f/s)\n", + NUM_THREADS, duration, NUM_THREADS / duration); + + return 0; +} diff --git a/3rdparty/libuv/test/benchmark-udp-pummel.c b/3rdparty/libuv/test/benchmark-udp-pummel.c new file mode 100644 index 00000000000..68a2373d781 --- /dev/null +++ b/3rdparty/libuv/test/benchmark-udp-pummel.c @@ -0,0 +1,243 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "uv.h" + +#include +#include +#include + +#define EXPECTED "RANG TANG DING DONG I AM THE JAPANESE SANDMAN" + +#define TEST_DURATION 5000 /* ms */ + +#define BASE_PORT 12345 + +struct sender_state { + struct sockaddr_in addr; + uv_udp_send_t send_req; + uv_udp_t udp_handle; +}; + +struct receiver_state { + struct sockaddr_in addr; + uv_udp_t udp_handle; +}; + +/* not used in timed mode */ +static unsigned int packet_counter = (unsigned int) 1e6; + +static int n_senders_; +static int n_receivers_; +static uv_buf_t bufs[5]; +static struct sender_state senders[1024]; +static struct receiver_state receivers[1024]; + +static unsigned int send_cb_called; +static unsigned int recv_cb_called; +static unsigned int close_cb_called; +static int timed; +static int exiting; + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + ASSERT(suggested_size <= sizeof(slab)); + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void send_cb(uv_udp_send_t* req, int status) { + struct sender_state* s; + + ASSERT(req != NULL); + + if (status != 0) { + ASSERT(status == UV_ECANCELED); + return; + } + + if (exiting) + return; + + s = container_of(req, struct sender_state, send_req); + ASSERT(req->handle == &s->udp_handle); + + if (timed) + goto send; + + if (packet_counter == 0) { + uv_close((uv_handle_t*)&s->udp_handle, NULL); + return; + } + + packet_counter--; + +send: + ASSERT(0 == uv_udp_send(&s->send_req, + &s->udp_handle, + bufs, + ARRAY_SIZE(bufs), + (const struct sockaddr*) &s->addr, + send_cb)); + send_cb_called++; +} + + +static void recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags) { + if (nread == 0) + return; + + if (nread < 0) { + ASSERT(nread == UV_ECANCELED); + return; + } + + ASSERT(addr->sa_family == AF_INET); + ASSERT(!memcmp(buf->base, EXPECTED, nread)); + + recv_cb_called++; +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +static void timeout_cb(uv_timer_t* timer) { + int i; + + exiting = 1; + + for (i = 0; i < n_senders_; i++) + uv_close((uv_handle_t*)&senders[i].udp_handle, close_cb); + + for (i = 0; i < n_receivers_; i++) + uv_close((uv_handle_t*)&receivers[i].udp_handle, close_cb); +} + + +static int pummel(unsigned int n_senders, + unsigned int n_receivers, + unsigned long timeout) { + uv_timer_t timer_handle; + uint64_t duration; + uv_loop_t* loop; + unsigned int i; + + ASSERT(n_senders <= ARRAY_SIZE(senders)); + ASSERT(n_receivers <= ARRAY_SIZE(receivers)); + + loop = uv_default_loop(); + + n_senders_ = n_senders; + n_receivers_ = n_receivers; + + if (timeout) { + ASSERT(0 == uv_timer_init(loop, &timer_handle)); + ASSERT(0 == uv_timer_start(&timer_handle, timeout_cb, timeout, 0)); + /* Timer should not keep loop alive. */ + uv_unref((uv_handle_t*)&timer_handle); + timed = 1; + } + + for (i = 0; i < n_receivers; i++) { + struct receiver_state* s = receivers + i; + struct sockaddr_in addr; + ASSERT(0 == uv_ip4_addr("0.0.0.0", BASE_PORT + i, &addr)); + ASSERT(0 == uv_udp_init(loop, &s->udp_handle)); + ASSERT(0 == uv_udp_bind(&s->udp_handle, (const struct sockaddr*) &addr, 0)); + ASSERT(0 == uv_udp_recv_start(&s->udp_handle, alloc_cb, recv_cb)); + uv_unref((uv_handle_t*)&s->udp_handle); + } + + bufs[0] = uv_buf_init(EXPECTED + 0, 10); + bufs[1] = uv_buf_init(EXPECTED + 10, 10); + bufs[2] = uv_buf_init(EXPECTED + 20, 10); + bufs[3] = uv_buf_init(EXPECTED + 30, 10); + bufs[4] = uv_buf_init(EXPECTED + 40, 5); + + for (i = 0; i < n_senders; i++) { + struct sender_state* s = senders + i; + ASSERT(0 == uv_ip4_addr("127.0.0.1", + BASE_PORT + (i % n_receivers), + &s->addr)); + ASSERT(0 == uv_udp_init(loop, &s->udp_handle)); + ASSERT(0 == uv_udp_send(&s->send_req, + &s->udp_handle, + bufs, + ARRAY_SIZE(bufs), + (const struct sockaddr*) &s->addr, + send_cb)); + } + + duration = uv_hrtime(); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + duration = uv_hrtime() - duration; + /* convert from nanoseconds to milliseconds */ + duration = duration / (uint64_t) 1e6; + + printf("udp_pummel_%dv%d: %.0f/s received, %.0f/s sent. " + "%u received, %u sent in %.1f seconds.\n", + n_receivers, + n_senders, + recv_cb_called / (duration / 1000.0), + send_cb_called / (duration / 1000.0), + recv_cb_called, + send_cb_called, + duration / 1000.0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +#define X(a, b) \ + BENCHMARK_IMPL(udp_pummel_##a##v##b) { \ + return pummel(a, b, 0); \ + } \ + BENCHMARK_IMPL(udp_timed_pummel_##a##v##b) { \ + return pummel(a, b, TEST_DURATION); \ + } + +X(1, 1) +X(1, 10) +X(1, 100) +X(1, 1000) +X(10, 10) +X(10, 100) +X(10, 1000) +X(100, 10) +X(100, 100) +X(100, 1000) +X(1000, 1000) + +#undef X diff --git a/3rdparty/libuv/test/blackhole-server.c b/3rdparty/libuv/test/blackhole-server.c new file mode 100644 index 00000000000..ad878b35c61 --- /dev/null +++ b/3rdparty/libuv/test/blackhole-server.c @@ -0,0 +1,121 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +typedef struct { + uv_tcp_t handle; + uv_shutdown_t shutdown_req; +} conn_rec; + +static uv_tcp_t tcp_server; + +static void connection_cb(uv_stream_t* stream, int status); +static void alloc_cb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf); +static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); +static void shutdown_cb(uv_shutdown_t* req, int status); +static void close_cb(uv_handle_t* handle); + + +static void connection_cb(uv_stream_t* stream, int status) { + conn_rec* conn; + int r; + + ASSERT(status == 0); + ASSERT(stream == (uv_stream_t*)&tcp_server); + + conn = malloc(sizeof *conn); + ASSERT(conn != NULL); + + r = uv_tcp_init(stream->loop, &conn->handle); + ASSERT(r == 0); + + r = uv_accept(stream, (uv_stream_t*)&conn->handle); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*)&conn->handle, alloc_cb, read_cb); + ASSERT(r == 0); +} + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { + conn_rec* conn; + int r; + + if (nread >= 0) + return; + + ASSERT(nread == UV_EOF); + + conn = container_of(stream, conn_rec, handle); + + r = uv_shutdown(&conn->shutdown_req, stream, shutdown_cb); + ASSERT(r == 0); +} + + +static void shutdown_cb(uv_shutdown_t* req, int status) { + conn_rec* conn = container_of(req, conn_rec, shutdown_req); + uv_close((uv_handle_t*)&conn->handle, close_cb); +} + + +static void close_cb(uv_handle_t* handle) { + conn_rec* conn = container_of(handle, conn_rec, handle); + free(conn); +} + + +HELPER_IMPL(tcp4_blackhole_server) { + struct sockaddr_in addr; + uv_loop_t* loop; + int r; + + loop = uv_default_loop(); + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_init(loop, &tcp_server); + ASSERT(r == 0); + + r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&tcp_server, 128, connection_cb); + ASSERT(r == 0); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(0 && "Blackhole server dropped out of event loop."); + + return 0; +} diff --git a/3rdparty/libuv/test/dns-server.c b/3rdparty/libuv/test/dns-server.c new file mode 100644 index 00000000000..80052c70398 --- /dev/null +++ b/3rdparty/libuv/test/dns-server.c @@ -0,0 +1,340 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include +#include + + +typedef struct { + uv_write_t req; + uv_buf_t buf; +} write_req_t; + + +/* used to track multiple DNS requests received */ +typedef struct { + char* prevbuf_ptr; + int prevbuf_pos; + int prevbuf_rem; +} dnsstate; + + +/* modify handle to append dnsstate */ +typedef struct { + uv_tcp_t handle; + dnsstate state; +} dnshandle; + + +static uv_loop_t* loop; + + +static uv_tcp_t server; + + +static void after_write(uv_write_t* req, int status); +static void after_read(uv_stream_t*, ssize_t nread, const uv_buf_t* buf); +static void on_close(uv_handle_t* peer); +static void on_connection(uv_stream_t*, int status); + +#define WRITE_BUF_LEN (64*1024) +#define DNSREC_LEN (4) + +#define LEN_OFFSET 0 +#define QUERYID_OFFSET 2 + +static unsigned char DNSRsp[] = { + 0, 43, 0, 0, 0x81, 0x80, 0, 1, 0, 1, 0, 0, 0, 0 +}; + +static unsigned char qrecord[] = { + 5, 'e', 'c', 'h', 'o', 's', 3, 's', 'r', 'v', 0, 0, 1, 0, 1 +}; + +static unsigned char arecord[] = { + 0xc0, 0x0c, 0, 1, 0, 1, 0, 0, 5, 0xbd, 0, 4, 10, 0, 1, 1 +}; + + +static void after_write(uv_write_t* req, int status) { + write_req_t* wr; + + if (status) { + fprintf(stderr, "uv_write error: %s\n", uv_strerror(status)); + ASSERT(0); + } + + wr = (write_req_t*) req; + + /* Free the read/write buffer and the request */ + free(wr->buf.base); + free(wr); +} + + +static void after_shutdown(uv_shutdown_t* req, int status) { + uv_close((uv_handle_t*) req->handle, on_close); + free(req); +} + + +static void addrsp(write_req_t* wr, char* hdr) { + char * dnsrsp; + short int rsplen; + short int* reclen; + + rsplen = sizeof(DNSRsp) + sizeof(qrecord) + sizeof(arecord); + + ASSERT (rsplen + wr->buf.len < WRITE_BUF_LEN); + + dnsrsp = wr->buf.base + wr->buf.len; + + /* copy stock response */ + memcpy(dnsrsp, DNSRsp, sizeof(DNSRsp)); + memcpy(dnsrsp + sizeof(DNSRsp), qrecord, sizeof(qrecord)); + memcpy(dnsrsp + sizeof(DNSRsp) + sizeof(qrecord), arecord, sizeof(arecord)); + + /* overwrite with network order length and id from request header */ + reclen = (short int*)dnsrsp; + *reclen = htons(rsplen-2); + dnsrsp[QUERYID_OFFSET] = hdr[QUERYID_OFFSET]; + dnsrsp[QUERYID_OFFSET+1] = hdr[QUERYID_OFFSET+1]; + + wr->buf.len += rsplen; +} + +static void process_req(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + write_req_t* wr; + dnshandle* dns = (dnshandle*)handle; + char hdrbuf[DNSREC_LEN]; + int hdrbuf_remaining = DNSREC_LEN; + int rec_remaining = 0; + int readbuf_remaining; + char* dnsreq; + char* hdrstart; + int usingprev = 0; + + wr = (write_req_t*) malloc(sizeof *wr); + wr->buf.base = (char*)malloc(WRITE_BUF_LEN); + wr->buf.len = 0; + + if (dns->state.prevbuf_ptr != NULL) { + dnsreq = dns->state.prevbuf_ptr + dns->state.prevbuf_pos; + readbuf_remaining = dns->state.prevbuf_rem; + usingprev = 1; + } else { + dnsreq = buf->base; + readbuf_remaining = nread; + } + hdrstart = dnsreq; + + while (dnsreq != NULL) { + /* something to process */ + while (readbuf_remaining > 0) { + /* something to process in current buffer */ + if (hdrbuf_remaining > 0) { + /* process len and id */ + if (readbuf_remaining < hdrbuf_remaining) { + /* too little to get request header. save for next buffer */ + memcpy(&hdrbuf[DNSREC_LEN - hdrbuf_remaining], + dnsreq, + readbuf_remaining); + hdrbuf_remaining = DNSREC_LEN - readbuf_remaining; + break; + } else { + /* save header */ + memcpy(&hdrbuf[DNSREC_LEN - hdrbuf_remaining], + dnsreq, + hdrbuf_remaining); + dnsreq += hdrbuf_remaining; + readbuf_remaining -= hdrbuf_remaining; + hdrbuf_remaining = 0; + + /* get record length */ + rec_remaining = (unsigned) hdrbuf[0] * 256 + (unsigned) hdrbuf[1]; + rec_remaining -= (DNSREC_LEN - 2); + } + } + + if (rec_remaining <= readbuf_remaining) { + /* prepare reply */ + addrsp(wr, hdrbuf); + + /* move to next record */ + dnsreq += rec_remaining; + hdrstart = dnsreq; + readbuf_remaining -= rec_remaining; + rec_remaining = 0; + hdrbuf_remaining = DNSREC_LEN; + } else { + /* otherwise this buffer is done. */ + rec_remaining -= readbuf_remaining; + break; + } + } + + /* If we had to use bytes from prev buffer, start processing the current + * one. + */ + if (usingprev == 1) { + /* free previous buffer */ + free(dns->state.prevbuf_ptr); + dnsreq = buf->base; + readbuf_remaining = nread; + usingprev = 0; + } else { + dnsreq = NULL; + } + } + + /* send write buffer */ + if (wr->buf.len > 0) { + if (uv_write((uv_write_t*) &wr->req, handle, &wr->buf, 1, after_write)) { + FATAL("uv_write failed"); + } + } + + if (readbuf_remaining > 0) { + /* save start of record position, so we can continue on next read */ + dns->state.prevbuf_ptr = buf->base; + dns->state.prevbuf_pos = hdrstart - buf->base; + dns->state.prevbuf_rem = nread - dns->state.prevbuf_pos; + } else { + /* nothing left in this buffer */ + dns->state.prevbuf_ptr = NULL; + dns->state.prevbuf_pos = 0; + dns->state.prevbuf_rem = 0; + free(buf->base); + } +} + +static void after_read(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + uv_shutdown_t* req; + + if (nread < 0) { + /* Error or EOF */ + ASSERT(nread == UV_EOF); + + if (buf->base) { + free(buf->base); + } + + req = malloc(sizeof *req); + uv_shutdown(req, handle, after_shutdown); + + return; + } + + if (nread == 0) { + /* Everything OK, but nothing read. */ + free(buf->base); + return; + } + /* process requests and send responses */ + process_req(handle, nread, buf); +} + + +static void on_close(uv_handle_t* peer) { + free(peer); +} + + +static void buf_alloc(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + buf->base = malloc(suggested_size); + buf->len = suggested_size; +} + + +static void on_connection(uv_stream_t* server, int status) { + dnshandle* handle; + int r; + + ASSERT(status == 0); + + handle = (dnshandle*) malloc(sizeof *handle); + ASSERT(handle != NULL); + + /* initialize read buffer state */ + handle->state.prevbuf_ptr = 0; + handle->state.prevbuf_pos = 0; + handle->state.prevbuf_rem = 0; + + r = uv_tcp_init(loop, (uv_tcp_t*)handle); + ASSERT(r == 0); + + r = uv_accept(server, (uv_stream_t*)handle); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*)handle, buf_alloc, after_read); + ASSERT(r == 0); +} + + +static int dns_start(int port) { + struct sockaddr_in addr; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", port, &addr)); + + r = uv_tcp_init(loop, &server); + if (r) { + /* TODO: Error codes */ + fprintf(stderr, "Socket creation error\n"); + return 1; + } + + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); + if (r) { + /* TODO: Error codes */ + fprintf(stderr, "Bind error\n"); + return 1; + } + + r = uv_listen((uv_stream_t*)&server, 128, on_connection); + if (r) { + /* TODO: Error codes */ + fprintf(stderr, "Listen error\n"); + return 1; + } + + return 0; +} + + +HELPER_IMPL(dns_server) { + loop = uv_default_loop(); + + if (dns_start(TEST_PORT_2)) + return 1; + + uv_run(loop, UV_RUN_DEFAULT); + return 0; +} diff --git a/3rdparty/libuv/test/echo-server.c b/3rdparty/libuv/test/echo-server.c new file mode 100644 index 00000000000..bfed67675dd --- /dev/null +++ b/3rdparty/libuv/test/echo-server.c @@ -0,0 +1,378 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + +typedef struct { + uv_write_t req; + uv_buf_t buf; +} write_req_t; + +static uv_loop_t* loop; + +static int server_closed; +static stream_type serverType; +static uv_tcp_t tcpServer; +static uv_udp_t udpServer; +static uv_pipe_t pipeServer; +static uv_handle_t* server; + +static void after_write(uv_write_t* req, int status); +static void after_read(uv_stream_t*, ssize_t nread, const uv_buf_t* buf); +static void on_close(uv_handle_t* peer); +static void on_server_close(uv_handle_t* handle); +static void on_connection(uv_stream_t*, int status); + + +static void after_write(uv_write_t* req, int status) { + write_req_t* wr; + + /* Free the read/write buffer and the request */ + wr = (write_req_t*) req; + free(wr->buf.base); + free(wr); + + if (status == 0) + return; + + fprintf(stderr, + "uv_write error: %s - %s\n", + uv_err_name(status), + uv_strerror(status)); +} + + +static void after_shutdown(uv_shutdown_t* req, int status) { + uv_close((uv_handle_t*) req->handle, on_close); + free(req); +} + + +static void after_read(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + int i; + write_req_t *wr; + uv_shutdown_t* sreq; + + if (nread < 0) { + /* Error or EOF */ + ASSERT(nread == UV_EOF); + + free(buf->base); + sreq = malloc(sizeof* sreq); + ASSERT(0 == uv_shutdown(sreq, handle, after_shutdown)); + return; + } + + if (nread == 0) { + /* Everything OK, but nothing read. */ + free(buf->base); + return; + } + + /* + * Scan for the letter Q which signals that we should quit the server. + * If we get QS it means close the stream. + */ + if (!server_closed) { + for (i = 0; i < nread; i++) { + if (buf->base[i] == 'Q') { + if (i + 1 < nread && buf->base[i + 1] == 'S') { + free(buf->base); + uv_close((uv_handle_t*)handle, on_close); + return; + } else { + uv_close(server, on_server_close); + server_closed = 1; + } + } + } + } + + wr = (write_req_t*) malloc(sizeof *wr); + ASSERT(wr != NULL); + wr->buf = uv_buf_init(buf->base, nread); + + if (uv_write(&wr->req, handle, &wr->buf, 1, after_write)) { + FATAL("uv_write failed"); + } +} + + +static void on_close(uv_handle_t* peer) { + free(peer); +} + + +static void echo_alloc(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + buf->base = malloc(suggested_size); + buf->len = suggested_size; +} + + +static void on_connection(uv_stream_t* server, int status) { + uv_stream_t* stream; + int r; + + if (status != 0) { + fprintf(stderr, "Connect error %s\n", uv_err_name(status)); + } + ASSERT(status == 0); + + switch (serverType) { + case TCP: + stream = malloc(sizeof(uv_tcp_t)); + ASSERT(stream != NULL); + r = uv_tcp_init(loop, (uv_tcp_t*)stream); + ASSERT(r == 0); + break; + + case PIPE: + stream = malloc(sizeof(uv_pipe_t)); + ASSERT(stream != NULL); + r = uv_pipe_init(loop, (uv_pipe_t*)stream, 0); + ASSERT(r == 0); + break; + + default: + ASSERT(0 && "Bad serverType"); + abort(); + } + + /* associate server with stream */ + stream->data = server; + + r = uv_accept(server, stream); + ASSERT(r == 0); + + r = uv_read_start(stream, echo_alloc, after_read); + ASSERT(r == 0); +} + + +static void on_server_close(uv_handle_t* handle) { + ASSERT(handle == server); +} + + +static void on_send(uv_udp_send_t* req, int status); + + +static void on_recv(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* rcvbuf, + const struct sockaddr* addr, + unsigned flags) { + uv_udp_send_t* req; + uv_buf_t sndbuf; + + ASSERT(nread > 0); + ASSERT(addr->sa_family == AF_INET); + + req = malloc(sizeof(*req)); + ASSERT(req != NULL); + + sndbuf = *rcvbuf; + ASSERT(0 == uv_udp_send(req, handle, &sndbuf, 1, addr, on_send)); +} + + +static void on_send(uv_udp_send_t* req, int status) { + ASSERT(status == 0); + free(req); +} + + +static int tcp4_echo_start(int port) { + struct sockaddr_in addr; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", port, &addr)); + + server = (uv_handle_t*)&tcpServer; + serverType = TCP; + + r = uv_tcp_init(loop, &tcpServer); + if (r) { + /* TODO: Error codes */ + fprintf(stderr, "Socket creation error\n"); + return 1; + } + + r = uv_tcp_bind(&tcpServer, (const struct sockaddr*) &addr, 0); + if (r) { + /* TODO: Error codes */ + fprintf(stderr, "Bind error\n"); + return 1; + } + + r = uv_listen((uv_stream_t*)&tcpServer, SOMAXCONN, on_connection); + if (r) { + /* TODO: Error codes */ + fprintf(stderr, "Listen error %s\n", uv_err_name(r)); + return 1; + } + + return 0; +} + + +static int tcp6_echo_start(int port) { + struct sockaddr_in6 addr6; + int r; + + ASSERT(0 == uv_ip6_addr("::1", port, &addr6)); + + server = (uv_handle_t*)&tcpServer; + serverType = TCP; + + r = uv_tcp_init(loop, &tcpServer); + if (r) { + /* TODO: Error codes */ + fprintf(stderr, "Socket creation error\n"); + return 1; + } + + /* IPv6 is optional as not all platforms support it */ + r = uv_tcp_bind(&tcpServer, (const struct sockaddr*) &addr6, 0); + if (r) { + /* show message but return OK */ + fprintf(stderr, "IPv6 not supported\n"); + return 0; + } + + r = uv_listen((uv_stream_t*)&tcpServer, SOMAXCONN, on_connection); + if (r) { + /* TODO: Error codes */ + fprintf(stderr, "Listen error\n"); + return 1; + } + + return 0; +} + + +static int udp4_echo_start(int port) { + int r; + + server = (uv_handle_t*)&udpServer; + serverType = UDP; + + r = uv_udp_init(loop, &udpServer); + if (r) { + fprintf(stderr, "uv_udp_init: %s\n", uv_strerror(r)); + return 1; + } + + r = uv_udp_recv_start(&udpServer, echo_alloc, on_recv); + if (r) { + fprintf(stderr, "uv_udp_recv_start: %s\n", uv_strerror(r)); + return 1; + } + + return 0; +} + + +static int pipe_echo_start(char* pipeName) { + int r; + +#ifndef _WIN32 + { + uv_fs_t req; + uv_fs_unlink(NULL, &req, pipeName, NULL); + uv_fs_req_cleanup(&req); + } +#endif + + server = (uv_handle_t*)&pipeServer; + serverType = PIPE; + + r = uv_pipe_init(loop, &pipeServer, 0); + if (r) { + fprintf(stderr, "uv_pipe_init: %s\n", uv_strerror(r)); + return 1; + } + + r = uv_pipe_bind(&pipeServer, pipeName); + if (r) { + fprintf(stderr, "uv_pipe_bind: %s\n", uv_strerror(r)); + return 1; + } + + r = uv_listen((uv_stream_t*)&pipeServer, SOMAXCONN, on_connection); + if (r) { + fprintf(stderr, "uv_pipe_listen: %s\n", uv_strerror(r)); + return 1; + } + + return 0; +} + + +HELPER_IMPL(tcp4_echo_server) { + loop = uv_default_loop(); + + if (tcp4_echo_start(TEST_PORT)) + return 1; + + uv_run(loop, UV_RUN_DEFAULT); + return 0; +} + + +HELPER_IMPL(tcp6_echo_server) { + loop = uv_default_loop(); + + if (tcp6_echo_start(TEST_PORT)) + return 1; + + uv_run(loop, UV_RUN_DEFAULT); + return 0; +} + + +HELPER_IMPL(pipe_echo_server) { + loop = uv_default_loop(); + + if (pipe_echo_start(TEST_PIPENAME)) + return 1; + + uv_run(loop, UV_RUN_DEFAULT); + return 0; +} + + +HELPER_IMPL(udp4_echo_server) { + loop = uv_default_loop(); + + if (udp4_echo_start(TEST_PORT)) + return 1; + + uv_run(loop, UV_RUN_DEFAULT); + return 0; +} diff --git a/3rdparty/libuv/test/fixtures/empty_file b/3rdparty/libuv/test/fixtures/empty_file new file mode 100644 index 00000000000..e69de29bb2d diff --git a/3rdparty/libuv/test/fixtures/load_error.node b/3rdparty/libuv/test/fixtures/load_error.node new file mode 100644 index 00000000000..323fae03f46 --- /dev/null +++ b/3rdparty/libuv/test/fixtures/load_error.node @@ -0,0 +1 @@ +foobar diff --git a/3rdparty/libuv/test/run-benchmarks.c b/3rdparty/libuv/test/run-benchmarks.c new file mode 100644 index 00000000000..6e42623d54c --- /dev/null +++ b/3rdparty/libuv/test/run-benchmarks.c @@ -0,0 +1,65 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include + +#include "runner.h" +#include "task.h" + +/* Actual benchmarks and helpers are defined in benchmark-list.h */ +#include "benchmark-list.h" + + +static int maybe_run_test(int argc, char **argv); + + +int main(int argc, char **argv) { + if (platform_init(argc, argv)) + return EXIT_FAILURE; + + switch (argc) { + case 1: return run_tests(1); + case 2: return maybe_run_test(argc, argv); + case 3: return run_test_part(argv[1], argv[2]); + default: + fprintf(stderr, "Too many arguments.\n"); + fflush(stderr); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + + +static int maybe_run_test(int argc, char **argv) { + if (strcmp(argv[1], "--list") == 0) { + print_tests(stdout); + return 0; + } + + if (strcmp(argv[1], "spawn_helper") == 0) { + printf("hello world\n"); + return 42; + } + + return run_test(argv[1], 1, 1); +} diff --git a/3rdparty/libuv/test/run-tests.c b/3rdparty/libuv/test/run-tests.c new file mode 100644 index 00000000000..b4be01f6f95 --- /dev/null +++ b/3rdparty/libuv/test/run-tests.c @@ -0,0 +1,181 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include + +#ifdef _WIN32 +# include +#else +# include +#endif + +#include "uv.h" +#include "runner.h" +#include "task.h" + +/* Actual tests and helpers are defined in test-list.h */ +#include "test-list.h" + +int ipc_helper(int listen_after_write); +int ipc_helper_tcp_connection(void); +int ipc_send_recv_helper(void); +int ipc_helper_bind_twice(void); +int stdio_over_pipes_helper(void); +int spawn_stdin_stdout(void); + +static int maybe_run_test(int argc, char **argv); + + +int main(int argc, char **argv) { + if (platform_init(argc, argv)) + return EXIT_FAILURE; + + argv = uv_setup_args(argc, argv); + + switch (argc) { + case 1: return run_tests(0); + case 2: return maybe_run_test(argc, argv); + case 3: return run_test_part(argv[1], argv[2]); + default: + fprintf(stderr, "Too many arguments.\n"); + fflush(stderr); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + + +static int maybe_run_test(int argc, char **argv) { + if (strcmp(argv[1], "--list") == 0) { + print_tests(stdout); + return 0; + } + + if (strcmp(argv[1], "ipc_helper_listen_before_write") == 0) { + return ipc_helper(0); + } + + if (strcmp(argv[1], "ipc_helper_listen_after_write") == 0) { + return ipc_helper(1); + } + + if (strcmp(argv[1], "ipc_send_recv_helper") == 0) { + return ipc_send_recv_helper(); + } + + if (strcmp(argv[1], "ipc_helper_tcp_connection") == 0) { + return ipc_helper_tcp_connection(); + } + + if (strcmp(argv[1], "ipc_helper_bind_twice") == 0) { + return ipc_helper_bind_twice(); + } + + if (strcmp(argv[1], "stdio_over_pipes_helper") == 0) { + return stdio_over_pipes_helper(); + } + + if (strcmp(argv[1], "spawn_helper1") == 0) { + return 1; + } + + if (strcmp(argv[1], "spawn_helper2") == 0) { + printf("hello world\n"); + return 1; + } + + if (strcmp(argv[1], "spawn_helper3") == 0) { + char buffer[256]; + ASSERT(buffer == fgets(buffer, sizeof(buffer) - 1, stdin)); + buffer[sizeof(buffer) - 1] = '\0'; + fputs(buffer, stdout); + return 1; + } + + if (strcmp(argv[1], "spawn_helper4") == 0) { + /* Never surrender, never return! */ + while (1) uv_sleep(10000); + } + + if (strcmp(argv[1], "spawn_helper5") == 0) { + const char out[] = "fourth stdio!\n"; +#ifdef _WIN32 + DWORD bytes; + WriteFile((HANDLE) _get_osfhandle(3), out, sizeof(out) - 1, &bytes, NULL); +#else + { + ssize_t r; + + do + r = write(3, out, sizeof(out) - 1); + while (r == -1 && errno == EINTR); + + fsync(3); + } +#endif + return 1; + } + + if (strcmp(argv[1], "spawn_helper6") == 0) { + int r; + + r = fprintf(stdout, "hello world\n"); + ASSERT(r > 0); + + r = fprintf(stderr, "hello errworld\n"); + ASSERT(r > 0); + + return 1; + } + + if (strcmp(argv[1], "spawn_helper7") == 0) { + int r; + char *test; + /* Test if the test value from the parent is still set */ + test = getenv("ENV_TEST"); + ASSERT(test != NULL); + + r = fprintf(stdout, "%s", test); + ASSERT(r > 0); + + return 1; + } + +#ifndef _WIN32 + if (strcmp(argv[1], "spawn_helper8") == 0) { + int fd; + ASSERT(sizeof(fd) == read(0, &fd, sizeof(fd))); + ASSERT(fd > 2); + ASSERT(-1 == write(fd, "x", 1)); + + return 1; + } +#endif /* !_WIN32 */ + + if (strcmp(argv[1], "spawn_helper9") == 0) { + return spawn_stdin_stdout(); + } + + return run_test(argv[1], 0, 1); +} diff --git a/3rdparty/libuv/test/runner-unix.c b/3rdparty/libuv/test/runner-unix.c new file mode 100644 index 00000000000..2264d1e89d5 --- /dev/null +++ b/3rdparty/libuv/test/runner-unix.c @@ -0,0 +1,400 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "runner-unix.h" +#include "runner.h" + +#include +#include /* uintptr_t */ + +#include +#include /* readlink, usleep */ +#include /* strdup */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +/* Do platform-specific initialization. */ +int platform_init(int argc, char **argv) { + const char* tap; + + tap = getenv("UV_TAP_OUTPUT"); + tap_output = (tap != NULL && atoi(tap) > 0); + + /* Disable stdio output buffering. */ + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + signal(SIGPIPE, SIG_IGN); + + if (realpath(argv[0], executable_path) == NULL) { + perror("realpath"); + return -1; + } + + return 0; +} + + +/* Invoke "argv[0] test-name [test-part]". Store process info in *p. */ +/* Make sure that all stdio output of the processes is buffered up. */ +int process_start(char* name, char* part, process_info_t* p, int is_helper) { + FILE* stdout_file; + const char* arg; + char* args[16]; + int n; + pid_t pid; + + stdout_file = tmpfile(); + if (!stdout_file) { + perror("tmpfile"); + return -1; + } + + p->terminated = 0; + p->status = 0; + + pid = fork(); + + if (pid < 0) { + perror("fork"); + return -1; + } + + if (pid == 0) { + /* child */ + arg = getenv("UV_USE_VALGRIND"); + n = 0; + + /* Disable valgrind for helpers, it complains about helpers leaking memory. + * They're killed after the test and as such never get a chance to clean up. + */ + if (is_helper == 0 && arg != NULL && atoi(arg) != 0) { + args[n++] = "valgrind"; + args[n++] = "--quiet"; + args[n++] = "--leak-check=full"; + args[n++] = "--show-reachable=yes"; + args[n++] = "--error-exitcode=125"; + } + + args[n++] = executable_path; + args[n++] = name; + args[n++] = part; + args[n++] = NULL; + + dup2(fileno(stdout_file), STDOUT_FILENO); + dup2(fileno(stdout_file), STDERR_FILENO); + execvp(args[0], args); + perror("execvp()"); + _exit(127); + } + + /* parent */ + p->pid = pid; + p->name = strdup(name); + p->stdout_file = stdout_file; + + return 0; +} + + +typedef struct { + int pipe[2]; + process_info_t* vec; + int n; +} dowait_args; + + +/* This function is run inside a pthread. We do this so that we can possibly + * timeout. + */ +static void* dowait(void* data) { + dowait_args* args = data; + + int i, r; + process_info_t* p; + + for (i = 0; i < args->n; i++) { + p = (process_info_t*)(args->vec + i * sizeof(process_info_t)); + if (p->terminated) continue; + r = waitpid(p->pid, &p->status, 0); + if (r < 0) { + perror("waitpid"); + return NULL; + } + p->terminated = 1; + } + + if (args->pipe[1] >= 0) { + /* Write a character to the main thread to notify it about this. */ + ssize_t r; + + do + r = write(args->pipe[1], "", 1); + while (r == -1 && errno == EINTR); + } + + return NULL; +} + + +/* Wait for all `n` processes in `vec` to terminate. */ +/* Time out after `timeout` msec, or never if timeout == -1 */ +/* Return 0 if all processes are terminated, -1 on error, -2 on timeout. */ +int process_wait(process_info_t* vec, int n, int timeout) { + int i; + int r; + int retval; + process_info_t* p; + dowait_args args; + pthread_t tid; + pthread_attr_t attr; + unsigned int elapsed_ms; + struct timeval timebase; + struct timeval tv; + fd_set fds; + + args.vec = vec; + args.n = n; + args.pipe[0] = -1; + args.pipe[1] = -1; + + /* The simple case is where there is no timeout */ + if (timeout == -1) { + dowait(&args); + return 0; + } + + /* Hard case. Do the wait with a timeout. + * + * Assumption: we are the only ones making this call right now. Otherwise + * we'd need to lock vec. + */ + + r = pipe((int*)&(args.pipe)); + if (r) { + perror("pipe()"); + return -1; + } + + if (pthread_attr_init(&attr)) + abort(); + + if (pthread_attr_setstacksize(&attr, 256 * 1024)) + abort(); + + r = pthread_create(&tid, &attr, dowait, &args); + + if (pthread_attr_destroy(&attr)) + abort(); + + if (r) { + perror("pthread_create()"); + retval = -1; + goto terminate; + } + + if (gettimeofday(&timebase, NULL)) + abort(); + + tv = timebase; + for (;;) { + /* Check that gettimeofday() doesn't jump back in time. */ + assert(tv.tv_sec == timebase.tv_sec || + (tv.tv_sec == timebase.tv_sec && tv.tv_usec >= timebase.tv_usec)); + + elapsed_ms = + (tv.tv_sec - timebase.tv_sec) * 1000 + + (tv.tv_usec / 1000) - + (timebase.tv_usec / 1000); + + r = 0; /* Timeout. */ + if (elapsed_ms >= (unsigned) timeout) + break; + + tv.tv_sec = (timeout - elapsed_ms) / 1000; + tv.tv_usec = (timeout - elapsed_ms) % 1000 * 1000; + + FD_ZERO(&fds); + FD_SET(args.pipe[0], &fds); + + r = select(args.pipe[0] + 1, &fds, NULL, NULL, &tv); + if (!(r == -1 && errno == EINTR)) + break; + + if (gettimeofday(&tv, NULL)) + abort(); + } + + if (r == -1) { + perror("select()"); + retval = -1; + + } else if (r) { + /* The thread completed successfully. */ + retval = 0; + + } else { + /* Timeout. Kill all the children. */ + for (i = 0; i < n; i++) { + p = (process_info_t*)(vec + i * sizeof(process_info_t)); + kill(p->pid, SIGTERM); + } + retval = -2; + } + + if (pthread_join(tid, NULL)) + abort(); + +terminate: + close(args.pipe[0]); + close(args.pipe[1]); + return retval; +} + + +/* Returns the number of bytes in the stdio output buffer for process `p`. */ +long int process_output_size(process_info_t *p) { + /* Size of the p->stdout_file */ + struct stat buf; + + int r = fstat(fileno(p->stdout_file), &buf); + if (r < 0) { + return -1; + } + + return (long)buf.st_size; +} + + +/* Copy the contents of the stdio output buffer to `fd`. */ +int process_copy_output(process_info_t *p, int fd) { + ssize_t nwritten; + char buf[1024]; + int r; + + r = fseek(p->stdout_file, 0, SEEK_SET); + if (r < 0) { + perror("fseek"); + return -1; + } + + /* TODO: what if the line is longer than buf */ + while (fgets(buf, sizeof(buf), p->stdout_file) != NULL) { + /* TODO: what if write doesn't write the whole buffer... */ + nwritten = 0; + + if (tap_output) + nwritten += write(fd, "#", 1); + + nwritten += write(fd, buf, strlen(buf)); + + if (nwritten < 0) { + perror("write"); + return -1; + } + } + + if (ferror(p->stdout_file)) { + perror("read"); + return -1; + } + + return 0; +} + + +/* Copy the last line of the stdio output buffer to `buffer` */ +int process_read_last_line(process_info_t *p, + char* buffer, + size_t buffer_len) { + char* ptr; + + int r = fseek(p->stdout_file, 0, SEEK_SET); + if (r < 0) { + perror("fseek"); + return -1; + } + + buffer[0] = '\0'; + + while (fgets(buffer, buffer_len, p->stdout_file) != NULL) { + for (ptr = buffer; *ptr && *ptr != '\r' && *ptr != '\n'; ptr++); + *ptr = '\0'; + } + + if (ferror(p->stdout_file)) { + perror("read"); + buffer[0] = '\0'; + return -1; + } + return 0; +} + + +/* Return the name that was specified when `p` was started by process_start */ +char* process_get_name(process_info_t *p) { + return p->name; +} + + +/* Terminate process `p`. */ +int process_terminate(process_info_t *p) { + return kill(p->pid, SIGTERM); +} + + +/* Return the exit code of process p. */ +/* On error, return -1. */ +int process_reap(process_info_t *p) { + if (WIFEXITED(p->status)) { + return WEXITSTATUS(p->status); + } else { + return p->status; /* ? */ + } +} + + +/* Clean up after terminating process `p` (e.g. free the output buffer etc.). */ +void process_cleanup(process_info_t *p) { + fclose(p->stdout_file); + free(p->name); +} + + +/* Move the console cursor one line up and back to the first column. */ +void rewind_cursor(void) { + fprintf(stderr, "\033[2K\r"); +} + + +/* Pause the calling thread for a number of milliseconds. */ +void uv_sleep(int msec) { + usleep(msec * 1000); +} diff --git a/3rdparty/libuv/test/runner-unix.h b/3rdparty/libuv/test/runner-unix.h new file mode 100644 index 00000000000..e21847f92c0 --- /dev/null +++ b/3rdparty/libuv/test/runner-unix.h @@ -0,0 +1,36 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef TEST_RUNNER_UNIX_H +#define TEST_RUNNER_UNIX_H + +#include +#include /* FILE */ + +typedef struct { + FILE* stdout_file; + pid_t pid; + char* name; + int status; + int terminated; +} process_info_t; + +#endif /* TEST_RUNNER_UNIX_H */ diff --git a/3rdparty/libuv/test/runner-win.c b/3rdparty/libuv/test/runner-win.c new file mode 100644 index 00000000000..97ef7599eb8 --- /dev/null +++ b/3rdparty/libuv/test/runner-win.c @@ -0,0 +1,371 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#if !defined(__MINGW32__) +# include +#endif + + +#include "task.h" +#include "runner.h" + + +/* + * Define the stuff that MinGW doesn't have + */ +#ifndef GetFileSizeEx + WINBASEAPI BOOL WINAPI GetFileSizeEx(HANDLE hFile, + PLARGE_INTEGER lpFileSize); +#endif + + +/* Do platform-specific initialization. */ +int platform_init(int argc, char **argv) { + const char* tap; + + tap = getenv("UV_TAP_OUTPUT"); + tap_output = (tap != NULL && atoi(tap) > 0); + + /* Disable the "application crashed" popup. */ + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | + SEM_NOOPENFILEERRORBOX); +#if !defined(__MINGW32__) + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG); +#endif + + _setmode(0, _O_BINARY); + _setmode(1, _O_BINARY); + _setmode(2, _O_BINARY); + + /* Disable stdio output buffering. */ + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + + strcpy(executable_path, argv[0]); + + return 0; +} + + +int process_start(char *name, char *part, process_info_t *p, int is_helper) { + HANDLE file = INVALID_HANDLE_VALUE; + HANDLE nul = INVALID_HANDLE_VALUE; + WCHAR path[MAX_PATH], filename[MAX_PATH]; + WCHAR image[MAX_PATH + 1]; + WCHAR args[MAX_PATH * 2]; + STARTUPINFOW si; + PROCESS_INFORMATION pi; + DWORD result; + + if (GetTempPathW(sizeof(path) / sizeof(WCHAR), (WCHAR*)&path) == 0) + goto error; + if (GetTempFileNameW((WCHAR*)&path, L"uv", 0, (WCHAR*)&filename) == 0) + goto error; + + file = CreateFileW((WCHAR*)filename, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, + NULL); + if (file == INVALID_HANDLE_VALUE) + goto error; + + if (!SetHandleInformation(file, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) + goto error; + + nul = CreateFileA("nul", + GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + if (nul == INVALID_HANDLE_VALUE) + goto error; + + if (!SetHandleInformation(nul, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) + goto error; + + result = GetModuleFileNameW(NULL, + (WCHAR*) &image, + sizeof(image) / sizeof(WCHAR)); + if (result == 0 || result == sizeof(image)) + goto error; + + if (part) { + if (_snwprintf((WCHAR*)args, + sizeof(args) / sizeof(WCHAR), + L"\"%s\" %S %S", + image, + name, + part) < 0) { + goto error; + } + } else { + if (_snwprintf((WCHAR*)args, + sizeof(args) / sizeof(WCHAR), + L"\"%s\" %S", + image, + name) < 0) { + goto error; + } + } + + memset((void*)&si, 0, sizeof(si)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdInput = nul; + si.hStdOutput = file; + si.hStdError = file; + + if (!CreateProcessW(image, args, NULL, NULL, TRUE, + 0, NULL, NULL, &si, &pi)) + goto error; + + CloseHandle(pi.hThread); + + SetHandleInformation(nul, HANDLE_FLAG_INHERIT, 0); + SetHandleInformation(file, HANDLE_FLAG_INHERIT, 0); + + p->stdio_in = nul; + p->stdio_out = file; + p->process = pi.hProcess; + p->name = part; + + return 0; + +error: + if (file != INVALID_HANDLE_VALUE) + CloseHandle(file); + if (nul != INVALID_HANDLE_VALUE) + CloseHandle(nul); + + return -1; +} + + +/* Timeout is is msecs. Set timeout < 0 to never time out. */ +/* Returns 0 when all processes are terminated, -2 on timeout. */ +int process_wait(process_info_t *vec, int n, int timeout) { + int i; + HANDLE handles[MAXIMUM_WAIT_OBJECTS]; + DWORD timeout_api, result; + + /* If there's nothing to wait for, return immediately. */ + if (n == 0) + return 0; + + ASSERT(n <= MAXIMUM_WAIT_OBJECTS); + + for (i = 0; i < n; i++) + handles[i] = vec[i].process; + + if (timeout >= 0) { + timeout_api = (DWORD)timeout; + } else { + timeout_api = INFINITE; + } + + result = WaitForMultipleObjects(n, handles, TRUE, timeout_api); + + if (result >= WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + n) { + /* All processes are terminated. */ + return 0; + } + if (result == WAIT_TIMEOUT) { + return -2; + } + return -1; +} + + +long int process_output_size(process_info_t *p) { + LARGE_INTEGER size; + if (!GetFileSizeEx(p->stdio_out, &size)) + return -1; + return (long int)size.QuadPart; +} + + +int process_copy_output(process_info_t *p, int fd) { + DWORD read; + char buf[1024]; + char *line, *start; + + if (SetFilePointer(p->stdio_out, + 0, + 0, + FILE_BEGIN) == INVALID_SET_FILE_POINTER) { + return -1; + } + + if (tap_output) + write(fd, "#", 1); + + while (ReadFile(p->stdio_out, (void*)&buf, sizeof(buf), &read, NULL) && + read > 0) { + if (tap_output) { + start = buf; + + while ((line = strchr(start, '\n')) != NULL) { + write(fd, start, line - start + 1); + write(fd, "#", 1); + start = line + 1; + } + + if (start < buf + read) + write(fd, start, buf + read - start); + } else { + write(fd, buf, read); + } + } + + if (tap_output) + write(fd, "\n", 1); + + if (GetLastError() != ERROR_HANDLE_EOF) + return -1; + + return 0; +} + + +int process_read_last_line(process_info_t *p, + char * buffer, + size_t buffer_len) { + DWORD size; + DWORD read; + DWORD start; + OVERLAPPED overlapped; + + ASSERT(buffer_len > 0); + + size = GetFileSize(p->stdio_out, NULL); + if (size == INVALID_FILE_SIZE) + return -1; + + if (size == 0) { + buffer[0] = '\0'; + return 1; + } + + memset(&overlapped, 0, sizeof overlapped); + if (size >= buffer_len) + overlapped.Offset = size - buffer_len - 1; + + if (!ReadFile(p->stdio_out, buffer, buffer_len - 1, &read, &overlapped)) + return -1; + + for (start = read - 1; start >= 0; start--) { + if (buffer[start] == '\n' || buffer[start] == '\r') + break; + } + + if (start > 0) + memmove(buffer, buffer + start, read - start); + + buffer[read - start] = '\0'; + + return 0; +} + + +char* process_get_name(process_info_t *p) { + return p->name; +} + + +int process_terminate(process_info_t *p) { + if (!TerminateProcess(p->process, 1)) + return -1; + return 0; +} + + +int process_reap(process_info_t *p) { + DWORD exitCode; + if (!GetExitCodeProcess(p->process, &exitCode)) + return -1; + return (int)exitCode; +} + + +void process_cleanup(process_info_t *p) { + CloseHandle(p->process); + CloseHandle(p->stdio_in); + CloseHandle(p->stdio_out); +} + + +static int clear_line() { + HANDLE handle; + CONSOLE_SCREEN_BUFFER_INFO info; + COORD coord; + DWORD written; + + handle = (HANDLE)_get_osfhandle(fileno(stderr)); + if (handle == INVALID_HANDLE_VALUE) + return -1; + + if (!GetConsoleScreenBufferInfo(handle, &info)) + return -1; + + coord = info.dwCursorPosition; + if (coord.Y <= 0) + return -1; + + coord.X = 0; + + if (!SetConsoleCursorPosition(handle, coord)) + return -1; + + if (!FillConsoleOutputCharacterW(handle, + 0x20, + info.dwSize.X, + coord, + &written)) { + return -1; + } + + return 0; +} + + +void rewind_cursor() { + if (clear_line() == -1) { + /* If clear_line fails (stdout is not a console), print a newline. */ + fprintf(stderr, "\n"); + } +} + + +/* Pause the calling thread for a number of milliseconds. */ +void uv_sleep(int msec) { + Sleep(msec); +} diff --git a/3rdparty/libuv/test/runner-win.h b/3rdparty/libuv/test/runner-win.h new file mode 100644 index 00000000000..8cc4c16eb22 --- /dev/null +++ b/3rdparty/libuv/test/runner-win.h @@ -0,0 +1,39 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* Don't complain about write(), fileno() etc. being deprecated. */ +#pragma warning(disable : 4996) + + +#include +#include +#include + +#if !defined(snprintf) && defined(_MSC_VER) && _MSC_VER < 1900 +extern int snprintf(char*, size_t, const char*, ...); +#endif + +typedef struct { + HANDLE process; + HANDLE stdio_in; + HANDLE stdio_out; + char *name; +} process_info_t; diff --git a/3rdparty/libuv/test/runner.c b/3rdparty/libuv/test/runner.c new file mode 100644 index 00000000000..c616d176445 --- /dev/null +++ b/3rdparty/libuv/test/runner.c @@ -0,0 +1,466 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include + +#include "runner.h" +#include "task.h" +#include "uv.h" + +char executable_path[sizeof(executable_path)]; + +int tap_output = 0; + + +static void log_progress(int total, + int passed, + int failed, + int todos, + int skipped, + const char* name) { + int progress; + + if (total == 0) + total = 1; + + progress = 100 * (passed + failed + skipped + todos) / total; + fprintf(stderr, "[%% %3d|+ %3d|- %3d|T %3d|S %3d]: %s", + progress, + passed, + failed, + todos, + skipped, + name); + fflush(stderr); +} + + +const char* fmt(double d) { + static char buf[1024]; + static char* p; + uint64_t v; + + if (p == NULL) + p = buf; + + p += 31; + + if (p >= buf + sizeof(buf)) + return ""; + + v = (uint64_t) d; + +#if 0 /* works but we don't care about fractional precision */ + if (d - v >= 0.01) { + *--p = '0' + (uint64_t) (d * 100) % 10; + *--p = '0' + (uint64_t) (d * 10) % 10; + *--p = '.'; + } +#endif + + if (v == 0) + *--p = '0'; + + while (v) { + if (v) *--p = '0' + (v % 10), v /= 10; + if (v) *--p = '0' + (v % 10), v /= 10; + if (v) *--p = '0' + (v % 10), v /= 10; + if (v) *--p = ','; + } + + return p; +} + + +int run_tests(int benchmark_output) { + int total; + int passed; + int failed; + int todos; + int skipped; + int current; + int test_result; + task_entry_t* task; + + /* Count the number of tests. */ + total = 0; + for (task = TASKS; task->main; task++) { + if (!task->is_helper) { + total++; + } + } + + if (tap_output) { + fprintf(stderr, "1..%d\n", total); + fflush(stderr); + } + + /* Run all tests. */ + passed = 0; + failed = 0; + todos = 0; + skipped = 0; + current = 1; + for (task = TASKS; task->main; task++) { + if (task->is_helper) { + continue; + } + + if (!tap_output) + rewind_cursor(); + + if (!benchmark_output && !tap_output) { + log_progress(total, passed, failed, todos, skipped, task->task_name); + } + + test_result = run_test(task->task_name, benchmark_output, current); + switch (test_result) { + case TEST_OK: passed++; break; + case TEST_TODO: todos++; break; + case TEST_SKIP: skipped++; break; + default: failed++; + } + current++; + } + + if (!tap_output) + rewind_cursor(); + + if (!benchmark_output && !tap_output) { + log_progress(total, passed, failed, todos, skipped, "Done.\n"); + } + + return failed; +} + + +void log_tap_result(int test_count, + const char* test, + int status, + process_info_t* process) { + const char* result; + const char* directive; + char reason[1024]; + + switch (status) { + case TEST_OK: + result = "ok"; + directive = ""; + break; + case TEST_TODO: + result = "not ok"; + directive = " # TODO "; + break; + case TEST_SKIP: + result = "ok"; + directive = " # SKIP "; + break; + default: + result = "not ok"; + directive = ""; + } + + if ((status == TEST_SKIP || status == TEST_TODO) && + process_output_size(process) > 0) { + process_read_last_line(process, reason, sizeof reason); + } else { + reason[0] = '\0'; + } + + fprintf(stderr, "%s %d - %s%s%s\n", result, test_count, test, directive, reason); + fflush(stderr); +} + + +int run_test(const char* test, + int benchmark_output, + int test_count) { + char errmsg[1024] = "no error"; + process_info_t processes[1024]; + process_info_t *main_proc; + task_entry_t* task; + int process_count; + int result; + int status; + int i; + + status = 255; + main_proc = NULL; + process_count = 0; + +#ifndef _WIN32 + /* Clean up stale socket from previous run. */ + remove(TEST_PIPENAME); + remove(TEST_PIPENAME_2); + remove(TEST_PIPENAME_3); +#endif + + /* If it's a helper the user asks for, start it directly. */ + for (task = TASKS; task->main; task++) { + if (task->is_helper && strcmp(test, task->process_name) == 0) { + return task->main(); + } + } + + /* Start the helpers first. */ + for (task = TASKS; task->main; task++) { + if (strcmp(test, task->task_name) != 0) { + continue; + } + + /* Skip the test itself. */ + if (!task->is_helper) { + continue; + } + + if (process_start(task->task_name, + task->process_name, + &processes[process_count], + 1 /* is_helper */) == -1) { + snprintf(errmsg, + sizeof errmsg, + "Process `%s` failed to start.", + task->process_name); + goto out; + } + + process_count++; + } + + /* Give the helpers time to settle. Race-y, fix this. */ + uv_sleep(250); + + /* Now start the test itself. */ + for (task = TASKS; task->main; task++) { + if (strcmp(test, task->task_name) != 0) { + continue; + } + + if (task->is_helper) { + continue; + } + + if (process_start(task->task_name, + task->process_name, + &processes[process_count], + 0 /* !is_helper */) == -1) { + snprintf(errmsg, + sizeof errmsg, + "Process `%s` failed to start.", + task->process_name); + goto out; + } + + main_proc = &processes[process_count]; + process_count++; + break; + } + + if (main_proc == NULL) { + snprintf(errmsg, + sizeof errmsg, + "No test with that name: %s", + test); + goto out; + } + + result = process_wait(main_proc, 1, task->timeout); + if (result == -1) { + FATAL("process_wait failed"); + } else if (result == -2) { + /* Don't have to clean up the process, process_wait() has killed it. */ + snprintf(errmsg, + sizeof errmsg, + "timeout"); + goto out; + } + + status = process_reap(main_proc); + if (status != TEST_OK) { + snprintf(errmsg, + sizeof errmsg, + "exit code %d", + status); + goto out; + } + + if (benchmark_output) { + /* Give the helpers time to clean up their act. */ + uv_sleep(1000); + } + +out: + /* Reap running processes except the main process, it's already dead. */ + for (i = 0; i < process_count - 1; i++) { + process_terminate(&processes[i]); + } + + if (process_count > 0 && + process_wait(processes, process_count - 1, -1) < 0) { + FATAL("process_wait failed"); + } + + if (tap_output) + log_tap_result(test_count, test, status, &processes[i]); + + /* Show error and output from processes if the test failed. */ + if (status != 0 || task->show_output) { + if (tap_output) { + fprintf(stderr, "#"); + } else if (status == TEST_TODO) { + fprintf(stderr, "\n`%s` todo\n", test); + } else if (status == TEST_SKIP) { + fprintf(stderr, "\n`%s` skipped\n", test); + } else if (status != 0) { + fprintf(stderr, "\n`%s` failed: %s\n", test, errmsg); + } else { + fprintf(stderr, "\n"); + } + fflush(stderr); + + for (i = 0; i < process_count; i++) { + switch (process_output_size(&processes[i])) { + case -1: + fprintf(stderr, "Output from process `%s`: (unavailable)\n", + process_get_name(&processes[i])); + fflush(stderr); + break; + + case 0: + fprintf(stderr, "Output from process `%s`: (no output)\n", + process_get_name(&processes[i])); + fflush(stderr); + break; + + default: + fprintf(stderr, "Output from process `%s`:\n", process_get_name(&processes[i])); + fflush(stderr); + process_copy_output(&processes[i], fileno(stderr)); + break; + } + } + + if (!tap_output) { + fprintf(stderr, "=============================================================\n"); + } + + /* In benchmark mode show concise output from the main process. */ + } else if (benchmark_output) { + switch (process_output_size(main_proc)) { + case -1: + fprintf(stderr, "%s: (unavailable)\n", test); + fflush(stderr); + break; + + case 0: + fprintf(stderr, "%s: (no output)\n", test); + fflush(stderr); + break; + + default: + for (i = 0; i < process_count; i++) { + process_copy_output(&processes[i], fileno(stderr)); + } + break; + } + } + + /* Clean up all process handles. */ + for (i = 0; i < process_count; i++) { + process_cleanup(&processes[i]); + } + + return status; +} + + +/* Returns the status code of the task part + * or 255 if no matching task was not found. + */ +int run_test_part(const char* test, const char* part) { + task_entry_t* task; + int r; + + for (task = TASKS; task->main; task++) { + if (strcmp(test, task->task_name) == 0 && + strcmp(part, task->process_name) == 0) { + r = task->main(); + return r; + } + } + + fprintf(stderr, "No test part with that name: %s:%s\n", test, part); + fflush(stderr); + return 255; +} + + +static int compare_task(const void* va, const void* vb) { + const task_entry_t* a = va; + const task_entry_t* b = vb; + return strcmp(a->task_name, b->task_name); +} + + +static int find_helpers(const task_entry_t* task, + const task_entry_t** helpers) { + const task_entry_t* helper; + int n_helpers; + + for (n_helpers = 0, helper = TASKS; helper->main; helper++) { + if (helper->is_helper && strcmp(helper->task_name, task->task_name) == 0) { + *helpers++ = helper; + n_helpers++; + } + } + + return n_helpers; +} + + +void print_tests(FILE* stream) { + const task_entry_t* helpers[1024]; + const task_entry_t* task; + int n_helpers; + int n_tasks; + int i; + + for (n_tasks = 0, task = TASKS; task->main; n_tasks++, task++); + qsort(TASKS, n_tasks, sizeof(TASKS[0]), compare_task); + + for (task = TASKS; task->main; task++) { + if (task->is_helper) { + continue; + } + + n_helpers = find_helpers(task, helpers); + if (n_helpers) { + printf("%-25s (helpers:", task->task_name); + for (i = 0; i < n_helpers; i++) { + printf(" %s", helpers[i]->process_name); + } + printf(")\n"); + } else { + printf("%s\n", task->task_name); + } + } +} diff --git a/3rdparty/libuv/test/runner.h b/3rdparty/libuv/test/runner.h new file mode 100644 index 00000000000..78f3c880a98 --- /dev/null +++ b/3rdparty/libuv/test/runner.h @@ -0,0 +1,178 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef RUNNER_H_ +#define RUNNER_H_ + +#include /* PATH_MAX */ +#include /* FILE */ + + +/* + * The maximum number of processes (main + helpers) that a test / benchmark + * can have. + */ +#define MAX_PROCESSES 8 + + +/* + * Struct to store both tests and to define helper processes for tasks. + */ +typedef struct { + char *task_name; + char *process_name; + int (*main)(void); + int is_helper; + int show_output; + + /* + * The time in milliseconds after which a single test or benchmark times out. + */ + int timeout; +} task_entry_t, bench_entry_t; + + +/* + * Macros used by test-list.h and benchmark-list.h. + */ +#define TASK_LIST_START \ + task_entry_t TASKS[] = { + +#define TASK_LIST_END \ + { 0, 0, 0, 0, 0, 0 } \ + }; + +#define TEST_DECLARE(name) \ + int run_test_##name(void); + +#define TEST_ENTRY(name) \ + { #name, #name, &run_test_##name, 0, 0, 5000 }, + +#define TEST_ENTRY_CUSTOM(name, is_helper, show_output, timeout) \ + { #name, #name, &run_test_##name, is_helper, show_output, timeout }, + +#define BENCHMARK_DECLARE(name) \ + int run_benchmark_##name(void); + +#define BENCHMARK_ENTRY(name) \ + { #name, #name, &run_benchmark_##name, 0, 0, 60000 }, + +#define HELPER_DECLARE(name) \ + int run_helper_##name(void); + +#define HELPER_ENTRY(task_name, name) \ + { #task_name, #name, &run_helper_##name, 1, 0, 0 }, + +#define TEST_HELPER HELPER_ENTRY +#define BENCHMARK_HELPER HELPER_ENTRY + +#ifdef PATH_MAX +extern char executable_path[PATH_MAX]; +#else +extern char executable_path[4096]; +#endif + +/* + * Include platform-dependent definitions + */ +#ifdef _WIN32 +# include "runner-win.h" +#else +# include "runner-unix.h" +#endif + + +/* The array that is filled by test-list.h or benchmark-list.h */ +extern task_entry_t TASKS[]; + +/* + * Run all tests. + */ +int run_tests(int benchmark_output); + +/* + * Run a single test. Starts up any helpers. + */ +int run_test(const char* test, + int benchmark_output, + int test_count); + +/* + * Run a test part, i.e. the test or one of its helpers. + */ +int run_test_part(const char* test, const char* part); + + +/* + * Print tests in sorted order to `stream`. Used by `./run-tests --list`. + */ +void print_tests(FILE* stream); + + +/* + * Stuff that should be implemented by test-runner-.h + * All functions return 0 on success, -1 on failure, unless specified + * otherwise. + */ + +/* Do platform-specific initialization. */ +int platform_init(int argc, char** argv); + +/* Invoke "argv[0] test-name [test-part]". Store process info in *p. */ +/* Make sure that all stdio output of the processes is buffered up. */ +int process_start(char *name, char* part, process_info_t *p, int is_helper); + +/* Wait for all `n` processes in `vec` to terminate. */ +/* Time out after `timeout` msec, or never if timeout == -1 */ +/* Return 0 if all processes are terminated, -1 on error, -2 on timeout. */ +int process_wait(process_info_t *vec, int n, int timeout); + +/* Returns the number of bytes in the stdio output buffer for process `p`. */ +long int process_output_size(process_info_t *p); + +/* Copy the contents of the stdio output buffer to `fd`. */ +int process_copy_output(process_info_t *p, int fd); + +/* Copy the last line of the stdio output buffer to `buffer` */ +int process_read_last_line(process_info_t *p, + char * buffer, + size_t buffer_len); + +/* Return the name that was specified when `p` was started by process_start */ +char* process_get_name(process_info_t *p); + +/* Terminate process `p`. */ +int process_terminate(process_info_t *p); + +/* Return the exit code of process p. */ +/* On error, return -1. */ +int process_reap(process_info_t *p); + +/* Clean up after terminating process `p` (e.g. free the output buffer etc.). */ +void process_cleanup(process_info_t *p); + +/* Move the console cursor one line up and back to the first column. */ +void rewind_cursor(void); + +/* trigger output as tap */ +extern int tap_output; + +#endif /* RUNNER_H_ */ diff --git a/3rdparty/libuv/test/task.h b/3rdparty/libuv/test/task.h new file mode 100644 index 00000000000..d18c1daa364 --- /dev/null +++ b/3rdparty/libuv/test/task.h @@ -0,0 +1,220 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef TASK_H_ +#define TASK_H_ + +#include "uv.h" + +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1600 +# include "stdint-msvc2008.h" +#else +# include +#endif + +#if !defined(_WIN32) +# include +# include /* setrlimit() */ +#endif + +#ifdef __clang__ +# pragma clang diagnostic ignored "-Wvariadic-macros" +# pragma clang diagnostic ignored "-Wc99-extensions" +#endif + +#define TEST_PORT 9123 +#define TEST_PORT_2 9124 + +#ifdef _WIN32 +# define TEST_PIPENAME "\\\\?\\pipe\\uv-test" +# define TEST_PIPENAME_2 "\\\\?\\pipe\\uv-test2" +# define TEST_PIPENAME_3 "\\\\?\\pipe\\uv-test3" +#else +# define TEST_PIPENAME "/tmp/uv-test-sock" +# define TEST_PIPENAME_2 "/tmp/uv-test-sock2" +# define TEST_PIPENAME_3 "/tmp/uv-test-sock3" +#endif + +#ifdef _WIN32 +# include +# ifndef S_IRUSR +# define S_IRUSR _S_IREAD +# endif +# ifndef S_IWUSR +# define S_IWUSR _S_IWRITE +# endif +#endif + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + +#define container_of(ptr, type, member) \ + ((type *) ((char *) (ptr) - offsetof(type, member))) + +typedef enum { + TCP = 0, + UDP, + PIPE +} stream_type; + +/* Die with fatal error. */ +#define FATAL(msg) \ + do { \ + fprintf(stderr, \ + "Fatal error in %s on line %d: %s\n", \ + __FILE__, \ + __LINE__, \ + msg); \ + fflush(stderr); \ + abort(); \ + } while (0) + +/* Have our own assert, so we are sure it does not get optimized away in + * a release build. + */ +#define ASSERT(expr) \ + do { \ + if (!(expr)) { \ + fprintf(stderr, \ + "Assertion failed in %s on line %d: %s\n", \ + __FILE__, \ + __LINE__, \ + #expr); \ + abort(); \ + } \ + } while (0) + +/* This macro cleans up the main loop. This is used to avoid valgrind + * warnings about memory being "leaked" by the main event loop. + */ +#define MAKE_VALGRIND_HAPPY() \ + do { \ + close_loop(uv_default_loop()); \ + uv_loop_delete(uv_default_loop()); \ + } while (0) + +/* Just sugar for wrapping the main() for a task or helper. */ +#define TEST_IMPL(name) \ + int run_test_##name(void); \ + int run_test_##name(void) + +#define BENCHMARK_IMPL(name) \ + int run_benchmark_##name(void); \ + int run_benchmark_##name(void) + +#define HELPER_IMPL(name) \ + int run_helper_##name(void); \ + int run_helper_##name(void) + +/* Pause the calling thread for a number of milliseconds. */ +void uv_sleep(int msec); + +/* Format big numbers nicely. WARNING: leaks memory. */ +const char* fmt(double d); + +/* Reserved test exit codes. */ +enum test_status { + TEST_OK = 0, + TEST_TODO, + TEST_SKIP +}; + +#define RETURN_OK() \ + do { \ + return TEST_OK; \ + } while (0) + +#define RETURN_TODO(explanation) \ + do { \ + fprintf(stderr, "%s\n", explanation); \ + fflush(stderr); \ + return TEST_TODO; \ + } while (0) + +#define RETURN_SKIP(explanation) \ + do { \ + fprintf(stderr, "%s\n", explanation); \ + fflush(stderr); \ + return TEST_SKIP; \ + } while (0) + +#if !defined(_WIN32) + +# define TEST_FILE_LIMIT(num) \ + do { \ + struct rlimit lim; \ + lim.rlim_cur = (num); \ + lim.rlim_max = lim.rlim_cur; \ + if (setrlimit(RLIMIT_NOFILE, &lim)) \ + RETURN_SKIP("File descriptor limit too low."); \ + } while (0) + +#else /* defined(_WIN32) */ + +# define TEST_FILE_LIMIT(num) do {} while (0) + +#endif + +#if !defined(snprintf) && defined(_MSC_VER) && _MSC_VER < 1900 +extern int snprintf(char*, size_t, const char*, ...); +#endif + +#if defined(__clang__) || \ + defined(__GNUC__) || \ + defined(__INTEL_COMPILER) || \ + defined(__SUNPRO_C) +# define UNUSED __attribute__((unused)) +#else +# define UNUSED +#endif + +/* Fully close a loop */ +static void close_walk_cb(uv_handle_t* handle, void* arg) { + if (!uv_is_closing(handle)) + uv_close(handle, NULL); +} + +UNUSED static void close_loop(uv_loop_t* loop) { + uv_walk(loop, close_walk_cb, NULL); + uv_run(loop, UV_RUN_DEFAULT); +} + +UNUSED static int can_ipv6(void) { + uv_interface_address_t* addr; + int supported; + int count; + int i; + + if (uv_interface_addresses(&addr, &count)) + return 1; /* Assume IPv6 support on failure. */ + + supported = 0; + for (i = 0; supported == 0 && i < count; i += 1) + supported = (AF_INET6 == addr[i].address.address6.sin6_family); + + uv_free_interface_addresses(addr, count); + return supported; +} + +#endif /* TASK_H_ */ diff --git a/3rdparty/libuv/test/test-active.c b/3rdparty/libuv/test/test-active.c new file mode 100644 index 00000000000..b17bd176018 --- /dev/null +++ b/3rdparty/libuv/test/test-active.c @@ -0,0 +1,84 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + + +static int close_cb_called = 0; + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +static void timer_cb(uv_timer_t* handle) { + ASSERT(0 && "timer_cb should not have been called"); +} + + +TEST_IMPL(active) { + int r; + uv_timer_t timer; + + r = uv_timer_init(uv_default_loop(), &timer); + ASSERT(r == 0); + + /* uv_is_active() and uv_is_closing() should always return either 0 or 1. */ + ASSERT(0 == uv_is_active((uv_handle_t*) &timer)); + ASSERT(0 == uv_is_closing((uv_handle_t*) &timer)); + + r = uv_timer_start(&timer, timer_cb, 1000, 0); + ASSERT(r == 0); + + ASSERT(1 == uv_is_active((uv_handle_t*) &timer)); + ASSERT(0 == uv_is_closing((uv_handle_t*) &timer)); + + r = uv_timer_stop(&timer); + ASSERT(r == 0); + + ASSERT(0 == uv_is_active((uv_handle_t*) &timer)); + ASSERT(0 == uv_is_closing((uv_handle_t*) &timer)); + + r = uv_timer_start(&timer, timer_cb, 1000, 0); + ASSERT(r == 0); + + ASSERT(1 == uv_is_active((uv_handle_t*) &timer)); + ASSERT(0 == uv_is_closing((uv_handle_t*) &timer)); + + uv_close((uv_handle_t*) &timer, close_cb); + + ASSERT(0 == uv_is_active((uv_handle_t*) &timer)); + ASSERT(1 == uv_is_closing((uv_handle_t*) &timer)); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-async-null-cb.c b/3rdparty/libuv/test/test-async-null-cb.c new file mode 100644 index 00000000000..757944a2762 --- /dev/null +++ b/3rdparty/libuv/test/test-async-null-cb.c @@ -0,0 +1,55 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static uv_async_t async_handle; +static uv_check_t check_handle; +static int check_cb_called; +static uv_thread_t thread; + + +static void thread_cb(void* dummy) { + (void) &dummy; + uv_async_send(&async_handle); +} + + +static void check_cb(uv_check_t* handle) { + ASSERT(check_cb_called == 0); + uv_close((uv_handle_t*) &async_handle, NULL); + uv_close((uv_handle_t*) &check_handle, NULL); + check_cb_called++; +} + + +TEST_IMPL(async_null_cb) { + ASSERT(0 == uv_async_init(uv_default_loop(), &async_handle, NULL)); + ASSERT(0 == uv_check_init(uv_default_loop(), &check_handle)); + ASSERT(0 == uv_check_start(&check_handle, check_cb)); + ASSERT(0 == uv_thread_create(&thread, thread_cb, NULL)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + ASSERT(0 == uv_thread_join(&thread)); + ASSERT(1 == check_cb_called); + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-async.c b/3rdparty/libuv/test/test-async.c new file mode 100644 index 00000000000..6f5351bf158 --- /dev/null +++ b/3rdparty/libuv/test/test-async.c @@ -0,0 +1,134 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + +static uv_thread_t thread; +static uv_mutex_t mutex; + +static uv_prepare_t prepare; +static uv_async_t async; + +static volatile int async_cb_called; +static int prepare_cb_called; +static int close_cb_called; + + +static void thread_cb(void *arg) { + int n; + int r; + + for (;;) { + uv_mutex_lock(&mutex); + n = async_cb_called; + uv_mutex_unlock(&mutex); + + if (n == 3) { + break; + } + + r = uv_async_send(&async); + ASSERT(r == 0); + + /* Work around a bug in Valgrind. + * + * Valgrind runs threads not in parallel but sequentially, i.e. one after + * the other. It also doesn't preempt them, instead it depends on threads + * yielding voluntarily by making a syscall. + * + * That never happens here: the pipe that is associated with the async + * handle is written to once but that's too early for Valgrind's scheduler + * to kick in. Afterwards, the thread busy-loops, starving the main thread. + * Therefore, we yield. + * + * This behavior has been observed with Valgrind 3.7.0 and 3.9.0. + */ + uv_sleep(0); + } +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +static void async_cb(uv_async_t* handle) { + int n; + + ASSERT(handle == &async); + + uv_mutex_lock(&mutex); + n = ++async_cb_called; + uv_mutex_unlock(&mutex); + + if (n == 3) { + uv_close((uv_handle_t*)&async, close_cb); + uv_close((uv_handle_t*)&prepare, close_cb); + } +} + + +static void prepare_cb(uv_prepare_t* handle) { + int r; + + ASSERT(handle == &prepare); + + if (prepare_cb_called++) + return; + + r = uv_thread_create(&thread, thread_cb, NULL); + ASSERT(r == 0); + uv_mutex_unlock(&mutex); +} + + +TEST_IMPL(async) { + int r; + + r = uv_mutex_init(&mutex); + ASSERT(r == 0); + uv_mutex_lock(&mutex); + + r = uv_prepare_init(uv_default_loop(), &prepare); + ASSERT(r == 0); + r = uv_prepare_start(&prepare, prepare_cb); + ASSERT(r == 0); + + r = uv_async_init(uv_default_loop(), &async, async_cb); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(prepare_cb_called > 0); + ASSERT(async_cb_called == 3); + ASSERT(close_cb_called == 2); + + ASSERT(0 == uv_thread_join(&thread)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-barrier.c b/3rdparty/libuv/test/test-barrier.c new file mode 100644 index 00000000000..dfd2dbdef1b --- /dev/null +++ b/3rdparty/libuv/test/test-barrier.c @@ -0,0 +1,106 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +typedef struct { + uv_barrier_t barrier; + int delay; + volatile int posted; + int main_barrier_wait_rval; + int worker_barrier_wait_rval; +} worker_config; + + +static void worker(void* arg) { + worker_config* c = arg; + + if (c->delay) + uv_sleep(c->delay); + + c->worker_barrier_wait_rval = uv_barrier_wait(&c->barrier); +} + + +TEST_IMPL(barrier_1) { + uv_thread_t thread; + worker_config wc; + + memset(&wc, 0, sizeof(wc)); + + ASSERT(0 == uv_barrier_init(&wc.barrier, 2)); + ASSERT(0 == uv_thread_create(&thread, worker, &wc)); + + uv_sleep(100); + wc.main_barrier_wait_rval = uv_barrier_wait(&wc.barrier); + + ASSERT(0 == uv_thread_join(&thread)); + uv_barrier_destroy(&wc.barrier); + + ASSERT(1 == (wc.main_barrier_wait_rval ^ wc.worker_barrier_wait_rval)); + + return 0; +} + + +TEST_IMPL(barrier_2) { + uv_thread_t thread; + worker_config wc; + + memset(&wc, 0, sizeof(wc)); + wc.delay = 100; + + ASSERT(0 == uv_barrier_init(&wc.barrier, 2)); + ASSERT(0 == uv_thread_create(&thread, worker, &wc)); + + wc.main_barrier_wait_rval = uv_barrier_wait(&wc.barrier); + + ASSERT(0 == uv_thread_join(&thread)); + uv_barrier_destroy(&wc.barrier); + + ASSERT(1 == (wc.main_barrier_wait_rval ^ wc.worker_barrier_wait_rval)); + + return 0; +} + + +TEST_IMPL(barrier_3) { + uv_thread_t thread; + worker_config wc; + + memset(&wc, 0, sizeof(wc)); + + ASSERT(0 == uv_barrier_init(&wc.barrier, 2)); + ASSERT(0 == uv_thread_create(&thread, worker, &wc)); + + wc.main_barrier_wait_rval = uv_barrier_wait(&wc.barrier); + + ASSERT(0 == uv_thread_join(&thread)); + uv_barrier_destroy(&wc.barrier); + + ASSERT(1 == (wc.main_barrier_wait_rval ^ wc.worker_barrier_wait_rval)); + + return 0; +} diff --git a/3rdparty/libuv/test/test-callback-order.c b/3rdparty/libuv/test/test-callback-order.c new file mode 100644 index 00000000000..8bc2c4f75de --- /dev/null +++ b/3rdparty/libuv/test/test-callback-order.c @@ -0,0 +1,77 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static int idle_cb_called; +static int timer_cb_called; + +static uv_idle_t idle_handle; +static uv_timer_t timer_handle; + + +/* idle_cb should run before timer_cb */ +static void idle_cb(uv_idle_t* handle) { + ASSERT(idle_cb_called == 0); + ASSERT(timer_cb_called == 0); + uv_idle_stop(handle); + idle_cb_called++; +} + + +static void timer_cb(uv_timer_t* handle) { + ASSERT(idle_cb_called == 1); + ASSERT(timer_cb_called == 0); + uv_timer_stop(handle); + timer_cb_called++; +} + + +static void next_tick(uv_idle_t* handle) { + uv_loop_t* loop = handle->loop; + uv_idle_stop(handle); + uv_idle_init(loop, &idle_handle); + uv_idle_start(&idle_handle, idle_cb); + uv_timer_init(loop, &timer_handle); + uv_timer_start(&timer_handle, timer_cb, 0, 0); +} + + +TEST_IMPL(callback_order) { + uv_loop_t* loop; + uv_idle_t idle; + + loop = uv_default_loop(); + uv_idle_init(loop, &idle); + uv_idle_start(&idle, next_tick); + + ASSERT(idle_cb_called == 0); + ASSERT(timer_cb_called == 0); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(idle_cb_called == 1); + ASSERT(timer_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-callback-stack.c b/3rdparty/libuv/test/test-callback-stack.c new file mode 100644 index 00000000000..8855c0841b3 --- /dev/null +++ b/3rdparty/libuv/test/test-callback-stack.c @@ -0,0 +1,205 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* + * TODO: Add explanation of why we want on_close to be called from fresh + * stack. + */ + +#include "uv.h" +#include "task.h" + + +static const char MESSAGE[] = "Failure is for the weak. Everyone dies alone."; + +static uv_tcp_t client; +static uv_timer_t timer; +static uv_connect_t connect_req; +static uv_write_t write_req; +static uv_shutdown_t shutdown_req; + +static int nested = 0; +static int close_cb_called = 0; +static int connect_cb_called = 0; +static int write_cb_called = 0; +static int timer_cb_called = 0; +static int bytes_received = 0; +static int shutdown_cb_called = 0; + + +static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + buf->len = size; + buf->base = malloc(size); + ASSERT(buf->base != NULL); +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(nested == 0 && "close_cb must be called from a fresh stack"); + + close_cb_called++; +} + + +static void shutdown_cb(uv_shutdown_t* req, int status) { + ASSERT(status == 0); + ASSERT(nested == 0 && "shutdown_cb must be called from a fresh stack"); + + shutdown_cb_called++; +} + + +static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { + ASSERT(nested == 0 && "read_cb must be called from a fresh stack"); + + printf("Read. nread == %d\n", (int)nread); + free(buf->base); + + if (nread == 0) { + return; + + } else if (nread < 0) { + ASSERT(nread == UV_EOF); + + nested++; + uv_close((uv_handle_t*)tcp, close_cb); + nested--; + + return; + } + + bytes_received += nread; + + /* We call shutdown here because when bytes_received == sizeof MESSAGE */ + /* there will be no more data sent nor received, so here it would be */ + /* possible for a backend to to call shutdown_cb immediately and *not* */ + /* from a fresh stack. */ + if (bytes_received == sizeof MESSAGE) { + nested++; + + puts("Shutdown"); + + if (uv_shutdown(&shutdown_req, (uv_stream_t*)tcp, shutdown_cb)) { + FATAL("uv_shutdown failed"); + } + nested--; + } +} + + +static void timer_cb(uv_timer_t* handle) { + ASSERT(handle == &timer); + ASSERT(nested == 0 && "timer_cb must be called from a fresh stack"); + + puts("Timeout complete. Now read data..."); + + nested++; + if (uv_read_start((uv_stream_t*)&client, alloc_cb, read_cb)) { + FATAL("uv_read_start failed"); + } + nested--; + + timer_cb_called++; + + uv_close((uv_handle_t*)handle, close_cb); +} + + +static void write_cb(uv_write_t* req, int status) { + int r; + + ASSERT(status == 0); + ASSERT(nested == 0 && "write_cb must be called from a fresh stack"); + + puts("Data written. 500ms timeout..."); + + /* After the data has been sent, we're going to wait for a while, then */ + /* start reading. This makes us certain that the message has been echoed */ + /* back to our receive buffer when we start reading. This maximizes the */ + /* temptation for the backend to use dirty stack for calling read_cb. */ + nested++; + r = uv_timer_init(uv_default_loop(), &timer); + ASSERT(r == 0); + r = uv_timer_start(&timer, timer_cb, 500, 0); + ASSERT(r == 0); + nested--; + + write_cb_called++; +} + + +static void connect_cb(uv_connect_t* req, int status) { + uv_buf_t buf; + + puts("Connected. Write some data to echo server..."); + + ASSERT(status == 0); + ASSERT(nested == 0 && "connect_cb must be called from a fresh stack"); + + nested++; + + buf.base = (char*) &MESSAGE; + buf.len = sizeof MESSAGE; + + if (uv_write(&write_req, (uv_stream_t*)req->handle, &buf, 1, write_cb)) { + FATAL("uv_write failed"); + } + + nested--; + + connect_cb_called++; +} + + +TEST_IMPL(callback_stack) { + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + if (uv_tcp_init(uv_default_loop(), &client)) { + FATAL("uv_tcp_init failed"); + } + + puts("Connecting..."); + + nested++; + + if (uv_tcp_connect(&connect_req, + &client, + (const struct sockaddr*) &addr, + connect_cb)) { + FATAL("uv_tcp_connect failed"); + } + nested--; + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(nested == 0); + ASSERT(connect_cb_called == 1 && "connect_cb must be called exactly once"); + ASSERT(write_cb_called == 1 && "write_cb must be called exactly once"); + ASSERT(timer_cb_called == 1 && "timer_cb must be called exactly once"); + ASSERT(bytes_received == sizeof MESSAGE); + ASSERT(shutdown_cb_called == 1 && "shutdown_cb must be called exactly once"); + ASSERT(close_cb_called == 2 && "close_cb must be called exactly twice"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-close-fd.c b/3rdparty/libuv/test/test-close-fd.c new file mode 100644 index 00000000000..93a7bd7c021 --- /dev/null +++ b/3rdparty/libuv/test/test-close-fd.c @@ -0,0 +1,76 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#if !defined(_WIN32) + +#include "uv.h" +#include "task.h" +#include +#include + +static unsigned int read_cb_called; + +static void alloc_cb(uv_handle_t *handle, size_t size, uv_buf_t *buf) { + static char slab[1]; + buf->base = slab; + buf->len = sizeof(slab); +} + +static void read_cb(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf) { + switch (++read_cb_called) { + case 1: + ASSERT(nread == 1); + uv_read_stop(handle); + break; + case 2: + ASSERT(nread == UV_EOF); + uv_close((uv_handle_t *) handle, NULL); + break; + default: + ASSERT(!"read_cb_called > 2"); + } +} + +TEST_IMPL(close_fd) { + uv_pipe_t pipe_handle; + int fd[2]; + + ASSERT(0 == pipe(fd)); + ASSERT(0 == uv_pipe_init(uv_default_loop(), &pipe_handle, 0)); + ASSERT(0 == uv_pipe_open(&pipe_handle, fd[0])); + fd[0] = -1; /* uv_pipe_open() takes ownership of the file descriptor. */ + ASSERT(1 == write(fd[1], "", 1)); + ASSERT(0 == close(fd[1])); + fd[1] = -1; + ASSERT(0 == uv_read_start((uv_stream_t *) &pipe_handle, alloc_cb, read_cb)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + ASSERT(1 == read_cb_called); + ASSERT(0 == uv_is_active((const uv_handle_t *) &pipe_handle)); + ASSERT(0 == uv_read_start((uv_stream_t *) &pipe_handle, alloc_cb, read_cb)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + ASSERT(2 == read_cb_called); + ASSERT(0 != uv_is_closing((const uv_handle_t *) &pipe_handle)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* !defined(_WIN32) */ diff --git a/3rdparty/libuv/test/test-close-order.c b/3rdparty/libuv/test/test-close-order.c new file mode 100644 index 00000000000..2b24f6d6579 --- /dev/null +++ b/3rdparty/libuv/test/test-close-order.c @@ -0,0 +1,80 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static int check_cb_called; +static int timer_cb_called; +static int close_cb_called; + +static uv_check_t check_handle; +static uv_timer_t timer_handle1; +static uv_timer_t timer_handle2; + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +/* check_cb should run before any close_cb */ +static void check_cb(uv_check_t* handle) { + ASSERT(check_cb_called == 0); + ASSERT(timer_cb_called == 1); + ASSERT(close_cb_called == 0); + uv_close((uv_handle_t*) handle, close_cb); + uv_close((uv_handle_t*) &timer_handle2, close_cb); + check_cb_called++; +} + + +static void timer_cb(uv_timer_t* handle) { + uv_close((uv_handle_t*) handle, close_cb); + timer_cb_called++; +} + + +TEST_IMPL(close_order) { + uv_loop_t* loop; + loop = uv_default_loop(); + + uv_check_init(loop, &check_handle); + uv_check_start(&check_handle, check_cb); + uv_timer_init(loop, &timer_handle1); + uv_timer_start(&timer_handle1, timer_cb, 0, 0); + uv_timer_init(loop, &timer_handle2); + uv_timer_start(&timer_handle2, timer_cb, 100000, 0); + + ASSERT(check_cb_called == 0); + ASSERT(close_cb_called == 0); + ASSERT(timer_cb_called == 0); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(check_cb_called == 1); + ASSERT(close_cb_called == 3); + ASSERT(timer_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-condvar.c b/3rdparty/libuv/test/test-condvar.c new file mode 100644 index 00000000000..dbacdba384d --- /dev/null +++ b/3rdparty/libuv/test/test-condvar.c @@ -0,0 +1,173 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +typedef struct { + uv_mutex_t mutex; + uv_cond_t cond; + int delay; + int use_broadcast; + volatile int posted; +} worker_config; + + +static void worker(void* arg) { + worker_config* c = arg; + + if (c->delay) + uv_sleep(c->delay); + + uv_mutex_lock(&c->mutex); + ASSERT(c->posted == 0); + c->posted = 1; + if (c->use_broadcast) + uv_cond_broadcast(&c->cond); + else + uv_cond_signal(&c->cond); + uv_mutex_unlock(&c->mutex); +} + + +TEST_IMPL(condvar_1) { + uv_thread_t thread; + worker_config wc; + + memset(&wc, 0, sizeof(wc)); + + ASSERT(0 == uv_cond_init(&wc.cond)); + ASSERT(0 == uv_mutex_init(&wc.mutex)); + ASSERT(0 == uv_thread_create(&thread, worker, &wc)); + + uv_mutex_lock(&wc.mutex); + uv_sleep(100); + uv_cond_wait(&wc.cond, &wc.mutex); + ASSERT(wc.posted == 1); + uv_mutex_unlock(&wc.mutex); + + ASSERT(0 == uv_thread_join(&thread)); + uv_mutex_destroy(&wc.mutex); + uv_cond_destroy(&wc.cond); + + return 0; +} + + +TEST_IMPL(condvar_2) { + uv_thread_t thread; + worker_config wc; + + memset(&wc, 0, sizeof(wc)); + wc.delay = 100; + + ASSERT(0 == uv_cond_init(&wc.cond)); + ASSERT(0 == uv_mutex_init(&wc.mutex)); + ASSERT(0 == uv_thread_create(&thread, worker, &wc)); + + uv_mutex_lock(&wc.mutex); + uv_cond_wait(&wc.cond, &wc.mutex); + uv_mutex_unlock(&wc.mutex); + + ASSERT(0 == uv_thread_join(&thread)); + uv_mutex_destroy(&wc.mutex); + uv_cond_destroy(&wc.cond); + + return 0; +} + + +TEST_IMPL(condvar_3) { + uv_thread_t thread; + worker_config wc; + int r; + + memset(&wc, 0, sizeof(wc)); + wc.delay = 100; + + ASSERT(0 == uv_cond_init(&wc.cond)); + ASSERT(0 == uv_mutex_init(&wc.mutex)); + ASSERT(0 == uv_thread_create(&thread, worker, &wc)); + + uv_mutex_lock(&wc.mutex); + r = uv_cond_timedwait(&wc.cond, &wc.mutex, (uint64_t)(50 * 1e6)); + ASSERT(r == UV_ETIMEDOUT); + uv_mutex_unlock(&wc.mutex); + + ASSERT(0 == uv_thread_join(&thread)); + uv_mutex_destroy(&wc.mutex); + uv_cond_destroy(&wc.cond); + + return 0; +} + + +TEST_IMPL(condvar_4) { + uv_thread_t thread; + worker_config wc; + int r; + + memset(&wc, 0, sizeof(wc)); + wc.delay = 100; + + ASSERT(0 == uv_cond_init(&wc.cond)); + ASSERT(0 == uv_mutex_init(&wc.mutex)); + ASSERT(0 == uv_thread_create(&thread, worker, &wc)); + + uv_mutex_lock(&wc.mutex); + r = uv_cond_timedwait(&wc.cond, &wc.mutex, (uint64_t)(150 * 1e6)); + ASSERT(r == 0); + uv_mutex_unlock(&wc.mutex); + + ASSERT(0 == uv_thread_join(&thread)); + uv_mutex_destroy(&wc.mutex); + uv_cond_destroy(&wc.cond); + + return 0; +} + + +TEST_IMPL(condvar_5) { + uv_thread_t thread; + worker_config wc; + + memset(&wc, 0, sizeof(wc)); + wc.use_broadcast = 1; + + ASSERT(0 == uv_cond_init(&wc.cond)); + ASSERT(0 == uv_mutex_init(&wc.mutex)); + ASSERT(0 == uv_thread_create(&thread, worker, &wc)); + + uv_mutex_lock(&wc.mutex); + uv_sleep(100); + uv_cond_wait(&wc.cond, &wc.mutex); + ASSERT(wc.posted == 1); + uv_mutex_unlock(&wc.mutex); + + ASSERT(0 == uv_thread_join(&thread)); + uv_mutex_destroy(&wc.mutex); + uv_cond_destroy(&wc.cond); + + return 0; +} diff --git a/3rdparty/libuv/test/test-connection-fail.c b/3rdparty/libuv/test/test-connection-fail.c new file mode 100644 index 00000000000..328bff46e7d --- /dev/null +++ b/3rdparty/libuv/test/test-connection-fail.c @@ -0,0 +1,151 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + + +static uv_tcp_t tcp; +static uv_connect_t req; +static int connect_cb_calls; +static int close_cb_calls; + +static uv_timer_t timer; +static int timer_close_cb_calls; +static int timer_cb_calls; + + +static void on_close(uv_handle_t* handle) { + close_cb_calls++; +} + + +static void timer_close_cb(uv_handle_t* handle) { + timer_close_cb_calls++; +} + + +static void timer_cb(uv_timer_t* handle) { + timer_cb_calls++; + + /* + * These are the important asserts. The connection callback has been made, + * but libuv hasn't automatically closed the socket. The user must + * uv_close the handle manually. + */ + ASSERT(close_cb_calls == 0); + ASSERT(connect_cb_calls == 1); + + /* Close the tcp handle. */ + uv_close((uv_handle_t*)&tcp, on_close); + + /* Close the timer. */ + uv_close((uv_handle_t*)handle, timer_close_cb); +} + + +static void on_connect_with_close(uv_connect_t *req, int status) { + ASSERT((uv_stream_t*) &tcp == req->handle); + ASSERT(status == UV_ECONNREFUSED); + connect_cb_calls++; + + ASSERT(close_cb_calls == 0); + uv_close((uv_handle_t*)req->handle, on_close); +} + + +static void on_connect_without_close(uv_connect_t *req, int status) { + ASSERT(status == UV_ECONNREFUSED); + connect_cb_calls++; + + uv_timer_start(&timer, timer_cb, 100, 0); + + ASSERT(close_cb_calls == 0); +} + + +static void connection_fail(uv_connect_cb connect_cb) { + struct sockaddr_in client_addr, server_addr; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", 0, &client_addr)); + + /* There should be no servers listening on this port. */ + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &server_addr)); + + /* Try to connect to the server and do NUM_PINGS ping-pongs. */ + r = uv_tcp_init(uv_default_loop(), &tcp); + ASSERT(!r); + + /* We are never doing multiple reads/connects at a time anyway. */ + /* so these handles can be pre-initialized. */ + ASSERT(0 == uv_tcp_bind(&tcp, (const struct sockaddr*) &client_addr, 0)); + + r = uv_tcp_connect(&req, + &tcp, + (const struct sockaddr*) &server_addr, + connect_cb); + ASSERT(!r); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(connect_cb_calls == 1); + ASSERT(close_cb_calls == 1); +} + + +/* + * This test attempts to connect to a port where no server is running. We + * expect an error. + */ +TEST_IMPL(connection_fail) { + connection_fail(on_connect_with_close); + + ASSERT(timer_close_cb_calls == 0); + ASSERT(timer_cb_calls == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +/* + * This test is the same as the first except it check that the close + * callback of the tcp handle hasn't been made after the failed connection + * attempt. + */ +TEST_IMPL(connection_fail_doesnt_auto_close) { + int r; + + r = uv_timer_init(uv_default_loop(), &timer); + ASSERT(r == 0); + + connection_fail(on_connect_without_close); + + ASSERT(timer_close_cb_calls == 1); + ASSERT(timer_cb_calls == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-cwd-and-chdir.c b/3rdparty/libuv/test/test-cwd-and-chdir.c new file mode 100644 index 00000000000..1e95043c177 --- /dev/null +++ b/3rdparty/libuv/test/test-cwd-and-chdir.c @@ -0,0 +1,51 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include + +#define PATHMAX 1024 +extern char executable_path[]; + +TEST_IMPL(cwd_and_chdir) { + char buffer_orig[PATHMAX]; + char buffer_new[PATHMAX]; + size_t size1; + size_t size2; + int err; + + size1 = sizeof buffer_orig; + err = uv_cwd(buffer_orig, &size1); + ASSERT(err == 0); + + err = uv_chdir(buffer_orig); + ASSERT(err == 0); + + size2 = sizeof buffer_new; + err = uv_cwd(buffer_new, &size2); + ASSERT(err == 0); + + ASSERT(size1 == size2); + ASSERT(strcmp(buffer_orig, buffer_new) == 0); + + return 0; +} diff --git a/3rdparty/libuv/test/test-default-loop-close.c b/3rdparty/libuv/test/test-default-loop-close.c new file mode 100644 index 00000000000..fd11cfa8c12 --- /dev/null +++ b/3rdparty/libuv/test/test-default-loop-close.c @@ -0,0 +1,59 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + + +static int timer_cb_called; + + +static void timer_cb(uv_timer_t* timer) { + timer_cb_called++; + uv_close((uv_handle_t*) timer, NULL); +} + + +TEST_IMPL(default_loop_close) { + uv_loop_t* loop; + uv_timer_t timer_handle; + + loop = uv_default_loop(); + ASSERT(loop != NULL); + + ASSERT(0 == uv_timer_init(loop, &timer_handle)); + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 1, 0)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(1 == timer_cb_called); + ASSERT(0 == uv_loop_close(loop)); + + loop = uv_default_loop(); + ASSERT(loop != NULL); + + ASSERT(0 == uv_timer_init(loop, &timer_handle)); + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 1, 0)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(2 == timer_cb_called); + ASSERT(0 == uv_loop_close(loop)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-delayed-accept.c b/3rdparty/libuv/test/test-delayed-accept.c new file mode 100644 index 00000000000..4a7998909c3 --- /dev/null +++ b/3rdparty/libuv/test/test-delayed-accept.c @@ -0,0 +1,189 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + +static int connection_cb_called = 0; +static int do_accept_called = 0; +static int close_cb_called = 0; +static int connect_cb_called = 0; + + +static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + buf->base = malloc(size); + buf->len = size; +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + + free(handle); + + close_cb_called++; +} + + +static void do_accept(uv_timer_t* timer_handle) { + uv_tcp_t* server; + uv_tcp_t* accepted_handle = (uv_tcp_t*)malloc(sizeof *accepted_handle); + int r; + + ASSERT(timer_handle != NULL); + ASSERT(accepted_handle != NULL); + + r = uv_tcp_init(uv_default_loop(), accepted_handle); + ASSERT(r == 0); + + server = (uv_tcp_t*)timer_handle->data; + r = uv_accept((uv_stream_t*)server, (uv_stream_t*)accepted_handle); + ASSERT(r == 0); + + do_accept_called++; + + /* Immediately close the accepted handle. */ + uv_close((uv_handle_t*)accepted_handle, close_cb); + + /* After accepting the two clients close the server handle */ + if (do_accept_called == 2) { + uv_close((uv_handle_t*)server, close_cb); + } + + /* Dispose the timer. */ + uv_close((uv_handle_t*)timer_handle, close_cb); +} + + +static void connection_cb(uv_stream_t* tcp, int status) { + int r; + uv_timer_t* timer_handle; + + ASSERT(status == 0); + + timer_handle = (uv_timer_t*)malloc(sizeof *timer_handle); + ASSERT(timer_handle != NULL); + + /* Accept the client after 1 second */ + r = uv_timer_init(uv_default_loop(), timer_handle); + ASSERT(r == 0); + + timer_handle->data = tcp; + + r = uv_timer_start(timer_handle, do_accept, 1000, 0); + ASSERT(r == 0); + + connection_cb_called++; +} + + +static void start_server(void) { + struct sockaddr_in addr; + uv_tcp_t* server = (uv_tcp_t*)malloc(sizeof *server); + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + ASSERT(server != NULL); + + r = uv_tcp_init(uv_default_loop(), server); + ASSERT(r == 0); + r = uv_tcp_bind(server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)server, 128, connection_cb); + ASSERT(r == 0); +} + + +static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { + /* The server will not send anything, it should close gracefully. */ + + if (buf->base) { + free(buf->base); + } + + if (nread >= 0) { + ASSERT(nread == 0); + } else { + ASSERT(tcp != NULL); + ASSERT(nread == UV_EOF); + uv_close((uv_handle_t*)tcp, close_cb); + } +} + + +static void connect_cb(uv_connect_t* req, int status) { + int r; + + ASSERT(req != NULL); + ASSERT(status == 0); + + /* Not that the server will send anything, but otherwise we'll never know */ + /* when the server closes the connection. */ + r = uv_read_start((uv_stream_t*)(req->handle), alloc_cb, read_cb); + ASSERT(r == 0); + + connect_cb_called++; + + free(req); +} + + +static void client_connect(void) { + struct sockaddr_in addr; + uv_tcp_t* client = (uv_tcp_t*)malloc(sizeof *client); + uv_connect_t* connect_req = malloc(sizeof *connect_req); + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + ASSERT(client != NULL); + ASSERT(connect_req != NULL); + + r = uv_tcp_init(uv_default_loop(), client); + ASSERT(r == 0); + + r = uv_tcp_connect(connect_req, + client, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); +} + + + +TEST_IMPL(delayed_accept) { + start_server(); + + client_connect(); + client_connect(); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(connection_cb_called == 2); + ASSERT(do_accept_called == 2); + ASSERT(connect_cb_called == 2); + ASSERT(close_cb_called == 7); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-dlerror.c b/3rdparty/libuv/test/test-dlerror.c new file mode 100644 index 00000000000..091200edbed --- /dev/null +++ b/3rdparty/libuv/test/test-dlerror.c @@ -0,0 +1,55 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include + + +TEST_IMPL(dlerror) { + const char* path = "test/fixtures/load_error.node"; + const char* dlerror_no_error = "no error"; + const char* msg; + uv_lib_t lib; + int r; + + lib.errmsg = NULL; + lib.handle = NULL; + msg = uv_dlerror(&lib); + ASSERT(msg != NULL); + ASSERT(strstr(msg, dlerror_no_error) != NULL); + + r = uv_dlopen(path, &lib); + ASSERT(r == -1); + + msg = uv_dlerror(&lib); + ASSERT(msg != NULL); + ASSERT(strstr(msg, dlerror_no_error) == NULL); + + /* Should return the same error twice in a row. */ + msg = uv_dlerror(&lib); + ASSERT(msg != NULL); + ASSERT(strstr(msg, dlerror_no_error) == NULL); + + uv_dlclose(&lib); + + return 0; +} diff --git a/3rdparty/libuv/test/test-embed.c b/3rdparty/libuv/test/test-embed.c new file mode 100644 index 00000000000..06137456f8b --- /dev/null +++ b/3rdparty/libuv/test/test-embed.c @@ -0,0 +1,138 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include +#include + +#ifndef HAVE_KQUEUE +# if defined(__APPLE__) || \ + defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) +# define HAVE_KQUEUE 1 +# endif +#endif + +#ifndef HAVE_EPOLL +# if defined(__linux__) +# define HAVE_EPOLL 1 +# endif +#endif + +#if defined(HAVE_KQUEUE) || defined(HAVE_EPOLL) + +#if defined(HAVE_KQUEUE) +# include +# include +# include +#endif + +#if defined(HAVE_EPOLL) +# include +#endif + +static uv_thread_t embed_thread; +static uv_sem_t embed_sem; +static uv_timer_t embed_timer; +static uv_async_t embed_async; +static volatile int embed_closed; + +static int embed_timer_called; + + +static void embed_thread_runner(void* arg) { + int r; + int fd; + int timeout; + + while (!embed_closed) { + fd = uv_backend_fd(uv_default_loop()); + timeout = uv_backend_timeout(uv_default_loop()); + + do { +#if defined(HAVE_KQUEUE) + struct timespec ts; + ts.tv_sec = timeout / 1000; + ts.tv_nsec = (timeout % 1000) * 1000000; + r = kevent(fd, NULL, 0, NULL, 0, &ts); +#elif defined(HAVE_EPOLL) + { + struct epoll_event ev; + r = epoll_wait(fd, &ev, 1, timeout); + } +#endif + } while (r == -1 && errno == EINTR); + uv_async_send(&embed_async); + uv_sem_wait(&embed_sem); + } +} + + +static void embed_cb(uv_async_t* async) { + uv_run(uv_default_loop(), UV_RUN_ONCE); + + uv_sem_post(&embed_sem); +} + + +static void embed_timer_cb(uv_timer_t* timer) { + embed_timer_called++; + embed_closed = 1; + + uv_close((uv_handle_t*) &embed_async, NULL); +} +#endif + + +TEST_IMPL(embed) { +#if defined(HAVE_KQUEUE) || defined(HAVE_EPOLL) + uv_loop_t external; + + ASSERT(0 == uv_loop_init(&external)); + + embed_timer_called = 0; + embed_closed = 0; + + uv_async_init(&external, &embed_async, embed_cb); + + /* Start timer in default loop */ + uv_timer_init(uv_default_loop(), &embed_timer); + uv_timer_start(&embed_timer, embed_timer_cb, 250, 0); + + /* Start worker that will interrupt external loop */ + uv_sem_init(&embed_sem, 0); + uv_thread_create(&embed_thread, embed_thread_runner, NULL); + + /* But run external loop */ + uv_run(&external, UV_RUN_DEFAULT); + + uv_thread_join(&embed_thread); + uv_loop_close(&external); + + ASSERT(embed_timer_called == 1); +#endif + + return 0; +} diff --git a/3rdparty/libuv/test/test-emfile.c b/3rdparty/libuv/test/test-emfile.c new file mode 100644 index 00000000000..dd35f785b46 --- /dev/null +++ b/3rdparty/libuv/test/test-emfile.c @@ -0,0 +1,110 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#if !defined(_WIN32) + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +static void connection_cb(uv_stream_t* server_handle, int status); +static void connect_cb(uv_connect_t* req, int status); + +static const int maxfd = 31; +static unsigned connect_cb_called; +static uv_tcp_t server_handle; +static uv_tcp_t client_handle; + + +TEST_IMPL(emfile) { + struct sockaddr_in addr; + struct rlimit limits; + uv_connect_t connect_req; + uv_loop_t* loop; + int first_fd; + + /* Lower the file descriptor limit and use up all fds save one. */ + limits.rlim_cur = limits.rlim_max = maxfd + 1; + if (setrlimit(RLIMIT_NOFILE, &limits)) { + ASSERT(errno == EPERM); /* Valgrind blocks the setrlimit() call. */ + RETURN_SKIP("setrlimit(RLIMIT_NOFILE) failed, running under valgrind?"); + } + + loop = uv_default_loop(); + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + ASSERT(0 == uv_tcp_init(loop, &server_handle)); + ASSERT(0 == uv_tcp_init(loop, &client_handle)); + ASSERT(0 == uv_tcp_bind(&server_handle, (const struct sockaddr*) &addr, 0)); + ASSERT(0 == uv_listen((uv_stream_t*) &server_handle, 8, connection_cb)); + + /* Remember the first one so we can clean up afterwards. */ + do + first_fd = dup(0); + while (first_fd == -1 && errno == EINTR); + ASSERT(first_fd > 0); + + while (dup(0) != -1 || errno == EINTR); + ASSERT(errno == EMFILE); + close(maxfd); + + /* Now connect and use up the last available file descriptor. The EMFILE + * handling logic in src/unix/stream.c should ensure that connect_cb() runs + * whereas connection_cb() should *not* run. + */ + ASSERT(0 == uv_tcp_connect(&connect_req, + &client_handle, + (const struct sockaddr*) &addr, + connect_cb)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(1 == connect_cb_called); + + /* Close the dups again. Ignore errors in the unlikely event that the + * file descriptors were not contiguous. + */ + while (first_fd < maxfd) { + close(first_fd); + first_fd += 1; + } + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +static void connection_cb(uv_stream_t* server_handle, int status) { + ASSERT(0 && "connection_cb should not be called."); +} + + +static void connect_cb(uv_connect_t* req, int status) { + /* |status| should equal 0 because the connection should have been accepted, + * it's just that the server immediately closes it again. + */ + ASSERT(0 == status); + connect_cb_called += 1; + uv_close((uv_handle_t*) &server_handle, NULL); + uv_close((uv_handle_t*) &client_handle, NULL); +} + +#endif /* !defined(_WIN32) */ diff --git a/3rdparty/libuv/test/test-error.c b/3rdparty/libuv/test/test-error.c new file mode 100644 index 00000000000..eb337e66f33 --- /dev/null +++ b/3rdparty/libuv/test/test-error.c @@ -0,0 +1,50 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + + +/* + * Synthetic errors (errors that originate from within libuv, not the system) + * should produce sensible error messages when run through uv_strerror(). + * + * See https://github.com/joyent/libuv/issues/210 + */ +TEST_IMPL(error_message) { + /* Cop out. Can't do proper checks on systems with + * i18n-ized error messages... + */ + if (strcmp(uv_strerror(0), "Success") != 0) { + printf("i18n error messages detected, skipping test.\n"); + return 0; + } + + ASSERT(strstr(uv_strerror(UV_EINVAL), "Success") == NULL); + ASSERT(strcmp(uv_strerror(1337), "Unknown error") == 0); + ASSERT(strcmp(uv_strerror(-1337), "Unknown error") == 0); + + return 0; +} diff --git a/3rdparty/libuv/test/test-fail-always.c b/3rdparty/libuv/test/test-fail-always.c new file mode 100644 index 00000000000..0008459eac7 --- /dev/null +++ b/3rdparty/libuv/test/test-fail-always.c @@ -0,0 +1,29 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" + + +TEST_IMPL(fail_always) { + /* This test always fails. It is used to test the test runner. */ + FATAL("Yes, it always fails"); + return 2; +} diff --git a/3rdparty/libuv/test/test-fs-event.c b/3rdparty/libuv/test/test-fs-event.c new file mode 100644 index 00000000000..e02ff2fda5e --- /dev/null +++ b/3rdparty/libuv/test/test-fs-event.c @@ -0,0 +1,907 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +#ifndef HAVE_KQUEUE +# if defined(__APPLE__) || \ + defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) +# define HAVE_KQUEUE 1 +# endif +#endif + +static uv_fs_event_t fs_event; +static const char file_prefix[] = "fsevent-"; +static const int fs_event_file_count = 16; +#if defined(__APPLE__) || defined(_WIN32) +static const char file_prefix_in_subdir[] = "subdir"; +#endif +static uv_timer_t timer; +static int timer_cb_called; +static int close_cb_called; +static int fs_event_created; +static int fs_event_removed; +static int fs_event_cb_called; +#if defined(PATH_MAX) +static char fs_event_filename[PATH_MAX]; +#else +static char fs_event_filename[1024]; +#endif /* defined(PATH_MAX) */ +static int timer_cb_touch_called; + +static void create_dir(const char* name) { + int r; + uv_fs_t req; + r = uv_fs_mkdir(NULL, &req, name, 0755, NULL); + ASSERT(r == 0 || r == UV_EEXIST); + uv_fs_req_cleanup(&req); +} + +static void create_file(const char* name) { + int r; + uv_file file; + uv_fs_t req; + + r = uv_fs_open(NULL, &req, name, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + file = r; + uv_fs_req_cleanup(&req); + r = uv_fs_close(NULL, &req, file, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&req); +} + +static void touch_file(const char* name) { + int r; + uv_file file; + uv_fs_t req; + uv_buf_t buf; + + r = uv_fs_open(NULL, &req, name, O_RDWR, 0, NULL); + ASSERT(r >= 0); + file = r; + uv_fs_req_cleanup(&req); + + buf = uv_buf_init("foo", 4); + r = uv_fs_write(NULL, &req, file, &buf, 1, -1, NULL); + ASSERT(r >= 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_close(NULL, &req, file, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&req); +} + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + +static void fail_cb(uv_fs_event_t* handle, + const char* path, + int events, + int status) { + ASSERT(0 && "fail_cb called"); +} + +static void fs_event_cb_dir(uv_fs_event_t* handle, const char* filename, + int events, int status) { + ++fs_event_cb_called; + ASSERT(handle == &fs_event); + ASSERT(status == 0); + ASSERT(events == UV_RENAME); + #if defined(__APPLE__) || defined(_WIN32) || defined(__linux__) + ASSERT(strcmp(filename, "file1") == 0); + #else + ASSERT(filename == NULL || strcmp(filename, "file1") == 0); + #endif + ASSERT(0 == uv_fs_event_stop(handle)); + uv_close((uv_handle_t*)handle, close_cb); +} + +static const char* fs_event_get_filename(int i) { + snprintf(fs_event_filename, + sizeof(fs_event_filename), + "watch_dir/%s%d", + file_prefix, + i); + return fs_event_filename; +} + +static void fs_event_create_files(uv_timer_t* handle) { + /* Make sure we're not attempting to create files we do not intend */ + ASSERT(fs_event_created < fs_event_file_count); + + /* Create the file */ + create_file(fs_event_get_filename(fs_event_created)); + + if (++fs_event_created < fs_event_file_count) { + /* Create another file on a different event loop tick. We do it this way + * to avoid fs events coalescing into one fs event. */ + ASSERT(0 == uv_timer_start(&timer, fs_event_create_files, 1, 0)); + } +} + +static void fs_event_unlink_files(uv_timer_t* handle) { + int r; + int i; + + /* NOTE: handle might be NULL if invoked not as timer callback */ + if (handle == NULL) { + /* Unlink all files */ + for (i = 0; i < 16; i++) { + r = remove(fs_event_get_filename(i)); + if (handle != NULL) + ASSERT(r == 0); + } + } else { + /* Make sure we're not attempting to remove files we do not intend */ + ASSERT(fs_event_removed < fs_event_file_count); + + /* Remove the file */ + ASSERT(0 == remove(fs_event_get_filename(fs_event_removed))); + + if (++fs_event_removed < fs_event_file_count) { + /* Remove another file on a different event loop tick. We do it this way + * to avoid fs events coalescing into one fs event. */ + ASSERT(0 == uv_timer_start(&timer, fs_event_unlink_files, 1, 0)); + } + } +} + +static void fs_event_cb_dir_multi_file(uv_fs_event_t* handle, + const char* filename, + int events, + int status) { + fs_event_cb_called++; + ASSERT(handle == &fs_event); + ASSERT(status == 0); + ASSERT(events == UV_CHANGE || UV_RENAME); + #if defined(__APPLE__) || defined(_WIN32) || defined(__linux__) + ASSERT(strncmp(filename, file_prefix, sizeof(file_prefix) - 1) == 0); + #else + ASSERT(filename == NULL || + strncmp(filename, file_prefix, sizeof(file_prefix) - 1) == 0); + #endif + + if (fs_event_created + fs_event_removed == fs_event_file_count) { + /* Once we've processed all create events, delete all files */ + ASSERT(0 == uv_timer_start(&timer, fs_event_unlink_files, 1, 0)); + } else if (fs_event_cb_called == 2 * fs_event_file_count) { + /* Once we've processed all create and delete events, stop watching */ + uv_close((uv_handle_t*) &timer, close_cb); + uv_close((uv_handle_t*) handle, close_cb); + } +} + +#if defined(__APPLE__) || defined(_WIN32) +static const char* fs_event_get_filename_in_subdir(int i) { + snprintf(fs_event_filename, + sizeof(fs_event_filename), + "watch_dir/subdir/%s%d", + file_prefix, + i); + return fs_event_filename; +} + +static void fs_event_create_files_in_subdir(uv_timer_t* handle) { + /* Make sure we're not attempting to create files we do not intend */ + ASSERT(fs_event_created < fs_event_file_count); + + /* Create the file */ + create_file(fs_event_get_filename_in_subdir(fs_event_created)); + + if (++fs_event_created < fs_event_file_count) { + /* Create another file on a different event loop tick. We do it this way + * to avoid fs events coalescing into one fs event. */ + ASSERT(0 == uv_timer_start(&timer, fs_event_create_files_in_subdir, 1, 0)); + } +} + +static void fs_event_unlink_files_in_subdir(uv_timer_t* handle) { + int r; + int i; + + /* NOTE: handle might be NULL if invoked not as timer callback */ + if (handle == NULL) { + /* Unlink all files */ + for (i = 0; i < 16; i++) { + r = remove(fs_event_get_filename_in_subdir(i)); + if (handle != NULL) + ASSERT(r == 0); + } + } else { + /* Make sure we're not attempting to remove files we do not intend */ + ASSERT(fs_event_removed < fs_event_file_count); + + /* Remove the file */ + ASSERT(0 == remove(fs_event_get_filename_in_subdir(fs_event_removed))); + + if (++fs_event_removed < fs_event_file_count) { + /* Remove another file on a different event loop tick. We do it this way + * to avoid fs events coalescing into one fs event. */ + ASSERT(0 == uv_timer_start(&timer, fs_event_unlink_files_in_subdir, 1, 0)); + } + } +} + +static void fs_event_cb_dir_multi_file_in_subdir(uv_fs_event_t* handle, + const char* filename, + int events, + int status) { + fs_event_cb_called++; + ASSERT(handle == &fs_event); + ASSERT(status == 0); + ASSERT(events == UV_CHANGE || UV_RENAME); + #if defined(__APPLE__) || defined(_WIN32) || defined(__linux__) + ASSERT(strncmp(filename, + file_prefix_in_subdir, + sizeof(file_prefix_in_subdir) - 1) == 0); + #else + ASSERT(filename == NULL || + strncmp(filename, + file_prefix_in_subdir, + sizeof(file_prefix_in_subdir) - 1) == 0); + #endif + + if (fs_event_created + fs_event_removed == fs_event_file_count) { + /* Once we've processed all create events, delete all files */ + ASSERT(0 == uv_timer_start(&timer, fs_event_unlink_files_in_subdir, 1, 0)); + } else if (fs_event_cb_called == 2 * fs_event_file_count) { + /* Once we've processed all create and delete events, stop watching */ + uv_close((uv_handle_t*) &timer, close_cb); + uv_close((uv_handle_t*) handle, close_cb); + } +} +#endif + +static void fs_event_cb_file(uv_fs_event_t* handle, const char* filename, + int events, int status) { + ++fs_event_cb_called; + ASSERT(handle == &fs_event); + ASSERT(status == 0); + ASSERT(events == UV_CHANGE); + #if defined(__APPLE__) || defined(_WIN32) || defined(__linux__) + ASSERT(strcmp(filename, "file2") == 0); + #else + ASSERT(filename == NULL || strcmp(filename, "file2") == 0); + #endif + ASSERT(0 == uv_fs_event_stop(handle)); + uv_close((uv_handle_t*)handle, close_cb); +} + +static void timer_cb_close_handle(uv_timer_t* timer) { + uv_handle_t* handle; + + ASSERT(timer != NULL); + handle = timer->data; + + uv_close((uv_handle_t*)timer, NULL); + uv_close((uv_handle_t*)handle, close_cb); +} + +static void fs_event_cb_file_current_dir(uv_fs_event_t* handle, + const char* filename, int events, int status) { + ASSERT(fs_event_cb_called == 0); + ++fs_event_cb_called; + + ASSERT(handle == &fs_event); + ASSERT(status == 0); + ASSERT(events == UV_CHANGE); + #if defined(__APPLE__) || defined(_WIN32) || defined(__linux__) + ASSERT(strcmp(filename, "watch_file") == 0); + #else + ASSERT(filename == NULL || strcmp(filename, "watch_file") == 0); + #endif + + /* Regression test for SunOS: touch should generate just one event. */ + { + static uv_timer_t timer; + uv_timer_init(handle->loop, &timer); + timer.data = handle; + uv_timer_start(&timer, timer_cb_close_handle, 250, 0); + } +} + +static void timer_cb_file(uv_timer_t* handle) { + ++timer_cb_called; + + if (timer_cb_called == 1) { + touch_file("watch_dir/file1"); + } else { + touch_file("watch_dir/file2"); + uv_close((uv_handle_t*)handle, close_cb); + } +} + +static void timer_cb_touch(uv_timer_t* timer) { + uv_close((uv_handle_t*)timer, NULL); + touch_file("watch_file"); + timer_cb_touch_called++; +} + +static void timer_cb_watch_twice(uv_timer_t* handle) { + uv_fs_event_t* handles = handle->data; + uv_close((uv_handle_t*) (handles + 0), NULL); + uv_close((uv_handle_t*) (handles + 1), NULL); + uv_close((uv_handle_t*) handle, NULL); +} + +TEST_IMPL(fs_event_watch_dir) { + uv_loop_t* loop = uv_default_loop(); + int r; + + /* Setup */ + fs_event_unlink_files(NULL); + remove("watch_dir/file2"); + remove("watch_dir/file1"); + remove("watch_dir/"); + create_dir("watch_dir"); + + r = uv_fs_event_init(loop, &fs_event); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event, fs_event_cb_dir_multi_file, "watch_dir", 0); + ASSERT(r == 0); + r = uv_timer_init(loop, &timer); + ASSERT(r == 0); + r = uv_timer_start(&timer, fs_event_create_files, 100, 0); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(fs_event_cb_called == fs_event_created + fs_event_removed); + ASSERT(close_cb_called == 2); + + /* Cleanup */ + fs_event_unlink_files(NULL); + remove("watch_dir/file2"); + remove("watch_dir/file1"); + remove("watch_dir/"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(fs_event_watch_dir_recursive) { +#if defined(__APPLE__) || defined(_WIN32) + uv_loop_t* loop; + int r; + + /* Setup */ + loop = uv_default_loop(); + fs_event_unlink_files(NULL); + remove("watch_dir/file2"); + remove("watch_dir/file1"); + remove("watch_dir/subdir"); + remove("watch_dir/"); + create_dir("watch_dir"); + create_dir("watch_dir/subdir"); + + r = uv_fs_event_init(loop, &fs_event); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event, fs_event_cb_dir_multi_file_in_subdir, "watch_dir", UV_FS_EVENT_RECURSIVE); + ASSERT(r == 0); + r = uv_timer_init(loop, &timer); + ASSERT(r == 0); + r = uv_timer_start(&timer, fs_event_create_files_in_subdir, 100, 0); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(fs_event_cb_called == fs_event_created + fs_event_removed); + ASSERT(close_cb_called == 2); + + /* Cleanup */ + fs_event_unlink_files_in_subdir(NULL); + remove("watch_dir/file2"); + remove("watch_dir/file1"); + remove("watch_dir/subdir"); + remove("watch_dir/"); + + MAKE_VALGRIND_HAPPY(); + return 0; +#else + RETURN_SKIP("Recursive directory watching not supported on this platform."); +#endif +} + + +TEST_IMPL(fs_event_watch_file) { + uv_loop_t* loop = uv_default_loop(); + int r; + + /* Setup */ + remove("watch_dir/file2"); + remove("watch_dir/file1"); + remove("watch_dir/"); + create_dir("watch_dir"); + create_file("watch_dir/file1"); + create_file("watch_dir/file2"); + + r = uv_fs_event_init(loop, &fs_event); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event, fs_event_cb_file, "watch_dir/file2", 0); + ASSERT(r == 0); + r = uv_timer_init(loop, &timer); + ASSERT(r == 0); + r = uv_timer_start(&timer, timer_cb_file, 100, 100); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(fs_event_cb_called == 1); + ASSERT(timer_cb_called == 2); + ASSERT(close_cb_called == 2); + + /* Cleanup */ + remove("watch_dir/file2"); + remove("watch_dir/file1"); + remove("watch_dir/"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(fs_event_watch_file_twice) { + const char path[] = "test/fixtures/empty_file"; + uv_fs_event_t watchers[2]; + uv_timer_t timer; + uv_loop_t* loop; + + loop = uv_default_loop(); + timer.data = watchers; + + ASSERT(0 == uv_fs_event_init(loop, watchers + 0)); + ASSERT(0 == uv_fs_event_start(watchers + 0, fail_cb, path, 0)); + ASSERT(0 == uv_fs_event_init(loop, watchers + 1)); + ASSERT(0 == uv_fs_event_start(watchers + 1, fail_cb, path, 0)); + ASSERT(0 == uv_timer_init(loop, &timer)); + ASSERT(0 == uv_timer_start(&timer, timer_cb_watch_twice, 10, 0)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(fs_event_watch_file_current_dir) { + uv_timer_t timer; + uv_loop_t* loop; + int r; + + loop = uv_default_loop(); + + /* Setup */ + remove("watch_file"); + create_file("watch_file"); + + r = uv_fs_event_init(loop, &fs_event); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event, + fs_event_cb_file_current_dir, + "watch_file", + 0); + ASSERT(r == 0); + + + r = uv_timer_init(loop, &timer); + ASSERT(r == 0); + + r = uv_timer_start(&timer, timer_cb_touch, 10, 0); + ASSERT(r == 0); + + ASSERT(timer_cb_touch_called == 0); + ASSERT(fs_event_cb_called == 0); + ASSERT(close_cb_called == 0); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(timer_cb_touch_called == 1); + ASSERT(fs_event_cb_called == 1); + ASSERT(close_cb_called == 1); + + /* Cleanup */ + remove("watch_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(fs_event_no_callback_after_close) { + uv_loop_t* loop = uv_default_loop(); + int r; + + /* Setup */ + remove("watch_dir/file1"); + remove("watch_dir/"); + create_dir("watch_dir"); + create_file("watch_dir/file1"); + + r = uv_fs_event_init(loop, &fs_event); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event, + fs_event_cb_file, + "watch_dir/file1", + 0); + ASSERT(r == 0); + + + uv_close((uv_handle_t*)&fs_event, close_cb); + touch_file("watch_dir/file1"); + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(fs_event_cb_called == 0); + ASSERT(close_cb_called == 1); + + /* Cleanup */ + remove("watch_dir/file1"); + remove("watch_dir/"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(fs_event_no_callback_on_close) { + uv_loop_t* loop = uv_default_loop(); + int r; + + /* Setup */ + remove("watch_dir/file1"); + remove("watch_dir/"); + create_dir("watch_dir"); + create_file("watch_dir/file1"); + + r = uv_fs_event_init(loop, &fs_event); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event, + fs_event_cb_file, + "watch_dir/file1", + 0); + ASSERT(r == 0); + + uv_close((uv_handle_t*)&fs_event, close_cb); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(fs_event_cb_called == 0); + ASSERT(close_cb_called == 1); + + /* Cleanup */ + remove("watch_dir/file1"); + remove("watch_dir/"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +static void fs_event_fail(uv_fs_event_t* handle, const char* filename, + int events, int status) { + ASSERT(0 && "should never be called"); +} + + +static void timer_cb(uv_timer_t* handle) { + int r; + + r = uv_fs_event_init(handle->loop, &fs_event); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event, fs_event_fail, ".", 0); + ASSERT(r == 0); + + uv_close((uv_handle_t*)&fs_event, close_cb); + uv_close((uv_handle_t*)handle, close_cb); +} + + +TEST_IMPL(fs_event_immediate_close) { + uv_timer_t timer; + uv_loop_t* loop; + int r; + + loop = uv_default_loop(); + + r = uv_timer_init(loop, &timer); + ASSERT(r == 0); + + r = uv_timer_start(&timer, timer_cb, 1, 0); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_event_close_with_pending_event) { + uv_loop_t* loop; + int r; + + loop = uv_default_loop(); + + create_dir("watch_dir"); + create_file("watch_dir/file"); + + r = uv_fs_event_init(loop, &fs_event); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event, fs_event_fail, "watch_dir", 0); + ASSERT(r == 0); + + /* Generate an fs event. */ + touch_file("watch_dir/file"); + + uv_close((uv_handle_t*)&fs_event, close_cb); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + /* Clean up */ + remove("watch_dir/file"); + remove("watch_dir/"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#if defined(HAVE_KQUEUE) + +/* kqueue doesn't register fs events if you don't have an active watcher. + * The file descriptor needs to be part of the kqueue set of interest and + * that's not the case until we actually enter the event loop. + */ +TEST_IMPL(fs_event_close_in_callback) { + fprintf(stderr, "Skipping test, doesn't work with kqueue.\n"); + return 0; +} + +#else /* !HAVE_KQUEUE */ + +static void fs_event_cb_close(uv_fs_event_t* handle, const char* filename, + int events, int status) { + ASSERT(status == 0); + + ASSERT(fs_event_cb_called < 3); + ++fs_event_cb_called; + + if (fs_event_cb_called == 3) { + uv_close((uv_handle_t*) handle, close_cb); + } +} + + +TEST_IMPL(fs_event_close_in_callback) { + uv_loop_t* loop; + int r; + + loop = uv_default_loop(); + + create_dir("watch_dir"); + create_file("watch_dir/file1"); + create_file("watch_dir/file2"); + create_file("watch_dir/file3"); + create_file("watch_dir/file4"); + create_file("watch_dir/file5"); + + r = uv_fs_event_init(loop, &fs_event); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event, fs_event_cb_close, "watch_dir", 0); + ASSERT(r == 0); + + /* Generate a couple of fs events. */ + touch_file("watch_dir/file1"); + touch_file("watch_dir/file2"); + touch_file("watch_dir/file3"); + touch_file("watch_dir/file4"); + touch_file("watch_dir/file5"); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + ASSERT(fs_event_cb_called == 3); + + /* Clean up */ + remove("watch_dir/file1"); + remove("watch_dir/file2"); + remove("watch_dir/file3"); + remove("watch_dir/file4"); + remove("watch_dir/file5"); + remove("watch_dir/"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* HAVE_KQUEUE */ + +TEST_IMPL(fs_event_start_and_close) { + uv_loop_t* loop; + uv_fs_event_t fs_event1; + uv_fs_event_t fs_event2; + int r; + + loop = uv_default_loop(); + + create_dir("watch_dir"); + + r = uv_fs_event_init(loop, &fs_event1); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event1, fs_event_cb_dir, "watch_dir", 0); + ASSERT(r == 0); + + r = uv_fs_event_init(loop, &fs_event2); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event2, fs_event_cb_dir, "watch_dir", 0); + ASSERT(r == 0); + + uv_close((uv_handle_t*) &fs_event2, close_cb); + uv_close((uv_handle_t*) &fs_event1, close_cb); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 2); + + remove("watch_dir/"); + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(fs_event_getpath) { + uv_loop_t* loop = uv_default_loop(); + int r; + char buf[1024]; + size_t len; + + create_dir("watch_dir"); + + r = uv_fs_event_init(loop, &fs_event); + ASSERT(r == 0); + len = sizeof buf; + r = uv_fs_event_getpath(&fs_event, buf, &len); + ASSERT(r == UV_EINVAL); + r = uv_fs_event_start(&fs_event, fail_cb, "watch_dir", 0); + ASSERT(r == 0); + len = sizeof buf; + r = uv_fs_event_getpath(&fs_event, buf, &len); + ASSERT(r == 0); + ASSERT(buf[len - 1] != 0); + ASSERT(memcmp(buf, "watch_dir", len) == 0); + r = uv_fs_event_stop(&fs_event); + ASSERT(r == 0); + uv_close((uv_handle_t*) &fs_event, close_cb); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + remove("watch_dir/"); + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#if defined(__APPLE__) + +static int fs_event_error_reported; + +static void fs_event_error_report_cb(uv_fs_event_t* handle, + const char* filename, + int events, + int status) { + if (status != 0) + fs_event_error_reported = status; +} + +static void timer_cb_nop(uv_timer_t* handle) { + ++timer_cb_called; + uv_close((uv_handle_t*) handle, close_cb); +} + +static void fs_event_error_report_close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; + + /* handle is allocated on-stack, no need to free it */ +} + + +TEST_IMPL(fs_event_error_reporting) { + unsigned int i; + uv_loop_t loops[1024]; + uv_fs_event_t events[ARRAY_SIZE(loops)]; + uv_loop_t* loop; + uv_fs_event_t* event; + + TEST_FILE_LIMIT(ARRAY_SIZE(loops) * 3); + + remove("watch_dir/"); + create_dir("watch_dir"); + + /* Create a lot of loops, and start FSEventStream in each of them. + * Eventually, this should create enough streams to make FSEventStreamStart() + * fail. + */ + for (i = 0; i < ARRAY_SIZE(loops); i++) { + loop = &loops[i]; + ASSERT(0 == uv_loop_init(loop)); + event = &events[i]; + + timer_cb_called = 0; + close_cb_called = 0; + ASSERT(0 == uv_fs_event_init(loop, event)); + ASSERT(0 == uv_fs_event_start(event, + fs_event_error_report_cb, + "watch_dir", + 0)); + uv_unref((uv_handle_t*) event); + + /* Let loop run for some time */ + ASSERT(0 == uv_timer_init(loop, &timer)); + ASSERT(0 == uv_timer_start(&timer, timer_cb_nop, 2, 0)); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(1 == timer_cb_called); + ASSERT(1 == close_cb_called); + if (fs_event_error_reported != 0) + break; + } + + /* At least one loop should fail */ + ASSERT(fs_event_error_reported == UV_EMFILE); + + /* Stop and close all events, and destroy loops */ + do { + loop = &loops[i]; + event = &events[i]; + + ASSERT(0 == uv_fs_event_stop(event)); + uv_ref((uv_handle_t*) event); + uv_close((uv_handle_t*) event, fs_event_error_report_close_cb); + + close_cb_called = 0; + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(close_cb_called == 1); + + uv_loop_close(loop); + } while (i-- != 0); + + remove("watch_dir/"); + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#else /* !defined(__APPLE__) */ + +TEST_IMPL(fs_event_error_reporting) { + /* No-op, needed only for FSEvents backend */ + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* defined(__APPLE__) */ diff --git a/3rdparty/libuv/test/test-fs-poll.c b/3rdparty/libuv/test/test-fs-poll.c new file mode 100644 index 00000000000..dbc1515b0b1 --- /dev/null +++ b/3rdparty/libuv/test/test-fs-poll.c @@ -0,0 +1,186 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include + +#define FIXTURE "testfile" + +static void timer_cb(uv_timer_t* handle); +static void close_cb(uv_handle_t* handle); +static void poll_cb(uv_fs_poll_t* handle, + int status, + const uv_stat_t* prev, + const uv_stat_t* curr); + +static void poll_cb_fail(uv_fs_poll_t* handle, + int status, + const uv_stat_t* prev, + const uv_stat_t* curr); + +static uv_fs_poll_t poll_handle; +static uv_timer_t timer_handle; +static uv_loop_t* loop; + +static int poll_cb_called; +static int timer_cb_called; +static int close_cb_called; + + +static void touch_file(const char* path) { + static int count; + FILE* fp; + int i; + + ASSERT((fp = fopen(FIXTURE, "w+"))); + + /* Need to change the file size because the poller may not pick up + * sub-second mtime changes. + */ + i = ++count; + + while (i--) + fputc('*', fp); + + fclose(fp); +} + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +static void timer_cb(uv_timer_t* handle) { + touch_file(FIXTURE); + timer_cb_called++; +} + + +static void poll_cb_fail(uv_fs_poll_t* handle, + int status, + const uv_stat_t* prev, + const uv_stat_t* curr) { + ASSERT(0 && "fail_cb called"); +} + + +static void poll_cb(uv_fs_poll_t* handle, + int status, + const uv_stat_t* prev, + const uv_stat_t* curr) { + uv_stat_t zero_statbuf; + + memset(&zero_statbuf, 0, sizeof(zero_statbuf)); + + ASSERT(handle == &poll_handle); + ASSERT(1 == uv_is_active((uv_handle_t*) handle)); + ASSERT(prev != NULL); + ASSERT(curr != NULL); + + switch (poll_cb_called++) { + case 0: + ASSERT(status == UV_ENOENT); + ASSERT(0 == memcmp(prev, &zero_statbuf, sizeof(zero_statbuf))); + ASSERT(0 == memcmp(curr, &zero_statbuf, sizeof(zero_statbuf))); + touch_file(FIXTURE); + break; + + case 1: + ASSERT(status == 0); + ASSERT(0 == memcmp(prev, &zero_statbuf, sizeof(zero_statbuf))); + ASSERT(0 != memcmp(curr, &zero_statbuf, sizeof(zero_statbuf))); + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 20, 0)); + break; + + case 2: + ASSERT(status == 0); + ASSERT(0 != memcmp(prev, &zero_statbuf, sizeof(zero_statbuf))); + ASSERT(0 != memcmp(curr, &zero_statbuf, sizeof(zero_statbuf))); + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 200, 0)); + break; + + case 3: + ASSERT(status == 0); + ASSERT(0 != memcmp(prev, &zero_statbuf, sizeof(zero_statbuf))); + ASSERT(0 != memcmp(curr, &zero_statbuf, sizeof(zero_statbuf))); + remove(FIXTURE); + break; + + case 4: + ASSERT(status == UV_ENOENT); + ASSERT(0 != memcmp(prev, &zero_statbuf, sizeof(zero_statbuf))); + ASSERT(0 == memcmp(curr, &zero_statbuf, sizeof(zero_statbuf))); + uv_close((uv_handle_t*)handle, close_cb); + break; + + default: + ASSERT(0); + } +} + + +TEST_IMPL(fs_poll) { + loop = uv_default_loop(); + + remove(FIXTURE); + + ASSERT(0 == uv_timer_init(loop, &timer_handle)); + ASSERT(0 == uv_fs_poll_init(loop, &poll_handle)); + ASSERT(0 == uv_fs_poll_start(&poll_handle, poll_cb, FIXTURE, 100)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + ASSERT(poll_cb_called == 5); + ASSERT(timer_cb_called == 2); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_poll_getpath) { + char buf[1024]; + size_t len; + loop = uv_default_loop(); + + remove(FIXTURE); + + ASSERT(0 == uv_fs_poll_init(loop, &poll_handle)); + len = sizeof buf; + ASSERT(UV_EINVAL == uv_fs_poll_getpath(&poll_handle, buf, &len)); + ASSERT(0 == uv_fs_poll_start(&poll_handle, poll_cb_fail, FIXTURE, 100)); + len = sizeof buf; + ASSERT(0 == uv_fs_poll_getpath(&poll_handle, buf, &len)); + ASSERT(buf[len - 1] != 0); + ASSERT(0 == memcmp(buf, FIXTURE, len)); + + uv_close((uv_handle_t*) &poll_handle, close_cb); + + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-fs.c b/3rdparty/libuv/test/test-fs.c new file mode 100644 index 00000000000..cf37ac4909c --- /dev/null +++ b/3rdparty/libuv/test/test-fs.c @@ -0,0 +1,2664 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include /* memset */ +#include +#include + +/* FIXME we shouldn't need to branch in this file */ +#if defined(__unix__) || defined(__POSIX__) || \ + defined(__APPLE__) || defined(_AIX) +#include /* unlink, rmdir, etc. */ +#else +# include +# include +# define unlink _unlink +# define rmdir _rmdir +# define open _open +# define write _write +# define close _close +# ifndef stat +# define stat _stati64 +# endif +# ifndef lseek +# define lseek _lseek +# endif +#endif + +#define TOO_LONG_NAME_LENGTH 65536 +#define PATHMAX 1024 + +typedef struct { + const char* path; + double atime; + double mtime; +} utime_check_t; + + +static int dummy_cb_count; +static int close_cb_count; +static int create_cb_count; +static int open_cb_count; +static int read_cb_count; +static int write_cb_count; +static int unlink_cb_count; +static int mkdir_cb_count; +static int mkdtemp_cb_count; +static int rmdir_cb_count; +static int scandir_cb_count; +static int stat_cb_count; +static int rename_cb_count; +static int fsync_cb_count; +static int fdatasync_cb_count; +static int ftruncate_cb_count; +static int sendfile_cb_count; +static int fstat_cb_count; +static int access_cb_count; +static int chmod_cb_count; +static int fchmod_cb_count; +static int chown_cb_count; +static int fchown_cb_count; +static int link_cb_count; +static int symlink_cb_count; +static int readlink_cb_count; +static int realpath_cb_count; +static int utime_cb_count; +static int futime_cb_count; + +static uv_loop_t* loop; + +static uv_fs_t open_req1; +static uv_fs_t open_req2; +static uv_fs_t read_req; +static uv_fs_t write_req; +static uv_fs_t unlink_req; +static uv_fs_t close_req; +static uv_fs_t mkdir_req; +static uv_fs_t mkdtemp_req1; +static uv_fs_t mkdtemp_req2; +static uv_fs_t rmdir_req; +static uv_fs_t scandir_req; +static uv_fs_t stat_req; +static uv_fs_t rename_req; +static uv_fs_t fsync_req; +static uv_fs_t fdatasync_req; +static uv_fs_t ftruncate_req; +static uv_fs_t sendfile_req; +static uv_fs_t utime_req; +static uv_fs_t futime_req; + +static char buf[32]; +static char buf2[32]; +static char test_buf[] = "test-buffer\n"; +static char test_buf2[] = "second-buffer\n"; +static uv_buf_t iov; + +static void check_permission(const char* filename, unsigned int mode) { + int r; + uv_fs_t req; + uv_stat_t* s; + + r = uv_fs_stat(NULL, &req, filename, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + + s = &req.statbuf; +#ifdef _WIN32 + /* + * On Windows, chmod can only modify S_IWUSR (_S_IWRITE) bit, + * so only testing for the specified flags. + */ + ASSERT((s->st_mode & 0777) & mode); +#else + ASSERT((s->st_mode & 0777) == mode); +#endif + + uv_fs_req_cleanup(&req); +} + + +static void dummy_cb(uv_fs_t* req) { + (void) req; + dummy_cb_count++; +} + + +static void link_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_LINK); + ASSERT(req->result == 0); + link_cb_count++; + uv_fs_req_cleanup(req); +} + + +static void symlink_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_SYMLINK); + ASSERT(req->result == 0); + symlink_cb_count++; + uv_fs_req_cleanup(req); +} + +static void readlink_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_READLINK); + ASSERT(req->result == 0); + ASSERT(strcmp(req->ptr, "test_file_symlink2") == 0); + readlink_cb_count++; + uv_fs_req_cleanup(req); +} + + +static void realpath_cb(uv_fs_t* req) { + char test_file_abs_buf[PATHMAX]; + size_t test_file_abs_size = sizeof(test_file_abs_buf); + ASSERT(req->fs_type == UV_FS_REALPATH); +#ifdef _WIN32 + /* + * Windows XP and Server 2003 don't support GetFinalPathNameByHandleW() + */ + if (req->result == UV_ENOSYS) { + realpath_cb_count++; + uv_fs_req_cleanup(req); + return; + } +#endif + ASSERT(req->result == 0); + + uv_cwd(test_file_abs_buf, &test_file_abs_size); +#ifdef _WIN32 + strcat(test_file_abs_buf, "\\test_file"); + ASSERT(stricmp(req->ptr, test_file_abs_buf) == 0); +#else + strcat(test_file_abs_buf, "/test_file"); + ASSERT(strcmp(req->ptr, test_file_abs_buf) == 0); +#endif + realpath_cb_count++; + uv_fs_req_cleanup(req); +} + + +static void access_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_ACCESS); + access_cb_count++; + uv_fs_req_cleanup(req); +} + + +static void fchmod_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_FCHMOD); + ASSERT(req->result == 0); + fchmod_cb_count++; + uv_fs_req_cleanup(req); + check_permission("test_file", *(int*)req->data); +} + + +static void chmod_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_CHMOD); + ASSERT(req->result == 0); + chmod_cb_count++; + uv_fs_req_cleanup(req); + check_permission("test_file", *(int*)req->data); +} + + +static void fchown_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_FCHOWN); + ASSERT(req->result == 0); + fchown_cb_count++; + uv_fs_req_cleanup(req); +} + + +static void chown_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_CHOWN); + ASSERT(req->result == 0); + chown_cb_count++; + uv_fs_req_cleanup(req); +} + +static void chown_root_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_CHOWN); +#ifdef _WIN32 + /* On windows, chown is a no-op and always succeeds. */ + ASSERT(req->result == 0); +#else + /* On unix, chown'ing the root directory is not allowed - + * unless you're root, of course. + */ + if (geteuid() == 0) + ASSERT(req->result == 0); + else + ASSERT(req->result == UV_EPERM); +#endif + chown_cb_count++; + uv_fs_req_cleanup(req); +} + +static void unlink_cb(uv_fs_t* req) { + ASSERT(req == &unlink_req); + ASSERT(req->fs_type == UV_FS_UNLINK); + ASSERT(req->result == 0); + unlink_cb_count++; + uv_fs_req_cleanup(req); +} + +static void fstat_cb(uv_fs_t* req) { + uv_stat_t* s = req->ptr; + ASSERT(req->fs_type == UV_FS_FSTAT); + ASSERT(req->result == 0); + ASSERT(s->st_size == sizeof(test_buf)); + uv_fs_req_cleanup(req); + fstat_cb_count++; +} + + +static void close_cb(uv_fs_t* req) { + int r; + ASSERT(req == &close_req); + ASSERT(req->fs_type == UV_FS_CLOSE); + ASSERT(req->result == 0); + close_cb_count++; + uv_fs_req_cleanup(req); + if (close_cb_count == 3) { + r = uv_fs_unlink(loop, &unlink_req, "test_file2", unlink_cb); + ASSERT(r == 0); + } +} + + +static void ftruncate_cb(uv_fs_t* req) { + int r; + ASSERT(req == &ftruncate_req); + ASSERT(req->fs_type == UV_FS_FTRUNCATE); + ASSERT(req->result == 0); + ftruncate_cb_count++; + uv_fs_req_cleanup(req); + r = uv_fs_close(loop, &close_req, open_req1.result, close_cb); + ASSERT(r == 0); +} + + +static void read_cb(uv_fs_t* req) { + int r; + ASSERT(req == &read_req); + ASSERT(req->fs_type == UV_FS_READ); + ASSERT(req->result >= 0); /* FIXME(bnoordhuis) Check if requested size? */ + read_cb_count++; + uv_fs_req_cleanup(req); + if (read_cb_count == 1) { + ASSERT(strcmp(buf, test_buf) == 0); + r = uv_fs_ftruncate(loop, &ftruncate_req, open_req1.result, 7, + ftruncate_cb); + } else { + ASSERT(strcmp(buf, "test-bu") == 0); + r = uv_fs_close(loop, &close_req, open_req1.result, close_cb); + } + ASSERT(r == 0); +} + + +static void open_cb(uv_fs_t* req) { + int r; + ASSERT(req == &open_req1); + ASSERT(req->fs_type == UV_FS_OPEN); + if (req->result < 0) { + fprintf(stderr, "async open error: %d\n", (int) req->result); + ASSERT(0); + } + open_cb_count++; + ASSERT(req->path); + ASSERT(memcmp(req->path, "test_file2\0", 11) == 0); + uv_fs_req_cleanup(req); + memset(buf, 0, sizeof(buf)); + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(loop, &read_req, open_req1.result, &iov, 1, -1, + read_cb); + ASSERT(r == 0); +} + + +static void open_cb_simple(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_OPEN); + if (req->result < 0) { + fprintf(stderr, "async open error: %d\n", (int) req->result); + ASSERT(0); + } + open_cb_count++; + ASSERT(req->path); + uv_fs_req_cleanup(req); +} + + +static void fsync_cb(uv_fs_t* req) { + int r; + ASSERT(req == &fsync_req); + ASSERT(req->fs_type == UV_FS_FSYNC); + ASSERT(req->result == 0); + fsync_cb_count++; + uv_fs_req_cleanup(req); + r = uv_fs_close(loop, &close_req, open_req1.result, close_cb); + ASSERT(r == 0); +} + + +static void fdatasync_cb(uv_fs_t* req) { + int r; + ASSERT(req == &fdatasync_req); + ASSERT(req->fs_type == UV_FS_FDATASYNC); + ASSERT(req->result == 0); + fdatasync_cb_count++; + uv_fs_req_cleanup(req); + r = uv_fs_fsync(loop, &fsync_req, open_req1.result, fsync_cb); + ASSERT(r == 0); +} + + +static void write_cb(uv_fs_t* req) { + int r; + ASSERT(req == &write_req); + ASSERT(req->fs_type == UV_FS_WRITE); + ASSERT(req->result >= 0); /* FIXME(bnoordhuis) Check if requested size? */ + write_cb_count++; + uv_fs_req_cleanup(req); + r = uv_fs_fdatasync(loop, &fdatasync_req, open_req1.result, fdatasync_cb); + ASSERT(r == 0); +} + + +static void create_cb(uv_fs_t* req) { + int r; + ASSERT(req == &open_req1); + ASSERT(req->fs_type == UV_FS_OPEN); + ASSERT(req->result >= 0); + create_cb_count++; + uv_fs_req_cleanup(req); + iov = uv_buf_init(test_buf, sizeof(test_buf)); + r = uv_fs_write(loop, &write_req, req->result, &iov, 1, -1, write_cb); + ASSERT(r == 0); +} + + +static void rename_cb(uv_fs_t* req) { + ASSERT(req == &rename_req); + ASSERT(req->fs_type == UV_FS_RENAME); + ASSERT(req->result == 0); + rename_cb_count++; + uv_fs_req_cleanup(req); +} + + +static void mkdir_cb(uv_fs_t* req) { + ASSERT(req == &mkdir_req); + ASSERT(req->fs_type == UV_FS_MKDIR); + ASSERT(req->result == 0); + mkdir_cb_count++; + ASSERT(req->path); + ASSERT(memcmp(req->path, "test_dir\0", 9) == 0); + uv_fs_req_cleanup(req); +} + + +static void check_mkdtemp_result(uv_fs_t* req) { + int r; + + ASSERT(req->fs_type == UV_FS_MKDTEMP); + ASSERT(req->result == 0); + ASSERT(req->path); + ASSERT(strlen(req->path) == 15); + ASSERT(memcmp(req->path, "test_dir_", 9) == 0); + ASSERT(memcmp(req->path + 9, "XXXXXX", 6) != 0); + check_permission(req->path, 0700); + + /* Check if req->path is actually a directory */ + r = uv_fs_stat(NULL, &stat_req, req->path, NULL); + ASSERT(r == 0); + ASSERT(((uv_stat_t*)stat_req.ptr)->st_mode & S_IFDIR); + uv_fs_req_cleanup(&stat_req); +} + + +static void mkdtemp_cb(uv_fs_t* req) { + ASSERT(req == &mkdtemp_req1); + check_mkdtemp_result(req); + mkdtemp_cb_count++; +} + + +static void rmdir_cb(uv_fs_t* req) { + ASSERT(req == &rmdir_req); + ASSERT(req->fs_type == UV_FS_RMDIR); + ASSERT(req->result == 0); + rmdir_cb_count++; + ASSERT(req->path); + ASSERT(memcmp(req->path, "test_dir\0", 9) == 0); + uv_fs_req_cleanup(req); +} + + +static void assert_is_file_type(uv_dirent_t dent) { +#ifdef HAVE_DIRENT_TYPES + /* + * For Apple and Windows, we know getdents is expected to work but for other + * environments, the filesystem dictates whether or not getdents supports + * returning the file type. + * + * See: + * http://man7.org/linux/man-pages/man2/getdents.2.html + * https://github.com/libuv/libuv/issues/501 + */ + #if defined(__APPLE__) || defined(_WIN32) + ASSERT(dent.type == UV_DIRENT_FILE); + #else + ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN); + #endif +#else + ASSERT(dent.type == UV_DIRENT_UNKNOWN); +#endif +} + + +static void scandir_cb(uv_fs_t* req) { + uv_dirent_t dent; + ASSERT(req == &scandir_req); + ASSERT(req->fs_type == UV_FS_SCANDIR); + ASSERT(req->result == 2); + ASSERT(req->ptr); + + while (UV_EOF != uv_fs_scandir_next(req, &dent)) { + ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); + assert_is_file_type(dent); + } + scandir_cb_count++; + ASSERT(req->path); + ASSERT(memcmp(req->path, "test_dir\0", 9) == 0); + uv_fs_req_cleanup(req); + ASSERT(!req->ptr); +} + + +static void empty_scandir_cb(uv_fs_t* req) { + uv_dirent_t dent; + + ASSERT(req == &scandir_req); + ASSERT(req->fs_type == UV_FS_SCANDIR); + ASSERT(req->result == 0); + ASSERT(req->ptr == NULL); + ASSERT(UV_EOF == uv_fs_scandir_next(req, &dent)); + uv_fs_req_cleanup(req); + scandir_cb_count++; +} + + +static void file_scandir_cb(uv_fs_t* req) { + ASSERT(req == &scandir_req); + ASSERT(req->fs_type == UV_FS_SCANDIR); + ASSERT(req->result == UV_ENOTDIR); + ASSERT(req->ptr == NULL); + uv_fs_req_cleanup(req); + scandir_cb_count++; +} + + +static void stat_cb(uv_fs_t* req) { + ASSERT(req == &stat_req); + ASSERT(req->fs_type == UV_FS_STAT || req->fs_type == UV_FS_LSTAT); + ASSERT(req->result == 0); + ASSERT(req->ptr); + stat_cb_count++; + uv_fs_req_cleanup(req); + ASSERT(!req->ptr); +} + + +static void sendfile_cb(uv_fs_t* req) { + ASSERT(req == &sendfile_req); + ASSERT(req->fs_type == UV_FS_SENDFILE); + ASSERT(req->result == 65546); + sendfile_cb_count++; + uv_fs_req_cleanup(req); +} + + +static void open_noent_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_OPEN); + ASSERT(req->result == UV_ENOENT); + open_cb_count++; + uv_fs_req_cleanup(req); +} + +static void open_nametoolong_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_OPEN); + ASSERT(req->result == UV_ENAMETOOLONG); + open_cb_count++; + uv_fs_req_cleanup(req); +} + +static void open_loop_cb(uv_fs_t* req) { + ASSERT(req->fs_type == UV_FS_OPEN); + ASSERT(req->result == UV_ELOOP); + open_cb_count++; + uv_fs_req_cleanup(req); +} + + +TEST_IMPL(fs_file_noent) { + uv_fs_t req; + int r; + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &req, "does_not_exist", O_RDONLY, 0, NULL); + ASSERT(r == UV_ENOENT); + ASSERT(req.result == UV_ENOENT); + uv_fs_req_cleanup(&req); + + r = uv_fs_open(loop, &req, "does_not_exist", O_RDONLY, 0, open_noent_cb); + ASSERT(r == 0); + + ASSERT(open_cb_count == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(open_cb_count == 1); + + /* TODO add EACCES test */ + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(fs_file_nametoolong) { + uv_fs_t req; + int r; + char name[TOO_LONG_NAME_LENGTH + 1]; + + loop = uv_default_loop(); + + memset(name, 'a', TOO_LONG_NAME_LENGTH); + name[TOO_LONG_NAME_LENGTH] = 0; + + r = uv_fs_open(NULL, &req, name, O_RDONLY, 0, NULL); + ASSERT(r == UV_ENAMETOOLONG); + ASSERT(req.result == UV_ENAMETOOLONG); + uv_fs_req_cleanup(&req); + + r = uv_fs_open(loop, &req, name, O_RDONLY, 0, open_nametoolong_cb); + ASSERT(r == 0); + + ASSERT(open_cb_count == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(open_cb_count == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(fs_file_loop) { + uv_fs_t req; + int r; + + loop = uv_default_loop(); + + unlink("test_symlink"); + r = uv_fs_symlink(NULL, &req, "test_symlink", "test_symlink", 0, NULL); +#ifdef _WIN32 + /* + * Windows XP and Server 2003 don't support symlinks; we'll get UV_ENOTSUP. + * Starting with vista they are supported, but only when elevated, otherwise + * we'll see UV_EPERM. + */ + if (r == UV_ENOTSUP || r == UV_EPERM) + return 0; +#endif + ASSERT(r == 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_open(NULL, &req, "test_symlink", O_RDONLY, 0, NULL); + ASSERT(r == UV_ELOOP); + ASSERT(req.result == UV_ELOOP); + uv_fs_req_cleanup(&req); + + r = uv_fs_open(loop, &req, "test_symlink", O_RDONLY, 0, open_loop_cb); + ASSERT(r == 0); + + ASSERT(open_cb_count == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(open_cb_count == 1); + + unlink("test_symlink"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +static void check_utime(const char* path, double atime, double mtime) { + uv_stat_t* s; + uv_fs_t req; + int r; + + r = uv_fs_stat(loop, &req, path, NULL); + ASSERT(r == 0); + + ASSERT(req.result == 0); + s = &req.statbuf; + + ASSERT(s->st_atim.tv_sec == atime); + ASSERT(s->st_mtim.tv_sec == mtime); + + uv_fs_req_cleanup(&req); +} + + +static void utime_cb(uv_fs_t* req) { + utime_check_t* c; + + ASSERT(req == &utime_req); + ASSERT(req->result == 0); + ASSERT(req->fs_type == UV_FS_UTIME); + + c = req->data; + check_utime(c->path, c->atime, c->mtime); + + uv_fs_req_cleanup(req); + utime_cb_count++; +} + + +static void futime_cb(uv_fs_t* req) { + utime_check_t* c; + + ASSERT(req == &futime_req); + ASSERT(req->result == 0); + ASSERT(req->fs_type == UV_FS_FUTIME); + + c = req->data; + check_utime(c->path, c->atime, c->mtime); + + uv_fs_req_cleanup(req); + futime_cb_count++; +} + + +TEST_IMPL(fs_file_async) { + int r; + + /* Setup. */ + unlink("test_file"); + unlink("test_file2"); + + loop = uv_default_loop(); + + r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT, + S_IRUSR | S_IWUSR, create_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(create_cb_count == 1); + ASSERT(write_cb_count == 1); + ASSERT(fsync_cb_count == 1); + ASSERT(fdatasync_cb_count == 1); + ASSERT(close_cb_count == 1); + + r = uv_fs_rename(loop, &rename_req, "test_file", "test_file2", rename_cb); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(create_cb_count == 1); + ASSERT(write_cb_count == 1); + ASSERT(close_cb_count == 1); + ASSERT(rename_cb_count == 1); + + r = uv_fs_open(loop, &open_req1, "test_file2", O_RDWR, 0, open_cb); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(open_cb_count == 1); + ASSERT(read_cb_count == 1); + ASSERT(close_cb_count == 2); + ASSERT(rename_cb_count == 1); + ASSERT(create_cb_count == 1); + ASSERT(write_cb_count == 1); + ASSERT(ftruncate_cb_count == 1); + + r = uv_fs_open(loop, &open_req1, "test_file2", O_RDONLY, 0, open_cb); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(open_cb_count == 2); + ASSERT(read_cb_count == 2); + ASSERT(close_cb_count == 3); + ASSERT(rename_cb_count == 1); + ASSERT(unlink_cb_count == 1); + ASSERT(create_cb_count == 1); + ASSERT(write_cb_count == 1); + ASSERT(ftruncate_cb_count == 1); + + /* Cleanup. */ + unlink("test_file"); + unlink("test_file2"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_file_sync) { + int r; + + /* Setup. */ + unlink("test_file"); + unlink("test_file2"); + + loop = uv_default_loop(); + + r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + iov = uv_buf_init(test_buf, sizeof(test_buf)); + r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r >= 0); + ASSERT(write_req.result >= 0); + uv_fs_req_cleanup(&write_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_open(NULL, &open_req1, "test_file", O_RDWR, 0, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r >= 0); + ASSERT(read_req.result >= 0); + ASSERT(strcmp(buf, test_buf) == 0); + uv_fs_req_cleanup(&read_req); + + r = uv_fs_ftruncate(NULL, &ftruncate_req, open_req1.result, 7, NULL); + ASSERT(r == 0); + ASSERT(ftruncate_req.result == 0); + uv_fs_req_cleanup(&ftruncate_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_rename(NULL, &rename_req, "test_file", "test_file2", NULL); + ASSERT(r == 0); + ASSERT(rename_req.result == 0); + uv_fs_req_cleanup(&rename_req); + + r = uv_fs_open(NULL, &open_req1, "test_file2", O_RDONLY, 0, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + memset(buf, 0, sizeof(buf)); + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r >= 0); + ASSERT(read_req.result >= 0); + ASSERT(strcmp(buf, "test-bu") == 0); + uv_fs_req_cleanup(&read_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_unlink(NULL, &unlink_req, "test_file2", NULL); + ASSERT(r == 0); + ASSERT(unlink_req.result == 0); + uv_fs_req_cleanup(&unlink_req); + + /* Cleanup */ + unlink("test_file"); + unlink("test_file2"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_file_write_null_buffer) { + int r; + + /* Setup. */ + unlink("test_file"); + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &open_req1, "test_file", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + iov = uv_buf_init(NULL, 0); + r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r == 0); + ASSERT(write_req.result == 0); + uv_fs_req_cleanup(&write_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + unlink("test_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_async_dir) { + int r; + uv_dirent_t dent; + + /* Setup */ + unlink("test_dir/file1"); + unlink("test_dir/file2"); + rmdir("test_dir"); + + loop = uv_default_loop(); + + r = uv_fs_mkdir(loop, &mkdir_req, "test_dir", 0755, mkdir_cb); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(mkdir_cb_count == 1); + + /* Create 2 files synchronously. */ + r = uv_fs_open(NULL, &open_req1, "test_dir/file1", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + uv_fs_req_cleanup(&open_req1); + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_open(NULL, &open_req1, "test_dir/file2", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + uv_fs_req_cleanup(&open_req1); + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_scandir(loop, &scandir_req, "test_dir", 0, scandir_cb); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(scandir_cb_count == 1); + + /* sync uv_fs_scandir */ + r = uv_fs_scandir(NULL, &scandir_req, "test_dir", 0, NULL); + ASSERT(r == 2); + ASSERT(scandir_req.result == 2); + ASSERT(scandir_req.ptr); + while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) { + ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); + assert_is_file_type(dent); + } + uv_fs_req_cleanup(&scandir_req); + ASSERT(!scandir_req.ptr); + + r = uv_fs_stat(loop, &stat_req, "test_dir", stat_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + + r = uv_fs_stat(loop, &stat_req, "test_dir/", stat_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + + r = uv_fs_lstat(loop, &stat_req, "test_dir", stat_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + + r = uv_fs_lstat(loop, &stat_req, "test_dir/", stat_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(stat_cb_count == 4); + + r = uv_fs_unlink(loop, &unlink_req, "test_dir/file1", unlink_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(unlink_cb_count == 1); + + r = uv_fs_unlink(loop, &unlink_req, "test_dir/file2", unlink_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(unlink_cb_count == 2); + + r = uv_fs_rmdir(loop, &rmdir_req, "test_dir", rmdir_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(rmdir_cb_count == 1); + + /* Cleanup */ + unlink("test_dir/file1"); + unlink("test_dir/file2"); + rmdir("test_dir"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_async_sendfile) { + int f, r; + struct stat s1, s2; + + loop = uv_default_loop(); + + /* Setup. */ + unlink("test_file"); + unlink("test_file2"); + + f = open("test_file", O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR); + ASSERT(f != -1); + + r = write(f, "begin\n", 6); + ASSERT(r == 6); + + r = lseek(f, 65536, SEEK_CUR); + ASSERT(r == 65542); + + r = write(f, "end\n", 4); + ASSERT(r != -1); + + r = close(f); + ASSERT(r == 0); + + /* Test starts here. */ + r = uv_fs_open(NULL, &open_req1, "test_file", O_RDWR, 0, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + r = uv_fs_open(NULL, &open_req2, "test_file2", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(open_req2.result >= 0); + uv_fs_req_cleanup(&open_req2); + + r = uv_fs_sendfile(loop, &sendfile_req, open_req2.result, open_req1.result, + 0, 131072, sendfile_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(sendfile_cb_count == 1); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&close_req); + r = uv_fs_close(NULL, &close_req, open_req2.result, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&close_req); + + stat("test_file", &s1); + stat("test_file2", &s2); + ASSERT(65546 == s2.st_size && s1.st_size == s2.st_size); + + /* Cleanup. */ + unlink("test_file"); + unlink("test_file2"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_mkdtemp) { + int r; + const char* path_template = "test_dir_XXXXXX"; + + loop = uv_default_loop(); + + r = uv_fs_mkdtemp(loop, &mkdtemp_req1, path_template, mkdtemp_cb); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(mkdtemp_cb_count == 1); + + /* sync mkdtemp */ + r = uv_fs_mkdtemp(NULL, &mkdtemp_req2, path_template, NULL); + ASSERT(r == 0); + check_mkdtemp_result(&mkdtemp_req2); + + /* mkdtemp return different values on subsequent calls */ + ASSERT(strcmp(mkdtemp_req1.path, mkdtemp_req2.path) != 0); + + /* Cleanup */ + rmdir(mkdtemp_req1.path); + rmdir(mkdtemp_req2.path); + uv_fs_req_cleanup(&mkdtemp_req1); + uv_fs_req_cleanup(&mkdtemp_req2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_fstat) { + int r; + uv_fs_t req; + uv_file file; + uv_stat_t* s; +#ifndef _WIN32 + struct stat t; +#endif + + /* Setup. */ + unlink("test_file"); + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + file = req.result; + uv_fs_req_cleanup(&req); + + iov = uv_buf_init(test_buf, sizeof(test_buf)); + r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL); + ASSERT(r == sizeof(test_buf)); + ASSERT(req.result == sizeof(test_buf)); + uv_fs_req_cleanup(&req); + + r = uv_fs_fstat(NULL, &req, file, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + s = req.ptr; + ASSERT(s->st_size == sizeof(test_buf)); + +#ifndef _WIN32 + r = fstat(file, &t); + ASSERT(r == 0); + + ASSERT(s->st_dev == (uint64_t) t.st_dev); + ASSERT(s->st_mode == (uint64_t) t.st_mode); + ASSERT(s->st_nlink == (uint64_t) t.st_nlink); + ASSERT(s->st_uid == (uint64_t) t.st_uid); + ASSERT(s->st_gid == (uint64_t) t.st_gid); + ASSERT(s->st_rdev == (uint64_t) t.st_rdev); + ASSERT(s->st_ino == (uint64_t) t.st_ino); + ASSERT(s->st_size == (uint64_t) t.st_size); + ASSERT(s->st_blksize == (uint64_t) t.st_blksize); + ASSERT(s->st_blocks == (uint64_t) t.st_blocks); +#if defined(__APPLE__) + ASSERT(s->st_atim.tv_sec == t.st_atimespec.tv_sec); + ASSERT(s->st_atim.tv_nsec == t.st_atimespec.tv_nsec); + ASSERT(s->st_mtim.tv_sec == t.st_mtimespec.tv_sec); + ASSERT(s->st_mtim.tv_nsec == t.st_mtimespec.tv_nsec); + ASSERT(s->st_ctim.tv_sec == t.st_ctimespec.tv_sec); + ASSERT(s->st_ctim.tv_nsec == t.st_ctimespec.tv_nsec); + ASSERT(s->st_birthtim.tv_sec == t.st_birthtimespec.tv_sec); + ASSERT(s->st_birthtim.tv_nsec == t.st_birthtimespec.tv_nsec); + ASSERT(s->st_flags == t.st_flags); + ASSERT(s->st_gen == t.st_gen); +#elif defined(_AIX) + ASSERT(s->st_atim.tv_sec == t.st_atime); + ASSERT(s->st_atim.tv_nsec == 0); + ASSERT(s->st_mtim.tv_sec == t.st_mtime); + ASSERT(s->st_mtim.tv_nsec == 0); + ASSERT(s->st_ctim.tv_sec == t.st_ctime); + ASSERT(s->st_ctim.tv_nsec == 0); +#elif defined(__sun) || \ + defined(_BSD_SOURCE) || \ + defined(_SVID_SOURCE) || \ + defined(_XOPEN_SOURCE) || \ + defined(_DEFAULT_SOURCE) + ASSERT(s->st_atim.tv_sec == t.st_atim.tv_sec); + ASSERT(s->st_atim.tv_nsec == t.st_atim.tv_nsec); + ASSERT(s->st_mtim.tv_sec == t.st_mtim.tv_sec); + ASSERT(s->st_mtim.tv_nsec == t.st_mtim.tv_nsec); + ASSERT(s->st_ctim.tv_sec == t.st_ctim.tv_sec); + ASSERT(s->st_ctim.tv_nsec == t.st_ctim.tv_nsec); +# if defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) + ASSERT(s->st_birthtim.tv_sec == t.st_birthtim.tv_sec); + ASSERT(s->st_birthtim.tv_nsec == t.st_birthtim.tv_nsec); + ASSERT(s->st_flags == t.st_flags); + ASSERT(s->st_gen == t.st_gen); +# endif +#else + ASSERT(s->st_atim.tv_sec == t.st_atime); + ASSERT(s->st_atim.tv_nsec == 0); + ASSERT(s->st_mtim.tv_sec == t.st_mtime); + ASSERT(s->st_mtim.tv_nsec == 0); + ASSERT(s->st_ctim.tv_sec == t.st_ctime); + ASSERT(s->st_ctim.tv_nsec == 0); +#endif +#endif + + uv_fs_req_cleanup(&req); + + /* Now do the uv_fs_fstat call asynchronously */ + r = uv_fs_fstat(loop, &req, file, fstat_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(fstat_cb_count == 1); + + + r = uv_fs_close(NULL, &req, file, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + /* + * Run the loop just to check we don't have make any extraneous uv_ref() + * calls. This should drop out immediately. + */ + uv_run(loop, UV_RUN_DEFAULT); + + /* Cleanup. */ + unlink("test_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_access) { + int r; + uv_fs_t req; + uv_file file; + + /* Setup. */ + unlink("test_file"); + rmdir("test_dir"); + + loop = uv_default_loop(); + + /* File should not exist */ + r = uv_fs_access(NULL, &req, "test_file", F_OK, NULL); + ASSERT(r < 0); + ASSERT(req.result < 0); + uv_fs_req_cleanup(&req); + + /* File should not exist */ + r = uv_fs_access(loop, &req, "test_file", F_OK, access_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(access_cb_count == 1); + access_cb_count = 0; /* reset for the next test */ + + /* Create file */ + r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + file = req.result; + uv_fs_req_cleanup(&req); + + /* File should exist */ + r = uv_fs_access(NULL, &req, "test_file", F_OK, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + /* File should exist */ + r = uv_fs_access(loop, &req, "test_file", F_OK, access_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(access_cb_count == 1); + access_cb_count = 0; /* reset for the next test */ + + /* Close file */ + r = uv_fs_close(NULL, &req, file, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + /* Directory access */ + r = uv_fs_mkdir(NULL, &req, "test_dir", 0777, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_access(NULL, &req, "test_dir", W_OK, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + /* + * Run the loop just to check we don't have make any extraneous uv_ref() + * calls. This should drop out immediately. + */ + uv_run(loop, UV_RUN_DEFAULT); + + /* Cleanup. */ + unlink("test_file"); + rmdir("test_dir"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_chmod) { + int r; + uv_fs_t req; + uv_file file; + + /* Setup. */ + unlink("test_file"); + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + file = req.result; + uv_fs_req_cleanup(&req); + + iov = uv_buf_init(test_buf, sizeof(test_buf)); + r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL); + ASSERT(r == sizeof(test_buf)); + ASSERT(req.result == sizeof(test_buf)); + uv_fs_req_cleanup(&req); + +#ifndef _WIN32 + /* Make the file write-only */ + r = uv_fs_chmod(NULL, &req, "test_file", 0200, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + check_permission("test_file", 0200); +#endif + + /* Make the file read-only */ + r = uv_fs_chmod(NULL, &req, "test_file", 0400, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + check_permission("test_file", 0400); + + /* Make the file read+write with sync uv_fs_fchmod */ + r = uv_fs_fchmod(NULL, &req, file, 0600, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + check_permission("test_file", 0600); + +#ifndef _WIN32 + /* async chmod */ + { + static int mode = 0200; + req.data = &mode; + } + r = uv_fs_chmod(loop, &req, "test_file", 0200, chmod_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(chmod_cb_count == 1); + chmod_cb_count = 0; /* reset for the next test */ +#endif + + /* async chmod */ + { + static int mode = 0400; + req.data = &mode; + } + r = uv_fs_chmod(loop, &req, "test_file", 0400, chmod_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(chmod_cb_count == 1); + + /* async fchmod */ + { + static int mode = 0600; + req.data = &mode; + } + r = uv_fs_fchmod(loop, &req, file, 0600, fchmod_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(fchmod_cb_count == 1); + + close(file); + + /* + * Run the loop just to check we don't have make any extraneous uv_ref() + * calls. This should drop out immediately. + */ + uv_run(loop, UV_RUN_DEFAULT); + + /* Cleanup. */ + unlink("test_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_unlink_readonly) { + int r; + uv_fs_t req; + uv_file file; + + /* Setup. */ + unlink("test_file"); + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, + &req, + "test_file", + O_RDWR | O_CREAT, + S_IWUSR | S_IRUSR, + NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + file = req.result; + uv_fs_req_cleanup(&req); + + iov = uv_buf_init(test_buf, sizeof(test_buf)); + r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL); + ASSERT(r == sizeof(test_buf)); + ASSERT(req.result == sizeof(test_buf)); + uv_fs_req_cleanup(&req); + + close(file); + + /* Make the file read-only */ + r = uv_fs_chmod(NULL, &req, "test_file", 0400, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + check_permission("test_file", 0400); + + /* Try to unlink the file */ + r = uv_fs_unlink(NULL, &req, "test_file", NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + /* + * Run the loop just to check we don't have make any extraneous uv_ref() + * calls. This should drop out immediately. + */ + uv_run(loop, UV_RUN_DEFAULT); + + /* Cleanup. */ + uv_fs_chmod(NULL, &req, "test_file", 0600, NULL); + uv_fs_req_cleanup(&req); + unlink("test_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_chown) { + int r; + uv_fs_t req; + uv_file file; + + /* Setup. */ + unlink("test_file"); + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + file = req.result; + uv_fs_req_cleanup(&req); + + /* sync chown */ + r = uv_fs_chown(NULL, &req, "test_file", -1, -1, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + /* sync fchown */ + r = uv_fs_fchown(NULL, &req, file, -1, -1, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + /* async chown */ + r = uv_fs_chown(loop, &req, "test_file", -1, -1, chown_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(chown_cb_count == 1); + + /* chown to root (fail) */ + chown_cb_count = 0; + r = uv_fs_chown(loop, &req, "test_file", 0, 0, chown_root_cb); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(chown_cb_count == 1); + + /* async fchown */ + r = uv_fs_fchown(loop, &req, file, -1, -1, fchown_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(fchown_cb_count == 1); + + close(file); + + /* + * Run the loop just to check we don't have make any extraneous uv_ref() + * calls. This should drop out immediately. + */ + uv_run(loop, UV_RUN_DEFAULT); + + /* Cleanup. */ + unlink("test_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_link) { + int r; + uv_fs_t req; + uv_file file; + uv_file link; + + /* Setup. */ + unlink("test_file"); + unlink("test_file_link"); + unlink("test_file_link2"); + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + file = req.result; + uv_fs_req_cleanup(&req); + + iov = uv_buf_init(test_buf, sizeof(test_buf)); + r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL); + ASSERT(r == sizeof(test_buf)); + ASSERT(req.result == sizeof(test_buf)); + uv_fs_req_cleanup(&req); + + close(file); + + /* sync link */ + r = uv_fs_link(NULL, &req, "test_file", "test_file_link", NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_open(NULL, &req, "test_file_link", O_RDWR, 0, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + link = req.result; + uv_fs_req_cleanup(&req); + + memset(buf, 0, sizeof(buf)); + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + ASSERT(strcmp(buf, test_buf) == 0); + + close(link); + + /* async link */ + r = uv_fs_link(loop, &req, "test_file", "test_file_link2", link_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(link_cb_count == 1); + + r = uv_fs_open(NULL, &req, "test_file_link2", O_RDWR, 0, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + link = req.result; + uv_fs_req_cleanup(&req); + + memset(buf, 0, sizeof(buf)); + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + ASSERT(strcmp(buf, test_buf) == 0); + + close(link); + + /* + * Run the loop just to check we don't have make any extraneous uv_ref() + * calls. This should drop out immediately. + */ + uv_run(loop, UV_RUN_DEFAULT); + + /* Cleanup. */ + unlink("test_file"); + unlink("test_file_link"); + unlink("test_file_link2"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_readlink) { + uv_fs_t req; + + loop = uv_default_loop(); + ASSERT(0 == uv_fs_readlink(loop, &req, "no_such_file", dummy_cb)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(dummy_cb_count == 1); + ASSERT(req.ptr == NULL); + ASSERT(req.result == UV_ENOENT); + uv_fs_req_cleanup(&req); + + ASSERT(UV_ENOENT == uv_fs_readlink(NULL, &req, "no_such_file", NULL)); + ASSERT(req.ptr == NULL); + ASSERT(req.result == UV_ENOENT); + uv_fs_req_cleanup(&req); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_realpath) { + uv_fs_t req; + + loop = uv_default_loop(); + ASSERT(0 == uv_fs_realpath(loop, &req, "no_such_file", dummy_cb)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(dummy_cb_count == 1); + ASSERT(req.ptr == NULL); +#ifdef _WIN32 + /* + * Windows XP and Server 2003 don't support GetFinalPathNameByHandleW() + */ + if (req.result == UV_ENOSYS) { + uv_fs_req_cleanup(&req); + RETURN_SKIP("realpath is not supported on Windows XP"); + } +#endif + ASSERT(req.result == UV_ENOENT); + uv_fs_req_cleanup(&req); + + ASSERT(UV_ENOENT == uv_fs_realpath(NULL, &req, "no_such_file", NULL)); + ASSERT(req.ptr == NULL); + ASSERT(req.result == UV_ENOENT); + uv_fs_req_cleanup(&req); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_symlink) { + int r; + uv_fs_t req; + uv_file file; + uv_file link; + char test_file_abs_buf[PATHMAX]; + size_t test_file_abs_size; + + /* Setup. */ + unlink("test_file"); + unlink("test_file_symlink"); + unlink("test_file_symlink2"); + unlink("test_file_symlink_symlink"); + unlink("test_file_symlink2_symlink"); + test_file_abs_size = sizeof(test_file_abs_buf); +#ifdef _WIN32 + uv_cwd(test_file_abs_buf, &test_file_abs_size); + strcat(test_file_abs_buf, "\\test_file"); +#else + uv_cwd(test_file_abs_buf, &test_file_abs_size); + strcat(test_file_abs_buf, "/test_file"); +#endif + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + file = req.result; + uv_fs_req_cleanup(&req); + + iov = uv_buf_init(test_buf, sizeof(test_buf)); + r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL); + ASSERT(r == sizeof(test_buf)); + ASSERT(req.result == sizeof(test_buf)); + uv_fs_req_cleanup(&req); + + close(file); + + /* sync symlink */ + r = uv_fs_symlink(NULL, &req, "test_file", "test_file_symlink", 0, NULL); +#ifdef _WIN32 + if (r < 0) { + if (r == UV_ENOTSUP) { + /* + * Windows doesn't support symlinks on older versions. + * We just pass the test and bail out early if we get ENOTSUP. + */ + return 0; + } else if (r == UV_EPERM) { + /* + * Creating a symlink is only allowed when running elevated. + * We pass the test and bail out early if we get UV_EPERM. + */ + return 0; + } + } +#endif + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_open(NULL, &req, "test_file_symlink", O_RDWR, 0, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + link = req.result; + uv_fs_req_cleanup(&req); + + memset(buf, 0, sizeof(buf)); + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + ASSERT(strcmp(buf, test_buf) == 0); + + close(link); + + r = uv_fs_symlink(NULL, + &req, + "test_file_symlink", + "test_file_symlink_symlink", + 0, + NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_readlink(NULL, &req, "test_file_symlink_symlink", NULL); + ASSERT(r == 0); + ASSERT(strcmp(req.ptr, "test_file_symlink") == 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_realpath(NULL, &req, "test_file_symlink_symlink", NULL); +#ifdef _WIN32 + /* + * Windows XP and Server 2003 don't support GetFinalPathNameByHandleW() + */ + if (r == UV_ENOSYS) { + uv_fs_req_cleanup(&req); + RETURN_SKIP("realpath is not supported on Windows XP"); + } +#endif + ASSERT(r == 0); +#ifdef _WIN32 + ASSERT(stricmp(req.ptr, test_file_abs_buf) == 0); +#else + ASSERT(strcmp(req.ptr, test_file_abs_buf) == 0); +#endif + uv_fs_req_cleanup(&req); + + /* async link */ + r = uv_fs_symlink(loop, + &req, + "test_file", + "test_file_symlink2", + 0, + symlink_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(symlink_cb_count == 1); + + r = uv_fs_open(NULL, &req, "test_file_symlink2", O_RDWR, 0, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + link = req.result; + uv_fs_req_cleanup(&req); + + memset(buf, 0, sizeof(buf)); + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + ASSERT(strcmp(buf, test_buf) == 0); + + close(link); + + r = uv_fs_symlink(NULL, + &req, + "test_file_symlink2", + "test_file_symlink2_symlink", + 0, + NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_readlink(loop, &req, "test_file_symlink2_symlink", readlink_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(readlink_cb_count == 1); + + r = uv_fs_realpath(loop, &req, "test_file", realpath_cb); +#ifdef _WIN32 + /* + * Windows XP and Server 2003 don't support GetFinalPathNameByHandleW() + */ + if (r == UV_ENOSYS) { + uv_fs_req_cleanup(&req); + RETURN_SKIP("realpath is not supported on Windows XP"); + } +#endif + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(realpath_cb_count == 1); + + /* + * Run the loop just to check we don't have make any extraneous uv_ref() + * calls. This should drop out immediately. + */ + uv_run(loop, UV_RUN_DEFAULT); + + /* Cleanup. */ + unlink("test_file"); + unlink("test_file_symlink"); + unlink("test_file_symlink_symlink"); + unlink("test_file_symlink2"); + unlink("test_file_symlink2_symlink"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_symlink_dir) { + uv_fs_t req; + int r; + char* test_dir; + uv_dirent_t dent; + static char test_dir_abs_buf[PATHMAX]; + size_t test_dir_abs_size; + + /* set-up */ + unlink("test_dir/file1"); + unlink("test_dir/file2"); + rmdir("test_dir"); + rmdir("test_dir_symlink"); + test_dir_abs_size = sizeof(test_dir_abs_buf); + + loop = uv_default_loop(); + + uv_fs_mkdir(NULL, &req, "test_dir", 0777, NULL); + uv_fs_req_cleanup(&req); + +#ifdef _WIN32 + strcpy(test_dir_abs_buf, "\\\\?\\"); + uv_cwd(test_dir_abs_buf + 4, &test_dir_abs_size); + test_dir_abs_size += 4; + strcat(test_dir_abs_buf, "\\test_dir\\"); + test_dir_abs_size += strlen("\\test_dir\\"); + test_dir = test_dir_abs_buf; +#else + uv_cwd(test_dir_abs_buf, &test_dir_abs_size); + strcat(test_dir_abs_buf, "/test_dir"); + test_dir_abs_size += strlen("/test_dir"); + test_dir = "test_dir"; +#endif + + r = uv_fs_symlink(NULL, &req, test_dir, "test_dir_symlink", + UV_FS_SYMLINK_JUNCTION, NULL); + fprintf(stderr, "r == %i\n", r); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_stat(NULL, &req, "test_dir_symlink", NULL); + ASSERT(r == 0); + ASSERT(((uv_stat_t*)req.ptr)->st_mode & S_IFDIR); + uv_fs_req_cleanup(&req); + + r = uv_fs_lstat(NULL, &req, "test_dir_symlink", NULL); + ASSERT(r == 0); + ASSERT(((uv_stat_t*)req.ptr)->st_mode & S_IFLNK); +#ifdef _WIN32 + ASSERT(((uv_stat_t*)req.ptr)->st_size == strlen(test_dir + 4)); +#else + ASSERT(((uv_stat_t*)req.ptr)->st_size == strlen(test_dir)); +#endif + uv_fs_req_cleanup(&req); + + r = uv_fs_readlink(NULL, &req, "test_dir_symlink", NULL); + ASSERT(r == 0); +#ifdef _WIN32 + ASSERT(strcmp(req.ptr, test_dir + 4) == 0); +#else + ASSERT(strcmp(req.ptr, test_dir) == 0); +#endif + uv_fs_req_cleanup(&req); + + r = uv_fs_realpath(NULL, &req, "test_dir_symlink", NULL); +#ifdef _WIN32 + /* + * Windows XP and Server 2003 don't support GetFinalPathNameByHandleW() + */ + if (r == UV_ENOSYS) { + uv_fs_req_cleanup(&req); + RETURN_SKIP("realpath is not supported on Windows XP"); + } +#endif + ASSERT(r == 0); +#ifdef _WIN32 + ASSERT(strlen(req.ptr) == test_dir_abs_size - 5); + ASSERT(strnicmp(req.ptr, test_dir + 4, test_dir_abs_size - 5) == 0); +#else + ASSERT(strcmp(req.ptr, test_dir_abs_buf) == 0); +#endif + uv_fs_req_cleanup(&req); + + r = uv_fs_open(NULL, &open_req1, "test_dir/file1", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + uv_fs_req_cleanup(&open_req1); + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_open(NULL, &open_req1, "test_dir/file2", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + uv_fs_req_cleanup(&open_req1); + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_scandir(NULL, &scandir_req, "test_dir_symlink", 0, NULL); + ASSERT(r == 2); + ASSERT(scandir_req.result == 2); + ASSERT(scandir_req.ptr); + while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) { + ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); + assert_is_file_type(dent); + } + uv_fs_req_cleanup(&scandir_req); + ASSERT(!scandir_req.ptr); + + /* unlink will remove the directory symlink */ + r = uv_fs_unlink(NULL, &req, "test_dir_symlink", NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_scandir(NULL, &scandir_req, "test_dir_symlink", 0, NULL); + ASSERT(r == UV_ENOENT); + uv_fs_req_cleanup(&scandir_req); + + r = uv_fs_scandir(NULL, &scandir_req, "test_dir", 0, NULL); + ASSERT(r == 2); + ASSERT(scandir_req.result == 2); + ASSERT(scandir_req.ptr); + while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) { + ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); + assert_is_file_type(dent); + } + uv_fs_req_cleanup(&scandir_req); + ASSERT(!scandir_req.ptr); + + /* clean-up */ + unlink("test_dir/file1"); + unlink("test_dir/file2"); + rmdir("test_dir"); + rmdir("test_dir_symlink"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_utime) { + utime_check_t checkme; + const char* path = "test_file"; + double atime; + double mtime; + uv_fs_t req; + int r; + + /* Setup. */ + loop = uv_default_loop(); + unlink(path); + r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + uv_fs_req_cleanup(&req); + close(r); + + atime = mtime = 400497753; /* 1982-09-10 11:22:33 */ + + r = uv_fs_utime(NULL, &req, path, atime, mtime, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_stat(NULL, &req, path, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + check_utime(path, atime, mtime); + uv_fs_req_cleanup(&req); + + atime = mtime = 1291404900; /* 2010-12-03 20:35:00 - mees <3 */ + checkme.path = path; + checkme.atime = atime; + checkme.mtime = mtime; + + /* async utime */ + utime_req.data = &checkme; + r = uv_fs_utime(loop, &utime_req, path, atime, mtime, utime_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(utime_cb_count == 1); + + /* Cleanup. */ + unlink(path); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +#ifdef _WIN32 +TEST_IMPL(fs_stat_root) { + int r; + uv_loop_t* loop = uv_default_loop(); + + r = uv_fs_stat(NULL, &stat_req, "\\", NULL); + ASSERT(r == 0); + + r = uv_fs_stat(NULL, &stat_req, "..\\..\\..\\..\\..\\..\\..", NULL); + ASSERT(r == 0); + + r = uv_fs_stat(NULL, &stat_req, "..", NULL); + ASSERT(r == 0); + + r = uv_fs_stat(NULL, &stat_req, "..\\", NULL); + ASSERT(r == 0); + + /* stats the current directory on c: */ + r = uv_fs_stat(NULL, &stat_req, "c:", NULL); + ASSERT(r == 0); + + r = uv_fs_stat(NULL, &stat_req, "c:\\", NULL); + ASSERT(r == 0); + + r = uv_fs_stat(NULL, &stat_req, "\\\\?\\C:\\", NULL); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif + + +TEST_IMPL(fs_futime) { + utime_check_t checkme; + const char* path = "test_file"; + double atime; + double mtime; + uv_file file; + uv_fs_t req; + int r; + + /* Setup. */ + loop = uv_default_loop(); + unlink(path); + r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + uv_fs_req_cleanup(&req); + close(r); + + atime = mtime = 400497753; /* 1982-09-10 11:22:33 */ + + r = uv_fs_open(NULL, &req, path, O_RDWR, 0, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + file = req.result; /* FIXME probably not how it's supposed to be used */ + uv_fs_req_cleanup(&req); + + r = uv_fs_futime(NULL, &req, file, atime, mtime, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + uv_fs_req_cleanup(&req); + + r = uv_fs_stat(NULL, &req, path, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + check_utime(path, atime, mtime); + uv_fs_req_cleanup(&req); + + atime = mtime = 1291404900; /* 2010-12-03 20:35:00 - mees <3 */ + + checkme.atime = atime; + checkme.mtime = mtime; + checkme.path = path; + + /* async futime */ + futime_req.data = &checkme; + r = uv_fs_futime(loop, &futime_req, file, atime, mtime, futime_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(futime_cb_count == 1); + + /* Cleanup. */ + unlink(path); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_stat_missing_path) { + uv_fs_t req; + int r; + + loop = uv_default_loop(); + + r = uv_fs_stat(NULL, &req, "non_existent_file", NULL); + ASSERT(r == UV_ENOENT); + ASSERT(req.result == UV_ENOENT); + uv_fs_req_cleanup(&req); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_scandir_empty_dir) { + const char* path; + uv_fs_t req; + uv_dirent_t dent; + int r; + + path = "./empty_dir/"; + loop = uv_default_loop(); + + uv_fs_mkdir(NULL, &req, path, 0777, NULL); + uv_fs_req_cleanup(&req); + + /* Fill the req to ensure that required fields are cleaned up */ + memset(&req, 0xdb, sizeof(req)); + + r = uv_fs_scandir(NULL, &req, path, 0, NULL); + ASSERT(r == 0); + ASSERT(req.result == 0); + ASSERT(req.ptr == NULL); + ASSERT(UV_EOF == uv_fs_scandir_next(&req, &dent)); + uv_fs_req_cleanup(&req); + + r = uv_fs_scandir(loop, &scandir_req, path, 0, empty_scandir_cb); + ASSERT(r == 0); + + ASSERT(scandir_cb_count == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(scandir_cb_count == 1); + + uv_fs_rmdir(NULL, &req, path, NULL); + uv_fs_req_cleanup(&req); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_scandir_file) { + const char* path; + int r; + + path = "test/fixtures/empty_file"; + loop = uv_default_loop(); + + r = uv_fs_scandir(NULL, &scandir_req, path, 0, NULL); + ASSERT(r == UV_ENOTDIR); + uv_fs_req_cleanup(&scandir_req); + + r = uv_fs_scandir(loop, &scandir_req, path, 0, file_scandir_cb); + ASSERT(r == 0); + + ASSERT(scandir_cb_count == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(scandir_cb_count == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_open_dir) { + const char* path; + uv_fs_t req; + int r, file; + + path = "."; + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &req, path, O_RDONLY, 0, NULL); + ASSERT(r >= 0); + ASSERT(req.result >= 0); + ASSERT(req.ptr == NULL); + file = r; + uv_fs_req_cleanup(&req); + + r = uv_fs_close(NULL, &req, file, NULL); + ASSERT(r == 0); + + r = uv_fs_open(loop, &req, path, O_RDONLY, 0, open_cb_simple); + ASSERT(r == 0); + + ASSERT(open_cb_count == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(open_cb_count == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_file_open_append) { + int r; + + /* Setup. */ + unlink("test_file"); + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &open_req1, "test_file", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + iov = uv_buf_init(test_buf, sizeof(test_buf)); + r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r >= 0); + ASSERT(write_req.result >= 0); + uv_fs_req_cleanup(&write_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_open(NULL, &open_req1, "test_file", O_RDWR | O_APPEND, 0, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + iov = uv_buf_init(test_buf, sizeof(test_buf)); + r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r >= 0); + ASSERT(write_req.result >= 0); + uv_fs_req_cleanup(&write_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY, S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); + printf("read = %d\n", r); + ASSERT(r == 26); + ASSERT(read_req.result == 26); + ASSERT(memcmp(buf, + "test-buffer\n\0test-buffer\n\0", + sizeof("test-buffer\n\0test-buffer\n\0") - 1) == 0); + uv_fs_req_cleanup(&read_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + /* Cleanup */ + unlink("test_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_rename_to_existing_file) { + int r; + + /* Setup. */ + unlink("test_file"); + unlink("test_file2"); + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &open_req1, "test_file", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + iov = uv_buf_init(test_buf, sizeof(test_buf)); + r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r >= 0); + ASSERT(write_req.result >= 0); + uv_fs_req_cleanup(&write_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_open(NULL, &open_req1, "test_file2", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_rename(NULL, &rename_req, "test_file", "test_file2", NULL); + ASSERT(r == 0); + ASSERT(rename_req.result == 0); + uv_fs_req_cleanup(&rename_req); + + r = uv_fs_open(NULL, &open_req1, "test_file2", O_RDONLY, 0, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + memset(buf, 0, sizeof(buf)); + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r >= 0); + ASSERT(read_req.result >= 0); + ASSERT(strcmp(buf, test_buf) == 0); + uv_fs_req_cleanup(&read_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + /* Cleanup */ + unlink("test_file"); + unlink("test_file2"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_read_file_eof) { + int r; + + /* Setup. */ + unlink("test_file"); + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &open_req1, "test_file", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + iov = uv_buf_init(test_buf, sizeof(test_buf)); + r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r >= 0); + ASSERT(write_req.result >= 0); + uv_fs_req_cleanup(&write_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY, 0, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + memset(buf, 0, sizeof(buf)); + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r >= 0); + ASSERT(read_req.result >= 0); + ASSERT(strcmp(buf, test_buf) == 0); + uv_fs_req_cleanup(&read_req); + + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, + read_req.result, NULL); + ASSERT(r == 0); + ASSERT(read_req.result == 0); + uv_fs_req_cleanup(&read_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + /* Cleanup */ + unlink("test_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_write_multiple_bufs) { + uv_buf_t iovs[2]; + int r; + + /* Setup. */ + unlink("test_file"); + + loop = uv_default_loop(); + + r = uv_fs_open(NULL, &open_req1, "test_file", O_WRONLY | O_CREAT, + S_IWUSR | S_IRUSR, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + iovs[0] = uv_buf_init(test_buf, sizeof(test_buf)); + iovs[1] = uv_buf_init(test_buf2, sizeof(test_buf2)); + r = uv_fs_write(NULL, &write_req, open_req1.result, iovs, 2, 0, NULL); + ASSERT(r >= 0); + ASSERT(write_req.result >= 0); + uv_fs_req_cleanup(&write_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY, 0, NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + memset(buf, 0, sizeof(buf)); + memset(buf2, 0, sizeof(buf2)); + /* Read the strings back to separate buffers. */ + iovs[0] = uv_buf_init(buf, sizeof(test_buf)); + iovs[1] = uv_buf_init(buf2, sizeof(test_buf2)); + r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, 2, 0, NULL); + ASSERT(r >= 0); + ASSERT(read_req.result >= 0); + ASSERT(strcmp(buf, test_buf) == 0); + ASSERT(strcmp(buf2, test_buf2) == 0); + uv_fs_req_cleanup(&read_req); + + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, + read_req.result, NULL); + ASSERT(r == 0); + ASSERT(read_req.result == 0); + uv_fs_req_cleanup(&read_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + /* Cleanup */ + unlink("test_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_write_alotof_bufs) { + const size_t iovcount = 54321; + uv_buf_t* iovs; + char* buffer; + size_t index; + int r; + + /* Setup. */ + unlink("test_file"); + + loop = uv_default_loop(); + + iovs = malloc(sizeof(*iovs) * iovcount); + ASSERT(iovs != NULL); + + r = uv_fs_open(NULL, + &open_req1, + "test_file", + O_RDWR | O_CREAT, + S_IWUSR | S_IRUSR, + NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + for (index = 0; index < iovcount; ++index) + iovs[index] = uv_buf_init(test_buf, sizeof(test_buf)); + + r = uv_fs_write(NULL, + &write_req, + open_req1.result, + iovs, + iovcount, + -1, + NULL); + ASSERT(r >= 0); + ASSERT((size_t)write_req.result == sizeof(test_buf) * iovcount); + uv_fs_req_cleanup(&write_req); + + /* Read the strings back to separate buffers. */ + buffer = malloc(sizeof(test_buf) * iovcount); + ASSERT(buffer != NULL); + + for (index = 0; index < iovcount; ++index) + iovs[index] = uv_buf_init(buffer + index * sizeof(test_buf), + sizeof(test_buf)); + + r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, iovcount, 0, NULL); + ASSERT(r >= 0); + ASSERT((size_t)read_req.result == sizeof(test_buf) * iovcount); + + for (index = 0; index < iovcount; ++index) + ASSERT(strncmp(buffer + index * sizeof(test_buf), + test_buf, + sizeof(test_buf)) == 0); + + uv_fs_req_cleanup(&read_req); + free(buffer); + + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, + &read_req, + open_req1.result, + &iov, + 1, + read_req.result, + NULL); + ASSERT(r == 0); + ASSERT(read_req.result == 0); + uv_fs_req_cleanup(&read_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + /* Cleanup */ + unlink("test_file"); + free(iovs); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_write_alotof_bufs_with_offset) { + const size_t iovcount = 54321; + uv_buf_t* iovs; + char* buffer; + size_t index; + int r; + int64_t offset; + char* filler = "0123456789"; + int filler_len = strlen(filler); + + /* Setup. */ + unlink("test_file"); + + loop = uv_default_loop(); + + iovs = malloc(sizeof(*iovs) * iovcount); + ASSERT(iovs != NULL); + + r = uv_fs_open(NULL, + &open_req1, + "test_file", + O_RDWR | O_CREAT, + S_IWUSR | S_IRUSR, + NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + iov = uv_buf_init(filler, filler_len); + r = uv_fs_write(NULL, &write_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r == filler_len); + ASSERT(write_req.result == filler_len); + uv_fs_req_cleanup(&write_req); + offset = (int64_t)r; + + for (index = 0; index < iovcount; ++index) + iovs[index] = uv_buf_init(test_buf, sizeof(test_buf)); + + r = uv_fs_write(NULL, + &write_req, + open_req1.result, + iovs, + iovcount, + offset, + NULL); + ASSERT(r >= 0); + ASSERT((size_t)write_req.result == sizeof(test_buf) * iovcount); + uv_fs_req_cleanup(&write_req); + + /* Read the strings back to separate buffers. */ + buffer = malloc(sizeof(test_buf) * iovcount); + ASSERT(buffer != NULL); + + for (index = 0; index < iovcount; ++index) + iovs[index] = uv_buf_init(buffer + index * sizeof(test_buf), + sizeof(test_buf)); + + r = uv_fs_read(NULL, &read_req, open_req1.result, + iovs, iovcount, offset, NULL); + ASSERT(r >= 0); + ASSERT(read_req.result == sizeof(test_buf) * iovcount); + + for (index = 0; index < iovcount; ++index) + ASSERT(strncmp(buffer + index * sizeof(test_buf), + test_buf, + sizeof(test_buf)) == 0); + + uv_fs_req_cleanup(&read_req); + free(buffer); + + r = uv_fs_stat(NULL, &stat_req, "test_file", NULL); + ASSERT(r == 0); + ASSERT((int64_t)((uv_stat_t*)stat_req.ptr)->st_size == + offset + (int64_t)(iovcount * sizeof(test_buf))); + uv_fs_req_cleanup(&stat_req); + + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, + &read_req, + open_req1.result, + &iov, + 1, + read_req.result + offset, + NULL); + ASSERT(r == 0); + ASSERT(read_req.result == 0); + uv_fs_req_cleanup(&read_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + /* Cleanup */ + unlink("test_file"); + free(iovs); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_read_write_null_arguments) { + int r; + + r = uv_fs_read(NULL, NULL, 0, NULL, 0, -1, NULL); + ASSERT(r == UV_EINVAL); + + r = uv_fs_write(NULL, NULL, 0, NULL, 0, -1, NULL); + ASSERT(r == UV_EINVAL); + + iov = uv_buf_init(NULL, 0); + r = uv_fs_read(NULL, NULL, 0, &iov, 0, -1, NULL); + ASSERT(r == UV_EINVAL); + + iov = uv_buf_init(NULL, 0); + r = uv_fs_write(NULL, NULL, 0, &iov, 0, -1, NULL); + ASSERT(r == UV_EINVAL); + + return 0; +} diff --git a/3rdparty/libuv/test/test-get-currentexe.c b/3rdparty/libuv/test/test-get-currentexe.c new file mode 100644 index 00000000000..0e9d6965402 --- /dev/null +++ b/3rdparty/libuv/test/test-get-currentexe.c @@ -0,0 +1,86 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include + +#define PATHMAX 1024 +extern char executable_path[]; + +TEST_IMPL(get_currentexe) { + char buffer[PATHMAX]; + size_t size; + char* match; + char* path; + int r; + + size = sizeof(buffer) / sizeof(buffer[0]); + r = uv_exepath(buffer, &size); + ASSERT(!r); + + /* uv_exepath can return an absolute path on darwin, so if the test runner + * was run with a relative prefix of "./", we need to strip that prefix off + * executable_path or we'll fail. */ + if (executable_path[0] == '.' && executable_path[1] == '/') { + path = executable_path + 2; + } else { + path = executable_path; + } + + match = strstr(buffer, path); + /* Verify that the path returned from uv_exepath is a subdirectory of + * executable_path. + */ + ASSERT(match && !strcmp(match, path)); + ASSERT(size == strlen(buffer)); + + /* Negative tests */ + size = sizeof(buffer) / sizeof(buffer[0]); + r = uv_exepath(NULL, &size); + ASSERT(r == UV_EINVAL); + + r = uv_exepath(buffer, NULL); + ASSERT(r == UV_EINVAL); + + size = 0; + r = uv_exepath(buffer, &size); + ASSERT(r == UV_EINVAL); + + memset(buffer, -1, sizeof(buffer)); + + size = 1; + r = uv_exepath(buffer, &size); + ASSERT(r == 0); + ASSERT(size == 0); + ASSERT(buffer[0] == '\0'); + + memset(buffer, -1, sizeof(buffer)); + + size = 2; + r = uv_exepath(buffer, &size); + ASSERT(r == 0); + ASSERT(size == 1); + ASSERT(buffer[0] != '\0'); + ASSERT(buffer[1] == '\0'); + + return 0; +} diff --git a/3rdparty/libuv/test/test-get-loadavg.c b/3rdparty/libuv/test/test-get-loadavg.c new file mode 100644 index 00000000000..4762e47576d --- /dev/null +++ b/3rdparty/libuv/test/test-get-loadavg.c @@ -0,0 +1,35 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +TEST_IMPL(get_loadavg) { + + double avg[3] = {-1, -1, -1}; + uv_loadavg(avg); + + ASSERT(avg[0] >= 0); + ASSERT(avg[1] >= 0); + ASSERT(avg[2] >= 0); + + return 0; +} diff --git a/3rdparty/libuv/test/test-get-memory.c b/3rdparty/libuv/test/test-get-memory.c new file mode 100644 index 00000000000..2396939bcb1 --- /dev/null +++ b/3rdparty/libuv/test/test-get-memory.c @@ -0,0 +1,38 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +TEST_IMPL(get_memory) { + uint64_t free_mem = uv_get_free_memory(); + uint64_t total_mem = uv_get_total_memory(); + + printf("free_mem=%llu, total_mem=%llu\n", + (unsigned long long) free_mem, + (unsigned long long) total_mem); + + ASSERT(free_mem > 0); + ASSERT(total_mem > 0); + ASSERT(total_mem > free_mem); + + return 0; +} diff --git a/3rdparty/libuv/test/test-getaddrinfo.c b/3rdparty/libuv/test/test-getaddrinfo.c new file mode 100644 index 00000000000..6b644a8d442 --- /dev/null +++ b/3rdparty/libuv/test/test-getaddrinfo.c @@ -0,0 +1,184 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include + +#define CONCURRENT_COUNT 10 + +static const char* name = "localhost"; + +static int getaddrinfo_cbs = 0; + +/* data used for running multiple calls concurrently */ +static uv_getaddrinfo_t* getaddrinfo_handle; +static uv_getaddrinfo_t getaddrinfo_handles[CONCURRENT_COUNT]; +static int callback_counts[CONCURRENT_COUNT]; +static int fail_cb_called; + + +static void getaddrinfo_fail_cb(uv_getaddrinfo_t* req, + int status, + struct addrinfo* res) { + ASSERT(fail_cb_called == 0); + ASSERT(status < 0); + ASSERT(res == NULL); + uv_freeaddrinfo(res); /* Should not crash. */ + fail_cb_called++; +} + + +static void getaddrinfo_basic_cb(uv_getaddrinfo_t* handle, + int status, + struct addrinfo* res) { + ASSERT(handle == getaddrinfo_handle); + getaddrinfo_cbs++; + free(handle); + uv_freeaddrinfo(res); +} + + +static void getaddrinfo_cuncurrent_cb(uv_getaddrinfo_t* handle, + int status, + struct addrinfo* res) { + int i; + int* data = (int*)handle->data; + + for (i = 0; i < CONCURRENT_COUNT; i++) { + if (&getaddrinfo_handles[i] == handle) { + ASSERT(i == *data); + + callback_counts[i]++; + break; + } + } + ASSERT (i < CONCURRENT_COUNT); + + free(data); + uv_freeaddrinfo(res); + + getaddrinfo_cbs++; +} + + +TEST_IMPL(getaddrinfo_fail) { + uv_getaddrinfo_t req; + + /* Use a FQDN by ending in a period */ + ASSERT(0 == uv_getaddrinfo(uv_default_loop(), + &req, + getaddrinfo_fail_cb, + "xyzzy.xyzzy.xyzzy.", + NULL, + NULL)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + ASSERT(fail_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(getaddrinfo_fail_sync) { + uv_getaddrinfo_t req; + + /* Use a FQDN by ending in a period */ + ASSERT(0 > uv_getaddrinfo(uv_default_loop(), + &req, + NULL, + "xyzzy.xyzzy.xyzzy.", + NULL, + NULL)); + uv_freeaddrinfo(req.addrinfo); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(getaddrinfo_basic) { + int r; + getaddrinfo_handle = (uv_getaddrinfo_t*)malloc(sizeof(uv_getaddrinfo_t)); + + r = uv_getaddrinfo(uv_default_loop(), + getaddrinfo_handle, + &getaddrinfo_basic_cb, + name, + NULL, + NULL); + ASSERT(r == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(getaddrinfo_cbs == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(getaddrinfo_basic_sync) { + uv_getaddrinfo_t req; + + ASSERT(0 == uv_getaddrinfo(uv_default_loop(), + &req, + NULL, + name, + NULL, + NULL)); + uv_freeaddrinfo(req.addrinfo); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(getaddrinfo_concurrent) { + int i, r; + int* data; + + for (i = 0; i < CONCURRENT_COUNT; i++) { + callback_counts[i] = 0; + + data = (int*)malloc(sizeof(int)); + ASSERT(data != NULL); + *data = i; + getaddrinfo_handles[i].data = data; + + r = uv_getaddrinfo(uv_default_loop(), + &getaddrinfo_handles[i], + &getaddrinfo_cuncurrent_cb, + name, + NULL, + NULL); + ASSERT(r == 0); + } + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + for (i = 0; i < CONCURRENT_COUNT; i++) { + ASSERT(callback_counts[i] == 1); + } + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-getnameinfo.c b/3rdparty/libuv/test/test-getnameinfo.c new file mode 100644 index 00000000000..b1391616d13 --- /dev/null +++ b/3rdparty/libuv/test/test-getnameinfo.c @@ -0,0 +1,101 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to +* deal in the Software without restriction, including without limitation the +* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +* sell copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +*/ + +#include "uv.h" +#include "task.h" +#include +#include +#include + + +static const char* address_ip4 = "127.0.0.1"; +static const char* address_ip6 = "::1"; +static const int port = 80; + +static struct sockaddr_in addr4; +static struct sockaddr_in6 addr6; +static uv_getnameinfo_t req; + +static void getnameinfo_req(uv_getnameinfo_t* handle, + int status, + const char* hostname, + const char* service) { + ASSERT(handle != NULL); + ASSERT(status == 0); + ASSERT(hostname != NULL); + ASSERT(service != NULL); +} + + +TEST_IMPL(getnameinfo_basic_ip4) { + int r; + + r = uv_ip4_addr(address_ip4, port, &addr4); + ASSERT(r == 0); + + r = uv_getnameinfo(uv_default_loop(), + &req, + &getnameinfo_req, + (const struct sockaddr*)&addr4, + 0); + ASSERT(r == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(getnameinfo_basic_ip4_sync) { + ASSERT(0 == uv_ip4_addr(address_ip4, port, &addr4)); + + ASSERT(0 == uv_getnameinfo(uv_default_loop(), + &req, + NULL, + (const struct sockaddr*)&addr4, + 0)); + ASSERT(req.host[0] != '\0'); + ASSERT(req.service[0] != '\0'); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(getnameinfo_basic_ip6) { + int r; + + r = uv_ip6_addr(address_ip6, port, &addr6); + ASSERT(r == 0); + + r = uv_getnameinfo(uv_default_loop(), + &req, + &getnameinfo_req, + (const struct sockaddr*)&addr6, + 0); + ASSERT(r == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-getsockname.c b/3rdparty/libuv/test/test-getsockname.c new file mode 100644 index 00000000000..565c17fe50b --- /dev/null +++ b/3rdparty/libuv/test/test-getsockname.c @@ -0,0 +1,361 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +static const int server_port = TEST_PORT; +/* Will be updated right after making the uv_connect_call */ +static int connect_port = -1; + +static int getsocknamecount = 0; +static int getpeernamecount = 0; + +static uv_loop_t* loop; +static uv_tcp_t tcp; +static uv_udp_t udp; +static uv_connect_t connect_req; +static uv_tcp_t tcpServer; +static uv_udp_t udpServer; +static uv_udp_send_t send_req; + + +static void alloc(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) { + buf->base = malloc(suggested_size); + buf->len = suggested_size; +} + + +static void on_close(uv_handle_t* peer) { + free(peer); + uv_close((uv_handle_t*)&tcpServer, NULL); +} + + +static void after_shutdown(uv_shutdown_t* req, int status) { + uv_close((uv_handle_t*) req->handle, on_close); + free(req); +} + + +static void after_read(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + uv_shutdown_t* req; + int r; + + if (buf->base) { + free(buf->base); + } + + req = (uv_shutdown_t*) malloc(sizeof *req); + r = uv_shutdown(req, handle, after_shutdown); + ASSERT(r == 0); +} + + +static void check_sockname(struct sockaddr* addr, const char* compare_ip, + int compare_port, const char* context) { + struct sockaddr_in check_addr = *(struct sockaddr_in*) addr; + struct sockaddr_in compare_addr; + char check_ip[17]; + int r; + + ASSERT(0 == uv_ip4_addr(compare_ip, compare_port, &compare_addr)); + + /* Both addresses should be ipv4 */ + ASSERT(check_addr.sin_family == AF_INET); + ASSERT(compare_addr.sin_family == AF_INET); + + /* Check if the ip matches */ + ASSERT(memcmp(&check_addr.sin_addr, + &compare_addr.sin_addr, + sizeof compare_addr.sin_addr) == 0); + + /* Check if the port matches. If port == 0 anything goes. */ + ASSERT(compare_port == 0 || check_addr.sin_port == compare_addr.sin_port); + + r = uv_ip4_name(&check_addr, (char*) check_ip, sizeof check_ip); + ASSERT(r == 0); + + printf("%s: %s:%d\n", context, check_ip, ntohs(check_addr.sin_port)); +} + + +static void on_connection(uv_stream_t* server, int status) { + struct sockaddr sockname, peername; + int namelen; + uv_tcp_t* handle; + int r; + + if (status != 0) { + fprintf(stderr, "Connect error %s\n", uv_err_name(status)); + } + ASSERT(status == 0); + + handle = malloc(sizeof(*handle)); + ASSERT(handle != NULL); + + r = uv_tcp_init(loop, handle); + ASSERT(r == 0); + + /* associate server with stream */ + handle->data = server; + + r = uv_accept(server, (uv_stream_t*)handle); + ASSERT(r == 0); + + namelen = sizeof sockname; + r = uv_tcp_getsockname(handle, &sockname, &namelen); + ASSERT(r == 0); + check_sockname(&sockname, "127.0.0.1", server_port, "accepted socket"); + getsocknamecount++; + + namelen = sizeof peername; + r = uv_tcp_getpeername(handle, &peername, &namelen); + ASSERT(r == 0); + check_sockname(&peername, "127.0.0.1", connect_port, "accepted socket peer"); + getpeernamecount++; + + r = uv_read_start((uv_stream_t*)handle, alloc, after_read); + ASSERT(r == 0); +} + + +static void on_connect(uv_connect_t* req, int status) { + struct sockaddr sockname, peername; + int r, namelen; + + ASSERT(status == 0); + + namelen = sizeof sockname; + r = uv_tcp_getsockname((uv_tcp_t*) req->handle, &sockname, &namelen); + ASSERT(r == 0); + check_sockname(&sockname, "127.0.0.1", 0, "connected socket"); + getsocknamecount++; + + namelen = sizeof peername; + r = uv_tcp_getpeername((uv_tcp_t*) req->handle, &peername, &namelen); + ASSERT(r == 0); + check_sockname(&peername, "127.0.0.1", server_port, "connected socket peer"); + getpeernamecount++; + + uv_close((uv_handle_t*)&tcp, NULL); +} + + +static int tcp_listener(void) { + struct sockaddr_in addr; + struct sockaddr sockname, peername; + int namelen; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", server_port, &addr)); + + r = uv_tcp_init(loop, &tcpServer); + if (r) { + fprintf(stderr, "Socket creation error\n"); + return 1; + } + + r = uv_tcp_bind(&tcpServer, (const struct sockaddr*) &addr, 0); + if (r) { + fprintf(stderr, "Bind error\n"); + return 1; + } + + r = uv_listen((uv_stream_t*)&tcpServer, 128, on_connection); + if (r) { + fprintf(stderr, "Listen error\n"); + return 1; + } + + memset(&sockname, -1, sizeof sockname); + namelen = sizeof sockname; + r = uv_tcp_getsockname(&tcpServer, &sockname, &namelen); + ASSERT(r == 0); + check_sockname(&sockname, "0.0.0.0", server_port, "server socket"); + getsocknamecount++; + + namelen = sizeof sockname; + r = uv_tcp_getpeername(&tcpServer, &peername, &namelen); + ASSERT(r == UV_ENOTCONN); + getpeernamecount++; + + return 0; +} + + +static void tcp_connector(void) { + struct sockaddr_in server_addr; + struct sockaddr sockname; + int r, namelen; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", server_port, &server_addr)); + + r = uv_tcp_init(loop, &tcp); + tcp.data = &connect_req; + ASSERT(!r); + + r = uv_tcp_connect(&connect_req, + &tcp, + (const struct sockaddr*) &server_addr, + on_connect); + ASSERT(!r); + + /* Fetch the actual port used by the connecting socket. */ + namelen = sizeof sockname; + r = uv_tcp_getsockname(&tcp, &sockname, &namelen); + ASSERT(!r); + ASSERT(sockname.sa_family == AF_INET); + connect_port = ntohs(((struct sockaddr_in*) &sockname)->sin_port); + ASSERT(connect_port > 0); +} + + +static void udp_recv(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags) { + struct sockaddr sockname; + int namelen; + int r; + + ASSERT(nread >= 0); + free(buf->base); + + if (nread == 0) { + return; + } + + memset(&sockname, -1, sizeof sockname); + namelen = sizeof(sockname); + r = uv_udp_getsockname(&udp, &sockname, &namelen); + ASSERT(r == 0); + check_sockname(&sockname, "0.0.0.0", 0, "udp receiving socket"); + getsocknamecount++; + + uv_close((uv_handle_t*) &udp, NULL); + uv_close((uv_handle_t*) handle, NULL); +} + + +static void udp_send(uv_udp_send_t* req, int status) { + +} + + +static int udp_listener(void) { + struct sockaddr_in addr; + struct sockaddr sockname; + int namelen; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", server_port, &addr)); + + r = uv_udp_init(loop, &udpServer); + if (r) { + fprintf(stderr, "Socket creation error\n"); + return 1; + } + + r = uv_udp_bind(&udpServer, (const struct sockaddr*) &addr, 0); + if (r) { + fprintf(stderr, "Bind error\n"); + return 1; + } + + memset(&sockname, -1, sizeof sockname); + namelen = sizeof sockname; + r = uv_udp_getsockname(&udpServer, &sockname, &namelen); + ASSERT(r == 0); + check_sockname(&sockname, "0.0.0.0", server_port, "udp listener socket"); + getsocknamecount++; + + r = uv_udp_recv_start(&udpServer, alloc, udp_recv); + ASSERT(r == 0); + + return 0; +} + + +static void udp_sender(void) { + struct sockaddr_in server_addr; + uv_buf_t buf; + int r; + + r = uv_udp_init(loop, &udp); + ASSERT(!r); + + buf = uv_buf_init("PING", 4); + ASSERT(0 == uv_ip4_addr("127.0.0.1", server_port, &server_addr)); + + r = uv_udp_send(&send_req, + &udp, + &buf, + 1, + (const struct sockaddr*) &server_addr, + udp_send); + ASSERT(!r); +} + + +TEST_IMPL(getsockname_tcp) { + loop = uv_default_loop(); + + if (tcp_listener()) + return 1; + + tcp_connector(); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(getsocknamecount == 3); + ASSERT(getpeernamecount == 3); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(getsockname_udp) { + loop = uv_default_loop(); + + if (udp_listener()) + return 1; + + udp_sender(); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(getsocknamecount == 2); + + ASSERT(udp.send_queue_size == 0); + ASSERT(udpServer.send_queue_size == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-handle-fileno.c b/3rdparty/libuv/test/test-handle-fileno.c new file mode 100644 index 00000000000..3fe933adebd --- /dev/null +++ b/3rdparty/libuv/test/test-handle-fileno.c @@ -0,0 +1,121 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + + +static int get_tty_fd(void) { + /* Make sure we have an FD that refers to a tty */ +#ifdef _WIN32 + HANDLE handle; + handle = CreateFileA("conout$", + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + if (handle == INVALID_HANDLE_VALUE) + return -1; + return _open_osfhandle((intptr_t) handle, 0); +#else /* unix */ + return open("/dev/tty", O_RDONLY, 0); +#endif +} + + +TEST_IMPL(handle_fileno) { + int r; + int tty_fd; + struct sockaddr_in addr; + uv_os_fd_t fd; + uv_tcp_t tcp; + uv_udp_t udp; + uv_pipe_t pipe; + uv_tty_t tty; + uv_idle_t idle; + uv_loop_t* loop; + + loop = uv_default_loop(); + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_idle_init(loop, &idle); + ASSERT(r == 0); + r = uv_fileno((uv_handle_t*) &idle, &fd); + ASSERT(r == UV_EINVAL); + uv_close((uv_handle_t*) &idle, NULL); + + r = uv_tcp_init(loop, &tcp); + ASSERT(r == 0); + r = uv_fileno((uv_handle_t*) &tcp, &fd); + ASSERT(r == UV_EBADF); + r = uv_tcp_bind(&tcp, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + r = uv_fileno((uv_handle_t*) &tcp, &fd); + ASSERT(r == 0); + uv_close((uv_handle_t*) &tcp, NULL); + r = uv_fileno((uv_handle_t*) &tcp, &fd); + ASSERT(r == UV_EBADF); + + r = uv_udp_init(loop, &udp); + ASSERT(r == 0); + r = uv_fileno((uv_handle_t*) &udp, &fd); + ASSERT(r == UV_EBADF); + r = uv_udp_bind(&udp, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + r = uv_fileno((uv_handle_t*) &udp, &fd); + ASSERT(r == 0); + uv_close((uv_handle_t*) &udp, NULL); + r = uv_fileno((uv_handle_t*) &udp, &fd); + ASSERT(r == UV_EBADF); + + r = uv_pipe_init(loop, &pipe, 0); + ASSERT(r == 0); + r = uv_fileno((uv_handle_t*) &pipe, &fd); + ASSERT(r == UV_EBADF); + r = uv_pipe_bind(&pipe, TEST_PIPENAME); + ASSERT(r == 0); + r = uv_fileno((uv_handle_t*) &pipe, &fd); + ASSERT(r == 0); + uv_close((uv_handle_t*) &pipe, NULL); + r = uv_fileno((uv_handle_t*) &pipe, &fd); + ASSERT(r == UV_EBADF); + + tty_fd = get_tty_fd(); + if (tty_fd < 0) { + fprintf(stderr, "Cannot open a TTY fd"); + fflush(stderr); + } else { + r = uv_tty_init(loop, &tty, tty_fd, 0); + ASSERT(r == 0); + r = uv_fileno((uv_handle_t*) &tty, &fd); + ASSERT(r == 0); + uv_close((uv_handle_t*) &tty, NULL); + r = uv_fileno((uv_handle_t*) &tty, &fd); + ASSERT(r == UV_EBADF); + } + + uv_run(loop, UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-homedir.c b/3rdparty/libuv/test/test-homedir.c new file mode 100644 index 00000000000..cbc47566c55 --- /dev/null +++ b/3rdparty/libuv/test/test-homedir.c @@ -0,0 +1,49 @@ +#include "uv.h" +#include "task.h" +#include + +#define PATHMAX 1024 +#define SMALLPATH 1 + +TEST_IMPL(homedir) { + char homedir[PATHMAX]; + size_t len; + char last; + int r; + + /* Test the normal case */ + len = sizeof homedir; + homedir[0] = '\0'; + ASSERT(strlen(homedir) == 0); + r = uv_os_homedir(homedir, &len); + ASSERT(r == 0); + ASSERT(strlen(homedir) == len); + ASSERT(len > 0); + ASSERT(homedir[len] == '\0'); + + if (len > 1) { + last = homedir[len - 1]; +#ifdef _WIN32 + ASSERT(last != '\\'); +#else + ASSERT(last != '/'); +#endif + } + + /* Test the case where the buffer is too small */ + len = SMALLPATH; + r = uv_os_homedir(homedir, &len); + ASSERT(r == UV_ENOBUFS); + ASSERT(len > SMALLPATH); + + /* Test invalid inputs */ + r = uv_os_homedir(NULL, &len); + ASSERT(r == UV_EINVAL); + r = uv_os_homedir(homedir, NULL); + ASSERT(r == UV_EINVAL); + len = 0; + r = uv_os_homedir(homedir, &len); + ASSERT(r == UV_EINVAL); + + return 0; +} diff --git a/3rdparty/libuv/test/test-hrtime.c b/3rdparty/libuv/test/test-hrtime.c new file mode 100644 index 00000000000..72a4d4b181d --- /dev/null +++ b/3rdparty/libuv/test/test-hrtime.c @@ -0,0 +1,54 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#ifndef MILLISEC +# define MILLISEC 1000 +#endif + +#ifndef NANOSEC +# define NANOSEC ((uint64_t) 1e9) +#endif + + +TEST_IMPL(hrtime) { + uint64_t a, b, diff; + int i = 75; + while (i > 0) { + a = uv_hrtime(); + uv_sleep(45); + b = uv_hrtime(); + + diff = b - a; + + /* printf("i= %d diff = %llu\n", i, (unsigned long long int) diff); */ + + /* The windows Sleep() function has only a resolution of 10-20 ms. */ + /* Check that the difference between the two hrtime values is somewhat in */ + /* the range we expect it to be. */ + ASSERT(diff > (uint64_t) 25 * NANOSEC / MILLISEC); + ASSERT(diff < (uint64_t) 80 * NANOSEC / MILLISEC); + --i; + } + return 0; +} diff --git a/3rdparty/libuv/test/test-idle.c b/3rdparty/libuv/test/test-idle.c new file mode 100644 index 00000000000..f49d1964827 --- /dev/null +++ b/3rdparty/libuv/test/test-idle.c @@ -0,0 +1,99 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + + +static uv_idle_t idle_handle; +static uv_check_t check_handle; +static uv_timer_t timer_handle; + +static int idle_cb_called = 0; +static int check_cb_called = 0; +static int timer_cb_called = 0; +static int close_cb_called = 0; + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +static void timer_cb(uv_timer_t* handle) { + ASSERT(handle == &timer_handle); + + uv_close((uv_handle_t*) &idle_handle, close_cb); + uv_close((uv_handle_t*) &check_handle, close_cb); + uv_close((uv_handle_t*) &timer_handle, close_cb); + + timer_cb_called++; + fprintf(stderr, "timer_cb %d\n", timer_cb_called); + fflush(stderr); +} + + +static void idle_cb(uv_idle_t* handle) { + ASSERT(handle == &idle_handle); + + idle_cb_called++; + fprintf(stderr, "idle_cb %d\n", idle_cb_called); + fflush(stderr); +} + + +static void check_cb(uv_check_t* handle) { + ASSERT(handle == &check_handle); + + check_cb_called++; + fprintf(stderr, "check_cb %d\n", check_cb_called); + fflush(stderr); +} + + +TEST_IMPL(idle_starvation) { + int r; + + r = uv_idle_init(uv_default_loop(), &idle_handle); + ASSERT(r == 0); + r = uv_idle_start(&idle_handle, idle_cb); + ASSERT(r == 0); + + r = uv_check_init(uv_default_loop(), &check_handle); + ASSERT(r == 0); + r = uv_check_start(&check_handle, check_cb); + ASSERT(r == 0); + + r = uv_timer_init(uv_default_loop(), &timer_handle); + ASSERT(r == 0); + r = uv_timer_start(&timer_handle, timer_cb, 50, 0); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(idle_cb_called > 0); + ASSERT(timer_cb_called == 1); + ASSERT(close_cb_called == 3); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-ip4-addr.c b/3rdparty/libuv/test/test-ip4-addr.c new file mode 100644 index 00000000000..3d6e0cf286a --- /dev/null +++ b/3rdparty/libuv/test/test-ip4-addr.c @@ -0,0 +1,46 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + + +TEST_IMPL(ip4_addr) { + + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + ASSERT(0 == uv_ip4_addr("255.255.255.255", TEST_PORT, &addr)); + ASSERT(UV_EINVAL == uv_ip4_addr("255.255.255*000", TEST_PORT, &addr)); + ASSERT(UV_EINVAL == uv_ip4_addr("255.255.255.256", TEST_PORT, &addr)); + ASSERT(UV_EINVAL == uv_ip4_addr("2555.0.0.0", TEST_PORT, &addr)); + ASSERT(UV_EINVAL == uv_ip4_addr("255", TEST_PORT, &addr)); + + /* for broken address family */ + ASSERT(UV_EAFNOSUPPORT == uv_inet_pton(42, "127.0.0.1", + &addr.sin_addr.s_addr)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-ip6-addr.c b/3rdparty/libuv/test/test-ip6-addr.c new file mode 100644 index 00000000000..869b099e0fc --- /dev/null +++ b/3rdparty/libuv/test/test-ip6-addr.c @@ -0,0 +1,141 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +#ifdef __linux__ +# include +# include +#endif + + +TEST_IMPL(ip6_addr_link_local) { + char string_address[INET6_ADDRSTRLEN]; + uv_interface_address_t* addresses; + uv_interface_address_t* address; + struct sockaddr_in6 addr; + unsigned int iface_index; + const char* device_name; + /* 40 bytes address, 16 bytes device name, plus reserve. */ + char scoped_addr[128]; + int count; + int ix; + + ASSERT(0 == uv_interface_addresses(&addresses, &count)); + + for (ix = 0; ix < count; ix++) { + address = addresses + ix; + + if (address->address.address6.sin6_family != AF_INET6) + continue; + + ASSERT(0 == uv_inet_ntop(AF_INET6, + &address->address.address6.sin6_addr, + string_address, + sizeof(string_address))); + + /* Skip addresses that are not link-local. */ + if (strncmp(string_address, "fe80::", 6) != 0) + continue; + + iface_index = address->address.address6.sin6_scope_id; + device_name = address->name; + +#ifdef _WIN32 + snprintf(scoped_addr, + sizeof(scoped_addr), + "%s%%%d", + string_address, + iface_index); +#else + snprintf(scoped_addr, + sizeof(scoped_addr), + "%s%%%s", + string_address, + device_name); +#endif + + fprintf(stderr, "Testing link-local address %s " + "(iface_index: 0x%02x, device_name: %s)\n", + scoped_addr, + iface_index, + device_name); + fflush(stderr); + + ASSERT(0 == uv_ip6_addr(scoped_addr, TEST_PORT, &addr)); + fprintf(stderr, "Got scope_id 0x%02x\n", addr.sin6_scope_id); + fflush(stderr); + ASSERT(iface_index == addr.sin6_scope_id); + } + + uv_free_interface_addresses(addresses, count); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +#define GOOD_ADDR_LIST(X) \ + X("::") \ + X("::1") \ + X("fe80::1") \ + X("fe80::") \ + X("fe80::2acf:daff:fedd:342a") \ + X("fe80:0:0:0:2acf:daff:fedd:342a") \ + X("fe80:0:0:0:2acf:daff:1.2.3.4") \ + X("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") \ + +#define BAD_ADDR_LIST(X) \ + X(":::1") \ + X("abcde::1") \ + X("fe80:0:0:0:2acf:daff:fedd:342a:5678") \ + X("fe80:0:0:0:2acf:daff:abcd:1.2.3.4") \ + X("fe80:0:0:2acf:daff:1.2.3.4.5") \ + X("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255.255") \ + +#define TEST_GOOD(ADDR) \ + ASSERT(0 == uv_inet_pton(AF_INET6, ADDR, &addr)); \ + ASSERT(0 == uv_inet_pton(AF_INET6, ADDR "%en1", &addr)); \ + ASSERT(0 == uv_inet_pton(AF_INET6, ADDR "%%%%", &addr)); \ + ASSERT(0 == uv_inet_pton(AF_INET6, ADDR "%en1:1.2.3.4", &addr)); \ + +#define TEST_BAD(ADDR) \ + ASSERT(0 != uv_inet_pton(AF_INET6, ADDR, &addr)); \ + ASSERT(0 != uv_inet_pton(AF_INET6, ADDR "%en1", &addr)); \ + ASSERT(0 != uv_inet_pton(AF_INET6, ADDR "%%%%", &addr)); \ + ASSERT(0 != uv_inet_pton(AF_INET6, ADDR "%en1:1.2.3.4", &addr)); \ + +TEST_IMPL(ip6_pton) { + struct in6_addr addr; + + GOOD_ADDR_LIST(TEST_GOOD) + BAD_ADDR_LIST(TEST_BAD) + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#undef GOOD_ADDR_LIST +#undef BAD_ADDR_LIST diff --git a/3rdparty/libuv/test/test-ipc-send-recv.c b/3rdparty/libuv/test/test-ipc-send-recv.c new file mode 100644 index 00000000000..c445483fa08 --- /dev/null +++ b/3rdparty/libuv/test/test-ipc-send-recv.c @@ -0,0 +1,411 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +/* See test-ipc.ctx */ +void spawn_helper(uv_pipe_t* channel, + uv_process_t* process, + const char* helper); + +void ipc_send_recv_helper_threadproc(void* arg); + +union handles { + uv_handle_t handle; + uv_stream_t stream; + uv_pipe_t pipe; + uv_tcp_t tcp; + uv_tty_t tty; +}; + +struct test_ctx { + uv_pipe_t channel; + uv_connect_t connect_req; + uv_write_t write_req; + uv_write_t write_req2; + uv_handle_type expected_type; + union handles send; + union handles send2; + union handles recv; + union handles recv2; +}; + +struct echo_ctx { + uv_pipe_t listen; + uv_pipe_t channel; + uv_write_t write_req; + uv_write_t write_req2; + uv_handle_type expected_type; + union handles recv; + union handles recv2; +}; + +static struct test_ctx ctx; +static struct echo_ctx ctx2; + +/* Used in write2_cb to decide if we need to cleanup or not */ +static int is_child_process; +static int is_in_process; +static int read_cb_called; +static int recv_cb_called; +static int write2_cb_called; + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + /* we're not actually reading anything so a small buffer is okay */ + static char slab[8]; + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void recv_cb(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + uv_handle_type pending; + uv_pipe_t* pipe; + int r; + union handles* recv; + + if (++recv_cb_called == 1) { + recv = &ctx.recv; + } else { + recv = &ctx.recv2; + } + + pipe = (uv_pipe_t*) handle; + ASSERT(pipe == &ctx.channel); + + /* Depending on the OS, the final recv_cb can be called after the child + * process has terminated which can result in nread being UV_EOF instead of + * the number of bytes read. Since the other end of the pipe has closed this + * UV_EOF is an acceptable value. */ + if (nread == UV_EOF) { + /* UV_EOF is only acceptable for the final recv_cb call */ + ASSERT(recv_cb_called == 2); + } else { + ASSERT(nread >= 0); + ASSERT(1 == uv_pipe_pending_count(pipe)); + + pending = uv_pipe_pending_type(pipe); + ASSERT(pending == ctx.expected_type); + + if (pending == UV_NAMED_PIPE) + r = uv_pipe_init(ctx.channel.loop, &recv->pipe, 0); + else if (pending == UV_TCP) + r = uv_tcp_init(ctx.channel.loop, &recv->tcp); + else + abort(); + ASSERT(r == 0); + + r = uv_accept(handle, &recv->stream); + ASSERT(r == 0); + } + + /* Close after two writes received */ + if (recv_cb_called == 2) { + uv_close((uv_handle_t*)&ctx.channel, NULL); + } +} + +static void connect_cb(uv_connect_t* req, int status) { + int r; + uv_buf_t buf; + + ASSERT(req == &ctx.connect_req); + ASSERT(status == 0); + + buf = uv_buf_init(".", 1); + r = uv_write2(&ctx.write_req, + (uv_stream_t*)&ctx.channel, + &buf, 1, + &ctx.send.stream, + NULL); + ASSERT(r == 0); + + /* Perform two writes to the same pipe to make sure that on Windows we are + * not running into issue 505: + * https://github.com/libuv/libuv/issues/505 */ + buf = uv_buf_init(".", 1); + r = uv_write2(&ctx.write_req2, + (uv_stream_t*)&ctx.channel, + &buf, 1, + &ctx.send2.stream, + NULL); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*)&ctx.channel, alloc_cb, recv_cb); + ASSERT(r == 0); +} + +static int run_test(int inprocess) { + uv_process_t process; + uv_thread_t tid; + int r; + + if (inprocess) { + r = uv_thread_create(&tid, ipc_send_recv_helper_threadproc, (void *) 42); + ASSERT(r == 0); + + uv_sleep(1000); + + r = uv_pipe_init(uv_default_loop(), &ctx.channel, 1); + ASSERT(r == 0); + + uv_pipe_connect(&ctx.connect_req, &ctx.channel, TEST_PIPENAME_3, connect_cb); + } else { + spawn_helper(&ctx.channel, &process, "ipc_send_recv_helper"); + + connect_cb(&ctx.connect_req, 0); + } + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(recv_cb_called == 2); + + if (inprocess) { + r = uv_thread_join(&tid); + ASSERT(r == 0); + } + + return 0; +} + +static int run_ipc_send_recv_pipe(int inprocess) { + int r; + + ctx.expected_type = UV_NAMED_PIPE; + + r = uv_pipe_init(uv_default_loop(), &ctx.send.pipe, 1); + ASSERT(r == 0); + + r = uv_pipe_bind(&ctx.send.pipe, TEST_PIPENAME); + ASSERT(r == 0); + + r = uv_pipe_init(uv_default_loop(), &ctx.send2.pipe, 1); + ASSERT(r == 0); + + r = uv_pipe_bind(&ctx.send2.pipe, TEST_PIPENAME_2); + ASSERT(r == 0); + + r = run_test(inprocess); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(ipc_send_recv_pipe) { + return run_ipc_send_recv_pipe(0); +} + +TEST_IMPL(ipc_send_recv_pipe_inprocess) { + return run_ipc_send_recv_pipe(1); +} + +static int run_ipc_send_recv_tcp(int inprocess) { + struct sockaddr_in addr; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + ctx.expected_type = UV_TCP; + + r = uv_tcp_init(uv_default_loop(), &ctx.send.tcp); + ASSERT(r == 0); + + r = uv_tcp_init(uv_default_loop(), &ctx.send2.tcp); + ASSERT(r == 0); + + r = uv_tcp_bind(&ctx.send.tcp, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_tcp_bind(&ctx.send2.tcp, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = run_test(inprocess); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(ipc_send_recv_tcp) { + return run_ipc_send_recv_tcp(0); +} + +TEST_IMPL(ipc_send_recv_tcp_inprocess) { + return run_ipc_send_recv_tcp(1); +} + + +/* Everything here runs in a child process or second thread. */ + +static void write2_cb(uv_write_t* req, int status) { + ASSERT(status == 0); + + /* After two successful writes in the child process, allow the child + * process to be closed. */ + if (++write2_cb_called == 2 && (is_child_process || is_in_process)) { + uv_close(&ctx2.recv.handle, NULL); + uv_close(&ctx2.recv2.handle, NULL); + uv_close((uv_handle_t*)&ctx2.channel, NULL); + uv_close((uv_handle_t*)&ctx2.listen, NULL); + } +} + +static void read_cb(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* rdbuf) { + uv_buf_t wrbuf; + uv_pipe_t* pipe; + uv_handle_type pending; + int r; + union handles* recv; + uv_write_t* write_req; + + if (nread == UV__EOF || nread == UV__ECONNABORTED) { + return; + } + + if (++read_cb_called == 2) { + recv = &ctx2.recv; + write_req = &ctx2.write_req; + } else { + recv = &ctx2.recv2; + write_req = &ctx2.write_req2; + } + + pipe = (uv_pipe_t*) handle; + ASSERT(pipe == &ctx2.channel); + ASSERT(nread >= 0); + ASSERT(1 == uv_pipe_pending_count(pipe)); + + pending = uv_pipe_pending_type(pipe); + ASSERT(pending == UV_NAMED_PIPE || pending == UV_TCP); + + if (pending == UV_NAMED_PIPE) + r = uv_pipe_init(ctx2.channel.loop, &recv->pipe, 0); + else if (pending == UV_TCP) + r = uv_tcp_init(ctx2.channel.loop, &recv->tcp); + else + abort(); + ASSERT(r == 0); + + r = uv_accept(handle, &recv->stream); + ASSERT(r == 0); + + wrbuf = uv_buf_init(".", 1); + r = uv_write2(write_req, + (uv_stream_t*)&ctx2.channel, + &wrbuf, + 1, + &recv->stream, + write2_cb); + ASSERT(r == 0); +} + +static void send_recv_start() { + int r; + ASSERT(1 == uv_is_readable((uv_stream_t*)&ctx2.channel)); + ASSERT(1 == uv_is_writable((uv_stream_t*)&ctx2.channel)); + ASSERT(0 == uv_is_closing((uv_handle_t*)&ctx2.channel)); + + r = uv_read_start((uv_stream_t*)&ctx2.channel, alloc_cb, read_cb); + ASSERT(r == 0); +} + +static void listen_cb(uv_stream_t* handle, int status) { + int r; + ASSERT(handle == (uv_stream_t*)&ctx2.listen); + ASSERT(status == 0); + + r = uv_accept((uv_stream_t*)&ctx2.listen, (uv_stream_t*)&ctx2.channel); + ASSERT(r == 0); + + send_recv_start(); +} + +int run_ipc_send_recv_helper(uv_loop_t* loop, int inprocess) { + int r; + + is_in_process = inprocess; + + memset(&ctx2, 0, sizeof(ctx2)); + + r = uv_pipe_init(loop, &ctx2.listen, 0); + ASSERT(r == 0); + + r = uv_pipe_init(loop, &ctx2.channel, 1); + ASSERT(r == 0); + + if (inprocess) { + r = uv_pipe_bind(&ctx2.listen, TEST_PIPENAME_3); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&ctx2.listen, SOMAXCONN, listen_cb); + ASSERT(r == 0); + } else { + r = uv_pipe_open(&ctx2.channel, 0); + ASSERT(r == 0); + + send_recv_start(); + } + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + return 0; +} + +/* stdin is a duplex channel over which a handle is sent. + * We receive it and send it back where it came from. + */ +int ipc_send_recv_helper(void) { + int r; + + r = run_ipc_send_recv_helper(uv_default_loop(), 0); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +void ipc_send_recv_helper_threadproc(void* arg) { + int r; + uv_loop_t loop; + + r = uv_loop_init(&loop); + ASSERT(r == 0); + + r = run_ipc_send_recv_helper(&loop, 1); + ASSERT(r == 0); + + r = uv_loop_close(&loop); + ASSERT(r == 0); +} diff --git a/3rdparty/libuv/test/test-ipc.c b/3rdparty/libuv/test/test-ipc.c new file mode 100644 index 00000000000..f018c2d4d49 --- /dev/null +++ b/3rdparty/libuv/test/test-ipc.c @@ -0,0 +1,779 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +static uv_pipe_t channel; +static uv_tcp_t tcp_server; +static uv_tcp_t tcp_server2; +static uv_tcp_t tcp_connection; + +static int exit_cb_called; +static int read_cb_called; +static int tcp_write_cb_called; +static int tcp_read_cb_called; +static int on_pipe_read_called; +static int local_conn_accepted; +static int remote_conn_accepted; +static int tcp_server_listening; +static uv_write_t write_req; +static uv_write_t conn_notify_req; +static int close_cb_called; +static int connection_accepted; +static int tcp_conn_read_cb_called; +static int tcp_conn_write_cb_called; + +typedef struct { + uv_connect_t conn_req; + uv_write_t tcp_write_req; + uv_tcp_t conn; +} tcp_conn; + +#define CONN_COUNT 100 +#define BACKLOG 128 + + +static void close_server_conn_cb(uv_handle_t* handle) { + free(handle); +} + + +static void on_connection(uv_stream_t* server, int status) { + uv_tcp_t* conn; + int r; + + if (!local_conn_accepted) { + /* Accept the connection and close it. Also and close the server. */ + ASSERT(status == 0); + ASSERT((uv_stream_t*)&tcp_server == server); + + conn = malloc(sizeof(*conn)); + ASSERT(conn); + r = uv_tcp_init(server->loop, conn); + ASSERT(r == 0); + + r = uv_accept(server, (uv_stream_t*)conn); + ASSERT(r == 0); + + uv_close((uv_handle_t*)conn, close_server_conn_cb); + uv_close((uv_handle_t*)server, NULL); + local_conn_accepted = 1; + } +} + + +static void exit_cb(uv_process_t* process, + int64_t exit_status, + int term_signal) { + printf("exit_cb\n"); + exit_cb_called++; + ASSERT(exit_status == 0); + uv_close((uv_handle_t*)process, NULL); +} + + +static void on_alloc(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + buf->base = malloc(suggested_size); + buf->len = suggested_size; +} + + +static void close_client_conn_cb(uv_handle_t* handle) { + tcp_conn* p = (tcp_conn*)handle->data; + free(p); +} + + +static void connect_cb(uv_connect_t* req, int status) { + uv_close((uv_handle_t*)req->handle, close_client_conn_cb); +} + + +static void make_many_connections(void) { + tcp_conn* conn; + struct sockaddr_in addr; + int r, i; + + for (i = 0; i < CONN_COUNT; i++) { + conn = malloc(sizeof(*conn)); + ASSERT(conn); + + r = uv_tcp_init(uv_default_loop(), &conn->conn); + ASSERT(r == 0); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_connect(&conn->conn_req, + (uv_tcp_t*) &conn->conn, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); + + conn->conn.data = conn; + } +} + + +static void on_read(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + int r; + uv_pipe_t* pipe; + uv_handle_type pending; + uv_buf_t outbuf; + + pipe = (uv_pipe_t*) handle; + + if (nread == 0) { + /* Everything OK, but nothing read. */ + free(buf->base); + return; + } + + if (nread < 0) { + if (nread == UV_EOF) { + free(buf->base); + return; + } + + printf("error recving on channel: %s\n", uv_strerror(nread)); + abort(); + } + + fprintf(stderr, "got %d bytes\n", (int)nread); + + pending = uv_pipe_pending_type(pipe); + if (!tcp_server_listening) { + ASSERT(1 == uv_pipe_pending_count(pipe)); + ASSERT(nread > 0 && buf->base && pending != UV_UNKNOWN_HANDLE); + read_cb_called++; + + /* Accept the pending TCP server, and start listening on it. */ + ASSERT(pending == UV_TCP); + r = uv_tcp_init(uv_default_loop(), &tcp_server); + ASSERT(r == 0); + + r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, on_connection); + ASSERT(r == 0); + + tcp_server_listening = 1; + + /* Make sure that the expected data is correctly multiplexed. */ + ASSERT(memcmp("hello\n", buf->base, nread) == 0); + + outbuf = uv_buf_init("world\n", 6); + r = uv_write(&write_req, (uv_stream_t*)pipe, &outbuf, 1, NULL); + ASSERT(r == 0); + + /* Create a bunch of connections to get both servers to accept. */ + make_many_connections(); + } else if (memcmp("accepted_connection\n", buf->base, nread) == 0) { + /* Remote server has accepted a connection. Close the channel. */ + ASSERT(0 == uv_pipe_pending_count(pipe)); + ASSERT(pending == UV_UNKNOWN_HANDLE); + remote_conn_accepted = 1; + uv_close((uv_handle_t*)&channel, NULL); + } + + free(buf->base); +} + +#ifdef _WIN32 +static void on_read_listen_after_bound_twice(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + int r; + uv_pipe_t* pipe; + uv_handle_type pending; + + pipe = (uv_pipe_t*) handle; + + if (nread == 0) { + /* Everything OK, but nothing read. */ + free(buf->base); + return; + } + + if (nread < 0) { + if (nread == UV_EOF) { + free(buf->base); + return; + } + + printf("error recving on channel: %s\n", uv_strerror(nread)); + abort(); + } + + fprintf(stderr, "got %d bytes\n", (int)nread); + + ASSERT(uv_pipe_pending_count(pipe) > 0); + pending = uv_pipe_pending_type(pipe); + ASSERT(nread > 0 && buf->base && pending != UV_UNKNOWN_HANDLE); + read_cb_called++; + + if (read_cb_called == 1) { + /* Accept the first TCP server, and start listening on it. */ + ASSERT(pending == UV_TCP); + r = uv_tcp_init(uv_default_loop(), &tcp_server); + ASSERT(r == 0); + + r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, on_connection); + ASSERT(r == 0); + } else if (read_cb_called == 2) { + /* Accept the second TCP server, and start listening on it. */ + ASSERT(pending == UV_TCP); + r = uv_tcp_init(uv_default_loop(), &tcp_server2); + ASSERT(r == 0); + + r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server2); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&tcp_server2, BACKLOG, on_connection); + ASSERT(r == UV_EADDRINUSE); + + uv_close((uv_handle_t*)&tcp_server, NULL); + uv_close((uv_handle_t*)&tcp_server2, NULL); + ASSERT(0 == uv_pipe_pending_count(pipe)); + uv_close((uv_handle_t*)&channel, NULL); + } + + free(buf->base); +} +#endif + +void spawn_helper(uv_pipe_t* channel, + uv_process_t* process, + const char* helper) { + uv_process_options_t options; + size_t exepath_size; + char exepath[1024]; + char* args[3]; + int r; + uv_stdio_container_t stdio[1]; + + r = uv_pipe_init(uv_default_loop(), channel, 1); + ASSERT(r == 0); + ASSERT(channel->ipc); + + exepath_size = sizeof(exepath); + r = uv_exepath(exepath, &exepath_size); + ASSERT(r == 0); + + exepath[exepath_size] = '\0'; + args[0] = exepath; + args[1] = (char*)helper; + args[2] = NULL; + + memset(&options, 0, sizeof(options)); + options.file = exepath; + options.args = args; + options.exit_cb = exit_cb; + + options.stdio = stdio; + options.stdio[0].flags = UV_CREATE_PIPE | + UV_READABLE_PIPE | UV_WRITABLE_PIPE; + options.stdio[0].data.stream = (uv_stream_t*)channel; + options.stdio_count = 1; + + r = uv_spawn(uv_default_loop(), process, &options); + ASSERT(r == 0); +} + + +static void on_tcp_write(uv_write_t* req, int status) { + ASSERT(status == 0); + ASSERT(req->handle == (uv_stream_t*)&tcp_connection); + tcp_write_cb_called++; +} + + +static void on_read_alloc(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + buf->base = malloc(suggested_size); + buf->len = suggested_size; +} + + +static void on_tcp_read(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { + ASSERT(nread > 0); + ASSERT(memcmp("hello again\n", buf->base, nread) == 0); + ASSERT(tcp == (uv_stream_t*)&tcp_connection); + free(buf->base); + + tcp_read_cb_called++; + + uv_close((uv_handle_t*)tcp, NULL); + uv_close((uv_handle_t*)&channel, NULL); +} + + +static void on_read_connection(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + int r; + uv_buf_t outbuf; + uv_pipe_t* pipe; + uv_handle_type pending; + + pipe = (uv_pipe_t*) handle; + if (nread == 0) { + /* Everything OK, but nothing read. */ + free(buf->base); + return; + } + + if (nread < 0) { + if (nread == UV_EOF) { + free(buf->base); + return; + } + + printf("error recving on channel: %s\n", uv_strerror(nread)); + abort(); + } + + fprintf(stderr, "got %d bytes\n", (int)nread); + + ASSERT(1 == uv_pipe_pending_count(pipe)); + pending = uv_pipe_pending_type(pipe); + + ASSERT(nread > 0 && buf->base && pending != UV_UNKNOWN_HANDLE); + read_cb_called++; + + /* Accept the pending TCP connection */ + ASSERT(pending == UV_TCP); + r = uv_tcp_init(uv_default_loop(), &tcp_connection); + ASSERT(r == 0); + + r = uv_accept(handle, (uv_stream_t*)&tcp_connection); + ASSERT(r == 0); + + /* Make sure that the expected data is correctly multiplexed. */ + ASSERT(memcmp("hello\n", buf->base, nread) == 0); + + /* Write/read to/from the connection */ + outbuf = uv_buf_init("world\n", 6); + r = uv_write(&write_req, (uv_stream_t*)&tcp_connection, &outbuf, 1, + on_tcp_write); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*)&tcp_connection, on_read_alloc, on_tcp_read); + ASSERT(r == 0); + + free(buf->base); +} + + +static int run_ipc_test(const char* helper, uv_read_cb read_cb) { + uv_process_t process; + int r; + + spawn_helper(&channel, &process, helper); + uv_read_start((uv_stream_t*)&channel, on_alloc, read_cb); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(ipc_listen_before_write) { + int r = run_ipc_test("ipc_helper_listen_before_write", on_read); + ASSERT(local_conn_accepted == 1); + ASSERT(remote_conn_accepted == 1); + ASSERT(read_cb_called == 1); + ASSERT(exit_cb_called == 1); + return r; +} + + +TEST_IMPL(ipc_listen_after_write) { + int r = run_ipc_test("ipc_helper_listen_after_write", on_read); + ASSERT(local_conn_accepted == 1); + ASSERT(remote_conn_accepted == 1); + ASSERT(read_cb_called == 1); + ASSERT(exit_cb_called == 1); + return r; +} + + +TEST_IMPL(ipc_tcp_connection) { + int r = run_ipc_test("ipc_helper_tcp_connection", on_read_connection); + ASSERT(read_cb_called == 1); + ASSERT(tcp_write_cb_called == 1); + ASSERT(tcp_read_cb_called == 1); + ASSERT(exit_cb_called == 1); + return r; +} + + +#ifdef _WIN32 +TEST_IMPL(listen_with_simultaneous_accepts) { + uv_tcp_t server; + int r; + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_tcp_simultaneous_accepts(&server, 1); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&server, SOMAXCONN, NULL); + ASSERT(r == 0); + ASSERT(server.reqs_pending == 32); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(listen_no_simultaneous_accepts) { + uv_tcp_t server; + int r; + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_tcp_simultaneous_accepts(&server, 0); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&server, SOMAXCONN, NULL); + ASSERT(r == 0); + ASSERT(server.reqs_pending == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(ipc_listen_after_bind_twice) { + int r = run_ipc_test("ipc_helper_bind_twice", on_read_listen_after_bound_twice); + ASSERT(read_cb_called == 2); + ASSERT(exit_cb_called == 1); + return r; +} +#endif + + +/* Everything here runs in a child process. */ + +static tcp_conn conn; + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +static void conn_notify_write_cb(uv_write_t* req, int status) { + uv_close((uv_handle_t*)&tcp_server, close_cb); + uv_close((uv_handle_t*)&channel, close_cb); +} + + +static void tcp_connection_write_cb(uv_write_t* req, int status) { + ASSERT((uv_handle_t*)&conn.conn == (uv_handle_t*)req->handle); + uv_close((uv_handle_t*)req->handle, close_cb); + uv_close((uv_handle_t*)&channel, close_cb); + uv_close((uv_handle_t*)&tcp_server, close_cb); + tcp_conn_write_cb_called++; +} + + +static void on_tcp_child_process_read(uv_stream_t* tcp, + ssize_t nread, + const uv_buf_t* buf) { + uv_buf_t outbuf; + int r; + + if (nread < 0) { + if (nread == UV_EOF) { + free(buf->base); + return; + } + + printf("error recving on tcp connection: %s\n", uv_strerror(nread)); + abort(); + } + + ASSERT(nread > 0); + ASSERT(memcmp("world\n", buf->base, nread) == 0); + on_pipe_read_called++; + free(buf->base); + + /* Write to the socket */ + outbuf = uv_buf_init("hello again\n", 12); + r = uv_write(&conn.tcp_write_req, tcp, &outbuf, 1, tcp_connection_write_cb); + ASSERT(r == 0); + + tcp_conn_read_cb_called++; +} + + +static void connect_child_process_cb(uv_connect_t* req, int status) { + int r; + + ASSERT(status == 0); + r = uv_read_start(req->handle, on_read_alloc, on_tcp_child_process_read); + ASSERT(r == 0); +} + + +static void ipc_on_connection(uv_stream_t* server, int status) { + int r; + uv_buf_t buf; + + if (!connection_accepted) { + /* + * Accept the connection and close it. Also let the other + * side know. + */ + ASSERT(status == 0); + ASSERT((uv_stream_t*)&tcp_server == server); + + r = uv_tcp_init(server->loop, &conn.conn); + ASSERT(r == 0); + + r = uv_accept(server, (uv_stream_t*)&conn.conn); + ASSERT(r == 0); + + uv_close((uv_handle_t*)&conn.conn, close_cb); + + buf = uv_buf_init("accepted_connection\n", 20); + r = uv_write2(&conn_notify_req, (uv_stream_t*)&channel, &buf, 1, + NULL, conn_notify_write_cb); + ASSERT(r == 0); + + connection_accepted = 1; + } +} + + +static void ipc_on_connection_tcp_conn(uv_stream_t* server, int status) { + int r; + uv_buf_t buf; + uv_tcp_t* conn; + + ASSERT(status == 0); + ASSERT((uv_stream_t*)&tcp_server == server); + + conn = malloc(sizeof(*conn)); + ASSERT(conn); + + r = uv_tcp_init(server->loop, conn); + ASSERT(r == 0); + + r = uv_accept(server, (uv_stream_t*)conn); + ASSERT(r == 0); + + /* Send the accepted connection to the other process */ + buf = uv_buf_init("hello\n", 6); + r = uv_write2(&conn_notify_req, (uv_stream_t*)&channel, &buf, 1, + (uv_stream_t*)conn, NULL); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*) conn, + on_read_alloc, + on_tcp_child_process_read); + ASSERT(r == 0); + + uv_close((uv_handle_t*)conn, close_cb); +} + + +int ipc_helper(int listen_after_write) { + /* + * This is launched from test-ipc.c. stdin is a duplex channel that we + * over which a handle will be transmitted. + */ + struct sockaddr_in addr; + uv_write_t write_req; + int r; + uv_buf_t buf; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + r = uv_pipe_init(uv_default_loop(), &channel, 1); + ASSERT(r == 0); + + uv_pipe_open(&channel, 0); + + ASSERT(1 == uv_is_readable((uv_stream_t*) &channel)); + ASSERT(1 == uv_is_writable((uv_stream_t*) &channel)); + ASSERT(0 == uv_is_closing((uv_handle_t*) &channel)); + + r = uv_tcp_init(uv_default_loop(), &tcp_server); + ASSERT(r == 0); + + r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + if (!listen_after_write) { + r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, ipc_on_connection); + ASSERT(r == 0); + } + + buf = uv_buf_init("hello\n", 6); + r = uv_write2(&write_req, (uv_stream_t*)&channel, &buf, 1, + (uv_stream_t*)&tcp_server, NULL); + ASSERT(r == 0); + + if (listen_after_write) { + r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, ipc_on_connection); + ASSERT(r == 0); + } + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(connection_accepted == 1); + ASSERT(close_cb_called == 3); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +int ipc_helper_tcp_connection(void) { + /* + * This is launched from test-ipc.c. stdin is a duplex channel + * over which a handle will be transmitted. + */ + + int r; + struct sockaddr_in addr; + + r = uv_pipe_init(uv_default_loop(), &channel, 1); + ASSERT(r == 0); + + uv_pipe_open(&channel, 0); + + ASSERT(1 == uv_is_readable((uv_stream_t*) &channel)); + ASSERT(1 == uv_is_writable((uv_stream_t*) &channel)); + ASSERT(0 == uv_is_closing((uv_handle_t*) &channel)); + + r = uv_tcp_init(uv_default_loop(), &tcp_server); + ASSERT(r == 0); + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, ipc_on_connection_tcp_conn); + ASSERT(r == 0); + + /* Make a connection to the server */ + r = uv_tcp_init(uv_default_loop(), &conn.conn); + ASSERT(r == 0); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_connect(&conn.conn_req, + (uv_tcp_t*) &conn.conn, + (const struct sockaddr*) &addr, + connect_child_process_cb); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(tcp_conn_read_cb_called == 1); + ASSERT(tcp_conn_write_cb_called == 1); + ASSERT(close_cb_called == 4); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +int ipc_helper_bind_twice(void) { + /* + * This is launched from test-ipc.c. stdin is a duplex channel + * over which two handles will be transmitted. + */ + struct sockaddr_in addr; + uv_write_t write_req; + uv_write_t write_req2; + int r; + uv_buf_t buf; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + r = uv_pipe_init(uv_default_loop(), &channel, 1); + ASSERT(r == 0); + + uv_pipe_open(&channel, 0); + + ASSERT(1 == uv_is_readable((uv_stream_t*) &channel)); + ASSERT(1 == uv_is_writable((uv_stream_t*) &channel)); + ASSERT(0 == uv_is_closing((uv_handle_t*) &channel)); + + buf = uv_buf_init("hello\n", 6); + + r = uv_tcp_init(uv_default_loop(), &tcp_server); + ASSERT(r == 0); + r = uv_tcp_init(uv_default_loop(), &tcp_server2); + ASSERT(r == 0); + + r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + r = uv_tcp_bind(&tcp_server2, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_write2(&write_req, (uv_stream_t*)&channel, &buf, 1, + (uv_stream_t*)&tcp_server, NULL); + ASSERT(r == 0); + r = uv_write2(&write_req2, (uv_stream_t*)&channel, &buf, 1, + (uv_stream_t*)&tcp_server2, NULL); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-list.h b/3rdparty/libuv/test/test-list.h new file mode 100644 index 00000000000..858a20af49c --- /dev/null +++ b/3rdparty/libuv/test/test-list.h @@ -0,0 +1,732 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +TEST_DECLARE (platform_output) +TEST_DECLARE (callback_order) +TEST_DECLARE (close_order) +TEST_DECLARE (run_once) +TEST_DECLARE (run_nowait) +TEST_DECLARE (loop_alive) +TEST_DECLARE (loop_close) +TEST_DECLARE (loop_stop) +TEST_DECLARE (loop_update_time) +TEST_DECLARE (loop_backend_timeout) +TEST_DECLARE (loop_configure) +TEST_DECLARE (default_loop_close) +TEST_DECLARE (barrier_1) +TEST_DECLARE (barrier_2) +TEST_DECLARE (barrier_3) +TEST_DECLARE (condvar_1) +TEST_DECLARE (condvar_2) +TEST_DECLARE (condvar_3) +TEST_DECLARE (condvar_4) +TEST_DECLARE (condvar_5) +TEST_DECLARE (semaphore_1) +TEST_DECLARE (semaphore_2) +TEST_DECLARE (semaphore_3) +TEST_DECLARE (tty) +TEST_DECLARE (tty_file) +TEST_DECLARE (stdio_over_pipes) +TEST_DECLARE (ip6_pton) +TEST_DECLARE (ipc_listen_before_write) +TEST_DECLARE (ipc_listen_after_write) +#ifndef _WIN32 +TEST_DECLARE (ipc_send_recv_pipe) +TEST_DECLARE (ipc_send_recv_pipe_inprocess) +#endif +TEST_DECLARE (ipc_send_recv_tcp) +TEST_DECLARE (ipc_send_recv_tcp_inprocess) +TEST_DECLARE (ipc_tcp_connection) +TEST_DECLARE (tcp_ping_pong) +TEST_DECLARE (tcp_ping_pong_v6) +TEST_DECLARE (pipe_ping_pong) +TEST_DECLARE (delayed_accept) +TEST_DECLARE (multiple_listen) +#ifndef _WIN32 +TEST_DECLARE (tcp_write_after_connect) +#endif +TEST_DECLARE (tcp_writealot) +TEST_DECLARE (tcp_write_fail) +TEST_DECLARE (tcp_try_write) +TEST_DECLARE (tcp_write_queue_order) +TEST_DECLARE (tcp_open) +TEST_DECLARE (tcp_open_twice) +TEST_DECLARE (tcp_connect_error_after_write) +TEST_DECLARE (tcp_shutdown_after_write) +TEST_DECLARE (tcp_bind_error_addrinuse) +TEST_DECLARE (tcp_bind_error_addrnotavail_1) +TEST_DECLARE (tcp_bind_error_addrnotavail_2) +TEST_DECLARE (tcp_bind_error_fault) +TEST_DECLARE (tcp_bind_error_inval) +TEST_DECLARE (tcp_bind_localhost_ok) +TEST_DECLARE (tcp_bind_invalid_flags) +TEST_DECLARE (tcp_listen_without_bind) +TEST_DECLARE (tcp_connect_error_fault) +TEST_DECLARE (tcp_connect_timeout) +TEST_DECLARE (tcp_close_while_connecting) +TEST_DECLARE (tcp_close) +TEST_DECLARE (tcp_create_early) +TEST_DECLARE (tcp_create_early_bad_bind) +TEST_DECLARE (tcp_create_early_bad_domain) +TEST_DECLARE (tcp_create_early_accept) +#ifndef _WIN32 +TEST_DECLARE (tcp_close_accept) +TEST_DECLARE (tcp_oob) +#endif +TEST_DECLARE (tcp_flags) +TEST_DECLARE (tcp_write_to_half_open_connection) +TEST_DECLARE (tcp_unexpected_read) +TEST_DECLARE (tcp_read_stop) +TEST_DECLARE (tcp_bind6_error_addrinuse) +TEST_DECLARE (tcp_bind6_error_addrnotavail) +TEST_DECLARE (tcp_bind6_error_fault) +TEST_DECLARE (tcp_bind6_error_inval) +TEST_DECLARE (tcp_bind6_localhost_ok) +TEST_DECLARE (udp_bind) +TEST_DECLARE (udp_bind_reuseaddr) +TEST_DECLARE (udp_create_early) +TEST_DECLARE (udp_create_early_bad_bind) +TEST_DECLARE (udp_create_early_bad_domain) +TEST_DECLARE (udp_send_and_recv) +TEST_DECLARE (udp_send_immediate) +TEST_DECLARE (udp_send_unreachable) +TEST_DECLARE (udp_multicast_join) +TEST_DECLARE (udp_multicast_join6) +TEST_DECLARE (udp_multicast_ttl) +TEST_DECLARE (udp_multicast_interface) +TEST_DECLARE (udp_multicast_interface6) +TEST_DECLARE (udp_dgram_too_big) +TEST_DECLARE (udp_dual_stack) +TEST_DECLARE (udp_ipv6_only) +TEST_DECLARE (udp_options) +TEST_DECLARE (udp_options6) +TEST_DECLARE (udp_no_autobind) +TEST_DECLARE (udp_open) +TEST_DECLARE (udp_open_twice) +TEST_DECLARE (udp_try_send) +TEST_DECLARE (pipe_bind_error_addrinuse) +TEST_DECLARE (pipe_bind_error_addrnotavail) +TEST_DECLARE (pipe_bind_error_inval) +TEST_DECLARE (pipe_connect_multiple) +TEST_DECLARE (pipe_listen_without_bind) +TEST_DECLARE (pipe_connect_bad_name) +TEST_DECLARE (pipe_connect_to_file) +TEST_DECLARE (pipe_connect_on_prepare) +TEST_DECLARE (pipe_getsockname) +TEST_DECLARE (pipe_getsockname_abstract) +TEST_DECLARE (pipe_getsockname_blocking) +TEST_DECLARE (pipe_pending_instances) +TEST_DECLARE (pipe_sendmsg) +TEST_DECLARE (pipe_server_close) +TEST_DECLARE (connection_fail) +TEST_DECLARE (connection_fail_doesnt_auto_close) +TEST_DECLARE (shutdown_close_tcp) +TEST_DECLARE (shutdown_close_pipe) +TEST_DECLARE (shutdown_eof) +TEST_DECLARE (shutdown_twice) +TEST_DECLARE (callback_stack) +TEST_DECLARE (error_message) +TEST_DECLARE (timer) +TEST_DECLARE (timer_init) +TEST_DECLARE (timer_again) +TEST_DECLARE (timer_start_twice) +TEST_DECLARE (timer_order) +TEST_DECLARE (timer_huge_timeout) +TEST_DECLARE (timer_huge_repeat) +TEST_DECLARE (timer_run_once) +TEST_DECLARE (timer_from_check) +TEST_DECLARE (timer_null_callback) +TEST_DECLARE (idle_starvation) +TEST_DECLARE (loop_handles) +TEST_DECLARE (get_loadavg) +TEST_DECLARE (walk_handles) +TEST_DECLARE (watcher_cross_stop) +TEST_DECLARE (ref) +TEST_DECLARE (idle_ref) +TEST_DECLARE (async_ref) +TEST_DECLARE (prepare_ref) +TEST_DECLARE (check_ref) +TEST_DECLARE (unref_in_prepare_cb) +TEST_DECLARE (timer_ref) +TEST_DECLARE (timer_ref2) +TEST_DECLARE (fs_event_ref) +TEST_DECLARE (fs_poll_ref) +TEST_DECLARE (tcp_ref) +TEST_DECLARE (tcp_ref2) +TEST_DECLARE (tcp_ref2b) +TEST_DECLARE (tcp_ref3) +TEST_DECLARE (tcp_ref4) +TEST_DECLARE (udp_ref) +TEST_DECLARE (udp_ref2) +TEST_DECLARE (udp_ref3) +TEST_DECLARE (pipe_ref) +TEST_DECLARE (pipe_ref2) +TEST_DECLARE (pipe_ref3) +TEST_DECLARE (pipe_ref4) +#ifndef _WIN32 +TEST_DECLARE (pipe_close_stdout_read_stdin) +#endif +TEST_DECLARE (pipe_set_non_blocking) +TEST_DECLARE (process_ref) +TEST_DECLARE (has_ref) +TEST_DECLARE (active) +TEST_DECLARE (embed) +TEST_DECLARE (async) +TEST_DECLARE (async_null_cb) +TEST_DECLARE (get_currentexe) +TEST_DECLARE (process_title) +TEST_DECLARE (cwd_and_chdir) +TEST_DECLARE (get_memory) +TEST_DECLARE (handle_fileno) +TEST_DECLARE (homedir) +TEST_DECLARE (hrtime) +TEST_DECLARE (getaddrinfo_fail) +TEST_DECLARE (getaddrinfo_fail_sync) +TEST_DECLARE (getaddrinfo_basic) +TEST_DECLARE (getaddrinfo_basic_sync) +TEST_DECLARE (getaddrinfo_concurrent) +TEST_DECLARE (getnameinfo_basic_ip4) +TEST_DECLARE (getnameinfo_basic_ip4_sync) +TEST_DECLARE (getnameinfo_basic_ip6) +TEST_DECLARE (getsockname_tcp) +TEST_DECLARE (getsockname_udp) +TEST_DECLARE (fail_always) +TEST_DECLARE (pass_always) +TEST_DECLARE (socket_buffer_size) +TEST_DECLARE (spawn_fails) +#ifndef _WIN32 +TEST_DECLARE (spawn_fails_check_for_waitpid_cleanup) +#endif +TEST_DECLARE (spawn_exit_code) +TEST_DECLARE (spawn_stdout) +TEST_DECLARE (spawn_stdin) +TEST_DECLARE (spawn_stdio_greater_than_3) +TEST_DECLARE (spawn_ignored_stdio) +TEST_DECLARE (spawn_and_kill) +TEST_DECLARE (spawn_detached) +TEST_DECLARE (spawn_and_kill_with_std) +TEST_DECLARE (spawn_and_ping) +TEST_DECLARE (spawn_preserve_env) +TEST_DECLARE (spawn_setuid_fails) +TEST_DECLARE (spawn_setgid_fails) +TEST_DECLARE (spawn_stdout_to_file) +TEST_DECLARE (spawn_stdout_and_stderr_to_file) +TEST_DECLARE (spawn_stdout_and_stderr_to_file2) +TEST_DECLARE (spawn_stdout_and_stderr_to_file_swap) +TEST_DECLARE (spawn_auto_unref) +TEST_DECLARE (spawn_closed_process_io) +TEST_DECLARE (spawn_reads_child_path) +TEST_DECLARE (spawn_inherit_streams) +TEST_DECLARE (fs_poll) +TEST_DECLARE (fs_poll_getpath) +TEST_DECLARE (kill) +TEST_DECLARE (fs_file_noent) +TEST_DECLARE (fs_file_nametoolong) +TEST_DECLARE (fs_file_loop) +TEST_DECLARE (fs_file_async) +TEST_DECLARE (fs_file_sync) +TEST_DECLARE (fs_file_write_null_buffer) +TEST_DECLARE (fs_async_dir) +TEST_DECLARE (fs_async_sendfile) +TEST_DECLARE (fs_mkdtemp) +TEST_DECLARE (fs_fstat) +TEST_DECLARE (fs_access) +TEST_DECLARE (fs_chmod) +TEST_DECLARE (fs_unlink_readonly) +TEST_DECLARE (fs_chown) +TEST_DECLARE (fs_link) +TEST_DECLARE (fs_readlink) +TEST_DECLARE (fs_realpath) +TEST_DECLARE (fs_symlink) +TEST_DECLARE (fs_symlink_dir) +TEST_DECLARE (fs_utime) +TEST_DECLARE (fs_futime) +TEST_DECLARE (fs_file_open_append) +TEST_DECLARE (fs_stat_missing_path) +TEST_DECLARE (fs_read_file_eof) +TEST_DECLARE (fs_event_watch_dir) +TEST_DECLARE (fs_event_watch_dir_recursive) +TEST_DECLARE (fs_event_watch_file) +TEST_DECLARE (fs_event_watch_file_twice) +TEST_DECLARE (fs_event_watch_file_current_dir) +TEST_DECLARE (fs_event_no_callback_after_close) +TEST_DECLARE (fs_event_no_callback_on_close) +TEST_DECLARE (fs_event_immediate_close) +TEST_DECLARE (fs_event_close_with_pending_event) +TEST_DECLARE (fs_event_close_in_callback) +TEST_DECLARE (fs_event_start_and_close) +TEST_DECLARE (fs_event_error_reporting) +TEST_DECLARE (fs_event_getpath) +TEST_DECLARE (fs_scandir_empty_dir) +TEST_DECLARE (fs_scandir_file) +TEST_DECLARE (fs_open_dir) +TEST_DECLARE (fs_rename_to_existing_file) +TEST_DECLARE (fs_write_multiple_bufs) +TEST_DECLARE (fs_read_write_null_arguments) +TEST_DECLARE (fs_write_alotof_bufs) +TEST_DECLARE (fs_write_alotof_bufs_with_offset) +TEST_DECLARE (threadpool_queue_work_simple) +TEST_DECLARE (threadpool_queue_work_einval) +TEST_DECLARE (threadpool_multiple_event_loops) +TEST_DECLARE (threadpool_cancel_getaddrinfo) +TEST_DECLARE (threadpool_cancel_getnameinfo) +TEST_DECLARE (threadpool_cancel_work) +TEST_DECLARE (threadpool_cancel_fs) +TEST_DECLARE (threadpool_cancel_single) +TEST_DECLARE (thread_local_storage) +TEST_DECLARE (thread_mutex) +TEST_DECLARE (thread_rwlock) +TEST_DECLARE (thread_rwlock_trylock) +TEST_DECLARE (thread_create) +TEST_DECLARE (thread_equal) +TEST_DECLARE (dlerror) +TEST_DECLARE (poll_duplex) +TEST_DECLARE (poll_unidirectional) +TEST_DECLARE (poll_close) + +TEST_DECLARE (ip4_addr) +TEST_DECLARE (ip6_addr_link_local) + +#ifdef _WIN32 +TEST_DECLARE (poll_close_doesnt_corrupt_stack) +TEST_DECLARE (poll_closesocket) +TEST_DECLARE (spawn_detect_pipe_name_collisions_on_windows) +#if !defined(USING_UV_SHARED) +TEST_DECLARE (argument_escaping) +TEST_DECLARE (environment_creation) +#endif +TEST_DECLARE (listen_with_simultaneous_accepts) +TEST_DECLARE (listen_no_simultaneous_accepts) +TEST_DECLARE (fs_stat_root) +TEST_DECLARE (spawn_with_an_odd_path) +TEST_DECLARE (ipc_listen_after_bind_twice) +#else +TEST_DECLARE (emfile) +TEST_DECLARE (close_fd) +TEST_DECLARE (spawn_fs_open) +TEST_DECLARE (spawn_setuid_setgid) +TEST_DECLARE (we_get_signal) +TEST_DECLARE (we_get_signals) +TEST_DECLARE (signal_multiple_loops) +TEST_DECLARE (closed_fd_events) +#endif +#ifdef __APPLE__ +TEST_DECLARE (osx_select) +TEST_DECLARE (osx_select_many_fds) +#endif +HELPER_DECLARE (tcp4_echo_server) +HELPER_DECLARE (tcp6_echo_server) +HELPER_DECLARE (udp4_echo_server) +HELPER_DECLARE (pipe_echo_server) + +TEST_DECLARE (queue_foreach_delete) + +TASK_LIST_START + TEST_ENTRY_CUSTOM (platform_output, 0, 1, 5000) + +#if 0 + TEST_ENTRY (callback_order) +#endif + TEST_ENTRY (close_order) + TEST_ENTRY (run_once) + TEST_ENTRY (run_nowait) + TEST_ENTRY (loop_alive) + TEST_ENTRY (loop_close) + TEST_ENTRY (loop_stop) + TEST_ENTRY (loop_update_time) + TEST_ENTRY (loop_backend_timeout) + TEST_ENTRY (loop_configure) + TEST_ENTRY (default_loop_close) + TEST_ENTRY (barrier_1) + TEST_ENTRY (barrier_2) + TEST_ENTRY (barrier_3) + TEST_ENTRY (condvar_1) + TEST_ENTRY (condvar_2) + TEST_ENTRY (condvar_3) + TEST_ENTRY (condvar_4) + TEST_ENTRY (condvar_5) + TEST_ENTRY (semaphore_1) + TEST_ENTRY (semaphore_2) + TEST_ENTRY (semaphore_3) + + TEST_ENTRY (pipe_connect_bad_name) + TEST_ENTRY (pipe_connect_to_file) + TEST_ENTRY (pipe_connect_on_prepare) + + TEST_ENTRY (pipe_server_close) +#ifndef _WIN32 + TEST_ENTRY (pipe_close_stdout_read_stdin) +#endif + TEST_ENTRY (pipe_set_non_blocking) + TEST_ENTRY (tty) + TEST_ENTRY (tty_file) + TEST_ENTRY (stdio_over_pipes) + TEST_ENTRY (ip6_pton) + TEST_ENTRY (ipc_listen_before_write) + TEST_ENTRY (ipc_listen_after_write) +#ifndef _WIN32 + TEST_ENTRY (ipc_send_recv_pipe) + TEST_ENTRY (ipc_send_recv_pipe_inprocess) +#endif + TEST_ENTRY (ipc_send_recv_tcp) + TEST_ENTRY (ipc_send_recv_tcp_inprocess) + TEST_ENTRY (ipc_tcp_connection) + + TEST_ENTRY (tcp_ping_pong) + TEST_HELPER (tcp_ping_pong, tcp4_echo_server) + + TEST_ENTRY (tcp_ping_pong_v6) + TEST_HELPER (tcp_ping_pong_v6, tcp6_echo_server) + + TEST_ENTRY (pipe_ping_pong) + TEST_HELPER (pipe_ping_pong, pipe_echo_server) + + TEST_ENTRY (delayed_accept) + TEST_ENTRY (multiple_listen) + +#ifndef _WIN32 + TEST_ENTRY (tcp_write_after_connect) +#endif + + TEST_ENTRY (tcp_writealot) + TEST_HELPER (tcp_writealot, tcp4_echo_server) + + TEST_ENTRY (tcp_write_fail) + TEST_HELPER (tcp_write_fail, tcp4_echo_server) + + TEST_ENTRY (tcp_try_write) + + TEST_ENTRY (tcp_write_queue_order) + + TEST_ENTRY (tcp_open) + TEST_HELPER (tcp_open, tcp4_echo_server) + TEST_ENTRY (tcp_open_twice) + + TEST_ENTRY (tcp_shutdown_after_write) + TEST_HELPER (tcp_shutdown_after_write, tcp4_echo_server) + + TEST_ENTRY (tcp_connect_error_after_write) + TEST_ENTRY (tcp_bind_error_addrinuse) + TEST_ENTRY (tcp_bind_error_addrnotavail_1) + TEST_ENTRY (tcp_bind_error_addrnotavail_2) + TEST_ENTRY (tcp_bind_error_fault) + TEST_ENTRY (tcp_bind_error_inval) + TEST_ENTRY (tcp_bind_localhost_ok) + TEST_ENTRY (tcp_bind_invalid_flags) + TEST_ENTRY (tcp_listen_without_bind) + TEST_ENTRY (tcp_connect_error_fault) + TEST_ENTRY (tcp_connect_timeout) + TEST_ENTRY (tcp_close_while_connecting) + TEST_ENTRY (tcp_close) + TEST_ENTRY (tcp_create_early) + TEST_ENTRY (tcp_create_early_bad_bind) + TEST_ENTRY (tcp_create_early_bad_domain) + TEST_ENTRY (tcp_create_early_accept) +#ifndef _WIN32 + TEST_ENTRY (tcp_close_accept) + TEST_ENTRY (tcp_oob) +#endif + TEST_ENTRY (tcp_flags) + TEST_ENTRY (tcp_write_to_half_open_connection) + TEST_ENTRY (tcp_unexpected_read) + + TEST_ENTRY (tcp_read_stop) + TEST_HELPER (tcp_read_stop, tcp4_echo_server) + + TEST_ENTRY (tcp_bind6_error_addrinuse) + TEST_ENTRY (tcp_bind6_error_addrnotavail) + TEST_ENTRY (tcp_bind6_error_fault) + TEST_ENTRY (tcp_bind6_error_inval) + TEST_ENTRY (tcp_bind6_localhost_ok) + + TEST_ENTRY (udp_bind) + TEST_ENTRY (udp_bind_reuseaddr) + TEST_ENTRY (udp_create_early) + TEST_ENTRY (udp_create_early_bad_bind) + TEST_ENTRY (udp_create_early_bad_domain) + TEST_ENTRY (udp_send_and_recv) + TEST_ENTRY (udp_send_immediate) + TEST_ENTRY (udp_send_unreachable) + TEST_ENTRY (udp_dgram_too_big) + TEST_ENTRY (udp_dual_stack) + TEST_ENTRY (udp_ipv6_only) + TEST_ENTRY (udp_options) + TEST_ENTRY (udp_options6) + TEST_ENTRY (udp_no_autobind) + TEST_ENTRY (udp_multicast_interface) + TEST_ENTRY (udp_multicast_interface6) + TEST_ENTRY (udp_multicast_join) + TEST_ENTRY (udp_multicast_join6) + TEST_ENTRY (udp_multicast_ttl) + TEST_ENTRY (udp_try_send) + + TEST_ENTRY (udp_open) + TEST_HELPER (udp_open, udp4_echo_server) + TEST_ENTRY (udp_open_twice) + + TEST_ENTRY (pipe_bind_error_addrinuse) + TEST_ENTRY (pipe_bind_error_addrnotavail) + TEST_ENTRY (pipe_bind_error_inval) + TEST_ENTRY (pipe_connect_multiple) + TEST_ENTRY (pipe_listen_without_bind) + TEST_ENTRY (pipe_getsockname) + TEST_ENTRY (pipe_getsockname_abstract) + TEST_ENTRY (pipe_getsockname_blocking) + TEST_ENTRY (pipe_pending_instances) + TEST_ENTRY (pipe_sendmsg) + + TEST_ENTRY (connection_fail) + TEST_ENTRY (connection_fail_doesnt_auto_close) + + TEST_ENTRY (shutdown_close_tcp) + TEST_HELPER (shutdown_close_tcp, tcp4_echo_server) + TEST_ENTRY (shutdown_close_pipe) + TEST_HELPER (shutdown_close_pipe, pipe_echo_server) + + TEST_ENTRY (shutdown_eof) + TEST_HELPER (shutdown_eof, tcp4_echo_server) + + TEST_ENTRY (shutdown_twice) + TEST_HELPER (shutdown_twice, tcp4_echo_server) + + TEST_ENTRY (callback_stack) + TEST_HELPER (callback_stack, tcp4_echo_server) + + TEST_ENTRY (error_message) + + TEST_ENTRY (timer) + TEST_ENTRY (timer_init) + TEST_ENTRY (timer_again) + TEST_ENTRY (timer_start_twice) + TEST_ENTRY (timer_order) + TEST_ENTRY (timer_huge_timeout) + TEST_ENTRY (timer_huge_repeat) + TEST_ENTRY (timer_run_once) + TEST_ENTRY (timer_from_check) + TEST_ENTRY (timer_null_callback) + + TEST_ENTRY (idle_starvation) + + TEST_ENTRY (ref) + TEST_ENTRY (idle_ref) + TEST_ENTRY (fs_poll_ref) + TEST_ENTRY (async_ref) + TEST_ENTRY (prepare_ref) + TEST_ENTRY (check_ref) + TEST_ENTRY (unref_in_prepare_cb) + TEST_ENTRY (timer_ref) + TEST_ENTRY (timer_ref2) + TEST_ENTRY (fs_event_ref) + TEST_ENTRY (tcp_ref) + TEST_ENTRY (tcp_ref2) + TEST_ENTRY (tcp_ref2b) + TEST_ENTRY (tcp_ref3) + TEST_HELPER (tcp_ref3, tcp4_echo_server) + TEST_ENTRY (tcp_ref4) + TEST_HELPER (tcp_ref4, tcp4_echo_server) + TEST_ENTRY (udp_ref) + TEST_ENTRY (udp_ref2) + TEST_ENTRY (udp_ref3) + TEST_HELPER (udp_ref3, udp4_echo_server) + TEST_ENTRY (pipe_ref) + TEST_ENTRY (pipe_ref2) + TEST_ENTRY (pipe_ref3) + TEST_HELPER (pipe_ref3, pipe_echo_server) + TEST_ENTRY (pipe_ref4) + TEST_HELPER (pipe_ref4, pipe_echo_server) + TEST_ENTRY (process_ref) + TEST_ENTRY (has_ref) + + TEST_ENTRY (loop_handles) + TEST_ENTRY (walk_handles) + + TEST_ENTRY (watcher_cross_stop) + + TEST_ENTRY (active) + + TEST_ENTRY (embed) + + TEST_ENTRY (async) + TEST_ENTRY (async_null_cb) + + TEST_ENTRY (get_currentexe) + + TEST_ENTRY (process_title) + + TEST_ENTRY (cwd_and_chdir) + + TEST_ENTRY (get_memory) + + TEST_ENTRY (get_loadavg) + + TEST_ENTRY (handle_fileno) + + TEST_ENTRY (homedir) + + TEST_ENTRY (hrtime) + + TEST_ENTRY_CUSTOM (getaddrinfo_fail, 0, 0, 10000) + TEST_ENTRY (getaddrinfo_fail_sync) + + TEST_ENTRY (getaddrinfo_basic) + TEST_ENTRY (getaddrinfo_basic_sync) + TEST_ENTRY (getaddrinfo_concurrent) + + TEST_ENTRY (getnameinfo_basic_ip4) + TEST_ENTRY (getnameinfo_basic_ip4_sync) + TEST_ENTRY (getnameinfo_basic_ip6) + + TEST_ENTRY (getsockname_tcp) + TEST_ENTRY (getsockname_udp) + + TEST_ENTRY (poll_duplex) + TEST_ENTRY (poll_unidirectional) + TEST_ENTRY (poll_close) + + TEST_ENTRY (socket_buffer_size) + + TEST_ENTRY (spawn_fails) +#ifndef _WIN32 + TEST_ENTRY (spawn_fails_check_for_waitpid_cleanup) +#endif + TEST_ENTRY (spawn_exit_code) + TEST_ENTRY (spawn_stdout) + TEST_ENTRY (spawn_stdin) + TEST_ENTRY (spawn_stdio_greater_than_3) + TEST_ENTRY (spawn_ignored_stdio) + TEST_ENTRY (spawn_and_kill) + TEST_ENTRY (spawn_detached) + TEST_ENTRY (spawn_and_kill_with_std) + TEST_ENTRY (spawn_and_ping) + TEST_ENTRY (spawn_preserve_env) + TEST_ENTRY (spawn_setuid_fails) + TEST_ENTRY (spawn_setgid_fails) + TEST_ENTRY (spawn_stdout_to_file) + TEST_ENTRY (spawn_stdout_and_stderr_to_file) + TEST_ENTRY (spawn_stdout_and_stderr_to_file2) + TEST_ENTRY (spawn_stdout_and_stderr_to_file_swap) + TEST_ENTRY (spawn_auto_unref) + TEST_ENTRY (spawn_closed_process_io) + TEST_ENTRY (spawn_reads_child_path) + TEST_ENTRY (spawn_inherit_streams) + TEST_ENTRY (fs_poll) + TEST_ENTRY (fs_poll_getpath) + TEST_ENTRY (kill) + +#ifdef _WIN32 + TEST_ENTRY (poll_close_doesnt_corrupt_stack) + TEST_ENTRY (poll_closesocket) + TEST_ENTRY (spawn_detect_pipe_name_collisions_on_windows) +#if !defined(USING_UV_SHARED) + TEST_ENTRY (argument_escaping) + TEST_ENTRY (environment_creation) +# endif + TEST_ENTRY (listen_with_simultaneous_accepts) + TEST_ENTRY (listen_no_simultaneous_accepts) + TEST_ENTRY (fs_stat_root) + TEST_ENTRY (spawn_with_an_odd_path) + TEST_ENTRY (ipc_listen_after_bind_twice) +#else + TEST_ENTRY (emfile) + TEST_ENTRY (close_fd) + TEST_ENTRY (spawn_fs_open) + TEST_ENTRY (spawn_setuid_setgid) + TEST_ENTRY (we_get_signal) + TEST_ENTRY (we_get_signals) + TEST_ENTRY (signal_multiple_loops) + TEST_ENTRY (closed_fd_events) +#endif + +#ifdef __APPLE__ + TEST_ENTRY (osx_select) + TEST_ENTRY (osx_select_many_fds) +#endif + + TEST_ENTRY (fs_file_noent) + TEST_ENTRY (fs_file_nametoolong) + TEST_ENTRY (fs_file_loop) + TEST_ENTRY (fs_file_async) + TEST_ENTRY (fs_file_sync) + TEST_ENTRY (fs_file_write_null_buffer) + TEST_ENTRY (fs_async_dir) + TEST_ENTRY (fs_async_sendfile) + TEST_ENTRY (fs_mkdtemp) + TEST_ENTRY (fs_fstat) + TEST_ENTRY (fs_access) + TEST_ENTRY (fs_chmod) + TEST_ENTRY (fs_unlink_readonly) + TEST_ENTRY (fs_chown) + TEST_ENTRY (fs_utime) + TEST_ENTRY (fs_futime) + TEST_ENTRY (fs_readlink) + TEST_ENTRY (fs_realpath) + TEST_ENTRY (fs_symlink) + TEST_ENTRY (fs_symlink_dir) + TEST_ENTRY (fs_stat_missing_path) + TEST_ENTRY (fs_read_file_eof) + TEST_ENTRY (fs_file_open_append) + TEST_ENTRY (fs_event_watch_dir) + TEST_ENTRY (fs_event_watch_dir_recursive) + TEST_ENTRY (fs_event_watch_file) + TEST_ENTRY (fs_event_watch_file_twice) + TEST_ENTRY (fs_event_watch_file_current_dir) + TEST_ENTRY (fs_event_no_callback_after_close) + TEST_ENTRY (fs_event_no_callback_on_close) + TEST_ENTRY (fs_event_immediate_close) + TEST_ENTRY (fs_event_close_with_pending_event) + TEST_ENTRY (fs_event_close_in_callback) + TEST_ENTRY (fs_event_start_and_close) + TEST_ENTRY (fs_event_error_reporting) + TEST_ENTRY (fs_event_getpath) + TEST_ENTRY (fs_scandir_empty_dir) + TEST_ENTRY (fs_scandir_file) + TEST_ENTRY (fs_open_dir) + TEST_ENTRY (fs_rename_to_existing_file) + TEST_ENTRY (fs_write_multiple_bufs) + TEST_ENTRY (fs_write_alotof_bufs) + TEST_ENTRY (fs_write_alotof_bufs_with_offset) + TEST_ENTRY (fs_read_write_null_arguments) + TEST_ENTRY (threadpool_queue_work_simple) + TEST_ENTRY (threadpool_queue_work_einval) + TEST_ENTRY (threadpool_multiple_event_loops) + TEST_ENTRY (threadpool_cancel_getaddrinfo) + TEST_ENTRY (threadpool_cancel_getnameinfo) + TEST_ENTRY (threadpool_cancel_work) + TEST_ENTRY (threadpool_cancel_fs) + TEST_ENTRY (threadpool_cancel_single) + TEST_ENTRY (thread_local_storage) + TEST_ENTRY (thread_mutex) + TEST_ENTRY (thread_rwlock) + TEST_ENTRY (thread_rwlock_trylock) + TEST_ENTRY (thread_create) + TEST_ENTRY (thread_equal) + TEST_ENTRY (dlerror) + TEST_ENTRY (ip4_addr) + TEST_ENTRY (ip6_addr_link_local) + + TEST_ENTRY (queue_foreach_delete) + +#if 0 + /* These are for testing the test runner. */ + TEST_ENTRY (fail_always) + TEST_ENTRY (pass_always) +#endif +TASK_LIST_END diff --git a/3rdparty/libuv/test/test-loop-alive.c b/3rdparty/libuv/test/test-loop-alive.c new file mode 100644 index 00000000000..cf4d301930c --- /dev/null +++ b/3rdparty/libuv/test/test-loop-alive.c @@ -0,0 +1,67 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static uv_timer_t timer_handle; + +static void timer_cb(uv_timer_t* handle) { + ASSERT(handle); +} + + +static uv_work_t work_req; + +static void work_cb(uv_work_t* req) { + ASSERT(req); +} + +static void after_work_cb(uv_work_t* req, int status) { + ASSERT(req); + ASSERT(status == 0); +} + + +TEST_IMPL(loop_alive) { + int r; + ASSERT(!uv_loop_alive(uv_default_loop())); + + /* loops with handles are alive */ + uv_timer_init(uv_default_loop(), &timer_handle); + uv_timer_start(&timer_handle, timer_cb, 100, 0); + ASSERT(uv_loop_alive(uv_default_loop())); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + ASSERT(!uv_loop_alive(uv_default_loop())); + + /* loops with requests are alive */ + r = uv_queue_work(uv_default_loop(), &work_req, work_cb, after_work_cb); + ASSERT(r == 0); + ASSERT(uv_loop_alive(uv_default_loop())); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + ASSERT(!uv_loop_alive(uv_default_loop())); + + return 0; +} diff --git a/3rdparty/libuv/test/test-loop-close.c b/3rdparty/libuv/test/test-loop-close.c new file mode 100644 index 00000000000..5aec234ed03 --- /dev/null +++ b/3rdparty/libuv/test/test-loop-close.c @@ -0,0 +1,53 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static uv_timer_t timer_handle; + +static void timer_cb(uv_timer_t* handle) { + ASSERT(handle); + uv_stop(handle->loop); +} + + +TEST_IMPL(loop_close) { + int r; + uv_loop_t loop; + + ASSERT(0 == uv_loop_init(&loop)); + + uv_timer_init(&loop, &timer_handle); + uv_timer_start(&timer_handle, timer_cb, 100, 100); + + ASSERT(UV_EBUSY == uv_loop_close(&loop)); + + uv_run(&loop, UV_RUN_DEFAULT); + + uv_close((uv_handle_t*) &timer_handle, NULL); + r = uv_run(&loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(0 == uv_loop_close(&loop)); + + return 0; +} diff --git a/3rdparty/libuv/test/test-loop-configure.c b/3rdparty/libuv/test/test-loop-configure.c new file mode 100644 index 00000000000..d057c1ed8a7 --- /dev/null +++ b/3rdparty/libuv/test/test-loop-configure.c @@ -0,0 +1,38 @@ +/* Copyright (c) 2014, Ben Noordhuis + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static void timer_cb(uv_timer_t* handle) { + uv_close((uv_handle_t*) handle, NULL); +} + + +TEST_IMPL(loop_configure) { + uv_timer_t timer_handle; + uv_loop_t loop; + ASSERT(0 == uv_loop_init(&loop)); +#ifdef _WIN32 + ASSERT(UV_ENOSYS == uv_loop_configure(&loop, UV_LOOP_BLOCK_SIGNAL, 0)); +#else + ASSERT(0 == uv_loop_configure(&loop, UV_LOOP_BLOCK_SIGNAL, SIGPROF)); +#endif + ASSERT(0 == uv_timer_init(&loop, &timer_handle)); + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 10, 0)); + ASSERT(0 == uv_run(&loop, UV_RUN_DEFAULT)); + ASSERT(0 == uv_loop_close(&loop)); + return 0; +} diff --git a/3rdparty/libuv/test/test-loop-handles.c b/3rdparty/libuv/test/test-loop-handles.c new file mode 100644 index 00000000000..c3e8498ae90 --- /dev/null +++ b/3rdparty/libuv/test/test-loop-handles.c @@ -0,0 +1,337 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* Tests commented out with XXX are ones that are failing on Linux */ + +/* + * Purpose of this test is to check semantics of starting and stopping + * prepare, check and idle watchers. + * + * - A watcher must be able to safely stop or close itself; + * - Once a watcher is stopped or closed its callback should never be called. + * - If a watcher is closed, it is implicitly stopped and its close_cb should + * be called exactly once. + * - A watcher can safely start and stop other watchers of the same type. + * - Prepare and check watchers are called once per event loop iterations. + * - All active idle watchers are queued when the event loop has no more work + * to do. This is done repeatedly until all idle watchers are inactive. + * - If a watcher starts another watcher of the same type its callback is not + * immediately queued. For check and prepare watchers, that means that if + * a watcher makes another of the same type active, it'll not be called until + * the next event loop iteration. For idle. watchers this means that the + * newly activated idle watcher might not be queued immediately. + * - Prepare, check, idle watchers keep the event loop alive even when they're + * not active. + * + * This is what the test globally does: + * + * - prepare_1 is always active and counts event loop iterations. It also + * creates and starts prepare_2 every other iteration. Finally it verifies + * that no idle watchers are active before polling. + * - prepare_2 is started by prepare_1 every other iteration. It immediately + * stops itself. It verifies that a watcher is not queued immediately + * if created by another watcher of the same type. + * - There's a check watcher that stops the event loop after a certain number + * of iterations. It starts a varying number of idle_1 watchers. + * - Idle_1 watchers stop themselves after being called a few times. All idle_1 + * watchers try to start the idle_2 watcher if it is not already started or + * awaiting its close callback. + * - The idle_2 watcher always exists but immediately closes itself after + * being started by a check_1 watcher. It verifies that a watcher is + * implicitly stopped when closed, and that a watcher can close itself + * safely. + * - There is a repeating timer. It does not keep the event loop alive + * (ev_unref) but makes sure that the loop keeps polling the system for + * events. + */ + + +#include "uv.h" +#include "task.h" + +#include + + +#define IDLE_COUNT 7 +#define ITERATIONS 21 +#define TIMEOUT 100 + + +static uv_prepare_t prepare_1_handle; +static uv_prepare_t prepare_2_handle; + +static uv_check_t check_handle; + +static uv_idle_t idle_1_handles[IDLE_COUNT]; +static uv_idle_t idle_2_handle; + +static uv_timer_t timer_handle; + + +static int loop_iteration = 0; + +static int prepare_1_cb_called = 0; +static int prepare_1_close_cb_called = 0; + +static int prepare_2_cb_called = 0; +static int prepare_2_close_cb_called = 0; + +static int check_cb_called = 0; +static int check_close_cb_called = 0; + +static int idle_1_cb_called = 0; +static int idle_1_close_cb_called = 0; +static int idles_1_active = 0; + +static int idle_2_cb_called = 0; +static int idle_2_close_cb_called = 0; +static int idle_2_cb_started = 0; +static int idle_2_is_active = 0; + + +static void timer_cb(uv_timer_t* handle) { + ASSERT(handle == &timer_handle); +} + + +static void idle_2_close_cb(uv_handle_t* handle) { + fprintf(stderr, "%s", "IDLE_2_CLOSE_CB\n"); + fflush(stderr); + + ASSERT(handle == (uv_handle_t*)&idle_2_handle); + + ASSERT(idle_2_is_active); + + idle_2_close_cb_called++; + idle_2_is_active = 0; +} + + +static void idle_2_cb(uv_idle_t* handle) { + fprintf(stderr, "%s", "IDLE_2_CB\n"); + fflush(stderr); + + ASSERT(handle == &idle_2_handle); + + idle_2_cb_called++; + + uv_close((uv_handle_t*)handle, idle_2_close_cb); +} + + +static void idle_1_cb(uv_idle_t* handle) { + int r; + + fprintf(stderr, "%s", "IDLE_1_CB\n"); + fflush(stderr); + + ASSERT(handle != NULL); + ASSERT(idles_1_active > 0); + + /* Init idle_2 and make it active */ + if (!idle_2_is_active && !uv_is_closing((uv_handle_t*)&idle_2_handle)) { + r = uv_idle_init(uv_default_loop(), &idle_2_handle); + ASSERT(r == 0); + r = uv_idle_start(&idle_2_handle, idle_2_cb); + ASSERT(r == 0); + idle_2_is_active = 1; + idle_2_cb_started++; + } + + idle_1_cb_called++; + + if (idle_1_cb_called % 5 == 0) { + r = uv_idle_stop((uv_idle_t*)handle); + ASSERT(r == 0); + idles_1_active--; + } +} + + +static void idle_1_close_cb(uv_handle_t* handle) { + fprintf(stderr, "%s", "IDLE_1_CLOSE_CB\n"); + fflush(stderr); + + ASSERT(handle != NULL); + + idle_1_close_cb_called++; +} + + +static void prepare_1_close_cb(uv_handle_t* handle) { + fprintf(stderr, "%s", "PREPARE_1_CLOSE_CB"); + fflush(stderr); + ASSERT(handle == (uv_handle_t*)&prepare_1_handle); + + prepare_1_close_cb_called++; +} + + +static void check_close_cb(uv_handle_t* handle) { + fprintf(stderr, "%s", "CHECK_CLOSE_CB\n"); + fflush(stderr); + ASSERT(handle == (uv_handle_t*)&check_handle); + + check_close_cb_called++; +} + + +static void prepare_2_close_cb(uv_handle_t* handle) { + fprintf(stderr, "%s", "PREPARE_2_CLOSE_CB\n"); + fflush(stderr); + ASSERT(handle == (uv_handle_t*)&prepare_2_handle); + + prepare_2_close_cb_called++; +} + + +static void check_cb(uv_check_t* handle) { + int i, r; + + fprintf(stderr, "%s", "CHECK_CB\n"); + fflush(stderr); + ASSERT(handle == &check_handle); + + if (loop_iteration < ITERATIONS) { + /* Make some idle watchers active */ + for (i = 0; i < 1 + (loop_iteration % IDLE_COUNT); i++) { + r = uv_idle_start(&idle_1_handles[i], idle_1_cb); + ASSERT(r == 0); + idles_1_active++; + } + + } else { + /* End of the test - close all handles */ + uv_close((uv_handle_t*)&prepare_1_handle, prepare_1_close_cb); + uv_close((uv_handle_t*)&check_handle, check_close_cb); + uv_close((uv_handle_t*)&prepare_2_handle, prepare_2_close_cb); + + for (i = 0; i < IDLE_COUNT; i++) { + uv_close((uv_handle_t*)&idle_1_handles[i], idle_1_close_cb); + } + + /* This handle is closed/recreated every time, close it only if it is */ + /* active.*/ + if (idle_2_is_active) { + uv_close((uv_handle_t*)&idle_2_handle, idle_2_close_cb); + } + } + + check_cb_called++; +} + + +static void prepare_2_cb(uv_prepare_t* handle) { + int r; + + fprintf(stderr, "%s", "PREPARE_2_CB\n"); + fflush(stderr); + ASSERT(handle == &prepare_2_handle); + + /* prepare_2 gets started by prepare_1 when (loop_iteration % 2 == 0), */ + /* and it stops itself immediately. A started watcher is not queued */ + /* until the next round, so when this callback is made */ + /* (loop_iteration % 2 == 0) cannot be true. */ + ASSERT(loop_iteration % 2 != 0); + + r = uv_prepare_stop((uv_prepare_t*)handle); + ASSERT(r == 0); + + prepare_2_cb_called++; +} + + +static void prepare_1_cb(uv_prepare_t* handle) { + int r; + + fprintf(stderr, "%s", "PREPARE_1_CB\n"); + fflush(stderr); + ASSERT(handle == &prepare_1_handle); + + if (loop_iteration % 2 == 0) { + r = uv_prepare_start(&prepare_2_handle, prepare_2_cb); + ASSERT(r == 0); + } + + prepare_1_cb_called++; + loop_iteration++; + + printf("Loop iteration %d of %d.\n", loop_iteration, ITERATIONS); +} + + +TEST_IMPL(loop_handles) { + int i; + int r; + + r = uv_prepare_init(uv_default_loop(), &prepare_1_handle); + ASSERT(r == 0); + r = uv_prepare_start(&prepare_1_handle, prepare_1_cb); + ASSERT(r == 0); + + r = uv_check_init(uv_default_loop(), &check_handle); + ASSERT(r == 0); + r = uv_check_start(&check_handle, check_cb); + ASSERT(r == 0); + + /* initialize only, prepare_2 is started by prepare_1_cb */ + r = uv_prepare_init(uv_default_loop(), &prepare_2_handle); + ASSERT(r == 0); + + for (i = 0; i < IDLE_COUNT; i++) { + /* initialize only, idle_1 handles are started by check_cb */ + r = uv_idle_init(uv_default_loop(), &idle_1_handles[i]); + ASSERT(r == 0); + } + + /* don't init or start idle_2, both is done by idle_1_cb */ + + /* the timer callback is there to keep the event loop polling */ + /* unref it as it is not supposed to keep the loop alive */ + r = uv_timer_init(uv_default_loop(), &timer_handle); + ASSERT(r == 0); + r = uv_timer_start(&timer_handle, timer_cb, TIMEOUT, TIMEOUT); + ASSERT(r == 0); + uv_unref((uv_handle_t*)&timer_handle); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(loop_iteration == ITERATIONS); + + ASSERT(prepare_1_cb_called == ITERATIONS); + ASSERT(prepare_1_close_cb_called == 1); + + ASSERT(prepare_2_cb_called == floor(ITERATIONS / 2.0)); + ASSERT(prepare_2_close_cb_called == 1); + + ASSERT(check_cb_called == ITERATIONS); + ASSERT(check_close_cb_called == 1); + + /* idle_1_cb should be called a lot */ + ASSERT(idle_1_close_cb_called == IDLE_COUNT); + + ASSERT(idle_2_close_cb_called == idle_2_cb_started); + ASSERT(idle_2_is_active == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-loop-stop.c b/3rdparty/libuv/test/test-loop-stop.c new file mode 100644 index 00000000000..14b8c11186c --- /dev/null +++ b/3rdparty/libuv/test/test-loop-stop.c @@ -0,0 +1,71 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static uv_prepare_t prepare_handle; +static uv_timer_t timer_handle; +static int prepare_called = 0; +static int timer_called = 0; +static int num_ticks = 10; + + +static void prepare_cb(uv_prepare_t* handle) { + ASSERT(handle == &prepare_handle); + prepare_called++; + if (prepare_called == num_ticks) + uv_prepare_stop(handle); +} + + +static void timer_cb(uv_timer_t* handle) { + ASSERT(handle == &timer_handle); + timer_called++; + if (timer_called == 1) + uv_stop(uv_default_loop()); + else if (timer_called == num_ticks) + uv_timer_stop(handle); +} + + +TEST_IMPL(loop_stop) { + int r; + uv_prepare_init(uv_default_loop(), &prepare_handle); + uv_prepare_start(&prepare_handle, prepare_cb); + uv_timer_init(uv_default_loop(), &timer_handle); + uv_timer_start(&timer_handle, timer_cb, 100, 100); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r != 0); + ASSERT(timer_called == 1); + + r = uv_run(uv_default_loop(), UV_RUN_NOWAIT); + ASSERT(r != 0); + ASSERT(prepare_called > 1); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + ASSERT(timer_called == 10); + ASSERT(prepare_called == 10); + + return 0; +} diff --git a/3rdparty/libuv/test/test-loop-time.c b/3rdparty/libuv/test/test-loop-time.c new file mode 100644 index 00000000000..a2db42cceec --- /dev/null +++ b/3rdparty/libuv/test/test-loop-time.c @@ -0,0 +1,63 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + + +TEST_IMPL(loop_update_time) { + uint64_t start; + + start = uv_now(uv_default_loop()); + while (uv_now(uv_default_loop()) - start < 1000) + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_NOWAIT)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +static void cb(uv_timer_t* timer) { + uv_close((uv_handle_t*)timer, NULL); +} + +TEST_IMPL(loop_backend_timeout) { + uv_loop_t *loop = uv_default_loop(); + uv_timer_t timer; + int r; + + r = uv_timer_init(loop, &timer); + ASSERT(r == 0); + + ASSERT(!uv_loop_alive(loop)); + ASSERT(uv_backend_timeout(loop) == 0); + + r = uv_timer_start(&timer, cb, 1000, 0); /* 1 sec */ + ASSERT(r == 0); + ASSERT(uv_backend_timeout(loop) > 100); /* 0.1 sec */ + ASSERT(uv_backend_timeout(loop) <= 1000); /* 1 sec */ + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + ASSERT(uv_backend_timeout(loop) == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-multiple-listen.c b/3rdparty/libuv/test/test-multiple-listen.c new file mode 100644 index 00000000000..4ae5fa67b3a --- /dev/null +++ b/3rdparty/libuv/test/test-multiple-listen.c @@ -0,0 +1,109 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + +static int connection_cb_called = 0; +static int close_cb_called = 0; +static int connect_cb_called = 0; +static uv_tcp_t server; +static uv_tcp_t client; + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +static void connection_cb(uv_stream_t* tcp, int status) { + ASSERT(status == 0); + uv_close((uv_handle_t*)&server, close_cb); + connection_cb_called++; +} + + +static void start_server(void) { + struct sockaddr_in addr; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&server, 128, connection_cb); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&server, 128, connection_cb); + ASSERT(r == 0); +} + + +static void connect_cb(uv_connect_t* req, int status) { + ASSERT(req != NULL); + ASSERT(status == 0); + free(req); + uv_close((uv_handle_t*)&client, close_cb); + connect_cb_called++; +} + + +static void client_connect(void) { + struct sockaddr_in addr; + uv_connect_t* connect_req = malloc(sizeof *connect_req); + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + ASSERT(connect_req != NULL); + + r = uv_tcp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + r = uv_tcp_connect(connect_req, + &client, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); +} + + + +TEST_IMPL(multiple_listen) { + start_server(); + + client_connect(); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(connection_cb_called == 1); + ASSERT(connect_cb_called == 1); + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-mutexes.c b/3rdparty/libuv/test/test-mutexes.c new file mode 100644 index 00000000000..af5e4e88a22 --- /dev/null +++ b/3rdparty/libuv/test/test-mutexes.c @@ -0,0 +1,162 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +static uv_cond_t condvar; +static uv_mutex_t mutex; +static uv_rwlock_t rwlock; +static int step; + +/* The mutex and rwlock tests are really poor. + * They're very basic sanity checks and nothing more. + * Apologies if that rhymes. + */ + +TEST_IMPL(thread_mutex) { + uv_mutex_t mutex; + int r; + + r = uv_mutex_init(&mutex); + ASSERT(r == 0); + + uv_mutex_lock(&mutex); + uv_mutex_unlock(&mutex); + uv_mutex_destroy(&mutex); + + return 0; +} + + +TEST_IMPL(thread_rwlock) { + uv_rwlock_t rwlock; + int r; + + r = uv_rwlock_init(&rwlock); + ASSERT(r == 0); + + uv_rwlock_rdlock(&rwlock); + uv_rwlock_rdunlock(&rwlock); + uv_rwlock_wrlock(&rwlock); + uv_rwlock_wrunlock(&rwlock); + uv_rwlock_destroy(&rwlock); + + return 0; +} + + +/* Call when holding |mutex|. */ +static void synchronize_nowait(void) { + step += 1; + uv_cond_signal(&condvar); +} + + +/* Call when holding |mutex|. */ +static void synchronize(void) { + int current; + + synchronize_nowait(); + /* Wait for the other thread. Guard against spurious wakeups. */ + for (current = step; current == step; uv_cond_wait(&condvar, &mutex)); + ASSERT(step == current + 1); +} + + +static void thread_rwlock_trylock_peer(void* unused) { + (void) &unused; + + uv_mutex_lock(&mutex); + + /* Write lock held by other thread. */ + ASSERT(UV_EBUSY == uv_rwlock_tryrdlock(&rwlock)); + ASSERT(UV_EBUSY == uv_rwlock_trywrlock(&rwlock)); + synchronize(); + + /* Read lock held by other thread. */ + ASSERT(0 == uv_rwlock_tryrdlock(&rwlock)); + uv_rwlock_rdunlock(&rwlock); + ASSERT(UV_EBUSY == uv_rwlock_trywrlock(&rwlock)); + synchronize(); + + /* Acquire write lock. */ + ASSERT(0 == uv_rwlock_trywrlock(&rwlock)); + synchronize(); + + /* Release write lock and acquire read lock. */ + uv_rwlock_wrunlock(&rwlock); + ASSERT(0 == uv_rwlock_tryrdlock(&rwlock)); + synchronize(); + + uv_rwlock_rdunlock(&rwlock); + synchronize_nowait(); /* Signal main thread we're going away. */ + uv_mutex_unlock(&mutex); +} + + +TEST_IMPL(thread_rwlock_trylock) { + uv_thread_t thread; + + ASSERT(0 == uv_cond_init(&condvar)); + ASSERT(0 == uv_mutex_init(&mutex)); + ASSERT(0 == uv_rwlock_init(&rwlock)); + + uv_mutex_lock(&mutex); + ASSERT(0 == uv_thread_create(&thread, thread_rwlock_trylock_peer, NULL)); + + /* Hold write lock. */ + ASSERT(0 == uv_rwlock_trywrlock(&rwlock)); + synchronize(); /* Releases the mutex to the other thread. */ + + /* Release write lock and acquire read lock. Pthreads doesn't support + * the notion of upgrading or downgrading rwlocks, so neither do we. + */ + uv_rwlock_wrunlock(&rwlock); + ASSERT(0 == uv_rwlock_tryrdlock(&rwlock)); + synchronize(); + + /* Release read lock. */ + uv_rwlock_rdunlock(&rwlock); + synchronize(); + + /* Write lock held by other thread. */ + ASSERT(UV_EBUSY == uv_rwlock_tryrdlock(&rwlock)); + ASSERT(UV_EBUSY == uv_rwlock_trywrlock(&rwlock)); + synchronize(); + + /* Read lock held by other thread. */ + ASSERT(0 == uv_rwlock_tryrdlock(&rwlock)); + uv_rwlock_rdunlock(&rwlock); + ASSERT(UV_EBUSY == uv_rwlock_trywrlock(&rwlock)); + synchronize(); + + ASSERT(0 == uv_thread_join(&thread)); + uv_rwlock_destroy(&rwlock); + uv_mutex_unlock(&mutex); + uv_mutex_destroy(&mutex); + uv_cond_destroy(&condvar); + + return 0; +} diff --git a/3rdparty/libuv/test/test-osx-select.c b/3rdparty/libuv/test/test-osx-select.c new file mode 100644 index 00000000000..a0afda9181e --- /dev/null +++ b/3rdparty/libuv/test/test-osx-select.c @@ -0,0 +1,140 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#ifdef __APPLE__ + +#include +#include + +static int read_count; + + +static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + static char slab[1024]; + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { + fprintf(stdout, "got data %d\n", ++read_count); + fflush(stdout); + + if (read_count == 3) + uv_close((uv_handle_t*) stream, NULL); +} + + +TEST_IMPL(osx_select) { + int r; + int fd; + size_t i; + size_t len; + const char* str; + uv_tty_t tty; + + fd = open("/dev/tty", O_RDONLY); + if (fd < 0) { + fprintf(stderr, "Cannot open /dev/tty as read-only: %s\n", strerror(errno)); + fflush(stderr); + return TEST_SKIP; + } + + r = uv_tty_init(uv_default_loop(), &tty, fd, 1); + ASSERT(r == 0); + + uv_read_start((uv_stream_t*) &tty, alloc_cb, read_cb); + + /* Emulate user-input */ + str = "got some input\n" + "with a couple of lines\n" + "feel pretty happy\n"; + for (i = 0, len = strlen(str); i < len; i++) { + r = ioctl(fd, TIOCSTI, str + i); + ASSERT(r == 0); + } + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(read_count == 3); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(osx_select_many_fds) { + int r; + int fd; + size_t i; + size_t len; + const char* str; + struct sockaddr_in addr; + uv_tty_t tty; + uv_tcp_t tcps[1500]; + + TEST_FILE_LIMIT(ARRAY_SIZE(tcps) + 100); + + r = uv_ip4_addr("127.0.0.1", 0, &addr); + ASSERT(r == 0); + + for (i = 0; i < ARRAY_SIZE(tcps); i++) { + r = uv_tcp_init(uv_default_loop(), &tcps[i]); + ASSERT(r == 0); + r = uv_tcp_bind(&tcps[i], (const struct sockaddr *) &addr, 0); + ASSERT(r == 0); + uv_unref((uv_handle_t*) &tcps[i]); + } + + fd = open("/dev/tty", O_RDONLY); + if (fd < 0) { + fprintf(stderr, "Cannot open /dev/tty as read-only: %s\n", strerror(errno)); + fflush(stderr); + return TEST_SKIP; + } + + r = uv_tty_init(uv_default_loop(), &tty, fd, 1); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*) &tty, alloc_cb, read_cb); + ASSERT(r == 0); + + /* Emulate user-input */ + str = "got some input\n" + "with a couple of lines\n" + "feel pretty happy\n"; + for (i = 0, len = strlen(str); i < len; i++) { + r = ioctl(fd, TIOCSTI, str + i); + ASSERT(r == 0); + } + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(read_count == 3); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* __APPLE__ */ diff --git a/3rdparty/libuv/test/test-pass-always.c b/3rdparty/libuv/test/test-pass-always.c new file mode 100644 index 00000000000..4fb58ff94be --- /dev/null +++ b/3rdparty/libuv/test/test-pass-always.c @@ -0,0 +1,28 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" + + +TEST_IMPL(pass_always) { + /* This test always passes. It is used to test the test runner. */ + return 0; +} diff --git a/3rdparty/libuv/test/test-ping-pong.c b/3rdparty/libuv/test/test-ping-pong.c new file mode 100644 index 00000000000..c074178541b --- /dev/null +++ b/3rdparty/libuv/test/test-ping-pong.c @@ -0,0 +1,270 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +static int completed_pingers = 0; + +#define NUM_PINGS 1000 + +/* 64 bytes is enough for a pinger */ +#define BUFSIZE 10240 + +static char PING[] = "PING\n"; +static int pinger_on_connect_count; + + +typedef struct { + int pongs; + int state; + union { + uv_tcp_t tcp; + uv_pipe_t pipe; + } stream; + uv_connect_t connect_req; + char read_buffer[BUFSIZE]; +} pinger_t; + + +static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + buf->base = malloc(size); + buf->len = size; +} + + +static void pinger_on_close(uv_handle_t* handle) { + pinger_t* pinger = (pinger_t*)handle->data; + + ASSERT(NUM_PINGS == pinger->pongs); + + free(pinger); + + completed_pingers++; +} + + +static void pinger_after_write(uv_write_t *req, int status) { + ASSERT(status == 0); + free(req); +} + + +static void pinger_write_ping(pinger_t* pinger) { + uv_write_t *req; + uv_buf_t buf; + + buf = uv_buf_init(PING, sizeof(PING) - 1); + + req = malloc(sizeof(*req)); + if (uv_write(req, + (uv_stream_t*) &pinger->stream.tcp, + &buf, + 1, + pinger_after_write)) { + FATAL("uv_write failed"); + } + + puts("PING"); +} + + +static void pinger_read_cb(uv_stream_t* stream, + ssize_t nread, + const uv_buf_t* buf) { + ssize_t i; + pinger_t* pinger; + + pinger = (pinger_t*)stream->data; + + if (nread < 0) { + ASSERT(nread == UV_EOF); + + puts("got EOF"); + free(buf->base); + + uv_close((uv_handle_t*)(&pinger->stream.tcp), pinger_on_close); + + return; + } + + /* Now we count the pings */ + for (i = 0; i < nread; i++) { + ASSERT(buf->base[i] == PING[pinger->state]); + pinger->state = (pinger->state + 1) % (sizeof(PING) - 1); + + if (pinger->state != 0) + continue; + + printf("PONG %d\n", pinger->pongs); + pinger->pongs++; + + if (pinger->pongs < NUM_PINGS) { + pinger_write_ping(pinger); + } else { + uv_close((uv_handle_t*)(&pinger->stream.tcp), pinger_on_close); + break; + } + } + + free(buf->base); +} + + +static void pinger_on_connect(uv_connect_t *req, int status) { + pinger_t *pinger = (pinger_t*)req->handle->data; + + pinger_on_connect_count++; + + ASSERT(status == 0); + + ASSERT(1 == uv_is_readable(req->handle)); + ASSERT(1 == uv_is_writable(req->handle)); + ASSERT(0 == uv_is_closing((uv_handle_t *) req->handle)); + + pinger_write_ping(pinger); + + uv_read_start((uv_stream_t*)(req->handle), alloc_cb, pinger_read_cb); +} + + +/* same ping-pong test, but using IPv6 connection */ +static void tcp_pinger_v6_new(void) { + int r; + struct sockaddr_in6 server_addr; + pinger_t *pinger; + + + ASSERT(0 ==uv_ip6_addr("::1", TEST_PORT, &server_addr)); + pinger = malloc(sizeof(*pinger)); + ASSERT(pinger != NULL); + pinger->state = 0; + pinger->pongs = 0; + + /* Try to connect to the server and do NUM_PINGS ping-pongs. */ + r = uv_tcp_init(uv_default_loop(), &pinger->stream.tcp); + pinger->stream.tcp.data = pinger; + ASSERT(!r); + + /* We are never doing multiple reads/connects at a time anyway. */ + /* so these handles can be pre-initialized. */ + r = uv_tcp_connect(&pinger->connect_req, + &pinger->stream.tcp, + (const struct sockaddr*) &server_addr, + pinger_on_connect); + ASSERT(!r); + + /* Synchronous connect callbacks are not allowed. */ + ASSERT(pinger_on_connect_count == 0); +} + + +static void tcp_pinger_new(void) { + int r; + struct sockaddr_in server_addr; + pinger_t *pinger; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &server_addr)); + pinger = malloc(sizeof(*pinger)); + ASSERT(pinger != NULL); + pinger->state = 0; + pinger->pongs = 0; + + /* Try to connect to the server and do NUM_PINGS ping-pongs. */ + r = uv_tcp_init(uv_default_loop(), &pinger->stream.tcp); + pinger->stream.tcp.data = pinger; + ASSERT(!r); + + /* We are never doing multiple reads/connects at a time anyway. */ + /* so these handles can be pre-initialized. */ + r = uv_tcp_connect(&pinger->connect_req, + &pinger->stream.tcp, + (const struct sockaddr*) &server_addr, + pinger_on_connect); + ASSERT(!r); + + /* Synchronous connect callbacks are not allowed. */ + ASSERT(pinger_on_connect_count == 0); +} + + +static void pipe_pinger_new(void) { + int r; + pinger_t *pinger; + + pinger = (pinger_t*)malloc(sizeof(*pinger)); + ASSERT(pinger != NULL); + pinger->state = 0; + pinger->pongs = 0; + + /* Try to connect to the server and do NUM_PINGS ping-pongs. */ + r = uv_pipe_init(uv_default_loop(), &pinger->stream.pipe, 0); + pinger->stream.pipe.data = pinger; + ASSERT(!r); + + /* We are never doing multiple reads/connects at a time anyway. */ + /* so these handles can be pre-initialized. */ + + uv_pipe_connect(&pinger->connect_req, &pinger->stream.pipe, TEST_PIPENAME, + pinger_on_connect); + + /* Synchronous connect callbacks are not allowed. */ + ASSERT(pinger_on_connect_count == 0); +} + + +TEST_IMPL(tcp_ping_pong) { + tcp_pinger_new(); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(completed_pingers == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_ping_pong_v6) { + if (!can_ipv6()) + RETURN_SKIP("IPv6 not supported"); + + tcp_pinger_v6_new(); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(completed_pingers == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(pipe_ping_pong) { + pipe_pinger_new(); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(completed_pingers == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-pipe-bind-error.c b/3rdparty/libuv/test/test-pipe-bind-error.c new file mode 100644 index 00000000000..38b57db6991 --- /dev/null +++ b/3rdparty/libuv/test/test-pipe-bind-error.c @@ -0,0 +1,136 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + + +#ifdef _WIN32 +# define BAD_PIPENAME "bad-pipe" +#else +# define BAD_PIPENAME "/path/to/unix/socket/that/really/should/not/be/there" +#endif + + +static int close_cb_called = 0; + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +TEST_IMPL(pipe_bind_error_addrinuse) { + uv_pipe_t server1, server2; + int r; + + r = uv_pipe_init(uv_default_loop(), &server1, 0); + ASSERT(r == 0); + r = uv_pipe_bind(&server1, TEST_PIPENAME); + ASSERT(r == 0); + + r = uv_pipe_init(uv_default_loop(), &server2, 0); + ASSERT(r == 0); + r = uv_pipe_bind(&server2, TEST_PIPENAME); + ASSERT(r == UV_EADDRINUSE); + + r = uv_listen((uv_stream_t*)&server1, SOMAXCONN, NULL); + ASSERT(r == 0); + r = uv_listen((uv_stream_t*)&server2, SOMAXCONN, NULL); + ASSERT(r == UV_EINVAL); + + uv_close((uv_handle_t*)&server1, close_cb); + uv_close((uv_handle_t*)&server2, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(pipe_bind_error_addrnotavail) { + uv_pipe_t server; + int r; + + r = uv_pipe_init(uv_default_loop(), &server, 0); + ASSERT(r == 0); + + r = uv_pipe_bind(&server, BAD_PIPENAME); + ASSERT(r == UV_EACCES); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(pipe_bind_error_inval) { + uv_pipe_t server; + int r; + + r = uv_pipe_init(uv_default_loop(), &server, 0); + ASSERT(r == 0); + r = uv_pipe_bind(&server, TEST_PIPENAME); + ASSERT(r == 0); + r = uv_pipe_bind(&server, TEST_PIPENAME_2); + ASSERT(r == UV_EINVAL); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(pipe_listen_without_bind) { + uv_pipe_t server; + int r; + + r = uv_pipe_init(uv_default_loop(), &server, 0); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&server, SOMAXCONN, NULL); + ASSERT(r == UV_EINVAL); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-pipe-close-stdout-read-stdin.c b/3rdparty/libuv/test/test-pipe-close-stdout-read-stdin.c new file mode 100644 index 00000000000..ee8bb2a9a8b --- /dev/null +++ b/3rdparty/libuv/test/test-pipe-close-stdout-read-stdin.c @@ -0,0 +1,104 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef _WIN32 + +#include +#include +#include +#include + +#include "uv.h" +#include "task.h" + +void alloc_buffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t* buf) +{ + static char buffer[1024]; + + buf->base = buffer; + buf->len = sizeof(buffer); +} + +void read_stdin(uv_stream_t *stream, ssize_t nread, const uv_buf_t* buf) +{ + if (nread < 0) { + uv_close((uv_handle_t*)stream, NULL); + return; + } +} + +/* + * This test is a reproduction of joyent/libuv#1419 . + */ +TEST_IMPL(pipe_close_stdout_read_stdin) { + int r = -1; + int pid; + int fd[2]; + int status; + uv_pipe_t stdin_pipe; + + r = pipe(fd); + ASSERT(r == 0); + + if ((pid = fork()) == 0) { + /* + * Make the read side of the pipe our stdin. + * The write side will be closed by the parent process. + */ + close(fd[1]); + close(0); + r = dup(fd[0]); + ASSERT(r != -1); + + /* Create a stream that reads from the pipe. */ + r = uv_pipe_init(uv_default_loop(), (uv_pipe_t *)&stdin_pipe, 0); + ASSERT(r == 0); + + r = uv_pipe_open((uv_pipe_t *)&stdin_pipe, 0); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t *)&stdin_pipe, alloc_buffer, read_stdin); + ASSERT(r == 0); + + /* + * Because the other end of the pipe was closed, there should + * be no event left to process after one run of the event loop. + * Otherwise, it means that events were not processed correctly. + */ + ASSERT(uv_run(uv_default_loop(), UV_RUN_NOWAIT) == 0); + } else { + /* + * Close both ends of the pipe so that the child + * get a POLLHUP event when it tries to read from + * the other end. + */ + close(fd[1]); + close(fd[0]); + + waitpid(pid, &status, 0); + ASSERT(WIFEXITED(status) && WEXITSTATUS(status) == 0); + } + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* ifndef _WIN32 */ diff --git a/3rdparty/libuv/test/test-pipe-connect-error.c b/3rdparty/libuv/test/test-pipe-connect-error.c new file mode 100644 index 00000000000..ebb2a6ca826 --- /dev/null +++ b/3rdparty/libuv/test/test-pipe-connect-error.c @@ -0,0 +1,95 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + + +#ifdef _WIN32 +# define BAD_PIPENAME "bad-pipe" +#else +# define BAD_PIPENAME "/path/to/unix/socket/that/really/should/not/be/there" +#endif + + +static int close_cb_called = 0; +static int connect_cb_called = 0; + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +static void connect_cb(uv_connect_t* connect_req, int status) { + ASSERT(status == UV_ENOENT); + uv_close((uv_handle_t*)connect_req->handle, close_cb); + connect_cb_called++; +} + + +static void connect_cb_file(uv_connect_t* connect_req, int status) { + ASSERT(status == UV_ENOTSOCK || status == UV_ECONNREFUSED); + uv_close((uv_handle_t*)connect_req->handle, close_cb); + connect_cb_called++; +} + + +TEST_IMPL(pipe_connect_bad_name) { + uv_pipe_t client; + uv_connect_t req; + int r; + + r = uv_pipe_init(uv_default_loop(), &client, 0); + ASSERT(r == 0); + uv_pipe_connect(&req, &client, BAD_PIPENAME, connect_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + ASSERT(connect_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(pipe_connect_to_file) { + const char* path = "test/fixtures/empty_file"; + uv_pipe_t client; + uv_connect_t req; + int r; + + r = uv_pipe_init(uv_default_loop(), &client, 0); + ASSERT(r == 0); + uv_pipe_connect(&req, &client, path, connect_cb_file); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + ASSERT(connect_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-pipe-connect-multiple.c b/3rdparty/libuv/test/test-pipe-connect-multiple.c new file mode 100644 index 00000000000..3de5a9a0bf4 --- /dev/null +++ b/3rdparty/libuv/test/test-pipe-connect-multiple.c @@ -0,0 +1,104 @@ +/* Copyright (c) 2015 Saúl Ibarra Corretgé . + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + + +static int connection_cb_called = 0; +static int connect_cb_called = 0; + +#define NUM_CLIENTS 4 + +typedef struct { + uv_pipe_t pipe_handle; + uv_connect_t conn_req; +} client_t; + +static uv_pipe_t server_handle; +static client_t clients[NUM_CLIENTS]; +static uv_pipe_t connections[NUM_CLIENTS]; + + +static void connection_cb(uv_stream_t* server, int status) { + int r; + uv_pipe_t* conn; + ASSERT(status == 0); + + conn = &connections[connection_cb_called]; + r = uv_pipe_init(server->loop, conn, 0); + ASSERT(r == 0); + + r = uv_accept(server, (uv_stream_t*)conn); + ASSERT(r == 0); + + if (++connection_cb_called == NUM_CLIENTS && + connect_cb_called == NUM_CLIENTS) { + uv_stop(server->loop); + } +} + + +static void connect_cb(uv_connect_t* connect_req, int status) { + ASSERT(status == 0); + if (++connect_cb_called == NUM_CLIENTS && + connection_cb_called == NUM_CLIENTS) { + uv_stop(connect_req->handle->loop); + } +} + + +TEST_IMPL(pipe_connect_multiple) { + int i; + int r; + uv_loop_t* loop; + + loop = uv_default_loop(); + + r = uv_pipe_init(loop, &server_handle, 0); + ASSERT(r == 0); + + r = uv_pipe_bind(&server_handle, TEST_PIPENAME); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&server_handle, 128, connection_cb); + ASSERT(r == 0); + + for (i = 0; i < NUM_CLIENTS; i++) { + r = uv_pipe_init(loop, &clients[i].pipe_handle, 0); + ASSERT(r == 0); + uv_pipe_connect(&clients[i].conn_req, + &clients[i].pipe_handle, + TEST_PIPENAME, + connect_cb); + } + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(connection_cb_called == NUM_CLIENTS); + ASSERT(connect_cb_called == NUM_CLIENTS); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-pipe-connect-prepare.c b/3rdparty/libuv/test/test-pipe-connect-prepare.c new file mode 100644 index 00000000000..a86e7284a79 --- /dev/null +++ b/3rdparty/libuv/test/test-pipe-connect-prepare.c @@ -0,0 +1,83 @@ +/* Copyright (c) 2015 Saúl Ibarra Corretgé . + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + + +#ifdef _WIN32 +# define BAD_PIPENAME "bad-pipe" +#else +# define BAD_PIPENAME "/path/to/unix/socket/that/really/should/not/be/there" +#endif + + +static int close_cb_called = 0; +static int connect_cb_called = 0; + +static uv_pipe_t pipe_handle; +static uv_prepare_t prepare_handle; +static uv_connect_t conn_req; + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +static void connect_cb(uv_connect_t* connect_req, int status) { + ASSERT(status == UV_ENOENT); + connect_cb_called++; + uv_close((uv_handle_t*)&prepare_handle, close_cb); + uv_close((uv_handle_t*)&pipe_handle, close_cb); +} + + +static void prepare_cb(uv_prepare_t* handle) { + ASSERT(handle == &prepare_handle); + uv_pipe_connect(&conn_req, &pipe_handle, BAD_PIPENAME, connect_cb); +} + + +TEST_IMPL(pipe_connect_on_prepare) { + int r; + + r = uv_pipe_init(uv_default_loop(), &pipe_handle, 0); + ASSERT(r == 0); + + r = uv_prepare_init(uv_default_loop(), &prepare_handle); + ASSERT(r == 0); + r = uv_prepare_start(&prepare_handle, prepare_cb); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(close_cb_called == 2); + ASSERT(connect_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-pipe-getsockname.c b/3rdparty/libuv/test/test-pipe-getsockname.c new file mode 100644 index 00000000000..5e036f9d528 --- /dev/null +++ b/3rdparty/libuv/test/test-pipe-getsockname.c @@ -0,0 +1,263 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include +#include + +#if defined(__linux__) + #include + #include +#endif + +#ifndef _WIN32 +# include /* close */ +#else +# include +#endif + +static uv_pipe_t pipe_client; +static uv_pipe_t pipe_server; +static uv_connect_t connect_req; + +static int pipe_close_cb_called = 0; +static int pipe_client_connect_cb_called = 0; + + +static void pipe_close_cb(uv_handle_t* handle) { + ASSERT(handle == (uv_handle_t*) &pipe_client || + handle == (uv_handle_t*) &pipe_server); + pipe_close_cb_called++; +} + + +static void pipe_client_connect_cb(uv_connect_t* req, int status) { + char buf[1024]; + size_t len; + int r; + + ASSERT(req == &connect_req); + ASSERT(status == 0); + + len = sizeof buf; + r = uv_pipe_getpeername(&pipe_client, buf, &len); + ASSERT(r == 0); + + ASSERT(buf[len - 1] != 0); + ASSERT(memcmp(buf, TEST_PIPENAME, len) == 0); + + len = sizeof buf; + r = uv_pipe_getsockname(&pipe_client, buf, &len); + ASSERT(r == 0 && len == 0); + + pipe_client_connect_cb_called++; + + + uv_close((uv_handle_t*) &pipe_client, pipe_close_cb); + uv_close((uv_handle_t*) &pipe_server, pipe_close_cb); +} + + +static void pipe_server_connection_cb(uv_stream_t* handle, int status) { + /* This function *may* be called, depending on whether accept or the + * connection callback is called first. + */ + ASSERT(status == 0); +} + + +TEST_IMPL(pipe_getsockname) { + uv_loop_t* loop; + char buf[1024]; + size_t len; + int r; + + loop = uv_default_loop(); + ASSERT(loop != NULL); + + r = uv_pipe_init(loop, &pipe_server, 0); + ASSERT(r == 0); + + len = sizeof buf; + r = uv_pipe_getsockname(&pipe_server, buf, &len); + ASSERT(r == UV_EBADF); + + len = sizeof buf; + r = uv_pipe_getpeername(&pipe_server, buf, &len); + ASSERT(r == UV_EBADF); + + r = uv_pipe_bind(&pipe_server, TEST_PIPENAME); + ASSERT(r == 0); + + len = sizeof buf; + r = uv_pipe_getsockname(&pipe_server, buf, &len); + ASSERT(r == 0); + + ASSERT(buf[len - 1] != 0); + ASSERT(memcmp(buf, TEST_PIPENAME, len) == 0); + + len = sizeof buf; + r = uv_pipe_getpeername(&pipe_server, buf, &len); + ASSERT(r == UV_ENOTCONN); + + r = uv_listen((uv_stream_t*) &pipe_server, 0, pipe_server_connection_cb); + ASSERT(r == 0); + + r = uv_pipe_init(loop, &pipe_client, 0); + ASSERT(r == 0); + + len = sizeof buf; + r = uv_pipe_getsockname(&pipe_client, buf, &len); + ASSERT(r == UV_EBADF); + + len = sizeof buf; + r = uv_pipe_getpeername(&pipe_client, buf, &len); + ASSERT(r == UV_EBADF); + + uv_pipe_connect(&connect_req, &pipe_client, TEST_PIPENAME, pipe_client_connect_cb); + + len = sizeof buf; + r = uv_pipe_getsockname(&pipe_client, buf, &len); + ASSERT(r == 0 && len == 0); + + len = sizeof buf; + r = uv_pipe_getpeername(&pipe_client, buf, &len); + ASSERT(r == 0); + + ASSERT(buf[len - 1] != 0); + ASSERT(memcmp(buf, TEST_PIPENAME, len) == 0); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + ASSERT(pipe_client_connect_cb_called == 1); + ASSERT(pipe_close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(pipe_getsockname_abstract) { +#if defined(__linux__) + char buf[1024]; + size_t len; + int r; + int sock; + struct sockaddr_un sun; + socklen_t sun_len; + char abstract_pipe[] = "\0test-pipe"; + + sock = socket(AF_LOCAL, SOCK_STREAM, 0); + ASSERT(sock != -1); + + sun_len = sizeof sun; + memset(&sun, 0, sun_len); + sun.sun_family = AF_UNIX; + memcpy(sun.sun_path, abstract_pipe, sizeof abstract_pipe); + + r = bind(sock, (struct sockaddr*)&sun, sun_len); + ASSERT(r == 0); + + r = uv_pipe_init(uv_default_loop(), &pipe_server, 0); + ASSERT(r == 0); + r = uv_pipe_open(&pipe_server, sock); + ASSERT(r == 0); + + len = sizeof buf; + r = uv_pipe_getsockname(&pipe_server, buf, &len); + ASSERT(r == 0); + + ASSERT(memcmp(buf, abstract_pipe, sizeof abstract_pipe) == 0); + + uv_close((uv_handle_t*)&pipe_server, pipe_close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + close(sock); + + ASSERT(pipe_close_cb_called == 1); + MAKE_VALGRIND_HAPPY(); + return 0; +#else + MAKE_VALGRIND_HAPPY(); + return 0; +#endif +} + +TEST_IMPL(pipe_getsockname_blocking) { +#ifdef _WIN32 + HANDLE readh, writeh; + int readfd; + char buf1[1024], buf2[1024]; + size_t len1, len2; + int r; + + r = CreatePipe(&readh, &writeh, NULL, 65536); + ASSERT(r != 0); + + r = uv_pipe_init(uv_default_loop(), &pipe_client, 0); + ASSERT(r == 0); + readfd = _open_osfhandle((intptr_t)readh, _O_RDONLY); + ASSERT(r != -1); + r = uv_pipe_open(&pipe_client, readfd); + ASSERT(r == 0); + r = uv_read_start((uv_stream_t*)&pipe_client, NULL, NULL); + ASSERT(r == 0); + Sleep(100); + r = uv_read_stop((uv_stream_t*)&pipe_client); + ASSERT(r == 0); + + len1 = sizeof buf1; + r = uv_pipe_getsockname(&pipe_client, buf1, &len1); + ASSERT(r == 0); + ASSERT(buf1[len1 - 1] != 0); + + r = uv_read_start((uv_stream_t*)&pipe_client, NULL, NULL); + ASSERT(r == 0); + Sleep(100); + + len2 = sizeof buf2; + r = uv_pipe_getsockname(&pipe_client, buf2, &len2); + ASSERT(r == 0); + ASSERT(buf2[len2 - 1] != 0); + + r = uv_read_stop((uv_stream_t*)&pipe_client); + ASSERT(r == 0); + + ASSERT(len1 == len2); + ASSERT(memcmp(buf1, buf2, len1) == 0); + + pipe_close_cb_called = 0; + uv_close((uv_handle_t*)&pipe_client, pipe_close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(pipe_close_cb_called == 1); + + _close(readfd); + CloseHandle(writeh); +#endif + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-pipe-pending-instances.c b/3rdparty/libuv/test/test-pipe-pending-instances.c new file mode 100644 index 00000000000..b6ff911a0f2 --- /dev/null +++ b/3rdparty/libuv/test/test-pipe-pending-instances.c @@ -0,0 +1,59 @@ +/* Copyright (c) 2015 Saúl Ibarra Corretgé . + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + + +static void connection_cb(uv_stream_t* server, int status) { + ASSERT(0 && "this will never be called"); +} + + +TEST_IMPL(pipe_pending_instances) { + int r; + uv_pipe_t pipe_handle; + uv_loop_t* loop; + + loop = uv_default_loop(); + + r = uv_pipe_init(loop, &pipe_handle, 0); + ASSERT(r == 0); + + uv_pipe_pending_instances(&pipe_handle, 8); + + r = uv_pipe_bind(&pipe_handle, TEST_PIPENAME); + ASSERT(r == 0); + + uv_pipe_pending_instances(&pipe_handle, 16); + + r = uv_listen((uv_stream_t*)&pipe_handle, 128, connection_cb); + ASSERT(r == 0); + + uv_close((uv_handle_t*)&pipe_handle, NULL); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-pipe-sendmsg.c b/3rdparty/libuv/test/test-pipe-sendmsg.c new file mode 100644 index 00000000000..f6d893b4494 --- /dev/null +++ b/3rdparty/libuv/test/test-pipe-sendmsg.c @@ -0,0 +1,169 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + + +#ifndef _WIN32 + +#include +#include +#include +#include +#include +#include +#include + + +/* NOTE: size should be divisible by 2 */ +static uv_pipe_t incoming[4]; +static unsigned int incoming_count; +static unsigned int close_called; + + +static void set_nonblocking(uv_os_sock_t sock) { + int r; +#ifdef _WIN32 + unsigned long on = 1; + r = ioctlsocket(sock, FIONBIO, &on); + ASSERT(r == 0); +#else + int flags = fcntl(sock, F_GETFL, 0); + ASSERT(flags >= 0); + r = fcntl(sock, F_SETFL, flags | O_NONBLOCK); + ASSERT(r >= 0); +#endif +} + + + + +static void close_cb(uv_handle_t* handle) { + close_called++; +} + + +static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + static char base[1]; + + buf->base = base; + buf->len = sizeof(base); +} + + +static void read_cb(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { + uv_pipe_t* p; + uv_pipe_t* inc; + uv_handle_type pending; + unsigned int i; + + p = (uv_pipe_t*) handle; + ASSERT(nread >= 0); + + while (uv_pipe_pending_count(p) != 0) { + pending = uv_pipe_pending_type(p); + ASSERT(pending == UV_NAMED_PIPE); + + ASSERT(incoming_count < ARRAY_SIZE(incoming)); + inc = &incoming[incoming_count++]; + ASSERT(0 == uv_pipe_init(p->loop, inc, 0)); + ASSERT(0 == uv_accept(handle, (uv_stream_t*) inc)); + } + + if (incoming_count != ARRAY_SIZE(incoming)) + return; + + ASSERT(0 == uv_read_stop((uv_stream_t*) p)); + uv_close((uv_handle_t*) p, close_cb); + for (i = 0; i < ARRAY_SIZE(incoming); i++) + uv_close((uv_handle_t*) &incoming[i], close_cb); +} + + +TEST_IMPL(pipe_sendmsg) { + uv_pipe_t p; + int r; + int fds[2]; + int send_fds[ARRAY_SIZE(incoming)]; + struct msghdr msg; + char scratch[64]; + struct cmsghdr *cmsg; + unsigned int i; + uv_buf_t buf; + + ASSERT(0 == socketpair(AF_UNIX, SOCK_STREAM, 0, fds)); + for (i = 0; i < ARRAY_SIZE(send_fds); i += 2) + ASSERT(0 == socketpair(AF_UNIX, SOCK_STREAM, 0, send_fds + i)); + ASSERT(i == ARRAY_SIZE(send_fds)); + ASSERT(0 == uv_pipe_init(uv_default_loop(), &p, 1)); + ASSERT(0 == uv_pipe_open(&p, fds[1])); + + buf = uv_buf_init("X", 1); + memset(&msg, 0, sizeof(msg)); + msg.msg_iov = (struct iovec*) &buf; + msg.msg_iovlen = 1; + msg.msg_flags = 0; + + msg.msg_control = (void*) scratch; + msg.msg_controllen = CMSG_LEN(sizeof(send_fds)); + ASSERT(sizeof(scratch) >= msg.msg_controllen); + + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = msg.msg_controllen; + + /* silence aliasing warning */ + { + void* pv = CMSG_DATA(cmsg); + int* pi = pv; + for (i = 0; i < ARRAY_SIZE(send_fds); i++) + pi[i] = send_fds[i]; + } + + set_nonblocking(fds[1]); + ASSERT(0 == uv_read_start((uv_stream_t*) &p, alloc_cb, read_cb)); + + do + r = sendmsg(fds[0], &msg, 0); + while (r == -1 && errno == EINTR); + ASSERT(r == 1); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(ARRAY_SIZE(incoming) == incoming_count); + ASSERT(ARRAY_SIZE(incoming) + 1 == close_called); + close(fds[0]); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#else /* !_WIN32 */ + +TEST_IMPL(pipe_sendmsg) { + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* _WIN32 */ diff --git a/3rdparty/libuv/test/test-pipe-server-close.c b/3rdparty/libuv/test/test-pipe-server-close.c new file mode 100644 index 00000000000..1dcdfffaf7c --- /dev/null +++ b/3rdparty/libuv/test/test-pipe-server-close.c @@ -0,0 +1,91 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + + +static uv_pipe_t pipe_client; +static uv_pipe_t pipe_server; +static uv_connect_t connect_req; + +static int pipe_close_cb_called = 0; +static int pipe_client_connect_cb_called = 0; + + +static void pipe_close_cb(uv_handle_t* handle) { + ASSERT(handle == (uv_handle_t*) &pipe_client || + handle == (uv_handle_t*) &pipe_server); + pipe_close_cb_called++; +} + + +static void pipe_client_connect_cb(uv_connect_t* req, int status) { + ASSERT(req == &connect_req); + ASSERT(status == 0); + + pipe_client_connect_cb_called++; + + uv_close((uv_handle_t*) &pipe_client, pipe_close_cb); + uv_close((uv_handle_t*) &pipe_server, pipe_close_cb); +} + + +static void pipe_server_connection_cb(uv_stream_t* handle, int status) { + /* This function *may* be called, depending on whether accept or the + * connection callback is called first. + */ + ASSERT(status == 0); +} + + +TEST_IMPL(pipe_server_close) { + uv_loop_t* loop; + int r; + + loop = uv_default_loop(); + ASSERT(loop != NULL); + + r = uv_pipe_init(loop, &pipe_server, 0); + ASSERT(r == 0); + + r = uv_pipe_bind(&pipe_server, TEST_PIPENAME); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*) &pipe_server, 0, pipe_server_connection_cb); + ASSERT(r == 0); + + r = uv_pipe_init(loop, &pipe_client, 0); + ASSERT(r == 0); + + uv_pipe_connect(&connect_req, &pipe_client, TEST_PIPENAME, pipe_client_connect_cb); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + ASSERT(pipe_client_connect_cb_called == 1); + ASSERT(pipe_close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-pipe-set-non-blocking.c b/3rdparty/libuv/test/test-pipe-set-non-blocking.c new file mode 100644 index 00000000000..fcc9fc0da85 --- /dev/null +++ b/3rdparty/libuv/test/test-pipe-set-non-blocking.c @@ -0,0 +1,99 @@ +/* Copyright (c) 2015, Ben Noordhuis + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#ifdef _WIN32 + +TEST_IMPL(pipe_set_non_blocking) { + RETURN_SKIP("Test not implemented on Windows."); +} + +#else /* !_WIN32 */ + +#include +#include +#include +#include +#include +#include + +struct thread_ctx { + uv_barrier_t barrier; + int fd; +}; + +static void thread_main(void* arg) { + struct thread_ctx* ctx; + char buf[4096]; + ssize_t n; + + ctx = arg; + uv_barrier_wait(&ctx->barrier); + + do + n = read(ctx->fd, buf, sizeof(buf)); + while (n > 0 || (n == -1 && errno == EINTR)); + + ASSERT(n == 0); +} + +TEST_IMPL(pipe_set_non_blocking) { + struct thread_ctx ctx; + uv_pipe_t pipe_handle; + uv_thread_t thread; + size_t nwritten; + char data[4096]; + uv_buf_t buf; + int fd[2]; + int n; + + ASSERT(0 == uv_pipe_init(uv_default_loop(), &pipe_handle, 0)); + ASSERT(0 == socketpair(AF_UNIX, SOCK_STREAM, 0, fd)); + ASSERT(0 == uv_pipe_open(&pipe_handle, fd[0])); + ASSERT(0 == uv_stream_set_blocking((uv_stream_t*) &pipe_handle, 1)); + + ctx.fd = fd[1]; + ASSERT(0 == uv_barrier_init(&ctx.barrier, 2)); + ASSERT(0 == uv_thread_create(&thread, thread_main, &ctx)); + uv_barrier_wait(&ctx.barrier); + + buf.len = sizeof(data); + buf.base = data; + memset(data, '.', sizeof(data)); + + nwritten = 0; + while (nwritten < 10 << 20) { + /* The stream is in blocking mode so uv_try_write() should always succeed + * with the exact number of bytes that we wanted written. + */ + n = uv_try_write((uv_stream_t*) &pipe_handle, &buf, 1); + ASSERT(n == sizeof(data)); + nwritten += n; + } + + uv_close((uv_handle_t*) &pipe_handle, NULL); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + ASSERT(0 == uv_thread_join(&thread)); + ASSERT(0 == close(fd[1])); /* fd[0] is closed by uv_close(). */ + uv_barrier_destroy(&ctx.barrier); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* !_WIN32 */ diff --git a/3rdparty/libuv/test/test-platform-output.c b/3rdparty/libuv/test/test-platform-output.c new file mode 100644 index 00000000000..76495e14fd8 --- /dev/null +++ b/3rdparty/libuv/test/test-platform-output.c @@ -0,0 +1,126 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include + + +TEST_IMPL(platform_output) { + char buffer[512]; + size_t rss; + size_t size; + double uptime; + uv_rusage_t rusage; + uv_cpu_info_t* cpus; + uv_interface_address_t* interfaces; + int count; + int i; + int err; + + err = uv_get_process_title(buffer, sizeof(buffer)); + ASSERT(err == 0); + printf("uv_get_process_title: %s\n", buffer); + + size = sizeof(buffer); + err = uv_cwd(buffer, &size); + ASSERT(err == 0); + printf("uv_cwd: %s\n", buffer); + + err = uv_resident_set_memory(&rss); + ASSERT(err == 0); + printf("uv_resident_set_memory: %llu\n", (unsigned long long) rss); + + err = uv_uptime(&uptime); + ASSERT(err == 0); + ASSERT(uptime > 0); + printf("uv_uptime: %f\n", uptime); + + err = uv_getrusage(&rusage); + ASSERT(err == 0); + ASSERT(rusage.ru_utime.tv_sec >= 0); + ASSERT(rusage.ru_utime.tv_usec >= 0); + ASSERT(rusage.ru_stime.tv_sec >= 0); + ASSERT(rusage.ru_stime.tv_usec >= 0); + printf("uv_getrusage:\n"); + printf(" user: %llu sec %llu microsec\n", + (unsigned long long) rusage.ru_utime.tv_sec, + (unsigned long long) rusage.ru_utime.tv_usec); + printf(" system: %llu sec %llu microsec\n", + (unsigned long long) rusage.ru_stime.tv_sec, + (unsigned long long) rusage.ru_stime.tv_usec); + + err = uv_cpu_info(&cpus, &count); + ASSERT(err == 0); + + printf("uv_cpu_info:\n"); + for (i = 0; i < count; i++) { + printf(" model: %s\n", cpus[i].model); + printf(" speed: %d\n", cpus[i].speed); + printf(" times.sys: %llu\n", (unsigned long long) cpus[i].cpu_times.sys); + printf(" times.user: %llu\n", + (unsigned long long) cpus[i].cpu_times.user); + printf(" times.idle: %llu\n", + (unsigned long long) cpus[i].cpu_times.idle); + printf(" times.irq: %llu\n", (unsigned long long) cpus[i].cpu_times.irq); + printf(" times.nice: %llu\n", + (unsigned long long) cpus[i].cpu_times.nice); + } + uv_free_cpu_info(cpus, count); + + err = uv_interface_addresses(&interfaces, &count); + ASSERT(err == 0); + + printf("uv_interface_addresses:\n"); + for (i = 0; i < count; i++) { + printf(" name: %s\n", interfaces[i].name); + printf(" internal: %d\n", interfaces[i].is_internal); + printf(" physical address: "); + printf("%02x:%02x:%02x:%02x:%02x:%02x\n", + (unsigned char)interfaces[i].phys_addr[0], + (unsigned char)interfaces[i].phys_addr[1], + (unsigned char)interfaces[i].phys_addr[2], + (unsigned char)interfaces[i].phys_addr[3], + (unsigned char)interfaces[i].phys_addr[4], + (unsigned char)interfaces[i].phys_addr[5]); + + if (interfaces[i].address.address4.sin_family == AF_INET) { + uv_ip4_name(&interfaces[i].address.address4, buffer, sizeof(buffer)); + } else if (interfaces[i].address.address4.sin_family == AF_INET6) { + uv_ip6_name(&interfaces[i].address.address6, buffer, sizeof(buffer)); + } + + printf(" address: %s\n", buffer); + + if (interfaces[i].netmask.netmask4.sin_family == AF_INET) { + uv_ip4_name(&interfaces[i].netmask.netmask4, buffer, sizeof(buffer)); + printf(" netmask: %s\n", buffer); + } else if (interfaces[i].netmask.netmask4.sin_family == AF_INET6) { + uv_ip6_name(&interfaces[i].netmask.netmask6, buffer, sizeof(buffer)); + printf(" netmask: %s\n", buffer); + } else { + printf(" netmask: none\n"); + } + } + uv_free_interface_addresses(interfaces, count); + + return 0; +} diff --git a/3rdparty/libuv/test/test-poll-close-doesnt-corrupt-stack.c b/3rdparty/libuv/test/test-poll-close-doesnt-corrupt-stack.c new file mode 100644 index 00000000000..fc2cc004f16 --- /dev/null +++ b/3rdparty/libuv/test/test-poll-close-doesnt-corrupt-stack.c @@ -0,0 +1,114 @@ +/* Copyright Bert Belder, and other libuv contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifdef _WIN32 + +#include +#include + +#include "uv.h" +#include "task.h" + +#ifdef _MSC_VER /* msvc */ +# define NO_INLINE __declspec(noinline) +#else /* gcc */ +# define NO_INLINE __attribute__ ((noinline)) +#endif + + +uv_os_sock_t sock; +uv_poll_t handle; + +static int close_cb_called = 0; + + +static void close_cb(uv_handle_t* h) { + close_cb_called++; +} + + +static void poll_cb(uv_poll_t* h, int status, int events) { + ASSERT(0 && "should never get here"); +} + + +static void NO_INLINE close_socket_and_verify_stack() { + const uint32_t MARKER = 0xDEADBEEF; + const int VERIFY_AFTER = 10; /* ms */ + int r; + + volatile uint32_t data[65536]; + size_t i; + + for (i = 0; i < ARRAY_SIZE(data); i++) + data[i] = MARKER; + + r = closesocket(sock); + ASSERT(r == 0); + + uv_sleep(VERIFY_AFTER); + + for (i = 0; i < ARRAY_SIZE(data); i++) + ASSERT(data[i] == MARKER); +} + + +TEST_IMPL(poll_close_doesnt_corrupt_stack) { + struct WSAData wsa_data; + int r; + unsigned long on; + struct sockaddr_in addr; + + r = WSAStartup(MAKEWORD(2, 2), &wsa_data); + ASSERT(r == 0); + + sock = socket(AF_INET, SOCK_STREAM, 0); + ASSERT(sock != INVALID_SOCKET); + on = 1; + r = ioctlsocket(sock, FIONBIO, &on); + ASSERT(r == 0); + + r = uv_ip4_addr("127.0.0.1", TEST_PORT, &addr); + ASSERT(r == 0); + + r = connect(sock, (const struct sockaddr*) &addr, sizeof addr); + ASSERT(r != 0); + ASSERT(WSAGetLastError() == WSAEWOULDBLOCK); + + r = uv_poll_init_socket(uv_default_loop(), &handle, sock); + ASSERT(r == 0); + r = uv_poll_start(&handle, UV_READABLE | UV_WRITABLE, poll_cb); + ASSERT(r == 0); + + uv_close((uv_handle_t*) &handle, close_cb); + + close_socket_and_verify_stack(); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* _WIN32 */ diff --git a/3rdparty/libuv/test/test-poll-close.c b/3rdparty/libuv/test/test-poll-close.c new file mode 100644 index 00000000000..2eccddf5b0b --- /dev/null +++ b/3rdparty/libuv/test/test-poll-close.c @@ -0,0 +1,73 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include + +#ifndef _WIN32 +# include +# include +# include +#endif + +#include "uv.h" +#include "task.h" + +#define NUM_SOCKETS 64 + + +static int close_cb_called = 0; + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +TEST_IMPL(poll_close) { + uv_os_sock_t sockets[NUM_SOCKETS]; + uv_poll_t poll_handles[NUM_SOCKETS]; + int i; + +#ifdef _WIN32 + { + struct WSAData wsa_data; + int r = WSAStartup(MAKEWORD(2, 2), &wsa_data); + ASSERT(r == 0); + } +#endif + + for (i = 0; i < NUM_SOCKETS; i++) { + sockets[i] = socket(AF_INET, SOCK_STREAM, 0); + uv_poll_init_socket(uv_default_loop(), &poll_handles[i], sockets[i]); + uv_poll_start(&poll_handles[i], UV_READABLE | UV_WRITABLE, NULL); + } + + for (i = 0; i < NUM_SOCKETS; i++) { + uv_close((uv_handle_t*) &poll_handles[i], close_cb); + } + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == NUM_SOCKETS); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-poll-closesocket.c b/3rdparty/libuv/test/test-poll-closesocket.c new file mode 100644 index 00000000000..4db74a01f63 --- /dev/null +++ b/3rdparty/libuv/test/test-poll-closesocket.c @@ -0,0 +1,89 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifdef _WIN32 + +#include + +#include "uv.h" +#include "task.h" + +uv_os_sock_t sock; +uv_poll_t handle; + +static int close_cb_called = 0; + + +static void close_cb(uv_handle_t* h) { + close_cb_called++; +} + + +static void poll_cb(uv_poll_t* h, int status, int events) { + int r; + + ASSERT(status == 0); + ASSERT(h == &handle); + + r = uv_poll_start(&handle, UV_READABLE, poll_cb); + ASSERT(r == 0); + + closesocket(sock); + uv_close((uv_handle_t*) &handle, close_cb); + +} + + +TEST_IMPL(poll_closesocket) { + struct WSAData wsa_data; + int r; + unsigned long on; + struct sockaddr_in addr; + + r = WSAStartup(MAKEWORD(2, 2), &wsa_data); + ASSERT(r == 0); + + sock = socket(AF_INET, SOCK_STREAM, 0); + ASSERT(sock != INVALID_SOCKET); + on = 1; + r = ioctlsocket(sock, FIONBIO, &on); + ASSERT(r == 0); + + r = uv_ip4_addr("127.0.0.1", TEST_PORT, &addr); + ASSERT(r == 0); + + r = connect(sock, (const struct sockaddr*) &addr, sizeof addr); + ASSERT(r != 0); + ASSERT(WSAGetLastError() == WSAEWOULDBLOCK); + + r = uv_poll_init_socket(uv_default_loop(), &handle, sock); + ASSERT(r == 0); + r = uv_poll_start(&handle, UV_WRITABLE, poll_cb); + ASSERT(r == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif diff --git a/3rdparty/libuv/test/test-poll.c b/3rdparty/libuv/test/test-poll.c new file mode 100644 index 00000000000..be8b00c32ca --- /dev/null +++ b/3rdparty/libuv/test/test-poll.c @@ -0,0 +1,560 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include + +#ifndef _WIN32 +# include +# include +#endif + +#include "uv.h" +#include "task.h" + + +#define NUM_CLIENTS 5 +#define TRANSFER_BYTES (1 << 16) + +#undef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)); + + +typedef enum { + UNIDIRECTIONAL, + DUPLEX +} test_mode_t; + +typedef struct connection_context_s { + uv_poll_t poll_handle; + uv_timer_t timer_handle; + uv_os_sock_t sock; + size_t read, sent; + int is_server_connection; + int open_handles; + int got_fin, sent_fin; + unsigned int events, delayed_events; +} connection_context_t; + +typedef struct server_context_s { + uv_poll_t poll_handle; + uv_os_sock_t sock; + int connections; +} server_context_t; + + +static void delay_timer_cb(uv_timer_t* timer); + + +static test_mode_t test_mode = DUPLEX; + +static int closed_connections = 0; + +static int valid_writable_wakeups = 0; +static int spurious_writable_wakeups = 0; + + +static int got_eagain(void) { +#ifdef _WIN32 + return WSAGetLastError() == WSAEWOULDBLOCK; +#else + return errno == EAGAIN + || errno == EINPROGRESS +#ifdef EWOULDBLOCK + || errno == EWOULDBLOCK; +#endif + ; +#endif +} + + +static uv_os_sock_t create_bound_socket (struct sockaddr_in bind_addr) { + uv_os_sock_t sock; + int r; + + sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP); +#ifdef _WIN32 + ASSERT(sock != INVALID_SOCKET); +#else + ASSERT(sock >= 0); +#endif + +#ifndef _WIN32 + { + /* Allow reuse of the port. */ + int yes = 1; + r = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes); + ASSERT(r == 0); + } +#endif + + r = bind(sock, (const struct sockaddr*) &bind_addr, sizeof bind_addr); + ASSERT(r == 0); + + return sock; +} + + +static void close_socket(uv_os_sock_t sock) { + int r; +#ifdef _WIN32 + r = closesocket(sock); +#else + r = close(sock); +#endif + ASSERT(r == 0); +} + + +static connection_context_t* create_connection_context( + uv_os_sock_t sock, int is_server_connection) { + int r; + connection_context_t* context; + + context = (connection_context_t*) malloc(sizeof *context); + ASSERT(context != NULL); + + context->sock = sock; + context->is_server_connection = is_server_connection; + context->read = 0; + context->sent = 0; + context->open_handles = 0; + context->events = 0; + context->delayed_events = 0; + context->got_fin = 0; + context->sent_fin = 0; + + r = uv_poll_init_socket(uv_default_loop(), &context->poll_handle, sock); + context->open_handles++; + context->poll_handle.data = context; + ASSERT(r == 0); + + r = uv_timer_init(uv_default_loop(), &context->timer_handle); + context->open_handles++; + context->timer_handle.data = context; + ASSERT(r == 0); + + return context; +} + + +static void connection_close_cb(uv_handle_t* handle) { + connection_context_t* context = (connection_context_t*) handle->data; + + if (--context->open_handles == 0) { + if (test_mode == DUPLEX || context->is_server_connection) { + ASSERT(context->read == TRANSFER_BYTES); + } else { + ASSERT(context->read == 0); + } + + if (test_mode == DUPLEX || !context->is_server_connection) { + ASSERT(context->sent == TRANSFER_BYTES); + } else { + ASSERT(context->sent == 0); + } + + closed_connections++; + + free(context); + } +} + + +static void destroy_connection_context(connection_context_t* context) { + uv_close((uv_handle_t*) &context->poll_handle, connection_close_cb); + uv_close((uv_handle_t*) &context->timer_handle, connection_close_cb); +} + + +static void connection_poll_cb(uv_poll_t* handle, int status, int events) { + connection_context_t* context = (connection_context_t*) handle->data; + unsigned int new_events; + int r; + + ASSERT(status == 0); + ASSERT(events & context->events); + ASSERT(!(events & ~context->events)); + + new_events = context->events; + + if (events & UV_READABLE) { + int action = rand() % 7; + + switch (action) { + case 0: + case 1: { + /* Read a couple of bytes. */ + static char buffer[74]; + r = recv(context->sock, buffer, sizeof buffer, 0); + ASSERT(r >= 0); + + if (r > 0) { + context->read += r; + } else { + /* Got FIN. */ + context->got_fin = 1; + new_events &= ~UV_READABLE; + } + + break; + } + + case 2: + case 3: { + /* Read until EAGAIN. */ + static char buffer[931]; + r = recv(context->sock, buffer, sizeof buffer, 0); + ASSERT(r >= 0); + + while (r > 0) { + context->read += r; + r = recv(context->sock, buffer, sizeof buffer, 0); + } + + if (r == 0) { + /* Got FIN. */ + context->got_fin = 1; + new_events &= ~UV_READABLE; + } else { + ASSERT(got_eagain()); + } + + break; + } + + case 4: + /* Ignore. */ + break; + + case 5: + /* Stop reading for a while. Restart in timer callback. */ + new_events &= ~UV_READABLE; + if (!uv_is_active((uv_handle_t*) &context->timer_handle)) { + context->delayed_events = UV_READABLE; + uv_timer_start(&context->timer_handle, delay_timer_cb, 10, 0); + } else { + context->delayed_events |= UV_READABLE; + } + break; + + case 6: + /* Fudge with the event mask. */ + uv_poll_start(&context->poll_handle, UV_WRITABLE, connection_poll_cb); + uv_poll_start(&context->poll_handle, UV_READABLE, connection_poll_cb); + context->events = UV_READABLE; + break; + + default: + ASSERT(0); + } + } + + if (events & UV_WRITABLE) { + if (context->sent < TRANSFER_BYTES && + !(test_mode == UNIDIRECTIONAL && context->is_server_connection)) { + /* We have to send more bytes. */ + int action = rand() % 7; + + switch (action) { + case 0: + case 1: { + /* Send a couple of bytes. */ + static char buffer[103]; + + int send_bytes = MIN(TRANSFER_BYTES - context->sent, sizeof buffer); + ASSERT(send_bytes > 0); + + r = send(context->sock, buffer, send_bytes, 0); + + if (r < 0) { + ASSERT(got_eagain()); + spurious_writable_wakeups++; + break; + } + + ASSERT(r > 0); + context->sent += r; + valid_writable_wakeups++; + break; + } + + case 2: + case 3: { + /* Send until EAGAIN. */ + static char buffer[1234]; + + int send_bytes = MIN(TRANSFER_BYTES - context->sent, sizeof buffer); + ASSERT(send_bytes > 0); + + r = send(context->sock, buffer, send_bytes, 0); + + if (r < 0) { + ASSERT(got_eagain()); + spurious_writable_wakeups++; + break; + } + + ASSERT(r > 0); + valid_writable_wakeups++; + context->sent += r; + + while (context->sent < TRANSFER_BYTES) { + send_bytes = MIN(TRANSFER_BYTES - context->sent, sizeof buffer); + ASSERT(send_bytes > 0); + + r = send(context->sock, buffer, send_bytes, 0); + + if (r <= 0) break; + context->sent += r; + } + ASSERT(r > 0 || got_eagain()); + break; + } + + case 4: + /* Ignore. */ + break; + + case 5: + /* Stop sending for a while. Restart in timer callback. */ + new_events &= ~UV_WRITABLE; + if (!uv_is_active((uv_handle_t*) &context->timer_handle)) { + context->delayed_events = UV_WRITABLE; + uv_timer_start(&context->timer_handle, delay_timer_cb, 100, 0); + } else { + context->delayed_events |= UV_WRITABLE; + } + break; + + case 6: + /* Fudge with the event mask. */ + uv_poll_start(&context->poll_handle, + UV_READABLE, + connection_poll_cb); + uv_poll_start(&context->poll_handle, + UV_WRITABLE, + connection_poll_cb); + context->events = UV_WRITABLE; + break; + + default: + ASSERT(0); + } + + } else { + /* Nothing more to write. Send FIN. */ + int r; +#ifdef _WIN32 + r = shutdown(context->sock, SD_SEND); +#else + r = shutdown(context->sock, SHUT_WR); +#endif + ASSERT(r == 0); + context->sent_fin = 1; + new_events &= ~UV_WRITABLE; + } + } + + if (context->got_fin && context->sent_fin) { + /* Sent and received FIN. Close and destroy context. */ + close_socket(context->sock); + destroy_connection_context(context); + context->events = 0; + + } else if (new_events != context->events) { + /* Poll mask changed. Call uv_poll_start again. */ + context->events = new_events; + uv_poll_start(handle, new_events, connection_poll_cb); + } + + /* Assert that uv_is_active works correctly for poll handles. */ + if (context->events != 0) { + ASSERT(1 == uv_is_active((uv_handle_t*) handle)); + } else { + ASSERT(0 == uv_is_active((uv_handle_t*) handle)); + } +} + + +static void delay_timer_cb(uv_timer_t* timer) { + connection_context_t* context = (connection_context_t*) timer->data; + int r; + + /* Timer should auto stop. */ + ASSERT(0 == uv_is_active((uv_handle_t*) timer)); + + /* Add the requested events to the poll mask. */ + ASSERT(context->delayed_events != 0); + context->events |= context->delayed_events; + context->delayed_events = 0; + + r = uv_poll_start(&context->poll_handle, + context->events, + connection_poll_cb); + ASSERT(r == 0); +} + + +static server_context_t* create_server_context( + uv_os_sock_t sock) { + int r; + server_context_t* context; + + context = (server_context_t*) malloc(sizeof *context); + ASSERT(context != NULL); + + context->sock = sock; + context->connections = 0; + + r = uv_poll_init_socket(uv_default_loop(), &context->poll_handle, sock); + context->poll_handle.data = context; + ASSERT(r == 0); + + return context; +} + + +static void server_close_cb(uv_handle_t* handle) { + server_context_t* context = (server_context_t*) handle->data; + free(context); +} + + +static void destroy_server_context(server_context_t* context) { + uv_close((uv_handle_t*) &context->poll_handle, server_close_cb); +} + + +static void server_poll_cb(uv_poll_t* handle, int status, int events) { + server_context_t* server_context = (server_context_t*) + handle->data; + connection_context_t* connection_context; + struct sockaddr_in addr; + socklen_t addr_len; + uv_os_sock_t sock; + int r; + + addr_len = sizeof addr; + sock = accept(server_context->sock, (struct sockaddr*) &addr, &addr_len); +#ifdef _WIN32 + ASSERT(sock != INVALID_SOCKET); +#else + ASSERT(sock >= 0); +#endif + + connection_context = create_connection_context(sock, 1); + connection_context->events = UV_READABLE | UV_WRITABLE; + r = uv_poll_start(&connection_context->poll_handle, + UV_READABLE | UV_WRITABLE, + connection_poll_cb); + ASSERT(r == 0); + + if (++server_context->connections == NUM_CLIENTS) { + close_socket(server_context->sock); + destroy_server_context(server_context); + } +} + + +static void start_server(void) { + server_context_t* context; + struct sockaddr_in addr; + uv_os_sock_t sock; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + sock = create_bound_socket(addr); + context = create_server_context(sock); + + r = listen(sock, 100); + ASSERT(r == 0); + + r = uv_poll_start(&context->poll_handle, UV_READABLE, server_poll_cb); + ASSERT(r == 0); +} + + +static void start_client(void) { + uv_os_sock_t sock; + connection_context_t* context; + struct sockaddr_in server_addr; + struct sockaddr_in addr; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &server_addr)); + ASSERT(0 == uv_ip4_addr("0.0.0.0", 0, &addr)); + + sock = create_bound_socket(addr); + context = create_connection_context(sock, 0); + + context->events = UV_READABLE | UV_WRITABLE; + r = uv_poll_start(&context->poll_handle, + UV_READABLE | UV_WRITABLE, + connection_poll_cb); + ASSERT(r == 0); + + r = connect(sock, (struct sockaddr*) &server_addr, sizeof server_addr); + ASSERT(r == 0 || got_eagain()); +} + + +static void start_poll_test(void) { + int i, r; + +#ifdef _WIN32 + { + struct WSAData wsa_data; + int r = WSAStartup(MAKEWORD(2, 2), &wsa_data); + ASSERT(r == 0); + } +#endif + + start_server(); + + for (i = 0; i < NUM_CLIENTS; i++) + start_client(); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + /* Assert that at most five percent of the writable wakeups was spurious. */ + ASSERT(spurious_writable_wakeups == 0 || + (valid_writable_wakeups + spurious_writable_wakeups) / + spurious_writable_wakeups > 20); + + ASSERT(closed_connections == NUM_CLIENTS * 2); + + MAKE_VALGRIND_HAPPY(); +} + + +TEST_IMPL(poll_duplex) { + test_mode = DUPLEX; + start_poll_test(); + return 0; +} + + +TEST_IMPL(poll_unidirectional) { + test_mode = UNIDIRECTIONAL; + start_poll_test(); + return 0; +} diff --git a/3rdparty/libuv/test/test-process-title.c b/3rdparty/libuv/test/test-process-title.c new file mode 100644 index 00000000000..42ade441604 --- /dev/null +++ b/3rdparty/libuv/test/test-process-title.c @@ -0,0 +1,53 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include + + +static void set_title(const char* title) { + char buffer[512]; + int err; + + err = uv_get_process_title(buffer, sizeof(buffer)); + ASSERT(err == 0); + + err = uv_set_process_title(title); + ASSERT(err == 0); + + err = uv_get_process_title(buffer, sizeof(buffer)); + ASSERT(err == 0); + + ASSERT(strcmp(buffer, title) == 0); +} + + +TEST_IMPL(process_title) { +#if defined(__sun) || defined(_AIX) + RETURN_SKIP("uv_(get|set)_process_title is not implemented."); +#else + /* Check for format string vulnerabilities. */ + set_title("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"); + set_title("new title"); + return 0; +#endif +} diff --git a/3rdparty/libuv/test/test-queue-foreach-delete.c b/3rdparty/libuv/test/test-queue-foreach-delete.c new file mode 100644 index 00000000000..45da225381f --- /dev/null +++ b/3rdparty/libuv/test/test-queue-foreach-delete.c @@ -0,0 +1,200 @@ +/* Copyright The libuv project and contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include + + +/* + * The idea behind the test is as follows. + * Certain handle types are stored in a queue internally. + * Extra care should be taken for removal of a handle from the queue while iterating over the queue. + * (i.e., QUEUE_REMOVE() called within QUEUE_FOREACH()) + * This usually happens when someone closes or stops a handle from within its callback. + * So we need to check that we haven't screwed the queue on close/stop. + * To do so we do the following (for each handle type): + * 1. Create and start 3 handles (#0, #1, and #2). + * + * The queue after the start() calls: + * ..=> [queue head] <=> [handle] <=> [handle #1] <=> [handle] <=.. + * + * 2. Trigger handles to fire (for uv_idle_t, uv_prepare_t, and uv_check_t there is nothing to do). + * + * 3. In the callback for the first-executed handle (#0 or #2 depending on handle type) + * stop the handle and the next one (#1). + * (for uv_idle_t, uv_prepare_t, and uv_check_t callbacks are executed in the reverse order as they are start()'ed, + * so callback for handle #2 will be called first) + * + * The queue after the stop() calls: + * correct foreach "next" | + * \/ + * ..=> [queue head] <==============================> [handle] <=.. + * [ ] <- [handle] <=> [handle #1] -> [ ] + * /\ + * wrong foreach "next" | + * + * 4. The callback for handle #1 shouldn't be called because the handle #1 is stopped in the previous step. + * However, if QUEUE_REMOVE() is not handled properly within QUEUE_FOREACH(), the callback _will_ be called. + */ + +static const unsigned first_handle_number_idle = 2; +static const unsigned first_handle_number_prepare = 2; +static const unsigned first_handle_number_check = 2; +#ifdef __linux__ +static const unsigned first_handle_number_fs_event = 0; +#endif + + +#define DEFINE_GLOBALS_AND_CBS(name) \ + static uv_##name##_t (name)[3]; \ + static unsigned name##_cb_calls[3]; \ + \ + static void name##2_cb(uv_##name##_t* handle) { \ + ASSERT(handle == &(name)[2]); \ + if (first_handle_number_##name == 2) { \ + uv_close((uv_handle_t*)&(name)[2], NULL); \ + uv_close((uv_handle_t*)&(name)[1], NULL); \ + } \ + name##_cb_calls[2]++; \ + } \ + \ + static void name##1_cb(uv_##name##_t* handle) { \ + ASSERT(handle == &(name)[1]); \ + ASSERT(0 && "Shouldn't be called" && (&name[0])); \ + } \ + \ + static void name##0_cb(uv_##name##_t* handle) { \ + ASSERT(handle == &(name)[0]); \ + if (first_handle_number_##name == 0) { \ + uv_close((uv_handle_t*)&(name)[0], NULL); \ + uv_close((uv_handle_t*)&(name)[1], NULL); \ + } \ + name##_cb_calls[0]++; \ + } \ + \ + static const uv_##name##_cb name##_cbs[] = { \ + (uv_##name##_cb)name##0_cb, \ + (uv_##name##_cb)name##1_cb, \ + (uv_##name##_cb)name##2_cb, \ + }; + +#define INIT_AND_START(name, loop) \ + do { \ + size_t i; \ + for (i = 0; i < ARRAY_SIZE(name); i++) { \ + int r; \ + r = uv_##name##_init((loop), &(name)[i]); \ + ASSERT(r == 0); \ + \ + r = uv_##name##_start(&(name)[i], name##_cbs[i]); \ + ASSERT(r == 0); \ + } \ + } while (0) + +#define END_ASSERTS(name) \ + do { \ + ASSERT(name##_cb_calls[0] == 1); \ + ASSERT(name##_cb_calls[1] == 0); \ + ASSERT(name##_cb_calls[2] == 1); \ + } while (0) + +DEFINE_GLOBALS_AND_CBS(idle) +DEFINE_GLOBALS_AND_CBS(prepare) +DEFINE_GLOBALS_AND_CBS(check) + +#ifdef __linux__ +DEFINE_GLOBALS_AND_CBS(fs_event) + +static const char watched_dir[] = "."; +static uv_timer_t timer; +static unsigned helper_timer_cb_calls; + + +static void init_and_start_fs_events(uv_loop_t* loop) { + size_t i; + for (i = 0; i < ARRAY_SIZE(fs_event); i++) { + int r; + r = uv_fs_event_init(loop, &fs_event[i]); + ASSERT(r == 0); + + r = uv_fs_event_start(&fs_event[i], + (uv_fs_event_cb)fs_event_cbs[i], + watched_dir, + 0); + ASSERT(r == 0); + } +} + +static void helper_timer_cb(uv_timer_t* thandle) { + int r; + uv_fs_t fs_req; + + /* fire all fs_events */ + r = uv_fs_utime(thandle->loop, &fs_req, watched_dir, 0, 0, NULL); + ASSERT(r == 0); + ASSERT(fs_req.result == 0); + ASSERT(fs_req.fs_type == UV_FS_UTIME); + ASSERT(strcmp(fs_req.path, watched_dir) == 0); + uv_fs_req_cleanup(&fs_req); + + helper_timer_cb_calls++; +} +#endif + + +TEST_IMPL(queue_foreach_delete) { + uv_loop_t* loop; + int r; + + loop = uv_default_loop(); + + INIT_AND_START(idle, loop); + INIT_AND_START(prepare, loop); + INIT_AND_START(check, loop); + +#ifdef __linux__ + init_and_start_fs_events(loop); + + /* helper timer to trigger async and fs_event callbacks */ + r = uv_timer_init(loop, &timer); + ASSERT(r == 0); + + r = uv_timer_start(&timer, helper_timer_cb, 0, 0); + ASSERT(r == 0); +#endif + + r = uv_run(loop, UV_RUN_NOWAIT); + ASSERT(r == 1); + + END_ASSERTS(idle); + END_ASSERTS(prepare); + END_ASSERTS(check); + +#ifdef __linux__ + ASSERT(helper_timer_cb_calls == 1); +#endif + + MAKE_VALGRIND_HAPPY(); + + return 0; +} diff --git a/3rdparty/libuv/test/test-ref.c b/3rdparty/libuv/test/test-ref.c new file mode 100644 index 00000000000..ddaa1738083 --- /dev/null +++ b/3rdparty/libuv/test/test-ref.c @@ -0,0 +1,442 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + + +static uv_write_t write_req; +static uv_shutdown_t shutdown_req; +static uv_connect_t connect_req; + +static char buffer[32767]; + +static int req_cb_called; +static int connect_cb_called; +static int write_cb_called; +static int shutdown_cb_called; +static int close_cb_called; + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +static void do_close(void* handle) { + close_cb_called = 0; + uv_close((uv_handle_t*)handle, close_cb); + ASSERT(close_cb_called == 0); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(close_cb_called == 1); +} + + +static void fail_cb(void) { + FATAL("fail_cb should not have been called"); +} + + +static void fail_cb2(void) { + ASSERT(0 && "fail_cb2 should not have been called"); +} + + +static void req_cb(uv_handle_t* req, int status) { + req_cb_called++; +} + + +static void shutdown_cb(uv_shutdown_t* req, int status) { + ASSERT(req == &shutdown_req); + shutdown_cb_called++; +} + + +static void write_cb(uv_write_t* req, int status) { + ASSERT(req == &write_req); + uv_shutdown(&shutdown_req, req->handle, shutdown_cb); + write_cb_called++; +} + + +static void connect_and_write(uv_connect_t* req, int status) { + uv_buf_t buf = uv_buf_init(buffer, sizeof buffer); + ASSERT(req == &connect_req); + ASSERT(status == 0); + uv_write(&write_req, req->handle, &buf, 1, write_cb); + connect_cb_called++; +} + + + +static void connect_and_shutdown(uv_connect_t* req, int status) { + ASSERT(req == &connect_req); + ASSERT(status == 0); + uv_shutdown(&shutdown_req, req->handle, shutdown_cb); + connect_cb_called++; +} + + +TEST_IMPL(ref) { + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(idle_ref) { + uv_idle_t h; + uv_idle_init(uv_default_loop(), &h); + uv_idle_start(&h, (uv_idle_cb) fail_cb2); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(async_ref) { + uv_async_t h; + uv_async_init(uv_default_loop(), &h, NULL); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(prepare_ref) { + uv_prepare_t h; + uv_prepare_init(uv_default_loop(), &h); + uv_prepare_start(&h, (uv_prepare_cb) fail_cb2); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(check_ref) { + uv_check_t h; + uv_check_init(uv_default_loop(), &h); + uv_check_start(&h, (uv_check_cb) fail_cb2); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +static void prepare_cb(uv_prepare_t* h) { + ASSERT(h != NULL); + uv_unref((uv_handle_t*)h); +} + + +TEST_IMPL(unref_in_prepare_cb) { + uv_prepare_t h; + uv_prepare_init(uv_default_loop(), &h); + uv_prepare_start(&h, prepare_cb); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(timer_ref) { + uv_timer_t h; + uv_timer_init(uv_default_loop(), &h); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(timer_ref2) { + uv_timer_t h; + uv_timer_init(uv_default_loop(), &h); + uv_timer_start(&h, (uv_timer_cb)fail_cb, 42, 42); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_event_ref) { + uv_fs_event_t h; + uv_fs_event_init(uv_default_loop(), &h); + uv_fs_event_start(&h, (uv_fs_event_cb)fail_cb, ".", 0); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(fs_poll_ref) { + uv_fs_poll_t h; + uv_fs_poll_init(uv_default_loop(), &h); + uv_fs_poll_start(&h, NULL, ".", 999); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_ref) { + uv_tcp_t h; + uv_tcp_init(uv_default_loop(), &h); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_ref2) { + uv_tcp_t h; + uv_tcp_init(uv_default_loop(), &h); + uv_listen((uv_stream_t*)&h, 128, (uv_connection_cb)fail_cb); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_ref2b) { + uv_tcp_t h; + uv_tcp_init(uv_default_loop(), &h); + uv_listen((uv_stream_t*)&h, 128, (uv_connection_cb)fail_cb); + uv_unref((uv_handle_t*)&h); + uv_close((uv_handle_t*)&h, close_cb); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(close_cb_called == 1); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_ref3) { + struct sockaddr_in addr; + uv_tcp_t h; + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + uv_tcp_init(uv_default_loop(), &h); + uv_tcp_connect(&connect_req, + &h, + (const struct sockaddr*) &addr, + connect_and_shutdown); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(connect_cb_called == 1); + ASSERT(shutdown_cb_called == 1); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_ref4) { + struct sockaddr_in addr; + uv_tcp_t h; + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + uv_tcp_init(uv_default_loop(), &h); + uv_tcp_connect(&connect_req, + &h, + (const struct sockaddr*) &addr, + connect_and_write); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(connect_cb_called == 1); + ASSERT(write_cb_called == 1); + ASSERT(shutdown_cb_called == 1); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(udp_ref) { + uv_udp_t h; + uv_udp_init(uv_default_loop(), &h); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(udp_ref2) { + struct sockaddr_in addr; + uv_udp_t h; + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + uv_udp_init(uv_default_loop(), &h); + uv_udp_bind(&h, (const struct sockaddr*) &addr, 0); + uv_udp_recv_start(&h, (uv_alloc_cb)fail_cb, (uv_udp_recv_cb)fail_cb); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(udp_ref3) { + struct sockaddr_in addr; + uv_buf_t buf = uv_buf_init("PING", 4); + uv_udp_send_t req; + uv_udp_t h; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + uv_udp_init(uv_default_loop(), &h); + uv_udp_send(&req, + &h, + &buf, + 1, + (const struct sockaddr*) &addr, + (uv_udp_send_cb) req_cb); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(req_cb_called == 1); + do_close(&h); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(pipe_ref) { + uv_pipe_t h; + uv_pipe_init(uv_default_loop(), &h, 0); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(pipe_ref2) { + uv_pipe_t h; + uv_pipe_init(uv_default_loop(), &h, 0); + uv_listen((uv_stream_t*)&h, 128, (uv_connection_cb)fail_cb); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(pipe_ref3) { + uv_pipe_t h; + uv_pipe_init(uv_default_loop(), &h, 0); + uv_pipe_connect(&connect_req, &h, TEST_PIPENAME, connect_and_shutdown); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(connect_cb_called == 1); + ASSERT(shutdown_cb_called == 1); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(pipe_ref4) { + uv_pipe_t h; + uv_pipe_init(uv_default_loop(), &h, 0); + uv_pipe_connect(&connect_req, &h, TEST_PIPENAME, connect_and_write); + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(connect_cb_called == 1); + ASSERT(write_cb_called == 1); + ASSERT(shutdown_cb_called == 1); + do_close(&h); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(process_ref) { + /* spawn_helper4 blocks indefinitely. */ + char *argv[] = { NULL, "spawn_helper4", NULL }; + uv_process_options_t options; + size_t exepath_size; + char exepath[256]; + uv_process_t h; + int r; + + memset(&options, 0, sizeof(options)); + exepath_size = sizeof(exepath); + + r = uv_exepath(exepath, &exepath_size); + ASSERT(r == 0); + + argv[0] = exepath; + options.file = exepath; + options.args = argv; + options.exit_cb = NULL; + + r = uv_spawn(uv_default_loop(), &h, &options); + ASSERT(r == 0); + + uv_unref((uv_handle_t*)&h); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + r = uv_process_kill(&h, /* SIGTERM */ 15); + ASSERT(r == 0); + + do_close(&h); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(has_ref) { + uv_idle_t h; + uv_idle_init(uv_default_loop(), &h); + uv_ref((uv_handle_t*)&h); + ASSERT(uv_has_ref((uv_handle_t*)&h) == 1); + uv_unref((uv_handle_t*)&h); + ASSERT(uv_has_ref((uv_handle_t*)&h) == 0); + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-run-nowait.c b/3rdparty/libuv/test/test-run-nowait.c new file mode 100644 index 00000000000..43524f636d8 --- /dev/null +++ b/3rdparty/libuv/test/test-run-nowait.c @@ -0,0 +1,45 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static uv_timer_t timer_handle; +static int timer_called = 0; + + +static void timer_cb(uv_timer_t* handle) { + ASSERT(handle == &timer_handle); + timer_called = 1; +} + + +TEST_IMPL(run_nowait) { + int r; + uv_timer_init(uv_default_loop(), &timer_handle); + uv_timer_start(&timer_handle, timer_cb, 100, 100); + + r = uv_run(uv_default_loop(), UV_RUN_NOWAIT); + ASSERT(r != 0); + ASSERT(timer_called == 0); + + return 0; +} diff --git a/3rdparty/libuv/test/test-run-once.c b/3rdparty/libuv/test/test-run-once.c new file mode 100644 index 00000000000..10cbf95e4ad --- /dev/null +++ b/3rdparty/libuv/test/test-run-once.c @@ -0,0 +1,48 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#define NUM_TICKS 64 + +static uv_idle_t idle_handle; +static int idle_counter; + + +static void idle_cb(uv_idle_t* handle) { + ASSERT(handle == &idle_handle); + + if (++idle_counter == NUM_TICKS) + uv_idle_stop(handle); +} + + +TEST_IMPL(run_once) { + uv_idle_init(uv_default_loop(), &idle_handle); + uv_idle_start(&idle_handle, idle_cb); + + while (uv_run(uv_default_loop(), UV_RUN_ONCE)); + ASSERT(idle_counter == NUM_TICKS); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-semaphore.c b/3rdparty/libuv/test/test-semaphore.c new file mode 100644 index 00000000000..ac03bb08f17 --- /dev/null +++ b/3rdparty/libuv/test/test-semaphore.c @@ -0,0 +1,111 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +typedef struct { + uv_mutex_t mutex; + uv_sem_t sem; + int delay; + volatile int posted; +} worker_config; + + +static void worker(void* arg) { + worker_config* c = arg; + + if (c->delay) + uv_sleep(c->delay); + + uv_mutex_lock(&c->mutex); + ASSERT(c->posted == 0); + uv_sem_post(&c->sem); + c->posted = 1; + uv_mutex_unlock(&c->mutex); +} + + +TEST_IMPL(semaphore_1) { + uv_thread_t thread; + worker_config wc; + + memset(&wc, 0, sizeof(wc)); + + ASSERT(0 == uv_sem_init(&wc.sem, 0)); + ASSERT(0 == uv_mutex_init(&wc.mutex)); + ASSERT(0 == uv_thread_create(&thread, worker, &wc)); + + uv_sleep(100); + uv_mutex_lock(&wc.mutex); + ASSERT(wc.posted == 1); + uv_sem_wait(&wc.sem); /* should not block */ + uv_mutex_unlock(&wc.mutex); /* ergo, it should be ok to unlock after wait */ + + ASSERT(0 == uv_thread_join(&thread)); + uv_mutex_destroy(&wc.mutex); + uv_sem_destroy(&wc.sem); + + return 0; +} + + +TEST_IMPL(semaphore_2) { + uv_thread_t thread; + worker_config wc; + + memset(&wc, 0, sizeof(wc)); + wc.delay = 100; + + ASSERT(0 == uv_sem_init(&wc.sem, 0)); + ASSERT(0 == uv_mutex_init(&wc.mutex)); + ASSERT(0 == uv_thread_create(&thread, worker, &wc)); + + uv_sem_wait(&wc.sem); + + ASSERT(0 == uv_thread_join(&thread)); + uv_mutex_destroy(&wc.mutex); + uv_sem_destroy(&wc.sem); + + return 0; +} + + +TEST_IMPL(semaphore_3) { + uv_sem_t sem; + + ASSERT(0 == uv_sem_init(&sem, 3)); + uv_sem_wait(&sem); /* should not block */ + uv_sem_wait(&sem); /* should not block */ + ASSERT(0 == uv_sem_trywait(&sem)); + ASSERT(UV_EAGAIN == uv_sem_trywait(&sem)); + + uv_sem_post(&sem); + ASSERT(0 == uv_sem_trywait(&sem)); + ASSERT(UV_EAGAIN == uv_sem_trywait(&sem)); + + uv_sem_destroy(&sem); + + return 0; +} diff --git a/3rdparty/libuv/test/test-shutdown-close.c b/3rdparty/libuv/test/test-shutdown-close.c new file mode 100644 index 00000000000..78c369be2d9 --- /dev/null +++ b/3rdparty/libuv/test/test-shutdown-close.c @@ -0,0 +1,108 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* + * These tests verify that the uv_shutdown callback is always made, even when + * it is immediately followed by an uv_close call. + */ + +#include "uv.h" +#include "task.h" + + +static uv_shutdown_t shutdown_req; +static uv_connect_t connect_req; + +static int connect_cb_called = 0; +static int shutdown_cb_called = 0; +static int close_cb_called = 0; + + +static void shutdown_cb(uv_shutdown_t* req, int status) { + ASSERT(req == &shutdown_req); + ASSERT(status == 0 || status == UV_ECANCELED); + shutdown_cb_called++; +} + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +static void connect_cb(uv_connect_t* req, int status) { + int r; + + ASSERT(req == &connect_req); + ASSERT(status == 0); + + r = uv_shutdown(&shutdown_req, req->handle, shutdown_cb); + ASSERT(r == 0); + ASSERT(0 == uv_is_closing((uv_handle_t*) req->handle)); + uv_close((uv_handle_t*) req->handle, close_cb); + ASSERT(1 == uv_is_closing((uv_handle_t*) req->handle)); + + connect_cb_called++; +} + + +TEST_IMPL(shutdown_close_tcp) { + struct sockaddr_in addr; + uv_tcp_t h; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + r = uv_tcp_init(uv_default_loop(), &h); + ASSERT(r == 0); + r = uv_tcp_connect(&connect_req, + &h, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(connect_cb_called == 1); + ASSERT(shutdown_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(shutdown_close_pipe) { + uv_pipe_t h; + int r; + + r = uv_pipe_init(uv_default_loop(), &h, 0); + ASSERT(r == 0); + uv_pipe_connect(&connect_req, &h, TEST_PIPENAME, connect_cb); + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(connect_cb_called == 1); + ASSERT(shutdown_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-shutdown-eof.c b/3rdparty/libuv/test/test-shutdown-eof.c new file mode 100644 index 00000000000..9f95e7561f2 --- /dev/null +++ b/3rdparty/libuv/test/test-shutdown-eof.c @@ -0,0 +1,182 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + +static uv_timer_t timer; +static uv_tcp_t tcp; +static uv_connect_t connect_req; +static uv_write_t write_req; +static uv_shutdown_t shutdown_req; +static uv_buf_t qbuf; +static int got_q; +static int got_eof; +static int called_connect_cb; +static int called_shutdown_cb; +static int called_tcp_close_cb; +static int called_timer_close_cb; +static int called_timer_cb; + + +static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + buf->base = malloc(size); + buf->len = size; +} + + +static void read_cb(uv_stream_t* t, ssize_t nread, const uv_buf_t* buf) { + ASSERT((uv_tcp_t*)t == &tcp); + + if (nread == 0) { + free(buf->base); + return; + } + + if (!got_q) { + ASSERT(nread == 1); + ASSERT(!got_eof); + ASSERT(buf->base[0] == 'Q'); + free(buf->base); + got_q = 1; + puts("got Q"); + } else { + ASSERT(nread == UV_EOF); + if (buf->base) { + free(buf->base); + } + got_eof = 1; + puts("got EOF"); + } +} + + +static void shutdown_cb(uv_shutdown_t *req, int status) { + ASSERT(req == &shutdown_req); + + ASSERT(called_connect_cb == 1); + ASSERT(!got_eof); + ASSERT(called_tcp_close_cb == 0); + ASSERT(called_timer_close_cb == 0); + ASSERT(called_timer_cb == 0); + + called_shutdown_cb++; +} + + +static void connect_cb(uv_connect_t *req, int status) { + ASSERT(status == 0); + ASSERT(req == &connect_req); + + /* Start reading from our connection so we can receive the EOF. */ + uv_read_start((uv_stream_t*)&tcp, alloc_cb, read_cb); + + /* + * Write the letter 'Q' to gracefully kill the echo-server. This will not + * effect our connection. + */ + uv_write(&write_req, (uv_stream_t*) &tcp, &qbuf, 1, NULL); + + /* Shutdown our end of the connection. */ + uv_shutdown(&shutdown_req, (uv_stream_t*) &tcp, shutdown_cb); + + called_connect_cb++; + ASSERT(called_shutdown_cb == 0); +} + + +static void tcp_close_cb(uv_handle_t* handle) { + ASSERT(handle == (uv_handle_t*) &tcp); + + ASSERT(called_connect_cb == 1); + ASSERT(got_q); + ASSERT(got_eof); + ASSERT(called_timer_cb == 1); + + called_tcp_close_cb++; +} + + +static void timer_close_cb(uv_handle_t* handle) { + ASSERT(handle == (uv_handle_t*) &timer); + called_timer_close_cb++; +} + + +static void timer_cb(uv_timer_t* handle) { + ASSERT(handle == &timer); + uv_close((uv_handle_t*) handle, timer_close_cb); + + /* + * The most important assert of the test: we have not received + * tcp_close_cb yet. + */ + ASSERT(called_tcp_close_cb == 0); + uv_close((uv_handle_t*) &tcp, tcp_close_cb); + + called_timer_cb++; +} + + +/* + * This test has a client which connects to the echo_server and immediately + * issues a shutdown. The echo-server, in response, will also shutdown their + * connection. We check, with a timer, that libuv is not automatically + * calling uv_close when the client receives the EOF from echo-server. + */ +TEST_IMPL(shutdown_eof) { + struct sockaddr_in server_addr; + int r; + + qbuf.base = "Q"; + qbuf.len = 1; + + r = uv_timer_init(uv_default_loop(), &timer); + ASSERT(r == 0); + + uv_timer_start(&timer, timer_cb, 100, 0); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &server_addr)); + r = uv_tcp_init(uv_default_loop(), &tcp); + ASSERT(!r); + + r = uv_tcp_connect(&connect_req, + &tcp, + (const struct sockaddr*) &server_addr, + connect_cb); + ASSERT(!r); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(called_connect_cb == 1); + ASSERT(called_shutdown_cb == 1); + ASSERT(got_eof); + ASSERT(got_q); + ASSERT(called_tcp_close_cb == 1); + ASSERT(called_timer_close_cb == 1); + ASSERT(called_timer_cb == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + diff --git a/3rdparty/libuv/test/test-shutdown-twice.c b/3rdparty/libuv/test/test-shutdown-twice.c new file mode 100644 index 00000000000..75c05435499 --- /dev/null +++ b/3rdparty/libuv/test/test-shutdown-twice.c @@ -0,0 +1,84 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* + * This is a regression test for issue #1113 (calling uv_shutdown twice will + * leave a ghost request in the system) + */ + +#include "uv.h" +#include "task.h" + +static uv_shutdown_t req1; +static uv_shutdown_t req2; + +static int shutdown_cb_called = 0; + +static void close_cb(uv_handle_t* handle) { + +} + +static void shutdown_cb(uv_shutdown_t* req, int status) { + ASSERT(req == &req1); + ASSERT(status == 0); + shutdown_cb_called++; + uv_close((uv_handle_t*) req->handle, close_cb); +} + +static void connect_cb(uv_connect_t* req, int status) { + int r; + + ASSERT(status == 0); + + r = uv_shutdown(&req1, req->handle, shutdown_cb); + ASSERT(r == 0); + r = uv_shutdown(&req2, req->handle, shutdown_cb); + ASSERT(r != 0); + +} + +TEST_IMPL(shutdown_twice) { + struct sockaddr_in addr; + uv_loop_t* loop; + int r; + uv_tcp_t h; + + uv_connect_t connect_req; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + loop = uv_default_loop(); + + r = uv_tcp_init(loop, &h); + + r = uv_tcp_connect(&connect_req, + &h, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(shutdown_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-signal-multiple-loops.c b/3rdparty/libuv/test/test-signal-multiple-loops.c new file mode 100644 index 00000000000..158129919bd --- /dev/null +++ b/3rdparty/libuv/test/test-signal-multiple-loops.c @@ -0,0 +1,290 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + + +/* This test does not pretend to be cross-platform. */ +#ifndef _WIN32 + +#include "uv.h" +#include "task.h" + +#include +#include +#include +#include +#include +#include +#include + +/* The value of NUM_SIGNAL_HANDLING_THREADS is not arbitrary; it needs to be a + * multiple of three for reasons that will become clear when you scroll down. + * We're basically creating three different thread groups. The total needs + * to be divisible by three in order for the numbers in the final check to + * match up. + */ +#define NUM_SIGNAL_HANDLING_THREADS 24 +#define NUM_LOOP_CREATING_THREADS 10 + +enum signal_action { + ONLY_SIGUSR1, + ONLY_SIGUSR2, + SIGUSR1_AND_SIGUSR2 +}; + +static uv_sem_t sem; +static uv_mutex_t counter_lock; +static volatile int stop = 0; + +static volatile int signal1_cb_counter = 0; +static volatile int signal2_cb_counter = 0; +static volatile int loop_creation_counter = 0; + + +static void increment_counter(volatile int* counter) { + uv_mutex_lock(&counter_lock); + ++(*counter); + uv_mutex_unlock(&counter_lock); +} + + +static void signal1_cb(uv_signal_t* handle, int signum) { + ASSERT(signum == SIGUSR1); + increment_counter(&signal1_cb_counter); + uv_signal_stop(handle); +} + + +static void signal2_cb(uv_signal_t* handle, int signum) { + ASSERT(signum == SIGUSR2); + increment_counter(&signal2_cb_counter); + uv_signal_stop(handle); +} + + +static void signal_handling_worker(void* context) { + enum signal_action action; + uv_signal_t signal1a; + uv_signal_t signal1b; + uv_signal_t signal2; + uv_loop_t loop; + int r; + + action = (enum signal_action) (uintptr_t) context; + + ASSERT(0 == uv_loop_init(&loop)); + + /* Setup the signal watchers and start them. */ + if (action == ONLY_SIGUSR1 || action == SIGUSR1_AND_SIGUSR2) { + r = uv_signal_init(&loop, &signal1a); + ASSERT(r == 0); + r = uv_signal_start(&signal1a, signal1_cb, SIGUSR1); + ASSERT(r == 0); + r = uv_signal_init(&loop, &signal1b); + ASSERT(r == 0); + r = uv_signal_start(&signal1b, signal1_cb, SIGUSR1); + ASSERT(r == 0); + } + + if (action == ONLY_SIGUSR2 || action == SIGUSR1_AND_SIGUSR2) { + r = uv_signal_init(&loop, &signal2); + ASSERT(r == 0); + r = uv_signal_start(&signal2, signal2_cb, SIGUSR2); + ASSERT(r == 0); + } + + /* Signal watchers are now set up. */ + uv_sem_post(&sem); + + /* Wait for all signals. The signal callbacks stop the watcher, so uv_run + * will return when all signal watchers caught a signal. + */ + r = uv_run(&loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + /* Restart the signal watchers. */ + if (action == ONLY_SIGUSR1 || action == SIGUSR1_AND_SIGUSR2) { + r = uv_signal_start(&signal1a, signal1_cb, SIGUSR1); + ASSERT(r == 0); + r = uv_signal_start(&signal1b, signal1_cb, SIGUSR1); + ASSERT(r == 0); + } + + if (action == ONLY_SIGUSR2 || action == SIGUSR1_AND_SIGUSR2) { + r = uv_signal_start(&signal2, signal2_cb, SIGUSR2); + ASSERT(r == 0); + } + + /* Wait for signals once more. */ + uv_sem_post(&sem); + + r = uv_run(&loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + /* Close the watchers. */ + if (action == ONLY_SIGUSR1 || action == SIGUSR1_AND_SIGUSR2) { + uv_close((uv_handle_t*) &signal1a, NULL); + uv_close((uv_handle_t*) &signal1b, NULL); + } + + if (action == ONLY_SIGUSR2 || action == SIGUSR1_AND_SIGUSR2) { + uv_close((uv_handle_t*) &signal2, NULL); + } + + /* Wait for the signal watchers to close. */ + r = uv_run(&loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + uv_loop_close(&loop); +} + + +static void signal_unexpected_cb(uv_signal_t* handle, int signum) { + ASSERT(0 && "signal_unexpected_cb should never be called"); +} + + +static void loop_creating_worker(void* context) { + (void) context; + + do { + uv_loop_t *loop; + uv_signal_t signal; + int r; + + loop = malloc(sizeof(*loop)); + ASSERT(loop != NULL); + ASSERT(0 == uv_loop_init(loop)); + + r = uv_signal_init(loop, &signal); + ASSERT(r == 0); + + r = uv_signal_start(&signal, signal_unexpected_cb, SIGTERM); + ASSERT(r == 0); + + uv_close((uv_handle_t*) &signal, NULL); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + uv_loop_close(loop); + free(loop); + + increment_counter(&loop_creation_counter); + } while (!stop); +} + + +TEST_IMPL(signal_multiple_loops) { + uv_thread_t loop_creating_threads[NUM_LOOP_CREATING_THREADS]; + uv_thread_t signal_handling_threads[NUM_SIGNAL_HANDLING_THREADS]; + enum signal_action action; + sigset_t sigset; + int i; + int r; + + r = uv_sem_init(&sem, 0); + ASSERT(r == 0); + + r = uv_mutex_init(&counter_lock); + ASSERT(r == 0); + + /* Create a couple of threads that create a destroy loops continuously. */ + for (i = 0; i < NUM_LOOP_CREATING_THREADS; i++) { + r = uv_thread_create(&loop_creating_threads[i], + loop_creating_worker, + NULL); + ASSERT(r == 0); + } + + /* Create a couple of threads that actually handle signals. */ + for (i = 0; i < NUM_SIGNAL_HANDLING_THREADS; i++) { + switch (i % 3) { + case 0: action = ONLY_SIGUSR1; break; + case 1: action = ONLY_SIGUSR2; break; + case 2: action = SIGUSR1_AND_SIGUSR2; break; + } + + r = uv_thread_create(&signal_handling_threads[i], + signal_handling_worker, + (void*) (uintptr_t) action); + ASSERT(r == 0); + } + + /* Wait until all threads have started and set up their signal watchers. */ + for (i = 0; i < NUM_SIGNAL_HANDLING_THREADS; i++) + uv_sem_wait(&sem); + + r = kill(getpid(), SIGUSR1); + ASSERT(r == 0); + r = kill(getpid(), SIGUSR2); + ASSERT(r == 0); + + /* Wait for all threads to handle these signals. */ + for (i = 0; i < NUM_SIGNAL_HANDLING_THREADS; i++) + uv_sem_wait(&sem); + + /* Block all signals to this thread, so we are sure that from here the signal + * handler runs in another thread. This is is more likely to catch thread and + * signal safety issues if there are any. + */ + sigfillset(&sigset); + pthread_sigmask(SIG_SETMASK, &sigset, NULL); + + r = kill(getpid(), SIGUSR1); + ASSERT(r == 0); + r = kill(getpid(), SIGUSR2); + ASSERT(r == 0); + + /* Wait for all signal handling threads to exit. */ + for (i = 0; i < NUM_SIGNAL_HANDLING_THREADS; i++) { + r = uv_thread_join(&signal_handling_threads[i]); + ASSERT(r == 0); + } + + /* Tell all loop creating threads to stop. */ + stop = 1; + + /* Wait for all loop creating threads to exit. */ + for (i = 0; i < NUM_LOOP_CREATING_THREADS; i++) { + r = uv_thread_join(&loop_creating_threads[i]); + ASSERT(r == 0); + } + + printf("signal1_cb calls: %d\n", signal1_cb_counter); + printf("signal2_cb calls: %d\n", signal2_cb_counter); + printf("loops created and destroyed: %d\n", loop_creation_counter); + + /* The division by three reflects the fact that we spawn three different + * thread groups of (NUM_SIGNAL_HANDLING_THREADS / 3) threads each. + */ + ASSERT(signal1_cb_counter == 8 * (NUM_SIGNAL_HANDLING_THREADS / 3)); + ASSERT(signal2_cb_counter == 4 * (NUM_SIGNAL_HANDLING_THREADS / 3)); + + /* We don't know exactly how much loops will be created and destroyed, but at + * least there should be 1 for every loop creating thread. + */ + ASSERT(loop_creation_counter >= NUM_LOOP_CREATING_THREADS); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* !_WIN32 */ diff --git a/3rdparty/libuv/test/test-signal.c b/3rdparty/libuv/test/test-signal.c new file mode 100644 index 00000000000..fcdd8e4d2dd --- /dev/null +++ b/3rdparty/libuv/test/test-signal.c @@ -0,0 +1,152 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + + +/* This test does not pretend to be cross-platform. */ +#ifndef _WIN32 + +#include "uv.h" +#include "task.h" + +#include +#include +#include +#include +#include +#include +#include + +#define NSIGNALS 10 + +struct timer_ctx { + unsigned int ncalls; + uv_timer_t handle; + int signum; +}; + +struct signal_ctx { + enum { CLOSE, STOP } stop_or_close; + unsigned int ncalls; + uv_signal_t handle; + int signum; +}; + + +static void signal_cb(uv_signal_t* handle, int signum) { + struct signal_ctx* ctx = container_of(handle, struct signal_ctx, handle); + ASSERT(signum == ctx->signum); + + if (++ctx->ncalls == NSIGNALS) { + if (ctx->stop_or_close == STOP) + uv_signal_stop(handle); + else if (ctx->stop_or_close == CLOSE) + uv_close((uv_handle_t*)handle, NULL); + else + ASSERT(0); + } +} + + +static void timer_cb(uv_timer_t* handle) { + struct timer_ctx* ctx = container_of(handle, struct timer_ctx, handle); + + raise(ctx->signum); + + if (++ctx->ncalls == NSIGNALS) + uv_close((uv_handle_t*)handle, NULL); +} + + +static void start_watcher(uv_loop_t* loop, int signum, struct signal_ctx* ctx) { + ctx->ncalls = 0; + ctx->signum = signum; + ctx->stop_or_close = CLOSE; + ASSERT(0 == uv_signal_init(loop, &ctx->handle)); + ASSERT(0 == uv_signal_start(&ctx->handle, signal_cb, signum)); +} + + +static void start_timer(uv_loop_t* loop, int signum, struct timer_ctx* ctx) { + ctx->ncalls = 0; + ctx->signum = signum; + ASSERT(0 == uv_timer_init(loop, &ctx->handle)); + ASSERT(0 == uv_timer_start(&ctx->handle, timer_cb, 5, 5)); +} + + +TEST_IMPL(we_get_signal) { + struct signal_ctx sc; + struct timer_ctx tc; + uv_loop_t* loop; + + loop = uv_default_loop(); + start_timer(loop, SIGCHLD, &tc); + start_watcher(loop, SIGCHLD, &sc); + sc.stop_or_close = STOP; /* stop, don't close the signal handle */ + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(tc.ncalls == NSIGNALS); + ASSERT(sc.ncalls == NSIGNALS); + + start_timer(loop, SIGCHLD, &tc); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(tc.ncalls == NSIGNALS); + ASSERT(sc.ncalls == NSIGNALS); + + sc.ncalls = 0; + sc.stop_or_close = CLOSE; /* now close it when it's done */ + uv_signal_start(&sc.handle, signal_cb, SIGCHLD); + + start_timer(loop, SIGCHLD, &tc); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(tc.ncalls == NSIGNALS); + ASSERT(sc.ncalls == NSIGNALS); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(we_get_signals) { + struct signal_ctx sc[4]; + struct timer_ctx tc[2]; + uv_loop_t* loop; + unsigned int i; + + loop = uv_default_loop(); + start_watcher(loop, SIGUSR1, sc + 0); + start_watcher(loop, SIGUSR1, sc + 1); + start_watcher(loop, SIGUSR2, sc + 2); + start_watcher(loop, SIGUSR2, sc + 3); + start_timer(loop, SIGUSR1, tc + 0); + start_timer(loop, SIGUSR2, tc + 1); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + for (i = 0; i < ARRAY_SIZE(sc); i++) + ASSERT(sc[i].ncalls == NSIGNALS); + + for (i = 0; i < ARRAY_SIZE(tc); i++) + ASSERT(tc[i].ncalls == NSIGNALS); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* _WIN32 */ diff --git a/3rdparty/libuv/test/test-socket-buffer-size.c b/3rdparty/libuv/test/test-socket-buffer-size.c new file mode 100644 index 00000000000..72f8c2524c0 --- /dev/null +++ b/3rdparty/libuv/test/test-socket-buffer-size.c @@ -0,0 +1,77 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +static uv_udp_t udp; +static uv_tcp_t tcp; +static int close_cb_called; + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +static void check_buffer_size(uv_handle_t* handle) { + int value; + + value = 0; + ASSERT(0 == uv_recv_buffer_size(handle, &value)); + ASSERT(value > 0); + + value = 10000; + ASSERT(0 == uv_recv_buffer_size(handle, &value)); + + value = 0; + ASSERT(0 == uv_recv_buffer_size(handle, &value)); + /* linux sets double the value */ + ASSERT(value == 10000 || value == 20000); +} + + +TEST_IMPL(socket_buffer_size) { + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + ASSERT(0 == uv_tcp_init(uv_default_loop(), &tcp)); + ASSERT(0 == uv_tcp_bind(&tcp, (struct sockaddr*) &addr, 0)); + check_buffer_size((uv_handle_t*) &tcp); + uv_close((uv_handle_t*) &tcp, close_cb); + + ASSERT(0 == uv_udp_init(uv_default_loop(), &udp)); + ASSERT(0 == uv_udp_bind(&udp, (struct sockaddr*) &addr, 0)); + check_buffer_size((uv_handle_t*) &udp); + uv_close((uv_handle_t*) &udp, close_cb); + + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-spawn.c b/3rdparty/libuv/test/test-spawn.c new file mode 100644 index 00000000000..eba54ae7054 --- /dev/null +++ b/3rdparty/libuv/test/test-spawn.c @@ -0,0 +1,1706 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include +#include +#include +#include + +#ifdef _WIN32 +# if defined(__MINGW32__) +# include +# endif +# include +# include +#else +# include +# include +#endif + + +static int close_cb_called; +static int exit_cb_called; +static uv_process_t process; +static uv_timer_t timer; +static uv_process_options_t options; +static char exepath[1024]; +static size_t exepath_size = 1024; +static char* args[3]; +static int no_term_signal; +static int timer_counter; + +#define OUTPUT_SIZE 1024 +static char output[OUTPUT_SIZE]; +static int output_used; + + +static void close_cb(uv_handle_t* handle) { + printf("close_cb\n"); + close_cb_called++; +} + +static void exit_cb(uv_process_t* process, + int64_t exit_status, + int term_signal) { + printf("exit_cb\n"); + exit_cb_called++; + ASSERT(exit_status == 1); + ASSERT(term_signal == 0); + uv_close((uv_handle_t*)process, close_cb); +} + + +static void fail_cb(uv_process_t* process, + int64_t exit_status, + int term_signal) { + ASSERT(0 && "fail_cb called"); +} + + +static void kill_cb(uv_process_t* process, + int64_t exit_status, + int term_signal) { + int err; + + printf("exit_cb\n"); + exit_cb_called++; +#ifdef _WIN32 + ASSERT(exit_status == 1); +#else + ASSERT(exit_status == 0); +#endif + ASSERT(no_term_signal || term_signal == 15); + uv_close((uv_handle_t*)process, close_cb); + + /* + * Sending signum == 0 should check if the + * child process is still alive, not kill it. + * This process should be dead. + */ + err = uv_kill(process->pid, 0); + ASSERT(err == UV_ESRCH); +} + +static void detach_failure_cb(uv_process_t* process, + int64_t exit_status, + int term_signal) { + printf("detach_cb\n"); + exit_cb_called++; +} + +static void on_alloc(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + buf->base = output + output_used; + buf->len = OUTPUT_SIZE - output_used; +} + + +static void on_read(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { + if (nread > 0) { + output_used += nread; + } else if (nread < 0) { + ASSERT(nread == UV_EOF); + uv_close((uv_handle_t*)tcp, close_cb); + } +} + + +static void on_read_once(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { + uv_read_stop(tcp); + on_read(tcp, nread, buf); +} + + +static void write_cb(uv_write_t* req, int status) { + ASSERT(status == 0); + uv_close((uv_handle_t*)req->handle, close_cb); +} + + +static void init_process_options(char* test, uv_exit_cb exit_cb) { + /* Note spawn_helper1 defined in test/run-tests.c */ + int r = uv_exepath(exepath, &exepath_size); + ASSERT(r == 0); + exepath[exepath_size] = '\0'; + args[0] = exepath; + args[1] = test; + args[2] = NULL; + options.file = exepath; + options.args = args; + options.exit_cb = exit_cb; + options.flags = 0; +} + + +static void timer_cb(uv_timer_t* handle) { + uv_process_kill(&process, /* SIGTERM */ 15); + uv_close((uv_handle_t*)handle, close_cb); +} + + +static void timer_counter_cb(uv_timer_t* handle) { + ++timer_counter; +} + + +TEST_IMPL(spawn_fails) { + int r; + + init_process_options("", fail_cb); + options.file = options.args[0] = "program-that-had-better-not-exist"; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == UV_ENOENT || r == UV_EACCES); + ASSERT(0 == uv_is_active((uv_handle_t*) &process)); + uv_close((uv_handle_t*) &process, NULL); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +#ifndef _WIN32 +TEST_IMPL(spawn_fails_check_for_waitpid_cleanup) { + int r; + int status; + int err; + + init_process_options("", fail_cb); + options.file = options.args[0] = "program-that-had-better-not-exist"; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == UV_ENOENT || r == UV_EACCES); + ASSERT(0 == uv_is_active((uv_handle_t*) &process)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + /* verify the child is successfully cleaned up within libuv */ + do + err = waitpid(process.pid, &status, 0); + while (err == -1 && errno == EINTR); + + ASSERT(err == -1); + ASSERT(errno == ECHILD); + + uv_close((uv_handle_t*) &process, NULL); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif + + +TEST_IMPL(spawn_exit_code) { + int r; + + init_process_options("spawn_helper1", exit_cb); + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_stdout) { + int r; + uv_pipe_t out; + uv_stdio_container_t stdio[2]; + + init_process_options("spawn_helper2", exit_cb); + + uv_pipe_init(uv_default_loop(), &out, 0); + options.stdio = stdio; + options.stdio[0].flags = UV_IGNORE; + options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio_count = 2; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*) &out, on_alloc, on_read); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 2); /* Once for process once for the pipe. */ + printf("output is: %s", output); + ASSERT(strcmp("hello world\n", output) == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_stdout_to_file) { + int r; + uv_file file; + uv_fs_t fs_req; + uv_stdio_container_t stdio[2]; + uv_buf_t buf; + + /* Setup. */ + unlink("stdout_file"); + + init_process_options("spawn_helper2", exit_cb); + + r = uv_fs_open(NULL, &fs_req, "stdout_file", O_CREAT | O_RDWR, + S_IRUSR | S_IWUSR, NULL); + ASSERT(r != -1); + uv_fs_req_cleanup(&fs_req); + + file = r; + + options.stdio = stdio; + options.stdio[0].flags = UV_IGNORE; + options.stdio[1].flags = UV_INHERIT_FD; + options.stdio[1].data.fd = file; + options.stdio_count = 2; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 1); + + buf = uv_buf_init(output, sizeof(output)); + r = uv_fs_read(NULL, &fs_req, file, &buf, 1, 0, NULL); + ASSERT(r == 12); + uv_fs_req_cleanup(&fs_req); + + r = uv_fs_close(NULL, &fs_req, file, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&fs_req); + + printf("output is: %s", output); + ASSERT(strcmp("hello world\n", output) == 0); + + /* Cleanup. */ + unlink("stdout_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_stdout_and_stderr_to_file) { + int r; + uv_file file; + uv_fs_t fs_req; + uv_stdio_container_t stdio[3]; + uv_buf_t buf; + + /* Setup. */ + unlink("stdout_file"); + + init_process_options("spawn_helper6", exit_cb); + + r = uv_fs_open(NULL, &fs_req, "stdout_file", O_CREAT | O_RDWR, + S_IRUSR | S_IWUSR, NULL); + ASSERT(r != -1); + uv_fs_req_cleanup(&fs_req); + + file = r; + + options.stdio = stdio; + options.stdio[0].flags = UV_IGNORE; + options.stdio[1].flags = UV_INHERIT_FD; + options.stdio[1].data.fd = file; + options.stdio[2].flags = UV_INHERIT_FD; + options.stdio[2].data.fd = file; + options.stdio_count = 3; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 1); + + buf = uv_buf_init(output, sizeof(output)); + r = uv_fs_read(NULL, &fs_req, file, &buf, 1, 0, NULL); + ASSERT(r == 27); + uv_fs_req_cleanup(&fs_req); + + r = uv_fs_close(NULL, &fs_req, file, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&fs_req); + + printf("output is: %s", output); + ASSERT(strcmp("hello world\nhello errworld\n", output) == 0); + + /* Cleanup. */ + unlink("stdout_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_stdout_and_stderr_to_file2) { +#ifndef _WIN32 + int r; + uv_file file; + uv_fs_t fs_req; + uv_stdio_container_t stdio[3]; + uv_buf_t buf; + + /* Setup. */ + unlink("stdout_file"); + + init_process_options("spawn_helper6", exit_cb); + + /* Replace stderr with our file */ + r = uv_fs_open(NULL, + &fs_req, + "stdout_file", + O_CREAT | O_RDWR, + S_IRUSR | S_IWUSR, + NULL); + ASSERT(r != -1); + uv_fs_req_cleanup(&fs_req); + file = dup2(r, STDERR_FILENO); + ASSERT(file != -1); + + options.stdio = stdio; + options.stdio[0].flags = UV_IGNORE; + options.stdio[1].flags = UV_INHERIT_FD; + options.stdio[1].data.fd = file; + options.stdio[2].flags = UV_INHERIT_FD; + options.stdio[2].data.fd = file; + options.stdio_count = 3; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 1); + + buf = uv_buf_init(output, sizeof(output)); + r = uv_fs_read(NULL, &fs_req, file, &buf, 1, 0, NULL); + ASSERT(r == 27); + uv_fs_req_cleanup(&fs_req); + + r = uv_fs_close(NULL, &fs_req, file, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&fs_req); + + printf("output is: %s", output); + ASSERT(strcmp("hello world\nhello errworld\n", output) == 0); + + /* Cleanup. */ + unlink("stdout_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +#else + RETURN_SKIP("Unix only test"); +#endif +} + + +TEST_IMPL(spawn_stdout_and_stderr_to_file_swap) { +#ifndef _WIN32 + int r; + uv_file stdout_file; + uv_file stderr_file; + uv_fs_t fs_req; + uv_stdio_container_t stdio[3]; + uv_buf_t buf; + + /* Setup. */ + unlink("stdout_file"); + unlink("stderr_file"); + + init_process_options("spawn_helper6", exit_cb); + + /* open 'stdout_file' and replace STDOUT_FILENO with it */ + r = uv_fs_open(NULL, + &fs_req, + "stdout_file", + O_CREAT | O_RDWR, + S_IRUSR | S_IWUSR, + NULL); + ASSERT(r != -1); + uv_fs_req_cleanup(&fs_req); + stdout_file = dup2(r, STDOUT_FILENO); + ASSERT(stdout_file != -1); + + /* open 'stderr_file' and replace STDERR_FILENO with it */ + r = uv_fs_open(NULL, &fs_req, "stderr_file", O_CREAT | O_RDWR, + S_IRUSR | S_IWUSR, NULL); + ASSERT(r != -1); + uv_fs_req_cleanup(&fs_req); + stderr_file = dup2(r, STDERR_FILENO); + ASSERT(stderr_file != -1); + + /* now we're going to swap them: the child process' stdout will be our + * stderr_file and vice versa */ + options.stdio = stdio; + options.stdio[0].flags = UV_IGNORE; + options.stdio[1].flags = UV_INHERIT_FD; + options.stdio[1].data.fd = stderr_file; + options.stdio[2].flags = UV_INHERIT_FD; + options.stdio[2].data.fd = stdout_file; + options.stdio_count = 3; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 1); + + buf = uv_buf_init(output, sizeof(output)); + + /* check the content of stdout_file */ + r = uv_fs_read(NULL, &fs_req, stdout_file, &buf, 1, 0, NULL); + ASSERT(r >= 15); + uv_fs_req_cleanup(&fs_req); + + r = uv_fs_close(NULL, &fs_req, stdout_file, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&fs_req); + + printf("output is: %s", output); + ASSERT(strncmp("hello errworld\n", output, 15) == 0); + + /* check the content of stderr_file */ + r = uv_fs_read(NULL, &fs_req, stderr_file, &buf, 1, 0, NULL); + ASSERT(r >= 12); + uv_fs_req_cleanup(&fs_req); + + r = uv_fs_close(NULL, &fs_req, stderr_file, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&fs_req); + + printf("output is: %s", output); + ASSERT(strncmp("hello world\n", output, 12) == 0); + + /* Cleanup. */ + unlink("stdout_file"); + unlink("stderr_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +#else + RETURN_SKIP("Unix only test"); +#endif +} + + +TEST_IMPL(spawn_stdin) { + int r; + uv_pipe_t out; + uv_pipe_t in; + uv_write_t write_req; + uv_buf_t buf; + uv_stdio_container_t stdio[2]; + char buffer[] = "hello-from-spawn_stdin"; + + init_process_options("spawn_helper3", exit_cb); + + uv_pipe_init(uv_default_loop(), &out, 0); + uv_pipe_init(uv_default_loop(), &in, 0); + options.stdio = stdio; + options.stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; + options.stdio[0].data.stream = (uv_stream_t*)∈ + options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio_count = 2; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + buf.base = buffer; + buf.len = sizeof(buffer); + r = uv_write(&write_req, (uv_stream_t*)&in, &buf, 1, write_cb); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*) &out, on_alloc, on_read); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 3); /* Once for process twice for the pipe. */ + ASSERT(strcmp(buffer, output) == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_stdio_greater_than_3) { + int r; + uv_pipe_t pipe; + uv_stdio_container_t stdio[4]; + + init_process_options("spawn_helper5", exit_cb); + + uv_pipe_init(uv_default_loop(), &pipe, 0); + options.stdio = stdio; + options.stdio[0].flags = UV_IGNORE; + options.stdio[1].flags = UV_IGNORE; + options.stdio[2].flags = UV_IGNORE; + options.stdio[3].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + options.stdio[3].data.stream = (uv_stream_t*)&pipe; + options.stdio_count = 4; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*) &pipe, on_alloc, on_read); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 2); /* Once for process once for the pipe. */ + printf("output from stdio[3] is: %s", output); + ASSERT(strcmp("fourth stdio!\n", output) == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_ignored_stdio) { + int r; + + init_process_options("spawn_helper6", exit_cb); + + options.stdio = NULL; + options.stdio_count = 0; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_and_kill) { + int r; + + init_process_options("spawn_helper4", kill_cb); + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_timer_init(uv_default_loop(), &timer); + ASSERT(r == 0); + + r = uv_timer_start(&timer, timer_cb, 500, 0); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 2); /* Once for process and once for timer. */ + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_preserve_env) { + int r; + uv_pipe_t out; + uv_stdio_container_t stdio[2]; + + init_process_options("spawn_helper7", exit_cb); + + uv_pipe_init(uv_default_loop(), &out, 0); + options.stdio = stdio; + options.stdio[0].flags = UV_IGNORE; + options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + options.stdio[1].data.stream = (uv_stream_t*) &out; + options.stdio_count = 2; + + r = putenv("ENV_TEST=testval"); + ASSERT(r == 0); + + /* Explicitly set options.env to NULL to test for env clobbering. */ + options.env = NULL; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*) &out, on_alloc, on_read); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 2); + + printf("output is: %s", output); + ASSERT(strcmp("testval", output) == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_detached) { + int r; + + init_process_options("spawn_helper4", detach_failure_cb); + + options.flags |= UV_PROCESS_DETACHED; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + uv_unref((uv_handle_t*)&process); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 0); + + r = uv_kill(process.pid, 0); + ASSERT(r == 0); + + r = uv_kill(process.pid, 15); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +TEST_IMPL(spawn_and_kill_with_std) { + int r; + uv_pipe_t in, out, err; + uv_write_t write; + char message[] = "Nancy's joining me because the message this evening is " + "not my message but ours."; + uv_buf_t buf; + uv_stdio_container_t stdio[3]; + + init_process_options("spawn_helper4", kill_cb); + + r = uv_pipe_init(uv_default_loop(), &in, 0); + ASSERT(r == 0); + + r = uv_pipe_init(uv_default_loop(), &out, 0); + ASSERT(r == 0); + + r = uv_pipe_init(uv_default_loop(), &err, 0); + ASSERT(r == 0); + + options.stdio = stdio; + options.stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; + options.stdio[0].data.stream = (uv_stream_t*)∈ + options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio[2].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + options.stdio[2].data.stream = (uv_stream_t*)&err; + options.stdio_count = 3; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + buf = uv_buf_init(message, sizeof message); + r = uv_write(&write, (uv_stream_t*) &in, &buf, 1, write_cb); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*) &out, on_alloc, on_read); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*) &err, on_alloc, on_read); + ASSERT(r == 0); + + r = uv_timer_init(uv_default_loop(), &timer); + ASSERT(r == 0); + + r = uv_timer_start(&timer, timer_cb, 500, 0); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 5); /* process x 1, timer x 1, stdio x 3. */ + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_and_ping) { + uv_write_t write_req; + uv_pipe_t in, out; + uv_buf_t buf; + uv_stdio_container_t stdio[2]; + int r; + + init_process_options("spawn_helper3", exit_cb); + buf = uv_buf_init("TEST", 4); + + uv_pipe_init(uv_default_loop(), &out, 0); + uv_pipe_init(uv_default_loop(), &in, 0); + options.stdio = stdio; + options.stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; + options.stdio[0].data.stream = (uv_stream_t*)∈ + options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio_count = 2; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + /* Sending signum == 0 should check if the + * child process is still alive, not kill it. + */ + r = uv_process_kill(&process, 0); + ASSERT(r == 0); + + r = uv_write(&write_req, (uv_stream_t*)&in, &buf, 1, write_cb); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*)&out, on_alloc, on_read); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(strcmp(output, "TEST") == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_same_stdout_stderr) { + uv_write_t write_req; + uv_pipe_t in, out; + uv_buf_t buf; + uv_stdio_container_t stdio[3]; + int r; + + init_process_options("spawn_helper3", exit_cb); + buf = uv_buf_init("TEST", 4); + + uv_pipe_init(uv_default_loop(), &out, 0); + uv_pipe_init(uv_default_loop(), &in, 0); + options.stdio = stdio; + options.stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; + options.stdio[0].data.stream = (uv_stream_t*)∈ + options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio_count = 2; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + /* Sending signum == 0 should check if the + * child process is still alive, not kill it. + */ + r = uv_process_kill(&process, 0); + ASSERT(r == 0); + + r = uv_write(&write_req, (uv_stream_t*)&in, &buf, 1, write_cb); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*)&out, on_alloc, on_read); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(strcmp(output, "TEST") == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_closed_process_io) { + uv_pipe_t in; + uv_write_t write_req; + uv_buf_t buf; + uv_stdio_container_t stdio[2]; + static char buffer[] = "hello-from-spawn_stdin\n"; + + init_process_options("spawn_helper3", exit_cb); + + uv_pipe_init(uv_default_loop(), &in, 0); + options.stdio = stdio; + options.stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; + options.stdio[0].data.stream = (uv_stream_t*) ∈ + options.stdio_count = 1; + + close(0); /* Close process stdin. */ + + ASSERT(0 == uv_spawn(uv_default_loop(), &process, &options)); + + buf = uv_buf_init(buffer, sizeof(buffer)); + ASSERT(0 == uv_write(&write_req, (uv_stream_t*) &in, &buf, 1, write_cb)); + + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 2); /* process, child stdin */ + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(kill) { + int r; + +#ifdef _WIN32 + no_term_signal = 1; +#endif + + init_process_options("spawn_helper4", kill_cb); + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + /* Sending signum == 0 should check if the + * child process is still alive, not kill it. + */ + r = uv_kill(process.pid, 0); + ASSERT(r == 0); + + /* Kill the process. */ + r = uv_kill(process.pid, /* SIGTERM */ 15); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +#ifdef _WIN32 +TEST_IMPL(spawn_detect_pipe_name_collisions_on_windows) { + int r; + uv_pipe_t out; + char name[64]; + HANDLE pipe_handle; + uv_stdio_container_t stdio[2]; + + init_process_options("spawn_helper2", exit_cb); + + uv_pipe_init(uv_default_loop(), &out, 0); + options.stdio = stdio; + options.stdio[0].flags = UV_IGNORE; + options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio_count = 2; + + /* Create a pipe that'll cause a collision. */ + snprintf(name, + sizeof(name), + "\\\\.\\pipe\\uv\\%p-%d", + &out, + GetCurrentProcessId()); + pipe_handle = CreateNamedPipeA(name, + PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, + PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, + 10, + 65536, + 65536, + 0, + NULL); + ASSERT(pipe_handle != INVALID_HANDLE_VALUE); + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*) &out, on_alloc, on_read); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 2); /* Once for process once for the pipe. */ + printf("output is: %s", output); + ASSERT(strcmp("hello world\n", output) == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +#if !defined(USING_UV_SHARED) +int make_program_args(char** args, int verbatim_arguments, WCHAR** dst_ptr); +WCHAR* quote_cmd_arg(const WCHAR *source, WCHAR *target); + +TEST_IMPL(argument_escaping) { + const WCHAR* test_str[] = { + L"", + L"HelloWorld", + L"Hello World", + L"Hello\"World", + L"Hello World\\", + L"Hello\\\"World", + L"Hello\\World", + L"Hello\\\\World", + L"Hello World\\", + L"c:\\path\\to\\node.exe --eval \"require('c:\\\\path\\\\to\\\\test.js')\"" + }; + const int count = sizeof(test_str) / sizeof(*test_str); + WCHAR** test_output; + WCHAR* command_line; + WCHAR** cracked; + size_t total_size = 0; + int i; + int num_args; + int result; + + char* verbatim[] = { + "cmd.exe", + "/c", + "c:\\path\\to\\node.exe --eval \"require('c:\\\\path\\\\to\\\\test.js')\"", + NULL + }; + WCHAR* verbatim_output; + WCHAR* non_verbatim_output; + + test_output = calloc(count, sizeof(WCHAR*)); + ASSERT(test_output != NULL); + for (i = 0; i < count; ++i) { + test_output[i] = calloc(2 * (wcslen(test_str[i]) + 2), sizeof(WCHAR)); + quote_cmd_arg(test_str[i], test_output[i]); + wprintf(L"input : %s\n", test_str[i]); + wprintf(L"output: %s\n", test_output[i]); + total_size += wcslen(test_output[i]) + 1; + } + command_line = calloc(total_size + 1, sizeof(WCHAR)); + ASSERT(command_line != NULL); + for (i = 0; i < count; ++i) { + wcscat(command_line, test_output[i]); + wcscat(command_line, L" "); + } + command_line[total_size - 1] = L'\0'; + + wprintf(L"command_line: %s\n", command_line); + + cracked = CommandLineToArgvW(command_line, &num_args); + for (i = 0; i < num_args; ++i) { + wprintf(L"%d: %s\t%s\n", i, test_str[i], cracked[i]); + ASSERT(wcscmp(test_str[i], cracked[i]) == 0); + } + + LocalFree(cracked); + for (i = 0; i < count; ++i) { + free(test_output[i]); + } + + result = make_program_args(verbatim, 1, &verbatim_output); + ASSERT(result == 0); + result = make_program_args(verbatim, 0, &non_verbatim_output); + ASSERT(result == 0); + + wprintf(L" verbatim_output: %s\n", verbatim_output); + wprintf(L"non_verbatim_output: %s\n", non_verbatim_output); + + ASSERT(wcscmp(verbatim_output, + L"cmd.exe /c c:\\path\\to\\node.exe --eval " + L"\"require('c:\\\\path\\\\to\\\\test.js')\"") == 0); + ASSERT(wcscmp(non_verbatim_output, + L"cmd.exe /c \"c:\\path\\to\\node.exe --eval " + L"\\\"require('c:\\\\path\\\\to\\\\test.js')\\\"\"") == 0); + + free(verbatim_output); + free(non_verbatim_output); + + return 0; +} + +int make_program_env(char** env_block, WCHAR** dst_ptr); + +TEST_IMPL(environment_creation) { + int i; + char* environment[] = { + "FOO=BAR", + "SYSTEM=ROOT", /* substring of a supplied var name */ + "SYSTEMROOTED=OMG", /* supplied var name is a substring */ + "TEMP=C:\\Temp", + "INVALID", + "BAZ=QUX", + "B_Z=QUX", + "B\xe2\x82\xacZ=QUX", + "B\xf0\x90\x80\x82Z=QUX", + "B\xef\xbd\xa1Z=QUX", + "B\xf0\xa3\x91\x96Z=QUX", + "BAZ", /* repeat, invalid variable */ + NULL + }; + WCHAR* wenvironment[] = { + L"BAZ=QUX", + L"B_Z=QUX", + L"B\x20acZ=QUX", + L"B\xd800\xdc02Z=QUX", + L"B\xd84d\xdc56Z=QUX", + L"B\xff61Z=QUX", + L"FOO=BAR", + L"SYSTEM=ROOT", /* substring of a supplied var name */ + L"SYSTEMROOTED=OMG", /* supplied var name is a substring */ + L"TEMP=C:\\Temp", + }; + WCHAR* from_env[] = { + /* list should be kept in sync with list + * in process.c, minus variables in wenvironment */ + L"HOMEDRIVE", + L"HOMEPATH", + L"LOGONSERVER", + L"PATH", + L"USERDOMAIN", + L"USERNAME", + L"USERPROFILE", + L"SYSTEMDRIVE", + L"SYSTEMROOT", + L"WINDIR", + /* test for behavior in the absence of a + * required-environment variable: */ + L"ZTHIS_ENV_VARIABLE_DOES_NOT_EXIST", + }; + int found_in_loc_env[ARRAY_SIZE(wenvironment)] = {0}; + int found_in_usr_env[ARRAY_SIZE(from_env)] = {0}; + WCHAR *expected[ARRAY_SIZE(from_env)]; + int result; + WCHAR* str; + WCHAR* prev; + WCHAR* env; + + for (i = 0; i < ARRAY_SIZE(from_env); i++) { + /* copy expected additions to environment locally */ + size_t len = GetEnvironmentVariableW(from_env[i], NULL, 0); + if (len == 0) { + found_in_usr_env[i] = 1; + str = malloc(1 * sizeof(WCHAR)); + *str = 0; + expected[i] = str; + } else { + size_t name_len = wcslen(from_env[i]); + str = malloc((name_len+1+len) * sizeof(WCHAR)); + wmemcpy(str, from_env[i], name_len); + expected[i] = str; + str += name_len; + *str++ = L'='; + GetEnvironmentVariableW(from_env[i], str, len); + } + } + + result = make_program_env(environment, &env); + ASSERT(result == 0); + + for (str = env, prev = NULL; *str; prev = str, str += wcslen(str) + 1) { + int found = 0; +#if 0 + _cputws(str); + putchar('\n'); +#endif + for (i = 0; i < ARRAY_SIZE(wenvironment) && !found; i++) { + if (!wcscmp(str, wenvironment[i])) { + ASSERT(!found_in_loc_env[i]); + found_in_loc_env[i] = 1; + found = 1; + } + } + for (i = 0; i < ARRAY_SIZE(expected) && !found; i++) { + if (!wcscmp(str, expected[i])) { + ASSERT(!found_in_usr_env[i]); + found_in_usr_env[i] = 1; + found = 1; + } + } + if (prev) { /* verify sort order -- requires Vista */ +#if _WIN32_WINNT >= 0x0600 && \ + (!defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)) + ASSERT(CompareStringOrdinal(prev, -1, str, -1, TRUE) == 1); +#endif + } + ASSERT(found); /* verify that we expected this variable */ + } + + /* verify that we found all expected variables */ + for (i = 0; i < ARRAY_SIZE(wenvironment); i++) { + ASSERT(found_in_loc_env[i]); + } + for (i = 0; i < ARRAY_SIZE(expected); i++) { + ASSERT(found_in_usr_env[i]); + } + + return 0; +} +#endif + +/* Regression test for issue #909 */ +TEST_IMPL(spawn_with_an_odd_path) { + int r; + + char newpath[2048]; + char *path = getenv("PATH"); + ASSERT(path != NULL); + snprintf(newpath, 2048, ";.;%s", path); + SetEnvironmentVariable("PATH", newpath); + + init_process_options("", exit_cb); + options.file = options.args[0] = "program-that-had-better-not-exist"; + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == UV_ENOENT || r == UV_EACCES); + ASSERT(0 == uv_is_active((uv_handle_t*) &process)); + uv_close((uv_handle_t*) &process, NULL); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif + +#ifndef _WIN32 +TEST_IMPL(spawn_setuid_setgid) { + int r; + struct passwd* pw; + + /* if not root, then this will fail. */ + uv_uid_t uid = getuid(); + if (uid != 0) { + fprintf(stderr, "spawn_setuid_setgid skipped: not root\n"); + return 0; + } + + init_process_options("spawn_helper1", exit_cb); + + /* become the "nobody" user. */ + pw = getpwnam("nobody"); + ASSERT(pw != NULL); + options.uid = pw->pw_uid; + options.gid = pw->pw_gid; + options.flags = UV_PROCESS_SETUID | UV_PROCESS_SETGID; + + r = uv_spawn(uv_default_loop(), &process, &options); + if (r == UV_EACCES) + RETURN_SKIP("user 'nobody' cannot access the test runner"); + + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif + + +#ifndef _WIN32 +TEST_IMPL(spawn_setuid_fails) { + int r; + + /* if root, become nobody. */ + uv_uid_t uid = getuid(); + if (uid == 0) { + struct passwd* pw; + pw = getpwnam("nobody"); + ASSERT(pw != NULL); + ASSERT(0 == setgid(pw->pw_gid)); + ASSERT(0 == setuid(pw->pw_uid)); + } + + init_process_options("spawn_helper1", fail_cb); + + options.flags |= UV_PROCESS_SETUID; + options.uid = 0; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == UV_EPERM); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_setgid_fails) { + int r; + + /* if root, become nobody. */ + uv_uid_t uid = getuid(); + if (uid == 0) { + struct passwd* pw; + pw = getpwnam("nobody"); + ASSERT(pw != NULL); + ASSERT(0 == setgid(pw->pw_gid)); + ASSERT(0 == setuid(pw->pw_uid)); + } + + init_process_options("spawn_helper1", fail_cb); + + options.flags |= UV_PROCESS_SETGID; + options.gid = 0; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == UV_EPERM); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif + + +#ifdef _WIN32 + +static void exit_cb_unexpected(uv_process_t* process, + int64_t exit_status, + int term_signal) { + ASSERT(0 && "should not have been called"); +} + + +TEST_IMPL(spawn_setuid_fails) { + int r; + + init_process_options("spawn_helper1", exit_cb_unexpected); + + options.flags |= UV_PROCESS_SETUID; + options.uid = (uv_uid_t) -42424242; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == UV_ENOTSUP); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(spawn_setgid_fails) { + int r; + + init_process_options("spawn_helper1", exit_cb_unexpected); + + options.flags |= UV_PROCESS_SETGID; + options.gid = (uv_gid_t) -42424242; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == UV_ENOTSUP); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif + + +TEST_IMPL(spawn_auto_unref) { + init_process_options("spawn_helper1", NULL); + ASSERT(0 == uv_spawn(uv_default_loop(), &process, &options)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + ASSERT(0 == uv_is_closing((uv_handle_t*) &process)); + uv_close((uv_handle_t*) &process, NULL); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + ASSERT(1 == uv_is_closing((uv_handle_t*) &process)); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +#ifndef _WIN32 +TEST_IMPL(spawn_fs_open) { + int fd; + uv_fs_t fs_req; + uv_pipe_t in; + uv_write_t write_req; + uv_buf_t buf; + uv_stdio_container_t stdio[1]; + + fd = uv_fs_open(NULL, &fs_req, "/dev/null", O_RDWR, 0, NULL); + ASSERT(fd >= 0); + uv_fs_req_cleanup(&fs_req); + + init_process_options("spawn_helper8", exit_cb); + + ASSERT(0 == uv_pipe_init(uv_default_loop(), &in, 0)); + + options.stdio = stdio; + options.stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; + options.stdio[0].data.stream = (uv_stream_t*) ∈ + options.stdio_count = 1; + + ASSERT(0 == uv_spawn(uv_default_loop(), &process, &options)); + + buf = uv_buf_init((char*) &fd, sizeof(fd)); + ASSERT(0 == uv_write(&write_req, (uv_stream_t*) &in, &buf, 1, write_cb)); + + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + ASSERT(0 == uv_fs_close(NULL, &fs_req, fd, NULL)); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 2); /* One for `in`, one for process */ + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif /* !_WIN32 */ + + +#ifndef _WIN32 +TEST_IMPL(closed_fd_events) { + uv_stdio_container_t stdio[3]; + uv_pipe_t pipe_handle; + int fd[2]; + + /* create a pipe and share it with a child process */ + ASSERT(0 == pipe(fd)); + + /* spawn_helper4 blocks indefinitely. */ + init_process_options("spawn_helper4", exit_cb); + options.stdio_count = 3; + options.stdio = stdio; + options.stdio[0].flags = UV_INHERIT_FD; + options.stdio[0].data.fd = fd[0]; + options.stdio[1].flags = UV_IGNORE; + options.stdio[2].flags = UV_IGNORE; + + ASSERT(0 == uv_spawn(uv_default_loop(), &process, &options)); + uv_unref((uv_handle_t*) &process); + + /* read from the pipe with uv */ + ASSERT(0 == uv_pipe_init(uv_default_loop(), &pipe_handle, 0)); + ASSERT(0 == uv_pipe_open(&pipe_handle, fd[0])); + fd[0] = -1; + + ASSERT(0 == uv_read_start((uv_stream_t*) &pipe_handle, on_alloc, on_read_once)); + + ASSERT(1 == write(fd[1], "", 1)); + + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_ONCE)); + + /* should have received just one byte */ + ASSERT(output_used == 1); + + /* close the pipe and see if we still get events */ + uv_close((uv_handle_t*) &pipe_handle, close_cb); + + ASSERT(1 == write(fd[1], "", 1)); + + ASSERT(0 == uv_timer_init(uv_default_loop(), &timer)); + ASSERT(0 == uv_timer_start(&timer, timer_counter_cb, 10, 0)); + + /* see if any spurious events interrupt the timer */ + if (1 == uv_run(uv_default_loop(), UV_RUN_ONCE)) + /* have to run again to really trigger the timer */ + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_ONCE)); + + ASSERT(timer_counter == 1); + + /* cleanup */ + ASSERT(0 == uv_process_kill(&process, /* SIGTERM */ 15)); + ASSERT(0 == close(fd[1])); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif /* !_WIN32 */ + +TEST_IMPL(spawn_reads_child_path) { + int r; + int len; + char file[64]; + char path[1024]; + char* env[3]; + + /* Need to carry over the dynamic linker path when the test runner is + * linked against libuv.so, see https://github.com/libuv/libuv/issues/85. + */ +#if defined(__APPLE__) + static const char dyld_path_var[] = "DYLD_LIBRARY_PATH"; +#else + static const char dyld_path_var[] = "LD_LIBRARY_PATH"; +#endif + + /* Set up the process, but make sure that the file to run is relative and */ + /* requires a lookup into PATH */ + init_process_options("spawn_helper1", exit_cb); + + /* Set up the PATH env variable */ + for (len = strlen(exepath); + exepath[len - 1] != '/' && exepath[len - 1] != '\\'; + len--); + strcpy(file, exepath + len); + exepath[len] = 0; + strcpy(path, "PATH="); + strcpy(path + 5, exepath); + + env[0] = path; + env[1] = getenv(dyld_path_var); + env[2] = NULL; + + if (env[1] != NULL) { + static char buf[1024 + sizeof(dyld_path_var)]; + snprintf(buf, sizeof(buf), "%s=%s", dyld_path_var, env[1]); + env[1] = buf; + } + + options.file = file; + options.args[0] = file; + options.env = env; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#ifndef _WIN32 +static int mpipe(int *fds) { + if (pipe(fds) == -1) + return -1; + if (fcntl(fds[0], F_SETFD, FD_CLOEXEC) == -1 || + fcntl(fds[1], F_SETFD, FD_CLOEXEC) == -1) { + close(fds[0]); + close(fds[1]); + return -1; + } + return 0; +} +#else +static int mpipe(int *fds) { + SECURITY_ATTRIBUTES attr; + HANDLE readh, writeh; + attr.nLength = sizeof(attr); + attr.lpSecurityDescriptor = NULL; + attr.bInheritHandle = FALSE; + if (!CreatePipe(&readh, &writeh, &attr, 0)) + return -1; + fds[0] = _open_osfhandle((intptr_t)readh, 0); + fds[1] = _open_osfhandle((intptr_t)writeh, 0); + if (fds[0] == -1 || fds[1] == -1) { + CloseHandle(readh); + CloseHandle(writeh); + return -1; + } + return 0; +} +#endif /* !_WIN32 */ + +TEST_IMPL(spawn_inherit_streams) { + uv_process_t child_req; + uv_stdio_container_t child_stdio[2]; + int fds_stdin[2]; + int fds_stdout[2]; + uv_pipe_t pipe_stdin_child; + uv_pipe_t pipe_stdout_child; + uv_pipe_t pipe_stdin_parent; + uv_pipe_t pipe_stdout_parent; + unsigned char ubuf[OUTPUT_SIZE - 1]; + uv_buf_t buf; + unsigned int i; + int r; + uv_write_t write_req; + uv_loop_t* loop; + + init_process_options("spawn_helper9", exit_cb); + + loop = uv_default_loop(); + ASSERT(uv_pipe_init(loop, &pipe_stdin_child, 0) == 0); + ASSERT(uv_pipe_init(loop, &pipe_stdout_child, 0) == 0); + ASSERT(uv_pipe_init(loop, &pipe_stdin_parent, 0) == 0); + ASSERT(uv_pipe_init(loop, &pipe_stdout_parent, 0) == 0); + + ASSERT(mpipe(fds_stdin) != -1); + ASSERT(mpipe(fds_stdout) != -1); + + ASSERT(uv_pipe_open(&pipe_stdin_child, fds_stdin[0]) == 0); + ASSERT(uv_pipe_open(&pipe_stdout_child, fds_stdout[1]) == 0); + ASSERT(uv_pipe_open(&pipe_stdin_parent, fds_stdin[1]) == 0); + ASSERT(uv_pipe_open(&pipe_stdout_parent, fds_stdout[0]) == 0); + + child_stdio[0].flags = UV_INHERIT_STREAM; + child_stdio[0].data.stream = (uv_stream_t *)&pipe_stdin_child; + + child_stdio[1].flags = UV_INHERIT_STREAM; + child_stdio[1].data.stream = (uv_stream_t *)&pipe_stdout_child; + + options.stdio = child_stdio; + options.stdio_count = 2; + + ASSERT(uv_spawn(loop, &child_req, &options) == 0); + + uv_close((uv_handle_t*)&pipe_stdin_child, NULL); + uv_close((uv_handle_t*)&pipe_stdout_child, NULL); + + buf = uv_buf_init((char*)ubuf, sizeof ubuf); + for (i = 0; i < sizeof ubuf; ++i) + ubuf[i] = i & 255u; + memset(output, 0, sizeof ubuf); + + r = uv_write(&write_req, + (uv_stream_t*)&pipe_stdin_parent, + &buf, + 1, + write_cb); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*)&pipe_stdout_parent, on_alloc, on_read); + ASSERT(r == 0); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 3); + + r = memcmp(ubuf, output, sizeof ubuf); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +/* Helper for child process of spawn_inherit_streams */ +#ifndef _WIN32 +int spawn_stdin_stdout(void) { + char buf[1024]; + char* pbuf; + for (;;) { + ssize_t r, w, c; + do { + r = read(0, buf, sizeof buf); + } while (r == -1 && errno == EINTR); + if (r == 0) { + return 1; + } + ASSERT(r > 0); + c = r; + pbuf = buf; + while (c) { + do { + w = write(1, pbuf, (size_t)c); + } while (w == -1 && errno == EINTR); + ASSERT(w >= 0); + pbuf = pbuf + w; + c = c - w; + } + } + return 2; +} +#else +int spawn_stdin_stdout(void) { + char buf[1024]; + char* pbuf; + HANDLE h_stdin = GetStdHandle(STD_INPUT_HANDLE); + HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE); + ASSERT(h_stdin != INVALID_HANDLE_VALUE); + ASSERT(h_stdout != INVALID_HANDLE_VALUE); + for (;;) { + DWORD n_read; + DWORD n_written; + DWORD to_write; + if (!ReadFile(h_stdin, buf, sizeof buf, &n_read, NULL)) { + ASSERT(GetLastError() == ERROR_BROKEN_PIPE); + return 1; + } + to_write = n_read; + pbuf = buf; + while (to_write) { + ASSERT(WriteFile(h_stdout, pbuf, to_write, &n_written, NULL)); + to_write -= n_written; + pbuf += n_written; + } + } + return 2; +} +#endif /* !_WIN32 */ diff --git a/3rdparty/libuv/test/test-stdio-over-pipes.c b/3rdparty/libuv/test/test-stdio-over-pipes.c new file mode 100644 index 00000000000..15744761049 --- /dev/null +++ b/3rdparty/libuv/test/test-stdio-over-pipes.c @@ -0,0 +1,255 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + + +static char exepath[1024]; +static size_t exepath_size = 1024; +static char* args[3]; +static uv_process_options_t options; +static int close_cb_called; +static int exit_cb_called; +static int on_read_cb_called; +static int after_write_cb_called; +static uv_pipe_t in; +static uv_pipe_t out; +static uv_loop_t* loop; +#define OUTPUT_SIZE 1024 +static char output[OUTPUT_SIZE]; +static int output_used; + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +static void exit_cb(uv_process_t* process, + int64_t exit_status, + int term_signal) { + printf("exit_cb\n"); + exit_cb_called++; + ASSERT(exit_status == 0); + ASSERT(term_signal == 0); + uv_close((uv_handle_t*)process, close_cb); + uv_close((uv_handle_t*)&in, close_cb); + uv_close((uv_handle_t*)&out, close_cb); +} + + +static void init_process_options(char* test, uv_exit_cb exit_cb) { + int r = uv_exepath(exepath, &exepath_size); + ASSERT(r == 0); + exepath[exepath_size] = '\0'; + args[0] = exepath; + args[1] = test; + args[2] = NULL; + options.file = exepath; + options.args = args; + options.exit_cb = exit_cb; +} + + +static void on_alloc(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + buf->base = output + output_used; + buf->len = OUTPUT_SIZE - output_used; +} + + +static void after_write(uv_write_t* req, int status) { + if (status) { + fprintf(stderr, "uv_write error: %s\n", uv_strerror(status)); + ASSERT(0); + } + + /* Free the read/write buffer and the request */ + free(req); + + after_write_cb_called++; +} + + +static void on_read(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* rdbuf) { + uv_write_t* req; + uv_buf_t wrbuf; + int r; + + ASSERT(nread > 0 || nread == UV_EOF); + + if (nread > 0) { + output_used += nread; + if (output_used == 12) { + ASSERT(memcmp("hello world\n", output, 12) == 0); + wrbuf = uv_buf_init(output, output_used); + req = malloc(sizeof(*req)); + r = uv_write(req, (uv_stream_t*)&in, &wrbuf, 1, after_write); + ASSERT(r == 0); + } + } + + on_read_cb_called++; +} + + +TEST_IMPL(stdio_over_pipes) { + int r; + uv_process_t process; + uv_stdio_container_t stdio[2]; + + loop = uv_default_loop(); + + init_process_options("stdio_over_pipes_helper", exit_cb); + + uv_pipe_init(loop, &out, 0); + uv_pipe_init(loop, &in, 0); + + options.stdio = stdio; + options.stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; + options.stdio[0].data.stream = (uv_stream_t*)∈ + options.stdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + options.stdio[1].data.stream = (uv_stream_t*)&out; + options.stdio_count = 2; + + r = uv_spawn(loop, &process, &options); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*) &out, on_alloc, on_read); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(on_read_cb_called > 1); + ASSERT(after_write_cb_called == 1); + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 3); + ASSERT(memcmp("hello world\n", output, 12) == 0); + ASSERT(output_used == 12); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +/* Everything here runs in a child process. */ + +static int on_pipe_read_called; +static int after_write_called; +static uv_pipe_t stdin_pipe; +static uv_pipe_t stdout_pipe; + +static void on_pipe_read(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { + ASSERT(nread > 0); + ASSERT(memcmp("hello world\n", buf->base, nread) == 0); + on_pipe_read_called++; + + free(buf->base); + + uv_close((uv_handle_t*)&stdin_pipe, close_cb); + uv_close((uv_handle_t*)&stdout_pipe, close_cb); +} + + +static void after_pipe_write(uv_write_t* req, int status) { + ASSERT(status == 0); + after_write_called++; +} + + +static void on_read_alloc(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + buf->base = malloc(suggested_size); + buf->len = suggested_size; +} + + +int stdio_over_pipes_helper(void) { + /* Write several buffers to test that the write order is preserved. */ + char* buffers[] = { + "he", + "ll", + "o ", + "wo", + "rl", + "d", + "\n" + }; + + uv_write_t write_req[ARRAY_SIZE(buffers)]; + uv_buf_t buf[ARRAY_SIZE(buffers)]; + unsigned int i; + int r; + uv_loop_t* loop = uv_default_loop(); + + ASSERT(UV_NAMED_PIPE == uv_guess_handle(0)); + ASSERT(UV_NAMED_PIPE == uv_guess_handle(1)); + + r = uv_pipe_init(loop, &stdin_pipe, 0); + ASSERT(r == 0); + r = uv_pipe_init(loop, &stdout_pipe, 0); + ASSERT(r == 0); + + uv_pipe_open(&stdin_pipe, 0); + uv_pipe_open(&stdout_pipe, 1); + + /* Unref both stdio handles to make sure that all writes complete. */ + uv_unref((uv_handle_t*)&stdin_pipe); + uv_unref((uv_handle_t*)&stdout_pipe); + + for (i = 0; i < ARRAY_SIZE(buffers); i++) { + buf[i] = uv_buf_init((char*)buffers[i], strlen(buffers[i])); + } + + for (i = 0; i < ARRAY_SIZE(buffers); i++) { + r = uv_write(&write_req[i], (uv_stream_t*)&stdout_pipe, &buf[i], 1, + after_pipe_write); + ASSERT(r == 0); + } + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(after_write_called == 7); + ASSERT(on_pipe_read_called == 0); + ASSERT(close_cb_called == 0); + + uv_ref((uv_handle_t*)&stdout_pipe); + uv_ref((uv_handle_t*)&stdin_pipe); + + r = uv_read_start((uv_stream_t*)&stdin_pipe, on_read_alloc, on_pipe_read); + ASSERT(r == 0); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(after_write_called == 7); + ASSERT(on_pipe_read_called == 1); + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-bind-error.c b/3rdparty/libuv/test/test-tcp-bind-error.c new file mode 100644 index 00000000000..10ed68e10ec --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-bind-error.c @@ -0,0 +1,216 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + + +static int close_cb_called = 0; + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +TEST_IMPL(tcp_bind_error_addrinuse) { + struct sockaddr_in addr; + uv_tcp_t server1, server2; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + r = uv_tcp_init(uv_default_loop(), &server1); + ASSERT(r == 0); + r = uv_tcp_bind(&server1, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_tcp_init(uv_default_loop(), &server2); + ASSERT(r == 0); + r = uv_tcp_bind(&server2, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&server1, 128, NULL); + ASSERT(r == 0); + r = uv_listen((uv_stream_t*)&server2, 128, NULL); + ASSERT(r == UV_EADDRINUSE); + + uv_close((uv_handle_t*)&server1, close_cb); + uv_close((uv_handle_t*)&server2, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_bind_error_addrnotavail_1) { + struct sockaddr_in addr; + uv_tcp_t server; + int r; + + ASSERT(0 == uv_ip4_addr("127.255.255.255", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + /* It seems that Linux is broken here - bind succeeds. */ + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0 || r == UV_EADDRNOTAVAIL); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_bind_error_addrnotavail_2) { + struct sockaddr_in addr; + uv_tcp_t server; + int r; + + ASSERT(0 == uv_ip4_addr("4.4.4.4", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == UV_EADDRNOTAVAIL); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_bind_error_fault) { + char garbage[] = + "blah blah blah blah blah blah blah blah blah blah blah blah"; + struct sockaddr_in* garbage_addr; + uv_tcp_t server; + int r; + + garbage_addr = (struct sockaddr_in*) &garbage; + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) garbage_addr, 0); + ASSERT(r == UV_EINVAL); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +/* Notes: On Linux uv_bind(server, NULL) will segfault the program. */ + +TEST_IMPL(tcp_bind_error_inval) { + struct sockaddr_in addr1; + struct sockaddr_in addr2; + uv_tcp_t server; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr1)); + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT_2, &addr2)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr1, 0); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr2, 0); + ASSERT(r == UV_EINVAL); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_bind_localhost_ok) { + struct sockaddr_in addr; + uv_tcp_t server; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_bind_invalid_flags) { + struct sockaddr_in addr; + uv_tcp_t server; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, UV_TCP_IPV6ONLY); + ASSERT(r == UV_EINVAL); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_listen_without_bind) { + int r; + uv_tcp_t server; + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_listen((uv_stream_t*)&server, 128, NULL); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-bind6-error.c b/3rdparty/libuv/test/test-tcp-bind6-error.c new file mode 100644 index 00000000000..b762bcb3d1b --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-bind6-error.c @@ -0,0 +1,176 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + + +static int close_cb_called = 0; + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +TEST_IMPL(tcp_bind6_error_addrinuse) { + struct sockaddr_in6 addr; + uv_tcp_t server1, server2; + int r; + + if (!can_ipv6()) + RETURN_SKIP("IPv6 not supported"); + + ASSERT(0 == uv_ip6_addr("::", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &server1); + ASSERT(r == 0); + r = uv_tcp_bind(&server1, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_tcp_init(uv_default_loop(), &server2); + ASSERT(r == 0); + r = uv_tcp_bind(&server2, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&server1, 128, NULL); + ASSERT(r == 0); + r = uv_listen((uv_stream_t*)&server2, 128, NULL); + ASSERT(r == UV_EADDRINUSE); + + uv_close((uv_handle_t*)&server1, close_cb); + uv_close((uv_handle_t*)&server2, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_bind6_error_addrnotavail) { + struct sockaddr_in6 addr; + uv_tcp_t server; + int r; + + if (!can_ipv6()) + RETURN_SKIP("IPv6 not supported"); + + ASSERT(0 == uv_ip6_addr("4:4:4:4:4:4:4:4", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == UV_EADDRNOTAVAIL); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_bind6_error_fault) { + char garbage[] = + "blah blah blah blah blah blah blah blah blah blah blah blah"; + struct sockaddr_in6* garbage_addr; + uv_tcp_t server; + int r; + + if (!can_ipv6()) + RETURN_SKIP("IPv6 not supported"); + + garbage_addr = (struct sockaddr_in6*) &garbage; + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) garbage_addr, 0); + ASSERT(r == UV_EINVAL); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +/* Notes: On Linux uv_bind6(server, NULL) will segfault the program. */ + +TEST_IMPL(tcp_bind6_error_inval) { + struct sockaddr_in6 addr1; + struct sockaddr_in6 addr2; + uv_tcp_t server; + int r; + + if (!can_ipv6()) + RETURN_SKIP("IPv6 not supported"); + + ASSERT(0 == uv_ip6_addr("::", TEST_PORT, &addr1)); + ASSERT(0 == uv_ip6_addr("::", TEST_PORT_2, &addr2)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr1, 0); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr2, 0); + ASSERT(r == UV_EINVAL); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_bind6_localhost_ok) { + struct sockaddr_in6 addr; + uv_tcp_t server; + int r; + + if (!can_ipv6()) + RETURN_SKIP("IPv6 not supported"); + + ASSERT(0 == uv_ip6_addr("::1", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-close-accept.c b/3rdparty/libuv/test/test-tcp-close-accept.c new file mode 100644 index 00000000000..5517aaf99e6 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-close-accept.c @@ -0,0 +1,188 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* this test is Unix only */ +#ifndef _WIN32 + +#include "uv.h" +#include "task.h" + +#include +#include + +static struct sockaddr_in addr; +static uv_tcp_t tcp_server; +static uv_tcp_t tcp_outgoing[2]; +static uv_tcp_t tcp_incoming[ARRAY_SIZE(tcp_outgoing)]; +static uv_connect_t connect_reqs[ARRAY_SIZE(tcp_outgoing)]; +static uv_tcp_t tcp_check; +static uv_connect_t tcp_check_req; +static uv_write_t write_reqs[ARRAY_SIZE(tcp_outgoing)]; +static unsigned int got_connections; +static unsigned int close_cb_called; +static unsigned int write_cb_called; +static unsigned int read_cb_called; + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + +static void write_cb(uv_write_t* req, int status) { + ASSERT(status == 0); + write_cb_called++; +} + +static void connect_cb(uv_connect_t* req, int status) { + unsigned int i; + uv_buf_t buf; + uv_stream_t* outgoing; + + if (req == &tcp_check_req) { + ASSERT(status != 0); + + /* Close check and incoming[0], time to finish test */ + uv_close((uv_handle_t*) &tcp_incoming[0], close_cb); + uv_close((uv_handle_t*) &tcp_check, close_cb); + return; + } + + ASSERT(status == 0); + ASSERT(connect_reqs <= req); + ASSERT(req <= connect_reqs + ARRAY_SIZE(connect_reqs)); + i = req - connect_reqs; + + buf = uv_buf_init("x", 1); + outgoing = (uv_stream_t*) &tcp_outgoing[i]; + ASSERT(0 == uv_write(&write_reqs[i], outgoing, &buf, 1, write_cb)); +} + +static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + static char slab[1]; + buf->base = slab; + buf->len = sizeof(slab); +} + +static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { + uv_loop_t* loop; + unsigned int i; + + /* Only first stream should receive read events */ + ASSERT(stream == (uv_stream_t*) &tcp_incoming[0]); + ASSERT(0 == uv_read_stop(stream)); + ASSERT(1 == nread); + + loop = stream->loop; + read_cb_called++; + + /* Close all active incomings, except current one */ + for (i = 1; i < got_connections; i++) + uv_close((uv_handle_t*) &tcp_incoming[i], close_cb); + + /* Create new fd that should be one of the closed incomings */ + ASSERT(0 == uv_tcp_init(loop, &tcp_check)); + ASSERT(0 == uv_tcp_connect(&tcp_check_req, + &tcp_check, + (const struct sockaddr*) &addr, + connect_cb)); + ASSERT(0 == uv_read_start((uv_stream_t*) &tcp_check, alloc_cb, read_cb)); + + /* Close server, so no one will connect to it */ + uv_close((uv_handle_t*) &tcp_server, close_cb); +} + +static void connection_cb(uv_stream_t* server, int status) { + unsigned int i; + uv_tcp_t* incoming; + + ASSERT(server == (uv_stream_t*) &tcp_server); + + /* Ignore tcp_check connection */ + if (got_connections == ARRAY_SIZE(tcp_incoming)) + return; + + /* Accept everyone */ + incoming = &tcp_incoming[got_connections++]; + ASSERT(0 == uv_tcp_init(server->loop, incoming)); + ASSERT(0 == uv_accept(server, (uv_stream_t*) incoming)); + + if (got_connections != ARRAY_SIZE(tcp_incoming)) + return; + + /* Once all clients are accepted - start reading */ + for (i = 0; i < ARRAY_SIZE(tcp_incoming); i++) { + incoming = &tcp_incoming[i]; + ASSERT(0 == uv_read_start((uv_stream_t*) incoming, alloc_cb, read_cb)); + } +} + +TEST_IMPL(tcp_close_accept) { + unsigned int i; + uv_loop_t* loop; + uv_tcp_t* client; + + /* + * A little explanation of what goes on below: + * + * We'll create server and connect to it using two clients, each writing one + * byte once connected. + * + * When all clients will be accepted by server - we'll start reading from them + * and, on first client's first byte, will close second client and server. + * After that, we'll immediately initiate new connection to server using + * tcp_check handle (thus, reusing fd from second client). + * + * In this situation uv__io_poll()'s event list should still contain read + * event for second client, and, if not cleaned up properly, `tcp_check` will + * receive stale event of second incoming and invoke `connect_cb` with zero + * status. + */ + + loop = uv_default_loop(); + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + ASSERT(0 == uv_tcp_init(loop, &tcp_server)); + ASSERT(0 == uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0)); + ASSERT(0 == uv_listen((uv_stream_t*) &tcp_server, + ARRAY_SIZE(tcp_outgoing), + connection_cb)); + + for (i = 0; i < ARRAY_SIZE(tcp_outgoing); i++) { + client = tcp_outgoing + i; + + ASSERT(0 == uv_tcp_init(loop, client)); + ASSERT(0 == uv_tcp_connect(&connect_reqs[i], + client, + (const struct sockaddr*) &addr, + connect_cb)); + } + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(ARRAY_SIZE(tcp_outgoing) == got_connections); + ASSERT((ARRAY_SIZE(tcp_outgoing) + 2) == close_cb_called); + ASSERT(ARRAY_SIZE(tcp_outgoing) == write_cb_called); + ASSERT(1 == read_cb_called); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* !_WIN32 */ diff --git a/3rdparty/libuv/test/test-tcp-close-while-connecting.c b/3rdparty/libuv/test/test-tcp-close-while-connecting.c new file mode 100644 index 00000000000..2c39b652b61 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-close-while-connecting.c @@ -0,0 +1,86 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static uv_timer_t timer1_handle; +static uv_timer_t timer2_handle; +static uv_tcp_t tcp_handle; + +static int connect_cb_called; +static int timer1_cb_called; +static int close_cb_called; + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +static void connect_cb(uv_connect_t* req, int status) { + ASSERT(status == UV_ECANCELED); + uv_timer_stop(&timer2_handle); + connect_cb_called++; +} + + +static void timer1_cb(uv_timer_t* handle) { + uv_close((uv_handle_t*)handle, close_cb); + uv_close((uv_handle_t*)&tcp_handle, close_cb); + timer1_cb_called++; +} + + +static void timer2_cb(uv_timer_t* handle) { + ASSERT(0 && "should not be called"); +} + + +TEST_IMPL(tcp_close_while_connecting) { + uv_connect_t connect_req; + struct sockaddr_in addr; + uv_loop_t* loop; + int r; + + loop = uv_default_loop(); + ASSERT(0 == uv_ip4_addr("1.2.3.4", TEST_PORT, &addr)); + ASSERT(0 == uv_tcp_init(loop, &tcp_handle)); + r = uv_tcp_connect(&connect_req, + &tcp_handle, + (const struct sockaddr*) &addr, + connect_cb); + if (r == UV_ENETUNREACH) + RETURN_SKIP("Network unreachable."); + ASSERT(r == 0); + ASSERT(0 == uv_timer_init(loop, &timer1_handle)); + ASSERT(0 == uv_timer_start(&timer1_handle, timer1_cb, 50, 0)); + ASSERT(0 == uv_timer_init(loop, &timer2_handle)); + ASSERT(0 == uv_timer_start(&timer2_handle, timer2_cb, 86400 * 1000, 0)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + ASSERT(connect_cb_called == 1); + ASSERT(timer1_cb_called == 1); + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-close.c b/3rdparty/libuv/test/test-tcp-close.c new file mode 100644 index 00000000000..e65885aa556 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-close.c @@ -0,0 +1,136 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include /* memset */ + +#define NUM_WRITE_REQS 32 + +static uv_tcp_t tcp_handle; +static uv_connect_t connect_req; + +static int write_cb_called; +static int close_cb_called; + +static void connect_cb(uv_connect_t* req, int status); +static void write_cb(uv_write_t* req, int status); +static void close_cb(uv_handle_t* handle); + + +static void connect_cb(uv_connect_t* conn_req, int status) { + uv_write_t* req; + uv_buf_t buf; + int i, r; + + buf = uv_buf_init("PING", 4); + for (i = 0; i < NUM_WRITE_REQS; i++) { + req = malloc(sizeof *req); + ASSERT(req != NULL); + + r = uv_write(req, (uv_stream_t*)&tcp_handle, &buf, 1, write_cb); + ASSERT(r == 0); + } + + uv_close((uv_handle_t*)&tcp_handle, close_cb); +} + + +static void write_cb(uv_write_t* req, int status) { + /* write callbacks should run before the close callback */ + ASSERT(close_cb_called == 0); + ASSERT(req->handle == (uv_stream_t*)&tcp_handle); + write_cb_called++; + free(req); +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle == (uv_handle_t*)&tcp_handle); + close_cb_called++; +} + + +static void connection_cb(uv_stream_t* server, int status) { + ASSERT(status == 0); +} + + +static void start_server(uv_loop_t* loop, uv_tcp_t* handle) { + struct sockaddr_in addr; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_init(loop, handle); + ASSERT(r == 0); + + r = uv_tcp_bind(handle, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)handle, 128, connection_cb); + ASSERT(r == 0); + + uv_unref((uv_handle_t*)handle); +} + + +/* Check that pending write requests have their callbacks + * invoked when the handle is closed. + */ +TEST_IMPL(tcp_close) { + struct sockaddr_in addr; + uv_tcp_t tcp_server; + uv_loop_t* loop; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + loop = uv_default_loop(); + + /* We can't use the echo server, it doesn't handle ECONNRESET. */ + start_server(loop, &tcp_server); + + r = uv_tcp_init(loop, &tcp_handle); + ASSERT(r == 0); + + r = uv_tcp_connect(&connect_req, + &tcp_handle, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); + + ASSERT(write_cb_called == 0); + ASSERT(close_cb_called == 0); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + printf("%d of %d write reqs seen\n", write_cb_called, NUM_WRITE_REQS); + + ASSERT(write_cb_called == NUM_WRITE_REQS); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-connect-error-after-write.c b/3rdparty/libuv/test/test-tcp-connect-error-after-write.c new file mode 100644 index 00000000000..3f2e3572da9 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-connect-error-after-write.c @@ -0,0 +1,98 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +static int connect_cb_called; +static int write_cb_called; +static int close_cb_called; + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +static void connect_cb(uv_connect_t* req, int status) { + ASSERT(status < 0); + connect_cb_called++; + uv_close((uv_handle_t*)req->handle, close_cb); +} + + +static void write_cb(uv_write_t* req, int status) { + ASSERT(status < 0); + write_cb_called++; +} + + +/* + * Try to connect to an address on which nothing listens, get ECONNREFUSED + * (uv errno 12) and get connect_cb() called once with status != 0. + * Related issue: https://github.com/joyent/libuv/issues/443 + */ +TEST_IMPL(tcp_connect_error_after_write) { + uv_connect_t connect_req; + struct sockaddr_in addr; + uv_write_t write_req; + uv_tcp_t conn; + uv_buf_t buf; + int r; + +#ifdef _WIN32 + fprintf(stderr, "This test is disabled on Windows for now.\n"); + fprintf(stderr, "See https://github.com/joyent/libuv/issues/444\n"); + return 0; /* windows slackers... */ +#endif + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + buf = uv_buf_init("TEST", 4); + + r = uv_tcp_init(uv_default_loop(), &conn); + ASSERT(r == 0); + + r = uv_write(&write_req, (uv_stream_t*)&conn, &buf, 1, write_cb); + ASSERT(r == UV_EBADF); + + r = uv_tcp_connect(&connect_req, + &conn, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); + + r = uv_write(&write_req, (uv_stream_t*)&conn, &buf, 1, write_cb); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(connect_cb_called == 1); + ASSERT(write_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-connect-error.c b/3rdparty/libuv/test/test-tcp-connect-error.c new file mode 100644 index 00000000000..eab1eeb2545 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-connect-error.c @@ -0,0 +1,73 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + + +static int connect_cb_called = 0; +static int close_cb_called = 0; + + + +static void connect_cb(uv_connect_t* handle, int status) { + ASSERT(handle != NULL); + connect_cb_called++; +} + + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +TEST_IMPL(tcp_connect_error_fault) { + const char garbage[] = + "blah blah blah blah blah blah blah blah blah blah blah blah"; + const struct sockaddr_in* garbage_addr; + uv_tcp_t server; + int r; + uv_connect_t req; + + garbage_addr = (const struct sockaddr_in*) &garbage; + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_connect(&req, + &server, + (const struct sockaddr*) garbage_addr, + connect_cb); + ASSERT(r == UV_EINVAL); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(connect_cb_called == 0); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-connect-timeout.c b/3rdparty/libuv/test/test-tcp-connect-timeout.c new file mode 100644 index 00000000000..081424b8002 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-connect-timeout.c @@ -0,0 +1,91 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + + +static int connect_cb_called; +static int close_cb_called; + +static uv_connect_t connect_req; +static uv_timer_t timer; +static uv_tcp_t conn; + +static void connect_cb(uv_connect_t* req, int status); +static void timer_cb(uv_timer_t* handle); +static void close_cb(uv_handle_t* handle); + + +static void connect_cb(uv_connect_t* req, int status) { + ASSERT(req == &connect_req); + ASSERT(status == UV_ECANCELED); + connect_cb_called++; +} + + +static void timer_cb(uv_timer_t* handle) { + ASSERT(handle == &timer); + uv_close((uv_handle_t*)&conn, close_cb); + uv_close((uv_handle_t*)&timer, close_cb); +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle == (uv_handle_t*)&conn || handle == (uv_handle_t*)&timer); + close_cb_called++; +} + + +/* Verify that connecting to an unreachable address or port doesn't hang + * the event loop. + */ +TEST_IMPL(tcp_connect_timeout) { + struct sockaddr_in addr; + int r; + + ASSERT(0 == uv_ip4_addr("8.8.8.8", 9999, &addr)); + + r = uv_timer_init(uv_default_loop(), &timer); + ASSERT(r == 0); + + r = uv_timer_start(&timer, timer_cb, 50, 0); + ASSERT(r == 0); + + r = uv_tcp_init(uv_default_loop(), &conn); + ASSERT(r == 0); + + r = uv_tcp_connect(&connect_req, + &conn, + (const struct sockaddr*) &addr, + connect_cb); + if (r == UV_ENETUNREACH) + RETURN_SKIP("Network unreachable."); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-connect6-error.c b/3rdparty/libuv/test/test-tcp-connect6-error.c new file mode 100644 index 00000000000..91ac0a3a101 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-connect6-error.c @@ -0,0 +1,71 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + + +static int connect_cb_called = 0; +static int close_cb_called = 0; + + +static void connect_cb(uv_connect_t* handle, int status) { + ASSERT(handle != NULL); + connect_cb_called++; +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +TEST_IMPL(tcp_connect6_error_fault) { + const char garbage[] = + "blah blah blah blah blah blah blah blah blah blah blah blah"; + const struct sockaddr_in6* garbage_addr; + uv_tcp_t server; + int r; + uv_connect_t req; + + garbage_addr = (const struct sockaddr_in6*) &garbage; + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_connect(&req, + &server, + (const struct sockaddr*) garbage_addr, + connect_cb); + ASSERT(r == UV_EINVAL); + + uv_close((uv_handle_t*)&server, close_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(connect_cb_called == 0); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-create-socket-early.c b/3rdparty/libuv/test/test-tcp-create-socket-early.c new file mode 100644 index 00000000000..65650adcc27 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-create-socket-early.c @@ -0,0 +1,206 @@ +/* Copyright (c) 2015 Saúl Ibarra Corretgé . + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include + +#ifdef _WIN32 +# define INVALID_FD (INVALID_HANDLE_VALUE) +#else +# define INVALID_FD (-1) +#endif + + +static void on_connect(uv_connect_t* req, int status) { + ASSERT(status == 0); + uv_close((uv_handle_t*) req->handle, NULL); +} + + +static void on_connection(uv_stream_t* server, int status) { + uv_tcp_t* handle; + int r; + + ASSERT(status == 0); + + handle = malloc(sizeof(*handle)); + ASSERT(handle != NULL); + + r = uv_tcp_init_ex(server->loop, handle, AF_INET); + ASSERT(r == 0); + + r = uv_accept(server, (uv_stream_t*)handle); + ASSERT(r == UV_EBUSY); + + uv_close((uv_handle_t*) server, NULL); + uv_close((uv_handle_t*) handle, (uv_close_cb)free); +} + + +static void tcp_listener(uv_loop_t* loop, uv_tcp_t* server) { + struct sockaddr_in addr; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + r = uv_tcp_init(loop, server); + ASSERT(r == 0); + + r = uv_tcp_bind(server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*) server, 128, on_connection); + ASSERT(r == 0); +} + + +static void tcp_connector(uv_loop_t* loop, uv_tcp_t* client, uv_connect_t* req) { + struct sockaddr_in server_addr; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &server_addr)); + + r = uv_tcp_init(loop, client); + ASSERT(r == 0); + + r = uv_tcp_connect(req, + client, + (const struct sockaddr*) &server_addr, + on_connect); + ASSERT(r == 0); +} + + +TEST_IMPL(tcp_create_early) { + struct sockaddr_in addr; + struct sockaddr_in sockname; + uv_tcp_t client; + uv_os_fd_t fd; + int r, namelen; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_init_ex(uv_default_loop(), &client, AF_INET); + ASSERT(r == 0); + + r = uv_fileno((const uv_handle_t*) &client, &fd); + ASSERT(r == 0); + ASSERT(fd != INVALID_FD); + + /* Windows returns WSAEINVAL if the socket is not bound */ +#ifndef _WIN32 + namelen = sizeof sockname; + r = uv_tcp_getsockname(&client, (struct sockaddr*) &sockname, &namelen); + ASSERT(r == 0); + ASSERT(sockname.sin_family == AF_INET); +#endif + + r = uv_tcp_bind(&client, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + namelen = sizeof sockname; + r = uv_tcp_getsockname(&client, (struct sockaddr*) &sockname, &namelen); + ASSERT(r == 0); + ASSERT(memcmp(&addr.sin_addr, + &sockname.sin_addr, + sizeof(addr.sin_addr)) == 0); + + uv_close((uv_handle_t*) &client, NULL); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_create_early_bad_bind) { + struct sockaddr_in addr; + uv_tcp_t client; + uv_os_fd_t fd; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_init_ex(uv_default_loop(), &client, AF_INET6); + ASSERT(r == 0); + + r = uv_fileno((const uv_handle_t*) &client, &fd); + ASSERT(r == 0); + ASSERT(fd != INVALID_FD); + + /* Windows returns WSAEINVAL if the socket is not bound */ +#ifndef _WIN32 + { + int namelen; + struct sockaddr_in6 sockname; + namelen = sizeof sockname; + r = uv_tcp_getsockname(&client, (struct sockaddr*) &sockname, &namelen); + ASSERT(r == 0); + ASSERT(sockname.sin6_family == AF_INET6); + } +#endif + + r = uv_tcp_bind(&client, (const struct sockaddr*) &addr, 0); +#ifndef _WIN32 + ASSERT(r == UV_EINVAL); +#else + ASSERT(r == UV_EFAULT); +#endif + + uv_close((uv_handle_t*) &client, NULL); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_create_early_bad_domain) { + uv_tcp_t client; + int r; + + r = uv_tcp_init_ex(uv_default_loop(), &client, 47); + ASSERT(r == UV_EINVAL); + + r = uv_tcp_init_ex(uv_default_loop(), &client, 1024); + ASSERT(r == UV_EINVAL); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_create_early_accept) { + uv_tcp_t client, server; + uv_connect_t connect_req; + + tcp_listener(uv_default_loop(), &server); + tcp_connector(uv_default_loop(), &client, &connect_req); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-flags.c b/3rdparty/libuv/test/test-tcp-flags.c new file mode 100644 index 00000000000..68afb39f456 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-flags.c @@ -0,0 +1,52 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + + +TEST_IMPL(tcp_flags) { + uv_loop_t* loop; + uv_tcp_t handle; + int r; + + loop = uv_default_loop(); + + r = uv_tcp_init(loop, &handle); + ASSERT(r == 0); + + r = uv_tcp_nodelay(&handle, 1); + ASSERT(r == 0); + + r = uv_tcp_keepalive(&handle, 1, 60); + ASSERT(r == 0); + + uv_close((uv_handle_t*)&handle, NULL); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-oob.c b/3rdparty/libuv/test/test-tcp-oob.c new file mode 100644 index 00000000000..fc011ee495f --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-oob.c @@ -0,0 +1,128 @@ +/* Copyright Fedor Indutny. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#if !defined(_WIN32) + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +static uv_tcp_t server_handle; +static uv_tcp_t client_handle; +static uv_tcp_t peer_handle; +static uv_idle_t idle; +static uv_connect_t connect_req; +static int ticks; +static const int kMaxTicks = 10; + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char storage[1024]; + *buf = uv_buf_init(storage, sizeof(storage)); +} + + +static void idle_cb(uv_idle_t* idle) { + if (++ticks < kMaxTicks) + return; + + uv_close((uv_handle_t*) &server_handle, NULL); + uv_close((uv_handle_t*) &client_handle, NULL); + uv_close((uv_handle_t*) &peer_handle, NULL); + uv_close((uv_handle_t*) idle, NULL); +} + + +static void read_cb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { + ASSERT(nread > 0); + ASSERT(0 == uv_idle_start(&idle, idle_cb)); +} + + +static void connect_cb(uv_connect_t* req, int status) { + ASSERT(req->handle == (uv_stream_t*) &client_handle); + ASSERT(0 == status); +} + + +static void connection_cb(uv_stream_t* handle, int status) { + int r; + uv_os_fd_t fd; + + ASSERT(0 == status); + ASSERT(0 == uv_accept(handle, (uv_stream_t*) &peer_handle)); + ASSERT(0 == uv_read_start((uv_stream_t*) &peer_handle, alloc_cb, read_cb)); + + /* Send some OOB data */ + ASSERT(0 == uv_fileno((uv_handle_t*) &client_handle, &fd)); + + ASSERT(0 == uv_stream_set_blocking((uv_stream_t*) &client_handle, 1)); + + /* The problem triggers only on a second message, it seem that xnu is not + * triggering `kevent()` for the first one + */ + do { + r = send(fd, "hello", 5, MSG_OOB); + } while (r < 0 && errno == EINTR); + ASSERT(5 == r); + + do { + r = send(fd, "hello", 5, MSG_OOB); + } while (r < 0 && errno == EINTR); + ASSERT(5 == r); + + ASSERT(0 == uv_stream_set_blocking((uv_stream_t*) &client_handle, 0)); +} + + +TEST_IMPL(tcp_oob) { + struct sockaddr_in addr; + uv_loop_t* loop; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + loop = uv_default_loop(); + + ASSERT(0 == uv_tcp_init(loop, &server_handle)); + ASSERT(0 == uv_tcp_init(loop, &client_handle)); + ASSERT(0 == uv_tcp_init(loop, &peer_handle)); + ASSERT(0 == uv_idle_init(loop, &idle)); + ASSERT(0 == uv_tcp_bind(&server_handle, (const struct sockaddr*) &addr, 0)); + ASSERT(0 == uv_listen((uv_stream_t*) &server_handle, 1, connection_cb)); + + /* Ensure two separate packets */ + ASSERT(0 == uv_tcp_nodelay(&client_handle, 1)); + + ASSERT(0 == uv_tcp_connect(&connect_req, + &client_handle, + (const struct sockaddr*) &addr, + connect_cb)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + ASSERT(ticks == kMaxTicks); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif diff --git a/3rdparty/libuv/test/test-tcp-open.c b/3rdparty/libuv/test/test-tcp-open.c new file mode 100644 index 00000000000..6c8d43d0009 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-open.c @@ -0,0 +1,220 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include +#include + +#ifndef _WIN32 +# include +#endif + +static int shutdown_cb_called = 0; +static int connect_cb_called = 0; +static int write_cb_called = 0; +static int close_cb_called = 0; + +static uv_connect_t connect_req; +static uv_shutdown_t shutdown_req; +static uv_write_t write_req; + + +static void startup(void) { +#ifdef _WIN32 + struct WSAData wsa_data; + int r = WSAStartup(MAKEWORD(2, 2), &wsa_data); + ASSERT(r == 0); +#endif +} + + +static uv_os_sock_t create_tcp_socket(void) { + uv_os_sock_t sock; + + sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP); +#ifdef _WIN32 + ASSERT(sock != INVALID_SOCKET); +#else + ASSERT(sock >= 0); +#endif + +#ifndef _WIN32 + { + /* Allow reuse of the port. */ + int yes = 1; + int r = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes); + ASSERT(r == 0); + } +#endif + + return sock; +} + + +static void close_socket(uv_os_sock_t sock) { + int r; +#ifdef _WIN32 + r = closesocket(sock); +#else + r = close(sock); +#endif + ASSERT(r == 0); +} + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + ASSERT(suggested_size <= sizeof(slab)); + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +static void shutdown_cb(uv_shutdown_t* req, int status) { + ASSERT(req == &shutdown_req); + ASSERT(status == 0); + + /* Now we wait for the EOF */ + shutdown_cb_called++; +} + + +static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { + ASSERT(tcp != NULL); + + if (nread >= 0) { + ASSERT(nread == 4); + ASSERT(memcmp("PING", buf->base, nread) == 0); + } + else { + ASSERT(nread == UV_EOF); + printf("GOT EOF\n"); + uv_close((uv_handle_t*)tcp, close_cb); + } +} + + +static void write_cb(uv_write_t* req, int status) { + ASSERT(req != NULL); + + if (status) { + fprintf(stderr, "uv_write error: %s\n", uv_strerror(status)); + ASSERT(0); + } + + write_cb_called++; +} + + +static void connect_cb(uv_connect_t* req, int status) { + uv_buf_t buf = uv_buf_init("PING", 4); + uv_stream_t* stream; + int r; + + ASSERT(req == &connect_req); + ASSERT(status == 0); + + stream = req->handle; + connect_cb_called++; + + r = uv_write(&write_req, stream, &buf, 1, write_cb); + ASSERT(r == 0); + + /* Shutdown on drain. */ + r = uv_shutdown(&shutdown_req, stream, shutdown_cb); + ASSERT(r == 0); + + /* Start reading */ + r = uv_read_start(stream, alloc_cb, read_cb); + ASSERT(r == 0); +} + + +TEST_IMPL(tcp_open) { + struct sockaddr_in addr; + uv_tcp_t client; + uv_os_sock_t sock; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + startup(); + sock = create_tcp_socket(); + + r = uv_tcp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + r = uv_tcp_open(&client, sock); + ASSERT(r == 0); + + r = uv_tcp_connect(&connect_req, + &client, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(shutdown_cb_called == 1); + ASSERT(connect_cb_called == 1); + ASSERT(write_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tcp_open_twice) { + uv_tcp_t client; + uv_os_sock_t sock1, sock2; + int r; + + startup(); + sock1 = create_tcp_socket(); + sock2 = create_tcp_socket(); + + r = uv_tcp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + r = uv_tcp_open(&client, sock1); + ASSERT(r == 0); + + r = uv_tcp_open(&client, sock2); + ASSERT(r == UV_EBUSY); + close_socket(sock2); + + uv_close((uv_handle_t*) &client, NULL); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-read-stop.c b/3rdparty/libuv/test/test-tcp-read-stop.c new file mode 100644 index 00000000000..488e8fb49a9 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-read-stop.c @@ -0,0 +1,76 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static uv_timer_t timer_handle; +static uv_tcp_t tcp_handle; +static uv_write_t write_req; + + +static void fail_cb(void) { + ASSERT(0 && "fail_cb called"); +} + + +static void write_cb(uv_write_t* req, int status) { + uv_close((uv_handle_t*) &timer_handle, NULL); + uv_close((uv_handle_t*) &tcp_handle, NULL); +} + + +static void timer_cb(uv_timer_t* handle) { + uv_buf_t buf = uv_buf_init("PING", 4); + ASSERT(0 == uv_write(&write_req, + (uv_stream_t*) &tcp_handle, + &buf, + 1, + write_cb)); + ASSERT(0 == uv_read_stop((uv_stream_t*) &tcp_handle)); +} + + +static void connect_cb(uv_connect_t* req, int status) { + ASSERT(0 == status); + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 50, 0)); + ASSERT(0 == uv_read_start((uv_stream_t*) &tcp_handle, + (uv_alloc_cb) fail_cb, + (uv_read_cb) fail_cb)); +} + + +TEST_IMPL(tcp_read_stop) { + uv_connect_t connect_req; + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + ASSERT(0 == uv_timer_init(uv_default_loop(), &timer_handle)); + ASSERT(0 == uv_tcp_init(uv_default_loop(), &tcp_handle)); + ASSERT(0 == uv_tcp_connect(&connect_req, + &tcp_handle, + (const struct sockaddr*) &addr, + connect_cb)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + MAKE_VALGRIND_HAPPY(); + + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-shutdown-after-write.c b/3rdparty/libuv/test/test-tcp-shutdown-after-write.c new file mode 100644 index 00000000000..463b4b0d79c --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-shutdown-after-write.c @@ -0,0 +1,138 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static void write_cb(uv_write_t* req, int status); +static void shutdown_cb(uv_shutdown_t* req, int status); + +static uv_tcp_t conn; +static uv_timer_t timer; +static uv_connect_t connect_req; +static uv_write_t write_req; +static uv_shutdown_t shutdown_req; + +static int connect_cb_called; +static int write_cb_called; +static int shutdown_cb_called; + +static int conn_close_cb_called; +static int timer_close_cb_called; + + +static void close_cb(uv_handle_t* handle) { + if (handle == (uv_handle_t*)&conn) + conn_close_cb_called++; + else if (handle == (uv_handle_t*)&timer) + timer_close_cb_called++; + else + ASSERT(0 && "bad handle in close_cb"); +} + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[64]; + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void timer_cb(uv_timer_t* handle) { + uv_buf_t buf; + int r; + + uv_close((uv_handle_t*)handle, close_cb); + + buf = uv_buf_init("TEST", 4); + r = uv_write(&write_req, (uv_stream_t*)&conn, &buf, 1, write_cb); + ASSERT(r == 0); + + r = uv_shutdown(&shutdown_req, (uv_stream_t*)&conn, shutdown_cb); + ASSERT(r == 0); +} + + +static void read_cb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { +} + + +static void connect_cb(uv_connect_t* req, int status) { + int r; + + ASSERT(status == 0); + connect_cb_called++; + + r = uv_read_start((uv_stream_t*)&conn, alloc_cb, read_cb); + ASSERT(r == 0); +} + + +static void write_cb(uv_write_t* req, int status) { + ASSERT(status == 0); + write_cb_called++; +} + + +static void shutdown_cb(uv_shutdown_t* req, int status) { + ASSERT(status == 0); + shutdown_cb_called++; + uv_close((uv_handle_t*)&conn, close_cb); +} + + +TEST_IMPL(tcp_shutdown_after_write) { + struct sockaddr_in addr; + uv_loop_t* loop; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + loop = uv_default_loop(); + + r = uv_timer_init(loop, &timer); + ASSERT(r == 0); + + r = uv_timer_start(&timer, timer_cb, 125, 0); + ASSERT(r == 0); + + r = uv_tcp_init(loop, &conn); + ASSERT(r == 0); + + r = uv_tcp_connect(&connect_req, + &conn, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(connect_cb_called == 1); + ASSERT(write_cb_called == 1); + ASSERT(shutdown_cb_called == 1); + ASSERT(conn_close_cb_called == 1); + ASSERT(timer_close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-try-write.c b/3rdparty/libuv/test/test-tcp-try-write.c new file mode 100644 index 00000000000..97a1d6e3d57 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-try-write.c @@ -0,0 +1,135 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#define MAX_BYTES 1024 * 1024 + +static uv_tcp_t server; +static uv_tcp_t client; +static uv_tcp_t incoming; +static int connect_cb_called; +static int close_cb_called; +static int connection_cb_called; +static int bytes_read; +static int bytes_written; + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +static void connect_cb(uv_connect_t* req, int status) { + int r; + uv_buf_t buf; + ASSERT(status == 0); + connect_cb_called++; + + do { + buf = uv_buf_init("PING", 4); + r = uv_try_write((uv_stream_t*) &client, &buf, 1); + ASSERT(r > 0 || r == UV_EAGAIN); + if (r > 0) { + bytes_written += r; + break; + } + } while (1); + + do { + buf = uv_buf_init("", 0); + r = uv_try_write((uv_stream_t*) &client, &buf, 1); + } while (r != 0); + uv_close((uv_handle_t*) &client, close_cb); +} + + +static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + static char base[1024]; + + buf->base = base; + buf->len = sizeof(base); +} + + +static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { + if (nread < 0) { + uv_close((uv_handle_t*) tcp, close_cb); + uv_close((uv_handle_t*) &server, close_cb); + return; + } + + bytes_read += nread; +} + + +static void connection_cb(uv_stream_t* tcp, int status) { + ASSERT(status == 0); + + ASSERT(0 == uv_tcp_init(tcp->loop, &incoming)); + ASSERT(0 == uv_accept(tcp, (uv_stream_t*) &incoming)); + + connection_cb_called++; + ASSERT(0 == uv_read_start((uv_stream_t*) &incoming, alloc_cb, read_cb)); +} + + +static void start_server(void) { + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + ASSERT(0 == uv_tcp_init(uv_default_loop(), &server)); + ASSERT(0 == uv_tcp_bind(&server, (struct sockaddr*) &addr, 0)); + ASSERT(0 == uv_listen((uv_stream_t*) &server, 128, connection_cb)); +} + + +TEST_IMPL(tcp_try_write) { + uv_connect_t connect_req; + struct sockaddr_in addr; + + start_server(); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + ASSERT(0 == uv_tcp_init(uv_default_loop(), &client)); + ASSERT(0 == uv_tcp_connect(&connect_req, + &client, + (struct sockaddr*) &addr, + connect_cb)); + + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + ASSERT(connect_cb_called == 1); + ASSERT(close_cb_called == 3); + ASSERT(connection_cb_called == 1); + ASSERT(bytes_read == bytes_written); + ASSERT(bytes_written > 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-unexpected-read.c b/3rdparty/libuv/test/test-tcp-unexpected-read.c new file mode 100644 index 00000000000..c7b981456be --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-unexpected-read.c @@ -0,0 +1,117 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static uv_check_t check_handle; +static uv_timer_t timer_handle; +static uv_tcp_t server_handle; +static uv_tcp_t client_handle; +static uv_tcp_t peer_handle; +static uv_write_t write_req; +static uv_connect_t connect_req; + +static unsigned long ticks; /* event loop ticks */ + + +static void check_cb(uv_check_t* handle) { + ticks++; +} + + +static void timer_cb(uv_timer_t* handle) { + uv_close((uv_handle_t*) &check_handle, NULL); + uv_close((uv_handle_t*) &timer_handle, NULL); + uv_close((uv_handle_t*) &server_handle, NULL); + uv_close((uv_handle_t*) &client_handle, NULL); + uv_close((uv_handle_t*) &peer_handle, NULL); +} + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + ASSERT(0 && "alloc_cb should not have been called"); +} + + +static void read_cb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { + ASSERT(0 && "read_cb should not have been called"); +} + + +static void connect_cb(uv_connect_t* req, int status) { + ASSERT(req->handle == (uv_stream_t*) &client_handle); + ASSERT(0 == status); +} + + +static void write_cb(uv_write_t* req, int status) { + ASSERT(req->handle == (uv_stream_t*) &peer_handle); + ASSERT(0 == status); +} + + +static void connection_cb(uv_stream_t* handle, int status) { + uv_buf_t buf; + + buf = uv_buf_init("PING", 4); + + ASSERT(0 == status); + ASSERT(0 == uv_accept(handle, (uv_stream_t*) &peer_handle)); + ASSERT(0 == uv_read_start((uv_stream_t*) &peer_handle, alloc_cb, read_cb)); + ASSERT(0 == uv_write(&write_req, (uv_stream_t*) &peer_handle, + &buf, 1, write_cb)); +} + + +TEST_IMPL(tcp_unexpected_read) { + struct sockaddr_in addr; + uv_loop_t* loop; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + loop = uv_default_loop(); + + ASSERT(0 == uv_timer_init(loop, &timer_handle)); + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 1000, 0)); + ASSERT(0 == uv_check_init(loop, &check_handle)); + ASSERT(0 == uv_check_start(&check_handle, check_cb)); + ASSERT(0 == uv_tcp_init(loop, &server_handle)); + ASSERT(0 == uv_tcp_init(loop, &client_handle)); + ASSERT(0 == uv_tcp_init(loop, &peer_handle)); + ASSERT(0 == uv_tcp_bind(&server_handle, (const struct sockaddr*) &addr, 0)); + ASSERT(0 == uv_listen((uv_stream_t*) &server_handle, 1, connection_cb)); + ASSERT(0 == uv_tcp_connect(&connect_req, + &client_handle, + (const struct sockaddr*) &addr, + connect_cb)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + /* This is somewhat inexact but the idea is that the event loop should not + * start busy looping when the server sends a message and the client isn't + * reading. + */ + ASSERT(ticks <= 20); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-write-after-connect.c b/3rdparty/libuv/test/test-tcp-write-after-connect.c new file mode 100644 index 00000000000..aa03228f134 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-write-after-connect.c @@ -0,0 +1,68 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef _WIN32 + +#include "uv.h" +#include "task.h" + +uv_loop_t loop; +uv_tcp_t tcp_client; +uv_connect_t connection_request; +uv_write_t write_request; +uv_buf_t buf = { "HELLO", 4 }; + + +static void write_cb(uv_write_t *req, int status) { + ASSERT(status == UV_ECANCELED); + uv_close((uv_handle_t*) req->handle, NULL); +} + + +static void connect_cb(uv_connect_t *req, int status) { + ASSERT(status == UV_ECONNREFUSED); +} + + +TEST_IMPL(tcp_write_after_connect) { + struct sockaddr_in sa; + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &sa)); + ASSERT(0 == uv_loop_init(&loop)); + ASSERT(0 == uv_tcp_init(&loop, &tcp_client)); + + ASSERT(0 == uv_tcp_connect(&connection_request, + &tcp_client, + (const struct sockaddr *) + &sa, + connect_cb)); + + ASSERT(0 == uv_write(&write_request, + (uv_stream_t *)&tcp_client, + &buf, 1, + write_cb)); + + uv_run(&loop, UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif diff --git a/3rdparty/libuv/test/test-tcp-write-fail.c b/3rdparty/libuv/test/test-tcp-write-fail.c new file mode 100644 index 00000000000..5256a9f4a79 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-write-fail.c @@ -0,0 +1,115 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include +#ifndef _WIN32 +# include +#endif + + +static int connect_cb_called = 0; +static int write_cb_called = 0; +static int close_cb_called = 0; + +static uv_connect_t connect_req; +static uv_write_t write_req; + + +static void close_socket(uv_tcp_t* sock) { + uv_os_fd_t fd; + int r; + + r = uv_fileno((uv_handle_t*)sock, &fd); + ASSERT(r == 0); +#ifdef _WIN32 + r = closesocket((uv_os_sock_t)fd); +#else + r = close(fd); +#endif + ASSERT(r == 0); +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +static void write_cb(uv_write_t* req, int status) { + ASSERT(req != NULL); + + ASSERT(status != 0); + fprintf(stderr, "uv_write error: %s\n", uv_strerror(status)); + write_cb_called++; + + uv_close((uv_handle_t*)(req->handle), close_cb); +} + + +static void connect_cb(uv_connect_t* req, int status) { + uv_buf_t buf; + uv_stream_t* stream; + int r; + + ASSERT(req == &connect_req); + ASSERT(status == 0); + + stream = req->handle; + connect_cb_called++; + + /* close the socket, the hard way */ + close_socket((uv_tcp_t*)stream); + + buf = uv_buf_init("hello\n", 6); + r = uv_write(&write_req, stream, &buf, 1, write_cb); + ASSERT(r == 0); +} + + +TEST_IMPL(tcp_write_fail) { + struct sockaddr_in addr; + uv_tcp_t client; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + r = uv_tcp_connect(&connect_req, + &client, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(connect_cb_called == 1); + ASSERT(write_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-write-queue-order.c b/3rdparty/libuv/test/test-tcp-write-queue-order.c new file mode 100644 index 00000000000..aa4d2acc24a --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-write-queue-order.c @@ -0,0 +1,137 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include + +#include "uv.h" +#include "task.h" + +#define REQ_COUNT 10000 + +static uv_timer_t timer; +static uv_tcp_t server; +static uv_tcp_t client; +static uv_tcp_t incoming; +static int connect_cb_called; +static int close_cb_called; +static int connection_cb_called; +static int write_callbacks; +static int write_cancelled_callbacks; +static int write_error_callbacks; + +static uv_write_t write_requests[REQ_COUNT]; + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + +void timer_cb(uv_timer_t* handle) { + uv_close((uv_handle_t*) &client, close_cb); + uv_close((uv_handle_t*) &server, close_cb); + uv_close((uv_handle_t*) &incoming, close_cb); +} + +void write_cb(uv_write_t* req, int status) { + if (status == 0) + write_callbacks++; + else if (status == UV_ECANCELED) + write_cancelled_callbacks++; + else + write_error_callbacks++; +} + +static void connect_cb(uv_connect_t* req, int status) { + static char base[1024]; + int r; + int i; + uv_buf_t buf; + + ASSERT(status == 0); + connect_cb_called++; + + buf = uv_buf_init(base, sizeof(base)); + + for (i = 0; i < REQ_COUNT; i++) { + r = uv_write(&write_requests[i], + req->handle, + &buf, + 1, + write_cb); + ASSERT(r == 0); + } +} + + +static void connection_cb(uv_stream_t* tcp, int status) { + ASSERT(status == 0); + + ASSERT(0 == uv_tcp_init(tcp->loop, &incoming)); + ASSERT(0 == uv_accept(tcp, (uv_stream_t*) &incoming)); + + connection_cb_called++; +} + + +static void start_server(void) { + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + ASSERT(0 == uv_tcp_init(uv_default_loop(), &server)); + ASSERT(0 == uv_tcp_bind(&server, (struct sockaddr*) &addr, 0)); + ASSERT(0 == uv_listen((uv_stream_t*) &server, 128, connection_cb)); +} + + +TEST_IMPL(tcp_write_queue_order) { + uv_connect_t connect_req; + struct sockaddr_in addr; + + start_server(); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + ASSERT(0 == uv_tcp_init(uv_default_loop(), &client)); + ASSERT(0 == uv_tcp_connect(&connect_req, + &client, + (struct sockaddr*) &addr, + connect_cb)); + + ASSERT(0 == uv_timer_init(uv_default_loop(), &timer)); + ASSERT(0 == uv_timer_start(&timer, timer_cb, 100, 0)); + + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + ASSERT(connect_cb_called == 1); + ASSERT(connection_cb_called == 1); + ASSERT(write_callbacks > 0); + ASSERT(write_cancelled_callbacks > 0); + ASSERT(write_callbacks + + write_error_callbacks + + write_cancelled_callbacks == REQ_COUNT); + ASSERT(close_cb_called == 3); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-write-to-half-open-connection.c b/3rdparty/libuv/test/test-tcp-write-to-half-open-connection.c new file mode 100644 index 00000000000..2fa2ae72253 --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-write-to-half-open-connection.c @@ -0,0 +1,141 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +static void connection_cb(uv_stream_t* server, int status); +static void connect_cb(uv_connect_t* req, int status); +static void write_cb(uv_write_t* req, int status); +static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); +static void alloc_cb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf); + +static uv_tcp_t tcp_server; +static uv_tcp_t tcp_client; +static uv_tcp_t tcp_peer; /* client socket as accept()-ed by server */ +static uv_connect_t connect_req; +static uv_write_t write_req; + +static int write_cb_called; +static int read_cb_called; + +static void connection_cb(uv_stream_t* server, int status) { + int r; + uv_buf_t buf; + + ASSERT(server == (uv_stream_t*)&tcp_server); + ASSERT(status == 0); + + r = uv_tcp_init(server->loop, &tcp_peer); + ASSERT(r == 0); + + r = uv_accept(server, (uv_stream_t*)&tcp_peer); + ASSERT(r == 0); + + r = uv_read_start((uv_stream_t*)&tcp_peer, alloc_cb, read_cb); + ASSERT(r == 0); + + buf.base = "hello\n"; + buf.len = 6; + + r = uv_write(&write_req, (uv_stream_t*)&tcp_peer, &buf, 1, write_cb); + ASSERT(r == 0); +} + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[1024]; + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { + if (nread < 0) { + fprintf(stderr, "read_cb error: %s\n", uv_err_name(nread)); + ASSERT(nread == UV_ECONNRESET || nread == UV_EOF); + + uv_close((uv_handle_t*)&tcp_server, NULL); + uv_close((uv_handle_t*)&tcp_peer, NULL); + } + + read_cb_called++; +} + + +static void connect_cb(uv_connect_t* req, int status) { + ASSERT(req == &connect_req); + ASSERT(status == 0); + + /* Close the client. */ + uv_close((uv_handle_t*)&tcp_client, NULL); +} + + +static void write_cb(uv_write_t* req, int status) { + ASSERT(status == 0); + write_cb_called++; +} + + +TEST_IMPL(tcp_write_to_half_open_connection) { + struct sockaddr_in addr; + uv_loop_t* loop; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + loop = uv_default_loop(); + ASSERT(loop != NULL); + + r = uv_tcp_init(loop, &tcp_server); + ASSERT(r == 0); + + r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_listen((uv_stream_t*)&tcp_server, 1, connection_cb); + ASSERT(r == 0); + + r = uv_tcp_init(loop, &tcp_client); + ASSERT(r == 0); + + r = uv_tcp_connect(&connect_req, + &tcp_client, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(write_cb_called > 0); + ASSERT(read_cb_called > 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tcp-writealot.c b/3rdparty/libuv/test/test-tcp-writealot.c new file mode 100644 index 00000000000..6cfe2ebb18d --- /dev/null +++ b/3rdparty/libuv/test/test-tcp-writealot.c @@ -0,0 +1,176 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include + + +#define WRITES 3 +#define CHUNKS_PER_WRITE 4096 +#define CHUNK_SIZE 10024 /* 10 kb */ + +#define TOTAL_BYTES (WRITES * CHUNKS_PER_WRITE * CHUNK_SIZE) + +static char* send_buffer; + +static int shutdown_cb_called = 0; +static int connect_cb_called = 0; +static int write_cb_called = 0; +static int close_cb_called = 0; +static size_t bytes_sent = 0; +static size_t bytes_sent_done = 0; +static size_t bytes_received_done = 0; + +static uv_connect_t connect_req; +static uv_shutdown_t shutdown_req; +static uv_write_t write_reqs[WRITES]; + + +static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + buf->base = malloc(size); + buf->len = size; +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +static void shutdown_cb(uv_shutdown_t* req, int status) { + uv_tcp_t* tcp; + + ASSERT(req == &shutdown_req); + ASSERT(status == 0); + + tcp = (uv_tcp_t*)(req->handle); + + /* The write buffer should be empty by now. */ + ASSERT(tcp->write_queue_size == 0); + + /* Now we wait for the EOF */ + shutdown_cb_called++; + + /* We should have had all the writes called already. */ + ASSERT(write_cb_called == WRITES); +} + + +static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { + ASSERT(tcp != NULL); + + if (nread >= 0) { + bytes_received_done += nread; + } + else { + ASSERT(nread == UV_EOF); + printf("GOT EOF\n"); + uv_close((uv_handle_t*)tcp, close_cb); + } + + free(buf->base); +} + + +static void write_cb(uv_write_t* req, int status) { + ASSERT(req != NULL); + + if (status) { + fprintf(stderr, "uv_write error: %s\n", uv_strerror(status)); + ASSERT(0); + } + + bytes_sent_done += CHUNKS_PER_WRITE * CHUNK_SIZE; + write_cb_called++; +} + + +static void connect_cb(uv_connect_t* req, int status) { + uv_buf_t send_bufs[CHUNKS_PER_WRITE]; + uv_stream_t* stream; + int i, j, r; + + ASSERT(req == &connect_req); + ASSERT(status == 0); + + stream = req->handle; + connect_cb_called++; + + /* Write a lot of data */ + for (i = 0; i < WRITES; i++) { + uv_write_t* write_req = write_reqs + i; + + for (j = 0; j < CHUNKS_PER_WRITE; j++) { + send_bufs[j] = uv_buf_init(send_buffer + bytes_sent, CHUNK_SIZE); + bytes_sent += CHUNK_SIZE; + } + + r = uv_write(write_req, stream, send_bufs, CHUNKS_PER_WRITE, write_cb); + ASSERT(r == 0); + } + + /* Shutdown on drain. */ + r = uv_shutdown(&shutdown_req, stream, shutdown_cb); + ASSERT(r == 0); + + /* Start reading */ + r = uv_read_start(stream, alloc_cb, read_cb); + ASSERT(r == 0); +} + + +TEST_IMPL(tcp_writealot) { + struct sockaddr_in addr; + uv_tcp_t client; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + send_buffer = calloc(1, TOTAL_BYTES); + ASSERT(send_buffer != NULL); + + r = uv_tcp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + r = uv_tcp_connect(&connect_req, + &client, + (const struct sockaddr*) &addr, + connect_cb); + ASSERT(r == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(shutdown_cb_called == 1); + ASSERT(connect_cb_called == 1); + ASSERT(write_cb_called == WRITES); + ASSERT(close_cb_called == 1); + ASSERT(bytes_sent == TOTAL_BYTES); + ASSERT(bytes_sent_done == TOTAL_BYTES); + ASSERT(bytes_received_done == TOTAL_BYTES); + + free(send_buffer); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-thread-equal.c b/3rdparty/libuv/test/test-thread-equal.c new file mode 100644 index 00000000000..27c07ee2c7d --- /dev/null +++ b/3rdparty/libuv/test/test-thread-equal.c @@ -0,0 +1,45 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +uv_thread_t main_thread_id; +uv_thread_t subthreads[2]; + +static void check_thread(void* arg) { + uv_thread_t *thread_id = arg; + uv_thread_t self_id = uv_thread_self(); + ASSERT(uv_thread_equal(&main_thread_id, &self_id) == 0); + *thread_id = uv_thread_self(); +} + +TEST_IMPL(thread_equal) { + uv_thread_t threads[2]; + main_thread_id = uv_thread_self(); + ASSERT(0 != uv_thread_equal(&main_thread_id, &main_thread_id)); + ASSERT(0 == uv_thread_create(threads + 0, check_thread, subthreads + 0)); + ASSERT(0 == uv_thread_create(threads + 1, check_thread, subthreads + 1)); + ASSERT(0 == uv_thread_join(threads + 0)); + ASSERT(0 == uv_thread_join(threads + 1)); + ASSERT(0 == uv_thread_equal(subthreads + 0, subthreads + 1)); + return 0; +} diff --git a/3rdparty/libuv/test/test-thread.c b/3rdparty/libuv/test/test-thread.c new file mode 100644 index 00000000000..7f3321aa06d --- /dev/null +++ b/3rdparty/libuv/test/test-thread.c @@ -0,0 +1,211 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include /* memset */ + +struct getaddrinfo_req { + uv_thread_t thread_id; + unsigned int counter; + uv_loop_t* loop; + uv_getaddrinfo_t handle; +}; + + +struct fs_req { + uv_thread_t thread_id; + unsigned int counter; + uv_loop_t* loop; + uv_fs_t handle; +}; + + +struct test_thread { + uv_thread_t thread_id; + volatile int thread_called; +}; + +static void getaddrinfo_do(struct getaddrinfo_req* req); +static void getaddrinfo_cb(uv_getaddrinfo_t* handle, + int status, + struct addrinfo* res); +static void fs_do(struct fs_req* req); +static void fs_cb(uv_fs_t* handle); + +static volatile int thread_called; +static uv_key_t tls_key; + + +static void getaddrinfo_do(struct getaddrinfo_req* req) { + int r; + + r = uv_getaddrinfo(req->loop, + &req->handle, + getaddrinfo_cb, + "localhost", + NULL, + NULL); + ASSERT(r == 0); +} + + +static void getaddrinfo_cb(uv_getaddrinfo_t* handle, + int status, + struct addrinfo* res) { + struct getaddrinfo_req* req; + + ASSERT(status == 0); + + req = container_of(handle, struct getaddrinfo_req, handle); + uv_freeaddrinfo(res); + + if (--req->counter) + getaddrinfo_do(req); +} + + +static void fs_do(struct fs_req* req) { + int r; + + r = uv_fs_stat(req->loop, &req->handle, ".", fs_cb); + ASSERT(r == 0); +} + + +static void fs_cb(uv_fs_t* handle) { + struct fs_req* req = container_of(handle, struct fs_req, handle); + + uv_fs_req_cleanup(handle); + + if (--req->counter) + fs_do(req); +} + + +static void do_work(void* arg) { + struct getaddrinfo_req getaddrinfo_reqs[16]; + struct fs_req fs_reqs[16]; + uv_loop_t* loop; + size_t i; + int r; + struct test_thread* thread = arg; + + loop = malloc(sizeof *loop); + ASSERT(loop != NULL); + ASSERT(0 == uv_loop_init(loop)); + + for (i = 0; i < ARRAY_SIZE(getaddrinfo_reqs); i++) { + struct getaddrinfo_req* req = getaddrinfo_reqs + i; + req->counter = 16; + req->loop = loop; + getaddrinfo_do(req); + } + + for (i = 0; i < ARRAY_SIZE(fs_reqs); i++) { + struct fs_req* req = fs_reqs + i; + req->counter = 16; + req->loop = loop; + fs_do(req); + } + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(0 == uv_loop_close(loop)); + free(loop); + thread->thread_called = 1; +} + + +static void thread_entry(void* arg) { + ASSERT(arg == (void *) 42); + thread_called++; +} + + +TEST_IMPL(thread_create) { + uv_thread_t tid; + int r; + + r = uv_thread_create(&tid, thread_entry, (void *) 42); + ASSERT(r == 0); + + r = uv_thread_join(&tid); + ASSERT(r == 0); + + ASSERT(thread_called == 1); + + return 0; +} + + +/* Hilariously bad test name. Run a lot of tasks in the thread pool and verify + * that each "finished" callback is run in its originating thread. + */ +TEST_IMPL(threadpool_multiple_event_loops) { + struct test_thread threads[8]; + size_t i; + int r; + + memset(threads, 0, sizeof(threads)); + + for (i = 0; i < ARRAY_SIZE(threads); i++) { + r = uv_thread_create(&threads[i].thread_id, do_work, &threads[i]); + ASSERT(r == 0); + } + + for (i = 0; i < ARRAY_SIZE(threads); i++) { + r = uv_thread_join(&threads[i].thread_id); + ASSERT(r == 0); + ASSERT(threads[i].thread_called); + } + + return 0; +} + + +static void tls_thread(void* arg) { + ASSERT(NULL == uv_key_get(&tls_key)); + uv_key_set(&tls_key, arg); + ASSERT(arg == uv_key_get(&tls_key)); + uv_key_set(&tls_key, NULL); + ASSERT(NULL == uv_key_get(&tls_key)); +} + + +TEST_IMPL(thread_local_storage) { + char name[] = "main"; + uv_thread_t threads[2]; + ASSERT(0 == uv_key_create(&tls_key)); + ASSERT(NULL == uv_key_get(&tls_key)); + uv_key_set(&tls_key, name); + ASSERT(name == uv_key_get(&tls_key)); + ASSERT(0 == uv_thread_create(threads + 0, tls_thread, threads + 0)); + ASSERT(0 == uv_thread_create(threads + 1, tls_thread, threads + 1)); + ASSERT(0 == uv_thread_join(threads + 0)); + ASSERT(0 == uv_thread_join(threads + 1)); + uv_key_delete(&tls_key); + return 0; +} diff --git a/3rdparty/libuv/test/test-threadpool-cancel.c b/3rdparty/libuv/test/test-threadpool-cancel.c new file mode 100644 index 00000000000..784c1739f6d --- /dev/null +++ b/3rdparty/libuv/test/test-threadpool-cancel.c @@ -0,0 +1,362 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#define INIT_CANCEL_INFO(ci, what) \ + do { \ + (ci)->reqs = (what); \ + (ci)->nreqs = ARRAY_SIZE(what); \ + (ci)->stride = sizeof((what)[0]); \ + } \ + while (0) + +struct cancel_info { + void* reqs; + unsigned nreqs; + unsigned stride; + uv_timer_t timer_handle; +}; + +static uv_cond_t signal_cond; +static uv_mutex_t signal_mutex; +static uv_mutex_t wait_mutex; +static unsigned num_threads; +static unsigned fs_cb_called; +static unsigned work_cb_called; +static unsigned done_cb_called; +static unsigned done2_cb_called; +static unsigned timer_cb_called; + + +static void work_cb(uv_work_t* req) { + uv_mutex_lock(&signal_mutex); + uv_cond_signal(&signal_cond); + uv_mutex_unlock(&signal_mutex); + + uv_mutex_lock(&wait_mutex); + uv_mutex_unlock(&wait_mutex); + + work_cb_called++; +} + + +static void done_cb(uv_work_t* req, int status) { + done_cb_called++; + free(req); +} + + +static void saturate_threadpool(void) { + uv_work_t* req; + + ASSERT(0 == uv_cond_init(&signal_cond)); + ASSERT(0 == uv_mutex_init(&signal_mutex)); + ASSERT(0 == uv_mutex_init(&wait_mutex)); + + uv_mutex_lock(&signal_mutex); + uv_mutex_lock(&wait_mutex); + + for (num_threads = 0; /* empty */; num_threads++) { + req = malloc(sizeof(*req)); + ASSERT(req != NULL); + ASSERT(0 == uv_queue_work(uv_default_loop(), req, work_cb, done_cb)); + + /* Expect to get signalled within 350 ms, otherwise assume that + * the thread pool is saturated. As with any timing dependent test, + * this is obviously not ideal. + */ + if (uv_cond_timedwait(&signal_cond, + &signal_mutex, + (uint64_t) (350 * 1e6))) { + ASSERT(0 == uv_cancel((uv_req_t*) req)); + break; + } + } +} + + +static void unblock_threadpool(void) { + uv_mutex_unlock(&signal_mutex); + uv_mutex_unlock(&wait_mutex); +} + + +static void cleanup_threadpool(void) { + ASSERT(done_cb_called == num_threads + 1); /* +1 == cancelled work req. */ + ASSERT(work_cb_called == num_threads); + + uv_cond_destroy(&signal_cond); + uv_mutex_destroy(&signal_mutex); + uv_mutex_destroy(&wait_mutex); +} + + +static void fs_cb(uv_fs_t* req) { + ASSERT(req->result == UV_ECANCELED); + uv_fs_req_cleanup(req); + fs_cb_called++; +} + + +static void getaddrinfo_cb(uv_getaddrinfo_t* req, + int status, + struct addrinfo* res) { + ASSERT(status == UV_EAI_CANCELED); + ASSERT(res == NULL); + uv_freeaddrinfo(res); /* Should not crash. */ +} + + +static void getnameinfo_cb(uv_getnameinfo_t* handle, + int status, + const char* hostname, + const char* service) { + ASSERT(status == UV_EAI_CANCELED); + ASSERT(hostname == NULL); + ASSERT(service == NULL); +} + + +static void work2_cb(uv_work_t* req) { + ASSERT(0 && "work2_cb called"); +} + + +static void done2_cb(uv_work_t* req, int status) { + ASSERT(status == UV_ECANCELED); + done2_cb_called++; +} + + +static void timer_cb(uv_timer_t* handle) { + struct cancel_info* ci; + uv_req_t* req; + unsigned i; + + ci = container_of(handle, struct cancel_info, timer_handle); + + for (i = 0; i < ci->nreqs; i++) { + req = (uv_req_t*) ((char*) ci->reqs + i * ci->stride); + ASSERT(0 == uv_cancel(req)); + } + + uv_close((uv_handle_t*) &ci->timer_handle, NULL); + unblock_threadpool(); + timer_cb_called++; +} + + +static void nop_work_cb(uv_work_t* req) { +} + + +static void nop_done_cb(uv_work_t* req, int status) { + req->data = "OK"; +} + + +TEST_IMPL(threadpool_cancel_getaddrinfo) { + uv_getaddrinfo_t reqs[4]; + struct cancel_info ci; + struct addrinfo hints; + uv_loop_t* loop; + int r; + + INIT_CANCEL_INFO(&ci, reqs); + loop = uv_default_loop(); + saturate_threadpool(); + + r = uv_getaddrinfo(loop, reqs + 0, getaddrinfo_cb, "fail", NULL, NULL); + ASSERT(r == 0); + + r = uv_getaddrinfo(loop, reqs + 1, getaddrinfo_cb, NULL, "fail", NULL); + ASSERT(r == 0); + + r = uv_getaddrinfo(loop, reqs + 2, getaddrinfo_cb, "fail", "fail", NULL); + ASSERT(r == 0); + + r = uv_getaddrinfo(loop, reqs + 3, getaddrinfo_cb, "fail", NULL, &hints); + ASSERT(r == 0); + + ASSERT(0 == uv_timer_init(loop, &ci.timer_handle)); + ASSERT(0 == uv_timer_start(&ci.timer_handle, timer_cb, 10, 0)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(1 == timer_cb_called); + + cleanup_threadpool(); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(threadpool_cancel_getnameinfo) { + uv_getnameinfo_t reqs[4]; + struct sockaddr_in addr4; + struct cancel_info ci; + uv_loop_t* loop; + int r; + + r = uv_ip4_addr("127.0.0.1", 80, &addr4); + ASSERT(r == 0); + + INIT_CANCEL_INFO(&ci, reqs); + loop = uv_default_loop(); + saturate_threadpool(); + + r = uv_getnameinfo(loop, reqs + 0, getnameinfo_cb, (const struct sockaddr*)&addr4, 0); + ASSERT(r == 0); + + r = uv_getnameinfo(loop, reqs + 1, getnameinfo_cb, (const struct sockaddr*)&addr4, 0); + ASSERT(r == 0); + + r = uv_getnameinfo(loop, reqs + 2, getnameinfo_cb, (const struct sockaddr*)&addr4, 0); + ASSERT(r == 0); + + r = uv_getnameinfo(loop, reqs + 3, getnameinfo_cb, (const struct sockaddr*)&addr4, 0); + ASSERT(r == 0); + + ASSERT(0 == uv_timer_init(loop, &ci.timer_handle)); + ASSERT(0 == uv_timer_start(&ci.timer_handle, timer_cb, 10, 0)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(1 == timer_cb_called); + + cleanup_threadpool(); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(threadpool_cancel_work) { + struct cancel_info ci; + uv_work_t reqs[16]; + uv_loop_t* loop; + unsigned i; + + INIT_CANCEL_INFO(&ci, reqs); + loop = uv_default_loop(); + saturate_threadpool(); + + for (i = 0; i < ARRAY_SIZE(reqs); i++) + ASSERT(0 == uv_queue_work(loop, reqs + i, work2_cb, done2_cb)); + + ASSERT(0 == uv_timer_init(loop, &ci.timer_handle)); + ASSERT(0 == uv_timer_start(&ci.timer_handle, timer_cb, 10, 0)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(1 == timer_cb_called); + ASSERT(ARRAY_SIZE(reqs) == done2_cb_called); + + cleanup_threadpool(); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(threadpool_cancel_fs) { + struct cancel_info ci; + uv_fs_t reqs[26]; + uv_loop_t* loop; + unsigned n; + uv_buf_t iov; + + INIT_CANCEL_INFO(&ci, reqs); + loop = uv_default_loop(); + saturate_threadpool(); + iov = uv_buf_init(NULL, 0); + + /* Needs to match ARRAY_SIZE(fs_reqs). */ + n = 0; + ASSERT(0 == uv_fs_chmod(loop, reqs + n++, "/", 0, fs_cb)); + ASSERT(0 == uv_fs_chown(loop, reqs + n++, "/", 0, 0, fs_cb)); + ASSERT(0 == uv_fs_close(loop, reqs + n++, 0, fs_cb)); + ASSERT(0 == uv_fs_fchmod(loop, reqs + n++, 0, 0, fs_cb)); + ASSERT(0 == uv_fs_fchown(loop, reqs + n++, 0, 0, 0, fs_cb)); + ASSERT(0 == uv_fs_fdatasync(loop, reqs + n++, 0, fs_cb)); + ASSERT(0 == uv_fs_fstat(loop, reqs + n++, 0, fs_cb)); + ASSERT(0 == uv_fs_fsync(loop, reqs + n++, 0, fs_cb)); + ASSERT(0 == uv_fs_ftruncate(loop, reqs + n++, 0, 0, fs_cb)); + ASSERT(0 == uv_fs_futime(loop, reqs + n++, 0, 0, 0, fs_cb)); + ASSERT(0 == uv_fs_link(loop, reqs + n++, "/", "/", fs_cb)); + ASSERT(0 == uv_fs_lstat(loop, reqs + n++, "/", fs_cb)); + ASSERT(0 == uv_fs_mkdir(loop, reqs + n++, "/", 0, fs_cb)); + ASSERT(0 == uv_fs_open(loop, reqs + n++, "/", 0, 0, fs_cb)); + ASSERT(0 == uv_fs_read(loop, reqs + n++, 0, &iov, 1, 0, fs_cb)); + ASSERT(0 == uv_fs_scandir(loop, reqs + n++, "/", 0, fs_cb)); + ASSERT(0 == uv_fs_readlink(loop, reqs + n++, "/", fs_cb)); + ASSERT(0 == uv_fs_realpath(loop, reqs + n++, "/", fs_cb)); + ASSERT(0 == uv_fs_rename(loop, reqs + n++, "/", "/", fs_cb)); + ASSERT(0 == uv_fs_mkdir(loop, reqs + n++, "/", 0, fs_cb)); + ASSERT(0 == uv_fs_sendfile(loop, reqs + n++, 0, 0, 0, 0, fs_cb)); + ASSERT(0 == uv_fs_stat(loop, reqs + n++, "/", fs_cb)); + ASSERT(0 == uv_fs_symlink(loop, reqs + n++, "/", "/", 0, fs_cb)); + ASSERT(0 == uv_fs_unlink(loop, reqs + n++, "/", fs_cb)); + ASSERT(0 == uv_fs_utime(loop, reqs + n++, "/", 0, 0, fs_cb)); + ASSERT(0 == uv_fs_write(loop, reqs + n++, 0, &iov, 1, 0, fs_cb)); + ASSERT(n == ARRAY_SIZE(reqs)); + + ASSERT(0 == uv_timer_init(loop, &ci.timer_handle)); + ASSERT(0 == uv_timer_start(&ci.timer_handle, timer_cb, 10, 0)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(n == fs_cb_called); + ASSERT(1 == timer_cb_called); + + cleanup_threadpool(); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(threadpool_cancel_single) { + uv_loop_t* loop; + uv_work_t req; + int cancelled; + int i; + + loop = uv_default_loop(); + for (i = 0; i < 5000; i++) { + req.data = NULL; + ASSERT(0 == uv_queue_work(loop, &req, nop_work_cb, nop_done_cb)); + + cancelled = uv_cancel((uv_req_t*) &req); + if (cancelled == 0) + break; + + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + } + + if (cancelled != 0) { + fputs("Failed to cancel a work req in 5,000 iterations, giving up.\n", + stderr); + return 1; + } + + ASSERT(req.data == NULL); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(req.data != NULL); /* Should have been updated by nop_done_cb(). */ + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-threadpool.c b/3rdparty/libuv/test/test-threadpool.c new file mode 100644 index 00000000000..e3d17d7546f --- /dev/null +++ b/3rdparty/libuv/test/test-threadpool.c @@ -0,0 +1,76 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static int work_cb_count; +static int after_work_cb_count; +static uv_work_t work_req; +static char data; + + +static void work_cb(uv_work_t* req) { + ASSERT(req == &work_req); + ASSERT(req->data == &data); + work_cb_count++; +} + + +static void after_work_cb(uv_work_t* req, int status) { + ASSERT(status == 0); + ASSERT(req == &work_req); + ASSERT(req->data == &data); + after_work_cb_count++; +} + + +TEST_IMPL(threadpool_queue_work_simple) { + int r; + + work_req.data = &data; + r = uv_queue_work(uv_default_loop(), &work_req, work_cb, after_work_cb); + ASSERT(r == 0); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(work_cb_count == 1); + ASSERT(after_work_cb_count == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(threadpool_queue_work_einval) { + int r; + + work_req.data = &data; + r = uv_queue_work(uv_default_loop(), &work_req, NULL, after_work_cb); + ASSERT(r == UV_EINVAL); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(work_cb_count == 0); + ASSERT(after_work_cb_count == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-timer-again.c b/3rdparty/libuv/test/test-timer-again.c new file mode 100644 index 00000000000..f93c509be5d --- /dev/null +++ b/3rdparty/libuv/test/test-timer-again.c @@ -0,0 +1,141 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + + +static int close_cb_called = 0; +static int repeat_1_cb_called = 0; +static int repeat_2_cb_called = 0; + +static int repeat_2_cb_allowed = 0; + +static uv_timer_t dummy, repeat_1, repeat_2; + +static uint64_t start_time; + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + + close_cb_called++; +} + + +static void repeat_1_cb(uv_timer_t* handle) { + int r; + + ASSERT(handle == &repeat_1); + ASSERT(uv_timer_get_repeat((uv_timer_t*)handle) == 50); + + fprintf(stderr, "repeat_1_cb called after %ld ms\n", + (long int)(uv_now(uv_default_loop()) - start_time)); + fflush(stderr); + + repeat_1_cb_called++; + + r = uv_timer_again(&repeat_2); + ASSERT(r == 0); + + if (repeat_1_cb_called == 10) { + uv_close((uv_handle_t*)handle, close_cb); + /* We're not calling uv_timer_again on repeat_2 any more, so after this */ + /* timer_2_cb is expected. */ + repeat_2_cb_allowed = 1; + return; + } +} + + +static void repeat_2_cb(uv_timer_t* handle) { + ASSERT(handle == &repeat_2); + ASSERT(repeat_2_cb_allowed); + + fprintf(stderr, "repeat_2_cb called after %ld ms\n", + (long int)(uv_now(uv_default_loop()) - start_time)); + fflush(stderr); + + repeat_2_cb_called++; + + if (uv_timer_get_repeat(&repeat_2) == 0) { + ASSERT(0 == uv_is_active((uv_handle_t*) handle)); + uv_close((uv_handle_t*)handle, close_cb); + return; + } + + fprintf(stderr, "uv_timer_get_repeat %ld ms\n", + (long int)uv_timer_get_repeat(&repeat_2)); + fflush(stderr); + ASSERT(uv_timer_get_repeat(&repeat_2) == 100); + + /* This shouldn't take effect immediately. */ + uv_timer_set_repeat(&repeat_2, 0); +} + + +TEST_IMPL(timer_again) { + int r; + + start_time = uv_now(uv_default_loop()); + ASSERT(0 < start_time); + + /* Verify that it is not possible to uv_timer_again a never-started timer. */ + r = uv_timer_init(uv_default_loop(), &dummy); + ASSERT(r == 0); + r = uv_timer_again(&dummy); + ASSERT(r == UV_EINVAL); + uv_unref((uv_handle_t*)&dummy); + + /* Start timer repeat_1. */ + r = uv_timer_init(uv_default_loop(), &repeat_1); + ASSERT(r == 0); + r = uv_timer_start(&repeat_1, repeat_1_cb, 50, 0); + ASSERT(r == 0); + ASSERT(uv_timer_get_repeat(&repeat_1) == 0); + + /* Actually make repeat_1 repeating. */ + uv_timer_set_repeat(&repeat_1, 50); + ASSERT(uv_timer_get_repeat(&repeat_1) == 50); + + /* + * Start another repeating timer. It'll be again()ed by the repeat_1 so + * it should not time out until repeat_1 stops. + */ + r = uv_timer_init(uv_default_loop(), &repeat_2); + ASSERT(r == 0); + r = uv_timer_start(&repeat_2, repeat_2_cb, 100, 100); + ASSERT(r == 0); + ASSERT(uv_timer_get_repeat(&repeat_2) == 100); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(repeat_1_cb_called == 10); + ASSERT(repeat_2_cb_called == 2); + ASSERT(close_cb_called == 2); + + fprintf(stderr, "Test took %ld ms (expected ~700 ms)\n", + (long int)(uv_now(uv_default_loop()) - start_time)); + fflush(stderr); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-timer-from-check.c b/3rdparty/libuv/test/test-timer-from-check.c new file mode 100644 index 00000000000..a18c7e1fb99 --- /dev/null +++ b/3rdparty/libuv/test/test-timer-from-check.c @@ -0,0 +1,80 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +static uv_prepare_t prepare_handle; +static uv_check_t check_handle; +static uv_timer_t timer_handle; + +static int prepare_cb_called; +static int check_cb_called; +static int timer_cb_called; + + +static void prepare_cb(uv_prepare_t* handle) { + ASSERT(0 == uv_prepare_stop(&prepare_handle)); + ASSERT(0 == prepare_cb_called); + ASSERT(1 == check_cb_called); + ASSERT(0 == timer_cb_called); + prepare_cb_called++; +} + + +static void timer_cb(uv_timer_t* handle) { + ASSERT(0 == uv_timer_stop(&timer_handle)); + ASSERT(1 == prepare_cb_called); + ASSERT(1 == check_cb_called); + ASSERT(0 == timer_cb_called); + timer_cb_called++; +} + + +static void check_cb(uv_check_t* handle) { + ASSERT(0 == uv_check_stop(&check_handle)); + ASSERT(0 == uv_timer_stop(&timer_handle)); /* Runs before timer_cb. */ + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 50, 0)); + ASSERT(0 == uv_prepare_start(&prepare_handle, prepare_cb)); + ASSERT(0 == prepare_cb_called); + ASSERT(0 == check_cb_called); + ASSERT(0 == timer_cb_called); + check_cb_called++; +} + + +TEST_IMPL(timer_from_check) { + ASSERT(0 == uv_prepare_init(uv_default_loop(), &prepare_handle)); + ASSERT(0 == uv_check_init(uv_default_loop(), &check_handle)); + ASSERT(0 == uv_check_start(&check_handle, check_cb)); + ASSERT(0 == uv_timer_init(uv_default_loop(), &timer_handle)); + ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 50, 0)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + ASSERT(1 == prepare_cb_called); + ASSERT(1 == check_cb_called); + ASSERT(1 == timer_cb_called); + uv_close((uv_handle_t*) &prepare_handle, NULL); + uv_close((uv_handle_t*) &check_handle, NULL); + uv_close((uv_handle_t*) &timer_handle, NULL); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_ONCE)); + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-timer.c b/3rdparty/libuv/test/test-timer.c new file mode 100644 index 00000000000..aba050fd64c --- /dev/null +++ b/3rdparty/libuv/test/test-timer.c @@ -0,0 +1,303 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + + +static int once_cb_called = 0; +static int once_close_cb_called = 0; +static int repeat_cb_called = 0; +static int repeat_close_cb_called = 0; +static int order_cb_called = 0; +static uint64_t start_time; +static uv_timer_t tiny_timer; +static uv_timer_t huge_timer1; +static uv_timer_t huge_timer2; + + +static void once_close_cb(uv_handle_t* handle) { + printf("ONCE_CLOSE_CB\n"); + + ASSERT(handle != NULL); + ASSERT(0 == uv_is_active(handle)); + + once_close_cb_called++; +} + + +static void once_cb(uv_timer_t* handle) { + printf("ONCE_CB %d\n", once_cb_called); + + ASSERT(handle != NULL); + ASSERT(0 == uv_is_active((uv_handle_t*) handle)); + + once_cb_called++; + + uv_close((uv_handle_t*)handle, once_close_cb); + + /* Just call this randomly for the code coverage. */ + uv_update_time(uv_default_loop()); +} + + +static void repeat_close_cb(uv_handle_t* handle) { + printf("REPEAT_CLOSE_CB\n"); + + ASSERT(handle != NULL); + + repeat_close_cb_called++; +} + + +static void repeat_cb(uv_timer_t* handle) { + printf("REPEAT_CB\n"); + + ASSERT(handle != NULL); + ASSERT(1 == uv_is_active((uv_handle_t*) handle)); + + repeat_cb_called++; + + if (repeat_cb_called == 5) { + uv_close((uv_handle_t*)handle, repeat_close_cb); + } +} + + +static void never_cb(uv_timer_t* handle) { + FATAL("never_cb should never be called"); +} + + +TEST_IMPL(timer) { + uv_timer_t once_timers[10]; + uv_timer_t *once; + uv_timer_t repeat, never; + unsigned int i; + int r; + + start_time = uv_now(uv_default_loop()); + ASSERT(0 < start_time); + + /* Let 10 timers time out in 500 ms total. */ + for (i = 0; i < ARRAY_SIZE(once_timers); i++) { + once = once_timers + i; + r = uv_timer_init(uv_default_loop(), once); + ASSERT(r == 0); + r = uv_timer_start(once, once_cb, i * 50, 0); + ASSERT(r == 0); + } + + /* The 11th timer is a repeating timer that runs 4 times */ + r = uv_timer_init(uv_default_loop(), &repeat); + ASSERT(r == 0); + r = uv_timer_start(&repeat, repeat_cb, 100, 100); + ASSERT(r == 0); + + /* The 12th timer should not do anything. */ + r = uv_timer_init(uv_default_loop(), &never); + ASSERT(r == 0); + r = uv_timer_start(&never, never_cb, 100, 100); + ASSERT(r == 0); + r = uv_timer_stop(&never); + ASSERT(r == 0); + uv_unref((uv_handle_t*)&never); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(once_cb_called == 10); + ASSERT(once_close_cb_called == 10); + printf("repeat_cb_called %d\n", repeat_cb_called); + ASSERT(repeat_cb_called == 5); + ASSERT(repeat_close_cb_called == 1); + + ASSERT(500 <= uv_now(uv_default_loop()) - start_time); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(timer_start_twice) { + uv_timer_t once; + int r; + + r = uv_timer_init(uv_default_loop(), &once); + ASSERT(r == 0); + r = uv_timer_start(&once, never_cb, 86400 * 1000, 0); + ASSERT(r == 0); + r = uv_timer_start(&once, once_cb, 10, 0); + ASSERT(r == 0); + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(once_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(timer_init) { + uv_timer_t handle; + + ASSERT(0 == uv_timer_init(uv_default_loop(), &handle)); + ASSERT(0 == uv_timer_get_repeat(&handle)); + ASSERT(0 == uv_is_active((uv_handle_t*) &handle)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +static void order_cb_a(uv_timer_t *handle) { + ASSERT(order_cb_called++ == *(int*)handle->data); +} + + +static void order_cb_b(uv_timer_t *handle) { + ASSERT(order_cb_called++ == *(int*)handle->data); +} + + +TEST_IMPL(timer_order) { + int first; + int second; + uv_timer_t handle_a; + uv_timer_t handle_b; + + first = 0; + second = 1; + ASSERT(0 == uv_timer_init(uv_default_loop(), &handle_a)); + ASSERT(0 == uv_timer_init(uv_default_loop(), &handle_b)); + + /* Test for starting handle_a then handle_b */ + handle_a.data = &first; + ASSERT(0 == uv_timer_start(&handle_a, order_cb_a, 0, 0)); + handle_b.data = &second; + ASSERT(0 == uv_timer_start(&handle_b, order_cb_b, 0, 0)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + ASSERT(order_cb_called == 2); + + ASSERT(0 == uv_timer_stop(&handle_a)); + ASSERT(0 == uv_timer_stop(&handle_b)); + + /* Test for starting handle_b then handle_a */ + order_cb_called = 0; + handle_b.data = &first; + ASSERT(0 == uv_timer_start(&handle_b, order_cb_b, 0, 0)); + + handle_a.data = &second; + ASSERT(0 == uv_timer_start(&handle_a, order_cb_a, 0, 0)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + + ASSERT(order_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +static void tiny_timer_cb(uv_timer_t* handle) { + ASSERT(handle == &tiny_timer); + uv_close((uv_handle_t*) &tiny_timer, NULL); + uv_close((uv_handle_t*) &huge_timer1, NULL); + uv_close((uv_handle_t*) &huge_timer2, NULL); +} + + +TEST_IMPL(timer_huge_timeout) { + ASSERT(0 == uv_timer_init(uv_default_loop(), &tiny_timer)); + ASSERT(0 == uv_timer_init(uv_default_loop(), &huge_timer1)); + ASSERT(0 == uv_timer_init(uv_default_loop(), &huge_timer2)); + ASSERT(0 == uv_timer_start(&tiny_timer, tiny_timer_cb, 1, 0)); + ASSERT(0 == uv_timer_start(&huge_timer1, tiny_timer_cb, 0xffffffffffffLL, 0)); + ASSERT(0 == uv_timer_start(&huge_timer2, tiny_timer_cb, (uint64_t) -1, 0)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +static void huge_repeat_cb(uv_timer_t* handle) { + static int ncalls; + + if (ncalls == 0) + ASSERT(handle == &huge_timer1); + else + ASSERT(handle == &tiny_timer); + + if (++ncalls == 10) { + uv_close((uv_handle_t*) &tiny_timer, NULL); + uv_close((uv_handle_t*) &huge_timer1, NULL); + } +} + + +TEST_IMPL(timer_huge_repeat) { + ASSERT(0 == uv_timer_init(uv_default_loop(), &tiny_timer)); + ASSERT(0 == uv_timer_init(uv_default_loop(), &huge_timer1)); + ASSERT(0 == uv_timer_start(&tiny_timer, huge_repeat_cb, 2, 2)); + ASSERT(0 == uv_timer_start(&huge_timer1, huge_repeat_cb, 1, (uint64_t) -1)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +static unsigned int timer_run_once_timer_cb_called; + + +static void timer_run_once_timer_cb(uv_timer_t* handle) { + timer_run_once_timer_cb_called++; +} + + +TEST_IMPL(timer_run_once) { + uv_timer_t timer_handle; + + ASSERT(0 == uv_timer_init(uv_default_loop(), &timer_handle)); + ASSERT(0 == uv_timer_start(&timer_handle, timer_run_once_timer_cb, 0, 0)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_ONCE)); + ASSERT(1 == timer_run_once_timer_cb_called); + + ASSERT(0 == uv_timer_start(&timer_handle, timer_run_once_timer_cb, 1, 0)); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_ONCE)); + ASSERT(2 == timer_run_once_timer_cb_called); + + uv_close((uv_handle_t*) &timer_handle, NULL); + ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_ONCE)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(timer_null_callback) { + uv_timer_t handle; + + ASSERT(0 == uv_timer_init(uv_default_loop(), &handle)); + ASSERT(UV_EINVAL == uv_timer_start(&handle, NULL, 100, 100)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-tty.c b/3rdparty/libuv/test/test-tty.c new file mode 100644 index 00000000000..b844959d526 --- /dev/null +++ b/3rdparty/libuv/test/test-tty.c @@ -0,0 +1,184 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#ifdef _WIN32 +# include +# include +#else /* Unix */ +# include +# include +#endif + +#include +#include + + +TEST_IMPL(tty) { + int r, width, height; + int ttyin_fd, ttyout_fd; + uv_tty_t tty_in, tty_out; + uv_loop_t* loop = uv_default_loop(); + + /* Make sure we have an FD that refers to a tty */ +#ifdef _WIN32 + HANDLE handle; + handle = CreateFileA("conin$", + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + ASSERT(handle != INVALID_HANDLE_VALUE); + ttyin_fd = _open_osfhandle((intptr_t) handle, 0); + + handle = CreateFileA("conout$", + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + ASSERT(handle != INVALID_HANDLE_VALUE); + ttyout_fd = _open_osfhandle((intptr_t) handle, 0); + +#else /* unix */ + ttyin_fd = open("/dev/tty", O_RDONLY, 0); + if (ttyin_fd < 0) { + fprintf(stderr, "Cannot open /dev/tty as read-only: %s\n", strerror(errno)); + fflush(stderr); + return TEST_SKIP; + } + + ttyout_fd = open("/dev/tty", O_WRONLY, 0); + if (ttyout_fd < 0) { + fprintf(stderr, "Cannot open /dev/tty as write-only: %s\n", strerror(errno)); + fflush(stderr); + return TEST_SKIP; + } +#endif + + ASSERT(ttyin_fd >= 0); + ASSERT(ttyout_fd >= 0); + + ASSERT(UV_UNKNOWN_HANDLE == uv_guess_handle(-1)); + + ASSERT(UV_TTY == uv_guess_handle(ttyin_fd)); + ASSERT(UV_TTY == uv_guess_handle(ttyout_fd)); + + r = uv_tty_init(uv_default_loop(), &tty_in, ttyin_fd, 1); /* Readable. */ + ASSERT(r == 0); + + r = uv_tty_init(uv_default_loop(), &tty_out, ttyout_fd, 0); /* Writable. */ + ASSERT(r == 0); + + r = uv_tty_get_winsize(&tty_out, &width, &height); + ASSERT(r == 0); + + printf("width=%d height=%d\n", width, height); + + if (width == 0 && height == 0) { + /* Some environments such as containers or Jenkins behave like this + * sometimes */ + MAKE_VALGRIND_HAPPY(); + return TEST_SKIP; + } + + /* + * Is it a safe assumption that most people have terminals larger than + * 10x10? + */ + ASSERT(width > 10); + ASSERT(height > 10); + + /* Turn on raw mode. */ + r = uv_tty_set_mode(&tty_in, UV_TTY_MODE_RAW); + ASSERT(r == 0); + + /* Turn off raw mode. */ + r = uv_tty_set_mode(&tty_in, UV_TTY_MODE_NORMAL); + ASSERT(r == 0); + + /* Calling uv_tty_reset_mode() repeatedly should not clobber errno. */ + errno = 0; + ASSERT(0 == uv_tty_reset_mode()); + ASSERT(0 == uv_tty_reset_mode()); + ASSERT(0 == uv_tty_reset_mode()); + ASSERT(0 == errno); + + /* TODO check the actual mode! */ + + uv_close((uv_handle_t*) &tty_in, NULL); + uv_close((uv_handle_t*) &tty_out, NULL); + + uv_run(loop, UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(tty_file) { +#ifndef _WIN32 + uv_loop_t loop; + uv_tty_t tty; + int fd; + + ASSERT(0 == uv_loop_init(&loop)); + + fd = open("test/fixtures/empty_file", O_RDONLY); + if (fd != -1) { + ASSERT(UV_EINVAL == uv_tty_init(&loop, &tty, fd, 1)); + ASSERT(0 == close(fd)); + } + +/* Bug on AIX where '/dev/random' returns 1 from isatty() */ +#ifndef _AIX + fd = open("/dev/random", O_RDONLY); + if (fd != -1) { + ASSERT(UV_EINVAL == uv_tty_init(&loop, &tty, fd, 1)); + ASSERT(0 == close(fd)); + } +#endif /* _AIX */ + + fd = open("/dev/zero", O_RDONLY); + if (fd != -1) { + ASSERT(UV_EINVAL == uv_tty_init(&loop, &tty, fd, 1)); + ASSERT(0 == close(fd)); + } + + fd = open("/dev/tty", O_RDONLY); + if (fd != -1) { + ASSERT(0 == uv_tty_init(&loop, &tty, fd, 1)); + ASSERT(0 == close(fd)); + uv_close((uv_handle_t*) &tty, NULL); + } + + ASSERT(0 == uv_run(&loop, UV_RUN_DEFAULT)); + ASSERT(0 == uv_loop_close(&loop)); + + MAKE_VALGRIND_HAPPY(); +#endif + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-bind.c b/3rdparty/libuv/test/test-udp-bind.c new file mode 100644 index 00000000000..a1e080ee70c --- /dev/null +++ b/3rdparty/libuv/test/test-udp-bind.c @@ -0,0 +1,93 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + + +TEST_IMPL(udp_bind) { + struct sockaddr_in addr; + uv_loop_t* loop; + uv_udp_t h1, h2; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + loop = uv_default_loop(); + + r = uv_udp_init(loop, &h1); + ASSERT(r == 0); + + r = uv_udp_init(loop, &h2); + ASSERT(r == 0); + + r = uv_udp_bind(&h1, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_udp_bind(&h2, (const struct sockaddr*) &addr, 0); + ASSERT(r == UV_EADDRINUSE); + + uv_close((uv_handle_t*) &h1, NULL); + uv_close((uv_handle_t*) &h2, NULL); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(udp_bind_reuseaddr) { + struct sockaddr_in addr; + uv_loop_t* loop; + uv_udp_t h1, h2; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + loop = uv_default_loop(); + + r = uv_udp_init(loop, &h1); + ASSERT(r == 0); + + r = uv_udp_init(loop, &h2); + ASSERT(r == 0); + + r = uv_udp_bind(&h1, (const struct sockaddr*) &addr, UV_UDP_REUSEADDR); + ASSERT(r == 0); + + r = uv_udp_bind(&h2, (const struct sockaddr*) &addr, UV_UDP_REUSEADDR); + ASSERT(r == 0); + + uv_close((uv_handle_t*) &h1, NULL); + uv_close((uv_handle_t*) &h2, NULL); + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-create-socket-early.c b/3rdparty/libuv/test/test-udp-create-socket-early.c new file mode 100644 index 00000000000..3d0152428b8 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-create-socket-early.c @@ -0,0 +1,132 @@ +/* Copyright (c) 2015 Saúl Ibarra Corretgé . + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include + +#ifdef _WIN32 +# define INVALID_FD (INVALID_HANDLE_VALUE) +#else +# define INVALID_FD (-1) +#endif + + +TEST_IMPL(udp_create_early) { + struct sockaddr_in addr; + struct sockaddr_in sockname; + uv_udp_t client; + uv_os_fd_t fd; + int r, namelen; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_udp_init_ex(uv_default_loop(), &client, AF_INET); + ASSERT(r == 0); + + r = uv_fileno((const uv_handle_t*) &client, &fd); + ASSERT(r == 0); + ASSERT(fd != INVALID_FD); + + /* Windows returns WSAEINVAL if the socket is not bound */ +#ifndef _WIN32 + namelen = sizeof sockname; + r = uv_udp_getsockname(&client, (struct sockaddr*) &sockname, &namelen); + ASSERT(r == 0); + ASSERT(sockname.sin_family == AF_INET); +#endif + + r = uv_udp_bind(&client, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + namelen = sizeof sockname; + r = uv_udp_getsockname(&client, (struct sockaddr*) &sockname, &namelen); + ASSERT(r == 0); + ASSERT(memcmp(&addr.sin_addr, + &sockname.sin_addr, + sizeof(addr.sin_addr)) == 0); + + uv_close((uv_handle_t*) &client, NULL); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(udp_create_early_bad_bind) { + struct sockaddr_in addr; + uv_udp_t client; + uv_os_fd_t fd; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_udp_init_ex(uv_default_loop(), &client, AF_INET6); + ASSERT(r == 0); + + r = uv_fileno((const uv_handle_t*) &client, &fd); + ASSERT(r == 0); + ASSERT(fd != INVALID_FD); + + /* Windows returns WSAEINVAL if the socket is not bound */ +#ifndef _WIN32 + { + int namelen; + struct sockaddr_in6 sockname; + namelen = sizeof sockname; + r = uv_udp_getsockname(&client, (struct sockaddr*) &sockname, &namelen); + ASSERT(r == 0); + ASSERT(sockname.sin6_family == AF_INET6); + } +#endif + + r = uv_udp_bind(&client, (const struct sockaddr*) &addr, 0); +#ifndef _WIN32 + ASSERT(r == UV_EINVAL); +#else + ASSERT(r == UV_EFAULT); +#endif + + uv_close((uv_handle_t*) &client, NULL); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(udp_create_early_bad_domain) { + uv_udp_t client; + int r; + + r = uv_udp_init_ex(uv_default_loop(), &client, 47); + ASSERT(r == UV_EINVAL); + + r = uv_udp_init_ex(uv_default_loop(), &client, 1024); + ASSERT(r == UV_EINVAL); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-dgram-too-big.c b/3rdparty/libuv/test/test-udp-dgram-too-big.c new file mode 100644 index 00000000000..bd44c425287 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-dgram-too-big.c @@ -0,0 +1,91 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &handle_) + +#define CHECK_REQ(req) \ + ASSERT((req) == &req_); + +static uv_udp_t handle_; +static uv_udp_send_t req_; + +static int send_cb_called; +static int close_cb_called; + + +static void close_cb(uv_handle_t* handle) { + CHECK_HANDLE(handle); + close_cb_called++; +} + + +static void send_cb(uv_udp_send_t* req, int status) { + CHECK_REQ(req); + CHECK_HANDLE(req->handle); + + ASSERT(status == UV_EMSGSIZE); + + uv_close((uv_handle_t*)req->handle, close_cb); + send_cb_called++; +} + + +TEST_IMPL(udp_dgram_too_big) { + char dgram[65536]; /* 64K MTU is unlikely, even on localhost */ + struct sockaddr_in addr; + uv_buf_t buf; + int r; + + memset(dgram, 42, sizeof dgram); /* silence valgrind */ + + r = uv_udp_init(uv_default_loop(), &handle_); + ASSERT(r == 0); + + buf = uv_buf_init(dgram, sizeof dgram); + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_udp_send(&req_, + &handle_, + &buf, + 1, + (const struct sockaddr*) &addr, + send_cb); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + ASSERT(send_cb_called == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(send_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-ipv6.c b/3rdparty/libuv/test/test-udp-ipv6.c new file mode 100644 index 00000000000..1b0db78b8ef --- /dev/null +++ b/3rdparty/libuv/test/test-udp-ipv6.c @@ -0,0 +1,193 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#ifdef __FreeBSD__ +#include +#endif + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &server \ + || (uv_udp_t*)(handle) == &client \ + || (uv_timer_t*)(handle) == &timeout) + +#define CHECK_REQ(req) \ + ASSERT((req) == &req_); + +static uv_udp_t client; +static uv_udp_t server; +static uv_udp_send_t req_; +static uv_timer_t timeout; + +static int send_cb_called; +static int recv_cb_called; +static int close_cb_called; + +#ifdef __FreeBSD__ +static int can_ipv6_ipv4_dual() { + int v6only; + size_t size = sizeof(int); + + if (sysctlbyname("net.inet6.ip6.v6only", &v6only, &size, NULL, 0)) + return 0; + + return v6only != 1; +} +#endif + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + CHECK_HANDLE(handle); + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void close_cb(uv_handle_t* handle) { + CHECK_HANDLE(handle); + close_cb_called++; +} + + +static void send_cb(uv_udp_send_t* req, int status) { + CHECK_REQ(req); + CHECK_HANDLE(req->handle); + ASSERT(status == 0); + send_cb_called++; +} + + +static void ipv6_recv_fail(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags) { + ASSERT(0 && "this function should not have been called"); +} + + +static void ipv6_recv_ok(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags) { + CHECK_HANDLE(handle); + ASSERT(nread >= 0); + + if (nread) + recv_cb_called++; +} + + +static void timeout_cb(uv_timer_t* timer) { + uv_close((uv_handle_t*)&server, close_cb); + uv_close((uv_handle_t*)&client, close_cb); + uv_close((uv_handle_t*)&timeout, close_cb); +} + + +static void do_test(uv_udp_recv_cb recv_cb, int bind_flags) { + struct sockaddr_in6 addr6; + struct sockaddr_in addr; + uv_buf_t buf; + int r; + + ASSERT(0 == uv_ip6_addr("::0", TEST_PORT, &addr6)); + + r = uv_udp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + r = uv_udp_bind(&server, (const struct sockaddr*) &addr6, bind_flags); + ASSERT(r == 0); + + r = uv_udp_recv_start(&server, alloc_cb, recv_cb); + ASSERT(r == 0); + + r = uv_udp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + buf = uv_buf_init("PING", 4); + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_udp_send(&req_, + &client, + &buf, + 1, + (const struct sockaddr*) &addr, + send_cb); + ASSERT(r == 0); + + r = uv_timer_init(uv_default_loop(), &timeout); + ASSERT(r == 0); + + r = uv_timer_start(&timeout, timeout_cb, 500, 0); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + ASSERT(send_cb_called == 0); + ASSERT(recv_cb_called == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 3); + + MAKE_VALGRIND_HAPPY(); +} + + +TEST_IMPL(udp_dual_stack) { + if (!can_ipv6()) + RETURN_SKIP("IPv6 not supported"); + +#ifdef __FreeBSD__ + if (!can_ipv6_ipv4_dual()) + RETURN_SKIP("IPv6-IPv4 dual stack not supported"); +#endif + + do_test(ipv6_recv_ok, 0); + + ASSERT(recv_cb_called == 1); + ASSERT(send_cb_called == 1); + + return 0; +} + + +TEST_IMPL(udp_ipv6_only) { + if (!can_ipv6()) + RETURN_SKIP("IPv6 not supported"); + + do_test(ipv6_recv_fail, UV_UDP_IPV6ONLY); + + ASSERT(recv_cb_called == 0); + ASSERT(send_cb_called == 1); + + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-multicast-interface.c b/3rdparty/libuv/test/test-udp-multicast-interface.c new file mode 100644 index 00000000000..71001a77e03 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-multicast-interface.c @@ -0,0 +1,99 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &server || (uv_udp_t*)(handle) == &client) + +static uv_udp_t server; +static uv_udp_t client; + +static int sv_send_cb_called; +static int close_cb_called; + + +static void close_cb(uv_handle_t* handle) { + CHECK_HANDLE(handle); + close_cb_called++; +} + + +static void sv_send_cb(uv_udp_send_t* req, int status) { + ASSERT(req != NULL); + ASSERT(status == 0 || status == UV_ENETUNREACH); + CHECK_HANDLE(req->handle); + + sv_send_cb_called++; + + uv_close((uv_handle_t*) req->handle, close_cb); +} + + +TEST_IMPL(udp_multicast_interface) { + int r; + uv_udp_send_t req; + uv_buf_t buf; + struct sockaddr_in addr; + struct sockaddr_in baddr; + + ASSERT(0 == uv_ip4_addr("239.255.0.1", TEST_PORT, &addr)); + + r = uv_udp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + ASSERT(0 == uv_ip4_addr("0.0.0.0", 0, &baddr)); + r = uv_udp_bind(&server, (const struct sockaddr*)&baddr, 0); + ASSERT(r == 0); + + r = uv_udp_set_multicast_interface(&server, "0.0.0.0"); + ASSERT(r == 0); + + /* server sends "PING" */ + buf = uv_buf_init("PING", 4); + r = uv_udp_send(&req, + &server, + &buf, + 1, + (const struct sockaddr*)&addr, + sv_send_cb); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + ASSERT(sv_send_cb_called == 0); + + /* run the loop till all events are processed */ + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(sv_send_cb_called == 1); + ASSERT(close_cb_called == 1); + + ASSERT(client.send_queue_size == 0); + ASSERT(server.send_queue_size == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-multicast-interface6.c b/3rdparty/libuv/test/test-udp-multicast-interface6.c new file mode 100644 index 00000000000..d3881e83bb1 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-multicast-interface6.c @@ -0,0 +1,103 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &server || (uv_udp_t*)(handle) == &client) + +static uv_udp_t server; +static uv_udp_t client; + +static int sv_send_cb_called; +static int close_cb_called; + + +static void close_cb(uv_handle_t* handle) { + CHECK_HANDLE(handle); + close_cb_called++; +} + + +static void sv_send_cb(uv_udp_send_t* req, int status) { + ASSERT(req != NULL); + ASSERT(status == 0); + CHECK_HANDLE(req->handle); + + sv_send_cb_called++; + + uv_close((uv_handle_t*) req->handle, close_cb); +} + + +TEST_IMPL(udp_multicast_interface6) { + int r; + uv_udp_send_t req; + uv_buf_t buf; + struct sockaddr_in6 addr; + struct sockaddr_in6 baddr; + + if (!can_ipv6()) + RETURN_SKIP("IPv6 not supported"); + + ASSERT(0 == uv_ip6_addr("::1", TEST_PORT, &addr)); + + r = uv_udp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + ASSERT(0 == uv_ip6_addr("::", 0, &baddr)); + r = uv_udp_bind(&server, (const struct sockaddr*)&baddr, 0); + ASSERT(r == 0); + +#if defined(__APPLE__) || defined(__FreeBSD__) + r = uv_udp_set_multicast_interface(&server, "::1%lo0"); +#else + r = uv_udp_set_multicast_interface(&server, NULL); +#endif + ASSERT(r == 0); + + /* server sends "PING" */ + buf = uv_buf_init("PING", 4); + r = uv_udp_send(&req, + &server, + &buf, + 1, + (const struct sockaddr*)&addr, + sv_send_cb); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + ASSERT(sv_send_cb_called == 0); + + /* run the loop till all events are processed */ + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(sv_send_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-multicast-join.c b/3rdparty/libuv/test/test-udp-multicast-join.c new file mode 100644 index 00000000000..6110a8d922a --- /dev/null +++ b/3rdparty/libuv/test/test-udp-multicast-join.c @@ -0,0 +1,150 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &server || (uv_udp_t*)(handle) == &client) + +static uv_udp_t server; +static uv_udp_t client; + +static int cl_recv_cb_called; + +static int sv_send_cb_called; + +static int close_cb_called; + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + CHECK_HANDLE(handle); + ASSERT(suggested_size <= sizeof(slab)); + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void close_cb(uv_handle_t* handle) { + CHECK_HANDLE(handle); + close_cb_called++; +} + + +static void sv_send_cb(uv_udp_send_t* req, int status) { + ASSERT(req != NULL); + ASSERT(status == 0); + CHECK_HANDLE(req->handle); + + sv_send_cb_called++; + + uv_close((uv_handle_t*) req->handle, close_cb); +} + + +static void cl_recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags) { + CHECK_HANDLE(handle); + ASSERT(flags == 0); + + cl_recv_cb_called++; + + if (nread < 0) { + ASSERT(0 && "unexpected error"); + } + + if (nread == 0) { + /* Returning unused buffer */ + /* Don't count towards cl_recv_cb_called */ + ASSERT(addr == NULL); + return; + } + + ASSERT(addr != NULL); + ASSERT(nread == 4); + ASSERT(!memcmp("PING", buf->base, nread)); + + /* we are done with the client handle, we can close it */ + uv_close((uv_handle_t*) &client, close_cb); +} + + +TEST_IMPL(udp_multicast_join) { + int r; + uv_udp_send_t req; + uv_buf_t buf; + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_udp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + r = uv_udp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + /* bind to the desired port */ + r = uv_udp_bind(&client, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + /* join the multicast channel */ + r = uv_udp_set_membership(&client, "239.255.0.1", NULL, UV_JOIN_GROUP); + if (r == UV_ENODEV) + RETURN_SKIP("No multicast support."); + ASSERT(r == 0); + + r = uv_udp_recv_start(&client, alloc_cb, cl_recv_cb); + ASSERT(r == 0); + + buf = uv_buf_init("PING", 4); + + /* server sends "PING" */ + r = uv_udp_send(&req, + &server, + &buf, + 1, + (const struct sockaddr*) &addr, + sv_send_cb); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + ASSERT(cl_recv_cb_called == 0); + ASSERT(sv_send_cb_called == 0); + + /* run the loop till all events are processed */ + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(cl_recv_cb_called == 1); + ASSERT(sv_send_cb_called == 1); + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-multicast-join6.c b/3rdparty/libuv/test/test-udp-multicast-join6.c new file mode 100644 index 00000000000..f635bdb9e14 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-multicast-join6.c @@ -0,0 +1,161 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &server || (uv_udp_t*)(handle) == &client) + +static uv_udp_t server; +static uv_udp_t client; + +static int cl_recv_cb_called; + +static int sv_send_cb_called; + +static int close_cb_called; + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + CHECK_HANDLE(handle); + ASSERT(suggested_size <= sizeof(slab)); + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void close_cb(uv_handle_t* handle) { + CHECK_HANDLE(handle); + close_cb_called++; +} + + +static void sv_send_cb(uv_udp_send_t* req, int status) { + ASSERT(req != NULL); + ASSERT(status == 0); + CHECK_HANDLE(req->handle); + + sv_send_cb_called++; + + uv_close((uv_handle_t*) req->handle, close_cb); +} + + +static void cl_recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags) { + CHECK_HANDLE(handle); + ASSERT(flags == 0); + + cl_recv_cb_called++; + + if (nread < 0) { + ASSERT(0 && "unexpected error"); + } + + if (nread == 0) { + /* Returning unused buffer */ + /* Don't count towards cl_recv_cb_called */ + ASSERT(addr == NULL); + return; + } + + ASSERT(addr != NULL); + ASSERT(nread == 4); + ASSERT(!memcmp("PING", buf->base, nread)); + + /* we are done with the client handle, we can close it */ + uv_close((uv_handle_t*) &client, close_cb); +} + + +TEST_IMPL(udp_multicast_join6) { + int r; + uv_udp_send_t req; + uv_buf_t buf; + struct sockaddr_in6 addr; + + if (!can_ipv6()) + RETURN_SKIP("IPv6 not supported"); + + ASSERT(0 == uv_ip6_addr("::1", TEST_PORT, &addr)); + + r = uv_udp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + r = uv_udp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + /* bind to the desired port */ + r = uv_udp_bind(&client, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + /* join the multicast channel */ +#if defined(__APPLE__) || defined(_AIX) + r = uv_udp_set_membership(&client, "ff02::1", "::1%lo0", UV_JOIN_GROUP); +#else + r = uv_udp_set_membership(&client, "ff02::1", NULL, UV_JOIN_GROUP); +#endif + if (r == UV_ENODEV) { + MAKE_VALGRIND_HAPPY(); + RETURN_SKIP("No ipv6 multicast route"); + } + + ASSERT(r == 0); + + r = uv_udp_recv_start(&client, alloc_cb, cl_recv_cb); + ASSERT(r == 0); + + buf = uv_buf_init("PING", 4); + + /* server sends "PING" */ + r = uv_udp_send(&req, + &server, + &buf, + 1, + (const struct sockaddr*) &addr, + sv_send_cb); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + ASSERT(cl_recv_cb_called == 0); + ASSERT(sv_send_cb_called == 0); + + /* run the loop till all events are processed */ + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(cl_recv_cb_called == 1); + ASSERT(sv_send_cb_called == 1); + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-multicast-ttl.c b/3rdparty/libuv/test/test-udp-multicast-ttl.c new file mode 100644 index 00000000000..7f1af9b9dd9 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-multicast-ttl.c @@ -0,0 +1,94 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &server || (uv_udp_t*)(handle) == &client) + +static uv_udp_t server; +static uv_udp_t client; + +static int sv_send_cb_called; +static int close_cb_called; + + +static void close_cb(uv_handle_t* handle) { + CHECK_HANDLE(handle); + close_cb_called++; +} + + +static void sv_send_cb(uv_udp_send_t* req, int status) { + ASSERT(req != NULL); + ASSERT(status == 0 || status == UV_ENETUNREACH); + CHECK_HANDLE(req->handle); + + sv_send_cb_called++; + + uv_close((uv_handle_t*) req->handle, close_cb); +} + + +TEST_IMPL(udp_multicast_ttl) { + int r; + uv_udp_send_t req; + uv_buf_t buf; + struct sockaddr_in addr; + + r = uv_udp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + ASSERT(0 == uv_ip4_addr("0.0.0.0", 0, &addr)); + r = uv_udp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_udp_set_multicast_ttl(&server, 32); + ASSERT(r == 0); + + /* server sends "PING" */ + buf = uv_buf_init("PING", 4); + ASSERT(0 == uv_ip4_addr("239.255.0.1", TEST_PORT, &addr)); + r = uv_udp_send(&req, + &server, + &buf, + 1, + (const struct sockaddr*) &addr, + sv_send_cb); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + ASSERT(sv_send_cb_called == 0); + + /* run the loop till all events are processed */ + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(sv_send_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-open.c b/3rdparty/libuv/test/test-udp-open.c new file mode 100644 index 00000000000..4d77f45d367 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-open.c @@ -0,0 +1,204 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" +#include +#include +#include + +#ifndef _WIN32 +# include +#endif + +static int send_cb_called = 0; +static int close_cb_called = 0; + +static uv_udp_send_t send_req; + + +static void startup(void) { +#ifdef _WIN32 + struct WSAData wsa_data; + int r = WSAStartup(MAKEWORD(2, 2), &wsa_data); + ASSERT(r == 0); +#endif +} + + +static uv_os_sock_t create_udp_socket(void) { + uv_os_sock_t sock; + + sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); +#ifdef _WIN32 + ASSERT(sock != INVALID_SOCKET); +#else + ASSERT(sock >= 0); +#endif + +#ifndef _WIN32 + { + /* Allow reuse of the port. */ + int yes = 1; + int r = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes); + ASSERT(r == 0); + } +#endif + + return sock; +} + + +static void close_socket(uv_os_sock_t sock) { + int r; +#ifdef _WIN32 + r = closesocket(sock); +#else + r = close(sock); +#endif + ASSERT(r == 0); +} + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + ASSERT(suggested_size <= sizeof(slab)); + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(handle != NULL); + close_cb_called++; +} + + +static void recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags) { + int r; + + if (nread < 0) { + ASSERT(0 && "unexpected error"); + } + + if (nread == 0) { + /* Returning unused buffer */ + /* Don't count towards sv_recv_cb_called */ + ASSERT(addr == NULL); + return; + } + + ASSERT(flags == 0); + + ASSERT(addr != NULL); + ASSERT(nread == 4); + ASSERT(memcmp("PING", buf->base, nread) == 0); + + r = uv_udp_recv_stop(handle); + ASSERT(r == 0); + + uv_close((uv_handle_t*) handle, close_cb); +} + + +static void send_cb(uv_udp_send_t* req, int status) { + ASSERT(req != NULL); + ASSERT(status == 0); + + send_cb_called++; +} + + +TEST_IMPL(udp_open) { + struct sockaddr_in addr; + uv_buf_t buf = uv_buf_init("PING", 4); + uv_udp_t client; + uv_os_sock_t sock; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + startup(); + sock = create_udp_socket(); + + r = uv_udp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + r = uv_udp_open(&client, sock); + ASSERT(r == 0); + + r = uv_udp_bind(&client, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_udp_recv_start(&client, alloc_cb, recv_cb); + ASSERT(r == 0); + + r = uv_udp_send(&send_req, + &client, + &buf, + 1, + (const struct sockaddr*) &addr, + send_cb); + ASSERT(r == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(send_cb_called == 1); + ASSERT(close_cb_called == 1); + + ASSERT(client.send_queue_size == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(udp_open_twice) { + uv_udp_t client; + uv_os_sock_t sock1, sock2; + int r; + + startup(); + sock1 = create_udp_socket(); + sock2 = create_udp_socket(); + + r = uv_udp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + r = uv_udp_open(&client, sock1); + ASSERT(r == 0); + + r = uv_udp_open(&client, sock2); + ASSERT(r == UV_EBUSY); + close_socket(sock2); + + uv_close((uv_handle_t*) &client, NULL); + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-options.c b/3rdparty/libuv/test/test-udp-options.c new file mode 100644 index 00000000000..0da1786f506 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-options.c @@ -0,0 +1,126 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + + +static int udp_options_test(const struct sockaddr* addr) { + static int invalid_ttls[] = { -1, 0, 256 }; + uv_loop_t* loop; + uv_udp_t h; + int i, r; + + loop = uv_default_loop(); + + r = uv_udp_init(loop, &h); + ASSERT(r == 0); + + uv_unref((uv_handle_t*)&h); /* don't keep the loop alive */ + + r = uv_udp_bind(&h, addr, 0); + ASSERT(r == 0); + + r = uv_udp_set_broadcast(&h, 1); + r |= uv_udp_set_broadcast(&h, 1); + r |= uv_udp_set_broadcast(&h, 0); + r |= uv_udp_set_broadcast(&h, 0); + ASSERT(r == 0); + + /* values 1-255 should work */ + for (i = 1; i <= 255; i++) { + r = uv_udp_set_ttl(&h, i); + ASSERT(r == 0); + } + + for (i = 0; i < (int) ARRAY_SIZE(invalid_ttls); i++) { + r = uv_udp_set_ttl(&h, invalid_ttls[i]); + ASSERT(r == UV_EINVAL); + } + + r = uv_udp_set_multicast_loop(&h, 1); + r |= uv_udp_set_multicast_loop(&h, 1); + r |= uv_udp_set_multicast_loop(&h, 0); + r |= uv_udp_set_multicast_loop(&h, 0); + ASSERT(r == 0); + + /* values 0-255 should work */ + for (i = 0; i <= 255; i++) { + r = uv_udp_set_multicast_ttl(&h, i); + ASSERT(r == 0); + } + + /* anything >255 should fail */ + r = uv_udp_set_multicast_ttl(&h, 256); + ASSERT(r == UV_EINVAL); + /* don't test ttl=-1, it's a valid value on some platforms */ + + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(udp_options) { + struct sockaddr_in addr; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + return udp_options_test((const struct sockaddr*) &addr); +} + + +TEST_IMPL(udp_options6) { + struct sockaddr_in6 addr; + + if (!can_ipv6()) + RETURN_SKIP("IPv6 not supported"); + + ASSERT(0 == uv_ip6_addr("::", TEST_PORT, &addr)); + return udp_options_test((const struct sockaddr*) &addr); +} + + +TEST_IMPL(udp_no_autobind) { + uv_loop_t* loop; + uv_udp_t h; + + loop = uv_default_loop(); + + ASSERT(0 == uv_udp_init(loop, &h)); + ASSERT(UV_EBADF == uv_udp_set_multicast_ttl(&h, 32)); + ASSERT(UV_EBADF == uv_udp_set_broadcast(&h, 1)); + ASSERT(UV_EBADF == uv_udp_set_ttl(&h, 1)); + ASSERT(UV_EBADF == uv_udp_set_multicast_loop(&h, 1)); + ASSERT(UV_EBADF == uv_udp_set_multicast_interface(&h, "0.0.0.0")); + + uv_close((uv_handle_t*) &h, NULL); + + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-send-and-recv.c b/3rdparty/libuv/test/test-udp-send-and-recv.c new file mode 100644 index 00000000000..633a16727b2 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-send-and-recv.c @@ -0,0 +1,214 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &server || (uv_udp_t*)(handle) == &client) + +static uv_udp_t server; +static uv_udp_t client; + +static int cl_send_cb_called; +static int cl_recv_cb_called; + +static int sv_send_cb_called; +static int sv_recv_cb_called; + +static int close_cb_called; + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + CHECK_HANDLE(handle); + ASSERT(suggested_size <= sizeof(slab)); + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void close_cb(uv_handle_t* handle) { + CHECK_HANDLE(handle); + ASSERT(1 == uv_is_closing(handle)); + close_cb_called++; +} + + +static void cl_recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags) { + CHECK_HANDLE(handle); + ASSERT(flags == 0); + + if (nread < 0) { + ASSERT(0 && "unexpected error"); + } + + if (nread == 0) { + /* Returning unused buffer */ + /* Don't count towards cl_recv_cb_called */ + ASSERT(addr == NULL); + return; + } + + ASSERT(addr != NULL); + ASSERT(nread == 4); + ASSERT(!memcmp("PONG", buf->base, nread)); + + cl_recv_cb_called++; + + uv_close((uv_handle_t*) handle, close_cb); +} + + +static void cl_send_cb(uv_udp_send_t* req, int status) { + int r; + + ASSERT(req != NULL); + ASSERT(status == 0); + CHECK_HANDLE(req->handle); + + r = uv_udp_recv_start(req->handle, alloc_cb, cl_recv_cb); + ASSERT(r == 0); + + cl_send_cb_called++; +} + + +static void sv_send_cb(uv_udp_send_t* req, int status) { + ASSERT(req != NULL); + ASSERT(status == 0); + CHECK_HANDLE(req->handle); + + uv_close((uv_handle_t*) req->handle, close_cb); + free(req); + + sv_send_cb_called++; +} + + +static void sv_recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* rcvbuf, + const struct sockaddr* addr, + unsigned flags) { + uv_udp_send_t* req; + uv_buf_t sndbuf; + int r; + + if (nread < 0) { + ASSERT(0 && "unexpected error"); + } + + if (nread == 0) { + /* Returning unused buffer */ + /* Don't count towards sv_recv_cb_called */ + ASSERT(addr == NULL); + return; + } + + CHECK_HANDLE(handle); + ASSERT(flags == 0); + + ASSERT(addr != NULL); + ASSERT(nread == 4); + ASSERT(!memcmp("PING", rcvbuf->base, nread)); + + /* FIXME? `uv_udp_recv_stop` does what it says: recv_cb is not called + * anymore. That's problematic because the read buffer won't be returned + * either... Not sure I like that but it's consistent with `uv_read_stop`. + */ + r = uv_udp_recv_stop(handle); + ASSERT(r == 0); + + req = malloc(sizeof *req); + ASSERT(req != NULL); + + sndbuf = uv_buf_init("PONG", 4); + r = uv_udp_send(req, handle, &sndbuf, 1, addr, sv_send_cb); + ASSERT(r == 0); + + sv_recv_cb_called++; +} + + +TEST_IMPL(udp_send_and_recv) { + struct sockaddr_in addr; + uv_udp_send_t req; + uv_buf_t buf; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + r = uv_udp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + r = uv_udp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_udp_recv_start(&server, alloc_cb, sv_recv_cb); + ASSERT(r == 0); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_udp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + /* client sends "PING", expects "PONG" */ + buf = uv_buf_init("PING", 4); + + r = uv_udp_send(&req, + &client, + &buf, + 1, + (const struct sockaddr*) &addr, + cl_send_cb); + ASSERT(r == 0); + + ASSERT(close_cb_called == 0); + ASSERT(cl_send_cb_called == 0); + ASSERT(cl_recv_cb_called == 0); + ASSERT(sv_send_cb_called == 0); + ASSERT(sv_recv_cb_called == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(cl_send_cb_called == 1); + ASSERT(cl_recv_cb_called == 1); + ASSERT(sv_send_cb_called == 1); + ASSERT(sv_recv_cb_called == 1); + ASSERT(close_cb_called == 2); + + ASSERT(client.send_queue_size == 0); + ASSERT(server.send_queue_size == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-send-immediate.c b/3rdparty/libuv/test/test-udp-send-immediate.c new file mode 100644 index 00000000000..0999f6b3425 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-send-immediate.c @@ -0,0 +1,148 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &server || (uv_udp_t*)(handle) == &client) + +static uv_udp_t server; +static uv_udp_t client; + +static int cl_send_cb_called; +static int sv_recv_cb_called; +static int close_cb_called; + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + CHECK_HANDLE(handle); + ASSERT(suggested_size <= sizeof(slab)); + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void close_cb(uv_handle_t* handle) { + CHECK_HANDLE(handle); + ASSERT(1 == uv_is_closing(handle)); + close_cb_called++; +} + + +static void cl_send_cb(uv_udp_send_t* req, int status) { + ASSERT(req != NULL); + ASSERT(status == 0); + CHECK_HANDLE(req->handle); + + cl_send_cb_called++; +} + + +static void sv_recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* rcvbuf, + const struct sockaddr* addr, + unsigned flags) { + if (nread < 0) { + ASSERT(0 && "unexpected error"); + } + + if (nread == 0) { + /* Returning unused buffer */ + /* Don't count towards sv_recv_cb_called */ + ASSERT(addr == NULL); + return; + } + + CHECK_HANDLE(handle); + ASSERT(flags == 0); + + ASSERT(addr != NULL); + ASSERT(nread == 4); + ASSERT(memcmp("PING", rcvbuf->base, nread) == 0 || + memcmp("PANG", rcvbuf->base, nread) == 0); + + if (++sv_recv_cb_called == 2) { + uv_close((uv_handle_t*) &server, close_cb); + uv_close((uv_handle_t*) &client, close_cb); + } +} + + +TEST_IMPL(udp_send_immediate) { + struct sockaddr_in addr; + uv_udp_send_t req1, req2; + uv_buf_t buf; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + r = uv_udp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + r = uv_udp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_udp_recv_start(&server, alloc_cb, sv_recv_cb); + ASSERT(r == 0); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_udp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + /* client sends "PING", then "PANG" */ + buf = uv_buf_init("PING", 4); + + r = uv_udp_send(&req1, + &client, + &buf, + 1, + (const struct sockaddr*) &addr, + cl_send_cb); + ASSERT(r == 0); + + buf = uv_buf_init("PANG", 4); + + r = uv_udp_send(&req2, + &client, + &buf, + 1, + (const struct sockaddr*) &addr, + cl_send_cb); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(cl_send_cb_called == 2); + ASSERT(sv_recv_cb_called == 2); + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-send-unreachable.c b/3rdparty/libuv/test/test-udp-send-unreachable.c new file mode 100644 index 00000000000..c6500320d78 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-send-unreachable.c @@ -0,0 +1,150 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &client) + +static uv_udp_t client; +static uv_timer_t timer; + +static int send_cb_called; +static int recv_cb_called; +static int close_cb_called; +static int alloc_cb_called; +static int timer_cb_called; + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + CHECK_HANDLE(handle); + ASSERT(suggested_size <= sizeof(slab)); + buf->base = slab; + buf->len = sizeof(slab); + alloc_cb_called++; +} + + +static void close_cb(uv_handle_t* handle) { + ASSERT(1 == uv_is_closing(handle)); + close_cb_called++; +} + + +static void send_cb(uv_udp_send_t* req, int status) { + ASSERT(req != NULL); + ASSERT(status == 0); + CHECK_HANDLE(req->handle); + send_cb_called++; +} + + +static void recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* rcvbuf, + const struct sockaddr* addr, + unsigned flags) { + CHECK_HANDLE(handle); + recv_cb_called++; + + if (nread < 0) { + ASSERT(0 && "unexpected error"); + } else if (nread == 0) { + /* Returning unused buffer */ + ASSERT(addr == NULL); + } else { + ASSERT(addr != NULL); + } +} + + +static void timer_cb(uv_timer_t* h) { + ASSERT(h == &timer); + timer_cb_called++; + uv_close((uv_handle_t*) &client, close_cb); + uv_close((uv_handle_t*) h, close_cb); +} + + +TEST_IMPL(udp_send_unreachable) { + struct sockaddr_in addr; + struct sockaddr_in addr2; + uv_udp_send_t req1, req2; + uv_buf_t buf; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT_2, &addr2)); + + r = uv_timer_init( uv_default_loop(), &timer ); + ASSERT(r == 0); + + r = uv_timer_start( &timer, timer_cb, 1000, 0 ); + ASSERT(r == 0); + + r = uv_udp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + r = uv_udp_bind(&client, (const struct sockaddr*) &addr2, 0); + ASSERT(r == 0); + + r = uv_udp_recv_start(&client, alloc_cb, recv_cb); + ASSERT(r == 0); + + /* client sends "PING", then "PANG" */ + buf = uv_buf_init("PING", 4); + + r = uv_udp_send(&req1, + &client, + &buf, + 1, + (const struct sockaddr*) &addr, + send_cb); + ASSERT(r == 0); + + buf = uv_buf_init("PANG", 4); + + r = uv_udp_send(&req2, + &client, + &buf, + 1, + (const struct sockaddr*) &addr, + send_cb); + ASSERT(r == 0); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(send_cb_called == 2); + ASSERT(recv_cb_called == alloc_cb_called); + ASSERT(timer_cb_called == 1); + ASSERT(close_cb_called == 2); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-udp-try-send.c b/3rdparty/libuv/test/test-udp-try-send.c new file mode 100644 index 00000000000..7b6de365487 --- /dev/null +++ b/3rdparty/libuv/test/test-udp-try-send.c @@ -0,0 +1,133 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include +#include + +#ifdef _WIN32 + +TEST_IMPL(udp_try_send) { + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#else /* !_WIN32 */ + +#define CHECK_HANDLE(handle) \ + ASSERT((uv_udp_t*)(handle) == &server || (uv_udp_t*)(handle) == &client) + +static uv_udp_t server; +static uv_udp_t client; + +static int sv_recv_cb_called; + +static int close_cb_called; + + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char slab[65536]; + CHECK_HANDLE(handle); + ASSERT(suggested_size <= sizeof(slab)); + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void close_cb(uv_handle_t* handle) { + CHECK_HANDLE(handle); + ASSERT(uv_is_closing(handle)); + close_cb_called++; +} + + +static void sv_recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* rcvbuf, + const struct sockaddr* addr, + unsigned flags) { + ASSERT(nread > 0); + + if (nread == 0) { + ASSERT(addr == NULL); + return; + } + + ASSERT(nread == 4); + ASSERT(addr != NULL); + + ASSERT(memcmp("EXIT", rcvbuf->base, nread) == 0); + uv_close((uv_handle_t*) handle, close_cb); + uv_close((uv_handle_t*) &client, close_cb); + + sv_recv_cb_called++; +} + + +TEST_IMPL(udp_try_send) { + struct sockaddr_in addr; + static char buffer[64 * 1024]; + uv_buf_t buf; + int r; + + ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); + + r = uv_udp_init(uv_default_loop(), &server); + ASSERT(r == 0); + + r = uv_udp_bind(&server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); + + r = uv_udp_recv_start(&server, alloc_cb, sv_recv_cb); + ASSERT(r == 0); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_udp_init(uv_default_loop(), &client); + ASSERT(r == 0); + + buf = uv_buf_init(buffer, sizeof(buffer)); + r = uv_udp_try_send(&client, &buf, 1, (const struct sockaddr*) &addr); + ASSERT(r == UV_EMSGSIZE); + + buf = uv_buf_init("EXIT", 4); + r = uv_udp_try_send(&client, &buf, 1, (const struct sockaddr*) &addr); + ASSERT(r == 4); + + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + + ASSERT(close_cb_called == 2); + ASSERT(sv_recv_cb_called == 1); + + ASSERT(client.send_queue_size == 0); + ASSERT(server.send_queue_size == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + +#endif /* !_WIN32 */ diff --git a/3rdparty/libuv/test/test-walk-handles.c b/3rdparty/libuv/test/test-walk-handles.c new file mode 100644 index 00000000000..4b0ca6ebc55 --- /dev/null +++ b/3rdparty/libuv/test/test-walk-handles.c @@ -0,0 +1,77 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +static char magic_cookie[] = "magic cookie"; +static int seen_timer_handle; +static uv_timer_t timer; + + +static void walk_cb(uv_handle_t* handle, void* arg) { + ASSERT(arg == (void*)magic_cookie); + + if (handle == (uv_handle_t*)&timer) { + seen_timer_handle++; + } else { + ASSERT(0 && "unexpected handle"); + } +} + + +static void timer_cb(uv_timer_t* handle) { + ASSERT(handle == &timer); + + uv_walk(handle->loop, walk_cb, magic_cookie); + uv_close((uv_handle_t*)handle, NULL); +} + + +TEST_IMPL(walk_handles) { + uv_loop_t* loop; + int r; + + loop = uv_default_loop(); + + r = uv_timer_init(loop, &timer); + ASSERT(r == 0); + + r = uv_timer_start(&timer, timer_cb, 1, 0); + ASSERT(r == 0); + + /* Start event loop, expect to see the timer handle in walk_cb. */ + ASSERT(seen_timer_handle == 0); + r = uv_run(loop, UV_RUN_DEFAULT); + ASSERT(r == 0); + ASSERT(seen_timer_handle == 1); + + /* Loop is finished, walk_cb should not see our timer handle. */ + seen_timer_handle = 0; + uv_walk(loop, walk_cb, magic_cookie); + ASSERT(seen_timer_handle == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/test/test-watcher-cross-stop.c b/3rdparty/libuv/test/test-watcher-cross-stop.c new file mode 100644 index 00000000000..910ed0fb613 --- /dev/null +++ b/3rdparty/libuv/test/test-watcher-cross-stop.c @@ -0,0 +1,103 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include +#include + +/* NOTE: Number should be big enough to trigger this problem */ +static uv_udp_t sockets[2500]; +static uv_udp_send_t reqs[ARRAY_SIZE(sockets)]; +static char slab[1]; +static unsigned int recv_cb_called; +static unsigned int send_cb_called; +static unsigned int close_cb_called; + +static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { + buf->base = slab; + buf->len = sizeof(slab); +} + + +static void recv_cb(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags) { + recv_cb_called++; +} + + +static void send_cb(uv_udp_send_t* req, int status) { + send_cb_called++; +} + + +static void close_cb(uv_handle_t* handle) { + close_cb_called++; +} + + +TEST_IMPL(watcher_cross_stop) { + uv_loop_t* loop = uv_default_loop(); + unsigned int i; + struct sockaddr_in addr; + uv_buf_t buf; + char big_string[1024]; + + TEST_FILE_LIMIT(ARRAY_SIZE(sockets) + 32); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + memset(big_string, 'A', sizeof(big_string)); + buf = uv_buf_init(big_string, sizeof(big_string)); + + for (i = 0; i < ARRAY_SIZE(sockets); i++) { + ASSERT(0 == uv_udp_init(loop, &sockets[i])); + ASSERT(0 == uv_udp_bind(&sockets[i], + (const struct sockaddr*) &addr, + UV_UDP_REUSEADDR)); + ASSERT(0 == uv_udp_recv_start(&sockets[i], alloc_cb, recv_cb)); + ASSERT(0 == uv_udp_send(&reqs[i], + &sockets[i], + &buf, + 1, + (const struct sockaddr*) &addr, + send_cb)); + } + + while (recv_cb_called == 0) + uv_run(loop, UV_RUN_ONCE); + + for (i = 0; i < ARRAY_SIZE(sockets); i++) + uv_close((uv_handle_t*) &sockets[i], close_cb); + + ASSERT(recv_cb_called > 0); + + uv_run(loop, UV_RUN_DEFAULT); + + ASSERT(ARRAY_SIZE(sockets) == send_cb_called); + ASSERT(ARRAY_SIZE(sockets) == close_cb_called); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/3rdparty/libuv/uv.gyp b/3rdparty/libuv/uv.gyp new file mode 100644 index 00000000000..635a234ea6e --- /dev/null +++ b/3rdparty/libuv/uv.gyp @@ -0,0 +1,508 @@ +{ + 'target_defaults': { + 'conditions': [ + ['OS != "win"', { + 'defines': [ + '_LARGEFILE_SOURCE', + '_FILE_OFFSET_BITS=64', + ], + 'conditions': [ + ['OS=="solaris"', { + 'cflags': [ '-pthreads' ], + }], + ['OS not in "solaris android"', { + 'cflags': [ '-pthread' ], + }], + ], + }], + ], + 'xcode_settings': { + 'WARNING_CFLAGS': [ '-Wall', '-Wextra', '-Wno-unused-parameter' ], + 'OTHER_CFLAGS': [ '-g', '--std=gnu89', '-pedantic' ], + } + }, + + 'targets': [ + { + 'target_name': 'libuv', + 'type': '<(uv_library)', + 'include_dirs': [ + 'include', + 'src/', + ], + 'direct_dependent_settings': { + 'include_dirs': [ 'include' ], + 'conditions': [ + ['OS != "win"', { + 'defines': [ + '_LARGEFILE_SOURCE', + '_FILE_OFFSET_BITS=64', + ], + }], + ['OS in "mac ios"', { + 'defines': [ '_DARWIN_USE_64_BIT_INODE=1' ], + }], + ['OS == "linux"', { + 'defines': [ '_POSIX_C_SOURCE=200112' ], + }], + ], + }, + 'sources': [ + 'common.gypi', + 'include/uv.h', + 'include/tree.h', + 'include/uv-errno.h', + 'include/uv-threadpool.h', + 'include/uv-version.h', + 'src/fs-poll.c', + 'src/heap-inl.h', + 'src/inet.c', + 'src/queue.h', + 'src/threadpool.c', + 'src/uv-common.c', + 'src/uv-common.h', + 'src/version.c' + ], + 'conditions': [ + [ 'OS=="win"', { + 'defines': [ + '_WIN32_WINNT=0x0600', + '_GNU_SOURCE', + ], + 'sources': [ + 'include/uv-win.h', + 'src/win/async.c', + 'src/win/atomicops-inl.h', + 'src/win/core.c', + 'src/win/dl.c', + 'src/win/error.c', + 'src/win/fs.c', + 'src/win/fs-event.c', + 'src/win/getaddrinfo.c', + 'src/win/getnameinfo.c', + 'src/win/handle.c', + 'src/win/handle-inl.h', + 'src/win/internal.h', + 'src/win/loop-watcher.c', + 'src/win/pipe.c', + 'src/win/thread.c', + 'src/win/poll.c', + 'src/win/process.c', + 'src/win/process-stdio.c', + 'src/win/req.c', + 'src/win/req-inl.h', + 'src/win/signal.c', + 'src/win/stream.c', + 'src/win/stream-inl.h', + 'src/win/tcp.c', + 'src/win/tty.c', + 'src/win/timer.c', + 'src/win/udp.c', + 'src/win/util.c', + 'src/win/winapi.c', + 'src/win/winapi.h', + 'src/win/winsock.c', + 'src/win/winsock.h', + ], + 'conditions': [ + ['MSVS_VERSION < "2015"', { + 'sources': [ + 'src/win/snprintf.c' + ] + }] + ], + 'link_settings': { + 'libraries': [ + '-ladvapi32', + '-liphlpapi', + '-lpsapi', + '-lshell32', + '-luserenv', + '-lws2_32' + ], + }, + }, { # Not Windows i.e. POSIX + 'cflags': [ + '-g', + '--std=gnu89', + '-pedantic', + '-Wall', + '-Wextra', + '-Wno-unused-parameter', + ], + 'sources': [ + 'include/uv-unix.h', + 'include/uv-linux.h', + 'include/uv-sunos.h', + 'include/uv-darwin.h', + 'include/uv-bsd.h', + 'include/uv-aix.h', + 'src/unix/async.c', + 'src/unix/atomic-ops.h', + 'src/unix/core.c', + 'src/unix/dl.c', + 'src/unix/fs.c', + 'src/unix/getaddrinfo.c', + 'src/unix/getnameinfo.c', + 'src/unix/internal.h', + 'src/unix/loop.c', + 'src/unix/loop-watcher.c', + 'src/unix/pipe.c', + 'src/unix/poll.c', + 'src/unix/process.c', + 'src/unix/signal.c', + 'src/unix/spinlock.h', + 'src/unix/stream.c', + 'src/unix/tcp.c', + 'src/unix/thread.c', + 'src/unix/timer.c', + 'src/unix/tty.c', + 'src/unix/udp.c', + ], + 'link_settings': { + 'libraries': [ '-lm' ], + 'conditions': [ + ['OS=="solaris"', { + 'ldflags': [ '-pthreads' ], + }], + ['OS != "solaris" and OS != "android"', { + 'ldflags': [ '-pthread' ], + }], + ], + }, + 'conditions': [ + ['uv_library=="shared_library"', { + 'cflags': [ '-fPIC' ], + }], + ['uv_library=="shared_library" and OS!="mac"', { + # This will cause gyp to set soname + # Must correspond with UV_VERSION_MAJOR + # in include/uv-version.h + 'product_extension': 'so.1', + }], + ], + }], + [ 'OS in "linux mac ios android"', { + 'sources': [ 'src/unix/proctitle.c' ], + }], + [ 'OS in "mac ios"', { + 'sources': [ + 'src/unix/darwin.c', + 'src/unix/fsevents.c', + 'src/unix/darwin-proctitle.c', + ], + 'defines': [ + '_DARWIN_USE_64_BIT_INODE=1', + '_DARWIN_UNLIMITED_SELECT=1', + ] + }], + [ 'OS!="mac"', { + # Enable on all platforms except OS X. The antique gcc/clang that + # ships with Xcode emits waaaay too many false positives. + 'cflags': [ '-Wstrict-aliasing' ], + }], + [ 'OS=="linux"', { + 'defines': [ '_GNU_SOURCE' ], + 'sources': [ + 'src/unix/linux-core.c', + 'src/unix/linux-inotify.c', + 'src/unix/linux-syscalls.c', + 'src/unix/linux-syscalls.h', + ], + 'link_settings': { + 'libraries': [ '-ldl', '-lrt' ], + }, + }], + [ 'OS=="android"', { + 'sources': [ + 'src/unix/linux-core.c', + 'src/unix/linux-inotify.c', + 'src/unix/linux-syscalls.c', + 'src/unix/linux-syscalls.h', + 'src/unix/pthread-fixes.c', + 'src/unix/android-ifaddrs.c' + ], + 'link_settings': { + 'libraries': [ '-ldl' ], + }, + }], + [ 'OS=="solaris"', { + 'sources': [ 'src/unix/sunos.c' ], + 'defines': [ + '__EXTENSIONS__', + '_XOPEN_SOURCE=500', + ], + 'link_settings': { + 'libraries': [ + '-lkstat', + '-lnsl', + '-lsendfile', + '-lsocket', + ], + }, + }], + [ 'OS=="aix"', { + 'sources': [ 'src/unix/aix.c' ], + 'defines': [ + '_ALL_SOURCE', + '_XOPEN_SOURCE=500', + '_LINUX_SOURCE_COMPAT', + ], + 'link_settings': { + 'libraries': [ + '-lperfstat', + ], + }, + }], + [ 'OS=="freebsd" or OS=="dragonflybsd"', { + 'sources': [ 'src/unix/freebsd.c' ], + }], + [ 'OS=="openbsd"', { + 'sources': [ 'src/unix/openbsd.c' ], + }], + [ 'OS=="netbsd"', { + 'sources': [ 'src/unix/netbsd.c' ], + }], + [ 'OS in "freebsd dragonflybsd openbsd netbsd".split()', { + 'link_settings': { + 'libraries': [ '-lkvm' ], + }, + }], + [ 'OS in "ios mac freebsd dragonflybsd openbsd netbsd".split()', { + 'sources': [ 'src/unix/kqueue.c' ], + }], + ['uv_library=="shared_library"', { + 'defines': [ 'BUILDING_UV_SHARED=1' ] + }], + ] + }, + + { + 'target_name': 'run-tests', + 'type': 'executable', + 'dependencies': [ 'libuv' ], + 'sources': [ + 'test/blackhole-server.c', + 'test/echo-server.c', + 'test/run-tests.c', + 'test/runner.c', + 'test/runner.h', + 'test/test-get-loadavg.c', + 'test/task.h', + 'test/test-active.c', + 'test/test-async.c', + 'test/test-async-null-cb.c', + 'test/test-callback-stack.c', + 'test/test-callback-order.c', + 'test/test-close-fd.c', + 'test/test-close-order.c', + 'test/test-connection-fail.c', + 'test/test-cwd-and-chdir.c', + 'test/test-default-loop-close.c', + 'test/test-delayed-accept.c', + 'test/test-error.c', + 'test/test-embed.c', + 'test/test-emfile.c', + 'test/test-fail-always.c', + 'test/test-fs.c', + 'test/test-fs-event.c', + 'test/test-get-currentexe.c', + 'test/test-get-memory.c', + 'test/test-getaddrinfo.c', + 'test/test-getnameinfo.c', + 'test/test-getsockname.c', + 'test/test-handle-fileno.c', + 'test/test-homedir.c', + 'test/test-hrtime.c', + 'test/test-idle.c', + 'test/test-ip6-addr.c', + 'test/test-ipc.c', + 'test/test-ipc-send-recv.c', + 'test/test-list.h', + 'test/test-loop-handles.c', + 'test/test-loop-alive.c', + 'test/test-loop-close.c', + 'test/test-loop-stop.c', + 'test/test-loop-time.c', + 'test/test-loop-configure.c', + 'test/test-walk-handles.c', + 'test/test-watcher-cross-stop.c', + 'test/test-multiple-listen.c', + 'test/test-osx-select.c', + 'test/test-pass-always.c', + 'test/test-ping-pong.c', + 'test/test-pipe-bind-error.c', + 'test/test-pipe-connect-error.c', + 'test/test-pipe-connect-multiple.c', + 'test/test-pipe-connect-prepare.c', + 'test/test-pipe-getsockname.c', + 'test/test-pipe-pending-instances.c', + 'test/test-pipe-sendmsg.c', + 'test/test-pipe-server-close.c', + 'test/test-pipe-close-stdout-read-stdin.c', + 'test/test-pipe-set-non-blocking.c', + 'test/test-platform-output.c', + 'test/test-poll.c', + 'test/test-poll-close.c', + 'test/test-poll-close-doesnt-corrupt-stack.c', + 'test/test-poll-closesocket.c', + 'test/test-process-title.c', + 'test/test-queue-foreach-delete.c', + 'test/test-ref.c', + 'test/test-run-nowait.c', + 'test/test-run-once.c', + 'test/test-semaphore.c', + 'test/test-shutdown-close.c', + 'test/test-shutdown-eof.c', + 'test/test-shutdown-twice.c', + 'test/test-signal.c', + 'test/test-signal-multiple-loops.c', + 'test/test-socket-buffer-size.c', + 'test/test-spawn.c', + 'test/test-fs-poll.c', + 'test/test-stdio-over-pipes.c', + 'test/test-tcp-bind-error.c', + 'test/test-tcp-bind6-error.c', + 'test/test-tcp-close.c', + 'test/test-tcp-close-accept.c', + 'test/test-tcp-close-while-connecting.c', + 'test/test-tcp-create-socket-early.c', + 'test/test-tcp-connect-error-after-write.c', + 'test/test-tcp-shutdown-after-write.c', + 'test/test-tcp-flags.c', + 'test/test-tcp-connect-error.c', + 'test/test-tcp-connect-timeout.c', + 'test/test-tcp-connect6-error.c', + 'test/test-tcp-open.c', + 'test/test-tcp-write-to-half-open-connection.c', + 'test/test-tcp-write-after-connect.c', + 'test/test-tcp-writealot.c', + 'test/test-tcp-write-fail.c', + 'test/test-tcp-try-write.c', + 'test/test-tcp-unexpected-read.c', + 'test/test-tcp-oob.c', + 'test/test-tcp-read-stop.c', + 'test/test-tcp-write-queue-order.c', + 'test/test-threadpool.c', + 'test/test-threadpool-cancel.c', + 'test/test-thread-equal.c', + 'test/test-mutexes.c', + 'test/test-thread.c', + 'test/test-barrier.c', + 'test/test-condvar.c', + 'test/test-timer-again.c', + 'test/test-timer-from-check.c', + 'test/test-timer.c', + 'test/test-tty.c', + 'test/test-udp-bind.c', + 'test/test-udp-create-socket-early.c', + 'test/test-udp-dgram-too-big.c', + 'test/test-udp-ipv6.c', + 'test/test-udp-open.c', + 'test/test-udp-options.c', + 'test/test-udp-send-and-recv.c', + 'test/test-udp-send-immediate.c', + 'test/test-udp-send-unreachable.c', + 'test/test-udp-multicast-join.c', + 'test/test-udp-multicast-join6.c', + 'test/test-dlerror.c', + 'test/test-udp-multicast-ttl.c', + 'test/test-ip4-addr.c', + 'test/test-ip6-addr.c', + 'test/test-udp-multicast-interface.c', + 'test/test-udp-multicast-interface6.c', + 'test/test-udp-try-send.c', + ], + 'conditions': [ + [ 'OS=="win"', { + 'sources': [ + 'test/runner-win.c', + 'test/runner-win.h' + ], + 'libraries': [ '-lws2_32' ] + }, { # POSIX + 'defines': [ '_GNU_SOURCE' ], + 'sources': [ + 'test/runner-unix.c', + 'test/runner-unix.h', + ], + }], + [ 'OS=="solaris"', { # make test-fs.c compile, needs _POSIX_C_SOURCE + 'defines': [ + '__EXTENSIONS__', + '_XOPEN_SOURCE=500', + ], + }], + [ 'OS=="aix"', { # make test-fs.c compile, needs _POSIX_C_SOURCE + 'defines': [ + '_ALL_SOURCE', + '_XOPEN_SOURCE=500', + ], + }], + ['uv_library=="shared_library"', { + 'defines': [ 'USING_UV_SHARED=1' ] + }], + ], + 'msvs-settings': { + 'VCLinkerTool': { + 'SubSystem': 1, # /subsystem:console + }, + }, + }, + + { + 'target_name': 'run-benchmarks', + 'type': 'executable', + 'dependencies': [ 'libuv' ], + 'sources': [ + 'test/benchmark-async.c', + 'test/benchmark-async-pummel.c', + 'test/benchmark-fs-stat.c', + 'test/benchmark-getaddrinfo.c', + 'test/benchmark-list.h', + 'test/benchmark-loop-count.c', + 'test/benchmark-million-async.c', + 'test/benchmark-million-timers.c', + 'test/benchmark-multi-accept.c', + 'test/benchmark-ping-pongs.c', + 'test/benchmark-pound.c', + 'test/benchmark-pump.c', + 'test/benchmark-sizes.c', + 'test/benchmark-spawn.c', + 'test/benchmark-thread.c', + 'test/benchmark-tcp-write-batch.c', + 'test/benchmark-udp-pummel.c', + 'test/dns-server.c', + 'test/echo-server.c', + 'test/blackhole-server.c', + 'test/run-benchmarks.c', + 'test/runner.c', + 'test/runner.h', + 'test/task.h', + ], + 'conditions': [ + [ 'OS=="win"', { + 'sources': [ + 'test/runner-win.c', + 'test/runner-win.h', + ], + 'libraries': [ '-lws2_32' ] + }, { # POSIX + 'defines': [ '_GNU_SOURCE' ], + 'sources': [ + 'test/runner-unix.c', + 'test/runner-unix.h', + ] + }], + ['uv_library=="shared_library"', { + 'defines': [ 'USING_UV_SHARED=1' ] + }], + ], + 'msvs-settings': { + 'VCLinkerTool': { + 'SubSystem': 1, # /subsystem:console + }, + }, + }, + ] +} diff --git a/3rdparty/libuv/vcbuild.bat b/3rdparty/libuv/vcbuild.bat new file mode 100644 index 00000000000..696f0db30e1 --- /dev/null +++ b/3rdparty/libuv/vcbuild.bat @@ -0,0 +1,153 @@ +@echo off + +cd %~dp0 + +if /i "%1"=="help" goto help +if /i "%1"=="--help" goto help +if /i "%1"=="-help" goto help +if /i "%1"=="/help" goto help +if /i "%1"=="?" goto help +if /i "%1"=="-?" goto help +if /i "%1"=="--?" goto help +if /i "%1"=="/?" goto help + +@rem Process arguments. +set config= +set target=Build +set noprojgen= +set nobuild= +set run= +set target_arch=ia32 +set vs_toolset=x86 +set platform=WIN32 +set library=static_library + +:next-arg +if "%1"=="" goto args-done +if /i "%1"=="debug" set config=Debug&goto arg-ok +if /i "%1"=="release" set config=Release&goto arg-ok +if /i "%1"=="test" set run=run-tests.exe&goto arg-ok +if /i "%1"=="bench" set run=run-benchmarks.exe&goto arg-ok +if /i "%1"=="clean" set target=Clean&goto arg-ok +if /i "%1"=="noprojgen" set noprojgen=1&goto arg-ok +if /i "%1"=="nobuild" set nobuild=1&goto arg-ok +if /i "%1"=="x86" set target_arch=ia32&set platform=WIN32&set vs_toolset=x86&goto arg-ok +if /i "%1"=="ia32" set target_arch=ia32&set platform=WIN32&set vs_toolset=x86&goto arg-ok +if /i "%1"=="x64" set target_arch=x64&set platform=x64&set vs_toolset=x64&goto arg-ok +if /i "%1"=="shared" set library=shared_library&goto arg-ok +if /i "%1"=="static" set library=static_library&goto arg-ok +:arg-ok +shift +goto next-arg +:args-done + +if defined WindowsSDKDir goto select-target +if defined VCINSTALLDIR goto select-target + +@rem Look for Visual Studio 2015 +if not defined VS140COMNTOOLS goto vc-set-2013 +if not exist "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2013 +call "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset% +set GYP_MSVS_VERSION=2015 +goto select-target + +:vc-set-2013 +@rem Look for Visual Studio 2013 +if not defined VS120COMNTOOLS goto vc-set-2012 +if not exist "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2012 +call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset% +set GYP_MSVS_VERSION=2013 +goto select-target + +:vc-set-2012 +@rem Look for Visual Studio 2012 +if not defined VS110COMNTOOLS goto vc-set-2010 +if not exist "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2010 +call "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset% +set GYP_MSVS_VERSION=2012 +goto select-target + +:vc-set-2010 +@rem Look for Visual Studio 2010 +if not defined VS100COMNTOOLS goto vc-set-2008 +if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2008 +call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset% +set GYP_MSVS_VERSION=2010 +goto select-target + +:vc-set-2008 +@rem Look for Visual Studio 2008 +if not defined VS90COMNTOOLS goto vc-set-notfound +if not exist "%VS90COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-notfound +call "%VS90COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset% +set GYP_MSVS_VERSION=2008 +goto select-target + +:vc-set-notfound +echo Warning: Visual Studio not found + +:select-target +if not "%config%"=="" goto project-gen +if "%run%"=="run-tests.exe" set config=Debug& goto project-gen +if "%run%"=="run-benchmarks.exe" set config=Release& goto project-gen +set config=Debug + +:project-gen +@rem Skip project generation if requested. +if defined noprojgen goto msbuild + +@rem Generate the VS project. +if exist build\gyp goto have_gyp +echo git clone https://chromium.googlesource.com/external/gyp build/gyp +git clone https://chromium.googlesource.com/external/gyp build/gyp +if errorlevel 1 goto gyp_install_failed +goto have_gyp + +:gyp_install_failed +echo Failed to download gyp. Make sure you have git installed, or +echo manually install gyp into %~dp0build\gyp. +exit /b 1 + +:have_gyp +if not defined PYTHON set PYTHON=python +"%PYTHON%" gyp_uv.py -Dtarget_arch=%target_arch% -Duv_library=%library% +if errorlevel 1 goto create-msvs-files-failed +if not exist uv.sln goto create-msvs-files-failed +echo Project files generated. + +:msbuild +@rem Skip project generation if requested. +if defined nobuild goto run + +@rem Check if VS build env is available +if defined VCINSTALLDIR goto msbuild-found +if defined WindowsSDKDir goto msbuild-found +echo Build skipped. To build, this file needs to run from VS cmd prompt. +goto run + +@rem Build the sln with msbuild. +:msbuild-found +msbuild uv.sln /t:%target% /p:Configuration=%config% /p:Platform="%platform%" /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo +if errorlevel 1 exit /b 1 + +:run +@rem Run tests if requested. +if "%run%"=="" goto exit +if not exist %config%\%run% goto exit +echo running '%config%\%run%' +%config%\%run% +goto exit + +:create-msvs-files-failed +echo Failed to create vc project files. +exit /b 1 + +:help +echo vcbuild.bat [debug/release] [test/bench] [clean] [noprojgen] [nobuild] [x86/x64] [static/shared] +echo Examples: +echo vcbuild.bat : builds debug build +echo vcbuild.bat test : builds debug build and runs tests +echo vcbuild.bat release bench: builds release build and runs benchmarks +goto exit + +:exit -- cgit v1.2.3-70-g09d2 From 7d915c5a79212203fc6cea2c0fabe8e450954a54 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 31 Jan 2016 15:28:49 +0100 Subject: Added script for building libuv (nw) --- scripts/src/3rdparty.lua | 173 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 173 insertions(+) diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 66fba9f2144..87a325f0bf0 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -917,3 +917,176 @@ links { "portaudio", } end + +-------------------------------------------------- +-- libuv library objects +-------------------------------------------------- +project "uv" + uuid "cd2afe7f-139d-49c3-9000-fc9119f3cea0" + kind "StaticLib" + + includedirs { + MAME_DIR .. "3rdparty/libuv/include", + MAME_DIR .. "3rdparty/libuv/src", + MAME_DIR .. "3rdparty/libuv/src/win", + } + + configuration { "gmake" } + buildoptions_c { + "-Wno-strict-prototypes", + "-Wno-bad-function-cast", + "-Wno-write-strings", + "-Wno-missing-braces", + "-Wno-undef", + "-Wno-unused-variable", + } + + + local version = str_to_version(_OPTIONS["gcc_version"]) + if (_OPTIONS["gcc"]~=nil) then + if string.find(_OPTIONS["gcc"], "clang") then + buildoptions_c { + "-Wno-unknown-warning-option", + "-Wno-unknown-attributes", + "-Wno-null-dereference", + "-Wno-unused-but-set-variable", + "-Wno-maybe-uninitialized", + } + else + buildoptions_c { + "-Wno-unused-but-set-variable", + "-Wno-maybe-uninitialized", + } + end + end + + configuration { "vs*" } + buildoptions { + "/wd4054", -- warning C4054: 'type cast' : from function pointer 'xxx' to data pointer 'void *' + "/wd4204", -- warning C4204: nonstandard extension used : non-constant aggregate initializer + "/wd4210", -- warning C4210: nonstandard extension used : function given file scope + "/wd4701", -- warning C4701: potentially uninitialized local variable 'xxx' used + "/wd4703", -- warning C4703: potentially uninitialized local pointer variable 'xxx' used + } + + configuration { } + + files { + MAME_DIR .. "3rdparty/libuv/src/fs-poll.c", + MAME_DIR .. "3rdparty/libuv/src/inet.c", + MAME_DIR .. "3rdparty/libuv/src/threadpool.c", + MAME_DIR .. "3rdparty/libuv/src/uv-common.c", + MAME_DIR .. "3rdparty/libuv/src/version.c", + } + + if _OPTIONS["targetos"]=="windows" then + defines { + "WIN32_LEAN_AND_MEAN", + "_WIN32_WINNT=0x0502", + } + if _ACTION == "vs2013" then + files { + MAME_DIR .. "3rdparty/libuv/src/win/snprintf.c", + } + end + configuration { } + files { + MAME_DIR .. "3rdparty/libuv/src/win/async.c", + MAME_DIR .. "3rdparty/libuv/src/win/core.c", + MAME_DIR .. "3rdparty/libuv/src/win/dl.c", + MAME_DIR .. "3rdparty/libuv/src/win/error.c", + MAME_DIR .. "3rdparty/libuv/src/win/fs-event.c", + MAME_DIR .. "3rdparty/libuv/src/win/fs.c", + MAME_DIR .. "3rdparty/libuv/src/win/getaddrinfo.c", + MAME_DIR .. "3rdparty/libuv/src/win/getnameinfo.c", + MAME_DIR .. "3rdparty/libuv/src/win/handle.c", + MAME_DIR .. "3rdparty/libuv/src/win/loop-watcher.c", + MAME_DIR .. "3rdparty/libuv/src/win/pipe.c", + MAME_DIR .. "3rdparty/libuv/src/win/poll.c", + MAME_DIR .. "3rdparty/libuv/src/win/process-stdio.c", + MAME_DIR .. "3rdparty/libuv/src/win/process.c", + MAME_DIR .. "3rdparty/libuv/src/win/req.c", + MAME_DIR .. "3rdparty/libuv/src/win/signal.c", + MAME_DIR .. "3rdparty/libuv/src/win/stream.c", + MAME_DIR .. "3rdparty/libuv/src/win/tcp.c", + MAME_DIR .. "3rdparty/libuv/src/win/thread.c", + MAME_DIR .. "3rdparty/libuv/src/win/timer.c", + MAME_DIR .. "3rdparty/libuv/src/win/tty.c", + MAME_DIR .. "3rdparty/libuv/src/win/udp.c", + MAME_DIR .. "3rdparty/libuv/src/win/util.c", + MAME_DIR .. "3rdparty/libuv/src/win/winapi.c", + MAME_DIR .. "3rdparty/libuv/src/win/winsock.c", + } + end + + if _OPTIONS["targetos"]~="windows" then + files { + MAME_DIR .. "3rdparty/libuv/src/unix/async.c", + MAME_DIR .. "3rdparty/libuv/src/unix/atomic-ops.h", + MAME_DIR .. "3rdparty/libuv/src/unix/core.c", + MAME_DIR .. "3rdparty/libuv/src/unix/dl.c", + MAME_DIR .. "3rdparty/libuv/src/unix/fs.c", + MAME_DIR .. "3rdparty/libuv/src/unix/getaddrinfo.c", + MAME_DIR .. "3rdparty/libuv/src/unix/getnameinfo.c", + MAME_DIR .. "3rdparty/libuv/src/unix/internal.h", + MAME_DIR .. "3rdparty/libuv/src/unix/loop-watcher.c", + MAME_DIR .. "3rdparty/libuv/src/unix/loop.c", + MAME_DIR .. "3rdparty/libuv/src/unix/pipe.c", + MAME_DIR .. "3rdparty/libuv/src/unix/poll.c", + MAME_DIR .. "3rdparty/libuv/src/unix/process.c", + MAME_DIR .. "3rdparty/libuv/src/unix/signal.c", + MAME_DIR .. "3rdparty/libuv/src/unix/spinlock.h", + MAME_DIR .. "3rdparty/libuv/src/unix/stream.c", + MAME_DIR .. "3rdparty/libuv/src/unix/tcp.c", + MAME_DIR .. "3rdparty/libuv/src/unix/thread.c", + MAME_DIR .. "3rdparty/libuv/src/unix/timer.c", + MAME_DIR .. "3rdparty/libuv/src/unix/tty.c", + MAME_DIR .. "3rdparty/libuv/src/unix/udp.c", + } + end + if _OPTIONS["targetos"]=="linux" then + defines { + "_GNU_SOURCE", + } + files { + MAME_DIR .. "3rdparty/libuv/src/unix/linux-core.c", + MAME_DIR .. "3rdparty/libuv/src/unix/linux-inotify.c", + MAME_DIR .. "3rdparty/libuv/src/unix/linux-syscalls.c", + MAME_DIR .. "3rdparty/libuv/src/unix/linux-syscalls.h", + MAME_DIR .. "3rdparty/libuv/src/unix/proctitle.c", + } + end + if _OPTIONS["targetos"]=="macosx" then + defines { + "_DARWIN_USE_64_BIT_INODE=1", + "_DARWIN_UNLIMITED_SELECT=1", + } + files { + MAME_DIR .. "3rdparty/libuv/src/unix/darwin.c", + MAME_DIR .. "3rdparty/libuv/src/unix/darwin-proctitle.c", + MAME_DIR .. "3rdparty/libuv/src/unix/fsevents.c", + MAME_DIR .. "3rdparty/libuv/src/unix/kqueue.c", + MAME_DIR .. "3rdparty/libuv/src/unix/proctitle.c", + } + end + if _OPTIONS["targetos"]=="solaris" then + defines { + "__EXTENSIONS__", + "_XOPEN_SOURCE=500", + } + files { + MAME_DIR .. "3rdparty/libuv/src/unix/sunos.c", + } + end + if _OPTIONS["targetos"]=="freebsd" then + files { + MAME_DIR .. "3rdparty/libuv/src/unix/freebsd.c", + MAME_DIR .. "3rdparty/libuv/src/unix/kqueue.c", + } + end + + if (_OPTIONS["SHADOW_CHECK"]=="1") then + removebuildoptions { + "-Wshadow" + } + end -- cgit v1.2.3-70-g09d2 From c152866e024dfd0d1f519aca0189b2178dae3286 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 31 Jan 2016 15:34:40 +0100 Subject: added http-parser (nw) --- 3rdparty/http-parser/.gitignore | 28 + 3rdparty/http-parser/.mailmap | 8 + 3rdparty/http-parser/.travis.yml | 13 + 3rdparty/http-parser/AUTHORS | 67 + 3rdparty/http-parser/LICENSE-MIT | 23 + 3rdparty/http-parser/Makefile | 136 + 3rdparty/http-parser/README.md | 183 ++ 3rdparty/http-parser/bench.c | 111 + 3rdparty/http-parser/contrib/parsertrace.c | 160 ++ 3rdparty/http-parser/contrib/url_parser.c | 46 + 3rdparty/http-parser/http_parser.c | 2429 ++++++++++++++++++ 3rdparty/http-parser/http_parser.gyp | 111 + 3rdparty/http-parser/http_parser.h | 342 +++ 3rdparty/http-parser/test.c | 3852 ++++++++++++++++++++++++++++ scripts/src/3rdparty.lua | 19 + 15 files changed, 7528 insertions(+) create mode 100644 3rdparty/http-parser/.gitignore create mode 100644 3rdparty/http-parser/.mailmap create mode 100644 3rdparty/http-parser/.travis.yml create mode 100644 3rdparty/http-parser/AUTHORS create mode 100644 3rdparty/http-parser/LICENSE-MIT create mode 100644 3rdparty/http-parser/Makefile create mode 100644 3rdparty/http-parser/README.md create mode 100644 3rdparty/http-parser/bench.c create mode 100644 3rdparty/http-parser/contrib/parsertrace.c create mode 100644 3rdparty/http-parser/contrib/url_parser.c create mode 100644 3rdparty/http-parser/http_parser.c create mode 100644 3rdparty/http-parser/http_parser.gyp create mode 100644 3rdparty/http-parser/http_parser.h create mode 100644 3rdparty/http-parser/test.c diff --git a/3rdparty/http-parser/.gitignore b/3rdparty/http-parser/.gitignore new file mode 100644 index 00000000000..32cb51b2d3f --- /dev/null +++ b/3rdparty/http-parser/.gitignore @@ -0,0 +1,28 @@ +/out/ +core +tags +*.o +test +test_g +test_fast +bench +url_parser +parsertrace +parsertrace_g +*.mk +*.Makefile +*.so.* +*.a + + +# Visual Studio uglies +*.suo +*.sln +*.vcxproj +*.vcxproj.filters +*.vcxproj.user +*.opensdf +*.ncrunchsolution* +*.sdf +*.vsp +*.psess diff --git a/3rdparty/http-parser/.mailmap b/3rdparty/http-parser/.mailmap new file mode 100644 index 00000000000..278d1412637 --- /dev/null +++ b/3rdparty/http-parser/.mailmap @@ -0,0 +1,8 @@ +# update AUTHORS with: +# git log --all --reverse --format='%aN <%aE>' | perl -ne 'BEGIN{print "# Authors ordered by first contribution.\n"} print unless $h{$_}; $h{$_} = 1' > AUTHORS +Ryan Dahl +Salman Haq +Simon Zimmermann +Thomas LE ROUX LE ROUX Thomas +Thomas LE ROUX Thomas LE ROUX +Fedor Indutny diff --git a/3rdparty/http-parser/.travis.yml b/3rdparty/http-parser/.travis.yml new file mode 100644 index 00000000000..4b038e6e62d --- /dev/null +++ b/3rdparty/http-parser/.travis.yml @@ -0,0 +1,13 @@ +language: c + +compiler: + - clang + - gcc + +script: + - "make" + +notifications: + email: false + irc: + - "irc.freenode.net#node-ci" diff --git a/3rdparty/http-parser/AUTHORS b/3rdparty/http-parser/AUTHORS new file mode 100644 index 00000000000..8e2df1d06e6 --- /dev/null +++ b/3rdparty/http-parser/AUTHORS @@ -0,0 +1,67 @@ +# Authors ordered by first contribution. +Ryan Dahl +Jeremy Hinegardner +Sergey Shepelev +Joe Damato +tomika +Phoenix Sol +Cliff Frey +Ewen Cheslack-Postava +Santiago Gala +Tim Becker +Jeff Terrace +Ben Noordhuis +Nathan Rajlich +Mark Nottingham +Aman Gupta +Tim Becker +Sean Cunningham +Peter Griess +Salman Haq +Cliff Frey +Jon Kolb +Fouad Mardini +Paul Querna +Felix Geisendörfer +koichik +Andre Caron +Ivo Raisr +James McLaughlin +David Gwynne +Thomas LE ROUX +Randy Rizun +Andre Louis Caron +Simon Zimmermann +Erik Dubbelboer +Martell Malone +Bertrand Paquet +BogDan Vatra +Peter Faiman +Corey Richardson +Tóth Tamás +Cam Swords +Chris Dickinson +Uli Köhler +Charlie Somerville +Patrik Stutz +Fedor Indutny +runner +Alexis Campailla +David Wragg +Vinnie Falco +Alex Butum +Rex Feng +Alex Kocharin +Mark Koopman +Helge Heß +Alexis La Goutte +George Miroshnykov +Maciej Małecki +Marc O'Morain +Jeff Pinner +Timothy J Fontaine +Akagi201 +Romain Giraud +Jay Satiro +Arne Steen +Kjell Schubert diff --git a/3rdparty/http-parser/LICENSE-MIT b/3rdparty/http-parser/LICENSE-MIT new file mode 100644 index 00000000000..58010b38894 --- /dev/null +++ b/3rdparty/http-parser/LICENSE-MIT @@ -0,0 +1,23 @@ +http_parser.c is based on src/http/ngx_http_parse.c from NGINX copyright +Igor Sysoev. + +Additional changes are licensed under the same terms as NGINX and +copyright Joyent, Inc. and other Node contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/3rdparty/http-parser/Makefile b/3rdparty/http-parser/Makefile new file mode 100644 index 00000000000..373709c6672 --- /dev/null +++ b/3rdparty/http-parser/Makefile @@ -0,0 +1,136 @@ +# Copyright Joyent, Inc. and other Node contributors. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"') +SONAME ?= libhttp_parser.so.2.5.0 + +CC?=gcc +AR?=ar + +CPPFLAGS ?= +LDFLAGS ?= + +CPPFLAGS += -I. +CPPFLAGS_DEBUG = $(CPPFLAGS) -DHTTP_PARSER_STRICT=1 +CPPFLAGS_DEBUG += $(CPPFLAGS_DEBUG_EXTRA) +CPPFLAGS_FAST = $(CPPFLAGS) -DHTTP_PARSER_STRICT=0 +CPPFLAGS_FAST += $(CPPFLAGS_FAST_EXTRA) +CPPFLAGS_BENCH = $(CPPFLAGS_FAST) + +CFLAGS += -Wall -Wextra -Werror +CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA) +CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA) +CFLAGS_BENCH = $(CFLAGS_FAST) -Wno-unused-parameter +CFLAGS_LIB = $(CFLAGS_FAST) -fPIC + +LDFLAGS_LIB = $(LDFLAGS) -shared + +INSTALL ?= install +PREFIX ?= $(DESTDIR)/usr/local +LIBDIR = $(PREFIX)/lib +INCLUDEDIR = $(PREFIX)/include + +ifneq (darwin,$(PLATFORM)) +# TODO(bnoordhuis) The native SunOS linker expects -h rather than -soname... +LDFLAGS_LIB += -Wl,-soname=$(SONAME) +endif + +test: test_g test_fast + ./test_g + ./test_fast + +test_g: http_parser_g.o test_g.o + $(CC) $(CFLAGS_DEBUG) $(LDFLAGS) http_parser_g.o test_g.o -o $@ + +test_g.o: test.c http_parser.h Makefile + $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c test.c -o $@ + +http_parser_g.o: http_parser.c http_parser.h Makefile + $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c http_parser.c -o $@ + +test_fast: http_parser.o test.o http_parser.h + $(CC) $(CFLAGS_FAST) $(LDFLAGS) http_parser.o test.o -o $@ + +test.o: test.c http_parser.h Makefile + $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c test.c -o $@ + +bench: http_parser.o bench.o + $(CC) $(CFLAGS_BENCH) $(LDFLAGS) http_parser.o bench.o -o $@ + +bench.o: bench.c http_parser.h Makefile + $(CC) $(CPPFLAGS_BENCH) $(CFLAGS_BENCH) -c bench.c -o $@ + +http_parser.o: http_parser.c http_parser.h Makefile + $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c http_parser.c + +test-run-timed: test_fast + while(true) do time ./test_fast > /dev/null; done + +test-valgrind: test_g + valgrind ./test_g + +libhttp_parser.o: http_parser.c http_parser.h Makefile + $(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o + +library: libhttp_parser.o + $(CC) $(LDFLAGS_LIB) -o $(SONAME) $< + +package: http_parser.o + $(AR) rcs libhttp_parser.a http_parser.o + +url_parser: http_parser.o contrib/url_parser.c + $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o $@ + +url_parser_g: http_parser_g.o contrib/url_parser.c + $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o $@ + +parsertrace: http_parser.o contrib/parsertrace.c + $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o parsertrace + +parsertrace_g: http_parser_g.o contrib/parsertrace.c + $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o parsertrace_g + +tags: http_parser.c http_parser.h test.c + ctags $^ + +install: library + $(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h + $(INSTALL) -D $(SONAME) $(LIBDIR)/$(SONAME) + ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.so + +install-strip: library + $(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h + $(INSTALL) -D -s $(SONAME) $(LIBDIR)/$(SONAME) + ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.so + +uninstall: + rm $(INCLUDEDIR)/http_parser.h + rm $(LIBDIR)/$(SONAME) + rm $(LIBDIR)/libhttp_parser.so + +clean: + rm -f *.o *.a tags test test_fast test_g \ + http_parser.tar libhttp_parser.so.* \ + url_parser url_parser_g parsertrace parsertrace_g + +contrib/url_parser.c: http_parser.h +contrib/parsertrace.c: http_parser.h + +.PHONY: clean package test-run test-run-timed test-valgrind install install-strip uninstall diff --git a/3rdparty/http-parser/README.md b/3rdparty/http-parser/README.md new file mode 100644 index 00000000000..7c54dd42d08 --- /dev/null +++ b/3rdparty/http-parser/README.md @@ -0,0 +1,183 @@ +HTTP Parser +=========== + +[![Build Status](https://travis-ci.org/joyent/http-parser.png?branch=master)](https://travis-ci.org/joyent/http-parser) + +This is a parser for HTTP messages written in C. It parses both requests and +responses. The parser is designed to be used in performance HTTP +applications. It does not make any syscalls nor allocations, it does not +buffer data, it can be interrupted at anytime. Depending on your +architecture, it only requires about 40 bytes of data per message +stream (in a web server that is per connection). + +Features: + + * No dependencies + * Handles persistent streams (keep-alive). + * Decodes chunked encoding. + * Upgrade support + * Defends against buffer overflow attacks. + +The parser extracts the following information from HTTP messages: + + * Header fields and values + * Content-Length + * Request method + * Response status code + * Transfer-Encoding + * HTTP version + * Request URL + * Message body + + +Usage +----- + +One `http_parser` object is used per TCP connection. Initialize the struct +using `http_parser_init()` and set the callbacks. That might look something +like this for a request parser: +```c +http_parser_settings settings; +settings.on_url = my_url_callback; +settings.on_header_field = my_header_field_callback; +/* ... */ + +http_parser *parser = malloc(sizeof(http_parser)); +http_parser_init(parser, HTTP_REQUEST); +parser->data = my_socket; +``` + +When data is received on the socket execute the parser and check for errors. + +```c +size_t len = 80*1024, nparsed; +char buf[len]; +ssize_t recved; + +recved = recv(fd, buf, len, 0); + +if (recved < 0) { + /* Handle error. */ +} + +/* Start up / continue the parser. + * Note we pass recved==0 to signal that EOF has been received. + */ +nparsed = http_parser_execute(parser, &settings, buf, recved); + +if (parser->upgrade) { + /* handle new protocol */ +} else if (nparsed != recved) { + /* Handle error. Usually just close the connection. */ +} +``` + +HTTP needs to know where the end of the stream is. For example, sometimes +servers send responses without Content-Length and expect the client to +consume input (for the body) until EOF. To tell http_parser about EOF, give +`0` as the fourth parameter to `http_parser_execute()`. Callbacks and errors +can still be encountered during an EOF, so one must still be prepared +to receive them. + +Scalar valued message information such as `status_code`, `method`, and the +HTTP version are stored in the parser structure. This data is only +temporally stored in `http_parser` and gets reset on each new message. If +this information is needed later, copy it out of the structure during the +`headers_complete` callback. + +The parser decodes the transfer-encoding for both requests and responses +transparently. That is, a chunked encoding is decoded before being sent to +the on_body callback. + + +The Special Problem of Upgrade +------------------------------ + +HTTP supports upgrading the connection to a different protocol. An +increasingly common example of this is the Web Socket protocol which sends +a request like + + GET /demo HTTP/1.1 + Upgrade: WebSocket + Connection: Upgrade + Host: example.com + Origin: http://example.com + WebSocket-Protocol: sample + +followed by non-HTTP data. + +(See http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75 for more +information the Web Socket protocol.) + +To support this, the parser will treat this as a normal HTTP message without a +body, issuing both on_headers_complete and on_message_complete callbacks. However +http_parser_execute() will stop parsing at the end of the headers and return. + +The user is expected to check if `parser->upgrade` has been set to 1 after +`http_parser_execute()` returns. Non-HTTP data begins at the buffer supplied +offset by the return value of `http_parser_execute()`. + + +Callbacks +--------- + +During the `http_parser_execute()` call, the callbacks set in +`http_parser_settings` will be executed. The parser maintains state and +never looks behind, so buffering the data is not necessary. If you need to +save certain data for later usage, you can do that from the callbacks. + +There are two types of callbacks: + +* notification `typedef int (*http_cb) (http_parser*);` + Callbacks: on_message_begin, on_headers_complete, on_message_complete. +* data `typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);` + Callbacks: (requests only) on_url, + (common) on_header_field, on_header_value, on_body; + +Callbacks must return 0 on success. Returning a non-zero value indicates +error to the parser, making it exit immediately. + +In case you parse HTTP message in chunks (i.e. `read()` request line +from socket, parse, read half headers, parse, etc) your data callbacks +may be called more than once. Http-parser guarantees that data pointer is only +valid for the lifetime of callback. You can also `read()` into a heap allocated +buffer to avoid copying memory around if this fits your application. + +Reading headers may be a tricky task if you read/parse headers partially. +Basically, you need to remember whether last header callback was field or value +and apply the following logic: + + (on_header_field and on_header_value shortened to on_h_*) + ------------------------ ------------ -------------------------------------------- + | State (prev. callback) | Callback | Description/action | + ------------------------ ------------ -------------------------------------------- + | nothing (first call) | on_h_field | Allocate new buffer and copy callback data | + | | | into it | + ------------------------ ------------ -------------------------------------------- + | value | on_h_field | New header started. | + | | | Copy current name,value buffers to headers | + | | | list and allocate new buffer for new name | + ------------------------ ------------ -------------------------------------------- + | field | on_h_field | Previous name continues. Reallocate name | + | | | buffer and append callback data to it | + ------------------------ ------------ -------------------------------------------- + | field | on_h_value | Value for current header started. Allocate | + | | | new buffer and copy callback data to it | + ------------------------ ------------ -------------------------------------------- + | value | on_h_value | Value continues. Reallocate value buffer | + | | | and append callback data to it | + ------------------------ ------------ -------------------------------------------- + + +Parsing URLs +------------ + +A simplistic zero-copy URL parser is provided as `http_parser_parse_url()`. +Users of this library may wish to use it to parse URLs constructed from +consecutive `on_url` callbacks. + +See examples of reading in headers: + +* [partial example](http://gist.github.com/155877) in C +* [from http-parser tests](http://github.com/joyent/http-parser/blob/37a0ff8/test.c#L403) in C +* [from Node library](http://github.com/joyent/node/blob/842eaf4/src/http.js#L284) in Javascript diff --git a/3rdparty/http-parser/bench.c b/3rdparty/http-parser/bench.c new file mode 100644 index 00000000000..5b452fa1cdb --- /dev/null +++ b/3rdparty/http-parser/bench.c @@ -0,0 +1,111 @@ +/* Copyright Fedor Indutny. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ +#include "http_parser.h" +#include +#include +#include +#include + +static const char data[] = + "POST /joyent/http-parser HTTP/1.1\r\n" + "Host: github.com\r\n" + "DNT: 1\r\n" + "Accept-Encoding: gzip, deflate, sdch\r\n" + "Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4\r\n" + "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) " + "AppleWebKit/537.36 (KHTML, like Gecko) " + "Chrome/39.0.2171.65 Safari/537.36\r\n" + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9," + "image/webp,*/*;q=0.8\r\n" + "Referer: https://github.com/joyent/http-parser\r\n" + "Connection: keep-alive\r\n" + "Transfer-Encoding: chunked\r\n" + "Cache-Control: max-age=0\r\n\r\nb\r\nhello world\r\n0\r\n\r\n"; +static const size_t data_len = sizeof(data) - 1; + +static int on_info(http_parser* p) { + return 0; +} + + +static int on_data(http_parser* p, const char *at, size_t length) { + return 0; +} + +static http_parser_settings settings = { + .on_message_begin = on_info, + .on_headers_complete = on_info, + .on_message_complete = on_info, + .on_header_field = on_data, + .on_header_value = on_data, + .on_url = on_data, + .on_status = on_data, + .on_body = on_data +}; + +int bench(int iter_count, int silent) { + struct http_parser parser; + int i; + int err; + struct timeval start; + struct timeval end; + float rps; + + if (!silent) { + err = gettimeofday(&start, NULL); + assert(err == 0); + } + + for (i = 0; i < iter_count; i++) { + size_t parsed; + http_parser_init(&parser, HTTP_REQUEST); + + parsed = http_parser_execute(&parser, &settings, data, data_len); + assert(parsed == data_len); + } + + if (!silent) { + err = gettimeofday(&end, NULL); + assert(err == 0); + + fprintf(stdout, "Benchmark result:\n"); + + rps = (float) (end.tv_sec - start.tv_sec) + + (end.tv_usec - start.tv_usec) * 1e-6f; + fprintf(stdout, "Took %f seconds to run\n", rps); + + rps = (float) iter_count / rps; + fprintf(stdout, "%f req/sec\n", rps); + fflush(stdout); + } + + return 0; +} + +int main(int argc, char** argv) { + if (argc == 2 && strcmp(argv[1], "infinite") == 0) { + for (;;) + bench(5000000, 1); + return 0; + } else { + return bench(5000000, 0); + } +} diff --git a/3rdparty/http-parser/contrib/parsertrace.c b/3rdparty/http-parser/contrib/parsertrace.c new file mode 100644 index 00000000000..e7153680f46 --- /dev/null +++ b/3rdparty/http-parser/contrib/parsertrace.c @@ -0,0 +1,160 @@ +/* Based on src/http/ngx_http_parse.c from NGINX copyright Igor Sysoev + * + * Additional changes are licensed under the same terms as NGINX and + * copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* Dump what the parser finds to stdout as it happen */ + +#include "http_parser.h" +#include +#include +#include + +int on_message_begin(http_parser* _) { + (void)_; + printf("\n***MESSAGE BEGIN***\n\n"); + return 0; +} + +int on_headers_complete(http_parser* _) { + (void)_; + printf("\n***HEADERS COMPLETE***\n\n"); + return 0; +} + +int on_message_complete(http_parser* _) { + (void)_; + printf("\n***MESSAGE COMPLETE***\n\n"); + return 0; +} + +int on_url(http_parser* _, const char* at, size_t length) { + (void)_; + printf("Url: %.*s\n", (int)length, at); + return 0; +} + +int on_header_field(http_parser* _, const char* at, size_t length) { + (void)_; + printf("Header field: %.*s\n", (int)length, at); + return 0; +} + +int on_header_value(http_parser* _, const char* at, size_t length) { + (void)_; + printf("Header value: %.*s\n", (int)length, at); + return 0; +} + +int on_body(http_parser* _, const char* at, size_t length) { + (void)_; + printf("Body: %.*s\n", (int)length, at); + return 0; +} + +void usage(const char* name) { + fprintf(stderr, + "Usage: %s $type $filename\n" + " type: -x, where x is one of {r,b,q}\n" + " parses file as a Response, reQuest, or Both\n", + name); + exit(EXIT_FAILURE); +} + +int main(int argc, char* argv[]) { + enum http_parser_type file_type; + + if (argc != 3) { + usage(argv[0]); + } + + char* type = argv[1]; + if (type[0] != '-') { + usage(argv[0]); + } + + switch (type[1]) { + /* in the case of "-", type[1] will be NUL */ + case 'r': + file_type = HTTP_RESPONSE; + break; + case 'q': + file_type = HTTP_REQUEST; + break; + case 'b': + file_type = HTTP_BOTH; + break; + default: + usage(argv[0]); + } + + char* filename = argv[2]; + FILE* file = fopen(filename, "r"); + if (file == NULL) { + perror("fopen"); + goto fail; + } + + fseek(file, 0, SEEK_END); + long file_length = ftell(file); + if (file_length == -1) { + perror("ftell"); + goto fail; + } + fseek(file, 0, SEEK_SET); + + char* data = malloc(file_length); + if (fread(data, 1, file_length, file) != (size_t)file_length) { + fprintf(stderr, "couldn't read entire file\n"); + free(data); + goto fail; + } + + http_parser_settings settings; + memset(&settings, 0, sizeof(settings)); + settings.on_message_begin = on_message_begin; + settings.on_url = on_url; + settings.on_header_field = on_header_field; + settings.on_header_value = on_header_value; + settings.on_headers_complete = on_headers_complete; + settings.on_body = on_body; + settings.on_message_complete = on_message_complete; + + http_parser parser; + http_parser_init(&parser, file_type); + size_t nparsed = http_parser_execute(&parser, &settings, data, file_length); + free(data); + + if (nparsed != (size_t)file_length) { + fprintf(stderr, + "Error: %s (%s)\n", + http_errno_description(HTTP_PARSER_ERRNO(&parser)), + http_errno_name(HTTP_PARSER_ERRNO(&parser))); + goto fail; + } + + return EXIT_SUCCESS; + +fail: + fclose(file); + return EXIT_FAILURE; +} diff --git a/3rdparty/http-parser/contrib/url_parser.c b/3rdparty/http-parser/contrib/url_parser.c new file mode 100644 index 00000000000..6650b414af9 --- /dev/null +++ b/3rdparty/http-parser/contrib/url_parser.c @@ -0,0 +1,46 @@ +#include "http_parser.h" +#include +#include + +void +dump_url (const char *url, const struct http_parser_url *u) +{ + unsigned int i; + + printf("\tfield_set: 0x%x, port: %u\n", u->field_set, u->port); + for (i = 0; i < UF_MAX; i++) { + if ((u->field_set & (1 << i)) == 0) { + printf("\tfield_data[%u]: unset\n", i); + continue; + } + + printf("\tfield_data[%u]: off: %u, len: %u, part: %.*s\n", + i, + u->field_data[i].off, + u->field_data[i].len, + u->field_data[i].len, + url + u->field_data[i].off); + } +} + +int main(int argc, char ** argv) { + struct http_parser_url u; + int len, connect, result; + + if (argc != 3) { + printf("Syntax : %s connect|get url\n", argv[0]); + return 1; + } + len = strlen(argv[2]); + connect = strcmp("connect", argv[1]) == 0 ? 1 : 0; + printf("Parsing %s, connect %d\n", argv[2], connect); + + result = http_parser_parse_url(argv[2], len, connect, &u); + if (result != 0) { + printf("Parse error : %d\n", result); + return result; + } + printf("Parse ok, result : \n"); + dump_url(argv[2], &u); + return 0; +} \ No newline at end of file diff --git a/3rdparty/http-parser/http_parser.c b/3rdparty/http-parser/http_parser.c new file mode 100644 index 00000000000..0fa1c362729 --- /dev/null +++ b/3rdparty/http-parser/http_parser.c @@ -0,0 +1,2429 @@ +/* Based on src/http/ngx_http_parse.c from NGINX copyright Igor Sysoev + * + * Additional changes are licensed under the same terms as NGINX and + * copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ +#include "http_parser.h" +#include +#include +#include +#include +#include +#include + +#ifndef ULLONG_MAX +# define ULLONG_MAX ((uint64_t) -1) /* 2^64-1 */ +#endif + +#ifndef MIN +# define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef ARRAY_SIZE +# define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#endif + +#ifndef BIT_AT +# define BIT_AT(a, i) \ + (!!((unsigned int) (a)[(unsigned int) (i) >> 3] & \ + (1 << ((unsigned int) (i) & 7)))) +#endif + +#ifndef ELEM_AT +# define ELEM_AT(a, i, v) ((unsigned int) (i) < ARRAY_SIZE(a) ? (a)[(i)] : (v)) +#endif + +#define SET_ERRNO(e) \ +do { \ + parser->http_errno = (e); \ +} while(0) + +#define CURRENT_STATE() p_state +#define UPDATE_STATE(V) p_state = (enum state) (V); +#define RETURN(V) \ +do { \ + parser->state = CURRENT_STATE(); \ + return (V); \ +} while (0); +#define REEXECUTE() \ + goto reexecute; \ + + +#ifdef __GNUC__ +# define LIKELY(X) __builtin_expect(!!(X), 1) +# define UNLIKELY(X) __builtin_expect(!!(X), 0) +#else +# define LIKELY(X) (X) +# define UNLIKELY(X) (X) +#endif + + +/* Run the notify callback FOR, returning ER if it fails */ +#define CALLBACK_NOTIFY_(FOR, ER) \ +do { \ + assert(HTTP_PARSER_ERRNO(parser) == HPE_OK); \ + \ + if (LIKELY(settings->on_##FOR)) { \ + parser->state = CURRENT_STATE(); \ + if (UNLIKELY(0 != settings->on_##FOR(parser))) { \ + SET_ERRNO(HPE_CB_##FOR); \ + } \ + UPDATE_STATE(parser->state); \ + \ + /* We either errored above or got paused; get out */ \ + if (UNLIKELY(HTTP_PARSER_ERRNO(parser) != HPE_OK)) { \ + return (ER); \ + } \ + } \ +} while (0) + +/* Run the notify callback FOR and consume the current byte */ +#define CALLBACK_NOTIFY(FOR) CALLBACK_NOTIFY_(FOR, p - data + 1) + +/* Run the notify callback FOR and don't consume the current byte */ +#define CALLBACK_NOTIFY_NOADVANCE(FOR) CALLBACK_NOTIFY_(FOR, p - data) + +/* Run data callback FOR with LEN bytes, returning ER if it fails */ +#define CALLBACK_DATA_(FOR, LEN, ER) \ +do { \ + assert(HTTP_PARSER_ERRNO(parser) == HPE_OK); \ + \ + if (FOR##_mark) { \ + if (LIKELY(settings->on_##FOR)) { \ + parser->state = CURRENT_STATE(); \ + if (UNLIKELY(0 != \ + settings->on_##FOR(parser, FOR##_mark, (LEN)))) { \ + SET_ERRNO(HPE_CB_##FOR); \ + } \ + UPDATE_STATE(parser->state); \ + \ + /* We either errored above or got paused; get out */ \ + if (UNLIKELY(HTTP_PARSER_ERRNO(parser) != HPE_OK)) { \ + return (ER); \ + } \ + } \ + FOR##_mark = NULL; \ + } \ +} while (0) + +/* Run the data callback FOR and consume the current byte */ +#define CALLBACK_DATA(FOR) \ + CALLBACK_DATA_(FOR, p - FOR##_mark, p - data + 1) + +/* Run the data callback FOR and don't consume the current byte */ +#define CALLBACK_DATA_NOADVANCE(FOR) \ + CALLBACK_DATA_(FOR, p - FOR##_mark, p - data) + +/* Set the mark FOR; non-destructive if mark is already set */ +#define MARK(FOR) \ +do { \ + if (!FOR##_mark) { \ + FOR##_mark = p; \ + } \ +} while (0) + +/* Don't allow the total size of the HTTP headers (including the status + * line) to exceed HTTP_MAX_HEADER_SIZE. This check is here to protect + * embedders against denial-of-service attacks where the attacker feeds + * us a never-ending header that the embedder keeps buffering. + * + * This check is arguably the responsibility of embedders but we're doing + * it on the embedder's behalf because most won't bother and this way we + * make the web a little safer. HTTP_MAX_HEADER_SIZE is still far bigger + * than any reasonable request or response so this should never affect + * day-to-day operation. + */ +#define COUNT_HEADER_SIZE(V) \ +do { \ + parser->nread += (V); \ + if (UNLIKELY(parser->nread > (HTTP_MAX_HEADER_SIZE))) { \ + SET_ERRNO(HPE_HEADER_OVERFLOW); \ + goto error; \ + } \ +} while (0) + + +#define PROXY_CONNECTION "proxy-connection" +#define CONNECTION "connection" +#define CONTENT_LENGTH "content-length" +#define TRANSFER_ENCODING "transfer-encoding" +#define UPGRADE "upgrade" +#define CHUNKED "chunked" +#define KEEP_ALIVE "keep-alive" +#define CLOSE "close" + + +static const char *method_strings[] = + { +#define XX(num, name, string) #string, + HTTP_METHOD_MAP(XX) +#undef XX + }; + + +/* Tokens as defined by rfc 2616. Also lowercases them. + * token = 1* + * separators = "(" | ")" | "<" | ">" | "@" + * | "," | ";" | ":" | "\" | <"> + * | "/" | "[" | "]" | "?" | "=" + * | "{" | "}" | SP | HT + */ +static const char tokens[256] = { +/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */ + 0, 0, 0, 0, 0, 0, 0, 0, +/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */ + 0, 0, 0, 0, 0, 0, 0, 0, +/* 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb */ + 0, 0, 0, 0, 0, 0, 0, 0, +/* 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us */ + 0, 0, 0, 0, 0, 0, 0, 0, +/* 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' */ + 0, '!', 0, '#', '$', '%', '&', '\'', +/* 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / */ + 0, 0, '*', '+', 0, '-', '.', 0, +/* 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 */ + '0', '1', '2', '3', '4', '5', '6', '7', +/* 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? */ + '8', '9', 0, 0, 0, 0, 0, 0, +/* 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G */ + 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', +/* 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O */ + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', +/* 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W */ + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', +/* 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ */ + 'x', 'y', 'z', 0, 0, 0, '^', '_', +/* 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g */ + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', +/* 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o */ + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', +/* 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w */ + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', +/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */ + 'x', 'y', 'z', 0, '|', 0, '~', 0 }; + + +static const int8_t unhex[256] = + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + , 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1 + ,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1 + ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + }; + + +#if HTTP_PARSER_STRICT +# define T(v) 0 +#else +# define T(v) v +#endif + + +static const uint8_t normal_url_char[32] = { +/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */ + 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0, +/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */ + 0 | T(2) | 0 | 0 | T(16) | 0 | 0 | 0, +/* 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb */ + 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0, +/* 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us */ + 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0, +/* 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' */ + 0 | 2 | 4 | 0 | 16 | 32 | 64 | 128, +/* 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 0, +/* 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, +/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */ + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 0, }; + +#undef T + +enum state + { s_dead = 1 /* important that this is > 0 */ + + , s_start_req_or_res + , s_res_or_resp_H + , s_start_res + , s_res_H + , s_res_HT + , s_res_HTT + , s_res_HTTP + , s_res_first_http_major + , s_res_http_major + , s_res_first_http_minor + , s_res_http_minor + , s_res_first_status_code + , s_res_status_code + , s_res_status_start + , s_res_status + , s_res_line_almost_done + + , s_start_req + + , s_req_method + , s_req_spaces_before_url + , s_req_schema + , s_req_schema_slash + , s_req_schema_slash_slash + , s_req_server_start + , s_req_server + , s_req_server_with_at + , s_req_path + , s_req_query_string_start + , s_req_query_string + , s_req_fragment_start + , s_req_fragment + , s_req_http_start + , s_req_http_H + , s_req_http_HT + , s_req_http_HTT + , s_req_http_HTTP + , s_req_first_http_major + , s_req_http_major + , s_req_first_http_minor + , s_req_http_minor + , s_req_line_almost_done + + , s_header_field_start + , s_header_field + , s_header_value_discard_ws + , s_header_value_discard_ws_almost_done + , s_header_value_discard_lws + , s_header_value_start + , s_header_value + , s_header_value_lws + + , s_header_almost_done + + , s_chunk_size_start + , s_chunk_size + , s_chunk_parameters + , s_chunk_size_almost_done + + , s_headers_almost_done + , s_headers_done + + /* Important: 's_headers_done' must be the last 'header' state. All + * states beyond this must be 'body' states. It is used for overflow + * checking. See the PARSING_HEADER() macro. + */ + + , s_chunk_data + , s_chunk_data_almost_done + , s_chunk_data_done + + , s_body_identity + , s_body_identity_eof + + , s_message_done + }; + + +#define PARSING_HEADER(state) (state <= s_headers_done) + + +enum header_states + { h_general = 0 + , h_C + , h_CO + , h_CON + + , h_matching_connection + , h_matching_proxy_connection + , h_matching_content_length + , h_matching_transfer_encoding + , h_matching_upgrade + + , h_connection + , h_content_length + , h_transfer_encoding + , h_upgrade + + , h_matching_transfer_encoding_chunked + , h_matching_connection_token_start + , h_matching_connection_keep_alive + , h_matching_connection_close + , h_matching_connection_upgrade + , h_matching_connection_token + + , h_transfer_encoding_chunked + , h_connection_keep_alive + , h_connection_close + , h_connection_upgrade + }; + +enum http_host_state + { + s_http_host_dead = 1 + , s_http_userinfo_start + , s_http_userinfo + , s_http_host_start + , s_http_host_v6_start + , s_http_host + , s_http_host_v6 + , s_http_host_v6_end + , s_http_host_port_start + , s_http_host_port +}; + +/* Macros for character classes; depends on strict-mode */ +#define CR '\r' +#define LF '\n' +#define LOWER(c) (unsigned char)(c | 0x20) +#define IS_ALPHA(c) (LOWER(c) >= 'a' && LOWER(c) <= 'z') +#define IS_NUM(c) ((c) >= '0' && (c) <= '9') +#define IS_ALPHANUM(c) (IS_ALPHA(c) || IS_NUM(c)) +#define IS_HEX(c) (IS_NUM(c) || (LOWER(c) >= 'a' && LOWER(c) <= 'f')) +#define IS_MARK(c) ((c) == '-' || (c) == '_' || (c) == '.' || \ + (c) == '!' || (c) == '~' || (c) == '*' || (c) == '\'' || (c) == '(' || \ + (c) == ')') +#define IS_USERINFO_CHAR(c) (IS_ALPHANUM(c) || IS_MARK(c) || (c) == '%' || \ + (c) == ';' || (c) == ':' || (c) == '&' || (c) == '=' || (c) == '+' || \ + (c) == '$' || (c) == ',') + +#define STRICT_TOKEN(c) (tokens[(unsigned char)c]) + +#if HTTP_PARSER_STRICT +#define TOKEN(c) (tokens[(unsigned char)c]) +#define IS_URL_CHAR(c) (BIT_AT(normal_url_char, (unsigned char)c)) +#define IS_HOST_CHAR(c) (IS_ALPHANUM(c) || (c) == '.' || (c) == '-') +#else +#define TOKEN(c) ((c == ' ') ? ' ' : tokens[(unsigned char)c]) +#define IS_URL_CHAR(c) \ + (BIT_AT(normal_url_char, (unsigned char)c) || ((c) & 0x80)) +#define IS_HOST_CHAR(c) \ + (IS_ALPHANUM(c) || (c) == '.' || (c) == '-' || (c) == '_') +#endif + + +#define start_state (parser->type == HTTP_REQUEST ? s_start_req : s_start_res) + + +#if HTTP_PARSER_STRICT +# define STRICT_CHECK(cond) \ +do { \ + if (cond) { \ + SET_ERRNO(HPE_STRICT); \ + goto error; \ + } \ +} while (0) +# define NEW_MESSAGE() (http_should_keep_alive(parser) ? start_state : s_dead) +#else +# define STRICT_CHECK(cond) +# define NEW_MESSAGE() start_state +#endif + + +/* Map errno values to strings for human-readable output */ +#define HTTP_STRERROR_GEN(n, s) { "HPE_" #n, s }, +static struct { + const char *name; + const char *description; +} http_strerror_tab[] = { + HTTP_ERRNO_MAP(HTTP_STRERROR_GEN) +}; +#undef HTTP_STRERROR_GEN + +int http_message_needs_eof(const http_parser *parser); + +/* Our URL parser. + * + * This is designed to be shared by http_parser_execute() for URL validation, + * hence it has a state transition + byte-for-byte interface. In addition, it + * is meant to be embedded in http_parser_parse_url(), which does the dirty + * work of turning state transitions URL components for its API. + * + * This function should only be invoked with non-space characters. It is + * assumed that the caller cares about (and can detect) the transition between + * URL and non-URL states by looking for these. + */ +static enum state +parse_url_char(enum state s, const char ch) +{ + if (ch == ' ' || ch == '\r' || ch == '\n') { + return s_dead; + } + +#if HTTP_PARSER_STRICT + if (ch == '\t' || ch == '\f') { + return s_dead; + } +#endif + + switch (s) { + case s_req_spaces_before_url: + /* Proxied requests are followed by scheme of an absolute URI (alpha). + * All methods except CONNECT are followed by '/' or '*'. + */ + + if (ch == '/' || ch == '*') { + return s_req_path; + } + + if (IS_ALPHA(ch)) { + return s_req_schema; + } + + break; + + case s_req_schema: + if (IS_ALPHA(ch)) { + return s; + } + + if (ch == ':') { + return s_req_schema_slash; + } + + break; + + case s_req_schema_slash: + if (ch == '/') { + return s_req_schema_slash_slash; + } + + break; + + case s_req_schema_slash_slash: + if (ch == '/') { + return s_req_server_start; + } + + break; + + case s_req_server_with_at: + if (ch == '@') { + return s_dead; + } + + /* FALLTHROUGH */ + case s_req_server_start: + case s_req_server: + if (ch == '/') { + return s_req_path; + } + + if (ch == '?') { + return s_req_query_string_start; + } + + if (ch == '@') { + return s_req_server_with_at; + } + + if (IS_USERINFO_CHAR(ch) || ch == '[' || ch == ']') { + return s_req_server; + } + + break; + + case s_req_path: + if (IS_URL_CHAR(ch)) { + return s; + } + + switch (ch) { + case '?': + return s_req_query_string_start; + + case '#': + return s_req_fragment_start; + } + + break; + + case s_req_query_string_start: + case s_req_query_string: + if (IS_URL_CHAR(ch)) { + return s_req_query_string; + } + + switch (ch) { + case '?': + /* allow extra '?' in query string */ + return s_req_query_string; + + case '#': + return s_req_fragment_start; + } + + break; + + case s_req_fragment_start: + if (IS_URL_CHAR(ch)) { + return s_req_fragment; + } + + switch (ch) { + case '?': + return s_req_fragment; + + case '#': + return s; + } + + break; + + case s_req_fragment: + if (IS_URL_CHAR(ch)) { + return s; + } + + switch (ch) { + case '?': + case '#': + return s; + } + + break; + + default: + break; + } + + /* We should never fall out of the switch above unless there's an error */ + return s_dead; +} + +size_t http_parser_execute (http_parser *parser, + const http_parser_settings *settings, + const char *data, + size_t len) +{ + char c, ch; + int8_t unhex_val; + const char *p = data; + const char *header_field_mark = 0; + const char *header_value_mark = 0; + const char *url_mark = 0; + const char *body_mark = 0; + const char *status_mark = 0; + enum state p_state = (enum state) parser->state; + + /* We're in an error state. Don't bother doing anything. */ + if (HTTP_PARSER_ERRNO(parser) != HPE_OK) { + return 0; + } + + if (len == 0) { + switch (CURRENT_STATE()) { + case s_body_identity_eof: + /* Use of CALLBACK_NOTIFY() here would erroneously return 1 byte read if + * we got paused. + */ + CALLBACK_NOTIFY_NOADVANCE(message_complete); + return 0; + + case s_dead: + case s_start_req_or_res: + case s_start_res: + case s_start_req: + return 0; + + default: + SET_ERRNO(HPE_INVALID_EOF_STATE); + return 1; + } + } + + + if (CURRENT_STATE() == s_header_field) + header_field_mark = data; + if (CURRENT_STATE() == s_header_value) + header_value_mark = data; + switch (CURRENT_STATE()) { + case s_req_path: + case s_req_schema: + case s_req_schema_slash: + case s_req_schema_slash_slash: + case s_req_server_start: + case s_req_server: + case s_req_server_with_at: + case s_req_query_string_start: + case s_req_query_string: + case s_req_fragment_start: + case s_req_fragment: + url_mark = data; + break; + case s_res_status: + status_mark = data; + break; + default: + break; + } + + for (p=data; p != data + len; p++) { + ch = *p; + + if (PARSING_HEADER(CURRENT_STATE())) + COUNT_HEADER_SIZE(1); + +reexecute: + switch (CURRENT_STATE()) { + + case s_dead: + /* this state is used after a 'Connection: close' message + * the parser will error out if it reads another message + */ + if (LIKELY(ch == CR || ch == LF)) + break; + + SET_ERRNO(HPE_CLOSED_CONNECTION); + goto error; + + case s_start_req_or_res: + { + if (ch == CR || ch == LF) + break; + parser->flags = 0; + parser->content_length = ULLONG_MAX; + + if (ch == 'H') { + UPDATE_STATE(s_res_or_resp_H); + + CALLBACK_NOTIFY(message_begin); + } else { + parser->type = HTTP_REQUEST; + UPDATE_STATE(s_start_req); + REEXECUTE(); + } + + break; + } + + case s_res_or_resp_H: + if (ch == 'T') { + parser->type = HTTP_RESPONSE; + UPDATE_STATE(s_res_HT); + } else { + if (UNLIKELY(ch != 'E')) { + SET_ERRNO(HPE_INVALID_CONSTANT); + goto error; + } + + parser->type = HTTP_REQUEST; + parser->method = HTTP_HEAD; + parser->index = 2; + UPDATE_STATE(s_req_method); + } + break; + + case s_start_res: + { + parser->flags = 0; + parser->content_length = ULLONG_MAX; + + switch (ch) { + case 'H': + UPDATE_STATE(s_res_H); + break; + + case CR: + case LF: + break; + + default: + SET_ERRNO(HPE_INVALID_CONSTANT); + goto error; + } + + CALLBACK_NOTIFY(message_begin); + break; + } + + case s_res_H: + STRICT_CHECK(ch != 'T'); + UPDATE_STATE(s_res_HT); + break; + + case s_res_HT: + STRICT_CHECK(ch != 'T'); + UPDATE_STATE(s_res_HTT); + break; + + case s_res_HTT: + STRICT_CHECK(ch != 'P'); + UPDATE_STATE(s_res_HTTP); + break; + + case s_res_HTTP: + STRICT_CHECK(ch != '/'); + UPDATE_STATE(s_res_first_http_major); + break; + + case s_res_first_http_major: + if (UNLIKELY(ch < '0' || ch > '9')) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_major = ch - '0'; + UPDATE_STATE(s_res_http_major); + break; + + /* major HTTP version or dot */ + case s_res_http_major: + { + if (ch == '.') { + UPDATE_STATE(s_res_first_http_minor); + break; + } + + if (!IS_NUM(ch)) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_major *= 10; + parser->http_major += ch - '0'; + + if (UNLIKELY(parser->http_major > 999)) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + break; + } + + /* first digit of minor HTTP version */ + case s_res_first_http_minor: + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_minor = ch - '0'; + UPDATE_STATE(s_res_http_minor); + break; + + /* minor HTTP version or end of request line */ + case s_res_http_minor: + { + if (ch == ' ') { + UPDATE_STATE(s_res_first_status_code); + break; + } + + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_minor *= 10; + parser->http_minor += ch - '0'; + + if (UNLIKELY(parser->http_minor > 999)) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + break; + } + + case s_res_first_status_code: + { + if (!IS_NUM(ch)) { + if (ch == ' ') { + break; + } + + SET_ERRNO(HPE_INVALID_STATUS); + goto error; + } + parser->status_code = ch - '0'; + UPDATE_STATE(s_res_status_code); + break; + } + + case s_res_status_code: + { + if (!IS_NUM(ch)) { + switch (ch) { + case ' ': + UPDATE_STATE(s_res_status_start); + break; + case CR: + UPDATE_STATE(s_res_line_almost_done); + break; + case LF: + UPDATE_STATE(s_header_field_start); + break; + default: + SET_ERRNO(HPE_INVALID_STATUS); + goto error; + } + break; + } + + parser->status_code *= 10; + parser->status_code += ch - '0'; + + if (UNLIKELY(parser->status_code > 999)) { + SET_ERRNO(HPE_INVALID_STATUS); + goto error; + } + + break; + } + + case s_res_status_start: + { + if (ch == CR) { + UPDATE_STATE(s_res_line_almost_done); + break; + } + + if (ch == LF) { + UPDATE_STATE(s_header_field_start); + break; + } + + MARK(status); + UPDATE_STATE(s_res_status); + parser->index = 0; + break; + } + + case s_res_status: + if (ch == CR) { + UPDATE_STATE(s_res_line_almost_done); + CALLBACK_DATA(status); + break; + } + + if (ch == LF) { + UPDATE_STATE(s_header_field_start); + CALLBACK_DATA(status); + break; + } + + break; + + case s_res_line_almost_done: + STRICT_CHECK(ch != LF); + UPDATE_STATE(s_header_field_start); + break; + + case s_start_req: + { + if (ch == CR || ch == LF) + break; + parser->flags = 0; + parser->content_length = ULLONG_MAX; + + if (UNLIKELY(!IS_ALPHA(ch))) { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + + parser->method = (enum http_method) 0; + parser->index = 1; + switch (ch) { + case 'C': parser->method = HTTP_CONNECT; /* or COPY, CHECKOUT */ break; + case 'D': parser->method = HTTP_DELETE; break; + case 'G': parser->method = HTTP_GET; break; + case 'H': parser->method = HTTP_HEAD; break; + case 'L': parser->method = HTTP_LOCK; break; + case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE, M-SEARCH, MKCALENDAR */ break; + case 'N': parser->method = HTTP_NOTIFY; break; + case 'O': parser->method = HTTP_OPTIONS; break; + case 'P': parser->method = HTTP_POST; + /* or PROPFIND|PROPPATCH|PUT|PATCH|PURGE */ + break; + case 'R': parser->method = HTTP_REPORT; break; + case 'S': parser->method = HTTP_SUBSCRIBE; /* or SEARCH */ break; + case 'T': parser->method = HTTP_TRACE; break; + case 'U': parser->method = HTTP_UNLOCK; /* or UNSUBSCRIBE */ break; + default: + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + UPDATE_STATE(s_req_method); + + CALLBACK_NOTIFY(message_begin); + + break; + } + + case s_req_method: + { + const char *matcher; + if (UNLIKELY(ch == '\0')) { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + + matcher = method_strings[parser->method]; + if (ch == ' ' && matcher[parser->index] == '\0') { + UPDATE_STATE(s_req_spaces_before_url); + } else if (ch == matcher[parser->index]) { + ; /* nada */ + } else if (parser->method == HTTP_CONNECT) { + if (parser->index == 1 && ch == 'H') { + parser->method = HTTP_CHECKOUT; + } else if (parser->index == 2 && ch == 'P') { + parser->method = HTTP_COPY; + } else { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + } else if (parser->method == HTTP_MKCOL) { + if (parser->index == 1 && ch == 'O') { + parser->method = HTTP_MOVE; + } else if (parser->index == 1 && ch == 'E') { + parser->method = HTTP_MERGE; + } else if (parser->index == 1 && ch == '-') { + parser->method = HTTP_MSEARCH; + } else if (parser->index == 2 && ch == 'A') { + parser->method = HTTP_MKACTIVITY; + } else if (parser->index == 3 && ch == 'A') { + parser->method = HTTP_MKCALENDAR; + } else { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + } else if (parser->method == HTTP_SUBSCRIBE) { + if (parser->index == 1 && ch == 'E') { + parser->method = HTTP_SEARCH; + } else { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + } else if (parser->index == 1 && parser->method == HTTP_POST) { + if (ch == 'R') { + parser->method = HTTP_PROPFIND; /* or HTTP_PROPPATCH */ + } else if (ch == 'U') { + parser->method = HTTP_PUT; /* or HTTP_PURGE */ + } else if (ch == 'A') { + parser->method = HTTP_PATCH; + } else { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + } else if (parser->index == 2) { + if (parser->method == HTTP_PUT) { + if (ch == 'R') { + parser->method = HTTP_PURGE; + } else { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + } else if (parser->method == HTTP_UNLOCK) { + if (ch == 'S') { + parser->method = HTTP_UNSUBSCRIBE; + } else { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + } else { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + } else if (parser->index == 4 && parser->method == HTTP_PROPFIND && ch == 'P') { + parser->method = HTTP_PROPPATCH; + } else { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } + + ++parser->index; + break; + } + + case s_req_spaces_before_url: + { + if (ch == ' ') break; + + MARK(url); + if (parser->method == HTTP_CONNECT) { + UPDATE_STATE(s_req_server_start); + } + + UPDATE_STATE(parse_url_char(CURRENT_STATE(), ch)); + if (UNLIKELY(CURRENT_STATE() == s_dead)) { + SET_ERRNO(HPE_INVALID_URL); + goto error; + } + + break; + } + + case s_req_schema: + case s_req_schema_slash: + case s_req_schema_slash_slash: + case s_req_server_start: + { + switch (ch) { + /* No whitespace allowed here */ + case ' ': + case CR: + case LF: + SET_ERRNO(HPE_INVALID_URL); + goto error; + default: + UPDATE_STATE(parse_url_char(CURRENT_STATE(), ch)); + if (UNLIKELY(CURRENT_STATE() == s_dead)) { + SET_ERRNO(HPE_INVALID_URL); + goto error; + } + } + + break; + } + + case s_req_server: + case s_req_server_with_at: + case s_req_path: + case s_req_query_string_start: + case s_req_query_string: + case s_req_fragment_start: + case s_req_fragment: + { + switch (ch) { + case ' ': + UPDATE_STATE(s_req_http_start); + CALLBACK_DATA(url); + break; + case CR: + case LF: + parser->http_major = 0; + parser->http_minor = 9; + UPDATE_STATE((ch == CR) ? + s_req_line_almost_done : + s_header_field_start); + CALLBACK_DATA(url); + break; + default: + UPDATE_STATE(parse_url_char(CURRENT_STATE(), ch)); + if (UNLIKELY(CURRENT_STATE() == s_dead)) { + SET_ERRNO(HPE_INVALID_URL); + goto error; + } + } + break; + } + + case s_req_http_start: + switch (ch) { + case 'H': + UPDATE_STATE(s_req_http_H); + break; + case ' ': + break; + default: + SET_ERRNO(HPE_INVALID_CONSTANT); + goto error; + } + break; + + case s_req_http_H: + STRICT_CHECK(ch != 'T'); + UPDATE_STATE(s_req_http_HT); + break; + + case s_req_http_HT: + STRICT_CHECK(ch != 'T'); + UPDATE_STATE(s_req_http_HTT); + break; + + case s_req_http_HTT: + STRICT_CHECK(ch != 'P'); + UPDATE_STATE(s_req_http_HTTP); + break; + + case s_req_http_HTTP: + STRICT_CHECK(ch != '/'); + UPDATE_STATE(s_req_first_http_major); + break; + + /* first digit of major HTTP version */ + case s_req_first_http_major: + if (UNLIKELY(ch < '1' || ch > '9')) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_major = ch - '0'; + UPDATE_STATE(s_req_http_major); + break; + + /* major HTTP version or dot */ + case s_req_http_major: + { + if (ch == '.') { + UPDATE_STATE(s_req_first_http_minor); + break; + } + + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_major *= 10; + parser->http_major += ch - '0'; + + if (UNLIKELY(parser->http_major > 999)) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + break; + } + + /* first digit of minor HTTP version */ + case s_req_first_http_minor: + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_minor = ch - '0'; + UPDATE_STATE(s_req_http_minor); + break; + + /* minor HTTP version or end of request line */ + case s_req_http_minor: + { + if (ch == CR) { + UPDATE_STATE(s_req_line_almost_done); + break; + } + + if (ch == LF) { + UPDATE_STATE(s_header_field_start); + break; + } + + /* XXX allow spaces after digit? */ + + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + parser->http_minor *= 10; + parser->http_minor += ch - '0'; + + if (UNLIKELY(parser->http_minor > 999)) { + SET_ERRNO(HPE_INVALID_VERSION); + goto error; + } + + break; + } + + /* end of request line */ + case s_req_line_almost_done: + { + if (UNLIKELY(ch != LF)) { + SET_ERRNO(HPE_LF_EXPECTED); + goto error; + } + + UPDATE_STATE(s_header_field_start); + break; + } + + case s_header_field_start: + { + if (ch == CR) { + UPDATE_STATE(s_headers_almost_done); + break; + } + + if (ch == LF) { + /* they might be just sending \n instead of \r\n so this would be + * the second \n to denote the end of headers*/ + UPDATE_STATE(s_headers_almost_done); + REEXECUTE(); + } + + c = TOKEN(ch); + + if (UNLIKELY(!c)) { + SET_ERRNO(HPE_INVALID_HEADER_TOKEN); + goto error; + } + + MARK(header_field); + + parser->index = 0; + UPDATE_STATE(s_header_field); + + switch (c) { + case 'c': + parser->header_state = h_C; + break; + + case 'p': + parser->header_state = h_matching_proxy_connection; + break; + + case 't': + parser->header_state = h_matching_transfer_encoding; + break; + + case 'u': + parser->header_state = h_matching_upgrade; + break; + + default: + parser->header_state = h_general; + break; + } + break; + } + + case s_header_field: + { + const char* start = p; + for (; p != data + len; p++) { + ch = *p; + c = TOKEN(ch); + + if (!c) + break; + + switch (parser->header_state) { + case h_general: + break; + + case h_C: + parser->index++; + parser->header_state = (c == 'o' ? h_CO : h_general); + break; + + case h_CO: + parser->index++; + parser->header_state = (c == 'n' ? h_CON : h_general); + break; + + case h_CON: + parser->index++; + switch (c) { + case 'n': + parser->header_state = h_matching_connection; + break; + case 't': + parser->header_state = h_matching_content_length; + break; + default: + parser->header_state = h_general; + break; + } + break; + + /* connection */ + + case h_matching_connection: + parser->index++; + if (parser->index > sizeof(CONNECTION)-1 + || c != CONNECTION[parser->index]) { + parser->header_state = h_general; + } else if (parser->index == sizeof(CONNECTION)-2) { + parser->header_state = h_connection; + } + break; + + /* proxy-connection */ + + case h_matching_proxy_connection: + parser->index++; + if (parser->index > sizeof(PROXY_CONNECTION)-1 + || c != PROXY_CONNECTION[parser->index]) { + parser->header_state = h_general; + } else if (parser->index == sizeof(PROXY_CONNECTION)-2) { + parser->header_state = h_connection; + } + break; + + /* content-length */ + + case h_matching_content_length: + parser->index++; + if (parser->index > sizeof(CONTENT_LENGTH)-1 + || c != CONTENT_LENGTH[parser->index]) { + parser->header_state = h_general; + } else if (parser->index == sizeof(CONTENT_LENGTH)-2) { + parser->header_state = h_content_length; + } + break; + + /* transfer-encoding */ + + case h_matching_transfer_encoding: + parser->index++; + if (parser->index > sizeof(TRANSFER_ENCODING)-1 + || c != TRANSFER_ENCODING[parser->index]) { + parser->header_state = h_general; + } else if (parser->index == sizeof(TRANSFER_ENCODING)-2) { + parser->header_state = h_transfer_encoding; + } + break; + + /* upgrade */ + + case h_matching_upgrade: + parser->index++; + if (parser->index > sizeof(UPGRADE)-1 + || c != UPGRADE[parser->index]) { + parser->header_state = h_general; + } else if (parser->index == sizeof(UPGRADE)-2) { + parser->header_state = h_upgrade; + } + break; + + case h_connection: + case h_content_length: + case h_transfer_encoding: + case h_upgrade: + if (ch != ' ') parser->header_state = h_general; + break; + + default: + assert(0 && "Unknown header_state"); + break; + } + } + + COUNT_HEADER_SIZE(p - start); + + if (p == data + len) { + --p; + break; + } + + if (ch == ':') { + UPDATE_STATE(s_header_value_discard_ws); + CALLBACK_DATA(header_field); + break; + } + + SET_ERRNO(HPE_INVALID_HEADER_TOKEN); + goto error; + } + + case s_header_value_discard_ws: + if (ch == ' ' || ch == '\t') break; + + if (ch == CR) { + UPDATE_STATE(s_header_value_discard_ws_almost_done); + break; + } + + if (ch == LF) { + UPDATE_STATE(s_header_value_discard_lws); + break; + } + + /* FALLTHROUGH */ + + case s_header_value_start: + { + MARK(header_value); + + UPDATE_STATE(s_header_value); + parser->index = 0; + + c = LOWER(ch); + + switch (parser->header_state) { + case h_upgrade: + parser->flags |= F_UPGRADE; + parser->header_state = h_general; + break; + + case h_transfer_encoding: + /* looking for 'Transfer-Encoding: chunked' */ + if ('c' == c) { + parser->header_state = h_matching_transfer_encoding_chunked; + } else { + parser->header_state = h_general; + } + break; + + case h_content_length: + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); + goto error; + } + + parser->content_length = ch - '0'; + break; + + case h_connection: + /* looking for 'Connection: keep-alive' */ + if (c == 'k') { + parser->header_state = h_matching_connection_keep_alive; + /* looking for 'Connection: close' */ + } else if (c == 'c') { + parser->header_state = h_matching_connection_close; + } else if (c == 'u') { + parser->header_state = h_matching_connection_upgrade; + } else { + parser->header_state = h_matching_connection_token; + } + break; + + /* Multi-value `Connection` header */ + case h_matching_connection_token_start: + break; + + default: + parser->header_state = h_general; + break; + } + break; + } + + case s_header_value: + { + const char* start = p; + enum header_states h_state = (enum header_states) parser->header_state; + for (; p != data + len; p++) { + ch = *p; + if (ch == CR) { + UPDATE_STATE(s_header_almost_done); + parser->header_state = h_state; + CALLBACK_DATA(header_value); + break; + } + + if (ch == LF) { + UPDATE_STATE(s_header_almost_done); + COUNT_HEADER_SIZE(p - start); + parser->header_state = h_state; + CALLBACK_DATA_NOADVANCE(header_value); + REEXECUTE(); + } + + c = LOWER(ch); + + switch (h_state) { + case h_general: + { + const char* p_cr; + const char* p_lf; + size_t limit = data + len - p; + + limit = MIN(limit, HTTP_MAX_HEADER_SIZE); + + p_cr = (const char*) memchr(p, CR, limit); + p_lf = (const char*) memchr(p, LF, limit); + if (p_cr != NULL) { + if (p_lf != NULL && p_cr >= p_lf) + p = p_lf; + else + p = p_cr; + } else if (UNLIKELY(p_lf != NULL)) { + p = p_lf; + } else { + p = data + len; + } + --p; + + break; + } + + case h_connection: + case h_transfer_encoding: + assert(0 && "Shouldn't get here."); + break; + + case h_content_length: + { + uint64_t t; + + if (ch == ' ') break; + + if (UNLIKELY(!IS_NUM(ch))) { + SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); + parser->header_state = h_state; + goto error; + } + + t = parser->content_length; + t *= 10; + t += ch - '0'; + + /* Overflow? Test against a conservative limit for simplicity. */ + if (UNLIKELY((ULLONG_MAX - 10) / 10 < parser->content_length)) { + SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); + parser->header_state = h_state; + goto error; + } + + parser->content_length = t; + break; + } + + /* Transfer-Encoding: chunked */ + case h_matching_transfer_encoding_chunked: + parser->index++; + if (parser->index > sizeof(CHUNKED)-1 + || c != CHUNKED[parser->index]) { + h_state = h_general; + } else if (parser->index == sizeof(CHUNKED)-2) { + h_state = h_transfer_encoding_chunked; + } + break; + + case h_matching_connection_token_start: + /* looking for 'Connection: keep-alive' */ + if (c == 'k') { + h_state = h_matching_connection_keep_alive; + /* looking for 'Connection: close' */ + } else if (c == 'c') { + h_state = h_matching_connection_close; + } else if (c == 'u') { + h_state = h_matching_connection_upgrade; + } else if (STRICT_TOKEN(c)) { + h_state = h_matching_connection_token; + } else if (c == ' ' || c == '\t') { + /* Skip lws */ + } else { + h_state = h_general; + } + break; + + /* looking for 'Connection: keep-alive' */ + case h_matching_connection_keep_alive: + parser->index++; + if (parser->index > sizeof(KEEP_ALIVE)-1 + || c != KEEP_ALIVE[parser->index]) { + h_state = h_matching_connection_token; + } else if (parser->index == sizeof(KEEP_ALIVE)-2) { + h_state = h_connection_keep_alive; + } + break; + + /* looking for 'Connection: close' */ + case h_matching_connection_close: + parser->index++; + if (parser->index > sizeof(CLOSE)-1 || c != CLOSE[parser->index]) { + h_state = h_matching_connection_token; + } else if (parser->index == sizeof(CLOSE)-2) { + h_state = h_connection_close; + } + break; + + /* looking for 'Connection: upgrade' */ + case h_matching_connection_upgrade: + parser->index++; + if (parser->index > sizeof(UPGRADE) - 1 || + c != UPGRADE[parser->index]) { + h_state = h_matching_connection_token; + } else if (parser->index == sizeof(UPGRADE)-2) { + h_state = h_connection_upgrade; + } + break; + + case h_matching_connection_token: + if (ch == ',') { + h_state = h_matching_connection_token_start; + parser->index = 0; + } + break; + + case h_transfer_encoding_chunked: + if (ch != ' ') h_state = h_general; + break; + + case h_connection_keep_alive: + case h_connection_close: + case h_connection_upgrade: + if (ch == ',') { + if (h_state == h_connection_keep_alive) { + parser->flags |= F_CONNECTION_KEEP_ALIVE; + } else if (h_state == h_connection_close) { + parser->flags |= F_CONNECTION_CLOSE; + } else if (h_state == h_connection_upgrade) { + parser->flags |= F_CONNECTION_UPGRADE; + } + h_state = h_matching_connection_token_start; + parser->index = 0; + } else if (ch != ' ') { + h_state = h_matching_connection_token; + } + break; + + default: + UPDATE_STATE(s_header_value); + h_state = h_general; + break; + } + } + parser->header_state = h_state; + + COUNT_HEADER_SIZE(p - start); + + if (p == data + len) + --p; + break; + } + + case s_header_almost_done: + { + STRICT_CHECK(ch != LF); + + UPDATE_STATE(s_header_value_lws); + break; + } + + case s_header_value_lws: + { + if (ch == ' ' || ch == '\t') { + UPDATE_STATE(s_header_value_start); + REEXECUTE(); + } + + /* finished the header */ + switch (parser->header_state) { + case h_connection_keep_alive: + parser->flags |= F_CONNECTION_KEEP_ALIVE; + break; + case h_connection_close: + parser->flags |= F_CONNECTION_CLOSE; + break; + case h_transfer_encoding_chunked: + parser->flags |= F_CHUNKED; + break; + case h_connection_upgrade: + parser->flags |= F_CONNECTION_UPGRADE; + break; + default: + break; + } + + UPDATE_STATE(s_header_field_start); + REEXECUTE(); + } + + case s_header_value_discard_ws_almost_done: + { + STRICT_CHECK(ch != LF); + UPDATE_STATE(s_header_value_discard_lws); + break; + } + + case s_header_value_discard_lws: + { + if (ch == ' ' || ch == '\t') { + UPDATE_STATE(s_header_value_discard_ws); + break; + } else { + switch (parser->header_state) { + case h_connection_keep_alive: + parser->flags |= F_CONNECTION_KEEP_ALIVE; + break; + case h_connection_close: + parser->flags |= F_CONNECTION_CLOSE; + break; + case h_connection_upgrade: + parser->flags |= F_CONNECTION_UPGRADE; + break; + case h_transfer_encoding_chunked: + parser->flags |= F_CHUNKED; + break; + default: + break; + } + + /* header value was empty */ + MARK(header_value); + UPDATE_STATE(s_header_field_start); + CALLBACK_DATA_NOADVANCE(header_value); + REEXECUTE(); + } + } + + case s_headers_almost_done: + { + STRICT_CHECK(ch != LF); + + if (parser->flags & F_TRAILING) { + /* End of a chunked request */ + UPDATE_STATE(s_message_done); + CALLBACK_NOTIFY_NOADVANCE(chunk_complete); + REEXECUTE(); + } + + UPDATE_STATE(s_headers_done); + + /* Set this here so that on_headers_complete() callbacks can see it */ + parser->upgrade = + ((parser->flags & (F_UPGRADE | F_CONNECTION_UPGRADE)) == + (F_UPGRADE | F_CONNECTION_UPGRADE) || + parser->method == HTTP_CONNECT); + + /* Here we call the headers_complete callback. This is somewhat + * different than other callbacks because if the user returns 1, we + * will interpret that as saying that this message has no body. This + * is needed for the annoying case of recieving a response to a HEAD + * request. + * + * We'd like to use CALLBACK_NOTIFY_NOADVANCE() here but we cannot, so + * we have to simulate it by handling a change in errno below. + */ + if (settings->on_headers_complete) { + switch (settings->on_headers_complete(parser)) { + case 0: + break; + + case 1: + parser->flags |= F_SKIPBODY; + break; + + default: + SET_ERRNO(HPE_CB_headers_complete); + RETURN(p - data); /* Error */ + } + } + + if (HTTP_PARSER_ERRNO(parser) != HPE_OK) { + RETURN(p - data); + } + + REEXECUTE(); + } + + case s_headers_done: + { + STRICT_CHECK(ch != LF); + + parser->nread = 0; + + int hasBody = parser->flags & F_CHUNKED || + (parser->content_length > 0 && parser->content_length != ULLONG_MAX); + if (parser->upgrade && (parser->method == HTTP_CONNECT || + (parser->flags & F_SKIPBODY) || !hasBody)) { + /* Exit, the rest of the message is in a different protocol. */ + UPDATE_STATE(NEW_MESSAGE()); + CALLBACK_NOTIFY(message_complete); + RETURN((p - data) + 1); + } + + if (parser->flags & F_SKIPBODY) { + UPDATE_STATE(NEW_MESSAGE()); + CALLBACK_NOTIFY(message_complete); + } else if (parser->flags & F_CHUNKED) { + /* chunked encoding - ignore Content-Length header */ + UPDATE_STATE(s_chunk_size_start); + } else { + if (parser->content_length == 0) { + /* Content-Length header given but zero: Content-Length: 0\r\n */ + UPDATE_STATE(NEW_MESSAGE()); + CALLBACK_NOTIFY(message_complete); + } else if (parser->content_length != ULLONG_MAX) { + /* Content-Length header given and non-zero */ + UPDATE_STATE(s_body_identity); + } else { + if (parser->type == HTTP_REQUEST || + !http_message_needs_eof(parser)) { + /* Assume content-length 0 - read the next */ + UPDATE_STATE(NEW_MESSAGE()); + CALLBACK_NOTIFY(message_complete); + } else { + /* Read body until EOF */ + UPDATE_STATE(s_body_identity_eof); + } + } + } + + break; + } + + case s_body_identity: + { + uint64_t to_read = MIN(parser->content_length, + (uint64_t) ((data + len) - p)); + + assert(parser->content_length != 0 + && parser->content_length != ULLONG_MAX); + + /* The difference between advancing content_length and p is because + * the latter will automaticaly advance on the next loop iteration. + * Further, if content_length ends up at 0, we want to see the last + * byte again for our message complete callback. + */ + MARK(body); + parser->content_length -= to_read; + p += to_read - 1; + + if (parser->content_length == 0) { + UPDATE_STATE(s_message_done); + + /* Mimic CALLBACK_DATA_NOADVANCE() but with one extra byte. + * + * The alternative to doing this is to wait for the next byte to + * trigger the data callback, just as in every other case. The + * problem with this is that this makes it difficult for the test + * harness to distinguish between complete-on-EOF and + * complete-on-length. It's not clear that this distinction is + * important for applications, but let's keep it for now. + */ + CALLBACK_DATA_(body, p - body_mark + 1, p - data); + REEXECUTE(); + } + + break; + } + + /* read until EOF */ + case s_body_identity_eof: + MARK(body); + p = data + len - 1; + + break; + + case s_message_done: + UPDATE_STATE(NEW_MESSAGE()); + CALLBACK_NOTIFY(message_complete); + if (parser->upgrade) { + /* Exit, the rest of the message is in a different protocol. */ + RETURN((p - data) + 1); + } + break; + + case s_chunk_size_start: + { + assert(parser->nread == 1); + assert(parser->flags & F_CHUNKED); + + unhex_val = unhex[(unsigned char)ch]; + if (UNLIKELY(unhex_val == -1)) { + SET_ERRNO(HPE_INVALID_CHUNK_SIZE); + goto error; + } + + parser->content_length = unhex_val; + UPDATE_STATE(s_chunk_size); + break; + } + + case s_chunk_size: + { + uint64_t t; + + assert(parser->flags & F_CHUNKED); + + if (ch == CR) { + UPDATE_STATE(s_chunk_size_almost_done); + break; + } + + unhex_val = unhex[(unsigned char)ch]; + + if (unhex_val == -1) { + if (ch == ';' || ch == ' ') { + UPDATE_STATE(s_chunk_parameters); + break; + } + + SET_ERRNO(HPE_INVALID_CHUNK_SIZE); + goto error; + } + + t = parser->content_length; + t *= 16; + t += unhex_val; + + /* Overflow? Test against a conservative limit for simplicity. */ + if (UNLIKELY((ULLONG_MAX - 16) / 16 < parser->content_length)) { + SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); + goto error; + } + + parser->content_length = t; + break; + } + + case s_chunk_parameters: + { + assert(parser->flags & F_CHUNKED); + /* just ignore this shit. TODO check for overflow */ + if (ch == CR) { + UPDATE_STATE(s_chunk_size_almost_done); + break; + } + break; + } + + case s_chunk_size_almost_done: + { + assert(parser->flags & F_CHUNKED); + STRICT_CHECK(ch != LF); + + parser->nread = 0; + + if (parser->content_length == 0) { + parser->flags |= F_TRAILING; + UPDATE_STATE(s_header_field_start); + } else { + UPDATE_STATE(s_chunk_data); + } + CALLBACK_NOTIFY(chunk_header); + break; + } + + case s_chunk_data: + { + uint64_t to_read = MIN(parser->content_length, + (uint64_t) ((data + len) - p)); + + assert(parser->flags & F_CHUNKED); + assert(parser->content_length != 0 + && parser->content_length != ULLONG_MAX); + + /* See the explanation in s_body_identity for why the content + * length and data pointers are managed this way. + */ + MARK(body); + parser->content_length -= to_read; + p += to_read - 1; + + if (parser->content_length == 0) { + UPDATE_STATE(s_chunk_data_almost_done); + } + + break; + } + + case s_chunk_data_almost_done: + assert(parser->flags & F_CHUNKED); + assert(parser->content_length == 0); + STRICT_CHECK(ch != CR); + UPDATE_STATE(s_chunk_data_done); + CALLBACK_DATA(body); + break; + + case s_chunk_data_done: + assert(parser->flags & F_CHUNKED); + STRICT_CHECK(ch != LF); + parser->nread = 0; + UPDATE_STATE(s_chunk_size_start); + CALLBACK_NOTIFY(chunk_complete); + break; + + default: + assert(0 && "unhandled state"); + SET_ERRNO(HPE_INVALID_INTERNAL_STATE); + goto error; + } + } + + /* Run callbacks for any marks that we have leftover after we ran our of + * bytes. There should be at most one of these set, so it's OK to invoke + * them in series (unset marks will not result in callbacks). + * + * We use the NOADVANCE() variety of callbacks here because 'p' has already + * overflowed 'data' and this allows us to correct for the off-by-one that + * we'd otherwise have (since CALLBACK_DATA() is meant to be run with a 'p' + * value that's in-bounds). + */ + + assert(((header_field_mark ? 1 : 0) + + (header_value_mark ? 1 : 0) + + (url_mark ? 1 : 0) + + (body_mark ? 1 : 0) + + (status_mark ? 1 : 0)) <= 1); + + CALLBACK_DATA_NOADVANCE(header_field); + CALLBACK_DATA_NOADVANCE(header_value); + CALLBACK_DATA_NOADVANCE(url); + CALLBACK_DATA_NOADVANCE(body); + CALLBACK_DATA_NOADVANCE(status); + + RETURN(len); + +error: + if (HTTP_PARSER_ERRNO(parser) == HPE_OK) { + SET_ERRNO(HPE_UNKNOWN); + } + + RETURN(p - data); +} + + +/* Does the parser need to see an EOF to find the end of the message? */ +int +http_message_needs_eof (const http_parser *parser) +{ + if (parser->type == HTTP_REQUEST) { + return 0; + } + + /* See RFC 2616 section 4.4 */ + if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */ + parser->status_code == 204 || /* No Content */ + parser->status_code == 304 || /* Not Modified */ + parser->flags & F_SKIPBODY) { /* response to a HEAD request */ + return 0; + } + + if ((parser->flags & F_CHUNKED) || parser->content_length != ULLONG_MAX) { + return 0; + } + + return 1; +} + + +int +http_should_keep_alive (const http_parser *parser) +{ + if (parser->http_major > 0 && parser->http_minor > 0) { + /* HTTP/1.1 */ + if (parser->flags & F_CONNECTION_CLOSE) { + return 0; + } + } else { + /* HTTP/1.0 or earlier */ + if (!(parser->flags & F_CONNECTION_KEEP_ALIVE)) { + return 0; + } + } + + return !http_message_needs_eof(parser); +} + + +const char * +http_method_str (enum http_method m) +{ + return ELEM_AT(method_strings, m, ""); +} + + +void +http_parser_init (http_parser *parser, enum http_parser_type t) +{ + void *data = parser->data; /* preserve application data */ + memset(parser, 0, sizeof(*parser)); + parser->data = data; + parser->type = t; + parser->state = (t == HTTP_REQUEST ? s_start_req : (t == HTTP_RESPONSE ? s_start_res : s_start_req_or_res)); + parser->http_errno = HPE_OK; +} + +void +http_parser_settings_init(http_parser_settings *settings) +{ + memset(settings, 0, sizeof(*settings)); +} + +const char * +http_errno_name(enum http_errno err) { + assert(((size_t) err) < + (sizeof(http_strerror_tab) / sizeof(http_strerror_tab[0]))); + return http_strerror_tab[err].name; +} + +const char * +http_errno_description(enum http_errno err) { + assert(((size_t) err) < + (sizeof(http_strerror_tab) / sizeof(http_strerror_tab[0]))); + return http_strerror_tab[err].description; +} + +static enum http_host_state +http_parse_host_char(enum http_host_state s, const char ch) { + switch(s) { + case s_http_userinfo: + case s_http_userinfo_start: + if (ch == '@') { + return s_http_host_start; + } + + if (IS_USERINFO_CHAR(ch)) { + return s_http_userinfo; + } + break; + + case s_http_host_start: + if (ch == '[') { + return s_http_host_v6_start; + } + + if (IS_HOST_CHAR(ch)) { + return s_http_host; + } + + break; + + case s_http_host: + if (IS_HOST_CHAR(ch)) { + return s_http_host; + } + + /* FALLTHROUGH */ + case s_http_host_v6_end: + if (ch == ':') { + return s_http_host_port_start; + } + + break; + + case s_http_host_v6: + if (ch == ']') { + return s_http_host_v6_end; + } + + /* FALLTHROUGH */ + case s_http_host_v6_start: + if (IS_HEX(ch) || ch == ':' || ch == '.') { + return s_http_host_v6; + } + + break; + + case s_http_host_port: + case s_http_host_port_start: + if (IS_NUM(ch)) { + return s_http_host_port; + } + + break; + + default: + break; + } + return s_http_host_dead; +} + +static int +http_parse_host(const char * buf, struct http_parser_url *u, int found_at) { + enum http_host_state s; + + const char *p; + size_t buflen = u->field_data[UF_HOST].off + u->field_data[UF_HOST].len; + + u->field_data[UF_HOST].len = 0; + + s = found_at ? s_http_userinfo_start : s_http_host_start; + + for (p = buf + u->field_data[UF_HOST].off; p < buf + buflen; p++) { + enum http_host_state new_s = http_parse_host_char(s, *p); + + if (new_s == s_http_host_dead) { + return 1; + } + + switch(new_s) { + case s_http_host: + if (s != s_http_host) { + u->field_data[UF_HOST].off = p - buf; + } + u->field_data[UF_HOST].len++; + break; + + case s_http_host_v6: + if (s != s_http_host_v6) { + u->field_data[UF_HOST].off = p - buf; + } + u->field_data[UF_HOST].len++; + break; + + case s_http_host_port: + if (s != s_http_host_port) { + u->field_data[UF_PORT].off = p - buf; + u->field_data[UF_PORT].len = 0; + u->field_set |= (1 << UF_PORT); + } + u->field_data[UF_PORT].len++; + break; + + case s_http_userinfo: + if (s != s_http_userinfo) { + u->field_data[UF_USERINFO].off = p - buf ; + u->field_data[UF_USERINFO].len = 0; + u->field_set |= (1 << UF_USERINFO); + } + u->field_data[UF_USERINFO].len++; + break; + + default: + break; + } + s = new_s; + } + + /* Make sure we don't end somewhere unexpected */ + switch (s) { + case s_http_host_start: + case s_http_host_v6_start: + case s_http_host_v6: + case s_http_host_port_start: + case s_http_userinfo: + case s_http_userinfo_start: + return 1; + default: + break; + } + + return 0; +} + +int +http_parser_parse_url(const char *buf, size_t buflen, int is_connect, + struct http_parser_url *u) +{ + enum state s; + const char *p; + enum http_parser_url_fields uf, old_uf; + int found_at = 0; + + u->port = u->field_set = 0; + s = is_connect ? s_req_server_start : s_req_spaces_before_url; + old_uf = UF_MAX; + + for (p = buf; p < buf + buflen; p++) { + s = parse_url_char(s, *p); + + /* Figure out the next field that we're operating on */ + switch (s) { + case s_dead: + return 1; + + /* Skip delimeters */ + case s_req_schema_slash: + case s_req_schema_slash_slash: + case s_req_server_start: + case s_req_query_string_start: + case s_req_fragment_start: + continue; + + case s_req_schema: + uf = UF_SCHEMA; + break; + + case s_req_server_with_at: + found_at = 1; + + /* FALLTROUGH */ + case s_req_server: + uf = UF_HOST; + break; + + case s_req_path: + uf = UF_PATH; + break; + + case s_req_query_string: + uf = UF_QUERY; + break; + + case s_req_fragment: + uf = UF_FRAGMENT; + break; + + default: + assert(!"Unexpected state"); + return 1; + } + + /* Nothing's changed; soldier on */ + if (uf == old_uf) { + u->field_data[uf].len++; + continue; + } + + u->field_data[uf].off = p - buf; + u->field_data[uf].len = 1; + + u->field_set |= (1 << uf); + old_uf = uf; + } + + /* host must be present if there is a schema */ + /* parsing http:///toto will fail */ + if ((u->field_set & ((1 << UF_SCHEMA) | (1 << UF_HOST))) != 0) { + if (http_parse_host(buf, u, found_at) != 0) { + return 1; + } + } + + /* CONNECT requests can only contain "hostname:port" */ + if (is_connect && u->field_set != ((1 << UF_HOST)|(1 << UF_PORT))) { + return 1; + } + + if (u->field_set & (1 << UF_PORT)) { + /* Don't bother with endp; we've already validated the string */ + unsigned long v = strtoul(buf + u->field_data[UF_PORT].off, NULL, 10); + + /* Ports have a max value of 2^16 */ + if (v > 0xffff) { + return 1; + } + + u->port = (uint16_t) v; + } + + return 0; +} + +void +http_parser_pause(http_parser *parser, int paused) { + /* Users should only be pausing/unpausing a parser that is not in an error + * state. In non-debug builds, there's not much that we can do about this + * other than ignore it. + */ + if (HTTP_PARSER_ERRNO(parser) == HPE_OK || + HTTP_PARSER_ERRNO(parser) == HPE_PAUSED) { + SET_ERRNO((paused) ? HPE_PAUSED : HPE_OK); + } else { + assert(0 && "Attempting to pause parser in error state"); + } +} + +int +http_body_is_final(const struct http_parser *parser) { + return parser->state == s_message_done; +} + +unsigned long +http_parser_version(void) { + return HTTP_PARSER_VERSION_MAJOR * 0x10000 | + HTTP_PARSER_VERSION_MINOR * 0x00100 | + HTTP_PARSER_VERSION_PATCH * 0x00001; +} diff --git a/3rdparty/http-parser/http_parser.gyp b/3rdparty/http-parser/http_parser.gyp new file mode 100644 index 00000000000..ef34ecaeaea --- /dev/null +++ b/3rdparty/http-parser/http_parser.gyp @@ -0,0 +1,111 @@ +# This file is used with the GYP meta build system. +# http://code.google.com/p/gyp/ +# To build try this: +# svn co http://gyp.googlecode.com/svn/trunk gyp +# ./gyp/gyp -f make --depth=`pwd` http_parser.gyp +# ./out/Debug/test +{ + 'target_defaults': { + 'default_configuration': 'Debug', + 'configurations': { + # TODO: hoist these out and put them somewhere common, because + # RuntimeLibrary MUST MATCH across the entire project + 'Debug': { + 'defines': [ 'DEBUG', '_DEBUG' ], + 'cflags': [ '-Wall', '-Wextra', '-O0', '-g', '-ftrapv' ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': 1, # static debug + }, + }, + }, + 'Release': { + 'defines': [ 'NDEBUG' ], + 'cflags': [ '-Wall', '-Wextra', '-O3' ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': 0, # static release + }, + }, + } + }, + 'msvs_settings': { + 'VCCLCompilerTool': { + }, + 'VCLibrarianTool': { + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'conditions': [ + ['OS == "win"', { + 'defines': [ + 'WIN32' + ], + }] + ], + }, + + 'targets': [ + { + 'target_name': 'http_parser', + 'type': 'static_library', + 'include_dirs': [ '.' ], + 'direct_dependent_settings': { + 'defines': [ 'HTTP_PARSER_STRICT=0' ], + 'include_dirs': [ '.' ], + }, + 'defines': [ 'HTTP_PARSER_STRICT=0' ], + 'sources': [ './http_parser.c', ], + 'conditions': [ + ['OS=="win"', { + 'msvs_settings': { + 'VCCLCompilerTool': { + # Compile as C++. http_parser.c is actually C99, but C++ is + # close enough in this case. + 'CompileAs': 2, + }, + }, + }] + ], + }, + + { + 'target_name': 'http_parser_strict', + 'type': 'static_library', + 'include_dirs': [ '.' ], + 'direct_dependent_settings': { + 'defines': [ 'HTTP_PARSER_STRICT=1' ], + 'include_dirs': [ '.' ], + }, + 'defines': [ 'HTTP_PARSER_STRICT=1' ], + 'sources': [ './http_parser.c', ], + 'conditions': [ + ['OS=="win"', { + 'msvs_settings': { + 'VCCLCompilerTool': { + # Compile as C++. http_parser.c is actually C99, but C++ is + # close enough in this case. + 'CompileAs': 2, + }, + }, + }] + ], + }, + + { + 'target_name': 'test-nonstrict', + 'type': 'executable', + 'dependencies': [ 'http_parser' ], + 'sources': [ 'test.c' ] + }, + + { + 'target_name': 'test-strict', + 'type': 'executable', + 'dependencies': [ 'http_parser_strict' ], + 'sources': [ 'test.c' ] + } + ] +} diff --git a/3rdparty/http-parser/http_parser.h b/3rdparty/http-parser/http_parser.h new file mode 100644 index 00000000000..eb71bf99219 --- /dev/null +++ b/3rdparty/http-parser/http_parser.h @@ -0,0 +1,342 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ +#ifndef http_parser_h +#define http_parser_h +#ifdef __cplusplus +extern "C" { +#endif + +/* Also update SONAME in the Makefile whenever you change these. */ +#define HTTP_PARSER_VERSION_MAJOR 2 +#define HTTP_PARSER_VERSION_MINOR 5 +#define HTTP_PARSER_VERSION_PATCH 0 + +#include +#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600) +#include +#include +typedef __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +#include +#endif + +/* Compile with -DHTTP_PARSER_STRICT=0 to make less checks, but run + * faster + */ +#ifndef HTTP_PARSER_STRICT +# define HTTP_PARSER_STRICT 1 +#endif + +/* Maximium header size allowed. If the macro is not defined + * before including this header then the default is used. To + * change the maximum header size, define the macro in the build + * environment (e.g. -DHTTP_MAX_HEADER_SIZE=). To remove + * the effective limit on the size of the header, define the macro + * to a very large number (e.g. -DHTTP_MAX_HEADER_SIZE=0x7fffffff) + */ +#ifndef HTTP_MAX_HEADER_SIZE +# define HTTP_MAX_HEADER_SIZE (80*1024) +#endif + +typedef struct http_parser http_parser; +typedef struct http_parser_settings http_parser_settings; + + +/* Callbacks should return non-zero to indicate an error. The parser will + * then halt execution. + * + * The one exception is on_headers_complete. In a HTTP_RESPONSE parser + * returning '1' from on_headers_complete will tell the parser that it + * should not expect a body. This is used when receiving a response to a + * HEAD request which may contain 'Content-Length' or 'Transfer-Encoding: + * chunked' headers that indicate the presence of a body. + * + * http_data_cb does not return data chunks. It will be called arbitrarily + * many times for each string. E.G. you might get 10 callbacks for "on_url" + * each providing just a few characters more data. + */ +typedef int (*http_data_cb) (http_parser*, const char *at, size_t length); +typedef int (*http_cb) (http_parser*); + + +/* Request Methods */ +#define HTTP_METHOD_MAP(XX) \ + XX(0, DELETE, DELETE) \ + XX(1, GET, GET) \ + XX(2, HEAD, HEAD) \ + XX(3, POST, POST) \ + XX(4, PUT, PUT) \ + /* pathological */ \ + XX(5, CONNECT, CONNECT) \ + XX(6, OPTIONS, OPTIONS) \ + XX(7, TRACE, TRACE) \ + /* webdav */ \ + XX(8, COPY, COPY) \ + XX(9, LOCK, LOCK) \ + XX(10, MKCOL, MKCOL) \ + XX(11, MOVE, MOVE) \ + XX(12, PROPFIND, PROPFIND) \ + XX(13, PROPPATCH, PROPPATCH) \ + XX(14, SEARCH, SEARCH) \ + XX(15, UNLOCK, UNLOCK) \ + /* subversion */ \ + XX(16, REPORT, REPORT) \ + XX(17, MKACTIVITY, MKACTIVITY) \ + XX(18, CHECKOUT, CHECKOUT) \ + XX(19, MERGE, MERGE) \ + /* upnp */ \ + XX(20, MSEARCH, M-SEARCH) \ + XX(21, NOTIFY, NOTIFY) \ + XX(22, SUBSCRIBE, SUBSCRIBE) \ + XX(23, UNSUBSCRIBE, UNSUBSCRIBE) \ + /* RFC-5789 */ \ + XX(24, PATCH, PATCH) \ + XX(25, PURGE, PURGE) \ + /* CalDAV */ \ + XX(26, MKCALENDAR, MKCALENDAR) \ + +enum http_method + { +#define XX(num, name, string) HTTP_##name = num, + HTTP_METHOD_MAP(XX) +#undef XX + }; + + +enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH }; + + +/* Flag values for http_parser.flags field */ +enum flags + { F_CHUNKED = 1 << 0 + , F_CONNECTION_KEEP_ALIVE = 1 << 1 + , F_CONNECTION_CLOSE = 1 << 2 + , F_CONNECTION_UPGRADE = 1 << 3 + , F_TRAILING = 1 << 4 + , F_UPGRADE = 1 << 5 + , F_SKIPBODY = 1 << 6 + }; + + +/* Map for errno-related constants + * + * The provided argument should be a macro that takes 2 arguments. + */ +#define HTTP_ERRNO_MAP(XX) \ + /* No error */ \ + XX(OK, "success") \ + \ + /* Callback-related errors */ \ + XX(CB_message_begin, "the on_message_begin callback failed") \ + XX(CB_url, "the on_url callback failed") \ + XX(CB_header_field, "the on_header_field callback failed") \ + XX(CB_header_value, "the on_header_value callback failed") \ + XX(CB_headers_complete, "the on_headers_complete callback failed") \ + XX(CB_body, "the on_body callback failed") \ + XX(CB_message_complete, "the on_message_complete callback failed") \ + XX(CB_status, "the on_status callback failed") \ + XX(CB_chunk_header, "the on_chunk_header callback failed") \ + XX(CB_chunk_complete, "the on_chunk_complete callback failed") \ + \ + /* Parsing-related errors */ \ + XX(INVALID_EOF_STATE, "stream ended at an unexpected time") \ + XX(HEADER_OVERFLOW, \ + "too many header bytes seen; overflow detected") \ + XX(CLOSED_CONNECTION, \ + "data received after completed connection: close message") \ + XX(INVALID_VERSION, "invalid HTTP version") \ + XX(INVALID_STATUS, "invalid HTTP status code") \ + XX(INVALID_METHOD, "invalid HTTP method") \ + XX(INVALID_URL, "invalid URL") \ + XX(INVALID_HOST, "invalid host") \ + XX(INVALID_PORT, "invalid port") \ + XX(INVALID_PATH, "invalid path") \ + XX(INVALID_QUERY_STRING, "invalid query string") \ + XX(INVALID_FRAGMENT, "invalid fragment") \ + XX(LF_EXPECTED, "LF character expected") \ + XX(INVALID_HEADER_TOKEN, "invalid character in header") \ + XX(INVALID_CONTENT_LENGTH, \ + "invalid character in content-length header") \ + XX(INVALID_CHUNK_SIZE, \ + "invalid character in chunk size header") \ + XX(INVALID_CONSTANT, "invalid constant string") \ + XX(INVALID_INTERNAL_STATE, "encountered unexpected internal state")\ + XX(STRICT, "strict mode assertion failed") \ + XX(PAUSED, "parser is paused") \ + XX(UNKNOWN, "an unknown error occurred") + + +/* Define HPE_* values for each errno value above */ +#define HTTP_ERRNO_GEN(n, s) HPE_##n, +enum http_errno { + HTTP_ERRNO_MAP(HTTP_ERRNO_GEN) +}; +#undef HTTP_ERRNO_GEN + + +/* Get an http_errno value from an http_parser */ +#define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno) + + +struct http_parser { + /** PRIVATE **/ + unsigned int type : 2; /* enum http_parser_type */ + unsigned int flags : 7; /* F_* values from 'flags' enum; semi-public */ + unsigned int state : 7; /* enum state from http_parser.c */ + unsigned int header_state : 8; /* enum header_state from http_parser.c */ + unsigned int index : 8; /* index into current matcher */ + + uint32_t nread; /* # bytes read in various scenarios */ + uint64_t content_length; /* # bytes in body (0 if no Content-Length header) */ + + /** READ-ONLY **/ + unsigned short http_major; + unsigned short http_minor; + unsigned int status_code : 16; /* responses only */ + unsigned int method : 8; /* requests only */ + unsigned int http_errno : 7; + + /* 1 = Upgrade header was present and the parser has exited because of that. + * 0 = No upgrade header present. + * Should be checked when http_parser_execute() returns in addition to + * error checking. + */ + unsigned int upgrade : 1; + + /** PUBLIC **/ + void *data; /* A pointer to get hook to the "connection" or "socket" object */ +}; + + +struct http_parser_settings { + http_cb on_message_begin; + http_data_cb on_url; + http_data_cb on_status; + http_data_cb on_header_field; + http_data_cb on_header_value; + http_cb on_headers_complete; + http_data_cb on_body; + http_cb on_message_complete; + /* When on_chunk_header is called, the current chunk length is stored + * in parser->content_length. + */ + http_cb on_chunk_header; + http_cb on_chunk_complete; +}; + + +enum http_parser_url_fields + { UF_SCHEMA = 0 + , UF_HOST = 1 + , UF_PORT = 2 + , UF_PATH = 3 + , UF_QUERY = 4 + , UF_FRAGMENT = 5 + , UF_USERINFO = 6 + , UF_MAX = 7 + }; + + +/* Result structure for http_parser_parse_url(). + * + * Callers should index into field_data[] with UF_* values iff field_set + * has the relevant (1 << UF_*) bit set. As a courtesy to clients (and + * because we probably have padding left over), we convert any port to + * a uint16_t. + */ +struct http_parser_url { + uint16_t field_set; /* Bitmask of (1 << UF_*) values */ + uint16_t port; /* Converted UF_PORT string */ + + struct { + uint16_t off; /* Offset into buffer in which field starts */ + uint16_t len; /* Length of run in buffer */ + } field_data[UF_MAX]; +}; + + +/* Returns the library version. Bits 16-23 contain the major version number, + * bits 8-15 the minor version number and bits 0-7 the patch level. + * Usage example: + * + * unsigned long version = http_parser_version(); + * unsigned major = (version >> 16) & 255; + * unsigned minor = (version >> 8) & 255; + * unsigned patch = version & 255; + * printf("http_parser v%u.%u.%u\n", major, minor, patch); + */ +unsigned long http_parser_version(void); + +void http_parser_init(http_parser *parser, enum http_parser_type type); + + +/* Initialize http_parser_settings members to 0 + */ +void http_parser_settings_init(http_parser_settings *settings); + + +/* Executes the parser. Returns number of parsed bytes. Sets + * `parser->http_errno` on error. */ +size_t http_parser_execute(http_parser *parser, + const http_parser_settings *settings, + const char *data, + size_t len); + + +/* If http_should_keep_alive() in the on_headers_complete or + * on_message_complete callback returns 0, then this should be + * the last message on the connection. + * If you are the server, respond with the "Connection: close" header. + * If you are the client, close the connection. + */ +int http_should_keep_alive(const http_parser *parser); + +/* Returns a string version of the HTTP method. */ +const char *http_method_str(enum http_method m); + +/* Return a string name of the given error */ +const char *http_errno_name(enum http_errno err); + +/* Return a string description of the given error */ +const char *http_errno_description(enum http_errno err); + +/* Parse a URL; return nonzero on failure */ +int http_parser_parse_url(const char *buf, size_t buflen, + int is_connect, + struct http_parser_url *u); + +/* Pause or un-pause the parser; a nonzero value pauses */ +void http_parser_pause(http_parser *parser, int paused); + +/* Checks if this is the final chunk of the body. */ +int http_body_is_final(const http_parser *parser); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/3rdparty/http-parser/test.c b/3rdparty/http-parser/test.c new file mode 100644 index 00000000000..4c00571eba6 --- /dev/null +++ b/3rdparty/http-parser/test.c @@ -0,0 +1,3852 @@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ +#include "http_parser.h" +#include +#include +#include +#include /* rand */ +#include +#include + +#if defined(__APPLE__) +# undef strlcat +# undef strlncpy +# undef strlcpy +#endif /* defined(__APPLE__) */ + +#undef TRUE +#define TRUE 1 +#undef FALSE +#define FALSE 0 + +#define MAX_HEADERS 13 +#define MAX_ELEMENT_SIZE 2048 +#define MAX_CHUNKS 16 + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) + +static http_parser *parser; + +struct message { + const char *name; // for debugging purposes + const char *raw; + enum http_parser_type type; + enum http_method method; + int status_code; + char response_status[MAX_ELEMENT_SIZE]; + char request_path[MAX_ELEMENT_SIZE]; + char request_url[MAX_ELEMENT_SIZE]; + char fragment[MAX_ELEMENT_SIZE]; + char query_string[MAX_ELEMENT_SIZE]; + char body[MAX_ELEMENT_SIZE]; + size_t body_size; + const char *host; + const char *userinfo; + uint16_t port; + int num_headers; + enum { NONE=0, FIELD, VALUE } last_header_element; + char headers [MAX_HEADERS][2][MAX_ELEMENT_SIZE]; + int should_keep_alive; + + int num_chunks; + int num_chunks_complete; + int chunk_lengths[MAX_CHUNKS]; + + const char *upgrade; // upgraded body + + unsigned short http_major; + unsigned short http_minor; + + int message_begin_cb_called; + int headers_complete_cb_called; + int message_complete_cb_called; + int message_complete_on_eof; + int body_is_final; +}; + +static int currently_parsing_eof; + +static struct message messages[5]; +static int num_messages; +static http_parser_settings *current_pause_parser; + +/* * R E Q U E S T S * */ +const struct message requests[] = +#define CURL_GET 0 +{ {.name= "curl get" + ,.type= HTTP_REQUEST + ,.raw= "GET /test HTTP/1.1\r\n" + "User-Agent: curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1\r\n" + "Host: 0.0.0.0=5000\r\n" + "Accept: */*\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/test" + ,.request_url= "/test" + ,.num_headers= 3 + ,.headers= + { { "User-Agent", "curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1" } + , { "Host", "0.0.0.0=5000" } + , { "Accept", "*/*" } + } + ,.body= "" + } + +#define FIREFOX_GET 1 +, {.name= "firefox get" + ,.type= HTTP_REQUEST + ,.raw= "GET /favicon.ico HTTP/1.1\r\n" + "Host: 0.0.0.0=5000\r\n" + "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008061015 Firefox/3.0\r\n" + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" + "Accept-Language: en-us,en;q=0.5\r\n" + "Accept-Encoding: gzip,deflate\r\n" + "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" + "Keep-Alive: 300\r\n" + "Connection: keep-alive\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/favicon.ico" + ,.request_url= "/favicon.ico" + ,.num_headers= 8 + ,.headers= + { { "Host", "0.0.0.0=5000" } + , { "User-Agent", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008061015 Firefox/3.0" } + , { "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" } + , { "Accept-Language", "en-us,en;q=0.5" } + , { "Accept-Encoding", "gzip,deflate" } + , { "Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7" } + , { "Keep-Alive", "300" } + , { "Connection", "keep-alive" } + } + ,.body= "" + } + +#define DUMBFUCK 2 +, {.name= "dumbfuck" + ,.type= HTTP_REQUEST + ,.raw= "GET /dumbfuck HTTP/1.1\r\n" + "aaaaaaaaaaaaa:++++++++++\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/dumbfuck" + ,.request_url= "/dumbfuck" + ,.num_headers= 1 + ,.headers= + { { "aaaaaaaaaaaaa", "++++++++++" } + } + ,.body= "" + } + +#define FRAGMENT_IN_URI 3 +, {.name= "fragment in url" + ,.type= HTTP_REQUEST + ,.raw= "GET /forums/1/topics/2375?page=1#posts-17408 HTTP/1.1\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "page=1" + ,.fragment= "posts-17408" + ,.request_path= "/forums/1/topics/2375" + /* XXX request url does include fragment? */ + ,.request_url= "/forums/1/topics/2375?page=1#posts-17408" + ,.num_headers= 0 + ,.body= "" + } + +#define GET_NO_HEADERS_NO_BODY 4 +, {.name= "get no headers no body" + ,.type= HTTP_REQUEST + ,.raw= "GET /get_no_headers_no_body/world HTTP/1.1\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE /* would need Connection: close */ + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/get_no_headers_no_body/world" + ,.request_url= "/get_no_headers_no_body/world" + ,.num_headers= 0 + ,.body= "" + } + +#define GET_ONE_HEADER_NO_BODY 5 +, {.name= "get one header no body" + ,.type= HTTP_REQUEST + ,.raw= "GET /get_one_header_no_body HTTP/1.1\r\n" + "Accept: */*\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE /* would need Connection: close */ + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/get_one_header_no_body" + ,.request_url= "/get_one_header_no_body" + ,.num_headers= 1 + ,.headers= + { { "Accept" , "*/*" } + } + ,.body= "" + } + +#define GET_FUNKY_CONTENT_LENGTH 6 +, {.name= "get funky content length body hello" + ,.type= HTTP_REQUEST + ,.raw= "GET /get_funky_content_length_body_hello HTTP/1.0\r\n" + "conTENT-Length: 5\r\n" + "\r\n" + "HELLO" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 0 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/get_funky_content_length_body_hello" + ,.request_url= "/get_funky_content_length_body_hello" + ,.num_headers= 1 + ,.headers= + { { "conTENT-Length" , "5" } + } + ,.body= "HELLO" + } + +#define POST_IDENTITY_BODY_WORLD 7 +, {.name= "post identity body world" + ,.type= HTTP_REQUEST + ,.raw= "POST /post_identity_body_world?q=search#hey HTTP/1.1\r\n" + "Accept: */*\r\n" + "Transfer-Encoding: identity\r\n" + "Content-Length: 5\r\n" + "\r\n" + "World" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_POST + ,.query_string= "q=search" + ,.fragment= "hey" + ,.request_path= "/post_identity_body_world" + ,.request_url= "/post_identity_body_world?q=search#hey" + ,.num_headers= 3 + ,.headers= + { { "Accept", "*/*" } + , { "Transfer-Encoding", "identity" } + , { "Content-Length", "5" } + } + ,.body= "World" + } + +#define POST_CHUNKED_ALL_YOUR_BASE 8 +, {.name= "post - chunked body: all your base are belong to us" + ,.type= HTTP_REQUEST + ,.raw= "POST /post_chunked_all_your_base HTTP/1.1\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n" + "1e\r\nall your base are belong to us\r\n" + "0\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_POST + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/post_chunked_all_your_base" + ,.request_url= "/post_chunked_all_your_base" + ,.num_headers= 1 + ,.headers= + { { "Transfer-Encoding" , "chunked" } + } + ,.body= "all your base are belong to us" + ,.num_chunks_complete= 2 + ,.chunk_lengths= { 0x1e } + } + +#define TWO_CHUNKS_MULT_ZERO_END 9 +, {.name= "two chunks ; triple zero ending" + ,.type= HTTP_REQUEST + ,.raw= "POST /two_chunks_mult_zero_end HTTP/1.1\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n" + "5\r\nhello\r\n" + "6\r\n world\r\n" + "000\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_POST + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/two_chunks_mult_zero_end" + ,.request_url= "/two_chunks_mult_zero_end" + ,.num_headers= 1 + ,.headers= + { { "Transfer-Encoding", "chunked" } + } + ,.body= "hello world" + ,.num_chunks_complete= 3 + ,.chunk_lengths= { 5, 6 } + } + +#define CHUNKED_W_TRAILING_HEADERS 10 +, {.name= "chunked with trailing headers. blech." + ,.type= HTTP_REQUEST + ,.raw= "POST /chunked_w_trailing_headers HTTP/1.1\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n" + "5\r\nhello\r\n" + "6\r\n world\r\n" + "0\r\n" + "Vary: *\r\n" + "Content-Type: text/plain\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_POST + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/chunked_w_trailing_headers" + ,.request_url= "/chunked_w_trailing_headers" + ,.num_headers= 3 + ,.headers= + { { "Transfer-Encoding", "chunked" } + , { "Vary", "*" } + , { "Content-Type", "text/plain" } + } + ,.body= "hello world" + ,.num_chunks_complete= 3 + ,.chunk_lengths= { 5, 6 } + } + +#define CHUNKED_W_BULLSHIT_AFTER_LENGTH 11 +, {.name= "with bullshit after the length" + ,.type= HTTP_REQUEST + ,.raw= "POST /chunked_w_bullshit_after_length HTTP/1.1\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n" + "5; ihatew3;whatthefuck=aretheseparametersfor\r\nhello\r\n" + "6; blahblah; blah\r\n world\r\n" + "0\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_POST + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/chunked_w_bullshit_after_length" + ,.request_url= "/chunked_w_bullshit_after_length" + ,.num_headers= 1 + ,.headers= + { { "Transfer-Encoding", "chunked" } + } + ,.body= "hello world" + ,.num_chunks_complete= 3 + ,.chunk_lengths= { 5, 6 } + } + +#define WITH_QUOTES 12 +, {.name= "with quotes" + ,.type= HTTP_REQUEST + ,.raw= "GET /with_\"stupid\"_quotes?foo=\"bar\" HTTP/1.1\r\n\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "foo=\"bar\"" + ,.fragment= "" + ,.request_path= "/with_\"stupid\"_quotes" + ,.request_url= "/with_\"stupid\"_quotes?foo=\"bar\"" + ,.num_headers= 0 + ,.headers= { } + ,.body= "" + } + +#define APACHEBENCH_GET 13 +/* The server receiving this request SHOULD NOT wait for EOF + * to know that content-length == 0. + * How to represent this in a unit test? message_complete_on_eof + * Compare with NO_CONTENT_LENGTH_RESPONSE. + */ +, {.name = "apachebench get" + ,.type= HTTP_REQUEST + ,.raw= "GET /test HTTP/1.0\r\n" + "Host: 0.0.0.0:5000\r\n" + "User-Agent: ApacheBench/2.3\r\n" + "Accept: */*\r\n\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 0 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/test" + ,.request_url= "/test" + ,.num_headers= 3 + ,.headers= { { "Host", "0.0.0.0:5000" } + , { "User-Agent", "ApacheBench/2.3" } + , { "Accept", "*/*" } + } + ,.body= "" + } + +#define QUERY_URL_WITH_QUESTION_MARK_GET 14 +/* Some clients include '?' characters in query strings. + */ +, {.name = "query url with question mark" + ,.type= HTTP_REQUEST + ,.raw= "GET /test.cgi?foo=bar?baz HTTP/1.1\r\n\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "foo=bar?baz" + ,.fragment= "" + ,.request_path= "/test.cgi" + ,.request_url= "/test.cgi?foo=bar?baz" + ,.num_headers= 0 + ,.headers= {} + ,.body= "" + } + +#define PREFIX_NEWLINE_GET 15 +/* Some clients, especially after a POST in a keep-alive connection, + * will send an extra CRLF before the next request + */ +, {.name = "newline prefix get" + ,.type= HTTP_REQUEST + ,.raw= "\r\nGET /test HTTP/1.1\r\n\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/test" + ,.request_url= "/test" + ,.num_headers= 0 + ,.headers= { } + ,.body= "" + } + +#define UPGRADE_REQUEST 16 +, {.name = "upgrade request" + ,.type= HTTP_REQUEST + ,.raw= "GET /demo HTTP/1.1\r\n" + "Host: example.com\r\n" + "Connection: Upgrade\r\n" + "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" + "Sec-WebSocket-Protocol: sample\r\n" + "Upgrade: WebSocket\r\n" + "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" + "Origin: http://example.com\r\n" + "\r\n" + "Hot diggity dogg" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/demo" + ,.request_url= "/demo" + ,.num_headers= 7 + ,.upgrade="Hot diggity dogg" + ,.headers= { { "Host", "example.com" } + , { "Connection", "Upgrade" } + , { "Sec-WebSocket-Key2", "12998 5 Y3 1 .P00" } + , { "Sec-WebSocket-Protocol", "sample" } + , { "Upgrade", "WebSocket" } + , { "Sec-WebSocket-Key1", "4 @1 46546xW%0l 1 5" } + , { "Origin", "http://example.com" } + } + ,.body= "" + } + +#define CONNECT_REQUEST 17 +, {.name = "connect request" + ,.type= HTTP_REQUEST + ,.raw= "CONNECT 0-home0.netscape.com:443 HTTP/1.0\r\n" + "User-agent: Mozilla/1.1N\r\n" + "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n" + "\r\n" + "some data\r\n" + "and yet even more data" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 0 + ,.method= HTTP_CONNECT + ,.query_string= "" + ,.fragment= "" + ,.request_path= "" + ,.request_url= "0-home0.netscape.com:443" + ,.num_headers= 2 + ,.upgrade="some data\r\nand yet even more data" + ,.headers= { { "User-agent", "Mozilla/1.1N" } + , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" } + } + ,.body= "" + } + +#define REPORT_REQ 18 +, {.name= "report request" + ,.type= HTTP_REQUEST + ,.raw= "REPORT /test HTTP/1.1\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_REPORT + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/test" + ,.request_url= "/test" + ,.num_headers= 0 + ,.headers= {} + ,.body= "" + } + +#define NO_HTTP_VERSION 19 +, {.name= "request with no http version" + ,.type= HTTP_REQUEST + ,.raw= "GET /\r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 0 + ,.http_minor= 9 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/" + ,.request_url= "/" + ,.num_headers= 0 + ,.headers= {} + ,.body= "" + } + +#define MSEARCH_REQ 20 +, {.name= "m-search request" + ,.type= HTTP_REQUEST + ,.raw= "M-SEARCH * HTTP/1.1\r\n" + "HOST: 239.255.255.250:1900\r\n" + "MAN: \"ssdp:discover\"\r\n" + "ST: \"ssdp:all\"\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_MSEARCH + ,.query_string= "" + ,.fragment= "" + ,.request_path= "*" + ,.request_url= "*" + ,.num_headers= 3 + ,.headers= { { "HOST", "239.255.255.250:1900" } + , { "MAN", "\"ssdp:discover\"" } + , { "ST", "\"ssdp:all\"" } + } + ,.body= "" + } + +#define LINE_FOLDING_IN_HEADER 21 +, {.name= "line folding in header value" + ,.type= HTTP_REQUEST + ,.raw= "GET / HTTP/1.1\r\n" + "Line1: abc\r\n" + "\tdef\r\n" + " ghi\r\n" + "\t\tjkl\r\n" + " mno \r\n" + "\t \tqrs\r\n" + "Line2: \t line2\t\r\n" + "Line3:\r\n" + " line3\r\n" + "Line4: \r\n" + " \r\n" + "Connection:\r\n" + " close\r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/" + ,.request_url= "/" + ,.num_headers= 5 + ,.headers= { { "Line1", "abc\tdef ghi\t\tjkl mno \t \tqrs" } + , { "Line2", "line2\t" } + , { "Line3", "line3" } + , { "Line4", "" } + , { "Connection", "close" }, + } + ,.body= "" + } + + +#define QUERY_TERMINATED_HOST 22 +, {.name= "host terminated by a query string" + ,.type= HTTP_REQUEST + ,.raw= "GET http://hypnotoad.org?hail=all HTTP/1.1\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "hail=all" + ,.fragment= "" + ,.request_path= "" + ,.request_url= "http://hypnotoad.org?hail=all" + ,.host= "hypnotoad.org" + ,.num_headers= 0 + ,.headers= { } + ,.body= "" + } + +#define QUERY_TERMINATED_HOSTPORT 23 +, {.name= "host:port terminated by a query string" + ,.type= HTTP_REQUEST + ,.raw= "GET http://hypnotoad.org:1234?hail=all HTTP/1.1\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "hail=all" + ,.fragment= "" + ,.request_path= "" + ,.request_url= "http://hypnotoad.org:1234?hail=all" + ,.host= "hypnotoad.org" + ,.port= 1234 + ,.num_headers= 0 + ,.headers= { } + ,.body= "" + } + +#define SPACE_TERMINATED_HOSTPORT 24 +, {.name= "host:port terminated by a space" + ,.type= HTTP_REQUEST + ,.raw= "GET http://hypnotoad.org:1234 HTTP/1.1\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "" + ,.request_url= "http://hypnotoad.org:1234" + ,.host= "hypnotoad.org" + ,.port= 1234 + ,.num_headers= 0 + ,.headers= { } + ,.body= "" + } + +#define PATCH_REQ 25 +, {.name = "PATCH request" + ,.type= HTTP_REQUEST + ,.raw= "PATCH /file.txt HTTP/1.1\r\n" + "Host: www.example.com\r\n" + "Content-Type: application/example\r\n" + "If-Match: \"e0023aa4e\"\r\n" + "Content-Length: 10\r\n" + "\r\n" + "cccccccccc" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_PATCH + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/file.txt" + ,.request_url= "/file.txt" + ,.num_headers= 4 + ,.headers= { { "Host", "www.example.com" } + , { "Content-Type", "application/example" } + , { "If-Match", "\"e0023aa4e\"" } + , { "Content-Length", "10" } + } + ,.body= "cccccccccc" + } + +#define CONNECT_CAPS_REQUEST 26 +, {.name = "connect caps request" + ,.type= HTTP_REQUEST + ,.raw= "CONNECT HOME0.NETSCAPE.COM:443 HTTP/1.0\r\n" + "User-agent: Mozilla/1.1N\r\n" + "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 0 + ,.method= HTTP_CONNECT + ,.query_string= "" + ,.fragment= "" + ,.request_path= "" + ,.request_url= "HOME0.NETSCAPE.COM:443" + ,.num_headers= 2 + ,.upgrade="" + ,.headers= { { "User-agent", "Mozilla/1.1N" } + , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" } + } + ,.body= "" + } + +#if !HTTP_PARSER_STRICT +#define UTF8_PATH_REQ 27 +, {.name= "utf-8 path request" + ,.type= HTTP_REQUEST + ,.raw= "GET /δ¶/δt/pope?q=1#narf HTTP/1.1\r\n" + "Host: github.com\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "q=1" + ,.fragment= "narf" + ,.request_path= "/δ¶/δt/pope" + ,.request_url= "/δ¶/δt/pope?q=1#narf" + ,.num_headers= 1 + ,.headers= { {"Host", "github.com" } + } + ,.body= "" + } + +#define HOSTNAME_UNDERSCORE 28 +, {.name = "hostname underscore" + ,.type= HTTP_REQUEST + ,.raw= "CONNECT home_0.netscape.com:443 HTTP/1.0\r\n" + "User-agent: Mozilla/1.1N\r\n" + "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 0 + ,.method= HTTP_CONNECT + ,.query_string= "" + ,.fragment= "" + ,.request_path= "" + ,.request_url= "home_0.netscape.com:443" + ,.num_headers= 2 + ,.upgrade="" + ,.headers= { { "User-agent", "Mozilla/1.1N" } + , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" } + } + ,.body= "" + } +#endif /* !HTTP_PARSER_STRICT */ + +/* see https://github.com/ry/http-parser/issues/47 */ +#define EAT_TRAILING_CRLF_NO_CONNECTION_CLOSE 29 +, {.name = "eat CRLF between requests, no \"Connection: close\" header" + ,.raw= "POST / HTTP/1.1\r\n" + "Host: www.example.com\r\n" + "Content-Type: application/x-www-form-urlencoded\r\n" + "Content-Length: 4\r\n" + "\r\n" + "q=42\r\n" /* note the trailing CRLF */ + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_POST + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/" + ,.request_url= "/" + ,.num_headers= 3 + ,.upgrade= 0 + ,.headers= { { "Host", "www.example.com" } + , { "Content-Type", "application/x-www-form-urlencoded" } + , { "Content-Length", "4" } + } + ,.body= "q=42" + } + +/* see https://github.com/ry/http-parser/issues/47 */ +#define EAT_TRAILING_CRLF_WITH_CONNECTION_CLOSE 30 +, {.name = "eat CRLF between requests even if \"Connection: close\" is set" + ,.raw= "POST / HTTP/1.1\r\n" + "Host: www.example.com\r\n" + "Content-Type: application/x-www-form-urlencoded\r\n" + "Content-Length: 4\r\n" + "Connection: close\r\n" + "\r\n" + "q=42\r\n" /* note the trailing CRLF */ + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE /* input buffer isn't empty when on_message_complete is called */ + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_POST + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/" + ,.request_url= "/" + ,.num_headers= 4 + ,.upgrade= 0 + ,.headers= { { "Host", "www.example.com" } + , { "Content-Type", "application/x-www-form-urlencoded" } + , { "Content-Length", "4" } + , { "Connection", "close" } + } + ,.body= "q=42" + } + +#define PURGE_REQ 31 +, {.name = "PURGE request" + ,.type= HTTP_REQUEST + ,.raw= "PURGE /file.txt HTTP/1.1\r\n" + "Host: www.example.com\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_PURGE + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/file.txt" + ,.request_url= "/file.txt" + ,.num_headers= 1 + ,.headers= { { "Host", "www.example.com" } } + ,.body= "" + } + +#define SEARCH_REQ 32 +, {.name = "SEARCH request" + ,.type= HTTP_REQUEST + ,.raw= "SEARCH / HTTP/1.1\r\n" + "Host: www.example.com\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_SEARCH + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/" + ,.request_url= "/" + ,.num_headers= 1 + ,.headers= { { "Host", "www.example.com" } } + ,.body= "" + } + +#define PROXY_WITH_BASIC_AUTH 33 +, {.name= "host:port and basic_auth" + ,.type= HTTP_REQUEST + ,.raw= "GET http://a%12:b!&*$@hypnotoad.org:1234/toto HTTP/1.1\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.fragment= "" + ,.request_path= "/toto" + ,.request_url= "http://a%12:b!&*$@hypnotoad.org:1234/toto" + ,.host= "hypnotoad.org" + ,.userinfo= "a%12:b!&*$" + ,.port= 1234 + ,.num_headers= 0 + ,.headers= { } + ,.body= "" + } + +#define LINE_FOLDING_IN_HEADER_WITH_LF 34 +, {.name= "line folding in header value" + ,.type= HTTP_REQUEST + ,.raw= "GET / HTTP/1.1\n" + "Line1: abc\n" + "\tdef\n" + " ghi\n" + "\t\tjkl\n" + " mno \n" + "\t \tqrs\n" + "Line2: \t line2\t\n" + "Line3:\n" + " line3\n" + "Line4: \n" + " \n" + "Connection:\n" + " close\n" + "\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/" + ,.request_url= "/" + ,.num_headers= 5 + ,.headers= { { "Line1", "abc\tdef ghi\t\tjkl mno \t \tqrs" } + , { "Line2", "line2\t" } + , { "Line3", "line3" } + , { "Line4", "" } + , { "Connection", "close" }, + } + ,.body= "" + } + +#define CONNECTION_MULTI 35 +, {.name = "multiple connection header values with folding" + ,.type= HTTP_REQUEST + ,.raw= "GET /demo HTTP/1.1\r\n" + "Host: example.com\r\n" + "Connection: Something,\r\n" + " Upgrade, ,Keep-Alive\r\n" + "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" + "Sec-WebSocket-Protocol: sample\r\n" + "Upgrade: WebSocket\r\n" + "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" + "Origin: http://example.com\r\n" + "\r\n" + "Hot diggity dogg" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/demo" + ,.request_url= "/demo" + ,.num_headers= 7 + ,.upgrade="Hot diggity dogg" + ,.headers= { { "Host", "example.com" } + , { "Connection", "Something, Upgrade, ,Keep-Alive" } + , { "Sec-WebSocket-Key2", "12998 5 Y3 1 .P00" } + , { "Sec-WebSocket-Protocol", "sample" } + , { "Upgrade", "WebSocket" } + , { "Sec-WebSocket-Key1", "4 @1 46546xW%0l 1 5" } + , { "Origin", "http://example.com" } + } + ,.body= "" + } + +#define CONNECTION_MULTI_LWS 36 +, {.name = "multiple connection header values with folding and lws" + ,.type= HTTP_REQUEST + ,.raw= "GET /demo HTTP/1.1\r\n" + "Connection: keep-alive, upgrade\r\n" + "Upgrade: WebSocket\r\n" + "\r\n" + "Hot diggity dogg" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/demo" + ,.request_url= "/demo" + ,.num_headers= 2 + ,.upgrade="Hot diggity dogg" + ,.headers= { { "Connection", "keep-alive, upgrade" } + , { "Upgrade", "WebSocket" } + } + ,.body= "" + } + +#define CONNECTION_MULTI_LWS_CRLF 37 +, {.name = "multiple connection header values with folding and lws" + ,.type= HTTP_REQUEST + ,.raw= "GET /demo HTTP/1.1\r\n" + "Connection: keep-alive, \r\n upgrade\r\n" + "Upgrade: WebSocket\r\n" + "\r\n" + "Hot diggity dogg" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_GET + ,.query_string= "" + ,.fragment= "" + ,.request_path= "/demo" + ,.request_url= "/demo" + ,.num_headers= 2 + ,.upgrade="Hot diggity dogg" + ,.headers= { { "Connection", "keep-alive, upgrade" } + , { "Upgrade", "WebSocket" } + } + ,.body= "" + } + +#define UPGRADE_POST_REQUEST 38 +, {.name = "upgrade post request" + ,.type= HTTP_REQUEST + ,.raw= "POST /demo HTTP/1.1\r\n" + "Host: example.com\r\n" + "Connection: Upgrade\r\n" + "Upgrade: HTTP/2.0\r\n" + "Content-Length: 15\r\n" + "\r\n" + "sweet post body" + "Hot diggity dogg" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.method= HTTP_POST + ,.request_path= "/demo" + ,.request_url= "/demo" + ,.num_headers= 4 + ,.upgrade="Hot diggity dogg" + ,.headers= { { "Host", "example.com" } + , { "Connection", "Upgrade" } + , { "Upgrade", "HTTP/2.0" } + , { "Content-Length", "15" } + } + ,.body= "sweet post body" + } + +#define CONNECT_WITH_BODY_REQUEST 39 +, {.name = "connect with body request" + ,.type= HTTP_REQUEST + ,.raw= "CONNECT foo.bar.com:443 HTTP/1.0\r\n" + "User-agent: Mozilla/1.1N\r\n" + "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n" + "Content-Length: 10\r\n" + "\r\n" + "blarfcicle" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 0 + ,.method= HTTP_CONNECT + ,.request_url= "foo.bar.com:443" + ,.num_headers= 3 + ,.upgrade="blarfcicle" + ,.headers= { { "User-agent", "Mozilla/1.1N" } + , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" } + , { "Content-Length", "10" } + } + ,.body= "" + } + +, {.name= NULL } /* sentinel */ +}; + +/* * R E S P O N S E S * */ +const struct message responses[] = +#define GOOGLE_301 0 +{ {.name= "google 301" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 301 Moved Permanently\r\n" + "Location: http://www.google.com/\r\n" + "Content-Type: text/html; charset=UTF-8\r\n" + "Date: Sun, 26 Apr 2009 11:11:49 GMT\r\n" + "Expires: Tue, 26 May 2009 11:11:49 GMT\r\n" + "X-$PrototypeBI-Version: 1.6.0.3\r\n" /* $ char in header field */ + "Cache-Control: public, max-age=2592000\r\n" + "Server: gws\r\n" + "Content-Length: 219 \r\n" + "\r\n" + "\n" + "301 Moved\n" + "

301 Moved

\n" + "The document has moved\n" + "
here.\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 301 + ,.response_status= "Moved Permanently" + ,.num_headers= 8 + ,.headers= + { { "Location", "http://www.google.com/" } + , { "Content-Type", "text/html; charset=UTF-8" } + , { "Date", "Sun, 26 Apr 2009 11:11:49 GMT" } + , { "Expires", "Tue, 26 May 2009 11:11:49 GMT" } + , { "X-$PrototypeBI-Version", "1.6.0.3" } + , { "Cache-Control", "public, max-age=2592000" } + , { "Server", "gws" } + , { "Content-Length", "219 " } + } + ,.body= "\n" + "301 Moved\n" + "

301 Moved

\n" + "The document has moved\n" + "here.\r\n" + "\r\n" + } + +#define NO_CONTENT_LENGTH_RESPONSE 1 +/* The client should wait for the server's EOF. That is, when content-length + * is not specified, and "Connection: close", the end of body is specified + * by the EOF. + * Compare with APACHEBENCH_GET + */ +, {.name= "no content-length response" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 200 OK\r\n" + "Date: Tue, 04 Aug 2009 07:59:32 GMT\r\n" + "Server: Apache\r\n" + "X-Powered-By: Servlet/2.5 JSP/2.1\r\n" + "Content-Type: text/xml; charset=utf-8\r\n" + "Connection: close\r\n" + "\r\n" + "\n" + "\n" + " \n" + " \n" + " SOAP-ENV:Client\n" + " Client Error\n" + " \n" + " \n" + "" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= TRUE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 5 + ,.headers= + { { "Date", "Tue, 04 Aug 2009 07:59:32 GMT" } + , { "Server", "Apache" } + , { "X-Powered-By", "Servlet/2.5 JSP/2.1" } + , { "Content-Type", "text/xml; charset=utf-8" } + , { "Connection", "close" } + } + ,.body= "\n" + "\n" + " \n" + " \n" + " SOAP-ENV:Client\n" + " Client Error\n" + " \n" + " \n" + "" + } + +#define NO_HEADERS_NO_BODY_404 2 +, {.name= "404 no headers no body" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 404 Not Found\r\n\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= TRUE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 404 + ,.response_status= "Not Found" + ,.num_headers= 0 + ,.headers= {} + ,.body_size= 0 + ,.body= "" + } + +#define NO_REASON_PHRASE 3 +, {.name= "301 no response phrase" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 301\r\n\r\n" + ,.should_keep_alive = FALSE + ,.message_complete_on_eof= TRUE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 301 + ,.response_status= "" + ,.num_headers= 0 + ,.headers= {} + ,.body= "" + } + +#define TRAILING_SPACE_ON_CHUNKED_BODY 4 +, {.name="200 trailing space on chunked body" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 200 OK\r\n" + "Content-Type: text/plain\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n" + "25 \r\n" + "This is the data in the first chunk\r\n" + "\r\n" + "1C\r\n" + "and this is the second one\r\n" + "\r\n" + "0 \r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 2 + ,.headers= + { {"Content-Type", "text/plain" } + , {"Transfer-Encoding", "chunked" } + } + ,.body_size = 37+28 + ,.body = + "This is the data in the first chunk\r\n" + "and this is the second one\r\n" + ,.num_chunks_complete= 3 + ,.chunk_lengths= { 0x25, 0x1c } + } + +#define NO_CARRIAGE_RET 5 +, {.name="no carriage ret" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 200 OK\n" + "Content-Type: text/html; charset=utf-8\n" + "Connection: close\n" + "\n" + "these headers are from http://news.ycombinator.com/" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= TRUE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 2 + ,.headers= + { {"Content-Type", "text/html; charset=utf-8" } + , {"Connection", "close" } + } + ,.body= "these headers are from http://news.ycombinator.com/" + } + +#define PROXY_CONNECTION 6 +, {.name="proxy connection" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 200 OK\r\n" + "Content-Type: text/html; charset=UTF-8\r\n" + "Content-Length: 11\r\n" + "Proxy-Connection: close\r\n" + "Date: Thu, 31 Dec 2009 20:55:48 +0000\r\n" + "\r\n" + "hello world" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 4 + ,.headers= + { {"Content-Type", "text/html; charset=UTF-8" } + , {"Content-Length", "11" } + , {"Proxy-Connection", "close" } + , {"Date", "Thu, 31 Dec 2009 20:55:48 +0000"} + } + ,.body= "hello world" + } + +#define UNDERSTORE_HEADER_KEY 7 + // shown by + // curl -o /dev/null -v "http://ad.doubleclick.net/pfadx/DARTSHELLCONFIGXML;dcmt=text/xml;" +, {.name="underscore header key" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 200 OK\r\n" + "Server: DCLK-AdSvr\r\n" + "Content-Type: text/xml\r\n" + "Content-Length: 0\r\n" + "DCLK_imp: v7;x;114750856;0-0;0;17820020;0/0;21603567/21621457/1;;~okv=;dcmt=text/xml;;~cs=o\r\n\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 4 + ,.headers= + { {"Server", "DCLK-AdSvr" } + , {"Content-Type", "text/xml" } + , {"Content-Length", "0" } + , {"DCLK_imp", "v7;x;114750856;0-0;0;17820020;0/0;21603567/21621457/1;;~okv=;dcmt=text/xml;;~cs=o" } + } + ,.body= "" + } + +#define BONJOUR_MADAME_FR 8 +/* The client should not merge two headers fields when the first one doesn't + * have a value. + */ +, {.name= "bonjourmadame.fr" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.0 301 Moved Permanently\r\n" + "Date: Thu, 03 Jun 2010 09:56:32 GMT\r\n" + "Server: Apache/2.2.3 (Red Hat)\r\n" + "Cache-Control: public\r\n" + "Pragma: \r\n" + "Location: http://www.bonjourmadame.fr/\r\n" + "Vary: Accept-Encoding\r\n" + "Content-Length: 0\r\n" + "Content-Type: text/html; charset=UTF-8\r\n" + "Connection: keep-alive\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 0 + ,.status_code= 301 + ,.response_status= "Moved Permanently" + ,.num_headers= 9 + ,.headers= + { { "Date", "Thu, 03 Jun 2010 09:56:32 GMT" } + , { "Server", "Apache/2.2.3 (Red Hat)" } + , { "Cache-Control", "public" } + , { "Pragma", "" } + , { "Location", "http://www.bonjourmadame.fr/" } + , { "Vary", "Accept-Encoding" } + , { "Content-Length", "0" } + , { "Content-Type", "text/html; charset=UTF-8" } + , { "Connection", "keep-alive" } + } + ,.body= "" + } + +#define RES_FIELD_UNDERSCORE 9 +/* Should handle spaces in header fields */ +, {.name= "field underscore" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 200 OK\r\n" + "Date: Tue, 28 Sep 2010 01:14:13 GMT\r\n" + "Server: Apache\r\n" + "Cache-Control: no-cache, must-revalidate\r\n" + "Expires: Mon, 26 Jul 1997 05:00:00 GMT\r\n" + ".et-Cookie: PlaxoCS=1274804622353690521; path=/; domain=.plaxo.com\r\n" + "Vary: Accept-Encoding\r\n" + "_eep-Alive: timeout=45\r\n" /* semantic value ignored */ + "_onnection: Keep-Alive\r\n" /* semantic value ignored */ + "Transfer-Encoding: chunked\r\n" + "Content-Type: text/html\r\n" + "Connection: close\r\n" + "\r\n" + "0\r\n\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 11 + ,.headers= + { { "Date", "Tue, 28 Sep 2010 01:14:13 GMT" } + , { "Server", "Apache" } + , { "Cache-Control", "no-cache, must-revalidate" } + , { "Expires", "Mon, 26 Jul 1997 05:00:00 GMT" } + , { ".et-Cookie", "PlaxoCS=1274804622353690521; path=/; domain=.plaxo.com" } + , { "Vary", "Accept-Encoding" } + , { "_eep-Alive", "timeout=45" } + , { "_onnection", "Keep-Alive" } + , { "Transfer-Encoding", "chunked" } + , { "Content-Type", "text/html" } + , { "Connection", "close" } + } + ,.body= "" + ,.num_chunks_complete= 1 + ,.chunk_lengths= {} + } + +#define NON_ASCII_IN_STATUS_LINE 10 +/* Should handle non-ASCII in status line */ +, {.name= "non-ASCII in status line" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 500 Oriëntatieprobleem\r\n" + "Date: Fri, 5 Nov 2010 23:07:12 GMT+2\r\n" + "Content-Length: 0\r\n" + "Connection: close\r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 500 + ,.response_status= "Oriëntatieprobleem" + ,.num_headers= 3 + ,.headers= + { { "Date", "Fri, 5 Nov 2010 23:07:12 GMT+2" } + , { "Content-Length", "0" } + , { "Connection", "close" } + } + ,.body= "" + } + +#define HTTP_VERSION_0_9 11 +/* Should handle HTTP/0.9 */ +, {.name= "http version 0.9" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/0.9 200 OK\r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= TRUE + ,.http_major= 0 + ,.http_minor= 9 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 0 + ,.headers= + {} + ,.body= "" + } + +#define NO_CONTENT_LENGTH_NO_TRANSFER_ENCODING_RESPONSE 12 +/* The client should wait for the server's EOF. That is, when neither + * content-length nor transfer-encoding is specified, the end of body + * is specified by the EOF. + */ +, {.name= "neither content-length nor transfer-encoding response" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 200 OK\r\n" + "Content-Type: text/plain\r\n" + "\r\n" + "hello world" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= TRUE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 1 + ,.headers= + { { "Content-Type", "text/plain" } + } + ,.body= "hello world" + } + +#define NO_BODY_HTTP10_KA_200 13 +, {.name= "HTTP/1.0 with keep-alive and EOF-terminated 200 status" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.0 200 OK\r\n" + "Connection: keep-alive\r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= TRUE + ,.http_major= 1 + ,.http_minor= 0 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 1 + ,.headers= + { { "Connection", "keep-alive" } + } + ,.body_size= 0 + ,.body= "" + } + +#define NO_BODY_HTTP10_KA_204 14 +, {.name= "HTTP/1.0 with keep-alive and a 204 status" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.0 204 No content\r\n" + "Connection: keep-alive\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 0 + ,.status_code= 204 + ,.response_status= "No content" + ,.num_headers= 1 + ,.headers= + { { "Connection", "keep-alive" } + } + ,.body_size= 0 + ,.body= "" + } + +#define NO_BODY_HTTP11_KA_200 15 +, {.name= "HTTP/1.1 with an EOF-terminated 200 status" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 200 OK\r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= TRUE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 0 + ,.headers={} + ,.body_size= 0 + ,.body= "" + } + +#define NO_BODY_HTTP11_KA_204 16 +, {.name= "HTTP/1.1 with a 204 status" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 204 No content\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 204 + ,.response_status= "No content" + ,.num_headers= 0 + ,.headers={} + ,.body_size= 0 + ,.body= "" + } + +#define NO_BODY_HTTP11_NOKA_204 17 +, {.name= "HTTP/1.1 with a 204 status and keep-alive disabled" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 204 No content\r\n" + "Connection: close\r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 204 + ,.response_status= "No content" + ,.num_headers= 1 + ,.headers= + { { "Connection", "close" } + } + ,.body_size= 0 + ,.body= "" + } + +#define NO_BODY_HTTP11_KA_CHUNKED_200 18 +, {.name= "HTTP/1.1 with chunked endocing and a 200 response" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 200 OK\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n" + "0\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 1 + ,.headers= + { { "Transfer-Encoding", "chunked" } + } + ,.body_size= 0 + ,.body= "" + ,.num_chunks_complete= 1 + } + +#if !HTTP_PARSER_STRICT +#define SPACE_IN_FIELD_RES 19 +/* Should handle spaces in header fields */ +, {.name= "field space" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 200 OK\r\n" + "Server: Microsoft-IIS/6.0\r\n" + "X-Powered-By: ASP.NET\r\n" + "en-US Content-Type: text/xml\r\n" /* this is the problem */ + "Content-Type: text/xml\r\n" + "Content-Length: 16\r\n" + "Date: Fri, 23 Jul 2010 18:45:38 GMT\r\n" + "Connection: keep-alive\r\n" + "\r\n" + "hello" /* fake body */ + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 7 + ,.headers= + { { "Server", "Microsoft-IIS/6.0" } + , { "X-Powered-By", "ASP.NET" } + , { "en-US Content-Type", "text/xml" } + , { "Content-Type", "text/xml" } + , { "Content-Length", "16" } + , { "Date", "Fri, 23 Jul 2010 18:45:38 GMT" } + , { "Connection", "keep-alive" } + } + ,.body= "hello" + } +#endif /* !HTTP_PARSER_STRICT */ + +#define AMAZON_COM 20 +, {.name= "amazon.com" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 301 MovedPermanently\r\n" + "Date: Wed, 15 May 2013 17:06:33 GMT\r\n" + "Server: Server\r\n" + "x-amz-id-1: 0GPHKXSJQ826RK7GZEB2\r\n" + "p3p: policyref=\"http://www.amazon.com/w3c/p3p.xml\",CP=\"CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC \"\r\n" + "x-amz-id-2: STN69VZxIFSz9YJLbz1GDbxpbjG6Qjmmq5E3DxRhOUw+Et0p4hr7c/Q8qNcx4oAD\r\n" + "Location: http://www.amazon.com/Dan-Brown/e/B000AP9DSU/ref=s9_pop_gw_al1?_encoding=UTF8&refinementId=618073011&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0SHYY5BZXN3KR20BNFAY&pf_rd_t=101&pf_rd_p=1263340922&pf_rd_i=507846\r\n" + "Vary: Accept-Encoding,User-Agent\r\n" + "Content-Type: text/html; charset=ISO-8859-1\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n" + "1\r\n" + "\n\r\n" + "0\r\n" + "\r\n" + ,.should_keep_alive= TRUE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 301 + ,.response_status= "MovedPermanently" + ,.num_headers= 9 + ,.headers= { { "Date", "Wed, 15 May 2013 17:06:33 GMT" } + , { "Server", "Server" } + , { "x-amz-id-1", "0GPHKXSJQ826RK7GZEB2" } + , { "p3p", "policyref=\"http://www.amazon.com/w3c/p3p.xml\",CP=\"CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC \"" } + , { "x-amz-id-2", "STN69VZxIFSz9YJLbz1GDbxpbjG6Qjmmq5E3DxRhOUw+Et0p4hr7c/Q8qNcx4oAD" } + , { "Location", "http://www.amazon.com/Dan-Brown/e/B000AP9DSU/ref=s9_pop_gw_al1?_encoding=UTF8&refinementId=618073011&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0SHYY5BZXN3KR20BNFAY&pf_rd_t=101&pf_rd_p=1263340922&pf_rd_i=507846" } + , { "Vary", "Accept-Encoding,User-Agent" } + , { "Content-Type", "text/html; charset=ISO-8859-1" } + , { "Transfer-Encoding", "chunked" } + } + ,.body= "\n" + ,.num_chunks_complete= 2 + ,.chunk_lengths= { 1 } + } + +#define EMPTY_REASON_PHRASE_AFTER_SPACE 20 +, {.name= "empty reason phrase after space" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/1.1 200 \r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= TRUE + ,.http_major= 1 + ,.http_minor= 1 + ,.status_code= 200 + ,.response_status= "" + ,.num_headers= 0 + ,.headers= {} + ,.body= "" + } + +, {.name= NULL } /* sentinel */ +}; + +/* strnlen() is a POSIX.2008 addition. Can't rely on it being available so + * define it ourselves. + */ +size_t +strnlen(const char *s, size_t maxlen) +{ + const char *p; + + p = memchr(s, '\0', maxlen); + if (p == NULL) + return maxlen; + + return p - s; +} + +size_t +strlncat(char *dst, size_t len, const char *src, size_t n) +{ + size_t slen; + size_t dlen; + size_t rlen; + size_t ncpy; + + slen = strnlen(src, n); + dlen = strnlen(dst, len); + + if (dlen < len) { + rlen = len - dlen; + ncpy = slen < rlen ? slen : (rlen - 1); + memcpy(dst + dlen, src, ncpy); + dst[dlen + ncpy] = '\0'; + } + + assert(len > slen + dlen); + return slen + dlen; +} + +size_t +strlcat(char *dst, const char *src, size_t len) +{ + return strlncat(dst, len, src, (size_t) -1); +} + +size_t +strlncpy(char *dst, size_t len, const char *src, size_t n) +{ + size_t slen; + size_t ncpy; + + slen = strnlen(src, n); + + if (len > 0) { + ncpy = slen < len ? slen : (len - 1); + memcpy(dst, src, ncpy); + dst[ncpy] = '\0'; + } + + assert(len > slen); + return slen; +} + +size_t +strlcpy(char *dst, const char *src, size_t len) +{ + return strlncpy(dst, len, src, (size_t) -1); +} + +int +request_url_cb (http_parser *p, const char *buf, size_t len) +{ + assert(p == parser); + strlncat(messages[num_messages].request_url, + sizeof(messages[num_messages].request_url), + buf, + len); + return 0; +} + +int +header_field_cb (http_parser *p, const char *buf, size_t len) +{ + assert(p == parser); + struct message *m = &messages[num_messages]; + + if (m->last_header_element != FIELD) + m->num_headers++; + + strlncat(m->headers[m->num_headers-1][0], + sizeof(m->headers[m->num_headers-1][0]), + buf, + len); + + m->last_header_element = FIELD; + + return 0; +} + +int +header_value_cb (http_parser *p, const char *buf, size_t len) +{ + assert(p == parser); + struct message *m = &messages[num_messages]; + + strlncat(m->headers[m->num_headers-1][1], + sizeof(m->headers[m->num_headers-1][1]), + buf, + len); + + m->last_header_element = VALUE; + + return 0; +} + +void +check_body_is_final (const http_parser *p) +{ + if (messages[num_messages].body_is_final) { + fprintf(stderr, "\n\n *** Error http_body_is_final() should return 1 " + "on last on_body callback call " + "but it doesn't! ***\n\n"); + assert(0); + abort(); + } + messages[num_messages].body_is_final = http_body_is_final(p); +} + +int +body_cb (http_parser *p, const char *buf, size_t len) +{ + assert(p == parser); + strlncat(messages[num_messages].body, + sizeof(messages[num_messages].body), + buf, + len); + messages[num_messages].body_size += len; + check_body_is_final(p); + // printf("body_cb: '%s'\n", requests[num_messages].body); + return 0; +} + +int +count_body_cb (http_parser *p, const char *buf, size_t len) +{ + assert(p == parser); + assert(buf); + messages[num_messages].body_size += len; + check_body_is_final(p); + return 0; +} + +int +message_begin_cb (http_parser *p) +{ + assert(p == parser); + messages[num_messages].message_begin_cb_called = TRUE; + return 0; +} + +int +headers_complete_cb (http_parser *p) +{ + assert(p == parser); + messages[num_messages].method = parser->method; + messages[num_messages].status_code = parser->status_code; + messages[num_messages].http_major = parser->http_major; + messages[num_messages].http_minor = parser->http_minor; + messages[num_messages].headers_complete_cb_called = TRUE; + messages[num_messages].should_keep_alive = http_should_keep_alive(parser); + return 0; +} + +int +message_complete_cb (http_parser *p) +{ + assert(p == parser); + if (messages[num_messages].should_keep_alive != http_should_keep_alive(parser)) + { + fprintf(stderr, "\n\n *** Error http_should_keep_alive() should have same " + "value in both on_message_complete and on_headers_complete " + "but it doesn't! ***\n\n"); + assert(0); + abort(); + } + + if (messages[num_messages].body_size && + http_body_is_final(p) && + !messages[num_messages].body_is_final) + { + fprintf(stderr, "\n\n *** Error http_body_is_final() should return 1 " + "on last on_body callback call " + "but it doesn't! ***\n\n"); + assert(0); + abort(); + } + + messages[num_messages].message_complete_cb_called = TRUE; + + messages[num_messages].message_complete_on_eof = currently_parsing_eof; + + num_messages++; + return 0; +} + +int +response_status_cb (http_parser *p, const char *buf, size_t len) +{ + assert(p == parser); + strlncat(messages[num_messages].response_status, + sizeof(messages[num_messages].response_status), + buf, + len); + return 0; +} + +int +chunk_header_cb (http_parser *p) +{ + assert(p == parser); + int chunk_idx = messages[num_messages].num_chunks; + messages[num_messages].num_chunks++; + if (chunk_idx < MAX_CHUNKS) { + messages[num_messages].chunk_lengths[chunk_idx] = p->content_length; + } + + return 0; +} + +int +chunk_complete_cb (http_parser *p) +{ + assert(p == parser); + + /* Here we want to verify that each chunk_header_cb is matched by a + * chunk_complete_cb, so not only should the total number of calls to + * both callbacks be the same, but they also should be interleaved + * properly */ + assert(messages[num_messages].num_chunks == + messages[num_messages].num_chunks_complete + 1); + + messages[num_messages].num_chunks_complete++; + return 0; +} + +/* These dontcall_* callbacks exist so that we can verify that when we're + * paused, no additional callbacks are invoked */ +int +dontcall_message_begin_cb (http_parser *p) +{ + if (p) { } // gcc + fprintf(stderr, "\n\n*** on_message_begin() called on paused parser ***\n\n"); + abort(); +} + +int +dontcall_header_field_cb (http_parser *p, const char *buf, size_t len) +{ + if (p || buf || len) { } // gcc + fprintf(stderr, "\n\n*** on_header_field() called on paused parser ***\n\n"); + abort(); +} + +int +dontcall_header_value_cb (http_parser *p, const char *buf, size_t len) +{ + if (p || buf || len) { } // gcc + fprintf(stderr, "\n\n*** on_header_value() called on paused parser ***\n\n"); + abort(); +} + +int +dontcall_request_url_cb (http_parser *p, const char *buf, size_t len) +{ + if (p || buf || len) { } // gcc + fprintf(stderr, "\n\n*** on_request_url() called on paused parser ***\n\n"); + abort(); +} + +int +dontcall_body_cb (http_parser *p, const char *buf, size_t len) +{ + if (p || buf || len) { } // gcc + fprintf(stderr, "\n\n*** on_body_cb() called on paused parser ***\n\n"); + abort(); +} + +int +dontcall_headers_complete_cb (http_parser *p) +{ + if (p) { } // gcc + fprintf(stderr, "\n\n*** on_headers_complete() called on paused " + "parser ***\n\n"); + abort(); +} + +int +dontcall_message_complete_cb (http_parser *p) +{ + if (p) { } // gcc + fprintf(stderr, "\n\n*** on_message_complete() called on paused " + "parser ***\n\n"); + abort(); +} + +int +dontcall_response_status_cb (http_parser *p, const char *buf, size_t len) +{ + if (p || buf || len) { } // gcc + fprintf(stderr, "\n\n*** on_status() called on paused parser ***\n\n"); + abort(); +} + +int +dontcall_chunk_header_cb (http_parser *p) +{ + if (p) { } // gcc + fprintf(stderr, "\n\n*** on_chunk_header() called on paused parser ***\n\n"); + exit(1); +} + +int +dontcall_chunk_complete_cb (http_parser *p) +{ + if (p) { } // gcc + fprintf(stderr, "\n\n*** on_chunk_complete() " + "called on paused parser ***\n\n"); + exit(1); +} + +static http_parser_settings settings_dontcall = + {.on_message_begin = dontcall_message_begin_cb + ,.on_header_field = dontcall_header_field_cb + ,.on_header_value = dontcall_header_value_cb + ,.on_url = dontcall_request_url_cb + ,.on_status = dontcall_response_status_cb + ,.on_body = dontcall_body_cb + ,.on_headers_complete = dontcall_headers_complete_cb + ,.on_message_complete = dontcall_message_complete_cb + ,.on_chunk_header = dontcall_chunk_header_cb + ,.on_chunk_complete = dontcall_chunk_complete_cb + }; + +/* These pause_* callbacks always pause the parser and just invoke the regular + * callback that tracks content. Before returning, we overwrite the parser + * settings to point to the _dontcall variety so that we can verify that + * the pause actually did, you know, pause. */ +int +pause_message_begin_cb (http_parser *p) +{ + http_parser_pause(p, 1); + *current_pause_parser = settings_dontcall; + return message_begin_cb(p); +} + +int +pause_header_field_cb (http_parser *p, const char *buf, size_t len) +{ + http_parser_pause(p, 1); + *current_pause_parser = settings_dontcall; + return header_field_cb(p, buf, len); +} + +int +pause_header_value_cb (http_parser *p, const char *buf, size_t len) +{ + http_parser_pause(p, 1); + *current_pause_parser = settings_dontcall; + return header_value_cb(p, buf, len); +} + +int +pause_request_url_cb (http_parser *p, const char *buf, size_t len) +{ + http_parser_pause(p, 1); + *current_pause_parser = settings_dontcall; + return request_url_cb(p, buf, len); +} + +int +pause_body_cb (http_parser *p, const char *buf, size_t len) +{ + http_parser_pause(p, 1); + *current_pause_parser = settings_dontcall; + return body_cb(p, buf, len); +} + +int +pause_headers_complete_cb (http_parser *p) +{ + http_parser_pause(p, 1); + *current_pause_parser = settings_dontcall; + return headers_complete_cb(p); +} + +int +pause_message_complete_cb (http_parser *p) +{ + http_parser_pause(p, 1); + *current_pause_parser = settings_dontcall; + return message_complete_cb(p); +} + +int +pause_response_status_cb (http_parser *p, const char *buf, size_t len) +{ + http_parser_pause(p, 1); + *current_pause_parser = settings_dontcall; + return response_status_cb(p, buf, len); +} + +int +pause_chunk_header_cb (http_parser *p) +{ + http_parser_pause(p, 1); + *current_pause_parser = settings_dontcall; + return chunk_header_cb(p); +} + +int +pause_chunk_complete_cb (http_parser *p) +{ + http_parser_pause(p, 1); + *current_pause_parser = settings_dontcall; + return chunk_complete_cb(p); +} + +static http_parser_settings settings_pause = + {.on_message_begin = pause_message_begin_cb + ,.on_header_field = pause_header_field_cb + ,.on_header_value = pause_header_value_cb + ,.on_url = pause_request_url_cb + ,.on_status = pause_response_status_cb + ,.on_body = pause_body_cb + ,.on_headers_complete = pause_headers_complete_cb + ,.on_message_complete = pause_message_complete_cb + ,.on_chunk_header = pause_chunk_header_cb + ,.on_chunk_complete = pause_chunk_complete_cb + }; + +static http_parser_settings settings = + {.on_message_begin = message_begin_cb + ,.on_header_field = header_field_cb + ,.on_header_value = header_value_cb + ,.on_url = request_url_cb + ,.on_status = response_status_cb + ,.on_body = body_cb + ,.on_headers_complete = headers_complete_cb + ,.on_message_complete = message_complete_cb + ,.on_chunk_header = chunk_header_cb + ,.on_chunk_complete = chunk_complete_cb + }; + +static http_parser_settings settings_count_body = + {.on_message_begin = message_begin_cb + ,.on_header_field = header_field_cb + ,.on_header_value = header_value_cb + ,.on_url = request_url_cb + ,.on_status = response_status_cb + ,.on_body = count_body_cb + ,.on_headers_complete = headers_complete_cb + ,.on_message_complete = message_complete_cb + ,.on_chunk_header = chunk_header_cb + ,.on_chunk_complete = chunk_complete_cb + }; + +static http_parser_settings settings_null = + {.on_message_begin = 0 + ,.on_header_field = 0 + ,.on_header_value = 0 + ,.on_url = 0 + ,.on_status = 0 + ,.on_body = 0 + ,.on_headers_complete = 0 + ,.on_message_complete = 0 + ,.on_chunk_header = 0 + ,.on_chunk_complete = 0 + }; + +void +parser_init (enum http_parser_type type) +{ + num_messages = 0; + + assert(parser == NULL); + + parser = malloc(sizeof(http_parser)); + + http_parser_init(parser, type); + + memset(&messages, 0, sizeof messages); + +} + +void +parser_free () +{ + assert(parser); + free(parser); + parser = NULL; +} + +size_t parse (const char *buf, size_t len) +{ + size_t nparsed; + currently_parsing_eof = (len == 0); + nparsed = http_parser_execute(parser, &settings, buf, len); + return nparsed; +} + +size_t parse_count_body (const char *buf, size_t len) +{ + size_t nparsed; + currently_parsing_eof = (len == 0); + nparsed = http_parser_execute(parser, &settings_count_body, buf, len); + return nparsed; +} + +size_t parse_pause (const char *buf, size_t len) +{ + size_t nparsed; + http_parser_settings s = settings_pause; + + currently_parsing_eof = (len == 0); + current_pause_parser = &s; + nparsed = http_parser_execute(parser, current_pause_parser, buf, len); + return nparsed; +} + +static inline int +check_str_eq (const struct message *m, + const char *prop, + const char *expected, + const char *found) { + if ((expected == NULL) != (found == NULL)) { + printf("\n*** Error: %s in '%s' ***\n\n", prop, m->name); + printf("expected %s\n", (expected == NULL) ? "NULL" : expected); + printf(" found %s\n", (found == NULL) ? "NULL" : found); + return 0; + } + if (expected != NULL && 0 != strcmp(expected, found)) { + printf("\n*** Error: %s in '%s' ***\n\n", prop, m->name); + printf("expected '%s'\n", expected); + printf(" found '%s'\n", found); + return 0; + } + return 1; +} + +static inline int +check_num_eq (const struct message *m, + const char *prop, + int expected, + int found) { + if (expected != found) { + printf("\n*** Error: %s in '%s' ***\n\n", prop, m->name); + printf("expected %d\n", expected); + printf(" found %d\n", found); + return 0; + } + return 1; +} + +#define MESSAGE_CHECK_STR_EQ(expected, found, prop) \ + if (!check_str_eq(expected, #prop, expected->prop, found->prop)) return 0 + +#define MESSAGE_CHECK_NUM_EQ(expected, found, prop) \ + if (!check_num_eq(expected, #prop, expected->prop, found->prop)) return 0 + +#define MESSAGE_CHECK_URL_EQ(u, expected, found, prop, fn) \ +do { \ + char ubuf[256]; \ + \ + if ((u)->field_set & (1 << (fn))) { \ + memcpy(ubuf, (found)->request_url + (u)->field_data[(fn)].off, \ + (u)->field_data[(fn)].len); \ + ubuf[(u)->field_data[(fn)].len] = '\0'; \ + } else { \ + ubuf[0] = '\0'; \ + } \ + \ + check_str_eq(expected, #prop, expected->prop, ubuf); \ +} while(0) + +int +message_eq (int index, const struct message *expected) +{ + int i; + struct message *m = &messages[index]; + + MESSAGE_CHECK_NUM_EQ(expected, m, http_major); + MESSAGE_CHECK_NUM_EQ(expected, m, http_minor); + + if (expected->type == HTTP_REQUEST) { + MESSAGE_CHECK_NUM_EQ(expected, m, method); + } else { + MESSAGE_CHECK_NUM_EQ(expected, m, status_code); + MESSAGE_CHECK_STR_EQ(expected, m, response_status); + } + + MESSAGE_CHECK_NUM_EQ(expected, m, should_keep_alive); + MESSAGE_CHECK_NUM_EQ(expected, m, message_complete_on_eof); + + assert(m->message_begin_cb_called); + assert(m->headers_complete_cb_called); + assert(m->message_complete_cb_called); + + + MESSAGE_CHECK_STR_EQ(expected, m, request_url); + + /* Check URL components; we can't do this w/ CONNECT since it doesn't + * send us a well-formed URL. + */ + if (*m->request_url && m->method != HTTP_CONNECT) { + struct http_parser_url u; + + if (http_parser_parse_url(m->request_url, strlen(m->request_url), 0, &u)) { + fprintf(stderr, "\n\n*** failed to parse URL %s ***\n\n", + m->request_url); + abort(); + } + + if (expected->host) { + MESSAGE_CHECK_URL_EQ(&u, expected, m, host, UF_HOST); + } + + if (expected->userinfo) { + MESSAGE_CHECK_URL_EQ(&u, expected, m, userinfo, UF_USERINFO); + } + + m->port = (u.field_set & (1 << UF_PORT)) ? + u.port : 0; + + MESSAGE_CHECK_URL_EQ(&u, expected, m, query_string, UF_QUERY); + MESSAGE_CHECK_URL_EQ(&u, expected, m, fragment, UF_FRAGMENT); + MESSAGE_CHECK_URL_EQ(&u, expected, m, request_path, UF_PATH); + MESSAGE_CHECK_NUM_EQ(expected, m, port); + } + + if (expected->body_size) { + MESSAGE_CHECK_NUM_EQ(expected, m, body_size); + } else { + MESSAGE_CHECK_STR_EQ(expected, m, body); + } + + assert(m->num_chunks == m->num_chunks_complete); + MESSAGE_CHECK_NUM_EQ(expected, m, num_chunks_complete); + for (i = 0; i < m->num_chunks && i < MAX_CHUNKS; i++) { + MESSAGE_CHECK_NUM_EQ(expected, m, chunk_lengths[i]); + } + + MESSAGE_CHECK_NUM_EQ(expected, m, num_headers); + + int r; + for (i = 0; i < m->num_headers; i++) { + r = check_str_eq(expected, "header field", expected->headers[i][0], m->headers[i][0]); + if (!r) return 0; + r = check_str_eq(expected, "header value", expected->headers[i][1], m->headers[i][1]); + if (!r) return 0; + } + + MESSAGE_CHECK_STR_EQ(expected, m, upgrade); + + return 1; +} + +/* Given a sequence of varargs messages, return the number of them that the + * parser should successfully parse, taking into account that upgraded + * messages prevent all subsequent messages from being parsed. + */ +size_t +count_parsed_messages(const size_t nmsgs, ...) { + size_t i; + va_list ap; + + va_start(ap, nmsgs); + + for (i = 0; i < nmsgs; i++) { + struct message *m = va_arg(ap, struct message *); + + if (m->upgrade) { + va_end(ap); + return i + 1; + } + } + + va_end(ap); + return nmsgs; +} + +/* Given a sequence of bytes and the number of these that we were able to + * parse, verify that upgrade bodies are correct. + */ +void +upgrade_message_fix(char *body, const size_t nread, const size_t nmsgs, ...) { + va_list ap; + size_t i; + size_t off = 0; + + va_start(ap, nmsgs); + + for (i = 0; i < nmsgs; i++) { + struct message *m = va_arg(ap, struct message *); + + off += strlen(m->raw); + + if (m->upgrade) { + off -= strlen(m->upgrade); + + /* Check the portion of the response after its specified upgrade */ + if (!check_str_eq(m, "upgrade", body + off, body + nread)) { + abort(); + } + + /* Fix up the response so that message_eq() will verify the beginning + * of the upgrade */ + *(body + nread + strlen(m->upgrade)) = '\0'; + messages[num_messages -1 ].upgrade = body + nread; + + va_end(ap); + return; + } + } + + va_end(ap); + printf("\n\n*** Error: expected a message with upgrade ***\n"); + + abort(); +} + +static void +print_error (const char *raw, size_t error_location) +{ + fprintf(stderr, "\n*** %s ***\n\n", + http_errno_description(HTTP_PARSER_ERRNO(parser))); + + int this_line = 0, char_len = 0; + size_t i, j, len = strlen(raw), error_location_line = 0; + for (i = 0; i < len; i++) { + if (i == error_location) this_line = 1; + switch (raw[i]) { + case '\r': + char_len = 2; + fprintf(stderr, "\\r"); + break; + + case '\n': + fprintf(stderr, "\\n\n"); + + if (this_line) goto print; + + error_location_line = 0; + continue; + + default: + char_len = 1; + fputc(raw[i], stderr); + break; + } + if (!this_line) error_location_line += char_len; + } + + fprintf(stderr, "[eof]\n"); + + print: + for (j = 0; j < error_location_line; j++) { + fputc(' ', stderr); + } + fprintf(stderr, "^\n\nerror location: %u\n", (unsigned int)error_location); +} + +void +test_preserve_data (void) +{ + char my_data[] = "application-specific data"; + http_parser parser; + parser.data = my_data; + http_parser_init(&parser, HTTP_REQUEST); + if (parser.data != my_data) { + printf("\n*** parser.data not preserved accross http_parser_init ***\n\n"); + abort(); + } +} + +struct url_test { + const char *name; + const char *url; + int is_connect; + struct http_parser_url u; + int rv; +}; + +const struct url_test url_tests[] = +{ {.name="proxy request" + ,.url="http://hostname/" + ,.is_connect=0 + ,.u= + {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PATH) + ,.port=0 + ,.field_data= + {{ 0, 4 } /* UF_SCHEMA */ + ,{ 7, 8 } /* UF_HOST */ + ,{ 0, 0 } /* UF_PORT */ + ,{ 15, 1 } /* UF_PATH */ + ,{ 0, 0 } /* UF_QUERY */ + ,{ 0, 0 } /* UF_FRAGMENT */ + ,{ 0, 0 } /* UF_USERINFO */ + } + } + ,.rv=0 + } + +, {.name="proxy request with port" + ,.url="http://hostname:444/" + ,.is_connect=0 + ,.u= + {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PORT) | (1 << UF_PATH) + ,.port=444 + ,.field_data= + {{ 0, 4 } /* UF_SCHEMA */ + ,{ 7, 8 } /* UF_HOST */ + ,{ 16, 3 } /* UF_PORT */ + ,{ 19, 1 } /* UF_PATH */ + ,{ 0, 0 } /* UF_QUERY */ + ,{ 0, 0 } /* UF_FRAGMENT */ + ,{ 0, 0 } /* UF_USERINFO */ + } + } + ,.rv=0 + } + +, {.name="CONNECT request" + ,.url="hostname:443" + ,.is_connect=1 + ,.u= + {.field_set=(1 << UF_HOST) | (1 << UF_PORT) + ,.port=443 + ,.field_data= + {{ 0, 0 } /* UF_SCHEMA */ + ,{ 0, 8 } /* UF_HOST */ + ,{ 9, 3 } /* UF_PORT */ + ,{ 0, 0 } /* UF_PATH */ + ,{ 0, 0 } /* UF_QUERY */ + ,{ 0, 0 } /* UF_FRAGMENT */ + ,{ 0, 0 } /* UF_USERINFO */ + } + } + ,.rv=0 + } + +, {.name="CONNECT request but not connect" + ,.url="hostname:443" + ,.is_connect=0 + ,.rv=1 + } + +, {.name="proxy ipv6 request" + ,.url="http://[1:2::3:4]/" + ,.is_connect=0 + ,.u= + {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PATH) + ,.port=0 + ,.field_data= + {{ 0, 4 } /* UF_SCHEMA */ + ,{ 8, 8 } /* UF_HOST */ + ,{ 0, 0 } /* UF_PORT */ + ,{ 17, 1 } /* UF_PATH */ + ,{ 0, 0 } /* UF_QUERY */ + ,{ 0, 0 } /* UF_FRAGMENT */ + ,{ 0, 0 } /* UF_USERINFO */ + } + } + ,.rv=0 + } + +, {.name="proxy ipv6 request with port" + ,.url="http://[1:2::3:4]:67/" + ,.is_connect=0 + ,.u= + {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PORT) | (1 << UF_PATH) + ,.port=67 + ,.field_data= + {{ 0, 4 } /* UF_SCHEMA */ + ,{ 8, 8 } /* UF_HOST */ + ,{ 18, 2 } /* UF_PORT */ + ,{ 20, 1 } /* UF_PATH */ + ,{ 0, 0 } /* UF_QUERY */ + ,{ 0, 0 } /* UF_FRAGMENT */ + ,{ 0, 0 } /* UF_USERINFO */ + } + } + ,.rv=0 + } + +, {.name="CONNECT ipv6 address" + ,.url="[1:2::3:4]:443" + ,.is_connect=1 + ,.u= + {.field_set=(1 << UF_HOST) | (1 << UF_PORT) + ,.port=443 + ,.field_data= + {{ 0, 0 } /* UF_SCHEMA */ + ,{ 1, 8 } /* UF_HOST */ + ,{ 11, 3 } /* UF_PORT */ + ,{ 0, 0 } /* UF_PATH */ + ,{ 0, 0 } /* UF_QUERY */ + ,{ 0, 0 } /* UF_FRAGMENT */ + ,{ 0, 0 } /* UF_USERINFO */ + } + } + ,.rv=0 + } + +, {.name="ipv4 in ipv6 address" + ,.url="http://[2001:0000:0000:0000:0000:0000:1.9.1.1]/" + ,.is_connect=0 + ,.u= + {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PATH) + ,.port=0 + ,.field_data= + {{ 0, 4 } /* UF_SCHEMA */ + ,{ 8, 37 } /* UF_HOST */ + ,{ 0, 0 } /* UF_PORT */ + ,{ 46, 1 } /* UF_PATH */ + ,{ 0, 0 } /* UF_QUERY */ + ,{ 0, 0 } /* UF_FRAGMENT */ + ,{ 0, 0 } /* UF_USERINFO */ + } + } + ,.rv=0 + } + +, {.name="extra ? in query string" + ,.url="http://a.tbcdn.cn/p/fp/2010c/??fp-header-min.css,fp-base-min.css," + "fp-channel-min.css,fp-product-min.css,fp-mall-min.css,fp-category-min.css," + "fp-sub-min.css,fp-gdp4p-min.css,fp-css3-min.css,fp-misc-min.css?t=20101022.css" + ,.is_connect=0 + ,.u= + {.field_set=(1<field_set, u->port); + for (i = 0; i < UF_MAX; i++) { + if ((u->field_set & (1 << i)) == 0) { + printf("\tfield_data[%u]: unset\n", i); + continue; + } + + printf("\tfield_data[%u]: off: %u len: %u part: \"%.*s\n\"", + i, + u->field_data[i].off, + u->field_data[i].len, + u->field_data[i].len, + url + u->field_data[i].off); + } +} + +void +test_parse_url (void) +{ + struct http_parser_url u; + const struct url_test *test; + unsigned int i; + int rv; + + for (i = 0; i < (sizeof(url_tests) / sizeof(url_tests[0])); i++) { + test = &url_tests[i]; + memset(&u, 0, sizeof(u)); + + rv = http_parser_parse_url(test->url, + strlen(test->url), + test->is_connect, + &u); + + if (test->rv == 0) { + if (rv != 0) { + printf("\n*** http_parser_parse_url(\"%s\") \"%s\" test failed, " + "unexpected rv %d ***\n\n", test->url, test->name, rv); + abort(); + } + + if (memcmp(&u, &test->u, sizeof(u)) != 0) { + printf("\n*** http_parser_parse_url(\"%s\") \"%s\" failed ***\n", + test->url, test->name); + + printf("target http_parser_url:\n"); + dump_url(test->url, &test->u); + printf("result http_parser_url:\n"); + dump_url(test->url, &u); + + abort(); + } + } else { + /* test->rv != 0 */ + if (rv == 0) { + printf("\n*** http_parser_parse_url(\"%s\") \"%s\" test failed, " + "unexpected rv %d ***\n\n", test->url, test->name, rv); + abort(); + } + } + } +} + +void +test_method_str (void) +{ + assert(0 == strcmp("GET", http_method_str(HTTP_GET))); + assert(0 == strcmp("", http_method_str(1337))); +} + +void +test_message (const struct message *message) +{ + size_t raw_len = strlen(message->raw); + size_t msg1len; + for (msg1len = 0; msg1len < raw_len; msg1len++) { + parser_init(message->type); + + size_t read; + const char *msg1 = message->raw; + const char *msg2 = msg1 + msg1len; + size_t msg2len = raw_len - msg1len; + + if (msg1len) { + read = parse(msg1, msg1len); + + if (message->upgrade && parser->upgrade && num_messages > 0) { + messages[num_messages - 1].upgrade = msg1 + read; + goto test; + } + + if (read != msg1len) { + print_error(msg1, read); + abort(); + } + } + + + read = parse(msg2, msg2len); + + if (message->upgrade && parser->upgrade) { + messages[num_messages - 1].upgrade = msg2 + read; + goto test; + } + + if (read != msg2len) { + print_error(msg2, read); + abort(); + } + + read = parse(NULL, 0); + + if (read != 0) { + print_error(message->raw, read); + abort(); + } + + test: + + if (num_messages != 1) { + printf("\n*** num_messages != 1 after testing '%s' ***\n\n", message->name); + abort(); + } + + if(!message_eq(0, message)) abort(); + + parser_free(); + } +} + +void +test_message_count_body (const struct message *message) +{ + parser_init(message->type); + + size_t read; + size_t l = strlen(message->raw); + size_t i, toread; + size_t chunk = 4024; + + for (i = 0; i < l; i+= chunk) { + toread = MIN(l-i, chunk); + read = parse_count_body(message->raw + i, toread); + if (read != toread) { + print_error(message->raw, read); + abort(); + } + } + + + read = parse_count_body(NULL, 0); + if (read != 0) { + print_error(message->raw, read); + abort(); + } + + if (num_messages != 1) { + printf("\n*** num_messages != 1 after testing '%s' ***\n\n", message->name); + abort(); + } + + if(!message_eq(0, message)) abort(); + + parser_free(); +} + +void +test_simple (const char *buf, enum http_errno err_expected) +{ + parser_init(HTTP_REQUEST); + + enum http_errno err; + + parse(buf, strlen(buf)); + err = HTTP_PARSER_ERRNO(parser); + parse(NULL, 0); + + parser_free(); + + /* In strict mode, allow us to pass with an unexpected HPE_STRICT as + * long as the caller isn't expecting success. + */ +#if HTTP_PARSER_STRICT + if (err_expected != err && err_expected != HPE_OK && err != HPE_STRICT) { +#else + if (err_expected != err) { +#endif + fprintf(stderr, "\n*** test_simple expected %s, but saw %s ***\n\n%s\n", + http_errno_name(err_expected), http_errno_name(err), buf); + abort(); + } +} + +void +test_header_overflow_error (int req) +{ + http_parser parser; + http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE); + size_t parsed; + const char *buf; + buf = req ? "GET / HTTP/1.1\r\n" : "HTTP/1.0 200 OK\r\n"; + parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf)); + assert(parsed == strlen(buf)); + + buf = "header-key: header-value\r\n"; + size_t buflen = strlen(buf); + + int i; + for (i = 0; i < 10000; i++) { + parsed = http_parser_execute(&parser, &settings_null, buf, buflen); + if (parsed != buflen) { + //fprintf(stderr, "error found on iter %d\n", i); + assert(HTTP_PARSER_ERRNO(&parser) == HPE_HEADER_OVERFLOW); + return; + } + } + + fprintf(stderr, "\n*** Error expected but none in header overflow test ***\n"); + abort(); +} + + +void +test_header_nread_value () +{ + http_parser parser; + http_parser_init(&parser, HTTP_REQUEST); + size_t parsed; + const char *buf; + buf = "GET / HTTP/1.1\r\nheader: value\nhdr: value\r\n"; + parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf)); + assert(parsed == strlen(buf)); + + assert(parser.nread == strlen(buf)); +} + + +static void +test_content_length_overflow (const char *buf, size_t buflen, int expect_ok) +{ + http_parser parser; + http_parser_init(&parser, HTTP_RESPONSE); + http_parser_execute(&parser, &settings_null, buf, buflen); + + if (expect_ok) + assert(HTTP_PARSER_ERRNO(&parser) == HPE_OK); + else + assert(HTTP_PARSER_ERRNO(&parser) == HPE_INVALID_CONTENT_LENGTH); +} + +void +test_header_content_length_overflow_error (void) +{ +#define X(size) \ + "HTTP/1.1 200 OK\r\n" \ + "Content-Length: " #size "\r\n" \ + "\r\n" + const char a[] = X(1844674407370955160); /* 2^64 / 10 - 1 */ + const char b[] = X(18446744073709551615); /* 2^64-1 */ + const char c[] = X(18446744073709551616); /* 2^64 */ +#undef X + test_content_length_overflow(a, sizeof(a) - 1, 1); /* expect ok */ + test_content_length_overflow(b, sizeof(b) - 1, 0); /* expect failure */ + test_content_length_overflow(c, sizeof(c) - 1, 0); /* expect failure */ +} + +void +test_chunk_content_length_overflow_error (void) +{ +#define X(size) \ + "HTTP/1.1 200 OK\r\n" \ + "Transfer-Encoding: chunked\r\n" \ + "\r\n" \ + #size "\r\n" \ + "..." + const char a[] = X(FFFFFFFFFFFFFFE); /* 2^64 / 16 - 1 */ + const char b[] = X(FFFFFFFFFFFFFFFF); /* 2^64-1 */ + const char c[] = X(10000000000000000); /* 2^64 */ +#undef X + test_content_length_overflow(a, sizeof(a) - 1, 1); /* expect ok */ + test_content_length_overflow(b, sizeof(b) - 1, 0); /* expect failure */ + test_content_length_overflow(c, sizeof(c) - 1, 0); /* expect failure */ +} + +void +test_no_overflow_long_body (int req, size_t length) +{ + http_parser parser; + http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE); + size_t parsed; + size_t i; + char buf1[3000]; + size_t buf1len = sprintf(buf1, "%s\r\nConnection: Keep-Alive\r\nContent-Length: %lu\r\n\r\n", + req ? "POST / HTTP/1.0" : "HTTP/1.0 200 OK", (unsigned long)length); + parsed = http_parser_execute(&parser, &settings_null, buf1, buf1len); + if (parsed != buf1len) + goto err; + + for (i = 0; i < length; i++) { + char foo = 'a'; + parsed = http_parser_execute(&parser, &settings_null, &foo, 1); + if (parsed != 1) + goto err; + } + + parsed = http_parser_execute(&parser, &settings_null, buf1, buf1len); + if (parsed != buf1len) goto err; + return; + + err: + fprintf(stderr, + "\n*** error in test_no_overflow_long_body %s of length %lu ***\n", + req ? "REQUEST" : "RESPONSE", + (unsigned long)length); + abort(); +} + +void +test_multiple3 (const struct message *r1, const struct message *r2, const struct message *r3) +{ + int message_count = count_parsed_messages(3, r1, r2, r3); + + char total[ strlen(r1->raw) + + strlen(r2->raw) + + strlen(r3->raw) + + 1 + ]; + total[0] = '\0'; + + strcat(total, r1->raw); + strcat(total, r2->raw); + strcat(total, r3->raw); + + parser_init(r1->type); + + size_t read; + + read = parse(total, strlen(total)); + + if (parser->upgrade) { + upgrade_message_fix(total, read, 3, r1, r2, r3); + goto test; + } + + if (read != strlen(total)) { + print_error(total, read); + abort(); + } + + read = parse(NULL, 0); + + if (read != 0) { + print_error(total, read); + abort(); + } + +test: + + if (message_count != num_messages) { + fprintf(stderr, "\n\n*** Parser didn't see 3 messages only %d *** \n", num_messages); + abort(); + } + + if (!message_eq(0, r1)) abort(); + if (message_count > 1 && !message_eq(1, r2)) abort(); + if (message_count > 2 && !message_eq(2, r3)) abort(); + + parser_free(); +} + +/* SCAN through every possible breaking to make sure the + * parser can handle getting the content in any chunks that + * might come from the socket + */ +void +test_scan (const struct message *r1, const struct message *r2, const struct message *r3) +{ + char total[80*1024] = "\0"; + char buf1[80*1024] = "\0"; + char buf2[80*1024] = "\0"; + char buf3[80*1024] = "\0"; + + strcat(total, r1->raw); + strcat(total, r2->raw); + strcat(total, r3->raw); + + size_t read; + + int total_len = strlen(total); + + int total_ops = 2 * (total_len - 1) * (total_len - 2) / 2; + int ops = 0 ; + + size_t buf1_len, buf2_len, buf3_len; + int message_count = count_parsed_messages(3, r1, r2, r3); + + int i,j,type_both; + for (type_both = 0; type_both < 2; type_both ++ ) { + for (j = 2; j < total_len; j ++ ) { + for (i = 1; i < j; i ++ ) { + + if (ops % 1000 == 0) { + printf("\b\b\b\b%3.0f%%", 100 * (float)ops /(float)total_ops); + fflush(stdout); + } + ops += 1; + + parser_init(type_both ? HTTP_BOTH : r1->type); + + buf1_len = i; + strlncpy(buf1, sizeof(buf1), total, buf1_len); + buf1[buf1_len] = 0; + + buf2_len = j - i; + strlncpy(buf2, sizeof(buf1), total+i, buf2_len); + buf2[buf2_len] = 0; + + buf3_len = total_len - j; + strlncpy(buf3, sizeof(buf1), total+j, buf3_len); + buf3[buf3_len] = 0; + + read = parse(buf1, buf1_len); + + if (parser->upgrade) goto test; + + if (read != buf1_len) { + print_error(buf1, read); + goto error; + } + + read += parse(buf2, buf2_len); + + if (parser->upgrade) goto test; + + if (read != buf1_len + buf2_len) { + print_error(buf2, read); + goto error; + } + + read += parse(buf3, buf3_len); + + if (parser->upgrade) goto test; + + if (read != buf1_len + buf2_len + buf3_len) { + print_error(buf3, read); + goto error; + } + + parse(NULL, 0); + +test: + if (parser->upgrade) { + upgrade_message_fix(total, read, 3, r1, r2, r3); + } + + if (message_count != num_messages) { + fprintf(stderr, "\n\nParser didn't see %d messages only %d\n", + message_count, num_messages); + goto error; + } + + if (!message_eq(0, r1)) { + fprintf(stderr, "\n\nError matching messages[0] in test_scan.\n"); + goto error; + } + + if (message_count > 1 && !message_eq(1, r2)) { + fprintf(stderr, "\n\nError matching messages[1] in test_scan.\n"); + goto error; + } + + if (message_count > 2 && !message_eq(2, r3)) { + fprintf(stderr, "\n\nError matching messages[2] in test_scan.\n"); + goto error; + } + + parser_free(); + } + } + } + puts("\b\b\b\b100%"); + return; + + error: + fprintf(stderr, "i=%d j=%d\n", i, j); + fprintf(stderr, "buf1 (%u) %s\n\n", (unsigned int)buf1_len, buf1); + fprintf(stderr, "buf2 (%u) %s\n\n", (unsigned int)buf2_len , buf2); + fprintf(stderr, "buf3 (%u) %s\n", (unsigned int)buf3_len, buf3); + abort(); +} + +// user required to free the result +// string terminated by \0 +char * +create_large_chunked_message (int body_size_in_kb, const char* headers) +{ + int i; + size_t wrote = 0; + size_t headers_len = strlen(headers); + size_t bufsize = headers_len + (5+1024+2)*body_size_in_kb + 6; + char * buf = malloc(bufsize); + + memcpy(buf, headers, headers_len); + wrote += headers_len; + + for (i = 0; i < body_size_in_kb; i++) { + // write 1kb chunk into the body. + memcpy(buf + wrote, "400\r\n", 5); + wrote += 5; + memset(buf + wrote, 'C', 1024); + wrote += 1024; + strcpy(buf + wrote, "\r\n"); + wrote += 2; + } + + memcpy(buf + wrote, "0\r\n\r\n", 6); + wrote += 6; + assert(wrote == bufsize); + + return buf; +} + +/* Verify that we can pause parsing at any of the bytes in the + * message and still get the result that we're expecting. */ +void +test_message_pause (const struct message *msg) +{ + char *buf = (char*) msg->raw; + size_t buflen = strlen(msg->raw); + size_t nread; + + parser_init(msg->type); + + do { + nread = parse_pause(buf, buflen); + + // We can only set the upgrade buffer once we've gotten our message + // completion callback. + if (messages[0].message_complete_cb_called && + msg->upgrade && + parser->upgrade) { + messages[0].upgrade = buf + nread; + goto test; + } + + if (nread < buflen) { + + // Not much do to if we failed a strict-mode check + if (HTTP_PARSER_ERRNO(parser) == HPE_STRICT) { + parser_free(); + return; + } + + assert (HTTP_PARSER_ERRNO(parser) == HPE_PAUSED); + } + + buf += nread; + buflen -= nread; + http_parser_pause(parser, 0); + } while (buflen > 0); + + nread = parse_pause(NULL, 0); + assert (nread == 0); + +test: + if (num_messages != 1) { + printf("\n*** num_messages != 1 after testing '%s' ***\n\n", msg->name); + abort(); + } + + if(!message_eq(0, msg)) abort(); + + parser_free(); +} + +int +main (void) +{ + parser = NULL; + int i, j, k; + int request_count; + int response_count; + unsigned long version; + unsigned major; + unsigned minor; + unsigned patch; + + version = http_parser_version(); + major = (version >> 16) & 255; + minor = (version >> 8) & 255; + patch = version & 255; + printf("http_parser v%u.%u.%u (0x%06lx)\n", major, minor, patch, version); + + printf("sizeof(http_parser) = %u\n", (unsigned int)sizeof(http_parser)); + + for (request_count = 0; requests[request_count].name; request_count++); + for (response_count = 0; responses[response_count].name; response_count++); + + //// API + test_preserve_data(); + test_parse_url(); + test_method_str(); + + //// NREAD + test_header_nread_value(); + + //// OVERFLOW CONDITIONS + + test_header_overflow_error(HTTP_REQUEST); + test_no_overflow_long_body(HTTP_REQUEST, 1000); + test_no_overflow_long_body(HTTP_REQUEST, 100000); + + test_header_overflow_error(HTTP_RESPONSE); + test_no_overflow_long_body(HTTP_RESPONSE, 1000); + test_no_overflow_long_body(HTTP_RESPONSE, 100000); + + test_header_content_length_overflow_error(); + test_chunk_content_length_overflow_error(); + + //// RESPONSES + + for (i = 0; i < response_count; i++) { + test_message(&responses[i]); + } + + for (i = 0; i < response_count; i++) { + test_message_pause(&responses[i]); + } + + for (i = 0; i < response_count; i++) { + if (!responses[i].should_keep_alive) continue; + for (j = 0; j < response_count; j++) { + if (!responses[j].should_keep_alive) continue; + for (k = 0; k < response_count; k++) { + test_multiple3(&responses[i], &responses[j], &responses[k]); + } + } + } + + test_message_count_body(&responses[NO_HEADERS_NO_BODY_404]); + test_message_count_body(&responses[TRAILING_SPACE_ON_CHUNKED_BODY]); + + // test very large chunked response + { + char * msg = create_large_chunked_message(31337, + "HTTP/1.0 200 OK\r\n" + "Transfer-Encoding: chunked\r\n" + "Content-Type: text/plain\r\n" + "\r\n"); + struct message large_chunked = + {.name= "large chunked" + ,.type= HTTP_RESPONSE + ,.raw= msg + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= FALSE + ,.http_major= 1 + ,.http_minor= 0 + ,.status_code= 200 + ,.response_status= "OK" + ,.num_headers= 2 + ,.headers= + { { "Transfer-Encoding", "chunked" } + , { "Content-Type", "text/plain" } + } + ,.body_size= 31337*1024 + ,.num_chunks_complete= 31338 + }; + for (i = 0; i < MAX_CHUNKS; i++) { + large_chunked.chunk_lengths[i] = 1024; + } + test_message_count_body(&large_chunked); + free(msg); + } + + + + printf("response scan 1/2 "); + test_scan( &responses[TRAILING_SPACE_ON_CHUNKED_BODY] + , &responses[NO_BODY_HTTP10_KA_204] + , &responses[NO_REASON_PHRASE] + ); + + printf("response scan 2/2 "); + test_scan( &responses[BONJOUR_MADAME_FR] + , &responses[UNDERSTORE_HEADER_KEY] + , &responses[NO_CARRIAGE_RET] + ); + + puts("responses okay"); + + + /// REQUESTS + + test_simple("GET / HTP/1.1\r\n\r\n", HPE_INVALID_VERSION); + + // Well-formed but incomplete + test_simple("GET / HTTP/1.1\r\n" + "Content-Type: text/plain\r\n" + "Content-Length: 6\r\n" + "\r\n" + "fooba", + HPE_OK); + + static const char *all_methods[] = { + "DELETE", + "GET", + "HEAD", + "POST", + "PUT", + //"CONNECT", //CONNECT can't be tested like other methods, it's a tunnel + "OPTIONS", + "TRACE", + "COPY", + "LOCK", + "MKCOL", + "MOVE", + "PROPFIND", + "PROPPATCH", + "UNLOCK", + "REPORT", + "MKACTIVITY", + "CHECKOUT", + "MERGE", + "M-SEARCH", + "NOTIFY", + "SUBSCRIBE", + "UNSUBSCRIBE", + "PATCH", + 0 }; + const char **this_method; + for (this_method = all_methods; *this_method; this_method++) { + char buf[200]; + sprintf(buf, "%s / HTTP/1.1\r\n\r\n", *this_method); + test_simple(buf, HPE_OK); + } + + static const char *bad_methods[] = { + "ASDF", + "C******", + "COLA", + "GEM", + "GETA", + "M****", + "MKCOLA", + "PROPPATCHA", + "PUN", + "PX", + "SA", + "hello world", + 0 }; + for (this_method = bad_methods; *this_method; this_method++) { + char buf[200]; + sprintf(buf, "%s / HTTP/1.1\r\n\r\n", *this_method); + test_simple(buf, HPE_INVALID_METHOD); + } + + // illegal header field name line folding + test_simple("GET / HTTP/1.1\r\n" + "name\r\n" + " : value\r\n" + "\r\n", + HPE_INVALID_HEADER_TOKEN); + + const char *dumbfuck2 = + "GET / HTTP/1.1\r\n" + "X-SSL-Bullshit: -----BEGIN CERTIFICATE-----\r\n" + "\tMIIFbTCCBFWgAwIBAgICH4cwDQYJKoZIhvcNAQEFBQAwcDELMAkGA1UEBhMCVUsx\r\n" + "\tETAPBgNVBAoTCGVTY2llbmNlMRIwEAYDVQQLEwlBdXRob3JpdHkxCzAJBgNVBAMT\r\n" + "\tAkNBMS0wKwYJKoZIhvcNAQkBFh5jYS1vcGVyYXRvckBncmlkLXN1cHBvcnQuYWMu\r\n" + "\tdWswHhcNMDYwNzI3MTQxMzI4WhcNMDcwNzI3MTQxMzI4WjBbMQswCQYDVQQGEwJV\r\n" + "\tSzERMA8GA1UEChMIZVNjaWVuY2UxEzARBgNVBAsTCk1hbmNoZXN0ZXIxCzAJBgNV\r\n" + "\tBAcTmrsogriqMWLAk1DMRcwFQYDVQQDEw5taWNoYWVsIHBhcmQYJKoZIhvcNAQEB\r\n" + "\tBQADggEPADCCAQoCggEBANPEQBgl1IaKdSS1TbhF3hEXSl72G9J+WC/1R64fAcEF\r\n" + "\tW51rEyFYiIeZGx/BVzwXbeBoNUK41OK65sxGuflMo5gLflbwJtHBRIEKAfVVp3YR\r\n" + "\tgW7cMA/s/XKgL1GEC7rQw8lIZT8RApukCGqOVHSi/F1SiFlPDxuDfmdiNzL31+sL\r\n" + "\t0iwHDdNkGjy5pyBSB8Y79dsSJtCW/iaLB0/n8Sj7HgvvZJ7x0fr+RQjYOUUfrePP\r\n" + "\tu2MSpFyf+9BbC/aXgaZuiCvSR+8Snv3xApQY+fULK/xY8h8Ua51iXoQ5jrgu2SqR\r\n" + "\twgA7BUi3G8LFzMBl8FRCDYGUDy7M6QaHXx1ZWIPWNKsCAwEAAaOCAiQwggIgMAwG\r\n" + "\tA1UdEwEB/wQCMAAwEQYJYIZIAYb4QgHTTPAQDAgWgMA4GA1UdDwEB/wQEAwID6DAs\r\n" + "\tBglghkgBhvhCAQ0EHxYdVUsgZS1TY2llbmNlIFVzZXIgQ2VydGlmaWNhdGUwHQYD\r\n" + "\tVR0OBBYEFDTt/sf9PeMaZDHkUIldrDYMNTBZMIGaBgNVHSMEgZIwgY+AFAI4qxGj\r\n" + "\tloCLDdMVKwiljjDastqooXSkcjBwMQswCQYDVQQGEwJVSzERMA8GA1UEChMIZVNj\r\n" + "\taWVuY2UxEjAQBgNVBAsTCUF1dGhvcml0eTELMAkGA1UEAxMCQ0ExLTArBgkqhkiG\r\n" + "\t9w0BCQEWHmNhLW9wZXJhdG9yQGdyaWQtc3VwcG9ydC5hYy51a4IBADApBgNVHRIE\r\n" + "\tIjAggR5jYS1vcGVyYXRvckBncmlkLXN1cHBvcnQuYWMudWswGQYDVR0gBBIwEDAO\r\n" + "\tBgwrBgEEAdkvAQEBAQYwPQYJYIZIAYb4QgEEBDAWLmh0dHA6Ly9jYS5ncmlkLXN1\r\n" + "\tcHBvcnQuYWMudmT4sopwqlBWsvcHViL2NybC9jYWNybC5jcmwwPQYJYIZIAYb4QgEDBDAWLmh0\r\n" + "\tdHA6Ly9jYS5ncmlkLXN1cHBvcnQuYWMudWsvcHViL2NybC9jYWNybC5jcmwwPwYD\r\n" + "\tVR0fBDgwNjA0oDKgMIYuaHR0cDovL2NhLmdyaWQt5hYy51ay9wdWIv\r\n" + "\tY3JsL2NhY3JsLmNybDANBgkqhkiG9w0BAQUFAAOCAQEAS/U4iiooBENGW/Hwmmd3\r\n" + "\tXCy6Zrt08YjKCzGNjorT98g8uGsqYjSxv/hmi0qlnlHs+k/3Iobc3LjS5AMYr5L8\r\n" + "\tUO7OSkgFFlLHQyC9JzPfmLCAugvzEbyv4Olnsr8hbxF1MbKZoQxUZtMVu29wjfXk\r\n" + "\thTeApBv7eaKCWpSp7MCbvgzm74izKhu3vlDk9w6qVrxePfGgpKPqfHiOoGhFnbTK\r\n" + "\twTC6o2xq5y0qZ03JonF7OJspEd3I5zKY3E+ov7/ZhW6DqT8UFvsAdjvQbXyhV8Eu\r\n" + "\tYhixw1aKEPzNjNowuIseVogKOLXxWI5vAi5HgXdS0/ES5gDGsABo4fqovUKlgop3\r\n" + "\tRA==\r\n" + "\t-----END CERTIFICATE-----\r\n" + "\r\n"; + test_simple(dumbfuck2, HPE_OK); + + const char *corrupted_connection = + "GET / HTTP/1.1\r\n" + "Host: www.example.com\r\n" + "Connection\r\033\065\325eep-Alive\r\n" + "Accept-Encoding: gzip\r\n" + "\r\n"; + test_simple(corrupted_connection, HPE_INVALID_HEADER_TOKEN); + + const char *corrupted_header_name = + "GET / HTTP/1.1\r\n" + "Host: www.example.com\r\n" + "X-Some-Header\r\033\065\325eep-Alive\r\n" + "Accept-Encoding: gzip\r\n" + "\r\n"; + test_simple(corrupted_header_name, HPE_INVALID_HEADER_TOKEN); + +#if 0 + // NOTE(Wed Nov 18 11:57:27 CET 2009) this seems okay. we just read body + // until EOF. + // + // no content-length + // error if there is a body without content length + const char *bad_get_no_headers_no_body = "GET /bad_get_no_headers_no_body/world HTTP/1.1\r\n" + "Accept: */*\r\n" + "\r\n" + "HELLO"; + test_simple(bad_get_no_headers_no_body, 0); +#endif + /* TODO sending junk and large headers gets rejected */ + + + /* check to make sure our predefined requests are okay */ + for (i = 0; requests[i].name; i++) { + test_message(&requests[i]); + } + + for (i = 0; i < request_count; i++) { + test_message_pause(&requests[i]); + } + + for (i = 0; i < request_count; i++) { + if (!requests[i].should_keep_alive) continue; + for (j = 0; j < request_count; j++) { + if (!requests[j].should_keep_alive) continue; + for (k = 0; k < request_count; k++) { + test_multiple3(&requests[i], &requests[j], &requests[k]); + } + } + } + + printf("request scan 1/4 "); + test_scan( &requests[GET_NO_HEADERS_NO_BODY] + , &requests[GET_ONE_HEADER_NO_BODY] + , &requests[GET_NO_HEADERS_NO_BODY] + ); + + printf("request scan 2/4 "); + test_scan( &requests[POST_CHUNKED_ALL_YOUR_BASE] + , &requests[POST_IDENTITY_BODY_WORLD] + , &requests[GET_FUNKY_CONTENT_LENGTH] + ); + + printf("request scan 3/4 "); + test_scan( &requests[TWO_CHUNKS_MULT_ZERO_END] + , &requests[CHUNKED_W_TRAILING_HEADERS] + , &requests[CHUNKED_W_BULLSHIT_AFTER_LENGTH] + ); + + printf("request scan 4/4 "); + test_scan( &requests[QUERY_URL_WITH_QUESTION_MARK_GET] + , &requests[PREFIX_NEWLINE_GET ] + , &requests[CONNECT_REQUEST] + ); + + puts("requests okay"); + + return 0; +} diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 87a325f0bf0..6ca53dc67e7 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -1090,3 +1090,22 @@ project "uv" "-Wshadow" } end + +-------------------------------------------------- +-- HTTP parser library objects +-------------------------------------------------- + +project "http-parser" + uuid "90c6ba59-bdb2-4fee-8b44-57601d690e14" + kind "StaticLib" + + configuration { } + + files { + MAME_DIR .. "3rdparty/http-parser/http_parser.c", + } + if (_OPTIONS["SHADOW_CHECK"]=="1") then + removebuildoptions { + "-Wshadow" + } + end -- cgit v1.2.3-70-g09d2 From f924d4bd4216f32de627ab42680e79b955275236 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 31 Jan 2016 15:38:51 +0100 Subject: link into main project and link deps (nw) --- scripts/genie.lua | 10 ++++++++++ scripts/src/main.lua | 2 ++ 2 files changed, 12 insertions(+) diff --git a/scripts/genie.lua b/scripts/genie.lua index 0e8ce5e63aa..7883eb6a0b4 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1084,6 +1084,11 @@ configuration { "mingw*" } "advapi32", "shlwapi", "wsock32", + "ws2_32", + "psapi", + "iphlpapi", + "shell32", + "userenv", } configuration { "mingw-clang" } linkoptions { @@ -1105,6 +1110,11 @@ configuration { "vs*" } "advapi32", "shlwapi", "wsock32", + "ws2_32", + "psapi", + "iphlpapi", + "shell32", + "userenv", } buildoptions { diff --git a/scripts/src/main.lua b/scripts/src/main.lua index da633c55212..9623a9d5236 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -129,6 +129,8 @@ end "7z", "lua", "lsqlite3", + "uv", + "http-parser", } if _OPTIONS["with-bundled-zlib"] then -- cgit v1.2.3-70-g09d2 From c147c4f953d299aa3e4c42a49fb1e6c86c99086a Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Sun, 31 Jan 2016 15:02:47 +0000 Subject: i8271: unload head after programmed revolutions --- src/devices/machine/i8271.cpp | 20 ++++++++++++++++++++ src/devices/machine/i8271.h | 1 + 2 files changed, 21 insertions(+) diff --git a/src/devices/machine/i8271.cpp b/src/devices/machine/i8271.cpp index cd8c0faf5bf..dfd098a5f82 100644 --- a/src/devices/machine/i8271.cpp +++ b/src/devices/machine/i8271.cpp @@ -88,6 +88,7 @@ void i8271_device::soft_reset() flopi[i].live = false; flopi[i].ready = get_ready(i); } + hdl_cb(false); set_irq(false); set_drq(false); command_pos = 0; @@ -887,6 +888,7 @@ void i8271_device::command_end(floppy_info &fi, bool data_completion) { logerror("%s: command done (%s) - %02x\n", tag(), data_completion ? "data" : "seek", rr); fi.main_state = fi.sub_state = IDLE; + idle_icnt = 0; main_phase = PHASE_RESULT; set_irq(true); } @@ -981,6 +983,7 @@ void i8271_device::seek_continue(floppy_info &fi) void i8271_device::read_data_start(floppy_info &fi) { fi.main_state = READ_DATA; + hdl_cb(true); fi.sub_state = HEAD_LOAD_DONE; logerror("%s: command read%s data%s cmd=%02x crn=(%d, %d, %d) len=%02x rate=%d\n", @@ -1010,6 +1013,7 @@ void i8271_device::read_data_start(floppy_info &fi) void i8271_device::scan_start(floppy_info &fi) { fi.main_state = SCAN_DATA; + hdl_cb(true); fi.sub_state = HEAD_LOAD_DONE; logerror("%s: command scan%s data%s cmd=%02x crn=(%d, %d, %d) len=%02x rate=%d\n", @@ -1041,6 +1045,7 @@ void i8271_device::scan_start(floppy_info &fi) void i8271_device::verify_data_start(floppy_info &fi) { fi.main_state = VERIFY_DATA; + hdl_cb(true); fi.sub_state = HEAD_LOAD_DONE; logerror("%s: command verify%s data%s cmd=%02x crn=(%d, %d, %d) len=%02x rate=%d\n", @@ -1098,6 +1103,7 @@ void i8271_device::read_data_continue(floppy_info &fi) return; case SEEK_WAIT_STEP_TIME_DONE: + hdl_cb(true); do { if(fi.pcn > command[1]) fi.pcn--; @@ -1181,7 +1187,9 @@ void i8271_device::read_data_continue(floppy_info &fi) void i8271_device::write_data_start(floppy_info &fi) { fi.main_state = WRITE_DATA; + hdl_cb(true); fi.sub_state = HEAD_LOAD_DONE; + logerror("%s: command write%s data%s cmd=%02x crn=(%d, %d, %d) len=%02x rate=%d\n", tag(), command[0] & 0x04 ? " deleted" : "", @@ -1238,6 +1246,7 @@ void i8271_device::write_data_continue(floppy_info &fi) return; case SEEK_WAIT_STEP_TIME_DONE: + hdl_cb(true); do { if(fi.pcn > command[1]) fi.pcn--; @@ -1311,6 +1320,7 @@ int i8271_device::calc_sector_size(UINT8 size) void i8271_device::format_track_start(floppy_info &fi) { fi.main_state = FORMAT_TRACK; + hdl_cb(true); fi.sub_state = HEAD_LOAD_DONE; logerror("%s: command format track c=%02x n=%02x sc=%02x gap3=%02x gap5=%02x gap1=%02x\n", @@ -1364,6 +1374,7 @@ void i8271_device::format_track_continue(floppy_info &fi) return; case SEEK_WAIT_STEP_TIME_DONE: + hdl_cb(true); do { if(fi.pcn > command[1]) fi.pcn--; @@ -1402,6 +1413,7 @@ void i8271_device::format_track_continue(floppy_info &fi) void i8271_device::read_id_start(floppy_info &fi) { fi.main_state = READ_ID; + hdl_cb(true); fi.sub_state = HEAD_LOAD_DONE; logerror("%s: command read id, rate=%d\n", @@ -1457,6 +1469,7 @@ void i8271_device::read_id_continue(floppy_info &fi) return; case SEEK_WAIT_STEP_TIME_DONE: + hdl_cb(true); do { if(fi.pcn > command[1]) fi.pcn--; @@ -1553,6 +1566,13 @@ void i8271_device::index_callback(floppy_image_device *floppy, int state) continue; } + if (fi.main_state == IDLE) { + idle_icnt++; + if (icnt != 0x0f && idle_icnt >= icnt) { + hdl_cb(false); + } + } + switch(fi.sub_state) { case IDLE: case SEEK_MOVE: diff --git a/src/devices/machine/i8271.h b/src/devices/machine/i8271.h index e4409bed389..5c63393a43f 100644 --- a/src/devices/machine/i8271.h +++ b/src/devices/machine/i8271.h @@ -215,6 +215,7 @@ private: UINT8 srate, hset, icnt, hload; int sector_size; int cur_rate; + int idle_icnt; static std::string tts(attotime t); std::string ttsn(); -- cgit v1.2.3-70-g09d2 From f005b29cce7aa3a62647ac44179a315c9446d8c0 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 31 Jan 2016 17:05:40 +0100 Subject: using dereferenced mutex = bad idea (nw) --- src/osd/modules/sync/work_osd.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/osd/modules/sync/work_osd.cpp b/src/osd/modules/sync/work_osd.cpp index 2d37feb0c56..3238fdfe792 100644 --- a/src/osd/modules/sync/work_osd.cpp +++ b/src/osd/modules/sync/work_osd.cpp @@ -445,11 +445,12 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call // first allocate a new work item; try the free list first { - std::lock_guard(*queue->lock); + queue->lock->lock(); do { item = (osd_work_item *)queue->free; } while (item != NULL && compare_exchange_ptr((PVOID volatile *)&queue->free, item, item->next) != item); + queue->lock->unlock(); } // if nothing, allocate something new @@ -484,9 +485,10 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call // enqueue the whole thing within the critical section { - std::lock_guard(*queue->lock); + queue->lock->lock(); *queue->tailptr = itemlist; queue->tailptr = item_tailptr; + queue->lock->unlock(); } // increment the number of items in the queue @@ -541,8 +543,9 @@ int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout) // if we don't have an event, create one if (item->event == NULL) { - std::lock_guard(*item->queue->lock); + item->queue->lock->lock(); item->event = osd_event_alloc(TRUE, FALSE); // manual reset, not signalled + item->queue->lock->unlock(); } else osd_event_reset(item->event); @@ -585,12 +588,13 @@ void osd_work_item_release(osd_work_item *item) osd_work_item_wait(item, 100 * osd_ticks_per_second()); // add us to the free list on our queue - std::lock_guard(*item->queue->lock); + item->queue->lock->lock(); do { next = (osd_work_item *)item->queue->free; item->next = next; } while (compare_exchange_ptr((PVOID volatile *)&item->queue->free, next, item) != next); + item->queue->lock->unlock(); } @@ -711,7 +715,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa // use a critical section to synchronize the removal of items { - std::lock_guard(*queue->lock); + queue->lock->lock(); if (queue->list == NULL) { end_loop = true; @@ -727,6 +731,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa queue->tailptr = (osd_work_item **)&queue->list; } } + queue->lock->unlock(); } if (end_loop) @@ -752,12 +757,13 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa // set the result and signal the event else { - std::lock_guard(*queue->lock); + queue->lock->lock(); if (item->event != NULL) { osd_event_set(item->event); add_to_stat(&item->queue->setevents, 1); } + queue->lock->unlock(); } // if we removed an item and there's still work to do, bump the stats @@ -778,7 +784,8 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa bool queue_has_list_items(osd_work_queue *queue) { - std::lock_guard(*queue->lock); + queue->lock->lock(); bool has_list_items = (queue->list != NULL); + queue->lock->unlock(); return has_list_items; } -- cgit v1.2.3-70-g09d2 From 963fb48ba7ca0eba3f723ecd598e9a7200101a16 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 31 Jan 2016 12:41:18 -0500 Subject: Ignore invalid default slot options in software lists This prevents software lists from (e.g.) trying to put a Zapper into ctrl1 on the Famicom. --- src/emu/emuopts.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 725f002aa00..af0e790b525 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -262,7 +262,7 @@ bool emu_options::add_slot_options(const software_part *swpart) { std::string featurename = std::string(name).append("_default"); const char *value = swpart->feature(featurename.c_str()); - if (value != nullptr) + if (value != nullptr && (*value == '\0' || slot->option(value) != nullptr)) set_default_value(name, value); } } -- cgit v1.2.3-70-g09d2 From e3b80070a53448fbe256d30f998be17e73fa3be8 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Sun, 31 Jan 2016 18:43:13 +0100 Subject: Suppressed warning C4477 in Visual Studio 2015. --- scripts/src/3rdparty.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 6ca53dc67e7..16b86dcbe21 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -967,6 +967,7 @@ project "uv" "/wd4210", -- warning C4210: nonstandard extension used : function given file scope "/wd4701", -- warning C4701: potentially uninitialized local variable 'xxx' used "/wd4703", -- warning C4703: potentially uninitialized local pointer variable 'xxx' used + "/wd4477", -- warning C4477: '' : format string '' requires an argument of type '', but variadic argument has type '' } configuration { } -- cgit v1.2.3-70-g09d2 From b1eaf6375878fed72eab97560906cbce081a1b8b Mon Sep 17 00:00:00 2001 From: Justin Kerk Date: Sun, 31 Jan 2016 20:43:55 +0000 Subject: Fix Emscripten build (nw) --- makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/makefile b/makefile index d56314ebd07..eae7d59071c 100644 --- a/makefile +++ b/makefile @@ -1267,7 +1267,11 @@ $(GENDIR)/%.lh: $(SRC)/%.lay scripts/build/file2str.py | $(GEN_FOLDERS) $(SILENT)$(PYTHON) scripts/build/file2str.py $< $@ layout_$(basename $(notdir $<)) $(SRC)/devices/cpu/m68000/m68kops.cpp: $(SRC)/devices/cpu/m68000/m68k_in.cpp $(SRC)/devices/cpu/m68000/m68kmake.cpp +ifeq ($(TARGETOS),asmjs) + $(SILENT) $(MAKE) -C $(SRC)/devices/cpu/m68000 +else $(SILENT) $(MAKE) -C $(SRC)/devices/cpu/m68000 CC=$(CC) CXX=$(CXX) +endif #------------------------------------------------- # Regression tests -- cgit v1.2.3-70-g09d2 From b3e74085fe793b886020f0f6c61902d20feea967 Mon Sep 17 00:00:00 2001 From: arbee Date: Sun, 31 Jan 2016 17:59:41 -0500 Subject: apple2: fix parallel card ACK handling, Print Shop almost works with the lx810l now. [R. Belmont] --- src/devices/bus/a2bus/a2pic.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/devices/bus/a2bus/a2pic.cpp b/src/devices/bus/a2bus/a2pic.cpp index f47f964f192..c16ee6f2140 100644 --- a/src/devices/bus/a2bus/a2pic.cpp +++ b/src/devices/bus/a2bus/a2pic.cpp @@ -49,11 +49,11 @@ static INPUT_PORTS_START( pic ) PORT_DIPSETTING( 0x06, "13 microseconds" ) PORT_DIPSETTING( 0x07, "15 microseconds" ) - PORT_DIPNAME( 0x08, 0x00, "Strobe polarity (SW4)" ) + PORT_DIPNAME( 0x08, 0x08, "Strobe polarity (SW4)" ) PORT_DIPSETTING( 0x00, "Positive" ) PORT_DIPSETTING( 0x08, "Negative" ) - PORT_DIPNAME( 0x10, 0x00, "Acknowledge polarity (SW5)" ) + PORT_DIPNAME( 0x10, 0x10, "Acknowledge polarity (SW5)" ) PORT_DIPSETTING( 0x00, "Positive" ) PORT_DIPSETTING( 0x10, "Negative" ) @@ -181,13 +181,27 @@ UINT8 a2bus_pic_device::read_cnxx(address_space &space, UINT8 offset) UINT8 a2bus_pic_device::read_c0nx(address_space &space, UINT8 offset) { + UINT8 rv = 0; + switch (offset) { case 3: return m_ctx_data_in->read(); case 4: - return m_ack; + rv = m_ack; + + // clear flip-flop + if (m_dsw1->read() & 0x10) // negative polarity + { + m_ack |= 0x80; + } + else + { + m_ack &= ~0x80; + } + + return rv; case 6: // does reading this really work? m_irqenable = true; -- cgit v1.2.3-70-g09d2 From 085892d9b8f71549726a0ab98c8d0df6a16eca45 Mon Sep 17 00:00:00 2001 From: arbee Date: Sun, 31 Jan 2016 18:03:30 -0500 Subject: lx810l: non-driver devices cannot have layouts, it scrambles the parent driver's video (nw) --- src/devices/bus/centronics/epson_lx810l.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/bus/centronics/epson_lx810l.cpp b/src/devices/bus/centronics/epson_lx810l.cpp index fc7d557d928..77a130b26bf 100644 --- a/src/devices/bus/centronics/epson_lx810l.cpp +++ b/src/devices/bus/centronics/epson_lx810l.cpp @@ -26,7 +26,7 @@ */ #include "epson_lx810l.h" -extern const char layout_lx800[]; /* use layout from lx800 */ +//extern const char layout_lx800[]; /* use layout from lx800 */ //#define LX810LDEBUG #ifdef LX810LDEBUG @@ -132,7 +132,7 @@ static MACHINE_CONFIG_FRAGMENT( epson_lx810l ) MCFG_UPD7810_CO0(WRITELINE(epson_lx810l_t, co0_w)) MCFG_UPD7810_CO1(WRITELINE(epson_lx810l_t, co1_w)) - MCFG_DEFAULT_LAYOUT(layout_lx800) +// MCFG_DEFAULT_LAYOUT(layout_lx800) /* video hardware (simulates paper) */ MCFG_SCREEN_ADD("screen", RASTER) -- cgit v1.2.3-70-g09d2 From 590f074fc4d06034b973cf588af8f8a133ba9c1f Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Sun, 31 Jan 2016 22:29:37 -0300 Subject: Nibble driver: Rewrote the whole driver. Added video hardware, preliminary machine driver and memory map. Decoded the graphics. [Roberto Fresca] --- src/mame/drivers/nibble.cpp | 304 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 273 insertions(+), 31 deletions(-) diff --git a/src/mame/drivers/nibble.cpp b/src/mame/drivers/nibble.cpp index 657e0457d15..3f2baa8c02a 100644 --- a/src/mame/drivers/nibble.cpp +++ b/src/mame/drivers/nibble.cpp @@ -2,9 +2,13 @@ // copyright-holders:Roberto Fresca /************************************************************************* - Unknown 'Nibble' game - - Preliminary driver by Roberto Fresca. + Lucky 9, Nibble. + + Driver by Roberto Fresca. + + Seems some sort of gambling game with playing cards (no poker) + and girls graphics... + ************************************************************************** @@ -37,9 +41,12 @@ *************************************************************************/ + #define MASTER_CLOCK XTAL_12MHz #include "emu.h" +#include "cpu/tms9900/tms9980a.h" +//#include "cpu/tms9900/tms9900.h" #include "sound/ay8910.h" #include "video/mc6845.h" @@ -48,65 +55,300 @@ class nibble_state : public driver_device { public: nibble_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - // ,m_maincpu(*this, "maincpu") - { } + : driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode") { } + + required_shared_ptr m_videoram; + tilemap_t *m_bg_tilemap; + DECLARE_WRITE8_MEMBER(nibble_videoram_w); + TILE_GET_INFO_MEMBER(get_bg_tile_info); virtual void machine_start() override; virtual void machine_reset() override; + virtual void video_start() override; + DECLARE_PALETTE_INIT(nibble); + UINT32 screen_update_nibble(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(nibble_interrupt); + required_device m_maincpu; + required_device m_gfxdecode; +}; -// required_device m_maincpu; -}; +/************************* +* Video Hardware * +*************************/ -static INPUT_PORTS_START( nibble ) -INPUT_PORTS_END +WRITE8_MEMBER(nibble_state::nibble_videoram_w) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} +TILE_GET_INFO_MEMBER(nibble_state::get_bg_tile_info) +{ +/* - bits - + 7654 3210 + ---- ---- bank select. + ---- ---- color code. + ---- ---- seems unused. +*/ + int code = m_videoram[tile_index]; + + SET_TILE_INFO_MEMBER(0 /* bank */, code, 0 /* color */, 0); +} + +void nibble_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(nibble_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); +} + +UINT32 nibble_state::screen_update_nibble(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + +PALETTE_INIT_MEMBER(nibble_state, nibble) +{ +} + + +/************************** +* Read / Write Handlers * +**************************/ + +INTERRUPT_GEN_MEMBER(nibble_state::nibble_interrupt) +{ +} + + +/************************ +* Start & Reset * +************************/ + void nibble_state::machine_start() { } + void nibble_state::machine_reset() { } +/************************* +* Memory Map Information * +*************************/ + +static ADDRESS_MAP_START( nibble_map, AS_PROGRAM, 8, nibble_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3fff) + AM_RANGE(0x0000, 0xbfff) AM_ROM + AM_RANGE(0xc000, 0xc3ff) AM_WRITE(nibble_videoram_w) AM_SHARE("videoram") // placeholder +// AM_RANGE(0xff00, 0xff01) AM_DEVWRITE("crtc", mc6845_device, address_w) +// AM_RANGE(0xff02, 0xff03) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( nibble_cru_map, AS_IO, 8, nibble_state ) +ADDRESS_MAP_END + + +/************************* +* Input Ports * +*************************/ + +static INPUT_PORTS_START( nibble ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_1) PORT_NAME("IN0-1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_2) PORT_NAME("IN0-2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_3) PORT_NAME("IN0-3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4) PORT_NAME("IN0-4") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_5) PORT_NAME("IN0-5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6) PORT_NAME("IN0-6") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7) PORT_NAME("IN0-7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_8) PORT_NAME("IN0-8") + + PORT_START("IN1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Q) PORT_NAME("IN1-1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_W) PORT_NAME("IN1-2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_E) PORT_NAME("IN1-3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_R) PORT_NAME("IN1-4") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_T) PORT_NAME("IN1-5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Y) PORT_NAME("IN1-6") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_U) PORT_NAME("IN1-7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_I) PORT_NAME("IN1-8") + + PORT_START("IN2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_A) PORT_NAME("IN2-1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_S) PORT_NAME("IN2-2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_D) PORT_NAME("IN2-3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F) PORT_NAME("IN2-4") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_G) PORT_NAME("IN2-5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_H) PORT_NAME("IN2-6") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_J) PORT_NAME("IN2-7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_K) PORT_NAME("IN2-8") + + PORT_START("IN3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Z) PORT_NAME("IN3-1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_X) PORT_NAME("IN3-2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_C) PORT_NAME("IN3-3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_V) PORT_NAME("IN3-4") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_B) PORT_NAME("IN3-5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_N) PORT_NAME("IN3-6") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_M) PORT_NAME("IN3-7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_L) PORT_NAME("IN3-8") + + PORT_START("IN4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("IN4-1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("IN4-2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("IN4-3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("IN4-4") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("IN4-5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("IN4-6") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("IN4-7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("IN4-8") + + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + +INPUT_PORTS_END + + +/************************* +* Graphics Layouts * +*************************/ + +static const gfx_layout charlayout = +{ + 8,8, + RGN_FRAC(1,8), + 8, + { RGN_FRAC(0,8), RGN_FRAC(1,8), RGN_FRAC(2,8), RGN_FRAC(3,8), RGN_FRAC(4,8), RGN_FRAC(5,8), RGN_FRAC(6,8), RGN_FRAC(7,8) }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + + +/****************************** +* Graphics Decode Information * +******************************/ + +static GFXDECODE_START( nibble ) + GFXDECODE_ENTRY( "gfx", 0, charlayout, 0, 16 ) +GFXDECODE_END + + +/************************* +* Machine Drivers * +*************************/ + static MACHINE_CONFIG_START( nibble, nibble_state ) - /* basic machine hardware */ -// MCFG_CPU_ADD("maincpu", ??, 3000000) // unknown DIP64 CPU -// MCFG_CPU_PROGRAM_MAP(nibble_map) -// MCFG_CPU_IO_MAP(nibble_io) -// MCFG_CPU_VBLANK_INT_DRIVER("screen", nibble_state, irq0_line_hold) + // CPU should be switched to TMS9900 + MCFG_TMS99xx_ADD("maincpu", TMS9980A, MASTER_CLOCK/4, nibble_map, nibble_cru_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", nibble_state, nibble_interrupt) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + MCFG_SCREEN_UPDATE_DRIVER(nibble_state, screen_update_nibble) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", nibble) - /* sound hardware */ -// MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_PALETTE_ADD("palette", 256) + MCFG_PALETTE_INIT_OWNER(nibble_state, nibble) + + MCFG_MC6845_ADD("crtc", MC6845, "screen", MASTER_CLOCK/8) /* guess */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) -// MCFG_SOUND_ADD("aysnd", AY8910, MASTER_CLOCK/8) -// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END +/************************* +* Rom Load * +*************************/ + ROM_START( l9nibble ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "09.U123", 0x00000, 0x10000, CRC(dfef685d) SHA1(0aeb4257e408e8549df629a0cdb5f2b6790e32de) ) // unknown + ROM_LOAD( "09.U123", 0x00000, 0x10000, CRC(dfef685d) SHA1(0aeb4257e408e8549df629a0cdb5f2b6790e32de) ) // tms9900 code? - ROM_REGION( 0x80000, "oki", 0 ) + ROM_REGION( 0x80000, "gfx", 0 ) ROM_LOAD( "01.U139", 0x00000, 0x10000, CRC(aba06e58) SHA1(5841beec122613eed2ba9f48cb1d51bfa0ff450c) ) - ROM_LOAD( "02.U141", 0x00000, 0x10000, CRC(a1e5d6d1) SHA1(8ec85b0544dd75bcb13600bae503ad2b20978281) ) - ROM_LOAD( "03.U149", 0x00000, 0x10000, CRC(ae66f77c) SHA1(6c9e98cc00b72252cb238f14686c0faef47134df) ) - ROM_LOAD( "04.U147", 0x00000, 0x10000, CRC(f1864094) SHA1(b439f9e8c2cc4575f9edbda45b9e724257015a73) ) - ROM_LOAD( "05.U137", 0x00000, 0x10000, CRC(2e8ae9de) SHA1(5f2831f71b351e34df82af37041c9aa815eb372c) ) - ROM_LOAD( "06.U143", 0x00000, 0x10000, CRC(8a56f324) SHA1(68790a12ca57c999bd7b7f26adc206aab3c06976) ) - ROM_LOAD( "07.U145", 0x00000, 0x10000, CRC(4f757912) SHA1(63e5fc2672552463060680b7a5a94df45f3d4b68) ) - ROM_LOAD( "08.U152", 0x00000, 0x10000, CRC(4f878ee4) SHA1(215f3ead0c358cc09c21515981cbb0a1e58c2ca6) ) + ROM_LOAD( "02.U141", 0x10000, 0x10000, CRC(a1e5d6d1) SHA1(8ec85b0544dd75bcb13600bae503ad2b20978281) ) + ROM_LOAD( "03.U149", 0x20000, 0x10000, CRC(ae66f77c) SHA1(6c9e98cc00b72252cb238f14686c0faef47134df) ) + ROM_LOAD( "04.U147", 0x30000, 0x10000, CRC(f1864094) SHA1(b439f9e8c2cc4575f9edbda45b9e724257015a73) ) + ROM_LOAD( "05.U137", 0x40000, 0x10000, CRC(2e8ae9de) SHA1(5f2831f71b351e34df82af37041c9aa815eb372c) ) + ROM_LOAD( "06.U143", 0x50000, 0x10000, CRC(8a56f324) SHA1(68790a12ca57c999bd7b7f26adc206aab3c06976) ) + ROM_LOAD( "07.U145", 0x60000, 0x10000, CRC(4f757912) SHA1(63e5fc2672552463060680b7a5a94df45f3d4b68) ) + ROM_LOAD( "08.U152", 0x70000, 0x10000, CRC(4f878ee4) SHA1(215f3ead0c358cc09c21515981cbb0a1e58c2ca6) ) ROM_REGION( 0x20000, "user", 0 ) - ROM_LOAD( "10.U138", 0x00000, 0x20000, CRC(ed831d2a) SHA1(ce5c3b24979d220215d7f0e8d50f45550aec15bd) ) + ROM_LOAD( "10.U138", 0x00000, 0x20000, CRC(ed831d2a) SHA1(ce5c3b24979d220215d7f0e8d50f45550aec15bd) ) // unknown data... ROM_END -/* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS... */ -GAME( 19??, l9nibble, 0, nibble, nibble, driver_device, 0, ROT0, "Nibble?", "Unknown Nibble game", MACHINE_IS_SKELETON ) +/************************* +* Game Drivers * +*************************/ + +/* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS... */ +GAME( 19??, l9nibble, 0, nibble, nibble, driver_device, 0, ROT0, "Nibble", "Lucky 9", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From 4a3a986311ce442853697810cee6863c8be471a4 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Sun, 31 Jan 2016 23:20:56 -0300 Subject: Nibble driver: Load the undumped PLDs... Also added more tech specs/notes. --- src/mame/drivers/nibble.cpp | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/src/mame/drivers/nibble.cpp b/src/mame/drivers/nibble.cpp index 3f2baa8c02a..edb798c94e5 100644 --- a/src/mame/drivers/nibble.cpp +++ b/src/mame/drivers/nibble.cpp @@ -14,20 +14,24 @@ Specs: - 1x UM6845 - 1x AY38910A/p + 1x UM6845 (U67). + 1x AY38910A/p (U75). - 3x HY6264P-12 - 2x IMSG171P-50G + 3x HY6264P-12 (U153, U154, U25). + 2x IMSG171P-50G (U32, U104). 2 Chips with no markings! - 8x 64K Graphics ROMs. - 1x 64K Program ROM. - 1x 128K unknown ROM. + 8x 64K Graphics ROMs (U139, U141, U149, U147, U137, U143, U145, U152). + 1x 64K Program ROM (U123). + 1x 128K unknown ROM (U138). + + 1x TI LF347N (U158) Operational Amplifier. + 1x LM380N (U82) 2.5W Audio Power Amplifier. 2x XTAL - 11.98135 KDS9C 2x 8 DIP switches banks. + 1x 3.6V lithium battery. ************************************************************************** @@ -35,8 +39,8 @@ Tech notes... About the unknown ICs: - DIP64 CPU with Xtal tied to pins 30 % 31. --> TMS9900? (ROM 9) - DIP40 CPU or sound IC driving 128k (ROM 10) data? (pin 20 tied to GND) + DIP64 (U101) CPU with Xtal tied to pins 30 % 31. --> TMS9900? (ROM 9) + DIP40 (U64) CPU or sound IC driving 128k (ROM 10) data? (pin 20 tied to GND) *************************************************************************/ @@ -331,17 +335,21 @@ ROM_START( l9nibble ) ROM_LOAD( "09.U123", 0x00000, 0x10000, CRC(dfef685d) SHA1(0aeb4257e408e8549df629a0cdb5f2b6790e32de) ) // tms9900 code? ROM_REGION( 0x80000, "gfx", 0 ) - ROM_LOAD( "01.U139", 0x00000, 0x10000, CRC(aba06e58) SHA1(5841beec122613eed2ba9f48cb1d51bfa0ff450c) ) - ROM_LOAD( "02.U141", 0x10000, 0x10000, CRC(a1e5d6d1) SHA1(8ec85b0544dd75bcb13600bae503ad2b20978281) ) - ROM_LOAD( "03.U149", 0x20000, 0x10000, CRC(ae66f77c) SHA1(6c9e98cc00b72252cb238f14686c0faef47134df) ) - ROM_LOAD( "04.U147", 0x30000, 0x10000, CRC(f1864094) SHA1(b439f9e8c2cc4575f9edbda45b9e724257015a73) ) - ROM_LOAD( "05.U137", 0x40000, 0x10000, CRC(2e8ae9de) SHA1(5f2831f71b351e34df82af37041c9aa815eb372c) ) - ROM_LOAD( "06.U143", 0x50000, 0x10000, CRC(8a56f324) SHA1(68790a12ca57c999bd7b7f26adc206aab3c06976) ) - ROM_LOAD( "07.U145", 0x60000, 0x10000, CRC(4f757912) SHA1(63e5fc2672552463060680b7a5a94df45f3d4b68) ) - ROM_LOAD( "08.U152", 0x70000, 0x10000, CRC(4f878ee4) SHA1(215f3ead0c358cc09c21515981cbb0a1e58c2ca6) ) + ROM_LOAD( "01.u139", 0x00000, 0x10000, CRC(aba06e58) SHA1(5841beec122613eed2ba9f48cb1d51bfa0ff450c) ) + ROM_LOAD( "02.u141", 0x10000, 0x10000, CRC(a1e5d6d1) SHA1(8ec85b0544dd75bcb13600bae503ad2b20978281) ) + ROM_LOAD( "03.u149", 0x20000, 0x10000, CRC(ae66f77c) SHA1(6c9e98cc00b72252cb238f14686c0faef47134df) ) + ROM_LOAD( "04.u147", 0x30000, 0x10000, CRC(f1864094) SHA1(b439f9e8c2cc4575f9edbda45b9e724257015a73) ) + ROM_LOAD( "05.u137", 0x40000, 0x10000, CRC(2e8ae9de) SHA1(5f2831f71b351e34df82af37041c9aa815eb372c) ) + ROM_LOAD( "06.u143", 0x50000, 0x10000, CRC(8a56f324) SHA1(68790a12ca57c999bd7b7f26adc206aab3c06976) ) + ROM_LOAD( "07.u145", 0x60000, 0x10000, CRC(4f757912) SHA1(63e5fc2672552463060680b7a5a94df45f3d4b68) ) + ROM_LOAD( "08.u152", 0x70000, 0x10000, CRC(4f878ee4) SHA1(215f3ead0c358cc09c21515981cbb0a1e58c2ca6) ) ROM_REGION( 0x20000, "user", 0 ) - ROM_LOAD( "10.U138", 0x00000, 0x20000, CRC(ed831d2a) SHA1(ce5c3b24979d220215d7f0e8d50f45550aec15bd) ) // unknown data... + ROM_LOAD( "10.u138", 0x00000, 0x20000, CRC(ed831d2a) SHA1(ce5c3b24979d220215d7f0e8d50f45550aec15bd) ) // unknown data... + + ROM_REGION( 0x0400, "plds", 0 ) + ROM_LOAD( "pal16l8acn.u23", 0x0000, 0x0104, NO_DUMP ) + ROM_LOAD( "pal16l8acn.uxx", 0x0200, 0x0104, NO_DUMP ) ROM_END -- cgit v1.2.3-70-g09d2 From 26c7707be16f24f64b9bb476fc17b7bbdc67893c Mon Sep 17 00:00:00 2001 From: Robbbert Date: Mon, 1 Feb 2016 20:29:40 +1100 Subject: h21: Added vc4000 compatibility flag. --- src/mame/drivers/vc4000.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/vc4000.cpp b/src/mame/drivers/vc4000.cpp index 2dcc44e54e7..11362de1e92 100644 --- a/src/mame/drivers/vc4000.cpp +++ b/src/mame/drivers/vc4000.cpp @@ -722,5 +722,5 @@ CONS(1979, telngtcs, rwtrntcs, 0, rwtrntcs, vc4000, driver_device, CONS(1979, krvnjvtv, 0, vc4000, vc4000, vc4000, driver_device, 0, "SOE", "OC Jeu Video TV Karvan", MACHINE_IMPERFECT_GRAPHICS ) /* France */ CONS(1979, oc2000, krvnjvtv, 0, vc4000, vc4000, driver_device, 0, "SOE", "OC-2000", MACHINE_IMPERFECT_GRAPHICS ) /* France */ CONS(1980, mpt05, 0, vc4000, vc4000, vc4000, driver_device, 0, "ITMC", "MPT-05", MACHINE_IMPERFECT_GRAPHICS ) /* France */ -CONS(1982, h21, 0, 0, h21, vc4000, driver_device, 0, "TRQ", "Video Computer H-21", MACHINE_IMPERFECT_GRAPHICS) // Spain +CONS(1982, h21, 0, vc4000, h21, vc4000, driver_device, 0, "TRQ", "Video Computer H-21", MACHINE_IMPERFECT_GRAPHICS) // Spain CONS(1979, elektor, 0, 0, elektor, elektor, driver_device, 0, "Elektor", "Elektor TV Games Computer", MACHINE_IMPERFECT_GRAPHICS ) -- cgit v1.2.3-70-g09d2 From 2605e3c1050bec038969b227216c97c769cff996 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 1 Feb 2016 15:13:58 +0000 Subject: new NOT WORKING Name Club Ver.2 (J 960315 V1.000) [TeamEurope & mooglyguy] Print Club LoveLove (J 970421 V1.000) [TeamEurope & mooglyguy] both quite interesting because they use the same protection device as decathlete. --- src/mame/arcade.lst | 2 ++ src/mame/drivers/stv.cpp | 45 +++++++++++++++++++++++++++-- src/mame/machine/315-5838_317-0229_comp.cpp | 5 ++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 149af1f186b..076d423dfc6 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -5145,6 +5145,7 @@ pclub2kc // 1997.02 Print Club Kome Kome Club pclub2fc // 1997.04 Print Club 2 Felix The Cat groovef // 1997.05 Groove on Fight (Atlus) nclubv3 // 1997.07 Name Club Ver. 3 +nclubv2 pclb2elk // 1997.07 Print Club Custom pclub2 // 1997.09 Print Club 2 thunt // 1997.09 Puzzle & Action Treasure Hunt (Sega (Deniam License)) @@ -5152,6 +5153,7 @@ thuntk winterht // 1997.10 Winter Heat (Data East) pclb297w // 1997.10 Print Club 2 '97 Winter Ver pclub298 // 1997.10 Print Club 2 '98 Spring Ver +pclove cotton2 // 1997.11 Cotton 2 (Success) hanagumi // 1997.11 Sakura Taisen Hanagumi Taisen Columns findlove // 1997.12 Find Love (Daiki / FCF) diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index c75d566f39d..6342df12f7c 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -3058,6 +3058,43 @@ ROM_START( pclb2elk ) // set to 1p ROM_LOAD( "pclb2elk.nv", 0x0000, 0x0080, CRC(54c7564f) SHA1(574dcc5e8fe4aac091fee1476347485ed660eddd) ) ROM_END +ROM_START( pclove ) + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ + // note, 'IC2' in service mode (the test of IC24/IC26) fails once you map the protection device because it occupies the same memory address as the rom at IC26 + // there must be a way to enable / disable it. + ROM_LOAD16_WORD_SWAP( "pclbLove.ic22", 0x0200000, 0x0200000, CRC(8cd25a0f) SHA1(c938d5f4f800db019abc2e17cce1e780e93f3d02) ) // OK (tested as IC7) + ROM_LOAD16_WORD_SWAP( "pclbLove.ic24", 0x0400000, 0x0200000, CRC(85583e2c) SHA1(7f407d1bce40317fc10433dafcd82ee41be05839) ) // OK (tested as IC2) + ROM_LOAD16_WORD_SWAP( "pclbLove.ic26", 0x0600000, 0x0200000, CRC(7efcabcc) SHA1(b99a67ab2053c3be5ce37530b65f9693c2a4eef8) ) // OK (tested as IC2) + ROM_LOAD16_WORD_SWAP( "pclbLove.ic28", 0x0800000, 0x0200000, CRC(a1336da7) SHA1(ba26810067a13968a54a8867025b8d8e96384ae7) ) // OK (tested as IC3) + ROM_LOAD16_WORD_SWAP( "pclbLove.ic30", 0x0a00000, 0x0200000, CRC(ec5b5e28) SHA1(89bcddb52c176c86ad4bdb9f4f052be5b75bcd1b) ) // OK (tested as IC3) + ROM_LOAD16_WORD_SWAP( "pclbLove.ic32", 0x0c00000, 0x0200000, CRC(9a4109e5) SHA1(ba59caac5f5a80fc52c507d8a47f322a380aa9a1) ) // FF fill? (not tested either) + + // protection device used to decrypt some startup code + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "pclove.nv", 0x0000, 0x0080, CRC(3c78e3bd) SHA1(6d5fe8545f434b4cc1e8229549adb0a49ac45bd1) ) +ROM_END + +ROM_START( nclubv2 ) + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASEFF ) /* SH2 code */ + // unusual rom mapping compared to other games, the cartridge is a little different too, with a large PALCE16V8H-10 marked 315-6026 + ROM_LOAD16_WORD_SWAP( "nclubv2.ic22", 0x0200000, 0x0200000, CRC(7e81676d) SHA1(fc0f0dcdb4aaf71218d7c1dd0e4ddc5381e8b13b) ) // OK + ROM_LOAD16_WORD_SWAP( "nclubv2.ic24", 0x0600000, 0x0200000, CRC(1b7637de) SHA1(43c3094f60a6582298a45bad923fef57e98c5b2b) ) // OK + ROM_LOAD16_WORD_SWAP( "nclubv2.ic26", 0x0a00000, 0x0200000, CRC(bcf3f540) SHA1(e7f3174ccb2f1664baf4332dd99a71647c9c6108) ) // fails rom check (data doesn't look bad tho so probably a few bits at most) + ROM_LOAD16_WORD_SWAP( "nclubv2.ic28", 0x0e00000, 0x0200000, CRC(1a3ca5e2) SHA1(4d3aed51d29c54e71175d828f648c9feb813ac04) ) // OK + + // the protection device is checked in the 'each game test' menu as 'RCDD2' might be worth investigating what the game passes to the device for it. + // I think the device is used to decompress the full size image data for the printer. + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "nclubv2.nv", 0x0000, 0x0080, CRC(96d55fa9) SHA1(b3c821d6cd4ed52d0e20565e12a06d8f81a08dbc) ) +ROM_END + + GAME( 1996, stvbios, 0, stv_slot, stv, stv_state, stv, ROT0, "Sega", "ST-V Bios", MACHINE_IS_BIOS_ROOT ) @@ -3114,9 +3151,10 @@ GAME( 1997, winterht, stvbios, stv, stv, stv_state, winterht, ROT GAME( 1997, znpwfv, stvbios, stv, stv, stv_state, znpwfv, ROT0, "Sega", "Zen Nippon Pro-Wrestling Featuring Virtua (J 971123 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) /* Unemulated printer / camera devices */ -GAME( 1998, stress, stvbios, stv, stv, stv_state, stv, ROT0, "Sega", "Stress Busters (J 981020 V1.000)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1997, nclubv3, stvbios, stv, stv, stv_state, nameclv3, ROT0, "Sega", "Name Club Ver.3 (J 970723 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) -GAME( 1997, pclub2, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 (U 970921 V1.000)", MACHINE_NOT_WORKING ) +GAME( 1998, stress, stvbios, stv, stv, stv_state, stv, ROT0, "Sega", "Stress Busters (J 981020 V1.000)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1996, nclubv2, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Sega", "Name Club Ver.2 (J 960315 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! +GAME( 1997, nclubv3, stvbios, stv, stv, stv_state, nameclv3, ROT0, "Sega", "Name Club Ver.3 (J 970723 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) +GAME( 1997, pclub2, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 (U 970921 V1.000)", MACHINE_NOT_WORKING ) GAME( 1999, pclub2fc, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Felix The Cat (Rev. A) (J 970415 V1.100)", MACHINE_NOT_WORKING ) GAME( 1997, pclb297w, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '97 Winter Ver (J 971017 V1.100)", MACHINE_NOT_WORKING ) GAME( 1997, pclub298, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Spring Ver (J 971017 V1.100)", MACHINE_NOT_WORKING ) @@ -3127,6 +3165,7 @@ GAME( 1999, pclub2v3, pclub2, stv, stv, stv_state, stv, ROT0 GAME( 1999, pclubpok, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Pokemon B (U 991126 V1.000)", MACHINE_NOT_WORKING ) GAME( 1997, pclub2kc, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Kome Kome Club (J 970203 V1.000)", MACHINE_NOT_WORKING ) GAME( 1997, pclb2elk, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Earth Limited Kobe (Print Club Custom) (J 970808 V1.000)", MACHINE_NOT_WORKING ) +GAME( 1997, pclove, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Atlus", "Print Club LoveLove (J 970421 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! /* Doing something.. but not enough yet */ diff --git a/src/mame/machine/315-5838_317-0229_comp.cpp b/src/mame/machine/315-5838_317-0229_comp.cpp index cfd38aa7c88..a3ec986ee38 100644 --- a/src/mame/machine/315-5838_317-0229_comp.cpp +++ b/src/mame/machine/315-5838_317-0229_comp.cpp @@ -4,6 +4,11 @@ 315-5838 - Decathlete (ST-V) 317-0229 - Dead or Alive (Model 2A) + ???-???? - Print CLub Love Love (ST-V) + ???-???? - Name Club Ver 2 (ST-V) (tested as RCDD2 in the service menu!) + + Several Print Club (ST-V) carts have + an unpopulated space marked '317-0229' on the PCB Package Type: TQFP100 -- cgit v1.2.3-70-g09d2 From 7eded8204d4b4728ad8809dfb25476dda7620b2d Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 1 Feb 2016 16:02:48 +0000 Subject: new NOT WORKING Print Club Yoshimoto V2 (J 970422 V1.100) [TeamEurope, MooglyGuy] Print Club 2 Vol. 7 Spring (J 970313 V1.100) [TeamEurope, MooglyGuy] Print Club 2 Puffy (Japan) [TeamEurope, MooglyGuy] also replaced nclubv2 bad rom with a better dump, but it still fails rom check. --- src/mame/arcade.lst | 3 ++ src/mame/drivers/stv.cpp | 69 ++++++++++++++++++++++++++--- src/mame/machine/315-5838_317-0229_comp.cpp | 4 +- 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 076d423dfc6..725487164ad 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -5143,6 +5143,9 @@ shienryu // 1997.02 Shienryu (Warashi) vmahjong // 1997.02 Virtual Mahjong (Micronet) pclub2kc // 1997.02 Print Club Kome Kome Club pclub2fc // 1997.04 Print Club 2 Felix The Cat +pclub2pf // +pclub27s // +pclubyo2 // groovef // 1997.05 Groove on Fight (Atlus) nclubv3 // 1997.07 Name Club Ver. 3 nclubv2 diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index 6342df12f7c..dfbbb3452b4 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -2901,6 +2901,21 @@ ROM_START( pclub2fc ) // set to 1p ROM_END +ROM_START( pclub2pf ) // set to 1p + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ + + ROM_LOAD16_WORD_SWAP( "pclb2puf.IC22", 0x0200000, 0x0200000, CRC(a14282f2) SHA1(b96e70693d8e71b090e20efdd3aa6228e7289fa4) ) // OK + ROM_LOAD16_WORD_SWAP( "pclb2puf.IC24", 0x0400000, 0x0200000, CRC(4fb4dc74) SHA1(1f174512c9cd5420d7f935cbc6b5875836f6e825) ) // OK + ROM_LOAD16_WORD_SWAP( "pclb2puf.IC26", 0x0600000, 0x0200000, CRC(d20bbfb5) SHA1(5f2768e0e306bd0e3ed9b4e1d234aac8fd7155e6) ) // OK + ROM_LOAD16_WORD_SWAP( "pclb2puf.IC28", 0x0800000, 0x0200000, CRC(da658ae9) SHA1(24293c2b23b3009956fc05df5177a27415754301) ) // OK + ROM_LOAD16_WORD_SWAP( "pclb2puf.IC30", 0x0a00000, 0x0200000, CRC(cafc0e6b) SHA1(fa2ac54260336d5dd1ced7ccaf87115511ece1f8) ) // OK + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "pclub2pf.nv", 0x0000, 0x0080, CRC(447bb3bd) SHA1(9fefec09849bfa0c14b49e73ff13e2a538dff511) ) +ROM_END + ROM_START( pclb297w ) // set to 1p STV_BIOS @@ -2940,6 +2955,37 @@ ROM_START( pclub298 ) // set to 1p ROM_LOAD( "pclub298.nv", 0x0000, 0x0080, CRC(a23dd0f2) SHA1(457282b5d40a17477b95330bba91e05c603f951e) ) ROM_END +ROM_START( pclub27s ) // set to 1p + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ + + ROM_LOAD16_WORD_SWAP( "pclub2v7.IC22", 0x0200000, 0x0200000, CRC(44c8ab27) SHA1(65e2705b2918da32ea40375707df4e148b311159) ) + ROM_LOAD16_WORD_SWAP( "pclub2v7.IC24", 0x0400000, 0x0200000, CRC(24818437) SHA1(5293d45b53680301abaf0b32a62596aaaa2552d6) ) + ROM_LOAD16_WORD_SWAP( "pclub2v7.IC26", 0x0600000, 0x0200000, CRC(076c1d44) SHA1(d597ed4524bb03eb0ef8ada08d49f3dc0fc8136d) ) + ROM_LOAD16_WORD_SWAP( "pclub2v7.IC28", 0x0800000, 0x0200000, CRC(03b9eacf) SHA1(d69c10f7613d9f52042dd6cce64e74e2b1ecc2d8) ) + ROM_LOAD16_WORD_SWAP( "pclub2v7.IC30", 0x0a00000, 0x0200000, CRC(e58c7167) SHA1(d88b1648c5d86a90615a8c6a1bf87bc9e75dc320) ) + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "pclub27s.nv", 0x0000, 0x0080, CRC(323dd0f2) SHA1(457282b5d40a17477b95330bba91e05c603f951e) ) +ROM_END + +ROM_START( pclubyo2 ) // set to 1p + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ + + ROM_LOAD16_WORD_SWAP( "pclbyov2.IC22", 0x0200000, 0x0200000, CRC(719a4d27) SHA1(328dfb8debea02e8660e636e953982d381529945) ) + ROM_LOAD16_WORD_SWAP( "pclbyov2.IC24", 0x0400000, 0x0200000, CRC(790dc7b5) SHA1(829ead39930779617a9bef41d8615362ca86c4c7) ) + ROM_LOAD16_WORD_SWAP( "pclbyov2.IC26", 0x0600000, 0x0200000, CRC(12ae1606) SHA1(9534fb2dbf6fd2c258ba2716783cc5bab8bd8dc0) ) + ROM_LOAD16_WORD_SWAP( "pclbyov2.IC28", 0x0800000, 0x0200000, CRC(ff9643ca) SHA1(3309f970f87324b06cc48add386019f769abcd89) ) + ROM_LOAD16_WORD_SWAP( "pclbyov2.IC30", 0x0a00000, 0x0200000, CRC(03b9eacf) SHA1(d69c10f7613d9f52042dd6cce64e74e2b1ecc2d8) ) + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "pclubyo2.nv", 0x0000, 0x0080, CRC(2b26a8f7) SHA1(32f34096cac05a37c492ee389ed8e4c02694c268) ) +ROM_END + + ROM_START( pclb298a ) // set to 1p STV_BIOS @@ -3084,8 +3130,9 @@ ROM_START( nclubv2 ) // unusual rom mapping compared to other games, the cartridge is a little different too, with a large PALCE16V8H-10 marked 315-6026 ROM_LOAD16_WORD_SWAP( "nclubv2.ic22", 0x0200000, 0x0200000, CRC(7e81676d) SHA1(fc0f0dcdb4aaf71218d7c1dd0e4ddc5381e8b13b) ) // OK ROM_LOAD16_WORD_SWAP( "nclubv2.ic24", 0x0600000, 0x0200000, CRC(1b7637de) SHA1(43c3094f60a6582298a45bad923fef57e98c5b2b) ) // OK - ROM_LOAD16_WORD_SWAP( "nclubv2.ic26", 0x0a00000, 0x0200000, CRC(bcf3f540) SHA1(e7f3174ccb2f1664baf4332dd99a71647c9c6108) ) // fails rom check (data doesn't look bad tho so probably a few bits at most) + ROM_LOAD16_WORD_SWAP( "ic26", 0x0a00000, 0x0200000, CRC(614deea4) SHA1(4af01ad961c72399481ab3ffce08fc8d30184323) ) // fails rom check ROM_LOAD16_WORD_SWAP( "nclubv2.ic28", 0x0e00000, 0x0200000, CRC(1a3ca5e2) SHA1(4d3aed51d29c54e71175d828f648c9feb813ac04) ) // OK + // the protection device is checked in the 'each game test' menu as 'RCDD2' might be worth investigating what the game passes to the device for it. // I think the device is used to decompress the full size image data for the printer. @@ -3151,21 +3198,29 @@ GAME( 1997, winterht, stvbios, stv, stv, stv_state, winterht, ROT GAME( 1997, znpwfv, stvbios, stv, stv, stv_state, znpwfv, ROT0, "Sega", "Zen Nippon Pro-Wrestling Featuring Virtua (J 971123 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) /* Unemulated printer / camera devices */ -GAME( 1998, stress, stvbios, stv, stv, stv_state, stv, ROT0, "Sega", "Stress Busters (J 981020 V1.000)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1996, nclubv2, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Sega", "Name Club Ver.2 (J 960315 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! -GAME( 1997, nclubv3, stvbios, stv, stv, stv_state, nameclv3, ROT0, "Sega", "Name Club Ver.3 (J 970723 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) +// USA sets GAME( 1997, pclub2, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 (U 970921 V1.000)", MACHINE_NOT_WORKING ) +GAME( 1999, pclub2v3, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 3 (U 990310 V1.000)", MACHINE_NOT_WORKING ) +GAME( 1999, pclubpok, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Pokemon B (U 991126 V1.000)", MACHINE_NOT_WORKING ) +// Japan sets GAME( 1999, pclub2fc, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Felix The Cat (Rev. A) (J 970415 V1.100)", MACHINE_NOT_WORKING ) +GAME( 1998, pclub2pf, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Puffy (Japan)", MACHINE_NOT_WORKING ) // version info is blank GAME( 1997, pclb297w, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '97 Winter Ver (J 971017 V1.100)", MACHINE_NOT_WORKING ) GAME( 1997, pclub298, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Spring Ver (J 971017 V1.100)", MACHINE_NOT_WORKING ) GAME( 1998, pclb298a, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Autumn Ver (J 980827 V1.000)", MACHINE_NOT_WORKING ) +GAME( 1997, pclb2elk, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Earth Limited Kobe (Print Club Custom) (J 970808 V1.000)", MACHINE_NOT_WORKING ) +GAME( 1997, pclub27s, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 7 Spring (J 970313 V1.100)", MACHINE_NOT_WORKING ) // aka Print Club 2 '97 Spring Ver ? + GAME( 1999, pclubor, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Goukakenran (J 991104 V1.000)", MACHINE_NOT_WORKING ) GAME( 1999, pclubol, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Olive (J 980717 V1.000)", MACHINE_NOT_WORKING ) -GAME( 1999, pclub2v3, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 3 (U 990310 V1.000)", MACHINE_NOT_WORKING ) -GAME( 1999, pclubpok, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Pokemon B (U 991126 V1.000)", MACHINE_NOT_WORKING ) GAME( 1997, pclub2kc, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Kome Kome Club (J 970203 V1.000)", MACHINE_NOT_WORKING ) -GAME( 1997, pclb2elk, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Earth Limited Kobe (Print Club Custom) (J 970808 V1.000)", MACHINE_NOT_WORKING ) GAME( 1997, pclove, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Atlus", "Print Club LoveLove (J 970421 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! +GAME( 1997, pclubyo2, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Yoshimoto V2 (J 970422 V1.100)", MACHINE_NOT_WORKING ) + +GAME( 1998, stress, stvbios, stv, stv, stv_state, stv, ROT0, "Sega", "Stress Busters (J 981020 V1.000)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1996, nclubv2, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Sega", "Name Club Ver.2 (J 960315 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! +GAME( 1997, nclubv3, stvbios, stv, stv, stv_state, nameclv3, ROT0, "Sega", "Name Club Ver.3 (J 970723 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) + /* Doing something.. but not enough yet */ diff --git a/src/mame/machine/315-5838_317-0229_comp.cpp b/src/mame/machine/315-5838_317-0229_comp.cpp index a3ec986ee38..7660dbf6076 100644 --- a/src/mame/machine/315-5838_317-0229_comp.cpp +++ b/src/mame/machine/315-5838_317-0229_comp.cpp @@ -4,8 +4,8 @@ 315-5838 - Decathlete (ST-V) 317-0229 - Dead or Alive (Model 2A) - ???-???? - Print CLub Love Love (ST-V) - ???-???? - Name Club Ver 2 (ST-V) (tested as RCDD2 in the service menu!) + 317-0229 - Name Club Ver 2 (ST-V) (tested as RCDD2 in the service menu!) + 317-0231 - Print Club Love Love (ST-V) Several Print Club (ST-V) carts have an unpopulated space marked '317-0229' on the PCB -- cgit v1.2.3-70-g09d2 From f099454e9554d19d5cccc19ab3d53643aeea161a Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 1 Feb 2016 17:24:42 +0000 Subject: replace nclubv2 rom with good dump (thanks TeamEurope) --- src/mame/drivers/stv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index dfbbb3452b4..80954a302cd 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -3130,7 +3130,7 @@ ROM_START( nclubv2 ) // unusual rom mapping compared to other games, the cartridge is a little different too, with a large PALCE16V8H-10 marked 315-6026 ROM_LOAD16_WORD_SWAP( "nclubv2.ic22", 0x0200000, 0x0200000, CRC(7e81676d) SHA1(fc0f0dcdb4aaf71218d7c1dd0e4ddc5381e8b13b) ) // OK ROM_LOAD16_WORD_SWAP( "nclubv2.ic24", 0x0600000, 0x0200000, CRC(1b7637de) SHA1(43c3094f60a6582298a45bad923fef57e98c5b2b) ) // OK - ROM_LOAD16_WORD_SWAP( "ic26", 0x0a00000, 0x0200000, CRC(614deea4) SHA1(4af01ad961c72399481ab3ffce08fc8d30184323) ) // fails rom check + ROM_LOAD16_WORD_SWAP( "nclubv2.ic26", 0x0a00000, 0x0200000, CRC(630be99d) SHA1(ac7fbaae98b126fad5228b0ebffa91a0f0a94516) ) // OK ROM_LOAD16_WORD_SWAP( "nclubv2.ic28", 0x0e00000, 0x0200000, CRC(1a3ca5e2) SHA1(4d3aed51d29c54e71175d828f648c9feb813ac04) ) // OK -- cgit v1.2.3-70-g09d2 From 0e38af3983da07bf564bb7b976fb08be03acb7e2 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 1 Feb 2016 17:57:54 +0000 Subject: evidence suggests there there aren't 2 channels. (nw) --- src/mame/machine/315-5838_317-0229_comp.cpp | 110 +++++++++++++--------------- src/mame/machine/315-5838_317-0229_comp.h | 16 ++-- 2 files changed, 61 insertions(+), 65 deletions(-) diff --git a/src/mame/machine/315-5838_317-0229_comp.cpp b/src/mame/machine/315-5838_317-0229_comp.cpp index 7660dbf6076..e83c8486ec0 100644 --- a/src/mame/machine/315-5838_317-0229_comp.cpp +++ b/src/mame/machine/315-5838_317-0229_comp.cpp @@ -12,15 +12,12 @@ Package Type: TQFP100 - This appears to be a dual channel compression chip, used in 1996, predating the 5881. - Decathlete uses it to compress ALL the game graphics, Dead or Alive uses it for a - dumb security check, decompressing a single string. + Decathlete accesses the chip at 2 different addresses, however, I don't think there + are 2 channels / sets of registers, instead the 2nd set of addresses are just a + mirror that allows access to a different set of source roms; the tables etc. are + re-uploaded before every transfer. - Each channel appears to be connected to a different set of ROMs, however there is - defintiely only a single 315-5838 chip. (could the different channels actually just - be mirror addresses, with part of the address determining the ROMs to use?) - - Dead of Alive only uses a single channel, and has the source data in RAM, not ROM. + Dead of Alive has the source data in RAM, not ROM. This is similar to how some 5881 games were set up, with the ST-V versions decrypting data directly from ROM and the Model 2 ones using a RAM source buffer. @@ -54,11 +51,12 @@ sega_315_5838_comp_device::sega_315_5838_comp_device(const machine_config &mconf void sega_315_5838_comp_device::device_start() { + m_decathlt_lastcount = 0; + m_decathlt_prot_uploadmode = 0; + m_decathlt_prot_uploadoffset = 0; + for (auto & elem : m_channel) { - elem.m_decathlt_lastcount = 0; - elem.m_decathlt_prot_uploadmode = 0; - elem.m_decathlt_prot_uploadoffset = 0; elem.m_read_ch.bind_relative_to(*owner()); } @@ -66,14 +64,10 @@ void sega_315_5838_comp_device::device_start() void sega_315_5838_comp_device::device_reset() { - for (auto & elem : m_channel) - { - elem.m_srcoffset = 0; - elem.m_decathlt_lastcount = 0; - elem.m_decathlt_prot_uploadmode = 0; - elem.m_decathlt_prot_uploadoffset = 0; - } - + m_srcoffset = 0; + m_decathlt_lastcount = 0; + m_decathlt_prot_uploadmode = 0; + m_decathlt_prot_uploadoffset = 0; m_protstate = 0; } @@ -105,46 +99,46 @@ UINT32 sega_315_5838_comp_device::genericdecathlt_prot_r(UINT32 mem_mask, int ch // UINT32 *fake0 = (UINT32*)memregion( ":fake0" )->base(); // UINT32 retvalue = 0xffff; - switch (m_channel[channel].m_srcoffset) + switch (m_srcoffset) { default: - m_channel[channel].m_decathlt_lastcount++; + m_decathlt_lastcount++; UINT32 tempdata = 0; - tempdata |= m_channel[channel].m_read_ch(m_channel[channel].m_srcoffset) << 0; - m_channel[channel].m_srcoffset++; - tempdata |= m_channel[channel].m_read_ch(m_channel[channel].m_srcoffset) << 16; - m_channel[channel].m_srcoffset++; + tempdata |= m_channel[channel].m_read_ch(m_srcoffset) << 0; + m_srcoffset++; + tempdata |= m_channel[channel].m_read_ch(m_srcoffset) << 16; + m_srcoffset++; #ifdef DEBUG_DATA_DUMP - //printf("read addr %08x, blah_r %08x - read count count %08x\n", m_channel[channel].m_srcoffset*2, tempdata, m_channel[channel].m_decathlt_lastcount*4); + //printf("read addr %08x, blah_r %08x - read count count %08x\n", m_srcoffset*2, tempdata, m_decathlt_lastcount*4); fwrite(&tempdata, 1, 4, tempfile); #else - logerror("read addr %08x, blah_r %08x - read count count %08x\n", m_channel[channel].m_srcoffset*2, tempdata, m_channel[channel].m_decathlt_lastcount*4); + logerror("read addr %08x, blah_r %08x - read count count %08x\n", m_srcoffset*2, tempdata, m_decathlt_lastcount*4); #endif return tempdata; #if 0 case 0x03228e4: - if (fake0) retvalue = fake0[(((0x20080/4)+m_channel[channel].m_decathlt_lastcount))]; - m_channel[channel].m_decathlt_lastcount++; + if (fake0) retvalue = fake0[(((0x20080/4)+m_decathlt_lastcount))]; + m_decathlt_lastcount++; return retvalue; case 0x00a9f3a: - if (fake0) retvalue = fake0[(((0x00000/4)+m_channel[channel].m_decathlt_lastcount))]; - m_channel[channel].m_decathlt_lastcount++; + if (fake0) retvalue = fake0[(((0x00000/4)+m_decathlt_lastcount))]; + m_decathlt_lastcount++; return retvalue; case 0x0213ab4: - if (fake0) retvalue = fake0[(((0x40000/4)+m_channel[channel].m_decathlt_lastcount))]; - m_channel[channel].m_decathlt_lastcount++; + if (fake0) retvalue = fake0[(((0x40000/4)+m_decathlt_lastcount))]; + m_decathlt_lastcount++; return retvalue; case 0x01efaf0: - if (fake0) retvalue = fake0[(((0x60000/4)+m_channel[channel].m_decathlt_lastcount))]; - m_channel[channel].m_decathlt_lastcount++; + if (fake0) retvalue = fake0[(((0x60000/4)+m_decathlt_lastcount))]; + m_decathlt_lastcount++; return retvalue; case 0x033f16c: @@ -185,14 +179,14 @@ UINT32 sega_315_5838_comp_device::genericdecathlt_prot_r(UINT32 mem_mask, int ch void sega_315_5838_comp_device::set_prot_addr(UINT32 data, UINT32 mem_mask, int channel) { // printf("set_prot_addr\n"); - COMBINE_DATA(&m_channel[channel].m_srcoffset); + COMBINE_DATA(&m_srcoffset); - //if (m_decathlt_part==0) logerror("%d, last read count was %06x\n",channel, m_channel[channel].m_decathlt_lastcount*4); - m_channel[channel].m_decathlt_lastcount = 0; + //if (m_decathlt_part==0) logerror("%d, last read count was %06x\n",channel, m_decathlt_lastcount*4); + m_decathlt_lastcount = 0; if (mem_mask == 0x0000ffff) { - printf("set source address to %08x (channel %d)\n", m_channel[channel].m_srcoffset, channel); + printf("set source address to %08x (channel %d)\n", m_srcoffset, channel); } @@ -203,24 +197,24 @@ void sega_315_5838_comp_device::set_prot_addr(UINT32 data, UINT32 mem_mask, int fclose(tempfile); char filename[256]; - sprintf(filename, "%d_compressed_%08x", channel, m_channel[channel].m_srcoffset * 2); + sprintf(filename, "%d_compressed_%08x", channel, m_srcoffset * 2); tempfile = fopen(filename, "w+b"); // the table and dictionary are uploaded repeatedly, usually before groups of data transfers but // it's always the same tables (one pair for each channel) { FILE* fp; - sprintf(filename, "%d_compressed_table1", channel); + sprintf(filename, "%d_compressed_table1_%08x", channel, m_srcoffset * 2); fp = fopen(filename, "w+b"); - fwrite(&m_channel[channel].m_decathlt_prottable1, 24, 2, fp); + fwrite(&m_decathlt_prottable1, 24, 2, fp); fclose(fp); } { FILE* fp; - sprintf(filename, "%d_compressed_dictionary", channel); + sprintf(filename, "%d_compressed_dictionary_%08x", channel, m_srcoffset * 2); fp = fopen(filename, "w+b"); - fwrite(&m_channel[channel].m_decathlt_dictionary, 128, 2, fp); + fwrite(&m_decathlt_dictionaryy, 128, 2, fp); fclose(fp); } } @@ -233,13 +227,13 @@ void sega_315_5838_comp_device::set_upload_mode(UINT16 data, int channel) if ((data == 0x8000) || (data == 0x0000)) { // logerror("changed to upload mode 1\n"); - m_channel[channel].m_decathlt_prot_uploadmode = 1; - m_channel[channel].m_decathlt_prot_uploadoffset = 0; + m_decathlt_prot_uploadmode = 1; + m_decathlt_prot_uploadoffset = 0; } else if ((data == 0x8080) || (data == 0x0080)) { - m_channel[channel].m_decathlt_prot_uploadmode = 2; - m_channel[channel].m_decathlt_prot_uploadoffset = 0; + m_decathlt_prot_uploadmode = 2; + m_decathlt_prot_uploadoffset = 0; } else { @@ -249,30 +243,30 @@ void sega_315_5838_comp_device::set_upload_mode(UINT16 data, int channel) void sega_315_5838_comp_device::upload_table_data(UINT16 data, int channel) { - if (m_channel[channel].m_decathlt_prot_uploadmode == 1) + if (m_decathlt_prot_uploadmode == 1) { - if (m_channel[channel].m_decathlt_prot_uploadoffset >= 24) + if (m_decathlt_prot_uploadoffset >= 24) { fatalerror("upload mode 1 error, too big\n"); return; } - //logerror("uploading table 1 %04x %04x\n",m_channel[channel].m_decathlt_prot_uploadoffset, data&0xffff); - m_channel[channel].m_decathlt_prottable1[m_channel[channel].m_decathlt_prot_uploadoffset] = data & 0xffff; - m_channel[channel].m_decathlt_prot_uploadoffset++; + //logerror("uploading table 1 %04x %04x\n",m_decathlt_prot_uploadoffset, data&0xffff); + m_decathlt_prottable1[m_decathlt_prot_uploadoffset] = data & 0xffff; + m_decathlt_prot_uploadoffset++; printf("unk table 1 %04x (channel %d)\n", data & 0xffff, channel); } - else if (m_channel[channel].m_decathlt_prot_uploadmode == 2) + else if (m_decathlt_prot_uploadmode == 2) { - if (m_channel[channel].m_decathlt_prot_uploadoffset >= 128) + if (m_decathlt_prot_uploadoffset >= 128) { fatalerror("upload mode 2 error, too big\n"); return; } - //logerror("uploading table 2 %04x %04x\n",m_channel[channel].m_decathlt_prot_uploadoffset, data&0xffff); - m_channel[channel].m_decathlt_dictionary[m_channel[channel].m_decathlt_prot_uploadoffset] = data & 0xffff; - m_channel[channel].m_decathlt_prot_uploadoffset++; + //logerror("uploading table 2 %04x %04x\n",m_decathlt_prot_uploadoffset, data&0xffff); + m_decathlt_dictionaryy[m_decathlt_prot_uploadoffset] = data & 0xffff; + m_decathlt_prot_uploadoffset++; printf("dictionary %04x (channel %d)\n", data & 0xffff, channel); } } diff --git a/src/mame/machine/315-5838_317-0229_comp.h b/src/mame/machine/315-5838_317-0229_comp.h index 2fd0904450e..4ad6070ab84 100644 --- a/src/mame/machine/315-5838_317-0229_comp.h +++ b/src/mame/machine/315-5838_317-0229_comp.h @@ -65,17 +65,19 @@ protected: virtual void device_reset() override; private: + UINT16 m_decathlt_prottable1[24]; + UINT16 m_decathlt_dictionaryy[128]; + + UINT32 m_srcoffset; + + UINT32 m_decathlt_lastcount; + UINT32 m_decathlt_prot_uploadmode; + UINT32 m_decathlt_prot_uploadoffset; + // Decathlete specific variables and functions (see machine/decathlt.c) struct channel_type { - UINT32 m_srcoffset; - UINT16 m_decathlt_prottable1[24]; - UINT16 m_decathlt_dictionary[128]; - - UINT32 m_decathlt_lastcount; - UINT32 m_decathlt_prot_uploadmode; - UINT32 m_decathlt_prot_uploadoffset; sega_dec_read_delegate m_read_ch; }; -- cgit v1.2.3-70-g09d2 From 0cd30c1a664c7389b7982076432c3d4d9c613a9c Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 1 Feb 2016 19:41:07 +0000 Subject: clones Touche Me (set 2, harder) [system11] --- src/mame/arcade.lst | 1 + src/mame/drivers/ladyfrog.cpp | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 725487164ad..da2d866bef4 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -10864,6 +10864,7 @@ strvmstr // (c) 1986 Enerdyne Technologies Inc dorachan // (c) 1980 Craul Denshi ladyfrog // (c) 1990 Mondial Games toucheme +touchemea rabbit // (c) 1997 Electronic Arts tmmjprd // (c) 1997 Media / Sonnet tmpdoki // (c) 1998 Media Syouji diff --git a/src/mame/drivers/ladyfrog.cpp b/src/mame/drivers/ladyfrog.cpp index 9a4782366d9..cf99c2192eb 100644 --- a/src/mame/drivers/ladyfrog.cpp +++ b/src/mame/drivers/ladyfrog.cpp @@ -365,7 +365,24 @@ ROM_START( toucheme ) ROM_LOAD( "8.ic10", 0x20000, 0x10000, CRC(fc6808bf) SHA1(f1f1b75a79dfdb500012f9b52c6364f0a13dce2d) ) ROM_END +ROM_START( touchemea ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "2.ic107", 0x0000, 0x10000, CRC(4e72312d) SHA1(a7d178608f05c87a53c650298b903bcf34b3b755) ) // sldh + + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "1.ic115", 0x0000, 0x8000, CRC(902589aa) SHA1(d60088fc31a67fec91f908f671af77bb87a5e59c) ) + + ROM_REGION( 0x60000, "gfx1", ROMREGION_INVERT ) + ROM_LOAD( "3.ic32", 0x30000, 0x10000, CRC(223b4435) SHA1(fb5a4096012093bae5fda213a5de317e63a88ec3) ) + ROM_LOAD( "4.ic33", 0x40000, 0x10000, CRC(96dcc2f3) SHA1(9c61f8161771e40ca41b6e102bc04583dc97cd0d) ) + ROM_LOAD( "5.ic34", 0x50000, 0x10000, CRC(b8667a6b) SHA1(288a5cbd8fc01b24822e89fbc1e6d7f45c181483) ) + ROM_LOAD( "6.ic8", 0x00000, 0x10000, CRC(d257382f) SHA1(9c459b90c9ddfe90de4a252f29a7bee809412b46) ) + ROM_LOAD( "7.ic9", 0x10000, 0x10000, CRC(feb1b974) SHA1(ffd4527472cdf655fbebebf4d3abb61962e54457) ) + ROM_LOAD( "8.ic10", 0x20000, 0x10000, CRC(fc6808bf) SHA1(f1f1b75a79dfdb500012f9b52c6364f0a13dce2d) ) +ROM_END + GAME( 1990, ladyfrog, 0, ladyfrog, ladyfrog, driver_device, 0, ORIENTATION_SWAP_XY, "Mondial Games", "Lady Frog", MACHINE_SUPPORTS_SAVE ) // toucheme art style is similar to ladyfrog, so it's probably the same manufacturer -GAME( 19??, toucheme, 0, toucheme, toucheme, driver_device, 0, ORIENTATION_SWAP_XY, "", "Touche Me", MACHINE_SUPPORTS_SAVE ) +GAME( 19??, toucheme, 0, toucheme, toucheme, driver_device, 0, ORIENTATION_SWAP_XY, "", "Touche Me (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 19??, touchemea,toucheme, toucheme, toucheme, driver_device, 0, ORIENTATION_SWAP_XY, "", "Touche Me (set 2, harder)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From 59e2e7e7ff3a43f62e23e5f26231cf5c5557a194 Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 1 Feb 2016 21:03:59 +0100 Subject: Moved sprite irq DMA into a timer callback, nw --- src/mame/drivers/overdriv.cpp | 26 ++++++++++++++++++++------ src/mame/includes/overdriv.h | 5 ++++- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index 7d14ae9aca0..bbe9774e7f9 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -82,7 +82,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(overdriv_state::overdriv_cpuA_scanline) { // m_screen->frame_number() & 1 m_maincpu->set_input_line(4, HOLD_LINE); - m_subcpu->set_input_line(4, HOLD_LINE); // likely wrong } else if(m_fake_timer >= timer_threshold) // timer irq { @@ -91,13 +90,12 @@ TIMER_DEVICE_CALLBACK_MEMBER(overdriv_state::overdriv_cpuA_scanline) } } +#ifdef UNUSED_FUNCTION INTERRUPT_GEN_MEMBER(overdriv_state::cpuB_interrupt) { // this doesn't get turned on until the irq has happened? wrong irq? - if (m_k053246->k053246_is_irq_enabled()) - m_subcpu->set_input_line(6, HOLD_LINE); // likely wrong } - +#endif WRITE16_MEMBER(overdriv_state::cpuA_ctrl_w) { @@ -149,6 +147,7 @@ WRITE16_MEMBER(overdriv_state::overdriv_cpuB_irq_x_w) WRITE16_MEMBER(overdriv_state::overdriv_cpuB_irq_y_w) { + m_subcpu->set_input_line(4, HOLD_LINE); } static ADDRESS_MAP_START( overdriv_master_map, AS_PROGRAM, 16, overdriv_state ) @@ -203,6 +202,19 @@ WRITE16_MEMBER( overdriv_state::overdriv_k053246_word_w ) } #endif +TIMER_CALLBACK_MEMBER(overdriv_state::objdma_end_cb ) +{ + m_subcpu->set_input_line(6, HOLD_LINE); +} + +WRITE16_MEMBER(overdriv_state::objdma_w) +{ + if(data & 0x10) + machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(overdriv_state::objdma_end_cb), this)); + + m_k053246->k053246_w(space,5,data,mem_mask); +} + static ADDRESS_MAP_START( overdriv_slave_map, AS_PROGRAM, 16, overdriv_state ) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x080000, 0x083fff) AM_RAM /* work RAM */ @@ -212,6 +224,7 @@ static ADDRESS_MAP_START( overdriv_slave_map, AS_PROGRAM, 16, overdriv_state ) AM_RANGE(0x118000, 0x118fff) AM_DEVREADWRITE("k053246", k053247_device, k053247_word_r, k053247_word_w) // data gets copied to sprite chip with DMA.. AM_RANGE(0x120000, 0x120001) AM_DEVREAD("k053246", k053247_device, k053246_word_r) AM_RANGE(0x128000, 0x128001) AM_READWRITE(cpuB_ctrl_r, cpuB_ctrl_w) /* enable K053247 ROM reading, plus something else */ + AM_RANGE(0x130004, 0x130005) AM_WRITE(objdma_w) AM_RANGE(0x130000, 0x130007) AM_DEVREADWRITE8("k053246", k053247_device, k053246_r,k053246_w,0xffff) //AM_RANGE(0x140000, 0x140001) used in later stages AM_RANGE(0x200000, 0x203fff) AM_RAM AM_SHARE("share1") @@ -303,8 +316,9 @@ static MACHINE_CONFIG_START( overdriv, overdriv_state ) MCFG_CPU_ADD("sub", M68000, XTAL_24MHz/2) /* 12 MHz */ MCFG_CPU_PROGRAM_MAP(overdriv_slave_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", overdriv_state, cpuB_interrupt) /* IRQ 5 and 6 are generated by the main CPU. */ - /* IRQ 5 is used only in test mode, to request the checksums of the gfx ROMs. */ + //MCFG_CPU_VBLANK_INT_DRIVER("screen", overdriv_state, cpuB_interrupt) + /* IRQ 5 and 6 are generated by the main CPU. */ + /* IRQ 5 is used only in test mode, to request the checksums of the gfx ROMs. */ MCFG_CPU_ADD("audiocpu", M6809, XTAL_3_579545MHz) /* 1.789 MHz?? This might be the right speed, but ROM testing */ MCFG_CPU_PROGRAM_MAP(overdriv_sound_map) /* takes a little too much (the counter wraps from 0000 to 9999). */ diff --git a/src/mame/includes/overdriv.h b/src/mame/includes/overdriv.h index b5a7c8fa2e0..ca83195e655 100644 --- a/src/mame/includes/overdriv.h +++ b/src/mame/includes/overdriv.h @@ -53,10 +53,13 @@ public: DECLARE_WRITE8_MEMBER(sound_ack_w); DECLARE_WRITE16_MEMBER(overdriv_cpuB_irq_x_w); DECLARE_WRITE16_MEMBER(overdriv_cpuB_irq_y_w); + DECLARE_WRITE16_MEMBER(objdma_w); + TIMER_CALLBACK_MEMBER(objdma_end_cb); + virtual void machine_start() override; virtual void machine_reset() override; UINT32 screen_update_overdriv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(cpuB_interrupt); + //INTERRUPT_GEN_MEMBER(cpuB_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(overdriv_cpuA_scanline); int m_fake_timer; -- cgit v1.2.3-70-g09d2 From 518e4be5983aa952abac85255cf58e0adf8e429a Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 1 Feb 2016 21:07:43 +0100 Subject: Better naming for master-to-slave-irq-assertion, nw --- src/mame/drivers/overdriv.cpp | 16 ++++++++++------ src/mame/includes/overdriv.h | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index bbe9774e7f9..e969fe28aa9 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -140,14 +140,18 @@ WRITE16_MEMBER(overdriv_state::overdriv_soundirq_w) } -WRITE16_MEMBER(overdriv_state::overdriv_cpuB_irq_x_w) + + +WRITE16_MEMBER(overdriv_state::slave_irq4_assert_w) { - m_subcpu->set_input_line(5, HOLD_LINE); // likely wrong + // used in-game + m_subcpu->set_input_line(4, HOLD_LINE); } -WRITE16_MEMBER(overdriv_state::overdriv_cpuB_irq_y_w) +WRITE16_MEMBER(overdriv_state::slave_irq5_assert_w) { - m_subcpu->set_input_line(4, HOLD_LINE); + // tests GFX ROMs with this irq (indeed enabled only in test mode) + m_subcpu->set_input_line(5, HOLD_LINE); } static ADDRESS_MAP_START( overdriv_master_map, AS_PROGRAM, 16, overdriv_state ) @@ -173,8 +177,8 @@ static ADDRESS_MAP_START( overdriv_master_map, AS_PROGRAM, 16, overdriv_state ) AM_RANGE(0x218000, 0x218fff) AM_DEVREADWRITE8("k051316_2", k051316_device, read, write, 0xff00) AM_RANGE(0x220000, 0x220fff) AM_DEVREAD8("k051316_1", k051316_device, rom_r, 0xff00) AM_RANGE(0x228000, 0x228fff) AM_DEVREAD8("k051316_2", k051316_device, rom_r, 0xff00) - AM_RANGE(0x230000, 0x230001) AM_WRITE(overdriv_cpuB_irq_y_w) - AM_RANGE(0x238000, 0x238001) AM_WRITE(overdriv_cpuB_irq_x_w) + AM_RANGE(0x230000, 0x230001) AM_WRITE(slave_irq4_assert_w) + AM_RANGE(0x238000, 0x238001) AM_WRITE(slave_irq5_assert_w) ADDRESS_MAP_END #ifdef UNUSED_FUNCTION diff --git a/src/mame/includes/overdriv.h b/src/mame/includes/overdriv.h index ca83195e655..9b5cc1b2cd2 100644 --- a/src/mame/includes/overdriv.h +++ b/src/mame/includes/overdriv.h @@ -51,8 +51,8 @@ public: DECLARE_WRITE16_MEMBER(cpuB_ctrl_w); DECLARE_WRITE16_MEMBER(overdriv_soundirq_w); DECLARE_WRITE8_MEMBER(sound_ack_w); - DECLARE_WRITE16_MEMBER(overdriv_cpuB_irq_x_w); - DECLARE_WRITE16_MEMBER(overdriv_cpuB_irq_y_w); + DECLARE_WRITE16_MEMBER(slave_irq4_assert_w); + DECLARE_WRITE16_MEMBER(slave_irq5_assert_w); DECLARE_WRITE16_MEMBER(objdma_w); TIMER_CALLBACK_MEMBER(objdma_end_cb); -- cgit v1.2.3-70-g09d2 From 676af54e8eca0ddaea2fe00d11c90e5897d3a3cc Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 1 Feb 2016 20:37:13 +0000 Subject: new clones Multi Champ (World, older) [f205v] --- src/mame/arcade.lst | 3 ++- src/mame/drivers/esd16.cpp | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index da2d866bef4..078e57d5902 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -9857,8 +9857,9 @@ spec2kh // (c) 2000 Yonatech // ESD games // http://www.esdgame.co.kr/english/ -multchmp // (c) 1998 (World) +multchmp // (c) 1999 (World) multchmpk // (c) 1998 (Korea) +multchmpa // (c) 1998 (World) mchampdx // (c) 1999 ESD mchampdxa // (c) 1999 ESD mchampdxb // (c) 1999 ESD diff --git a/src/mame/drivers/esd16.cpp b/src/mame/drivers/esd16.cpp index 8ba0616585e..01f12b0de2b 100644 --- a/src/mame/drivers/esd16.cpp +++ b/src/mame/drivers/esd16.cpp @@ -826,6 +826,37 @@ ROM_START( multchmpk ) ROM_LOAD( "esd4.su10", 0x00000, 0x20000, CRC(6e741fcd) SHA1(742e0952916c00f67dd9f8d01e721a9a538d2fc4) ) ROM_END +ROM_START( multchmpa ) + ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "esd2.cu02", 0x000000, 0x040000, CRC(bfd39198) SHA1(11c0cb7a865daa1be9301ddfa5f5d2014e8f9908) ) + ROM_LOAD16_BYTE( "esd1.cu03", 0x000001, 0x040000, CRC(cd769077) SHA1(741cca679393dab031691834874c96fee791241e) ) + + ROM_REGION( 0x40000, "audiocpu", 0 ) /* Z80 Code */ + ROM_LOAD( "esd3.su01", 0x00000, 0x20000, CRC(7c178bd7) SHA1(8754d3c70d9b2bf369a5ce0cce4cc0696ed22750) ) + + ROM_REGION( 0x180000, "spr", 0 ) /* Sprites, 16x16x5 */ + ROM_LOAD16_BYTE( "esd17.ju06", 0x000000, 0x040000, CRC(51f01067) SHA1(d5ebbc7d358b63724d2f24da8b2ce4a202be37a5) ) + ROM_LOAD16_BYTE( "esd16.ju05", 0x000001, 0x040000, CRC(88e252e8) SHA1(07d898379798c6be42b636762b0af61b9111a480) ) + ROM_LOAD16_BYTE( "esd15.ju04", 0x080000, 0x040000, CRC(b1ae7f08) SHA1(37dd9d4cef8b9e1d09d7b46a9794fb2b777c9a01) ) + ROM_LOAD16_BYTE( "esd14.ju03", 0x080001, 0x040000, CRC(d8f06fa8) SHA1(f76912f93f99578529612a7f01d82ac7229a8e41) ) + ROM_LOAD16_BYTE( "esd13.ju07", 0x100000, 0x040000, CRC(9d1590a6) SHA1(35f634dbf0df06ec62359c7bae43c7f5d14b0ab2) ) + + ROM_REGION( 0x400000, "bgs", 0 ) /* Layers, 16x16x8 */ + ROM_LOAD32_BYTE( "esd9.fu28", 0x000000, 0x080000, CRC(a3cfe895) SHA1(a8dc0d5d9e64d4c5112177b8f20b5bdb86ca73af) ) + ROM_LOAD32_BYTE( "esd11.fu29", 0x000001, 0x080000, CRC(d3c1855e) SHA1(bb547d4a45a745e9ae4a6727087cdf325105de90) ) + ROM_LOAD32_BYTE( "esd7.fu26", 0x000002, 0x080000, CRC(042d59ff) SHA1(8e45a4757e07d8aaf50b151d8849c1a27424e64b) ) + ROM_LOAD32_BYTE( "esd5.fu27", 0x000003, 0x080000, CRC(ed5b4e58) SHA1(82c3ee9e2525c0b370a29d5560c21ec6380d1a43) ) + ROM_LOAD32_BYTE( "esd10.fu31", 0x200000, 0x080000, CRC(396d77b6) SHA1(f22449a7f9f50e172e36db4f399c14e527409884) ) + ROM_LOAD32_BYTE( "esd12.fu33", 0x200001, 0x080000, CRC(a68848a8) SHA1(915239a961d76af6a1a567eb89b1569f158e714e) ) + ROM_LOAD32_BYTE( "esd8.fu30", 0x200002, 0x080000, CRC(fa8cd2d3) SHA1(ddc1b98867e6d2eee458bf35a933e7cdc59f4c7e) ) + ROM_LOAD32_BYTE( "esd6.fu32", 0x200003, 0x080000, CRC(97fde7b1) SHA1(b3610f6fcc1367ff079dc01121c86bc1e1f4c7a2) ) + + ROM_REGION( 0x40000, "oki", 0 ) /* Samples */ + ROM_LOAD( "esd4.su08", 0x00000, 0x20000, CRC(6e741fcd) SHA1(742e0952916c00f67dd9f8d01e721a9a538d2fc4) ) +ROM_END + + + /* Multi Champ Deluxe @@ -1530,7 +1561,9 @@ ROM_END /* ESD 11-09-98 */ GAME( 1999, multchmp, 0, esd16, multchmp, driver_device, 0, ROT0, "ESD", "Multi Champ (World, ver. 2.5)", MACHINE_SUPPORTS_SAVE ) -GAME( 1998, multchmpk,multchmp, esd16, multchmp, driver_device, 0, ROT0, "ESD", "Multi Champ (Korea)", MACHINE_SUPPORTS_SAVE ) +GAME( 1998, multchmpk,multchmp, esd16, multchmp, driver_device, 0, ROT0, "ESD", "Multi Champ (Korea, older)", MACHINE_SUPPORTS_SAVE ) +GAME( 1998, multchmpa,multchmp, esd16, multchmp, driver_device, 0, ROT0, "ESD", "Multi Champ (World, older)", MACHINE_SUPPORTS_SAVE ) + GAME( 2001, jumppop, 0, jumppop, jumppop, driver_device, 0, ROT0, "ESD", "Jumping Pop (set 1)", MACHINE_SUPPORTS_SAVE ) /* Redesigned(?) ESD 11-09-98 with no ID# */ GAME( 2001, jumppope, jumppop, jumppop, jumppop, driver_device, 0, ROT0, "Emag Soft", "Jumping Pop (set 2)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From bb032db5db3888d28c513b47e63b4dd1e10f45ca Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 1 Feb 2016 21:38:02 +0100 Subject: Note, nw --- src/mame/drivers/overdriv.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index e969fe28aa9..233da503224 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -230,9 +230,9 @@ static ADDRESS_MAP_START( overdriv_slave_map, AS_PROGRAM, 16, overdriv_state ) AM_RANGE(0x128000, 0x128001) AM_READWRITE(cpuB_ctrl_r, cpuB_ctrl_w) /* enable K053247 ROM reading, plus something else */ AM_RANGE(0x130004, 0x130005) AM_WRITE(objdma_w) AM_RANGE(0x130000, 0x130007) AM_DEVREADWRITE8("k053246", k053247_device, k053246_r,k053246_w,0xffff) - //AM_RANGE(0x140000, 0x140001) used in later stages + //AM_RANGE(0x140000, 0x140001) used in later stages, set after writes at 0x208000-0x20bfff range AM_RANGE(0x200000, 0x203fff) AM_RAM AM_SHARE("share1") - AM_RANGE(0x208000, 0x20bfff) AM_RAM + AM_RANGE(0x208000, 0x20bfff) AM_RAM // sprite indirect table? AM_RANGE(0x218000, 0x219fff) AM_DEVREAD("k053250_1", k053250_device, rom_r) AM_RANGE(0x220000, 0x221fff) AM_DEVREAD("k053250_2", k053250_device, rom_r) ADDRESS_MAP_END -- cgit v1.2.3-70-g09d2 From 4ba9de3b750206e601de667450b8d254074e6850 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 1 Feb 2016 22:10:42 +0000 Subject: pasted wrong crcs (nw) --- src/mame/drivers/stv.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index 80954a302cd..ce0ce699750 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -2963,11 +2963,11 @@ ROM_START( pclub27s ) // set to 1p ROM_LOAD16_WORD_SWAP( "pclub2v7.IC22", 0x0200000, 0x0200000, CRC(44c8ab27) SHA1(65e2705b2918da32ea40375707df4e148b311159) ) ROM_LOAD16_WORD_SWAP( "pclub2v7.IC24", 0x0400000, 0x0200000, CRC(24818437) SHA1(5293d45b53680301abaf0b32a62596aaaa2552d6) ) ROM_LOAD16_WORD_SWAP( "pclub2v7.IC26", 0x0600000, 0x0200000, CRC(076c1d44) SHA1(d597ed4524bb03eb0ef8ada08d49f3dc0fc8136d) ) - ROM_LOAD16_WORD_SWAP( "pclub2v7.IC28", 0x0800000, 0x0200000, CRC(03b9eacf) SHA1(d69c10f7613d9f52042dd6cce64e74e2b1ecc2d8) ) - ROM_LOAD16_WORD_SWAP( "pclub2v7.IC30", 0x0a00000, 0x0200000, CRC(e58c7167) SHA1(d88b1648c5d86a90615a8c6a1bf87bc9e75dc320) ) + ROM_LOAD16_WORD_SWAP( "pclub2v7.IC28", 0x0800000, 0x0200000, CRC(ff9643ca) SHA1(3309f970f87324b06cc48add386019f769abcd89) ) + ROM_LOAD16_WORD_SWAP( "pclub2v7.IC30", 0x0a00000, 0x0200000, CRC(03b9eacf) SHA1(d69c10f7613d9f52042dd6cce64e74e2b1ecc2d8) ) ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player - ROM_LOAD( "pclub27s.nv", 0x0000, 0x0080, CRC(323dd0f2) SHA1(457282b5d40a17477b95330bba91e05c603f951e) ) + ROM_LOAD( "pclub27s.nv", 0x0000, 0x0080, CRC(e58c7167) SHA1(d88b1648c5d86a90615a8c6a1bf87bc9e75dc320) ) ROM_END ROM_START( pclubyo2 ) // set to 1p -- cgit v1.2.3-70-g09d2 From 5e8d6c57bd99293eeee8328b4b392b97c1756438 Mon Sep 17 00:00:00 2001 From: yz70s Date: Mon, 1 Feb 2016 23:28:56 +0100 Subject: chihiro.cpp: add backface culling to 3d accelerator (nw) --- src/mame/includes/chihiro.h | 16 +++++++++++ src/mame/video/chihiro.cpp | 68 +++++++++++++++++++++++++++++++++------------ 2 files changed, 67 insertions(+), 17 deletions(-) diff --git a/src/mame/includes/chihiro.h b/src/mame/includes/chihiro.h index 0f68747059a..0a1915157c6 100644 --- a/src/mame/includes/chihiro.h +++ b/src/mame/includes/chihiro.h @@ -346,6 +346,15 @@ public: B8 = 9, G8B8 = 10 }; + enum class NV2A_GL_FRONT_FACE { + CW = 0x0900, + CCW = 0x0901 + }; + enum class NV2A_GL_CULL_FACE { + FRONT = 0x0404, + BACK = 0x0405, + FRONT_AND_BACK = 0x0408 + }; nv2a_renderer(running_machine &machine) : poly_manager(machine) { @@ -363,6 +372,9 @@ public: indexesleft_count = 0; vertex_pipeline = 4; color_mask = 0xffffffff; + backface_culling_enabled = false; + backface_culling_winding = NV2A_GL_FRONT_FACE::CCW; + backface_culling_culled = NV2A_GL_CULL_FACE::BACK; alpha_test_enabled = false; alpha_reference = 0; alpha_func = NV2A_COMPARISON_OP::ALWAYS; @@ -464,6 +476,7 @@ public: int read_vertices_0x1810(address_space & space, vertex_nv *destination, int offset, int limit); int read_vertices_0x1818(address_space & space, vertex_nv *destination, UINT32 address, int limit); void convert_vertices_poly(vertex_nv *source, vertex_t *destination, int count); + UINT32 render_triangle_culling(const rectangle &cliprect, render_delegate callback, int paramcount, const vertex_t &_v1, const vertex_t &_v2, const vertex_t &_v3); void clear_render_target(int what, UINT32 value); void clear_depth_buffer(int what, UINT32 value); inline UINT8 *direct_access_ptr(offs_t address); @@ -630,6 +643,9 @@ public: std::mutex lock; } combiner; UINT32 color_mask; + bool backface_culling_enabled; + NV2A_GL_FRONT_FACE backface_culling_winding; + NV2A_GL_CULL_FACE backface_culling_culled; bool alpha_test_enabled; NV2A_COMPARISON_OP alpha_func; int alpha_reference; diff --git a/src/mame/video/chihiro.cpp b/src/mame/video/chihiro.cpp index e6c8e578bb6..845110e59b4 100644 --- a/src/mame/video/chihiro.cpp +++ b/src/mame/video/chihiro.cpp @@ -2549,6 +2549,25 @@ void nv2a_renderer::clear_depth_buffer(int what, UINT32 value) } } +UINT32 nv2a_renderer::render_triangle_culling(const rectangle &cliprect, render_delegate callback, int paramcount, const vertex_t &_v1, const vertex_t &_v2, const vertex_t &_v3) +{ + float areax2; + + if (backface_culling_enabled == false) + return render_triangle(cliprect, callback, paramcount, _v1, _v2, _v3); + if (backface_culling_culled == NV2A_GL_CULL_FACE::FRONT_AND_BACK) + return 0; + areax2 = _v1.x*(_v2.y - _v3.y) + _v2.x*(_v3.y - _v1.y) + _v3.x*(_v1.y - _v2.y); + if (backface_culling_winding == NV2A_GL_FRONT_FACE::CCW) + areax2 = -areax2; + // if areax2 >= 0 then front faced else back faced + if ((backface_culling_culled == NV2A_GL_CULL_FACE::FRONT) && (areax2 >= 0)) + return 0; + if ((backface_culling_culled == NV2A_GL_CULL_FACE::BACK) && (areax2 < 0)) + return 0; + return render_triangle(cliprect, callback, paramcount, _v1, _v2, _v3); +} + int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UINT32 subchannel, UINT32 method, UINT32 address, int &countlen) { UINT32 maddress; @@ -2592,7 +2611,9 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN for (n = 0; n <= count; n += 4) { read_vertices_0x1810(space, vertex_software + vertex_first, n + offset, 4); convert_vertices_poly(vertex_software + vertex_first, vertex_xy + vertex_first, 4); - render_polygon<4>(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy + vertex_first); // 4 rgba, 4 texture units 2 uv + //render_polygon<4>(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy + vertex_first); // 4 rgba, 4 texture units 2 uv + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[vertex_first + 1], vertex_xy[vertex_first + 2]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[vertex_first + 2], vertex_xy[vertex_first + 3]); vertex_first = (vertex_first + 4) & 1023; vertex_count = vertex_count + 4; wait(); @@ -2602,7 +2623,7 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN for (n = 0; n <= count; n += 3) { read_vertices_0x1810(space, vertex_software + vertex_first, n + offset, 3); convert_vertices_poly(vertex_software + vertex_first, vertex_xy + vertex_first, 3); - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[(vertex_first + 1) & 1023], vertex_xy[(vertex_first + 2) & 1023]); // 4 rgba, 4 texture units 2 uv + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[(vertex_first + 1) & 1023], vertex_xy[(vertex_first + 2) & 1023]); // 4 rgba, 4 texture units 2 uv vertex_first = (vertex_first + 3) & 1023; vertex_count = vertex_count + 3; wait(); @@ -2624,7 +2645,7 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN for (n = 0; n <= count; n++) { read_vertices_0x1810(space, vertex_software + vertex_first, offset + n, 1); convert_vertices_poly(vertex_software + vertex_first, vertex_xy + vertex_first, 1); - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[1024], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[1024], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); vertex_first = (vertex_first + 1) & 1023; vertex_count = vertex_count + 1; wait(); @@ -2645,9 +2666,9 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN read_vertices_0x1810(space, vertex_software + vertex_first, offset + n, 1); convert_vertices_poly(vertex_software + vertex_first, vertex_xy + vertex_first, 1); if ((vertex_count & 1) == 0) - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); else - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[vertex_first], vertex_xy[(vertex_first - 1) & 1023]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[vertex_first], vertex_xy[(vertex_first - 1) & 1023]); vertex_first = (vertex_first + 1) & 1023; vertex_count = vertex_count + 1; wait(); @@ -2691,7 +2712,9 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN address = address + c * 4; countlen = countlen - c; convert_vertices_poly(vertex_software + vertex_first, vertex_xy + vertex_first, 4); - render_polygon<4>(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy + vertex_first); // 4 rgba, 4 texture units 2 uv + //render_polygon<4>(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy + vertex_first); // 4 rgba, 4 texture units 2 uv + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[vertex_first + 1], vertex_xy[vertex_first + 2]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[vertex_first + 2], vertex_xy[vertex_first + 3]); vertex_first = (vertex_first + 4) & 1023; vertex_count = vertex_count + 4; wait(); @@ -2733,7 +2756,7 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN convert_vertices_poly(vertex_software + vertex_first, vertex_xy + vertex_first, 1); address = address + c * 4; countlen = countlen - c; - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[1024], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[1024], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); vertex_first = (vertex_first + 1) & 1023; vertex_count = vertex_count + 1; wait(); @@ -2753,7 +2776,7 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN address = address + c * 4; countlen = countlen - c; convert_vertices_poly(vertex_software + vertex_first, vertex_xy + vertex_first, 3); - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[(vertex_first + 1) & 1023], vertex_xy[(vertex_first + 2) & 1023]); // 4 rgba, 4 texture units 2 uv + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[(vertex_first + 1) & 1023], vertex_xy[(vertex_first + 2) & 1023]); // 4 rgba, 4 texture units 2 uv vertex_first = (vertex_first + 3) & 1023; vertex_count = vertex_count + 3; wait(); @@ -2789,9 +2812,9 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN countlen = countlen - c; convert_vertices_poly(vertex_software + vertex_first, vertex_xy + vertex_first, 1); if ((vertex_count & 1) == 0) - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); else - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[vertex_first], vertex_xy[(vertex_first - 1) & 1023]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[vertex_first], vertex_xy[(vertex_first - 1) & 1023]); vertex_first = (vertex_first + 1) & 1023; vertex_count = vertex_count + 1; wait(); @@ -2849,7 +2872,9 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN break; } address = address + c * 4; - render_polygon<4>(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy); // 4 rgba, 4 texture units 2 uv + //render_polygon<4>(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy); // 4 rgba, 4 texture units 2 uv + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[vertex_first + 1], vertex_xy[vertex_first + 2]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[vertex_first + 2], vertex_xy[vertex_first + 3]); vertex_first = (vertex_first + 4) & 1023; vertex_count = vertex_count + 4; wait(); @@ -2877,8 +2902,8 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN return 0; } address = address + c * 4; - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[n & 3], vertex_xy[(n + 1) & 3], vertex_xy[(n + 2) & 3]); - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(n + 2) & 3], vertex_xy[(n + 1) & 3], vertex_xy[(n + 3) & 3]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[n & 3], vertex_xy[(n + 1) & 3], vertex_xy[(n + 2) & 3]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(n + 2) & 3], vertex_xy[(n + 1) & 3], vertex_xy[(n + 3) & 3]); wait(); } } @@ -2914,7 +2939,7 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN } address = address + c * 4; convert_vertices_poly(vertex_software + vertex_first, vertex_xy + vertex_first, 1); - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[1024], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[1024], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); vertex_first = (vertex_first + 1) & 1023; vertex_count = vertex_count + 1; wait(); @@ -2933,7 +2958,7 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN break; } address = address + c * 4; - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[(vertex_first + 1) & 1023], vertex_xy[(vertex_first + 2) & 1023]); // 4 rgba, 4 texture units 2 uv + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[vertex_first], vertex_xy[(vertex_first + 1) & 1023], vertex_xy[(vertex_first + 2) & 1023]); // 4 rgba, 4 texture units 2 uv vertex_first = (vertex_first + 3) & 1023; vertex_count = vertex_count + 3; wait(); @@ -2968,9 +2993,9 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN } address = address + c * 4; if ((vertex_count & 1) == 0) - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[(vertex_first - 1) & 1023], vertex_xy[vertex_first]); else - render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[vertex_first], vertex_xy[(vertex_first - 1) & 1023]); + render_triangle_culling(limits_rendertarget, renderspans, 4 + 4 * 2, vertex_xy[(vertex_first - 2) & 1023], vertex_xy[vertex_first], vertex_xy[(vertex_first - 1) & 1023]); vertex_first = (vertex_first + 1) & 1023; vertex_count = vertex_count + 1; wait(); @@ -3028,6 +3053,15 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN } if ((maddress == 0x1d6c) || (maddress == 0x1d70) || (maddress == 0x1a4)) countlen--; + if (maddress == 0x0308) { + backface_culling_enabled = data != 0 ? true : false; + } + if (maddress == 0x03a0) { + backface_culling_winding = (NV2A_GL_FRONT_FACE)data; + } + if (maddress == 0x039c) { + backface_culling_culled = (NV2A_GL_CULL_FACE)data; + } if (maddress == 0x019c) { geforce_read_dma_object(data, dma_offset[0], dma_size[0]); } -- cgit v1.2.3-70-g09d2 From b222e6257453b3ca77cee403535e6a5becf4d5ee Mon Sep 17 00:00:00 2001 From: Brandon Munger Date: Mon, 1 Feb 2016 17:54:57 -0500 Subject: r9751: Added more dma registers for serial and floppy --- src/mame/drivers/r9751.cpp | 64 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/src/mame/drivers/r9751.cpp b/src/mame/drivers/r9751.cpp index 5ca1d8d153a..3503b5dde4f 100644 --- a/src/mame/drivers/r9751.cpp +++ b/src/mame/drivers/r9751.cpp @@ -67,6 +67,8 @@ public: DECLARE_READ32_MEMBER(r9751_mmio_5ff_r); DECLARE_WRITE32_MEMBER(r9751_mmio_5ff_w); + DECLARE_READ32_MEMBER(r9751_mmio_ff01_r); + DECLARE_WRITE32_MEMBER(r9751_mmio_ff01_w); DECLARE_READ32_MEMBER(r9751_mmio_ff05_r); DECLARE_WRITE32_MEMBER(r9751_mmio_ff05_w); DECLARE_READ32_MEMBER(r9751_mmio_fff8_r); @@ -90,6 +92,8 @@ private: UINT32 fdd_dest_address; // 5FF080B0 UINT32 fdd_cmd_complete; UINT32 smioc_out_addr; + UINT32 smioc_dma_bank; + UINT32 fdd_dma_bank; attotime timer_32khz_last; // End registers @@ -110,12 +114,16 @@ UINT32 r9751_state::swap_uint32( UINT32 val ) READ8_MEMBER(r9751_state::pdc_dma_r) { - return m_maincpu->space(AS_PROGRAM).read_byte(offset); + /* This callback function takes the value written to 0xFF01000C as the bank offset */ + UINT32 address = (fdd_dma_bank & 0x7FFFF800) + (offset&0xFFFF); + return m_maincpu->space(AS_PROGRAM).read_byte(address); } WRITE8_MEMBER(r9751_state::pdc_dma_w) { - m_maincpu->space(AS_PROGRAM).write_byte(m_pdc->fdd_68k_dma_address,data); + /* This callback function takes the value written to 0xFF01000C as the bank offset */ + UINT32 address = (fdd_dma_bank & 0x7FFFF800) + (data&0xFFFF); + m_maincpu->space(AS_PROGRAM).write_byte(m_pdc->fdd_68k_dma_address,address); } DRIVER_INIT_MEMBER(r9751_state,r9751) @@ -123,9 +131,10 @@ DRIVER_INIT_MEMBER(r9751_state,r9751) reg_ff050004 = 0; reg_fff80040 = 0; fdd_dest_address = 0; -// fdd_scsi_command = 0; fdd_cmd_complete = 0; + fdd_dma_bank = 0; smioc_out_addr = 0; + smioc_dma_bank = 0; m_mem = &m_maincpu->space(AS_PROGRAM); } @@ -199,7 +208,7 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w ) switch(data) { case 0x4100: /* Send byte to serial */ - if(TRACE_SMIOC) logerror("Serial byte: %02X\n", m_mem->read_dword(smioc_out_addr)); + if(TRACE_SMIOC) logerror("Serial byte: %02X PC: %08X\n", m_mem->read_dword(smioc_out_addr), space.machine().firstcpu->pc()); m_terminal->write(space,0,m_mem->read_dword(smioc_out_addr)); break; default: @@ -207,7 +216,9 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w ) } break; case 0x5FF0C098: /* Serial DMA output address */ - smioc_out_addr = data * 2; + //smioc_out_addr = data * 2; + smioc_out_addr = (smioc_dma_bank & 0x7FFFF800) | ((data&0x3FF)<<1); + if(TRACE_SMIOC) logerror("Serial output address: %08X PC: %08X\n", smioc_out_addr, space.machine().firstcpu->pc()); break; /* PDC FDD region (0xB0, device 44 */ case 0x5FF001B0: /* FDD SCSI read command */ @@ -216,13 +227,17 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w ) case 0x5FF002B0: /* FDD SCSI read command */ if(TRACE_FDC) logerror("--- FDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); break; + case 0x5FF004B0: /* FDD RESET PDC */ + if(TRACE_FDC) logerror("PDC RESET, PC: %08X\n", space.machine().firstcpu->pc()); + m_pdc->reset(); + break; case 0x5FF008B0: /* FDD SCSI read command */ if(TRACE_FDC) logerror("--- FDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); break; case 0x5FF041B0: /* Unknown - Probably old style commands */ if(TRACE_FDC) logerror("--- FDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); - /* Clear FDD Command completion status 0x5FF030B0 (PDC 0x4, 0x5)*/ + /* Clear FDD Command completion status 0x5FF030B0 (PDC 0x4, 0x5) */ m_pdc->reg_p4 = 0; m_pdc->reg_p5 = 0; @@ -248,7 +263,7 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w ) unsigned char c_fdd_scsi_command[8]; // Array for SCSI command int scsi_lba; // FDD LBA location here, extracted from command - /* Clear FDD Command completion status 0x5FF030B0 (PDC 0x4, 0x5)*/ + /* Clear FDD Command completion status 0x5FF030B0 (PDC 0x4, 0x5) */ m_pdc->reg_p4 = 0; m_pdc->reg_p5 = 0; @@ -286,12 +301,42 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w ) } /****************************************************************************** - CPU board registers [0xFF050000 - 0xFF06FFFF] + CPU board registers [0xFF010000 - 0xFF06FFFF] ******************************************************************************/ +READ32_MEMBER( r9751_state::r9751_mmio_ff01_r ) +{ + //UINT32 data; + UINT32 address = offset * 4 + 0xFF010000; + + switch(address) + { + default: + //return data; + return 0; + } +} + +WRITE32_MEMBER( r9751_state::r9751_mmio_ff01_w ) +{ + UINT32 address = offset * 4 + 0xFF010000; + + switch(address) + { + case 0xFF01000C: /* FDD DMA Offset */ + fdd_dma_bank = data; + return; + case 0xFF010010: /* SMIOC DMA Offset */ + smioc_dma_bank = data; + return; + default: + return; + } +} + READ32_MEMBER( r9751_state::r9751_mmio_ff05_r ) { UINT32 data; - UINT32 address = offset * 4 + 0xFF050000; + UINT32 address = offset * 4 + 0xFF050000; switch(address) { @@ -373,6 +418,7 @@ static ADDRESS_MAP_START(r9751_mem, AS_PROGRAM, 32, r9751_state) AM_RANGE(0x00000000,0x00ffffff) AM_RAM AM_SHARE("main_ram") // 16MB AM_RANGE(0x08000000,0x0800ffff) AM_ROM AM_REGION("prom", 0) AM_RANGE(0x5FF00000,0x5FFFFFFF) AM_READWRITE(r9751_mmio_5ff_r, r9751_mmio_5ff_w) + AM_RANGE(0xFF010000,0xFF01FFFF) AM_READWRITE(r9751_mmio_ff01_r, r9751_mmio_ff01_w) AM_RANGE(0xFF050000,0xFF06FFFF) AM_READWRITE(r9751_mmio_ff05_r, r9751_mmio_ff05_w) AM_RANGE(0xFFF80000,0xFFF8FFFF) AM_READWRITE(r9751_mmio_fff8_r, r9751_mmio_fff8_w) //AM_RANGE(0xffffff00,0xffffffff) AM_RAM // Unknown area -- cgit v1.2.3-70-g09d2 From 88413be8669808573bcdb4c50d5d038ed7fd17d1 Mon Sep 17 00:00:00 2001 From: cracyc Date: Mon, 1 Feb 2016 17:24:21 -0600 Subject: pc9801_cd: 9801 cdrom drivers require DRDY and SERV always set (nw) pc9801_kbd: make a serial keyboard someday (nw) --- Load NECCDM.SYS to make the cdrom work. --- scripts/target/mame/mess.lua | 2 ++ src/mame/drivers/pc9801.cpp | 7 ++++++- src/mame/machine/pc9801_cd.cpp | 34 ++++++++++++++++++++++++++++++++++ src/mame/machine/pc9801_cd.h | 23 +++++++++++++++++++++++ src/mame/machine/pc9801_kbd.cpp | 8 +++++++- src/mame/machine/pc9801_kbd.h | 1 + 6 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 src/mame/machine/pc9801_cd.cpp create mode 100644 src/mame/machine/pc9801_cd.h diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index cfbf4e0667a..d6f3b786332 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -2090,6 +2090,8 @@ files { MAME_DIR .. "src/mame/machine/pc9801_cbus.h", MAME_DIR .. "src/mame/machine/pc9801_kbd.cpp", MAME_DIR .. "src/mame/machine/pc9801_kbd.h", + MAME_DIR .. "src/mame/machine/pc9801_cd.cpp", + MAME_DIR .. "src/mame/machine/pc9801_cd.h", MAME_DIR .. "src/mame/drivers/tk80bs.cpp", MAME_DIR .. "src/mame/drivers/hh_ucom4.cpp", MAME_DIR .. "src/mame/includes/hh_ucom4.h", diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index 433e8346858..48b89439694 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -425,6 +425,7 @@ Keyboard TX commands: #include "machine/pc9801_118.h" #include "machine/pc9801_cbus.h" #include "machine/pc9801_kbd.h" +#include "machine/pc9801_cd.h" #include "machine/idectrl.h" #include "machine/idehd.h" @@ -3218,6 +3219,10 @@ TIMER_DEVICE_CALLBACK_MEMBER( pc9801_state::mouse_irq_cb ) } } +SLOT_INTERFACE_START(pc9801_atapi_devices) + SLOT_INTERFACE("pc9801_cd", PC9801_CD) +SLOT_INTERFACE_END + static MACHINE_CONFIG_FRAGMENT( pc9801_keyboard ) MCFG_DEVICE_ADD("keyb", PC9801_KBD, 53) MCFG_PC9801_KBD_IRQ_CALLBACK(DEVWRITELINE("pic8259_master", pic8259_device, ir1_w)) @@ -3266,7 +3271,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_FRAGMENT( pc9801_ide ) MCFG_ATA_INTERFACE_ADD("ide1", ata_devices, "hdd", nullptr, false) MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(pc9801_state, ide1_irq_w)) - MCFG_ATA_INTERFACE_ADD("ide2", ata_devices, "cdrom", nullptr, false) + MCFG_ATA_INTERFACE_ADD("ide2", pc9801_atapi_devices, "pc9801_cd", nullptr, false) MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(pc9801_state, ide2_irq_w)) MACHINE_CONFIG_END diff --git a/src/mame/machine/pc9801_cd.cpp b/src/mame/machine/pc9801_cd.cpp new file mode 100644 index 00000000000..2a4dffdc98e --- /dev/null +++ b/src/mame/machine/pc9801_cd.cpp @@ -0,0 +1,34 @@ +// license:BSD-3-Clause +// copyright-holders:smf +#include "pc9801_cd.h" + +// device type definition +const device_type PC9801_CD = &device_creator; + +pc9801_cd_device::pc9801_cd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + atapi_cdrom_device(mconfig, PC9801_CD, "PC9801 CD-ROM Drive", tag, owner, clock, "pc9801_cd", __FILE__) +{ +} + +void pc9801_cd_device::fill_buffer() +{ + atapi_hle_device::fill_buffer(); + m_status |= IDE_STATUS_DRDY | IDE_STATUS_SERV; +} + +void pc9801_cd_device::process_buffer() +{ + atapi_hle_device::process_buffer(); + m_status |= IDE_STATUS_DRDY | IDE_STATUS_SERV; +} + +void pc9801_cd_device::process_command() +{ + atapi_hle_device::process_command(); + switch(m_command) + { + case IDE_COMMAND_CHECK_POWER_MODE: + m_status = IDE_STATUS_DRDY | IDE_STATUS_SERV; + break; + } +} diff --git a/src/mame/machine/pc9801_cd.h b/src/mame/machine/pc9801_cd.h new file mode 100644 index 00000000000..35a2d223bd8 --- /dev/null +++ b/src/mame/machine/pc9801_cd.h @@ -0,0 +1,23 @@ +// license:BSD-3-Clause +// copyright-holders:smf + +#ifndef __PC9801_CD_H__ +#define __PC9801_CD_H__ + +#include "machine/atapicdr.h" + +class pc9801_cd_device : public atapi_cdrom_device +{ +public: + pc9801_cd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + virtual void fill_buffer() override; + virtual void process_command() override; + virtual void process_buffer() override; +}; + +// device type definition +extern const device_type PC9801_CD; + +#endif diff --git a/src/mame/machine/pc9801_kbd.cpp b/src/mame/machine/pc9801_kbd.cpp index 260bd9f6b3d..3e4cd4373f8 100644 --- a/src/mame/machine/pc9801_kbd.cpp +++ b/src/mame/machine/pc9801_kbd.cpp @@ -257,6 +257,7 @@ void pc9801_kbd_device::device_reset() m_keyb_tx = 0xff; m_keyb_rx = 0; + m_key_avail = false; } //------------------------------------------------- @@ -276,6 +277,7 @@ void pc9801_kbd_device::device_timer(emu_timer &timer, device_timer_id id, int p { m_keyb_tx = i | 0x80; m_write_irq(ASSERT_LINE); + m_key_avail = true; m_rx_buf[i] = 0; return; } @@ -288,6 +290,7 @@ void pc9801_kbd_device::device_timer(emu_timer &timer, device_timer_id id, int p { m_keyb_tx = i; m_write_irq(ASSERT_LINE); + m_key_avail = true; m_rx_buf[i] = 0; return; } @@ -303,8 +306,11 @@ READ8_MEMBER( pc9801_kbd_device::rx_r ) { m_write_irq(CLEAR_LINE); if(!offset) + { + m_key_avail = false; return m_keyb_tx; - return 1 | 4 | 2; + } + return 1 | 4 | (m_key_avail ? 2 : 0); } WRITE8_MEMBER( pc9801_kbd_device::tx_w ) diff --git a/src/mame/machine/pc9801_kbd.h b/src/mame/machine/pc9801_kbd.h index c33d554ab3e..e776e2b238e 100644 --- a/src/mame/machine/pc9801_kbd.h +++ b/src/mame/machine/pc9801_kbd.h @@ -55,6 +55,7 @@ protected: UINT8 m_rx_buf[0x80]; UINT8 m_keyb_tx; UINT8 m_keyb_rx; + bool m_key_avail; }; -- cgit v1.2.3-70-g09d2 From 51ffee344f652b4f110aff3005e676fc31a7ab42 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 1 Feb 2016 23:32:24 +0000 Subject: start making this a little more modern c++y with classes, member functions etc. rather than legacy structs, tokens etc. (with a view to eventually ditching polylgcy) --- src/devices/machine/k033906.cpp | 4 +- src/devices/machine/k033906.h | 4 +- src/devices/video/vooddefs.h | 1848 +----------------------- src/devices/video/voodoo.cpp | 2875 +++++++++++++++++++------------------- src/devices/video/voodoo.h | 1794 +++++++++++++++++++++++- src/devices/video/voodoo_pci.cpp | 4 +- src/mame/drivers/funkball.cpp | 4 +- src/mame/drivers/gticlub.cpp | 8 +- src/mame/drivers/hornet.cpp | 12 +- src/mame/drivers/magictg.cpp | 14 +- src/mame/drivers/nwk-tr.cpp | 4 +- src/mame/drivers/savquest.cpp | 4 +- src/mame/drivers/seattle.cpp | 4 +- src/mame/drivers/vegas.cpp | 14 +- src/mame/drivers/viper.cpp | 4 +- 15 files changed, 3292 insertions(+), 3305 deletions(-) diff --git a/src/devices/machine/k033906.cpp b/src/devices/machine/k033906.cpp index bd32fef29f1..d9953d2864f 100644 --- a/src/devices/machine/k033906.cpp +++ b/src/devices/machine/k033906.cpp @@ -33,7 +33,7 @@ k033906_device::k033906_device(const machine_config &mconfig, const char *tag, d void k033906_device::device_start() { - m_voodoo = machine().device(m_voodoo_tag); + m_voodoo = (voodoo_device*)machine().device(m_voodoo_tag); m_reg_set = 0; @@ -95,7 +95,7 @@ void k033906_device::reg_w(int reg, UINT32 data) case 0x10: // initEnable { - voodoo_set_init_enable(m_voodoo, data); + m_voodoo->voodoo_set_init_enable(data); break; } diff --git a/src/devices/machine/k033906.h b/src/devices/machine/k033906.h index aa2c685df99..438cc5796ab 100644 --- a/src/devices/machine/k033906.h +++ b/src/devices/machine/k033906.h @@ -12,7 +12,7 @@ #define __K033906_H__ #include "emu.h" - +#include "video/voodoo.h" /*************************************************************************** @@ -58,7 +58,7 @@ private: int m_reg_set; // 1 = access reg / 0 = access ram const char *m_voodoo_tag; - device_t *m_voodoo; + voodoo_device *m_voodoo; UINT32 m_reg[256]; UINT32 m_ram[32768]; diff --git a/src/devices/video/vooddefs.h b/src/devices/video/vooddefs.h index e394946d445..5bef9d4cc8e 100644 --- a/src/devices/video/vooddefs.h +++ b/src/devices/video/vooddefs.h @@ -9,1349 +9,6 @@ ***************************************************************************/ -/************************************* - * - * Misc. constants - * - *************************************/ - -/* enumeration describing reasons we might be stalled */ -enum -{ - NOT_STALLED = 0, - STALLED_UNTIL_FIFO_LWM, - STALLED_UNTIL_FIFO_EMPTY -}; - - - -// Use old table lookup versus straight double divide -#define USE_FAST_RECIP 0 - -/* maximum number of TMUs */ -#define MAX_TMU 2 - -/* accumulate operations less than this number of clocks */ -#define ACCUMULATE_THRESHOLD 0 - -/* number of clocks to set up a triangle (just a guess) */ -#define TRIANGLE_SETUP_CLOCKS 100 - -/* maximum number of rasterizers */ -#define MAX_RASTERIZERS 1024 - -/* size of the rasterizer hash table */ -#define RASTER_HASH_SIZE 97 - -/* flags for LFB writes */ -#define LFB_RGB_PRESENT 1 -#define LFB_ALPHA_PRESENT 2 -#define LFB_DEPTH_PRESENT 4 -#define LFB_DEPTH_PRESENT_MSW 8 - -/* flags for the register access array */ -#define REGISTER_READ 0x01 /* reads are allowed */ -#define REGISTER_WRITE 0x02 /* writes are allowed */ -#define REGISTER_PIPELINED 0x04 /* writes are pipelined */ -#define REGISTER_FIFO 0x08 /* writes go to FIFO */ -#define REGISTER_WRITETHRU 0x10 /* writes are valid even for CMDFIFO */ - -/* shorter combinations to make the table smaller */ -#define REG_R (REGISTER_READ) -#define REG_W (REGISTER_WRITE) -#define REG_WT (REGISTER_WRITE | REGISTER_WRITETHRU) -#define REG_RW (REGISTER_READ | REGISTER_WRITE) -#define REG_RWT (REGISTER_READ | REGISTER_WRITE | REGISTER_WRITETHRU) -#define REG_RP (REGISTER_READ | REGISTER_PIPELINED) -#define REG_WP (REGISTER_WRITE | REGISTER_PIPELINED) -#define REG_RWP (REGISTER_READ | REGISTER_WRITE | REGISTER_PIPELINED) -#define REG_RWPT (REGISTER_READ | REGISTER_WRITE | REGISTER_PIPELINED | REGISTER_WRITETHRU) -#define REG_RF (REGISTER_READ | REGISTER_FIFO) -#define REG_WF (REGISTER_WRITE | REGISTER_FIFO) -#define REG_RWF (REGISTER_READ | REGISTER_WRITE | REGISTER_FIFO) -#define REG_RPF (REGISTER_READ | REGISTER_PIPELINED | REGISTER_FIFO) -#define REG_WPF (REGISTER_WRITE | REGISTER_PIPELINED | REGISTER_FIFO) -#define REG_RWPF (REGISTER_READ | REGISTER_WRITE | REGISTER_PIPELINED | REGISTER_FIFO) - -/* lookup bits is the log2 of the size of the reciprocal/log table */ -#define RECIPLOG_LOOKUP_BITS 9 - -/* input precision is how many fraction bits the input value has; this is a 64-bit number */ -#define RECIPLOG_INPUT_PREC 32 - -/* lookup precision is how many fraction bits each table entry contains */ -#define RECIPLOG_LOOKUP_PREC 22 - -/* output precision is how many fraction bits the result should have */ -#define RECIP_OUTPUT_PREC 15 -#define LOG_OUTPUT_PREC 8 - - - -/************************************* - * - * Register constants - * - *************************************/ - -/* Codes to the right: - R = readable - W = writeable - P = pipelined - F = goes to FIFO -*/ - -/* 0x000 */ -#define status (0x000/4) /* R P */ -#define intrCtrl (0x004/4) /* RW P -- Voodoo2/Banshee only */ -#define vertexAx (0x008/4) /* W PF */ -#define vertexAy (0x00c/4) /* W PF */ -#define vertexBx (0x010/4) /* W PF */ -#define vertexBy (0x014/4) /* W PF */ -#define vertexCx (0x018/4) /* W PF */ -#define vertexCy (0x01c/4) /* W PF */ -#define startR (0x020/4) /* W PF */ -#define startG (0x024/4) /* W PF */ -#define startB (0x028/4) /* W PF */ -#define startZ (0x02c/4) /* W PF */ -#define startA (0x030/4) /* W PF */ -#define startS (0x034/4) /* W PF */ -#define startT (0x038/4) /* W PF */ -#define startW (0x03c/4) /* W PF */ - -/* 0x040 */ -#define dRdX (0x040/4) /* W PF */ -#define dGdX (0x044/4) /* W PF */ -#define dBdX (0x048/4) /* W PF */ -#define dZdX (0x04c/4) /* W PF */ -#define dAdX (0x050/4) /* W PF */ -#define dSdX (0x054/4) /* W PF */ -#define dTdX (0x058/4) /* W PF */ -#define dWdX (0x05c/4) /* W PF */ -#define dRdY (0x060/4) /* W PF */ -#define dGdY (0x064/4) /* W PF */ -#define dBdY (0x068/4) /* W PF */ -#define dZdY (0x06c/4) /* W PF */ -#define dAdY (0x070/4) /* W PF */ -#define dSdY (0x074/4) /* W PF */ -#define dTdY (0x078/4) /* W PF */ -#define dWdY (0x07c/4) /* W PF */ - -/* 0x080 */ -#define triangleCMD (0x080/4) /* W PF */ -#define fvertexAx (0x088/4) /* W PF */ -#define fvertexAy (0x08c/4) /* W PF */ -#define fvertexBx (0x090/4) /* W PF */ -#define fvertexBy (0x094/4) /* W PF */ -#define fvertexCx (0x098/4) /* W PF */ -#define fvertexCy (0x09c/4) /* W PF */ -#define fstartR (0x0a0/4) /* W PF */ -#define fstartG (0x0a4/4) /* W PF */ -#define fstartB (0x0a8/4) /* W PF */ -#define fstartZ (0x0ac/4) /* W PF */ -#define fstartA (0x0b0/4) /* W PF */ -#define fstartS (0x0b4/4) /* W PF */ -#define fstartT (0x0b8/4) /* W PF */ -#define fstartW (0x0bc/4) /* W PF */ - -/* 0x0c0 */ -#define fdRdX (0x0c0/4) /* W PF */ -#define fdGdX (0x0c4/4) /* W PF */ -#define fdBdX (0x0c8/4) /* W PF */ -#define fdZdX (0x0cc/4) /* W PF */ -#define fdAdX (0x0d0/4) /* W PF */ -#define fdSdX (0x0d4/4) /* W PF */ -#define fdTdX (0x0d8/4) /* W PF */ -#define fdWdX (0x0dc/4) /* W PF */ -#define fdRdY (0x0e0/4) /* W PF */ -#define fdGdY (0x0e4/4) /* W PF */ -#define fdBdY (0x0e8/4) /* W PF */ -#define fdZdY (0x0ec/4) /* W PF */ -#define fdAdY (0x0f0/4) /* W PF */ -#define fdSdY (0x0f4/4) /* W PF */ -#define fdTdY (0x0f8/4) /* W PF */ -#define fdWdY (0x0fc/4) /* W PF */ - -/* 0x100 */ -#define ftriangleCMD (0x100/4) /* W PF */ -#define fbzColorPath (0x104/4) /* RW PF */ -#define fogMode (0x108/4) /* RW PF */ -#define alphaMode (0x10c/4) /* RW PF */ -#define fbzMode (0x110/4) /* RW F */ -#define lfbMode (0x114/4) /* RW F */ -#define clipLeftRight (0x118/4) /* RW F */ -#define clipLowYHighY (0x11c/4) /* RW F */ -#define nopCMD (0x120/4) /* W F */ -#define fastfillCMD (0x124/4) /* W F */ -#define swapbufferCMD (0x128/4) /* W F */ -#define fogColor (0x12c/4) /* W F */ -#define zaColor (0x130/4) /* W F */ -#define chromaKey (0x134/4) /* W F */ -#define chromaRange (0x138/4) /* W F -- Voodoo2/Banshee only */ -#define userIntrCMD (0x13c/4) /* W F -- Voodoo2/Banshee only */ - -/* 0x140 */ -#define stipple (0x140/4) /* RW F */ -#define color0 (0x144/4) /* RW F */ -#define color1 (0x148/4) /* RW F */ -#define fbiPixelsIn (0x14c/4) /* R */ -#define fbiChromaFail (0x150/4) /* R */ -#define fbiZfuncFail (0x154/4) /* R */ -#define fbiAfuncFail (0x158/4) /* R */ -#define fbiPixelsOut (0x15c/4) /* R */ -#define fogTable (0x160/4) /* W F */ - -/* 0x1c0 */ -#define cmdFifoBaseAddr (0x1e0/4) /* RW -- Voodoo2 only */ -#define cmdFifoBump (0x1e4/4) /* RW -- Voodoo2 only */ -#define cmdFifoRdPtr (0x1e8/4) /* RW -- Voodoo2 only */ -#define cmdFifoAMin (0x1ec/4) /* RW -- Voodoo2 only */ -#define colBufferAddr (0x1ec/4) /* RW -- Banshee only */ -#define cmdFifoAMax (0x1f0/4) /* RW -- Voodoo2 only */ -#define colBufferStride (0x1f0/4) /* RW -- Banshee only */ -#define cmdFifoDepth (0x1f4/4) /* RW -- Voodoo2 only */ -#define auxBufferAddr (0x1f4/4) /* RW -- Banshee only */ -#define cmdFifoHoles (0x1f8/4) /* RW -- Voodoo2 only */ -#define auxBufferStride (0x1f8/4) /* RW -- Banshee only */ - -/* 0x200 */ -#define fbiInit4 (0x200/4) /* RW -- Voodoo/Voodoo2 only */ -#define clipLeftRight1 (0x200/4) /* RW -- Banshee only */ -#define vRetrace (0x204/4) /* R -- Voodoo/Voodoo2 only */ -#define clipTopBottom1 (0x204/4) /* RW -- Banshee only */ -#define backPorch (0x208/4) /* RW -- Voodoo/Voodoo2 only */ -#define videoDimensions (0x20c/4) /* RW -- Voodoo/Voodoo2 only */ -#define fbiInit0 (0x210/4) /* RW -- Voodoo/Voodoo2 only */ -#define fbiInit1 (0x214/4) /* RW -- Voodoo/Voodoo2 only */ -#define fbiInit2 (0x218/4) /* RW -- Voodoo/Voodoo2 only */ -#define fbiInit3 (0x21c/4) /* RW -- Voodoo/Voodoo2 only */ -#define hSync (0x220/4) /* W -- Voodoo/Voodoo2 only */ -#define vSync (0x224/4) /* W -- Voodoo/Voodoo2 only */ -#define clutData (0x228/4) /* W F -- Voodoo/Voodoo2 only */ -#define dacData (0x22c/4) /* W -- Voodoo/Voodoo2 only */ -#define maxRgbDelta (0x230/4) /* W -- Voodoo/Voodoo2 only */ -#define hBorder (0x234/4) /* W -- Voodoo2 only */ -#define vBorder (0x238/4) /* W -- Voodoo2 only */ -#define borderColor (0x23c/4) /* W -- Voodoo2 only */ - -/* 0x240 */ -#define hvRetrace (0x240/4) /* R -- Voodoo2 only */ -#define fbiInit5 (0x244/4) /* RW -- Voodoo2 only */ -#define fbiInit6 (0x248/4) /* RW -- Voodoo2 only */ -#define fbiInit7 (0x24c/4) /* RW -- Voodoo2 only */ -#define swapPending (0x24c/4) /* W -- Banshee only */ -#define leftOverlayBuf (0x250/4) /* W -- Banshee only */ -#define rightOverlayBuf (0x254/4) /* W -- Banshee only */ -#define fbiSwapHistory (0x258/4) /* R -- Voodoo2/Banshee only */ -#define fbiTrianglesOut (0x25c/4) /* R -- Voodoo2/Banshee only */ -#define sSetupMode (0x260/4) /* W PF -- Voodoo2/Banshee only */ -#define sVx (0x264/4) /* W PF -- Voodoo2/Banshee only */ -#define sVy (0x268/4) /* W PF -- Voodoo2/Banshee only */ -#define sARGB (0x26c/4) /* W PF -- Voodoo2/Banshee only */ -#define sRed (0x270/4) /* W PF -- Voodoo2/Banshee only */ -#define sGreen (0x274/4) /* W PF -- Voodoo2/Banshee only */ -#define sBlue (0x278/4) /* W PF -- Voodoo2/Banshee only */ -#define sAlpha (0x27c/4) /* W PF -- Voodoo2/Banshee only */ - -/* 0x280 */ -#define sVz (0x280/4) /* W PF -- Voodoo2/Banshee only */ -#define sWb (0x284/4) /* W PF -- Voodoo2/Banshee only */ -#define sWtmu0 (0x288/4) /* W PF -- Voodoo2/Banshee only */ -#define sS_W0 (0x28c/4) /* W PF -- Voodoo2/Banshee only */ -#define sT_W0 (0x290/4) /* W PF -- Voodoo2/Banshee only */ -#define sWtmu1 (0x294/4) /* W PF -- Voodoo2/Banshee only */ -#define sS_Wtmu1 (0x298/4) /* W PF -- Voodoo2/Banshee only */ -#define sT_Wtmu1 (0x29c/4) /* W PF -- Voodoo2/Banshee only */ -#define sDrawTriCMD (0x2a0/4) /* W PF -- Voodoo2/Banshee only */ -#define sBeginTriCMD (0x2a4/4) /* W PF -- Voodoo2/Banshee only */ - -/* 0x2c0 */ -#define bltSrcBaseAddr (0x2c0/4) /* RW PF -- Voodoo2 only */ -#define bltDstBaseAddr (0x2c4/4) /* RW PF -- Voodoo2 only */ -#define bltXYStrides (0x2c8/4) /* RW PF -- Voodoo2 only */ -#define bltSrcChromaRange (0x2cc/4) /* RW PF -- Voodoo2 only */ -#define bltDstChromaRange (0x2d0/4) /* RW PF -- Voodoo2 only */ -#define bltClipX (0x2d4/4) /* RW PF -- Voodoo2 only */ -#define bltClipY (0x2d8/4) /* RW PF -- Voodoo2 only */ -#define bltSrcXY (0x2e0/4) /* RW PF -- Voodoo2 only */ -#define bltDstXY (0x2e4/4) /* RW PF -- Voodoo2 only */ -#define bltSize (0x2e8/4) /* RW PF -- Voodoo2 only */ -#define bltRop (0x2ec/4) /* RW PF -- Voodoo2 only */ -#define bltColor (0x2f0/4) /* RW PF -- Voodoo2 only */ -#define bltCommand (0x2f8/4) /* RW PF -- Voodoo2 only */ -#define bltData (0x2fc/4) /* W PF -- Voodoo2 only */ - -/* 0x300 */ -#define textureMode (0x300/4) /* W PF */ -#define tLOD (0x304/4) /* W PF */ -#define tDetail (0x308/4) /* W PF */ -#define texBaseAddr (0x30c/4) /* W PF */ -#define texBaseAddr_1 (0x310/4) /* W PF */ -#define texBaseAddr_2 (0x314/4) /* W PF */ -#define texBaseAddr_3_8 (0x318/4) /* W PF */ -#define trexInit0 (0x31c/4) /* W F -- Voodoo/Voodoo2 only */ -#define trexInit1 (0x320/4) /* W F */ -#define nccTable (0x324/4) /* W F */ - - - -// 2D registers -#define banshee2D_clip0Min (0x008/4) -#define banshee2D_clip0Max (0x00c/4) -#define banshee2D_dstBaseAddr (0x010/4) -#define banshee2D_dstFormat (0x014/4) -#define banshee2D_srcColorkeyMin (0x018/4) -#define banshee2D_srcColorkeyMax (0x01c/4) -#define banshee2D_dstColorkeyMin (0x020/4) -#define banshee2D_dstColorkeyMax (0x024/4) -#define banshee2D_bresError0 (0x028/4) -#define banshee2D_bresError1 (0x02c/4) -#define banshee2D_rop (0x030/4) -#define banshee2D_srcBaseAddr (0x034/4) -#define banshee2D_commandExtra (0x038/4) -#define banshee2D_lineStipple (0x03c/4) -#define banshee2D_lineStyle (0x040/4) -#define banshee2D_pattern0Alias (0x044/4) -#define banshee2D_pattern1Alias (0x048/4) -#define banshee2D_clip1Min (0x04c/4) -#define banshee2D_clip1Max (0x050/4) -#define banshee2D_srcFormat (0x054/4) -#define banshee2D_srcSize (0x058/4) -#define banshee2D_srcXY (0x05c/4) -#define banshee2D_colorBack (0x060/4) -#define banshee2D_colorFore (0x064/4) -#define banshee2D_dstSize (0x068/4) -#define banshee2D_dstXY (0x06c/4) -#define banshee2D_command (0x070/4) - - -/************************************* - * - * Alias map of the first 64 - * registers when remapped - * - *************************************/ - -static const UINT8 register_alias_map[0x40] = -{ - status, 0x004/4, vertexAx, vertexAy, - vertexBx, vertexBy, vertexCx, vertexCy, - startR, dRdX, dRdY, startG, - dGdX, dGdY, startB, dBdX, - dBdY, startZ, dZdX, dZdY, - startA, dAdX, dAdY, startS, - dSdX, dSdY, startT, dTdX, - dTdY, startW, dWdX, dWdY, - - triangleCMD,0x084/4, fvertexAx, fvertexAy, - fvertexBx, fvertexBy, fvertexCx, fvertexCy, - fstartR, fdRdX, fdRdY, fstartG, - fdGdX, fdGdY, fstartB, fdBdX, - fdBdY, fstartZ, fdZdX, fdZdY, - fstartA, fdAdX, fdAdY, fstartS, - fdSdX, fdSdY, fstartT, fdTdX, - fdTdY, fstartW, fdWdX, fdWdY -}; - - - -/************************************* - * - * Table of per-register access rights - * - *************************************/ - -static const UINT8 voodoo_register_access[0x100] = -{ - /* 0x000 */ - REG_RP, 0, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x040 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x080 */ - REG_WPF, 0, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x0c0 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x100 */ - REG_WPF, REG_RWPF, REG_RWPF, REG_RWPF, - REG_RWF, REG_RWF, REG_RWF, REG_RWF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, 0, 0, - - /* 0x140 */ - REG_RWF, REG_RWF, REG_RWF, REG_R, - REG_R, REG_R, REG_R, REG_R, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x180 */ - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x1c0 */ - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - 0, 0, 0, 0, - 0, 0, 0, 0, - - /* 0x200 */ - REG_RW, REG_R, REG_RW, REG_RW, - REG_RW, REG_RW, REG_RW, REG_RW, - REG_W, REG_W, REG_W, REG_W, - REG_W, 0, 0, 0, - - /* 0x240 */ - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - - /* 0x280 */ - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - - /* 0x2c0 */ - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - - /* 0x300 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x340 */ - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x380 */ - REG_WF -}; - - -static const UINT8 voodoo2_register_access[0x100] = -{ - /* 0x000 */ - REG_RP, REG_RWPT, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x040 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x080 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x0c0 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x100 */ - REG_WPF, REG_RWPF, REG_RWPF, REG_RWPF, - REG_RWF, REG_RWF, REG_RWF, REG_RWF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x140 */ - REG_RWF, REG_RWF, REG_RWF, REG_R, - REG_R, REG_R, REG_R, REG_R, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x180 */ - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x1c0 */ - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_RWT, REG_RWT, REG_RWT, REG_RWT, - REG_RWT, REG_RWT, REG_RWT, REG_RW, - - /* 0x200 */ - REG_RWT, REG_R, REG_RWT, REG_RWT, - REG_RWT, REG_RWT, REG_RWT, REG_RWT, - REG_WT, REG_WT, REG_WF, REG_WT, - REG_WT, REG_WT, REG_WT, REG_WT, - - /* 0x240 */ - REG_R, REG_RWT, REG_RWT, REG_RWT, - 0, 0, REG_R, REG_R, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x280 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, 0, 0, - 0, 0, 0, 0, - - /* 0x2c0 */ - REG_RWPF, REG_RWPF, REG_RWPF, REG_RWPF, - REG_RWPF, REG_RWPF, REG_RWPF, REG_RWPF, - REG_RWPF, REG_RWPF, REG_RWPF, REG_RWPF, - REG_RWPF, REG_RWPF, REG_RWPF, REG_WPF, - - /* 0x300 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x340 */ - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x380 */ - REG_WF -}; - - -static const UINT8 banshee_register_access[0x100] = -{ - /* 0x000 */ - REG_RP, REG_RWPT, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x040 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x080 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x0c0 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x100 */ - REG_WPF, REG_RWPF, REG_RWPF, REG_RWPF, - REG_RWF, REG_RWF, REG_RWF, REG_RWF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x140 */ - REG_RWF, REG_RWF, REG_RWF, REG_R, - REG_R, REG_R, REG_R, REG_R, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x180 */ - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x1c0 */ - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - 0, 0, 0, REG_RWF, - REG_RWF, REG_RWF, REG_RWF, 0, - - /* 0x200 */ - REG_RWF, REG_RWF, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - - /* 0x240 */ - 0, 0, 0, REG_WT, - REG_RWF, REG_RWF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_R, REG_R, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - - /* 0x280 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, 0, 0, - 0, 0, 0, 0, - - /* 0x2c0 */ - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - - /* 0x300 */ - REG_WPF, REG_WPF, REG_WPF, REG_WPF, - REG_WPF, REG_WPF, REG_WPF, 0, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x340 */ - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - REG_WF, REG_WF, REG_WF, REG_WF, - - /* 0x380 */ - REG_WF -}; - - - -/************************************* - * - * Register string table for debug - * - *************************************/ - -static const char *const voodoo_reg_name[] = -{ - /* 0x000 */ - "status", "{intrCtrl}", "vertexAx", "vertexAy", - "vertexBx", "vertexBy", "vertexCx", "vertexCy", - "startR", "startG", "startB", "startZ", - "startA", "startS", "startT", "startW", - /* 0x040 */ - "dRdX", "dGdX", "dBdX", "dZdX", - "dAdX", "dSdX", "dTdX", "dWdX", - "dRdY", "dGdY", "dBdY", "dZdY", - "dAdY", "dSdY", "dTdY", "dWdY", - /* 0x080 */ - "triangleCMD", "reserved084", "fvertexAx", "fvertexAy", - "fvertexBx", "fvertexBy", "fvertexCx", "fvertexCy", - "fstartR", "fstartG", "fstartB", "fstartZ", - "fstartA", "fstartS", "fstartT", "fstartW", - /* 0x0c0 */ - "fdRdX", "fdGdX", "fdBdX", "fdZdX", - "fdAdX", "fdSdX", "fdTdX", "fdWdX", - "fdRdY", "fdGdY", "fdBdY", "fdZdY", - "fdAdY", "fdSdY", "fdTdY", "fdWdY", - /* 0x100 */ - "ftriangleCMD", "fbzColorPath", "fogMode", "alphaMode", - "fbzMode", "lfbMode", "clipLeftRight","clipLowYHighY", - "nopCMD", "fastfillCMD", "swapbufferCMD","fogColor", - "zaColor", "chromaKey", "{chromaRange}","{userIntrCMD}", - /* 0x140 */ - "stipple", "color0", "color1", "fbiPixelsIn", - "fbiChromaFail","fbiZfuncFail", "fbiAfuncFail", "fbiPixelsOut", - "fogTable160", "fogTable164", "fogTable168", "fogTable16c", - "fogTable170", "fogTable174", "fogTable178", "fogTable17c", - /* 0x180 */ - "fogTable180", "fogTable184", "fogTable188", "fogTable18c", - "fogTable190", "fogTable194", "fogTable198", "fogTable19c", - "fogTable1a0", "fogTable1a4", "fogTable1a8", "fogTable1ac", - "fogTable1b0", "fogTable1b4", "fogTable1b8", "fogTable1bc", - /* 0x1c0 */ - "fogTable1c0", "fogTable1c4", "fogTable1c8", "fogTable1cc", - "fogTable1d0", "fogTable1d4", "fogTable1d8", "fogTable1dc", - "{cmdFifoBaseAddr}","{cmdFifoBump}","{cmdFifoRdPtr}","{cmdFifoAMin}", - "{cmdFifoAMax}","{cmdFifoDepth}","{cmdFifoHoles}","reserved1fc", - /* 0x200 */ - "fbiInit4", "vRetrace", "backPorch", "videoDimensions", - "fbiInit0", "fbiInit1", "fbiInit2", "fbiInit3", - "hSync", "vSync", "clutData", "dacData", - "maxRgbDelta", "{hBorder}", "{vBorder}", "{borderColor}", - /* 0x240 */ - "{hvRetrace}", "{fbiInit5}", "{fbiInit6}", "{fbiInit7}", - "reserved250", "reserved254", "{fbiSwapHistory}","{fbiTrianglesOut}", - "{sSetupMode}", "{sVx}", "{sVy}", "{sARGB}", - "{sRed}", "{sGreen}", "{sBlue}", "{sAlpha}", - /* 0x280 */ - "{sVz}", "{sWb}", "{sWtmu0}", "{sS/Wtmu0}", - "{sT/Wtmu0}", "{sWtmu1}", "{sS/Wtmu1}", "{sT/Wtmu1}", - "{sDrawTriCMD}","{sBeginTriCMD}","reserved2a8", "reserved2ac", - "reserved2b0", "reserved2b4", "reserved2b8", "reserved2bc", - /* 0x2c0 */ - "{bltSrcBaseAddr}","{bltDstBaseAddr}","{bltXYStrides}","{bltSrcChromaRange}", - "{bltDstChromaRange}","{bltClipX}","{bltClipY}","reserved2dc", - "{bltSrcXY}", "{bltDstXY}", "{bltSize}", "{bltRop}", - "{bltColor}", "reserved2f4", "{bltCommand}", "{bltData}", - /* 0x300 */ - "textureMode", "tLOD", "tDetail", "texBaseAddr", - "texBaseAddr_1","texBaseAddr_2","texBaseAddr_3_8","trexInit0", - "trexInit1", "nccTable0.0", "nccTable0.1", "nccTable0.2", - "nccTable0.3", "nccTable0.4", "nccTable0.5", "nccTable0.6", - /* 0x340 */ - "nccTable0.7", "nccTable0.8", "nccTable0.9", "nccTable0.A", - "nccTable0.B", "nccTable1.0", "nccTable1.1", "nccTable1.2", - "nccTable1.3", "nccTable1.4", "nccTable1.5", "nccTable1.6", - "nccTable1.7", "nccTable1.8", "nccTable1.9", "nccTable1.A", - /* 0x380 */ - "nccTable1.B" -}; - - -static const char *const banshee_reg_name[] = -{ - /* 0x000 */ - "status", "intrCtrl", "vertexAx", "vertexAy", - "vertexBx", "vertexBy", "vertexCx", "vertexCy", - "startR", "startG", "startB", "startZ", - "startA", "startS", "startT", "startW", - /* 0x040 */ - "dRdX", "dGdX", "dBdX", "dZdX", - "dAdX", "dSdX", "dTdX", "dWdX", - "dRdY", "dGdY", "dBdY", "dZdY", - "dAdY", "dSdY", "dTdY", "dWdY", - /* 0x080 */ - "triangleCMD", "reserved084", "fvertexAx", "fvertexAy", - "fvertexBx", "fvertexBy", "fvertexCx", "fvertexCy", - "fstartR", "fstartG", "fstartB", "fstartZ", - "fstartA", "fstartS", "fstartT", "fstartW", - /* 0x0c0 */ - "fdRdX", "fdGdX", "fdBdX", "fdZdX", - "fdAdX", "fdSdX", "fdTdX", "fdWdX", - "fdRdY", "fdGdY", "fdBdY", "fdZdY", - "fdAdY", "fdSdY", "fdTdY", "fdWdY", - /* 0x100 */ - "ftriangleCMD", "fbzColorPath", "fogMode", "alphaMode", - "fbzMode", "lfbMode", "clipLeftRight","clipLowYHighY", - "nopCMD", "fastfillCMD", "swapbufferCMD","fogColor", - "zaColor", "chromaKey", "chromaRange", "userIntrCMD", - /* 0x140 */ - "stipple", "color0", "color1", "fbiPixelsIn", - "fbiChromaFail","fbiZfuncFail", "fbiAfuncFail", "fbiPixelsOut", - "fogTable160", "fogTable164", "fogTable168", "fogTable16c", - "fogTable170", "fogTable174", "fogTable178", "fogTable17c", - /* 0x180 */ - "fogTable180", "fogTable184", "fogTable188", "fogTable18c", - "fogTable190", "fogTable194", "fogTable198", "fogTable19c", - "fogTable1a0", "fogTable1a4", "fogTable1a8", "fogTable1ac", - "fogTable1b0", "fogTable1b4", "fogTable1b8", "fogTable1bc", - /* 0x1c0 */ - "fogTable1c0", "fogTable1c4", "fogTable1c8", "fogTable1cc", - "fogTable1d0", "fogTable1d4", "fogTable1d8", "fogTable1dc", - "reserved1e0", "reserved1e4", "reserved1e8", "colBufferAddr", - "colBufferStride","auxBufferAddr","auxBufferStride","reserved1fc", - /* 0x200 */ - "clipLeftRight1","clipTopBottom1","reserved208","reserved20c", - "reserved210", "reserved214", "reserved218", "reserved21c", - "reserved220", "reserved224", "reserved228", "reserved22c", - "reserved230", "reserved234", "reserved238", "reserved23c", - /* 0x240 */ - "reserved240", "reserved244", "reserved248", "swapPending", - "leftOverlayBuf","rightOverlayBuf","fbiSwapHistory","fbiTrianglesOut", - "sSetupMode", "sVx", "sVy", "sARGB", - "sRed", "sGreen", "sBlue", "sAlpha", - /* 0x280 */ - "sVz", "sWb", "sWtmu0", "sS/Wtmu0", - "sT/Wtmu0", "sWtmu1", "sS/Wtmu1", "sT/Wtmu1", - "sDrawTriCMD", "sBeginTriCMD", "reserved2a8", "reserved2ac", - "reserved2b0", "reserved2b4", "reserved2b8", "reserved2bc", - /* 0x2c0 */ - "reserved2c0", "reserved2c4", "reserved2c8", "reserved2cc", - "reserved2d0", "reserved2d4", "reserved2d8", "reserved2dc", - "reserved2e0", "reserved2e4", "reserved2e8", "reserved2ec", - "reserved2f0", "reserved2f4", "reserved2f8", "reserved2fc", - /* 0x300 */ - "textureMode", "tLOD", "tDetail", "texBaseAddr", - "texBaseAddr_1","texBaseAddr_2","texBaseAddr_3_8","reserved31c", - "trexInit1", "nccTable0.0", "nccTable0.1", "nccTable0.2", - "nccTable0.3", "nccTable0.4", "nccTable0.5", "nccTable0.6", - /* 0x340 */ - "nccTable0.7", "nccTable0.8", "nccTable0.9", "nccTable0.A", - "nccTable0.B", "nccTable1.0", "nccTable1.1", "nccTable1.2", - "nccTable1.3", "nccTable1.4", "nccTable1.5", "nccTable1.6", - "nccTable1.7", "nccTable1.8", "nccTable1.9", "nccTable1.A", - /* 0x380 */ - "nccTable1.B" -}; - - - -/************************************* - * - * Voodoo Banshee I/O space registers - * - *************************************/ - -/* 0x000 */ -#define io_status (0x000/4) /* */ -#define io_pciInit0 (0x004/4) /* */ -#define io_sipMonitor (0x008/4) /* */ -#define io_lfbMemoryConfig (0x00c/4) /* */ -#define io_miscInit0 (0x010/4) /* */ -#define io_miscInit1 (0x014/4) /* */ -#define io_dramInit0 (0x018/4) /* */ -#define io_dramInit1 (0x01c/4) /* */ -#define io_agpInit (0x020/4) /* */ -#define io_tmuGbeInit (0x024/4) /* */ -#define io_vgaInit0 (0x028/4) /* */ -#define io_vgaInit1 (0x02c/4) /* */ -#define io_dramCommand (0x030/4) /* */ -#define io_dramData (0x034/4) /* */ - -/* 0x040 */ -#define io_pllCtrl0 (0x040/4) /* */ -#define io_pllCtrl1 (0x044/4) /* */ -#define io_pllCtrl2 (0x048/4) /* */ -#define io_dacMode (0x04c/4) /* */ -#define io_dacAddr (0x050/4) /* */ -#define io_dacData (0x054/4) /* */ -#define io_rgbMaxDelta (0x058/4) /* */ -#define io_vidProcCfg (0x05c/4) /* */ -#define io_hwCurPatAddr (0x060/4) /* */ -#define io_hwCurLoc (0x064/4) /* */ -#define io_hwCurC0 (0x068/4) /* */ -#define io_hwCurC1 (0x06c/4) /* */ -#define io_vidInFormat (0x070/4) /* */ -#define io_vidInStatus (0x074/4) /* */ -#define io_vidSerialParallelPort (0x078/4) /* */ -#define io_vidInXDecimDeltas (0x07c/4) /* */ - -/* 0x080 */ -#define io_vidInDecimInitErrs (0x080/4) /* */ -#define io_vidInYDecimDeltas (0x084/4) /* */ -#define io_vidPixelBufThold (0x088/4) /* */ -#define io_vidChromaMin (0x08c/4) /* */ -#define io_vidChromaMax (0x090/4) /* */ -#define io_vidCurrentLine (0x094/4) /* */ -#define io_vidScreenSize (0x098/4) /* */ -#define io_vidOverlayStartCoords (0x09c/4) /* */ -#define io_vidOverlayEndScreenCoord (0x0a0/4) /* */ -#define io_vidOverlayDudx (0x0a4/4) /* */ -#define io_vidOverlayDudxOffsetSrcWidth (0x0a8/4) /* */ -#define io_vidOverlayDvdy (0x0ac/4) /* */ -#define io_vgab0 (0x0b0/4) /* */ -#define io_vgab4 (0x0b4/4) /* */ -#define io_vgab8 (0x0b8/4) /* */ -#define io_vgabc (0x0bc/4) /* */ - -/* 0x0c0 */ -#define io_vgac0 (0x0c0/4) /* */ -#define io_vgac4 (0x0c4/4) /* */ -#define io_vgac8 (0x0c8/4) /* */ -#define io_vgacc (0x0cc/4) /* */ -#define io_vgad0 (0x0d0/4) /* */ -#define io_vgad4 (0x0d4/4) /* */ -#define io_vgad8 (0x0d8/4) /* */ -#define io_vgadc (0x0dc/4) /* */ -#define io_vidOverlayDvdyOffset (0x0e0/4) /* */ -#define io_vidDesktopStartAddr (0x0e4/4) /* */ -#define io_vidDesktopOverlayStride (0x0e8/4) /* */ -#define io_vidInAddr0 (0x0ec/4) /* */ -#define io_vidInAddr1 (0x0f0/4) /* */ -#define io_vidInAddr2 (0x0f4/4) /* */ -#define io_vidInStride (0x0f8/4) /* */ -#define io_vidCurrOverlayStartAddr (0x0fc/4) /* */ - - - -/************************************* - * - * Register string table for debug - * - *************************************/ - -static const char *const banshee_io_reg_name[] = -{ - /* 0x000 */ - "status", "pciInit0", "sipMonitor", "lfbMemoryConfig", - "miscInit0", "miscInit1", "dramInit0", "dramInit1", - "agpInit", "tmuGbeInit", "vgaInit0", "vgaInit1", - "dramCommand", "dramData", "reserved38", "reserved3c", - - /* 0x040 */ - "pllCtrl0", "pllCtrl1", "pllCtrl2", "dacMode", - "dacAddr", "dacData", "rgbMaxDelta", "vidProcCfg", - "hwCurPatAddr", "hwCurLoc", "hwCurC0", "hwCurC1", - "vidInFormat", "vidInStatus", "vidSerialParallelPort","vidInXDecimDeltas", - - /* 0x080 */ - "vidInDecimInitErrs","vidInYDecimDeltas","vidPixelBufThold","vidChromaMin", - "vidChromaMax", "vidCurrentLine","vidScreenSize","vidOverlayStartCoords", - "vidOverlayEndScreenCoord","vidOverlayDudx","vidOverlayDudxOffsetSrcWidth","vidOverlayDvdy", - "vga[b0]", "vga[b4]", "vga[b8]", "vga[bc]", - - /* 0x0c0 */ - "vga[c0]", "vga[c4]", "vga[c8]", "vga[cc]", - "vga[d0]", "vga[d4]", "vga[d8]", "vga[dc]", - "vidOverlayDvdyOffset","vidDesktopStartAddr","vidDesktopOverlayStride","vidInAddr0", - "vidInAddr1", "vidInAddr2", "vidInStride", "vidCurrOverlayStartAddr" -}; - - - -/************************************* - * - * Voodoo Banshee AGP space registers - * - *************************************/ - -/* 0x000 */ -#define agpReqSize (0x000/4) /* */ -#define agpHostAddressLow (0x004/4) /* */ -#define agpHostAddressHigh (0x008/4) /* */ -#define agpGraphicsAddress (0x00c/4) /* */ -#define agpGraphicsStride (0x010/4) /* */ -#define agpMoveCMD (0x014/4) /* */ -#define cmdBaseAddr0 (0x020/4) /* */ -#define cmdBaseSize0 (0x024/4) /* */ -#define cmdBump0 (0x028/4) /* */ -#define cmdRdPtrL0 (0x02c/4) /* */ -#define cmdRdPtrH0 (0x030/4) /* */ -#define cmdAMin0 (0x034/4) /* */ -#define cmdAMax0 (0x03c/4) /* */ - -/* 0x040 */ -#define cmdFifoDepth0 (0x044/4) /* */ -#define cmdHoleCnt0 (0x048/4) /* */ -#define cmdBaseAddr1 (0x050/4) /* */ -#define cmdBaseSize1 (0x054/4) /* */ -#define cmdBump1 (0x058/4) /* */ -#define cmdRdPtrL1 (0x05c/4) /* */ -#define cmdRdPtrH1 (0x060/4) /* */ -#define cmdAMin1 (0x064/4) /* */ -#define cmdAMax1 (0x06c/4) /* */ -#define cmdFifoDepth1 (0x074/4) /* */ -#define cmdHoleCnt1 (0x078/4) /* */ - -/* 0x080 */ -#define cmdFifoThresh (0x080/4) /* */ -#define cmdHoleInt (0x084/4) /* */ - -/* 0x100 */ -#define yuvBaseAddress (0x100/4) /* */ -#define yuvStride (0x104/4) /* */ -#define crc1 (0x120/4) /* */ -#define crc2 (0x130/4) /* */ - - - -/************************************* - * - * Register string table for debug - * - *************************************/ - -static const char *const banshee_agp_reg_name[] = -{ - /* 0x000 */ - "agpReqSize", "agpHostAddressLow","agpHostAddressHigh","agpGraphicsAddress", - "agpGraphicsStride","agpMoveCMD","reserved18", "reserved1c", - "cmdBaseAddr0", "cmdBaseSize0", "cmdBump0", "cmdRdPtrL0", - "cmdRdPtrH0", "cmdAMin0", "reserved38", "cmdAMax0", - - /* 0x040 */ - "reserved40", "cmdFifoDepth0","cmdHoleCnt0", "reserved4c", - "cmdBaseAddr1", "cmdBaseSize1", "cmdBump1", "cmdRdPtrL1", - "cmdRdPtrH1", "cmdAMin1", "reserved68", "cmdAMax1", - "reserved70", "cmdFifoDepth1","cmdHoleCnt1", "reserved7c", - - /* 0x080 */ - "cmdFifoThresh","cmdHoleInt", "reserved88", "reserved8c", - "reserved90", "reserved94", "reserved98", "reserved9c", - "reserveda0", "reserveda4", "reserveda8", "reservedac", - "reservedb0", "reservedb4", "reservedb8", "reservedbc", - - /* 0x0c0 */ - "reservedc0", "reservedc4", "reservedc8", "reservedcc", - "reservedd0", "reservedd4", "reservedd8", "reserveddc", - "reservede0", "reservede4", "reservede8", "reservedec", - "reservedf0", "reservedf4", "reservedf8", "reservedfc", - - /* 0x100 */ - "yuvBaseAddress","yuvStride", "reserved108", "reserved10c", - "reserved110", "reserved114", "reserved118", "reserved11c", - "crc1", "reserved124", "reserved128", "reserved12c", - "crc2", "reserved134", "reserved138", "reserved13c" -}; - - - -/************************************* - * - * Dithering tables - * - *************************************/ - -static const UINT8 dither_matrix_4x4[16] = -{ - 0, 8, 2, 10, - 12, 4, 14, 6, - 3, 11, 1, 9, - 15, 7, 13, 5 -}; - -static const UINT8 dither_matrix_2x2[16] = -{ - 2, 10, 2, 10, - 14, 6, 14, 6, - 2, 10, 2, 10, - 14, 6, 14, 6 -}; - - - -/************************************* - * - * Macros for extracting pixels - * - *************************************/ - -#define EXTRACT_565_TO_888(val, a, b, c) \ - (a) = (((val) >> 8) & 0xf8) | (((val) >> 13) & 0x07); \ - (b) = (((val) >> 3) & 0xfc) | (((val) >> 9) & 0x03); \ - (c) = (((val) << 3) & 0xf8) | (((val) >> 2) & 0x07); -#define EXTRACT_x555_TO_888(val, a, b, c) \ - (a) = (((val) >> 7) & 0xf8) | (((val) >> 12) & 0x07); \ - (b) = (((val) >> 2) & 0xf8) | (((val) >> 7) & 0x07); \ - (c) = (((val) << 3) & 0xf8) | (((val) >> 2) & 0x07); -#define EXTRACT_555x_TO_888(val, a, b, c) \ - (a) = (((val) >> 8) & 0xf8) | (((val) >> 13) & 0x07); \ - (b) = (((val) >> 3) & 0xf8) | (((val) >> 8) & 0x07); \ - (c) = (((val) << 2) & 0xf8) | (((val) >> 3) & 0x07); -#define EXTRACT_1555_TO_8888(val, a, b, c, d) \ - (a) = ((INT16)(val) >> 15) & 0xff; \ - EXTRACT_x555_TO_888(val, b, c, d) -#define EXTRACT_5551_TO_8888(val, a, b, c, d) \ - EXTRACT_555x_TO_888(val, a, b, c) \ - (d) = ((val) & 0x0001) ? 0xff : 0x00; -#define EXTRACT_x888_TO_888(val, a, b, c) \ - (a) = ((val) >> 16) & 0xff; \ - (b) = ((val) >> 8) & 0xff; \ - (c) = ((val) >> 0) & 0xff; -#define EXTRACT_888x_TO_888(val, a, b, c) \ - (a) = ((val) >> 24) & 0xff; \ - (b) = ((val) >> 16) & 0xff; \ - (c) = ((val) >> 8) & 0xff; -#define EXTRACT_8888_TO_8888(val, a, b, c, d) \ - (a) = ((val) >> 24) & 0xff; \ - (b) = ((val) >> 16) & 0xff; \ - (c) = ((val) >> 8) & 0xff; \ - (d) = ((val) >> 0) & 0xff; -#define EXTRACT_4444_TO_8888(val, a, b, c, d) \ - (a) = (((val) >> 8) & 0xf0) | (((val) >> 12) & 0x0f); \ - (b) = (((val) >> 4) & 0xf0) | (((val) >> 8) & 0x0f); \ - (c) = (((val) >> 0) & 0xf0) | (((val) >> 4) & 0x0f); \ - (d) = (((val) << 4) & 0xf0) | (((val) >> 0) & 0x0f); -#define EXTRACT_332_TO_888(val, a, b, c) \ - (a) = (((val) >> 0) & 0xe0) | (((val) >> 3) & 0x1c) | (((val) >> 6) & 0x03); \ - (b) = (((val) << 3) & 0xe0) | (((val) >> 0) & 0x1c) | (((val) >> 3) & 0x03); \ - (c) = (((val) << 6) & 0xc0) | (((val) << 4) & 0x30) | (((val) << 2) & 0x0c) | (((val) << 0) & 0x03); - - -/************************************* - * - * Misc. macros - * - *************************************/ - -/* macro for clamping a value between minimum and maximum values */ -#define CLAMP(val,min,max) do { if ((val) < (min)) { (val) = (min); } else if ((val) > (max)) { (val) = (max); } } while (0) - -/* macro to compute the base 2 log for LOD calculations */ -#define LOGB2(x) (log((double)(x)) / log(2.0)) - - - -/************************************* - * - * Macros for extracting bitfields - * - *************************************/ - -#define INITEN_ENABLE_HW_INIT(val) (((val) >> 0) & 1) -#define INITEN_ENABLE_PCI_FIFO(val) (((val) >> 1) & 1) -#define INITEN_REMAP_INIT_TO_DAC(val) (((val) >> 2) & 1) -#define INITEN_ENABLE_SNOOP0(val) (((val) >> 4) & 1) -#define INITEN_SNOOP0_MEMORY_MATCH(val) (((val) >> 5) & 1) -#define INITEN_SNOOP0_READWRITE_MATCH(val) (((val) >> 6) & 1) -#define INITEN_ENABLE_SNOOP1(val) (((val) >> 7) & 1) -#define INITEN_SNOOP1_MEMORY_MATCH(val) (((val) >> 8) & 1) -#define INITEN_SNOOP1_READWRITE_MATCH(val) (((val) >> 9) & 1) -#define INITEN_SLI_BUS_OWNER(val) (((val) >> 10) & 1) -#define INITEN_SLI_ODD_EVEN(val) (((val) >> 11) & 1) -#define INITEN_SECONDARY_REV_ID(val) (((val) >> 12) & 0xf) /* voodoo 2 only */ -#define INITEN_MFCTR_FAB_ID(val) (((val) >> 16) & 0xf) /* voodoo 2 only */ -#define INITEN_ENABLE_PCI_INTERRUPT(val) (((val) >> 20) & 1) /* voodoo 2 only */ -#define INITEN_PCI_INTERRUPT_TIMEOUT(val) (((val) >> 21) & 1) /* voodoo 2 only */ -#define INITEN_ENABLE_NAND_TREE_TEST(val) (((val) >> 22) & 1) /* voodoo 2 only */ -#define INITEN_ENABLE_SLI_ADDRESS_SNOOP(val) (((val) >> 23) & 1) /* voodoo 2 only */ -#define INITEN_SLI_SNOOP_ADDRESS(val) (((val) >> 24) & 0xff) /* voodoo 2 only */ - -#define FBZCP_CC_RGBSELECT(val) (((val) >> 0) & 3) -#define FBZCP_CC_ASELECT(val) (((val) >> 2) & 3) -#define FBZCP_CC_LOCALSELECT(val) (((val) >> 4) & 1) -#define FBZCP_CCA_LOCALSELECT(val) (((val) >> 5) & 3) -#define FBZCP_CC_LOCALSELECT_OVERRIDE(val) (((val) >> 7) & 1) -#define FBZCP_CC_ZERO_OTHER(val) (((val) >> 8) & 1) -#define FBZCP_CC_SUB_CLOCAL(val) (((val) >> 9) & 1) -#define FBZCP_CC_MSELECT(val) (((val) >> 10) & 7) -#define FBZCP_CC_REVERSE_BLEND(val) (((val) >> 13) & 1) -#define FBZCP_CC_ADD_ACLOCAL(val) (((val) >> 14) & 3) -#define FBZCP_CC_INVERT_OUTPUT(val) (((val) >> 16) & 1) -#define FBZCP_CCA_ZERO_OTHER(val) (((val) >> 17) & 1) -#define FBZCP_CCA_SUB_CLOCAL(val) (((val) >> 18) & 1) -#define FBZCP_CCA_MSELECT(val) (((val) >> 19) & 7) -#define FBZCP_CCA_REVERSE_BLEND(val) (((val) >> 22) & 1) -#define FBZCP_CCA_ADD_ACLOCAL(val) (((val) >> 23) & 3) -#define FBZCP_CCA_INVERT_OUTPUT(val) (((val) >> 25) & 1) -#define FBZCP_CCA_SUBPIXEL_ADJUST(val) (((val) >> 26) & 1) -#define FBZCP_TEXTURE_ENABLE(val) (((val) >> 27) & 1) -#define FBZCP_RGBZW_CLAMP(val) (((val) >> 28) & 1) /* voodoo 2 only */ -#define FBZCP_ANTI_ALIAS(val) (((val) >> 29) & 1) /* voodoo 2 only */ - -#define ALPHAMODE_ALPHATEST(val) (((val) >> 0) & 1) -#define ALPHAMODE_ALPHAFUNCTION(val) (((val) >> 1) & 7) -#define ALPHAMODE_ALPHABLEND(val) (((val) >> 4) & 1) -#define ALPHAMODE_ANTIALIAS(val) (((val) >> 5) & 1) -#define ALPHAMODE_SRCRGBBLEND(val) (((val) >> 8) & 15) -#define ALPHAMODE_DSTRGBBLEND(val) (((val) >> 12) & 15) -#define ALPHAMODE_SRCALPHABLEND(val) (((val) >> 16) & 15) -#define ALPHAMODE_DSTALPHABLEND(val) (((val) >> 20) & 15) -#define ALPHAMODE_ALPHAREF(val) (((val) >> 24) & 0xff) - -#define FOGMODE_ENABLE_FOG(val) (((val) >> 0) & 1) -#define FOGMODE_FOG_ADD(val) (((val) >> 1) & 1) -#define FOGMODE_FOG_MULT(val) (((val) >> 2) & 1) -#define FOGMODE_FOG_ZALPHA(val) (((val) >> 3) & 3) -#define FOGMODE_FOG_CONSTANT(val) (((val) >> 5) & 1) -#define FOGMODE_FOG_DITHER(val) (((val) >> 6) & 1) /* voodoo 2 only */ -#define FOGMODE_FOG_ZONES(val) (((val) >> 7) & 1) /* voodoo 2 only */ - -#define FBZMODE_ENABLE_CLIPPING(val) (((val) >> 0) & 1) -#define FBZMODE_ENABLE_CHROMAKEY(val) (((val) >> 1) & 1) -#define FBZMODE_ENABLE_STIPPLE(val) (((val) >> 2) & 1) -#define FBZMODE_WBUFFER_SELECT(val) (((val) >> 3) & 1) -#define FBZMODE_ENABLE_DEPTHBUF(val) (((val) >> 4) & 1) -#define FBZMODE_DEPTH_FUNCTION(val) (((val) >> 5) & 7) -#define FBZMODE_ENABLE_DITHERING(val) (((val) >> 8) & 1) -#define FBZMODE_RGB_BUFFER_MASK(val) (((val) >> 9) & 1) -#define FBZMODE_AUX_BUFFER_MASK(val) (((val) >> 10) & 1) -#define FBZMODE_DITHER_TYPE(val) (((val) >> 11) & 1) -#define FBZMODE_STIPPLE_PATTERN(val) (((val) >> 12) & 1) -#define FBZMODE_ENABLE_ALPHA_MASK(val) (((val) >> 13) & 1) -#define FBZMODE_DRAW_BUFFER(val) (((val) >> 14) & 3) -#define FBZMODE_ENABLE_DEPTH_BIAS(val) (((val) >> 16) & 1) -#define FBZMODE_Y_ORIGIN(val) (((val) >> 17) & 1) -#define FBZMODE_ENABLE_ALPHA_PLANES(val) (((val) >> 18) & 1) -#define FBZMODE_ALPHA_DITHER_SUBTRACT(val) (((val) >> 19) & 1) -#define FBZMODE_DEPTH_SOURCE_COMPARE(val) (((val) >> 20) & 1) -#define FBZMODE_DEPTH_FLOAT_SELECT(val) (((val) >> 21) & 1) /* voodoo 2 only */ - -#define LFBMODE_WRITE_FORMAT(val) (((val) >> 0) & 0xf) -#define LFBMODE_WRITE_BUFFER_SELECT(val) (((val) >> 4) & 3) -#define LFBMODE_READ_BUFFER_SELECT(val) (((val) >> 6) & 3) -#define LFBMODE_ENABLE_PIXEL_PIPELINE(val) (((val) >> 8) & 1) -#define LFBMODE_RGBA_LANES(val) (((val) >> 9) & 3) -#define LFBMODE_WORD_SWAP_WRITES(val) (((val) >> 11) & 1) -#define LFBMODE_BYTE_SWIZZLE_WRITES(val) (((val) >> 12) & 1) -#define LFBMODE_Y_ORIGIN(val) (((val) >> 13) & 1) -#define LFBMODE_WRITE_W_SELECT(val) (((val) >> 14) & 1) -#define LFBMODE_WORD_SWAP_READS(val) (((val) >> 15) & 1) -#define LFBMODE_BYTE_SWIZZLE_READS(val) (((val) >> 16) & 1) - -#define CHROMARANGE_BLUE_EXCLUSIVE(val) (((val) >> 24) & 1) -#define CHROMARANGE_GREEN_EXCLUSIVE(val) (((val) >> 25) & 1) -#define CHROMARANGE_RED_EXCLUSIVE(val) (((val) >> 26) & 1) -#define CHROMARANGE_UNION_MODE(val) (((val) >> 27) & 1) -#define CHROMARANGE_ENABLE(val) (((val) >> 28) & 1) - -#define FBIINIT0_VGA_PASSTHRU(val) (((val) >> 0) & 1) -#define FBIINIT0_GRAPHICS_RESET(val) (((val) >> 1) & 1) -#define FBIINIT0_FIFO_RESET(val) (((val) >> 2) & 1) -#define FBIINIT0_SWIZZLE_REG_WRITES(val) (((val) >> 3) & 1) -#define FBIINIT0_STALL_PCIE_FOR_HWM(val) (((val) >> 4) & 1) -#define FBIINIT0_PCI_FIFO_LWM(val) (((val) >> 6) & 0x1f) -#define FBIINIT0_LFB_TO_MEMORY_FIFO(val) (((val) >> 11) & 1) -#define FBIINIT0_TEXMEM_TO_MEMORY_FIFO(val) (((val) >> 12) & 1) -#define FBIINIT0_ENABLE_MEMORY_FIFO(val) (((val) >> 13) & 1) -#define FBIINIT0_MEMORY_FIFO_HWM(val) (((val) >> 14) & 0x7ff) -#define FBIINIT0_MEMORY_FIFO_BURST(val) (((val) >> 25) & 0x3f) - -#define FBIINIT1_PCI_DEV_FUNCTION(val) (((val) >> 0) & 1) -#define FBIINIT1_PCI_WRITE_WAIT_STATES(val) (((val) >> 1) & 1) -#define FBIINIT1_MULTI_SST1(val) (((val) >> 2) & 1) /* not on voodoo 2 */ -#define FBIINIT1_ENABLE_LFB(val) (((val) >> 3) & 1) -#define FBIINIT1_X_VIDEO_TILES(val) (((val) >> 4) & 0xf) -#define FBIINIT1_VIDEO_TIMING_RESET(val) (((val) >> 8) & 1) -#define FBIINIT1_SOFTWARE_OVERRIDE(val) (((val) >> 9) & 1) -#define FBIINIT1_SOFTWARE_HSYNC(val) (((val) >> 10) & 1) -#define FBIINIT1_SOFTWARE_VSYNC(val) (((val) >> 11) & 1) -#define FBIINIT1_SOFTWARE_BLANK(val) (((val) >> 12) & 1) -#define FBIINIT1_DRIVE_VIDEO_TIMING(val) (((val) >> 13) & 1) -#define FBIINIT1_DRIVE_VIDEO_BLANK(val) (((val) >> 14) & 1) -#define FBIINIT1_DRIVE_VIDEO_SYNC(val) (((val) >> 15) & 1) -#define FBIINIT1_DRIVE_VIDEO_DCLK(val) (((val) >> 16) & 1) -#define FBIINIT1_VIDEO_TIMING_VCLK(val) (((val) >> 17) & 1) -#define FBIINIT1_VIDEO_CLK_2X_DELAY(val) (((val) >> 18) & 3) -#define FBIINIT1_VIDEO_TIMING_SOURCE(val) (((val) >> 20) & 3) -#define FBIINIT1_ENABLE_24BPP_OUTPUT(val) (((val) >> 22) & 1) -#define FBIINIT1_ENABLE_SLI(val) (((val) >> 23) & 1) -#define FBIINIT1_X_VIDEO_TILES_BIT5(val) (((val) >> 24) & 1) /* voodoo 2 only */ -#define FBIINIT1_ENABLE_EDGE_FILTER(val) (((val) >> 25) & 1) -#define FBIINIT1_INVERT_VID_CLK_2X(val) (((val) >> 26) & 1) -#define FBIINIT1_VID_CLK_2X_SEL_DELAY(val) (((val) >> 27) & 3) -#define FBIINIT1_VID_CLK_DELAY(val) (((val) >> 29) & 3) -#define FBIINIT1_DISABLE_FAST_READAHEAD(val) (((val) >> 31) & 1) - -#define FBIINIT2_DISABLE_DITHER_SUB(val) (((val) >> 0) & 1) -#define FBIINIT2_DRAM_BANKING(val) (((val) >> 1) & 1) -#define FBIINIT2_ENABLE_TRIPLE_BUF(val) (((val) >> 4) & 1) -#define FBIINIT2_ENABLE_FAST_RAS_READ(val) (((val) >> 5) & 1) -#define FBIINIT2_ENABLE_GEN_DRAM_OE(val) (((val) >> 6) & 1) -#define FBIINIT2_ENABLE_FAST_READWRITE(val) (((val) >> 7) & 1) -#define FBIINIT2_ENABLE_PASSTHRU_DITHER(val) (((val) >> 8) & 1) -#define FBIINIT2_SWAP_BUFFER_ALGORITHM(val) (((val) >> 9) & 3) -#define FBIINIT2_VIDEO_BUFFER_OFFSET(val) (((val) >> 11) & 0x1ff) -#define FBIINIT2_ENABLE_DRAM_BANKING(val) (((val) >> 20) & 1) -#define FBIINIT2_ENABLE_DRAM_READ_FIFO(val) (((val) >> 21) & 1) -#define FBIINIT2_ENABLE_DRAM_REFRESH(val) (((val) >> 22) & 1) -#define FBIINIT2_REFRESH_LOAD_VALUE(val) (((val) >> 23) & 0x1ff) - -#define FBIINIT3_TRI_REGISTER_REMAP(val) (((val) >> 0) & 1) -#define FBIINIT3_VIDEO_FIFO_THRESH(val) (((val) >> 1) & 0x1f) -#define FBIINIT3_DISABLE_TMUS(val) (((val) >> 6) & 1) -#define FBIINIT3_FBI_MEMORY_TYPE(val) (((val) >> 8) & 7) -#define FBIINIT3_VGA_PASS_RESET_VAL(val) (((val) >> 11) & 1) -#define FBIINIT3_HARDCODE_PCI_BASE(val) (((val) >> 12) & 1) -#define FBIINIT3_FBI2TREX_DELAY(val) (((val) >> 13) & 0xf) -#define FBIINIT3_TREX2FBI_DELAY(val) (((val) >> 17) & 0x1f) -#define FBIINIT3_YORIGIN_SUBTRACT(val) (((val) >> 22) & 0x3ff) - -#define FBIINIT4_PCI_READ_WAITS(val) (((val) >> 0) & 1) -#define FBIINIT4_ENABLE_LFB_READAHEAD(val) (((val) >> 1) & 1) -#define FBIINIT4_MEMORY_FIFO_LWM(val) (((val) >> 2) & 0x3f) -#define FBIINIT4_MEMORY_FIFO_START_ROW(val) (((val) >> 8) & 0x3ff) -#define FBIINIT4_MEMORY_FIFO_STOP_ROW(val) (((val) >> 18) & 0x3ff) -#define FBIINIT4_VIDEO_CLOCKING_DELAY(val) (((val) >> 29) & 7) /* voodoo 2 only */ - -#define FBIINIT5_DISABLE_PCI_STOP(val) (((val) >> 0) & 1) /* voodoo 2 only */ -#define FBIINIT5_PCI_SLAVE_SPEED(val) (((val) >> 1) & 1) /* voodoo 2 only */ -#define FBIINIT5_DAC_DATA_OUTPUT_WIDTH(val) (((val) >> 2) & 1) /* voodoo 2 only */ -#define FBIINIT5_DAC_DATA_17_OUTPUT(val) (((val) >> 3) & 1) /* voodoo 2 only */ -#define FBIINIT5_DAC_DATA_18_OUTPUT(val) (((val) >> 4) & 1) /* voodoo 2 only */ -#define FBIINIT5_GENERIC_STRAPPING(val) (((val) >> 5) & 0xf) /* voodoo 2 only */ -#define FBIINIT5_BUFFER_ALLOCATION(val) (((val) >> 9) & 3) /* voodoo 2 only */ -#define FBIINIT5_DRIVE_VID_CLK_SLAVE(val) (((val) >> 11) & 1) /* voodoo 2 only */ -#define FBIINIT5_DRIVE_DAC_DATA_16(val) (((val) >> 12) & 1) /* voodoo 2 only */ -#define FBIINIT5_VCLK_INPUT_SELECT(val) (((val) >> 13) & 1) /* voodoo 2 only */ -#define FBIINIT5_MULTI_CVG_DETECT(val) (((val) >> 14) & 1) /* voodoo 2 only */ -#define FBIINIT5_SYNC_RETRACE_READS(val) (((val) >> 15) & 1) /* voodoo 2 only */ -#define FBIINIT5_ENABLE_RHBORDER_COLOR(val) (((val) >> 16) & 1) /* voodoo 2 only */ -#define FBIINIT5_ENABLE_LHBORDER_COLOR(val) (((val) >> 17) & 1) /* voodoo 2 only */ -#define FBIINIT5_ENABLE_BVBORDER_COLOR(val) (((val) >> 18) & 1) /* voodoo 2 only */ -#define FBIINIT5_ENABLE_TVBORDER_COLOR(val) (((val) >> 19) & 1) /* voodoo 2 only */ -#define FBIINIT5_DOUBLE_HORIZ(val) (((val) >> 20) & 1) /* voodoo 2 only */ -#define FBIINIT5_DOUBLE_VERT(val) (((val) >> 21) & 1) /* voodoo 2 only */ -#define FBIINIT5_ENABLE_16BIT_GAMMA(val) (((val) >> 22) & 1) /* voodoo 2 only */ -#define FBIINIT5_INVERT_DAC_HSYNC(val) (((val) >> 23) & 1) /* voodoo 2 only */ -#define FBIINIT5_INVERT_DAC_VSYNC(val) (((val) >> 24) & 1) /* voodoo 2 only */ -#define FBIINIT5_ENABLE_24BIT_DACDATA(val) (((val) >> 25) & 1) /* voodoo 2 only */ -#define FBIINIT5_ENABLE_INTERLACING(val) (((val) >> 26) & 1) /* voodoo 2 only */ -#define FBIINIT5_DAC_DATA_18_CONTROL(val) (((val) >> 27) & 1) /* voodoo 2 only */ -#define FBIINIT5_RASTERIZER_UNIT_MODE(val) (((val) >> 30) & 3) /* voodoo 2 only */ - -#define FBIINIT6_WINDOW_ACTIVE_COUNTER(val) (((val) >> 0) & 7) /* voodoo 2 only */ -#define FBIINIT6_WINDOW_DRAG_COUNTER(val) (((val) >> 3) & 0x1f) /* voodoo 2 only */ -#define FBIINIT6_SLI_SYNC_MASTER(val) (((val) >> 8) & 1) /* voodoo 2 only */ -#define FBIINIT6_DAC_DATA_22_OUTPUT(val) (((val) >> 9) & 3) /* voodoo 2 only */ -#define FBIINIT6_DAC_DATA_23_OUTPUT(val) (((val) >> 11) & 3) /* voodoo 2 only */ -#define FBIINIT6_SLI_SYNCIN_OUTPUT(val) (((val) >> 13) & 3) /* voodoo 2 only */ -#define FBIINIT6_SLI_SYNCOUT_OUTPUT(val) (((val) >> 15) & 3) /* voodoo 2 only */ -#define FBIINIT6_DAC_RD_OUTPUT(val) (((val) >> 17) & 3) /* voodoo 2 only */ -#define FBIINIT6_DAC_WR_OUTPUT(val) (((val) >> 19) & 3) /* voodoo 2 only */ -#define FBIINIT6_PCI_FIFO_LWM_RDY(val) (((val) >> 21) & 0x7f) /* voodoo 2 only */ -#define FBIINIT6_VGA_PASS_N_OUTPUT(val) (((val) >> 28) & 3) /* voodoo 2 only */ -#define FBIINIT6_X_VIDEO_TILES_BIT0(val) (((val) >> 30) & 1) /* voodoo 2 only */ - -#define FBIINIT7_GENERIC_STRAPPING(val) (((val) >> 0) & 0xff) /* voodoo 2 only */ -#define FBIINIT7_CMDFIFO_ENABLE(val) (((val) >> 8) & 1) /* voodoo 2 only */ -#define FBIINIT7_CMDFIFO_MEMORY_STORE(val) (((val) >> 9) & 1) /* voodoo 2 only */ -#define FBIINIT7_DISABLE_CMDFIFO_HOLES(val) (((val) >> 10) & 1) /* voodoo 2 only */ -#define FBIINIT7_CMDFIFO_READ_THRESH(val) (((val) >> 11) & 0x1f) /* voodoo 2 only */ -#define FBIINIT7_SYNC_CMDFIFO_WRITES(val) (((val) >> 16) & 1) /* voodoo 2 only */ -#define FBIINIT7_SYNC_CMDFIFO_READS(val) (((val) >> 17) & 1) /* voodoo 2 only */ -#define FBIINIT7_RESET_PCI_PACKER(val) (((val) >> 18) & 1) /* voodoo 2 only */ -#define FBIINIT7_ENABLE_CHROMA_STUFF(val) (((val) >> 19) & 1) /* voodoo 2 only */ -#define FBIINIT7_CMDFIFO_PCI_TIMEOUT(val) (((val) >> 20) & 0x7f) /* voodoo 2 only */ -#define FBIINIT7_ENABLE_TEXTURE_BURST(val) (((val) >> 27) & 1) /* voodoo 2 only */ - -#define TEXMODE_ENABLE_PERSPECTIVE(val) (((val) >> 0) & 1) -#define TEXMODE_MINIFICATION_FILTER(val) (((val) >> 1) & 1) -#define TEXMODE_MAGNIFICATION_FILTER(val) (((val) >> 2) & 1) -#define TEXMODE_CLAMP_NEG_W(val) (((val) >> 3) & 1) -#define TEXMODE_ENABLE_LOD_DITHER(val) (((val) >> 4) & 1) -#define TEXMODE_NCC_TABLE_SELECT(val) (((val) >> 5) & 1) -#define TEXMODE_CLAMP_S(val) (((val) >> 6) & 1) -#define TEXMODE_CLAMP_T(val) (((val) >> 7) & 1) -#define TEXMODE_FORMAT(val) (((val) >> 8) & 0xf) -#define TEXMODE_TC_ZERO_OTHER(val) (((val) >> 12) & 1) -#define TEXMODE_TC_SUB_CLOCAL(val) (((val) >> 13) & 1) -#define TEXMODE_TC_MSELECT(val) (((val) >> 14) & 7) -#define TEXMODE_TC_REVERSE_BLEND(val) (((val) >> 17) & 1) -#define TEXMODE_TC_ADD_ACLOCAL(val) (((val) >> 18) & 3) -#define TEXMODE_TC_INVERT_OUTPUT(val) (((val) >> 20) & 1) -#define TEXMODE_TCA_ZERO_OTHER(val) (((val) >> 21) & 1) -#define TEXMODE_TCA_SUB_CLOCAL(val) (((val) >> 22) & 1) -#define TEXMODE_TCA_MSELECT(val) (((val) >> 23) & 7) -#define TEXMODE_TCA_REVERSE_BLEND(val) (((val) >> 26) & 1) -#define TEXMODE_TCA_ADD_ACLOCAL(val) (((val) >> 27) & 3) -#define TEXMODE_TCA_INVERT_OUTPUT(val) (((val) >> 29) & 1) -#define TEXMODE_TRILINEAR(val) (((val) >> 30) & 1) -#define TEXMODE_SEQ_8_DOWNLD(val) (((val) >> 31) & 1) - -#define TEXLOD_LODMIN(val) (((val) >> 0) & 0x3f) -#define TEXLOD_LODMAX(val) (((val) >> 6) & 0x3f) -#define TEXLOD_LODBIAS(val) (((val) >> 12) & 0x3f) -#define TEXLOD_LOD_ODD(val) (((val) >> 18) & 1) -#define TEXLOD_LOD_TSPLIT(val) (((val) >> 19) & 1) -#define TEXLOD_LOD_S_IS_WIDER(val) (((val) >> 20) & 1) -#define TEXLOD_LOD_ASPECT(val) (((val) >> 21) & 3) -#define TEXLOD_LOD_ZEROFRAC(val) (((val) >> 23) & 1) -#define TEXLOD_TMULTIBASEADDR(val) (((val) >> 24) & 1) -#define TEXLOD_TDATA_SWIZZLE(val) (((val) >> 25) & 1) -#define TEXLOD_TDATA_SWAP(val) (((val) >> 26) & 1) -#define TEXLOD_TDIRECT_WRITE(val) (((val) >> 27) & 1) /* Voodoo 2 only */ - -#define TEXDETAIL_DETAIL_MAX(val) (((val) >> 0) & 0xff) -#define TEXDETAIL_DETAIL_BIAS(val) (((val) >> 8) & 0x3f) -#define TEXDETAIL_DETAIL_SCALE(val) (((val) >> 14) & 7) -#define TEXDETAIL_RGB_MIN_FILTER(val) (((val) >> 17) & 1) /* Voodoo 2 only */ -#define TEXDETAIL_RGB_MAG_FILTER(val) (((val) >> 18) & 1) /* Voodoo 2 only */ -#define TEXDETAIL_ALPHA_MIN_FILTER(val) (((val) >> 19) & 1) /* Voodoo 2 only */ -#define TEXDETAIL_ALPHA_MAG_FILTER(val) (((val) >> 20) & 1) /* Voodoo 2 only */ -#define TEXDETAIL_SEPARATE_RGBA_FILTER(val) (((val) >> 21) & 1) /* Voodoo 2 only */ - -#define TREXINIT_SEND_TMU_CONFIG(val) (((val) >> 18) & 1) /************************************* @@ -1364,377 +21,6 @@ struct voodoo_state; struct poly_extra_data; -struct rgba -{ -#ifdef LSB_FIRST - UINT8 b, g, r, a; -#else - UINT8 a, r, g, b; -#endif -}; - - -union voodoo_reg -{ - INT32 i; - UINT32 u; - float f; - rgba rgb; -}; - - -typedef voodoo_reg rgb_union; - - -struct voodoo_stats -{ - UINT8 lastkey; /* last key state */ - UINT8 display; /* display stats? */ - INT32 swaps; /* total swaps */ - INT32 stalls; /* total stalls */ - INT32 total_triangles; /* total triangles */ - INT32 total_pixels_in; /* total pixels in */ - INT32 total_pixels_out; /* total pixels out */ - INT32 total_chroma_fail; /* total chroma fail */ - INT32 total_zfunc_fail; /* total z func fail */ - INT32 total_afunc_fail; /* total a func fail */ - INT32 total_clipped; /* total clipped */ - INT32 total_stippled; /* total stippled */ - INT32 lfb_writes; /* LFB writes */ - INT32 lfb_reads; /* LFB reads */ - INT32 reg_writes; /* register writes */ - INT32 reg_reads; /* register reads */ - INT32 tex_writes; /* texture writes */ - INT32 texture_mode[16]; /* 16 different texture modes */ - UINT8 render_override; /* render override */ - char buffer[1024]; /* string */ -}; - - -/* note that this structure is an even 64 bytes long */ -struct stats_block -{ - INT32 pixels_in; /* pixels in statistic */ - INT32 pixels_out; /* pixels out statistic */ - INT32 chroma_fail; /* chroma test fail statistic */ - INT32 zfunc_fail; /* z function test fail statistic */ - INT32 afunc_fail; /* alpha function test fail statistic */ - INT32 clip_fail; /* clipping fail statistic */ - INT32 stipple_count; /* stipple statistic */ - INT32 filler[64/4 - 7]; /* pad this structure to 64 bytes */ -}; - - -struct fifo_state -{ - UINT32 * base; /* base of the FIFO */ - INT32 size; /* size of the FIFO */ - INT32 in; /* input pointer */ - INT32 out; /* output pointer */ -}; - - -struct cmdfifo_info -{ - UINT8 enable; /* enabled? */ - UINT8 count_holes; /* count holes? */ - UINT32 base; /* base address in framebuffer RAM */ - UINT32 end; /* end address in framebuffer RAM */ - UINT32 rdptr; /* current read pointer */ - UINT32 amin; /* minimum address */ - UINT32 amax; /* maximum address */ - UINT32 depth; /* current depth */ - UINT32 holes; /* number of holes */ -}; - - -struct pci_state -{ - fifo_state fifo; /* PCI FIFO */ - UINT32 init_enable; /* initEnable value */ - UINT8 stall_state; /* state of the system if we're stalled */ - UINT8 op_pending; /* true if an operation is pending */ - attotime op_end_time; /* time when the pending operation ends */ - emu_timer * continue_timer; /* timer to use to continue processing */ - UINT32 fifo_mem[64*2]; /* memory backing the PCI FIFO */ -}; - - -struct ncc_table -{ - UINT8 dirty; /* is the texel lookup dirty? */ - voodoo_reg * reg; /* pointer to our registers */ - INT32 ir[4], ig[4], ib[4]; /* I values for R,G,B */ - INT32 qr[4], qg[4], qb[4]; /* Q values for R,G,B */ - INT32 y[16]; /* Y values */ - rgb_t * palette; /* pointer to associated RGB palette */ - rgb_t * palettea; /* pointer to associated ARGB palette */ - rgb_t texel[256]; /* texel lookup */ -}; - - -struct tmu_state -{ - UINT8 * ram; /* pointer to our RAM */ - UINT32 mask; /* mask to apply to pointers */ - voodoo_reg * reg; /* pointer to our register base */ - UINT32 regdirty; /* true if the LOD/mode/base registers have changed */ - - UINT32 texaddr_mask; /* mask for texture address */ - UINT8 texaddr_shift; /* shift for texture address */ - - INT64 starts, startt; /* starting S,T (14.18) */ - INT64 startw; /* starting W (2.30) */ - INT64 dsdx, dtdx; /* delta S,T per X */ - INT64 dwdx; /* delta W per X */ - INT64 dsdy, dtdy; /* delta S,T per Y */ - INT64 dwdy; /* delta W per Y */ - - INT32 lodmin, lodmax; /* min, max LOD values */ - INT32 lodbias; /* LOD bias */ - UINT32 lodmask; /* mask of available LODs */ - UINT32 lodoffset[9]; /* offset of texture base for each LOD */ - INT32 detailmax; /* detail clamp */ - INT32 detailbias; /* detail bias */ - UINT8 detailscale; /* detail scale */ - - UINT32 wmask; /* mask for the current texture width */ - UINT32 hmask; /* mask for the current texture height */ - - UINT32 bilinear_mask; /* mask for bilinear resolution (0xf0 for V1, 0xff for V2) */ - - ncc_table ncc[2]; /* two NCC tables */ - - rgb_t * lookup; /* currently selected lookup */ - rgb_t * texel[16]; /* texel lookups for each format */ - - rgb_t palette[256]; /* palette lookup table */ - rgb_t palettea[256]; /* palette+alpha lookup table */ -}; - - -struct tmu_shared_state -{ - rgb_t rgb332[256]; /* RGB 3-3-2 lookup table */ - rgb_t alpha8[256]; /* alpha 8-bit lookup table */ - rgb_t int8[256]; /* intensity 8-bit lookup table */ - rgb_t ai44[256]; /* alpha, intensity 4-4 lookup table */ - - rgb_t rgb565[65536]; /* RGB 5-6-5 lookup table */ - rgb_t argb1555[65536]; /* ARGB 1-5-5-5 lookup table */ - rgb_t argb4444[65536]; /* ARGB 4-4-4-4 lookup table */ -}; - - -struct setup_vertex -{ - float x, y; /* X, Y coordinates */ - float a, r, g, b; /* A, R, G, B values */ - float z, wb; /* Z and broadcast W values */ - float w0, s0, t0; /* W, S, T for TMU 0 */ - float w1, s1, t1; /* W, S, T for TMU 1 */ -}; - - -struct fbi_state -{ - UINT8 * ram; /* pointer to frame buffer RAM */ - UINT32 mask; /* mask to apply to pointers */ - UINT32 rgboffs[3]; /* word offset to 3 RGB buffers */ - UINT32 auxoffs; /* word offset to 1 aux buffer */ - - UINT8 frontbuf; /* front buffer index */ - UINT8 backbuf; /* back buffer index */ - UINT8 swaps_pending; /* number of pending swaps */ - UINT8 video_changed; /* did the frontbuffer video change? */ - - UINT32 yorigin; /* Y origin subtract value */ - UINT32 lfb_base; /* base of LFB in memory */ - UINT8 lfb_stride; /* stride of LFB accesses in bits */ - - UINT32 width; /* width of current frame buffer */ - UINT32 height; /* height of current frame buffer */ - UINT32 xoffs; /* horizontal offset (back porch) */ - UINT32 yoffs; /* vertical offset (back porch) */ - UINT32 vsyncscan; /* vertical sync scanline */ - UINT32 rowpixels; /* pixels per row */ - UINT32 tile_width; /* width of video tiles */ - UINT32 tile_height; /* height of video tiles */ - UINT32 x_tiles; /* number of tiles in the X direction */ - - emu_timer * vblank_timer; /* VBLANK timer */ - UINT8 vblank; /* VBLANK state */ - UINT8 vblank_count; /* number of VBLANKs since last swap */ - UINT8 vblank_swap_pending; /* a swap is pending, waiting for a vblank */ - UINT8 vblank_swap; /* swap when we hit this count */ - UINT8 vblank_dont_swap; /* don't actually swap when we hit this point */ - - /* triangle setup info */ - UINT8 cheating_allowed; /* allow cheating? */ - INT32 sign; /* triangle sign */ - INT16 ax, ay; /* vertex A x,y (12.4) */ - INT16 bx, by; /* vertex B x,y (12.4) */ - INT16 cx, cy; /* vertex C x,y (12.4) */ - INT32 startr, startg, startb, starta; /* starting R,G,B,A (12.12) */ - INT32 startz; /* starting Z (20.12) */ - INT64 startw; /* starting W (16.32) */ - INT32 drdx, dgdx, dbdx, dadx; /* delta R,G,B,A per X */ - INT32 dzdx; /* delta Z per X */ - INT64 dwdx; /* delta W per X */ - INT32 drdy, dgdy, dbdy, dady; /* delta R,G,B,A per Y */ - INT32 dzdy; /* delta Z per Y */ - INT64 dwdy; /* delta W per Y */ - - stats_block lfb_stats; /* LFB-access statistics */ - - UINT8 sverts; /* number of vertices ready */ - setup_vertex svert[3]; /* 3 setup vertices */ - - fifo_state fifo; /* framebuffer memory fifo */ - cmdfifo_info cmdfifo[2]; /* command FIFOs */ - - UINT8 fogblend[64]; /* 64-entry fog table */ - UINT8 fogdelta[64]; /* 64-entry fog table */ - UINT8 fogdelta_mask; /* mask for for delta (0xff for V1, 0xfc for V2) */ - - rgb_t pen[65536]; /* mapping from pixels to pens */ - rgb_t clut[512]; /* clut gamma data */ - UINT8 clut_dirty; /* do we need to recompute? */ -}; - - -struct dac_state -{ - UINT8 reg[8]; /* 8 registers */ - UINT8 read_result; /* pending read result */ -}; - - -struct raster_info -{ - raster_info * next; /* pointer to next entry with the same hash */ - poly_draw_scanline_func callback; /* callback pointer */ - UINT8 is_generic; /* TRUE if this is one of the generic rasterizers */ - UINT8 display; /* display index */ - UINT32 hits; /* how many hits (pixels) we've used this for */ - UINT32 polys; /* how many polys we've used this for */ - UINT32 eff_color_path; /* effective fbzColorPath value */ - UINT32 eff_alpha_mode; /* effective alphaMode value */ - UINT32 eff_fog_mode; /* effective fogMode value */ - UINT32 eff_fbz_mode; /* effective fbzMode value */ - UINT32 eff_tex_mode_0; /* effective textureMode value for TMU #0 */ - UINT32 eff_tex_mode_1; /* effective textureMode value for TMU #1 */ - UINT32 hash; -}; - - -struct poly_extra_data -{ - voodoo_state * state; /* pointer back to the voodoo state */ - raster_info * info; /* pointer to rasterizer information */ - - INT16 ax, ay; /* vertex A x,y (12.4) */ - INT32 startr, startg, startb, starta; /* starting R,G,B,A (12.12) */ - INT32 startz; /* starting Z (20.12) */ - INT64 startw; /* starting W (16.32) */ - INT32 drdx, dgdx, dbdx, dadx; /* delta R,G,B,A per X */ - INT32 dzdx; /* delta Z per X */ - INT64 dwdx; /* delta W per X */ - INT32 drdy, dgdy, dbdy, dady; /* delta R,G,B,A per Y */ - INT32 dzdy; /* delta Z per Y */ - INT64 dwdy; /* delta W per Y */ - - INT64 starts0, startt0; /* starting S,T (14.18) */ - INT64 startw0; /* starting W (2.30) */ - INT64 ds0dx, dt0dx; /* delta S,T per X */ - INT64 dw0dx; /* delta W per X */ - INT64 ds0dy, dt0dy; /* delta S,T per Y */ - INT64 dw0dy; /* delta W per Y */ - INT32 lodbase0; /* used during rasterization */ - - INT64 starts1, startt1; /* starting S,T (14.18) */ - INT64 startw1; /* starting W (2.30) */ - INT64 ds1dx, dt1dx; /* delta S,T per X */ - INT64 dw1dx; /* delta W per X */ - INT64 ds1dy, dt1dy; /* delta S,T per Y */ - INT64 dw1dy; /* delta W per Y */ - INT32 lodbase1; /* used during rasterization */ - - UINT16 dither[16]; /* dither matrix, for fastfill */ -}; - - -struct banshee_info -{ - UINT32 io[0x40]; /* I/O registers */ - UINT32 agp[0x80]; /* AGP registers */ - UINT8 vga[0x20]; /* VGA registers */ - UINT8 crtc[0x27]; /* VGA CRTC registers */ - UINT8 seq[0x05]; /* VGA sequencer registers */ - UINT8 gc[0x05]; /* VGA graphics controller registers */ - UINT8 att[0x15]; /* VGA attribute registers */ - UINT8 attff; /* VGA attribute flip-flop */ - - UINT32 blt_regs[0x20]; /* 2D Blitter registers */ - UINT32 blt_dst_base; - UINT32 blt_dst_x; - UINT32 blt_dst_y; - UINT32 blt_dst_width; - UINT32 blt_dst_height; - UINT32 blt_dst_stride; - UINT32 blt_dst_bpp; - UINT32 blt_cmd; - UINT32 blt_src_base; - UINT32 blt_src_x; - UINT32 blt_src_y; - UINT32 blt_src_width; - UINT32 blt_src_height; - UINT32 blt_src_stride; - UINT32 blt_src_bpp; -}; - - -struct voodoo_state -{ - UINT8 index; /* index of board */ - voodoo_device *device; /* pointer to our containing device */ - screen_device *screen; /* the screen we are acting on */ - device_t *cpu; /* the CPU we interact with */ - UINT8 type; /* type of system */ - UINT8 chipmask; /* mask for which chips are available */ - UINT32 freq; /* operating frequency */ - attoseconds_t attoseconds_per_cycle; /* attoseconds per cycle */ - UINT32 extra_cycles; /* extra cycles not yet accounted for */ - int trigger; /* trigger used for stalling */ - - voodoo_reg reg[0x400]; /* raw registers */ - const UINT8 * regaccess; /* register access array */ - const char *const * regnames; /* register names array */ - UINT8 alt_regmap; /* enable alternate register map? */ - - pci_state pci; /* PCI state */ - dac_state dac; /* DAC state */ - - fbi_state fbi; /* FBI states */ - tmu_state tmu[MAX_TMU]; /* TMU states */ - tmu_shared_state tmushare; /* TMU shared state */ - banshee_info banshee; /* Banshee state */ - - legacy_poly_manager * poly; /* polygon manager */ - stats_block * thread_stats; /* per-thread statistics */ - - voodoo_stats stats; /* internal statistics */ - - offs_t last_status_pc; /* PC of last status description (for logging) */ - UINT32 last_status_value; /* value of last status read (for logging) */ - - int next_rasterizer; /* next rasterizer index */ - raster_info rasterizer[MAX_RASTERIZERS]; /* array of rasterizers */ - raster_info * raster_hash[RASTER_HASH_SIZE]; /* hash table of rasterizers */ - - bool send_config; - UINT32 tmu_config; -}; @@ -2345,16 +631,16 @@ do } \ while (0) -static inline bool ATTR_FORCE_INLINE chromaKeyTest(voodoo_state *v, stats_block *stats, UINT32 fbzModeReg, rgbaint_t rgbaIntColor) +static inline bool ATTR_FORCE_INLINE chromaKeyTest(voodoo_device *vd, stats_block *stats, UINT32 fbzModeReg, rgbaint_t rgbaIntColor) { if (FBZMODE_ENABLE_CHROMAKEY(fbzModeReg)) { rgb_union color; color.u = (rgbaIntColor.get_a()<<24) | (rgbaIntColor.get_r()<<16) | (rgbaIntColor.get_g()<<8) | rgbaIntColor.get_b(); /* non-range version */ - if (!CHROMARANGE_ENABLE(v->reg[chromaRange].u)) + if (!CHROMARANGE_ENABLE(vd->reg[chromaRange].u)) { - if (((color.u ^ v->reg[chromaKey].u) & 0xffffff) == 0) + if (((color.u ^ vd->reg[chromaKey].u) & 0xffffff) == 0) { stats->chroma_fail++; return false; @@ -2368,30 +654,30 @@ static inline bool ATTR_FORCE_INLINE chromaKeyTest(voodoo_state *v, stats_block int results; /* check blue */ - low = v->reg[chromaKey].rgb.b; - high = v->reg[chromaRange].rgb.b; + low = vd->reg[chromaKey].rgb.b; + high = vd->reg[chromaRange].rgb.b; test = color.rgb.b; results = (test >= low && test <= high); - results ^= CHROMARANGE_BLUE_EXCLUSIVE(v->reg[chromaRange].u); + results ^= CHROMARANGE_BLUE_EXCLUSIVE(vd->reg[chromaRange].u); results <<= 1; /* check green */ - low = v->reg[chromaKey].rgb.g; - high = v->reg[chromaRange].rgb.g; + low = vd->reg[chromaKey].rgb.g; + high = vd->reg[chromaRange].rgb.g; test = color.rgb.g; results |= (test >= low && test <= high); - results ^= CHROMARANGE_GREEN_EXCLUSIVE(v->reg[chromaRange].u); + results ^= CHROMARANGE_GREEN_EXCLUSIVE(vd->reg[chromaRange].u); results <<= 1; /* check red */ - low = v->reg[chromaKey].rgb.r; - high = v->reg[chromaRange].rgb.r; + low = vd->reg[chromaKey].rgb.r; + high = vd->reg[chromaRange].rgb.r; test = color.rgb.r; results |= (test >= low && test <= high); - results ^= CHROMARANGE_RED_EXCLUSIVE(v->reg[chromaRange].u); + results ^= CHROMARANGE_RED_EXCLUSIVE(vd->reg[chromaRange].u); /* final result */ - if (CHROMARANGE_UNION_MODE(v->reg[chromaRange].u)) + if (CHROMARANGE_UNION_MODE(vd->reg[chromaRange].u)) { if (results != 0) { @@ -2520,11 +806,11 @@ do } \ while (0) -static inline bool ATTR_FORCE_INLINE alphaTest(voodoo_state *v, stats_block *stats, UINT32 alphaModeReg, UINT8 alpha) +static inline bool ATTR_FORCE_INLINE alphaTest(voodoo_device *vd, stats_block *stats, UINT32 alphaModeReg, UINT8 alpha) { if (ALPHAMODE_ALPHATEST(alphaModeReg)) { - UINT8 alpharef = v->reg[alphaMode].rgb.a; + UINT8 alpharef = vd->reg[alphaMode].rgb.a; switch (ALPHAMODE_ALPHAFUNCTION(alphaModeReg)) { case 0: /* alphaOP = never */ @@ -3067,7 +1353,7 @@ do } \ while (0) -static inline void ATTR_FORCE_INLINE applyFogging(voodoo_state *v, UINT32 fogModeReg, UINT32 fbzCpReg, INT32 x, const UINT8 *dither4, INT32 fogDepth, +static inline void ATTR_FORCE_INLINE applyFogging(voodoo_device *vd, UINT32 fogModeReg, UINT32 fbzCpReg, INT32 x, const UINT8 *dither4, INT32 fogDepth, rgbaint_t &color, INT32 iterz, INT64 iterw, UINT8 itera) { if (FOGMODE_ENABLE_FOG(fogModeReg)) @@ -3075,7 +1361,7 @@ static inline void ATTR_FORCE_INLINE applyFogging(voodoo_state *v, UINT32 fogMod UINT32 color_alpha = color.get_a(); /* constant fog bypasses everything else */ - rgbaint_t fogColorLocal(v->reg[fogColor].u); + rgbaint_t fogColorLocal(vd->reg[fogColor].u); if (FOGMODE_FOG_CONSTANT(fogModeReg)) { @@ -3119,11 +1405,11 @@ static inline void ATTR_FORCE_INLINE applyFogging(voodoo_state *v, UINT32 fogMod { case 0: /* fog table */ { - INT32 delta = v->fbi.fogdelta[fogDepth >> 10]; + INT32 delta = vd->fbi.fogdelta[fogDepth >> 10]; INT32 deltaval; /* perform the multiply against lower 8 bits of wfloat */ - deltaval = (delta & v->fbi.fogdelta_mask) * + deltaval = (delta & vd->fbi.fogdelta_mask) * ((fogDepth >> 2) & 0xff); /* fog zones allow for negating this value */ @@ -3137,7 +1423,7 @@ static inline void ATTR_FORCE_INLINE applyFogging(voodoo_state *v, UINT32 fogMod deltaval >>= 4; /* add to the blending factor */ - fogblend = v->fbi.fogblend[fogDepth >> 10] + deltaval; + fogblend = vd->fbi.fogblend[fogDepth >> 10] + deltaval; break; } @@ -3542,7 +1828,7 @@ while (0) * *************************************/ -#define PIXEL_PIPELINE_BEGIN(VV, STATS, XX, YY, FBZCOLORPATH, FBZMODE, ITERZ, ITERW) \ +#define PIXEL_PIPELINE_BEGIN(vd, STATS, XX, YY, FBZCOLORPATH, FBZMODE, ITERZ, ITERW) \ do \ { \ INT32 depthval, wfloat, fogdepth, biasdepth; \ @@ -3559,10 +1845,10 @@ do /* rotate mode */ \ if (FBZMODE_STIPPLE_PATTERN(FBZMODE) == 0) \ { \ - (VV)->reg[stipple].u = ((VV)->reg[stipple].u << 1) | ((VV)->reg[stipple].u >> 31);\ - if (((VV)->reg[stipple].u & 0x80000000) == 0) \ + vd->reg[stipple].u = (vd->reg[stipple].u << 1) | (vd->reg[stipple].u >> 31);\ + if ((vd->reg[stipple].u & 0x80000000) == 0) \ { \ - (VV)->stats.total_stippled++; \ + vd->stats.total_stippled++; \ goto skipdrawdepth; \ } \ } \ @@ -3571,9 +1857,9 @@ do else \ { \ int stipple_index = (((YY) & 3) << 3) | (~(XX) & 7); \ - if ((((VV)->reg[stipple].u >> stipple_index) & 1) == 0) \ + if (((vd->reg[stipple].u >> stipple_index) & 1) == 0) \ { \ - (VV)->stats.total_stippled++; \ + vd->stats.total_stippled++; \ goto skipdrawdepth; \ } \ } \ @@ -3597,7 +1883,7 @@ do /* add the bias for fog selection*/ \ if (FBZMODE_ENABLE_DEPTH_BIAS(FBZMODE)) \ { \ - fogdepth += (INT16)(VV)->reg[zaColor].u; \ + fogdepth += (INT16)vd->reg[zaColor].u; \ CLAMP(fogdepth, 0, 0xffff); \ } \ \ @@ -3628,12 +1914,12 @@ do biasdepth = depthval; \ if (FBZMODE_ENABLE_DEPTH_BIAS(FBZMODE)) \ { \ - biasdepth += (INT16)(VV)->reg[zaColor].u; \ + biasdepth += (INT16)vd->reg[zaColor].u; \ CLAMP(biasdepth, 0, 0xffff); \ } -#define DEPTH_TEST(VV, STATS, XX, FBZMODE) \ +#define DEPTH_TEST(vd, STATS, XX, FBZMODE) \ do \ { \ /* handle depth buffer testing */ \ @@ -3646,7 +1932,7 @@ do if (FBZMODE_DEPTH_SOURCE_COMPARE(FBZMODE) == 0) \ depthsource = biasdepth; \ else \ - depthsource = (UINT16)(VV)->reg[zaColor].u; \ + depthsource = (UINT16)vd->reg[zaColor].u; \ \ /* test against the depth buffer */ \ switch (FBZMODE_DEPTH_FUNCTION(FBZMODE)) \ @@ -3786,11 +2072,11 @@ static inline bool ATTR_FORCE_INLINE depthTest(UINT16 zaColorReg, stats_block *s return true; } -#define PIXEL_PIPELINE_END(VV, STATS, DITHER, DITHER4, DITHER_LOOKUP, XX, dest, depth, FBZMODE, FBZCOLORPATH, ALPHAMODE, FOGMODE, ITERZ, ITERW, ITERAXXX) \ +#define PIXEL_PIPELINE_END(vd, STATS, DITHER, DITHER4, DITHER_LOOKUP, XX, dest, depth, FBZMODE, FBZCOLORPATH, ALPHAMODE, FOGMODE, ITERZ, ITERW, ITERAXXX) \ \ /* perform fogging */ \ preFog.set(color); \ - applyFogging(VV, FOGMODE, FBZCOLORPATH, XX, DITHER4, fogdepth, color, ITERZ, ITERW, ITERAXXX.get_a()); \ + applyFogging(vd, FOGMODE, FBZCOLORPATH, XX, DITHER4, fogdepth, color, ITERZ, ITERW, ITERAXXX.get_a()); \ /* perform alpha blending */ \ alphaBlend(FBZMODE, ALPHAMODE, XX, DITHER, dest[XX], depth, preFog, color); \ a = color.get_a(); r = color.get_r(); g = color.get_g(); b = color.get_b(); \ @@ -4121,7 +2407,7 @@ do } \ while (0) -static inline bool ATTR_FORCE_INLINE combineColor(voodoo_state *VV, stats_block *STATS, UINT32 FBZCOLORPATH, UINT32 FBZMODE, UINT32 ALPHAMODE, +static inline bool ATTR_FORCE_INLINE combineColor(voodoo_device *vd, stats_block *STATS, UINT32 FBZCOLORPATH, UINT32 FBZMODE, UINT32 ALPHAMODE, rgbaint_t TEXELARGB, INT32 ITERZ, INT64 ITERW, rgbaint_t &srcColor) { rgbaint_t c_other; @@ -4139,7 +2425,7 @@ static inline bool ATTR_FORCE_INLINE combineColor(voodoo_state *VV, stats_block break; case 2: /* color1 RGB */ - c_other.set((VV)->reg[color1].u); + c_other.set(vd->reg[color1].u); break; default: /* reserved - voodoo3 framebufferRGB */ @@ -4148,9 +2434,9 @@ static inline bool ATTR_FORCE_INLINE combineColor(voodoo_state *VV, stats_block } /* handle chroma key */ - if (!chromaKeyTest(VV, STATS, FBZMODE, c_other)) + if (!chromaKeyTest(vd, STATS, FBZMODE, c_other)) return false; - //APPLY_CHROMAKEY(VV, STATS, FBZMODE, c_other); + //APPLY_CHROMAKEY(vd->m_vds, STATS, FBZMODE, c_other); /* compute a_other */ switch (FBZCP_CC_ASELECT(FBZCOLORPATH)) @@ -4164,7 +2450,7 @@ static inline bool ATTR_FORCE_INLINE combineColor(voodoo_state *VV, stats_block break; case 2: /* color1 alpha */ - c_other.set_a((VV)->reg[color1].rgb.a); + c_other.set_a(vd->reg[color1].rgb.a); break; default: /* reserved */ @@ -4175,7 +2461,7 @@ static inline bool ATTR_FORCE_INLINE combineColor(voodoo_state *VV, stats_block /* handle alpha mask */ if (!alphaMaskTest(STATS, FBZMODE, c_other.get_a())) return false; - //APPLY_ALPHAMASK(VV, STATS, FBZMODE, c_other.rgb.a); + //APPLY_ALPHAMASK(vd->m_vds, STATS, FBZMODE, c_other.rgb.a); /* compute c_local */ @@ -4184,14 +2470,14 @@ static inline bool ATTR_FORCE_INLINE combineColor(voodoo_state *VV, stats_block if (FBZCP_CC_LOCALSELECT(FBZCOLORPATH) == 0) /* iterated RGB */ c_local.set(srcColor); else /* color0 RGB */ - c_local.set((VV)->reg[color0].u); + c_local.set(vd->reg[color0].u); } else { if (!(TEXELARGB.get_a() & 0x80)) /* iterated RGB */ c_local.set(srcColor); else /* color0 RGB */ - c_local.set((VV)->reg[color0].u); + c_local.set(vd->reg[color0].u); } /* compute a_local */ @@ -4203,7 +2489,7 @@ static inline bool ATTR_FORCE_INLINE combineColor(voodoo_state *VV, stats_block break; case 1: /* color0 alpha */ - c_local.set_a((VV)->reg[color0].rgb.a); + c_local.set_a(vd->reg[color0].rgb.a); break; case 2: /* clamped iterated Z[27:20] */ @@ -4355,9 +2641,9 @@ static inline bool ATTR_FORCE_INLINE combineColor(voodoo_state *VV, stats_block /* handle alpha test */ - if (!alphaTest(VV, STATS, ALPHAMODE, srcColor.get_a())) + if (!alphaTest(vd, STATS, ALPHAMODE, srcColor.get_a())) return false; - //APPLY_ALPHATEST(VV, STATS, ALPHAMODE, color.rgb.a); + //APPLY_ALPHATEST(vd->m_vds, STATS, ALPHAMODE, color.rgb.a); return true; } @@ -4372,11 +2658,11 @@ static inline bool ATTR_FORCE_INLINE combineColor(voodoo_state *VV, stats_block #define RASTERIZER(name, TMUS, FBZCOLORPATH, FBZMODE, ALPHAMODE, FOGMODE, TEXMODE0, TEXMODE1) \ \ -static void raster_##name(void *destbase, INT32 y, const poly_extent *extent, const void *extradata, int threadid) \ +void voodoo_device::raster_##name(void *destbase, INT32 y, const poly_extent *extent, const void *extradata, int threadid) \ { \ const poly_extra_data *extra = (const poly_extra_data *)extradata; \ - voodoo_state *v = extra->state; \ - stats_block *stats = &v->thread_stats[threadid]; \ + voodoo_device *vd = extra->device; \ + stats_block *stats = &vd->thread_stats[threadid]; \ DECLARE_DITHER_POINTERS; \ INT32 startx = extent->startx; \ INT32 stopx = extent->stopx; \ @@ -4394,7 +2680,7 @@ static void raster_##name(void *destbase, INT32 y, const poly_extent *extent, co /* determine the screen Y */ \ scry = y; \ if (FBZMODE_Y_ORIGIN(FBZMODE)) \ - scry = (v->fbi.yorigin - y) & 0x3ff; \ + scry = (vd->fbi.yorigin - y) & 0x3ff; \ \ /* compute dithering */ \ COMPUTE_DITHER_POINTERS(FBZMODE, y); \ @@ -4405,8 +2691,8 @@ static void raster_##name(void *destbase, INT32 y, const poly_extent *extent, co INT32 tempclip; \ \ /* Y clipping buys us the whole scanline */ \ - if (scry < ((v->reg[clipLowYHighY].u >> 16) & 0x3ff) || \ - scry >= (v->reg[clipLowYHighY].u & 0x3ff)) \ + if (scry < ((vd->reg[clipLowYHighY].u >> 16) & 0x3ff) || \ + scry >= (vd->reg[clipLowYHighY].u & 0x3ff)) \ { \ stats->pixels_in += stopx - startx; \ stats->clip_fail += stopx - startx; \ @@ -4414,25 +2700,25 @@ static void raster_##name(void *destbase, INT32 y, const poly_extent *extent, co } \ \ /* X clipping */ \ - tempclip = (v->reg[clipLeftRight].u >> 16) & 0x3ff; \ + tempclip = (vd->reg[clipLeftRight].u >> 16) & 0x3ff; \ if (startx < tempclip) \ { \ stats->pixels_in += tempclip - startx; \ - v->stats.total_clipped += tempclip - startx; \ + vd->stats.total_clipped += tempclip - startx; \ startx = tempclip; \ } \ - tempclip = v->reg[clipLeftRight].u & 0x3ff; \ + tempclip = vd->reg[clipLeftRight].u & 0x3ff; \ if (stopx >= tempclip) \ { \ stats->pixels_in += stopx - tempclip; \ - v->stats.total_clipped += stopx - tempclip; \ + vd->stats.total_clipped += stopx - tempclip; \ stopx = tempclip - 1; \ } \ } \ \ /* get pointers to the target buffer and depth buffer */ \ - dest = (UINT16 *)destbase + scry * v->fbi.rowpixels; \ - depth = (v->fbi.auxoffs != ~0) ? ((UINT16 *)(v->fbi.ram + v->fbi.auxoffs) + scry * v->fbi.rowpixels) : NULL; \ + dest = (UINT16 *)destbase + scry * vd->fbi.rowpixels; \ + depth = (vd->fbi.auxoffs != ~0) ? ((UINT16 *)(vd->fbi.ram + vd->fbi.auxoffs) + scry * vd->fbi.rowpixels) : NULL; \ \ /* compute the starting parameters */ \ dx = startx - (extra->ax >> 4); \ @@ -4465,46 +2751,46 @@ static void raster_##name(void *destbase, INT32 y, const poly_extent *extent, co rgbaint_t color, preFog; \ \ /* pixel pipeline part 1 handles depth setup and stippling */ \ - PIXEL_PIPELINE_BEGIN(v, stats, x, y, FBZCOLORPATH, FBZMODE, iterz, iterw); \ + PIXEL_PIPELINE_BEGIN(vd, stats, x, y, FBZCOLORPATH, FBZMODE, iterz, iterw); \ /* depth testing */ \ - if (!depthTest((UINT16) v->reg[zaColor].u, stats, depth[x], FBZMODE, biasdepth)) \ + if (!depthTest((UINT16) vd->reg[zaColor].u, stats, depth[x], FBZMODE, biasdepth)) \ goto skipdrawdepth; \ \ /* run the texture pipeline on TMU1 to produce a value in texel */ \ /* note that they set LOD min to 8 to "disable" a TMU */ \ - if (TMUS >= 2 && v->tmu[1].lodmin < (8 << 8)) { \ + if (TMUS >= 2 && vd->tmu[1].lodmin < (8 << 8)) { \ INT32 tmp; \ const rgbaint_t texelZero(0); \ - texel = genTexture(&v->tmu[1], x, dither4, TEXMODE1, v->tmu[1].lookup, extra->lodbase1, \ + texel = genTexture(&vd->tmu[1], x, dither4, TEXMODE1, vd->tmu[1].lookup, extra->lodbase1, \ iters1, itert1, iterw1, tmp); \ - texel = combineTexture(&v->tmu[1], TEXMODE1, texel, texelZero, tmp); \ + texel = combineTexture(&vd->tmu[1], TEXMODE1, texel, texelZero, tmp); \ } \ /* run the texture pipeline on TMU0 to produce a final */ \ /* result in texel */ \ /* note that they set LOD min to 8 to "disable" a TMU */ \ - if (TMUS >= 1 && v->tmu[0].lodmin < (8 << 8)) \ + if (TMUS >= 1 && vd->tmu[0].lodmin < (8 << 8)) \ { \ - if (!v->send_config) \ + if (!vd->send_config) \ { \ INT32 lod0; \ rgbaint_t texelT0; \ - texelT0 = genTexture(&v->tmu[0], x, dither4, TEXMODE0, v->tmu[0].lookup, extra->lodbase0, \ + texelT0 = genTexture(&vd->tmu[0], x, dither4, TEXMODE0, vd->tmu[0].lookup, extra->lodbase0, \ iters0, itert0, iterw0, lod0); \ - texel = combineTexture(&v->tmu[0], TEXMODE0, texelT0, texel, lod0); \ + texel = combineTexture(&vd->tmu[0], TEXMODE0, texelT0, texel, lod0); \ } \ else \ { \ - texel.set(v->tmu_config); \ + texel.set(vd->tmu_config); \ } \ } \ \ /* colorpath pipeline selects source colors and does blending */ \ color = clampARGB(iterargb, FBZCOLORPATH); \ - if (!combineColor(v, stats, FBZCOLORPATH, FBZMODE, ALPHAMODE, texel, iterz, iterw, color)) \ + if (!combineColor(vd, stats, FBZCOLORPATH, FBZMODE, ALPHAMODE, texel, iterz, iterw, color)) \ goto skipdrawdepth; \ \ /* pixel pipeline part 2 handles fog, alpha, and final output */ \ - PIXEL_PIPELINE_END(v, stats, dither, dither4, dither_lookup, x, dest, depth, \ + PIXEL_PIPELINE_END(vd, stats, dither, dither4, dither_lookup, x, dest, depth, \ FBZMODE, FBZCOLORPATH, ALPHAMODE, FOGMODE, \ iterz, iterw, iterargb); \ \ diff --git a/src/devices/video/voodoo.cpp b/src/devices/video/voodoo.cpp index 4304b5ebf32..7fe0b94a007 100644 --- a/src/devices/video/voodoo.cpp +++ b/src/devices/video/voodoo.cpp @@ -143,7 +143,7 @@ bits(7:4) and bit(24)), X, and Y: #include "emu.h" -#include "video/polylgcy.h" + #include "video/rgbutil.h" #include "voodoo.h" #include "vooddefs.h" @@ -194,50 +194,6 @@ UINT32 voodoo_reciplog[(2 << RECIPLOG_LOOKUP_BITS) + 2]; -/************************************* - * - * Prototypes - * - *************************************/ - -static void init_fbi(voodoo_state *v, fbi_state *f, void *memory, int fbmem); -static void init_tmu_shared(tmu_shared_state *s); -static void init_tmu(voodoo_state *v, tmu_state *t, voodoo_reg *reg, void *memory, int tmem); -static void soft_reset(voodoo_state *v); -static void recompute_video_memory(voodoo_state *v); -static void check_stalled_cpu(voodoo_state *v, attotime current_time); -static void flush_fifos(voodoo_state *v, attotime current_time); -static TIMER_CALLBACK( stall_cpu_callback ); -static void stall_cpu(voodoo_state *v, int state, attotime current_time); -static TIMER_CALLBACK( vblank_callback ); -static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data); -static INT32 lfb_direct_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask); -static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask); -static INT32 texture_w(voodoo_state *v, offs_t offset, UINT32 data); -static INT32 banshee_2d_w(voodoo_state *v, offs_t offset, UINT32 data); - -/* command handlers */ -static INT32 fastfill(voodoo_state *v); -static INT32 swapbuffer(voodoo_state *v, UINT32 data); -static INT32 triangle(voodoo_state *v); -static INT32 begin_triangle(voodoo_state *v); -static INT32 draw_triangle(voodoo_state *v); - -/* triangle helpers */ -static INT32 setup_and_draw_triangle(voodoo_state *v); -static INT32 triangle_create_work_item(voodoo_state *v, UINT16 *drawbuf, int texcount); - -/* rasterizer management */ -static raster_info *add_rasterizer(voodoo_state *v, const raster_info *cinfo); -static raster_info *find_rasterizer(voodoo_state *v, int texcount); -static void dump_rasterizer_stats(voodoo_state *v); - -/* generic rasterizers */ -static void raster_fastfill(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid); -static void raster_generic_0tmu(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid); -static void raster_generic_1tmu(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid); -static void raster_generic_2tmu(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid); - /************************************* @@ -262,7 +218,7 @@ static void raster_generic_2tmu(void *dest, INT32 scanline, const poly_extent *e *************************************/ #define RASTERIZER_ENTRY(fbzcp, alpha, fog, fbz, tex0, tex1) \ - { NULL, raster_##fbzcp##_##alpha##_##fog##_##fbz##_##tex0##_##tex1, FALSE, 0, 0, 0, fbzcp, alpha, fog, fbz, tex0, tex1 }, + { NULL, voodoo_device::raster_##fbzcp##_##alpha##_##fog##_##fbz##_##tex0##_##tex1, FALSE, 0, 0, 0, fbzcp, alpha, fog, fbz, tex0, tex1 }, static const raster_info predef_raster_table[] = { @@ -278,100 +234,84 @@ static const raster_info predef_raster_table[] = INLINE FUNCTIONS ***************************************************************************/ -/*------------------------------------------------- - get_safe_token - makes sure that the passed - in device is, in fact, a voodoo device --------------------------------------------------*/ - -static inline voodoo_state *get_safe_token(device_t *device) -{ - assert(device != nullptr); - assert((device->type() == VOODOO_1) || (device->type() == VOODOO_2) || (device->type() == VOODOO_BANSHEE) || (device->type() == VOODOO_3)); - - return (voodoo_state *)downcast(device)->token(); -} - - - /************************************* * * Video update * *************************************/ -int voodoo_update(device_t *device, bitmap_rgb32 &bitmap, const rectangle &cliprect) +int voodoo_device::voodoo_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - voodoo_state *v = get_safe_token(device); - int changed = v->fbi.video_changed; - int drawbuf = v->fbi.frontbuf; + int changed = fbi.video_changed; + int drawbuf = fbi.frontbuf; int statskey; int x, y; /* reset the video changed flag */ - v->fbi.video_changed = FALSE; + fbi.video_changed = FALSE; /* if we are blank, just fill with black */ - if (v->type <= TYPE_VOODOO_2 && FBIINIT1_SOFTWARE_BLANK(v->reg[fbiInit1].u)) + if (vd_type <= TYPE_VOODOO_2 && FBIINIT1_SOFTWARE_BLANK(reg[fbiInit1].u)) { bitmap.fill(0, cliprect); return changed; } /* if the CLUT is dirty, recompute the pens array */ - if (v->fbi.clut_dirty) + if (fbi.clut_dirty) { UINT8 rtable[32], gtable[64], btable[32]; /* Voodoo/Voodoo-2 have an internal 33-entry CLUT */ - if (v->type <= TYPE_VOODOO_2) + if (vd_type <= TYPE_VOODOO_2) { /* kludge: some of the Midway games write 0 to the last entry when they obviously mean FF */ - if ((v->fbi.clut[32] & 0xffffff) == 0 && (v->fbi.clut[31] & 0xffffff) != 0) - v->fbi.clut[32] = 0x20ffffff; + if ((fbi.clut[32] & 0xffffff) == 0 && (fbi.clut[31] & 0xffffff) != 0) + fbi.clut[32] = 0x20ffffff; /* compute the R/G/B pens first */ for (x = 0; x < 32; x++) { /* treat X as a 5-bit value, scale up to 8 bits, and linear interpolate for red/blue */ y = (x << 3) | (x >> 2); - rtable[x] = (v->fbi.clut[y >> 3].r() * (8 - (y & 7)) + v->fbi.clut[(y >> 3) + 1].r() * (y & 7)) >> 3; - btable[x] = (v->fbi.clut[y >> 3].b() * (8 - (y & 7)) + v->fbi.clut[(y >> 3) + 1].b() * (y & 7)) >> 3; + rtable[x] = (fbi.clut[y >> 3].r() * (8 - (y & 7)) + fbi.clut[(y >> 3) + 1].r() * (y & 7)) >> 3; + btable[x] = (fbi.clut[y >> 3].b() * (8 - (y & 7)) + fbi.clut[(y >> 3) + 1].b() * (y & 7)) >> 3; /* treat X as a 6-bit value with LSB=0, scale up to 8 bits, and linear interpolate */ y = (x * 2) + 0; y = (y << 2) | (y >> 4); - gtable[x*2+0] = (v->fbi.clut[y >> 3].g() * (8 - (y & 7)) + v->fbi.clut[(y >> 3) + 1].g() * (y & 7)) >> 3; + gtable[x*2+0] = (fbi.clut[y >> 3].g() * (8 - (y & 7)) + fbi.clut[(y >> 3) + 1].g() * (y & 7)) >> 3; /* treat X as a 6-bit value with LSB=1, scale up to 8 bits, and linear interpolate */ y = (x * 2) + 1; y = (y << 2) | (y >> 4); - gtable[x*2+1] = (v->fbi.clut[y >> 3].g() * (8 - (y & 7)) + v->fbi.clut[(y >> 3) + 1].g() * (y & 7)) >> 3; + gtable[x*2+1] = (fbi.clut[y >> 3].g() * (8 - (y & 7)) + fbi.clut[(y >> 3) + 1].g() * (y & 7)) >> 3; } } /* Banshee and later have a 512-entry CLUT that can be bypassed */ else { - int which = (v->banshee.io[io_vidProcCfg] >> 13) & 1; - int bypass = (v->banshee.io[io_vidProcCfg] >> 11) & 1; + int which = (banshee.io[io_vidProcCfg] >> 13) & 1; + int bypass = (banshee.io[io_vidProcCfg] >> 11) & 1; /* compute R/G/B pens first */ for (x = 0; x < 32; x++) { /* treat X as a 5-bit value, scale up to 8 bits */ y = (x << 3) | (x >> 2); - rtable[x] = bypass ? y : v->fbi.clut[which * 256 + y].r(); - btable[x] = bypass ? y : v->fbi.clut[which * 256 + y].b(); + rtable[x] = bypass ? y : fbi.clut[which * 256 + y].r(); + btable[x] = bypass ? y : fbi.clut[which * 256 + y].b(); /* treat X as a 6-bit value with LSB=0, scale up to 8 bits */ y = (x * 2) + 0; y = (y << 2) | (y >> 4); - gtable[x*2+0] = bypass ? y : v->fbi.clut[which * 256 + y].g(); + gtable[x*2+0] = bypass ? y : fbi.clut[which * 256 + y].g(); /* treat X as a 6-bit value with LSB=1, scale up to 8 bits, and linear interpolate */ y = (x * 2) + 1; y = (y << 2) | (y >> 4); - gtable[x*2+1] = bypass ? y : v->fbi.clut[which * 256 + y].g(); + gtable[x*2+1] = bypass ? y : fbi.clut[which * 256 + y].g(); } } @@ -381,45 +321,45 @@ int voodoo_update(device_t *device, bitmap_rgb32 &bitmap, const rectangle &clipr int r = rtable[(x >> 11) & 0x1f]; int g = gtable[(x >> 5) & 0x3f]; int b = btable[x & 0x1f]; - v->fbi.pen[x] = rgb_t(r, g, b); + fbi.pen[x] = rgb_t(r, g, b); } /* no longer dirty */ - v->fbi.clut_dirty = FALSE; + fbi.clut_dirty = FALSE; changed = TRUE; } /* debugging! */ - if (device->machine().input().code_pressed(KEYCODE_L)) - drawbuf = v->fbi.backbuf; + if (machine().input().code_pressed(KEYCODE_L)) + drawbuf = fbi.backbuf; /* copy from the current front buffer */ for (y = cliprect.min_y; y <= cliprect.max_y; y++) - if (y >= v->fbi.yoffs) + if (y >= fbi.yoffs) { - UINT16 *src = (UINT16 *)(v->fbi.ram + v->fbi.rgboffs[drawbuf]) + (y - v->fbi.yoffs) * v->fbi.rowpixels - v->fbi.xoffs; + UINT16 *src = (UINT16 *)(fbi.ram + fbi.rgboffs[drawbuf]) + (y - fbi.yoffs) * fbi.rowpixels - fbi.xoffs; UINT32 *dst = &bitmap.pix32(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) - dst[x] = v->fbi.pen[src[x]]; + dst[x] = fbi.pen[src[x]]; } /* update stats display */ - statskey = (device->machine().input().code_pressed(KEYCODE_BACKSLASH) != 0); - if (statskey && statskey != v->stats.lastkey) - v->stats.display = !v->stats.display; - v->stats.lastkey = statskey; + statskey = (machine().input().code_pressed(KEYCODE_BACKSLASH) != 0); + if (statskey && statskey != stats.lastkey) + stats.display = !stats.display; + stats.lastkey = statskey; /* display stats */ - if (v->stats.display) - device->popmessage(v->stats.buffer, 0, 0); + if (stats.display) + popmessage(stats.buffer, 0, 0); /* update render override */ - v->stats.render_override = device->machine().input().code_pressed(KEYCODE_ENTER); - if (DEBUG_DEPTH && v->stats.render_override) + stats.render_override = machine().input().code_pressed(KEYCODE_ENTER); + if (DEBUG_DEPTH && stats.render_override) { for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - UINT16 *src = (UINT16 *)(v->fbi.ram + v->fbi.auxoffs) + (y - v->fbi.yoffs) * v->fbi.rowpixels - v->fbi.xoffs; + UINT16 *src = (UINT16 *)(fbi.ram + fbi.auxoffs) + (y - fbi.yoffs) * fbi.rowpixels - fbi.xoffs; UINT32 *dst = &bitmap.pix32(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) dst[x] = ((src[x] << 8) & 0xff0000) | ((src[x] >> 0) & 0xff00) | ((src[x] >> 8) & 0xff); @@ -436,26 +376,27 @@ int voodoo_update(device_t *device, bitmap_rgb32 &bitmap, const rectangle &clipr * *************************************/ -int voodoo_get_type(device_t *device) + +int voodoo_device::voodoo_get_type() { - voodoo_state *v = get_safe_token(device); - return v->type; + voodoo_device *vd = this; + return vd->vd_type; } -int voodoo_is_stalled(device_t *device) +int voodoo_device::voodoo_is_stalled() { - voodoo_state *v = get_safe_token(device); - return (v->pci.stall_state != NOT_STALLED); + voodoo_device *vd = this; + return (vd->pci.stall_state != NOT_STALLED); } -void voodoo_set_init_enable(device_t *device, UINT32 newval) +void voodoo_device::voodoo_set_init_enable(UINT32 newval) { - voodoo_state *v = get_safe_token(device); - v->pci.init_enable = newval; + voodoo_device *vd = this; + vd->pci.init_enable = newval; if (LOG_REGISTERS) - device->logerror("VOODOO.%d.REG:initEnable write = %08X\n", v->index, newval); + logerror("VOODOO.%d.REG:initEnable write = %08X\n", vd->index, newval); } @@ -466,7 +407,7 @@ void voodoo_set_init_enable(device_t *device, UINT32 newval) * *************************************/ -static void init_fbi(voodoo_state *v, fbi_state *f, void *memory, int fbmem) +void voodoo_device::init_fbi(voodoo_device* vd,fbi_state *f, void *memory, int fbmem) { int pen; @@ -484,20 +425,20 @@ static void init_fbi(voodoo_state *v, fbi_state *f, void *memory, int fbmem) /* init the pens */ f->clut_dirty = TRUE; - if (v->type <= TYPE_VOODOO_2) + if (vd->vd_type <= TYPE_VOODOO_2) { for (pen = 0; pen < 32; pen++) - v->fbi.clut[pen] = rgb_t(pen, pal5bit(pen), pal5bit(pen), pal5bit(pen)); - v->fbi.clut[32] = rgb_t(32,0xff,0xff,0xff); + vd->fbi.clut[pen] = rgb_t(pen, pal5bit(pen), pal5bit(pen), pal5bit(pen)); + vd->fbi.clut[32] = rgb_t(32,0xff,0xff,0xff); } else { for (pen = 0; pen < 512; pen++) - v->fbi.clut[pen] = rgb_t(pen,pen,pen); + vd->fbi.clut[pen] = rgb_t(pen,pen,pen); } /* allocate a VBLANK timer */ - f->vblank_timer = v->device->machine().scheduler().timer_alloc(FUNC(vblank_callback), v); + f->vblank_timer = vd->device->machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(voodoo_device::vblank_callback),vd), vd); f->vblank = FALSE; /* initialize the memory FIFO */ @@ -505,11 +446,11 @@ static void init_fbi(voodoo_state *v, fbi_state *f, void *memory, int fbmem) f->fifo.size = f->fifo.in = f->fifo.out = 0; /* set the fog delta mask */ - f->fogdelta_mask = (v->type < TYPE_VOODOO_2) ? 0xff : 0xfc; + f->fogdelta_mask = (vd->vd_type < TYPE_VOODOO_2) ? 0xff : 0xfc; } -static void init_tmu_shared(tmu_shared_state *s) +void voodoo_device::init_tmu_shared(tmu_shared_state *s) { int val; @@ -554,14 +495,14 @@ static void init_tmu_shared(tmu_shared_state *s) } -static void init_tmu(voodoo_state *v, tmu_state *t, voodoo_reg *reg, void *memory, int tmem) +void voodoo_device::init_tmu(voodoo_device* vd, tmu_state *t, voodoo_reg *reg, void *memory, int tmem) { /* allocate texture RAM */ t->ram = (UINT8 *)memory; t->mask = tmem - 1; t->reg = reg; t->regdirty = TRUE; - t->bilinear_mask = (v->type >= TYPE_VOODOO_2) ? 0xff : 0xf0; + t->bilinear_mask = (vd->vd_type >= TYPE_VOODOO_2) ? 0xff : 0xf0; /* mark the NCC tables dirty and configure their registers */ t->ncc[0].dirty = t->ncc[1].dirty = TRUE; @@ -569,31 +510,31 @@ static void init_tmu(voodoo_state *v, tmu_state *t, voodoo_reg *reg, void *memor t->ncc[1].reg = &t->reg[nccTable+12]; /* create pointers to all the tables */ - t->texel[0] = v->tmushare.rgb332; + t->texel[0] = vd->tmushare.rgb332; t->texel[1] = t->ncc[0].texel; - t->texel[2] = v->tmushare.alpha8; - t->texel[3] = v->tmushare.int8; - t->texel[4] = v->tmushare.ai44; + t->texel[2] = vd->tmushare.alpha8; + t->texel[3] = vd->tmushare.int8; + t->texel[4] = vd->tmushare.ai44; t->texel[5] = t->palette; - t->texel[6] = (v->type >= TYPE_VOODOO_2) ? t->palettea : nullptr; + t->texel[6] = (vd->vd_type >= TYPE_VOODOO_2) ? t->palettea : nullptr; t->texel[7] = nullptr; - t->texel[8] = v->tmushare.rgb332; + t->texel[8] = vd->tmushare.rgb332; t->texel[9] = t->ncc[0].texel; - t->texel[10] = v->tmushare.rgb565; - t->texel[11] = v->tmushare.argb1555; - t->texel[12] = v->tmushare.argb4444; - t->texel[13] = v->tmushare.int8; + t->texel[10] = vd->tmushare.rgb565; + t->texel[11] = vd->tmushare.argb1555; + t->texel[12] = vd->tmushare.argb4444; + t->texel[13] = vd->tmushare.int8; t->texel[14] = t->palette; t->texel[15] = nullptr; t->lookup = t->texel[0]; /* attach the palette to NCC table 0 */ t->ncc[0].palette = t->palette; - if (v->type >= TYPE_VOODOO_2) + if (vd->vd_type >= TYPE_VOODOO_2) t->ncc[0].palettea = t->palettea; /* set up texture address calculations */ - if (v->type <= TYPE_VOODOO_2) + if (vd->vd_type <= TYPE_VOODOO_2) { t->texaddr_mask = 0x0fffff; t->texaddr_shift = 3; @@ -606,181 +547,180 @@ static void init_tmu(voodoo_state *v, tmu_state *t, voodoo_reg *reg, void *memor } -static void voodoo_postload(voodoo_state *v) +void voodoo_device::voodoo_postload(voodoo_device *vd) { int index, subindex; - v->fbi.clut_dirty = TRUE; - for (index = 0; index < ARRAY_LENGTH(v->tmu); index++) + vd->fbi.clut_dirty = TRUE; + for (index = 0; index < ARRAY_LENGTH(vd->tmu); index++) { - v->tmu[index].regdirty = TRUE; - for (subindex = 0; subindex < ARRAY_LENGTH(v->tmu[index].ncc); subindex++) - v->tmu[index].ncc[subindex].dirty = TRUE; + vd->tmu[index].regdirty = TRUE; + for (subindex = 0; subindex < ARRAY_LENGTH(vd->tmu[index].ncc); subindex++) + vd->tmu[index].ncc[subindex].dirty = TRUE; } /* recompute video memory to get the FBI FIFO base recomputed */ - if (v->type <= TYPE_VOODOO_2) - recompute_video_memory(v); + if (vd->vd_type <= TYPE_VOODOO_2) + recompute_video_memory(vd); } -static void init_save_state(device_t *device) +static void init_save_state(voodoo_device *vd) { - voodoo_state *v = get_safe_token(device); int index, subindex; - device->machine().save().register_postload(save_prepost_delegate(FUNC(voodoo_postload), v)); + vd->machine().save().register_postload(save_prepost_delegate(FUNC(voodoo_device::voodoo_postload), vd)); /* register states: core */ - device->save_item(NAME(v->extra_cycles)); - device->save_pointer(NAME(&v->reg[0].u), ARRAY_LENGTH(v->reg)); - device->save_item(NAME(v->alt_regmap)); + vd->save_item(NAME(vd->extra_cycles)); + vd->save_pointer(NAME(&vd->reg[0].u), ARRAY_LENGTH(vd->reg)); + vd->save_item(NAME(vd->alt_regmap)); /* register states: pci */ - device->save_item(NAME(v->pci.fifo.in)); - device->save_item(NAME(v->pci.fifo.out)); - device->save_item(NAME(v->pci.init_enable)); - device->save_item(NAME(v->pci.stall_state)); - device->save_item(NAME(v->pci.op_pending)); - device->save_item(NAME(v->pci.op_end_time)); - device->save_item(NAME(v->pci.fifo_mem)); + vd->save_item(NAME(vd->pci.fifo.in)); + vd->save_item(NAME(vd->pci.fifo.out)); + vd->save_item(NAME(vd->pci.init_enable)); + vd->save_item(NAME(vd->pci.stall_state)); + vd->save_item(NAME(vd->pci.op_pending)); + vd->save_item(NAME(vd->pci.op_end_time)); + vd->save_item(NAME(vd->pci.fifo_mem)); /* register states: dac */ - device->save_item(NAME(v->dac.reg)); - device->save_item(NAME(v->dac.read_result)); + vd->save_item(NAME(vd->dac.reg)); + vd->save_item(NAME(vd->dac.read_result)); /* register states: fbi */ - device->save_pointer(NAME(v->fbi.ram), v->fbi.mask + 1); - device->save_item(NAME(v->fbi.rgboffs)); - device->save_item(NAME(v->fbi.auxoffs)); - device->save_item(NAME(v->fbi.frontbuf)); - device->save_item(NAME(v->fbi.backbuf)); - device->save_item(NAME(v->fbi.swaps_pending)); - device->save_item(NAME(v->fbi.video_changed)); - device->save_item(NAME(v->fbi.yorigin)); - device->save_item(NAME(v->fbi.lfb_base)); - device->save_item(NAME(v->fbi.lfb_stride)); - device->save_item(NAME(v->fbi.width)); - device->save_item(NAME(v->fbi.height)); - device->save_item(NAME(v->fbi.xoffs)); - device->save_item(NAME(v->fbi.yoffs)); - device->save_item(NAME(v->fbi.vsyncscan)); - device->save_item(NAME(v->fbi.rowpixels)); - device->save_item(NAME(v->fbi.vblank)); - device->save_item(NAME(v->fbi.vblank_count)); - device->save_item(NAME(v->fbi.vblank_swap_pending)); - device->save_item(NAME(v->fbi.vblank_swap)); - device->save_item(NAME(v->fbi.vblank_dont_swap)); - device->save_item(NAME(v->fbi.cheating_allowed)); - device->save_item(NAME(v->fbi.sign)); - device->save_item(NAME(v->fbi.ax)); - device->save_item(NAME(v->fbi.ay)); - device->save_item(NAME(v->fbi.bx)); - device->save_item(NAME(v->fbi.by)); - device->save_item(NAME(v->fbi.cx)); - device->save_item(NAME(v->fbi.cy)); - device->save_item(NAME(v->fbi.startr)); - device->save_item(NAME(v->fbi.startg)); - device->save_item(NAME(v->fbi.startb)); - device->save_item(NAME(v->fbi.starta)); - device->save_item(NAME(v->fbi.startz)); - device->save_item(NAME(v->fbi.startw)); - device->save_item(NAME(v->fbi.drdx)); - device->save_item(NAME(v->fbi.dgdx)); - device->save_item(NAME(v->fbi.dbdx)); - device->save_item(NAME(v->fbi.dadx)); - device->save_item(NAME(v->fbi.dzdx)); - device->save_item(NAME(v->fbi.dwdx)); - device->save_item(NAME(v->fbi.drdy)); - device->save_item(NAME(v->fbi.dgdy)); - device->save_item(NAME(v->fbi.dbdy)); - device->save_item(NAME(v->fbi.dady)); - device->save_item(NAME(v->fbi.dzdy)); - device->save_item(NAME(v->fbi.dwdy)); - device->save_item(NAME(v->fbi.lfb_stats.pixels_in)); - device->save_item(NAME(v->fbi.lfb_stats.pixels_out)); - device->save_item(NAME(v->fbi.lfb_stats.chroma_fail)); - device->save_item(NAME(v->fbi.lfb_stats.zfunc_fail)); - device->save_item(NAME(v->fbi.lfb_stats.afunc_fail)); - device->save_item(NAME(v->fbi.lfb_stats.clip_fail)); - device->save_item(NAME(v->fbi.lfb_stats.stipple_count)); - device->save_item(NAME(v->fbi.sverts)); - for (index = 0; index < ARRAY_LENGTH(v->fbi.svert); index++) + vd->save_pointer(NAME(vd->fbi.ram), vd->fbi.mask + 1); + vd->save_item(NAME(vd->fbi.rgboffs)); + vd->save_item(NAME(vd->fbi.auxoffs)); + vd->save_item(NAME(vd->fbi.frontbuf)); + vd->save_item(NAME(vd->fbi.backbuf)); + vd->save_item(NAME(vd->fbi.swaps_pending)); + vd->save_item(NAME(vd->fbi.video_changed)); + vd->save_item(NAME(vd->fbi.yorigin)); + vd->save_item(NAME(vd->fbi.lfb_base)); + vd->save_item(NAME(vd->fbi.lfb_stride)); + vd->save_item(NAME(vd->fbi.width)); + vd->save_item(NAME(vd->fbi.height)); + vd->save_item(NAME(vd->fbi.xoffs)); + vd->save_item(NAME(vd->fbi.yoffs)); + vd->save_item(NAME(vd->fbi.vsyncscan)); + vd->save_item(NAME(vd->fbi.rowpixels)); + vd->save_item(NAME(vd->fbi.vblank)); + vd->save_item(NAME(vd->fbi.vblank_count)); + vd->save_item(NAME(vd->fbi.vblank_swap_pending)); + vd->save_item(NAME(vd->fbi.vblank_swap)); + vd->save_item(NAME(vd->fbi.vblank_dont_swap)); + vd->save_item(NAME(vd->fbi.cheating_allowed)); + vd->save_item(NAME(vd->fbi.sign)); + vd->save_item(NAME(vd->fbi.ax)); + vd->save_item(NAME(vd->fbi.ay)); + vd->save_item(NAME(vd->fbi.bx)); + vd->save_item(NAME(vd->fbi.by)); + vd->save_item(NAME(vd->fbi.cx)); + vd->save_item(NAME(vd->fbi.cy)); + vd->save_item(NAME(vd->fbi.startr)); + vd->save_item(NAME(vd->fbi.startg)); + vd->save_item(NAME(vd->fbi.startb)); + vd->save_item(NAME(vd->fbi.starta)); + vd->save_item(NAME(vd->fbi.startz)); + vd->save_item(NAME(vd->fbi.startw)); + vd->save_item(NAME(vd->fbi.drdx)); + vd->save_item(NAME(vd->fbi.dgdx)); + vd->save_item(NAME(vd->fbi.dbdx)); + vd->save_item(NAME(vd->fbi.dadx)); + vd->save_item(NAME(vd->fbi.dzdx)); + vd->save_item(NAME(vd->fbi.dwdx)); + vd->save_item(NAME(vd->fbi.drdy)); + vd->save_item(NAME(vd->fbi.dgdy)); + vd->save_item(NAME(vd->fbi.dbdy)); + vd->save_item(NAME(vd->fbi.dady)); + vd->save_item(NAME(vd->fbi.dzdy)); + vd->save_item(NAME(vd->fbi.dwdy)); + vd->save_item(NAME(vd->fbi.lfb_stats.pixels_in)); + vd->save_item(NAME(vd->fbi.lfb_stats.pixels_out)); + vd->save_item(NAME(vd->fbi.lfb_stats.chroma_fail)); + vd->save_item(NAME(vd->fbi.lfb_stats.zfunc_fail)); + vd->save_item(NAME(vd->fbi.lfb_stats.afunc_fail)); + vd->save_item(NAME(vd->fbi.lfb_stats.clip_fail)); + vd->save_item(NAME(vd->fbi.lfb_stats.stipple_count)); + vd->save_item(NAME(vd->fbi.sverts)); + for (index = 0; index < ARRAY_LENGTH(vd->fbi.svert); index++) { - device->save_item(NAME(v->fbi.svert[index].x), index); - device->save_item(NAME(v->fbi.svert[index].y), index); - device->save_item(NAME(v->fbi.svert[index].a), index); - device->save_item(NAME(v->fbi.svert[index].r), index); - device->save_item(NAME(v->fbi.svert[index].g), index); - device->save_item(NAME(v->fbi.svert[index].b), index); - device->save_item(NAME(v->fbi.svert[index].z), index); - device->save_item(NAME(v->fbi.svert[index].wb), index); - device->save_item(NAME(v->fbi.svert[index].w0), index); - device->save_item(NAME(v->fbi.svert[index].s0), index); - device->save_item(NAME(v->fbi.svert[index].t0), index); - device->save_item(NAME(v->fbi.svert[index].w1), index); - device->save_item(NAME(v->fbi.svert[index].s1), index); - device->save_item(NAME(v->fbi.svert[index].t1), index); + vd->save_item(NAME(vd->fbi.svert[index].x), index); + vd->save_item(NAME(vd->fbi.svert[index].y), index); + vd->save_item(NAME(vd->fbi.svert[index].a), index); + vd->save_item(NAME(vd->fbi.svert[index].r), index); + vd->save_item(NAME(vd->fbi.svert[index].g), index); + vd->save_item(NAME(vd->fbi.svert[index].b), index); + vd->save_item(NAME(vd->fbi.svert[index].z), index); + vd->save_item(NAME(vd->fbi.svert[index].wb), index); + vd->save_item(NAME(vd->fbi.svert[index].w0), index); + vd->save_item(NAME(vd->fbi.svert[index].s0), index); + vd->save_item(NAME(vd->fbi.svert[index].t0), index); + vd->save_item(NAME(vd->fbi.svert[index].w1), index); + vd->save_item(NAME(vd->fbi.svert[index].s1), index); + vd->save_item(NAME(vd->fbi.svert[index].t1), index); } - device->save_item(NAME(v->fbi.fifo.size)); - device->save_item(NAME(v->fbi.fifo.in)); - device->save_item(NAME(v->fbi.fifo.out)); - for (index = 0; index < ARRAY_LENGTH(v->fbi.cmdfifo); index++) + vd->save_item(NAME(vd->fbi.fifo.size)); + vd->save_item(NAME(vd->fbi.fifo.in)); + vd->save_item(NAME(vd->fbi.fifo.out)); + for (index = 0; index < ARRAY_LENGTH(vd->fbi.cmdfifo); index++) { - device->save_item(NAME(v->fbi.cmdfifo[index].enable), index); - device->save_item(NAME(v->fbi.cmdfifo[index].count_holes), index); - device->save_item(NAME(v->fbi.cmdfifo[index].base), index); - device->save_item(NAME(v->fbi.cmdfifo[index].end), index); - device->save_item(NAME(v->fbi.cmdfifo[index].rdptr), index); - device->save_item(NAME(v->fbi.cmdfifo[index].amin), index); - device->save_item(NAME(v->fbi.cmdfifo[index].amax), index); - device->save_item(NAME(v->fbi.cmdfifo[index].depth), index); - device->save_item(NAME(v->fbi.cmdfifo[index].holes), index); + vd->save_item(NAME(vd->fbi.cmdfifo[index].enable), index); + vd->save_item(NAME(vd->fbi.cmdfifo[index].count_holes), index); + vd->save_item(NAME(vd->fbi.cmdfifo[index].base), index); + vd->save_item(NAME(vd->fbi.cmdfifo[index].end), index); + vd->save_item(NAME(vd->fbi.cmdfifo[index].rdptr), index); + vd->save_item(NAME(vd->fbi.cmdfifo[index].amin), index); + vd->save_item(NAME(vd->fbi.cmdfifo[index].amax), index); + vd->save_item(NAME(vd->fbi.cmdfifo[index].depth), index); + vd->save_item(NAME(vd->fbi.cmdfifo[index].holes), index); } - device->save_item(NAME(v->fbi.fogblend)); - device->save_item(NAME(v->fbi.fogdelta)); - device->save_item(NAME(v->fbi.clut)); + vd->save_item(NAME(vd->fbi.fogblend)); + vd->save_item(NAME(vd->fbi.fogdelta)); + vd->save_item(NAME(vd->fbi.clut)); /* register states: tmu */ - for (index = 0; index < ARRAY_LENGTH(v->tmu); index++) + for (index = 0; index < ARRAY_LENGTH(vd->tmu); index++) { - tmu_state *tmu = &v->tmu[index]; + tmu_state *tmu = &vd->tmu[index]; if (tmu->ram == nullptr) continue; - if (tmu->ram != v->fbi.ram) - device->save_pointer(NAME(tmu->ram), tmu->mask + 1, index); - device->save_item(NAME(tmu->starts), index); - device->save_item(NAME(tmu->startt), index); - device->save_item(NAME(tmu->startw), index); - device->save_item(NAME(tmu->dsdx), index); - device->save_item(NAME(tmu->dtdx), index); - device->save_item(NAME(tmu->dwdx), index); - device->save_item(NAME(tmu->dsdy), index); - device->save_item(NAME(tmu->dtdy), index); - device->save_item(NAME(tmu->dwdy), index); + if (tmu->ram != vd->fbi.ram) + vd->save_pointer(NAME(tmu->ram), tmu->mask + 1, index); + vd->save_item(NAME(tmu->starts), index); + vd->save_item(NAME(tmu->startt), index); + vd->save_item(NAME(tmu->startw), index); + vd->save_item(NAME(tmu->dsdx), index); + vd->save_item(NAME(tmu->dtdx), index); + vd->save_item(NAME(tmu->dwdx), index); + vd->save_item(NAME(tmu->dsdy), index); + vd->save_item(NAME(tmu->dtdy), index); + vd->save_item(NAME(tmu->dwdy), index); for (subindex = 0; subindex < ARRAY_LENGTH(tmu->ncc); subindex++) { - device->save_item(NAME(tmu->ncc[subindex].ir), index * ARRAY_LENGTH(tmu->ncc) + subindex); - device->save_item(NAME(tmu->ncc[subindex].ig), index * ARRAY_LENGTH(tmu->ncc) + subindex); - device->save_item(NAME(tmu->ncc[subindex].ib), index * ARRAY_LENGTH(tmu->ncc) + subindex); - device->save_item(NAME(tmu->ncc[subindex].qr), index * ARRAY_LENGTH(tmu->ncc) + subindex); - device->save_item(NAME(tmu->ncc[subindex].qg), index * ARRAY_LENGTH(tmu->ncc) + subindex); - device->save_item(NAME(tmu->ncc[subindex].qb), index * ARRAY_LENGTH(tmu->ncc) + subindex); - device->save_item(NAME(tmu->ncc[subindex].y), index * ARRAY_LENGTH(tmu->ncc) + subindex); + vd->save_item(NAME(tmu->ncc[subindex].ir), index * ARRAY_LENGTH(tmu->ncc) + subindex); + vd->save_item(NAME(tmu->ncc[subindex].ig), index * ARRAY_LENGTH(tmu->ncc) + subindex); + vd->save_item(NAME(tmu->ncc[subindex].ib), index * ARRAY_LENGTH(tmu->ncc) + subindex); + vd->save_item(NAME(tmu->ncc[subindex].qr), index * ARRAY_LENGTH(tmu->ncc) + subindex); + vd->save_item(NAME(tmu->ncc[subindex].qg), index * ARRAY_LENGTH(tmu->ncc) + subindex); + vd->save_item(NAME(tmu->ncc[subindex].qb), index * ARRAY_LENGTH(tmu->ncc) + subindex); + vd->save_item(NAME(tmu->ncc[subindex].y), index * ARRAY_LENGTH(tmu->ncc) + subindex); } } /* register states: banshee */ - if (v->type >= TYPE_VOODOO_BANSHEE) + if (vd->vd_type >= TYPE_VOODOO_BANSHEE) { - device->save_item(NAME(v->banshee.io)); - device->save_item(NAME(v->banshee.agp)); - device->save_item(NAME(v->banshee.vga)); - device->save_item(NAME(v->banshee.crtc)); - device->save_item(NAME(v->banshee.seq)); - device->save_item(NAME(v->banshee.gc)); - device->save_item(NAME(v->banshee.att)); - device->save_item(NAME(v->banshee.attff)); + vd->save_item(NAME(vd->banshee.io)); + vd->save_item(NAME(vd->banshee.agp)); + vd->save_item(NAME(vd->banshee.vga)); + vd->save_item(NAME(vd->banshee.crtc)); + vd->save_item(NAME(vd->banshee.seq)); + vd->save_item(NAME(vd->banshee.gc)); + vd->save_item(NAME(vd->banshee.att)); + vd->save_item(NAME(vd->banshee.attff)); } } @@ -792,27 +732,27 @@ static void init_save_state(device_t *device) * *************************************/ -static void accumulate_statistics(voodoo_state *v, const stats_block *stats) +static void accumulate_statistics(voodoo_device *vd, const stats_block *stats) { /* apply internal voodoo statistics */ - v->reg[fbiPixelsIn].u += stats->pixels_in; - v->reg[fbiPixelsOut].u += stats->pixels_out; - v->reg[fbiChromaFail].u += stats->chroma_fail; - v->reg[fbiZfuncFail].u += stats->zfunc_fail; - v->reg[fbiAfuncFail].u += stats->afunc_fail; + vd->reg[fbiPixelsIn].u += stats->pixels_in; + vd->reg[fbiPixelsOut].u += stats->pixels_out; + vd->reg[fbiChromaFail].u += stats->chroma_fail; + vd->reg[fbiZfuncFail].u += stats->zfunc_fail; + vd->reg[fbiAfuncFail].u += stats->afunc_fail; /* apply emulation statistics */ - v->stats.total_pixels_in += stats->pixels_in; - v->stats.total_pixels_out += stats->pixels_out; - v->stats.total_chroma_fail += stats->chroma_fail; - v->stats.total_zfunc_fail += stats->zfunc_fail; - v->stats.total_afunc_fail += stats->afunc_fail; - v->stats.total_clipped += stats->clip_fail; - v->stats.total_stippled += stats->stipple_count; + vd->stats.total_pixels_in += stats->pixels_in; + vd->stats.total_pixels_out += stats->pixels_out; + vd->stats.total_chroma_fail += stats->chroma_fail; + vd->stats.total_zfunc_fail += stats->zfunc_fail; + vd->stats.total_afunc_fail += stats->afunc_fail; + vd->stats.total_clipped += stats->clip_fail; + vd->stats.total_stippled += stats->stipple_count; } -static void update_statistics(voodoo_state *v, int accumulate) +static void update_statistics(voodoo_device *vd, int accumulate) { int threadnum; @@ -820,14 +760,14 @@ static void update_statistics(voodoo_state *v, int accumulate) for (threadnum = 0; threadnum < WORK_MAX_THREADS; threadnum++) { if (accumulate) - accumulate_statistics(v, &v->thread_stats[threadnum]); - memset(&v->thread_stats[threadnum], 0, sizeof(v->thread_stats[threadnum])); + accumulate_statistics(vd, &vd->thread_stats[threadnum]); + memset(&vd->thread_stats[threadnum], 0, sizeof(vd->thread_stats[threadnum])); } /* accumulate/reset statistics from the LFB */ if (accumulate) - accumulate_statistics(v, &v->fbi.lfb_stats); - memset(&v->fbi.lfb_stats, 0, sizeof(v->fbi.lfb_stats)); + accumulate_statistics(vd, &vd->fbi.lfb_stats); + memset(&vd->fbi.lfb_stats, 0, sizeof(vd->fbi.lfb_stats)); } @@ -838,210 +778,208 @@ static void update_statistics(voodoo_state *v, int accumulate) * *************************************/ -static void swap_buffers(voodoo_state *v) +void voodoo_device::swap_buffers(voodoo_device *vd) { int count; - if (LOG_VBLANK_SWAP) v->device->logerror("--- swap_buffers @ %d\n", v->screen->vpos()); + if (LOG_VBLANK_SWAP) vd->device->logerror("--- swap_buffers @ %d\n", vd->screen->vpos()); /* force a partial update */ - v->screen->update_partial(v->screen->vpos()); - v->fbi.video_changed = TRUE; + vd->screen->update_partial(vd->screen->vpos()); + vd->fbi.video_changed = TRUE; /* keep a history of swap intervals */ - count = v->fbi.vblank_count; + count = vd->fbi.vblank_count; if (count > 15) count = 15; - v->reg[fbiSwapHistory].u = (v->reg[fbiSwapHistory].u << 4) | count; + vd->reg[fbiSwapHistory].u = (vd->reg[fbiSwapHistory].u << 4) | count; /* rotate the buffers */ - if (v->type <= TYPE_VOODOO_2) + if (vd->vd_type <= TYPE_VOODOO_2) { - if (v->type < TYPE_VOODOO_2 || !v->fbi.vblank_dont_swap) + if (vd->vd_type < TYPE_VOODOO_2 || !vd->fbi.vblank_dont_swap) { - if (v->fbi.rgboffs[2] == ~0) + if (vd->fbi.rgboffs[2] == ~0) { - v->fbi.frontbuf = 1 - v->fbi.frontbuf; - v->fbi.backbuf = 1 - v->fbi.frontbuf; + vd->fbi.frontbuf = 1 - vd->fbi.frontbuf; + vd->fbi.backbuf = 1 - vd->fbi.frontbuf; } else { - v->fbi.frontbuf = (v->fbi.frontbuf + 1) % 3; - v->fbi.backbuf = (v->fbi.frontbuf + 1) % 3; + vd->fbi.frontbuf = (vd->fbi.frontbuf + 1) % 3; + vd->fbi.backbuf = (vd->fbi.frontbuf + 1) % 3; } } } else - v->fbi.rgboffs[0] = v->reg[leftOverlayBuf].u & v->fbi.mask & ~0x0f; + vd->fbi.rgboffs[0] = vd->reg[leftOverlayBuf].u & vd->fbi.mask & ~0x0f; /* decrement the pending count and reset our state */ - if (v->fbi.swaps_pending) - v->fbi.swaps_pending--; - v->fbi.vblank_count = 0; - v->fbi.vblank_swap_pending = FALSE; + if (vd->fbi.swaps_pending) + vd->fbi.swaps_pending--; + vd->fbi.vblank_count = 0; + vd->fbi.vblank_swap_pending = FALSE; /* reset the last_op_time to now and start processing the next command */ - if (v->pci.op_pending) + if (vd->pci.op_pending) { - v->pci.op_end_time = v->device->machine().time(); - flush_fifos(v, v->pci.op_end_time); + vd->pci.op_end_time = vd->device->machine().time(); + flush_fifos(vd, vd->pci.op_end_time); } /* we may be able to unstall now */ - if (v->pci.stall_state != NOT_STALLED) - check_stalled_cpu(v, v->device->machine().time()); + if (vd->pci.stall_state != NOT_STALLED) + check_stalled_cpu(vd, vd->device->machine().time()); /* periodically log rasterizer info */ - v->stats.swaps++; - if (LOG_RASTERIZERS && v->stats.swaps % 1000 == 0) - dump_rasterizer_stats(v); + vd->stats.swaps++; + if (LOG_RASTERIZERS && vd->stats.swaps % 1000 == 0) + dump_rasterizer_stats(vd); /* update the statistics (debug) */ - if (v->stats.display) + if (vd->stats.display) { - const rectangle &visible_area = v->screen->visible_area(); + const rectangle &visible_area = vd->screen->visible_area(); int screen_area = visible_area.width() * visible_area.height(); - char *statsptr = v->stats.buffer; + char *statsptr = vd->stats.buffer; int pixelcount; int i; - update_statistics(v, TRUE); - pixelcount = v->stats.total_pixels_out; + update_statistics(vd, TRUE); + pixelcount = vd->stats.total_pixels_out; - statsptr += sprintf(statsptr, "Swap:%6d\n", v->stats.swaps); - statsptr += sprintf(statsptr, "Hist:%08X\n", v->reg[fbiSwapHistory].u); - statsptr += sprintf(statsptr, "Stal:%6d\n", v->stats.stalls); + statsptr += sprintf(statsptr, "Swap:%6d\n", vd->stats.swaps); + statsptr += sprintf(statsptr, "Hist:%08X\n", vd->reg[fbiSwapHistory].u); + statsptr += sprintf(statsptr, "Stal:%6d\n", vd->stats.stalls); statsptr += sprintf(statsptr, "Rend:%6d%%\n", pixelcount * 100 / screen_area); - statsptr += sprintf(statsptr, "Poly:%6d\n", v->stats.total_triangles); - statsptr += sprintf(statsptr, "PxIn:%6d\n", v->stats.total_pixels_in); - statsptr += sprintf(statsptr, "POut:%6d\n", v->stats.total_pixels_out); - statsptr += sprintf(statsptr, "Clip:%6d\n", v->stats.total_clipped); - statsptr += sprintf(statsptr, "Stip:%6d\n", v->stats.total_stippled); - statsptr += sprintf(statsptr, "Chro:%6d\n", v->stats.total_chroma_fail); - statsptr += sprintf(statsptr, "ZFun:%6d\n", v->stats.total_zfunc_fail); - statsptr += sprintf(statsptr, "AFun:%6d\n", v->stats.total_afunc_fail); - statsptr += sprintf(statsptr, "RegW:%6d\n", v->stats.reg_writes); - statsptr += sprintf(statsptr, "RegR:%6d\n", v->stats.reg_reads); - statsptr += sprintf(statsptr, "LFBW:%6d\n", v->stats.lfb_writes); - statsptr += sprintf(statsptr, "LFBR:%6d\n", v->stats.lfb_reads); - statsptr += sprintf(statsptr, "TexW:%6d\n", v->stats.tex_writes); + statsptr += sprintf(statsptr, "Poly:%6d\n", vd->stats.total_triangles); + statsptr += sprintf(statsptr, "PxIn:%6d\n", vd->stats.total_pixels_in); + statsptr += sprintf(statsptr, "POut:%6d\n", vd->stats.total_pixels_out); + statsptr += sprintf(statsptr, "Clip:%6d\n", vd->stats.total_clipped); + statsptr += sprintf(statsptr, "Stip:%6d\n", vd->stats.total_stippled); + statsptr += sprintf(statsptr, "Chro:%6d\n", vd->stats.total_chroma_fail); + statsptr += sprintf(statsptr, "ZFun:%6d\n", vd->stats.total_zfunc_fail); + statsptr += sprintf(statsptr, "AFun:%6d\n", vd->stats.total_afunc_fail); + statsptr += sprintf(statsptr, "RegW:%6d\n", vd->stats.reg_writes); + statsptr += sprintf(statsptr, "RegR:%6d\n", vd->stats.reg_reads); + statsptr += sprintf(statsptr, "LFBW:%6d\n", vd->stats.lfb_writes); + statsptr += sprintf(statsptr, "LFBR:%6d\n", vd->stats.lfb_reads); + statsptr += sprintf(statsptr, "TexW:%6d\n", vd->stats.tex_writes); statsptr += sprintf(statsptr, "TexM:"); for (i = 0; i < 16; i++) - if (v->stats.texture_mode[i]) + if (vd->stats.texture_mode[i]) *statsptr++ = "0123456789ABCDEF"[i]; *statsptr = 0; } /* update statistics */ - v->stats.stalls = 0; - v->stats.total_triangles = 0; - v->stats.total_pixels_in = 0; - v->stats.total_pixels_out = 0; - v->stats.total_chroma_fail = 0; - v->stats.total_zfunc_fail = 0; - v->stats.total_afunc_fail = 0; - v->stats.total_clipped = 0; - v->stats.total_stippled = 0; - v->stats.reg_writes = 0; - v->stats.reg_reads = 0; - v->stats.lfb_writes = 0; - v->stats.lfb_reads = 0; - v->stats.tex_writes = 0; - memset(v->stats.texture_mode, 0, sizeof(v->stats.texture_mode)); + vd->stats.stalls = 0; + vd->stats.total_triangles = 0; + vd->stats.total_pixels_in = 0; + vd->stats.total_pixels_out = 0; + vd->stats.total_chroma_fail = 0; + vd->stats.total_zfunc_fail = 0; + vd->stats.total_afunc_fail = 0; + vd->stats.total_clipped = 0; + vd->stats.total_stippled = 0; + vd->stats.reg_writes = 0; + vd->stats.reg_reads = 0; + vd->stats.lfb_writes = 0; + vd->stats.lfb_reads = 0; + vd->stats.tex_writes = 0; + memset(vd->stats.texture_mode, 0, sizeof(vd->stats.texture_mode)); } -static void adjust_vblank_timer(voodoo_state *v) +static void adjust_vblank_timer(voodoo_device *vd) { - attotime vblank_period = v->screen->time_until_pos(v->fbi.vsyncscan); + attotime vblank_period = vd->screen->time_until_pos(vd->fbi.vsyncscan); /* if zero, adjust to next frame, otherwise we may get stuck in an infinite loop */ if (vblank_period == attotime::zero) - vblank_period = v->screen->frame_period(); - v->fbi.vblank_timer->adjust(vblank_period); + vblank_period = vd->screen->frame_period(); + vd->fbi.vblank_timer->adjust(vblank_period); } -static TIMER_CALLBACK( vblank_off_callback ) +TIMER_CALLBACK_MEMBER( voodoo_device::vblank_off_callback ) { - voodoo_state *v = (voodoo_state *)ptr; - - if (LOG_VBLANK_SWAP) v->device->logerror("--- vblank end\n"); + if (LOG_VBLANK_SWAP) device->logerror("--- vblank end\n"); /* set internal state and call the client */ - v->fbi.vblank = FALSE; + fbi.vblank = FALSE; // TODO: Vblank IRQ enable is VOODOO3 only? - if (v->type >= TYPE_VOODOO_3) + if (vd_type >= TYPE_VOODOO_3) { - if (v->reg[intrCtrl].u & 0x8) // call IRQ handler if VSYNC interrupt (falling) is enabled + if (reg[intrCtrl].u & 0x8) // call IRQ handler if VSYNC interrupt (falling) is enabled { - v->reg[intrCtrl].u |= 0x200; // VSYNC int (falling) active + reg[intrCtrl].u |= 0x200; // VSYNC int (falling) active - if (!v->device->m_vblank.isnull()) - v->device->m_vblank(FALSE); + if (!device->m_vblank.isnull()) + device->m_vblank(FALSE); } } else { - if (!v->device->m_vblank.isnull()) - v->device->m_vblank(FALSE); + if (!device->m_vblank.isnull()) + device->m_vblank(FALSE); } /* go to the end of the next frame */ - adjust_vblank_timer(v); + adjust_vblank_timer(this); } -static TIMER_CALLBACK( vblank_callback ) +TIMER_CALLBACK_MEMBER( voodoo_device::vblank_callback ) { - voodoo_state *v = (voodoo_state *)ptr; - - if (LOG_VBLANK_SWAP) v->device->logerror("--- vblank start\n"); + if (LOG_VBLANK_SWAP) device->logerror("--- vblank start\n"); /* flush the pipes */ - if (v->pci.op_pending) + if (pci.op_pending) { - if (LOG_VBLANK_SWAP) v->device->logerror("---- vblank flush begin\n"); - flush_fifos(v, machine.time()); - if (LOG_VBLANK_SWAP) v->device->logerror("---- vblank flush end\n"); + if (LOG_VBLANK_SWAP) device->logerror("---- vblank flush begin\n"); + flush_fifos(this, machine().time()); + if (LOG_VBLANK_SWAP) device->logerror("---- vblank flush end\n"); } /* increment the count */ - v->fbi.vblank_count++; - if (v->fbi.vblank_count > 250) - v->fbi.vblank_count = 250; - if (LOG_VBLANK_SWAP) v->device->logerror("---- vblank count = %d", v->fbi.vblank_count); - if (v->fbi.vblank_swap_pending) - if (LOG_VBLANK_SWAP) v->device->logerror(" (target=%d)", v->fbi.vblank_swap); - if (LOG_VBLANK_SWAP) v->device->logerror("\n"); + fbi.vblank_count++; + if (fbi.vblank_count > 250) + fbi.vblank_count = 250; + if (LOG_VBLANK_SWAP) device->logerror("---- vblank count = %d", fbi.vblank_count); + if (fbi.vblank_swap_pending) + if (LOG_VBLANK_SWAP) device->logerror(" (target=%d)", fbi.vblank_swap); + if (LOG_VBLANK_SWAP) device->logerror("\n"); /* if we're past the swap count, do the swap */ - if (v->fbi.vblank_swap_pending && v->fbi.vblank_count >= v->fbi.vblank_swap) - swap_buffers(v); + if (fbi.vblank_swap_pending && fbi.vblank_count >= fbi.vblank_swap) + swap_buffers(this); /* set a timer for the next off state */ - machine.scheduler().timer_set(v->screen->time_until_pos(0), FUNC(vblank_off_callback), 0, v); + machine().scheduler().timer_set(screen->time_until_pos(0), timer_expired_delegate(FUNC(voodoo_device::vblank_off_callback),this), 0, this); + + /* set internal state and call the client */ - v->fbi.vblank = TRUE; + fbi.vblank = TRUE; // TODO: Vblank IRQ enable is VOODOO3 only? - if (v->type >= TYPE_VOODOO_3) + if (vd_type >= TYPE_VOODOO_3) { - if (v->reg[intrCtrl].u & 0x4) // call IRQ handler if VSYNC interrupt (rising) is enabled + if (reg[intrCtrl].u & 0x4) // call IRQ handler if VSYNC interrupt (rising) is enabled { - v->reg[intrCtrl].u |= 0x100; // VSYNC int (rising) active + reg[intrCtrl].u |= 0x100; // VSYNC int (rising) active - if (!v->device->m_vblank.isnull()) - v->device->m_vblank(TRUE); + if (!device->m_vblank.isnull()) + device->m_vblank(TRUE); } } else { - if (!v->device->m_vblank.isnull()) - v->device->m_vblank(TRUE); + if (!device->m_vblank.isnull()) + device->m_vblank(TRUE); } } @@ -1053,23 +991,23 @@ static TIMER_CALLBACK( vblank_callback ) * *************************************/ -static void reset_counters(voodoo_state *v) +static void reset_counters(voodoo_device *vd) { - update_statistics(v, FALSE); - v->reg[fbiPixelsIn].u = 0; - v->reg[fbiChromaFail].u = 0; - v->reg[fbiZfuncFail].u = 0; - v->reg[fbiAfuncFail].u = 0; - v->reg[fbiPixelsOut].u = 0; + update_statistics(vd, FALSE); + vd->reg[fbiPixelsIn].u = 0; + vd->reg[fbiChromaFail].u = 0; + vd->reg[fbiZfuncFail].u = 0; + vd->reg[fbiAfuncFail].u = 0; + vd->reg[fbiPixelsOut].u = 0; } -static void soft_reset(voodoo_state *v) +void voodoo_device::soft_reset(voodoo_device *vd) { - reset_counters(v); - v->reg[fbiTrianglesOut].u = 0; - fifo_reset(&v->fbi.fifo); - fifo_reset(&v->pci.fifo); + reset_counters(vd); + vd->reg[fbiTrianglesOut].u = 0; + fifo_reset(&vd->fbi.fifo); + fifo_reset(&vd->pci.fifo); } @@ -1080,103 +1018,103 @@ static void soft_reset(voodoo_state *v) * *************************************/ -static void recompute_video_memory(voodoo_state *v) +void voodoo_device::recompute_video_memory(voodoo_device *vd) { - UINT32 buffer_pages = FBIINIT2_VIDEO_BUFFER_OFFSET(v->reg[fbiInit2].u); - UINT32 fifo_start_page = FBIINIT4_MEMORY_FIFO_START_ROW(v->reg[fbiInit4].u); - UINT32 fifo_last_page = FBIINIT4_MEMORY_FIFO_STOP_ROW(v->reg[fbiInit4].u); + UINT32 buffer_pages = FBIINIT2_VIDEO_BUFFER_OFFSET(vd->reg[fbiInit2].u); + UINT32 fifo_start_page = FBIINIT4_MEMORY_FIFO_START_ROW(vd->reg[fbiInit4].u); + UINT32 fifo_last_page = FBIINIT4_MEMORY_FIFO_STOP_ROW(vd->reg[fbiInit4].u); UINT32 memory_config; int buf; /* memory config is determined differently between V1 and V2 */ - memory_config = FBIINIT2_ENABLE_TRIPLE_BUF(v->reg[fbiInit2].u); - if (v->type == TYPE_VOODOO_2 && memory_config == 0) - memory_config = FBIINIT5_BUFFER_ALLOCATION(v->reg[fbiInit5].u); + memory_config = FBIINIT2_ENABLE_TRIPLE_BUF(vd->reg[fbiInit2].u); + if (vd->vd_type == TYPE_VOODOO_2 && memory_config == 0) + memory_config = FBIINIT5_BUFFER_ALLOCATION(vd->reg[fbiInit5].u); /* tiles are 64x16/32; x_tiles specifies how many half-tiles */ - v->fbi.tile_width = (v->type == TYPE_VOODOO_1) ? 64 : 32; - v->fbi.tile_height = (v->type == TYPE_VOODOO_1) ? 16 : 32; - v->fbi.x_tiles = FBIINIT1_X_VIDEO_TILES(v->reg[fbiInit1].u); - if (v->type == TYPE_VOODOO_2) + vd->fbi.tile_width = (vd->vd_type == TYPE_VOODOO_1) ? 64 : 32; + vd->fbi.tile_height = (vd->vd_type == TYPE_VOODOO_1) ? 16 : 32; + vd->fbi.x_tiles = FBIINIT1_X_VIDEO_TILES(vd->reg[fbiInit1].u); + if (vd->vd_type == TYPE_VOODOO_2) { - v->fbi.x_tiles = (v->fbi.x_tiles << 1) | - (FBIINIT1_X_VIDEO_TILES_BIT5(v->reg[fbiInit1].u) << 5) | - (FBIINIT6_X_VIDEO_TILES_BIT0(v->reg[fbiInit6].u)); + vd->fbi.x_tiles = (vd->fbi.x_tiles << 1) | + (FBIINIT1_X_VIDEO_TILES_BIT5(vd->reg[fbiInit1].u) << 5) | + (FBIINIT6_X_VIDEO_TILES_BIT0(vd->reg[fbiInit6].u)); } - v->fbi.rowpixels = v->fbi.tile_width * v->fbi.x_tiles; + vd->fbi.rowpixels = vd->fbi.tile_width * vd->fbi.x_tiles; -// logerror("VOODOO.%d.VIDMEM: buffer_pages=%X fifo=%X-%X tiles=%X rowpix=%d\n", v->index, buffer_pages, fifo_start_page, fifo_last_page, v->fbi.x_tiles, v->fbi.rowpixels); +// logerror("VOODOO.%d.VIDMEM: buffer_pages=%X fifo=%X-%X tiles=%X rowpix=%d\n", vd->index, buffer_pages, fifo_start_page, fifo_last_page, vd->fbi.x_tiles, vd->fbi.rowpixels); /* first RGB buffer always starts at 0 */ - v->fbi.rgboffs[0] = 0; + vd->fbi.rgboffs[0] = 0; /* second RGB buffer starts immediately afterwards */ - v->fbi.rgboffs[1] = buffer_pages * 0x1000; + vd->fbi.rgboffs[1] = buffer_pages * 0x1000; /* remaining buffers are based on the config */ switch (memory_config) { case 3: /* reserved */ - v->device->logerror("VOODOO.%d.ERROR:Unexpected memory configuration in recompute_video_memory!\n", v->index); + vd->device->logerror("VOODOO.%d.ERROR:Unexpected memory configuration in recompute_video_memory!\n", vd->index); case 0: /* 2 color buffers, 1 aux buffer */ - v->fbi.rgboffs[2] = ~0; - v->fbi.auxoffs = 2 * buffer_pages * 0x1000; + vd->fbi.rgboffs[2] = ~0; + vd->fbi.auxoffs = 2 * buffer_pages * 0x1000; break; case 1: /* 3 color buffers, 0 aux buffers */ - v->fbi.rgboffs[2] = 2 * buffer_pages * 0x1000; - v->fbi.auxoffs = ~0; + vd->fbi.rgboffs[2] = 2 * buffer_pages * 0x1000; + vd->fbi.auxoffs = ~0; break; case 2: /* 3 color buffers, 1 aux buffers */ - v->fbi.rgboffs[2] = 2 * buffer_pages * 0x1000; - v->fbi.auxoffs = 3 * buffer_pages * 0x1000; + vd->fbi.rgboffs[2] = 2 * buffer_pages * 0x1000; + vd->fbi.auxoffs = 3 * buffer_pages * 0x1000; break; } /* clamp the RGB buffers to video memory */ for (buf = 0; buf < 3; buf++) - if (v->fbi.rgboffs[buf] != ~0 && v->fbi.rgboffs[buf] > v->fbi.mask) - v->fbi.rgboffs[buf] = v->fbi.mask; + if (vd->fbi.rgboffs[buf] != ~0 && vd->fbi.rgboffs[buf] > vd->fbi.mask) + vd->fbi.rgboffs[buf] = vd->fbi.mask; /* clamp the aux buffer to video memory */ - if (v->fbi.auxoffs != ~0 && v->fbi.auxoffs > v->fbi.mask) - v->fbi.auxoffs = v->fbi.mask; + if (vd->fbi.auxoffs != ~0 && vd->fbi.auxoffs > vd->fbi.mask) + vd->fbi.auxoffs = vd->fbi.mask; /* osd_printf_debug("rgb[0] = %08X rgb[1] = %08X rgb[2] = %08X aux = %08X\n", - v->fbi.rgboffs[0], v->fbi.rgboffs[1], v->fbi.rgboffs[2], v->fbi.auxoffs);*/ + vd->fbi.rgboffs[0], vd->fbi.rgboffs[1], vd->fbi.rgboffs[2], vd->fbi.auxoffs);*/ /* compute the memory FIFO location and size */ - if (fifo_last_page > v->fbi.mask / 0x1000) - fifo_last_page = v->fbi.mask / 0x1000; + if (fifo_last_page > vd->fbi.mask / 0x1000) + fifo_last_page = vd->fbi.mask / 0x1000; /* is it valid and enabled? */ - if (fifo_start_page <= fifo_last_page && FBIINIT0_ENABLE_MEMORY_FIFO(v->reg[fbiInit0].u)) + if (fifo_start_page <= fifo_last_page && FBIINIT0_ENABLE_MEMORY_FIFO(vd->reg[fbiInit0].u)) { - v->fbi.fifo.base = (UINT32 *)(v->fbi.ram + fifo_start_page * 0x1000); - v->fbi.fifo.size = (fifo_last_page + 1 - fifo_start_page) * 0x1000 / 4; - if (v->fbi.fifo.size > 65536*2) - v->fbi.fifo.size = 65536*2; + vd->fbi.fifo.base = (UINT32 *)(vd->fbi.ram + fifo_start_page * 0x1000); + vd->fbi.fifo.size = (fifo_last_page + 1 - fifo_start_page) * 0x1000 / 4; + if (vd->fbi.fifo.size > 65536*2) + vd->fbi.fifo.size = 65536*2; } /* if not, disable the FIFO */ else { - v->fbi.fifo.base = nullptr; - v->fbi.fifo.size = 0; + vd->fbi.fifo.base = nullptr; + vd->fbi.fifo.size = 0; } /* reset the FIFO */ - fifo_reset(&v->fbi.fifo); + fifo_reset(&vd->fbi.fifo); /* reset our front/back buffers if they are out of range */ - if (v->fbi.rgboffs[2] == ~0) + if (vd->fbi.rgboffs[2] == ~0) { - if (v->fbi.frontbuf == 2) - v->fbi.frontbuf = 0; - if (v->fbi.backbuf == 2) - v->fbi.backbuf = 0; + if (vd->fbi.frontbuf == 2) + vd->fbi.frontbuf = 0; + if (vd->fbi.backbuf == 2) + vd->fbi.backbuf = 0; } } @@ -1476,9 +1414,9 @@ static inline INT32 prepare_tmu(tmu_state *t) * *************************************/ -static int cmdfifo_compute_expected_depth(voodoo_state *v, cmdfifo_info *f) +static int cmdfifo_compute_expected_depth(voodoo_device *vd, cmdfifo_info *f) { - UINT32 *fifobase = (UINT32 *)v->fbi.ram; + UINT32 *fifobase = (UINT32 *)vd->fbi.ram; UINT32 readptr = f->rdptr; UINT32 command = fifobase[readptr / 4]; int i, count = 0; @@ -1616,9 +1554,9 @@ static int cmdfifo_compute_expected_depth(voodoo_state *v, cmdfifo_info *f) * *************************************/ -static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) +UINT32 voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f) { - UINT32 *fifobase = (UINT32 *)v->fbi.ram; + UINT32 *fifobase = (UINT32 *)vd->fbi.ram; UINT32 readptr = f->rdptr; UINT32 *src = &fifobase[readptr / 4]; UINT32 command = *src++; @@ -1649,26 +1587,26 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) switch ((command >> 3) & 7) { case 0: /* NOP */ - if (LOG_CMDFIFO) v->device->logerror(" NOP\n"); + if (LOG_CMDFIFO) vd->device->logerror(" NOP\n"); break; case 1: /* JSR */ - if (LOG_CMDFIFO) v->device->logerror(" JSR $%06X\n", target); + if (LOG_CMDFIFO) vd->device->logerror(" JSR $%06X\n", target); osd_printf_debug("JSR in CMDFIFO!\n"); src = &fifobase[target / 4]; break; case 2: /* RET */ - if (LOG_CMDFIFO) v->device->logerror(" RET $%06X\n", target); + if (LOG_CMDFIFO) vd->device->logerror(" RET $%06X\n", target); fatalerror("RET in CMDFIFO!\n"); case 3: /* JMP LOCAL FRAME BUFFER */ - if (LOG_CMDFIFO) v->device->logerror(" JMP LOCAL FRAMEBUF $%06X\n", target); + if (LOG_CMDFIFO) vd->device->logerror(" JMP LOCAL FRAMEBUF $%06X\n", target); src = &fifobase[target / 4]; break; case 4: /* JMP AGP */ - if (LOG_CMDFIFO) v->device->logerror(" JMP AGP $%06X\n", target); + if (LOG_CMDFIFO) vd->device->logerror(" JMP AGP $%06X\n", target); fatalerror("JMP AGP in CMDFIFO!\n"); src = &fifobase[target / 4]; break; @@ -1696,16 +1634,16 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) inc = (command >> 15) & 1; target = (command >> 3) & 0xfff; - if (LOG_CMDFIFO) v->device->logerror(" PACKET TYPE 1: count=%d inc=%d reg=%04X\n", count, inc, target); + if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 1: count=%d inc=%d reg=%04X\n", count, inc, target); - if (v->type >= TYPE_VOODOO_BANSHEE && (target & 0x800)) + if (vd->vd_type >= TYPE_VOODOO_BANSHEE && (target & 0x800)) { // Banshee/Voodoo3 2D register writes /* loop over all registers and write them one at a time */ for (i = 0; i < count; i++, target += inc) { - cycles += banshee_2d_w(v, target & 0xff, *src); + cycles += banshee_2d_w(vd, target & 0xff, *src); //logerror(" 2d reg: %03x = %08X\n", target & 0x7ff, *src); src++; } @@ -1714,7 +1652,7 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) { /* loop over all registers and write them one at a time */ for (i = 0; i < count; i++, target += inc) - cycles += register_w(v, target, *src++); + cycles += register_w(vd, target, *src++); } break; @@ -1727,12 +1665,12 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) 1 31:0 = Data word */ case 2: - if (LOG_CMDFIFO) v->device->logerror(" PACKET TYPE 2: mask=%X\n", (command >> 3) & 0x1ffffff); + if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 2: mask=%X\n", (command >> 3) & 0x1ffffff); /* loop over all registers and write them one at a time */ for (i = 3; i <= 31; i++) if (command & (1 << i)) - cycles += register_w(v, banshee2D_clip0Min + (i - 3), *src++); + cycles += register_w(vd, banshee2D_clip0Min + (i - 3), *src++); break; /* @@ -1764,10 +1702,10 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) count = (command >> 6) & 15; code = (command >> 3) & 7; - if (LOG_CMDFIFO) v->device->logerror(" PACKET TYPE 3: count=%d code=%d mask=%03X smode=%02X pc=%d\n", count, code, (command >> 10) & 0xfff, (command >> 22) & 0x3f, (command >> 28) & 1); + if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 3: count=%d code=%d mask=%03X smode=%02X pc=%d\n", count, code, (command >> 10) & 0xfff, (command >> 22) & 0x3f, (command >> 28) & 1); /* copy relevant bits into the setup mode register */ - v->reg[sSetupMode].u = ((command >> 10) & 0xff) | ((command >> 6) & 0xf0000); + vd->reg[sSetupMode].u = ((command >> 10) & 0xff) | ((command >> 6) & 0xf0000); /* loop over triangles */ for (i = 0; i < count; i++) @@ -1834,8 +1772,8 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) /* for a series of individual triangles, initialize all the verts */ if ((code == 1 && i == 0) || (code == 0 && i % 3 == 0)) { - v->fbi.sverts = 1; - v->fbi.svert[0] = v->fbi.svert[1] = v->fbi.svert[2] = svert; + vd->fbi.sverts = 1; + vd->fbi.svert[0] = vd->fbi.svert[1] = vd->fbi.svert[2] = svert; } /* otherwise, add this to the list */ @@ -1843,15 +1781,15 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) { /* for strip mode, shuffle vertex 1 down to 0 */ if (!(command & (1 << 22))) - v->fbi.svert[0] = v->fbi.svert[1]; + vd->fbi.svert[0] = vd->fbi.svert[1]; /* copy 2 down to 1 and add our new one regardless */ - v->fbi.svert[1] = v->fbi.svert[2]; - v->fbi.svert[2] = svert; + vd->fbi.svert[1] = vd->fbi.svert[2]; + vd->fbi.svert[2] = svert; /* if we have enough, draw */ - if (++v->fbi.sverts >= 3) - cycles += setup_and_draw_triangle(v); + if (++vd->fbi.sverts >= 3) + cycles += setup_and_draw_triangle(vd); } } @@ -1874,9 +1812,9 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) /* extract parameters */ target = (command >> 3) & 0xfff; - if (LOG_CMDFIFO) v->device->logerror(" PACKET TYPE 4: mask=%X reg=%04X pad=%d\n", (command >> 15) & 0x3fff, target, command >> 29); + if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 4: mask=%X reg=%04X pad=%d\n", (command >> 15) & 0x3fff, target, command >> 29); - if (v->type >= TYPE_VOODOO_BANSHEE && (target & 0x800)) + if (vd->vd_type >= TYPE_VOODOO_BANSHEE && (target & 0x800)) { // Banshee/Voodoo3 2D register writes @@ -1886,7 +1824,7 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) { if (command & (1 << i)) { - cycles += banshee_2d_w(v, target + (i - 15), *src); + cycles += banshee_2d_w(vd, target + (i - 15), *src); //logerror(" 2d reg: %03x = %08X\n", target & 0x7ff, *src); src++; } @@ -1897,7 +1835,7 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) /* loop over all registers and write them one at a time */ for (i = 15; i <= 28; i++) if (command & (1 << i)) - cycles += register_w(v, target + (i - 15), *src++); + cycles += register_w(vd, target + (i - 15), *src++); } /* account for the extra dummy words */ @@ -1928,17 +1866,17 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) { case 0: // Linear FB { - if (LOG_CMDFIFO) v->device->logerror(" PACKET TYPE 5: FB count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15); + if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 5: FB count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15); UINT32 addr = target * 4; for (i=0; i < count; i++) { UINT32 data = *src++; - v->fbi.ram[BYTE_XOR_LE(addr + 0)] = (UINT8)(data); - v->fbi.ram[BYTE_XOR_LE(addr + 1)] = (UINT8)(data >> 8); - v->fbi.ram[BYTE_XOR_LE(addr + 2)] = (UINT8)(data >> 16); - v->fbi.ram[BYTE_XOR_LE(addr + 3)] = (UINT8)(data >> 24); + vd->fbi.ram[BYTE_XOR_LE(addr + 0)] = (UINT8)(data); + vd->fbi.ram[BYTE_XOR_LE(addr + 1)] = (UINT8)(data >> 8); + vd->fbi.ram[BYTE_XOR_LE(addr + 2)] = (UINT8)(data >> 16); + vd->fbi.ram[BYTE_XOR_LE(addr + 3)] = (UINT8)(data >> 24); addr += 4; } @@ -1946,11 +1884,11 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) } case 2: // 3D LFB { - if (LOG_CMDFIFO) v->device->logerror(" PACKET TYPE 5: 3D LFB count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15); + if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 5: 3D LFB count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15); /* loop over words */ for (i = 0; i < count; i++) - cycles += lfb_w(v, target++, *src++, 0xffffffff); + cycles += lfb_w(vd, target++, *src++, 0xffffffff); break; } @@ -1971,11 +1909,11 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) case 3: // Texture Port { - if (LOG_CMDFIFO) v->device->logerror(" PACKET TYPE 5: textureRAM count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15); + if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 5: textureRAM count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15); /* loop over words */ for (i = 0; i < count; i++) - cycles += texture_w(v, target++, *src++); + cycles += texture_w(vd, target++, *src++); break; } @@ -2001,7 +1939,7 @@ static UINT32 cmdfifo_execute(voodoo_state *v, cmdfifo_info *f) * *************************************/ -static INT32 cmdfifo_execute_if_ready(voodoo_state *v, cmdfifo_info *f) +INT32 voodoo_device::cmdfifo_execute_if_ready(voodoo_device* vd, cmdfifo_info *f) { int needed_depth; int cycles; @@ -2011,12 +1949,12 @@ static INT32 cmdfifo_execute_if_ready(voodoo_state *v, cmdfifo_info *f) return -1; /* see if we have enough for the current command */ - needed_depth = cmdfifo_compute_expected_depth(v, f); + needed_depth = cmdfifo_compute_expected_depth(vd, f); if (f->depth < needed_depth) return -1; /* execute */ - cycles = cmdfifo_execute(v, f); + cycles = cmdfifo_execute(vd, f); f->depth -= needed_depth; return cycles; } @@ -2029,12 +1967,12 @@ static INT32 cmdfifo_execute_if_ready(voodoo_state *v, cmdfifo_info *f) * *************************************/ -static void cmdfifo_w(voodoo_state *v, cmdfifo_info *f, offs_t offset, UINT32 data) +void voodoo_device::cmdfifo_w(voodoo_device *vd, cmdfifo_info *f, offs_t offset, UINT32 data) { UINT32 addr = f->base + offset * 4; - UINT32 *fifobase = (UINT32 *)v->fbi.ram; + UINT32 *fifobase = (UINT32 *)vd->fbi.ram; - if (LOG_CMDFIFO_VERBOSE) v->device->logerror("CMDFIFO_w(%04X) = %08X\n", offset, data); + if (LOG_CMDFIFO_VERBOSE) vd->device->logerror("CMDFIFO_w(%04X) = %08X\n", offset, data); /* write the data */ if (addr < f->end) @@ -2054,7 +1992,7 @@ static void cmdfifo_w(voodoo_state *v, cmdfifo_info *f, offs_t offset, UINT32 da else if (addr < f->amin) { if (f->holes != 0) - v->device->logerror("Unexpected CMDFIFO: AMin=%08X AMax=%08X Holes=%d WroteTo:%08X\n", + vd->device->logerror("Unexpected CMDFIFO: AMin=%08X AMax=%08X Holes=%d WroteTo:%08X\n", f->amin, f->amax, f->holes, addr); //f->amin = f->amax = addr; f->holes += (addr - f->base) / 4; @@ -2084,17 +2022,17 @@ static void cmdfifo_w(voodoo_state *v, cmdfifo_info *f, offs_t offset, UINT32 da } /* execute if we can */ - if (!v->pci.op_pending) + if (!vd->pci.op_pending) { - INT32 cycles = cmdfifo_execute_if_ready(v, f); + INT32 cycles = cmdfifo_execute_if_ready(vd, f); if (cycles > 0) { - v->pci.op_pending = TRUE; - v->pci.op_end_time = v->device->machine().time() + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle); + vd->pci.op_pending = TRUE; + vd->pci.op_end_time = vd->device->machine().time() + attotime(0, (attoseconds_t)cycles * vd->attoseconds_per_cycle); - if (LOG_FIFO_VERBOSE) v->device->logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", v->index, - v->device->machine().time().seconds(), (UINT32)(v->device->machine().time().attoseconds() >> 32), (UINT32)v->device->machine().time().attoseconds(), - v->pci.op_end_time.seconds(), (UINT32)(v->pci.op_end_time.attoseconds() >> 32), (UINT32)v->pci.op_end_time.attoseconds()); + if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", vd->index, + vd->device->machine().time().seconds(), (UINT32)(vd->device->machine().time().attoseconds() >> 32), (UINT32)vd->device->machine().time().attoseconds(), + vd->pci.op_end_time.seconds(), (UINT32)(vd->pci.op_end_time.attoseconds() >> 32), (UINT32)vd->pci.op_end_time.attoseconds()); } } } @@ -2108,83 +2046,83 @@ static void cmdfifo_w(voodoo_state *v, cmdfifo_info *f, offs_t offset, UINT32 da * *************************************/ -static TIMER_CALLBACK( stall_cpu_callback ) +TIMER_CALLBACK_MEMBER( voodoo_device::stall_cpu_callback ) { - check_stalled_cpu((voodoo_state *)ptr, machine.time()); + check_stalled_cpu(this, machine().time()); } -static void check_stalled_cpu(voodoo_state *v, attotime current_time) +void voodoo_device::check_stalled_cpu(voodoo_device* vd, attotime current_time) { int resume = FALSE; /* flush anything we can */ - if (v->pci.op_pending) - flush_fifos(v, current_time); + if (vd->pci.op_pending) + flush_fifos(vd, current_time); /* if we're just stalled until the LWM is passed, see if we're ok now */ - if (v->pci.stall_state == STALLED_UNTIL_FIFO_LWM) + if (vd->pci.stall_state == STALLED_UNTIL_FIFO_LWM) { /* if there's room in the memory FIFO now, we can proceed */ - if (FBIINIT0_ENABLE_MEMORY_FIFO(v->reg[fbiInit0].u)) + if (FBIINIT0_ENABLE_MEMORY_FIFO(vd->reg[fbiInit0].u)) { - if (fifo_items(&v->fbi.fifo) < 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(v->reg[fbiInit0].u)) + if (fifo_items(&vd->fbi.fifo) < 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(vd->reg[fbiInit0].u)) resume = TRUE; } - else if (fifo_space(&v->pci.fifo) > 2 * FBIINIT0_PCI_FIFO_LWM(v->reg[fbiInit0].u)) + else if (fifo_space(&vd->pci.fifo) > 2 * FBIINIT0_PCI_FIFO_LWM(vd->reg[fbiInit0].u)) resume = TRUE; } /* if we're stalled until the FIFOs are empty, check now */ - else if (v->pci.stall_state == STALLED_UNTIL_FIFO_EMPTY) + else if (vd->pci.stall_state == STALLED_UNTIL_FIFO_EMPTY) { - if (FBIINIT0_ENABLE_MEMORY_FIFO(v->reg[fbiInit0].u)) + if (FBIINIT0_ENABLE_MEMORY_FIFO(vd->reg[fbiInit0].u)) { - if (fifo_empty(&v->fbi.fifo) && fifo_empty(&v->pci.fifo)) + if (fifo_empty(&vd->fbi.fifo) && fifo_empty(&vd->pci.fifo)) resume = TRUE; } - else if (fifo_empty(&v->pci.fifo)) + else if (fifo_empty(&vd->pci.fifo)) resume = TRUE; } /* resume if necessary */ - if (resume || !v->pci.op_pending) + if (resume || !vd->pci.op_pending) { - if (LOG_FIFO) v->device->logerror("VOODOO.%d.FIFO:Stall condition cleared; resuming\n", v->index); - v->pci.stall_state = NOT_STALLED; + if (LOG_FIFO) vd->device->logerror("VOODOO.%d.FIFO:Stall condition cleared; resuming\n", vd->index); + vd->pci.stall_state = NOT_STALLED; /* either call the callback, or trigger the trigger */ - if (!v->device->m_stall.isnull()) - v->device->m_stall(FALSE); + if (!vd->device->m_stall.isnull()) + vd->device->m_stall(FALSE); else - v->device->machine().scheduler().trigger(v->trigger); + vd->device->machine().scheduler().trigger(vd->trigger); } /* if not, set a timer for the next one */ else { - v->pci.continue_timer->adjust(v->pci.op_end_time - current_time); + vd->pci.continue_timer->adjust(vd->pci.op_end_time - current_time); } } -static void stall_cpu(voodoo_state *v, int state, attotime current_time) +void voodoo_device::stall_cpu(voodoo_device *vd, int state, attotime current_time) { /* sanity check */ - if (!v->pci.op_pending) fatalerror("FIFOs not empty, no op pending!\n"); + if (!vd->pci.op_pending) fatalerror("FIFOs not empty, no op pending!\n"); /* set the state and update statistics */ - v->pci.stall_state = state; - v->stats.stalls++; + vd->pci.stall_state = state; + vd->stats.stalls++; /* either call the callback, or spin the CPU */ - if (!v->device->m_stall.isnull()) - v->device->m_stall(TRUE); + if (!vd->device->m_stall.isnull()) + vd->device->m_stall(TRUE); else - v->cpu->execute().spin_until_trigger(v->trigger); + vd->cpu->execute().spin_until_trigger(vd->trigger); /* set a timer to clear the stall */ - v->pci.continue_timer->adjust(v->pci.op_end_time - current_time); + vd->pci.continue_timer->adjust(vd->pci.op_end_time - current_time); } @@ -2195,7 +2133,7 @@ static void stall_cpu(voodoo_state *v, int state, attotime current_time) * *************************************/ -static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) +INT32 voodoo_device::register_w(voodoo_device *vd, offs_t offset, UINT32 data) { UINT32 origdata = data; INT32 cycles = 0; @@ -2204,24 +2142,24 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) UINT8 chips; /* statistics */ - v->stats.reg_writes++; + vd->stats.reg_writes++; /* determine which chips we are addressing */ chips = (offset >> 8) & 0xf; if (chips == 0) chips = 0xf; - chips &= v->chipmask; + chips &= vd->chipmask; /* the first 64 registers can be aliased differently */ - if ((offset & 0x800c0) == 0x80000 && v->alt_regmap) + if ((offset & 0x800c0) == 0x80000 && vd->alt_regmap) regnum = register_alias_map[offset & 0x3f]; else regnum = offset & 0xff; /* first make sure this register is readable */ - if (!(v->regaccess[regnum] & REGISTER_WRITE)) + if (!(vd->regaccess[regnum] & REGISTER_WRITE)) { - v->device->logerror("VOODOO.%d.ERROR:Invalid attempt to write %s\n", v->index, v->regnames[regnum]); + vd->device->logerror("VOODOO.%d.ERROR:Invalid attempt to write %s\n", vd->index, vd->regnames[regnum]); return 0; } @@ -2232,227 +2170,227 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) case fvertexAx: data = float_to_int32(data, 4); case vertexAx: - if (chips & 1) v->fbi.ax = (INT16)data; + if (chips & 1) vd->fbi.ax = (INT16)data; break; case fvertexAy: data = float_to_int32(data, 4); case vertexAy: - if (chips & 1) v->fbi.ay = (INT16)data; + if (chips & 1) vd->fbi.ay = (INT16)data; break; case fvertexBx: data = float_to_int32(data, 4); case vertexBx: - if (chips & 1) v->fbi.bx = (INT16)data; + if (chips & 1) vd->fbi.bx = (INT16)data; break; case fvertexBy: data = float_to_int32(data, 4); case vertexBy: - if (chips & 1) v->fbi.by = (INT16)data; + if (chips & 1) vd->fbi.by = (INT16)data; break; case fvertexCx: data = float_to_int32(data, 4); case vertexCx: - if (chips & 1) v->fbi.cx = (INT16)data; + if (chips & 1) vd->fbi.cx = (INT16)data; break; case fvertexCy: data = float_to_int32(data, 4); case vertexCy: - if (chips & 1) v->fbi.cy = (INT16)data; + if (chips & 1) vd->fbi.cy = (INT16)data; break; /* RGB data is 12.12 formatted fixed point */ case fstartR: data = float_to_int32(data, 12); case startR: - if (chips & 1) v->fbi.startr = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.startr = (INT32)(data << 8) >> 8; break; case fstartG: data = float_to_int32(data, 12); case startG: - if (chips & 1) v->fbi.startg = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.startg = (INT32)(data << 8) >> 8; break; case fstartB: data = float_to_int32(data, 12); case startB: - if (chips & 1) v->fbi.startb = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.startb = (INT32)(data << 8) >> 8; break; case fstartA: data = float_to_int32(data, 12); case startA: - if (chips & 1) v->fbi.starta = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.starta = (INT32)(data << 8) >> 8; break; case fdRdX: data = float_to_int32(data, 12); case dRdX: - if (chips & 1) v->fbi.drdx = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.drdx = (INT32)(data << 8) >> 8; break; case fdGdX: data = float_to_int32(data, 12); case dGdX: - if (chips & 1) v->fbi.dgdx = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.dgdx = (INT32)(data << 8) >> 8; break; case fdBdX: data = float_to_int32(data, 12); case dBdX: - if (chips & 1) v->fbi.dbdx = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.dbdx = (INT32)(data << 8) >> 8; break; case fdAdX: data = float_to_int32(data, 12); case dAdX: - if (chips & 1) v->fbi.dadx = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.dadx = (INT32)(data << 8) >> 8; break; case fdRdY: data = float_to_int32(data, 12); case dRdY: - if (chips & 1) v->fbi.drdy = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.drdy = (INT32)(data << 8) >> 8; break; case fdGdY: data = float_to_int32(data, 12); case dGdY: - if (chips & 1) v->fbi.dgdy = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.dgdy = (INT32)(data << 8) >> 8; break; case fdBdY: data = float_to_int32(data, 12); case dBdY: - if (chips & 1) v->fbi.dbdy = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.dbdy = (INT32)(data << 8) >> 8; break; case fdAdY: data = float_to_int32(data, 12); case dAdY: - if (chips & 1) v->fbi.dady = (INT32)(data << 8) >> 8; + if (chips & 1) vd->fbi.dady = (INT32)(data << 8) >> 8; break; /* Z data is 20.12 formatted fixed point */ case fstartZ: data = float_to_int32(data, 12); case startZ: - if (chips & 1) v->fbi.startz = (INT32)data; + if (chips & 1) vd->fbi.startz = (INT32)data; break; case fdZdX: data = float_to_int32(data, 12); case dZdX: - if (chips & 1) v->fbi.dzdx = (INT32)data; + if (chips & 1) vd->fbi.dzdx = (INT32)data; break; case fdZdY: data = float_to_int32(data, 12); case dZdY: - if (chips & 1) v->fbi.dzdy = (INT32)data; + if (chips & 1) vd->fbi.dzdy = (INT32)data; break; /* S,T data is 14.18 formatted fixed point, converted to 16.32 internally */ case fstartS: data64 = float_to_int64(data, 32); - if (chips & 2) v->tmu[0].starts = data64; - if (chips & 4) v->tmu[1].starts = data64; + if (chips & 2) vd->tmu[0].starts = data64; + if (chips & 4) vd->tmu[1].starts = data64; break; case startS: - if (chips & 2) v->tmu[0].starts = (INT64)(INT32)data << 14; - if (chips & 4) v->tmu[1].starts = (INT64)(INT32)data << 14; + if (chips & 2) vd->tmu[0].starts = (INT64)(INT32)data << 14; + if (chips & 4) vd->tmu[1].starts = (INT64)(INT32)data << 14; break; case fstartT: data64 = float_to_int64(data, 32); - if (chips & 2) v->tmu[0].startt = data64; - if (chips & 4) v->tmu[1].startt = data64; + if (chips & 2) vd->tmu[0].startt = data64; + if (chips & 4) vd->tmu[1].startt = data64; break; case startT: - if (chips & 2) v->tmu[0].startt = (INT64)(INT32)data << 14; - if (chips & 4) v->tmu[1].startt = (INT64)(INT32)data << 14; + if (chips & 2) vd->tmu[0].startt = (INT64)(INT32)data << 14; + if (chips & 4) vd->tmu[1].startt = (INT64)(INT32)data << 14; break; case fdSdX: data64 = float_to_int64(data, 32); - if (chips & 2) v->tmu[0].dsdx = data64; - if (chips & 4) v->tmu[1].dsdx = data64; + if (chips & 2) vd->tmu[0].dsdx = data64; + if (chips & 4) vd->tmu[1].dsdx = data64; break; case dSdX: - if (chips & 2) v->tmu[0].dsdx = (INT64)(INT32)data << 14; - if (chips & 4) v->tmu[1].dsdx = (INT64)(INT32)data << 14; + if (chips & 2) vd->tmu[0].dsdx = (INT64)(INT32)data << 14; + if (chips & 4) vd->tmu[1].dsdx = (INT64)(INT32)data << 14; break; case fdTdX: data64 = float_to_int64(data, 32); - if (chips & 2) v->tmu[0].dtdx = data64; - if (chips & 4) v->tmu[1].dtdx = data64; + if (chips & 2) vd->tmu[0].dtdx = data64; + if (chips & 4) vd->tmu[1].dtdx = data64; break; case dTdX: - if (chips & 2) v->tmu[0].dtdx = (INT64)(INT32)data << 14; - if (chips & 4) v->tmu[1].dtdx = (INT64)(INT32)data << 14; + if (chips & 2) vd->tmu[0].dtdx = (INT64)(INT32)data << 14; + if (chips & 4) vd->tmu[1].dtdx = (INT64)(INT32)data << 14; break; case fdSdY: data64 = float_to_int64(data, 32); - if (chips & 2) v->tmu[0].dsdy = data64; - if (chips & 4) v->tmu[1].dsdy = data64; + if (chips & 2) vd->tmu[0].dsdy = data64; + if (chips & 4) vd->tmu[1].dsdy = data64; break; case dSdY: - if (chips & 2) v->tmu[0].dsdy = (INT64)(INT32)data << 14; - if (chips & 4) v->tmu[1].dsdy = (INT64)(INT32)data << 14; + if (chips & 2) vd->tmu[0].dsdy = (INT64)(INT32)data << 14; + if (chips & 4) vd->tmu[1].dsdy = (INT64)(INT32)data << 14; break; case fdTdY: data64 = float_to_int64(data, 32); - if (chips & 2) v->tmu[0].dtdy = data64; - if (chips & 4) v->tmu[1].dtdy = data64; + if (chips & 2) vd->tmu[0].dtdy = data64; + if (chips & 4) vd->tmu[1].dtdy = data64; break; case dTdY: - if (chips & 2) v->tmu[0].dtdy = (INT64)(INT32)data << 14; - if (chips & 4) v->tmu[1].dtdy = (INT64)(INT32)data << 14; + if (chips & 2) vd->tmu[0].dtdy = (INT64)(INT32)data << 14; + if (chips & 4) vd->tmu[1].dtdy = (INT64)(INT32)data << 14; break; /* W data is 2.30 formatted fixed point, converted to 16.32 internally */ case fstartW: data64 = float_to_int64(data, 32); - if (chips & 1) v->fbi.startw = data64; - if (chips & 2) v->tmu[0].startw = data64; - if (chips & 4) v->tmu[1].startw = data64; + if (chips & 1) vd->fbi.startw = data64; + if (chips & 2) vd->tmu[0].startw = data64; + if (chips & 4) vd->tmu[1].startw = data64; break; case startW: - if (chips & 1) v->fbi.startw = (INT64)(INT32)data << 2; - if (chips & 2) v->tmu[0].startw = (INT64)(INT32)data << 2; - if (chips & 4) v->tmu[1].startw = (INT64)(INT32)data << 2; + if (chips & 1) vd->fbi.startw = (INT64)(INT32)data << 2; + if (chips & 2) vd->tmu[0].startw = (INT64)(INT32)data << 2; + if (chips & 4) vd->tmu[1].startw = (INT64)(INT32)data << 2; break; case fdWdX: data64 = float_to_int64(data, 32); - if (chips & 1) v->fbi.dwdx = data64; - if (chips & 2) v->tmu[0].dwdx = data64; - if (chips & 4) v->tmu[1].dwdx = data64; + if (chips & 1) vd->fbi.dwdx = data64; + if (chips & 2) vd->tmu[0].dwdx = data64; + if (chips & 4) vd->tmu[1].dwdx = data64; break; case dWdX: - if (chips & 1) v->fbi.dwdx = (INT64)(INT32)data << 2; - if (chips & 2) v->tmu[0].dwdx = (INT64)(INT32)data << 2; - if (chips & 4) v->tmu[1].dwdx = (INT64)(INT32)data << 2; + if (chips & 1) vd->fbi.dwdx = (INT64)(INT32)data << 2; + if (chips & 2) vd->tmu[0].dwdx = (INT64)(INT32)data << 2; + if (chips & 4) vd->tmu[1].dwdx = (INT64)(INT32)data << 2; break; case fdWdY: data64 = float_to_int64(data, 32); - if (chips & 1) v->fbi.dwdy = data64; - if (chips & 2) v->tmu[0].dwdy = data64; - if (chips & 4) v->tmu[1].dwdy = data64; + if (chips & 1) vd->fbi.dwdy = data64; + if (chips & 2) vd->tmu[0].dwdy = data64; + if (chips & 4) vd->tmu[1].dwdy = data64; break; case dWdY: - if (chips & 1) v->fbi.dwdy = (INT64)(INT32)data << 2; - if (chips & 2) v->tmu[0].dwdy = (INT64)(INT32)data << 2; - if (chips & 4) v->tmu[1].dwdy = (INT64)(INT32)data << 2; + if (chips & 1) vd->fbi.dwdy = (INT64)(INT32)data << 2; + if (chips & 2) vd->tmu[0].dwdy = (INT64)(INT32)data << 2; + if (chips & 4) vd->tmu[1].dwdy = (INT64)(INT32)data << 2; break; /* setup bits */ @@ -2460,114 +2398,114 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) if (chips & 1) { rgb_t rgbdata(data); - v->reg[sAlpha].f = rgbdata.a(); - v->reg[sRed].f = rgbdata.r(); - v->reg[sGreen].f = rgbdata.g(); - v->reg[sBlue].f = rgbdata.b(); + vd->reg[sAlpha].f = rgbdata.a(); + vd->reg[sRed].f = rgbdata.r(); + vd->reg[sGreen].f = rgbdata.g(); + vd->reg[sBlue].f = rgbdata.b(); } break; /* mask off invalid bits for different cards */ case fbzColorPath: - poly_wait(v->poly, v->regnames[regnum]); - if (v->type < TYPE_VOODOO_2) + poly_wait(vd->poly, vd->regnames[regnum]); + if (vd->vd_type < TYPE_VOODOO_2) data &= 0x0fffffff; - if (chips & 1) v->reg[fbzColorPath].u = data; + if (chips & 1) vd->reg[fbzColorPath].u = data; break; case fbzMode: - poly_wait(v->poly, v->regnames[regnum]); - if (v->type < TYPE_VOODOO_2) + poly_wait(vd->poly, vd->regnames[regnum]); + if (vd->vd_type < TYPE_VOODOO_2) data &= 0x001fffff; - if (chips & 1) v->reg[fbzMode].u = data; + if (chips & 1) vd->reg[fbzMode].u = data; break; case fogMode: - poly_wait(v->poly, v->regnames[regnum]); - if (v->type < TYPE_VOODOO_2) + poly_wait(vd->poly, vd->regnames[regnum]); + if (vd->vd_type < TYPE_VOODOO_2) data &= 0x0000003f; - if (chips & 1) v->reg[fogMode].u = data; + if (chips & 1) vd->reg[fogMode].u = data; break; /* triangle drawing */ case triangleCMD: - v->fbi.cheating_allowed = (v->fbi.ax != 0 || v->fbi.ay != 0 || v->fbi.bx > 50 || v->fbi.by != 0 || v->fbi.cx != 0 || v->fbi.cy > 50); - v->fbi.sign = data; - cycles = triangle(v); + vd->fbi.cheating_allowed = (vd->fbi.ax != 0 || vd->fbi.ay != 0 || vd->fbi.bx > 50 || vd->fbi.by != 0 || vd->fbi.cx != 0 || vd->fbi.cy > 50); + vd->fbi.sign = data; + cycles = triangle(vd); break; case ftriangleCMD: - v->fbi.cheating_allowed = TRUE; - v->fbi.sign = data; - cycles = triangle(v); + vd->fbi.cheating_allowed = TRUE; + vd->fbi.sign = data; + cycles = triangle(vd); break; case sBeginTriCMD: - cycles = begin_triangle(v); + cycles = begin_triangle(vd); break; case sDrawTriCMD: - cycles = draw_triangle(v); + cycles = draw_triangle(vd); break; /* other commands */ case nopCMD: - poly_wait(v->poly, v->regnames[regnum]); + poly_wait(vd->poly, vd->regnames[regnum]); if (data & 1) - reset_counters(v); + reset_counters(vd); if (data & 2) - v->reg[fbiTrianglesOut].u = 0; + vd->reg[fbiTrianglesOut].u = 0; break; case fastfillCMD: - cycles = fastfill(v); + cycles = fastfill(vd); break; case swapbufferCMD: - poly_wait(v->poly, v->regnames[regnum]); - cycles = swapbuffer(v, data); + poly_wait(vd->poly, vd->regnames[regnum]); + cycles = swapbuffer(vd, data); break; case userIntrCMD: - poly_wait(v->poly, v->regnames[regnum]); + poly_wait(vd->poly, vd->regnames[regnum]); //fatalerror("userIntrCMD\n"); - v->reg[intrCtrl].u |= 0x1800; - v->reg[intrCtrl].u &= ~0x80000000; + vd->reg[intrCtrl].u |= 0x1800; + vd->reg[intrCtrl].u &= ~0x80000000; // TODO: rename vblank_client for less confusion? - if (!v->device->m_vblank.isnull()) - v->device->m_vblank(TRUE); + if (!vd->device->m_vblank.isnull()) + vd->device->m_vblank(TRUE); break; /* gamma table access -- Voodoo/Voodoo2 only */ case clutData: - if (v->type <= TYPE_VOODOO_2 && (chips & 1)) + if (vd->vd_type <= TYPE_VOODOO_2 && (chips & 1)) { - poly_wait(v->poly, v->regnames[regnum]); - if (!FBIINIT1_VIDEO_TIMING_RESET(v->reg[fbiInit1].u)) + poly_wait(vd->poly, vd->regnames[regnum]); + if (!FBIINIT1_VIDEO_TIMING_RESET(vd->reg[fbiInit1].u)) { int index = data >> 24; if (index <= 32) { - v->fbi.clut[index] = data; - v->fbi.clut_dirty = TRUE; + vd->fbi.clut[index] = data; + vd->fbi.clut_dirty = TRUE; } } else - v->device->logerror("clutData ignored because video timing reset = 1\n"); + vd->device->logerror("clutData ignored because video timing reset = 1\n"); } break; /* external DAC access -- Voodoo/Voodoo2 only */ case dacData: - if (v->type <= TYPE_VOODOO_2 && (chips & 1)) + if (vd->vd_type <= TYPE_VOODOO_2 && (chips & 1)) { - poly_wait(v->poly, v->regnames[regnum]); + poly_wait(vd->poly, vd->regnames[regnum]); if (!(data & 0x800)) - dacdata_w(&v->dac, (data >> 8) & 7, data & 0xff); + dacdata_w(&vd->dac, (data >> 8) & 7, data & 0xff); else - dacdata_r(&v->dac, (data >> 8) & 7); + dacdata_r(&vd->dac, (data >> 8) & 7); } break; @@ -2576,35 +2514,35 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) case vSync: case backPorch: case videoDimensions: - if (v->type <= TYPE_VOODOO_2 && (chips & 1)) + if (vd->vd_type <= TYPE_VOODOO_2 && (chips & 1)) { - poly_wait(v->poly, v->regnames[regnum]); - v->reg[regnum].u = data; - if (v->reg[hSync].u != 0 && v->reg[vSync].u != 0 && v->reg[videoDimensions].u != 0) + poly_wait(vd->poly, vd->regnames[regnum]); + vd->reg[regnum].u = data; + if (vd->reg[hSync].u != 0 && vd->reg[vSync].u != 0 && vd->reg[videoDimensions].u != 0) { int hvis, vvis, htotal, vtotal, hbp, vbp; - attoseconds_t refresh = v->screen->frame_period().attoseconds(); + attoseconds_t refresh = vd->screen->frame_period().attoseconds(); attoseconds_t stdperiod, medperiod, vgaperiod; attoseconds_t stddiff, meddiff, vgadiff; rectangle visarea; - if (v->type == TYPE_VOODOO_2) + if (vd->vd_type == TYPE_VOODOO_2) { - htotal = ((v->reg[hSync].u >> 16) & 0x7ff) + 1 + (v->reg[hSync].u & 0x1ff) + 1; - vtotal = ((v->reg[vSync].u >> 16) & 0x1fff) + (v->reg[vSync].u & 0x1fff); - hvis = v->reg[videoDimensions].u & 0x7ff; - vvis = (v->reg[videoDimensions].u >> 16) & 0x7ff; - hbp = (v->reg[backPorch].u & 0x1ff) + 2; - vbp = (v->reg[backPorch].u >> 16) & 0x1ff; + htotal = ((vd->reg[hSync].u >> 16) & 0x7ff) + 1 + (vd->reg[hSync].u & 0x1ff) + 1; + vtotal = ((vd->reg[vSync].u >> 16) & 0x1fff) + (vd->reg[vSync].u & 0x1fff); + hvis = vd->reg[videoDimensions].u & 0x7ff; + vvis = (vd->reg[videoDimensions].u >> 16) & 0x7ff; + hbp = (vd->reg[backPorch].u & 0x1ff) + 2; + vbp = (vd->reg[backPorch].u >> 16) & 0x1ff; } else { - htotal = ((v->reg[hSync].u >> 16) & 0x3ff) + 1 + (v->reg[hSync].u & 0xff) + 1; - vtotal = ((v->reg[vSync].u >> 16) & 0xfff) + (v->reg[vSync].u & 0xfff); - hvis = v->reg[videoDimensions].u & 0x3ff; - vvis = (v->reg[videoDimensions].u >> 16) & 0x3ff; - hbp = (v->reg[backPorch].u & 0xff) + 2; - vbp = (v->reg[backPorch].u >> 16) & 0xff; + htotal = ((vd->reg[hSync].u >> 16) & 0x3ff) + 1 + (vd->reg[hSync].u & 0xff) + 1; + vtotal = ((vd->reg[vSync].u >> 16) & 0xfff) + (vd->reg[vSync].u & 0xfff); + hvis = vd->reg[videoDimensions].u & 0x3ff; + vvis = (vd->reg[videoDimensions].u >> 16) & 0x3ff; + hbp = (vd->reg[backPorch].u & 0xff) + 2; + vbp = (vd->reg[backPorch].u >> 16) & 0xff; } /* create a new visarea */ @@ -2628,61 +2566,61 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) if (vgadiff < 0) vgadiff = -vgadiff; osd_printf_debug("hSync=%08X vSync=%08X backPorch=%08X videoDimensions=%08X\n", - v->reg[hSync].u, v->reg[vSync].u, v->reg[backPorch].u, v->reg[videoDimensions].u); + vd->reg[hSync].u, vd->reg[vSync].u, vd->reg[backPorch].u, vd->reg[videoDimensions].u); osd_printf_debug("Horiz: %d-%d (%d total) Vert: %d-%d (%d total) -- ", visarea.min_x, visarea.max_x, htotal, visarea.min_y, visarea.max_y, vtotal); /* configure the screen based on which one matches the closest */ if (stddiff < meddiff && stddiff < vgadiff) { - v->screen->configure(htotal, vtotal, visarea, stdperiod); + vd->screen->configure(htotal, vtotal, visarea, stdperiod); osd_printf_debug("Standard resolution, %f Hz\n", ATTOSECONDS_TO_HZ(stdperiod)); } else if (meddiff < vgadiff) { - v->screen->configure(htotal, vtotal, visarea, medperiod); + vd->screen->configure(htotal, vtotal, visarea, medperiod); osd_printf_debug("Medium resolution, %f Hz\n", ATTOSECONDS_TO_HZ(medperiod)); } else { - v->screen->configure(htotal, vtotal, visarea, vgaperiod); + vd->screen->configure(htotal, vtotal, visarea, vgaperiod); osd_printf_debug("VGA resolution, %f Hz\n", ATTOSECONDS_TO_HZ(vgaperiod)); } /* configure the new framebuffer info */ - v->fbi.width = hvis; - v->fbi.height = vvis; - v->fbi.xoffs = hbp; - v->fbi.yoffs = vbp; - v->fbi.vsyncscan = (v->reg[vSync].u >> 16) & 0xfff; + vd->fbi.width = hvis; + vd->fbi.height = vvis; + vd->fbi.xoffs = hbp; + vd->fbi.yoffs = vbp; + vd->fbi.vsyncscan = (vd->reg[vSync].u >> 16) & 0xfff; /* recompute the time of VBLANK */ - adjust_vblank_timer(v); + adjust_vblank_timer(vd); /* if changing dimensions, update video memory layout */ if (regnum == videoDimensions) - recompute_video_memory(v); + recompute_video_memory(vd); } } break; /* fbiInit0 can only be written if initEnable says we can -- Voodoo/Voodoo2 only */ case fbiInit0: - poly_wait(v->poly, v->regnames[regnum]); - if (v->type <= TYPE_VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable)) + poly_wait(vd->poly, vd->regnames[regnum]); + if (vd->vd_type <= TYPE_VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(vd->pci.init_enable)) { - v->reg[fbiInit0].u = data; + vd->reg[fbiInit0].u = data; if (FBIINIT0_GRAPHICS_RESET(data)) - soft_reset(v); + soft_reset(vd); if (FBIINIT0_FIFO_RESET(data)) - fifo_reset(&v->pci.fifo); - recompute_video_memory(v); + fifo_reset(&vd->pci.fifo); + recompute_video_memory(vd); } break; /* fbiInit5-7 are Voodoo 2-only; ignore them on anything else */ case fbiInit5: case fbiInit6: - if (v->type < TYPE_VOODOO_2) + if (vd->vd_type < TYPE_VOODOO_2) break; /* else fall through... */ @@ -2691,94 +2629,94 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) case fbiInit1: case fbiInit2: case fbiInit4: - poly_wait(v->poly, v->regnames[regnum]); - if (v->type <= TYPE_VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable)) + poly_wait(vd->poly, vd->regnames[regnum]); + if (vd->vd_type <= TYPE_VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(vd->pci.init_enable)) { - v->reg[regnum].u = data; - recompute_video_memory(v); - v->fbi.video_changed = TRUE; + vd->reg[regnum].u = data; + recompute_video_memory(vd); + vd->fbi.video_changed = TRUE; } break; case fbiInit3: - poly_wait(v->poly, v->regnames[regnum]); - if (v->type <= TYPE_VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable)) + poly_wait(vd->poly, vd->regnames[regnum]); + if (vd->vd_type <= TYPE_VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(vd->pci.init_enable)) { - v->reg[regnum].u = data; - v->alt_regmap = FBIINIT3_TRI_REGISTER_REMAP(data); - v->fbi.yorigin = FBIINIT3_YORIGIN_SUBTRACT(v->reg[fbiInit3].u); - recompute_video_memory(v); + vd->reg[regnum].u = data; + vd->alt_regmap = FBIINIT3_TRI_REGISTER_REMAP(data); + vd->fbi.yorigin = FBIINIT3_YORIGIN_SUBTRACT(vd->reg[fbiInit3].u); + recompute_video_memory(vd); } break; case fbiInit7: /* case swapPending: -- Banshee */ - if (v->type == TYPE_VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable)) + if (vd->vd_type == TYPE_VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(vd->pci.init_enable)) { - poly_wait(v->poly, v->regnames[regnum]); - v->reg[regnum].u = data; - v->fbi.cmdfifo[0].enable = FBIINIT7_CMDFIFO_ENABLE(data); - v->fbi.cmdfifo[0].count_holes = !FBIINIT7_DISABLE_CMDFIFO_HOLES(data); + poly_wait(vd->poly, vd->regnames[regnum]); + vd->reg[regnum].u = data; + vd->fbi.cmdfifo[0].enable = FBIINIT7_CMDFIFO_ENABLE(data); + vd->fbi.cmdfifo[0].count_holes = !FBIINIT7_DISABLE_CMDFIFO_HOLES(data); } - else if (v->type >= TYPE_VOODOO_BANSHEE) - v->fbi.swaps_pending++; + else if (vd->vd_type >= TYPE_VOODOO_BANSHEE) + vd->fbi.swaps_pending++; break; /* cmdFifo -- Voodoo2 only */ case cmdFifoBaseAddr: - if (v->type == TYPE_VOODOO_2 && (chips & 1)) + if (vd->vd_type == TYPE_VOODOO_2 && (chips & 1)) { - poly_wait(v->poly, v->regnames[regnum]); - v->reg[regnum].u = data; - v->fbi.cmdfifo[0].base = (data & 0x3ff) << 12; - v->fbi.cmdfifo[0].end = (((data >> 16) & 0x3ff) + 1) << 12; + poly_wait(vd->poly, vd->regnames[regnum]); + vd->reg[regnum].u = data; + vd->fbi.cmdfifo[0].base = (data & 0x3ff) << 12; + vd->fbi.cmdfifo[0].end = (((data >> 16) & 0x3ff) + 1) << 12; } break; case cmdFifoBump: - if (v->type == TYPE_VOODOO_2 && (chips & 1)) + if (vd->vd_type == TYPE_VOODOO_2 && (chips & 1)) fatalerror("cmdFifoBump\n"); break; case cmdFifoRdPtr: - if (v->type == TYPE_VOODOO_2 && (chips & 1)) - v->fbi.cmdfifo[0].rdptr = data; + if (vd->vd_type == TYPE_VOODOO_2 && (chips & 1)) + vd->fbi.cmdfifo[0].rdptr = data; break; case cmdFifoAMin: /* case colBufferAddr: -- Banshee */ - if (v->type == TYPE_VOODOO_2 && (chips & 1)) - v->fbi.cmdfifo[0].amin = data; - else if (v->type >= TYPE_VOODOO_BANSHEE && (chips & 1)) - v->fbi.rgboffs[1] = data & v->fbi.mask & ~0x0f; + if (vd->vd_type == TYPE_VOODOO_2 && (chips & 1)) + vd->fbi.cmdfifo[0].amin = data; + else if (vd->vd_type >= TYPE_VOODOO_BANSHEE && (chips & 1)) + vd->fbi.rgboffs[1] = data & vd->fbi.mask & ~0x0f; break; case cmdFifoAMax: /* case colBufferStride: -- Banshee */ - if (v->type == TYPE_VOODOO_2 && (chips & 1)) - v->fbi.cmdfifo[0].amax = data; - else if (v->type >= TYPE_VOODOO_BANSHEE && (chips & 1)) + if (vd->vd_type == TYPE_VOODOO_2 && (chips & 1)) + vd->fbi.cmdfifo[0].amax = data; + else if (vd->vd_type >= TYPE_VOODOO_BANSHEE && (chips & 1)) { if (data & 0x8000) - v->fbi.rowpixels = (data & 0x7f) << 6; + vd->fbi.rowpixels = (data & 0x7f) << 6; else - v->fbi.rowpixels = (data & 0x3fff) >> 1; + vd->fbi.rowpixels = (data & 0x3fff) >> 1; } break; case cmdFifoDepth: /* case auxBufferAddr: -- Banshee */ - if (v->type == TYPE_VOODOO_2 && (chips & 1)) - v->fbi.cmdfifo[0].depth = data; - else if (v->type >= TYPE_VOODOO_BANSHEE && (chips & 1)) - v->fbi.auxoffs = data & v->fbi.mask & ~0x0f; + if (vd->vd_type == TYPE_VOODOO_2 && (chips & 1)) + vd->fbi.cmdfifo[0].depth = data; + else if (vd->vd_type >= TYPE_VOODOO_BANSHEE && (chips & 1)) + vd->fbi.auxoffs = data & vd->fbi.mask & ~0x0f; break; case cmdFifoHoles: /* case auxBufferStride: -- Banshee */ - if (v->type == TYPE_VOODOO_2 && (chips & 1)) - v->fbi.cmdfifo[0].holes = data; - else if (v->type >= TYPE_VOODOO_BANSHEE && (chips & 1)) + if (vd->vd_type == TYPE_VOODOO_2 && (chips & 1)) + vd->fbi.cmdfifo[0].holes = data; + else if (vd->vd_type >= TYPE_VOODOO_BANSHEE && (chips & 1)) { int rowpixels; @@ -2786,7 +2724,7 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) rowpixels = (data & 0x7f) << 6; else rowpixels = (data & 0x3fff) >> 1; - if (v->fbi.rowpixels != rowpixels) + if (vd->fbi.rowpixels != rowpixels) fatalerror("aux buffer stride differs from color buffer stride\n"); } break; @@ -2804,9 +2742,9 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) case nccTable+9: case nccTable+10: case nccTable+11: - poly_wait(v->poly, v->regnames[regnum]); - if (chips & 2) ncc_table_write(&v->tmu[0].ncc[0], regnum - nccTable, data); - if (chips & 4) ncc_table_write(&v->tmu[1].ncc[0], regnum - nccTable, data); + poly_wait(vd->poly, vd->regnames[regnum]); + if (chips & 2) ncc_table_write(&vd->tmu[0].ncc[0], regnum - nccTable, data); + if (chips & 4) ncc_table_write(&vd->tmu[1].ncc[0], regnum - nccTable, data); break; case nccTable+12: @@ -2821,9 +2759,9 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) case nccTable+21: case nccTable+22: case nccTable+23: - poly_wait(v->poly, v->regnames[regnum]); - if (chips & 2) ncc_table_write(&v->tmu[0].ncc[1], regnum - (nccTable+12), data); - if (chips & 4) ncc_table_write(&v->tmu[1].ncc[1], regnum - (nccTable+12), data); + poly_wait(vd->poly, vd->regnames[regnum]); + if (chips & 2) ncc_table_write(&vd->tmu[0].ncc[1], regnum - (nccTable+12), data); + if (chips & 4) ncc_table_write(&vd->tmu[1].ncc[1], regnum - (nccTable+12), data); break; /* fogTable entries are processed and expanded immediately */ @@ -2859,14 +2797,14 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) case fogTable+29: case fogTable+30: case fogTable+31: - poly_wait(v->poly, v->regnames[regnum]); + poly_wait(vd->poly, vd->regnames[regnum]); if (chips & 1) { int base = 2 * (regnum - fogTable); - v->fbi.fogdelta[base + 0] = (data >> 0) & 0xff; - v->fbi.fogblend[base + 0] = (data >> 8) & 0xff; - v->fbi.fogdelta[base + 1] = (data >> 16) & 0xff; - v->fbi.fogblend[base + 1] = (data >> 24) & 0xff; + vd->fbi.fogdelta[base + 0] = (data >> 0) & 0xff; + vd->fbi.fogblend[base + 0] = (data >> 8) & 0xff; + vd->fbi.fogdelta[base + 1] = (data >> 16) & 0xff; + vd->fbi.fogblend[base + 1] = (data >> 24) & 0xff; } break; @@ -2878,22 +2816,22 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) case texBaseAddr_1: case texBaseAddr_2: case texBaseAddr_3_8: - poly_wait(v->poly, v->regnames[regnum]); + poly_wait(vd->poly, vd->regnames[regnum]); if (chips & 2) { - v->tmu[0].reg[regnum].u = data; - v->tmu[0].regdirty = TRUE; + vd->tmu[0].reg[regnum].u = data; + vd->tmu[0].regdirty = TRUE; } if (chips & 4) { - v->tmu[1].reg[regnum].u = data; - v->tmu[1].regdirty = TRUE; + vd->tmu[1].reg[regnum].u = data; + vd->tmu[1].regdirty = TRUE; } break; case trexInit1: /* send tmu config data to the frame buffer */ - v->send_config = (TREXINIT_SEND_TMU_CONFIG(data) > 0); + vd->send_config = (TREXINIT_SEND_TMU_CONFIG(data) > 0); goto default_case; /* these registers are referenced in the renderer; we must wait for pending work before changing */ @@ -2907,25 +2845,25 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) case color0: case clipLowYHighY: case clipLeftRight: - poly_wait(v->poly, v->regnames[regnum]); + poly_wait(vd->poly, vd->regnames[regnum]); /* fall through to default implementation */ /* by default, just feed the data to the chips */ default: default_case: - if (chips & 1) v->reg[0x000 + regnum].u = data; - if (chips & 2) v->reg[0x100 + regnum].u = data; - if (chips & 4) v->reg[0x200 + regnum].u = data; - if (chips & 8) v->reg[0x300 + regnum].u = data; + if (chips & 1) vd->reg[0x000 + regnum].u = data; + if (chips & 2) vd->reg[0x100 + regnum].u = data; + if (chips & 4) vd->reg[0x200 + regnum].u = data; + if (chips & 8) vd->reg[0x300 + regnum].u = data; break; } if (LOG_REGISTERS) { if (regnum < fvertexAx || regnum > fdWdY) - v->device->logerror("VOODOO.%d.REG:%s(%d) write = %08X\n", v->index, (regnum < 0x384/4) ? v->regnames[regnum] : "oob", chips, origdata); + vd->device->logerror("VOODOO.%d.REG:%s(%d) write = %08X\n", vd->index, (regnum < 0x384/4) ? vd->regnames[regnum] : "oob", chips, origdata); else - v->device->logerror("VOODOO.%d.REG:%s(%d) write = %f\n", v->index, (regnum < 0x384/4) ? v->regnames[regnum] : "oob", chips, (double) u2f(origdata)); + vd->device->logerror("VOODOO.%d.REG:%s(%d) write = %f\n", vd->index, (regnum < 0x384/4) ? vd->regnames[regnum] : "oob", chips, (double) u2f(origdata)); } return cycles; @@ -2938,25 +2876,25 @@ default_case: * Voodoo LFB writes * *************************************/ -static INT32 lfb_direct_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) -{ +INT32 voodoo_device::lfb_direct_w(voodoo_device *vd, offs_t offset, UINT32 data, UINT32 mem_mask) +{ UINT16 *dest; UINT32 destmax; int x, y; UINT32 bufoffs; /* statistics */ - v->stats.lfb_writes++; + vd->stats.lfb_writes++; /* byte swizzling */ - if (LFBMODE_BYTE_SWIZZLE_WRITES(v->reg[lfbMode].u)) + if (LFBMODE_BYTE_SWIZZLE_WRITES(vd->reg[lfbMode].u)) { data = FLIPENDIAN_INT32(data); mem_mask = FLIPENDIAN_INT32(mem_mask); } /* word swapping */ - if (LFBMODE_WORD_SWAP_WRITES(v->reg[lfbMode].u)) + if (LFBMODE_WORD_SWAP_WRITES(vd->reg[lfbMode].u)) { data = (data << 16) | (data >> 16); mem_mask = (mem_mask << 16) | (mem_mask >> 16); @@ -2966,25 +2904,26 @@ static INT32 lfb_direct_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 me // For direct lfb access just write the data /* compute X,Y */ offset <<= 1; - x = offset & ((1 << v->fbi.lfb_stride) - 1); - y = (offset >> v->fbi.lfb_stride); - dest = (UINT16 *)(v->fbi.ram + v->fbi.lfb_base*4); - destmax = (v->fbi.mask + 1 - v->fbi.lfb_base*4) / 2; - bufoffs = y * v->fbi.rowpixels + x; + x = offset & ((1 << vd->fbi.lfb_stride) - 1); + y = (offset >> vd->fbi.lfb_stride); + dest = (UINT16 *)(vd->fbi.ram + vd->fbi.lfb_base*4); + destmax = (vd->fbi.mask + 1 - vd->fbi.lfb_base*4) / 2; + bufoffs = y * vd->fbi.rowpixels + x; if (bufoffs >= destmax) { - v->device->logerror("lfb_direct_w: Buffer offset out of bounds x=%i y=%i offset=%08X bufoffs=%08X data=%08X\n", x, y, offset, (UINT32) bufoffs, data); + vd->device->logerror("lfb_direct_w: Buffer offset out of bounds x=%i y=%i offset=%08X bufoffs=%08X data=%08X\n", x, y, offset, (UINT32) bufoffs, data); return 0; } if (ACCESSING_BITS_0_15) dest[bufoffs + 0] = data&0xffff; if (ACCESSING_BITS_16_31) dest[bufoffs + 1] = data>>16; - if (LOG_LFB) v->device->logerror("VOODOO.%d.LFB:write direct (%d,%d) = %08X & %08X\n", v->index, x, y, data, mem_mask); + if (LOG_LFB) vd->device->logerror("VOODOO.%d.LFB:write direct (%d,%d) = %08X & %08X\n", vd->index, x, y, data, mem_mask); return 0; } -static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) +INT32 voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, UINT32 data, UINT32 mem_mask) { + UINT16 *dest, *depth; UINT32 destmax, depthmax; int sr[2], sg[2], sb[2], sa[2], sw[2]; @@ -2992,28 +2931,28 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) int pix, destbuf; /* statistics */ - v->stats.lfb_writes++; + vd->stats.lfb_writes++; /* byte swizzling */ - if (LFBMODE_BYTE_SWIZZLE_WRITES(v->reg[lfbMode].u)) + if (LFBMODE_BYTE_SWIZZLE_WRITES(vd->reg[lfbMode].u)) { data = FLIPENDIAN_INT32(data); mem_mask = FLIPENDIAN_INT32(mem_mask); } /* word swapping */ - if (LFBMODE_WORD_SWAP_WRITES(v->reg[lfbMode].u)) + if (LFBMODE_WORD_SWAP_WRITES(vd->reg[lfbMode].u)) { data = (data << 16) | (data >> 16); mem_mask = (mem_mask << 16) | (mem_mask >> 16); } /* extract default depth and alpha values */ - sw[0] = sw[1] = v->reg[zaColor].u & 0xffff; - sa[0] = sa[1] = v->reg[zaColor].u >> 24; + sw[0] = sw[1] = vd->reg[zaColor].u & 0xffff; + sa[0] = sa[1] = vd->reg[zaColor].u >> 24; /* first extract A,R,G,B from the data */ - switch (LFBMODE_WRITE_FORMAT(v->reg[lfbMode].u) + 16 * LFBMODE_RGBA_LANES(v->reg[lfbMode].u)) + switch (LFBMODE_WRITE_FORMAT(vd->reg[lfbMode].u) + 16 * LFBMODE_RGBA_LANES(vd->reg[lfbMode].u)) { case 16*0 + 0: /* ARGB, 16-bit RGB 5-6-5 */ case 16*2 + 0: /* RGBA, 16-bit RGB 5-6-5 */ @@ -3180,13 +3119,13 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) break; default: /* reserved */ - v->device->logerror("lfb_w: Unknown format\n"); + vd->device->logerror("lfb_w: Unknown format\n"); return 0; } /* compute X,Y */ - x = offset & ((1 << v->fbi.lfb_stride) - 1); - y = (offset >> v->fbi.lfb_stride) & 0x3ff; + x = offset & ((1 << vd->fbi.lfb_stride) - 1); + y = (offset >> vd->fbi.lfb_stride) & 0x3ff; /* adjust the mask based on which half of the data is written */ if (!ACCESSING_BITS_0_15) @@ -3195,47 +3134,47 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) mask &= ~(0xf0 + LFB_DEPTH_PRESENT_MSW); /* select the target buffer */ - destbuf = (v->type >= TYPE_VOODOO_BANSHEE) ? 1 : LFBMODE_WRITE_BUFFER_SELECT(v->reg[lfbMode].u); + destbuf = (vd->vd_type >= TYPE_VOODOO_BANSHEE) ? 1 : LFBMODE_WRITE_BUFFER_SELECT(vd->reg[lfbMode].u); switch (destbuf) { case 0: /* front buffer */ - dest = (UINT16 *)(v->fbi.ram + v->fbi.rgboffs[v->fbi.frontbuf]); - destmax = (v->fbi.mask + 1 - v->fbi.rgboffs[v->fbi.frontbuf]) / 2; - v->fbi.video_changed = TRUE; + dest = (UINT16 *)(vd->fbi.ram + vd->fbi.rgboffs[vd->fbi.frontbuf]); + destmax = (vd->fbi.mask + 1 - vd->fbi.rgboffs[vd->fbi.frontbuf]) / 2; + vd->fbi.video_changed = TRUE; break; case 1: /* back buffer */ - dest = (UINT16 *)(v->fbi.ram + v->fbi.rgboffs[v->fbi.backbuf]); - destmax = (v->fbi.mask + 1 - v->fbi.rgboffs[v->fbi.backbuf]) / 2; + dest = (UINT16 *)(vd->fbi.ram + vd->fbi.rgboffs[vd->fbi.backbuf]); + destmax = (vd->fbi.mask + 1 - vd->fbi.rgboffs[vd->fbi.backbuf]) / 2; break; default: /* reserved */ return 0; } - depth = (UINT16 *)(v->fbi.ram + v->fbi.auxoffs); - depthmax = (v->fbi.mask + 1 - v->fbi.auxoffs) / 2; + depth = (UINT16 *)(vd->fbi.ram + vd->fbi.auxoffs); + depthmax = (vd->fbi.mask + 1 - vd->fbi.auxoffs) / 2; /* simple case: no pipeline */ - if (!LFBMODE_ENABLE_PIXEL_PIPELINE(v->reg[lfbMode].u)) + if (!LFBMODE_ENABLE_PIXEL_PIPELINE(vd->reg[lfbMode].u)) { DECLARE_DITHER_POINTERS_NO_DITHER_VAR; UINT32 bufoffs; - if (LOG_LFB) v->device->logerror("VOODOO.%d.LFB:write raw mode %X (%d,%d) = %08X & %08X\n", v->index, LFBMODE_WRITE_FORMAT(v->reg[lfbMode].u), x, y, data, mem_mask); + if (LOG_LFB) vd->device->logerror("VOODOO.%d.LFB:write raw mode %X (%d,%d) = %08X & %08X\n", vd->index, LFBMODE_WRITE_FORMAT(vd->reg[lfbMode].u), x, y, data, mem_mask); /* determine the screen Y */ scry = y; - if (LFBMODE_Y_ORIGIN(v->reg[lfbMode].u)) - scry = (v->fbi.yorigin - y) & 0x3ff; + if (LFBMODE_Y_ORIGIN(vd->reg[lfbMode].u)) + scry = (vd->fbi.yorigin - y) & 0x3ff; /* advance pointers to the proper row */ - bufoffs = scry * v->fbi.rowpixels + x; + bufoffs = scry * vd->fbi.rowpixels + x; /* compute dithering */ - COMPUTE_DITHER_POINTERS_NO_DITHER_VAR(v->reg[fbzMode].u, y); + COMPUTE_DITHER_POINTERS_NO_DITHER_VAR(vd->reg[fbzMode].u, y); /* wait for any outstanding work to finish */ - poly_wait(v->poly, "LFB Write"); + poly_wait(vd->poly, "LFB Write"); /* loop over up to two pixels */ for (pix = 0; mask; pix++) @@ -3247,7 +3186,7 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) if ((mask & LFB_RGB_PRESENT) && bufoffs < destmax) { /* apply dithering and write to the screen */ - APPLY_DITHER(v->reg[fbzMode].u, x, dither_lookup, sr[pix], sg[pix], sb[pix]); + APPLY_DITHER(vd->reg[fbzMode].u, x, dither_lookup, sr[pix], sg[pix], sb[pix]); dest[bufoffs] = (sr[pix] << 11) | (sg[pix] << 5) | sb[pix]; } @@ -3255,16 +3194,16 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) if (depth && bufoffs < depthmax) { /* write to the alpha buffer */ - if ((mask & LFB_ALPHA_PRESENT) && FBZMODE_ENABLE_ALPHA_PLANES(v->reg[fbzMode].u)) + if ((mask & LFB_ALPHA_PRESENT) && FBZMODE_ENABLE_ALPHA_PLANES(vd->reg[fbzMode].u)) depth[bufoffs] = sa[pix]; /* write to the depth buffer */ - if ((mask & (LFB_DEPTH_PRESENT | LFB_DEPTH_PRESENT_MSW)) && !FBZMODE_ENABLE_ALPHA_PLANES(v->reg[fbzMode].u)) + if ((mask & (LFB_DEPTH_PRESENT | LFB_DEPTH_PRESENT_MSW)) && !FBZMODE_ENABLE_ALPHA_PLANES(vd->reg[fbzMode].u)) depth[bufoffs] = sw[pix]; } /* track pixel writes to the frame buffer regardless of mask */ - v->reg[fbiPixelsOut].u++; + vd->reg[fbiPixelsOut].u++; } /* advance our pointers */ @@ -3279,20 +3218,20 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) { DECLARE_DITHER_POINTERS; - if (LOG_LFB) v->device->logerror("VOODOO.%d.LFB:write pipelined mode %X (%d,%d) = %08X & %08X\n", v->index, LFBMODE_WRITE_FORMAT(v->reg[lfbMode].u), x, y, data, mem_mask); + if (LOG_LFB) vd->device->logerror("VOODOO.%d.LFB:write pipelined mode %X (%d,%d) = %08X & %08X\n", vd->index, LFBMODE_WRITE_FORMAT(vd->reg[lfbMode].u), x, y, data, mem_mask); /* determine the screen Y */ scry = y; - if (FBZMODE_Y_ORIGIN(v->reg[fbzMode].u)) - scry = (v->fbi.yorigin - y) & 0x3ff; + if (FBZMODE_Y_ORIGIN(vd->reg[fbzMode].u)) + scry = (vd->fbi.yorigin - y) & 0x3ff; /* advance pointers to the proper row */ - dest += scry * v->fbi.rowpixels; + dest += scry * vd->fbi.rowpixels; if (depth) - depth += scry * v->fbi.rowpixels; + depth += scry * vd->fbi.rowpixels; /* compute dithering */ - COMPUTE_DITHER_POINTERS(v->reg[fbzMode].u, y); + COMPUTE_DITHER_POINTERS(vd->reg[fbzMode].u, y); /* loop over up to two pixels */ for (pix = 0; mask; pix++) @@ -3300,10 +3239,10 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) /* make sure we care about this pixel */ if (mask & 0x0f) { - stats_block *stats = &v->fbi.lfb_stats; + stats_block *stats = &vd->fbi.lfb_stats; INT64 iterw; - if (LFBMODE_WRITE_W_SELECT(v->reg[lfbMode].u)) { - iterw = (UINT32) v->reg[zaColor].u << 16; + if (LFBMODE_WRITE_W_SELECT(vd->reg[lfbMode].u)) { + iterw = (UINT32) vd->reg[zaColor].u << 16; } else { // The most significant fractional bits of 16.32 W are set to z iterw = (UINT32) sw[pix] << 16; @@ -3311,12 +3250,12 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) INT32 iterz = sw[pix] << 12; /* apply clipping */ - if (FBZMODE_ENABLE_CLIPPING(v->reg[fbzMode].u)) + if (FBZMODE_ENABLE_CLIPPING(vd->reg[fbzMode].u)) { - if (x < ((v->reg[clipLeftRight].u >> 16) & 0x3ff) || - x >= (v->reg[clipLeftRight].u & 0x3ff) || - scry < ((v->reg[clipLowYHighY].u >> 16) & 0x3ff) || - scry >= (v->reg[clipLowYHighY].u & 0x3ff)) + if (x < ((vd->reg[clipLeftRight].u >> 16) & 0x3ff) || + x >= (vd->reg[clipLeftRight].u & 0x3ff) || + scry < ((vd->reg[clipLowYHighY].u >> 16) & 0x3ff) || + scry >= (vd->reg[clipLowYHighY].u & 0x3ff)) { stats->pixels_in++; stats->clip_fail++; @@ -3329,7 +3268,7 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) /* pixel pipeline part 1 handles depth testing and stippling */ - //PIXEL_PIPELINE_BEGIN(v, stats, x, y, v->reg[fbzColorPath].u, v->reg[fbzMode].u, iterz, iterw); + //PIXEL_PIPELINE_BEGIN(v, stats, x, y, vd->reg[fbzColorPath].u, vd->reg[fbzMode].u, iterz, iterw); // Start PIXEL_PIPE_BEGIN copy //#define PIXEL_PIPELINE_BEGIN(VV, STATS, XX, YY, FBZCOLORPATH, FBZMODE, ITERZ, ITERW) INT32 fogdepth, biasdepth; @@ -3341,15 +3280,15 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) /* note that for perf reasons, we assume the caller has done clipping */ /* handle stippling */ - if (FBZMODE_ENABLE_STIPPLE(v->reg[fbzMode].u)) + if (FBZMODE_ENABLE_STIPPLE(vd->reg[fbzMode].u)) { /* rotate mode */ - if (FBZMODE_STIPPLE_PATTERN(v->reg[fbzMode].u) == 0) + if (FBZMODE_STIPPLE_PATTERN(vd->reg[fbzMode].u) == 0) { - v->reg[stipple].u = (v->reg[stipple].u << 1) | (v->reg[stipple].u >> 31); - if ((v->reg[stipple].u & 0x80000000) == 0) + vd->reg[stipple].u = (vd->reg[stipple].u << 1) | (vd->reg[stipple].u >> 31); + if ((vd->reg[stipple].u & 0x80000000) == 0) { - v->stats.total_stippled++; + vd->stats.total_stippled++; goto skipdrawdepth; } } @@ -3358,9 +3297,9 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) else { int stipple_index = ((y & 3) << 3) | (~x & 7); - if (((v->reg[stipple].u >> stipple_index) & 1) == 0) + if (((vd->reg[stipple].u >> stipple_index) & 1) == 0) { - v->stats.total_stippled++; + vd->stats.total_stippled++; goto nextpixel; } } @@ -3372,29 +3311,29 @@ static INT32 lfb_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask) /* Perform depth testing */ - if (!depthTest((UINT16) v->reg[zaColor].u, stats, depth[x], v->reg[fbzMode].u, biasdepth)) + if (!depthTest((UINT16) vd->reg[zaColor].u, stats, depth[x], vd->reg[fbzMode].u, biasdepth)) goto nextpixel; /* use the RGBA we stashed above */ color.set(sa[pix], sr[pix], sg[pix], sb[pix]); /* handle chroma key */ - if (!chromaKeyTest(v, stats, v->reg[fbzMode].u, color)) + if (!chromaKeyTest(vd, stats, vd->reg[fbzMode].u, color)) goto nextpixel; /* handle alpha mask */ - if (!alphaMaskTest(stats, v->reg[fbzMode].u, color.get_a())) + if (!alphaMaskTest(stats, vd->reg[fbzMode].u, color.get_a())) goto nextpixel; /* handle alpha test */ - if (!alphaTest(v, stats, v->reg[alphaMode].u, color.get_a())) + if (!alphaTest(vd, stats, vd->reg[alphaMode].u, color.get_a())) goto nextpixel; /* wait for any outstanding work to finish */ - poly_wait(v->poly, "LFB Write"); + poly_wait(vd->poly, "LFB Write"); /* pixel pipeline part 2 handles color combine, fog, alpha, and final output */ - PIXEL_PIPELINE_END(v, stats, dither, dither4, dither_lookup, x, dest, depth, - v->reg[fbzMode].u, v->reg[fbzColorPath].u, v->reg[alphaMode].u, v->reg[fogMode].u, + PIXEL_PIPELINE_END(vd, stats, dither, dither4, dither_lookup, x, dest, depth, + vd->reg[fbzMode].u, vd->reg[fbzColorPath].u, vd->reg[alphaMode].u, vd->reg[fogMode].u, iterz, iterw, iterargb) {}; nextpixel: /* advance our pointers */ @@ -3414,24 +3353,24 @@ nextpixel: * *************************************/ -static INT32 texture_w(voodoo_state *v, offs_t offset, UINT32 data) +INT32 voodoo_device::texture_w(voodoo_device *vd, offs_t offset, UINT32 data) { int tmunum = (offset >> 19) & 0x03; tmu_state *t; /* statistics */ - v->stats.tex_writes++; + vd->stats.tex_writes++; /* point to the right TMU */ - if (!(v->chipmask & (2 << tmunum))) + if (!(vd->chipmask & (2 << tmunum))) return 0; - t = &v->tmu[tmunum]; + t = &vd->tmu[tmunum]; if (TEXLOD_TDIRECT_WRITE(t->reg[tLOD].u)) fatalerror("Texture direct write!\n"); /* wait for any outstanding work to finish */ - poly_wait(v->poly, "Texture write"); + poly_wait(vd->poly, "Texture write"); /* update texture info if dirty */ if (t->regdirty) @@ -3451,13 +3390,13 @@ static INT32 texture_w(voodoo_state *v, offs_t offset, UINT32 data) UINT8 *dest; /* extract info */ - if (v->type <= TYPE_VOODOO_2) + if (vd->vd_type <= TYPE_VOODOO_2) { lod = (offset >> 15) & 0x0f; tt = (offset >> 7) & 0xff; /* old code has a bit about how this is broken in gauntleg unless we always look at TMU0 */ - if (TEXMODE_SEQ_8_DOWNLD(v->tmu[0].reg/*t->reg*/[textureMode].u)) + if (TEXMODE_SEQ_8_DOWNLD(vd->tmu[0].reg/*t->reg*/[textureMode].u)) ts = (offset << 2) & 0xfc; else ts = (offset << 1) & 0xfc; @@ -3470,13 +3409,13 @@ static INT32 texture_w(voodoo_state *v, offs_t offset, UINT32 data) tbaseaddr = t->lodoffset[lod]; tbaseaddr += tt * ((t->wmask >> lod) + 1) + ts; - if (LOG_TEXTURE_RAM) v->device->logerror("Texture 8-bit w: lod=%d s=%d t=%d data=%08X\n", lod, ts, tt, data); + if (LOG_TEXTURE_RAM) vd->device->logerror("Texture 8-bit w: lod=%d s=%d t=%d data=%08X\n", lod, ts, tt, data); } else { tbaseaddr = t->lodoffset[0] + offset*4; - if (LOG_TEXTURE_RAM) v->device->logerror("Texture 8-bit w: offset=%X data=%08X\n", offset*4, data); + if (LOG_TEXTURE_RAM) vd->device->logerror("Texture 8-bit w: offset=%X data=%08X\n", offset*4, data); } /* write the four bytes in little-endian order */ @@ -3496,7 +3435,7 @@ static INT32 texture_w(voodoo_state *v, offs_t offset, UINT32 data) UINT16 *dest; /* extract info */ - if (v->type <= TYPE_VOODOO_2) + if (vd->vd_type <= TYPE_VOODOO_2) { lod = (offset >> 15) & 0x0f; tt = (offset >> 7) & 0xff; @@ -3510,13 +3449,13 @@ static INT32 texture_w(voodoo_state *v, offs_t offset, UINT32 data) tbaseaddr = t->lodoffset[lod]; tbaseaddr += 2 * (tt * ((t->wmask >> lod) + 1) + ts); - if (LOG_TEXTURE_RAM) v->device->logerror("Texture 16-bit w: lod=%d s=%d t=%d data=%08X\n", lod, ts, tt, data); + if (LOG_TEXTURE_RAM) vd->device->logerror("Texture 16-bit w: lod=%d s=%d t=%d data=%08X\n", lod, ts, tt, data); } else { tbaseaddr = t->lodoffset[0] + offset*4; - if (LOG_TEXTURE_RAM) v->device->logerror("Texture 16-bit w: offset=%X data=%08X\n", offset*4, data); + if (LOG_TEXTURE_RAM) vd->device->logerror("Texture 16-bit w: offset=%X data=%08X\n", offset*4, data); } /* write the two words in little-endian order */ @@ -3538,7 +3477,7 @@ static INT32 texture_w(voodoo_state *v, offs_t offset, UINT32 data) * *************************************/ -static void flush_fifos(voodoo_state *v, attotime current_time) +void voodoo_device::flush_fifos(voodoo_device *vd, attotime current_time) { static UINT8 in_flush; @@ -3547,14 +3486,14 @@ static void flush_fifos(voodoo_state *v, attotime current_time) return; in_flush = TRUE; - if (!v->pci.op_pending) fatalerror("flush_fifos called with no pending operation\n"); + if (!vd->pci.op_pending) fatalerror("flush_fifos called with no pending operation\n"); - if (LOG_FIFO_VERBOSE) v->device->logerror("VOODOO.%d.FIFO:flush_fifos start -- pending=%d.%08X%08X cur=%d.%08X%08X\n", v->index, - v->pci.op_end_time.seconds(), (UINT32)(v->pci.op_end_time.attoseconds() >> 32), (UINT32)v->pci.op_end_time.attoseconds(), + if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:flush_fifos start -- pending=%d.%08X%08X cur=%d.%08X%08X\n", vd->index, + vd->pci.op_end_time.seconds(), (UINT32)(vd->pci.op_end_time.attoseconds() >> 32), (UINT32)vd->pci.op_end_time.attoseconds(), current_time.seconds(), (UINT32)(current_time.attoseconds() >> 32), (UINT32)current_time.attoseconds()); /* loop while we still have cycles to burn */ - while (v->pci.op_end_time <= current_time) + while (vd->pci.op_end_time <= current_time) { INT32 extra_cycles = 0; INT32 cycles; @@ -3567,27 +3506,27 @@ static void flush_fifos(voodoo_state *v, attotime current_time) UINT32 data; /* we might be in CMDFIFO mode */ - if (v->fbi.cmdfifo[0].enable) + if (vd->fbi.cmdfifo[0].enable) { /* if we don't have anything to execute, we're done for now */ - cycles = cmdfifo_execute_if_ready(v, &v->fbi.cmdfifo[0]); + cycles = cmdfifo_execute_if_ready(vd, &vd->fbi.cmdfifo[0]); if (cycles == -1) { - v->pci.op_pending = FALSE; + vd->pci.op_pending = FALSE; in_flush = FALSE; - if (LOG_FIFO_VERBOSE) v->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- CMDFIFO empty\n", v->index); + if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- CMDFIFO empty\n", vd->index); return; } } - else if (v->fbi.cmdfifo[1].enable) + else if (vd->fbi.cmdfifo[1].enable) { /* if we don't have anything to execute, we're done for now */ - cycles = cmdfifo_execute_if_ready(v, &v->fbi.cmdfifo[1]); + cycles = cmdfifo_execute_if_ready(vd, &vd->fbi.cmdfifo[1]); if (cycles == -1) { - v->pci.op_pending = FALSE; + vd->pci.op_pending = FALSE; in_flush = FALSE; - if (LOG_FIFO_VERBOSE) v->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- CMDFIFO empty\n", v->index); + if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- CMDFIFO empty\n", vd->index); return; } } @@ -3596,15 +3535,15 @@ static void flush_fifos(voodoo_state *v, attotime current_time) else { /* choose which FIFO to read from */ - if (!fifo_empty(&v->fbi.fifo)) - fifo = &v->fbi.fifo; - else if (!fifo_empty(&v->pci.fifo)) - fifo = &v->pci.fifo; + if (!fifo_empty(&vd->fbi.fifo)) + fifo = &vd->fbi.fifo; + else if (!fifo_empty(&vd->pci.fifo)) + fifo = &vd->pci.fifo; else { - v->pci.op_pending = FALSE; + vd->pci.op_pending = FALSE; in_flush = FALSE; - if (LOG_FIFO_VERBOSE) v->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- FIFOs empty\n", v->index); + if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- FIFOs empty\n", vd->index); return; } @@ -3614,9 +3553,9 @@ static void flush_fifos(voodoo_state *v, attotime current_time) /* target the appropriate location */ if ((address & (0xc00000/4)) == 0) - cycles = register_w(v, address, data); + cycles = register_w(vd, address, data); else if (address & (0x800000/4)) - cycles = texture_w(v, address, data); + cycles = texture_w(vd, address, data); else { UINT32 mem_mask = 0xffffffff; @@ -3628,7 +3567,7 @@ static void flush_fifos(voodoo_state *v, attotime current_time) mem_mask &= 0xffff0000; address &= 0xffffff; - cycles = lfb_w(v, address, data, mem_mask); + cycles = lfb_w(vd, address, data, mem_mask); } } @@ -3645,15 +3584,15 @@ static void flush_fifos(voodoo_state *v, attotime current_time) cycles += extra_cycles; /* account for those cycles */ - v->pci.op_end_time += attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle); + vd->pci.op_end_time += attotime(0, (attoseconds_t)cycles * vd->attoseconds_per_cycle); - if (LOG_FIFO_VERBOSE) v->device->logerror("VOODOO.%d.FIFO:update -- pending=%d.%08X%08X cur=%d.%08X%08X\n", v->index, - v->pci.op_end_time.seconds(), (UINT32)(v->pci.op_end_time.attoseconds() >> 32), (UINT32)v->pci.op_end_time.attoseconds(), + if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:update -- pending=%d.%08X%08X cur=%d.%08X%08X\n", vd->index, + vd->pci.op_end_time.seconds(), (UINT32)(vd->pci.op_end_time.attoseconds() >> 32), (UINT32)vd->pci.op_end_time.attoseconds(), current_time.seconds(), (UINT32)(current_time.attoseconds() >> 32), (UINT32)current_time.attoseconds()); } - if (LOG_FIFO_VERBOSE) v->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- pending command complete at %d.%08X%08X\n", v->index, - v->pci.op_end_time.seconds(), (UINT32)(v->pci.op_end_time.attoseconds() >> 32), (UINT32)v->pci.op_end_time.attoseconds()); + if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- pending command complete at %d.%08X%08X\n", vd->index, + vd->pci.op_end_time.seconds(), (UINT32)(vd->pci.op_end_time.attoseconds() >> 32), (UINT32)vd->pci.op_end_time.attoseconds()); in_flush = FALSE; } @@ -3669,18 +3608,17 @@ static void flush_fifos(voodoo_state *v, attotime current_time) WRITE32_MEMBER( voodoo_device::voodoo_w ) { - voodoo_state *v = get_safe_token(this); int stall = FALSE; g_profiler.start(PROFILER_USER1); /* should not be getting accesses while stalled */ - if (v->pci.stall_state != NOT_STALLED) + if (pci.stall_state != NOT_STALLED) logerror("voodoo_w while stalled!\n"); /* if we have something pending, flush the FIFOs up to the current time */ - if (v->pci.op_pending) - flush_fifos(v, machine().time()); + if (pci.op_pending) + flush_fifos(this, machine().time()); /* special handling for registers */ if ((offset & 0xc00000/4) == 0) @@ -3688,10 +3626,10 @@ WRITE32_MEMBER( voodoo_device::voodoo_w ) UINT8 access; /* some special stuff for Voodoo 2 */ - if (v->type >= TYPE_VOODOO_2) + if (vd_type >= TYPE_VOODOO_2) { /* we might be in CMDFIFO mode */ - if (FBIINIT7_CMDFIFO_ENABLE(v->reg[fbiInit7].u)) + if (FBIINIT7_CMDFIFO_ENABLE(reg[fbiInit7].u)) { /* if bit 21 is set, we're writing to the FIFO */ if (offset & 0x200000/4) @@ -3699,20 +3637,20 @@ WRITE32_MEMBER( voodoo_device::voodoo_w ) /* check for byte swizzling (bit 18) */ if (offset & 0x40000/4) data = FLIPENDIAN_INT32(data); - cmdfifo_w(v, &v->fbi.cmdfifo[0], offset & 0xffff, data); + cmdfifo_w(this, &fbi.cmdfifo[0], offset & 0xffff, data); g_profiler.stop(); return; } /* we're a register access; but only certain ones are allowed */ - access = v->regaccess[offset & 0xff]; + access = regaccess[offset & 0xff]; if (!(access & REGISTER_WRITETHRU)) { /* track swap buffers regardless */ if ((offset & 0xff) == swapbufferCMD) - v->fbi.swaps_pending++; + fbi.swaps_pending++; - logerror("Ignoring write to %s in CMDFIFO mode\n", v->regnames[offset & 0xff]); + logerror("Ignoring write to %s in CMDFIFO mode\n", regnames[offset & 0xff]); g_profiler.stop(); return; } @@ -3725,7 +3663,7 @@ WRITE32_MEMBER( voodoo_device::voodoo_w ) /* check the access behavior; note that the table works even if the */ /* alternate mapping is used */ - access = v->regaccess[offset & 0xff]; + access = regaccess[offset & 0xff]; /* ignore if writes aren't allowed */ if (!(access & REGISTER_WRITE)) @@ -3740,31 +3678,31 @@ WRITE32_MEMBER( voodoo_device::voodoo_w ) /* track swap buffers */ if ((offset & 0xff) == swapbufferCMD) - v->fbi.swaps_pending++; + fbi.swaps_pending++; } /* if we don't have anything pending, or if FIFOs are disabled, just execute */ - if (!v->pci.op_pending || !INITEN_ENABLE_PCI_FIFO(v->pci.init_enable)) + if (!pci.op_pending || !INITEN_ENABLE_PCI_FIFO(pci.init_enable)) { int cycles; /* target the appropriate location */ if ((offset & (0xc00000/4)) == 0) - cycles = register_w(v, offset, data); + cycles = register_w(this, offset, data); else if (offset & (0x800000/4)) - cycles = texture_w(v, offset, data); + cycles = texture_w(this, offset, data); else - cycles = lfb_w(v, offset, data, mem_mask); + cycles = lfb_w(this, offset, data, mem_mask); /* if we ended up with cycles, mark the operation pending */ if (cycles) { - v->pci.op_pending = TRUE; - v->pci.op_end_time = machine().time() + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle); + pci.op_pending = TRUE; + pci.op_end_time = machine().time() + attotime(0, (attoseconds_t)cycles * attoseconds_per_cycle); - if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", v->index, + if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", index, machine().time().seconds(), (UINT32)(machine().time().attoseconds() >> 32), (UINT32)machine().time().attoseconds(), - v->pci.op_end_time.seconds(), (UINT32)(v->pci.op_end_time.attoseconds() >> 32), (UINT32)v->pci.op_end_time.attoseconds()); + pci.op_end_time.seconds(), (UINT32)(pci.op_end_time.attoseconds() >> 32), (UINT32)pci.op_end_time.attoseconds()); } g_profiler.stop(); return; @@ -3780,56 +3718,56 @@ WRITE32_MEMBER( voodoo_device::voodoo_w ) } /* if there's room in the PCI FIFO, add there */ - if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w adding to PCI FIFO @ %08X=%08X\n", v->index, offset, data); - if (!fifo_full(&v->pci.fifo)) + if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w adding to PCI FIFO @ %08X=%08X\n", this, offset, data); + if (!fifo_full(&pci.fifo)) { - fifo_add(&v->pci.fifo, offset); - fifo_add(&v->pci.fifo, data); + fifo_add(&pci.fifo, offset); + fifo_add(&pci.fifo, data); } else fatalerror("PCI FIFO full\n"); /* handle flushing to the memory FIFO */ - if (FBIINIT0_ENABLE_MEMORY_FIFO(v->reg[fbiInit0].u) && - fifo_space(&v->pci.fifo) <= 2 * FBIINIT4_MEMORY_FIFO_LWM(v->reg[fbiInit4].u)) + if (FBIINIT0_ENABLE_MEMORY_FIFO(reg[fbiInit0].u) && + fifo_space(&pci.fifo) <= 2 * FBIINIT4_MEMORY_FIFO_LWM(reg[fbiInit4].u)) { UINT8 valid[4]; /* determine which types of data can go to the memory FIFO */ valid[0] = TRUE; - valid[1] = FBIINIT0_LFB_TO_MEMORY_FIFO(v->reg[fbiInit0].u); - valid[2] = valid[3] = FBIINIT0_TEXMEM_TO_MEMORY_FIFO(v->reg[fbiInit0].u); + valid[1] = FBIINIT0_LFB_TO_MEMORY_FIFO(reg[fbiInit0].u); + valid[2] = valid[3] = FBIINIT0_TEXMEM_TO_MEMORY_FIFO(reg[fbiInit0].u); /* flush everything we can */ - if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w moving PCI FIFO to memory FIFO\n", v->index); - while (!fifo_empty(&v->pci.fifo) && valid[(fifo_peek(&v->pci.fifo) >> 22) & 3]) + if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w moving PCI FIFO to memory FIFO\n", index); + while (!fifo_empty(&pci.fifo) && valid[(fifo_peek(&pci.fifo) >> 22) & 3]) { - fifo_add(&v->fbi.fifo, fifo_remove(&v->pci.fifo)); - fifo_add(&v->fbi.fifo, fifo_remove(&v->pci.fifo)); + fifo_add(&fbi.fifo, fifo_remove(&pci.fifo)); + fifo_add(&fbi.fifo, fifo_remove(&pci.fifo)); } /* if we're above the HWM as a result, stall */ - if (FBIINIT0_STALL_PCIE_FOR_HWM(v->reg[fbiInit0].u) && - fifo_items(&v->fbi.fifo) >= 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(v->reg[fbiInit0].u)) + if (FBIINIT0_STALL_PCIE_FOR_HWM(reg[fbiInit0].u) && + fifo_items(&fbi.fifo) >= 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(reg[fbiInit0].u)) { - if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit memory FIFO HWM -- stalling\n", v->index); - stall_cpu(v, STALLED_UNTIL_FIFO_LWM, machine().time()); + if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit memory FIFO HWM -- stalling\n", index); + stall_cpu(this, STALLED_UNTIL_FIFO_LWM, machine().time()); } } /* if we're at the LWM for the PCI FIFO, stall */ - if (FBIINIT0_STALL_PCIE_FOR_HWM(v->reg[fbiInit0].u) && - fifo_space(&v->pci.fifo) <= 2 * FBIINIT0_PCI_FIFO_LWM(v->reg[fbiInit0].u)) + if (FBIINIT0_STALL_PCIE_FOR_HWM(reg[fbiInit0].u) && + fifo_space(&pci.fifo) <= 2 * FBIINIT0_PCI_FIFO_LWM(reg[fbiInit0].u)) { - if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit PCI FIFO free LWM -- stalling\n", v->index); - stall_cpu(v, STALLED_UNTIL_FIFO_LWM, machine().time()); + if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit PCI FIFO free LWM -- stalling\n", index); + stall_cpu(this, STALLED_UNTIL_FIFO_LWM, machine().time()); } /* if we weren't ready, and this is a non-FIFO access, stall until the FIFOs are clear */ if (stall) { - if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w wrote non-FIFO register -- stalling until clear\n", v->index); - stall_cpu(v, STALLED_UNTIL_FIFO_EMPTY, machine().time()); + if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w wrote non-FIFO register -- stalling until clear\n", index); + stall_cpu(this, STALLED_UNTIL_FIFO_EMPTY, machine().time()); } g_profiler.stop(); @@ -3843,70 +3781,71 @@ WRITE32_MEMBER( voodoo_device::voodoo_w ) * *************************************/ -static UINT32 register_r(voodoo_state *v, offs_t offset) +static UINT32 register_r(voodoo_device *vd, offs_t offset) { + int regnum = offset & 0xff; UINT32 result; /* statistics */ - v->stats.reg_reads++; + vd->stats.reg_reads++; /* first make sure this register is readable */ - if (!(v->regaccess[regnum] & REGISTER_READ)) + if (!(vd->regaccess[regnum] & REGISTER_READ)) { - v->device->logerror("VOODOO.%d.ERROR:Invalid attempt to read %s\n", v->index, regnum < 225 ? v->regnames[regnum] : "unknown register"); + vd->device->logerror("VOODOO.%d.ERROR:Invalid attempt to read %s\n", vd->index, regnum < 225 ? vd->regnames[regnum] : "unknown register"); return 0xffffffff; } /* default result is the FBI register value */ - result = v->reg[regnum].u; + result = vd->reg[regnum].u; /* some registers are dynamic; compute them */ switch (regnum) { - case status: + case vdstatus: /* start with a blank slate */ result = 0; /* bits 5:0 are the PCI FIFO free space */ - if (fifo_empty(&v->pci.fifo)) + if (fifo_empty(&vd->pci.fifo)) result |= 0x3f << 0; else { - int temp = fifo_space(&v->pci.fifo)/2; + int temp = fifo_space(&vd->pci.fifo)/2; if (temp > 0x3f) temp = 0x3f; result |= temp << 0; } /* bit 6 is the vertical retrace */ - result |= v->fbi.vblank << 6; + result |= vd->fbi.vblank << 6; /* bit 7 is FBI graphics engine busy */ - if (v->pci.op_pending) + if (vd->pci.op_pending) result |= 1 << 7; /* bit 8 is TREX busy */ - if (v->pci.op_pending) + if (vd->pci.op_pending) result |= 1 << 8; /* bit 9 is overall busy */ - if (v->pci.op_pending) + if (vd->pci.op_pending) result |= 1 << 9; /* Banshee is different starting here */ - if (v->type < TYPE_VOODOO_BANSHEE) + if (vd->vd_type < TYPE_VOODOO_BANSHEE) { /* bits 11:10 specifies which buffer is visible */ - result |= v->fbi.frontbuf << 10; + result |= vd->fbi.frontbuf << 10; /* bits 27:12 indicate memory FIFO freespace */ - if (!FBIINIT0_ENABLE_MEMORY_FIFO(v->reg[fbiInit0].u) || fifo_empty(&v->fbi.fifo)) + if (!FBIINIT0_ENABLE_MEMORY_FIFO(vd->reg[fbiInit0].u) || fifo_empty(&vd->fbi.fifo)) result |= 0xffff << 12; else { - int temp = fifo_space(&v->fbi.fifo)/2; + int temp = fifo_space(&vd->fbi.fifo)/2; if (temp > 0xffff) temp = 0xffff; result |= temp << 12; @@ -3917,38 +3856,38 @@ static UINT32 register_r(voodoo_state *v, offs_t offset) /* bit 10 is 2D busy */ /* bit 11 is cmd FIFO 0 busy */ - if (v->fbi.cmdfifo[0].enable && v->fbi.cmdfifo[0].depth > 0) + if (vd->fbi.cmdfifo[0].enable && vd->fbi.cmdfifo[0].depth > 0) result |= 1 << 11; /* bit 12 is cmd FIFO 1 busy */ - if (v->fbi.cmdfifo[1].enable && v->fbi.cmdfifo[1].depth > 0) + if (vd->fbi.cmdfifo[1].enable && vd->fbi.cmdfifo[1].depth > 0) result |= 1 << 12; } /* bits 30:28 are the number of pending swaps */ - if (v->fbi.swaps_pending > 7) + if (vd->fbi.swaps_pending > 7) result |= 7 << 28; else - result |= v->fbi.swaps_pending << 28; + result |= vd->fbi.swaps_pending << 28; /* bit 31 is not used */ /* eat some cycles since people like polling here */ - if (EAT_CYCLES) v->cpu->execute().eat_cycles(1000); + if (EAT_CYCLES) vd->cpu->execute().eat_cycles(1000); break; /* bit 2 of the initEnable register maps this to dacRead */ case fbiInit2: - if (INITEN_REMAP_INIT_TO_DAC(v->pci.init_enable)) - result = v->dac.read_result; + if (INITEN_REMAP_INIT_TO_DAC(vd->pci.init_enable)) + result = vd->dac.read_result; break; /* return the current scanline for now */ case vRetrace: /* eat some cycles since people like polling here */ - if (EAT_CYCLES) v->cpu->execute().eat_cycles(10); - result = v->screen->vpos(); + if (EAT_CYCLES) vd->cpu->execute().eat_cycles(10); + result = vd->screen->vpos(); break; /* reserved area in the TMU read by the Vegas startup sequence */ @@ -3959,26 +3898,26 @@ static UINT32 register_r(voodoo_state *v, offs_t offset) /* cmdFifo -- Voodoo2 only */ case cmdFifoRdPtr: - result = v->fbi.cmdfifo[0].rdptr; + result = vd->fbi.cmdfifo[0].rdptr; /* eat some cycles since people like polling here */ - if (EAT_CYCLES) v->cpu->execute().eat_cycles(1000); + if (EAT_CYCLES) vd->cpu->execute().eat_cycles(1000); break; case cmdFifoAMin: - result = v->fbi.cmdfifo[0].amin; + result = vd->fbi.cmdfifo[0].amin; break; case cmdFifoAMax: - result = v->fbi.cmdfifo[0].amax; + result = vd->fbi.cmdfifo[0].amax; break; case cmdFifoDepth: - result = v->fbi.cmdfifo[0].depth; + result = vd->fbi.cmdfifo[0].depth; break; case cmdFifoHoles: - result = v->fbi.cmdfifo[0].holes; + result = vd->fbi.cmdfifo[0].holes; break; /* all counters are 24-bit only */ @@ -3987,9 +3926,9 @@ static UINT32 register_r(voodoo_state *v, offs_t offset) case fbiZfuncFail: case fbiAfuncFail: case fbiPixelsOut: - update_statistics(v, TRUE); + update_statistics(vd, TRUE); case fbiTrianglesOut: - result = v->reg[regnum].u & 0xffffff; + result = vd->reg[regnum].u & 0xffffff; break; } @@ -3998,19 +3937,19 @@ static UINT32 register_r(voodoo_state *v, offs_t offset) int logit = TRUE; /* don't log multiple identical status reads from the same address */ - if (regnum == status) + if (regnum == vdstatus) { - offs_t pc = v->cpu->safe_pc(); - if (pc == v->last_status_pc && result == v->last_status_value) + offs_t pc = vd->cpu->safe_pc(); + if (pc == vd->last_status_pc && result == vd->last_status_value) logit = FALSE; - v->last_status_pc = pc; - v->last_status_value = result; + vd->last_status_pc = pc; + vd->last_status_value = result; } if (regnum == cmdFifoRdPtr) logit = FALSE; if (logit) - v->device->logerror("VOODOO.%d.REG:%s read = %08X\n", v->index, v->regnames[regnum], result); + vd->device->logerror("VOODOO.%d.REG:%s read = %08X\n", vd->index, vd->regnames[regnum], result); } return result; @@ -4024,7 +3963,7 @@ static UINT32 register_r(voodoo_state *v, offs_t offset) * *************************************/ -static UINT32 lfb_r(voodoo_state *v, offs_t offset, bool lfb_3d) +static UINT32 lfb_r(voodoo_device *vd, offs_t offset, bool lfb_3d) { UINT16 *buffer; UINT32 bufmax; @@ -4033,34 +3972,34 @@ static UINT32 lfb_r(voodoo_state *v, offs_t offset, bool lfb_3d) int x, y, scry, destbuf; /* statistics */ - v->stats.lfb_reads++; + vd->stats.lfb_reads++; /* compute X,Y */ offset <<= 1; - x = offset & ((1 << v->fbi.lfb_stride) - 1); - y = (offset >> v->fbi.lfb_stride); + x = offset & ((1 << vd->fbi.lfb_stride) - 1); + y = (offset >> vd->fbi.lfb_stride); /* select the target buffer */ if (lfb_3d) { y &= 0x3ff; - destbuf = (v->type >= TYPE_VOODOO_BANSHEE) ? 1 : LFBMODE_READ_BUFFER_SELECT(v->reg[lfbMode].u); + destbuf = (vd->vd_type >= TYPE_VOODOO_BANSHEE) ? 1 : LFBMODE_READ_BUFFER_SELECT(vd->reg[lfbMode].u); switch (destbuf) { case 0: /* front buffer */ - buffer = (UINT16 *)(v->fbi.ram + v->fbi.rgboffs[v->fbi.frontbuf]); - bufmax = (v->fbi.mask + 1 - v->fbi.rgboffs[v->fbi.frontbuf]) / 2; + buffer = (UINT16 *)(vd->fbi.ram + vd->fbi.rgboffs[vd->fbi.frontbuf]); + bufmax = (vd->fbi.mask + 1 - vd->fbi.rgboffs[vd->fbi.frontbuf]) / 2; break; case 1: /* back buffer */ - buffer = (UINT16 *)(v->fbi.ram + v->fbi.rgboffs[v->fbi.backbuf]); - bufmax = (v->fbi.mask + 1 - v->fbi.rgboffs[v->fbi.backbuf]) / 2; + buffer = (UINT16 *)(vd->fbi.ram + vd->fbi.rgboffs[vd->fbi.backbuf]); + bufmax = (vd->fbi.mask + 1 - vd->fbi.rgboffs[vd->fbi.backbuf]) / 2; break; case 2: /* aux buffer */ - if (v->fbi.auxoffs == ~0) + if (vd->fbi.auxoffs == ~0) return 0xffffffff; - buffer = (UINT16 *)(v->fbi.ram + v->fbi.auxoffs); - bufmax = (v->fbi.mask + 1 - v->fbi.auxoffs) / 2; + buffer = (UINT16 *)(vd->fbi.ram + vd->fbi.auxoffs); + bufmax = (vd->fbi.mask + 1 - vd->fbi.auxoffs) / 2; break; default: /* reserved */ @@ -4069,37 +4008,37 @@ static UINT32 lfb_r(voodoo_state *v, offs_t offset, bool lfb_3d) /* determine the screen Y */ scry = y; - if (LFBMODE_Y_ORIGIN(v->reg[lfbMode].u)) - scry = (v->fbi.yorigin - y) & 0x3ff; + if (LFBMODE_Y_ORIGIN(vd->reg[lfbMode].u)) + scry = (vd->fbi.yorigin - y) & 0x3ff; } else { // Direct lfb access - buffer = (UINT16 *)(v->fbi.ram + v->fbi.lfb_base*4); - bufmax = (v->fbi.mask + 1 - v->fbi.lfb_base*4) / 2; + buffer = (UINT16 *)(vd->fbi.ram + vd->fbi.lfb_base*4); + bufmax = (vd->fbi.mask + 1 - vd->fbi.lfb_base*4) / 2; scry = y; } /* advance pointers to the proper row */ - bufoffs = scry * v->fbi.rowpixels + x; + bufoffs = scry * vd->fbi.rowpixels + x; if (bufoffs >= bufmax) { - v->device->logerror("LFB_R: Buffer offset out of bounds x=%i y=%i lfb_3d=%i offset=%08X bufoffs=%08X\n", x, y, lfb_3d, offset, (UINT32) bufoffs); + vd->device->logerror("LFB_R: Buffer offset out of bounds x=%i y=%i lfb_3d=%i offset=%08X bufoffs=%08X\n", x, y, lfb_3d, offset, (UINT32) bufoffs); return 0xffffffff; } /* wait for any outstanding work to finish */ - poly_wait(v->poly, "LFB read"); + poly_wait(vd->poly, "LFB read"); /* compute the data */ data = buffer[bufoffs + 0] | (buffer[bufoffs + 1] << 16); /* word swapping */ - if (LFBMODE_WORD_SWAP_READS(v->reg[lfbMode].u)) + if (LFBMODE_WORD_SWAP_READS(vd->reg[lfbMode].u)) data = (data << 16) | (data >> 16); /* byte swizzling */ - if (LFBMODE_BYTE_SWIZZLE_READS(v->reg[lfbMode].u)) + if (LFBMODE_BYTE_SWIZZLE_READS(vd->reg[lfbMode].u)) data = FLIPENDIAN_INT32(data); - if (LOG_LFB) v->device->logerror("VOODOO.%d.LFB:read (%d,%d) = %08X\n", v->index, x, y, data); + if (LOG_LFB) vd->device->logerror("VOODOO.%d.LFB:read (%d,%d) = %08X\n", vd->index, x, y, data); return data; } @@ -4114,17 +4053,16 @@ static UINT32 lfb_r(voodoo_state *v, offs_t offset, bool lfb_3d) READ32_MEMBER( voodoo_device::voodoo_r ) { - voodoo_state *v = get_safe_token(this); /* if we have something pending, flush the FIFOs up to the current time */ - if (v->pci.op_pending) - flush_fifos(v, machine().time()); + if (pci.op_pending) + flush_fifos(this, machine().time()); /* target the appropriate location */ if (!(offset & (0xc00000/4))) - return register_r(v, offset); + return register_r(this, offset); else if (!(offset & (0x800000/4))) - return lfb_r(v, offset, true); + return lfb_r(this, offset, true); return 0xffffffff; } @@ -4140,7 +4078,6 @@ READ32_MEMBER( voodoo_device::voodoo_r ) READ32_MEMBER( voodoo_banshee_device::banshee_agp_r ) { - voodoo_state *v = get_safe_token(this); UINT32 result; offset &= 0x1ff/4; @@ -4149,64 +4086,63 @@ READ32_MEMBER( voodoo_banshee_device::banshee_agp_r ) switch (offset) { case cmdRdPtrL0: - result = v->fbi.cmdfifo[0].rdptr; + result = fbi.cmdfifo[0].rdptr; break; case cmdAMin0: - result = v->fbi.cmdfifo[0].amin; + result = fbi.cmdfifo[0].amin; break; case cmdAMax0: - result = v->fbi.cmdfifo[0].amax; + result = fbi.cmdfifo[0].amax; break; case cmdFifoDepth0: - result = v->fbi.cmdfifo[0].depth; + result = fbi.cmdfifo[0].depth; break; case cmdHoleCnt0: - result = v->fbi.cmdfifo[0].holes; + result = fbi.cmdfifo[0].holes; break; case cmdRdPtrL1: - result = v->fbi.cmdfifo[1].rdptr; + result = fbi.cmdfifo[1].rdptr; break; case cmdAMin1: - result = v->fbi.cmdfifo[1].amin; + result = fbi.cmdfifo[1].amin; break; case cmdAMax1: - result = v->fbi.cmdfifo[1].amax; + result = fbi.cmdfifo[1].amax; break; case cmdFifoDepth1: - result = v->fbi.cmdfifo[1].depth; + result = fbi.cmdfifo[1].depth; break; case cmdHoleCnt1: - result = v->fbi.cmdfifo[1].holes; + result = fbi.cmdfifo[1].holes; break; default: - result = v->banshee.agp[offset]; + result = banshee.agp[offset]; break; } if (LOG_REGISTERS) - logerror("%s:banshee_r(AGP:%s)\n", v->device->machine().describe_context(), banshee_agp_reg_name[offset]); + logerror("%s:banshee_r(AGP:%s)\n", device->machine().describe_context(), banshee_agp_reg_name[offset]); return result; } READ32_MEMBER( voodoo_banshee_device::banshee_r ) { - voodoo_state *v = get_safe_token(this); UINT32 result = 0xffffffff; /* if we have something pending, flush the FIFOs up to the current time */ - if (v->pci.op_pending) - flush_fifos(v, machine().time()); + if (pci.op_pending) + flush_fifos(this, machine().time()); if (offset < 0x80000/4) result = banshee_io_r(space, offset, mem_mask); @@ -4215,7 +4151,7 @@ READ32_MEMBER( voodoo_banshee_device::banshee_r ) else if (offset < 0x200000/4) logerror("%s:banshee_r(2D:%X)\n", machine().describe_context(), (offset*4) & 0xfffff); else if (offset < 0x600000/4) - result = register_r(v, offset & 0x1fffff/4); + result = register_r(this, offset & 0x1fffff/4); else if (offset < 0x800000/4) logerror("%s:banshee_r(TEX0:%X)\n", machine().describe_context(), (offset*4) & 0x1fffff); else if (offset < 0xa00000/4) @@ -4226,7 +4162,7 @@ READ32_MEMBER( voodoo_banshee_device::banshee_r ) logerror("%s:banshee_r(YUV:%X)\n", machine().describe_context(), (offset*4) & 0x3fffff); else if (offset < 0x2000000/4) { - result = lfb_r(v, offset & 0xffffff/4, true); + result = lfb_r(this, offset & 0xffffff/4, true); } else { logerror("%s:banshee_r(%X) Access out of bounds\n", machine().describe_context(), offset*4); } @@ -4236,27 +4172,26 @@ READ32_MEMBER( voodoo_banshee_device::banshee_r ) READ32_MEMBER( voodoo_banshee_device::banshee_fb_r ) { - voodoo_state *v = get_safe_token(this); UINT32 result = 0xffffffff; /* if we have something pending, flush the FIFOs up to the current time */ - if (v->pci.op_pending) - flush_fifos(v, machine().time()); + if (pci.op_pending) + flush_fifos(this, machine().time()); - if (offset < v->fbi.lfb_base) + if (offset < fbi.lfb_base) { #if LOG_LFB logerror("%s:banshee_fb_r(%X)\n", machine().describe_context(), offset*4); #endif - if (offset*4 <= v->fbi.mask) - result = ((UINT32 *)v->fbi.ram)[offset]; + if (offset*4 <= fbi.mask) + result = ((UINT32 *)fbi.ram)[offset]; else logerror("%s:banshee_fb_r(%X) Access out of bounds\n", machine().describe_context(), offset*4); } else { if (LOG_LFB) - logerror("%s:banshee_fb_r(%X) to lfb_r: %08X lfb_base=%08X\n", machine().describe_context(), offset*4, offset - v->fbi.lfb_base, v->fbi.lfb_base); - result = lfb_r(v, offset - v->fbi.lfb_base, false); + logerror("%s:banshee_fb_r(%X) to lfb_r: %08X lfb_base=%08X\n", machine().describe_context(), offset*4, offset - fbi.lfb_base, fbi.lfb_base); + result = lfb_r(this, offset - fbi.lfb_base, false); } return result; } @@ -4264,7 +4199,6 @@ READ32_MEMBER( voodoo_banshee_device::banshee_fb_r ) READ8_MEMBER( voodoo_banshee_device::banshee_vga_r ) { - voodoo_state *v = get_safe_token(this); UINT8 result = 0xff; offset &= 0x1f; @@ -4274,10 +4208,10 @@ READ8_MEMBER( voodoo_banshee_device::banshee_vga_r ) { /* attribute access */ case 0x3c0: - if (v->banshee.vga[0x3c1 & 0x1f] < ARRAY_LENGTH(v->banshee.att)) - result = v->banshee.att[v->banshee.vga[0x3c1 & 0x1f]]; + if (banshee.vga[0x3c1 & 0x1f] < ARRAY_LENGTH(banshee.att)) + result = banshee.att[banshee.vga[0x3c1 & 0x1f]]; if (LOG_REGISTERS) - logerror("%s:banshee_att_r(%X)\n", machine().describe_context(), v->banshee.vga[0x3c1 & 0x1f]); + logerror("%s:banshee_att_r(%X)\n", machine().describe_context(), banshee.vga[0x3c1 & 0x1f]); break; /* Input status 0 */ @@ -4295,41 +4229,41 @@ READ8_MEMBER( voodoo_banshee_device::banshee_vga_r ) /* Sequencer access */ case 0x3c5: - if (v->banshee.vga[0x3c4 & 0x1f] < ARRAY_LENGTH(v->banshee.seq)) - result = v->banshee.seq[v->banshee.vga[0x3c4 & 0x1f]]; + if (banshee.vga[0x3c4 & 0x1f] < ARRAY_LENGTH(banshee.seq)) + result = banshee.seq[banshee.vga[0x3c4 & 0x1f]]; if (LOG_REGISTERS) - logerror("%s:banshee_seq_r(%X)\n", machine().describe_context(), v->banshee.vga[0x3c4 & 0x1f]); + logerror("%s:banshee_seq_r(%X)\n", machine().describe_context(), banshee.vga[0x3c4 & 0x1f]); break; /* Feature control */ case 0x3ca: - result = v->banshee.vga[0x3da & 0x1f]; - v->banshee.attff = 0; + result = banshee.vga[0x3da & 0x1f]; + banshee.attff = 0; if (LOG_REGISTERS) logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x300+offset); break; /* Miscellaneous output */ case 0x3cc: - result = v->banshee.vga[0x3c2 & 0x1f]; + result = banshee.vga[0x3c2 & 0x1f]; if (LOG_REGISTERS) logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x300+offset); break; /* Graphics controller access */ case 0x3cf: - if (v->banshee.vga[0x3ce & 0x1f] < ARRAY_LENGTH(v->banshee.gc)) - result = v->banshee.gc[v->banshee.vga[0x3ce & 0x1f]]; + if (banshee.vga[0x3ce & 0x1f] < ARRAY_LENGTH(banshee.gc)) + result = banshee.gc[banshee.vga[0x3ce & 0x1f]]; if (LOG_REGISTERS) - logerror("%s:banshee_gc_r(%X)\n", machine().describe_context(), v->banshee.vga[0x3ce & 0x1f]); + logerror("%s:banshee_gc_r(%X)\n", machine().describe_context(), banshee.vga[0x3ce & 0x1f]); break; /* CRTC access */ case 0x3d5: - if (v->banshee.vga[0x3d4 & 0x1f] < ARRAY_LENGTH(v->banshee.crtc)) - result = v->banshee.crtc[v->banshee.vga[0x3d4 & 0x1f]]; + if (banshee.vga[0x3d4 & 0x1f] < ARRAY_LENGTH(banshee.crtc)) + result = banshee.crtc[banshee.vga[0x3d4 & 0x1f]]; if (LOG_REGISTERS) - logerror("%s:banshee_crtc_r(%X)\n", machine().describe_context(), v->banshee.vga[0x3d4 & 0x1f]); + logerror("%s:banshee_crtc_r(%X)\n", machine().describe_context(), banshee.vga[0x3d4 & 0x1f]); break; /* Input status 1 */ @@ -4349,7 +4283,7 @@ READ8_MEMBER( voodoo_banshee_device::banshee_vga_r ) break; default: - result = v->banshee.vga[offset]; + result = banshee.vga[offset]; if (LOG_REGISTERS) logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x300+offset); break; @@ -4360,7 +4294,6 @@ READ8_MEMBER( voodoo_banshee_device::banshee_vga_r ) READ32_MEMBER( voodoo_banshee_device::banshee_io_r ) { - voodoo_state *v = get_safe_token(this); UINT32 result; offset &= 0xff/4; @@ -4369,13 +4302,13 @@ READ32_MEMBER( voodoo_banshee_device::banshee_io_r ) switch (offset) { case io_status: - result = register_r(v, 0); + result = register_r(this, 0); break; case io_dacData: - result = v->fbi.clut[v->banshee.io[io_dacAddr] & 0x1ff] = v->banshee.io[offset]; + result = fbi.clut[banshee.io[io_dacAddr] & 0x1ff] = banshee.io[offset]; if (LOG_REGISTERS) - logerror("%s:banshee_dac_r(%X)\n", machine().describe_context(), v->banshee.io[io_dacAddr] & 0x1ff); + logerror("%s:banshee_dac_r(%X)\n", machine().describe_context(), banshee.io[io_dacAddr] & 0x1ff); break; case io_vgab0: case io_vgab4: case io_vgab8: case io_vgabc: @@ -4393,7 +4326,7 @@ READ32_MEMBER( voodoo_banshee_device::banshee_io_r ) break; default: - result = v->banshee.io[offset]; + result = banshee.io[offset]; if (LOG_REGISTERS) logerror("%s:banshee_io_r(%s)\n", machine().describe_context(), banshee_io_reg_name[offset]); break; @@ -4409,9 +4342,9 @@ READ32_MEMBER( voodoo_banshee_device::banshee_rom_r ) return 0xffffffff; } -static void blit_2d(voodoo_state *v, UINT32 data) +static void blit_2d(voodoo_device *vd, UINT32 data) { - switch (v->banshee.blt_cmd) + switch (vd->banshee.blt_cmd) { case 0: // NOP - wait for idle { @@ -4434,46 +4367,46 @@ static void blit_2d(voodoo_state *v, UINT32 data) case 3: // Host-to-screen blit { - UINT32 addr = v->banshee.blt_dst_base; + UINT32 addr = vd->banshee.blt_dst_base; - addr += (v->banshee.blt_dst_y * v->banshee.blt_dst_stride) + (v->banshee.blt_dst_x * v->banshee.blt_dst_bpp); + addr += (vd->banshee.blt_dst_y * vd->banshee.blt_dst_stride) + (vd->banshee.blt_dst_x * vd->banshee.blt_dst_bpp); #if LOG_BANSHEE_2D - logerror(" blit_2d:host_to_screen: %08x -> %08x, %d, %d\n", data, addr, v->banshee.blt_dst_x, v->banshee.blt_dst_y); + logerror(" blit_2d:host_to_screen: %08x -> %08x, %d, %d\n", data, addr, vd->banshee.blt_dst_x, vd->banshee.blt_dst_y); #endif - switch (v->banshee.blt_dst_bpp) + switch (vd->banshee.blt_dst_bpp) { case 1: - v->fbi.ram[addr+0] = data & 0xff; - v->fbi.ram[addr+1] = (data >> 8) & 0xff; - v->fbi.ram[addr+2] = (data >> 16) & 0xff; - v->fbi.ram[addr+3] = (data >> 24) & 0xff; - v->banshee.blt_dst_x += 4; + vd->fbi.ram[addr+0] = data & 0xff; + vd->fbi.ram[addr+1] = (data >> 8) & 0xff; + vd->fbi.ram[addr+2] = (data >> 16) & 0xff; + vd->fbi.ram[addr+3] = (data >> 24) & 0xff; + vd->banshee.blt_dst_x += 4; break; case 2: - v->fbi.ram[addr+1] = data & 0xff; - v->fbi.ram[addr+0] = (data >> 8) & 0xff; - v->fbi.ram[addr+3] = (data >> 16) & 0xff; - v->fbi.ram[addr+2] = (data >> 24) & 0xff; - v->banshee.blt_dst_x += 2; + vd->fbi.ram[addr+1] = data & 0xff; + vd->fbi.ram[addr+0] = (data >> 8) & 0xff; + vd->fbi.ram[addr+3] = (data >> 16) & 0xff; + vd->fbi.ram[addr+2] = (data >> 24) & 0xff; + vd->banshee.blt_dst_x += 2; break; case 3: - v->banshee.blt_dst_x += 1; + vd->banshee.blt_dst_x += 1; break; case 4: - v->fbi.ram[addr+3] = data & 0xff; - v->fbi.ram[addr+2] = (data >> 8) & 0xff; - v->fbi.ram[addr+1] = (data >> 16) & 0xff; - v->fbi.ram[addr+0] = (data >> 24) & 0xff; - v->banshee.blt_dst_x += 1; + vd->fbi.ram[addr+3] = data & 0xff; + vd->fbi.ram[addr+2] = (data >> 8) & 0xff; + vd->fbi.ram[addr+1] = (data >> 16) & 0xff; + vd->fbi.ram[addr+0] = (data >> 24) & 0xff; + vd->banshee.blt_dst_x += 1; break; } - if (v->banshee.blt_dst_x >= v->banshee.blt_dst_width) + if (vd->banshee.blt_dst_x >= vd->banshee.blt_dst_width) { - v->banshee.blt_dst_x = 0; - v->banshee.blt_dst_y++; + vd->banshee.blt_dst_x = 0; + vd->banshee.blt_dst_y++; } break; } @@ -4500,12 +4433,12 @@ static void blit_2d(voodoo_state *v, UINT32 data) default: { - fatalerror("blit_2d: unknown command %d\n", v->banshee.blt_cmd); + fatalerror("blit_2d: unknown command %d\n", vd->banshee.blt_cmd); } } } -static INT32 banshee_2d_w(voodoo_state *v, offs_t offset, UINT32 data) +INT32 voodoo_device::banshee_2d_w(voodoo_device *vd, offs_t offset, UINT32 data) { switch (offset) { @@ -4514,152 +4447,152 @@ static INT32 banshee_2d_w(voodoo_state *v, offs_t offset, UINT32 data) logerror(" 2D:command: cmd %d, ROP0 %02X\n", data & 0xf, data >> 24); #endif - v->banshee.blt_src_x = v->banshee.blt_regs[banshee2D_srcXY] & 0xfff; - v->banshee.blt_src_y = (v->banshee.blt_regs[banshee2D_srcXY] >> 16) & 0xfff; - v->banshee.blt_src_base = v->banshee.blt_regs[banshee2D_srcBaseAddr] & 0xffffff; - v->banshee.blt_src_stride = v->banshee.blt_regs[banshee2D_srcFormat] & 0x3fff; - v->banshee.blt_src_width = v->banshee.blt_regs[banshee2D_srcSize] & 0xfff; - v->banshee.blt_src_height = (v->banshee.blt_regs[banshee2D_srcSize] >> 16) & 0xfff; + vd->banshee.blt_src_x = vd->banshee.blt_regs[banshee2D_srcXY] & 0xfff; + vd->banshee.blt_src_y = (vd->banshee.blt_regs[banshee2D_srcXY] >> 16) & 0xfff; + vd->banshee.blt_src_base = vd->banshee.blt_regs[banshee2D_srcBaseAddr] & 0xffffff; + vd->banshee.blt_src_stride = vd->banshee.blt_regs[banshee2D_srcFormat] & 0x3fff; + vd->banshee.blt_src_width = vd->banshee.blt_regs[banshee2D_srcSize] & 0xfff; + vd->banshee.blt_src_height = (vd->banshee.blt_regs[banshee2D_srcSize] >> 16) & 0xfff; - switch ((v->banshee.blt_regs[banshee2D_srcFormat] >> 16) & 0xf) + switch ((vd->banshee.blt_regs[banshee2D_srcFormat] >> 16) & 0xf) { - case 1: v->banshee.blt_src_bpp = 1; break; - case 3: v->banshee.blt_src_bpp = 2; break; - case 4: v->banshee.blt_src_bpp = 3; break; - case 5: v->banshee.blt_src_bpp = 4; break; - case 8: v->banshee.blt_src_bpp = 2; break; - case 9: v->banshee.blt_src_bpp = 2; break; - default: v->banshee.blt_src_bpp = 1; break; + case 1: vd->banshee.blt_src_bpp = 1; break; + case 3: vd->banshee.blt_src_bpp = 2; break; + case 4: vd->banshee.blt_src_bpp = 3; break; + case 5: vd->banshee.blt_src_bpp = 4; break; + case 8: vd->banshee.blt_src_bpp = 2; break; + case 9: vd->banshee.blt_src_bpp = 2; break; + default: vd->banshee.blt_src_bpp = 1; break; } - v->banshee.blt_dst_x = v->banshee.blt_regs[banshee2D_dstXY] & 0xfff; - v->banshee.blt_dst_y = (v->banshee.blt_regs[banshee2D_dstXY] >> 16) & 0xfff; - v->banshee.blt_dst_base = v->banshee.blt_regs[banshee2D_dstBaseAddr] & 0xffffff; - v->banshee.blt_dst_stride = v->banshee.blt_regs[banshee2D_dstFormat] & 0x3fff; - v->banshee.blt_dst_width = v->banshee.blt_regs[banshee2D_dstSize] & 0xfff; - v->banshee.blt_dst_height = (v->banshee.blt_regs[banshee2D_dstSize] >> 16) & 0xfff; + vd->banshee.blt_dst_x = vd->banshee.blt_regs[banshee2D_dstXY] & 0xfff; + vd->banshee.blt_dst_y = (vd->banshee.blt_regs[banshee2D_dstXY] >> 16) & 0xfff; + vd->banshee.blt_dst_base = vd->banshee.blt_regs[banshee2D_dstBaseAddr] & 0xffffff; + vd->banshee.blt_dst_stride = vd->banshee.blt_regs[banshee2D_dstFormat] & 0x3fff; + vd->banshee.blt_dst_width = vd->banshee.blt_regs[banshee2D_dstSize] & 0xfff; + vd->banshee.blt_dst_height = (vd->banshee.blt_regs[banshee2D_dstSize] >> 16) & 0xfff; - switch ((v->banshee.blt_regs[banshee2D_dstFormat] >> 16) & 0x7) + switch ((vd->banshee.blt_regs[banshee2D_dstFormat] >> 16) & 0x7) { - case 1: v->banshee.blt_dst_bpp = 1; break; - case 3: v->banshee.blt_dst_bpp = 2; break; - case 4: v->banshee.blt_dst_bpp = 3; break; - case 5: v->banshee.blt_dst_bpp = 4; break; - default: v->banshee.blt_dst_bpp = 1; break; + case 1: vd->banshee.blt_dst_bpp = 1; break; + case 3: vd->banshee.blt_dst_bpp = 2; break; + case 4: vd->banshee.blt_dst_bpp = 3; break; + case 5: vd->banshee.blt_dst_bpp = 4; break; + default: vd->banshee.blt_dst_bpp = 1; break; } - v->banshee.blt_cmd = data & 0xf; + vd->banshee.blt_cmd = data & 0xf; break; case banshee2D_colorBack: #if LOG_BANSHEE_2D logerror(" 2D:colorBack: %08X\n", data); #endif - v->banshee.blt_regs[banshee2D_colorBack] = data; + vd->banshee.blt_regs[banshee2D_colorBack] = data; break; case banshee2D_colorFore: #if LOG_BANSHEE_2D logerror(" 2D:colorFore: %08X\n", data); #endif - v->banshee.blt_regs[banshee2D_colorFore] = data; + vd->banshee.blt_regs[banshee2D_colorFore] = data; break; case banshee2D_srcBaseAddr: #if LOG_BANSHEE_2D logerror(" 2D:srcBaseAddr: %08X, %s\n", data & 0xffffff, data & 0x80000000 ? "tiled" : "non-tiled"); #endif - v->banshee.blt_regs[banshee2D_srcBaseAddr] = data; + vd->banshee.blt_regs[banshee2D_srcBaseAddr] = data; break; case banshee2D_dstBaseAddr: #if LOG_BANSHEE_2D logerror(" 2D:dstBaseAddr: %08X, %s\n", data & 0xffffff, data & 0x80000000 ? "tiled" : "non-tiled"); #endif - v->banshee.blt_regs[banshee2D_dstBaseAddr] = data; + vd->banshee.blt_regs[banshee2D_dstBaseAddr] = data; break; case banshee2D_srcSize: #if LOG_BANSHEE_2D logerror(" 2D:srcSize: %d, %d\n", data & 0xfff, (data >> 16) & 0xfff); #endif - v->banshee.blt_regs[banshee2D_srcSize] = data; + vd->banshee.blt_regs[banshee2D_srcSize] = data; break; case banshee2D_dstSize: #if LOG_BANSHEE_2D logerror(" 2D:dstSize: %d, %d\n", data & 0xfff, (data >> 16) & 0xfff); #endif - v->banshee.blt_regs[banshee2D_dstSize] = data; + vd->banshee.blt_regs[banshee2D_dstSize] = data; break; case banshee2D_srcXY: #if LOG_BANSHEE_2D logerror(" 2D:srcXY: %d, %d\n", data & 0xfff, (data >> 16) & 0xfff); #endif - v->banshee.blt_regs[banshee2D_srcXY] = data; + vd->banshee.blt_regs[banshee2D_srcXY] = data; break; case banshee2D_dstXY: #if LOG_BANSHEE_2D logerror(" 2D:dstXY: %d, %d\n", data & 0xfff, (data >> 16) & 0xfff); #endif - v->banshee.blt_regs[banshee2D_dstXY] = data; + vd->banshee.blt_regs[banshee2D_dstXY] = data; break; case banshee2D_srcFormat: #if LOG_BANSHEE_2D logerror(" 2D:srcFormat: str %d, fmt %d, packing %d\n", data & 0x3fff, (data >> 16) & 0xf, (data >> 22) & 0x3); #endif - v->banshee.blt_regs[banshee2D_srcFormat] = data; + vd->banshee.blt_regs[banshee2D_srcFormat] = data; break; case banshee2D_dstFormat: #if LOG_BANSHEE_2D logerror(" 2D:dstFormat: str %d, fmt %d\n", data & 0x3fff, (data >> 16) & 0xf); #endif - v->banshee.blt_regs[banshee2D_dstFormat] = data; + vd->banshee.blt_regs[banshee2D_dstFormat] = data; break; case banshee2D_clip0Min: #if LOG_BANSHEE_2D logerror(" 2D:clip0Min: %d, %d\n", data & 0xfff, (data >> 16) & 0xfff); #endif - v->banshee.blt_regs[banshee2D_clip0Min] = data; + vd->banshee.blt_regs[banshee2D_clip0Min] = data; break; case banshee2D_clip0Max: #if LOG_BANSHEE_2D logerror(" 2D:clip0Max: %d, %d\n", data & 0xfff, (data >> 16) & 0xfff); #endif - v->banshee.blt_regs[banshee2D_clip0Max] = data; + vd->banshee.blt_regs[banshee2D_clip0Max] = data; break; case banshee2D_clip1Min: #if LOG_BANSHEE_2D logerror(" 2D:clip1Min: %d, %d\n", data & 0xfff, (data >> 16) & 0xfff); #endif - v->banshee.blt_regs[banshee2D_clip1Min] = data; + vd->banshee.blt_regs[banshee2D_clip1Min] = data; break; case banshee2D_clip1Max: #if LOG_BANSHEE_2D logerror(" 2D:clip1Max: %d, %d\n", data & 0xfff, (data >> 16) & 0xfff); #endif - v->banshee.blt_regs[banshee2D_clip1Max] = data; + vd->banshee.blt_regs[banshee2D_clip1Max] = data; break; case banshee2D_rop: #if LOG_BANSHEE_2D logerror(" 2D:rop: %d, %d, %d\n", data & 0xff, (data >> 8) & 0xff, (data >> 16) & 0xff); #endif - v->banshee.blt_regs[banshee2D_rop] = data; + vd->banshee.blt_regs[banshee2D_rop] = data; break; default: if (offset >= 0x20 && offset < 0x40) { - blit_2d(v, data); + blit_2d(vd, data); } else if (offset >= 0x40 && offset < 0x80) { @@ -4677,86 +4610,85 @@ static INT32 banshee_2d_w(voodoo_state *v, offs_t offset, UINT32 data) WRITE32_MEMBER( voodoo_banshee_device::banshee_agp_w ) { - voodoo_state *v = get_safe_token(this); offset &= 0x1ff/4; /* switch off the offset */ switch (offset) { case cmdBaseAddr0: - COMBINE_DATA(&v->banshee.agp[offset]); - v->fbi.cmdfifo[0].base = (data & 0xffffff) << 12; - v->fbi.cmdfifo[0].end = v->fbi.cmdfifo[0].base + (((v->banshee.agp[cmdBaseSize0] & 0xff) + 1) << 12); + COMBINE_DATA(&banshee.agp[offset]); + fbi.cmdfifo[0].base = (data & 0xffffff) << 12; + fbi.cmdfifo[0].end = fbi.cmdfifo[0].base + (((banshee.agp[cmdBaseSize0] & 0xff) + 1) << 12); break; case cmdBaseSize0: - COMBINE_DATA(&v->banshee.agp[offset]); - v->fbi.cmdfifo[0].end = v->fbi.cmdfifo[0].base + (((v->banshee.agp[cmdBaseSize0] & 0xff) + 1) << 12); - v->fbi.cmdfifo[0].enable = (data >> 8) & 1; - v->fbi.cmdfifo[0].count_holes = (~data >> 10) & 1; + COMBINE_DATA(&banshee.agp[offset]); + fbi.cmdfifo[0].end = fbi.cmdfifo[0].base + (((banshee.agp[cmdBaseSize0] & 0xff) + 1) << 12); + fbi.cmdfifo[0].enable = (data >> 8) & 1; + fbi.cmdfifo[0].count_holes = (~data >> 10) & 1; break; case cmdBump0: fatalerror("cmdBump0\n"); case cmdRdPtrL0: - v->fbi.cmdfifo[0].rdptr = data; + fbi.cmdfifo[0].rdptr = data; break; case cmdAMin0: - v->fbi.cmdfifo[0].amin = data; + fbi.cmdfifo[0].amin = data; break; case cmdAMax0: - v->fbi.cmdfifo[0].amax = data; + fbi.cmdfifo[0].amax = data; break; case cmdFifoDepth0: - v->fbi.cmdfifo[0].depth = data; + fbi.cmdfifo[0].depth = data; break; case cmdHoleCnt0: - v->fbi.cmdfifo[0].holes = data; + fbi.cmdfifo[0].holes = data; break; case cmdBaseAddr1: - COMBINE_DATA(&v->banshee.agp[offset]); - v->fbi.cmdfifo[1].base = (data & 0xffffff) << 12; - v->fbi.cmdfifo[1].end = v->fbi.cmdfifo[1].base + (((v->banshee.agp[cmdBaseSize1] & 0xff) + 1) << 12); + COMBINE_DATA(&banshee.agp[offset]); + fbi.cmdfifo[1].base = (data & 0xffffff) << 12; + fbi.cmdfifo[1].end = fbi.cmdfifo[1].base + (((banshee.agp[cmdBaseSize1] & 0xff) + 1) << 12); break; case cmdBaseSize1: - COMBINE_DATA(&v->banshee.agp[offset]); - v->fbi.cmdfifo[1].end = v->fbi.cmdfifo[1].base + (((v->banshee.agp[cmdBaseSize1] & 0xff) + 1) << 12); - v->fbi.cmdfifo[1].enable = (data >> 8) & 1; - v->fbi.cmdfifo[1].count_holes = (~data >> 10) & 1; + COMBINE_DATA(&banshee.agp[offset]); + fbi.cmdfifo[1].end = fbi.cmdfifo[1].base + (((banshee.agp[cmdBaseSize1] & 0xff) + 1) << 12); + fbi.cmdfifo[1].enable = (data >> 8) & 1; + fbi.cmdfifo[1].count_holes = (~data >> 10) & 1; break; case cmdBump1: fatalerror("cmdBump1\n"); case cmdRdPtrL1: - v->fbi.cmdfifo[1].rdptr = data; + fbi.cmdfifo[1].rdptr = data; break; case cmdAMin1: - v->fbi.cmdfifo[1].amin = data; + fbi.cmdfifo[1].amin = data; break; case cmdAMax1: - v->fbi.cmdfifo[1].amax = data; + fbi.cmdfifo[1].amax = data; break; case cmdFifoDepth1: - v->fbi.cmdfifo[1].depth = data; + fbi.cmdfifo[1].depth = data; break; case cmdHoleCnt1: - v->fbi.cmdfifo[1].holes = data; + fbi.cmdfifo[1].holes = data; break; default: - COMBINE_DATA(&v->banshee.agp[offset]); + COMBINE_DATA(&banshee.agp[offset]); break; } @@ -4767,11 +4699,10 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_agp_w ) WRITE32_MEMBER( voodoo_banshee_device::banshee_w ) { - voodoo_state *v = get_safe_token(this); /* if we have something pending, flush the FIFOs up to the current time */ - if (v->pci.op_pending) - flush_fifos(v, machine().time()); + if (pci.op_pending) + flush_fifos(this, machine().time()); if (offset < 0x80000/4) banshee_io_w(space, offset, data, mem_mask); @@ -4780,7 +4711,7 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_w ) else if (offset < 0x200000/4) logerror("%s:banshee_w(2D:%X) = %08X & %08X\n", machine().describe_context(), (offset*4) & 0xfffff, data, mem_mask); else if (offset < 0x600000/4) - register_w(v, offset & 0x1fffff/4, data); + register_w(this, offset & 0x1fffff/4, data); else if (offset < 0x800000/4) logerror("%s:banshee_w(TEX0:%X) = %08X & %08X\n", machine().describe_context(), (offset*4) & 0x1fffff, data, mem_mask); else if (offset < 0xa00000/4) @@ -4791,7 +4722,7 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_w ) logerror("%s:banshee_w(YUV:%X) = %08X & %08X\n", machine().describe_context(), (offset*4) & 0x3fffff, data, mem_mask); else if (offset < 0x2000000/4) { - lfb_w(v, offset & 0xffffff/4, data, mem_mask); + lfb_w(this, offset & 0xffffff/4, data, mem_mask); } else { logerror("%s:banshee_w Address out of range %08X = %08X & %08X\n", machine().describe_context(), (offset*4), data, mem_mask); } @@ -4800,23 +4731,22 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_w ) WRITE32_MEMBER( voodoo_banshee_device::banshee_fb_w ) { - voodoo_state *v = get_safe_token(this); UINT32 addr = offset*4; /* if we have something pending, flush the FIFOs up to the current time */ - if (v->pci.op_pending) - flush_fifos(v, machine().time()); + if (pci.op_pending) + flush_fifos(this, machine().time()); - if (offset < v->fbi.lfb_base) + if (offset < fbi.lfb_base) { - if (v->fbi.cmdfifo[0].enable && addr >= v->fbi.cmdfifo[0].base && addr < v->fbi.cmdfifo[0].end) - cmdfifo_w(v, &v->fbi.cmdfifo[0], (addr - v->fbi.cmdfifo[0].base) / 4, data); - else if (v->fbi.cmdfifo[1].enable && addr >= v->fbi.cmdfifo[1].base && addr < v->fbi.cmdfifo[1].end) - cmdfifo_w(v, &v->fbi.cmdfifo[1], (addr - v->fbi.cmdfifo[1].base) / 4, data); + if (fbi.cmdfifo[0].enable && addr >= fbi.cmdfifo[0].base && addr < fbi.cmdfifo[0].end) + cmdfifo_w(this, &fbi.cmdfifo[0], (addr - fbi.cmdfifo[0].base) / 4, data); + else if (fbi.cmdfifo[1].enable && addr >= fbi.cmdfifo[1].base && addr < fbi.cmdfifo[1].end) + cmdfifo_w(this, &fbi.cmdfifo[1], (addr - fbi.cmdfifo[1].base) / 4, data); else { - if (offset*4 <= v->fbi.mask) - COMBINE_DATA(&((UINT32 *)v->fbi.ram)[offset]); + if (offset*4 <= fbi.mask) + COMBINE_DATA(&((UINT32 *)fbi.ram)[offset]); else logerror("%s:banshee_fb_w Out of bounds (%X) = %08X & %08X\n", machine().describe_context(), offset*4, data, mem_mask); #if LOG_LFB @@ -4825,13 +4755,12 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_fb_w ) } } else - lfb_direct_w(v, offset - v->fbi.lfb_base, data, mem_mask); + lfb_direct_w(this, offset - fbi.lfb_base, data, mem_mask); } WRITE8_MEMBER( voodoo_banshee_device::banshee_vga_w ) { - voodoo_state *v = get_safe_token(this); offset &= 0x1f; /* switch off the offset */ @@ -4840,48 +4769,48 @@ WRITE8_MEMBER( voodoo_banshee_device::banshee_vga_w ) /* attribute access */ case 0x3c0: case 0x3c1: - if (v->banshee.attff == 0) + if (banshee.attff == 0) { - v->banshee.vga[0x3c1 & 0x1f] = data; + banshee.vga[0x3c1 & 0x1f] = data; if (LOG_REGISTERS) logerror("%s:banshee_vga_w(%X) = %02X\n", machine().describe_context(), 0x3c0+offset, data); } else { - if (v->banshee.vga[0x3c1 & 0x1f] < ARRAY_LENGTH(v->banshee.att)) - v->banshee.att[v->banshee.vga[0x3c1 & 0x1f]] = data; + if (banshee.vga[0x3c1 & 0x1f] < ARRAY_LENGTH(banshee.att)) + banshee.att[banshee.vga[0x3c1 & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%s:banshee_att_w(%X) = %02X\n", machine().describe_context(), v->banshee.vga[0x3c1 & 0x1f], data); + logerror("%s:banshee_att_w(%X) = %02X\n", machine().describe_context(), banshee.vga[0x3c1 & 0x1f], data); } - v->banshee.attff ^= 1; + banshee.attff ^= 1; break; /* Sequencer access */ case 0x3c5: - if (v->banshee.vga[0x3c4 & 0x1f] < ARRAY_LENGTH(v->banshee.seq)) - v->banshee.seq[v->banshee.vga[0x3c4 & 0x1f]] = data; + if (banshee.vga[0x3c4 & 0x1f] < ARRAY_LENGTH(banshee.seq)) + banshee.seq[banshee.vga[0x3c4 & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%s:banshee_seq_w(%X) = %02X\n", machine().describe_context(), v->banshee.vga[0x3c4 & 0x1f], data); + logerror("%s:banshee_seq_w(%X) = %02X\n", machine().describe_context(), banshee.vga[0x3c4 & 0x1f], data); break; /* Graphics controller access */ case 0x3cf: - if (v->banshee.vga[0x3ce & 0x1f] < ARRAY_LENGTH(v->banshee.gc)) - v->banshee.gc[v->banshee.vga[0x3ce & 0x1f]] = data; + if (banshee.vga[0x3ce & 0x1f] < ARRAY_LENGTH(banshee.gc)) + banshee.gc[banshee.vga[0x3ce & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%s:banshee_gc_w(%X) = %02X\n", machine().describe_context(), v->banshee.vga[0x3ce & 0x1f], data); + logerror("%s:banshee_gc_w(%X) = %02X\n", machine().describe_context(), banshee.vga[0x3ce & 0x1f], data); break; /* CRTC access */ case 0x3d5: - if (v->banshee.vga[0x3d4 & 0x1f] < ARRAY_LENGTH(v->banshee.crtc)) - v->banshee.crtc[v->banshee.vga[0x3d4 & 0x1f]] = data; + if (banshee.vga[0x3d4 & 0x1f] < ARRAY_LENGTH(banshee.crtc)) + banshee.crtc[banshee.vga[0x3d4 & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%s:banshee_crtc_w(%X) = %02X\n", machine().describe_context(), v->banshee.vga[0x3d4 & 0x1f], data); + logerror("%s:banshee_crtc_w(%X) = %02X\n", machine().describe_context(), banshee.vga[0x3d4 & 0x1f], data); break; default: - v->banshee.vga[offset] = data; + banshee.vga[offset] = data; if (LOG_REGISTERS) logerror("%s:banshee_vga_w(%X) = %02X\n", machine().describe_context(), 0x3c0+offset, data); break; @@ -4891,73 +4820,72 @@ WRITE8_MEMBER( voodoo_banshee_device::banshee_vga_w ) WRITE32_MEMBER( voodoo_banshee_device::banshee_io_w ) { - voodoo_state *v = get_safe_token(this); UINT32 old; offset &= 0xff/4; - old = v->banshee.io[offset]; + old = banshee.io[offset]; /* switch off the offset */ switch (offset) { case io_vidProcCfg: - COMBINE_DATA(&v->banshee.io[offset]); - if ((v->banshee.io[offset] ^ old) & 0x2800) - v->fbi.clut_dirty = TRUE; + COMBINE_DATA(&banshee.io[offset]); + if ((banshee.io[offset] ^ old) & 0x2800) + fbi.clut_dirty = TRUE; if (LOG_REGISTERS) logerror("%s:banshee_io_w(%s) = %08X & %08X\n", machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; case io_dacData: - COMBINE_DATA(&v->banshee.io[offset]); - if (v->banshee.io[offset] != v->fbi.clut[v->banshee.io[io_dacAddr] & 0x1ff]) + COMBINE_DATA(&banshee.io[offset]); + if (banshee.io[offset] != fbi.clut[banshee.io[io_dacAddr] & 0x1ff]) { - v->fbi.clut[v->banshee.io[io_dacAddr] & 0x1ff] = v->banshee.io[offset]; - v->fbi.clut_dirty = TRUE; + fbi.clut[banshee.io[io_dacAddr] & 0x1ff] = banshee.io[offset]; + fbi.clut_dirty = TRUE; } if (LOG_REGISTERS) - logerror("%s:banshee_dac_w(%X) = %08X & %08X\n", machine().describe_context(), v->banshee.io[io_dacAddr] & 0x1ff, data, mem_mask); + logerror("%s:banshee_dac_w(%X) = %08X & %08X\n", machine().describe_context(), banshee.io[io_dacAddr] & 0x1ff, data, mem_mask); break; case io_miscInit0: - COMBINE_DATA(&v->banshee.io[offset]); - v->fbi.yorigin = (data >> 18) & 0xfff; + COMBINE_DATA(&banshee.io[offset]); + fbi.yorigin = (data >> 18) & 0xfff; if (LOG_REGISTERS) logerror("%s:banshee_io_w(%s) = %08X & %08X\n", machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; case io_vidScreenSize: if (data & 0xfff) - v->fbi.width = data & 0xfff; + fbi.width = data & 0xfff; if (data & 0xfff000) - v->fbi.height = (data >> 12) & 0xfff; + fbi.height = (data >> 12) & 0xfff; /* fall through */ case io_vidOverlayDudx: case io_vidOverlayDvdy: { /* warning: this is a hack for now! We should really compute the screen size */ /* from the CRTC registers */ - COMBINE_DATA(&v->banshee.io[offset]); + COMBINE_DATA(&banshee.io[offset]); - int width = v->fbi.width; - int height = v->fbi.height; + int width = fbi.width; + int height = fbi.height; - if (v->banshee.io[io_vidOverlayDudx] != 0) - width = (v->fbi.width * v->banshee.io[io_vidOverlayDudx]) / 1048576; - if (v->banshee.io[io_vidOverlayDvdy] != 0) - height = (v->fbi.height * v->banshee.io[io_vidOverlayDvdy]) / 1048576; + if (banshee.io[io_vidOverlayDudx] != 0) + width = (fbi.width * banshee.io[io_vidOverlayDudx]) / 1048576; + if (banshee.io[io_vidOverlayDvdy] != 0) + height = (fbi.height * banshee.io[io_vidOverlayDvdy]) / 1048576; - v->screen->set_visible_area(0, width - 1, 0, height - 1); + screen->set_visible_area(0, width - 1, 0, height - 1); - adjust_vblank_timer(v); + adjust_vblank_timer(this); if (LOG_REGISTERS) logerror("%s:banshee_io_w(%s) = %08X & %08X\n", machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; } case io_lfbMemoryConfig: - v->fbi.lfb_base = (data & 0x1fff) << (12-2); - v->fbi.lfb_stride = ((data >> 13) & 7) + 9; + fbi.lfb_base = (data & 0x1fff) << (12-2); + fbi.lfb_stride = ((data >> 13) & 7) + 9; if (LOG_REGISTERS) logerror("%s:banshee_io_w(%s) = %08X & %08X\n", machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; @@ -4976,7 +4904,7 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_io_w ) break; default: - COMBINE_DATA(&v->banshee.io[offset]); + COMBINE_DATA(&banshee.io[offset]); if (LOG_REGISTERS) logerror("%s:banshee_io_w(%s) = %08X & %08X\n", machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; @@ -4995,7 +4923,6 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_io_w ) void voodoo_device::common_start_voodoo(UINT8 type) { - voodoo_state *v = get_safe_token(this); const raster_info *info; void *fbmem, *tmumem[2]; UINT32 tmumem0, tmumem1; @@ -5007,17 +4934,17 @@ void voodoo_device::common_start_voodoo(UINT8 type) assert(m_fbmem > 0); /* store a pointer back to the device */ - v->device = this; - v->type = type; + device = this; + vd_type = type; /* copy config data */ - v->freq = clock(); - v->device->m_vblank.resolve(); - v->device->m_stall.resolve(); + freq = clock(); + device->m_vblank.resolve(); + device->m_stall.resolve(); /* create a multiprocessor work queue */ - v->poly = poly_alloc(machine(), 64, sizeof(poly_extra_data), 0); - v->thread_stats = auto_alloc_array(machine(), stats_block, WORK_MAX_THREADS); + poly = poly_alloc(machine(), 64, sizeof(poly_extra_data), 0); + thread_stats = auto_alloc_array(machine(), stats_block, WORK_MAX_THREADS); /* create a table of precomputed 1/n and log2(n) values */ /* n ranges from 1.0000 to 2.0000 */ @@ -5048,38 +4975,38 @@ void voodoo_device::common_start_voodoo(UINT8 type) } } - v->tmu_config = 0x11; // revision 1 + tmu_config = 0x11; // revision 1 /* configure type-specific values */ - switch (v->type) + switch (vd_type) { case TYPE_VOODOO_1: - v->regaccess = voodoo_register_access; - v->regnames = voodoo_reg_name; - v->alt_regmap = 0; - v->fbi.lfb_stride = 10; + regaccess = voodoo_register_access; + regnames = voodoo_reg_name; + alt_regmap = 0; + fbi.lfb_stride = 10; break; case TYPE_VOODOO_2: - v->regaccess = voodoo2_register_access; - v->regnames = voodoo_reg_name; - v->alt_regmap = 0; - v->fbi.lfb_stride = 10; - v->tmu_config |= 0x800; + regaccess = voodoo2_register_access; + regnames = voodoo_reg_name; + alt_regmap = 0; + fbi.lfb_stride = 10; + tmu_config |= 0x800; break; case TYPE_VOODOO_BANSHEE: - v->regaccess = banshee_register_access; - v->regnames = banshee_reg_name; - v->alt_regmap = 1; - v->fbi.lfb_stride = 11; + regaccess = banshee_register_access; + regnames = banshee_reg_name; + alt_regmap = 1; + fbi.lfb_stride = 11; break; case TYPE_VOODOO_3: - v->regaccess = banshee_register_access; - v->regnames = banshee_reg_name; - v->alt_regmap = 1; - v->fbi.lfb_stride = 11; + regaccess = banshee_register_access; + regnames = banshee_reg_name; + alt_regmap = 1; + fbi.lfb_stride = 11; break; default: @@ -5088,41 +5015,41 @@ void voodoo_device::common_start_voodoo(UINT8 type) /* set the type, and initialize the chip mask */ device_iterator iter(machine().root_device()); - v->index = 0; + index = 0; for (device_t *scan = iter.first(); scan != nullptr; scan = iter.next()) if (scan->type() == this->type()) { if (scan == this) break; - v->index++; + index++; } - v->screen = downcast(machine().device(m_screen)); - assert_always(v->screen != nullptr, "Unable to find screen attached to voodoo"); - v->cpu = machine().device(m_cputag); - assert_always(v->cpu != nullptr, "Unable to find CPU attached to voodoo"); + screen = downcast(machine().device(m_screen)); + assert_always(screen != nullptr, "Unable to find screen attached to voodoo"); + cpu = machine().device(m_cputag); + assert_always(cpu != nullptr, "Unable to find CPU attached to voodoo"); if (m_tmumem1 != 0) - v->tmu_config |= 0xc0; // two TMUs + tmu_config |= 0xc0; // two TMUs - v->chipmask = 0x01; - v->attoseconds_per_cycle = ATTOSECONDS_PER_SECOND / v->freq; - v->trigger = 51324 + v->index; + chipmask = 0x01; + attoseconds_per_cycle = ATTOSECONDS_PER_SECOND / freq; + trigger = 51324 + index; /* build the rasterizer table */ for (info = predef_raster_table; info->callback; info++) - add_rasterizer(v, info); + add_rasterizer(this, info); /* set up the PCI FIFO */ - v->pci.fifo.base = v->pci.fifo_mem; - v->pci.fifo.size = 64*2; - v->pci.fifo.in = v->pci.fifo.out = 0; - v->pci.stall_state = NOT_STALLED; - v->pci.continue_timer = machine().scheduler().timer_alloc(FUNC(stall_cpu_callback), v); - + pci.fifo.base = pci.fifo_mem; + pci.fifo.size = 64*2; + pci.fifo.in = pci.fifo.out = 0; + pci.stall_state = NOT_STALLED; + pci.continue_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(voodoo_device::stall_cpu_callback),this), nullptr); + /* allocate memory */ tmumem0 = m_tmumem0; tmumem1 = m_tmumem1; - if (v->type <= TYPE_VOODOO_2) + if (vd_type <= TYPE_VOODOO_2) { /* separate FB/TMU memory */ fbmem = auto_alloc_array(machine(), UINT8, m_fbmem << 20); @@ -5134,47 +5061,47 @@ void voodoo_device::common_start_voodoo(UINT8 type) /* shared memory */ tmumem[0] = tmumem[1] = fbmem = auto_alloc_array(machine(), UINT8, m_fbmem << 20); tmumem0 = m_fbmem; - if (v->type == TYPE_VOODOO_3) + if (vd_type == TYPE_VOODOO_3) tmumem1 = m_fbmem; } /* set up frame buffer */ - init_fbi(v, &v->fbi, fbmem, m_fbmem << 20); + init_fbi(this, &fbi, fbmem, m_fbmem << 20); /* build shared TMU tables */ - init_tmu_shared(&v->tmushare); + init_tmu_shared(&tmushare); /* set up the TMUs */ - init_tmu(v, &v->tmu[0], &v->reg[0x100], tmumem[0], tmumem0 << 20); - v->chipmask |= 0x02; + init_tmu(this, &tmu[0], ®[0x100], tmumem[0], tmumem0 << 20); + chipmask |= 0x02; if (tmumem1 != 0) { - init_tmu(v, &v->tmu[1], &v->reg[0x200], tmumem[1], tmumem1 << 20); - v->chipmask |= 0x04; - v->tmu_config |= 0x40; + init_tmu(this, &tmu[1], ®[0x200], tmumem[1], tmumem1 << 20); + chipmask |= 0x04; + tmu_config |= 0x40; } /* initialize some registers */ - memset(v->reg, 0, sizeof(v->reg)); - v->pci.init_enable = 0; - v->reg[fbiInit0].u = (1 << 4) | (0x10 << 6); - v->reg[fbiInit1].u = (1 << 1) | (1 << 8) | (1 << 12) | (2 << 20); - v->reg[fbiInit2].u = (1 << 6) | (0x100 << 23); - v->reg[fbiInit3].u = (2 << 13) | (0xf << 17); - v->reg[fbiInit4].u = (1 << 0); + memset(reg, 0, sizeof(reg)); + pci.init_enable = 0; + reg[fbiInit0].u = (1 << 4) | (0x10 << 6); + reg[fbiInit1].u = (1 << 1) | (1 << 8) | (1 << 12) | (2 << 20); + reg[fbiInit2].u = (1 << 6) | (0x100 << 23); + reg[fbiInit3].u = (2 << 13) | (0xf << 17); + reg[fbiInit4].u = (1 << 0); /* initialize banshee registers */ - memset(v->banshee.io, 0, sizeof(v->banshee.io)); - v->banshee.io[io_pciInit0] = 0x01800040; - v->banshee.io[io_sipMonitor] = 0x40000000; - v->banshee.io[io_lfbMemoryConfig] = 0x000a2200; - v->banshee.io[io_dramInit0] = 0x00579d29; - v->banshee.io[io_dramInit0] |= 0x08000000; // Konami Viper expects 16MBit SGRAMs - v->banshee.io[io_dramInit1] = 0x00f02200; - v->banshee.io[io_tmuGbeInit] = 0x00000bfb; + memset(banshee.io, 0, sizeof(banshee.io)); + banshee.io[io_pciInit0] = 0x01800040; + banshee.io[io_sipMonitor] = 0x40000000; + banshee.io[io_lfbMemoryConfig] = 0x000a2200; + banshee.io[io_dramInit0] = 0x00579d29; + banshee.io[io_dramInit0] |= 0x08000000; // Konami Viper expects 16MBit SGRAMs + banshee.io[io_dramInit1] = 0x00f02200; + banshee.io[io_tmuGbeInit] = 0x00000bfb; /* do a soft reset to reset everything else */ - soft_reset(v); + soft_reset(this); /* register for save states */ init_save_state(this); @@ -5191,12 +5118,12 @@ void voodoo_device::common_start_voodoo(UINT8 type) command -------------------------------------------------*/ -static INT32 fastfill(voodoo_state *v) +INT32 voodoo_device::fastfill(voodoo_device *vd) { - int sx = (v->reg[clipLeftRight].u >> 16) & 0x3ff; - int ex = (v->reg[clipLeftRight].u >> 0) & 0x3ff; - int sy = (v->reg[clipLowYHighY].u >> 16) & 0x3ff; - int ey = (v->reg[clipLowYHighY].u >> 0) & 0x3ff; + int sx = (vd->reg[clipLeftRight].u >> 16) & 0x3ff; + int ex = (vd->reg[clipLeftRight].u >> 0) & 0x3ff; + int sy = (vd->reg[clipLowYHighY].u >> 16) & 0x3ff; + int ey = (vd->reg[clipLowYHighY].u >> 0) & 0x3ff; poly_extent extents[64]; UINT16 dithermatrix[16]; UINT16 *drawbuf = nullptr; @@ -5204,22 +5131,22 @@ static INT32 fastfill(voodoo_state *v) int extnum, x, y; /* if we're not clearing either, take no time */ - if (!FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u) && !FBZMODE_AUX_BUFFER_MASK(v->reg[fbzMode].u)) + if (!FBZMODE_RGB_BUFFER_MASK(vd->reg[fbzMode].u) && !FBZMODE_AUX_BUFFER_MASK(vd->reg[fbzMode].u)) return 0; /* are we clearing the RGB buffer? */ - if (FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u)) + if (FBZMODE_RGB_BUFFER_MASK(vd->reg[fbzMode].u)) { /* determine the draw buffer */ - int destbuf = (v->type >= TYPE_VOODOO_BANSHEE) ? 1 : FBZMODE_DRAW_BUFFER(v->reg[fbzMode].u); + int destbuf = (vd->vd_type >= TYPE_VOODOO_BANSHEE) ? 1 : FBZMODE_DRAW_BUFFER(vd->reg[fbzMode].u); switch (destbuf) { case 0: /* front buffer */ - drawbuf = (UINT16 *)(v->fbi.ram + v->fbi.rgboffs[v->fbi.frontbuf]); + drawbuf = (UINT16 *)(vd->fbi.ram + vd->fbi.rgboffs[vd->fbi.frontbuf]); break; case 1: /* back buffer */ - drawbuf = (UINT16 *)(v->fbi.ram + v->fbi.rgboffs[v->fbi.backbuf]); + drawbuf = (UINT16 *)(vd->fbi.ram + vd->fbi.rgboffs[vd->fbi.backbuf]); break; default: /* reserved */ @@ -5230,14 +5157,14 @@ static INT32 fastfill(voodoo_state *v) for (y = 0; y < 4; y++) { DECLARE_DITHER_POINTERS_NO_DITHER_VAR; - COMPUTE_DITHER_POINTERS_NO_DITHER_VAR(v->reg[fbzMode].u, y); + COMPUTE_DITHER_POINTERS_NO_DITHER_VAR(vd->reg[fbzMode].u, y); for (x = 0; x < 4; x++) { - int r = v->reg[color1].rgb.r; - int g = v->reg[color1].rgb.g; - int b = v->reg[color1].rgb.b; + int r = vd->reg[color1].rgb.r; + int g = vd->reg[color1].rgb.g; + int b = vd->reg[color1].rgb.b; - APPLY_DITHER(v->reg[fbzMode].u, x, dither_lookup, r, g, b); + APPLY_DITHER(vd->reg[fbzMode].u, x, dither_lookup, r, g, b); dithermatrix[y*4 + x] = (r << 11) | (g << 5) | b; } } @@ -5252,13 +5179,13 @@ static INT32 fastfill(voodoo_state *v) /* iterate over blocks of extents */ for (y = sy; y < ey; y += ARRAY_LENGTH(extents)) { - poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(v->poly); + poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(vd->poly); int count = MIN(ey - y, ARRAY_LENGTH(extents)); - extra->state = v; + extra->device= vd; memcpy(extra->dither, dithermatrix, sizeof(extra->dither)); - pixels += poly_render_triangle_custom(v->poly, drawbuf, global_cliprect, raster_fastfill, y, count, extents); + pixels += poly_render_triangle_custom(vd->poly, drawbuf, global_cliprect, raster_fastfill, y, count, extents); } /* 2 pixels per clock */ @@ -5271,23 +5198,23 @@ static INT32 fastfill(voodoo_state *v) command -------------------------------------------------*/ -static INT32 swapbuffer(voodoo_state *v, UINT32 data) +INT32 voodoo_device::swapbuffer(voodoo_device* vd, UINT32 data) { /* set the don't swap value for Voodoo 2 */ - v->fbi.vblank_swap_pending = TRUE; - v->fbi.vblank_swap = (data >> 1) & 0xff; - v->fbi.vblank_dont_swap = (data >> 9) & 1; + vd->fbi.vblank_swap_pending = TRUE; + vd->fbi.vblank_swap = (data >> 1) & 0xff; + vd->fbi.vblank_dont_swap = (data >> 9) & 1; /* if we're not syncing to the retrace, process the command immediately */ if (!(data & 1)) { - swap_buffers(v); + swap_buffers(vd); return 0; } /* determine how many cycles to wait; we deliberately overshoot here because */ /* the final count gets updated on the VBLANK */ - return (v->fbi.vblank_swap + 1) * v->freq / 30; + return (vd->fbi.vblank_swap + 1) * vd->freq / 30; } @@ -5296,7 +5223,7 @@ static INT32 swapbuffer(voodoo_state *v, UINT32 data) command -------------------------------------------------*/ -static INT32 triangle(voodoo_state *v) +INT32 voodoo_device::triangle(voodoo_device *vd) { int texcount; UINT16 *drawbuf; @@ -5307,58 +5234,58 @@ static INT32 triangle(voodoo_state *v) /* determine the number of TMUs involved */ texcount = 0; - if (!FBIINIT3_DISABLE_TMUS(v->reg[fbiInit3].u) && FBZCP_TEXTURE_ENABLE(v->reg[fbzColorPath].u)) + if (!FBIINIT3_DISABLE_TMUS(vd->reg[fbiInit3].u) && FBZCP_TEXTURE_ENABLE(vd->reg[fbzColorPath].u)) { texcount = 1; - if (v->chipmask & 0x04) + if (vd->chipmask & 0x04) texcount = 2; } /* perform subpixel adjustments */ - if (FBZCP_CCA_SUBPIXEL_ADJUST(v->reg[fbzColorPath].u)) + if (FBZCP_CCA_SUBPIXEL_ADJUST(vd->reg[fbzColorPath].u)) { - INT32 dx = 8 - (v->fbi.ax & 15); - INT32 dy = 8 - (v->fbi.ay & 15); + INT32 dx = 8 - (vd->fbi.ax & 15); + INT32 dy = 8 - (vd->fbi.ay & 15); /* adjust iterated R,G,B,A and W/Z */ - v->fbi.startr += (dy * v->fbi.drdy + dx * v->fbi.drdx) >> 4; - v->fbi.startg += (dy * v->fbi.dgdy + dx * v->fbi.dgdx) >> 4; - v->fbi.startb += (dy * v->fbi.dbdy + dx * v->fbi.dbdx) >> 4; - v->fbi.starta += (dy * v->fbi.dady + dx * v->fbi.dadx) >> 4; - v->fbi.startw += (dy * v->fbi.dwdy + dx * v->fbi.dwdx) >> 4; - v->fbi.startz += mul_32x32_shift(dy, v->fbi.dzdy, 4) + mul_32x32_shift(dx, v->fbi.dzdx, 4); + vd->fbi.startr += (dy * vd->fbi.drdy + dx * vd->fbi.drdx) >> 4; + vd->fbi.startg += (dy * vd->fbi.dgdy + dx * vd->fbi.dgdx) >> 4; + vd->fbi.startb += (dy * vd->fbi.dbdy + dx * vd->fbi.dbdx) >> 4; + vd->fbi.starta += (dy * vd->fbi.dady + dx * vd->fbi.dadx) >> 4; + vd->fbi.startw += (dy * vd->fbi.dwdy + dx * vd->fbi.dwdx) >> 4; + vd->fbi.startz += mul_32x32_shift(dy, vd->fbi.dzdy, 4) + mul_32x32_shift(dx, vd->fbi.dzdx, 4); /* adjust iterated W/S/T for TMU 0 */ if (texcount >= 1) { - v->tmu[0].startw += (dy * v->tmu[0].dwdy + dx * v->tmu[0].dwdx) >> 4; - v->tmu[0].starts += (dy * v->tmu[0].dsdy + dx * v->tmu[0].dsdx) >> 4; - v->tmu[0].startt += (dy * v->tmu[0].dtdy + dx * v->tmu[0].dtdx) >> 4; + vd->tmu[0].startw += (dy * vd->tmu[0].dwdy + dx * vd->tmu[0].dwdx) >> 4; + vd->tmu[0].starts += (dy * vd->tmu[0].dsdy + dx * vd->tmu[0].dsdx) >> 4; + vd->tmu[0].startt += (dy * vd->tmu[0].dtdy + dx * vd->tmu[0].dtdx) >> 4; /* adjust iterated W/S/T for TMU 1 */ if (texcount >= 2) { - v->tmu[1].startw += (dy * v->tmu[1].dwdy + dx * v->tmu[1].dwdx) >> 4; - v->tmu[1].starts += (dy * v->tmu[1].dsdy + dx * v->tmu[1].dsdx) >> 4; - v->tmu[1].startt += (dy * v->tmu[1].dtdy + dx * v->tmu[1].dtdx) >> 4; + vd->tmu[1].startw += (dy * vd->tmu[1].dwdy + dx * vd->tmu[1].dwdx) >> 4; + vd->tmu[1].starts += (dy * vd->tmu[1].dsdy + dx * vd->tmu[1].dsdx) >> 4; + vd->tmu[1].startt += (dy * vd->tmu[1].dtdy + dx * vd->tmu[1].dtdx) >> 4; } } } /* wait for any outstanding work to finish */ -// poly_wait(v->poly, "triangle"); +// poly_wait(vd->poly, "triangle"); /* determine the draw buffer */ - destbuf = (v->type >= TYPE_VOODOO_BANSHEE) ? 1 : FBZMODE_DRAW_BUFFER(v->reg[fbzMode].u); + destbuf = (vd->vd_type >= TYPE_VOODOO_BANSHEE) ? 1 : FBZMODE_DRAW_BUFFER(vd->reg[fbzMode].u); switch (destbuf) { case 0: /* front buffer */ - drawbuf = (UINT16 *)(v->fbi.ram + v->fbi.rgboffs[v->fbi.frontbuf]); - v->fbi.video_changed = TRUE; + drawbuf = (UINT16 *)(vd->fbi.ram + vd->fbi.rgboffs[vd->fbi.frontbuf]); + vd->fbi.video_changed = TRUE; break; case 1: /* back buffer */ - drawbuf = (UINT16 *)(v->fbi.ram + v->fbi.rgboffs[v->fbi.backbuf]); + drawbuf = (UINT16 *)(vd->fbi.ram + vd->fbi.rgboffs[vd->fbi.backbuf]); break; default: /* reserved */ @@ -5366,18 +5293,18 @@ static INT32 triangle(voodoo_state *v) } /* find a rasterizer that matches our current state */ - pixels = triangle_create_work_item(v, drawbuf, texcount); + pixels = triangle_create_work_item(vd, drawbuf, texcount); /* update stats */ - v->reg[fbiTrianglesOut].u++; + vd->reg[fbiTrianglesOut].u++; /* update stats */ - v->stats.total_triangles++; + vd->stats.total_triangles++; g_profiler.stop(); /* 1 pixel per clock, plus some setup time */ - if (LOG_REGISTERS) v->device->logerror("cycles = %d\n", TRIANGLE_SETUP_CLOCKS + pixels); + if (LOG_REGISTERS) vd->device->logerror("cycles = %d\n", TRIANGLE_SETUP_CLOCKS + pixels); return TRIANGLE_SETUP_CLOCKS + pixels; } @@ -5387,28 +5314,28 @@ static INT32 triangle(voodoo_state *v) command -------------------------------------------------*/ -static INT32 begin_triangle(voodoo_state *v) +INT32 voodoo_device::begin_triangle(voodoo_device *vd) { - setup_vertex *sv = &v->fbi.svert[2]; + setup_vertex *sv = &vd->fbi.svert[2]; /* extract all the data from registers */ - sv->x = v->reg[sVx].f; - sv->y = v->reg[sVy].f; - sv->wb = v->reg[sWb].f; - sv->w0 = v->reg[sWtmu0].f; - sv->s0 = v->reg[sS_W0].f; - sv->t0 = v->reg[sT_W0].f; - sv->w1 = v->reg[sWtmu1].f; - sv->s1 = v->reg[sS_Wtmu1].f; - sv->t1 = v->reg[sT_Wtmu1].f; - sv->a = v->reg[sAlpha].f; - sv->r = v->reg[sRed].f; - sv->g = v->reg[sGreen].f; - sv->b = v->reg[sBlue].f; + sv->x = vd->reg[sVx].f; + sv->y = vd->reg[sVy].f; + sv->wb = vd->reg[sWb].f; + sv->w0 = vd->reg[sWtmu0].f; + sv->s0 = vd->reg[sS_W0].f; + sv->t0 = vd->reg[sT_W0].f; + sv->w1 = vd->reg[sWtmu1].f; + sv->s1 = vd->reg[sS_Wtmu1].f; + sv->t1 = vd->reg[sT_Wtmu1].f; + sv->a = vd->reg[sAlpha].f; + sv->r = vd->reg[sRed].f; + sv->g = vd->reg[sGreen].f; + sv->b = vd->reg[sBlue].f; /* spread it across all three verts and reset the count */ - v->fbi.svert[0] = v->fbi.svert[1] = v->fbi.svert[2]; - v->fbi.sverts = 1; + vd->fbi.svert[0] = vd->fbi.svert[1] = vd->fbi.svert[2]; + vd->fbi.sverts = 1; return 0; } @@ -5419,36 +5346,36 @@ static INT32 begin_triangle(voodoo_state *v) command -------------------------------------------------*/ -static INT32 draw_triangle(voodoo_state *v) +INT32 voodoo_device::draw_triangle(voodoo_device *vd) { - setup_vertex *sv = &v->fbi.svert[2]; + setup_vertex *sv = &vd->fbi.svert[2]; int cycles = 0; /* for strip mode, shuffle vertex 1 down to 0 */ - if (!(v->reg[sSetupMode].u & (1 << 16))) - v->fbi.svert[0] = v->fbi.svert[1]; + if (!(vd->reg[sSetupMode].u & (1 << 16))) + vd->fbi.svert[0] = vd->fbi.svert[1]; /* copy 2 down to 1 regardless */ - v->fbi.svert[1] = v->fbi.svert[2]; + vd->fbi.svert[1] = vd->fbi.svert[2]; /* extract all the data from registers */ - sv->x = v->reg[sVx].f; - sv->y = v->reg[sVy].f; - sv->wb = v->reg[sWb].f; - sv->w0 = v->reg[sWtmu0].f; - sv->s0 = v->reg[sS_W0].f; - sv->t0 = v->reg[sT_W0].f; - sv->w1 = v->reg[sWtmu1].f; - sv->s1 = v->reg[sS_Wtmu1].f; - sv->t1 = v->reg[sT_Wtmu1].f; - sv->a = v->reg[sAlpha].f; - sv->r = v->reg[sRed].f; - sv->g = v->reg[sGreen].f; - sv->b = v->reg[sBlue].f; + sv->x = vd->reg[sVx].f; + sv->y = vd->reg[sVy].f; + sv->wb = vd->reg[sWb].f; + sv->w0 = vd->reg[sWtmu0].f; + sv->s0 = vd->reg[sS_W0].f; + sv->t0 = vd->reg[sT_W0].f; + sv->w1 = vd->reg[sWtmu1].f; + sv->s1 = vd->reg[sS_Wtmu1].f; + sv->t1 = vd->reg[sT_Wtmu1].f; + sv->a = vd->reg[sAlpha].f; + sv->r = vd->reg[sRed].f; + sv->g = vd->reg[sGreen].f; + sv->b = vd->reg[sBlue].f; /* if we have enough verts, go ahead and draw */ - if (++v->fbi.sverts >= 3) - cycles = setup_and_draw_triangle(v); + if (++vd->fbi.sverts >= 3) + cycles = setup_and_draw_triangle(vd); return cycles; } @@ -5464,32 +5391,32 @@ static INT32 draw_triangle(voodoo_state *v) parameters and render the triangle -------------------------------------------------*/ -static INT32 setup_and_draw_triangle(voodoo_state *v) +INT32 voodoo_device::setup_and_draw_triangle(voodoo_device *vd) { float dx1, dy1, dx2, dy2; float divisor, tdiv; /* grab the X/Ys at least */ - v->fbi.ax = (INT16)(v->fbi.svert[0].x * 16.0f); - v->fbi.ay = (INT16)(v->fbi.svert[0].y * 16.0f); - v->fbi.bx = (INT16)(v->fbi.svert[1].x * 16.0f); - v->fbi.by = (INT16)(v->fbi.svert[1].y * 16.0f); - v->fbi.cx = (INT16)(v->fbi.svert[2].x * 16.0f); - v->fbi.cy = (INT16)(v->fbi.svert[2].y * 16.0f); + vd->fbi.ax = (INT16)(vd->fbi.svert[0].x * 16.0f); + vd->fbi.ay = (INT16)(vd->fbi.svert[0].y * 16.0f); + vd->fbi.bx = (INT16)(vd->fbi.svert[1].x * 16.0f); + vd->fbi.by = (INT16)(vd->fbi.svert[1].y * 16.0f); + vd->fbi.cx = (INT16)(vd->fbi.svert[2].x * 16.0f); + vd->fbi.cy = (INT16)(vd->fbi.svert[2].y * 16.0f); /* compute the divisor */ - divisor = 1.0f / ((v->fbi.svert[0].x - v->fbi.svert[1].x) * (v->fbi.svert[0].y - v->fbi.svert[2].y) - - (v->fbi.svert[0].x - v->fbi.svert[2].x) * (v->fbi.svert[0].y - v->fbi.svert[1].y)); + divisor = 1.0f / ((vd->fbi.svert[0].x - vd->fbi.svert[1].x) * (vd->fbi.svert[0].y - vd->fbi.svert[2].y) - + (vd->fbi.svert[0].x - vd->fbi.svert[2].x) * (vd->fbi.svert[0].y - vd->fbi.svert[1].y)); /* backface culling */ - if (v->reg[sSetupMode].u & 0x20000) + if (vd->reg[sSetupMode].u & 0x20000) { - int culling_sign = (v->reg[sSetupMode].u >> 18) & 1; + int culling_sign = (vd->reg[sSetupMode].u >> 18) & 1; int divisor_sign = (divisor < 0); /* if doing strips and ping pong is enabled, apply the ping pong */ - if ((v->reg[sSetupMode].u & 0x90000) == 0x00000) - culling_sign ^= (v->fbi.sverts - 3) & 1; + if ((vd->reg[sSetupMode].u & 0x90000) == 0x00000) + culling_sign ^= (vd->fbi.sverts - 3) & 1; /* if our sign matches the culling sign, we're done for */ if (divisor_sign == culling_sign) @@ -5497,92 +5424,92 @@ static INT32 setup_and_draw_triangle(voodoo_state *v) } /* compute the dx/dy values */ - dx1 = v->fbi.svert[0].y - v->fbi.svert[2].y; - dx2 = v->fbi.svert[0].y - v->fbi.svert[1].y; - dy1 = v->fbi.svert[0].x - v->fbi.svert[1].x; - dy2 = v->fbi.svert[0].x - v->fbi.svert[2].x; + dx1 = vd->fbi.svert[0].y - vd->fbi.svert[2].y; + dx2 = vd->fbi.svert[0].y - vd->fbi.svert[1].y; + dy1 = vd->fbi.svert[0].x - vd->fbi.svert[1].x; + dy2 = vd->fbi.svert[0].x - vd->fbi.svert[2].x; /* set up R,G,B */ tdiv = divisor * 4096.0f; - if (v->reg[sSetupMode].u & (1 << 0)) + if (vd->reg[sSetupMode].u & (1 << 0)) { - v->fbi.startr = (INT32)(v->fbi.svert[0].r * 4096.0f); - v->fbi.drdx = (INT32)(((v->fbi.svert[0].r - v->fbi.svert[1].r) * dx1 - (v->fbi.svert[0].r - v->fbi.svert[2].r) * dx2) * tdiv); - v->fbi.drdy = (INT32)(((v->fbi.svert[0].r - v->fbi.svert[2].r) * dy1 - (v->fbi.svert[0].r - v->fbi.svert[1].r) * dy2) * tdiv); - v->fbi.startg = (INT32)(v->fbi.svert[0].g * 4096.0f); - v->fbi.dgdx = (INT32)(((v->fbi.svert[0].g - v->fbi.svert[1].g) * dx1 - (v->fbi.svert[0].g - v->fbi.svert[2].g) * dx2) * tdiv); - v->fbi.dgdy = (INT32)(((v->fbi.svert[0].g - v->fbi.svert[2].g) * dy1 - (v->fbi.svert[0].g - v->fbi.svert[1].g) * dy2) * tdiv); - v->fbi.startb = (INT32)(v->fbi.svert[0].b * 4096.0f); - v->fbi.dbdx = (INT32)(((v->fbi.svert[0].b - v->fbi.svert[1].b) * dx1 - (v->fbi.svert[0].b - v->fbi.svert[2].b) * dx2) * tdiv); - v->fbi.dbdy = (INT32)(((v->fbi.svert[0].b - v->fbi.svert[2].b) * dy1 - (v->fbi.svert[0].b - v->fbi.svert[1].b) * dy2) * tdiv); + vd->fbi.startr = (INT32)(vd->fbi.svert[0].r * 4096.0f); + vd->fbi.drdx = (INT32)(((vd->fbi.svert[0].r - vd->fbi.svert[1].r) * dx1 - (vd->fbi.svert[0].r - vd->fbi.svert[2].r) * dx2) * tdiv); + vd->fbi.drdy = (INT32)(((vd->fbi.svert[0].r - vd->fbi.svert[2].r) * dy1 - (vd->fbi.svert[0].r - vd->fbi.svert[1].r) * dy2) * tdiv); + vd->fbi.startg = (INT32)(vd->fbi.svert[0].g * 4096.0f); + vd->fbi.dgdx = (INT32)(((vd->fbi.svert[0].g - vd->fbi.svert[1].g) * dx1 - (vd->fbi.svert[0].g - vd->fbi.svert[2].g) * dx2) * tdiv); + vd->fbi.dgdy = (INT32)(((vd->fbi.svert[0].g - vd->fbi.svert[2].g) * dy1 - (vd->fbi.svert[0].g - vd->fbi.svert[1].g) * dy2) * tdiv); + vd->fbi.startb = (INT32)(vd->fbi.svert[0].b * 4096.0f); + vd->fbi.dbdx = (INT32)(((vd->fbi.svert[0].b - vd->fbi.svert[1].b) * dx1 - (vd->fbi.svert[0].b - vd->fbi.svert[2].b) * dx2) * tdiv); + vd->fbi.dbdy = (INT32)(((vd->fbi.svert[0].b - vd->fbi.svert[2].b) * dy1 - (vd->fbi.svert[0].b - vd->fbi.svert[1].b) * dy2) * tdiv); } /* set up alpha */ - if (v->reg[sSetupMode].u & (1 << 1)) + if (vd->reg[sSetupMode].u & (1 << 1)) { - v->fbi.starta = (INT32)(v->fbi.svert[0].a * 4096.0f); - v->fbi.dadx = (INT32)(((v->fbi.svert[0].a - v->fbi.svert[1].a) * dx1 - (v->fbi.svert[0].a - v->fbi.svert[2].a) * dx2) * tdiv); - v->fbi.dady = (INT32)(((v->fbi.svert[0].a - v->fbi.svert[2].a) * dy1 - (v->fbi.svert[0].a - v->fbi.svert[1].a) * dy2) * tdiv); + vd->fbi.starta = (INT32)(vd->fbi.svert[0].a * 4096.0f); + vd->fbi.dadx = (INT32)(((vd->fbi.svert[0].a - vd->fbi.svert[1].a) * dx1 - (vd->fbi.svert[0].a - vd->fbi.svert[2].a) * dx2) * tdiv); + vd->fbi.dady = (INT32)(((vd->fbi.svert[0].a - vd->fbi.svert[2].a) * dy1 - (vd->fbi.svert[0].a - vd->fbi.svert[1].a) * dy2) * tdiv); } /* set up Z */ - if (v->reg[sSetupMode].u & (1 << 2)) + if (vd->reg[sSetupMode].u & (1 << 2)) { - v->fbi.startz = (INT32)(v->fbi.svert[0].z * 4096.0f); - v->fbi.dzdx = (INT32)(((v->fbi.svert[0].z - v->fbi.svert[1].z) * dx1 - (v->fbi.svert[0].z - v->fbi.svert[2].z) * dx2) * tdiv); - v->fbi.dzdy = (INT32)(((v->fbi.svert[0].z - v->fbi.svert[2].z) * dy1 - (v->fbi.svert[0].z - v->fbi.svert[1].z) * dy2) * tdiv); + vd->fbi.startz = (INT32)(vd->fbi.svert[0].z * 4096.0f); + vd->fbi.dzdx = (INT32)(((vd->fbi.svert[0].z - vd->fbi.svert[1].z) * dx1 - (vd->fbi.svert[0].z - vd->fbi.svert[2].z) * dx2) * tdiv); + vd->fbi.dzdy = (INT32)(((vd->fbi.svert[0].z - vd->fbi.svert[2].z) * dy1 - (vd->fbi.svert[0].z - vd->fbi.svert[1].z) * dy2) * tdiv); } /* set up Wb */ tdiv = divisor * 65536.0f * 65536.0f; - if (v->reg[sSetupMode].u & (1 << 3)) + if (vd->reg[sSetupMode].u & (1 << 3)) { - v->fbi.startw = v->tmu[0].startw = v->tmu[1].startw = (INT64)(v->fbi.svert[0].wb * 65536.0f * 65536.0f); - v->fbi.dwdx = v->tmu[0].dwdx = v->tmu[1].dwdx = ((v->fbi.svert[0].wb - v->fbi.svert[1].wb) * dx1 - (v->fbi.svert[0].wb - v->fbi.svert[2].wb) * dx2) * tdiv; - v->fbi.dwdy = v->tmu[0].dwdy = v->tmu[1].dwdy = ((v->fbi.svert[0].wb - v->fbi.svert[2].wb) * dy1 - (v->fbi.svert[0].wb - v->fbi.svert[1].wb) * dy2) * tdiv; + vd->fbi.startw = vd->tmu[0].startw = vd->tmu[1].startw = (INT64)(vd->fbi.svert[0].wb * 65536.0f * 65536.0f); + vd->fbi.dwdx = vd->tmu[0].dwdx = vd->tmu[1].dwdx = ((vd->fbi.svert[0].wb - vd->fbi.svert[1].wb) * dx1 - (vd->fbi.svert[0].wb - vd->fbi.svert[2].wb) * dx2) * tdiv; + vd->fbi.dwdy = vd->tmu[0].dwdy = vd->tmu[1].dwdy = ((vd->fbi.svert[0].wb - vd->fbi.svert[2].wb) * dy1 - (vd->fbi.svert[0].wb - vd->fbi.svert[1].wb) * dy2) * tdiv; } /* set up W0 */ - if (v->reg[sSetupMode].u & (1 << 4)) + if (vd->reg[sSetupMode].u & (1 << 4)) { - v->tmu[0].startw = v->tmu[1].startw = (INT64)(v->fbi.svert[0].w0 * 65536.0f * 65536.0f); - v->tmu[0].dwdx = v->tmu[1].dwdx = ((v->fbi.svert[0].w0 - v->fbi.svert[1].w0) * dx1 - (v->fbi.svert[0].w0 - v->fbi.svert[2].w0) * dx2) * tdiv; - v->tmu[0].dwdy = v->tmu[1].dwdy = ((v->fbi.svert[0].w0 - v->fbi.svert[2].w0) * dy1 - (v->fbi.svert[0].w0 - v->fbi.svert[1].w0) * dy2) * tdiv; + vd->tmu[0].startw = vd->tmu[1].startw = (INT64)(vd->fbi.svert[0].w0 * 65536.0f * 65536.0f); + vd->tmu[0].dwdx = vd->tmu[1].dwdx = ((vd->fbi.svert[0].w0 - vd->fbi.svert[1].w0) * dx1 - (vd->fbi.svert[0].w0 - vd->fbi.svert[2].w0) * dx2) * tdiv; + vd->tmu[0].dwdy = vd->tmu[1].dwdy = ((vd->fbi.svert[0].w0 - vd->fbi.svert[2].w0) * dy1 - (vd->fbi.svert[0].w0 - vd->fbi.svert[1].w0) * dy2) * tdiv; } /* set up S0,T0 */ - if (v->reg[sSetupMode].u & (1 << 5)) + if (vd->reg[sSetupMode].u & (1 << 5)) { - v->tmu[0].starts = v->tmu[1].starts = (INT64)(v->fbi.svert[0].s0 * 65536.0f * 65536.0f); - v->tmu[0].dsdx = v->tmu[1].dsdx = ((v->fbi.svert[0].s0 - v->fbi.svert[1].s0) * dx1 - (v->fbi.svert[0].s0 - v->fbi.svert[2].s0) * dx2) * tdiv; - v->tmu[0].dsdy = v->tmu[1].dsdy = ((v->fbi.svert[0].s0 - v->fbi.svert[2].s0) * dy1 - (v->fbi.svert[0].s0 - v->fbi.svert[1].s0) * dy2) * tdiv; - v->tmu[0].startt = v->tmu[1].startt = (INT64)(v->fbi.svert[0].t0 * 65536.0f * 65536.0f); - v->tmu[0].dtdx = v->tmu[1].dtdx = ((v->fbi.svert[0].t0 - v->fbi.svert[1].t0) * dx1 - (v->fbi.svert[0].t0 - v->fbi.svert[2].t0) * dx2) * tdiv; - v->tmu[0].dtdy = v->tmu[1].dtdy = ((v->fbi.svert[0].t0 - v->fbi.svert[2].t0) * dy1 - (v->fbi.svert[0].t0 - v->fbi.svert[1].t0) * dy2) * tdiv; + vd->tmu[0].starts = vd->tmu[1].starts = (INT64)(vd->fbi.svert[0].s0 * 65536.0f * 65536.0f); + vd->tmu[0].dsdx = vd->tmu[1].dsdx = ((vd->fbi.svert[0].s0 - vd->fbi.svert[1].s0) * dx1 - (vd->fbi.svert[0].s0 - vd->fbi.svert[2].s0) * dx2) * tdiv; + vd->tmu[0].dsdy = vd->tmu[1].dsdy = ((vd->fbi.svert[0].s0 - vd->fbi.svert[2].s0) * dy1 - (vd->fbi.svert[0].s0 - vd->fbi.svert[1].s0) * dy2) * tdiv; + vd->tmu[0].startt = vd->tmu[1].startt = (INT64)(vd->fbi.svert[0].t0 * 65536.0f * 65536.0f); + vd->tmu[0].dtdx = vd->tmu[1].dtdx = ((vd->fbi.svert[0].t0 - vd->fbi.svert[1].t0) * dx1 - (vd->fbi.svert[0].t0 - vd->fbi.svert[2].t0) * dx2) * tdiv; + vd->tmu[0].dtdy = vd->tmu[1].dtdy = ((vd->fbi.svert[0].t0 - vd->fbi.svert[2].t0) * dy1 - (vd->fbi.svert[0].t0 - vd->fbi.svert[1].t0) * dy2) * tdiv; } /* set up W1 */ - if (v->reg[sSetupMode].u & (1 << 6)) + if (vd->reg[sSetupMode].u & (1 << 6)) { - v->tmu[1].startw = (INT64)(v->fbi.svert[0].w1 * 65536.0f * 65536.0f); - v->tmu[1].dwdx = ((v->fbi.svert[0].w1 - v->fbi.svert[1].w1) * dx1 - (v->fbi.svert[0].w1 - v->fbi.svert[2].w1) * dx2) * tdiv; - v->tmu[1].dwdy = ((v->fbi.svert[0].w1 - v->fbi.svert[2].w1) * dy1 - (v->fbi.svert[0].w1 - v->fbi.svert[1].w1) * dy2) * tdiv; + vd->tmu[1].startw = (INT64)(vd->fbi.svert[0].w1 * 65536.0f * 65536.0f); + vd->tmu[1].dwdx = ((vd->fbi.svert[0].w1 - vd->fbi.svert[1].w1) * dx1 - (vd->fbi.svert[0].w1 - vd->fbi.svert[2].w1) * dx2) * tdiv; + vd->tmu[1].dwdy = ((vd->fbi.svert[0].w1 - vd->fbi.svert[2].w1) * dy1 - (vd->fbi.svert[0].w1 - vd->fbi.svert[1].w1) * dy2) * tdiv; } /* set up S1,T1 */ - if (v->reg[sSetupMode].u & (1 << 7)) + if (vd->reg[sSetupMode].u & (1 << 7)) { - v->tmu[1].starts = (INT64)(v->fbi.svert[0].s1 * 65536.0f * 65536.0f); - v->tmu[1].dsdx = ((v->fbi.svert[0].s1 - v->fbi.svert[1].s1) * dx1 - (v->fbi.svert[0].s1 - v->fbi.svert[2].s1) * dx2) * tdiv; - v->tmu[1].dsdy = ((v->fbi.svert[0].s1 - v->fbi.svert[2].s1) * dy1 - (v->fbi.svert[0].s1 - v->fbi.svert[1].s1) * dy2) * tdiv; - v->tmu[1].startt = (INT64)(v->fbi.svert[0].t1 * 65536.0f * 65536.0f); - v->tmu[1].dtdx = ((v->fbi.svert[0].t1 - v->fbi.svert[1].t1) * dx1 - (v->fbi.svert[0].t1 - v->fbi.svert[2].t1) * dx2) * tdiv; - v->tmu[1].dtdy = ((v->fbi.svert[0].t1 - v->fbi.svert[2].t1) * dy1 - (v->fbi.svert[0].t1 - v->fbi.svert[1].t1) * dy2) * tdiv; + vd->tmu[1].starts = (INT64)(vd->fbi.svert[0].s1 * 65536.0f * 65536.0f); + vd->tmu[1].dsdx = ((vd->fbi.svert[0].s1 - vd->fbi.svert[1].s1) * dx1 - (vd->fbi.svert[0].s1 - vd->fbi.svert[2].s1) * dx2) * tdiv; + vd->tmu[1].dsdy = ((vd->fbi.svert[0].s1 - vd->fbi.svert[2].s1) * dy1 - (vd->fbi.svert[0].s1 - vd->fbi.svert[1].s1) * dy2) * tdiv; + vd->tmu[1].startt = (INT64)(vd->fbi.svert[0].t1 * 65536.0f * 65536.0f); + vd->tmu[1].dtdx = ((vd->fbi.svert[0].t1 - vd->fbi.svert[1].t1) * dx1 - (vd->fbi.svert[0].t1 - vd->fbi.svert[2].t1) * dx2) * tdiv; + vd->tmu[1].dtdy = ((vd->fbi.svert[0].t1 - vd->fbi.svert[2].t1) * dy1 - (vd->fbi.svert[0].t1 - vd->fbi.svert[1].t1) * dy2) * tdiv; } /* draw the triangle */ - v->fbi.cheating_allowed = 1; - return triangle(v); + vd->fbi.cheating_allowed = 1; + return triangle(vd); } @@ -5591,81 +5518,82 @@ static INT32 setup_and_draw_triangle(voodoo_state *v) setup and create the work item -------------------------------------------------*/ -static INT32 triangle_create_work_item(voodoo_state *v, UINT16 *drawbuf, int texcount) +INT32 voodoo_device::triangle_create_work_item(voodoo_device* vd, UINT16 *drawbuf, int texcount) { - poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(v->poly); - raster_info *info = find_rasterizer(v, texcount); + poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(vd->poly); + + raster_info *info = find_rasterizer(vd, texcount); poly_vertex vert[3]; /* fill in the vertex data */ - vert[0].x = (float)v->fbi.ax * (1.0f / 16.0f); - vert[0].y = (float)v->fbi.ay * (1.0f / 16.0f); - vert[1].x = (float)v->fbi.bx * (1.0f / 16.0f); - vert[1].y = (float)v->fbi.by * (1.0f / 16.0f); - vert[2].x = (float)v->fbi.cx * (1.0f / 16.0f); - vert[2].y = (float)v->fbi.cy * (1.0f / 16.0f); + vert[0].x = (float)vd->fbi.ax * (1.0f / 16.0f); + vert[0].y = (float)vd->fbi.ay * (1.0f / 16.0f); + vert[1].x = (float)vd->fbi.bx * (1.0f / 16.0f); + vert[1].y = (float)vd->fbi.by * (1.0f / 16.0f); + vert[2].x = (float)vd->fbi.cx * (1.0f / 16.0f); + vert[2].y = (float)vd->fbi.cy * (1.0f / 16.0f); /* fill in the extra data */ - extra->state = v; + extra->device = vd; extra->info = info; /* fill in triangle parameters */ - extra->ax = v->fbi.ax; - extra->ay = v->fbi.ay; - extra->startr = v->fbi.startr; - extra->startg = v->fbi.startg; - extra->startb = v->fbi.startb; - extra->starta = v->fbi.starta; - extra->startz = v->fbi.startz; - extra->startw = v->fbi.startw; - extra->drdx = v->fbi.drdx; - extra->dgdx = v->fbi.dgdx; - extra->dbdx = v->fbi.dbdx; - extra->dadx = v->fbi.dadx; - extra->dzdx = v->fbi.dzdx; - extra->dwdx = v->fbi.dwdx; - extra->drdy = v->fbi.drdy; - extra->dgdy = v->fbi.dgdy; - extra->dbdy = v->fbi.dbdy; - extra->dady = v->fbi.dady; - extra->dzdy = v->fbi.dzdy; - extra->dwdy = v->fbi.dwdy; + extra->ax = vd->fbi.ax; + extra->ay = vd->fbi.ay; + extra->startr = vd->fbi.startr; + extra->startg = vd->fbi.startg; + extra->startb = vd->fbi.startb; + extra->starta = vd->fbi.starta; + extra->startz = vd->fbi.startz; + extra->startw = vd->fbi.startw; + extra->drdx = vd->fbi.drdx; + extra->dgdx = vd->fbi.dgdx; + extra->dbdx = vd->fbi.dbdx; + extra->dadx = vd->fbi.dadx; + extra->dzdx = vd->fbi.dzdx; + extra->dwdx = vd->fbi.dwdx; + extra->drdy = vd->fbi.drdy; + extra->dgdy = vd->fbi.dgdy; + extra->dbdy = vd->fbi.dbdy; + extra->dady = vd->fbi.dady; + extra->dzdy = vd->fbi.dzdy; + extra->dwdy = vd->fbi.dwdy; /* fill in texture 0 parameters */ if (texcount > 0) { - extra->starts0 = v->tmu[0].starts; - extra->startt0 = v->tmu[0].startt; - extra->startw0 = v->tmu[0].startw; - extra->ds0dx = v->tmu[0].dsdx; - extra->dt0dx = v->tmu[0].dtdx; - extra->dw0dx = v->tmu[0].dwdx; - extra->ds0dy = v->tmu[0].dsdy; - extra->dt0dy = v->tmu[0].dtdy; - extra->dw0dy = v->tmu[0].dwdy; - extra->lodbase0 = prepare_tmu(&v->tmu[0]); - v->stats.texture_mode[TEXMODE_FORMAT(v->tmu[0].reg[textureMode].u)]++; + extra->starts0 = vd->tmu[0].starts; + extra->startt0 = vd->tmu[0].startt; + extra->startw0 = vd->tmu[0].startw; + extra->ds0dx = vd->tmu[0].dsdx; + extra->dt0dx = vd->tmu[0].dtdx; + extra->dw0dx = vd->tmu[0].dwdx; + extra->ds0dy = vd->tmu[0].dsdy; + extra->dt0dy = vd->tmu[0].dtdy; + extra->dw0dy = vd->tmu[0].dwdy; + extra->lodbase0 = prepare_tmu(&vd->tmu[0]); + vd->stats.texture_mode[TEXMODE_FORMAT(vd->tmu[0].reg[textureMode].u)]++; /* fill in texture 1 parameters */ if (texcount > 1) { - extra->starts1 = v->tmu[1].starts; - extra->startt1 = v->tmu[1].startt; - extra->startw1 = v->tmu[1].startw; - extra->ds1dx = v->tmu[1].dsdx; - extra->dt1dx = v->tmu[1].dtdx; - extra->dw1dx = v->tmu[1].dwdx; - extra->ds1dy = v->tmu[1].dsdy; - extra->dt1dy = v->tmu[1].dtdy; - extra->dw1dy = v->tmu[1].dwdy; - extra->lodbase1 = prepare_tmu(&v->tmu[1]); - v->stats.texture_mode[TEXMODE_FORMAT(v->tmu[1].reg[textureMode].u)]++; + extra->starts1 = vd->tmu[1].starts; + extra->startt1 = vd->tmu[1].startt; + extra->startw1 = vd->tmu[1].startw; + extra->ds1dx = vd->tmu[1].dsdx; + extra->dt1dx = vd->tmu[1].dtdx; + extra->dw1dx = vd->tmu[1].dwdx; + extra->ds1dy = vd->tmu[1].dsdy; + extra->dt1dy = vd->tmu[1].dtdy; + extra->dw1dy = vd->tmu[1].dwdy; + extra->lodbase1 = prepare_tmu(&vd->tmu[1]); + vd->stats.texture_mode[TEXMODE_FORMAT(vd->tmu[1].reg[textureMode].u)]++; } } /* farm the rasterization out to other threads */ info->polys++; - return poly_render_triangle(v->poly, drawbuf, global_cliprect, info->callback, 0, &vert[0], &vert[1], &vert[2]); + return poly_render_triangle(vd->poly, drawbuf, global_cliprect, info->callback, 0, &vert[0], &vert[1], &vert[2]); } @@ -5679,12 +5607,12 @@ static INT32 triangle_create_work_item(voodoo_state *v, UINT16 *drawbuf, int tex hash table -------------------------------------------------*/ -static raster_info *add_rasterizer(voodoo_state *v, const raster_info *cinfo) +raster_info *voodoo_device::add_rasterizer(voodoo_device *vd, const raster_info *cinfo) { - raster_info *info = &v->rasterizer[v->next_rasterizer++]; + raster_info *info = &vd->rasterizer[vd->next_rasterizer++]; int hash = compute_raster_hash(cinfo); - assert_always(v->next_rasterizer <= MAX_RASTERIZERS, "Out of space for new rasterizers!"); + assert_always(vd->next_rasterizer <= MAX_RASTERIZERS, "Out of space for new rasterizers!"); /* make a copy of the info */ *info = *cinfo; @@ -5695,8 +5623,8 @@ static raster_info *add_rasterizer(voodoo_state *v, const raster_info *cinfo) info->hash = hash; /* hook us into the hash table */ - info->next = v->raster_hash[hash]; - v->raster_hash[hash] = info; + info->next = vd->raster_hash[hash]; + vd->raster_hash[hash] = info; if (LOG_RASTERIZERS) printf("Adding rasterizer @ %p : cp=%08X am=%08X %08X fbzM=%08X tm0=%08X tm1=%08X (hash=%d)\n", @@ -5714,25 +5642,25 @@ static raster_info *add_rasterizer(voodoo_state *v, const raster_info *cinfo) it, creating a new one if necessary -------------------------------------------------*/ -static raster_info *find_rasterizer(voodoo_state *v, int texcount) +raster_info *voodoo_device::find_rasterizer(voodoo_device *vd, int texcount) { raster_info *info, *prev = nullptr; raster_info curinfo; int hash; /* build an info struct with all the parameters */ - curinfo.eff_color_path = normalize_color_path(v->reg[fbzColorPath].u); - curinfo.eff_alpha_mode = normalize_alpha_mode(v->reg[alphaMode].u); - curinfo.eff_fog_mode = normalize_fog_mode(v->reg[fogMode].u); - curinfo.eff_fbz_mode = normalize_fbz_mode(v->reg[fbzMode].u); - curinfo.eff_tex_mode_0 = (texcount >= 1) ? normalize_tex_mode(v->tmu[0].reg[textureMode].u) : 0xffffffff; - curinfo.eff_tex_mode_1 = (texcount >= 2) ? normalize_tex_mode(v->tmu[1].reg[textureMode].u) : 0xffffffff; + curinfo.eff_color_path = normalize_color_path(vd->reg[fbzColorPath].u); + curinfo.eff_alpha_mode = normalize_alpha_mode(vd->reg[alphaMode].u); + curinfo.eff_fog_mode = normalize_fog_mode(vd->reg[fogMode].u); + curinfo.eff_fbz_mode = normalize_fbz_mode(vd->reg[fbzMode].u); + curinfo.eff_tex_mode_0 = (texcount >= 1) ? normalize_tex_mode(vd->tmu[0].reg[textureMode].u) : 0xffffffff; + curinfo.eff_tex_mode_1 = (texcount >= 2) ? normalize_tex_mode(vd->tmu[1].reg[textureMode].u) : 0xffffffff; /* compute the hash */ hash = compute_raster_hash(&curinfo); /* find the appropriate hash entry */ - for (info = v->raster_hash[hash]; info; prev = info, info = info->next) + for (info = vd->raster_hash[hash]; info; prev = info, info = info->next) if (info->eff_color_path == curinfo.eff_color_path && info->eff_alpha_mode == curinfo.eff_alpha_mode && info->eff_fog_mode == curinfo.eff_fog_mode && @@ -5744,8 +5672,8 @@ static raster_info *find_rasterizer(voodoo_state *v, int texcount) if (prev) { prev->next = info->next; - info->next = v->raster_hash[hash]; - v->raster_hash[hash] = info; + info->next = vd->raster_hash[hash]; + vd->raster_hash[hash] = info; } /* return the result */ @@ -5761,7 +5689,7 @@ static raster_info *find_rasterizer(voodoo_state *v, int texcount) curinfo.next = nullptr; curinfo.hash = hash; - return add_rasterizer(v, &curinfo); + return add_rasterizer(vd, &curinfo); } @@ -5770,7 +5698,7 @@ static raster_info *find_rasterizer(voodoo_state *v, int texcount) the current rasterizer usage patterns -------------------------------------------------*/ -static void dump_rasterizer_stats(voodoo_state *v) +void voodoo_device::dump_rasterizer_stats(voodoo_device *vd) { static UINT8 display_index; raster_info *cur, *best; @@ -5786,7 +5714,7 @@ static void dump_rasterizer_stats(voodoo_state *v) /* find the highest entry */ for (hash = 0; hash < RASTER_HASH_SIZE; hash++) - for (cur = v->raster_hash[hash]; cur; cur = cur->next) + for (cur = vd->raster_hash[hash]; cur; cur = cur->next) if (cur->display != display_index && (best == nullptr || cur->hits > best->hits)) best = cur; @@ -5822,12 +5750,10 @@ voodoo_device::voodoo_device(const machine_config &mconfig, device_type type, co m_vblank(*this), m_stall(*this) { - m_token = global_alloc_clear(); } voodoo_device::~voodoo_device() { - global_free(m_token); } //------------------------------------------------- @@ -5846,8 +5772,7 @@ void voodoo_device::device_config_complete() void voodoo_device::device_reset() { - voodoo_state *v = get_safe_token(this); - soft_reset(v); + soft_reset(this); } //------------------------------------------------- @@ -5856,11 +5781,9 @@ void voodoo_device::device_reset() void voodoo_device::device_stop() { - voodoo_state *v = get_safe_token(this); - /* release the work queue, ensuring all work is finished */ - if (v->poly != nullptr) - poly_free(v->poly); + if (poly != nullptr) + poly_free(poly); } @@ -5947,26 +5870,26 @@ void voodoo_3_device::device_start() implementation of the 'fastfill' command -------------------------------------------------*/ -static void raster_fastfill(void *destbase, INT32 y, const poly_extent *extent, const void *extradata, int threadid) +void voodoo_device::raster_fastfill(void *destbase, INT32 y, const poly_extent *extent, const void *extradata, int threadid) { const poly_extra_data *extra = (const poly_extra_data *)extradata; - voodoo_state *v = extra->state; - stats_block *stats = &v->thread_stats[threadid]; + voodoo_device* vd = extra->device; + stats_block *stats = &vd->thread_stats[threadid]; INT32 startx = extent->startx; INT32 stopx = extent->stopx; int scry, x; /* determine the screen Y */ scry = y; - if (FBZMODE_Y_ORIGIN(v->reg[fbzMode].u)) - scry = (v->fbi.yorigin - y) & 0x3ff; + if (FBZMODE_Y_ORIGIN(vd->reg[fbzMode].u)) + scry = (vd->fbi.yorigin - y) & 0x3ff; /* fill this RGB row */ - if (FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u)) + if (FBZMODE_RGB_BUFFER_MASK(vd->reg[fbzMode].u)) { const UINT16 *ditherow = &extra->dither[(y & 3) * 4]; UINT64 expanded = *(UINT64 *)ditherow; - UINT16 *dest = (UINT16 *)destbase + scry * v->fbi.rowpixels; + UINT16 *dest = (UINT16 *)destbase + scry * vd->fbi.rowpixels; for (x = startx; x < stopx && (x & 3) != 0; x++) dest[x] = ditherow[x & 3]; @@ -5978,11 +5901,11 @@ static void raster_fastfill(void *destbase, INT32 y, const poly_extent *extent, } /* fill this dest buffer row */ - if (FBZMODE_AUX_BUFFER_MASK(v->reg[fbzMode].u) && v->fbi.auxoffs != ~0) + if (FBZMODE_AUX_BUFFER_MASK(vd->reg[fbzMode].u) && vd->fbi.auxoffs != ~0) { - UINT16 color = v->reg[zaColor].u; + UINT16 color = vd->reg[zaColor].u; UINT64 expanded = ((UINT64)color << 48) | ((UINT64)color << 32) | (color << 16) | color; - UINT16 *dest = (UINT16 *)(v->fbi.ram + v->fbi.auxoffs) + scry * v->fbi.rowpixels; + UINT16 *dest = (UINT16 *)(vd->fbi.ram + vd->fbi.auxoffs) + scry * vd->fbi.rowpixels; for (x = startx; x < stopx && (x & 3) != 0; x++) dest[x] = color; @@ -5998,21 +5921,21 @@ static void raster_fastfill(void *destbase, INT32 y, const poly_extent *extent, generic_0tmu - generic rasterizer for 0 TMUs -------------------------------------------------*/ -RASTERIZER(generic_0tmu, 0, v->reg[fbzColorPath].u, v->reg[fbzMode].u, v->reg[alphaMode].u, - v->reg[fogMode].u, 0, 0) +RASTERIZER(generic_0tmu, 0, vd->reg[fbzColorPath].u, vd->reg[fbzMode].u, vd->reg[alphaMode].u, + vd->reg[fogMode].u, 0, 0) /*------------------------------------------------- generic_1tmu - generic rasterizer for 1 TMU -------------------------------------------------*/ -RASTERIZER(generic_1tmu, 1, v->reg[fbzColorPath].u, v->reg[fbzMode].u, v->reg[alphaMode].u, - v->reg[fogMode].u, v->tmu[0].reg[textureMode].u, 0) +RASTERIZER(generic_1tmu, 1, vd->reg[fbzColorPath].u, vd->reg[fbzMode].u, vd->reg[alphaMode].u, + vd->reg[fogMode].u, vd->tmu[0].reg[textureMode].u, 0) /*------------------------------------------------- generic_2tmu - generic rasterizer for 2 TMUs -------------------------------------------------*/ -RASTERIZER(generic_2tmu, 2, v->reg[fbzColorPath].u, v->reg[fbzMode].u, v->reg[alphaMode].u, - v->reg[fogMode].u, v->tmu[0].reg[textureMode].u, v->tmu[1].reg[textureMode].u) +RASTERIZER(generic_2tmu, 2, vd->reg[fbzColorPath].u, vd->reg[fbzMode].u, vd->reg[alphaMode].u, + vd->reg[fogMode].u, vd->tmu[0].reg[textureMode].u, vd->tmu[1].reg[textureMode].u) diff --git a/src/devices/video/voodoo.h b/src/devices/video/voodoo.h index 3d92f17f86a..1dc1a4a59ec 100644 --- a/src/devices/video/voodoo.h +++ b/src/devices/video/voodoo.h @@ -11,9 +11,1694 @@ #ifndef __VOODOO_H__ #define __VOODOO_H__ +#include "video/polylgcy.h" + #pragma once +/************************************* + * + * Misc. constants + * + *************************************/ + +/* enumeration describing reasons we might be stalled */ +enum +{ + NOT_STALLED = 0, + STALLED_UNTIL_FIFO_LWM, + STALLED_UNTIL_FIFO_EMPTY +}; + + + +// Use old table lookup versus straight double divide +#define USE_FAST_RECIP 0 + +/* maximum number of TMUs */ +#define MAX_TMU 2 + +/* accumulate operations less than this number of clocks */ +#define ACCUMULATE_THRESHOLD 0 + +/* number of clocks to set up a triangle (just a guess) */ +#define TRIANGLE_SETUP_CLOCKS 100 + +/* maximum number of rasterizers */ +#define MAX_RASTERIZERS 1024 + +/* size of the rasterizer hash table */ +#define RASTER_HASH_SIZE 97 + +/* flags for LFB writes */ +#define LFB_RGB_PRESENT 1 +#define LFB_ALPHA_PRESENT 2 +#define LFB_DEPTH_PRESENT 4 +#define LFB_DEPTH_PRESENT_MSW 8 + +/* flags for the register access array */ +#define REGISTER_READ 0x01 /* reads are allowed */ +#define REGISTER_WRITE 0x02 /* writes are allowed */ +#define REGISTER_PIPELINED 0x04 /* writes are pipelined */ +#define REGISTER_FIFO 0x08 /* writes go to FIFO */ +#define REGISTER_WRITETHRU 0x10 /* writes are valid even for CMDFIFO */ + +/* shorter combinations to make the table smaller */ +#define REG_R (REGISTER_READ) +#define REG_W (REGISTER_WRITE) +#define REG_WT (REGISTER_WRITE | REGISTER_WRITETHRU) +#define REG_RW (REGISTER_READ | REGISTER_WRITE) +#define REG_RWT (REGISTER_READ | REGISTER_WRITE | REGISTER_WRITETHRU) +#define REG_RP (REGISTER_READ | REGISTER_PIPELINED) +#define REG_WP (REGISTER_WRITE | REGISTER_PIPELINED) +#define REG_RWP (REGISTER_READ | REGISTER_WRITE | REGISTER_PIPELINED) +#define REG_RWPT (REGISTER_READ | REGISTER_WRITE | REGISTER_PIPELINED | REGISTER_WRITETHRU) +#define REG_RF (REGISTER_READ | REGISTER_FIFO) +#define REG_WF (REGISTER_WRITE | REGISTER_FIFO) +#define REG_RWF (REGISTER_READ | REGISTER_WRITE | REGISTER_FIFO) +#define REG_RPF (REGISTER_READ | REGISTER_PIPELINED | REGISTER_FIFO) +#define REG_WPF (REGISTER_WRITE | REGISTER_PIPELINED | REGISTER_FIFO) +#define REG_RWPF (REGISTER_READ | REGISTER_WRITE | REGISTER_PIPELINED | REGISTER_FIFO) + +/* lookup bits is the log2 of the size of the reciprocal/log table */ +#define RECIPLOG_LOOKUP_BITS 9 + +/* input precision is how many fraction bits the input value has; this is a 64-bit number */ +#define RECIPLOG_INPUT_PREC 32 + +/* lookup precision is how many fraction bits each table entry contains */ +#define RECIPLOG_LOOKUP_PREC 22 + +/* output precision is how many fraction bits the result should have */ +#define RECIP_OUTPUT_PREC 15 +#define LOG_OUTPUT_PREC 8 + + + +/************************************* + * + * Register constants + * + *************************************/ + +/* Codes to the right: + R = readable + W = writeable + P = pipelined + F = goes to FIFO +*/ + +/* 0x000 */ +#define vdstatus (0x000/4) /* R P */ +#define intrCtrl (0x004/4) /* RW P -- Voodoo2/Banshee only */ +#define vertexAx (0x008/4) /* W PF */ +#define vertexAy (0x00c/4) /* W PF */ +#define vertexBx (0x010/4) /* W PF */ +#define vertexBy (0x014/4) /* W PF */ +#define vertexCx (0x018/4) /* W PF */ +#define vertexCy (0x01c/4) /* W PF */ +#define startR (0x020/4) /* W PF */ +#define startG (0x024/4) /* W PF */ +#define startB (0x028/4) /* W PF */ +#define startZ (0x02c/4) /* W PF */ +#define startA (0x030/4) /* W PF */ +#define startS (0x034/4) /* W PF */ +#define startT (0x038/4) /* W PF */ +#define startW (0x03c/4) /* W PF */ + +/* 0x040 */ +#define dRdX (0x040/4) /* W PF */ +#define dGdX (0x044/4) /* W PF */ +#define dBdX (0x048/4) /* W PF */ +#define dZdX (0x04c/4) /* W PF */ +#define dAdX (0x050/4) /* W PF */ +#define dSdX (0x054/4) /* W PF */ +#define dTdX (0x058/4) /* W PF */ +#define dWdX (0x05c/4) /* W PF */ +#define dRdY (0x060/4) /* W PF */ +#define dGdY (0x064/4) /* W PF */ +#define dBdY (0x068/4) /* W PF */ +#define dZdY (0x06c/4) /* W PF */ +#define dAdY (0x070/4) /* W PF */ +#define dSdY (0x074/4) /* W PF */ +#define dTdY (0x078/4) /* W PF */ +#define dWdY (0x07c/4) /* W PF */ + +/* 0x080 */ +#define triangleCMD (0x080/4) /* W PF */ +#define fvertexAx (0x088/4) /* W PF */ +#define fvertexAy (0x08c/4) /* W PF */ +#define fvertexBx (0x090/4) /* W PF */ +#define fvertexBy (0x094/4) /* W PF */ +#define fvertexCx (0x098/4) /* W PF */ +#define fvertexCy (0x09c/4) /* W PF */ +#define fstartR (0x0a0/4) /* W PF */ +#define fstartG (0x0a4/4) /* W PF */ +#define fstartB (0x0a8/4) /* W PF */ +#define fstartZ (0x0ac/4) /* W PF */ +#define fstartA (0x0b0/4) /* W PF */ +#define fstartS (0x0b4/4) /* W PF */ +#define fstartT (0x0b8/4) /* W PF */ +#define fstartW (0x0bc/4) /* W PF */ + +/* 0x0c0 */ +#define fdRdX (0x0c0/4) /* W PF */ +#define fdGdX (0x0c4/4) /* W PF */ +#define fdBdX (0x0c8/4) /* W PF */ +#define fdZdX (0x0cc/4) /* W PF */ +#define fdAdX (0x0d0/4) /* W PF */ +#define fdSdX (0x0d4/4) /* W PF */ +#define fdTdX (0x0d8/4) /* W PF */ +#define fdWdX (0x0dc/4) /* W PF */ +#define fdRdY (0x0e0/4) /* W PF */ +#define fdGdY (0x0e4/4) /* W PF */ +#define fdBdY (0x0e8/4) /* W PF */ +#define fdZdY (0x0ec/4) /* W PF */ +#define fdAdY (0x0f0/4) /* W PF */ +#define fdSdY (0x0f4/4) /* W PF */ +#define fdTdY (0x0f8/4) /* W PF */ +#define fdWdY (0x0fc/4) /* W PF */ + +/* 0x100 */ +#define ftriangleCMD (0x100/4) /* W PF */ +#define fbzColorPath (0x104/4) /* RW PF */ +#define fogMode (0x108/4) /* RW PF */ +#define alphaMode (0x10c/4) /* RW PF */ +#define fbzMode (0x110/4) /* RW F */ +#define lfbMode (0x114/4) /* RW F */ +#define clipLeftRight (0x118/4) /* RW F */ +#define clipLowYHighY (0x11c/4) /* RW F */ +#define nopCMD (0x120/4) /* W F */ +#define fastfillCMD (0x124/4) /* W F */ +#define swapbufferCMD (0x128/4) /* W F */ +#define fogColor (0x12c/4) /* W F */ +#define zaColor (0x130/4) /* W F */ +#define chromaKey (0x134/4) /* W F */ +#define chromaRange (0x138/4) /* W F -- Voodoo2/Banshee only */ +#define userIntrCMD (0x13c/4) /* W F -- Voodoo2/Banshee only */ + +/* 0x140 */ +#define stipple (0x140/4) /* RW F */ +#define color0 (0x144/4) /* RW F */ +#define color1 (0x148/4) /* RW F */ +#define fbiPixelsIn (0x14c/4) /* R */ +#define fbiChromaFail (0x150/4) /* R */ +#define fbiZfuncFail (0x154/4) /* R */ +#define fbiAfuncFail (0x158/4) /* R */ +#define fbiPixelsOut (0x15c/4) /* R */ +#define fogTable (0x160/4) /* W F */ + +/* 0x1c0 */ +#define cmdFifoBaseAddr (0x1e0/4) /* RW -- Voodoo2 only */ +#define cmdFifoBump (0x1e4/4) /* RW -- Voodoo2 only */ +#define cmdFifoRdPtr (0x1e8/4) /* RW -- Voodoo2 only */ +#define cmdFifoAMin (0x1ec/4) /* RW -- Voodoo2 only */ +#define colBufferAddr (0x1ec/4) /* RW -- Banshee only */ +#define cmdFifoAMax (0x1f0/4) /* RW -- Voodoo2 only */ +#define colBufferStride (0x1f0/4) /* RW -- Banshee only */ +#define cmdFifoDepth (0x1f4/4) /* RW -- Voodoo2 only */ +#define auxBufferAddr (0x1f4/4) /* RW -- Banshee only */ +#define cmdFifoHoles (0x1f8/4) /* RW -- Voodoo2 only */ +#define auxBufferStride (0x1f8/4) /* RW -- Banshee only */ + +/* 0x200 */ +#define fbiInit4 (0x200/4) /* RW -- Voodoo/Voodoo2 only */ +#define clipLeftRight1 (0x200/4) /* RW -- Banshee only */ +#define vRetrace (0x204/4) /* R -- Voodoo/Voodoo2 only */ +#define clipTopBottom1 (0x204/4) /* RW -- Banshee only */ +#define backPorch (0x208/4) /* RW -- Voodoo/Voodoo2 only */ +#define videoDimensions (0x20c/4) /* RW -- Voodoo/Voodoo2 only */ +#define fbiInit0 (0x210/4) /* RW -- Voodoo/Voodoo2 only */ +#define fbiInit1 (0x214/4) /* RW -- Voodoo/Voodoo2 only */ +#define fbiInit2 (0x218/4) /* RW -- Voodoo/Voodoo2 only */ +#define fbiInit3 (0x21c/4) /* RW -- Voodoo/Voodoo2 only */ +#define hSync (0x220/4) /* W -- Voodoo/Voodoo2 only */ +#define vSync (0x224/4) /* W -- Voodoo/Voodoo2 only */ +#define clutData (0x228/4) /* W F -- Voodoo/Voodoo2 only */ +#define dacData (0x22c/4) /* W -- Voodoo/Voodoo2 only */ +#define maxRgbDelta (0x230/4) /* W -- Voodoo/Voodoo2 only */ +#define hBorder (0x234/4) /* W -- Voodoo2 only */ +#define vBorder (0x238/4) /* W -- Voodoo2 only */ +#define borderColor (0x23c/4) /* W -- Voodoo2 only */ + +/* 0x240 */ +#define hvRetrace (0x240/4) /* R -- Voodoo2 only */ +#define fbiInit5 (0x244/4) /* RW -- Voodoo2 only */ +#define fbiInit6 (0x248/4) /* RW -- Voodoo2 only */ +#define fbiInit7 (0x24c/4) /* RW -- Voodoo2 only */ +#define swapPending (0x24c/4) /* W -- Banshee only */ +#define leftOverlayBuf (0x250/4) /* W -- Banshee only */ +#define rightOverlayBuf (0x254/4) /* W -- Banshee only */ +#define fbiSwapHistory (0x258/4) /* R -- Voodoo2/Banshee only */ +#define fbiTrianglesOut (0x25c/4) /* R -- Voodoo2/Banshee only */ +#define sSetupMode (0x260/4) /* W PF -- Voodoo2/Banshee only */ +#define sVx (0x264/4) /* W PF -- Voodoo2/Banshee only */ +#define sVy (0x268/4) /* W PF -- Voodoo2/Banshee only */ +#define sARGB (0x26c/4) /* W PF -- Voodoo2/Banshee only */ +#define sRed (0x270/4) /* W PF -- Voodoo2/Banshee only */ +#define sGreen (0x274/4) /* W PF -- Voodoo2/Banshee only */ +#define sBlue (0x278/4) /* W PF -- Voodoo2/Banshee only */ +#define sAlpha (0x27c/4) /* W PF -- Voodoo2/Banshee only */ + +/* 0x280 */ +#define sVz (0x280/4) /* W PF -- Voodoo2/Banshee only */ +#define sWb (0x284/4) /* W PF -- Voodoo2/Banshee only */ +#define sWtmu0 (0x288/4) /* W PF -- Voodoo2/Banshee only */ +#define sS_W0 (0x28c/4) /* W PF -- Voodoo2/Banshee only */ +#define sT_W0 (0x290/4) /* W PF -- Voodoo2/Banshee only */ +#define sWtmu1 (0x294/4) /* W PF -- Voodoo2/Banshee only */ +#define sS_Wtmu1 (0x298/4) /* W PF -- Voodoo2/Banshee only */ +#define sT_Wtmu1 (0x29c/4) /* W PF -- Voodoo2/Banshee only */ +#define sDrawTriCMD (0x2a0/4) /* W PF -- Voodoo2/Banshee only */ +#define sBeginTriCMD (0x2a4/4) /* W PF -- Voodoo2/Banshee only */ + +/* 0x2c0 */ +#define bltSrcBaseAddr (0x2c0/4) /* RW PF -- Voodoo2 only */ +#define bltDstBaseAddr (0x2c4/4) /* RW PF -- Voodoo2 only */ +#define bltXYStrides (0x2c8/4) /* RW PF -- Voodoo2 only */ +#define bltSrcChromaRange (0x2cc/4) /* RW PF -- Voodoo2 only */ +#define bltDstChromaRange (0x2d0/4) /* RW PF -- Voodoo2 only */ +#define bltClipX (0x2d4/4) /* RW PF -- Voodoo2 only */ +#define bltClipY (0x2d8/4) /* RW PF -- Voodoo2 only */ +#define bltSrcXY (0x2e0/4) /* RW PF -- Voodoo2 only */ +#define bltDstXY (0x2e4/4) /* RW PF -- Voodoo2 only */ +#define bltSize (0x2e8/4) /* RW PF -- Voodoo2 only */ +#define bltRop (0x2ec/4) /* RW PF -- Voodoo2 only */ +#define bltColor (0x2f0/4) /* RW PF -- Voodoo2 only */ +#define bltCommand (0x2f8/4) /* RW PF -- Voodoo2 only */ +#define bltData (0x2fc/4) /* W PF -- Voodoo2 only */ + +/* 0x300 */ +#define textureMode (0x300/4) /* W PF */ +#define tLOD (0x304/4) /* W PF */ +#define tDetail (0x308/4) /* W PF */ +#define texBaseAddr (0x30c/4) /* W PF */ +#define texBaseAddr_1 (0x310/4) /* W PF */ +#define texBaseAddr_2 (0x314/4) /* W PF */ +#define texBaseAddr_3_8 (0x318/4) /* W PF */ +#define trexInit0 (0x31c/4) /* W F -- Voodoo/Voodoo2 only */ +#define trexInit1 (0x320/4) /* W F */ +#define nccTable (0x324/4) /* W F */ + + + +// 2D registers +#define banshee2D_clip0Min (0x008/4) +#define banshee2D_clip0Max (0x00c/4) +#define banshee2D_dstBaseAddr (0x010/4) +#define banshee2D_dstFormat (0x014/4) +#define banshee2D_srcColorkeyMin (0x018/4) +#define banshee2D_srcColorkeyMax (0x01c/4) +#define banshee2D_dstColorkeyMin (0x020/4) +#define banshee2D_dstColorkeyMax (0x024/4) +#define banshee2D_bresError0 (0x028/4) +#define banshee2D_bresError1 (0x02c/4) +#define banshee2D_rop (0x030/4) +#define banshee2D_srcBaseAddr (0x034/4) +#define banshee2D_commandExtra (0x038/4) +#define banshee2D_lineStipple (0x03c/4) +#define banshee2D_lineStyle (0x040/4) +#define banshee2D_pattern0Alias (0x044/4) +#define banshee2D_pattern1Alias (0x048/4) +#define banshee2D_clip1Min (0x04c/4) +#define banshee2D_clip1Max (0x050/4) +#define banshee2D_srcFormat (0x054/4) +#define banshee2D_srcSize (0x058/4) +#define banshee2D_srcXY (0x05c/4) +#define banshee2D_colorBack (0x060/4) +#define banshee2D_colorFore (0x064/4) +#define banshee2D_dstSize (0x068/4) +#define banshee2D_dstXY (0x06c/4) +#define banshee2D_command (0x070/4) + + +/************************************* + * + * Alias map of the first 64 + * registers when remapped + * + *************************************/ + +static const UINT8 register_alias_map[0x40] = +{ + vdstatus, 0x004/4, vertexAx, vertexAy, + vertexBx, vertexBy, vertexCx, vertexCy, + startR, dRdX, dRdY, startG, + dGdX, dGdY, startB, dBdX, + dBdY, startZ, dZdX, dZdY, + startA, dAdX, dAdY, startS, + dSdX, dSdY, startT, dTdX, + dTdY, startW, dWdX, dWdY, + + triangleCMD,0x084/4, fvertexAx, fvertexAy, + fvertexBx, fvertexBy, fvertexCx, fvertexCy, + fstartR, fdRdX, fdRdY, fstartG, + fdGdX, fdGdY, fstartB, fdBdX, + fdBdY, fstartZ, fdZdX, fdZdY, + fstartA, fdAdX, fdAdY, fstartS, + fdSdX, fdSdY, fstartT, fdTdX, + fdTdY, fstartW, fdWdX, fdWdY +}; + + + +/************************************* + * + * Table of per-register access rights + * + *************************************/ + +static const UINT8 voodoo_register_access[0x100] = +{ + /* 0x000 */ + REG_RP, 0, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x040 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x080 */ + REG_WPF, 0, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x0c0 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x100 */ + REG_WPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWF, REG_RWF, REG_RWF, REG_RWF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, 0, 0, + + /* 0x140 */ + REG_RWF, REG_RWF, REG_RWF, REG_R, + REG_R, REG_R, REG_R, REG_R, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x180 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x1c0 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x200 */ + REG_RW, REG_R, REG_RW, REG_RW, + REG_RW, REG_RW, REG_RW, REG_RW, + REG_W, REG_W, REG_W, REG_W, + REG_W, 0, 0, 0, + + /* 0x240 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x280 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x2c0 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x300 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x340 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x380 */ + REG_WF +}; + + +static const UINT8 voodoo2_register_access[0x100] = +{ + /* 0x000 */ + REG_RP, REG_RWPT, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x040 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x080 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x0c0 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x100 */ + REG_WPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWF, REG_RWF, REG_RWF, REG_RWF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x140 */ + REG_RWF, REG_RWF, REG_RWF, REG_R, + REG_R, REG_R, REG_R, REG_R, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x180 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x1c0 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_RWT, REG_RWT, REG_RWT, REG_RWT, + REG_RWT, REG_RWT, REG_RWT, REG_RW, + + /* 0x200 */ + REG_RWT, REG_R, REG_RWT, REG_RWT, + REG_RWT, REG_RWT, REG_RWT, REG_RWT, + REG_WT, REG_WT, REG_WF, REG_WT, + REG_WT, REG_WT, REG_WT, REG_WT, + + /* 0x240 */ + REG_R, REG_RWT, REG_RWT, REG_RWT, + 0, 0, REG_R, REG_R, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x280 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, 0, 0, + 0, 0, 0, 0, + + /* 0x2c0 */ + REG_RWPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWPF, REG_RWPF, REG_RWPF, REG_WPF, + + /* 0x300 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x340 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x380 */ + REG_WF +}; + + +static const UINT8 banshee_register_access[0x100] = +{ + /* 0x000 */ + REG_RP, REG_RWPT, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x040 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x080 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x0c0 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x100 */ + REG_WPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWF, REG_RWF, REG_RWF, REG_RWF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x140 */ + REG_RWF, REG_RWF, REG_RWF, REG_R, + REG_R, REG_R, REG_R, REG_R, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x180 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x1c0 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + 0, 0, 0, REG_RWF, + REG_RWF, REG_RWF, REG_RWF, 0, + + /* 0x200 */ + REG_RWF, REG_RWF, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x240 */ + 0, 0, 0, REG_WT, + REG_RWF, REG_RWF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_R, REG_R, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x280 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, 0, 0, + 0, 0, 0, 0, + + /* 0x2c0 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x300 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, 0, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x340 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x380 */ + REG_WF +}; + + + +/************************************* + * + * Register string table for debug + * + *************************************/ + +static const char *const voodoo_reg_name[] = +{ + /* 0x000 */ + "status", "{intrCtrl}", "vertexAx", "vertexAy", + "vertexBx", "vertexBy", "vertexCx", "vertexCy", + "startR", "startG", "startB", "startZ", + "startA", "startS", "startT", "startW", + /* 0x040 */ + "dRdX", "dGdX", "dBdX", "dZdX", + "dAdX", "dSdX", "dTdX", "dWdX", + "dRdY", "dGdY", "dBdY", "dZdY", + "dAdY", "dSdY", "dTdY", "dWdY", + /* 0x080 */ + "triangleCMD", "reserved084", "fvertexAx", "fvertexAy", + "fvertexBx", "fvertexBy", "fvertexCx", "fvertexCy", + "fstartR", "fstartG", "fstartB", "fstartZ", + "fstartA", "fstartS", "fstartT", "fstartW", + /* 0x0c0 */ + "fdRdX", "fdGdX", "fdBdX", "fdZdX", + "fdAdX", "fdSdX", "fdTdX", "fdWdX", + "fdRdY", "fdGdY", "fdBdY", "fdZdY", + "fdAdY", "fdSdY", "fdTdY", "fdWdY", + /* 0x100 */ + "ftriangleCMD", "fbzColorPath", "fogMode", "alphaMode", + "fbzMode", "lfbMode", "clipLeftRight","clipLowYHighY", + "nopCMD", "fastfillCMD", "swapbufferCMD","fogColor", + "zaColor", "chromaKey", "{chromaRange}","{userIntrCMD}", + /* 0x140 */ + "stipple", "color0", "color1", "fbiPixelsIn", + "fbiChromaFail","fbiZfuncFail", "fbiAfuncFail", "fbiPixelsOut", + "fogTable160", "fogTable164", "fogTable168", "fogTable16c", + "fogTable170", "fogTable174", "fogTable178", "fogTable17c", + /* 0x180 */ + "fogTable180", "fogTable184", "fogTable188", "fogTable18c", + "fogTable190", "fogTable194", "fogTable198", "fogTable19c", + "fogTable1a0", "fogTable1a4", "fogTable1a8", "fogTable1ac", + "fogTable1b0", "fogTable1b4", "fogTable1b8", "fogTable1bc", + /* 0x1c0 */ + "fogTable1c0", "fogTable1c4", "fogTable1c8", "fogTable1cc", + "fogTable1d0", "fogTable1d4", "fogTable1d8", "fogTable1dc", + "{cmdFifoBaseAddr}","{cmdFifoBump}","{cmdFifoRdPtr}","{cmdFifoAMin}", + "{cmdFifoAMax}","{cmdFifoDepth}","{cmdFifoHoles}","reserved1fc", + /* 0x200 */ + "fbiInit4", "vRetrace", "backPorch", "videoDimensions", + "fbiInit0", "fbiInit1", "fbiInit2", "fbiInit3", + "hSync", "vSync", "clutData", "dacData", + "maxRgbDelta", "{hBorder}", "{vBorder}", "{borderColor}", + /* 0x240 */ + "{hvRetrace}", "{fbiInit5}", "{fbiInit6}", "{fbiInit7}", + "reserved250", "reserved254", "{fbiSwapHistory}","{fbiTrianglesOut}", + "{sSetupMode}", "{sVx}", "{sVy}", "{sARGB}", + "{sRed}", "{sGreen}", "{sBlue}", "{sAlpha}", + /* 0x280 */ + "{sVz}", "{sWb}", "{sWtmu0}", "{sS/Wtmu0}", + "{sT/Wtmu0}", "{sWtmu1}", "{sS/Wtmu1}", "{sT/Wtmu1}", + "{sDrawTriCMD}","{sBeginTriCMD}","reserved2a8", "reserved2ac", + "reserved2b0", "reserved2b4", "reserved2b8", "reserved2bc", + /* 0x2c0 */ + "{bltSrcBaseAddr}","{bltDstBaseAddr}","{bltXYStrides}","{bltSrcChromaRange}", + "{bltDstChromaRange}","{bltClipX}","{bltClipY}","reserved2dc", + "{bltSrcXY}", "{bltDstXY}", "{bltSize}", "{bltRop}", + "{bltColor}", "reserved2f4", "{bltCommand}", "{bltData}", + /* 0x300 */ + "textureMode", "tLOD", "tDetail", "texBaseAddr", + "texBaseAddr_1","texBaseAddr_2","texBaseAddr_3_8","trexInit0", + "trexInit1", "nccTable0.0", "nccTable0.1", "nccTable0.2", + "nccTable0.3", "nccTable0.4", "nccTable0.5", "nccTable0.6", + /* 0x340 */ + "nccTable0.7", "nccTable0.8", "nccTable0.9", "nccTable0.A", + "nccTable0.B", "nccTable1.0", "nccTable1.1", "nccTable1.2", + "nccTable1.3", "nccTable1.4", "nccTable1.5", "nccTable1.6", + "nccTable1.7", "nccTable1.8", "nccTable1.9", "nccTable1.A", + /* 0x380 */ + "nccTable1.B" +}; + + +static const char *const banshee_reg_name[] = +{ + /* 0x000 */ + "status", "intrCtrl", "vertexAx", "vertexAy", + "vertexBx", "vertexBy", "vertexCx", "vertexCy", + "startR", "startG", "startB", "startZ", + "startA", "startS", "startT", "startW", + /* 0x040 */ + "dRdX", "dGdX", "dBdX", "dZdX", + "dAdX", "dSdX", "dTdX", "dWdX", + "dRdY", "dGdY", "dBdY", "dZdY", + "dAdY", "dSdY", "dTdY", "dWdY", + /* 0x080 */ + "triangleCMD", "reserved084", "fvertexAx", "fvertexAy", + "fvertexBx", "fvertexBy", "fvertexCx", "fvertexCy", + "fstartR", "fstartG", "fstartB", "fstartZ", + "fstartA", "fstartS", "fstartT", "fstartW", + /* 0x0c0 */ + "fdRdX", "fdGdX", "fdBdX", "fdZdX", + "fdAdX", "fdSdX", "fdTdX", "fdWdX", + "fdRdY", "fdGdY", "fdBdY", "fdZdY", + "fdAdY", "fdSdY", "fdTdY", "fdWdY", + /* 0x100 */ + "ftriangleCMD", "fbzColorPath", "fogMode", "alphaMode", + "fbzMode", "lfbMode", "clipLeftRight","clipLowYHighY", + "nopCMD", "fastfillCMD", "swapbufferCMD","fogColor", + "zaColor", "chromaKey", "chromaRange", "userIntrCMD", + /* 0x140 */ + "stipple", "color0", "color1", "fbiPixelsIn", + "fbiChromaFail","fbiZfuncFail", "fbiAfuncFail", "fbiPixelsOut", + "fogTable160", "fogTable164", "fogTable168", "fogTable16c", + "fogTable170", "fogTable174", "fogTable178", "fogTable17c", + /* 0x180 */ + "fogTable180", "fogTable184", "fogTable188", "fogTable18c", + "fogTable190", "fogTable194", "fogTable198", "fogTable19c", + "fogTable1a0", "fogTable1a4", "fogTable1a8", "fogTable1ac", + "fogTable1b0", "fogTable1b4", "fogTable1b8", "fogTable1bc", + /* 0x1c0 */ + "fogTable1c0", "fogTable1c4", "fogTable1c8", "fogTable1cc", + "fogTable1d0", "fogTable1d4", "fogTable1d8", "fogTable1dc", + "reserved1e0", "reserved1e4", "reserved1e8", "colBufferAddr", + "colBufferStride","auxBufferAddr","auxBufferStride","reserved1fc", + /* 0x200 */ + "clipLeftRight1","clipTopBottom1","reserved208","reserved20c", + "reserved210", "reserved214", "reserved218", "reserved21c", + "reserved220", "reserved224", "reserved228", "reserved22c", + "reserved230", "reserved234", "reserved238", "reserved23c", + /* 0x240 */ + "reserved240", "reserved244", "reserved248", "swapPending", + "leftOverlayBuf","rightOverlayBuf","fbiSwapHistory","fbiTrianglesOut", + "sSetupMode", "sVx", "sVy", "sARGB", + "sRed", "sGreen", "sBlue", "sAlpha", + /* 0x280 */ + "sVz", "sWb", "sWtmu0", "sS/Wtmu0", + "sT/Wtmu0", "sWtmu1", "sS/Wtmu1", "sT/Wtmu1", + "sDrawTriCMD", "sBeginTriCMD", "reserved2a8", "reserved2ac", + "reserved2b0", "reserved2b4", "reserved2b8", "reserved2bc", + /* 0x2c0 */ + "reserved2c0", "reserved2c4", "reserved2c8", "reserved2cc", + "reserved2d0", "reserved2d4", "reserved2d8", "reserved2dc", + "reserved2e0", "reserved2e4", "reserved2e8", "reserved2ec", + "reserved2f0", "reserved2f4", "reserved2f8", "reserved2fc", + /* 0x300 */ + "textureMode", "tLOD", "tDetail", "texBaseAddr", + "texBaseAddr_1","texBaseAddr_2","texBaseAddr_3_8","reserved31c", + "trexInit1", "nccTable0.0", "nccTable0.1", "nccTable0.2", + "nccTable0.3", "nccTable0.4", "nccTable0.5", "nccTable0.6", + /* 0x340 */ + "nccTable0.7", "nccTable0.8", "nccTable0.9", "nccTable0.A", + "nccTable0.B", "nccTable1.0", "nccTable1.1", "nccTable1.2", + "nccTable1.3", "nccTable1.4", "nccTable1.5", "nccTable1.6", + "nccTable1.7", "nccTable1.8", "nccTable1.9", "nccTable1.A", + /* 0x380 */ + "nccTable1.B" +}; + + + +/************************************* + * + * Voodoo Banshee I/O space registers + * + *************************************/ + +/* 0x000 */ +#define io_status (0x000/4) /* */ +#define io_pciInit0 (0x004/4) /* */ +#define io_sipMonitor (0x008/4) /* */ +#define io_lfbMemoryConfig (0x00c/4) /* */ +#define io_miscInit0 (0x010/4) /* */ +#define io_miscInit1 (0x014/4) /* */ +#define io_dramInit0 (0x018/4) /* */ +#define io_dramInit1 (0x01c/4) /* */ +#define io_agpInit (0x020/4) /* */ +#define io_tmuGbeInit (0x024/4) /* */ +#define io_vgaInit0 (0x028/4) /* */ +#define io_vgaInit1 (0x02c/4) /* */ +#define io_dramCommand (0x030/4) /* */ +#define io_dramData (0x034/4) /* */ + +/* 0x040 */ +#define io_pllCtrl0 (0x040/4) /* */ +#define io_pllCtrl1 (0x044/4) /* */ +#define io_pllCtrl2 (0x048/4) /* */ +#define io_dacMode (0x04c/4) /* */ +#define io_dacAddr (0x050/4) /* */ +#define io_dacData (0x054/4) /* */ +#define io_rgbMaxDelta (0x058/4) /* */ +#define io_vidProcCfg (0x05c/4) /* */ +#define io_hwCurPatAddr (0x060/4) /* */ +#define io_hwCurLoc (0x064/4) /* */ +#define io_hwCurC0 (0x068/4) /* */ +#define io_hwCurC1 (0x06c/4) /* */ +#define io_vidInFormat (0x070/4) /* */ +#define io_vidInStatus (0x074/4) /* */ +#define io_vidSerialParallelPort (0x078/4) /* */ +#define io_vidInXDecimDeltas (0x07c/4) /* */ + +/* 0x080 */ +#define io_vidInDecimInitErrs (0x080/4) /* */ +#define io_vidInYDecimDeltas (0x084/4) /* */ +#define io_vidPixelBufThold (0x088/4) /* */ +#define io_vidChromaMin (0x08c/4) /* */ +#define io_vidChromaMax (0x090/4) /* */ +#define io_vidCurrentLine (0x094/4) /* */ +#define io_vidScreenSize (0x098/4) /* */ +#define io_vidOverlayStartCoords (0x09c/4) /* */ +#define io_vidOverlayEndScreenCoord (0x0a0/4) /* */ +#define io_vidOverlayDudx (0x0a4/4) /* */ +#define io_vidOverlayDudxOffsetSrcWidth (0x0a8/4) /* */ +#define io_vidOverlayDvdy (0x0ac/4) /* */ +#define io_vgab0 (0x0b0/4) /* */ +#define io_vgab4 (0x0b4/4) /* */ +#define io_vgab8 (0x0b8/4) /* */ +#define io_vgabc (0x0bc/4) /* */ + +/* 0x0c0 */ +#define io_vgac0 (0x0c0/4) /* */ +#define io_vgac4 (0x0c4/4) /* */ +#define io_vgac8 (0x0c8/4) /* */ +#define io_vgacc (0x0cc/4) /* */ +#define io_vgad0 (0x0d0/4) /* */ +#define io_vgad4 (0x0d4/4) /* */ +#define io_vgad8 (0x0d8/4) /* */ +#define io_vgadc (0x0dc/4) /* */ +#define io_vidOverlayDvdyOffset (0x0e0/4) /* */ +#define io_vidDesktopStartAddr (0x0e4/4) /* */ +#define io_vidDesktopOverlayStride (0x0e8/4) /* */ +#define io_vidInAddr0 (0x0ec/4) /* */ +#define io_vidInAddr1 (0x0f0/4) /* */ +#define io_vidInAddr2 (0x0f4/4) /* */ +#define io_vidInStride (0x0f8/4) /* */ +#define io_vidCurrOverlayStartAddr (0x0fc/4) /* */ + + + +/************************************* + * + * Register string table for debug + * + *************************************/ + +static const char *const banshee_io_reg_name[] = +{ + /* 0x000 */ + "status", "pciInit0", "sipMonitor", "lfbMemoryConfig", + "miscInit0", "miscInit1", "dramInit0", "dramInit1", + "agpInit", "tmuGbeInit", "vgaInit0", "vgaInit1", + "dramCommand", "dramData", "reserved38", "reserved3c", + + /* 0x040 */ + "pllCtrl0", "pllCtrl1", "pllCtrl2", "dacMode", + "dacAddr", "dacData", "rgbMaxDelta", "vidProcCfg", + "hwCurPatAddr", "hwCurLoc", "hwCurC0", "hwCurC1", + "vidInFormat", "vidInStatus", "vidSerialParallelPort","vidInXDecimDeltas", + + /* 0x080 */ + "vidInDecimInitErrs","vidInYDecimDeltas","vidPixelBufThold","vidChromaMin", + "vidChromaMax", "vidCurrentLine","vidScreenSize","vidOverlayStartCoords", + "vidOverlayEndScreenCoord","vidOverlayDudx","vidOverlayDudxOffsetSrcWidth","vidOverlayDvdy", + "vga[b0]", "vga[b4]", "vga[b8]", "vga[bc]", + + /* 0x0c0 */ + "vga[c0]", "vga[c4]", "vga[c8]", "vga[cc]", + "vga[d0]", "vga[d4]", "vga[d8]", "vga[dc]", + "vidOverlayDvdyOffset","vidDesktopStartAddr","vidDesktopOverlayStride","vidInAddr0", + "vidInAddr1", "vidInAddr2", "vidInStride", "vidCurrOverlayStartAddr" +}; + + + +/************************************* + * + * Voodoo Banshee AGP space registers + * + *************************************/ + +/* 0x000 */ +#define agpReqSize (0x000/4) /* */ +#define agpHostAddressLow (0x004/4) /* */ +#define agpHostAddressHigh (0x008/4) /* */ +#define agpGraphicsAddress (0x00c/4) /* */ +#define agpGraphicsStride (0x010/4) /* */ +#define agpMoveCMD (0x014/4) /* */ +#define cmdBaseAddr0 (0x020/4) /* */ +#define cmdBaseSize0 (0x024/4) /* */ +#define cmdBump0 (0x028/4) /* */ +#define cmdRdPtrL0 (0x02c/4) /* */ +#define cmdRdPtrH0 (0x030/4) /* */ +#define cmdAMin0 (0x034/4) /* */ +#define cmdAMax0 (0x03c/4) /* */ + +/* 0x040 */ +#define cmdFifoDepth0 (0x044/4) /* */ +#define cmdHoleCnt0 (0x048/4) /* */ +#define cmdBaseAddr1 (0x050/4) /* */ +#define cmdBaseSize1 (0x054/4) /* */ +#define cmdBump1 (0x058/4) /* */ +#define cmdRdPtrL1 (0x05c/4) /* */ +#define cmdRdPtrH1 (0x060/4) /* */ +#define cmdAMin1 (0x064/4) /* */ +#define cmdAMax1 (0x06c/4) /* */ +#define cmdFifoDepth1 (0x074/4) /* */ +#define cmdHoleCnt1 (0x078/4) /* */ + +/* 0x080 */ +#define cmdFifoThresh (0x080/4) /* */ +#define cmdHoleInt (0x084/4) /* */ + +/* 0x100 */ +#define yuvBaseAddress (0x100/4) /* */ +#define yuvStride (0x104/4) /* */ +#define crc1 (0x120/4) /* */ +#define crc2 (0x130/4) /* */ + + + +/************************************* + * + * Register string table for debug + * + *************************************/ + +static const char *const banshee_agp_reg_name[] = +{ + /* 0x000 */ + "agpReqSize", "agpHostAddressLow","agpHostAddressHigh","agpGraphicsAddress", + "agpGraphicsStride","agpMoveCMD","reserved18", "reserved1c", + "cmdBaseAddr0", "cmdBaseSize0", "cmdBump0", "cmdRdPtrL0", + "cmdRdPtrH0", "cmdAMin0", "reserved38", "cmdAMax0", + + /* 0x040 */ + "reserved40", "cmdFifoDepth0","cmdHoleCnt0", "reserved4c", + "cmdBaseAddr1", "cmdBaseSize1", "cmdBump1", "cmdRdPtrL1", + "cmdRdPtrH1", "cmdAMin1", "reserved68", "cmdAMax1", + "reserved70", "cmdFifoDepth1","cmdHoleCnt1", "reserved7c", + + /* 0x080 */ + "cmdFifoThresh","cmdHoleInt", "reserved88", "reserved8c", + "reserved90", "reserved94", "reserved98", "reserved9c", + "reserveda0", "reserveda4", "reserveda8", "reservedac", + "reservedb0", "reservedb4", "reservedb8", "reservedbc", + + /* 0x0c0 */ + "reservedc0", "reservedc4", "reservedc8", "reservedcc", + "reservedd0", "reservedd4", "reservedd8", "reserveddc", + "reservede0", "reservede4", "reservede8", "reservedec", + "reservedf0", "reservedf4", "reservedf8", "reservedfc", + + /* 0x100 */ + "yuvBaseAddress","yuvStride", "reserved108", "reserved10c", + "reserved110", "reserved114", "reserved118", "reserved11c", + "crc1", "reserved124", "reserved128", "reserved12c", + "crc2", "reserved134", "reserved138", "reserved13c" +}; + + + +/************************************* + * + * Dithering tables + * + *************************************/ + +static const UINT8 dither_matrix_4x4[16] = +{ + 0, 8, 2, 10, + 12, 4, 14, 6, + 3, 11, 1, 9, + 15, 7, 13, 5 +}; + +static const UINT8 dither_matrix_2x2[16] = +{ + 2, 10, 2, 10, + 14, 6, 14, 6, + 2, 10, 2, 10, + 14, 6, 14, 6 +}; + + + +/************************************* + * + * Macros for extracting pixels + * + *************************************/ + +#define EXTRACT_565_TO_888(val, a, b, c) \ + (a) = (((val) >> 8) & 0xf8) | (((val) >> 13) & 0x07); \ + (b) = (((val) >> 3) & 0xfc) | (((val) >> 9) & 0x03); \ + (c) = (((val) << 3) & 0xf8) | (((val) >> 2) & 0x07); +#define EXTRACT_x555_TO_888(val, a, b, c) \ + (a) = (((val) >> 7) & 0xf8) | (((val) >> 12) & 0x07); \ + (b) = (((val) >> 2) & 0xf8) | (((val) >> 7) & 0x07); \ + (c) = (((val) << 3) & 0xf8) | (((val) >> 2) & 0x07); +#define EXTRACT_555x_TO_888(val, a, b, c) \ + (a) = (((val) >> 8) & 0xf8) | (((val) >> 13) & 0x07); \ + (b) = (((val) >> 3) & 0xf8) | (((val) >> 8) & 0x07); \ + (c) = (((val) << 2) & 0xf8) | (((val) >> 3) & 0x07); +#define EXTRACT_1555_TO_8888(val, a, b, c, d) \ + (a) = ((INT16)(val) >> 15) & 0xff; \ + EXTRACT_x555_TO_888(val, b, c, d) +#define EXTRACT_5551_TO_8888(val, a, b, c, d) \ + EXTRACT_555x_TO_888(val, a, b, c) \ + (d) = ((val) & 0x0001) ? 0xff : 0x00; +#define EXTRACT_x888_TO_888(val, a, b, c) \ + (a) = ((val) >> 16) & 0xff; \ + (b) = ((val) >> 8) & 0xff; \ + (c) = ((val) >> 0) & 0xff; +#define EXTRACT_888x_TO_888(val, a, b, c) \ + (a) = ((val) >> 24) & 0xff; \ + (b) = ((val) >> 16) & 0xff; \ + (c) = ((val) >> 8) & 0xff; +#define EXTRACT_8888_TO_8888(val, a, b, c, d) \ + (a) = ((val) >> 24) & 0xff; \ + (b) = ((val) >> 16) & 0xff; \ + (c) = ((val) >> 8) & 0xff; \ + (d) = ((val) >> 0) & 0xff; +#define EXTRACT_4444_TO_8888(val, a, b, c, d) \ + (a) = (((val) >> 8) & 0xf0) | (((val) >> 12) & 0x0f); \ + (b) = (((val) >> 4) & 0xf0) | (((val) >> 8) & 0x0f); \ + (c) = (((val) >> 0) & 0xf0) | (((val) >> 4) & 0x0f); \ + (d) = (((val) << 4) & 0xf0) | (((val) >> 0) & 0x0f); +#define EXTRACT_332_TO_888(val, a, b, c) \ + (a) = (((val) >> 0) & 0xe0) | (((val) >> 3) & 0x1c) | (((val) >> 6) & 0x03); \ + (b) = (((val) << 3) & 0xe0) | (((val) >> 0) & 0x1c) | (((val) >> 3) & 0x03); \ + (c) = (((val) << 6) & 0xc0) | (((val) << 4) & 0x30) | (((val) << 2) & 0x0c) | (((val) << 0) & 0x03); + + +/************************************* + * + * Misc. macros + * + *************************************/ + +/* macro for clamping a value between minimum and maximum values */ +#define CLAMP(val,min,max) do { if ((val) < (min)) { (val) = (min); } else if ((val) > (max)) { (val) = (max); } } while (0) + +/* macro to compute the base 2 log for LOD calculations */ +#define LOGB2(x) (log((double)(x)) / log(2.0)) + + + +/************************************* + * + * Macros for extracting bitfields + * + *************************************/ + +#define INITEN_ENABLE_HW_INIT(val) (((val) >> 0) & 1) +#define INITEN_ENABLE_PCI_FIFO(val) (((val) >> 1) & 1) +#define INITEN_REMAP_INIT_TO_DAC(val) (((val) >> 2) & 1) +#define INITEN_ENABLE_SNOOP0(val) (((val) >> 4) & 1) +#define INITEN_SNOOP0_MEMORY_MATCH(val) (((val) >> 5) & 1) +#define INITEN_SNOOP0_READWRITE_MATCH(val) (((val) >> 6) & 1) +#define INITEN_ENABLE_SNOOP1(val) (((val) >> 7) & 1) +#define INITEN_SNOOP1_MEMORY_MATCH(val) (((val) >> 8) & 1) +#define INITEN_SNOOP1_READWRITE_MATCH(val) (((val) >> 9) & 1) +#define INITEN_SLI_BUS_OWNER(val) (((val) >> 10) & 1) +#define INITEN_SLI_ODD_EVEN(val) (((val) >> 11) & 1) +#define INITEN_SECONDARY_REV_ID(val) (((val) >> 12) & 0xf) /* voodoo 2 only */ +#define INITEN_MFCTR_FAB_ID(val) (((val) >> 16) & 0xf) /* voodoo 2 only */ +#define INITEN_ENABLE_PCI_INTERRUPT(val) (((val) >> 20) & 1) /* voodoo 2 only */ +#define INITEN_PCI_INTERRUPT_TIMEOUT(val) (((val) >> 21) & 1) /* voodoo 2 only */ +#define INITEN_ENABLE_NAND_TREE_TEST(val) (((val) >> 22) & 1) /* voodoo 2 only */ +#define INITEN_ENABLE_SLI_ADDRESS_SNOOP(val) (((val) >> 23) & 1) /* voodoo 2 only */ +#define INITEN_SLI_SNOOP_ADDRESS(val) (((val) >> 24) & 0xff) /* voodoo 2 only */ + +#define FBZCP_CC_RGBSELECT(val) (((val) >> 0) & 3) +#define FBZCP_CC_ASELECT(val) (((val) >> 2) & 3) +#define FBZCP_CC_LOCALSELECT(val) (((val) >> 4) & 1) +#define FBZCP_CCA_LOCALSELECT(val) (((val) >> 5) & 3) +#define FBZCP_CC_LOCALSELECT_OVERRIDE(val) (((val) >> 7) & 1) +#define FBZCP_CC_ZERO_OTHER(val) (((val) >> 8) & 1) +#define FBZCP_CC_SUB_CLOCAL(val) (((val) >> 9) & 1) +#define FBZCP_CC_MSELECT(val) (((val) >> 10) & 7) +#define FBZCP_CC_REVERSE_BLEND(val) (((val) >> 13) & 1) +#define FBZCP_CC_ADD_ACLOCAL(val) (((val) >> 14) & 3) +#define FBZCP_CC_INVERT_OUTPUT(val) (((val) >> 16) & 1) +#define FBZCP_CCA_ZERO_OTHER(val) (((val) >> 17) & 1) +#define FBZCP_CCA_SUB_CLOCAL(val) (((val) >> 18) & 1) +#define FBZCP_CCA_MSELECT(val) (((val) >> 19) & 7) +#define FBZCP_CCA_REVERSE_BLEND(val) (((val) >> 22) & 1) +#define FBZCP_CCA_ADD_ACLOCAL(val) (((val) >> 23) & 3) +#define FBZCP_CCA_INVERT_OUTPUT(val) (((val) >> 25) & 1) +#define FBZCP_CCA_SUBPIXEL_ADJUST(val) (((val) >> 26) & 1) +#define FBZCP_TEXTURE_ENABLE(val) (((val) >> 27) & 1) +#define FBZCP_RGBZW_CLAMP(val) (((val) >> 28) & 1) /* voodoo 2 only */ +#define FBZCP_ANTI_ALIAS(val) (((val) >> 29) & 1) /* voodoo 2 only */ + +#define ALPHAMODE_ALPHATEST(val) (((val) >> 0) & 1) +#define ALPHAMODE_ALPHAFUNCTION(val) (((val) >> 1) & 7) +#define ALPHAMODE_ALPHABLEND(val) (((val) >> 4) & 1) +#define ALPHAMODE_ANTIALIAS(val) (((val) >> 5) & 1) +#define ALPHAMODE_SRCRGBBLEND(val) (((val) >> 8) & 15) +#define ALPHAMODE_DSTRGBBLEND(val) (((val) >> 12) & 15) +#define ALPHAMODE_SRCALPHABLEND(val) (((val) >> 16) & 15) +#define ALPHAMODE_DSTALPHABLEND(val) (((val) >> 20) & 15) +#define ALPHAMODE_ALPHAREF(val) (((val) >> 24) & 0xff) + +#define FOGMODE_ENABLE_FOG(val) (((val) >> 0) & 1) +#define FOGMODE_FOG_ADD(val) (((val) >> 1) & 1) +#define FOGMODE_FOG_MULT(val) (((val) >> 2) & 1) +#define FOGMODE_FOG_ZALPHA(val) (((val) >> 3) & 3) +#define FOGMODE_FOG_CONSTANT(val) (((val) >> 5) & 1) +#define FOGMODE_FOG_DITHER(val) (((val) >> 6) & 1) /* voodoo 2 only */ +#define FOGMODE_FOG_ZONES(val) (((val) >> 7) & 1) /* voodoo 2 only */ + +#define FBZMODE_ENABLE_CLIPPING(val) (((val) >> 0) & 1) +#define FBZMODE_ENABLE_CHROMAKEY(val) (((val) >> 1) & 1) +#define FBZMODE_ENABLE_STIPPLE(val) (((val) >> 2) & 1) +#define FBZMODE_WBUFFER_SELECT(val) (((val) >> 3) & 1) +#define FBZMODE_ENABLE_DEPTHBUF(val) (((val) >> 4) & 1) +#define FBZMODE_DEPTH_FUNCTION(val) (((val) >> 5) & 7) +#define FBZMODE_ENABLE_DITHERING(val) (((val) >> 8) & 1) +#define FBZMODE_RGB_BUFFER_MASK(val) (((val) >> 9) & 1) +#define FBZMODE_AUX_BUFFER_MASK(val) (((val) >> 10) & 1) +#define FBZMODE_DITHER_TYPE(val) (((val) >> 11) & 1) +#define FBZMODE_STIPPLE_PATTERN(val) (((val) >> 12) & 1) +#define FBZMODE_ENABLE_ALPHA_MASK(val) (((val) >> 13) & 1) +#define FBZMODE_DRAW_BUFFER(val) (((val) >> 14) & 3) +#define FBZMODE_ENABLE_DEPTH_BIAS(val) (((val) >> 16) & 1) +#define FBZMODE_Y_ORIGIN(val) (((val) >> 17) & 1) +#define FBZMODE_ENABLE_ALPHA_PLANES(val) (((val) >> 18) & 1) +#define FBZMODE_ALPHA_DITHER_SUBTRACT(val) (((val) >> 19) & 1) +#define FBZMODE_DEPTH_SOURCE_COMPARE(val) (((val) >> 20) & 1) +#define FBZMODE_DEPTH_FLOAT_SELECT(val) (((val) >> 21) & 1) /* voodoo 2 only */ + +#define LFBMODE_WRITE_FORMAT(val) (((val) >> 0) & 0xf) +#define LFBMODE_WRITE_BUFFER_SELECT(val) (((val) >> 4) & 3) +#define LFBMODE_READ_BUFFER_SELECT(val) (((val) >> 6) & 3) +#define LFBMODE_ENABLE_PIXEL_PIPELINE(val) (((val) >> 8) & 1) +#define LFBMODE_RGBA_LANES(val) (((val) >> 9) & 3) +#define LFBMODE_WORD_SWAP_WRITES(val) (((val) >> 11) & 1) +#define LFBMODE_BYTE_SWIZZLE_WRITES(val) (((val) >> 12) & 1) +#define LFBMODE_Y_ORIGIN(val) (((val) >> 13) & 1) +#define LFBMODE_WRITE_W_SELECT(val) (((val) >> 14) & 1) +#define LFBMODE_WORD_SWAP_READS(val) (((val) >> 15) & 1) +#define LFBMODE_BYTE_SWIZZLE_READS(val) (((val) >> 16) & 1) + +#define CHROMARANGE_BLUE_EXCLUSIVE(val) (((val) >> 24) & 1) +#define CHROMARANGE_GREEN_EXCLUSIVE(val) (((val) >> 25) & 1) +#define CHROMARANGE_RED_EXCLUSIVE(val) (((val) >> 26) & 1) +#define CHROMARANGE_UNION_MODE(val) (((val) >> 27) & 1) +#define CHROMARANGE_ENABLE(val) (((val) >> 28) & 1) + +#define FBIINIT0_VGA_PASSTHRU(val) (((val) >> 0) & 1) +#define FBIINIT0_GRAPHICS_RESET(val) (((val) >> 1) & 1) +#define FBIINIT0_FIFO_RESET(val) (((val) >> 2) & 1) +#define FBIINIT0_SWIZZLE_REG_WRITES(val) (((val) >> 3) & 1) +#define FBIINIT0_STALL_PCIE_FOR_HWM(val) (((val) >> 4) & 1) +#define FBIINIT0_PCI_FIFO_LWM(val) (((val) >> 6) & 0x1f) +#define FBIINIT0_LFB_TO_MEMORY_FIFO(val) (((val) >> 11) & 1) +#define FBIINIT0_TEXMEM_TO_MEMORY_FIFO(val) (((val) >> 12) & 1) +#define FBIINIT0_ENABLE_MEMORY_FIFO(val) (((val) >> 13) & 1) +#define FBIINIT0_MEMORY_FIFO_HWM(val) (((val) >> 14) & 0x7ff) +#define FBIINIT0_MEMORY_FIFO_BURST(val) (((val) >> 25) & 0x3f) + +#define FBIINIT1_PCI_DEV_FUNCTION(val) (((val) >> 0) & 1) +#define FBIINIT1_PCI_WRITE_WAIT_STATES(val) (((val) >> 1) & 1) +#define FBIINIT1_MULTI_SST1(val) (((val) >> 2) & 1) /* not on voodoo 2 */ +#define FBIINIT1_ENABLE_LFB(val) (((val) >> 3) & 1) +#define FBIINIT1_X_VIDEO_TILES(val) (((val) >> 4) & 0xf) +#define FBIINIT1_VIDEO_TIMING_RESET(val) (((val) >> 8) & 1) +#define FBIINIT1_SOFTWARE_OVERRIDE(val) (((val) >> 9) & 1) +#define FBIINIT1_SOFTWARE_HSYNC(val) (((val) >> 10) & 1) +#define FBIINIT1_SOFTWARE_VSYNC(val) (((val) >> 11) & 1) +#define FBIINIT1_SOFTWARE_BLANK(val) (((val) >> 12) & 1) +#define FBIINIT1_DRIVE_VIDEO_TIMING(val) (((val) >> 13) & 1) +#define FBIINIT1_DRIVE_VIDEO_BLANK(val) (((val) >> 14) & 1) +#define FBIINIT1_DRIVE_VIDEO_SYNC(val) (((val) >> 15) & 1) +#define FBIINIT1_DRIVE_VIDEO_DCLK(val) (((val) >> 16) & 1) +#define FBIINIT1_VIDEO_TIMING_VCLK(val) (((val) >> 17) & 1) +#define FBIINIT1_VIDEO_CLK_2X_DELAY(val) (((val) >> 18) & 3) +#define FBIINIT1_VIDEO_TIMING_SOURCE(val) (((val) >> 20) & 3) +#define FBIINIT1_ENABLE_24BPP_OUTPUT(val) (((val) >> 22) & 1) +#define FBIINIT1_ENABLE_SLI(val) (((val) >> 23) & 1) +#define FBIINIT1_X_VIDEO_TILES_BIT5(val) (((val) >> 24) & 1) /* voodoo 2 only */ +#define FBIINIT1_ENABLE_EDGE_FILTER(val) (((val) >> 25) & 1) +#define FBIINIT1_INVERT_VID_CLK_2X(val) (((val) >> 26) & 1) +#define FBIINIT1_VID_CLK_2X_SEL_DELAY(val) (((val) >> 27) & 3) +#define FBIINIT1_VID_CLK_DELAY(val) (((val) >> 29) & 3) +#define FBIINIT1_DISABLE_FAST_READAHEAD(val) (((val) >> 31) & 1) + +#define FBIINIT2_DISABLE_DITHER_SUB(val) (((val) >> 0) & 1) +#define FBIINIT2_DRAM_BANKING(val) (((val) >> 1) & 1) +#define FBIINIT2_ENABLE_TRIPLE_BUF(val) (((val) >> 4) & 1) +#define FBIINIT2_ENABLE_FAST_RAS_READ(val) (((val) >> 5) & 1) +#define FBIINIT2_ENABLE_GEN_DRAM_OE(val) (((val) >> 6) & 1) +#define FBIINIT2_ENABLE_FAST_READWRITE(val) (((val) >> 7) & 1) +#define FBIINIT2_ENABLE_PASSTHRU_DITHER(val) (((val) >> 8) & 1) +#define FBIINIT2_SWAP_BUFFER_ALGORITHM(val) (((val) >> 9) & 3) +#define FBIINIT2_VIDEO_BUFFER_OFFSET(val) (((val) >> 11) & 0x1ff) +#define FBIINIT2_ENABLE_DRAM_BANKING(val) (((val) >> 20) & 1) +#define FBIINIT2_ENABLE_DRAM_READ_FIFO(val) (((val) >> 21) & 1) +#define FBIINIT2_ENABLE_DRAM_REFRESH(val) (((val) >> 22) & 1) +#define FBIINIT2_REFRESH_LOAD_VALUE(val) (((val) >> 23) & 0x1ff) + +#define FBIINIT3_TRI_REGISTER_REMAP(val) (((val) >> 0) & 1) +#define FBIINIT3_VIDEO_FIFO_THRESH(val) (((val) >> 1) & 0x1f) +#define FBIINIT3_DISABLE_TMUS(val) (((val) >> 6) & 1) +#define FBIINIT3_FBI_MEMORY_TYPE(val) (((val) >> 8) & 7) +#define FBIINIT3_VGA_PASS_RESET_VAL(val) (((val) >> 11) & 1) +#define FBIINIT3_HARDCODE_PCI_BASE(val) (((val) >> 12) & 1) +#define FBIINIT3_FBI2TREX_DELAY(val) (((val) >> 13) & 0xf) +#define FBIINIT3_TREX2FBI_DELAY(val) (((val) >> 17) & 0x1f) +#define FBIINIT3_YORIGIN_SUBTRACT(val) (((val) >> 22) & 0x3ff) + +#define FBIINIT4_PCI_READ_WAITS(val) (((val) >> 0) & 1) +#define FBIINIT4_ENABLE_LFB_READAHEAD(val) (((val) >> 1) & 1) +#define FBIINIT4_MEMORY_FIFO_LWM(val) (((val) >> 2) & 0x3f) +#define FBIINIT4_MEMORY_FIFO_START_ROW(val) (((val) >> 8) & 0x3ff) +#define FBIINIT4_MEMORY_FIFO_STOP_ROW(val) (((val) >> 18) & 0x3ff) +#define FBIINIT4_VIDEO_CLOCKING_DELAY(val) (((val) >> 29) & 7) /* voodoo 2 only */ + +#define FBIINIT5_DISABLE_PCI_STOP(val) (((val) >> 0) & 1) /* voodoo 2 only */ +#define FBIINIT5_PCI_SLAVE_SPEED(val) (((val) >> 1) & 1) /* voodoo 2 only */ +#define FBIINIT5_DAC_DATA_OUTPUT_WIDTH(val) (((val) >> 2) & 1) /* voodoo 2 only */ +#define FBIINIT5_DAC_DATA_17_OUTPUT(val) (((val) >> 3) & 1) /* voodoo 2 only */ +#define FBIINIT5_DAC_DATA_18_OUTPUT(val) (((val) >> 4) & 1) /* voodoo 2 only */ +#define FBIINIT5_GENERIC_STRAPPING(val) (((val) >> 5) & 0xf) /* voodoo 2 only */ +#define FBIINIT5_BUFFER_ALLOCATION(val) (((val) >> 9) & 3) /* voodoo 2 only */ +#define FBIINIT5_DRIVE_VID_CLK_SLAVE(val) (((val) >> 11) & 1) /* voodoo 2 only */ +#define FBIINIT5_DRIVE_DAC_DATA_16(val) (((val) >> 12) & 1) /* voodoo 2 only */ +#define FBIINIT5_VCLK_INPUT_SELECT(val) (((val) >> 13) & 1) /* voodoo 2 only */ +#define FBIINIT5_MULTI_CVG_DETECT(val) (((val) >> 14) & 1) /* voodoo 2 only */ +#define FBIINIT5_SYNC_RETRACE_READS(val) (((val) >> 15) & 1) /* voodoo 2 only */ +#define FBIINIT5_ENABLE_RHBORDER_COLOR(val) (((val) >> 16) & 1) /* voodoo 2 only */ +#define FBIINIT5_ENABLE_LHBORDER_COLOR(val) (((val) >> 17) & 1) /* voodoo 2 only */ +#define FBIINIT5_ENABLE_BVBORDER_COLOR(val) (((val) >> 18) & 1) /* voodoo 2 only */ +#define FBIINIT5_ENABLE_TVBORDER_COLOR(val) (((val) >> 19) & 1) /* voodoo 2 only */ +#define FBIINIT5_DOUBLE_HORIZ(val) (((val) >> 20) & 1) /* voodoo 2 only */ +#define FBIINIT5_DOUBLE_VERT(val) (((val) >> 21) & 1) /* voodoo 2 only */ +#define FBIINIT5_ENABLE_16BIT_GAMMA(val) (((val) >> 22) & 1) /* voodoo 2 only */ +#define FBIINIT5_INVERT_DAC_HSYNC(val) (((val) >> 23) & 1) /* voodoo 2 only */ +#define FBIINIT5_INVERT_DAC_VSYNC(val) (((val) >> 24) & 1) /* voodoo 2 only */ +#define FBIINIT5_ENABLE_24BIT_DACDATA(val) (((val) >> 25) & 1) /* voodoo 2 only */ +#define FBIINIT5_ENABLE_INTERLACING(val) (((val) >> 26) & 1) /* voodoo 2 only */ +#define FBIINIT5_DAC_DATA_18_CONTROL(val) (((val) >> 27) & 1) /* voodoo 2 only */ +#define FBIINIT5_RASTERIZER_UNIT_MODE(val) (((val) >> 30) & 3) /* voodoo 2 only */ + +#define FBIINIT6_WINDOW_ACTIVE_COUNTER(val) (((val) >> 0) & 7) /* voodoo 2 only */ +#define FBIINIT6_WINDOW_DRAG_COUNTER(val) (((val) >> 3) & 0x1f) /* voodoo 2 only */ +#define FBIINIT6_SLI_SYNC_MASTER(val) (((val) >> 8) & 1) /* voodoo 2 only */ +#define FBIINIT6_DAC_DATA_22_OUTPUT(val) (((val) >> 9) & 3) /* voodoo 2 only */ +#define FBIINIT6_DAC_DATA_23_OUTPUT(val) (((val) >> 11) & 3) /* voodoo 2 only */ +#define FBIINIT6_SLI_SYNCIN_OUTPUT(val) (((val) >> 13) & 3) /* voodoo 2 only */ +#define FBIINIT6_SLI_SYNCOUT_OUTPUT(val) (((val) >> 15) & 3) /* voodoo 2 only */ +#define FBIINIT6_DAC_RD_OUTPUT(val) (((val) >> 17) & 3) /* voodoo 2 only */ +#define FBIINIT6_DAC_WR_OUTPUT(val) (((val) >> 19) & 3) /* voodoo 2 only */ +#define FBIINIT6_PCI_FIFO_LWM_RDY(val) (((val) >> 21) & 0x7f) /* voodoo 2 only */ +#define FBIINIT6_VGA_PASS_N_OUTPUT(val) (((val) >> 28) & 3) /* voodoo 2 only */ +#define FBIINIT6_X_VIDEO_TILES_BIT0(val) (((val) >> 30) & 1) /* voodoo 2 only */ + +#define FBIINIT7_GENERIC_STRAPPING(val) (((val) >> 0) & 0xff) /* voodoo 2 only */ +#define FBIINIT7_CMDFIFO_ENABLE(val) (((val) >> 8) & 1) /* voodoo 2 only */ +#define FBIINIT7_CMDFIFO_MEMORY_STORE(val) (((val) >> 9) & 1) /* voodoo 2 only */ +#define FBIINIT7_DISABLE_CMDFIFO_HOLES(val) (((val) >> 10) & 1) /* voodoo 2 only */ +#define FBIINIT7_CMDFIFO_READ_THRESH(val) (((val) >> 11) & 0x1f) /* voodoo 2 only */ +#define FBIINIT7_SYNC_CMDFIFO_WRITES(val) (((val) >> 16) & 1) /* voodoo 2 only */ +#define FBIINIT7_SYNC_CMDFIFO_READS(val) (((val) >> 17) & 1) /* voodoo 2 only */ +#define FBIINIT7_RESET_PCI_PACKER(val) (((val) >> 18) & 1) /* voodoo 2 only */ +#define FBIINIT7_ENABLE_CHROMA_STUFF(val) (((val) >> 19) & 1) /* voodoo 2 only */ +#define FBIINIT7_CMDFIFO_PCI_TIMEOUT(val) (((val) >> 20) & 0x7f) /* voodoo 2 only */ +#define FBIINIT7_ENABLE_TEXTURE_BURST(val) (((val) >> 27) & 1) /* voodoo 2 only */ + +#define TEXMODE_ENABLE_PERSPECTIVE(val) (((val) >> 0) & 1) +#define TEXMODE_MINIFICATION_FILTER(val) (((val) >> 1) & 1) +#define TEXMODE_MAGNIFICATION_FILTER(val) (((val) >> 2) & 1) +#define TEXMODE_CLAMP_NEG_W(val) (((val) >> 3) & 1) +#define TEXMODE_ENABLE_LOD_DITHER(val) (((val) >> 4) & 1) +#define TEXMODE_NCC_TABLE_SELECT(val) (((val) >> 5) & 1) +#define TEXMODE_CLAMP_S(val) (((val) >> 6) & 1) +#define TEXMODE_CLAMP_T(val) (((val) >> 7) & 1) +#define TEXMODE_FORMAT(val) (((val) >> 8) & 0xf) +#define TEXMODE_TC_ZERO_OTHER(val) (((val) >> 12) & 1) +#define TEXMODE_TC_SUB_CLOCAL(val) (((val) >> 13) & 1) +#define TEXMODE_TC_MSELECT(val) (((val) >> 14) & 7) +#define TEXMODE_TC_REVERSE_BLEND(val) (((val) >> 17) & 1) +#define TEXMODE_TC_ADD_ACLOCAL(val) (((val) >> 18) & 3) +#define TEXMODE_TC_INVERT_OUTPUT(val) (((val) >> 20) & 1) +#define TEXMODE_TCA_ZERO_OTHER(val) (((val) >> 21) & 1) +#define TEXMODE_TCA_SUB_CLOCAL(val) (((val) >> 22) & 1) +#define TEXMODE_TCA_MSELECT(val) (((val) >> 23) & 7) +#define TEXMODE_TCA_REVERSE_BLEND(val) (((val) >> 26) & 1) +#define TEXMODE_TCA_ADD_ACLOCAL(val) (((val) >> 27) & 3) +#define TEXMODE_TCA_INVERT_OUTPUT(val) (((val) >> 29) & 1) +#define TEXMODE_TRILINEAR(val) (((val) >> 30) & 1) +#define TEXMODE_SEQ_8_DOWNLD(val) (((val) >> 31) & 1) + +#define TEXLOD_LODMIN(val) (((val) >> 0) & 0x3f) +#define TEXLOD_LODMAX(val) (((val) >> 6) & 0x3f) +#define TEXLOD_LODBIAS(val) (((val) >> 12) & 0x3f) +#define TEXLOD_LOD_ODD(val) (((val) >> 18) & 1) +#define TEXLOD_LOD_TSPLIT(val) (((val) >> 19) & 1) +#define TEXLOD_LOD_S_IS_WIDER(val) (((val) >> 20) & 1) +#define TEXLOD_LOD_ASPECT(val) (((val) >> 21) & 3) +#define TEXLOD_LOD_ZEROFRAC(val) (((val) >> 23) & 1) +#define TEXLOD_TMULTIBASEADDR(val) (((val) >> 24) & 1) +#define TEXLOD_TDATA_SWIZZLE(val) (((val) >> 25) & 1) +#define TEXLOD_TDATA_SWAP(val) (((val) >> 26) & 1) +#define TEXLOD_TDIRECT_WRITE(val) (((val) >> 27) & 1) /* Voodoo 2 only */ + +#define TEXDETAIL_DETAIL_MAX(val) (((val) >> 0) & 0xff) +#define TEXDETAIL_DETAIL_BIAS(val) (((val) >> 8) & 0x3f) +#define TEXDETAIL_DETAIL_SCALE(val) (((val) >> 14) & 7) +#define TEXDETAIL_RGB_MIN_FILTER(val) (((val) >> 17) & 1) /* Voodoo 2 only */ +#define TEXDETAIL_RGB_MAG_FILTER(val) (((val) >> 18) & 1) /* Voodoo 2 only */ +#define TEXDETAIL_ALPHA_MIN_FILTER(val) (((val) >> 19) & 1) /* Voodoo 2 only */ +#define TEXDETAIL_ALPHA_MAG_FILTER(val) (((val) >> 20) & 1) /* Voodoo 2 only */ +#define TEXDETAIL_SEPARATE_RGBA_FILTER(val) (((val) >> 21) & 1) /* Voodoo 2 only */ + +#define TREXINIT_SEND_TMU_CONFIG(val) (((val) >> 18) & 1) + + + +struct voodoo_state; +struct poly_extra_data; +class voodoo_device; + +struct rgba +{ +#ifdef LSB_FIRST + UINT8 b, g, r, a; +#else + UINT8 a, r, g, b; +#endif +}; + + +union voodoo_reg +{ + INT32 i; + UINT32 u; + float f; + rgba rgb; +}; + + + +struct voodoo_stats +{ + UINT8 lastkey; /* last key state */ + UINT8 display; /* display stats? */ + INT32 swaps; /* total swaps */ + INT32 stalls; /* total stalls */ + INT32 total_triangles; /* total triangles */ + INT32 total_pixels_in; /* total pixels in */ + INT32 total_pixels_out; /* total pixels out */ + INT32 total_chroma_fail; /* total chroma fail */ + INT32 total_zfunc_fail; /* total z func fail */ + INT32 total_afunc_fail; /* total a func fail */ + INT32 total_clipped; /* total clipped */ + INT32 total_stippled; /* total stippled */ + INT32 lfb_writes; /* LFB writes */ + INT32 lfb_reads; /* LFB reads */ + INT32 reg_writes; /* register writes */ + INT32 reg_reads; /* register reads */ + INT32 tex_writes; /* texture writes */ + INT32 texture_mode[16]; /* 16 different texture modes */ + UINT8 render_override; /* render override */ + char buffer[1024]; /* string */ +}; + + +/* note that this structure is an even 64 bytes long */ +struct stats_block +{ + INT32 pixels_in; /* pixels in statistic */ + INT32 pixels_out; /* pixels out statistic */ + INT32 chroma_fail; /* chroma test fail statistic */ + INT32 zfunc_fail; /* z function test fail statistic */ + INT32 afunc_fail; /* alpha function test fail statistic */ + INT32 clip_fail; /* clipping fail statistic */ + INT32 stipple_count; /* stipple statistic */ + INT32 filler[64/4 - 7]; /* pad this structure to 64 bytes */ +}; + + +struct fifo_state +{ + UINT32 * base; /* base of the FIFO */ + INT32 size; /* size of the FIFO */ + INT32 in; /* input pointer */ + INT32 out; /* output pointer */ +}; + + +struct cmdfifo_info +{ + UINT8 enable; /* enabled? */ + UINT8 count_holes; /* count holes? */ + UINT32 base; /* base address in framebuffer RAM */ + UINT32 end; /* end address in framebuffer RAM */ + UINT32 rdptr; /* current read pointer */ + UINT32 amin; /* minimum address */ + UINT32 amax; /* maximum address */ + UINT32 depth; /* current depth */ + UINT32 holes; /* number of holes */ +}; + + +struct pci_state +{ + fifo_state fifo; /* PCI FIFO */ + UINT32 init_enable; /* initEnable value */ + UINT8 stall_state; /* state of the system if we're stalled */ + UINT8 op_pending; /* true if an operation is pending */ + attotime op_end_time; /* time when the pending operation ends */ + emu_timer * continue_timer; /* timer to use to continue processing */ + UINT32 fifo_mem[64*2]; /* memory backing the PCI FIFO */ +}; + + +struct ncc_table +{ + UINT8 dirty; /* is the texel lookup dirty? */ + voodoo_reg * reg; /* pointer to our registers */ + INT32 ir[4], ig[4], ib[4]; /* I values for R,G,B */ + INT32 qr[4], qg[4], qb[4]; /* Q values for R,G,B */ + INT32 y[16]; /* Y values */ + rgb_t * palette; /* pointer to associated RGB palette */ + rgb_t * palettea; /* pointer to associated ARGB palette */ + rgb_t texel[256]; /* texel lookup */ +}; + + +struct tmu_state +{ + UINT8 * ram; /* pointer to our RAM */ + UINT32 mask; /* mask to apply to pointers */ + voodoo_reg * reg; /* pointer to our register base */ + UINT32 regdirty; /* true if the LOD/mode/base registers have changed */ + + UINT32 texaddr_mask; /* mask for texture address */ + UINT8 texaddr_shift; /* shift for texture address */ + + INT64 starts, startt; /* starting S,T (14.18) */ + INT64 startw; /* starting W (2.30) */ + INT64 dsdx, dtdx; /* delta S,T per X */ + INT64 dwdx; /* delta W per X */ + INT64 dsdy, dtdy; /* delta S,T per Y */ + INT64 dwdy; /* delta W per Y */ + + INT32 lodmin, lodmax; /* min, max LOD values */ + INT32 lodbias; /* LOD bias */ + UINT32 lodmask; /* mask of available LODs */ + UINT32 lodoffset[9]; /* offset of texture base for each LOD */ + INT32 detailmax; /* detail clamp */ + INT32 detailbias; /* detail bias */ + UINT8 detailscale; /* detail scale */ + + UINT32 wmask; /* mask for the current texture width */ + UINT32 hmask; /* mask for the current texture height */ + + UINT32 bilinear_mask; /* mask for bilinear resolution (0xf0 for V1, 0xff for V2) */ + + ncc_table ncc[2]; /* two NCC tables */ + + rgb_t * lookup; /* currently selected lookup */ + rgb_t * texel[16]; /* texel lookups for each format */ + + rgb_t palette[256]; /* palette lookup table */ + rgb_t palettea[256]; /* palette+alpha lookup table */ +}; + + +struct tmu_shared_state +{ + rgb_t rgb332[256]; /* RGB 3-3-2 lookup table */ + rgb_t alpha8[256]; /* alpha 8-bit lookup table */ + rgb_t int8[256]; /* intensity 8-bit lookup table */ + rgb_t ai44[256]; /* alpha, intensity 4-4 lookup table */ + + rgb_t rgb565[65536]; /* RGB 5-6-5 lookup table */ + rgb_t argb1555[65536]; /* ARGB 1-5-5-5 lookup table */ + rgb_t argb4444[65536]; /* ARGB 4-4-4-4 lookup table */ +}; + + +struct setup_vertex +{ + float x, y; /* X, Y coordinates */ + float a, r, g, b; /* A, R, G, B values */ + float z, wb; /* Z and broadcast W values */ + float w0, s0, t0; /* W, S, T for TMU 0 */ + float w1, s1, t1; /* W, S, T for TMU 1 */ +}; + + +struct fbi_state +{ + UINT8 * ram; /* pointer to frame buffer RAM */ + UINT32 mask; /* mask to apply to pointers */ + UINT32 rgboffs[3]; /* word offset to 3 RGB buffers */ + UINT32 auxoffs; /* word offset to 1 aux buffer */ + + UINT8 frontbuf; /* front buffer index */ + UINT8 backbuf; /* back buffer index */ + UINT8 swaps_pending; /* number of pending swaps */ + UINT8 video_changed; /* did the frontbuffer video change? */ + + UINT32 yorigin; /* Y origin subtract value */ + UINT32 lfb_base; /* base of LFB in memory */ + UINT8 lfb_stride; /* stride of LFB accesses in bits */ + + UINT32 width; /* width of current frame buffer */ + UINT32 height; /* height of current frame buffer */ + UINT32 xoffs; /* horizontal offset (back porch) */ + UINT32 yoffs; /* vertical offset (back porch) */ + UINT32 vsyncscan; /* vertical sync scanline */ + UINT32 rowpixels; /* pixels per row */ + UINT32 tile_width; /* width of video tiles */ + UINT32 tile_height; /* height of video tiles */ + UINT32 x_tiles; /* number of tiles in the X direction */ + + emu_timer * vblank_timer; /* VBLANK timer */ + UINT8 vblank; /* VBLANK state */ + UINT8 vblank_count; /* number of VBLANKs since last swap */ + UINT8 vblank_swap_pending; /* a swap is pending, waiting for a vblank */ + UINT8 vblank_swap; /* swap when we hit this count */ + UINT8 vblank_dont_swap; /* don't actually swap when we hit this point */ + + /* triangle setup info */ + UINT8 cheating_allowed; /* allow cheating? */ + INT32 sign; /* triangle sign */ + INT16 ax, ay; /* vertex A x,y (12.4) */ + INT16 bx, by; /* vertex B x,y (12.4) */ + INT16 cx, cy; /* vertex C x,y (12.4) */ + INT32 startr, startg, startb, starta; /* starting R,G,B,A (12.12) */ + INT32 startz; /* starting Z (20.12) */ + INT64 startw; /* starting W (16.32) */ + INT32 drdx, dgdx, dbdx, dadx; /* delta R,G,B,A per X */ + INT32 dzdx; /* delta Z per X */ + INT64 dwdx; /* delta W per X */ + INT32 drdy, dgdy, dbdy, dady; /* delta R,G,B,A per Y */ + INT32 dzdy; /* delta Z per Y */ + INT64 dwdy; /* delta W per Y */ + + stats_block lfb_stats; /* LFB-access statistics */ + + UINT8 sverts; /* number of vertices ready */ + setup_vertex svert[3]; /* 3 setup vertices */ + + fifo_state fifo; /* framebuffer memory fifo */ + cmdfifo_info cmdfifo[2]; /* command FIFOs */ + + UINT8 fogblend[64]; /* 64-entry fog table */ + UINT8 fogdelta[64]; /* 64-entry fog table */ + UINT8 fogdelta_mask; /* mask for for delta (0xff for V1, 0xfc for V2) */ + + rgb_t pen[65536]; /* mapping from pixels to pens */ + rgb_t clut[512]; /* clut gamma data */ + UINT8 clut_dirty; /* do we need to recompute? */ +}; + + +struct dac_state +{ + UINT8 reg[8]; /* 8 registers */ + UINT8 read_result; /* pending read result */ +}; + + +struct raster_info +{ + raster_info * next; /* pointer to next entry with the same hash */ + poly_draw_scanline_func callback; /* callback pointer */ + UINT8 is_generic; /* TRUE if this is one of the generic rasterizers */ + UINT8 display; /* display index */ + UINT32 hits; /* how many hits (pixels) we've used this for */ + UINT32 polys; /* how many polys we've used this for */ + UINT32 eff_color_path; /* effective fbzColorPath value */ + UINT32 eff_alpha_mode; /* effective alphaMode value */ + UINT32 eff_fog_mode; /* effective fogMode value */ + UINT32 eff_fbz_mode; /* effective fbzMode value */ + UINT32 eff_tex_mode_0; /* effective textureMode value for TMU #0 */ + UINT32 eff_tex_mode_1; /* effective textureMode value for TMU #1 */ + UINT32 hash; +}; + + +struct poly_extra_data +{ + voodoo_device * device; + raster_info * info; /* pointer to rasterizer information */ + + INT16 ax, ay; /* vertex A x,y (12.4) */ + INT32 startr, startg, startb, starta; /* starting R,G,B,A (12.12) */ + INT32 startz; /* starting Z (20.12) */ + INT64 startw; /* starting W (16.32) */ + INT32 drdx, dgdx, dbdx, dadx; /* delta R,G,B,A per X */ + INT32 dzdx; /* delta Z per X */ + INT64 dwdx; /* delta W per X */ + INT32 drdy, dgdy, dbdy, dady; /* delta R,G,B,A per Y */ + INT32 dzdy; /* delta Z per Y */ + INT64 dwdy; /* delta W per Y */ + + INT64 starts0, startt0; /* starting S,T (14.18) */ + INT64 startw0; /* starting W (2.30) */ + INT64 ds0dx, dt0dx; /* delta S,T per X */ + INT64 dw0dx; /* delta W per X */ + INT64 ds0dy, dt0dy; /* delta S,T per Y */ + INT64 dw0dy; /* delta W per Y */ + INT32 lodbase0; /* used during rasterization */ + + INT64 starts1, startt1; /* starting S,T (14.18) */ + INT64 startw1; /* starting W (2.30) */ + INT64 ds1dx, dt1dx; /* delta S,T per X */ + INT64 dw1dx; /* delta W per X */ + INT64 ds1dy, dt1dy; /* delta S,T per Y */ + INT64 dw1dy; /* delta W per Y */ + INT32 lodbase1; /* used during rasterization */ + + UINT16 dither[16]; /* dither matrix, for fastfill */ +}; + + +struct banshee_info +{ + UINT32 io[0x40]; /* I/O registers */ + UINT32 agp[0x80]; /* AGP registers */ + UINT8 vga[0x20]; /* VGA registers */ + UINT8 crtc[0x27]; /* VGA CRTC registers */ + UINT8 seq[0x05]; /* VGA sequencer registers */ + UINT8 gc[0x05]; /* VGA graphics controller registers */ + UINT8 att[0x15]; /* VGA attribute registers */ + UINT8 attff; /* VGA attribute flip-flop */ + + UINT32 blt_regs[0x20]; /* 2D Blitter registers */ + UINT32 blt_dst_base; + UINT32 blt_dst_x; + UINT32 blt_dst_y; + UINT32 blt_dst_width; + UINT32 blt_dst_height; + UINT32 blt_dst_stride; + UINT32 blt_dst_bpp; + UINT32 blt_cmd; + UINT32 blt_src_base; + UINT32 blt_src_x; + UINT32 blt_src_y; + UINT32 blt_src_width; + UINT32 blt_src_height; + UINT32 blt_src_stride; + UINT32 blt_src_bpp; +}; + + +typedef voodoo_reg rgb_union; + + + + /*************************************************************************** CONSTANTS @@ -61,10 +1746,7 @@ enum FUNCTION PROTOTYPES ***************************************************************************/ -int voodoo_update(device_t *device, bitmap_rgb32 &bitmap, const rectangle &cliprect); -int voodoo_get_type(device_t *device); -int voodoo_is_stalled(device_t *device); -void voodoo_set_init_enable(device_t *device, UINT32 newval); +struct stats_block; /* ----- device interface ----- */ @@ -86,7 +1768,6 @@ public: DECLARE_WRITE32_MEMBER( voodoo_w ); // access to legacy token - struct voodoo_state *token() const { assert(m_token != nullptr); return m_token; } void common_start_voodoo(UINT8 type); UINT8 m_fbmem; @@ -96,15 +1777,112 @@ public: const char * m_cputag; devcb_write_line m_vblank; devcb_write_line m_stall; + + TIMER_CALLBACK_MEMBER( vblank_off_callback ); + TIMER_CALLBACK_MEMBER( stall_cpu_callback ); + TIMER_CALLBACK_MEMBER( vblank_callback ); + + static void voodoo_postload(voodoo_device *vd); + + int voodoo_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); + int voodoo_get_type(); + int voodoo_is_stalled(); + void voodoo_set_init_enable(UINT32 newval); + + // not all of these need to be static, review. + + static void check_stalled_cpu(voodoo_device* vd, attotime current_time); + static void flush_fifos( voodoo_device* vd, attotime current_time); + static void init_fbi(voodoo_device *vd, fbi_state *f, void *memory, int fbmem); + static INT32 register_w(voodoo_device *vd, offs_t offset, UINT32 data); + static INT32 swapbuffer(voodoo_device *vd, UINT32 data); + static void init_tmu(voodoo_device *vd, tmu_state *t, voodoo_reg *reg, void *memory, int tmem); + static INT32 lfb_w(voodoo_device *vd, offs_t offset, UINT32 data, UINT32 mem_mask); + static INT32 texture_w(voodoo_device *vd, offs_t offset, UINT32 data); + static INT32 lfb_direct_w(voodoo_device *vd, offs_t offset, UINT32 data, UINT32 mem_mask); + static INT32 banshee_2d_w(voodoo_device *vd, offs_t offset, UINT32 data); + static void stall_cpu(voodoo_device *vd, int state, attotime current_time); + static void soft_reset(voodoo_device *vd); + static void recompute_video_memory(voodoo_device *vd); + static INT32 fastfill(voodoo_device *vd); + static INT32 triangle(voodoo_device *vd); + static INT32 begin_triangle(voodoo_device *vd); + static INT32 draw_triangle(voodoo_device *vd); + static INT32 setup_and_draw_triangle(voodoo_device *vd); + static INT32 triangle_create_work_item(voodoo_device* vd,UINT16 *drawbuf, int texcount); + static raster_info *add_rasterizer(voodoo_device *vd, const raster_info *cinfo); + static raster_info *find_rasterizer(voodoo_device *vd, int texcount); + static void dump_rasterizer_stats(voodoo_device *vd); + static void init_tmu_shared(tmu_shared_state *s); + + static void swap_buffers(voodoo_device *vd); + static UINT32 cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f); + static INT32 cmdfifo_execute_if_ready(voodoo_device* vd, cmdfifo_info *f); + static void cmdfifo_w(voodoo_device *vd, cmdfifo_info *f, offs_t offset, UINT32 data); + + static void raster_fastfill(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid); + static void raster_generic_0tmu(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid); + static void raster_generic_1tmu(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid); + static void raster_generic_2tmu(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid); + +#define RASTERIZER_HEADER(name) \ + static void raster_##name(void *destbase, INT32 y, const poly_extent *extent, const void *extradata, int threadid); \ + +#define RASTERIZER_ENTRY(fbzcp, alpha, fog, fbz, tex0, tex1) \ + RASTERIZER_HEADER(fbzcp##_##alpha##_##fog##_##fbz##_##tex0##_##tex1) \ + +#include "voodoo_rast.inc" + +#undef RASTERIZER_ENTRY + + protected: // device-level overrides virtual void device_config_complete() override; virtual void device_stop() override; virtual void device_reset() override; -private: - // internal state - struct voodoo_state *m_token; +public: + // voodoo_state + UINT8 index; /* index of board */ + voodoo_device *device; /* pointer to our containing device */ + screen_device *screen; /* the screen we are acting on */ + device_t *cpu; /* the CPU we interact with */ + UINT8 vd_type; /* type of system */ + UINT8 chipmask; /* mask for which chips are available */ + UINT32 freq; /* operating frequency */ + attoseconds_t attoseconds_per_cycle; /* attoseconds per cycle */ + UINT32 extra_cycles; /* extra cycles not yet accounted for */ + int trigger; /* trigger used for stalling */ + + voodoo_reg reg[0x400]; /* raw registers */ + const UINT8 * regaccess; /* register access array */ + const char *const * regnames; /* register names array */ + UINT8 alt_regmap; /* enable alternate register map? */ + + pci_state pci; /* PCI state */ + dac_state dac; /* DAC state */ + + fbi_state fbi; /* FBI states */ + tmu_state tmu[MAX_TMU]; /* TMU states */ + tmu_shared_state tmushare; /* TMU shared state */ + banshee_info banshee; /* Banshee state */ + + legacy_poly_manager * poly; /* polygon manager */ + stats_block * thread_stats; /* per-thread statistics */ + + voodoo_stats stats; /* internal statistics */ + + offs_t last_status_pc; /* PC of last status description (for logging) */ + UINT32 last_status_value; /* value of last status read (for logging) */ + + int next_rasterizer; /* next rasterizer index */ + raster_info rasterizer[MAX_RASTERIZERS]; /* array of rasterizers */ + raster_info * raster_hash[RASTER_HASH_SIZE]; /* hash table of rasterizers */ + + bool send_config; + UINT32 tmu_config; + }; class voodoo_1_device : public voodoo_device diff --git a/src/devices/video/voodoo_pci.cpp b/src/devices/video/voodoo_pci.cpp index 7570a007efb..9d34442f08b 100644 --- a/src/devices/video/voodoo_pci.cpp +++ b/src/devices/video/voodoo_pci.cpp @@ -153,7 +153,7 @@ void voodoo_pci_device::map_extra(UINT64 memory_window_start, UINT64 memory_wind UINT32 voodoo_pci_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - return voodoo_update(m_voodoo, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; + return m_voodoo->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; } // PCI bus control @@ -170,7 +170,7 @@ WRITE32_MEMBER (voodoo_pci_device::pcictrl_w) switch (offset) { case 0x0/4: // The address map starts at 0x40 // HW initEnable - voodoo_set_init_enable(m_voodoo, data); + m_voodoo->voodoo_set_init_enable(data); logerror("%06X:voodoo_pci_device pcictrl_w to offset %02X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask); break; default: diff --git a/src/mame/drivers/funkball.cpp b/src/mame/drivers/funkball.cpp index caa650705fe..6eaf7c496ef 100644 --- a/src/mame/drivers/funkball.cpp +++ b/src/mame/drivers/funkball.cpp @@ -142,7 +142,7 @@ void funkball_state::video_start() UINT32 funkball_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) { - return voodoo_update(m_voodoo, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; + return m_voodoo->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; } static UINT32 voodoo_0_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) @@ -186,7 +186,7 @@ static void voodoo_0_pci_w(device_t *busdevice, device_t *device, int function, break; case 0x40: state->m_voodoo_pci_regs.init_enable = data; - voodoo_set_init_enable(state->m_voodoo, data); + state->m_voodoo->voodoo_set_init_enable(data); break; } } diff --git a/src/mame/drivers/gticlub.cpp b/src/mame/drivers/gticlub.cpp index b751e7fc029..e9cbb5e37a5 100644 --- a/src/mame/drivers/gticlub.cpp +++ b/src/mame/drivers/gticlub.cpp @@ -910,21 +910,21 @@ UINT32 gticlub_state::screen_update_hangplt(screen_device &screen, bitmap_rgb32 if (strcmp(screen.tag(), ":lscreen") == 0) { - device_t *voodoo = machine().device("voodoo0"); + voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo0"); // m_k001604_1->draw_back_layer(bitmap, cliprect); - voodoo_update(voodoo, bitmap, cliprect); + voodoo->voodoo_update(bitmap, cliprect); m_k001604_1->draw_front_layer(screen, bitmap, cliprect); } else if (strcmp(screen.tag(), ":rscreen") == 0) { - device_t *voodoo = machine().device("voodoo1"); + voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo1"); // m_k001604_2->draw_back_layer(bitmap, cliprect); - voodoo_update(voodoo, bitmap, cliprect); + voodoo->voodoo_update(bitmap, cliprect); m_k001604_2->draw_front_layer(screen, bitmap, cliprect); } diff --git a/src/mame/drivers/hornet.cpp b/src/mame/drivers/hornet.cpp index 49200920f36..b1df15c8419 100644 --- a/src/mame/drivers/hornet.cpp +++ b/src/mame/drivers/hornet.cpp @@ -478,9 +478,9 @@ WRITE_LINE_MEMBER(hornet_state::voodoo_vblank_1) UINT32 hornet_state::screen_update_hornet(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - device_t *voodoo = machine().device("voodoo0"); + voodoo_device* voodoo = (voodoo_device*)machine().device("voodoo0"); - voodoo_update(voodoo, bitmap, cliprect); + voodoo->voodoo_update(bitmap, cliprect); m_k037122_1->tile_draw(screen, bitmap, cliprect); @@ -493,16 +493,16 @@ UINT32 hornet_state::screen_update_hornet_2board(screen_device &screen, bitmap_r { if (strcmp(screen.tag(), ":lscreen") == 0) { - device_t *voodoo = machine().device("voodoo0"); - voodoo_update(voodoo, bitmap, cliprect); + voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo0"); + voodoo->voodoo_update(bitmap, cliprect); /* TODO: tilemaps per screen */ m_k037122_1->tile_draw(screen, bitmap, cliprect); } else if (strcmp(screen.tag(), ":rscreen") == 0) { - device_t *voodoo = machine().device("voodoo1"); - voodoo_update(voodoo, bitmap, cliprect); + voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo1"); + voodoo->voodoo_update(bitmap, cliprect); /* TODO: tilemaps per screen */ m_k037122_2->tile_draw(screen, bitmap, cliprect); diff --git a/src/mame/drivers/magictg.cpp b/src/mame/drivers/magictg.cpp index 0235da41a9a..901c8070390 100644 --- a/src/mame/drivers/magictg.cpp +++ b/src/mame/drivers/magictg.cpp @@ -180,7 +180,7 @@ public: /* 3Dfx Voodoo */ - device_t* m_voodoo[2]; + voodoo_device* m_voodoo[2]; struct { @@ -241,8 +241,8 @@ public: void magictg_state::machine_start() { - m_voodoo[0] = machine().device("voodoo_0"); - m_voodoo[1] = machine().device("voodoo_1"); + m_voodoo[0] = (voodoo_device*)machine().device("voodoo_0"); + m_voodoo[1] = (voodoo_device*)machine().device("voodoo_1"); } @@ -278,7 +278,7 @@ void magictg_state::video_start() UINT32 magictg_state::screen_update_magictg(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - return voodoo_update(m_voodoo[0], bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; + return m_voodoo[0]->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; } @@ -338,7 +338,7 @@ static void voodoo_0_pci_w(device_t *busdevice, device_t *device, int function, break; case 0x40: state->m_voodoo_pci_regs[0].init_enable = data; - voodoo_set_init_enable(state->m_voodoo[0], data); + state->m_voodoo[0]->voodoo_set_init_enable(data); break; default: @@ -601,8 +601,8 @@ WRITE32_MEMBER( magictg_state::f0_w ) UINT32 dst_addr = m_dma_ch[ch].dst_addr; //device_t *voodoo = dst_addr > 0xa000000 voodoo0 : voodoo1; - assert(DWORD_ALIGNED(src_addr)); - assert(DWORD_ALIGNED(dst_addr)); + assert((src_addr & 3) == 0); + assert((dst_addr & 3) == 0); while (m_dma_ch[ch].count > 3) { diff --git a/src/mame/drivers/nwk-tr.cpp b/src/mame/drivers/nwk-tr.cpp index 3d4719b95f1..9ec6ba6f9c4 100644 --- a/src/mame/drivers/nwk-tr.cpp +++ b/src/mame/drivers/nwk-tr.cpp @@ -346,11 +346,11 @@ WRITE_LINE_MEMBER(nwktr_state::voodoo_vblank_0) UINT32 nwktr_state::screen_update_nwktr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - device_t *voodoo = machine().device("voodoo0"); + voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo0"); bitmap.fill(m_palette->pen(0), cliprect); - voodoo_update(voodoo, bitmap, cliprect); + voodoo->voodoo_update(bitmap, cliprect); const rectangle &visarea = screen.visible_area(); const rectangle tilemap_rect(visarea.min_x, visarea.max_x, visarea.min_y+16, visarea.max_y); diff --git a/src/mame/drivers/savquest.cpp b/src/mame/drivers/savquest.cpp index 784278096fa..77cb34fcc37 100644 --- a/src/mame/drivers/savquest.cpp +++ b/src/mame/drivers/savquest.cpp @@ -336,7 +336,7 @@ void savquest_state::vid_3dfx_init() m_pci_3dfx_regs[0x08 / 4] = 2; // revision ID m_pci_3dfx_regs[0x10 / 4] = 0xff000000; m_pci_3dfx_regs[0x40 / 4] = 0x4000; //INITEN_SECONDARY_REV_ID - voodoo_set_init_enable(m_voodoo, 0x4000); //INITEN_SECONDARY_REV_ID + m_voodoo->voodoo_set_init_enable(0x4000); //INITEN_SECONDARY_REV_ID } static UINT32 pci_3dfx_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) @@ -358,7 +358,7 @@ osd_printf_warning("PCI write: %x %x\n", reg, data); } else if (reg == 0x40) { - voodoo_set_init_enable(state->m_voodoo, data); + state->m_voodoo->voodoo_set_init_enable(data); } else if (reg == 0x54) { diff --git a/src/mame/drivers/seattle.cpp b/src/mame/drivers/seattle.cpp index 57295aec2ac..79b56322995 100644 --- a/src/mame/drivers/seattle.cpp +++ b/src/mame/drivers/seattle.cpp @@ -540,7 +540,7 @@ public: UINT32 seattle_state::screen_update_seattle(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - return voodoo_update(m_voodoo, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; + return m_voodoo->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; } @@ -876,7 +876,7 @@ void seattle_state::pci_3dfx_w(address_space &space, UINT8 reg, UINT8 type, UINT break; case 0x10: /* initEnable register */ - voodoo_set_init_enable(m_voodoo, data); + m_voodoo->voodoo_set_init_enable(data); break; } if (LOG_PCI) diff --git a/src/mame/drivers/vegas.cpp b/src/mame/drivers/vegas.cpp index c71cff65f1a..c65e6885d9a 100644 --- a/src/mame/drivers/vegas.cpp +++ b/src/mame/drivers/vegas.cpp @@ -493,7 +493,7 @@ public: UINT8 m_sio_led_state; UINT8 m_pending_analog_read; UINT8 m_cmos_unlocked; - device_t *m_voodoo; + voodoo_device *m_voodoo; UINT8 m_dcs_idma_cs; int m_count; int m_dynamic_count; @@ -567,7 +567,7 @@ public: UINT32 vegas_state::screen_update_vegas(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - return voodoo_update(m_voodoo, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; + return m_voodoo->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; } @@ -579,7 +579,7 @@ UINT32 vegas_state::screen_update_vegas(screen_device &screen, bitmap_rgb32 &bit void vegas_state::machine_start() { - m_voodoo = machine().device("voodoo"); + m_voodoo = (voodoo_device*)machine().device("voodoo"); /* allocate timers for the NILE */ m_timer[0] = machine().scheduler().timer_alloc(FUNC_NULL); @@ -797,7 +797,7 @@ WRITE32_MEMBER( vegas_state::pci_ide_w ) READ32_MEMBER( vegas_state::pci_3dfx_r ) { - int voodoo_type = voodoo_get_type(m_voodoo); + int voodoo_type = m_voodoo->voodoo_get_type(); UINT32 result = m_pci_3dfx_regs[offset]; switch (offset) @@ -830,7 +830,7 @@ READ32_MEMBER( vegas_state::pci_3dfx_r ) WRITE32_MEMBER( vegas_state::pci_3dfx_w ) { - int voodoo_type = voodoo_get_type(m_voodoo); + int voodoo_type = m_voodoo->voodoo_get_type(); m_pci_3dfx_regs[offset] = data; @@ -869,7 +869,7 @@ WRITE32_MEMBER( vegas_state::pci_3dfx_w ) break; case 0x10: /* initEnable register */ - voodoo_set_init_enable(m_voodoo, data); + m_voodoo->voodoo_set_init_enable(data); break; } @@ -1555,7 +1555,7 @@ inline void vegas_state::_add_dynamic_address(offs_t start, offs_t end, read32_d void vegas_state::remap_dynamic_addresses() { dynamic_address *dynamic = m_dynamic; - int voodoo_type = voodoo_get_type(m_voodoo); + int voodoo_type = m_voodoo->voodoo_get_type(); offs_t base; int addr; diff --git a/src/mame/drivers/viper.cpp b/src/mame/drivers/viper.cpp index c10c28e55d0..8f4bd3cfbd1 100644 --- a/src/mame/drivers/viper.cpp +++ b/src/mame/drivers/viper.cpp @@ -435,8 +435,8 @@ public: UINT32 viper_state::screen_update_viper(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - device_t *device = machine().device("voodoo"); - return voodoo_update(device, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; + voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo"); + return voodoo->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED; } UINT32 m_mpc8240_regs[256/4]; -- cgit v1.2.3-70-g09d2 From 45f84d902e064e36c96761c870afcbd945d4c921 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 2 Feb 2016 20:39:58 +0000 Subject: new clones 1000 Miglia: Great 1000 Miles Rally (94/05/26) [caius] --- src/mame/arcade.lst | 1 + src/mame/drivers/kaneko16.cpp | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 078e57d5902..ce49625dfe7 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -9275,6 +9275,7 @@ oedfight // (c) 1994 Kaneko bonkadv // (c) 1994 Kaneko gtmr // (c) 1994 Kaneko gtmra // (c) 1994 Kaneko +gtmrb // (c) 1994 Kaneko gtmro // (c) 1994 Kaneko gtmre // (c) 1994 Kaneko gtmrusa // (c) 1994 Kaneko (US) diff --git a/src/mame/drivers/kaneko16.cpp b/src/mame/drivers/kaneko16.cpp index ca2a754857e..b9c25759145 100644 --- a/src/mame/drivers/kaneko16.cpp +++ b/src/mame/drivers/kaneko16.cpp @@ -3342,6 +3342,35 @@ ROM_START( gtmra ) /* Not present on this board */ ROM_END +ROM_START( gtmrb ) + ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "mmp0x1.u514", 0x000000, 0x080000, CRC(6c163f12) SHA1(7f33d1475dcb754c83f68b5fb686fb236ba81256) ) + ROM_LOAD16_BYTE( "mmp1x1.u513", 0x000001, 0x080000, CRC(424dc7e1) SHA1(a9cb8d1fd0549c8c77462552c649c180c30eef89) ) + + ROM_REGION( 0x020000, "mcudata", 0 ) /* MCU Code */ + ROM_LOAD16_WORD_SWAP( "mmd0x1.u124", 0x000000, 0x020000, CRC(3d7cb329) SHA1(053106acde642a414fde0b01105fe6762b6a10f6) ) // == mmd0x2 + + ROM_REGION( 0x840000, "gfx1", 0 ) /* Sprites */ + ROM_LOAD( "mm-200-402-s0.bin", 0x000000, 0x200000, CRC(c0ab3efc) SHA1(e6cd15480977b036234d91e6f3a6e21b7f0a3c3e) ) + ROM_LOAD( "mm-201-403-s1.bin", 0x200000, 0x200000, CRC(cf6b23dc) SHA1(ccfd0b17507e091e55c169361cd6a6b19641b717) ) + ROM_LOAD( "mm-202-404-s2.bin", 0x400000, 0x200000, CRC(8f27f5d3) SHA1(219a86446ce2556682009d8aff837480f040a01e) ) + ROM_LOAD( "mm-203-405-s3.bin", 0x600000, 0x080000, CRC(e9747c8c) SHA1(2507102ec34755c6f110eadb3444e6d3a3474051) ) + ROM_LOAD16_BYTE( "mms1x1.u30", 0x800001, 0x020000, CRC(9463825c) SHA1(696bbfc816b564b3cff1487e1b848d375951f923) ) + ROM_LOAD16_BYTE( "mms0x1.u29", 0x800000, 0x020000, CRC(bd22b7d2) SHA1(ef82d00d72439590c71aed33ecfabc6ee71a6ff9) ) // == mms0x2 + + ROM_REGION( 0x200000, "gfx2", 0 ) /* Tiles (scrambled) */ + ROM_LOAD( "mm-300-406-a0.bin", 0x000000, 0x200000, CRC(b15f6b7f) SHA1(5e84919d788add53fc87f4d85f437df413b1dbc5) ) + + ROM_REGION( 0x200000, "gfx3", 0 ) /* Tiles (scrambled) */ + ROM_COPY("gfx2",0x000000,0,0x200000) // it isn't on the board twice. + + ROM_REGION( 0x400000, "oki1", 0 ) /* Samples, plus room for expansion */ + ROM_LOAD( "mm-100-401-e0.bin", 0x000000, 0x100000, CRC(b9cbfbee) SHA1(051d48a68477ef9c29bd5cc0bb7955d513a0ab94) ) // 16 x $10000 + + ROM_REGION( 0x100000, "oki2", ROMREGION_ERASE00 ) /* Samples */ + /* Not present on this board */ +ROM_END + ROM_START( gtmro ) ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */ @@ -4380,8 +4409,9 @@ GAME( 1993, wingforc, 0, wingforc, wingforc, kaneko16_state, kan GAME( 1994, bonkadv, 0, bonkadv , bonkadv, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "B.C. Kid / Bonk's Adventure / Kyukyoku!! PC Genjin", MACHINE_SUPPORTS_SAVE ) GAME( 1994, bloodwar, 0, bloodwar, bloodwar, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "Blood Warrior", MACHINE_SUPPORTS_SAVE ) GAME( 1994, oedfight, bloodwar, bloodwar, bloodwar, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "Oedo Fight (Japan Bloodshed Ver.)", MACHINE_SUPPORTS_SAVE ) -GAME( 1994, gtmr, 0, gtmr, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "1000 Miglia: Great 1000 Miles Rally (94/07/18)", MACHINE_SUPPORTS_SAVE ) +GAME( 1994, gtmr, 0, gtmr, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "1000 Miglia: Great 1000 Miles Rally (94/07/18)", MACHINE_SUPPORTS_SAVE ) // this set shows 'PCB by Jinwei Co Ltd. ROC' GAME( 1994, gtmra, gtmr, gtmr, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "1000 Miglia: Great 1000 Miles Rally (94/06/13)", MACHINE_SUPPORTS_SAVE ) +GAME( 1994, gtmrb, gtmr, gtmr, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "1000 Miglia: Great 1000 Miles Rally (94/05/26)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, gtmro, gtmr, gtmr, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "1000 Miglia: Great 1000 Miles Rally (94/05/10)", MACHINE_SUPPORTS_SAVE ) // possible prototype GAME( 1994, gtmre, gtmr, gtmre, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "Great 1000 Miles Rally: Evolution Model!!! (94/09/06)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, gtmrusa, gtmr, gtmre, gtmr, kaneko16_gtmr_state, gtmr, ROT0, "Kaneko", "Great 1000 Miles Rally: U.S.A Version! (94/09/06)", MACHINE_SUPPORTS_SAVE ) // U.S.A version seems part of the title, rather than region -- cgit v1.2.3-70-g09d2 From c9faa144ba4663821f5d39cfd61b5dce2af72e50 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Tue, 2 Feb 2016 15:44:09 -0500 Subject: Made anonymous timer non-anonymous in arkanoid.cpp, fixes savestates for the sets using the original Taito MCU code [Lord Nightmare] --- src/mame/drivers/arkanoid.cpp | 5 +++++ src/mame/includes/arkanoid.h | 2 +- src/mame/machine/arkanoid.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/arkanoid.cpp b/src/mame/drivers/arkanoid.cpp index 09318ad84eb..e4e33fcdea2 100644 --- a/src/mame/drivers/arkanoid.cpp +++ b/src/mame/drivers/arkanoid.cpp @@ -1245,6 +1245,10 @@ GFXDECODE_END void arkanoid_state::machine_start() { + // allocate the MCU timer, even if we have no MCU, and set it to fire NEVER. + m_68705_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(arkanoid_state::timer_68705_increment),this)); + m_68705_timer->adjust(attotime::never); + save_item(NAME(m_gfxbank)); save_item(NAME(m_palettebank)); @@ -1284,6 +1288,7 @@ void arkanoid_state::machine_reset() m_z80HasWritten = 0; m_68705HasWritten = 0; if (m_mcu.found()) m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE); + if (m_mcu.found()) m_68705_timer->adjust(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<7))); m_port_a_in = 0; m_port_a_out = 0; diff --git a/src/mame/includes/arkanoid.h b/src/mame/includes/arkanoid.h index 483975bd45f..3bae2fd73bf 100644 --- a/src/mame/includes/arkanoid.h +++ b/src/mame/includes/arkanoid.h @@ -62,7 +62,7 @@ public: UINT8 m_ddr_c; UINT8 m_tdr; UINT8 m_tcr; - + emu_timer *m_68705_timer; /* hexaa */ UINT8 m_hexaa_from_main; diff --git a/src/mame/machine/arkanoid.cpp b/src/mame/machine/arkanoid.cpp index 11b352e63df..02bb306a1b6 100644 --- a/src/mame/machine/arkanoid.cpp +++ b/src/mame/machine/arkanoid.cpp @@ -82,14 +82,14 @@ WRITE8_MEMBER(arkanoid_state::arkanoid_68705_tcr_w) if ((m_tcr^data)&0x20)// check if TIN state changed { /* logerror("timer enable state changed!\n"); */ - if (data&0x20) timer_set(attotime::never, TIMER_68705_PRESCALER_EXPIRED); - else timer_set(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(data&0x7))), TIMER_68705_PRESCALER_EXPIRED); + if (data&0x20) m_68705_timer->adjust(attotime::never, TIMER_68705_PRESCALER_EXPIRED); + else m_68705_timer->adjust(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(data&0x7))), TIMER_68705_PRESCALER_EXPIRED); } // prescaler check: if timer prescaler has changed, or the PSC bit is set, adjust the timer length for the prescaler expired timer, but only if the timer would be running if ( (((m_tcr&0x07)!=(data&0x07))||(data&0x08)) && ((data&0x20)==0) ) { /* logerror("timer reset due to PSC or prescaler change!\n"); */ - timer_set(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(data&0x7))), TIMER_68705_PRESCALER_EXPIRED); + m_68705_timer->adjust(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(data&0x7))), TIMER_68705_PRESCALER_EXPIRED); } m_tcr = data; // if int state is set, and TIM is unmasked, assert an interrupt. otherwise clear it. @@ -120,7 +120,7 @@ TIMER_CALLBACK_MEMBER(arkanoid_state::timer_68705_increment) m_mcu->set_input_line(M68705_INT_TIMER, ASSERT_LINE); else m_mcu->set_input_line(M68705_INT_TIMER, CLEAR_LINE); - timer_set(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(m_tcr&0x7))), TIMER_68705_PRESCALER_EXPIRED); + m_68705_timer->adjust(attotime::from_hz(((XTAL_12MHz/4)/4)/(1<<(m_tcr&0x7))), TIMER_68705_PRESCALER_EXPIRED); } READ8_MEMBER(arkanoid_state::arkanoid_68705_port_c_r) -- cgit v1.2.3-70-g09d2 From b11f39e7a0dbccee2a69ecc96e6584b7f3536f03 Mon Sep 17 00:00:00 2001 From: Victor Vasiliev Date: Mon, 1 Feb 2016 17:29:25 -0500 Subject: Do not handle any UI inputs immediately after state load/save Before this change, if you try to save state to a bound which already does something as a UI button, it will save state there and then immediately execute the bound action (sometimes it would not happen). So, if you have state to P, with default button it would pause the game immediately after saving state (except sometimes it would not). --- src/emu/ui/ui.cpp | 3 +++ src/emu/uiinput.cpp | 10 ++++++++++ src/emu/uiinput.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 577a0cb015d..304c365ac6a 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -1755,6 +1755,9 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container machine.schedule_load(filename); } + // avoid handling the name of the save state slot as a seperate input + machine.ui_input().mark_all_as_pressed(); + // remove the pause and reset the state machine.resume(); return UI_HANDLER_CANCEL; diff --git a/src/emu/uiinput.cpp b/src/emu/uiinput.cpp index 6b26bb323b5..b1ee53a697b 100644 --- a/src/emu/uiinput.cpp +++ b/src/emu/uiinput.cpp @@ -324,3 +324,13 @@ void ui_input_manager::push_char_event(render_target* target, unicode_char ch) event.ch = ch; push_event(event); } + +/*------------------------------------------------- + mark_all_as_pressed - marks all buttons + as if they were already pressed once +-------------------------------------------------*/ +void ui_input_manager::mark_all_as_pressed() +{ + for (int code = IPT_UI_FIRST + 1; code < IPT_UI_LAST; code++) + m_next_repeat[code] = osd_ticks(); +} diff --git a/src/emu/uiinput.h b/src/emu/uiinput.h index 2e89a0c413a..ff4137faf74 100644 --- a/src/emu/uiinput.h +++ b/src/emu/uiinput.h @@ -86,6 +86,8 @@ public: void push_mouse_double_click_event(render_target* target, INT32 x, INT32 y); void push_char_event(render_target* target, unicode_char ch); + void mark_all_as_pressed(); + private: // internal state -- cgit v1.2.3-70-g09d2 From c626466050146c9ddb8533222c5486dc3125e07b Mon Sep 17 00:00:00 2001 From: Victor Vasiliev Date: Mon, 1 Feb 2016 10:29:47 -0500 Subject: Do not read the load/save state filename while sequence is still pressed Fixes the issue where, if the save state button was bound to something that was a legal save state input, it would occasionally immediately save the state onto the same button as "save state" input itself was bound. --- src/emu/ui/ui.cpp | 19 +++++++++++++++++++ src/emu/ui/ui.h | 1 + 2 files changed, 20 insertions(+) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 304c365ac6a..df16d384ebb 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -1625,6 +1625,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (machine.ui_input().pressed(IPT_UI_SAVE_STATE)) { machine.pause(); + machine.ui().m_load_save_hold = true; return machine.ui().set_handler(handler_load_save, LOADSAVE_SAVE); } @@ -1632,6 +1633,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (machine.ui_input().pressed(IPT_UI_LOAD_STATE)) { machine.pause(); + machine.ui().m_load_save_hold = true; return machine.ui().set_handler(handler_load_save, LOADSAVE_LOAD); } @@ -1713,6 +1715,23 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container else machine.ui().draw_message_window(container, "Select position to load from"); + // if load/save state sequence is still being pressed, do not read the filename yet + if (machine.ui().m_load_save_hold) { + bool seq_in_progress = false; + const input_seq &load_save_seq = state == LOADSAVE_SAVE ? + machine.ioport().type_seq(IPT_UI_SAVE_STATE) : + machine.ioport().type_seq(IPT_UI_LOAD_STATE); + + for (int i = 0; i < load_save_seq.length(); i++) + if (machine.input().code_pressed_once(load_save_seq[i])) + seq_in_progress = true; + + if (seq_in_progress) + return state; + else + machine.ui().m_load_save_hold = false; + } + // check for cancel key if (machine.ui_input().pressed(IPT_UI_CANCEL)) { diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h index ac68a2fb773..d0f7a28ad27 100644 --- a/src/emu/ui/ui.h +++ b/src/emu/ui/ui.h @@ -182,6 +182,7 @@ private: std::unique_ptr m_non_char_keys_down; render_texture * m_mouse_arrow_texture; bool m_mouse_show; + bool m_load_save_hold; // text generators std::string &disclaimer_string(std::string &buffer); -- cgit v1.2.3-70-g09d2 From f6331aaf656437913eb63e7c51439505aec6571f Mon Sep 17 00:00:00 2001 From: Victor Vasiliev Date: Tue, 2 Feb 2016 15:27:21 -0500 Subject: Allow saved states to be bound to joystick buttons --- src/emu/ui/ui.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index df16d384ebb..f32f35ca71a 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -37,6 +37,8 @@ enum LOADSAVE_SAVE }; +#define MAX_SAVED_STATE_JOYSTICK 4 + /*************************************************************************** LOCAL VARIABLES @@ -1759,18 +1761,35 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container if (machine.input().code_pressed_once(input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, id))) file = id - ITEM_ID_0_PAD + '0'; if (file == 0) - return state; + { + bool found = false; + + for (int joy_index = 0; joy_index <= MAX_SAVED_STATE_JOYSTICK; joy_index++) + for (input_item_id id = ITEM_ID_BUTTON1; id <= ITEM_ID_BUTTON32; ++id) + if (machine.input().code_pressed_once(input_code(DEVICE_CLASS_JOYSTICK, joy_index, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, id))) + { + snprintf(filename, sizeof(filename), "joy%i-%i", joy_index, id - ITEM_ID_BUTTON1 + 1); + found = true; + break; + } + + if (!found) + return state; + } + else + { + sprintf(filename, "%c", file); + } // display a popup indicating that the save will proceed - sprintf(filename, "%c", file); if (state == LOADSAVE_SAVE) { - machine.popmessage("Save to position %c", file); + machine.popmessage("Save to position %s", filename); machine.schedule_save(filename); } else { - machine.popmessage("Load from position %c", file); + machine.popmessage("Load from position %s", filename); machine.schedule_load(filename); } -- cgit v1.2.3-70-g09d2 From 1913d6add124f21b438de9526253f2bebbec19a8 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 2 Feb 2016 23:16:25 +0000 Subject: new NOT WORKING Print Club 2 Pepsiman (J 970618 V1.100) [Team Europe, Mooglyguy] Print Club 2 Vol. 6 Winter (J 961210 V1.000) [Team Europe, Mooglyguy] Name Club (J 960315 V1.000) [Team Europe, Mooglyguy] --- src/mame/arcade.lst | 5 ++- src/mame/drivers/stv.cpp | 83 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 75 insertions(+), 13 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index ce49625dfe7..589a0228436 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -5143,12 +5143,15 @@ shienryu // 1997.02 Shienryu (Warashi) vmahjong // 1997.02 Virtual Mahjong (Micronet) pclub2kc // 1997.02 Print Club Kome Kome Club pclub2fc // 1997.04 Print Club 2 Felix The Cat +pclub2pe // pclub2pf // +pclub26w // pclub27s // pclubyo2 // groovef // 1997.05 Groove on Fight (Atlus) nclubv3 // 1997.07 Name Club Ver. 3 -nclubv2 +nclubv2 // +nameclub // pclb2elk // 1997.07 Print Club Custom pclub2 // 1997.09 Print Club 2 thunt // 1997.09 Puzzle & Action Treasure Hunt (Sega (Deniam License)) diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index ce0ce699750..9a73880705b 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -2955,6 +2955,22 @@ ROM_START( pclub298 ) // set to 1p ROM_LOAD( "pclub298.nv", 0x0000, 0x0080, CRC(a23dd0f2) SHA1(457282b5d40a17477b95330bba91e05c603f951e) ) ROM_END + +ROM_START( pclub26w ) // set to 1p + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ + + ROM_LOAD16_WORD_SWAP( "pclbvol6w_IC22", 0x0200000, 0x0200000, CRC(72aa320c) SHA1(09bc30e8cb00a5a4014c44e468cc64f6c3425d92) ) + ROM_LOAD16_WORD_SWAP( "pclbvol6w_IC24", 0x0400000, 0x0200000, CRC(d98371e2) SHA1(813ac5f3c5b57d07cc319c73560bc0719ddcfe6b) ) + ROM_LOAD16_WORD_SWAP( "pclbvol6w_IC26", 0x0600000, 0x0200000, CRC(e6bbe3a5) SHA1(b2f642b8ca0779ad66cfbbadece40f4e3dc41fd1) ) + ROM_LOAD16_WORD_SWAP( "pclbvol6w_IC28", 0x0800000, 0x0200000, CRC(3c330c9b) SHA1(92f8e8d4f43db7c4ce431d17501492a7f8d8a867) ) + ROM_LOAD16_WORD_SWAP( "pclbvol6w_IC30", 0x0a00000, 0x0200000, CRC(67646090) SHA1(ed6402a22acafa0203c587b871edc547f0ec5277) ) + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "pclub26w.nv", 0x0000, 0x0080, CRC(448f770d) SHA1(5f966c511c4c8e9d5b2d257c41c2c88a453b4944) ) +ROM_END + ROM_START( pclub27s ) // set to 1p STV_BIOS @@ -2970,6 +2986,22 @@ ROM_START( pclub27s ) // set to 1p ROM_LOAD( "pclub27s.nv", 0x0000, 0x0080, CRC(e58c7167) SHA1(d88b1648c5d86a90615a8c6a1bf87bc9e75dc320) ) ROM_END +ROM_START( pclub2pe ) // set to 1p + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ + + ROM_LOAD16_WORD_SWAP( "pclb2psi_IC22", 0x0200000, 0x0200000, CRC(caadc660) SHA1(f2e84bee96266bb03d8f9009249c17c27935f82e) ) + ROM_LOAD16_WORD_SWAP( "pclb2psi_IC24", 0x0400000, 0x0200000, CRC(ece82698) SHA1(b17b1ea8adc13c3722067c9854d1b7fdf3917090) ) + ROM_LOAD16_WORD_SWAP( "pclb2psi_IC26", 0x0600000, 0x0200000, CRC(c8a1e335) SHA1(a95ddfc41fdd9f720c11208f45ef5db4bee6cb97) ) + ROM_LOAD16_WORD_SWAP( "pclb2psi_IC28", 0x0800000, 0x0200000, CRC(52f09627) SHA1(e2ffc321bb0f2a650d0c0b39c3ec68226e1ca7f4) ) + ROM_LOAD16_WORD_SWAP( "pclb2psi_IC30", 0x0a00000, 0x0200000, CRC(03b9eacf) SHA1(d69c10f7613d9f52042dd6cce64e74e2b1ecc2d8) ) + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "pclub2pe.nv", 0x0000, 0x0080, CRC(447bb3bd) SHA1(9fefec09849bfa0c14b49e73ff13e2a538dff511)) +ROM_END + + ROM_START( pclubyo2 ) // set to 1p STV_BIOS @@ -3123,20 +3155,38 @@ ROM_START( pclove ) ROM_LOAD( "pclove.nv", 0x0000, 0x0080, CRC(3c78e3bd) SHA1(6d5fe8545f434b4cc1e8229549adb0a49ac45bd1) ) ROM_END +// Name Club / Name Club vol.2 +// have an unusual rom mapping compared to other games, the cartridge is a little different too, with a large PALCE16V8H-10 marked 315-6026 +// For Name Club vol. 2, the protection device (317-0229 on both) is checked in the 'each game test' menu as 'RCDD2' +// For the service mode test the game just passes a large block of compressed data and checksums the result, it doesn't even look like it's +// passing 100% valid data, just an entire section of ROM, checking the result against a pre-calculated checksum. + +// The device is accessed by the game when you choose to print, it looks like it's decompressing the full-size graphics for the printer rather +// than anything you see onscreen. It makes quite extensive use of the device, with lots of different dictionaries, unlike Decathlete where +// there are only 2 that cover all the data. + +ROM_START( nameclub ) + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASEFF ) /* SH2 code */ + ROM_LOAD16_WORD_SWAP( "ic22", 0x0200000, 0x0200000, CRC(ac23c648) SHA1(4dd099a92ff162082eb24a61a277ca907b3f9892) ) // OK + ROM_LOAD16_WORD_SWAP( "ic24", 0x0600000, 0x0200000, CRC(a16902e3) SHA1(85c582cb0d02ef028a8ae32688c20a5b5aeeaae8) ) // OK + ROM_LOAD16_WORD_SWAP( "ic26", 0x0a00000, 0x0200000, CRC(a5eab3f3) SHA1(1b7263639bb8f4aa644cc46133988ef4d2b6c9de) ) // OK + ROM_LOAD16_WORD_SWAP( "ic28", 0x0e00000, 0x0200000, CRC(34ed677a) SHA1(ff2c4dd8fae33ac618f6e3e28ba71c4ecb4ca88f) ) // OK + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "nameclub.nv", 0x0000, 0x0080, CRC(680a64bc) SHA1(45194bbe4a7e67f0e44f858589881967884f63a6) ) +ROM_END + ROM_START( nclubv2 ) STV_BIOS ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASEFF ) /* SH2 code */ - // unusual rom mapping compared to other games, the cartridge is a little different too, with a large PALCE16V8H-10 marked 315-6026 ROM_LOAD16_WORD_SWAP( "nclubv2.ic22", 0x0200000, 0x0200000, CRC(7e81676d) SHA1(fc0f0dcdb4aaf71218d7c1dd0e4ddc5381e8b13b) ) // OK ROM_LOAD16_WORD_SWAP( "nclubv2.ic24", 0x0600000, 0x0200000, CRC(1b7637de) SHA1(43c3094f60a6582298a45bad923fef57e98c5b2b) ) // OK ROM_LOAD16_WORD_SWAP( "nclubv2.ic26", 0x0a00000, 0x0200000, CRC(630be99d) SHA1(ac7fbaae98b126fad5228b0ebffa91a0f0a94516) ) // OK ROM_LOAD16_WORD_SWAP( "nclubv2.ic28", 0x0e00000, 0x0200000, CRC(1a3ca5e2) SHA1(4d3aed51d29c54e71175d828f648c9feb813ac04) ) // OK - - // the protection device is checked in the 'each game test' menu as 'RCDD2' might be worth investigating what the game passes to the device for it. - // I think the device is used to decompress the full size image data for the printer. - ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player ROM_LOAD( "nclubv2.nv", 0x0000, 0x0080, CRC(96d55fa9) SHA1(b3c821d6cd4ed52d0e20565e12a06d8f81a08dbc) ) ROM_END @@ -3200,16 +3250,23 @@ GAME( 1997, znpwfv, stvbios, stv, stv, stv_state, znpwfv, ROT /* Unemulated printer / camera devices */ // USA sets GAME( 1997, pclub2, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 (U 970921 V1.000)", MACHINE_NOT_WORKING ) -GAME( 1999, pclub2v3, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 3 (U 990310 V1.000)", MACHINE_NOT_WORKING ) +GAME( 1999, pclub2v3, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 3 (U 990310 V1.000)", MACHINE_NOT_WORKING ) // Hello Kitty themed GAME( 1999, pclubpok, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Pokemon B (U 991126 V1.000)", MACHINE_NOT_WORKING ) // Japan sets GAME( 1999, pclub2fc, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Felix The Cat (Rev. A) (J 970415 V1.100)", MACHINE_NOT_WORKING ) GAME( 1998, pclub2pf, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Puffy (Japan)", MACHINE_NOT_WORKING ) // version info is blank -GAME( 1997, pclb297w, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '97 Winter Ver (J 971017 V1.100)", MACHINE_NOT_WORKING ) -GAME( 1997, pclub298, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Spring Ver (J 971017 V1.100)", MACHINE_NOT_WORKING ) -GAME( 1998, pclb298a, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Autumn Ver (J 980827 V1.000)", MACHINE_NOT_WORKING ) GAME( 1997, pclb2elk, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Earth Limited Kobe (Print Club Custom) (J 970808 V1.000)", MACHINE_NOT_WORKING ) -GAME( 1997, pclub27s, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 7 Spring (J 970313 V1.100)", MACHINE_NOT_WORKING ) // aka Print Club 2 '97 Spring Ver ? +GAME( 1997, pclub2pe, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Pepsiman (J 970618 V1.100)", MACHINE_NOT_WORKING ) + +GAME( 1997, pclub26w, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 6 Winter (J 961210 V1.000)", MACHINE_NOT_WORKING ) // internal string is 'PURIKURA2 97FUYU' (but in reality it seems to be an end of 96 Winter version) +GAME( 1997, pclub27s, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 7 Spring (J 970313 V1.100)", MACHINE_NOT_WORKING ) +// Summer 97? +// Autumn 97? +GAME( 1997, pclb297w, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '97 Winter Ver (J 971017 V1.100)", MACHINE_NOT_WORKING ) // internal string is '97WINTER' (3 roms bad / missing tho, need new dump) +GAME( 1997, pclub298, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Spring Ver (J 971017 V1.100)", MACHINE_NOT_WORKING ) // date is the same as previous version, surely incorrect / not updated when the game was +// Summer 98? +GAME( 1998, pclb298a, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Autumn Ver (J 980827 V1.000)", MACHINE_NOT_WORKING ) + GAME( 1999, pclubor, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Goukakenran (J 991104 V1.000)", MACHINE_NOT_WORKING ) GAME( 1999, pclubol, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Olive (J 980717 V1.000)", MACHINE_NOT_WORKING ) @@ -3218,8 +3275,10 @@ GAME( 1997, pclove, stvbios, stv_5838, stv, stv_state, decathlt, ROT0 GAME( 1997, pclubyo2, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Yoshimoto V2 (J 970422 V1.100)", MACHINE_NOT_WORKING ) GAME( 1998, stress, stvbios, stv, stv, stv_state, stv, ROT0, "Sega", "Stress Busters (J 981020 V1.000)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1996, nclubv2, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Sega", "Name Club Ver.2 (J 960315 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! -GAME( 1997, nclubv3, stvbios, stv, stv, stv_state, nameclv3, ROT0, "Sega", "Name Club Ver.3 (J 970723 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) + +GAME( 1996, nameclub, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Sega", "Name Club (J 960315 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! +GAME( 1996, nclubv2, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Sega", "Name Club Ver.2 (J 960315 V1.000)", MACHINE_NOT_WORKING ) // ^ (has the same datecode as nameclub, probably incorrect unless both were released today) +GAME( 1997, nclubv3, stvbios, stv, stv, stv_state, nameclv3, ROT0, "Sega", "Name Club Ver.3 (J 970723 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // no protection -- cgit v1.2.3-70-g09d2 From c35aa629e35879c9475f05ed5a8f7d203b6f47f9 Mon Sep 17 00:00:00 2001 From: Ville Linde Date: Wed, 3 Feb 2016 02:04:05 +0200 Subject: nwk-tr: fix network ram test (nw) --- src/mame/drivers/nwk-tr.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/nwk-tr.cpp b/src/mame/drivers/nwk-tr.cpp index 9ec6ba6f9c4..a64c10fd96a 100644 --- a/src/mame/drivers/nwk-tr.cpp +++ b/src/mame/drivers/nwk-tr.cpp @@ -304,6 +304,7 @@ public: int m_fpga_uploaded; int m_lanc2_ram_r; int m_lanc2_ram_w; + UINT8 m_lanc2_reg[3]; std::unique_ptr m_lanc2_ram; std::unique_ptr m_sharc_dataram; DECLARE_WRITE32_MEMBER(paletteram32_w); @@ -521,6 +522,7 @@ WRITE32_MEMBER(nwktr_state::lanc2_w) ((value << 7) & 0x80); m_fpga_uploaded = 1; + m_lanc2_reg[0] = (UINT8)(data >> 24); //printf("lanc2_fpga_w: %02X at %08X\n", value, space.device().safe_pc()); } @@ -528,11 +530,16 @@ WRITE32_MEMBER(nwktr_state::lanc2_w) { m_lanc2_ram_r = 0; m_lanc2_ram_w = 0; + m_lanc2_reg[1] = (UINT8)(data >> 8); } else if (ACCESSING_BITS_16_23) { - m_lanc2_ram[2] = (data >> 20) & 0xf; - m_lanc2_ram[3] = 0; + if (m_lanc2_reg[0] != 0) + { + m_lanc2_ram[2] = (data >> 20) & 0xf; + m_lanc2_ram[3] = 0; + } + m_lanc2_reg[2] = (UINT8)(data >> 16); } else if (ACCESSING_BITS_0_7) { -- cgit v1.2.3-70-g09d2 From ed2377a0ef6cdc436776c9e82e427bf22befd9c3 Mon Sep 17 00:00:00 2001 From: hap Date: Wed, 3 Feb 2016 01:53:57 +0100 Subject: Clones promoted to WORKING -------------------------- Speak & Math (1980 version) [Sean Riddle, plgDavid] La Dictee Magique (French Speak & Spell) [Sean Riddle, plgDavid] Grillo Parlante (Italian Speak & Spell) [Sean Riddle, plgDavid] --- src/mame/drivers/tispeak.cpp | 71 +++++++++++++++++++++++++++----------------- src/mame/mess.lst | 1 + 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index 124edffd379..94d62dd1350 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -80,7 +80,7 @@ above expectations. TI continued to manufacture many products for this line. - notes: this one has a dedicated voice actor Speak & Spell (France) "La Dictee Magique", 1980 - - MCU: CD2702* + - MCU: CD2702, labeled CD2702AN2L (die labeled TMC0270F 2702A) - TMS51xx: CD2801 - VSM: 16KB CD2352 @@ -143,7 +143,7 @@ Note that they are interchangeable, eg. you can use a French module on a US Spea Speak & Math: Speak & Math (US), 1980 (renamed to "Speak & Maths" in UK, but is the same product) - - MCU: CD2704* + - MCU: CD2704, labeled CD2704B-N2L (die labeled TMC0270F 2704B) - 2nd revision?(mid-1982) - TMS51xx: CD2801 - VSM(1/2): 16KB CD2392 - VSM(2/2): 16KB CD2393 @@ -170,7 +170,7 @@ Speak & Math: Speak & Read: Speak & Read (US), 1980 - - MCU: CD2705, labeled CD2705B-N2L (die labeled TMC0270E 2705B) - 2nd revision? + - MCU: CD2705, labeled CD2705B-N2L (die labeled TMC0270E 2705B) - 2nd revision?(late-1981) - TMS51xx: CD2801 - VSM(1/2): 16KB CD2394(rev.A) - VSM(2/2): 16KB CD2395(rev.A) @@ -1242,10 +1242,10 @@ ROM_START( snspellp ) ROM_REGION( 2127, "maincpu:mpla", 0 ) ROM_LOAD( "tms0270_common2_micro.pla", 0, 2127, CRC(86737ac1) SHA1(4aa0444f3ddf88738ea74aec404c684bf54eddba) ) ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) // using the one from 1978 version + ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) // using the one from 1st version ROM_REGION( 0x10000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge - ROM_LOAD( "tmc0351nl.vsm", 0x0000, 0x4000, CRC(beea3373) SHA1(8b0f7586d2f12c3d4a885fdb528cf23feffa1a3b) ) // using the one from 1978 version + ROM_LOAD( "tmc0351nl.vsm", 0x0000, 0x4000, CRC(beea3373) SHA1(8b0f7586d2f12c3d4a885fdb528cf23feffa1a3b) ) // using the one from 1st version ROM_LOAD( "tmc0352nl.vsm", 0x4000, 0x4000, CRC(d51f0587) SHA1(ddaa484be1bba5fef46b481cafae517e4acaa8ed) ) // " ROM_END @@ -1256,7 +1256,7 @@ ROM_START( snspellua ) ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common2_micro.pla", 0, 2127, BAD_DUMP CRC(86737ac1) SHA1(4aa0444f3ddf88738ea74aec404c684bf54eddba) ) // not verified + ROM_LOAD( "tms0270_common2_micro.pla", 0, 2127, CRC(86737ac1) SHA1(4aa0444f3ddf88738ea74aec404c684bf54eddba) ) ROM_REGION( 1246, "maincpu:opla", 0 ) ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) @@ -1287,7 +1287,7 @@ ROM_START( snspelluk ) ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common2_micro.pla", 0, 2127, BAD_DUMP CRC(86737ac1) SHA1(4aa0444f3ddf88738ea74aec404c684bf54eddba) ) // not verified + ROM_LOAD( "tms0270_common2_micro.pla", 0, 2127, CRC(86737ac1) SHA1(4aa0444f3ddf88738ea74aec404c684bf54eddba) ) ROM_REGION( 1246, "maincpu:opla", 0 ) ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) @@ -1329,14 +1329,14 @@ ROM_END ROM_START( snspellfr ) ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "tmc0271h-n2l", 0x0000, 0x1000, BAD_DUMP CRC(f83b5d2d) SHA1(10155b0b7f7f1583c7def8a693553cd35944ea6f) ) // placeholder, use the one we have + ROM_LOAD( "cd2702an2l", 0x0000, 0x1000, CRC(895d6a4e) SHA1(a8bc118c83a84260033734191dcaa71a93dfa52b) ) ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common2_micro.pla", 0, 2127, BAD_DUMP CRC(86737ac1) SHA1(4aa0444f3ddf88738ea74aec404c684bf54eddba) ) // not verified + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271h_output.pla", 0, 1246, BAD_DUMP CRC(2478c595) SHA1(9a8ac690902731e1e01533279a1c9223011e1537) ) // placeholder, use the one we have + ROM_LOAD( "tms0270_cd2702_output.pla", 0, 1246, CRC(2478c595) SHA1(9a8ac690902731e1e01533279a1c9223011e1537) ) ROM_REGION( 0x10000, "tms6100", ROMREGION_ERASEFF ) // uses only 1 rom, 8000-bfff = space reserved for cartridge ROM_LOAD( "cd2352.vsm", 0x0000, 0x4000, CRC(181a239e) SHA1(e16043766c385e152b7005c1c010be4c5fccdd9b) ) @@ -1344,14 +1344,14 @@ ROM_END ROM_START( snspellit ) ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "tmc0271h-n2l", 0x0000, 0x1000, BAD_DUMP CRC(f83b5d2d) SHA1(10155b0b7f7f1583c7def8a693553cd35944ea6f) ) // placeholder, use the one we have + ROM_LOAD( "cd2702an2l", 0x0000, 0x1000, CRC(895d6a4e) SHA1(a8bc118c83a84260033734191dcaa71a93dfa52b) ) ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common2_micro.pla", 0, 2127, BAD_DUMP CRC(86737ac1) SHA1(4aa0444f3ddf88738ea74aec404c684bf54eddba) ) // not verified + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271h_output.pla", 0, 1246, BAD_DUMP CRC(2478c595) SHA1(9a8ac690902731e1e01533279a1c9223011e1537) ) // placeholder, use the one we have + ROM_LOAD( "tms0270_cd2702_output.pla", 0, 1246, CRC(2478c595) SHA1(9a8ac690902731e1e01533279a1c9223011e1537) ) ROM_REGION( 0x10000, "tms6100", ROMREGION_ERASEFF ) // uses only 1 rom, 8000-bfff = space reserved for cartridge ROM_LOAD( "cd62190.vsm", 0x0000, 0x4000, CRC(63832002) SHA1(ea8124b2bf0f5908c5f1a56d60063f2468a10143) ) @@ -1400,7 +1400,23 @@ ROM_END ROM_START( snmath ) ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "cd2708n2l", 0x0000, 0x1000, CRC(35937360) SHA1(69c362c75bb459056c09c7fab37c91040485474b) ) + ROM_LOAD( "cd2704b-n2l", 0x0000, 0x1000, CRC(7e06c7c5) SHA1(d60a35a8163ab593c31afc840a0d8a9b3a762f29) ) + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_cd2704_output.pla", 0, 1246, CRC(5a2eb949) SHA1(8bb161d4884f229af65f8d155e59b9d8966fe3d1) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) + ROM_LOAD( "cd2392.vsm", 0x0000, 0x4000, CRC(4ed2e920) SHA1(8896f29e25126c1e4d9a47c9a325b35dddecc61f) ) + ROM_LOAD( "cd2393.vsm", 0x4000, 0x4000, CRC(571d5b5a) SHA1(83284755d9b77267d320b5b87fdc39f352433715) ) +ROM_END + +ROM_START( snmatha ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "cd2708-n2l", 0x0000, 0x1000, CRC(35937360) SHA1(69c362c75bb459056c09c7fab37c91040485474b) ) ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) @@ -1426,13 +1442,13 @@ ROM_START( snmathp ) ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_cd2708_output.pla", 0, 1246, BAD_DUMP CRC(1abad753) SHA1(53d20b519ed73ce248368047a056836afbe3cd46) ) // taken from cd2708, need to verify if it's same as cd2704 + ROM_LOAD( "tms0270_cd2704_output.pla", 0, 1246, CRC(5a2eb949) SHA1(8bb161d4884f229af65f8d155e59b9d8966fe3d1) ) // using the one from 1st version ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) - ROM_LOAD( "cd2392.vsm", 0x0000, 0x4000, CRC(4ed2e920) SHA1(8896f29e25126c1e4d9a47c9a325b35dddecc61f) ) - ROM_LOAD( "cd2393.vsm", 0x4000, 0x4000, CRC(571d5b5a) SHA1(83284755d9b77267d320b5b87fdc39f352433715) ) + ROM_LOAD( "cd2392.vsm", 0x0000, 0x4000, CRC(4ed2e920) SHA1(8896f29e25126c1e4d9a47c9a325b35dddecc61f) ) // using the one from 1st version + ROM_LOAD( "cd2393.vsm", 0x4000, 0x4000, CRC(571d5b5a) SHA1(83284755d9b77267d320b5b87fdc39f352433715) ) // " ROM_END @@ -1537,29 +1553,30 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1978, snspell, 0, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1979 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +COMP( 1979, snspell, 0, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1979 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) COMP( 1978, snspellp, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) COMP( 1980, snspellub, snspell, 0, sns_tmc0281d, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1980 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -COMP( 1979, snspellua, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // incomplete dump, using 1979 MCU ROM instead -COMP( 1978, snspelluk, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " +COMP( 1978, snspellua, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) // incomplete dump, using 1979 MCU ROM instead +COMP( 1978, snspelluk, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) // " COMP( 1981, snspelluka, snspell, 0, sns_cd2801, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) COMP( 1979, snspelljp, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -COMP( 1980, snspellfr, snspell, 0, sns_cd2801, snspellfr, tispeak_state, snspell, "Texas Instruments", "La Dictee Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // doesn't work due to missing CD2702 MCU dump, German/Italian version has CD2702 too -COMP( 1982, snspellit, snspell, 0, sns_cd2801_m, snspellit, tispeak_state, snspell, "Texas Instruments", "Grillo Parlante (Italy)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " +COMP( 1980, snspellfr, snspell, 0, sns_cd2801, snspellfr, tispeak_state, snspell, "Texas Instruments", "La Dictee Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +COMP( 1982, snspellit, snspell, 0, sns_cd2801_m, snspellit, tispeak_state, snspell, "Texas Instruments", "Grillo Parlante (Italy)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) COMP( 1981, snspellc, 0, 0, snspellc, snspellc, tispeak_state, snspell, "Texas Instruments", "Speak & Spell Compact (US, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) COMP( 1982, snspellca, snspellc, 0, snspellc, snspellc, tispeak_state, snspell, "Texas Instruments", "Speak & Spell Compact (US, 1982 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) COMP( 1982, snspellcuk, snspellc, 0, snspellcuk, snspellcuk, tispeak_state, snspell, "Texas Instruments", "Speak & Write (UK)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -COMP( 1986, snmath, 0, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1986 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -COMP( 1980, snmathp, snmath, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1980 version/patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) +COMP( 1980, snmath, 0, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1980 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +COMP( 1986, snmatha, snmath, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1986 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +COMP( 1980, snmathp, snmath, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_IS_INCOMPLETE ) COMP( 1980, snread, 0, 0, snread, snread, tispeak_state, snspell, "Texas Instruments", "Speak & Read (US)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) COMP( 1979, lantutor, 0, 0, lantutor, lantutor, tispeak_state, lantutor, "Texas Instruments", "Language Tutor (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) -COMP( 1981, tntell, 0, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (US, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK | MACHINE_REQUIRES_ARTWORK ) // assume there is an older version too, with CD8010 MCU -COMP( 1980, tntellp, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) +COMP( 1981, tntell, 0, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (US)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK | MACHINE_REQUIRES_ARTWORK ) +COMP( 1980, tntellp, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (US, patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) COMP( 1981, tntelluk, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (UK)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK | MACHINE_REQUIRES_ARTWORK ) COMP( 1981, tntellfr, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Le Livre Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 608b88c02f6..910bcd668c7 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2344,6 +2344,7 @@ snspellc snspellca snspellcuk snmath +snmatha snmathp snread lantutor -- cgit v1.2.3-70-g09d2 From f2a01abaf913a928592d8004346630b0e0ff69e9 Mon Sep 17 00:00:00 2001 From: hap Date: Wed, 3 Feb 2016 03:06:44 +0100 Subject: fidelz80: added cc7 (skeleton for now, nw) --- src/mame/drivers/fidelz80.cpp | 24 +++++++++++++++++++++++- src/mame/mess.lst | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 2269f3eead8..714221c0e0a 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -1537,6 +1537,22 @@ INPUT_PORTS_END Machine Drivers ******************************************************************************/ +static MACHINE_CONFIG_START( cc7, fidelz80_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz) + MCFG_CPU_PROGRAM_MAP(cc10_map) + //MCFG_CPU_IO_MAP(vcc_io) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_fidel_cc) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + static MACHINE_CONFIG_START( cc10, fidelz80_state ) /* basic machine hardware */ @@ -1641,6 +1657,11 @@ MACHINE_CONFIG_END ROM Definitions ******************************************************************************/ +ROM_START( cc7 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "cn19103n_bcc-revb", 0x0000, 0x1000, CRC(a397d471) SHA1(9b12bc442fccee40f4d8500c792bc9d886c5e1a5) ) // 2332 +ROM_END + ROM_START( cc10 ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "cc10b", 0x0000, 0x1000, CRC(afd3ca99) SHA1(870d09b2b52ccb8572d69642c59b5215d5fb26ab) ) // 2332 @@ -1804,7 +1825,8 @@ ROM_END ******************************************************************************/ /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1978, cc10, 0, 0, cc10, cc10, driver_device, 0, "Fidelity Electronics", "Chess Challenger 10 (version B)", MACHINE_SUPPORTS_SAVE ) +COMP( 1978, cc10, 0, 0, cc10, cc10, driver_device, 0, "Fidelity Electronics", "Chess Challenger 10 (rev. B)", MACHINE_SUPPORTS_SAVE ) +COMP( 1979, cc7, 0, 0, cc7, cc10, driver_device, 0, "Fidelity Electronics", "Chess Challenger 7 (rev. B)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) COMP( 1979, vcc, 0, 0, vcc, vcc, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (English)", MACHINE_SUPPORTS_SAVE ) COMP( 1979, vccsp, vcc, 0, vcc, vccsp, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 910bcd668c7..afd520e0563 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2142,6 +2142,7 @@ diablo68 // 1991 Novag Diablo 68000 Chess Computer // Fidelity cc10 +cc7 vcc // VCC: Voice Chess Challenger (English) vccg // * Spanish vccfr // * German -- cgit v1.2.3-70-g09d2 From 7f6b42536e6fbcd6b0f18414a6584116fd75e83b Mon Sep 17 00:00:00 2001 From: Brandon Munger Date: Tue, 2 Feb 2016 23:08:33 -0500 Subject: r9751: Fix offset switching and enable write mask logging --- src/mame/drivers/r9751.cpp | 132 +++++++++++++++++++++++---------------------- 1 file changed, 68 insertions(+), 64 deletions(-) diff --git a/src/mame/drivers/r9751.cpp b/src/mame/drivers/r9751.cpp index 3503b5dde4f..fd93f310e2e 100644 --- a/src/mame/drivers/r9751.cpp +++ b/src/mame/drivers/r9751.cpp @@ -156,32 +156,31 @@ void r9751_state::machine_reset() READ32_MEMBER( r9751_state::r9751_mmio_5ff_r ) { UINT32 data; - UINT32 address = offset * 4 + 0x5FF00000; - switch(address) + switch(offset << 2) { /* PDC HDD region (0x24, device 9) */ - case 0x5FF00824: /* HDD Command result code */ + case 0x0824: /* HDD Command result code */ return 0x10; - case 0x5FF03024: /* HDD SCSI command completed successfully */ + case 0x3024: /* HDD SCSI command completed successfully */ data = 0x1; - if(TRACE_HDC) logerror("SCSI HDD command completion status - Read: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); + if(TRACE_HDC) logerror("SCSI HDD command completion status - Read: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000); return data; /* SMIOC region (0x98, device 26) */ - case 0x5FF00898: /* Serial status or DMA status */ + case 0x0898: /* Serial status or DMA status */ return 0x40; /* PDC FDD region (0xB0, device 44 */ - case 0x5FF008B0: /* FDD Command result code */ + case 0x08B0: /* FDD Command result code */ return 0x10; - case 0x5FF010B0: /* Clear 5FF030B0 ?? */ + case 0x10B0: /* Clear 5FF030B0 ?? */ if(TRACE_FDC) logerror("--- FDD 0x5FF010B0 READ (0)\n"); return 0; - case 0x5FF030B0: /* FDD command completion status */ + case 0x30B0: /* FDD command completion status */ data = (m_pdc->reg_p5 << 8) + m_pdc->reg_p4; - if(TRACE_FDC) logerror("--- SCSI FDD command completion status - Read: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); + if(TRACE_FDC) logerror("--- SCSI FDD command completion status - Read: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000); return data; default: - if(TRACE_FDC || TRACE_HDC || TRACE_SMIOC) logerror("Instruction: %08x READ MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), address, 0, mem_mask); + if(TRACE_FDC || TRACE_HDC || TRACE_SMIOC) logerror("Instruction: %08x READ MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000, 0, mem_mask); return 0; } } @@ -189,22 +188,24 @@ READ32_MEMBER( r9751_state::r9751_mmio_5ff_r ) WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w ) { UINT8 data_b0, data_b1; - UINT32 address = offset * 4 + 0x5FF00000; + /* Unknown mask */ + if (mem_mask != 0xFFFFFFFF) + logerror("Mask found: %08X Register: %08X PC: %08X\n", mem_mask, offset << 2 | 0x5FF00000, space.machine().firstcpu->pc()); - switch(address) + switch(offset << 2) { /* PDC HDD region (0x24, device 9 */ - case 0x5FF00224: /* HDD SCSI read command */ - if(TRACE_HDC) logerror("@@@ HDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); + case 0x0224: /* HDD SCSI read command */ + if(TRACE_HDC) logerror("@@@ HDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000); break; - case 0x5FF08024: /* HDD SCSI read command */ - if(TRACE_HDC) logerror("@@@ HDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); + case 0x8024: /* HDD SCSI read command */ + if(TRACE_HDC) logerror("@@@ HDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000); break; - case 0x5FF0C024: /* HDD SCSI read command */ - if(TRACE_HDC) logerror("@@@ HDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); + case 0xC024: /* HDD SCSI read command */ + if(TRACE_HDC) logerror("@@@ HDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000); break; /* SMIOC region (0x98, device 26) */ - case 0x5FF04098: /* Serial DMA Command */ + case 0x4098: /* Serial DMA Command */ switch(data) { case 0x4100: /* Send byte to serial */ @@ -215,27 +216,27 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w ) if(TRACE_SMIOC) logerror("Uknown serial DMA command: %X\n", data); } break; - case 0x5FF0C098: /* Serial DMA output address */ + case 0xC098: /* Serial DMA output address */ //smioc_out_addr = data * 2; smioc_out_addr = (smioc_dma_bank & 0x7FFFF800) | ((data&0x3FF)<<1); if(TRACE_SMIOC) logerror("Serial output address: %08X PC: %08X\n", smioc_out_addr, space.machine().firstcpu->pc()); break; /* PDC FDD region (0xB0, device 44 */ - case 0x5FF001B0: /* FDD SCSI read command */ - if(TRACE_FDC) logerror("--- FDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); + case 0x01B0: /* FDD SCSI read command */ + if(TRACE_FDC) logerror("--- FDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000); break; - case 0x5FF002B0: /* FDD SCSI read command */ - if(TRACE_FDC) logerror("--- FDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); + case 0x02B0: /* FDD SCSI read command */ + if(TRACE_FDC) logerror("--- FDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000); break; - case 0x5FF004B0: /* FDD RESET PDC */ + case 0x04B0: /* FDD RESET PDC */ if(TRACE_FDC) logerror("PDC RESET, PC: %08X\n", space.machine().firstcpu->pc()); m_pdc->reset(); break; - case 0x5FF008B0: /* FDD SCSI read command */ - if(TRACE_FDC) logerror("--- FDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); + case 0x08B0: /* FDD SCSI read command */ + if(TRACE_FDC) logerror("--- FDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000); break; - case 0x5FF041B0: /* Unknown - Probably old style commands */ - if(TRACE_FDC) logerror("--- FDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), address); + case 0x41B0: /* Unknown - Probably old style commands */ + if(TRACE_FDC) logerror("--- FDD Command: %08X, From: %08X, Register: %08X\n", data, space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000); /* Clear FDD Command completion status 0x5FF030B0 (PDC 0x4, 0x5) */ m_pdc->reg_p4 = 0; @@ -248,7 +249,7 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w ) m_pdc->reg_p38 |= 0x2; /* Set bit 1 on port 38 register, PDC polls this port looking for a command */ if(TRACE_FDC) logerror("--- FDD Old Command: %02X and %02X\n", data_b0, data_b1); break; - case 0x5FF080B0: /* fdd_dest_address register */ + case 0x80B0: /* fdd_dest_address register */ fdd_dest_address = data << 1; if(TRACE_FDC) logerror("--- FDD destination address: %08X\n", fdd_dest_address); data_b0 = data & 0xFF; @@ -256,8 +257,8 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w ) m_pdc->reg_p6 = data_b0; m_pdc->reg_p7 = data_b1; break; - case 0x5FF0C0B0: - case 0x5FF0C1B0: /* FDD command address register */ + case 0xC0B0: + case 0xC1B0: /* FDD command address register */ UINT32 fdd_scsi_command; UINT32 fdd_scsi_command2; unsigned char c_fdd_scsi_command[8]; // Array for SCSI command @@ -296,7 +297,7 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w ) break; default: - if(TRACE_FDC || TRACE_HDC || TRACE_SMIOC) logerror("Instruction: %08x WRITE MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), address, data, mem_mask); + if(TRACE_FDC || TRACE_HDC || TRACE_SMIOC) logerror("Instruction: %08x WRITE MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), offset << 2 | 0x5FF00000, data, mem_mask); } } @@ -306,9 +307,8 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_5ff_w ) READ32_MEMBER( r9751_state::r9751_mmio_ff01_r ) { //UINT32 data; - UINT32 address = offset * 4 + 0xFF010000; - switch(address) + switch(offset << 2) { default: //return data; @@ -318,14 +318,16 @@ READ32_MEMBER( r9751_state::r9751_mmio_ff01_r ) WRITE32_MEMBER( r9751_state::r9751_mmio_ff01_w ) { - UINT32 address = offset * 4 + 0xFF010000; + /* Unknown mask */ + if (mem_mask != 0xFFFFFFFF) + logerror("Mask found: %08X Register: %08X PC: %08X\n", mem_mask, offset << 2 | 0xFF010000, space.machine().firstcpu->pc()); - switch(address) + switch(offset << 2) { - case 0xFF01000C: /* FDD DMA Offset */ + case 0x000C: /* FDD DMA Offset */ fdd_dma_bank = data; return; - case 0xFF010010: /* SMIOC DMA Offset */ + case 0x0010: /* SMIOC DMA Offset */ smioc_dma_bank = data; return; default: @@ -336,76 +338,78 @@ WRITE32_MEMBER( r9751_state::r9751_mmio_ff01_w ) READ32_MEMBER( r9751_state::r9751_mmio_ff05_r ) { UINT32 data; - UINT32 address = offset * 4 + 0xFF050000; - switch(address) + switch(offset << 2) { - case 0xFF050004: + case 0x0004: return reg_ff050004; - case 0xFF050300: + case 0x0300: return 0x1B | (1<<0x14); - case 0xFF050320: /* Some type of counter */ + case 0x0320: /* Some type of counter */ return (machine().time() - timer_32khz_last).as_ticks(32768) & 0xFFFF; - case 0xFF050584: + case 0x0584: return 0; - case 0xFF050610: + case 0x0610: return 0xabacabac; - case 0xFF060014: + case 0x0014: return 0x80; default: data = 0; - if(TRACE_CPU_REG) logerror("Instruction: %08x READ MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), address, data, mem_mask); + if(TRACE_CPU_REG) logerror("Instruction: %08x READ MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), offset << 2 | 0xFF050000, data, mem_mask); return data; } } WRITE32_MEMBER( r9751_state::r9751_mmio_ff05_w ) { - UINT32 address = offset * 4 + 0xFF050000; + /* Unknown mask */ + if (mem_mask != 0xFFFFFFFF) + logerror("Mask found: %08X Register: %08X PC: %08X\n", mem_mask, offset << 2 | 0xFF050000, space.machine().firstcpu->pc()); - switch(address) + switch(offset << 2) { - case 0xFF050004: + case 0x0004: reg_ff050004 = data; return; - case 0xFF05000C: /* CPU LED hex display indicator */ + case 0x000C: /* CPU LED hex display indicator */ if(TRACE_LED) logerror("\n*** LED: %02x, Instruction: %08x ***\n\n", data, space.machine().firstcpu->pc()); return; - case 0xFF050320: + case 0x0320: timer_32khz_last = machine().time(); default: - if(TRACE_CPU_REG) logerror("Instruction: %08x WRITE MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), address, data, mem_mask); + if(TRACE_CPU_REG) logerror("Instruction: %08x WRITE MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), offset << 2 | 0xFF050000, data, mem_mask); return; } } READ32_MEMBER( r9751_state::r9751_mmio_fff8_r ) { - UINT32 data; - UINT32 address = offset * 4 + 0xFFF80000; + UINT32 data; - switch(address) + switch(offset << 2) { - case 0xFFF80040: + case 0x0040: return reg_fff80040; default: data = 0; - if(TRACE_CPU_REG) logerror("Instruction: %08x READ MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), address, data, mem_mask); + if(TRACE_CPU_REG) logerror("Instruction: %08x READ MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), offset << 2 | 0xFFF80000, data, mem_mask); return data; } } WRITE32_MEMBER( r9751_state::r9751_mmio_fff8_w ) { - UINT32 address = offset * 4 + 0xFFF80000; + /* Unknown mask */ + if (mem_mask != 0xFFFFFFFF) + logerror("Mask found: %08X Register: %08X PC: %08X\n", mem_mask, offset << 2 | 0xFFF80000, space.machine().firstcpu->pc()); - switch(address) + switch(offset << 2) { - case 0xFFF80040: + case 0x0040: reg_fff80040 = data; return; default: - if(TRACE_CPU_REG) logerror("Instruction: %08x WRITE MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), address, data, mem_mask); + if(TRACE_CPU_REG) logerror("Instruction: %08x WRITE MMIO(%08x): %08x & %08x\n", space.machine().firstcpu->pc(), offset << 2 | 0xFFF80000, data, mem_mask); } } -- cgit v1.2.3-70-g09d2 From ccee9f7825acd7b32dd50092acc1d9f874d75940 Mon Sep 17 00:00:00 2001 From: Victor Vasiliev Date: Wed, 3 Feb 2016 02:36:17 -0500 Subject: Initialize m_load_save_hold --- src/emu/ui/ui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index f32f35ca71a..d0e432c2a21 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -244,6 +244,7 @@ ui_manager::ui_manager(running_machine &machine) m_popup_text_end = 0; m_use_natural_keyboard = false; m_mouse_arrow_texture = nullptr; + m_load_save_hold = false; // more initialization set_handler(handler_messagebox, 0); -- cgit v1.2.3-70-g09d2 From 989afd64e23a15a11f147621424166d4fa65a5d9 Mon Sep 17 00:00:00 2001 From: MetalliC <0vetal0@gmail.com> Date: Wed, 3 Feb 2016 18:28:38 +0200 Subject: New NOT WORKING Dragon Treasure 2 (Rev A) (GDS-0037A) [Jorge Valero, rtw, The Dumping Union] (security PIC is missing) add notes about Dragon Treasure sets --- src/mame/arcade.lst | 2 +- src/mame/drivers/naomi.cpp | 30 ++++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 589a0228436..be8b3ef62ce 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -5670,7 +5670,7 @@ shootpl // 2003.?? Shootout Pool The Medal / Shootout Pool Prize (Rev A) cfield // 2004.06 Chaos Field tetkiwam // 2004.06 Tetris Kiwamemichi (Arcade TV Game List - P.88, Right, 11 from bottom) trizeal // 2004.09 Trizeal - // 2004.?? Dragon Treasure 2 +dragntr2 // 2004.?? Dragon Treasure 2 (Rev A) kick4csh // 2004.?? Kick '4' Cash shootplm // 2004.?? Shootout Pool The Medal Ver. B / Shootout Pool Prize Ver. B // 2004.?? The Quiz Show diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp index de906fba250..7910db2096d 100644 --- a/src/mame/drivers/naomi.cpp +++ b/src/mame/drivers/naomi.cpp @@ -1862,7 +1862,9 @@ READ64_MEMBER(naomi_state::aw_modem_r ) { /* 0x00600280 r 0000dcba - a/b/c/d - coin inputs 1-4, active low + a/b - 1P/2P coin inputs (JAMMA), active low + c/d - 3P/4P coin inputs (EX. IO board), active low + (ab == 0) -> BIOS skip RAM test */ return U64(0xffffffff00000000) | (ioport("COINS")->read() & 0x0F); @@ -1896,8 +1898,8 @@ WRITE64_MEMBER(naomi_state::aw_modem_w ) TODO: hook this then MAME have such devices emulated 0x00600288 rw 0000dcba - a - 1P coin couner - b - 2P coin couner + a - 1P coin counter + b - 2P coin counter c - 1P coin lockout d - 2P coin lockout @@ -7963,6 +7965,26 @@ ROM_START( puyofev ) ROM_LOAD("317-0375-com.pic", 0x00, 0x4000, CRC(52b56b52) SHA1(221590efbb09824621714cb163bda51a921d7d54) ) ROM_END +/* + note: + both Dragon Treasure game binaries have only first 16MB encrypted using DES key from security PIC provided with GD-ROMs. + the rest of data encrypted using some other key, same in both game versions. + presumably this data uploaded via network to satellite units and decrypted using DES key from their own security PICs. +*/ + +// requires 837-14381 "G2 EXPANSION BD" I/O board +ROM_START( dragntr2 ) + NAOMIGD_BIOS + NAOMI_DEFAULT_EEPROM + + DISK_REGION( "gdrom" ) + DISK_IMAGE_READONLY( "gds-0037a", 0, SHA1(ce65fe84cabaa1ac3f40bff9535a42c2055b5f1c) ) + + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + //PIC is missing + ROM_LOAD("317-xxxx-xxx.pic", 0x00, 0x4000, NO_DUMP ) +ROM_END + // requires 837-14381 "G2 EXPANSION BD" I/O board ROM_START( dragntr3 ) NAOMIGD_BIOS @@ -9566,7 +9588,7 @@ GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", " // 0036E Virtua Fighter 4 Final Tuned (GDS-0036E) /* 0036F */ GAME( 2004, vf4tuned, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Final Tuned (Rev F) (GDS-0036F)", GAME_FLAGS ) // 0037 Dragon Treasure 2 (GDS-0037) -// 0037A Dragon Treasure 2 (Rev A) (GDS-0037A) +/* 0037A */ GAME( 2004, dragntr2, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Dragon Treasure 2 (Rev A) (GDS-0037A)", GAME_FLAGS ) // 0038 // 0039 Initial D Arcade Stage Ver. 3 Cycraft Edition (GDS-0039) /* 0039A */ GAME( 2006, inidv3ca, inidv3cy,naomigd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 Cycraft Edition (Rev A) (GDS-0039A)", GAME_FLAGS ) -- cgit v1.2.3-70-g09d2 From fcf4f4729cbfc54f244d0c93e35fbcfec779440b Mon Sep 17 00:00:00 2001 From: MetalliC <0vetal0@gmail.com> Date: Wed, 3 Feb 2016 18:42:27 +0200 Subject: dumped "Dead or Alive 2 (Rev A)", match existent set, fix game and EPR ROM names [Smitdogg, The Dumping Union] dumped "King of Fighters XI" EN, match JP one, add notes [Brizzo] --- src/mame/drivers/naomi.cpp | 9 +++++---- src/mame/machine/awboard.cpp | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp index 7910db2096d..e17a52f7b52 100644 --- a/src/mame/drivers/naomi.cpp +++ b/src/mame/drivers/naomi.cpp @@ -377,7 +377,7 @@ Airline Pilots (Rev A) 840-0005C 21739A 11 (64Mb) Cosmic Smash 840-0044C 23428 8 (64Mb) ? 315-6213 317-0289-COM joystick + 2 buttons Cosmic Smash (Rev A) 840-0044C 23428A 8 (64Mb) ? 315-6213 317-0289-COM joystick + 2 buttons Crazy Taxi 840-0002C 21684 13 (64Mb)* present 315-6213 317-0248-COM * ic8 and ic9 are not present -Dead Or Alive 2 841-0003C 22121 21 (64Mb) present 315-6213 317-5048-COM joystick + 3 buttons +Dead Or Alive 2 (Rev A) 841-0003C 22121a 21 (64Mb) present 315-6213 317-5048-COM joystick + 3 buttons Dead Or Alive 2 Millennium 841-0003C DOA2 M 21 (64Mb) present 315-6213 317-5048-COM joystick + 3 buttons Death Crimson OX 841-0016C 23524 10 (64Mb) present 315-6213 317-5066-COM Dengen Tenshi Taisen Janshi Shangri-La 841-0004C 22060 12 (64Mb) ? 315-6213 317-5050-JPN @@ -3413,7 +3413,7 @@ ROM_START( doa2 ) NAOMI_DEFAULT_EEPROM_NO_BD ROM_REGION( 0xb000000, "rom_board", ROMREGION_ERASEFF) - ROM_LOAD("epr-22121.ic22", 0x0000000, 0x0400000, CRC(30f93b5e) SHA1(0e33383e7ab9a721dab4708b063598f2e9c9f2e7) ) // partially encrypted + ROM_LOAD("epr-22121a.ic22", 0x0000000, 0x0400000, CRC(30f93b5e) SHA1(0e33383e7ab9a721dab4708b063598f2e9c9f2e7) ) // partially encrypted ROM_LOAD("mpr-22100.ic1", 0x0800000, 0x0800000, CRC(92a53e5e) SHA1(87fcdeee9c4e65a3eb6eb345eed85d4f2df26c3c) ) ROM_LOAD("mpr-22101.ic2", 0x1000000, 0x0800000, CRC(14cd7dce) SHA1(5df14a5dad14bc922b4f88881dc2e9c8e74d6170) ) @@ -9164,6 +9164,7 @@ ROM_START( ftspeed ) ROM_LOAD( "ax1701f01.bin", 0, 4, CRC(f3f03c35) SHA1(2a8329a29cdcc0219e9360cc573c0f3ad44d0175) ) ROM_END +// contents of cartridges labeled as JP and EN is the same ROM_START( kofxi ) AW_BIOS @@ -9478,8 +9479,8 @@ GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", " /* 841-xxxxx ("Licensed by Sega" Naomi cart games)*/ /* 0001 */ GAME( 1999, pstone, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom", "Power Stone (JPN, USA, EUR, ASI, AUS)", GAME_FLAGS ) /* 0002 */ GAME( 1999, suchie3, naomi, naomim2, suchie3, naomi_state,naomi_mp,ROT0, "Jaleco", "Idol Janshi Suchie-Pai 3 (JPN)", GAME_FLAGS ) -/* 0003 */ GAME( 1999, doa2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2 (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) -/* 0003 */ GAME( 2000, doa2m, doa2, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2 Millennium (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) +/* 0003 */ GAME( 1999, doa2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2 (Rev A)", GAME_FLAGS ) +/* 0003 */ GAME( 2000, doa2m, doa2, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2 Millennium", GAME_FLAGS ) /* 0004 */ GAME( 1999, shangril, naomi, naomim2, naomi_mp,naomi_state,naomi_mp,ROT0, "Marvelous Ent.", "Dengen Tenshi Taisen Janshi Shangri-la (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) /* 0005 */ GAME( 1999, spawn, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Todd Mc Farlane / Capcom","Spawn In the Demon's Hand (JPN, USA, EUR, ASI, AUS) (Rev B)", GAME_FLAGS ) /* 0006 */ GAME( 1999, puyoda, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Compile", "Puyo Puyo Da!", GAME_FLAGS ) diff --git a/src/mame/machine/awboard.cpp b/src/mame/machine/awboard.cpp index e931fa221eb..7ec0c5b6c3a 100644 --- a/src/mame/machine/awboard.cpp +++ b/src/mame/machine/awboard.cpp @@ -97,8 +97,9 @@ ROM board internal layouts: Type 2: 00000000 - 00800000 FMEM1 flash ROM - 00800000 - 01000000 FMEM2 flash ROM - 01000000 - 02000000 unk, probably mirror of above + 00800000 - 01000000 mirror of above + 01000000 - 01800000 FMEM2 flash ROM + 01800000 - 02000000 mirror of above 02000000 - 04000000 MROM1 MROM4 MROM7 MROM10 \ 04000000 - 06000000 MROM2 MROM5 MROM8 MROM11 banked mask ROMs 06000000 - 08000000 MROM3 MROM6 MROM9 MROM12 / -- cgit v1.2.3-70-g09d2 From 082d8293b01bcd4edf998fbf46236fd71c548fff Mon Sep 17 00:00:00 2001 From: MetalliC <0vetal0@gmail.com> Date: Wed, 3 Feb 2016 18:43:25 +0200 Subject: BetaDisk floppy sound (nw) --- src/mame/machine/beta.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mame/machine/beta.cpp b/src/mame/machine/beta.cpp index ef9ec771805..4c1afc59f64 100644 --- a/src/mame/machine/beta.cpp +++ b/src/mame/machine/beta.cpp @@ -184,9 +184,13 @@ SLOT_INTERFACE_END static MACHINE_CONFIG_FRAGMENT( beta_disk ) MCFG_KR1818VG93_ADD("wd179x", XTAL_8MHz / 8) MCFG_FLOPPY_DRIVE_ADD("wd179x:0", beta_disk_floppies, "drive0", beta_disk_device::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) MCFG_FLOPPY_DRIVE_ADD("wd179x:1", beta_disk_floppies, "drive1", beta_disk_device::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) MCFG_FLOPPY_DRIVE_ADD("wd179x:2", beta_disk_floppies, "drive2", beta_disk_device::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) MCFG_FLOPPY_DRIVE_ADD("wd179x:3", beta_disk_floppies, "drive3", beta_disk_device::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) MACHINE_CONFIG_END ROM_START( beta_disk ) -- cgit v1.2.3-70-g09d2 From 3e1ef4c17c96ca8621bdb56ba9989e0d3f652a92 Mon Sep 17 00:00:00 2001 From: hap Date: Wed, 3 Feb 2016 21:05:31 +0100 Subject: New WORKING machine added -------------- Chess Challenger 7 [hap, Berger] --- src/mame/drivers/deshoros.cpp | 2 +- src/mame/drivers/fidel6502.cpp | 9 +- src/mame/drivers/fidelz80.cpp | 220 +++++++++++++++++++++++++++-------------- src/mame/drivers/hh_tms1k.cpp | 11 +++ src/mame/includes/fidelz80.h | 4 + src/mame/includes/hh_tms1k.h | 1 + src/mame/layout/fidel_bcc.lay | 69 +++++++++++++ 7 files changed, 233 insertions(+), 83 deletions(-) create mode 100644 src/mame/layout/fidel_bcc.lay diff --git a/src/mame/drivers/deshoros.cpp b/src/mame/drivers/deshoros.cpp index b1884ab9265..dac7f3a989d 100644 --- a/src/mame/drivers/deshoros.cpp +++ b/src/mame/drivers/deshoros.cpp @@ -12,7 +12,7 @@ It is not Y2K compliant. Rough cpanel sketch: - [LED-array dispay] 1 2 3 M + [LED-array display] 1 2 3 M 4 5 6 F 7 8 9 0 CLEAR ENTER diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index cf5b7bb4a8f..11b78cb6874 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -15,7 +15,6 @@ #include "cpu/m6502/r65c02.h" #include "cpu/m6502/m65sc02.h" #include "machine/6821pia.h" -#include "sound/speaker.h" #include "bus/generic/slot.h" #include "bus/generic/carts.h" #include "softlist.h" @@ -34,14 +33,12 @@ public: fidel6502_state(const machine_config &mconfig, device_type type, const char *tag) : fidelz80base_state(mconfig, type, tag), m_6821pia(*this, "6821pia"), - m_cart(*this, "cartslot"), - m_speaker(*this, "speaker") + m_cart(*this, "cartslot") { } // devices/pointers optional_device m_6821pia; optional_device m_cart; - optional_device m_speaker; TIMER_DEVICE_CALLBACK_MEMBER(irq_on) { m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); } TIMER_DEVICE_CALLBACK_MEMBER(irq_off) { m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); } @@ -94,16 +91,14 @@ void fidel6502_state::csc_prepare_display() // 4 7seg leds + H for (int i = 0; i < 4; i++) - { - m_display_segmask[i] = 0x7f; m_display_state[i] = (m_inp_mux >> i & 1) ? m_7seg_data : 0; - } // 8*8 chessboard leds for (int i = 0; i < 8; i++) m_display_state[i+4] = (m_inp_mux >> i & 1) ? m_led_data : 0; set_display_size(8, 12); + set_display_segmask(0xf, 0x7f); display_update(); } diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 714221c0e0a..2abfab37c8d 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -42,7 +42,7 @@ Board hardware descriptions below. Detailed RE work done by Kevin 'kevtris' Horton, except where noted -*********************************************************************** +****************************************************************************** Voice Chess Challenger (VCC) (version A and B?) Advanced Voice Chess Challenger (UVC) @@ -51,7 +51,6 @@ Decorator Challenger (FCC) (which share the same hardware) ---------------------- - The CPU is a Z80 running at 4MHz. The TSI chip runs at around 25KHz, using a 470K / 100pf RC network. This system is very very basic, and is composed of just the Z80, 4 ROMs, the TSI chip, and an 8255. @@ -79,14 +78,12 @@ Memory map (UVC): 4000-5FFF: 1K RAM (2114 SRAM x2) 6000-FFFF: empty -I/O map: --------- +Port map: +--------- 00-03: 8255 port chip, mirrored over the 00-FF range; program accesses F4-F7 - 8255 connections: ----------------- - PA.0 - segment G, TSI A0 (W) PA.1 - segment F, TSI A1 (W) PA.2 - segment E, TSI A2 (W) @@ -115,19 +112,15 @@ PC.5 - button column B (W) PC.6 - button column C (W) PC.7 - button column D (W) - language switches: ------------------ - When PB.6 is pulled low, the language switches can be read. There are four. They connect to the button rows. When enabled, the row(s) will read low if the jumper is present. English only VCC's do not have the 367 or any pads stuffed. The jumpers are labelled: French, German, Spanish, and special. - language latch: --------------- - There's an unstuffed 7474 on the board that connects to PA.6 and PA.7. It allows one to latch the state of A12 to the speech ROM. The English version has the chip missing, and a jumper pulling "A12" to ground. This line is really a negative @@ -143,11 +136,10 @@ automatically select the correct ROM(s). I have to test whether it will do auto determination and give you a language option on power up or something. -*********************************************************************** +****************************************************************************** -Chess Challenger 10 +Chess Challenger 10 (CC10) ------------------- - 4 versions are known to exist: A,B,C,D. Strangely, version C has an 8080 instead of Z80. Chess Challenger 1,3 and 7 also run on very similar hardware. @@ -158,7 +150,6 @@ the connections to ports A and B on the PPI: 8255 connections: ----------------- - PA.0 - segment G (W) PA.1 - segment F (W) PA.2 - segment E (W) @@ -191,6 +182,37 @@ PC.6 - button column C (W) PC.7 - button column D (W) +****************************************************************************** + +Chess Challenger 7 (BCC) +------------------------ +RE information from netlist by Berger + +Zilog Z80A, 3.579MHz from XTAL +This is a cost-reduced design from CC10, no special I/O chips. + +Memory map: +----------- +0000-0FFF: 4K 2332 ROM CN19103N BCC-REVB. +2000-2FFF: ROM/RAM bus conflict! +3000-3FFF: 256 bytes RAM (2111 SRAM x2) +4000-FFFF: Z80 A14/A15 not connected + +Port map (Write): +--------- +D0-D3: digit select and keypad mux +D4: LOSE led +D5: CHECK led +A0-A2: NE591 A0-A2 +D7: NE591 D (_C not used) +NE591 Q0-Q6: digit segments A-G +NE591 Q7: buzzer + +Port map (Read): +--------- +D0-D3: keypad row + + ****************************************************************************** Voice Bridge Challenger (Model VBRC, later reissued as Model 7002) @@ -216,7 +238,6 @@ The 8041 runs at 5MHz. Memory Map: ----------- - 0000-1FFF: 8K 101-64108 ROM 2000-3FFF: 8K 101-64109 ROM 4000-5FFF: 8K 101-64110 ROM @@ -230,15 +251,12 @@ when the word is done being spoken. This is because D0-D5 run to the TSI chip d The TSI chip's ROM is 4K, and is marked 101-32118. The clock is the same as the Chess Challengers- 470K/100pf which gives a frequency around 25KHz or so. -I/O Map: --------- - +Port Map: +--------- 00-FF: 8041 I/O ports (A0 selects between the two) - 8041 pinout: ------------ - (note: columns are pulled up with 10K resistors) P10 - column H, RD LED, VFD grid 0 @@ -264,10 +282,8 @@ PROG - I/O expander T0 - optical card sensor (high = bright/reflective, low = dark/non reflective) T1 - connects to inverter, then nothing? - D8243C I/O expander: -------------------- - P4.0 - segment M P4.1 - segment L P4.2 - segment N @@ -288,10 +304,8 @@ P7.1 - goes through inverter, to pads that are not used P7.2 - segment C P7.3 - segment H - button matrix: -------------- - the matrix is composed of 8 columns by 4 rows. A B C D E F G H @@ -337,7 +351,6 @@ Champion Sensory Chess Challenger (CSC) Memory map: ----------- - 0000-07FF: 2K of RAM 0800-0FFF: 1K of RAM (note: mirrored twice) 1000-17FF: PIA 0 (display, TSI speech chip) @@ -356,10 +369,8 @@ NMI is not used. IRQ is connected to a 600Hz oscillator (38.4KHz divided by 64). Reset is connected to a power-on reset circuit. - PIA 0: ------ - PA0 - 7seg segments E, TSI A0 PA1 - 7seg segments D, TSI A1 PA2 - 7seg segments C, TSI A2 @@ -384,10 +395,8 @@ CA2 - violet wire CB1 - NC CB2 - NC (connects to pin 14 of soldered connector) - PIA 1: ------ - PA0 - button row 1 PA1 - button row 2 PA2 - button row 3 @@ -412,10 +421,8 @@ CA2 - selector bit 3 CB1 - button row 8 CB2 - selector bit 2 - Selector: (attached to PIA 1, outputs 1 of 10 pins low. 7442) --------- - output # (selected turns this column on, and all others off) 0 - LED column A, button column A, 7seg digit 1 1 - LED column B, button column B, 7seg digit 2 @@ -456,10 +463,8 @@ column F - ST these 6 buttons use row 9 (connects to PIA 0) - LED display: ------------ - 43 21 (digit number) ----- 88:88 @@ -473,18 +478,16 @@ The lone LED is connected to digit 1 common All three of the above are called "segment H". -*********************************************************************** +****************************************************************************** Voice Sensory Chess Challenger (VSC) ------------------------------------ - The display/button/LED/speech technology is identical to the above product. Only the CPU board was changed. As such, it works the same but is interfaced to different port chips this time. Hardware: --------- - On the board are 13 chips. The CPU is a Z80A running at 3.9MHz, with 20K of ROM and 1K of RAM mapped. @@ -508,17 +511,15 @@ RST connects to a power-on reset circuit Memory map: ----------- - 0000-1FFF: 8K ROM 101-64018 2000-3FFF: 8K ROM 101-64019 (also used on the sensory champ. chess challenger) 4000-5FFF: 4K ROM 101-32024 6000-7FFF: 1K of RAM (2114 * 2) 8000-FFFF: not used, maps to open bus -I/O map: --------- - -There's only two chips in the I/O map, an 8255 triple port chip, and a Z80A PIO +Port map: +--------- +There's only two chips in the portmap, an 8255 triple port chip, and a Z80A PIO parallel input/output device. Decoding isn't performed using a selector, but instead address lines are used. @@ -551,10 +552,8 @@ This sequence repeats every 16 addresses. So to recap: Refer to the Sensory Champ. Chess Chall. above for explanations of the below I/O names and labels. It's the same. - 8255: ----- - PA.0 - segment D, TSI A0 PA.1 - segment E, TSI A1 PA.2 - segment F, TSI A2 @@ -582,10 +581,8 @@ PC.5 - LED column F, button column F PC.6 - LED column G, button column G PC.7 - LED column H, button column H - Z80A PIO: --------- - PA.0 - button row 1 PA.1 - button row 2 PA.2 - button row 3 @@ -604,10 +601,8 @@ PB.5 - selection jumper input (see below) PB.6 - TSI start line PB.7 - TSI ROM A12 line - selection jumpers: ------------------ - These act like another row of buttons. It is composed of two diode locations, so there's up to 4 possible configurations. My board does not have either diode stuffed, so this most likely is "English". I suspect it selects which language to use @@ -624,7 +619,6 @@ expect that the software reads these once on startup only. Sensory Chess Challenger (SC12-B) 4 versions are known to exist: A,B,C, and X, with increasing CPU speed. --------------------------------- - RE information from netlist by Berger 8*(8+1) buttons, 8+8+2 red LEDs @@ -636,10 +630,8 @@ NE556 dual-timer IC: - timer#1, one-shot at power-on, to CPU _RESET - timer#2: R1=82K, R2=1K, C=22nf, to CPU _IRQ: ~780Hz, active low=15.25us - Memory map: ----------- - 6000-0FFF: 4K of RAM (2016 * 2) 2000-5FFF: cartridge 6000-7FFF: control(W) @@ -650,7 +642,6 @@ E000-FFFF: 8K ROM Toshiba TMM2764D-2 control: (74LS377) -------- - Q0-Q3: 7442 A0-A3 Q4: enable printer port pin 1 input Q5: printer port pin 5 output @@ -667,7 +658,6 @@ If control Q4 is set, printer data can be read from I0. Voice Excellence (FEV, model 6092) ---------------------------------- - PCB 1: 510.1117A02, appears to be identical to other "Excellence" boards CPU: GTE G65SC102P-3, 32 KB PRG ROM: AMI 101-1080A01(IC5), 8192x8 SRAM SRM2264C10(IC6) 2 rows of LEDs on the side: 1*8 green, 1*8 red @@ -713,6 +703,7 @@ ROM A11 is however tied to the CPU's XYZ // internal artwork #include "fidel_cc.lh" +#include "fidel_bcc.lh" #include "fidel_vcc.lh" #include "fidel_vbrc.lh" #include "fidel_vsc.lh" // clickable @@ -751,6 +742,10 @@ public: DECLARE_WRITE8_MEMBER(vcc_ppi_portc_w); DECLARE_WRITE8_MEMBER(cc10_ppi_porta_w); TIMER_DEVICE_CALLBACK_MEMBER(beeper_off_callback); + + // model BCC + DECLARE_READ8_MEMBER(bcc_input_r); + DECLARE_WRITE8_MEMBER(bcc_control_w); // model VSC void vsc_prepare_display(); @@ -763,7 +758,7 @@ public: DECLARE_READ8_MEMBER(vsc_pio_portb_r); DECLARE_WRITE8_MEMBER(vsc_pio_portb_w); - // model 7014 and VBC + // model 7014 and VBRC void vbrc_prepare_display(); DECLARE_WRITE8_MEMBER(vbrc_speech_w); DECLARE_WRITE8_MEMBER(vbrc_mcu_p1_w); @@ -891,6 +886,17 @@ void fidelz80base_state::set_display_size(int maxx, int maxy) m_display_maxy = maxy; } +void fidelz80base_state::set_display_segmask(UINT32 digits, UINT32 mask) +{ + // set a segment mask per selected digit, but leave unselected ones alone + for (int i = 0; i < 0x20; i++) + { + if (digits & 1) + m_display_segmask[i] = mask; + digits >>= 1; + } +} + void fidelz80base_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) { set_display_size(maxx, maxy); @@ -939,12 +945,9 @@ INPUT_CHANGED_MEMBER(fidelz80_state::reset_button) void fidelz80_state::vcc_prepare_display() { - // 4 7seg leds - for (int i = 0; i < 4; i++) - m_display_segmask[i] = 0x7f; - - // note: sel d0 for extra leds + // 4 7seg leds (note: sel d0 for extra leds) UINT8 outdata = (m_7seg_data & 0x7f) | (m_led_select << 7 & 0x80); + set_display_segmask(0xf, 0x7f); display_matrix(8, 4, outdata, m_led_select >> 2 & 0xf); } @@ -1027,6 +1030,34 @@ WRITE8_MEMBER(fidelz80_state::cc10_ppi_porta_w) +/****************************************************************************** + BCC +******************************************************************************/ + +// TTL + +WRITE8_MEMBER(fidelz80_state::bcc_control_w) +{ + // a0-a2,d7: digit segment data via NE591, Q7 is speaker out + UINT8 sel = 1 << (offset & 7); + m_7seg_data = (m_7seg_data & ~sel) | ((data & 0x80) ? sel : 0); + m_speaker->level_w(m_7seg_data >> 7 & 1); + + // d0-d3: led select, input mux + // d4,d5: check,lose leds(direct) + set_display_segmask(0xf, 0x7f); + display_matrix(7, 6, m_7seg_data & 0x7f, data & 0x3f); + m_inp_mux = data & 0xf; +} + +READ8_MEMBER(fidelz80_state::bcc_input_r) +{ + // d0-d3: multiplexed inputs + return read_inputs(4); +} + + + /****************************************************************************** VSC ******************************************************************************/ @@ -1037,16 +1068,14 @@ void fidelz80_state::vsc_prepare_display() { // 4 7seg leds + H for (int i = 0; i < 4; i++) - { - m_display_segmask[i] = 0x7f; m_display_state[i] = (m_led_select >> i & 1) ? m_7seg_data : 0; - } // 8*8 chessboard leds for (int i = 0; i < 8; i++) m_display_state[i+4] = (m_led_select >> i & 1) ? m_led_data : 0; set_display_size(8, 12); + set_display_segmask(0xf, 0x7f); display_update(); } @@ -1127,9 +1156,7 @@ void fidelz80_state::vbrc_prepare_display() { // 14seg led segments, d15 is extra led, d14 is unused (tone on prototype?) UINT16 outdata = BITSWAP16(m_7seg_data,12,13,1,6,5,2,0,7,15,11,10,14,4,3,9,8); - for (int i = 0; i < 8; i++) - m_display_segmask[i] = 0x3fff; - + set_display_segmask(0xff, 0x3fff); display_matrix(16, 8, outdata, m_led_select); } @@ -1181,8 +1208,9 @@ READ8_MEMBER(fidelz80_state::vbrc_mcu_t_r) static ADDRESS_MAP_START( cc10_map, AS_PROGRAM, 8, fidelz80_state ) ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x3fff) AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x3000, 0x31ff) AM_RAM + AM_RANGE(0x3000, 0x31ff) AM_MIRROR(0x0e00) AM_RAM ADDRESS_MAP_END static ADDRESS_MAP_START( vcc_map, AS_PROGRAM, 8, fidelz80_state ) @@ -1197,6 +1225,21 @@ static ADDRESS_MAP_START( vcc_io, AS_IO, 8, fidelz80_state ) ADDRESS_MAP_END +// BCC + +static ADDRESS_MAP_START( bcc_map, AS_PROGRAM, 8, fidelz80_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x3fff) + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x3000, 0x30ff) AM_MIRROR(0x0f00) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bcc_io, AS_IO, 8, fidelz80_state ) + ADDRESS_MAP_GLOBAL_MASK(0x07) + AM_RANGE(0x00, 0x07) AM_READWRITE(bcc_input_r, bcc_control_w) +ADDRESS_MAP_END + + // VSC static ADDRESS_MAP_START( vsc_map, AS_PROGRAM, 8, fidelz80_state ) @@ -1359,6 +1402,33 @@ static INPUT_PORTS_START( vccg ) INPUT_PORTS_END +static INPUT_PORTS_START( bcc ) + PORT_START("IN.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("EN") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PV") PORT_CODE(KEYCODE_O) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("d4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_D) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_H) + + PORT_START("IN.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PB") PORT_CODE(KEYCODE_P) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_C) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("g7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_G) + + PORT_START("IN.2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CB") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("b2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_F) + + PORT_START("IN.3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_A) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(KEYCODE_E) +INPUT_PORTS_END + + static INPUT_PORTS_START( vsc ) PORT_START("IN.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a1") @@ -1537,19 +1607,19 @@ INPUT_PORTS_END Machine Drivers ******************************************************************************/ -static MACHINE_CONFIG_START( cc7, fidelz80_state ) +static MACHINE_CONFIG_START( bcc, fidelz80_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz) - MCFG_CPU_PROGRAM_MAP(cc10_map) - //MCFG_CPU_IO_MAP(vcc_io) + MCFG_CPU_PROGRAM_MAP(bcc_map) + MCFG_CPU_IO_MAP(bcc_io) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_fidel_cc) + MCFG_DEFAULT_LAYOUT(layout_fidel_bcc) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -1657,14 +1727,14 @@ MACHINE_CONFIG_END ROM Definitions ******************************************************************************/ -ROM_START( cc7 ) +ROM_START( cc10 ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "cn19103n_bcc-revb", 0x0000, 0x1000, CRC(a397d471) SHA1(9b12bc442fccee40f4d8500c792bc9d886c5e1a5) ) // 2332 + ROM_LOAD( "cc10b", 0x0000, 0x1000, CRC(afd3ca99) SHA1(870d09b2b52ccb8572d69642c59b5215d5fb26ab) ) // 2332 ROM_END -ROM_START( cc10 ) +ROM_START( cc7 ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "cc10b", 0x0000, 0x1000, CRC(afd3ca99) SHA1(870d09b2b52ccb8572d69642c59b5215d5fb26ab) ) // 2332 + ROM_LOAD( "cn19103n_bcc-revb", 0x0000, 0x1000, CRC(a397d471) SHA1(9b12bc442fccee40f4d8500c792bc9d886c5e1a5) ) // 2332 ROM_END @@ -1826,7 +1896,7 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ COMP( 1978, cc10, 0, 0, cc10, cc10, driver_device, 0, "Fidelity Electronics", "Chess Challenger 10 (rev. B)", MACHINE_SUPPORTS_SAVE ) -COMP( 1979, cc7, 0, 0, cc7, cc10, driver_device, 0, "Fidelity Electronics", "Chess Challenger 7 (rev. B)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +COMP( 1979, cc7, 0, 0, bcc, bcc, driver_device, 0, "Fidelity Electronics", "Chess Challenger 7 (rev. B)", MACHINE_SUPPORTS_SAVE ) COMP( 1979, vcc, 0, 0, vcc, vcc, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (English)", MACHINE_SUPPORTS_SAVE ) COMP( 1979, vccsp, vcc, 0, vcc, vccsp, driver_device, 0, "Fidelity Electronics", "Voice Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 7c30ff3ca3f..9b30fd89b66 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -271,6 +271,17 @@ void hh_tms1k_state::set_display_size(int maxx, int maxy) m_display_maxy = maxy; } +void hh_tms1k_state::set_display_segmask(UINT32 digits, UINT32 mask) +{ + // set a segment mask per selected digit, but leave unselected ones alone + for (int i = 0; i < 0x20; i++) + { + if (digits & 1) + m_display_segmask[i] = mask; + digits >>= 1; + } +} + void hh_tms1k_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) { set_display_size(maxx, maxy); diff --git a/src/mame/includes/fidelz80.h b/src/mame/includes/fidelz80.h index a27f4e7aabc..a43182773f5 100644 --- a/src/mame/includes/fidelz80.h +++ b/src/mame/includes/fidelz80.h @@ -7,6 +7,7 @@ ******************************************************************************/ #include "emu.h" +#include "sound/speaker.h" #include "sound/s14001a.h" class fidelz80base_state : public driver_device @@ -18,6 +19,7 @@ public: m_inp_matrix(*this, "IN"), m_speech(*this, "speech"), m_speech_rom(*this, "speech"), + m_speaker(*this, "speaker"), m_display_wait(33), m_display_maxy(1), m_display_maxx(0) @@ -28,6 +30,7 @@ public: optional_ioport_array<11> m_inp_matrix; // max 11 optional_device m_speech; optional_region_ptr m_speech_rom; + optional_device m_speaker; // misc common UINT16 m_inp_mux; // multiplexed keypad/leds mask @@ -51,6 +54,7 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); void display_update(); void set_display_size(int maxx, int maxy); + void set_display_segmask(UINT32 digits, UINT32 mask); void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); protected: diff --git a/src/mame/includes/hh_tms1k.h b/src/mame/includes/hh_tms1k.h index 4a7ccb99467..0551bc8e17f 100644 --- a/src/mame/includes/hh_tms1k.h +++ b/src/mame/includes/hh_tms1k.h @@ -60,6 +60,7 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); void display_update(); void set_display_size(int maxx, int maxy); + void set_display_segmask(UINT32 digits, UINT32 mask); void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); void display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask); diff --git a/src/mame/layout/fidel_bcc.lay b/src/mame/layout/fidel_bcc.lay new file mode 100644 index 00000000000..d9bf4712953 --- /dev/null +++ b/src/mame/layout/fidel_bcc.lay @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-70-g09d2 From 13cea8d9b91ed89acad081af489aa74b382265f9 Mon Sep 17 00:00:00 2001 From: sparrowred Date: Wed, 3 Feb 2016 22:13:42 +0100 Subject: corrected software list connection for snotec, snotecex, pc1000 and ordisava as they have listed the same software list xml twice, as original and compatible --- src/mame/drivers/pc2000.cpp | 1 + src/mame/drivers/prestige.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/mame/drivers/pc2000.cpp b/src/mame/drivers/pc2000.cpp index 152ee648b28..b207dd72fec 100644 --- a/src/mame/drivers/pc2000.cpp +++ b/src/mame/drivers/pc2000.cpp @@ -935,6 +935,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( pc1000, misterx ) MCFG_SOFTWARE_LIST_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_REMOVE("pc1000_cart") MCFG_SOFTWARE_LIST_ADD("cart_list", "pc1000") MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") MACHINE_CONFIG_END diff --git a/src/mame/drivers/prestige.cpp b/src/mame/drivers/prestige.cpp index e8c0c1200fb..4b7131f82d4 100644 --- a/src/mame/drivers/prestige.cpp +++ b/src/mame/drivers/prestige.cpp @@ -775,6 +775,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( snotec, glcolor ) MCFG_SOFTWARE_LIST_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_REMOVE("snotec_cart") MCFG_SOFTWARE_LIST_ADD("cart_list", "snotec") MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("glcolor_cart", "glcolor") MACHINE_CONFIG_END -- cgit v1.2.3-70-g09d2 From 7da8fa7bb887715842e41e1e7e5ee3216b7250f7 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Wed, 3 Feb 2016 23:18:16 +0100 Subject: timeplt.cpp: fixed save state regression found during Tafoid's latest round of tests (nw) --- src/mame/video/timeplt.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mame/video/timeplt.cpp b/src/mame/video/timeplt.cpp index afd493a8b92..b418ab7c4fc 100644 --- a/src/mame/video/timeplt.cpp +++ b/src/mame/video/timeplt.cpp @@ -139,6 +139,9 @@ VIDEO_START_MEMBER(timeplt_state,psurge) VIDEO_START_MEMBER(timeplt_state,chkun) { m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(timeplt_state::get_chkun_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_video_enable = 0; + + save_item(NAME(m_video_enable)); } -- cgit v1.2.3-70-g09d2 From d88c7951c3952eb08d53897cdacde619d8c680d6 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Wed, 3 Feb 2016 23:25:03 +0100 Subject: mc6845.cpp: fixed save state regression found during Tafoid's latest round of tests (i.e. futflash, docastle, usgames, madalien) (nw) --- src/devices/video/mc6845.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/devices/video/mc6845.cpp b/src/devices/video/mc6845.cpp index 57813f574ab..04e7c967869 100644 --- a/src/devices/video/mc6845.cpp +++ b/src/devices/video/mc6845.cpp @@ -553,7 +553,8 @@ void mc6845_device::recompute_parameters(bool postload) m_hsync_off_pos = hsync_off_pos; m_vsync_on_pos = vsync_on_pos; m_vsync_off_pos = vsync_off_pos; - m_line_counter = 0; + if (!postload) // set m_line_counter to 0 on normal operation, but not on postload + m_line_counter = 0; } } -- cgit v1.2.3-70-g09d2 From a68842a91fbcfd99f0d636412f4529197e88c543 Mon Sep 17 00:00:00 2001 From: cracyc Date: Wed, 3 Feb 2016 16:58:43 -0600 Subject: pc9801: more egc fixes (nw) --- src/mame/drivers/pc9801.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index 48b89439694..66670fe7c9a 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -1426,7 +1426,20 @@ void pc9801_state::egc_blit_w(UINT32 offset, UINT16 data, UINT16 mem_mask) } // mask off the bits past the end of the blit - if(m_egc.count < 16) + if((m_egc.count < 8) && (mem_mask != 0xffff)) + { + UINT16 end_mask = dir ? ((1 << m_egc.count) - 1) : ~((1 << (8 - m_egc.count)) - 1); + // if the blit is less than 8 bits, adjust the masks + if(m_egc.first) + { + if(dir) + end_mask <<= dst_off & 7; + else + end_mask >>= dst_off & 7; + } + mask &= end_mask; + } + else if((m_egc.count < 16) && (mem_mask == 0xffff)) { UINT16 end_mask = dir ? ((1 << m_egc.count) - 1) : ~((1 << (16 - m_egc.count)) - 1); // if the blit is less than 16 bits, adjust the masks @@ -1457,11 +1470,6 @@ void pc9801_state::egc_blit_w(UINT32 offset, UINT16 data, UINT16 mem_mask) out = data; break; case 1: - if(mem_mask == 0x00ff) - src = src | src << 8; - else if(mem_mask == 0xff00) - src = src | src >> 8; - out = egc_do_partial_op(i, src, pat, m_video_ram_2[offset + (((i + 1) & 3) * 0x4000)]); break; case 2: @@ -2263,7 +2271,7 @@ static ADDRESS_MAP_START( pc9801rs_io, AS_IO, 16, pc9801_state ) AM_RANGE(0x0430, 0x0433) AM_READWRITE8(ide_ctrl_r, ide_ctrl_w, 0x00ff) AM_RANGE(0x0640, 0x064f) AM_READWRITE(ide_cs0_r, ide_cs0_w) AM_RANGE(0x0740, 0x074f) AM_READWRITE(ide_cs1_r, ide_cs1_w) - AM_RANGE(0x1e80, 0x1e8f) AM_NOP // temp + AM_RANGE(0x1e8c, 0x1e8f) AM_NOP // temp AM_RANGE(0xbfd8, 0xbfdf) AM_WRITE8(pc9801rs_mouse_freq_w, 0xffff) AM_RANGE(0xe0d0, 0xe0d3) AM_READ8(pc9801rs_midi_r, 0xffff) AM_IMPORT_FROM(pc9801ux_io) @@ -2512,6 +2520,7 @@ static ADDRESS_MAP_START( pc9821_io, AS_IO, 32, pc9801_state ) // AM_RANGE(0x0c2d, 0x0c2d) cs4231 PCM board hi byte control // AM_RANGE(0x0cc0, 0x0cc7) SCSI interface / // AM_RANGE(0x0cfc, 0x0cff) PCI bus + AM_RANGE(0x1e8c, 0x1e8f) AM_NOP // IDE RAM switch AM_RANGE(0x3fd8, 0x3fdf) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00ff00) // / pit mirror ports AM_RANGE(0x7fd8, 0x7fdf) AM_DEVREADWRITE8("ppi8255_mouse", i8255_device, read, write, 0xff00ff00) AM_RANGE(0x841c, 0x841f) AM_READWRITE8(sdip_0_r,sdip_0_w,0xffffffff) -- cgit v1.2.3-70-g09d2 From 493a78a810e9d71b227dbf9cc06fc96dd2340841 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 4 Feb 2016 00:52:48 +0000 Subject: new print club sets [Team Europe, Ryan Holtz] Print Club 2 Warner Bros (J 970228 V1.000) Print Club 2 '97 Winter Ver (J 971017 V1.100, set 2) Print Club 2 '98 Summer Ver (J 980603 V1.100) --- src/mame/arcade.lst | 9 ++- src/mame/drivers/stv.cpp | 139 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 103 insertions(+), 45 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index be8b3ef62ce..d27a32bee31 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -5144,6 +5144,7 @@ vmahjong // 1997.02 Virtual Mahjong (Micronet) pclub2kc // 1997.02 Print Club Kome Kome Club pclub2fc // 1997.04 Print Club 2 Felix The Cat pclub2pe // +pclub2wb // pclub2pf // pclub26w // pclub27s // @@ -5157,8 +5158,10 @@ pclub2 // 1997.09 Print Club 2 thunt // 1997.09 Puzzle & Action Treasure Hunt (Sega (Deniam License)) thuntk winterht // 1997.10 Winter Heat (Data East) -pclb297w // 1997.10 Print Club 2 '97 Winter Ver -pclub298 // 1997.10 Print Club 2 '98 Spring Ver +prc297wi // 1997.10 Print Club 2 '97 Winter Ver +prc297wia // +prc298sp // 1997.10 Print Club 2 '98 Spring Ver +prc298su // pclove cotton2 // 1997.11 Cotton 2 (Success) hanagumi // 1997.11 Sakura Taisen Hanagumi Taisen Columns @@ -5176,7 +5179,7 @@ astrass // 1998.06 Astra Super Stars (Sunsoft) myfairld // 1998.07 My Fair Lady (Micronet) othellos // 1998.07 Othello Shiyouyo (Success) pclubol // 1998.07 Print Club Olive -pclb298a // 1998.08 Print Club 2 '98 Autumn Ver +prc298au // 1998.08 Print Club 2 '98 Autumn Ver cottonbm // 1998.09 Cotton Boomerang (Success) stress // 1998.10 Stress Busters elandore // 1998.11 Touryuu Densetsu Elandore (Sai-Mate) diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index 9a73880705b..758dbccee5a 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -2916,43 +2916,80 @@ ROM_START( pclub2pf ) // set to 1p ROM_LOAD( "pclub2pf.nv", 0x0000, 0x0080, CRC(447bb3bd) SHA1(9fefec09849bfa0c14b49e73ff13e2a538dff511) ) ROM_END -ROM_START( pclb297w ) // set to 1p +ROM_START( prc297wi ) // set to 1p STV_BIOS ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ - ROM_LOAD16_WORD_SWAP( "pclb297w_ic22", 0x0200000, 0x0200000, CRC(589f6705) SHA1(d10897ab26c3ecdd518087562207de131133646c) ) // OK - IC7? - ROM_LOAD16_WORD_SWAP( "pclb297w_ic24", 0x0400000, 0x0200000, CRC(4bd706d1) SHA1(e3c52c63bb93d9fa836c300865423a226bf74586) ) // OK - IC2? - ROM_LOAD16_WORD_SWAP( "pclb297w_ic26", 0x0600000, 0x0200000, CRC(417e182a) SHA1(4df04a390523e52e48efcc48891bc54452f351c9) ) // OK - IC2? - ROM_LOAD16_WORD_SWAP( "pclb297w_ic28", 0x0800000, 0x0200000, CRC(73da594e) SHA1(936b0af4a32d5b93847bbf2ecfc8d334290059c0) ) // OK - IC3? - ROM_LOAD16_WORD_SWAP( "pclb297w_ic30", 0x0a00000, 0x0200000, CRC(03b9eacf) SHA1(d69c10f7613d9f52042dd6cce64e74e2b1ecc2d8) ) // OK - IC3? - ROM_LOAD16_WORD_SWAP( "pclb297w_ic32", 0x0c00000, 0x0200000, CRC(20437e93) SHA1(dfd2026bec6b2f418cd1cbfa7266717211d013b6) ) // OK - IC4? - ROM_LOAD16_WORD_SWAP( "pclb297w_ic34", 0x0e00000, 0x0200000, CRC(9639b003) SHA1(8f95b024ad19151e1e642d58aa785d14ae3a0661) ) // OK - IC4? - ROM_LOAD16_WORD_SWAP( "pclb297w_ic36", 0x1000000, 0x0200000, CRC(dd1b57b6) SHA1(8450355ec6cdc9718f8579f8702f3900f686c3f8) ) // BAD? - IC5 ?? (will need rom below to pass) - ROM_LOAD16_WORD_SWAP( "pclb297w_ic23", 0x1200000, 0x0200000, NO_DUMP) // IC5 ?? - ROM_LOAD16_WORD_SWAP( "pclb297w_ic25", 0x1400000, 0x0200000, NO_DUMP) // IC6 ?? - ROM_LOAD16_WORD_SWAP( "pclb297w_ic27", 0x1600000, 0x0200000, NO_DUMP) // IC6 ?? + ROM_LOAD16_WORD_SWAP( "prc297wi_ic22", 0x0200000, 0x0200000, CRC(589f6705) SHA1(d10897ab26c3ecdd518087562207de131133646c) ) // OK - IC7 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic24", 0x0400000, 0x0200000, CRC(4bd706d1) SHA1(e3c52c63bb93d9fa836c300865423a226bf74586) ) // OK - IC2 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic26", 0x0600000, 0x0200000, CRC(417e182a) SHA1(4df04a390523e52e48efcc48891bc54452f351c9) ) // OK - IC2 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic28", 0x0800000, 0x0200000, CRC(73da594e) SHA1(936b0af4a32d5b93847bbf2ecfc8d334290059c0) ) // OK - IC3 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic30", 0x0a00000, 0x0200000, CRC(03b9eacf) SHA1(d69c10f7613d9f52042dd6cce64e74e2b1ecc2d8) ) // OK - IC3 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic32", 0x0c00000, 0x0200000, CRC(20437e93) SHA1(dfd2026bec6b2f418cd1cbfa7266717211d013b6) ) // OK - IC4 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic34", 0x0e00000, 0x0200000, CRC(9639b003) SHA1(8f95b024ad19151e1e642d58aa785d14ae3a0661) ) // OK - IC4 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic36", 0x1000000, 0x0200000, CRC(dd1b57b6) SHA1(8450355ec6cdc9718f8579f8702f3900f686c3f8) ) // OK - IC5 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic23", 0x1200000, 0x0200000, CRC(e3d9d12b) SHA1(28ec3727774ef8a6a241238ad134a5adab8327fd) ) // OK - IC5 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic25", 0x1400000, 0x0200000, CRC(71238374) SHA1(0dc534628a98aba508bdef58f8b812908414ae48) ) // OK - IC6 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic27", 0x1600000, 0x0200000, CRC(7485a9a2) SHA1(17999a5192f185a27c08c2f05e19c65977b8f84e) ) // OK - IC6 ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player ROM_LOAD( "eeprom", 0x0000, 0x0080, CRC(9ba58358) SHA1(555ac21321b3051f7083cd72176ddc0fef2d4155) ) ROM_END -ROM_START( pclub298 ) // set to 1p +ROM_START( prc297wia ) // set to 1p STV_BIOS ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ - ROM_LOAD16_WORD_SWAP( "pclub298_ic22", 0x0200000, 0x0200000, CRC(cb0ec98a) SHA1(efef536cb3bc71207936b26b87f04641baded10b) ) // OK? - tested as IC7? - ROM_LOAD16_WORD_SWAP( "pclub298_ic24", 0x0400000, 0x0200000, CRC(645e7e24) SHA1(7362b0c4b500639c20ec27002f543a0b4390eaa8) ) // OK - tested as IC2 - ROM_LOAD16_WORD_SWAP( "pclub298_ic26", 0x0600000, 0x0200000, CRC(9d3ad85d) SHA1(71fe330594ab58be331aa5311472855be07cb44c) ) // OK - tested as IC2 - ROM_LOAD16_WORD_SWAP( "pclub298_ic28", 0x0800000, 0x0200000, CRC(877e73cc) SHA1(dd9928a3fe0ed759611e1b7be8ea10b45084e392) ) // OK - tested as IC3 - ROM_LOAD16_WORD_SWAP( "pclub298_ic30", 0x0a00000, 0x0200000, CRC(03b9eacf) SHA1(d69c10f7613d9f52042dd6cce64e74e2b1ecc2d8) ) // OK - tested as IC3 - ROM_LOAD16_WORD_SWAP( "pclub298_ic32", 0x0c00000, 0x0200000, CRC(62c10626) SHA1(58cb0ca0330fa7a62b277ab0ff84bff65b81bb23) ) // OK - tested as IC4 - ROM_LOAD16_WORD_SWAP( "pclub298_ic34", 0x0e00000, 0x0200000, CRC(8d89877e) SHA1(7d76d48d64d7ac5411d714a4bb83f37e3e5b8df6) ) // 00 fill. OK - tested as IC4 - ROM_LOAD16_WORD_SWAP( "pclub298_ic36", 0x1000000, 0x0200000, CRC(8d89877e) SHA1(7d76d48d64d7ac5411d714a4bb83f37e3e5b8df6) ) // 00 fill, OK - tested as IC5 + ROM_LOAD16_WORD_SWAP( "pclb297w_ic22_ALT", 0x0200000, 0x0200000, CRC(1feb3bfe) SHA1(cb79908a13e32c3c00e5892d988088a902d6f874) ) // OK - IC7 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic24", 0x0400000, 0x0200000, CRC(4bd706d1) SHA1(e3c52c63bb93d9fa836c300865423a226bf74586) ) // OK - IC2 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic26", 0x0600000, 0x0200000, CRC(417e182a) SHA1(4df04a390523e52e48efcc48891bc54452f351c9) ) // OK - IC2 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic28", 0x0800000, 0x0200000, CRC(73da594e) SHA1(936b0af4a32d5b93847bbf2ecfc8d334290059c0) ) // OK - IC3 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic30", 0x0a00000, 0x0200000, CRC(03b9eacf) SHA1(d69c10f7613d9f52042dd6cce64e74e2b1ecc2d8) ) // OK - IC3 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic32", 0x0c00000, 0x0200000, CRC(20437e93) SHA1(dfd2026bec6b2f418cd1cbfa7266717211d013b6) ) // OK - IC4 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic34", 0x0e00000, 0x0200000, CRC(9639b003) SHA1(8f95b024ad19151e1e642d58aa785d14ae3a0661) ) // OK - IC4 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic36", 0x1000000, 0x0200000, CRC(dd1b57b6) SHA1(8450355ec6cdc9718f8579f8702f3900f686c3f8) ) // OK - IC5 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic23", 0x1200000, 0x0200000, CRC(e3d9d12b) SHA1(28ec3727774ef8a6a241238ad134a5adab8327fd) ) // OK - IC5 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic25", 0x1400000, 0x0200000, CRC(71238374) SHA1(0dc534628a98aba508bdef58f8b812908414ae48) ) // OK - IC6 + ROM_LOAD16_WORD_SWAP( "prc297wi_ic27", 0x1600000, 0x0200000, CRC(7485a9a2) SHA1(17999a5192f185a27c08c2f05e19c65977b8f84e) ) // OK - IC6 ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player - ROM_LOAD( "pclub298.nv", 0x0000, 0x0080, CRC(a23dd0f2) SHA1(457282b5d40a17477b95330bba91e05c603f951e) ) + ROM_LOAD( "eeprom", 0x0000, 0x0080, CRC(9ba58358) SHA1(555ac21321b3051f7083cd72176ddc0fef2d4155) ) +ROM_END + + +ROM_START( prc298sp ) // set to 1p + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ + + ROM_LOAD16_WORD_SWAP( "prc298sp_ic22", 0x0200000, 0x0200000, CRC(cb0ec98a) SHA1(efef536cb3bc71207936b26b87f04641baded10b) ) // OK? - tested as IC7? + ROM_LOAD16_WORD_SWAP( "prc298sp_ic24", 0x0400000, 0x0200000, CRC(645e7e24) SHA1(7362b0c4b500639c20ec27002f543a0b4390eaa8) ) // OK - tested as IC2 + ROM_LOAD16_WORD_SWAP( "prc298sp_ic26", 0x0600000, 0x0200000, CRC(9d3ad85d) SHA1(71fe330594ab58be331aa5311472855be07cb44c) ) // OK - tested as IC2 + ROM_LOAD16_WORD_SWAP( "prc298sp_ic28", 0x0800000, 0x0200000, CRC(877e73cc) SHA1(dd9928a3fe0ed759611e1b7be8ea10b45084e392) ) // OK - tested as IC3 + ROM_LOAD16_WORD_SWAP( "prc298sp_ic30", 0x0a00000, 0x0200000, CRC(03b9eacf) SHA1(d69c10f7613d9f52042dd6cce64e74e2b1ecc2d8) ) // OK - tested as IC3 + ROM_LOAD16_WORD_SWAP( "prc298sp_ic32", 0x0c00000, 0x0200000, CRC(62c10626) SHA1(58cb0ca0330fa7a62b277ab0ff84bff65b81bb23) ) // OK - tested as IC4 + ROM_LOAD16_WORD_SWAP( "prc298sp_ic34", 0x0e00000, 0x0200000, CRC(8d89877e) SHA1(7d76d48d64d7ac5411d714a4bb83f37e3e5b8df6) ) // 00 fill. OK - tested as IC4 + ROM_LOAD16_WORD_SWAP( "prc298sp_ic36", 0x1000000, 0x0200000, CRC(8d89877e) SHA1(7d76d48d64d7ac5411d714a4bb83f37e3e5b8df6) ) // 00 fill, OK - tested as IC5 + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "prc298sp.nv", 0x0000, 0x0080, CRC(a23dd0f2) SHA1(457282b5d40a17477b95330bba91e05c603f951e) ) +ROM_END + +ROM_START( prc298su ) // set to 1p + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ + + ROM_LOAD16_WORD_SWAP( "pclb298s_ic22", 0x0200000, 0x0200000, CRC(9720fe7a) SHA1(5b17eee0bd4574c0b2eb5bb64928d37bd87da23f) ) // OK - tested as IC7 + ROM_LOAD16_WORD_SWAP( "pclb298s_ic24", 0x0400000, 0x0200000, CRC(380496dc) SHA1(60a000cd71553cd23009ffd41b0208153b18d858) ) // OK - tested as IC2 + ROM_LOAD16_WORD_SWAP( "pclb298s_ic26", 0x0600000, 0x0200000, CRC(42622126) SHA1(cc312b1be51e919013ce55d4c1242a90676157e0) ) // OK - tested as IC2 + ROM_LOAD16_WORD_SWAP( "pclb298s_ic28", 0x0800000, 0x0200000, CRC(c03e861a) SHA1(e39e1d040651577d088ce88d354c74e96971efaa) ) // OK - tested as IC3 + ROM_LOAD16_WORD_SWAP( "pclb298s_ic30", 0x0a00000, 0x0200000, CRC(01844b12) SHA1(92d23e54cdfba8c0bdf3d87c52313334e2f903fa) ) // OK - tested as IC3 + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "prc298su.nv", 0x0000, 0x0080, CRC(6b81636a) SHA1(c84de7c374c46f92985186834ab023986e2abbd8) ) ROM_END @@ -3001,6 +3038,22 @@ ROM_START( pclub2pe ) // set to 1p ROM_LOAD( "pclub2pe.nv", 0x0000, 0x0080, CRC(447bb3bd) SHA1(9fefec09849bfa0c14b49e73ff13e2a538dff511)) ROM_END +ROM_START( pclub2wb ) // set to 1p + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ + + ROM_LOAD16_WORD_SWAP( "pclb2wb_IC22", 0x0200000, 0x0200000, CRC(12245be7) SHA1(4d6c2c9ca7fe73a9ec490157cdb01a6228dee7f8) ) + ROM_LOAD16_WORD_SWAP( "pclb2wb_IC24", 0x0400000, 0x0200000, CRC(e5d6e11e) SHA1(4af3c646747f76d99482c985f960df2519a85c23) ) + ROM_LOAD16_WORD_SWAP( "pclb2wb_IC26", 0x0600000, 0x0200000, CRC(7ee066f0) SHA1(a7c725ce8e621ed299474dd215174699e097db3f) ) + ROM_LOAD16_WORD_SWAP( "pclb2wb_IC28", 0x0800000, 0x0200000, CRC(9ed59513) SHA1(c8f5ed13be2a91f83c35a7929aaa5751d7843e6e) ) + ROM_LOAD16_WORD_SWAP( "pclb2wb_IC30", 0x0a00000, 0x0200000, CRC(00a0c702) SHA1(f2c4a7a51559f0ade96b8e6337cd1a1d61472de7) ) + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "pclub2wb.nv", 0x0000, 0x0080, CRC(0d442eec) SHA1(54dd544e1496e3999d8111eb06abf805b610d77d) ) +ROM_END + + ROM_START( pclubyo2 ) // set to 1p STV_BIOS @@ -3018,22 +3071,22 @@ ROM_START( pclubyo2 ) // set to 1p ROM_END -ROM_START( pclb298a ) // set to 1p +ROM_START( prc298au ) // set to 1p STV_BIOS ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ - ROM_LOAD16_WORD_SWAP( "pclb298a_ic22", 0x0200000, 0x0200000, CRC(21a995ce) SHA1(6ee1250becd76bef3aa8044a42e10c3830a609bd) ) // OK - ROM_LOAD16_WORD_SWAP( "pclb298a_ic24", 0x0400000, 0x0200000, CRC(94540f39) SHA1(cee9fff48d177e7502802d366339ed922c212871) ) // OK - ROM_LOAD16_WORD_SWAP( "pclb298a_ic26", 0x0600000, 0x0200000, CRC(8b22c41f) SHA1(371f8b35ed45f695f5ec0c8db2c4b62007bf4782) ) // OK - ROM_LOAD16_WORD_SWAP( "pclb298a_ic28", 0x0800000, 0x0200000, CRC(bf68cec0) SHA1(550138f5110661d69eaff44c0596914a2621c3df) ) // OK - ROM_LOAD16_WORD_SWAP( "pclb298a_ic30", 0x0a00000, 0x0200000, CRC(ae276c06) SHA1(98358860ae9bf7c405ba4f763c7a4bf309ce85e3) ) // OK - ROM_LOAD16_WORD_SWAP( "pclb298a_ic32", 0x0c00000, 0x0200000, CRC(a3fb81f5) SHA1(6c78c97635dd486d2a7c09bc0511267eae6082c4) ) // OK - ROM_LOAD16_WORD_SWAP( "pclb298a_ic34", 0x0e00000, 0x0200000, CRC(04200dc9) SHA1(e40b01d12ccf71e50da7fd0f3000158626e5a98d) ) // OK - ROM_LOAD16_WORD_SWAP( "pclb298a_ic36", 0x1000000, 0x0200000, CRC(9a4109e5) SHA1(ba59caac5f5a80fc52c507d8a47f322a380aa9a1) ) // (blank! - not tested) + ROM_LOAD16_WORD_SWAP( "prc298au_ic22", 0x0200000, 0x0200000, CRC(21a995ce) SHA1(6ee1250becd76bef3aa8044a42e10c3830a609bd) ) // OK + ROM_LOAD16_WORD_SWAP( "prc298au_ic24", 0x0400000, 0x0200000, CRC(94540f39) SHA1(cee9fff48d177e7502802d366339ed922c212871) ) // OK + ROM_LOAD16_WORD_SWAP( "prc298au_ic26", 0x0600000, 0x0200000, CRC(8b22c41f) SHA1(371f8b35ed45f695f5ec0c8db2c4b62007bf4782) ) // OK + ROM_LOAD16_WORD_SWAP( "prc298au_ic28", 0x0800000, 0x0200000, CRC(bf68cec0) SHA1(550138f5110661d69eaff44c0596914a2621c3df) ) // OK + ROM_LOAD16_WORD_SWAP( "prc298au_ic30", 0x0a00000, 0x0200000, CRC(ae276c06) SHA1(98358860ae9bf7c405ba4f763c7a4bf309ce85e3) ) // OK + ROM_LOAD16_WORD_SWAP( "prc298au_ic32", 0x0c00000, 0x0200000, CRC(a3fb81f5) SHA1(6c78c97635dd486d2a7c09bc0511267eae6082c4) ) // OK + ROM_LOAD16_WORD_SWAP( "prc298au_ic34", 0x0e00000, 0x0200000, CRC(04200dc9) SHA1(e40b01d12ccf71e50da7fd0f3000158626e5a98d) ) // OK + ROM_LOAD16_WORD_SWAP( "prc298au_ic36", 0x1000000, 0x0200000, CRC(9a4109e5) SHA1(ba59caac5f5a80fc52c507d8a47f322a380aa9a1) ) // (blank! - not tested) ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player - ROM_LOAD( "pclub298a.nv", 0x0000, 0x0080, CRC(b4440ff0) SHA1(bd3c83221ede11c68163df4b52a85856c83f865f) ) + ROM_LOAD( "prc298au.nv", 0x0000, 0x0080, CRC(b4440ff0) SHA1(bd3c83221ede11c68163df4b52a85856c83f865f) ) ROM_END @@ -3250,22 +3303,24 @@ GAME( 1997, znpwfv, stvbios, stv, stv, stv_state, znpwfv, ROT /* Unemulated printer / camera devices */ // USA sets GAME( 1997, pclub2, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 (U 970921 V1.000)", MACHINE_NOT_WORKING ) -GAME( 1999, pclub2v3, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 3 (U 990310 V1.000)", MACHINE_NOT_WORKING ) // Hello Kitty themed +GAME( 1999, pclub2v3, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 3 (U 990310 V1.000)", MACHINE_NOT_WORKING ) // Hello Kitty themed GAME( 1999, pclubpok, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Pokemon B (U 991126 V1.000)", MACHINE_NOT_WORKING ) // Japan sets -GAME( 1999, pclub2fc, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Felix The Cat (Rev. A) (J 970415 V1.100)", MACHINE_NOT_WORKING ) -GAME( 1998, pclub2pf, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Puffy (Japan)", MACHINE_NOT_WORKING ) // version info is blank +GAME( 1999, pclub2fc, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Felix The Cat (Rev. A) (J 970415 V1.100)", MACHINE_NOT_WORKING ) +GAME( 1998, pclub2pf, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Puffy (Japan)", MACHINE_NOT_WORKING ) // version info is blank GAME( 1997, pclb2elk, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Earth Limited Kobe (Print Club Custom) (J 970808 V1.000)", MACHINE_NOT_WORKING ) -GAME( 1997, pclub2pe, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Pepsiman (J 970618 V1.100)", MACHINE_NOT_WORKING ) +GAME( 1997, pclub2pe, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Pepsiman (J 970618 V1.100)", MACHINE_NOT_WORKING ) +GAME( 1997, pclub2wb, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Warner Bros (J 970228 V1.000)", MACHINE_NOT_WORKING ) -GAME( 1997, pclub26w, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 6 Winter (J 961210 V1.000)", MACHINE_NOT_WORKING ) // internal string is 'PURIKURA2 97FUYU' (but in reality it seems to be an end of 96 Winter version) -GAME( 1997, pclub27s, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 7 Spring (J 970313 V1.100)", MACHINE_NOT_WORKING ) +GAME( 1997, pclub26w, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 6 Winter (J 961210 V1.000)", MACHINE_NOT_WORKING ) // internal string is 'PURIKURA2 97FUYU' (but in reality it seems to be an end of 96 Winter version) +GAME( 1997, pclub27s, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 Vol. 7 Spring (J 970313 V1.100)", MACHINE_NOT_WORKING ) // Summer 97? // Autumn 97? -GAME( 1997, pclb297w, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '97 Winter Ver (J 971017 V1.100)", MACHINE_NOT_WORKING ) // internal string is '97WINTER' (3 roms bad / missing tho, need new dump) -GAME( 1997, pclub298, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Spring Ver (J 971017 V1.100)", MACHINE_NOT_WORKING ) // date is the same as previous version, surely incorrect / not updated when the game was -// Summer 98? -GAME( 1998, pclb298a, pclub2, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Autumn Ver (J 980827 V1.000)", MACHINE_NOT_WORKING ) +GAME( 1997, prc297wi, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '97 Winter Ver (J 971017 V1.100, set 1)", MACHINE_NOT_WORKING ) // internal string is '97WINTER' +GAME( 1997, prc297wia, prc297wi,stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '97 Winter Ver (J 971017 V1.100, set 2)", MACHINE_NOT_WORKING ) // different program revision, same date code, clearly didn't get updated properly +GAME( 1998, prc298sp, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Spring Ver (J 971017 V1.100)", MACHINE_NOT_WORKING ) // again, dat doesn't appear to have bene updated, this should be early 98 +GAME( 1998, prc298su, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Summer Ver (J 980603 V1.100)", MACHINE_NOT_WORKING ) // again, dat doesn't appear to have bene updated, this should be early 98 +GAME( 1998, prc298au, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Autumn Ver (J 980827 V1.000)", MACHINE_NOT_WORKING ) GAME( 1999, pclubor, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Goukakenran (J 991104 V1.000)", MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From 32780cb7474e26f3a49c2a18fcdf69c83369c070 Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 4 Feb 2016 02:54:30 +0100 Subject: Notes for Night Gal Summer, nw --- src/mame/drivers/nightgal.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 2720f071051..d5357fd051d 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -18,6 +18,25 @@ TODO: -Minor graphic glitches in Royal Queen (cross hatch test, some little glitches during gameplay), presumably due of the unemulated wait states on the comms. + Notes: +-Night Gal Summer accesses the blitter in a weird fashion, perhaps it fails the ROM check + due of address line encryption? + Example snippet: + 0 1 2 3 4 5 6 + RH XX YY WW HH DD + 70 00 40 80 07 06 00 x = 2 y = 3 srcl = 0 srch = 1 srcd = 6 + DD YY RH WW HH XX + 00 60 80 03 07 06 48 x = 6 y = 2 srcl = 1 srch = 3 srcd = 0 + XX DD RH WW HH YY + 50 00 04 28 07 06 80 x = 0 y = 6 srcl = 3 srch = 2 srcd = 1 + YY XX DD WW HH RH + 80 58 10 00 07 06 03 x = 1 y = 0 srcl = 2 srch = 6 srcd = 3 + RH YY DD XX WW HH + 02 80 00 68 07 06 a0 x = 3 y = 1 srcl = 6 srch = 0 srcd = 2 + .. .. .. .. .. + + 48 03 78 80 07 06 00 (again) + *******************************************************************************************/ #include "emu.h" -- cgit v1.2.3-70-g09d2 From 29bef4fb4bd5dca4fdab856f34fd4fa49538c24a Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 4 Feb 2016 03:57:12 +0100 Subject: Added ldax_imm and stax_imm for NCS CPU core, used by Night Gal Summer, nw --- src/devices/cpu/m6800/6800ops.inc | 19 +++++++++++++++++++ src/devices/cpu/m6800/6800tbl.inc | 28 ++++++++++++++++++++++++++-- src/devices/cpu/m6800/m6800.cpp | 4 ++-- src/devices/cpu/m6800/m6800.h | 2 ++ 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/devices/cpu/m6800/6800ops.inc b/src/devices/cpu/m6800/6800ops.inc index cf0360c7538..c9712dca9ff 100644 --- a/src/devices/cpu/m6800/6800ops.inc +++ b/src/devices/cpu/m6800/6800ops.inc @@ -2282,3 +2282,22 @@ OP_HANDLER( stx_ex ) EXTENDED; WM16(EAD,&m_x); } + +/* NCS specific, guessed opcodes (tested by Night Gal Summer) */ +// $bb - load A from [X + $0] +OP_HANDLER( ldax_imm ) +{ + EA=X; + A=RM(EAD); + CLR_NZV; + SET_NZ8(A); +} + +// $00 - store A to [X + $0] +OP_HANDLER( stax_imm ) +{ + CLR_NZV; + SET_NZ8(A); + EA=X; + WM(EAD,A); +} \ No newline at end of file diff --git a/src/devices/cpu/m6800/6800tbl.inc b/src/devices/cpu/m6800/6800tbl.inc index 38376dadd59..c830f9ebe75 100644 --- a/src/devices/cpu/m6800/6800tbl.inc +++ b/src/devices/cpu/m6800/6800tbl.inc @@ -105,30 +105,54 @@ const m6800_cpu_device::op_func m6800_cpu_device::hd63701_insn[0x100] = { }; const m6800_cpu_device::op_func m6800_cpu_device::nsc8105_insn[0x100] = { -&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::nop, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::tap, &m6800_cpu_device::illegal,&m6800_cpu_device::tpa, +// 0 +&m6800_cpu_device::stax_imm,&m6800_cpu_device::illegal,&m6800_cpu_device::nop, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::tap, &m6800_cpu_device::illegal,&m6800_cpu_device::tpa, +// 8 &m6800_cpu_device::inx, &m6800_cpu_device::clv, &m6800_cpu_device::dex, &m6800_cpu_device::sev, &m6800_cpu_device::clc, &m6800_cpu_device::cli, &m6800_cpu_device::sec, &m6800_cpu_device::sei, +// 10 &m6800_cpu_device::sba, &m6800_cpu_device::illegal,&m6800_cpu_device::cba, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::tab, &m6800_cpu_device::illegal,&m6800_cpu_device::tba, +// 18 &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::daa, &m6800_cpu_device::aba, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal, +// 20 &m6800_cpu_device::bra, &m6800_cpu_device::bhi, &m6800_cpu_device::brn, &m6800_cpu_device::bls, &m6800_cpu_device::bcc, &m6800_cpu_device::bne, &m6800_cpu_device::bcs, &m6800_cpu_device::beq, +// 28 &m6800_cpu_device::bvc, &m6800_cpu_device::bpl, &m6800_cpu_device::bvs, &m6800_cpu_device::bmi, &m6800_cpu_device::bge, &m6800_cpu_device::bgt, &m6800_cpu_device::blt, &m6800_cpu_device::ble, +// 30 &m6800_cpu_device::tsx, &m6800_cpu_device::pula, &m6800_cpu_device::ins, &m6800_cpu_device::pulb, &m6800_cpu_device::des, &m6800_cpu_device::psha, &m6800_cpu_device::txs, &m6800_cpu_device::pshb, +// 38 &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::rts, &m6800_cpu_device::rti, &m6800_cpu_device::illegal,&m6800_cpu_device::wai, &m6800_cpu_device::illegal,&m6800_cpu_device::swi, +// 40 &m6800_cpu_device::suba_im,&m6800_cpu_device::sbca_im,&m6800_cpu_device::cmpa_im,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_im,&m6800_cpu_device::lda_im, &m6800_cpu_device::bita_im,&m6800_cpu_device::sta_im, +// 48 &m6800_cpu_device::eora_im,&m6800_cpu_device::ora_im, &m6800_cpu_device::adca_im,&m6800_cpu_device::adda_im,&m6800_cpu_device::cmpx_im,&m6800_cpu_device::lds_im, &m6800_cpu_device::bsr, &m6800_cpu_device::sts_im, +// 50 &m6800_cpu_device::suba_di,&m6800_cpu_device::sbca_di,&m6800_cpu_device::cmpa_di,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_di,&m6800_cpu_device::lda_di, &m6800_cpu_device::bita_di,&m6800_cpu_device::sta_di, +// 58 &m6800_cpu_device::eora_di,&m6800_cpu_device::ora_di, &m6800_cpu_device::adca_di,&m6800_cpu_device::adda_di,&m6800_cpu_device::cmpx_di,&m6800_cpu_device::lds_di, &m6800_cpu_device::jsr_di, &m6800_cpu_device::sts_di, +// 60 &m6800_cpu_device::suba_ix,&m6800_cpu_device::sbca_ix,&m6800_cpu_device::cmpa_ix,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_ix,&m6800_cpu_device::lda_ix, &m6800_cpu_device::bita_ix,&m6800_cpu_device::sta_ix, +// 68 &m6800_cpu_device::eora_ix,&m6800_cpu_device::ora_ix, &m6800_cpu_device::adca_ix,&m6800_cpu_device::adda_ix,&m6800_cpu_device::cmpx_ix,&m6800_cpu_device::lds_ix, &m6800_cpu_device::jsr_ix, &m6800_cpu_device::sts_ix, +// 70 &m6800_cpu_device::suba_ex,&m6800_cpu_device::sbca_ex,&m6800_cpu_device::cmpa_ex,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_ex,&m6800_cpu_device::lda_ex, &m6800_cpu_device::bita_ex,&m6800_cpu_device::sta_ex, +// 78 &m6800_cpu_device::eora_ex,&m6800_cpu_device::ora_ex, &m6800_cpu_device::adca_ex,&m6800_cpu_device::adda_ex,&m6800_cpu_device::cmpx_ex,&m6800_cpu_device::lds_ex, &m6800_cpu_device::jsr_ex, &m6800_cpu_device::sts_ex, +// 80 &m6800_cpu_device::nega, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::coma, &m6800_cpu_device::lsra, &m6800_cpu_device::rora, &m6800_cpu_device::illegal,&m6800_cpu_device::asra, +// 88 &m6800_cpu_device::asla, &m6800_cpu_device::deca, &m6800_cpu_device::rola, &m6800_cpu_device::illegal,&m6800_cpu_device::inca, &m6800_cpu_device::illegal,&m6800_cpu_device::tsta, &m6800_cpu_device::clra, +// 90 &m6800_cpu_device::negb, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::comb, &m6800_cpu_device::lsrb, &m6800_cpu_device::rorb, &m6800_cpu_device::illegal,&m6800_cpu_device::asrb, +// 98 &m6800_cpu_device::aslb, &m6800_cpu_device::decb, &m6800_cpu_device::rolb, &m6800_cpu_device::illegal,&m6800_cpu_device::incb, &m6800_cpu_device::illegal,&m6800_cpu_device::tstb, &m6800_cpu_device::clrb, +// a0 &m6800_cpu_device::neg_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::com_ix, &m6800_cpu_device::lsr_ix, &m6800_cpu_device::ror_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::asr_ix, +// a8 &m6800_cpu_device::asl_ix, &m6800_cpu_device::dec_ix, &m6800_cpu_device::rol_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::inc_ix, &m6800_cpu_device::jmp_ix, &m6800_cpu_device::tst_ix, &m6800_cpu_device::clr_ix, +// b0 &m6800_cpu_device::neg_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::com_ex, &m6800_cpu_device::lsr_ex, &m6800_cpu_device::ror_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::asr_ex, -&m6800_cpu_device::asl_ex, &m6800_cpu_device::dec_ex, &m6800_cpu_device::rol_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::inc_ex, &m6800_cpu_device::jmp_ex, &m6800_cpu_device::tst_ex, &m6800_cpu_device::clr_ex, +// b8 +&m6800_cpu_device::asl_ex, &m6800_cpu_device::dec_ex, &m6800_cpu_device::rol_ex, &m6800_cpu_device::ldax_imm,&m6800_cpu_device::inc_ex, &m6800_cpu_device::jmp_ex, &m6800_cpu_device::tst_ex, &m6800_cpu_device::clr_ex, &m6800_cpu_device::subb_im,&m6800_cpu_device::sbcb_im,&m6800_cpu_device::cmpb_im,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_im,&m6800_cpu_device::ldb_im, &m6800_cpu_device::bitb_im,&m6800_cpu_device::stb_im, &m6800_cpu_device::eorb_im,&m6800_cpu_device::orb_im, &m6800_cpu_device::adcb_im,&m6800_cpu_device::addb_im,&m6800_cpu_device::illegal,&m6800_cpu_device::ldx_im, &m6800_cpu_device::illegal,&m6800_cpu_device::stx_im, &m6800_cpu_device::subb_di,&m6800_cpu_device::sbcb_di,&m6800_cpu_device::cmpb_di,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_di,&m6800_cpu_device::ldb_di, &m6800_cpu_device::bitb_di,&m6800_cpu_device::stb_di, diff --git a/src/devices/cpu/m6800/m6800.cpp b/src/devices/cpu/m6800/m6800.cpp index 84d3b8d03e2..730d7a1be4b 100644 --- a/src/devices/cpu/m6800/m6800.cpp +++ b/src/devices/cpu/m6800/m6800.cpp @@ -488,7 +488,7 @@ const UINT8 m6800_cpu_device::cycles_63701[256] = const UINT8 m6800_cpu_device::cycles_nsc8105[256] = { /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ - /*0*/ XX,XX, 2,XX,XX, 2,XX, 2, 4, 2, 4, 2, 2, 2, 2, 2, + /*0*/ 5,XX, 2,XX,XX, 2,XX, 2, 4, 2, 4, 2, 2, 2, 2, 2, /*1*/ 2,XX, 2,XX,XX, 2,XX, 2,XX,XX, 2, 2,XX,XX,XX,XX, /*2*/ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /*3*/ 4, 4, 4, 4, 4, 4, 4, 4,XX,XX, 5,10,XX, 9,XX,12, @@ -499,7 +499,7 @@ const UINT8 m6800_cpu_device::cycles_nsc8105[256] = /*8*/ 2,XX,XX, 2, 2, 2,XX, 2, 2, 2, 2,XX, 2,XX, 2, 2, /*9*/ 2,XX,XX, 2, 2, 2,XX, 2, 2, 2, 2,XX, 2,XX, 2, 2, /*A*/ 7,XX,XX, 7, 7, 7,XX, 7, 7, 7, 7,XX, 7, 4, 7, 7, - /*B*/ 6,XX,XX, 6, 6, 6,XX, 6, 6, 6, 6,XX, 6, 3, 6, 6, + /*B*/ 6,XX,XX, 6, 6, 6,XX, 6, 6, 6, 6, 5, 6, 3, 6, 6, /*C*/ 2, 2, 2,XX, 2, 2, 2, 3, 2, 2, 2, 2,XX, 3,XX, 4, /*D*/ 3, 3, 3,XX, 3, 3, 3, 4, 3, 3, 3, 3,XX, 4,XX, 5, /*E*/ 5, 5, 5,XX, 5, 5, 5, 6, 5, 5, 5, 5, 5, 6,XX, 7, diff --git a/src/devices/cpu/m6800/m6800.h b/src/devices/cpu/m6800/m6800.h index bb6055e8ad0..a096bd922cd 100644 --- a/src/devices/cpu/m6800/m6800.h +++ b/src/devices/cpu/m6800/m6800.h @@ -426,6 +426,8 @@ protected: void cpx_im(); void cpx_ix(); void trap(); + void ldax_imm(); + void stax_imm(); }; -- cgit v1.2.3-70-g09d2 From 26426914cc9ede54b7542674400a96eb4a0e90a8 Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 4 Feb 2016 04:14:00 +0100 Subject: SCREEN RAW PARAMS for nightgal.cpp, nw --- src/mame/drivers/nightgal.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index d5357fd051d..0afd405d947 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -917,10 +917,7 @@ static MACHINE_CONFIG_START( royalqn, nightgal_state ) /* video hardware */ /* TODO: blitter clock is MASTER_CLOCK / 4, 320 x 264 pixels, 256 x 224 of visible area */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(256, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1) + MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4,320,0,256,264,16,240) MCFG_SCREEN_UPDATE_DRIVER(nightgal_state, screen_update_nightgal) MCFG_SCREEN_PALETTE("palette") -- cgit v1.2.3-70-g09d2 From 039a07bb4d3c32ac66a55637d334056aa5661b6f Mon Sep 17 00:00:00 2001 From: Justin Kerk Date: Thu, 4 Feb 2016 04:35:51 +0000 Subject: Substantial improvements to Web Audio sound backend for Emscripten port. [Grant Galitz] --- scripts/src/main.lua | 2 +- src/osd/modules/sound/js_sound.cpp | 6 +- src/osd/modules/sound/js_sound.js | 213 +++++++++++++++++++++++++++++++++++++ 3 files changed, 217 insertions(+), 4 deletions(-) create mode 100644 src/osd/modules/sound/js_sound.js diff --git a/scripts/src/main.lua b/scripts/src/main.lua index 9623a9d5236..2397a489e00 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -88,7 +88,7 @@ end targetextension ".bc" if os.getenv("EMSCRIPTEN") then postbuildcommands { - os.getenv("EMSCRIPTEN") .. "/emcc -O3 -s DISABLE_EXCEPTION_CATCHING=2 -s USE_SDL=2 --memory-init-file 0 -s ALLOW_MEMORY_GROWTH=0 -s TOTAL_MEMORY=268435456 -s EXCEPTION_CATCHING_WHITELIST='[\"__ZN15running_machine17start_all_devicesEv\"]' -s EXPORTED_FUNCTIONS=\"['_main', '_malloc', '__Z14js_get_machinev', '__Z9js_get_uiv', '__Z12js_get_soundv', '__ZN10ui_manager12set_show_fpsEb', '__ZNK10ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_PauseAudio']\" $(TARGET) -o " .. _MAKE.esc(MAME_DIR) .. _OPTIONS["target"] .. _OPTIONS["subtarget"] .. ".js --post-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/sdl/emscripten_post.js", + os.getenv("EMSCRIPTEN") .. "/emcc -O3 -s DISABLE_EXCEPTION_CATCHING=2 -s USE_SDL=2 --memory-init-file 0 -s ALLOW_MEMORY_GROWTH=0 -s TOTAL_MEMORY=268435456 -s EXCEPTION_CATCHING_WHITELIST='[\"__ZN15running_machine17start_all_devicesEv\"]' -s EXPORTED_FUNCTIONS=\"['_main', '_malloc', '__Z14js_get_machinev', '__Z9js_get_uiv', '__Z12js_get_soundv', '__ZN10ui_manager12set_show_fpsEb', '__ZNK10ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_PauseAudio']\" $(TARGET) -o " .. _MAKE.esc(MAME_DIR) .. _OPTIONS["target"] .. _OPTIONS["subtarget"] .. ".js --pre-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/modules/sound/js_sound.js --post-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/sdl/emscripten_post.js", } end diff --git a/src/osd/modules/sound/js_sound.cpp b/src/osd/modules/sound/js_sound.cpp index bd95c79dd2e..581de205d7b 100644 --- a/src/osd/modules/sound/js_sound.cpp +++ b/src/osd/modules/sound/js_sound.cpp @@ -6,7 +6,7 @@ Shim for native JavaScript sound interface implementations (Emscripten only). -*******************************************************************c********/ +****************************************************************************/ #include "sound_module.h" #include "modules/osdmodule.h" @@ -34,14 +34,14 @@ public: { EM_ASM_ARGS({ // Forward audio stream update on to JS backend implementation. - jsmess_update_audio_stream($0, $1); + jsmame_update_audio_stream($0, $1); }, (unsigned int)buffer, samples_this_frame); } virtual void set_mastervolume(int attenuation) { EM_ASM_ARGS({ // Forward volume update on to JS backend implementation. - jsmess_set_mastervolume($0); + jsmame_set_mastervolume($0); }, attenuation); } diff --git a/src/osd/modules/sound/js_sound.js b/src/osd/modules/sound/js_sound.js new file mode 100644 index 00000000000..393bcd66e93 --- /dev/null +++ b/src/osd/modules/sound/js_sound.js @@ -0,0 +1,213 @@ +// license:BSD-3-Clause +// copyright-holders:Grant Galitz, Katelyn Gadd +/*************************************************************************** + + JSMAME web audio backend v0.3 + + Original by katelyn gadd - kg at luminance dot org ; @antumbral on twitter + Substantial changes by taisel + +***************************************************************************/ + +var jsmame_web_audio = (function () { + +var context = null; +var gain_node = null; +var eventNode = null; +var sampleScale = 32766; +var inputBuffer = new Float32Array(44100); +var bufferSize = 44100; +var start = 0; +var rear = 0; +var watchDogDateLast = null; +var watchDogTimerEvent = null; + +function lazy_init () { + //Make + if (context) { + //Return if already created: + return; + } + if (typeof AudioContext != "undefined") { + //Standard context creation: + context = new AudioContext(); + } + else if (typeof webkitAudioContext != "undefined") { + //Older webkit context creation: + context = new webkitAudioContext(); + } + else { + //API not found! + return; + } + //Generate a volume control node: + gain_node = context.createGain(); + //Set initial volume to 1: + gain_node.gain.value = 1.0; + //Connect volume node to output: + gain_node.connect(context.destination); + //Initialize the streaming event: + init_event(); +}; + +function init_event() { + //Generate a streaming node point: + if (typeof context.createScriptProcessor == "function") { + //Current standard compliant way: + eventNode = context.createScriptProcessor(4096, 0, 2); + } + else { + //Deprecated way: + eventNode = context.createJavaScriptNode(4096, 0, 2); + } + //Make our tick function the audio callback function: + eventNode.onaudioprocess = tick; + //Connect stream to volume control node: + eventNode.connect(gain_node); + //WORKAROUND FOR FIREFOX BUG: + initializeWatchDogForFirefoxBug(); +}; + +function initializeWatchDogForFirefoxBug() { + //TODO: decide if we want to user agent sniff firefox here, + //since Google Chrome doesn't need this: + watchDogDateLast = (new Date()).getTime(); + if (watchDogTimerEvent === null) { + watchDogTimerEvent = setInterval(function () { + var timeDiff = (new Date()).getTime() - watchDogDateLast; + if (timeDiff > 500) { + disconnect_old_event(); + init_event(); + } + }, 500); + } +}; + +function disconnect_old_event() { + //Disconnect from audio graph: + eventNode.disconnect(); + //IIRC there was a firefox bug that did not GC this event when nulling the node itself: + eventNode.onaudioprocess = null; + //Null the glitched/unused node: + eventNode = null; +}; + +function set_mastervolume ( + // even though it's 'attenuation' the value is negative, so... + attenuation_in_decibels +) { + lazy_init(); + if (!context) return; + + // http://stackoverflow.com/questions/22604500/web-audio-api-working-with-decibels + // seemingly incorrect/broken. figures. welcome to Web Audio + // var gain_web_audio = 1.0 - Math.pow(10, 10 / attenuation_in_decibels); + + // HACK: Max attenuation in JSMESS appears to be 32. + // Hit ' then left/right arrow to test. + // FIXME: This is linear instead of log10 scale. + var gain_web_audio = 1.0 + (+attenuation_in_decibels / +32); + if (gain_web_audio < +0) + gain_web_audio = +0; + else if (gain_web_audio > +1) + gain_web_audio = +1; + + gain_node.gain.value = gain_web_audio; +}; + +function update_audio_stream ( + pBuffer, // pointer into emscripten heap. int16 samples + samples_this_frame // int. number of samples at pBuffer address. +) { + lazy_init(); + if (!context) return; + + for ( + var i = 0, + l = samples_this_frame | 0; + i < l; + i++ + ) { + var offset = + // divide by sizeof(INT16) since pBuffer is offset + // in bytes + ((pBuffer / 2) | 0) + + ((i * 2) | 0); + + var left_sample = HEAP16[offset]; + var right_sample = HEAP16[(offset + 1) | 0]; + + // normalize from signed int16 to signed float + var left_sample_float = left_sample / sampleScale; + var right_sample_float = right_sample / sampleScale; + + inputBuffer[rear++] = left_sample_float; + inputBuffer[rear++] = right_sample_float; + if (rear == bufferSize) { + rear = 0; + } + if (start == rear) { + start += 2; + if (start == bufferSize) { + start = 0; + } + } + } +}; +function tick (event) { + //Find all output channels: + for (var bufferCount = 0, buffers = []; bufferCount < 2; ++bufferCount) { + buffers[bufferCount] = event.outputBuffer.getChannelData(bufferCount); + } + //Copy samples from the input buffer to the Web Audio API: + for (var index = 0; index < 4096 && start != rear; ++index) { + buffers[0][index] = inputBuffer[start++]; + buffers[1][index] = inputBuffer[start++]; + if (start == bufferSize) { + start = 0; + } + } + //Pad with silence if we're underrunning: + while (index < 4096) { + buffers[0][index] = 0; + buffers[1][index++] = 0; + } + //Deep inside the bowels of vendors bugs, + //we're using watchdog for a firefox bug, + //where the user agent decides to stop firing events + //if the user agent lags out due to system load. + //Don't even ask.... + watchDogDateLast = (new Date()).getTime(); +} + +function get_context() { + return context; +}; + +function sample_count() { + //TODO get someone to call this from the emulator, + //so the emulator can do proper audio buffering by + //knowing how many samples are left: + if (!context) { + //Use impossible value as an error code: + return -1; + } + var count = rear - start; + if (start > rear) { + count += bufferSize; + } + return count; +} + +return { + set_mastervolume: set_mastervolume, + update_audio_stream: update_audio_stream, + get_context: get_context, + sample_count: sample_count +}; + +})(); + +window.jsmame_set_mastervolume = jsmame_web_audio.set_mastervolume; +window.jsmame_update_audio_stream = jsmame_web_audio.update_audio_stream; +window.jsmame_sample_count = jsmame_web_audio.sample_count; -- cgit v1.2.3-70-g09d2 From ccfa1e3496d9f73a5917f51d98e1fd74cf2e1ce6 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Thu, 4 Feb 2016 15:45:01 +1100 Subject: karatblzbl: fixed save state problem found by Tafoid (nw) --- src/mame/drivers/aerofgt.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/aerofgt.cpp b/src/mame/drivers/aerofgt.cpp index 8cfd233520d..af333697ce9 100644 --- a/src/mame/drivers/aerofgt.cpp +++ b/src/mame/drivers/aerofgt.cpp @@ -1521,8 +1521,8 @@ static MACHINE_CONFIG_START( karatblzbl, aerofgt_state ) MCFG_CPU_ADD("audiocpu",Z80,8000000/2) /* 4 MHz ??? */ MCFG_CPU_PROGRAM_MAP(karatblzbl_sound_map) -// MCFG_MACHINE_START_OVERRIDE(aerofgt_state,aerofgt) -// MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,aerofgt) + MCFG_MACHINE_START_OVERRIDE(aerofgt_state,common) + MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,common) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1552,7 +1552,7 @@ static MACHINE_CONFIG_START( karatblzbl, aerofgt_state ) MCFG_VIDEO_START_OVERRIDE(aerofgt_state,karatblz) /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + //MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") // breaks savestate // NEC D7759c + YM???? MACHINE_CONFIG_END -- cgit v1.2.3-70-g09d2 From 23fd282121ea5c478fa45f3edc868309b85e25fc Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Thu, 4 Feb 2016 13:28:55 +0100 Subject: disound: Don't crash on state load when the mixer is disabled by lack of inputs (misconfiguration or missing samples) [O. Galibert] --- src/emu/disound.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/emu/disound.cpp b/src/emu/disound.cpp index c1f4e49f4b6..7134b588963 100644 --- a/src/emu/disound.cpp +++ b/src/emu/disound.cpp @@ -443,7 +443,10 @@ void device_mixer_interface::interface_pre_start() void device_mixer_interface::interface_post_load() { - m_mixer_stream->set_sample_rate(device().machine().sample_rate()); + // Beware that there's not going to be a mixer stream if there was + // no inputs + if (m_mixer_stream) + m_mixer_stream->set_sample_rate(device().machine().sample_rate()); // call our parent device_sound_interface::interface_post_load(); -- cgit v1.2.3-70-g09d2 From 196e742a77f7719f61318c420e79ae08add25124 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Fri, 5 Feb 2016 01:10:04 +1100 Subject: mc1000: make software list appear in File Manager. --- src/mame/drivers/mc1000.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mame/drivers/mc1000.cpp b/src/mame/drivers/mc1000.cpp index 06c1b177c15..c98f66b601e 100644 --- a/src/mame/drivers/mc1000.cpp +++ b/src/mame/drivers/mc1000.cpp @@ -453,6 +453,7 @@ static MACHINE_CONFIG_START( mc1000, mc1000_state ) /* devices */ MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("mc1000_cass") MCFG_SOFTWARE_LIST_ADD("cass_list", "mc1000_cass") -- cgit v1.2.3-70-g09d2 From 701df7fe9ea4775b25c9d7263592cb3d442e2793 Mon Sep 17 00:00:00 2001 From: Dankan1890 Date: Thu, 4 Feb 2016 14:44:49 +0100 Subject: Initial import of MEWUI to MAME [Dankan1890] --- scripts/src/emu.lua | 46 +- src/emu/cheat.cpp | 16 +- src/emu/cheat.h | 4 +- src/emu/drivers/empty.cpp | 2 +- src/emu/emuopts.cpp | 8 +- src/emu/emuopts.h | 12 +- src/emu/info.cpp | 5 +- src/emu/info.h | 2 +- src/emu/inpttype.h | 20 +- src/emu/ioport.h | 18 + src/emu/machine.cpp | 137 ++- src/emu/machine.h | 12 +- src/emu/mame.cpp | 19 + src/emu/rendfont.cpp | 126 +- src/emu/rendfont.h | 14 +- src/emu/rendutil.cpp | 4 +- src/emu/rendutil.h | 2 +- src/emu/romload.cpp | 4 +- src/emu/ui/auditmenu.cpp | 200 ++++ src/emu/ui/auditmenu.h | 37 + src/emu/ui/cmddata.h | 404 +++++++ src/emu/ui/cmdrender.h | 151 +++ src/emu/ui/ctrlmenu.cpp | 143 +++ src/emu/ui/ctrlmenu.h | 41 + src/emu/ui/custmenu.cpp | 616 ++++++++++ src/emu/ui/custmenu.h | 131 +++ src/emu/ui/custui.cpp | 1049 +++++++++++++++++ src/emu/ui/custui.h | 182 +++ src/emu/ui/datfile.cpp | 642 +++++++++++ src/emu/ui/datfile.h | 79 ++ src/emu/ui/datmenu.cpp | 570 +++++++++ src/emu/ui/datmenu.h | 93 ++ src/emu/ui/defimg.h | 261 +++++ src/emu/ui/dirmenu.cpp | 641 +++++++++++ src/emu/ui/dirmenu.h | 128 ++ src/emu/ui/dsplmenu.cpp | 194 ++++ src/emu/ui/dsplmenu.h | 46 + src/emu/ui/icorender.h | 235 ++++ src/emu/ui/inifile.cpp | 453 ++++++++ src/emu/ui/inifile.h | 122 ++ src/emu/ui/mainmenu.cpp | 112 +- src/emu/ui/mainmenu.h | 11 +- src/emu/ui/menu.cpp | 1906 +++++++++++++++++++++++++++--- src/emu/ui/menu.h | 166 ++- src/emu/ui/miscmenu.cpp | 110 +- src/emu/ui/miscmenu.h | 25 +- src/emu/ui/moptions.cpp | 89 ++ src/emu/ui/moptions.h | 140 +++ src/emu/ui/optsmenu.cpp | 361 ++++++ src/emu/ui/optsmenu.h | 49 + src/emu/ui/selector.cpp | 244 ++++ src/emu/ui/selector.h | 51 + src/emu/ui/selgame.cpp | 2756 +++++++++++++++++++++++++++++++++++++++----- src/emu/ui/selgame.h | 81 +- src/emu/ui/selsoft.cpp | 1974 +++++++++++++++++++++++++++++++ src/emu/ui/selsoft.h | 112 ++ src/emu/ui/sliders.cpp | 4 +- src/emu/ui/sndmenu.cpp | 166 +++ src/emu/ui/sndmenu.h | 42 + src/emu/ui/starimg.h | 37 + src/emu/ui/toolbar.h | 250 ++++ src/emu/ui/ui.cpp | 237 +++- src/emu/ui/ui.h | 203 ++-- src/emu/ui/uicmd14.png | Bin 0 -> 3254 bytes src/emu/ui/utils.cpp | 183 +++ src/emu/ui/utils.h | 367 ++++++ src/emu/uiinput.cpp | 19 +- src/emu/uiinput.h | 4 + src/osd/sdl/input.cpp | 40 +- src/osd/windows/window.cpp | 14 +- 70 files changed, 15862 insertions(+), 760 deletions(-) create mode 100644 src/emu/ui/auditmenu.cpp create mode 100644 src/emu/ui/auditmenu.h create mode 100644 src/emu/ui/cmddata.h create mode 100644 src/emu/ui/cmdrender.h create mode 100644 src/emu/ui/ctrlmenu.cpp create mode 100644 src/emu/ui/ctrlmenu.h create mode 100644 src/emu/ui/custmenu.cpp create mode 100644 src/emu/ui/custmenu.h create mode 100644 src/emu/ui/custui.cpp create mode 100644 src/emu/ui/custui.h create mode 100644 src/emu/ui/datfile.cpp create mode 100644 src/emu/ui/datfile.h create mode 100644 src/emu/ui/datmenu.cpp create mode 100644 src/emu/ui/datmenu.h create mode 100644 src/emu/ui/defimg.h create mode 100644 src/emu/ui/dirmenu.cpp create mode 100644 src/emu/ui/dirmenu.h create mode 100644 src/emu/ui/dsplmenu.cpp create mode 100644 src/emu/ui/dsplmenu.h create mode 100644 src/emu/ui/icorender.h create mode 100644 src/emu/ui/inifile.cpp create mode 100644 src/emu/ui/inifile.h create mode 100644 src/emu/ui/moptions.cpp create mode 100644 src/emu/ui/moptions.h create mode 100644 src/emu/ui/optsmenu.cpp create mode 100644 src/emu/ui/optsmenu.h create mode 100644 src/emu/ui/selector.cpp create mode 100644 src/emu/ui/selector.h create mode 100644 src/emu/ui/selsoft.cpp create mode 100644 src/emu/ui/selsoft.h create mode 100644 src/emu/ui/sndmenu.cpp create mode 100644 src/emu/ui/sndmenu.h create mode 100644 src/emu/ui/starimg.h create mode 100644 src/emu/ui/toolbar.h create mode 100644 src/emu/ui/uicmd14.png create mode 100644 src/emu/ui/utils.cpp create mode 100644 src/emu/ui/utils.h diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index 01e61852d60..1b7492c1760 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -208,8 +208,6 @@ files { MAME_DIR .. "src/emu/ui/info_pty.h", MAME_DIR .. "src/emu/ui/inputmap.cpp", MAME_DIR .. "src/emu/ui/inputmap.h", - MAME_DIR .. "src/emu/ui/selgame.cpp", - MAME_DIR .. "src/emu/ui/selgame.h", MAME_DIR .. "src/emu/ui/sliders.cpp", MAME_DIR .. "src/emu/ui/sliders.h", MAME_DIR .. "src/emu/ui/slotopt.cpp", @@ -222,6 +220,46 @@ files { MAME_DIR .. "src/emu/ui/videoopt.h", MAME_DIR .. "src/emu/ui/viewgfx.cpp", MAME_DIR .. "src/emu/ui/viewgfx.h", + MAME_DIR .. "src/emu/ui/auditmenu.cpp", + MAME_DIR .. "src/emu/ui/auditmenu.h", + MAME_DIR .. "src/emu/ui/cmddata.h", + MAME_DIR .. "src/emu/ui/cmdrender.h", + MAME_DIR .. "src/emu/ui/ctrlmenu.cpp", + MAME_DIR .. "src/emu/ui/ctrlmenu.h", + MAME_DIR .. "src/emu/ui/custmenu.cpp", + MAME_DIR .. "src/emu/ui/custmenu.h", + MAME_DIR .. "src/emu/ui/custui.cpp", + MAME_DIR .. "src/emu/ui/custui.h", + MAME_DIR .. "src/emu/ui/datfile.cpp", + MAME_DIR .. "src/emu/ui/datfile.h", + MAME_DIR .. "src/emu/ui/datmenu.cpp", + MAME_DIR .. "src/emu/ui/datmenu.h", + MAME_DIR .. "src/emu/ui/defimg.h", + MAME_DIR .. "src/emu/ui/dirmenu.cpp", + MAME_DIR .. "src/emu/ui/dirmenu.h", + MAME_DIR .. "src/emu/ui/dsplmenu.cpp", + MAME_DIR .. "src/emu/ui/dsplmenu.h", + MAME_DIR .. "src/emu/ui/icorender.h", + MAME_DIR .. "src/emu/ui/inifile.cpp", + MAME_DIR .. "src/emu/ui/inifile.h", + MAME_DIR .. "src/emu/ui/miscmenu.cpp", + MAME_DIR .. "src/emu/ui/miscmenu.h", + MAME_DIR .. "src/emu/ui/moptions.cpp", + MAME_DIR .. "src/emu/ui/moptions.h", + MAME_DIR .. "src/emu/ui/optsmenu.cpp", + MAME_DIR .. "src/emu/ui/optsmenu.h", + MAME_DIR .. "src/emu/ui/selector.cpp", + MAME_DIR .. "src/emu/ui/selector.h", + MAME_DIR .. "src/emu/ui/selgame.cpp", + MAME_DIR .. "src/emu/ui/selgame.h", + MAME_DIR .. "src/emu/ui/selsoft.cpp", + MAME_DIR .. "src/emu/ui/selsoft.h", + MAME_DIR .. "src/emu/ui/sndmenu.cpp", + MAME_DIR .. "src/emu/ui/sndmenu.h", + MAME_DIR .. "src/emu/ui/starimg.h", + MAME_DIR .. "src/emu/ui/toolbar.h", + MAME_DIR .. "src/emu/ui/utils.cpp", + MAME_DIR .. "src/emu/ui/utils.h", MAME_DIR .. "src/emu/validity.cpp", MAME_DIR .. "src/emu/validity.h", MAME_DIR .. "src/emu/video.cpp", @@ -333,6 +371,7 @@ dependency { -- additional dependencies -------------------------------------------------- { MAME_DIR .. "src/emu/rendfont.cpp", GEN_DIR .. "emu/uismall.fh" }, + { MAME_DIR .. "src/emu/rendfont.cpp", GEN_DIR .. "emu/ui/uicmd14.fh" }, ------------------------------------------------- -- core layouts -------------------------------------------------- @@ -352,7 +391,8 @@ dependency { } custombuildtask { - { MAME_DIR .. "src/emu/uismall.png" , GEN_DIR .. "emu/uismall.fh", { MAME_DIR.. "scripts/build/png2bdc.py", MAME_DIR .. "scripts/build/file2str.py" }, {"@echo Converting uismall.png...", PYTHON .. " $(1) $(<) temp.bdc", PYTHON .. " $(2) temp.bdc $(@) font_uismall UINT8" }}, + { MAME_DIR .. "src/emu/uismall.png" , GEN_DIR .. "emu/uismall.fh", { MAME_DIR.. "scripts/build/png2bdc.py", MAME_DIR .. "scripts/build/file2str.py" }, {"@echo Converting uismall.png...", PYTHON .. " $(1) $(<) temp.bdc", PYTHON .. " $(2) temp.bdc $(@) font_uismall UINT8" }}, + { MAME_DIR .. "src/emu/ui/uicmd14.png" , GEN_DIR .. "emu/ui/uicmd14.fh", { MAME_DIR.. "scripts/build/png2bdc.py", MAME_DIR .. "scripts/build/file2str.py" }, {"@echo Converting uicmd14.png...", PYTHON .. " $(1) $(<) temp_cmd.bdc", PYTHON .. " $(2) temp_cmd.bdc $(@) font_uicmd14 UINT8" }}, layoutbuildtask("emu/layout", "dualhovu"), layoutbuildtask("emu/layout", "dualhsxs"), diff --git a/src/emu/cheat.cpp b/src/emu/cheat.cpp index 16291063985..c055ba5bdb2 100644 --- a/src/emu/cheat.cpp +++ b/src/emu/cheat.cpp @@ -1043,6 +1043,9 @@ cheat_manager::cheat_manager(running_machine &machine) if (!machine.options().cheat()) return; + m_output.resize(UI_TARGET_FONT_ROWS*2); + m_justify.resize(UI_TARGET_FONT_ROWS*2); + // request a callback machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(cheat_manager::frame_update), this)); @@ -1209,7 +1212,7 @@ bool cheat_manager::save_all(const char *filename) void cheat_manager::render_text(render_container &container) { // render any text and free it along the way - for (int linenum = 0; linenum < ARRAY_LENGTH(m_output); linenum++) + for (int linenum = 0; linenum < m_output.size(); linenum++) if (!m_output[linenum].empty()) { // output the text @@ -1337,7 +1340,7 @@ void cheat_manager::frame_update() // set up for accumulating output m_lastline = 0; m_numlines = floor(1.0f / machine().ui().get_line_height()); - m_numlines = MIN(m_numlines, ARRAY_LENGTH(m_output)); + m_numlines = MIN(m_numlines, m_output.size()); for (auto & elem : m_output) elem.clear(); @@ -1358,7 +1361,14 @@ void cheat_manager::frame_update() void cheat_manager::load_cheats(const char *filename) { xml_data_node *rootnode = nullptr; - emu_file cheatfile(machine().options().cheat_path(), OPEN_FLAG_READ); + std::string searchstr(machine().options().cheat_path()); + path_iterator path(searchstr.c_str()); + std::string curpath; + while (path.next(curpath)) + { + searchstr.append(";").append(curpath).append(PATH_SEPARATOR).append("cheat"); + } + emu_file cheatfile(searchstr.c_str(), OPEN_FLAG_READ); try { // open the file with the proper name diff --git a/src/emu/cheat.h b/src/emu/cheat.h index 8e49a8888bb..6badabd14d6 100644 --- a/src/emu/cheat.h +++ b/src/emu/cheat.h @@ -321,8 +321,8 @@ private: running_machine & m_machine; // reference to our machine simple_list m_cheatlist; // cheat list UINT64 m_framecount; // frame count - std::string m_output[UI_TARGET_FONT_ROWS * 2]; // array of output strings - UINT8 m_justify[UI_TARGET_FONT_ROWS*2]; // justification for each string + std::vector m_output; // array of output strings + std::vector m_justify; // justification for each string UINT8 m_numlines; // number of lines available for output INT8 m_lastline; // last line used for output bool m_disabled; // true if the cheat engine is disabled diff --git a/src/emu/drivers/empty.cpp b/src/emu/drivers/empty.cpp index 9c48a6c8b26..97c59887e4e 100644 --- a/src/emu/drivers/empty.cpp +++ b/src/emu/drivers/empty.cpp @@ -29,7 +29,7 @@ public: virtual void machine_start() override { // force the UI to show the game select screen - ui_menu_select_game::force_game_select(machine(), &machine().render().ui_container()); + ui_mewui_select_game::force_game_select(machine(), &machine().render().ui_container()); } UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index af0e790b525..41b9a69fc2b 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -50,7 +50,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_NVRAM_DIRECTORY, "nvram", OPTION_STRING, "directory to save nvram contents" }, { OPTION_INPUT_DIRECTORY, "inp", OPTION_STRING, "directory to save input device logs" }, { OPTION_STATE_DIRECTORY, "sta", OPTION_STRING, "directory to save states" }, - { OPTION_SNAPSHOT_DIRECTORY, "snap", OPTION_STRING, "directory to save screenshots" }, + { OPTION_SNAPSHOT_DIRECTORY, "snap", OPTION_STRING, "directory to save/load screenshots" }, { OPTION_DIFF_DIRECTORY, "diff", OPTION_STRING, "directory to save hard drive image difference files" }, { OPTION_COMMENT_DIRECTORY, "comments", OPTION_STRING, "directory to save debugger comments" }, @@ -181,8 +181,8 @@ const options_entry emu_options::s_option_entries[] = { OPTION_SKIP_GAMEINFO, "0", OPTION_BOOLEAN, "skip displaying the information screen at startup" }, { OPTION_UI_FONT, "default", OPTION_STRING, "specify a font to use" }, { OPTION_RAMSIZE ";ram", nullptr, OPTION_STRING, "size of RAM (if supported by driver)" }, - { OPTION_CONFIRM_QUIT, "0", OPTION_BOOLEAN, "display confirm quit screen on exit" }, - { OPTION_UI_MOUSE, "0", OPTION_BOOLEAN, "display ui mouse cursor" }, + { OPTION_CONFIRM_QUIT, "1", OPTION_BOOLEAN, "display confirm quit screen on exit" }, + { OPTION_UI_MOUSE, "1", OPTION_BOOLEAN, "display ui mouse cursor" }, { OPTION_AUTOBOOT_COMMAND ";ab", nullptr, OPTION_STRING, "command to execute after machine boot" }, { OPTION_AUTOBOOT_DELAY, "2", OPTION_INTEGER, "timer delay in sec to trigger command execution on autoboot" }, { OPTION_AUTOBOOT_SCRIPT ";script", nullptr, OPTION_STRING, "lua script to execute after machine boot" }, @@ -201,7 +201,7 @@ const options_entry emu_options::s_option_entries[] = //------------------------------------------------- emu_options::emu_options() -: core_options() +: mewui_options() , m_coin_impulse(0) , m_joystick_contradictory(false) , m_sleep(true) diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index ea279ca3982..8f72e00144b 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -13,7 +13,8 @@ #ifndef __EMUOPTS_H__ #define __EMUOPTS_H__ -#include "options.h" +#include "ui/moptions.h" + //************************************************************************** // CONSTANTS @@ -26,8 +27,7 @@ enum OPTION_PRIORITY_CMDLINE = OPTION_PRIORITY_HIGH, // INI-based options are NORMAL priority, in increasing order: - OPTION_PRIORITY_INI = OPTION_PRIORITY_NORMAL, - OPTION_PRIORITY_MAME_INI, + OPTION_PRIORITY_MAME_INI = OPTION_PRIORITY_NORMAL, OPTION_PRIORITY_DEBUG_INI, OPTION_PRIORITY_ORIENTATION_INI, OPTION_PRIORITY_SYSTYPE_INI, @@ -35,7 +35,8 @@ enum OPTION_PRIORITY_SOURCE_INI, OPTION_PRIORITY_GPARENT_INI, OPTION_PRIORITY_PARENT_INI, - OPTION_PRIORITY_DRIVER_INI + OPTION_PRIORITY_DRIVER_INI, + OPTION_PRIORITY_INI }; // core options @@ -200,7 +201,7 @@ struct game_driver; class software_part; -class emu_options : public core_options +class emu_options : public mewui_options { static const UINT32 OPTION_FLAG_DEVICE = 0x80000000; @@ -373,6 +374,7 @@ public: std::string sub_value(const char *name, const char *subname) const; bool add_slot_options(const software_part *swpart = nullptr); + private: // device-specific option handling void add_device_options(); diff --git a/src/emu/info.cpp b/src/emu/info.cpp index 4bae0daf37a..21c98853adc 100644 --- a/src/emu/info.cpp +++ b/src/emu/info.cpp @@ -188,7 +188,7 @@ info_xml_creator::info_xml_creator(driver_enumerator &drivlist) // for all known games //------------------------------------------------- -void info_xml_creator::output(FILE *out) +void info_xml_creator::output(FILE *out, bool nodevices) { m_output = out; @@ -218,7 +218,8 @@ void info_xml_creator::output(FILE *out) output_one(); // output devices (both devices with roms and slot devices) - output_devices(); + if (!nodevices) + output_devices(); // close the top level tag fprintf(m_output, "\n",emulator_info::get_xml_root()); diff --git a/src/emu/info.h b/src/emu/info.h index 0607acf9d7e..78082ec033b 100644 --- a/src/emu/info.h +++ b/src/emu/info.h @@ -28,7 +28,7 @@ public: info_xml_creator(driver_enumerator &drivlist); // output - void output(FILE *out); + void output(FILE *out, bool nodevices = false); private: // internal helper diff --git a/src/emu/inpttype.h b/src/emu/inpttype.h index 7a07ea777b6..d927680ab4d 100644 --- a/src/emu/inpttype.h +++ b/src/emu/inpttype.h @@ -716,7 +716,8 @@ void construct_core_types_UI(simple_list &typelist) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_ON_SCREEN_DISPLAY,"On Screen Display", input_seq(KEYCODE_TILDE) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DEBUG_BREAK, "Break in Debugger", input_seq(KEYCODE_TILDE) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_CONFIGURE, "Config Menu", input_seq(KEYCODE_TAB) ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PAUSE, "Pause", input_seq(KEYCODE_P) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PAUSE, "Pause", input_seq(KEYCODE_P, input_seq::not_code, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_RSHIFT) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PAUSE_SINGLE, "Pause - Single Step", input_seq(KEYCODE_P, KEYCODE_LSHIFT, input_seq::or_code, KEYCODE_P, KEYCODE_RSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RESET_MACHINE, "Reset Game", input_seq(KEYCODE_F3, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SOFT_RESET, "Soft Reset", input_seq(KEYCODE_F3, input_seq::not_code, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SHOW_GFX, "Show Gfx", input_seq(KEYCODE_F4) ) @@ -731,7 +732,7 @@ void construct_core_types_UI(simple_list &typelist) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP, "UI Up", input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN, "UI Down", input_seq(KEYCODE_DOWN, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0)) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LEFT, "UI Left", input_seq(KEYCODE_LEFT, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(0)) ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RIGHT, "UI Right", input_seq(KEYCODE_RIGHT, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(0)) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RIGHT, "UI Right", input_seq(KEYCODE_RIGHT, input_seq::not_code, KEYCODE_LCONTROL, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(0), input_seq::not_code, KEYCODE_LCONTROL) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_HOME, "UI Home", input_seq(KEYCODE_HOME) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_END, "UI End", input_seq(KEYCODE_END) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PAGE_UP, "UI Page Up", input_seq(KEYCODE_PGUP) ) @@ -753,6 +754,21 @@ void construct_core_types_UI(simple_list &typelist) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LOAD_STATE, "Load State", input_seq(KEYCODE_F7, input_seq::not_code, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TAPE_START, "UI (First) Tape Start", input_seq(KEYCODE_F2, input_seq::not_code, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TAPE_STOP, "UI (First) Tape Stop", input_seq(KEYCODE_F2, KEYCODE_LSHIFT) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_HISTORY, "UI Show History", input_seq(KEYCODE_LALT, KEYCODE_H) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_MAMEINFO, "UI Show Mame/Messinfo", input_seq(KEYCODE_LALT, KEYCODE_M) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_COMMAND, "UI Show Command Info", input_seq(KEYCODE_LALT, KEYCODE_C) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SYSINFO, "UI Show Sysinfo", input_seq(KEYCODE_LALT, KEYCODE_S) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_FAVORITES, "UI Add/Remove favorites",input_seq(KEYCODE_LALT, KEYCODE_F) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_STORY, "UI Show Story.dat", input_seq(KEYCODE_LALT, KEYCODE_T) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP_FILTER, NULL, input_seq() ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN_FILTER, NULL, input_seq() ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LEFT_PANEL, NULL, input_seq() ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RIGHT_PANEL, "UI Right switch image/info", input_seq(KEYCODE_RIGHT, KEYCODE_LCONTROL) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP_PANEL, NULL, input_seq() ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN_PANEL, NULL, input_seq() ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_EXPORT, "UI Export list to xml", input_seq(KEYCODE_LALT, KEYCODE_E) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_AUDIT_FAST, "UI Audit Unavailable", input_seq(KEYCODE_F1, input_seq::not_code, KEYCODE_LSHIFT) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_AUDIT_ALL, "UI Audit All", input_seq(KEYCODE_F1, KEYCODE_LSHIFT) ) } void construct_core_types_OSD(simple_list &typelist) diff --git a/src/emu/ioport.h b/src/emu/ioport.h index 89bd9e6964e..c2c861d3320 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -333,6 +333,7 @@ enum ioport_type IPT_UI_ON_SCREEN_DISPLAY, IPT_UI_DEBUG_BREAK, IPT_UI_PAUSE, + IPT_UI_PAUSE_SINGLE, IPT_UI_RESET_MACHINE, IPT_UI_SOFT_RESET, IPT_UI_SHOW_GFX, @@ -370,6 +371,23 @@ enum ioport_type IPT_UI_TAPE_START, IPT_UI_TAPE_STOP, + // additional MEWUI options + IPT_UI_HISTORY, + IPT_UI_MAMEINFO, + IPT_UI_COMMAND, + IPT_UI_SYSINFO, + IPT_UI_FAVORITES, + IPT_UI_STORY, + IPT_UI_UP_FILTER, + IPT_UI_DOWN_FILTER, + IPT_UI_LEFT_PANEL, + IPT_UI_RIGHT_PANEL, + IPT_UI_UP_PANEL, + IPT_UI_DOWN_PANEL, + IPT_UI_EXPORT, + IPT_UI_AUDIT_FAST, + IPT_UI_AUDIT_ALL, + // additional OSD-specified UI port types (up to 16) IPT_OSD_1, IPT_OSD_2, diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index a80a9c1aa74..500a03ba9af 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -2,69 +2,69 @@ // copyright-holders:Aaron Giles /*************************************************************************** - machine.c + machine.c - Controls execution of the core MAME system. + Controls execution of the core MAME system. **************************************************************************** - Since there has been confusion in the past over the order of - initialization and other such things, here it is, all spelled out - as of January, 2008: - - main() - - does platform-specific init - - calls mame_execute() [mame.c] - - mame_execute() [mame.c] - - calls mame_validitychecks() [validity.c] to perform validity checks on all compiled drivers - - begins resource tracking (level 1) - - calls create_machine [mame.c] to initialize the running_machine structure - - calls init_machine() [mame.c] - - init_machine() [mame.c] - - calls fileio_init() [fileio.c] to initialize file I/O info - - calls config_init() [config.c] to initialize configuration system - - calls input_init() [input.c] to initialize the input system - - calls output_init() [output.c] to initialize the output system - - calls state_init() [state.c] to initialize save state system - - calls state_save_allow_registration() [state.c] to allow registrations - - calls palette_init() [palette.c] to initialize palette system - - calls render_init() [render.c] to initialize the rendering system - - calls ui_init() [ui.c] to initialize the user interface - - calls generic_machine_init() [machine/generic.c] to initialize generic machine structures - - calls timer_init() [timer.c] to reset the timer system - - calls osd_init() [osdepend.h] to do platform-specific initialization - - calls input_port_init() [inptport.c] to set up the input ports - - calls rom_init() [romload.c] to load the game's ROMs - - calls memory_init() [memory.c] to process the game's memory maps - - calls the driver's DRIVER_INIT callback - - calls device_list_start() [devintrf.c] to start any devices - - calls video_init() [video.c] to start the video system - - calls tilemap_init() [tilemap.c] to start the tilemap system - - calls crosshair_init() [crsshair.c] to configure the crosshairs - - calls sound_init() [sound.c] to start the audio system - - calls debugger_init() [debugger.c] to set up the debugger - - calls the driver's MACHINE_START, SOUND_START, and VIDEO_START callbacks - - calls cheat_init() [cheat.c] to initialize the cheat system - - calls image_init() [image.c] to initialize the image system - - - calls config_load_settings() [config.c] to load the configuration file - - calls nvram_load [machine/generic.c] to load NVRAM - - calls ui_display_startup_screens() [ui.c] to display the startup screens - - begins resource tracking (level 2) - - calls soft_reset() [mame.c] to reset all systems - - -------------------( at this point, we're up and running )---------------------- - - - calls scheduler->timeslice() [schedule.c] over and over until we exit - - ends resource tracking (level 2), freeing all auto_mallocs and timers - - calls the nvram_save() [machine/generic.c] to save NVRAM - - calls config_save_settings() [config.c] to save the game's configuration - - calls all registered exit routines [mame.c] - - ends resource tracking (level 1), freeing all auto_mallocs and timers - - - exits the program + Since there has been confusion in the past over the order of + initialization and other such things, here it is, all spelled out + as of January, 2008: + + main() + - does platform-specific init + - calls mame_execute() [mame.c] + + mame_execute() [mame.c] + - calls mame_validitychecks() [validity.c] to perform validity checks on all compiled drivers + - begins resource tracking (level 1) + - calls create_machine [mame.c] to initialize the running_machine structure + - calls init_machine() [mame.c] + + init_machine() [mame.c] + - calls fileio_init() [fileio.c] to initialize file I/O info + - calls config_init() [config.c] to initialize configuration system + - calls input_init() [input.c] to initialize the input system + - calls output_init() [output.c] to initialize the output system + - calls state_init() [state.c] to initialize save state system + - calls state_save_allow_registration() [state.c] to allow registrations + - calls palette_init() [palette.c] to initialize palette system + - calls render_init() [render.c] to initialize the rendering system + - calls ui_init() [ui.c] to initialize the user interface + - calls generic_machine_init() [machine/generic.c] to initialize generic machine structures + - calls timer_init() [timer.c] to reset the timer system + - calls osd_init() [osdepend.h] to do platform-specific initialization + - calls input_port_init() [inptport.c] to set up the input ports + - calls rom_init() [romload.c] to load the game's ROMs + - calls memory_init() [memory.c] to process the game's memory maps + - calls the driver's DRIVER_INIT callback + - calls device_list_start() [devintrf.c] to start any devices + - calls video_init() [video.c] to start the video system + - calls tilemap_init() [tilemap.c] to start the tilemap system + - calls crosshair_init() [crsshair.c] to configure the crosshairs + - calls sound_init() [sound.c] to start the audio system + - calls debugger_init() [debugger.c] to set up the debugger + - calls the driver's MACHINE_START, SOUND_START, and VIDEO_START callbacks + - calls cheat_init() [cheat.c] to initialize the cheat system + - calls image_init() [image.c] to initialize the image system + + - calls config_load_settings() [config.c] to load the configuration file + - calls nvram_load [machine/generic.c] to load NVRAM + - calls ui_display_startup_screens() [ui.c] to display the startup screens + - begins resource tracking (level 2) + - calls soft_reset() [mame.c] to reset all systems + + -------------------( at this point, we're up and running )---------------------- + + - calls scheduler->timeslice() [schedule.c] over and over until we exit + - ends resource tracking (level 2), freeing all auto_mallocs and timers + - calls the nvram_save() [machine/generic.c] to save NVRAM + - calls config_save_settings() [config.c] to save the game's configuration + - calls all registered exit routines [mame.c] + - ends resource tracking (level 1), freeing all auto_mallocs and timers + + - exits the program ***************************************************************************/ @@ -78,6 +78,8 @@ #include "uiinput.h" #include "crsshair.h" #include "unzip.h" +#include "ui/datfile.h" +#include "ui/inifile.h" #include "debug/debugvw.h" #include "image.h" #include "luaengine.h" @@ -229,6 +231,9 @@ void running_machine::start() // init the osd layer m_manager.osd().init(*this); + // start the inifile manager + m_inifile = std::make_unique(*this); + // create the video manager m_video = std::make_unique(*this); m_ui = std::make_unique(*this); @@ -305,6 +310,12 @@ void running_machine::start() // allocate autoboot timer m_autoboot_timer = scheduler().timer_alloc(timer_expired_delegate(FUNC(running_machine::autoboot_callback), this)); + // start datfile manager + m_datfile = std::make_unique(*this); + + // start favorite manager + m_favorite = std::make_unique(*this); + manager().update_machine(); } @@ -1309,12 +1320,12 @@ void system_time::full_time::set(struct tm &t) { second = t.tm_sec; minute = t.tm_min; - hour = t.tm_hour; - mday = t.tm_mday; + hour = t.tm_hour; + mday = t.tm_mday; month = t.tm_mon; - year = t.tm_year + 1900; + year = t.tm_year + 1900; weekday = t.tm_wday; - day = t.tm_yday; + day = t.tm_yday; is_dst = t.tm_isdst; } diff --git a/src/emu/machine.h b/src/emu/machine.h index 24b0840c93d..613e62b505e 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -95,8 +95,10 @@ class image_manager; class rom_load_manager; class debugger_manager; class osd_interface; +class datfile_manager; enum class config_type; - +class inifile_manager; +class favorite_manager; struct debugcpu_private; @@ -165,6 +167,9 @@ public: ioport_manager &ioport() { return m_ioport; } parameters_manager ¶meters() { return m_parameters; } cheat_manager &cheat() const { assert(m_cheat != nullptr); return *m_cheat; } + datfile_manager &datfile() const { assert(m_datfile != nullptr); return *m_datfile; } + inifile_manager &inifile() const { assert(m_inifile != nullptr); return *m_inifile; } + favorite_manager &favorite() const { assert(m_favorite != nullptr); return *m_favorite; } render_manager &render() const { assert(m_render != nullptr); return *m_render; } input_manager &input() const { assert(m_input != nullptr); return *m_input; } sound_manager &sound() const { assert(m_sound != nullptr); return *m_sound; } @@ -363,7 +368,10 @@ private: parameters_manager m_parameters; // parameters manager device_scheduler m_scheduler; // scheduler object emu_timer *m_autoboot_timer; // autoboot timer -}; + std::unique_ptr m_datfile; // internal data from datfile.c + std::unique_ptr m_inifile; // internal data from inifile.c for INIs + std::unique_ptr m_favorite; // internal data from inifile.c for favorites +}; #endif /* __MACHINE_H__ */ diff --git a/src/emu/mame.cpp b/src/emu/mame.cpp index e18e41329ad..f17c04e3b68 100644 --- a/src/emu/mame.cpp +++ b/src/emu/mame.cpp @@ -231,6 +231,25 @@ int machine_manager::execute() m_options.set_value(OPTION_RAMSIZE, "", OPTION_PRIORITY_CMDLINE, error_string); } firstrun = true; + if (m_options.software_name()) + { + std::string sw_load(m_options.software_name()); + std::string sw_list, sw_name, sw_part, sw_instance, option_errors, error_string; + int left = sw_load.find_first_of(':'); + int middle = sw_load.find_first_of(':', left + 1); + int right = sw_load.find_last_of(':'); + + sw_list = sw_load.substr(0, left - 1); + sw_name = sw_load.substr(left + 1, middle - left - 1); + sw_part = sw_load.substr(middle + 1, right - middle - 1); + sw_instance = sw_load.substr(right + 1); + sw_load.assign(sw_load.substr(0, right)); + + char arg[] = "ume"; + char *argv = &arg[0]; + m_options.set_value(OPTION_SOFTWARENAME, sw_name.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + m_options.parse_slot_devices(1, &argv, option_errors, sw_instance.c_str(), sw_load.c_str()); + } } else { diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp index 63ff7dc47de..89c174c31bf 100644 --- a/src/emu/rendfont.cpp +++ b/src/emu/rendfont.cpp @@ -16,6 +16,7 @@ #include "osdepend.h" #include "uismall.fh" +#include "ui/cmdrender.h" //************************************************************************** // INLINE FUNCTIONS @@ -55,12 +56,51 @@ inline render_font::glyph &render_font::get_char(unicode_char chnum) if (!m_glyphs[chnum / 256] && m_format == FF_OSD) m_glyphs[chnum / 256] = new glyph[256]; if (!m_glyphs[chnum / 256]) - return dummy_glyph; + { + //mamep: make table for command glyph + if (chnum >= COMMAND_UNICODE && chnum < COMMAND_UNICODE + MAX_GLYPH_FONT) + m_glyphs[chnum / 256] = new glyph[256]; + else + return dummy_glyph; + } // if the character isn't generated yet, do it now glyph &gl = m_glyphs[chnum / 256][chnum % 256]; if (!gl.bitmap.valid()) - char_expand(chnum, gl); + { + //mamep: command glyph support + if (m_height_cmd && chnum >= COMMAND_UNICODE && chnum < COMMAND_UNICODE + MAX_GLYPH_FONT) + { + glyph &glyph_ch = m_glyphs_cmd[chnum / 256][chnum % 256]; + float scale = (float)m_height / (float)m_height_cmd; + if (m_format == FF_OSD) scale *= 0.90f; + + if (!glyph_ch.bitmap.valid()) + char_expand(chnum, glyph_ch); + + //mamep: for color glyph + gl.color = glyph_ch.color; + + gl.width = (int)(glyph_ch.width * scale + 0.5f); + gl.xoffs = (int)(glyph_ch.xoffs * scale + 0.5f); + gl.yoffs = (int)(glyph_ch.yoffs * scale + 0.5f); + gl.bmwidth = (int)(glyph_ch.bmwidth * scale + 0.5f); + gl.bmheight = (int)(glyph_ch.bmheight * scale + 0.5f); + + gl.bitmap.allocate(gl.bmwidth, gl.bmheight); + rectangle clip; + clip.min_x = clip.min_y = 0; + clip.max_x = glyph_ch.bitmap.width() - 1; + clip.max_y = glyph_ch.bitmap.height() - 1; + render_texture::hq_scale(gl.bitmap, glyph_ch.bitmap, clip, nullptr); + + /* wrap a texture around the bitmap */ + gl.texture = m_manager.texture_alloc(render_texture::hq_scale); + gl.texture->set_bitmap(gl.bitmap, gl.bitmap.cliprect(), TEXFORMAT_ARGB32); + } + else + char_expand(chnum, gl); + } // return the resulting character return gl; @@ -83,9 +123,12 @@ render_font::render_font(render_manager &manager, const char *filename) m_yoffs(0), m_scale(1.0f), m_rawsize(0), - m_osdfont(nullptr) + m_osdfont(nullptr), + m_height_cmd(0), + m_yoffs_cmd(0) { memset(m_glyphs, 0, sizeof(m_glyphs)); + memset(m_glyphs_cmd, 0, sizeof(m_glyphs_cmd)); // if this is an OSD font, we're done if (filename != nullptr) @@ -95,10 +138,13 @@ render_font::render_font(render_manager &manager, const char *filename) { if (m_osdfont->open(manager.machine().options().font_path(), filename, m_height)) { - m_scale = 1.0f / (float)m_height; - m_format = FF_OSD; - return; - } + m_scale = 1.0f / (float)m_height; + m_format = FF_OSD; + + //mamep: allocate command glyph font + render_font_command_glyph(); + return; + } global_free(m_osdfont); m_osdfont = nullptr; } @@ -110,13 +156,18 @@ render_font::render_font(render_manager &manager, const char *filename) // attempt to load the cached version of the font first if (filename != nullptr && load_cached_bdf(filename)) - return; + { + //mamep: allocate command glyph font + render_font_command_glyph(); + return; + } // load the raw data instead emu_file ramfile(OPEN_FLAG_READ); file_error filerr = ramfile.open_ram(font_uismall, sizeof(font_uismall)); if (filerr == FILERR_NONE) load_cached(ramfile, 0); + render_font_command_glyph(); } @@ -138,6 +189,17 @@ render_font::~render_font() delete[] elem; } + for (auto & elem : m_glyphs_cmd) + if (elem) + { + for (unsigned int charnum = 0; charnum < 256; charnum++) + { + glyph &gl = elem[charnum]; + m_manager.texture_free(gl.texture); + } + delete[] elem; + } + // release the OSD font if (m_osdfont != nullptr) { @@ -154,8 +216,43 @@ render_font::~render_font() void render_font::char_expand(unicode_char chnum, glyph &gl) { + rgb_t color = rgb_t(0xff,0xff,0xff,0xff); + bool is_cmd = (chnum >= COMMAND_UNICODE && chnum < COMMAND_UNICODE + MAX_GLYPH_FONT); + + if (gl.color) + color = gl.color; + + if (is_cmd) + { + // punt if nothing there + if (gl.bmwidth == 0 || gl.bmheight == 0 || gl.rawdata == nullptr) + return; + + // allocate a new bitmap of the size we need + gl.bitmap.allocate(gl.bmwidth, m_height_cmd); + gl.bitmap.fill(0); + + // extract the data + const char *ptr = gl.rawdata; + UINT8 accum = 0, accumbit = 7; + for (int y = 0; y < gl.bmheight; y++) + { + int desty = y + m_height_cmd + m_yoffs_cmd - gl.yoffs - gl.bmheight; + UINT32 *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix32(desty, 0) : nullptr; + { + for (int x = 0; x < gl.bmwidth; x++) + { + if (accumbit == 7) + accum = *ptr++; + if (dest != nullptr) + *dest++ = (accum & (1 << accumbit)) ? color : rgb_t(0x00,0xff,0xff,0xff); + accumbit = (accumbit - 1) & 7; + } + } + } + } // if we're an OSD font, query the info - if (m_format == FF_OSD) + else if (m_format == FF_OSD) { // we set bmwidth to -1 if we've previously queried and failed if (gl.bmwidth == -1) @@ -173,7 +270,6 @@ void render_font::char_expand(unicode_char chnum, glyph &gl) gl.bmwidth = gl.bitmap.width(); gl.bmheight = gl.bitmap.height(); } - // other formats need to parse their data else { @@ -216,10 +312,10 @@ void render_font::char_expand(unicode_char chnum, glyph &gl) // expand the four bits if (dest != nullptr) { - *dest++ = (bits & 8) ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff); - *dest++ = (bits & 4) ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff); - *dest++ = (bits & 2) ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff); - *dest++ = (bits & 1) ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff); + *dest++ = (bits & 8) ? color : rgb_t(0x00,0xff,0xff,0xff); + *dest++ = (bits & 4) ? color : rgb_t(0x00,0xff,0xff,0xff); + *dest++ = (bits & 2) ? color : rgb_t(0x00,0xff,0xff,0xff); + *dest++ = (bits & 1) ? color : rgb_t(0x00,0xff,0xff,0xff); } } @@ -235,7 +331,7 @@ void render_font::char_expand(unicode_char chnum, glyph &gl) if (accumbit == 7) accum = *ptr++; if (dest != nullptr) - *dest++ = (accum & (1 << accumbit)) ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff); + *dest++ = (accum & (1 << accumbit)) ? color : rgb_t(0x00,0xff,0xff,0xff); accumbit = (accumbit - 1) & 7; } } diff --git a/src/emu/rendfont.h b/src/emu/rendfont.h index aced202260d..1f05babd789 100644 --- a/src/emu/rendfont.h +++ b/src/emu/rendfont.h @@ -65,6 +65,9 @@ private: const char * rawdata; // pointer to the raw data for this one render_texture * texture; // pointer to a texture for rendering and sizing bitmap_argb32 bitmap; // pointer to the bitmap containing the raw data + + rgb_t color; + }; // internal format @@ -82,8 +85,11 @@ private: bool load_cached_bdf(const char *filename); bool load_bdf(); bool load_cached(emu_file &file, UINT32 hash); + bool load_cached_cmd(emu_file &file, UINT32 hash); bool save_cached(const char *filename, UINT32 hash); + void render_font_command_glyph(); + // internal state render_manager & m_manager; format m_format; // format of font data @@ -93,7 +99,12 @@ private: glyph *m_glyphs[256]; // array of glyph subtables std::vector m_rawdata; // pointer to the raw data for the font UINT64 m_rawsize; // size of the raw font data - osd_font *m_osdfont; // handle to the OSD font + osd_font *m_osdfont; // handle to the OSD font + + int m_height_cmd; // height of the font, from ascent to descent + int m_yoffs_cmd; // y offset from baseline to descent + glyph *m_glyphs_cmd[256]; // array of glyph subtables + std::vector m_rawdata_cmd; // pointer to the raw data for the font // constants static const int CACHED_CHAR_SIZE = 12; @@ -101,5 +112,6 @@ private: static const int CACHED_BDF_HASH_SIZE = 1024; }; +void convert_command_glyph(std::string &s); #endif /* __RENDFONT_H__ */ diff --git a/src/emu/rendutil.cpp b/src/emu/rendutil.cpp index 1a487536455..6d0bde63adb 100644 --- a/src/emu/rendutil.cpp +++ b/src/emu/rendutil.cpp @@ -35,7 +35,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info *png) quality resampling of a texture -------------------------------------------------*/ -void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, const render_color &color) +void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, const render_color &color, bool force) { if (dest.width() == 0 || dest.height() == 0) return; @@ -52,7 +52,7 @@ void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, UINT32 dy = (sheight << 12) / dheight; /* if the source is higher res than the target, use full averaging */ - if (dx > 0x1000 || dy > 0x1000) + if (dx > 0x1000 || dy > 0x1000 || force) resample_argb_bitmap_average(&dest.pix(0), dest.rowpixels(), dwidth, dheight, sbase, source.rowpixels(), swidth, sheight, color, dx, dy); else resample_argb_bitmap_bilinear(&dest.pix(0), dest.rowpixels(), dwidth, dheight, sbase, source.rowpixels(), swidth, sheight, color, dx, dy); diff --git a/src/emu/rendutil.h b/src/emu/rendutil.h index d992d35d88c..34a9c2ef75c 100644 --- a/src/emu/rendutil.h +++ b/src/emu/rendutil.h @@ -21,7 +21,7 @@ /* ----- render utilities ----- */ -void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, const render_color &color); +void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, const render_color &color, bool force = false); int render_clip_line(render_bounds *bounds, const render_bounds *clip); int render_clip_quad(render_bounds *bounds, const render_bounds *clip, render_quad_texuv *texcoords); void render_line_to_quad(const render_bounds *bounds, float width, render_bounds *bounds0, render_bounds *bounds1); diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index 28cc994402c..e33df543fbb 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -302,8 +302,8 @@ void rom_load_manager::determine_bios_rom(device_t *device, const char *specbios /* if we got neither an empty string nor 'default' then warn the user */ if (specbios[0] != 0 && strcmp(specbios, "default") != 0) { - strcatprintf(m_errorstring, "%s: invalid bios\n", specbios); - m_errors++; + strcatprintf(m_errorstring, "%s: invalid bios, reverting to default\n", specbios); + m_warnings++; } /* set to default */ diff --git a/src/emu/ui/auditmenu.cpp b/src/emu/ui/auditmenu.cpp new file mode 100644 index 00000000000..631355bfac3 --- /dev/null +++ b/src/emu/ui/auditmenu.cpp @@ -0,0 +1,200 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/********************************************************************* + + mewui/auditmenu.cpp + + Internal MEWUI user interface. + +*********************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "audit.h" +#include "ui/auditmenu.h" +#include + +extern const char MEWUI_VERSION_TAG[]; + +//------------------------------------------------- +// sort +//------------------------------------------------- + +inline int cs_stricmp(const char *s1, const char *s2) +{ + for (;;) + { + int c1 = tolower((UINT8)*s1++); + int c2 = tolower((UINT8)*s2++); + if (c1 == 0 || c1 != c2) + return c1 - c2; + } +} + +bool sorted_game_list(const game_driver *x, const game_driver *y) +{ + bool clonex = strcmp(x->parent, "0"); + bool cloney = strcmp(y->parent, "0"); + + if (!clonex && !cloney) + return (cs_stricmp(x->description, y->description) < 0); + + int cx = -1, cy = -1; + if (clonex) + { + cx = driver_list::find(x->parent); + if (cx == -1 || (driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0) + clonex = false; + } + + if (cloney) + { + cy = driver_list::find(y->parent); + if (cy == -1 || (driver_list::driver(cy).flags & MACHINE_IS_BIOS_ROOT) != 0) + cloney = false; + } + + if (!clonex && !cloney) + return (cs_stricmp(x->description, y->description) < 0); + else if (clonex && cloney) + { + if (!cs_stricmp(x->parent, y->parent)) + return (cs_stricmp(x->description, y->description) < 0); + else + return (cs_stricmp(driver_list::driver(cx).description, driver_list::driver(cy).description) < 0); + } + else if (!clonex && cloney) + { + if (!cs_stricmp(x->name, y->parent)) + return true; + else + return (cs_stricmp(x->description, driver_list::driver(cy).description) < 0); + } + else + { + if (!cs_stricmp(x->parent, y->name)) + return false; + else + return (cs_stricmp(driver_list::driver(cx).description, y->description) < 0); + } +} + +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_audit::ui_menu_audit(running_machine &machine, render_container *container, std::vector &availablesorted, std::vector &unavailablesorted, int _audit_mode) + : ui_menu(machine, container), m_availablesorted(availablesorted), m_unavailablesorted(unavailablesorted), m_audit_mode(_audit_mode), m_first(true) +{ + if (m_audit_mode == 2) + { + m_availablesorted.clear(); + m_unavailablesorted.clear(); + } +} + +ui_menu_audit::~ui_menu_audit() +{ +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_audit::handle() +{ + process(UI_MENU_PROCESS_CUSTOM_ONLY); + + if (m_first) + { + machine().ui().draw_text_box(container, "Audit in progress...", JUSTIFY_CENTER, 0.5f, 0.5f, UI_GREEN_COLOR); + m_first = false; + return; + } + + if (m_audit_mode == 1) + { + std::vector::iterator iter = m_unavailablesorted.begin(); + while (iter != m_unavailablesorted.end()) + { + driver_enumerator enumerator(machine().options(), (*iter)->name); + enumerator.next(); + media_auditor auditor(enumerator); + media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST); + + // if everything looks good, include the driver + if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + { + m_availablesorted.push_back((*iter)); + iter = m_unavailablesorted.erase(iter); + } + else + ++iter; + } + } + else + { + driver_enumerator enumerator(machine().options()); + media_auditor auditor(enumerator); + while (enumerator.next()) + { + media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST); + + // if everything looks good, include the driver + if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + m_availablesorted.push_back(&enumerator.driver()); + else + m_unavailablesorted.push_back(&enumerator.driver()); + } + } + + // sort + std::stable_sort(m_availablesorted.begin(), m_availablesorted.end(), sorted_game_list); + std::stable_sort(m_unavailablesorted.begin(), m_unavailablesorted.end(), sorted_game_list); + save_available_machines(); + ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST); + ui_menu::stack_pop(machine()); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_audit::populate() +{ + item_append("Dummy", nullptr, 0, (void *)(FPTR)1); +} + +//------------------------------------------------- +// save drivers infos to file +//------------------------------------------------- + +void ui_menu_audit::save_available_machines() +{ + // attempt to open the output file + emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + if (file.open(emulator_info::get_configname(), "_avail.ini") == FILERR_NONE) + { + // generate header + std::string buffer = std::string("#\n").append(MEWUI_VERSION_TAG).append(bare_build_version).append("\n#\n\n"); + strcatprintf(buffer, "%d\n", (int)m_availablesorted.size()); + strcatprintf(buffer, "%d\n", (int)m_unavailablesorted.size()); + + // generate available list + for (size_t x = 0; x < m_availablesorted.size(); ++x) + { + int find = driver_list::find(m_availablesorted[x]->name); + strcatprintf(buffer, "%d\n", find); + } + + // generate unavailable list + for (size_t x = 0; x < m_unavailablesorted.size(); ++x) + { + int find = driver_list::find(m_unavailablesorted[x]->name); + strcatprintf(buffer, "%d\n", find); + } + file.puts(buffer.c_str()); + file.close(); + } +} diff --git a/src/emu/ui/auditmenu.h b/src/emu/ui/auditmenu.h new file mode 100644 index 00000000000..85a9dcba9f6 --- /dev/null +++ b/src/emu/ui/auditmenu.h @@ -0,0 +1,37 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/auditmenu.h + + Internal MEWUI user interface. + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_AUDIT_H__ +#define __MEWUI_AUDIT_H__ + +//------------------------------------------------- +// class audit menu +//------------------------------------------------- + +class ui_menu_audit : public ui_menu +{ +public: + ui_menu_audit(running_machine &machine, render_container *container, std::vector &availablesorted, std::vector &unavailablesorted, int audit_mode); + virtual ~ui_menu_audit(); + virtual void populate() override; + virtual void handle() override; + +private: + std::vector &m_availablesorted; + std::vector &m_unavailablesorted; + + int m_audit_mode; + void save_available_machines(); + bool m_first; +}; + +#endif /* __MEWUI_AUDIT_H__ */ diff --git a/src/emu/ui/cmddata.h b/src/emu/ui/cmddata.h new file mode 100644 index 00000000000..a588c47465f --- /dev/null +++ b/src/emu/ui/cmddata.h @@ -0,0 +1,404 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/********************************************************************* + + mewui/cmddata.h + +*********************************************************************/ +#pragma once + +#ifndef __MEWUI_CMDDATA_H__ +#define __MEWUI_CMDDATA_H__ + +#define BUTTON_COLOR_RED rgb_t(255,64,64) +#define BUTTON_COLOR_YELLOW rgb_t(255,238,0) +#define BUTTON_COLOR_GREEN rgb_t(0,255,64) +#define BUTTON_COLOR_BLUE rgb_t(0,170,255) +#define BUTTON_COLOR_PURPLE rgb_t(170,0,255) +#define BUTTON_COLOR_PINK rgb_t(255,0,170) +#define BUTTON_COLOR_AQUA rgb_t(0,255,204) +#define BUTTON_COLOR_SILVER rgb_t(255,0,255) +#define BUTTON_COLOR_NAVY rgb_t(255,160,0) +#define BUTTON_COLOR_LIME rgb_t(190,190,190) + +enum +{ + B_COLOR_RED, + B_COLOR_YELLOW, + B_COLOR_GREEN, + B_COLOR_BLUE, + B_COLOR_PURPLE, + B_COLOR_PINK, + B_COLOR_AQUA, + B_COLOR_SILVER, + B_COLOR_NAVY, + B_COLOR_LIME, + MAX_COLORTABLE +}; + +// command.dat symbols assigned to Unicode PUA U+E000 +#define COMMAND_UNICODE (0xe000) +#define MAX_GLYPH_FONT (150) + +// Define Game Command Font Converting Conditions +#define COMMAND_DEFAULT_TEXT '_' + +// Define Expanded Game Command ShortCut +#define COMMAND_EXPAND_TEXT '^' + +// Define Simple Game Command ShortCut +#define COMMAND_CONVERT_TEXT '@' + +// Defined Game Command Font Color Array +static rgb_t color_table[] = +{ + 0, // dummy + BUTTON_COLOR_RED, // BTN_A + BUTTON_COLOR_YELLOW, // BTN_B + BUTTON_COLOR_GREEN, // BTN_C + BUTTON_COLOR_BLUE, // BTN_D + BUTTON_COLOR_PINK, // BTN_E + BUTTON_COLOR_PURPLE, // BTN_F + BUTTON_COLOR_AQUA, // BTN_G + BUTTON_COLOR_SILVER, // BTN_H + BUTTON_COLOR_NAVY, // BTN_I + BUTTON_COLOR_LIME, // BTN_J + BUTTON_COLOR_RED, // BTN_K + BUTTON_COLOR_YELLOW, // BTN_L + BUTTON_COLOR_GREEN, // BTN_M + BUTTON_COLOR_BLUE, // BTN_N + BUTTON_COLOR_PINK, // BTN_O + BUTTON_COLOR_PURPLE, // BTN_P + BUTTON_COLOR_AQUA, // BTN_Q + BUTTON_COLOR_SILVER, // BTN_R + BUTTON_COLOR_NAVY, // BTN_S + BUTTON_COLOR_LIME, // BTN_T + BUTTON_COLOR_RED, // BTN_U + BUTTON_COLOR_YELLOW, // BTN_V + BUTTON_COLOR_GREEN, // BTN_W + BUTTON_COLOR_BLUE, // BTN_X + BUTTON_COLOR_PINK, // BTN_Y + BUTTON_COLOR_PURPLE, // BTN_Z + BUTTON_COLOR_RED, // BTN_1 + BUTTON_COLOR_YELLOW, // BTN_2 + BUTTON_COLOR_GREEN, // BTN_3 + BUTTON_COLOR_BLUE, // BTN_4 + BUTTON_COLOR_PINK, // BTN_5 + BUTTON_COLOR_PURPLE, // BTN_6 + BUTTON_COLOR_AQUA, // BTN_7 + BUTTON_COLOR_SILVER, // BTN_8 + BUTTON_COLOR_NAVY, // BTN_9 + BUTTON_COLOR_LIME, // BTN_10 + BUTTON_COLOR_BLUE, // BTN_DEC + BUTTON_COLOR_RED, // BTN_INC + 0, // BTN_+ + 0, // DIR_... + 0, // DIR_1 + 0, // DIR_2 + 0, // DIR_3 + 0, // DIR_4 + BUTTON_COLOR_RED, // Joystick Ball + 0, // DIR_6 + 0, // DIR_7 + 0, // DIR_8 + 0, // DIR_9 + 0, // DIR_N + BUTTON_COLOR_RED, // BTN_START + BUTTON_COLOR_YELLOW, // BTN_SELECT + BUTTON_COLOR_PINK, // BTN_PUNCH + BUTTON_COLOR_PURPLE, // BTN_KICK + BUTTON_COLOR_BLUE, // BTN_GUARD + 0, + BUTTON_COLOR_YELLOW, // Light Punch + BUTTON_COLOR_NAVY, // Middle Punch + BUTTON_COLOR_RED, // Strong Punch + BUTTON_COLOR_LIME, // Light Kick + BUTTON_COLOR_AQUA, // Middle Kick + BUTTON_COLOR_BLUE, // Strong Kick + BUTTON_COLOR_PURPLE, // 3 Kick + BUTTON_COLOR_PINK, // 3 Punch + BUTTON_COLOR_PURPLE, // 2 Kick + BUTTON_COLOR_PINK, // 2 Punch + BUTTON_COLOR_RED, // CUSTOM_1 + BUTTON_COLOR_YELLOW, // CUSTOM_2 + BUTTON_COLOR_GREEN, // CUSTOM_3 + BUTTON_COLOR_BLUE, // CUSTOM_4 + BUTTON_COLOR_PINK, // CUSTOM_5 + BUTTON_COLOR_PURPLE, // CUSTOM_6 + BUTTON_COLOR_AQUA, // CUSTOM_7 + BUTTON_COLOR_SILVER, // CUSTOM_8 + BUTTON_COLOR_RED, // (Cursor Up) + BUTTON_COLOR_YELLOW, // (Cursor Down) + BUTTON_COLOR_GREEN, // (Cursor Left) + BUTTON_COLOR_BLUE, // (Cursor Right) + 0, // Non Player Lever + BUTTON_COLOR_LIME, // Gray Color Lever + BUTTON_COLOR_RED, // 1 Player Lever + BUTTON_COLOR_YELLOW, // 2 Player Lever + BUTTON_COLOR_GREEN, // 3 Player Lever + BUTTON_COLOR_BLUE, // 4 Player Lever + BUTTON_COLOR_PINK, // 5 Player Lever + BUTTON_COLOR_PURPLE, // 6 Player Lever + BUTTON_COLOR_AQUA, // 7 Player Lever + BUTTON_COLOR_SILVER // 8 Player Lever +}; + +// for color glyph +#define COLOR_BUTTONS ARRAY_LENGTH(color_table) + +// Follow Varialbe Defined Arraies for Game Command Tag +struct fix_command_t +{ + unsigned char glyph_char; + const int glyph_code; +}; + + +struct fix_strings_t +{ + const char *glyph_str; + const int glyph_code; + int glyph_str_len; +}; + +static fix_command_t default_text[] = +{ + // Alphabetic Buttons (NeoGeo): A~D,H,Z + { 'A', 1 }, // BTN_A + { 'B', 2 }, // BTN_B + { 'C', 3 }, // BTN_C + { 'D', 4 }, // BTN_D + { 'H', 8 }, // BTN_H + { 'Z', 26 }, // BTN_Z + // Numerical Buttons (Capcom): 1~10 + { 'a', 27 }, // BTN_1 + { 'b', 28 }, // BTN_2 + { 'c', 29 }, // BTN_3 + { 'd', 30 }, // BTN_4 + { 'e', 31 }, // BTN_5 + { 'f', 32 }, // BTN_6 + { 'g', 33 }, // BTN_7 + { 'h', 34 }, // BTN_8 + { 'i', 35 }, // BTN_9 + { 'j', 36 }, // BTN_10 + // Directions of Arrow, Joystick Ball + { '+', 39 }, // BTN_+ + { '.', 40 }, // DIR_... + { '1', 41 }, // DIR_1 + { '2', 42 }, // DIR_2 + { '3', 43 }, // DIR_3 + { '4', 44 }, // DIR_4 + { '5', 45 }, // Joystick Ball + { '6', 46 }, // DIR_6 + { '7', 47 }, // DIR_7 + { '8', 48 }, // DIR_8 + { '9', 49 }, // DIR_9 + { 'N', 50 }, // DIR_N + // Special Buttons + { 'S', 51 }, // BTN_START + { 'P', 53 }, // BTN_PUNCH + { 'K', 54 }, // BTN_KICK + { 'G', 55 }, // BTN_GUARD + // Composition of Arrow Directions + { '!', 90 }, // Arrow + { 'k', 100 }, // Half Circle Back + { 'l', 101 }, // Half Circle Front Up + { 'm', 102 }, // Half Circle Front + { 'n', 103 }, // Half Circle Back Up + { 'o', 104 }, // 1/4 Cir For 2 Down + { 'p', 105 }, // 1/4 Cir Down 2 Back + { 'q', 106 }, // 1/4 Cir Back 2 Up + { 'r', 107 }, // 1/4 Cir Up 2 For + { 's', 108 }, // 1/4 Cir Back 2 Down + { 't', 109 }, // 1/4 Cir Down 2 For + { 'u', 110 }, // 1/4 Cir For 2 Up + { 'v', 111 }, // 1/4 Cir Up 2 Back + { 'w', 112 }, // Full Clock Forward + { 'x', 113 }, // Full Clock Back + { 'y', 114 }, // Full Count Forward + { 'z', 115 }, // Full Count Back + { 'L', 116 }, // 2x Forward + { 'M', 117 }, // 2x Back + { 'Q', 118 }, // Dragon Screw Forward + { 'R', 119 }, // Dragon Screw Back + // Big letter Text + { '^', 121 }, // AIR + { '?', 122 }, // DIR + { 'X', 124 }, // TAP + // Condition of Positions + { '|', 125 }, // Jump + { 'O', 126 }, // Hold + { '-', 127 }, // Air + { '=', 128 }, // Squatting + { '~', 131 }, // Charge + // Special Character Text + { '`', 135 }, // Small Dot + { '@', 136 }, // Double Ball + { ')', 137 }, // Single Ball + { '(', 138 }, // Solid Ball + { '*', 139 }, // Star + { '&', 140 }, // Solid star + { '%', 141 }, // Triangle + { '$', 142 }, // Solid Triangle + { '#', 143 }, // Double Square + { ']', 144 }, // Single Square + { '[', 145 }, // Solid Square + { '{', 146 }, // Down Triangle + { '}', 147 }, // Solid Down Triangle + { '<', 148 }, // Diamond + { '>', 149 }, // Solid Diamond + { 0, 0 } // end of array +}; + +static fix_command_t expand_text[] = +{ + // Alphabetic Buttons (NeoGeo): S (Slash Button) + { 's', 19 }, // BTN_S + // Special Buttons + { 'S', 52 }, // BTN_SELECT + // Multiple Punches & Kicks + { 'E', 57 }, // Light Punch + { 'F', 58 }, // Middle Punch + { 'G', 59 }, // Strong Punch + { 'H', 60 }, // Light Kick + { 'I', 61 }, // Middle Kick + { 'J', 62 }, // Strong Kick + { 'T', 63 }, // 3 Kick + { 'U', 64 }, // 3 Punch + { 'V', 65 }, // 2 Kick + { 'W', 66 }, // 2 Pick + // Composition of Arrow Directions + { '!', 91 }, // Continue Arrow + // Charge of Arrow Directions + { '1', 92 }, // Charge DIR_1 + { '2', 93 }, // Charge DIR_2 + { '3', 94 }, // Charge DIR_3 + { '4', 95 }, // Charge DIR_4 + { '6', 96 }, // Charge DIR_6 + { '7', 97 }, // Charge DIR_7 + { '8', 98 }, // Charge DIR_8 + { '9', 99 }, // Charge DIR_9 + // Big letter Text + { 'M', 123 }, // MAX + // Condition of Positions + { '-', 129 }, // Close + { '=', 130 }, // Away + { '*', 132 }, // Serious Tap + { '?', 133 }, // Any Button + { 0, 0 } // end of array +}; + +static fix_strings_t convert_text[] = +{ + // Alphabetic Buttons: A~Z + { "A-button", 1 }, // BTN_A + { "B-button", 2 }, // BTN_B + { "C-button", 3 }, // BTN_C + { "D-button", 4 }, // BTN_D + { "E-button", 5 }, // BTN_E + { "F-button", 6 }, // BTN_F + { "G-button", 7 }, // BTN_G + { "H-button", 8 }, // BTN_H + { "I-button", 9 }, // BTN_I + { "J-button", 10 }, // BTN_J + { "K-button", 11 }, // BTN_K + { "L-button", 12 }, // BTN_L + { "M-button", 13 }, // BTN_M + { "N-button", 14 }, // BTN_N + { "O-button", 15 }, // BTN_O + { "P-button", 16 }, // BTN_P + { "Q-button", 17 }, // BTN_Q + { "R-button", 18 }, // BTN_R + { "S-button", 19 }, // BTN_S + { "T-button", 20 }, // BTN_T + { "U-button", 21 }, // BTN_U + { "V-button", 22 }, // BTN_V + { "W-button", 23 }, // BTN_W + { "X-button", 24 }, // BTN_X + { "Y-button", 25 }, // BTN_Y + { "Z-button", 26 }, // BTN_Z + // Special Moves and Buttons + { "decrease", 37 }, // BTN_DEC + { "increase", 38 }, // BTN_INC + { "BALL", 45 }, // Joystick Ball + { "start", 51 }, // BTN_START + { "select", 52 }, // BTN_SELECT + { "punch", 53 }, // BTN_PUNCH + { "kick", 54 }, // BTN_KICK + { "guard", 55 }, // BTN_GUARD + { "L-punch", 57 }, // Light Punch + { "M-punch", 58 }, // Middle Punch + { "S-punch", 59 }, // Strong Punch + { "L-kick", 60 }, // Light Kick + { "M-kick", 61 }, // Middle Kick + { "S-kick", 62 }, // Strong Kick + { "3-kick", 63 }, // 3 Kick + { "3-punch", 64 }, // 3 Punch + { "2-kick", 65 }, // 2 Kick + { "2-punch", 66 }, // 2 Pick + // Custom Buttons and Cursor Buttons + { "custom1", 67 }, // CUSTOM_1 + { "custom2", 68 }, // CUSTOM_2 + { "custom3", 69 }, // CUSTOM_3 + { "custom4", 70 }, // CUSTOM_4 + { "custom5", 71 }, // CUSTOM_5 + { "custom6", 72 }, // CUSTOM_6 + { "custom7", 73 }, // CUSTOM_7 + { "custom8", 74 }, // CUSTOM_8 + { "up", 75 }, // (Cursor Up) + { "down", 76 }, // (Cursor Down) + { "left", 77 }, // (Cursor Left) + { "right", 78 }, // (Cursor Right) + // Player Lever + { "lever", 79 }, // Non Player Lever + { "nplayer", 80 }, // Gray Color Lever + { "1player", 81 }, // 1 Player Lever + { "2player", 82 }, // 2 Player Lever + { "3player", 83 }, // 3 Player Lever + { "4player", 84 }, // 4 Player Lever + { "5player", 85 }, // 5 Player Lever + { "6player", 86 }, // 6 Player Lever + { "7player", 87 }, // 7 Player Lever + { "8player", 88 }, // 8 Player Lever + // Composition of Arrow Directions + { "-->", 90 }, // Arrow + { "==>", 91 }, // Continue Arrow + { "hcb", 100 }, // Half Circle Back + { "huf", 101 }, // Half Circle Front Up + { "hcf", 102 }, // Half Circle Front + { "hub", 103 }, // Half Circle Back Up + { "qfd", 104 }, // 1/4 Cir For 2 Down + { "qdb", 105 }, // 1/4 Cir Down 2 Back + { "qbu", 106 }, // 1/4 Cir Back 2 Up + { "quf", 107 }, // 1/4 Cir Up 2 For + { "qbd", 108 }, // 1/4 Cir Back 2 Down + { "qdf", 109 }, // 1/4 Cir Down 2 For + { "qfu", 110 }, // 1/4 Cir For 2 Up + { "qub", 111 }, // 1/4 Cir Up 2 Back + { "fdf", 112 }, // Full Clock Forward + { "fub", 113 }, // Full Clock Back + { "fuf", 114 }, // Full Count Forward + { "fdb", 115 }, // Full Count Back + { "xff", 116 }, // 2x Forward + { "xbb", 117 }, // 2x Back + { "dsf", 118 }, // Dragon Screw Forward + { "dsb", 119 }, // Dragon Screw Back + // Big letter Text + { "AIR", 121 }, // AIR + { "DIR", 122 }, // DIR + { "MAX", 123 }, // MAX + { "TAP", 124 }, // TAP + // Condition of Positions + { "jump", 125 }, // Jump + { "hold", 126 }, // Hold + { "air", 127 }, // Air + { "sit", 128 }, // Squatting + { "close", 129 }, // Close + { "away", 130 }, // Away + { "charge", 131 }, // Charge + { "tap", 132 }, // Serious Tap + { "button", 133 }, // Any Button + { 0, 0 } // end of array +}; + +#endif /* __MEWUI_CMDDATA_H__ */ diff --git a/src/emu/ui/cmdrender.h b/src/emu/ui/cmdrender.h new file mode 100644 index 00000000000..4cf8c7089c6 --- /dev/null +++ b/src/emu/ui/cmdrender.h @@ -0,0 +1,151 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/cmdrender.h + + MEWUI rendfont. + +***************************************************************************/ + +#include "ui/uicmd14.fh" +#include "ui/cmddata.h" + +void convert_command_glyph(std::string &str) +{ + int j; + const char *s = str.c_str(); + int len = str.length(); + int buflen = (len + 2) * 2; + char *d = global_alloc_array(char, buflen); + + for (int i = j = 0; i < len;) + { + fix_command_t *fixcmd = nullptr; + unicode_char uchar; + int ucharcount = uchar_from_utf8(&uchar, s + i, len - i); + if (ucharcount == -1) + break; + else if (ucharcount != 1) + goto process_next; + else if (s[i] == '\n') + uchar = '\n'; + else if (s[i] == COMMAND_CONVERT_TEXT) + { + if (s[i] == s[i + 1]) + ++i; + else + { + fix_strings_t *fixtext = convert_text; + for (; fixtext->glyph_code; ++fixtext) + { + if (!fixtext->glyph_str_len) + fixtext->glyph_str_len = strlen(fixtext->glyph_str); + + if (strncmp(fixtext->glyph_str, s + i + 1, fixtext->glyph_str_len) == 0) + { + uchar = fixtext->glyph_code + COMMAND_UNICODE; + i += strlen(fixtext->glyph_str); + break; + } + } + } + } + else if (s[i] == COMMAND_DEFAULT_TEXT) + fixcmd = default_text; + else if (s[i] == COMMAND_EXPAND_TEXT) + fixcmd = expand_text; + + if (fixcmd) + { + if (s[i] == s[i + 1]) + i++; + else + { + for (; fixcmd->glyph_code; ++fixcmd) + if (s[i + 1] == fixcmd->glyph_char) + { + uchar = fixcmd->glyph_code + COMMAND_UNICODE; + ++i; + break; + } + } + } +process_next: + i += ucharcount; + ucharcount = utf8_from_uchar(d + j, buflen - j - 1, uchar); + if (ucharcount == -1) + break; + j += ucharcount; + } + d[j] = '\0'; + str = d; + global_free_array(d); +} + +void render_font::render_font_command_glyph() +{ + emu_file ramfile(OPEN_FLAG_READ); + + if (ramfile.open_ram(font_uicmd14, sizeof(font_uicmd14)) == FILERR_NONE) + load_cached_cmd(ramfile, 0); +} + +bool render_font::load_cached_cmd(emu_file &file, UINT32 hash) +{ + UINT64 filesize = file.size(); + UINT8 header[CACHED_HEADER_SIZE]; + UINT32 bytes_read = file.read(header, CACHED_HEADER_SIZE); + + if (bytes_read != CACHED_HEADER_SIZE) + return false; + + if (header[0] != 'f' || header[1] != 'o' || header[2] != 'n' || header[3] != 't') + return false; + if (header[4] != (UINT8)(hash >> 24) || header[5] != (UINT8)(hash >> 16) || header[6] != (UINT8)(hash >> 8) || header[7] != (UINT8)hash) + return false; + m_height_cmd = (header[8] << 8) | header[9]; + m_yoffs_cmd = (INT16)((header[10] << 8) | header[11]); + UINT32 numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15]; + if (filesize - CACHED_HEADER_SIZE < numchars * CACHED_CHAR_SIZE) + return false; + + m_rawdata_cmd.resize(filesize - CACHED_HEADER_SIZE); + bytes_read = file.read(&m_rawdata_cmd[0], filesize - CACHED_HEADER_SIZE); + if (bytes_read != filesize - CACHED_HEADER_SIZE) + { + m_rawdata_cmd.clear(); + return false; + } + + UINT64 offset = numchars * CACHED_CHAR_SIZE; + for (int chindex = 0; chindex < numchars; chindex++) + { + const UINT8 *info = reinterpret_cast(&m_rawdata_cmd[chindex * CACHED_CHAR_SIZE]); + int chnum = (info[0] << 8) | info[1]; + + if (!m_glyphs_cmd[chnum / 256]) + m_glyphs_cmd[chnum / 256] = new glyph[256]; + + glyph &gl = m_glyphs_cmd[chnum / 256][chnum % 256]; + + if (chnum >= COMMAND_UNICODE && chnum < COMMAND_UNICODE + COLOR_BUTTONS) + gl.color = color_table[chnum - COMMAND_UNICODE]; + + gl.width = (info[2] << 8) | info[3]; + gl.xoffs = (INT16)((info[4] << 8) | info[5]); + gl.yoffs = (INT16)((info[6] << 8) | info[7]); + gl.bmwidth = (info[8] << 8) | info[9]; + gl.bmheight = (info[10] << 8) | info[11]; + gl.rawdata = &m_rawdata_cmd[offset]; + + offset += (gl.bmwidth * gl.bmheight + 7) / 8; + if (offset > filesize - CACHED_HEADER_SIZE) + { + m_rawdata_cmd.clear(); + return false; + } + } + + return true; +} diff --git a/src/emu/ui/ctrlmenu.cpp b/src/emu/ui/ctrlmenu.cpp new file mode 100644 index 00000000000..96a35f052ed --- /dev/null +++ b/src/emu/ui/ctrlmenu.cpp @@ -0,0 +1,143 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/********************************************************************* + + mewui/ctrlmenu.cpp + + Internal MEWUI user interface. + +*********************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "ui/ctrlmenu.h" + +const char *ui_menu_controller_mapping::m_device_status[] = { "none", "keyboard", "mouse", "lightgun", "joystick" }; + +ui_menu_controller_mapping::ctrl_option ui_menu_controller_mapping::m_options[] = { + { 0, nullptr, nullptr }, + { 0, "Lightgun Device Assignment", OPTION_LIGHTGUN_DEVICE }, + { 0, "Trackball Device Assignment", OPTION_TRACKBALL_DEVICE }, + { 0, "Pedal Device Assignment", OPTION_PEDAL_DEVICE }, + { 0, "Adstick Device Assignment", OPTION_ADSTICK_DEVICE }, + { 0, "Paddle Device Assignment", OPTION_PADDLE_DEVICE }, + { 0, "Dial Device Assignment", OPTION_DIAL_DEVICE }, + { 0, "Positional Device Assignment", OPTION_POSITIONAL_DEVICE }, + { 0, "Mouse Device Assignment", OPTION_MOUSE_DEVICE } +}; + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_menu_controller_mapping::ui_menu_controller_mapping(running_machine &machine, render_container *container) : ui_menu(machine, container) +{ + for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) + m_options[d].status = check_status(machine.options().value(m_options[d].option), m_options[d].option); +} + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_menu_controller_mapping::~ui_menu_controller_mapping() +{ + std::string error_string; + for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) + machine().options().set_value(m_options[d].option, m_device_status[m_options[d].status], OPTION_PRIORITY_CMDLINE, error_string); +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_controller_mapping::handle() +{ + bool changed = false; + + // process the menu + const ui_menu_event *m_event = process(0); + if (m_event != nullptr && m_event->itemref != nullptr) + { + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + changed = true; + FPTR value = (FPTR)m_event->itemref; + (m_event->iptkey == IPT_UI_RIGHT) ? m_options[value].status++ : m_options[value].status--; + } + } + + if (changed) + reset(UI_MENU_RESET_REMEMBER_REF); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_controller_mapping::populate() +{ + // add options + for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) + { + UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_device_status) - 1, m_options[d].status); + item_append(m_options[d].description, m_device_status[m_options[d].status], arrow_flags, (void *)(FPTR)d); + } + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_controller_mapping::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width, maxwidth = origx2 - origx1; + ui_manager &mui = machine().ui(); + + mui.draw_text_full(container, "Device Mapping", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, "Device Mapping", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + +} + +//------------------------------------------------- +// return current value +//------------------------------------------------- + +int ui_menu_controller_mapping::check_status(const char *status, const char *option) +{ + for (int d = 0; *m_device_status[d]; d++) + if (!strcmp(m_device_status[d], status)) + return d; + + emu_options def_opt; + const char *def_val = def_opt.value(option); + + for (int d = 0; *m_device_status[d]; d++) + if (!strcmp(m_device_status[d], def_val)) + return d; + + return 1; +} diff --git a/src/emu/ui/ctrlmenu.h b/src/emu/ui/ctrlmenu.h new file mode 100644 index 00000000000..0ce43dd2a26 --- /dev/null +++ b/src/emu/ui/ctrlmenu.h @@ -0,0 +1,41 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/ctrlmenu.h + + Internal MEWUI user interface. + +***************************************************************************/ +#pragma once + +#ifndef __MEWUI_CTRLMENU_H__ +#define __MEWUI_CTRLMENU_H__ + +//------------------------------------------------- +// class controller mapping menu +//------------------------------------------------- + +class ui_menu_controller_mapping : public ui_menu +{ +public: + ui_menu_controller_mapping(running_machine &machine, render_container *container); + virtual ~ui_menu_controller_mapping(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + struct ctrl_option + { + int status; + const char *description; + const char *option; + }; + + static const char *m_device_status[]; + static ctrl_option m_options[]; + int check_status(const char *status, const char *option); +}; + +#endif /* __MEWUI_CTRLMENU_H__ */ diff --git a/src/emu/ui/custmenu.cpp b/src/emu/ui/custmenu.cpp new file mode 100644 index 00000000000..6ee8d5094af --- /dev/null +++ b/src/emu/ui/custmenu.cpp @@ -0,0 +1,616 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/********************************************************************* + + mewui/custmenu.cpp + + Internal MEWUI user interface. + +*********************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "ui/custmenu.h" +#include "ui/selector.h" +#include "ui/inifile.h" +#include "rendfont.h" + +/************************************************** + MENU CUSTOM FILTER +**************************************************/ +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- +ui_menu_custom_filter::ui_menu_custom_filter(running_machine &machine, render_container *container, bool _single_menu) : ui_menu(machine, container) +{ + m_single_menu = _single_menu; + m_added = false; +} + +ui_menu_custom_filter::~ui_menu_custom_filter() +{ + if (m_single_menu) + ui_menu::menu_stack->reset(UI_MENU_RESET_SELECT_FIRST); + save_custom_filters(); +} + +//------------------------------------------------- +// handle +//------------------------------------------------- +void ui_menu_custom_filter::handle() +{ + bool changed = false; + m_added = false; + + // process the menu + const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT); + if (m_event != nullptr && m_event->itemref != nullptr) + { + switch ((FPTR)m_event->itemref) + { + case MAIN_FILTER: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + (m_event->iptkey == IPT_UI_RIGHT) ? custfltr::main++ : custfltr::main--; + changed = true; + } + break; + + case ADD_FILTER: + if (m_event->iptkey == IPT_UI_SELECT) + { + custfltr::numother++; + custfltr::other[custfltr::numother] = FILTER_UNAVAILABLE + 1; + m_added = true; + } + break; + + case REMOVE_FILTER: + if (m_event->iptkey == IPT_UI_SELECT) + { + custfltr::other[custfltr::numother] = FILTER_UNAVAILABLE + 1; + custfltr::numother--; + changed = true; + } + break; + } + + if ((FPTR)m_event->itemref >= OTHER_FILTER && (FPTR)m_event->itemref < OTHER_FILTER + MAX_CUST_FILTER) + { + int pos = (int)((FPTR)m_event->itemref - OTHER_FILTER); + if (m_event->iptkey == IPT_UI_LEFT && custfltr::other[pos] > FILTER_UNAVAILABLE + 1) + { + custfltr::other[pos]--; + for ( ; custfltr::other[pos] > FILTER_UNAVAILABLE && (custfltr::other[pos] == FILTER_CATEGORY + || custfltr::other[pos] == FILTER_FAVORITE_GAME); custfltr::other[pos]--) ; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::other[pos] < FILTER_LAST - 1) + { + custfltr::other[pos]++; + for ( ; custfltr::other[pos] < FILTER_LAST && (custfltr::other[pos] == FILTER_CATEGORY + || custfltr::other[pos] == FILTER_FAVORITE_GAME); custfltr::other[pos]++) ; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + { + size_t total = main_filters::length; + std::vector s_sel(total); + for (size_t index = 0; index < total; ++index) + if (index <= FILTER_UNAVAILABLE || index == FILTER_CATEGORY || index == FILTER_FAVORITE_GAME || index == FILTER_CUSTOM) + s_sel[index] = "_skip_"; + else + s_sel[index] = main_filters::text[index]; + + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, custfltr::other[pos])); + } + } + else if ((FPTR)m_event->itemref >= SCREEN_FILTER && (FPTR)m_event->itemref < SCREEN_FILTER + MAX_CUST_FILTER) + { + int pos = (int)((FPTR)m_event->itemref - SCREEN_FILTER); + if (m_event->iptkey == IPT_UI_LEFT && custfltr::screen[pos] > 0) + { + custfltr::screen[pos]--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::screen[pos] < screen_filters::length - 1) + { + custfltr::screen[pos]++; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + { + size_t total = screen_filters::length; + std::vector s_sel(total); + for (size_t index = 0; index < total; ++index) + s_sel[index] = screen_filters::text[index]; + + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, custfltr::screen[pos])); + } + } + else if ((FPTR)m_event->itemref >= YEAR_FILTER && (FPTR)m_event->itemref < YEAR_FILTER + MAX_CUST_FILTER) + { + int pos = (int)((FPTR)m_event->itemref - YEAR_FILTER); + if (m_event->iptkey == IPT_UI_LEFT && custfltr::year[pos] > 0) + { + custfltr::year[pos]--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::year[pos] < c_year::ui.size() - 1) + { + custfltr::year[pos]++; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container, c_year::ui, custfltr::year[pos])); + } + else if ((FPTR)m_event->itemref >= MNFCT_FILTER && (FPTR)m_event->itemref < MNFCT_FILTER + MAX_CUST_FILTER) + { + int pos = (int)((FPTR)m_event->itemref - MNFCT_FILTER); + if (m_event->iptkey == IPT_UI_LEFT && custfltr::mnfct[pos] > 0) + { + custfltr::mnfct[pos]--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::mnfct[pos] < c_mnfct::ui.size() - 1) + { + custfltr::mnfct[pos]++; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container, c_mnfct::ui, custfltr::mnfct[pos])); + } + } + + if (changed) + reset(UI_MENU_RESET_REMEMBER_REF); + else if (m_added) + reset(UI_MENU_RESET_SELECT_FIRST); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- +void ui_menu_custom_filter::populate() +{ + // add main filter + UINT32 arrow_flags = get_arrow_flags((int)FILTER_ALL, (int)FILTER_UNAVAILABLE, custfltr::main); + item_append("Main filter", main_filters::text[custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER); + + // add other filters + for (int x = 1; x <= custfltr::numother; x++) + { + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + // add filter items + arrow_flags = get_arrow_flags((int)FILTER_UNAVAILABLE + 1, (int)FILTER_LAST - 1, custfltr::other[x]); + item_append("Other filter", main_filters::text[custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x)); + + if (m_added) + selected = item.size() - 2; + + // add manufacturer subitem + if (custfltr::other[x] == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0) + { + arrow_flags = get_arrow_flags(0, c_mnfct::ui.size() - 1, custfltr::mnfct[x]); + std::string fbuff("^!Manufacturer"); + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), c_mnfct::ui[custfltr::mnfct[x]].c_str(), arrow_flags, (void *)(FPTR)(MNFCT_FILTER + x)); + } + + // add year subitem + else if (custfltr::other[x] == FILTER_YEAR && c_year::ui.size() > 0) + { + arrow_flags = get_arrow_flags(0, c_year::ui.size() - 1, custfltr::year[x]); + std::string fbuff("^!Year"); + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), c_year::ui[custfltr::year[x]].c_str(), arrow_flags, (void *)(FPTR)(YEAR_FILTER + x)); + } + + // add screen subitem + else if (custfltr::other[x] == FILTER_SCREEN) + { + arrow_flags = get_arrow_flags(0, screen_filters::length - 1, custfltr::screen[x]); + std::string fbuff("^!Screen type"); + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), screen_filters::text[custfltr::screen[x]], arrow_flags, (void *)(FPTR)(SCREEN_FILTER + x)); + } + + } + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + if (custfltr::numother > 0) + item_append("Remove last filter", nullptr, 0, (void *)(FPTR)REMOVE_FILTER); + + if (custfltr::numother < MAX_CUST_FILTER - 2) + item_append("Add filter", nullptr, 0, (void *)(FPTR)ADD_FILTER); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- +void ui_menu_custom_filter::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + + // get the size of the text + mui.draw_text_full(container, "Select custom filters:", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + float maxwidth = MAX(width, origx2 - origx1); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, "Select custom filters:", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} + +//------------------------------------------------- +// save custom filters info to file +//------------------------------------------------- + +void ui_menu_custom_filter::save_custom_filters() +{ + // attempt to open the output file + emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == FILERR_NONE) + { + // generate custom filters info + std::string cinfo; + strprintf(cinfo, "Total filters = %d\n", (custfltr::numother + 1)); + cinfo.append("Main filter = ").append(main_filters::text[custfltr::main]).append("\n"); + + for (int x = 1; x <= custfltr::numother; x++) + { + cinfo.append("Other filter = ").append(main_filters::text[custfltr::other[x]]).append("\n"); + if (custfltr::other[x] == FILTER_MANUFACTURER) + cinfo.append(" Manufacturer filter = ").append(c_mnfct::ui[custfltr::mnfct[x]]).append("\n"); + else if (custfltr::other[x] == FILTER_YEAR) + cinfo.append(" Year filter = ").append(c_year::ui[custfltr::year[x]]).append("\n"); + else if (custfltr::other[x] == FILTER_SCREEN) + cinfo.append(" Screen filter = ").append(screen_filters::text[custfltr::screen[x]]).append("\n"); + } + file.puts(cinfo.c_str()); + file.close(); + } +} + +/************************************************** + MENU CUSTOM SOFTWARE FILTER +**************************************************/ +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- +ui_menu_swcustom_filter::ui_menu_swcustom_filter(running_machine &machine, render_container *container, const game_driver *_driver, s_filter &_filter) : + ui_menu(machine, container), m_added(false), m_filter(_filter), m_driver(_driver) +{ +} + +ui_menu_swcustom_filter::~ui_menu_swcustom_filter() +{ + ui_menu::menu_stack->reset(UI_MENU_RESET_SELECT_FIRST); + save_sw_custom_filters(); +} + +//------------------------------------------------- +// handle +//------------------------------------------------- +void ui_menu_swcustom_filter::handle() +{ + bool changed = false; + m_added = false; + + // process the menu + const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT); + if (m_event != nullptr && m_event->itemref != nullptr) + { + switch ((FPTR)m_event->itemref) + { + case MAIN_FILTER: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + (m_event->iptkey == IPT_UI_RIGHT) ? sw_custfltr::main++ : sw_custfltr::main--; + changed = true; + } + break; + + case ADD_FILTER: + if (m_event->iptkey == IPT_UI_SELECT) + { + sw_custfltr::numother++; + sw_custfltr::other[sw_custfltr::numother] = MEWUI_SW_UNAVAILABLE + 1; + m_added = true; + } + break; + + case REMOVE_FILTER: + if (m_event->iptkey == IPT_UI_SELECT) + { + sw_custfltr::other[sw_custfltr::numother] = MEWUI_SW_UNAVAILABLE + 1; + sw_custfltr::numother--; + changed = true; + } + break; + } + + if ((FPTR)m_event->itemref >= OTHER_FILTER && (FPTR)m_event->itemref < OTHER_FILTER + MAX_CUST_FILTER) + { + int pos = (int)((FPTR)m_event->itemref - OTHER_FILTER); + if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::other[pos] > MEWUI_SW_UNAVAILABLE + 1) + { + sw_custfltr::other[pos]--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::other[pos] < MEWUI_SW_LAST - 1) + { + sw_custfltr::other[pos]++; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + { + size_t total = sw_filters::length; + std::vector s_sel(total); + for (size_t index = 0; index < total; ++index) + if (index <= MEWUI_SW_UNAVAILABLE|| index == MEWUI_SW_CUSTOM) + s_sel[index] = "_skip_"; + else + s_sel[index] = sw_filters::text[index]; + + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, sw_custfltr::other[pos])); + } + } + else if ((FPTR)m_event->itemref >= YEAR_FILTER && (FPTR)m_event->itemref < YEAR_FILTER + MAX_CUST_FILTER) + { + int pos = (int)((FPTR)m_event->itemref - YEAR_FILTER); + if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::year[pos] > 0) + { + sw_custfltr::year[pos]--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::year[pos] < m_filter.year.ui.size() - 1) + { + sw_custfltr::year[pos]++; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.year.ui, sw_custfltr::year[pos])); + } + else if ((FPTR)m_event->itemref >= TYPE_FILTER && (FPTR)m_event->itemref < TYPE_FILTER + MAX_CUST_FILTER) + { + int pos = (int)((FPTR)m_event->itemref - TYPE_FILTER); + if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::type[pos] > 0) + { + sw_custfltr::type[pos]--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::type[pos] < m_filter.type.ui.size() - 1) + { + sw_custfltr::type[pos]++; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.type.ui, sw_custfltr::type[pos])); + } + else if ((FPTR)m_event->itemref >= MNFCT_FILTER && (FPTR)m_event->itemref < MNFCT_FILTER + MAX_CUST_FILTER) + { + int pos = (int)((FPTR)m_event->itemref - MNFCT_FILTER); + if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::mnfct[pos] > 0) + { + sw_custfltr::mnfct[pos]--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::mnfct[pos] < m_filter.publisher.ui.size() - 1) + { + sw_custfltr::mnfct[pos]++; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.publisher.ui, sw_custfltr::mnfct[pos])); + } + else if ((FPTR)m_event->itemref >= REGION_FILTER && (FPTR)m_event->itemref < REGION_FILTER + MAX_CUST_FILTER) + { + int pos = (int)((FPTR)m_event->itemref - REGION_FILTER); + if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::region[pos] > 0) + { + sw_custfltr::region[pos]--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::region[pos] < m_filter.region.ui.size() - 1) + { + sw_custfltr::region[pos]++; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.region.ui, sw_custfltr::region[pos])); + } + else if ((FPTR)m_event->itemref >= LIST_FILTER && (FPTR)m_event->itemref < LIST_FILTER + MAX_CUST_FILTER) + { + int pos = (int)((FPTR)m_event->itemref - LIST_FILTER); + if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::list[pos] > 0) + { + sw_custfltr::list[pos]--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::list[pos] < m_filter.swlist.name.size() - 1) + { + sw_custfltr::list[pos]++; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.swlist.description, sw_custfltr::list[pos])); + } + } + + if (changed) + reset(UI_MENU_RESET_REMEMBER_REF); + else if (m_added) + reset(UI_MENU_RESET_SELECT_FIRST); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- +void ui_menu_swcustom_filter::populate() +{ + // add main filter + UINT32 arrow_flags = get_arrow_flags((int)MEWUI_SW_ALL, (int)MEWUI_SW_UNAVAILABLE, sw_custfltr::main); + item_append("Main filter", sw_filters::text[sw_custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER); + + // add other filters + for (int x = 1; x <= sw_custfltr::numother; x++) + { + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + // add filter items + arrow_flags = get_arrow_flags((int)MEWUI_SW_UNAVAILABLE + 1, (int)MEWUI_SW_LAST - 1, sw_custfltr::other[x]); + item_append("Other filter", sw_filters::text[sw_custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x)); + + if (m_added) + selected = item.size() - 2; + + // add publisher subitem + if (sw_custfltr::other[x] == MEWUI_SW_PUBLISHERS && m_filter.publisher.ui.size() > 0) + { + arrow_flags = get_arrow_flags(0, m_filter.publisher.ui.size() - 1, sw_custfltr::mnfct[x]); + std::string fbuff("^!Publisher"); + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), m_filter.publisher.ui[sw_custfltr::mnfct[x]].c_str(), arrow_flags, (void *)(FPTR)(MNFCT_FILTER + x)); + } + + // add year subitem + else if (sw_custfltr::other[x] == MEWUI_SW_YEARS && m_filter.year.ui.size() > 0) + { + arrow_flags = get_arrow_flags(0, m_filter.year.ui.size() - 1, sw_custfltr::year[x]); + std::string fbuff("^!Year"); + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), m_filter.year.ui[sw_custfltr::year[x]].c_str(), arrow_flags, (void *)(FPTR)(YEAR_FILTER + x)); + } + + // add year subitem + else if (sw_custfltr::other[x] == MEWUI_SW_LIST && m_filter.swlist.name.size() > 0) + { + arrow_flags = get_arrow_flags(0, m_filter.swlist.name.size() - 1, sw_custfltr::list[x]); + std::string fbuff("^!Software List"); + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), m_filter.swlist.description[sw_custfltr::list[x]].c_str(), arrow_flags, (void *)(FPTR)(LIST_FILTER + x)); + } + + // add device type subitem + else if (sw_custfltr::other[x] == MEWUI_SW_TYPE && m_filter.type.ui.size() > 0) + { + arrow_flags = get_arrow_flags(0, m_filter.type.ui.size() - 1, sw_custfltr::type[x]); + std::string fbuff("^!Device type"); + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), m_filter.type.ui[sw_custfltr::type[x]].c_str(), arrow_flags, (void *)(FPTR)(TYPE_FILTER + x)); + } + + // add region subitem + else if (sw_custfltr::other[x] == MEWUI_SW_REGION && m_filter.region.ui.size() > 0) + { + arrow_flags = get_arrow_flags(0, m_filter.region.ui.size() - 1, sw_custfltr::region[x]); + std::string fbuff("^!Region"); + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), m_filter.region.ui[sw_custfltr::region[x]].c_str(), arrow_flags, (void *)(FPTR)(REGION_FILTER + x)); + } + } + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + if (sw_custfltr::numother > 0) + item_append("Remove last filter", nullptr, 0, (void *)(FPTR)REMOVE_FILTER); + + if (sw_custfltr::numother < MAX_CUST_FILTER - 2) + item_append("Add filter", nullptr, 0, (void *)(FPTR)ADD_FILTER); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- +void ui_menu_swcustom_filter::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + + // get the size of the text + mui.draw_text_full(container, "Select custom filters:", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + float maxwidth = MAX(width, origx2 - origx1); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, "Select custom filters:", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} + +//------------------------------------------------- +// save custom filters info to file +//------------------------------------------------- + +void ui_menu_swcustom_filter::save_sw_custom_filters() +{ + // attempt to open the output file + emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + if (file.open("custom_", m_driver->name, "_filter.ini") == FILERR_NONE) + { + // generate custom filters info + std::string cinfo; + strprintf(cinfo, "Total filters = %d\n", (sw_custfltr::numother + 1)); + cinfo.append("Main filter = ").append(sw_filters::text[sw_custfltr::main]).append("\n"); + + for (int x = 1; x <= sw_custfltr::numother; x++) + { + cinfo.append("Other filter = ").append(sw_filters::text[sw_custfltr::other[x]]).append("\n"); + if (sw_custfltr::other[x] == MEWUI_SW_PUBLISHERS) + cinfo.append(" Manufacturer filter = ").append(m_filter.publisher.ui[sw_custfltr::mnfct[x]]).append("\n"); + else if (sw_custfltr::other[x] == MEWUI_SW_LIST) + cinfo.append(" Software List filter = ").append(m_filter.swlist.name[sw_custfltr::list[x]]).append("\n"); + else if (sw_custfltr::other[x] == MEWUI_SW_YEARS) + cinfo.append(" Year filter = ").append(m_filter.year.ui[sw_custfltr::year[x]]).append("\n"); + else if (sw_custfltr::other[x] == MEWUI_SW_TYPE) + cinfo.append(" Type filter = ").append(m_filter.type.ui[sw_custfltr::type[x]]).append("\n"); + else if (sw_custfltr::other[x] == MEWUI_SW_REGION) + cinfo.append(" Region filter = ").append(m_filter.region.ui[sw_custfltr::region[x]]).append("\n"); + } + file.puts(cinfo.c_str()); + file.close(); + } +} + diff --git a/src/emu/ui/custmenu.h b/src/emu/ui/custmenu.h new file mode 100644 index 00000000000..8122978b693 --- /dev/null +++ b/src/emu/ui/custmenu.h @@ -0,0 +1,131 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/custmenu.h + + Internal MEWUI user interface. + + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_CUSTMENU_H__ +#define __MEWUI_CUSTMENU_H__ + +#include "ui/utils.h" + +// Software region +struct c_sw_region +{ + std::vector ui; + UINT16 actual; + void set(std::string &str); + std::string getname(std::string &str); +}; + +// Software publishers +struct c_sw_publisher +{ + std::vector ui; + UINT16 actual; + void set(std::string &str); + std::string getname(std::string &str); +}; + +// Software device type +struct c_sw_type +{ + std::vector ui; + UINT16 actual; + void set(std::string &str); +}; + +// Software list +struct c_sw_list +{ + std::vector name; + std::vector description; + UINT16 actual; +}; + +// Software years +struct c_sw_year +{ + std::vector ui; + UINT16 actual; + void set(std::string &str); +}; + +struct s_filter +{ + c_sw_region region; + c_sw_publisher publisher; + c_sw_year year; + c_sw_type type; + c_sw_list swlist; +}; + +//------------------------------------------------- +// custom software filter menu class +//------------------------------------------------- +class ui_menu_swcustom_filter : public ui_menu +{ +public: + ui_menu_swcustom_filter(running_machine &machine, render_container *container, const game_driver *_driver, s_filter &_filter); + virtual ~ui_menu_swcustom_filter(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + enum + { + MAIN_FILTER = 1, + ADD_FILTER, + REMOVE_FILTER, + MNFCT_FILTER, + YEAR_FILTER = MNFCT_FILTER + MAX_CUST_FILTER + 1, + REGION_FILTER = YEAR_FILTER + MAX_CUST_FILTER + 1, + TYPE_FILTER = REGION_FILTER + MAX_CUST_FILTER + 1, + LIST_FILTER = TYPE_FILTER + MAX_CUST_FILTER + 1, + OTHER_FILTER = LIST_FILTER + MAX_CUST_FILTER + 1 + }; + + bool m_added; + s_filter &m_filter; + const game_driver *m_driver; + + void save_sw_custom_filters(); +}; + +//------------------------------------------------- +// custom filter menu class +//------------------------------------------------- +class ui_menu_custom_filter : public ui_menu +{ +public: + ui_menu_custom_filter(running_machine &machine, render_container *container, bool _single_menu = false); + virtual ~ui_menu_custom_filter(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + enum + { + MAIN_FILTER = 1, + ADD_FILTER, + REMOVE_FILTER, + MNFCT_FILTER, + YEAR_FILTER = MNFCT_FILTER + MAX_CUST_FILTER + 1, + SCREEN_FILTER = YEAR_FILTER + MAX_CUST_FILTER + 1, + OTHER_FILTER = SCREEN_FILTER + MAX_CUST_FILTER + 1 + }; + + bool m_single_menu, m_added; + void save_custom_filters(); +}; + +#endif /* __MEWUI_CUSTMENU_H__ */ diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp new file mode 100644 index 00000000000..ee30658200b --- /dev/null +++ b/src/emu/ui/custui.cpp @@ -0,0 +1,1049 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/********************************************************************* + + mewui/custui.cpp + + Internal MEWUI user interface. + +*********************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "ui/selector.h" +#include "ui/custui.h" +#include "ui/utils.h" +#include + +const char *ui_menu_custom_ui::hide_status[] = { "Show All", "Hide Filters", "Hide Info/Image", "Hide Both" }; + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_menu_custom_ui::ui_menu_custom_ui(running_machine &machine, render_container *container) : ui_menu(machine, container) +{ +} + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_menu_custom_ui::~ui_menu_custom_ui() +{ + std::string error_string; + machine().options().set_value(OPTION_HIDE_PANELS, mewui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); + mewui_globals::reset = true; +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_custom_ui::handle() +{ + bool changed = false; + + // process the menu + const ui_menu_event *m_event = process(0); + + if (m_event != nullptr && m_event->itemref != nullptr) + { + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + changed = true; + (m_event->iptkey == IPT_UI_RIGHT) ? mewui_globals::panels_status++ : mewui_globals::panels_status--; + } + + + else if (m_event->iptkey == IPT_UI_SELECT) + { + switch ((FPTR)m_event->itemref) + { + case FONT_MENU: + ui_menu::stack_push(global_alloc_clear(machine(), container)); + break; + + case COLORS_MENU: + ui_menu::stack_push(global_alloc_clear(machine(), container)); + break; + case HIDE_MENU: + { + int total = ARRAY_LENGTH(hide_status); + std::vector s_sel(total); + for (int index = 0; index < total; ++index) + s_sel[index] = hide_status[index]; + + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, mewui_globals::panels_status)); + } + } + } + } + + if (changed) + reset(UI_MENU_RESET_REMEMBER_REF); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_custom_ui::populate() +{ + item_append("Fonts", nullptr, 0, (void *)(FPTR)FONT_MENU); + item_append("Colors", nullptr, 0, (void *)(FPTR)COLORS_MENU); + + UINT32 arrow_flags = get_arrow_flags(0, (int)HIDE_BOTH, mewui_globals::panels_status); + item_append("Filters and Info/Image", hide_status[mewui_globals::panels_status], arrow_flags, (void *)(FPTR)HIDE_MENU); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_custom_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + + mui.draw_text_full(container, "Custom UI Settings", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + float maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, "Custom UI Settings", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_menu_font_ui::ui_menu_font_ui(running_machine &machine, render_container *container) : ui_menu(machine, container) +{ + emu_options &moptions = machine.options(); +#ifdef MEWUI_WINDOWS + + std::string name(moptions.ui_font()); + list(); + + m_bold = (strreplace(name, "[B]", "") + strreplace(name, "[b]", "") > 0); + m_italic = (strreplace(name, "[I]", "") + strreplace(name, "[i]", "") > 0); + m_actual = 0; + + for (size_t index = 0; index < m_fonts.size(); index++) + { + if (m_fonts[index] == name) + { + m_actual = index; + break; + } + } +#endif + + m_info_size = moptions.infos_size(); + m_font_size = moptions.font_rows(); + + for (emu_options::entry *f_entry = moptions.first(); f_entry != nullptr; f_entry = f_entry->next()) + { + const char *name = f_entry->name(); + if (name && strlen(name) && !strcmp(OPTION_INFOS_SIZE, f_entry->name())) + { + m_info_max = atof(f_entry->maximum()); + m_info_min = atof(f_entry->minimum()); + } + else if (name && strlen(name) && !strcmp(OPTION_FONT_ROWS, f_entry->name())) + { + m_font_max = atof(f_entry->maximum()); + m_font_min = atof(f_entry->minimum()); + } + } + +} + +#ifdef MEWUI_WINDOWS +//------------------------------------------------- +// fonts enumerator CALLBACK +//------------------------------------------------- + +int CALLBACK ui_menu_font_ui::EnumFontFamiliesExProc(const LOGFONT *lpelfe, const TEXTMETRIC *lpntme, DWORD FontType, LPARAM lParam) +{ + std::vector *lpc = (std::vector*)lParam; + std::string utf((char *)lpelfe->lfFaceName); + if (utf[0] != '@') + lpc->push_back(utf); + + return 1; +} + +//------------------------------------------------- +// create fonts list +//------------------------------------------------- + +void ui_menu_font_ui::list() +{ + // create LOGFONT structure + LOGFONT lf; + lf.lfCharSet = ANSI_CHARSET; + lf.lfFaceName[0] = '\0'; + + HDC hDC = GetDC( nullptr ); + EnumFontFamiliesEx( hDC, &lf, (FONTENUMPROC)EnumFontFamiliesExProc, (LPARAM)&m_fonts, 0 ); + ReleaseDC( nullptr, hDC ); + + // sort + std::stable_sort(m_fonts.begin(), m_fonts.end()); + + // add default string to the top of array + m_fonts.insert(m_fonts.begin(), std::string("default")); +} +#endif + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_menu_font_ui::~ui_menu_font_ui() +{ + std::string error_string; + emu_options &moptions = machine().options(); + +#ifdef MEWUI_WINDOWS + std::string name(m_fonts[m_actual]); + if (m_fonts[m_actual] != "default") + { + if (m_italic) + name.insert(0, "[I]"); + if (m_bold) + name.insert(0, "[B]"); + } + moptions.set_value(OPTION_UI_FONT, name.c_str(), OPTION_PRIORITY_CMDLINE, error_string); +#endif + + moptions.set_value(OPTION_INFOS_SIZE, m_info_size, OPTION_PRIORITY_CMDLINE, error_string); + moptions.set_value(OPTION_FONT_ROWS, m_font_size, OPTION_PRIORITY_CMDLINE, error_string); +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_font_ui::handle() +{ + bool changed = false; + + // process the menu + const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT); + + if (m_event != nullptr && m_event->itemref != nullptr) + switch ((FPTR)m_event->itemref) + { + case INFOS_SIZE: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + (m_event->iptkey == IPT_UI_RIGHT) ? m_info_size += 0.05f : m_info_size -= 0.05f; + changed = true; + } + break; + + case FONT_SIZE: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + (m_event->iptkey == IPT_UI_RIGHT) ? m_font_size++ : m_font_size--; + changed = true; + } + break; + +#ifdef MEWUI_WINDOWS + + case MUI_FNT: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + (m_event->iptkey == IPT_UI_RIGHT) ? m_actual++ : m_actual--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + { + ui_menu::stack_push(global_alloc_clear(machine(), container, m_fonts, m_actual)); + changed = true; + } + break; + + case MUI_BOLD: + case MUI_ITALIC: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT) + { + ((FPTR)m_event->itemref == MUI_BOLD) ? m_bold = !m_bold : m_italic = !m_italic; + changed = true; + } + break; +#endif + } + + if (changed) + reset(UI_MENU_RESET_REMEMBER_REF); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_font_ui::populate() +{ + // set filter arrow + UINT32 arrow_flags; + std::string tmptxt; + +#ifdef MEWUI_WINDOWS + // add fonts option + arrow_flags = get_arrow_flags(0, m_fonts.size() - 1, m_actual); + std::string name(m_fonts[m_actual]); + item_append("UI Font", name.c_str(), arrow_flags, (void *)(FPTR)MUI_FNT); + + if (name != "default") + { + item_append("Bold", m_bold ? "On" : "Off", m_bold ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)MUI_BOLD); + item_append("Italic", m_italic ? "On" : "Off", m_italic ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)MUI_ITALIC); + } +#endif + + arrow_flags = get_arrow_flags(m_font_min, m_font_max, m_font_size); + strprintf(tmptxt, "%2d", m_font_size); + item_append("Lines", tmptxt.c_str(), arrow_flags, (void *)(FPTR)FONT_SIZE); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + // add item + tmptxt.clear(); + strprintf(tmptxt, "%3.2f", m_info_size); + arrow_flags = get_arrow_flags(m_info_min, m_info_max, m_info_size); + item_append("Infos text size", tmptxt.c_str(), arrow_flags, (void *)(FPTR)INFOS_SIZE); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + custombottom = customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_font_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + + // top text + std::string topbuf("UI Fonts Settings"); + + mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + float maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + if ((FPTR)selectedref == INFOS_SIZE) + { + topbuf = "Sample text - Lorem ipsum dolor sit amet, consectetur adipiscing elit."; + + mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr, m_info_size); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = origy2 + UI_BOX_TB_BORDER; + y2 = origy2 + bottom; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_LEFT, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, m_info_size); + } +} + +//------------------------------------------------- +// ctor +//------------------------------------------------- +#define SET_COLOR_UI(var, opt) var[M##opt].color = opt; var[M##opt].option = OPTION_##opt + +ui_menu_colors_ui::ui_menu_colors_ui(running_machine &machine, render_container *container) : ui_menu(machine, container) +{ + SET_COLOR_UI(m_color_table, UI_BACKGROUND_COLOR); + SET_COLOR_UI(m_color_table, UI_BORDER_COLOR); + SET_COLOR_UI(m_color_table, UI_CLONE_COLOR); + SET_COLOR_UI(m_color_table, UI_DIPSW_COLOR); + SET_COLOR_UI(m_color_table, UI_GFXVIEWER_BG_COLOR); + SET_COLOR_UI(m_color_table, UI_MOUSEDOWN_BG_COLOR); + SET_COLOR_UI(m_color_table, UI_MOUSEDOWN_COLOR); + SET_COLOR_UI(m_color_table, UI_MOUSEOVER_BG_COLOR); + SET_COLOR_UI(m_color_table, UI_MOUSEOVER_COLOR); + SET_COLOR_UI(m_color_table, UI_SELECTED_BG_COLOR); + SET_COLOR_UI(m_color_table, UI_SELECTED_COLOR); + SET_COLOR_UI(m_color_table, UI_SLIDER_COLOR); + SET_COLOR_UI(m_color_table, UI_SUBITEM_COLOR); + SET_COLOR_UI(m_color_table, UI_TEXT_BG_COLOR); + SET_COLOR_UI(m_color_table, UI_TEXT_COLOR); + SET_COLOR_UI(m_color_table, UI_UNAVAILABLE_COLOR); +} + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_menu_colors_ui::~ui_menu_colors_ui() +{ + std::string error_string, dec_color; + for (int index = 1; index < MUI_RESTORE; index++) + { + strprintf(dec_color, "%x", (UINT32)m_color_table[index].color); + machine().options().set_value(m_color_table[index].option, dec_color.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + } +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_colors_ui::handle() +{ + bool changed = false; + + // process the menu + const ui_menu_event *m_event = process(0); + + if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) + { + if ((FPTR)m_event->itemref != MUI_RESTORE) + ui_menu::stack_push(global_alloc_clear(machine(), container, &m_color_table[(FPTR)m_event->itemref].color, item[selected].text)); + else + { + changed = true; + restore_colors(); + } + } + + if (changed) + reset(UI_MENU_RESET_REMEMBER_REF); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_colors_ui::populate() +{ + item_append("Normal text", nullptr, 0, (void *)(FPTR)MUI_TEXT_COLOR); + item_append("Selected m_color", nullptr, 0, (void *)(FPTR)MUI_SELECTED_COLOR); + item_append("Normal text background", nullptr, 0, (void *)(FPTR)MUI_TEXT_BG_COLOR); + item_append("Selected background m_color", nullptr, 0, (void *)(FPTR)MUI_SELECTED_BG_COLOR); + item_append("Subitem m_color", nullptr, 0, (void *)(FPTR)MUI_SUBITEM_COLOR); + item_append("Clone", nullptr, 0, (void *)(FPTR)MUI_CLONE_COLOR); + item_append("Border", nullptr, 0, (void *)(FPTR)MUI_BORDER_COLOR); + item_append("Background", nullptr, 0, (void *)(FPTR)MUI_BACKGROUND_COLOR); + item_append("Dipswitch", nullptr, 0, (void *)(FPTR)MUI_DIPSW_COLOR); + item_append("Unavailable m_color", nullptr, 0, (void *)(FPTR)MUI_UNAVAILABLE_COLOR); + item_append("Slider m_color", nullptr, 0, (void *)(FPTR)MUI_SLIDER_COLOR); + item_append("Gfx viewer background", nullptr, 0, (void *)(FPTR)MUI_GFXVIEWER_BG_COLOR); + item_append("Mouse over m_color", nullptr, 0, (void *)(FPTR)MUI_MOUSEOVER_COLOR); + item_append("Mouse over background m_color", nullptr, 0, (void *)(FPTR)MUI_MOUSEOVER_BG_COLOR); + item_append("Mouse down m_color", nullptr, 0, (void *)(FPTR)MUI_MOUSEDOWN_COLOR); + item_append("Mouse down background m_color", nullptr, 0, (void *)(FPTR)MUI_MOUSEDOWN_BG_COLOR); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + item_append("Restore originals colors", nullptr, 0, (void *)(FPTR)MUI_RESTORE); + + custombottom = customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width, maxwidth = origx2 - origx1; + ui_manager &mui = machine().ui(); + float line_height = mui.get_line_height(); + + // top text + std::string topbuf("UI Colors Settings"); + + mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + // bottom text + // get the text for 'UI Select' + std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)); + topbuf.assign("Double click or press ").append(ui_select_text.c_str()).append(" to change the m_color value"); + + mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = origy2 + UI_BOX_TB_BORDER; + y2 = origy2 + bottom; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + // compute maxwidth + topbuf = "Menu Preview"; + + mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + maxwidth = width + 2.0f * UI_BOX_LR_BORDER; + + std::string sampletxt[5]; + + sampletxt[0] = "Normal"; + sampletxt[1] = "Subitem"; + sampletxt[2] = "Selected"; + sampletxt[3] = "Mouse Over"; + sampletxt[4] = "Clone"; + + for (auto & elem: sampletxt) + { + mui.draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + } + + // compute our bounds for header + x1 = origx2 + 2.0f * UI_BOX_LR_BORDER; + x2 = x1 + maxwidth; + y1 = origy1; + y2 = y1 + bottom - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + y2 -= UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + // compute our bounds for menu preview + x1 -= UI_BOX_LR_BORDER; + x2 += UI_BOX_LR_BORDER; + y1 = y2 + 2.0f * UI_BOX_TB_BORDER; + y2 = y1 + 5.0f * line_height + 2.0f * UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, m_color_table[MUI_BACKGROUND_COLOR].color); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw normal text + mui.draw_text_full(container, sampletxt[0].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, m_color_table[MUI_TEXT_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); + y1 += line_height; + + // draw subitem text + mui.draw_text_full(container, sampletxt[1].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, m_color_table[MUI_SUBITEM_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); + y1 += line_height; + + // draw selected text + highlight(container, x1, y1, x2, y1 + line_height, m_color_table[MUI_SELECTED_BG_COLOR].color); + mui.draw_text_full(container, sampletxt[2].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, m_color_table[MUI_SELECTED_COLOR].color, m_color_table[MUI_SELECTED_BG_COLOR].color, nullptr, nullptr); + y1 += line_height; + + // draw mouse over text + highlight(container, x1, y1, x2, y1 + line_height, m_color_table[MUI_MOUSEOVER_BG_COLOR].color); + mui.draw_text_full(container, sampletxt[3].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, m_color_table[MUI_MOUSEOVER_COLOR].color, m_color_table[MUI_MOUSEOVER_BG_COLOR].color, nullptr, nullptr); + y1 += line_height; + + // draw clone text + mui.draw_text_full(container, sampletxt[4].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, m_color_table[MUI_CLONE_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr); + +} + +//------------------------------------------------- +// restore original colors +//------------------------------------------------- + +void ui_menu_colors_ui::restore_colors() +{ + emu_options options; + for (int index = 1; index < MUI_RESTORE; index++) + m_color_table[index].color = rgb_t((UINT32)strtoul(options.value(m_color_table[index].option), nullptr, 16)); +} + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_menu_rgb_ui::ui_menu_rgb_ui(running_machine &machine, render_container *container, rgb_t *_color, std::string _title) : ui_menu(machine, container) +{ + m_color = _color; + m_key_active = false; + m_lock_ref = 0; + m_title = _title; + m_search[0] = '\0'; +} + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_menu_rgb_ui::~ui_menu_rgb_ui() +{ +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_rgb_ui::handle() +{ + bool changed = false; + + // process the menu + const ui_menu_event *m_event; + + if (!m_key_active) + m_event = process(UI_MENU_PROCESS_LR_REPEAT); + else + m_event = process(UI_MENU_PROCESS_ONLYCHAR); + + if (m_event != nullptr && m_event->itemref != nullptr) + { + switch ((FPTR)m_event->itemref) + { + case RGB_ALPHA: + if (m_event->iptkey == IPT_UI_LEFT && m_color->a() > 1) + { + m_color->set_a(m_color->a() - 1); + changed = true; + } + + else if (m_event->iptkey == IPT_UI_RIGHT && m_color->a() < 255) + { + m_color->set_a(m_color->a() + 1); + changed = true; + } + + else if (m_event->iptkey == IPT_UI_SELECT || m_event->iptkey == IPT_SPECIAL) + { + inkey_special(m_event); + changed = true; + } + + break; + + case RGB_RED: + if (m_event->iptkey == IPT_UI_LEFT && m_color->r() > 1) + { + m_color->set_r(m_color->r() - 1); + changed = true; + } + + else if (m_event->iptkey == IPT_UI_RIGHT && m_color->r() < 255) + { + m_color->set_r(m_color->r() + 1); + changed = true; + } + + else if (m_event->iptkey == IPT_UI_SELECT || m_event->iptkey == IPT_SPECIAL) + { + inkey_special(m_event); + changed = true; + } + + break; + + case RGB_GREEN: + if (m_event->iptkey == IPT_UI_LEFT && m_color->g() > 1) + { + m_color->set_g(m_color->g() - 1); + changed = true; + } + + else if (m_event->iptkey == IPT_UI_RIGHT && m_color->g() < 255) + { + m_color->set_g(m_color->g() + 1); + changed = true; + } + + else if (m_event->iptkey == IPT_UI_SELECT || m_event->iptkey == IPT_SPECIAL) + { + inkey_special(m_event); + changed = true; + } + + break; + + case RGB_BLUE: + if (m_event->iptkey == IPT_UI_LEFT && m_color->b() > 1) + { + m_color->set_b(m_color->b() - 1); + changed = true; + } + + else if (m_event->iptkey == IPT_UI_RIGHT && m_color->b() < 255) + { + m_color->set_b(m_color->b() + 1); + changed = true; + } + + else if (m_event->iptkey == IPT_UI_SELECT || m_event->iptkey == IPT_SPECIAL) + { + inkey_special(m_event); + changed = true; + } + + break; + + case PALETTE_CHOOSE: + if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container, *m_color)); + break; + } + } + + if (changed) + reset(UI_MENU_RESET_REMEMBER_REF); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_rgb_ui::populate() +{ + // set filter arrow + UINT32 arrow_flags = MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; + std::string text; + std::string s_text = std::string(m_search).append("_"); + + if (m_lock_ref != RGB_ALPHA) + { + arrow_flags = get_arrow_flags(0, 255, m_color->a()); + strprintf(text, "%3d", m_color->a()); + item_append("Alpha", text.c_str(), arrow_flags, (void *)(FPTR)RGB_ALPHA); + } + else + item_append("Alpha", s_text.c_str(), 0, (void *)(FPTR)RGB_ALPHA); + + if (m_lock_ref != RGB_RED) + { + arrow_flags = get_arrow_flags(0, 255, m_color->r()); + strprintf(text, "%3d", m_color->r()); + item_append("Red", text.c_str(), arrow_flags, (void *)(FPTR)RGB_RED); + } + else + item_append("Red", s_text.c_str(), 0, (void *)(FPTR)RGB_RED); + + if (m_lock_ref != RGB_GREEN) + { + arrow_flags = get_arrow_flags(0, 255, m_color->g()); + strprintf(text, "%3d", m_color->g()); + item_append("Green", text.c_str(), arrow_flags, (void *)(FPTR)RGB_GREEN); + } + else + item_append("Green", s_text.c_str(), 0, (void *)(FPTR)RGB_GREEN); + + if (m_lock_ref != RGB_BLUE) + { + arrow_flags = get_arrow_flags(0, 255, m_color->b()); + strprintf(text, "%3d", m_color->b()); + item_append("Blue", text.c_str(), arrow_flags, (void *)(FPTR)RGB_BLUE); + } + else + item_append("Blue", s_text.c_str(), 0, (void *)(FPTR)RGB_BLUE); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + item_append("Choose from palette", nullptr, 0, (void *)(FPTR)PALETTE_CHOOSE); + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + custombottom = customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width, maxwidth = origx2 - origx1; + ui_manager &mui = machine().ui(); + + // top text + std::string topbuf = std::string(m_title).append(" - ARGB Settings"); + mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + std::string sampletxt("Color preview ="); + maxwidth = origx2 - origx1; + mui.draw_text_full(container, sampletxt.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + + // compute our bounds + x1 -= UI_BOX_LR_BORDER; + x2 = x1 + width; + y1 = origy2 + UI_BOX_TB_BORDER; + y2 = origy2 + bottom; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the normal text + mui.draw_text_full(container, sampletxt.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); + + float t_x2 = x1 - UI_BOX_LR_BORDER + maxwidth; + x1 = x2 + 2.0f * UI_BOX_LR_BORDER; + x2 = t_x2; + y1 -= UI_BOX_TB_BORDER; + + mui.draw_outlined_box(container, x1, y1, x2, y2, *m_color); + +} + +//------------------------------------------------- +// handle special key event +//------------------------------------------------- + +void ui_menu_rgb_ui::inkey_special(const ui_menu_event *m_event) +{ + if (m_event->iptkey == IPT_UI_SELECT) + { + m_key_active = !m_key_active; + m_lock_ref = (FPTR)m_event->itemref; + + if (!m_key_active) + { + int val = atoi(m_search); + val = m_color->clamp(val); + + switch ((FPTR)m_event->itemref) + { + case RGB_ALPHA: + m_color->set_a(val); + break; + + case RGB_RED: + m_color->set_r(val); + break; + + case RGB_GREEN: + m_color->set_g(val); + break; + + case RGB_BLUE: + m_color->set_b(val); + break; + } + + m_search[0] = 0; + m_lock_ref = 0; + return; + } + } + + if (!m_key_active) + { + m_search[0] = 0; + return; + } + + int buflen = strlen(m_search); + + // if it's a backspace and we can handle it, do so + if (((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0)) + *(char *)utf8_previous_char(&m_search[buflen]) = 0; + else if (buflen >= 3) + return; + // if it's any other key and we're not maxed out, update + else if ((m_event->unichar >= '0' && m_event->unichar <= '9')) + buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar); + + m_search[buflen] = 0; +} + +ui_menu_palette_sel::palcolor ui_menu_palette_sel::m_palette[] = { + { "White", "FFFFFFFF" }, + { "Silver", "FFC0C0C0" }, + { "Gray", "FF808080" }, + { "Black", "FF000000" }, + { "Red", "FFFF0000" }, + { "Orange", "FFFFA500" }, + { "Yellow", "FFFFFF00" }, + { "Green", "FF00FF00" }, + { "Blue", "FF0000FF" }, + { "Violet", "FF8F00FF" } +}; + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_menu_palette_sel::ui_menu_palette_sel(running_machine &machine, render_container *container, rgb_t &_color) + : ui_menu(machine, container), m_original(_color) +{ +} + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_menu_palette_sel::~ui_menu_palette_sel() +{ +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_palette_sel::handle() +{ + // process the menu + const ui_menu_event *m_event = process(MENU_FLAG_MEWUI_PALETTE); + if (m_event != nullptr && m_event->itemref != nullptr) + { + if (m_event->iptkey == IPT_UI_SELECT) + { + m_original = rgb_t((UINT32)strtoul(item[selected].subtext, nullptr, 16)); + ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST); + ui_menu::stack_pop(machine()); + } + } +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_palette_sel::populate() +{ + for (int x = 0; x < ARRAY_LENGTH(m_palette); ++x) + item_append(m_palette[x].name, m_palette[x].argb, MENU_FLAG_MEWUI_PALETTE, (void *)(FPTR)(x + 1)); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_palette_sel::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ +} diff --git a/src/emu/ui/custui.h b/src/emu/ui/custui.h new file mode 100644 index 00000000000..46bb92b8197 --- /dev/null +++ b/src/emu/ui/custui.h @@ -0,0 +1,182 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/custui.h + + Internal MEWUI user interface. + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_CUSTUI_H__ +#define __MEWUI_CUSTUI_H__ + +#ifdef MEWUI_WINDOWS +#define WIN32_LEAN_AND_MEAN +#include +#endif + +//------------------------------------------------- +// Custom UI menu +//------------------------------------------------- + +class ui_menu_custom_ui : public ui_menu +{ +public: + ui_menu_custom_ui(running_machine &machine, render_container *container); + virtual ~ui_menu_custom_ui(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + enum + { + FONT_MENU = 1, + COLORS_MENU, + HIDE_MENU + }; + static const char *hide_status[]; +}; + +//------------------------------------------------- +// Font UI menu +//------------------------------------------------- + +class ui_menu_font_ui : public ui_menu +{ +public: + ui_menu_font_ui(running_machine &machine, render_container *container); + virtual ~ui_menu_font_ui(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + enum + { + INFOS_SIZE = 1, + FONT_SIZE, + MUI_FNT, + MUI_BOLD, + MUI_ITALIC + }; + +#ifdef MEWUI_WINDOWS + UINT16 m_actual; + std::vector m_fonts; + bool m_bold, m_italic; + + void list(); + static int CALLBACK EnumFontFamiliesExProc(const LOGFONT *lpelfe, const TEXTMETRIC *lpntme, DWORD FontType, LPARAM lParam); + +#endif + + float m_info_min, m_info_max, m_info_size; + int m_font_min, m_font_max, m_font_size; +}; + +//------------------------------------------------- +// Colors UI menu +//------------------------------------------------- + +class ui_menu_colors_ui : public ui_menu +{ +public: + ui_menu_colors_ui(running_machine &machine, render_container *container); + virtual ~ui_menu_colors_ui(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + enum + { + MUI_BACKGROUND_COLOR = 1, + MUI_BORDER_COLOR, + MUI_CLONE_COLOR, + MUI_DIPSW_COLOR, + MUI_GFXVIEWER_BG_COLOR, + MUI_MOUSEDOWN_BG_COLOR, + MUI_MOUSEDOWN_COLOR, + MUI_MOUSEOVER_BG_COLOR, + MUI_MOUSEOVER_COLOR, + MUI_SELECTED_BG_COLOR, + MUI_SELECTED_COLOR, + MUI_SLIDER_COLOR, + MUI_SUBITEM_COLOR, + MUI_TEXT_BG_COLOR, + MUI_TEXT_COLOR, + MUI_UNAVAILABLE_COLOR, + MUI_RESTORE + }; + + struct s_color_table + { + rgb_t color; + const char *option; + }; + + s_color_table m_color_table[MUI_RESTORE]; + void restore_colors(); +}; + +//------------------------------------------------- +// ARGB UI menu +//------------------------------------------------- + +class ui_menu_rgb_ui : public ui_menu +{ +public: + ui_menu_rgb_ui(running_machine &machine, render_container *container, rgb_t *_color, std::string _title); + virtual ~ui_menu_rgb_ui(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + rgb_t *m_color; + char m_search[4]; + bool m_key_active; + int m_lock_ref; + std::string m_title; + + enum + { + RGB_ALPHA = 1, + RGB_RED, + RGB_GREEN, + RGB_BLUE, + PALETTE_CHOOSE + }; + + void inkey_special(const ui_menu_event *menu_event); +}; + +//------------------------------------------------- +// Palette UI menu +//------------------------------------------------- + +class ui_menu_palette_sel : public ui_menu +{ +public: + ui_menu_palette_sel(running_machine &machine, render_container *container, rgb_t &_color); + virtual ~ui_menu_palette_sel(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + struct palcolor + { + const char *name; + const char *argb; + }; + + static palcolor m_palette[]; + rgb_t &m_original; +}; + +#endif /* __MEWUI_CUSTUI_H__ */ diff --git a/src/emu/ui/datfile.cpp b/src/emu/ui/datfile.cpp new file mode 100644 index 00000000000..f0e938fbd4d --- /dev/null +++ b/src/emu/ui/datfile.cpp @@ -0,0 +1,642 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/datfile.cpp + + MEWUI DATs manager. + +***************************************************************************/ + +#include "emu.h" +#include "drivenum.h" +#include "ui/datfile.h" +#include "ui/utils.h" + +//------------------------------------------------- +// TAGS +//------------------------------------------------- +static std::string DATAFILE_TAG("$"); +static std::string TAG_BIO("$bio"); +static std::string TAG_INFO("$info"); +static std::string TAG_MAME("$mame"); +static std::string TAG_COMMAND("$cmd"); +static std::string TAG_END("$end"); +static std::string TAG_DRIVER("$drv"); +static std::string TAG_STORY("$story"); +static std::string TAG_HISTORY_R("## REVISION:"); +static std::string TAG_MAMEINFO_R("# MAMEINFO.DAT"); +static std::string TAG_MESSINFO_R("# MESSINFO.DAT"); +static std::string TAG_SYSINFO_R("# This file was generated on"); +static std::string TAG_STORY_R("# version"); +static std::string TAG_COMMAND_SEPARATOR("-----------------------------------------------"); + +//------------------------------------------------- +// Statics +//------------------------------------------------- +datfile_manager::dataindex datfile_manager::m_histidx; +datfile_manager::dataindex datfile_manager::m_mameidx; +datfile_manager::dataindex datfile_manager::m_messidx; +datfile_manager::dataindex datfile_manager::m_cmdidx; +datfile_manager::dataindex datfile_manager::m_sysidx; +datfile_manager::dataindex datfile_manager::m_storyidx; +datfile_manager::drvindex datfile_manager::m_drvidx; +datfile_manager::drvindex datfile_manager::m_messdrvidx; +datfile_manager::drvindex datfile_manager::m_menuidx; +datfile_manager::swindex datfile_manager::m_swindex; +std::string datfile_manager::m_history_rev; +std::string datfile_manager::m_mame_rev; +std::string datfile_manager::m_mess_rev; +std::string datfile_manager::m_sysinfo_rev; +std::string datfile_manager::m_story_rev; +bool datfile_manager::first_run = true; + +//------------------------------------------------- +// ctor +//------------------------------------------------- +datfile_manager::datfile_manager(running_machine &machine) : m_machine(machine) +{ + if (machine.options().enabled_dats() && first_run) + { + first_run = false; + if (parseopen("mameinfo.dat")) + { + init_mameinfo(); + parseclose(); + } + + if (parseopen("command.dat")) + { + init_command(); + parseclose(); + } + + if (parseopen("story.dat")) + { + init_storyinfo(); + parseclose(); + } + + if (parseopen("messinfo.dat")) + { + init_messinfo(); + parseclose(); + } + + if (parseopen("sysinfo.dat")) + { + init_sysinfo(); + parseclose(); + } + + if (parseopen("history.dat")) + { + init_history(); + parseclose(); + } + } +} + +//------------------------------------------------- +// initialize sysinfo.dat index +//------------------------------------------------- +void datfile_manager::init_sysinfo() +{ + int swcount = 0; + int count = index_datafile(m_sysidx, swcount); + osd_printf_verbose("Sysinfo.dat games found = %i\n", count); + osd_printf_verbose("Rev = %s\n", m_sysinfo_rev.c_str()); +} + +//------------------------------------------------- +// initialize story.dat index +//------------------------------------------------- +void datfile_manager::init_storyinfo() +{ + int swcount = 0; + int count = index_datafile(m_storyidx, swcount); + osd_printf_verbose("Story.dat games found = %i\n", count); +} + +//------------------------------------------------- +// initialize history.dat index +//------------------------------------------------- +void datfile_manager::init_history() +{ + int swcount = 0; + int count = index_datafile(m_histidx, swcount); + osd_printf_verbose("History.dat games found = %i\n", count); + osd_printf_verbose("History.dat softwares found = %i\n", swcount); + osd_printf_verbose("Rev = %s\n", m_history_rev.c_str()); +} + +//------------------------------------------------- +// initialize mameinfo.dat index +//------------------------------------------------- +void datfile_manager::init_mameinfo() +{ + int drvcount = 0; + int count = index_mame_mess_info(m_mameidx, m_drvidx, drvcount); + osd_printf_verbose("Mameinfo.dat games found = %i\n", count); + osd_printf_verbose("Mameinfo.dat drivers found = %d\n", drvcount); + osd_printf_verbose("Rev = %s\n", m_mame_rev.c_str()); +} + +//------------------------------------------------- +// initialize messinfo.dat index +//------------------------------------------------- +void datfile_manager::init_messinfo() +{ + int drvcount = 0; + int count = index_mame_mess_info(m_messidx, m_messdrvidx, drvcount); + osd_printf_verbose("Messinfo.dat games found = %i\n", count); + osd_printf_verbose("Messinfo.dat drivers found = %d\n", drvcount); + osd_printf_verbose("Rev = %s\n", m_mess_rev.c_str()); +} + +//------------------------------------------------- +// initialize command.dat index +//------------------------------------------------- +void datfile_manager::init_command() +{ + int swcount = 0; + int count = index_datafile(m_cmdidx, swcount); + osd_printf_verbose("Command.dat games found = %i\n", count); +} + +//------------------------------------------------- +// load software info +//------------------------------------------------- +void datfile_manager::load_software_info(std::string &softlist, std::string &buffer, std::string &softname, std::string &parentname) +{ + // Load history text + if (!m_swindex.empty() && parseopen("history.dat")) + { + // Find software in software list index + if (m_swindex.find(softlist) == m_swindex.end()) + return; + + drvindex::iterator itemsiter; + itemsiter = m_swindex[softlist].find(softname); + if (itemsiter == m_swindex[softlist].end() && !parentname.empty()) + itemsiter = m_swindex[softlist].find(parentname); + + if (itemsiter == m_swindex[softlist].end()) + return; + + long s_offset = (*itemsiter).second; + char rbuf[64 * 1024]; + fseek(fp, s_offset, SEEK_SET); + std::string readbuf; + while (fgets(rbuf, 64 * 1024, fp) != nullptr) + { + readbuf = chartrimcarriage(rbuf); + + // end entry when a end tag is encountered + if (readbuf == TAG_END) + break; + + // add this string to the buffer + buffer.append(readbuf).append("\n"); + } + parseclose(); + } +} + +//------------------------------------------------- +// load_data_info +//------------------------------------------------- +void datfile_manager::load_data_info(const game_driver *drv, std::string &buffer, int type) +{ + dataindex index_idx; + drvindex driver_idx; + std::string tag; + std::string filename; + + switch (type) + { + case MEWUI_HISTORY_LOAD: + filename = "history.dat"; + tag = TAG_BIO; + index_idx = m_histidx; + break; + case MEWUI_MAMEINFO_LOAD: + filename = "mameinfo.dat"; + tag = TAG_MAME; + index_idx = m_mameidx; + driver_idx = m_drvidx; + break; + case MEWUI_SYSINFO_LOAD: + filename = "sysinfo.dat"; + tag = TAG_BIO; + index_idx = m_sysidx; + break; + case MEWUI_MESSINFO_LOAD: + filename = "messinfo.dat"; + tag = TAG_MAME; + index_idx = m_messidx; + driver_idx = m_messdrvidx; + break; + case MEWUI_STORY_LOAD: + filename = "story.dat"; + tag = TAG_STORY; + index_idx = m_storyidx; + break; + } + + if (parseopen(filename.c_str())) + { + load_data_text(drv, buffer, index_idx, tag); + + // load driver info + if (!driver_idx.empty()) + load_driver_text(drv, buffer, driver_idx, TAG_DRIVER); + + // cleanup mameinfo and sysinfo double line spacing + if (tag == TAG_MAME || type == MEWUI_SYSINFO_LOAD) + strreplace(buffer, "\n\n", "\n"); + + parseclose(); + } +} + +//------------------------------------------------- +// load a game text into the buffer +//------------------------------------------------- +void datfile_manager::load_data_text(const game_driver *drv, std::string &buffer, dataindex &idx, std::string &tag) +{ + dataindex::iterator itemsiter = idx.find(drv); + if (itemsiter == idx.end()) + { + int cloneof = driver_list::non_bios_clone(*drv); + if (cloneof == -1) + return; + else + { + const game_driver *c_drv = &driver_list::driver(cloneof); + itemsiter = idx.find(c_drv); + if (itemsiter == idx.end()) + return; + } + } + + long s_offset = (*itemsiter).second; + fseek(fp, s_offset, SEEK_SET); + char rbuf[64 * 1024]; + std::string readbuf; + while (fgets(rbuf, 64 * 1024, fp) != nullptr) + { + readbuf = chartrimcarriage(rbuf); + + // end entry when a end tag is encountered + if (readbuf == TAG_END) + break; + + // continue if a specific tag is encountered + if (readbuf == tag) + continue; + + // add this string to the buffer + buffer.append(readbuf).append("\n"); + } +} + +//------------------------------------------------- +// load a driver name and offset into an +// indexed array +//------------------------------------------------- +void datfile_manager::load_driver_text(const game_driver *drv, std::string &buffer, drvindex &idx, std::string &tag) +{ + std::string s(core_filename_extract_base(drv->source_file)); + drvindex::const_iterator index = idx.find(s); + + // if driver not found, return + if (index == idx.end()) + return; + + buffer.append("\n--- DRIVER INFO ---\n").append("Driver: ").append(s).append("\n\n"); + long s_offset = (*index).second; + fseek(fp, s_offset, SEEK_SET); + char rbuf[64 * 1024]; + std::string readbuf; + while (fgets(rbuf, 64 * 1024, fp) != nullptr) + { + readbuf = chartrimcarriage(rbuf); + + // end entry when a end tag is encountered + if (readbuf == TAG_END) + break; + + // continue if a specific tag is encountered + if (readbuf == tag) + continue; + + // add this string to the buffer + buffer.append(readbuf).append("\n"); + } +} + +//------------------------------------------------- +// load a game name and offset into an +// indexed array (mameinfo) +//------------------------------------------------- +int datfile_manager::index_mame_mess_info(dataindex &index, drvindex &index_drv, int &drvcount) +{ + std::string name; + size_t foundtag; + size_t t_mame = TAG_MAMEINFO_R.size(); + size_t t_mess = TAG_MESSINFO_R.size(); + size_t t_info = TAG_INFO.size(); + + char rbuf[64 * 1024]; + std::string readbuf, xid; + while (fgets(rbuf, 64 * 1024, fp) != nullptr) + { + readbuf = chartrimcarriage(rbuf); + if (m_mame_rev.empty() && readbuf.compare(0, t_mame, TAG_MAMEINFO_R) == 0) + { + size_t found = readbuf.find(" ", t_mame + 1); + m_mame_rev = readbuf.substr(t_mame + 1, found - t_mame); + } + else if (m_mess_rev.empty() && (foundtag = readbuf.find(TAG_MESSINFO_R)) != std::string::npos) + { + size_t found = readbuf.find(" ", foundtag + t_mess + 1); + m_mess_rev = readbuf.substr(foundtag + t_mess + 1, found - t_mess - foundtag); + } + else if (readbuf.compare(0, t_info, TAG_INFO) == 0) + { + // TAG_INFO + fgets(rbuf, 64 * 1024, fp); + xid = chartrimcarriage(rbuf); + name = readbuf.substr(t_info + 1); + if (xid == TAG_MAME) + { + // validate driver + int game_index = driver_list::find(name.c_str()); + if (game_index != -1) + index.emplace(&driver_list::driver(game_index), ftell(fp)); + } + else if (xid == TAG_DRIVER) + { + index_drv.emplace(name, ftell(fp)); + drvcount++; + } + } + } + return index.size(); +} + +//------------------------------------------------- +// load a game name and offset into an +// indexed array +//------------------------------------------------- +int datfile_manager::index_datafile(dataindex &index, int &swcount) +{ + std::string readbuf, name; + size_t t_hist = TAG_HISTORY_R.size(); + size_t t_story = TAG_STORY_R.size(); + size_t t_sysinfo = TAG_SYSINFO_R.size(); + size_t t_info = TAG_INFO.size(); + size_t t_bio = TAG_BIO.size(); + char rbuf[64 * 1024]; + while (fgets(rbuf, 64 * 1024, fp) != nullptr) + { + readbuf = chartrimcarriage(rbuf); + + if (m_history_rev.empty() && readbuf.compare(0, t_hist, TAG_HISTORY_R) == 0) + { + size_t found = readbuf.find(" ", t_hist + 1); + m_history_rev = readbuf.substr(t_hist + 1, found - t_hist); + } + else if (m_sysinfo_rev.empty() && readbuf.compare(0, t_sysinfo, TAG_SYSINFO_R) == 0) + { + size_t found = readbuf.find(".", t_sysinfo + 1); + m_sysinfo_rev = readbuf.substr(t_sysinfo + 1, found - t_sysinfo); + } + else if (m_story_rev.empty() && readbuf.compare(0, t_story, TAG_STORY_R) == 0) + m_story_rev = readbuf.substr(t_story + 1); + + // TAG_INFO identifies the driver + else if (readbuf.compare(0, t_info, TAG_INFO) == 0) + { + int curpoint = t_info + 1; + int ends = readbuf.size(); + while (curpoint < ends) + { + // search for comma + size_t found = readbuf.find(",", curpoint); + + // found it + if (found != std::string::npos) + { + // copy data and validate driver + name = readbuf.substr(curpoint, found - curpoint); + + // validate driver + int game_index = driver_list::find(name.c_str()); + if (game_index != -1) + index.emplace(&driver_list::driver(game_index), ftell(fp)); + + // update current point + curpoint = ++found; + } + // if comma not found, copy data while until reach the end of string + else if (curpoint < ends) + { + name = readbuf.substr(curpoint); + int game_index = driver_list::find(name.c_str()); + if (game_index != -1) + index.emplace(&driver_list::driver(game_index), ftell(fp)); + + // update current point + curpoint = ends; + } + } + } + // search for software info + else if (!readbuf.empty() && readbuf[0] == DATAFILE_TAG[0]) + { + fgets(rbuf, 64 * 1024, fp); + std::string readbuf_2(chartrimcarriage(rbuf)); + + // TAG_BIO identifies software list + if (readbuf_2.compare(0, t_bio, TAG_BIO) == 0) + { + size_t eq_sign = readbuf.find("="); + std::string s_list(readbuf.substr(1, eq_sign - 1)); + std::string s_roms(readbuf.substr(eq_sign + 1)); + int ends = s_list.size(); + int curpoint = 0; + + while (curpoint < ends) + { + size_t found = s_list.find(",", curpoint); + + // found it + if (found != std::string::npos) + { + name = s_list.substr(curpoint, found - curpoint); + curpoint = ++found; + } + else + { + name = s_list; + curpoint = ends; + } + + // search for a software list in the index, if not found then allocates + std::string lname(name); + int cpoint = 0; + int cends = s_roms.size(); + + while (cpoint < cends) + { + // search for comma + size_t found = s_roms.find(",", cpoint); + + // found it + if (found != std::string::npos) + { + // copy data + name = s_roms.substr(cpoint, found - cpoint); + + // add a SoftwareItem + m_swindex[lname].emplace(name, ftell(fp)); + + // update current point + cpoint = ++found; + swcount++; + } + else + { + // if reach the end, bail out + if (s_roms[cpoint] == '\r' || s_roms[cpoint] == '\n') + break; + + // copy data + name = s_roms.substr(cpoint); + + // add a SoftwareItem + m_swindex[lname].emplace(name, ftell(fp)); + + // update current point + cpoint = cends; + swcount++; + } + } + } + } + } + } + return index.size(); +} + +//--------------------------------------------------------- +// parseopen - Open up file for reading +//--------------------------------------------------------- +bool datfile_manager::parseopen(const char *filename) +{ + // MAME core file parsing functions fail in recognizing UNICODE chars in UTF-8 without BOM, + // so it's better and faster use standard C fileio functions. + + emu_file file(machine().options().history_path(), OPEN_FLAG_READ); + if (file.open(filename) != FILERR_NONE) + return false; + + m_fullpath = file.fullpath(); + file.close(); + fp = fopen(m_fullpath.c_str(), "rb"); + + fgetc(fp); + fseek(fp, 0, SEEK_SET); + return true; +} + +//------------------------------------------------- +// create the menu index +//------------------------------------------------- +void datfile_manager::index_menuidx(const game_driver *drv, dataindex &idx, drvindex &index) +{ + dataindex::iterator itemsiter = idx.find(drv); + if (itemsiter == idx.end()) + { + int cloneof = driver_list::non_bios_clone(*drv); + if (cloneof == -1) + return; + else + { + const game_driver *c_drv = &driver_list::driver(cloneof); + itemsiter = idx.find(c_drv); + if (itemsiter == idx.end()) + return; + } + } + + // seek to correct point in datafile + long s_offset = (*itemsiter).second; + fseek(fp, s_offset, SEEK_SET); + size_t tinfo = TAG_INFO.size(); + char rbuf[64 * 1024]; + std::string readbuf; + while (fgets(rbuf, 64 * 1024, fp) != nullptr) + { + readbuf = chartrimcarriage(rbuf); + + if (!core_strnicmp(TAG_INFO.c_str(), readbuf.c_str(), tinfo)) + break; + + // TAG_COMMAND identifies the driver + if (readbuf == TAG_COMMAND) + { + fgets(rbuf, 64 * 1024, fp); + chartrimcarriage(rbuf); + index.emplace(rbuf, ftell(fp)); + } + } +} + +//------------------------------------------------- +// load command text into the buffer +//------------------------------------------------- +void datfile_manager::load_command_info(std::string &buffer, std::string &sel) +{ + if (parseopen("command.dat")) + { + // open and seek to correct point in datafile + long offset = m_menuidx.at(sel); + fseek(fp, offset, SEEK_SET); + char rbuf[64 * 1024]; + std::string readbuf; + while (fgets(rbuf, 64 * 1024, fp) != nullptr) + { + readbuf = chartrimcarriage(rbuf); + + // skip separator lines + if (readbuf == TAG_COMMAND_SEPARATOR) + continue; + + // end entry when a tag is encountered + if (readbuf == TAG_END) + break; + + // add this string to the buffer + buffer.append(readbuf).append("\n");; + } + parseclose(); + } +} + +//------------------------------------------------- +// load submenu item for command.dat +//------------------------------------------------- +void datfile_manager::command_sub_menu(const game_driver *drv, std::vector &menuitems) +{ + if (parseopen("command.dat")) + { + m_menuidx.clear(); + index_menuidx(drv, m_cmdidx, m_menuidx); + for (auto & elem : m_menuidx) + menuitems.push_back(elem.first); + parseclose(); + } +} \ No newline at end of file diff --git a/src/emu/ui/datfile.h b/src/emu/ui/datfile.h new file mode 100644 index 00000000000..cb8e5fdcd70 --- /dev/null +++ b/src/emu/ui/datfile.h @@ -0,0 +1,79 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/datfile.h + + MEWUI DATs manager. + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_DATFILE_H__ +#define __MEWUI_DATFILE_H__ + +//------------------------------------------------- +// Datafile Manager +//------------------------------------------------- +class datfile_manager +{ +public: + // construction/destruction + datfile_manager(running_machine &machine); + + // getters + running_machine &machine() const { return m_machine; } + + // actions + void load_data_info(const game_driver *drv, std::string &buffer, int type); + void load_command_info(std::string &buffer, std::string &sel); + void load_software_info(std::string &softlist, std::string &buffer, std::string &softname, std::string &parentname); + void command_sub_menu(const game_driver *drv, std::vector &menuitems); + void reset_run() { first_run = true; } + + std::string rev_history() const { return m_history_rev; } + std::string rev_mameinfo() const { return m_mame_rev; } + std::string rev_messinfo() const { return m_mess_rev; } + std::string rev_sysinfo() const { return m_sysinfo_rev; } + std::string rev_storyinfo() const { return m_story_rev; } + +private: + using drvindex = std::unordered_map; + using dataindex = std::unordered_map; + using swindex = std::unordered_map; + + // global index + static dataindex m_histidx, m_mameidx, m_messidx, m_cmdidx, m_sysidx, m_storyidx; + static drvindex m_drvidx, m_messdrvidx, m_menuidx; + static swindex m_swindex; + + // internal helpers + void init_history(); + void init_mameinfo(); + void init_messinfo(); + void init_command(); + void init_sysinfo(); + void init_storyinfo(); + + // file open/close/seek + bool parseopen(const char *filename); + void parseclose() { if (fp != nullptr) fclose(fp); } + + int index_mame_mess_info(dataindex &index, drvindex &index_drv, int &drvcount); + int index_datafile(dataindex &index, int &swcount); + void index_menuidx(const game_driver *drv, dataindex &idx, drvindex &index); + + void load_data_text(const game_driver *drv, std::string &buffer, dataindex &idx, std::string &tag); + void load_driver_text(const game_driver *drv, std::string &buffer, drvindex &idx, std::string &tag); + + // internal state + running_machine &m_machine; // reference to our machine + std::string m_fullpath; + static std::string m_history_rev, m_mame_rev, m_mess_rev, m_sysinfo_rev, m_story_rev; + FILE *fp = nullptr; + static bool first_run; +}; + + +#endif /* __MEWUI_DATFILE_H__ */ diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp new file mode 100644 index 00000000000..91dbcdcd41c --- /dev/null +++ b/src/emu/ui/datmenu.cpp @@ -0,0 +1,570 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/********************************************************************* + + mewui/datmenu.cpp + + Internal MEWUI user interface. + +*********************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "drivenum.h" +#include "rendfont.h" +#include "ui/datfile.h" +#include "ui/datmenu.h" +#include "ui/utils.h" +#include "softlist.h" + +/************************************************** + MENU COMMAND +**************************************************/ +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_command::ui_menu_command(running_machine &machine, render_container *container, const game_driver *driver) : ui_menu(machine, container) +{ + m_driver = (driver == nullptr) ? &machine.system() : driver; +} + +ui_menu_command::~ui_menu_command() +{ +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_command::populate() +{ + std::vector text; + machine().datfile().command_sub_menu(m_driver, text); + + if (!text.empty()) + { + for (size_t menu_items = 0; menu_items < text.size(); menu_items++) + item_append(text[menu_items].c_str(), nullptr, 0, (void *)(FPTR)menu_items); + } + else + item_append("No available Command for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_command::handle() +{ + // process the menu + const ui_menu_event *m_event = process(0); + + if (m_event != nullptr && m_event->iptkey == IPT_UI_SELECT) + { + std::string m_title(item[selected].text); + ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, m_title, m_driver))); + } +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_command::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + std::string tempbuf = std::string("Command Info - Game: ").append(m_driver->description); + + // get the size of the text + mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + float maxwidth = MAX(width, origx2 - origx1); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + +} + +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_command_content::ui_menu_command_content(running_machine &machine, render_container *container, std::string p_title, const game_driver *driver) : ui_menu(machine, container) +{ + m_driver = (driver == nullptr) ? &machine.system() : driver; + m_title = p_title; +} + +ui_menu_command_content::~ui_menu_command_content() +{ +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_command_content::handle() +{ + // process the menu + process(0); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_command_content::populate() +{ + machine().pause(); + std::string buffer; + machine().datfile().load_command_info(buffer, m_title); + if (!buffer.empty()) + { + float line_height = machine().ui().get_line_height(); + float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); + float gutter_width = lr_arrow_width * 1.3f; + std::vector xstart; + std::vector xend; + int total_lines; + convert_command_glyph(buffer); + machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), + total_lines, xstart, xend); + for (int r = 0; r < total_lines; r++) + { + std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); + int first_dspace = tempbuf.find(" "); + if (first_dspace > 0 ) + { + std::string first_part(tempbuf.substr(0, first_dspace)); + std::string last_part(tempbuf.substr(first_dspace)); + strtrimspace(last_part); + item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_MEWUI_HISTORY, nullptr); + } + else + item_append(tempbuf.c_str(), nullptr, MENU_FLAG_MEWUI_HISTORY, nullptr); + } + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + } + + machine().resume(); + customtop = custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_command_content::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + + // get the size of the text + mui.draw_text_full(container, m_title.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + float maxwidth = MAX(width, origx2 - origx1); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, m_title.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + std::string tempbuf = std::string("Command Info - Game: ").append(m_driver->description); + + mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = origy2 + UI_BOX_TB_BORDER; + y2 = origy2 + bottom; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} + +/************************************************** + MENU SOFTWARE HISTORY +**************************************************/ +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_history_sw::ui_menu_history_sw(running_machine &machine, render_container *container, ui_software_info *swinfo, const game_driver *driver) : ui_menu(machine, container) +{ + m_list = swinfo->listname; + m_short = swinfo->shortname; + m_long = swinfo->longname; + m_parent = swinfo->parentname; + m_driver = (driver == nullptr) ? &machine.system() : driver; +} + +ui_menu_history_sw::ui_menu_history_sw(running_machine &machine, render_container *container, const game_driver *driver) : ui_menu(machine, container) +{ + image_interface_iterator iter(machine.root_device()); + for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) + { + if (image->filename()) + { + m_list = strensure(image->software_list_name()); + m_short = strensure(image->software_entry()->shortname()); + m_long = strensure(image->software_entry()->longname()); + m_parent = strensure(image->software_entry()->parentname()); + } + } + m_driver = (driver == nullptr) ? &machine.system() : driver; +} + +ui_menu_history_sw::~ui_menu_history_sw() +{ +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_history_sw::handle() +{ + // process the menu + process(0); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_history_sw::populate() +{ + machine().pause(); + std::string buffer; + machine().datfile().load_software_info(m_list, buffer, m_short, m_parent); + if (!buffer.empty()) + { + float line_height = machine().ui().get_line_height(); + float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); + float gutter_width = lr_arrow_width * 1.3f; + std::vector xstart; + std::vector xend; + int total_lines; + + machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), + total_lines, xstart, xend); + + for (int r = 0; r < total_lines; r++) + { + std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); + item_append(tempbuf.c_str(), nullptr, MENU_FLAG_MEWUI_HISTORY, nullptr); + } + } + else + item_append("No available History for this software.", nullptr, MENU_FLAG_DISABLE, nullptr); + + machine().resume(); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_history_sw::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + std::string tempbuf = std::string("Software info - ").append(m_long); + ui_manager &mui = machine().ui(); + + // get the size of the text + mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + float maxwidth = MAX(width, origx2 - origx1); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + tempbuf.assign("System driver: ").append(m_driver->description); + + mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = origy2 + UI_BOX_TB_BORDER; + y2 = origy2 + bottom; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} + +/************************************************** + MENU DATS +**************************************************/ +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_dats::ui_menu_dats(running_machine &machine, render_container *container, int _flags, const game_driver *driver) : ui_menu(machine, container) +{ + m_driver = (driver == nullptr) ? &machine.system() : driver; + m_flags = _flags; +} + +ui_menu_dats::~ui_menu_dats() +{ +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_dats::handle() +{ + // process the menu + process(0); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_dats::populate() +{ + machine().pause(); + switch (m_flags) + { + case MEWUI_HISTORY_LOAD: + if (!get_data(m_driver, m_flags)) + item_append("No available History for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); + break; + + case MEWUI_MAMEINFO_LOAD: + if (!get_data(m_driver, m_flags)) + item_append("No available MameInfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); + break; + + case MEWUI_MESSINFO_LOAD: + if (!get_data(m_driver, m_flags)) + item_append("No available MessInfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); + break; + + case MEWUI_STORY_LOAD: + if (!get_data(m_driver, MEWUI_STORY_LOAD)) + item_append("No available Mamescore for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); + break; + + case MEWUI_SYSINFO_LOAD: + if (!get_data(m_driver, MEWUI_SYSINFO_LOAD)) + item_append("No available Sysinfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); + break; + } + + machine().resume(); + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_dats::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + std::string tempbuf, revision; + datfile_manager &datfile = machine().datfile(); + ui_manager &mui = machine().ui(); + + switch (m_flags) + { + case MEWUI_HISTORY_LOAD: + tempbuf.assign("History - Game / System: ").append(m_driver->description); + revision.assign("History.dat Revision: ").append(datfile.rev_history()); + break; + + case MEWUI_MESSINFO_LOAD: + tempbuf.assign("MessInfo - System: ").append(m_driver->description); + revision.assign("Messinfo.dat Revision: ").append(datfile.rev_messinfo()); + break; + + case MEWUI_MAMEINFO_LOAD: + tempbuf.assign("MameInfo - Game: ").append(m_driver->description); + revision.assign("Mameinfo.dat Revision: ").append(datfile.rev_mameinfo()); + break; + + case MEWUI_SYSINFO_LOAD: + tempbuf.assign("Sysinfo - System: ").append(m_driver->description); + revision.assign("Sysinfo.dat Revision: ").append(datfile.rev_sysinfo()); + break; + + case MEWUI_STORY_LOAD: + tempbuf.assign("MAMESCORE - Game: ").append(m_driver->description); + revision.assign("Story.dat Revision: ").append(machine().datfile().rev_storyinfo()); + break; + } + + // get the size of the text + mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + float maxwidth = MAX(width, origx2 - origx1); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + mui.draw_text_full(container, revision.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = origy2 + UI_BOX_TB_BORDER; + y2 = origy2 + bottom; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, revision.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} + +//------------------------------------------------- +// load data from DATs +//------------------------------------------------- + +bool ui_menu_dats::get_data(const game_driver *driver, int flags) +{ + std::string buffer; + machine().datfile().load_data_info(driver, buffer, flags); + + if (buffer.empty()) + return false; + + float line_height = machine().ui().get_line_height(); + float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); + float gutter_width = lr_arrow_width * 1.3f; + std::vector xstart; + std::vector xend; + int tlines; + + machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), tlines, xstart, xend); + for (int r = 0; r < tlines; r++) + { + std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); + // special case for mamescore + if (flags == MEWUI_STORY_LOAD) + { + size_t last_underscore = tempbuf.find_last_of('_'); + if (last_underscore != std::string::npos) + { + std::string last_part(tempbuf.substr(last_underscore + 1)); + int primary = tempbuf.find("___"); + std::string first_part(tempbuf.substr(0, primary)); + item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_MEWUI_HISTORY, nullptr); + } + } + else + item_append(tempbuf.c_str(), nullptr, MENU_FLAG_MEWUI_HISTORY, nullptr); + } + return true; +} diff --git a/src/emu/ui/datmenu.h b/src/emu/ui/datmenu.h new file mode 100644 index 00000000000..9df45d57190 --- /dev/null +++ b/src/emu/ui/datmenu.h @@ -0,0 +1,93 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/datmenu.h + + Internal MEWUI user interface. + + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_DATMENU_H__ +#define __MEWUI_DATMENU_H__ + +struct ui_software_info; + +//------------------------------------------------- +// class dats menu +//------------------------------------------------- + +class ui_menu_dats : public ui_menu +{ +public: + ui_menu_dats(running_machine &machine, render_container *container, int _flags, const game_driver *driver = nullptr); + virtual ~ui_menu_dats(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + const game_driver *m_driver; + int m_flags; + + bool get_data(const game_driver *driver, int flags); +}; + +//------------------------------------------------- +// class command data menu +//------------------------------------------------- + +class ui_menu_command : public ui_menu +{ +public: + ui_menu_command(running_machine &machine, render_container *container, const game_driver *driver = nullptr); + virtual ~ui_menu_command(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + const game_driver *m_driver; +}; + +//------------------------------------------------- +// class command content data menu +//------------------------------------------------- + +class ui_menu_command_content : public ui_menu +{ +public: + ui_menu_command_content(running_machine &machine, render_container *container, std::string title, const game_driver *driver = nullptr); + virtual ~ui_menu_command_content(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + const game_driver *m_driver; + std::string m_title; +}; + +//------------------------------------------------- +// class software history menu +//------------------------------------------------- + +class ui_menu_history_sw : public ui_menu +{ +public: + ui_menu_history_sw(running_machine &machine, render_container *container, ui_software_info *swinfo, const game_driver *driver = nullptr); + ui_menu_history_sw(running_machine &machine, render_container *container, const game_driver *driver = nullptr); + virtual ~ui_menu_history_sw(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + std::string m_list, m_short, m_long, m_parent; + const game_driver *m_driver; +}; + +#endif /* __MEWUI_DATMENU_H__ */ diff --git a/src/emu/ui/defimg.h b/src/emu/ui/defimg.h new file mode 100644 index 00000000000..43b334b8f93 --- /dev/null +++ b/src/emu/ui/defimg.h @@ -0,0 +1,261 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +static const UINT32 no_avail_bmp[] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x01231f20, 0x04231f20, 0x11231f20, 0x2e231f20, 0x62231f20, 0x8e231f20, 0xb4231f20, 0xd4231f20, 0xe5231f20, 0xf2231f20, 0xfd231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfd231f20, 0xf2231f20, 0xe5231f20, 0xd4231f20, 0xb4231f20, 0x8e231f20, 0x62231f20, 0x2e231f20, 0x11231f20, 0x04231f20, 0x01231f20, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00231f20, 0x00000000, 0x00000000, 0x06231f20, 0x1c231f20, 0x49231f20, 0x8c231f20, 0xc4231f20, 0xf0231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf0231f20, 0xc4231f20, 0x8c231f20, 0x49231f20, 0x1c231f20, 0x06231f20, 0x00000000, 0x00000000, 0x00231f20, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x04231f20, 0x32231f20, 0x7b231f20, 0xc2231f20, 0xf3231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf3231f20, 0xc2231f20, 0x7b231f20, 0x32231f20, 0x04231f20, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x30231f20, 0x8e231f20, 0xd6231f20, 0xfd231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfd231f20, 0xd6231f20, 0x8e231f20, 0x30231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x0e231f20, 0x73231f20, 0xd8231f20, 0xfb231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfb231f20, 0xd8231f20, 0x73231f20, 0x0e231f20, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00231f20, 0x00000000, 0x29231f20, 0xb6231f20, 0xfb231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfb231f20, 0xb6231f20, 0x29231f20, 0x00000000, 0x00231f20, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x03231f20, 0x4f231f20, 0xdd231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xdd231f20, 0x4f231f20, 0x03231f20, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x0a231f20, 0x72231f20, 0xf4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf4231f20, 0x72231f20, 0x0a231f20, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x10231f20, 0x84231f20, 0xf5231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1a1b, 0xff1e191a, 0xff1e1a1b, 0xff211c1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf5231f20, 0x84231f20, 0x10231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x0a231f20, 0x84231f20, 0xf5231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff1c1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1d191a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff1b1718, 0xff1b1718, 0xff1c1819, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff393637, 0xff7c7a7a, 0xff827f80, 0xff7d7b7c, 0xff494647, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf5231f20, 0x84231f20, 0x0a231f20, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x03231f20, 0x74231f20, 0xf5231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff3b3839, 0xff585656, 0xff5a5757, 0xff5a5757, 0xff5b5858, 0xff4b4949, 0xff272325, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff464243, 0xff5a5858, 0xff5a5758, 0xff565253, 0xff312d2e, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff575355, 0xffececec, 0xfff7f7f7, 0xffededed, 0xff7a7878, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf5231f20, 0x74231f20, 0x03231f20, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x51231f20, 0xf4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff807d7e, 0xfff1f1f1, 0xfff6f6f6, 0xfff6f6f6, 0xfff9f9f9, 0xffe1e0e0, 0xff565354, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffa9a7a7, 0xfff6f6f6, 0xfff6f6f6, 0xffe6e6e6, 0xff575455, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf4231f20, 0x51231f20, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x2a231f20, 0xde231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff848283, 0xfff7f7f7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa6a4a5, 0xff2c2729, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffedecec, 0xff5a5758, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff595556, 0xfff6f6f6, 0xffffffff, 0xfff6f6f6, 0xff7e7c7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xde231f20, 0x2a231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x0e231f20, 0xb5231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff0f0f0, 0xff585556, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff524f50, 0xffdbdbdb, 0xffe5e4e5, 0xffdcdbdb, 0xff737071, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xb5231f20, 0x0e231f20, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, + 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x73231f20, 0xfb231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffb4b3b4, 0xff282425, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2e2b2c, 0xff4f4c4d, 0xff524f50, 0xff504d4e, 0xff363334, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfb231f20, 0x73231f20, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, + 0x00000000, 0x00231f20, 0x00000000, 0x30231f20, 0xd8231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfffdfdfd, 0xffededed, 0xfffdfdfd, 0xffffffff, 0xfff9fafa, 0xff646162, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1a1b, 0xff1e1a1b, 0xff1e1a1b, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xd8231f20, 0x30231f20, 0x00000000, 0x00231f20, 0x00000000, + 0x00231f20, 0x00000000, 0x05231f20, 0x8e231f20, 0xfa231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xffadacac, 0xffdbdbdb, 0xffffffff, 0xffffffff, 0xffc8c7c7, 0xff2b2628, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff1c1718, 0xff1a1617, 0xff1b1718, 0xff1b1718, 0xff1a1617, 0xff1d191a, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1d191a, 0xff1a1617, 0xff1b1718, 0xff1a1617, 0xff1b1718, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1c1819, 0xff1a1517, 0xff1b1718, 0xff1a1517, 0xff1c1719, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff1c1819, 0xff191516, 0xff1a1617, 0xff1a1617, 0xff191516, 0xff1b1718, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1c1819, 0xff1a1617, 0xff1b1718, 0xff1a1617, 0xff1a1617, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff1d191a, 0xff1a1516, 0xff1a1617, 0xff1b1718, 0xff191516, 0xff1b1718, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfa231f20, 0x8e231f20, 0x05231f20, 0x00000000, 0x00231f20, + 0x00000000, 0x00000000, 0x32231f20, 0xd8231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff7f7f7, 0xff858384, 0xff949393, 0xfffdfefd, 0xffffffff, 0xfffdfdfd, 0xff767475, 0xff1c1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff252122, 0xff413e3f, 0xff6e6c6c, 0xff8f8d8d, 0xff9c9b9b, 0xff9b9999, 0xff898787, 0xff646061, 0xff383435, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff292526, 0xff393637, 0xff3b3839, 0xff3a3738, 0xff2c292a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231e1f, 0xff2f2b2c, 0xff3a3738, 0xff3b3839, 0xff393536, 0xff282425, 0xff221e1f, 0xff201c1d, 0xff302d2e, 0xff5f5c5d, 0xff8a8788, 0xff9b9a9a, 0xff989797, 0xff7c7a7a, 0xff454243, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff373334, 0xff666465, 0xff8e8c8c, 0xff9b999a, 0xff918f8f, 0xff716f6f, 0xff3b3839, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff231f20, 0xff302c2d, 0xff4e4a4b, 0xff706e6f, 0xff8b898a, 0xff999797, 0xff999797, 0xff8e8c8d, 0xff767374, 0xff494646, 0xff2b2728, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff332f30, 0xff636061, 0xff8d8b8b, 0xff9c9a9b, 0xff989697, 0xff807f7f, 0xff524f4f, 0xff2a2627, 0xff211d1e, 0xff221e1f, 0xff2e2a2b, 0xff3b3738, 0xff3b3839, 0xff383536, 0xff292526, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff393636, 0xff646162, 0xff878485, 0xff989697, 0xff9d9b9b, 0xff908e8e, 0xff716e6e, 0xff423f3f, 0xff252122, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xd8231f20, 0x32231f20, 0x00000000, 0x00000000, + 0x00000000, 0x06231f20, 0x7c231f20, 0xfc231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7b797a, 0xff4a4647, 0xffdedede, 0xffffffff, 0xffffffff, 0xffd1d0d1, 0xff363233, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff252122, 0xff504e4f, 0xffaaa9a9, 0xffececed, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe1e0e1, 0xff949293, 0xff403c3d, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1718, 0xff555253, 0xffe9e9e9, 0xfff4f4f4, 0xffebebeb, 0xff787676, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff8b898a, 0xffeff0f0, 0xfff3f3f3, 0xffdddddd, 0xff4c4a4a, 0xff242021, 0xff716f6f, 0xffd4d2d3, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff0f0f0, 0xff9c9b9c, 0xff393536, 0xff201c1d, 0xff231f20, 0xff211d1e, 0xff322f30, 0xff848282, 0xffe0dede, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff838182, 0xff2f2b2c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff2b2728, 0xff605d5e, 0xffa2a1a1, 0xffd8d7d7, 0xfff7f7f7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff6f5f5, 0xffc4c3c3, 0xff6c696a, 0xff2d292a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2f2b2c, 0xff7c797a, 0xffd9d8d8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff8f7f7, 0xffbdbcbc, 0xff5a5757, 0xff1f1a1b, 0xff817e7f, 0xfff2f1f1, 0xfff3f2f2, 0xffdedede, 0xff524e4f, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff242021, 0xff474344, 0xff9a9899, 0xffe3e2e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffeeedee, 0xffaaa9a9, 0xff4e4b4b, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfc231f20, 0x7c231f20, 0x06231f20, 0x00000000, + 0x00000000, 0x1c231f20, 0xc3231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7e7c7d, 0xff1d181a, 0xff9a9898, 0xfffbfbfb, 0xffffffff, 0xfff9f9f9, 0xff848182, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff272324, 0xff7d7a7b, 0xffe9e9e9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xfffdfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd4d3d4, 0xff605d5e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff595656, 0xfff7f7f7, 0xffffffff, 0xfff7f7f7, 0xff7e7c7d, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff939191, 0xfffbfbfb, 0xffffffff, 0xffeae9e9, 0xff5d5a5b, 0xff8c8a8a, 0xfff8f7f7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffbab9b9, 0xff3b3738, 0xff1b1718, 0xff3c3939, 0xffb3b2b2, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffffefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xff959293, 0xff2b2728, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff484445, 0xffe6e6e6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfefe, 0xfffafafa, 0xfffcfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff8f8f8, 0xff9d9b9b, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff383435, 0xffa7a6a6, 0xfffefdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xfff8f8f8, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffe7e7e7, 0xff696767, 0xff8b8989, 0xfffcfcfc, 0xffffffff, 0xffeaeaea, 0xff555253, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff262222, 0xff727071, 0xffdedede, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e4e4, 0xff757273, 0xff252122, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xc3231f20, 0x1c231f20, 0x00000000, + 0x01231f20, 0x49231f20, 0xf4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff807d7e, 0xff161213, 0xff474444, 0xffdfdedf, 0xffffffff, 0xffffffff, 0xffd1d0d0, 0xff413d3e, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff828080, 0xfff4f3f3, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xffcecdcd, 0xff9c9a9a, 0xff868585, 0xff8a8787, 0xffa6a4a4, 0xffdddcdc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe0dfe0, 0xff5f5c5d, 0xff1f1b1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffececec, 0xffadabac, 0xfff2f2f2, 0xffffffff, 0xffd3d2d2, 0xffa6a4a5, 0xff908e8f, 0xff929191, 0xffb4b3b3, 0xffeeeeee, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xff959394, 0xff363333, 0xffb0afb0, 0xffffffff, 0xfffafafa, 0xffc9c8c9, 0xffa09e9f, 0xff8f8c8d, 0xff969494, 0xffbdbcbc, 0xfff6f5f6, 0xffffffff, 0xffffffff, 0xfff7f7f7, 0xff686667, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff4b4949, 0xffefeeef, 0xffffffff, 0xffdddddd, 0xffbab9ba, 0xff9e9c9d, 0xff8b898a, 0xff848182, 0xff868484, 0xff999797, 0xffbebdbe, 0xfff0f0ef, 0xffffffff, 0xffffffff, 0xffffffff, 0xff949293, 0xff262223, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2e2a2b, 0xff9f9d9e, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xfff1f1f1, 0xffb7b5b6, 0xff8d8b8c, 0xff7f7c7d, 0xff878586, 0xffaaa8a9, 0xffe2e1e2, 0xffffffff, 0xffdbdbdb, 0xffbcbbbb, 0xfffcfcfc, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff221e1f, 0xff807e7e, 0xfff0f0f0, 0xffffffff, 0xffffffff, 0xfff7f7f7, 0xffcac9c9, 0xff9e9c9c, 0xff888686, 0xff858282, 0xff959393, 0xffc0bfbf, 0xfff5f5f5, 0xffffffff, 0xffffffff, 0xffecebeb, 0xff726f70, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf4231f20, 0x49231f20, 0x01231f20, + 0x04231f20, 0x8c231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff807d7e, 0xff1b1718, 0xff1e191a, 0xff8f8d8e, 0xffffffff, 0xffffffff, 0xfff9f9f9, 0xff888687, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d1a1b, 0xff5c5959, 0xffe6e5e5, 0xffffffff, 0xffffffff, 0xfff6f5f6, 0xff979495, 0xff3f3c3c, 0xff272424, 0xff221f20, 0xff221e1f, 0xff2b2728, 0xff4d494a, 0xffb6b5b5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc9c8c8, 0xff3f3b3c, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xfffcfcfc, 0xfff9f9f9, 0xfff4f4f4, 0xff918e8f, 0xff413e3f, 0xff2b2728, 0xff242021, 0xff242021, 0xff2d2a2a, 0xff6c6a6a, 0xffeae9e9, 0xffffffff, 0xffffffff, 0xffdcdcdc, 0xffb1afb0, 0xfff7f7f7, 0xffececec, 0xff7b797a, 0xff393536, 0xff292526, 0xff231f20, 0xff262223, 0xff343031, 0xff7f7d7d, 0xfff4f4f4, 0xffffffff, 0xffffffff, 0xffc1c0c0, 0xff292526, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff454243, 0xffb1afb0, 0xff7e7b7c, 0xff494647, 0xff332f30, 0xff292526, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff272224, 0xff343031, 0xff656263, 0xffd1d0d0, 0xffffffff, 0xffffffff, 0xfff2f2f2, 0xff545152, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff6c6a6b, 0xfff1f1f1, 0xffffffff, 0xffffffff, 0xffe4e3e4, 0xff6b6869, 0xff302c2d, 0xff241f20, 0xff221e1f, 0xff221e1f, 0xff2c2829, 0xff565253, 0xffc2c2c2, 0xffffffff, 0xfff8f8f8, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191b, 0xff666264, 0xffe9e8e9, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff7b7879, 0xff3b3738, 0xff282425, 0xff221e1f, 0xff221e1f, 0xff252122, 0xff353132, 0xff777575, 0xffe9e9e9, 0xffffffff, 0xffffffff, 0xffd5d4d4, 0xff4a4647, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0x8c231f20, 0x04231f20, + 0x11231f20, 0xc4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff1f1b1c, 0xff383535, 0xffdcdbdb, 0xffffffff, 0xffffffff, 0xffd3d3d3, 0xff434041, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2c2829, 0xffb0afaf, 0xfffefefe, 0xffffffff, 0xfffcfcfc, 0xff9e9d9d, 0xff282525, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff383435, 0xffc7c7c7, 0xffffffff, 0xffffffff, 0xfff8f8f8, 0xff848383, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffffffff, 0xfffaf9f9, 0xff918f8f, 0xff2a2627, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1a1b, 0xff8a8889, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xfffdfdfd, 0xfff6f7f7, 0xff6b6969, 0xff211d1e, 0xff221d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2a2727, 0xffa3a1a1, 0xffffffff, 0xffffffff, 0xfff6f6f6, 0xff4d4a4b, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff282425, 0xff302c2d, 0xff242021, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231e1f, 0xff221e1f, 0xff221e1f, 0xff524f4f, 0xffdddddd, 0xffffffff, 0xffffffff, 0xffa5a4a4, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff312d2e, 0xffbfbebe, 0xffffffff, 0xffffffff, 0xfff5f4f5, 0xff625f60, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff4b4849, 0xffd5d4d4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff363333, 0xffc1c1c1, 0xffffffff, 0xffffffff, 0xffededed, 0xff666464, 0xff211d1e, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1f1b1c, 0xff706e6e, 0xfff9f9f9, 0xffffffff, 0xfffdfdfd, 0xff908e8f, 0xff272223, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xc4231f20, 0x11231f20, + 0x2e231f20, 0xf0231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff1c1819, 0xff7d7b7b, 0xffffffff, 0xffffffff, 0xffffffff, 0xff8a8788, 0xff252122, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff535051, 0xffe2e1e1, 0xffffffff, 0xffffffff, 0xffd9d9d9, 0xff393636, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff5b5859, 0xfff5f5f5, 0xffffffff, 0xffffffff, 0xffc4c3c3, 0xff383435, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffffffff, 0xffcbcacb, 0xff3b3839, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff3f3b3c, 0xffeeedee, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa6a5a5, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221f1f, 0xff615e5e, 0xfff2f2f2, 0xffffffff, 0xffffffff, 0xff797677, 0xff1b1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff262223, 0xff939191, 0xffffffff, 0xffffffff, 0xffdedede, 0xff2f2b2c, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff575354, 0xfff5f5f5, 0xffffffff, 0xffffffff, 0xffa1a09f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201d1e, 0xff817f81, 0xfff5f5f5, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211c1e, 0xff6c696a, 0xffefefef, 0xffffffff, 0xffffffff, 0xff989797, 0xff1d191a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xffb1b0b0, 0xffffffff, 0xffffffff, 0xffcccbcb, 0xff3b3738, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf0231f20, 0x2e231f20, + 0x62231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff211d1e, 0xff2f2c2d, 0xffcdcdcd, 0xffffffff, 0xffffffff, 0xffdddddd, 0xff423f40, 0xff211d1e, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff7d7b7b, 0xfff9f9f9, 0xffffffff, 0xffffffff, 0xff8f8e8e, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffbdbcbd, 0xffffffff, 0xffffffff, 0xffeaeaea, 0xff565353, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xfff9f9f9, 0xff918f90, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff282425, 0xffcdcccc, 0xffffffff, 0xffffffff, 0xfff7f7f7, 0xff5d5b5b, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff474444, 0xffdad9d9, 0xffffffff, 0xffffffff, 0xff999898, 0xff1b1618, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff1f1b1c, 0xff696768, 0xfff0f0ef, 0xffffffff, 0xfff5f5f5, 0xff4c494a, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff8a8989, 0xffffffff, 0xffffffff, 0xfff7f7f7, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff454242, 0xffdedede, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2a2627, 0xffa19fa0, 0xffffffff, 0xffffffff, 0xffeeeded, 0xff444040, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff626060, 0xffffffff, 0xffffffff, 0xffeeeeee, 0xff575354, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0x62231f20, + 0x8e231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff6e6b6b, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xff959394, 0xff211d1e, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff2a2627, 0xffa09f9f, 0xffffffff, 0xffffffff, 0xfff8f8f8, 0xff535051, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1a1617, 0xff7e7b7c, 0xffffffff, 0xffffffff, 0xfffefefe, 0xff737172, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xfff2f2f1, 0xff686666, 0xff1c1719, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xffb7b5b5, 0xffffffff, 0xffffffff, 0xffdbdbdb, 0xff423f3f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff3b3738, 0xffcecdcd, 0xffffffff, 0xffffffff, 0xffa7a6a6, 0xff1e1a1b, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff1f1b1c, 0xff2c2729, 0xff3b3839, 0xff4c4849, 0xff575455, 0xff5c595a, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5d5a5b, 0xff8b898a, 0xffefefef, 0xffffffff, 0xfffbfbfb, 0xff646162, 0xff1b1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xffb2b1b2, 0xffffffff, 0xffffffff, 0xffd5d4d4, 0xff373435, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff272324, 0xffbebdbd, 0xfffefefe, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff383435, 0xffc7c7c7, 0xffffffff, 0xffffffff, 0xffc3c2c2, 0xff201c1d, 0xff1d191a, 0xff1f1b1c, 0xff1e1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1c1819, 0xff3a3738, 0xffeeeeee, 0xffffffff, 0xffffffff, 0xff706e6e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0x8e231f20, + 0xb4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff312e2e, 0xffbcbbbb, 0xffffffff, 0xffffffff, 0xffebebeb, 0xff4a4748, 0xff1e1a1b, 0xff221e1f, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff302d2e, 0xffb9b8b9, 0xffffffff, 0xffffffff, 0xffe6e6e6, 0xff343031, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff565254, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xff8f8c8d, 0xff252122, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffededed, 0xff575454, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201d1e, 0xffafadae, 0xffffffff, 0xffffffff, 0xffcac9ca, 0xff373334, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff383535, 0xffc9c8c8, 0xffffffff, 0xffffffff, 0xffafadae, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1a1b, 0xff393536, 0xff777475, 0xffacaaaa, 0xffcccacb, 0xffdddddc, 0xffe5e5e5, 0xffe9e9e9, 0xffebebeb, 0xffebebeb, 0xffebebeb, 0xffebeaeb, 0xfff0f0f0, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xff706d6e, 0xff191516, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2c292a, 0xffcccbcc, 0xffffffff, 0xffffffff, 0xffbab9b9, 0xff2b2829, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xffa2a0a0, 0xfffcfcfc, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff484445, 0xffdcdcdc, 0xffffffff, 0xffffffff, 0xffc8c7c8, 0xff716f6f, 0xff747172, 0xff747273, 0xff747273, 0xff757273, 0xff757273, 0xff757273, 0xff767373, 0xff757374, 0xff767374, 0xff757273, 0xff828081, 0xffeeedee, 0xffffffff, 0xffffffff, 0xff858283, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xb4231f20, + 0xd4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff686566, 0xfff1f1f1, 0xffffffff, 0xffffffff, 0xffabaaaa, 0xff211c1d, 0xff211d1e, 0xff221e1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff343031, 0xffc6c5c5, 0xffffffff, 0xffffffff, 0xffd4d4d4, 0xff2a2627, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff413e3f, 0xfff6f6f5, 0xffffffff, 0xffffffff, 0xff9f9e9e, 0xff272223, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffe9e9e9, 0xff524e4f, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffadabac, 0xffffffff, 0xffffffff, 0xffc4c3c4, 0xff322f30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373435, 0xffc8c7c7, 0xffffffff, 0xffffffff, 0xffb0aeaf, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff5d5a5b, 0xffc8c7c8, 0xfff3f3f3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff777475, 0xff181415, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff322e2f, 0xffdbdada, 0xffffffff, 0xffffffff, 0xffaeacac, 0xff282425, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1d191a, 0xff908e8f, 0xfffbfbfb, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff545151, 0xffe9e9e9, 0xffffffff, 0xffffffff, 0xfff9f9f9, 0xfff1f1f1, 0xfff2f1f2, 0xfff2f1f2, 0xfff2f1f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff3f3f3, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xff8d8c8c, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xd4231f20, + 0xe5231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff322e2f, 0xffb6b5b5, 0xffffffff, 0xffffffff, 0xfff3f3f3, 0xff5a5858, 0xff1a1617, 0xff221f1f, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373434, 0xffcac9c9, 0xffffffff, 0xffffffff, 0xffcbcacb, 0xff282425, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff3b3738, 0xfff2f1f2, 0xffffffff, 0xffffffff, 0xffa5a4a4, 0xff262223, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffe9e9e9, 0xff514d4f, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffadacad, 0xffffffff, 0xffffffff, 0xffc4c3c3, 0xff322e30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373435, 0xffc8c7c7, 0xffffffff, 0xffffffff, 0xffb0aeaf, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff565454, 0xffe2e1e1, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff3f3f3, 0xffd1d0d0, 0xffb3b1b1, 0xffa19f9f, 0xff989696, 0xff939191, 0xff929091, 0xff918f90, 0xffafaeaf, 0xfff4f4f4, 0xffffffff, 0xffffffff, 0xff777475, 0xff181415, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff322f30, 0xffdfdede, 0xffffffff, 0xffffffff, 0xffa9a7a8, 0xff282425, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1c1819, 0xff8b8989, 0xfffbfbfb, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff595758, 0xfff0efef, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff929091, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xe5231f20, + 0xf2231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff676566, 0xffececec, 0xffffffff, 0xffffffff, 0xffb9b8b8, 0xff262223, 0xff201c1c, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff353233, 0xffc7c6c7, 0xffffffff, 0xffffffff, 0xffd2d1d1, 0xff2a2627, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff3f3b3c, 0xfff5f5f5, 0xffffffff, 0xffffffff, 0xffa2a0a1, 0xff262223, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffe9e9e9, 0xff514d4f, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffadacad, 0xffffffff, 0xffffffff, 0xffc4c3c3, 0xff322e30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373435, 0xffc8c7c7, 0xffffffff, 0xffffffff, 0xffb0aeaf, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2e2a2b, 0xffc2c1c1, 0xffffffff, 0xffffffff, 0xfff5f4f4, 0xff9b9a9a, 0xff464344, 0xff2a2627, 0xff221e1f, 0xff1d191a, 0xff1c1819, 0xff1c1819, 0xff1c1819, 0xff1a1516, 0xff5c595a, 0xffe9e8e9, 0xffffffff, 0xffffffff, 0xff777475, 0xff181415, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff302c2d, 0xffd7d7d7, 0xffffffff, 0xffffffff, 0xffb1b0b0, 0xff292526, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e191a, 0xff959393, 0xfffcfcfc, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff585556, 0xffeeedee, 0xffffffff, 0xffffffff, 0xffc1c0c0, 0xff848282, 0xff898788, 0xff898788, 0xff898788, 0xff898788, 0xff898788, 0xff898788, 0xff898788, 0xff898788, 0xff898788, 0xff898788, 0xff898788, 0xff898788, 0xff898788, 0xff8b898a, 0xff565253, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf2231f20, + 0xfd231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff2c2829, 0xffb6b5b5, 0xfffefefe, 0xffffffff, 0xfff1f1f1, 0xff666364, 0xff1c1819, 0xffafadad, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff312e2f, 0xffbdbcbd, 0xffffffff, 0xffffffff, 0xffe1e0e1, 0xff302c2d, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff4f4b4c, 0xfffaf9f9, 0xffffffff, 0xffffffff, 0xff949292, 0xff262223, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffe9e9e9, 0xff514d4f, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffadacad, 0xffffffff, 0xffffffff, 0xffc4c3c3, 0xff322e30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373435, 0xffc8c7c7, 0xffffffff, 0xffffffff, 0xffb0aeaf, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff5d5a5b, 0xfffffefe, 0xffffffff, 0xfffefefe, 0xff8c898a, 0xff201c1d, 0xff1d191a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff6a6768, 0xffefefef, 0xffffffff, 0xffffffff, 0xff777475, 0xff181415, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2a2627, 0xffc6c5c5, 0xffffffff, 0xffffffff, 0xffc1c0c0, 0xff2e2a2b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xffa9a8a8, 0xfffdfdfd, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff4f4c4d, 0xffe4e4e4, 0xffffffff, 0xffffffff, 0xff999797, 0xff100c0d, 0xff181415, 0xff181415, 0xff181415, 0xff181415, 0xff181415, 0xff181415, 0xff181415, 0xff181415, 0xff181415, 0xff181415, 0xff181415, 0xff181415, 0xff181415, 0xff171314, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfd231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff5f5d5d, 0xffeeeeee, 0xffffffff, 0xfffefefe, 0xffb9b7b8, 0xff302d2e, 0xffacabab, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff2c2829, 0xffa8a6a6, 0xffffffff, 0xffffffff, 0xfff4f4f4, 0xff494647, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff726f70, 0xffffffff, 0xffffffff, 0xffffffff, 0xff7a7878, 0xff241f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffe9e9e9, 0xff514d4f, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffadacad, 0xffffffff, 0xffffffff, 0xffc4c3c3, 0xff322e30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373435, 0xffc8c7c7, 0xffffffff, 0xffffffff, 0xffb0aeaf, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff908e8e, 0xffffffff, 0xffffffff, 0xffdcdbdb, 0xff434041, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff7f7c7d, 0xfff9f9f9, 0xffffffff, 0xffffffff, 0xff777475, 0xff181415, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xffa8a6a7, 0xffffffff, 0xffffffff, 0xffe0dfdf, 0xff3f3b3c, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff2d2a2b, 0xffc8c8c8, 0xfffefefe, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff3f3c3d, 0xffd3d2d2, 0xffffffff, 0xffffffff, 0xffc7c5c6, 0xff262223, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242021, 0xffaeacad, 0xffffffff, 0xffffffff, 0xffeeeeee, 0xff6c6a6a, 0xffadabab, 0xfffdfdfd, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242121, 0xff868484, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xff7e7b7c, 0xff191516, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1a1b, 0xffacaaab, 0xffffffff, 0xffffffff, 0xfff0f0f0, 0xff5d595a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffe9e9e9, 0xff514d4f, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffadacad, 0xffffffff, 0xffffffff, 0xffc4c3c3, 0xff322e30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373435, 0xffc8c7c7, 0xffffffff, 0xffffffff, 0xffb0aeaf, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xffa7a5a6, 0xffffffff, 0xffffffff, 0xffc6c5c5, 0xff343132, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff2b2829, 0xffa9a8a8, 0xffffffff, 0xffffffff, 0xffffffff, 0xff777475, 0xff181415, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff7b7878, 0xffffffff, 0xffffffff, 0xfffefefe, 0xff696667, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff555153, 0xffe6e5e5, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2f2b2c, 0xffb2b1b1, 0xffffffff, 0xffffffff, 0xfff1f1f1, 0xff4a4748, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff4e4a4b, 0xffefeeee, 0xffffffff, 0xffffffff, 0xffbcbbbb, 0xffc1c0c1, 0xfffcfcfc, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff5d5a5b, 0xffe9e8e9, 0xffffffff, 0xffffffff, 0xffc7c6c6, 0xff2b2627, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff464243, 0xffebebeb, 0xffffffff, 0xffffffff, 0xffcfcece, 0xff3e3a3b, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffe9e9e9, 0xff514d4f, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffadacad, 0xffffffff, 0xffffffff, 0xffc4c3c3, 0xff322e30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373435, 0xffc8c7c7, 0xffffffff, 0xffffffff, 0xffb0aeaf, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xffa8a6a6, 0xffffffff, 0xffffffff, 0xffcbcaca, 0xff383435, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff4e4b4b, 0xffe3e2e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xff777475, 0xff181415, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff484546, 0xffe8e8e8, 0xffffffff, 0xffffffff, 0xffc3c2c2, 0xff292627, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff262223, 0xff9e9c9c, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff7f7c7d, 0xfff8f7f8, 0xffffffff, 0xffffffff, 0xffa3a1a1, 0xff1e1a1c, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff9c9a9a, 0xffffffff, 0xffffffff, 0xfff5f5f5, 0xfff0f0f0, 0xfffefefe, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff343031, 0xffbfbebe, 0xffffffff, 0xffffffff, 0xfff8f8f8, 0xff807e7f, 0xff1d191a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff262223, 0xffafadae, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xff949293, 0xff272324, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffe9e9e9, 0xff514d4f, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffadacad, 0xffffffff, 0xffffffff, 0xffc4c3c3, 0xff322e30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373435, 0xffc8c7c7, 0xffffffff, 0xffffffff, 0xffb0aeaf, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff949192, 0xffffffff, 0xffffffff, 0xffecebec, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2c2829, 0xffb1afaf, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff777475, 0xff181415, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff2a2627, 0xffa6a4a5, 0xffffffff, 0xffffffff, 0xffffffff, 0xff939192, 0xff201c1d, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff211d1e, 0xff6c6a6a, 0xffebebeb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff444041, 0xffd5d4d4, 0xffffffff, 0xffffffff, 0xfff0f0f0, 0xff716e6f, 0xff1d191a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff221e1f, 0xff2d292a, 0xff252122, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff403d3e, 0xffe4e4e4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff706d6e, 0xfff0eff0, 0xffffffff, 0xffffffff, 0xffe9e9e9, 0xff706e6f, 0xff282425, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff302c2d, 0xff969494, 0xfffafaf9, 0xffffffff, 0xffffffff, 0xffdad9d9, 0xff4d494a, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffe9e9e9, 0xff514d4f, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffadacad, 0xffffffff, 0xffffffff, 0xffc4c3c3, 0xff322e30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373435, 0xffc8c7c7, 0xffffffff, 0xffffffff, 0xffb0aeaf, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xfffdfcfc, 0xffffffff, 0xffffffff, 0xffbbb9b9, 0xff3a3738, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff373334, 0xffa5a3a3, 0xffffffff, 0xfffefefe, 0xfffefefe, 0xffffffff, 0xffffffff, 0xff777475, 0xff181415, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff534f50, 0xffe0dfe0, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xffa2a0a1, 0xff433f40, 0xff2a2627, 0xff252122, 0xff282425, 0xff3a3738, 0xff807d7e, 0xffeaeaea, 0xfffefefe, 0xffeeeded, 0xfffefefe, 0xffffffff, 0xffe9e8e8, 0xff555252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201b1c, 0xff7e7b7c, 0xfff3f3f3, 0xffffffff, 0xffffffff, 0xffe9e9e9, 0xff7c7a7a, 0xff302c2d, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff242021, 0xff2e2a2b, 0xff4f4c4d, 0xff9f9e9f, 0xff9c9a9b, 0xff2f2b2c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231e1f, 0xff1e1b1c, 0xff848282, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xff7f7d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff8b898a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffececec, 0xff595658, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff272425, 0xffa3a1a1, 0xfffafafa, 0xffffffff, 0xffffffff, 0xfff3f2f3, 0xffaaa9a9, 0xff6c6a6a, 0xff585556, 0xff5b5859, 0xff797677, 0xffc2c1c1, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffefeeee, 0xff7b7979, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xfff5f5f5, 0xffffffff, 0xfff5f5f5, 0xff7d7b7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff929090, 0xfffafafa, 0xffffffff, 0xffe9e9e9, 0xff514d4f, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffadacad, 0xffffffff, 0xffffffff, 0xffc4c3c3, 0xff322e30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373435, 0xffc8c7c7, 0xffffffff, 0xffffffff, 0xffb0aeaf, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2e2a2b, 0xffc4c3c3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcccccc, 0xff7b7878, 0xff575354, 0xff524e4f, 0xff5c595a, 0xff848282, 0xffd2d1d1, 0xffffffff, 0xfff5f5f5, 0xffcbcbcb, 0xffeeeeee, 0xffffffff, 0xffffffff, 0xff777475, 0xff181415, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff242021, 0xff7c797a, 0xffedeced, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xffbebdbe, 0xffaeadae, 0xffb8b7b7, 0xffdddcdc, 0xffffffff, 0xffffffff, 0xffbfbebf, 0xffa5a3a4, 0xfffbfbfb, 0xffffffff, 0xffe9e8e8, 0xff545252, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff282325, 0xff9e9d9d, 0xfff7f7f7, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xffc6c5c5, 0xff888687, 0xff636161, 0xff585556, 0xff575455, 0xff5e5b5c, 0xff726f70, 0xff959293, 0xffc3c2c2, 0xfff4f3f3, 0xffffffff, 0xffb5b4b4, 0xff2f2b2c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff858383, 0xfff8f7f7, 0xffffffff, 0xfff9f9f9, 0xff807d7e, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff3f3c3c, 0xffd5d4d4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffededed, 0xff5a5758, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff332f30, 0xffa4a3a3, 0xfff6f6f6, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xfff0f1f1, 0xfff3f3f3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffeae9e9, 0xff858383, 0xff252222, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585656, 0xfff6f6f6, 0xffffffff, 0xfff6f6f6, 0xff7e7c7c, 0xff201d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff939191, 0xfffbfbfb, 0xffffffff, 0xffeaeaea, 0xff524e4f, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffaeacad, 0xffffffff, 0xffffffff, 0xffc5c4c4, 0xff322e30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff383435, 0xffc9c8c9, 0xffffffff, 0xffffffff, 0xffb1afb0, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff585556, 0xffdedddd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff0f0f0, 0xffe9e9e9, 0xfff4f4f4, 0xffffffff, 0xffffffff, 0xfffafafa, 0xffa4a3a3, 0xff706d6e, 0xffe6e6e6, 0xffffffff, 0xffffffff, 0xff787576, 0xff181415, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff272324, 0xff7e7b7d, 0xffdfdede, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xffc2c1c1, 0xff494747, 0xff8a8788, 0xfffbfbfb, 0xffffffff, 0xffe7e6e6, 0xff514e4f, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff2c2829, 0xff918f8f, 0xffe9e9e9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffafafa, 0xfff0f0f0, 0xffefefef, 0xfff7f7f7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffadabac, 0xff2e2a2b, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff828181, 0xfff5f5f5, 0xfffcfcfc, 0xfff7f7f7, 0xff7e7b7c, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff252122, 0xff817f7f, 0xfff8f8f8, 0xfffdfefe, 0xfffcfcfc, 0xfffcfdfc, 0xffebeaeb, 0xff595656, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201b1d, 0xff2e2a2b, 0xff787575, 0xffcccbcc, 0xfffbfafb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff4f4f3, 0xffbab9b9, 0xff625e5f, 0xff252122, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585555, 0xfff2f2f2, 0xfffefdfd, 0xfff3f4f4, 0xff7c7a7a, 0xff211c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff908e8f, 0xfff9f8f8, 0xfffcfcfc, 0xffe7e6e6, 0xff504d4e, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211c1d, 0xffacaaaa, 0xffffffff, 0xffffffff, 0xffc3c2c2, 0xff322e2f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff383435, 0xffc7c5c6, 0xffffffff, 0xffffffff, 0xffafadad, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff232020, 0xff5b5959, 0xffc0bfbf, 0xfffafafa, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdddcdd, 0xff888686, 0xff302c2d, 0xff5a5657, 0xffe7e7e7, 0xfffefefe, 0xfffffffe, 0xff767475, 0xff191415, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242021, 0xff535051, 0xff9d9b9b, 0xffd2d1d2, 0xffeeeeee, 0xfff9fafa, 0xfff7f7f7, 0xffe7e7e7, 0xffc4c3c4, 0xff858384, 0xff3d3a3b, 0xff1b1819, 0xff989797, 0xfffcfcfc, 0xffffffff, 0xffe1e0e1, 0xff4a4647, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff272324, 0xff5e5b5c, 0xffafadae, 0xffeaeaea, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff5f5f5, 0xffd1d1d1, 0xff9f9d9e, 0xff565454, 0xff262223, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff3b3738, 0xff575455, 0xff585556, 0xff575556, 0xff393637, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff312d2e, 0xff545152, 0xff595657, 0xff585556, 0xff585556, 0xff545152, 0xff302c2d, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff242021, 0xff3a3637, 0xff656263, 0xff949292, 0xffb1b0b0, 0xffbdbcbc, 0xffbcbaba, 0xffacabab, 0xff898787, 0xff595656, 0xff322e2f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff302c2d, 0xff565353, 0xff595556, 0xff565454, 0xff393536, 0xff221f1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff3e3a3b, 0xff585556, 0xff585556, 0xff535051, 0xff2e2b2b, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff454142, 0xff5a5859, 0xff5a5758, 0xff4a4748, 0xff272324, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff282425, 0xff4b4748, 0xff595657, 0xff5a5758, 0xff454243, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff363233, 0xff666464, 0xff9a9798, 0xffb4b3b4, 0xffbdbcbc, 0xffb7b6b6, 0xffa09e9e, 0xff737172, 0xff434041, 0xff262223, 0xff211d1e, 0xff312d2e, 0xff535051, 0xff595656, 0xff595556, 0xff383435, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff292526, 0xff3b3738, 0xff4e4b4c, 0xff565454, 0xff555253, 0xff4a4647, 0xff353132, 0xff252122, 0xff1f1b1c, 0xff231e1f, 0xffb5b4b4, 0xfffefefe, 0xffffffff, 0xffd5d4d4, 0xff3a3738, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff2e2a2b, 0xff4d4a4a, 0xff787676, 0xff9e9c9d, 0xffb5b4b4, 0xffbdbcbd, 0xffbababa, 0xffb1b0b1, 0xff9c9a9b, 0xff7d7b7b, 0xff575455, 0xff3b3838, 0xff292526, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff221f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff252122, 0xff292526, 0xff272425, 0xff231f20, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211e1f, 0xff211d1e, 0xff221e1f, 0xff221f1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221f1f, 0xff221d1f, 0xff221e1f, 0xff252122, 0xff282425, 0xff262223, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff3c393a, 0xffd5d5d5, 0xffffffff, 0xfffefefe, 0xffbebdbe, 0xff272324, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff262223, 0xff292526, 0xff272425, 0xff242021, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff7b7879, 0xfff4f3f3, 0xffffffff, 0xfffbfbfb, 0xff8e8b8c, 0xff1d191a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff322e2f, 0xff312d2e, 0xff211d1e, 0xff1f1b1c, 0xff201c1d, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff211d1e, 0xff1f1b1c, 0xff221e1f, 0xff555253, 0xffd6d5d5, 0xffffffff, 0xffffffff, 0xffeaeaea, 0xff4c484a, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff727070, 0xffafadae, 0xff777475, 0xff494647, 0xff302c2d, 0xff231f20, 0xff221e1f, 0xff211e1f, 0xff2a2627, 0xff434040, 0xff7b7879, 0xffd5d4d4, 0xffffffff, 0xffffffff, 0xffffffff, 0xff9b9999, 0xff201d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff838181, 0xfffafafa, 0xfff4f3f4, 0xffdbd9da, 0xffc0bfbf, 0xffacabab, 0xffa3a2a2, 0xffa8a6a6, 0xffb8b6b7, 0xffd5d4d4, 0xfff4f4f4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffbcbbbc, 0xff353133, 0xff201b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff828080, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xfffcfcfc, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfefe, 0xffacaaab, 0xff3c3839, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff434041, 0xff939191, 0xffcdcccd, 0xffedecec, 0xfff7f7f7, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff9f9f9, 0xffebebeb, 0xffbcbbbc, 0xff696666, 0xff2a2627, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff1d191a, 0xff272324, 0xff3d3a3b, 0xff5a5758, 0xff6e6c6c, 0xff797677, 0xff7b797a, 0xff737172, 0xff605d5e, 0xff3f3b3b, 0xff231f20, 0xff1d191a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1e1a1b, 0xff1b1718, 0xff191516, 0xff181415, 0xff181415, 0xff181415, 0xff1b1718, 0xff1f1a1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2d292a, 0xff5e5c5d, 0xff696566, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696666, 0xff696566, 0xff696666, 0xff514e4f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff787576, 0xffe8e7e7, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f3f3, 0xfff4f4f4, 0xffd1d1d1, 0xff464344, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff4b4849, 0xffd6d6d6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xffa2a1a1, 0xff292526, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff2e2a2b, 0xffaaa8a9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefdfd, 0xfff7f6f7, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfffafafa, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffeaeaea, 0xff656263, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff737071, 0xfff7f7f7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e3e4, 0xff686566, 0xff423e3f, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff454142, 0xff464344, 0xffa19f9f, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff383435, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff464344, 0xffdedddd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdedede, 0xff484546, 0xff1a1617, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1e1a1b, 0xff201c1d, 0xff8d8a8b, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xff828080, 0xff252122, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2b2829, 0xffb4b2b3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdfdedf, 0xff4c494a, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff908d8d, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff4b4748, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2e2a2b, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464243, 0xff464244, 0xff423f40, 0xff2b2728, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1d191a, 0xff868485, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdfdedf, 0xff4c494a, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff8f8d8d, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffb4b3b3, 0xff272425, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff838181, 0xffdadada, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d8, 0xffd9d8d9, 0xffcfcecf, 0xff676464, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1f1a1b, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1e1a1b, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff585556, 0xffeaeaea, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdfdedf, 0xff4c494a, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff8f8d8d, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xff787677, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff332f30, 0xffd7d5d6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa9a7a8, 0xff2b2728, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2e2b2b, 0xff413d3e, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff423e3f, 0xff383535, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff343132, 0xffc5c3c3, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdfdedf, 0xff4c494a, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff8f8d8d, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdfdfdf, 0xff423e3f, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff737072, 0xfff7f7f7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdcdbdb, 0xff4a4748, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211e1f, 0xff969394, 0xfffaf9f9, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff2f2f2, 0xfff8f8f8, 0xffcdcccc, 0xff332f30, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff252021, 0xff908e8e, 0xfff9f8f8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdfdedf, 0xff4c484a, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff242021, 0xff8f8d8d, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xffa8a7a7, 0xff262122, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2b2728, 0xffbbb9b9, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xff7d7b7b, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff312d2e, 0xffd6d5d5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff8f7f7, 0xff4c494a, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff5d5a5b, 0xffe5e5e5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdfdedf, 0xff4c4849, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff242021, 0xff8f8d8e, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffefeeef, 0xff696667, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff5a5758, 0xffe8e7e8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffbfbdbe, 0xff302c2d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff5b5858, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff787676, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff393536, 0xffc0bebf, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffededed, 0xff9b999a, 0xff828080, 0xff848283, 0xff848283, 0xff848283, 0xff848283, 0xff848283, 0xff848283, 0xff848283, 0xff848283, 0xff848283, 0xff848283, 0xff848283, 0xff848283, 0xff848283, 0xff848282, 0xff868383, 0xffc1c0c0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc5c3c4, 0xff3c3839, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff262323, 0xff9a9999, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff3f3f3, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1d191a, 0xff9c9b9a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa8a6a6, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221f1f, 0xff231f20, 0xff908e8e, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffeffff, 0xfffefefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xfffffefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffafafa, 0xff8a8889, 0xff252122, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff444142, 0xffd4d3d4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff9b999a, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff312d2e, 0xffdfdede, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdad9da, 0xff2c2829, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff676565, 0xfffafafa, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffebeaea, 0xff585555, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff252122, 0xff807e7e, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffeae9e9, 0xff3d393a, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff332f30, 0xff777575, 0xff7d7b7c, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7c7a7a, 0xff7e7b7c, 0xff757273, 0xff2b2728, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff767374, 0xffa19f9f, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xff9c9a9b, 0xffa09e9f, 0xff615f60, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff272223, 0xff605d5e, 0xff8a8888, 0xff878686, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff878585, 0xff888686, 0xff878485, 0xff3e3a3b, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1b1718, 0xff1c1819, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e191a, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1e1a1b, 0xff221f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1d191a, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff1a1617, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff201b1c, 0xff242021, 0xff302c2d, 0xff3e3b3c, 0xff4a4747, 0xff555253, 0xff5e5b5b, 0xff5f5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5f5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5e5c5d, 0xff5f5c5d, 0xff5e5a5b, 0xff555252, 0xff4a4647, 0xff3e3a3b, 0xff2f2b2c, 0xff231f20, 0xff201c1d, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1d191a, 0xff2d2a2b, 0xff575455, 0xff848283, 0xffb4b3b4, 0xffd2d1d2, 0xffdfdede, 0xffeaeaea, 0xfff4f4f4, 0xfff6f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff5f5f5, 0xfff4f3f4, 0xffeaeaea, 0xffdeddde, 0xffd0d0d0, 0xffb2b1b1, 0xff818080, 0xff555253, 0xff2b2829, 0xff1d191a, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e191a, 0xff242021, 0xff605d5e, 0xffb5b3b3, 0xffe5e5e5, 0xfffaf9fa, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff9f9f9, 0xffe4e3e4, 0xffb0afb0, 0xff5c5959, 0xff231e20, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff3f3b3c, 0xffaaa9a9, 0xffececec, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xffebeaea, 0xffa6a4a6, 0xff3c3839, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff4e4a4b, 0xffcccacb, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xffc8c7c7, 0xff4b4848, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff585556, 0xffdbdadb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd8d7d8, 0xff555253, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1c1c, 0xff484546, 0xffd7d6d6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd4d3d3, 0xff474344, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff383434, 0xffc3c2c2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff373333, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1a1b, 0xff9c9a9a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff9a9898, 0xff1e1a1b, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff514e4e, 0xffebebeb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffeaeaea, 0xff504c4d, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff252122, 0xffaaa9aa, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xffaaa9a9, 0xff252122, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff4a4748, 0xffe0dfe0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe0dfdf, 0xff4a4747, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff787676, 0xfff4f3f3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff3f3f3, 0xff777575, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2a2627, 0xffa8a6a6, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xffa6a5a5, 0xff292526, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff373435, 0xffc5c4c4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc3c2c2, 0xff363333, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff3f3c3d, 0xffd2d1d2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd2d1d1, 0xff3f3b3c, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff4a4748, 0xffdcdbdb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdcdbdb, 0xff4a4748, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211c1e, 0xff535052, 0xffe3e2e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e2e2, 0xff535051, 0xff211c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff555252, 0xffe4e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff555253, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xfff5f4f5, 0xffececec, 0xffe4e3e4, 0xffdcdbdb, 0xffdbdada, 0xffe3e3e3, 0xffececec, 0xfff5f4f5, 0xfffcfcfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211c1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff1f1f1, 0xffd2d1d1, 0xffafaeae, 0xff8a8889, 0xff6f6d6e, 0xff646162, 0xff5c595a, 0xff555253, 0xff4e4a4b, 0xff464344, 0xff454343, 0xff4d4a4b, 0xff555252, 0xff5c595a, 0xff646263, 0xff706e6f, 0xff898787, 0xffaeadad, 0xffd1d0d0, 0xfff1f1f1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e2e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xffd0cfd0, 0xff949293, 0xff696667, 0xff474444, 0xff343031, 0xff272324, 0xff242021, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff282324, 0xff343031, 0xff464243, 0xff686566, 0xff929091, 0xffcccbcb, 0xfff9f9f9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545151, 0xffe2e2e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xfff8f7f7, 0xffdddcdc, 0xffa09f9f, 0xff5a5757, 0xff2b2829, 0xff1d191a, 0xff1e1a1b, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff1e1a1b, 0xff1d191a, 0xff2a2627, 0xff575454, 0xff9d9b9c, 0xffdcdadb, 0xfff7f7f7, 0xfffefdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff535051, 0xffe2e2e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xffebebeb, 0xffb6b5b5, 0xff6c696a, 0xff353132, 0xff1d191a, 0xff1c1819, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1d191a, 0xff1c1819, 0xff333030, 0xff6a6767, 0xffb1b0b0, 0xffe9e9e9, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211c1e, 0xff525050, 0xffe2e2e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e7e7, 0xffaeacad, 0xff605d5e, 0xff272324, 0xff1a1617, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff1a1617, 0xff252223, 0xff5c595a, 0xffa9a8a8, 0xffe5e5e5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff524f50, 0xffe2e1e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffefeeef, 0xffa7a6a6, 0xff5d5a5a, 0xff2c2829, 0xff1e1a1b, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1e1a1b, 0xff2b2728, 0xff5a5757, 0xffa3a1a2, 0xffecebeb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff524f50, 0xffe2e1e1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcdcccd, 0xff605d5d, 0xff2b2728, 0xff211d1e, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221d1e, 0xff211d1e, 0xff2a2627, 0xff595657, 0xffc3c3c3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff524f50, 0xffe2e1e1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff7f7f7, 0xff999797, 0xff343132, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff332f30, 0xff928f90, 0xfff3f2f3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff524f50, 0xffe1e1e1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xffd6d5d5, 0xff666464, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff221e1f, 0xff646061, 0xffd3d2d2, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff524e4f, 0xffe1e1e1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffaf9fa, 0xffb6b4b5, 0xff423f3f, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1c1718, 0xff3e3a3b, 0xffb2b0b1, 0xfff9f9f9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff514e4f, 0xffe1e0e1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff8f7f8, 0xffa2a0a1, 0xff353233, 0xff1c191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff302c2d, 0xff9a9899, 0xfff6f6f6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff504e4e, 0xffe1e0e0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff4f3f3, 0xff888687, 0xff2d292a, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff2a2728, 0xff827f7f, 0xffefefef, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff504d4e, 0xffe1e0e0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffecebec, 0xff716e6f, 0xff272324, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff272425, 0xff6f6d6e, 0xffe7e7e7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff504d4e, 0xffe0e0e0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff1f0f1, 0xff726f70, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff716f6f, 0xffeeeeee, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff504d4e, 0xffe0dfe0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff4f4f4, 0xff8a8888, 0xff262223, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221d1e, 0xff888686, 0xfff4f4f4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff504d4d, 0xffe0dfdf, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff9f9f9, 0xff9f9d9d, 0xff2b2727, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff201c1d, 0xff211d1e, 0xff252222, 0xff2e2a2b, 0xff333031, 0xff363334, 0xff3a3738, 0xff3b3738, 0xff373334, 0xff343031, 0xff2f2b2c, 0xff262223, 0xff211e1f, 0xff1f1b1c, 0xff201b1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff242122, 0xff999797, 0xfffafafa, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff504c4d, 0xffe0dfdf, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffaeacac, 0xff312d2e, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff1d1819, 0xff242021, 0xff3c3839, 0xff5d5b5b, 0xff7b7979, 0xff959393, 0xffafadad, 0xffbebdbd, 0xffc6c5c5, 0xffcdcccc, 0xffcecdcd, 0xffc7c6c6, 0xffbfbebe, 0xffb1afaf, 0xff979595, 0xff7d7a7c, 0xff615d5e, 0xff3e3a3b, 0xff252122, 0xff1d191a, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff2a2728, 0xffa4a2a2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff504c4d, 0xffe0dfdf, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcbcaca, 0xff383535, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff1c1819, 0xff343031, 0xff6f6c6d, 0xffa6a5a5, 0xffcecdce, 0xffe8e8e8, 0xfff6f6f6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff7f7f7, 0xffe9e9e9, 0xffd0d0d0, 0xffa9a8a8, 0xff737070, 0xff363334, 0xff1c1819, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff333031, 0xffbbb9ba, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff4f4c4c, 0xffdfdfdf, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffefefef, 0xff555253, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1b1718, 0xff3b3839, 0xff8b8888, 0xffd2d1d1, 0xfff3f3f3, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xfff4f4f4, 0xffd6d5d5, 0xff8f8d8e, 0xff403d3d, 0xff1d1819, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221d1e, 0xff4e4b4c, 0xffe2e1e1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff4f4b4c, 0xffdfdedf, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff868384, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff2f2b2c, 0xff807d7d, 0xffe0e0e0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xffe3e3e3, 0xff858384, 0xff322e2f, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff252122, 0xff7f7c7d, 0xfff8f8f8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff4e4b4c, 0xffdfdede, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffbab9b9, 0xff312d2e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff272324, 0xff5b5858, 0xffc6c5c5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcbcbcb, 0xff5f5c5d, 0xff282425, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff332f30, 0xffb5b3b4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e4e4, 0xff555252, 0xff211c1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff423e3f, 0xffaaa8a9, 0xffc2c1c1, 0xffc0bebf, 0xffc0bfbf, 0xffc0bfbf, 0xffc0bfbf, 0xffc0bfbf, 0xffc0bfbf, 0xffc0bfbf, 0xffc0bfbf, 0xffc1bfbf, 0xffc1bfbf, 0xffc1bfbf, 0xffc1bfbf, 0xffc1bfbf, 0xffc1bfbf, 0xffc1bfc0, 0xffc1bfc0, 0xffc1c0c0, 0xffc1c0c0, 0xffc1c0c0, 0xffc1c0c0, 0xffc1c0c0, 0xffc1c0c0, 0xffc1c0c0, 0xffc1c0c0, 0xffc1c0c1, 0xffc1c0c1, 0xffc1c0c1, 0xffc1c0c1, 0xffc1c0c1, 0xffc2c1c1, 0xffc2c1c1, 0xffc2c1c1, 0xffc2c1c1, 0xffc2c1c1, 0xffc2c1c1, 0xffc2c1c1, 0xffc2c1c1, 0xffc3c1c2, 0xffc3c1c2, 0xffc3c2c2, 0xffc3c2c2, 0xffc3c2c2, 0xffc3c2c2, 0xffc3c2c2, 0xffc3c2c2, 0xffc3c2c2, 0xffc3c2c2, 0xffc3c2c3, 0xffc3c2c3, 0xffc3c2c3, 0xffc3c2c3, 0xffc3c2c3, 0xffc3c3c3, 0xffc3c3c3, 0xffc3c3c3, 0xffc4c3c3, 0xffc4c3c3, 0xffc4c3c3, 0xffc4c3c3, 0xffc4c3c3, 0xffc4c3c3, 0xffc5c3c4, 0xffc5c3c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc5c4c4, 0xffc7c6c6, 0xffbab9ba, 0xff524f50, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff343031, 0xff888686, 0xffeaeaea, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff0f0f0, 0xff8f8e8e, 0xff383435, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1a1b, 0xff535051, 0xffc0bfc0, 0xffd2d1d1, 0xffd1d1d1, 0xffd1d1d1, 0xffd1d1d1, 0xffd2d1d1, 0xffd2d1d1, 0xffd2d1d1, 0xffd2d1d1, 0xffd2d1d1, 0xffd3d2d2, 0xffd3d2d2, 0xffd3d2d2, 0xffd3d2d2, 0xffd3d2d3, 0xffd3d2d3, 0xffd3d2d3, 0xffd3d3d3, 0xffd3d3d3, 0xffd3d3d3, 0xffd4d3d3, 0xffd4d3d3, 0xffd3d3d3, 0xffd4d4d4, 0xffd5d4d4, 0xffd5d4d4, 0xffd5d4d4, 0xffd5d4d4, 0xffd5d4d4, 0xffd5d4d4, 0xffd5d4d4, 0xffd5d4d4, 0xffd5d4d5, 0xffd5d5d5, 0xffd5d5d5, 0xffd6d5d5, 0xffd6d5d6, 0xffd6d6d6, 0xffd6d6d6, 0xffd6d6d6, 0xffd7d6d6, 0xffd7d6d6, 0xffd7d6d6, 0xffd7d6d6, 0xffdad9d9, 0xffc3c2c2, 0xff4b4849, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff252122, 0xff2d292a, 0xff2e2b2c, 0xff2f2a2c, 0xff2f2b2c, 0xff2f2b2c, 0xff2f2b2c, 0xff2f2b2c, 0xff2f2b2c, 0xff2f2b2c, 0xff2f2b2c, 0xff2f2c2c, 0xff2f2c2c, 0xff2f2c2c, 0xff2f2c2d, 0xff2f2c2d, 0xff2f2c2d, 0xff2f2c2d, 0xff2f2c2d, 0xff302c2d, 0xff302c2d, 0xff302c2d, 0xff302c2d, 0xff302c2d, 0xff302c2d, 0xff302c2d, 0xff302c2d, 0xff302d2e, 0xff302d2e, 0xff302d2e, 0xff302d2e, 0xff302d2e, 0xff312d2e, 0xff312d2e, 0xff312d2e, 0xff312d2e, 0xff312d2e, 0xff312d2e, 0xff312d2e, 0xff312d2e, 0xff312d2e, 0xff312d2e, 0xff312e2f, 0xff312e2f, 0xff312e2f, 0xff312e2f, 0xff312e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322e2f, 0xff322f2f, 0xff322f30, 0xff322f30, 0xff322f30, 0xff322f30, 0xff322f30, 0xff332f30, 0xff332f30, 0xff332f30, 0xff332f30, 0xff332f30, 0xff332f30, 0xff332f30, 0xff332f30, 0xff333030, 0xff333030, 0xff343030, 0xff343031, 0xff2f2c2d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff413e3f, 0xffb2b1b2, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefffe, 0xffbbbaba, 0xff4b4748, 0xff1d191a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xff373435, 0xff3e3a3b, 0xff3e3a3b, 0xff3e3a3b, 0xff3e3b3b, 0xff3e3b3b, 0xff3f3b3b, 0xff3f3b3c, 0xff3f3b3c, 0xff3f3c3c, 0xff3f3b3c, 0xff3f3b3d, 0xff3f3c3d, 0xff3f3c3d, 0xff403c3d, 0xff403c3d, 0xff403c3d, 0xff403c3d, 0xff403d3d, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff403d3e, 0xff413d3e, 0xff413d3e, 0xff413d3e, 0xff413e3f, 0xff413e3f, 0xff413e3f, 0xff413e3f, 0xff413e3f, 0xff413e3f, 0xff423e3f, 0xff423e3f, 0xff423f3f, 0xff423f40, 0xff423f40, 0xff423f40, 0xff423f40, 0xff423f40, 0xff433f40, 0xff433f40, 0xff433f40, 0xff433f40, 0xff434041, 0xff3f3c3d, 0xff2a2627, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211c1e, 0xff211c1d, 0xff211c1d, 0xff211c1d, 0xff211c1d, 0xff211c1d, 0xff211c1d, 0xff211c1d, 0xff211c1d, 0xff211c1d, 0xff211c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff211c1d, 0xff231e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff4f4c4d, 0xffcac8c8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcfcece, 0xff585556, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff4f4c4d, 0xffd3d3d3, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd9d8d8, 0xff555152, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff252122, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff454242, 0xffcacaca, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd1d1d1, 0xff464343, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff444041, 0xffa3a1a2, 0xffb6b4b5, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb4b2b3, 0xffb6b4b5, 0xff5b5859, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff373334, 0xffb8b7b7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc4c3c4, 0xff373334, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff464243, 0xffadabab, 0xffb0afaf, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb0aeae, 0xffb1b0b0, 0xffa2a0a1, 0xff474445, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff575454, 0xffeae9ea, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff1f1f1, 0xff464344, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff262223, 0xff928f90, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa19fa0, 0xff262223, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff383435, 0xffdedddd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff0efef, 0xff5e5b5c, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211c1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa6a5a5, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff696667, 0xfff4f4f4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff8f8f8, 0xff7a7778, 0xff1d191a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff8d8b8c, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xff5c5959, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff9f9f9, 0xff585556, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454143, 0xffdeddde, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e2e2, 0xff535050, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff504c4d, 0xffe9e8e9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xff5c5959, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc5c5c5, 0xff2c2829, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xffadabab, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xffb3b1b1, 0xff2a2627, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff2f2b2c, 0xffb5b4b4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xff5c5859, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff8e8b8c, 0xff211e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff5a5758, 0xfff0f0f0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffebebeb, 0xff636161, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff838182, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e8e8, 0xff5b5859, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff7f7f7, 0xff5b5959, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2a2627, 0xffb2b1b2, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffb2b0b0, 0xff312d2e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff5c5959, 0xffe9e8e8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e8e8, 0xff5b5859, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd4d4d4, 0xff3c3839, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff5c5a5b, 0xffe9e9e9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffecebec, 0xff5d5a5b, 0xff221d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff3d393a, 0xffcccbcb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e8e8, 0xff5b5859, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa9a7a8, 0xff2b2728, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff252122, 0xff989696, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff979596, 0xff272324, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff282325, 0xffa6a4a4, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e8e8, 0xff5b5859, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff828080, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff3d393a, 0xffcccacb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd3d2d2, 0xff3a3637, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201b1d, 0xff817f80, 0xfff6f6f6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e7e8, 0xff5b5859, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff3f3f3, 0xff6a6767, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff666364, 0xfff1f1f1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xff666465, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff656263, 0xffeeeded, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e7e8, 0xff5b5859, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e2e2, 0xff545152, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff272224, 0xff908e8f, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff9b9999, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff4c494a, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e7e8, 0xff5a5859, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd2d2d2, 0xff413d3e, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff2e292a, 0xffb5b4b4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc4c2c3, 0xff292526, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff373334, 0xffd1d0d0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e7e8, 0xff5a5859, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffbebdbd, 0xff343031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff3d3a3a, 0xffd7d6d6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffeae9e9, 0xff3b3838, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff262223, 0xffbdbcbc, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e7e7, 0xff5a5758, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffb1afb0, 0xff2d292a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff514d4e, 0xfff3f3f3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfcfc, 0xff5a5758, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xffadabac, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e7e7, 0xff5a5758, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa9a8a8, 0xff292627, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff5f5c5d, 0xfffdfefd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff706e6f, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201b1d, 0xffa2a0a0, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e7e7, 0xff5a5758, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa1a0a0, 0xff252122, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff6c6a6b, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff7e7c7d, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1a1b, 0xff979595, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e7e7, 0xff5a5758, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xff999798, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff7b7879, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff8d8b8b, 0xff191516, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1d1819, 0xff8c8a8b, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe8e7e7, 0xff5a5757, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xff929191, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff868384, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff989697, 0xff1b1618, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff848182, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e7e7, 0xff5a5757, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xff969595, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff827f80, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff949292, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff888687, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e7e7, 0xff5a5757, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xff9e9d9d, 0xff241f21, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff777576, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff8a8788, 0xff191516, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1d191a, 0xff929090, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e7e7, 0xff5a5757, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa5a3a5, 0xff272324, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff6a6768, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff7c7a7a, 0xff1b1618, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1a1b, 0xff9b9a9a, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e7e7, 0xff5a5757, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffadabab, 0xff2b2728, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545051, 0xfff7f6f6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xff615e5e, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xffa4a3a4, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e7e7, 0xff5a5757, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffb9b8b8, 0xff312e2e, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff444243, 0xffe2e2e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff5f5f5, 0xff444142, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xffb5b4b4, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e6e6, 0xff5a5657, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcecdcd, 0xff3d393a, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff353132, 0xffc9c7c8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdbdada, 0xff312e2f, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff2f2b2c, 0xffcbcaca, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e6e6, 0xff595657, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdedddd, 0xff4c494a, 0xff211d1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff292526, 0xffa1a0a0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffadacac, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff423f3f, 0xffdbdada, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e6e6, 0xff595657, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffececec, 0xff605d5d, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff767374, 0xfffafafa, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff7a7778, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff565354, 0xffe8e8e8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e6e6, 0xff595657, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffafafa, 0xff767475, 0xff221f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff4e4a4b, 0xffdfdede, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe9e9e9, 0xff4a4748, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e191b, 0xff6f6d6d, 0xfff1f0f0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e6e6, 0xff595657, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff9c9b9b, 0xff282526, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2e2a2b, 0xffb2b0b1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffb5b3b4, 0xff2d292a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff969495, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e6e6, 0xff595657, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc6c5c5, 0xff343031, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff797677, 0xfff3f3f3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffafafa, 0xff777575, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff312e2f, 0xffbbbaba, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e6e6, 0xff595657, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe9e8e9, 0xff4c4849, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff3c393a, 0xffd0cfcf, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcfcece, 0xff413e3f, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff494646, 0xffdbdada, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e6e6, 0xff595657, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff716e6f, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1d1a1b, 0xff878585, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff9f9f9, 0xff8a8989, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff6a6768, 0xfff1f1f1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e6e6, 0xff585656, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffafadae, 0xff252123, 0xff231e20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff373335, 0xffd2d2d2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd2d2d2, 0xff423e3f, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff282425, 0xff9c9a9a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e6e6, 0xff585556, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffebebeb, 0xff423f3f, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff686566, 0xfffafbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff8f8f8, 0xff797677, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff3e3a3b, 0xffd4d3d3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e6e6, 0xff585556, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff838081, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xffa7a5a6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffbab9b9, 0xff292525, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff6a6768, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e5e6, 0xff585556, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcbcaca, 0xff292627, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff393536, 0xffcecdce, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdbdbdb, 0xff434041, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff262223, 0xffaeadad, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e5e6, 0xff585556, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffafafa, 0xff656264, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff595657, 0xffe2e2e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffececec, 0xff636162, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff4d4a4a, 0xffeeeeee, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e5e6, 0xff585556, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff292525, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff71706f, 0xffebeaea, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff1f0f0, 0xff787576, 0xff221f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xffa5a4a4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e5e5, 0xff585555, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff2f2f2, 0xff676465, 0xff1c1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff262223, 0xff7e7c7c, 0xfff2f2f2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff4f4f4, 0xff827f80, 0xff282425, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff4d4a4b, 0xfff0f0f0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e5e5, 0xff585555, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xffb8b7b7, 0xff2b2729, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff242021, 0xff797777, 0xfff2f2f1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff2f1f2, 0xff807e7f, 0xff282425, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201b1c, 0xffa9a7a7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e5e5, 0xff585555, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffefefef, 0xff6d6b6b, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1a1b, 0xff6c696a, 0xffe7e7e7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffeae9e9, 0xff777475, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff5c595a, 0xfff0efef, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e5e5, 0xff585455, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc4c3c4, 0xff3b3839, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1c1819, 0xff4f4c4d, 0xffc4c3c3, 0xfffbfafb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xffcccacb, 0xff585656, 0xff1c1819, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff322e2f, 0xffbebdbd, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e5e5, 0xff585455, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xff858384, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff373435, 0xff929091, 0xffe1e0e0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e4e4, 0xff999797, 0xff3b3839, 0xff1c1819, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff7d7a7a, 0xfff5f5f5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e5e5, 0xff575455, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe1e0e0, 0xff4e4b4c, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201b1c, 0xff252122, 0xff565354, 0xffa9a7a8, 0xffededed, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff0f0f0, 0xffaeacad, 0xff5a5758, 0xff272324, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff484546, 0xffd4d3d3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e5e5, 0xff575455, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffc1c0c0, 0xff302d2e, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff2d292a, 0xff575354, 0xffa5a4a4, 0xffebebeb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffefefef, 0xffadabac, 0xff5b5959, 0xff2e2b2c, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2e2b2b, 0xffaeacad, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e5e5, 0xff575455, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff9d9b9c, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff272324, 0xff444142, 0xff838182, 0xffcac9ca, 0xfff2f2f2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff3f3f4, 0xffcdcccd, 0xff888686, 0xff474444, 0xff282425, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff838182, 0xfffdfefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e5e5, 0xff575455, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff9fafa, 0xff747172, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff1e191a, 0xff272425, 0xff454243, 0xff767373, 0xffa3a1a2, 0xffc4c3c3, 0xffdddbdc, 0xffe7e6e6, 0xffebebeb, 0xffefefef, 0xffefefef, 0xffecebeb, 0xffe7e7e7, 0xffdedede, 0xffc5c4c5, 0xffa6a4a5, 0xff7a7777, 0xff494546, 0xff292526, 0xff1e1a1b, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1a1c, 0xff5c595a, 0xfff1f1f1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e4e5, 0xff575455, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe6e5e5, 0xff5f5c5d, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e191a, 0xff1a1517, 0xff1d191a, 0xff242021, 0xff302c2d, 0xff413d3e, 0xff4a4747, 0xff524f50, 0xff535051, 0xff4b4748, 0xff423e3f, 0xff312e2e, 0xff252122, 0xff1e1a1b, 0xff1a1517, 0xff1d191a, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231e20, 0xff1f1b1b, 0xff4e4c4c, 0xffdddcdc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e4e5, 0xff575455, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd7d7d7, 0xff565354, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1f1b1c, 0xff1e1a1b, 0xff1d191a, 0xff1c1819, 0xff1c1819, 0xff1d1819, 0xff1e1a1b, 0xff1f1b1c, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff4b4849, 0xffd0d0d0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e5e5, 0xff575455, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcccccc, 0xff4a4748, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff444041, 0xffc5c4c4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e5e4, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcccbcb, 0xff484546, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff433f40, 0xffc1c0c0, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e5e4, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdad9d9, 0xff504d4e, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff454243, 0xffcccacb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e4e4, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff5e5c5c, 0xff211e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221d1e, 0xff504d4e, 0xffd6d6d6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e4e4, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe9e9ea, 0xff7d7b7b, 0xff2e2a2b, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff2a2627, 0xff726f6f, 0xffe2e2e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e4e4, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff6f5f6, 0xffa4a3a4, 0xff423e3f, 0xff1e1a1b, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1d191a, 0xff3c3839, 0xff9b9a9a, 0xfff3f2f2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe5e4e4, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xffcac9ca, 0xff666464, 0xff231e1f, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff211d1e, 0xff5d5b5b, 0xffc3c2c2, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e4e4, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff0efef, 0xffa9a8a9, 0xff433f40, 0xff1c1718, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1b1718, 0xff393637, 0xff9d9c9c, 0xffececec, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e4e4, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xffe3e1e1, 0xff7e7b7b, 0xff2f2b2c, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201b1d, 0xff2b2628, 0xff737171, 0xffdcdcdc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e4e4, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcccbcb, 0xff727070, 0xff363233, 0xff241f20, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff332f30, 0xff6b696a, 0xffc5c4c5, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e4e4, 0xff565354, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcac9ca, 0xff7d7a7b, 0xff484445, 0xff2b2728, 0xff201c1d, 0xff1f1b1c, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff1f1b1c, 0xff2a2627, 0xff444142, 0xff767374, 0xffc3c2c2, 0xfffcfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e4e4, 0xff565254, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfcfd, 0xffdad9d9, 0xffa9a7a8, 0xff716e6f, 0xff413d3e, 0xff252122, 0xff1d191a, 0xff1b1718, 0xff1f1b1c, 0xff221d1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff1c1819, 0xff1d1819, 0xff242021, 0xff3d3a3b, 0xff6c6a6b, 0xffa4a2a3, 0xffd6d5d6, 0xfff9fafa, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e4e4, 0xff565254, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff1f1f1, 0xffd5d3d3, 0xffb0aeaf, 0xff838182, 0xff575455, 0xff322e30, 0xff221d1f, 0xff1c1819, 0xff191516, 0xff1b1718, 0xff1e1a1b, 0xff1f1b1c, 0xff201c1d, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211c1d, 0xff201c1d, 0xff1f1b1c, 0xff1e1a1b, 0xff1b1718, 0xff191516, 0xff1b1718, 0xff201c1d, 0xff302d2d, 0xff545253, 0xff7f7d7d, 0xffadabab, 0xffd2d1d1, 0xffefefef, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e4e4, 0xff565253, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xfff8f8f8, 0xffeeeeee, 0xffd8d7d7, 0xffb7b6b6, 0xff989697, 0xff7a7778, 0xff5d595a, 0xff444041, 0xff363334, 0xff2f2c2d, 0xff2c2829, 0xff2a2526, 0xff292627, 0xff2c2829, 0xff2f2b2c, 0xff363234, 0xff413e3f, 0xff5b5758, 0xff777576, 0xff959494, 0xffb5b4b4, 0xffd5d5d5, 0xffededed, 0xfff8f7f7, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e4e3, 0xff565253, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff9f9f9, 0xfff0f0f0, 0xffececec, 0xffe7e7e7, 0xffdedede, 0xffd4d3d3, 0xffd3d2d2, 0xffdddddc, 0xffe7e6e6, 0xffebebeb, 0xffefefef, 0xfff8f8f8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e4e4, 0xff555253, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e3e4, 0xff555253, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff545152, 0xffe3e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e3e4, 0xff555253, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211c1d, 0xff555252, 0xffe4e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe4e3e4, 0xff565253, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff524f50, 0xffe2e1e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe2e1e2, 0xff524f50, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff484445, 0xffdad9d9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdad9d9, 0xff474445, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff3d3a3b, 0xffd0cfd0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcfcfcf, 0xff3d3a3a, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff363233, 0xffc1bfc0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffbfbebe, 0xff343132, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff272324, 0xff9e9c9d, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xff9d9b9b, 0xff272223, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff6d6a6b, 0xfff0f0f0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff0f0f0, 0xff6c696a, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff403d3e, 0xffd9d8d8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd9d8d8, 0xff403c3d, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff969495, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xff959394, 0xff201b1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff3e3a3b, 0xffdedddd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffdddcdd, 0xff3d393a, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff807e7f, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xff7e7c7c, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff292526, 0xffa5a3a4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa2a1a1, 0xff282525, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff363233, 0xffb9b8b8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffb6b4b5, 0xff343132, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff423e3f, 0xffb8b6b6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffb3b2b2, 0xff3f3c3c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff353132, 0xffa4a3a4, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffaf9fa, 0xffa09e9f, 0xff333031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff292526, 0xff7c7979, 0xffd9d9d9, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xffd7d5d6, 0xff777474, 0xff272324, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1b1617, 0xff3a3636, 0xff8e8c8d, 0xffd1d0d0, 0xffebebeb, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffafafa, 0xffeaeaea, 0xffcecdce, 0xff8a8888, 0xff373333, 0xff1a1617, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff1f1a1c, 0xff393536, 0xff625f60, 0xff929090, 0xffb2b0b1, 0xffc2c0c1, 0xffcecece, 0xffd7d6d6, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd8d7d7, 0xffd7d6d6, 0xffcecdcd, 0xffc0bfc0, 0xffb1afb0, 0xff908e8e, 0xff605c5d, 0xff373334, 0xff1e1a1b, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff1e1a1b, 0xff242021, 0xff2e2a2b, 0xff363233, 0xff3d393a, 0xff434041, 0xff454242, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454142, 0xff454242, 0xff434041, 0xff3c393a, 0xff363233, 0xff2e2a2b, 0xff231f20, 0xff1e1a1b, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff232021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff232020, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff232020, 0xff232021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff232021, 0xff232021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff252122, 0xff252122, 0xff252122, 0xff262223, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff393536, 0xffa1a0a0, 0xffb3b2b3, 0xffb1b0b0, 0xff726f70, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff4c4849, 0xffa9a7a7, 0xffb3b2b2, 0xffb2b0b0, 0xff5b5859, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff787576, 0xffb4b2b2, 0xffb4b2b3, 0xffa09e9f, 0xff312d2e, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff242021, 0xff8c8a8b, 0xffb5b3b3, 0xffb4b2b3, 0xff898788, 0xff2e2a2b, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff322e2f, 0xff807d7e, 0xff8d8b8c, 0xff8d8b8b, 0xff8e8c8d, 0xff625f60, 0xff262323, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff464343, 0xffebebeb, 0xffffffff, 0xffffffff, 0xffa09e9f, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff646162, 0xfff3f3f3, 0xffffffff, 0xffffffff, 0xff7c7a7b, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa9a7a7, 0xffffffff, 0xffffffff, 0xffe8e8e8, 0xff393536, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff252022, 0xffcac9ca, 0xffffffff, 0xffffffff, 0xffc5c4c5, 0xff343132, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff6b6869, 0xfff4f4f4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffcbcaca, 0xff3b3839, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe2e2e2, 0xff383535, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c2c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff262223, 0xffacabab, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff6f5f5, 0xff666364, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff464343, 0xffebebea, 0xffffffff, 0xffffffff, 0xffa09e9e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe2e2e2, 0xff383535, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff4a4747, 0xffdddcdc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa6a4a5, 0xff282425, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff393536, 0xffa4a2a3, 0xffb6b4b5, 0xffb4b2b3, 0xff727071, 0xff211e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe2e2e2, 0xff383535, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211e1f, 0xff7e7c7e, 0xfff6f6f6, 0xffffffff, 0xfff8f8f8, 0xffd8d7d7, 0xfffdfdfd, 0xffffffff, 0xffe4e3e3, 0xff413d3e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff242021, 0xff241f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe2e2e2, 0xff383535, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff322e2f, 0xffb8b7b7, 0xffffffff, 0xffffffff, 0xffd7d7d7, 0xff656263, 0xfff0f0f0, 0xffffffff, 0xffffffff, 0xff7c797a, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe2e2e2, 0xff383535, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff211d1e, 0xff211c1d, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff555353, 0xffe7e7e6, 0xffffffff, 0xffffffff, 0xff939292, 0xff2c2829, 0xffc3c1c2, 0xffffffff, 0xffffffff, 0xffc7c6c6, 0xff292627, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff221e1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff1d191a, 0xff211d1e, 0xff282425, 0xff343031, 0xff3b3738, 0xff3e3a3b, 0xff3a3738, 0xff353132, 0xff282425, 0xff201b1d, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1e1a1b, 0xff1f1a1b, 0xff242021, 0xff2e2a2b, 0xff383435, 0xff3d393a, 0xff3d393a, 0xff383536, 0xff2f2c2d, 0xff221f20, 0xff1e1a1b, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe2e2e2, 0xff383535, 0xff1f1a1c, 0xff1f1b1c, 0xff201c1d, 0xff2c282a, 0xff393637, 0xff3e3a3b, 0xff3c3839, 0xff312d2e, 0xff231f20, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1e1a1b, 0xff211d1e, 0xff2c292a, 0xff383535, 0xff3d3a3a, 0xff3e3a3b, 0xff373435, 0xff2b2728, 0xff201c1d, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff252122, 0xff8d8b8c, 0xffffffff, 0xffffffff, 0xfff3f4f4, 0xff4d494b, 0xff201c1d, 0xff868485, 0xfffefefe, 0xffffffff, 0xfff9f8f8, 0xff585556, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff454243, 0xff8a8889, 0xff8b8989, 0xff8b898a, 0xff464344, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff565354, 0xff8d8b8c, 0xff8b8a89, 0xff848283, 0xff363233, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1f, 0xff373334, 0xff5f5c5d, 0xff878586, 0xffa8a7a7, 0xffbebcbd, 0xffcbc9ca, 0xffd0d0d0, 0xffcbcaca, 0xffbfbebe, 0xffa6a4a4, 0xff7b7879, 0xff3f3c3d, 0xff1e1a1b, 0xff221d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211c1d, 0xff332f30, 0xff7d7b7c, 0xff8a8888, 0xff898787, 0xff5b5858, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff282425, 0xff4a4647, 0xff727070, 0xff999797, 0xffb3b1b2, 0xffc5c4c4, 0xffcfcece, 0xffcfcdce, 0xffc6c5c5, 0xffb6b4b5, 0xff939292, 0xff5f5d5d, 0xff2b2728, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe2e2e2, 0xff373434, 0xff1a1617, 0xff3c3839, 0xff7d7b7b, 0xffaeadad, 0xffc7c6c7, 0xffd1d0d0, 0xffcccbcb, 0xffb9b8b8, 0xff8f8d8e, 0xff4d494a, 0xff1f1b1c, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff242021, 0xff514d4e, 0xff8a8788, 0xffb0aeaf, 0xffc5c4c4, 0xffcfcece, 0xffd0cfcf, 0xffc5c4c4, 0xffacabab, 0xff807d7e, 0xff423f40, 0xff1d1a1b, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff363233, 0xffcdcccc, 0xffffffff, 0xffffffff, 0xffbdbcbc, 0xff272324, 0xff201c1d, 0xff524f50, 0xffe3e2e3, 0xffffffff, 0xffffffff, 0xffa4a2a2, 0xff1e191a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff4e4b4b, 0xffe1e0e0, 0xfffcfcfc, 0xfffefefe, 0xff9d9b9c, 0xff1e1a1b, 0xff231e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff282425, 0xffbab9b9, 0xfffefefe, 0xfffefefe, 0xffcccbcb, 0xff363233, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221d1f, 0xff7e7c7d, 0xffcfcece, 0xffeaeaea, 0xfff7f7f8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xfff5f5f5, 0xffd7d7d7, 0xff7c7a7b, 0xff221f20, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e191a, 0xff434041, 0xffdfdedf, 0xfff9f8f8, 0xfff5f5f5, 0xff989697, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff413e3e, 0xffabaaaa, 0xffdfdfdf, 0xfff1f1f1, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xffebebeb, 0xffb4b3b3, 0xff454142, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe2e2e2, 0xff363334, 0xff585556, 0xffcac9c9, 0xfff5f4f5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffafafa, 0xffdfdede, 0xff858283, 0xff252223, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff393536, 0xff9f9d9d, 0xffe3e2e3, 0xfff9f8f9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff6f5f6, 0xffd7d6d6, 0xff7c7a7a, 0xff252021, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff625f60, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xff757374, 0xff1f1b1c, 0xff221e1f, 0xff302c2d, 0xffb6b5b5, 0xffffffff, 0xffffffff, 0xffe3e3e3, 0xff3b3738, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff302c2d, 0xffb4b3b3, 0xffffffff, 0xffffffff, 0xffe2e2e2, 0xff363233, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff4d4a4b, 0xfff5f5f5, 0xffffffff, 0xffffffff, 0xff929090, 0xff252223, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff231f20, 0xffb7b7b7, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff8f8f8, 0xfff3f3f4, 0xfff2f2f2, 0xfff6f6f6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff8f8f8, 0xff949393, 0xff221d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b9a9a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff585556, 0xffe5e4e4, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xfff5f6f5, 0xfff2f2f3, 0xfff3f3f3, 0xfffbfafb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd8d7d7, 0xff484445, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe2e1e1, 0xff6b6869, 0xffdadada, 0xffffffff, 0xffffffff, 0xfff9faf9, 0xfff1f1f1, 0xfff2f2f2, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff5f4f5, 0xff918f90, 0xff262122, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff444142, 0xffcdcccd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff9f9f9, 0xfff3f3f3, 0xfff3f3f3, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff4f3f4, 0xff929091, 0xff272324, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xffa9a8a9, 0xffffffff, 0xffffffff, 0xffe0dfdf, 0xff403c3d, 0xff221e1f, 0xff231f20, 0xff201c1d, 0xff7e7c7c, 0xfff5f5f5, 0xffffffff, 0xfffcfcfc, 0xff7b787a, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff797878, 0xfff7f7f7, 0xffffffff, 0xffffffff, 0xff747272, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff949293, 0xffffffff, 0xffffffff, 0xffebeaeb, 0xff585455, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff231f20, 0xffb8b6b7, 0xfff7f7f7, 0xffd5d5d5, 0xff9c9b9b, 0xff6f6d6d, 0xff514e4f, 0xff413e3f, 0xff3e3a3b, 0xff4b4849, 0xff726f70, 0xffb6b5b5, 0xfff2f2f2, 0xffffffff, 0xffffffff, 0xfff5f5f5, 0xff6f6c6d, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff595656, 0xffe4e4e4, 0xffedecec, 0xffbbbaba, 0xff848282, 0xff5f5d5d, 0xff484445, 0xff3e3a3b, 0xff423e3f, 0xff5a5758, 0xff8e8c8d, 0xffd8d8d8, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffc5c4c4, 0xff2e2a2b, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xfff0f0f0, 0xffd7d7d7, 0xffffffff, 0xffeeeded, 0xff9e9c9c, 0xff575354, 0xff3a3738, 0xff3d3a3b, 0xff646061, 0xffb7b5b5, 0xfff7f6f6, 0xffffffff, 0xffffffff, 0xfff0f0f0, 0xff716e6f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff3c3839, 0xffd1d0d1, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xffd7d6d6, 0xff8d8b8b, 0xff575455, 0xff413e3e, 0xff413e3f, 0xff5d5a5b, 0xffa2a0a0, 0xffedecec, 0xffffffff, 0xffffffff, 0xfff2f2f2, 0xff777575, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff403c3d, 0xffe9e9e9, 0xffffffff, 0xffffffff, 0xffa5a4a4, 0xff292525, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff484546, 0xffdedddd, 0xffffffff, 0xfffefefe, 0xffbfbebe, 0xff2a2627, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff494546, 0xffd9d8d8, 0xffffffff, 0xffffffff, 0xffbcbbbc, 0xff242122, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff322e2f, 0xffd9dad9, 0xffffffff, 0xffffffff, 0xffbdbcbd, 0xff343132, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff262122, 0xff817f7f, 0xff6a6768, 0xff2d292a, 0xff1b1718, 0xff1a1517, 0xff1d191a, 0xff1f1b1c, 0xff1f1b1c, 0xff1e1a1b, 0xff1a1617, 0xff231f20, 0xff767274, 0xffe8e8e8, 0xffffffff, 0xffffffff, 0xffc7c5c6, 0xff332f31, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff494647, 0xff858383, 0xff484546, 0xff231e20, 0xff191516, 0xff1c1819, 0xff1e1a1b, 0xff1f1b1c, 0xff1f1b1c, 0xff1c1819, 0xff1b1718, 0xff3d393a, 0xffb0afaf, 0xfffbfbfb, 0xffffffff, 0xfffdfdfd, 0xff777576, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe2e1e1, 0xff686666, 0xff1f1b1c, 0xff1c1819, 0xff1f1b1c, 0xff1f1b1c, 0xff1a1617, 0xff242021, 0xff8c8a8b, 0xfff6f6f6, 0xffffffff, 0xffffffff, 0xffcdcccc, 0xff3f3c3d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff282425, 0xffadabab, 0xffffffff, 0xffffffff, 0xfff8f7f8, 0xffa7a6a6, 0xff393637, 0xff1b1618, 0xff1c1819, 0xff1f1b1c, 0xff1f1b1c, 0xff1b1718, 0xff1b1718, 0xff605d5e, 0xffe0dfe0, 0xffffffff, 0xffffffff, 0xffd4d3d3, 0xff434041, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff838181, 0xffffffff, 0xffffffff, 0xfff5f5f5, 0xff686566, 0xff221f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff252223, 0xffaeadae, 0xfffdfdfd, 0xffffffff, 0xffe8e8e8, 0xff575455, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff282526, 0xffa9a8a8, 0xfffdfdfd, 0xffffffff, 0xffededed, 0xff4f4b4c, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff6b696a, 0xfffcfcfc, 0xffffffff, 0xfff9f9f9, 0xff858283, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff221e1f, 0xff1c1819, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff1b1718, 0xff888687, 0xfffbfbfb, 0xffffffff, 0xffecebeb, 0xff625e60, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff241f21, 0xff1e1a1b, 0xff1d191a, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff3e3a3b, 0xffcfcece, 0xffffffff, 0xffffffff, 0xffbebdbe, 0xff272324, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffffffff, 0xfff3f3f3, 0xff7e7b7c, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff221e20, 0xffa5a3a3, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xff7a7878, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff656262, 0xffeeeeee, 0xffffffff, 0xfffefefe, 0xffb6b4b5, 0xff302d2e, 0xff1d1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1a1516, 0xff686566, 0xfff6f6f6, 0xffffffff, 0xffffffff, 0xff807e7f, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff2a2728, 0xffcecdcd, 0xffffffff, 0xffffffff, 0xffcecdcd, 0xff3e3b3b, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff6d6b6c, 0xfff6f6f6, 0xffffffff, 0xfffafafa, 0xff939292, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff6d6a6b, 0xfff2f2f2, 0xffffffff, 0xfffbfbfb, 0xff918e8f, 0xff1e1a1b, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff221e1f, 0xffb4b2b2, 0xffffffff, 0xffffffff, 0xffe0dfdf, 0xff504c4d, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff3a3637, 0xffe6e5e6, 0xffffffff, 0xfff9f9f9, 0xff898788, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1c1819, 0xff8f8c8d, 0xfffafafa, 0xffffffff, 0xffe0dfdf, 0xff423f40, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xfffefefe, 0xffc9c8c9, 0xff343031, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff423e3f, 0xffe7e7e7, 0xffffffff, 0xffffffff, 0xffb9b8b8, 0xff2e2a2b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff282526, 0xffa9a7a7, 0xfffdfdfd, 0xffffffff, 0xffededed, 0xff545152, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff252222, 0xffb5b4b3, 0xffffffff, 0xffffffff, 0xffbcbcbc, 0xff2e2a2b, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, + 0xfd231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff5f5d5d, 0xfff8f8f8, 0xffffffff, 0xfffefefe, 0xff999798, 0xff272324, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff343132, 0xffdad9d9, 0xffffffff, 0xffffffff, 0xffcac9c9, 0xff3b3738, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff383435, 0xffd4d3d4, 0xffffffff, 0xffffffff, 0xffcac9c9, 0xff353132, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff484545, 0xffe5e5e5, 0xffffffff, 0xfffefefe, 0xffb4b2b2, 0xff2b2727, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1d191a, 0xff191516, 0xff191516, 0xff1b1718, 0xff1c1819, 0xff1d191a, 0xff1d191a, 0xff1b1718, 0xff201b1c, 0xffc9c8c9, 0xffffffff, 0xffffffff, 0xffa4a3a3, 0xff292526, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff1b1718, 0xff181415, 0xff1a1517, 0xff1c1819, 0xff1d191a, 0xff1d191a, 0xff1d191a, 0xff130f10, 0xff686566, 0xfff6f6f6, 0xffffffff, 0xffededed, 0xff5d5a5a, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xfffbfbfb, 0xff8e8c8d, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xffaba9aa, 0xffffffff, 0xffffffff, 0xffe6e5e5, 0xff413f40, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff413e3f, 0xffd3d2d3, 0xffffffff, 0xffffffff, 0xffbfbebe, 0xff252122, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff757374, 0xffffffff, 0xffffffff, 0xffe4e4e4, 0xff3f3c3d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfd231f20, + 0xf2231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201b1c, 0xffa8a7a7, 0xffffffff, 0xffffffff, 0xffeaeaea, 0xff625f60, 0xff201b1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff999898, 0xffffffff, 0xffffffff, 0xffeeeeee, 0xff676466, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1a1b, 0xff999898, 0xfffdfdfd, 0xffffffff, 0xffebebeb, 0xff636161, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1d191b, 0xff858384, 0xfff8f7f7, 0xffffffff, 0xfff5f5f5, 0xff767475, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff2d292a, 0xff504d4e, 0xff767474, 0xff8e8c8d, 0xff989797, 0xffa09e9f, 0xffa1a0a0, 0xffa1a0a0, 0xffa09f9f, 0xffa1a0a0, 0xffe4e4e4, 0xffffffff, 0xffffffff, 0xffb1afb0, 0xff2e2b2c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201b1c, 0xff221f20, 0xff3c3839, 0xff636061, 0xff838182, 0xff949292, 0xff9d9c9c, 0xffa1a0a0, 0xffa1a0a0, 0xffa1a0a0, 0xff9d9c9c, 0xffbdbcbc, 0xfffbfbfb, 0xffffffff, 0xfff1f1f1, 0xff6a6768, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xfff7f7f7, 0xff636060, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff7b7979, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xff5a5758, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff5c5959, 0xffe7e7e7, 0xffffffff, 0xffffffff, 0xff908e8f, 0xff171213, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff201c1d, 0xff1e1a1b, 0xff555253, 0xfffbfbfb, 0xffffffff, 0xfffafafa, 0xff514e4f, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf2231f20, + 0xe5231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff403d3e, 0xffdfdfdf, 0xffffffff, 0xffffffff, 0xffc8c7c7, 0xff353233, 0xff201b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff514f4f, 0xfff5f5f5, 0xffffffff, 0xffffffff, 0xffa19f9f, 0xff2a2627, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff555153, 0xfff2f1f1, 0xffffffff, 0xfffdfdfd, 0xff9d9b9b, 0xff272324, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff302c2d, 0xffc0bfbf, 0xffffffff, 0xffffffff, 0xffdcdcdc, 0xff3d3a3b, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff373334, 0xff888586, 0xffd3d2d2, 0xfff9f8f8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffbab9b9, 0xff332f30, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff262223, 0xff5a5757, 0xffb0afaf, 0xffebeaea, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff3f3f3, 0xff747172, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffebebeb, 0xff494647, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff5a5859, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xff737171, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff706e6f, 0xfff3f3f3, 0xffffffff, 0xffffffff, 0xffcdcccc, 0xffa6a4a4, 0xffaaa9a9, 0xffaaa8aa, 0xffaaa9a9, 0xffaaa9a9, 0xffaba9a9, 0xffaba9aa, 0xffabaaaa, 0xffababaa, 0xffacabaa, 0xffabaaab, 0xffbdbcbc, 0xfffcfcfc, 0xffffffff, 0xfffefeff, 0xff625e5f, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xe5231f20, + 0xd4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff7d7a7b, 0xfff7f7f7, 0xffffffff, 0xfffafafa, 0xff959393, 0xff242021, 0xff282425, 0xff292526, 0xff292526, 0xff292526, 0xff292526, 0xff292526, 0xff272324, 0xff2b2728, 0xffc7c6c6, 0xffffffff, 0xffffffff, 0xffd9d8d8, 0xff433f40, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff252223, 0xffc5c3c4, 0xffffffff, 0xffffffff, 0xffd0d0d0, 0xff403d3e, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff5a5758, 0xffe8e7e7, 0xffffffff, 0xffffffff, 0xffa3a2a2, 0xff1e1a1b, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff565354, 0xffcfcece, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffefefe, 0xfff7f7f7, 0xfff1f1f1, 0xffeeedee, 0xffececec, 0xffecebeb, 0xffecebeb, 0xffecebeb, 0xfffaf9f9, 0xffffffff, 0xffffffff, 0xffbcbbbc, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2f2b2c, 0xff8f8d8d, 0xfff3f2f2, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xfff4f4f4, 0xffefefef, 0xffededed, 0xffecebeb, 0xffecebeb, 0xffebeaeb, 0xfff1f1f1, 0xfffefefe, 0xffffffff, 0xfff4f4f4, 0xff787676, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe5e5e5, 0xff3e3b3b, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff4f4c4c, 0xfff8f8f8, 0xffffffff, 0xffffffff, 0xff827f80, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff7c7a7a, 0xfffbfafa, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff686565, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xd4231f20, + 0xb4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2e2a2b, 0xffbab8b9, 0xfffefefe, 0xffffffff, 0xfffafafa, 0xffbbb9ba, 0xff979696, 0xff9b9a9a, 0xff9b9a9a, 0xff9b9a9a, 0xff9b9a9a, 0xff9b9a9a, 0xff9b9a9a, 0xff9c9a9a, 0xff979696, 0xffcfcfcf, 0xffffffff, 0xffffffff, 0xfffefefe, 0xff757273, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1717, 0xff7a7778, 0xffffffff, 0xffffffff, 0xfff4f4f4, 0xff6d6a6b, 0xff231e1f, 0xff231f20, 0xff221e1f, 0xff252122, 0xff918f8f, 0xfffcfbfb, 0xffffffff, 0xfff7f7f7, 0xff5b5859, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff494647, 0xffd3d2d2, 0xffffffff, 0xffffffff, 0xfff9f9f9, 0xffcccccc, 0xffa1a0a0, 0xff848383, 0xff726f70, 0xff676465, 0xff625f60, 0xff605d5e, 0xff5f5c5d, 0xff625e5f, 0xffd3d2d2, 0xffffffff, 0xffffffff, 0xffbcbbbb, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff272324, 0xff858383, 0xfff8f8f8, 0xffffffff, 0xffffffff, 0xffe8e7e7, 0xffb6b5b5, 0xff929191, 0xff7b7879, 0xff6c6969, 0xff656263, 0xff615e5f, 0xff615e5e, 0xff5a5758, 0xff908e8e, 0xfff8f8f8, 0xffffffff, 0xfff4f4f4, 0xff777576, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe3e3e3, 0xff3b3838, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221d1e, 0xff4d4a4b, 0xfff6f6f6, 0xffffffff, 0xffffffff, 0xff848182, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff807d7e, 0xfffdfdfd, 0xffffffff, 0xffffffff, 0xffe9e8e8, 0xffdfdede, 0xffe0dfdf, 0xffe0dfdf, 0xffe0dfdf, 0xffe0dfdf, 0xffe0dfdf, 0xffe0dfdf, 0xffe0dfdf, 0xffe0dfdf, 0xffe0dfdf, 0xffe0dfdf, 0xffe0dfdf, 0xffe0dfdf, 0xffe1e0e0, 0xffe0e0e0, 0xff5e5b5c, 0xff211c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xb4231f20, + 0x8e231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff565354, 0xffe4e3e3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffb9b8b8, 0xff2a2627, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff3a3738, 0xffe4e3e4, 0xffffffff, 0xffffffff, 0xffa8a6a7, 0xff2b2728, 0xff231f20, 0xff221e1f, 0xff3a3637, 0xffc7c6c6, 0xffffffff, 0xffffffff, 0xffcbcbcb, 0xff292527, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff272324, 0xff9b9999, 0xfffdfdfd, 0xffffffff, 0xfff9f8f8, 0xff949192, 0xff3d393a, 0xff262223, 0xff201c1d, 0xff1e1a1b, 0xff1e1a1b, 0xff1e191a, 0xff1d191a, 0xff1b1718, 0xff1f1b1c, 0xffc6c5c5, 0xffffffff, 0xffffffff, 0xffbcbbbb, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff484445, 0xffdadada, 0xffffffff, 0xffffffff, 0xffd4d2d2, 0xff5c595a, 0xff2f2b2c, 0xff221e1f, 0xff1f1b1c, 0xff1e1a1b, 0xff1e1a1b, 0xff1d191a, 0xff1d191a, 0xff140f10, 0xff656363, 0xfff5f5f5, 0xffffffff, 0xfff4f4f4, 0xff777576, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe7e7e7, 0xff423e3f, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff534f50, 0xfffafbfb, 0xffffffff, 0xffffffff, 0xff7c797a, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff7b7879, 0xfffafafa, 0xffffffff, 0xffffffff, 0xff8c8a8a, 0xff484545, 0xff504d4e, 0xff504d4d, 0xff504d4d, 0xff504d4d, 0xff504d4d, 0xff504d4d, 0xff504d4d, 0xff504d4d, 0xff504d4d, 0xff504d4d, 0xff504d4d, 0xff504d4d, 0xff504d4e, 0xff504d4e, 0xff312e2e, 0xff221f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0x8e231f20, + 0x62231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff252122, 0xff8e8b8b, 0xfffcfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff2f1f2, 0xff4d4a4b, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xffa2a1a1, 0xffffffff, 0xffffffff, 0xffe1e0e0, 0xff434041, 0xff221e1f, 0xff221e1f, 0xff625f5f, 0xfff1f1f1, 0xffffffff, 0xffffffff, 0xff818080, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff3f3b3c, 0xffcfcecf, 0xffffffff, 0xffffffff, 0xffbdbcbc, 0xff292526, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff292627, 0xffd8d7d7, 0xffffffff, 0xffffffff, 0xffbcbbbb, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff232021, 0xff757273, 0xfffdfdfd, 0xffffffff, 0xfffafafa, 0xff5f5d5d, 0xff1e1a1b, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff787676, 0xfff7f7f7, 0xffffffff, 0xfff4f4f4, 0xff777576, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xfff1f1f1, 0xff545152, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff686566, 0xffffffff, 0xffffffff, 0xffffffff, 0xff676566, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff6d6a6b, 0xfff1f1f1, 0xffffffff, 0xffffffff, 0xff858384, 0xff171213, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff211d1e, 0xff231e20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0x62231f20, + 0x2e231f20, 0xf0231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff393536, 0xffc6c5c5, 0xffffffff, 0xffffffff, 0xfff0f0f0, 0xffa6a4a5, 0xffa2a0a1, 0xffa3a1a1, 0xffa3a1a1, 0xffa3a1a1, 0xffa3a1a1, 0xffa3a1a1, 0xffa3a1a1, 0xffa3a1a1, 0xffa3a1a1, 0xffa3a1a1, 0xffa2a1a2, 0xffb6b4b4, 0xfff7f7f7, 0xffffffff, 0xffffffff, 0xff929192, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff5b5758, 0xfff9fafa, 0xffffffff, 0xffffffff, 0xff7a7878, 0xff211d1e, 0xff272324, 0xff9d9b9c, 0xffffffff, 0xffffffff, 0xffebeaea, 0xff3f3c3d, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff535051, 0xffe2e2e2, 0xffffffff, 0xffffffff, 0xff7f7d7d, 0xff1a1517, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffededed, 0xffffffff, 0xffffffff, 0xffbcbbbb, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff252122, 0xff979697, 0xffffffff, 0xffffffff, 0xffd5d5d6, 0xff312d2e, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201b1c, 0xff9c9a9b, 0xfffbfbfb, 0xffffffff, 0xfff4f4f4, 0xff777576, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xfff9f9f9, 0xff747272, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201b1c, 0xff8f8d8e, 0xffffffff, 0xffffffff, 0xfff5f4f4, 0xff4d4a4b, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff555152, 0xffe3e2e2, 0xffffffff, 0xffffffff, 0xffb7b6b6, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf0231f20, 0x2e231f20, + 0x11231f20, 0xc4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221f20, 0xff605e5f, 0xfff1f1f1, 0xffffffff, 0xffffffff, 0xffacabab, 0xff1a1718, 0xff1c1819, 0xff1d191a, 0xff1d191a, 0xff1d191a, 0xff1d191a, 0xff1d191a, 0xff1d191a, 0xff1d191a, 0xff1d191a, 0xff1d191a, 0xff1d191a, 0xff353232, 0xffcccccc, 0xffffffff, 0xffffffff, 0xffdad9da, 0xff322e2f, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff312e2f, 0xffc9c8c8, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff292526, 0xff3c3839, 0xffdad9da, 0xffffffff, 0xffffffff, 0xffaba9aa, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff5e5b5c, 0xffeaeaea, 0xffffffff, 0xffffffff, 0xff6d6b6b, 0xff1b1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1b1718, 0xff7e7c7d, 0xfffefdfe, 0xffffffff, 0xffffffff, 0xffbcbbbb, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff252223, 0xffa6a4a5, 0xffffffff, 0xffffffff, 0xffc6c4c4, 0xff2b2829, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff363233, 0xffcacaca, 0xffffffff, 0xffffffff, 0xfff4f4f4, 0xff777576, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xfffdfdfd, 0xffaaa9aa, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff2c2829, 0xffc9c7c8, 0xffffffff, 0xffffffff, 0xffd1d1d1, 0xff383435, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff383536, 0xffc6c5c6, 0xffffffff, 0xffffffff, 0xffe7e7e7, 0xff464344, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xc4231f20, 0x11231f20, + 0x04231f20, 0x8c231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff272324, 0xff9f9d9d, 0xffffffff, 0xffffffff, 0xfffefefe, 0xff646262, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff272324, 0xff959393, 0xffffffff, 0xffffffff, 0xffffffff, 0xff6d6a6b, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff878586, 0xffffffff, 0xffffffff, 0xfff6f6f6, 0xff4d4a4a, 0xff6a6869, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xff656262, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff595657, 0xffe7e7e6, 0xffffffff, 0xffffffff, 0xff858384, 0xff181416, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff393536, 0xffcdcccc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffbcbbbb, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff252122, 0xffa09e9e, 0xffffffff, 0xffffffff, 0xffdad9d9, 0xff332f30, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff201c1d, 0xff777575, 0xfff2f2f2, 0xffffffff, 0xffffffff, 0xfff4f4f4, 0xff777576, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffe0e0e0, 0xff4f4c4d, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff686566, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xff9c9b9b, 0xff272324, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff908f8f, 0xfffafafa, 0xffffffff, 0xfffcfcfc, 0xffa09e9e, 0xff262223, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0x8c231f20, 0x04231f20, + 0x01231f20, 0x49231f20, 0xf4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff3d3a3b, 0xffdddddd, 0xffffffff, 0xffffffff, 0xffd8d7d7, 0xff322e2f, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221d1e, 0xff605d5e, 0xffececec, 0xffffffff, 0xffffffff, 0xffb9b7b8, 0xff221e20, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff504c4d, 0xffe6e5e5, 0xffffffff, 0xffffffff, 0xff9c9a9b, 0xffb4b2b2, 0xffffffff, 0xffffffff, 0xffd0cfcf, 0xff373334, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff474344, 0xffd8d7d7, 0xffffffff, 0xffffffff, 0xffcbcaca, 0xff322e2f, 0xff1b1718, 0xff211d1e, 0xff221e1f, 0xff221e1f, 0xff211d1e, 0xff1c1819, 0xff2f2b2c, 0xffa09e9f, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffbcbbbb, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff242021, 0xff828081, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xff737171, 0xff1b1617, 0xff1f1b1c, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff1f1b1c, 0xff1f1b1c, 0xff575555, 0xffd7d6d6, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff4f4f4, 0xff777576, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffffffff, 0xfffefefe, 0xffafaeaf, 0xff343132, 0xff1d191a, 0xff211d1e, 0xff221e1f, 0xff221e1f, 0xff201c1d, 0xff1a1617, 0xff474344, 0xffd5d4d4, 0xffffffff, 0xffffffff, 0xffebeaea, 0xff5b5858, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff454343, 0xffd9d8d9, 0xffffffff, 0xffffffff, 0xffefefef, 0xff828081, 0xff2a2627, 0xff1c1819, 0xff201c1d, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff201c1d, 0xff1e191b, 0xff1c1819, 0xff272424, 0xff524f50, 0xff4b4848, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf4231f20, 0x49231f20, 0x01231f20, + 0x00000000, 0x1c231f20, 0xc3231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff757273, 0xffffffff, 0xffffffff, 0xffffffff, 0xff969495, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff393537, 0xffc7c6c6, 0xffffffff, 0xffffffff, 0xffececec, 0xff4c4949, 0xff1c1819, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff302c2d, 0xffb4b3b3, 0xffffffff, 0xffffffff, 0xffeeedee, 0xfff3f3f3, 0xffffffff, 0xffffffff, 0xff918f90, 0xff262223, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2d292a, 0xffafadae, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xffacabab, 0xff434041, 0xff211d1e, 0xff1d191a, 0xff1e1a1b, 0xff262223, 0xff504d4e, 0xffadabab, 0xfff7f7f7, 0xfffbfbfb, 0xfff2f2f2, 0xffffffff, 0xffffffff, 0xffbcbbbb, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff555252, 0xffeaeae9, 0xffffffff, 0xffffffff, 0xffe3e2e2, 0xff726f70, 0xff2b2828, 0xff1e1a1b, 0xff1d191a, 0xff201b1c, 0xff332f30, 0xff777475, 0xffd8d7d7, 0xffffffff, 0xfff3f2f2, 0xfffdfdfd, 0xffffffff, 0xfff4f4f4, 0xff777576, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xfffafafa, 0xfff7f8f8, 0xfffbfbfb, 0xffafaeae, 0xff4c494a, 0xff242021, 0xff1d191a, 0xff1e1a1b, 0xff282425, 0xff615e5f, 0xffcbcacb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffa3a1a2, 0xff2c2829, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c3c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1a1b, 0xff726f70, 0xfff5f5f5, 0xffffffff, 0xffffffff, 0xfff0efef, 0xffa9a7a7, 0xff5a5757, 0xff2d2a2b, 0xff211c1d, 0xff1e1a1b, 0xff1f1b1c, 0xff211d1e, 0xff2a2627, 0xff434041, 0xff706d6e, 0xffaba9aa, 0xffe1e1e1, 0xff868384, 0xff252122, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xc3231f20, 0x1c231f20, 0x00000000, + 0x00000000, 0x06231f20, 0x7c231f20, 0xfc231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff262223, 0xffc0bebf, 0xffffffff, 0xffffffff, 0xfff5f4f4, 0xff575455, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff949293, 0xfffafafa, 0xffffffff, 0xfffbfbfb, 0xff908e8e, 0xff1c1819, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff7a7879, 0xfff6f5f6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe9e9e9, 0xff595657, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201b1c, 0xff605e5e, 0xffebeaea, 0xffffffff, 0xffffffff, 0xfffbfbfb, 0xffdfdedf, 0xffb4b3b3, 0xff9b9999, 0xffa1a0a0, 0xffc0bfbf, 0xffe6e6e6, 0xfffdfdfd, 0xffffffff, 0xffa5a2a3, 0xffc8c6c7, 0xffffffff, 0xffffffff, 0xffbcbbbb, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b999a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f5f, 0xffedecec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2d292a, 0xffa3a1a1, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff1f1f1, 0xffcbcbcb, 0xffa4a3a3, 0xff9a9999, 0xffadabac, 0xffd4d3d3, 0xfff3f3f3, 0xffffffff, 0xffdfdfdf, 0xff9e9c9d, 0xfff6f6f6, 0xffffffff, 0xfff4f4f4, 0xff777576, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe6e5e5, 0xffa09f9e, 0xfffcfcfc, 0xfffdfdfd, 0xffe4e4e4, 0xffbbbaba, 0xff9f9d9d, 0xffa3a0a2, 0xffc5c4c4, 0xffececec, 0xfffefefe, 0xffffffff, 0xffffffff, 0xffcccbcb, 0xff433f40, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242022, 0xffc4c2c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff333031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff242021, 0xff807e7e, 0xfff9f8f8, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xffececec, 0xffd0d0d0, 0xffb2b0b0, 0xffa4a1a2, 0xffa6a3a5, 0xffb5b3b4, 0xffcdcccd, 0xffe2e1e1, 0xfff3f3f3, 0xfffdfdfd, 0xffffffff, 0xff8b8a8a, 0xff242121, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfc231f20, 0x7c231f20, 0x06231f20, 0x00000000, + 0x00000000, 0x00000000, 0x32231f20, 0xd8231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e191a, 0xff514e4f, 0xfff7f7f7, 0xffffffff, 0xffffffff, 0xffc5c4c5, 0xff332f30, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff5c5a5a, 0xffebebeb, 0xffffffff, 0xffffffff, 0xffcdcdcd, 0xff343032, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff484546, 0xffdbdada, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffbdbcbd, 0xff343132, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff807e7f, 0xfff2f2f2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffdfdfd, 0xffabaaaa, 0xff363233, 0xffc1bfc0, 0xffffffff, 0xffffffff, 0xffbcbcbb, 0xff343031, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff454142, 0xffe5e5e5, 0xffffffff, 0xfffbfbfb, 0xff9b9a9a, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1d191a, 0xff615f60, 0xffededec, 0xffffffff, 0xfffafafa, 0xff797778, 0xff1a1617, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff3e3b3c, 0xffc0bebf, 0xfffdfdfe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffe7e6e6, 0xff666364, 0xff656263, 0xfff5f5f5, 0xffffffff, 0xfff4f4f4, 0xff787576, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff232021, 0xffa5a3a3, 0xfffefefe, 0xffffffff, 0xffe2e2e2, 0xff464244, 0xff9e9d9d, 0xfffbfbfb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffd1cfcf, 0xff4b4849, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242122, 0xffc5c4c4, 0xffffffff, 0xffffffff, 0xffc0bfbf, 0xff343031, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff696767, 0xffdddddd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff9f9f9, 0xff7d7b7c, 0xff252122, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xd8231f20, 0x32231f20, 0x00000000, 0x00000000, + 0x00231f20, 0x00000000, 0x05231f20, 0x8e231f20, 0xfa231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1c1819, 0xff7f7d7d, 0xffe1e0e1, 0xffdbdbdb, 0xffdedede, 0xff7f7d7e, 0xff252122, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff302d2e, 0xffb2b1b1, 0xffdcdbdb, 0xffdbdbdb, 0xffcccccc, 0xff555253, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff282425, 0xff9b9999, 0xffdbdbdb, 0xffdbdbdb, 0xffdbdbdb, 0xffd9d8d9, 0xff7b797a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff656263, 0xffc7c6c7, 0xffeeeeee, 0xfff7f6f6, 0xfff8f8f8, 0xfff8f8f8, 0xfff6f6f6, 0xfff0f0f0, 0xffd4d3d3, 0xff838181, 0xff2b2728, 0xff211d1e, 0xffa7a5a6, 0xffe0dfdf, 0xffdedddd, 0xffa3a2a2, 0xff312d2e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff3f3b3c, 0xffc5c4c4, 0xffdcdcdc, 0xffd9d9d9, 0xff888586, 0xff211d1e, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff575455, 0xffcfcdcf, 0xffdbdbdb, 0xffdbd9da, 0xff6b696a, 0xff1b1718, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff363333, 0xff999797, 0xffe0dfe0, 0xfff5f4f4, 0xfff8f7f7, 0xfff9f8f8, 0xfff8f8f8, 0xfff5f5f5, 0xffe7e6e7, 0xffb6b5b5, 0xff535052, 0xff181415, 0xff595556, 0xffd4d3d3, 0xffdbdbdb, 0xffd4d4d4, 0xff696668, 0xff1e1a1b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff231f20, 0xff8f8d8e, 0xffdcdbdb, 0xffdddcdc, 0xffc3c2c2, 0xff322f30, 0xff272425, 0xff828080, 0xffd6d6d6, 0xfff1f1f1, 0xfff7f7f7, 0xfff9f9f9, 0xfff8f8f8, 0xfff5f5f5, 0xffe3e3e3, 0xff9e9d9d, 0xff393536, 0xff1d191a, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff242021, 0xffaaa8a9, 0xffdedede, 0xffdddcdc, 0xffa6a4a5, 0xff312d2e, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1e1a1b, 0xff3c3839, 0xff918f8f, 0xffd3d2d3, 0xffededed, 0xfff5f5f5, 0xfff8f8f8, 0xfff9f9f9, 0xfff8f8f8, 0xfff7f6f6, 0xfff4f3f3, 0xffe8e8e8, 0xffd0cece, 0xff9e9c9c, 0xff5c5959, 0xff2b2829, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfa231f20, 0x8e231f20, 0x05231f20, 0x00000000, 0x00231f20, + 0x00000000, 0x00231f20, 0x00000000, 0x30231f20, 0xd8231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff322e2f, 0xff373435, 0xff363334, 0xff363334, 0xff292526, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff302b2c, 0xff373334, 0xff363334, 0xff363334, 0xff2c2829, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff2c2829, 0xff363334, 0xff363334, 0xff363334, 0xff353233, 0xff282526, 0xff231e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1c1819, 0xff2b2829, 0xff585556, 0xff7b7878, 0xff8a8888, 0xff8b8989, 0xff7b797a, 0xff5e5b5b, 0xff343132, 0xff1d191a, 0xff201c1d, 0xff231f20, 0xff302d2e, 0xff373335, 0xff373334, 0xff312d2e, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff262223, 0xff343132, 0xff373334, 0xff363334, 0xff2d2a2b, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff292526, 0xff353132, 0xff363334, 0xff363334, 0xff2a2728, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff1f1a1b, 0xff403d3e, 0xff6b6869, 0xff848283, 0xff8c8a8a, 0xff868384, 0xff6f6d6d, 0xff4b4748, 0xff242122, 0xff1d191a, 0xff221e1f, 0xff292526, 0xff363233, 0xff373334, 0xff363233, 0xff2a2728, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff2e2a2b, 0xff373334, 0xff373334, 0xff343131, 0xff252122, 0xff201c1d, 0xff1d191a, 0xff373334, 0xff625f60, 0xff807e7e, 0xff8c8a8b, 0xff888686, 0xff6f6c6d, 0xff433f40, 0xff1f1b1c, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff312e2f, 0xff373334, 0xff373334, 0xff312d2e, 0xff242021, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff1d191a, 0xff322e2f, 0xff565354, 0xff737172, 0xff878485, 0xff8d8b8b, 0xff888687, 0xff7d7b7c, 0xff676464, 0xff4d494a, 0xff2d292a, 0xff1d191a, 0xff1c1819, 0xff221d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xd8231f20, 0x30231f20, 0x00000000, 0x00231f20, 0x00000000, + 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x73231f20, 0xfb231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff1c1819, 0xff1c1819, 0xff1e1a1b, 0xff1e1a1b, 0xff1d181a, 0xff1b1718, 0xff1f1b1c, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff1f1b1c, 0xff1f1b1c, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff221d1e, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1e1a1b, 0xff1b1718, 0xff1d191a, 0xff1e1a1b, 0xff1d191a, 0xff1b1718, 0xff1d191a, 0xff211d1e, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff1f1b1c, 0xff1f1b1c, 0xff1f1b1c, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff211d1e, 0xff1f1b1c, 0xff1f1b1c, 0xff201b1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff1b1718, 0xff1d191a, 0xff1e1a1b, 0xff1e1a1b, 0xff1c1718, 0xff1d191a, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff201c1d, 0xff1f1b1c, 0xff1f1b1c, 0xff201c1d, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff1f1b1c, 0xff1c1718, 0xff1c1819, 0xff1e191a, 0xff1f1a1b, 0xff1e1a1b, 0xff1d1819, 0xff1b1718, 0xff1d191a, 0xff201c1d, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfb231f20, 0x73231f20, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, + 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x0e231f20, 0xb5231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff221e1f, 0xff221e1f, 0xff221e1f, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xb5231f20, 0x0e231f20, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x2a231f20, 0xde231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xde231f20, 0x2a231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x51231f20, 0xf4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf4231f20, 0x51231f20, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x03231f20, 0x74231f20, 0xf5231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf5231f20, 0x74231f20, 0x03231f20, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x0a231f20, 0x84231f20, 0xf5231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf5231f20, 0x84231f20, 0x0a231f20, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x10231f20, 0x84231f20, 0xf5231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf5231f20, 0x84231f20, 0x10231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x0a231f20, 0x72231f20, 0xf4231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf4231f20, 0x72231f20, 0x0a231f20, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x03231f20, 0x4f231f20, 0xdd231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xdd231f20, 0x4f231f20, 0x03231f20, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00231f20, 0x00000000, 0x29231f20, 0xb6231f20, 0xfb231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfb231f20, 0xb6231f20, 0x29231f20, 0x00000000, 0x00231f20, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x0e231f20, 0x73231f20, 0xd8231f20, 0xfb231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfb231f20, 0xd8231f20, 0x73231f20, 0x0e231f20, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x30231f20, 0x8e231f20, 0xd6231f20, 0xfd231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfd231f20, 0xd6231f20, 0x8e231f20, 0x30231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x04231f20, 0x32231f20, 0x7b231f20, 0xc2231f20, 0xf3231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf3231f20, 0xc2231f20, 0x7b231f20, 0x32231f20, 0x04231f20, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00231f20, 0x00000000, 0x00000000, 0x06231f20, 0x1c231f20, 0x49231f20, 0x8c231f20, 0xc4231f20, 0xf0231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xf0231f20, 0xc4231f20, 0x8c231f20, 0x49231f20, 0x1c231f20, 0x06231f20, 0x00000000, 0x00000000, 0x00231f20, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x01231f20, 0x04231f20, 0x11231f20, 0x2e231f20, 0x62231f20, 0x8e231f20, 0xb4231f20, 0xd4231f20, 0xe5231f20, 0xf2231f20, 0xfd231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfd231f20, 0xf2231f20, 0xe5231f20, 0xd4231f20, 0xb4231f20, 0x8e231f20, 0x62231f20, 0x2e231f20, 0x11231f20, 0x04231f20, 0x01231f20, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp new file mode 100644 index 00000000000..967b8176b06 --- /dev/null +++ b/src/emu/ui/dirmenu.cpp @@ -0,0 +1,641 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/********************************************************************* + + mewui/dirmenu.cpp + + Internal MEWUI user interface. + +*********************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "ui/dirmenu.h" +#include "ui/datfile.h" +#include "ui/utils.h" +#include "ui/optsmenu.h" + +struct folders_entry +{ + const char *name; + const char *option; +}; + +static const folders_entry s_folders_entry[] = +{ + { "ROMs", OPTION_MEDIAPATH }, + { "MEWUI", OPTION_MEWUI_PATH }, + { "Samples", OPTION_SAMPLEPATH }, + { "DATs", OPTION_HISTORY_PATH }, + { "INIs", OPTION_INIPATH }, + { "Extra INIs", OPTION_EXTRAINI_PATH }, + { "Icons", OPTION_ICONS_PATH }, + { "Cheats", OPTION_CHEATPATH }, + { "Snapshots", OPTION_SNAPSHOT_DIRECTORY }, + { "Cabinets", OPTION_CABINETS_PATH }, + { "Flyers", OPTION_FLYERS_PATH }, + { "Titles", OPTION_TITLES_PATH }, + { "Ends", OPTION_ENDS_PATH }, + { "PCBs", OPTION_PCBS_PATH }, + { "Marquees", OPTION_MARQUEES_PATH }, + { "Controls Panels", OPTION_CPANELS_PATH }, + { "Crosshairs", OPTION_CROSSHAIRPATH }, + { "Artworks", OPTION_ARTPATH }, + { "Bosses", OPTION_BOSSES_PATH }, + { "Artworks Preview", OPTION_ARTPREV_PATH }, + { "Select", OPTION_SELECT_PATH }, + { "GameOver", OPTION_GAMEOVER_PATH }, + { "HowTo", OPTION_HOWTO_PATH }, + { "Logos", OPTION_LOGOS_PATH }, + { "Scores", OPTION_SCORES_PATH }, + { "Versus", OPTION_VERSUS_PATH }, + { nullptr } +}; + +/************************************************** + MENU ADD FOLDER +**************************************************/ +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_add_change_folder::ui_menu_add_change_folder(running_machine &machine, render_container *container, int ref, bool _change) : ui_menu(machine, container) +{ + m_ref = ref - 1; + m_change = _change; + m_search[0] = '\0'; + + // configure the starting's path + char *dst = nullptr; + osd_get_full_path(&dst, "."); + m_current_path = dst; + osd_free(dst); +} + +ui_menu_add_change_folder::~ui_menu_add_change_folder() +{ +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_add_change_folder::handle() +{ + // process the menu + const ui_menu_event *m_event = process(0); + + if (m_event != nullptr && m_event->itemref != nullptr) + { + if (m_event->iptkey == IPT_UI_SELECT) + { + int index = (FPTR)m_event->itemref - 1; + const ui_menu_item &pitem = item[index]; + + // go up to the parent path + if (!strcmp(pitem.text, "..")) + { + size_t first_sep = m_current_path.find_first_of(PATH_SEPARATOR[0]); + size_t last_sep = m_current_path.find_last_of(PATH_SEPARATOR[0]); + if (first_sep != last_sep) + m_current_path.erase(++last_sep); + } + else + { + // if isn't a drive, appends the directory + if (strcmp(pitem.subtext, "[DRIVE]") != 0) + { + if (m_current_path[m_current_path.length() - 1] == PATH_SEPARATOR[0]) + m_current_path.append(pitem.text); + else + m_current_path.append(PATH_SEPARATOR).append(pitem.text); + } + else + m_current_path = pitem.text; + } + + // reset the char buffer also in this case + if (m_search[0] != 0) + m_search[0] = '\0'; + reset(UI_MENU_RESET_SELECT_FIRST); + } + else if (m_event->iptkey == IPT_SPECIAL) + { + int buflen = strlen(m_search); + bool update_selected = FALSE; + + // if it's a backspace and we can handle it, do so + if ((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0) + { + *(char *)utf8_previous_char(&m_search[buflen]) = 0; + update_selected = TRUE; + } + // if it's any other key and we're not maxed out, update + else if (m_event->unichar >= ' ' && m_event->unichar < 0x7f) + { + buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar); + m_search[buflen] = 0; + update_selected = TRUE; + } + // Tab key, save current path + else if (m_event->unichar == 0x09) + { + std::string error_string; + if (m_change) + { + machine().options().set_value(s_folders_entry[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().datfile().reset_run(); + } + else + { + std::string tmppath = std::string(machine().options().value(s_folders_entry[m_ref].option)).append(";").append(m_current_path.c_str()); + machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + } + + ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST); + ui_menu::stack_pop(machine()); + } + + // check for entries which matches our search buffer + if (update_selected) + { + const int cur_selected = selected; + int entry, bestmatch = 0; + + // from current item to the end + for (entry = cur_selected; entry < item.size(); entry++) + if (item[entry].ref != nullptr && m_search[0] != 0) + { + int match = 0; + for (int i = 0; i < ARRAY_LENGTH(m_search); i++) + { + if (core_strnicmp(item[entry].text, m_search, i) == 0) + match = i; + } + + if (match > bestmatch) + { + bestmatch = match; + selected = entry; + } + } + + // and from the first item to current one + for (entry = 0; entry < cur_selected; entry++) + { + if (item[entry].ref != nullptr && m_search[0] != 0) + { + int match = 0; + for (int i = 0; i < ARRAY_LENGTH(m_search); i++) + { + if (core_strnicmp(item[entry].text, m_search, i) == 0) + match = i; + } + + if (match > bestmatch) + { + bestmatch = match; + selected = entry; + } + } + } + } + } + else if (m_event->iptkey == IPT_UI_CANCEL) + { + // reset the char buffer also in this case + if (m_search[0] != 0) + m_search[0] = '\0'; + } + } +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_add_change_folder::populate() +{ + // open a path + const char *volume_name; + file_enumerator path(m_current_path.c_str()); + const osd_directory_entry *dirent; + int folders_count = 0; + + // add the drives + for (int i = 0; (volume_name = osd_get_volume_name(i)) != nullptr; i++) + item_append(volume_name, "[DRIVE]", 0, (void *)(FPTR)++folders_count); + + // add the directories + while ((dirent = path.next()) != nullptr) + { + if (dirent->type == ENTTYPE_DIR && strcmp(dirent->name, ".") != 0) + item_append(dirent->name, "[DIR]", 0, (void *)(FPTR)++folders_count); + } + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + // configure the custom rendering + customtop = 2.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + custombottom = 1.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_add_change_folder::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width, maxwidth = origx2 - origx1; + ui_manager &mui = machine().ui(); + std::string tempbuf[2]; + tempbuf[0] = (m_change) ? "Change" : "Add"; + tempbuf[0].append(" ").append(s_folders_entry[m_ref].name).append(" Folder - Search: ").append(m_search).append("_"); + tempbuf[1] = m_current_path; + + // get the size of the text + for (auto & elem: tempbuf) + { + mui.draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + maxwidth = MAX(width, maxwidth); + } + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + for (auto & elem : tempbuf) + { + mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + y1 = y1 + mui.get_line_height(); + } + + // bottom text + tempbuf[0] = "Press TAB to set"; + + mui.draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = origy2 + UI_BOX_TB_BORDER; + y2 = origy2 + bottom; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + +} + +/************************************************** + MENU DIRECTORY +**************************************************/ +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_directory::ui_menu_directory(running_machine &machine, render_container *container) : ui_menu(machine, container) +{ +} + +ui_menu_directory::~ui_menu_directory() +{ + save_game_options(machine()); + mewui_globals::reset = true; +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_directory::handle() +{ + // process the menu + const ui_menu_event *m_event = process(0); + + if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) + { + int ref = (FPTR)m_event->itemref; + bool change = (ref == HISTORY_FOLDERS || ref == EXTRAINI_FOLDERS || ref == MEWUI_FOLDERS); + ui_menu::stack_push(global_alloc_clear(machine(), container, ref, change)); + } +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_directory::populate() +{ + item_append("Roms", nullptr, 0, (void *)(FPTR)ROM_FOLDERS); + item_append("MEWUI", nullptr, 0, (void *)(FPTR)MEWUI_FOLDERS); + item_append("Samples", nullptr, 0, (void *)(FPTR)SAMPLE_FOLDERS); + item_append("INIs", nullptr, 0, (void *)(FPTR)INI_FOLDERS); + item_append("Artwork", nullptr, 0, (void *)(FPTR)ARTWORK_FOLDERS); + item_append("DATs (History, Mameinfo, etc...)", nullptr, 0, (void *)(FPTR)HISTORY_FOLDERS); + item_append("Extra INI (Category, etc...)", nullptr, 0, (void *)(FPTR)EXTRAINI_FOLDERS); + item_append("Icons", nullptr, 0, (void *)(FPTR)ICON_FOLDERS); + item_append("Cheats", nullptr, 0, (void *)(FPTR)CHEAT_FOLDERS); + item_append("Snapshots", nullptr, 0, (void *)(FPTR)SNAPSHOT_FOLDERS); + item_append("Cabinets", nullptr, 0, (void *)(FPTR)CABINET_FOLDERS); + item_append("Flyers", nullptr, 0, (void *)(FPTR)FLYER_FOLDERS); + item_append("Titles", nullptr, 0, (void *)(FPTR)TITLE_FOLDERS); + item_append("Ends", nullptr, 0, (void *)(FPTR)ENDS_FOLDERS); + item_append("PCBs", nullptr, 0, (void *)(FPTR)PCB_FOLDERS); + item_append("Marquees", nullptr, 0, (void *)(FPTR)MARQUEES_FOLDERS); + item_append("Control Panels", nullptr, 0, (void *)(FPTR)CPANEL_FOLDERS); + item_append("Bosses", nullptr, 0, (void *)(FPTR)BOSSES_FOLDERS); + item_append("Versus", nullptr, 0, (void *)(FPTR)VERSUS_FOLDERS); + item_append("Game Over", nullptr, 0, (void *)(FPTR)GAMEOVER_FOLDERS); + item_append("How To", nullptr, 0, (void *)(FPTR)HOWTO_FOLDERS); + item_append("Select", nullptr, 0, (void *)(FPTR)SELECT_FOLDERS); + item_append("Artwork Preview", nullptr, 0, (void *)(FPTR)ARTPREV_FOLDERS); + item_append("Scores", nullptr, 0, (void *)(FPTR)SCORES_FOLDERS); + item_append("Logos", nullptr, 0, (void *)(FPTR)LOGO_FOLDERS); + item_append("Crosshairs", nullptr, 0, (void *)(FPTR)CROSSHAIR_FOLDERS); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_directory::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + + // get the size of the text + mui.draw_text_full(container, "Folder Setup", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + float maxwidth = MAX(width, origx2 - origx1); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, "Folder Setup", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} + +/************************************************** + MENU DISPLAY PATH +**************************************************/ +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_display_actual::ui_menu_display_actual(running_machine &machine, render_container *container, int ref, bool _change) : ui_menu(machine, container) +{ + m_ref = ref; + m_change = _change; +} + +ui_menu_display_actual::~ui_menu_display_actual() +{ +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_display_actual::handle() +{ + // process the menu + const ui_menu_event *m_event = process(0); + if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) + switch ((FPTR)m_event->itemref) + { + case REMOVE_FOLDER: + ui_menu::stack_push(global_alloc_clear(machine(), container, m_ref)); + break; + + case ADD_FOLDER: + case CHANGE_FOLDER: + ui_menu::stack_push(global_alloc_clear(machine(), container, m_ref, m_change)); + break; + } +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_display_actual::populate() +{ + m_tempbuf.assign("Current ").append(s_folders_entry[m_ref - 1].name).append(" Folders"); + m_searchpath.assign(machine().options().value(s_folders_entry[m_ref - 1].option)); + path_iterator path(m_searchpath.c_str()); + std::string curpath; + m_folders.clear(); + while (path.next(curpath, nullptr)) + m_folders.push_back(curpath); + + if (m_change) + item_append("Change Folder", nullptr, 0, (void *)CHANGE_FOLDER); + else + item_append("Add Folder", nullptr, 0, (void *)ADD_FOLDER); + + if (m_folders.size() > 1) + item_append("Remove Folder", nullptr, 0, (void *)REMOVE_FOLDER); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = (m_folders.size() + 1) * machine().ui().get_line_height() + 6.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_display_actual::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width, maxwidth = origx2 - origx1; + ui_manager &mui = machine().ui(); + float lineh = mui.get_line_height(); + + for (auto & elem : m_folders) + { + mui.draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + maxwidth = MAX(maxwidth, width); + } + + // get the size of the text + mui.draw_text_full(container, m_tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + maxwidth = MAX(width, maxwidth); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = y1 + lineh + 2.0f * UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, m_tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = y2 + 2.0f * UI_BOX_TB_BORDER; + y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + for (auto & elem : m_folders) + { + mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_LEFT, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + y1 += lineh; + } + +} + +/************************************************** + MENU REMOVE FOLDER +**************************************************/ +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_remove_folder::ui_menu_remove_folder(running_machine &machine, render_container *container, int ref) : ui_menu(machine, container) +{ + m_ref = ref - 1; + m_searchpath.assign(machine.options().value(s_folders_entry[m_ref].option)); +} + +ui_menu_remove_folder::~ui_menu_remove_folder() +{ +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_remove_folder::handle() +{ + // process the menu + const ui_menu_event *m_event = process(0); + if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) + { + int index = (FPTR)m_event->itemref - 1; + std::string tmppath; + for (size_t i = 0; i < item.size() - 2; i++) + if (i != index) + tmppath.append(item[i].text).append(";"); + + tmppath.substr(0, tmppath.size() - 1); + std::string error_string; + machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF); + ui_menu::stack_pop(machine()); + } +} + +//------------------------------------------------- +// populate menu +//------------------------------------------------- + +void ui_menu_remove_folder::populate() +{ + path_iterator path(m_searchpath.c_str()); + std::string curpath; + int folders_count = 0; + + while (path.next(curpath, nullptr)) + item_append(curpath.c_str(), nullptr, 0, (void *)(FPTR)++folders_count); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_remove_folder::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + std::string tempbuf = std::string("Remove ").append(s_folders_entry[m_ref].name).append(" Folder"); + + // get the size of the text + mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + float maxwidth = MAX(width, origx2 - origx1); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, + UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} diff --git a/src/emu/ui/dirmenu.h b/src/emu/ui/dirmenu.h new file mode 100644 index 00000000000..9d6a8fc6ef4 --- /dev/null +++ b/src/emu/ui/dirmenu.h @@ -0,0 +1,128 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/dirmenu.h + + Internal MEWUI user interface. + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_DIRMENU_H__ +#define __MEWUI_DIRMENU_H__ + +//------------------------------------------------- +// class directory menu +//------------------------------------------------- + +class ui_menu_directory : public ui_menu +{ +public: + ui_menu_directory(running_machine &machine, render_container *container); + virtual ~ui_menu_directory(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + enum + { + ROM_FOLDERS = 1, + MEWUI_FOLDERS, + SAMPLE_FOLDERS, + HISTORY_FOLDERS, + INI_FOLDERS, + EXTRAINI_FOLDERS, + ICON_FOLDERS, + CHEAT_FOLDERS, + SNAPSHOT_FOLDERS, + CABINET_FOLDERS, + FLYER_FOLDERS, + TITLE_FOLDERS, + ENDS_FOLDERS, + PCB_FOLDERS, + MARQUEES_FOLDERS, + CPANEL_FOLDERS, + CROSSHAIR_FOLDERS, + ARTWORK_FOLDERS, + BOSSES_FOLDERS, + ARTPREV_FOLDERS, + SELECT_FOLDERS, + GAMEOVER_FOLDERS, + HOWTO_FOLDERS, + LOGO_FOLDERS, + SCORES_FOLDERS, + VERSUS_FOLDERS + }; +}; + +//------------------------------------------------- +// class directory specific menu +//------------------------------------------------- + +class ui_menu_display_actual : public ui_menu +{ +public: + ui_menu_display_actual(running_machine &machine, render_container *container, int selectedref, bool _change); + virtual ~ui_menu_display_actual(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + std::string m_tempbuf, m_searchpath; + std::vector m_folders; + int m_ref; + bool m_change; + + enum + { + ADD_FOLDER = 1, + REMOVE_FOLDER, + CHANGE_FOLDER + }; +}; + +//------------------------------------------------- +// class remove folder menu +//------------------------------------------------- + +class ui_menu_remove_folder : public ui_menu +{ +public: + ui_menu_remove_folder(running_machine &machine, render_container *container, int ref); + virtual ~ui_menu_remove_folder(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + std::string m_searchpath; + int m_ref; +}; + +//------------------------------------------------- +// class add / change folder menu +//------------------------------------------------- + +class ui_menu_add_change_folder : public ui_menu +{ +public: + ui_menu_add_change_folder(running_machine &machine, render_container *container, int ref, bool change); + virtual ~ui_menu_add_change_folder(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + + virtual bool menu_has_search_active() override { return (m_search[0] != 0); } + +private: + int m_ref; + std::string m_current_path; + char m_search[40]; + bool m_change; +}; + +#endif /* __MEWUI_DIRMENU_H__ */ diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp new file mode 100644 index 00000000000..6927043c165 --- /dev/null +++ b/src/emu/ui/dsplmenu.cpp @@ -0,0 +1,194 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/********************************************************************* + + mewui/dsplmenu.cpp + + MEWUI video options menu. + +*********************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "ui/dsplmenu.h" +#include "ui/selector.h" +#include "ui/utils.h" + +#if defined(MEWUI_WINDOWS) && !defined(MEWUI_SDL) +#include "../osd/windows/winmain.h" +#else +#include "../osd/modules/lib/osdobj_common.h" +#endif + +ui_menu_display_options::video_modes ui_menu_display_options::m_video[] = { + { "auto", "Auto" }, + { "opengl", "OpenGL" }, +#if defined(MEWUI_WINDOWS) && !defined(MEWUI_SDL) + { "d3d", "Direct3D" }, + { "gdi", "GDI" }, + { "ddraw", "DirectDraw" } +#else + { "soft", "Software" }, + { "accel", "SDL2 Accelerated" } +#endif +}; + +ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = { + { 0, nullptr, nullptr }, + { 0, "Video Mode", OSDOPTION_VIDEO }, +#if defined(MEWUI_WINDOWS) && !defined(MEWUI_SDL) + { 0, "Hardware Stretch", WINOPTION_HWSTRETCH }, + { 0, "Triple Buffering", WINOPTION_TRIPLEBUFFER }, + { 0, "HLSL", WINOPTION_HLSL_ENABLE }, +#endif + { 0, "GLSL", OSDOPTION_GL_GLSL }, + { 0, "Bilinear Filtering", OSDOPTION_FILTER }, + { 0, "Bitmap Prescaling", OSDOPTION_PRESCALE }, + { 0, "Multi-Threaded Rendering", OSDOPTION_MULTITHREADING }, + { 0, "Window Mode", OSDOPTION_WINDOW }, + { 0, "Enforce Aspect Ratio", OSDOPTION_KEEPASPECT }, + { 0, "Start Out Maximized", OSDOPTION_MAXIMIZE }, + { 0, "Synchronized Refresh", OSDOPTION_SYNCREFRESH }, + { 0, "Wait Vertical Sync", OSDOPTION_WAITVSYNC } +}; + + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_menu_display_options::ui_menu_display_options(running_machine &machine, render_container *container) : ui_menu(machine, container) +{ +#if defined(MEWUI_WINDOWS) && !defined(MEWUI_SDL) + windows_options &options = downcast(machine.options()); +#else + osd_options &options = downcast(machine.options()); +#endif + + for (int d = 2; d < ARRAY_LENGTH(m_options); ++d) + m_options[d].status = options.int_value(m_options[d].option); + + m_options[1].status = 0; + for (int cur = 0; cur < ARRAY_LENGTH(m_video); ++cur) + if (!core_stricmp(options.video(), m_video[cur].option)) + { + m_options[1].status = cur; + break; + } +} + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_menu_display_options::~ui_menu_display_options() +{ + std::string error_string; + for (int d = 2; d < ARRAY_LENGTH(m_options); ++d) + machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); + + machine().options().set_value(m_options[1].option, m_video[m_options[1].status].option, OPTION_PRIORITY_CMDLINE, error_string); + mewui_globals::reset = true; +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_display_options::handle() +{ + bool changed = false; + + // process the menu + const ui_menu_event *m_event = process(0); + + if (m_event != nullptr && m_event->itemref != nullptr) + { + int value = (FPTR)m_event->itemref; + if (!strcmp(m_options[value].option, OSDOPTION_VIDEO) || !strcmp(m_options[value].option, OSDOPTION_PRESCALE)) + { + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + changed = true; + (m_event->iptkey == IPT_UI_LEFT) ? m_options[value].status-- : m_options[value].status++; + } + else if (m_event->iptkey == IPT_UI_SELECT && !strcmp(m_options[value].option, OSDOPTION_VIDEO)) + { + int total = ARRAY_LENGTH(m_video); + std::vector s_sel(total); + for (int index = 0; index < total; ++index) + s_sel[index] = m_video[index].label; + + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, m_options[value].status)); + } + } + else if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT) + { + changed = true; + m_options[value].status = !m_options[value].status; + } + } + + if (changed) + reset(UI_MENU_RESET_REMEMBER_REF); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_display_options::populate() +{ + // add video mode option + std::string v_text(m_video[m_options[1].status].label); + UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_video) - 1, m_options[1].status); + item_append(m_options[1].description, v_text.c_str(), arrow_flags, (void *)(FPTR)1); + + // add options items + for (int opt = 2; opt < ARRAY_LENGTH(m_options); ++opt) + if (strcmp(m_options[opt].option, OSDOPTION_PRESCALE) != 0) + item_append(m_options[opt].description, m_options[opt].status ? "On" : "Off", + m_options[opt].status ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)opt); + else + { + strprintf(v_text, "%d", m_options[opt].status); + arrow_flags = get_arrow_flags(1, 3, m_options[opt].status); + item_append(m_options[opt].description, v_text.c_str(), arrow_flags, (void *)(FPTR)opt); + } + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_display_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + mui.draw_text_full(container, "Display Options", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + float maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, "Display Options", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} diff --git a/src/emu/ui/dsplmenu.h b/src/emu/ui/dsplmenu.h new file mode 100644 index 00000000000..c52e151612b --- /dev/null +++ b/src/emu/ui/dsplmenu.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/dsplmenu.h + + MEWUI video options menu. + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_DSPLMENU_H__ +#define __MEWUI_DSPLMENU_H__ + +//------------------------------------------------- +// class display options menu +//------------------------------------------------- +class ui_menu_display_options : public ui_menu +{ +public: + ui_menu_display_options(running_machine &machine, render_container *container); + virtual ~ui_menu_display_options(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + struct dspl_option + { + UINT16 status; + const char *description; + const char *option; + }; + + struct video_modes + { + const char *option; + const char *label; + }; + + static video_modes m_video[]; + static dspl_option m_options[]; +}; + +#endif /* __MEWUI_DSPLMENU_H__ */ diff --git a/src/emu/ui/icorender.h b/src/emu/ui/icorender.h new file mode 100644 index 00000000000..915a2b88706 --- /dev/null +++ b/src/emu/ui/icorender.h @@ -0,0 +1,235 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890;Victor Laskin +/*************************************************************************** + + mewui/icorender.h + + ICOns file loader. + + Original code by Victor Laskin (victor.laskin@gmail.com) + http://vitiy.info/Code/ico.cpp + + Revised for MEWUI by dankan1890. + +***************************************************************************/ +#pragma once + +#ifndef __MEWUI_ICORENDER_H__ +#define __MEWUI_ICORENDER_H__ + +// These next two structs represent how the icon information is stored +// in an ICO file. +typedef struct +{ + UINT8 bWidth; // Width of the image + UINT8 bHeight; // Height of the image (times 2) + UINT8 bColorCount; // Number of colors in image (0 if >=8bpp) + UINT8 bReserved; // Reserved + UINT16 wPlanes; // Color Planes + UINT16 wBitCount; // Bits per pixel + UINT32 dwBytesInRes; // how many bytes in this resource? + UINT32 dwImageOffset; // where in the file is this image +} ICONDIRENTRY, *LPICONDIRENTRY; + +typedef struct +{ + UINT16 idReserved; // Reserved + UINT16 idType; // resource type (1 for icons) + UINT16 idCount; // how many images? + //ICONDIRENTRY idEntries[1]; // the entries for each image +} ICONDIR, *LPICONDIR; + +// size - 40 bytes +typedef struct { + UINT32 biSize; + UINT32 biWidth; + UINT32 biHeight; // Icon Height (added height of XOR-Bitmap and AND-Bitmap) + UINT16 biPlanes; + UINT16 biBitCount; + UINT32 biCompression; + INT32 biSizeImage; + UINT32 biXPelsPerMeter; + UINT32 biYPelsPerMeter; + UINT32 biClrUsed; + UINT32 biClrImportant; +} s_BITMAPINFOHEADER, *s_PBITMAPINFOHEADER; + +// 46 bytes +typedef struct{ + s_BITMAPINFOHEADER icHeader; // DIB header + UINT32 icColors[1]; // Color table (short 4 bytes) //RGBQUAD + UINT8 icXOR[1]; // DIB bits for XOR mask + UINT8 icAND[1]; // DIB bits for AND mask +} ICONIMAGE, *LPICONIMAGE; + +//------------------------------------------------- +// load an ICO file into a bitmap +//------------------------------------------------- + +void render_load_ico(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, const char *filename) +{ + INT32 width = 0; + INT32 height = 0; + + // deallocate previous bitmap + bitmap.reset(); + + // define file's full name + std::string fname; + + if (!dirname) + fname = filename; + else + fname.assign(dirname).append(PATH_SEPARATOR).append(filename); + + file_error filerr = file.open(fname.c_str()); + + if (filerr != FILERR_NONE) + return; + + // allocates a buffer for the image + UINT64 size = file.size(); + UINT8 *buffer = global_alloc_array(UINT8, size + 1); + + // read data from the file and set them in the buffer + file.read(buffer, size); + + LPICONDIR icoDir = (LPICONDIR)buffer; + int iconsCount = icoDir->idCount; + + if (icoDir->idReserved != 0 || icoDir->idType != 1 || iconsCount == 0 || iconsCount > 20) + { + file.close(); + global_free_array(buffer); + return; + } + + UINT8* cursor = buffer; + cursor += 6; + ICONDIRENTRY* dirEntry = (ICONDIRENTRY*)(cursor); + int maxSize = 0; + int offset = 0; + int maxBitCount = 0; + for (int i = 0; i < iconsCount; i++, ++dirEntry) + { + int w = dirEntry->bWidth; + int h = dirEntry->bHeight; + int bitCount = dirEntry->wBitCount; + if (w * h > maxSize || bitCount > maxBitCount) // we choose icon with max resolution + { + width = w; + height = h; + offset = dirEntry->dwImageOffset; + maxSize = w * h; + } + } + + if (offset == 0) return; + + cursor = buffer; + cursor += offset; + ICONIMAGE* icon = (ICONIMAGE*)(cursor); + int realBitsCount = (int)icon->icHeader.biBitCount; + bool hasAndMask = (realBitsCount < 32) && (height != icon->icHeader.biHeight); + + cursor += 40; + bitmap.allocate(width, height); + + // rgba + vertical swap + if (realBitsCount >= 32) + { + for (int x = 0; x < width; ++x) + for (int y = 0; y < height; ++y) + { + int shift2 = 4 * (x + (height - y - 1) * width); + bitmap.pix32(y, x) = rgb_t(cursor[shift2 + 3], cursor[shift2 + 2], cursor[shift2 + 1], cursor[shift2]); + } + } + else if (realBitsCount == 24) + for (int x = 0; x < width; ++x) + for (int y = 0; y < height; ++y) + { + int shift2 = 3 * (x + (height - y - 1) * width); + bitmap.pix32(y, x) = rgb_t(255, cursor[shift2 + 2], cursor[shift2 + 1], cursor[shift2]); + } + else if (realBitsCount == 8) // 256 colors + { + // 256 color table + UINT8 *colors = cursor; + cursor += 256 * 4; + for (int x = 0; x < width; ++x) + for (int y = 0; y < height; ++y) + { + int shift2 = (x + (height - y - 1) * width); + int index = 4 * cursor[shift2]; + bitmap.pix32(y, x) = rgb_t(255, colors[index + 2], colors[index + 1], colors[index]); + } + } + else if (realBitsCount == 4) // 16 colors + { + // 16 color table + UINT8 *colors = cursor; + cursor += 16 * 4; + for (int x = 0; x < width; ++x) + for (int y = 0; y < height; ++y) + { + int shift2 = (x + (height - y - 1) * width); + UINT8 index = cursor[shift2 / 2]; + if (shift2 % 2 == 0) + index = (index >> 4) & 0xF; + else + index = index & 0xF; + index *= 4; + bitmap.pix32(y, x) = rgb_t(255, colors[index + 2], colors[index + 1], colors[index]); + } + } + else if (realBitsCount == 1) // 2 colors + { + // 2 color table + UINT8 *colors = cursor; + cursor += 2 * 4; + int boundary = width; // !!! 32 bit boundary (http://www.daubnet.com/en/file-format-ico) + while (boundary % 32 != 0) boundary++; + + for (int x = 0; x < width; ++x) + for (int y = 0; y < height; ++y) + { + int shift2 = (x + (height - y - 1) * boundary); + UINT8 index = cursor[shift2 / 8]; + + // select 1 bit only + UINT8 bit = 7 - (x % 8); + index = (index >> bit) & 0x01; + index *= 4; + bitmap.pix32(y, x) = rgb_t(255, colors[index + 2], colors[index + 1], colors[index]); + } + } + + // Read AND mask after base color data - 1 BIT MASK + if (hasAndMask) + { + int boundary = width * realBitsCount; // !!! 32 bit boundary (http://www.daubnet.com/en/file-format-ico) + while (boundary % 32 != 0) boundary++; + cursor += boundary * height / 8; + + boundary = width; + while (boundary % 32 != 0) boundary++; + + for (int y = 0; y < height; ++y) + for (int x = 0; x < width; ++x) + { + UINT8 bit = 7 - (x % 8); + int shift2 = (x + (height - y - 1) * boundary) / 8; + int mask = (0x01 & ((UINT8)cursor[shift2] >> bit)); + rgb_t colors = bitmap.pix32(y, x); + UINT8 alpha = colors.a(); + alpha *= 1 - mask; + colors.set_a(alpha); + bitmap.pix32(y, x) = colors; + } + } + file.close(); + global_free_array(buffer); +} + +#endif /* __MEWUI_ICORENDER_H__ */ diff --git a/src/emu/ui/inifile.cpp b/src/emu/ui/inifile.cpp new file mode 100644 index 00000000000..d261385b5cb --- /dev/null +++ b/src/emu/ui/inifile.cpp @@ -0,0 +1,453 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/inifile.cpp + + MEWUI INIs file manager. + +***************************************************************************/ + +#include "emu.h" +#include "ui/inifile.h" +#include "softlist.h" +#include "drivenum.h" +#include + +//------------------------------------------------- +// GLOBAL VARIABLES +//------------------------------------------------- +UINT16 inifile_manager::current_category = 0; +UINT16 inifile_manager::current_file = 0; + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +inifile_manager::inifile_manager(running_machine &machine) + : m_machine(machine) +{ + ini_index.clear(); + directory_scan(); +} + +//------------------------------------------------- +// scan directories and create index +//------------------------------------------------- + +void inifile_manager::directory_scan() +{ + // open extra INIs folder + file_enumerator path(machine().options().extraini_path()); + const osd_directory_entry *dir; + + // loop into folder's file + while ((dir = path.next()) != nullptr) + { + int length = strlen(dir->name); + std::string filename(dir->name); + + // skip mewui_favorite file + if (!core_stricmp("mewui_favorite.ini", filename.c_str())) + continue; + + // check .ini file ending + if ((length > 4) && dir->name[length - 4] == '.' && tolower((UINT8)dir->name[length - 3]) == 'i' && + tolower((UINT8)dir->name[length - 2]) == 'n' && tolower((UINT8)dir->name[length - 1]) == 'i') + { + // try to open file and indexing + if (parseopen(filename.c_str())) + { + init_category(filename); + parseclose(); + } + } + } +} + +//------------------------------------------------- +// initialize category +//------------------------------------------------- + +void inifile_manager::init_category(std::string &filename) +{ + categoryindex index; + char rbuf[MAX_CHAR_INFO]; + std::string readbuf, name; + while (fgets(rbuf, MAX_CHAR_INFO, fp) != nullptr) + { + readbuf = rbuf; + if (readbuf[0] == '[') + { + size_t found = readbuf.find("]"); + name = readbuf.substr(1, found - 1); + if (name == "FOLDER_SETTINGS" || name == "ROOT_FOLDER") + continue; + else + index.emplace_back(name, ftell(fp)); + } + } + + if (!index.empty()) + ini_index.emplace_back(filename, index); +} + +//------------------------------------------------- +// load and indexing ini files +//------------------------------------------------- + +void inifile_manager::load_ini_category(std::vector &temp_filter) +{ + if (ini_index.empty()) + return; + + bool search_clones = false; + std::string filename(ini_index[current_file].name); + long offset = ini_index[current_file].category[current_category].offset; + + if (!core_stricmp(filename.c_str(), "category.ini") || !core_stricmp(filename.c_str(), "alltime.ini")) + search_clones = true; + + if (parseopen(filename.c_str())) + { + fseek(fp, offset, SEEK_SET); + int num_game = driver_list::total(); + char rbuf[MAX_CHAR_INFO]; + std::string readbuf; + while (fgets(rbuf, MAX_CHAR_INFO, fp) != nullptr) + { + readbuf = chartrimcarriage(rbuf); + + if (readbuf.empty() || readbuf[0] == '[') + break; + + int dfind = driver_list::find(readbuf.c_str()); + if (dfind != -1 && search_clones) + { + temp_filter.push_back(dfind); + int clone_of = driver_list::non_bios_clone(dfind); + if (clone_of == -1) + { + for (int x = 0; x < num_game; x++) + if (readbuf == driver_list::driver(x).parent && readbuf != driver_list::driver(x).name) + temp_filter.push_back(x); + } + } + else if (dfind != -1) + temp_filter.push_back(dfind); + } + parseclose(); + } +} + +//--------------------------------------------------------- +// parseopen - Open up file for reading +//--------------------------------------------------------- + +bool inifile_manager::parseopen(const char *filename) +{ + // MAME core file parsing functions fail in recognizing UNICODE chars in UTF-8 without BOM, + // so it's better and faster use standard C fileio functions. + + emu_file file(machine().options().extraini_path(), OPEN_FLAG_READ); + if (file.open(filename) != FILERR_NONE) + return false; + + m_fullpath = file.fullpath(); + file.close(); + fp = fopen(m_fullpath.c_str(), "r"); + + fgetc(fp); + fseek(fp, 0, SEEK_SET); + return true; +} + +/************************************************************************** + FAVORITE MANAGER +**************************************************************************/ + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +favorite_manager::favorite_manager(running_machine &machine) + : m_machine(machine) +{ + m_current = -1; + parse_favorite(); +} + +//------------------------------------------------- +// add a game +//------------------------------------------------- + +void favorite_manager::add_favorite_game(const game_driver *driver) +{ + m_list.emplace_back(driver->name, driver->description, "", "", "", 0, "", driver, "", "", "", 1, "", "", "", true); + save_favorite_games(); +} + +//------------------------------------------------- +// add a system +//------------------------------------------------- + +void favorite_manager::add_favorite_game(ui_software_info &swinfo) +{ + m_list.push_back(swinfo); + save_favorite_games(); +} + +//------------------------------------------------- +// add a game / system +//------------------------------------------------- + +void favorite_manager::add_favorite_game() +{ + if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0) + { + add_favorite_game(&machine().system()); + return; + } + + bool software_avail = false; + image_interface_iterator iter(machine().root_device()); + for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) + { + if (image->exists() && image->software_entry()) + { + const software_info *swinfo = image->software_entry(); + const software_part *part = image->part_entry(); + ui_software_info tmpmatches; + tmpmatches.shortname = strensure(swinfo->shortname()); + tmpmatches.longname = strensure(image->longname()); + tmpmatches.parentname = strensure(swinfo->parentname()); + tmpmatches.year = strensure(image->year()); + tmpmatches.publisher = strensure(image->manufacturer()); + tmpmatches.supported = image->supported(); + tmpmatches.part = strensure(part->name()); + tmpmatches.driver = &machine().system(); + tmpmatches.listname = strensure(image->software_list_name()); + tmpmatches.interface = strensure(part->interface()); + tmpmatches.instance = strensure(image->instance_name()); + tmpmatches.startempty = 0; + tmpmatches.parentlongname.clear(); + if (swinfo->parentname()) + { + software_list_device *swlist = software_list_device::find_by_name(machine().config(), image->software_list_name()); + for (software_info *c_swinfo = swlist->first_software_info(); c_swinfo != nullptr; c_swinfo = c_swinfo->next()) + { + std::string c_parent(c_swinfo->parentname()); + if (!c_parent.empty() && c_parent == swinfo->shortname()) + { + tmpmatches.parentlongname = c_swinfo->longname(); + break; + } + } + } + + tmpmatches.usage.clear(); + for (feature_list_item *flist = swinfo->other_info(); flist != nullptr; flist = flist->next()) + if (!strcmp(flist->name(), "usage")) + tmpmatches.usage = flist->value(); + + tmpmatches.devicetype = strensure(image->image_type_name()); + tmpmatches.available = true; + software_avail = true; + m_list.push_back(tmpmatches); + save_favorite_games(); + } + } + + if (!software_avail) + add_favorite_game(&machine().system()); +} + +//------------------------------------------------- +// remove a favorite from list +//------------------------------------------------- + +void favorite_manager::remove_favorite_game(ui_software_info &swinfo) +{ + m_list.erase(std::remove(m_list.begin(), m_list.end(), swinfo), m_list.end()); + save_favorite_games(); +} + +//------------------------------------------------- +// remove a favorite from list +//------------------------------------------------- + +void favorite_manager::remove_favorite_game() +{ + m_list.erase(m_list.begin() + m_current); + save_favorite_games(); +} + +//------------------------------------------------- +// check if game is already in favorite list +//------------------------------------------------- + +bool favorite_manager::isgame_favorite() +{ + if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0) + return isgame_favorite(&machine().system()); + + image_interface_iterator iter(machine().root_device()); + bool image_loaded = false; + + for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) + { + const software_info *swinfo = image->software_entry(); + if (image->exists() && swinfo != nullptr) + { + image_loaded = true; + for (size_t current = 0; current < m_list.size(); current++) + if (m_list[current].shortname == swinfo->shortname() && + m_list[current].listname == image->software_list_name()) + { + m_current = current; + return true; + } + } + } + + if (!image_loaded) + return isgame_favorite(&machine().system()); + + m_current = -1; + return false; +} + +//------------------------------------------------- +// check if game is already in favorite list +//------------------------------------------------- + +bool favorite_manager::isgame_favorite(const game_driver *driver) +{ + for (size_t x = 0; x < m_list.size(); x++) + if (m_list[x].driver == driver && m_list[x].shortname == driver->name) + { + m_current = x; + return true; + } + + m_current = -1; + return false; +} + +//------------------------------------------------- +// check if game is already in favorite list +//------------------------------------------------- + +bool favorite_manager::isgame_favorite(ui_software_info &swinfo) +{ + for (size_t x = 0; x < m_list.size(); x++) + if (m_list[x] == swinfo) + { + m_current = x; + return true; + } + + m_current = -1; + return false; +} + +//------------------------------------------------- +// parse favorite file +//------------------------------------------------- + +void favorite_manager::parse_favorite() +{ + emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); + if (file.open(favorite_filename) == FILERR_NONE) + { + char readbuf[1024]; + file.gets(readbuf, 1024); + + while (readbuf[0] == '[') + file.gets(readbuf, 1024); + + while (file.gets(readbuf, 1024)) + { + ui_software_info tmpmatches; + tmpmatches.shortname = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + tmpmatches.longname = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + tmpmatches.parentname = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + tmpmatches.year = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + tmpmatches.publisher = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + tmpmatches.supported = atoi(readbuf); + file.gets(readbuf, 1024); + tmpmatches.part = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + chartrimcarriage(readbuf); + int dx = driver_list::find(readbuf); + if (dx == -1) continue; + tmpmatches.driver = &driver_list::driver(dx); + file.gets(readbuf, 1024); + tmpmatches.listname = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + tmpmatches.interface = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + tmpmatches.instance = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + tmpmatches.startempty = atoi(readbuf); + file.gets(readbuf, 1024); + tmpmatches.parentlongname = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + tmpmatches.usage = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + tmpmatches.devicetype = chartrimcarriage(readbuf); + file.gets(readbuf, 1024); + tmpmatches.available = atoi(readbuf); + m_list.push_back(tmpmatches); + } + file.close(); + } +} + +//------------------------------------------------- +// save favorite +//------------------------------------------------- + +void favorite_manager::save_favorite_games() +{ + // attempt to open the output file + emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + if (file.open(favorite_filename) == FILERR_NONE) + { + if (m_list.empty()) + { + file.remove_on_close(); + file.close(); + return; + } + + // generate the favorite INI + std::string text("[ROOT_FOLDER]\n[Favorite]\n\n"); + for (auto & elem : m_list) + { + text += elem.shortname + "\n"; + text += elem.longname + "\n"; + text += elem.parentname + "\n"; + text += elem.year + "\n"; + text += elem.publisher + "\n"; + strcatprintf(text, "%d\n", elem.supported); + text += elem.part + "\n"; + strcatprintf(text, "%s\n", elem.driver->name); + text += elem.listname + "\n"; + text += elem.interface + "\n"; + text += elem.instance + "\n"; + strcatprintf(text, "%d\n", elem.startempty); + text += elem.parentlongname + "\n"; + text += elem.usage + "\n"; + text += elem.devicetype + "\n"; + strcatprintf(text, "%d\n", elem.available); + } + file.puts(text.c_str()); + file.close(); + } +} diff --git a/src/emu/ui/inifile.h b/src/emu/ui/inifile.h new file mode 100644 index 00000000000..f009ec53857 --- /dev/null +++ b/src/emu/ui/inifile.h @@ -0,0 +1,122 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/inifile.h + + MEWUI INIs file manager. + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_INIFILE_H__ +#define __MEWUI_INIFILE_H__ + +#include "ui/utils.h" + +//------------------------------------------------- +// INIFILE MANAGER +//------------------------------------------------- + +class inifile_manager +{ +public: + // category structure + struct IniCategoryIndex + { + IniCategoryIndex(std::string _name, long _offset) { name = _name; offset = _offset; } + std::string name; + long offset; + }; + + using categoryindex = std::vector; + + // ini file structure + struct IniFileIndex + { + IniFileIndex(std::string _name, categoryindex _category) { name = _name; category = _category; } + std::string name; + categoryindex category; + }; + + // construction/destruction + inifile_manager(running_machine &machine); + + // getters + running_machine &machine() const { return m_machine; } + + // load games from category + void load_ini_category(std::vector &temp_filter); + + // files indices + std::vector ini_index; + static UINT16 current_file, current_category; + + std::string actual_file() { return ini_index[current_file].name; } + std::string actual_category() { return ini_index[current_file].category[current_category].name; } + +private: + // init category index + void init_category(std::string &filename); + + // init file index + void directory_scan(); + + // file open/close/seek + bool parseopen(const char *filename); + void parseclose() { if (fp != nullptr) fclose(fp); } + + // internal state + running_machine &m_machine; // reference to our machine + std::string m_fullpath; + FILE *fp = nullptr; +}; + +//------------------------------------------------- +// FAVORITE MANAGER +//------------------------------------------------- + +class favorite_manager +{ +public: + // construction/destruction + favorite_manager(running_machine &machine); + + // favorite indices + std::vector m_list; + + // getters + running_machine &machine() const { return m_machine; } + + // add + void add_favorite_game(); + void add_favorite_game(const game_driver *driver); + void add_favorite_game(ui_software_info &swinfo); + + // check + bool isgame_favorite(); + bool isgame_favorite(const game_driver *driver); + bool isgame_favorite(ui_software_info &swinfo); + + // save + void save_favorite_games(); + + // remove + void remove_favorite_game(); + void remove_favorite_game(ui_software_info &swinfo); + +private: + const char *favorite_filename = "favorites.ini"; + + // current + int m_current; + + // parse file mewui_favorite + void parse_favorite(); + + // internal state + running_machine &m_machine; // reference to our machine +}; + +#endif /* __MEWUI_INIFILE_H__ */ diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp index 75f16b3d9ba..7287c68919c 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/emu/ui/mainmenu.cpp @@ -29,6 +29,9 @@ #include "ui/videoopt.h" #include "imagedev/cassette.h" #include "machine/bcreader.h" +#include "ui/datfile.h" +#include "ui/inifile.h" +#include "ui/datmenu.h" /*************************************************************************** @@ -132,9 +135,62 @@ void ui_menu_main::populate() if (machine().options().cheat() && machine().cheat().first() != nullptr) item_append("Cheat", nullptr, 0, (void *)CHEAT); + /* add history menu */ + if (machine().options().enabled_dats()) + item_append("History Info", nullptr, 0, (void *)HISTORY); + + // add software history menu + if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().options().enabled_dats()) + { + image_interface_iterator iter(machine().root_device()); + for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) + { + const char *name = image->filename(); + if (name != nullptr) + { + item_append("Software History Info", nullptr, 0, (void *)SW_HISTORY); + break; + } + } + } + + /* add mameinfo / messinfo menu */ + if (machine().options().enabled_dats()) + { + if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0) + item_append("MameInfo", nullptr, 0, (void *)MAMEINFO); + else if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0) + item_append("MessInfo", nullptr, 0, (void *)MAMEINFO); + } + + /* add sysinfo menu */ + if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().options().enabled_dats()) + item_append("SysInfo", nullptr, 0, (void *)SYSINFO); + + /* add command list menu */ + if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().options().enabled_dats()) + item_append("Commands Info", nullptr, 0, (void *)COMMAND); + + /* add story menu */ + if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().options().enabled_dats()) + item_append("Mamescores", nullptr, 0, (void *)STORYINFO); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + /* add favorite menu */ + if (!machine().favorite().isgame_favorite()) + item_append("Add To Favorites", nullptr, 0, (void *)ADD_FAVORITE); + else + item_append("Remove From Favorites", nullptr, 0, (void *)REMOVE_FAVORITE); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + menu_text.assign("Quit from ").append(emulator_info::get_capstartgamenoun()); + item_append(menu_text.c_str(), nullptr, 0, (void *)QUIT_GAME); + /* add reset and exit menus */ - strprintf(menu_text, "Select New %s", emulator_info::get_capstartgamenoun()); - item_append(menu_text.c_str(), nullptr, 0, (void *)SELECT_GAME); +// strprintf(menu_text, "Select New %s", emulator_info::get_capstartgamenoun()); +// item_append(menu_text.c_str(), nullptr, 0, (void *)SELECT_GAME); } ui_menu_main::~ui_menu_main() @@ -191,8 +247,8 @@ void ui_menu_main::handle() ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); break; - case PTY_INFO: - ui_menu::stack_push(global_alloc_clear(machine(), container)); + case PTY_INFO: + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case SLOT_DEVICES: @@ -227,9 +283,9 @@ void ui_menu_main::handle() ui_menu::stack_push(global_alloc_clear(machine(), container)); break; - case SELECT_GAME: - ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); - break; +// case SELECT_GAME: +// ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); +// break; case BIOS_SELECTION: ui_menu::stack_push(global_alloc_clear(machine(), container)); @@ -239,6 +295,48 @@ void ui_menu_main::handle() ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); break; + case HISTORY: + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_HISTORY_LOAD)); + break; + + case MAMEINFO: + if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0) + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MAMEINFO_LOAD)); + else + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MESSINFO_LOAD)); + break; + + case SYSINFO: + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_SYSINFO_LOAD)); + break; + + case COMMAND: + ui_menu::stack_push(global_alloc_clear(machine(), container)); + break; + + case STORYINFO: + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_STORY_LOAD)); + break; + + case ADD_FAVORITE: + machine().favorite().add_favorite_game(); + reset(UI_MENU_RESET_REMEMBER_POSITION); + break; + + case REMOVE_FAVORITE: + machine().favorite().remove_favorite_game(); + reset(UI_MENU_RESET_REMEMBER_POSITION); + break; + + case SW_HISTORY: + ui_menu::stack_push(global_alloc_clear(machine(), container)); + break; + + case QUIT_GAME: + ui_menu::stack_pop(machine()); + machine().ui().request_quit(); + break; + default: fatalerror("ui_menu_main::handle - unknown reference\n"); } diff --git a/src/emu/ui/mainmenu.h b/src/emu/ui/mainmenu.h index 27a810341c3..ca697558dbd 100644 --- a/src/emu/ui/mainmenu.h +++ b/src/emu/ui/mainmenu.h @@ -45,7 +45,16 @@ private: SELECT_GAME, BIOS_SELECTION, BARCODE_READ, - PTY_INFO + PTY_INFO, + HISTORY, + MAMEINFO, + SYSINFO, + ADD_FAVORITE, + REMOVE_FAVORITE, + COMMAND, + STORYINFO, + SW_HISTORY, + QUIT_GAME }; }; diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index 33604fbbe62..cbbb0bcdb11 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -2,9 +2,9 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /********************************************************************* - ui/menu.c + ui/menu.c - Internal MAME menus for the user interface. + Internal MAME menus for the user interface. *********************************************************************/ @@ -15,18 +15,56 @@ #include "ui/ui.h" #include "ui/menu.h" #include "ui/mainmenu.h" - +#include "ui/utils.h" +#include "ui/defimg.h" +#include "ui/starimg.h" +#include "ui/optsmenu.h" +#include "ui/datfile.h" +#include "rendfont.h" +#include "ui/custmenu.h" +#include "ui/icorender.h" +#include "ui/toolbar.h" /*************************************************************************** - CONSTANTS + CONSTANTS ***************************************************************************/ -#define UI_MENU_POOL_SIZE 65536 -#define UI_MENU_ALLOC_ITEMS 256 +#define UI_MENU_POOL_SIZE 65536 +#define MAX_ICONS_RENDER 40 + +struct ui_arts_info +{ + const char *title, *path, *addpath; +}; + +static const ui_arts_info arts_info[] = +{ + { "Snapshots", OPTION_SNAPSHOT_DIRECTORY, "snap" }, + { "Cabinets", OPTION_CABINETS_PATH, "cabinets;cabdevs" }, + { "Control Panels", OPTION_CPANELS_PATH, "cpanel" }, + { "PCBs", OPTION_PCBS_PATH, "pcb" }, + { "Flyers", OPTION_FLYERS_PATH, "flyers" }, + { "Titles", OPTION_TITLES_PATH, "titles" }, + { "Ends", OPTION_ENDS_PATH, "ends" }, + { "Artwork Preview", OPTION_ARTPREV_PATH, "artwork preview" }, + { "Bosses", OPTION_BOSSES_PATH, "bosses" }, + { "Logos", OPTION_LOGOS_PATH, "logo" }, + { "Versus", OPTION_VERSUS_PATH, "versus" }, + { "Game Over", OPTION_GAMEOVER_PATH, "gameover" }, + { "HowTo", OPTION_HOWTO_PATH, "howto" }, + { "Scores", OPTION_SCORES_PATH, "scores" }, + { "Select", OPTION_SELECT_PATH, "select" }, + { "Marquees", OPTION_MARQUEES_PATH, "marquees" }, + { nullptr } +}; + +static const char *hover_msg[] = { "Add or remove favorites", "Export displayed list to file", "Show history.dat info", + "Show mameinfo.dat / messinfo.dat info", "Show command.dat info", "Setup directories", + "Configure options" }; /*************************************************************************** - GLOBAL VARIABLES + GLOBAL VARIABLES ***************************************************************************/ ui_menu *ui_menu::menu_stack; @@ -34,9 +72,24 @@ ui_menu *ui_menu::menu_free; std::unique_ptr ui_menu::hilight_bitmap; render_texture *ui_menu::hilight_texture; render_texture *ui_menu::arrow_texture; +render_texture *ui_menu::snapx_texture; +render_texture *ui_menu::hilight_main_texture; +render_texture *ui_menu::bgrnd_texture; +render_texture *ui_menu::star_texture; +render_texture *ui_menu::toolbar_texture[MEWUI_TOOLBAR_BUTTONS]; +render_texture *ui_menu::sw_toolbar_texture[MEWUI_TOOLBAR_BUTTONS]; +render_texture *ui_menu::icons_texture[MAX_ICONS_RENDER]; +std::unique_ptr ui_menu::snapx_bitmap; +std::unique_ptr ui_menu::no_avail_bitmap; +std::unique_ptr ui_menu::star_bitmap; +std::unique_ptr ui_menu::bgrnd_bitmap; +bitmap_argb32 *ui_menu::icons_bitmap[MAX_ICONS_RENDER]; +std::unique_ptr ui_menu::hilight_main_bitmap; +bitmap_argb32 *ui_menu::toolbar_bitmap[MEWUI_TOOLBAR_BUTTONS]; +bitmap_argb32 *ui_menu::sw_toolbar_bitmap[MEWUI_TOOLBAR_BUTTONS]; /*************************************************************************** - INLINE FUNCTIONS + INLINE FUNCTIONS ***************************************************************************/ //------------------------------------------------- @@ -69,7 +122,7 @@ inline bool ui_menu::exclusive_input_pressed(int key, int repeat) /*************************************************************************** - CORE SYSTEM MANAGEMENT + CORE SYSTEM MANAGEMENT ***************************************************************************/ //------------------------------------------------- @@ -78,14 +131,12 @@ inline bool ui_menu::exclusive_input_pressed(int key, int repeat) void ui_menu::init(running_machine &machine) { - int x; - // initialize the menu stack ui_menu::stack_reset(machine); // create a texture for hilighting items hilight_bitmap = std::make_unique(256, 1); - for (x = 0; x < 256; x++) + for (int x = 0; x < 256; x++) { int alpha = 0xff; if (x < 25) alpha = 0xff * x / 25; @@ -98,6 +149,9 @@ void ui_menu::init(running_machine &machine) // create a texture for arrow icons arrow_texture = machine.render().texture_alloc(render_triangle); + // initialize mewui + init_mewui(machine); + // add an exit callback to free memory machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_menu::exit), &machine)); } @@ -114,14 +168,28 @@ void ui_menu::exit(running_machine &machine) ui_menu::clear_free_list(machine); // free textures - machine.render().texture_free(hilight_texture); - machine.render().texture_free(arrow_texture); + render_manager &mre = machine.render(); + mre.texture_free(hilight_texture); + mre.texture_free(arrow_texture); + mre.texture_free(snapx_texture); + mre.texture_free(hilight_main_texture); + mre.texture_free(bgrnd_texture); + mre.texture_free(star_texture); + + for (auto & elem : icons_texture) + mre.texture_free(elem); + + for (int i = 0; i < MEWUI_TOOLBAR_BUTTONS; i++) + { + mre.texture_free(sw_toolbar_texture[i]); + mre.texture_free(toolbar_texture[i]); + } } /*************************************************************************** - CORE MENU MANAGEMENT + CORE MENU MANAGEMENT ***************************************************************************/ //------------------------------------------------- @@ -134,6 +202,8 @@ ui_menu::ui_menu(running_machine &machine, render_container *_container) : m_mac container = _container; reset(UI_MENU_RESET_SELECT_FIRST); + + top_line = 0; } @@ -150,10 +220,6 @@ ui_menu::~ui_menu() pool = pool->next; global_free(ppool); } - - // free the item array - if (item) - global_free(item); } @@ -172,10 +238,10 @@ void ui_menu::reset(ui_menu_reset_options options) else if (options == UI_MENU_RESET_REMEMBER_REF) resetref = item[selected].ref; - // reset all the pools and the numitems back to 0 + // reset all the pools and the item.size() back to 0 for (ui_menu_pool *ppool = pool; ppool != nullptr; ppool = ppool->next) ppool->top = (UINT8 *)(ppool + 1); - numitems = 0; + item.clear(); visitems = 0; selected = 0; std::string backtext; @@ -213,17 +279,6 @@ void ui_menu::set_special_main_menu(bool special) } -//------------------------------------------------- -// populated - returns true if the menu -// has any non-default items in it -//------------------------------------------------- - -bool ui_menu::populated() -{ - return numitems > 1; -} - - //------------------------------------------------- // item_append - append a new item to the // end of the menu @@ -231,49 +286,36 @@ bool ui_menu::populated() void ui_menu::item_append(const char *text, const char *subtext, UINT32 flags, void *ref) { - ui_menu_item *pitem; - int index; - // only allow multiline as the first item if ((flags & MENU_FLAG_MULTILINE) != 0) - assert(numitems == 1); + assert(item.size() == 1); // only allow a single multi-line item - else if (numitems >= 2) + else if (item.size() >= 2) assert((item[0].flags & MENU_FLAG_MULTILINE) == 0); - // realloc the item array if necessary - if (numitems >= allocitems) - { - int olditems = allocitems; - allocitems += UI_MENU_ALLOC_ITEMS; - ui_menu_item *newitems = global_alloc_array(ui_menu_item, allocitems); - for (int itemnum = 0; itemnum < olditems; itemnum++) - newitems[itemnum] = item[itemnum]; - global_free(item); - item = newitems; - } - index = numitems++; - - // copy the previous last item to the next one - if (index != 0) + // allocate a new item and populate it + ui_menu_item pitem; + pitem.text = (text != nullptr) ? pool_strdup(text) : nullptr; + pitem.subtext = (subtext != nullptr) ? pool_strdup(subtext) : nullptr; + pitem.flags = flags; + pitem.ref = ref; + + // append to array + int index = item.size(); + if (!item.empty()) { - index--; - item[index + 1] = item[index]; + item.insert(item.end() - 1, pitem); + --index; } - - // allocate a new item and populate it - pitem = &item[index]; - pitem->text = (text != nullptr) ? pool_strdup(text) : nullptr; - pitem->subtext = (subtext != nullptr) ? pool_strdup(subtext) : nullptr; - pitem->flags = flags; - pitem->ref = ref; + else + item.push_back(pitem); // update the selection if we need to if (resetpos == index || (resetref != nullptr && resetref == ref)) selected = index; - if (resetpos == numitems - 1) - selected = numitems - 1; + if (resetpos == item.size() - 1) + selected = item.size() - 1; } @@ -288,27 +330,40 @@ const ui_menu_event *ui_menu::process(UINT32 flags) menu_event.iptkey = IPT_INVALID; // first make sure our selection is valid - validate_selection(1); +// if (!(flags & UI_MENU_PROCESS_NOINPUT)) + validate_selection(1); // draw the menu - if (numitems > 1 && (item[0].flags & MENU_FLAG_MULTILINE) != 0) + if (item.size() > 1 && (item[0].flags & MENU_FLAG_MULTILINE) != 0) draw_text_box(); + else if ((item[0].flags & MENU_FLAG_MEWUI ) != 0 || (item[0].flags & MENU_FLAG_MEWUI_SWLIST ) != 0) + draw_select_game(flags & UI_MENU_PROCESS_NOINPUT); + else if ((item[0].flags & MENU_FLAG_MEWUI_PALETTE ) != 0) + draw_palette_menu(); else - draw(flags & UI_MENU_PROCESS_CUSTOM_ONLY); + draw(flags & UI_MENU_PROCESS_CUSTOM_ONLY, flags & UI_MENU_PROCESS_NOIMAGE, flags & UI_MENU_PROCESS_NOINPUT); // process input - if (!(flags & UI_MENU_PROCESS_NOKEYS)) + if (!(flags & UI_MENU_PROCESS_NOKEYS) && !(flags & UI_MENU_PROCESS_NOINPUT)) { // read events - handle_events(); + if ((item[0].flags & MENU_FLAG_MEWUI ) != 0 || (item[0].flags & MENU_FLAG_MEWUI_SWLIST ) != 0) + handle_main_events(flags); + else + handle_events(flags); // handle the keys if we don't already have an menu_event if (menu_event.iptkey == IPT_INVALID) - handle_keys(flags); + { + if ((item[0].flags & MENU_FLAG_MEWUI ) != 0 || (item[0].flags & MENU_FLAG_MEWUI_SWLIST ) != 0) + handle_main_keys(flags); + else + handle_keys(flags); + } } // update the selected item in the menu_event - if (menu_event.iptkey != IPT_INVALID && selected >= 0 && selected < numitems) + if (menu_event.iptkey != IPT_INVALID && selected >= 0 && selected < item.size()) { menu_event.itemref = item[selected].ref; return &menu_event; @@ -367,7 +422,7 @@ const char *ui_menu::pool_strdup(const char *string) void *ui_menu::get_selection() { - return (selected >= 0 && selected < numitems) ? item[selected].ref : nullptr; + return (selected >= 0 && selected < item.size()) ? item[selected].ref : nullptr; } @@ -378,10 +433,8 @@ void *ui_menu::get_selection() void ui_menu::set_selection(void *selected_itemref) { - int itemnum; - selected = -1; - for (itemnum = 0; itemnum < numitems; itemnum++) + for (int itemnum = 0; itemnum < item.size(); itemnum++) if (item[itemnum].ref == selected_itemref) { selected = itemnum; @@ -392,38 +445,33 @@ void ui_menu::set_selection(void *selected_itemref) /*************************************************************************** - INTERNAL MENU PROCESSING + INTERNAL MENU PROCESSING ***************************************************************************/ //------------------------------------------------- // draw - draw a menu //------------------------------------------------- -void ui_menu::draw(bool customonly) +void ui_menu::draw(bool customonly, bool noimage, bool noinput) { float line_height = machine().ui().get_line_height(); float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); float ud_arrow_width = line_height * machine().render().ui_aspect(); float gutter_width = lr_arrow_width * 1.3f; - float x1, y1, x2, y2; - float effective_width, effective_left; - float visible_width, visible_main_menu_height; - float visible_extra_menu_height; - float visible_top, visible_left; int selected_subitem_too_big = FALSE; - int visible_lines; - int top_line; int itemnum, linenum; bool mouse_hit, mouse_button; - render_target *mouse_target; - INT32 mouse_target_x, mouse_target_y; float mouse_x = -1, mouse_y = -1; + bool history_flag = ((item[0].flags & MENU_FLAG_MEWUI_HISTORY) != 0); + + if (machine().options().use_background_image() && &machine().system() == &GAME_NAME(___empty) && bgrnd_bitmap->valid() && !noimage) + container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); // compute the width and height of the full menu - visible_width = 0; - visible_main_menu_height = 0; - for (itemnum = 0; itemnum < numitems; itemnum++) + float visible_width = 0; + float visible_main_menu_height = 0; + for (itemnum = 0; itemnum < item.size(); itemnum++) { const ui_menu_item &pitem = item[itemnum]; float total_width; @@ -444,7 +492,7 @@ void ui_menu::draw(bool customonly) } // account for extra space at the top and bottom - visible_extra_menu_height = customtop + custombottom; + float visible_extra_menu_height = customtop + custombottom; // add a little bit of slop for rounding visible_width += 0.01f; @@ -458,48 +506,59 @@ void ui_menu::draw(bool customonly) if (visible_main_menu_height + visible_extra_menu_height + 2.0f * UI_BOX_TB_BORDER > 1.0f) visible_main_menu_height = 1.0f - 2.0f * UI_BOX_TB_BORDER - visible_extra_menu_height; - visible_lines = floor(visible_main_menu_height / line_height); + int visible_lines = floor(visible_main_menu_height / line_height); visible_main_menu_height = (float)visible_lines * line_height; // compute top/left of inner menu area by centering - visible_left = (1.0f - visible_width) * 0.5f; - visible_top = (1.0f - (visible_main_menu_height + visible_extra_menu_height)) * 0.5f; + float visible_left = (1.0f - visible_width) * 0.5f; + float visible_top = (1.0f - (visible_main_menu_height + visible_extra_menu_height)) * 0.5f; // if the menu is at the bottom of the extra, adjust visible_top += customtop; // first add us a box - x1 = visible_left - UI_BOX_LR_BORDER; - y1 = visible_top - UI_BOX_TB_BORDER; - x2 = visible_left + visible_width + UI_BOX_LR_BORDER; - y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER; + float x1 = visible_left - UI_BOX_LR_BORDER; + float y1 = visible_top - UI_BOX_TB_BORDER; + float x2 = visible_left + visible_width + UI_BOX_LR_BORDER; + float y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER; if (!customonly) machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); // determine the first visible line based on the current selection - top_line = selected - visible_lines / 2; + int top_line = selected - visible_lines / 2; if (top_line < 0) top_line = 0; - if (top_line + visible_lines >= numitems) - top_line = numitems - visible_lines; + + if (top_line + visible_lines >= item.size()) + { + if (history_flag) + selected = item.size() - 1; + top_line = item.size() - visible_lines; + } + + if (history_flag && selected != item.size() - 1) + selected = top_line + visible_lines / 2; // determine effective positions taking into account the hilighting arrows - effective_width = visible_width - 2.0f * gutter_width; - effective_left = visible_left + gutter_width; + float effective_width = visible_width - 2.0f * gutter_width; + float effective_left = visible_left + gutter_width; // locate mouse mouse_hit = false; mouse_button = false; - if (!customonly) + if (!customonly && !noinput) { - mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button); + INT32 mouse_target_x, mouse_target_y; + render_target *mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button); if (mouse_target != nullptr) if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y)) mouse_hit = true; } // loop over visible lines - hover = numitems + 1; + hover = item.size() + 1; + float line_x0 = x1 + 0.5f * UI_LINE_WIDTH; + float line_x1 = x2 - 0.5f * UI_LINE_WIDTH; if (!customonly) for (linenum = 0; linenum < visible_lines; linenum++) { @@ -511,17 +570,16 @@ void ui_menu::draw(bool customonly) rgb_t bgcolor = UI_TEXT_BG_COLOR; rgb_t fgcolor2 = UI_SUBITEM_COLOR; rgb_t fgcolor3 = UI_CLONE_COLOR; - float line_x0 = x1 + 0.5f * UI_LINE_WIDTH; float line_y0 = line_y; - float line_x1 = x2 - 0.5f * UI_LINE_WIDTH; float line_y1 = line_y + line_height; // set the hover if this is our item - if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && pitem.is_selectable()) + if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && pitem.is_selectable() + && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) hover = itemnum; // if we're selected, draw with a different background - if (itemnum == selected) + if (itemnum == selected && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) { fgcolor = UI_SELECTED_COLOR; bgcolor = UI_SELECTED_BG_COLOR; @@ -530,7 +588,8 @@ void ui_menu::draw(bool customonly) } // else if the mouse is over this item, draw with a different background - else if (itemnum == hover) + else if (itemnum == hover && (((pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) || (linenum == 0 && top_line != 0) + || (linenum == visible_lines - 1 && itemnum != item.size() - 1))) { fgcolor = UI_MOUSEOVER_COLOR; bgcolor = UI_MOUSEOVER_BG_COLOR; @@ -545,8 +604,7 @@ void ui_menu::draw(bool customonly) // if we're on the top line, display the up arrow if (linenum == 0 && top_line != 0) { - draw_arrow( - container, + draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height, 0.5f * (x1 + x2) + 0.5f * ud_arrow_width, @@ -554,14 +612,13 @@ void ui_menu::draw(bool customonly) fgcolor, ROT0); if (hover == itemnum) - hover = -2; + hover = HOVER_ARROW_UP; } // if we're on the bottom line, display the down arrow - else if (linenum == visible_lines - 1 && itemnum != numitems - 1) + else if (linenum == visible_lines - 1 && itemnum != item.size() - 1) { - draw_arrow( - container, + draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height, 0.5f * (x1 + x2) + 0.5f * ud_arrow_width, @@ -569,17 +626,22 @@ void ui_menu::draw(bool customonly) fgcolor, ROT0 ^ ORIENTATION_FLIP_Y); if (hover == itemnum) - hover = -1; + hover = HOVER_ARROW_DOWN; } // if we're just a divider, draw a line else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + // draw the subitem left-justified + else if (pitem.subtext == nullptr && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) != 0) + machine().ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, + JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + // if we don't have a subitem, just draw the string centered else if (pitem.subtext == nullptr) machine().ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, - JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); // otherwise, draw the item on the left and the subitem text on the right else @@ -603,6 +665,16 @@ void ui_menu::draw(bool customonly) selected_subitem_too_big = TRUE; } + // customize subitem text color + if (!core_stricmp(subitem_text, "On")) + fgcolor2 = rgb_t(0xff,0x00,0xff,0x00); + + if (!core_stricmp(subitem_text, "Off")) + fgcolor2 = rgb_t(0xff,0xff,0x00,0x00); + + if (!core_stricmp(subitem_text, "Auto")) + fgcolor2 = rgb_t(0xff,0xff,0xff,0x00); + // draw the subitem right-justified machine().ui().draw_text_full(container, subitem_text, effective_left + item_width, line_y, effective_width - item_width, JUSTIFY_RIGHT, WRAP_TRUNCATE, DRAW_NORMAL, subitem_invert ? fgcolor3 : fgcolor2, bgcolor, &subitem_width, nullptr); @@ -610,8 +682,7 @@ void ui_menu::draw(bool customonly) // apply arrows if (itemnum == selected && (pitem.flags & MENU_FLAG_LEFT_ARROW)) { - draw_arrow( - container, + draw_arrow(container, effective_left + effective_width - subitem_width - gutter_width, line_y + 0.1f * line_height, effective_left + effective_width - subitem_width - gutter_width + lr_arrow_width, @@ -621,8 +692,7 @@ void ui_menu::draw(bool customonly) } if (itemnum == selected && (pitem.flags & MENU_FLAG_RIGHT_ARROW)) { - draw_arrow( - container, + draw_arrow(container, effective_left + effective_width + gutter_width - lr_arrow_width, line_y + 0.1f * line_height, effective_left + effective_width + gutter_width, @@ -645,7 +715,7 @@ void ui_menu::draw(bool customonly) // compute the multi-line target width/height machine().ui().draw_text_full(container, pitem.subtext, 0, 0, visible_width * 0.75f, - JUSTIFY_RIGHT, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height); + JUSTIFY_RIGHT, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height); // determine the target location target_x = visible_left + visible_width - target_width - UI_BOX_LR_BORDER; @@ -657,16 +727,19 @@ void ui_menu::draw(bool customonly) machine().ui().draw_outlined_box(container, target_x - UI_BOX_LR_BORDER, target_y - UI_BOX_TB_BORDER, target_x + target_width + UI_BOX_LR_BORDER, - target_y + target_height + UI_BOX_TB_BORDER, subitem_invert ? UI_SELECTED_BG_COLOR : UI_BACKGROUND_COLOR); + target_y + target_height + UI_BOX_TB_BORDER, + subitem_invert ? UI_SELECTED_BG_COLOR : UI_BACKGROUND_COLOR); machine().ui().draw_text_full(container, pitem.subtext, target_x, target_y, target_width, JUSTIFY_RIGHT, WRAP_WORD, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, nullptr, nullptr); } // if there is something special to add, do it by calling the virtual method - custom_render((selected >= 0 && selected < numitems) ? item[selected].ref : nullptr, customtop, custombottom, x1, y1, x2, y2); + custom_render((selected >= 0 && selected < item.size()) ? item[selected].ref : nullptr, customtop, custombottom, x1, y1, x2, y2); // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow - visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != numitems); + visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != item.size()); +// if (history_flag && (top_line + visible_lines >= item.size())) +// selected = item.size() - 1; } void ui_menu::custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) @@ -691,7 +764,7 @@ void ui_menu::draw_text_box() // compute the multi-line target width/height machine().ui().draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER - 2.0f * gutter_width, - JUSTIFY_LEFT, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height); + JUSTIFY_LEFT, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height); target_height += 2.0f * line_height; if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER) target_height = floorf((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height; @@ -716,25 +789,25 @@ void ui_menu::draw_text_box() // add a box around that machine().ui().draw_outlined_box(container, target_x - UI_BOX_LR_BORDER - gutter_width, - target_y - UI_BOX_TB_BORDER, - target_x + target_width + gutter_width + UI_BOX_LR_BORDER, - target_y + target_height + UI_BOX_TB_BORDER, (item[0].flags & MENU_FLAG_REDTEXT) ? UI_RED_COLOR : UI_BACKGROUND_COLOR); + target_y - UI_BOX_TB_BORDER, + target_x + target_width + gutter_width + UI_BOX_LR_BORDER, + target_y + target_height + UI_BOX_TB_BORDER, + (item[0].flags & MENU_FLAG_REDTEXT) ? UI_RED_COLOR : UI_BACKGROUND_COLOR); machine().ui().draw_text_full(container, text, target_x, target_y, target_width, JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // draw the "return to prior menu" text with a hilight behind it - highlight( - container, - target_x + 0.5f * UI_LINE_WIDTH, - target_y + target_height - line_height, - target_x + target_width - 0.5f * UI_LINE_WIDTH, - target_y + target_height, - UI_SELECTED_BG_COLOR); + highlight(container, + target_x + 0.5f * UI_LINE_WIDTH, + target_y + target_height - line_height, + target_x + target_width - 0.5f * UI_LINE_WIDTH, + target_y + target_height, + UI_SELECTED_BG_COLOR); machine().ui().draw_text_full(container, backtext, target_x, target_y + target_height - line_height, target_width, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, nullptr, nullptr); // artificially set the hover to the last item so a double-click exits - hover = numitems - 1; + hover = item.size() - 1; } @@ -743,10 +816,11 @@ void ui_menu::draw_text_box() // input events for a menu //------------------------------------------------- -void ui_menu::handle_events() +void ui_menu::handle_events(UINT32 flags) { int stop = FALSE; ui_event local_menu_event; + bool historyflag = ((item[0].flags & MENU_FLAG_MEWUI_HISTORY) != 0); // loop while we have interesting events while (!stop && machine().ui_input().pop_event(&local_menu_event)) @@ -755,35 +829,61 @@ void ui_menu::handle_events() { // if we are hovering over a valid item, select it with a single click case UI_EVENT_MOUSE_DOWN: - if (hover >= 0 && hover < numitems) - selected = hover; - else if (hover == -2) - { - selected -= visitems - 1; - validate_selection(1); - } - else if (hover == -1) + if ((flags & UI_MENU_PROCESS_ONLYCHAR) == 0) { - selected += visitems - 1; - validate_selection(1); + if (hover >= 0 && hover < item.size()) + selected = hover; + else if (hover == HOVER_ARROW_UP) + { + selected -= visitems - 1; + validate_selection(1); + } + else if (hover == HOVER_ARROW_DOWN) + { + selected += visitems - 1; + validate_selection(1); + } } break; // if we are hovering over a valid item, fake a UI_SELECT with a double-click case UI_EVENT_MOUSE_DOUBLE_CLICK: - if (hover >= 0 && hover < numitems) + if ((flags & UI_MENU_PROCESS_ONLYCHAR) == 0) { - selected = hover; - if (local_menu_event.event_type == UI_EVENT_MOUSE_DOUBLE_CLICK) + if (hover >= 0 && hover < item.size()) { - menu_event.iptkey = IPT_UI_SELECT; - if (selected == numitems - 1) + selected = hover; + if (local_menu_event.event_type == UI_EVENT_MOUSE_DOUBLE_CLICK) { - menu_event.iptkey = IPT_UI_CANCEL; - ui_menu::stack_pop(machine()); + menu_event.iptkey = IPT_UI_SELECT; + if (selected == item.size() - 1) + { + menu_event.iptkey = IPT_UI_CANCEL; + ui_menu::stack_pop(machine()); + } } + stop = TRUE; + } + } + break; + + // caught scroll event + case UI_EVENT_MOUSE_WHEEL: + if ((flags & UI_MENU_PROCESS_ONLYCHAR) == 0) + { + if (local_menu_event.zdelta > 0) + { + if (historyflag && selected == item.size() - 1) + selected -= visitems + 1; + else + selected -= local_menu_event.num_lines; + validate_selection(-1); + } + else + { + selected += local_menu_event.num_lines; + validate_selection(1); } - stop = TRUE; } break; @@ -815,13 +915,15 @@ void ui_menu::handle_keys(UINT32 flags) int code; // bail if no items - if (numitems == 0) + if (item.empty()) return; + bool historyflag = ((item[0].flags & MENU_FLAG_MEWUI_HISTORY) != 0); + // if we hit select, return TRUE or pop the stack, depending on the item if (exclusive_input_pressed(IPT_UI_SELECT, 0)) { - if (selected == numitems - 1) + if (selected == item.size() - 1) { menu_event.iptkey = IPT_UI_CANCEL; ui_menu::stack_pop(machine()); @@ -829,10 +931,15 @@ void ui_menu::handle_keys(UINT32 flags) return; } + // bail out + if ((flags & UI_MENU_PROCESS_ONLYCHAR) != 0) + return; + // hitting cancel also pops the stack if (exclusive_input_pressed(IPT_UI_CANCEL, 0)) { - ui_menu::stack_pop(machine()); + if (!menu_has_search_active()) + ui_menu::stack_pop(machine()); return; } @@ -852,14 +959,32 @@ void ui_menu::handle_keys(UINT32 flags) // up backs up by one item if (exclusive_input_pressed(IPT_UI_UP, 6)) { - selected = (selected + numitems - 1) % numitems; + if (historyflag && selected <= (visitems / 2)) + return; + else if (historyflag && visitems == item.size()) + { + selected = item.size() - 1; + return; + } + else if (historyflag && selected == item.size() - 1) + selected = (item.size() - 1) - (visitems / 2); + + selected = (selected + item.size() - 1) % item.size(); validate_selection(-1); } // down advances by one item if (exclusive_input_pressed(IPT_UI_DOWN, 6)) { - selected = (selected + 1) % numitems; + if (historyflag && (selected < visitems / 2)) + selected = visitems / 2; + else if (historyflag && (selected + (visitems / 2) >= item.size())) + { + selected = item.size() - 1; + return; + } + + selected = (selected + 1) % item.size(); validate_selection(1); } @@ -887,7 +1012,7 @@ void ui_menu::handle_keys(UINT32 flags) // end goes to the last if (exclusive_input_pressed(IPT_UI_END, 0)) { - selected = numitems - 1; + selected = item.size() - 1; validate_selection(-1); } @@ -927,12 +1052,12 @@ void ui_menu::validate_selection(int scandir) // clamp to be in range if (selected < 0) selected = 0; - else if (selected >= numitems) - selected = numitems - 1; + else if (selected >= item.size()) + selected = item.size() - 1; // skip past unselectable items while (!item[selected].is_selectable()) - selected = (selected + numitems + scandir) % numitems; + selected = (selected + item.size() + scandir) % item.size(); } @@ -955,7 +1080,7 @@ void ui_menu::clear_free_list(running_machine &machine) /*************************************************************************** - MENU STACK MANAGEMENT + MENU STACK MANAGEMENT ***************************************************************************/ //------------------------------------------------- @@ -1018,14 +1143,14 @@ bool ui_menu::stack_has_special_main_menu() void ui_menu::do_handle() { - if(!populated()) + if(item.size() < 2) populate(); handle(); } /*************************************************************************** - UI SYSTEM INTERACTION + UI SYSTEM INTERACTION ***************************************************************************/ //------------------------------------------------- @@ -1054,7 +1179,7 @@ UINT32 ui_menu::ui_handler(running_machine &machine, render_container *container } /*************************************************************************** - MENU HELPERS + MENU HELPERS ***************************************************************************/ //------------------------------------------------- @@ -1118,8 +1243,7 @@ void ui_menu::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const void ui_menu::highlight(render_container *container, float x0, float y0, float x1, float y1, rgb_t bgcolor) { - container->add_quad(x0, y0, x1, y1, bgcolor, hilight_texture, - PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + container->add_quad(x0, y0, x1, y1, bgcolor, hilight_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); } @@ -1129,12 +1253,1436 @@ void ui_menu::highlight(render_container *container, float x0, float y0, float x void ui_menu::draw_arrow(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, UINT32 orientation) { - container->add_quad( - x0, - y0, - x1, - y1, - fgcolor, - arrow_texture, - PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(orientation)); + container->add_quad(x0, y0, x1, y1, fgcolor, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(orientation)); +} + +//------------------------------------------------- +// init - initialize the mewui menu system +//------------------------------------------------- + +void ui_menu::init_mewui(running_machine &machine) +{ + render_manager &mrender = machine.render(); + // create a texture for hilighting items in main menu + hilight_main_bitmap = std::make_unique(1, 26); + int r1 = 0, g1 = 169, b1 = 255; //Any start color + int r2 = 0, g2 = 39, b2 = 130; //Any stop color + for (int y = 0; y < 26; y++) + { + int r = r1 + (y * (r2 - r1) / 26); + int g = g1 + (y * (g2 - g1) / 26); + int b = b1 + (y * (b2 - b1) / 26); + hilight_main_bitmap->pix32(y, 0) = rgb_t(0xff, r, g, b); + } + + hilight_main_texture = mrender.texture_alloc(); + hilight_main_texture->set_bitmap(*hilight_main_bitmap, hilight_main_bitmap->cliprect(), TEXFORMAT_ARGB32); + + // create a texture for snapshot + snapx_bitmap = std::make_unique(0, 0); + snapx_texture = mrender.texture_alloc(render_texture::hq_scale); + + // allocates and sets the default "no available" image + no_avail_bitmap = std::make_unique(256, 256); + UINT32 *dst = &no_avail_bitmap->pix32(0); + memcpy(dst, no_avail_bmp, 256 * 256 * sizeof(UINT32)); + + // allocates and sets the favorites star image + star_bitmap = std::make_unique(32, 32); + dst = &star_bitmap->pix32(0); + memcpy(dst, favorite_star_bmp, 32 * 32 * sizeof(UINT32)); + star_texture = mrender.texture_alloc(); + star_texture->set_bitmap(*star_bitmap, star_bitmap->cliprect(), TEXFORMAT_ARGB32); + + // allocates icons bitmap and texture + for (int i = 0; i < MAX_ICONS_RENDER; i++) + { + icons_bitmap[i] = auto_alloc(machine, bitmap_argb32); + icons_texture[i] = mrender.texture_alloc(); + } + + // create a texture for main menu background + bgrnd_bitmap = std::make_unique(0, 0); + bgrnd_texture = mrender.texture_alloc(render_texture::hq_scale); + + emu_options &mopt = machine.options(); + if (mopt.use_background_image() && &machine.system() == &GAME_NAME(___empty)) + { + emu_file backgroundfile(".", OPEN_FLAG_READ); + render_load_jpeg(*bgrnd_bitmap, backgroundfile, nullptr, "background.jpg"); + + if (!bgrnd_bitmap->valid()) + render_load_png(*bgrnd_bitmap, backgroundfile, nullptr, "background.png"); + + if (bgrnd_bitmap->valid()) + bgrnd_texture->set_bitmap(*bgrnd_bitmap, bgrnd_bitmap->cliprect(), TEXFORMAT_ARGB32); + else + bgrnd_bitmap->reset(); + } + else + bgrnd_bitmap->reset(); + + // create a texture for toolbar + for (int x = 0; x < MEWUI_TOOLBAR_BUTTONS; ++x) + { + toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); + toolbar_texture[x] = mrender.texture_alloc(); + UINT32 *dst = &toolbar_bitmap[x]->pix32(0); + memcpy(dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32)); + if (toolbar_bitmap[x]->valid()) + toolbar_texture[x]->set_bitmap(*toolbar_bitmap[x], toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32); + else + toolbar_bitmap[x]->reset(); + } + + // create a texture for toolbar + for (int x = 0; x < MEWUI_TOOLBAR_BUTTONS; ++x) + { + sw_toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); + sw_toolbar_texture[x] = mrender.texture_alloc(); + if (x == 0 || x == 2) + { + UINT32 *dst; + dst = &sw_toolbar_bitmap[x]->pix32(0); + memcpy(dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32)); + sw_toolbar_texture[x]->set_bitmap(*sw_toolbar_bitmap[x], sw_toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32); + } + else + sw_toolbar_bitmap[x]->reset(); + } +} + + +//------------------------------------------------- +// draw main menu +//------------------------------------------------- + +void ui_menu::draw_select_game(bool noinput) +{ + float line_height = machine().ui().get_line_height(); + float ud_arrow_width = line_height * machine().render().ui_aspect(); + float gutter_width = 0.4f * line_height * machine().render().ui_aspect() * 1.3f; + mouse_x = -1, mouse_y = -1; + float right_panel_size = (mewui_globals::panels_status == HIDE_BOTH || mewui_globals::panels_status == HIDE_RIGHT_PANEL) ? 2.0f * UI_BOX_LR_BORDER : 0.3f; + float visible_width = 1.0f - 4.0f * UI_BOX_LR_BORDER; + float primary_left = (1.0f - visible_width) * 0.5f; + float primary_width = visible_width; + bool is_swlist = ((item[0].flags & MENU_FLAG_MEWUI_SWLIST) != 0); + bool is_favorites = ((item[0].flags & MENU_FLAG_MEWUI_FAVORITE) != 0); + ui_manager &mui = machine().ui(); + + // draw background image if available + if (machine().options().use_background_image() && bgrnd_bitmap->valid()) + container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + + hover = item.size() + 1; + visible_items = (is_swlist) ? item.size() - 2 : item.size() - 4; + float extra_height = (is_swlist) ? 2.0f * line_height : 4.0f * line_height; + float visible_extra_menu_height = customtop + custombottom + extra_height; + + // locate mouse + mouse_hit = FALSE; + mouse_button = FALSE; + if (!noinput) + { + mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button); + if (mouse_target != nullptr) + if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y)) + mouse_hit = TRUE; + } + + // account for extra space at the top and bottom + float visible_main_menu_height = 1.0f - 2.0f * UI_BOX_TB_BORDER - visible_extra_menu_height; + visible_lines = floor(visible_main_menu_height / line_height); + visible_main_menu_height = (float)(visible_lines * line_height); + + if (!is_swlist) + mewui_globals::visible_main_lines = visible_lines; + else + mewui_globals::visible_sw_lines = visible_lines; + + // compute top/left of inner menu area by centering + float visible_left = primary_left; + float visible_top = (1.0f - (visible_main_menu_height + visible_extra_menu_height)) * 0.5f; + + // if the menu is at the bottom of the extra, adjust + visible_top += customtop; + + // compute left box size + float x1 = visible_left - UI_BOX_LR_BORDER; + float y1 = visible_top - UI_BOX_TB_BORDER; + float x2 = x1 + 2.0f * UI_BOX_LR_BORDER; + float y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER + extra_height; + + // add left box + visible_left = draw_left_panel(x1, y1, x2, y2); + visible_width -= right_panel_size + visible_left - 2.0f * UI_BOX_LR_BORDER; + + // compute and add main box + x1 = visible_left - UI_BOX_LR_BORDER; + x2 = visible_left + visible_width + UI_BOX_LR_BORDER; + float line = visible_top + (float)(visible_lines * line_height); + + //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + + if (visible_items < visible_lines) + visible_lines = visible_items; + if (top_line < 0 || selected == 0) + top_line = 0; + if (selected < visible_items && top_line + visible_lines >= visible_items) + top_line = visible_items - visible_lines; + + // determine effective positions taking into account the hilighting arrows + float effective_width = visible_width - 2.0f * gutter_width; + float effective_left = visible_left + gutter_width; + + int n_loop = (visible_items >= visible_lines) ? visible_lines : visible_items; + + for (int linenum = 0; linenum < n_loop; linenum++) + { + float line_y = visible_top + (float)linenum * line_height; + int itemnum = top_line + linenum; + const ui_menu_item &pitem = item[itemnum]; + const char *itemtext = pitem.text; + rgb_t fgcolor = UI_TEXT_COLOR; + rgb_t bgcolor = UI_TEXT_BG_COLOR; + rgb_t fgcolor3 = UI_CLONE_COLOR; + float line_x0 = x1 + 0.5f * UI_LINE_WIDTH; + float line_y0 = line_y; + float line_x1 = x2 - 0.5f * UI_LINE_WIDTH; + float line_y1 = line_y + line_height; + + // set the hover if this is our item + if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && pitem.is_selectable()) + hover = itemnum; + + // if we're selected, draw with a different background + if (itemnum == selected) + { + fgcolor = rgb_t(0xff, 0xff, 0xff, 0x00); + bgcolor = rgb_t(0xff, 0xff, 0xff, 0xff); + fgcolor3 = rgb_t(0xff, 0xcc, 0xcc, 0x00); + } + // else if the mouse is over this item, draw with a different background + else if (itemnum == hover) + { + fgcolor = fgcolor3 = UI_MOUSEOVER_COLOR; + bgcolor = UI_MOUSEOVER_BG_COLOR; + } + + // if we have some background hilighting to do, add a quad behind everything else + if (bgcolor != UI_TEXT_BG_COLOR) + mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, + bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, + PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + + // if we're on the top line, display the up arrow + if (linenum == 0 && top_line != 0) + { + draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height, + 0.5f * (x1 + x2) + 0.5f * ud_arrow_width, line_y + 0.75f * line_height, fgcolor, ROT0); + + if (hover == itemnum) + hover = HOVER_ARROW_UP; + } + // if we're on the bottom line, display the down arrow + else if (linenum == visible_lines - 1 && itemnum != visible_items - 1) + { + draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height, + 0.5f * (x1 + x2) + 0.5f * ud_arrow_width, line_y + 0.75f * line_height, fgcolor, ROT0 ^ ORIENTATION_FLIP_Y); + + if (hover == itemnum) + hover = HOVER_ARROW_DOWN; + } + // if we're just a divider, draw a line + else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) + container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, + UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + // draw the item centered + else if (pitem.subtext == nullptr) + { + int item_invert = pitem.flags & MENU_FLAG_INVERT; + float space = 0.0f; + + if (!is_swlist) + { + if (is_favorites) + { + ui_software_info *soft = (ui_software_info *)item[itemnum].ref; + if (soft->startempty == 1) + draw_icon(linenum, (void *)soft->driver, effective_left, line_y); + } + else + draw_icon(linenum, item[itemnum].ref, effective_left, line_y); + + space = mui.get_line_height() * container->manager().ui_aspect() * 1.5f; + } + mui.draw_text_full(container, itemtext, effective_left + space, line_y, effective_width - space, + JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, + bgcolor, nullptr, nullptr); + } + else + { + int item_invert = pitem.flags & MENU_FLAG_INVERT; + const char *subitem_text = pitem.subtext; + float item_width, subitem_width; + + // compute right space for subitem + mui.draw_text_full(container, subitem_text, effective_left, line_y, machine().ui().get_string_width(pitem.subtext), + JUSTIFY_RIGHT, WRAP_NEVER, DRAW_NONE, item_invert ? fgcolor3 : fgcolor, bgcolor, &subitem_width, nullptr); + subitem_width += gutter_width; + + // draw the item left-justified + mui.draw_text_full(container, itemtext, effective_left, line_y, effective_width - subitem_width, + JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, &item_width, nullptr); + + // draw the subitem right-justified + mui.draw_text_full(container, subitem_text, effective_left + item_width, line_y, effective_width - item_width, + JUSTIFY_RIGHT, WRAP_NEVER, DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr); + } + } + + for (size_t count = visible_items; count < item.size(); count++) + { + const ui_menu_item &pitem = item[count]; + const char *itemtext = pitem.text; + float line_x0 = x1 + 0.5f * UI_LINE_WIDTH; + float line_y0 = line; + float line_x1 = x2 - 0.5f * UI_LINE_WIDTH; + float line_y1 = line + line_height; + rgb_t fgcolor = UI_TEXT_COLOR; + rgb_t bgcolor = UI_TEXT_BG_COLOR; + + if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && pitem.is_selectable()) + hover = count; + + // if we're selected, draw with a different background + if (count == selected) + { + fgcolor = rgb_t(0xff, 0xff, 0xff, 0x00); + bgcolor = rgb_t(0xff, 0xff, 0xff, 0xff); + } + // else if the mouse is over this item, draw with a different background + else if (count == hover) + { + fgcolor = UI_MOUSEOVER_COLOR; + bgcolor = UI_MOUSEOVER_BG_COLOR; + } + + // if we have some background hilighting to do, add a quad behind everything else + if (bgcolor != UI_TEXT_BG_COLOR) + mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(255, 43, 43, 43), + hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + + if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) + container->add_line(visible_left, line + 0.5f * line_height, visible_left + visible_width, line + 0.5f * line_height, + UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + else + mui.draw_text_full(container, itemtext, effective_left, line, effective_width, + JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + line += line_height; + } + + x1 = x2; + x2 += right_panel_size; + + draw_right_panel((selected >= 0 && selected < item.size()) ? item[selected].ref : nullptr, x1, y1, x2, y2); + + x1 = primary_left - UI_BOX_LR_BORDER; + x2 = primary_left + primary_width + UI_BOX_LR_BORDER; + + // if there is something special to add, do it by calling the virtual method + custom_render((selected >= 0 && selected < item.size()) ? item[selected].ref : nullptr, customtop, custombottom, x1, y1, x2, y2); + + // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow + visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != visible_items); + + // reset redraw icon stage + if (!is_swlist) + mewui_globals::redraw_icon = false; +} + +//------------------------------------------------- +// get title and search path for right panel +//------------------------------------------------- + +void ui_menu::get_title_search(std::string &snaptext, std::string &searchstr) +{ + // get arts title text + snaptext.assign(arts_info[mewui_globals::curimage_view].title); + + // get search path + path_iterator path(machine().options().value(arts_info[mewui_globals::curimage_view].path)); + std::string curpath; + searchstr.assign(machine().options().value(arts_info[mewui_globals::curimage_view].path)); + + // iterate over path and add path for zipped formats + while (path.next(curpath)) + { + path_iterator path_iter(arts_info[mewui_globals::curimage_view].addpath); + std::string c_path; + while (path_iter.next(c_path)) + searchstr.append(";").append(curpath).append(PATH_SEPARATOR).append(c_path); + } } + +//------------------------------------------------- +// handle keys for main menu +//------------------------------------------------- + +void ui_menu::handle_main_keys(UINT32 flags) +{ + bool ignorepause = ui_menu::stack_has_special_main_menu(); + + // bail if no items + if (item.size() == 0) + return; + + // if we hit select, return TRUE or pop the stack, depending on the item + if (exclusive_input_pressed(IPT_UI_SELECT, 0)) + { + if (selected == item.size() - 1) + { + menu_event.iptkey = IPT_UI_CANCEL; + ui_menu::stack_pop(machine()); + } + return; + } + + // hitting cancel also pops the stack + if (exclusive_input_pressed(IPT_UI_CANCEL, 0)) + { + if (!menu_has_search_active()) + ui_menu::stack_pop(machine()); + // else if (!ui_error) + // ui_menu::stack_pop(machine()); TODO + return; + } + + // validate the current selection + validate_selection(1); + + // swallow left/right keys if they are not appropriate + bool ignoreleft = ((item[selected].flags & MENU_FLAG_LEFT_ARROW) == 0 || mewui_globals::panels_status == HIDE_BOTH || mewui_globals::panels_status == HIDE_RIGHT_PANEL); + bool ignoreright = ((item[selected].flags & MENU_FLAG_RIGHT_ARROW) == 0 || mewui_globals::panels_status == HIDE_BOTH || mewui_globals::panels_status == HIDE_RIGHT_PANEL); + bool ignoreup = (mewui_globals::panels_status == HIDE_BOTH || mewui_globals::panels_status == HIDE_LEFT_PANEL); + bool ignoredown = (mewui_globals::panels_status == HIDE_BOTH || mewui_globals::panels_status == HIDE_LEFT_PANEL); + + input_manager &minput = machine().input(); + // accept left/right keys as-is with repeat + if (!ignoreleft && exclusive_input_pressed(IPT_UI_LEFT, (flags & UI_MENU_PROCESS_LR_REPEAT) ? 6 : 0)) + { + // Swap the right panel + if (minput.code_pressed(KEYCODE_LCONTROL) || minput.code_pressed(JOYCODE_BUTTON1)) + menu_event.iptkey = IPT_UI_LEFT_PANEL; + return; + } + + if (!ignoreright && exclusive_input_pressed(IPT_UI_RIGHT, (flags & UI_MENU_PROCESS_LR_REPEAT) ? 6 : 0)) + { + // Swap the right panel +// if (minput.code_pressed(KEYCODE_LCONTROL) || minput.code_pressed(JOYCODE_BUTTON1)) +// menu_event.iptkey = IPT_UI_RIGHT_PANEL; + return; + } + + // up backs up by one item + if (exclusive_input_pressed(IPT_UI_UP, 6)) + { + // Filter + if (!ignoreup && (minput.code_pressed(KEYCODE_LALT) || minput.code_pressed(JOYCODE_BUTTON2))) + { + menu_event.iptkey = IPT_UI_UP_FILTER; + return; + } + + // Infos + if (!ignoreleft && (minput.code_pressed(KEYCODE_LCONTROL) || minput.code_pressed(JOYCODE_BUTTON1))) + { + menu_event.iptkey = IPT_UI_UP_PANEL; + topline_datsview--; + return; + } + + if (selected == visible_items + 1 || selected == 0 || ui_error) + return; + + selected--; + + if (selected == top_line && top_line != 0) + top_line--; + } + + // down advances by one item + if (exclusive_input_pressed(IPT_UI_DOWN, 6)) + { + // Filter + if (!ignoredown && (minput.code_pressed(KEYCODE_LALT) || minput.code_pressed(JOYCODE_BUTTON2))) + { + menu_event.iptkey = IPT_UI_DOWN_FILTER; + return; + } + + // Infos + if (!ignoreright && (minput.code_pressed(KEYCODE_LCONTROL) || minput.code_pressed(JOYCODE_BUTTON1))) + { + menu_event.iptkey = IPT_UI_DOWN_PANEL; + topline_datsview++; + return; + } + + if (selected == item.size() - 1 || selected == visible_items - 1 || ui_error) + return; + + selected++; + + if (selected == top_line + visitems + (top_line != 0)) + top_line++; + } + + // page up backs up by visitems + if (exclusive_input_pressed(IPT_UI_PAGE_UP, 6)) + { + // Infos + if (!ignoreleft && (minput.code_pressed(KEYCODE_LCONTROL) || minput.code_pressed(JOYCODE_BUTTON1))) + { + menu_event.iptkey = IPT_UI_DOWN_PANEL; + topline_datsview -= right_visible_lines - 1; + return; + } + + if (selected < visible_items && !ui_error) + { + selected -= visitems; + + if (selected < 0) + selected = 0; + + top_line -= visitems - (top_line + visible_lines == visible_items); + } + } + + // page down advances by visitems + if (exclusive_input_pressed(IPT_UI_PAGE_DOWN, 6)) + { + // Infos + if (!ignoreleft && (minput.code_pressed(KEYCODE_LCONTROL) || minput.code_pressed(JOYCODE_BUTTON1))) + { + menu_event.iptkey = IPT_UI_DOWN_PANEL; + topline_datsview += right_visible_lines - 1; + return; + } + + if (selected < visible_items && !ui_error) + { + selected += visible_lines - 2 + (selected == 0); + + if (selected >= visible_items) + selected = visible_items - 1; + + top_line += visible_lines - 2; + } + } + + // home goes to the start + if (exclusive_input_pressed(IPT_UI_HOME, 0)) + { + // Infos + if (!ignoreleft && (minput.code_pressed(KEYCODE_LCONTROL) || minput.code_pressed(JOYCODE_BUTTON1))) + { + menu_event.iptkey = IPT_UI_DOWN_PANEL; + topline_datsview = 0; + return; + } + + if (selected < visible_items && !ui_error) + { + selected = 0; + top_line = 0; + } + } + + // end goes to the last + if (exclusive_input_pressed(IPT_UI_END, 0)) + { + // Infos + if (!ignoreleft && (minput.code_pressed(KEYCODE_LCONTROL) || minput.code_pressed(JOYCODE_BUTTON1))) + { + menu_event.iptkey = IPT_UI_DOWN_PANEL; + topline_datsview = totallines; + return; + } + + if (selected < visible_items && !ui_error) + selected = top_line = visible_items - 1; + } + + // pause enables/disables pause + if (!ui_error && !ignorepause && exclusive_input_pressed(IPT_UI_PAUSE, 0)) + { + if (machine().paused()) + machine().resume(); + else + machine().pause(); + } + + // handle a toggle cheats request + if (!ui_error && machine().ui_input().pressed_repeat(IPT_UI_TOGGLE_CHEAT, 0)) + machine().cheat().set_enable(!machine().cheat().enabled()); + + // see if any other UI keys are pressed + if (menu_event.iptkey == IPT_INVALID) + for (int code = IPT_UI_FIRST + 1; code < IPT_UI_LAST; code++) + { + if (ui_error || code == IPT_UI_CONFIGURE || (code == IPT_UI_LEFT && ignoreleft) || (code == IPT_UI_RIGHT && ignoreright) || (code == IPT_UI_PAUSE && ignorepause)) + continue; + + if (exclusive_input_pressed(code, 0)) + break; + } +} + +//------------------------------------------------- +// handle input events for main menu +//------------------------------------------------- + +void ui_menu::handle_main_events(UINT32 flags) +{ + bool stop = false; + ui_event local_menu_event; + + // loop while we have interesting events + while (!stop && machine().ui_input().pop_event(&local_menu_event)) + { + switch (local_menu_event.event_type) + { + // if we are hovering over a valid item, select it with a single click + case UI_EVENT_MOUSE_DOWN: + { + if (ui_error) + { + menu_event.iptkey = IPT_OTHER; + stop = true; + } + else + { + if (hover >= 0 && hover < item.size()) + selected = hover; + else if (hover == HOVER_ARROW_UP) + { + selected -= visitems; + if (selected < 0) + selected = 0; + top_line -= visitems - (top_line + visible_lines == visible_items); + } + else if (hover == HOVER_ARROW_DOWN) + { + selected += visible_lines - 2 + (selected == 0); + if (selected >= visible_items) + selected = visible_items - 1; + top_line += visible_lines - 2; + } + else if (hover == HOVER_UI_RIGHT) + menu_event.iptkey = IPT_UI_RIGHT; + else if (hover == HOVER_UI_LEFT) + menu_event.iptkey = IPT_UI_LEFT; + else if (hover == HOVER_DAT_DOWN) + topline_datsview += right_visible_lines - 1; + else if (hover == HOVER_DAT_UP) + topline_datsview -= right_visible_lines - 1; + else if (hover == HOVER_LPANEL_ARROW) + { + if (mewui_globals::panels_status == HIDE_LEFT_PANEL) + mewui_globals::panels_status = SHOW_PANELS; + else if (mewui_globals::panels_status == HIDE_BOTH) + mewui_globals::panels_status = HIDE_RIGHT_PANEL; + else if (mewui_globals::panels_status == SHOW_PANELS) + mewui_globals::panels_status = HIDE_LEFT_PANEL; + else if (mewui_globals::panels_status == HIDE_RIGHT_PANEL) + mewui_globals::panels_status = HIDE_BOTH; + } + else if (hover == HOVER_RPANEL_ARROW) + { + if (mewui_globals::panels_status == HIDE_RIGHT_PANEL) + mewui_globals::panels_status = SHOW_PANELS; + else if (mewui_globals::panels_status == HIDE_BOTH) + mewui_globals::panels_status = HIDE_LEFT_PANEL; + else if (mewui_globals::panels_status == SHOW_PANELS) + mewui_globals::panels_status = HIDE_RIGHT_PANEL; + else if (mewui_globals::panels_status == HIDE_LEFT_PANEL) + mewui_globals::panels_status = HIDE_BOTH; + } + else if (hover == HOVER_B_FAV) + { + menu_event.iptkey = IPT_UI_FAVORITES; + stop = true; + } + else if (hover == HOVER_B_EXPORT) + { + menu_event.iptkey = IPT_UI_EXPORT; + stop = true; + } + else if (hover == HOVER_B_HISTORY) + { + menu_event.iptkey = IPT_UI_HISTORY; + stop = true; + } + else if (hover == HOVER_B_MAMEINFO) + { + menu_event.iptkey = IPT_UI_MAMEINFO; + stop = true; + } + else if (hover == HOVER_B_COMMAND) + { + menu_event.iptkey = IPT_UI_COMMAND; + stop = true; + } + else if (hover == HOVER_B_SETTINGS) + { + menu_event.iptkey = IPT_UI_SELECT; + selected = visible_items + 1; + stop = true; + } + else if (hover == HOVER_B_FOLDERS) + { + menu_event.iptkey = IPT_UI_SELECT; + selected = visible_items + 2; + stop = true; + } + else if (hover >= HOVER_MAME_ALL && hover <= HOVER_MAME_SYSTEMS) + { + ume_filters::actual = (HOVER_MAME_ALL - hover) * (-1); + menu_event.iptkey = IPT_OTHER; + stop = true; + } + else if (hover >= HOVER_RP_FIRST && hover <= HOVER_RP_LAST) + { + mewui_globals::rpanel = (HOVER_RP_FIRST - hover) * (-1); + stop = true; + } + else if (hover >= HOVER_SW_FILTER_FIRST && hover <= HOVER_SW_FILTER_LAST) + { + l_sw_hover = (HOVER_SW_FILTER_FIRST - hover) * (-1); + menu_event.iptkey = IPT_OTHER; + stop = true; + } + else if (hover >= HOVER_FILTER_FIRST && hover <= HOVER_FILTER_LAST) + { + l_hover = (HOVER_FILTER_FIRST - hover) * (-1); + menu_event.iptkey = IPT_OTHER; + stop = true; + } + } + break; + } + + // if we are hovering over a valid item, fake a UI_SELECT with a double-click + case UI_EVENT_MOUSE_DOUBLE_CLICK: + if (hover >= 0 && hover < item.size()) + { + selected = hover; + menu_event.iptkey = IPT_UI_SELECT; + } + + if (selected == item.size() - 1) + { + menu_event.iptkey = IPT_UI_CANCEL; + ui_menu::stack_pop(machine()); + } + stop = true; + break; + + // caught scroll event + case UI_EVENT_MOUSE_WHEEL: + if (local_menu_event.zdelta > 0) + { + if (selected >= visible_items || selected == 0 || ui_error) + break; + selected -= local_menu_event.num_lines; + if (selected < top_line + (top_line != 0)) + top_line -= local_menu_event.num_lines; + } + else + { + if (selected >= visible_items - 1 || ui_error) + break; + selected += local_menu_event.num_lines; + if (selected > visible_items - 1) + selected = visible_items - 1; + if (selected >= top_line + visitems + (top_line != 0)) + top_line += local_menu_event.num_lines; + } + break; + + // translate CHAR events into specials + case UI_EVENT_CHAR: + menu_event.iptkey = IPT_SPECIAL; + menu_event.unichar = local_menu_event.ch; + stop = true; + break; + + // ignore everything else + default: + break; + } + } +} + +//------------------------------------------------- +// draw UME box +//------------------------------------------------- + +void ui_menu::draw_ume_box(float x1, float y1, float x2, float y2) +{ + float text_size = 0.65f; + ui_manager &mui = machine().ui(); + float line_height = mui.get_line_height() * text_size; + float maxwidth = 0.0f; + + for (int x = 0; x < ume_filters::length; x++) + { + float width; + // compute width of left hand side + mui.draw_text_full(container, ume_filters::text[x], 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, UI_TEXT_COLOR, ARGB_BLACK, &width, nullptr, text_size); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + } + + x2 = x1 + maxwidth; + + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + y2 -= UI_BOX_TB_BORDER; + + for (int filter = 0; filter < ume_filters::length; filter++) + { + rgb_t bgcolor = UI_TEXT_BG_COLOR; + rgb_t fgcolor = UI_TEXT_COLOR; + + if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y1 + line_height > mouse_y) + { + bgcolor = UI_MOUSEOVER_BG_COLOR; + fgcolor = UI_MOUSEOVER_COLOR; + hover = HOVER_MAME_ALL + filter; + } + + if (ume_filters::actual == filter) + { + bgcolor = UI_SELECTED_BG_COLOR; + fgcolor = UI_SELECTED_COLOR; + } + + if (bgcolor != UI_TEXT_BG_COLOR) + container->add_rect(x1, y1, x2, y1 + line_height, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + + mui.draw_text_full(container, ume_filters::text[filter], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size); + + y1 += line_height; + } +} + +//------------------------------------------------- +// draw right box title +//------------------------------------------------- + +float ui_menu::draw_right_box_title(float x1, float y1, float x2, float y2) +{ + ui_manager &mui = machine().ui(); + float line_height = mui.get_line_height(); + float midl = (x2 - x1) * 0.5f; + + // add outlined box for options + //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + + // add separator line + container->add_line(x1 + midl, y1, x1 + midl, y1 + line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + + std::string buffer[RP_LAST + 1]; + buffer[RP_IMAGES].assign("Images"); + buffer[RP_INFOS].assign("Infos"); + + for (int cells = RP_IMAGES; cells <= RP_INFOS; cells++) + { + rgb_t bgcolor = UI_TEXT_BG_COLOR; + rgb_t fgcolor = UI_TEXT_COLOR; + + if (mouse_hit && x1 <= mouse_x && x1 + midl > mouse_x && y1 <= mouse_y && y1 + line_height > mouse_y) + { + if (mewui_globals::rpanel != cells) + { + bgcolor = UI_MOUSEOVER_BG_COLOR; + fgcolor = UI_MOUSEOVER_COLOR; + hover = HOVER_RP_FIRST + cells; + } + } + + if (mewui_globals::rpanel != cells) + { + container->add_line(x1, y1 + line_height, x1 + midl, y1 + line_height, UI_LINE_WIDTH, + UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + if (fgcolor != UI_MOUSEOVER_COLOR) + fgcolor = UI_CLONE_COLOR; + } + + if (bgcolor != UI_TEXT_BG_COLOR) + container->add_rect(x1 + UI_LINE_WIDTH, y1 + UI_LINE_WIDTH, x1 + midl - UI_LINE_WIDTH, y1 + line_height, + bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + + mui.draw_text_full(container, buffer[cells].c_str(), x1 + UI_LINE_WIDTH, y1, midl - UI_LINE_WIDTH, + JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + x1 = x1 + midl; + } + + return (y1 + line_height + UI_LINE_WIDTH); +} + +//------------------------------------------------- +// common function for images render +//------------------------------------------------- + +std::string ui_menu::arts_render_common(float origx1, float origy1, float origx2, float origy2) +{ + std::string snaptext, searchstr; + get_title_search(snaptext, searchstr); + + // apply title to right panel + float title_size = 0.0f; + float txt_lenght = 0.0f; + + for (int x = FIRST_VIEW; x < LAST_VIEW; x++) + { + machine().ui().draw_text_full(container, arts_info[x].title, origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, + WRAP_TRUNCATE, DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr); + txt_lenght += 0.01f; + title_size = MAX(txt_lenght, title_size); + } + + machine().ui().draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + draw_common_arrow(origx1, origy1, origx2, origy2, mewui_globals::curimage_view, FIRST_VIEW, LAST_VIEW, title_size); + + return searchstr; +} + +//------------------------------------------------- +// draw favorites star +//------------------------------------------------- + +void ui_menu::draw_star(float x0, float y0) +{ + float y1 = y0 + machine().ui().get_line_height(); + float x1 = x0 + machine().ui().get_line_height() * container->manager().ui_aspect(); + container->add_quad(x0, y0, x1, y1, ARGB_WHITE, star_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); +} + +//------------------------------------------------- +// draw toolbar +//------------------------------------------------- + +void ui_menu::draw_toolbar(float x1, float y1, float x2, float y2, bool software) +{ + ui_manager &mui = machine().ui(); + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + y2 -= UI_BOX_TB_BORDER; + + render_texture **t_texture = (software) ? sw_toolbar_texture : toolbar_texture; + bitmap_argb32 **t_bitmap = (software) ? sw_toolbar_bitmap : toolbar_bitmap; + + int m_valid = 0; + for (int x = 0; x < MEWUI_TOOLBAR_BUTTONS; ++x) + if (t_bitmap[x]->valid()) + m_valid++; + + float x_pixel = 1.0f / container->manager().ui_target().width(); + int h_len = mui.get_line_height() * container->manager().ui_target().height(); + h_len = (h_len % 2 == 0) ? h_len : h_len - 1; + x1 = (x1 + x2) * 0.5f - x_pixel * (m_valid * ((h_len / 2) + 2)); + + for (int z = 0; z < MEWUI_TOOLBAR_BUTTONS; ++z) + { + if (t_bitmap[z]->valid()) + { + x2 = x1 + x_pixel * h_len; + rgb_t color(0xEFEFEFEF); + if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y) + { + hover = HOVER_B_FAV + z; + color = ARGB_WHITE; + float ypos = y2 + machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER; + mui.draw_text_box(container, hover_msg[z], JUSTIFY_CENTER, 0.5f, ypos, UI_BACKGROUND_COLOR); + } + + container->add_quad(x1, y1, x2, y2, color, t_texture[z], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + x1 += x_pixel * (h_len + 2); + } + } +} + + +//------------------------------------------------- +// perform rendering of image +//------------------------------------------------- + +void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float origy1, float origx2, float origy2, bool software) +{ + bool no_available = false; + float line_height = machine().ui().get_line_height(); + + // if it fails, use the default image + if (!tmp_bitmap->valid()) + { + tmp_bitmap->reset(); + tmp_bitmap->allocate(256, 256); + for (int x = 0; x < 256; x++) + for (int y = 0; y < 256; y++) + tmp_bitmap->pix32(y, x) = no_avail_bitmap->pix32(y, x); + no_available = true; + } + + if (tmp_bitmap->valid()) + { + float panel_width = origx2 - origx1 - 0.02f; + float panel_height = origy2 - origy1 - 0.02f - (2.0f * UI_BOX_TB_BORDER) - (2.0f * line_height); + int screen_width = machine().render().ui_target().width(); + int screen_height = machine().render().ui_target().height(); + int panel_width_pixel = panel_width * screen_width; + int panel_height_pixel = panel_height * screen_height; + float ratio = 0.0f; + + // Calculate resize ratios for resizing + float ratioW = (float)panel_width_pixel / tmp_bitmap->width(); + float ratioH = (float)panel_height_pixel / tmp_bitmap->height(); + float ratioI = (float)tmp_bitmap->height() / tmp_bitmap->width(); + int dest_xPixel = tmp_bitmap->width(); + int dest_yPixel = tmp_bitmap->height(); + + // force 4:3 ratio min + if (machine().options().forced_4x3_snapshot() && ratioI < 0.75f && mewui_globals::curimage_view == SNAPSHOT_VIEW) + { + // smaller ratio will ensure that the image fits in the view + dest_yPixel = tmp_bitmap->width() * 0.75f; + ratioH = (float)panel_height_pixel / dest_yPixel; + ratio = MIN(ratioW, ratioH); + dest_xPixel = tmp_bitmap->width() * ratio; + dest_yPixel *= ratio; + } + // resize the bitmap if necessary + else if (ratioW < 1 || ratioH < 1 || (machine().options().enlarge_snaps() && !no_available)) + { + // smaller ratio will ensure that the image fits in the view + ratio = MIN(ratioW, ratioH); + dest_xPixel = tmp_bitmap->width() * ratio; + dest_yPixel = tmp_bitmap->height() * ratio; + } + + bitmap_argb32 *dest_bitmap; + dest_bitmap = auto_alloc(machine(), bitmap_argb32); + + // resample if necessary + if (dest_xPixel != tmp_bitmap->width() || dest_yPixel != tmp_bitmap->height()) + { + dest_bitmap->allocate(dest_xPixel, dest_yPixel); + render_color color = { 1.0f, 1.0f, 1.0f, 1.0f }; + render_resample_argb_bitmap_hq(*dest_bitmap, *tmp_bitmap, color, true); + } + else + dest_bitmap = tmp_bitmap; + + snapx_bitmap->reset(); + snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel); + int x1 = (0.5f * panel_width_pixel) - (0.5f * dest_xPixel); + int y1 = (0.5f * panel_height_pixel) - (0.5f * dest_yPixel); + + for (int x = 0; x < dest_xPixel; x++) + for (int y = 0; y < dest_yPixel; y++) + snapx_bitmap->pix32(y + y1, x + x1) = dest_bitmap->pix32(y, x); + + auto_free(machine(), dest_bitmap); + + // apply bitmap + snapx_texture->set_bitmap(*snapx_bitmap, snapx_bitmap->cliprect(), TEXFORMAT_ARGB32); + } + else + snapx_bitmap->reset(); +} + +//------------------------------------------------- +// draw common arrows +//------------------------------------------------- + +void ui_menu::draw_common_arrow(float origx1, float origy1, float origx2, float origy2, int current, int dmin, int dmax, float title_size) +{ + float line_height = machine().ui().get_line_height(); + float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); + float gutter_width = lr_arrow_width * 1.3f; + + // set left-right arrows dimension + float ar_x0 = 0.5f * (origx2 + origx1) + 0.5f * title_size + gutter_width - lr_arrow_width; + float ar_y0 = origy1 + 0.1f * line_height; + float ar_x1 = 0.5f * (origx2 + origx1) + 0.5f * title_size + gutter_width; + float ar_y1 = origy1 + 0.9f * line_height; + + float al_x0 = 0.5f * (origx2 + origx1) - 0.5f * title_size - gutter_width; + float al_y0 = origy1 + 0.1f * line_height; + float al_x1 = 0.5f * (origx2 + origx1) - 0.5f * title_size - gutter_width + lr_arrow_width; + float al_y1 = origy1 + 0.9f * line_height; + + rgb_t fgcolor_right, fgcolor_left; + fgcolor_right = fgcolor_left = UI_TEXT_COLOR; + + // set hover + if (mouse_hit && ar_x0 <= mouse_x && ar_x1 > mouse_x && ar_y0 <= mouse_y && ar_y1 > mouse_y && current != dmax) + { + machine().ui().draw_textured_box(container, ar_x0 + 0.01f, ar_y0, ar_x1 - 0.01f, ar_y1, UI_MOUSEOVER_BG_COLOR, rgb_t(255, 43, 43, 43), + hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + hover = HOVER_UI_RIGHT; + fgcolor_right = UI_MOUSEOVER_COLOR; + } + else if (mouse_hit && al_x0 <= mouse_x && al_x1 > mouse_x && al_y0 <= mouse_y && al_y1 > mouse_y && current != dmin) + { + machine().ui().draw_textured_box(container, al_x0 + 0.01f, al_y0, al_x1 - 0.01f, al_y1, UI_MOUSEOVER_BG_COLOR, rgb_t(255, 43, 43, 43), + hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + hover = HOVER_UI_LEFT; + fgcolor_left = UI_MOUSEOVER_COLOR; + } + + // apply arrow + if (current == dmin) + container->add_quad(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90)); + else if (current == dmax) + container->add_quad(al_x0, al_y0, al_x1, al_y1, fgcolor_left, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90 ^ ORIENTATION_FLIP_X)); + else + { + container->add_quad(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90)); + container->add_quad(al_x0, al_y0, al_x1, al_y1, fgcolor_left, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90 ^ ORIENTATION_FLIP_X)); + } +} + +//------------------------------------------------- +// draw icons +//------------------------------------------------- + +void ui_menu::draw_icon(int linenum, void *selectedref, float x0, float y0) +{ + static const game_driver *olddriver[MAX_ICONS_RENDER] = { nullptr }; + float x1 = x0 + machine().ui().get_line_height() * container->manager().ui_aspect(container); + float y1 = y0 + machine().ui().get_line_height(); + const game_driver *driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr; + + if (driver == nullptr) + return; + + if (olddriver[linenum] != driver || mewui_globals::redraw_icon) + { + olddriver[linenum] = driver; + + // set clone status + bool cloneof = strcmp(driver->parent, "0"); + if (cloneof) + { + int cx = driver_list::find(driver->parent); + if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0)) + cloneof = false; + } + + // get search path + path_iterator path(machine().options().icons_directory()); + std::string curpath; + std::string searchstr(machine().options().icons_directory()); + + // iterate over path and add path for zipped formats + while (path.next(curpath)) + searchstr.append(";").append(curpath.c_str()).append(PATH_SEPARATOR).append("icons"); + + bitmap_argb32 *tmp = auto_alloc(machine(), bitmap_argb32); + emu_file snapfile(searchstr.c_str(), OPEN_FLAG_READ); + std::string fullname = std::string(driver->name).append(".ico"); + render_load_ico(*tmp, snapfile, nullptr, fullname.c_str()); + + if (!tmp->valid() && cloneof) + { + fullname.assign(driver->parent).append(".ico"); + render_load_ico(*tmp, snapfile, nullptr, fullname.c_str()); + } + + if (tmp->valid()) + { + float panel_width = x1 - x0; + float panel_height = y1 - y0; + int screen_width = machine().render().ui_target().width(); + int screen_height = machine().render().ui_target().height(); + int panel_width_pixel = panel_width * screen_width; + int panel_height_pixel = panel_height * screen_height; + + // Calculate resize ratios for resizing + float ratioW = (float)panel_width_pixel / tmp->width(); + float ratioH = (float)panel_height_pixel / tmp->height(); + int dest_xPixel = tmp->width(); + int dest_yPixel = tmp->height(); + + if (ratioW < 1 || ratioH < 1) + { + // smaller ratio will ensure that the image fits in the view + float ratio = MIN(ratioW, ratioH); + dest_xPixel = tmp->width() * ratio; + dest_yPixel = tmp->height() * ratio; + } + + bitmap_argb32 *dest_bitmap; + dest_bitmap = auto_alloc(machine(), bitmap_argb32); + + // resample if necessary + if (dest_xPixel != tmp->width() || dest_yPixel != tmp->height()) + { + dest_bitmap->allocate(dest_xPixel, dest_yPixel); + render_color color = { 1.0f, 1.0f, 1.0f, 1.0f }; + render_resample_argb_bitmap_hq(*dest_bitmap, *tmp, color, true); + } + else + dest_bitmap = tmp; + + icons_bitmap[linenum]->reset(); + icons_bitmap[linenum]->allocate(panel_width_pixel, panel_height_pixel); + + for (int x = 0; x < dest_xPixel; x++) + for (int y = 0; y < dest_yPixel; y++) + icons_bitmap[linenum]->pix32(y, x) = dest_bitmap->pix32(y, x); + + auto_free(machine(), dest_bitmap); + + icons_texture[linenum]->set_bitmap(*icons_bitmap[linenum], icons_bitmap[linenum]->cliprect(), TEXFORMAT_ARGB32); + } + else + icons_bitmap[linenum]->reset(); + + auto_free(machine(), tmp); + } + + if (icons_bitmap[linenum]->valid()) + container->add_quad(x0, y0, x1, y1, ARGB_WHITE, icons_texture[linenum], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); +} + +//------------------------------------------------- +// draw info arrow +//------------------------------------------------- + +void ui_menu::info_arrow(int ub, float origx1, float origx2, float oy1, float line_height, float text_size, float ud_arrow_width) +{ + rgb_t fgcolor = UI_TEXT_COLOR; + UINT32 orientation = (!ub) ? ROT0 : ROT0 ^ ORIENTATION_FLIP_Y; + + if (mouse_hit && origx1 <= mouse_x && origx2 > mouse_x && oy1 <= mouse_y && oy1 + (line_height * text_size) > mouse_y) + { + machine().ui().draw_textured_box(container, origx1 + 0.01f, oy1, origx2 - 0.01f, oy1 + (line_height * text_size), UI_MOUSEOVER_BG_COLOR, + rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + hover = (!ub) ? HOVER_DAT_UP : HOVER_DAT_DOWN; + fgcolor = UI_MOUSEOVER_COLOR; + } + + draw_arrow(container, 0.5f * (origx1 + origx2) - 0.5f * (ud_arrow_width * text_size), oy1 + 0.25f * (line_height * text_size), + 0.5f * (origx1 + origx2) + 0.5f * (ud_arrow_width * text_size), oy1 + 0.75f * (line_height * text_size), fgcolor, orientation); +} + +//------------------------------------------------- +// draw - draw a menu +//------------------------------------------------- + +void ui_menu::draw_palette_menu() +{ + ui_manager &mui = machine().ui(); + float line_height = mui.get_line_height(); + float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); + float ud_arrow_width = line_height * machine().render().ui_aspect(); + float gutter_width = lr_arrow_width * 1.3f; + int itemnum, linenum; + + if (machine().options().use_background_image() && machine().options().system() == nullptr && bgrnd_bitmap->valid()) + container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + + // compute the width and height of the full menu + float visible_width = 0; + float visible_main_menu_height = 0; + for (itemnum = 0; itemnum < item.size(); itemnum++) + { + const ui_menu_item &pitem = item[itemnum]; + + // compute width of left hand side + float total_width = gutter_width + mui.get_string_width(pitem.text) + gutter_width; + + // add in width of right hand side + if (pitem.subtext) + total_width += 2.0f * gutter_width + mui.get_string_width(pitem.subtext); + + // track the maximum + if (total_width > visible_width) + visible_width = total_width; + + // track the height as well + visible_main_menu_height += line_height; + } + + // account for extra space at the top and bottom + float visible_extra_menu_height = customtop + custombottom; + + // add a little bit of slop for rounding + visible_width += 0.01f; + visible_main_menu_height += 0.01f; + + // if we are too wide or too tall, clamp it down + if (visible_width + 2.0f * UI_BOX_LR_BORDER > 1.0f) + visible_width = 1.0f - 2.0f * UI_BOX_LR_BORDER; + + // if the menu and extra menu won't fit, take away part of the regular menu, it will scroll + if (visible_main_menu_height + visible_extra_menu_height + 2.0f * UI_BOX_TB_BORDER > 1.0f) + visible_main_menu_height = 1.0f - 2.0f * UI_BOX_TB_BORDER - visible_extra_menu_height; + + int visible_lines = floor(visible_main_menu_height / line_height); + visible_main_menu_height = (float)visible_lines * line_height; + + // compute top/left of inner menu area by centering + float visible_left = (1.0f - visible_width) * 0.5f; + float visible_top = (1.0f - (visible_main_menu_height + visible_extra_menu_height)) * 0.5f; + + // if the menu is at the bottom of the extra, adjust + visible_top += customtop; + + // first add us a box + float x1 = visible_left - UI_BOX_LR_BORDER; + float y1 = visible_top - UI_BOX_TB_BORDER; + float x2 = visible_left + visible_width + UI_BOX_LR_BORDER; + float y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER; + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + + // determine the first visible line based on the current selection + int top_line = selected - visible_lines / 2; + if (top_line < 0) + top_line = 0; + if (top_line + visible_lines >= item.size()) + top_line = item.size() - visible_lines; + + // determine effective positions taking into account the hilighting arrows + float effective_width = visible_width - 2.0f * gutter_width; + float effective_left = visible_left + gutter_width; + + // locate mouse + mouse_hit = false; + mouse_button = false; + mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button); + if (mouse_target != nullptr) + if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y)) + mouse_hit = true; + + // loop over visible lines + hover = item.size() + 1; + float line_x0 = x1 + 0.5f * UI_LINE_WIDTH; + float line_x1 = x2 - 0.5f * UI_LINE_WIDTH; + + for (linenum = 0; linenum < visible_lines; linenum++) + { + float line_y = visible_top + (float)linenum * line_height; + itemnum = top_line + linenum; + const ui_menu_item &pitem = item[itemnum]; + const char *itemtext = pitem.text; + rgb_t fgcolor = UI_TEXT_COLOR; + rgb_t bgcolor = UI_TEXT_BG_COLOR; + float line_y0 = line_y; + float line_y1 = line_y + line_height; + + // set the hover if this is our item + if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && pitem.is_selectable()) + hover = itemnum; + + // if we're selected, draw with a different background + if (itemnum == selected && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) + { + fgcolor = UI_SELECTED_COLOR; + bgcolor = UI_SELECTED_BG_COLOR; + } + + // else if the mouse is over this item, draw with a different background + else if (itemnum == hover && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) + { + fgcolor = UI_MOUSEOVER_COLOR; + bgcolor = UI_MOUSEOVER_BG_COLOR; + } + + // if we have some background hilighting to do, add a quad behind everything else + if (bgcolor != UI_TEXT_BG_COLOR) + highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor); + + // if we're on the top line, display the up arrow + if (linenum == 0 && top_line != 0) + { + draw_arrow(container, + 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, + line_y + 0.25f * line_height, + 0.5f * (x1 + x2) + 0.5f * ud_arrow_width, + line_y + 0.75f * line_height, + fgcolor, + ROT0); + if (hover == itemnum) + hover = HOVER_ARROW_UP; + } + + // if we're on the bottom line, display the down arrow + else if (linenum == visible_lines - 1 && itemnum != item.size() - 1) + { + draw_arrow(container, + 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, + line_y + 0.25f * line_height, + 0.5f * (x1 + x2) + 0.5f * ud_arrow_width, + line_y + 0.75f * line_height, + fgcolor, + ROT0 ^ ORIENTATION_FLIP_Y); + if (hover == itemnum) + hover = HOVER_ARROW_DOWN; + } + + // if we're just a divider, draw a line + else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) + container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + + // if we don't have a subitem, just draw the string centered + else if (pitem.subtext == nullptr) + mui.draw_text_full(container, itemtext, effective_left, line_y, effective_width, + JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + + // otherwise, draw the item on the left and the subitem text on the right + else + { + const char *subitem_text = pitem.subtext; + rgb_t color = rgb_t((UINT32)strtoul(subitem_text, nullptr, 16)); + + // draw the left-side text + mui.draw_text_full(container, itemtext, effective_left, line_y, effective_width, + JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + + // give 2 spaces worth of padding + float subitem_width = mui.get_string_width("FF00FF00"); + + mui.draw_outlined_box(container, effective_left + effective_width - subitem_width, line_y0, + effective_left + effective_width, line_y1, color); + } + } + + // if there is something special to add, do it by calling the virtual method + custom_render((selected >= 0 && selected < item.size()) ? item[selected].ref : nullptr, customtop, custombottom, x1, y1, x2, y2); + + // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow + visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != item.size()); +} \ No newline at end of file diff --git a/src/emu/ui/menu.h b/src/emu/ui/menu.h index b52b0f90ff4..606e66c5908 100644 --- a/src/emu/ui/menu.h +++ b/src/emu/ui/menu.h @@ -2,9 +2,9 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /*************************************************************************** - ui/menu.h + ui/menu.h - Internal MAME menus for the user interface. + Internal MAME menus for the user interface. ***************************************************************************/ @@ -17,7 +17,7 @@ /*************************************************************************** - CONSTANTS + CONSTANTS ***************************************************************************/ // flags for menu items @@ -27,6 +27,11 @@ #define MENU_FLAG_MULTILINE (1 << 3) #define MENU_FLAG_REDTEXT (1 << 4) #define MENU_FLAG_DISABLE (1 << 5) +#define MENU_FLAG_MEWUI (1 << 6) +#define MENU_FLAG_MEWUI_HISTORY (1 << 7) +#define MENU_FLAG_MEWUI_SWLIST (1 << 8) +#define MENU_FLAG_MEWUI_FAVORITE (1 << 9) +#define MENU_FLAG_MEWUI_PALETTE (1 << 10) // special menu item for separators #define MENU_SEPARATOR_ITEM "---" @@ -35,6 +40,9 @@ #define UI_MENU_PROCESS_NOKEYS 1 #define UI_MENU_PROCESS_LR_REPEAT 2 #define UI_MENU_PROCESS_CUSTOM_ONLY 4 +#define UI_MENU_PROCESS_ONLYCHAR 8 +#define UI_MENU_PROCESS_NOINPUT 16 +#define UI_MENU_PROCESS_NOIMAGE 32 // options for ui_menu_reset enum ui_menu_reset_options @@ -47,32 +55,32 @@ enum ui_menu_reset_options /*************************************************************************** - TYPE DEFINITIONS + TYPE DEFINITIONS ***************************************************************************/ // menu-related events struct ui_menu_event { - void * itemref; // reference for the selected item - int iptkey; // one of the IPT_* values from inptport.h - unicode_char unichar; // unicode character if iptkey == IPT_SPECIAL + void *itemref; // reference for the selected item + int iptkey; // one of the IPT_* values from inptport.h + unicode_char unichar; // unicode character if iptkey == IPT_SPECIAL }; struct ui_menu_pool { - ui_menu_pool * next; // chain to next one - UINT8 * top; // top of the pool - UINT8 * end; // end of the pool + ui_menu_pool *next; // chain to next one + UINT8 *top; // top of the pool + UINT8 *end; // end of the pool }; class ui_menu_item { public: - const char * text; - const char * subtext; - UINT32 flags; - void * ref; + const char *text; + const char *subtext; + UINT32 flags; + void *ref; inline bool is_selectable() const; }; @@ -85,27 +93,22 @@ public: running_machine &machine() const { return m_machine; } - render_container * container; // render_container we render to - ui_menu_event menu_event; // the UI menu_event that occurred - ui_menu * parent; // pointer to parent menu - int resetpos; // reset position - void * resetref; // reset reference - int selected; // which item is selected - int hover; // which item is being hovered over - int visitems; // number of visible items - int numitems; // number of items in the menu - int allocitems; // allocated size of array - ui_menu_item * item; // pointer to array of items - float customtop; // amount of extra height to add at the top - float custombottom; // amount of extra height to add at the bottom - ui_menu_pool * pool; // list of memory pools + render_container *container; // render_container we render to + ui_menu_event menu_event; // the UI menu_event that occurred + ui_menu *parent; // pointer to parent menu + int resetpos; // reset position + void *resetref; // reset reference + int selected; // which item is selected + int hover; // which item is being hovered over + int visitems; // number of visible items + float customtop; // amount of extra height to add at the top + float custombottom; // amount of extra height to add at the bottom + ui_menu_pool *pool; // list of memory pools + std::vector item; // array of items // free all items in the menu, and all memory allocated from the memory pool void reset(ui_menu_reset_options options); - // returns true if the menu has any non-default items in it - bool populated(); - // append a new item to the end of the menu void item_append(const char *text, const char *subtext, UINT32 flags, void *ref); @@ -168,22 +171,117 @@ public: // To be reimplemented in the menu subclass virtual void handle() = 0; + // test if search is active + virtual bool menu_has_search_active() { return false; } + private: static ui_menu *menu_free; static std::unique_ptr hilight_bitmap; static render_texture *hilight_texture, *arrow_texture; bool m_special_main_menu; - running_machine & m_machine; // machine we are attached to + running_machine &m_machine; // machine we are attached to - void draw(bool customonly); + void draw(bool customonly, bool noimage, bool noinput); void draw_text_box(); - void handle_events(); + void handle_events(UINT32 flags); void handle_keys(UINT32 flags); inline bool exclusive_input_pressed(int key, int repeat); static void clear_free_list(running_machine &machine); static void render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param); + +/***************************************** + MEWUI SECTION +*****************************************/ +public: + int visible_items; + bool ui_error; + + // mouse handling + bool mouse_hit, mouse_button; + render_target *mouse_target; + INT32 mouse_target_x, mouse_target_y; + float mouse_x, mouse_y; + + // draw UME box + void draw_ume_box(float x1, float y1, float x2, float y2); + + // draw toolbar + void draw_toolbar(float x1, float y1, float x2, float y2, bool software = false); + + // draw left panel + virtual float draw_left_panel(float x1, float y1, float x2, float y2) { return 0; } + + // draw right panel + virtual void draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) { }; + + // draw star + void draw_star(float x0, float y0); + + // Global initialization + static void init_mewui(running_machine &machine); + + // get arrows status + template + UINT32 get_arrow_flags(_T1 min, _T2 max, _T3 actual) + { + if (max == 0) + return 0; + else + return ((actual <= min) ? MENU_FLAG_RIGHT_ARROW : (actual >= max ? MENU_FLAG_LEFT_ARROW : (MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW))); + } + +protected: + int topline_datsview; // right box top line + int top_line; // main box top line + int l_sw_hover; + int l_hover; + int totallines; + + // draw right box + float draw_right_box_title(float x1, float y1, float x2, float y2); + + // draw arrow + void draw_common_arrow(float origx1, float origy1, float origx2, float origy2, int current, int dmin, int dmax, float title); + void info_arrow(int ub, float origx1, float origx2, float oy1, float line_height, float text_size, float ud_arrow_width); + + // images render + std::string arts_render_common(float origx1, float origy1, float origx2, float origy2); + void arts_render_images(bitmap_argb32 *bitmap, float origx1, float origy1, float origx2, float origy2, bool software); + + int visible_lines; // main box visible lines + int right_visible_lines; // right box lines + + static std::unique_ptr snapx_bitmap; + static render_texture *snapx_texture; + +private: + static std::unique_ptr no_avail_bitmap, bgrnd_bitmap, star_bitmap; + static std::unique_ptr hilight_main_bitmap; + static render_texture *hilight_main_texture, *bgrnd_texture, *star_texture; + static bitmap_argb32 *icons_bitmap[]; + static render_texture *icons_texture[]; + + // toolbar + static bitmap_argb32 *toolbar_bitmap[], *sw_toolbar_bitmap[]; + static render_texture *toolbar_texture[], *sw_toolbar_texture[]; + + // draw game list + void draw_select_game(bool noinput); + + // draw game list + void draw_palette_menu(); + + void get_title_search(std::string &title, std::string &search); + + // handle keys + void handle_main_keys(UINT32 flags); + + // handle mouse + void handle_main_events(UINT32 flags); + + void draw_icon(int linenum, void *selectedref, float x1, float y1); }; #endif // __UI_MENU_H__ diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp index 9d96692a15a..35181d6a584 100644 --- a/src/emu/ui/miscmenu.cpp +++ b/src/emu/ui/miscmenu.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods +// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods,Dankan1890 /********************************************************************* miscmenu.c @@ -15,7 +15,7 @@ #include "ui/ui.h" #include "ui/menu.h" #include "ui/miscmenu.h" - +#include "ui/utils.h" /*************************************************************************** MENU HANDLERS @@ -556,3 +556,109 @@ void ui_menu_quit_game::handle() /* reset the menu stack */ ui_menu::stack_reset(machine()); } + +ui_menu_misc_options::misc_option ui_menu_misc_options::m_options[] = { + { 0, nullptr, nullptr }, + { 0, "Re-select last machine played", OPTION_REMEMBER_LAST }, + { 0, "Enlarge images in the right panel", OPTION_ENLARGE_SNAPS }, + { 0, "DATs info", OPTION_DATS_ENABLED }, + { 0, "Cheats", OPTION_CHEAT }, + { 0, "Show mouse pointer", OPTION_UI_MOUSE }, + { 0, "Confirm quit from machines", OPTION_CONFIRM_QUIT }, + { 0, "Skip displaying information's screen at startup", OPTION_SKIP_GAMEINFO }, + { 0, "Force 4:3 appearance for software snapshot", OPTION_FORCED4X3 }, + { 0, "Use image as background", OPTION_USE_BACKGROUND }, + { 0, "Skip bios selection menu", OPTION_SKIP_BIOS_MENU }, + { 0, "Skip software parts selection menu", OPTION_SKIP_PARTS_MENU } +}; + +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_misc_options::ui_menu_misc_options(running_machine &machine, render_container *container) : ui_menu(machine, container) +{ + for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) + m_options[d].status = machine.options().bool_value(m_options[d].option); +} + +ui_menu_misc_options::~ui_menu_misc_options() +{ + std::string error_string; + for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) + machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); + mewui_globals::reset = true; +} + +//------------------------------------------------- +// handlethe options menu +//------------------------------------------------- + +void ui_menu_misc_options::handle() +{ + bool changed = false; + + // process the menu + const ui_menu_event *m_event = process(0); + if (m_event != nullptr && m_event->itemref != nullptr) + { + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT) + { + changed = true; + int value = (FPTR)m_event->itemref; + if (!strcmp(m_options[value].option, OPTION_ENLARGE_SNAPS)) + mewui_globals::switch_image = true; + m_options[value].status = !m_options[value].status; + } + } + + if (changed) + reset(UI_MENU_RESET_REMEMBER_REF); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_misc_options::populate() +{ + // add options items + for (int opt = 1; opt < ARRAY_LENGTH(m_options); ++opt) + item_append(m_options[opt].description, m_options[opt].status ? "On" : "Off", m_options[opt].status ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)opt); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_misc_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + + mui.draw_text_full(container, "Miscellaneous Options", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + float maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, "Miscellaneous Options", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} diff --git a/src/emu/ui/miscmenu.h b/src/emu/ui/miscmenu.h index ea75897edde..f43c4a6b2ba 100644 --- a/src/emu/ui/miscmenu.h +++ b/src/emu/ui/miscmenu.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods +// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods,Dankan1890 /*************************************************************************** ui/miscmenu.h @@ -85,4 +85,27 @@ public: virtual void handle() override; }; +//------------------------------------------------- +// class miscellaneous options menu +//------------------------------------------------- +class ui_menu_misc_options : public ui_menu +{ +public: + ui_menu_misc_options(running_machine &machine, render_container *container); + virtual ~ui_menu_misc_options(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + struct misc_option + { + bool status; + const char *description; + const char *option; + }; + + static misc_option m_options[]; +}; + #endif /* __UI_MISCMENU_H__ */ diff --git a/src/emu/ui/moptions.cpp b/src/emu/ui/moptions.cpp new file mode 100644 index 00000000000..f99699e0a41 --- /dev/null +++ b/src/emu/ui/moptions.cpp @@ -0,0 +1,89 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/moptions.c + + MEWUI main options manager. + +***************************************************************************/ + +#include "emu.h" +#include "ui/moptions.h" + + +//************************************************************************** +// MEWUI EXTRA OPTIONS +//************************************************************************** + +const options_entry mewui_options::s_option_entries[] = +{ + // seach path options + { nullptr, nullptr, OPTION_HEADER, "MEWUI SEARCH PATH OPTIONS" }, + { OPTION_HISTORY_PATH, "history;dats", OPTION_STRING, "path to history files" }, + { OPTION_EXTRAINI_PATH, "folders", OPTION_STRING, "path to extra ini files" }, + { OPTION_CABINETS_PATH, "cabinets;cabdevs", OPTION_STRING, "path to cabinets / devices image" }, + { OPTION_CPANELS_PATH, "cpanel", OPTION_STRING, "path to control panel image" }, + { OPTION_PCBS_PATH, "pcb", OPTION_STRING, "path to pcbs image" }, + { OPTION_FLYERS_PATH, "flyers", OPTION_STRING, "path to flyers image" }, + { OPTION_TITLES_PATH, "titles", OPTION_STRING, "path to titles image" }, + { OPTION_ENDS_PATH, "ends", OPTION_STRING, "path to ends image" }, + { OPTION_MARQUEES_PATH, "marquees", OPTION_STRING, "path to marquees image" }, + { OPTION_ARTPREV_PATH, "artwork preview", OPTION_STRING, "path to artwork preview image" }, + { OPTION_BOSSES_PATH, "bosses", OPTION_STRING, "path to bosses image" }, + { OPTION_LOGOS_PATH, "logo", OPTION_STRING, "path to logos image" }, + { OPTION_SCORES_PATH, "scores", OPTION_STRING, "path to scores image" }, + { OPTION_VERSUS_PATH, "versus", OPTION_STRING, "path to versus image" }, + { OPTION_GAMEOVER_PATH, "gameover", OPTION_STRING, "path to gameover image" }, + { OPTION_HOWTO_PATH, "howto", OPTION_STRING, "path to howto image" }, + { OPTION_SELECT_PATH, "select", OPTION_STRING, "path to select image" }, + { OPTION_ICONS_PATH, "icons", OPTION_STRING, "path to ICOns image" }, + { OPTION_MEWUI_PATH, "mewui", OPTION_STRING, "path to MEWUI files" }, + + // misc options + { nullptr, nullptr, OPTION_HEADER, "MEWUI MISC OPTIONS" }, + { OPTION_DATS_ENABLED, "1", OPTION_BOOLEAN, "enable DATs support" }, + { OPTION_REMEMBER_LAST, "1", OPTION_BOOLEAN, "reselect in main menu last played game" }, + { OPTION_ENLARGE_SNAPS, "1", OPTION_BOOLEAN, "enlarge arts (snapshot, title, etc...) in right panel (keeping aspect ratio)" }, + { OPTION_FORCED4X3, "1", OPTION_BOOLEAN, "force the appearance of the snapshot in the list software to 4:3" }, + { OPTION_USE_BACKGROUND, "1", OPTION_BOOLEAN, "enable background image in main view" }, + { OPTION_SKIP_BIOS_MENU, "0", OPTION_BOOLEAN, "skip bios submenu, start with configured or default" }, + { OPTION_SKIP_PARTS_MENU, "0", OPTION_BOOLEAN, "skip parts submenu, start with first part" }, + { OPTION_START_FILTER, "0", OPTION_INTEGER, "startup filter (0 = ALL, 1 = ARCADES, 2 = SYSTEMS)" }, + { OPTION_LAST_USED_FILTER, "", OPTION_STRING, "latest used filter" }, + { OPTION_LAST_USED_MACHINE, "", OPTION_STRING, "latest used machine" }, + { OPTION_INFO_AUTO_AUDIT, "0", OPTION_BOOLEAN, "enable auto audit in the general info panel" }, + + // UI options + { nullptr, nullptr, OPTION_HEADER, "MEWUI UI OPTIONS" }, + { OPTION_INFOS_SIZE "(0.05-1.00)", "0.75", OPTION_FLOAT, "UI right panel infos text size (0.05 - 1.00)" }, + { OPTION_FONT_ROWS "(25-40)", "30", OPTION_INTEGER, "UI font text size (25 - 40)" }, + { OPTION_HIDE_PANELS "(0-3)", "0", OPTION_INTEGER, "UI hide left/right panel in main view (0 = Show all, 1 = hide left, 2 = hide right, 3 = hide both" }, + { OPTION_UI_BORDER_COLOR, "ffffffff", OPTION_STRING, "UI border color (ARGB)" }, + { OPTION_UI_BACKGROUND_COLOR, "ef101030", OPTION_STRING, "UI background color (ARGB)" }, + { OPTION_UI_CLONE_COLOR, "ff808080", OPTION_STRING, "UI clone color (ARGB)" }, + { OPTION_UI_DIPSW_COLOR, "ffffff00", OPTION_STRING, "UI dipswitch color (ARGB)" }, + { OPTION_UI_GFXVIEWER_BG_COLOR, "ef101030", OPTION_STRING, "UI gfx viewer color (ARGB)" }, + { OPTION_UI_MOUSEDOWN_BG_COLOR, "b0606000", OPTION_STRING, "UI mouse down bg color (ARGB)" }, + { OPTION_UI_MOUSEDOWN_COLOR, "ffffff80", OPTION_STRING, "UI mouse down color (ARGB)" }, + { OPTION_UI_MOUSEOVER_BG_COLOR, "70404000", OPTION_STRING, "UI mouse over bg color (ARGB)" }, + { OPTION_UI_MOUSEOVER_COLOR, "ffffff80", OPTION_STRING, "UI mouse over color (ARGB)" }, + { OPTION_UI_SELECTED_BG_COLOR, "ef808000", OPTION_STRING, "UI selected bg color (ARGB)" }, + { OPTION_UI_SELECTED_COLOR, "ffffff00", OPTION_STRING, "UI selected color (ARGB)" }, + { OPTION_UI_SLIDER_COLOR, "ffffffff", OPTION_STRING, "UI slider color (ARGB)" }, + { OPTION_UI_SUBITEM_COLOR, "ffffffff", OPTION_STRING, "UI subitem color (ARGB)" }, + { OPTION_UI_TEXT_BG_COLOR, "ef000000", OPTION_STRING, "UI text bg color (ARGB)" }, + { OPTION_UI_TEXT_COLOR, "ffffffff", OPTION_STRING, "UI text color (ARGB)" }, + { OPTION_UI_UNAVAILABLE_COLOR, "ff404040", OPTION_STRING, "UI unavailable color (ARGB)" }, + { nullptr } +}; + +//------------------------------------------------- +// mewui_options - constructor +//------------------------------------------------- + +mewui_options::mewui_options() +: core_options() +{ + add_entries(mewui_options::s_option_entries); +} diff --git a/src/emu/ui/moptions.h b/src/emu/ui/moptions.h new file mode 100644 index 00000000000..b31827645fa --- /dev/null +++ b/src/emu/ui/moptions.h @@ -0,0 +1,140 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/moptions.h + + MEWUI main options manager. + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_OPTS_H__ +#define __MEWUI_OPTS_H__ + +#include "options.h" + +// core directory options +#define OPTION_HISTORY_PATH "historypath" +#define OPTION_EXTRAINI_PATH "extrainipath" +#define OPTION_CABINETS_PATH "cabinets_directory" +#define OPTION_CPANELS_PATH "cpanels_directory" +#define OPTION_PCBS_PATH "pcbs_directory" +#define OPTION_FLYERS_PATH "flyers_directory" +#define OPTION_TITLES_PATH "titles_directory" +#define OPTION_ENDS_PATH "ends_directory" +#define OPTION_MARQUEES_PATH "marquees_directory" +#define OPTION_ARTPREV_PATH "artwork_preview_directory" +#define OPTION_BOSSES_PATH "bosses_directory" +#define OPTION_LOGOS_PATH "logos_directory" +#define OPTION_SCORES_PATH "scores_directory" +#define OPTION_VERSUS_PATH "versus_directory" +#define OPTION_GAMEOVER_PATH "gameover_directory" +#define OPTION_HOWTO_PATH "howto_directory" +#define OPTION_SELECT_PATH "select_directory" +#define OPTION_ICONS_PATH "icons_directory" +#define OPTION_MEWUI_PATH "mewui_path" + +// core misc options +#define OPTION_DATS_ENABLED "dats_enabled" +#define OPTION_REMEMBER_LAST "remember_last" +#define OPTION_ENLARGE_SNAPS "enlarge_snaps" +#define OPTION_FORCED4X3 "forced4x3" +#define OPTION_USE_BACKGROUND "use_background" +#define OPTION_SKIP_BIOS_MENU "skip_biosmenu" +#define OPTION_SKIP_PARTS_MENU "skip_partsmenu" +#define OPTION_START_FILTER "start_filter" +#define OPTION_LAST_USED_FILTER "last_used_filter" +#define OPTION_LAST_USED_MACHINE "last_used_machine" +#define OPTION_INFO_AUTO_AUDIT "info_audit_enabled" + +// core UI options +#define OPTION_INFOS_SIZE "infos_text_size" +#define OPTION_FONT_ROWS "font_rows" +#define OPTION_HIDE_PANELS "hide_main_panel" + +#define OPTION_UI_BORDER_COLOR "ui_border_color" +#define OPTION_UI_BACKGROUND_COLOR "ui_bg_color" +#define OPTION_UI_GFXVIEWER_BG_COLOR "ui_gfxviewer_color" +#define OPTION_UI_UNAVAILABLE_COLOR "ui_unavail_color" +#define OPTION_UI_TEXT_COLOR "ui_text_color" +#define OPTION_UI_TEXT_BG_COLOR "ui_text_bg_color" +#define OPTION_UI_SUBITEM_COLOR "ui_subitem_color" +#define OPTION_UI_CLONE_COLOR "ui_clone_color" +#define OPTION_UI_SELECTED_COLOR "ui_selected_color" +#define OPTION_UI_SELECTED_BG_COLOR "ui_selected_bg_color" +#define OPTION_UI_MOUSEOVER_COLOR "ui_mouseover_color" +#define OPTION_UI_MOUSEOVER_BG_COLOR "ui_mouseover_bg_color" +#define OPTION_UI_MOUSEDOWN_COLOR "ui_mousedown_color" +#define OPTION_UI_MOUSEDOWN_BG_COLOR "ui_mousedown_bg_color" +#define OPTION_UI_DIPSW_COLOR "ui_dipsw_color" +#define OPTION_UI_SLIDER_COLOR "ui_slider_color" + +class mewui_options : public core_options +{ +public: + // construction/destruction + mewui_options(); + + // Search path options + const char *history_path() const { return value(OPTION_HISTORY_PATH); } + const char *extraini_path() const { return value(OPTION_EXTRAINI_PATH); } + const char *cabinets_directory() const { return value(OPTION_CABINETS_PATH); } + const char *cpanels_directory() const { return value(OPTION_CPANELS_PATH); } + const char *pcbs_directory() const { return value(OPTION_PCBS_PATH); } + const char *flyers_directory() const { return value(OPTION_FLYERS_PATH); } + const char *titles_directory() const { return value(OPTION_TITLES_PATH); } + const char *ends_directory() const { return value(OPTION_ENDS_PATH); } + const char *marquees_directory() const { return value(OPTION_MARQUEES_PATH); } + const char *artprev_directory() const { return value(OPTION_ARTPREV_PATH); } + const char *bosses_directory() const { return value(OPTION_BOSSES_PATH); } + const char *logos_directory() const { return value(OPTION_LOGOS_PATH); } + const char *scores_directory() const { return value(OPTION_SCORES_PATH); } + const char *versus_directory() const { return value(OPTION_VERSUS_PATH); } + const char *gameover_directory() const { return value(OPTION_GAMEOVER_PATH); } + const char *howto_directory() const { return value(OPTION_HOWTO_PATH); } + const char *select_directory() const { return value(OPTION_SELECT_PATH); } + const char *icons_directory() const { return value(OPTION_ICONS_PATH); } + const char *mewui_path() const { return value(OPTION_MEWUI_PATH); } + + // Misc options + bool enabled_dats() const { return bool_value(OPTION_DATS_ENABLED); } + bool remember_last() const { return bool_value(OPTION_REMEMBER_LAST); } + bool enlarge_snaps() const { return bool_value(OPTION_ENLARGE_SNAPS); } + bool forced_4x3_snapshot() const { return bool_value(OPTION_FORCED4X3); } + bool use_background_image() const { return bool_value(OPTION_USE_BACKGROUND); } + bool skip_bios_menu() const { return bool_value(OPTION_SKIP_BIOS_MENU); } + bool skip_parts_menu() const { return bool_value(OPTION_SKIP_PARTS_MENU); } + int start_filter() const { return int_value(OPTION_START_FILTER); } + const char *last_used_machine() const { return value(OPTION_LAST_USED_MACHINE); } + const char *last_used_filter() const { return value(OPTION_LAST_USED_FILTER); } + bool info_audit() const { return bool_value(OPTION_INFO_AUTO_AUDIT); } + + // UI options + float infos_size() const { return float_value(OPTION_INFOS_SIZE); } + int font_rows() const { return int_value(OPTION_FONT_ROWS); } + int hide_panels() const { return int_value(OPTION_HIDE_PANELS); } + + const char *ui_border_color() const { return value(OPTION_UI_BORDER_COLOR); } + const char *ui_bg_color() const { return value(OPTION_UI_BACKGROUND_COLOR); } + const char *ui_gfx_bg_color() const { return value(OPTION_UI_GFXVIEWER_BG_COLOR); } + const char *ui_unavail_color() const { return value(OPTION_UI_UNAVAILABLE_COLOR); } + const char *ui_text_color() const { return value(OPTION_UI_TEXT_COLOR); } + const char *ui_text_bg_color() const { return value(OPTION_UI_TEXT_BG_COLOR); } + const char *ui_subitem_color() const { return value(OPTION_UI_SUBITEM_COLOR); } + const char *ui_clone_color() const { return value(OPTION_UI_CLONE_COLOR); } + const char *ui_selected_color() const { return value(OPTION_UI_SELECTED_COLOR); } + const char *ui_selected_bg_color() const { return value(OPTION_UI_SELECTED_BG_COLOR); } + const char *ui_mouseover_color() const { return value(OPTION_UI_MOUSEOVER_COLOR); } + const char *ui_mouseover_bg_color() const { return value(OPTION_UI_MOUSEOVER_BG_COLOR); } + const char *ui_mousedown_color() const { return value(OPTION_UI_MOUSEDOWN_COLOR); } + const char *ui_mousedown_bg_color() const { return value(OPTION_UI_MOUSEDOWN_BG_COLOR); } + const char *ui_dipsw_color() const { return value(OPTION_UI_DIPSW_COLOR); } + const char *ui_slider_color() const { return value(OPTION_UI_SLIDER_COLOR); } + +private: + static const options_entry s_option_entries[]; +}; + +#endif /* __MEWUI_OPTS_H__ */ diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp new file mode 100644 index 00000000000..4902b496304 --- /dev/null +++ b/src/emu/ui/optsmenu.cpp @@ -0,0 +1,361 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/********************************************************************* + + mewui/optsmenu.cpp + + MEWUI main options menu manager. + +*********************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "ui/datfile.h" +#include "ui/inifile.h" +#include "ui/selector.h" +#include "ui/custui.h" +#include "ui/sndmenu.h" +#include "ui/ctrlmenu.h" +#include "ui/dsplmenu.h" +#include "ui/miscmenu.h" +#include "ui/optsmenu.h" +#include "ui/custmenu.h" +#include "ui/inputmap.h" +#include "rendfont.h" + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_menu_game_options::ui_menu_game_options(running_machine &machine, render_container *container) : ui_menu(machine, container) +{ +} + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_menu_game_options::~ui_menu_game_options() +{ + ui_menu::menu_stack->reset(UI_MENU_RESET_SELECT_FIRST); + save_game_options(machine()); + mewui_globals::switch_image = true; +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_game_options::handle() +{ + bool changed = false; + + // process the menu +// ui_menu::menu_stack->parent->process(UI_MENU_PROCESS_NOINPUT); +// const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT | UI_MENU_PROCESS_NOIMAGE); + const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT); + + if (m_event != nullptr && m_event->itemref != nullptr) + switch ((FPTR)m_event->itemref) + { + case FILTER_MENU: + { + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + (m_event->iptkey == IPT_UI_RIGHT) ? ++main_filters::actual : --main_filters::actual; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + { + int total = main_filters::length; + std::vector s_sel(total); + for (int index = 0; index < total; ++index) + s_sel[index] = main_filters::text[index]; + + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, main_filters::actual)); + } + break; + } + + case FILE_CATEGORY_FILTER: + { + if (m_event->iptkey == IPT_UI_LEFT) + { + machine().inifile().current_file--; + machine().inifile().current_category = 0; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT) + { + machine().inifile().current_file++; + machine().inifile().current_category = 0; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + { + inifile_manager &ifile = machine().inifile(); + int total = ifile.ini_index.size(); + std::vector s_sel(total); + machine().inifile().current_category = 0; + for (size_t index = 0; index < total; ++index) + s_sel[index] = ifile.ini_index[index].name; + + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, ifile.current_file, SELECTOR_INIFILE)); + } + break; + } + + case CATEGORY_FILTER: + { + if (m_event->iptkey == IPT_UI_LEFT) + { + machine().inifile().current_category--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_RIGHT) + { + machine().inifile().current_category++; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + { + inifile_manager &ifile = machine().inifile(); + int cfile = ifile.current_file; + int total = ifile.ini_index[cfile].category.size(); + std::vector s_sel(total); + for (int index = 0; index < total; ++index) + s_sel[index] = ifile.ini_index[cfile].category[index].name; + + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, ifile.current_category, SELECTOR_CATEGORY)); + } + break; + } + + case MANUFACT_CAT_FILTER: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + (m_event->iptkey == IPT_UI_RIGHT) ? c_mnfct::actual++ : c_mnfct::actual--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container, c_mnfct::ui, c_mnfct::actual)); + + break; + + case YEAR_CAT_FILTER: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + (m_event->iptkey == IPT_UI_RIGHT) ? c_year::actual++ : c_year::actual--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container, c_year::ui, c_year::actual)); + + break; + + case SCREEN_CAT_FILTER: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + (m_event->iptkey == IPT_UI_RIGHT) ? screen_filters::actual++ : screen_filters::actual--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + { + std::vector text(screen_filters::length); + for (int x = 0; x < screen_filters::length; ++x) + text[x] = screen_filters::text[x]; + + ui_menu::stack_push(global_alloc_clear(machine(), container, text, screen_filters::actual)); + } + + break; + + case MISC_MENU: + if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + break; + + case SOUND_MENU: + if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + break; + + case DISPLAY_MENU: + if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + break; + + case CUSTOM_MENU: + if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + break; + + case CONTROLLER_MENU: + if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + break; + + case CGI_MENU: + if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + break; + + case CUSTOM_FILTER: + if (m_event->iptkey == IPT_UI_SELECT) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + break; + + case UME_SYSTEM: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + (m_event->iptkey == IPT_UI_RIGHT) ? ume_filters::actual++ : ume_filters::actual--; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + { + int total = ume_filters::length; + std::vector s_sel(total); + for (int index = 0; index < total; ++index) + s_sel[index] = ume_filters::text[index]; + + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, ume_filters::actual)); + } + + break; + } + + if (changed) + reset(UI_MENU_RESET_REMEMBER_REF); +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_game_options::populate() +{ + // set filter arrow + std::string fbuff; + + // add filter item + UINT32 arrow_flags = get_arrow_flags(0, ume_filters::length - 1, ume_filters::actual); + item_append("Machine", ume_filters::text[ume_filters::actual], arrow_flags, (void *)(FPTR)UME_SYSTEM); + + // add filter item + arrow_flags = get_arrow_flags((int)FILTER_FIRST, (int)FILTER_LAST, main_filters::actual); + item_append("Filter", main_filters::text[main_filters::actual], arrow_flags, (void *)(FPTR)FILTER_MENU); + + // add category subitem + if (main_filters::actual == FILTER_CATEGORY && !machine().inifile().ini_index.empty()) + { + inifile_manager &inif = machine().inifile(); + int afile = inif.current_file; + + arrow_flags = get_arrow_flags(0, inif.ini_index.size() - 1, afile); + fbuff = " ^!File"; + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), inif.actual_file().c_str(), arrow_flags, (void *)(FPTR)FILE_CATEGORY_FILTER); + + arrow_flags = get_arrow_flags(0, inif.ini_index[afile].category.size() - 1, inif.current_category); + fbuff = " ^!Category"; + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), inif.actual_category().c_str(), arrow_flags, (void *)(FPTR)CATEGORY_FILTER); + } + // add manufacturer subitem + else if (main_filters::actual == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0) + { + arrow_flags = get_arrow_flags(0, c_mnfct::ui.size() - 1, c_mnfct::actual); + fbuff = "^!Manufacturer"; + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), c_mnfct::ui[c_mnfct::actual].c_str(), arrow_flags, (void *)(FPTR)MANUFACT_CAT_FILTER); + } + // add year subitem + else if (main_filters::actual == FILTER_YEAR && c_year::ui.size() > 0) + { + arrow_flags = get_arrow_flags(0, c_year::ui.size() - 1, c_year::actual); + fbuff.assign("^!Year"); + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), c_year::ui[c_year::actual].c_str(), arrow_flags, (void *)(FPTR)YEAR_CAT_FILTER); + } + // add screen subitem + else if (main_filters::actual == FILTER_SCREEN) + { + arrow_flags = get_arrow_flags(0, screen_filters::length - 1, screen_filters::actual); + fbuff = "^!Screen type"; + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), screen_filters::text[screen_filters::actual], arrow_flags, (void *)(FPTR)SCREEN_CAT_FILTER); + } + // add custom subitem + else if (main_filters::actual == FILTER_CUSTOM) + { + fbuff = "^!Setup custom filter"; + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), nullptr, 0, (void *)(FPTR)CUSTOM_FILTER); + } + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + // add options items + item_append("Customize UI", nullptr, 0, (void *)(FPTR)CUSTOM_MENU); + item_append("Display Options", nullptr, 0, (void *)(FPTR)DISPLAY_MENU); + item_append("Sound Options", nullptr, 0, (void *)(FPTR)SOUND_MENU); + item_append("Miscellaneous Options", nullptr, 0, (void *)(FPTR)MISC_MENU); + item_append("Device Mapping", nullptr, 0, (void *)(FPTR)CONTROLLER_MENU); + item_append("General Inputs", nullptr, 0, (void *)(FPTR)CGI_MENU); + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + custombottom = 2.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_game_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + mui.draw_text_full(container, "Settings", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + float maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, "Settings", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} + +//------------------------------------------------- +// save game options +//------------------------------------------------- + +void save_game_options(running_machine &machine) +{ + // attempt to open the output file + emu_file file(machine.options().ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + if (file.open(emulator_info::get_configname(), ".ini") == FILERR_NONE) + { + // generate the updated INI + std::string initext = machine.options().output_ini(); + file.puts(initext.c_str()); + file.close(); + } + else + machine.popmessage("**Error to save %s.ini**", emulator_info::get_configname()); +} diff --git a/src/emu/ui/optsmenu.h b/src/emu/ui/optsmenu.h new file mode 100644 index 00000000000..5838f5994b5 --- /dev/null +++ b/src/emu/ui/optsmenu.h @@ -0,0 +1,49 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/optsmenu.h + + MEWUI main options menu manager. + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_OPTSMENU_H__ +#define __MEWUI_OPTSMENU_H__ + +class ui_menu_game_options : public ui_menu +{ +public: + ui_menu_game_options(running_machine &machine, render_container *container); + virtual ~ui_menu_game_options(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + enum + { + FILTER_MENU = 1, + FILE_CATEGORY_FILTER, + MANUFACT_CAT_FILTER, + YEAR_CAT_FILTER, + SCREEN_CAT_FILTER, + CATEGORY_FILTER, + MISC_MENU, + DISPLAY_MENU, + CUSTOM_MENU, + SOUND_MENU, + CONTROLLER_MENU, + SAVE_OPTIONS, + CGI_MENU, + CUSTOM_FILTER, + UME_SYSTEM + }; +}; + +// save options to file +void save_game_options(running_machine &machine); + +#endif /* __MEWUI_OPTSMENU_H__ */ diff --git a/src/emu/ui/selector.cpp b/src/emu/ui/selector.cpp new file mode 100644 index 00000000000..5766cc14cb3 --- /dev/null +++ b/src/emu/ui/selector.cpp @@ -0,0 +1,244 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/********************************************************************* + + mewui/m_selector.cpp + + Internal MEWUI user interface. + +*********************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "ui/selector.h" +#include "ui/inifile.h" + +//------------------------------------------------- +// ctor / dtor +//------------------------------------------------- + +ui_menu_selector::ui_menu_selector(running_machine &machine, render_container *container, std::vector s_sel, UINT16 &s_actual, int category, int _hover) + : ui_menu(machine, container), m_selector(s_actual) +{ + m_category = category; + m_first_pass = true; + m_hover = _hover; + m_str_items = s_sel; + m_search[0] = '\0'; + m_searchlist[0] = nullptr; +} + +ui_menu_selector::~ui_menu_selector() +{ +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_selector::handle() +{ + // process the menu + const ui_menu_event *m_event = process(0); + + if (m_event != nullptr && m_event->itemref != nullptr) + { + if (m_event->iptkey == IPT_UI_SELECT) + { + for (size_t idx = 0; idx < m_str_items.size(); ++idx) + if ((void*)&m_str_items[idx] == m_event->itemref) + m_selector = idx; + + switch (m_category) + { + case SELECTOR_INIFILE: + machine().inifile().current_file = m_selector; + machine().inifile().current_category = 0; + ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF); + break; + + case SELECTOR_CATEGORY: + machine().inifile().current_category = m_selector; + ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF); + break; + + case SELECTOR_GAME: + main_filters::actual = m_hover; + ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST); + break; + + case SELECTOR_SOFTWARE: + sw_filters::actual = m_hover; + ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST); + break; + + default: + ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF); + break; + } + + mewui_globals::switch_image = true; + ui_menu::stack_pop(machine()); + } + else if (m_event->iptkey == IPT_SPECIAL) + { + int buflen = strlen(m_search); + + // if it's a backspace and we can handle it, do so + if ((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0) + { + *(char *)utf8_previous_char(&m_search[buflen]) = 0; + reset(UI_MENU_RESET_SELECT_FIRST); + } + + // if it's any other key and we're not maxed out, update + else if (m_event->unichar >= ' ' && m_event->unichar < 0x7f) + { + buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar); + m_search[buflen] = 0; + reset(UI_MENU_RESET_SELECT_FIRST); + } + } + + // escape pressed with non-empty text clears the text + else if (m_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0) + { + m_search[0] = '\0'; + reset(UI_MENU_RESET_SELECT_FIRST); + } + } +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_selector::populate() +{ + if (m_search[0] != 0) + { + find_matches(m_search); + + for (int curitem = 0; m_searchlist[curitem]; ++curitem) + item_append(m_searchlist[curitem]->c_str(), nullptr, 0, (void *)m_searchlist[curitem]); + } + else + { + for (size_t index = 0, added = 0; index < m_str_items.size(); ++index) + if (m_str_items[index] != "_skip_") + { + if (m_first_pass && m_selector == index) + selected = added; + + added++; + item_append(m_str_items[index].c_str(), nullptr, 0, (void *)&m_str_items[index]); + } + } + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + m_first_pass = false; +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + std::string tempbuf = std::string("Selection List - Search: ").append(m_search).append("_"); + + // get the size of the text + mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; + float maxwidth = MAX(width, origx2 - origx1); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + // bottom text + // get the text for 'UI Select' + std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)); + tempbuf.assign("Double click or press ").append(ui_select_text).append(" to select"); + + mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = origy2 + UI_BOX_TB_BORDER; + y2 = origy2 + bottom; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} + +//------------------------------------------------- +// find approximate matches +//------------------------------------------------- + +void ui_menu_selector::find_matches(const char *str) +{ + // allocate memory to track the penalty value + std::vector penalty(VISIBLE_GAMES_IN_SEARCH, 9999); + int index = 0; + + for (; index < m_str_items.size(); ++index) + { + if (m_str_items[index] == "_skip_") + continue; + + // pick the best match between driver name and description + int curpenalty = fuzzy_substring(str, m_str_items[index]); + + // insert into the sorted table of matches + for (int matchnum = VISIBLE_GAMES_IN_SEARCH - 1; matchnum >= 0; --matchnum) + { + // stop if we're worse than the current entry + if (curpenalty >= penalty[matchnum]) + break; + + // as long as this isn't the last entry, bump this one down + if (matchnum < VISIBLE_GAMES_IN_SEARCH - 1) + { + penalty[matchnum + 1] = penalty[matchnum]; + m_searchlist[matchnum + 1] = m_searchlist[matchnum]; + } + + m_searchlist[matchnum] = &m_str_items[index]; + penalty[matchnum] = curpenalty; + } + } + (index < VISIBLE_GAMES_IN_SEARCH) ? m_searchlist[index] = nullptr : m_searchlist[VISIBLE_GAMES_IN_SEARCH] = nullptr; +} diff --git a/src/emu/ui/selector.h b/src/emu/ui/selector.h new file mode 100644 index 00000000000..e8b68f57ba4 --- /dev/null +++ b/src/emu/ui/selector.h @@ -0,0 +1,51 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/selector.h + + Internal MEWUI user interface. + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_SELECTOR_H__ +#define __MEWUI_SELECTOR_H__ + +enum +{ + SELECTOR_INIFILE = 1, + SELECTOR_CATEGORY, + SELECTOR_GAME, + SELECTOR_SOFTWARE +}; + +//------------------------------------------------- +// class selector menu +//------------------------------------------------- + +class ui_menu_selector : public ui_menu +{ +public: + ui_menu_selector(running_machine &machine, render_container *container, std::vector _sel, UINT16 &_actual, int _category = 0, int _hover = 0); + virtual ~ui_menu_selector(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + + virtual bool menu_has_search_active() override { return (m_search[0] != 0); } + +private: + enum { VISIBLE_GAMES_IN_SEARCH = 200 }; + char m_search[40]; + UINT16 &m_selector; + int m_category, m_hover; + bool m_first_pass; + std::vector m_str_items; + std::string *m_searchlist[VISIBLE_GAMES_IN_SEARCH + 1]; + + void find_matches(const char *str); +}; + +#endif /* __MEWUI_SELECTOR_H__ */ diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 19af6e607d8..ba2b91a93e9 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -1,12 +1,12 @@ // license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods -/*************************************************************************** +// copyright-holders:Dankan1890 +/********************************************************************* - ui/selgame.c + mewui/selgame.cpp - Game selector + Main MEWUI menu. -***************************************************************************/ +*********************************************************************/ #include "emu.h" #include "emuopts.h" @@ -14,417 +14,974 @@ #include "ui/menu.h" #include "uiinput.h" #include "ui/selgame.h" -#include "ui/inputmap.h" #include "ui/miscmenu.h" #include "audit.h" -#include - +#include "ui/datfile.h" +#include "ui/inifile.h" +#include "rendfont.h" +#include "ui/datmenu.h" +#include "ui/dirmenu.h" +#include "ui/optsmenu.h" +#include "ui/selector.h" +#include "ui/selsoft.h" +#include "sound/samples.h" +#include "ui/custmenu.h" +#include "../info.h" +#include "ui/auditmenu.h" +#include "rendutil.h" +#include "softlist.h" +#include + +extern const char MEWUI_VERSION_TAG[]; + +static bool first_start = true; +static const char *dats_info[] = { "General Info", "History", "Mameinfo", "Sysinfo", "Messinfo", "Command", "Mamescore" }; //------------------------------------------------- -// ctor +// sort //------------------------------------------------- -ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_container *container, const char *gamename) : ui_menu(machine, container), m_driverlist(driver_list::total() + 1) +inline int c_stricmp(const char *s1, const char *s2) { - build_driver_list(); - if(gamename) - strcpy(m_search, gamename); - m_matchlist[0] = -1; + for (;;) + { + int c1 = tolower((UINT8)*s1++); + int c2 = tolower((UINT8)*s2++); + if (c1 == 0 || c1 != c2) + return c1 - c2; + } } +bool sort_game_list(const game_driver *x, const game_driver *y) +{ + bool clonex = strcmp(x->parent, "0"); + bool cloney = strcmp(y->parent, "0"); -//------------------------------------------------- -// dtor -//------------------------------------------------- + if (!clonex && !cloney) + return (c_stricmp(x->description, y->description) < 0); -ui_menu_select_game::~ui_menu_select_game() -{ -} + int cx = -1, cy = -1; + if (clonex) + { + cx = driver_list::find(x->parent); + if (cx == -1 || (driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0) + clonex = false; + } + if (cloney) + { + cy = driver_list::find(y->parent); + if (cy == -1 || (driver_list::driver(cy).flags & MACHINE_IS_BIOS_ROOT) != 0) + cloney = false; + } + if (!clonex && !cloney) + return (c_stricmp(x->description, y->description) < 0); + + else if (clonex && cloney) + { + if (!c_stricmp(x->parent, y->parent)) + return (c_stricmp(x->description, y->description) < 0); + else + return (c_stricmp(driver_list::driver(cx).description, driver_list::driver(cy).description) < 0); + } + else if (!clonex && cloney) + { + if (!c_stricmp(x->name, y->parent)) + return true; + else + return (c_stricmp(x->description, driver_list::driver(cy).description) < 0); + } + else + { + if (!c_stricmp(x->parent, y->name)) + return false; + else + return (c_stricmp(driver_list::driver(cx).description, y->description) < 0); + } +} //------------------------------------------------- -// build_driver_list - build a list of available -// drivers +// ctor //------------------------------------------------- -void ui_menu_select_game::build_driver_list() +ui_mewui_select_game::ui_mewui_select_game(running_machine &machine, render_container *container, const char *gamename) : ui_menu(machine, container) { - // start with an empty list - m_drivlist = std::make_unique(machine().options()); - m_drivlist->exclude_all(); + std::string error_string, last_filter, sub_filter; + emu_options &moptions = machine.options(); - // open a path to the ROMs and find them in the array - file_enumerator path(machine().options().media_path()); - const osd_directory_entry *dir; + // load drivers cache + load_cache_info(); - // iterate while we get new objects - while ((dir = path.next()) != nullptr) + // build drivers list + if (!load_available_machines()) + build_available_list(); + + // load custom filter + load_custom_filters(); + + if (first_start) { - char drivername[50]; - char *dst = drivername; - const char *src; + reselect_last::driver = moptions.last_used_machine(); + std::string tmp(moptions.last_used_filter()); + std::size_t found = tmp.find_first_of(","); + if (found == std::string::npos) + last_filter = tmp; + else + { + last_filter = tmp.substr(0, found); + sub_filter = tmp.substr(found + 1); + } - // build a name for it - for (src = dir->name; *src != 0 && *src != '.' && dst < &drivername[ARRAY_LENGTH(drivername) - 1]; src++) - *dst++ = tolower((UINT8)*src); - *dst = 0; + for (size_t ind = 0; ind < main_filters::length; ++ind) + if (last_filter == main_filters::text[ind]) + { + main_filters::actual = ind; + break; + } - int drivnum = m_drivlist->find(drivername); - if (drivnum != -1) - m_drivlist->include(drivnum); + if (main_filters::actual == FILTER_CATEGORY) + main_filters::actual = FILTER_ALL; + else if (main_filters::actual == FILTER_MANUFACTURER) + { + for (size_t id = 0; id < c_mnfct::ui.size(); ++id) + if (sub_filter == c_mnfct::ui[id]) + c_mnfct::actual = id; + } + else if (main_filters::actual == FILTER_YEAR) + { + for (size_t id = 0; id < c_year::ui.size(); ++id) + if (sub_filter == c_year::ui[id]) + c_year::actual = id; + } + else if (main_filters::actual == FILTER_SCREEN) + { + for (size_t id = 0; id < screen_filters::length; ++id) + if (sub_filter == screen_filters::text[id]) + screen_filters::actual = id; + } + first_start = false; } - // now build the final list - m_drivlist->reset(); - int listnum = 0; - while (m_drivlist->next()) - m_driverlist[listnum++] = &m_drivlist->driver(); + if (!moptions.remember_last()) + reselect_last::reset(); - // NULL-terminate - m_driverlist[listnum] = nullptr; + moptions.set_value(OPTION_SNAPNAME, "%g/%i", OPTION_PRIORITY_CMDLINE, error_string); + moptions.set_value(OPTION_SOFTWARENAME, "", OPTION_PRIORITY_CMDLINE, error_string); + + mewui_globals::curimage_view = FIRST_VIEW; + mewui_globals::curdats_view = MEWUI_FIRST_LOAD; + mewui_globals::switch_image = false; + mewui_globals::default_image = true; + ume_filters::actual = moptions.start_filter(); + mewui_globals::panels_status = moptions.hide_panels(); } +//------------------------------------------------- +// dtor +//------------------------------------------------- +ui_mewui_select_game::~ui_mewui_select_game() +{ + std::string error_string, last_driver; + const game_driver *driver = nullptr; + ui_software_info *swinfo = nullptr; + emu_options &mopt = machine().options(); + if (main_filters::actual == FILTER_FAVORITE_GAME) + swinfo = (selected >= 0 && selected < item.size()) ? (ui_software_info *)item[selected].ref : nullptr; + else + driver = (selected >= 0 && selected < item.size()) ? (const game_driver *)item[selected].ref : nullptr; + + if ((FPTR)driver > 2) + last_driver = driver->name; + + if ((FPTR)swinfo > 2) + last_driver = swinfo->shortname; + + std::string filter(main_filters::text[main_filters::actual]); + if (main_filters::actual == FILTER_MANUFACTURER) + filter.append(",").append(c_mnfct::ui[c_mnfct::actual]); + else if (main_filters::actual == FILTER_YEAR) + filter.append(",").append(c_year::ui[c_year::actual]); + else if (main_filters::actual == FILTER_SCREEN) + filter.append(",").append(screen_filters::text[screen_filters::actual]); + + mopt.set_value(OPTION_START_FILTER, ume_filters::actual, OPTION_PRIORITY_CMDLINE, error_string); + mopt.set_value(OPTION_LAST_USED_FILTER, filter.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + mopt.set_value(OPTION_LAST_USED_MACHINE, last_driver.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + mopt.set_value(OPTION_HIDE_PANELS, mewui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); + save_game_options(machine()); +} //------------------------------------------------- -// handle - handle the game select menu +// handle //------------------------------------------------- -void ui_menu_select_game::handle() +void ui_mewui_select_game::handle() { + bool check_filter = false; + bool enabled_dats = machine().options().enabled_dats(); + + // if i have to load datfile, performe an hard reset + if (mewui_globals::reset) + { + mewui_globals::reset = false; + machine().schedule_hard_reset(); + ui_menu::stack_reset(machine()); + return; + } + + // if i have to reselect a software, force software list submenu + if (reselect_last::get()) + { + const game_driver *driver = (const game_driver *)item[selected].ref; + ui_menu::stack_push(global_alloc_clear(machine(), container, driver)); + return; + } + // ignore pause keys by swallowing them before we process the menu machine().ui_input().pressed(IPT_UI_PAUSE); // process the menu - const ui_menu_event *menu_event = process(0); - if (menu_event != nullptr && menu_event->itemref != nullptr) + const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT); + if (m_event != nullptr && m_event->itemref != nullptr) { - // reset the error on any future menu_event - if (m_error) - m_error = false; + // reset the error on any future m_event + if (ui_error) + ui_error = false; // handle selections - else + else if (m_event->iptkey == IPT_UI_SELECT) + { + if (main_filters::actual != FILTER_FAVORITE_GAME) + inkey_select(m_event); + else + inkey_select_favorite(m_event); + } + + // handle UI_LEFT + else if (m_event->iptkey == IPT_UI_LEFT) { - switch(menu_event->iptkey) + // Images + if (mewui_globals::rpanel == RP_IMAGES && mewui_globals::curimage_view > FIRST_VIEW) { - case IPT_UI_SELECT: - inkey_select(menu_event); - break; - case IPT_UI_CANCEL: - inkey_cancel(menu_event); - break; - case IPT_SPECIAL: - inkey_special(menu_event); - break; + mewui_globals::curimage_view--; + mewui_globals::switch_image = true; + mewui_globals::default_image = false; + } + + // Infos + else if (mewui_globals::rpanel == RP_INFOS && mewui_globals::curdats_view > MEWUI_FIRST_LOAD) + { + mewui_globals::curdats_view--; + topline_datsview = 0; } } - } - // if we're in an error state, overlay an error message - if (m_error) - machine().ui().draw_text_box(container, - "The selected game is missing one or more required ROM or CHD images. " - "Please select a different game.\n\nPress any key to continue.", - JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); -} + // handle UI_RIGHT + else if (m_event->iptkey == IPT_UI_RIGHT) + { + // Images + if (mewui_globals::rpanel == RP_IMAGES && mewui_globals::curimage_view < LAST_VIEW) + { + mewui_globals::curimage_view++; + mewui_globals::switch_image = true; + mewui_globals::default_image = false; + } + // Infos + else if (mewui_globals::rpanel == RP_INFOS && mewui_globals::curdats_view < MEWUI_LAST_LOAD) + { + mewui_globals::curdats_view++; + topline_datsview = 0; + } + } -//------------------------------------------------- -// inkey_select -//------------------------------------------------- + // handle UI_UP_FILTER + else if (m_event->iptkey == IPT_UI_UP_FILTER && main_filters::actual > FILTER_FIRST) + { + l_hover = main_filters::actual - 1; + check_filter = true; + } -void ui_menu_select_game::inkey_select(const ui_menu_event *menu_event) -{ - const game_driver *driver = (const game_driver *)menu_event->itemref; + // handle UI_DOWN_FILTER + else if (m_event->iptkey == IPT_UI_DOWN_FILTER && main_filters::actual < FILTER_LAST) + { + l_hover = main_filters::actual + 1; + check_filter = true; + } - // special case for configure inputs - if ((FPTR)driver == 1) - ui_menu::stack_push(global_alloc_clear(machine(), container)); + // handle UI_LEFT_PANEL + else if (m_event->iptkey == IPT_UI_LEFT_PANEL) + mewui_globals::rpanel = RP_IMAGES; - // anything else is a driver - else - { - // audit the game first to see if we're going to work - driver_enumerator enumerator(machine().options(), *driver); - enumerator.next(); - media_auditor auditor(enumerator); - media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST); + // handle UI_RIGHT_PANEL + else if (m_event->iptkey == IPT_UI_RIGHT_PANEL) + mewui_globals::rpanel = RP_INFOS; - // if everything looks good, schedule the new driver - if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + // escape pressed with non-empty text clears the text + else if (m_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0) { - machine().manager().schedule_new_driver(*driver); - machine().schedule_hard_reset(); - ui_menu::stack_reset(machine()); + m_search[0] = '\0'; + reset(UI_MENU_RESET_SELECT_FIRST); } - // otherwise, display an error - else + // handle UI_HISTORY + else if (m_event->iptkey == IPT_UI_HISTORY && enabled_dats) { - reset(UI_MENU_RESET_REMEMBER_REF); - m_error = true; + if (main_filters::actual != FILTER_FAVORITE_GAME) + { + const game_driver *driver = (const game_driver *)m_event->itemref; + if ((FPTR)driver > 2) + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_HISTORY_LOAD, driver)); + } + else + { + ui_software_info *swinfo = (ui_software_info *)m_event->itemref; + if ((FPTR)swinfo > 2) + { + if (swinfo->startempty == 1) + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_HISTORY_LOAD, swinfo->driver)); + else + ui_menu::stack_push(global_alloc_clear(machine(), container, swinfo)); + } + } } - } -} + // handle UI_MAMEINFO + else if (m_event->iptkey == IPT_UI_MAMEINFO && enabled_dats) + { + if (main_filters::actual != FILTER_FAVORITE_GAME) + { + const game_driver *driver = (const game_driver *)m_event->itemref; + if ((FPTR)driver > 2) + { + if ((driver->flags & MACHINE_TYPE_ARCADE) != 0) + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MAMEINFO_LOAD, driver)); + else + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MESSINFO_LOAD, driver)); + } + } + else + { + ui_software_info *swinfo = (ui_software_info *)m_event->itemref; + if ((FPTR)swinfo > 2 && swinfo->startempty == 1) + { + if ((swinfo->driver->flags & MACHINE_TYPE_ARCADE) != 0) + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MAMEINFO_LOAD, swinfo->driver)); + else + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MESSINFO_LOAD, swinfo->driver)); + } + } + } -//------------------------------------------------- -// inkey_cancel -//------------------------------------------------- + // handle UI_STORY + else if (m_event->iptkey == IPT_UI_STORY && enabled_dats) + { + if (main_filters::actual != FILTER_FAVORITE_GAME) + { + const game_driver *driver = (const game_driver *)m_event->itemref; + if ((FPTR)driver > 2) + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_STORY_LOAD, driver)); + } + else + { + ui_software_info *swinfo = (ui_software_info *)m_event->itemref; + if ((FPTR)swinfo > 2 && swinfo->startempty == 1) + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_STORY_LOAD, swinfo->driver)); + } + } -void ui_menu_select_game::inkey_cancel(const ui_menu_event *menu_event) -{ - // escape pressed with non-empty text clears the text - if (m_search[0] != 0) - { - // since we have already been popped, we must recreate ourself from scratch - ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); - } -} + // handle UI_SYSINFO + else if (m_event->iptkey == IPT_UI_SYSINFO && enabled_dats) + { + if (main_filters::actual != FILTER_FAVORITE_GAME) + { + const game_driver *driver = (const game_driver *)m_event->itemref; + if ((FPTR)driver > 2) + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_SYSINFO_LOAD, driver)); + } + else + { + ui_software_info *swinfo = (ui_software_info *)m_event->itemref; + if ((FPTR)swinfo > 2 && swinfo->startempty == 1) + ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_SYSINFO_LOAD, swinfo->driver)); + } + } + // handle UI_COMMAND + else if (m_event->iptkey == IPT_UI_COMMAND && enabled_dats) + { + if (main_filters::actual != FILTER_FAVORITE_GAME) + { + const game_driver *driver = (const game_driver *)m_event->itemref; + if ((FPTR)driver > 2) + ui_menu::stack_push(global_alloc_clear(machine(), container, driver)); + } + else + { + ui_software_info *swinfo = (ui_software_info *)m_event->itemref; + if ((FPTR)swinfo > 2 && swinfo->startempty == 1) + ui_menu::stack_push(global_alloc_clear(machine(), container, swinfo->driver)); + } + } -//------------------------------------------------- -// inkey_special - typed characters append to the buffer -//------------------------------------------------- + // handle UI_FAVORITES + else if (m_event->iptkey == IPT_UI_FAVORITES) + { + if (main_filters::actual != FILTER_FAVORITE_GAME) + { + const game_driver *driver = (const game_driver *)m_event->itemref; + if ((FPTR)driver > 2) + { + if (!machine().favorite().isgame_favorite(driver)) + { + machine().favorite().add_favorite_game(driver); + machine().popmessage("%s\n added to favorites list.", driver->description); + } + + else + { + machine().favorite().remove_favorite_game(); + machine().popmessage("%s\n removed from favorites list.", driver->description); + } + } + } + else + { + ui_software_info *swinfo = (ui_software_info *)m_event->itemref; + if ((FPTR)swinfo > 2) + { + machine().popmessage("%s\n removed from favorites list.", swinfo->longname.c_str()); + machine().favorite().remove_favorite_game(*swinfo); + reset(UI_MENU_RESET_SELECT_FIRST); + } + } + } -void ui_menu_select_game::inkey_special(const ui_menu_event *menu_event) -{ - // typed characters append to the buffer - int buflen = strlen(m_search); + // handle UI_EXPORT + else if (m_event->iptkey == IPT_UI_EXPORT) + inkey_export(); - // if it's a backspace and we can handle it, do so - if ((menu_event->unichar == 8 || menu_event->unichar == 0x7f) && buflen > 0) - { - *(char *)utf8_previous_char(&m_search[buflen]) = 0; - m_rerandomize = true; - reset(UI_MENU_RESET_SELECT_FIRST); - } + // handle UI_AUDIT_FAST + else if (m_event->iptkey == IPT_UI_AUDIT_FAST && !m_unavailsortedlist.empty()) + ui_menu::stack_push(global_alloc_clear(machine(), container, m_availsortedlist, m_unavailsortedlist, 1)); - // if it's any other key and we're not maxed out, update - else if (menu_event->unichar >= ' ' && menu_event->unichar < 0x7f) - { - buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, menu_event->unichar); - m_search[buflen] = 0; - reset(UI_MENU_RESET_SELECT_FIRST); + // handle UI_AUDIT_ALL + else if (m_event->iptkey == IPT_UI_AUDIT_ALL) + ui_menu::stack_push(global_alloc_clear(machine(), container, m_availsortedlist, m_unavailsortedlist, 2)); + + // typed characters append to the buffer + else if (m_event->iptkey == IPT_SPECIAL) + inkey_special(m_event); + + else if (m_event->iptkey == IPT_OTHER) + check_filter = true; } -} + if (m_event != nullptr && m_event->itemref == nullptr) + { + if (m_event->iptkey == IPT_SPECIAL && m_event->unichar == 0x09) + selected = m_prev_selected; -//------------------------------------------------- -// populate - populate the game select menu -//------------------------------------------------- + // handle UI_UP_FILTER + else if (m_event->iptkey == IPT_UI_UP_FILTER && main_filters::actual > FILTER_FIRST) + { + l_hover = main_filters::actual - 1; + check_filter = true; + } -void ui_menu_select_game::populate() -{ - int matchcount; - int curitem; - - for (curitem = matchcount = 0; m_driverlist[curitem] != nullptr && matchcount < VISIBLE_GAMES_IN_LIST; curitem++) - if (!(m_driverlist[curitem]->flags & MACHINE_NO_STANDALONE)) - matchcount++; - - // if nothing there, add a single multiline item and return - if (matchcount == 0) - { - std::string txt; - strprintf(txt, "No %s found. Please check the rompath specified in the %s.ini file.\n\n" - "If this is your first time using %s, please see the config.txt file in " - "the docs directory for information on configuring %s.", - emulator_info::get_gamesnoun(), - emulator_info::get_configname(), - emulator_info::get_appname(),emulator_info::get_appname() ); - item_append(txt.c_str(), nullptr, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, nullptr); - return; + // handle UI_DOWN_FILTER + else if (m_event->iptkey == IPT_UI_DOWN_FILTER && main_filters::actual < FILTER_LAST) + { + l_hover = main_filters::actual + 1; + check_filter = true; + } + else if (m_event->iptkey == IPT_OTHER) + check_filter = true; } - // otherwise, rebuild the match list - assert(m_drivlist != nullptr); - if (m_search[0] != 0 || m_matchlist[0] == -1 || m_rerandomize) - m_drivlist->find_approximate_matches(m_search, matchcount, m_matchlist); - m_rerandomize = false; + // if we're in an error state, overlay an error message + if (ui_error) + machine().ui().draw_text_box(container, "The selected game is missing one or more required ROM or CHD images. " + "Please select a different game.\n\nPress any key (except ESC) to continue.", JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); - // iterate over entries - for (curitem = 0; curitem < matchcount; curitem++) + // handle filters selection from key shortcuts + if (check_filter) { - int curmatch = m_matchlist[curitem]; - if (curmatch != -1) + m_search[0] = '\0'; + if (l_hover == FILTER_CATEGORY) { - int cloneof = m_drivlist->non_bios_clone(curmatch); - item_append(m_drivlist->driver(curmatch).name, m_drivlist->driver(curmatch).description, (cloneof == -1) ? 0 : MENU_FLAG_INVERT, (void *)&m_drivlist->driver(curmatch)); + main_filters::actual = l_hover; + ui_menu::stack_push(global_alloc_clear(machine(), container)); } - } + else if (l_hover == FILTER_CUSTOM) + { + main_filters::actual = l_hover; + ui_menu::stack_push(global_alloc_clear(machine(), container, true)); + } + else if (l_hover == FILTER_MANUFACTURER) + ui_menu::stack_push(global_alloc_clear(machine(), container, c_mnfct::ui, c_mnfct::actual, SELECTOR_GAME, l_hover)); + else if (l_hover == FILTER_YEAR) + ui_menu::stack_push(global_alloc_clear(machine(), container, c_year::ui, c_year::actual, SELECTOR_GAME, l_hover)); + else if (l_hover == FILTER_SCREEN) + { + std::vector text(screen_filters::length); + for (int x = 0; x < screen_filters::length; ++x) + text[x] = screen_filters::text[x]; - // if we're forced into this, allow general input configuration as well - if (ui_menu::stack_has_special_main_menu()) - { - item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - item_append("Configure General Inputs", nullptr, 0, (void *)1); + ui_menu::stack_push(global_alloc_clear(machine(), container, text, screen_filters::actual, SELECTOR_GAME, l_hover)); + } + else + { + if (l_hover >= FILTER_ALL) + main_filters::actual = l_hover; + reset(UI_MENU_RESET_SELECT_FIRST); + } } - - // configure the custom rendering - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; - custombottom = 4.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } - //------------------------------------------------- -// custom_render - perform our special rendering +// populate //------------------------------------------------- -void ui_menu_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +void ui_mewui_select_game::populate() { - const game_driver *driver; - float width, maxwidth; - float x1, y1, x2, y2; - std::string tempbuf[5]; - rgb_t color; - int line; - - // display the current typeahead - if (m_search[0] != 0) - strprintf(tempbuf[0], "Type name or select: %s_", m_search); - else - strprintf(tempbuf[0],"Type name or select: (random)"); - - // get the size of the text - machine().ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); - width += 2 * UI_BOX_LR_BORDER; - maxwidth = MAX(width, origx2 - origx1); - - // compute our bounds - x1 = 0.5f - 0.5f * maxwidth; - x2 = x1 + maxwidth; - y1 = origy1 - top; - y2 = origy1 - UI_BOX_TB_BORDER; - - // draw a box - machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); - - // take off the borders - x1 += UI_BOX_LR_BORDER; - x2 -= UI_BOX_LR_BORDER; - y1 += UI_BOX_TB_BORDER; - - // draw the text within it - machine().ui().draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + mewui_globals::redraw_icon = true; + mewui_globals::switch_image = true; + int old_item_selected = -1; - // determine the text to render below - driver = ((FPTR)selectedref > 1) ? (const game_driver *)selectedref : nullptr; - if ((FPTR)driver > 1) + if (main_filters::actual != FILTER_FAVORITE_GAME) { - const char *gfxstat, *soundstat; + // if search is not empty, find approximate matches + if (m_search[0] != 0 && !no_active_search()) + populate_search(); + else + { + // reset search string + m_search[0] = '\0'; + m_displaylist.clear(); + m_tmp.clear(); - // first line is game name - strprintf(tempbuf[0],"%-.100s", driver->description); + // if filter is set on category, build category list + switch (main_filters::actual) + { + case FILTER_CATEGORY: + build_category(); + break; - // next line is year, manufacturer - strprintf(tempbuf[1], "%s, %-.100s", driver->year, driver->manufacturer); + case FILTER_MANUFACTURER: + build_list(m_tmp, c_mnfct::ui[c_mnfct::actual].c_str()); + break; - // next line source path - strprintf(tempbuf[2],"Driver: %-.100s", core_filename_extract_base(driver->source_file).c_str()); + case FILTER_YEAR: + build_list(m_tmp, c_year::ui[c_year::actual].c_str()); + break; - // next line is overall driver status - if (driver->flags & MACHINE_NOT_WORKING) - tempbuf[3].assign("Overall: NOT WORKING"); - else if (driver->flags & MACHINE_UNEMULATED_PROTECTION) - tempbuf[3].assign("Overall: Unemulated Protection"); - else - tempbuf[3].assign("Overall: Working"); + case FILTER_SCREEN: + case FILTER_STEREO: + case FILTER_SAMPLES: + case FILTER_NOSAMPLES: + case FILTER_CHD: + case FILTER_NOCHD: + build_from_cache(m_tmp, screen_filters::actual); + break; - // next line is graphics, sound status - if (driver->flags & (MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_COLORS)) - gfxstat = "Imperfect"; - else - gfxstat = "OK"; + case FILTER_CUSTOM: + build_custom(); + break; - if (driver->flags & MACHINE_NO_SOUND) - soundstat = "Unimplemented"; - else if (driver->flags & MACHINE_IMPERFECT_SOUND) - soundstat = "Imperfect"; - else - soundstat = "OK"; + default: + build_list(m_tmp); + break; + } - strprintf(tempbuf[4], "Gfx: %s, Sound: %s", gfxstat, soundstat); + // iterate over entries + for (size_t curitem = 0; curitem < m_displaylist.size(); ++curitem) + { + UINT32 flags_mewui = MENU_FLAG_MEWUI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; + + if (old_item_selected == -1 && !reselect_last::driver.empty() && m_displaylist[curitem]->name == reselect_last::driver) + old_item_selected = curitem; + + bool cloneof = strcmp(m_displaylist[curitem]->parent, "0"); + if (cloneof) + { + int cx = driver_list::find(m_displaylist[curitem]->parent); + if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0)) + cloneof = false; + } + if (cloneof) + flags_mewui |= MENU_FLAG_INVERT; + + item_append(m_displaylist[curitem]->description, nullptr, flags_mewui, (void *)m_displaylist[curitem]); + } + } } + // populate favorites list else { - const char *s = emulator_info::get_copyright(); - line = 0; - - // first line is version string - strprintf(tempbuf[line++], "%s %s", emulator_info::get_appname(), build_version); - - // output message - while (line < ARRAY_LENGTH(tempbuf)) + m_search[0] = '\0'; + int curitem = 0; + // iterate over entries + for (auto & mfavorite : machine().favorite().m_list) { - if (!(*s == 0 || *s == '\n')) - tempbuf[line].push_back(*s); - - if (*s == '\n') + UINT32 flags_mewui = MENU_FLAG_MEWUI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW | MENU_FLAG_MEWUI_FAVORITE; + if (mfavorite.startempty == 1) { - line++; - s++; - } else if (*s != 0) - s++; + if (old_item_selected == -1 && !reselect_last::driver.empty() && mfavorite.shortname == reselect_last::driver) + old_item_selected = curitem; + + bool cloneof = strcmp(mfavorite.driver->parent, "0"); + if (cloneof) + { + int cx = driver_list::find(mfavorite.driver->parent); + if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0)) + cloneof = false; + } + if (cloneof) + flags_mewui |= MENU_FLAG_INVERT; + + item_append(mfavorite.longname.c_str(), nullptr, flags_mewui, (void *)&mfavorite); + } else - line++; + { + if (old_item_selected == -1 && !reselect_last::driver.empty() && mfavorite.shortname == reselect_last::driver) + old_item_selected = curitem; + item_append(mfavorite.longname.c_str(), mfavorite.devicetype.c_str(), + mfavorite.parentname.empty() ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), (void *)&mfavorite); + } + curitem++; } } - // get the size of the text - maxwidth = origx2 - origx1; - for (line = 0; line < 4; line++) - { - machine().ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); - width += 2 * UI_BOX_LR_BORDER; - maxwidth = MAX(maxwidth, width); - } + // add special items + item_append(MENU_SEPARATOR_ITEM, nullptr, MENU_FLAG_MEWUI, nullptr); + item_append("Configure Options", nullptr, MENU_FLAG_MEWUI, (void *)(FPTR)1); + item_append("Configure Directories", nullptr, MENU_FLAG_MEWUI, (void *)(FPTR)2); - // compute our bounds + // configure the custom rendering + customtop = 3.0f * machine().ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER; + custombottom = 5.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + + // reselect prior game launched, if any + if (old_item_selected != -1) + { + selected = old_item_selected; + if (mewui_globals::visible_main_lines == 0) + top_line = (selected != 0) ? selected - 1 : 0; + else + top_line = selected - (mewui_globals::visible_main_lines / 2); + + if (reselect_last::software.empty()) + reselect_last::reset(); + } + else + reselect_last::reset(); +} + +//------------------------------------------------- +// build a list of available drivers +//------------------------------------------------- + +void ui_mewui_select_game::build_available_list() +{ + int m_total = driver_list::total(); + std::vector m_included(m_total, false); + + // open a path to the ROMs and find them in the array + file_enumerator path(machine().options().media_path()); + const osd_directory_entry *dir; + + // iterate while we get new objects + while ((dir = path.next()) != nullptr) + { + char drivername[50]; + char *dst = drivername; + const char *src; + + // build a name for it + for (src = dir->name; *src != 0 && *src != '.' && dst < &drivername[ARRAY_LENGTH(drivername) - 1]; ++src) + *dst++ = tolower((UINT8) * src); + + *dst = 0; + int drivnum = driver_list::find(drivername); + if (drivnum != -1 && !m_included[drivnum]) + { + m_availsortedlist.push_back(&driver_list::driver(drivnum)); + m_included[drivnum] = true; + } + } + + // now check and include NONE_NEEDED + for (int x = 0; x < m_total; ++x) + if (!m_included[x]) + { + if (&driver_list::driver(x) == &GAME_NAME(___empty)) + continue; + + const rom_entry *rom = driver_list::driver(x).rom; + if (ROMENTRY_ISREGION(rom) && ROMENTRY_ISEND(++rom)) + { + m_availsortedlist.push_back(&driver_list::driver(x)); + m_included[x] = true; + } + } + + // sort + std::stable_sort(m_availsortedlist.begin(), m_availsortedlist.end(), sort_game_list); + + // now build the unavailable list + for (int x = 0; x < m_total; ++x) + if (!m_included[x] && &driver_list::driver(x) != &GAME_NAME(___empty)) + m_unavailsortedlist.push_back(&driver_list::driver(x)); + + // sort + std::stable_sort(m_unavailsortedlist.begin(), m_unavailsortedlist.end(), sort_game_list); +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_mewui_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + const game_driver *driver = nullptr; + ui_software_info *swinfo = nullptr; + float width, maxwidth = origx2 - origx1; + std::string tempbuf[5]; + rgb_t color = UI_BACKGROUND_COLOR; + bool isstar = false; + ui_manager &mui = machine().ui(); + float tbarspace = mui.get_line_height(); + + if (ume_filters::actual == MEWUI_MAME) + strprintf(tempbuf[0], "MAME %s ( %d / %d machines (%d BIOS) )", bare_build_version, visible_items, (driver_list::total() - 1), m_isabios + m_issbios); + else if (ume_filters::actual == MEWUI_ARCADES) + strprintf(tempbuf[0], "MAME %s ( %d / %d arcades (%d BIOS) )", bare_build_version, visible_items, m_isarcades, m_isabios); + else if (ume_filters::actual == MEWUI_SYSTEMS) + strprintf(tempbuf[0], "MAME %s ( %d / %d systems (%d BIOS) )", bare_build_version, visible_items, m_issystems, m_issbios); + + std::string filtered; + + if (main_filters::actual == FILTER_CATEGORY && !machine().inifile().ini_index.empty()) + { + std::string s_file(machine().inifile().actual_file()); + std::string s_category(machine().inifile().actual_category()); + filtered.assign(main_filters::text[main_filters::actual]).append(" (").append(s_file).append(" - ").append(s_category).append(") -"); + } + + else if (main_filters::actual == FILTER_MANUFACTURER) + filtered.assign(main_filters::text[main_filters::actual]).append(" (").append(c_mnfct::ui[c_mnfct::actual]).append(") -"); + + else if (main_filters::actual == FILTER_YEAR) + filtered.assign(main_filters::text[main_filters::actual]).append(" (").append(c_year::ui[c_year::actual]).append(") -"); + + else if (main_filters::actual == FILTER_SCREEN) + filtered.assign(main_filters::text[main_filters::actual]).append(" (").append(screen_filters::text[screen_filters::actual]).append(") -"); + + // display the current typeahead + if (no_active_search()) + tempbuf[1].clear(); + else + tempbuf[1].assign(filtered).append(" Search: ").append(m_search).append("_"); + + // get the size of the text + for (int line = 0; line < 2; ++line) + { + mui.draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(width, maxwidth); + } + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - 3.0f * UI_BOX_TB_BORDER - tbarspace; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + for (int line = 0; line < 2; ++line) + { + mui.draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + y1 += mui.get_line_height(); + } + + // draw ume box + x1 -= UI_BOX_LR_BORDER; + y1 = origy1 - top; + draw_ume_box(x1, y1, x2, y2); + + // determine the text to render below + if (main_filters::actual != FILTER_FAVORITE_GAME) + driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr; + else + { + swinfo = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr; + if (swinfo && swinfo->startempty == 1) + driver = swinfo->driver; + } + + if ((FPTR)driver > 2) + { + isstar = machine().favorite().isgame_favorite(driver); + + // first line is game name + strprintf(tempbuf[0], "Romset: %-.100s", driver->name); + + // next line is year, manufacturer + strprintf(tempbuf[1], "%s, %-.100s", driver->year, driver->manufacturer); + + // next line is clone/parent status + int cloneof = driver_list::non_bios_clone(*driver); + + if (cloneof != -1) + strprintf(tempbuf[2], "Driver is clone of: %-.100s", driver_list::driver(cloneof).description); + else + tempbuf[2] = "Driver is parent"; + + // next line is overall driver status + if (driver->flags & MACHINE_NOT_WORKING) + tempbuf[3] = "Overall: NOT WORKING"; + else if (driver->flags & MACHINE_UNEMULATED_PROTECTION) + tempbuf[3] = "Overall: Unemulated Protection"; + else + tempbuf[3] = "Overall: Working"; + + // next line is graphics, sound status + if (driver->flags & (MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_COLORS)) + tempbuf[4] = "Graphics: Imperfect, "; + else + tempbuf[4] = "Graphics: OK, "; + + if (driver->flags & MACHINE_NO_SOUND) + tempbuf[4].append("Sound: Unimplemented"); + else if (driver->flags & MACHINE_IMPERFECT_SOUND) + tempbuf[4].append("Sound: Imperfect"); + else + tempbuf[4].append("Sound: OK"); + + color = UI_GREEN_COLOR; + + if ((driver->flags & (MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_COLORS + | MACHINE_NO_SOUND | MACHINE_IMPERFECT_SOUND)) != 0) + color = UI_YELLOW_COLOR; + + if ((driver->flags & (MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION)) != 0) + color = UI_RED_COLOR; + } + + else if ((FPTR)swinfo > 2) + { + isstar = machine().favorite().isgame_favorite(*swinfo); + + // first line is system + strprintf(tempbuf[0], "System: %-.100s", swinfo->driver->description); + + // next line is year, publisher + strprintf(tempbuf[1], "%s, %-.100s", swinfo->year.c_str(), swinfo->publisher.c_str()); + + // next line is parent/clone + if (!swinfo->parentname.empty()) + strprintf(tempbuf[2], "Software is clone of: %-.100s", !swinfo->parentlongname.empty() ? swinfo->parentlongname.c_str() : swinfo->parentname.c_str()); + else + tempbuf[2] = "Software is parent"; + + // next line is supported status + if (swinfo->supported == SOFTWARE_SUPPORTED_NO) + { + tempbuf[3] = "Supported: No"; + color = UI_RED_COLOR; + } + else if (swinfo->supported == SOFTWARE_SUPPORTED_PARTIAL) + { + tempbuf[3] = "Supported: Partial"; + color = UI_YELLOW_COLOR; + } + else + { + tempbuf[3] = "Supported: Yes"; + color = UI_GREEN_COLOR; + } + + // last line is romset name + strprintf(tempbuf[4], "romset: %-.100s", swinfo->shortname.c_str()); + } + else + { + std::string copyright(emulator_info::get_copyright()); + size_t found = copyright.find("\n"); + tempbuf[0].clear(); + tempbuf[1].assign(emulator_info::get_appname()).append(" ").append(build_version); + tempbuf[2] = copyright.substr(0, found); + tempbuf[3] = copyright.substr(found + 1); + tempbuf[4].clear(); + } + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = y2; + y2 = origy1 - UI_BOX_TB_BORDER; + + // draw toolbar + draw_toolbar(x1, y1, x2, y2); + + // get the size of the text + maxwidth = origx2 - origx1; + + for (auto & elem : tempbuf) + { + mui.draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + } + + // compute our bounds x1 = 0.5f - 0.5f * maxwidth; x2 = x1 + maxwidth; y1 = origy2 + UI_BOX_TB_BORDER; y2 = origy2 + bottom; // draw a box - color = UI_BACKGROUND_COLOR; - if (driver != nullptr) - color = UI_GREEN_COLOR; - if (driver != nullptr && (driver->flags & (MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_COLORS | MACHINE_NO_SOUND | MACHINE_IMPERFECT_SOUND)) != 0) - color = UI_YELLOW_COLOR; - if (driver != nullptr && (driver->flags & (MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION)) != 0) - color = UI_RED_COLOR; - machine().ui().draw_outlined_box(container, x1, y1, x2, y2, color); + mui.draw_outlined_box(container, x1, y1, x2, y2, color); // take off the borders x1 += UI_BOX_LR_BORDER; x2 -= UI_BOX_LR_BORDER; y1 += UI_BOX_TB_BORDER; + // is favorite? draw the star + if (isstar) + draw_star(x1, y1); + // draw all lines - for (line = 0; line < 4; line++) + for (auto & elem : tempbuf) { - machine().ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - y1 += machine().ui().get_line_height(); + mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + y1 += mui.get_line_height(); } } - //------------------------------------------------- -// force_game_select - force the game -// select menu to be visible and inescapable +// force the game select menu to be visible +// and inescapable //------------------------------------------------- -void ui_menu_select_game::force_game_select(running_machine &machine, render_container *container) +void ui_mewui_select_game::force_game_select(running_machine &machine, render_container *container) { - char *gamename = (char *)machine.options().system_name(); - // reset the menu stack ui_menu::stack_reset(machine); @@ -432,7 +989,7 @@ void ui_menu_select_game::force_game_select(running_machine &machine, render_con ui_menu *quit = global_alloc_clear(machine, container); quit->set_special_main_menu(true); ui_menu::stack_push(quit); - ui_menu::stack_push(global_alloc_clear(machine, container, gamename)); + ui_menu::stack_push(global_alloc_clear(machine, container, nullptr)); // force the menus on machine.ui().show_menu(); @@ -440,3 +997,1614 @@ void ui_menu_select_game::force_game_select(running_machine &machine, render_con // make sure MAME is paused machine.pause(); } + +//------------------------------------------------- +// handle select key event +//------------------------------------------------- + +void ui_mewui_select_game::inkey_select(const ui_menu_event *m_event) +{ + const game_driver *driver = (const game_driver *)m_event->itemref; + + // special case for configure options + if ((FPTR)driver == 1) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + // special case for configure directory + else if ((FPTR)driver == 2) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + // anything else is a driver + else + { + // audit the game first to see if we're going to work + driver_enumerator enumerator(machine().options(), *driver); + enumerator.next(); + media_auditor auditor(enumerator); + media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST); + + // if everything looks good, schedule the new driver + if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + { + if ((driver->flags & MACHINE_TYPE_ARCADE) == 0) + { + software_list_device_iterator iter(enumerator.config().root_device()); + for (software_list_device *swlistdev = iter.first(); swlistdev != nullptr; swlistdev = iter.next()) + if (swlistdev->first_software_info() != nullptr) + { + ui_menu::stack_push(global_alloc_clear(machine(), container, driver)); + return; + } + } + + std::vector biosname; + if (!machine().options().skip_bios_menu() && has_multiple_bios(driver, biosname)) + ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)driver, false, false)); + else + { + reselect_last::driver = driver->name; + reselect_last::software.clear(); + reselect_last::swlist.clear(); + machine().manager().schedule_new_driver(*driver); + machine().schedule_hard_reset(); + ui_menu::stack_reset(machine()); + } + } + // otherwise, display an error + else + { + reset(UI_MENU_RESET_REMEMBER_REF); + ui_error = true; + } + } +} + +//------------------------------------------------- +// handle select key event for favorites menu +//------------------------------------------------- + +void ui_mewui_select_game::inkey_select_favorite(const ui_menu_event *m_event) +{ + ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; + emu_options &mopt = machine().options(); + + // special case for configure options + if ((FPTR)ui_swinfo == 1) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + + // special case for configure directory + else if ((FPTR)ui_swinfo == 2) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + + else if (ui_swinfo->startempty == 1) + { + // audit the game first to see if we're going to work + driver_enumerator enumerator(mopt, *ui_swinfo->driver); + enumerator.next(); + media_auditor auditor(enumerator); + media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST); + + // if everything looks good, schedule the new driver + if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + { + std::vector biosname; + if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) + ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo->driver, false, false)); + else + { + reselect_last::driver = ui_swinfo->driver->name; + reselect_last::software.clear(); + reselect_last::swlist.clear(); + reselect_last::set(true); + machine().manager().schedule_new_driver(*ui_swinfo->driver); + machine().schedule_hard_reset(); + ui_menu::stack_reset(machine()); + } + } + + // otherwise, display an error + else + { + reset(UI_MENU_RESET_REMEMBER_REF); + ui_error = true; + } + } + else + { + // first validate + driver_enumerator drv(mopt, *ui_swinfo->driver); + media_auditor auditor(drv); + drv.next(); + software_list_device *swlist = software_list_device::find_by_name(drv.config(), ui_swinfo->listname.c_str()); + software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); + media_auditor::summary summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST); + if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + { + std::vector biosname; + if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) + { + ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo, true, false)); + return; + } + else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) + { + std::unordered_map parts; + for (const software_part *swpart = swinfo->first_part(); swpart != nullptr; swpart = swpart->next()) + { + if (swpart->matches_interface(ui_swinfo->interface.c_str())) + { + std::string menu_part_name(swpart->name()); + if (swpart->feature("part_id") != nullptr) + menu_part_name.assign("(").append(swpart->feature("part_id")).append(")"); + parts.emplace(swpart->name(), menu_part_name); + } + } + ui_menu::stack_push(global_alloc_clear(machine(), container, parts, ui_swinfo)); + return; + } + + std::string error_string; + std::string string_list = std::string(ui_swinfo->listname).append(":").append(ui_swinfo->shortname).append(":").append(ui_swinfo->part).append(":").append(ui_swinfo->instance); + mopt.set_value(OPTION_SOFTWARENAME, string_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + std::string snap_list = std::string(ui_swinfo->listname).append(PATH_SEPARATOR).append(ui_swinfo->shortname); + mopt.set_value(OPTION_SNAPNAME, snap_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + reselect_last::driver = drv.driver().name; + reselect_last::software = ui_swinfo->shortname; + reselect_last::swlist = ui_swinfo->listname; + machine().manager().schedule_new_driver(drv.driver()); + machine().schedule_hard_reset(); + ui_menu::stack_reset(machine()); + } + // otherwise, display an error + else + { + reset(UI_MENU_RESET_REMEMBER_POSITION); + ui_error = true; + } + } +} + +//------------------------------------------------- +// returns if the search can be activated +//------------------------------------------------- + +inline bool ui_mewui_select_game::no_active_search() +{ + return (main_filters::actual == FILTER_FAVORITE_GAME); +} + +//------------------------------------------------- +// handle special key event +//------------------------------------------------- + +void ui_mewui_select_game::inkey_special(const ui_menu_event *m_event) +{ + int buflen = strlen(m_search); + + // if it's a backspace and we can handle it, do so + if (((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0) && !no_active_search()) + { + *(char *)utf8_previous_char(&m_search[buflen]) = 0; + reset(UI_MENU_RESET_SELECT_FIRST); + } + + // if it's any other key and we're not maxed out, update + else if ((m_event->unichar >= ' ' && m_event->unichar < 0x7f) && !no_active_search()) + { + buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar); + m_search[buflen] = 0; + reset(UI_MENU_RESET_SELECT_FIRST); + } + + // Tab key + else if (m_event->unichar == 0x09) + { + // if the selection is in the main screen, save and go to submenu + if (selected <= visible_items) + { + m_prev_selected = selected; + selected = visible_items + 1; + } + + // otherwise, retrieve the previous position + else + selected = m_prev_selected; + } +} + +//------------------------------------------------- +// build list +//------------------------------------------------- + +void ui_mewui_select_game::build_list(std::vector &s_drivers, const char *filter_text, int filter, bool bioscheck) +{ + int cx = 0; + bool cloneof = false; + + if (s_drivers.empty()) + { + filter = main_filters::actual; + if (filter == FILTER_AVAILABLE) + s_drivers = m_availsortedlist; + else if (filter == FILTER_UNAVAILABLE) + s_drivers = m_unavailsortedlist; + else + s_drivers = m_sortedlist; + } + + for (auto & s_driver : s_drivers) + { + if (!bioscheck && filter != FILTER_BIOS && (s_driver->flags & MACHINE_IS_BIOS_ROOT) != 0) + continue; + + if ((s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_SYSTEMS) + continue; + + if (!(s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_ARCADES) + continue; + + switch (filter) + { + case FILTER_ALL: + case FILTER_AVAILABLE: + case FILTER_UNAVAILABLE: + m_displaylist.push_back(s_driver); + break; + + case FILTER_WORKING: + if (!(s_driver->flags & MACHINE_NOT_WORKING)) + m_displaylist.push_back(s_driver); + break; + + case FILTER_NOT_MECHANICAL: + if (!(s_driver->flags & MACHINE_MECHANICAL)) + m_displaylist.push_back(s_driver); + break; + + case FILTER_BIOS: + if (s_driver->flags & MACHINE_IS_BIOS_ROOT) + m_displaylist.push_back(s_driver); + break; + + case FILTER_PARENT: + case FILTER_CLONES: + cloneof = strcmp(s_driver->parent, "0"); + if (cloneof) + { + cx = driver_list::find(s_driver->parent); + if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0)) + cloneof = false; + } + + if (filter == FILTER_CLONES && cloneof) + m_displaylist.push_back(s_driver); + else if (filter == FILTER_PARENT && !cloneof) + m_displaylist.push_back(s_driver); + break; + + case FILTER_NOT_WORKING: + if (s_driver->flags & MACHINE_NOT_WORKING) + m_displaylist.push_back(s_driver); + break; + + case FILTER_MECHANICAL: + if (s_driver->flags & MACHINE_MECHANICAL) + m_displaylist.push_back(s_driver); + break; + + case FILTER_SAVE: + if (s_driver->flags & MACHINE_SUPPORTS_SAVE) + m_displaylist.push_back(s_driver); + break; + + case FILTER_NOSAVE: + if (!(s_driver->flags & MACHINE_SUPPORTS_SAVE)) + m_displaylist.push_back(s_driver); + break; + + case FILTER_YEAR: + if (!core_stricmp(filter_text, s_driver->year)) + m_displaylist.push_back(s_driver); + break; + + case FILTER_VERTICAL: + if (s_driver->flags & ORIENTATION_SWAP_XY) + m_displaylist.push_back(s_driver); + break; + + case FILTER_HORIZONTAL: + if (!(s_driver->flags & ORIENTATION_SWAP_XY)) + m_displaylist.push_back(s_driver); + break; + + case FILTER_MANUFACTURER: + { + std::string name = c_mnfct::getname(s_driver->manufacturer); + if (!core_stricmp(filter_text, name.c_str())) + m_displaylist.push_back(s_driver); + break; + } + } + } +} + +//------------------------------------------------- +// build custom display list +//------------------------------------------------- + +void ui_mewui_select_game::build_custom() +{ + std::vector s_drivers; + bool bioscheck = false; + + if (custfltr::main == FILTER_AVAILABLE) + s_drivers = m_availsortedlist; + else if (custfltr::main == FILTER_UNAVAILABLE) + s_drivers = m_unavailsortedlist; + else + s_drivers = m_sortedlist; + + for (auto & elem : s_drivers) + { + if ((elem->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_SYSTEMS) + continue; + + if (!(elem->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_ARCADES) + continue; + + m_displaylist.push_back(elem); + } + + for (int count = 1; count <= custfltr::numother; ++count) + { + int filter = custfltr::other[count]; + if (filter == FILTER_BIOS) + bioscheck = true; + } + + for (int count = 1; count <= custfltr::numother; ++count) + { + int filter = custfltr::other[count]; + s_drivers = m_displaylist; + m_displaylist.clear(); + + switch (filter) + { + case FILTER_YEAR: + build_list(s_drivers, c_year::ui[custfltr::year[count]].c_str(), filter, bioscheck); + break; + case FILTER_MANUFACTURER: + build_list(s_drivers, c_mnfct::ui[custfltr::mnfct[count]].c_str(), filter, bioscheck); + break; + case FILTER_SCREEN: + build_from_cache(s_drivers, custfltr::screen[count], filter, bioscheck); + break; + case FILTER_CHD: + case FILTER_NOCHD: + case FILTER_SAMPLES: + case FILTER_NOSAMPLES: + case FILTER_STEREO: + build_from_cache(s_drivers, 0, filter, bioscheck); + break; + default: + build_list(s_drivers, nullptr, filter, bioscheck); + break; + } + } +} + +//------------------------------------------------- +// build category list +//------------------------------------------------- + +void ui_mewui_select_game::build_category() +{ + std::vector temp_filter; + machine().inifile().load_ini_category(temp_filter); + + for (auto actual : temp_filter) + m_tmp.push_back(&driver_list::driver(actual)); + + std::stable_sort(m_tmp.begin(), m_tmp.end(), sort_game_list); + m_displaylist = m_tmp; +} + +//------------------------------------------------- +// build list from cache +//------------------------------------------------- + +void ui_mewui_select_game::build_from_cache(std::vector &s_drivers, int screens, int filter, bool bioscheck) +{ + if (s_drivers.empty()) + { + s_drivers = m_sortedlist; + filter = main_filters::actual; + } + + for (auto & s_driver : s_drivers) + { + if (!bioscheck && filter != FILTER_BIOS && (s_driver->flags & MACHINE_IS_BIOS_ROOT) != 0) + continue; + + if ((s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_SYSTEMS) + continue; + + if (!(s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_ARCADES) + continue; + + int idx = driver_list::find(s_driver->name); + + switch (filter) + { + case FILTER_SCREEN: + if (driver_cache[idx].b_screen == screens) + m_displaylist.push_back(s_driver); + break; + + case FILTER_SAMPLES: + if (driver_cache[idx].b_samples) + m_displaylist.push_back(s_driver); + break; + + case FILTER_NOSAMPLES: + if (!driver_cache[idx].b_samples) + m_displaylist.push_back(s_driver); + break; + + case FILTER_STEREO: + if (driver_cache[idx].b_stereo) + m_displaylist.push_back(s_driver); + break; + + case FILTER_CHD: + if (driver_cache[idx].b_chd) + m_displaylist.push_back(s_driver); + break; + + case FILTER_NOCHD: + if (!driver_cache[idx].b_chd) + m_displaylist.push_back(s_driver); + break; + } + } +} + +//------------------------------------------------- +// populate search list +//------------------------------------------------- + +void ui_mewui_select_game::populate_search() +{ + // allocate memory to track the penalty value + std::vector penalty(VISIBLE_GAMES_IN_SEARCH, 9999); + int index = 0; + for (; index < m_displaylist.size(); ++index) + { + // pick the best match between driver name and description + int curpenalty = fuzzy_substring(m_search, m_displaylist[index]->description); + int tmp = fuzzy_substring(m_search, m_displaylist[index]->name); + curpenalty = MIN(curpenalty, tmp); + + // insert into the sorted table of matches + for (int matchnum = VISIBLE_GAMES_IN_SEARCH - 1; matchnum >= 0; --matchnum) + { + // stop if we're worse than the current entry + if (curpenalty >= penalty[matchnum]) + break; + + // as long as this isn't the last entry, bump this one down + if (matchnum < VISIBLE_GAMES_IN_SEARCH - 1) + { + penalty[matchnum + 1] = penalty[matchnum]; + m_searchlist[matchnum + 1] = m_searchlist[matchnum]; + } + + m_searchlist[matchnum] = m_displaylist[index]; + penalty[matchnum] = curpenalty; + } + } + + (index < VISIBLE_GAMES_IN_SEARCH) ? m_searchlist[index] = nullptr : m_searchlist[VISIBLE_GAMES_IN_SEARCH] = nullptr; + UINT32 flags_mewui = MENU_FLAG_MEWUI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; + for (int curitem = 0; m_searchlist[curitem]; ++curitem) + { + bool cloneof = strcmp(m_searchlist[curitem]->parent, "0"); + if (cloneof) + { + int cx = driver_list::find(m_searchlist[curitem]->parent); + if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0)) + cloneof = false; + } + item_append(m_searchlist[curitem]->description, nullptr, (!cloneof) ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), + (void *)m_searchlist[curitem]); + } +} + +//------------------------------------------------- +// generate general info +//------------------------------------------------- + +void ui_mewui_select_game::general_info(const game_driver *driver, std::string &buffer) +{ + strprintf(buffer, "Romset: %-.100s\n", driver->name); + buffer.append("Year: ").append(driver->year).append("\n"); + strcatprintf(buffer, "Manufacturer: %-.100s\n", driver->manufacturer); + + int cloneof = driver_list::non_bios_clone(*driver); + if (cloneof != -1) + strcatprintf(buffer, "Driver is Clone of: %-.100s\n", driver_list::driver(cloneof).description); + else + buffer.append("Driver is Parent\n"); + + if (driver->flags & MACHINE_NOT_WORKING) + buffer.append("Overall: NOT WORKING\n"); + else if (driver->flags & MACHINE_UNEMULATED_PROTECTION) + buffer.append("Overall: Unemulated Protection\n"); + else + buffer.append("Overall: Working\n"); + + if (driver->flags & MACHINE_IMPERFECT_COLORS) + buffer.append("Graphics: Imperfect Colors\n"); + else if (driver->flags & MACHINE_WRONG_COLORS) + buffer.append("Graphics: Wrong Colors\n"); + else if (driver->flags & MACHINE_IMPERFECT_GRAPHICS) + buffer.append("Graphics: Imperfect\n"); + else + buffer.append("Graphics: OK\n"); + + if (driver->flags & MACHINE_NO_SOUND) + buffer.append("Sound: Unimplemented\n"); + else if (driver->flags & MACHINE_IMPERFECT_SOUND) + buffer.append("Sound: Imperfect\n"); + else + buffer.append("Sound: OK\n"); + + strcatprintf(buffer, "Driver is Skeleton: %s\n", ((driver->flags & MACHINE_IS_SKELETON) ? "Yes" : "No")); + strcatprintf(buffer, "Game is Mechanical: %s\n", ((driver->flags & MACHINE_MECHANICAL) ? "Yes" : "No")); + strcatprintf(buffer, "Requires Artwork: %s\n", ((driver->flags & MACHINE_REQUIRES_ARTWORK) ? "Yes" : "No")); + strcatprintf(buffer, "Requires Clickable Artwork: %s\n", ((driver->flags & MACHINE_CLICKABLE_ARTWORK) ? "Yes" : "No")); + strcatprintf(buffer, "Support Cocktail: %s\n", ((driver->flags & MACHINE_NO_COCKTAIL) ? "Yes" : "No")); + strcatprintf(buffer, "Driver is Bios: %s\n", ((driver->flags & MACHINE_IS_BIOS_ROOT) ? "Yes" : "No")); + strcatprintf(buffer, "Support Save: %s\n", ((driver->flags & MACHINE_SUPPORTS_SAVE) ? "Yes" : "No")); + + int idx = driver_list::find(driver->name); + strcatprintf(buffer, "Screen Type: %s\n", screen_filters::text[driver_cache[idx].b_screen]); + strcatprintf(buffer, "Screen Orentation: %s\n", ((driver->flags & ORIENTATION_SWAP_XY) ? "Vertical" : "Horizontal")); + strcatprintf(buffer, "Requires Samples: %s\n", (driver_cache[idx].b_samples ? "Yes" : "No")); + strcatprintf(buffer, "Sound Channel: %s\n", (driver_cache[idx].b_stereo ? "Stereo" : "Mono")); + strcatprintf(buffer, "Requires CHD: %s\n", (driver_cache[idx].b_chd ? "Yes" : "No")); + + // audit the game first to see if we're going to work + if (machine().options().info_audit()) + { + driver_enumerator enumerator(machine().options(), *driver); + enumerator.next(); + media_auditor auditor(enumerator); + media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST); + media_auditor::summary summary_samples = auditor.audit_samples(); + + // if everything looks good, schedule the new driver + if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + buffer.append("Roms Audit Pass: OK\n"); + else + buffer.append("Roms Audit Pass: BAD\n"); + + if (summary_samples == media_auditor::NONE_NEEDED) + buffer.append("Samples Audit Pass: None Needed\n"); + else if (summary_samples == media_auditor::CORRECT || summary_samples == media_auditor::BEST_AVAILABLE) + buffer.append("Samples Audit Pass: OK\n"); + else + buffer.append("Samples Audit Pass: BAD\n"); + } + else + buffer.append("Roms Audit Pass: Disabled\nSamples Audit Pass: Disabled\n"); +} + +void ui_mewui_select_game::inkey_export() +{ + std::string filename("exported"); + emu_file infile(machine().options().mewui_path(), OPEN_FLAG_READ); + if (infile.open(filename.c_str(), ".xml") == FILERR_NONE) + for (int seq = 0; ; ++seq) + { + std::string seqtext; + strprintf(seqtext, "%s_%04d", filename.c_str(), seq); + if (infile.open(seqtext.c_str(), ".xml") != FILERR_NONE) + { + filename = seqtext; + break; + } + } + + // attempt to open the output file + emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + if (file.open(filename.c_str(), ".xml") == FILERR_NONE) + { + FILE *pfile; + std::string fullpath(file.fullpath()); + file.close(); + pfile = fopen(fullpath.c_str() , "w"); + driver_enumerator drivlist(machine().options()); + drivlist.exclude_all(); + + if (m_search[0] != 0) + { + for (int curitem = 0; m_searchlist[curitem]; ++curitem) + { + int f = driver_list::find(m_searchlist[curitem]->name); + drivlist.include(f); + } + } + else + { + for (auto & elem : m_displaylist) + { + int f = driver_list::find(elem->name); + drivlist.include(f); + } + } + + // create the XML and save to file + info_xml_creator creator(drivlist); + creator.output(pfile, false); + fclose(pfile); + machine().popmessage("%s.xml saved under mewui folder.", filename.c_str()); + } +} + +//------------------------------------------------- +// save drivers infos to file +//------------------------------------------------- + +void ui_mewui_select_game::save_cache_info() +{ + // attempt to open the output file + emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + + if (file.open("info_", emulator_info::get_configname(), ".ini") == FILERR_NONE) + { + m_sortedlist.clear(); + + // generate header + std::string buffer = std::string("#\n").append(MEWUI_VERSION_TAG).append(bare_build_version).append("\n#\n\n"); + + // generate full list + for (int x = 0; x < driver_list::total(); ++x) + { + const game_driver *driver = &driver_list::driver(x); + if (driver == &GAME_NAME(___empty)) + continue; + + m_sortedlist.push_back(driver); + c_mnfct::set(driver->manufacturer); + c_year::set(driver->year); + } + + // sort manufacturers - years and driver + std::stable_sort(c_mnfct::ui.begin(), c_mnfct::ui.end()); + std::stable_sort(c_year::ui.begin(), c_year::ui.end()); + std::stable_sort(m_sortedlist.begin(), m_sortedlist.end(), sort_game_list); + + int index = 0; + m_isabios = 0; + m_issbios = 0; + m_isarcades = 0; + m_issystems = 0; + for (int x = 0; x < driver_list::total(); ++x) + { + const game_driver *driver = &driver_list::driver(x); + if (driver == &GAME_NAME(___empty)) + continue; + + if (driver->flags & MACHINE_TYPE_ARCADE) + { + if (driver->flags & MACHINE_IS_BIOS_ROOT) + m_isabios++; + m_isarcades++; + } + else + { + if (driver->flags & MACHINE_IS_BIOS_ROOT) + m_issbios++; + m_issystems++; + } + cache_info infos; + machine_config config(*driver, machine().options()); + + samples_device_iterator iter(config.root_device()); + infos.b_samples = (iter.first() != nullptr) ? 1 : 0; + + const screen_device *screen = config.first_screen(); + infos.b_screen = (screen != nullptr) ? screen->screen_type() : 0; + + speaker_device_iterator siter(config.root_device()); + sound_interface_iterator snditer(config.root_device()); + infos.b_stereo = (snditer.first() != nullptr && siter.count() > 1) ? 1 : 0; + infos.b_chd = 0; + for (const rom_entry *rom = driver->rom; !ROMENTRY_ISEND(rom); ++rom) + if (ROMENTRY_ISREGION(rom) && ROMREGION_ISDISKDATA(rom)) + { + infos.b_chd = 1; + break; + } + driver_cache[x].b_screen = infos.b_screen; + driver_cache[x].b_samples = infos.b_samples; + driver_cache[x].b_stereo = infos.b_stereo; + driver_cache[x].b_chd = infos.b_chd; + int find = driver_list::find(m_sortedlist[index++]->name); + strcatprintf(buffer, "%d,%d,%d,%d,%d\n", infos.b_screen, infos.b_samples, infos.b_stereo, infos.b_chd, find); + } + + strcatprintf(buffer, "%d,%d,%d,%d\n", m_isabios, m_issbios, m_isarcades, m_issystems); + file.puts(buffer.c_str()); + file.close(); + } +} + +//------------------------------------------------- +// load drivers infos from file +//------------------------------------------------- + +void ui_mewui_select_game::load_cache_info() +{ + driver_cache.resize(driver_list::total() + 1); + + // try to load driver cache + emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); + if (file.open("info_", emulator_info::get_configname(), ".ini") != FILERR_NONE) + { + save_cache_info(); + return; + } + + std::string readbuf; + char rbuf[MAX_CHAR_INFO]; + file.gets(rbuf, MAX_CHAR_INFO); + file.gets(rbuf, MAX_CHAR_INFO); + readbuf = chartrimcarriage(rbuf); + std::string a_rev = std::string(MEWUI_VERSION_TAG).append(bare_build_version); + + // version not matching ? save and exit + if (a_rev != readbuf) + { + file.close(); + save_cache_info(); + return; + } + + size_t pos = 0, end = 0; + file.gets(rbuf, MAX_CHAR_INFO); + file.gets(rbuf, MAX_CHAR_INFO); + for (int x = 0; x < driver_list::total(); ++x) + { + const game_driver *driver = &driver_list::driver(x); + if (driver == &GAME_NAME(___empty)) + continue; + + c_mnfct::set(driver->manufacturer); + c_year::set(driver->year); + file.gets(rbuf, MAX_CHAR_INFO); + readbuf = chartrimcarriage(rbuf); + pos = readbuf.find_first_of(','); + driver_cache[x].b_screen = std::stoi(readbuf.substr(0, pos)); + end = readbuf.find_first_of(',', ++pos); + driver_cache[x].b_samples = std::stoi(readbuf.substr(pos, end)); + pos = end; + end = readbuf.find_first_of(',', ++pos); + driver_cache[x].b_stereo = std::stoi(readbuf.substr(pos, end)); + pos = end; + end = readbuf.find_first_of(',', ++pos); + driver_cache[x].b_chd = std::stoi(readbuf.substr(pos, end)); + pos = end; + int find = std::stoi(readbuf.substr(++pos)); + m_sortedlist.push_back(&driver_list::driver(find)); + } + file.gets(rbuf, MAX_CHAR_INFO); + readbuf = chartrimcarriage(rbuf); + pos = readbuf.find_first_of(','); + m_isabios = std::stoi(readbuf.substr(0, pos)); + end = readbuf.find_first_of(',', ++pos); + m_issbios = std::stoi(readbuf.substr(pos, end)); + pos = end; + end = readbuf.find_first_of(',', ++pos); + m_isarcades = std::stoi(readbuf.substr(pos, end)); + pos = end; + m_issystems = std::stoi(readbuf.substr(++pos)); + file.close(); + std::stable_sort(c_mnfct::ui.begin(), c_mnfct::ui.end()); + std::stable_sort(c_year::ui.begin(), c_year::ui.end()); +} + +//------------------------------------------------- +// load drivers infos from file +//------------------------------------------------- + +bool ui_mewui_select_game::load_available_machines() +{ + // try to load available drivers from file + emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); + if (file.open(emulator_info::get_configname(), "_avail.ini") != FILERR_NONE) + return false; + + std::string readbuf; + char rbuf[MAX_CHAR_INFO]; + file.gets(rbuf, MAX_CHAR_INFO); + file.gets(rbuf, MAX_CHAR_INFO); + readbuf = chartrimcarriage(rbuf); + std::string a_rev = std::string(MEWUI_VERSION_TAG).append(bare_build_version); + + // version not matching ? exit + if (a_rev != readbuf) + { + file.close(); + return false; + } + + file.gets(rbuf, MAX_CHAR_INFO); + file.gets(rbuf, MAX_CHAR_INFO); + int avsize = 0, unavsize = 0; + file.gets(rbuf, MAX_CHAR_INFO); + avsize = atoi(rbuf); + file.gets(rbuf, MAX_CHAR_INFO); + unavsize = atoi(rbuf); + + // load available list + for (int x = 0; x < avsize; ++x) + { + file.gets(rbuf, MAX_CHAR_INFO); + int find = atoi(rbuf); + m_availsortedlist.push_back(&driver_list::driver(find)); + } + + // load unavailable list + for (int x = 0; x < unavsize; ++x) + { + file.gets(rbuf, MAX_CHAR_INFO); + int find = atoi(rbuf); + m_unavailsortedlist.push_back(&driver_list::driver(find)); + } + file.close(); + return true; +} + +//------------------------------------------------- +// load custom filters info from file +//------------------------------------------------- + +void ui_mewui_select_game::load_custom_filters() +{ + // attempt to open the output file + emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); + if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == FILERR_NONE) + { + char buffer[MAX_CHAR_INFO]; + + // get number of filters + file.gets(buffer, MAX_CHAR_INFO); + char *pb = strchr(buffer, '='); + custfltr::numother = atoi(++pb) - 1; + + // get main filter + file.gets(buffer, MAX_CHAR_INFO); + pb = strchr(buffer, '=') + 2; + + for (int y = 0; y < main_filters::length; ++y) + if (!strncmp(pb, main_filters::text[y], strlen(main_filters::text[y]))) + { + custfltr::main = y; + break; + } + + for (int x = 1; x <= custfltr::numother; ++x) + { + file.gets(buffer, MAX_CHAR_INFO); + char *cb = strchr(buffer, '=') + 2; + for (int y = 0; y < main_filters::length; ++y) + if (!strncmp(cb, main_filters::text[y], strlen(main_filters::text[y]))) + { + custfltr::other[x] = y; + if (y == FILTER_MANUFACTURER) + { + file.gets(buffer, MAX_CHAR_INFO); + char *ab = strchr(buffer, '=') + 2; + for (size_t z = 0; z < c_mnfct::ui.size(); ++z) + if (!strncmp(ab, c_mnfct::ui[z].c_str(), c_mnfct::ui[z].length())) + custfltr::mnfct[x] = z; + } + else if (y == FILTER_YEAR) + { + file.gets(buffer, MAX_CHAR_INFO); + char *db = strchr(buffer, '=') + 2; + for (size_t z = 0; z < c_year::ui.size(); ++z) + if (!strncmp(db, c_year::ui[z].c_str(), c_year::ui[z].length())) + custfltr::year[x] = z; + } + else if (y == FILTER_SCREEN) + { + file.gets(buffer, MAX_CHAR_INFO); + char *db = strchr(buffer, '=') + 2; + for (size_t z = 0; z < screen_filters::length; ++z) + if (!strncmp(db, screen_filters::text[z], strlen(screen_filters::text[z]))) + custfltr::screen[x] = z; + } + } + } + file.close(); + } + +} + + +//------------------------------------------------- +// draw left box +//------------------------------------------------- + +float ui_mewui_select_game::draw_left_panel(float x1, float y1, float x2, float y2) +{ + ui_manager &mui = machine().ui(); + float line_height = mui.get_line_height(); + + if (mewui_globals::panels_status == SHOW_PANELS || mewui_globals::panels_status == HIDE_RIGHT_PANEL) + { + float origy1 = y1; + float origy2 = y2; + float text_size = 0.75f; + float line_height_max = line_height * text_size; + float left_width = 0.0f; + int text_lenght = main_filters::length; + int afilter = main_filters::actual; + int phover = HOVER_FILTER_FIRST; + const char **text = main_filters::text; + float sc = y2 - y1 - (2.0f * UI_BOX_TB_BORDER); + + if ((text_lenght * line_height_max) > sc) + { + float lm = sc / (text_lenght); + text_size = lm / line_height; + line_height_max = line_height * text_size; + } + + float text_sign = mui.get_string_width_ex("_# ", text_size); + for (int x = 0; x < text_lenght; ++x) + { + float total_width; + + // compute width of left hand side + total_width = mui.get_string_width_ex(text[x], text_size); + total_width += text_sign; + + // track the maximum + if (total_width > left_width) + left_width = total_width; + } + + x2 = x1 + left_width + 2.0f * UI_BOX_LR_BORDER; + //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + y2 -= UI_BOX_TB_BORDER; + + for (int filter = 0; filter < text_lenght; ++filter) + { + std::string str(text[filter]); + rgb_t bgcolor = UI_TEXT_BG_COLOR; + rgb_t fgcolor = UI_TEXT_COLOR; + + if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y1 + line_height_max > mouse_y) + { + bgcolor = UI_MOUSEOVER_BG_COLOR; + fgcolor = UI_MOUSEOVER_COLOR; + hover = phover + filter; + } + + if (afilter == filter) + { + bgcolor = UI_SELECTED_BG_COLOR; + fgcolor = UI_SELECTED_COLOR; + } + + if (bgcolor != UI_TEXT_BG_COLOR) + container->add_rect(x1, y1, x2, y1 + line_height_max, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + + float x1t = x1 + text_sign; + if (afilter == FILTER_CUSTOM) + { + if (filter == custfltr::main) + { + str.assign("@custom1 ").append(text[filter]); + x1t -= text_sign; + } + else + { + for (int count = 1; count <= custfltr::numother; ++count) + { + int cfilter = custfltr::other[count]; + if (cfilter == filter) + { + strprintf(str, "@custom%d %s", count + 1, text[filter]); + x1t -= text_sign; + break; + } + } + } + convert_command_glyph(str); + } + + mui.draw_text_full(container, str.c_str(), x1t, y1, x2 - x1, JUSTIFY_LEFT, WRAP_NEVER, + DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size); + y1 += line_height_max; + } + + x1 = x2 + UI_BOX_LR_BORDER; + x2 = x1 + 2.0f * UI_BOX_LR_BORDER; + y1 = origy1; + y2 = origy2; + float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); + rgb_t fgcolor = UI_TEXT_COLOR; + + // set left-right arrows dimension + float ar_x0 = 0.5f * (x2 + x1) - 0.5f * lr_arrow_width; + float ar_y0 = 0.5f * (y2 + y1) + 0.1f * line_height; + float ar_x1 = ar_x0 + lr_arrow_width; + float ar_y1 = 0.5f * (y2 + y1) + 0.9f * line_height; + + //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + + if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y) + { + fgcolor = UI_MOUSEOVER_COLOR; + hover = HOVER_LPANEL_ARROW; + } + + draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X); + return x2 + UI_BOX_LR_BORDER; + } + else + { + float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); + rgb_t fgcolor = UI_TEXT_COLOR; + + // set left-right arrows dimension + float ar_x0 = 0.5f * (x2 + x1) - 0.5f * lr_arrow_width; + float ar_y0 = 0.5f * (y2 + y1) + 0.1f * line_height; + float ar_x1 = ar_x0 + lr_arrow_width; + float ar_y1 = 0.5f * (y2 + y1) + 0.9f * line_height; + + //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + + if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y) + { + fgcolor = UI_MOUSEOVER_COLOR; + hover = HOVER_LPANEL_ARROW; + } + + draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90); + return x2 + UI_BOX_LR_BORDER; + } +} + +//------------------------------------------------- +// draw infos +//------------------------------------------------- + +void ui_mewui_select_game::infos_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) +{ + ui_manager &mui = machine().ui(); + float line_height = mui.get_line_height(); + static std::string buffer; + std::vector xstart; + std::vector xend; + float text_size = machine().options().infos_size(); + const game_driver *driver = nullptr; + ui_software_info *soft = nullptr; + bool is_favorites = ((item[0].flags & MENU_FLAG_MEWUI_FAVORITE) != 0); + static ui_software_info *oldsoft = nullptr; + static const game_driver *olddriver = nullptr; + static int oldview = -1; + static int old_sw_view = -1; + + if (is_favorites) + { + soft = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr; + if (soft && soft->startempty == 1) + { + driver = soft->driver; + oldsoft = nullptr; + } + else + olddriver = nullptr; + } + else + { + driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr; + oldsoft = nullptr; + } + + if (driver) + { + float gutter_width = 0.4f * line_height * machine().render().ui_aspect() * 1.3f; + float ud_arrow_width = line_height * machine().render().ui_aspect(); + float oy1 = origy1 + line_height; + + // MAMESCORE? Full size text + if (mewui_globals::curdats_view == MEWUI_STORY_LOAD) + text_size = 1.0f; + + std::string snaptext(dats_info[mewui_globals::curdats_view]); + + // apply title to right panel + float title_size = 0.0f; + float txt_lenght = 0.0f; + + for (int x = MEWUI_FIRST_LOAD; x < MEWUI_LAST_LOAD; ++x) + { + mui.draw_text_full(container, dats_info[x], origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, + WRAP_TRUNCATE, DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr); + txt_lenght += 0.01f; + title_size = MAX(txt_lenght, title_size); + } + + mui.draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, + WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + draw_common_arrow(origx1, origy1, origx2, origy2, mewui_globals::curdats_view, MEWUI_FIRST_LOAD, MEWUI_LAST_LOAD, title_size); + + if (driver != olddriver || mewui_globals::curdats_view != oldview) + { + buffer.clear(); + olddriver = driver; + oldview = mewui_globals::curdats_view; + topline_datsview = 0; + totallines = 0; + std::vector m_item; + + if (mewui_globals::curdats_view == MEWUI_GENERAL_LOAD) + general_info(driver, buffer); + else if (mewui_globals::curdats_view != MEWUI_COMMAND_LOAD) + machine().datfile().load_data_info(driver, buffer, mewui_globals::curdats_view); + else + machine().datfile().command_sub_menu(driver, m_item); + + if (!m_item.empty() && mewui_globals::curdats_view == MEWUI_COMMAND_LOAD) + { + for (size_t x = 0; x < m_item.size(); ++x) + { + std::string t_buffer; + buffer.append(m_item[x]).append("\n"); + machine().datfile().load_command_info(t_buffer, m_item[x]); + if (!t_buffer.empty()) + buffer.append(t_buffer).append("\n"); + } + convert_command_glyph(buffer); + } + } + + if (buffer.empty()) + { + mui.draw_text_full(container, "No Infos Available", origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, JUSTIFY_CENTER, + WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + return; + } + else if (mewui_globals::curdats_view != MEWUI_STORY_LOAD && mewui_globals::curdats_view != MEWUI_COMMAND_LOAD) + mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, xstart, xend, text_size); + else + mui.wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * gutter_width), totallines, xstart, xend, text_size); + + int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size)); + if (totallines < r_visible_lines) + r_visible_lines = totallines; + if (topline_datsview < 0) + topline_datsview = 0; + if (topline_datsview + r_visible_lines >= totallines) + topline_datsview = totallines - r_visible_lines; + + float sc = origx2 - origx1 - (2.0f * UI_BOX_LR_BORDER); + for (int r = 0; r < r_visible_lines; ++r) + { + int itemline = r + topline_datsview; + std::string tempbuf(buffer.substr(xstart[itemline], xend[itemline] - xstart[itemline])); + + // up arrow + if (r == 0 && topline_datsview != 0) + info_arrow(0, origx1, origx2, oy1, line_height, text_size, ud_arrow_width); + // bottom arrow + else if (r == r_visible_lines - 1 && itemline != totallines - 1) + info_arrow(1, origx1, origx2, oy1, line_height, text_size, ud_arrow_width); + // special case for mamescore + else if (mewui_globals::curdats_view == MEWUI_STORY_LOAD) + { + // check size + float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size); + float tmp_size = (textlen > sc) ? text_size * (sc / textlen) : text_size; + + size_t last_underscore = tempbuf.find_last_of("_"); + if (last_underscore == std::string::npos) + { + mui.draw_text_full(container, tempbuf.c_str(), origx1, oy1, origx2 - origx1, JUSTIFY_CENTER, + WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size); + } + else + { + float effective_width = origx2 - origx1 - gutter_width; + float effective_left = origx1 + gutter_width; + std::string last_part(tempbuf.substr(last_underscore + 1)); + std::string first_part(tempbuf.substr(0, tempbuf.find("___"))); + float item_width; + + mui.draw_text_full(container, first_part.c_str(), effective_left, oy1, effective_width, + JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &item_width, nullptr, tmp_size); + + mui.draw_text_full(container, last_part.c_str(), effective_left + item_width, oy1, + origx2 - origx1 - 2.0f * gutter_width - item_width, JUSTIFY_RIGHT, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size); + } + } + + // special case for command + else if (mewui_globals::curdats_view == MEWUI_COMMAND_LOAD || mewui_globals::curdats_view == MEWUI_GENERAL_LOAD) + { + // check size + float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size); + float tmp_size = (textlen > sc) ? text_size * (sc / textlen) : text_size; + + int first_dspace = (mewui_globals::curdats_view == MEWUI_COMMAND_LOAD) ? tempbuf.find(" ") : tempbuf.find(":"); + if (first_dspace > 0) + { + float effective_width = origx2 - origx1 - gutter_width; + float effective_left = origx1 + gutter_width; + std::string first_part(tempbuf.substr(0, first_dspace)); + std::string last_part(tempbuf.substr(first_dspace + 1)); + strtrimspace(last_part); + mui.draw_text_full(container, first_part.c_str(), effective_left, oy1, effective_width, JUSTIFY_LEFT, + WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size); + + mui.draw_text_full(container, last_part.c_str(), effective_left, oy1, origx2 - origx1 - 2.0f * gutter_width, + JUSTIFY_RIGHT, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size); + } + else + mui.draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, JUSTIFY_LEFT, + WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size); + } + else + mui.draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, JUSTIFY_LEFT, + WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); + + oy1 += (line_height * text_size); + } + + // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow + right_visible_lines = r_visible_lines - (topline_datsview != 0) - (topline_datsview + r_visible_lines != totallines); + } + else if (soft) + { + float gutter_width = 0.4f * line_height * machine().render().ui_aspect() * 1.3f; + float ud_arrow_width = line_height * machine().render().ui_aspect(); + float oy1 = origy1 + line_height; + + // apply title to right panel + if (soft->usage.empty()) + { + mui.draw_text_full(container, "History", origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + mewui_globals::cur_sw_dats_view = 0; + } + else + { + float title_size = 0.0f; + float txt_lenght = 0.0f; + std::string t_text[2]; + t_text[0] = "History"; + t_text[1] = "Usage"; + + for (auto & elem: t_text) + { + mui.draw_text_full(container, elem.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr); + txt_lenght += 0.01f; + title_size = MAX(txt_lenght, title_size); + } + + mui.draw_text_full(container, t_text[mewui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1, + JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + draw_common_arrow(origx1, origy1, origx2, origy2, mewui_globals::cur_sw_dats_view, 0, 1, title_size); + } + + if (oldsoft != soft || old_sw_view != mewui_globals::cur_sw_dats_view) + { + buffer.clear(); + old_sw_view = mewui_globals::cur_sw_dats_view; + oldsoft = soft; + if (mewui_globals::cur_sw_dats_view == 0) + { + if (soft->startempty == 1) + machine().datfile().load_data_info(soft->driver, buffer, MEWUI_HISTORY_LOAD); + else + machine().datfile().load_software_info(soft->listname, buffer, soft->shortname, soft->parentname); + } + else + buffer = soft->usage; + } + + if (buffer.empty()) + { + mui.draw_text_full(container, "No Infos Available", origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, JUSTIFY_CENTER, + WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + return; + } + else + mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, xstart, xend, text_size); + + int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size)); + if (totallines < r_visible_lines) + r_visible_lines = totallines; + if (topline_datsview < 0) + topline_datsview = 0; + if (topline_datsview + r_visible_lines >= totallines) + topline_datsview = totallines - r_visible_lines; + + for (int r = 0; r < r_visible_lines; ++r) + { + int itemline = r + topline_datsview; + std::string tempbuf(buffer.substr(xstart[itemline], xend[itemline] - xstart[itemline])); + + // up arrow + if (r == 0 && topline_datsview != 0) + info_arrow(0, origx1, origx2, oy1, line_height, text_size, ud_arrow_width); + // bottom arrow + else if (r == r_visible_lines - 1 && itemline != totallines - 1) + info_arrow(1, origx1, origx2, oy1, line_height, text_size, ud_arrow_width); + else + mui.draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, JUSTIFY_LEFT, + WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); + oy1 += (line_height * text_size); + } + + // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow + right_visible_lines = r_visible_lines - (topline_datsview != 0) - (topline_datsview + r_visible_lines != totallines); + } +} + +void ui_mewui_select_game::draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) +{ + ui_manager &mui = machine().ui(); + float line_height = mui.get_line_height(); + float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); + rgb_t fgcolor = UI_TEXT_COLOR; + bool hide = (mewui_globals::panels_status == HIDE_RIGHT_PANEL || mewui_globals::panels_status == HIDE_BOTH); + float x2 = (hide) ? origx2 : origx1 + 2.0f * UI_BOX_LR_BORDER; + + // set left-right arrows dimension + float ar_x0 = 0.5f * (x2 + origx1) - 0.5f * lr_arrow_width; + float ar_y0 = 0.5f * (origy2 + origy1) + 0.1f * line_height; + float ar_x1 = ar_x0 + lr_arrow_width; + float ar_y1 = 0.5f * (origy2 + origy1) + 0.9f * line_height; + + //machine().ui().draw_outlined_box(container, origx1, origy1, origx2, origy2, UI_BACKGROUND_COLOR); + mui.draw_outlined_box(container, origx1, origy1, origx2, origy2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + + if (mouse_hit && origx1 <= mouse_x && x2 > mouse_x && origy1 <= mouse_y && origy2 > mouse_y) + { + fgcolor = UI_MOUSEOVER_COLOR; + hover = HOVER_RPANEL_ARROW; + } + + if (hide) + { + draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X); + return; + } + + draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90); + origx1 = x2; + origy1 = draw_right_box_title(origx1, origy1, origx2, origy2); + + if (mewui_globals::rpanel == RP_IMAGES) + arts_render(selectedref, origx1, origy1, origx2, origy2); + else + infos_render(selectedref, origx1, origy1, origx2, origy2); +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_mewui_select_game::arts_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) +{ + ui_manager &mui = machine().ui(); + float line_height = mui.get_line_height(); + bool is_favorites = ((item[0].flags & MENU_FLAG_MEWUI_FAVORITE) != 0); + static ui_software_info *oldsoft = nullptr; + static const game_driver *olddriver = nullptr; + const game_driver *driver = nullptr; + ui_software_info *soft = nullptr; + + if (is_favorites) + { + soft = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr; + if (soft && soft->startempty == 1) + { + driver = soft->driver; + oldsoft = nullptr; + } + else + olddriver = nullptr; + } + else + { + driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr; + oldsoft = nullptr; + } + + if (driver) + { + if (mewui_globals::default_image) + ((driver->flags & MACHINE_TYPE_ARCADE) == 0) ? mewui_globals::curimage_view = CABINETS_VIEW : mewui_globals::curimage_view = SNAPSHOT_VIEW; + + std::string searchstr; + searchstr = arts_render_common(origx1, origy1, origx2, origy2); + + // loads the image if necessary + if (driver != olddriver || !snapx_bitmap->valid() || mewui_globals::switch_image) + { + emu_file snapfile(searchstr.c_str(), OPEN_FLAG_READ); + bitmap_argb32 *tmp_bitmap; + tmp_bitmap = auto_alloc(machine(), bitmap_argb32); + + // try to load snapshot first from saved "0000.png" file + std::string fullname(driver->name); + render_load_png(*tmp_bitmap, snapfile, fullname.c_str(), "0000.png"); + + if (!tmp_bitmap->valid()) + render_load_jpeg(*tmp_bitmap, snapfile, fullname.c_str(), "0000.jpg"); + + // if fail, attemp to load from standard file + if (!tmp_bitmap->valid()) + { + fullname.assign(driver->name).append(".png"); + render_load_png(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(driver->name).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + } + } + + // if fail again, attemp to load from parent file + if (!tmp_bitmap->valid()) + { + // set clone status + bool cloneof = strcmp(driver->parent, "0"); + if (cloneof) + { + int cx = driver_list::find(driver->parent); + if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0)) + cloneof = false; + } + + if (cloneof) + { + fullname.assign(driver->parent).append(".png"); + render_load_png(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(driver->parent).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + } + } + } + + olddriver = driver; + mewui_globals::switch_image = false; + arts_render_images(tmp_bitmap, origx1, origy1, origx2, origy2, false); + auto_free(machine(), tmp_bitmap); + } + + // if the image is available, loaded and valid, display it + if (snapx_bitmap->valid()) + { + float x1 = origx1 + 0.01f; + float x2 = origx2 - 0.01f; + float y1 = origy1 + UI_BOX_TB_BORDER + line_height; + float y2 = origy2 - UI_BOX_TB_BORDER - line_height; + + // apply texture + container->add_quad( x1, y1, x2, y2, ARGB_WHITE, snapx_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + } + } + else if (soft) + { + std::string fullname, pathname; + + if (mewui_globals::default_image) + (soft->startempty == 0) ? mewui_globals::curimage_view = SNAPSHOT_VIEW : mewui_globals::curimage_view = CABINETS_VIEW; + + // arts title and searchpath + std::string searchstr; + searchstr = arts_render_common(origx1, origy1, origx2, origy2); + + // loads the image if necessary + if (soft != oldsoft || !snapx_bitmap->valid() || mewui_globals::switch_image) + { + emu_file snapfile(searchstr.c_str(), OPEN_FLAG_READ); + bitmap_argb32 *tmp_bitmap; + tmp_bitmap = auto_alloc(machine(), bitmap_argb32); + + if (soft->startempty == 1) + { + // Load driver snapshot + fullname.assign(soft->driver->name).append(".png"); + render_load_png(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(soft->driver->name).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + } + } + else if (mewui_globals::curimage_view == TITLES_VIEW) + { + // First attempt from name list + pathname.assign(soft->listname).append("_titles"); + fullname.assign(soft->shortname).append(".png"); + render_load_png(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(soft->shortname).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + } + } + else + { + // First attempt from name list + pathname = soft->listname; + fullname.assign(soft->shortname).append(".png"); + render_load_png(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(soft->shortname).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + } + + if (!tmp_bitmap->valid()) + { + // Second attempt from driver name + part name + pathname.assign(soft->driver->name).append(soft->part.c_str()); + fullname.assign(soft->shortname).append(".png"); + render_load_png(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(soft->shortname).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + } + } + } + + oldsoft = soft; + mewui_globals::switch_image = false; + arts_render_images(tmp_bitmap, origx1, origy1, origx2, origy2, true); + auto_free(machine(), tmp_bitmap); + } + + // if the image is available, loaded and valid, display it + if (snapx_bitmap->valid()) + { + float x1 = origx1 + 0.01f; + float x2 = origx2 - 0.01f; + float y1 = origy1 + UI_BOX_TB_BORDER + line_height; + float y2 = origy2 - UI_BOX_TB_BORDER - line_height; + + // apply texture + container->add_quad(x1, y1, x2, y2, ARGB_WHITE, snapx_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + } + } +} diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h index 006f972b22b..175194826ca 100644 --- a/src/emu/ui/selgame.h +++ b/src/emu/ui/selgame.h @@ -1,25 +1,26 @@ // license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods +// copyright-holders:Dankan1890 /*************************************************************************** - ui/selgame.h + mewui/selgame.h - Game selector + Main MEWUI menu. ***************************************************************************/ #pragma once -#ifndef __UI_SELGAME_H__ -#define __UI_SELGAME_H__ +#ifndef __MEWUI_MAIN_H__ +#define __MEWUI_MAIN_H__ #include "drivenum.h" -#include "menu.h" +#include "ui/menu.h" -class ui_menu_select_game : public ui_menu { +class ui_mewui_select_game : public ui_menu +{ public: - ui_menu_select_game(running_machine &machine, render_container *container, const char *gamename); - virtual ~ui_menu_select_game(); + ui_mewui_select_game(running_machine &machine, render_container *container, const char *gamename); + virtual ~ui_mewui_select_game(); virtual void populate() override; virtual void handle() override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; @@ -27,21 +28,61 @@ public: // force game select menu static void force_game_select(running_machine &machine, render_container *container); + virtual bool menu_has_search_active() override { return (m_search[0] != 0); } + + // draw left panel + virtual float draw_left_panel(float x1, float y1, float x2, float y2) override; + + // draw right panel + virtual void draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) override; + private: - // internal state - enum { VISIBLE_GAMES_IN_LIST = 15 }; - UINT8 m_error; - bool m_rerandomize; - char m_search[40]; - int m_matchlist[VISIBLE_GAMES_IN_LIST]; - std::vector m_driverlist; - std::unique_ptr m_drivlist; + struct cache_info + { + UINT8 b_screen, b_stereo, b_samples, b_chd; + }; + + std::vector driver_cache; + + enum { VISIBLE_GAMES_IN_SEARCH = 200 }; + char m_search[40]; + int m_prev_selected; + int m_isabios, m_issbios, m_isarcades, m_issystems; + + std::vector m_sortedlist; + std::vector m_availsortedlist; + std::vector m_unavailsortedlist; + std::vector m_displaylist; + std::vector m_tmp; + + const game_driver *m_searchlist[VISIBLE_GAMES_IN_SEARCH + 1]; // internal methods - void build_driver_list(); + void build_custom(); + void build_category(); + void build_available_list(); + void build_list(std::vector &vec, const char *filter_text = nullptr, int filter = 0, bool bioscheck = false); + void build_from_cache(std::vector &vec, int screens = 0, int filter = 0, bool bioscheck = false); + + bool no_active_search(); + void populate_search(); + void load_cache_info(); + void save_cache_info(); + bool load_available_machines(); + void load_custom_filters(); + + // General info + void general_info(const game_driver *driver, std::string &buffer); + + void arts_render(void *selectedref, float x1, float y1, float x2, float y2); + void infos_render(void *selectedref, float x1, float y1, float x2, float y2); + + // handlers void inkey_select(const ui_menu_event *menu_event); - void inkey_cancel(const ui_menu_event *menu_event); + void inkey_select_favorite(const ui_menu_event *menu_event); void inkey_special(const ui_menu_event *menu_event); + void inkey_export(); }; -#endif /* __UI_SELGAME_H__ */ + +#endif /* __MEWUI_MAIN_H__ */ diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp new file mode 100644 index 00000000000..ccc98d5f0a3 --- /dev/null +++ b/src/emu/ui/selsoft.cpp @@ -0,0 +1,1974 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/selsoft.cpp + + MEWUI softwares menu. + +***************************************************************************/ + +#include "emu.h" +#include "emuopts.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "uiinput.h" +#include "audit.h" +#include "ui/selsoft.h" +#include "ui/datmenu.h" +#include "ui/datfile.h" +#include "ui/inifile.h" +#include "ui/selector.h" +#include "ui/custmenu.h" +#include "rendfont.h" +#include "rendutil.h" +#include "softlist.h" +#include + +std::string reselect_last::driver; +std::string reselect_last::software; +std::string reselect_last::swlist; +bool reselect_last::m_reselect = false; +static const char *region_lists[] = { "arab", "arg", "asia", "aus", "aut", "bel", "blr", "bra", "can", "chi", "chn", "cze", "den", + "ecu", "esp", "euro", "fin", "fra", "gbr", "ger", "gre", "hkg", "hun", "irl", "isr", + "isv", "ita", "jpn", "kaz", "kor", "lat", "lux", "mex", "ned", "nld", "nor", "nzl", + "pol", "rus", "slo", "spa", "sui", "swe", "tha", "tpe", "tw", "uk", "ukr", "usa" }; + +//------------------------------------------------- +// compares two items in the software list and +// sort them by parent-clone +//------------------------------------------------- + +bool compare_software(ui_software_info a, ui_software_info b) +{ + ui_software_info *x = &a; + ui_software_info *y = &b; + + bool clonex = (x->parentname[0] != '\0'); + bool cloney = (y->parentname[0] != '\0'); + + if (!clonex && !cloney) + return (strmakelower(x->longname) < strmakelower(y->longname)); + + std::string cx(x->parentlongname), cy(y->parentlongname); + + if (clonex && cx[0] == '\0') + clonex = false; + + if (cloney && cy[0] == '\0') + cloney = false; + + if (!clonex && !cloney) + return (strmakelower(x->longname) < strmakelower(y->longname)); + else if (clonex && cloney) + { + if (!core_stricmp(x->parentname.c_str(), y->parentname.c_str()) && !core_stricmp(x->instance.c_str(), y->instance.c_str())) + return (strmakelower(x->longname) < strmakelower(y->longname)); + else + return (strmakelower(cx) < strmakelower(cy)); + } + else if (!clonex && cloney) + { + if (!core_stricmp(x->shortname.c_str(), y->parentname.c_str()) && !core_stricmp(x->instance.c_str(), y->instance.c_str())) + return true; + else + return (strmakelower(x->longname) < strmakelower(cy)); + } + else + { + if (!core_stricmp(x->parentname.c_str(), y->shortname.c_str()) && !core_stricmp(x->instance.c_str(), y->instance.c_str())) + return false; + else + return (strmakelower(cx) < strmakelower(y->longname)); + } +} + +//------------------------------------------------- +// get bios count +//------------------------------------------------- + +bool has_multiple_bios(const game_driver *driver, std::vector &biosname) +{ + if (driver->rom == nullptr) + return 0; + + std::string default_name; + for (const rom_entry *rom = driver->rom; !ROMENTRY_ISEND(rom); ++rom) + if (ROMENTRY_ISDEFAULT_BIOS(rom)) + default_name = ROM_GETNAME(rom); + + for (const rom_entry *rom = driver->rom; !ROMENTRY_ISEND(rom); ++rom) + { + if (ROMENTRY_ISSYSTEM_BIOS(rom)) + { + std::string name(ROM_GETHASHDATA(rom)); + std::string bname(ROM_GETNAME(rom)); + int bios_flags = ROM_GETBIOSFLAGS(rom); + + if (bname == default_name) + { + name.append(" (default)"); + biosname.emplace(biosname.begin(), name, bios_flags - 1); + } + else + biosname.emplace_back(name, bios_flags - 1); + } + } + return (biosname.size() > 1); +} + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_menu_select_software::ui_menu_select_software(running_machine &machine, render_container *container, const game_driver *driver) : ui_menu(machine, container) +{ + if (reselect_last::get()) + reselect_last::set(false); + + sw_filters::actual = 0; + + m_driver = driver; + build_software_list(); + load_sw_custom_filters(); + + mewui_globals::curimage_view = SNAPSHOT_VIEW; + mewui_globals::switch_image = true; + mewui_globals::cur_sw_dats_view = MEWUI_FIRST_LOAD; + + std::string error_string; + machine.options().set_value(OPTION_SOFTWARENAME, "", OPTION_PRIORITY_CMDLINE, error_string); +} + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_menu_select_software::~ui_menu_select_software() +{ + mewui_globals::curimage_view = CABINETS_VIEW; + mewui_globals::switch_image = true; +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_select_software::handle() +{ + bool check_filter = false; + + // ignore pause keys by swallowing them before we process the menu + machine().ui_input().pressed(IPT_UI_PAUSE); + + // process the menu + const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT); + + if (m_event != nullptr && m_event->itemref != nullptr) + { + // reset the error on any future m_event + if (ui_error) + ui_error = false; + + // handle selections + else if (m_event->iptkey == IPT_UI_SELECT) + inkey_select(m_event); + + // handle UI_LEFT + else if (m_event->iptkey == IPT_UI_LEFT) + { + // Images + if (mewui_globals::rpanel == RP_IMAGES && mewui_globals::curimage_view > FIRST_VIEW) + { + mewui_globals::curimage_view--; + mewui_globals::switch_image = true; + mewui_globals::default_image = false; + } + + // Infos + else if (mewui_globals::rpanel == RP_INFOS && mewui_globals::cur_sw_dats_view > 0) + { + mewui_globals::cur_sw_dats_view--; + topline_datsview = 0; + } + } + + // handle UI_RIGHT + else if (m_event->iptkey == IPT_UI_RIGHT) + { + // Images + if (mewui_globals::rpanel == RP_IMAGES && mewui_globals::curimage_view < LAST_VIEW) + { + mewui_globals::curimage_view++; + mewui_globals::switch_image = true; + mewui_globals::default_image = false; + } + + // Infos + else if (mewui_globals::rpanel == RP_INFOS && mewui_globals::cur_sw_dats_view < 1) + { + mewui_globals::cur_sw_dats_view++; + topline_datsview = 0; + } + } + + // handle UI_HISTORY + else if (m_event->iptkey == IPT_UI_HISTORY && machine().options().enabled_dats()) + { + ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; + + if ((FPTR)ui_swinfo > 1) + ui_menu::stack_push(global_alloc_clear(machine(), container, ui_swinfo, m_driver)); + } + + // handle UI_UP_FILTER + else if (m_event->iptkey == IPT_UI_UP_FILTER && sw_filters::actual > MEWUI_SW_FIRST) + { + l_sw_hover = sw_filters::actual - 1; + check_filter = true; + } + + // handle UI_DOWN_FILTER + else if (m_event->iptkey == IPT_UI_DOWN_FILTER && sw_filters::actual < MEWUI_SW_LAST) + { + l_sw_hover = sw_filters::actual + 1; + check_filter = true; + } + + // handle UI_LEFT_PANEL + else if (m_event->iptkey == IPT_UI_LEFT_PANEL) + mewui_globals::rpanel = RP_IMAGES; + + // handle UI_RIGHT_PANEL + else if (m_event->iptkey == IPT_UI_RIGHT_PANEL) + mewui_globals::rpanel = RP_INFOS; + + // escape pressed with non-empty text clears the text + else if (m_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0) + { + m_search[0] = '\0'; + reset(UI_MENU_RESET_SELECT_FIRST); + } + + // handle UI_FAVORITES + else if (m_event->iptkey == IPT_UI_FAVORITES) + { + ui_software_info *swinfo = (ui_software_info *)m_event->itemref; + + if ((FPTR)swinfo > 2) + { + if (!machine().favorite().isgame_favorite(*swinfo)) + { + machine().favorite().add_favorite_game(*swinfo); + machine().popmessage("%s\n added to favorites list.", swinfo->longname.c_str()); + } + + else + { + machine().popmessage("%s\n removed from favorites list.", swinfo->longname.c_str()); + machine().favorite().remove_favorite_game(); + } + } + } + + // typed characters append to the buffer + else if (m_event->iptkey == IPT_SPECIAL) + inkey_special(m_event); + + else if (m_event->iptkey == IPT_OTHER) + check_filter = true; + } + + if (m_event != nullptr && m_event->itemref == nullptr) + { + // reset the error on any future m_event + if (ui_error) + ui_error = false; + + else if (m_event->iptkey == IPT_OTHER) + check_filter = true; + + // handle UI_UP_FILTER + else if (m_event->iptkey == IPT_UI_UP_FILTER && sw_filters::actual > MEWUI_SW_FIRST) + { + l_sw_hover = sw_filters::actual - 1; + check_filter = true; + } + + // handle UI_DOWN_FILTER + else if (m_event->iptkey == IPT_UI_DOWN_FILTER && sw_filters::actual < MEWUI_SW_LAST) + { + l_sw_hover = sw_filters::actual + 1; + check_filter = true; + } + } + + // if we're in an error state, overlay an error message + if (ui_error) + machine().ui().draw_text_box(container, + "The selected software is missing one or more required files. " + "Please select a different software.\n\nPress any key (except ESC) to continue.", + JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); + + // handle filters selection from key shortcuts + if (check_filter) + { + m_search[0] = '\0'; + + switch (l_sw_hover) + { + case MEWUI_SW_REGION: + ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.region.ui, + m_filter.region.actual, SELECTOR_SOFTWARE, l_sw_hover)); + break; + case MEWUI_SW_YEARS: + ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.year.ui, + m_filter.year.actual, SELECTOR_SOFTWARE, l_sw_hover)); + break; + case MEWUI_SW_LIST: + ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.swlist.description, + m_filter.swlist.actual, SELECTOR_SOFTWARE, l_sw_hover)); + break; + case MEWUI_SW_TYPE: + ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.type.ui, + m_filter.type.actual, SELECTOR_SOFTWARE, l_sw_hover)); + break; + case MEWUI_SW_PUBLISHERS: + ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.publisher.ui, + m_filter.publisher.actual, SELECTOR_SOFTWARE, l_sw_hover)); + break; + case MEWUI_SW_CUSTOM: + sw_filters::actual = l_sw_hover; + ui_menu::stack_push(global_alloc_clear(machine(), container, m_driver, m_filter)); + break; + default: + sw_filters::actual = l_sw_hover; + reset(UI_MENU_RESET_SELECT_FIRST); + break; + } + } +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_select_software::populate() +{ + UINT32 flags_mewui = MENU_FLAG_MEWUI_SWLIST | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; + m_has_empty_start = true; + int old_software = -1; + + machine_config config(*m_driver, machine().options()); + image_interface_iterator iter(config.root_device()); + + for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) + if (image->filename() == nullptr && image->must_be_loaded()) + { + m_has_empty_start = false; + break; + } + + // no active search + if (m_search[0] == 0) + { + // if the device can be loaded empty, add an item + if (m_has_empty_start) + item_append("[Start empty]", nullptr, flags_mewui, (void *)&m_swinfo[0]); + + m_displaylist.clear(); + m_tmp.clear(); + + switch (sw_filters::actual) + { + case MEWUI_SW_PUBLISHERS: + build_list(m_tmp, m_filter.publisher.ui[m_filter.publisher.actual].c_str()); + break; + + case MEWUI_SW_LIST: + build_list(m_tmp, m_filter.swlist.name[m_filter.swlist.actual].c_str()); + break; + + case MEWUI_SW_YEARS: + build_list(m_tmp, m_filter.year.ui[m_filter.year.actual].c_str()); + break; + + case MEWUI_SW_TYPE: + build_list(m_tmp, m_filter.type.ui[m_filter.type.actual].c_str()); + break; + + case MEWUI_SW_REGION: + build_list(m_tmp, m_filter.region.ui[m_filter.region.actual].c_str()); + break; + + case MEWUI_SW_CUSTOM: + build_custom(); + break; + + default: + build_list(m_tmp); + break; + } + + // iterate over entries + for (size_t curitem = 0; curitem < m_displaylist.size(); ++curitem) + { + if (reselect_last::software == "[Start empty]" && !reselect_last::driver.empty()) + old_software = 0; + + else if (!reselect_last::software.empty() && m_displaylist[curitem]->shortname == reselect_last::software + && m_displaylist[curitem]->listname == reselect_last::swlist) + old_software = m_has_empty_start ? curitem + 1 : curitem; + + item_append(m_displaylist[curitem]->longname.c_str(), m_displaylist[curitem]->devicetype.c_str(), + m_displaylist[curitem]->parentname.empty() ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), (void *)m_displaylist[curitem]); + } + } + + else + { + find_matches(m_search, VISIBLE_GAMES_IN_SEARCH); + + for (int curitem = 0; m_searchlist[curitem] != nullptr; ++curitem) + item_append(m_searchlist[curitem]->longname.c_str(), m_searchlist[curitem]->devicetype.c_str(), + m_searchlist[curitem]->parentname.empty() ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), + (void *)m_searchlist[curitem]); + } + + item_append(MENU_SEPARATOR_ITEM, nullptr, flags_mewui, nullptr); + + // configure the custom rendering + customtop = 4.0f * machine().ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER; + custombottom = 5.0f * machine().ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER; + + if (old_software != -1) + { + selected = old_software; + top_line = selected - (mewui_globals::visible_sw_lines / 2); + } + + reselect_last::reset(); +} + +//------------------------------------------------- +// build a list of softwares +//------------------------------------------------- + +void ui_menu_select_software::build_software_list() +{ + // add start empty item + m_swinfo.emplace_back(m_driver->name, m_driver->description, "", "", "", 0, "", m_driver, "", "", "", 1, "", "", "", true); + + machine_config config(*m_driver, machine().options()); + software_list_device_iterator deviter(config.root_device()); + + // iterate thru all software lists + for (software_list_device *swlist = deviter.first(); swlist != nullptr; swlist = deviter.next()) + { + m_filter.swlist.name.push_back(swlist->list_name()); + m_filter.swlist.description.push_back(swlist->description()); + for (software_info *swinfo = swlist->first_software_info(); swinfo != nullptr; swinfo = swinfo->next()) + { + software_part *part = swinfo->first_part(); + if (part->is_compatible(*swlist)) + { + const char *instance_name = nullptr; + const char *type_name = nullptr; + ui_software_info tmpmatches; + image_interface_iterator imgiter(config.root_device()); + for (device_image_interface *image = imgiter.first(); image != nullptr; image = imgiter.next()) + { + const char *interface = image->image_interface(); + if (interface != nullptr && part->matches_interface(interface)) + { + instance_name = image->instance_name(); + if (instance_name != nullptr) + tmpmatches.instance = image->instance_name(); + + type_name = image->image_type_name(); + if (type_name != nullptr) + tmpmatches.devicetype = type_name; + break; + } + } + + if (instance_name == nullptr || type_name == nullptr) + continue; + + if (swinfo->shortname()) tmpmatches.shortname = swinfo->shortname(); + if (swinfo->longname()) tmpmatches.longname = swinfo->longname(); + if (swinfo->parentname()) tmpmatches.parentname = swinfo->parentname(); + if (swinfo->year()) tmpmatches.year = swinfo->year(); + if (swinfo->publisher()) tmpmatches.publisher = swinfo->publisher(); + tmpmatches.supported = swinfo->supported(); + if (part->name()) tmpmatches.part = part->name(); + tmpmatches.driver = m_driver; + if (swlist->list_name()) tmpmatches.listname = swlist->list_name(); + if (part->interface()) tmpmatches.interface = part->interface(); + tmpmatches.startempty = 0; + tmpmatches.parentlongname.clear(); + tmpmatches.usage.clear(); + tmpmatches.available = false; + + for (feature_list_item *flist = swinfo->other_info(); flist != nullptr; flist = flist->next()) + if (!strcmp(flist->name(), "usage")) + tmpmatches.usage = flist->value(); + + m_swinfo.push_back(tmpmatches); + m_filter.region.set(tmpmatches.longname); + m_filter.publisher.set(tmpmatches.publisher); + m_filter.year.set(tmpmatches.year); + m_filter.type.set(tmpmatches.devicetype); + } + } + } + m_displaylist.resize(m_swinfo.size() + 1); + + // retrieve and set the long name of software for parents + for (size_t y = 1; y < m_swinfo.size(); ++y) + { + if (!m_swinfo[y].parentname.empty()) + { + std::string lparent(m_swinfo[y].parentname); + bool found = false; + + // first scan backward + for (int x = y; x > 0; --x) + if (lparent == m_swinfo[x].shortname && m_swinfo[y].listname == m_swinfo[x].listname) + { + m_swinfo[y].parentlongname = m_swinfo[x].longname; + found = true; + break; + } + + // not found? then scan forward + for (size_t x = y; !found && x < m_swinfo.size(); ++x) + if (lparent == m_swinfo[x].shortname && m_swinfo[y].listname == m_swinfo[x].listname) + { + m_swinfo[y].parentlongname = m_swinfo[x].longname; + break; + } + } + } + + std::string searchstr, curpath; + const osd_directory_entry *dir; + for (auto & elem : m_filter.swlist.name) + { + path_iterator path(machine().options().media_path()); + while (path.next(curpath)) + { + searchstr.assign(curpath).append(PATH_SEPARATOR).append(elem).append(";"); + file_enumerator fpath(searchstr.c_str()); + + // iterate while we get new objects + while ((dir = fpath.next()) != nullptr) + { + std::string name; + if (dir->type == ENTTYPE_FILE) + name = core_filename_extract_base(dir->name, true); + else if (dir->type == ENTTYPE_DIR && strcmp(dir->name, ".") != 0) + name = dir->name; + else + continue; + + strmakelower(name); + for (auto & yelem : m_swinfo) + if (yelem.shortname == name && yelem.listname == elem) + { + yelem.available = true; + break; + } + } + } + } + + // sort array + std::stable_sort(m_swinfo.begin() + 1, m_swinfo.end(), compare_software); + std::stable_sort(m_filter.region.ui.begin(), m_filter.region.ui.end()); + std::stable_sort(m_filter.year.ui.begin(), m_filter.year.ui.end()); + std::stable_sort(m_filter.type.ui.begin(), m_filter.type.ui.end()); + std::stable_sort(m_filter.publisher.ui.begin(), m_filter.publisher.ui.end()); + + for (size_t x = 1; x < m_swinfo.size(); ++x) + m_sortedlist.push_back(&m_swinfo[x]); +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_select_software::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + ui_software_info *swinfo = (FPTR)selectedref > 1 ? (ui_software_info *)selectedref : nullptr; + const game_driver *driver = nullptr; + ui_manager &mui = machine().ui(); + float width; + std::string tempbuf[5], filtered; + rgb_t color = UI_BACKGROUND_COLOR; + bool isstar = false; + float tbarspace = mui.get_line_height(); + + // determine the text for the header + int vis_item = (m_search[0] != 0) ? visible_items : (m_has_empty_start ? visible_items - 1 : visible_items); + strprintf(tempbuf[0], "MAME %s ( %d / %d softwares )", bare_build_version, vis_item, (int)m_swinfo.size() - 1); + tempbuf[1].assign("Driver: \"").append(m_driver->description).append("\" software list "); + + if (sw_filters::actual == MEWUI_SW_REGION && m_filter.region.ui.size() != 0) + filtered.assign("Region: ").append(m_filter.region.ui[m_filter.region.actual]).append(" - "); + else if (sw_filters::actual == MEWUI_SW_PUBLISHERS) + filtered.assign("Publisher: ").append(m_filter.publisher.ui[m_filter.publisher.actual]).append(" - "); + else if (sw_filters::actual == MEWUI_SW_YEARS) + filtered.assign("Year: ").append(m_filter.year.ui[m_filter.year.actual]).append(" - "); + else if (sw_filters::actual == MEWUI_SW_LIST) + filtered.assign("Software List: ").append(m_filter.swlist.description[m_filter.swlist.actual]).append(" - "); + else if (sw_filters::actual == MEWUI_SW_TYPE) + filtered.assign("Device type: ").append(m_filter.type.ui[m_filter.type.actual]).append(" - "); + + tempbuf[2].assign(filtered).append("Search: ").append(m_search).append("_"); + + // get the size of the text + float maxwidth = origx2 - origx1; + + for (int line = 0; line < 3; ++line) + { + mui.draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(width, maxwidth); + } + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - 3.0f * UI_BOX_TB_BORDER - tbarspace; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + for (int line = 0; line < 3; ++line) + { + mui.draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + y1 += mui.get_line_height(); + } + + // determine the text to render below + if (swinfo && swinfo->startempty == 1) + driver = swinfo->driver; + + if ((FPTR)driver > 1) + { + isstar = machine().favorite().isgame_favorite(driver); + + // first line is game description + strprintf(tempbuf[0], "%-.100s", driver->description); + + // next line is year, manufacturer + strprintf(tempbuf[1], "%s, %-.100s", driver->year, driver->manufacturer); + + // next line is clone/parent status + int cloneof = driver_list::non_bios_clone(*driver); + + if (cloneof != -1) + strprintf(tempbuf[2], "Driver is clone of: %-.100s", driver_list::driver(cloneof).description); + else + tempbuf[2] = "Driver is parent"; + + // next line is overall driver status + if (driver->flags & MACHINE_NOT_WORKING) + tempbuf[3] = "Overall: NOT WORKING"; + else if (driver->flags & MACHINE_UNEMULATED_PROTECTION) + tempbuf[3] = "Overall: Unemulated Protection"; + else + tempbuf[3] = "Overall: Working"; + + // next line is graphics, sound status + if (driver->flags & (MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_COLORS)) + tempbuf[4] = "Graphics: Imperfect, "; + else + tempbuf[4] = "Graphics: OK, "; + + if (driver->flags & MACHINE_NO_SOUND) + tempbuf[4].append("Sound: Unimplemented"); + else if (driver->flags & MACHINE_IMPERFECT_SOUND) + tempbuf[4].append("Sound: Imperfect"); + else + tempbuf[4].append("Sound: OK"); + + color = UI_GREEN_COLOR; + + if ((driver->flags & (MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_COLORS + | MACHINE_NO_SOUND | MACHINE_IMPERFECT_SOUND)) != 0) + color = UI_YELLOW_COLOR; + + if ((driver->flags & (MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION)) != 0) + color = UI_RED_COLOR; + + } + + else if ((FPTR)swinfo > 1) + { + isstar = machine().favorite().isgame_favorite(*swinfo); + + // first line is long name + strprintf(tempbuf[0], "%-.100s", swinfo->longname.c_str()); + + // next line is year, publisher + strprintf(tempbuf[1], "%s, %-.100s", swinfo->year.c_str(), swinfo->publisher.c_str()); + + // next line is parent/clone + if (!swinfo->parentname.empty()) + strprintf(tempbuf[2], "Software is clone of: %-.100s", !swinfo->parentlongname.empty() ? swinfo->parentlongname.c_str() : swinfo->parentname.c_str()); + else + tempbuf[2] = "Software is parent"; + + // next line is supported status + if (swinfo->supported == SOFTWARE_SUPPORTED_NO) + { + tempbuf[3] = "Supported: No"; + color = UI_RED_COLOR; + } + else if (swinfo->supported == SOFTWARE_SUPPORTED_PARTIAL) + { + tempbuf[3] = "Supported: Partial"; + color = UI_YELLOW_COLOR; + } + else + { + tempbuf[3] = "Supported: Yes"; + color = UI_GREEN_COLOR; + } + + // last line is romset name + strprintf(tempbuf[4], "romset: %-.100s", swinfo->shortname.c_str()); + } + + else + { + std::string copyright(emulator_info::get_copyright()); + size_t found = copyright.find("\n"); + + tempbuf[0].clear(); + tempbuf[1].assign(emulator_info::get_appname()).append(" ").append(build_version); + tempbuf[2] = copyright.substr(0, found); + tempbuf[3] = copyright.substr(found + 1); + tempbuf[4].clear(); + } + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = y2; + y2 = origy1 - UI_BOX_TB_BORDER; + + // draw toolbar + draw_toolbar(x1, y1, x2, y2, true); + + // get the size of the text + maxwidth = origx2 - origx1; + + for (auto & elem : tempbuf) + { + mui.draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + } + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = origy2 + UI_BOX_TB_BORDER; + y2 = origy2 + bottom; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, color); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // is favorite? draw the star + if (isstar) + draw_star(x1, y1); + + // draw all lines + for (auto & elem : tempbuf) + { + mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + y1 += machine().ui().get_line_height(); + } +} + +//------------------------------------------------- +// handle select key event +//------------------------------------------------- + +void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) +{ + ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; + emu_options &mopt = machine().options(); + + if (ui_swinfo->startempty == 1) + { + std::vector biosname; + if (has_multiple_bios(ui_swinfo->driver, biosname) && !mopt.skip_bios_menu()) + ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo->driver, false, true)); + else + { + reselect_last::driver = ui_swinfo->driver->name; + reselect_last::software = "[Start empty]"; + reselect_last::swlist.clear(); + reselect_last::set(true); + machine().manager().schedule_new_driver(*ui_swinfo->driver); + machine().schedule_hard_reset(); + ui_menu::stack_reset(machine()); + } + } + + else + { + // first validate + driver_enumerator drivlist(machine().options(), *ui_swinfo->driver); + media_auditor auditor(drivlist); + drivlist.next(); + software_list_device *swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str()); + software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); + + media_auditor::summary summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST); + + if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + { + std::vector biosname; + if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) + { + ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo, true, false)); + return; + } + else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) + { + std::unordered_map parts; + for (const software_part *swpart = swinfo->first_part(); swpart != nullptr; swpart = swpart->next()) + { + if (swpart->matches_interface(ui_swinfo->interface.c_str())) + { + std::string menu_part_name(swpart->name()); + if (swpart->feature("part_id") != nullptr) + menu_part_name.assign("(").append(swpart->feature("part_id")).append(")"); + parts.emplace(swpart->name(), menu_part_name); + } + } + ui_menu::stack_push(global_alloc_clear(machine(), container, parts, ui_swinfo)); + return; + } + std::string error_string; + std::string string_list = std::string(ui_swinfo->listname).append(":").append(ui_swinfo->shortname).append(":").append(ui_swinfo->part).append(":").append(ui_swinfo->instance); + mopt.set_value(OPTION_SOFTWARENAME, string_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + std::string snap_list = std::string(ui_swinfo->listname).append(PATH_SEPARATOR).append(ui_swinfo->shortname); + mopt.set_value(OPTION_SNAPNAME, snap_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + reselect_last::driver = drivlist.driver().name; + reselect_last::software = ui_swinfo->shortname; + reselect_last::swlist = ui_swinfo->listname; + reselect_last::set(true); + machine().manager().schedule_new_driver(drivlist.driver()); + machine().schedule_hard_reset(); + ui_menu::stack_reset(machine()); + } + + // otherwise, display an error + else + { + reset(UI_MENU_RESET_REMEMBER_POSITION); + ui_error = true; + } + } +} + +//------------------------------------------------- +// handle special key event +//------------------------------------------------- + +void ui_menu_select_software::inkey_special(const ui_menu_event *m_event) +{ + int buflen = strlen(m_search); + + // if it's a backspace and we can handle it, do so + if ((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0) + { + *(char *)utf8_previous_char(&m_search[buflen]) = 0; + reset(UI_MENU_RESET_SELECT_FIRST); + } + + // if it's any other key and we're not maxed out, update + else if (m_event->unichar >= ' ' && m_event->unichar < 0x7f) + { + buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar); + m_search[buflen] = 0; + reset(UI_MENU_RESET_SELECT_FIRST); + } +} + +//------------------------------------------------- +// load custom filters info from file +//------------------------------------------------- + +void ui_menu_select_software::load_sw_custom_filters() +{ + // attempt to open the output file + emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); + if (file.open("custom_", m_driver->name, "_filter.ini") == FILERR_NONE) + { + char buffer[MAX_CHAR_INFO]; + + // get number of filters + file.gets(buffer, MAX_CHAR_INFO); + char *pb = strchr(buffer, '='); + sw_custfltr::numother = atoi(++pb) - 1; + + // get main filter + file.gets(buffer, MAX_CHAR_INFO); + pb = strchr(buffer, '=') + 2; + + for (int y = 0; y < sw_filters::length; ++y) + if (!strncmp(pb, sw_filters::text[y], strlen(sw_filters::text[y]))) + { + sw_custfltr::main = y; + break; + } + + for (int x = 1; x <= sw_custfltr::numother; ++x) + { + file.gets(buffer, MAX_CHAR_INFO); + char *cb = strchr(buffer, '=') + 2; + for (int y = 0; y < sw_filters::length; y++) + { + if (!strncmp(cb, sw_filters::text[y], strlen(sw_filters::text[y]))) + { + sw_custfltr::other[x] = y; + if (y == MEWUI_SW_PUBLISHERS) + { + file.gets(buffer, MAX_CHAR_INFO); + char *ab = strchr(buffer, '=') + 2; + for (size_t z = 0; z < m_filter.publisher.ui.size(); ++z) + if (!strncmp(ab, m_filter.publisher.ui[z].c_str(), m_filter.publisher.ui[z].length())) + sw_custfltr::mnfct[x] = z; + } + else if (y == MEWUI_SW_YEARS) + { + file.gets(buffer, MAX_CHAR_INFO); + char *db = strchr(buffer, '=') + 2; + for (size_t z = 0; z < m_filter.year.ui.size(); ++z) + if (!strncmp(db, m_filter.year.ui[z].c_str(), m_filter.year.ui[z].length())) + sw_custfltr::year[x] = z; + } + else if (y == MEWUI_SW_LIST) + { + file.gets(buffer, MAX_CHAR_INFO); + char *gb = strchr(buffer, '=') + 2; + for (size_t z = 0; z < m_filter.swlist.name.size(); ++z) + if (!strncmp(gb, m_filter.swlist.name[z].c_str(), m_filter.swlist.name[z].length())) + sw_custfltr::list[x] = z; + } + else if (y == MEWUI_SW_TYPE) + { + file.gets(buffer, MAX_CHAR_INFO); + char *fb = strchr(buffer, '=') + 2; + for (size_t z = 0; z < m_filter.type.ui.size(); ++z) + if (!strncmp(fb, m_filter.type.ui[z].c_str(), m_filter.type.ui[z].length())) + sw_custfltr::type[x] = z; + } + else if (y == MEWUI_SW_REGION) + { + file.gets(buffer, MAX_CHAR_INFO); + char *eb = strchr(buffer, '=') + 2; + for (size_t z = 0; z < m_filter.region.ui.size(); ++z) + if (!strncmp(eb, m_filter.region.ui[z].c_str(), m_filter.region.ui[z].length())) + sw_custfltr::region[x] = z; + } + } + } + } + file.close(); + } +} + +//------------------------------------------------- +// set software regions +//------------------------------------------------- + +void c_sw_region::set(std::string &str) +{ + std::string name = getname(str); + if (std::find(ui.begin(), ui.end(), name) != ui.end()) + return; + + ui.push_back(name); +} + +std::string c_sw_region::getname(std::string &str) +{ + std::string fullname(str); + strmakelower(fullname); + size_t found = fullname.find("("); + + if (found != std::string::npos) + { + size_t ends = fullname.find_first_not_of("abcdefghijklmnopqrstuvwxyz", found + 1); + std::string temp(fullname.substr(found + 1, ends - found - 1)); + + for (auto & elem : region_lists) + if (temp == elem) + return (str.substr(found + 1, ends - found - 1)); + } + return std::string(""); +} + +//------------------------------------------------- +// set software device type +//------------------------------------------------- + +void c_sw_type::set(std::string &str) +{ + if (std::find(ui.begin(), ui.end(), str) != ui.end()) + return; + + ui.push_back(str); +} + +//------------------------------------------------- +// set software years +//------------------------------------------------- + +void c_sw_year::set(std::string &str) +{ + if (std::find(ui.begin(), ui.end(), str) != ui.end()) + return; + + ui.push_back(str); +} + +//------------------------------------------------- +// set software publishers +//------------------------------------------------- + +void c_sw_publisher::set(std::string &str) +{ + std::string name = getname(str); + if (std::find(ui.begin(), ui.end(), name) != ui.end()) + return; + + ui.push_back(name); +} + +std::string c_sw_publisher::getname(std::string &str) +{ + size_t found = str.find("("); + + if (found != std::string::npos) + return (str.substr(0, found - 1)); + else + return str; +} + +//------------------------------------------------- +// build display list +//------------------------------------------------- +void ui_menu_select_software::build_list(std::vector &s_drivers, const char *filter_text, int filter) +{ + + if (s_drivers.empty() && filter == -1) + { + filter = sw_filters::actual; + s_drivers = m_sortedlist; + } + + // iterate over entries + for (auto & s_driver : s_drivers) + { + switch (filter) + { + case MEWUI_SW_PARENTS: + if (s_driver->parentname.empty()) + m_displaylist.push_back(s_driver); + break; + + case MEWUI_SW_CLONES: + if (!s_driver->parentname.empty()) + m_displaylist.push_back(s_driver); + break; + + case MEWUI_SW_AVAILABLE: + if (s_driver->available) + m_displaylist.push_back(s_driver); + break; + + case MEWUI_SW_UNAVAILABLE: + if (!s_driver->available) + m_displaylist.push_back(s_driver); + break; + + case MEWUI_SW_SUPPORTED: + if (s_driver->supported == SOFTWARE_SUPPORTED_YES) + m_displaylist.push_back(s_driver); + break; + + case MEWUI_SW_PARTIAL_SUPPORTED: + if (s_driver->supported == SOFTWARE_SUPPORTED_PARTIAL) + m_displaylist.push_back(s_driver); + break; + + case MEWUI_SW_UNSUPPORTED: + if (s_driver->supported == SOFTWARE_SUPPORTED_NO) + m_displaylist.push_back(s_driver); + break; + + case MEWUI_SW_REGION: + { + std::string name = m_filter.region.getname(s_driver->longname); + + if(!name.empty() && name == filter_text) + m_displaylist.push_back(s_driver); + break; + } + + case MEWUI_SW_PUBLISHERS: + { + std::string name = m_filter.publisher.getname(s_driver->publisher); + + if(!name.empty() && name == filter_text) + m_displaylist.push_back(s_driver); + break; + } + + case MEWUI_SW_YEARS: + if(s_driver->year == filter_text) + m_displaylist.push_back(s_driver); + break; + + case MEWUI_SW_LIST: + if(s_driver->listname == filter_text) + m_displaylist.push_back(s_driver); + break; + + case MEWUI_SW_TYPE: + if(s_driver->devicetype == filter_text) + m_displaylist.push_back(s_driver); + break; + + default: + m_displaylist.push_back(s_driver); + break; + } + } +} + +//------------------------------------------------- +// find approximate matches +//------------------------------------------------- + +void ui_menu_select_software::find_matches(const char *str, int count) +{ + // allocate memory to track the penalty value + std::vector penalty(count, 9999); + int index = 0; + + for (; m_displaylist[index]; ++index) + { + // pick the best match between driver name and description + int curpenalty = fuzzy_substring(str, m_displaylist[index]->longname); + int tmp = fuzzy_substring(str, m_displaylist[index]->shortname); + curpenalty = MIN(curpenalty, tmp); + + // insert into the sorted table of matches + for (int matchnum = count - 1; matchnum >= 0; --matchnum) + { + // stop if we're worse than the current entry + if (curpenalty >= penalty[matchnum]) + break; + + // as long as this isn't the last entry, bump this one down + if (matchnum < count - 1) + { + penalty[matchnum + 1] = penalty[matchnum]; + m_searchlist[matchnum + 1] = m_searchlist[matchnum]; + } + + m_searchlist[matchnum] = m_displaylist[index]; + penalty[matchnum] = curpenalty; + } + } + (index < count) ? m_searchlist[index] = nullptr : m_searchlist[count] = nullptr; +} + +//------------------------------------------------- +// build custom display list +//------------------------------------------------- + +void ui_menu_select_software::build_custom() +{ + std::vector s_drivers; + + build_list(m_sortedlist, nullptr, sw_custfltr::main); + + for (int count = 1; count <= sw_custfltr::numother; ++count) + { + int filter = sw_custfltr::other[count]; + s_drivers = m_displaylist; + m_displaylist.clear(); + + switch (filter) + { + case MEWUI_SW_YEARS: + build_list(s_drivers, m_filter.year.ui[sw_custfltr::year[count]].c_str(), filter); + break; + case MEWUI_SW_LIST: + build_list(s_drivers, m_filter.swlist.name[sw_custfltr::list[count]].c_str(), filter); + break; + case MEWUI_SW_TYPE: + build_list(s_drivers, m_filter.type.ui[sw_custfltr::type[count]].c_str(), filter); + break; + case MEWUI_SW_PUBLISHERS: + build_list(s_drivers, m_filter.publisher.ui[sw_custfltr::mnfct[count]].c_str(), filter); + break; + case MEWUI_SW_REGION: + build_list(s_drivers, m_filter.region.ui[sw_custfltr::region[count]].c_str(), filter); + break; + default: + build_list(s_drivers, nullptr, filter); + break; + } + } +} + +//------------------------------------------------- +// draw left box +//------------------------------------------------- + +float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, float y2) +{ + ui_manager &mui = machine().ui(); + + if (mewui_globals::panels_status == SHOW_PANELS || mewui_globals::panels_status == HIDE_RIGHT_PANEL) + { + float origy1 = y1; + float origy2 = y2; + float text_size = 0.75f; + float l_height = mui.get_line_height(); + float line_height = l_height * text_size; + float left_width = 0.0f; + int text_lenght = sw_filters::length; + int afilter = sw_filters::actual; + int phover = HOVER_SW_FILTER_FIRST; + const char **text = sw_filters::text; + float sc = y2 - y1 - (2.0f * UI_BOX_TB_BORDER); + + if ((text_lenght * line_height) > sc) + { + float lm = sc / (text_lenght); + text_size = lm / l_height; + line_height = l_height * text_size; + } + + float text_sign = mui.get_string_width_ex("_# ", text_size); + for (int x = 0; x < text_lenght; ++x) + { + float total_width; + + // compute width of left hand side + total_width = mui.get_string_width_ex(text[x], text_size); + total_width += text_sign; + + // track the maximum + if (total_width > left_width) + left_width = total_width; + } + + x2 = x1 + left_width + 2.0f * UI_BOX_LR_BORDER; + //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + y2 -= UI_BOX_TB_BORDER; + + for (int filter = 0; filter < text_lenght; ++filter) + { + std::string str(text[filter]); + rgb_t bgcolor = UI_TEXT_BG_COLOR; + rgb_t fgcolor = UI_TEXT_COLOR; + + if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y1 + line_height > mouse_y) + { + bgcolor = UI_MOUSEOVER_BG_COLOR; + fgcolor = UI_MOUSEOVER_COLOR; + hover = phover + filter; + } + + if (afilter == filter) + { + bgcolor = UI_SELECTED_BG_COLOR; + fgcolor = UI_SELECTED_COLOR; + } + + if (bgcolor != UI_TEXT_BG_COLOR) + container->add_rect(x1, y1, x2, y1 + line_height, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + + float x1t = x1 + text_sign; + if (afilter == MEWUI_SW_CUSTOM) + { + if (filter == sw_custfltr::main) + { + str.assign("@custom1 ").append(text[filter]); + x1t -= text_sign; + } + else + { + for (int count = 1; count <= sw_custfltr::numother; ++count) + { + int cfilter = sw_custfltr::other[count]; + if (cfilter == filter) + { + strprintf(str, "@custom%d %s", count + 1, text[filter]); + x1t -= text_sign; + break; + } + } + } + convert_command_glyph(str); + } + + mui.draw_text_full(container, str.c_str(), x1t, y1, x2 - x1, JUSTIFY_LEFT, WRAP_NEVER, + DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size); + y1 += line_height; + } + + x1 = x2 + UI_BOX_LR_BORDER; + x2 = x1 + 2.0f * UI_BOX_LR_BORDER; + y1 = origy1; + y2 = origy2; + line_height = mui.get_line_height(); + float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); + rgb_t fgcolor = UI_TEXT_COLOR; + + // set left-right arrows dimension + float ar_x0 = 0.5f * (x2 + x1) - 0.5f * lr_arrow_width; + float ar_y0 = 0.5f * (y2 + y1) + 0.1f * line_height; + float ar_x1 = ar_x0 + lr_arrow_width; + float ar_y1 = 0.5f * (y2 + y1) + 0.9f * line_height; + + //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + + if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y) + { + fgcolor = UI_MOUSEOVER_COLOR; + hover = HOVER_LPANEL_ARROW; + } + + draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X); + return x2 + UI_BOX_LR_BORDER; + } + else + { + float line_height = mui.get_line_height(); + float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); + rgb_t fgcolor = UI_TEXT_COLOR; + + // set left-right arrows dimension + float ar_x0 = 0.5f * (x2 + x1) - 0.5f * lr_arrow_width; + float ar_y0 = 0.5f * (y2 + y1) + 0.1f * line_height; + float ar_x1 = ar_x0 + lr_arrow_width; + float ar_y1 = 0.5f * (y2 + y1) + 0.9f * line_height; + + //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + + if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y) + { + fgcolor = UI_MOUSEOVER_COLOR; + hover = HOVER_LPANEL_ARROW; + } + + draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90); + return x2 + UI_BOX_LR_BORDER; + } +} + +//------------------------------------------------- +// draw infos +//------------------------------------------------- + +void ui_menu_select_software::infos_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) +{ + ui_manager &mui = machine().ui(); + float line_height = mui.get_line_height(); + static std::string buffer; + std::vector xstart; + std::vector xend; + float text_size = machine().options().infos_size(); + ui_software_info *soft = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr; + static ui_software_info *oldsoft = nullptr; + static int old_sw_view = -1; + + float gutter_width = 0.4f * line_height * machine().render().ui_aspect() * 1.3f; + float ud_arrow_width = line_height * machine().render().ui_aspect(); + float oy1 = origy1 + line_height; + + // apply title to right panel + if (soft && soft->usage.empty()) + { + mui.draw_text_full(container, "History", origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + mewui_globals::cur_sw_dats_view = 0; + } + else + { + float title_size = 0.0f; + float txt_lenght = 0.0f; + std::string t_text[2]; + t_text[0] = "History"; + t_text[1] = "Usage"; + + for (auto & elem : t_text) + { + mui.draw_text_full(container, elem.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr); + txt_lenght += 0.01f; + title_size = MAX(txt_lenght, title_size); + } + + mui.draw_text_full(container, t_text[mewui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1, + JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, + nullptr, nullptr); + + draw_common_arrow(origx1, origy1, origx2, origy2, mewui_globals::cur_sw_dats_view, 0, 1, title_size); + } + + if (oldsoft != soft || old_sw_view != mewui_globals::cur_sw_dats_view) + { + buffer.clear(); + old_sw_view = mewui_globals::cur_sw_dats_view; + oldsoft = soft; + if (mewui_globals::cur_sw_dats_view == 0) + { + if (soft->startempty == 1) + machine().datfile().load_data_info(soft->driver, buffer, MEWUI_HISTORY_LOAD); + else + machine().datfile().load_software_info(soft->listname, buffer, soft->shortname, soft->parentname); + } + else + buffer = soft->usage; + } + + if (buffer.empty()) + { + mui.draw_text_full(container, "No Infos Available", origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, JUSTIFY_CENTER, + WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + return; + } + else + mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, + xstart, xend, text_size); + + int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size)); + if (totallines < r_visible_lines) + r_visible_lines = totallines; + if (topline_datsview < 0) + topline_datsview = 0; + if (topline_datsview + r_visible_lines >= totallines) + topline_datsview = totallines - r_visible_lines; + + for (int r = 0; r < r_visible_lines; ++r) + { + int itemline = r + topline_datsview; + std::string tempbuf; + tempbuf.assign(buffer.substr(xstart[itemline], xend[itemline] - xstart[itemline])); + + // up arrow + if (r == 0 && topline_datsview != 0) + info_arrow(0, origx1, origx2, oy1, line_height, text_size, ud_arrow_width); + // bottom arrow + else if (r == r_visible_lines - 1 && itemline != totallines - 1) + info_arrow(1, origx1, origx2, oy1, line_height, text_size, ud_arrow_width); + else + mui.draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, + JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, + nullptr, nullptr, text_size); + oy1 += (line_height * text_size); + } + + // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow + right_visible_lines = r_visible_lines - (topline_datsview != 0) - (topline_datsview + r_visible_lines != totallines); +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_select_software::arts_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) +{ + ui_manager &mui = machine().ui(); + float line_height = mui.get_line_height(); + static ui_software_info *oldsoft = nullptr; + static const game_driver *olddriver = nullptr; + const game_driver *driver = nullptr; + ui_software_info *soft = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr; + + if (soft && soft->startempty == 1) + { + driver = soft->driver; + oldsoft = nullptr; + } + else + olddriver = nullptr; + + if (driver) + { + if (mewui_globals::default_image) + ((driver->flags & MACHINE_TYPE_ARCADE) == 0) ? mewui_globals::curimage_view = CABINETS_VIEW : mewui_globals::curimage_view = SNAPSHOT_VIEW; + + std::string searchstr; + searchstr = arts_render_common(origx1, origy1, origx2, origy2); + + // loads the image if necessary + if (driver != olddriver || !snapx_bitmap->valid() || mewui_globals::switch_image) + { + emu_file snapfile(searchstr.c_str(), OPEN_FLAG_READ); + bitmap_argb32 *tmp_bitmap; + tmp_bitmap = auto_alloc(machine(), bitmap_argb32); + + // try to load snapshot first from saved "0000.png" file + std::string fullname(driver->name); + render_load_png(*tmp_bitmap, snapfile, fullname.c_str(), "0000.png"); + + if (!tmp_bitmap->valid()) + render_load_jpeg(*tmp_bitmap, snapfile, fullname.c_str(), "0000.jpg"); + + // if fail, attemp to load from standard file + if (!tmp_bitmap->valid()) + { + fullname.assign(driver->name).append(".png"); + render_load_png(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(driver->name).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + } + } + + // if fail again, attemp to load from parent file + if (!tmp_bitmap->valid()) + { + // set clone status + bool cloneof = strcmp(driver->parent, "0"); + if (cloneof) + { + int cx = driver_list::find(driver->parent); + if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0)) + cloneof = false; + } + + if (cloneof) + { + fullname.assign(driver->parent).append(".png"); + render_load_png(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(driver->parent).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + } + } + } + + olddriver = driver; + mewui_globals::switch_image = false; + arts_render_images(tmp_bitmap, origx1, origy1, origx2, origy2, false); + auto_free(machine(), tmp_bitmap); + } + + // if the image is available, loaded and valid, display it + if (snapx_bitmap->valid()) + { + float x1 = origx1 + 0.01f; + float x2 = origx2 - 0.01f; + float y1 = origy1 + UI_BOX_TB_BORDER + line_height; + float y2 = origy2 - UI_BOX_TB_BORDER - line_height; + + // apply texture + container->add_quad( x1, y1, x2, y2, ARGB_WHITE, snapx_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + } + } + else if (soft) + { + std::string fullname, pathname; + if (mewui_globals::default_image) + (soft->startempty == 0) ? mewui_globals::curimage_view = SNAPSHOT_VIEW : mewui_globals::curimage_view = CABINETS_VIEW; + + // arts title and searchpath + std::string searchstr; + searchstr = arts_render_common(origx1, origy1, origx2, origy2); + + // loads the image if necessary + if (soft != oldsoft || !snapx_bitmap->valid() || mewui_globals::switch_image) + { + emu_file snapfile(searchstr.c_str(), OPEN_FLAG_READ); + bitmap_argb32 *tmp_bitmap; + tmp_bitmap = auto_alloc(machine(), bitmap_argb32); + + if (soft->startempty == 1) + { + // Load driver snapshot + fullname.assign(soft->driver->name).append(".png"); + render_load_png(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(soft->driver->name).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); + } + } + else if (mewui_globals::curimage_view == TITLES_VIEW) + { + // First attempt from name list + pathname.assign(soft->listname).append("_titles"); + fullname.assign(soft->shortname).append(".png"); + render_load_png(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(soft->shortname).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + } + } + else + { + // First attempt from name list + pathname = soft->listname; + fullname.assign(soft->shortname).append(".png"); + render_load_png(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(soft->shortname).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + } + + if (!tmp_bitmap->valid()) + { + // Second attempt from driver name + part name + pathname.assign(soft->driver->name).append(soft->part); + fullname.assign(soft->shortname).append(".png"); + render_load_png(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + + if (!tmp_bitmap->valid()) + { + fullname.assign(soft->shortname).append(".jpg"); + render_load_jpeg(*tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + } + } + } + + oldsoft = soft; + mewui_globals::switch_image = false; + arts_render_images(tmp_bitmap, origx1, origy1, origx2, origy2, true); + auto_free(machine(), tmp_bitmap); + } + + // if the image is available, loaded and valid, display it + if (snapx_bitmap->valid()) + { + float x1 = origx1 + 0.01f; + float x2 = origx2 - 0.01f; + float y1 = origy1 + UI_BOX_TB_BORDER + line_height; + float y2 = origy2 - UI_BOX_TB_BORDER - line_height; + + // apply texture + container->add_quad(x1, y1, x2, y2, ARGB_WHITE, snapx_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + } + } +} + +void ui_menu_select_software::draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) +{ + ui_manager &mui = machine().ui(); + float line_height = mui.get_line_height(); + float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); + rgb_t fgcolor = UI_TEXT_COLOR; + bool hide = (mewui_globals::panels_status == HIDE_RIGHT_PANEL || mewui_globals::panels_status == HIDE_BOTH); + float x2 = (hide) ? origx2 : origx1 + 2.0f * UI_BOX_LR_BORDER; + + // set left-right arrows dimension + float ar_x0 = 0.5f * (x2 + origx1) - 0.5f * lr_arrow_width; + float ar_y0 = 0.5f * (origy2 + origy1) + 0.1f * line_height; + float ar_x1 = ar_x0 + lr_arrow_width; + float ar_y1 = 0.5f * (origy2 + origy1) + 0.9f * line_height; + + //machine().ui().draw_outlined_box(container, origx1, origy1, origx2, origy2, UI_BACKGROUND_COLOR); + mui.draw_outlined_box(container, origx1, origy1, origx2, origy2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + + if (mouse_hit && origx1 <= mouse_x && x2 > mouse_x && origy1 <= mouse_y && origy2 > mouse_y) + { + fgcolor = UI_MOUSEOVER_COLOR; + hover = HOVER_RPANEL_ARROW; + } + + if (hide) + { + draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X); + return; + } + + draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90); + origx1 = x2; + origy1 = draw_right_box_title(origx1, origy1, origx2, origy2); + + if (mewui_globals::rpanel == RP_IMAGES) + arts_render(selectedref, origx1, origy1, origx2, origy2); + else + infos_render(selectedref, origx1, origy1, origx2, origy2); +} + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_mewui_software_parts::ui_mewui_software_parts(running_machine &machine, render_container *container, std::unordered_map parts, ui_software_info *ui_info) : ui_menu(machine, container) +{ + m_parts = parts; + m_uiinfo = ui_info; +} + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_mewui_software_parts::~ui_mewui_software_parts() +{ +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_mewui_software_parts::populate() +{ + for (auto & elem : m_parts) + item_append(elem.first.c_str(), elem.second.c_str(), 0, (void *)&elem); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_mewui_software_parts::handle() +{ + // process the menu + const ui_menu_event *event = process(0); + if (event != nullptr && event->iptkey == IPT_UI_SELECT && event->itemref != nullptr) + for (auto & elem : m_parts) + if ((void*)&elem == event->itemref) + { + std::string error_string; + std::string string_list = std::string(m_uiinfo->listname).append(":").append(m_uiinfo->shortname).append(":").append(elem.first).append(":").append(m_uiinfo->instance); + machine().options().set_value(OPTION_SOFTWARENAME, string_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + + reselect_last::driver = m_uiinfo->driver->name; + reselect_last::software = m_uiinfo->shortname; + reselect_last::swlist = m_uiinfo->listname; + reselect_last::set(true); + + std::string snap_list = std::string(m_uiinfo->listname).append("/").append(m_uiinfo->shortname); + machine().options().set_value(OPTION_SNAPNAME, snap_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + + machine().manager().schedule_new_driver(*m_uiinfo->driver); + machine().schedule_hard_reset(); + ui_menu::stack_reset(machine()); + } +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_mewui_software_parts::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + mui.draw_text_full(container, "Software part selection:", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + float maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, "Software part selection:", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_mewui_bios_selection::ui_mewui_bios_selection(running_machine &machine, render_container *container, std::vector biosname, void *_driver, bool _software, bool _inlist) : ui_menu(machine, container) +{ + m_bios = biosname; + m_driver = _driver; + m_software = _software; + m_inlist = _inlist; +} + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_mewui_bios_selection::~ui_mewui_bios_selection() +{ +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_mewui_bios_selection::populate() +{ + for (auto & elem : m_bios) + item_append(elem.name.c_str(), nullptr, 0, (void *)&elem.name); + + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_mewui_bios_selection::handle() +{ + // process the menu + const ui_menu_event *event = process(0); + emu_options &moptions = machine().options(); + if (event != nullptr && event->iptkey == IPT_UI_SELECT && event->itemref != nullptr) + for (auto & elem : m_bios) + if ((void*)&elem.name == event->itemref) + { + if (!m_software) + { + const game_driver *s_driver = (const game_driver *)m_driver; + reselect_last::driver = s_driver->name; + if (m_inlist) + reselect_last::software = "[Start empty]"; + else + { + reselect_last::software.clear(); + reselect_last::swlist.clear(); + reselect_last::set(true); + } + + std::string error; + moptions.set_value("bios", elem.id, OPTION_PRIORITY_CMDLINE, error); + machine().manager().schedule_new_driver(*s_driver); + machine().schedule_hard_reset(); + ui_menu::stack_reset(machine()); + } + else + { + ui_software_info *ui_swinfo = (ui_software_info *)m_driver; + std::string error; + machine().options().set_value("bios", elem.id, OPTION_PRIORITY_CMDLINE, error); + driver_enumerator drivlist(moptions, *ui_swinfo->driver); + drivlist.next(); + software_list_device *swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str()); + software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); + if (!moptions.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) + { + std::unordered_map parts; + for (const software_part *swpart = swinfo->first_part(); swpart != nullptr; swpart = swpart->next()) + { + if (swpart->matches_interface(ui_swinfo->interface.c_str())) + { + std::string menu_part_name(swpart->name()); + if (swpart->feature("part_id") != nullptr) + menu_part_name.assign("(").append(swpart->feature("part_id")).append(")"); + parts.emplace(swpart->name(), menu_part_name); + } + } + ui_menu::stack_push(global_alloc_clear(machine(), container, parts, ui_swinfo)); + return; + } + std::string error_string; + std::string string_list = std::string(ui_swinfo->listname).append(":").append(ui_swinfo->shortname).append(":").append(ui_swinfo->part).append(":").append(ui_swinfo->instance); + moptions.set_value(OPTION_SOFTWARENAME, string_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + std::string snap_list = std::string(ui_swinfo->listname).append(PATH_SEPARATOR).append(ui_swinfo->shortname); + moptions.set_value(OPTION_SNAPNAME, snap_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + reselect_last::driver = drivlist.driver().name; + reselect_last::software = ui_swinfo->shortname; + reselect_last::swlist = ui_swinfo->listname; + reselect_last::set(true); + machine().manager().schedule_new_driver(drivlist.driver()); + machine().schedule_hard_reset(); + ui_menu::stack_reset(machine()); + } + } +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_mewui_bios_selection::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + mui.draw_text_full(container, "Bios selection:", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + float maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, "Bios selection:", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} diff --git a/src/emu/ui/selsoft.h b/src/emu/ui/selsoft.h new file mode 100644 index 00000000000..9691e5ad118 --- /dev/null +++ b/src/emu/ui/selsoft.h @@ -0,0 +1,112 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/selsoft.h + + MEWUI softwares menu. + +***************************************************************************/ +#pragma once + +#ifndef __MEWUI_SELSOFT_H__ +#define __MEWUI_SELSOFT_H__ + +#include "ui/custmenu.h" + +struct s_bios +{ + s_bios(std::string _name, int _id) { name = _name; id = _id; } + std::string name; + int id; +}; + +// Menu Class +class ui_menu_select_software : public ui_menu +{ +public: + ui_menu_select_software(running_machine &machine, render_container *container, const game_driver *driver); + virtual ~ui_menu_select_software(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + + virtual bool menu_has_search_active() override { return (m_search[0] != 0); } + + // draw left panel + virtual float draw_left_panel(float x1, float y1, float x2, float y2) override; + + // draw right panel + virtual void draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) override; + +private: + enum { VISIBLE_GAMES_IN_SEARCH = 200 }; + char m_search[40]; + const game_driver *m_driver; + bool m_has_empty_start; + s_filter m_filter; + + ui_software_info *m_searchlist[VISIBLE_GAMES_IN_SEARCH + 1]; + std::vector m_displaylist, m_tmp, m_sortedlist; + std::vector m_swinfo; + + void build_software_list(); + void build_list(std::vector &vec, const char *filter_text = nullptr, int filter = -1); + void build_custom(); + void find_matches(const char *str, int count); + void load_sw_custom_filters(); + + void arts_render(void *selectedref, float x1, float y1, float x2, float y2); + void infos_render(void *selectedref, float x1, float y1, float x2, float y2); + + // handlers + void inkey_select(const ui_menu_event *menu_event); + void inkey_special(const ui_menu_event *menu_event); +}; + +class ui_mewui_software_parts : public ui_menu +{ +public: + ui_mewui_software_parts(running_machine &machine, render_container *container, std::unordered_map parts, ui_software_info *ui_info); + virtual ~ui_mewui_software_parts(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + ui_software_info *m_uiinfo; + std::unordered_map m_parts; +}; + +class ui_mewui_bios_selection : public ui_menu +{ +public: + ui_mewui_bios_selection(running_machine &machine, render_container *container, std::vector biosname, void *driver, bool software, bool inlist); + virtual ~ui_mewui_bios_selection(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + + void *m_driver; + bool m_software, m_inlist; + std::vector m_bios; +}; + +struct reselect_last +{ + static std::string driver, software, swlist; + static void set(bool value) { m_reselect = value; } + static bool get() { return m_reselect; } + static void reset() { driver.clear(); software.clear(); swlist.clear(); set(false); } + +private: + static bool m_reselect; +}; + +// Getter +bool has_multiple_bios(const game_driver *driver, std::vector &biosname); + + +#endif /* __MEWUI_SELSOFT_H__ */ diff --git a/src/emu/ui/sliders.cpp b/src/emu/ui/sliders.cpp index 23bd9013dba..e494213aa1b 100644 --- a/src/emu/ui/sliders.cpp +++ b/src/emu/ui/sliders.cpp @@ -108,14 +108,14 @@ void ui_menu_sliders::handle() /* if we got here via up or page up, select the previous item */ if (menu_event->iptkey == IPT_UI_UP || menu_event->iptkey == IPT_UI_PAGE_UP) { - selected = (selected + numitems - 1) % numitems; + selected = (selected + item.size() - 1) % item.size(); validate_selection(-1); } /* otherwise select the next item */ else if (menu_event->iptkey == IPT_UI_DOWN || menu_event->iptkey == IPT_UI_PAGE_DOWN) { - selected = (selected + 1) % numitems; + selected = (selected + 1) % item.size(); validate_selection(1); } } diff --git a/src/emu/ui/sndmenu.cpp b/src/emu/ui/sndmenu.cpp new file mode 100644 index 00000000000..d8dfa05404f --- /dev/null +++ b/src/emu/ui/sndmenu.cpp @@ -0,0 +1,166 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/********************************************************************* + + mewui/sndmenu.cpp + + Internal MEWUI user interface. + +*********************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "ui/sndmenu.h" +#include "ui/selector.h" +#include "cliopts.h" +#include "../osd/modules/lib/osdobj_common.h" // TODO: remove + +const int ui_menu_sound_options::m_sound_rate[] = { 11025, 22050, 44100, 48000 }; + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_menu_sound_options::ui_menu_sound_options(running_machine &machine, render_container *container) : ui_menu(machine, container) +{ + osd_options &options = downcast(machine.options()); + + m_sample_rate = machine.options().sample_rate(); + m_sound = (strcmp(options.sound(), OSDOPTVAL_NONE) && strcmp(options.sound(), "0")); + m_samples = machine.options().samples(); + + int total = ARRAY_LENGTH(m_sound_rate); + + for (m_cur_rates = 0; m_cur_rates < total; m_cur_rates++) + if (m_sample_rate == m_sound_rate[m_cur_rates]) + break; + + if (m_cur_rates == total) + m_cur_rates = 2; +} + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_menu_sound_options::~ui_menu_sound_options() +{ + std::string error_string; + emu_options &moptions = machine().options(); + + if (m_sound) + moptions.set_value(OSDOPTION_SOUND, OSDOPTVAL_AUTO, OPTION_PRIORITY_CMDLINE, error_string); + else + moptions.set_value(OSDOPTION_SOUND, OSDOPTVAL_NONE, OPTION_PRIORITY_CMDLINE, error_string); + + moptions.set_value(OPTION_SAMPLERATE, m_sound_rate[m_cur_rates], OPTION_PRIORITY_CMDLINE, error_string); + moptions.set_value(OPTION_SAMPLES, m_samples, OPTION_PRIORITY_CMDLINE, error_string); +} + +//------------------------------------------------- +// handle +//------------------------------------------------- + +void ui_menu_sound_options::handle() +{ + bool changed = false; + + // process the menu + const ui_menu_event *m_event = process(0); + + if (m_event != nullptr && m_event->itemref != nullptr) + { + switch ((FPTR)m_event->itemref) + { + case ENABLE_SOUND: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT) + { + m_sound = !m_sound; + changed = true; + } + break; + + case SAMPLE_RATE: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + (m_event->iptkey == IPT_UI_LEFT) ? m_cur_rates-- : m_cur_rates++; + changed = true; + } + else if (m_event->iptkey == IPT_UI_SELECT) + { + int total = ARRAY_LENGTH(m_sound_rate); + std::vector s_sel(total); + for (int index = 0; index < total; index++) + s_sel[index] = std::to_string(m_sound_rate[index]); + + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, m_cur_rates)); + } + break; + + case ENABLE_SAMPLES: + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT) + { + m_samples = !m_samples; + changed = true; + } + break; + } + } + + if (changed) + reset(UI_MENU_RESET_REMEMBER_REF); + +} + +//------------------------------------------------- +// populate +//------------------------------------------------- + +void ui_menu_sound_options::populate() +{ + UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_sound_rate) - 1, m_cur_rates); + m_sample_rate = m_sound_rate[m_cur_rates]; + std::string s_text; + strprintf(s_text, "%d", m_sample_rate); + + // add options items + item_append("Sound", m_sound ? "On" : "Off", m_sound ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)ENABLE_SOUND); + item_append("Sample Rate", s_text.c_str(), arrow_flags, (void *)(FPTR)SAMPLE_RATE); + item_append("Use External Samples", m_samples ? "On" : "Off", m_samples ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)ENABLE_SAMPLES); + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); +} + +//------------------------------------------------- +// perform our special rendering +//------------------------------------------------- + +void ui_menu_sound_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + float width; + ui_manager &mui = machine().ui(); + mui.draw_text_full(container, "Sound Options", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + float maxwidth = MAX(origx2 - origx1, width); + + // compute our bounds + float x1 = 0.5f - 0.5f * maxwidth; + float x2 = x1 + maxwidth; + float y1 = origy1 - top; + float y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + mui.draw_text_full(container, "Sound Options", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); +} diff --git a/src/emu/ui/sndmenu.h b/src/emu/ui/sndmenu.h new file mode 100644 index 00000000000..19112ad848f --- /dev/null +++ b/src/emu/ui/sndmenu.h @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/sndmenu.h + + Internal MEWUI user interface. + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_SNDMENU_H__ +#define __MEWUI_SNDMENU_H__ + +//------------------------------------------------- +// class sound options menu +//------------------------------------------------- +class ui_menu_sound_options : public ui_menu +{ +public: + ui_menu_sound_options(running_machine &machine, render_container *container); + virtual ~ui_menu_sound_options(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + +private: + enum + { + ENABLE_SOUND = 1, + SAMPLE_RATE, + ENABLE_SAMPLES + }; + + UINT16 m_cur_rates; + static const int m_sound_rate[]; + int m_sample_rate; + bool m_samples, m_sound; +}; + +#endif /* __MEWUI_SNDMENU_H__ */ diff --git a/src/emu/ui/starimg.h b/src/emu/ui/starimg.h new file mode 100644 index 00000000000..2704e486e5b --- /dev/null +++ b/src/emu/ui/starimg.h @@ -0,0 +1,37 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +static const UINT32 favorite_star_bmp[] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02D07A00, 0x15D07A00, 0x0FD07A00, 0x00D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x76D27F04, 0xBFDA9714, 0xB9D78F0E, 0x4DD17B01, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3BD07A00, 0xFFE8B228, 0xFFFDEB50, 0xFFFBE34A, 0xD0E1A11C, 0x13D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0BD07A00, 0xA0D48306, 0xFFFACE42, 0xFFFBCE45, 0xFFFCD146, 0xFFF2BD34, 0x67D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x49D27E03, 0xE9EAAB26, 0xFFFDD044, 0xFFF9C741, 0xFFFAC942, 0xFFFED245, 0xD1DF9716, 0x27D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xA2DB8D0F, 0xFFF6C236, 0xFFFAC740, 0xFFF8C53F, 0xFFF8C53F, 0xFFFDCB41, 0xF7F0B62E, 0x71D68308, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x31D07A00, 0xFFE7A420, 0xFFFDCA3F, 0xFFF8C23D, 0xFFF8C23D, 0xFFF8C23D, 0xFFF8C23D, 0xFFFCC83D, 0xE0E19818, 0x11D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x08D07A00, 0x99D38004, 0xFFF9C237, 0xFFFAC43C, 0xFFF8BF3A, 0xFFF8BF3A, 0xFFF8BF3A, 0xFFF8BF3A, 0xFFFBC53C, 0xFFF1B32B, 0x63D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01D07A00, 0x15D07A00, 0x24D07A00, 0x39D07A00, 0x4AD07A00, 0x79D48205, 0xE6E9A820, 0xFFFDC539, 0xFFF8BC37, 0xFFF8BC37, 0xFFF8BC37, 0xFFF8BC37, 0xFFF8BC37, 0xFFF9BD37, 0xFFFEC63A, 0xD8DF9613, 0x64D17C01, 0x3FD07A00, 0x2FD07A00, 0x1CD07A00, 0x0AD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x04D07A00, 0x3BD07A00, 0x8BD07A00, 0xA5D17B01, 0xBFDA940F, 0xCEE1A317, 0xE2E7B622, 0xF4EDC229, 0xFFF1C62D, 0xFFFAC735, 0xFFFABC35, 0xFFF8B934, 0xFFF8B934, 0xFFF8B934, 0xFFF8B934, 0xFFF8B934, 0xFFF8B934, 0xFFFCBF36, 0xFFF7C733, 0xFCEFC52C, 0xE9EABB24, 0xD8E4AE1D, 0xC6DD9C13, 0xB4D58608, 0x99D07A00, 0x75D07A00, 0x20D07A00, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01D07A00, 0xBBD78608, 0xFFE9AE1F, 0xFFF9D133, 0xFFFCD839, 0xFFFCD338, 0xFFFCCC36, 0xFFFCC333, 0xFFFCBB32, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFFAB831, 0xFFFCC033, 0xFFFCC735, 0xFFFCD037, 0xFFFCD739, 0xFFFBD536, 0xFFF5C92F, 0xE8E4A318, 0x55D78507, 0x00000000, 0x00000000, + 0x00000000, 0x13D07A00, 0xFFDF9212, 0xFFFABC2F, 0xFFF9B72F, 0xFFF8B32E, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B32D, 0xFFF9B52E, 0xFFF9B92F, 0xFFF6B52A, 0xC1DB8B0D, 0x00000000, 0x00000000, + 0x00000000, 0x07D07A00, 0xE6DC8B0E, 0xFFF4AB27, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFEFA421, 0xAAD9860A, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x5ED58005, 0xE8E39213, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF4A925, 0xE2DC890C, 0x45D27C02, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x41D07A00, 0xE7E18F11, 0xFFF3A420, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFEFA11D, 0xE0DB880A, 0x35D07A00, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x5DD47E03, 0xE6E08D0D, 0xFFF5A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF3A11D, 0xDFDB8609, 0x4FD27C01, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40D07A00, 0xE6E08A0C, 0xFFF29D19, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFEE9917, 0xDDDA8407, 0x30D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x5BD37D02, 0xE6DF880A, 0xFFF59C18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF29A16, 0xDCD98306, 0x49D17B01, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7BD07A00, 0xFFEF9311, 0xFFF69A15, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF69915, 0xFFE2890A, 0x3BD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01D07A00, 0xA2D17B00, 0xFFF59612, 0xFFF69713, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF79712, 0xFFE98D0B, 0x4BD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x14D07A00, 0xBED87F03, 0xFFF6940E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF7940E, 0xFFF1900B, 0x7ED07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x27D07A00, 0xD1DE8205, 0xFFF8920C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF6910C, 0xFFF5910C, 0xA5D27B01, 0x03D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40D07A00, 0xEAE48505, 0xFFFA9009, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF78E09, 0xC1D97F02, 0x17D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x57D17B00, 0xFBE88504, 0xFFF78D06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF38B06, 0xFFEC8705, 0xFFF18A06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF88E06, 0xD6DF8102, 0x2CD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x83D67D01, 0xFFED8503, 0xFFF48804, 0xFFF48804, 0xFFF48804, 0xFFF48804, 0xFFF28804, 0xFFEA8503, 0xCDDC7F02, 0x79D17B00, 0xA1D47C01, 0xEFE18102, 0xFFEE8604, 0xFFF38804, 0xFFF48804, 0xFFF48804, 0xFFF48804, 0xFFF88B04, 0xEFE58203, 0x46D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xA0D87D01, 0xFFED8401, 0xFFF48602, 0xFFF48602, 0xFFF48602, 0xFFEF8501, 0xE9DE7F01, 0x8FD67D00, 0x23D07A00, 0x04D07A00, 0x0DD07A00, 0x46D07A00, 0xC3D97D01, 0xFFE28001, 0xFFF38602, 0xFFF48602, 0xFFF48602, 0xFFF58702, 0xFDE88201, 0x59D17A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x5FD47B00, 0xF3E58000, 0xFFF18400, 0xFFED8200, 0xDEE07F01, 0x90D37B00, 0x1FD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01D07A00, 0x3BD07A00, 0xBDD67C00, 0xF2E48000, 0xFFEF8300, 0xFFF08300, 0xDEDF7E01, 0x34D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x10D07A00, 0x71D57C00, 0xD2DB7D00, 0x9AD87C00, 0x34D07A00, 0x0AD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x13D07A00, 0x52D27B00, 0xBBD97D00, 0xCBDA7D00, 0x5DD27B00, 0x0AD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; diff --git a/src/emu/ui/toolbar.h b/src/emu/ui/toolbar.h new file mode 100644 index 00000000000..145ab0e0cc5 --- /dev/null +++ b/src/emu/ui/toolbar.h @@ -0,0 +1,250 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +static const UINT32 toolbar_bitmap_bmp[][1024] = { +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02D07A00, 0x15D07A00, 0x0FD07A00, 0x00D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x76D27F04, 0xBFDA9714, 0xB9D78F0E, 0x4DD17B01, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3BD07A00, 0xFFE8B228, 0xFFFDEB50, 0xFFFBE34A, 0xD0E1A11C, 0x13D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0BD07A00, 0xA0D48306, 0xFFFACE42, 0xFFFBCE45, 0xFFFCD146, 0xFFF2BD34, 0x67D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x49D27E03, 0xE9EAAB26, 0xFFFDD044, 0xFFF9C741, 0xFFFAC942, 0xFFFED245, 0xD1DF9716, 0x27D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xA2DB8D0F, 0xFFF6C236, 0xFFFAC740, 0xFFF8C53F, 0xFFF8C53F, 0xFFFDCB41, 0xF7F0B62E, 0x71D68308, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x31D07A00, 0xFFE7A420, 0xFFFDCA3F, 0xFFF8C23D, 0xFFF8C23D, 0xFFF8C23D, 0xFFF8C23D, 0xFFFCC83D, 0xE0E19818, 0x11D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x08D07A00, 0x99D38004, 0xFFF9C237, 0xFFFAC43C, 0xFFF8BF3A, 0xFFF8BF3A, 0xFFF8BF3A, 0xFFF8BF3A, 0xFFFBC53C, 0xFFF1B32B, 0x63D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01D07A00, 0x15D07A00, 0x24D07A00, 0x39D07A00, 0x4AD07A00, 0x79D48205, 0xE6E9A820, 0xFFFDC539, 0xFFF8BC37, 0xFFF8BC37, 0xFFF8BC37, 0xFFF8BC37, 0xFFF8BC37, 0xFFF9BD37, 0xFFFEC63A, 0xD8DF9613, 0x64D17C01, 0x3FD07A00, 0x2FD07A00, 0x1CD07A00, 0x0AD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x04D07A00, 0x3BD07A00, 0x8BD07A00, 0xA5D17B01, 0xBFDA940F, 0xCEE1A317, 0xE2E7B622, 0xF4EDC229, 0xFFF1C62D, 0xFFFAC735, 0xFFFABC35, 0xFFF8B934, 0xFFF8B934, 0xFFF8B934, 0xFFF8B934, 0xFFF8B934, 0xFFF8B934, 0xFFFCBF36, 0xFFF7C733, 0xFCEFC52C, 0xE9EABB24, 0xD8E4AE1D, 0xC6DD9C13, 0xB4D58608, 0x99D07A00, 0x75D07A00, 0x20D07A00, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01D07A00, 0xBBD78608, 0xFFE9AE1F, 0xFFF9D133, 0xFFFCD839, 0xFFFCD338, 0xFFFCCC36, 0xFFFCC333, 0xFFFCBB32, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFF7B630, 0xFFFAB831, 0xFFFCC033, 0xFFFCC735, 0xFFFCD037, 0xFFFCD739, 0xFFFBD536, 0xFFF5C92F, 0xE8E4A318, 0x55D78507, 0x00000000, 0x00000000, + 0x00000000, 0x13D07A00, 0xFFDF9212, 0xFFFABC2F, 0xFFF9B72F, 0xFFF8B32E, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B32D, 0xFFF9B52E, 0xFFF9B92F, 0xFFF6B52A, 0xC1DB8B0D, 0x00000000, 0x00000000, + 0x00000000, 0x07D07A00, 0xE6DC8B0E, 0xFFF4AB27, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFEFA421, 0xAAD9860A, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x5ED58005, 0xE8E39213, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF4A925, 0xE2DC890C, 0x45D27C02, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x41D07A00, 0xE7E18F11, 0xFFF3A420, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFEFA11D, 0xE0DB880A, 0x35D07A00, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x5DD47E03, 0xE6E08D0D, 0xFFF5A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFF3A11D, 0xDFDB8609, 0x4FD27C01, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40D07A00, 0xE6E08A0C, 0xFFF29D19, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFF6A01C, 0xFFEE9917, 0xDDDA8407, 0x30D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x5BD37D02, 0xE6DF880A, 0xFFF59C18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFF29A16, 0xDCD98306, 0x49D17B01, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7BD07A00, 0xFFEF9311, 0xFFF69A15, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF59915, 0xFFF69915, 0xFFE2890A, 0x3BD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01D07A00, 0xA2D17B00, 0xFFF59612, 0xFFF69713, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF59612, 0xFFF79712, 0xFFE98D0B, 0x4BD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x14D07A00, 0xBED87F03, 0xFFF6940E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF5930E, 0xFFF7940E, 0xFFF1900B, 0x7ED07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x27D07A00, 0xD1DE8205, 0xFFF8920C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFF6910C, 0xFFF5910C, 0xA5D27B01, 0x03D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40D07A00, 0xEAE48505, 0xFFFA9009, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF58D09, 0xFFF78E09, 0xC1D97F02, 0x17D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x57D17B00, 0xFBE88504, 0xFFF78D06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF38B06, 0xFFEC8705, 0xFFF18A06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF48B06, 0xFFF88E06, 0xD6DF8102, 0x2CD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x83D67D01, 0xFFED8503, 0xFFF48804, 0xFFF48804, 0xFFF48804, 0xFFF48804, 0xFFF28804, 0xFFEA8503, 0xCDDC7F02, 0x79D17B00, 0xA1D47C01, 0xEFE18102, 0xFFEE8604, 0xFFF38804, 0xFFF48804, 0xFFF48804, 0xFFF48804, 0xFFF88B04, 0xEFE58203, 0x46D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xA0D87D01, 0xFFED8401, 0xFFF48602, 0xFFF48602, 0xFFF48602, 0xFFEF8501, 0xE9DE7F01, 0x8FD67D00, 0x23D07A00, 0x04D07A00, 0x0DD07A00, 0x46D07A00, 0xC3D97D01, 0xFFE28001, 0xFFF38602, 0xFFF48602, 0xFFF48602, 0xFFF58702, 0xFDE88201, 0x59D17A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x5FD47B00, 0xF3E58000, 0xFFF18400, 0xFFED8200, 0xDEE07F01, 0x90D37B00, 0x1FD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01D07A00, 0x3BD07A00, 0xBDD67C00, 0xF2E48000, 0xFFEF8300, 0xFFF08300, 0xDEDF7E01, 0x34D07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x10D07A00, 0x71D57C00, 0xD2DB7D00, 0x9AD87C00, 0x34D07A00, 0x0AD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x13D07A00, 0x52D27B00, 0xBBD97D00, 0xCBDA7D00, 0x5DD27B00, 0x0AD07A00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}, + +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x41D07A00, 0x8BD07A00, 0xAAD07A00, 0xAAD07A00, 0xAAC48715, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAACA810B, 0xAAD07A00, 0xA4D07A00, 0x7DD07A00, 0x1CD07A00, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x07D07A00, 0x7BD38206, 0xFFE8B82B, 0xFFF9E24B, 0xFFFEEE55, 0xFFFDEE55, 0xFFCBA95F, 0xFFEBEBEB, 0xFFF1F1F1, 0xFFF3F3F3, 0xFFF7F7F7, 0xFFF9F9F9, 0xFFFCFCFC, 0xFFFEFEFE, 0xFFFEFEFE, 0xFFFEFEFE, 0xFFFCFCFC, 0xFFFAFAFA, 0xFFF7F7F7, 0xFFF5F5F5, 0xFFF2F2F2, 0xFFE9E9E9, 0xFFD4AC2F, 0xFFFDEE55, 0xFFFDEC53, 0xFFF6DE47, 0xE4DE9E19, 0x49D38105, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x2DD07A00, 0xD7E39E1C, 0xFFFDDC4A, 0xFFFBD047, 0xFFFACC45, 0xFFF9CB45, 0xFFC4A258, 0xFFD0D0D0, 0xFFD6D6D6, 0xFFDDDDDD, 0xFFE6E6E6, 0xFFEEEEEE, 0xFFF6F6F6, 0xFFFBFBFB, 0xFFF0E5CC, 0xFFD4B167, 0xFFD2B066, 0xFFD0AE64, 0xFFE9E9E9, 0xFFE1E1E1, 0xFFD8D8D8, 0xFFD2D2D2, 0xFFD3A12A, 0xFFF9CB45, 0xFFFACD46, 0xFFFBD348, 0xFFF7CD3E, 0xB2DB9112, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x52D07A00, 0xFCEBAD2C, 0xFFFCCC44, 0xFFF9C943, 0xFFF9C943, 0xFFF9C943, 0xFFC4A258, 0xFFD0D0D0, 0xFFD6D6D6, 0xFFDDDDDD, 0xFFE6E6E6, 0xFFEEEEEE, 0xFFF6F6F6, 0xFFFBFBFB, 0xFFE9D8B3, 0xFFE6B437, 0xFFF9C943, 0xFFD3A02A, 0xFFE9E9E9, 0xFFE1E1E1, 0xFFD8D8D8, 0xFFD2D2D2, 0xFFD3A02A, 0xFFF9C943, 0xFFF9C943, 0xFFF9C943, 0xFFFBCB44, 0xFADD9416, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFEBAD2B, 0xFFF9C741, 0xFFF9C741, 0xFFF9C741, 0xFFF9C741, 0xFFC4A258, 0xFFD0D0D0, 0xFFD6D6D6, 0xFFDDDDDD, 0xFFE6E6E6, 0xFFEEEEEE, 0xFFF6F6F6, 0xFFFBFBFB, 0xFFE9D8B3, 0xFFE6B335, 0xFFF9C741, 0xFFD3A029, 0xFFE9E9E9, 0xFFE1E1E1, 0xFFD8D8D8, 0xFFD2D2D2, 0xFFD3A029, 0xFFF9C741, 0xFFF9C741, 0xFFF9C741, 0xFFF9C741, 0xFFDD9416, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFEAAB2A, 0xFFF8C43F, 0xFFF8C43F, 0xFFF8C43F, 0xFFF8C43F, 0xFFC4A258, 0xFFD0D0D0, 0xFFD6D6D6, 0xFFDDDDDD, 0xFFE6E6E6, 0xFFEEEEEE, 0xFFF6F6F6, 0xFFFBFBFB, 0xFFE9D8B3, 0xFFE5B133, 0xFFF8C43F, 0xFFD29F28, 0xFFE9E9E9, 0xFFE1E1E1, 0xFFD8D8D8, 0xFFD2D2D2, 0xFFD29F28, 0xFFF8C43F, 0xFFF8C43F, 0xFFF8C43F, 0xFFF8C43F, 0xFFDD9315, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFEAAA28, 0xFFF8C23C, 0xFFF8C23C, 0xFFF8C23C, 0xFFF8C23C, 0xFFC4A258, 0xFFD0D0D0, 0xFFD6D6D6, 0xFFDDDDDD, 0xFFE6E6E6, 0xFFEEEEEE, 0xFFF6F6F6, 0xFFFBFBFB, 0xFFE9D8B3, 0xFFE5B032, 0xFFF8C23C, 0xFFD29E27, 0xFFE9E9E9, 0xFFE1E1E1, 0xFFD8D8D8, 0xFFD2D2D2, 0xFFD29E27, 0xFFF8C23C, 0xFFF8C23C, 0xFFF8C23C, 0xFFF8C23C, 0xFFDD9214, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFEAA826, 0xFFF8BF39, 0xFFF8BF39, 0xFFF8BF39, 0xFFF8BF39, 0xFFC9A352, 0xFFCFCDC7, 0xFFD6D6D6, 0xFFDDDDDD, 0xFFE6E6E6, 0xFFEEEEEE, 0xFFF6F6F6, 0xFFFBFBFB, 0xFFE9D8B3, 0xFFD8A329, 0xFFE5AE30, 0xFFCC9723, 0xFFECECEC, 0xFFE1E1E1, 0xFFD8D8D8, 0xFFD0CCC2, 0xFFD8A128, 0xFFF8BF39, 0xFFF8BF39, 0xFFF8BF39, 0xFFF8BF39, 0xFFDD9113, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFEAA624, 0xFFF8BC36, 0xFFF8BC36, 0xFFF8BC36, 0xFFF8BC36, 0xFFD7A63B, 0xFFCCBFA3, 0xFFD6D6D6, 0xFFDDDDDD, 0xFFE6E6E6, 0xFFEEEEEE, 0xFFF6F6F6, 0xFFFBFBFB, 0xFFF8F2E6, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFF5F5F5, 0xFFE1E1E1, 0xFFD8D7D5, 0xFFCBB280, 0xFFE9AF2F, 0xFFF8BC36, 0xFFF8BC36, 0xFFF8BC36, 0xFFF8BC36, 0xFFDD9012, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFEAA422, 0xFFF8B933, 0xFFF8B933, 0xFFF8B933, 0xFFF8B933, 0xFFF1B430, 0xFFD6A02D, 0xFFD0B57B, 0xFFD3C099, 0xFFD9C8A3, 0xFFDFCDA8, 0xFFE4D3AE, 0xFFE7D6B1, 0xFFE9D8B3, 0xFFE8D7B2, 0xFFE5D3AE, 0xFFE1CFAA, 0xFFDBCAA5, 0xFFD5C298, 0xFFD0AB5D, 0xFFDDA42C, 0xFFF8B933, 0xFFF8B933, 0xFFF8B933, 0xFFF8B933, 0xFFF8B933, 0xFFDD8F11, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFEAA120, 0xFFF7B530, 0xFFF7B530, 0xFFF7B530, 0xFFF7B530, 0xFFF7B530, 0xFFF4B32F, 0xFFE9AB2B, 0xFFE5A72A, 0xFFE4A729, 0xFFE4A729, 0xFFE4A729, 0xFFE4A729, 0xFFE4A729, 0xFFE4A729, 0xFFE4A729, 0xFFE4A729, 0xFFE4A729, 0xFFE5A82A, 0xFFEDAE2D, 0xFFF5B430, 0xFFF7B530, 0xFFF7B530, 0xFFF7B530, 0xFFF7B530, 0xFFF7B530, 0xFFDD8E10, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFEA9F1E, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFF7B22D, 0xFFDD8D0F, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFEA9D1C, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFF7AF2A, 0xFFDD8B0E, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFEA9A19, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF0A725, 0xFFE8A324, 0xFFE4A123, 0xFFE4A123, 0xFFE4A123, 0xFFE4A123, 0xFFE4A123, 0xFFE4A123, 0xFFE4A123, 0xFFE4A123, 0xFFE4A123, 0xFFE4A123, 0xFFE4A123, 0xFFE4A123, 0xFFE5A124, 0xFFE9A424, 0xFFF4AA26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFF7AB26, 0xFFDD8A0D, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFE99917, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFE9A122, 0xFFD7A84A, 0xFFE5CC98, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFEAD8B3, 0xFFE9D6AE, 0xFFE4C78C, 0xFFD89C2A, 0xFFF0A522, 0xFFF6A823, 0xFFF6A823, 0xFFF6A823, 0xFFDD890B, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFE99614, 0xFFF6A41F, 0xFFF6A41F, 0xFFEFA11F, 0xFFD7A94D, 0xFFFBF9F6, 0xFFF7F7F7, 0xFFEFEFEF, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFF2F2F2, 0xFFF8F8F8, 0xFFEEE1C5, 0xFFDBA136, 0xFFF6A41F, 0xFFF6A41F, 0xFFF6A41F, 0xFFDC880A, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFE99413, 0xFFF6A11C, 0xFFF6A11C, 0xFFE79B1C, 0xFFDDC594, 0xFFF3F3F3, 0xFFEDEDED, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFEDEDED, 0xFFF2EFEA, 0xFFD2AA59, 0xFFF6A11C, 0xFFF6A11C, 0xFFF6A11C, 0xFFDC8709, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFE99110, 0xFFF69D18, 0xFFF69D18, 0xFFE49719, 0xFFDCCAA5, 0xFFE9E9E9, 0xFFE2E2E2, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFE6E6E6, 0xFFEAEAEA, 0xFFCEAB61, 0xFFF69D18, 0xFFF69D18, 0xFFF69D18, 0xFFDC8608, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFE88F0E, 0xFFF59A15, 0xFFF59A15, 0xFFE39518, 0xFFDAC9A4, 0xFFE7E7E7, 0xFFE0E0E0, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFE4E4E4, 0xFFE7E7E7, 0xFFCDAA60, 0xFFF59A15, 0xFFF59A15, 0xFFF59A15, 0xFFDC8507, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFE88D0C, 0xFFF59712, 0xFFF59712, 0xFFE39315, 0xFFD8C6A1, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFCCA95F, 0xFFF59712, 0xFFF59712, 0xFFF59712, 0xFFDC8406, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFE88B0A, 0xFFF5930F, 0xFFF5930F, 0xFFE39114, 0xFFD5C49F, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFCBA85E, 0xFFF5930F, 0xFFF5930F, 0xFFF5930F, 0xFFDC8205, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFE88808, 0xFFF5900C, 0xFFF5900C, 0xFFE38E11, 0xFFD3C29D, 0xFFDCDCDC, 0xFFCECECE, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFC7C7C7, 0xFFD6D6D6, 0xFFDDDDDD, 0xFFCAA75D, 0xFFF5900C, 0xFFF5900C, 0xFFF5900C, 0xFFDC8104, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFE88706, 0xFFF58E09, 0xFFF58E09, 0xFFE38D10, 0xFFD1C09B, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFC8A65C, 0xFFF58E09, 0xFFF58E09, 0xFFF58E09, 0xFFDC8103, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x55D07A00, 0xFFE88504, 0xFFF48B07, 0xFFF48B07, 0xFFE38B0E, 0xFFCEBD98, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFD6D6D6, 0xFFC7A55B, 0xFFF48B07, 0xFFF48B07, 0xFFF48B07, 0xFFDC8002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x52D07A00, 0xFCE78404, 0xFFF48905, 0xFFF48905, 0xFFE28A0D, 0xFFCDBC97, 0xFFD3D3D3, 0xFFC6C6C6, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFCDCDCD, 0xFFD4D4D4, 0xFFC7A45A, 0xFFF48905, 0xFFF48905, 0xFFF38905, 0xFADC7F02, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x2ED07A00, 0xD8DF7F01, 0xFFF38602, 0xFFF48602, 0xFFE2880B, 0xFFCBBA95, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFC6A359, 0xFFF48602, 0xFFF48602, 0xFFED8402, 0xB2D97D01, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x08D07A00, 0x7BD37B00, 0xFFE27F00, 0xFFF08401, 0xFFE2870A, 0xFFCAB893, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFC5A258, 0xFFF38501, 0xFFEE8301, 0xE4DB7D00, 0x49D27B00, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x43D07A00, 0x8DD07A00, 0xAACD7D05, 0xAAC28919, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC08C1D, 0xAAC48715, 0xA5D07A00, 0x7FD07A00, 0x1DD07A00, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}, + +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0E999999, 0x59999999, 0x9E999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0x8B999999, 0x41999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x0F999999, 0xC8AEAEAE, 0xFFDADADA, 0xFFF7F7F7, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFF1F1F1, 0xFFCDCDCD, 0x7BA1A1A1, 0x08999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x5B999999, 0xFFDADADA, 0xFFF8F8F8, 0xFFF2F2F2, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFF0F0F0, 0xFFF3F3F3, 0xFFFAFAFA, 0xD8BFBFBF, 0x2E999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xA3999999, 0xFFEEEEEE, 0xFFF0F0F0, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFF2F2F2, 0xFCD1D1D1, 0x53999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFB5B5B5, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFD3D3D3, 0xFFEDEDED, 0xFFEDEDED, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFDADADA, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFE4E4E4, 0xFFEDEDED, 0xFFEDEDED, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFD0D0D0, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFCFCFCF, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFD8D8D8, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFE1E1E1, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFCFCFCF, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFB4B4B4, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFD0D0D0, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFCECECE, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFCDCDCD, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFCDCDCD, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFCCCCCC, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFCBCBCB, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFB2B2B2, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFCCCCCC, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFCBCBCB, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFD2D2D2, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFB0BABD, 0xFFAEB9BC, 0xFFDADBDB, 0xFFABC1C8, 0xFFD9DDDE, 0xFFCACACA, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFDEE0E0, 0xFFBECFD4, 0xFFC5D1D4, 0xFF6CADC1, 0xFF53B4CE, 0xFF89B6C4, 0xFF35AAC8, 0xFFA8C3CC, 0xFFA6B9BE, 0x59758F96, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFD2D7D9, 0xFF5CABC4, 0xFF4AB6D1, 0xFF35ACD0, 0xFF2ABAE5, 0xFF25B0D9, 0xFF28B6E3, 0xFF49ACC8, 0xFF3AACCB, 0x632385A4, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFDEDFDF, 0xFFA7C0C9, 0xFF79B4C5, 0xFF3CA1C0, 0xFF29B3E0, 0xFF25B0DC, 0xFF5DC2E3, 0xFFB1E2F2, 0xFF59C2E3, 0xFF26B3DE, 0xFF26A8D2, 0xA41C8CAD, 0x661783A4, 0x180E6784, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFC0C0C0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFDEDEDE, 0xFF87AEBA, 0xFF24A7D1, 0xFF25ABD5, 0xFF25A8D1, 0xFF1EA4CF, 0xFF9BD7EA, 0xFFFFFFFF, 0xFF91D3E8, 0xFF23A6D0, 0xFF25A9D2, 0xFD26ACD4, 0xD11E94B8, 0x280D647F, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFBFBFBF, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFBFCCD1, 0xFF85B3C2, 0xFF1F96BC, 0xFF229FC7, 0xFF229FC6, 0xFF1B9BC5, 0xFF95D1E4, 0xFFFFFFFF, 0xFF8DCDE2, 0xFF219DC6, 0xFF229FC6, 0xFF22A0C8, 0xBE1986A9, 0x46137696, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFF77A5B4, 0xFF2795B9, 0xFF2099C0, 0xFF2097BD, 0xFF2097BD, 0xFF1A95BC, 0xFF8BC9DD, 0xFFFEFEFF, 0xFF7CC2D8, 0xFF1D96BC, 0xFF2097BD, 0xFF2097BE, 0xFB219BC1, 0xDE1780A1, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFCBD2D3, 0xFF5293A8, 0xFF1D8FB3, 0xFF1C8EB1, 0xFF1C8EB1, 0xFF198CB0, 0xFF77BAD0, 0xFFFCFDFE, 0xFF64B1CA, 0xFF178BAF, 0xFF1C8EB1, 0xFF1C8EB2, 0xF21984A6, 0x5E0F6884, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFF85ABB8, 0xFF2789AA, 0xFF1B87A9, 0xFF1A85A7, 0xFF1A85A7, 0xFF1884A6, 0xFF69AEC5, 0xFFF9FCFD, 0xFF51A2BC, 0xFF1683A5, 0xFF1A85A7, 0xFF1A85A7, 0xFB1B88AB, 0xC0147695, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFAFC0C6, 0xFF5F95A6, 0xFF177998, 0xFF187C9D, 0xFF187C9C, 0xFF177B9C, 0xFF2C87A4, 0xFF75B0C3, 0xFF1E7F9F, 0xFF177B9C, 0xFF187C9C, 0xFF177D9D, 0xD7147190, 0x7C0F6682, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFF94B1B9, 0xFF167695, 0xFF167695, 0xFF157593, 0xFF137492, 0xFF4E97AE, 0xFFA3CAD6, 0xFF4390A9, 0xFF147492, 0xFF157593, 0xFF177796, 0xBD126D8B, 0x190B5B75, + 0x00000000, 0x00000000, 0x00000000, 0x91999999, 0xFFD2D2D2, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD6D7D8, 0xFF7FA4B0, 0xFF4D899B, 0xFF21718B, 0xFF136D8A, 0xFF0C6986, 0xFF7FB0BF, 0xFFE5EFF2, 0xFF78ABBB, 0xFF116C89, 0xFC136C88, 0xCA106682, 0x990F6580, 0x240B5E78, + 0x00000000, 0x00000000, 0x00000000, 0x45999999, 0xFFBCBCBC, 0xFFD8D8D8, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD3D6D6, 0xFFBFC9CC, 0xFF3D7E93, 0xFF126681, 0xFF116682, 0xFF22728B, 0xFF44889D, 0xFF1F6F89, 0xF90F6480, 0xFC116681, 0x620D607A, 0x0A0A5A74, 0x020A5B75, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7B9C9C9C, 0xD7B1B1B1, 0xFAC1C1C1, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFBDBFC0, 0xFF819BA4, 0xFF96A8AD, 0xFF467C8E, 0xF220687F, 0xCB276A7F, 0xE90E607A, 0x520B5D77, 0x5F0B5D77, 0x2B0B5D77, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x07999999, 0x2D999999, 0x50999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x72407283, 0x6626687D, 0x22467584, 0x800B5C76, 0x1A0A5B75, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}, + +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0E999999, 0x59999999, 0x9E999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0x8B999999, 0x41999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x0F999999, 0xC8AEAEAE, 0xFFDADADA, 0xFFF7F7F7, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFF1F1F1, 0xFFCDCDCD, 0x7BA1A1A1, 0x08999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x5B999999, 0xFFDADADA, 0xFFF8F8F8, 0xFFF2F2F2, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFF0F0F0, 0xFFF3F3F3, 0xFFFAFAFA, 0xD8BFBFBF, 0x2E999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xA3999999, 0xFFEEEEEE, 0xFFF0F0F0, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFF2F2F2, 0xFCD1D1D1, 0x53999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFB5B5B5, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFD3D3D3, 0xFFEDEDED, 0xFFEDEDED, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFDADADA, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFE4E4E4, 0xFFEDEDED, 0xFFEDEDED, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFD0D0D0, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFCFCFCF, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFD8D8D8, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFE1E1E1, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFCFCFCF, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFB4B4B4, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFD0D0D0, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFCECECE, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFCDCDCD, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFCDCDCD, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFCCCCCC, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFCBCBCB, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFB2B2B2, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFCCCCCC, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFCBCBCB, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFD2D2D2, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFDBDBDB, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFCACACA, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFBAC5A7, 0xFFB5C29F, 0xFFD6D8D1, 0xFF9AB077, 0xFFD1D5CA, 0xFFC9C9C9, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFDCDDDA, 0xFFB2C09C, 0xFFB9C3A7, 0xFF95B06E, 0xFF99BE65, 0xFF94AE6B, 0xFF91B959, 0xFFB3C09D, 0xFF9EAD84, 0x5C778B57, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFDADBD8, 0xFFC9CEBF, 0xFF90AE62, 0xFF93BE57, 0xFF8EB853, 0xFF97C060, 0xFFA2C86F, 0xFF94BE5D, 0xFF89B24D, 0xFF8DB852, 0x6B678E2C, 0x0E446804, 0x03466A06, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFC0C0C0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFDDDEDC, 0xFFA5B68A, 0xFF92B263, 0xFF86AD4F, 0xFF8FB957, 0xFF8BB551, 0xFFB8D295, 0xFFEAF2E1, 0xFFB4D08F, 0xFF8DB754, 0xFF89B350, 0xCE76A038, 0xA16E962E, 0x27517612, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFBFBFBF, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFDEDEDE, 0xFFB2BC9F, 0xFF81AA47, 0xFF87B14F, 0xFF84AE4C, 0xFF80AB46, 0xFFC7DAAE, 0xFFFFFFFF, 0xFFC3D8A8, 0xFF84AE4B, 0xFF85AF4D, 0xFF8AB552, 0xBE6F9633, 0x1A466B07, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFB4BFA1, 0xFF8FAA64, 0xFF7BA53F, 0xFF7FA845, 0xFF7EA745, 0xFF7BA53F, 0xFFC0D4A4, 0xFFFFFFFF, 0xFFBAD09D, 0xFF7DA743, 0xFF7EA745, 0xFF80A946, 0xD9709931, 0x815C831C, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFAAB893, 0xFF7C9F48, 0xFF779F3C, 0xFF769F3B, 0xFF769F3B, 0xFF739C37, 0xFFB4CA93, 0xFFFEFEFD, 0xFFA9C284, 0xFF739D38, 0xFF769F3B, 0xFF769E3B, 0xFB769E3B, 0xBE628925, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFCBCFC5, 0xFF7D9A4F, 0xFF729935, 0xFF709834, 0xFF709734, 0xFF6E9631, 0xFFA7BF82, 0xFFFDFDFC, 0xFF9BB670, 0xFF6D9530, 0xFF709734, 0xFF709835, 0xF268902A, 0x5E517611, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFF98A979, 0xFF6A8F2F, 0xFF678E2A, 0xFF688F2A, 0xFF688F2A, 0xFF678E29, 0xFF90AC63, 0xFFE7EDDE, 0xFF7FA04C, 0xFF668D27, 0xFF688F2A, 0xFF678E2A, 0xFB688F2A, 0xDC5A801A, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFCACEC4, 0xFFA3B28B, 0xFF5E8420, 0xFF618824, 0xFF618823, 0xFF618823, 0xFF678C2B, 0xFF83A153, 0xFF618824, 0xFF608723, 0xFF618823, 0xFF628924, 0xBC557A16, 0x434E730F, + 0x00000000, 0x00000000, 0x00000000, 0x91999999, 0xFFD2D2D2, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD8D8D7, 0xFF93A575, 0xFF5A811C, 0xFF597F1A, 0xFF597F1A, 0xFF567D15, 0xFFA1B77D, 0xFFF3F6EF, 0xFF98B072, 0xFF587E18, 0xFF597F1A, 0xFD59801A, 0xCF547A14, 0x27476B07, + 0x00000000, 0x00000000, 0x00000000, 0x45999999, 0xFFBCBCBC, 0xFFD8D8D8, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD8D8D7, 0xFFB3BDA3, 0xFF9BAC80, 0xFF658430, 0xFF557B16, 0xFF517810, 0xFF91A968, 0xFFDAE2CC, 0xFF8BA560, 0xFF527913, 0xFA537914, 0x9B4D720D, 0x5C4C710D, 0x15476C08, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7B9C9C9C, 0xD7B1B1B1, 0xFAC1C1C1, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFB8BBB3, 0xFF6E8744, 0xFF5E7A2D, 0xFF54761A, 0xFD4C720C, 0xF64C720C, 0xFB4C720B, 0xC54B700B, 0xD94C720D, 0x53496E0A, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x07999999, 0x2D999999, 0x50999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55969793, 0x55728354, 0x557E8A69, 0xAB52731A, 0xBC4A6E0A, 0x70486C0A, 0xE0496D08, 0x41466B06, 0x2F476B07, 0x16476B07, 0x00000000, 0x00000000 +}, + +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0E999999, 0x59999999, 0x9E999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0x8B999999, 0x41999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x0F999999, 0xC8AEAEAE, 0xFFDADADA, 0xFFF7F7F7, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFF1F1F1, 0xFFCDCDCD, 0x7BA1A1A1, 0x08999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x5B999999, 0xFFDADADA, 0xFFF8F8F8, 0xFFF2F2F2, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFF0F0F0, 0xFFF3F3F3, 0xFFFAFAFA, 0xD8BFBFBF, 0x2E999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xA3999999, 0xFFEEEEEE, 0xFFF0F0F0, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFF2F2F2, 0xFCD1D1D1, 0x53999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFB5B5B5, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFD3D3D3, 0xFFEDEDED, 0xFFEDEDED, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFDADADA, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFE4E4E4, 0xFFEDEDED, 0xFFEDEDED, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFD0D0D0, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFCFCFCF, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFD8D8D8, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFE1E1E1, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFCFCFCF, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFB4B4B4, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFD0D0D0, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFCECECE, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFCDCDCD, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFCDCDCD, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFCCCCCC, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFCBCBCB, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFB2B2B2, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFCCCCCC, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFCBCBCB, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFD2D2D2, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFC6B7B1, 0xFFC6B5B0, 0xFFDBDBDA, 0xFFDAB9AF, 0xFFE1DBD9, 0xFFCACACA, 0x55999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE1DFDE, 0xFFDEC9C0, 0xFFDDCDC7, 0xFFDB9673, 0xFFE49259, 0xFFDAA68E, 0xFFE4803C, 0xFFDCBAAC, 0xFFCAB2A9, 0x59A68679, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFDED6D3, 0xFFDD8F62, 0xFFE78F50, 0xFFE8813C, 0xFFF0852D, 0xFFEB7D2A, 0xFFF0832C, 0xFFE2884F, 0xFFE38341, 0x63CF612D, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0DFDE, 0xFFDAB7AA, 0xFFDC9D7E, 0xFFDE7B42, 0xFFEB7F2A, 0xFFEA7C27, 0xFFED9D5F, 0xFFF6CFB1, 0xFFEE9A5B, 0xFFEB7E28, 0xFFE67729, 0xA4D76225, 0x66D55A22, 0x18C5461C, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFC0C0C0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFDFDEDE, 0xFFD59F8C, 0xFFE77426, 0xFFE87627, 0xFFE47426, 0xFFE46F1E, 0xFFF3C09C, 0xFFFFFFFF, 0xFFF2B992, 0xFFE37324, 0xFFE67426, 0xFDE87727, 0xD1DC6523, 0x28C3441C, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFBFBFBF, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFDBC8C1, 0xFFD9A08A, 0xFFDE6521, 0xFFE06B21, 0xFFE06B21, 0xFFDF661A, 0xFFF0B794, 0xFFFFFFFF, 0xFFEEB28D, 0xFFE0691F, 0xFFDF6B21, 0xFFE06B21, 0xBED85A1F, 0x46CF4F1D, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFD3947C, 0xFFDC6527, 0xFFDE631D, 0xFFDB621D, 0xFFDC621D, 0xFFDB5E17, 0xFFECAD89, 0xFFFFFEFE, 0xFFEAA37A, 0xFFDB5F1A, 0xFFDC621D, 0xFFDC621D, 0xFBE1641E, 0xDED2541C, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFD9CFCD, 0xFFD17857, 0xFFD75819, 0xFFD65719, 0xFFD65719, 0xFFD55414, 0xFFE69A75, 0xFFFEFDFC, 0xFFE38C61, 0xFFD55313, 0xFFD65719, 0xFFD65719, 0xF2D45319, 0x5EC6451A, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFD39B89, 0xFFD85925, 0xFFD35015, 0xFFD24F15, 0xFFD24F15, 0xFFD14D12, 0xFFE18B65, 0xFFFEFBF9, 0xFFDC784C, 0xFFD14B11, 0xFFD24F15, 0xFFD24E15, 0xFBD85015, 0xC0D04917, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFD5B9B1, 0xFFCC7D64, 0xFFCC4513, 0xFFCD4410, 0xFFCD4410, 0xFFCD440F, 0xFFD15425, 0xFFE08F71, 0xFFCE4917, 0xFFCD430F, 0xFFCD4410, 0xFFCE4410, 0xD7C84315, 0x7CC34118, + 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFD1A598, 0xFFCD3E0E, 0xFFC93C0C, 0xFFC93C0D, 0xFFC83A0A, 0xFFD66B47, 0xFFEAB4A0, 0xFFD4633C, 0xFFC93B0B, 0xFFC93C0D, 0xFFCB3D0B, 0xBDCB3E12, 0x19BF3E19, + 0x00000000, 0x00000000, 0x00000000, 0x91999999, 0xFFD2D2D2, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD8D7D6, 0xFFCE9383, 0xFFC96A4E, 0xFFC4451F, 0xFFC53408, 0xFFC32E03, 0xFFDF907A, 0xFFF8E9E4, 0xFFDD8B72, 0xFFC43206, 0xFCC5350A, 0xCAC23911, 0x99C23B13, 0x24C03D18, + 0x00000000, 0x00000000, 0x00000000, 0x45999999, 0xFFBCBCBC, 0xFFD8D8D8, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD8D5D4, 0xFFD5C6C1, 0xFFC55A3D, 0xFFC1320B, 0xFFC13109, 0xFFC53D18, 0xFFCE5A3C, 0xFFC43B17, 0xF9C1310B, 0xFCC13109, 0x62BF3812, 0x0ABD3E1B, 0x02BE3E1A, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7B9C9C9C, 0xD7B1B1B1, 0xFAC1C1C1, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC2BEBD, 0xFFBA9185, 0xFFBDA19A, 0xFFBC5F46, 0xF2BB3D1C, 0xCBB84A2B, 0xE9BE2E09, 0x52BE3915, 0x5FBE3B17, 0x2BBE3A16, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x07999999, 0x2D999999, 0x50999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x72B05D46, 0x66B74B2D, 0x22AE644F, 0x80BE3814, 0x1ABE3C18, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}, + +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03B5B5B5, 0x48B6B6B6, 0xC2C9C9C9, 0xF9CDCDCD, 0xFFCDCDCD, 0xFFCDCDCD, 0xFFCDCDCD, 0xFFCDCDCD, 0xFFCDCDCD, 0xFBCDCDCD, 0xAEC5C5C5, 0x3BB7B7B7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x21B5B5B5, 0xCBCBCBCB, 0xFFF5F5F5, 0xFFF9F9F9, 0xFFF7F7F7, 0xFFF7F7F7, 0xFFF7F7F7, 0xFFF7F7F7, 0xFFF7F7F7, 0xFFF9F9F9, 0xFFECECEC, 0xB4C6C6C6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x51B5B5B5, 0xFADDDDDD, 0xFFF6F6F6, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF7F7F7, 0xFFD1D1D1, 0x63B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x55B5B5B5, 0x52B5B5B5, 0x37B5B5B5, 0x06B5B5B5, 0x00000000, 0x00000000, 0x00000000, + 0x55B5B5B5, 0xFFDEDEDE, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF3F3F3, 0xFFF7F7F7, 0xFFF1F1F1, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFCE5E5E5, 0xE1D9D9D9, 0x7EB6B6B6, 0x07B5B5B5, 0x00000000, 0x00000000, + 0x55B5B5B5, 0xFFDEDEDE, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF2F2F2, 0xFFF0F0EE, 0xFFEADFCF, 0xFFE4CEB1, 0xFFE3CEB0, 0xFFE3CEB0, 0xFFE3CEB0, 0xFFE5D0B2, 0xFFEAD5B7, 0xE4CEB696, 0x58C0965D, 0x06C4842A, 0x00000000, + 0x55B5B5B5, 0xFFDDDDDD, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFF1F1F1, 0xFFDEC7A8, 0xFFE7A054, 0xFFC4B778, 0xFFBAB97E, 0xFFBAB97E, 0xFFBAB97E, 0xFFBAB97E, 0xFFBAB97E, 0xFFC4B475, 0xE4E89A43, 0x7EC7842A, 0x07C4842A, + 0x55B5B5B5, 0xFFDCDCDC, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFEDEDEC, 0xFFE3A34E, 0xFFFBC160, 0xFFFFBE5A, 0xFFFFBA57, 0xFFFFBA57, 0xFFFFBA57, 0xFFFFBA57, 0xFFFFBA57, 0xFFFFBE5B, 0xFFFAC668, 0xE2F09F37, 0x38C4842A, + 0x55B5B5B5, 0xFFDBDBDB, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFE5E3DF, 0xFFE99B32, 0xFFFFBA55, 0xFFFFB853, 0xFFFFB853, 0xFFFFB853, 0xFFFFB853, 0xFFFFB853, 0xFFFFB853, 0xFFFFB853, 0xFFFFBA56, 0xFDECA644, 0x53C4842A, + 0x55B5B5B5, 0xFFDBDBDB, 0xFFEEEEEE, 0xFFECECEB, 0xFFE5D7C4, 0xFFE2CCAF, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFE0CBAD, 0xFFD9C2A0, 0xFFEC9C30, 0xFFFFB751, 0xFFFFB64F, 0xFFFFB64F, 0xFFFFB64F, 0xFFFFB64F, 0xFFFFB64F, 0xFFFFB64F, 0xFFFFB64F, 0xFFFFB64F, 0xFFEBA543, 0x55C4842A, + 0x55B5B5B5, 0xFFDADADA, 0xFFEAEAE9, 0xFFD7B98F, 0xFFF0A750, 0xFFDDB262, 0xFFD5B56A, 0xFFD5B56A, 0xFFD5B56A, 0xFFD5B56A, 0xFFD5B56A, 0xFFD5B56A, 0xFFD5B56A, 0xFFD5B56A, 0xFFD5B56A, 0xFFD5B56A, 0xFFD5B56A, 0xFFD5B56A, 0xFFD5B56A, 0xFFD8B367, 0xFFFAB952, 0xFFFFB64F, 0xFFFFB24B, 0xFFFFB24B, 0xFFFFB24B, 0xFFFFB24B, 0xFFFFB24B, 0xFFFFB24B, 0xFFFFB24B, 0xFFFFB24B, 0xFFEBA340, 0x55C4842A, + 0x55B5B5B5, 0xFFDADADA, 0xFFE3D5C1, 0xFFF0A544, 0xFFFFB753, 0xFFFFB048, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFFFAE44, 0xFFEBA03B, 0x55C4842A, + 0x55B5B5B5, 0xFFD9D9D9, 0xFFDFC9AC, 0xFFEC9F38, 0xFFFFAE42, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFFFAC40, 0xFFEB9E39, 0x55C4842A, + 0x55B5B5B5, 0xFFD9D9D9, 0xFFDEC8AA, 0xFFEB9C34, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFFFA739, 0xFFEB9C34, 0x55C4842A, + 0x55B5B5B5, 0xFFD8D8D8, 0xFFDDC8AA, 0xFFEB9A30, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFFFA533, 0xFFEB9A30, 0x55C4842A, + 0x55B5B5B5, 0xFFD7D7D7, 0xFFDCC7A9, 0xFFEB972B, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFFFA12C, 0xFFEB972B, 0x55C4842A, + 0x55B5B5B5, 0xFFD7D7D7, 0xFFDCC6A8, 0xFFEB9627, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFFF9F26, 0xFFEB9627, 0x55C4842A, + 0x55B5B5B5, 0xFFD7D7D7, 0xFFDCC6A8, 0xFFEB9423, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFFF9C1F, 0xFFEB9423, 0x55C4842A, + 0x55B5B5B5, 0xFFD5D5D5, 0xFFDAC5A7, 0xFFEA9320, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFFD9A1B, 0xFFEA9320, 0x55C4842A, + 0x55B5B5B5, 0xFFD5D5D5, 0xFFDAC5A7, 0xFFE38F21, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFF3951D, 0xFFE38F21, 0x55C4842A, + 0x55B5B5B5, 0xFFD4D4D4, 0xFFD9C4A6, 0xFFDE8D22, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFEC921F, 0xFFDE8D22, 0x55C4842A, + 0x55B5B5B5, 0xFFD4D4D4, 0xFFD9C4A6, 0xFFD88A24, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFE28E21, 0xFFD88A24, 0x55C4842A, + 0x51B5B5B5, 0xFAD3D3D3, 0xFFD8C3A5, 0xFFD38926, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFDB8C25, 0xFFD38926, 0x55C4842A, + 0x21B5B5B5, 0xCBC3C3C3, 0xFFD6C4AC, 0xFFCE8B34, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xFFD38827, 0xEDCC8628, 0x43C4842A, + 0x03B5B5B5, 0x4CB6B6B6, 0xC8BFB9B1, 0xFAC3924D, 0xFFCA8629, 0xFFCD8829, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8929, 0xFFCD8829, 0xFFCA8629, 0xC1C6852A, 0x17C4842A, + 0x00000000, 0x00000000, 0x00000000, 0x10C4842A, 0x72C4842A, 0xA5C4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xAAC4842A, 0xA5C4842A, 0x72C4842A, 0x10C4842A, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}, + +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x27999999, 0x8E999999, 0xAA999999, 0xAA999999, 0x8E999999, 0x27999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x10999999, 0xBAAAAAAA, 0xFFF2F2F2, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFF2F2F2, 0xBAA9A9A9, 0x10999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x37999999, 0xE1C4C4C4, 0xFFF6F6F6, 0xFFF0F0F0, 0xFFF0F0F0, 0xFFF5F5F5, 0xDAC0C0C0, 0x30999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x49A1A1A1, 0x99B0B0B0, 0x69A7A7A7, 0x23999999, 0x00000000, 0x00000000, 0x659D9D9D, 0xF8D4D4D4, 0xFFF1F1F1, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFF3F3F3, 0xF4D3D3D3, 0x619D9D9D, 0x00000000, 0x00000000, 0x23999999, 0x69A7A7A7, 0x99B0B0B0, 0x49A1A1A1, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x43999999, 0xE8C7C7C7, 0xFFEAEAEA, 0xF6DEDEDE, 0xCDAFAFAF, 0x58999999, 0x80999999, 0xDDC0C0C0, 0xFFF0F0F0, 0xFFEFEFEF, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEFEFEF, 0xFFF1F1F1, 0xDDC0C0C0, 0x7E999999, 0x56999999, 0xCDAFAFAF, 0xF6DEDEDE, 0xFFEAEAEA, 0xE8C7C7C7, 0x43999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4CA3A3A3, 0xE8C7C7C7, 0xFFFBFBFB, 0xFFF0F0F0, 0xFFF4F4F4, 0xFFF9F9F9, 0xFFDADADA, 0xFFECECEC, 0xFFFAFAFA, 0xFFF3F3F3, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFF3F3F3, 0xFFFAFAFA, 0xFFEBEBEB, 0xFFD9D9D9, 0xFFF9F9F9, 0xFFF4F4F4, 0xFFF0F0F0, 0xFFFBFBFB, 0xE8C7C7C7, 0x4CA3A3A3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x9DADADAD, 0xFFE1E1E1, 0xFFF0F0F0, 0xFFEDEDED, 0xFFEDEDED, 0xFFF0F0F0, 0xFFF3F3F3, 0xFFF2F2F2, 0xFFEEEEEE, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFEEEEEE, 0xFFF2F2F2, 0xFFF3F3F3, 0xFFF0F0F0, 0xFFEDEDED, 0xFFEDEDED, 0xFFF0F0F0, 0xFFE1E1E1, 0x9DADADAD, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7AA7A7A7, 0xFAD5D5D5, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFE6E6E6, 0xFFDEDEDE, 0xFFDADADA, 0xFFDADADA, 0xFFDEDEDE, 0xFFE6E6E6, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xF8D4D4D4, 0x79A7A7A7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x2E999999, 0xD8B0B0B0, 0xFFE8E8E8, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEAEAEA, 0xFFD4D4D4, 0xFFC2C2C2, 0xFFB9B9B9, 0xFFB6B6B6, 0xFFB6B6B6, 0xFFB9B9B9, 0xFFC2C2C2, 0xFFD4D4D4, 0xFFEAEAEA, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFE8E8E8, 0xD3AFAFAF, 0x29999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x60999999, 0xFFD3D3D3, 0xFFEBEBEB, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFE2E2E2, 0xFFC5C5C5, 0xFFB5B5B5, 0xFFB5B5B5, 0xFFB5B5B5, 0xFFB5B5B5, 0xFFB5B5B5, 0xFFB5B5B5, 0xFFB5B5B5, 0xFFB5B5B5, 0xFFC5C5C5, 0xFFE2E2E2, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFEBEBEB, 0xFFD3D3D3, 0x60999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8A999999, 0xFFE6E6E6, 0xFFECECEC, 0xFFE9E9E9, 0xFFE8E8E8, 0xFFC6C6C6, 0xFFB8B8B8, 0xFFB7B7B7, 0xFFB7B7B7, 0xFFB7B7B7, 0xFFB7B7B7, 0xFFB7B7B7, 0xFFB7B7B7, 0xFFB7B7B7, 0xFFB7B7B7, 0xFFB8B8B8, 0xFFC6C6C6, 0xFFE8E8E8, 0xFFE9E9E9, 0xFFECECEC, 0xFFE2E2E2, 0x83999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x0E999999, 0x2E999999, 0x619D9D9D, 0xDDC1C1C1, 0xFFF0F0F0, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFD4D4D4, 0xFFB9B9B9, 0xFFB9B9B9, 0xFFB9B9B9, 0xFFBABABA, 0xD8B9B9B9, 0xB9B9B9B9, 0xB9B9B9B9, 0xD8B9B9B9, 0xFFBABABA, 0xFFB9B9B9, 0xFFB9B9B9, 0xFFB9B9B9, 0xFFD4D4D4, 0xFFE8E8E8, 0xFFE9E9E9, 0xFFF2F2F2, 0xDDBFBFBF, 0x619D9D9D, 0x2E999999, 0x0E999999, 0x00000000, 0x00000000, + 0x00000000, 0x27999999, 0xB8A8A8A8, 0xD8C4C4C4, 0xF4D9D9D9, 0xFFEFEFEF, 0xFFECECEC, 0xFFE7E7E7, 0xFFE3E3E3, 0xFFC7C7C7, 0xFFBCBCBC, 0xFFBCBCBC, 0xFFBCBCBC, 0xC6BCBCBC, 0x2EBBBBBB, 0x0FBBBBBB, 0x0FBBBBBB, 0x2EBBBBBB, 0xC6BCBCBC, 0xFFBCBCBC, 0xFFBCBCBC, 0xFFBCBCBC, 0xFFC7C7C7, 0xFFE3E3E3, 0xFFE7E7E7, 0xFFECECEC, 0xFFEFEFEF, 0xF4D9D9D9, 0xD8C4C4C4, 0xB8A8A8A8, 0x27999999, 0x00000000, + 0x04999999, 0x919D9D9D, 0xFFECECEC, 0xFFF6F6F6, 0xFFEBEBEB, 0xFFE6E6E6, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFDCDCDC, 0xFFC2C2C2, 0xFFBEBEBE, 0xFFBEBEBE, 0xD8BEBEBE, 0x2EBEBEBE, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x2EBEBEBE, 0xD8BEBEBE, 0xFFBEBEBE, 0xFFBEBEBE, 0xFFC2C2C2, 0xFFDBDBDB, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE6E6E6, 0xFFEBEBEB, 0xFFF6F6F6, 0xFFEBEBEB, 0x8E999999, 0x00000000, + 0x12999999, 0xBCA8A8A8, 0xFFE6E6E6, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFDADADA, 0xFFC2C2C2, 0xFFC1C1C1, 0xFFC1C1C1, 0xB9C1C1C1, 0x0FC1C1C1, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0FC1C1C1, 0xB9C1C1C1, 0xFFC1C1C1, 0xFFC1C1C1, 0xFFC1C1C1, 0xFFD9D9D9, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xAA999999, 0x00000000, + 0x14999999, 0xBEA8A8A8, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFDCDCDC, 0xFFC4C4C4, 0xFFC3C3C3, 0xFFC3C3C3, 0xB9C4C4C4, 0x0FC4C4C4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0FC4C4C4, 0xB9C4C4C4, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC4C4C4, 0xFFDDDDDD, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xAA999999, 0x00000000, + 0x05999999, 0x9A9E9E9E, 0xFFDCDCDC, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFDEDEDE, 0xFFC8C8C8, 0xFFC5C5C5, 0xFFC5C5C5, 0xD8C6C6C6, 0x2EC6C6C6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x2EC6C6C6, 0xD8C6C6C6, 0xFFC5C5C5, 0xFFC5C5C5, 0xFFC8C8C8, 0xFFDDDDDD, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFDCDCDC, 0x95999999, 0x00000000, + 0x00000000, 0x2D999999, 0xC3A8A8A8, 0xE5BEBEBE, 0xFCCACACA, 0xFFDADADA, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE2E2E2, 0xFFD2D2D2, 0xFFC8C8C8, 0xFFC8C8C8, 0xFFC8C8C8, 0xC6C9C9C9, 0x2ECACACA, 0x0FCACACA, 0x0FCACACA, 0x2ECACACA, 0xC6C9C9C9, 0xFFC8C8C8, 0xFFC8C8C8, 0xFFC8C8C8, 0xFFD1D1D1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFD9D9D9, 0xFCCACACA, 0xE5BEBEBE, 0xC3A8A8A8, 0x2D999999, 0x00000000, + 0x00000000, 0x00000000, 0x19999999, 0x3B999999, 0x709D9D9D, 0xE4B9B9B9, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE2E2E2, 0xFFDDDDDD, 0xFFCBCBCB, 0xFFCBCBCB, 0xFFCBCBCB, 0xFFCBCBCB, 0xD8CCCCCC, 0xB9CCCCCC, 0xB9CCCCCC, 0xD8CCCCCC, 0xFFCBCBCB, 0xFFCBCBCB, 0xFFCBCBCB, 0xFFCBCBCB, 0xFFDDDDDD, 0xFFE2E2E2, 0xFFE0E0E0, 0xFFE0E0E0, 0xE1B8B8B8, 0x6C9D9D9D, 0x3B999999, 0x19999999, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x04999999, 0x959C9C9C, 0xFFD7D7D7, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFE4E4E4, 0xFFD8D8D8, 0xFFCECECE, 0xFFCECECE, 0xFFCECECE, 0xFFCECECE, 0xFFCECECE, 0xFFCECECE, 0xFFCECECE, 0xFFCECECE, 0xFFCECECE, 0xFFCECECE, 0xFFD8D8D8, 0xFFE4E4E4, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFD7D7D7, 0x8A999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x60999999, 0xFFCBCBCB, 0xFFDFDFDF, 0xFFDEDEDE, 0xFFDFDFDF, 0xFFE3E3E3, 0xFFDADADA, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFDADADA, 0xFFE3E3E3, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDFDFDF, 0xFFC9C9C9, 0x5C999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x23999999, 0xCDACACAC, 0xFFE8E8E8, 0xFFDFDFDF, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDEDEDE, 0xFFE3E3E3, 0xFFE1E1E1, 0xFFDADADA, 0xFFD5D5D5, 0xFFD2D2D2, 0xFFD2D2D2, 0xFFD5D5D5, 0xFFD9D9D9, 0xFFE1E1E1, 0xFFE3E3E3, 0xFFDEDEDE, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFE0E0E0, 0xFFE9E9E9, 0xCDACACAC, 0x23999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x69A3A3A3, 0xF6CECECE, 0xFFE4E4E4, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDFDFDF, 0xFFE1E1E1, 0xFFDFDFDF, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFDFDFDF, 0xFFE1E1E1, 0xFFDFDFDF, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFE4E4E4, 0xF6CECECE, 0x69A3A3A3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x9DA8A8A8, 0xFFCFCFCF, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFCFCFCF, 0x9DA8A8A8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4E9F9F9F, 0xEABFBFBF, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFD9D9D9, 0xFFC7C7C7, 0xFFD2D2D2, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFD2D2D2, 0xFFC7C7C7, 0xFFD9D9D9, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xE8B7B7B7, 0x4C9F9F9F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0C999999, 0x5F999999, 0xEABFBFBF, 0xFFCECECE, 0xFAC8C8C8, 0xD8ABABAB, 0x60999999, 0x959C9C9C, 0xE4B5B5B5, 0xFFD3D3D3, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFD2D2D2, 0xE1B4B4B4, 0x959C9C9C, 0x60999999, 0xD8ADADAD, 0xFAC8C8C8, 0xFFCECECE, 0xE8B7B7B7, 0x43999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0C999999, 0x52A0A0A0, 0xA0A8A8A8, 0x7AA4A4A4, 0x2E999999, 0x00000000, 0x04999999, 0x709C9C9C, 0xFCC4C4C4, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xF4C1C1C1, 0x659B9B9B, 0x04999999, 0x00000000, 0x2E999999, 0x7AA4A4A4, 0xA0A8A8A8, 0x50A0A0A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x39999999, 0xE3B9B9B9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xDAB5B5B5, 0x30999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x14999999, 0xBEA5A5A5, 0xFFD3D3D3, 0xFFD8D8D8, 0xFFD8D8D8, 0xFFD3D3D3, 0xBAA4A4A4, 0x10999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x2D999999, 0x9C9F9F9F, 0xC0A7A7A7, 0xBEA6A6A6, 0x9A9E9E9E, 0x2D999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x07999999, 0x16999999, 0x14999999, 0x05999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +} +}; + +#define MEWUI_TOOLBAR_BUTTONS ARRAY_LENGTH(toolbar_bitmap_bmp) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index d0e432c2a21..3ca38662e38 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -88,6 +88,25 @@ static const input_item_id non_char_keys[] = ITEM_ID_CANCEL }; +static const char *s_color_list[] = { + OPTION_UI_BORDER_COLOR, + OPTION_UI_BACKGROUND_COLOR, + OPTION_UI_GFXVIEWER_BG_COLOR, + OPTION_UI_UNAVAILABLE_COLOR, + OPTION_UI_TEXT_COLOR, + OPTION_UI_TEXT_BG_COLOR, + OPTION_UI_SUBITEM_COLOR, + OPTION_UI_CLONE_COLOR, + OPTION_UI_SELECTED_COLOR, + OPTION_UI_SELECTED_BG_COLOR, + OPTION_UI_MOUSEOVER_COLOR, + OPTION_UI_MOUSEOVER_BG_COLOR, + OPTION_UI_MOUSEDOWN_COLOR, + OPTION_UI_MOUSEDOWN_BG_COLOR, + OPTION_UI_DIPSW_COLOR, + OPTION_UI_SLIDER_COLOR +}; + /*************************************************************************** GLOBAL VARIABLES ***************************************************************************/ @@ -246,6 +265,9 @@ ui_manager::ui_manager(running_machine &machine) m_mouse_arrow_texture = nullptr; m_load_save_hold = false; + get_font_rows(&machine); + decode_ui_color(0, &machine); + // more initialization set_handler(handler_messagebox, 0); m_non_char_keys_down = std::make_unique((ARRAY_LENGTH(non_char_keys) + 7) / 8); @@ -461,7 +483,9 @@ void ui_manager::update_and_render(render_container *container) { float mouse_y=-1,mouse_x=-1; if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y)) { - container->add_quad(mouse_x,mouse_y,mouse_x + 0.02f*container->manager().ui_aspect(container),mouse_y + 0.02f,UI_TEXT_COLOR,m_mouse_arrow_texture,PRIMFLAG_ANTIALIAS(1)|PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + float l_heigth = machine().ui().get_line_height(); + container->add_quad(mouse_x, mouse_y, mouse_x + l_heigth*container->manager().ui_aspect(container), mouse_y + l_heigth, UI_TEXT_COLOR, m_mouse_arrow_texture, PRIMFLAG_ANTIALIAS(1) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + } } } @@ -596,9 +620,9 @@ void ui_manager::draw_text(render_container *container, const char *buf, float x // and full size computation //------------------------------------------------- -void ui_manager::draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight) +void ui_manager::draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight, float text_size) { - float lineheight = get_line_height(); + float lineheight = get_line_height() * text_size; const char *ends = origs + strlen(origs); float wrapwidth = origwrapwidth; const char *s = origs; @@ -1648,15 +1672,21 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (machine.ui_input().pressed(IPT_UI_PAUSE)) { // with a shift key, it is single step - if (is_paused && (machine.input().code_pressed(KEYCODE_LSHIFT) || machine.input().code_pressed(KEYCODE_RSHIFT))) - { - machine.ui().set_single_step(true); - machine.resume(); - } - else +// if (is_paused && (machine.input().code_pressed(KEYCODE_LSHIFT) || machine.input().code_pressed(KEYCODE_RSHIFT))) +// { +// machine.ui().set_single_step(true); +// machine.resume(); +// } +// else machine.toggle_pause(); } + if (machine.ui_input().pressed(IPT_UI_PAUSE_SINGLE)) + { + machine.ui().set_single_step(true); + machine.resume(); + } + // handle a toggle cheats request if (machine.ui_input().pressed(IPT_UI_TOGGLE_CHEAT)) machine.cheat().set_enable(!machine.cheat().enabled()); @@ -2532,3 +2562,192 @@ void ui_manager::set_use_natural_keyboard(bool use_natural_keyboard) machine().options().set_value(OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE, error); assert(error.empty()); } + +/********************************************** + * MEWUI + *********************************************/ +void ui_manager::wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, int &count, std::vector &xstart, std::vector &xend, float text_size) +{ + float lineheight = get_line_height() * text_size; + const char *ends = origs + strlen(origs); + float wrapwidth = origwrapwidth; + const char *s = origs; + const char *linestart; + float maxwidth = 0; + float aspect = machine().render().ui_aspect(container); + count = 0; + + // loop over lines + while (*s != 0) + { + const char *lastbreak = nullptr; + unicode_char schar; + int scharcount; + float lastbreak_width = 0; + float curwidth = 0; + + // get the current character + scharcount = uchar_from_utf8(&schar, s, ends - s); + if (scharcount == -1) + break; + + // remember the starting position of the line + linestart = s; + + // loop while we have characters and are less than the wrapwidth + while (*s != 0 && curwidth <= wrapwidth) + { + float chwidth; + + // get the current chcaracter + scharcount = uchar_from_utf8(&schar, s, ends - s); + if (scharcount == -1) + break; + + // if we hit a newline, stop immediately + if (schar == '\n') + break; + + // get the width of this character + chwidth = get_font()->char_width(lineheight, aspect, schar); + + // if we hit a space, remember the location and width *without* the space + if (schar == ' ') + { + lastbreak = s; + lastbreak_width = curwidth; + } + + // add the width of this character and advance + curwidth += chwidth; + s += scharcount; + + // if we hit any non-space breakable character, remember the location and width + // *with* the breakable character + if (schar != ' ' && is_breakable_char(schar) && curwidth <= wrapwidth) + { + lastbreak = s; + lastbreak_width = curwidth; + } + } + + // if we accumulated too much for the current width, we need to back off + if (curwidth > wrapwidth) + { + // if we hit a break, back up to there with the appropriate width + if (lastbreak != nullptr) + { + s = lastbreak; + curwidth = lastbreak_width; + } + + // if we didn't hit a break, back up one character + else if (s > linestart) + { + // get the previous character + s = (const char *)utf8_previous_char(s); + scharcount = uchar_from_utf8(&schar, s, ends - s); + if (scharcount == -1) + break; + + curwidth -= get_font()->char_width(lineheight, aspect, schar); + } + } + + // track the maximum width of any given line + if (curwidth > maxwidth) + maxwidth = curwidth; + + xstart.push_back(linestart - origs); + xend.push_back(s - origs); + + // loop from the line start and add the characters + while (linestart < s) + { + // get the current character + unicode_char linechar; + int linecharcount = uchar_from_utf8(&linechar, linestart, ends - linestart); + if (linecharcount == -1) + break; + linestart += linecharcount; + } + + // advance by a row + count++; + + // skip past any spaces at the beginning of the next line + scharcount = uchar_from_utf8(&schar, s, ends - s); + if (scharcount == -1) + break; + + if (schar == '\n') + s += scharcount; + else + while (*s && isspace(schar)) + { + s += scharcount; + scharcount = uchar_from_utf8(&schar, s, ends - s); + if (scharcount == -1) + break; + } + } +} + +//------------------------------------------------- +// draw_textured_box - add primitives to +// draw an outlined box with the given +// textured background and line color +//------------------------------------------------- + +void ui_manager::draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture, UINT32 flags) +{ + container->add_quad(x0, y0, x1, y1, backcolor, texture, flags); + container->add_line(x0, y0, x1, y0, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + container->add_line(x1, y0, x1, y1, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + container->add_line(x1, y1, x0, y1, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + container->add_line(x0, y1, x0, y0, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); +} + +//------------------------------------------------- +// get_string_width_ex - return the width of a +// character string with given text size +//------------------------------------------------- + +float ui_manager::get_string_width_ex(const char *s, float text_size) +{ + return get_font()->utf8string_width(get_line_height() * text_size, machine().render().ui_aspect(), s); +} + +//------------------------------------------------- +// decode UI color options +//------------------------------------------------- + +rgb_t decode_ui_color(int id, running_machine *machine) +{ + static rgb_t color[ARRAY_LENGTH(s_color_list)]; + + if (machine != nullptr) { + emu_options option; + for (int x = 0; x < ARRAY_LENGTH(s_color_list); x++) { + const char *o_default = option.value(s_color_list[x]); + const char *s_option = machine->options().value(s_color_list[x]); + int len = strlen(s_option); + if (len != 8) + color[x] = rgb_t((UINT32)strtoul(o_default, nullptr, 16)); + else + color[x] = rgb_t((UINT32)strtoul(s_option, nullptr, 16)); + } + } + return color[id]; +} + +//------------------------------------------------- +// get font rows from options +//------------------------------------------------- + +int get_font_rows(running_machine *machine) +{ + static int value; + + return ((machine != nullptr) ? value = machine->options().font_rows() : value); +} diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h index d0f7a28ad27..7e6248169c6 100644 --- a/src/emu/ui/ui.h +++ b/src/emu/ui/ui.h @@ -21,7 +21,8 @@ ***************************************************************************/ /* preferred font height; use ui_get_line_height() to get actual height */ -#define UI_TARGET_FONT_ROWS (25) +#define UI_TARGET_FONT_ROWS get_font_rows() + #define UI_TARGET_FONT_HEIGHT (1.0f / (float)UI_TARGET_FONT_ROWS) #define UI_MAX_FONT_HEIGHT (1.0f / 15.0f) @@ -35,25 +36,25 @@ /* handy colors */ #define ARGB_WHITE rgb_t(0xff,0xff,0xff,0xff) #define ARGB_BLACK rgb_t(0xff,0x00,0x00,0x00) -#define UI_BORDER_COLOR rgb_t(0xff,0xff,0xff,0xff) -#define UI_BACKGROUND_COLOR rgb_t(0xef,0x10,0x10,0x30) -#define UI_GFXVIEWER_BG_COLOR rgb_t(0xef,0x10,0x10,0x30) #define UI_GREEN_COLOR rgb_t(0xef,0x10,0x60,0x10) #define UI_YELLOW_COLOR rgb_t(0xef,0x60,0x60,0x10) #define UI_RED_COLOR rgb_t(0xf0,0x60,0x10,0x10) -#define UI_UNAVAILABLE_COLOR rgb_t(0xff,0x40,0x40,0x40) -#define UI_TEXT_COLOR rgb_t(0xff,0xff,0xff,0xff) -#define UI_TEXT_BG_COLOR rgb_t(0xef,0x00,0x00,0x00) -#define UI_SUBITEM_COLOR rgb_t(0xff,0xff,0xff,0xff) -#define UI_CLONE_COLOR rgb_t(0xff,0x80,0x80,0x80) -#define UI_SELECTED_COLOR rgb_t(0xff,0xff,0xff,0x00) -#define UI_SELECTED_BG_COLOR rgb_t(0xef,0x80,0x80,0x00) -#define UI_MOUSEOVER_COLOR rgb_t(0xff,0xff,0xff,0x80) -#define UI_MOUSEOVER_BG_COLOR rgb_t(0x70,0x40,0x40,0x00) -#define UI_MOUSEDOWN_COLOR rgb_t(0xff,0xff,0xff,0x80) -#define UI_MOUSEDOWN_BG_COLOR rgb_t(0xb0,0x60,0x60,0x00) -#define UI_DIPSW_COLOR rgb_t(0xff,0xff,0xff,0x00) -#define UI_SLIDER_COLOR rgb_t(0xff,0xff,0xff,0xff) +#define UI_BORDER_COLOR decode_ui_color(0) +#define UI_BACKGROUND_COLOR decode_ui_color(1) +#define UI_GFXVIEWER_BG_COLOR decode_ui_color(2) +#define UI_UNAVAILABLE_COLOR decode_ui_color(3) +#define UI_TEXT_COLOR decode_ui_color(4) +#define UI_TEXT_BG_COLOR decode_ui_color(5) +#define UI_SUBITEM_COLOR decode_ui_color(6) +#define UI_CLONE_COLOR decode_ui_color(7) +#define UI_SELECTED_COLOR decode_ui_color(8) +#define UI_SELECTED_BG_COLOR decode_ui_color(9) +#define UI_MOUSEOVER_COLOR decode_ui_color(10) +#define UI_MOUSEOVER_BG_COLOR decode_ui_color(11) +#define UI_MOUSEDOWN_COLOR decode_ui_color(12) +#define UI_MOUSEDOWN_BG_COLOR decode_ui_color(13) +#define UI_DIPSW_COLOR decode_ui_color(14) +#define UI_SLIDER_COLOR decode_ui_color(15) /* cancel return value for a UI handler */ #define UI_HANDLER_CANCEL ((UINT32)~0) @@ -112,97 +113,107 @@ struct slider_state class ui_manager { public: - // construction/destruction - ui_manager(running_machine &machine); - - // getters - running_machine &machine() const { return m_machine; } - bool single_step() const { return m_single_step; } - - // setters - void set_single_step(bool single_step) { m_single_step = single_step; } - - // methods - void initialize(running_machine &machine); - UINT32 set_handler(ui_callback callback, UINT32 param); - void display_startup_screens(bool first_time, bool show_disclaimer); - void set_startup_text(const char *text, bool force); - void update_and_render(render_container *container); - render_font *get_font(); - float get_line_height(); - float get_char_width(unicode_char ch); - float get_string_width(const char *s); - void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor); - void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor); - void draw_text(render_container *container, const char *buf, float x, float y); - void draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth = nullptr, float *totalheight = nullptr); + // construction/destruction + ui_manager(running_machine &machine); + + // getters + running_machine &machine() const { return m_machine; } + bool single_step() const { return m_single_step; } + + // setters + void set_single_step(bool single_step) { m_single_step = single_step; } + + // methods + void initialize(running_machine &machine); + UINT32 set_handler(ui_callback callback, UINT32 param); + void display_startup_screens(bool first_time, bool show_disclaimer); + void set_startup_text(const char *text, bool force); + void update_and_render(render_container *container); + render_font *get_font(); + float get_line_height(); + float get_char_width(unicode_char ch); + float get_string_width(const char *s); + void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor); + void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor); + void draw_text(render_container *container, const char *buf, float x, float y); + void draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth = nullptr, float *totalheight = nullptr, float text_size = 1.0f); void draw_text_box(render_container *container, const char *text, int justify, float xpos, float ypos, rgb_t backcolor); - void draw_message_window(render_container *container, const char *text); - - void CLIB_DECL popup_time(int seconds, const char *text, ...) ATTR_PRINTF(3,4); - void show_fps_temp(double seconds); - void set_show_fps(bool show); - bool show_fps() const; - bool show_fps_counter(); - void set_show_profiler(bool show); - bool show_profiler() const; - void show_menu(); - void show_mouse(bool status); - bool is_menu_active(); - bool can_paste(); - void paste(); - bool use_natural_keyboard() const; - void set_use_natural_keyboard(bool use_natural_keyboard); - void image_handler_ingame(); - void increase_frameskip(); - void decrease_frameskip(); - void request_quit(); - - // print the game info string into a buffer - std::string &game_info_astring(std::string &str); - - // slider controls - const slider_state *get_slider_list(void); - - // other - void process_natural_keyboard(); + void draw_message_window(render_container *container, const char *text); + + void CLIB_DECL popup_time(int seconds, const char *text, ...) ATTR_PRINTF(3,4); + void show_fps_temp(double seconds); + void set_show_fps(bool show); + bool show_fps() const; + bool show_fps_counter(); + void set_show_profiler(bool show); + bool show_profiler() const; + void show_menu(); + void show_mouse(bool status); + bool is_menu_active(); + bool can_paste(); + void paste(); + bool use_natural_keyboard() const; + void set_use_natural_keyboard(bool use_natural_keyboard); + void image_handler_ingame(); + void increase_frameskip(); + void decrease_frameskip(); + void request_quit(); + + // print the game info string into a buffer + std::string &game_info_astring(std::string &str); + + // slider controls + const slider_state *get_slider_list(void); + + // other + void process_natural_keyboard(); + + // MEWUI word wrap + void wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, int &totallines, std::vector &xstart, std::vector &xend, float text_size = 1.0f); + + // draw an outlined box with given line color and filled with a texture + void draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture = nullptr, UINT32 flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + + // return text string width with given text size + float get_string_width_ex(const char *s, float text_size); private: - // instance variables - running_machine & m_machine; - render_font * m_font; - ui_callback m_handler_callback; - UINT32 m_handler_param; - bool m_single_step; - bool m_showfps; - osd_ticks_t m_showfps_end; - bool m_show_profiler; - osd_ticks_t m_popup_text_end; - bool m_use_natural_keyboard; + // instance variables + running_machine & m_machine; + render_font * m_font; + ui_callback m_handler_callback; + UINT32 m_handler_param; + bool m_single_step; + bool m_showfps; + osd_ticks_t m_showfps_end; + bool m_show_profiler; + osd_ticks_t m_popup_text_end; + bool m_use_natural_keyboard; std::unique_ptr m_non_char_keys_down; - render_texture * m_mouse_arrow_texture; - bool m_mouse_show; + render_texture * m_mouse_arrow_texture; + bool m_mouse_show; bool m_load_save_hold; - // text generators - std::string &disclaimer_string(std::string &buffer); - std::string &warnings_string(std::string &buffer); + // text generators + std::string &disclaimer_string(std::string &buffer); + std::string &warnings_string(std::string &buffer); - // UI handlers - static UINT32 handler_messagebox(running_machine &machine, render_container *container, UINT32 state); - static UINT32 handler_messagebox_ok(running_machine &machine, render_container *container, UINT32 state); - static UINT32 handler_messagebox_anykey(running_machine &machine, render_container *container, UINT32 state); - static UINT32 handler_ingame(running_machine &machine, render_container *container, UINT32 state); - static UINT32 handler_load_save(running_machine &machine, render_container *container, UINT32 state); - static UINT32 handler_confirm_quit(running_machine &machine, render_container *container, UINT32 state); + // UI handlers + static UINT32 handler_messagebox(running_machine &machine, render_container *container, UINT32 state); + static UINT32 handler_messagebox_ok(running_machine &machine, render_container *container, UINT32 state); + static UINT32 handler_messagebox_anykey(running_machine &machine, render_container *container, UINT32 state); + static UINT32 handler_ingame(running_machine &machine, render_container *container, UINT32 state); + static UINT32 handler_load_save(running_machine &machine, render_container *container, UINT32 state); + static UINT32 handler_confirm_quit(running_machine &machine, render_container *container, UINT32 state); - // private methods - void exit(); + // private methods + void exit(); }; /*************************************************************************** FUNCTION PROTOTYPES ***************************************************************************/ - +rgb_t decode_ui_color(int id, running_machine *machine = nullptr); +int get_font_rows(running_machine *machine = NULL); #endif /* __USRINTRF_H__ */ diff --git a/src/emu/ui/uicmd14.png b/src/emu/ui/uicmd14.png new file mode 100644 index 00000000000..d3cae952cac Binary files /dev/null and b/src/emu/ui/uicmd14.png differ diff --git a/src/emu/ui/utils.cpp b/src/emu/ui/utils.cpp new file mode 100644 index 00000000000..3dbf3e30e01 --- /dev/null +++ b/src/emu/ui/utils.cpp @@ -0,0 +1,183 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/utils.cpp + + Internal MEWUI user interface. + +***************************************************************************/ + +#include "emu.h" +#include "ui/utils.h" +#include + +extern const char MEWUI_VERSION_TAG[]; +const char MEWUI_VERSION_TAG[] = "# MEWUI INFO "; + +// Years index +UINT16 c_year::actual = 0; +std::vector c_year::ui; + +// Manufacturers index +UINT16 c_mnfct::actual = 0; +std::vector c_mnfct::ui; + +// Main filters +UINT16 main_filters::actual = 0; +const char *main_filters::text[] = { "All", "Available", "Unavailable", "Working", "Not Mechanical", "Category", "Favorites", "BIOS", + "Originals", "Clones", "Not Working", "Mechanical", "Manufacturers", "Years", "Support Save", + "Not Support Save", "CHD", "No CHD", "Use Samples", "Not Use Samples", "Stereo", "Vertical", + "Horizontal", "Screen Type", "Custom" }; +size_t main_filters::length = ARRAY_LENGTH(main_filters::text); + +// Software filters +UINT16 sw_filters::actual = 0; +const char *sw_filters::text[] = { "All", "Available", "Unavailable", "Originals", "Clones", "Years", "Publishers", "Supported", + "Partial Supported", "Unsupported", "Region", "Device Type", "Software List", "Custom" }; +size_t sw_filters::length = ARRAY_LENGTH(sw_filters::text); + +// Screens +UINT16 screen_filters::actual = 0; +const char *screen_filters::text[] = { "", "Raster", "Vector", "LCD" }; +size_t screen_filters::length = ARRAY_LENGTH(screen_filters::text); + +// UME +UINT16 ume_filters::actual = 0; +const char *ume_filters::text[] = { "ALL", "ARCADES", "SYSTEMS" }; +size_t ume_filters::length = ARRAY_LENGTH(ume_filters::text); + +// Globals +UINT8 mewui_globals::rpanel = 0; +UINT8 mewui_globals::curimage_view = 0; +UINT8 mewui_globals::curdats_view = 0; +UINT8 mewui_globals::cur_sw_dats_view = 0; +bool mewui_globals::switch_image = false; +bool mewui_globals::default_image = true; +bool mewui_globals::reset = false; +bool mewui_globals::redraw_icon = false; +int mewui_globals::visible_main_lines = 0; +int mewui_globals::visible_sw_lines = 0; +UINT16 mewui_globals::panels_status = 0; + +// Custom filter +UINT16 custfltr::main = 0; +UINT16 custfltr::numother = 0; +UINT16 custfltr::other[MAX_CUST_FILTER]; +UINT16 custfltr::mnfct[MAX_CUST_FILTER]; +UINT16 custfltr::year[MAX_CUST_FILTER]; +UINT16 custfltr::screen[MAX_CUST_FILTER]; + +// Custom filter +UINT16 sw_custfltr::main = 0; +UINT16 sw_custfltr::numother = 0; +UINT16 sw_custfltr::other[MAX_CUST_FILTER]; +UINT16 sw_custfltr::mnfct[MAX_CUST_FILTER]; +UINT16 sw_custfltr::year[MAX_CUST_FILTER]; +UINT16 sw_custfltr::region[MAX_CUST_FILTER]; +UINT16 sw_custfltr::type[MAX_CUST_FILTER]; +UINT16 sw_custfltr::list[MAX_CUST_FILTER]; + +char* chartrimcarriage(char str[]) +{ + char *pstr = strrchr(str, '\n'); + if (pstr) + str[pstr - str] = '\0'; + pstr = strrchr(str, '\r'); + if (pstr) + str[pstr - str] = '\0'; + return str; +} + +const char* strensure(const char* s) +{ + return s == nullptr ? "" : s; +} + +//------------------------------------------------- +// search a substring with even partial matching +//------------------------------------------------- + +int fuzzy_substring(std::string s_needle, std::string s_haystack) +{ + if (s_needle.empty()) + return s_haystack.size(); + if (s_haystack.empty()) + return s_needle.size(); + + strmakelower(s_needle); + strmakelower(s_haystack); + + if (s_needle == s_haystack) + return 0; + if (s_haystack.find(s_needle) != std::string::npos) + return 0; + + auto *row1 = global_alloc_array_clear(s_haystack.size() + 2); + auto *row2 = global_alloc_array_clear(s_haystack.size() + 2); + + for (int i = 0; i < s_needle.size(); ++i) + { + row2[0] = i + 1; + for (int j = 0; j < s_haystack.size(); ++j) + { + int cost = (s_needle[i] == s_haystack[j]) ? 0 : 1; + row2[j + 1] = MIN(row1[j + 1] + 1, MIN(row2[j] + 1, row1[j] + cost)); + } + + int *tmp = row1; + row1 = row2; + row2 = tmp; + } + + int *first, *smallest; + first = smallest = row1; + int *last = row1 + s_haystack.size(); + + while (++first != last) + if (*first < *smallest) + smallest = first; + + int rv = *smallest; + global_free_array(row1); + global_free_array(row2); + + return rv; +} + +//------------------------------------------------- +// set manufacturers +//------------------------------------------------- + +void c_mnfct::set(const char *str) +{ + std::string name = getname(str); + if (std::find(ui.begin(), ui.end(), name) != ui.end()) + return; + + ui.push_back(name); +} + +std::string c_mnfct::getname(const char *str) +{ + std::string name(str); + size_t found = name.find("("); + + if (found != std::string::npos) + return (name.substr(0, found - 1)); + else + return name; +} + +//------------------------------------------------- +// set years +//------------------------------------------------- + +void c_year::set(const char *str) +{ + std::string name(str); + if (std::find(ui.begin(), ui.end(), name) != ui.end()) + return; + + ui.push_back(name); +} diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h new file mode 100644 index 00000000000..fc3bdf2d32d --- /dev/null +++ b/src/emu/ui/utils.h @@ -0,0 +1,367 @@ +// license:BSD-3-Clause +// copyright-holders:Dankan1890 +/*************************************************************************** + + mewui/utils.h + + Internal MEWUI user interface. + +***************************************************************************/ + +#pragma once + +#ifndef __MEWUI_UTILS_H__ +#define __MEWUI_UTILS_H__ + +#include "osdepend.h" +#include "render.h" +#include "libjpeg/jpeglib.h" +//#include +//#include "drivenum.h" +//#include + +#define MAX_CHAR_INFO 256 +#define MAX_CUST_FILTER 8 + +// GLOBAL ENUMERATORS +enum +{ + FILTER_FIRST = 0, + FILTER_ALL = FILTER_FIRST, + FILTER_AVAILABLE, + FILTER_UNAVAILABLE, + FILTER_WORKING, + FILTER_NOT_MECHANICAL, + FILTER_CATEGORY, + FILTER_FAVORITE_GAME, + FILTER_BIOS, + FILTER_PARENT, + FILTER_CLONES, + FILTER_NOT_WORKING, + FILTER_MECHANICAL, + FILTER_MANUFACTURER, + FILTER_YEAR, + FILTER_SAVE, + FILTER_NOSAVE, + FILTER_CHD, + FILTER_NOCHD, + FILTER_SAMPLES, + FILTER_NOSAMPLES, + FILTER_STEREO, + FILTER_VERTICAL, + FILTER_HORIZONTAL, + FILTER_SCREEN, + FILTER_CUSTOM, + FILTER_LAST = FILTER_CUSTOM +}; + +enum +{ + FIRST_VIEW = 0, + SNAPSHOT_VIEW = FIRST_VIEW, + CABINETS_VIEW, + CPANELS_VIEW, + PCBS_VIEW, + FLYERS_VIEW, + TITLES_VIEW, + ENDS_VIEW, + ARTPREV_VIEW, + BOSSES_VIEW, + LOGOS_VIEW, + VERSUS_VIEW, + GAMEOVER_VIEW, + HOWTO_VIEW, + SCORES_VIEW, + SELECT_VIEW, + MARQUEES_VIEW, + LAST_VIEW = MARQUEES_VIEW +}; + +enum +{ + RP_FIRST = 0, + RP_IMAGES = RP_FIRST, + RP_INFOS, + RP_LAST = RP_INFOS +}; + +enum +{ + SHOW_PANELS = 0, + HIDE_LEFT_PANEL, + HIDE_RIGHT_PANEL, + HIDE_BOTH +}; + +enum +{ + MEWUI_FIRST_LOAD = 0, + MEWUI_GENERAL_LOAD = MEWUI_FIRST_LOAD, + MEWUI_HISTORY_LOAD, + MEWUI_MAMEINFO_LOAD, + MEWUI_SYSINFO_LOAD, + MEWUI_MESSINFO_LOAD, + MEWUI_COMMAND_LOAD, + MEWUI_STORY_LOAD, + MEWUI_LAST_LOAD = MEWUI_STORY_LOAD +}; + +enum +{ + MEWUI_SW_FIRST = 0, + MEWUI_SW_ALL = MEWUI_SW_FIRST, + MEWUI_SW_AVAILABLE, + MEWUI_SW_UNAVAILABLE, + MEWUI_SW_PARENTS, + MEWUI_SW_CLONES, + MEWUI_SW_YEARS, + MEWUI_SW_PUBLISHERS, + MEWUI_SW_SUPPORTED, + MEWUI_SW_PARTIAL_SUPPORTED, + MEWUI_SW_UNSUPPORTED, + MEWUI_SW_REGION, + MEWUI_SW_TYPE, + MEWUI_SW_LIST, + MEWUI_SW_CUSTOM, + MEWUI_SW_LAST = MEWUI_SW_CUSTOM +}; + +enum +{ + MEWUI_MAME_FIRST = 0, + MEWUI_MAME = MEWUI_MAME_FIRST, + MEWUI_ARCADES, + MEWUI_SYSTEMS, + MEWUI_MAME_LAST = MEWUI_SYSTEMS +}; + +enum +{ + HOVER_DAT_UP = -1000, + HOVER_DAT_DOWN, + HOVER_UI_LEFT, + HOVER_UI_RIGHT, + HOVER_ARROW_UP, + HOVER_ARROW_DOWN, + HOVER_B_FAV, + HOVER_B_EXPORT, + HOVER_B_HISTORY, + HOVER_B_MAMEINFO, + HOVER_B_COMMAND, + HOVER_B_FOLDERS, + HOVER_B_SETTINGS, + HOVER_RPANEL_ARROW, + HOVER_LPANEL_ARROW, + HOVER_MAME_ALL, + HOVER_MAME_ARCADES, + HOVER_MAME_SYSTEMS, + HOVER_FILTER_FIRST, + HOVER_FILTER_LAST = (HOVER_FILTER_FIRST) + 1 + FILTER_LAST, + HOVER_SW_FILTER_FIRST, + HOVER_SW_FILTER_LAST = (HOVER_SW_FILTER_FIRST) + 1 + MEWUI_SW_LAST, + HOVER_RP_FIRST, + HOVER_RP_LAST = (HOVER_RP_FIRST) + 1 + RP_LAST +}; + +// GLOBAL STRUCTURES +struct ui_software_info +{ + ui_software_info() {} + ui_software_info(std::string sname, std::string lname, std::string pname, std::string y, std::string pub, + UINT8 s, std::string pa, const game_driver *d, std::string li, std::string i, std::string is, UINT8 em, + std::string plong, std::string u, std::string de, bool av) + { + shortname = sname; longname = lname; parentname = pname; year = y; publisher = pub; + supported = s; part = pa; driver = d; listname = li; interface = i; instance = is; startempty = em; + parentlongname = plong; usage = u; devicetype = de; available = av; + } + std::string shortname; + std::string longname; + std::string parentname; + std::string year; + std::string publisher; + UINT8 supported = 0; + std::string part; + const game_driver *driver; + std::string listname; + std::string interface; + std::string instance; + UINT8 startempty = 0; + std::string parentlongname; + std::string usage; + std::string devicetype; + bool available = false; + + bool operator==(const ui_software_info& r) + { + if (shortname == r.shortname && longname == r.longname && parentname == r.parentname + && year == r.year && publisher == r.publisher && supported == r.supported + && part == r.part && driver == r.driver && listname == r.listname + && interface == r.interface && instance == r.instance && startempty == r.startempty + && parentlongname == r.parentlongname && usage == r.usage && devicetype == r.devicetype) + return true; + + return false; + } +}; + +// Manufacturers +struct c_mnfct +{ + static void set(const char *str); + static std::string getname(const char *str); + static std::vector ui; + static UINT16 actual; +}; + +// Years +struct c_year +{ + static void set(const char *str); + static std::vector ui; + static UINT16 actual; +}; + +// GLOBAL CLASS +struct mewui_globals +{ + static UINT8 curimage_view, curdats_view, cur_sw_dats_view, rpanel; + static bool switch_image, redraw_icon, default_image, reset; + static int visible_main_lines, visible_sw_lines; + static UINT16 panels_status; +}; + +#define main_struct(name) \ +struct name##_filters \ +{ \ + static UINT16 actual; \ + static const char *text[]; \ + static size_t length; \ +}; + +main_struct(main); +main_struct(sw); +main_struct(ume); +main_struct(screen); + +// Custom filter +struct custfltr +{ + static UINT16 main; + static UINT16 numother; + static UINT16 other[MAX_CUST_FILTER]; + static UINT16 mnfct[MAX_CUST_FILTER]; + static UINT16 screen[MAX_CUST_FILTER]; + static UINT16 year[MAX_CUST_FILTER]; +}; + +// Software custom filter +struct sw_custfltr +{ + static UINT16 main; + static UINT16 numother; + static UINT16 other[MAX_CUST_FILTER]; + static UINT16 mnfct[MAX_CUST_FILTER]; + static UINT16 year[MAX_CUST_FILTER]; + static UINT16 region[MAX_CUST_FILTER]; + static UINT16 type[MAX_CUST_FILTER]; + static UINT16 list[MAX_CUST_FILTER]; +}; + +// GLOBAL FUNCTIONS + +// advanced search function +int fuzzy_substring(std::string needle, std::string haystack); + +// trim carriage return +char* chartrimcarriage(char str[]); + +const char* strensure(const char* s); + +// jpeg loader +template +void render_load_jpeg(_T &bitmap, emu_file &file, const char *dirname, const char *filename) +{ + // deallocate previous bitmap + bitmap.reset(); + + bitmap_format format = bitmap.format(); + + // define file's full name + std::string fname; + + if (dirname == nullptr) + fname = filename; + else + fname.assign(dirname).append(PATH_SEPARATOR).append(filename); + + file_error filerr = file.open(fname.c_str()); + + if (filerr != FILERR_NONE) + return; + + // define standard JPEG structures + jpeg_decompress_struct cinfo; + jpeg_error_mgr jerr; + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_decompress(&cinfo); + + // allocates a buffer for the image + UINT64 jpg_size = file.size(); + unsigned char *jpg_buffer = global_alloc_array(unsigned char, jpg_size + 100); + + // read data from the file and set them in the buffer + file.read(jpg_buffer, jpg_size); + jpeg_mem_src(&cinfo, jpg_buffer, jpg_size); + + // read JPEG header and start decompression + jpeg_read_header(&cinfo, TRUE); + jpeg_start_decompress(&cinfo); + + // allocates the destination bitmap + int w = cinfo.output_width; + int h = cinfo.output_height; + int s = cinfo.output_components; + bitmap.allocate(w, h); + + // allocates a buffer to receive the information and copy them into the bitmap + int row_stride = cinfo.output_width * cinfo.output_components; + JSAMPARRAY buffer = (JSAMPARRAY)malloc(sizeof(JSAMPROW)); + buffer[0] = (JSAMPROW)malloc(sizeof(JSAMPLE) * row_stride); + + while ( cinfo.output_scanline < cinfo.output_height ) + { + int j = cinfo.output_scanline; + jpeg_read_scanlines(&cinfo, buffer, 1); + + if (s == 1) + for (int i = 0; i < w; ++i) + if (format == BITMAP_FORMAT_ARGB32) + bitmap.pix32(j, i) = rgb_t(0xFF, buffer[0][i], buffer[0][i], buffer[0][i]); + else + bitmap.pix32(j, i) = rgb_t(buffer[0][i], buffer[0][i], buffer[0][i]); + + else if (s == 3) + for (int i = 0; i < w; ++i) + if (format == BITMAP_FORMAT_ARGB32) + bitmap.pix32(j, i) = rgb_t(0xFF, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); + else + bitmap.pix32(j, i) = rgb_t(buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); + + else + { + osd_printf_info("Error! Cannot read JPEG data from %s file.\n", fname.c_str()); + break; + } + } + + // finish decompression and frees the memory + jpeg_finish_decompress(&cinfo); + jpeg_destroy_decompress(&cinfo); + file.close(); + free(buffer[0]); + free(buffer); + global_free_array(jpg_buffer); +} + +#endif /* __MEWUI_UTILS_H__ */ diff --git a/src/emu/uiinput.cpp b/src/emu/uiinput.cpp index b1ee53a697b..c55038d3065 100644 --- a/src/emu/uiinput.cpp +++ b/src/emu/uiinput.cpp @@ -325,6 +325,23 @@ void ui_input_manager::push_char_event(render_target* target, unicode_char ch) push_event(event); } +/*------------------------------------------------- + push_mouse_wheel_event - pushes a mouse + wheel event to the specified render_target +-------------------------------------------------*/ + +void ui_input_manager::push_mouse_wheel_event(render_target *target, INT32 x, INT32 y, short delta, int ucNumLines) +{ + ui_event event = { UI_EVENT_NONE }; + event.event_type = UI_EVENT_MOUSE_WHEEL; + event.target = target; + event.mouse_x = x; + event.mouse_y = y; + event.zdelta = delta; + event.num_lines = ucNumLines; + push_event(event); +} + /*------------------------------------------------- mark_all_as_pressed - marks all buttons as if they were already pressed once @@ -333,4 +350,4 @@ void ui_input_manager::mark_all_as_pressed() { for (int code = IPT_UI_FIRST + 1; code < IPT_UI_LAST; code++) m_next_repeat[code] = osd_ticks(); -} +} \ No newline at end of file diff --git a/src/emu/uiinput.h b/src/emu/uiinput.h index ff4137faf74..fecc61c0c1a 100644 --- a/src/emu/uiinput.h +++ b/src/emu/uiinput.h @@ -33,6 +33,7 @@ enum ui_event_type UI_EVENT_MOUSE_DOWN, UI_EVENT_MOUSE_UP, UI_EVENT_MOUSE_DOUBLE_CLICK, + UI_EVENT_MOUSE_WHEEL, UI_EVENT_CHAR }; @@ -44,6 +45,8 @@ struct ui_event INT32 mouse_y; input_item_id key; unicode_char ch; + short zdelta; + int num_lines; }; // ======================> ui_input_manager @@ -85,6 +88,7 @@ public: void push_mouse_up_event(render_target* target, INT32 x, INT32 y); void push_mouse_double_click_event(render_target* target, INT32 x, INT32 y); void push_char_event(render_target* target, unicode_char ch); + void push_mouse_wheel_event(render_target *target, INT32 x, INT32 y, short delta, int ucNumLines); void mark_all_as_pressed(); diff --git a/src/osd/sdl/input.cpp b/src/osd/sdl/input.cpp index b0d4d8c1096..a050cbf024b 100644 --- a/src/osd/sdl/input.cpp +++ b/src/osd/sdl/input.cpp @@ -1854,7 +1854,43 @@ void sdlinput_poll(running_machine &machine) } } } +#if (!SDLMAME_SDL2) + else if (event.button.button == 4) // SDL_BUTTON_WHEELUP + { + int cx, cy; + sdl_window_info *window = GET_FOCUS_WINDOW(&event.button); + if (window != NULL && window->xy_to_render_target(event.button.x,event.button.y, &cx, &cy) ) + { + machine.ui_input().push_mouse_wheel_event(window->target(), cx, cy, 120, 3); + } + } + + else if (event.button.button == 5) // SDL_BUTTON_WHEELDOWN + { + int cx, cy; + sdl_window_info *window = GET_FOCUS_WINDOW(&event.button); + if (window != NULL && window->xy_to_render_target(event.button.x,event.button.y, &cx, &cy) ) + { + machine.ui_input().push_mouse_wheel_event(window->target(), cx, cy, -120, 3); + } + } +#endif + break; +#if (SDLMAME_SDL2) + case SDL_MOUSEWHEEL: +#ifdef SDL2_MULTIAPI + devinfo = generic_device_find_index(mouse_list, mouse_map.logical[event.wheel.which]); +#else + devinfo = generic_device_find_index(mouse_list, mouse_map.logical[0]); +#endif + if (devinfo) + { + sdl_window_info *window = GET_FOCUS_WINDOW(&event.wheel); + if (window != NULL) + machine.ui_input().push_mouse_wheel_event(window->target(), 0, 0, event.wheel.y, 3); + } break; +#endif case SDL_MOUSEBUTTONUP: #ifdef SDL2_MULTIAPI devinfo = generic_device_find_index(mouse_list, mouse_map.logical[event.button.which]); @@ -1970,8 +2006,8 @@ void sdlinput_poll(running_machine &machine) #endif { //printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event)); - window->resize(event.window.data1, event.window.data2); - } + window->resize(event.window.data1, event.window.data2); + } } focus_window = window; break; diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 5b102dd359b..dd219949534 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -1319,6 +1319,14 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR window->machine().ui_input().push_char_event(window->m_target, (unicode_char) wparam); break; + case WM_MOUSEWHEEL: + { + UINT ucNumLines = 3; // default + SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &ucNumLines, 0); + window->machine().ui_input().push_mouse_wheel_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam), GET_WHEEL_DELTA_WPARAM(wparam), ucNumLines); + break; + } + // pause the system when we start a menu or resize case WM_ENTERSIZEMOVE: window->m_resize_state = RESIZE_STATE_RESIZING; @@ -1401,9 +1409,9 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR case WM_DESTROY: if (!(window->m_renderer == NULL)) { - window->m_renderer->destroy(); - global_free(window->m_renderer); - window->m_renderer = NULL; + window->m_renderer->destroy(); + global_free(window->m_renderer); + window->m_renderer = NULL; } window->m_hwnd = NULL; return DefWindowProc(wnd, message, wparam, lparam); -- cgit v1.2.3-70-g09d2 From 213283e43064d04bc5ba671e23177eb7ebe8d0a2 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 4 Feb 2016 14:56:46 +0100 Subject: some MEWUI to UI renames (nw) --- src/emu/drivers/empty.cpp | 2 +- src/emu/ui/auditmenu.cpp | 4 ++-- src/emu/ui/auditmenu.h | 10 ++++----- src/emu/ui/cmddata.h | 8 +++---- src/emu/ui/cmdrender.h | 2 +- src/emu/ui/ctrlmenu.cpp | 4 ++-- src/emu/ui/ctrlmenu.h | 10 ++++----- src/emu/ui/custmenu.cpp | 4 ++-- src/emu/ui/custmenu.h | 10 ++++----- src/emu/ui/custui.cpp | 14 ++++++------ src/emu/ui/custui.h | 14 ++++++------ src/emu/ui/datfile.cpp | 2 +- src/emu/ui/datfile.h | 8 +++---- src/emu/ui/datmenu.cpp | 4 ++-- src/emu/ui/datmenu.h | 10 ++++----- src/emu/ui/dirmenu.cpp | 4 ++-- src/emu/ui/dirmenu.h | 10 ++++----- src/emu/ui/dsplmenu.cpp | 10 ++++----- src/emu/ui/dsplmenu.h | 8 +++---- src/emu/ui/icorender.h | 8 +++---- src/emu/ui/inifile.cpp | 2 +- src/emu/ui/inifile.h | 8 +++---- src/emu/ui/moptions.cpp | 2 +- src/emu/ui/moptions.h | 8 +++---- src/emu/ui/optsmenu.cpp | 2 +- src/emu/ui/optsmenu.h | 8 +++---- src/emu/ui/selector.cpp | 4 ++-- src/emu/ui/selector.h | 10 ++++----- src/emu/ui/selgame.cpp | 56 +++++++++++++++++++++++------------------------ src/emu/ui/selgame.h | 14 ++++++------ src/emu/ui/selsoft.cpp | 2 +- src/emu/ui/selsoft.h | 8 +++---- src/emu/ui/sndmenu.cpp | 4 ++-- src/emu/ui/sndmenu.h | 10 ++++----- src/emu/ui/utils.cpp | 4 ++-- src/emu/ui/utils.h | 10 ++++----- 36 files changed, 149 insertions(+), 149 deletions(-) diff --git a/src/emu/drivers/empty.cpp b/src/emu/drivers/empty.cpp index 97c59887e4e..9c48a6c8b26 100644 --- a/src/emu/drivers/empty.cpp +++ b/src/emu/drivers/empty.cpp @@ -29,7 +29,7 @@ public: virtual void machine_start() override { // force the UI to show the game select screen - ui_mewui_select_game::force_game_select(machine(), &machine().render().ui_container()); + ui_menu_select_game::force_game_select(machine(), &machine().render().ui_container()); } UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/emu/ui/auditmenu.cpp b/src/emu/ui/auditmenu.cpp index 631355bfac3..9ebbdf00f40 100644 --- a/src/emu/ui/auditmenu.cpp +++ b/src/emu/ui/auditmenu.cpp @@ -2,9 +2,9 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/auditmenu.cpp + ui/auditmenu.cpp - Internal MEWUI user interface. + Internal UI user interface. *********************************************************************/ diff --git a/src/emu/ui/auditmenu.h b/src/emu/ui/auditmenu.h index 85a9dcba9f6..caad05796a6 100644 --- a/src/emu/ui/auditmenu.h +++ b/src/emu/ui/auditmenu.h @@ -2,16 +2,16 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/auditmenu.h + ui/auditmenu.h - Internal MEWUI user interface. + Internal UI user interface. ***************************************************************************/ #pragma once -#ifndef __MEWUI_AUDIT_H__ -#define __MEWUI_AUDIT_H__ +#ifndef __UI_AUDIT_H__ +#define __UI_AUDIT_H__ //------------------------------------------------- // class audit menu @@ -34,4 +34,4 @@ private: bool m_first; }; -#endif /* __MEWUI_AUDIT_H__ */ +#endif /* __UI_AUDIT_H__ */ diff --git a/src/emu/ui/cmddata.h b/src/emu/ui/cmddata.h index a588c47465f..5fa2658d2cb 100644 --- a/src/emu/ui/cmddata.h +++ b/src/emu/ui/cmddata.h @@ -2,13 +2,13 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/cmddata.h + ui/cmddata.h *********************************************************************/ #pragma once -#ifndef __MEWUI_CMDDATA_H__ -#define __MEWUI_CMDDATA_H__ +#ifndef __UI_CMDDATA_H__ +#define __UI_CMDDATA_H__ #define BUTTON_COLOR_RED rgb_t(255,64,64) #define BUTTON_COLOR_YELLOW rgb_t(255,238,0) @@ -401,4 +401,4 @@ static fix_strings_t convert_text[] = { 0, 0 } // end of array }; -#endif /* __MEWUI_CMDDATA_H__ */ +#endif /* __UI_CMDDATA_H__ */ diff --git a/src/emu/ui/cmdrender.h b/src/emu/ui/cmdrender.h index 4cf8c7089c6..a1f594a5d8f 100644 --- a/src/emu/ui/cmdrender.h +++ b/src/emu/ui/cmdrender.h @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/cmdrender.h + ui/cmdrender.h MEWUI rendfont. diff --git a/src/emu/ui/ctrlmenu.cpp b/src/emu/ui/ctrlmenu.cpp index 96a35f052ed..295fb7f85a0 100644 --- a/src/emu/ui/ctrlmenu.cpp +++ b/src/emu/ui/ctrlmenu.cpp @@ -2,9 +2,9 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/ctrlmenu.cpp + ui/ctrlmenu.cpp - Internal MEWUI user interface. + Internal UI user interface. *********************************************************************/ diff --git a/src/emu/ui/ctrlmenu.h b/src/emu/ui/ctrlmenu.h index 0ce43dd2a26..4c1325071d6 100644 --- a/src/emu/ui/ctrlmenu.h +++ b/src/emu/ui/ctrlmenu.h @@ -2,15 +2,15 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/ctrlmenu.h + ui/ctrlmenu.h - Internal MEWUI user interface. + Internal UI user interface. ***************************************************************************/ #pragma once -#ifndef __MEWUI_CTRLMENU_H__ -#define __MEWUI_CTRLMENU_H__ +#ifndef __UI_CTRLMENU_H__ +#define __UI_CTRLMENU_H__ //------------------------------------------------- // class controller mapping menu @@ -38,4 +38,4 @@ private: int check_status(const char *status, const char *option); }; -#endif /* __MEWUI_CTRLMENU_H__ */ +#endif /* __UI_CTRLMENU_H__ */ diff --git a/src/emu/ui/custmenu.cpp b/src/emu/ui/custmenu.cpp index 6ee8d5094af..3fed1cd1c40 100644 --- a/src/emu/ui/custmenu.cpp +++ b/src/emu/ui/custmenu.cpp @@ -2,9 +2,9 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/custmenu.cpp + ui/custmenu.cpp - Internal MEWUI user interface. + Internal UI user interface. *********************************************************************/ diff --git a/src/emu/ui/custmenu.h b/src/emu/ui/custmenu.h index 8122978b693..d136e911164 100644 --- a/src/emu/ui/custmenu.h +++ b/src/emu/ui/custmenu.h @@ -2,17 +2,17 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/custmenu.h + ui/custmenu.h - Internal MEWUI user interface. + Internal UI user interface. ***************************************************************************/ #pragma once -#ifndef __MEWUI_CUSTMENU_H__ -#define __MEWUI_CUSTMENU_H__ +#ifndef __UI_CUSTMENU_H__ +#define __UI_CUSTMENU_H__ #include "ui/utils.h" @@ -128,4 +128,4 @@ private: void save_custom_filters(); }; -#endif /* __MEWUI_CUSTMENU_H__ */ +#endif /* __UI_CUSTMENU_H__ */ diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index ee30658200b..fb247509e59 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -2,9 +2,9 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/custui.cpp + ui/custui.cpp - Internal MEWUI user interface. + Internal UI user interface. *********************************************************************/ @@ -141,7 +141,7 @@ void ui_menu_custom_ui::custom_render(void *selectedref, float top, float bottom ui_menu_font_ui::ui_menu_font_ui(running_machine &machine, render_container *container) : ui_menu(machine, container) { emu_options &moptions = machine.options(); -#ifdef MEWUI_WINDOWS +#ifdef OSD_WINDOWS std::string name(moptions.ui_font()); list(); @@ -180,7 +180,7 @@ ui_menu_font_ui::ui_menu_font_ui(running_machine &machine, render_container *con } -#ifdef MEWUI_WINDOWS +#ifdef OSD_WINDOWS //------------------------------------------------- // fonts enumerator CALLBACK //------------------------------------------------- @@ -227,7 +227,7 @@ ui_menu_font_ui::~ui_menu_font_ui() std::string error_string; emu_options &moptions = machine().options(); -#ifdef MEWUI_WINDOWS +#ifdef OSD_WINDOWS std::string name(m_fonts[m_actual]); if (m_fonts[m_actual] != "default") { @@ -273,7 +273,7 @@ void ui_menu_font_ui::handle() } break; -#ifdef MEWUI_WINDOWS +#ifdef OSD_WINDOWS case MUI_FNT: if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) @@ -313,7 +313,7 @@ void ui_menu_font_ui::populate() UINT32 arrow_flags; std::string tmptxt; -#ifdef MEWUI_WINDOWS +#ifdef OSD_WINDOWS // add fonts option arrow_flags = get_arrow_flags(0, m_fonts.size() - 1, m_actual); std::string name(m_fonts[m_actual]); diff --git a/src/emu/ui/custui.h b/src/emu/ui/custui.h index 46bb92b8197..0c453340c18 100644 --- a/src/emu/ui/custui.h +++ b/src/emu/ui/custui.h @@ -2,18 +2,18 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/custui.h + ui/custui.h - Internal MEWUI user interface. + Internal UI user interface. ***************************************************************************/ #pragma once -#ifndef __MEWUI_CUSTUI_H__ -#define __MEWUI_CUSTUI_H__ +#ifndef __UI_CUSTUI_H__ +#define __UI_CUSTUI_H__ -#ifdef MEWUI_WINDOWS +#ifdef OSD_WINDOWS #define WIN32_LEAN_AND_MEAN #include #endif @@ -64,7 +64,7 @@ private: MUI_ITALIC }; -#ifdef MEWUI_WINDOWS +#ifdef OSD_WINDOWS UINT16 m_actual; std::vector m_fonts; bool m_bold, m_italic; @@ -179,4 +179,4 @@ private: rgb_t &m_original; }; -#endif /* __MEWUI_CUSTUI_H__ */ +#endif /* __UI_CUSTUI_H__ */ diff --git a/src/emu/ui/datfile.cpp b/src/emu/ui/datfile.cpp index f0e938fbd4d..5afe83687ac 100644 --- a/src/emu/ui/datfile.cpp +++ b/src/emu/ui/datfile.cpp @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/datfile.cpp + ui/datfile.cpp MEWUI DATs manager. diff --git a/src/emu/ui/datfile.h b/src/emu/ui/datfile.h index cb8e5fdcd70..3b7a8423ec2 100644 --- a/src/emu/ui/datfile.h +++ b/src/emu/ui/datfile.h @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/datfile.h + ui/datfile.h MEWUI DATs manager. @@ -10,8 +10,8 @@ #pragma once -#ifndef __MEWUI_DATFILE_H__ -#define __MEWUI_DATFILE_H__ +#ifndef __UI_DATFILE_H__ +#define __UI_DATFILE_H__ //------------------------------------------------- // Datafile Manager @@ -76,4 +76,4 @@ private: }; -#endif /* __MEWUI_DATFILE_H__ */ +#endif /* __UI_DATFILE_H__ */ diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp index 91dbcdcd41c..8e66e2ccd5e 100644 --- a/src/emu/ui/datmenu.cpp +++ b/src/emu/ui/datmenu.cpp @@ -2,9 +2,9 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/datmenu.cpp + ui/datmenu.cpp - Internal MEWUI user interface. + Internal UI user interface. *********************************************************************/ diff --git a/src/emu/ui/datmenu.h b/src/emu/ui/datmenu.h index 9df45d57190..652c6492c43 100644 --- a/src/emu/ui/datmenu.h +++ b/src/emu/ui/datmenu.h @@ -2,17 +2,17 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/datmenu.h + ui/datmenu.h - Internal MEWUI user interface. + Internal UI user interface. ***************************************************************************/ #pragma once -#ifndef __MEWUI_DATMENU_H__ -#define __MEWUI_DATMENU_H__ +#ifndef __UI_DATMENU_H__ +#define __UI_DATMENU_H__ struct ui_software_info; @@ -90,4 +90,4 @@ private: const game_driver *m_driver; }; -#endif /* __MEWUI_DATMENU_H__ */ +#endif /* __UI_DATMENU_H__ */ diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp index 967b8176b06..21a8a177623 100644 --- a/src/emu/ui/dirmenu.cpp +++ b/src/emu/ui/dirmenu.cpp @@ -2,9 +2,9 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/dirmenu.cpp + ui/dirmenu.cpp - Internal MEWUI user interface. + Internal UI user interface. *********************************************************************/ diff --git a/src/emu/ui/dirmenu.h b/src/emu/ui/dirmenu.h index 9d6a8fc6ef4..b513f181540 100644 --- a/src/emu/ui/dirmenu.h +++ b/src/emu/ui/dirmenu.h @@ -2,16 +2,16 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/dirmenu.h + ui/dirmenu.h - Internal MEWUI user interface. + Internal UI user interface. ***************************************************************************/ #pragma once -#ifndef __MEWUI_DIRMENU_H__ -#define __MEWUI_DIRMENU_H__ +#ifndef __UI_DIRMENU_H__ +#define __UI_DIRMENU_H__ //------------------------------------------------- // class directory menu @@ -125,4 +125,4 @@ private: bool m_change; }; -#endif /* __MEWUI_DIRMENU_H__ */ +#endif /* __UI_DIRMENU_H__ */ diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp index 6927043c165..68c218014bd 100644 --- a/src/emu/ui/dsplmenu.cpp +++ b/src/emu/ui/dsplmenu.cpp @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/dsplmenu.cpp + ui/dsplmenu.cpp MEWUI video options menu. @@ -15,7 +15,7 @@ #include "ui/selector.h" #include "ui/utils.h" -#if defined(MEWUI_WINDOWS) && !defined(MEWUI_SDL) +#if defined(OSD_WINDOWS) && !defined(OSD_SDL) #include "../osd/windows/winmain.h" #else #include "../osd/modules/lib/osdobj_common.h" @@ -24,7 +24,7 @@ ui_menu_display_options::video_modes ui_menu_display_options::m_video[] = { { "auto", "Auto" }, { "opengl", "OpenGL" }, -#if defined(MEWUI_WINDOWS) && !defined(MEWUI_SDL) +#if defined(OSD_WINDOWS) && !defined(OSD_SDL) { "d3d", "Direct3D" }, { "gdi", "GDI" }, { "ddraw", "DirectDraw" } @@ -37,7 +37,7 @@ ui_menu_display_options::video_modes ui_menu_display_options::m_video[] = { ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = { { 0, nullptr, nullptr }, { 0, "Video Mode", OSDOPTION_VIDEO }, -#if defined(MEWUI_WINDOWS) && !defined(MEWUI_SDL) +#if defined(OSD_WINDOWS) && !defined(OSD_SDL) { 0, "Hardware Stretch", WINOPTION_HWSTRETCH }, { 0, "Triple Buffering", WINOPTION_TRIPLEBUFFER }, { 0, "HLSL", WINOPTION_HLSL_ENABLE }, @@ -60,7 +60,7 @@ ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = { ui_menu_display_options::ui_menu_display_options(running_machine &machine, render_container *container) : ui_menu(machine, container) { -#if defined(MEWUI_WINDOWS) && !defined(MEWUI_SDL) +#if defined(OSD_WINDOWS) && !defined(OSD_SDL) windows_options &options = downcast(machine.options()); #else osd_options &options = downcast(machine.options()); diff --git a/src/emu/ui/dsplmenu.h b/src/emu/ui/dsplmenu.h index c52e151612b..862ccc11fcd 100644 --- a/src/emu/ui/dsplmenu.h +++ b/src/emu/ui/dsplmenu.h @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/dsplmenu.h + ui/dsplmenu.h MEWUI video options menu. @@ -10,8 +10,8 @@ #pragma once -#ifndef __MEWUI_DSPLMENU_H__ -#define __MEWUI_DSPLMENU_H__ +#ifndef __UI_DSPLMENU_H__ +#define __UI_DSPLMENU_H__ //------------------------------------------------- // class display options menu @@ -43,4 +43,4 @@ private: static dspl_option m_options[]; }; -#endif /* __MEWUI_DSPLMENU_H__ */ +#endif /* __UI_DSPLMENU_H__ */ diff --git a/src/emu/ui/icorender.h b/src/emu/ui/icorender.h index 915a2b88706..1e5ca286c3a 100644 --- a/src/emu/ui/icorender.h +++ b/src/emu/ui/icorender.h @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890;Victor Laskin /*************************************************************************** - mewui/icorender.h + ui/icorender.h ICOns file loader. @@ -14,8 +14,8 @@ ***************************************************************************/ #pragma once -#ifndef __MEWUI_ICORENDER_H__ -#define __MEWUI_ICORENDER_H__ +#ifndef __UI_ICORENDER_H__ +#define __UI_ICORENDER_H__ // These next two structs represent how the icon information is stored // in an ICO file. @@ -232,4 +232,4 @@ void render_load_ico(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, global_free_array(buffer); } -#endif /* __MEWUI_ICORENDER_H__ */ +#endif /* __UI_ICORENDER_H__ */ diff --git a/src/emu/ui/inifile.cpp b/src/emu/ui/inifile.cpp index d261385b5cb..524b1a7b3ad 100644 --- a/src/emu/ui/inifile.cpp +++ b/src/emu/ui/inifile.cpp @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/inifile.cpp + ui/inifile.cpp MEWUI INIs file manager. diff --git a/src/emu/ui/inifile.h b/src/emu/ui/inifile.h index f009ec53857..49bf123a3ad 100644 --- a/src/emu/ui/inifile.h +++ b/src/emu/ui/inifile.h @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/inifile.h + ui/inifile.h MEWUI INIs file manager. @@ -10,8 +10,8 @@ #pragma once -#ifndef __MEWUI_INIFILE_H__ -#define __MEWUI_INIFILE_H__ +#ifndef __UI_INIFILE_H__ +#define __UI_INIFILE_H__ #include "ui/utils.h" @@ -119,4 +119,4 @@ private: running_machine &m_machine; // reference to our machine }; -#endif /* __MEWUI_INIFILE_H__ */ +#endif /* __UI_INIFILE_H__ */ diff --git a/src/emu/ui/moptions.cpp b/src/emu/ui/moptions.cpp index f99699e0a41..83ff444783a 100644 --- a/src/emu/ui/moptions.cpp +++ b/src/emu/ui/moptions.cpp @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/moptions.c + ui/moptions.c MEWUI main options manager. diff --git a/src/emu/ui/moptions.h b/src/emu/ui/moptions.h index b31827645fa..b2db7f68059 100644 --- a/src/emu/ui/moptions.h +++ b/src/emu/ui/moptions.h @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/moptions.h + ui/moptions.h MEWUI main options manager. @@ -10,8 +10,8 @@ #pragma once -#ifndef __MEWUI_OPTS_H__ -#define __MEWUI_OPTS_H__ +#ifndef __UI_OPTS_H__ +#define __UI_OPTS_H__ #include "options.h" @@ -137,4 +137,4 @@ private: static const options_entry s_option_entries[]; }; -#endif /* __MEWUI_OPTS_H__ */ +#endif /* __UI_OPTS_H__ */ diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp index 4902b496304..3cefed3219c 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/emu/ui/optsmenu.cpp @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/optsmenu.cpp + ui/optsmenu.cpp MEWUI main options menu manager. diff --git a/src/emu/ui/optsmenu.h b/src/emu/ui/optsmenu.h index 5838f5994b5..c1d46a9c80e 100644 --- a/src/emu/ui/optsmenu.h +++ b/src/emu/ui/optsmenu.h @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/optsmenu.h + ui/optsmenu.h MEWUI main options menu manager. @@ -10,8 +10,8 @@ #pragma once -#ifndef __MEWUI_OPTSMENU_H__ -#define __MEWUI_OPTSMENU_H__ +#ifndef __UI_OPTSMENU_H__ +#define __UI_OPTSMENU_H__ class ui_menu_game_options : public ui_menu { @@ -46,4 +46,4 @@ private: // save options to file void save_game_options(running_machine &machine); -#endif /* __MEWUI_OPTSMENU_H__ */ +#endif /* __UI_OPTSMENU_H__ */ diff --git a/src/emu/ui/selector.cpp b/src/emu/ui/selector.cpp index 5766cc14cb3..06419d93f72 100644 --- a/src/emu/ui/selector.cpp +++ b/src/emu/ui/selector.cpp @@ -2,9 +2,9 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/m_selector.cpp + ui/m_selector.cpp - Internal MEWUI user interface. + Internal UI user interface. *********************************************************************/ diff --git a/src/emu/ui/selector.h b/src/emu/ui/selector.h index e8b68f57ba4..595ca1f578d 100644 --- a/src/emu/ui/selector.h +++ b/src/emu/ui/selector.h @@ -2,16 +2,16 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/selector.h + ui/selector.h - Internal MEWUI user interface. + Internal UI user interface. ***************************************************************************/ #pragma once -#ifndef __MEWUI_SELECTOR_H__ -#define __MEWUI_SELECTOR_H__ +#ifndef __UI_SELECTOR_H__ +#define __UI_SELECTOR_H__ enum { @@ -48,4 +48,4 @@ private: void find_matches(const char *str); }; -#endif /* __MEWUI_SELECTOR_H__ */ +#endif /* __UI_SELECTOR_H__ */ diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index ba2b91a93e9..7f1e8b647bf 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/selgame.cpp + ui/selgame.cpp Main MEWUI menu. @@ -105,7 +105,7 @@ bool sort_game_list(const game_driver *x, const game_driver *y) // ctor //------------------------------------------------- -ui_mewui_select_game::ui_mewui_select_game(running_machine &machine, render_container *container, const char *gamename) : ui_menu(machine, container) +ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_container *container, const char *gamename) : ui_menu(machine, container) { std::string error_string, last_filter, sub_filter; emu_options &moptions = machine.options(); @@ -181,7 +181,7 @@ ui_mewui_select_game::ui_mewui_select_game(running_machine &machine, render_cont // dtor //------------------------------------------------- -ui_mewui_select_game::~ui_mewui_select_game() +ui_menu_select_game::~ui_menu_select_game() { std::string error_string, last_driver; const game_driver *driver = nullptr; @@ -217,7 +217,7 @@ ui_mewui_select_game::~ui_mewui_select_game() // handle //------------------------------------------------- -void ui_mewui_select_game::handle() +void ui_menu_select_game::handle() { bool check_filter = false; bool enabled_dats = machine().options().enabled_dats(); @@ -545,7 +545,7 @@ void ui_mewui_select_game::handle() // populate //------------------------------------------------- -void ui_mewui_select_game::populate() +void ui_menu_select_game::populate() { mewui_globals::redraw_icon = true; mewui_globals::switch_image = true; @@ -684,7 +684,7 @@ void ui_mewui_select_game::populate() // build a list of available drivers //------------------------------------------------- -void ui_mewui_select_game::build_available_list() +void ui_menu_select_game::build_available_list() { int m_total = driver_list::total(); std::vector m_included(m_total, false); @@ -744,7 +744,7 @@ void ui_mewui_select_game::build_available_list() // perform our special rendering //------------------------------------------------- -void ui_mewui_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +void ui_menu_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { const game_driver *driver = nullptr; ui_software_info *swinfo = nullptr; @@ -980,7 +980,7 @@ void ui_mewui_select_game::custom_render(void *selectedref, float top, float bot // and inescapable //------------------------------------------------- -void ui_mewui_select_game::force_game_select(running_machine &machine, render_container *container) +void ui_menu_select_game::force_game_select(running_machine &machine, render_container *container) { // reset the menu stack ui_menu::stack_reset(machine); @@ -989,7 +989,7 @@ void ui_mewui_select_game::force_game_select(running_machine &machine, render_co ui_menu *quit = global_alloc_clear(machine, container); quit->set_special_main_menu(true); ui_menu::stack_push(quit); - ui_menu::stack_push(global_alloc_clear(machine, container, nullptr)); + ui_menu::stack_push(global_alloc_clear(machine, container, nullptr)); // force the menus on machine.ui().show_menu(); @@ -1002,7 +1002,7 @@ void ui_mewui_select_game::force_game_select(running_machine &machine, render_co // handle select key event //------------------------------------------------- -void ui_mewui_select_game::inkey_select(const ui_menu_event *m_event) +void ui_menu_select_game::inkey_select(const ui_menu_event *m_event) { const game_driver *driver = (const game_driver *)m_event->itemref; @@ -1061,7 +1061,7 @@ void ui_mewui_select_game::inkey_select(const ui_menu_event *m_event) // handle select key event for favorites menu //------------------------------------------------- -void ui_mewui_select_game::inkey_select_favorite(const ui_menu_event *m_event) +void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) { ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; emu_options &mopt = machine().options(); @@ -1166,7 +1166,7 @@ void ui_mewui_select_game::inkey_select_favorite(const ui_menu_event *m_event) // returns if the search can be activated //------------------------------------------------- -inline bool ui_mewui_select_game::no_active_search() +inline bool ui_menu_select_game::no_active_search() { return (main_filters::actual == FILTER_FAVORITE_GAME); } @@ -1175,7 +1175,7 @@ inline bool ui_mewui_select_game::no_active_search() // handle special key event //------------------------------------------------- -void ui_mewui_select_game::inkey_special(const ui_menu_event *m_event) +void ui_menu_select_game::inkey_special(const ui_menu_event *m_event) { int buflen = strlen(m_search); @@ -1214,7 +1214,7 @@ void ui_mewui_select_game::inkey_special(const ui_menu_event *m_event) // build list //------------------------------------------------- -void ui_mewui_select_game::build_list(std::vector &s_drivers, const char *filter_text, int filter, bool bioscheck) +void ui_menu_select_game::build_list(std::vector &s_drivers, const char *filter_text, int filter, bool bioscheck) { int cx = 0; bool cloneof = false; @@ -1330,7 +1330,7 @@ void ui_mewui_select_game::build_list(std::vector &s_driver // build custom display list //------------------------------------------------- -void ui_mewui_select_game::build_custom() +void ui_menu_select_game::build_custom() { std::vector s_drivers; bool bioscheck = false; @@ -1395,7 +1395,7 @@ void ui_mewui_select_game::build_custom() // build category list //------------------------------------------------- -void ui_mewui_select_game::build_category() +void ui_menu_select_game::build_category() { std::vector temp_filter; machine().inifile().load_ini_category(temp_filter); @@ -1411,7 +1411,7 @@ void ui_mewui_select_game::build_category() // build list from cache //------------------------------------------------- -void ui_mewui_select_game::build_from_cache(std::vector &s_drivers, int screens, int filter, bool bioscheck) +void ui_menu_select_game::build_from_cache(std::vector &s_drivers, int screens, int filter, bool bioscheck) { if (s_drivers.empty()) { @@ -1471,7 +1471,7 @@ void ui_mewui_select_game::build_from_cache(std::vector &s_ // populate search list //------------------------------------------------- -void ui_mewui_select_game::populate_search() +void ui_menu_select_game::populate_search() { // allocate memory to track the penalty value std::vector penalty(VISIBLE_GAMES_IN_SEARCH, 9999); @@ -1522,7 +1522,7 @@ void ui_mewui_select_game::populate_search() // generate general info //------------------------------------------------- -void ui_mewui_select_game::general_info(const game_driver *driver, std::string &buffer) +void ui_menu_select_game::general_info(const game_driver *driver, std::string &buffer) { strprintf(buffer, "Romset: %-.100s\n", driver->name); buffer.append("Year: ").append(driver->year).append("\n"); @@ -1598,7 +1598,7 @@ void ui_mewui_select_game::general_info(const game_driver *driver, std::string & buffer.append("Roms Audit Pass: Disabled\nSamples Audit Pass: Disabled\n"); } -void ui_mewui_select_game::inkey_export() +void ui_menu_select_game::inkey_export() { std::string filename("exported"); emu_file infile(machine().options().mewui_path(), OPEN_FLAG_READ); @@ -1654,7 +1654,7 @@ void ui_mewui_select_game::inkey_export() // save drivers infos to file //------------------------------------------------- -void ui_mewui_select_game::save_cache_info() +void ui_menu_select_game::save_cache_info() { // attempt to open the output file emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); @@ -1743,7 +1743,7 @@ void ui_mewui_select_game::save_cache_info() // load drivers infos from file //------------------------------------------------- -void ui_mewui_select_game::load_cache_info() +void ui_menu_select_game::load_cache_info() { driver_cache.resize(driver_list::total() + 1); @@ -1817,7 +1817,7 @@ void ui_mewui_select_game::load_cache_info() // load drivers infos from file //------------------------------------------------- -bool ui_mewui_select_game::load_available_machines() +bool ui_menu_select_game::load_available_machines() { // try to load available drivers from file emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); @@ -1869,7 +1869,7 @@ bool ui_mewui_select_game::load_available_machines() // load custom filters info from file //------------------------------------------------- -void ui_mewui_select_game::load_custom_filters() +void ui_menu_select_game::load_custom_filters() { // attempt to open the output file emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); @@ -1937,7 +1937,7 @@ void ui_mewui_select_game::load_custom_filters() // draw left box //------------------------------------------------- -float ui_mewui_select_game::draw_left_panel(float x1, float y1, float x2, float y2) +float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2) { ui_manager &mui = machine().ui(); float line_height = mui.get_line_height(); @@ -2091,7 +2091,7 @@ float ui_mewui_select_game::draw_left_panel(float x1, float y1, float x2, float // draw infos //------------------------------------------------- -void ui_mewui_select_game::infos_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) +void ui_menu_select_game::infos_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) { ui_manager &mui = machine().ui(); float line_height = mui.get_line_height(); @@ -2369,7 +2369,7 @@ void ui_mewui_select_game::infos_render(void *selectedref, float origx1, float o } } -void ui_mewui_select_game::draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) +void ui_menu_select_game::draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) { ui_manager &mui = machine().ui(); float line_height = mui.get_line_height(); @@ -2413,7 +2413,7 @@ void ui_mewui_select_game::draw_right_panel(void *selectedref, float origx1, flo // perform our special rendering //------------------------------------------------- -void ui_mewui_select_game::arts_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) +void ui_menu_select_game::arts_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) { ui_manager &mui = machine().ui(); float line_height = mui.get_line_height(); diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h index 175194826ca..b1acdc31e92 100644 --- a/src/emu/ui/selgame.h +++ b/src/emu/ui/selgame.h @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/selgame.h + ui/selgame.h Main MEWUI menu. @@ -10,17 +10,17 @@ #pragma once -#ifndef __MEWUI_MAIN_H__ -#define __MEWUI_MAIN_H__ +#ifndef __UI_MAIN_H__ +#define __UI_MAIN_H__ #include "drivenum.h" #include "ui/menu.h" -class ui_mewui_select_game : public ui_menu +class ui_menu_select_game : public ui_menu { public: - ui_mewui_select_game(running_machine &machine, render_container *container, const char *gamename); - virtual ~ui_mewui_select_game(); + ui_menu_select_game(running_machine &machine, render_container *container, const char *gamename); + virtual ~ui_menu_select_game(); virtual void populate() override; virtual void handle() override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; @@ -85,4 +85,4 @@ private: }; -#endif /* __MEWUI_MAIN_H__ */ +#endif /* __UI_MAIN_H__ */ diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index ccc98d5f0a3..a8bedde43b4 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -2,7 +2,7 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/selsoft.cpp + ui/selsoft.cpp MEWUI softwares menu. diff --git a/src/emu/ui/selsoft.h b/src/emu/ui/selsoft.h index 9691e5ad118..f5a2063cec6 100644 --- a/src/emu/ui/selsoft.h +++ b/src/emu/ui/selsoft.h @@ -2,15 +2,15 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/selsoft.h + ui/selsoft.h MEWUI softwares menu. ***************************************************************************/ #pragma once -#ifndef __MEWUI_SELSOFT_H__ -#define __MEWUI_SELSOFT_H__ +#ifndef __UI_SELSOFT_H__ +#define __UI_SELSOFT_H__ #include "ui/custmenu.h" @@ -109,4 +109,4 @@ private: bool has_multiple_bios(const game_driver *driver, std::vector &biosname); -#endif /* __MEWUI_SELSOFT_H__ */ +#endif /* __UI_SELSOFT_H__ */ diff --git a/src/emu/ui/sndmenu.cpp b/src/emu/ui/sndmenu.cpp index d8dfa05404f..76568509385 100644 --- a/src/emu/ui/sndmenu.cpp +++ b/src/emu/ui/sndmenu.cpp @@ -2,9 +2,9 @@ // copyright-holders:Dankan1890 /********************************************************************* - mewui/sndmenu.cpp + ui/sndmenu.cpp - Internal MEWUI user interface. + Internal UI user interface. *********************************************************************/ diff --git a/src/emu/ui/sndmenu.h b/src/emu/ui/sndmenu.h index 19112ad848f..8b13b38ea88 100644 --- a/src/emu/ui/sndmenu.h +++ b/src/emu/ui/sndmenu.h @@ -2,16 +2,16 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/sndmenu.h + ui/sndmenu.h - Internal MEWUI user interface. + Internal UI user interface. ***************************************************************************/ #pragma once -#ifndef __MEWUI_SNDMENU_H__ -#define __MEWUI_SNDMENU_H__ +#ifndef __UI_SNDMENU_H__ +#define __UI_SNDMENU_H__ //------------------------------------------------- // class sound options menu @@ -39,4 +39,4 @@ private: bool m_samples, m_sound; }; -#endif /* __MEWUI_SNDMENU_H__ */ +#endif /* __UI_SNDMENU_H__ */ diff --git a/src/emu/ui/utils.cpp b/src/emu/ui/utils.cpp index 3dbf3e30e01..e52274e22f1 100644 --- a/src/emu/ui/utils.cpp +++ b/src/emu/ui/utils.cpp @@ -2,9 +2,9 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/utils.cpp + ui/utils.cpp - Internal MEWUI user interface. + Internal UI user interface. ***************************************************************************/ diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index fc3bdf2d32d..3e339ccadce 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -2,16 +2,16 @@ // copyright-holders:Dankan1890 /*************************************************************************** - mewui/utils.h + ui/utils.h - Internal MEWUI user interface. + Internal UI user interface. ***************************************************************************/ #pragma once -#ifndef __MEWUI_UTILS_H__ -#define __MEWUI_UTILS_H__ +#ifndef __UI_UTILS_H__ +#define __UI_UTILS_H__ #include "osdepend.h" #include "render.h" @@ -364,4 +364,4 @@ void render_load_jpeg(_T &bitmap, emu_file &file, const char *dirname, const cha global_free_array(jpg_buffer); } -#endif /* __MEWUI_UTILS_H__ */ +#endif /* __UI_UTILS_H__ */ -- cgit v1.2.3-70-g09d2 From 52d97f0dfa95c6400001bf986b6aac6ea9a95a22 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 4 Feb 2016 15:01:41 +0100 Subject: more mewui -> ui renames (nw) --- src/emu/emuopts.cpp | 2 +- src/emu/emuopts.h | 2 +- src/emu/ui/custui.cpp | 12 ++--- src/emu/ui/dirmenu.cpp | 2 +- src/emu/ui/dsplmenu.cpp | 2 +- src/emu/ui/menu.cpp | 68 ++++++++++++++--------------- src/emu/ui/miscmenu.cpp | 4 +- src/emu/ui/moptions.cpp | 8 ++-- src/emu/ui/moptions.h | 4 +- src/emu/ui/optsmenu.cpp | 2 +- src/emu/ui/selector.cpp | 2 +- src/emu/ui/selgame.cpp | 114 ++++++++++++++++++++++++------------------------ src/emu/ui/selsoft.cpp | 76 ++++++++++++++++---------------- src/emu/ui/utils.cpp | 24 +++++----- src/emu/ui/utils.h | 2 +- 15 files changed, 162 insertions(+), 162 deletions(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 41b9a69fc2b..94f91fe1ca3 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -201,7 +201,7 @@ const options_entry emu_options::s_option_entries[] = //------------------------------------------------- emu_options::emu_options() -: mewui_options() +: ui_options() , m_coin_impulse(0) , m_joystick_contradictory(false) , m_sleep(true) diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index 8f72e00144b..44ee7165df5 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -201,7 +201,7 @@ struct game_driver; class software_part; -class emu_options : public mewui_options +class emu_options : public ui_options { static const UINT32 OPTION_FLAG_DEVICE = 0x80000000; diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index fb247509e59..c256b41221f 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -33,8 +33,8 @@ ui_menu_custom_ui::ui_menu_custom_ui(running_machine &machine, render_container ui_menu_custom_ui::~ui_menu_custom_ui() { std::string error_string; - machine().options().set_value(OPTION_HIDE_PANELS, mewui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); - mewui_globals::reset = true; + machine().options().set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); + ui_globals::reset = true; } //------------------------------------------------- @@ -53,7 +53,7 @@ void ui_menu_custom_ui::handle() if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) { changed = true; - (m_event->iptkey == IPT_UI_RIGHT) ? mewui_globals::panels_status++ : mewui_globals::panels_status--; + (m_event->iptkey == IPT_UI_RIGHT) ? ui_globals::panels_status++ : ui_globals::panels_status--; } @@ -75,7 +75,7 @@ void ui_menu_custom_ui::handle() for (int index = 0; index < total; ++index) s_sel[index] = hide_status[index]; - ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, mewui_globals::panels_status)); + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, ui_globals::panels_status)); } } } @@ -94,8 +94,8 @@ void ui_menu_custom_ui::populate() item_append("Fonts", nullptr, 0, (void *)(FPTR)FONT_MENU); item_append("Colors", nullptr, 0, (void *)(FPTR)COLORS_MENU); - UINT32 arrow_flags = get_arrow_flags(0, (int)HIDE_BOTH, mewui_globals::panels_status); - item_append("Filters and Info/Image", hide_status[mewui_globals::panels_status], arrow_flags, (void *)(FPTR)HIDE_MENU); + UINT32 arrow_flags = get_arrow_flags(0, (int)HIDE_BOTH, ui_globals::panels_status); + item_append("Filters and Info/Image", hide_status[ui_globals::panels_status], arrow_flags, (void *)(FPTR)HIDE_MENU); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp index 21a8a177623..4b23bce9c59 100644 --- a/src/emu/ui/dirmenu.cpp +++ b/src/emu/ui/dirmenu.cpp @@ -327,7 +327,7 @@ ui_menu_directory::ui_menu_directory(running_machine &machine, render_container ui_menu_directory::~ui_menu_directory() { save_game_options(machine()); - mewui_globals::reset = true; + ui_globals::reset = true; } //------------------------------------------------- diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp index 68c218014bd..f98068a729d 100644 --- a/src/emu/ui/dsplmenu.cpp +++ b/src/emu/ui/dsplmenu.cpp @@ -89,7 +89,7 @@ ui_menu_display_options::~ui_menu_display_options() machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); machine().options().set_value(m_options[1].option, m_video[m_options[1].status].option, OPTION_PRIORITY_CMDLINE, error_string); - mewui_globals::reset = true; + ui_globals::reset = true; } //------------------------------------------------- diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index cbbb0bcdb11..2d9a6f679c2 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -1363,7 +1363,7 @@ void ui_menu::draw_select_game(bool noinput) float ud_arrow_width = line_height * machine().render().ui_aspect(); float gutter_width = 0.4f * line_height * machine().render().ui_aspect() * 1.3f; mouse_x = -1, mouse_y = -1; - float right_panel_size = (mewui_globals::panels_status == HIDE_BOTH || mewui_globals::panels_status == HIDE_RIGHT_PANEL) ? 2.0f * UI_BOX_LR_BORDER : 0.3f; + float right_panel_size = (ui_globals::panels_status == HIDE_BOTH || ui_globals::panels_status == HIDE_RIGHT_PANEL) ? 2.0f * UI_BOX_LR_BORDER : 0.3f; float visible_width = 1.0f - 4.0f * UI_BOX_LR_BORDER; float primary_left = (1.0f - visible_width) * 0.5f; float primary_width = visible_width; @@ -1397,9 +1397,9 @@ void ui_menu::draw_select_game(bool noinput) visible_main_menu_height = (float)(visible_lines * line_height); if (!is_swlist) - mewui_globals::visible_main_lines = visible_lines; + ui_globals::visible_main_lines = visible_lines; else - mewui_globals::visible_sw_lines = visible_lines; + ui_globals::visible_sw_lines = visible_lines; // compute top/left of inner menu area by centering float visible_left = primary_left; @@ -1600,7 +1600,7 @@ void ui_menu::draw_select_game(bool noinput) // reset redraw icon stage if (!is_swlist) - mewui_globals::redraw_icon = false; + ui_globals::redraw_icon = false; } //------------------------------------------------- @@ -1610,17 +1610,17 @@ void ui_menu::draw_select_game(bool noinput) void ui_menu::get_title_search(std::string &snaptext, std::string &searchstr) { // get arts title text - snaptext.assign(arts_info[mewui_globals::curimage_view].title); + snaptext.assign(arts_info[ui_globals::curimage_view].title); // get search path - path_iterator path(machine().options().value(arts_info[mewui_globals::curimage_view].path)); + path_iterator path(machine().options().value(arts_info[ui_globals::curimage_view].path)); std::string curpath; - searchstr.assign(machine().options().value(arts_info[mewui_globals::curimage_view].path)); + searchstr.assign(machine().options().value(arts_info[ui_globals::curimage_view].path)); // iterate over path and add path for zipped formats while (path.next(curpath)) { - path_iterator path_iter(arts_info[mewui_globals::curimage_view].addpath); + path_iterator path_iter(arts_info[ui_globals::curimage_view].addpath); std::string c_path; while (path_iter.next(c_path)) searchstr.append(";").append(curpath).append(PATH_SEPARATOR).append(c_path); @@ -1664,10 +1664,10 @@ void ui_menu::handle_main_keys(UINT32 flags) validate_selection(1); // swallow left/right keys if they are not appropriate - bool ignoreleft = ((item[selected].flags & MENU_FLAG_LEFT_ARROW) == 0 || mewui_globals::panels_status == HIDE_BOTH || mewui_globals::panels_status == HIDE_RIGHT_PANEL); - bool ignoreright = ((item[selected].flags & MENU_FLAG_RIGHT_ARROW) == 0 || mewui_globals::panels_status == HIDE_BOTH || mewui_globals::panels_status == HIDE_RIGHT_PANEL); - bool ignoreup = (mewui_globals::panels_status == HIDE_BOTH || mewui_globals::panels_status == HIDE_LEFT_PANEL); - bool ignoredown = (mewui_globals::panels_status == HIDE_BOTH || mewui_globals::panels_status == HIDE_LEFT_PANEL); + bool ignoreleft = ((item[selected].flags & MENU_FLAG_LEFT_ARROW) == 0 || ui_globals::panels_status == HIDE_BOTH || ui_globals::panels_status == HIDE_RIGHT_PANEL); + bool ignoreright = ((item[selected].flags & MENU_FLAG_RIGHT_ARROW) == 0 || ui_globals::panels_status == HIDE_BOTH || ui_globals::panels_status == HIDE_RIGHT_PANEL); + bool ignoreup = (ui_globals::panels_status == HIDE_BOTH || ui_globals::panels_status == HIDE_LEFT_PANEL); + bool ignoredown = (ui_globals::panels_status == HIDE_BOTH || ui_globals::panels_status == HIDE_LEFT_PANEL); input_manager &minput = machine().input(); // accept left/right keys as-is with repeat @@ -1893,25 +1893,25 @@ void ui_menu::handle_main_events(UINT32 flags) topline_datsview -= right_visible_lines - 1; else if (hover == HOVER_LPANEL_ARROW) { - if (mewui_globals::panels_status == HIDE_LEFT_PANEL) - mewui_globals::panels_status = SHOW_PANELS; - else if (mewui_globals::panels_status == HIDE_BOTH) - mewui_globals::panels_status = HIDE_RIGHT_PANEL; - else if (mewui_globals::panels_status == SHOW_PANELS) - mewui_globals::panels_status = HIDE_LEFT_PANEL; - else if (mewui_globals::panels_status == HIDE_RIGHT_PANEL) - mewui_globals::panels_status = HIDE_BOTH; + if (ui_globals::panels_status == HIDE_LEFT_PANEL) + ui_globals::panels_status = SHOW_PANELS; + else if (ui_globals::panels_status == HIDE_BOTH) + ui_globals::panels_status = HIDE_RIGHT_PANEL; + else if (ui_globals::panels_status == SHOW_PANELS) + ui_globals::panels_status = HIDE_LEFT_PANEL; + else if (ui_globals::panels_status == HIDE_RIGHT_PANEL) + ui_globals::panels_status = HIDE_BOTH; } else if (hover == HOVER_RPANEL_ARROW) { - if (mewui_globals::panels_status == HIDE_RIGHT_PANEL) - mewui_globals::panels_status = SHOW_PANELS; - else if (mewui_globals::panels_status == HIDE_BOTH) - mewui_globals::panels_status = HIDE_LEFT_PANEL; - else if (mewui_globals::panels_status == SHOW_PANELS) - mewui_globals::panels_status = HIDE_RIGHT_PANEL; - else if (mewui_globals::panels_status == HIDE_LEFT_PANEL) - mewui_globals::panels_status = HIDE_BOTH; + if (ui_globals::panels_status == HIDE_RIGHT_PANEL) + ui_globals::panels_status = SHOW_PANELS; + else if (ui_globals::panels_status == HIDE_BOTH) + ui_globals::panels_status = HIDE_LEFT_PANEL; + else if (ui_globals::panels_status == SHOW_PANELS) + ui_globals::panels_status = HIDE_RIGHT_PANEL; + else if (ui_globals::panels_status == HIDE_LEFT_PANEL) + ui_globals::panels_status = HIDE_BOTH; } else if (hover == HOVER_B_FAV) { @@ -1958,7 +1958,7 @@ void ui_menu::handle_main_events(UINT32 flags) } else if (hover >= HOVER_RP_FIRST && hover <= HOVER_RP_LAST) { - mewui_globals::rpanel = (HOVER_RP_FIRST - hover) * (-1); + ui_globals::rpanel = (HOVER_RP_FIRST - hover) * (-1); stop = true; } else if (hover >= HOVER_SW_FILTER_FIRST && hover <= HOVER_SW_FILTER_LAST) @@ -2116,7 +2116,7 @@ float ui_menu::draw_right_box_title(float x1, float y1, float x2, float y2) if (mouse_hit && x1 <= mouse_x && x1 + midl > mouse_x && y1 <= mouse_y && y1 + line_height > mouse_y) { - if (mewui_globals::rpanel != cells) + if (ui_globals::rpanel != cells) { bgcolor = UI_MOUSEOVER_BG_COLOR; fgcolor = UI_MOUSEOVER_COLOR; @@ -2124,7 +2124,7 @@ float ui_menu::draw_right_box_title(float x1, float y1, float x2, float y2) } } - if (mewui_globals::rpanel != cells) + if (ui_globals::rpanel != cells) { container->add_line(x1, y1 + line_height, x1 + midl, y1 + line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); @@ -2168,7 +2168,7 @@ std::string ui_menu::arts_render_common(float origx1, float origy1, float origx2 machine().ui().draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - draw_common_arrow(origx1, origy1, origx2, origy2, mewui_globals::curimage_view, FIRST_VIEW, LAST_VIEW, title_size); + draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curimage_view, FIRST_VIEW, LAST_VIEW, title_size); return searchstr; } @@ -2272,7 +2272,7 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float int dest_yPixel = tmp_bitmap->height(); // force 4:3 ratio min - if (machine().options().forced_4x3_snapshot() && ratioI < 0.75f && mewui_globals::curimage_view == SNAPSHOT_VIEW) + if (machine().options().forced_4x3_snapshot() && ratioI < 0.75f && ui_globals::curimage_view == SNAPSHOT_VIEW) { // smaller ratio will ensure that the image fits in the view dest_yPixel = tmp_bitmap->width() * 0.75f; @@ -2387,7 +2387,7 @@ void ui_menu::draw_icon(int linenum, void *selectedref, float x0, float y0) if (driver == nullptr) return; - if (olddriver[linenum] != driver || mewui_globals::redraw_icon) + if (olddriver[linenum] != driver || ui_globals::redraw_icon) { olddriver[linenum] = driver; diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp index 35181d6a584..2226d0435a8 100644 --- a/src/emu/ui/miscmenu.cpp +++ b/src/emu/ui/miscmenu.cpp @@ -587,7 +587,7 @@ ui_menu_misc_options::~ui_menu_misc_options() std::string error_string; for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); - mewui_globals::reset = true; + ui_globals::reset = true; } //------------------------------------------------- @@ -607,7 +607,7 @@ void ui_menu_misc_options::handle() changed = true; int value = (FPTR)m_event->itemref; if (!strcmp(m_options[value].option, OPTION_ENLARGE_SNAPS)) - mewui_globals::switch_image = true; + ui_globals::switch_image = true; m_options[value].status = !m_options[value].status; } } diff --git a/src/emu/ui/moptions.cpp b/src/emu/ui/moptions.cpp index 83ff444783a..7d68bd7d483 100644 --- a/src/emu/ui/moptions.cpp +++ b/src/emu/ui/moptions.cpp @@ -16,7 +16,7 @@ // MEWUI EXTRA OPTIONS //************************************************************************** -const options_entry mewui_options::s_option_entries[] = +const options_entry ui_options::s_option_entries[] = { // seach path options { nullptr, nullptr, OPTION_HEADER, "MEWUI SEARCH PATH OPTIONS" }, @@ -79,11 +79,11 @@ const options_entry mewui_options::s_option_entries[] = }; //------------------------------------------------- -// mewui_options - constructor +// ui_options - constructor //------------------------------------------------- -mewui_options::mewui_options() +ui_options::ui_options() : core_options() { - add_entries(mewui_options::s_option_entries); + add_entries(ui_options::s_option_entries); } diff --git a/src/emu/ui/moptions.h b/src/emu/ui/moptions.h index b2db7f68059..5baf153ff3d 100644 --- a/src/emu/ui/moptions.h +++ b/src/emu/ui/moptions.h @@ -71,11 +71,11 @@ #define OPTION_UI_DIPSW_COLOR "ui_dipsw_color" #define OPTION_UI_SLIDER_COLOR "ui_slider_color" -class mewui_options : public core_options +class ui_options : public core_options { public: // construction/destruction - mewui_options(); + ui_options(); // Search path options const char *history_path() const { return value(OPTION_HISTORY_PATH); } diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp index 3cefed3219c..dc86e3e7178 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/emu/ui/optsmenu.cpp @@ -40,7 +40,7 @@ ui_menu_game_options::~ui_menu_game_options() { ui_menu::menu_stack->reset(UI_MENU_RESET_SELECT_FIRST); save_game_options(machine()); - mewui_globals::switch_image = true; + ui_globals::switch_image = true; } //------------------------------------------------- diff --git a/src/emu/ui/selector.cpp b/src/emu/ui/selector.cpp index 06419d93f72..c9cc3c7b6c0 100644 --- a/src/emu/ui/selector.cpp +++ b/src/emu/ui/selector.cpp @@ -78,7 +78,7 @@ void ui_menu_selector::handle() break; } - mewui_globals::switch_image = true; + ui_globals::switch_image = true; ui_menu::stack_pop(machine()); } else if (m_event->iptkey == IPT_SPECIAL) diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 7f1e8b647bf..a1cd39508ac 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -169,12 +169,12 @@ ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_contai moptions.set_value(OPTION_SNAPNAME, "%g/%i", OPTION_PRIORITY_CMDLINE, error_string); moptions.set_value(OPTION_SOFTWARENAME, "", OPTION_PRIORITY_CMDLINE, error_string); - mewui_globals::curimage_view = FIRST_VIEW; - mewui_globals::curdats_view = MEWUI_FIRST_LOAD; - mewui_globals::switch_image = false; - mewui_globals::default_image = true; + ui_globals::curimage_view = FIRST_VIEW; + ui_globals::curdats_view = MEWUI_FIRST_LOAD; + ui_globals::switch_image = false; + ui_globals::default_image = true; ume_filters::actual = moptions.start_filter(); - mewui_globals::panels_status = moptions.hide_panels(); + ui_globals::panels_status = moptions.hide_panels(); } //------------------------------------------------- @@ -209,7 +209,7 @@ ui_menu_select_game::~ui_menu_select_game() mopt.set_value(OPTION_START_FILTER, ume_filters::actual, OPTION_PRIORITY_CMDLINE, error_string); mopt.set_value(OPTION_LAST_USED_FILTER, filter.c_str(), OPTION_PRIORITY_CMDLINE, error_string); mopt.set_value(OPTION_LAST_USED_MACHINE, last_driver.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - mopt.set_value(OPTION_HIDE_PANELS, mewui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); + mopt.set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); save_game_options(machine()); } @@ -223,9 +223,9 @@ void ui_menu_select_game::handle() bool enabled_dats = machine().options().enabled_dats(); // if i have to load datfile, performe an hard reset - if (mewui_globals::reset) + if (ui_globals::reset) { - mewui_globals::reset = false; + ui_globals::reset = false; machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); return; @@ -263,17 +263,17 @@ void ui_menu_select_game::handle() else if (m_event->iptkey == IPT_UI_LEFT) { // Images - if (mewui_globals::rpanel == RP_IMAGES && mewui_globals::curimage_view > FIRST_VIEW) + if (ui_globals::rpanel == RP_IMAGES && ui_globals::curimage_view > FIRST_VIEW) { - mewui_globals::curimage_view--; - mewui_globals::switch_image = true; - mewui_globals::default_image = false; + ui_globals::curimage_view--; + ui_globals::switch_image = true; + ui_globals::default_image = false; } // Infos - else if (mewui_globals::rpanel == RP_INFOS && mewui_globals::curdats_view > MEWUI_FIRST_LOAD) + else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view > MEWUI_FIRST_LOAD) { - mewui_globals::curdats_view--; + ui_globals::curdats_view--; topline_datsview = 0; } } @@ -282,17 +282,17 @@ void ui_menu_select_game::handle() else if (m_event->iptkey == IPT_UI_RIGHT) { // Images - if (mewui_globals::rpanel == RP_IMAGES && mewui_globals::curimage_view < LAST_VIEW) + if (ui_globals::rpanel == RP_IMAGES && ui_globals::curimage_view < LAST_VIEW) { - mewui_globals::curimage_view++; - mewui_globals::switch_image = true; - mewui_globals::default_image = false; + ui_globals::curimage_view++; + ui_globals::switch_image = true; + ui_globals::default_image = false; } // Infos - else if (mewui_globals::rpanel == RP_INFOS && mewui_globals::curdats_view < MEWUI_LAST_LOAD) + else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view < MEWUI_LAST_LOAD) { - mewui_globals::curdats_view++; + ui_globals::curdats_view++; topline_datsview = 0; } } @@ -313,11 +313,11 @@ void ui_menu_select_game::handle() // handle UI_LEFT_PANEL else if (m_event->iptkey == IPT_UI_LEFT_PANEL) - mewui_globals::rpanel = RP_IMAGES; + ui_globals::rpanel = RP_IMAGES; // handle UI_RIGHT_PANEL else if (m_event->iptkey == IPT_UI_RIGHT_PANEL) - mewui_globals::rpanel = RP_INFOS; + ui_globals::rpanel = RP_INFOS; // escape pressed with non-empty text clears the text else if (m_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0) @@ -547,8 +547,8 @@ void ui_menu_select_game::handle() void ui_menu_select_game::populate() { - mewui_globals::redraw_icon = true; - mewui_globals::switch_image = true; + ui_globals::redraw_icon = true; + ui_globals::switch_image = true; int old_item_selected = -1; if (main_filters::actual != FILTER_FAVORITE_GAME) @@ -668,10 +668,10 @@ void ui_menu_select_game::populate() if (old_item_selected != -1) { selected = old_item_selected; - if (mewui_globals::visible_main_lines == 0) + if (ui_globals::visible_main_lines == 0) top_line = (selected != 0) ? selected - 1 : 0; else - top_line = selected - (mewui_globals::visible_main_lines / 2); + top_line = selected - (ui_globals::visible_main_lines / 2); if (reselect_last::software.empty()) reselect_last::reset(); @@ -1942,7 +1942,7 @@ float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y ui_manager &mui = machine().ui(); float line_height = mui.get_line_height(); - if (mewui_globals::panels_status == SHOW_PANELS || mewui_globals::panels_status == HIDE_RIGHT_PANEL) + if (ui_globals::panels_status == SHOW_PANELS || ui_globals::panels_status == HIDE_RIGHT_PANEL) { float origy1 = y1; float origy2 = y2; @@ -2131,10 +2131,10 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or float oy1 = origy1 + line_height; // MAMESCORE? Full size text - if (mewui_globals::curdats_view == MEWUI_STORY_LOAD) + if (ui_globals::curdats_view == MEWUI_STORY_LOAD) text_size = 1.0f; - std::string snaptext(dats_info[mewui_globals::curdats_view]); + std::string snaptext(dats_info[ui_globals::curdats_view]); // apply title to right panel float title_size = 0.0f; @@ -2151,25 +2151,25 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or mui.draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - draw_common_arrow(origx1, origy1, origx2, origy2, mewui_globals::curdats_view, MEWUI_FIRST_LOAD, MEWUI_LAST_LOAD, title_size); + draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curdats_view, MEWUI_FIRST_LOAD, MEWUI_LAST_LOAD, title_size); - if (driver != olddriver || mewui_globals::curdats_view != oldview) + if (driver != olddriver || ui_globals::curdats_view != oldview) { buffer.clear(); olddriver = driver; - oldview = mewui_globals::curdats_view; + oldview = ui_globals::curdats_view; topline_datsview = 0; totallines = 0; std::vector m_item; - if (mewui_globals::curdats_view == MEWUI_GENERAL_LOAD) + if (ui_globals::curdats_view == MEWUI_GENERAL_LOAD) general_info(driver, buffer); - else if (mewui_globals::curdats_view != MEWUI_COMMAND_LOAD) - machine().datfile().load_data_info(driver, buffer, mewui_globals::curdats_view); + else if (ui_globals::curdats_view != MEWUI_COMMAND_LOAD) + machine().datfile().load_data_info(driver, buffer, ui_globals::curdats_view); else machine().datfile().command_sub_menu(driver, m_item); - if (!m_item.empty() && mewui_globals::curdats_view == MEWUI_COMMAND_LOAD) + if (!m_item.empty() && ui_globals::curdats_view == MEWUI_COMMAND_LOAD) { for (size_t x = 0; x < m_item.size(); ++x) { @@ -2189,7 +2189,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); return; } - else if (mewui_globals::curdats_view != MEWUI_STORY_LOAD && mewui_globals::curdats_view != MEWUI_COMMAND_LOAD) + else if (ui_globals::curdats_view != MEWUI_STORY_LOAD && ui_globals::curdats_view != MEWUI_COMMAND_LOAD) mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, xstart, xend, text_size); else mui.wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * gutter_width), totallines, xstart, xend, text_size); @@ -2215,7 +2215,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or else if (r == r_visible_lines - 1 && itemline != totallines - 1) info_arrow(1, origx1, origx2, oy1, line_height, text_size, ud_arrow_width); // special case for mamescore - else if (mewui_globals::curdats_view == MEWUI_STORY_LOAD) + else if (ui_globals::curdats_view == MEWUI_STORY_LOAD) { // check size float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size); @@ -2245,13 +2245,13 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or } // special case for command - else if (mewui_globals::curdats_view == MEWUI_COMMAND_LOAD || mewui_globals::curdats_view == MEWUI_GENERAL_LOAD) + else if (ui_globals::curdats_view == MEWUI_COMMAND_LOAD || ui_globals::curdats_view == MEWUI_GENERAL_LOAD) { // check size float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size); float tmp_size = (textlen > sc) ? text_size * (sc / textlen) : text_size; - int first_dspace = (mewui_globals::curdats_view == MEWUI_COMMAND_LOAD) ? tempbuf.find(" ") : tempbuf.find(":"); + int first_dspace = (ui_globals::curdats_view == MEWUI_COMMAND_LOAD) ? tempbuf.find(" ") : tempbuf.find(":"); if (first_dspace > 0) { float effective_width = origx2 - origx1 - gutter_width; @@ -2290,7 +2290,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or { mui.draw_text_full(container, "History", origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - mewui_globals::cur_sw_dats_view = 0; + ui_globals::cur_sw_dats_view = 0; } else { @@ -2308,18 +2308,18 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or title_size = MAX(txt_lenght, title_size); } - mui.draw_text_full(container, t_text[mewui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1, + mui.draw_text_full(container, t_text[ui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - draw_common_arrow(origx1, origy1, origx2, origy2, mewui_globals::cur_sw_dats_view, 0, 1, title_size); + draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::cur_sw_dats_view, 0, 1, title_size); } - if (oldsoft != soft || old_sw_view != mewui_globals::cur_sw_dats_view) + if (oldsoft != soft || old_sw_view != ui_globals::cur_sw_dats_view) { buffer.clear(); - old_sw_view = mewui_globals::cur_sw_dats_view; + old_sw_view = ui_globals::cur_sw_dats_view; oldsoft = soft; - if (mewui_globals::cur_sw_dats_view == 0) + if (ui_globals::cur_sw_dats_view == 0) { if (soft->startempty == 1) machine().datfile().load_data_info(soft->driver, buffer, MEWUI_HISTORY_LOAD); @@ -2375,7 +2375,7 @@ void ui_menu_select_game::draw_right_panel(void *selectedref, float origx1, floa float line_height = mui.get_line_height(); float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); rgb_t fgcolor = UI_TEXT_COLOR; - bool hide = (mewui_globals::panels_status == HIDE_RIGHT_PANEL || mewui_globals::panels_status == HIDE_BOTH); + bool hide = (ui_globals::panels_status == HIDE_RIGHT_PANEL || ui_globals::panels_status == HIDE_BOTH); float x2 = (hide) ? origx2 : origx1 + 2.0f * UI_BOX_LR_BORDER; // set left-right arrows dimension @@ -2403,7 +2403,7 @@ void ui_menu_select_game::draw_right_panel(void *selectedref, float origx1, floa origx1 = x2; origy1 = draw_right_box_title(origx1, origy1, origx2, origy2); - if (mewui_globals::rpanel == RP_IMAGES) + if (ui_globals::rpanel == RP_IMAGES) arts_render(selectedref, origx1, origy1, origx2, origy2); else infos_render(selectedref, origx1, origy1, origx2, origy2); @@ -2442,14 +2442,14 @@ void ui_menu_select_game::arts_render(void *selectedref, float origx1, float ori if (driver) { - if (mewui_globals::default_image) - ((driver->flags & MACHINE_TYPE_ARCADE) == 0) ? mewui_globals::curimage_view = CABINETS_VIEW : mewui_globals::curimage_view = SNAPSHOT_VIEW; + if (ui_globals::default_image) + ((driver->flags & MACHINE_TYPE_ARCADE) == 0) ? ui_globals::curimage_view = CABINETS_VIEW : ui_globals::curimage_view = SNAPSHOT_VIEW; std::string searchstr; searchstr = arts_render_common(origx1, origy1, origx2, origy2); // loads the image if necessary - if (driver != olddriver || !snapx_bitmap->valid() || mewui_globals::switch_image) + if (driver != olddriver || !snapx_bitmap->valid() || ui_globals::switch_image) { emu_file snapfile(searchstr.c_str(), OPEN_FLAG_READ); bitmap_argb32 *tmp_bitmap; @@ -2501,7 +2501,7 @@ void ui_menu_select_game::arts_render(void *selectedref, float origx1, float ori } olddriver = driver; - mewui_globals::switch_image = false; + ui_globals::switch_image = false; arts_render_images(tmp_bitmap, origx1, origy1, origx2, origy2, false); auto_free(machine(), tmp_bitmap); } @@ -2522,15 +2522,15 @@ void ui_menu_select_game::arts_render(void *selectedref, float origx1, float ori { std::string fullname, pathname; - if (mewui_globals::default_image) - (soft->startempty == 0) ? mewui_globals::curimage_view = SNAPSHOT_VIEW : mewui_globals::curimage_view = CABINETS_VIEW; + if (ui_globals::default_image) + (soft->startempty == 0) ? ui_globals::curimage_view = SNAPSHOT_VIEW : ui_globals::curimage_view = CABINETS_VIEW; // arts title and searchpath std::string searchstr; searchstr = arts_render_common(origx1, origy1, origx2, origy2); // loads the image if necessary - if (soft != oldsoft || !snapx_bitmap->valid() || mewui_globals::switch_image) + if (soft != oldsoft || !snapx_bitmap->valid() || ui_globals::switch_image) { emu_file snapfile(searchstr.c_str(), OPEN_FLAG_READ); bitmap_argb32 *tmp_bitmap; @@ -2548,7 +2548,7 @@ void ui_menu_select_game::arts_render(void *selectedref, float origx1, float ori render_load_jpeg(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); } } - else if (mewui_globals::curimage_view == TITLES_VIEW) + else if (ui_globals::curimage_view == TITLES_VIEW) { // First attempt from name list pathname.assign(soft->listname).append("_titles"); @@ -2590,7 +2590,7 @@ void ui_menu_select_game::arts_render(void *selectedref, float origx1, float ori } oldsoft = soft; - mewui_globals::switch_image = false; + ui_globals::switch_image = false; arts_render_images(tmp_bitmap, origx1, origy1, origx2, origy2, true); auto_free(machine(), tmp_bitmap); } diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index a8bedde43b4..fbc6f698217 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -132,9 +132,9 @@ ui_menu_select_software::ui_menu_select_software(running_machine &machine, rende build_software_list(); load_sw_custom_filters(); - mewui_globals::curimage_view = SNAPSHOT_VIEW; - mewui_globals::switch_image = true; - mewui_globals::cur_sw_dats_view = MEWUI_FIRST_LOAD; + ui_globals::curimage_view = SNAPSHOT_VIEW; + ui_globals::switch_image = true; + ui_globals::cur_sw_dats_view = MEWUI_FIRST_LOAD; std::string error_string; machine.options().set_value(OPTION_SOFTWARENAME, "", OPTION_PRIORITY_CMDLINE, error_string); @@ -146,8 +146,8 @@ ui_menu_select_software::ui_menu_select_software(running_machine &machine, rende ui_menu_select_software::~ui_menu_select_software() { - mewui_globals::curimage_view = CABINETS_VIEW; - mewui_globals::switch_image = true; + ui_globals::curimage_view = CABINETS_VIEW; + ui_globals::switch_image = true; } //------------------------------------------------- @@ -178,17 +178,17 @@ void ui_menu_select_software::handle() else if (m_event->iptkey == IPT_UI_LEFT) { // Images - if (mewui_globals::rpanel == RP_IMAGES && mewui_globals::curimage_view > FIRST_VIEW) + if (ui_globals::rpanel == RP_IMAGES && ui_globals::curimage_view > FIRST_VIEW) { - mewui_globals::curimage_view--; - mewui_globals::switch_image = true; - mewui_globals::default_image = false; + ui_globals::curimage_view--; + ui_globals::switch_image = true; + ui_globals::default_image = false; } // Infos - else if (mewui_globals::rpanel == RP_INFOS && mewui_globals::cur_sw_dats_view > 0) + else if (ui_globals::rpanel == RP_INFOS && ui_globals::cur_sw_dats_view > 0) { - mewui_globals::cur_sw_dats_view--; + ui_globals::cur_sw_dats_view--; topline_datsview = 0; } } @@ -197,17 +197,17 @@ void ui_menu_select_software::handle() else if (m_event->iptkey == IPT_UI_RIGHT) { // Images - if (mewui_globals::rpanel == RP_IMAGES && mewui_globals::curimage_view < LAST_VIEW) + if (ui_globals::rpanel == RP_IMAGES && ui_globals::curimage_view < LAST_VIEW) { - mewui_globals::curimage_view++; - mewui_globals::switch_image = true; - mewui_globals::default_image = false; + ui_globals::curimage_view++; + ui_globals::switch_image = true; + ui_globals::default_image = false; } // Infos - else if (mewui_globals::rpanel == RP_INFOS && mewui_globals::cur_sw_dats_view < 1) + else if (ui_globals::rpanel == RP_INFOS && ui_globals::cur_sw_dats_view < 1) { - mewui_globals::cur_sw_dats_view++; + ui_globals::cur_sw_dats_view++; topline_datsview = 0; } } @@ -237,11 +237,11 @@ void ui_menu_select_software::handle() // handle UI_LEFT_PANEL else if (m_event->iptkey == IPT_UI_LEFT_PANEL) - mewui_globals::rpanel = RP_IMAGES; + ui_globals::rpanel = RP_IMAGES; // handle UI_RIGHT_PANEL else if (m_event->iptkey == IPT_UI_RIGHT_PANEL) - mewui_globals::rpanel = RP_INFOS; + ui_globals::rpanel = RP_INFOS; // escape pressed with non-empty text clears the text else if (m_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0) @@ -444,7 +444,7 @@ void ui_menu_select_software::populate() if (old_software != -1) { selected = old_software; - top_line = selected - (mewui_globals::visible_sw_lines / 2); + top_line = selected - (ui_globals::visible_sw_lines / 2); } reselect_last::reset(); @@ -1258,7 +1258,7 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo { ui_manager &mui = machine().ui(); - if (mewui_globals::panels_status == SHOW_PANELS || mewui_globals::panels_status == HIDE_RIGHT_PANEL) + if (ui_globals::panels_status == SHOW_PANELS || ui_globals::panels_status == HIDE_RIGHT_PANEL) { float origy1 = y1; float origy2 = y2; @@ -1431,7 +1431,7 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa { mui.draw_text_full(container, "History", origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - mewui_globals::cur_sw_dats_view = 0; + ui_globals::cur_sw_dats_view = 0; } else { @@ -1449,19 +1449,19 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa title_size = MAX(txt_lenght, title_size); } - mui.draw_text_full(container, t_text[mewui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1, + mui.draw_text_full(container, t_text[ui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - draw_common_arrow(origx1, origy1, origx2, origy2, mewui_globals::cur_sw_dats_view, 0, 1, title_size); + draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::cur_sw_dats_view, 0, 1, title_size); } - if (oldsoft != soft || old_sw_view != mewui_globals::cur_sw_dats_view) + if (oldsoft != soft || old_sw_view != ui_globals::cur_sw_dats_view) { buffer.clear(); - old_sw_view = mewui_globals::cur_sw_dats_view; + old_sw_view = ui_globals::cur_sw_dats_view; oldsoft = soft; - if (mewui_globals::cur_sw_dats_view == 0) + if (ui_globals::cur_sw_dats_view == 0) { if (soft->startempty == 1) machine().datfile().load_data_info(soft->driver, buffer, MEWUI_HISTORY_LOAD); @@ -1536,14 +1536,14 @@ void ui_menu_select_software::arts_render(void *selectedref, float origx1, float if (driver) { - if (mewui_globals::default_image) - ((driver->flags & MACHINE_TYPE_ARCADE) == 0) ? mewui_globals::curimage_view = CABINETS_VIEW : mewui_globals::curimage_view = SNAPSHOT_VIEW; + if (ui_globals::default_image) + ((driver->flags & MACHINE_TYPE_ARCADE) == 0) ? ui_globals::curimage_view = CABINETS_VIEW : ui_globals::curimage_view = SNAPSHOT_VIEW; std::string searchstr; searchstr = arts_render_common(origx1, origy1, origx2, origy2); // loads the image if necessary - if (driver != olddriver || !snapx_bitmap->valid() || mewui_globals::switch_image) + if (driver != olddriver || !snapx_bitmap->valid() || ui_globals::switch_image) { emu_file snapfile(searchstr.c_str(), OPEN_FLAG_READ); bitmap_argb32 *tmp_bitmap; @@ -1595,7 +1595,7 @@ void ui_menu_select_software::arts_render(void *selectedref, float origx1, float } olddriver = driver; - mewui_globals::switch_image = false; + ui_globals::switch_image = false; arts_render_images(tmp_bitmap, origx1, origy1, origx2, origy2, false); auto_free(machine(), tmp_bitmap); } @@ -1615,15 +1615,15 @@ void ui_menu_select_software::arts_render(void *selectedref, float origx1, float else if (soft) { std::string fullname, pathname; - if (mewui_globals::default_image) - (soft->startempty == 0) ? mewui_globals::curimage_view = SNAPSHOT_VIEW : mewui_globals::curimage_view = CABINETS_VIEW; + if (ui_globals::default_image) + (soft->startempty == 0) ? ui_globals::curimage_view = SNAPSHOT_VIEW : ui_globals::curimage_view = CABINETS_VIEW; // arts title and searchpath std::string searchstr; searchstr = arts_render_common(origx1, origy1, origx2, origy2); // loads the image if necessary - if (soft != oldsoft || !snapx_bitmap->valid() || mewui_globals::switch_image) + if (soft != oldsoft || !snapx_bitmap->valid() || ui_globals::switch_image) { emu_file snapfile(searchstr.c_str(), OPEN_FLAG_READ); bitmap_argb32 *tmp_bitmap; @@ -1641,7 +1641,7 @@ void ui_menu_select_software::arts_render(void *selectedref, float origx1, float render_load_jpeg(*tmp_bitmap, snapfile, nullptr, fullname.c_str()); } } - else if (mewui_globals::curimage_view == TITLES_VIEW) + else if (ui_globals::curimage_view == TITLES_VIEW) { // First attempt from name list pathname.assign(soft->listname).append("_titles"); @@ -1683,7 +1683,7 @@ void ui_menu_select_software::arts_render(void *selectedref, float origx1, float } oldsoft = soft; - mewui_globals::switch_image = false; + ui_globals::switch_image = false; arts_render_images(tmp_bitmap, origx1, origy1, origx2, origy2, true); auto_free(machine(), tmp_bitmap); } @@ -1708,7 +1708,7 @@ void ui_menu_select_software::draw_right_panel(void *selectedref, float origx1, float line_height = mui.get_line_height(); float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); rgb_t fgcolor = UI_TEXT_COLOR; - bool hide = (mewui_globals::panels_status == HIDE_RIGHT_PANEL || mewui_globals::panels_status == HIDE_BOTH); + bool hide = (ui_globals::panels_status == HIDE_RIGHT_PANEL || ui_globals::panels_status == HIDE_BOTH); float x2 = (hide) ? origx2 : origx1 + 2.0f * UI_BOX_LR_BORDER; // set left-right arrows dimension @@ -1736,7 +1736,7 @@ void ui_menu_select_software::draw_right_panel(void *selectedref, float origx1, origx1 = x2; origy1 = draw_right_box_title(origx1, origy1, origx2, origy2); - if (mewui_globals::rpanel == RP_IMAGES) + if (ui_globals::rpanel == RP_IMAGES) arts_render(selectedref, origx1, origy1, origx2, origy2); else infos_render(selectedref, origx1, origy1, origx2, origy2); diff --git a/src/emu/ui/utils.cpp b/src/emu/ui/utils.cpp index e52274e22f1..7bca1943884 100644 --- a/src/emu/ui/utils.cpp +++ b/src/emu/ui/utils.cpp @@ -13,7 +13,7 @@ #include extern const char MEWUI_VERSION_TAG[]; -const char MEWUI_VERSION_TAG[] = "# MEWUI INFO "; +const char MEWUI_VERSION_TAG[] = "# UI INFO "; // Years index UINT16 c_year::actual = 0; @@ -48,17 +48,17 @@ const char *ume_filters::text[] = { "ALL", "ARCADES", "SYSTEMS" }; size_t ume_filters::length = ARRAY_LENGTH(ume_filters::text); // Globals -UINT8 mewui_globals::rpanel = 0; -UINT8 mewui_globals::curimage_view = 0; -UINT8 mewui_globals::curdats_view = 0; -UINT8 mewui_globals::cur_sw_dats_view = 0; -bool mewui_globals::switch_image = false; -bool mewui_globals::default_image = true; -bool mewui_globals::reset = false; -bool mewui_globals::redraw_icon = false; -int mewui_globals::visible_main_lines = 0; -int mewui_globals::visible_sw_lines = 0; -UINT16 mewui_globals::panels_status = 0; +UINT8 ui_globals::rpanel = 0; +UINT8 ui_globals::curimage_view = 0; +UINT8 ui_globals::curdats_view = 0; +UINT8 ui_globals::cur_sw_dats_view = 0; +bool ui_globals::switch_image = false; +bool ui_globals::default_image = true; +bool ui_globals::reset = false; +bool ui_globals::redraw_icon = false; +int ui_globals::visible_main_lines = 0; +int ui_globals::visible_sw_lines = 0; +UINT16 ui_globals::panels_status = 0; // Custom filter UINT16 custfltr::main = 0; diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index 3e339ccadce..4f1f5076351 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -223,7 +223,7 @@ struct c_year }; // GLOBAL CLASS -struct mewui_globals +struct ui_globals { static UINT8 curimage_view, curdats_view, cur_sw_dats_view, rpanel; static bool switch_image, redraw_icon, default_image, reset; -- cgit v1.2.3-70-g09d2 From 024d67c14f250229765384fc97f8a115d068e622 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 4 Feb 2016 15:13:05 +0100 Subject: removed UME filtering (nw) --- src/emu/ui/menu.cpp | 65 ------------------------------------------------- src/emu/ui/menu.h | 3 --- src/emu/ui/moptions.cpp | 1 - src/emu/ui/moptions.h | 2 -- src/emu/ui/optsmenu.cpp | 24 +----------------- src/emu/ui/optsmenu.h | 3 +-- src/emu/ui/selgame.cpp | 34 +------------------------- src/emu/ui/utils.cpp | 5 ---- src/emu/ui/utils.h | 12 --------- 9 files changed, 3 insertions(+), 146 deletions(-) diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index 2d9a6f679c2..23e9143f392 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -1950,12 +1950,6 @@ void ui_menu::handle_main_events(UINT32 flags) selected = visible_items + 2; stop = true; } - else if (hover >= HOVER_MAME_ALL && hover <= HOVER_MAME_SYSTEMS) - { - ume_filters::actual = (HOVER_MAME_ALL - hover) * (-1); - menu_event.iptkey = IPT_OTHER; - stop = true; - } else if (hover >= HOVER_RP_FIRST && hover <= HOVER_RP_LAST) { ui_globals::rpanel = (HOVER_RP_FIRST - hover) * (-1); @@ -2029,65 +2023,6 @@ void ui_menu::handle_main_events(UINT32 flags) } } -//------------------------------------------------- -// draw UME box -//------------------------------------------------- - -void ui_menu::draw_ume_box(float x1, float y1, float x2, float y2) -{ - float text_size = 0.65f; - ui_manager &mui = machine().ui(); - float line_height = mui.get_line_height() * text_size; - float maxwidth = 0.0f; - - for (int x = 0; x < ume_filters::length; x++) - { - float width; - // compute width of left hand side - mui.draw_text_full(container, ume_filters::text[x], 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, UI_TEXT_COLOR, ARGB_BLACK, &width, nullptr, text_size); - width += 2 * UI_BOX_LR_BORDER; - maxwidth = MAX(maxwidth, width); - } - - x2 = x1 + maxwidth; - - mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); - - // take off the borders - x1 += UI_BOX_LR_BORDER; - x2 -= UI_BOX_LR_BORDER; - y1 += UI_BOX_TB_BORDER; - y2 -= UI_BOX_TB_BORDER; - - for (int filter = 0; filter < ume_filters::length; filter++) - { - rgb_t bgcolor = UI_TEXT_BG_COLOR; - rgb_t fgcolor = UI_TEXT_COLOR; - - if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y1 + line_height > mouse_y) - { - bgcolor = UI_MOUSEOVER_BG_COLOR; - fgcolor = UI_MOUSEOVER_COLOR; - hover = HOVER_MAME_ALL + filter; - } - - if (ume_filters::actual == filter) - { - bgcolor = UI_SELECTED_BG_COLOR; - fgcolor = UI_SELECTED_COLOR; - } - - if (bgcolor != UI_TEXT_BG_COLOR) - container->add_rect(x1, y1, x2, y1 + line_height, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); - - mui.draw_text_full(container, ume_filters::text[filter], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size); - - y1 += line_height; - } -} - //------------------------------------------------- // draw right box title //------------------------------------------------- diff --git a/src/emu/ui/menu.h b/src/emu/ui/menu.h index 606e66c5908..43c88330d66 100644 --- a/src/emu/ui/menu.h +++ b/src/emu/ui/menu.h @@ -204,9 +204,6 @@ public: INT32 mouse_target_x, mouse_target_y; float mouse_x, mouse_y; - // draw UME box - void draw_ume_box(float x1, float y1, float x2, float y2); - // draw toolbar void draw_toolbar(float x1, float y1, float x2, float y2, bool software = false); diff --git a/src/emu/ui/moptions.cpp b/src/emu/ui/moptions.cpp index 7d68bd7d483..419769ac977 100644 --- a/src/emu/ui/moptions.cpp +++ b/src/emu/ui/moptions.cpp @@ -49,7 +49,6 @@ const options_entry ui_options::s_option_entries[] = { OPTION_USE_BACKGROUND, "1", OPTION_BOOLEAN, "enable background image in main view" }, { OPTION_SKIP_BIOS_MENU, "0", OPTION_BOOLEAN, "skip bios submenu, start with configured or default" }, { OPTION_SKIP_PARTS_MENU, "0", OPTION_BOOLEAN, "skip parts submenu, start with first part" }, - { OPTION_START_FILTER, "0", OPTION_INTEGER, "startup filter (0 = ALL, 1 = ARCADES, 2 = SYSTEMS)" }, { OPTION_LAST_USED_FILTER, "", OPTION_STRING, "latest used filter" }, { OPTION_LAST_USED_MACHINE, "", OPTION_STRING, "latest used machine" }, { OPTION_INFO_AUTO_AUDIT, "0", OPTION_BOOLEAN, "enable auto audit in the general info panel" }, diff --git a/src/emu/ui/moptions.h b/src/emu/ui/moptions.h index 5baf153ff3d..59e04506fcc 100644 --- a/src/emu/ui/moptions.h +++ b/src/emu/ui/moptions.h @@ -44,7 +44,6 @@ #define OPTION_USE_BACKGROUND "use_background" #define OPTION_SKIP_BIOS_MENU "skip_biosmenu" #define OPTION_SKIP_PARTS_MENU "skip_partsmenu" -#define OPTION_START_FILTER "start_filter" #define OPTION_LAST_USED_FILTER "last_used_filter" #define OPTION_LAST_USED_MACHINE "last_used_machine" #define OPTION_INFO_AUTO_AUDIT "info_audit_enabled" @@ -106,7 +105,6 @@ public: bool use_background_image() const { return bool_value(OPTION_USE_BACKGROUND); } bool skip_bios_menu() const { return bool_value(OPTION_SKIP_BIOS_MENU); } bool skip_parts_menu() const { return bool_value(OPTION_SKIP_PARTS_MENU); } - int start_filter() const { return int_value(OPTION_START_FILTER); } const char *last_used_machine() const { return value(OPTION_LAST_USED_MACHINE); } const char *last_used_filter() const { return value(OPTION_LAST_USED_FILTER); } bool info_audit() const { return bool_value(OPTION_INFO_AUTO_AUDIT); } diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp index dc86e3e7178..116519b25e7 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/emu/ui/optsmenu.cpp @@ -205,24 +205,6 @@ void ui_menu_game_options::handle() if (m_event->iptkey == IPT_UI_SELECT) ui_menu::stack_push(global_alloc_clear(machine(), container)); break; - - case UME_SYSTEM: - if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) - { - (m_event->iptkey == IPT_UI_RIGHT) ? ume_filters::actual++ : ume_filters::actual--; - changed = true; - } - else if (m_event->iptkey == IPT_UI_SELECT) - { - int total = ume_filters::length; - std::vector s_sel(total); - for (int index = 0; index < total; ++index) - s_sel[index] = ume_filters::text[index]; - - ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, ume_filters::actual)); - } - - break; } if (changed) @@ -239,11 +221,7 @@ void ui_menu_game_options::populate() std::string fbuff; // add filter item - UINT32 arrow_flags = get_arrow_flags(0, ume_filters::length - 1, ume_filters::actual); - item_append("Machine", ume_filters::text[ume_filters::actual], arrow_flags, (void *)(FPTR)UME_SYSTEM); - - // add filter item - arrow_flags = get_arrow_flags((int)FILTER_FIRST, (int)FILTER_LAST, main_filters::actual); + UINT32 arrow_flags = get_arrow_flags((int)FILTER_FIRST, (int)FILTER_LAST, main_filters::actual); item_append("Filter", main_filters::text[main_filters::actual], arrow_flags, (void *)(FPTR)FILTER_MENU); // add category subitem diff --git a/src/emu/ui/optsmenu.h b/src/emu/ui/optsmenu.h index c1d46a9c80e..71196284c3d 100644 --- a/src/emu/ui/optsmenu.h +++ b/src/emu/ui/optsmenu.h @@ -38,8 +38,7 @@ private: CONTROLLER_MENU, SAVE_OPTIONS, CGI_MENU, - CUSTOM_FILTER, - UME_SYSTEM + CUSTOM_FILTER }; }; diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index a1cd39508ac..e931c6a8d73 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -173,7 +173,6 @@ ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_contai ui_globals::curdats_view = MEWUI_FIRST_LOAD; ui_globals::switch_image = false; ui_globals::default_image = true; - ume_filters::actual = moptions.start_filter(); ui_globals::panels_status = moptions.hide_panels(); } @@ -206,7 +205,6 @@ ui_menu_select_game::~ui_menu_select_game() else if (main_filters::actual == FILTER_SCREEN) filter.append(",").append(screen_filters::text[screen_filters::actual]); - mopt.set_value(OPTION_START_FILTER, ume_filters::actual, OPTION_PRIORITY_CMDLINE, error_string); mopt.set_value(OPTION_LAST_USED_FILTER, filter.c_str(), OPTION_PRIORITY_CMDLINE, error_string); mopt.set_value(OPTION_LAST_USED_MACHINE, last_driver.c_str(), OPTION_PRIORITY_CMDLINE, error_string); mopt.set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); @@ -755,13 +753,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott ui_manager &mui = machine().ui(); float tbarspace = mui.get_line_height(); - if (ume_filters::actual == MEWUI_MAME) - strprintf(tempbuf[0], "MAME %s ( %d / %d machines (%d BIOS) )", bare_build_version, visible_items, (driver_list::total() - 1), m_isabios + m_issbios); - else if (ume_filters::actual == MEWUI_ARCADES) - strprintf(tempbuf[0], "MAME %s ( %d / %d arcades (%d BIOS) )", bare_build_version, visible_items, m_isarcades, m_isabios); - else if (ume_filters::actual == MEWUI_SYSTEMS) - strprintf(tempbuf[0], "MAME %s ( %d / %d systems (%d BIOS) )", bare_build_version, visible_items, m_issystems, m_issbios); - + strprintf(tempbuf[0], "MAME %s ( %d / %d machines (%d BIOS) )", bare_build_version, visible_items, (driver_list::total() - 1), m_isabios + m_issbios); std::string filtered; if (main_filters::actual == FILTER_CATEGORY && !machine().inifile().ini_index.empty()) @@ -817,11 +809,6 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott y1 += mui.get_line_height(); } - // draw ume box - x1 -= UI_BOX_LR_BORDER; - y1 = origy1 - top; - draw_ume_box(x1, y1, x2, y2); - // determine the text to render below if (main_filters::actual != FILTER_FAVORITE_GAME) driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr; @@ -1235,12 +1222,6 @@ void ui_menu_select_game::build_list(std::vector &s_drivers if (!bioscheck && filter != FILTER_BIOS && (s_driver->flags & MACHINE_IS_BIOS_ROOT) != 0) continue; - if ((s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_SYSTEMS) - continue; - - if (!(s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_ARCADES) - continue; - switch (filter) { case FILTER_ALL: @@ -1344,12 +1325,6 @@ void ui_menu_select_game::build_custom() for (auto & elem : s_drivers) { - if ((elem->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_SYSTEMS) - continue; - - if (!(elem->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_ARCADES) - continue; - m_displaylist.push_back(elem); } @@ -1423,13 +1398,6 @@ void ui_menu_select_game::build_from_cache(std::vector &s_d { if (!bioscheck && filter != FILTER_BIOS && (s_driver->flags & MACHINE_IS_BIOS_ROOT) != 0) continue; - - if ((s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_SYSTEMS) - continue; - - if (!(s_driver->flags & MACHINE_TYPE_ARCADE) && ume_filters::actual == MEWUI_ARCADES) - continue; - int idx = driver_list::find(s_driver->name); switch (filter) diff --git a/src/emu/ui/utils.cpp b/src/emu/ui/utils.cpp index 7bca1943884..e3e71b096b0 100644 --- a/src/emu/ui/utils.cpp +++ b/src/emu/ui/utils.cpp @@ -42,11 +42,6 @@ UINT16 screen_filters::actual = 0; const char *screen_filters::text[] = { "", "Raster", "Vector", "LCD" }; size_t screen_filters::length = ARRAY_LENGTH(screen_filters::text); -// UME -UINT16 ume_filters::actual = 0; -const char *ume_filters::text[] = { "ALL", "ARCADES", "SYSTEMS" }; -size_t ume_filters::length = ARRAY_LENGTH(ume_filters::text); - // Globals UINT8 ui_globals::rpanel = 0; UINT8 ui_globals::curimage_view = 0; diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index 4f1f5076351..db1be4fc25c 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -126,15 +126,6 @@ enum MEWUI_SW_LAST = MEWUI_SW_CUSTOM }; -enum -{ - MEWUI_MAME_FIRST = 0, - MEWUI_MAME = MEWUI_MAME_FIRST, - MEWUI_ARCADES, - MEWUI_SYSTEMS, - MEWUI_MAME_LAST = MEWUI_SYSTEMS -}; - enum { HOVER_DAT_UP = -1000, @@ -152,9 +143,6 @@ enum HOVER_B_SETTINGS, HOVER_RPANEL_ARROW, HOVER_LPANEL_ARROW, - HOVER_MAME_ALL, - HOVER_MAME_ARCADES, - HOVER_MAME_SYSTEMS, HOVER_FILTER_FIRST, HOVER_FILTER_LAST = (HOVER_FILTER_FIRST) + 1 + FILTER_LAST, HOVER_SW_FILTER_FIRST, -- cgit v1.2.3-70-g09d2 From a95c4619c6b89d83528d1afbb1d50eb633ab48d8 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 4 Feb 2016 15:36:33 +0100 Subject: clear the rest of mewui mentioning (nw) --- src/emu/ioport.h | 2 - src/emu/ui/auditmenu.cpp | 6 +-- src/emu/ui/cmdrender.h | 2 +- src/emu/ui/custmenu.cpp | 38 +++++++------- src/emu/ui/custui.cpp | 4 +- src/emu/ui/datfile.cpp | 14 ++--- src/emu/ui/datfile.h | 2 +- src/emu/ui/datmenu.cpp | 36 ++++++------- src/emu/ui/dirmenu.cpp | 6 +-- src/emu/ui/dirmenu.h | 2 +- src/emu/ui/dsplmenu.cpp | 2 +- src/emu/ui/dsplmenu.h | 2 +- src/emu/ui/icorender.h | 2 - src/emu/ui/inifile.cpp | 10 ++-- src/emu/ui/inifile.h | 4 +- src/emu/ui/mainmenu.cpp | 10 ++-- src/emu/ui/menu.cpp | 56 ++++++++++---------- src/emu/ui/menu.h | 15 +++--- src/emu/ui/moptions.cpp | 12 ++--- src/emu/ui/moptions.h | 6 +-- src/emu/ui/optsmenu.cpp | 2 +- src/emu/ui/optsmenu.h | 2 +- src/emu/ui/selgame.cpp | 108 +++++++++++++++++++------------------- src/emu/ui/selgame.h | 2 +- src/emu/ui/selsoft.cpp | 134 +++++++++++++++++++++++------------------------ src/emu/ui/selsoft.h | 14 ++--- src/emu/ui/toolbar.h | 2 +- src/emu/ui/ui.cpp | 7 +-- src/emu/ui/ui.h | 2 +- src/emu/ui/utils.cpp | 4 +- src/emu/ui/utils.h | 52 +++++++++--------- 31 files changed, 277 insertions(+), 283 deletions(-) diff --git a/src/emu/ioport.h b/src/emu/ioport.h index c2c861d3320..9ba2818c5d0 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -370,8 +370,6 @@ enum ioport_type IPT_UI_LOAD_STATE, IPT_UI_TAPE_START, IPT_UI_TAPE_STOP, - - // additional MEWUI options IPT_UI_HISTORY, IPT_UI_MAMEINFO, IPT_UI_COMMAND, diff --git a/src/emu/ui/auditmenu.cpp b/src/emu/ui/auditmenu.cpp index 9ebbdf00f40..2cf482d4f8b 100644 --- a/src/emu/ui/auditmenu.cpp +++ b/src/emu/ui/auditmenu.cpp @@ -15,7 +15,7 @@ #include "ui/auditmenu.h" #include -extern const char MEWUI_VERSION_TAG[]; +extern const char UI_VERSION_TAG[]; //------------------------------------------------- // sort @@ -173,11 +173,11 @@ void ui_menu_audit::populate() void ui_menu_audit::save_available_machines() { // attempt to open the output file - emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(emulator_info::get_configname(), "_avail.ini") == FILERR_NONE) { // generate header - std::string buffer = std::string("#\n").append(MEWUI_VERSION_TAG).append(bare_build_version).append("\n#\n\n"); + std::string buffer = std::string("#\n").append(UI_VERSION_TAG).append(bare_build_version).append("\n#\n\n"); strcatprintf(buffer, "%d\n", (int)m_availablesorted.size()); strcatprintf(buffer, "%d\n", (int)m_unavailablesorted.size()); diff --git a/src/emu/ui/cmdrender.h b/src/emu/ui/cmdrender.h index a1f594a5d8f..d9bf466f1e9 100644 --- a/src/emu/ui/cmdrender.h +++ b/src/emu/ui/cmdrender.h @@ -4,7 +4,7 @@ ui/cmdrender.h - MEWUI rendfont. + UI rendfont. ***************************************************************************/ diff --git a/src/emu/ui/custmenu.cpp b/src/emu/ui/custmenu.cpp index 3fed1cd1c40..1162ced015b 100644 --- a/src/emu/ui/custmenu.cpp +++ b/src/emu/ui/custmenu.cpp @@ -272,7 +272,7 @@ void ui_menu_custom_filter::custom_render(void *selectedref, float top, float bo void ui_menu_custom_filter::save_custom_filters() { // attempt to open the output file - emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == FILERR_NONE) { // generate custom filters info @@ -338,7 +338,7 @@ void ui_menu_swcustom_filter::handle() if (m_event->iptkey == IPT_UI_SELECT) { sw_custfltr::numother++; - sw_custfltr::other[sw_custfltr::numother] = MEWUI_SW_UNAVAILABLE + 1; + sw_custfltr::other[sw_custfltr::numother] = UI_SW_UNAVAILABLE + 1; m_added = true; } break; @@ -346,7 +346,7 @@ void ui_menu_swcustom_filter::handle() case REMOVE_FILTER: if (m_event->iptkey == IPT_UI_SELECT) { - sw_custfltr::other[sw_custfltr::numother] = MEWUI_SW_UNAVAILABLE + 1; + sw_custfltr::other[sw_custfltr::numother] = UI_SW_UNAVAILABLE + 1; sw_custfltr::numother--; changed = true; } @@ -356,12 +356,12 @@ void ui_menu_swcustom_filter::handle() if ((FPTR)m_event->itemref >= OTHER_FILTER && (FPTR)m_event->itemref < OTHER_FILTER + MAX_CUST_FILTER) { int pos = (int)((FPTR)m_event->itemref - OTHER_FILTER); - if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::other[pos] > MEWUI_SW_UNAVAILABLE + 1) + if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::other[pos] > UI_SW_UNAVAILABLE + 1) { sw_custfltr::other[pos]--; changed = true; } - else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::other[pos] < MEWUI_SW_LAST - 1) + else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::other[pos] < UI_SW_LAST - 1) { sw_custfltr::other[pos]++; changed = true; @@ -371,7 +371,7 @@ void ui_menu_swcustom_filter::handle() size_t total = sw_filters::length; std::vector s_sel(total); for (size_t index = 0; index < total; ++index) - if (index <= MEWUI_SW_UNAVAILABLE|| index == MEWUI_SW_CUSTOM) + if (index <= UI_SW_UNAVAILABLE|| index == UI_SW_CUSTOM) s_sel[index] = "_skip_"; else s_sel[index] = sw_filters::text[index]; @@ -473,7 +473,7 @@ void ui_menu_swcustom_filter::handle() void ui_menu_swcustom_filter::populate() { // add main filter - UINT32 arrow_flags = get_arrow_flags((int)MEWUI_SW_ALL, (int)MEWUI_SW_UNAVAILABLE, sw_custfltr::main); + UINT32 arrow_flags = get_arrow_flags((int)UI_SW_ALL, (int)UI_SW_UNAVAILABLE, sw_custfltr::main); item_append("Main filter", sw_filters::text[sw_custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER); // add other filters @@ -482,14 +482,14 @@ void ui_menu_swcustom_filter::populate() item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); // add filter items - arrow_flags = get_arrow_flags((int)MEWUI_SW_UNAVAILABLE + 1, (int)MEWUI_SW_LAST - 1, sw_custfltr::other[x]); + arrow_flags = get_arrow_flags((int)UI_SW_UNAVAILABLE + 1, (int)UI_SW_LAST - 1, sw_custfltr::other[x]); item_append("Other filter", sw_filters::text[sw_custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x)); if (m_added) selected = item.size() - 2; // add publisher subitem - if (sw_custfltr::other[x] == MEWUI_SW_PUBLISHERS && m_filter.publisher.ui.size() > 0) + if (sw_custfltr::other[x] == UI_SW_PUBLISHERS && m_filter.publisher.ui.size() > 0) { arrow_flags = get_arrow_flags(0, m_filter.publisher.ui.size() - 1, sw_custfltr::mnfct[x]); std::string fbuff("^!Publisher"); @@ -498,7 +498,7 @@ void ui_menu_swcustom_filter::populate() } // add year subitem - else if (sw_custfltr::other[x] == MEWUI_SW_YEARS && m_filter.year.ui.size() > 0) + else if (sw_custfltr::other[x] == UI_SW_YEARS && m_filter.year.ui.size() > 0) { arrow_flags = get_arrow_flags(0, m_filter.year.ui.size() - 1, sw_custfltr::year[x]); std::string fbuff("^!Year"); @@ -507,7 +507,7 @@ void ui_menu_swcustom_filter::populate() } // add year subitem - else if (sw_custfltr::other[x] == MEWUI_SW_LIST && m_filter.swlist.name.size() > 0) + else if (sw_custfltr::other[x] == UI_SW_LIST && m_filter.swlist.name.size() > 0) { arrow_flags = get_arrow_flags(0, m_filter.swlist.name.size() - 1, sw_custfltr::list[x]); std::string fbuff("^!Software List"); @@ -516,7 +516,7 @@ void ui_menu_swcustom_filter::populate() } // add device type subitem - else if (sw_custfltr::other[x] == MEWUI_SW_TYPE && m_filter.type.ui.size() > 0) + else if (sw_custfltr::other[x] == UI_SW_TYPE && m_filter.type.ui.size() > 0) { arrow_flags = get_arrow_flags(0, m_filter.type.ui.size() - 1, sw_custfltr::type[x]); std::string fbuff("^!Device type"); @@ -525,7 +525,7 @@ void ui_menu_swcustom_filter::populate() } // add region subitem - else if (sw_custfltr::other[x] == MEWUI_SW_REGION && m_filter.region.ui.size() > 0) + else if (sw_custfltr::other[x] == UI_SW_REGION && m_filter.region.ui.size() > 0) { arrow_flags = get_arrow_flags(0, m_filter.region.ui.size() - 1, sw_custfltr::region[x]); std::string fbuff("^!Region"); @@ -587,7 +587,7 @@ void ui_menu_swcustom_filter::custom_render(void *selectedref, float top, float void ui_menu_swcustom_filter::save_sw_custom_filters() { // attempt to open the output file - emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open("custom_", m_driver->name, "_filter.ini") == FILERR_NONE) { // generate custom filters info @@ -598,15 +598,15 @@ void ui_menu_swcustom_filter::save_sw_custom_filters() for (int x = 1; x <= sw_custfltr::numother; x++) { cinfo.append("Other filter = ").append(sw_filters::text[sw_custfltr::other[x]]).append("\n"); - if (sw_custfltr::other[x] == MEWUI_SW_PUBLISHERS) + if (sw_custfltr::other[x] == UI_SW_PUBLISHERS) cinfo.append(" Manufacturer filter = ").append(m_filter.publisher.ui[sw_custfltr::mnfct[x]]).append("\n"); - else if (sw_custfltr::other[x] == MEWUI_SW_LIST) + else if (sw_custfltr::other[x] == UI_SW_LIST) cinfo.append(" Software List filter = ").append(m_filter.swlist.name[sw_custfltr::list[x]]).append("\n"); - else if (sw_custfltr::other[x] == MEWUI_SW_YEARS) + else if (sw_custfltr::other[x] == UI_SW_YEARS) cinfo.append(" Year filter = ").append(m_filter.year.ui[sw_custfltr::year[x]]).append("\n"); - else if (sw_custfltr::other[x] == MEWUI_SW_TYPE) + else if (sw_custfltr::other[x] == UI_SW_TYPE) cinfo.append(" Type filter = ").append(m_filter.type.ui[sw_custfltr::type[x]]).append("\n"); - else if (sw_custfltr::other[x] == MEWUI_SW_REGION) + else if (sw_custfltr::other[x] == UI_SW_REGION) cinfo.append(" Region filter = ").append(m_filter.region.ui[sw_custfltr::region[x]]).append("\n"); } file.puts(cinfo.c_str()); diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index c256b41221f..47d983d5ef4 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -1016,7 +1016,7 @@ ui_menu_palette_sel::~ui_menu_palette_sel() void ui_menu_palette_sel::handle() { // process the menu - const ui_menu_event *m_event = process(MENU_FLAG_MEWUI_PALETTE); + const ui_menu_event *m_event = process(MENU_FLAG_UI_PALETTE); if (m_event != nullptr && m_event->itemref != nullptr) { if (m_event->iptkey == IPT_UI_SELECT) @@ -1035,7 +1035,7 @@ void ui_menu_palette_sel::handle() void ui_menu_palette_sel::populate() { for (int x = 0; x < ARRAY_LENGTH(m_palette); ++x) - item_append(m_palette[x].name, m_palette[x].argb, MENU_FLAG_MEWUI_PALETTE, (void *)(FPTR)(x + 1)); + item_append(m_palette[x].name, m_palette[x].argb, MENU_FLAG_UI_PALETTE, (void *)(FPTR)(x + 1)); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); } diff --git a/src/emu/ui/datfile.cpp b/src/emu/ui/datfile.cpp index 5afe83687ac..b71b326f5e0 100644 --- a/src/emu/ui/datfile.cpp +++ b/src/emu/ui/datfile.cpp @@ -4,7 +4,7 @@ ui/datfile.cpp - MEWUI DATs manager. + UI DATs manager. ***************************************************************************/ @@ -215,29 +215,29 @@ void datfile_manager::load_data_info(const game_driver *drv, std::string &buffer switch (type) { - case MEWUI_HISTORY_LOAD: + case UI_HISTORY_LOAD: filename = "history.dat"; tag = TAG_BIO; index_idx = m_histidx; break; - case MEWUI_MAMEINFO_LOAD: + case UI_MAMEINFO_LOAD: filename = "mameinfo.dat"; tag = TAG_MAME; index_idx = m_mameidx; driver_idx = m_drvidx; break; - case MEWUI_SYSINFO_LOAD: + case UI_SYSINFO_LOAD: filename = "sysinfo.dat"; tag = TAG_BIO; index_idx = m_sysidx; break; - case MEWUI_MESSINFO_LOAD: + case UI_MESSINFO_LOAD: filename = "messinfo.dat"; tag = TAG_MAME; index_idx = m_messidx; driver_idx = m_messdrvidx; break; - case MEWUI_STORY_LOAD: + case UI_STORY_LOAD: filename = "story.dat"; tag = TAG_STORY; index_idx = m_storyidx; @@ -253,7 +253,7 @@ void datfile_manager::load_data_info(const game_driver *drv, std::string &buffer load_driver_text(drv, buffer, driver_idx, TAG_DRIVER); // cleanup mameinfo and sysinfo double line spacing - if (tag == TAG_MAME || type == MEWUI_SYSINFO_LOAD) + if (tag == TAG_MAME || type == UI_SYSINFO_LOAD) strreplace(buffer, "\n\n", "\n"); parseclose(); diff --git a/src/emu/ui/datfile.h b/src/emu/ui/datfile.h index 3b7a8423ec2..959419eb0f7 100644 --- a/src/emu/ui/datfile.h +++ b/src/emu/ui/datfile.h @@ -4,7 +4,7 @@ ui/datfile.h - MEWUI DATs manager. + UI DATs manager. ***************************************************************************/ diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp index 8e66e2ccd5e..5beb0ff52b5 100644 --- a/src/emu/ui/datmenu.cpp +++ b/src/emu/ui/datmenu.cpp @@ -161,10 +161,10 @@ void ui_menu_command_content::populate() std::string first_part(tempbuf.substr(0, first_dspace)); std::string last_part(tempbuf.substr(first_dspace)); strtrimspace(last_part); - item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_MEWUI_HISTORY, nullptr); + item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_UI_HISTORY, nullptr); } else - item_append(tempbuf.c_str(), nullptr, MENU_FLAG_MEWUI_HISTORY, nullptr); + item_append(tempbuf.c_str(), nullptr, MENU_FLAG_UI_HISTORY, nullptr); } item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); } @@ -302,7 +302,7 @@ void ui_menu_history_sw::populate() for (int r = 0; r < total_lines; r++) { std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); - item_append(tempbuf.c_str(), nullptr, MENU_FLAG_MEWUI_HISTORY, nullptr); + item_append(tempbuf.c_str(), nullptr, MENU_FLAG_UI_HISTORY, nullptr); } } else @@ -410,28 +410,28 @@ void ui_menu_dats::populate() machine().pause(); switch (m_flags) { - case MEWUI_HISTORY_LOAD: + case UI_HISTORY_LOAD: if (!get_data(m_driver, m_flags)) item_append("No available History for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); break; - case MEWUI_MAMEINFO_LOAD: + case UI_MAMEINFO_LOAD: if (!get_data(m_driver, m_flags)) item_append("No available MameInfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); break; - case MEWUI_MESSINFO_LOAD: + case UI_MESSINFO_LOAD: if (!get_data(m_driver, m_flags)) item_append("No available MessInfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); break; - case MEWUI_STORY_LOAD: - if (!get_data(m_driver, MEWUI_STORY_LOAD)) + case UI_STORY_LOAD: + if (!get_data(m_driver, UI_STORY_LOAD)) item_append("No available Mamescore for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); break; - case MEWUI_SYSINFO_LOAD: - if (!get_data(m_driver, MEWUI_SYSINFO_LOAD)) + case UI_SYSINFO_LOAD: + if (!get_data(m_driver, UI_SYSINFO_LOAD)) item_append("No available Sysinfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); break; } @@ -454,27 +454,27 @@ void ui_menu_dats::custom_render(void *selectedref, float top, float bottom, flo switch (m_flags) { - case MEWUI_HISTORY_LOAD: + case UI_HISTORY_LOAD: tempbuf.assign("History - Game / System: ").append(m_driver->description); revision.assign("History.dat Revision: ").append(datfile.rev_history()); break; - case MEWUI_MESSINFO_LOAD: + case UI_MESSINFO_LOAD: tempbuf.assign("MessInfo - System: ").append(m_driver->description); revision.assign("Messinfo.dat Revision: ").append(datfile.rev_messinfo()); break; - case MEWUI_MAMEINFO_LOAD: + case UI_MAMEINFO_LOAD: tempbuf.assign("MameInfo - Game: ").append(m_driver->description); revision.assign("Mameinfo.dat Revision: ").append(datfile.rev_mameinfo()); break; - case MEWUI_SYSINFO_LOAD: + case UI_SYSINFO_LOAD: tempbuf.assign("Sysinfo - System: ").append(m_driver->description); revision.assign("Sysinfo.dat Revision: ").append(datfile.rev_sysinfo()); break; - case MEWUI_STORY_LOAD: + case UI_STORY_LOAD: tempbuf.assign("MAMESCORE - Game: ").append(m_driver->description); revision.assign("Story.dat Revision: ").append(machine().datfile().rev_storyinfo()); break; @@ -552,7 +552,7 @@ bool ui_menu_dats::get_data(const game_driver *driver, int flags) { std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); // special case for mamescore - if (flags == MEWUI_STORY_LOAD) + if (flags == UI_STORY_LOAD) { size_t last_underscore = tempbuf.find_last_of('_'); if (last_underscore != std::string::npos) @@ -560,11 +560,11 @@ bool ui_menu_dats::get_data(const game_driver *driver, int flags) std::string last_part(tempbuf.substr(last_underscore + 1)); int primary = tempbuf.find("___"); std::string first_part(tempbuf.substr(0, primary)); - item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_MEWUI_HISTORY, nullptr); + item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_UI_HISTORY, nullptr); } } else - item_append(tempbuf.c_str(), nullptr, MENU_FLAG_MEWUI_HISTORY, nullptr); + item_append(tempbuf.c_str(), nullptr, MENU_FLAG_UI_HISTORY, nullptr); } return true; } diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp index 4b23bce9c59..e606732e2db 100644 --- a/src/emu/ui/dirmenu.cpp +++ b/src/emu/ui/dirmenu.cpp @@ -25,7 +25,7 @@ struct folders_entry static const folders_entry s_folders_entry[] = { { "ROMs", OPTION_MEDIAPATH }, - { "MEWUI", OPTION_MEWUI_PATH }, + { "UI", OPTION_UI_PATH }, { "Samples", OPTION_SAMPLEPATH }, { "DATs", OPTION_HISTORY_PATH }, { "INIs", OPTION_INIPATH }, @@ -342,7 +342,7 @@ void ui_menu_directory::handle() if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) { int ref = (FPTR)m_event->itemref; - bool change = (ref == HISTORY_FOLDERS || ref == EXTRAINI_FOLDERS || ref == MEWUI_FOLDERS); + bool change = (ref == HISTORY_FOLDERS || ref == EXTRAINI_FOLDERS || ref == UI_FOLDERS); ui_menu::stack_push(global_alloc_clear(machine(), container, ref, change)); } } @@ -354,7 +354,7 @@ void ui_menu_directory::handle() void ui_menu_directory::populate() { item_append("Roms", nullptr, 0, (void *)(FPTR)ROM_FOLDERS); - item_append("MEWUI", nullptr, 0, (void *)(FPTR)MEWUI_FOLDERS); + item_append("UI", nullptr, 0, (void *)(FPTR)UI_FOLDERS); item_append("Samples", nullptr, 0, (void *)(FPTR)SAMPLE_FOLDERS); item_append("INIs", nullptr, 0, (void *)(FPTR)INI_FOLDERS); item_append("Artwork", nullptr, 0, (void *)(FPTR)ARTWORK_FOLDERS); diff --git a/src/emu/ui/dirmenu.h b/src/emu/ui/dirmenu.h index b513f181540..47734fc6542 100644 --- a/src/emu/ui/dirmenu.h +++ b/src/emu/ui/dirmenu.h @@ -30,7 +30,7 @@ private: enum { ROM_FOLDERS = 1, - MEWUI_FOLDERS, + UI_FOLDERS, SAMPLE_FOLDERS, HISTORY_FOLDERS, INI_FOLDERS, diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp index f98068a729d..88edd6466e7 100644 --- a/src/emu/ui/dsplmenu.cpp +++ b/src/emu/ui/dsplmenu.cpp @@ -4,7 +4,7 @@ ui/dsplmenu.cpp - MEWUI video options menu. + UI video options menu. *********************************************************************/ diff --git a/src/emu/ui/dsplmenu.h b/src/emu/ui/dsplmenu.h index 862ccc11fcd..364ce12844e 100644 --- a/src/emu/ui/dsplmenu.h +++ b/src/emu/ui/dsplmenu.h @@ -4,7 +4,7 @@ ui/dsplmenu.h - MEWUI video options menu. + UI video options menu. ***************************************************************************/ diff --git a/src/emu/ui/icorender.h b/src/emu/ui/icorender.h index 1e5ca286c3a..eec52b7e3ed 100644 --- a/src/emu/ui/icorender.h +++ b/src/emu/ui/icorender.h @@ -9,8 +9,6 @@ Original code by Victor Laskin (victor.laskin@gmail.com) http://vitiy.info/Code/ico.cpp - Revised for MEWUI by dankan1890. - ***************************************************************************/ #pragma once diff --git a/src/emu/ui/inifile.cpp b/src/emu/ui/inifile.cpp index 524b1a7b3ad..05c5a887933 100644 --- a/src/emu/ui/inifile.cpp +++ b/src/emu/ui/inifile.cpp @@ -4,7 +4,7 @@ ui/inifile.cpp - MEWUI INIs file manager. + UI INIs file manager. ***************************************************************************/ @@ -47,8 +47,8 @@ void inifile_manager::directory_scan() int length = strlen(dir->name); std::string filename(dir->name); - // skip mewui_favorite file - if (!core_stricmp("mewui_favorite.ini", filename.c_str())) + // skip ui_favorite file + if (!core_stricmp("ui_favorite.ini", filename.c_str())) continue; // check .ini file ending @@ -357,7 +357,7 @@ bool favorite_manager::isgame_favorite(ui_software_info &swinfo) void favorite_manager::parse_favorite() { - emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); + emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); if (file.open(favorite_filename) == FILERR_NONE) { char readbuf[1024]; @@ -416,7 +416,7 @@ void favorite_manager::parse_favorite() void favorite_manager::save_favorite_games() { // attempt to open the output file - emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(favorite_filename) == FILERR_NONE) { if (m_list.empty()) diff --git a/src/emu/ui/inifile.h b/src/emu/ui/inifile.h index 49bf123a3ad..5a90b0d3d83 100644 --- a/src/emu/ui/inifile.h +++ b/src/emu/ui/inifile.h @@ -4,7 +4,7 @@ ui/inifile.h - MEWUI INIs file manager. + UI INIs file manager. ***************************************************************************/ @@ -112,7 +112,7 @@ private: // current int m_current; - // parse file mewui_favorite + // parse file ui_favorite void parse_favorite(); // internal state diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp index 7287c68919c..4021d419a7b 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/emu/ui/mainmenu.cpp @@ -296,18 +296,18 @@ void ui_menu_main::handle() break; case HISTORY: - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_HISTORY_LOAD)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_HISTORY_LOAD)); break; case MAMEINFO: if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0) - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MAMEINFO_LOAD)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MAMEINFO_LOAD)); else - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MESSINFO_LOAD)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MESSINFO_LOAD)); break; case SYSINFO: - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_SYSINFO_LOAD)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_SYSINFO_LOAD)); break; case COMMAND: @@ -315,7 +315,7 @@ void ui_menu_main::handle() break; case STORYINFO: - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_STORY_LOAD)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_STORY_LOAD)); break; case ADD_FAVORITE: diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index 23e9143f392..d86f69fc4e2 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -76,8 +76,8 @@ render_texture *ui_menu::snapx_texture; render_texture *ui_menu::hilight_main_texture; render_texture *ui_menu::bgrnd_texture; render_texture *ui_menu::star_texture; -render_texture *ui_menu::toolbar_texture[MEWUI_TOOLBAR_BUTTONS]; -render_texture *ui_menu::sw_toolbar_texture[MEWUI_TOOLBAR_BUTTONS]; +render_texture *ui_menu::toolbar_texture[UI_TOOLBAR_BUTTONS]; +render_texture *ui_menu::sw_toolbar_texture[UI_TOOLBAR_BUTTONS]; render_texture *ui_menu::icons_texture[MAX_ICONS_RENDER]; std::unique_ptr ui_menu::snapx_bitmap; std::unique_ptr ui_menu::no_avail_bitmap; @@ -85,8 +85,8 @@ std::unique_ptr ui_menu::star_bitmap; std::unique_ptr ui_menu::bgrnd_bitmap; bitmap_argb32 *ui_menu::icons_bitmap[MAX_ICONS_RENDER]; std::unique_ptr ui_menu::hilight_main_bitmap; -bitmap_argb32 *ui_menu::toolbar_bitmap[MEWUI_TOOLBAR_BUTTONS]; -bitmap_argb32 *ui_menu::sw_toolbar_bitmap[MEWUI_TOOLBAR_BUTTONS]; +bitmap_argb32 *ui_menu::toolbar_bitmap[UI_TOOLBAR_BUTTONS]; +bitmap_argb32 *ui_menu::sw_toolbar_bitmap[UI_TOOLBAR_BUTTONS]; /*************************************************************************** INLINE FUNCTIONS @@ -149,8 +149,8 @@ void ui_menu::init(running_machine &machine) // create a texture for arrow icons arrow_texture = machine.render().texture_alloc(render_triangle); - // initialize mewui - init_mewui(machine); + // initialize ui + init_ui(machine); // add an exit callback to free memory machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_menu::exit), &machine)); @@ -179,7 +179,7 @@ void ui_menu::exit(running_machine &machine) for (auto & elem : icons_texture) mre.texture_free(elem); - for (int i = 0; i < MEWUI_TOOLBAR_BUTTONS; i++) + for (int i = 0; i < UI_TOOLBAR_BUTTONS; i++) { mre.texture_free(sw_toolbar_texture[i]); mre.texture_free(toolbar_texture[i]); @@ -336,9 +336,9 @@ const ui_menu_event *ui_menu::process(UINT32 flags) // draw the menu if (item.size() > 1 && (item[0].flags & MENU_FLAG_MULTILINE) != 0) draw_text_box(); - else if ((item[0].flags & MENU_FLAG_MEWUI ) != 0 || (item[0].flags & MENU_FLAG_MEWUI_SWLIST ) != 0) + else if ((item[0].flags & MENU_FLAG_UI ) != 0 || (item[0].flags & MENU_FLAG_UI_SWLIST ) != 0) draw_select_game(flags & UI_MENU_PROCESS_NOINPUT); - else if ((item[0].flags & MENU_FLAG_MEWUI_PALETTE ) != 0) + else if ((item[0].flags & MENU_FLAG_UI_PALETTE ) != 0) draw_palette_menu(); else draw(flags & UI_MENU_PROCESS_CUSTOM_ONLY, flags & UI_MENU_PROCESS_NOIMAGE, flags & UI_MENU_PROCESS_NOINPUT); @@ -347,7 +347,7 @@ const ui_menu_event *ui_menu::process(UINT32 flags) if (!(flags & UI_MENU_PROCESS_NOKEYS) && !(flags & UI_MENU_PROCESS_NOINPUT)) { // read events - if ((item[0].flags & MENU_FLAG_MEWUI ) != 0 || (item[0].flags & MENU_FLAG_MEWUI_SWLIST ) != 0) + if ((item[0].flags & MENU_FLAG_UI ) != 0 || (item[0].flags & MENU_FLAG_UI_SWLIST ) != 0) handle_main_events(flags); else handle_events(flags); @@ -355,7 +355,7 @@ const ui_menu_event *ui_menu::process(UINT32 flags) // handle the keys if we don't already have an menu_event if (menu_event.iptkey == IPT_INVALID) { - if ((item[0].flags & MENU_FLAG_MEWUI ) != 0 || (item[0].flags & MENU_FLAG_MEWUI_SWLIST ) != 0) + if ((item[0].flags & MENU_FLAG_UI ) != 0 || (item[0].flags & MENU_FLAG_UI_SWLIST ) != 0) handle_main_keys(flags); else handle_keys(flags); @@ -463,7 +463,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) int itemnum, linenum; bool mouse_hit, mouse_button; float mouse_x = -1, mouse_y = -1; - bool history_flag = ((item[0].flags & MENU_FLAG_MEWUI_HISTORY) != 0); + bool history_flag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); if (machine().options().use_background_image() && &machine().system() == &GAME_NAME(___empty) && bgrnd_bitmap->valid() && !noimage) container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); @@ -575,11 +575,11 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) // set the hover if this is our item if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && pitem.is_selectable() - && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) + && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) hover = itemnum; // if we're selected, draw with a different background - if (itemnum == selected && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) + if (itemnum == selected && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) { fgcolor = UI_SELECTED_COLOR; bgcolor = UI_SELECTED_BG_COLOR; @@ -588,7 +588,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) } // else if the mouse is over this item, draw with a different background - else if (itemnum == hover && (((pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) || (linenum == 0 && top_line != 0) + else if (itemnum == hover && (((pitem.flags & MENU_FLAG_UI_HISTORY) == 0) || (linenum == 0 && top_line != 0) || (linenum == visible_lines - 1 && itemnum != item.size() - 1))) { fgcolor = UI_MOUSEOVER_COLOR; @@ -634,7 +634,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); // draw the subitem left-justified - else if (pitem.subtext == nullptr && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) != 0) + else if (pitem.subtext == nullptr && (pitem.flags & MENU_FLAG_UI_HISTORY) != 0) machine().ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); @@ -820,7 +820,7 @@ void ui_menu::handle_events(UINT32 flags) { int stop = FALSE; ui_event local_menu_event; - bool historyflag = ((item[0].flags & MENU_FLAG_MEWUI_HISTORY) != 0); + bool historyflag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); // loop while we have interesting events while (!stop && machine().ui_input().pop_event(&local_menu_event)) @@ -917,7 +917,7 @@ void ui_menu::handle_keys(UINT32 flags) // bail if no items if (item.empty()) return; - bool historyflag = ((item[0].flags & MENU_FLAG_MEWUI_HISTORY) != 0); + bool historyflag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); // if we hit select, return TRUE or pop the stack, depending on the item @@ -1257,10 +1257,10 @@ void ui_menu::draw_arrow(render_container *container, float x0, float y0, float } //------------------------------------------------- -// init - initialize the mewui menu system +// init - initialize the ui menu system //------------------------------------------------- -void ui_menu::init_mewui(running_machine &machine) +void ui_menu::init_ui(running_machine &machine) { render_manager &mrender = machine.render(); // create a texture for hilighting items in main menu @@ -1323,7 +1323,7 @@ void ui_menu::init_mewui(running_machine &machine) bgrnd_bitmap->reset(); // create a texture for toolbar - for (int x = 0; x < MEWUI_TOOLBAR_BUTTONS; ++x) + for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x) { toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); toolbar_texture[x] = mrender.texture_alloc(); @@ -1336,7 +1336,7 @@ void ui_menu::init_mewui(running_machine &machine) } // create a texture for toolbar - for (int x = 0; x < MEWUI_TOOLBAR_BUTTONS; ++x) + for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x) { sw_toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); sw_toolbar_texture[x] = mrender.texture_alloc(); @@ -1367,8 +1367,8 @@ void ui_menu::draw_select_game(bool noinput) float visible_width = 1.0f - 4.0f * UI_BOX_LR_BORDER; float primary_left = (1.0f - visible_width) * 0.5f; float primary_width = visible_width; - bool is_swlist = ((item[0].flags & MENU_FLAG_MEWUI_SWLIST) != 0); - bool is_favorites = ((item[0].flags & MENU_FLAG_MEWUI_FAVORITE) != 0); + bool is_swlist = ((item[0].flags & MENU_FLAG_UI_SWLIST) != 0); + bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0); ui_manager &mui = machine().ui(); // draw background image if available @@ -2139,7 +2139,7 @@ void ui_menu::draw_toolbar(float x1, float y1, float x2, float y2, bool software bitmap_argb32 **t_bitmap = (software) ? sw_toolbar_bitmap : toolbar_bitmap; int m_valid = 0; - for (int x = 0; x < MEWUI_TOOLBAR_BUTTONS; ++x) + for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x) if (t_bitmap[x]->valid()) m_valid++; @@ -2148,7 +2148,7 @@ void ui_menu::draw_toolbar(float x1, float y1, float x2, float y2, bool software h_len = (h_len % 2 == 0) ? h_len : h_len - 1; x1 = (x1 + x2) * 0.5f - x_pixel * (m_valid * ((h_len / 2) + 2)); - for (int z = 0; z < MEWUI_TOOLBAR_BUTTONS; ++z) + for (int z = 0; z < UI_TOOLBAR_BUTTONS; ++z) { if (t_bitmap[z]->valid()) { @@ -2543,14 +2543,14 @@ void ui_menu::draw_palette_menu() hover = itemnum; // if we're selected, draw with a different background - if (itemnum == selected && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) + if (itemnum == selected && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) { fgcolor = UI_SELECTED_COLOR; bgcolor = UI_SELECTED_BG_COLOR; } // else if the mouse is over this item, draw with a different background - else if (itemnum == hover && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) + else if (itemnum == hover && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) { fgcolor = UI_MOUSEOVER_COLOR; bgcolor = UI_MOUSEOVER_BG_COLOR; diff --git a/src/emu/ui/menu.h b/src/emu/ui/menu.h index 43c88330d66..174d2866fac 100644 --- a/src/emu/ui/menu.h +++ b/src/emu/ui/menu.h @@ -27,11 +27,11 @@ #define MENU_FLAG_MULTILINE (1 << 3) #define MENU_FLAG_REDTEXT (1 << 4) #define MENU_FLAG_DISABLE (1 << 5) -#define MENU_FLAG_MEWUI (1 << 6) -#define MENU_FLAG_MEWUI_HISTORY (1 << 7) -#define MENU_FLAG_MEWUI_SWLIST (1 << 8) -#define MENU_FLAG_MEWUI_FAVORITE (1 << 9) -#define MENU_FLAG_MEWUI_PALETTE (1 << 10) +#define MENU_FLAG_UI (1 << 6) +#define MENU_FLAG_UI_HISTORY (1 << 7) +#define MENU_FLAG_UI_SWLIST (1 << 8) +#define MENU_FLAG_UI_FAVORITE (1 << 9) +#define MENU_FLAG_UI_PALETTE (1 << 10) // special menu item for separators #define MENU_SEPARATOR_ITEM "---" @@ -191,9 +191,6 @@ private: static void clear_free_list(running_machine &machine); static void render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param); -/***************************************** - MEWUI SECTION -*****************************************/ public: int visible_items; bool ui_error; @@ -217,7 +214,7 @@ public: void draw_star(float x0, float y0); // Global initialization - static void init_mewui(running_machine &machine); + static void init_ui(running_machine &machine); // get arrows status template diff --git a/src/emu/ui/moptions.cpp b/src/emu/ui/moptions.cpp index 419769ac977..cae3582747c 100644 --- a/src/emu/ui/moptions.cpp +++ b/src/emu/ui/moptions.cpp @@ -4,7 +4,7 @@ ui/moptions.c - MEWUI main options manager. + UI main options manager. ***************************************************************************/ @@ -13,13 +13,13 @@ //************************************************************************** -// MEWUI EXTRA OPTIONS +// UI EXTRA OPTIONS //************************************************************************** const options_entry ui_options::s_option_entries[] = { // seach path options - { nullptr, nullptr, OPTION_HEADER, "MEWUI SEARCH PATH OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "UI SEARCH PATH OPTIONS" }, { OPTION_HISTORY_PATH, "history;dats", OPTION_STRING, "path to history files" }, { OPTION_EXTRAINI_PATH, "folders", OPTION_STRING, "path to extra ini files" }, { OPTION_CABINETS_PATH, "cabinets;cabdevs", OPTION_STRING, "path to cabinets / devices image" }, @@ -38,10 +38,10 @@ const options_entry ui_options::s_option_entries[] = { OPTION_HOWTO_PATH, "howto", OPTION_STRING, "path to howto image" }, { OPTION_SELECT_PATH, "select", OPTION_STRING, "path to select image" }, { OPTION_ICONS_PATH, "icons", OPTION_STRING, "path to ICOns image" }, - { OPTION_MEWUI_PATH, "mewui", OPTION_STRING, "path to MEWUI files" }, + { OPTION_UI_PATH, "ui", OPTION_STRING, "path to UI files" }, // misc options - { nullptr, nullptr, OPTION_HEADER, "MEWUI MISC OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "UI MISC OPTIONS" }, { OPTION_DATS_ENABLED, "1", OPTION_BOOLEAN, "enable DATs support" }, { OPTION_REMEMBER_LAST, "1", OPTION_BOOLEAN, "reselect in main menu last played game" }, { OPTION_ENLARGE_SNAPS, "1", OPTION_BOOLEAN, "enlarge arts (snapshot, title, etc...) in right panel (keeping aspect ratio)" }, @@ -54,7 +54,7 @@ const options_entry ui_options::s_option_entries[] = { OPTION_INFO_AUTO_AUDIT, "0", OPTION_BOOLEAN, "enable auto audit in the general info panel" }, // UI options - { nullptr, nullptr, OPTION_HEADER, "MEWUI UI OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "UI UI OPTIONS" }, { OPTION_INFOS_SIZE "(0.05-1.00)", "0.75", OPTION_FLOAT, "UI right panel infos text size (0.05 - 1.00)" }, { OPTION_FONT_ROWS "(25-40)", "30", OPTION_INTEGER, "UI font text size (25 - 40)" }, { OPTION_HIDE_PANELS "(0-3)", "0", OPTION_INTEGER, "UI hide left/right panel in main view (0 = Show all, 1 = hide left, 2 = hide right, 3 = hide both" }, diff --git a/src/emu/ui/moptions.h b/src/emu/ui/moptions.h index 59e04506fcc..e3c649111d9 100644 --- a/src/emu/ui/moptions.h +++ b/src/emu/ui/moptions.h @@ -4,7 +4,7 @@ ui/moptions.h - MEWUI main options manager. + UI main options manager. ***************************************************************************/ @@ -34,7 +34,7 @@ #define OPTION_HOWTO_PATH "howto_directory" #define OPTION_SELECT_PATH "select_directory" #define OPTION_ICONS_PATH "icons_directory" -#define OPTION_MEWUI_PATH "mewui_path" +#define OPTION_UI_PATH "ui_path" // core misc options #define OPTION_DATS_ENABLED "dats_enabled" @@ -95,7 +95,7 @@ public: const char *howto_directory() const { return value(OPTION_HOWTO_PATH); } const char *select_directory() const { return value(OPTION_SELECT_PATH); } const char *icons_directory() const { return value(OPTION_ICONS_PATH); } - const char *mewui_path() const { return value(OPTION_MEWUI_PATH); } + const char *ui_path() const { return value(OPTION_UI_PATH); } // Misc options bool enabled_dats() const { return bool_value(OPTION_DATS_ENABLED); } diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp index 116519b25e7..4f19a6d1c1d 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/emu/ui/optsmenu.cpp @@ -4,7 +4,7 @@ ui/optsmenu.cpp - MEWUI main options menu manager. + UI main options menu manager. *********************************************************************/ diff --git a/src/emu/ui/optsmenu.h b/src/emu/ui/optsmenu.h index 71196284c3d..6900bfec769 100644 --- a/src/emu/ui/optsmenu.h +++ b/src/emu/ui/optsmenu.h @@ -4,7 +4,7 @@ ui/optsmenu.h - MEWUI main options menu manager. + UI main options menu manager. ***************************************************************************/ diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index e931c6a8d73..208c61b795d 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -4,7 +4,7 @@ ui/selgame.cpp - Main MEWUI menu. + Main UI menu. *********************************************************************/ @@ -32,7 +32,7 @@ #include "softlist.h" #include -extern const char MEWUI_VERSION_TAG[]; +extern const char UI_VERSION_TAG[]; static bool first_start = true; static const char *dats_info[] = { "General Info", "History", "Mameinfo", "Sysinfo", "Messinfo", "Command", "Mamescore" }; @@ -170,7 +170,7 @@ ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_contai moptions.set_value(OPTION_SOFTWARENAME, "", OPTION_PRIORITY_CMDLINE, error_string); ui_globals::curimage_view = FIRST_VIEW; - ui_globals::curdats_view = MEWUI_FIRST_LOAD; + ui_globals::curdats_view = UI_FIRST_LOAD; ui_globals::switch_image = false; ui_globals::default_image = true; ui_globals::panels_status = moptions.hide_panels(); @@ -269,7 +269,7 @@ void ui_menu_select_game::handle() } // Infos - else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view > MEWUI_FIRST_LOAD) + else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view > UI_FIRST_LOAD) { ui_globals::curdats_view--; topline_datsview = 0; @@ -288,7 +288,7 @@ void ui_menu_select_game::handle() } // Infos - else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view < MEWUI_LAST_LOAD) + else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view < UI_LAST_LOAD) { ui_globals::curdats_view++; topline_datsview = 0; @@ -331,7 +331,7 @@ void ui_menu_select_game::handle() { const game_driver *driver = (const game_driver *)m_event->itemref; if ((FPTR)driver > 2) - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_HISTORY_LOAD, driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_HISTORY_LOAD, driver)); } else { @@ -339,7 +339,7 @@ void ui_menu_select_game::handle() if ((FPTR)swinfo > 2) { if (swinfo->startempty == 1) - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_HISTORY_LOAD, swinfo->driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_HISTORY_LOAD, swinfo->driver)); else ui_menu::stack_push(global_alloc_clear(machine(), container, swinfo)); } @@ -355,9 +355,9 @@ void ui_menu_select_game::handle() if ((FPTR)driver > 2) { if ((driver->flags & MACHINE_TYPE_ARCADE) != 0) - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MAMEINFO_LOAD, driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MAMEINFO_LOAD, driver)); else - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MESSINFO_LOAD, driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MESSINFO_LOAD, driver)); } } else @@ -366,9 +366,9 @@ void ui_menu_select_game::handle() if ((FPTR)swinfo > 2 && swinfo->startempty == 1) { if ((swinfo->driver->flags & MACHINE_TYPE_ARCADE) != 0) - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MAMEINFO_LOAD, swinfo->driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MAMEINFO_LOAD, swinfo->driver)); else - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_MESSINFO_LOAD, swinfo->driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MESSINFO_LOAD, swinfo->driver)); } } } @@ -380,13 +380,13 @@ void ui_menu_select_game::handle() { const game_driver *driver = (const game_driver *)m_event->itemref; if ((FPTR)driver > 2) - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_STORY_LOAD, driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_STORY_LOAD, driver)); } else { ui_software_info *swinfo = (ui_software_info *)m_event->itemref; if ((FPTR)swinfo > 2 && swinfo->startempty == 1) - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_STORY_LOAD, swinfo->driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_STORY_LOAD, swinfo->driver)); } } @@ -397,13 +397,13 @@ void ui_menu_select_game::handle() { const game_driver *driver = (const game_driver *)m_event->itemref; if ((FPTR)driver > 2) - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_SYSINFO_LOAD, driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_SYSINFO_LOAD, driver)); } else { ui_software_info *swinfo = (ui_software_info *)m_event->itemref; if ((FPTR)swinfo > 2 && swinfo->startempty == 1) - ui_menu::stack_push(global_alloc_clear(machine(), container, MEWUI_SYSINFO_LOAD, swinfo->driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, UI_SYSINFO_LOAD, swinfo->driver)); } } @@ -597,7 +597,7 @@ void ui_menu_select_game::populate() // iterate over entries for (size_t curitem = 0; curitem < m_displaylist.size(); ++curitem) { - UINT32 flags_mewui = MENU_FLAG_MEWUI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; + UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; if (old_item_selected == -1 && !reselect_last::driver.empty() && m_displaylist[curitem]->name == reselect_last::driver) old_item_selected = curitem; @@ -610,9 +610,9 @@ void ui_menu_select_game::populate() cloneof = false; } if (cloneof) - flags_mewui |= MENU_FLAG_INVERT; + flags_ui |= MENU_FLAG_INVERT; - item_append(m_displaylist[curitem]->description, nullptr, flags_mewui, (void *)m_displaylist[curitem]); + item_append(m_displaylist[curitem]->description, nullptr, flags_ui, (void *)m_displaylist[curitem]); } } } @@ -624,7 +624,7 @@ void ui_menu_select_game::populate() // iterate over entries for (auto & mfavorite : machine().favorite().m_list) { - UINT32 flags_mewui = MENU_FLAG_MEWUI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW | MENU_FLAG_MEWUI_FAVORITE; + UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW | MENU_FLAG_UI_FAVORITE; if (mfavorite.startempty == 1) { if (old_item_selected == -1 && !reselect_last::driver.empty() && mfavorite.shortname == reselect_last::driver) @@ -638,25 +638,25 @@ void ui_menu_select_game::populate() cloneof = false; } if (cloneof) - flags_mewui |= MENU_FLAG_INVERT; + flags_ui |= MENU_FLAG_INVERT; - item_append(mfavorite.longname.c_str(), nullptr, flags_mewui, (void *)&mfavorite); + item_append(mfavorite.longname.c_str(), nullptr, flags_ui, (void *)&mfavorite); } else { if (old_item_selected == -1 && !reselect_last::driver.empty() && mfavorite.shortname == reselect_last::driver) old_item_selected = curitem; item_append(mfavorite.longname.c_str(), mfavorite.devicetype.c_str(), - mfavorite.parentname.empty() ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), (void *)&mfavorite); + mfavorite.parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui), (void *)&mfavorite); } curitem++; } } // add special items - item_append(MENU_SEPARATOR_ITEM, nullptr, MENU_FLAG_MEWUI, nullptr); - item_append("Configure Options", nullptr, MENU_FLAG_MEWUI, (void *)(FPTR)1); - item_append("Configure Directories", nullptr, MENU_FLAG_MEWUI, (void *)(FPTR)2); + item_append(MENU_SEPARATOR_ITEM, nullptr, MENU_FLAG_UI, nullptr); + item_append("Configure Options", nullptr, MENU_FLAG_UI, (void *)(FPTR)1); + item_append("Configure Directories", nullptr, MENU_FLAG_UI, (void *)(FPTR)2); // configure the custom rendering customtop = 3.0f * machine().ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER; @@ -1024,7 +1024,7 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event) std::vector biosname; if (!machine().options().skip_bios_menu() && has_multiple_bios(driver, biosname)) - ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)driver, false, false)); + ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)driver, false, false)); else { reselect_last::driver = driver->name; @@ -1074,7 +1074,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) { std::vector biosname; if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) - ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo->driver, false, false)); + ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo->driver, false, false)); else { reselect_last::driver = ui_swinfo->driver->name; @@ -1108,7 +1108,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) std::vector biosname; if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) { - ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo, true, false)); + ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo, true, false)); return; } else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) @@ -1124,7 +1124,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) parts.emplace(swpart->name(), menu_part_name); } } - ui_menu::stack_push(global_alloc_clear(machine(), container, parts, ui_swinfo)); + ui_menu::stack_push(global_alloc_clear(machine(), container, parts, ui_swinfo)); return; } @@ -1471,7 +1471,7 @@ void ui_menu_select_game::populate_search() } (index < VISIBLE_GAMES_IN_SEARCH) ? m_searchlist[index] = nullptr : m_searchlist[VISIBLE_GAMES_IN_SEARCH] = nullptr; - UINT32 flags_mewui = MENU_FLAG_MEWUI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; + UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; for (int curitem = 0; m_searchlist[curitem]; ++curitem) { bool cloneof = strcmp(m_searchlist[curitem]->parent, "0"); @@ -1481,7 +1481,7 @@ void ui_menu_select_game::populate_search() if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0)) cloneof = false; } - item_append(m_searchlist[curitem]->description, nullptr, (!cloneof) ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), + item_append(m_searchlist[curitem]->description, nullptr, (!cloneof) ? flags_ui : (MENU_FLAG_INVERT | flags_ui), (void *)m_searchlist[curitem]); } } @@ -1569,7 +1569,7 @@ void ui_menu_select_game::general_info(const game_driver *driver, std::string &b void ui_menu_select_game::inkey_export() { std::string filename("exported"); - emu_file infile(machine().options().mewui_path(), OPEN_FLAG_READ); + emu_file infile(machine().options().ui_path(), OPEN_FLAG_READ); if (infile.open(filename.c_str(), ".xml") == FILERR_NONE) for (int seq = 0; ; ++seq) { @@ -1583,7 +1583,7 @@ void ui_menu_select_game::inkey_export() } // attempt to open the output file - emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(filename.c_str(), ".xml") == FILERR_NONE) { FILE *pfile; @@ -1614,7 +1614,7 @@ void ui_menu_select_game::inkey_export() info_xml_creator creator(drivlist); creator.output(pfile, false); fclose(pfile); - machine().popmessage("%s.xml saved under mewui folder.", filename.c_str()); + machine().popmessage("%s.xml saved under ui folder.", filename.c_str()); } } @@ -1625,14 +1625,14 @@ void ui_menu_select_game::inkey_export() void ui_menu_select_game::save_cache_info() { // attempt to open the output file - emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open("info_", emulator_info::get_configname(), ".ini") == FILERR_NONE) { m_sortedlist.clear(); // generate header - std::string buffer = std::string("#\n").append(MEWUI_VERSION_TAG).append(bare_build_version).append("\n#\n\n"); + std::string buffer = std::string("#\n").append(UI_VERSION_TAG).append(bare_build_version).append("\n#\n\n"); // generate full list for (int x = 0; x < driver_list::total(); ++x) @@ -1716,7 +1716,7 @@ void ui_menu_select_game::load_cache_info() driver_cache.resize(driver_list::total() + 1); // try to load driver cache - emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); + emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); if (file.open("info_", emulator_info::get_configname(), ".ini") != FILERR_NONE) { save_cache_info(); @@ -1728,7 +1728,7 @@ void ui_menu_select_game::load_cache_info() file.gets(rbuf, MAX_CHAR_INFO); file.gets(rbuf, MAX_CHAR_INFO); readbuf = chartrimcarriage(rbuf); - std::string a_rev = std::string(MEWUI_VERSION_TAG).append(bare_build_version); + std::string a_rev = std::string(UI_VERSION_TAG).append(bare_build_version); // version not matching ? save and exit if (a_rev != readbuf) @@ -1788,7 +1788,7 @@ void ui_menu_select_game::load_cache_info() bool ui_menu_select_game::load_available_machines() { // try to load available drivers from file - emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); + emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); if (file.open(emulator_info::get_configname(), "_avail.ini") != FILERR_NONE) return false; @@ -1797,7 +1797,7 @@ bool ui_menu_select_game::load_available_machines() file.gets(rbuf, MAX_CHAR_INFO); file.gets(rbuf, MAX_CHAR_INFO); readbuf = chartrimcarriage(rbuf); - std::string a_rev = std::string(MEWUI_VERSION_TAG).append(bare_build_version); + std::string a_rev = std::string(UI_VERSION_TAG).append(bare_build_version); // version not matching ? exit if (a_rev != readbuf) @@ -1840,7 +1840,7 @@ bool ui_menu_select_game::load_available_machines() void ui_menu_select_game::load_custom_filters() { // attempt to open the output file - emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); + emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == FILERR_NONE) { char buffer[MAX_CHAR_INFO]; @@ -2069,7 +2069,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or float text_size = machine().options().infos_size(); const game_driver *driver = nullptr; ui_software_info *soft = nullptr; - bool is_favorites = ((item[0].flags & MENU_FLAG_MEWUI_FAVORITE) != 0); + bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0); static ui_software_info *oldsoft = nullptr; static const game_driver *olddriver = nullptr; static int oldview = -1; @@ -2099,7 +2099,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or float oy1 = origy1 + line_height; // MAMESCORE? Full size text - if (ui_globals::curdats_view == MEWUI_STORY_LOAD) + if (ui_globals::curdats_view == UI_STORY_LOAD) text_size = 1.0f; std::string snaptext(dats_info[ui_globals::curdats_view]); @@ -2108,7 +2108,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or float title_size = 0.0f; float txt_lenght = 0.0f; - for (int x = MEWUI_FIRST_LOAD; x < MEWUI_LAST_LOAD; ++x) + for (int x = UI_FIRST_LOAD; x < UI_LAST_LOAD; ++x) { mui.draw_text_full(container, dats_info[x], origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr); @@ -2119,7 +2119,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or mui.draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curdats_view, MEWUI_FIRST_LOAD, MEWUI_LAST_LOAD, title_size); + draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curdats_view, UI_FIRST_LOAD, UI_LAST_LOAD, title_size); if (driver != olddriver || ui_globals::curdats_view != oldview) { @@ -2130,14 +2130,14 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or totallines = 0; std::vector m_item; - if (ui_globals::curdats_view == MEWUI_GENERAL_LOAD) + if (ui_globals::curdats_view == UI_GENERAL_LOAD) general_info(driver, buffer); - else if (ui_globals::curdats_view != MEWUI_COMMAND_LOAD) + else if (ui_globals::curdats_view != UI_COMMAND_LOAD) machine().datfile().load_data_info(driver, buffer, ui_globals::curdats_view); else machine().datfile().command_sub_menu(driver, m_item); - if (!m_item.empty() && ui_globals::curdats_view == MEWUI_COMMAND_LOAD) + if (!m_item.empty() && ui_globals::curdats_view == UI_COMMAND_LOAD) { for (size_t x = 0; x < m_item.size(); ++x) { @@ -2157,7 +2157,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); return; } - else if (ui_globals::curdats_view != MEWUI_STORY_LOAD && ui_globals::curdats_view != MEWUI_COMMAND_LOAD) + else if (ui_globals::curdats_view != UI_STORY_LOAD && ui_globals::curdats_view != UI_COMMAND_LOAD) mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, xstart, xend, text_size); else mui.wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * gutter_width), totallines, xstart, xend, text_size); @@ -2183,7 +2183,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or else if (r == r_visible_lines - 1 && itemline != totallines - 1) info_arrow(1, origx1, origx2, oy1, line_height, text_size, ud_arrow_width); // special case for mamescore - else if (ui_globals::curdats_view == MEWUI_STORY_LOAD) + else if (ui_globals::curdats_view == UI_STORY_LOAD) { // check size float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size); @@ -2213,13 +2213,13 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or } // special case for command - else if (ui_globals::curdats_view == MEWUI_COMMAND_LOAD || ui_globals::curdats_view == MEWUI_GENERAL_LOAD) + else if (ui_globals::curdats_view == UI_COMMAND_LOAD || ui_globals::curdats_view == UI_GENERAL_LOAD) { // check size float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size); float tmp_size = (textlen > sc) ? text_size * (sc / textlen) : text_size; - int first_dspace = (ui_globals::curdats_view == MEWUI_COMMAND_LOAD) ? tempbuf.find(" ") : tempbuf.find(":"); + int first_dspace = (ui_globals::curdats_view == UI_COMMAND_LOAD) ? tempbuf.find(" ") : tempbuf.find(":"); if (first_dspace > 0) { float effective_width = origx2 - origx1 - gutter_width; @@ -2290,7 +2290,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or if (ui_globals::cur_sw_dats_view == 0) { if (soft->startempty == 1) - machine().datfile().load_data_info(soft->driver, buffer, MEWUI_HISTORY_LOAD); + machine().datfile().load_data_info(soft->driver, buffer, UI_HISTORY_LOAD); else machine().datfile().load_software_info(soft->listname, buffer, soft->shortname, soft->parentname); } @@ -2385,7 +2385,7 @@ void ui_menu_select_game::arts_render(void *selectedref, float origx1, float ori { ui_manager &mui = machine().ui(); float line_height = mui.get_line_height(); - bool is_favorites = ((item[0].flags & MENU_FLAG_MEWUI_FAVORITE) != 0); + bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0); static ui_software_info *oldsoft = nullptr; static const game_driver *olddriver = nullptr; const game_driver *driver = nullptr; diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h index b1acdc31e92..d09c9789ee0 100644 --- a/src/emu/ui/selgame.h +++ b/src/emu/ui/selgame.h @@ -4,7 +4,7 @@ ui/selgame.h - Main MEWUI menu. + Main UI menu. ***************************************************************************/ diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index fbc6f698217..e4b71a6a809 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -4,7 +4,7 @@ ui/selsoft.cpp - MEWUI softwares menu. + UI softwares menu. ***************************************************************************/ @@ -134,7 +134,7 @@ ui_menu_select_software::ui_menu_select_software(running_machine &machine, rende ui_globals::curimage_view = SNAPSHOT_VIEW; ui_globals::switch_image = true; - ui_globals::cur_sw_dats_view = MEWUI_FIRST_LOAD; + ui_globals::cur_sw_dats_view = UI_FIRST_LOAD; std::string error_string; machine.options().set_value(OPTION_SOFTWARENAME, "", OPTION_PRIORITY_CMDLINE, error_string); @@ -222,14 +222,14 @@ void ui_menu_select_software::handle() } // handle UI_UP_FILTER - else if (m_event->iptkey == IPT_UI_UP_FILTER && sw_filters::actual > MEWUI_SW_FIRST) + else if (m_event->iptkey == IPT_UI_UP_FILTER && sw_filters::actual > UI_SW_FIRST) { l_sw_hover = sw_filters::actual - 1; check_filter = true; } // handle UI_DOWN_FILTER - else if (m_event->iptkey == IPT_UI_DOWN_FILTER && sw_filters::actual < MEWUI_SW_LAST) + else if (m_event->iptkey == IPT_UI_DOWN_FILTER && sw_filters::actual < UI_SW_LAST) { l_sw_hover = sw_filters::actual + 1; check_filter = true; @@ -289,14 +289,14 @@ void ui_menu_select_software::handle() check_filter = true; // handle UI_UP_FILTER - else if (m_event->iptkey == IPT_UI_UP_FILTER && sw_filters::actual > MEWUI_SW_FIRST) + else if (m_event->iptkey == IPT_UI_UP_FILTER && sw_filters::actual > UI_SW_FIRST) { l_sw_hover = sw_filters::actual - 1; check_filter = true; } // handle UI_DOWN_FILTER - else if (m_event->iptkey == IPT_UI_DOWN_FILTER && sw_filters::actual < MEWUI_SW_LAST) + else if (m_event->iptkey == IPT_UI_DOWN_FILTER && sw_filters::actual < UI_SW_LAST) { l_sw_hover = sw_filters::actual + 1; check_filter = true; @@ -317,27 +317,27 @@ void ui_menu_select_software::handle() switch (l_sw_hover) { - case MEWUI_SW_REGION: + case UI_SW_REGION: ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.region.ui, m_filter.region.actual, SELECTOR_SOFTWARE, l_sw_hover)); break; - case MEWUI_SW_YEARS: + case UI_SW_YEARS: ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.year.ui, m_filter.year.actual, SELECTOR_SOFTWARE, l_sw_hover)); break; - case MEWUI_SW_LIST: + case UI_SW_LIST: ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.swlist.description, m_filter.swlist.actual, SELECTOR_SOFTWARE, l_sw_hover)); break; - case MEWUI_SW_TYPE: + case UI_SW_TYPE: ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.type.ui, m_filter.type.actual, SELECTOR_SOFTWARE, l_sw_hover)); break; - case MEWUI_SW_PUBLISHERS: + case UI_SW_PUBLISHERS: ui_menu::stack_push(global_alloc_clear(machine(), container, m_filter.publisher.ui, m_filter.publisher.actual, SELECTOR_SOFTWARE, l_sw_hover)); break; - case MEWUI_SW_CUSTOM: + case UI_SW_CUSTOM: sw_filters::actual = l_sw_hover; ui_menu::stack_push(global_alloc_clear(machine(), container, m_driver, m_filter)); break; @@ -355,7 +355,7 @@ void ui_menu_select_software::handle() void ui_menu_select_software::populate() { - UINT32 flags_mewui = MENU_FLAG_MEWUI_SWLIST | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; + UINT32 flags_ui = MENU_FLAG_UI_SWLIST | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; m_has_empty_start = true; int old_software = -1; @@ -374,34 +374,34 @@ void ui_menu_select_software::populate() { // if the device can be loaded empty, add an item if (m_has_empty_start) - item_append("[Start empty]", nullptr, flags_mewui, (void *)&m_swinfo[0]); + item_append("[Start empty]", nullptr, flags_ui, (void *)&m_swinfo[0]); m_displaylist.clear(); m_tmp.clear(); switch (sw_filters::actual) { - case MEWUI_SW_PUBLISHERS: + case UI_SW_PUBLISHERS: build_list(m_tmp, m_filter.publisher.ui[m_filter.publisher.actual].c_str()); break; - case MEWUI_SW_LIST: + case UI_SW_LIST: build_list(m_tmp, m_filter.swlist.name[m_filter.swlist.actual].c_str()); break; - case MEWUI_SW_YEARS: + case UI_SW_YEARS: build_list(m_tmp, m_filter.year.ui[m_filter.year.actual].c_str()); break; - case MEWUI_SW_TYPE: + case UI_SW_TYPE: build_list(m_tmp, m_filter.type.ui[m_filter.type.actual].c_str()); break; - case MEWUI_SW_REGION: + case UI_SW_REGION: build_list(m_tmp, m_filter.region.ui[m_filter.region.actual].c_str()); break; - case MEWUI_SW_CUSTOM: + case UI_SW_CUSTOM: build_custom(); break; @@ -421,7 +421,7 @@ void ui_menu_select_software::populate() old_software = m_has_empty_start ? curitem + 1 : curitem; item_append(m_displaylist[curitem]->longname.c_str(), m_displaylist[curitem]->devicetype.c_str(), - m_displaylist[curitem]->parentname.empty() ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), (void *)m_displaylist[curitem]); + m_displaylist[curitem]->parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui), (void *)m_displaylist[curitem]); } } @@ -431,11 +431,11 @@ void ui_menu_select_software::populate() for (int curitem = 0; m_searchlist[curitem] != nullptr; ++curitem) item_append(m_searchlist[curitem]->longname.c_str(), m_searchlist[curitem]->devicetype.c_str(), - m_searchlist[curitem]->parentname.empty() ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), + m_searchlist[curitem]->parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui), (void *)m_searchlist[curitem]); } - item_append(MENU_SEPARATOR_ITEM, nullptr, flags_mewui, nullptr); + item_append(MENU_SEPARATOR_ITEM, nullptr, flags_ui, nullptr); // configure the custom rendering customtop = 4.0f * machine().ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER; @@ -614,15 +614,15 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float strprintf(tempbuf[0], "MAME %s ( %d / %d softwares )", bare_build_version, vis_item, (int)m_swinfo.size() - 1); tempbuf[1].assign("Driver: \"").append(m_driver->description).append("\" software list "); - if (sw_filters::actual == MEWUI_SW_REGION && m_filter.region.ui.size() != 0) + if (sw_filters::actual == UI_SW_REGION && m_filter.region.ui.size() != 0) filtered.assign("Region: ").append(m_filter.region.ui[m_filter.region.actual]).append(" - "); - else if (sw_filters::actual == MEWUI_SW_PUBLISHERS) + else if (sw_filters::actual == UI_SW_PUBLISHERS) filtered.assign("Publisher: ").append(m_filter.publisher.ui[m_filter.publisher.actual]).append(" - "); - else if (sw_filters::actual == MEWUI_SW_YEARS) + else if (sw_filters::actual == UI_SW_YEARS) filtered.assign("Year: ").append(m_filter.year.ui[m_filter.year.actual]).append(" - "); - else if (sw_filters::actual == MEWUI_SW_LIST) + else if (sw_filters::actual == UI_SW_LIST) filtered.assign("Software List: ").append(m_filter.swlist.description[m_filter.swlist.actual]).append(" - "); - else if (sw_filters::actual == MEWUI_SW_TYPE) + else if (sw_filters::actual == UI_SW_TYPE) filtered.assign("Device type: ").append(m_filter.type.ui[m_filter.type.actual]).append(" - "); tempbuf[2].assign(filtered).append("Search: ").append(m_search).append("_"); @@ -823,7 +823,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) { std::vector biosname; if (has_multiple_bios(ui_swinfo->driver, biosname) && !mopt.skip_bios_menu()) - ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo->driver, false, true)); + ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo->driver, false, true)); else { reselect_last::driver = ui_swinfo->driver->name; @@ -852,7 +852,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) std::vector biosname; if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) { - ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo, true, false)); + ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo, true, false)); return; } else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) @@ -868,7 +868,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) parts.emplace(swpart->name(), menu_part_name); } } - ui_menu::stack_push(global_alloc_clear(machine(), container, parts, ui_swinfo)); + ui_menu::stack_push(global_alloc_clear(machine(), container, parts, ui_swinfo)); return; } std::string error_string; @@ -925,7 +925,7 @@ void ui_menu_select_software::inkey_special(const ui_menu_event *m_event) void ui_menu_select_software::load_sw_custom_filters() { // attempt to open the output file - emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); + emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); if (file.open("custom_", m_driver->name, "_filter.ini") == FILERR_NONE) { char buffer[MAX_CHAR_INFO]; @@ -955,7 +955,7 @@ void ui_menu_select_software::load_sw_custom_filters() if (!strncmp(cb, sw_filters::text[y], strlen(sw_filters::text[y]))) { sw_custfltr::other[x] = y; - if (y == MEWUI_SW_PUBLISHERS) + if (y == UI_SW_PUBLISHERS) { file.gets(buffer, MAX_CHAR_INFO); char *ab = strchr(buffer, '=') + 2; @@ -963,7 +963,7 @@ void ui_menu_select_software::load_sw_custom_filters() if (!strncmp(ab, m_filter.publisher.ui[z].c_str(), m_filter.publisher.ui[z].length())) sw_custfltr::mnfct[x] = z; } - else if (y == MEWUI_SW_YEARS) + else if (y == UI_SW_YEARS) { file.gets(buffer, MAX_CHAR_INFO); char *db = strchr(buffer, '=') + 2; @@ -971,7 +971,7 @@ void ui_menu_select_software::load_sw_custom_filters() if (!strncmp(db, m_filter.year.ui[z].c_str(), m_filter.year.ui[z].length())) sw_custfltr::year[x] = z; } - else if (y == MEWUI_SW_LIST) + else if (y == UI_SW_LIST) { file.gets(buffer, MAX_CHAR_INFO); char *gb = strchr(buffer, '=') + 2; @@ -979,7 +979,7 @@ void ui_menu_select_software::load_sw_custom_filters() if (!strncmp(gb, m_filter.swlist.name[z].c_str(), m_filter.swlist.name[z].length())) sw_custfltr::list[x] = z; } - else if (y == MEWUI_SW_TYPE) + else if (y == UI_SW_TYPE) { file.gets(buffer, MAX_CHAR_INFO); char *fb = strchr(buffer, '=') + 2; @@ -987,7 +987,7 @@ void ui_menu_select_software::load_sw_custom_filters() if (!strncmp(fb, m_filter.type.ui[z].c_str(), m_filter.type.ui[z].length())) sw_custfltr::type[x] = z; } - else if (y == MEWUI_SW_REGION) + else if (y == UI_SW_REGION) { file.gets(buffer, MAX_CHAR_INFO); char *eb = strchr(buffer, '=') + 2; @@ -1097,42 +1097,42 @@ void ui_menu_select_software::build_list(std::vector &s_driv { switch (filter) { - case MEWUI_SW_PARENTS: + case UI_SW_PARENTS: if (s_driver->parentname.empty()) m_displaylist.push_back(s_driver); break; - case MEWUI_SW_CLONES: + case UI_SW_CLONES: if (!s_driver->parentname.empty()) m_displaylist.push_back(s_driver); break; - case MEWUI_SW_AVAILABLE: + case UI_SW_AVAILABLE: if (s_driver->available) m_displaylist.push_back(s_driver); break; - case MEWUI_SW_UNAVAILABLE: + case UI_SW_UNAVAILABLE: if (!s_driver->available) m_displaylist.push_back(s_driver); break; - case MEWUI_SW_SUPPORTED: + case UI_SW_SUPPORTED: if (s_driver->supported == SOFTWARE_SUPPORTED_YES) m_displaylist.push_back(s_driver); break; - case MEWUI_SW_PARTIAL_SUPPORTED: + case UI_SW_PARTIAL_SUPPORTED: if (s_driver->supported == SOFTWARE_SUPPORTED_PARTIAL) m_displaylist.push_back(s_driver); break; - case MEWUI_SW_UNSUPPORTED: + case UI_SW_UNSUPPORTED: if (s_driver->supported == SOFTWARE_SUPPORTED_NO) m_displaylist.push_back(s_driver); break; - case MEWUI_SW_REGION: + case UI_SW_REGION: { std::string name = m_filter.region.getname(s_driver->longname); @@ -1141,7 +1141,7 @@ void ui_menu_select_software::build_list(std::vector &s_driv break; } - case MEWUI_SW_PUBLISHERS: + case UI_SW_PUBLISHERS: { std::string name = m_filter.publisher.getname(s_driver->publisher); @@ -1150,17 +1150,17 @@ void ui_menu_select_software::build_list(std::vector &s_driv break; } - case MEWUI_SW_YEARS: + case UI_SW_YEARS: if(s_driver->year == filter_text) m_displaylist.push_back(s_driver); break; - case MEWUI_SW_LIST: + case UI_SW_LIST: if(s_driver->listname == filter_text) m_displaylist.push_back(s_driver); break; - case MEWUI_SW_TYPE: + case UI_SW_TYPE: if(s_driver->devicetype == filter_text) m_displaylist.push_back(s_driver); break; @@ -1228,19 +1228,19 @@ void ui_menu_select_software::build_custom() switch (filter) { - case MEWUI_SW_YEARS: + case UI_SW_YEARS: build_list(s_drivers, m_filter.year.ui[sw_custfltr::year[count]].c_str(), filter); break; - case MEWUI_SW_LIST: + case UI_SW_LIST: build_list(s_drivers, m_filter.swlist.name[sw_custfltr::list[count]].c_str(), filter); break; - case MEWUI_SW_TYPE: + case UI_SW_TYPE: build_list(s_drivers, m_filter.type.ui[sw_custfltr::type[count]].c_str(), filter); break; - case MEWUI_SW_PUBLISHERS: + case UI_SW_PUBLISHERS: build_list(s_drivers, m_filter.publisher.ui[sw_custfltr::mnfct[count]].c_str(), filter); break; - case MEWUI_SW_REGION: + case UI_SW_REGION: build_list(s_drivers, m_filter.region.ui[sw_custfltr::region[count]].c_str(), filter); break; default: @@ -1326,7 +1326,7 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo container->add_rect(x1, y1, x2, y1 + line_height, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); float x1t = x1 + text_sign; - if (afilter == MEWUI_SW_CUSTOM) + if (afilter == UI_SW_CUSTOM) { if (filter == sw_custfltr::main) { @@ -1464,7 +1464,7 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa if (ui_globals::cur_sw_dats_view == 0) { if (soft->startempty == 1) - machine().datfile().load_data_info(soft->driver, buffer, MEWUI_HISTORY_LOAD); + machine().datfile().load_data_info(soft->driver, buffer, UI_HISTORY_LOAD); else machine().datfile().load_software_info(soft->listname, buffer, soft->shortname, soft->parentname); } @@ -1746,7 +1746,7 @@ void ui_menu_select_software::draw_right_panel(void *selectedref, float origx1, // ctor //------------------------------------------------- -ui_mewui_software_parts::ui_mewui_software_parts(running_machine &machine, render_container *container, std::unordered_map parts, ui_software_info *ui_info) : ui_menu(machine, container) +ui_software_parts::ui_software_parts(running_machine &machine, render_container *container, std::unordered_map parts, ui_software_info *ui_info) : ui_menu(machine, container) { m_parts = parts; m_uiinfo = ui_info; @@ -1756,7 +1756,7 @@ ui_mewui_software_parts::ui_mewui_software_parts(running_machine &machine, rende // dtor //------------------------------------------------- -ui_mewui_software_parts::~ui_mewui_software_parts() +ui_software_parts::~ui_software_parts() { } @@ -1764,7 +1764,7 @@ ui_mewui_software_parts::~ui_mewui_software_parts() // populate //------------------------------------------------- -void ui_mewui_software_parts::populate() +void ui_software_parts::populate() { for (auto & elem : m_parts) item_append(elem.first.c_str(), elem.second.c_str(), 0, (void *)&elem); @@ -1777,7 +1777,7 @@ void ui_mewui_software_parts::populate() // handle //------------------------------------------------- -void ui_mewui_software_parts::handle() +void ui_software_parts::handle() { // process the menu const ui_menu_event *event = process(0); @@ -1807,7 +1807,7 @@ void ui_mewui_software_parts::handle() // perform our special rendering //------------------------------------------------- -void ui_mewui_software_parts::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +void ui_software_parts::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; ui_manager &mui = machine().ui(); @@ -1839,7 +1839,7 @@ void ui_mewui_software_parts::custom_render(void *selectedref, float top, float // ctor //------------------------------------------------- -ui_mewui_bios_selection::ui_mewui_bios_selection(running_machine &machine, render_container *container, std::vector biosname, void *_driver, bool _software, bool _inlist) : ui_menu(machine, container) +ui_bios_selection::ui_bios_selection(running_machine &machine, render_container *container, std::vector biosname, void *_driver, bool _software, bool _inlist) : ui_menu(machine, container) { m_bios = biosname; m_driver = _driver; @@ -1851,7 +1851,7 @@ ui_mewui_bios_selection::ui_mewui_bios_selection(running_machine &machine, rende // dtor //------------------------------------------------- -ui_mewui_bios_selection::~ui_mewui_bios_selection() +ui_bios_selection::~ui_bios_selection() { } @@ -1859,7 +1859,7 @@ ui_mewui_bios_selection::~ui_mewui_bios_selection() // populate //------------------------------------------------- -void ui_mewui_bios_selection::populate() +void ui_bios_selection::populate() { for (auto & elem : m_bios) item_append(elem.name.c_str(), nullptr, 0, (void *)&elem.name); @@ -1872,7 +1872,7 @@ void ui_mewui_bios_selection::populate() // handle //------------------------------------------------- -void ui_mewui_bios_selection::handle() +void ui_bios_selection::handle() { // process the menu const ui_menu_event *event = process(0); @@ -1922,7 +1922,7 @@ void ui_mewui_bios_selection::handle() parts.emplace(swpart->name(), menu_part_name); } } - ui_menu::stack_push(global_alloc_clear(machine(), container, parts, ui_swinfo)); + ui_menu::stack_push(global_alloc_clear(machine(), container, parts, ui_swinfo)); return; } std::string error_string; @@ -1945,7 +1945,7 @@ void ui_mewui_bios_selection::handle() // perform our special rendering //------------------------------------------------- -void ui_mewui_bios_selection::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +void ui_bios_selection::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; ui_manager &mui = machine().ui(); diff --git a/src/emu/ui/selsoft.h b/src/emu/ui/selsoft.h index f5a2063cec6..8f7e6d413c8 100644 --- a/src/emu/ui/selsoft.h +++ b/src/emu/ui/selsoft.h @@ -4,7 +4,7 @@ ui/selsoft.h - MEWUI softwares menu. + UI softwares menu. ***************************************************************************/ #pragma once @@ -64,11 +64,11 @@ private: void inkey_special(const ui_menu_event *menu_event); }; -class ui_mewui_software_parts : public ui_menu +class ui_software_parts : public ui_menu { public: - ui_mewui_software_parts(running_machine &machine, render_container *container, std::unordered_map parts, ui_software_info *ui_info); - virtual ~ui_mewui_software_parts(); + ui_software_parts(running_machine &machine, render_container *container, std::unordered_map parts, ui_software_info *ui_info); + virtual ~ui_software_parts(); virtual void populate() override; virtual void handle() override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; @@ -78,11 +78,11 @@ private: std::unordered_map m_parts; }; -class ui_mewui_bios_selection : public ui_menu +class ui_bios_selection : public ui_menu { public: - ui_mewui_bios_selection(running_machine &machine, render_container *container, std::vector biosname, void *driver, bool software, bool inlist); - virtual ~ui_mewui_bios_selection(); + ui_bios_selection(running_machine &machine, render_container *container, std::vector biosname, void *driver, bool software, bool inlist); + virtual ~ui_bios_selection(); virtual void populate() override; virtual void handle() override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; diff --git a/src/emu/ui/toolbar.h b/src/emu/ui/toolbar.h index 145ab0e0cc5..f15f4499229 100644 --- a/src/emu/ui/toolbar.h +++ b/src/emu/ui/toolbar.h @@ -247,4 +247,4 @@ static const UINT32 toolbar_bitmap_bmp[][1024] = { } }; -#define MEWUI_TOOLBAR_BUTTONS ARRAY_LENGTH(toolbar_bitmap_bmp) +#define UI_TOOLBAR_BUTTONS ARRAY_LENGTH(toolbar_bitmap_bmp) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 3ca38662e38..93d100196ee 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -2563,9 +2563,10 @@ void ui_manager::set_use_natural_keyboard(bool use_natural_keyboard) assert(error.empty()); } -/********************************************** - * MEWUI - *********************************************/ +//------------------------------------------------- +// wrap_text +//------------------------------------------------- + void ui_manager::wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, int &count, std::vector &xstart, std::vector &xend, float text_size) { float lineheight = get_line_height() * text_size; diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h index 7e6248169c6..7153dae430b 100644 --- a/src/emu/ui/ui.h +++ b/src/emu/ui/ui.h @@ -168,7 +168,7 @@ public: // other void process_natural_keyboard(); - // MEWUI word wrap + // word wrap void wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, int &totallines, std::vector &xstart, std::vector &xend, float text_size = 1.0f); // draw an outlined box with given line color and filled with a texture diff --git a/src/emu/ui/utils.cpp b/src/emu/ui/utils.cpp index e3e71b096b0..eb8078a4ab1 100644 --- a/src/emu/ui/utils.cpp +++ b/src/emu/ui/utils.cpp @@ -12,8 +12,8 @@ #include "ui/utils.h" #include -extern const char MEWUI_VERSION_TAG[]; -const char MEWUI_VERSION_TAG[] = "# UI INFO "; +extern const char UI_VERSION_TAG[]; +const char UI_VERSION_TAG[] = "# UI INFO "; // Years index UINT16 c_year::actual = 0; diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index db1be4fc25c..473ac5f32ea 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -95,35 +95,35 @@ enum enum { - MEWUI_FIRST_LOAD = 0, - MEWUI_GENERAL_LOAD = MEWUI_FIRST_LOAD, - MEWUI_HISTORY_LOAD, - MEWUI_MAMEINFO_LOAD, - MEWUI_SYSINFO_LOAD, - MEWUI_MESSINFO_LOAD, - MEWUI_COMMAND_LOAD, - MEWUI_STORY_LOAD, - MEWUI_LAST_LOAD = MEWUI_STORY_LOAD + UI_FIRST_LOAD = 0, + UI_GENERAL_LOAD = UI_FIRST_LOAD, + UI_HISTORY_LOAD, + UI_MAMEINFO_LOAD, + UI_SYSINFO_LOAD, + UI_MESSINFO_LOAD, + UI_COMMAND_LOAD, + UI_STORY_LOAD, + UI_LAST_LOAD = UI_STORY_LOAD }; enum { - MEWUI_SW_FIRST = 0, - MEWUI_SW_ALL = MEWUI_SW_FIRST, - MEWUI_SW_AVAILABLE, - MEWUI_SW_UNAVAILABLE, - MEWUI_SW_PARENTS, - MEWUI_SW_CLONES, - MEWUI_SW_YEARS, - MEWUI_SW_PUBLISHERS, - MEWUI_SW_SUPPORTED, - MEWUI_SW_PARTIAL_SUPPORTED, - MEWUI_SW_UNSUPPORTED, - MEWUI_SW_REGION, - MEWUI_SW_TYPE, - MEWUI_SW_LIST, - MEWUI_SW_CUSTOM, - MEWUI_SW_LAST = MEWUI_SW_CUSTOM + UI_SW_FIRST = 0, + UI_SW_ALL = UI_SW_FIRST, + UI_SW_AVAILABLE, + UI_SW_UNAVAILABLE, + UI_SW_PARENTS, + UI_SW_CLONES, + UI_SW_YEARS, + UI_SW_PUBLISHERS, + UI_SW_SUPPORTED, + UI_SW_PARTIAL_SUPPORTED, + UI_SW_UNSUPPORTED, + UI_SW_REGION, + UI_SW_TYPE, + UI_SW_LIST, + UI_SW_CUSTOM, + UI_SW_LAST = UI_SW_CUSTOM }; enum @@ -146,7 +146,7 @@ enum HOVER_FILTER_FIRST, HOVER_FILTER_LAST = (HOVER_FILTER_FIRST) + 1 + FILTER_LAST, HOVER_SW_FILTER_FIRST, - HOVER_SW_FILTER_LAST = (HOVER_SW_FILTER_FIRST) + 1 + MEWUI_SW_LAST, + HOVER_SW_FILTER_LAST = (HOVER_SW_FILTER_FIRST) + 1 + UI_SW_LAST, HOVER_RP_FIRST, HOVER_RP_LAST = (HOVER_RP_FIRST) + 1 + RP_LAST }; -- cgit v1.2.3-70-g09d2 From 3ebf7e64fc546ef96b446cc586010cc028008211 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 4 Feb 2016 16:18:55 +0100 Subject: fixed system dependent UI (nw) --- scripts/src/emu.lua | 12 ++++++++++++ src/emu/ui/custui.cpp | 10 +++++----- src/emu/ui/custui.h | 4 ++-- src/emu/ui/dsplmenu.cpp | 8 ++++---- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index 1b7492c1760..8043384a5a2 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -38,6 +38,18 @@ if _OPTIONS["with-bundled-lua"] then } end +if (_OPTIONS["targetos"] == "windows") then + defines { + "UI_WINDOWS", + } +end + +if (_OPTIONS["osd"] == "sdl") then + defines { + "UI_SDL", + } +end + files { MAME_DIR .. "src/emu/emu.h", MAME_DIR .. "src/emu/gamedrv.h", diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index 47d983d5ef4..70176cf4708 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -141,7 +141,7 @@ void ui_menu_custom_ui::custom_render(void *selectedref, float top, float bottom ui_menu_font_ui::ui_menu_font_ui(running_machine &machine, render_container *container) : ui_menu(machine, container) { emu_options &moptions = machine.options(); -#ifdef OSD_WINDOWS +#ifdef UI_WINDOWS std::string name(moptions.ui_font()); list(); @@ -180,7 +180,7 @@ ui_menu_font_ui::ui_menu_font_ui(running_machine &machine, render_container *con } -#ifdef OSD_WINDOWS +#ifdef UI_WINDOWS //------------------------------------------------- // fonts enumerator CALLBACK //------------------------------------------------- @@ -227,7 +227,7 @@ ui_menu_font_ui::~ui_menu_font_ui() std::string error_string; emu_options &moptions = machine().options(); -#ifdef OSD_WINDOWS +#ifdef UI_WINDOWS std::string name(m_fonts[m_actual]); if (m_fonts[m_actual] != "default") { @@ -273,7 +273,7 @@ void ui_menu_font_ui::handle() } break; -#ifdef OSD_WINDOWS +#ifdef UI_WINDOWS case MUI_FNT: if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) @@ -313,7 +313,7 @@ void ui_menu_font_ui::populate() UINT32 arrow_flags; std::string tmptxt; -#ifdef OSD_WINDOWS +#ifdef UI_WINDOWS // add fonts option arrow_flags = get_arrow_flags(0, m_fonts.size() - 1, m_actual); std::string name(m_fonts[m_actual]); diff --git a/src/emu/ui/custui.h b/src/emu/ui/custui.h index 0c453340c18..79f45cc3a6e 100644 --- a/src/emu/ui/custui.h +++ b/src/emu/ui/custui.h @@ -13,7 +13,7 @@ #ifndef __UI_CUSTUI_H__ #define __UI_CUSTUI_H__ -#ifdef OSD_WINDOWS +#ifdef UI_WINDOWS #define WIN32_LEAN_AND_MEAN #include #endif @@ -64,7 +64,7 @@ private: MUI_ITALIC }; -#ifdef OSD_WINDOWS +#ifdef UI_WINDOWS UINT16 m_actual; std::vector m_fonts; bool m_bold, m_italic; diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp index 88edd6466e7..a1907b89d51 100644 --- a/src/emu/ui/dsplmenu.cpp +++ b/src/emu/ui/dsplmenu.cpp @@ -15,7 +15,7 @@ #include "ui/selector.h" #include "ui/utils.h" -#if defined(OSD_WINDOWS) && !defined(OSD_SDL) +#if defined(UI_WINDOWS) && !defined(UI_SDL) #include "../osd/windows/winmain.h" #else #include "../osd/modules/lib/osdobj_common.h" @@ -24,7 +24,7 @@ ui_menu_display_options::video_modes ui_menu_display_options::m_video[] = { { "auto", "Auto" }, { "opengl", "OpenGL" }, -#if defined(OSD_WINDOWS) && !defined(OSD_SDL) +#if defined(UI_WINDOWS) && !defined(UI_SDL) { "d3d", "Direct3D" }, { "gdi", "GDI" }, { "ddraw", "DirectDraw" } @@ -37,7 +37,7 @@ ui_menu_display_options::video_modes ui_menu_display_options::m_video[] = { ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = { { 0, nullptr, nullptr }, { 0, "Video Mode", OSDOPTION_VIDEO }, -#if defined(OSD_WINDOWS) && !defined(OSD_SDL) +#if defined(UI_WINDOWS) && !defined(UI_SDL) { 0, "Hardware Stretch", WINOPTION_HWSTRETCH }, { 0, "Triple Buffering", WINOPTION_TRIPLEBUFFER }, { 0, "HLSL", WINOPTION_HLSL_ENABLE }, @@ -60,7 +60,7 @@ ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = { ui_menu_display_options::ui_menu_display_options(running_machine &machine, render_container *container) : ui_menu(machine, container) { -#if defined(OSD_WINDOWS) && !defined(OSD_SDL) +#if defined(UI_WINDOWS) && !defined(UI_SDL) windows_options &options = downcast(machine.options()); #else osd_options &options = downcast(machine.options()); -- cgit v1.2.3-70-g09d2 From edfa314f1db0639a85f8aae4d291652459c632c7 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 4 Feb 2016 16:30:43 +0100 Subject: put back select new game (nw) --- src/emu/ui/mainmenu.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp index 4021d419a7b..8891c7a6324 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/emu/ui/mainmenu.cpp @@ -185,12 +185,12 @@ void ui_menu_main::populate() item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - menu_text.assign("Quit from ").append(emulator_info::get_capstartgamenoun()); - item_append(menu_text.c_str(), nullptr, 0, (void *)QUIT_GAME); +// menu_text.assign("Quit from ").append(emulator_info::get_capstartgamenoun()); +// item_append(menu_text.c_str(), nullptr, 0, (void *)QUIT_GAME); /* add reset and exit menus */ -// strprintf(menu_text, "Select New %s", emulator_info::get_capstartgamenoun()); -// item_append(menu_text.c_str(), nullptr, 0, (void *)SELECT_GAME); + strprintf(menu_text, "Select New %s", emulator_info::get_capstartgamenoun()); + item_append(menu_text.c_str(), nullptr, 0, (void *)SELECT_GAME); } ui_menu_main::~ui_menu_main() @@ -283,9 +283,9 @@ void ui_menu_main::handle() ui_menu::stack_push(global_alloc_clear(machine(), container)); break; -// case SELECT_GAME: -// ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); -// break; + case SELECT_GAME: + ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); + break; case BIOS_SELECTION: ui_menu::stack_push(global_alloc_clear(machine(), container)); -- cgit v1.2.3-70-g09d2 From 1b48794d63828bda5c16354a76c1f94fe65c4ce6 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 4 Feb 2016 15:40:00 +0000 Subject: confirmed on a PCB that this is rev A --- src/mame/drivers/segac2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/segac2.cpp b/src/mame/drivers/segac2.cpp index 4c83e1fb618..86eb16efe5f 100644 --- a/src/mame/drivers/segac2.cpp +++ b/src/mame/drivers/segac2.cpp @@ -1962,8 +1962,8 @@ ROM_END ROM_START( potopoto ) /* Poto Poto (c)1994 Sega */ ROM_REGION( 0x200000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "epr-16662.ic32", 0x000000, 0x040000, CRC(bbd305d6) SHA1(1a4f4869fefac188c69bc67df0b625e43a0c3f1f) ) - ROM_LOAD16_BYTE( "epr-16661.ic31", 0x000001, 0x040000, CRC(5a7d14f4) SHA1(a615b5f481256366db7b1c6302a8dcb69708102b) ) + ROM_LOAD16_BYTE( "epr-16662a.ic32", 0x000000, 0x040000, CRC(bbd305d6) SHA1(1a4f4869fefac188c69bc67df0b625e43a0c3f1f) ) + ROM_LOAD16_BYTE( "epr-16661a.ic31", 0x000001, 0x040000, CRC(5a7d14f4) SHA1(a615b5f481256366db7b1c6302a8dcb69708102b) ) ROM_REGION( 0x040000, "upd", 0 ) ROM_LOAD( "epr-16660.ic4", 0x000000, 0x040000, CRC(8251c61c) SHA1(03eef3aa0bdde2c1d93128648f54fd69278d85dd) ) @@ -2506,7 +2506,7 @@ GAME( 1992, wwmarine, 0, segac2, wwmarine, segac2_state, bloxeedc, ROT0, // not really sure how this should hook up, things like the 'sold out' flags could be mechanical sensors, or from another MCU / CPU board in the actual popcorn part of the machine? GAME( 1993, sonicpop, 0, segac2, sonicpop, segac2_state, bloxeedc, ROT0, "Sega", "SegaSonic Popcorn Shop (Rev B)", MACHINE_MECHANICAL ) // region DSW for USA / Export / Japan, still speaks Japanese tho. 'Mechanical' part isn't emulated -GAME( 1994, potopoto, 0, segac2, potopoto, segac2_state, potopoto, ROT0, "Sega", "Poto Poto (Japan)", 0 ) +GAME( 1994, potopoto, 0, segac2, potopoto, segac2_state, potopoto, ROT0, "Sega", "Poto Poto (Japan, Rev A)", 0 ) GAME( 1994, stkclmns, 0, segac2, stkclmns, segac2_state, stkclmns, ROT0, "Sega", "Stack Columns (World)", 0 ) GAME( 1994, stkclmnsj, stkclmns, segac2, stkclmns, segac2_state, stkclmnj, ROT0, "Sega", "Stack Columns (Japan)", 0 ) -- cgit v1.2.3-70-g09d2 From e5dde745c407a0be47e581c867947ff19fb9967e Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 4 Feb 2016 15:50:39 +0000 Subject: change default (nw) --- src/emu/emuopts.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 94f91fe1ca3..d67e99997cc 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -181,7 +181,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_SKIP_GAMEINFO, "0", OPTION_BOOLEAN, "skip displaying the information screen at startup" }, { OPTION_UI_FONT, "default", OPTION_STRING, "specify a font to use" }, { OPTION_RAMSIZE ";ram", nullptr, OPTION_STRING, "size of RAM (if supported by driver)" }, - { OPTION_CONFIRM_QUIT, "1", OPTION_BOOLEAN, "display confirm quit screen on exit" }, + { OPTION_CONFIRM_QUIT, "0", OPTION_BOOLEAN, "display confirm quit screen on exit" }, { OPTION_UI_MOUSE, "1", OPTION_BOOLEAN, "display ui mouse cursor" }, { OPTION_AUTOBOOT_COMMAND ";ab", nullptr, OPTION_STRING, "command to execute after machine boot" }, { OPTION_AUTOBOOT_DELAY, "2", OPTION_INTEGER, "timer delay in sec to trigger command execution on autoboot" }, -- cgit v1.2.3-70-g09d2 From f6c90a7c052fbbde9201b8bb7b114290edadbf1a Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 4 Feb 2016 20:35:06 +0100 Subject: tb303/tr606: simplified interrupt timing --- src/mame/drivers/tb303.cpp | 42 ++++++++++-------------------------------- src/mame/drivers/tr606.cpp | 43 +++++++++++-------------------------------- 2 files changed, 21 insertions(+), 64 deletions(-) diff --git a/src/mame/drivers/tb303.cpp b/src/mame/drivers/tb303.cpp index e0f4e4798c9..41b5f648a02 100644 --- a/src/mame/drivers/tb303.cpp +++ b/src/mame/drivers/tb303.cpp @@ -23,12 +23,9 @@ class tb303_state : public hh_ucom4_state { public: tb303_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag), - m_tp3_off_timer(*this, "tp3_off") + : hh_ucom4_state(mconfig, type, tag) { } - required_device m_tp3_off_timer; - UINT8 m_ram[0xc00]; UINT16 m_ram_address; bool m_ram_ce; @@ -43,37 +40,18 @@ public: DECLARE_READ8_MEMBER(input_r); void update_leds(); - TIMER_DEVICE_CALLBACK_MEMBER(tp3_clock); - TIMER_DEVICE_CALLBACK_MEMBER(tp3_off); + TIMER_DEVICE_CALLBACK_MEMBER(tp3_clock) { m_maincpu->set_input_line(0, ASSERT_LINE); } + TIMER_DEVICE_CALLBACK_MEMBER(tp3_clear) { m_maincpu->set_input_line(0, CLEAR_LINE); } virtual void machine_start() override; }; - -/*************************************************************************** - - Timer/Interrupt - -***************************************************************************/ - // TP2 to MCU CLK: LC circuit(TI S74230), stable sine wave, 2.2us interval -#define TP2_CLOCK_HZ 454545 /* in hz */ +#define TP2_HZ 454545 // TP3 to MCU _INT: square wave, 1.8ms interval, short duty cycle -#define TP3_CLOCK attotime::from_usec(1800) -#define TP3_OFF (TP3_CLOCK / 8) - -TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::tp3_off) -{ - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::tp3_clock) -{ - m_maincpu->set_input_line(0, ASSERT_LINE); - m_tp3_off_timer->adjust(TP3_OFF); -} - +#define TP3_PERIOD attotime::from_usec(1800) +#define TP3_LOW (TP3_PERIOD / 8) /*************************************************************************** @@ -270,7 +248,7 @@ void tb303_state::machine_start() static MACHINE_CONFIG_START( tb303, tb303_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D650, TP2_CLOCK_HZ) + MCFG_CPU_ADD("maincpu", NEC_D650, TP2_HZ) MCFG_UCOM4_READ_A_CB(READ8(tb303_state, input_r)) MCFG_UCOM4_READ_B_CB(READ8(tb303_state, input_r)) MCFG_UCOM4_READ_C_CB(READ8(tb303_state, ram_r)) @@ -282,9 +260,9 @@ static MACHINE_CONFIG_START( tb303, tb303_state ) MCFG_UCOM4_WRITE_H_CB(WRITE8(tb303_state, switch_w)) MCFG_UCOM4_WRITE_I_CB(WRITE8(tb303_state, strobe_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clock", tb303_state, tp3_clock, TP3_CLOCK) - MCFG_TIMER_START_DELAY(TP3_CLOCK) - MCFG_TIMER_DRIVER_ADD("tp3_off", tb303_state, tp3_off) + MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clock", tb303_state, tp3_clock, TP3_PERIOD) + MCFG_TIMER_START_DELAY(TP3_PERIOD - TP3_LOW) + MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clear", tb303_state, tp3_clear, TP3_PERIOD) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_tb303) diff --git a/src/mame/drivers/tr606.cpp b/src/mame/drivers/tr606.cpp index 3842cb0f875..4fd0e50141e 100644 --- a/src/mame/drivers/tr606.cpp +++ b/src/mame/drivers/tr606.cpp @@ -23,43 +23,22 @@ class tr606_state : public hh_ucom4_state { public: tr606_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag), - m_tp3_off_timer(*this, "tp3_off") + : hh_ucom4_state(mconfig, type, tag) { } - required_device m_tp3_off_timer; - - TIMER_DEVICE_CALLBACK_MEMBER(tp3_clock); - TIMER_DEVICE_CALLBACK_MEMBER(tp3_off); + TIMER_DEVICE_CALLBACK_MEMBER(tp3_clock) { m_maincpu->set_input_line(0, ASSERT_LINE); } + TIMER_DEVICE_CALLBACK_MEMBER(tp3_clear) { m_maincpu->set_input_line(0, CLEAR_LINE); } virtual void machine_start() override; }; - -/*************************************************************************** - - Timer/Interrupt - -***************************************************************************/ - // TP2 to MCU CLK: LC circuit(TI S74230), stable sine wave, 2.2us interval -#define TP2_CLOCK_HZ 454545 /* in hz */ +#define TP2_HZ 454545 +// MCU interrupt timing is same as in TB303 // TP3 to MCU _INT: square wave, 1.8ms interval, short duty cycle -#define TP3_CLOCK attotime::from_usec(1800) -#define TP3_OFF (TP3_CLOCK / 8) - -TIMER_DEVICE_CALLBACK_MEMBER(tr606_state::tp3_off) -{ - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -TIMER_DEVICE_CALLBACK_MEMBER(tr606_state::tp3_clock) -{ - m_maincpu->set_input_line(0, ASSERT_LINE); - m_tp3_off_timer->adjust(TP3_OFF); -} - +#define TP3_PERIOD attotime::from_usec(1800) +#define TP3_LOW (TP3_PERIOD / 8) /*************************************************************************** @@ -100,11 +79,11 @@ void tr606_state::machine_start() static MACHINE_CONFIG_START( tr606, tr606_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D650, TP2_CLOCK_HZ) + MCFG_CPU_ADD("maincpu", NEC_D650, TP2_HZ) - MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clock", tr606_state, tp3_clock, TP3_CLOCK) - MCFG_TIMER_START_DELAY(TP3_CLOCK) - MCFG_TIMER_DRIVER_ADD("tp3_off", tr606_state, tp3_off) + MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clock", tr606_state, tp3_clock, TP3_PERIOD) + MCFG_TIMER_START_DELAY(TP3_PERIOD - TP3_LOW) + MCFG_TIMER_DRIVER_ADD_PERIODIC("tp3_clear", tr606_state, tp3_clear, TP3_PERIOD) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_tr606) -- cgit v1.2.3-70-g09d2 From 33937a4a4cde90be0d9c2a03eb0d042500cc0564 Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 4 Feb 2016 21:12:19 +0100 Subject: ui: orange mousecursor regrew with mewUI merge, let's re-shrink it --- src/emu/ui/ui.cpp | 9 +++++---- src/mame/drivers/fidelz80.cpp | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 93d100196ee..a20da75a68e 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -473,6 +473,7 @@ void ui_manager::update_and_render(render_container *container) else m_popup_text_end = 0; + // display the internal mouse cursor if (m_mouse_show || (is_menu_active() && machine().options().ui_mouse())) { INT32 mouse_target_x, mouse_target_y; @@ -482,10 +483,10 @@ void ui_manager::update_and_render(render_container *container) if (mouse_target != nullptr) { float mouse_y=-1,mouse_x=-1; - if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y)) { - float l_heigth = machine().ui().get_line_height(); - container->add_quad(mouse_x, mouse_y, mouse_x + l_heigth*container->manager().ui_aspect(container), mouse_y + l_heigth, UI_TEXT_COLOR, m_mouse_arrow_texture, PRIMFLAG_ANTIALIAS(1) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); - + if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y)) + { + const float cursor_size = 0.6 * machine().ui().get_line_height(); + container->add_quad(mouse_x, mouse_y, mouse_x + cursor_size*container->manager().ui_aspect(container), mouse_y + cursor_size, UI_TEXT_COLOR, m_mouse_arrow_texture, PRIMFLAG_ANTIALIAS(1) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); } } } diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 2abfab37c8d..bb963922a24 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -189,6 +189,7 @@ Chess Challenger 7 (BCC) RE information from netlist by Berger Zilog Z80A, 3.579MHz from XTAL +Z80 IRQ/NMI unused, no timer IC. This is a cost-reduced design from CC10, no special I/O chips. Memory map: -- cgit v1.2.3-70-g09d2 From 538fa63433294d47a93647ace4b96b2ba1316395 Mon Sep 17 00:00:00 2001 From: Justin Kerk Date: Thu, 4 Feb 2016 12:25:10 -0800 Subject: Allow dat files in the root by default, like the old days (nw) --- src/emu/ui/moptions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emu/ui/moptions.cpp b/src/emu/ui/moptions.cpp index cae3582747c..5dfdfde43c3 100644 --- a/src/emu/ui/moptions.cpp +++ b/src/emu/ui/moptions.cpp @@ -20,7 +20,7 @@ const options_entry ui_options::s_option_entries[] = { // seach path options { nullptr, nullptr, OPTION_HEADER, "UI SEARCH PATH OPTIONS" }, - { OPTION_HISTORY_PATH, "history;dats", OPTION_STRING, "path to history files" }, + { OPTION_HISTORY_PATH, "history;dats;.", OPTION_STRING, "path to history files" }, { OPTION_EXTRAINI_PATH, "folders", OPTION_STRING, "path to extra ini files" }, { OPTION_CABINETS_PATH, "cabinets;cabdevs", OPTION_STRING, "path to cabinets / devices image" }, { OPTION_CPANELS_PATH, "cpanel", OPTION_STRING, "path to control panel image" }, -- cgit v1.2.3-70-g09d2 From b22a19a1cc3305ce109425ca5a6eaa6cac3c5cf6 Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 4 Feb 2016 21:48:01 +0100 Subject: Assume bad ROM, nw --- src/mame/drivers/nightgal.cpp | 48 +++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 0afd405d947..38a069c7885 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -6,36 +6,16 @@ Night Gal (c) 1984 Nichibutsu a.k.a. same Jangou blitter but with NCS CPU for displaying graphics as protection. -preliminary driver by David Haywood & Angelo Salese +driver by David Haywood & Angelo Salese many thanks to Charles MacDonald for the schematics / documentation of this HW. TODO: --Night Gal Summer trips illegal opcodes on the NCS side, presumably a CPU bug; --Fix Sweet Gal/Sexy Gal gfxs if necessary (i.e. if the bugs aren't all caused by irq/nmi - wrong firing); --Proper Z80<->MCU comms,many video problems because of that; --Abstract the video chip to a proper video file and get the name of that chip; --Minor graphic glitches in Royal Queen (cross hatch test, some little glitches during gameplay), - presumably due of the unemulated wait states on the comms. - - Notes: --Night Gal Summer accesses the blitter in a weird fashion, perhaps it fails the ROM check - due of address line encryption? - Example snippet: - 0 1 2 3 4 5 6 - RH XX YY WW HH DD - 70 00 40 80 07 06 00 x = 2 y = 3 srcl = 0 srch = 1 srcd = 6 - DD YY RH WW HH XX - 00 60 80 03 07 06 48 x = 6 y = 2 srcl = 1 srch = 3 srcd = 0 - XX DD RH WW HH YY - 50 00 04 28 07 06 80 x = 0 y = 6 srcl = 3 srch = 2 srcd = 1 - YY XX DD WW HH RH - 80 58 10 00 07 06 03 x = 1 y = 0 srcl = 2 srch = 6 srcd = 3 - RH YY DD XX WW HH - 02 80 00 68 07 06 a0 x = 3 y = 1 srcl = 6 srch = 0 srcd = 2 - .. .. .. .. .. - - 48 03 78 80 07 06 00 (again) + - Night Gal Summer trips illegal opcodes on the NCS side, needs to check if bit-rotted or encrypted ROM; + - Fix Sweet Gal/Sexy Gal gfxs if necessary (i.e. if the bugs aren't all caused by irq/nmi wrong firing); + - unemulated WAIT pin for Z80, MCU asserts it when accessing communication RAM + - Abstract the video chip to a proper video file and get the name of that chip; + - Minor graphic glitches in Royal Queen (cross hatch test, some little glitches during gameplay), + presumably due of the unemulated wait states on the comms. *******************************************************************************************/ @@ -1242,7 +1222,7 @@ ROM_START( ngalsumr ) ROM_LOAD( "10.3v", 0x04000, 0x02000, CRC(31211088) SHA1(960b781c420602be3de66565a030cf5ebdcc2ffb) ) ROM_REGION( 0x10000, "sub", 0 ) - ROM_LOAD( "7.3p", 0x0c000, 0x02000, CRC(20c55a25) SHA1(9dc88cb6c016b594264f7272d4fd5f30567e7c5d) ) + ROM_LOAD( "7.3p", 0x0c000, 0x02000, BAD_DUMP CRC(20c55a25) SHA1(9dc88cb6c016b594264f7272d4fd5f30567e7c5d) ) // either encrypted or bit-rotted. ROM_REGION( 0xc000, "samples", 0 ) ROM_LOAD( "1s.ic7", 0x00000, 0x04000, CRC(47ad8a0f) SHA1(e3b1e13f0a5c613bd205338683bef8d005b54830) ) @@ -1274,9 +1254,15 @@ DRIVER_INIT_MEMBER(nightgal_state,ngalsumr) { UINT8 *ROM = memregion("sub")->base(); - /* patch protection */ - ROM[0xd6ce] = 0x02; - ROM[0xd6cf] = 0x02; + /* patch blantantly wrong ROM checks */ + //ROM[0xd6ce] = 0x02; + //ROM[0xd6cf] = 0x02; + // adcx $05 converted to 0x04 for debug purposes + ROM[0xd782] = 0x04; + //ROM[0xd655] = 0x20; + //ROM[0xd3f9] = 0x02; + //ROM[0xd3fa] = 0x02; + //ROM[0xd3a0] = 0x02; } /* Type 1 HW */ -- cgit v1.2.3-70-g09d2 From 19f783a5711aa261ae3e056c2f68654131ba27f0 Mon Sep 17 00:00:00 2001 From: Jean-François DEL NERO Date: Thu, 4 Feb 2016 21:51:39 +0100 Subject: New video chip support : Thomson EF9364 / Sescosem SFF96364 --- scripts/target/mame/arcade.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index ec89d9d69db..87a6010756a 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -276,6 +276,7 @@ VIDEOS["BUFSPRITE"] = true VIDEOS["DM9368"] = true --VIDEOS["EF9340_1"] = true --VIDEOS["EF9345"] = true +--VIDEOS["EF9364"] = true --VIDEOS["EF9365"] = true --VIDEOS["GF4500"] = true VIDEOS["GF7600GS"] = true -- cgit v1.2.3-70-g09d2 From 0b943844d06a17b1ec98a942b30d3e51e02cc865 Mon Sep 17 00:00:00 2001 From: Jean-François DEL NERO Date: Thu, 4 Feb 2016 21:53:55 +0100 Subject: New machine driver : SMT Goupil G1 --- scripts/target/mame/mess.lua | 2 + src/mame/drivers/goupil.cpp | 512 +++++++++++++++++++++++++++++++++++++++++++ src/mame/mess.lst | 1 + 3 files changed, 515 insertions(+) create mode 100644 src/mame/drivers/goupil.cpp diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 3c2ec4884e9..4e1d12abc2f 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -274,6 +274,7 @@ VIDEOS["DL1416"] = true VIDEOS["DM9368"] = true VIDEOS["EF9340_1"] = true VIDEOS["EF9345"] = true +VIDEOS["EF9364"] = true VIDEOS["EF9365"] = true VIDEOS["GF4500"] = true --VIDEOS+= EPIC12"] = true @@ -3082,6 +3083,7 @@ files { MAME_DIR .. "src/mame/audio/gamate.cpp", MAME_DIR .. "src/mame/drivers/gameking.cpp", MAME_DIR .. "src/mame/drivers/gimix.cpp", + MAME_DIR .. "src/mame/drivers/goupil.cpp", MAME_DIR .. "src/mame/drivers/grfd2301.cpp", MAME_DIR .. "src/mame/drivers/harriet.cpp", MAME_DIR .. "src/mame/drivers/hprot1.cpp", diff --git a/src/mame/drivers/goupil.cpp b/src/mame/drivers/goupil.cpp new file mode 100644 index 00000000000..791bb991042 --- /dev/null +++ b/src/mame/drivers/goupil.cpp @@ -0,0 +1,512 @@ +// license:BSD-3-Clause +// copyright-holders:Jean-Franois DEL NERO +/*************************************************************************** + + SMT Goupil G1 driver + + Current state : + + -> CPU / ROM / RAM working + -> Video output working + -> Keyboard support working (need to be polished... ) + -> Floppy FDC not fully implemented. + -> Sound support missing. + + Software : + -> The Monitor is working + -> The internal Basic is working (-> 6800 0xC3 illegal opcode emulation needed). + + 02/04/2016 + Jean-Franois DEL NERO + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "machine/6522via.h" +#include "machine/i8279.h" +#include "video/ef9364.h" +#include "video/mc6845.h" +#include "machine/6850acia.h" +#include "machine/wd_fdc.h" + +#include "softlist.h" + +#define MAIN_CLOCK XTAL_4MHz +#define VIDEO_CLOCK MAIN_CLOCK / 8 /* 1.75 Mhz */ +#define CPU_CLOCK MAIN_CLOCK / 4 /* 1 Mhz */ + +class goupil_g1_state : public driver_device +{ +public: + goupil_g1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_acia(*this, "ef6850") + , m_ef9364(*this, "ef9364") + , m_maincpu(*this, "maincpu") + , m_via_video(*this, "m_via_video") + , m_via_keyb(*this, "m_via_keyb") + , m_via_modem(*this, "m_via_modem") + , m_fdc(*this, "fd1791") + , m_floppy0(*this, "fd1791:0") + , m_floppy1(*this, "fd1791:1") + , m_floppy(NULL) + { } + + DECLARE_WRITE8_MEMBER(via_video_pba_w); + DECLARE_WRITE8_MEMBER(via_video_pbb_w); + DECLARE_WRITE_LINE_MEMBER(via_video_ca2_w); + + DECLARE_READ8_MEMBER(kbd1_r); + DECLARE_READ8_MEMBER(kbd2_r); + DECLARE_READ8_MEMBER(shift_kb1_r); + DECLARE_READ8_MEMBER(shift_kb2_r); + DECLARE_READ8_MEMBER(ctrl_kb1_r); + DECLARE_READ8_MEMBER(ctrl_kb2_r); + + DECLARE_WRITE8_MEMBER(scanlines_kbd1_w); + DECLARE_WRITE8_MEMBER(scanlines_kbd2_w); + + DECLARE_READ_LINE_MEMBER(via_keyb_ca2_r); + + virtual void machine_start() override; + virtual void machine_reset() override; + + UINT8 m_row_kbd1; + UINT8 m_row_kbd2; + int old_state_ca2; + UINT8 via_video_pbb_data; + UINT8 cnttim; + UINT8 valkeyb; + TIMER_DEVICE_CALLBACK_MEMBER(goupil_scanline); + +private: + required_device m_acia; + required_device m_ef9364; + required_device m_maincpu; + required_device m_via_video; + required_device m_via_keyb; + required_device m_via_modem; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + floppy_image_device *m_floppy; +}; + +/********************************** +* Floppy controller I/O Handlers * +***********************************/ +// TODO + +/********************************** +* Keyboard I/O Handlers * +***********************************/ + +TIMER_DEVICE_CALLBACK_MEMBER( goupil_g1_state::goupil_scanline ) +{ + m_ef9364->update_scanline((UINT16)param); +} + +static ADDRESS_MAP_START(goupil_mem, AS_PROGRAM, 8, goupil_g1_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000,0x3fff) AM_RAM + AM_RANGE(0x4000,0x7fff) AM_RAM + AM_RANGE(0xC000,0xE3FF) AM_ROM AM_REGION("maincpu", 0x1000) // Basic ROM (BASIC 1 up to BASIC 9). + + AM_RANGE(0xe400,0xe7ff) AM_RAM + AM_RANGE(0xE800,0xE80F) AM_DEVREADWRITE("ef6850", acia6850_device, data_r, data_w) + AM_RANGE(0xE810,0xE81F) AM_DEVREADWRITE("m_via_video", via6522_device, read, write) + + AM_RANGE(0xE820,0xE820) AM_DEVREADWRITE("i8279_kb1", i8279_device, data_r, data_w ) + AM_RANGE(0xE821,0xE821) AM_DEVREADWRITE("i8279_kb1", i8279_device, status_r, cmd_w ) + + AM_RANGE(0xE830,0xE830) AM_DEVREADWRITE("i8279_kb2", i8279_device, data_r, data_w ) + AM_RANGE(0xE831,0xE831) AM_DEVREADWRITE("i8279_kb2", i8279_device, status_r, cmd_w ) + + AM_RANGE(0xE840,0xE84F) AM_DEVREADWRITE("m_via_keyb", via6522_device, read, write) + + AM_RANGE(0xE860,0xE86F) AM_DEVREADWRITE("m_via_modem", via6522_device, read, write) + + AM_RANGE(0xe8f0,0xe8ff) AM_DEVREADWRITE("fd1791", fd1791_t, read, write) + //AM_RANGE(0xf08a,0xf08a) AM_READWRITE( fdc_sel0_r, fdc_sel0_w ) + //AM_RANGE(0xf08b,0xf08b) AM_READWRITE( fdc_sel1_r, fdc_sel1_w ) + + AM_RANGE(0xf400,0xf7ff) AM_ROM AM_REGION("maincpu", 0x0800) // Modem (MOD 3) + AM_RANGE(0xf800,0xffff) AM_ROM AM_REGION("maincpu", 0x0000) // Monitor (MON 1 + MON 2) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( goupil_io, AS_IO, 8, goupil_g1_state) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +WRITE8_MEMBER( goupil_g1_state::scanlines_kbd1_w ) +{ + m_row_kbd1 = data; +} + +READ8_MEMBER( goupil_g1_state::ctrl_kb1_r ) +{ + char kbdrow[6]; + unsigned char data; + + kbdrow[0] = 'C'; + kbdrow[1] = 'T'; + kbdrow[2] = 'R'; + kbdrow[3] = '0'; + kbdrow[4] = 0; + + data = ioport(kbdrow)->read(); + if( data & 0x02 ) + return 1; + else + return 0; +} + +READ8_MEMBER( goupil_g1_state::ctrl_kb2_r ) +{ + return 1; +} + +READ8_MEMBER( goupil_g1_state::shift_kb1_r ) +{ + char kbdrow[6]; + unsigned char data; + + kbdrow[0] = 'C'; + kbdrow[1] = 'T'; + kbdrow[2] = 'R'; + kbdrow[3] = '0'; + kbdrow[4] = 0; + + data = ioport(kbdrow)->read(); + if( data & 0x01 ) + return 1; + else + return 0; +} + +READ8_MEMBER( goupil_g1_state::shift_kb2_r ) +{ + return 1; +} + +READ8_MEMBER( goupil_g1_state::kbd1_r ) +{ + char kbdrow[6]; + UINT8 data = 0xff; + + kbdrow[0] = 'A'; + kbdrow[1] = 'X'; + kbdrow[2] = '0' + ( m_row_kbd1 & 7 ) ; + kbdrow[3] = 0; + + data = ioport(kbdrow)->read(); + + return data; +} + +WRITE8_MEMBER( goupil_g1_state::scanlines_kbd2_w ) +{ + m_row_kbd2 = data & 7; +} + +READ_LINE_MEMBER( goupil_g1_state::via_keyb_ca2_r ) +{ + return 0; +} + +READ8_MEMBER( goupil_g1_state::kbd2_r ) +{ + char kbdrow[6]; + UINT8 data = 0xff; + + kbdrow[0] = 'B'; + kbdrow[1] = 'X'; + kbdrow[2] = '0' + ( m_row_kbd2 & 7 ) ; + kbdrow[3] = 0; + + data = ioport(kbdrow)->read(); + + return data; +} + +/* Input ports */ +static INPUT_PORTS_START( goupil_g1 ) + PORT_START("AX0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_START("AX1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_START("AX2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_START("AX3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) + PORT_START("AX4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR(':') PORT_CHAR('/') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('.') + PORT_START("AX5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_START("AX6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00F9) PORT_CHAR('%') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_START("AX7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("CTR0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START("BX0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("BX1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("BX2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("BX3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_START("BX4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("BX5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("BX6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_START("BX7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') +INPUT_PORTS_END + +static SLOT_INTERFACE_START( goupil_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +void goupil_g1_state::machine_start() +{ + std::string region_tag; + + m_floppy = NULL; + valkeyb = 0xFF; +} + +void goupil_g1_state::machine_reset() +{ +} + +WRITE8_MEMBER(goupil_g1_state::via_video_pba_w) +{ + #ifdef DBGMODE + printf("%s: write via_video_pba_w reg : 0x%X\n",machine().describe_context(),data); + #endif + m_ef9364->char_latch_w(data); +} + +WRITE8_MEMBER(goupil_g1_state::via_video_pbb_w) +{ + #ifdef DBGMODE + printf("%s: write via_video_pbb_w reg : 0x%X\n",machine().describe_context(),data); + #endif + via_video_pbb_data = data; +} + +WRITE_LINE_MEMBER( goupil_g1_state::via_video_ca2_w ) +{ + if(old_state_ca2==0 and state==1) + { + m_ef9364->command_w(via_video_pbb_data&0xF); + } + old_state_ca2 = state; +} + +static MACHINE_CONFIG_START( goupil_g1, goupil_g1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6808, CPU_CLOCK) + MCFG_CPU_PROGRAM_MAP(goupil_mem) + MCFG_CPU_IO_MAP(goupil_io) + + /* sound hardware */ + // TODO ! + + MCFG_DEVICE_ADD ("ef6850", ACIA6850, 0) + + /* screen */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_UPDATE_DEVICE("ef9364", ef9364_device, screen_update) + + MCFG_SCREEN_SIZE((64*8), (16*(8+4))) + MCFG_SCREEN_VISIBLE_AREA(0, (64*8)-1, 0, (16*(8+4))-1) + MCFG_PALETTE_ADD("palette", 16) + + MCFG_DEVICE_ADD("ef9364", EF9364, VIDEO_CLOCK) + MCFG_EF9364_PALETTE("palette") + MCFG_EF9364_PAGES_CNT(1); + MCFG_TIMER_DRIVER_ADD_SCANLINE("goupil_sl", goupil_g1_state, goupil_scanline, "screen", 0, 10) + + MCFG_DEVICE_ADD("m_via_video", VIA6522, 0) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(goupil_g1_state, via_video_pba_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(goupil_g1_state, via_video_pbb_w)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(goupil_g1_state, via_video_ca2_w)) + + MCFG_DEVICE_ADD("m_via_keyb", VIA6522, 0) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6808_cpu_device, irq_line)) + + MCFG_DEVICE_ADD("m_via_modem", VIA6522, 0) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6808_cpu_device, irq_line)) + + /* Floppy */ + MCFG_FD1791_ADD("fd1791", XTAL_8MHz ) + MCFG_FLOPPY_DRIVE_ADD("fd1791:0", goupil_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd1791:1", goupil_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_SOFTWARE_LIST_ADD("flop525_list", "goupil") + + MCFG_DEVICE_ADD("i8279_kb1", I8279, CPU_CLOCK) + MCFG_I8279_OUT_SL_CB(WRITE8(goupil_g1_state, scanlines_kbd1_w)) // scan SL lines + MCFG_I8279_IN_RL_CB(READ8(goupil_g1_state, kbd1_r)) // kbd RL lines + MCFG_I8279_IN_SHIFT_CB(READ8(goupil_g1_state, shift_kb1_r)) + MCFG_I8279_IN_CTRL_CB(READ8(goupil_g1_state, ctrl_kb1_r)) + MCFG_I8279_OUT_IRQ_CB(DEVWRITELINE("m_via_keyb", via6522_device, write_ca1)) + + MCFG_DEVICE_ADD("i8279_kb2", I8279, CPU_CLOCK) + MCFG_I8279_OUT_SL_CB(WRITE8(goupil_g1_state, scanlines_kbd2_w)) // scan SL lines + MCFG_I8279_IN_RL_CB(READ8(goupil_g1_state, kbd2_r)) // kbd RL lines + MCFG_I8279_IN_SHIFT_CB(READ8(goupil_g1_state, shift_kb2_r)) + MCFG_I8279_IN_CTRL_CB(READ8(goupil_g1_state, ctrl_kb2_r)) + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( goupilg1 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_DEFAULT_BIOS("v1_0") + + ROM_SYSTEM_BIOS(0, "v1_0", "Version 1.0") + ROMX_LOAD( "SMT_Goupil_G1_MON_1.bin", 0x0000, 0x0400, CRC(98B7BE69) SHA1(69E83FE78A43FCF2B08FB0BCEFB0D217A57B1ECB), ROM_BIOS(1) ) + ROM_LOAD ( "SMT_Goupil_G1_MON_2.bin", 0x0400, 0x0400, CRC(19386B81) SHA1(E52F63FD29D374319781E9677DE6D3FD61A3684C) ) + + ROM_LOAD( "SMT_Goupil_G1_MOD_3.bin", 0x0800, 0x0400, CRC(E662F152) SHA1(11B91C5737E7572A2C18472B66BBD16B485132D5) ) + + ROMX_LOAD( "SMT_Goupil_G1_Basic_1.bin", 0x1000, 0x0400, CRC(AD105B12) SHA1(631CD4B997F76B57BF2509E4BFF30B1595C8BD13), ROM_BIOS(1) ) + ROMX_LOAD( "SMT_Goupil_G1_Basic_2.bin", 0x1400, 0x0400, CRC(0C5C309C) SHA1(F1CAB4B0F9191E53113790A95F1AB7108F9406A1), ROM_BIOS(1) ) + ROMX_LOAD( "SMT_Goupil_G1_Basic_3.bin", 0x1800, 0x0400, CRC(1F1EB127) SHA1(DBBB880C79D515ACBFCB2BE9A4C96962F3E4EDEA), ROM_BIOS(1) ) + ROMX_LOAD( "SMT_Goupil_G1_Basic_4.bin", 0x1C00, 0x0400, CRC(09BE48E4) SHA1(86CAE0D159583C1D572A5754F3BB6B4A2E479359), ROM_BIOS(1) ) + ROMX_LOAD( "SMT_Goupil_G1_Basic_5.bin", 0x2000, 0x0400, CRC(BDEB395C) SHA1(32A50468F1CA772EE45A1F5C61C66F3ECC774074), ROM_BIOS(1) ) + ROMX_LOAD( "SMT_Goupil_G1_Basic_6.bin", 0x2400, 0x0400, CRC(850A4000) SHA1(720F0BB3E45877835219B7E1D943EF4F19B9977D), ROM_BIOS(1) ) + ROMX_LOAD( "SMT_Goupil_G1_Basic_7.bin", 0x2800, 0x0400, CRC(586C7670) SHA1(13E2E96B9F1A53555CE0D55F657CF3C6B96F10A0), ROM_BIOS(1) ) + ROMX_LOAD( "SMT_Goupil_G1_Basic_8.bin", 0x2C00, 0x0400, CRC(33281300) SHA1(CE631FA8157A3F8869C5FEFE24B7F40E06696DF9), ROM_BIOS(1) ) + ROMX_LOAD( "SMT_Goupil_G1_Basic_9.bin", 0x3000, 0x0400, CRC(A3911201) SHA1(8623A0A2D83EB3A27A795030643C5C05A4350A9F), ROM_BIOS(1) ) + + ROM_REGION( 0x400, "ef9364", 0 ) + ROM_LOAD( "SMT_Goupil_G1_Charset.bin", 0x0000, 0x0400, CRC(8B6DA54B) SHA1(AC2204600F45C6DD0DF1E759B62ED25928F02A12) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1979, goupilg1, 0, 0, goupil_g1, goupil_g1,driver_device, 0, "SMT", "Goupil G1", MACHINE_IS_SKELETON ) diff --git a/src/mame/mess.lst b/src/mame/mess.lst index b62f6b933e9..dc947d57d01 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2815,6 +2815,7 @@ hp_ipc lggp40 mt735 squale +goupilg1 micral rd100 proteus3 -- cgit v1.2.3-70-g09d2 From e8de5cb9d542591ef9048009f80131613d31ac3d Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 4 Feb 2016 23:05:06 +0100 Subject: z80.cpp: added a debug mechanism for /WAIT pin assertion mechanism (enable with STALLS_ON_WAIT_ASSERT in CPU core), and hooked it up to Night Gal driver as a quick example. [Angelo Salese] --- src/devices/cpu/z80/z80.cpp | 22 ++++++++++++++++++++++ src/mame/drivers/nightgal.cpp | 21 +++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp index 345ea4334bf..055e98ecdd7 100644 --- a/src/devices/cpu/z80/z80.cpp +++ b/src/devices/cpu/z80/z80.cpp @@ -113,6 +113,10 @@ #define VERBOSE 0 +/* Debug purpose: set to 1 to test /WAIT pin behaviour. + */ +#define STALLS_ON_WAIT_ASSERT 0 + /* On an NMOS Z80, if LD A,I or LD A,R is interrupted, P/V flag gets reset, even if IFF2 was set before this instruction. This issue was fixed on the CMOS Z80, so until knowing (most) Z80 types on hardware, it's disabled */ @@ -3478,6 +3482,7 @@ void nsc800_device::device_reset() ****************************************************************************/ void z80_device::execute_run() { + /* check for NMIs on the way in; they can only be set externally */ /* via timers, and can't be dynamically enabled, so it is safe */ /* to just check here */ @@ -3518,7 +3523,24 @@ void z80_device::execute_run() PRVPC = PCD; debugger_instruction_hook(this, PCD); m_r++; +#if STALLS_ON_WAIT_ASSERT + static int test_cycles; + + if(m_wait_state == ASSERT_LINE) + { + m_icount --; + test_cycles ++; + } + else + { + if(test_cycles != 0) + printf("stalls for %d z80 cycles\n",test_cycles); + test_cycles = 0; + EXEC(op,rop()); + } +#else EXEC(op,rop()); +#endif } while (m_icount > 0); } diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 38a069c7885..4ab807c8745 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -120,7 +120,9 @@ protected: required_ioport m_io_dswb; required_ioport m_io_dswc; required_device m_palette; - + void z80_wait_assert_cb(); + TIMER_CALLBACK_MEMBER( z80_wait_ack_cb ); + UINT8 nightgal_gfx_nibble( int niboffset ); void plot_nightgal_gfx_pixel( UINT8 pix, int x, int y ); }; @@ -420,13 +422,29 @@ READ8_MEMBER(nightgal_state::royalqn_nsc_blit_r) return m_blit_raw_data[offset]; } +TIMER_CALLBACK_MEMBER(nightgal_state::z80_wait_ack_cb) +{ + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); +} + +void nightgal_state::z80_wait_assert_cb() +{ + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + + // Note: cycles_to_attotime requires z80 context to work, calling for example m_subcpu as context gives a x4 cycle boost in z80 terms (reads execute_cycles_to_clocks() from NCS?) even if they runs at same speed basically. + // TODO: needs a getter that tells a given CPU how many cycles requires an executing opcode for the r/w operation, which stacks with wait state penalty for accessing this specific area. + machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(4), timer_expired_delegate(FUNC(nightgal_state::z80_wait_ack_cb),this)); +} + READ8_MEMBER(nightgal_state::royalqn_comm_r) { + z80_wait_assert_cb(); return (m_comms_ram[offset] & 0x80) | (0x7f); //bits 6-0 are undefined, presumably open bus } WRITE8_MEMBER(nightgal_state::royalqn_comm_w) { + z80_wait_assert_cb(); m_comms_ram[offset] = data & 0x80; } @@ -893,7 +911,6 @@ static MACHINE_CONFIG_START( royalqn, nightgal_state ) MCFG_QUANTUM_PERFECT_CPU("maincpu") - /* video hardware */ /* TODO: blitter clock is MASTER_CLOCK / 4, 320 x 264 pixels, 256 x 224 of visible area */ MCFG_SCREEN_ADD("screen", RASTER) -- cgit v1.2.3-70-g09d2 From 7750a1013553794662694ea8d7951acb145d11f0 Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 4 Feb 2016 17:10:53 -0500 Subject: Make octal flag part of address_space/address_space_config, not (illogically) device_execute_interface (nw) --- src/devices/cpu/alto2/alto2cpu.cpp | 4 +++- src/devices/cpu/i4004/i4004.cpp | 4 +++- src/devices/cpu/pdp1/pdp1.cpp | 2 +- src/devices/cpu/pdp1/tx0.cpp | 2 +- src/devices/cpu/t11/t11.cpp | 4 ++-- src/emu/debug/debugvw.cpp | 7 +------ src/emu/debug/debugvw.h | 2 -- src/emu/debug/dvdisasm.cpp | 10 +++++----- src/emu/diexec.cpp | 1 - src/emu/diexec.h | 2 -- src/emu/dimemory.cpp | 5 +++++ src/emu/machine.cpp | 5 ++++- src/emu/memory.cpp | 20 +++++--------------- src/emu/memory.h | 7 +++++-- 14 files changed, 35 insertions(+), 40 deletions(-) diff --git a/src/devices/cpu/alto2/alto2cpu.cpp b/src/devices/cpu/alto2/alto2cpu.cpp index a3538dee290..653f56949e5 100644 --- a/src/devices/cpu/alto2/alto2cpu.cpp +++ b/src/devices/cpu/alto2/alto2cpu.cpp @@ -204,7 +204,9 @@ alto2_cpu_device::alto2_cpu_device(const machine_config& mconfig, const char* ta m_ether_a49(nullptr), m_eth() { - m_is_octal = true; + m_ucode_config.m_is_octal = true; + m_const_config.m_is_octal = true; + m_iomem_config.m_is_octal = true; memset(m_task_mpc, 0x00, sizeof(m_task_mpc)); memset(m_task_next2, 0x00, sizeof(m_task_next2)); memset(m_r, 0x00, sizeof(m_r)); diff --git a/src/devices/cpu/i4004/i4004.cpp b/src/devices/cpu/i4004/i4004.cpp index d4ba8891260..371074238c9 100644 --- a/src/devices/cpu/i4004/i4004.cpp +++ b/src/devices/cpu/i4004/i4004.cpp @@ -30,7 +30,9 @@ i4004_cpu_device::i4004_cpu_device(const machine_config &mconfig, const char *ta , m_io_config("io", ENDIANNESS_LITTLE, 8, 6, 0) , m_data_config("data", ENDIANNESS_LITTLE, 8, 12, 0), m_A(0), m_C(0), m_TEST(0), m_flags(0), m_program(nullptr), m_direct(nullptr), m_data(nullptr), m_io(nullptr), m_icount(0), m_pc_pos(0), m_addr_mask(0) { - m_is_octal = true; + m_program_config.m_is_octal = true; + m_io_config.m_is_octal = true; + m_data_config.m_is_octal = true; } diff --git a/src/devices/cpu/pdp1/pdp1.cpp b/src/devices/cpu/pdp1/pdp1.cpp index cbb43535d7f..d7a9ad008fb 100644 --- a/src/devices/cpu/pdp1/pdp1.cpp +++ b/src/devices/cpu/pdp1/pdp1.cpp @@ -384,7 +384,7 @@ pdp1_device::pdp1_device(const machine_config &mconfig, const char *tag, device_ : cpu_device(mconfig, PDP1, "PDP1", tag, owner, clock, "pdp1_cpu", __FILE__) , m_program_config("program", ENDIANNESS_BIG, 32, 18, 0) { - m_is_octal = true; + m_program_config.m_is_octal = true; } diff --git a/src/devices/cpu/pdp1/tx0.cpp b/src/devices/cpu/pdp1/tx0.cpp index 3a4fd7f1fb1..8e5b41776a0 100644 --- a/src/devices/cpu/pdp1/tx0.cpp +++ b/src/devices/cpu/pdp1/tx0.cpp @@ -61,7 +61,7 @@ tx0_device::tx0_device(const machine_config &mconfig, device_type type, const ch , m_sel_handler(*this) , m_io_reset_callback(*this) { - m_is_octal = true; + m_program_config.m_is_octal = true; } tx0_8kw_device::tx0_8kw_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) diff --git a/src/devices/cpu/t11/t11.cpp b/src/devices/cpu/t11/t11.cpp index 72c2e80c91b..5e32e2081f5 100644 --- a/src/devices/cpu/t11/t11.cpp +++ b/src/devices/cpu/t11/t11.cpp @@ -49,7 +49,7 @@ t11_device::t11_device(const machine_config &mconfig, device_type type, const ch , m_program_config("program", ENDIANNESS_LITTLE, 16, 16, 0) , c_initial_mode(0) { - m_is_octal = true; + m_program_config.m_is_octal = true; memset(m_reg, 0x00, sizeof(m_reg)); memset(&m_psw, 0x00, sizeof(m_psw)); } @@ -59,7 +59,7 @@ t11_device::t11_device(const machine_config &mconfig, const char *tag, device_t , m_program_config("program", ENDIANNESS_LITTLE, 16, 16, 0) , c_initial_mode(0) { - m_is_octal = true; + m_program_config.m_is_octal = true; memset(m_reg, 0x00, sizeof(m_reg)); memset(&m_psw, 0x00, sizeof(m_psw)); } diff --git a/src/emu/debug/debugvw.cpp b/src/emu/debug/debugvw.cpp index 0fcf1f4b2fd..641a31b41f0 100644 --- a/src/emu/debug/debugvw.cpp +++ b/src/emu/debug/debugvw.cpp @@ -33,13 +33,8 @@ debug_view_source::debug_view_source(const char *name, device_t *device) : m_next(nullptr), m_name(name), - m_device(device), - m_is_octal(false) + m_device(device) { - device_execute_interface *intf; - if (device && device->interface(intf)) - m_is_octal = intf->is_octal(); - } diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h index 437e68d68f6..ab4c986172e 100644 --- a/src/emu/debug/debugvw.h +++ b/src/emu/debug/debugvw.h @@ -124,14 +124,12 @@ public: const char *name() const { return m_name.c_str(); } debug_view_source *next() const { return m_next; } device_t *device() const { return m_device; } - bool is_octal() const { return m_is_octal; } private: // internal state debug_view_source * m_next; // link to next item std::string m_name; // name of the source item device_t * m_device; // associated device (if applicable) - bool m_is_octal; // is view in octal or hex }; diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp index e8becd1954d..9b05345b6ff 100644 --- a/src/emu/debug/dvdisasm.cpp +++ b/src/emu/debug/dvdisasm.cpp @@ -308,16 +308,16 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs) void debug_view_disasm::generate_bytes(offs_t pcbyte, int numbytes, int minbytes, char *string, int maxchars, bool encrypted) { const debug_view_disasm_source &source = downcast(*m_source); - int char_num = source.is_octal() ? 3 : 2; + int char_num = source.m_space.is_octal() ? 3 : 2; // output the first value int offset = 0; if (maxchars >= char_num * minbytes) - offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(source.m_decrypted_space, pcbyte, minbytes), minbytes * char_num, source.is_octal())); + offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(source.m_decrypted_space, pcbyte, minbytes), minbytes * char_num, source.m_space.is_octal())); // output subsequent values int byte; for (byte = minbytes; byte < numbytes && offset + 1 + char_num * minbytes < maxchars; byte += minbytes) - offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(encrypted ? source.m_space : source.m_decrypted_space, pcbyte + byte, minbytes), minbytes * char_num, source.is_octal())); + offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(encrypted ? source.m_space : source.m_decrypted_space, pcbyte + byte, minbytes), minbytes * char_num, source.m_space.is_octal())); // if we ran out of room, indicate more string[maxchars - 1] = 0; @@ -335,7 +335,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) { bool changed = false; const debug_view_disasm_source &source = downcast(*m_source); - int char_num = source.is_octal() ? 3 : 2; + int char_num = source.m_space.is_octal() ? 3 : 2; // determine how many characters we need for an address and set the divider m_divider1 = 1 + (source.m_space.logaddrchars()/2*char_num) + 1; @@ -383,7 +383,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) // convert back and set the address of this instruction m_byteaddress[instr] = pcbyte; - sprintf(&destbuf[0], " %s ", core_i64_format(source.m_space.byte_to_address(pcbyte), source.m_space.logaddrchars()/2*char_num, source.is_octal())); + sprintf(&destbuf[0], " %s ", core_i64_format(source.m_space.byte_to_address(pcbyte), source.m_space.logaddrchars()/2*char_num, source.m_space.is_octal())); // make sure we can translate the address, and then disassemble the result char buffer[100]; diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp index 7b4b530f75b..ac72ce768d7 100644 --- a/src/emu/diexec.cpp +++ b/src/emu/diexec.cpp @@ -46,7 +46,6 @@ device_execute_interface::device_execute_interface(const machine_config &mconfig m_disabled(false), m_vblank_interrupt_screen(nullptr), m_timed_interrupt_period(attotime::zero), - m_is_octal(false), m_nextexec(nullptr), m_timedint_timer(nullptr), m_profiler(PROFILER_IDLE), diff --git a/src/emu/diexec.h b/src/emu/diexec.h index 7f9eb41bfcf..3a5cc0405f9 100644 --- a/src/emu/diexec.h +++ b/src/emu/diexec.h @@ -146,7 +146,6 @@ public: UINT64 attotime_to_cycles(const attotime &duration) const { return clocks_to_cycles(device().attotime_to_clocks(duration)); } UINT32 input_lines() const { return execute_input_lines(); } UINT32 default_irq_vector() const { return execute_default_irq_vector(); } - bool is_octal() const { return m_is_octal; } // static inline configuration helpers static void static_set_disable(device_t &device); @@ -260,7 +259,6 @@ protected: const char * m_vblank_interrupt_screen; // the screen that causes the VBLANK interrupt device_interrupt_delegate m_timed_interrupt; // for interrupts not tied to VBLANK attotime m_timed_interrupt_period; // period for periodic interrupts - bool m_is_octal; // to determine if messages/debugger will show octal or hex // execution lists device_execute_interface *m_nextexec; // pointer to the next device to execute, in order diff --git a/src/emu/dimemory.cpp b/src/emu/dimemory.cpp index b245d51a0b9..dbe3647ec01 100644 --- a/src/emu/dimemory.cpp +++ b/src/emu/dimemory.cpp @@ -36,6 +36,7 @@ address_space_config::address_space_config() m_addrbus_shift(0), m_logaddr_width(0), m_page_shift(0), + m_is_octal(false), m_internal_map(nullptr), m_default_map(nullptr) { @@ -58,6 +59,7 @@ address_space_config::address_space_config(const char *name, endianness_t endian m_addrbus_shift(addrshift), m_logaddr_width(addrwidth), m_page_shift(0), + m_is_octal(false), m_internal_map(internal), m_default_map(defmap) { @@ -71,6 +73,7 @@ address_space_config::address_space_config(const char *name, endianness_t endian m_addrbus_shift(addrshift), m_logaddr_width(logwidth), m_page_shift(pageshift), + m_is_octal(false), m_internal_map(internal), m_default_map(defmap) { @@ -84,6 +87,7 @@ address_space_config::address_space_config(const char *name, endianness_t endian m_addrbus_shift(addrshift), m_logaddr_width(addrwidth), m_page_shift(0), + m_is_octal(false), m_internal_map(nullptr), m_default_map(nullptr), m_internal_map_delegate(std::move(internal)), @@ -99,6 +103,7 @@ address_space_config::address_space_config(const char *name, endianness_t endian m_addrbus_shift(addrshift), m_logaddr_width(logwidth), m_page_shift(pageshift), + m_is_octal(false), m_internal_map(nullptr), m_default_map(nullptr), m_internal_map_delegate(std::move(internal)), diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index 500a03ba9af..41694484914 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -188,7 +188,10 @@ const char *running_machine::describe_context() { cpu_device *cpu = dynamic_cast(&executing->device()); if (cpu != nullptr) - strprintf(m_context, "'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), cpu->space(AS_PROGRAM).logaddrchars(), cpu->is_octal())); + { + address_space &prg = cpu->space(AS_PROGRAM); + strprintf(m_context, "'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), prg.logaddrchars(), prg.is_octal())); + } } else m_context.assign("(no context)"); diff --git a/src/emu/memory.cpp b/src/emu/memory.cpp index 656c00fd626..aa33faf65cf 100644 --- a/src/emu/memory.cpp +++ b/src/emu/memory.cpp @@ -673,15 +673,10 @@ private: { if (m_space.log_unmap() && !m_space.debugger_access()) { - device_execute_interface *intf; - bool is_octal = false; - if (m_space.device().interface(intf)) - is_octal = intf->is_octal(); - m_space.device().logerror("%s: unmapped %s memory read from %s & %s\n", m_space.machine().describe_context(), m_space.name(), - core_i64_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars(),is_octal), - core_i64_format(mask, 2 * sizeof(_UintType),is_octal)); + core_i64_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars(),m_space.is_octal()), + core_i64_format(mask, 2 * sizeof(_UintType),m_space.is_octal())); } return m_space.unmap(); } @@ -746,16 +741,11 @@ private: { if (m_space.log_unmap() && !m_space.debugger_access()) { - device_execute_interface *intf; - bool is_octal = false; - if (m_space.device().interface(intf)) - is_octal = intf->is_octal(); - m_space.device().logerror("%s: unmapped %s memory write to %s = %s & %s\n", m_space.machine().describe_context(), m_space.name(), - core_i64_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars(),is_octal), - core_i64_format(data, 2 * sizeof(_UintType),is_octal), - core_i64_format(mask, 2 * sizeof(_UintType),is_octal)); + core_i64_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars(),m_space.is_octal()), + core_i64_format(data, 2 * sizeof(_UintType),m_space.is_octal()), + core_i64_format(mask, 2 * sizeof(_UintType),m_space.is_octal())); } } diff --git a/src/emu/memory.h b/src/emu/memory.h index 34a060a51b6..0b2b493a27d 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -239,10 +239,12 @@ public: INT8 m_addrbus_shift; UINT8 m_logaddr_width; UINT8 m_page_shift; + bool m_is_octal; // to determine if messages/debugger will show octal or hex + address_map_constructor m_internal_map; address_map_constructor m_default_map; - address_map_delegate m_internal_map_delegate; - address_map_delegate m_default_map_delegate; + address_map_delegate m_internal_map_delegate; + address_map_delegate m_default_map_delegate; }; @@ -283,6 +285,7 @@ public: int addr_width() const { return m_config.addr_width(); } endianness_t endianness() const { return m_config.endianness(); } UINT64 unmap() const { return m_unmap; } + bool is_octal() const { return m_config.m_is_octal; } offs_t addrmask() const { return m_addrmask; } offs_t bytemask() const { return m_bytemask; } -- cgit v1.2.3-70-g09d2 From 71ea89fa74cb796abbdd48754a7e4a90cb4792cc Mon Sep 17 00:00:00 2001 From: briantro Date: Thu, 4 Feb 2016 16:12:09 -0600 Subject: new NBA Jam clone New Clone Added --------------------------------------------------------- NBA Jam (rev 1.00 02/1/93 [Alex Meijer, Bernard Tack] --- src/mame/arcade.lst | 1 + src/mame/drivers/midtunit.cpp | 127 +++++++++++++++++++++++++++--------------- 2 files changed, 83 insertions(+), 45 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index d27a32bee31..1df7701c9e6 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -8422,6 +8422,7 @@ mk2chal // hack jdreddp // (c) 1993 Midway nbajam // (c) 1993 Midway nbajamr2 // (c) 1993 Midway +nbajamr1 // (c) 1993 Midway nbajamte // (c) 1994 Midway nbajamte1 // (c) 1994 Midway nbajamte2 // (c) 1994 Midway diff --git a/src/mame/drivers/midtunit.cpp b/src/mame/drivers/midtunit.cpp index 996086bfe05..872956e489c 100644 --- a/src/mame/drivers/midtunit.cpp +++ b/src/mame/drivers/midtunit.cpp @@ -1186,73 +1186,109 @@ ROM_END ROM_START( nbajam ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "nbau3.bin", 0x010000, 0x20000, CRC(3a3ea480) SHA1(d12a45cba5c35f046b176661d7877fa4fd0e6c13) ) + ROM_LOAD( "l2_nba_jam_u3_sound_rom.u3", 0x010000, 0x20000, CRC(3a3ea480) SHA1(d12a45cba5c35f046b176661d7877fa4fd0e6c13) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "nbau12.bin", 0x000000, 0x80000, CRC(b94847f1) SHA1(e7efa0a379bfa91fe4ffb75f07a5dfbfde9a96b4) ) - ROM_LOAD( "nbau13.bin", 0x080000, 0x80000, CRC(b6fe24bd) SHA1(f70f75b5570a2b368ebc74d2a7d264c618940430) ) + ROM_LOAD( "nbau12.u12", 0x000000, 0x80000, CRC(b94847f1) SHA1(e7efa0a379bfa91fe4ffb75f07a5dfbfde9a96b4) ) + ROM_LOAD( "nbau13.u13", 0x080000, 0x80000, CRC(b6fe24bd) SHA1(f70f75b5570a2b368ebc74d2a7d264c618940430) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ - ROM_LOAD16_BYTE( "nbauj12.bin", 0x00000, 0x80000, CRC(b93e271c) SHA1(b0e9f055376a4a4cd1115a81f71c933903c251b1) ) - ROM_LOAD16_BYTE( "nbaug12.bin", 0x00001, 0x80000, CRC(407d3390) SHA1(a319bc890d94310e44fe2ec98bfc95665a662701) ) + ROM_LOAD16_BYTE( "l3_nba_jam_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(b93e271c) SHA1(b0e9f055376a4a4cd1115a81f71c933903c251b1) ) + ROM_LOAD16_BYTE( "l3_nba_jam_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(407d3390) SHA1(a319bc890d94310e44fe2ec98bfc95665a662701) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "nbaug14.bin", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "nbauj14.bin", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "nbaug19.bin", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "nbauj19.bin", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) - - ROM_LOAD32_BYTE( "nbaug16.bin", 0x200000, 0x80000, CRC(8591c572) SHA1(237bab2e93abf438a84be3603505db5de59922af) ) - ROM_LOAD32_BYTE( "nbauj16.bin", 0x200001, 0x80000, CRC(d2e554f1) SHA1(139aa39bd48b8605058ece188f9f5e6793561fcb) ) - ROM_LOAD32_BYTE( "nbaug20.bin", 0x200002, 0x80000, CRC(44fd6221) SHA1(1d6754bf2c24950080523f66b77407931babba29) ) - ROM_LOAD32_BYTE( "nbauj20.bin", 0x200003, 0x80000, CRC(f9cebbb6) SHA1(6202e490bc5658bd0741422f841540fcd037cfee) ) - - ROM_LOAD32_BYTE( "nbaug17.bin", 0x400000, 0x80000, CRC(6f921886) SHA1(72542249ca6602dc4816952765c1810f064ff394) ) - ROM_LOAD32_BYTE( "nbauj17.bin", 0x400001, 0x80000, CRC(b2e14981) SHA1(5cec9b7fcaa6d0ce5bff689541fc98db435c5b5f) ) - ROM_LOAD32_BYTE( "nbaug22.bin", 0x400002, 0x80000, CRC(ab05ed89) SHA1(4153d098fbaeac963d93f26dcd9d8bc33a48a734) ) - ROM_LOAD32_BYTE( "nbauj22.bin", 0x400003, 0x80000, CRC(59a95878) SHA1(b95165987853f164842ab2b5895ea95484a1d78b) ) - - ROM_LOAD32_BYTE( "nbaug18.bin", 0x600000, 0x80000, CRC(5162d3d6) SHA1(14d377977510b7793e4006a7a5089dbfd785d7d1) ) - ROM_LOAD32_BYTE( "nbauj18.bin", 0x600001, 0x80000, CRC(fdee0037) SHA1(3bcc740f4bdb3236822cd6e7ed06241804351cca) ) - ROM_LOAD32_BYTE( "nbaug23.bin", 0x600002, 0x80000, CRC(7b934c7a) SHA1(a6992fb3c50429ac4fa15bd91612ae0c0b8f961d) ) - ROM_LOAD32_BYTE( "nbauj23.bin", 0x600003, 0x80000, CRC(427d2eee) SHA1(4985e3dd9c9e1bedd5a900958bf549656debd494) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(8591c572) SHA1(237bab2e93abf438a84be3603505db5de59922af) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(d2e554f1) SHA1(139aa39bd48b8605058ece188f9f5e6793561fcb) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(44fd6221) SHA1(1d6754bf2c24950080523f66b77407931babba29) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(f9cebbb6) SHA1(6202e490bc5658bd0741422f841540fcd037cfee) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(6f921886) SHA1(72542249ca6602dc4816952765c1810f064ff394) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(b2e14981) SHA1(5cec9b7fcaa6d0ce5bff689541fc98db435c5b5f) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(ab05ed89) SHA1(4153d098fbaeac963d93f26dcd9d8bc33a48a734) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(59a95878) SHA1(b95165987853f164842ab2b5895ea95484a1d78b) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(5162d3d6) SHA1(14d377977510b7793e4006a7a5089dbfd785d7d1) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(fdee0037) SHA1(3bcc740f4bdb3236822cd6e7ed06241804351cca) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(7b934c7a) SHA1(a6992fb3c50429ac4fa15bd91612ae0c0b8f961d) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(427d2eee) SHA1(4985e3dd9c9e1bedd5a900958bf549656debd494) ) ROM_END ROM_START( nbajamr2 ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "nbau3.bin", 0x010000, 0x20000, CRC(3a3ea480) SHA1(d12a45cba5c35f046b176661d7877fa4fd0e6c13) ) + ROM_LOAD( "l2_nba_jam_u3_sound_rom.u3", 0x010000, 0x20000, CRC(3a3ea480) SHA1(d12a45cba5c35f046b176661d7877fa4fd0e6c13) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "nbau12.bin", 0x000000, 0x80000, CRC(b94847f1) SHA1(e7efa0a379bfa91fe4ffb75f07a5dfbfde9a96b4) ) - ROM_LOAD( "nbau13.bin", 0x080000, 0x80000, CRC(b6fe24bd) SHA1(f70f75b5570a2b368ebc74d2a7d264c618940430) ) + ROM_LOAD( "nbau12.u12", 0x000000, 0x80000, CRC(b94847f1) SHA1(e7efa0a379bfa91fe4ffb75f07a5dfbfde9a96b4) ) + ROM_LOAD( "nbau13.u13", 0x080000, 0x80000, CRC(b6fe24bd) SHA1(f70f75b5570a2b368ebc74d2a7d264c618940430) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ - ROM_LOAD16_BYTE( "jam2uj12.bin", 0x00000, 0x80000, CRC(0fe80b36) SHA1(fe6b21dc9b393b25c511b2914b568fa92301d749) ) - ROM_LOAD16_BYTE( "jam2ug12.bin", 0x00001, 0x80000, CRC(5d106315) SHA1(e2cddd9ed6771e77711e3a4f25fe2d07712d954e) ) + ROM_LOAD16_BYTE( "l2_nba_jam_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(0fe80b36) SHA1(fe6b21dc9b393b25c511b2914b568fa92301d749) ) + ROM_LOAD16_BYTE( "l2_nba_jam_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(5d106315) SHA1(e2cddd9ed6771e77711e3a4f25fe2d07712d954e) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "nbaug14.bin", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "nbauj14.bin", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "nbaug19.bin", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "nbauj19.bin", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(8591c572) SHA1(237bab2e93abf438a84be3603505db5de59922af) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(d2e554f1) SHA1(139aa39bd48b8605058ece188f9f5e6793561fcb) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(44fd6221) SHA1(1d6754bf2c24950080523f66b77407931babba29) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(f9cebbb6) SHA1(6202e490bc5658bd0741422f841540fcd037cfee) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(6f921886) SHA1(72542249ca6602dc4816952765c1810f064ff394) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(b2e14981) SHA1(5cec9b7fcaa6d0ce5bff689541fc98db435c5b5f) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(ab05ed89) SHA1(4153d098fbaeac963d93f26dcd9d8bc33a48a734) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(59a95878) SHA1(b95165987853f164842ab2b5895ea95484a1d78b) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(5162d3d6) SHA1(14d377977510b7793e4006a7a5089dbfd785d7d1) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(fdee0037) SHA1(3bcc740f4bdb3236822cd6e7ed06241804351cca) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(7b934c7a) SHA1(a6992fb3c50429ac4fa15bd91612ae0c0b8f961d) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(427d2eee) SHA1(4985e3dd9c9e1bedd5a900958bf549656debd494) ) +ROM_END - ROM_LOAD32_BYTE( "nbaug16.bin", 0x200000, 0x80000, CRC(8591c572) SHA1(237bab2e93abf438a84be3603505db5de59922af) ) - ROM_LOAD32_BYTE( "nbauj16.bin", 0x200001, 0x80000, CRC(d2e554f1) SHA1(139aa39bd48b8605058ece188f9f5e6793561fcb) ) - ROM_LOAD32_BYTE( "nbaug20.bin", 0x200002, 0x80000, CRC(44fd6221) SHA1(1d6754bf2c24950080523f66b77407931babba29) ) - ROM_LOAD32_BYTE( "nbauj20.bin", 0x200003, 0x80000, CRC(f9cebbb6) SHA1(6202e490bc5658bd0741422f841540fcd037cfee) ) - ROM_LOAD32_BYTE( "nbaug17.bin", 0x400000, 0x80000, CRC(6f921886) SHA1(72542249ca6602dc4816952765c1810f064ff394) ) - ROM_LOAD32_BYTE( "nbauj17.bin", 0x400001, 0x80000, CRC(b2e14981) SHA1(5cec9b7fcaa6d0ce5bff689541fc98db435c5b5f) ) - ROM_LOAD32_BYTE( "nbaug22.bin", 0x400002, 0x80000, CRC(ab05ed89) SHA1(4153d098fbaeac963d93f26dcd9d8bc33a48a734) ) - ROM_LOAD32_BYTE( "nbauj22.bin", 0x400003, 0x80000, CRC(59a95878) SHA1(b95165987853f164842ab2b5895ea95484a1d78b) ) +ROM_START( nbajamr1 ) + ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ + ROM_LOAD( "l2_nba_jam_u3_sound_rom.u3", 0x010000, 0x20000, CRC(3a3ea480) SHA1(d12a45cba5c35f046b176661d7877fa4fd0e6c13) ) + ROM_RELOAD( 0x030000, 0x20000 ) - ROM_LOAD32_BYTE( "nbaug18.bin", 0x600000, 0x80000, CRC(5162d3d6) SHA1(14d377977510b7793e4006a7a5089dbfd785d7d1) ) - ROM_LOAD32_BYTE( "nbauj18.bin", 0x600001, 0x80000, CRC(fdee0037) SHA1(3bcc740f4bdb3236822cd6e7ed06241804351cca) ) - ROM_LOAD32_BYTE( "nbaug23.bin", 0x600002, 0x80000, CRC(7b934c7a) SHA1(a6992fb3c50429ac4fa15bd91612ae0c0b8f961d) ) - ROM_LOAD32_BYTE( "nbauj23.bin", 0x600003, 0x80000, CRC(427d2eee) SHA1(4985e3dd9c9e1bedd5a900958bf549656debd494) ) + ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ + ROM_LOAD( "nbau12.u12", 0x000000, 0x80000, CRC(b94847f1) SHA1(e7efa0a379bfa91fe4ffb75f07a5dfbfde9a96b4) ) + ROM_LOAD( "nbau13.u13", 0x080000, 0x80000, CRC(b6fe24bd) SHA1(f70f75b5570a2b368ebc74d2a7d264c618940430) ) + + ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ + ROM_LOAD16_BYTE( "l1_nba_jam_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(4db672ec) SHA1(bb329c552473179f617d3bd038f47fb69d060b55) ) + ROM_LOAD16_BYTE( "l1_nba_jam_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(ed1df3f7) SHA1(36b0c47758a205719dbef169f0af3e761f557b99) ) + + ROM_REGION( 0xc00000, "gfxrom", 0 ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(8591c572) SHA1(237bab2e93abf438a84be3603505db5de59922af) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(d2e554f1) SHA1(139aa39bd48b8605058ece188f9f5e6793561fcb) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(44fd6221) SHA1(1d6754bf2c24950080523f66b77407931babba29) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(f9cebbb6) SHA1(6202e490bc5658bd0741422f841540fcd037cfee) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(6f921886) SHA1(72542249ca6602dc4816952765c1810f064ff394) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(b2e14981) SHA1(5cec9b7fcaa6d0ce5bff689541fc98db435c5b5f) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(ab05ed89) SHA1(4153d098fbaeac963d93f26dcd9d8bc33a48a734) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(59a95878) SHA1(b95165987853f164842ab2b5895ea95484a1d78b) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(5162d3d6) SHA1(14d377977510b7793e4006a7a5089dbfd785d7d1) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(fdee0037) SHA1(3bcc740f4bdb3236822cd6e7ed06241804351cca) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(7b934c7a) SHA1(a6992fb3c50429ac4fa15bd91612ae0c0b8f961d) ) + ROM_LOAD32_BYTE( "l1_nba_jam_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(427d2eee) SHA1(4985e3dd9c9e1bedd5a900958bf549656debd494) ) ROM_END @@ -1499,6 +1535,7 @@ GAME( 1993, jdreddp, 0, tunit_adpcm, jdreddp, midtunit_state, jdreddp, GAME( 1993, nbajam, 0, tunit_adpcm, nbajam, midtunit_state, nbajam, ROT0, "Midway", "NBA Jam (rev 3.01 04/07/93)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, nbajamr2, nbajam, tunit_adpcm, nbajam, midtunit_state, nbajam, ROT0, "Midway", "NBA Jam (rev 2.00 02/10/93)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, nbajamr1, nbajam, tunit_adpcm, nbajam, midtunit_state, nbajam, ROT0, "Midway", "NBA Jam (rev 1.00 02/1/93)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, nbajamte, 0, tunit_adpcm, nbajamte, midtunit_state, nbajamte, ROT0, "Midway", "NBA Jam TE (rev 4.0 03/23/94)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, nbajamte1,nbajamte, tunit_adpcm, nbajamte, midtunit_state, nbajamte, ROT0, "Midway", "NBA Jam TE (rev 1.0 01/17/94)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From ec0f896258c032f143ca977a502a95a0ac07c6b7 Mon Sep 17 00:00:00 2001 From: briantro Date: Thu, 4 Feb 2016 16:35:55 -0600 Subject: midtunit.cpp: Correct rom labels for NBA Jam Tournament - NW --- src/mame/drivers/midtunit.cpp | 244 +++++++++++++++++++++--------------------- 1 file changed, 122 insertions(+), 122 deletions(-) diff --git a/src/mame/drivers/midtunit.cpp b/src/mame/drivers/midtunit.cpp index 872956e489c..77d1f1c8ecc 100644 --- a/src/mame/drivers/midtunit.cpp +++ b/src/mame/drivers/midtunit.cpp @@ -1294,181 +1294,181 @@ ROM_END ROM_START( nbajamte ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "te-u3.bin", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) + ROM_LOAD( "l1_nba_game_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "te-u12.bin", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) - ROM_LOAD( "te-u13.bin", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) + ROM_LOAD( "l1_nba_game_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) + ROM_LOAD( "l1_nba_game_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ - ROM_LOAD16_BYTE( "te-uj12.l4", 0x00000, 0x80000, CRC(d7c21bc4) SHA1(e05f0299b955500df6a08b1c0b24b932a9cdfa6a) ) - ROM_LOAD16_BYTE( "te-ug12.l4", 0x00001, 0x80000, CRC(7ad49229) SHA1(e9ceedb0e620809d8a4d42087d806aa296a4cd59) ) + ROM_LOAD16_BYTE( "l4_nba_game_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(d7c21bc4) SHA1(e05f0299b955500df6a08b1c0b24b932a9cdfa6a) ) + ROM_LOAD16_BYTE( "l4_nba_game_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(7ad49229) SHA1(e9ceedb0e620809d8a4d42087d806aa296a4cd59) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "nbaug14.bin", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "nbauj14.bin", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "nbaug19.bin", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "nbauj19.bin", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) - - ROM_LOAD32_BYTE( "te-ug16.bin", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) - ROM_LOAD32_BYTE( "te-uj16.bin", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) - ROM_LOAD32_BYTE( "te-ug20.bin", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) - ROM_LOAD32_BYTE( "te-uj20.bin", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) - - ROM_LOAD32_BYTE( "te-ug17.bin", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) - ROM_LOAD32_BYTE( "te-uj17.bin", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) - ROM_LOAD32_BYTE( "te-ug22.bin", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) - ROM_LOAD32_BYTE( "te-uj22.bin", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) - - ROM_LOAD32_BYTE( "te-ug18.bin", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) - ROM_LOAD32_BYTE( "te-uj18.bin", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) - ROM_LOAD32_BYTE( "te-ug23.bin", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) - ROM_LOAD32_BYTE( "te-uj23.bin", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) ROM_END -ROM_START( nbajamte1 ) +ROM_START( nbajamte3 ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "te-u3.bin", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) + ROM_LOAD( "l1_nba_game_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "te-u12.bin", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) - ROM_LOAD( "te-u13.bin", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) + ROM_LOAD( "l1_nba_game_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) + ROM_LOAD( "l1_nba_game_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ - ROM_LOAD16_BYTE( "te-uj12.l1", 0x00000, 0x80000, CRC(a9f555ad) SHA1(34f5fc1b003ef8acbb2b38fbacd58d018d20ab1b) ) - ROM_LOAD16_BYTE( "te-ug12.l1", 0x00001, 0x80000, CRC(bd4579b5) SHA1(c893cff931f1e60a1d0d29d2719f514d92fb3490) ) + ROM_LOAD16_BYTE( "l3_nba_game_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(8fdf77b4) SHA1(1a8a178b19d0b8e7a5fd2ddf373a4279321440d0) ) + ROM_LOAD16_BYTE( "l3_nba_game_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(656579ed) SHA1(b038fdc814ebc8d203724fdb2f7501d40f1dc21f) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "nbaug14.bin", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "nbauj14.bin", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "nbaug19.bin", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "nbauj19.bin", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) - - ROM_LOAD32_BYTE( "te-ug16.bin", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) - ROM_LOAD32_BYTE( "te-uj16.bin", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) - ROM_LOAD32_BYTE( "te-ug20.bin", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) - ROM_LOAD32_BYTE( "te-uj20.bin", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) - - ROM_LOAD32_BYTE( "te-ug17.bin", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) - ROM_LOAD32_BYTE( "te-uj17.bin", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) - ROM_LOAD32_BYTE( "te-ug22.bin", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) - ROM_LOAD32_BYTE( "te-uj22.bin", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) - - ROM_LOAD32_BYTE( "te-ug18.bin", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) - ROM_LOAD32_BYTE( "te-uj18.bin", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) - ROM_LOAD32_BYTE( "te-ug23.bin", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) - ROM_LOAD32_BYTE( "te-uj23.bin", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) ROM_END ROM_START( nbajamte2 ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "te-u3.bin", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) + ROM_LOAD( "l1_nba_game_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "te-u12.bin", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) - ROM_LOAD( "te-u13.bin", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) + ROM_LOAD( "l1_nba_game_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) + ROM_LOAD( "l1_nba_game_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ - ROM_LOAD16_BYTE( "te-uj12.l2", 0x00000, 0x80000, CRC(eaa6fb32) SHA1(8c8c0c6ace2b98679d7fe90e1f9284bdf0e14eaf) ) - ROM_LOAD16_BYTE( "te-ug12.l2", 0x00001, 0x80000, CRC(5a694d9a) SHA1(fb74e4242d9adba03f24a81451ea06e8d9b4af96) ) + ROM_LOAD16_BYTE( "l2_nba_game_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(eaa6fb32) SHA1(8c8c0c6ace2b98679d7fe90e1f9284bdf0e14eaf) ) + ROM_LOAD16_BYTE( "l2_nba_game_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(5a694d9a) SHA1(fb74e4242d9adba03f24a81451ea06e8d9b4af96) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "nbaug14.bin", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "nbauj14.bin", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "nbaug19.bin", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "nbauj19.bin", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) - - ROM_LOAD32_BYTE( "te-ug16.bin", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) - ROM_LOAD32_BYTE( "te-uj16.bin", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) - ROM_LOAD32_BYTE( "te-ug20.bin", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) - ROM_LOAD32_BYTE( "te-uj20.bin", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) - - ROM_LOAD32_BYTE( "te-ug17.bin", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) - ROM_LOAD32_BYTE( "te-uj17.bin", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) - ROM_LOAD32_BYTE( "te-ug22.bin", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) - ROM_LOAD32_BYTE( "te-uj22.bin", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) - - ROM_LOAD32_BYTE( "te-ug18.bin", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) - ROM_LOAD32_BYTE( "te-uj18.bin", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) - ROM_LOAD32_BYTE( "te-ug23.bin", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) - ROM_LOAD32_BYTE( "te-uj23.bin", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) ROM_END -ROM_START( nbajamte3 ) +ROM_START( nbajamte1 ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "te-u3.bin", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) + ROM_LOAD( "l1_nba_game_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "te-u12.bin", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) - ROM_LOAD( "te-u13.bin", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) + ROM_LOAD( "l1_nba_game_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) + ROM_LOAD( "l1_nba_game_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ - ROM_LOAD16_BYTE( "te-uj12.l3", 0x00000, 0x80000, CRC(8fdf77b4) SHA1(1a8a178b19d0b8e7a5fd2ddf373a4279321440d0) ) - ROM_LOAD16_BYTE( "te-ug12.l3", 0x00001, 0x80000, CRC(656579ed) SHA1(b038fdc814ebc8d203724fdb2f7501d40f1dc21f) ) + ROM_LOAD16_BYTE( "l1_nba_game_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(a9f555ad) SHA1(34f5fc1b003ef8acbb2b38fbacd58d018d20ab1b) ) + ROM_LOAD16_BYTE( "l1_nba_game_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(bd4579b5) SHA1(c893cff931f1e60a1d0d29d2719f514d92fb3490) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "nbaug14.bin", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "nbauj14.bin", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "nbaug19.bin", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "nbauj19.bin", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) - - ROM_LOAD32_BYTE( "te-ug16.bin", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) - ROM_LOAD32_BYTE( "te-uj16.bin", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) - ROM_LOAD32_BYTE( "te-ug20.bin", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) - ROM_LOAD32_BYTE( "te-uj20.bin", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) - - ROM_LOAD32_BYTE( "te-ug17.bin", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) - ROM_LOAD32_BYTE( "te-uj17.bin", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) - ROM_LOAD32_BYTE( "te-ug22.bin", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) - ROM_LOAD32_BYTE( "te-uj22.bin", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) - - ROM_LOAD32_BYTE( "te-ug18.bin", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) - ROM_LOAD32_BYTE( "te-uj18.bin", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) - ROM_LOAD32_BYTE( "te-ug23.bin", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) - ROM_LOAD32_BYTE( "te-uj23.bin", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) ROM_END ROM_START( nbajamten ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "te-u3.bin", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) + ROM_LOAD( "l1_nba_game_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "te-u12.bin", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) - ROM_LOAD( "te-u13.bin", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) + ROM_LOAD( "l1_nba_game_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) + ROM_LOAD( "l1_nba_game_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ ROM_LOAD16_BYTE( "nani-uj12.bin", 0x00000, 0x80000, CRC(a2662e74) SHA1(7a6c18464446baf3d279013eb95bf862b5b3be70) ) ROM_LOAD16_BYTE( "nani-ug12.bin", 0x00001, 0x80000, CRC(40cda5b1) SHA1(2ff51f830aa86f6456c626666e221be1f7bfbfa2) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "nbaug14.bin", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "nbauj14.bin", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "nbaug19.bin", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "nbauj19.bin", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) - - ROM_LOAD32_BYTE( "te-ug16.bin", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) - ROM_LOAD32_BYTE( "te-uj16.bin", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) - ROM_LOAD32_BYTE( "te-ug20.bin", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) - ROM_LOAD32_BYTE( "te-uj20.bin", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) - - ROM_LOAD32_BYTE( "te-ug17.bin", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) - ROM_LOAD32_BYTE( "te-uj17.bin", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) - ROM_LOAD32_BYTE( "te-ug22.bin", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) - ROM_LOAD32_BYTE( "te-uj22.bin", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) - - ROM_LOAD32_BYTE( "te-ug18.bin", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) - ROM_LOAD32_BYTE( "te-uj18.bin", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) - ROM_LOAD32_BYTE( "te-ug23.bin", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) - ROM_LOAD32_BYTE( "te-uj23.bin", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) + + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) + ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) ROM_END @@ -1538,7 +1538,7 @@ GAME( 1993, nbajamr2, nbajam, tunit_adpcm, nbajam, midtunit_state, nbajam, GAME( 1993, nbajamr1, nbajam, tunit_adpcm, nbajam, midtunit_state, nbajam, ROT0, "Midway", "NBA Jam (rev 1.00 02/1/93)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, nbajamte, 0, tunit_adpcm, nbajamte, midtunit_state, nbajamte, ROT0, "Midway", "NBA Jam TE (rev 4.0 03/23/94)", MACHINE_SUPPORTS_SAVE ) -GAME( 1994, nbajamte1,nbajamte, tunit_adpcm, nbajamte, midtunit_state, nbajamte, ROT0, "Midway", "NBA Jam TE (rev 1.0 01/17/94)", MACHINE_SUPPORTS_SAVE ) -GAME( 1994, nbajamte2,nbajamte, tunit_adpcm, nbajamte, midtunit_state, nbajamte, ROT0, "Midway", "NBA Jam TE (rev 2.0 01/28/94)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, nbajamte3,nbajamte, tunit_adpcm, nbajamte, midtunit_state, nbajamte, ROT0, "Midway", "NBA Jam TE (rev 3.0 03/04/94)", MACHINE_SUPPORTS_SAVE ) +GAME( 1994, nbajamte2,nbajamte, tunit_adpcm, nbajamte, midtunit_state, nbajamte, ROT0, "Midway", "NBA Jam TE (rev 2.0 01/28/94)", MACHINE_SUPPORTS_SAVE ) +GAME( 1994, nbajamte1,nbajamte, tunit_adpcm, nbajamte, midtunit_state, nbajamte, ROT0, "Midway", "NBA Jam TE (rev 1.0 01/17/94)", MACHINE_SUPPORTS_SAVE ) GAME( 1995, nbajamten,nbajamte, tunit_adpcm, nbajamte, midtunit_state, nbajamte, ROT0, "Midway", "NBA Jam T.E. Nani Edition (rev 5.2 8/11/95, prototype)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From 397ac3769aa5a0b95ea99c1a62a0970fb9c4012b Mon Sep 17 00:00:00 2001 From: briantro Date: Thu, 4 Feb 2016 16:40:46 -0600 Subject: midtunit.cpp: Hooray Cut-N-Paste (IE: Fix CNP error) - NW --- src/mame/drivers/midtunit.cpp | 236 +++++++++++++++++++++--------------------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/src/mame/drivers/midtunit.cpp b/src/mame/drivers/midtunit.cpp index 77d1f1c8ecc..15e50184a56 100644 --- a/src/mame/drivers/midtunit.cpp +++ b/src/mame/drivers/midtunit.cpp @@ -1294,181 +1294,181 @@ ROM_END ROM_START( nbajamte ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "l1_nba_game_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) + ROM_LOAD( "l1_nba_jam_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "l1_nba_game_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) - ROM_LOAD( "l1_nba_game_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) + ROM_LOAD( "l1_nba_jam_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) + ROM_LOAD( "l1_nba_jam_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ - ROM_LOAD16_BYTE( "l4_nba_game_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(d7c21bc4) SHA1(e05f0299b955500df6a08b1c0b24b932a9cdfa6a) ) - ROM_LOAD16_BYTE( "l4_nba_game_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(7ad49229) SHA1(e9ceedb0e620809d8a4d42087d806aa296a4cd59) ) + ROM_LOAD16_BYTE( "l4_nba_jam_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(d7c21bc4) SHA1(e05f0299b955500df6a08b1c0b24b932a9cdfa6a) ) + ROM_LOAD16_BYTE( "l4_nba_jam_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(7ad49229) SHA1(e9ceedb0e620809d8a4d42087d806aa296a4cd59) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) ROM_END ROM_START( nbajamte3 ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "l1_nba_game_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) + ROM_LOAD( "l1_nba_jam_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "l1_nba_game_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) - ROM_LOAD( "l1_nba_game_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) + ROM_LOAD( "l1_nba_jam_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) + ROM_LOAD( "l1_nba_jam_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ - ROM_LOAD16_BYTE( "l3_nba_game_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(8fdf77b4) SHA1(1a8a178b19d0b8e7a5fd2ddf373a4279321440d0) ) - ROM_LOAD16_BYTE( "l3_nba_game_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(656579ed) SHA1(b038fdc814ebc8d203724fdb2f7501d40f1dc21f) ) + ROM_LOAD16_BYTE( "l3_nba_jam_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(8fdf77b4) SHA1(1a8a178b19d0b8e7a5fd2ddf373a4279321440d0) ) + ROM_LOAD16_BYTE( "l3_nba_jam_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(656579ed) SHA1(b038fdc814ebc8d203724fdb2f7501d40f1dc21f) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) ROM_END ROM_START( nbajamte2 ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "l1_nba_game_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) + ROM_LOAD( "l1_nba_jam_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "l1_nba_game_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) - ROM_LOAD( "l1_nba_game_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) + ROM_LOAD( "l1_nba_jam_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) + ROM_LOAD( "l1_nba_jam_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ - ROM_LOAD16_BYTE( "l2_nba_game_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(eaa6fb32) SHA1(8c8c0c6ace2b98679d7fe90e1f9284bdf0e14eaf) ) - ROM_LOAD16_BYTE( "l2_nba_game_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(5a694d9a) SHA1(fb74e4242d9adba03f24a81451ea06e8d9b4af96) ) + ROM_LOAD16_BYTE( "l2_nba_jam_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(eaa6fb32) SHA1(8c8c0c6ace2b98679d7fe90e1f9284bdf0e14eaf) ) + ROM_LOAD16_BYTE( "l2_nba_jam_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(5a694d9a) SHA1(fb74e4242d9adba03f24a81451ea06e8d9b4af96) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) ROM_END ROM_START( nbajamte1 ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "l1_nba_game_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) + ROM_LOAD( "l1_nba_jam_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "l1_nba_game_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) - ROM_LOAD( "l1_nba_game_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) + ROM_LOAD( "l1_nba_jam_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) + ROM_LOAD( "l1_nba_jam_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ - ROM_LOAD16_BYTE( "l1_nba_game_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(a9f555ad) SHA1(34f5fc1b003ef8acbb2b38fbacd58d018d20ab1b) ) - ROM_LOAD16_BYTE( "l1_nba_game_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(bd4579b5) SHA1(c893cff931f1e60a1d0d29d2719f514d92fb3490) ) + ROM_LOAD16_BYTE( "l1_nba_jam_tournament_game_rom_uj12.uj12", 0x00000, 0x80000, CRC(a9f555ad) SHA1(34f5fc1b003ef8acbb2b38fbacd58d018d20ab1b) ) + ROM_LOAD16_BYTE( "l1_nba_jam_tournament_game_rom_ug12.ug12", 0x00001, 0x80000, CRC(bd4579b5) SHA1(c893cff931f1e60a1d0d29d2719f514d92fb3490) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) ROM_END ROM_START( nbajamten ) ROM_REGION( 0x50000, "adpcm:cpu", 0 ) /* sound CPU */ - ROM_LOAD( "l1_nba_game_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) + ROM_LOAD( "l1_nba_jam_tournament_u3_sound_rom.u3", 0x010000, 0x20000, CRC(d4551195) SHA1(e8908fbe4339fb8c93f7e74113dfd25dda1667ea) ) ROM_RELOAD( 0x030000, 0x20000 ) ROM_REGION( 0x100000, "adpcm:oki", 0 ) /* ADPCM */ - ROM_LOAD( "l1_nba_game_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) - ROM_LOAD( "l1_nba_game_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) + ROM_LOAD( "l1_nba_jam_tournament_u12_sound_rom.u12", 0x000000, 0x80000, CRC(4fac97bc) SHA1(bd88d8c3edab0e35ad9f9350bcbaa17cda61d87a) ) + ROM_LOAD( "l1_nba_jam_tournament_u13_sound_rom.u13", 0x080000, 0x80000, CRC(6f27b202) SHA1(c1f0db15624d1e7102ce9fd1db49ccf86e8611d6) ) ROM_REGION16_LE( 0x100000, "maincpu", 0 ) /* 34010 code */ ROM_LOAD16_BYTE( "nani-uj12.bin", 0x00000, 0x80000, CRC(a2662e74) SHA1(7a6c18464446baf3d279013eb95bf862b5b3be70) ) ROM_LOAD16_BYTE( "nani-ug12.bin", 0x00001, 0x80000, CRC(40cda5b1) SHA1(2ff51f830aa86f6456c626666e221be1f7bfbfa2) ) ROM_REGION( 0xc00000, "gfxrom", 0 ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) - - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) - ROM_LOAD32_BYTE( "l1_nba_game_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug14.ug14", 0x000000, 0x80000, CRC(04bb9f64) SHA1(9e1a8c37e14cb6fe67f4aa3caa9022f356f1ca64) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj14.uj14", 0x000001, 0x80000, CRC(b34b7af3) SHA1(0abb74d2f414bc9da0380a81beb134f3a87c1a0a) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug19.ug19", 0x000002, 0x80000, CRC(a8f22fbb) SHA1(514208a9d6d0c8c2d7847cc02d4387eac90be659) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj19.uj19", 0x000003, 0x80000, CRC(8130a8a2) SHA1(f23f124024285d07d8cf822817b62e42c38b82db) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug16.ug16", 0x200000, 0x80000, CRC(c7ce74d0) SHA1(93861cd909e0f28ed112096d6f9fc57d0d31c57c) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj16.uj16", 0x200001, 0x80000, CRC(905ad88b) SHA1(24c336ccc0e2ac0ee96a34ad6fe4aa7464de0009) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug20.ug20", 0x200002, 0x80000, CRC(8a48728c) SHA1(3684099b4934b027336c319c77d9e0710b8c22dc) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj20.uj20", 0x200003, 0x80000, CRC(bf263d61) SHA1(b5b59e8df55f8030eff068c1d8b07dad8521bf5d) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug17.ug17", 0x400000, 0x80000, CRC(9401be62) SHA1(597413a8a1eb66a7ad89af2f548fa3062e5e8efb) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj17.uj17", 0x400001, 0x80000, CRC(8a852b9e) SHA1(604c7f4305887e9505320630027765ea76607c58) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug22.ug22", 0x400002, 0x80000, CRC(3b05133b) SHA1(f6067abb92b8751afe7352a4f1b1a22c9528002b) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj22.uj22", 0x400003, 0x80000, CRC(39791051) SHA1(7aa02500ddacd31fca04044a22a38f36452ca300) ) + + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug18.ug18", 0x600000, 0x80000, CRC(6fd08f57) SHA1(5b7031dffc88374c5bfdf3021aa01ec4e28d0631) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj18.uj18", 0x600001, 0x80000, CRC(4eb73c26) SHA1(693bf45f777da8e55b7bcd8699ea5bd711964941) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_ug23.ug23", 0x600002, 0x80000, CRC(854f73bc) SHA1(242cc8ce28711f6f0787524a1070eb4b0956e6ae) ) + ROM_LOAD32_BYTE( "l1_nba_jam_tournament_game_rom_uj23.uj23", 0x600003, 0x80000, CRC(f8c30998) SHA1(33e2f982d74e9f3686b1f4a8172c49fb8b604cf5) ) ROM_END -- cgit v1.2.3-70-g09d2 From 343d8c89b4c62d4d0d8505ce172a749abc6b78fc Mon Sep 17 00:00:00 2001 From: angelosa Date: Fri, 5 Feb 2016 00:29:12 +0100 Subject: Basic outputs, nw --- src/mame/drivers/nightgal.cpp | 59 ++++++++++--------------------------------- 1 file changed, 14 insertions(+), 45 deletions(-) diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 4ab807c8745..1150cc05c45 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -90,6 +90,7 @@ public: DECLARE_WRITE8_MEMBER(mux_w); DECLARE_READ8_MEMBER(input_1p_r); DECLARE_READ8_MEMBER(input_2p_r); + DECLARE_WRITE8_MEMBER(output_w); DECLARE_DRIVER_INIT(ngalsumr); DECLARE_DRIVER_INIT(royalqn); virtual void machine_start() override; @@ -514,53 +515,23 @@ READ8_MEMBER(nightgal_state::input_2p_r) m_io_pl2_4->read() & m_io_pl2_5->read() & m_io_pl2_6->read()) | coin_port; } +WRITE8_MEMBER(nightgal_state::output_w) +{ + /* + Doesn't match Charles notes? + --x- ---- unknown, set by Royal Queen on gameplay + ---- -x-- flip screen + ---- ---x out counter + */ + machine().bookkeeping().coin_counter_w(0, data & 0x02); +} + /******************************************** * * Memory Maps * ********************************************/ -/******************************** -* Night Gal -********************************/ -#ifdef UNUSED_CODE -static ADDRESS_MAP_START( nightgal_map, AS_PROGRAM, 8, nightgal_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0xc100, 0xc100) AM_READ(nsc_latch_r) - AM_RANGE(0xc200, 0xc200) AM_WRITE(nsc_latch_w) - AM_RANGE(0xc300, 0xc30f) AM_WRITE(blit_vregs_w) - AM_RANGE(0xf000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( nightgal_io, AS_IO, 8, nightgal_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x01,0x01) AM_DEVREAD("aysnd", ay8910_device, data_r) - AM_RANGE(0x02,0x03) AM_DEVWRITE("aysnd", ay8910_device, data_address_w) -// AM_RANGE(0x10,0x10) AM_WRITE(output_w) - AM_RANGE(0x10,0x10) AM_READ_PORT("DSWC") - AM_RANGE(0x11,0x11) AM_READ_PORT("SYSA") - AM_RANGE(0x12,0x12) AM_READ_PORT("DSWA") - AM_RANGE(0x13,0x13) AM_READ_PORT("DSWB") - AM_RANGE(0x11,0x11) AM_WRITE(mux_w) - AM_RANGE(0x12,0x14) AM_WRITE(blitter_w) //data for the nsc to be processed -ADDRESS_MAP_END - -static ADDRESS_MAP_START( nsc_map, AS_PROGRAM, 8, nightgal_state ) - AM_RANGE(0x0000, 0x007f) AM_RAM - AM_RANGE(0x0080, 0x0080) AM_READ(blitter_status_r) - AM_RANGE(0x0081, 0x0083) AM_READ(nsc_blit_r) - AM_RANGE(0x0080, 0x0086) AM_WRITE(nsc_true_blitter_w) - - AM_RANGE(0x00a0, 0x00af) AM_WRITE(blit_true_vregs_w) - - AM_RANGE(0x1100, 0x1100) AM_READWRITE(z80_latch_r,z80_latch_w) //irq control? - AM_RANGE(0x1200, 0x1200) AM_READNOP //flip screen set bit - AM_RANGE(0x1300, 0x130f) AM_READ(blit_vregs_r) -// AM_RANGE(0x1000, 0xdfff) AM_ROM AM_REGION("gfx1", 0 ) - AM_RANGE(0xe000, 0xffff) AM_ROM AM_WRITENOP -ADDRESS_MAP_END -#endif - /******************************** * Sexy Gal ********************************/ @@ -575,8 +546,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sexygal_io, AS_IO, 8, nightgal_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00,0x01) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) -// AM_RANGE(0x10,0x10) AM_WRITE(output_w) - AM_RANGE(0x10,0x10) AM_READ_PORT("DSWC") + AM_RANGE(0x10,0x10) AM_READ_PORT("DSWC") AM_WRITE(output_w) AM_RANGE(0x11,0x11) AM_READ_PORT("SYSA") AM_WRITE(mux_w) AM_RANGE(0x12,0x12) AM_MIRROR(0xe8) AM_READ_PORT("DSWA") AM_WRITE(royalqn_blitter_0_w) AM_RANGE(0x13,0x13) AM_MIRROR(0xe8) AM_READ_PORT("DSWB") AM_WRITE(royalqn_blitter_1_w) @@ -611,7 +581,7 @@ static ADDRESS_MAP_START( royalqn_io, AS_IO, 8, nightgal_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x01,0x01) AM_MIRROR(0xec) AM_DEVREAD("aysnd", ay8910_device, data_r) AM_RANGE(0x02,0x03) AM_MIRROR(0xec) AM_DEVWRITE("aysnd", ay8910_device, data_address_w) - AM_RANGE(0x10,0x10) AM_MIRROR(0xe8) AM_READ_PORT("DSWC") AM_WRITENOP //AM_WRITE(output_w) + AM_RANGE(0x10,0x10) AM_MIRROR(0xe8) AM_READ_PORT("DSWC") AM_WRITE(output_w) AM_RANGE(0x11,0x11) AM_MIRROR(0xe8) AM_READ_PORT("SYSA") AM_WRITE(mux_w) AM_RANGE(0x12,0x12) AM_MIRROR(0xe8) AM_READ_PORT("DSWA") AM_WRITE(royalqn_blitter_0_w) AM_RANGE(0x13,0x13) AM_MIRROR(0xe8) AM_READ_PORT("DSWB") AM_WRITE(royalqn_blitter_1_w) @@ -912,7 +882,6 @@ static MACHINE_CONFIG_START( royalqn, nightgal_state ) MCFG_QUANTUM_PERFECT_CPU("maincpu") /* video hardware */ - /* TODO: blitter clock is MASTER_CLOCK / 4, 320 x 264 pixels, 256 x 224 of visible area */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4,320,0,256,264,16,240) MCFG_SCREEN_UPDATE_DRIVER(nightgal_state, screen_update_nightgal) -- cgit v1.2.3-70-g09d2 From 99d0ae34cc1dd819b57f56cc1df5876f1dacc291 Mon Sep 17 00:00:00 2001 From: Justin Kerk Date: Thu, 4 Feb 2016 20:37:36 -0800 Subject: Add a document with Emscripten build instructions --- docs/emscripten.txt | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docs/emscripten.txt diff --git a/docs/emscripten.txt b/docs/emscripten.txt new file mode 100644 index 00000000000..dbc8bd5ad48 --- /dev/null +++ b/docs/emscripten.txt @@ -0,0 +1,60 @@ +Compiling MAME to JavaScript via Emscripten +=========================================== + +First, download and install Emscripten by following the instructions at the +official site: + +https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html + +Once Emscripten has been installed, it should be possible to compile MAME +out-of-the-box using Emscripten's 'emmake' tool. Because a full MAME compile is +too large to load into a web browser at once, you will want to use the SOURCES +parameter to compile only a subset of the project, e.g. (in the mame directory): + +emmake make SUBTARGET=pacmantest SOURCES=src/mame/drivers/pacman.cpp + +The SOURCES parameter should have the path to at least one driver .cpp file. +The make process will attempt to locate and include all dependencies necessary +to produce a complete build including the specified driver(s). However, +sometimes it is necessary to manually specify additional files (using commas) if +this process misses something. E.g.: + +emmake make SUBTARGET=apple2e SOURCES=src/mame/drivers/apple2e.cpp,src/mame/machine/applefdc.cpp + +The value of the SUBTARGET parameter serves only to differentiate multiple +builds and need not be set to any specific value. + +Other make parameters can also be used, e.g. -j for multithreaded compilation. + +When the compilation reaches the emcc phase, you may see a number of "unresolved +symbol" warnings. At the moment, this is expected for OpenGL-related functions +such as glPointSize. Any others may indicate that an additional dependency file +needs to be specified in the SOURCES list. Unfortunately this process is not +automated and you will need to search the source tree to locate the files +supplying the missing symbols. You may also be able to get away with ignoring +the warnings if the code path referencing them is not used at run-time. + +If all goes well, a .js file will be output to the current directory. This file +cannot be run by itself, but requires an HTML loader to provide it with a canvas +to output to and pass in command-line parameters. The Emularity project provides +such a loader: + +https://github.com/db48x/emularity + +There are example .html files in that repository which can be edited to point +to your newly compiled MAME js filename and pass in whatever parameters you +desire. You will then need to place all of the following on a web server: + +* The compiled MAME .js file +* The .js files from the Emularity package (loader.js, browserfs.js, etc.) +* A .zip file with the ROMs for the MAME driver you would like to run (if any) +* Any software files you would like to run with the MAME driver +* An Emularity loader .html modified to point to all of the above + +You need to use a web server instead of opening the local files directly due to +security restrictions in modern web browsers. + +If the result fails to run, you can open the Web Console in your browser to see +any error output which may have been produced (e.g. missing or incorrect ROM +files). A "ReferenceError: foo is not defined" error most likely indicates that +a needed source file was omitted from the SOURCES list. -- cgit v1.2.3-70-g09d2 From 0528787f136fc50806acd96c26fc37263ca90e08 Mon Sep 17 00:00:00 2001 From: MetalliC <0vetal0@gmail.com> Date: Fri, 5 Feb 2016 07:54:17 +0200 Subject: KOF NW notes (nw) --- src/mame/drivers/naomi.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp index e17a52f7b52..5d3ad6a30b6 100644 --- a/src/mame/drivers/naomi.cpp +++ b/src/mame/drivers/naomi.cpp @@ -377,7 +377,7 @@ Airline Pilots (Rev A) 840-0005C 21739A 11 (64Mb) Cosmic Smash 840-0044C 23428 8 (64Mb) ? 315-6213 317-0289-COM joystick + 2 buttons Cosmic Smash (Rev A) 840-0044C 23428A 8 (64Mb) ? 315-6213 317-0289-COM joystick + 2 buttons Crazy Taxi 840-0002C 21684 13 (64Mb)* present 315-6213 317-0248-COM * ic8 and ic9 are not present -Dead Or Alive 2 (Rev A) 841-0003C 22121a 21 (64Mb) present 315-6213 317-5048-COM joystick + 3 buttons +Dead Or Alive 2 (Rev A) 841-0003C 22121A 21 (64Mb) present 315-6213 317-5048-COM joystick + 3 buttons Dead Or Alive 2 Millennium 841-0003C DOA2 M 21 (64Mb) present 315-6213 317-5048-COM joystick + 3 buttons Death Crimson OX 841-0016C 23524 10 (64Mb) present 315-6213 317-5066-COM Dengen Tenshi Taisen Janshi Shangri-La 841-0004C 22060 12 (64Mb) ? 315-6213 317-5050-JPN @@ -9030,6 +9030,9 @@ ROM_START( ngbc ) ROM_LOAD( "ax3301f01.bin", 0, 4, CRC(9afe949b) SHA1(4f7b039f3287da61a53a2d012993bfb57e1459bd) ) ROM_END +// note: it looks there no regional differences in KOF NW EN and JP cartridge dumps, possible JP is just newer revision + +// Build: Jul 2004 ROM_START( kofnw ) AW_BIOS @@ -9046,6 +9049,7 @@ ROM_START( kofnw ) ROM_LOAD( "ax2201f01.bin", 0, 4, CRC(b1fff0c8) SHA1(d83177e3672378a2bbc08653b4b73704333ca30a) ) ROM_END +// Build: Sep 2004 ROM_START( kofnwj ) AW_BIOS -- cgit v1.2.3-70-g09d2 From 58e91294b3601eb6490252d8b616fce2e23726f0 Mon Sep 17 00:00:00 2001 From: Jean-François DEL NERO Date: Fri, 5 Feb 2016 07:52:33 +0100 Subject: Software list removed. --- src/mame/drivers/goupil.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mame/drivers/goupil.cpp b/src/mame/drivers/goupil.cpp index 791bb991042..8d71443a39b 100644 --- a/src/mame/drivers/goupil.cpp +++ b/src/mame/drivers/goupil.cpp @@ -464,7 +464,6 @@ static MACHINE_CONFIG_START( goupil_g1, goupil_g1_state ) MCFG_FD1791_ADD("fd1791", XTAL_8MHz ) MCFG_FLOPPY_DRIVE_ADD("fd1791:0", goupil_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fd1791:1", goupil_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_SOFTWARE_LIST_ADD("flop525_list", "goupil") MCFG_DEVICE_ADD("i8279_kb1", I8279, CPU_CLOCK) MCFG_I8279_OUT_SL_CB(WRITE8(goupil_g1_state, scanlines_kbd1_w)) // scan SL lines -- cgit v1.2.3-70-g09d2 From 9a28da4f7324d5a89ed5c7b5e7e78a51cbd8d448 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 5 Feb 2016 08:53:00 +0100 Subject: added UI parameter, option simple gives back old style start screen, features for configuration and in game stays same as with new (nw) --- scripts/src/emu.lua | 2 + src/emu/drivers/empty.cpp | 7 +- src/emu/emuopts.cpp | 1 + src/emu/emuopts.h | 2 + src/emu/ui/mainmenu.cpp | 7 +- src/emu/ui/optsmenu.cpp | 113 +++++------ src/emu/ui/simpleselgame.cpp | 443 +++++++++++++++++++++++++++++++++++++++++++ src/emu/ui/simpleselgame.h | 47 +++++ 8 files changed, 565 insertions(+), 57 deletions(-) create mode 100644 src/emu/ui/simpleselgame.cpp create mode 100644 src/emu/ui/simpleselgame.h diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index 8043384a5a2..b49756676ce 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -264,6 +264,8 @@ files { MAME_DIR .. "src/emu/ui/selector.h", MAME_DIR .. "src/emu/ui/selgame.cpp", MAME_DIR .. "src/emu/ui/selgame.h", + MAME_DIR .. "src/emu/ui/simpleselgame.cpp", + MAME_DIR .. "src/emu/ui/simpleselgame.h", MAME_DIR .. "src/emu/ui/selsoft.cpp", MAME_DIR .. "src/emu/ui/selsoft.h", MAME_DIR .. "src/emu/ui/sndmenu.cpp", diff --git a/src/emu/drivers/empty.cpp b/src/emu/drivers/empty.cpp index 9c48a6c8b26..be4f53b24a7 100644 --- a/src/emu/drivers/empty.cpp +++ b/src/emu/drivers/empty.cpp @@ -11,6 +11,7 @@ #include "emu.h" #include "render.h" #include "ui/selgame.h" +#include "ui/simpleselgame.h" //************************************************************************** @@ -29,7 +30,11 @@ public: virtual void machine_start() override { // force the UI to show the game select screen - ui_menu_select_game::force_game_select(machine(), &machine().render().ui_container()); + if (strcmp(machine().options().ui(),"simple")==0) { + ui_simple_menu_select_game::force_game_select(machine(), &machine().render().ui_container()); + } else { + ui_menu_select_game::force_game_select(machine(), &machine().render().ui_container()); + } } UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index d67e99997cc..64e0856761b 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -180,6 +180,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_CHEAT ";c", "0", OPTION_BOOLEAN, "enable cheat subsystem" }, { OPTION_SKIP_GAMEINFO, "0", OPTION_BOOLEAN, "skip displaying the information screen at startup" }, { OPTION_UI_FONT, "default", OPTION_STRING, "specify a font to use" }, + { OPTION_UI, "cabinet", OPTION_STRING, "type of UI (simple|cabinet)" }, { OPTION_RAMSIZE ";ram", nullptr, OPTION_STRING, "size of RAM (if supported by driver)" }, { OPTION_CONFIRM_QUIT, "0", OPTION_BOOLEAN, "display confirm quit screen on exit" }, { OPTION_UI_MOUSE, "1", OPTION_BOOLEAN, "display ui mouse cursor" }, diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index 44ee7165df5..05baaab650f 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -175,6 +175,7 @@ enum #define OPTION_CHEAT "cheat" #define OPTION_SKIP_GAMEINFO "skip_gameinfo" #define OPTION_UI_FONT "uifont" +#define OPTION_UI "ui" #define OPTION_RAMSIZE "ramsize" // core comm options @@ -350,6 +351,7 @@ public: bool cheat() const { return bool_value(OPTION_CHEAT); } bool skip_gameinfo() const { return bool_value(OPTION_SKIP_GAMEINFO); } const char *ui_font() const { return value(OPTION_UI_FONT); } + const char *ui() const { return value(OPTION_UI); } const char *ram_size() const { return value(OPTION_RAMSIZE); } // core comm options diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp index 8891c7a6324..1bc023f7562 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/emu/ui/mainmenu.cpp @@ -23,6 +23,7 @@ #include "ui/mainmenu.h" #include "ui/miscmenu.h" #include "ui/selgame.h" +#include "ui/simpleselgame.h" #include "ui/sliders.h" #include "ui/slotopt.h" #include "ui/tapectrl.h" @@ -284,7 +285,11 @@ void ui_menu_main::handle() break; case SELECT_GAME: - ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); + if (strcmp(machine().options().ui(),"simple")==0) { + ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); + } else { + ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); + } break; case BIOS_SELECTION: diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp index 4f19a6d1c1d..82cf7b8d42c 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/emu/ui/optsmenu.cpp @@ -217,65 +217,68 @@ void ui_menu_game_options::handle() void ui_menu_game_options::populate() { - // set filter arrow - std::string fbuff; + if (strcmp(machine().options().ui(),"simple")!=0) + { + // set filter arrow + std::string fbuff; - // add filter item - UINT32 arrow_flags = get_arrow_flags((int)FILTER_FIRST, (int)FILTER_LAST, main_filters::actual); - item_append("Filter", main_filters::text[main_filters::actual], arrow_flags, (void *)(FPTR)FILTER_MENU); + // add filter item + UINT32 arrow_flags = get_arrow_flags((int)FILTER_FIRST, (int)FILTER_LAST, main_filters::actual); + item_append("Filter", main_filters::text[main_filters::actual], arrow_flags, (void *)(FPTR)FILTER_MENU); - // add category subitem - if (main_filters::actual == FILTER_CATEGORY && !machine().inifile().ini_index.empty()) - { - inifile_manager &inif = machine().inifile(); - int afile = inif.current_file; - - arrow_flags = get_arrow_flags(0, inif.ini_index.size() - 1, afile); - fbuff = " ^!File"; - convert_command_glyph(fbuff); - item_append(fbuff.c_str(), inif.actual_file().c_str(), arrow_flags, (void *)(FPTR)FILE_CATEGORY_FILTER); - - arrow_flags = get_arrow_flags(0, inif.ini_index[afile].category.size() - 1, inif.current_category); - fbuff = " ^!Category"; - convert_command_glyph(fbuff); - item_append(fbuff.c_str(), inif.actual_category().c_str(), arrow_flags, (void *)(FPTR)CATEGORY_FILTER); - } - // add manufacturer subitem - else if (main_filters::actual == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0) - { - arrow_flags = get_arrow_flags(0, c_mnfct::ui.size() - 1, c_mnfct::actual); - fbuff = "^!Manufacturer"; - convert_command_glyph(fbuff); - item_append(fbuff.c_str(), c_mnfct::ui[c_mnfct::actual].c_str(), arrow_flags, (void *)(FPTR)MANUFACT_CAT_FILTER); - } - // add year subitem - else if (main_filters::actual == FILTER_YEAR && c_year::ui.size() > 0) - { - arrow_flags = get_arrow_flags(0, c_year::ui.size() - 1, c_year::actual); - fbuff.assign("^!Year"); - convert_command_glyph(fbuff); - item_append(fbuff.c_str(), c_year::ui[c_year::actual].c_str(), arrow_flags, (void *)(FPTR)YEAR_CAT_FILTER); - } - // add screen subitem - else if (main_filters::actual == FILTER_SCREEN) - { - arrow_flags = get_arrow_flags(0, screen_filters::length - 1, screen_filters::actual); - fbuff = "^!Screen type"; - convert_command_glyph(fbuff); - item_append(fbuff.c_str(), screen_filters::text[screen_filters::actual], arrow_flags, (void *)(FPTR)SCREEN_CAT_FILTER); - } - // add custom subitem - else if (main_filters::actual == FILTER_CUSTOM) - { - fbuff = "^!Setup custom filter"; - convert_command_glyph(fbuff); - item_append(fbuff.c_str(), nullptr, 0, (void *)(FPTR)CUSTOM_FILTER); - } + // add category subitem + if (main_filters::actual == FILTER_CATEGORY && !machine().inifile().ini_index.empty()) + { + inifile_manager &inif = machine().inifile(); + int afile = inif.current_file; + + arrow_flags = get_arrow_flags(0, inif.ini_index.size() - 1, afile); + fbuff = " ^!File"; + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), inif.actual_file().c_str(), arrow_flags, (void *)(FPTR)FILE_CATEGORY_FILTER); + + arrow_flags = get_arrow_flags(0, inif.ini_index[afile].category.size() - 1, inif.current_category); + fbuff = " ^!Category"; + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), inif.actual_category().c_str(), arrow_flags, (void *)(FPTR)CATEGORY_FILTER); + } + // add manufacturer subitem + else if (main_filters::actual == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0) + { + arrow_flags = get_arrow_flags(0, c_mnfct::ui.size() - 1, c_mnfct::actual); + fbuff = "^!Manufacturer"; + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), c_mnfct::ui[c_mnfct::actual].c_str(), arrow_flags, (void *)(FPTR)MANUFACT_CAT_FILTER); + } + // add year subitem + else if (main_filters::actual == FILTER_YEAR && c_year::ui.size() > 0) + { + arrow_flags = get_arrow_flags(0, c_year::ui.size() - 1, c_year::actual); + fbuff.assign("^!Year"); + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), c_year::ui[c_year::actual].c_str(), arrow_flags, (void *)(FPTR)YEAR_CAT_FILTER); + } + // add screen subitem + else if (main_filters::actual == FILTER_SCREEN) + { + arrow_flags = get_arrow_flags(0, screen_filters::length - 1, screen_filters::actual); + fbuff = "^!Screen type"; + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), screen_filters::text[screen_filters::actual], arrow_flags, (void *)(FPTR)SCREEN_CAT_FILTER); + } + // add custom subitem + else if (main_filters::actual == FILTER_CUSTOM) + { + fbuff = "^!Setup custom filter"; + convert_command_glyph(fbuff); + item_append(fbuff.c_str(), nullptr, 0, (void *)(FPTR)CUSTOM_FILTER); + } - item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - // add options items - item_append("Customize UI", nullptr, 0, (void *)(FPTR)CUSTOM_MENU); + // add options items + item_append("Customize UI", nullptr, 0, (void *)(FPTR)CUSTOM_MENU); + } item_append("Display Options", nullptr, 0, (void *)(FPTR)DISPLAY_MENU); item_append("Sound Options", nullptr, 0, (void *)(FPTR)SOUND_MENU); item_append("Miscellaneous Options", nullptr, 0, (void *)(FPTR)MISC_MENU); diff --git a/src/emu/ui/simpleselgame.cpp b/src/emu/ui/simpleselgame.cpp new file mode 100644 index 00000000000..0c96ff4022d --- /dev/null +++ b/src/emu/ui/simpleselgame.cpp @@ -0,0 +1,443 @@ +// license:BSD-3-Clause +// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods +/*************************************************************************** + + ui/simpleselgame.c + + Game selector + +***************************************************************************/ + +#include "emu.h" +#include "emuopts.h" +#include "ui/ui.h" +#include "ui/menu.h" +#include "uiinput.h" +#include "ui/simpleselgame.h" +#include "ui/inputmap.h" +#include "ui/miscmenu.h" +#include "ui/optsmenu.h" +#include "audit.h" +#include + + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +ui_simple_menu_select_game::ui_simple_menu_select_game(running_machine &machine, render_container *container, const char *gamename) : ui_menu(machine, container), m_driverlist(driver_list::total() + 1) +{ + build_driver_list(); + if(gamename) + strcpy(m_search, gamename); + m_matchlist[0] = -1; +} + + +//------------------------------------------------- +// dtor +//------------------------------------------------- + +ui_simple_menu_select_game::~ui_simple_menu_select_game() +{ +} + + + +//------------------------------------------------- +// build_driver_list - build a list of available +// drivers +//------------------------------------------------- + +void ui_simple_menu_select_game::build_driver_list() +{ + // start with an empty list + m_drivlist = std::make_unique(machine().options()); + m_drivlist->exclude_all(); + + // open a path to the ROMs and find them in the array + file_enumerator path(machine().options().media_path()); + const osd_directory_entry *dir; + + // iterate while we get new objects + while ((dir = path.next()) != nullptr) + { + char drivername[50]; + char *dst = drivername; + const char *src; + + // build a name for it + for (src = dir->name; *src != 0 && *src != '.' && dst < &drivername[ARRAY_LENGTH(drivername) - 1]; src++) + *dst++ = tolower((UINT8)*src); + *dst = 0; + + int drivnum = m_drivlist->find(drivername); + if (drivnum != -1) + m_drivlist->include(drivnum); + } + + // now build the final list + m_drivlist->reset(); + int listnum = 0; + while (m_drivlist->next()) + m_driverlist[listnum++] = &m_drivlist->driver(); + + // NULL-terminate + m_driverlist[listnum] = nullptr; +} + + + +//------------------------------------------------- +// handle - handle the game select menu +//------------------------------------------------- + +void ui_simple_menu_select_game::handle() +{ + // ignore pause keys by swallowing them before we process the menu + machine().ui_input().pressed(IPT_UI_PAUSE); + + // process the menu + const ui_menu_event *menu_event = process(0); + if (menu_event != nullptr && menu_event->itemref != nullptr) + { + // reset the error on any future menu_event + if (m_error) + m_error = false; + + // handle selections + else + { + switch(menu_event->iptkey) + { + case IPT_UI_SELECT: + inkey_select(menu_event); + break; + case IPT_UI_CANCEL: + inkey_cancel(menu_event); + break; + case IPT_SPECIAL: + inkey_special(menu_event); + break; + } + } + } + + // if we're in an error state, overlay an error message + if (m_error) + machine().ui().draw_text_box(container, + "The selected game is missing one or more required ROM or CHD images. " + "Please select a different game.\n\nPress any key to continue.", + JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); +} + + +//------------------------------------------------- +// inkey_select +//------------------------------------------------- + +void ui_simple_menu_select_game::inkey_select(const ui_menu_event *menu_event) +{ + const game_driver *driver = (const game_driver *)menu_event->itemref; + + // special case for configure inputs + if ((FPTR)driver == 1) + ui_menu::stack_push(global_alloc_clear(machine(), container)); + + // anything else is a driver + else + { + // audit the game first to see if we're going to work + driver_enumerator enumerator(machine().options(), *driver); + enumerator.next(); + media_auditor auditor(enumerator); + media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST); + + // if everything looks good, schedule the new driver + if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + { + machine().manager().schedule_new_driver(*driver); + machine().schedule_hard_reset(); + ui_menu::stack_reset(machine()); + } + + // otherwise, display an error + else + { + reset(UI_MENU_RESET_REMEMBER_REF); + m_error = true; + } + } +} + + +//------------------------------------------------- +// inkey_cancel +//------------------------------------------------- + +void ui_simple_menu_select_game::inkey_cancel(const ui_menu_event *menu_event) +{ + // escape pressed with non-empty text clears the text + if (m_search[0] != 0) + { + // since we have already been popped, we must recreate ourself from scratch + ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); + } +} + + +//------------------------------------------------- +// inkey_special - typed characters append to the buffer +//------------------------------------------------- + +void ui_simple_menu_select_game::inkey_special(const ui_menu_event *menu_event) +{ + // typed characters append to the buffer + int buflen = strlen(m_search); + + // if it's a backspace and we can handle it, do so + if ((menu_event->unichar == 8 || menu_event->unichar == 0x7f) && buflen > 0) + { + *(char *)utf8_previous_char(&m_search[buflen]) = 0; + m_rerandomize = true; + reset(UI_MENU_RESET_SELECT_FIRST); + } + + // if it's any other key and we're not maxed out, update + else if (menu_event->unichar >= ' ' && menu_event->unichar < 0x7f) + { + buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, menu_event->unichar); + m_search[buflen] = 0; + reset(UI_MENU_RESET_SELECT_FIRST); + } +} + + +//------------------------------------------------- +// populate - populate the game select menu +//------------------------------------------------- + +void ui_simple_menu_select_game::populate() +{ + int matchcount; + int curitem; + + for (curitem = matchcount = 0; m_driverlist[curitem] != nullptr && matchcount < VISIBLE_GAMES_IN_LIST; curitem++) + if (!(m_driverlist[curitem]->flags & MACHINE_NO_STANDALONE)) + matchcount++; + + // if nothing there, add a single multiline item and return + if (matchcount == 0) + { + std::string txt; + strprintf(txt, "No %s found. Please check the rompath specified in the %s.ini file.\n\n" + "If this is your first time using %s, please see the config.txt file in " + "the docs directory for information on configuring %s.", + emulator_info::get_gamesnoun(), + emulator_info::get_configname(), + emulator_info::get_appname(),emulator_info::get_appname() ); + item_append(txt.c_str(), nullptr, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, nullptr); + return; + } + + // otherwise, rebuild the match list + assert(m_drivlist != nullptr); + if (m_search[0] != 0 || m_matchlist[0] == -1 || m_rerandomize) + m_drivlist->find_approximate_matches(m_search, matchcount, m_matchlist); + m_rerandomize = false; + + // iterate over entries + for (curitem = 0; curitem < matchcount; curitem++) + { + int curmatch = m_matchlist[curitem]; + if (curmatch != -1) + { + int cloneof = m_drivlist->non_bios_clone(curmatch); + item_append(m_drivlist->driver(curmatch).name, m_drivlist->driver(curmatch).description, (cloneof == -1) ? 0 : MENU_FLAG_INVERT, (void *)&m_drivlist->driver(curmatch)); + } + } + + // if we're forced into this, allow general input configuration as well + if (ui_menu::stack_has_special_main_menu()) + { + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + item_append("Configure Options", nullptr, 0, (void *)1); + } + + // configure the custom rendering + customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + custombottom = 4.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; +} + + +//------------------------------------------------- +// custom_render - perform our special rendering +//------------------------------------------------- + +void ui_simple_menu_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +{ + const game_driver *driver; + float width, maxwidth; + float x1, y1, x2, y2; + std::string tempbuf[5]; + rgb_t color; + int line; + + // display the current typeahead + if (m_search[0] != 0) + strprintf(tempbuf[0], "Type name or select: %s_", m_search); + else + strprintf(tempbuf[0],"Type name or select: (random)"); + + // get the size of the text + machine().ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(width, origx2 - origx1); + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = origy1 - top; + y2 = origy1 - UI_BOX_TB_BORDER; + + // draw a box + machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw the text within it + machine().ui().draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + + // determine the text to render below + driver = ((FPTR)selectedref > 1) ? (const game_driver *)selectedref : nullptr; + if ((FPTR)driver > 1) + { + const char *gfxstat, *soundstat; + + // first line is game name + strprintf(tempbuf[0],"%-.100s", driver->description); + + // next line is year, manufacturer + strprintf(tempbuf[1], "%s, %-.100s", driver->year, driver->manufacturer); + + // next line source path + strprintf(tempbuf[2],"Driver: %-.100s", core_filename_extract_base(driver->source_file).c_str()); + + // next line is overall driver status + if (driver->flags & MACHINE_NOT_WORKING) + tempbuf[3].assign("Overall: NOT WORKING"); + else if (driver->flags & MACHINE_UNEMULATED_PROTECTION) + tempbuf[3].assign("Overall: Unemulated Protection"); + else + tempbuf[3].assign("Overall: Working"); + + // next line is graphics, sound status + if (driver->flags & (MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_COLORS)) + gfxstat = "Imperfect"; + else + gfxstat = "OK"; + + if (driver->flags & MACHINE_NO_SOUND) + soundstat = "Unimplemented"; + else if (driver->flags & MACHINE_IMPERFECT_SOUND) + soundstat = "Imperfect"; + else + soundstat = "OK"; + + strprintf(tempbuf[4], "Gfx: %s, Sound: %s", gfxstat, soundstat); + } + else + { + const char *s = emulator_info::get_copyright(); + line = 0; + + // first line is version string + strprintf(tempbuf[line++], "%s %s", emulator_info::get_appname(), build_version); + + // output message + while (line < ARRAY_LENGTH(tempbuf)) + { + if (!(*s == 0 || *s == '\n')) + tempbuf[line].push_back(*s); + + if (*s == '\n') + { + line++; + s++; + } else if (*s != 0) + s++; + else + line++; + } + } + + // get the size of the text + maxwidth = origx2 - origx1; + for (line = 0; line < 4; line++) + { + machine().ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(maxwidth, width); + } + + // compute our bounds + x1 = 0.5f - 0.5f * maxwidth; + x2 = x1 + maxwidth; + y1 = origy2 + UI_BOX_TB_BORDER; + y2 = origy2 + bottom; + + // draw a box + color = UI_BACKGROUND_COLOR; + if (driver != nullptr) + color = UI_GREEN_COLOR; + if (driver != nullptr && (driver->flags & (MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_COLORS | MACHINE_NO_SOUND | MACHINE_IMPERFECT_SOUND)) != 0) + color = UI_YELLOW_COLOR; + if (driver != nullptr && (driver->flags & (MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION)) != 0) + color = UI_RED_COLOR; + machine().ui().draw_outlined_box(container, x1, y1, x2, y2, color); + + // take off the borders + x1 += UI_BOX_LR_BORDER; + x2 -= UI_BOX_LR_BORDER; + y1 += UI_BOX_TB_BORDER; + + // draw all lines + for (line = 0; line < 4; line++) + { + machine().ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + y1 += machine().ui().get_line_height(); + } +} + + +//------------------------------------------------- +// force_game_select - force the game +// select menu to be visible and inescapable +//------------------------------------------------- + +void ui_simple_menu_select_game::force_game_select(running_machine &machine, render_container *container) +{ + char *gamename = (char *)machine.options().system_name(); + + // reset the menu stack + ui_menu::stack_reset(machine); + + // add the quit entry followed by the game select entry + ui_menu *quit = global_alloc_clear(machine, container); + quit->set_special_main_menu(true); + ui_menu::stack_push(quit); + ui_menu::stack_push(global_alloc_clear(machine, container, gamename)); + + // force the menus on + machine.ui().show_menu(); + + // make sure MAME is paused + machine.pause(); +} diff --git a/src/emu/ui/simpleselgame.h b/src/emu/ui/simpleselgame.h new file mode 100644 index 00000000000..50fcf10a432 --- /dev/null +++ b/src/emu/ui/simpleselgame.h @@ -0,0 +1,47 @@ +// license:BSD-3-Clause +// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods +/*************************************************************************** + + ui/selgame.h + + Game selector + +***************************************************************************/ + +#pragma once + +#ifndef __UI_SIMPLESELGAME_H__ +#define __UI_SIMPLESELGAME_H__ + +#include "drivenum.h" +#include "menu.h" + +class ui_simple_menu_select_game : public ui_menu { +public: + ui_simple_menu_select_game(running_machine &machine, render_container *container, const char *gamename); + virtual ~ui_simple_menu_select_game(); + virtual void populate() override; + virtual void handle() override; + virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; + + // force game select menu + static void force_game_select(running_machine &machine, render_container *container); + +private: + // internal state + enum { VISIBLE_GAMES_IN_LIST = 15 }; + UINT8 m_error; + bool m_rerandomize; + char m_search[40]; + int m_matchlist[VISIBLE_GAMES_IN_LIST]; + std::vector m_driverlist; + std::unique_ptr m_drivlist; + + // internal methods + void build_driver_list(); + void inkey_select(const ui_menu_event *menu_event); + void inkey_cancel(const ui_menu_event *menu_event); + void inkey_special(const ui_menu_event *menu_event); +}; + +#endif /* __UI_SELGAME_H__ */ -- cgit v1.2.3-70-g09d2 From d0162765cdd23c2cb015118b75c87689a839de40 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 5 Feb 2016 14:24:17 +0100 Subject: Keep ui options separate from emulator ini file. (nw) TODO: Need fixing saving of some core settings that could be changed by UI --- src/emu/emuopts.cpp | 2 +- src/emu/emuopts.h | 11 +++++------ src/emu/machine.cpp | 7 ++++--- src/emu/ui/auditmenu.cpp | 2 +- src/emu/ui/custmenu.cpp | 4 ++-- src/emu/ui/custui.cpp | 10 +++++----- src/emu/ui/datfile.cpp | 5 +++-- src/emu/ui/dirmenu.cpp | 2 +- src/emu/ui/inifile.cpp | 9 +++++---- src/emu/ui/mainmenu.cpp | 12 ++++++------ src/emu/ui/menu.cpp | 16 ++++++++-------- src/emu/ui/optsmenu.cpp | 12 ++++++------ src/emu/ui/optsmenu.h | 2 +- src/emu/ui/selgame.cpp | 32 ++++++++++++++++---------------- src/emu/ui/selsoft.cpp | 12 ++++++------ src/emu/ui/ui.cpp | 47 +++++++++++++++++++++++++++++++++++------------ src/emu/ui/ui.h | 8 ++++++-- 17 files changed, 111 insertions(+), 82 deletions(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 64e0856761b..9081f996e6d 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -202,7 +202,7 @@ const options_entry emu_options::s_option_entries[] = //------------------------------------------------- emu_options::emu_options() -: ui_options() +: core_options() , m_coin_impulse(0) , m_joystick_contradictory(false) , m_sleep(true) diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index 05baaab650f..dc5acbb7849 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -13,8 +13,7 @@ #ifndef __EMUOPTS_H__ #define __EMUOPTS_H__ -#include "ui/moptions.h" - +#include "options.h" //************************************************************************** // CONSTANTS @@ -27,7 +26,8 @@ enum OPTION_PRIORITY_CMDLINE = OPTION_PRIORITY_HIGH, // INI-based options are NORMAL priority, in increasing order: - OPTION_PRIORITY_MAME_INI = OPTION_PRIORITY_NORMAL, + OPTION_PRIORITY_INI = OPTION_PRIORITY_NORMAL, + OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DEBUG_INI, OPTION_PRIORITY_ORIENTATION_INI, OPTION_PRIORITY_SYSTYPE_INI, @@ -35,8 +35,7 @@ enum OPTION_PRIORITY_SOURCE_INI, OPTION_PRIORITY_GPARENT_INI, OPTION_PRIORITY_PARENT_INI, - OPTION_PRIORITY_DRIVER_INI, - OPTION_PRIORITY_INI + OPTION_PRIORITY_DRIVER_INI }; // core options @@ -202,7 +201,7 @@ struct game_driver; class software_part; -class emu_options : public ui_options +class emu_options : public core_options { static const UINT32 OPTION_FLAG_DEVICE = 0x80000000; diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index 500a03ba9af..21cc7a54812 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -231,12 +231,13 @@ void running_machine::start() // init the osd layer m_manager.osd().init(*this); - // start the inifile manager - m_inifile = std::make_unique(*this); - // create the video manager m_video = std::make_unique(*this); m_ui = std::make_unique(*this); + m_ui->init(); + + // start the inifile manager + m_inifile = std::make_unique(*this); // initialize the base time (needed for doing record/playback) ::time(&m_base_time); diff --git a/src/emu/ui/auditmenu.cpp b/src/emu/ui/auditmenu.cpp index 2cf482d4f8b..8b98f0d70a2 100644 --- a/src/emu/ui/auditmenu.cpp +++ b/src/emu/ui/auditmenu.cpp @@ -173,7 +173,7 @@ void ui_menu_audit::populate() void ui_menu_audit::save_available_machines() { // attempt to open the output file - emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(emulator_info::get_configname(), "_avail.ini") == FILERR_NONE) { // generate header diff --git a/src/emu/ui/custmenu.cpp b/src/emu/ui/custmenu.cpp index 1162ced015b..45ca407a84b 100644 --- a/src/emu/ui/custmenu.cpp +++ b/src/emu/ui/custmenu.cpp @@ -272,7 +272,7 @@ void ui_menu_custom_filter::custom_render(void *selectedref, float top, float bo void ui_menu_custom_filter::save_custom_filters() { // attempt to open the output file - emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == FILERR_NONE) { // generate custom filters info @@ -587,7 +587,7 @@ void ui_menu_swcustom_filter::custom_render(void *selectedref, float top, float void ui_menu_swcustom_filter::save_sw_custom_filters() { // attempt to open the output file - emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open("custom_", m_driver->name, "_filter.ini") == FILERR_NONE) { // generate custom filters info diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index 70176cf4708..b03f51f9122 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -140,10 +140,10 @@ void ui_menu_custom_ui::custom_render(void *selectedref, float top, float bottom ui_menu_font_ui::ui_menu_font_ui(running_machine &machine, render_container *container) : ui_menu(machine, container) { - emu_options &moptions = machine.options(); + ui_options &moptions = machine.ui().options(); #ifdef UI_WINDOWS - std::string name(moptions.ui_font()); + std::string name(machine.options().ui_font()); list(); m_bold = (strreplace(name, "[B]", "") + strreplace(name, "[b]", "") > 0); @@ -163,7 +163,7 @@ ui_menu_font_ui::ui_menu_font_ui(running_machine &machine, render_container *con m_info_size = moptions.infos_size(); m_font_size = moptions.font_rows(); - for (emu_options::entry *f_entry = moptions.first(); f_entry != nullptr; f_entry = f_entry->next()) + for (ui_options::entry *f_entry = moptions.first(); f_entry != nullptr; f_entry = f_entry->next()) { const char *name = f_entry->name(); if (name && strlen(name) && !strcmp(OPTION_INFOS_SIZE, f_entry->name())) @@ -225,7 +225,7 @@ void ui_menu_font_ui::list() ui_menu_font_ui::~ui_menu_font_ui() { std::string error_string; - emu_options &moptions = machine().options(); + ui_options &moptions = machine().ui().options(); #ifdef UI_WINDOWS std::string name(m_fonts[m_actual]); @@ -655,7 +655,7 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom void ui_menu_colors_ui::restore_colors() { - emu_options options; + ui_options options; for (int index = 1; index < MUI_RESTORE; index++) m_color_table[index].color = rgb_t((UINT32)strtoul(options.value(m_color_table[index].option), nullptr, 16)); } diff --git a/src/emu/ui/datfile.cpp b/src/emu/ui/datfile.cpp index b71b326f5e0..5e8af15b335 100644 --- a/src/emu/ui/datfile.cpp +++ b/src/emu/ui/datfile.cpp @@ -10,6 +10,7 @@ #include "emu.h" #include "drivenum.h" +#include "ui/ui.h" #include "ui/datfile.h" #include "ui/utils.h" @@ -56,7 +57,7 @@ bool datfile_manager::first_run = true; //------------------------------------------------- datfile_manager::datfile_manager(running_machine &machine) : m_machine(machine) { - if (machine.options().enabled_dats() && first_run) + if (machine.ui().options().enabled_dats() && first_run) { first_run = false; if (parseopen("mameinfo.dat")) @@ -539,7 +540,7 @@ bool datfile_manager::parseopen(const char *filename) // MAME core file parsing functions fail in recognizing UNICODE chars in UTF-8 without BOM, // so it's better and faster use standard C fileio functions. - emu_file file(machine().options().history_path(), OPEN_FLAG_READ); + emu_file file(machine().ui().options().history_path(), OPEN_FLAG_READ); if (file.open(filename) != FILERR_NONE) return false; diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp index e606732e2db..a180997aa8a 100644 --- a/src/emu/ui/dirmenu.cpp +++ b/src/emu/ui/dirmenu.cpp @@ -326,7 +326,7 @@ ui_menu_directory::ui_menu_directory(running_machine &machine, render_container ui_menu_directory::~ui_menu_directory() { - save_game_options(machine()); + save_ui_options(machine()); ui_globals::reset = true; } diff --git a/src/emu/ui/inifile.cpp b/src/emu/ui/inifile.cpp index 05c5a887933..1c92b43a4d6 100644 --- a/src/emu/ui/inifile.cpp +++ b/src/emu/ui/inifile.cpp @@ -9,6 +9,7 @@ ***************************************************************************/ #include "emu.h" +#include "ui/ui.h" #include "ui/inifile.h" #include "softlist.h" #include "drivenum.h" @@ -38,7 +39,7 @@ inifile_manager::inifile_manager(running_machine &machine) void inifile_manager::directory_scan() { // open extra INIs folder - file_enumerator path(machine().options().extraini_path()); + file_enumerator path(machine().ui().options().extraini_path()); const osd_directory_entry *dir; // loop into folder's file @@ -149,7 +150,7 @@ bool inifile_manager::parseopen(const char *filename) // MAME core file parsing functions fail in recognizing UNICODE chars in UTF-8 without BOM, // so it's better and faster use standard C fileio functions. - emu_file file(machine().options().extraini_path(), OPEN_FLAG_READ); + emu_file file(machine().ui().options().extraini_path(), OPEN_FLAG_READ); if (file.open(filename) != FILERR_NONE) return false; @@ -357,7 +358,7 @@ bool favorite_manager::isgame_favorite(ui_software_info &swinfo) void favorite_manager::parse_favorite() { - emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); + emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_READ); if (file.open(favorite_filename) == FILERR_NONE) { char readbuf[1024]; @@ -416,7 +417,7 @@ void favorite_manager::parse_favorite() void favorite_manager::save_favorite_games() { // attempt to open the output file - emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(favorite_filename) == FILERR_NONE) { if (m_list.empty()) diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp index 1bc023f7562..9ea41a3963d 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/emu/ui/mainmenu.cpp @@ -137,11 +137,11 @@ void ui_menu_main::populate() item_append("Cheat", nullptr, 0, (void *)CHEAT); /* add history menu */ - if (machine().options().enabled_dats()) + if (machine().ui().options().enabled_dats()) item_append("History Info", nullptr, 0, (void *)HISTORY); // add software history menu - if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().options().enabled_dats()) + if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().ui().options().enabled_dats()) { image_interface_iterator iter(machine().root_device()); for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) @@ -156,7 +156,7 @@ void ui_menu_main::populate() } /* add mameinfo / messinfo menu */ - if (machine().options().enabled_dats()) + if (machine().ui().options().enabled_dats()) { if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0) item_append("MameInfo", nullptr, 0, (void *)MAMEINFO); @@ -165,15 +165,15 @@ void ui_menu_main::populate() } /* add sysinfo menu */ - if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().options().enabled_dats()) + if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().ui().options().enabled_dats()) item_append("SysInfo", nullptr, 0, (void *)SYSINFO); /* add command list menu */ - if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().options().enabled_dats()) + if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().ui().options().enabled_dats()) item_append("Commands Info", nullptr, 0, (void *)COMMAND); /* add story menu */ - if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().options().enabled_dats()) + if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().ui().options().enabled_dats()) item_append("Mamescores", nullptr, 0, (void *)STORYINFO); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index d86f69fc4e2..a8ba0d75b04 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -465,7 +465,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) float mouse_x = -1, mouse_y = -1; bool history_flag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); - if (machine().options().use_background_image() && &machine().system() == &GAME_NAME(___empty) && bgrnd_bitmap->valid() && !noimage) + if (machine().ui().options().use_background_image() && &machine().system() == &GAME_NAME(___empty) && bgrnd_bitmap->valid() && !noimage) container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); // compute the width and height of the full menu @@ -1305,7 +1305,7 @@ void ui_menu::init_ui(running_machine &machine) bgrnd_bitmap = std::make_unique(0, 0); bgrnd_texture = mrender.texture_alloc(render_texture::hq_scale); - emu_options &mopt = machine.options(); + ui_options &mopt = machine.ui().options(); if (mopt.use_background_image() && &machine.system() == &GAME_NAME(___empty)) { emu_file backgroundfile(".", OPEN_FLAG_READ); @@ -1372,7 +1372,7 @@ void ui_menu::draw_select_game(bool noinput) ui_manager &mui = machine().ui(); // draw background image if available - if (machine().options().use_background_image() && bgrnd_bitmap->valid()) + if (machine().ui().options().use_background_image() && bgrnd_bitmap->valid()) container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); hover = item.size() + 1; @@ -2207,7 +2207,7 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float int dest_yPixel = tmp_bitmap->height(); // force 4:3 ratio min - if (machine().options().forced_4x3_snapshot() && ratioI < 0.75f && ui_globals::curimage_view == SNAPSHOT_VIEW) + if (machine().ui().options().forced_4x3_snapshot() && ratioI < 0.75f && ui_globals::curimage_view == SNAPSHOT_VIEW) { // smaller ratio will ensure that the image fits in the view dest_yPixel = tmp_bitmap->width() * 0.75f; @@ -2217,7 +2217,7 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float dest_yPixel *= ratio; } // resize the bitmap if necessary - else if (ratioW < 1 || ratioH < 1 || (machine().options().enlarge_snaps() && !no_available)) + else if (ratioW < 1 || ratioH < 1 || (machine().ui().options().enlarge_snaps() && !no_available)) { // smaller ratio will ensure that the image fits in the view ratio = MIN(ratioW, ratioH); @@ -2336,9 +2336,9 @@ void ui_menu::draw_icon(int linenum, void *selectedref, float x0, float y0) } // get search path - path_iterator path(machine().options().icons_directory()); + path_iterator path(machine().ui().options().icons_directory()); std::string curpath; - std::string searchstr(machine().options().icons_directory()); + std::string searchstr(machine().ui().options().icons_directory()); // iterate over path and add path for zipped formats while (path.next(curpath)) @@ -2446,7 +2446,7 @@ void ui_menu::draw_palette_menu() float gutter_width = lr_arrow_width * 1.3f; int itemnum, linenum; - if (machine().options().use_background_image() && machine().options().system() == nullptr && bgrnd_bitmap->valid()) + if (machine().ui().options().use_background_image() && machine().options().system() == nullptr && bgrnd_bitmap->valid()) container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); // compute the width and height of the full menu diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp index 82cf7b8d42c..1884547d8c5 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/emu/ui/optsmenu.cpp @@ -39,7 +39,7 @@ ui_menu_game_options::ui_menu_game_options(running_machine &machine, render_cont ui_menu_game_options::~ui_menu_game_options() { ui_menu::menu_stack->reset(UI_MENU_RESET_SELECT_FIRST); - save_game_options(machine()); + save_ui_options(machine()); ui_globals::switch_image = true; } @@ -323,20 +323,20 @@ void ui_menu_game_options::custom_render(void *selectedref, float top, float bot } //------------------------------------------------- -// save game options +// save ui options //------------------------------------------------- -void save_game_options(running_machine &machine) +void save_ui_options(running_machine &machine) { // attempt to open the output file emu_file file(machine.options().ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open(emulator_info::get_configname(), ".ini") == FILERR_NONE) + if (file.open("ui.ini") == FILERR_NONE) { // generate the updated INI - std::string initext = machine.options().output_ini(); + std::string initext = machine.ui().options().output_ini(); file.puts(initext.c_str()); file.close(); } else - machine.popmessage("**Error to save %s.ini**", emulator_info::get_configname()); + machine.popmessage("**Error to save ui.ini**", emulator_info::get_configname()); } diff --git a/src/emu/ui/optsmenu.h b/src/emu/ui/optsmenu.h index 6900bfec769..b62e5712de9 100644 --- a/src/emu/ui/optsmenu.h +++ b/src/emu/ui/optsmenu.h @@ -43,6 +43,6 @@ private: }; // save options to file -void save_game_options(running_machine &machine); +void save_ui_options(running_machine &machine); #endif /* __UI_OPTSMENU_H__ */ diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 208c61b795d..10a53dfae9b 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -108,7 +108,7 @@ bool sort_game_list(const game_driver *x, const game_driver *y) ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_container *container, const char *gamename) : ui_menu(machine, container) { std::string error_string, last_filter, sub_filter; - emu_options &moptions = machine.options(); + ui_options &moptions = machine.ui().options(); // load drivers cache load_cache_info(); @@ -185,7 +185,7 @@ ui_menu_select_game::~ui_menu_select_game() std::string error_string, last_driver; const game_driver *driver = nullptr; ui_software_info *swinfo = nullptr; - emu_options &mopt = machine().options(); + ui_options &mopt = machine().ui().options(); if (main_filters::actual == FILTER_FAVORITE_GAME) swinfo = (selected >= 0 && selected < item.size()) ? (ui_software_info *)item[selected].ref : nullptr; else @@ -208,7 +208,7 @@ ui_menu_select_game::~ui_menu_select_game() mopt.set_value(OPTION_LAST_USED_FILTER, filter.c_str(), OPTION_PRIORITY_CMDLINE, error_string); mopt.set_value(OPTION_LAST_USED_MACHINE, last_driver.c_str(), OPTION_PRIORITY_CMDLINE, error_string); mopt.set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); - save_game_options(machine()); + save_ui_options(machine()); } //------------------------------------------------- @@ -218,7 +218,7 @@ ui_menu_select_game::~ui_menu_select_game() void ui_menu_select_game::handle() { bool check_filter = false; - bool enabled_dats = machine().options().enabled_dats(); + bool enabled_dats = machine().ui().options().enabled_dats(); // if i have to load datfile, performe an hard reset if (ui_globals::reset) @@ -1023,7 +1023,7 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event) } std::vector biosname; - if (!machine().options().skip_bios_menu() && has_multiple_bios(driver, biosname)) + if (!machine().ui().options().skip_bios_menu() && has_multiple_bios(driver, biosname)) ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)driver, false, false)); else { @@ -1051,7 +1051,7 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event) void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) { ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; - emu_options &mopt = machine().options(); + ui_options &mopt = machine().ui().options(); // special case for configure options if ((FPTR)ui_swinfo == 1) @@ -1064,7 +1064,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) else if (ui_swinfo->startempty == 1) { // audit the game first to see if we're going to work - driver_enumerator enumerator(mopt, *ui_swinfo->driver); + driver_enumerator enumerator(machine().options(), *ui_swinfo->driver); enumerator.next(); media_auditor auditor(enumerator); media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST); @@ -1097,7 +1097,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) else { // first validate - driver_enumerator drv(mopt, *ui_swinfo->driver); + driver_enumerator drv(machine().options(), *ui_swinfo->driver); media_auditor auditor(drv); drv.next(); software_list_device *swlist = software_list_device::find_by_name(drv.config(), ui_swinfo->listname.c_str()); @@ -1541,7 +1541,7 @@ void ui_menu_select_game::general_info(const game_driver *driver, std::string &b strcatprintf(buffer, "Requires CHD: %s\n", (driver_cache[idx].b_chd ? "Yes" : "No")); // audit the game first to see if we're going to work - if (machine().options().info_audit()) + if (machine().ui().options().info_audit()) { driver_enumerator enumerator(machine().options(), *driver); enumerator.next(); @@ -1569,7 +1569,7 @@ void ui_menu_select_game::general_info(const game_driver *driver, std::string &b void ui_menu_select_game::inkey_export() { std::string filename("exported"); - emu_file infile(machine().options().ui_path(), OPEN_FLAG_READ); + emu_file infile(machine().ui().options().ui_path(), OPEN_FLAG_READ); if (infile.open(filename.c_str(), ".xml") == FILERR_NONE) for (int seq = 0; ; ++seq) { @@ -1583,7 +1583,7 @@ void ui_menu_select_game::inkey_export() } // attempt to open the output file - emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(filename.c_str(), ".xml") == FILERR_NONE) { FILE *pfile; @@ -1625,7 +1625,7 @@ void ui_menu_select_game::inkey_export() void ui_menu_select_game::save_cache_info() { // attempt to open the output file - emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open("info_", emulator_info::get_configname(), ".ini") == FILERR_NONE) { @@ -1716,7 +1716,7 @@ void ui_menu_select_game::load_cache_info() driver_cache.resize(driver_list::total() + 1); // try to load driver cache - emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); + emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_READ); if (file.open("info_", emulator_info::get_configname(), ".ini") != FILERR_NONE) { save_cache_info(); @@ -1788,7 +1788,7 @@ void ui_menu_select_game::load_cache_info() bool ui_menu_select_game::load_available_machines() { // try to load available drivers from file - emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); + emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_READ); if (file.open(emulator_info::get_configname(), "_avail.ini") != FILERR_NONE) return false; @@ -1840,7 +1840,7 @@ bool ui_menu_select_game::load_available_machines() void ui_menu_select_game::load_custom_filters() { // attempt to open the output file - emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); + emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_READ); if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == FILERR_NONE) { char buffer[MAX_CHAR_INFO]; @@ -2066,7 +2066,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or static std::string buffer; std::vector xstart; std::vector xend; - float text_size = machine().options().infos_size(); + float text_size = machine().ui().options().infos_size(); const game_driver *driver = nullptr; ui_software_info *soft = nullptr; bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0); diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index e4b71a6a809..88cbd8cb2d0 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -213,7 +213,7 @@ void ui_menu_select_software::handle() } // handle UI_HISTORY - else if (m_event->iptkey == IPT_UI_HISTORY && machine().options().enabled_dats()) + else if (m_event->iptkey == IPT_UI_HISTORY && machine().ui().options().enabled_dats()) { ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; @@ -817,7 +817,7 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) { ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; - emu_options &mopt = machine().options(); + ui_options &mopt = machine().ui().options(); if (ui_swinfo->startempty == 1) { @@ -925,7 +925,7 @@ void ui_menu_select_software::inkey_special(const ui_menu_event *m_event) void ui_menu_select_software::load_sw_custom_filters() { // attempt to open the output file - emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); + emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_READ); if (file.open("custom_", m_driver->name, "_filter.ini") == FILERR_NONE) { char buffer[MAX_CHAR_INFO]; @@ -1417,7 +1417,7 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa static std::string buffer; std::vector xstart; std::vector xend; - float text_size = machine().options().infos_size(); + float text_size = machine().ui().options().infos_size(); ui_software_info *soft = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr; static ui_software_info *oldsoft = nullptr; static int old_sw_view = -1; @@ -1876,7 +1876,7 @@ void ui_bios_selection::handle() { // process the menu const ui_menu_event *event = process(0); - emu_options &moptions = machine().options(); + ui_options &moptions = machine().ui().options(); if (event != nullptr && event->iptkey == IPT_UI_SELECT && event->itemref != nullptr) for (auto & elem : m_bios) if ((void*)&elem.name == event->itemref) @@ -1905,7 +1905,7 @@ void ui_bios_selection::handle() ui_software_info *ui_swinfo = (ui_software_info *)m_driver; std::string error; machine().options().set_value("bios", elem.id, OPTION_PRIORITY_CMDLINE, error); - driver_enumerator drivlist(moptions, *ui_swinfo->driver); + driver_enumerator drivlist(machine().options(), *ui_swinfo->driver); drivlist.next(); software_list_device *swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str()); software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index a20da75a68e..b549a51e80f 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -159,6 +159,24 @@ static INT32 slider_crossoffset(running_machine &machine, void *arg, std::string INLINE FUNCTIONS ***************************************************************************/ +//------------------------------------------------- +// load ui options +//------------------------------------------------- + +static void load_ui_options(running_machine &machine) +{ + // parse the file + std::string error; + // attempt to open the output file + emu_file file(machine.options().ini_path(), OPEN_FLAG_READ); + if (file.open("ui.ini") == FILERR_NONE) + { + bool result = machine.ui().options().parse_ini_file((core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error); + if (!result) + osd_printf_error("**Error to load ui.ini**"); + } +} + //------------------------------------------------- // is_breakable_char - is a given unicode // character a possible line break? @@ -248,9 +266,14 @@ static const UINT32 mouse_bitmap[32*32] = ui_manager::ui_manager(running_machine &machine) : m_machine(machine) { +} + +void ui_manager::init() +{ + load_ui_options(machine()); // initialize the other UI bits - ui_menu::init(machine); - ui_gfx_init(machine); + ui_menu::init(machine()); + ui_gfx_init(machine()); // reset instance variables m_font = nullptr; @@ -265,23 +288,23 @@ ui_manager::ui_manager(running_machine &machine) m_mouse_arrow_texture = nullptr; m_load_save_hold = false; - get_font_rows(&machine); - decode_ui_color(0, &machine); + get_font_rows(&machine()); + decode_ui_color(0, &machine()); // more initialization set_handler(handler_messagebox, 0); m_non_char_keys_down = std::make_unique((ARRAY_LENGTH(non_char_keys) + 7) / 8); - m_mouse_show = machine.system().flags & MACHINE_CLICKABLE_ARTWORK ? true : false; + m_mouse_show = machine().system().flags & MACHINE_CLICKABLE_ARTWORK ? true : false; // request a callback upon exiting - machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_manager::exit), this)); + machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_manager::exit), this)); // retrieve options - m_use_natural_keyboard = machine.options().natural_keyboard(); - bitmap_argb32 *ui_mouse_bitmap = auto_alloc(machine, bitmap_argb32(32, 32)); + m_use_natural_keyboard = machine().options().natural_keyboard(); + bitmap_argb32 *ui_mouse_bitmap = auto_alloc(machine(), bitmap_argb32(32, 32)); UINT32 *dst = &ui_mouse_bitmap->pix32(0); memcpy(dst,mouse_bitmap,32*32*sizeof(UINT32)); - m_mouse_arrow_texture = machine.render().texture_alloc(); + m_mouse_arrow_texture = machine().render().texture_alloc(); m_mouse_arrow_texture->set_bitmap(*ui_mouse_bitmap, ui_mouse_bitmap->cliprect(), TEXFORMAT_ARGB32); } @@ -2729,10 +2752,10 @@ rgb_t decode_ui_color(int id, running_machine *machine) static rgb_t color[ARRAY_LENGTH(s_color_list)]; if (machine != nullptr) { - emu_options option; + ui_options option; for (int x = 0; x < ARRAY_LENGTH(s_color_list); x++) { const char *o_default = option.value(s_color_list[x]); - const char *s_option = machine->options().value(s_color_list[x]); + const char *s_option = machine->ui().options().value(s_color_list[x]); int len = strlen(s_option); if (len != 8) color[x] = rgb_t((UINT32)strtoul(o_default, nullptr, 16)); @@ -2751,5 +2774,5 @@ int get_font_rows(running_machine *machine) { static int value; - return ((machine != nullptr) ? value = machine->options().font_rows() : value); + return ((machine != nullptr) ? value = machine->ui().options().font_rows() : value); } diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h index 7153dae430b..5a07a0800b5 100644 --- a/src/emu/ui/ui.h +++ b/src/emu/ui/ui.h @@ -14,7 +14,7 @@ #define __USRINTRF_H__ #include "render.h" - +#include "moptions.h" /*************************************************************************** CONSTANTS @@ -116,10 +116,13 @@ public: // construction/destruction ui_manager(running_machine &machine); + void init(); + // getters running_machine &machine() const { return m_machine; } bool single_step() const { return m_single_step; } - + ui_options &options() { return m_ui_options; } + // setters void set_single_step(bool single_step) { m_single_step = single_step; } @@ -193,6 +196,7 @@ private: render_texture * m_mouse_arrow_texture; bool m_mouse_show; bool m_load_save_hold; + ui_options m_ui_options; // text generators std::string &disclaimer_string(std::string &buffer); -- cgit v1.2.3-70-g09d2 From 6fb757d6a6ee1628c49834c884d682bb43211ffd Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 5 Feb 2016 15:17:51 +0100 Subject: move some options to ui.ini (nw) --- src/emu/emuopts.cpp | 4 ---- src/emu/emuopts.h | 12 +----------- src/emu/ui/custui.cpp | 8 ++++---- src/emu/ui/menu.cpp | 4 ++-- src/emu/ui/miscmenu.cpp | 8 ++++---- src/emu/ui/moptions.cpp | 6 +++++- src/emu/ui/moptions.h | 10 ++++++++++ src/emu/ui/ui.cpp | 8 ++++---- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 9081f996e6d..716432b9088 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -178,12 +178,8 @@ const options_entry emu_options::s_option_entries[] = { OPTION_DRC_LOG_NATIVE, "0", OPTION_BOOLEAN, "write DRC native disassembly log" }, { OPTION_BIOS, nullptr, OPTION_STRING, "select the system BIOS to use" }, { OPTION_CHEAT ";c", "0", OPTION_BOOLEAN, "enable cheat subsystem" }, - { OPTION_SKIP_GAMEINFO, "0", OPTION_BOOLEAN, "skip displaying the information screen at startup" }, - { OPTION_UI_FONT, "default", OPTION_STRING, "specify a font to use" }, { OPTION_UI, "cabinet", OPTION_STRING, "type of UI (simple|cabinet)" }, { OPTION_RAMSIZE ";ram", nullptr, OPTION_STRING, "size of RAM (if supported by driver)" }, - { OPTION_CONFIRM_QUIT, "0", OPTION_BOOLEAN, "display confirm quit screen on exit" }, - { OPTION_UI_MOUSE, "1", OPTION_BOOLEAN, "display ui mouse cursor" }, { OPTION_AUTOBOOT_COMMAND ";ab", nullptr, OPTION_STRING, "command to execute after machine boot" }, { OPTION_AUTOBOOT_DELAY, "2", OPTION_INTEGER, "timer delay in sec to trigger command execution on autoboot" }, { OPTION_AUTOBOOT_SCRIPT ";script", nullptr, OPTION_STRING, "lua script to execute after machine boot" }, diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index dc5acbb7849..d8d6e162e94 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -172,8 +172,6 @@ enum #define OPTION_DRC_LOG_NATIVE "drc_log_native" #define OPTION_BIOS "bios" #define OPTION_CHEAT "cheat" -#define OPTION_SKIP_GAMEINFO "skip_gameinfo" -#define OPTION_UI_FONT "uifont" #define OPTION_UI "ui" #define OPTION_RAMSIZE "ramsize" @@ -183,9 +181,6 @@ enum #define OPTION_COMM_REMOTE_HOST "comm_remotehost" #define OPTION_COMM_REMOTE_PORT "comm_remoteport" -#define OPTION_CONFIRM_QUIT "confirm_quit" -#define OPTION_UI_MOUSE "ui_mouse" - #define OPTION_AUTOBOOT_COMMAND "autoboot_command" #define OPTION_AUTOBOOT_DELAY "autoboot_delay" #define OPTION_AUTOBOOT_SCRIPT "autoboot_script" @@ -348,8 +343,6 @@ public: bool drc_log_native() const { return bool_value(OPTION_DRC_LOG_NATIVE); } const char *bios() const { return value(OPTION_BIOS); } bool cheat() const { return bool_value(OPTION_CHEAT); } - bool skip_gameinfo() const { return bool_value(OPTION_SKIP_GAMEINFO); } - const char *ui_font() const { return value(OPTION_UI_FONT); } const char *ui() const { return value(OPTION_UI); } const char *ram_size() const { return value(OPTION_RAMSIZE); } @@ -358,10 +351,7 @@ public: const char *comm_localport() const { return value(OPTION_COMM_LOCAL_PORT); } const char *comm_remotehost() const { return value(OPTION_COMM_REMOTE_HOST); } const char *comm_remoteport() const { return value(OPTION_COMM_REMOTE_PORT); } - - bool confirm_quit() const { return bool_value(OPTION_CONFIRM_QUIT); } - bool ui_mouse() const { return bool_value(OPTION_UI_MOUSE); } - + const char *autoboot_command() const { return value(OPTION_AUTOBOOT_COMMAND); } int autoboot_delay() const { return int_value(OPTION_AUTOBOOT_DELAY); } const char *autoboot_script() const { return value(OPTION_AUTOBOOT_SCRIPT); } diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index b03f51f9122..fb1459837ab 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -33,11 +33,11 @@ ui_menu_custom_ui::ui_menu_custom_ui(running_machine &machine, render_container ui_menu_custom_ui::~ui_menu_custom_ui() { std::string error_string; - machine().options().set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); + machine().ui().options().set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); ui_globals::reset = true; } -//------------------------------------------------- +//------------------------------------------------- // handle //------------------------------------------------- @@ -143,7 +143,7 @@ ui_menu_font_ui::ui_menu_font_ui(running_machine &machine, render_container *con ui_options &moptions = machine.ui().options(); #ifdef UI_WINDOWS - std::string name(machine.options().ui_font()); + std::string name(machine.ui().options().ui_font()); list(); m_bold = (strreplace(name, "[B]", "") + strreplace(name, "[b]", "") > 0); @@ -442,7 +442,7 @@ ui_menu_colors_ui::~ui_menu_colors_ui() for (int index = 1; index < MUI_RESTORE; index++) { strprintf(dec_color, "%x", (UINT32)m_color_table[index].color); - machine().options().set_value(m_color_table[index].option, dec_color.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().ui().options().set_value(m_color_table[index].option, dec_color.c_str(), OPTION_PRIORITY_CMDLINE, error_string); } } diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index a8ba0d75b04..b401da66144 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -1613,9 +1613,9 @@ void ui_menu::get_title_search(std::string &snaptext, std::string &searchstr) snaptext.assign(arts_info[ui_globals::curimage_view].title); // get search path - path_iterator path(machine().options().value(arts_info[ui_globals::curimage_view].path)); + path_iterator path(machine().ui().options().value(arts_info[ui_globals::curimage_view].path)); std::string curpath; - searchstr.assign(machine().options().value(arts_info[ui_globals::curimage_view].path)); + searchstr.assign(machine().ui().options().value(arts_info[ui_globals::curimage_view].path)); // iterate over path and add path for zipped formats while (path.next(curpath)) diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp index 2226d0435a8..3f5b987975f 100644 --- a/src/emu/ui/miscmenu.cpp +++ b/src/emu/ui/miscmenu.cpp @@ -564,8 +564,8 @@ ui_menu_misc_options::misc_option ui_menu_misc_options::m_options[] = { { 0, "DATs info", OPTION_DATS_ENABLED }, { 0, "Cheats", OPTION_CHEAT }, { 0, "Show mouse pointer", OPTION_UI_MOUSE }, - { 0, "Confirm quit from machines", OPTION_CONFIRM_QUIT }, - { 0, "Skip displaying information's screen at startup", OPTION_SKIP_GAMEINFO }, + { 0, "Confirm quit from machines", OPTION_UI_CONFIRM_QUIT }, + { 0, "Skip displaying information's screen at startup", OPTION_UI_SKIP_GAMEINFO }, { 0, "Force 4:3 appearance for software snapshot", OPTION_FORCED4X3 }, { 0, "Use image as background", OPTION_USE_BACKGROUND }, { 0, "Skip bios selection menu", OPTION_SKIP_BIOS_MENU }, @@ -579,14 +579,14 @@ ui_menu_misc_options::misc_option ui_menu_misc_options::m_options[] = { ui_menu_misc_options::ui_menu_misc_options(running_machine &machine, render_container *container) : ui_menu(machine, container) { for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) - m_options[d].status = machine.options().bool_value(m_options[d].option); + m_options[d].status = machine.ui().options().bool_value(m_options[d].option); } ui_menu_misc_options::~ui_menu_misc_options() { std::string error_string; for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) - machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); + machine().ui().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); ui_globals::reset = true; } diff --git a/src/emu/ui/moptions.cpp b/src/emu/ui/moptions.cpp index 5dfdfde43c3..dd4897749fc 100644 --- a/src/emu/ui/moptions.cpp +++ b/src/emu/ui/moptions.cpp @@ -52,9 +52,13 @@ const options_entry ui_options::s_option_entries[] = { OPTION_LAST_USED_FILTER, "", OPTION_STRING, "latest used filter" }, { OPTION_LAST_USED_MACHINE, "", OPTION_STRING, "latest used machine" }, { OPTION_INFO_AUTO_AUDIT, "0", OPTION_BOOLEAN, "enable auto audit in the general info panel" }, + { OPTION_UI_SKIP_GAMEINFO, "0", OPTION_BOOLEAN, "skip displaying the information screen at startup" }, + { OPTION_UI_FONT, "default", OPTION_STRING, "specify a font to use" }, + { OPTION_UI_CONFIRM_QUIT, "0", OPTION_BOOLEAN, "display confirm quit screen on exit" }, + { OPTION_UI_MOUSE, "1", OPTION_BOOLEAN, "display ui mouse cursor" }, // UI options - { nullptr, nullptr, OPTION_HEADER, "UI UI OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "UI OPTIONS" }, { OPTION_INFOS_SIZE "(0.05-1.00)", "0.75", OPTION_FLOAT, "UI right panel infos text size (0.05 - 1.00)" }, { OPTION_FONT_ROWS "(25-40)", "30", OPTION_INTEGER, "UI font text size (25 - 40)" }, { OPTION_HIDE_PANELS "(0-3)", "0", OPTION_INTEGER, "UI hide left/right panel in main view (0 = Show all, 1 = hide left, 2 = hide right, 3 = hide both" }, diff --git a/src/emu/ui/moptions.h b/src/emu/ui/moptions.h index e3c649111d9..3b1ab8948c0 100644 --- a/src/emu/ui/moptions.h +++ b/src/emu/ui/moptions.h @@ -70,6 +70,12 @@ #define OPTION_UI_DIPSW_COLOR "ui_dipsw_color" #define OPTION_UI_SLIDER_COLOR "ui_slider_color" +#define OPTION_UI_FONT "uifont" +#define OPTION_UI_CONFIRM_QUIT "confirm_quit" +#define OPTION_UI_MOUSE "ui_mouse" +#define OPTION_UI_SKIP_GAMEINFO "skip_gameinfo" + + class ui_options : public core_options { public: @@ -131,6 +137,10 @@ public: const char *ui_dipsw_color() const { return value(OPTION_UI_DIPSW_COLOR); } const char *ui_slider_color() const { return value(OPTION_UI_SLIDER_COLOR); } + bool skip_gameinfo() const { return bool_value(OPTION_UI_SKIP_GAMEINFO); } + const char *ui_font() const { return value(OPTION_UI_FONT); } + bool confirm_quit() const { return bool_value(OPTION_UI_CONFIRM_QUIT); } + bool ui_mouse() const { return bool_value(OPTION_UI_MOUSE); } private: static const options_entry s_option_entries[]; }; diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index b549a51e80f..6d996ac50a0 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -361,7 +361,7 @@ void ui_manager::display_startup_screens(bool first_time, bool show_disclaimer) { const int maxstate = 4; int str = machine().options().seconds_to_run(); - bool show_gameinfo = !machine().options().skip_gameinfo(); + bool show_gameinfo = !machine().ui().options().skip_gameinfo(); bool show_warnings = true, show_mandatory_fileman = true; int state; @@ -497,7 +497,7 @@ void ui_manager::update_and_render(render_container *container) m_popup_text_end = 0; // display the internal mouse cursor - if (m_mouse_show || (is_menu_active() && machine().options().ui_mouse())) + if (m_mouse_show || (is_menu_active() && machine().ui().options().ui_mouse())) { INT32 mouse_target_x, mouse_target_y; bool mouse_button; @@ -528,7 +528,7 @@ render_font *ui_manager::get_font() { // allocate the font and messagebox string if (m_font == nullptr) - m_font = machine().render().font_alloc(machine().options().ui_font()); + m_font = machine().render().font_alloc(machine().ui().options().ui_font()); return m_font; } @@ -1863,7 +1863,7 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container void ui_manager::request_quit() { - if (!machine().options().confirm_quit()) + if (!machine().ui().options().confirm_quit()) machine().schedule_exit(); else set_handler(handler_confirm_quit, 0); -- cgit v1.2.3-70-g09d2 From 11ee4b5c70e127f286398924f46908fa1dc18d1c Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Fri, 5 Feb 2016 14:46:53 +0000 Subject: bbc: fdc callbacks on connected devices only (nw) --- src/mame/machine/bbc.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/mame/machine/bbc.cpp b/src/mame/machine/bbc.cpp index d82f4fdd827..9d25639924b 100644 --- a/src/mame/machine/bbc.cpp +++ b/src/mame/machine/bbc.cpp @@ -1426,14 +1426,26 @@ WRITE_LINE_MEMBER(bbc_state::write_acia_clock) WRITE_LINE_MEMBER(bbc_state::motor_w) { - m_i8271->subdevice("0")->get_device()->mon_w(!state); - m_i8271->subdevice("1")->get_device()->mon_w(!state); + for (int i=0; i != 2; i++) { + char devname[1]; + sprintf(devname, "%d", i); + floppy_connector *con = m_i8271->subdevice(devname); + if (con) { + con->get_device()->mon_w(!state); + } + } } WRITE_LINE_MEMBER(bbc_state::side_w) { - m_i8271->subdevice("0")->get_device()->ss_w(state); - m_i8271->subdevice("1")->get_device()->ss_w(state); + for (int i=0; i != 2; i++) { + char devname[1]; + sprintf(devname, "%d", i); + floppy_connector *con = m_i8271->subdevice(devname); + if (con) { + con->get_device()->ss_w(state); + } + } } -- cgit v1.2.3-70-g09d2 From bd3b47671d842f6fe7529af9e2a0b69b2a827f5b Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 5 Feb 2016 18:59:08 +0100 Subject: machine promoted to WORKING -------------------------- Fidelity Voice Excellence [hap, plgDavid] --- src/mame/drivers/fidel6502.cpp | 117 ++++++++++- src/mame/drivers/fidelz80.cpp | 16 +- src/mame/drivers/hh_ucom4.cpp | 2 +- src/mame/includes/fidelz80.h | 7 +- src/mame/layout/fidel_csc.lay | 43 ++-- src/mame/layout/fidel_fev.lay | 445 ++++++++++++++++++++++++++++++++++++++--- src/mame/layout/fidel_sc12.lay | 257 ++++++++++++------------ src/mame/layout/fidel_vsc.lay | 43 ++-- 8 files changed, 714 insertions(+), 216 deletions(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 11b78cb6874..47df4091f7f 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -5,9 +5,6 @@ Fidelity Electronics 6502 based board driver See drivers/fidelz80.cpp for hardware description - TODO: - - x - ******************************************************************************/ #include "emu.h" @@ -23,7 +20,7 @@ // internal artwork #include "fidel_csc.lh" // clickable -#include "fidel_fev.lh" +#include "fidel_fev.lh" // clickable #include "fidel_sc12.lh" // clickable @@ -43,7 +40,7 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(irq_on) { m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); } TIMER_DEVICE_CALLBACK_MEMBER(irq_off) { m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); } - // model CSC + // CSC void csc_update_7442(); void csc_prepare_display(); DECLARE_READ8_MEMBER(csc_speech_r); @@ -59,11 +56,17 @@ public: DECLARE_READ_LINE_MEMBER(csc_pia1_ca1_r); DECLARE_READ_LINE_MEMBER(csc_pia1_cb1_r); - // model SC12 + // SC12 DECLARE_MACHINE_START(sc12); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(scc_cartridge); DECLARE_WRITE8_MEMBER(sc12_control_w); DECLARE_READ8_MEMBER(sc12_input_r); + + // FEV (6092) + DECLARE_INPUT_CHANGED_MEMBER(fev_bankswitch); + DECLARE_READ8_MEMBER(fev_speech_r); + DECLARE_WRITE8_MEMBER(fev_ttl_w); + DECLARE_READ8_MEMBER(fev_ttl_r); }; @@ -81,7 +84,7 @@ void fidel6502_state::csc_update_7442() // 7442 0-8: led select, input mux m_inp_mux = 1 << m_led_select & 0x3ff; - // 7442 9: buzzer speaker out + // 7442 9: speaker out m_speaker->level_w(m_inp_mux >> 9 & 1); } @@ -259,7 +262,72 @@ WRITE8_MEMBER(fidel6502_state::sc12_control_w) READ8_MEMBER(fidel6502_state::sc12_input_r) { // a0-a2,d7: multiplexed inputs (active low) - return (read_inputs(9) << (offset^7) & 0x80) ^ 0xff; + return (read_inputs(9) >> offset & 1) ? 0 : 0x80; +} + + + +/****************************************************************************** + FEV +******************************************************************************/ + +// misc handlers + +INPUT_CHANGED_MEMBER(fidel6502_state::fev_bankswitch) +{ + // tied to speech ROM highest bits + m_speech->force_update(); + m_speech_bank = (m_speech_bank & 1) | newval << 1; +} + +READ8_MEMBER(fidel6502_state::fev_speech_r) +{ + // TSI A11 is A12, program controls A11, user controls A13,A14(language switches) + offset = (offset & 0x7ff) | (offset << 1 & 0x1000); + return m_speech_rom[offset | (m_speech_bank << 11 & 0x800) | (~m_speech_bank << 12 & 0x6000)]; +} + + +// TTL + +WRITE8_MEMBER(fidel6502_state::fev_ttl_w) +{ + // a0-a2,d0: 74259(1) + UINT8 mask = 1 << offset; + m_led_select = (m_led_select & ~mask) | ((data & 1) ? mask : 0); + + // 74259 Q0-Q3: 7442 a0-a3 + // 7442 0-8: led data, input mux + UINT16 sel = 1 << (m_led_select & 0xf) & 0x3ff; + m_inp_mux = sel & 0x1ff; + + // 7442 9: speaker out + m_speaker->level_w(sel >> 9 & 1); + + // 74259 Q4,Q5: led select (active low) + display_matrix(9, 2, sel & 0x1ff, ~m_led_select >> 4 & 3); + + // a0-a2,d2: 74259(2) to speech board + m_speech_data = (m_speech_data & ~mask) | ((data & 4) ? mask : 0); + + // 74259 Q6: TSI ROM A11 + m_speech->force_update(); // update stream to now + m_speech_bank = (m_speech_bank & ~1) | (m_speech_data >> 6 & 1); + + // Q0-Q5: TSI C0-C5 + // Q7: TSI START line + m_speech->data_w(space, 0, m_speech_data & 0x3f); + m_speech->start_w(m_speech_data >> 7 & 1); +} + +READ8_MEMBER(fidel6502_state::fev_ttl_r) +{ + // a0-a2,d7: multiplexed inputs (active low) + UINT8 data = (read_inputs(9) >> offset & 1) ? 0 : 0x80; + + // a0-a2,d6: from speech board: language switches and TSI BUSY line + data |= (m_inp_matrix[9]->read() >> offset & 1) ? 0x40 : 0; + return data; } @@ -298,7 +366,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( fev_map, AS_PROGRAM, 8, fidel6502_state ) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_RAM + AM_RANGE(0x0000, 0x1fff) AM_MIRROR(0x2000) AM_RAM + AM_RANGE(0x4000, 0x4007) AM_MIRROR(0x3ff8) AM_READWRITE(fev_ttl_r, fev_ttl_w) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -519,6 +588,29 @@ static INPUT_PORTS_START( sc12 ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) INPUT_PORTS_END +static INPUT_PORTS_START( fev ) + PORT_INCLUDE( sc12 ) + + PORT_MODIFY("IN.8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Clear") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Move / Pawn") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Hint / Knight") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Take Back / Bishop") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Level / Rook") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Options / Queen") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Verify / King") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("New Game") PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_N) + + PORT_START("IN.9") + PORT_CONFNAME( 0x03, 0x00, "Language" ) PORT_CHANGED_MEMBER(DEVICE_SELF, fidel6502_state, fev_bankswitch, 0) + PORT_CONFSETTING( 0x00, "English" ) + PORT_CONFSETTING( 0x01, "German" ) + PORT_CONFSETTING( 0x02, "French" ) + PORT_CONFSETTING( 0x03, "Spanish" ) + PORT_BIT(0x7c, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_READ_LINE_DEVICE_MEMBER("speech", s14001a_device, busy_r) +INPUT_PORTS_END + /****************************************************************************** @@ -601,8 +693,11 @@ static MACHINE_CONFIG_START( fev, fidel6502_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("speech", S14001A, 25000) // R/C circuit, around 25khz - MCFG_S14001A_EXT_READ_HANDLER(READ8(fidel6502_state, csc_speech_r)) + MCFG_S14001A_EXT_READ_HANDLER(READ8(fidel6502_state, fev_speech_r)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -688,4 +783,4 @@ COMP( 1981, cscfr, csc, 0, csc, cscg, driver_device, 0, "Fidelit COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1987, fexcelv, 0, 0, fev, csc, driver_device, 0, "Fidelity Electronics", "Voice Excellence", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1987, fexcelv, 0, 0, fev, fev, driver_device, 0, "Fidelity Electronics", "Voice Excellence", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index bb963922a24..4f236fd2947 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -665,7 +665,7 @@ CPU: GTE G65SC102P-3, 32 KB PRG ROM: AMI 101-1080A01(IC5), 8192x8 SRAM SRM2264C1 PCB 2: 510.1117A01 Speech: TSI S14001A, 32 KB ROM: AMI 101-1081A01(IC2) -Dip Switches set ROM A13 and ROM A14, on the side of the tablet +Dip Switches set ROM A13 and ROM A14, on the side of the board ROM A12 is tied to S14001A's A11 (yuck) ROM A11 is however tied to the CPU's XYZ @@ -733,7 +733,7 @@ public: DECLARE_INPUT_CHANGED_MEMBER(reset_button); - // model VCC/UVC/CC10 + // VCC/UVC/CC10 void vcc_prepare_display(); DECLARE_READ8_MEMBER(vcc_speech_r); DECLARE_WRITE8_MEMBER(vcc_ppi_porta_w); @@ -744,11 +744,11 @@ public: DECLARE_WRITE8_MEMBER(cc10_ppi_porta_w); TIMER_DEVICE_CALLBACK_MEMBER(beeper_off_callback); - // model BCC + // BCC DECLARE_READ8_MEMBER(bcc_input_r); DECLARE_WRITE8_MEMBER(bcc_control_w); - // model VSC + // VSC void vsc_prepare_display(); DECLARE_READ8_MEMBER(vsc_io_trampoline_r); DECLARE_WRITE8_MEMBER(vsc_io_trampoline_w); @@ -759,7 +759,7 @@ public: DECLARE_READ8_MEMBER(vsc_pio_portb_r); DECLARE_WRITE8_MEMBER(vsc_pio_portb_w); - // model 7014 and VBRC + // VBRC (7014) void vbrc_prepare_display(); DECLARE_WRITE8_MEMBER(vbrc_speech_w); DECLARE_WRITE8_MEMBER(vbrc_mcu_p1_w); @@ -783,6 +783,7 @@ void fidelz80base_state::machine_start() m_led_select = 0; m_led_data = 0; m_7seg_data = 0; + m_speech_data = 0; m_speech_bank = 0; // register for savestates @@ -799,6 +800,7 @@ void fidelz80base_state::machine_start() save_item(NAME(m_led_select)); save_item(NAME(m_led_data)); save_item(NAME(m_7seg_data)); + save_item(NAME(m_speech_data)); save_item(NAME(m_speech_bank)); } @@ -1040,8 +1042,8 @@ WRITE8_MEMBER(fidelz80_state::cc10_ppi_porta_w) WRITE8_MEMBER(fidelz80_state::bcc_control_w) { // a0-a2,d7: digit segment data via NE591, Q7 is speaker out - UINT8 sel = 1 << (offset & 7); - m_7seg_data = (m_7seg_data & ~sel) | ((data & 0x80) ? sel : 0); + UINT8 mask = 1 << (offset & 7); + m_7seg_data = (m_7seg_data & ~mask) | ((data & 0x80) ? mask : 0); m_speaker->level_w(m_7seg_data >> 7 & 1); // d0-d3: led select, input mux diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp index b78b15a40d3..d7578b8e173 100644 --- a/src/mame/drivers/hh_ucom4.cpp +++ b/src/mame/drivers/hh_ucom4.cpp @@ -2496,7 +2496,7 @@ CONS( 1980, splasfgt, 0, 0, splasfgt, splasfgt, driver_device, 0, "Bambin CONS( 1982, bcclimbr, 0, 0, bcclimbr, bcclimbr, driver_device, 0, "Bandai", "Crazy Climber (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1980, tactix, 0, 0, tactix, tactix, driver_device, 0, "Castle Toy", "Tactix", MACHINE_SUPPORTS_SAVE ) +CONS( 1980, tactix, 0, 0, tactix, tactix, driver_device, 0, "Castle Toy", "Tactix (Castle Toy)", MACHINE_SUPPORTS_SAVE ) CONS( 1980, invspace, 0, 0, invspace, invspace, driver_device, 0, "Epoch", "Invader From Space", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) CONS( 1980, efball, 0, 0, efball, efball, driver_device, 0, "Epoch", "Electronic Football (Epoch)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/fidelz80.h b/src/mame/includes/fidelz80.h index a43182773f5..6598cc76ec0 100644 --- a/src/mame/includes/fidelz80.h +++ b/src/mame/includes/fidelz80.h @@ -34,10 +34,11 @@ public: // misc common UINT16 m_inp_mux; // multiplexed keypad/leds mask - UINT16 m_led_select; // 5 bit selects for 7 seg leds and for common other leds, bits are (7seg leds are 0 1 2 3, common other leds are C) 0bxx3210xc - UINT16 m_7seg_data; // data for seg leds + UINT16 m_led_select; + UINT16 m_7seg_data; // data for seg leds UINT16 m_led_data; - UINT8 m_speech_bank; + UINT8 m_speech_data; + UINT8 m_speech_bank; // speech rom higher address bits UINT16 read_inputs(int columns); diff --git a/src/mame/layout/fidel_csc.lay b/src/mame/layout/fidel_csc.lay index 34545563175..22aed7ef11c 100644 --- a/src/mame/layout/fidel_csc.lay +++ b/src/mame/layout/fidel_csc.lay @@ -185,9 +185,30 @@ + + + + + + + + + + + + + + + + + + + + + + - @@ -379,26 +400,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/mame/layout/fidel_fev.lay b/src/mame/layout/fidel_fev.lay index 8c4637ab6ce..51cc059ee7e 100644 --- a/src/mame/layout/fidel_fev.lay +++ b/src/mame/layout/fidel_fev.lay @@ -3,38 +3,435 @@ - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/fidel_sc12.lay b/src/mame/layout/fidel_sc12.lay index dd653679a7e..3d087368edf 100644 --- a/src/mame/layout/fidel_sc12.lay +++ b/src/mame/layout/fidel_sc12.lay @@ -70,39 +70,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -141,6 +108,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -242,9 +242,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -362,100 +457,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mame/layout/fidel_vsc.lay b/src/mame/layout/fidel_vsc.lay index ab55048ba0e..f9c2c742620 100644 --- a/src/mame/layout/fidel_vsc.lay +++ b/src/mame/layout/fidel_vsc.lay @@ -183,9 +183,30 @@ + + + + + + + + + + + + + + + + + + + + + + - @@ -377,26 +398,6 @@ - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3-70-g09d2 From 6f3e86613da4b4bb0e63e5e124220e28518c53ef Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 5 Feb 2016 20:47:22 +0100 Subject: Save mame.ini options only if they are updated in UI (nw) Not all are covered, will need to check rest of files, but not tonight --- src/emu/ui/ctrlmenu.cpp | 10 +++++++-- src/emu/ui/dsplmenu.cpp | 22 ++++++++++++-------- src/emu/ui/menu.h | 4 ++++ src/emu/ui/optsmenu.cpp | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ src/emu/ui/sndmenu.cpp | 22 +++++++++++++------- 5 files changed, 95 insertions(+), 17 deletions(-) diff --git a/src/emu/ui/ctrlmenu.cpp b/src/emu/ui/ctrlmenu.cpp index 295fb7f85a0..d08cfd391f2 100644 --- a/src/emu/ui/ctrlmenu.cpp +++ b/src/emu/ui/ctrlmenu.cpp @@ -44,8 +44,14 @@ ui_menu_controller_mapping::ui_menu_controller_mapping(running_machine &machine, ui_menu_controller_mapping::~ui_menu_controller_mapping() { std::string error_string; - for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) - machine().options().set_value(m_options[d].option, m_device_status[m_options[d].status], OPTION_PRIORITY_CMDLINE, error_string); + for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) + { + if (strcmp(machine().options().value(m_options[d].option),m_device_status[m_options[d].status])!=0) + { + machine().options().set_value(m_options[d].option, m_device_status[m_options[d].status], OPTION_PRIORITY_CMDLINE, error_string); + save_main_option(machine(),m_options[d].option, m_device_status[m_options[d].status]); + } + } } //------------------------------------------------- diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp index a1907b89d51..48707e530ee 100644 --- a/src/emu/ui/dsplmenu.cpp +++ b/src/emu/ui/dsplmenu.cpp @@ -60,11 +60,7 @@ ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = { ui_menu_display_options::ui_menu_display_options(running_machine &machine, render_container *container) : ui_menu(machine, container) { -#if defined(UI_WINDOWS) && !defined(UI_SDL) - windows_options &options = downcast(machine.options()); -#else osd_options &options = downcast(machine.options()); -#endif for (int d = 2; d < ARRAY_LENGTH(m_options); ++d) m_options[d].status = options.int_value(m_options[d].option); @@ -85,13 +81,23 @@ ui_menu_display_options::ui_menu_display_options(running_machine &machine, rende ui_menu_display_options::~ui_menu_display_options() { std::string error_string; - for (int d = 2; d < ARRAY_LENGTH(m_options); ++d) - machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); - - machine().options().set_value(m_options[1].option, m_video[m_options[1].status].option, OPTION_PRIORITY_CMDLINE, error_string); + for (int d = 2; d < ARRAY_LENGTH(m_options); ++d) + { + if (machine().options().int_value(m_options[d].option)!=m_options[d].status) + { + machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); + save_main_option(machine(),m_options[d].option, m_options[d].status); + } + } + if (strcmp(machine().options().value(m_options[1].option), m_video[m_options[1].status].option)!=0) + { + machine().options().set_value(m_options[1].option, m_video[m_options[1].status].option, OPTION_PRIORITY_CMDLINE, error_string); + save_main_option(machine(),m_options[1].option, m_video[m_options[1].status].option); + } ui_globals::reset = true; } + //------------------------------------------------- // handle //------------------------------------------------- diff --git a/src/emu/ui/menu.h b/src/emu/ui/menu.h index 174d2866fac..64b24f158be 100644 --- a/src/emu/ui/menu.h +++ b/src/emu/ui/menu.h @@ -278,4 +278,8 @@ private: void draw_icon(int linenum, void *selectedref, float x1, float y1); }; +void save_main_option(running_machine &machine,const char *name, const char *value); +void save_main_option(running_machine &machine,const char *name, int value); +void save_main_option(running_machine &machine,const char *name, float value); + #endif // __UI_MENU_H__ diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp index 1884547d8c5..b77d41c5b87 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/emu/ui/optsmenu.cpp @@ -340,3 +340,57 @@ void save_ui_options(running_machine &machine) else machine.popmessage("**Error to save ui.ini**", emulator_info::get_configname()); } + +//------------------------------------------------- +// save main option +//------------------------------------------------- + +void save_main_option(running_machine &machine,const char *name, const char *value) +{ + // parse the file + std::string error; + emu_options options(machine.options()); // This way we make sure that all OSD parts are in + std::string error_string; + + // attempt to open the main ini file + { + emu_file file(machine.options().ini_path(), OPEN_FLAG_READ); + if (file.open(emulator_info::get_configname(), ".ini") == FILERR_NONE) + { + bool result = options.parse_ini_file((core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error); + if (!result) + { + osd_printf_error("**Error to load %s.ini**", emulator_info::get_configname()); + return; + } + } + } + + options.set_value(name, value, OPTION_PRIORITY_CMDLINE, error_string); + + // attempt to open the output file + { + emu_file file(machine.options().ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + if (file.open(emulator_info::get_configname(), ".ini") == FILERR_NONE) + { + // generate the updated INI + std::string initext = options.output_ini(); + file.puts(initext.c_str()); + file.close(); + } + else + machine.popmessage("**Error to save %s.ini**", emulator_info::get_configname()); + } +} + +void save_main_option(running_machine &machine,const char *name, int value) +{ + std::string tempstr = strformat("%d", value); + save_main_option(machine,name,tempstr.c_str()); +} + +void save_main_option(running_machine &machine,const char *name, float value) +{ + std::string tempstr = strformat("%f", (double)value); + save_main_option(machine,name,tempstr.c_str()); +} diff --git a/src/emu/ui/sndmenu.cpp b/src/emu/ui/sndmenu.cpp index 76568509385..14f8d639a67 100644 --- a/src/emu/ui/sndmenu.cpp +++ b/src/emu/ui/sndmenu.cpp @@ -49,13 +49,21 @@ ui_menu_sound_options::~ui_menu_sound_options() std::string error_string; emu_options &moptions = machine().options(); - if (m_sound) - moptions.set_value(OSDOPTION_SOUND, OSDOPTVAL_AUTO, OPTION_PRIORITY_CMDLINE, error_string); - else - moptions.set_value(OSDOPTION_SOUND, OSDOPTVAL_NONE, OPTION_PRIORITY_CMDLINE, error_string); - - moptions.set_value(OPTION_SAMPLERATE, m_sound_rate[m_cur_rates], OPTION_PRIORITY_CMDLINE, error_string); - moptions.set_value(OPTION_SAMPLES, m_samples, OPTION_PRIORITY_CMDLINE, error_string); + if (strcmp(moptions.value(OSDOPTION_SOUND),m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE)!=0) + { + moptions.set_value(OSDOPTION_SOUND, m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE, OPTION_PRIORITY_CMDLINE, error_string); + save_main_option(machine(),OSDOPTION_SOUND, m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE); + } + if (moptions.int_value(OPTION_SAMPLERATE)!=m_sound_rate[m_cur_rates]) + { + moptions.set_value(OPTION_SAMPLERATE, m_sound_rate[m_cur_rates], OPTION_PRIORITY_CMDLINE, error_string); + save_main_option(machine(),OPTION_SAMPLERATE, m_sound_rate[m_cur_rates]); + } + if (moptions.bool_value(OPTION_SAMPLES)!=m_samples) + { + moptions.set_value(OPTION_SAMPLES, m_samples, OPTION_PRIORITY_CMDLINE, error_string); + save_main_option(machine(),OPTION_SAMPLES, m_samples); + } } //------------------------------------------------- -- cgit v1.2.3-70-g09d2 From 22b279cf9797a965daed011c1c7c10004011b9dc Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 5 Feb 2016 21:39:19 +0100 Subject: New WORKING machine added --------------- Fidelity Excellence [hap, plgDavid] --- src/mame/drivers/fidel6502.cpp | 115 ++++++++++++++++++++++++----------------- src/mame/drivers/fidelz80.cpp | 14 ++--- src/mame/mess.lst | 1 + 3 files changed, 75 insertions(+), 55 deletions(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 47df4091f7f..5837a739585 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -56,17 +56,17 @@ public: DECLARE_READ_LINE_MEMBER(csc_pia1_ca1_r); DECLARE_READ_LINE_MEMBER(csc_pia1_cb1_r); - // SC12 + // SC12/6086 DECLARE_MACHINE_START(sc12); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(scc_cartridge); DECLARE_WRITE8_MEMBER(sc12_control_w); DECLARE_READ8_MEMBER(sc12_input_r); - // FEV (6092) - DECLARE_INPUT_CHANGED_MEMBER(fev_bankswitch); - DECLARE_READ8_MEMBER(fev_speech_r); - DECLARE_WRITE8_MEMBER(fev_ttl_w); - DECLARE_READ8_MEMBER(fev_ttl_r); + // 6080/6092 (Excellence) + DECLARE_INPUT_CHANGED_MEMBER(fexcelv_bankswitch); + DECLARE_READ8_MEMBER(fexcelv_speech_r); + DECLARE_WRITE8_MEMBER(fexcel_ttl_w); + DECLARE_READ8_MEMBER(fexcel_ttl_r); }; @@ -209,7 +209,7 @@ WRITE_LINE_MEMBER(fidel6502_state::csc_pia1_ca2_w) /****************************************************************************** - SC12 + SC12/6086 ******************************************************************************/ // cartridge @@ -268,19 +268,19 @@ READ8_MEMBER(fidel6502_state::sc12_input_r) /****************************************************************************** - FEV + 6080/6092 (Excellence) ******************************************************************************/ // misc handlers -INPUT_CHANGED_MEMBER(fidel6502_state::fev_bankswitch) +INPUT_CHANGED_MEMBER(fidel6502_state::fexcelv_bankswitch) { // tied to speech ROM highest bits m_speech->force_update(); m_speech_bank = (m_speech_bank & 1) | newval << 1; } -READ8_MEMBER(fidel6502_state::fev_speech_r) +READ8_MEMBER(fidel6502_state::fexcelv_speech_r) { // TSI A11 is A12, program controls A11, user controls A13,A14(language switches) offset = (offset & 0x7ff) | (offset << 1 & 0x1000); @@ -290,7 +290,7 @@ READ8_MEMBER(fidel6502_state::fev_speech_r) // TTL -WRITE8_MEMBER(fidel6502_state::fev_ttl_w) +WRITE8_MEMBER(fidel6502_state::fexcel_ttl_w) { // a0-a2,d0: 74259(1) UINT8 mask = 1 << offset; @@ -301,33 +301,36 @@ WRITE8_MEMBER(fidel6502_state::fev_ttl_w) UINT16 sel = 1 << (m_led_select & 0xf) & 0x3ff; m_inp_mux = sel & 0x1ff; - // 7442 9: speaker out + // 7442 9: speaker out (optional?) m_speaker->level_w(sel >> 9 & 1); // 74259 Q4,Q5: led select (active low) display_matrix(9, 2, sel & 0x1ff, ~m_led_select >> 4 & 3); - // a0-a2,d2: 74259(2) to speech board - m_speech_data = (m_speech_data & ~mask) | ((data & 4) ? mask : 0); + // speech (model 6092) + if (m_speech != nullptr) + { + // a0-a2,d2: 74259(2) to speech board + m_speech_data = (m_speech_data & ~mask) | ((data & 4) ? mask : 0); - // 74259 Q6: TSI ROM A11 - m_speech->force_update(); // update stream to now - m_speech_bank = (m_speech_bank & ~1) | (m_speech_data >> 6 & 1); - - // Q0-Q5: TSI C0-C5 - // Q7: TSI START line - m_speech->data_w(space, 0, m_speech_data & 0x3f); - m_speech->start_w(m_speech_data >> 7 & 1); + // 74259 Q6: TSI ROM A11 + m_speech->force_update(); // update stream to now + m_speech_bank = (m_speech_bank & ~1) | (m_speech_data >> 6 & 1); + + // Q0-Q5: TSI C0-C5 + // Q7: TSI START line + m_speech->data_w(space, 0, m_speech_data & 0x3f); + m_speech->start_w(m_speech_data >> 7 & 1); + } } -READ8_MEMBER(fidel6502_state::fev_ttl_r) +READ8_MEMBER(fidel6502_state::fexcel_ttl_r) { + // a0-a2,d6: from speech board: language switches and TSI BUSY line, otherwise tied to VCC + UINT8 d6 = (read_safe(m_inp_matrix[9], 0xff) >> offset & 1) ? 0x40 : 0; + // a0-a2,d7: multiplexed inputs (active low) - UINT8 data = (read_inputs(9) >> offset & 1) ? 0 : 0x80; - - // a0-a2,d6: from speech board: language switches and TSI BUSY line - data |= (m_inp_matrix[9]->read() >> offset & 1) ? 0x40 : 0; - return data; + return d6 | ((read_inputs(9) >> offset & 1) ? 0 : 0x80); } @@ -349,7 +352,7 @@ static ADDRESS_MAP_START( csc_map, AS_PROGRAM, 8, fidel6502_state ) ADDRESS_MAP_END -// SC12 +// SC12/6086 static ADDRESS_MAP_START( sc12_map, AS_PROGRAM, 8, fidel6502_state ) ADDRESS_MAP_UNMAP_HIGH @@ -362,12 +365,11 @@ static ADDRESS_MAP_START( sc12_map, AS_PROGRAM, 8, fidel6502_state ) ADDRESS_MAP_END -// FEV +// 6080/6092 (Excellence) -static ADDRESS_MAP_START( fev_map, AS_PROGRAM, 8, fidel6502_state ) - ADDRESS_MAP_UNMAP_HIGH +static ADDRESS_MAP_START( fexcel_map, AS_PROGRAM, 8, fidel6502_state ) AM_RANGE(0x0000, 0x1fff) AM_MIRROR(0x2000) AM_RAM - AM_RANGE(0x4000, 0x4007) AM_MIRROR(0x3ff8) AM_READWRITE(fev_ttl_r, fev_ttl_w) + AM_RANGE(0x4000, 0x4007) AM_MIRROR(0x3ff8) AM_READWRITE(fexcel_ttl_r, fexcel_ttl_w) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -588,7 +590,7 @@ static INPUT_PORTS_START( sc12 ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) INPUT_PORTS_END -static INPUT_PORTS_START( fev ) +static INPUT_PORTS_START( fexcel ) PORT_INCLUDE( sc12 ) PORT_MODIFY("IN.8") @@ -600,9 +602,13 @@ static INPUT_PORTS_START( fev ) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Options / Queen") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Verify / King") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("New Game") PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_N) +INPUT_PORTS_END + +static INPUT_PORTS_START( fexcelv ) + PORT_INCLUDE( fexcel ) PORT_START("IN.9") - PORT_CONFNAME( 0x03, 0x00, "Language" ) PORT_CHANGED_MEMBER(DEVICE_SELF, fidel6502_state, fev_bankswitch, 0) + PORT_CONFNAME( 0x03, 0x00, "Language" ) PORT_CHANGED_MEMBER(DEVICE_SELF, fidel6502_state, fexcelv_bankswitch, 0) PORT_CONFSETTING( 0x00, "English" ) PORT_CONFSETTING( 0x01, "German" ) PORT_CONFSETTING( 0x02, "French" ) @@ -678,11 +684,11 @@ static MACHINE_CONFIG_START( sc12, fidel6502_state ) MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_scc") MACHINE_CONFIG_END -static MACHINE_CONFIG_START( fev, fidel6502_state ) +static MACHINE_CONFIG_START( fexcel, fidel6502_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M65SC02, XTAL_12MHz/4) // G65SC102P-3, 12.0M ceramic resonator - MCFG_CPU_PROGRAM_MAP(fev_map) + MCFG_CPU_PROGRAM_MAP(fexcel_map) MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(780)) // from 556 timer, PCB photo suggests it's same as sc12 MCFG_TIMER_START_DELAY(attotime::from_hz(780) - attotime::from_nsec(15250)) // active for 15.25us MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel6502_state, irq_off, attotime::from_hz(780)) @@ -692,14 +698,18 @@ static MACHINE_CONFIG_START( fev, fidel6502_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speech", S14001A, 25000) // R/C circuit, around 25khz - MCFG_S14001A_EXT_READ_HANDLER(READ8(fidel6502_state, fev_speech_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( fexcelv, fexcel ) + + /* sound hardware */ + MCFG_SOUND_ADD("speech", S14001A, 25000) // R/C circuit, around 25khz + MCFG_S14001A_EXT_READ_HANDLER(READ8(fidel6502_state, fexcelv_speech_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) +MACHINE_CONFIG_END + /****************************************************************************** @@ -763,6 +773,12 @@ ROM_START( fscc12 ) ROM_LOAD("tmm2764d-2", 0xe000, 0x2000, CRC(183d3edc) SHA1(3296a4c3bce5209587d4a1694fce153558544e63) ) // Toshiba TMM2764D-2 ROM_END + +ROM_START( fexcel ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("101-1080a01.ic5", 0x8000, 0x8000, CRC(846f8e40) SHA1(4e1d5b08d5ff3422192b54fa82cb3f505a69a971) ) +ROM_END + ROM_START( fexcelv ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD("101-1080a01.ic5", 0x8000, 0x8000, CRC(846f8e40) SHA1(4e1d5b08d5ff3422192b54fa82cb3f505a69a971) ) @@ -771,16 +787,19 @@ ROM_START( fexcelv ) ROM_LOAD("101-1081a01.ic2", 0x0000, 0x8000, CRC(c8ae1607) SHA1(6491ce6be60ed77f3dd931c0ca17616f13af943e) ) ROM_END + + /****************************************************************************** Drivers ******************************************************************************/ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1981, csc, 0, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (English)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1981, cscsp, csc, 0, csc, cscg, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1981, cscg, csc, 0, csc, cscg, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1981, cscfr, csc, 0, csc, cscg, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +COMP( 1981, csc, 0, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (English)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1981, cscsp, csc, 0, csc, cscg, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (Spanish)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1981, cscg, csc, 0, csc, cscg, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (German)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1981, cscfr, csc, 0, csc, cscg, driver_device, 0, "Fidelity Electronics", "Champion Sensory Chess Challenger (French)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1987, fexcelv, 0, 0, fev, fev, driver_device, 0, "Fidelity Electronics", "Voice Excellence", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1987, fexcel, 0, 0, fexcel, fexcel, driver_device, 0, "Fidelity Electronics", "Excellence (model 6080)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1987, fexcelv, 0, 0, fexcelv, fexcelv, driver_device, 0, "Fidelity Electronics", "Voice Excellence", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 4f236fd2947..8ddb32ab675 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -617,7 +617,7 @@ expect that the software reads these once on startup only. ****************************************************************************** -Sensory Chess Challenger (SC12-B) +Sensory Chess Challenger (SC12-B, 6086) 4 versions are known to exist: A,B,C, and X, with increasing CPU speed. --------------------------------- RE information from netlist by Berger @@ -657,8 +657,8 @@ If control Q4 is set, printer data can be read from I0. ****************************************************************************** -Voice Excellence (FEV, model 6092) ----------------------------------- +Voice Excellence (model 6092) +---------------- PCB 1: 510.1117A02, appears to be identical to other "Excellence" boards CPU: GTE G65SC102P-3, 32 KB PRG ROM: AMI 101-1080A01(IC5), 8192x8 SRAM SRM2264C10(IC6) 2 rows of LEDs on the side: 1*8 green, 1*8 red @@ -733,7 +733,7 @@ public: DECLARE_INPUT_CHANGED_MEMBER(reset_button); - // VCC/UVC/CC10 + // CC10 and VCC/UVC void vcc_prepare_display(); DECLARE_READ8_MEMBER(vcc_speech_r); DECLARE_WRITE8_MEMBER(vcc_ppi_porta_w); @@ -759,7 +759,7 @@ public: DECLARE_READ8_MEMBER(vsc_pio_portb_r); DECLARE_WRITE8_MEMBER(vsc_pio_portb_w); - // VBRC (7014) + // VBRC/7014 void vbrc_prepare_display(); DECLARE_WRITE8_MEMBER(vbrc_speech_w); DECLARE_WRITE8_MEMBER(vbrc_mcu_p1_w); @@ -1150,7 +1150,7 @@ WRITE8_MEMBER(fidelz80_state::vsc_pio_portb_w) /****************************************************************************** - VBRC + VBRC/7014 ******************************************************************************/ // misc handlers @@ -1278,7 +1278,7 @@ static ADDRESS_MAP_START( vsc_io, AS_IO, 8, fidelz80_state ) ADDRESS_MAP_END -// VBRC +// VBRC/7014 WRITE8_MEMBER(fidelz80_state::vbrc_speech_w) { diff --git a/src/mame/mess.lst b/src/mame/mess.lst index c1c186a40c7..9f41ab0709e 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2163,6 +2163,7 @@ cscsp // * Spanish cscg // * German cscfr // * French fscc12 +fexcel fexcelv // Hegener & Glaser Munich -- cgit v1.2.3-70-g09d2 From 5b0fcf599756c93a64539b5e2d048273a42b9f92 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 5 Feb 2016 22:48:44 +0100 Subject: New NOT_WORKING machine added ---------- Coleco Talking Teacher [hap, Jonathan Gevaryahu, Sean Riddle, plgDavid, Kevin Horton] --- scripts/target/mame/mess.lua | 1 + src/mame/drivers/ctteach.cpp | 116 ++++++++++++++++++++++++++++++++++++++++++ src/mame/drivers/hh_tms1k.cpp | 2 +- src/mame/mess.lst | 9 ++-- 4 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 src/mame/drivers/ctteach.cpp diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index f89b2b0557e..453b01028b8 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -1464,6 +1464,7 @@ files { MAME_DIR .. "src/mame/includes/coleco.h", MAME_DIR .. "src/mame/machine/coleco.cpp", MAME_DIR .. "src/mame/machine/coleco.h", + MAME_DIR .. "src/mame/drivers/ctteach.cpp", } createMESSProjects(_target, _subtarget, "cromemco") diff --git a/src/mame/drivers/ctteach.cpp b/src/mame/drivers/ctteach.cpp new file mode 100644 index 00000000000..027269f0b7c --- /dev/null +++ b/src/mame/drivers/ctteach.cpp @@ -0,0 +1,116 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/*************************************************************************** + + ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.cpp) ** + + Coleco Talking Teacher + * + +***************************************************************************/ + +#include "includes/hh_tms1k.h" + + +class ctteach_state : public hh_tms1k_state +{ +public: + ctteach_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + +protected: + virtual void machine_start() override; +}; + + +/*************************************************************************** + + I/O + +***************************************************************************/ + +WRITE16_MEMBER(ctteach_state::write_r) +{ +} + +WRITE16_MEMBER(ctteach_state::write_o) +{ +} + +READ8_MEMBER(ctteach_state::read_k) +{ + return 0; +} + + + +/*************************************************************************** + + Inputs + +***************************************************************************/ + +static INPUT_PORTS_START( ctteach ) + +INPUT_PORTS_END + + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + +void ctteach_state::machine_start() +{ + hh_tms1k_state::machine_start(); + + // zerofill + + // register for savestates +} + + +static MACHINE_CONFIG_START( ctteach, ctteach_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1400, 400000) // approximation + MCFG_TMS1XXX_READ_K_CB(READ8(ctteach_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ctteach_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ctteach_state, write_o)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( ctteach ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "mp7324", 0x0000, 0x1000, CRC(08d15ab6) SHA1(5b0f6c53e6732a362c4bb25d966d4072fdd33db8) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 557, "maincpu:opla", 0 ) + ROM_LOAD( "tms1400_ctteach_output.pla", 0, 557, CRC(3a5c7005) SHA1(3fe5819c138a90e7fc12817415f2622ca81b40b2) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) + ROM_LOAD( "cm62084.vsm", 0x0000, 0x4000, CRC(cd1376f7) SHA1(96fa484c392c451599bc083b8376cad9c998df7d) ) +ROM_END + + +COMP( 1987, ctteach, 0, 0, ctteach, ctteach, driver_device, 0, "Coleco", "Talking Teacher", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 9b30fd89b66..6a35b0fe09a 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -74,7 +74,7 @@ *MP7303 TMS1400? 19??, Tiger 7-in-1 Sports Stadium @MP7313 TMS1400 1980, Parker Brothers Bank Shot @MP7314 TMS1400 1980, Parker Brothers Split Second - *MP7324 TMS1400? 1985, Coleco Talking Teacher + MP7324 TMS1400 1987, Coleco Talking Teacher -> ctteach.cpp MP7332 TMS1400 1981, Milton Bradley Dark Tower -> mbdtower.cpp @MP7334 TMS1400 1981, Coleco Total Control 4 @MP7351 TMS1400CR 1982, Parker Brothers Master Merlin diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 9f41ab0709e..48e094ace26 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2314,6 +2314,7 @@ tbreakup // Tomy phpball // Tomy // hh_tms1k derivatives +ctteach // Coleco elecbowl // Marx mbdtower // Milton Bradley @@ -2332,6 +2333,10 @@ lilprof lilprof78 dataman +// hh_tms1k tispellb.cpp +spellb +mrchalgr + // hh_tms1k tispeak.cpp snspell snspellp @@ -2356,10 +2361,6 @@ tntellfr tntellp vocaid -// hh_tms1k tispellb.cpp -spellb -mrchalgr - // hh_ucom4 ufombs // Bambino ssfball // Bambino -- cgit v1.2.3-70-g09d2 From 74630d671bacadd069a053ec5464c353e47045fc Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 6 Feb 2016 02:12:03 +0100 Subject: fidel6502: added 7seg display to fexcel --- src/mame/drivers/fidel6502.cpp | 37 ++++++---- src/mame/layout/fidel_fev.lay | 152 +++++++++++++++++++++++++++-------------- 2 files changed, 121 insertions(+), 68 deletions(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 5837a739585..5ae6d624149 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -41,7 +41,6 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(irq_off) { m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); } // CSC - void csc_update_7442(); void csc_prepare_display(); DECLARE_READ8_MEMBER(csc_speech_r); DECLARE_WRITE8_MEMBER(csc_pia0_pa_w); @@ -62,7 +61,7 @@ public: DECLARE_WRITE8_MEMBER(sc12_control_w); DECLARE_READ8_MEMBER(sc12_input_r); - // 6080/6092 (Excellence) + // 6080/6092/6093 (Excellence) DECLARE_INPUT_CHANGED_MEMBER(fexcelv_bankswitch); DECLARE_READ8_MEMBER(fexcelv_speech_r); DECLARE_WRITE8_MEMBER(fexcel_ttl_w); @@ -79,18 +78,13 @@ public: // misc handlers -void fidel6502_state::csc_update_7442() +void fidel6502_state::csc_prepare_display() { // 7442 0-8: led select, input mux m_inp_mux = 1 << m_led_select & 0x3ff; // 7442 9: speaker out m_speaker->level_w(m_inp_mux >> 9 & 1); -} - -void fidel6502_state::csc_prepare_display() -{ - csc_update_7442(); // 4 7seg leds + H for (int i = 0; i < 4; i++) @@ -100,7 +94,7 @@ void fidel6502_state::csc_prepare_display() for (int i = 0; i < 8; i++) m_display_state[i+4] = (m_inp_mux >> i & 1) ? m_led_data : 0; - set_display_size(8, 12); + set_display_size(8, 4+8); set_display_segmask(0xf, 0x7f); display_update(); } @@ -268,7 +262,7 @@ READ8_MEMBER(fidel6502_state::sc12_input_r) /****************************************************************************** - 6080/6092 (Excellence) + 6080/6092/6093 (Excellence) ******************************************************************************/ // misc handlers @@ -299,15 +293,28 @@ WRITE8_MEMBER(fidel6502_state::fexcel_ttl_w) // 74259 Q0-Q3: 7442 a0-a3 // 7442 0-8: led data, input mux UINT16 sel = 1 << (m_led_select & 0xf) & 0x3ff; + UINT8 led_data = sel & 0xff; m_inp_mux = sel & 0x1ff; // 7442 9: speaker out (optional?) m_speaker->level_w(sel >> 9 & 1); - // 74259 Q4,Q5: led select (active low) - display_matrix(9, 2, sel & 0x1ff, ~m_led_select >> 4 & 3); + // 74259 Q4-Q7,Q2,Q1: digit/led select (active low) + UINT8 led_sel = ~BITSWAP8(m_led_select,0,3,1,2,7,6,5,4) & 0x3f; + + // a0-a2,d1: digit segment data (optional/model 6093) + m_7seg_data = (m_7seg_data & ~mask) | ((data & 2) ? mask : 0); + UINT8 seg_data = BITSWAP8(m_7seg_data,0,1,3,2,7,5,6,4); - // speech (model 6092) + // update display: 4 7seg leds, 2*8 chessboard leds + for (int i = 0; i < 6; i++) + m_display_state[i] = (led_sel >> i & 1) ? ((i < 2) ? led_data : seg_data) : 0; + + set_display_size(8, 2+4); + set_display_segmask(0x3c, 0x7f); + display_update(); + + // speech (optional/model 6092) if (m_speech != nullptr) { // a0-a2,d2: 74259(2) to speech board @@ -365,7 +372,7 @@ static ADDRESS_MAP_START( sc12_map, AS_PROGRAM, 8, fidel6502_state ) ADDRESS_MAP_END -// 6080/6092 (Excellence) +// 6080/6092/6093 (Excellence) static ADDRESS_MAP_START( fexcel_map, AS_PROGRAM, 8, fidel6502_state ) AM_RANGE(0x0000, 0x1fff) AM_MIRROR(0x2000) AM_RAM @@ -801,5 +808,5 @@ COMP( 1981, cscfr, csc, 0, csc, cscg, driver_device, 0, "Fideli COMP( 1984, fscc12, 0, 0, sc12, sc12, driver_device, 0, "Fidelity Electronics", "Sensory Chess Challenger 12-B", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1987, fexcel, 0, 0, fexcel, fexcel, driver_device, 0, "Fidelity Electronics", "Excellence (model 6080)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1987, fexcel, 0, 0, fexcel, fexcel, driver_device, 0, "Fidelity Electronics", "Excellence (model 6080/6093)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) COMP( 1987, fexcelv, 0, 0, fexcelv, fexcelv, driver_device, 0, "Fidelity Electronics", "Voice Excellence", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/layout/fidel_fev.lay b/src/mame/layout/fidel_fev.lay index 51cc059ee7e..1ecc3e9bcc7 100644 --- a/src/mame/layout/fidel_fev.lay +++ b/src/mame/layout/fidel_fev.lay @@ -5,6 +5,10 @@ + + + + @@ -192,22 +196,40 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + @@ -385,52 +407,76 @@ + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-70-g09d2 From 7403c195b349048f855f6165aaceeeaef5d0acec Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 6 Feb 2016 02:20:51 +0100 Subject: fidel6502: small cleanup --- src/mame/drivers/fidel6502.cpp | 167 ++++++++++++----------------------------- 1 file changed, 48 insertions(+), 119 deletions(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 5ae6d624149..7c59d740167 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -386,125 +386,6 @@ ADDRESS_MAP_END Input Ports ******************************************************************************/ -static INPUT_PORTS_START( csc ) - PORT_START("IN.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a1") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a2") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a3") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a4") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a5") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a6") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a7") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a8") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) - - PORT_START("IN.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b1") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b2") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b3") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b4") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b5") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b6") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b7") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square b8") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV") PORT_CODE(KEYCODE_V) - - PORT_START("IN.2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c1") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c2") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c3") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c4") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c5") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c6") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c7") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square c8") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TM") PORT_CODE(KEYCODE_T) - - PORT_START("IN.3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d1") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d2") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d3") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d4") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d5") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d6") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d7") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square d8") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) - - PORT_START("IN.4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e1") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e2") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e3") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e4") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e5") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e6") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e7") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square e8") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) - - PORT_START("IN.5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f1") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f2") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f3") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f4") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f5") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f6") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f7") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square f8") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) - - PORT_START("IN.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g1") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g2") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g3") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g4") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g5") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g6") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g7") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square g8") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("IN.7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h1") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h2") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h3") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h4") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h5") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h6") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h7") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h8") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("IN.8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Rook") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Knight") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bishop") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Queen") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("IN.9") // hardwired - PORT_CONFNAME( 0x01, 0x00, "Language" ) - PORT_CONFSETTING( 0x00, "English" ) - PORT_CONFSETTING( 0x01, "Other" ) - PORT_CONFNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x02, DEF_STR( On ) ) -INPUT_PORTS_END - -static INPUT_PORTS_START( cscg ) - PORT_INCLUDE( csc ) - - PORT_MODIFY("IN.9") - PORT_CONFNAME( 0x01, 0x01, "Language" ) - PORT_CONFSETTING( 0x00, "English" ) - PORT_CONFSETTING( 0x01, "Other" ) -INPUT_PORTS_END - - static INPUT_PORTS_START( sc12 ) PORT_START("IN.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square a1") @@ -625,6 +506,54 @@ static INPUT_PORTS_START( fexcelv ) INPUT_PORTS_END +static INPUT_PORTS_START( csc ) + PORT_INCLUDE( sc12 ) + + PORT_MODIFY("IN.0") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) + + PORT_MODIFY("IN.1") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV") PORT_CODE(KEYCODE_V) + + PORT_MODIFY("IN.2") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TM") PORT_CODE(KEYCODE_T) + + PORT_MODIFY("IN.3") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) + + PORT_MODIFY("IN.4") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) + + PORT_MODIFY("IN.5") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) + + PORT_MODIFY("IN.8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Rook") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Knight") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bishop") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Queen") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) + + PORT_START("IN.9") // hardwired + PORT_CONFNAME( 0x01, 0x00, "Language" ) + PORT_CONFSETTING( 0x00, "English" ) + PORT_CONFSETTING( 0x01, "Other" ) + PORT_CONFNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x02, DEF_STR( On ) ) +INPUT_PORTS_END + +static INPUT_PORTS_START( cscg ) + PORT_INCLUDE( csc ) + + PORT_MODIFY("IN.9") + PORT_CONFNAME( 0x01, 0x01, "Language" ) + PORT_CONFSETTING( 0x00, "English" ) + PORT_CONFSETTING( 0x01, "Other" ) +INPUT_PORTS_END + + /****************************************************************************** Machine Drivers -- cgit v1.2.3-70-g09d2 From 570db5bf5c93c895dca2c9fb7cd02d22366a6938 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 6 Feb 2016 08:54:06 +0100 Subject: made -cc creates ui.ini as well (nw) --- src/emu/clifront.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/emu/clifront.cpp b/src/emu/clifront.cpp index 50e8464a14c..a016d13a031 100644 --- a/src/emu/clifront.cpp +++ b/src/emu/clifront.cpp @@ -27,6 +27,8 @@ #include "osdepend.h" #include "softlist.h" +#include "ui/moptions.h" + #include #include @@ -1618,6 +1620,14 @@ void cli_frontend::execute_commands(const char *exename) // generate the updated INI file.puts(m_options.output_ini().c_str()); + + ui_options ui_opts; + emu_file file_ui(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + if (file_ui.open("ui.ini") != FILERR_NONE) + throw emu_fatalerror("Unable to create file ui.ini\n"); + + // generate the updated INI + file_ui.puts(ui_opts.output_ini().c_str()); return; } -- cgit v1.2.3-70-g09d2 From dbfcc63e2cdaf3a9e73710c7dad08cba08eaa4c7 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 6 Feb 2016 09:27:51 +0100 Subject: fix my mistake in software selection (nw) --- src/emu/ui/selsoft.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index 88cbd8cb2d0..fc3d21b550d 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -873,9 +873,9 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) } std::string error_string; std::string string_list = std::string(ui_swinfo->listname).append(":").append(ui_swinfo->shortname).append(":").append(ui_swinfo->part).append(":").append(ui_swinfo->instance); - mopt.set_value(OPTION_SOFTWARENAME, string_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().options().set_value(OPTION_SOFTWARENAME, string_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); std::string snap_list = std::string(ui_swinfo->listname).append(PATH_SEPARATOR).append(ui_swinfo->shortname); - mopt.set_value(OPTION_SNAPNAME, snap_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().options().set_value(OPTION_SNAPNAME, snap_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); reselect_last::driver = drivlist.driver().name; reselect_last::software = ui_swinfo->shortname; reselect_last::swlist = ui_swinfo->listname; -- cgit v1.2.3-70-g09d2 From 4404f3dab3b85d2f9dd9c82766d5412e26eb5897 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Sat, 6 Feb 2016 09:49:57 +0100 Subject: bus/neogeo/bootleg_prot.cpp: fixed save state problem for kof10th (nw) --- src/devices/bus/neogeo/bootleg_prot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/bus/neogeo/bootleg_prot.cpp b/src/devices/bus/neogeo/bootleg_prot.cpp index 8c023f00091..145e17efa0b 100644 --- a/src/devices/bus/neogeo/bootleg_prot.cpp +++ b/src/devices/bus/neogeo/bootleg_prot.cpp @@ -142,8 +142,7 @@ WRITE16_MEMBER( ngbootleg_prot_device::kof10th_custom_w ) //UINT16 *prom = (UINT16*)m_mainrom; COMBINE_DATA(&m_cartridge_ram2[(0x00000/2) + (offset & 0xFFFF)]); } else { // Write S data on-the-fly - UINT8 *srom = m_fixedrom; - srom[offset] = BITSWAP8(data,7,6,0,4,3,2,1,5); + m_fixedrom[offset] = BITSWAP8(data,7,6,0,4,3,2,1,5); } } @@ -173,6 +172,7 @@ void ngbootleg_prot_device::install_kof10th_protection (cpu_device* maincpu, neo maincpu->space(AS_PROGRAM).install_write_handler(0x240000, 0x2fffff, write16_delegate(FUNC(ngbootleg_prot_device::kof10th_bankswitch_w),this)); memcpy(m_cartridge_ram2, cpurom + 0xe0000, 0x20000); + save_pointer(NAME(m_fixedrom), 0x40000); } void ngbootleg_prot_device::decrypt_kof10th(UINT8* cpurom, UINT32 cpurom_size) -- cgit v1.2.3-70-g09d2 From 65d9003144f14b856bde8c728d39e5e20d18b59b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 6 Feb 2016 10:39:49 +0100 Subject: fixed rest of ui.ini mame.ini read/write settings (nw) --- src/emu/ui/dirmenu.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++++----- src/emu/ui/miscmenu.cpp | 15 ++++++++++-- src/emu/ui/selgame.cpp | 4 ++-- 3 files changed, 70 insertions(+), 10 deletions(-) diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp index a180997aa8a..c023b83e463 100644 --- a/src/emu/ui/dirmenu.cpp +++ b/src/emu/ui/dirmenu.cpp @@ -144,13 +144,40 @@ void ui_menu_add_change_folder::handle() std::string error_string; if (m_change) { - machine().options().set_value(s_folders_entry[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + if (machine().ui().options().exists(s_folders_entry[m_ref].option)) + { + machine().ui().options().set_value(s_folders_entry[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + } + else { + if (strcmp(machine().options().value(s_folders_entry[m_ref].option), m_current_path.c_str()) != 0) + { + machine().options().set_value(s_folders_entry[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + save_main_option(machine(), s_folders_entry[m_ref].option, m_current_path.c_str()); + } + } machine().datfile().reset_run(); } else { - std::string tmppath = std::string(machine().options().value(s_folders_entry[m_ref].option)).append(";").append(m_current_path.c_str()); - machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + std::string tmppath; + if (machine().ui().options().exists(s_folders_entry[m_ref].option)) { + tmppath.assign(machine().ui().options().value(s_folders_entry[m_ref].option)).append(";").append(m_current_path.c_str()); + } + else { + tmppath.assign(machine().options().value(s_folders_entry[m_ref].option)).append(";").append(m_current_path.c_str()); + } + + if (machine().ui().options().exists(s_folders_entry[m_ref].option)) + { + machine().ui().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + } + else { + if (strcmp(machine().options().value(s_folders_entry[m_ref].option), tmppath.c_str()) != 0) + { + machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + save_main_option(machine(), s_folders_entry[m_ref].option, tmppath.c_str()); + } + } } ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST); @@ -464,7 +491,12 @@ void ui_menu_display_actual::handle() void ui_menu_display_actual::populate() { m_tempbuf.assign("Current ").append(s_folders_entry[m_ref - 1].name).append(" Folders"); - m_searchpath.assign(machine().options().value(s_folders_entry[m_ref - 1].option)); + if (machine().ui().options().exists(s_folders_entry[m_ref - 1].option)) { + m_searchpath.assign(machine().ui().options().value(s_folders_entry[m_ref - 1].option)); + } + else { + m_searchpath.assign(machine().options().value(s_folders_entry[m_ref - 1].option)); + } path_iterator path(m_searchpath.c_str()); std::string curpath; m_folders.clear(); @@ -557,7 +589,13 @@ void ui_menu_display_actual::custom_render(void *selectedref, float top, float b ui_menu_remove_folder::ui_menu_remove_folder(running_machine &machine, render_container *container, int ref) : ui_menu(machine, container) { m_ref = ref - 1; - m_searchpath.assign(machine.options().value(s_folders_entry[m_ref].option)); + if (machine.ui().options().exists(s_folders_entry[m_ref].option)) { + m_searchpath.assign(machine.ui().options().value(s_folders_entry[m_ref].option)); + } + else { + m_searchpath.assign(machine.options().value(s_folders_entry[m_ref].option)); + } + } ui_menu_remove_folder::~ui_menu_remove_folder() @@ -582,7 +620,18 @@ void ui_menu_remove_folder::handle() tmppath.substr(0, tmppath.size() - 1); std::string error_string; - machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + if (machine().ui().options().exists(s_folders_entry[m_ref].option)) + { + machine().ui().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + } + else { + if (strcmp(machine().options().value(s_folders_entry[m_ref].option),tmppath.c_str())!=0) + { + machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + save_main_option(machine(), s_folders_entry[m_ref].option, tmppath.c_str()); + } + } + ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF); ui_menu::stack_pop(machine()); } diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp index 3f5b987975f..e1eccb86a37 100644 --- a/src/emu/ui/miscmenu.cpp +++ b/src/emu/ui/miscmenu.cpp @@ -585,8 +585,19 @@ ui_menu_misc_options::ui_menu_misc_options(running_machine &machine, render_cont ui_menu_misc_options::~ui_menu_misc_options() { std::string error_string; - for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) - machine().ui().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); + for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) { + if (machine().ui().options().exists(m_options[d].option)) + { + machine().ui().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); + } + else { + if (machine().options().bool_value(m_options[d].option) != m_options[d].status) + { + machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); + save_main_option(machine(), m_options[d].option, m_options[d].status); + } + } + } ui_globals::reset = true; } diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 10a53dfae9b..e8deb09c3e3 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -166,8 +166,8 @@ ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_contai if (!moptions.remember_last()) reselect_last::reset(); - moptions.set_value(OPTION_SNAPNAME, "%g/%i", OPTION_PRIORITY_CMDLINE, error_string); - moptions.set_value(OPTION_SOFTWARENAME, "", OPTION_PRIORITY_CMDLINE, error_string); + machine.options().set_value(OPTION_SNAPNAME, "%g/%i", OPTION_PRIORITY_CMDLINE, error_string); + machine.options().set_value(OPTION_SOFTWARENAME, "", OPTION_PRIORITY_CMDLINE, error_string); ui_globals::curimage_view = FIRST_VIEW; ui_globals::curdats_view = UI_FIRST_LOAD; -- cgit v1.2.3-70-g09d2 From f80ff018913eb689e89a6fc50ceb78d132754a8c Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 6 Feb 2016 13:47:21 +0100 Subject: MAME related settings are saved on request only (nw) --- src/emu/ui/ctrlmenu.cpp | 2 +- src/emu/ui/dirmenu.cpp | 8 ++-- src/emu/ui/dsplmenu.cpp | 5 ++- src/emu/ui/menu.cpp | 4 +- src/emu/ui/menu.h | 4 -- src/emu/ui/miscmenu.cpp | 2 +- src/emu/ui/optsmenu.cpp | 54 ------------------------ src/emu/ui/selgame.cpp | 105 ++++++++++++++++++++++++++++++++++++----------- src/emu/ui/sndmenu.cpp | 6 +-- src/lib/util/options.cpp | 23 ++++++++++- src/lib/util/options.h | 5 +++ 11 files changed, 123 insertions(+), 95 deletions(-) diff --git a/src/emu/ui/ctrlmenu.cpp b/src/emu/ui/ctrlmenu.cpp index d08cfd391f2..5d006693faf 100644 --- a/src/emu/ui/ctrlmenu.cpp +++ b/src/emu/ui/ctrlmenu.cpp @@ -49,7 +49,7 @@ ui_menu_controller_mapping::~ui_menu_controller_mapping() if (strcmp(machine().options().value(m_options[d].option),m_device_status[m_options[d].status])!=0) { machine().options().set_value(m_options[d].option, m_device_status[m_options[d].status], OPTION_PRIORITY_CMDLINE, error_string); - save_main_option(machine(),m_options[d].option, m_device_status[m_options[d].status]); + machine().options().mark_changed(m_options[d].option); } } } diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp index c023b83e463..3ac9803cee6 100644 --- a/src/emu/ui/dirmenu.cpp +++ b/src/emu/ui/dirmenu.cpp @@ -152,7 +152,7 @@ void ui_menu_add_change_folder::handle() if (strcmp(machine().options().value(s_folders_entry[m_ref].option), m_current_path.c_str()) != 0) { machine().options().set_value(s_folders_entry[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - save_main_option(machine(), s_folders_entry[m_ref].option, m_current_path.c_str()); + machine().options().mark_changed(s_folders_entry[m_ref].option); } } machine().datfile().reset_run(); @@ -175,7 +175,7 @@ void ui_menu_add_change_folder::handle() if (strcmp(machine().options().value(s_folders_entry[m_ref].option), tmppath.c_str()) != 0) { machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - save_main_option(machine(), s_folders_entry[m_ref].option, tmppath.c_str()); + machine().options().mark_changed(s_folders_entry[m_ref].option); } } } @@ -627,8 +627,8 @@ void ui_menu_remove_folder::handle() else { if (strcmp(machine().options().value(s_folders_entry[m_ref].option),tmppath.c_str())!=0) { - machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - save_main_option(machine(), s_folders_entry[m_ref].option, tmppath.c_str()); + machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().options().mark_changed(s_folders_entry[m_ref].option); } } diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp index 48707e530ee..cea63f34759 100644 --- a/src/emu/ui/dsplmenu.cpp +++ b/src/emu/ui/dsplmenu.cpp @@ -86,13 +86,14 @@ ui_menu_display_options::~ui_menu_display_options() if (machine().options().int_value(m_options[d].option)!=m_options[d].status) { machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); - save_main_option(machine(),m_options[d].option, m_options[d].status); + machine().options().mark_changed(m_options[d].option); } } if (strcmp(machine().options().value(m_options[1].option), m_video[m_options[1].status].option)!=0) { machine().options().set_value(m_options[1].option, m_video[m_options[1].status].option, OPTION_PRIORITY_CMDLINE, error_string); - save_main_option(machine(),m_options[1].option, m_video[m_options[1].status].option); + machine().options().mark_changed(m_options[1].option); + } ui_globals::reset = true; } diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index b401da66144..43e3474f3be 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -1376,8 +1376,8 @@ void ui_menu::draw_select_game(bool noinput) container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); hover = item.size() + 1; - visible_items = (is_swlist) ? item.size() - 2 : item.size() - 4; - float extra_height = (is_swlist) ? 2.0f * line_height : 4.0f * line_height; + visible_items = (is_swlist) ? item.size() - 2 : item.size() - 5; + float extra_height = (is_swlist) ? 2.0f * line_height : 5.0f * line_height; float visible_extra_menu_height = customtop + custombottom + extra_height; // locate mouse diff --git a/src/emu/ui/menu.h b/src/emu/ui/menu.h index 64b24f158be..174d2866fac 100644 --- a/src/emu/ui/menu.h +++ b/src/emu/ui/menu.h @@ -278,8 +278,4 @@ private: void draw_icon(int linenum, void *selectedref, float x1, float y1); }; -void save_main_option(running_machine &machine,const char *name, const char *value); -void save_main_option(running_machine &machine,const char *name, int value); -void save_main_option(running_machine &machine,const char *name, float value); - #endif // __UI_MENU_H__ diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp index e1eccb86a37..0b41eed95bb 100644 --- a/src/emu/ui/miscmenu.cpp +++ b/src/emu/ui/miscmenu.cpp @@ -594,7 +594,7 @@ ui_menu_misc_options::~ui_menu_misc_options() if (machine().options().bool_value(m_options[d].option) != m_options[d].status) { machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); - save_main_option(machine(), m_options[d].option, m_options[d].status); + machine().options().mark_changed(m_options[d].option); } } } diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp index b77d41c5b87..1884547d8c5 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/emu/ui/optsmenu.cpp @@ -340,57 +340,3 @@ void save_ui_options(running_machine &machine) else machine.popmessage("**Error to save ui.ini**", emulator_info::get_configname()); } - -//------------------------------------------------- -// save main option -//------------------------------------------------- - -void save_main_option(running_machine &machine,const char *name, const char *value) -{ - // parse the file - std::string error; - emu_options options(machine.options()); // This way we make sure that all OSD parts are in - std::string error_string; - - // attempt to open the main ini file - { - emu_file file(machine.options().ini_path(), OPEN_FLAG_READ); - if (file.open(emulator_info::get_configname(), ".ini") == FILERR_NONE) - { - bool result = options.parse_ini_file((core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error); - if (!result) - { - osd_printf_error("**Error to load %s.ini**", emulator_info::get_configname()); - return; - } - } - } - - options.set_value(name, value, OPTION_PRIORITY_CMDLINE, error_string); - - // attempt to open the output file - { - emu_file file(machine.options().ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open(emulator_info::get_configname(), ".ini") == FILERR_NONE) - { - // generate the updated INI - std::string initext = options.output_ini(); - file.puts(initext.c_str()); - file.close(); - } - else - machine.popmessage("**Error to save %s.ini**", emulator_info::get_configname()); - } -} - -void save_main_option(running_machine &machine,const char *name, int value) -{ - std::string tempstr = strformat("%d", value); - save_main_option(machine,name,tempstr.c_str()); -} - -void save_main_option(running_machine &machine,const char *name, float value) -{ - std::string tempstr = strformat("%f", (double)value); - save_main_option(machine,name,tempstr.c_str()); -} diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index e8deb09c3e3..9642826e024 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -101,6 +101,57 @@ bool sort_game_list(const game_driver *x, const game_driver *y) } } +//------------------------------------------------- +// save main option +//------------------------------------------------- + +void save_main_option(running_machine &machine) +{ + // parse the file + std::string error; + emu_options options(machine.options()); // This way we make sure that all OSD parts are in + std::string error_string; + + // attempt to open the main ini file + { + emu_file file(machine.options().ini_path(), OPEN_FLAG_READ); + if (file.open(emulator_info::get_configname(), ".ini") == FILERR_NONE) + { + bool result = options.parse_ini_file((core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error); + if (!result) + { + osd_printf_error("**Error to load %s.ini**", emulator_info::get_configname()); + return; + } + } + } + + for (emu_options::entry *f_entry = machine.options().first(); f_entry != nullptr; f_entry = f_entry->next()) + { + if (f_entry->is_changed()) + { + options.set_value(f_entry->name(), f_entry->value(), OPTION_PRIORITY_CMDLINE, error_string); + } + } + + // attempt to open the output file + { + emu_file file(machine.options().ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + if (file.open(emulator_info::get_configname(), ".ini") == FILERR_NONE) + { + // generate the updated INI + std::string initext = options.output_ini(); + file.puts(initext.c_str()); + file.close(); + } + else { + machine.popmessage("**Error to save %s.ini**", emulator_info::get_configname()); + return; + } + } + machine.ui().popup_time(3, "\n Configuration saved \n\n"); +} + //------------------------------------------------- // ctor //------------------------------------------------- @@ -191,10 +242,10 @@ ui_menu_select_game::~ui_menu_select_game() else driver = (selected >= 0 && selected < item.size()) ? (const game_driver *)item[selected].ref : nullptr; - if ((FPTR)driver > 2) + if ((FPTR)driver > 3) last_driver = driver->name; - if ((FPTR)swinfo > 2) + if ((FPTR)swinfo > 3) last_driver = swinfo->shortname; std::string filter(main_filters::text[main_filters::actual]); @@ -330,13 +381,13 @@ void ui_menu_select_game::handle() if (main_filters::actual != FILTER_FAVORITE_GAME) { const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 2) + if ((FPTR)driver > 3) ui_menu::stack_push(global_alloc_clear(machine(), container, UI_HISTORY_LOAD, driver)); } else { ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 2) + if ((FPTR)swinfo > 3) { if (swinfo->startempty == 1) ui_menu::stack_push(global_alloc_clear(machine(), container, UI_HISTORY_LOAD, swinfo->driver)); @@ -352,7 +403,7 @@ void ui_menu_select_game::handle() if (main_filters::actual != FILTER_FAVORITE_GAME) { const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 2) + if ((FPTR)driver > 3) { if ((driver->flags & MACHINE_TYPE_ARCADE) != 0) ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MAMEINFO_LOAD, driver)); @@ -363,7 +414,7 @@ void ui_menu_select_game::handle() else { ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 2 && swinfo->startempty == 1) + if ((FPTR)swinfo > 3 && swinfo->startempty == 1) { if ((swinfo->driver->flags & MACHINE_TYPE_ARCADE) != 0) ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MAMEINFO_LOAD, swinfo->driver)); @@ -379,13 +430,13 @@ void ui_menu_select_game::handle() if (main_filters::actual != FILTER_FAVORITE_GAME) { const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 2) + if ((FPTR)driver > 3) ui_menu::stack_push(global_alloc_clear(machine(), container, UI_STORY_LOAD, driver)); } else { ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 2 && swinfo->startempty == 1) + if ((FPTR)swinfo > 3 && swinfo->startempty == 1) ui_menu::stack_push(global_alloc_clear(machine(), container, UI_STORY_LOAD, swinfo->driver)); } } @@ -396,13 +447,13 @@ void ui_menu_select_game::handle() if (main_filters::actual != FILTER_FAVORITE_GAME) { const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 2) + if ((FPTR)driver > 3) ui_menu::stack_push(global_alloc_clear(machine(), container, UI_SYSINFO_LOAD, driver)); } else { ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 2 && swinfo->startempty == 1) + if ((FPTR)swinfo > 3 && swinfo->startempty == 1) ui_menu::stack_push(global_alloc_clear(machine(), container, UI_SYSINFO_LOAD, swinfo->driver)); } } @@ -413,13 +464,13 @@ void ui_menu_select_game::handle() if (main_filters::actual != FILTER_FAVORITE_GAME) { const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 2) + if ((FPTR)driver > 3) ui_menu::stack_push(global_alloc_clear(machine(), container, driver)); } else { ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 2 && swinfo->startempty == 1) + if ((FPTR)swinfo > 3 && swinfo->startempty == 1) ui_menu::stack_push(global_alloc_clear(machine(), container, swinfo->driver)); } } @@ -430,7 +481,7 @@ void ui_menu_select_game::handle() if (main_filters::actual != FILTER_FAVORITE_GAME) { const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 2) + if ((FPTR)driver > 3) { if (!machine().favorite().isgame_favorite(driver)) { @@ -448,7 +499,7 @@ void ui_menu_select_game::handle() else { ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 2) + if ((FPTR)swinfo > 3) { machine().popmessage("%s\n removed from favorites list.", swinfo->longname.c_str()); machine().favorite().remove_favorite_game(*swinfo); @@ -657,6 +708,7 @@ void ui_menu_select_game::populate() item_append(MENU_SEPARATOR_ITEM, nullptr, MENU_FLAG_UI, nullptr); item_append("Configure Options", nullptr, MENU_FLAG_UI, (void *)(FPTR)1); item_append("Configure Directories", nullptr, MENU_FLAG_UI, (void *)(FPTR)2); + item_append("Save Configuration", nullptr, MENU_FLAG_UI, (void *)(FPTR)3); // configure the custom rendering customtop = 3.0f * machine().ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER; @@ -811,15 +863,15 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott // determine the text to render below if (main_filters::actual != FILTER_FAVORITE_GAME) - driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr; + driver = ((FPTR)selectedref > 3) ? (const game_driver *)selectedref : nullptr; else { - swinfo = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr; + swinfo = ((FPTR)selectedref > 3) ? (ui_software_info *)selectedref : nullptr; if (swinfo && swinfo->startempty == 1) driver = swinfo->driver; } - if ((FPTR)driver > 2) + if ((FPTR)driver > 3) { isstar = machine().favorite().isgame_favorite(driver); @@ -868,7 +920,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott color = UI_RED_COLOR; } - else if ((FPTR)swinfo > 2) + else if ((FPTR)swinfo > 3) { isstar = machine().favorite().isgame_favorite(*swinfo); @@ -1000,6 +1052,10 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event) else if ((FPTR)driver == 2) ui_menu::stack_push(global_alloc_clear(machine(), container)); // anything else is a driver + else if ((FPTR)driver == 3) { + save_main_option(machine()); + } + // anything else is a driver else { // audit the game first to see if we're going to work @@ -1060,7 +1116,10 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) // special case for configure directory else if ((FPTR)ui_swinfo == 2) ui_menu::stack_push(global_alloc_clear(machine(), container)); - + else if ((FPTR)ui_swinfo == 3) + { + save_main_option(machine()); + } else if (ui_swinfo->startempty == 1) { // audit the game first to see if we're going to work @@ -2077,7 +2136,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or if (is_favorites) { - soft = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr; + soft = ((FPTR)selectedref > 3) ? (ui_software_info *)selectedref : nullptr; if (soft && soft->startempty == 1) { driver = soft->driver; @@ -2088,7 +2147,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or } else { - driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr; + driver = ((FPTR)selectedref > 3) ? (const game_driver *)selectedref : nullptr; oldsoft = nullptr; } @@ -2393,7 +2452,7 @@ void ui_menu_select_game::arts_render(void *selectedref, float origx1, float ori if (is_favorites) { - soft = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr; + soft = ((FPTR)selectedref > 3) ? (ui_software_info *)selectedref : nullptr; if (soft && soft->startempty == 1) { driver = soft->driver; @@ -2404,7 +2463,7 @@ void ui_menu_select_game::arts_render(void *selectedref, float origx1, float ori } else { - driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr; + driver = ((FPTR)selectedref > 3) ? (const game_driver *)selectedref : nullptr; oldsoft = nullptr; } diff --git a/src/emu/ui/sndmenu.cpp b/src/emu/ui/sndmenu.cpp index 14f8d639a67..06563c661b3 100644 --- a/src/emu/ui/sndmenu.cpp +++ b/src/emu/ui/sndmenu.cpp @@ -52,17 +52,17 @@ ui_menu_sound_options::~ui_menu_sound_options() if (strcmp(moptions.value(OSDOPTION_SOUND),m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE)!=0) { moptions.set_value(OSDOPTION_SOUND, m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE, OPTION_PRIORITY_CMDLINE, error_string); - save_main_option(machine(),OSDOPTION_SOUND, m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE); + machine().options().mark_changed(OSDOPTION_SOUND); } if (moptions.int_value(OPTION_SAMPLERATE)!=m_sound_rate[m_cur_rates]) { moptions.set_value(OPTION_SAMPLERATE, m_sound_rate[m_cur_rates], OPTION_PRIORITY_CMDLINE, error_string); - save_main_option(machine(),OPTION_SAMPLERATE, m_sound_rate[m_cur_rates]); + machine().options().mark_changed(OPTION_SAMPLERATE); } if (moptions.bool_value(OPTION_SAMPLES)!=m_samples) { moptions.set_value(OPTION_SAMPLES, m_samples, OPTION_PRIORITY_CMDLINE, error_string); - save_main_option(machine(),OPTION_SAMPLES, m_samples); + machine().options().mark_changed(OPTION_SAMPLES); } } diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp index d7ab454d063..830721127ac 100644 --- a/src/lib/util/options.cpp +++ b/src/lib/util/options.cpp @@ -58,7 +58,8 @@ core_options::entry::entry(const char *name, const char *description, UINT32 fla m_seqid(0), m_error_reported(false), m_priority(OPTION_PRIORITY_DEFAULT), - m_description(description) + m_description(description), + m_changed(false) { // copy in the name(s) as appropriate if (name != nullptr) @@ -614,6 +615,16 @@ bool core_options::exists(const char *name) const return (m_entrymap.find(name) != m_entrymap.end()); } +//------------------------------------------------- +// is_changed - return if option have been marked +// changed +//------------------------------------------------- + +bool core_options::is_changed(const char *name) const +{ + auto curentry = m_entrymap.find(name); + return (curentry != m_entrymap.end()) ? curentry->second->is_changed() : false; +} //------------------------------------------------- // set_value - set the raw option value //------------------------------------------------- @@ -656,6 +667,16 @@ void core_options::set_flag(const char *name, UINT32 mask, UINT32 flag) curentry->second->set_flag(mask, flag); } +void core_options::mark_changed(const char* name) +{ + // find the entry first + auto curentry = m_entrymap.find(name); + if (curentry == m_entrymap.end()) + { + return; + } + curentry->second->mark_changed(); +} //------------------------------------------------- // reset - reset the options state, removing diff --git a/src/lib/util/options.h b/src/lib/util/options.h index 1df89bed6c7..5edf64a9fcd 100644 --- a/src/lib/util/options.h +++ b/src/lib/util/options.h @@ -89,12 +89,14 @@ public: bool is_internal() const { return m_flags & OPTION_FLAG_INTERNAL; } bool has_range() const { return (!m_minimum.empty() && !m_maximum.empty()); } int priority() const { return m_priority; } + bool is_changed() const { return m_changed; } // setters void set_value(const char *newvalue, int priority); void set_default_value(const char *defvalue); void set_description(const char *description); void set_flag(UINT32 mask, UINT32 flag); + void mark_changed() { m_changed = true; } void revert(int priority); private: @@ -110,6 +112,7 @@ public: std::string m_defdata; // default data for this item std::string m_minimum; // minimum value std::string m_maximum; // maximum value + bool m_changed; // changed flag }; // construction/destruction @@ -157,6 +160,7 @@ public: float float_value(const char *name) const { return atof(value(name)); } UINT32 seqid(const char *name) const; bool exists(const char *name) const; + bool is_changed(const char *name) const; // setting void set_command(const char *command); @@ -164,6 +168,7 @@ public: bool set_value(const char *name, int value, int priority, std::string &error_string); bool set_value(const char *name, float value, int priority, std::string &error_string); void set_flag(const char *name, UINT32 mask, UINT32 flags); + void mark_changed(const char *name); // misc static const char *unadorned(int x = 0) { return s_option_unadorned[MIN(x, MAX_UNADORNED_OPTIONS)]; } -- cgit v1.2.3-70-g09d2 From 1bc83295c759e938ed776c0f02d775de1a23f351 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 6 Feb 2016 13:54:15 +0100 Subject: added save to simple ui (nw) --- src/emu/ui/simpleselgame.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/emu/ui/simpleselgame.cpp b/src/emu/ui/simpleselgame.cpp index 0c96ff4022d..8f5ada60071 100644 --- a/src/emu/ui/simpleselgame.cpp +++ b/src/emu/ui/simpleselgame.cpp @@ -135,7 +135,7 @@ void ui_simple_menu_select_game::handle() //------------------------------------------------- // inkey_select //------------------------------------------------- - +extern void save_main_option(running_machine &machine); void ui_simple_menu_select_game::inkey_select(const ui_menu_event *menu_event) { const game_driver *driver = (const game_driver *)menu_event->itemref; @@ -143,7 +143,8 @@ void ui_simple_menu_select_game::inkey_select(const ui_menu_event *menu_event) // special case for configure inputs if ((FPTR)driver == 1) ui_menu::stack_push(global_alloc_clear(machine(), container)); - + else if ((FPTR)driver == 2) + save_main_option(machine()); // anything else is a driver else { @@ -262,6 +263,7 @@ void ui_simple_menu_select_game::populate() { item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); item_append("Configure Options", nullptr, 0, (void *)1); + item_append("Save Configuration", nullptr, 0, (void *)2); } // configure the custom rendering @@ -314,8 +316,8 @@ void ui_simple_menu_select_game::custom_render(void *selectedref, float top, flo DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // determine the text to render below - driver = ((FPTR)selectedref > 1) ? (const game_driver *)selectedref : nullptr; - if ((FPTR)driver > 1) + driver = ((FPTR)selectedref > 2) ? (const game_driver *)selectedref : nullptr; + if ((FPTR)driver > 2) { const char *gfxstat, *soundstat; -- cgit v1.2.3-70-g09d2 From 8dbebbc594072aabea29729bb2392ec8bd2eb2c3 Mon Sep 17 00:00:00 2001 From: Guru Date: Sat, 6 Feb 2016 21:02:05 +0800 Subject: model3.cpp: updated notes on DSB hardware (nw) --- src/mame/drivers/model3.cpp | 233 +++++++++++++++++++++++++++++--------------- 1 file changed, 153 insertions(+), 80 deletions(-) diff --git a/src/mame/drivers/model3.cpp b/src/mame/drivers/model3.cpp index aca17b6ecfc..8f640ac1b9f 100644 --- a/src/mame/drivers/model3.cpp +++ b/src/mame/drivers/model3.cpp @@ -92,11 +92,11 @@ Tilemap entry formats (16-bit wide): are the palette select bits for 8bpp and PHI-T5 for 4bpp. =================================================================================== - -Model 3 Hardware Overview. +Guru-Readme +Model 3 Hardware Overview Sega, 1996-1998 -This document covers all games running on the original Model 3 hardware and is produced with +This document covers all games running on the original Model 3 hardware with reference to a Scud Race PCB and Virtua Fighter 3TB PCB. ALL PCB numbers are identical. Scud Race runs on the original Sega Model 3 hardware. It's the same PCB as Virtua Fighter 3, there is no mention of 'Step 1.5' or even 'Step 1.0' on any of the PCBs and there is no 50MHz or @@ -136,8 +136,6 @@ Virtua Striker 2 Virtua Striker 2 Version '98 -[There is an external MPEG PCB used on some games but it was not available for documenting] - COMM Board ---------- 171-7053B @@ -196,6 +194,30 @@ Notes: if different, it's likely only for the games that use 64MBit MASKROMs. ROMs - Not all sockets are populated. See MAME src for exact ROM usage. +(For dumping reference) +Jumpers centre pin joins +------------------------------------------------------- +JP3: 2-3 pin2 of ic 1 to ic 16 and pin 39 of ic 17 to ic 20 +JP4: 2-3 pin2 of ic 1 to ic 16 and pin 39 of ic 17 to ic 20 +JP5: 2-3 pin2 of ic 1 to ic 16 and pin 39 of ic 17 to ic 20 +JP6: 2-3 pin2 of ic 1 to ic 16 and pin 39 of ic 17 to ic 20 +JP7: 2-3 pin2 of ic 22 to ic 25 and pin 39 ic ic21 +JP8: 2-3 pin32 of ic 22 to ic 25 +JP9: 2-3 pin32 of ic 22 to ic 25 +Jumper pos. 1 is +5V + +JP1: 1-2 gnd +JP2: 2-3 +5v +Jumper pos. 1 is GND +Jumper pos. 3 is +5V + + pin1 joins +------------------------------- +JP10: 1-2 pin32 of ic 26 to ic 41 + +All CROM ROMs are 32M MASK +ALL VROM ROMs are 16M MASK + CPU Board --------- @@ -317,12 +339,69 @@ Notes: Other than the revision of the listed chips, the PCBs are identical. - -Harley Davidson (Rev.A) -Sega, 1997 - -This game runs on Sega Model3 Step2 hardware. - +External MPEG Audio Board +------------------------- +This is the first version of the Model 3 Digital Audio Board used +on Scud Race and is usually just mounted bare onto the outside of +the main board metal box. + +837-10084 DIGITAL AUDIO BD SEGA 1993 +171-6614B PC BD +Sticker: 837-12941 +|-------------------------------------------------| +| CN3 CN4 CN1 R RCA-1 CN2 RCA-2 | +| MB84256 PC910 4040 7805 TL062 TL062 D6376 | +| D71051 SM5840| +| EPROM.IC2 |------| | +| Z80 16MHz |NEC | | +| |D65654| | +| |--------| |------| | +| |SEGA | KM68257 | +| |315-5762| KM68257 | +| | | KM68257 MB84256 | +| 20MHz|--------| | +| | +| MB3771 JP1 JP2 MROM.IC57| +| 12.288MHz | +| MROM.IC58| +| | +| MROM.IC59| +| | +|DSW(4) G G G G MROM.IC60| +|-------------------------------------------------| +Notes: + Z80 - Clock 4.000MHz [16/4] +EPROM.IC2 - 27C1001/27C010 EPROM (DIP32) + - Scud Race : EPR-19612.IC2 + MROM* - 8M/16M Mask ROM (DIP42) + - Scud Race : MPR-19603/04/05/06 + MB84256 - Fujitsu MB84256 32kx8 SRAM (DIP28) + KM68257 - Samsung KM68257 32kx8 SRAM (DIP28). On this PCB pin 1 (A14) is grounded with a jumper wire on all 3 chips making it 16k + PC910 - Sharp PC910 Optocoupler (DIP8) + 4040 - 74HC4040 logic chip + 7805 - 12V to 5V Voltage Regulator + MB3771 - Fujitsu MB3771 Master Reset IC (DIP8) + TL062 - Texas Instruments TL062 Low Power JFET-Input Operational Amplifier (DIP8) + D71051 - NEC uPD71051 Serial Control Unit USART, functionally equivalent to uPD8251 (SOP28) + D65654 - NEC uPD65654 CMOS Gate Array (QFP100) + SM5840 - Nippon Precision Circuits SM5840 Digital Audio Multi-Function Digital Filter (DIP18) + D6376 - NEC uPD6376GS Audio 2-Channel 16-bit D/A converter (DIP16) + 315-5762 - Sega custom chip, probably a NEC or Texas Instruments DSP or MCU, clock input 20MHz (PLCC68) + R - Red LED + G - Green LED + DSW - 4 position DIP switch, all OFF + JP1 - 1-2 (Select 16M ROM on bank 1 - IC57 & IC58). alt is select 8M + JP2 - 1-2 (Select 16M ROM on bank 2 - IC59 & IC60). alt is select 8M + CN1 - 10-pin power input connector + CN2 - 5-pin connector for Left+/Left-/Right+/Right- Stereo Audio Output + CN3 - 6-pin connector for MIDI TX+/TX-/RX+/RX- communication + CN4 - 4-pin connector (not used) + RCA* - Left/Right RCA Audio Output Jacks (not used) + + +Sega Model 3 Step2 hardware +--------------------------- +This covers most, if not all of the later MODEL 3 games on Step 2 & 2.1 hardware. ROM Board --------- @@ -352,6 +431,8 @@ ROM Board | | |---------------------------------------------------------------------------------------------------| +Notes: (ROMs documented are for Harley Davidson) + VROM00.27 mpr-20378 \ VROM01.26 mpr-20377 | VROM02.29 mpr-20380 | @@ -491,7 +572,7 @@ CPU Board | CN25 | | RTC72423 (Connector for ) | | KM4132G271AQ-10 (Protection PCB) | -| ( not used ) | +| | | 32MHz BATT_3V | | NEC D71051-10 | | | @@ -573,76 +654,68 @@ Security Board 315-6050 Lattice ispLSI 2032 315-5881 TQFP100 stamped 317-0247-COM for Spikeout FE -=================================================================================== - -Scud Race -Sega, 1996 - -Tis game runs on Sega Model 3 Step 1.5 hardware - - -Sound Board (bolted to outside of the metal box) ------------ - -PCB Layout ----------- - -PCB Number: 837-10084 DIGITAL AUDIO BD (C) SEGA 1993 ---------------------------------------------------------------- -84256 D71051GU-10 D6376 SM5840 -epr-19612 -Z80 16MHz SEGA D65654GF102 - 315-5762 (QFP100) - (PLCC68) - 20MHz KM68257 - KM68257 84256 - KM68257 - 12.288MHz mpr-19603 - mpr-19604 - mpr-19605 -DSW1 mpr-19606 ----------------------------------------------------------------- - - -Jumpers -JP1: 1-2 (Select 16M ROM on bank 1 - ic57 & ic58) -JP2: 1-2 (Select 16M ROM on bank 2 - ic59 & ic60) - - - -ROM Board ---------- - -PCB Number: 837-11860 MODEL3 ROM BOARD (C) SEGA 1995 - -(For dumping reference) - -Jumpers centre pin joins -------------------------------------------------------- -JP3: 2-3 pin2 of ic 1 to 16 and pin 39 of ic 17 to 20 -JP4: 2-3 pin2 of ic 1 to 16 and pin 39 of ic 17 to 20 -JP5: 2-3 pin2 of ic 1 to 16 and pin 39 of ic 17 to 20 -JP6: 2-3 pin2 of ic 1 to 16 and pin 39 of ic 17 to 20 -JP7: 2-3 pin2 of ic 22 to 25 and pin 39 ic ic21 -JP8: 2-3 pin32 of ic 22 to 25 -JP9: 2-3 pin32 of ic 22 to 25 -Jumper pos. 1 is +5V -JP1: 1-2 gnd -JP2: 2-3 +5v -Jumper pos. 1 is GND -Jumper pos. 3 is +5V - - pin1 joins -------------------------------- -JP10: 1-2 pin32 of ic 26 to 41 - -All CROM ROMs are 32M MASK -ALL VROM ROMs are 16M MASK - -*/ +External MPEG Audio Board +------------------------- +This is the second version of the Model 3 Digital Audio Board used on +Sega Rally 2, Daytona USA 2 and others and is mounted inside a metal box. + +837-12273 DIGITAL SOUND BD 2 SEGA 1995 +171-7165D PC BD +Sticker: 837-12273-92 +Sticker: 837-13376 +|-------------------------------------------------| +| CN1 CN2 R CN5 CN6 LMC6484 CN7 | +|315-5932 D71051 PQ30RV21 7805 D63210 D63210 | +|PC910 R 12.288MHz | +| JP8 | +|68EC000 315-6028A | +| 33MHz | +|KM62256 * | +|KM62256 MCM6206 | +| MCM6206 JP4/5/6/7 | +| JP1/2/3 315-5934| +|3771 JP10 | +| JP9 | +| EPROM.IC2 | +| RGRG MROM.IC18 MROM.IC20 MROM.IC22 MROM.IC24 | +|DSW(4) MROM.IC19 MROM.IC21 MROM.IC23 MROM.IC25| +|-------------------------------------------------| +Notes: + 68000 - Motorola 68EC000FN12 CPU, clock 11.000MHz [33/3] (PLCC68) +EPROM.IC2 - 27C1024 EPROM (DIP40) + - Sega Rally 2 : EPR-20641.IC2 + - Daytona 2 : EPR-20886.IC2 + MROM* - Mask ROM (DIP42) + - Sega Rally 2 : MPR-20637/38/39/40 + - Daytona 2 : MPR-20887/88/89/90 + KM62256 - Samsung KM62256 32kx8 SRAM (SOP28) + MCM6206 - Motorola MCM6206 32kx8 SRAM (SOP28) + PC910 - Sharp PC910 Optocoupler (DIP8) + 7805 - 12V to 5V Voltage Regulator + PQ30RV21 - Sharp PQ30RV21 3.3V Voltage Regulator + MB3771 - Fujitsu MB3771 Master Reset IC (SOIC8) + 315-5934 - GAL16V8 (PLCC20) + 315-5932 - GAL16V8 (PLCC20) + LMC6484 - Texas Instruments LMC6484IM CMOS Quad Rail-to-Rail Input and Output Operational Amplifier (SOIC14) + D71051 - NEC uPD71051 Serial Control Unit USART, functionally equivalent to uPD8251 (SOP28) + D63210 - NEC uPD63210 16-bit D/A Converter with built-in Digital Filter for Audio (SOP28) +315-6028A - Sega custom chip, probably a NEC DSP, clock input 12.228MHz (QFP100) + * - Unpopulated position on bottom side of PCB for a NEC uPD77016 DSP. The Sega chip above may be similar to this + R - Red LED + G - Green LED + DSW - 4 position DIP switch, all OFF + JP1/2/3 - Jumpers to configure ROMs +JP4/5/6/7 - Jumpers to configure ROMs + JP8 - Jumper tied to pin 26 (IPL1) of MC68EC000 + JP9/10 - Jumpers to configure ROMs, tied to GAL16V8 315-5934 + CN1 - 6-pin connector for MIDI TX+/TX-/RX+/RX- communication + CN2 - 4-pin connector (not used) + CN5 - 10-pin power input connector + CN6 - 5-pin connector for Left+/Left-/Right+/Right- Stereo Audio Output + CN7 - 5-pin connector (not used) +=================================================================================== -/* magtruck locations of interest 000006ee (word) - incremented each vblank, used by mainline to busywait. -- cgit v1.2.3-70-g09d2 From 41b0bbd87d2347c103b896e1724898cce4e999c6 Mon Sep 17 00:00:00 2001 From: Guru Date: Sat, 6 Feb 2016 21:38:47 +0800 Subject: slapfght.cpp: added Guru-Readme(tm)(c)(r) for Guardian PCB (nw) --- src/mame/drivers/slapfght.cpp | 166 +++++++++++++++++++++++++++++++++--------- 1 file changed, 130 insertions(+), 36 deletions(-) diff --git a/src/mame/drivers/slapfght.cpp b/src/mame/drivers/slapfght.cpp index 98f7578ac71..413cf8651b2 100644 --- a/src/mame/drivers/slapfght.cpp +++ b/src/mame/drivers/slapfght.cpp @@ -1832,72 +1832,166 @@ ROM_START( slapfighb3 ) ROM_LOAD( "sf_col19.bin", 0x0200, 0x0100, CRC(5cbf9fbf) SHA1(abfa58fa4e44ebc56f2e0fac9bcc36164c845fa3) ) ROM_END +/* + +Guardian +1986 Taito Corporation + +The Guardian PCB is exactly the same PCB as Tiger Heli, including the +edge connector pinout. + +PCB Layout +---------- + +Top Board + +Sticker - M6100151B 860010898 +GX-006-A MADE IN JAPAN +|--------------------------------------------------| +|VOL ROM21.12Q 2148 | +|MB3712 2148 | +| ROM19.12P 2148 | +| 2148 | +| ROM20.12M 6264 | +| | +| 6264 | +| | +|2 A68_13.8J A68_12.6J 6264 | +|2 YM2149F | +|W A68_11.8H A68_10.6H 6264 | +|A DSW1 DSW2 | +|Y 2148 | +| YM2149F | +| ROM16.1E| +| | +| A68_03.12D ROM17.1C| +| | +| ROM18.2B | +| Z80A 6116 | +| | +|-----|----------|--------------|----------|-------| + |----------| |----------| +Notes: + YM2149F - Clock 1.500MHz (36/24) + Z80A - Clock 3.000MHz (36/12) + 6116 - 2kx8 SRAM + 6264 - 8kx8 SRAM + MB3712 - Audio Power AMP + 2148 - 1kx4 SRAM + DSW1/2 - 8-position DIP-switch + VSync - 56.91313Hz + HSync - 14.97090kHz + A68_03 - 2764 EPROM + A68_10 to 13 - 27256 EPROM + ROM18 - 82S123 PROM +ROM16/17/19/20/21 - 82S129 PROM + + +Bottom Board + +GX-006-B MADE IN JAPAN +|--------------------------------------------------| +| A68_14.6A | +| | +| ROM14.2C ROM15.8B | +| | +| | +| 6116 A68_05.6F | +| 36MHz | +| 6116 A68_04.6G | +| | +| | +| | +| | +| 6116 | +| A68_02.8K | +| | +| A68_09.4M A47_08.6M X | +| 6116 | +| 6116 A68_07.6N A68_01.8N | +| | +| 6116 A68_06.6P A68_00.8P | +| Z80B | +|-----|----------|--------------|----------|-------| + |----------| |----------| +Notes: + Z80B - Clock 6.000MHz (36/6) + 6116 - 2kx8 SRAM + ROM14/15 - 82S129 PROM + A68_00/01 - 27128 EPROM +A68_02 & 06 to 09 - 27256 EPROM + A68_04/05 - 2764 EPROM + A68_14 - Motorola MC68705P5 Micro-Controller (protected). Clock 3.000MHz [36/12] + X - Unpopulated socket + +*/ + ROM_START( grdian ) ROM_REGION( 0x18000, "maincpu", 0 ) /* Region 0 - main cpu code */ - ROM_LOAD( "a68_00-1", 0x00000, 0x4000, CRC(6a8bdc6c) SHA1(c923bca539bd2eb9a34cb9c7a67a199e28bc081a) ) - ROM_LOAD( "a68_01-1", 0x04000, 0x4000, CRC(ebe8db3c) SHA1(9046d6e63c33fc9cbd48b90dcbcc0badf1d3b9ba) ) - ROM_LOAD( "a68_02-1", 0x10000, 0x8000, CRC(343e8415) SHA1(00b98055277a0ddfb7d0bda6537df10a4049533e) ) + ROM_LOAD( "a68_00-1.8p", 0x00000, 0x4000, CRC(6a8bdc6c) SHA1(c923bca539bd2eb9a34cb9c7a67a199e28bc081a) ) + ROM_LOAD( "a68_01-1.8n", 0x04000, 0x4000, CRC(ebe8db3c) SHA1(9046d6e63c33fc9cbd48b90dcbcc0badf1d3b9ba) ) + ROM_LOAD( "a68_02-1.8k", 0x10000, 0x8000, CRC(343e8415) SHA1(00b98055277a0ddfb7d0bda6537df10a4049533e) ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* Region 3 - sound cpu code */ - ROM_LOAD( "a68-03", 0x0000, 0x2000, CRC(18daa44c) SHA1(1a3d22a186c591321d1b836ee30d89fba4771122) ) + ROM_LOAD( "a68-03.12d", 0x0000, 0x2000, CRC(18daa44c) SHA1(1a3d22a186c591321d1b836ee30d89fba4771122) ) ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller */ - ROM_LOAD( "a68_14", 0x0000, 0x0800, NO_DUMP ) + ROM_LOAD( "a68_14.6a", 0x0000, 0x0800, NO_DUMP ) ROM_REGION( 0x04000, "gfx1", 0 ) /* Region 1 - temporary for gfx */ - ROM_LOAD( "a68_05-1", 0x00000, 0x2000, CRC(06f60107) SHA1(c5dcf0c7a5863ea960ee747d2d7ec7ac8bb7d3af) ) /* Chars */ - ROM_LOAD( "a68_04-1", 0x02000, 0x2000, CRC(1fc8f277) SHA1(59dc1a0fad23b1e98abca3d0b1685b9d2939b059) ) + ROM_LOAD( "a68_05-1.6f", 0x00000, 0x2000, CRC(06f60107) SHA1(c5dcf0c7a5863ea960ee747d2d7ec7ac8bb7d3af) ) /* Chars */ + ROM_LOAD( "a68_04-1.6g", 0x02000, 0x2000, CRC(1fc8f277) SHA1(59dc1a0fad23b1e98abca3d0b1685b9d2939b059) ) ROM_REGION( 0x20000, "gfx2", 0 ) /* Region 1 - temporary for gfx */ - ROM_LOAD( "a68_09", 0x00000, 0x8000, CRC(a293cc2e) SHA1(a2c2598e92982d13b51cbb6efb4b963142233433) ) /* Tiles */ - ROM_LOAD( "a68_08", 0x08000, 0x8000, CRC(37662375) SHA1(46ba8a3f0b553d476ecf431d0d20556896b4ca43) ) - ROM_LOAD( "a68_07", 0x10000, 0x8000, CRC(cf1a964c) SHA1(e9223c8d4f3bdafed193a1ded63e377f16f45e17) ) - ROM_LOAD( "a68_06", 0x18000, 0x8000, CRC(05f9eb9a) SHA1(a71640a63b259799086d361ef293aa26cec46a0c) ) + ROM_LOAD( "a68_09.4m", 0x00000, 0x8000, CRC(a293cc2e) SHA1(a2c2598e92982d13b51cbb6efb4b963142233433) ) /* Tiles */ + ROM_LOAD( "a68_08.6m", 0x08000, 0x8000, CRC(37662375) SHA1(46ba8a3f0b553d476ecf431d0d20556896b4ca43) ) + ROM_LOAD( "a68_07.6n", 0x10000, 0x8000, CRC(cf1a964c) SHA1(e9223c8d4f3bdafed193a1ded63e377f16f45e17) ) + ROM_LOAD( "a68_06.6p", 0x18000, 0x8000, CRC(05f9eb9a) SHA1(a71640a63b259799086d361ef293aa26cec46a0c) ) ROM_REGION( 0x20000, "gfx3", 0 ) /* Region 1 - temporary for gfx */ - ROM_LOAD( "a68-13", 0x00000, 0x8000, CRC(643fb282) SHA1(d904d3c27c2b56341929c5eed4ea97e948c53c34) ) /* Sprites */ - ROM_LOAD( "a68-12", 0x08000, 0x8000, CRC(11f74e32) SHA1(02d8b4cc679f45a02c4989f2b62cde91b7418235) ) - ROM_LOAD( "a68-11", 0x10000, 0x8000, CRC(f24158cf) SHA1(db4c6b68a488b0798ea5f793ac8ced283a8ecab2) ) - ROM_LOAD( "a68-10", 0x18000, 0x8000, CRC(83161ed0) SHA1(a6aa28f22f487dc3a2ec07935e6d42bcdd1eff81) ) + ROM_LOAD( "a68-13.8j", 0x00000, 0x8000, CRC(643fb282) SHA1(d904d3c27c2b56341929c5eed4ea97e948c53c34) ) /* Sprites */ + ROM_LOAD( "a68-12.6j", 0x08000, 0x8000, CRC(11f74e32) SHA1(02d8b4cc679f45a02c4989f2b62cde91b7418235) ) + ROM_LOAD( "a68-11.8h", 0x10000, 0x8000, CRC(f24158cf) SHA1(db4c6b68a488b0798ea5f793ac8ced283a8ecab2) ) + ROM_LOAD( "a68-10.6h", 0x18000, 0x8000, CRC(83161ed0) SHA1(a6aa28f22f487dc3a2ec07935e6d42bcdd1eff81) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "rom21", 0x0000, 0x0100, CRC(d6360b4d) SHA1(3e64548c82a3378fc091e104cdc2b0c7e592fc44) ) - ROM_LOAD( "rom20", 0x0100, 0x0100, CRC(4ca01887) SHA1(2892c89d5e60f1d10593adffff55c1a9654e8209) ) - ROM_LOAD( "rom19", 0x0200, 0x0100, CRC(513224f0) SHA1(15b34612206138f6fc5f7478925b1fff2ed56aa8) ) + ROM_LOAD( "rom21.12q", 0x0000, 0x0100, CRC(d6360b4d) SHA1(3e64548c82a3378fc091e104cdc2b0c7e592fc44) ) + ROM_LOAD( "rom20.12m", 0x0100, 0x0100, CRC(4ca01887) SHA1(2892c89d5e60f1d10593adffff55c1a9654e8209) ) + ROM_LOAD( "rom19.12p", 0x0200, 0x0100, CRC(513224f0) SHA1(15b34612206138f6fc5f7478925b1fff2ed56aa8) ) ROM_END ROM_START( getstarj ) ROM_REGION( 0x18000, "maincpu", 0 ) /* Region 0 - main cpu code */ - ROM_LOAD( "a68_00.bin", 0x00000, 0x4000, CRC(ad1a0143) SHA1(0d9adeb12bd4d5ad11e5bada0cd7498bc565c1db) ) - ROM_LOAD( "a68_01.bin", 0x04000, 0x4000, CRC(3426eb7c) SHA1(e91db45a650a1bfefd7c12c7553b647bc916c7c8) ) - ROM_LOAD( "a68_02.bin", 0x10000, 0x8000, CRC(3567da17) SHA1(29d698606d0bd30abfc3171d79bfad95b0de89fc) ) + ROM_LOAD( "a68_00.8p", 0x00000, 0x4000, CRC(ad1a0143) SHA1(0d9adeb12bd4d5ad11e5bada0cd7498bc565c1db) ) + ROM_LOAD( "a68_01.8n", 0x04000, 0x4000, CRC(3426eb7c) SHA1(e91db45a650a1bfefd7c12c7553b647bc916c7c8) ) + ROM_LOAD( "a68_02.8k", 0x10000, 0x8000, CRC(3567da17) SHA1(29d698606d0bd30abfc3171d79bfad95b0de89fc) ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* Region 3 - sound cpu code */ - ROM_LOAD( "a68-03", 0x00000, 0x2000, CRC(18daa44c) SHA1(1a3d22a186c591321d1b836ee30d89fba4771122) ) + ROM_LOAD( "a68-03.12d", 0x00000, 0x2000, CRC(18daa44c) SHA1(1a3d22a186c591321d1b836ee30d89fba4771122) ) ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller */ - ROM_LOAD( "68705.bin", 0x0000, 0x0800, NO_DUMP ) + ROM_LOAD( "68705.6a", 0x0000, 0x0800, NO_DUMP ) ROM_REGION( 0x04000, "gfx1", 0 ) /* Region 1 - temporary for gfx */ - ROM_LOAD( "a68_05.bin", 0x00000, 0x2000, CRC(e3d409e7) SHA1(0b6be4767f110729f4dd1a472ef8d9a0c718b684) ) /* Chars */ - ROM_LOAD( "a68_04.bin", 0x02000, 0x2000, CRC(6e5ac9d4) SHA1(74f90b7a1ceb3b1c2fd92dff100d92dea0155530) ) + ROM_LOAD( "a68_05.6f", 0x00000, 0x2000, CRC(e3d409e7) SHA1(0b6be4767f110729f4dd1a472ef8d9a0c718b684) ) /* Chars */ + ROM_LOAD( "a68_04.6g", 0x02000, 0x2000, CRC(6e5ac9d4) SHA1(74f90b7a1ceb3b1c2fd92dff100d92dea0155530) ) ROM_REGION( 0x20000, "gfx2", 0 ) /* Region 1 - temporary for gfx */ - ROM_LOAD( "a68_09", 0x00000, 0x8000, CRC(a293cc2e) SHA1(a2c2598e92982d13b51cbb6efb4b963142233433) ) /* Tiles */ - ROM_LOAD( "a68_08", 0x08000, 0x8000, CRC(37662375) SHA1(46ba8a3f0b553d476ecf431d0d20556896b4ca43) ) - ROM_LOAD( "a68_07", 0x10000, 0x8000, CRC(cf1a964c) SHA1(e9223c8d4f3bdafed193a1ded63e377f16f45e17) ) - ROM_LOAD( "a68_06", 0x18000, 0x8000, CRC(05f9eb9a) SHA1(a71640a63b259799086d361ef293aa26cec46a0c) ) + ROM_LOAD( "a68_09.4m", 0x00000, 0x8000, CRC(a293cc2e) SHA1(a2c2598e92982d13b51cbb6efb4b963142233433) ) /* Tiles */ + ROM_LOAD( "a68_08.6m", 0x08000, 0x8000, CRC(37662375) SHA1(46ba8a3f0b553d476ecf431d0d20556896b4ca43) ) + ROM_LOAD( "a68_07.6n", 0x10000, 0x8000, CRC(cf1a964c) SHA1(e9223c8d4f3bdafed193a1ded63e377f16f45e17) ) + ROM_LOAD( "a68_06.6p", 0x18000, 0x8000, CRC(05f9eb9a) SHA1(a71640a63b259799086d361ef293aa26cec46a0c) ) ROM_REGION( 0x20000, "gfx3", 0 ) /* Region 1 - temporary for gfx */ - ROM_LOAD( "a68-13", 0x00000, 0x8000, CRC(643fb282) SHA1(d904d3c27c2b56341929c5eed4ea97e948c53c34) ) /* Sprites */ - ROM_LOAD( "a68-12", 0x08000, 0x8000, CRC(11f74e32) SHA1(02d8b4cc679f45a02c4989f2b62cde91b7418235) ) - ROM_LOAD( "a68-11", 0x10000, 0x8000, CRC(f24158cf) SHA1(db4c6b68a488b0798ea5f793ac8ced283a8ecab2) ) - ROM_LOAD( "a68-10", 0x18000, 0x8000, CRC(83161ed0) SHA1(a6aa28f22f487dc3a2ec07935e6d42bcdd1eff81) ) + ROM_LOAD( "a68-13.8j", 0x00000, 0x8000, CRC(643fb282) SHA1(d904d3c27c2b56341929c5eed4ea97e948c53c34) ) /* Sprites */ + ROM_LOAD( "a68-12.6j", 0x08000, 0x8000, CRC(11f74e32) SHA1(02d8b4cc679f45a02c4989f2b62cde91b7418235) ) + ROM_LOAD( "a68-11.8h", 0x10000, 0x8000, CRC(f24158cf) SHA1(db4c6b68a488b0798ea5f793ac8ced283a8ecab2) ) + ROM_LOAD( "a68-10.6h", 0x18000, 0x8000, CRC(83161ed0) SHA1(a6aa28f22f487dc3a2ec07935e6d42bcdd1eff81) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "rom21", 0x0000, 0x0100, CRC(d6360b4d) SHA1(3e64548c82a3378fc091e104cdc2b0c7e592fc44) ) - ROM_LOAD( "rom20", 0x0100, 0x0100, CRC(4ca01887) SHA1(2892c89d5e60f1d10593adffff55c1a9654e8209) ) - ROM_LOAD( "rom19", 0x0200, 0x0100, CRC(513224f0) SHA1(15b34612206138f6fc5f7478925b1fff2ed56aa8) ) + ROM_LOAD( "rom21.12q", 0x0000, 0x0100, CRC(d6360b4d) SHA1(3e64548c82a3378fc091e104cdc2b0c7e592fc44) ) + ROM_LOAD( "rom20.12m", 0x0100, 0x0100, CRC(4ca01887) SHA1(2892c89d5e60f1d10593adffff55c1a9654e8209) ) + ROM_LOAD( "rom19.12p", 0x0200, 0x0100, CRC(513224f0) SHA1(15b34612206138f6fc5f7478925b1fff2ed56aa8) ) ROM_END ROM_START( getstarb1 ) -- cgit v1.2.3-70-g09d2 From 9f49d7226236716a33d665c1aed7b1604e90d508 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sat, 6 Feb 2016 13:44:00 +0000 Subject: new clones Raiden Fighters 2 - Operation Hell Dive (Italy) [Corrado Tomaselli] --- src/mame/arcade.lst | 1 + src/mame/drivers/seibuspi.cpp | 49 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 1df7701c9e6..ae3200317fe 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -8807,6 +8807,7 @@ rdft2a // (c) 1997 Seibu Kaihatsu (Metrotainment license) rdft2aa // (c) 1997 Seibu Kaihatsu (Dream Island license) rdft2j // (c) 1997 Seibu Kaihatsu rdft2ja // (c) 1997 Seibu Kaihatsu +rdft2it // (c) 1997 Seibu Kaihatsu rdft2t // (c) 1997 Seibu Kaihatsu rdft2u // (c) 1997 Seibu Kaihatsu (Fabtek license) rdft2us // (c) 1997 Seibu Kaihatsu (Fabtek license) diff --git a/src/mame/drivers/seibuspi.cpp b/src/mame/drivers/seibuspi.cpp index 161d87ae25f..3543985a418 100644 --- a/src/mame/drivers/seibuspi.cpp +++ b/src/mame/drivers/seibuspi.cpp @@ -3277,6 +3277,44 @@ ROM_START( rdft2ja ) /* SPI Cart, Japan */ ROM_LOAD("flash0_blank_region01.u1053", 0x000000, 0x100000, CRC(7ae7ab76) SHA1(a2b196f470bf64af94002fc4e2640fadad00418f) ) ROM_END + +ROM_START( rdft2it ) /* SPI Cart, Italy */ + ROM_REGION32_LE( 0x200000, "maincpu", 0 ) /* i386 program */ + ROM_LOAD32_BYTE("seibu1.bin",0x000000, 0x80000, CRC(501b92a9) SHA1(3e1c5cc63906ec7b97a3478557ec2638c515d726) ) + ROM_LOAD32_BYTE("seibu2.bin",0x000001, 0x80000, CRC(ec73a767) SHA1(83f3905afe49401793c0ea0193cb31d3ba1e1739) ) + ROM_LOAD32_BYTE("seibu3.bin",0x000002, 0x80000, CRC(e66243b2) SHA1(54e67af37a4586fd1afc79085ed433d599e1bb87) ) + ROM_LOAD32_BYTE("seibu4.bin",0x000003, 0x80000, CRC(92b7b73e) SHA1(128649b2a6a0616113bd0f9846fb6cf814ae326d) ) + + ROM_REGION( 0x40000, "audiocpu", ROMREGION_ERASE00 ) /* 256K RAM, ROM from Z80 point-of-view */ + + ROM_REGION( 0x30000, "gfx1", ROMREGION_ERASEFF ) /* text layer roms */ + ROM_LOAD24_BYTE("seibu5.bin", 0x000001, 0x10000, CRC(377cac2f) SHA1(f7c9323d79b77f6c8c02ba2c6cdca127d6e5cb5c) ) + ROM_LOAD24_BYTE("seibu6.bin", 0x000000, 0x10000, CRC(42bd5372) SHA1(c38df85b25070db9640eac541f71c0511bab0c98) ) + ROM_LOAD24_BYTE("seibu7.bin", 0x000002, 0x10000, CRC(1efaac7e) SHA1(8252af56dcb7a6306dc3422070176778e3c511c2) ) + + ROM_REGION( 0xc00000, "gfx2", ROMREGION_ERASEFF ) /* background layer roms */ + ROM_LOAD24_WORD("bg-1d.u0535", 0x000000, 0x400000, CRC(6143f576) SHA1(c034923d0663d9ef24357a03098b8cb81dbab9f8) ) + ROM_LOAD24_BYTE("bg-1p.u0537", 0x000002, 0x200000, CRC(55e64ef7) SHA1(aae991268948d07342ee8ba1b3761bd180aab8ec) ) + ROM_LOAD24_WORD("bg-2d.u0536", 0x600000, 0x400000, CRC(c607a444) SHA1(dc1aa96a42e9394ca6036359670a4ec6f830c96d) ) + ROM_LOAD24_BYTE("bg-2p.u0538", 0x600002, 0x200000, CRC(f0830248) SHA1(6075df96b49e70d2243fef691e096119e7a4d044) ) + + ROM_REGION( 0x1200000, "gfx3", 0 ) /* sprites */ + ROM_LOAD("obj3.u0434", 0x0000000, 0x400000, CRC(e08f42dc) SHA1(5188d71d4355eaf43ea8893b4cfc4fe80cc24f41) ) + ROM_LOAD("obj3b.u0433", 0x0400000, 0x200000, CRC(1b6a523c) SHA1(99a420dbc8e22e7832ccda7cec9fa661a2a2687a) ) + ROM_LOAD("obj2.u0431", 0x0600000, 0x400000, CRC(7aeadd8e) SHA1(47103c0579240c5b1add4d0b164eaf76f5fa97f0) ) + ROM_LOAD("obj2b.u0432", 0x0a00000, 0x200000, CRC(5d790a5d) SHA1(1ed5d4ad4c9a7e505ce35dcc90d184c26ce891dc) ) + ROM_LOAD("obj1.u0429", 0x0c00000, 0x400000, CRC(c2c50f02) SHA1(b81397b5800c6d49f58b7ac7ff6eac56da3c5257) ) + ROM_LOAD("obj1b.u0430", 0x1000000, 0x200000, CRC(5259321f) SHA1(3c70c1147e49f81371d0f60f7108d9718d56faf4) ) + + ROM_REGION32_LE( 0xa00000, "sound01", ROMREGION_ERASE00 ) /* sound roms */ + ROM_LOAD32_WORD("pcm.u0217", 0x000000, 0x100000, CRC(2edc30b5) SHA1(c25d690d633657fc3687636b9070f36bd305ae06) ) + ROM_CONTINUE( 0x400000, 0x100000 ) + ROM_LOAD32_BYTE("seibu8.bin", 0x800000, 0x080000, CRC(b7bd3703) SHA1(6427a7e6de10d6743d6e64b984a1d1c647f5643a) ) + + ROM_REGION( 0x100000, "soundflash1", 0 ) /* on SPI motherboard */ + ROM_LOAD("flash0_blank_region92.u1053", 0x000000, 0x100000, CRC(204d82d0) SHA1(444f4aefa27d8f5d1a2f7f08f826ea84b0ccbd02) ) +ROM_END + ROM_START( rdft2a ) /* SPI Cart, Asia (Metrotainment license); SPI PCB is marked "(C)1997 SXX2C ROM SUB8" */ // The SUB8 board is also capable of having two 23C8100 roms at U0223 and U0219 for PRG instead of the four roms below. ROM_REGION32_LE( 0x200000, "maincpu", 0 ) /* i386 program, all are 27C040 */ @@ -3848,13 +3886,20 @@ GAME( 1996, rdftauge, rdft, spi, spi_3button, seibuspi_state, rdft, GAME( 1996, rdftit, rdft, spi, spi_3button, seibuspi_state, rdft, ROT270, "Seibu Kaihatsu", "Raiden Fighters (Italy)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1996, rdfta, rdft, spi, spi_3button, seibuspi_state, rdft, ROT270, "Seibu Kaihatsu", "Raiden Fighters (Austria)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +// this is one revision GAME( 1997, rdft2, 0, spi, spi_2button, seibuspi_state, rdft2, ROT270, "Seibu Kaihatsu (Tuning license)", "Raiden Fighters 2 - Operation Hell Dive (Germany)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1997, rdft2u, rdft2, spi, spi_2button, seibuspi_state, rdft2, ROT270, "Seibu Kaihatsu (Fabtek license)", "Raiden Fighters 2 - Operation Hell Dive (US)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1997, rdft2j, rdft2, spi, spi_2button, seibuspi_state, rdft2, ROT270, "Seibu Kaihatsu", "Raiden Fighters 2 - Operation Hell Dive (Japan set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1997, rdft2ja, rdft2, spi, spi_2button, seibuspi_state, rdft2, ROT270, "Seibu Kaihatsu", "Raiden Fighters 2 - Operation Hell Dive (Japan set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1997, rdft2a, rdft2, spi, spi_2button, seibuspi_state, rdft2, ROT270, "Seibu Kaihatsu (Metrotainment license)", "Raiden Fighters 2 - Operation Hell Dive (Hong Kong)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +// this is another +GAME( 1997, rdft2ja, rdft2, spi, spi_2button, seibuspi_state, rdft2, ROT270, "Seibu Kaihatsu", "Raiden Fighters 2 - Operation Hell Dive (Japan set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1997, rdft2aa, rdft2, spi, spi_2button, seibuspi_state, rdft2, ROT270, "Seibu Kaihatsu (Dream Island license)", "Raiden Fighters 2 - Operation Hell Dive (Korea)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1997, rdft2it, rdft2, spi, spi_2button, seibuspi_state, rdft2, ROT270, "Seibu Kaihatsu", "Raiden Fighters 2 - Operation Hell Dive (Italy)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +// these 2 are both unique GAME( 1997, rdft2t, rdft2, spi, spi_2button, seibuspi_state, rdft2, ROT270, "Seibu Kaihatsu", "Raiden Fighters 2 - Operation Hell Dive (Taiwan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1997, rdft2u, rdft2, spi, spi_2button, seibuspi_state, rdft2, ROT270, "Seibu Kaihatsu (Fabtek license)", "Raiden Fighters 2 - Operation Hell Dive (US)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) + + + GAME( 1998, rfjet, 0, spi, spi_2button, seibuspi_state, rfjet, ROT270, "Seibu Kaihatsu (Tuning license)", "Raiden Fighters Jet (Germany)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1998, rfjetu, rfjet, spi, spi_2button, seibuspi_state, rfjet, ROT270, "Seibu Kaihatsu (Fabtek license)", "Raiden Fighters Jet (US)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -- cgit v1.2.3-70-g09d2 From fe79bbad82105b8143f538590a4006a51ffa688c Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 6 Feb 2016 15:22:38 +0100 Subject: fix output interface(nw) --- src/osd/windows/output.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osd/windows/output.cpp b/src/osd/windows/output.cpp index 3b390b1f3a1..ef3c563e3ac 100644 --- a/src/osd/windows/output.cpp +++ b/src/osd/windows/output.cpp @@ -313,8 +313,8 @@ static void notifier_callback(const char *outname, INT32 value, void *param) // loop over clients and notify them for (client = clientlist; client != nullptr; client = client->next) { - printf("there are clients\n"); - if (param == nullptr || param == client) + if (param == nullptr || param == client->machine) { PostMessage(client->hwnd, om_mame_update_state, client->machine->output().name_to_id(outname), value); + } } } -- cgit v1.2.3-70-g09d2 From eb4b73256ec66c50338eebb9418337dffbe282d2 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sat, 6 Feb 2016 14:31:23 +0000 Subject: new clones 64th. Street - A Detective Story (Japan, set 2) [Corrado Tomaselli] --- src/mame/arcade.lst | 1 + src/mame/drivers/megasys1.cpp | 123 ++++++++++++++++++++++++++++++------------ src/mame/includes/megasys1.h | 4 +- src/mame/video/megasys1.cpp | 31 +---------- 4 files changed, 95 insertions(+), 64 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index ae3200317fe..dd5e9187a78 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -8956,6 +8956,7 @@ edfu // (c) 1991 (North America) edfbl // (c) 1991 64street // (c) 1991 64streetj // (c) 1991 (Japan) +64streetja // (c) 1991 (Japan) soldam // (c) 1992 soldamj // (c) 1992 (Japan) bigstrik // (c) 1992 diff --git a/src/mame/drivers/megasys1.cpp b/src/mame/drivers/megasys1.cpp index ad32ebb1961..bed3ec42e7d 100644 --- a/src/mame/drivers/megasys1.cpp +++ b/src/mame/drivers/megasys1.cpp @@ -43,7 +43,7 @@ Year + Game System Protection Peek-a-Boo! D Inputs --------------------------------------------------------------------- -NOTE: Chimera Beast is the only game missing a dump of its priority PROM +NOTE: Chimera Beast PROM has not been dumped, but looks like it should match 64street based on game analysis. Hardware Main CPU Sound CPU Sound Chips @@ -94,10 +94,6 @@ RAM RW 0f0000-0f3fff 0e0000-0effff? < Issues / To Do -------------- -- There is a 512 byte PROM in the video section (differs by game) that - controls the priorities. This prom is currently missing for one game, - so we have to use fake data for it (Chimera Beast). - - Making the M6295 status register return 0 fixes the music tempo in avspirit, 64street, astyanax etc. but makes most of the effects in hachoo disappear! Define SOUND_HACK to 0 to turn this hack off @@ -105,15 +101,9 @@ RAM RW 0f0000-0f3fff 0e0000-0effff? < bootleg version of rodlandj has one instruction patched out to do exactly the same thing that we are doing (ignoring the 6295 status). -- Understand properly how irqs truly works, kazan / iganinju is (again) broken. - -- 64street: player characters in attract mode doesn't move at all, protection? - they move on the real PCB +- Understand properly how irqs truly works, kazan / iganinju solution seems hacky -- tshingen: unemulated mosaic effect when killing enemies with the flashing sword. - See https://youtu.be/m4ZH0v8UqWs - The effect can be tested in e.g. stdragon and p47 test mode: - See https://youtu.be/zo3FTCqkNBc and https://youtu.be/dEqH017YBzw +- P47 intro effect is imperfect ( https://www.youtube.com/watch?v=eozZGcVspVw ) - Understand a handful of unknown bits in video regs @@ -144,16 +134,16 @@ RAM RW 0f0000-0f3fff 0e0000-0effff? < MACHINE_RESET_MEMBER(megasys1_state,megasys1) { - m_ignore_oki_status = 1; /* ignore oki status due 'protection' */ - m_ip_select = 0; /* reset protection */ + + m_ignore_oki_status = 1; /* ignore oki status due 'protection' */ + m_ip_latched = 0x0006; /* reset protection - some games expect this initial read without sending anything */ m_mcu_hs = 0; } MACHINE_RESET_MEMBER(megasys1_state,megasys1_hachoo) { + MACHINE_RESET_CALL_MEMBER(megasys1); m_ignore_oki_status = 0; /* strangely hachoo need real oki status */ - m_ip_select = 0; /* reset protection */ - m_mcu_hs = 0; } @@ -254,7 +244,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(megasys1_state::megasys1B_scanline) in that order. */ -READ16_MEMBER(megasys1_state::ip_select_r) +READ16_MEMBER(megasys1_state::ip_select_r) // FROM MCU +{ + return m_ip_latched; +} + + + +WRITE16_MEMBER(megasys1_state::ip_select_w) // TO MCU { int i; @@ -266,26 +263,24 @@ READ16_MEMBER(megasys1_state::ip_select_r) // 20 21 22 23 24 < edf // 51 52 53 54 55 < hayaosi1 - /* f(x) = ((x*x)>>4)&0xFF ; f(f($D)) == 6 */ - if ((m_ip_select & 0xF0) == 0xF0) return 0x000D; - for (i = 0; i < 5; i++) if (m_ip_select == m_ip_select_values[i]) break; + for (i = 0; i < 7; i++) if ((data & 0x00ff) == m_ip_select_values[i]) break; switch (i) { - case 0 : return m_io_system->read(); - case 1 : return m_io_p1->read(); - case 2 : return m_io_p2->read(); - case 3 : return m_io_dsw1->read(); - case 4 : return m_io_dsw2->read(); - default : return 0x0006; + case 0 : m_ip_latched = m_io_system->read(); break; + case 1 : m_ip_latched = m_io_p1->read(); break; + case 2 : m_ip_latched = m_io_p2->read(); break; + case 3 : m_ip_latched = m_io_dsw1->read(); break; + case 4 : m_ip_latched = m_io_dsw2->read(); break; + case 5 : m_ip_latched = 0x0d; break; // startup check? + case 6 : m_ip_latched = 0x06; break; // sent before each other command + default: return; // get out if it wasn't a valid request } -} -WRITE16_MEMBER(megasys1_state::ip_select_w) -{ - COMBINE_DATA(&m_ip_select); + + // if the command is valid, generate an IRQ from the MCU m_maincpu->set_input_line(2, HOLD_LINE); } @@ -1812,6 +1807,40 @@ ROM_START( 64street ) ROM_LOAD( "pr91009.12", 0x0000, 0x0200, CRC(c69423d6) SHA1(ba9644a9899df2d73a5a16bf7ceef1954c2e25f3) ) // same as pr-91044 on hayaosi1 ROM_END +ROM_START( 64streetja ) + ROM_REGION( 0x80000, "maincpu", 0 ) /* Main CPU Code */ + ROM_LOAD16_BYTE( "ic53.bin", 0x000000, 0x040000, CRC(c978d086) SHA1(b091faf570841f098d4d70bf3ca4f26d6cda890a) ) + ROM_LOAD16_BYTE( "ic52.bin", 0x000001, 0x040000, CRC(af475852) SHA1(5e0a375dd904a4176ca6fdccdb67a907e270e9be) ) + + ROM_REGION( 0x20000, "audiocpu", 0 ) /* Sound CPU Code */ + ROM_LOAD16_BYTE( "64th_08.rom", 0x000000, 0x010000, CRC(632be0c1) SHA1(626073037249d96ac70b2d11b2dd72b22bac49c7) ) + ROM_LOAD16_BYTE( "64th_07.rom", 0x000001, 0x010000, CRC(13595d01) SHA1(e730a530ca232aab883217fa12804075cb2aa640) ) + + ROM_REGION( 0x1000, "mcu", 0 ) /* MCU Internal Code, M50747? */ + ROM_LOAD( "64street.mcu", 0x000000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x80000, "gfx1", 0 ) /* Scroll 0 */ + ROM_LOAD( "64th_01.rom", 0x000000, 0x080000, CRC(06222f90) SHA1(52b6cb88b9d2209c16d1633c83c0224b6ebf29dc) ) + + ROM_REGION( 0x80000, "gfx2", 0 ) /* Scroll 1 */ + ROM_LOAD( "64th_06.rom", 0x000000, 0x080000, CRC(2bfcdc75) SHA1(f49f92f1ff58dccf72e05ecf80761c7b65a25ba3) ) + + ROM_REGION( 0x20000, "gfx3", 0 ) /* Scroll 2 */ + ROM_LOAD( "64th_09.rom", 0x000000, 0x020000, CRC(a4a97db4) SHA1(1179457a6f33b3b44fac6056f6245f3aaae6afd5) ) + + ROM_REGION( 0x100000, "gfx4", 0 ) /* Sprites */ + ROM_LOAD( "64th_05.rom", 0x000000, 0x080000, CRC(a89a7020) SHA1(be36e58e9314688ee39249944c5a6c201e0249ee) ) + ROM_LOAD( "64th_04.rom", 0x080000, 0x080000, CRC(98f83ef6) SHA1(e9b72487695ac7cdc4fbf595389c4b8781ed207e) ) + + ROM_REGION( 0x40000, "oki1", 0 ) /* Samples */ + ROM_LOAD( "64th_11.rom", 0x000000, 0x020000, CRC(b0b8a65c) SHA1(b7e42d9083d0bbfe160fc73a7317d696e90d83d6) ) + + ROM_REGION( 0x40000, "oki2", 0 ) /* Samples */ + ROM_LOAD( "64th_10.rom", 0x000000, 0x040000, CRC(a3390561) SHA1(f86d5c61e3e80d30408535c2203940ca1e95ac18) ) + + ROM_REGION( 0x0200, "proms", 0 ) /* Priority PROM */ + ROM_LOAD( "pr91009.12", 0x0000, 0x0200, CRC(c69423d6) SHA1(ba9644a9899df2d73a5a16bf7ceef1954c2e25f3) ) // same as pr-91044 on hayaosi1 +ROM_END ROM_START( 64streetj ) ROM_REGION( 0x80000, "maincpu", 0 ) /* Main CPU Code */ @@ -2251,7 +2280,7 @@ ROM_START( chimerab ) ROM_LOAD( "voi10.bin", 0x000000, 0x040000, CRC(67498914) SHA1(8d89fa90f38fd102b15f26f71491ea833ec32cb2) ) ROM_REGION( 0x0200, "proms", 0 ) /* Priority PROM */ - ROM_LOAD( "prom", 0x0000, 0x0200, NO_DUMP ) + ROM_LOAD( "pr-91044", 0x0000, 0x0200, BAD_DUMP CRC(c69423d6) SHA1(ba9644a9899df2d73a5a16bf7ceef1954c2e25f3) ) // guess, but 99% sure it's meant to be the same as 64street/hayaosi1 based on analysis of game and previous handcrafted data ROM_END @@ -3988,6 +4017,10 @@ DRIVER_INIT_MEMBER(megasys1_state,64street) m_ip_select_values[2] = 0x54; m_ip_select_values[3] = 0x55; m_ip_select_values[4] = 0x56; + + m_ip_select_values[5] = 0xfa; + m_ip_select_values[6] = 0x06; + } READ16_MEMBER(megasys1_state::megasys1A_mcu_hs_r) @@ -4041,6 +4074,10 @@ DRIVER_INIT_MEMBER(megasys1_state,avspirit) m_ip_select_values[3] = 0x33; m_ip_select_values[4] = 0x34; + m_ip_select_values[5] = 0xff; + m_ip_select_values[6] = 0x06; + + // has twice less RAM m_maincpu->space(AS_PROGRAM).unmap_readwrite(0x060000, 0x06ffff); m_maincpu->space(AS_PROGRAM).install_ram(0x070000, 0x07ffff, m_ram); @@ -4053,6 +4090,10 @@ DRIVER_INIT_MEMBER(megasys1_state,bigstrik) m_ip_select_values[2] = 0x55; m_ip_select_values[3] = 0x56; m_ip_select_values[4] = 0x57; + + m_ip_select_values[5] = 0xfb; + m_ip_select_values[6] = 0x06; + } DRIVER_INIT_MEMBER(megasys1_state,chimerab) @@ -4063,6 +4104,10 @@ DRIVER_INIT_MEMBER(megasys1_state,chimerab) m_ip_select_values[2] = 0x53; m_ip_select_values[3] = 0x54; m_ip_select_values[4] = 0x55; + + m_ip_select_values[5] = 0xf2; + m_ip_select_values[6] = 0x06; + } DRIVER_INIT_MEMBER(megasys1_state,cybattlr) @@ -4072,6 +4117,9 @@ DRIVER_INIT_MEMBER(megasys1_state,cybattlr) m_ip_select_values[2] = 0x53; m_ip_select_values[3] = 0x54; m_ip_select_values[4] = 0x55; + + m_ip_select_values[5] = 0xf2; + m_ip_select_values[6] = 0x06; } DRIVER_INIT_MEMBER(megasys1_state,edf) @@ -4081,6 +4129,10 @@ DRIVER_INIT_MEMBER(megasys1_state,edf) m_ip_select_values[2] = 0x22; m_ip_select_values[3] = 0x23; m_ip_select_values[4] = 0x24; + + m_ip_select_values[5] = 0xf0; + m_ip_select_values[6] = 0x06; + } READ16_MEMBER(megasys1_state::edfbl_input_r) @@ -4115,6 +4167,10 @@ DRIVER_INIT_MEMBER(megasys1_state,hayaosi1) m_ip_select_values[2] = 0x53; m_ip_select_values[3] = 0x54; m_ip_select_values[4] = 0x55; + + m_ip_select_values[5] = 0xfc; + m_ip_select_values[6] = 0x06; + } READ16_MEMBER(megasys1_state::iganinju_mcu_hs_r) @@ -4390,7 +4446,8 @@ GAME( 1993, hayaosi1, 0, system_B_hayaosi1, hayaosi1, megasys1_state, hay // Type C GAME( 1991, 64street, 0, system_C, 64street, megasys1_state, 64street, ROT0, "Jaleco", "64th. Street - A Detective Story (World)", 0 ) -GAME( 1991, 64streetj,64street, system_C, 64street, megasys1_state, 64street, ROT0, "Jaleco", "64th. Street - A Detective Story (Japan)", 0 ) +GAME( 1991, 64streetj,64street, system_C, 64street, megasys1_state, 64street, ROT0, "Jaleco", "64th. Street - A Detective Story (Japan, set 1)", 0 ) +GAME( 1991, 64streetja,64street,system_C, 64street, megasys1_state, 64street, ROT0, "Jaleco", "64th. Street - A Detective Story (Japan, set 2)", 0 ) GAME( 1992, bigstrik, 0, system_C, bigstrik, megasys1_state, bigstrik, ROT0, "Jaleco", "Big Striker", 0 ) GAME( 1993, chimerab, 0, system_C, chimerab, megasys1_state, chimerab, ROT0, "Jaleco", "Chimera Beast (Japan, prototype)", 0 ) GAME( 1993, cybattlr, 0, system_C, cybattlr, megasys1_state, cybattlr, ROT90, "Jaleco", "Cybattler", 0 ) diff --git a/src/mame/includes/megasys1.h b/src/mame/includes/megasys1.h index 414b670cc36..65694249f8f 100644 --- a/src/mame/includes/megasys1.h +++ b/src/mame/includes/megasys1.h @@ -65,8 +65,8 @@ public: bitmap_ind16 m_sprite_buffer_bitmap; UINT16 *m_spriteram; - UINT16 m_ip_select; - UINT16 m_ip_select_values[5]; + UINT16 m_ip_select_values[7]; + UINT16 m_ip_latched; UINT8 m_ignore_oki_status; UINT16 m_protection_val; int m_scrollx[3]; diff --git a/src/mame/video/megasys1.cpp b/src/mame/video/megasys1.cpp index 1770c490218..7e04cec112d 100644 --- a/src/mame/video/megasys1.cpp +++ b/src/mame/video/megasys1.cpp @@ -844,14 +844,6 @@ struct priority */ -static const struct priority priorities[] = -{ - { "chimerab", - { 0x14032,0x04132,0x14032,0x04132,0xfffff,0xfffff,0xfffff,0xfffff, - 0xfffff,0xfffff,0x01324,0xfffff,0xfffff,0xfffff,0xfffff,0xfffff } - }, - { nullptr } // end of list: use the prom's data -}; /* @@ -901,27 +893,8 @@ void megasys1_state::megasys1_priority_create() { const UINT8 *color_prom = memregion("proms")->base(); int pri_code, offset, i, order; - - /* First check if we have an hand-crafted priority scheme - available (this should happen only if no good dump - of the prom is known) */ - - i = 0; - while ( priorities[i].driver && - strcmp(priorities[i].driver, machine().system().name) != 0 && - strcmp(priorities[i].driver, machine().system().parent) != 0) - i++; - - if (priorities[i].driver) - { - memcpy (m_layers_order, priorities[i].priorities, 16 * sizeof(int)); - - logerror("WARNING: using an hand-crafted priorities scheme\n"); - - return; - } - - /* Otherwise, perform the conversion from the prom itself */ + + /* convert PROM to something we can use */ for (pri_code = 0; pri_code < 0x10 ; pri_code++) // 16 priority codes { -- cgit v1.2.3-70-g09d2 From 3ca73cd096964fd5ae7aaff4705862a1c9f6297f Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sat, 6 Feb 2016 14:53:20 +0000 Subject: new clones World Rally (Version 1.0, Checksum 8AA2) [Artemio Urbina] Gaelco is another where changing the version number seemed optional ;-) --- src/mame/arcade.lst | 3 ++- src/mame/drivers/wrally.cpp | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index dd5e9187a78..8db4e5e4b00 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -9175,7 +9175,8 @@ thoop // (c) 1992 - Ref 922804/1 squash // (c) 1992 - Ref 922804/2 wrally // (c) 1993 - Ref 930705 wrallya // (c) 1993 - Ref 930705 -wrallyb // (c) 1993 - Ref 930217 +wrallyb // (c) 1993 - Ref 930217 +wrallyat // (c) 1993 - Ref 930217 glass // (c) 1993 - Ref 931021 glass10 // (c) 1993 - Ref 931021 glass10a // (c) 1993 - Ref 931021 shows "Break Edition" on a real PCB diff --git a/src/mame/drivers/wrally.cpp b/src/mame/drivers/wrally.cpp index db729a6b7ac..935cbc84e54 100644 --- a/src/mame/drivers/wrally.cpp +++ b/src/mame/drivers/wrally.cpp @@ -329,7 +329,32 @@ ROM_START( wrallya ) ROM_LOAD( "pal16r8-b15.bin", 0x0000, 0x0104, CRC(b50337a6) SHA1(1f922753cb9982cad9a3c9246894ecd38273236e) ) ROM_END -ROM_START( wrallyb ) /* Board Marked 930217, Atari License */ + +ROM_START( wrallyb ) + ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ + ROM_LOAD16_BYTE( "rally.c23", 0x000000, 0x080000, CRC(ddd6f833) SHA1(f12f82c412fa93f46020d50c2620974ae2fb502b) ) + ROM_LOAD16_BYTE( "rally.c22", 0x000001, 0x080000, CRC(59a0d35c) SHA1(7c6f376a53c1e6d793cbfb16861ee3298ee013a1) ) + + ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ + ROM_LOAD( "wrdallas.bin", 0x00000, 0x8000, CRC(547d1768) SHA1(c58d1edd072d796be0663fb265f4739ec006b688) ) + + ROM_REGION( 0x200000, "gfx1", 0 ) + ROM_LOAD( "rally h-12.h12", 0x000000, 0x100000, CRC(3353dc00) SHA1(db3b1686751dcaa231d66c08b5be81fcfe299ad9) ) /* Same data, different layout */ + ROM_LOAD( "rally h-8.h8", 0x100000, 0x100000, CRC(58dcd024) SHA1(384ff296d3c7c8e0c4469231d1940de3cea89fc2) ) + + ROM_REGION( 0x140000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ + ROM_LOAD( "sound c-1.c1", 0x000000, 0x100000, CRC(2d69c9b8) SHA1(328cb3c928dc6921c0c3f0277f59bca6c747c504) ) /* Same data in a single rom */ + ROM_RELOAD( 0x040000, 0x100000 ) + + ROM_REGION( 0x0514, "plds", 0 ) /* PAL's and GAL's */ + ROM_LOAD( "tibpal20l8-25cnt.b23", 0x0000, 0x0104, NO_DUMP ) + ROM_LOAD( "gal16v8-25lnc.h21", 0x0000, 0x0104, NO_DUMP ) + ROM_LOAD( "tibpal20l8-25cnt.h15", 0x0000, 0x0104, NO_DUMP ) + ROM_LOAD( "pal16r4-e2.bin", 0x0000, 0x0104, CRC(15fee75c) SHA1(b9ee5121dd41f2535d9abd78ff5fcfeaa1ac6b62) ) + ROM_LOAD( "pal16r8-b15.bin", 0x0000, 0x0104, CRC(b50337a6) SHA1(1f922753cb9982cad9a3c9246894ecd38273236e) ) +ROM_END + +ROM_START( wrallyat ) /* Board Marked 930217, Atari License */ ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_BYTE( "rally.c23", 0x000000, 0x080000, CRC(366595ad) SHA1(e16341ed9eacf9b729c28184268150ea9b62f185) ) /* North & South America only... */ ROM_LOAD16_BYTE( "rally.c22", 0x000001, 0x080000, CRC(0ad4ec6f) SHA1(991557cf25fe960b1c586e990e6019befe5a11d0) ) @@ -354,6 +379,7 @@ ROM_START( wrallyb ) /* Board Marked 930217, Atari License */ ROM_END -GAME( 1993, wrally, 0, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (set 1)", MACHINE_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Tension baja " */ -GAME( 1993, wrallya, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (set 2)", MACHINE_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Power Failure" */ -GAME( 1993, wrallyb, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco (Atari license)", "World Rally (US, 930217)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, wrally, 0, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 0E56)", MACHINE_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Tension baja " */ +GAME( 1993, wrallya, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 3873)", MACHINE_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Power Failure" */ +GAME( 1993, wrallyb, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 8AA2)", MACHINE_SUPPORTS_SAVE ) // uses a 930217 board like the Atari set +GAME( 1993, wrallyat, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco (Atari license)", "World Rally (US, 930217)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From 24005babbadd3a7ce05244e1115ac0fc4867aca9 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sat, 6 Feb 2016 15:11:28 +0000 Subject: new print club Print Club LoveLove Ver 2 (J 970825 V1.000) [TeamEurope, Ryan Holtz] this one is also protected, same chip as the original Print Club Love Love. --- src/mame/arcade.lst | 3 ++- src/mame/drivers/stv.cpp | 28 ++++++++++++++++++++++++---- src/mame/machine/315-5838_317-0229_comp.cpp | 13 +++++++++++-- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 8db4e5e4b00..2dff9f220ae 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -5162,7 +5162,8 @@ prc297wi // 1997.10 Print Club 2 '97 Winter Ver prc297wia // prc298sp // 1997.10 Print Club 2 '98 Spring Ver prc298su // -pclove +pclove // +pclove2 // cotton2 // 1997.11 Cotton 2 (Success) hanagumi // 1997.11 Sakura Taisen Hanagumi Taisen Columns findlove // 1997.12 Find Love (Daiki / FCF) diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index 758dbccee5a..1a823eabcc1 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -3208,6 +3208,26 @@ ROM_START( pclove ) ROM_LOAD( "pclove.nv", 0x0000, 0x0080, CRC(3c78e3bd) SHA1(6d5fe8545f434b4cc1e8229549adb0a49ac45bd1) ) ROM_END +ROM_START( pclove2 ) + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ + // note, 'IC2' in service mode (the test of IC24/IC26) fails once you map the protection device because it occupies the same memory address as the rom at IC26 + // there must be a way to enable / disable it. + ROM_LOAD16_WORD_SWAP( "ic22", 0x0200000, 0x0200000, CRC(d7d968d6) SHA1(59916a453ba8a53af2138272e359c6d6ce11ea8c) ) // OK (tested as IC7) + ROM_LOAD16_WORD_SWAP( "ic24", 0x0400000, 0x0200000, CRC(9c9b7e57) SHA1(ae834a3648126ec2456d2cc5544f81b6dc2f5825) ) // OK (tested as IC2) + ROM_LOAD16_WORD_SWAP( "ic26", 0x0600000, 0x0200000, CRC(55eb859f) SHA1(4f25536787142f965d688d1758a45885b52ae52e) ) // OK (tested as IC2) + ROM_LOAD16_WORD_SWAP( "ic28", 0x0800000, 0x0200000, CRC(463604a6) SHA1(d8eb41676c750e01870241361ef04c8f22a0c4b4) ) // OK (tested as IC3) + ROM_LOAD16_WORD_SWAP( "ic30", 0x0a00000, 0x0200000, CRC(ec5b5e28) SHA1(89bcddb52c176c86ad4bdb9f4f052be5b75bcd1b) ) // OK (tested as IC3) + ROM_LOAD16_WORD_SWAP( "ic32", 0x0c00000, 0x0200000, CRC(9a4109e5) SHA1(ba59caac5f5a80fc52c507d8a47f322a380aa9a1) ) // FF fill? (not tested either) + + // protection device used to decrypt some startup code + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player + ROM_LOAD( "pclove2.nv", 0x0000, 0x0080, CRC(93b30600) SHA1(eadba12ec322911823a6873a343e4d9b4089ed93) ) +ROM_END + + // Name Club / Name Club vol.2 // have an unusual rom mapping compared to other games, the cartridge is a little different too, with a large PALCE16V8H-10 marked 315-6026 // For Name Club vol. 2, the protection device (317-0229 on both) is checked in the 'each game test' menu as 'RCDD2' @@ -3290,7 +3310,6 @@ GAME( 1998, sss, stvbios, stv_5881, stv, stv_state, sss, ROT GAME( 1995, sandor, stvbios, stv, stv, stv_state, sandor, ROT0, "Sega", "Puzzle & Action: Sando-R (J 951114 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1997, thunt, sandor, stv, stv, stv_state, thunt, ROT0, "Sega", "Puzzle & Action: Treasure Hunt (JUET 970901 V2.00E)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1997, thuntk, sandor, stv, stv, stv_state, sandor, ROT0, "Sega / Deniam", "Puzzle & Action: BoMulEul Chajara (JUET 970125 V2.00K)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) -GAME( 1998, twcup98, stvbios, stv_5881, stv, stv_state, twcup98, ROT0, "Tecmo", "Tecmo World Cup '98 (JUET 980410 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1995, smleague, stvbios, stv, stv, stv_state, smleague, ROT0, "Sega", "Super Major League (U 960108 V1.000)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1995, finlarch, smleague,stv, stv, stv_state, finlarch, ROT0, "Sega", "Final Arch (J 950714 V1.001)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1996, sokyugrt, stvbios, stv, stv, stv_state, sokyugrt, ROT0, "Raizing / Eighting", "Soukyugurentai / Terra Diver (JUET 960821 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) @@ -3322,13 +3341,14 @@ GAME( 1998, prc298sp, stvbios, stv, stv, stv_state, stv, ROT0 GAME( 1998, prc298su, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Summer Ver (J 980603 V1.100)", MACHINE_NOT_WORKING ) // again, dat doesn't appear to have bene updated, this should be early 98 GAME( 1998, prc298au, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Autumn Ver (J 980827 V1.000)", MACHINE_NOT_WORKING ) - GAME( 1999, pclubor, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Goukakenran (J 991104 V1.000)", MACHINE_NOT_WORKING ) GAME( 1999, pclubol, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Olive (J 980717 V1.000)", MACHINE_NOT_WORKING ) GAME( 1997, pclub2kc, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Kome Kome Club (J 970203 V1.000)", MACHINE_NOT_WORKING ) -GAME( 1997, pclove, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Atlus", "Print Club LoveLove (J 970421 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! GAME( 1997, pclubyo2, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Yoshimoto V2 (J 970422 V1.100)", MACHINE_NOT_WORKING ) +GAME( 1997, pclove, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Atlus", "Print Club LoveLove (J 970421 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! +GAME( 1997, pclove2, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Atlus", "Print Club LoveLove Ver 2 (J 970825 V1.000)", MACHINE_NOT_WORKING ) // ^ + GAME( 1998, stress, stvbios, stv, stv, stv_state, stv, ROT0, "Sega", "Stress Busters (J 981020 V1.000)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1996, nameclub, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Sega", "Name Club (J 960315 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! @@ -3341,7 +3361,7 @@ GAME( 1997, nclubv3, stvbios, stv, stv, stv_state, nameclv3, ROT0 GAME( 1995, vfremix, stvbios, stv, stv, stv_state, vfremix, ROT0, "Sega", "Virtua Fighter Remix (JUETBKAL 950428 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) GAME( 1996, decathlt, stvbios, stv_5838, stv, stv_state, decathlt, ROT0, "Sega", "Decathlete (JUET 960709 V1.001)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION ) GAME( 1996, decathlto, decathlt,stv_5838, stv, stv_state, decathlt, ROT0, "Sega", "Decathlete (JUET 960424 V1.000)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION ) - +GAME( 1998, twcup98, stvbios, stv_5881, stv, stv_state, twcup98, ROT0, "Tecmo", "Tecmo World Cup '98 (JUET 980410 V1.000)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // some situations with the GK result in the game stalling, maybe CPU core bug?? /* Gives I/O errors */ GAME( 1996, magzun, stvbios, stv, stv, stv_state, magzun, ROT0, "Sega", "Magical Zunou Power (J 961031 V1.000)", MACHINE_NOT_WORKING ) GAME( 1997, techbowl, stvbios, stv, stv, stv_state, stv, ROT0, "Sega", "Technical Bowling (J 971212 V1.000)", MACHINE_NOT_WORKING ) diff --git a/src/mame/machine/315-5838_317-0229_comp.cpp b/src/mame/machine/315-5838_317-0229_comp.cpp index e83c8486ec0..f4c0b69129b 100644 --- a/src/mame/machine/315-5838_317-0229_comp.cpp +++ b/src/mame/machine/315-5838_317-0229_comp.cpp @@ -4,8 +4,8 @@ 315-5838 - Decathlete (ST-V) 317-0229 - Dead or Alive (Model 2A) - 317-0229 - Name Club Ver 2 (ST-V) (tested as RCDD2 in the service menu!) - 317-0231 - Print Club Love Love (ST-V) + 317-0229 - Name Club / Name Club Ver 2 (ST-V) (tested as RCDD2 in the service menu!) + 317-0231 - Print Club Love Love / Print Club Love Love Ver 2 (ST-V) Several Print Club (ST-V) carts have an unpopulated space marked '317-0229' on the PCB @@ -21,6 +21,15 @@ This is similar to how some 5881 games were set up, with the ST-V versions decrypting data directly from ROM and the Model 2 ones using a RAM source buffer. + Decathlete decompresses all graphic data with the chip. + + The Name Club games use the chip for decompressing data for the printer (full size + versions of the graphics?) + + Print Club Love Love decrypts some start up code/data required for booting. + + Dead or Alive decrypts a string that is checked on startup, nothing else. + Looking at the values read I don't think there is any address based encryption, for example many blocks where you'd expect a zero fill start with repeating patterns of 8f708f70 (different lengths) channel would appear to relate to compressed 0x00 data -- cgit v1.2.3-70-g09d2 From 322309df8f061eb2fd37559fdcbe452c11c9d2b4 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Sat, 6 Feb 2016 16:37:20 +0100 Subject: fix visual studio compile. nw --- src/mame/drivers/goupil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/goupil.cpp b/src/mame/drivers/goupil.cpp index 8d71443a39b..d1bdabb186d 100644 --- a/src/mame/drivers/goupil.cpp +++ b/src/mame/drivers/goupil.cpp @@ -417,7 +417,7 @@ WRITE8_MEMBER(goupil_g1_state::via_video_pbb_w) WRITE_LINE_MEMBER( goupil_g1_state::via_video_ca2_w ) { - if(old_state_ca2==0 and state==1) + if(old_state_ca2==0 && state==1) { m_ef9364->command_w(via_video_pbb_data&0xF); } -- cgit v1.2.3-70-g09d2 From fa8badfa5fd4fdd1639b4fce1f856459e5923071 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sat, 6 Feb 2016 16:42:26 +0000 Subject: new clones Fighting Golf (US, Ver 2) [Ryan Holtz, Shoutime, Smitdogg, The Dumping Union] --- src/mame/arcade.lst | 1 + src/mame/drivers/snk.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/mame/includes/snk.h | 1 + src/mame/video/snk.cpp | 13 +++++++++++++ 4 files changed, 62 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 2dff9f220ae..a29b753e704 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -7693,6 +7693,7 @@ tnk3j // A5001 (c) 1985 athena // 'UP' (c) 1986 fitegolf // 'GU' (c) 1988 fitegolfu // 'GU' (c) 1988 +fitegolf2 // countryc // A7004 'CC' (c) 1988 ikari // A5004 'IW' (c) 1986 ikaria // A5004 'IW' (c) 1986 diff --git a/src/mame/drivers/snk.cpp b/src/mame/drivers/snk.cpp index 0ebc52b1d0a..0e35f023e59 100644 --- a/src/mame/drivers/snk.cpp +++ b/src/mame/drivers/snk.cpp @@ -3841,6 +3841,11 @@ static MACHINE_CONFIG_DERIVED( fitegolf, tnk3 ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( fitegolf2, fitegolf ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(snk_state, screen_update_fitegolf2) +MACHINE_CONFIG_END + static MACHINE_CONFIG_START( ikari, snk_state ) @@ -4643,6 +4648,47 @@ ROM_START( fitegolfu ) /* Later US version containing enhancements to make the ROM_LOAD( "pal20l8a.6r", 0x0400, 0x0144, CRC(0f011673) SHA1(383e6f6e78daec9c874d5b48378111ca60f5ed64) ) ROM_END + + + +ROM_START( fitegolf2 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "fg_ver2_6.4e", 0x0000, 0x4000, CRC(4cc9ef0c) SHA1(0ac6071725db3ec85659b170eecec91d22e76abd) ) + ROM_LOAD( "fg_ver2_7.g4", 0x4000, 0x4000, CRC(144b0beb) SHA1(5b5e58ee93cabbdd560487b16d0cc7217d9cea7f) ) + ROM_LOAD( "fg_ver2_8.4h", 0x8000, 0x4000, CRC(057888c9) SHA1(bd412bbd9939358fedf6cc7635b46f737a288e64) ) + + ROM_REGION( 0x10000, "sub", 0 ) + ROM_LOAD( "fg_ver2_3.2e", 0x0000, 0x4000, CRC(cf8c29d7) SHA1(2153ed43ddd1967e3aea7b40415b6cd70fc6ff34) ) + ROM_LOAD( "fg_ver2_4.2g", 0x4000, 0x4000, CRC(90c1fb09) SHA1(13dcb6e9ffb3ed1588225df195c9f6af8a868970) ) + ROM_LOAD( "fg_ver2_5.2h", 0x8000, 0x4000, CRC(0ffbdbb8) SHA1(09e58551a8caf06ba420b6b44f16003b50b2ebc4) ) + + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "fg_2.3e", 0x0000, 0x4000, CRC(811b87d7) SHA1(fb387f42085d6e0e5a88729ca0e50656411ce037) ) + ROM_LOAD( "fg_1.2e", 0x4000, 0x8000, CRC(2d998e2b) SHA1(a471cfbb4dabc90fcc29c562620b9965eaff6861) ) + + ROM_REGION( 0x0c00, "proms", 0 ) + ROM_LOAD( "gl1.5f", 0x00000, 0x00400, CRC(6e4c7836) SHA1(3ab3c498939fac992e2bf1c33983ee821a9b6a18) ) + ROM_LOAD( "gl2.5g", 0x00400, 0x00400, CRC(29e7986f) SHA1(85ba8d3443458c27728f633745857a1315dd183f) ) + ROM_LOAD( "gl3.5h", 0x00800, 0x00400, CRC(27ba9ff9) SHA1(f021d10460f40de4447560df5ac47fa53bb57ff9) ) + + ROM_REGION( 0x4000, "tx_tiles", 0 ) + ROM_LOAD( "fg_12.1e", 0x0000, 0x4000, CRC(f1628dcf) SHA1(efea343d3a9dd45ef74947c297e166e34afbb680) ) + + ROM_REGION( 0x8000, "bg_tiles", 0 ) + ROM_LOAD( "fg_14.3d", 0x0000, 0x4000, CRC(29393a19) SHA1(bae5a61c16832dc217c6fd0bd9d54db86cb9692f) ) + ROM_LOAD( "fg_ver2_13.3c", 0x4000, 0x4000, CRC(5cd57c93) SHA1(7f5fb0d9e40b4894f3940373ad09fa4e984b108e) ) + + ROM_REGION( 0x18000, "sp16_tiles", 0 ) + ROM_LOAD( "fg_ver2_11.7h", 0x00000, 0x8000, CRC(d4957ec5) SHA1(8ead7866ba5ac66ead6b707aa868bcae30c486e1) ) + ROM_LOAD( "fg_ver2_10.7g", 0x08000, 0x8000, CRC(b3acdac2) SHA1(7377480d5e1b5ab2c49f5fee2927623ce8240e19) ) + ROM_LOAD( "fg_ver2_9.7e", 0x10000, 0x8000, CRC(b99cf73b) SHA1(23989fc3914e77d364807a9eb96a4ddf75ad7cf1) ) + + ROM_REGION( 0x0600, "plds", 0 ) + ROM_LOAD( "pal16r6a.6c", 0x0000, 0x0104, CRC(de291f4e) SHA1(b50294d30cb8eacc7a9bb8b46695a7463ef45ff1) ) + ROM_LOAD( "pal16l8a.3f", 0x0200, 0x0104, CRC(c5f1c1da) SHA1(e17293be0f77d302c59c1095fe1ec65e45557627) ) + ROM_LOAD( "pal20l8a.6r", 0x0400, 0x0144, CRC(0f011673) SHA1(383e6f6e78daec9c874d5b48378111ca60f5ed64) ) +ROM_END + /***********************************************************************/ /* @@ -6317,6 +6363,7 @@ GAME( 1985, tnk3j, tnk3, tnk3, tnk3, driver_device, 0, ROT GAME( 1986, athena, 0, athena, athena, driver_device, 0, ROT0, "SNK", "Athena", 0 ) GAME( 1988, fitegolf, 0, fitegolf, fitegolf, driver_device, 0, ROT0, "SNK", "Fighting Golf (World?)", 0 ) GAME( 1988, fitegolfu,fitegolf, fitegolf, fitegolfu, driver_device,0, ROT0, "SNK", "Fighting Golf (US)", 0 ) +GAME( 1988, fitegolf2,fitegolf, fitegolf2,fitegolfu, driver_device,0, ROT0, "SNK", "Fighting Golf (US, Ver 2)", 0 ) GAME( 1988, countryc, 0, fitegolf, countryc, snk_state, countryc, ROT0, "SNK", "Country Club", 0 ) GAME( 1986, ikari, 0, ikari, ikari, driver_device, 0, ROT270, "SNK", "Ikari Warriors (US JAMMA)", 0 ) // distributed by Tradewest(?) diff --git a/src/mame/includes/snk.h b/src/mame/includes/snk.h index 7e6469d6f3b..81744602a36 100644 --- a/src/mame/includes/snk.h +++ b/src/mame/includes/snk.h @@ -185,6 +185,7 @@ public: UINT32 screen_update_ikari(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gwar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_tdfever(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_fitegolf2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(sgladiat_sndirq_update_callback); TIMER_CALLBACK_MEMBER(sndirq_update_callback); DECLARE_WRITE_LINE_MEMBER(ymirq_callback_2); diff --git a/src/mame/video/snk.cpp b/src/mame/video/snk.cpp index 19bcf967fda..3749233adcb 100644 --- a/src/mame/video/snk.cpp +++ b/src/mame/video/snk.cpp @@ -930,6 +930,19 @@ UINT32 snk_state::screen_update_tnk3(screen_device &screen, bitmap_ind16 &bitmap return 0; } +UINT32 snk_state::screen_update_fitegolf2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->set_scrollx(0, m_bg_scrollx); + m_bg_tilemap->set_scrolly(0, m_bg_scrolly); + + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + tnk3_draw_sprites(bitmap, cliprect, m_sp16_scrollx+1, m_sp16_scrolly); // needs an extra offset?? neither this or fitegolf actually write to sprite offset registers tho? + m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + return 0; +} + + UINT32 snk_state::screen_update_ikari(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { -- cgit v1.2.3-70-g09d2 From 26b1bd7acb3cc0ebcfcaa0579402b45a208def59 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 6 Feb 2016 18:54:57 +0100 Subject: fidel*: update notes --- src/mame/drivers/fidel6502.cpp | 10 ++++----- src/mame/drivers/fidelz80.cpp | 47 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 7c59d740167..f4f1013eb7b 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -302,7 +302,7 @@ WRITE8_MEMBER(fidel6502_state::fexcel_ttl_w) // 74259 Q4-Q7,Q2,Q1: digit/led select (active low) UINT8 led_sel = ~BITSWAP8(m_led_select,0,3,1,2,7,6,5,4) & 0x3f; - // a0-a2,d1: digit segment data (optional/model 6093) + // a0-a2,d1: digit segment data (model 6093) m_7seg_data = (m_7seg_data & ~mask) | ((data & 2) ? mask : 0); UINT8 seg_data = BITSWAP8(m_7seg_data,0,1,3,2,7,5,6,4); @@ -314,7 +314,7 @@ WRITE8_MEMBER(fidel6502_state::fexcel_ttl_w) set_display_segmask(0x3c, 0x7f); display_update(); - // speech (optional/model 6092) + // speech (model 6092) if (m_speech != nullptr) { // a0-a2,d2: 74259(2) to speech board @@ -712,15 +712,15 @@ ROM_END ROM_START( fexcel ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD("101-1080a01.ic5", 0x8000, 0x8000, CRC(846f8e40) SHA1(4e1d5b08d5ff3422192b54fa82cb3f505a69a971) ) + ROM_LOAD("101-1080a01.ic5", 0x8000, 0x8000, CRC(846f8e40) SHA1(4e1d5b08d5ff3422192b54fa82cb3f505a69a971) ) // same as fexcelv ROM_END ROM_START( fexcelv ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD("101-1080a01.ic5", 0x8000, 0x8000, CRC(846f8e40) SHA1(4e1d5b08d5ff3422192b54fa82cb3f505a69a971) ) + ROM_LOAD("101-1080a01.ic5", 0x8000, 0x8000, CRC(846f8e40) SHA1(4e1d5b08d5ff3422192b54fa82cb3f505a69a971) ) // PCB1, M27256 ROM_REGION( 0x8000, "speech", 0 ) - ROM_LOAD("101-1081a01.ic2", 0x0000, 0x8000, CRC(c8ae1607) SHA1(6491ce6be60ed77f3dd931c0ca17616f13af943e) ) + ROM_LOAD("101-1081a01.ic2", 0x0000, 0x8000, CRC(c8ae1607) SHA1(6491ce6be60ed77f3dd931c0ca17616f13af943e) ) // PCB2, M27256 ROM_END diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 8ddb32ab675..7fdf806f635 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -633,7 +633,7 @@ NE556 dual-timer IC: Memory map: ----------- -6000-0FFF: 4K of RAM (2016 * 2) +6000-0FFF: 4K RAM (2016 * 2) 2000-5FFF: cartridge 6000-7FFF: control(W) 8000-9FFF: 8K ROM SSS SCM23C65E4 @@ -690,6 +690,51 @@ ROM A11 is however tied to the CPU's XYZ 7000_77FF - English 2/2 7800_7FFF - Bridge Challenger 2/2 +------------------ +RE info by hap, based on PCB photos + +Memory map: +----------- +0000-3FFF: 8K RAM (SRM2264) +4000-7FFF: control (R/W) +8000-FFFF: 32K ROM (M27256 compatible) + +control (W): +------------ +Z80 A0-A2 to 3*74259, Z80 Dx to D (_C unused) + +Z80 D0: +- Q4,Q5: led commons +- Q6,Q7,Q2,Q1: 7seg panel digit select +- Q0-Q3: 7442 A0-A3 + + 0-7: led data + + 0-8: keypad mux + + 9: buzzer out + +Z80 D1: (model 6093) +- Q0-Q7: 7seg data + +Z80 D2: (model 6092) +- Q0-Q5: TSI C0-C5 +- Q6: TSI START pin +- Q7: TSI ROM A11 + +A11 from TSI is tied to TSI ROM A12(!) +TSI ROM A13,A14 are hardwired to the 2 language switches. +Sound comes from the Audio out pin, digital out pins are N/C. + +control (R): +------------ +Z80 A0-A2 to 2*74251, Z80 Dx to output + +Z80 D7 to Y: +- D0-D7: keypad row data + +Z80 D6 to W: (model 6092, tied to VCC otherwise) +- D0,D1: language switches +- D2-D6: VCC +- D7: TSI BUSY + ******************************************************************************/ #include "emu.h" -- cgit v1.2.3-70-g09d2 From 2c764cad8827a03dd7026aa7808e9d6e912c4826 Mon Sep 17 00:00:00 2001 From: Ville Linde Date: Sat, 6 Feb 2016 19:53:49 +0200 Subject: viper: unknown serial device at 0xff300000 (nw) --- src/mame/drivers/viper.cpp | 83 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/viper.cpp b/src/mame/drivers/viper.cpp index 8f4bd3cfbd1..12a63346d22 100644 --- a/src/mame/drivers/viper.cpp +++ b/src/mame/drivers/viper.cpp @@ -385,6 +385,11 @@ public: int m_cf_card_ide; int m_unk1_bit; UINT32 m_voodoo3_pci_reg[0x100]; + int m_unk_serial_bit_w; + UINT16 m_unk_serial_cmd; + UINT16 m_unk_serial_data; + UINT16 m_unk_serial_data_r; + UINT8 m_unk_serial_regs[0x80]; DECLARE_READ32_MEMBER(epic_r); DECLARE_WRITE32_MEMBER(epic_w); @@ -413,9 +418,12 @@ public: DECLARE_WRITE64_MEMBER(cf_card_w); DECLARE_READ64_MEMBER(ata_r); DECLARE_WRITE64_MEMBER(ata_w); + DECLARE_READ64_MEMBER(unk_serial_r); + DECLARE_WRITE64_MEMBER(unk_serial_w); DECLARE_WRITE_LINE_MEMBER(voodoo_vblank); DECLARE_DRIVER_INIT(viper); DECLARE_DRIVER_INIT(vipercf); + DECLARE_DRIVER_INIT(viperhd); virtual void machine_start() override; virtual void machine_reset() override; UINT32 screen_update_viper(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -1970,6 +1978,68 @@ READ64_MEMBER(viper_state::e00000_r) return r; } +READ64_MEMBER(viper_state::unk_serial_r) +{ + UINT64 r = 0; + if (ACCESSING_BITS_16_31) + { + int bit = m_unk_serial_data_r & 0x1; + m_unk_serial_data_r >>= 1; + r |= bit << 17; + } + return r; +} + +WRITE64_MEMBER(viper_state::unk_serial_w) +{ + if (ACCESSING_BITS_16_31) + { + if (data & 0x10000) + { + int bit = (data & 0x20000) ? 1 : 0; + if (m_unk_serial_bit_w < 8) + { + if (m_unk_serial_bit_w > 0) + m_unk_serial_cmd <<= 1; + m_unk_serial_cmd |= bit; + } + else + { + if (m_unk_serial_bit_w > 8) + m_unk_serial_data <<= 1; + m_unk_serial_data |= bit; + } + m_unk_serial_bit_w++; + + if (m_unk_serial_bit_w == 8) + { + if ((m_unk_serial_cmd & 0x80) == 0) // register read + { + int reg = m_unk_serial_cmd & 0x7f; + UINT8 data = m_unk_serial_regs[reg]; + + m_unk_serial_data_r = ((data & 0x1) << 7) | ((data & 0x2) << 5) | ((data & 0x4) << 3) | ((data & 0x8) << 1) | ((data & 0x10) >> 1) | ((data & 0x20) >> 3) | ((data & 0x40) >> 5) | ((data & 0x80) >> 7); + + printf("unk_serial read reg %02X: %04X\n", reg, data); + } + } + if (m_unk_serial_bit_w == 16) + { + if (m_unk_serial_cmd & 0x80) // register write + { + int reg = m_unk_serial_cmd & 0x7f; + m_unk_serial_regs[reg] = m_unk_serial_data; + printf("unk_serial write reg %02X: %04X\n", reg, m_unk_serial_data); + } + + m_unk_serial_bit_w = 0; + m_unk_serial_cmd = 0; + m_unk_serial_data = 0; + } + } + } +} + /*****************************************************************************/ @@ -1984,7 +2054,7 @@ static ADDRESS_MAP_START(viper_map, AS_PROGRAM, 64, viper_state ) AM_RANGE(0xfee00000, 0xfeefffff) AM_READWRITE(pci_config_data_r, pci_config_data_w) // 0xff000000, 0xff000fff - cf_card_data_r/w (installed in DRIVER_INIT(vipercf)) // 0xff200000, 0xff200fff - cf_card_r/w (installed in DRIVER_INIT(vipercf)) - AM_RANGE(0xff300000, 0xff300fff) AM_READWRITE(ata_r, ata_w) + // 0xff300000, 0xff300fff - ata_r/w (installed in DRIVER_INIT(viperhd)) AM_RANGE(0xffe00000, 0xffe00007) AM_READ(e00000_r) AM_RANGE(0xffe00008, 0xffe0000f) AM_READWRITE(e00008_r, e00008_w) AM_RANGE(0xffe10000, 0xffe10007) AM_READ(unk1_r) @@ -2135,12 +2205,21 @@ DRIVER_INIT_MEMBER(viper_state,viper) // m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler( *ide, 0xff200000, 0xff207fff, FUNC(hdd_r), FUNC(hdd_w) ); //TODO } +DRIVER_INIT_MEMBER(viper_state,viperhd) +{ + DRIVER_INIT_CALL(viper); + + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xff300000, 0xff300fff, read64_delegate(FUNC(viper_state::ata_r), this), write64_delegate(FUNC(viper_state::ata_w), this)); +} + DRIVER_INIT_MEMBER(viper_state,vipercf) { DRIVER_INIT_CALL(viper); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xff000000, 0xff000fff, read64_delegate(FUNC(viper_state::cf_card_data_r), this), write64_delegate(FUNC(viper_state::cf_card_data_w), this) ); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xff200000, 0xff200fff, read64_delegate(FUNC(viper_state::cf_card_r), this), write64_delegate(FUNC(viper_state::cf_card_w), this) ); + + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xff300000, 0xff300fff, read64_delegate(FUNC(viper_state::unk_serial_r), this), write64_delegate(FUNC(viper_state::unk_serial_w), this) ); } @@ -2631,7 +2710,7 @@ ROM_END /* Viper BIOS */ GAME(1999, kviper, 0, viper, viper, viper_state, viper, ROT0, "Konami", "Konami Viper BIOS", MACHINE_IS_BIOS_ROOT) -GAME(2001, ppp2nd, kviper, viper, viper, viper_state, viper, ROT0, "Konami", "ParaParaParadise 2nd Mix", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) +GAME(2001, ppp2nd, kviper, viper, viper, viper_state, viperhd, ROT0, "Konami", "ParaParaParadise 2nd Mix", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, boxingm, kviper, viper, viper, viper_state, vipercf, ROT0, "Konami", "Boxing Mania (ver JAA)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2000, code1d, kviper, viper, viper, viper_state, vipercf, ROT0, "Konami", "Code One Dispatch (ver D)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) -- cgit v1.2.3-70-g09d2 From 45de7cf28aab976b7912d0394c52a12cccfcd947 Mon Sep 17 00:00:00 2001 From: MetalliC <0vetal0@gmail.com> Date: Sat, 6 Feb 2016 20:11:59 +0200 Subject: add unknown NAOMI development(?) board BOOT ROM [coolmod] --- src/mame/drivers/naomi.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp index 5d3ad6a30b6..96dc89ca2c4 100644 --- a/src/mame/drivers/naomi.cpp +++ b/src/mame/drivers/naomi.cpp @@ -2967,9 +2967,20 @@ Probably at some stage of development NAOMI was planned as non-JVS system as wel ROM_SYSTEM_BIOS( 20, "bios20", "Naomi Dev BIOS" ) \ ROM_LOAD16_WORD_SWAP_BIOS( 20, "dcnaodev.bios", 0x000000, 0x080000, CRC(7a50fab9) SHA1(ef79f448e0bf735d1264ad4f051d24178822110f) ) \ ROM_SYSTEM_BIOS( 21, "bios21", "Naomi Dev BIOS v1.10" ) \ - ROM_LOAD16_WORD_SWAP_BIOS( 21, "develop110.ic27", 0x000000, 0x200000, CRC(de7cfdb0) SHA1(da16800edc4d49f70481c124d487f544c2fa8ce7) ) + ROM_LOAD16_WORD_SWAP_BIOS( 21, "develop110.ic27", 0x000000, 0x200000, CRC(de7cfdb0) SHA1(da16800edc4d49f70481c124d487f544c2fa8ce7) ) \ + ROM_SYSTEM_BIOS( 22, "bios22", "Naomi Unknown Dev board" ) \ + ROM_LOAD16_WORD_SWAP_BIOS( 22, "zukinver0930.ipl", 0x000000, 0x200000, CRC(58e17c23) SHA1(19330f906accf1b859f56bbcedc2edff73747599) ) /* dcnaodev.bios comes from a dev / beta board. The eprom was a 27C4096 */ +/* + zukinver0930.ipl comes from 837-13502-01 / 837-13663 PCB which contains: + 22 empty sockets ROM0 - ROM21 + 315-6187 Altera EPM7064LC68-10 + PC16550DV UART + Fujitsu MB???? SCSI controller + IPL BOOT ROM with printed label "Zukin Ver.0930 / 99/5/24 / SUM:DB9C" +*/ + // bios for House of the Dead 2 #define HOTD2_BIOS \ ROM_REGION( 0x200000, "maincpu", 0) \ -- cgit v1.2.3-70-g09d2 From 6976f15dcb5ce188f81bdf07b1ff34df9516f16d Mon Sep 17 00:00:00 2001 From: briantro Date: Sat, 6 Feb 2016 12:47:51 -0600 Subject: wrally.cpp: Add minor doc updates & correct rom labels as per PCB - NW --- src/mame/drivers/wrally.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/wrally.cpp b/src/mame/drivers/wrally.cpp index 935cbc84e54..c6af288a8eb 100644 --- a/src/mame/drivers/wrally.cpp +++ b/src/mame/drivers/wrally.cpp @@ -66,6 +66,7 @@ CPUs related: Sound related: ============== * 1xOKIM6295 @ C6 +* 1xOSC1MHz @ C7 * 2xM27C4001 @ C1 & C3 (OKI ADPCM samples) * 1xPAL16R4 @ E2 (handles OKI ROM banking) @@ -94,6 +95,12 @@ to pin #2 (CLK) at ICs A16 and A17 and it is a clock for the 74LS169 ICs; this c frequency is proportional to the movements of the steering wheel: fast movements produces a high clock frequency, slow movements a low freq. +PCB: REF.930217 + +The PCB has a layout that can either use the 4 rom set of I7, I9, I11 & I 13 or larger + roms at H8 & H12 for graphics as well as the ability to use different size sound sample + roms at C1 & C3 + ***************************************************************************/ #include "emu.h" @@ -329,11 +336,10 @@ ROM_START( wrallya ) ROM_LOAD( "pal16r8-b15.bin", 0x0000, 0x0104, CRC(b50337a6) SHA1(1f922753cb9982cad9a3c9246894ecd38273236e) ) ROM_END - ROM_START( wrallyb ) ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ - ROM_LOAD16_BYTE( "rally.c23", 0x000000, 0x080000, CRC(ddd6f833) SHA1(f12f82c412fa93f46020d50c2620974ae2fb502b) ) - ROM_LOAD16_BYTE( "rally.c22", 0x000001, 0x080000, CRC(59a0d35c) SHA1(7c6f376a53c1e6d793cbfb16861ee3298ee013a1) ) + ROM_LOAD16_BYTE( "rally_c23.c23", 0x000000, 0x080000, CRC(ddd6f833) SHA1(f12f82c412fa93f46020d50c2620974ae2fb502b) ) + ROM_LOAD16_BYTE( "rally_c22.c22", 0x000001, 0x080000, CRC(59a0d35c) SHA1(7c6f376a53c1e6d793cbfb16861ee3298ee013a1) ) ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ ROM_LOAD( "wrdallas.bin", 0x00000, 0x8000, CRC(547d1768) SHA1(c58d1edd072d796be0663fb265f4739ec006b688) ) @@ -379,7 +385,7 @@ ROM_START( wrallyat ) /* Board Marked 930217, Atari License */ ROM_END -GAME( 1993, wrally, 0, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 0E56)", MACHINE_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Tension baja " */ -GAME( 1993, wrallya, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 3873)", MACHINE_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Power Failure" */ -GAME( 1993, wrallyb, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 8AA2)", MACHINE_SUPPORTS_SAVE ) // uses a 930217 board like the Atari set +GAME( 1993, wrally, 0, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 0E56)", MACHINE_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Tension baja " */ +GAME( 1993, wrallya, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 3873)", MACHINE_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Power Failure" */ +GAME( 1993, wrallyb, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 8AA2)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, wrallyat, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco (Atari license)", "World Rally (US, 930217)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From 49929923927580bf669ed3cb1d2939e776a56246 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sat, 6 Feb 2016 20:24:23 +0000 Subject: new clones The Big Apple (2131-16, U5-0 081889) (Brian can take care of credits etc.) --- src/mame/arcade.lst | 1 + src/mame/drivers/merit.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index a29b753e704..c460da1fea6 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -10979,6 +10979,7 @@ phrcrazeb // (c) 1986 Merit phrcrazec // (c) 1986 Merit phrcrazev // (c) 1986 Merit bigappg // (c) 1986 Merit +bigappga // riviera // (c) 1987 Merit rivieraa // (c) 1986 Merit rivierab // (c) 1986 Merit diff --git a/src/mame/drivers/merit.cpp b/src/mame/drivers/merit.cpp index 9f5ac8f6190..daf603d10f5 100644 --- a/src/mame/drivers/merit.cpp +++ b/src/mame/drivers/merit.cpp @@ -422,6 +422,19 @@ static ADDRESS_MAP_START( bigappg_map, AS_PROGRAM, 8, merit_state ) AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w) ADDRESS_MAP_END +static ADDRESS_MAP_START( bigappga_map, AS_PROGRAM, 8, merit_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_SHARE("cpunvram") // overlays other NVRAM? or is it banked? + AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0xc004, 0xc007) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) // swapped compared to other set? + AM_RANGE(0xc008, 0xc00b) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) + AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_device, address_w) + AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_device, register_w) + AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr") + AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo") + AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w) +ADDRESS_MAP_END + static ADDRESS_MAP_START( dodge_map, AS_PROGRAM, 8, merit_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("nvram") @@ -590,6 +603,8 @@ static INPUT_PORTS_START( meritpoker ) PORT_DIPUNKNOWN_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" ) INPUT_PORTS_END + + static INPUT_PORTS_START( bigappg ) PORT_INCLUDE( meritpoker ) @@ -1260,6 +1275,14 @@ static MACHINE_CONFIG_DERIVED( bigappg, pitboss ) MCFG_NVRAM_ADD_0FILL("nvram") MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( bigappga, bigappg ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(bigappga_map) + + MCFG_NVRAM_ADD_0FILL("cpunvram") +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( dodge, pitboss ) MCFG_CPU_MODIFY("maincpu") @@ -1479,6 +1502,23 @@ ROM_START( bigappg ) ROM_LOAD( "haip_u40.u40", 0x0000, 0x2000, CRC(ac4983b8) SHA1(a552a15f813c331de67eaae2ed42cc037b26c5bd) ) ROM_END +ROM_START( bigappga ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "2131-16_u5-2.u5", 0x0000, 0x8000, CRC(fc756320) SHA1(6b810c57ed1be844a04a6081d727e182509604b4) ) /* 2131-16 U5-0 081889 */ + + ROM_REGION( 0x6000, "gfx1", 0 ) + ROM_LOAD( "u39.u39", 0x0000, 0x2000, CRC(0f09d19b) SHA1(1f98559d5bad7c84d92ecea5a6df9429914a47f0) ) + ROM_LOAD( "u38.u38", 0x2000, 0x2000, CRC(8210a48d) SHA1(9af3e8ac8dcf1e548c4ba3ca8096e48dbb3b4700) ) + ROM_LOAD( "u37.u37", 0x4000, 0x2000, CRC(34ca07d5) SHA1(3656b3eb78dd6ea06cf323a08fc3f949a01b76a3) ) + + ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_LOAD( "haip_u40.u40", 0x0000, 0x2000, CRC(ac4983b8) SHA1(a552a15f813c331de67eaae2ed42cc037b26c5bd) ) + + ROM_REGION( 0x0800, "cpunvram", ROMREGION_ERASEFF ) + // this contains CODE, the game jumps there on startup + ROM_LOAD( "crt-209_2131-16", 0x0000, 0x0800, CRC(34729437) SHA1(f097a1a97d8078d7d6a6af85be416b1d1d09c7f2) ) /* 2816 EEPROM in Z80 epoxy CPU module */ +ROM_END + ROM_START( dodgectya ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "2131-82_u5-0d.u5", 0x0000, 0x8000, CRC(ef71b268) SHA1(c85f2c8e7e9cd89b4720699814d8fcfbecf4dc1b) ) /* 2131-82 U5-0D 884111 2131 820*/ @@ -2185,6 +2225,7 @@ GAME( 1986, rivieraa, riviera, dodge, riviera, driver_device, 0, ROT0, " GAME( 1986, rivierab, riviera, dodge, rivierab, driver_device, 0, ROT0, "Merit", "Riviera Hi-Score (2131-08, U5-2D)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1986, bigappg, 0, bigappg, bigappg, driver_device, 0, ROT0, "Big Apple Games / Merit", "The Big Apple (2131-13, U5-0)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, bigappga, bigappg, bigappga, bigappg, driver_device, 0, ROT0, "Big Apple Games / Merit", "The Big Apple (2131-16, U5-0 081889)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, dodgectya,dodgecty,dodge, dodge, driver_device, 0, ROT0, "Merit", "Dodge City (2131-82, U5-0D)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) GAME( 1986, dodgectyb,dodgecty,dodge, dodge, driver_device, 0, ROT0, "Merit", "Dodge City (2131-82, U5-50)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From 41f1661876f163c0cb01d678b19920edd0b86358 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 6 Feb 2016 21:42:36 +0100 Subject: Revert "New NOT_WORKING machine added" This reverts commit 5b0fcf599756c93a64539b5e2d048273a42b9f92. --- scripts/target/mame/mess.lua | 1 - src/mame/drivers/ctteach.cpp | 116 ------------------------------------------ src/mame/drivers/hh_tms1k.cpp | 2 +- src/mame/mess.lst | 9 ++-- 4 files changed, 5 insertions(+), 123 deletions(-) delete mode 100644 src/mame/drivers/ctteach.cpp diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 453b01028b8..f89b2b0557e 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -1464,7 +1464,6 @@ files { MAME_DIR .. "src/mame/includes/coleco.h", MAME_DIR .. "src/mame/machine/coleco.cpp", MAME_DIR .. "src/mame/machine/coleco.h", - MAME_DIR .. "src/mame/drivers/ctteach.cpp", } createMESSProjects(_target, _subtarget, "cromemco") diff --git a/src/mame/drivers/ctteach.cpp b/src/mame/drivers/ctteach.cpp deleted file mode 100644 index 027269f0b7c..00000000000 --- a/src/mame/drivers/ctteach.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap -/*************************************************************************** - - ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.cpp) ** - - Coleco Talking Teacher - * - -***************************************************************************/ - -#include "includes/hh_tms1k.h" - - -class ctteach_state : public hh_tms1k_state -{ -public: - ctteach_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); - -protected: - virtual void machine_start() override; -}; - - -/*************************************************************************** - - I/O - -***************************************************************************/ - -WRITE16_MEMBER(ctteach_state::write_r) -{ -} - -WRITE16_MEMBER(ctteach_state::write_o) -{ -} - -READ8_MEMBER(ctteach_state::read_k) -{ - return 0; -} - - - -/*************************************************************************** - - Inputs - -***************************************************************************/ - -static INPUT_PORTS_START( ctteach ) - -INPUT_PORTS_END - - - -/*************************************************************************** - - Machine Config - -***************************************************************************/ - -void ctteach_state::machine_start() -{ - hh_tms1k_state::machine_start(); - - // zerofill - - // register for savestates -} - - -static MACHINE_CONFIG_START( ctteach, ctteach_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 400000) // approximation - MCFG_TMS1XXX_READ_K_CB(READ8(ctteach_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ctteach_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ctteach_state, write_o)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( ctteach ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "mp7324", 0x0000, 0x1000, CRC(08d15ab6) SHA1(5b0f6c53e6732a362c4bb25d966d4072fdd33db8) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) - ROM_REGION( 557, "maincpu:opla", 0 ) - ROM_LOAD( "tms1400_ctteach_output.pla", 0, 557, CRC(3a5c7005) SHA1(3fe5819c138a90e7fc12817415f2622ca81b40b2) ) - - ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) - ROM_LOAD( "cm62084.vsm", 0x0000, 0x4000, CRC(cd1376f7) SHA1(96fa484c392c451599bc083b8376cad9c998df7d) ) -ROM_END - - -COMP( 1987, ctteach, 0, 0, ctteach, ctteach, driver_device, 0, "Coleco", "Talking Teacher", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 6a35b0fe09a..9b30fd89b66 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -74,7 +74,7 @@ *MP7303 TMS1400? 19??, Tiger 7-in-1 Sports Stadium @MP7313 TMS1400 1980, Parker Brothers Bank Shot @MP7314 TMS1400 1980, Parker Brothers Split Second - MP7324 TMS1400 1987, Coleco Talking Teacher -> ctteach.cpp + *MP7324 TMS1400? 1985, Coleco Talking Teacher MP7332 TMS1400 1981, Milton Bradley Dark Tower -> mbdtower.cpp @MP7334 TMS1400 1981, Coleco Total Control 4 @MP7351 TMS1400CR 1982, Parker Brothers Master Merlin diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 48e094ace26..9f41ab0709e 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2314,7 +2314,6 @@ tbreakup // Tomy phpball // Tomy // hh_tms1k derivatives -ctteach // Coleco elecbowl // Marx mbdtower // Milton Bradley @@ -2333,10 +2332,6 @@ lilprof lilprof78 dataman -// hh_tms1k tispellb.cpp -spellb -mrchalgr - // hh_tms1k tispeak.cpp snspell snspellp @@ -2361,6 +2356,10 @@ tntellfr tntellp vocaid +// hh_tms1k tispellb.cpp +spellb +mrchalgr + // hh_ucom4 ufombs // Bambino ssfball // Bambino -- cgit v1.2.3-70-g09d2 From bd1215606542ee9843710d658100be303db17b6d Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 6 Feb 2016 22:11:27 +0100 Subject: tispeak: moved ctteach to here --- src/mame/drivers/hh_tms1k.cpp | 2 +- src/mame/drivers/tispeak.cpp | 71 ++++++++++++++++++++++++++++++++++++++++++- src/mame/mess.lst | 9 +++--- 3 files changed, 76 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 9b30fd89b66..208751f7f9d 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -74,7 +74,7 @@ *MP7303 TMS1400? 19??, Tiger 7-in-1 Sports Stadium @MP7313 TMS1400 1980, Parker Brothers Bank Shot @MP7314 TMS1400 1980, Parker Brothers Split Second - *MP7324 TMS1400? 1985, Coleco Talking Teacher + MP7324 TMS1400 1985, Coleco Talking Teacher -> tispeak.cpp MP7332 TMS1400 1981, Milton Bradley Dark Tower -> mbdtower.cpp @MP7334 TMS1400 1981, Coleco Total Control 4 @MP7351 TMS1400CR 1982, Parker Brothers Master Merlin diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index 94d62dd1350..0e11898ca51 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -351,10 +351,17 @@ Language Tutor modules: - English(4/4): VSM: 16KB CD3529 +Other manufacturers: + +Coleco Talking Teacher: + +x + ---------------------------------------------------------------------------- TODO: - why doesn't lantutor work? + - identify and emulate ctteach LCD - emulate other known devices @@ -412,6 +419,10 @@ public: DECLARE_WRITE16_MEMBER(snspellc_write_r); DECLARE_READ8_MEMBER(tntell_read_k); + DECLARE_READ8_MEMBER(ctteach_read_k); + DECLARE_WRITE16_MEMBER(ctteach_write_o); + DECLARE_WRITE16_MEMBER(ctteach_write_r); + // cartridge UINT32 m_cart_max_size; UINT8* m_cart_base; @@ -631,6 +642,22 @@ TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::tntell_get_overlay) } +// ctteach specific + +WRITE16_MEMBER(tispeak_state::ctteach_write_r) +{ +} + +WRITE16_MEMBER(tispeak_state::ctteach_write_o) +{ +} + +READ8_MEMBER(tispeak_state::ctteach_read_k) +{ + return 0; +} + + /*************************************************************************** @@ -799,7 +826,7 @@ static INPUT_PORTS_START( snmath ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) // / + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Mix It") PORT_START("IN.6") // R6 @@ -1031,6 +1058,12 @@ static INPUT_PORTS_START( tntell ) INPUT_PORTS_END +static INPUT_PORTS_START( ctteach ) + + +INPUT_PORTS_END + + /*************************************************************************** @@ -1210,6 +1243,26 @@ static MACHINE_CONFIG_DERIVED( tntell, vocaid ) MACHINE_CONFIG_END +static MACHINE_CONFIG_START( ctteach, tispeak_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1400, MASTER_CLOCK/2) + MCFG_TMS1XXX_READ_K_CB(READ8(tispeak_state, ctteach_read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, ctteach_write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, ctteach_write_r)) + + //MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + //MCFG_DEFAULT_LAYOUT(layout_ctteach) + + /* sound hardware */ + MCFG_DEVICE_ADD("tms6100", TMS6100, MASTER_CLOCK/4) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("tms5100", TMS5110A, MASTER_CLOCK) + MCFG_FRAGMENT_ADD(tms5110_route) +MACHINE_CONFIG_END + + /*************************************************************************** @@ -1551,6 +1604,20 @@ ROM_START( vocaid ) ROM_END +ROM_START( ctteach ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "mp7324", 0x0000, 0x1000, CRC(08d15ab6) SHA1(5b0f6c53e6732a362c4bb25d966d4072fdd33db8) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 557, "maincpu:opla", 0 ) + ROM_LOAD( "tms1400_ctteach_output.pla", 0, 557, CRC(3a5c7005) SHA1(3fe5819c138a90e7fc12817415f2622ca81b40b2) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) + ROM_LOAD( "cm62084.vsm", 0x0000, 0x4000, CRC(cd1376f7) SHA1(96fa484c392c451599bc083b8376cad9c998df7d) ) +ROM_END + + /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ COMP( 1979, snspell, 0, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1979 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) @@ -1581,3 +1648,5 @@ COMP( 1981, tntelluk, tntell, 0, tntell, tntell, tispeak_state, tn COMP( 1981, tntellfr, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Le Livre Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK | MACHINE_REQUIRES_ARTWORK ) COMP( 1982, vocaid, 0, 0, vocaid, tntell, driver_device, 0, "Texas Instruments", "Vocaid", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) + +COMP( 1985, ctteach, 0, 0, ctteach, ctteach, driver_device, 0, "Coleco", "Talking Teacher", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 9f41ab0709e..459fae8a81f 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2332,6 +2332,10 @@ lilprof lilprof78 dataman +// hh_tms1k tispellb.cpp +spellb +mrchalgr + // hh_tms1k tispeak.cpp snspell snspellp @@ -2355,10 +2359,7 @@ tntelluk tntellfr tntellp vocaid - -// hh_tms1k tispellb.cpp -spellb -mrchalgr +ctteach // Coleco // hh_ucom4 ufombs // Bambino -- cgit v1.2.3-70-g09d2 From 02d1107016ef1f8cd56d19ac7688c6150248b4b7 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 6 Feb 2016 22:18:32 +0100 Subject: tispeak: added ctteach i/o and keyboard --- src/mame/drivers/tispeak.cpp | 73 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index 0e11898ca51..dfd3502470f 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -646,15 +646,35 @@ TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::tntell_get_overlay) WRITE16_MEMBER(tispeak_state::ctteach_write_r) { + // R1234: TMS5100 CTL8421 + m_tms5100->ctl_w(space, 0, BITSWAP8(data,0,0,0,0,1,2,3,4) & 0xf); + + // R0: TMS5100 PDC pin + m_tms5100->pdc_w(data & 1); + + // R5: input mux high bit + m_inp_mux = (m_inp_mux & 0xff) | (data << 3 & 0x100); + + // R6: power-off request, on falling edge + if ((m_r >> 6 & 1) && !(data >> 6 & 1)) + power_off(); + + // R7-R10: LCD data + //.. + + m_r = data; } WRITE16_MEMBER(tispeak_state::ctteach_write_o) { + // O0-O7: input mux low + m_inp_mux = (m_inp_mux & ~0xff) | data; } READ8_MEMBER(tispeak_state::ctteach_read_k) { - return 0; + // K: TMS5100 CTL, multiplexed inputs + return m_tms5100->ctl_r(space, 0) | read_inputs(9); } @@ -1059,8 +1079,59 @@ INPUT_PORTS_END static INPUT_PORTS_START( ctteach ) + PORT_START("IN.0") // O0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") // -> auto_power_off + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('A') PORT_NAME("A/1") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('J') PORT_NAME("J/0") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_START("IN.1") // O1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, power_button, (void *)true) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('B') PORT_NAME("B/2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('K') PORT_NAME("K/+") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + + PORT_START("IN.2") // O2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("Repeat") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('C') PORT_NAME("C/3") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('L') PORT_NAME("L/-") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_START("IN.3") // O3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("Prompt") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('D') PORT_NAME("D/4") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('M') PORT_NAME("M/" UTF8_MULTIPLY) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + + PORT_START("IN.4") // O4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("Menu") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('E') PORT_NAME("E/5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('N') PORT_NAME("N/" UTF8_DIVIDE) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("IN.5") // O5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("Module") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('F') PORT_NAME("F/6") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("IN.6") // O6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Select") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('G') PORT_NAME("G/7") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + + PORT_START("IN.7") // O7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('H') PORT_NAME("H/8") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + + PORT_START("IN.8") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('I') PORT_NAME("I/9") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") INPUT_PORTS_END -- cgit v1.2.3-70-g09d2 From 9e482e16820180f6359d374b93a45d6bc813116c Mon Sep 17 00:00:00 2001 From: briantro Date: Sat, 6 Feb 2016 15:39:59 -0600 Subject: new Working Game This replaces David's Big Apple clone New games added or promoted from NOT_WORKING status --------------------------------------------------- Michigan Super Draw (2131-16, U5-2) [Charles MacDonald, Brian Troha, David Haywood, The Dumping Union] --- src/mame/arcade.lst | 4 ++-- src/mame/drivers/merit.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index c460da1fea6..331e64bb462 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -10978,8 +10978,8 @@ phrcrazea // (c) 1986 Merit phrcrazeb // (c) 1986 Merit phrcrazec // (c) 1986 Merit phrcrazev // (c) 1986 Merit -bigappg // (c) 1986 Merit -bigappga // +bigappg // (c) 1986 Merit / Big Apple Games +misdraw // (c) 1986 Merit / Big Apple Games riviera // (c) 1987 Merit rivieraa // (c) 1986 Merit rivierab // (c) 1986 Merit diff --git a/src/mame/drivers/merit.cpp b/src/mame/drivers/merit.cpp index daf603d10f5..f438e37dea9 100644 --- a/src/mame/drivers/merit.cpp +++ b/src/mame/drivers/merit.cpp @@ -59,7 +59,7 @@ Merit Riviera Notes - There are several known versions: Riviera Super Star (not dumped) Riviera Montana Version (with journal printer, not dumped) Riviera Tennessee Draw (not dumped) - Michigan Superstar Draw Poker (not dumped) + Michigan Super Draw Poker (Is there a "Superstar" version?) Americana There are several law suites over the Riviera games. Riviera Distributors Inc. bought earlier versions @@ -422,7 +422,7 @@ static ADDRESS_MAP_START( bigappg_map, AS_PROGRAM, 8, merit_state ) AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w) ADDRESS_MAP_END -static ADDRESS_MAP_START( bigappga_map, AS_PROGRAM, 8, merit_state ) +static ADDRESS_MAP_START( misdraw_map, AS_PROGRAM, 8, merit_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_SHARE("cpunvram") // overlays other NVRAM? or is it banked? AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("nvram") @@ -1275,10 +1275,10 @@ static MACHINE_CONFIG_DERIVED( bigappg, pitboss ) MCFG_NVRAM_ADD_0FILL("nvram") MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( bigappga, bigappg ) +static MACHINE_CONFIG_DERIVED( misdraw, bigappg ) MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(bigappga_map) + MCFG_CPU_PROGRAM_MAP(misdraw_map) MCFG_NVRAM_ADD_0FILL("cpunvram") MACHINE_CONFIG_END @@ -1502,9 +1502,9 @@ ROM_START( bigappg ) ROM_LOAD( "haip_u40.u40", 0x0000, 0x2000, CRC(ac4983b8) SHA1(a552a15f813c331de67eaae2ed42cc037b26c5bd) ) ROM_END -ROM_START( bigappga ) +ROM_START( misdraw ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "2131-16_u5-2.u5", 0x0000, 0x8000, CRC(fc756320) SHA1(6b810c57ed1be844a04a6081d727e182509604b4) ) /* 2131-16 U5-0 081889 */ + ROM_LOAD( "2131-16_u5-2.u5", 0x0000, 0x8000, CRC(fc756320) SHA1(6b810c57ed1be844a04a6081d727e182509604b4) ) /* 2131-16 U5-2 081889 */ ROM_REGION( 0x6000, "gfx1", 0 ) ROM_LOAD( "u39.u39", 0x0000, 0x2000, CRC(0f09d19b) SHA1(1f98559d5bad7c84d92ecea5a6df9429914a47f0) ) @@ -2225,7 +2225,7 @@ GAME( 1986, rivieraa, riviera, dodge, riviera, driver_device, 0, ROT0, " GAME( 1986, rivierab, riviera, dodge, rivierab, driver_device, 0, ROT0, "Merit", "Riviera Hi-Score (2131-08, U5-2D)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1986, bigappg, 0, bigappg, bigappg, driver_device, 0, ROT0, "Big Apple Games / Merit", "The Big Apple (2131-13, U5-0)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, bigappga, bigappg, bigappga, bigappg, driver_device, 0, ROT0, "Big Apple Games / Merit", "The Big Apple (2131-16, U5-0 081889)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, misdraw, 0, misdraw, bigappg, driver_device, 0, ROT0, "Big Apple Games / Merit", "Michigan Super Draw (2131-16, U5-2)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, dodgectya,dodgecty,dodge, dodge, driver_device, 0, ROT0, "Merit", "Dodge City (2131-82, U5-0D)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) GAME( 1986, dodgectyb,dodgecty,dodge, dodge, driver_device, 0, ROT0, "Merit", "Dodge City (2131-82, U5-50)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From 2f32d226cc42154c6d2726fcdcd1893fe09e4b3e Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 6 Feb 2016 22:49:00 +0100 Subject: tispeak: added ctteach layout file --- src/mame/drivers/tispeak.cpp | 32 +++++++++++++++++++++++++------- src/mame/layout/ctteach.lay | 26 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 src/mame/layout/ctteach.lay diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index dfd3502470f..3f51ca6f1eb 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -353,9 +353,20 @@ Language Tutor modules: Other manufacturers: -Coleco Talking Teacher: - -x + Coleco Talking Teacher: + - MCU: TMS1400 MP7324 + - TMS51xx: TMS5110A + - VSM: 16KB CM62084 + - LCD: unknown 8*16-seg + - known releases: + + Coleco: Talking Teacher + + Sears: Talkatron - Learning Computer + + Tiger Electronics(Hong Kong): K-2-8 + + An earlier revision used the SC-01 speech chip? + + modules: + - x ---------------------------------------------------------------------------- @@ -375,6 +386,7 @@ x #include "softlist.h" // internal artwork +#include "ctteach.lh" #include "lantutor.lh" #include "snmath.lh" #include "snspell.lh" @@ -419,6 +431,7 @@ public: DECLARE_WRITE16_MEMBER(snspellc_write_r); DECLARE_READ8_MEMBER(tntell_read_k); + void ctteach_prepare_display(UINT8 old, UINT8 data); DECLARE_READ8_MEMBER(ctteach_read_k); DECLARE_WRITE16_MEMBER(ctteach_write_o); DECLARE_WRITE16_MEMBER(ctteach_write_r); @@ -644,6 +657,12 @@ TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::tntell_get_overlay) // ctteach specific +void tispeak_state::ctteach_prepare_display(UINT8 old, UINT8 data) +{ + if (data == old) + return; +} + WRITE16_MEMBER(tispeak_state::ctteach_write_r) { // R1234: TMS5100 CTL8421 @@ -660,8 +679,7 @@ WRITE16_MEMBER(tispeak_state::ctteach_write_r) power_off(); // R7-R10: LCD data - //.. - + ctteach_prepare_display(m_r >> 7 & 0xf, data >> 7 & 0xf); m_r = data; } @@ -1322,8 +1340,8 @@ static MACHINE_CONFIG_START( ctteach, tispeak_state ) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, ctteach_write_o)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, ctteach_write_r)) - //MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - //MCFG_DEFAULT_LAYOUT(layout_ctteach) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_ctteach) /* sound hardware */ MCFG_DEVICE_ADD("tms6100", TMS6100, MASTER_CLOCK/4) diff --git a/src/mame/layout/ctteach.lay b/src/mame/layout/ctteach.lay new file mode 100644 index 00000000000..dde1a20e295 --- /dev/null +++ b/src/mame/layout/ctteach.lay @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-70-g09d2 From a560877764e0bad6cc7946f3a7a751a7953f0de5 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sat, 6 Feb 2016 22:17:48 +0000 Subject: new clones World Cup Volley '95 Extra Version (Asia v2.0B) [Kevin Eshbach] --- src/mame/arcade.lst | 1 + src/mame/drivers/deco156.cpp | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 331e64bb462..45f41a0882a 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -6367,6 +6367,7 @@ charlien // MBR (c) 1994 Mitchell // MBV ?? // MBW ?? wcvol95 // MBX (c) 1993 Data East +wcvol95x // ? // MBY ?? backfire // MBZ (c) 1995 backfirea // MBZ (c) 1995 diff --git a/src/mame/drivers/deco156.cpp b/src/mame/drivers/deco156.cpp index faa0f3bb6a5..e77e5ac0c09 100644 --- a/src/mame/drivers/deco156.cpp +++ b/src/mame/drivers/deco156.cpp @@ -8,9 +8,6 @@ See also deco32.c, deco_mlc.c, backfire.c - Todo: - complete co-processor emulation for wcvol95 - Emulation by Bryan McPhail, mish@tendril.co.uk */ @@ -630,6 +627,25 @@ ROM_START( wcvol95 ) // ROM_LOAD( "93c46.3k", 0x00, 0x80, CRC(88f8e270) SHA1(cb82203ad38e0c12ea998562b7b785979726afe5) ) ROM_END + + +ROM_START( wcvol95x ) + ROM_REGION( 0x100000, "maincpu", 0 ) /* DE156 code (encrypted) */ + // no label markings were present + ROM_LOAD32_WORD( "2f.bin", 0x000002, 0x080000, CRC(ac06633d) SHA1(5d37ca3050f35d5fc06f70e91b1522e325471585) ) + ROM_LOAD32_WORD( "4f.bin", 0x000000, 0x080000, CRC(e211f67a) SHA1(d008c2b809482f17ada608134357fa1205d767d4) ) + + ROM_REGION( 0x080000, "gfx1", 0 ) + ROM_LOAD( "mbx-00.9a", 0x000000, 0x080000, CRC(a0b24204) SHA1(cec8089c6c635f23b3a4aeeef2c43f519568ad70) ) + + ROM_REGION( 0x200000, "gfx2", 0 ) + ROM_LOAD16_BYTE( "mbx-01.12a", 0x000000, 0x100000, CRC(73deb3f1) SHA1(c0cabecfd88695afe0f27c5bb115b4973907207d) ) + ROM_LOAD16_BYTE( "mbx-02.13a", 0x000001, 0x100000, CRC(3204d324) SHA1(44102f71bae44bf3a9bd2de7e5791d959a2c9bdd) ) + + ROM_REGION( 0x200000, "ymz", 0 ) /* YMZ280B-F samples */ + ROM_LOAD( "mbx-03.13j", 0x00000, 0x200000, CRC(061632bc) SHA1(7900ac56e59f4a4e5768ce72f4a4b7c5875f5ae8) ) +ROM_END + /**********************************************************************************/ void deco156_state::descramble_sound( const char *tag ) @@ -677,3 +693,4 @@ GAME( 1993, hvysmsh, 0, hvysmsh, hvysmsh, deco156_state, hvysmsh, ROT0, GAME( 1993, hvysmsha, hvysmsh, hvysmsh, hvysmsh, deco156_state, hvysmsh, ROT0, "Data East Corporation", "Heavy Smash (Asia version -4)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, hvysmshj, hvysmsh, hvysmsh, hvysmsh, deco156_state, hvysmsh, ROT0, "Data East Corporation", "Heavy Smash (Japan version -2)", MACHINE_SUPPORTS_SAVE ) GAME( 1995, wcvol95, 0, wcvol95, wcvol95, deco156_state, wcvol95, ROT0, "Data East Corporation", "World Cup Volley '95 (Japan v1.0)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, wcvol95x, wcvol95, wcvol95, wcvol95, deco156_state, wcvol95, ROT0, "Data East Corporation", "World Cup Volley '95 Extra Version (Asia v2.0B)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From d18260287d31e49368b5cd956ebacb61209c4d6a Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sat, 6 Feb 2016 22:43:08 +0000 Subject: gals (nw) --- src/mame/drivers/deco156.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mame/drivers/deco156.cpp b/src/mame/drivers/deco156.cpp index e77e5ac0c09..b8ab102bee1 100644 --- a/src/mame/drivers/deco156.cpp +++ b/src/mame/drivers/deco156.cpp @@ -625,6 +625,10 @@ ROM_START( wcvol95 ) // ROM_REGION( 0x80, "user1", 0 ) /* eeprom */ // ROM_LOAD( "93c46.3k", 0x00, 0x80, CRC(88f8e270) SHA1(cb82203ad38e0c12ea998562b7b785979726afe5) ) + + ROM_REGION( 0x200, "gals", 0 ) + ROM_LOAD( "GAL16V8B.10J.bin", 0x000, 0x117, CRC(06bbcbd5) SHA1(f7adb4bca13bb799bc42411eb178edfdc11a76c7) ) + ROM_LOAD( "GAL16V8B.5D.bin", 0x000, 0x117, CRC(117784f0) SHA1(daf3720740621fc3af49333c96795718b693f4d2)) ROM_END @@ -644,8 +648,13 @@ ROM_START( wcvol95x ) ROM_REGION( 0x200000, "ymz", 0 ) /* YMZ280B-F samples */ ROM_LOAD( "mbx-03.13j", 0x00000, 0x200000, CRC(061632bc) SHA1(7900ac56e59f4a4e5768ce72f4a4b7c5875f5ae8) ) + + ROM_REGION( 0x200, "gals", 0 ) + ROM_LOAD( "GAL16V8B.10J.bin", 0x000, 0x117, CRC(06bbcbd5) SHA1(f7adb4bca13bb799bc42411eb178edfdc11a76c7) ) + ROM_LOAD( "GAL16V8B.5D.bin", 0x000, 0x117, CRC(117784f0) SHA1(daf3720740621fc3af49333c96795718b693f4d2)) ROM_END + /**********************************************************************************/ void deco156_state::descramble_sound( const char *tag ) -- cgit v1.2.3-70-g09d2 From 0174ccbbe185da0c9a4b2330995a4c2243809979 Mon Sep 17 00:00:00 2001 From: Justin Kerk Date: Sat, 6 Feb 2016 15:59:15 -0800 Subject: Fix indentation (nw) --- src/osd/modules/sound/js_sound.js | 312 +++++++++++++++++++------------------- 1 file changed, 156 insertions(+), 156 deletions(-) diff --git a/src/osd/modules/sound/js_sound.js b/src/osd/modules/sound/js_sound.js index 393bcd66e93..b06cbb44365 100644 --- a/src/osd/modules/sound/js_sound.js +++ b/src/osd/modules/sound/js_sound.js @@ -2,10 +2,10 @@ // copyright-holders:Grant Galitz, Katelyn Gadd /*************************************************************************** - JSMAME web audio backend v0.3 + JSMAME web audio backend v0.3 - Original by katelyn gadd - kg at luminance dot org ; @antumbral on twitter - Substantial changes by taisel + Original by katelyn gadd - kg at luminance dot org ; @antumbral on twitter + Substantial changes by taisel ***************************************************************************/ @@ -23,187 +23,187 @@ var watchDogDateLast = null; var watchDogTimerEvent = null; function lazy_init () { - //Make - if (context) { - //Return if already created: - return; - } - if (typeof AudioContext != "undefined") { - //Standard context creation: - context = new AudioContext(); - } - else if (typeof webkitAudioContext != "undefined") { - //Older webkit context creation: - context = new webkitAudioContext(); - } - else { - //API not found! - return; - } - //Generate a volume control node: - gain_node = context.createGain(); - //Set initial volume to 1: - gain_node.gain.value = 1.0; - //Connect volume node to output: - gain_node.connect(context.destination); - //Initialize the streaming event: - init_event(); + //Make + if (context) { + //Return if already created: + return; + } + if (typeof AudioContext != "undefined") { + //Standard context creation: + context = new AudioContext(); + } + else if (typeof webkitAudioContext != "undefined") { + //Older webkit context creation: + context = new webkitAudioContext(); + } + else { + //API not found! + return; + } + //Generate a volume control node: + gain_node = context.createGain(); + //Set initial volume to 1: + gain_node.gain.value = 1.0; + //Connect volume node to output: + gain_node.connect(context.destination); + //Initialize the streaming event: + init_event(); }; function init_event() { - //Generate a streaming node point: - if (typeof context.createScriptProcessor == "function") { - //Current standard compliant way: - eventNode = context.createScriptProcessor(4096, 0, 2); - } - else { - //Deprecated way: - eventNode = context.createJavaScriptNode(4096, 0, 2); - } - //Make our tick function the audio callback function: - eventNode.onaudioprocess = tick; - //Connect stream to volume control node: - eventNode.connect(gain_node); - //WORKAROUND FOR FIREFOX BUG: - initializeWatchDogForFirefoxBug(); + //Generate a streaming node point: + if (typeof context.createScriptProcessor == "function") { + //Current standard compliant way: + eventNode = context.createScriptProcessor(4096, 0, 2); + } + else { + //Deprecated way: + eventNode = context.createJavaScriptNode(4096, 0, 2); + } + //Make our tick function the audio callback function: + eventNode.onaudioprocess = tick; + //Connect stream to volume control node: + eventNode.connect(gain_node); + //WORKAROUND FOR FIREFOX BUG: + initializeWatchDogForFirefoxBug(); }; function initializeWatchDogForFirefoxBug() { - //TODO: decide if we want to user agent sniff firefox here, - //since Google Chrome doesn't need this: - watchDogDateLast = (new Date()).getTime(); - if (watchDogTimerEvent === null) { - watchDogTimerEvent = setInterval(function () { - var timeDiff = (new Date()).getTime() - watchDogDateLast; - if (timeDiff > 500) { - disconnect_old_event(); - init_event(); - } - }, 500); - } + //TODO: decide if we want to user agent sniff firefox here, + //since Google Chrome doesn't need this: + watchDogDateLast = (new Date()).getTime(); + if (watchDogTimerEvent === null) { + watchDogTimerEvent = setInterval(function () { + var timeDiff = (new Date()).getTime() - watchDogDateLast; + if (timeDiff > 500) { + disconnect_old_event(); + init_event(); + } + }, 500); + } }; function disconnect_old_event() { - //Disconnect from audio graph: - eventNode.disconnect(); - //IIRC there was a firefox bug that did not GC this event when nulling the node itself: - eventNode.onaudioprocess = null; - //Null the glitched/unused node: - eventNode = null; + //Disconnect from audio graph: + eventNode.disconnect(); + //IIRC there was a firefox bug that did not GC this event when nulling the node itself: + eventNode.onaudioprocess = null; + //Null the glitched/unused node: + eventNode = null; }; function set_mastervolume ( - // even though it's 'attenuation' the value is negative, so... - attenuation_in_decibels + // even though it's 'attenuation' the value is negative, so... + attenuation_in_decibels ) { - lazy_init(); - if (!context) return; - - // http://stackoverflow.com/questions/22604500/web-audio-api-working-with-decibels - // seemingly incorrect/broken. figures. welcome to Web Audio - // var gain_web_audio = 1.0 - Math.pow(10, 10 / attenuation_in_decibels); - - // HACK: Max attenuation in JSMESS appears to be 32. - // Hit ' then left/right arrow to test. - // FIXME: This is linear instead of log10 scale. - var gain_web_audio = 1.0 + (+attenuation_in_decibels / +32); - if (gain_web_audio < +0) - gain_web_audio = +0; - else if (gain_web_audio > +1) - gain_web_audio = +1; - - gain_node.gain.value = gain_web_audio; + lazy_init(); + if (!context) return; + + // http://stackoverflow.com/questions/22604500/web-audio-api-working-with-decibels + // seemingly incorrect/broken. figures. welcome to Web Audio + // var gain_web_audio = 1.0 - Math.pow(10, 10 / attenuation_in_decibels); + + // HACK: Max attenuation in JSMESS appears to be 32. + // Hit ' then left/right arrow to test. + // FIXME: This is linear instead of log10 scale. + var gain_web_audio = 1.0 + (+attenuation_in_decibels / +32); + if (gain_web_audio < +0) + gain_web_audio = +0; + else if (gain_web_audio > +1) + gain_web_audio = +1; + + gain_node.gain.value = gain_web_audio; }; function update_audio_stream ( - pBuffer, // pointer into emscripten heap. int16 samples - samples_this_frame // int. number of samples at pBuffer address. + pBuffer, // pointer into emscripten heap. int16 samples + samples_this_frame // int. number of samples at pBuffer address. ) { - lazy_init(); - if (!context) return; - - for ( - var i = 0, - l = samples_this_frame | 0; - i < l; - i++ - ) { - var offset = - // divide by sizeof(INT16) since pBuffer is offset - // in bytes - ((pBuffer / 2) | 0) + - ((i * 2) | 0); - - var left_sample = HEAP16[offset]; - var right_sample = HEAP16[(offset + 1) | 0]; - - // normalize from signed int16 to signed float - var left_sample_float = left_sample / sampleScale; - var right_sample_float = right_sample / sampleScale; - - inputBuffer[rear++] = left_sample_float; - inputBuffer[rear++] = right_sample_float; - if (rear == bufferSize) { - rear = 0; - } - if (start == rear) { - start += 2; - if (start == bufferSize) { - start = 0; - } - } - } + lazy_init(); + if (!context) return; + + for ( + var i = 0, + l = samples_this_frame | 0; + i < l; + i++ + ) { + var offset = + // divide by sizeof(INT16) since pBuffer is offset + // in bytes + ((pBuffer / 2) | 0) + + ((i * 2) | 0); + + var left_sample = HEAP16[offset]; + var right_sample = HEAP16[(offset + 1) | 0]; + + // normalize from signed int16 to signed float + var left_sample_float = left_sample / sampleScale; + var right_sample_float = right_sample / sampleScale; + + inputBuffer[rear++] = left_sample_float; + inputBuffer[rear++] = right_sample_float; + if (rear == bufferSize) { + rear = 0; + } + if (start == rear) { + start += 2; + if (start == bufferSize) { + start = 0; + } + } + } }; function tick (event) { - //Find all output channels: - for (var bufferCount = 0, buffers = []; bufferCount < 2; ++bufferCount) { - buffers[bufferCount] = event.outputBuffer.getChannelData(bufferCount); - } - //Copy samples from the input buffer to the Web Audio API: - for (var index = 0; index < 4096 && start != rear; ++index) { - buffers[0][index] = inputBuffer[start++]; - buffers[1][index] = inputBuffer[start++]; - if (start == bufferSize) { - start = 0; - } - } - //Pad with silence if we're underrunning: - while (index < 4096) { - buffers[0][index] = 0; - buffers[1][index++] = 0; - } - //Deep inside the bowels of vendors bugs, - //we're using watchdog for a firefox bug, - //where the user agent decides to stop firing events - //if the user agent lags out due to system load. - //Don't even ask.... - watchDogDateLast = (new Date()).getTime(); + //Find all output channels: + for (var bufferCount = 0, buffers = []; bufferCount < 2; ++bufferCount) { + buffers[bufferCount] = event.outputBuffer.getChannelData(bufferCount); + } + //Copy samples from the input buffer to the Web Audio API: + for (var index = 0; index < 4096 && start != rear; ++index) { + buffers[0][index] = inputBuffer[start++]; + buffers[1][index] = inputBuffer[start++]; + if (start == bufferSize) { + start = 0; + } + } + //Pad with silence if we're underrunning: + while (index < 4096) { + buffers[0][index] = 0; + buffers[1][index++] = 0; + } + //Deep inside the bowels of vendors bugs, + //we're using watchdog for a firefox bug, + //where the user agent decides to stop firing events + //if the user agent lags out due to system load. + //Don't even ask.... + watchDogDateLast = (new Date()).getTime(); } function get_context() { - return context; + return context; }; function sample_count() { - //TODO get someone to call this from the emulator, - //so the emulator can do proper audio buffering by - //knowing how many samples are left: - if (!context) { - //Use impossible value as an error code: - return -1; - } - var count = rear - start; - if (start > rear) { - count += bufferSize; - } - return count; + //TODO get someone to call this from the emulator, + //so the emulator can do proper audio buffering by + //knowing how many samples are left: + if (!context) { + //Use impossible value as an error code: + return -1; + } + var count = rear - start; + if (start > rear) { + count += bufferSize; + } + return count; } return { - set_mastervolume: set_mastervolume, - update_audio_stream: update_audio_stream, - get_context: get_context, - sample_count: sample_count + set_mastervolume: set_mastervolume, + update_audio_stream: update_audio_stream, + get_context: get_context, + sample_count: sample_count }; })(); -- cgit v1.2.3-70-g09d2 From 7f6752bacb0e89ef3c133c4fa0317c55aaea85d5 Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 7 Feb 2016 01:03:23 +0100 Subject: k28: renamed ctteach to k28 and added softwarelist --- hash/k28.xml | 81 ++++++++++++++++++++++++++++++++++++++++++ src/mame/drivers/hh_tms1k.cpp | 2 +- src/mame/drivers/tispeak.cpp | 82 ++++++++++++++++++++++++++----------------- src/mame/layout/ctteach.lay | 26 -------------- src/mame/layout/k28.lay | 26 ++++++++++++++ src/mame/mess.lst | 2 +- 6 files changed, 158 insertions(+), 61 deletions(-) create mode 100644 hash/k28.xml delete mode 100644 src/mame/layout/ctteach.lay create mode 100644 src/mame/layout/k28.lay diff --git a/hash/k28.xml b/hash/k28.xml new file mode 100644 index 00000000000..842c7da0312 --- /dev/null +++ b/hash/k28.xml @@ -0,0 +1,81 @@ + + + + + + + Expansion Module 1 + 1986? + Tiger Electronics + + + + + + + + + + Expansion Module 2 + 1986 + Tiger Electronics + + + + + + + + + + Expansion Module 3 + 1986 + Tiger Electronics + + + + + + + + + + Expansion Module 4 + 1986 + Tiger Electronics + + + + + + + + + + + + Expansion Module 6 + 1987 + Tiger Electronics + + + + + + + + + + diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 208751f7f9d..68e14d4514b 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -74,7 +74,7 @@ *MP7303 TMS1400? 19??, Tiger 7-in-1 Sports Stadium @MP7313 TMS1400 1980, Parker Brothers Bank Shot @MP7314 TMS1400 1980, Parker Brothers Split Second - MP7324 TMS1400 1985, Coleco Talking Teacher -> tispeak.cpp + MP7324 TMS1400 1985, Tiger K28/Coleco Talking Teacher -> tispeak.cpp MP7332 TMS1400 1981, Milton Bradley Dark Tower -> mbdtower.cpp @MP7334 TMS1400 1981, Coleco Total Control 4 @MP7351 TMS1400CR 1982, Parker Brothers Master Merlin diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index 3f51ca6f1eb..0415dce272f 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -353,26 +353,36 @@ Language Tutor modules: Other manufacturers: - Coleco Talking Teacher: +Tiger Electronics K28 (model 7-232) Sold in Hong Kong, distributed in US as: +- Coleco: Talking Teacher +- Sears: Talkatron - Learning Computer + +Earlier K28 models 7-230 and 7-231 are on different hardware, showing a different keyboard, +VFD display, and presumed to use the SC-01 speech chip. + + K28 model 7-232 (HK), 1985 - MCU: TMS1400 MP7324 - TMS51xx: TMS5110A - VSM: 16KB CM62084 - LCD: unknown 8*16-seg - - known releases: - + Coleco: Talking Teacher - + Sears: Talkatron - Learning Computer - + Tiger Electronics(Hong Kong): K-2-8 - An earlier revision used the SC-01 speech chip? - - modules: - - x +K28 modules: + + - Spelling I: VSM: 16KB CM62086 + - Spelling II: VSM: 16KB CM62085? + - Spelling III: VSM: 16KB CM62087 + - Expansion Module 1: VSM: 16KB CM62214? - assumed same VSM as CM62086 + - Expansion Module 2: VSM: 16KB CM62216 - assumed same VSM as the one in Spelling II + - Expansion Module 3: VSM: 16KB CM62215 - same VSM as CM62087 + - Expansion Module 4: VSM: 16KB CM62217 + - Expansion Module 5: VSM: 16KB CM62218* + - Expansion Module 6: VSM: 16KB CM62219 ---------------------------------------------------------------------------- TODO: - why doesn't lantutor work? - - identify and emulate ctteach LCD + - identify and emulate k28 LCD - emulate other known devices @@ -386,7 +396,7 @@ Other manufacturers: #include "softlist.h" // internal artwork -#include "ctteach.lh" +#include "k28.lh" #include "lantutor.lh" #include "snmath.lh" #include "snspell.lh" @@ -431,10 +441,10 @@ public: DECLARE_WRITE16_MEMBER(snspellc_write_r); DECLARE_READ8_MEMBER(tntell_read_k); - void ctteach_prepare_display(UINT8 old, UINT8 data); - DECLARE_READ8_MEMBER(ctteach_read_k); - DECLARE_WRITE16_MEMBER(ctteach_write_o); - DECLARE_WRITE16_MEMBER(ctteach_write_r); + void k28_prepare_display(UINT8 old, UINT8 data); + DECLARE_READ8_MEMBER(k28_read_k); + DECLARE_WRITE16_MEMBER(k28_write_o); + DECLARE_WRITE16_MEMBER(k28_write_r); // cartridge UINT32 m_cart_max_size; @@ -655,15 +665,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::tntell_get_overlay) } -// ctteach specific +// k28 specific -void tispeak_state::ctteach_prepare_display(UINT8 old, UINT8 data) +void tispeak_state::k28_prepare_display(UINT8 old, UINT8 data) { - if (data == old) - return; + // ? } -WRITE16_MEMBER(tispeak_state::ctteach_write_r) +WRITE16_MEMBER(tispeak_state::k28_write_r) { // R1234: TMS5100 CTL8421 m_tms5100->ctl_w(space, 0, BITSWAP8(data,0,0,0,0,1,2,3,4) & 0xf); @@ -679,17 +688,17 @@ WRITE16_MEMBER(tispeak_state::ctteach_write_r) power_off(); // R7-R10: LCD data - ctteach_prepare_display(m_r >> 7 & 0xf, data >> 7 & 0xf); + k28_prepare_display(m_r >> 7 & 0xf, data >> 7 & 0xf); m_r = data; } -WRITE16_MEMBER(tispeak_state::ctteach_write_o) +WRITE16_MEMBER(tispeak_state::k28_write_o) { // O0-O7: input mux low m_inp_mux = (m_inp_mux & ~0xff) | data; } -READ8_MEMBER(tispeak_state::ctteach_read_k) +READ8_MEMBER(tispeak_state::k28_read_k) { // K: TMS5100 CTL, multiplexed inputs return m_tms5100->ctl_r(space, 0) | read_inputs(9); @@ -1096,7 +1105,7 @@ static INPUT_PORTS_START( tntell ) INPUT_PORTS_END -static INPUT_PORTS_START( ctteach ) +static INPUT_PORTS_START( k28 ) PORT_START("IN.0") // O0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") // -> auto_power_off PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('A') PORT_NAME("A/1") @@ -1332,16 +1341,16 @@ static MACHINE_CONFIG_DERIVED( tntell, vocaid ) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( ctteach, tispeak_state ) +static MACHINE_CONFIG_START( k28, tispeak_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1400, MASTER_CLOCK/2) - MCFG_TMS1XXX_READ_K_CB(READ8(tispeak_state, ctteach_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, ctteach_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, ctteach_write_r)) + MCFG_TMS1XXX_READ_K_CB(READ8(tispeak_state, k28_read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, k28_write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, k28_write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_ctteach) + MCFG_DEFAULT_LAYOUT(layout_k28) /* sound hardware */ MCFG_DEVICE_ADD("tms6100", TMS6100, MASTER_CLOCK/4) @@ -1349,6 +1358,13 @@ static MACHINE_CONFIG_START( ctteach, tispeak_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("tms5100", TMS5110A, MASTER_CLOCK) MCFG_FRAGMENT_ADD(tms5110_route) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "k28") + MCFG_GENERIC_EXTENSIONS("vsm") + MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "k28") MACHINE_CONFIG_END @@ -1693,16 +1709,16 @@ ROM_START( vocaid ) ROM_END -ROM_START( ctteach ) +ROM_START( k28 ) ROM_REGION( 0x1000, "maincpu", 0 ) ROM_LOAD( "mp7324", 0x0000, 0x1000, CRC(08d15ab6) SHA1(5b0f6c53e6732a362c4bb25d966d4072fdd33db8) ) ROM_REGION( 867, "maincpu:mpla", 0 ) ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) ROM_REGION( 557, "maincpu:opla", 0 ) - ROM_LOAD( "tms1400_ctteach_output.pla", 0, 557, CRC(3a5c7005) SHA1(3fe5819c138a90e7fc12817415f2622ca81b40b2) ) + ROM_LOAD( "tms1400_k28_output.pla", 0, 557, CRC(3a5c7005) SHA1(3fe5819c138a90e7fc12817415f2622ca81b40b2) ) - ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) + ROM_REGION( 0x10000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge? ROM_LOAD( "cm62084.vsm", 0x0000, 0x4000, CRC(cd1376f7) SHA1(96fa484c392c451599bc083b8376cad9c998df7d) ) ROM_END @@ -1738,4 +1754,4 @@ COMP( 1981, tntellfr, tntell, 0, tntell, tntell, tispeak_state, tn COMP( 1982, vocaid, 0, 0, vocaid, tntell, driver_device, 0, "Texas Instruments", "Vocaid", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) -COMP( 1985, ctteach, 0, 0, ctteach, ctteach, driver_device, 0, "Coleco", "Talking Teacher", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) +COMP( 1985, k28, 0, 0, k28, k28, tispeak_state, snspell, "Tiger Electronics", "K28: Talking Learning Computer (model 7-232)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) diff --git a/src/mame/layout/ctteach.lay b/src/mame/layout/ctteach.lay deleted file mode 100644 index dde1a20e295..00000000000 --- a/src/mame/layout/ctteach.lay +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mame/layout/k28.lay b/src/mame/layout/k28.lay new file mode 100644 index 00000000000..dde1a20e295 --- /dev/null +++ b/src/mame/layout/k28.lay @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 459fae8a81f..d43909d9e41 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2359,7 +2359,7 @@ tntelluk tntellfr tntellp vocaid -ctteach // Coleco +k28 // Tiger Electronics // hh_ucom4 ufombs // Bambino -- cgit v1.2.3-70-g09d2 From b383bebc2d76981f71e0771694286f9471a44c51 Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Sat, 6 Feb 2016 19:20:53 -0500 Subject: hash.xml format fixes (nw) --- hash/casloopy.xml | 2 +- hash/pico.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hash/casloopy.xml b/hash/casloopy.xml index 6573fddaa37..26e36c95a97 100644 --- a/hash/casloopy.xml +++ b/hash/casloopy.xml @@ -91,7 +91,7 @@ 1996 Casio - + diff --git a/hash/pico.xml b/hash/pico.xml index 71ba190c791..08dc5b5ec30 100644 --- a/hash/pico.xml +++ b/hash/pico.xml @@ -1818,7 +1818,7 @@ Published by Others (T-yyy*** serial codes, for yyy depending on the publisher) 1995 Imagineer - + -- cgit v1.2.3-70-g09d2 From 45b5f1e5d2e95e44fa852f7a9598ac253d5af562 Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 7 Feb 2016 02:33:14 +0100 Subject: fidelz80: small update --- src/mame/drivers/fidelz80.cpp | 28 ++++++++++++---------------- src/mame/drivers/tispeak.cpp | 6 +++--- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 7fdf806f635..3ebb4f2919e 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -10,7 +10,7 @@ It sometimes does this on Voice Sensory Chess Challenger real hardware. It can also be heard on Advanced Voice Chess Challenger real hardware, but not the whole line: "I I am Fidelity's chess challenger", instead. - - correctly hook up VBRC speech so that the z80 is halted while words are being spoken + - VBRC card scanner Chess pieces are required, but theoretically blindfold chess is possible. Chessboard artwork is provided for boards with pressure/magnet sensors. @@ -1327,21 +1327,16 @@ ADDRESS_MAP_END WRITE8_MEMBER(fidelz80_state::vbrc_speech_w) { - //printf("%X ",data); - - // todo: HALT THE z80 here, and set up a callback to poll the s14001a BUSY line to resume z80 m_speech->data_w(space, 0, data & 0x3f); m_speech->start_w(1); m_speech->start_w(0); - - //m_speech->start_w(BIT(data, 7)); } static ADDRESS_MAP_START( vbrc_main_map, AS_PROGRAM, 8, fidelz80_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x6000, 0x63ff) AM_MIRROR(0x1c00) AM_RAM - AM_RANGE(0xe000, 0xffff) AM_MIRROR(0x1fff) AM_WRITE(vbrc_speech_w) + AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x1fff) AM_WRITE(vbrc_speech_w) ADDRESS_MAP_END static ADDRESS_MAP_START( vbrc_main_io, AS_IO, 8, fidelz80_state ) @@ -1408,13 +1403,13 @@ static INPUT_PORTS_START( vcc ) PORT_INCLUDE( vcc_base ) PORT_START("IN.4") // PCB jumpers, not consumer accessible - PORT_CONFNAME( 0x01, 0x00, "Language: French" ) + PORT_CONFNAME( 0x01, 0x00, "Language: German" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - PORT_CONFNAME( 0x02, 0x00, "Language: Spanish" ) + PORT_CONFNAME( 0x02, 0x00, "Language: French" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x02, DEF_STR( On ) ) - PORT_CONFNAME( 0x04, 0x00, "Language: German" ) + PORT_CONFNAME( 0x04, 0x00, "Language: Spanish" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x04, DEF_STR( On ) ) PORT_CONFNAME( 0x08, 0x00, "Language: Special" ) @@ -1426,27 +1421,27 @@ static INPUT_PORTS_START( vccfr ) PORT_INCLUDE( vcc ) PORT_MODIFY("IN.4") - PORT_CONFNAME( 0x01, 0x01, "Language: French" ) + PORT_CONFNAME( 0x02, 0x02, "Language: French" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) + PORT_CONFSETTING( 0x02, DEF_STR( On ) ) INPUT_PORTS_END static INPUT_PORTS_START( vccsp ) PORT_INCLUDE( vcc ) PORT_MODIFY("IN.4") - PORT_CONFNAME( 0x02, 0x02, "Language: Spanish" ) + PORT_CONFNAME( 0x04, 0x04, "Language: Spanish" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x02, DEF_STR( On ) ) + PORT_CONFSETTING( 0x04, DEF_STR( On ) ) INPUT_PORTS_END static INPUT_PORTS_START( vccg ) PORT_INCLUDE( vcc ) PORT_MODIFY("IN.4") - PORT_CONFNAME( 0x04, 0x04, "Language: German" ) + PORT_CONFNAME( 0x01, 0x01, "Language: German" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x04, DEF_STR( On ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) INPUT_PORTS_END @@ -1766,6 +1761,7 @@ static MACHINE_CONFIG_START( vbrc, fidelz80_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("speech", S14001A, 25000) // R/C circuit, around 25khz + MCFG_S14001A_BSY_HANDLER(INPUTLINE("maincpu", Z80_INPUT_LINE_WAIT)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) MACHINE_CONFIG_END diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index 0415dce272f..0bfc1888c5c 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -357,8 +357,8 @@ Tiger Electronics K28 (model 7-232) Sold in Hong Kong, distributed in US as: - Coleco: Talking Teacher - Sears: Talkatron - Learning Computer -Earlier K28 models 7-230 and 7-231 are on different hardware, showing a different keyboard, -VFD display, and presumed to use the SC-01 speech chip. +Earlier K28 models 7-230 and 7-231 are on different hardware, showing a different +keyboard, VFD display, and use the SC-01 speech chip. K28 model 7-232 (HK), 1985 - MCU: TMS1400 MP7324 @@ -1718,7 +1718,7 @@ ROM_START( k28 ) ROM_REGION( 557, "maincpu:opla", 0 ) ROM_LOAD( "tms1400_k28_output.pla", 0, 557, CRC(3a5c7005) SHA1(3fe5819c138a90e7fc12817415f2622ca81b40b2) ) - ROM_REGION( 0x10000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge? + ROM_REGION( 0x10000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff? = space reserved for cartridge ROM_LOAD( "cm62084.vsm", 0x0000, 0x4000, CRC(cd1376f7) SHA1(96fa484c392c451599bc083b8376cad9c998df7d) ) ROM_END -- cgit v1.2.3-70-g09d2 From e15dca747c4840bcb039bdbee074f410d622c85a Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Sun, 7 Feb 2016 03:32:47 +0100 Subject: datmenu.cpp: fixed a missed substitution from auto_alloc to global_alloc. --- src/emu/ui/datmenu.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp index 5beb0ff52b5..2f8a8490a9b 100644 --- a/src/emu/ui/datmenu.cpp +++ b/src/emu/ui/datmenu.cpp @@ -68,7 +68,7 @@ void ui_menu_command::handle() if (m_event != nullptr && m_event->iptkey == IPT_UI_SELECT) { std::string m_title(item[selected].text); - ui_menu::stack_push(auto_alloc_clear(machine(), (machine(), container, m_title, m_driver))); + ui_menu::stack_push(global_alloc_clear(machine(), container, m_title, m_driver)); } } @@ -141,11 +141,11 @@ void ui_menu_command_content::populate() machine().pause(); std::string buffer; machine().datfile().load_command_info(buffer, m_title); + float line_height = machine().ui().get_line_height(); + if (!buffer.empty()) { - float line_height = machine().ui().get_line_height(); - float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); - float gutter_width = lr_arrow_width * 1.3f; + float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); std::vector xstart; std::vector xend; int total_lines; @@ -170,7 +170,7 @@ void ui_menu_command_content::populate() } machine().resume(); - customtop = custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = custombottom = line_height + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -287,11 +287,11 @@ void ui_menu_history_sw::populate() machine().pause(); std::string buffer; machine().datfile().load_software_info(m_list, buffer, m_short, m_parent); + float line_height = machine().ui().get_line_height(); + if (!buffer.empty()) { - float line_height = machine().ui().get_line_height(); - float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); - float gutter_width = lr_arrow_width * 1.3f; + float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); std::vector xstart; std::vector xend; int total_lines; @@ -541,8 +541,7 @@ bool ui_menu_dats::get_data(const game_driver *driver, int flags) return false; float line_height = machine().ui().get_line_height(); - float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); - float gutter_width = lr_arrow_width * 1.3f; + float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); std::vector xstart; std::vector xend; int tlines; -- cgit v1.2.3-70-g09d2 From 2fda7e23f2ff096a27b316a2504e6d333c70640e Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Sun, 7 Feb 2016 03:53:47 +0100 Subject: menu: fixed search path for snapshots. (nw) --- src/emu/ui/menu.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index 43e3474f3be..da22c83e126 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -1613,9 +1613,13 @@ void ui_menu::get_title_search(std::string &snaptext, std::string &searchstr) snaptext.assign(arts_info[ui_globals::curimage_view].title); // get search path - path_iterator path(machine().ui().options().value(arts_info[ui_globals::curimage_view].path)); + if (ui_globals::curimage_view == SNAPSHOT_VIEW) + searchstr = machine().options().value(arts_info[ui_globals::curimage_view].path); + else + searchstr = machine().ui().options().value(arts_info[ui_globals::curimage_view].path); + + path_iterator path(searchstr.c_str()); std::string curpath; - searchstr.assign(machine().ui().options().value(arts_info[ui_globals::curimage_view].path)); // iterate over path and add path for zipped formats while (path.next(curpath)) -- cgit v1.2.3-70-g09d2 From 3466c47229c837919539e0d228c524f1d3a07b39 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 7 Feb 2016 01:17:17 -0500 Subject: Renaming (nw) --- src/devices/cpu/vtlb.cpp | 310 ----------------------------------------------- src/devices/cpu/vtlb.h | 88 -------------- src/emu/divtlb.cpp | 310 +++++++++++++++++++++++++++++++++++++++++++++++ src/emu/divtlb.h | 88 ++++++++++++++ 4 files changed, 398 insertions(+), 398 deletions(-) delete mode 100644 src/devices/cpu/vtlb.cpp delete mode 100644 src/devices/cpu/vtlb.h create mode 100644 src/emu/divtlb.cpp create mode 100644 src/emu/divtlb.h diff --git a/src/devices/cpu/vtlb.cpp b/src/devices/cpu/vtlb.cpp deleted file mode 100644 index 4c9a9a2f311..00000000000 --- a/src/devices/cpu/vtlb.cpp +++ /dev/null @@ -1,310 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** - - vtlb.c - - Generic virtual TLB implementation. - -***************************************************************************/ - -#include "emu.h" -#include "vtlb.h" - - - -/*************************************************************************** - DEBUGGING -***************************************************************************/ - -#define PRINTF_TLB (0) - - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -/* VTLB state */ -struct vtlb_state -{ - cpu_device * cpudevice; /* CPU device */ - address_spacenum space; /* address space */ - int dynamic; /* number of dynamic entries */ - int fixed; /* number of fixed entries */ - int dynindex; /* index of next dynamic entry */ - int pageshift; /* bits to shift to get page index */ - int addrwidth; /* logical address bus width */ - std::vector live; /* array of live entries by table index */ - std::vector fixedpages; /* number of pages each fixed entry covers */ - std::vector table; /* table of entries by address */ -}; - - - -/*************************************************************************** - INITIALIZATION/TEARDOWN -***************************************************************************/ - -/*------------------------------------------------- - vtlb_alloc - allocate a new VTLB for the - given CPU --------------------------------------------------*/ - -vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries, int dynamic_entries) -{ - vtlb_state *vtlb; - - /* allocate memory for the core structure */ - vtlb = auto_alloc_clear(cpu->machine(), ()); - - /* fill in CPU information */ - vtlb->cpudevice = downcast(cpu); - vtlb->space = space; - vtlb->dynamic = dynamic_entries; - vtlb->fixed = fixed_entries; - const address_space_config *spaceconfig = device_get_space_config(*cpu, space); - assert(spaceconfig != nullptr); - vtlb->pageshift = spaceconfig->m_page_shift; - vtlb->addrwidth = spaceconfig->m_logaddr_width; - - /* validate CPU information */ - assert((1 << vtlb->pageshift) > VTLB_FLAGS_MASK); - assert(vtlb->addrwidth > vtlb->pageshift); - - /* allocate the entry array */ - vtlb->live.resize(fixed_entries + dynamic_entries); - memset(&vtlb->live[0], 0, vtlb->live.size()*sizeof(vtlb->live[0])); - cpu->save_item(NAME(vtlb->live)); - - /* allocate the lookup table */ - vtlb->table.resize((size_t) 1 << (vtlb->addrwidth - vtlb->pageshift)); - memset(&vtlb->table[0], 0, vtlb->table.size()*sizeof(vtlb->table[0])); - cpu->save_item(NAME(vtlb->table)); - - /* allocate the fixed page count array */ - if (fixed_entries > 0) - { - vtlb->fixedpages.resize(fixed_entries); - memset(&vtlb->fixedpages[0], 0, fixed_entries*sizeof(vtlb->fixedpages[0])); - cpu->save_item(NAME(vtlb->fixedpages)); - } - return vtlb; -} - - -/*------------------------------------------------- - vtlb_free - free an allocated VTLB --------------------------------------------------*/ - -void vtlb_free(vtlb_state *vtlb) -{ - auto_free(vtlb->cpudevice->machine(), vtlb); -} - - - -/*************************************************************************** - FILLING -***************************************************************************/ - -/*------------------------------------------------- - vtlb_fill - rcalled by the CPU core in - response to an unmapped access --------------------------------------------------*/ - -int vtlb_fill(vtlb_state *vtlb, offs_t address, int intention) -{ - offs_t tableindex = address >> vtlb->pageshift; - vtlb_entry entry = vtlb->table[tableindex]; - offs_t taddress; - - if (PRINTF_TLB) - printf("vtlb_fill: %08X(%X) ... ", address, intention); - - /* should not be called here if the entry is in the table already */ -// assert((entry & (1 << intention)) == 0); - - /* if we have no dynamic entries, we always fail */ - if (vtlb->dynamic == 0) - { - if (PRINTF_TLB) - printf("failed: no dynamic entries\n"); - return FALSE; - } - - /* ask the CPU core to translate for us */ - taddress = address; - if (!vtlb->cpudevice->translate(vtlb->space, intention, taddress)) - { - if (PRINTF_TLB) - printf("failed: no translation\n"); - return FALSE; - } - - /* if this is the first successful translation for this address, allocate a new entry */ - if ((entry & VTLB_FLAGS_MASK) == 0) - { - int liveindex = vtlb->dynindex++ % vtlb->dynamic; - - /* if an entry already exists at this index, free it */ - if (vtlb->live[liveindex] != 0) - vtlb->table[vtlb->live[liveindex] - 1] = 0; - - /* claim this new entry */ - vtlb->live[liveindex] = tableindex + 1; - - /* form a new blank entry */ - entry = (taddress >> vtlb->pageshift) << vtlb->pageshift; - entry |= VTLB_FLAG_VALID; - - if (PRINTF_TLB) - printf("success (%08X), new entry\n", taddress); - } - - /* otherwise, ensure that different intentions do not produce different addresses */ - else - { - assert((entry >> vtlb->pageshift) == (taddress >> vtlb->pageshift)); - assert(entry & VTLB_FLAG_VALID); - - if (PRINTF_TLB) - printf("success (%08X), existing entry\n", taddress); - } - - /* add the intention to the list of valid intentions and store */ - entry |= 1 << (intention & (TRANSLATE_TYPE_MASK | TRANSLATE_USER_MASK)); - vtlb->table[tableindex] = entry; - return TRUE; -} - - -/*------------------------------------------------- - vtlb_load - load a fixed VTLB entry --------------------------------------------------*/ - -void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtlb_entry value) -{ - offs_t tableindex = address >> vtlb->pageshift; - int liveindex = vtlb->dynamic + entrynum; - int pagenum; - - /* must be in range */ - assert(entrynum >= 0 && entrynum < vtlb->fixed); - - if (PRINTF_TLB) - printf("vtlb_load %d for %d pages at %08X == %08X\n", entrynum, numpages, address, value); - - /* if an entry already exists at this index, free it */ - if (vtlb->live[liveindex] != 0) - { - int pagecount = vtlb->fixedpages[entrynum]; - int oldtableindex = vtlb->live[liveindex] - 1; - for (pagenum = 0; pagenum < pagecount; pagenum++) - vtlb->table[oldtableindex + pagenum] = 0; - } - - /* claim this new entry */ - vtlb->live[liveindex] = tableindex + 1; - - /* store the raw value, making sure the "fixed" flag is set */ - value |= VTLB_FLAG_FIXED; - vtlb->fixedpages[entrynum] = numpages; - for (pagenum = 0; pagenum < numpages; pagenum++) - vtlb->table[tableindex + pagenum] = value + (pagenum << vtlb->pageshift); -} - -/*------------------------------------------------- - vtlb_dynload - load a dynamic VTLB entry --------------------------------------------------*/ - -void vtlb_dynload(vtlb_state *vtlb, UINT32 index, offs_t address, vtlb_entry value) -{ - vtlb_entry entry = vtlb->table[index]; - - if (vtlb->dynamic == 0) - { - if (PRINTF_TLB) - printf("failed: no dynamic entries\n"); - return; - } - - int liveindex = vtlb->dynindex++ % vtlb->dynamic; - /* is entry already live? */ - if (!(entry & VTLB_FLAG_VALID)) - { - /* if an entry already exists at this index, free it */ - if (vtlb->live[liveindex] != 0) - vtlb->table[vtlb->live[liveindex] - 1] = 0; - - /* claim this new entry */ - vtlb->live[liveindex] = index + 1; - } - /* form a new blank entry */ - entry = (address >> vtlb->pageshift) << vtlb->pageshift; - entry |= VTLB_FLAG_VALID | value; - - if (PRINTF_TLB) - printf("success (%08X), new entry\n", address); - - vtlb->table[index] = entry; -} - -/*************************************************************************** - FLUSHING -***************************************************************************/ - -/*------------------------------------------------- - vtlb_flush_dynamic - flush all knowledge - from the dynamic part of the VTLB --------------------------------------------------*/ - -void vtlb_flush_dynamic(vtlb_state *vtlb) -{ - int liveindex; - - if (PRINTF_TLB) - printf("vtlb_flush_dynamic\n"); - - /* loop over live entries and release them from the table */ - for (liveindex = 0; liveindex < vtlb->dynamic; liveindex++) - if (vtlb->live[liveindex] != 0) - { - offs_t tableindex = vtlb->live[liveindex] - 1; - vtlb->table[tableindex] = 0; - vtlb->live[liveindex] = 0; - } -} - - -/*------------------------------------------------- - vtlb_flush_address - flush knowledge of a - particular address from the VTLB --------------------------------------------------*/ - -void vtlb_flush_address(vtlb_state *vtlb, offs_t address) -{ - offs_t tableindex = address >> vtlb->pageshift; - - if (PRINTF_TLB) - printf("vtlb_flush_address %08X\n", address); - - /* free the entry in the table; for speed, we leave the entry in the live array */ - vtlb->table[tableindex] = 0; -} - - - -/*************************************************************************** - ACCESSORS -***************************************************************************/ - -/*------------------------------------------------- - vtlb_table - return a pointer to the base of - the linear VTLB lookup table --------------------------------------------------*/ - -const vtlb_entry *vtlb_table(vtlb_state *vtlb) -{ - return &vtlb->table[0]; -} diff --git a/src/devices/cpu/vtlb.h b/src/devices/cpu/vtlb.h deleted file mode 100644 index f63a0ac50f6..00000000000 --- a/src/devices/cpu/vtlb.h +++ /dev/null @@ -1,88 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** - - vtlb.h - - Generic virtual TLB implementation. - -***************************************************************************/ - -#pragma once - -#ifndef __VTLB_H__ -#define __VTLB_H__ - - - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define VTLB_FLAGS_MASK 0xff - -#define VTLB_READ_ALLOWED 0x01 /* (1 << TRANSLATE_READ) */ -#define VTLB_WRITE_ALLOWED 0x02 /* (1 << TRANSLATE_WRITE) */ -#define VTLB_FETCH_ALLOWED 0x04 /* (1 << TRANSLATE_FETCH) */ -#define VTLB_FLAG_VALID 0x08 -#define VTLB_USER_READ_ALLOWED 0x10 /* (1 << TRANSLATE_READ_USER) */ -#define VTLB_USER_WRITE_ALLOWED 0x20 /* (1 << TRANSLATE_WRITE_USER) */ -#define VTLB_USER_FETCH_ALLOWED 0x40 /* (1 << TRANSLATE_FETCH_USER) */ -#define VTLB_FLAG_FIXED 0x80 - - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -/* represents an entry in the VTLB */ -typedef UINT32 vtlb_entry; - - -/* opaque structure describing VTLB state */ -struct vtlb_state; - - - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - - -/* ----- initialization/teardown ----- */ - -/* allocate a new VTLB for the given CPU */ -vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries, int dynamic_entries); - -/* free an allocated VTLB */ -void vtlb_free(vtlb_state *vtlb); - - -/* ----- filling ----- */ - -/* called by the CPU core in response to an unmapped access */ -int vtlb_fill(vtlb_state *vtlb, offs_t address, int intention); - -/* load a fixed VTLB entry */ -void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtlb_entry value); - -/* load a dynamic VTLB entry */ -void vtlb_dynload(vtlb_state *vtlb, UINT32 index, offs_t address, vtlb_entry value); - -/* ----- flushing ----- */ - -/* flush all knowledge from the dynamic part of the VTLB */ -void vtlb_flush_dynamic(vtlb_state *vtlb); - -/* flush knowledge of a particular address from the VTLB */ -void vtlb_flush_address(vtlb_state *vtlb, offs_t address); - - -/* ----- accessors ----- */ - -/* return a pointer to the base of the linear VTLB lookup table */ -const vtlb_entry *vtlb_table(vtlb_state *vtlb); - - -#endif /* __VTLB_H__ */ diff --git a/src/emu/divtlb.cpp b/src/emu/divtlb.cpp new file mode 100644 index 00000000000..4c9a9a2f311 --- /dev/null +++ b/src/emu/divtlb.cpp @@ -0,0 +1,310 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles +/*************************************************************************** + + vtlb.c + + Generic virtual TLB implementation. + +***************************************************************************/ + +#include "emu.h" +#include "vtlb.h" + + + +/*************************************************************************** + DEBUGGING +***************************************************************************/ + +#define PRINTF_TLB (0) + + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +/* VTLB state */ +struct vtlb_state +{ + cpu_device * cpudevice; /* CPU device */ + address_spacenum space; /* address space */ + int dynamic; /* number of dynamic entries */ + int fixed; /* number of fixed entries */ + int dynindex; /* index of next dynamic entry */ + int pageshift; /* bits to shift to get page index */ + int addrwidth; /* logical address bus width */ + std::vector live; /* array of live entries by table index */ + std::vector fixedpages; /* number of pages each fixed entry covers */ + std::vector table; /* table of entries by address */ +}; + + + +/*************************************************************************** + INITIALIZATION/TEARDOWN +***************************************************************************/ + +/*------------------------------------------------- + vtlb_alloc - allocate a new VTLB for the + given CPU +-------------------------------------------------*/ + +vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries, int dynamic_entries) +{ + vtlb_state *vtlb; + + /* allocate memory for the core structure */ + vtlb = auto_alloc_clear(cpu->machine(), ()); + + /* fill in CPU information */ + vtlb->cpudevice = downcast(cpu); + vtlb->space = space; + vtlb->dynamic = dynamic_entries; + vtlb->fixed = fixed_entries; + const address_space_config *spaceconfig = device_get_space_config(*cpu, space); + assert(spaceconfig != nullptr); + vtlb->pageshift = spaceconfig->m_page_shift; + vtlb->addrwidth = spaceconfig->m_logaddr_width; + + /* validate CPU information */ + assert((1 << vtlb->pageshift) > VTLB_FLAGS_MASK); + assert(vtlb->addrwidth > vtlb->pageshift); + + /* allocate the entry array */ + vtlb->live.resize(fixed_entries + dynamic_entries); + memset(&vtlb->live[0], 0, vtlb->live.size()*sizeof(vtlb->live[0])); + cpu->save_item(NAME(vtlb->live)); + + /* allocate the lookup table */ + vtlb->table.resize((size_t) 1 << (vtlb->addrwidth - vtlb->pageshift)); + memset(&vtlb->table[0], 0, vtlb->table.size()*sizeof(vtlb->table[0])); + cpu->save_item(NAME(vtlb->table)); + + /* allocate the fixed page count array */ + if (fixed_entries > 0) + { + vtlb->fixedpages.resize(fixed_entries); + memset(&vtlb->fixedpages[0], 0, fixed_entries*sizeof(vtlb->fixedpages[0])); + cpu->save_item(NAME(vtlb->fixedpages)); + } + return vtlb; +} + + +/*------------------------------------------------- + vtlb_free - free an allocated VTLB +-------------------------------------------------*/ + +void vtlb_free(vtlb_state *vtlb) +{ + auto_free(vtlb->cpudevice->machine(), vtlb); +} + + + +/*************************************************************************** + FILLING +***************************************************************************/ + +/*------------------------------------------------- + vtlb_fill - rcalled by the CPU core in + response to an unmapped access +-------------------------------------------------*/ + +int vtlb_fill(vtlb_state *vtlb, offs_t address, int intention) +{ + offs_t tableindex = address >> vtlb->pageshift; + vtlb_entry entry = vtlb->table[tableindex]; + offs_t taddress; + + if (PRINTF_TLB) + printf("vtlb_fill: %08X(%X) ... ", address, intention); + + /* should not be called here if the entry is in the table already */ +// assert((entry & (1 << intention)) == 0); + + /* if we have no dynamic entries, we always fail */ + if (vtlb->dynamic == 0) + { + if (PRINTF_TLB) + printf("failed: no dynamic entries\n"); + return FALSE; + } + + /* ask the CPU core to translate for us */ + taddress = address; + if (!vtlb->cpudevice->translate(vtlb->space, intention, taddress)) + { + if (PRINTF_TLB) + printf("failed: no translation\n"); + return FALSE; + } + + /* if this is the first successful translation for this address, allocate a new entry */ + if ((entry & VTLB_FLAGS_MASK) == 0) + { + int liveindex = vtlb->dynindex++ % vtlb->dynamic; + + /* if an entry already exists at this index, free it */ + if (vtlb->live[liveindex] != 0) + vtlb->table[vtlb->live[liveindex] - 1] = 0; + + /* claim this new entry */ + vtlb->live[liveindex] = tableindex + 1; + + /* form a new blank entry */ + entry = (taddress >> vtlb->pageshift) << vtlb->pageshift; + entry |= VTLB_FLAG_VALID; + + if (PRINTF_TLB) + printf("success (%08X), new entry\n", taddress); + } + + /* otherwise, ensure that different intentions do not produce different addresses */ + else + { + assert((entry >> vtlb->pageshift) == (taddress >> vtlb->pageshift)); + assert(entry & VTLB_FLAG_VALID); + + if (PRINTF_TLB) + printf("success (%08X), existing entry\n", taddress); + } + + /* add the intention to the list of valid intentions and store */ + entry |= 1 << (intention & (TRANSLATE_TYPE_MASK | TRANSLATE_USER_MASK)); + vtlb->table[tableindex] = entry; + return TRUE; +} + + +/*------------------------------------------------- + vtlb_load - load a fixed VTLB entry +-------------------------------------------------*/ + +void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtlb_entry value) +{ + offs_t tableindex = address >> vtlb->pageshift; + int liveindex = vtlb->dynamic + entrynum; + int pagenum; + + /* must be in range */ + assert(entrynum >= 0 && entrynum < vtlb->fixed); + + if (PRINTF_TLB) + printf("vtlb_load %d for %d pages at %08X == %08X\n", entrynum, numpages, address, value); + + /* if an entry already exists at this index, free it */ + if (vtlb->live[liveindex] != 0) + { + int pagecount = vtlb->fixedpages[entrynum]; + int oldtableindex = vtlb->live[liveindex] - 1; + for (pagenum = 0; pagenum < pagecount; pagenum++) + vtlb->table[oldtableindex + pagenum] = 0; + } + + /* claim this new entry */ + vtlb->live[liveindex] = tableindex + 1; + + /* store the raw value, making sure the "fixed" flag is set */ + value |= VTLB_FLAG_FIXED; + vtlb->fixedpages[entrynum] = numpages; + for (pagenum = 0; pagenum < numpages; pagenum++) + vtlb->table[tableindex + pagenum] = value + (pagenum << vtlb->pageshift); +} + +/*------------------------------------------------- + vtlb_dynload - load a dynamic VTLB entry +-------------------------------------------------*/ + +void vtlb_dynload(vtlb_state *vtlb, UINT32 index, offs_t address, vtlb_entry value) +{ + vtlb_entry entry = vtlb->table[index]; + + if (vtlb->dynamic == 0) + { + if (PRINTF_TLB) + printf("failed: no dynamic entries\n"); + return; + } + + int liveindex = vtlb->dynindex++ % vtlb->dynamic; + /* is entry already live? */ + if (!(entry & VTLB_FLAG_VALID)) + { + /* if an entry already exists at this index, free it */ + if (vtlb->live[liveindex] != 0) + vtlb->table[vtlb->live[liveindex] - 1] = 0; + + /* claim this new entry */ + vtlb->live[liveindex] = index + 1; + } + /* form a new blank entry */ + entry = (address >> vtlb->pageshift) << vtlb->pageshift; + entry |= VTLB_FLAG_VALID | value; + + if (PRINTF_TLB) + printf("success (%08X), new entry\n", address); + + vtlb->table[index] = entry; +} + +/*************************************************************************** + FLUSHING +***************************************************************************/ + +/*------------------------------------------------- + vtlb_flush_dynamic - flush all knowledge + from the dynamic part of the VTLB +-------------------------------------------------*/ + +void vtlb_flush_dynamic(vtlb_state *vtlb) +{ + int liveindex; + + if (PRINTF_TLB) + printf("vtlb_flush_dynamic\n"); + + /* loop over live entries and release them from the table */ + for (liveindex = 0; liveindex < vtlb->dynamic; liveindex++) + if (vtlb->live[liveindex] != 0) + { + offs_t tableindex = vtlb->live[liveindex] - 1; + vtlb->table[tableindex] = 0; + vtlb->live[liveindex] = 0; + } +} + + +/*------------------------------------------------- + vtlb_flush_address - flush knowledge of a + particular address from the VTLB +-------------------------------------------------*/ + +void vtlb_flush_address(vtlb_state *vtlb, offs_t address) +{ + offs_t tableindex = address >> vtlb->pageshift; + + if (PRINTF_TLB) + printf("vtlb_flush_address %08X\n", address); + + /* free the entry in the table; for speed, we leave the entry in the live array */ + vtlb->table[tableindex] = 0; +} + + + +/*************************************************************************** + ACCESSORS +***************************************************************************/ + +/*------------------------------------------------- + vtlb_table - return a pointer to the base of + the linear VTLB lookup table +-------------------------------------------------*/ + +const vtlb_entry *vtlb_table(vtlb_state *vtlb) +{ + return &vtlb->table[0]; +} diff --git a/src/emu/divtlb.h b/src/emu/divtlb.h new file mode 100644 index 00000000000..f63a0ac50f6 --- /dev/null +++ b/src/emu/divtlb.h @@ -0,0 +1,88 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles +/*************************************************************************** + + vtlb.h + + Generic virtual TLB implementation. + +***************************************************************************/ + +#pragma once + +#ifndef __VTLB_H__ +#define __VTLB_H__ + + + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define VTLB_FLAGS_MASK 0xff + +#define VTLB_READ_ALLOWED 0x01 /* (1 << TRANSLATE_READ) */ +#define VTLB_WRITE_ALLOWED 0x02 /* (1 << TRANSLATE_WRITE) */ +#define VTLB_FETCH_ALLOWED 0x04 /* (1 << TRANSLATE_FETCH) */ +#define VTLB_FLAG_VALID 0x08 +#define VTLB_USER_READ_ALLOWED 0x10 /* (1 << TRANSLATE_READ_USER) */ +#define VTLB_USER_WRITE_ALLOWED 0x20 /* (1 << TRANSLATE_WRITE_USER) */ +#define VTLB_USER_FETCH_ALLOWED 0x40 /* (1 << TRANSLATE_FETCH_USER) */ +#define VTLB_FLAG_FIXED 0x80 + + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +/* represents an entry in the VTLB */ +typedef UINT32 vtlb_entry; + + +/* opaque structure describing VTLB state */ +struct vtlb_state; + + + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + + +/* ----- initialization/teardown ----- */ + +/* allocate a new VTLB for the given CPU */ +vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries, int dynamic_entries); + +/* free an allocated VTLB */ +void vtlb_free(vtlb_state *vtlb); + + +/* ----- filling ----- */ + +/* called by the CPU core in response to an unmapped access */ +int vtlb_fill(vtlb_state *vtlb, offs_t address, int intention); + +/* load a fixed VTLB entry */ +void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtlb_entry value); + +/* load a dynamic VTLB entry */ +void vtlb_dynload(vtlb_state *vtlb, UINT32 index, offs_t address, vtlb_entry value); + +/* ----- flushing ----- */ + +/* flush all knowledge from the dynamic part of the VTLB */ +void vtlb_flush_dynamic(vtlb_state *vtlb); + +/* flush knowledge of a particular address from the VTLB */ +void vtlb_flush_address(vtlb_state *vtlb, offs_t address); + + +/* ----- accessors ----- */ + +/* return a pointer to the base of the linear VTLB lookup table */ +const vtlb_entry *vtlb_table(vtlb_state *vtlb); + + +#endif /* __VTLB_H__ */ -- cgit v1.2.3-70-g09d2 From 0d8df9d595aa49dd1ce77fa7ecd1db5b286a6f9f Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 7 Feb 2016 01:42:58 -0500 Subject: Make generic VTLB implementation a modern device interface (nw) --- scripts/src/cpu.lua | 9 - scripts/src/emu.lua | 2 + src/devices/cpu/i386/i386.cpp | 61 +++--- src/devices/cpu/i386/i386.h | 8 +- src/devices/cpu/i386/i386ops.inc | 2 +- src/devices/cpu/i386/i386priv.h | 4 +- src/devices/cpu/i386/i486ops.inc | 8 +- src/devices/cpu/mips/mips3.cpp | 67 +++--- src/devices/cpu/mips/mips3.h | 6 +- src/devices/cpu/mips/mips3com.cpp | 12 +- src/devices/cpu/mips/mips3com.h | 1 - src/devices/cpu/mips/mips3drc.cpp | 6 +- src/devices/cpu/powerpc/ppc.h | 7 +- src/devices/cpu/powerpc/ppccom.cpp | 28 ++- src/devices/cpu/powerpc/ppcdrc.cpp | 10 +- src/emu/dimemory.h | 18 -- src/emu/divtlb.cpp | 403 ++++++++++++++++++++----------------- src/emu/divtlb.h | 93 ++++----- 18 files changed, 363 insertions(+), 382 deletions(-) diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua index 0c2882df5e5..ed6378f93f8 100644 --- a/scripts/src/cpu.lua +++ b/scripts/src/cpu.lua @@ -9,14 +9,6 @@ -- --------------------------------------------------------------------------- --------------------------------------------------- --- Shared code --------------------------------------------------- - -files { - MAME_DIR .. "src/devices/cpu/vtlb.cpp", -} - -------------------------------------------------- -- Dynamic recompiler objects -------------------------------------------------- @@ -43,7 +35,6 @@ if (CPUS["SH2"]~=null or CPUS["MIPS"]~=null or CPUS["POWERPC"]~=null or CPUS["RS MAME_DIR .. "src/devices/cpu/drcbex64.cpp", MAME_DIR .. "src/devices/cpu/drcbex64.h", MAME_DIR .. "src/devices/cpu/drcumlsh.h", - MAME_DIR .. "src/devices/cpu/vtlb.h", MAME_DIR .. "src/devices/cpu/x86emit.h", } end diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index b49756676ce..e0358285114 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -117,6 +117,8 @@ files { MAME_DIR .. "src/emu/distate.h", MAME_DIR .. "src/emu/divideo.cpp", MAME_DIR .. "src/emu/divideo.h", + MAME_DIR .. "src/emu/divtlb.cpp", + MAME_DIR .. "src/emu/divtlb.h", MAME_DIR .. "src/emu/drawgfx.cpp", MAME_DIR .. "src/emu/drawgfx.h", MAME_DIR .. "src/emu/drawgfxm.h", diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp index f0d57ada9a0..62a65155a59 100644 --- a/src/devices/cpu/i386/i386.cpp +++ b/src/devices/cpu/i386/i386.cpp @@ -41,23 +41,31 @@ const device_type PENTIUM4 = &device_creator; i386_device::i386_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : cpu_device(mconfig, I386, "I386", tag, owner, clock, "i386", __FILE__) + , device_vtlb_interface(mconfig, *this, AS_PROGRAM) , m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0) , m_io_config("io", ENDIANNESS_LITTLE, 32, 16, 0) , m_smiact(*this) { m_program_config.m_logaddr_width = 32; m_program_config.m_page_shift = 12; + + // 32 unified + set_vtlb_dynamic_entries(32); } i386_device::i386_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, int program_data_width, int program_addr_width, int io_data_width) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) + , device_vtlb_interface(mconfig, *this, AS_PROGRAM) , m_program_config("program", ENDIANNESS_LITTLE, program_data_width, program_addr_width, 0) , m_io_config("io", ENDIANNESS_LITTLE, io_data_width, 16, 0) , m_smiact(*this) { m_program_config.m_logaddr_width = 32; m_program_config.m_page_shift = 12; + + // 32 unified + set_vtlb_dynamic_entries(32); } i386SX_device::i386SX_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) @@ -73,11 +81,15 @@ i486_device::i486_device(const machine_config &mconfig, const char *tag, device_ pentium_device::pentium_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : i386_device(mconfig, PENTIUM, "PENTIUM", tag, owner, clock, "pentium", __FILE__) { + // 64 dtlb small, 8 dtlb large, 32 itlb + set_vtlb_dynamic_entries(96); } pentium_device::pentium_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : i386_device(mconfig, type, name, tag, owner, clock, shortname, source) { + // 64 dtlb small, 8 dtlb large, 32 itlb + set_vtlb_dynamic_entries(96); } mediagx_device::mediagx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) @@ -93,21 +105,29 @@ pentium_pro_device::pentium_pro_device(const machine_config &mconfig, const char pentium_mmx_device::pentium_mmx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : pentium_device(mconfig, PENTIUM_MMX, "Pentium MMX", tag, owner, clock, "pentium_mmx", __FILE__) { + // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large + set_vtlb_dynamic_entries(96); } pentium2_device::pentium2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : pentium_device(mconfig, PENTIUM2, "Pentium II", tag, owner, clock, "pentium2", __FILE__) { + // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large + set_vtlb_dynamic_entries(96); } pentium3_device::pentium3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : pentium_device(mconfig, PENTIUM3, "Pentium III", tag, owner, clock, "pentium3", __FILE__) { + // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large + set_vtlb_dynamic_entries(96); } pentium4_device::pentium4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : pentium_device(mconfig, PENTIUM4, "Pentium 4", tag, owner, clock, "pentium4", __FILE__) { + // 128 dtlb, 64 itlb + set_vtlb_dynamic_entries(196); } @@ -1306,7 +1326,7 @@ void i386_device::i386_task_switch(UINT16 selector, UINT8 nested) } m_cr[3] = READ32(tss+0x1c); // CR3 (PDBR) if(oldcr3 != m_cr[3]) - vtlb_flush_dynamic(m_vtlb); + vtlb_flush_dynamic(); /* Set the busy bit in the new task's descriptor */ if(selector & 0x0004) @@ -3178,7 +3198,7 @@ void i386_device::i386_postload() CHANGE_PC(m_eip); } -void i386_device::i386_common_init(int tlbsize) +void i386_device::i386_common_init() { int i, j; static const int regs8[8] = {AL,CL,DL,BL,AH,CH,DH,BH}; @@ -3211,7 +3231,6 @@ void i386_device::i386_common_init(int tlbsize) m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); m_io = &space(AS_IO); - m_vtlb = vtlb_alloc(this, AS_PROGRAM, 0, tlbsize); m_smi = false; m_debugger_temp = 0; m_lock = false; @@ -3294,7 +3313,7 @@ void i386_device::i386_common_init(int tlbsize) void i386_device::device_start() { - i386_common_init(32); + i386_common_init(); build_opcode_table(OP_I386); m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_I386].get(); @@ -3698,7 +3717,6 @@ void i386_device::zero_state() void i386_device::device_reset() { zero_state(); - vtlb_flush_dynamic(m_vtlb); m_sreg[CS].selector = 0xf000; m_sreg[CS].base = 0xffff0000; @@ -3890,7 +3908,7 @@ void i386_device::i386_set_a20_line(int state) m_a20_mask = ~(1 << 20); } // TODO: how does A20M and the tlb interact - vtlb_flush_dynamic(m_vtlb); + vtlb_flush_dynamic(); } void i386_device::execute_run() @@ -3976,7 +3994,7 @@ offs_t i386_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *opr void i486_device::device_start() { - i386_common_init(32); + i386_common_init(); build_opcode_table(OP_I386 | OP_FPU | OP_I486); build_x87_opcode_table(); @@ -3989,7 +4007,6 @@ void i486_device::device_start() void i486_device::device_reset() { zero_state(); - vtlb_flush_dynamic(m_vtlb); m_sreg[CS].selector = 0xf000; m_sreg[CS].base = 0xffff0000; @@ -4033,8 +4050,7 @@ void i486_device::device_reset() void pentium_device::device_start() { - // 64 dtlb small, 8 dtlb large, 32 itlb - i386_common_init(96); + i386_common_init(); register_state_i386_x87(); build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM); @@ -4046,7 +4062,6 @@ void pentium_device::device_start() void pentium_device::device_reset() { zero_state(); - vtlb_flush_dynamic(m_vtlb); m_sreg[CS].selector = 0xf000; m_sreg[CS].base = 0xffff0000; @@ -4107,8 +4122,7 @@ void pentium_device::device_reset() void mediagx_device::device_start() { - // probably 32 unified - i386_common_init(32); + i386_common_init(); register_state_i386_x87(); build_x87_opcode_table(); @@ -4120,7 +4134,6 @@ void mediagx_device::device_start() void mediagx_device::device_reset() { zero_state(); - vtlb_flush_dynamic(m_vtlb); m_sreg[CS].selector = 0xf000; m_sreg[CS].base = 0xffff0000; @@ -4172,8 +4185,7 @@ void mediagx_device::device_reset() void pentium_pro_device::device_start() { - // 64 dtlb small, 32 itlb - i386_common_init(96); + i386_common_init(); register_state_i386_x87(); build_x87_opcode_table(); @@ -4185,7 +4197,6 @@ void pentium_pro_device::device_start() void pentium_pro_device::device_reset() { zero_state(); - vtlb_flush_dynamic(m_vtlb); m_sreg[CS].selector = 0xf000; m_sreg[CS].base = 0xffff0000; @@ -4247,8 +4258,7 @@ void pentium_pro_device::device_reset() void pentium_mmx_device::device_start() { - // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large - i386_common_init(96); + i386_common_init(); register_state_i386_x87(); build_x87_opcode_table(); @@ -4260,7 +4270,6 @@ void pentium_mmx_device::device_start() void pentium_mmx_device::device_reset() { zero_state(); - vtlb_flush_dynamic(m_vtlb); m_sreg[CS].selector = 0xf000; m_sreg[CS].base = 0xffff0000; @@ -4320,8 +4329,7 @@ void pentium_mmx_device::device_reset() void pentium2_device::device_start() { - // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large - i386_common_init(96); + i386_common_init(); register_state_i386_x87(); build_x87_opcode_table(); @@ -4333,7 +4341,6 @@ void pentium2_device::device_start() void pentium2_device::device_reset() { zero_state(); - vtlb_flush_dynamic(m_vtlb); m_sreg[CS].selector = 0xf000; m_sreg[CS].base = 0xffff0000; @@ -4387,8 +4394,7 @@ void pentium2_device::device_reset() void pentium3_device::device_start() { - // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large - i386_common_init(96); + i386_common_init(); register_state_i386_x87_xmm(); build_x87_opcode_table(); @@ -4400,7 +4406,6 @@ void pentium3_device::device_start() void pentium3_device::device_reset() { zero_state(); - vtlb_flush_dynamic(m_vtlb); m_sreg[CS].selector = 0xf000; m_sreg[CS].base = 0xffff0000; @@ -4456,8 +4461,7 @@ void pentium3_device::device_reset() void pentium4_device::device_start() { - // 128 dtlb, 64 itlb - i386_common_init(196); + i386_common_init(); register_state_i386_x87_xmm(); build_x87_opcode_table(); @@ -4469,7 +4473,6 @@ void pentium4_device::device_start() void pentium4_device::device_reset() { zero_state(); - vtlb_flush_dynamic(m_vtlb); m_sreg[CS].selector = 0xf000; m_sreg[CS].base = 0xffff0000; diff --git a/src/devices/cpu/i386/i386.h b/src/devices/cpu/i386/i386.h index c9ef38b4280..979aaf08f45 100644 --- a/src/devices/cpu/i386/i386.h +++ b/src/devices/cpu/i386/i386.h @@ -8,7 +8,7 @@ #include "softfloat/milieu.h" #include "softfloat/softfloat.h" #include "debug/debugcpu.h" -#include "cpu/vtlb.h" +#include "divtlb.h" #define INPUT_LINE_A20 1 @@ -24,7 +24,7 @@ #define X86_NUM_CPUS 4 -class i386_device : public cpu_device +class i386_device : public cpu_device, public device_vtlb_interface { public: // construction/destruction @@ -270,8 +270,6 @@ struct I386_CALL_GATE UINT8 *m_cycle_table_pm; UINT8 *m_cycle_table_rm; - vtlb_state *m_vtlb; - bool m_smm; bool m_smi; bool m_smi_latched; @@ -1411,7 +1409,7 @@ struct I386_CALL_GATE void build_x87_opcode_table_df(); void build_x87_opcode_table(); void i386_postload(); - void i386_common_init(int tlbsize); + void i386_common_init(); void build_opcode_table(UINT32 features); void pentium_smi(); void zero_state(); diff --git a/src/devices/cpu/i386/i386ops.inc b/src/devices/cpu/i386/i386ops.inc index dc237c98469..ea15f9a5923 100644 --- a/src/devices/cpu/i386/i386ops.inc +++ b/src/devices/cpu/i386/i386ops.inc @@ -701,7 +701,7 @@ void i386_device::i386_mov_cr_r32() // Opcode 0x0f 22 case 2: CYCLES(CYCLES_MOV_REG_CR2); break; case 3: CYCLES(CYCLES_MOV_REG_CR3); - vtlb_flush_dynamic(m_vtlb); + vtlb_flush_dynamic(); break; case 4: CYCLES(1); break; // TODO default: diff --git a/src/devices/cpu/i386/i386priv.h b/src/devices/cpu/i386/i386priv.h index fa7ae0d4945..339e630d1cd 100644 --- a/src/devices/cpu/i386/i386priv.h +++ b/src/devices/cpu/i386/i386priv.h @@ -486,7 +486,7 @@ int i386_device::translate_address(int pl, int type, UINT32 *address, UINT32 *er if(!(m_cr[0] & 0x80000000)) // Some (very few) old OS's won't work with this return TRUE; - const vtlb_entry *table = vtlb_table(m_vtlb); + const vtlb_entry *table = vtlb_table(); UINT32 index = *address >> 12; vtlb_entry entry = table[index]; if(type == TRANSLATE_FETCH) @@ -506,7 +506,7 @@ int i386_device::translate_address(int pl, int type, UINT32 *address, UINT32 *er *error |= 1; return FALSE; } - vtlb_dynload(m_vtlb, index, *address, entry); + vtlb_dynload(index, *address, entry); return TRUE; } if(!(entry & (1 << type))) diff --git a/src/devices/cpu/i386/i486ops.inc b/src/devices/cpu/i386/i486ops.inc index d22f6c079c3..8be406692d4 100644 --- a/src/devices/cpu/i386/i486ops.inc +++ b/src/devices/cpu/i386/i486ops.inc @@ -312,7 +312,7 @@ void i386_device::i486_group0F01_16() // Opcode 0x0f 01 } ea = GetEA(modrm,-1); CYCLES(25); // TODO: add to cycles.h - vtlb_flush_address(m_vtlb, ea); + vtlb_flush_address(ea); break; } default: @@ -430,7 +430,7 @@ void i386_device::i486_group0F01_32() // Opcode 0x0f 01 } ea = GetEA(modrm,-1); CYCLES(25); // TODO: add to cycles.h - vtlb_flush_address(m_vtlb, ea); + vtlb_flush_address(ea); break; } default: @@ -500,12 +500,12 @@ void i386_device::i486_mov_cr_r32() // Opcode 0x0f 22 case 0: CYCLES(CYCLES_MOV_REG_CR0); if((oldcr ^ m_cr[cr]) & 0x80010000) - vtlb_flush_dynamic(m_vtlb); + vtlb_flush_dynamic(); break; case 2: CYCLES(CYCLES_MOV_REG_CR2); break; case 3: CYCLES(CYCLES_MOV_REG_CR3); - vtlb_flush_dynamic(m_vtlb); + vtlb_flush_dynamic(); break; case 4: CYCLES(1); break; // TODO default: diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp index f4747b7304c..711b9c3edf4 100644 --- a/src/devices/cpu/mips/mips3.cpp +++ b/src/devices/cpu/mips/mips3.cpp @@ -120,8 +120,10 @@ const device_type RM7000BE = &device_creator; const device_type RM7000LE = &device_creator; +// VR4300 and VR5432 have 4 fewer PFN bits, and only 32 TLB entries mips3_device::mips3_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, mips3_flavor flavor, endianness_t endianness) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, __FILE__) + , device_vtlb_interface(mconfig, *this, AS_PROGRAM) , m_program_config("program", endianness, 32, 32, 0, 32, MIPS3_MIN_PAGE_SHIFT) , m_flavor(flavor) , m_core(nullptr) @@ -134,7 +136,6 @@ mips3_device::mips3_device(const machine_config &mconfig, device_type type, cons , m_ll_value(0) , m_lld_value(0) , m_badcop_value(0) - , m_tlb_table(nullptr) , m_lwl(endianness == ENDIANNESS_BIG ? &mips3_device::lwl_be : &mips3_device::lwl_le) , m_lwr(endianness == ENDIANNESS_BIG ? &mips3_device::lwr_be : &mips3_device::lwr_le) , m_swl(endianness == ENDIANNESS_BIG ? &mips3_device::swl_be : &mips3_device::swl_le) @@ -144,14 +145,13 @@ mips3_device::mips3_device(const machine_config &mconfig, device_type type, cons , m_sdl(endianness == ENDIANNESS_BIG ? &mips3_device::sdl_be : &mips3_device::sdl_le) , m_sdr(endianness == ENDIANNESS_BIG ? &mips3_device::sdr_be : &mips3_device::sdr_le) , c_system_clock(0) - , m_pfnmask(0) - , m_tlbentries(0) + , m_pfnmask(flavor == MIPS3_TYPE_VR4300 ? 0x000fffff : 0x00ffffff) + , m_tlbentries(flavor == MIPS3_TYPE_VR4300 ? 32 : MIPS3_MAX_TLB_ENTRIES) , m_bigendian(endianness == ENDIANNESS_BIG) , m_byte_xor(m_bigendian ? BYTE4_XOR_BE(0) : BYTE4_XOR_LE(0)) , m_word_xor(m_bigendian ? WORD_XOR_BE(0) : WORD_XOR_LE(0)) , c_icache_size(0) , c_dcache_size(0) - , m_vtlb(nullptr) , m_fastram_select(0) , m_debugger_temp(0) , m_cache(CACHE_SIZE + sizeof(internal_mips3_state)) @@ -190,17 +190,14 @@ mips3_device::mips3_device(const machine_config &mconfig, device_type type, cons } memset(m_fastram, 0, sizeof(m_fastram)); memset(m_hotspot, 0, sizeof(m_hotspot)); + + // configure the virtual TLB + set_vtlb_fixed_entries(2 * m_tlbentries + 2); } void mips3_device::device_stop() { - if (m_vtlb != nullptr) - { - vtlb_free(m_vtlb); - m_vtlb = nullptr; - } - if (m_drcfe != nullptr) { m_drcfe = nullptr; @@ -331,28 +328,12 @@ void mips3_device::device_start() m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); - /* configure flavor-specific parameters */ - m_pfnmask = 0x00ffffff; - m_tlbentries = MIPS3_MAX_TLB_ENTRIES; - - /* VR4300 and VR5432 have 4 fewer PFN bits, and only 32 TLB entries */ - if (m_flavor == MIPS3_TYPE_VR4300) - { - m_pfnmask = 0x000fffff; - m_tlbentries = 32; - } - /* set up the endianness */ m_program->accessors(m_memory); - /* allocate the virtual TLB */ - m_vtlb = vtlb_alloc(this, AS_PROGRAM, 2 * m_tlbentries + 2, 0); - /* allocate a timer for the compare interrupt */ m_compare_int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mips3_device::compare_int_callback), this)); - m_tlb_table = vtlb_table(m_vtlb); - UINT32 flags = 0; /* initialize the UML generator */ m_drcuml = std::make_unique(*this, m_cache, flags, 8, 32, 2); @@ -950,13 +931,13 @@ void mips3_device::device_reset() entry->entry_hi = 0xffffffff; entry->entry_lo[0] = 0xfffffff8; entry->entry_lo[1] = 0xfffffff8; - vtlb_load(m_vtlb, 2 * tlbindex + 0, 0, 0, 0); - vtlb_load(m_vtlb, 2 * tlbindex + 1, 0, 0, 0); + vtlb_load(2 * tlbindex + 0, 0, 0, 0); + vtlb_load(2 * tlbindex + 1, 0, 0, 0); } /* load the fixed TLB range */ - vtlb_load(m_vtlb, 2 * m_tlbentries + 0, (0xa0000000 - 0x80000000) >> MIPS3_MIN_PAGE_SHIFT, 0x80000000, 0x00000000 | VTLB_READ_ALLOWED | VTLB_WRITE_ALLOWED | VTLB_FETCH_ALLOWED | VTLB_FLAG_VALID); - vtlb_load(m_vtlb, 2 * m_tlbentries + 1, (0xc0000000 - 0xa0000000) >> MIPS3_MIN_PAGE_SHIFT, 0xa0000000, 0x00000000 | VTLB_READ_ALLOWED | VTLB_WRITE_ALLOWED | VTLB_FETCH_ALLOWED | VTLB_FLAG_VALID); + vtlb_load(2 * m_tlbentries + 0, (0xa0000000 - 0x80000000) >> MIPS3_MIN_PAGE_SHIFT, 0x80000000, 0x00000000 | VTLB_READ_ALLOWED | VTLB_WRITE_ALLOWED | VTLB_FETCH_ALLOWED | VTLB_FLAG_VALID); + vtlb_load(2 * m_tlbentries + 1, (0xc0000000 - 0xa0000000) >> MIPS3_MIN_PAGE_SHIFT, 0xa0000000, 0x00000000 | VTLB_READ_ALLOWED | VTLB_WRITE_ALLOWED | VTLB_FETCH_ALLOWED | VTLB_FLAG_VALID); m_core->mode = (MODE_KERNEL << 1) | 0; m_cache_dirty = TRUE; @@ -969,7 +950,7 @@ bool mips3_device::memory_translate(address_spacenum spacenum, int intention, of /* only applies to the program address space */ if (spacenum == AS_PROGRAM) { - const vtlb_entry *table = vtlb_table(m_vtlb); + const vtlb_entry *table = vtlb_table(); vtlb_entry entry = table[address >> MIPS3_MIN_PAGE_SHIFT]; if ((entry & (1 << (intention & (TRANSLATE_TYPE_MASK | TRANSLATE_USER_MASK)))) == 0) return false; @@ -998,7 +979,7 @@ offs_t mips3_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *op inline bool mips3_device::RBYTE(offs_t address, UINT32 *result) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_READ_ALLOWED) { const UINT32 tlbaddress = (tlbval & ~0xfff) | (address & 0xfff); @@ -1031,7 +1012,7 @@ inline bool mips3_device::RBYTE(offs_t address, UINT32 *result) inline bool mips3_device::RHALF(offs_t address, UINT32 *result) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_READ_ALLOWED) { const UINT32 tlbaddress = (tlbval & ~0xfff) | (address & 0xfff); @@ -1064,7 +1045,7 @@ inline bool mips3_device::RHALF(offs_t address, UINT32 *result) inline bool mips3_device::RWORD(offs_t address, UINT32 *result) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_READ_ALLOWED) { const UINT32 tlbaddress = (tlbval & ~0xfff) | (address & 0xfff); @@ -1097,7 +1078,7 @@ inline bool mips3_device::RWORD(offs_t address, UINT32 *result) inline bool mips3_device::RWORD_MASKED(offs_t address, UINT32 *result, UINT32 mem_mask) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_READ_ALLOWED) { *result = (*m_memory.read_dword_masked)(*m_program, (tlbval & ~0xfff) | (address & 0xfff), mem_mask); @@ -1120,7 +1101,7 @@ inline bool mips3_device::RWORD_MASKED(offs_t address, UINT32 *result, UINT32 me inline bool mips3_device::RDOUBLE(offs_t address, UINT64 *result) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_READ_ALLOWED) { *result = (*m_memory.read_qword)(*m_program, (tlbval & ~0xfff) | (address & 0xfff)); @@ -1143,7 +1124,7 @@ inline bool mips3_device::RDOUBLE(offs_t address, UINT64 *result) inline bool mips3_device::RDOUBLE_MASKED(offs_t address, UINT64 *result, UINT64 mem_mask) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_READ_ALLOWED) { *result = (*m_memory.read_qword_masked)(*m_program, (tlbval & ~0xfff) | (address & 0xfff), mem_mask); @@ -1166,7 +1147,7 @@ inline bool mips3_device::RDOUBLE_MASKED(offs_t address, UINT64 *result, UINT64 inline void mips3_device::WBYTE(offs_t address, UINT8 data) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_WRITE_ALLOWED) { const UINT32 tlbaddress = (tlbval & ~0xfff) | (address & 0xfff); @@ -1200,7 +1181,7 @@ inline void mips3_device::WBYTE(offs_t address, UINT8 data) inline void mips3_device::WHALF(offs_t address, UINT16 data) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_WRITE_ALLOWED) { const UINT32 tlbaddress = (tlbval & ~0xfff) | (address & 0xfff); @@ -1234,7 +1215,7 @@ inline void mips3_device::WHALF(offs_t address, UINT16 data) inline void mips3_device::WWORD(offs_t address, UINT32 data) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_WRITE_ALLOWED) { const UINT32 tlbaddress = (tlbval & ~0xfff) | (address & 0xfff); @@ -1268,7 +1249,7 @@ inline void mips3_device::WWORD(offs_t address, UINT32 data) inline void mips3_device::WWORD_MASKED(offs_t address, UINT32 data, UINT32 mem_mask) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_WRITE_ALLOWED) { (*m_memory.write_dword_masked)(*m_program, (tlbval & ~0xfff) | (address & 0xfff), data, mem_mask); @@ -1292,7 +1273,7 @@ inline void mips3_device::WWORD_MASKED(offs_t address, UINT32 data, UINT32 mem_m inline void mips3_device::WDOUBLE(offs_t address, UINT64 data) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_WRITE_ALLOWED) { (*m_memory.write_qword)(*m_program, (tlbval & ~0xfff) | (address & 0xfff), data); @@ -1316,7 +1297,7 @@ inline void mips3_device::WDOUBLE(offs_t address, UINT64 data) inline void mips3_device::WDOUBLE_MASKED(offs_t address, UINT64 data, UINT64 mem_mask) { - const UINT32 tlbval = m_tlb_table[address >> 12]; + const UINT32 tlbval = vtlb_table()[address >> 12]; if (tlbval & VTLB_WRITE_ALLOWED) { (*m_memory.write_qword_masked)(*m_program, (tlbval & ~0xfff) | (address & 0xfff), data, mem_mask); diff --git a/src/devices/cpu/mips/mips3.h b/src/devices/cpu/mips/mips3.h index 9e0de9ed419..1715861bb89 100644 --- a/src/devices/cpu/mips/mips3.h +++ b/src/devices/cpu/mips/mips3.h @@ -15,7 +15,7 @@ #define __MIPS3_H__ -#include "cpu/vtlb.h" +#include "divtlb.h" #include "cpu/drcfe.h" #include "cpu/drcuml.h" #include "cpu/drcumlsh.h" @@ -245,7 +245,7 @@ struct compiler_state class mips3_frontend; -class mips3_device : public cpu_device +class mips3_device : public cpu_device, public device_vtlb_interface { friend class mips3_frontend; @@ -355,7 +355,6 @@ private: UINT32 m_ll_value; UINT64 m_lld_value; UINT32 m_badcop_value; - const vtlb_entry *m_tlb_table; /* endian-dependent load/store */ typedef void (mips3_device::*loadstore_func)(UINT32 op); @@ -389,7 +388,6 @@ private: size_t c_dcache_size; /* MMU */ - vtlb_state * m_vtlb; mips3_tlb_entry m_tlb[MIPS3_MAX_TLB_ENTRIES]; /* fast RAM */ diff --git a/src/devices/cpu/mips/mips3com.cpp b/src/devices/cpu/mips/mips3com.cpp index bcd6f6f349a..2fcf8de1844 100644 --- a/src/devices/cpu/mips/mips3com.cpp +++ b/src/devices/cpu/mips/mips3com.cpp @@ -325,8 +325,8 @@ void mips3_device::tlb_map_entry(int tlbindex) /* the ASID doesn't match the current ASID, and if the page isn't global, unmap it from the TLB */ if (!tlb_entry_matches_asid(entry, current_asid) && !tlb_entry_is_global(entry)) { - vtlb_load(m_vtlb, 2 * tlbindex + 0, 0, 0, 0); - vtlb_load(m_vtlb, 2 * tlbindex + 1, 0, 0, 0); + vtlb_load(2 * tlbindex + 0, 0, 0, 0); + vtlb_load(2 * tlbindex + 1, 0, 0, 0); return; } @@ -334,8 +334,8 @@ void mips3_device::tlb_map_entry(int tlbindex) vpn = ((entry->entry_hi >> 13) & 0x07ffffff) << 1; if (vpn >= (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT))) { - vtlb_load(m_vtlb, 2 * tlbindex + 0, 0, 0, 0); - vtlb_load(m_vtlb, 2 * tlbindex + 1, 0, 0, 0); + vtlb_load(2 * tlbindex + 0, 0, 0, 0); + vtlb_load(2 * tlbindex + 1, 0, 0, 0); return; } @@ -369,9 +369,9 @@ void mips3_device::tlb_map_entry(int tlbindex) /* load the virtual TLB with the corresponding entries */ if ((effvpn + count) <= (0x80000000 >> MIPS3_MIN_PAGE_SHIFT) || effvpn >= (0xc0000000 >> MIPS3_MIN_PAGE_SHIFT)) - vtlb_load(m_vtlb, 2 * tlbindex + which, count, effvpn << MIPS3_MIN_PAGE_SHIFT, (pfn << MIPS3_MIN_PAGE_SHIFT) | flags); + vtlb_load(2 * tlbindex + which, count, effvpn << MIPS3_MIN_PAGE_SHIFT, (pfn << MIPS3_MIN_PAGE_SHIFT) | flags); else - vtlb_load(m_vtlb, 2 * tlbindex + which, 0, 0, 0); + vtlb_load(2 * tlbindex + which, 0, 0, 0); } } diff --git a/src/devices/cpu/mips/mips3com.h b/src/devices/cpu/mips/mips3com.h index 86d7f0c7a05..20facae78d0 100644 --- a/src/devices/cpu/mips/mips3com.h +++ b/src/devices/cpu/mips/mips3com.h @@ -14,7 +14,6 @@ #define __MIPS3COM_H__ #include "mips3.h" -#include "cpu/vtlb.h" /*************************************************************************** diff --git a/src/devices/cpu/mips/mips3drc.cpp b/src/devices/cpu/mips/mips3drc.cpp index 4e6e9771a38..7b6da3a1626 100644 --- a/src/devices/cpu/mips/mips3drc.cpp +++ b/src/devices/cpu/mips/mips3drc.cpp @@ -667,7 +667,7 @@ void mips3_device::static_generate_tlb_mismatch() UML_RECOVER(block, I0, MAPVAR_PC); // recover i0,PC UML_MOV(block, mem(&m_core->pc), I0); // mov ,i0 UML_SHR(block, I1, I0, 12); // shr i1,i0,12 - UML_LOAD(block, I1, (void *)vtlb_table(m_vtlb), I1, SIZE_DWORD, SCALE_x4);// load i1,[vtlb_table],i1,dword + UML_LOAD(block, I1, (void *)vtlb_table(), I1, SIZE_DWORD, SCALE_x4);// load i1,[vtlb_table],i1,dword if (PRINTF_MMU) { static const char text[] = "TLB mismatch @ %08X (ent=%08X)\n"; @@ -839,7 +839,7 @@ void mips3_device::static_generate_memory_accessor(int mode, int size, int iswri /* general case: assume paging and perform a translation */ UML_SHR(block, I3, I0, 12); // shr i3,i0,12 - UML_LOAD(block, I3, (void *)vtlb_table(m_vtlb), I3, SIZE_DWORD, SCALE_x4);// load i3,[vtlb_table],i3,dword + UML_LOAD(block, I3, (void *)vtlb_table(), I3, SIZE_DWORD, SCALE_x4);// load i3,[vtlb_table],i3,dword UML_TEST(block, I3, iswrite ? VTLB_WRITE_ALLOWED : VTLB_READ_ALLOWED);// test i3,iswrite ? VTLB_WRITE_ALLOWED : VTLB_READ_ALLOWED UML_JMPc(block, COND_Z, tlbmiss = label++); // jmp tlbmiss,z UML_ROLINS(block, I0, I3, 0, 0xfffff000); // rolins i0,i3,0,0xfffff000 @@ -1226,7 +1226,7 @@ void mips3_device::generate_sequence_instruction(drcuml_block *block, compiler_s /* validate our TLB entry at this PC; if we fail, we need to handle it */ if ((desc->flags & OPFLAG_VALIDATE_TLB) && (desc->pc < 0x80000000 || desc->pc >= 0xc0000000)) { - const vtlb_entry *tlbtable = vtlb_table(m_vtlb); + const vtlb_entry *tlbtable = vtlb_table(); /* if we currently have a valid TLB read entry, we just verify */ if (tlbtable[desc->pc >> 12] & VTLB_FETCH_ALLOWED) diff --git a/src/devices/cpu/powerpc/ppc.h b/src/devices/cpu/powerpc/ppc.h index 5e40ee88249..450b4ca2257 100644 --- a/src/devices/cpu/powerpc/ppc.h +++ b/src/devices/cpu/powerpc/ppc.h @@ -14,7 +14,7 @@ #ifndef __PPC_H__ #define __PPC_H__ -#include "cpu/vtlb.h" +#include "divtlb.h" #include "cpu/drcfe.h" #include "cpu/drcuml.h" #include "cpu/drcumlsh.h" @@ -171,7 +171,7 @@ enum class ppc_frontend; -class ppc_device : public cpu_device +class ppc_device : public cpu_device, public device_vtlb_interface { friend class ppc_frontend; @@ -462,9 +462,6 @@ protected: UINT32 m_sebr; UINT32 m_ser; - /* MMU */ - vtlb_state *m_vtlb; - /* architectural distinctions */ powerpc_flavor m_flavor; UINT32 m_cap; diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp index 9036ff2c794..a9a26b29a5c 100644 --- a/src/devices/cpu/powerpc/ppccom.cpp +++ b/src/devices/cpu/powerpc/ppccom.cpp @@ -209,11 +209,11 @@ const device_type PPC405GP = &device_creator; ppc_device::ppc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, int address_bits, int data_bits, powerpc_flavor flavor, UINT32 cap, UINT32 tb_divisor, address_map_constructor internal_map) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, __FILE__) + , device_vtlb_interface(mconfig, *this, AS_PROGRAM) , m_program_config("program", ENDIANNESS_BIG, data_bits, address_bits, 0, internal_map) , c_bus_frequency(0) , m_core(nullptr) , m_bus_freq_multiplier(1) - , m_vtlb(nullptr) , m_flavor(flavor) , m_cap(cap) , m_tb_divisor(tb_divisor) @@ -224,6 +224,11 @@ ppc_device::ppc_device(const machine_config &mconfig, device_type type, const ch { m_program_config.m_logaddr_width = 32; m_program_config.m_page_shift = POWERPC_MIN_PAGE_SHIFT; + + // configure the virtual TLB + set_vtlb_dynamic_entries(POWERPC_TLB_ENTRIES); + if (m_cap & PPCCAP_603_MMU) + set_vtlb_fixed_entries(PPC603_FIXED_TLB_ENTRIES); } //ppc403_device::ppc403_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) @@ -708,9 +713,6 @@ void ppc_device::device_start() if (!(m_cap & PPCCAP_4XX) && space_config()->m_endianness != ENDIANNESS_NATIVE) m_codexor = 4; - /* allocate the virtual TLB */ - m_vtlb = vtlb_alloc(this, AS_PROGRAM, (m_cap & PPCCAP_603_MMU) ? PPC603_FIXED_TLB_ENTRIES : 0, POWERPC_TLB_ENTRIES); - /* allocate a timer for the compare interrupt */ if ((m_cap & PPCCAP_OEA) && (m_tb_divisor)) m_decrementer_int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ppc_device::decrementer_int_callback), this)); @@ -1148,9 +1150,6 @@ void ppc_device::state_string_export(const device_state_entry &entry, std::strin void ppc_device::device_stop() { - if (m_vtlb != nullptr) - vtlb_free(m_vtlb); - m_vtlb = nullptr; } @@ -1199,12 +1198,11 @@ void ppc_device::device_reset() m_core->irq_pending = 0; /* flush the TLB */ - vtlb_flush_dynamic(m_vtlb); if (m_cap & PPCCAP_603_MMU) { for (int tlbindex = 0; tlbindex < PPC603_FIXED_TLB_ENTRIES; tlbindex++) { - vtlb_load(m_vtlb, tlbindex, 0, 0, 0); + vtlb_load(tlbindex, 0, 0, 0); } } @@ -1385,7 +1383,7 @@ UINT32 ppc_device::ppccom_translate_address_internal(int intention, offs_t &addr /* if we're simulating the 603 MMU, fill in the data and stop here */ if (m_cap & PPCCAP_603_MMU) { - UINT32 entry = vtlb_table(m_vtlb)[address >> 12]; + UINT32 entry = vtlb_table()[address >> 12]; m_core->mmu603_cmp = 0x80000000 | ((segreg & 0xffffff) << 7) | (0 << 6) | ((address >> 22) & 0x3f); m_core->mmu603_hash[0] = hashbase | ((hash << 6) & hashmask); m_core->mmu603_hash[1] = hashbase | ((~hash << 6) & hashmask); @@ -1465,7 +1463,7 @@ bool ppc_device::memory_translate(address_spacenum spacenum, int intention, offs void ppc_device::ppccom_tlb_fill() { - vtlb_fill(m_vtlb, m_core->param0, m_core->param1); + vtlb_fill(m_core->param0, m_core->param1); } @@ -1476,7 +1474,7 @@ void ppc_device::ppccom_tlb_fill() void ppc_device::ppccom_tlb_flush() { - vtlb_flush_dynamic(m_vtlb); + vtlb_flush_dynamic(); } @@ -1492,7 +1490,7 @@ void ppc_device::ppccom_tlb_flush() void ppc_device::ppccom_execute_tlbie() { - vtlb_flush_address(m_vtlb, m_core->param0); + vtlb_flush_address(m_core->param0); } @@ -1503,7 +1501,7 @@ void ppc_device::ppccom_execute_tlbie() void ppc_device::ppccom_execute_tlbia() { - vtlb_flush_dynamic(m_vtlb); + vtlb_flush_dynamic(); } @@ -1530,7 +1528,7 @@ void ppc_device::ppccom_execute_tlbl() flags |= VTLB_FETCH_ALLOWED; /* load the entry */ - vtlb_load(m_vtlb, entrynum, 1, address, (m_core->spr[SPR603_RPA] & 0xfffff000) | flags); + vtlb_load(entrynum, 1, address, (m_core->spr[SPR603_RPA] & 0xfffff000) | flags); } diff --git a/src/devices/cpu/powerpc/ppcdrc.cpp b/src/devices/cpu/powerpc/ppcdrc.cpp index ed502d344de..35b984d240d 100644 --- a/src/devices/cpu/powerpc/ppcdrc.cpp +++ b/src/devices/cpu/powerpc/ppcdrc.cpp @@ -743,11 +743,11 @@ void ppc_device::static_generate_tlb_mismatch() UML_HANDLE(block, *m_tlb_mismatch); // handle tlb_mismatch UML_RECOVER(block, I0, MAPVAR_PC); // recover i0,PC UML_SHR(block, I1, I0, 12); // shr i1,i0,12 - UML_LOAD(block, I2, (void *)vtlb_table(m_vtlb), I1, SIZE_DWORD, SCALE_x4); // load i2,[vtlb],i1,dword + UML_LOAD(block, I2, (void *)vtlb_table(), I1, SIZE_DWORD, SCALE_x4); // load i2,[vtlb],i1,dword UML_MOV(block, mem(&m_core->param0), I0); // mov [param0],i0 UML_MOV(block, mem(&m_core->param1), TRANSLATE_FETCH); // mov [param1],TRANSLATE_FETCH UML_CALLC(block, (c_function)cfunc_ppccom_tlb_fill, this); // callc tlbfill,ppc - UML_LOAD(block, I1, (void *)vtlb_table(m_vtlb), I1, SIZE_DWORD, SCALE_x4); // load i1,[vtlb],i1,dword + UML_LOAD(block, I1, (void *)vtlb_table(), I1, SIZE_DWORD, SCALE_x4); // load i1,[vtlb],i1,dword UML_TEST(block, I1, VTLB_FETCH_ALLOWED); // test i1,VTLB_FETCH_ALLOWED UML_JMPc(block, COND_Z, isi = label++); // jmp isi,z UML_CMP(block, I2, 0); // cmp i2,0 @@ -1021,7 +1021,7 @@ void ppc_device::static_generate_memory_accessor(int mode, int size, int iswrite if (((m_cap & PPCCAP_OEA) && (mode & MODE_DATA_TRANSLATION)) || (iswrite && (m_cap & PPCCAP_4XX) && (mode & MODE_PROTECTION))) { UML_SHR(block, I3, I0, 12); // shr i3,i0,12 - UML_LOAD(block, I3, (void *)vtlb_table(m_vtlb), I3, SIZE_DWORD, SCALE_x4);// load i3,[vtlb],i3,dword + UML_LOAD(block, I3, (void *)vtlb_table(), I3, SIZE_DWORD, SCALE_x4);// load i3,[vtlb],i3,dword UML_TEST(block, I3, (UINT64)1 << translate_type); // test i3,1 << translate_type UML_JMPc(block, COND_Z, tlbmiss = label++); // jmp tlbmiss,z UML_LABEL(block, tlbreturn = label++); // tlbreturn: @@ -1338,7 +1338,7 @@ void ppc_device::static_generate_memory_accessor(int mode, int size, int iswrite UML_MOV(block, mem(&m_core->param1), translate_type); // mov [param1],translate_type UML_CALLC(block, (c_function)cfunc_ppccom_tlb_fill, this); // callc tlbfill,ppc UML_SHR(block, I3, I0, 12); // shr i3,i0,12 - UML_LOAD(block, I3, (void *)vtlb_table(m_vtlb), I3, SIZE_DWORD, SCALE_x4);// load i3,[vtlb],i3,dword + UML_LOAD(block, I3, (void *)vtlb_table(), I3, SIZE_DWORD, SCALE_x4);// load i3,[vtlb],i3,dword UML_TEST(block, I3, (UINT64)1 << translate_type); // test i3,1 << translate_type UML_JMPc(block, COND_NZ, tlbreturn); // jmp tlbreturn,nz @@ -1703,7 +1703,7 @@ void ppc_device::generate_sequence_instruction(drcuml_block *block, compiler_sta /* validate our TLB entry at this PC; if we fail, we need to handle it */ if ((desc->flags & OPFLAG_VALIDATE_TLB) && (m_core->mode & MODE_DATA_TRANSLATION)) { - const vtlb_entry *tlbtable = vtlb_table(m_vtlb); + const vtlb_entry *tlbtable = vtlb_table(); /* if we currently have a valid TLB read entry, we just verify */ if (tlbtable[desc->pc >> 12] != 0) diff --git a/src/emu/dimemory.h b/src/emu/dimemory.h index 66561b5a5cf..0998fd4ae9a 100644 --- a/src/emu/dimemory.h +++ b/src/emu/dimemory.h @@ -131,22 +131,4 @@ typedef device_interface_iterator memory_interface_iter -//************************************************************************** -// INLINE HELPERS -//************************************************************************** - -//------------------------------------------------- -// device_get_space_config - return a pointer -// to sthe given address space's configuration -//------------------------------------------------- - -inline const address_space_config *device_get_space_config(const device_t &device, address_spacenum spacenum = AS_0) -{ - const device_memory_interface *intf; - if (!device.interface(intf)) - throw emu_fatalerror("Device '%s' does not have memory interface", device.tag()); - return intf->space_config(spacenum); -} - - #endif /* __DIMEMORY_H__ */ diff --git a/src/emu/divtlb.cpp b/src/emu/divtlb.cpp index 4c9a9a2f311..01be30919cb 100644 --- a/src/emu/divtlb.cpp +++ b/src/emu/divtlb.cpp @@ -2,309 +2,340 @@ // copyright-holders:Aaron Giles /*************************************************************************** - vtlb.c + divtlb.c - Generic virtual TLB implementation. + Device generic virtual TLB interface. ***************************************************************************/ #include "emu.h" -#include "vtlb.h" +#include "divtlb.h" +#include "validity.h" -/*************************************************************************** - DEBUGGING -***************************************************************************/ +//************************************************************************** +// DEBUGGING +//************************************************************************** #define PRINTF_TLB (0) -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ +//************************************************************************** +// DEVICE VTLB INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_vtlb_interface - constructor +//------------------------------------------------- -/* VTLB state */ -struct vtlb_state +device_vtlb_interface::device_vtlb_interface(const machine_config &mconfig, device_t &device, address_spacenum space) + : device_interface(device, "vtlb"), + m_space(space), + m_dynamic(0), + m_fixed(0), + m_dynindex(0), + m_pageshift(0), + m_addrwidth(0) { - cpu_device * cpudevice; /* CPU device */ - address_spacenum space; /* address space */ - int dynamic; /* number of dynamic entries */ - int fixed; /* number of fixed entries */ - int dynindex; /* index of next dynamic entry */ - int pageshift; /* bits to shift to get page index */ - int addrwidth; /* logical address bus width */ - std::vector live; /* array of live entries by table index */ - std::vector fixedpages; /* number of pages each fixed entry covers */ - std::vector table; /* table of entries by address */ -}; +} +//------------------------------------------------- +// device_vtlb_interface - destructor +//------------------------------------------------- + +device_vtlb_interface::~device_vtlb_interface() +{ +} + + +//------------------------------------------------- +// interface_validity_check - validation for a +// device after the configuration has been +// constructed +//------------------------------------------------- + +void device_vtlb_interface::interface_validity_check(validity_checker &valid) const +{ + const device_memory_interface *intf; + if (!device().interface(intf)) + osd_printf_error("Device does not have memory interface\n"); + else + { + // validate CPU information + const address_space_config *spaceconfig = intf->space_config(m_space); + if (spaceconfig == nullptr) + osd_printf_error("No memory address space configuration found for space %d\n", m_space); + else if ((1 << spaceconfig->m_page_shift) <= VTLB_FLAGS_MASK || spaceconfig->m_logaddr_width <= spaceconfig->m_page_shift) + osd_printf_error("Invalid page shift %d for VTLB\n", spaceconfig->m_page_shift); + } +} -/*************************************************************************** - INITIALIZATION/TEARDOWN -***************************************************************************/ -/*------------------------------------------------- - vtlb_alloc - allocate a new VTLB for the - given CPU --------------------------------------------------*/ +//------------------------------------------------- +// interface_pre_start - work to be done prior to +// actually starting a device +//------------------------------------------------- -vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries, int dynamic_entries) +void device_vtlb_interface::interface_pre_start() { - vtlb_state *vtlb; - - /* allocate memory for the core structure */ - vtlb = auto_alloc_clear(cpu->machine(), ()); - - /* fill in CPU information */ - vtlb->cpudevice = downcast(cpu); - vtlb->space = space; - vtlb->dynamic = dynamic_entries; - vtlb->fixed = fixed_entries; - const address_space_config *spaceconfig = device_get_space_config(*cpu, space); - assert(spaceconfig != nullptr); - vtlb->pageshift = spaceconfig->m_page_shift; - vtlb->addrwidth = spaceconfig->m_logaddr_width; - - /* validate CPU information */ - assert((1 << vtlb->pageshift) > VTLB_FLAGS_MASK); - assert(vtlb->addrwidth > vtlb->pageshift); - - /* allocate the entry array */ - vtlb->live.resize(fixed_entries + dynamic_entries); - memset(&vtlb->live[0], 0, vtlb->live.size()*sizeof(vtlb->live[0])); - cpu->save_item(NAME(vtlb->live)); - - /* allocate the lookup table */ - vtlb->table.resize((size_t) 1 << (vtlb->addrwidth - vtlb->pageshift)); - memset(&vtlb->table[0], 0, vtlb->table.size()*sizeof(vtlb->table[0])); - cpu->save_item(NAME(vtlb->table)); - - /* allocate the fixed page count array */ - if (fixed_entries > 0) + // fill in CPU information + const address_space_config *spaceconfig = device().memory().space_config(m_space); + m_pageshift = spaceconfig->m_page_shift; + m_addrwidth = spaceconfig->m_logaddr_width; + + // allocate the entry array + m_live.resize(m_fixed + m_dynamic); + memset(&m_live[0], 0, m_live.size()*sizeof(m_live[0])); + + // allocate the lookup table + m_table.resize((size_t) 1 << (m_addrwidth - m_pageshift)); + memset(&m_table[0], 0, m_table.size()*sizeof(m_table[0])); + + // allocate the fixed page count array + if (m_fixed > 0) { - vtlb->fixedpages.resize(fixed_entries); - memset(&vtlb->fixedpages[0], 0, fixed_entries*sizeof(vtlb->fixedpages[0])); - cpu->save_item(NAME(vtlb->fixedpages)); + m_fixedpages.resize(m_fixed); + memset(&m_fixedpages[0], 0, m_fixed*sizeof(m_fixedpages[0])); } - return vtlb; } -/*------------------------------------------------- - vtlb_free - free an allocated VTLB --------------------------------------------------*/ +//------------------------------------------------- +// interface_post_start - work to be done after +// actually starting a device +//------------------------------------------------- -void vtlb_free(vtlb_state *vtlb) +void device_vtlb_interface::interface_post_start() { - auto_free(vtlb->cpudevice->machine(), vtlb); + device().save_item(NAME(m_live)); + device().save_item(NAME(m_table)); + if (m_fixed > 0) + device().save_item(NAME(m_fixedpages)); } +//------------------------------------------------- +// interface_pre_reset - work to be done prior to +// actually resetting a device +//------------------------------------------------- -/*************************************************************************** - FILLING -***************************************************************************/ +void device_vtlb_interface::interface_pre_reset() +{ + vtlb_flush_dynamic(); +} -/*------------------------------------------------- - vtlb_fill - rcalled by the CPU core in - response to an unmapped access --------------------------------------------------*/ -int vtlb_fill(vtlb_state *vtlb, offs_t address, int intention) +//************************************************************************** +// FILLING +//************************************************************************** + +//------------------------------------------------- +// vtlb_fill - called by the CPU core in +// response to an unmapped access +//------------------------------------------------- + +int device_vtlb_interface::vtlb_fill(offs_t address, int intention) { - offs_t tableindex = address >> vtlb->pageshift; - vtlb_entry entry = vtlb->table[tableindex]; + offs_t tableindex = address >> m_pageshift; + vtlb_entry entry = m_table[tableindex]; offs_t taddress; - if (PRINTF_TLB) - printf("vtlb_fill: %08X(%X) ... ", address, intention); +#if PRINTF_TLB + osd_printf_debug("vtlb_fill: %08X(%X) ... ", address, intention); +#endif - /* should not be called here if the entry is in the table already */ + // should not be called here if the entry is in the table already // assert((entry & (1 << intention)) == 0); - /* if we have no dynamic entries, we always fail */ - if (vtlb->dynamic == 0) + // if we have no dynamic entries, we always fail + if (m_dynamic == 0) { - if (PRINTF_TLB) - printf("failed: no dynamic entries\n"); +#if PRINTF_TLB + osd_printf_debug("failed: no dynamic entries\n"); +#endif return FALSE; } - /* ask the CPU core to translate for us */ + // ask the CPU core to translate for us taddress = address; - if (!vtlb->cpudevice->translate(vtlb->space, intention, taddress)) + if (!device().memory().translate(m_space, intention, taddress)) { - if (PRINTF_TLB) - printf("failed: no translation\n"); +#if PRINTF_TLB + osd_printf_debug("failed: no translation\n"); +#endif return FALSE; } - /* if this is the first successful translation for this address, allocate a new entry */ + // if this is the first successful translation for this address, allocate a new entry if ((entry & VTLB_FLAGS_MASK) == 0) { - int liveindex = vtlb->dynindex++ % vtlb->dynamic; + int liveindex = m_dynindex++ % m_dynamic; - /* if an entry already exists at this index, free it */ - if (vtlb->live[liveindex] != 0) - vtlb->table[vtlb->live[liveindex] - 1] = 0; + // if an entry already exists at this index, free it + if (m_live[liveindex] != 0) + m_table[m_live[liveindex] - 1] = 0; - /* claim this new entry */ - vtlb->live[liveindex] = tableindex + 1; + // claim this new entry + m_live[liveindex] = tableindex + 1; - /* form a new blank entry */ - entry = (taddress >> vtlb->pageshift) << vtlb->pageshift; + // form a new blank entry + entry = (taddress >> m_pageshift) << m_pageshift; entry |= VTLB_FLAG_VALID; - if (PRINTF_TLB) - printf("success (%08X), new entry\n", taddress); +#if PRINTF_TLB + osd_printf_debug("success (%08X), new entry\n", taddress); +#endif } - /* otherwise, ensure that different intentions do not produce different addresses */ + // otherwise, ensure that different intentions do not produce different addresses else { - assert((entry >> vtlb->pageshift) == (taddress >> vtlb->pageshift)); + assert((entry >> m_pageshift) == (taddress >> m_pageshift)); assert(entry & VTLB_FLAG_VALID); - if (PRINTF_TLB) - printf("success (%08X), existing entry\n", taddress); +#if PRINTF_TLB + osd_printf_debug("success (%08X), existing entry\n", taddress); +#endif } - /* add the intention to the list of valid intentions and store */ + // add the intention to the list of valid intentions and store entry |= 1 << (intention & (TRANSLATE_TYPE_MASK | TRANSLATE_USER_MASK)); - vtlb->table[tableindex] = entry; + m_table[tableindex] = entry; return TRUE; } -/*------------------------------------------------- - vtlb_load - load a fixed VTLB entry --------------------------------------------------*/ +//------------------------------------------------- +// vtlb_load - load a fixed VTLB entry +//------------------------------------------------- -void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtlb_entry value) +void device_vtlb_interface::vtlb_load(int entrynum, int numpages, offs_t address, vtlb_entry value) { - offs_t tableindex = address >> vtlb->pageshift; - int liveindex = vtlb->dynamic + entrynum; + offs_t tableindex = address >> m_pageshift; + int liveindex = m_dynamic + entrynum; int pagenum; - /* must be in range */ - assert(entrynum >= 0 && entrynum < vtlb->fixed); + // must be in range + assert(entrynum >= 0 && entrynum < m_fixed); - if (PRINTF_TLB) - printf("vtlb_load %d for %d pages at %08X == %08X\n", entrynum, numpages, address, value); +#if PRINTF_TLB + osd_printf_debug("vtlb_load %d for %d pages at %08X == %08X\n", entrynum, numpages, address, value); +#endif - /* if an entry already exists at this index, free it */ - if (vtlb->live[liveindex] != 0) + // if an entry already exists at this index, free it + if (m_live[liveindex] != 0) { - int pagecount = vtlb->fixedpages[entrynum]; - int oldtableindex = vtlb->live[liveindex] - 1; + int pagecount = m_fixedpages[entrynum]; + int oldtableindex = m_live[liveindex] - 1; for (pagenum = 0; pagenum < pagecount; pagenum++) - vtlb->table[oldtableindex + pagenum] = 0; + m_table[oldtableindex + pagenum] = 0; } - /* claim this new entry */ - vtlb->live[liveindex] = tableindex + 1; + // claim this new entry + m_live[liveindex] = tableindex + 1; - /* store the raw value, making sure the "fixed" flag is set */ + // store the raw value, making sure the "fixed" flag is set value |= VTLB_FLAG_FIXED; - vtlb->fixedpages[entrynum] = numpages; + m_fixedpages[entrynum] = numpages; for (pagenum = 0; pagenum < numpages; pagenum++) - vtlb->table[tableindex + pagenum] = value + (pagenum << vtlb->pageshift); + m_table[tableindex + pagenum] = value + (pagenum << m_pageshift); } -/*------------------------------------------------- - vtlb_dynload - load a dynamic VTLB entry --------------------------------------------------*/ +//------------------------------------------------- +// vtlb_dynload - load a dynamic VTLB entry +//------------------------------------------------- -void vtlb_dynload(vtlb_state *vtlb, UINT32 index, offs_t address, vtlb_entry value) +void device_vtlb_interface::vtlb_dynload(UINT32 index, offs_t address, vtlb_entry value) { - vtlb_entry entry = vtlb->table[index]; + vtlb_entry entry = m_table[index]; - if (vtlb->dynamic == 0) + if (m_dynamic == 0) { - if (PRINTF_TLB) - printf("failed: no dynamic entries\n"); +#if PRINTF_TLB + osd_printf_debug("failed: no dynamic entries\n"); +#endif return; } - int liveindex = vtlb->dynindex++ % vtlb->dynamic; - /* is entry already live? */ + int liveindex = m_dynindex++ % m_dynamic; + // is entry already live? if (!(entry & VTLB_FLAG_VALID)) { - /* if an entry already exists at this index, free it */ - if (vtlb->live[liveindex] != 0) - vtlb->table[vtlb->live[liveindex] - 1] = 0; + // if an entry already exists at this index, free it + if (m_live[liveindex] != 0) + m_table[m_live[liveindex] - 1] = 0; - /* claim this new entry */ - vtlb->live[liveindex] = index + 1; + // claim this new entry + m_live[liveindex] = index + 1; } - /* form a new blank entry */ - entry = (address >> vtlb->pageshift) << vtlb->pageshift; + // form a new blank entry + entry = (address >> m_pageshift) << m_pageshift; entry |= VTLB_FLAG_VALID | value; - if (PRINTF_TLB) - printf("success (%08X), new entry\n", address); - - vtlb->table[index] = entry; +#if PRINTF_TLB + osd_printf_debug("success (%08X), new entry\n", address); +#endif + m_table[index] = entry; } -/*************************************************************************** - FLUSHING -***************************************************************************/ +//************************************************************************** +// FLUSHING +//************************************************************************** -/*------------------------------------------------- - vtlb_flush_dynamic - flush all knowledge - from the dynamic part of the VTLB --------------------------------------------------*/ +//------------------------------------------------- +// vtlb_flush_dynamic - flush all knowledge +// from the dynamic part of the VTLB +//------------------------------------------------- -void vtlb_flush_dynamic(vtlb_state *vtlb) +void device_vtlb_interface::vtlb_flush_dynamic() { - int liveindex; - - if (PRINTF_TLB) - printf("vtlb_flush_dynamic\n"); +#if PRINTF_TLB + osd_printf_debug("vtlb_flush_dynamic\n"); +#endif - /* loop over live entries and release them from the table */ - for (liveindex = 0; liveindex < vtlb->dynamic; liveindex++) - if (vtlb->live[liveindex] != 0) + // loop over live entries and release them from the table + for (int liveindex = 0; liveindex < m_dynamic; liveindex++) + if (m_live[liveindex] != 0) { - offs_t tableindex = vtlb->live[liveindex] - 1; - vtlb->table[tableindex] = 0; - vtlb->live[liveindex] = 0; + offs_t tableindex = m_live[liveindex] - 1; + m_table[tableindex] = 0; + m_live[liveindex] = 0; } } -/*------------------------------------------------- - vtlb_flush_address - flush knowledge of a - particular address from the VTLB --------------------------------------------------*/ +//------------------------------------------------- +// vtlb_flush_address - flush knowledge of a +// particular address from the VTLB +//------------------------------------------------- -void vtlb_flush_address(vtlb_state *vtlb, offs_t address) +void device_vtlb_interface::vtlb_flush_address(offs_t address) { - offs_t tableindex = address >> vtlb->pageshift; + offs_t tableindex = address >> m_pageshift; - if (PRINTF_TLB) - printf("vtlb_flush_address %08X\n", address); +#if PRINTF_TLB + osd_printf_debug("vtlb_flush_address %08X\n", address); +#endif - /* free the entry in the table; for speed, we leave the entry in the live array */ - vtlb->table[tableindex] = 0; + // free the entry in the table; for speed, we leave the entry in the live array + m_table[tableindex] = 0; } -/*************************************************************************** - ACCESSORS -***************************************************************************/ +//************************************************************************** +// ACCESSORS +//************************************************************************** -/*------------------------------------------------- - vtlb_table - return a pointer to the base of - the linear VTLB lookup table --------------------------------------------------*/ +//------------------------------------------------- +// vtlb_table - return a pointer to the base of +// the linear VTLB lookup table +//------------------------------------------------- -const vtlb_entry *vtlb_table(vtlb_state *vtlb) +const vtlb_entry *device_vtlb_interface::vtlb_table() const { - return &vtlb->table[0]; + return &m_table[0]; } diff --git a/src/emu/divtlb.h b/src/emu/divtlb.h index f63a0ac50f6..eccd2947da3 100644 --- a/src/emu/divtlb.h +++ b/src/emu/divtlb.h @@ -2,7 +2,7 @@ // copyright-holders:Aaron Giles /*************************************************************************** - vtlb.h + divtlb.h Generic virtual TLB implementation. @@ -10,8 +10,8 @@ #pragma once -#ifndef __VTLB_H__ -#define __VTLB_H__ +#ifndef __DIVTLB_H__ +#define __DIVTLB_H__ @@ -40,49 +40,50 @@ typedef UINT32 vtlb_entry; -/* opaque structure describing VTLB state */ -struct vtlb_state; - - - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - - -/* ----- initialization/teardown ----- */ - -/* allocate a new VTLB for the given CPU */ -vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries, int dynamic_entries); - -/* free an allocated VTLB */ -void vtlb_free(vtlb_state *vtlb); - - -/* ----- filling ----- */ - -/* called by the CPU core in response to an unmapped access */ -int vtlb_fill(vtlb_state *vtlb, offs_t address, int intention); - -/* load a fixed VTLB entry */ -void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtlb_entry value); - -/* load a dynamic VTLB entry */ -void vtlb_dynload(vtlb_state *vtlb, UINT32 index, offs_t address, vtlb_entry value); - -/* ----- flushing ----- */ - -/* flush all knowledge from the dynamic part of the VTLB */ -void vtlb_flush_dynamic(vtlb_state *vtlb); - -/* flush knowledge of a particular address from the VTLB */ -void vtlb_flush_address(vtlb_state *vtlb, offs_t address); - - -/* ----- accessors ----- */ - -/* return a pointer to the base of the linear VTLB lookup table */ -const vtlb_entry *vtlb_table(vtlb_state *vtlb); +// ======================> device_vtlb_interface + +class device_vtlb_interface : public device_interface +{ +public: + // construction/destruction + device_vtlb_interface(const machine_config &mconfig, device_t &device, address_spacenum space); + virtual ~device_vtlb_interface(); + + // configuration helpers + void set_vtlb_dynamic_entries(int entries) { m_dynamic = entries; } + void set_vtlb_fixed_entries(int entries) { m_fixed = entries; } + + // filling + int vtlb_fill(offs_t address, int intention); + void vtlb_load(int entrynum, int numpages, offs_t address, vtlb_entry value); + void vtlb_dynload(UINT32 index, offs_t address, vtlb_entry value); + + // flushing + void vtlb_flush_dynamic(); + void vtlb_flush_address(offs_t address); + + // accessors + const vtlb_entry *vtlb_table() const; + +protected: + // interface-level overrides + virtual void interface_validity_check(validity_checker &valid) const override; + virtual void interface_pre_start() override; + virtual void interface_post_start() override; + virtual void interface_pre_reset() override; + +private: + // private state + address_spacenum m_space; // address space + int m_dynamic; // number of dynamic entries + int m_fixed; // number of fixed entries + int m_dynindex; // index of next dynamic entry + int m_pageshift; // bits to shift to get page index + int m_addrwidth; // logical address bus width + std::vector m_live; // array of live entries by table index + std::vector m_fixedpages; // number of pages each fixed entry covers + std::vector m_table; // table of entries by address +}; #endif /* __VTLB_H__ */ -- cgit v1.2.3-70-g09d2 From 5bc83a25063330ab9177a291ab984c5c7052aa02 Mon Sep 17 00:00:00 2001 From: Branimir Karadžić Date: Sun, 7 Feb 2016 09:50:16 +0100 Subject: Update BGFX (nw) --- 3rdparty/bgfx/.appveyor.yml | 22 + 3rdparty/bgfx/.travis.yml | 22 + 3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h | 2 + 3rdparty/bgfx/3rdparty/etc2/LICENSE.txt | 24 + 3rdparty/bgfx/3rdparty/etc2/Math.hpp | 90 + 3rdparty/bgfx/3rdparty/etc2/ProcessCommon.hpp | 51 + 3rdparty/bgfx/3rdparty/etc2/ProcessRGB.cpp | 719 +++++ 3rdparty/bgfx/3rdparty/etc2/ProcessRGB.hpp | 9 + 3rdparty/bgfx/3rdparty/etc2/Tables.cpp | 109 + 3rdparty/bgfx/3rdparty/etc2/Tables.hpp | 25 + 3rdparty/bgfx/3rdparty/etc2/Types.hpp | 17 + 3rdparty/bgfx/3rdparty/etc2/Vector.hpp | 222 ++ .../forsyth-too/forsythtriangleorderoptimizer.cpp | 2 +- .../glsl-optimizer/src/glsl/glcpp/.gitignore | 2 - .../bgfx/3rdparty/nvtt/nvcore/defsgnucdarwin.h | 2 +- 3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnuclinux.h | 2 +- 3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucwin32.h | 2 +- 3rdparty/bgfx/3rdparty/nvtt/nvcore/defsvcwin32.h | 2 +- 3rdparty/bgfx/3rdparty/nvtt/nvmath/nvmath.h | 5 + 3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp | 228 +- 3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h | 134 +- .../bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp | 25 +- .../bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp | 49 +- .../bgfx/3rdparty/ocornut-imgui/imgui_internal.h | 15 +- 3rdparty/bgfx/3rdparty/pvrtc/BitScale.h | 2 +- 3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c | 3 +- 3rdparty/bgfx/3rdparty/stb/stb_image.c | 1 + 3rdparty/bgfx/3rdparty/tinyexr/tinyexr.h | 15 +- 3rdparty/bgfx/README.md | 18 +- .../bgfx/examples/02-metaballs/fs_metaballs.bin.h | 51 +- .../bgfx/examples/02-metaballs/vs_metaballs.bin.h | 36 +- 3rdparty/bgfx/examples/08-update/update.cpp | 10 +- 3rdparty/bgfx/examples/09-hdr/hdr.cpp | 4 +- 3rdparty/bgfx/examples/13-stencil/stencil.cpp | 4 +- .../examples/14-shadowvolumes/shadowvolumes.cpp | 8 +- .../15-shadowmaps-simple/fs_sms_shadow_pd.sc | 6 +- .../15-shadowmaps-simple/shadowmaps_simple.cpp | 15 +- .../bgfx/examples/16-shadowmaps/shadowmaps.cpp | 22 +- .../examples/17-drawstress/fs_drawstress.bin.h | 14 +- .../examples/17-drawstress/vs_drawstress.bin.h | 25 +- 3rdparty/bgfx/examples/27-terrain/terrain.cpp | 26 +- 3rdparty/bgfx/examples/common/aviwriter.h | 6 +- 3rdparty/bgfx/examples/common/bgfx_utils.cpp | 23 +- 3rdparty/bgfx/examples/common/entry/entry_ios.mm | 10 +- 3rdparty/bgfx/examples/common/entry/entry_p.h | 2 +- 3rdparty/bgfx/examples/common/entry/entry_sdl.cpp | 155 +- .../bgfx/examples/common/entry/entry_windows.cpp | 2 +- 3rdparty/bgfx/examples/common/entry/entry_x11.cpp | 35 + .../bgfx/examples/common/font/fs_font_basic.bin.h | 47 +- .../common/font/fs_font_distance_field.bin.h | 84 +- .../font/fs_font_distance_field_subpixel.bin.h | 102 +- .../bgfx/examples/common/font/vs_font_basic.bin.h | 27 +- .../common/font/vs_font_distance_field.bin.h | 27 +- .../font/vs_font_distance_field_subpixel.bin.h | 27 +- .../examples/common/imgui/fs_imgui_color.bin.h | 14 +- .../examples/common/imgui/fs_imgui_cubemap.bin.h | 26 +- .../examples/common/imgui/fs_imgui_image.bin.h | 26 +- .../common/imgui/fs_imgui_image_swizz.bin.h | 28 +- .../examples/common/imgui/fs_imgui_latlong.bin.h | 46 +- .../examples/common/imgui/fs_imgui_texture.bin.h | 22 +- .../examples/common/imgui/fs_ocornut_imgui.bin.h | 17 +- .../examples/common/imgui/vs_imgui_color.bin.h | 26 +- .../examples/common/imgui/vs_imgui_cubemap.bin.h | 25 +- .../examples/common/imgui/vs_imgui_image.bin.h | 26 +- .../examples/common/imgui/vs_imgui_latlong.bin.h | 25 +- .../examples/common/imgui/vs_imgui_texture.bin.h | 30 +- .../examples/common/imgui/vs_ocornut_imgui.bin.h | 33 +- .../examples/common/nanovg/fs_nanovg_fill.bin.h | 132 +- .../bgfx/examples/common/nanovg/nanovg_bgfx.cpp | 34 +- .../examples/common/nanovg/vs_nanovg_fill.bin.h | 35 +- 3rdparty/bgfx/examples/common/shaderlib.sh | 30 +- .../bgfx/examples/runtime/gamecontrollerdb.txt | 35 +- .../examples/runtime/shaders/dx11/fs_particle.bin | Bin 603 -> 603 bytes .../dx11/fs_shadowmaps_color_lighting_esm.bin | Bin 3573 -> 3573 bytes .../dx11/fs_shadowmaps_color_lighting_esm_csm.bin | Bin 6510 -> 6534 bytes .../fs_shadowmaps_color_lighting_esm_linear.bin | Bin 3545 -> 3545 bytes ...fs_shadowmaps_color_lighting_esm_linear_csm.bin | Bin 6398 -> 6422 bytes ...s_shadowmaps_color_lighting_esm_linear_omni.bin | Bin 5203 -> 5203 bytes .../dx11/fs_shadowmaps_color_lighting_esm_omni.bin | Bin 5231 -> 5231 bytes .../dx11/fs_shadowmaps_color_lighting_hard.bin | Bin 3457 -> 3457 bytes .../dx11/fs_shadowmaps_color_lighting_hard_csm.bin | Bin 6046 -> 6070 bytes .../fs_shadowmaps_color_lighting_hard_linear.bin | Bin 3429 -> 3429 bytes ...s_shadowmaps_color_lighting_hard_linear_csm.bin | Bin 5934 -> 5958 bytes ..._shadowmaps_color_lighting_hard_linear_omni.bin | Bin 5087 -> 5087 bytes .../fs_shadowmaps_color_lighting_hard_omni.bin | Bin 5115 -> 5115 bytes .../dx11/fs_shadowmaps_color_lighting_pcf.bin | Bin 11918 -> 11918 bytes .../dx11/fs_shadowmaps_color_lighting_pcf_csm.bin | Bin 39963 -> 40071 bytes .../fs_shadowmaps_color_lighting_pcf_linear.bin | Bin 10842 -> 10850 bytes ...fs_shadowmaps_color_lighting_pcf_linear_csm.bin | Bin 35579 -> 35715 bytes ...s_shadowmaps_color_lighting_pcf_linear_omni.bin | Bin 12436 -> 12436 bytes .../dx11/fs_shadowmaps_color_lighting_pcf_omni.bin | Bin 13524 -> 13524 bytes .../dx11/fs_shadowmaps_color_lighting_vsm.bin | Bin 3749 -> 3717 bytes .../dx11/fs_shadowmaps_color_lighting_vsm_csm.bin | Bin 7214 -> 7206 bytes .../fs_shadowmaps_color_lighting_vsm_linear.bin | Bin 3721 -> 3689 bytes ...fs_shadowmaps_color_lighting_vsm_linear_csm.bin | Bin 7102 -> 7094 bytes ...s_shadowmaps_color_lighting_vsm_linear_omni.bin | Bin 5379 -> 5347 bytes .../dx11/fs_shadowmaps_color_lighting_vsm_omni.bin | Bin 5407 -> 5375 bytes .../examples/runtime/shaders/dx11/fs_sms_mesh.bin | Bin 4815 -> 4239 bytes .../runtime/shaders/dx11/fs_sms_mesh_pd.bin | Bin 5631 -> 5631 bytes .../runtime/shaders/dx11/fs_sms_shadow_pd.bin | Bin 428 -> 477 bytes .../bgfx/examples/runtime/shaders/dx9/fs_bump.bin | Bin 2274 -> 2278 bytes .../examples/runtime/shaders/dx9/fs_callback.bin | Bin 553 -> 557 bytes .../bgfx/examples/runtime/shaders/dx9/fs_cubes.bin | Bin 137 -> 141 bytes .../runtime/shaders/dx9/fs_deferred_combine.bin | Bin 618 -> 622 bytes .../runtime/shaders/dx9/fs_deferred_debug.bin | Bin 218 -> 222 bytes .../runtime/shaders/dx9/fs_deferred_debug_line.bin | Bin 137 -> 141 bytes .../runtime/shaders/dx9/fs_deferred_geom.bin | Bin 696 -> 700 bytes .../runtime/shaders/dx9/fs_deferred_light.bin | Bin 1088 -> 1092 bytes .../examples/runtime/shaders/dx9/fs_hdr_blur.bin | Bin 618 -> 622 bytes .../examples/runtime/shaders/dx9/fs_hdr_bright.bin | Bin 1656 -> 1664 bytes .../examples/runtime/shaders/dx9/fs_hdr_lum.bin | Bin 1469 -> 1473 bytes .../examples/runtime/shaders/dx9/fs_hdr_lumavg.bin | Bin 1793 -> 1797 bytes .../examples/runtime/shaders/dx9/fs_hdr_mesh.bin | Bin 1433 -> 1381 bytes .../examples/runtime/shaders/dx9/fs_hdr_skybox.bin | Bin 525 -> 529 bytes .../runtime/shaders/dx9/fs_hdr_tonemap.bin | Bin 1673 -> 1677 bytes .../examples/runtime/shaders/dx9/fs_ibl_mesh.bin | Bin 1661 -> 1661 bytes .../examples/runtime/shaders/dx9/fs_ibl_skybox.bin | Bin 556 -> 560 bytes .../examples/runtime/shaders/dx9/fs_instancing.bin | Bin 137 -> 141 bytes .../bgfx/examples/runtime/shaders/dx9/fs_mesh.bin | Bin 1278 -> 1206 bytes .../bgfx/examples/runtime/shaders/dx9/fs_oit.bin | Bin 183 -> 187 bytes .../examples/runtime/shaders/dx9/fs_oit_wb.bin | Bin 459 -> 463 bytes .../runtime/shaders/dx9/fs_oit_wb_blit.bin | Bin 429 -> 433 bytes .../runtime/shaders/dx9/fs_oit_wb_separate.bin | Bin 431 -> 435 bytes .../shaders/dx9/fs_oit_wb_separate_blit.bin | Bin 429 -> 433 bytes .../examples/runtime/shaders/dx9/fs_particle.bin | Bin 404 -> 408 bytes .../runtime/shaders/dx9/fs_raymarching.bin | Bin 47438 -> 47442 bytes .../shaders/dx9/fs_shadowmaps_color_black.bin | Bin 149 -> 153 bytes .../dx9/fs_shadowmaps_color_lighting_esm.bin | Bin 2726 -> 2730 bytes .../dx9/fs_shadowmaps_color_lighting_esm_csm.bin | Bin 4507 -> 4511 bytes .../fs_shadowmaps_color_lighting_esm_linear.bin | Bin 2722 -> 2726 bytes ...fs_shadowmaps_color_lighting_esm_linear_csm.bin | Bin 4471 -> 4475 bytes ...s_shadowmaps_color_lighting_esm_linear_omni.bin | Bin 3772 -> 3776 bytes .../dx9/fs_shadowmaps_color_lighting_esm_omni.bin | Bin 3776 -> 3780 bytes .../dx9/fs_shadowmaps_color_lighting_hard.bin | Bin 2686 -> 2690 bytes .../dx9/fs_shadowmaps_color_lighting_hard_csm.bin | Bin 4375 -> 4379 bytes .../fs_shadowmaps_color_lighting_hard_linear.bin | Bin 2682 -> 2686 bytes ...s_shadowmaps_color_lighting_hard_linear_csm.bin | Bin 4419 -> 4423 bytes ..._shadowmaps_color_lighting_hard_linear_omni.bin | Bin 3744 -> 3748 bytes .../dx9/fs_shadowmaps_color_lighting_hard_omni.bin | Bin 3728 -> 3732 bytes .../dx9/fs_shadowmaps_color_lighting_pcf.bin | Bin 7591 -> 7591 bytes .../dx9/fs_shadowmaps_color_lighting_pcf_csm.bin | Bin 24496 -> 24496 bytes .../fs_shadowmaps_color_lighting_pcf_linear.bin | Bin 7267 -> 7267 bytes ...fs_shadowmaps_color_lighting_pcf_linear_csm.bin | Bin 22316 -> 22316 bytes ...s_shadowmaps_color_lighting_pcf_linear_omni.bin | Bin 7961 -> 7965 bytes .../dx9/fs_shadowmaps_color_lighting_pcf_omni.bin | Bin 8665 -> 8669 bytes .../dx9/fs_shadowmaps_color_lighting_vsm.bin | Bin 2806 -> 2810 bytes .../dx9/fs_shadowmaps_color_lighting_vsm_csm.bin | Bin 4891 -> 4895 bytes .../fs_shadowmaps_color_lighting_vsm_linear.bin | Bin 2790 -> 2794 bytes ...fs_shadowmaps_color_lighting_vsm_linear_csm.bin | Bin 4827 -> 4831 bytes ...s_shadowmaps_color_lighting_vsm_linear_omni.bin | Bin 3872 -> 3876 bytes .../dx9/fs_shadowmaps_color_lighting_vsm_omni.bin | Bin 3888 -> 3892 bytes .../shaders/dx9/fs_shadowmaps_color_texture.bin | Bin 572 -> 576 bytes .../runtime/shaders/dx9/fs_shadowmaps_hblur.bin | Bin 960 -> 964 bytes .../shaders/dx9/fs_shadowmaps_hblur_vsm.bin | Bin 1152 -> 1156 bytes .../shaders/dx9/fs_shadowmaps_packdepth.bin | Bin 269 -> 273 bytes .../shaders/dx9/fs_shadowmaps_packdepth_linear.bin | Bin 221 -> 225 bytes .../shaders/dx9/fs_shadowmaps_packdepth_vsm.bin | Bin 333 -> 337 bytes .../dx9/fs_shadowmaps_packdepth_vsm_linear.bin | Bin 261 -> 265 bytes .../runtime/shaders/dx9/fs_shadowmaps_texture.bin | Bin 218 -> 222 bytes .../shaders/dx9/fs_shadowmaps_unpackdepth.bin | Bin 380 -> 384 bytes .../shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin | Bin 384 -> 388 bytes .../runtime/shaders/dx9/fs_shadowmaps_vblur.bin | Bin 960 -> 964 bytes .../shaders/dx9/fs_shadowmaps_vblur_vsm.bin | Bin 1152 -> 1156 bytes .../shaders/dx9/fs_shadowvolume_color_lighting.bin | Bin 1910 -> 1914 bytes .../shaders/dx9/fs_shadowvolume_color_texture.bin | Bin 572 -> 576 bytes .../shaders/dx9/fs_shadowvolume_svbackblank.bin | Bin 149 -> 153 bytes .../shaders/dx9/fs_shadowvolume_svbackcolor.bin | Bin 227 -> 231 bytes .../shaders/dx9/fs_shadowvolume_svbacktex1.bin | Bin 201 -> 205 bytes .../shaders/dx9/fs_shadowvolume_svbacktex2.bin | Bin 201 -> 205 bytes .../shaders/dx9/fs_shadowvolume_svfrontblank.bin | Bin 149 -> 153 bytes .../shaders/dx9/fs_shadowvolume_svfrontcolor.bin | Bin 227 -> 231 bytes .../shaders/dx9/fs_shadowvolume_svfronttex1.bin | Bin 201 -> 205 bytes .../shaders/dx9/fs_shadowvolume_svfronttex2.bin | Bin 201 -> 205 bytes .../runtime/shaders/dx9/fs_shadowvolume_svside.bin | Bin 277 -> 281 bytes .../shaders/dx9/fs_shadowvolume_svsideblank.bin | Bin 149 -> 153 bytes .../shaders/dx9/fs_shadowvolume_svsidecolor.bin | Bin 227 -> 231 bytes .../shaders/dx9/fs_shadowvolume_svsidetex.bin | Bin 374 -> 378 bytes .../shaders/dx9/fs_shadowvolume_texture.bin | Bin 218 -> 222 bytes .../dx9/fs_shadowvolume_texture_lighting.bin | Bin 2061 -> 2065 bytes .../examples/runtime/shaders/dx9/fs_sms_mesh.bin | Bin 2464 -> 2468 bytes .../runtime/shaders/dx9/fs_sms_mesh_pd.bin | Bin 3300 -> 3304 bytes .../examples/runtime/shaders/dx9/fs_sms_shadow.bin | Bin 149 -> 153 bytes .../runtime/shaders/dx9/fs_sms_shadow_pd.bin | Bin 269 -> 354 bytes .../runtime/shaders/dx9/fs_stencil_color_black.bin | Bin 149 -> 153 bytes .../shaders/dx9/fs_stencil_color_lighting.bin | Bin 1976 -> 1980 bytes .../shaders/dx9/fs_stencil_color_texture.bin | Bin 572 -> 576 bytes .../runtime/shaders/dx9/fs_stencil_texture.bin | Bin 218 -> 222 bytes .../shaders/dx9/fs_stencil_texture_lighting.bin | Bin 2169 -> 2173 bytes .../bgfx/examples/runtime/shaders/dx9/fs_tree.bin | Bin 1018 -> 1022 bytes .../examples/runtime/shaders/dx9/fs_update.bin | Bin 217 -> 221 bytes .../examples/runtime/shaders/dx9/fs_update_3d.bin | Bin 427 -> 431 bytes .../examples/runtime/shaders/dx9/fs_update_cmp.bin | Bin 262 -> 266 bytes .../runtime/shaders/dx9/fs_vectordisplay_blit.bin | Bin 325 -> 329 bytes .../runtime/shaders/dx9/fs_vectordisplay_blur.bin | Bin 813 -> 817 bytes .../runtime/shaders/dx9/fs_vectordisplay_fb.bin | Bin 337 -> 341 bytes .../bgfx/examples/runtime/shaders/dx9/vs_bump.bin | Bin 1089 -> 1093 bytes .../runtime/shaders/dx9/vs_bump_instanced.bin | Bin 1083 -> 1087 bytes .../examples/runtime/shaders/dx9/vs_callback.bin | Bin 461 -> 465 bytes .../bgfx/examples/runtime/shaders/dx9/vs_cubes.bin | Bin 319 -> 323 bytes .../runtime/shaders/dx9/vs_deferred_combine.bin | Bin 319 -> 323 bytes .../runtime/shaders/dx9/vs_deferred_debug.bin | Bin 319 -> 323 bytes .../runtime/shaders/dx9/vs_deferred_debug_line.bin | Bin 319 -> 323 bytes .../runtime/shaders/dx9/vs_deferred_geom.bin | Bin 1089 -> 1093 bytes .../runtime/shaders/dx9/vs_deferred_light.bin | Bin 319 -> 323 bytes .../examples/runtime/shaders/dx9/vs_hdr_blur.bin | Bin 665 -> 669 bytes .../examples/runtime/shaders/dx9/vs_hdr_bright.bin | Bin 319 -> 323 bytes .../examples/runtime/shaders/dx9/vs_hdr_lum.bin | Bin 319 -> 323 bytes .../examples/runtime/shaders/dx9/vs_hdr_lumavg.bin | Bin 319 -> 323 bytes .../examples/runtime/shaders/dx9/vs_hdr_mesh.bin | Bin 577 -> 581 bytes .../examples/runtime/shaders/dx9/vs_hdr_skybox.bin | Bin 319 -> 323 bytes .../runtime/shaders/dx9/vs_hdr_tonemap.bin | Bin 653 -> 657 bytes .../examples/runtime/shaders/dx9/vs_ibl_mesh.bin | Bin 672 -> 676 bytes .../examples/runtime/shaders/dx9/vs_ibl_skybox.bin | Bin 443 -> 447 bytes .../examples/runtime/shaders/dx9/vs_instancing.bin | Bin 474 -> 478 bytes .../bgfx/examples/runtime/shaders/dx9/vs_mesh.bin | Bin 982 -> 986 bytes .../bgfx/examples/runtime/shaders/dx9/vs_oit.bin | Bin 553 -> 557 bytes .../examples/runtime/shaders/dx9/vs_oit_blit.bin | Bin 319 -> 323 bytes .../examples/runtime/shaders/dx9/vs_particle.bin | Bin 682 -> 686 bytes .../runtime/shaders/dx9/vs_raymarching.bin | Bin 355 -> 359 bytes .../runtime/shaders/dx9/vs_shadowmaps_color.bin | Bin 283 -> 287 bytes .../shaders/dx9/vs_shadowmaps_color_lighting.bin | Bin 802 -> 806 bytes .../dx9/vs_shadowmaps_color_lighting_csm.bin | Bin 1451 -> 1455 bytes .../dx9/vs_shadowmaps_color_lighting_linear.bin | Bin 818 -> 822 bytes .../vs_shadowmaps_color_lighting_linear_csm.bin | Bin 1515 -> 1519 bytes .../vs_shadowmaps_color_lighting_linear_omni.bin | Bin 1462 -> 1466 bytes .../dx9/vs_shadowmaps_color_lighting_omni.bin | Bin 1398 -> 1402 bytes .../shaders/dx9/vs_shadowmaps_color_texture.bin | Bin 319 -> 323 bytes .../runtime/shaders/dx9/vs_shadowmaps_depth.bin | Bin 283 -> 287 bytes .../runtime/shaders/dx9/vs_shadowmaps_hblur.bin | Bin 754 -> 758 bytes .../shaders/dx9/vs_shadowmaps_packdepth.bin | Bin 319 -> 323 bytes .../shaders/dx9/vs_shadowmaps_packdepth_linear.bin | Bin 351 -> 355 bytes .../runtime/shaders/dx9/vs_shadowmaps_texture.bin | Bin 319 -> 323 bytes .../shaders/dx9/vs_shadowmaps_texture_lighting.bin | Bin 577 -> 581 bytes .../shaders/dx9/vs_shadowmaps_unpackdepth.bin | Bin 319 -> 323 bytes .../runtime/shaders/dx9/vs_shadowmaps_vblur.bin | Bin 754 -> 758 bytes .../shaders/dx9/vs_shadowvolume_color_lighting.bin | Bin 541 -> 545 bytes .../shaders/dx9/vs_shadowvolume_color_texture.bin | Bin 319 -> 323 bytes .../runtime/shaders/dx9/vs_shadowvolume_svback.bin | Bin 437 -> 441 bytes .../shaders/dx9/vs_shadowvolume_svfront.bin | Bin 283 -> 287 bytes .../runtime/shaders/dx9/vs_shadowvolume_svside.bin | Bin 545 -> 549 bytes .../shaders/dx9/vs_shadowvolume_texture.bin | Bin 319 -> 323 bytes .../dx9/vs_shadowvolume_texture_lighting.bin | Bin 577 -> 581 bytes .../examples/runtime/shaders/dx9/vs_sms_mesh.bin | Bin 738 -> 742 bytes .../examples/runtime/shaders/dx9/vs_sms_shadow.bin | Bin 283 -> 287 bytes .../runtime/shaders/dx9/vs_sms_shadow_pd.bin | Bin 319 -> 323 bytes .../runtime/shaders/dx9/vs_stencil_color.bin | Bin 283 -> 287 bytes .../shaders/dx9/vs_stencil_color_lighting.bin | Bin 541 -> 545 bytes .../shaders/dx9/vs_stencil_color_texture.bin | Bin 319 -> 323 bytes .../runtime/shaders/dx9/vs_stencil_texture.bin | Bin 319 -> 323 bytes .../shaders/dx9/vs_stencil_texture_lighting.bin | Bin 577 -> 581 bytes .../bgfx/examples/runtime/shaders/dx9/vs_tree.bin | Bin 629 -> 633 bytes .../examples/runtime/shaders/dx9/vs_update.bin | Bin 319 -> 323 bytes .../runtime/shaders/dx9/vs_vectordisplay_fb.bin | Bin 355 -> 359 bytes .../examples/runtime/shaders/gles/fs_oit_wb.bin | Bin 373 -> 371 bytes .../runtime/shaders/gles/fs_oit_wb_separate.bin | Bin 320 -> 318 bytes .../gles/fs_shadowmaps_color_lighting_esm.bin | Bin 4213 -> 4207 bytes .../gles/fs_shadowmaps_color_lighting_esm_csm.bin | Bin 10222 -> 10204 bytes .../fs_shadowmaps_color_lighting_esm_linear.bin | Bin 4257 -> 4251 bytes ...fs_shadowmaps_color_lighting_esm_linear_csm.bin | Bin 10442 -> 10424 bytes ...s_shadowmaps_color_lighting_esm_linear_omni.bin | Bin 7587 -> 7581 bytes .../gles/fs_shadowmaps_color_lighting_esm_omni.bin | Bin 7541 -> 7535 bytes .../gles/fs_shadowmaps_color_lighting_hard.bin | Bin 4085 -> 4079 bytes .../gles/fs_shadowmaps_color_lighting_hard_csm.bin | Bin 9678 -> 9660 bytes .../fs_shadowmaps_color_lighting_hard_linear.bin | Bin 4117 -> 4111 bytes ...s_shadowmaps_color_lighting_hard_linear_csm.bin | Bin 9814 -> 9796 bytes ..._shadowmaps_color_lighting_hard_linear_omni.bin | Bin 7448 -> 7442 bytes .../fs_shadowmaps_color_lighting_hard_omni.bin | Bin 7414 -> 7408 bytes .../gles/fs_shadowmaps_color_lighting_pcf.bin | Bin 15736 -> 15670 bytes .../gles/fs_shadowmaps_color_lighting_pcf_csm.bin | Bin 63472 -> 63214 bytes .../fs_shadowmaps_color_lighting_pcf_linear.bin | Bin 15787 -> 15721 bytes ...fs_shadowmaps_color_lighting_pcf_linear_csm.bin | Bin 63918 -> 63660 bytes ...s_shadowmaps_color_lighting_pcf_linear_omni.bin | Bin 19328 -> 19262 bytes .../gles/fs_shadowmaps_color_lighting_pcf_omni.bin | Bin 19273 -> 19207 bytes .../gles/fs_shadowmaps_color_lighting_vsm.bin | Bin 4635 -> 4633 bytes .../gles/fs_shadowmaps_color_lighting_vsm_csm.bin | Bin 12152 -> 12150 bytes .../fs_shadowmaps_color_lighting_vsm_linear.bin | Bin 4679 -> 4677 bytes ...fs_shadowmaps_color_lighting_vsm_linear_csm.bin | Bin 12372 -> 12370 bytes ...s_shadowmaps_color_lighting_vsm_linear_omni.bin | Bin 8011 -> 8009 bytes .../gles/fs_shadowmaps_color_lighting_vsm_omni.bin | Bin 7965 -> 7963 bytes .../runtime/shaders/gles/fs_shadowmaps_hblur.bin | Bin 1746 -> 1708 bytes .../shaders/gles/fs_shadowmaps_packdepth.bin | Bin 302 -> 300 bytes .../gles/fs_shadowmaps_packdepth_linear.bin | Bin 254 -> 252 bytes .../shaders/gles/fs_shadowmaps_unpackdepth.bin | Bin 421 -> 417 bytes .../runtime/shaders/gles/fs_shadowmaps_vblur.bin | Bin 1746 -> 1708 bytes .../runtime/shaders/gles/fs_sms_mesh_pd.bin | Bin 8652 -> 8588 bytes .../runtime/shaders/gles/fs_sms_shadow_pd.bin | Bin 302 -> 398 bytes .../examples/runtime/shaders/glsl/fs_oit_wb.bin | Bin 355 -> 353 bytes .../runtime/shaders/glsl/fs_oit_wb_separate.bin | Bin 302 -> 300 bytes .../glsl/fs_shadowmaps_color_lighting_esm.bin | Bin 3976 -> 3970 bytes .../glsl/fs_shadowmaps_color_lighting_esm_csm.bin | Bin 9840 -> 9822 bytes .../fs_shadowmaps_color_lighting_esm_linear.bin | Bin 4020 -> 4014 bytes ...fs_shadowmaps_color_lighting_esm_linear_csm.bin | Bin 10060 -> 10042 bytes ...s_shadowmaps_color_lighting_esm_linear_omni.bin | Bin 7231 -> 7225 bytes .../glsl/fs_shadowmaps_color_lighting_esm_omni.bin | Bin 7185 -> 7179 bytes .../glsl/fs_shadowmaps_color_lighting_hard.bin | Bin 3854 -> 3848 bytes .../glsl/fs_shadowmaps_color_lighting_hard_csm.bin | Bin 9320 -> 9302 bytes .../fs_shadowmaps_color_lighting_hard_linear.bin | Bin 3886 -> 3880 bytes ...s_shadowmaps_color_lighting_hard_linear_csm.bin | Bin 9456 -> 9438 bytes ..._shadowmaps_color_lighting_hard_linear_omni.bin | Bin 7098 -> 7092 bytes .../fs_shadowmaps_color_lighting_hard_omni.bin | Bin 7064 -> 7058 bytes .../glsl/fs_shadowmaps_color_lighting_pcf.bin | Bin 15123 -> 15057 bytes .../glsl/fs_shadowmaps_color_lighting_pcf_csm.bin | Bin 61633 -> 61375 bytes .../fs_shadowmaps_color_lighting_pcf_linear.bin | Bin 15168 -> 15102 bytes ...fs_shadowmaps_color_lighting_pcf_linear_csm.bin | Bin 62055 -> 61797 bytes ...s_shadowmaps_color_lighting_pcf_linear_omni.bin | Bin 18584 -> 18518 bytes .../glsl/fs_shadowmaps_color_lighting_pcf_omni.bin | Bin 18535 -> 18469 bytes .../glsl/fs_shadowmaps_color_lighting_vsm.bin | Bin 4373 -> 4371 bytes .../glsl/fs_shadowmaps_color_lighting_vsm_csm.bin | Bin 11670 -> 11668 bytes .../fs_shadowmaps_color_lighting_vsm_linear.bin | Bin 4417 -> 4415 bytes ...fs_shadowmaps_color_lighting_vsm_linear_csm.bin | Bin 11890 -> 11888 bytes ...s_shadowmaps_color_lighting_vsm_linear_omni.bin | Bin 7630 -> 7628 bytes .../glsl/fs_shadowmaps_color_lighting_vsm_omni.bin | Bin 7584 -> 7582 bytes .../runtime/shaders/glsl/fs_shadowmaps_hblur.bin | Bin 1619 -> 1581 bytes .../shaders/glsl/fs_shadowmaps_packdepth.bin | Bin 290 -> 288 bytes .../glsl/fs_shadowmaps_packdepth_linear.bin | Bin 242 -> 240 bytes .../shaders/glsl/fs_shadowmaps_unpackdepth.bin | Bin 356 -> 352 bytes .../runtime/shaders/glsl/fs_shadowmaps_vblur.bin | Bin 1619 -> 1581 bytes .../runtime/shaders/glsl/fs_sms_mesh_pd.bin | Bin 8286 -> 8222 bytes .../runtime/shaders/glsl/fs_sms_shadow_pd.bin | Bin 290 -> 380 bytes .../runtime/shaders/metal/fs_sms_shadow_pd.bin | Bin 623 -> 700 bytes 3rdparty/bgfx/include/bgfx/bgfxdefines.h | 4 +- 3rdparty/bgfx/include/bgfx/bgfxplatform.h | 77 +- 3rdparty/bgfx/include/bgfx/c99/bgfx.h | 135 - 3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h | 157 +- 3rdparty/bgfx/makefile | 29 +- 3rdparty/bgfx/scripts/bgfx.lua | 2 +- 3rdparty/bgfx/scripts/genie.lua | 18 +- 3rdparty/bgfx/scripts/makedisttex.lua | 19 - 3rdparty/bgfx/scripts/shader.mk | 29 +- 3rdparty/bgfx/scripts/shaderc.lua | 6 +- 3rdparty/bgfx/scripts/texturec.lua | 4 + 3rdparty/bgfx/src/bgfx.cpp | 166 +- 3rdparty/bgfx/src/bgfx_p.h | 48 +- 3rdparty/bgfx/src/bgfx_shader.sh | 26 +- 3rdparty/bgfx/src/config.h | 37 +- 3rdparty/bgfx/src/glcontext_eagl.mm | 2 + 3rdparty/bgfx/src/glcontext_egl.cpp | 2 + 3rdparty/bgfx/src/glcontext_glx.cpp | 2 + 3rdparty/bgfx/src/glcontext_nsgl.mm | 2 + 3rdparty/bgfx/src/glcontext_ppapi.cpp | 2 + 3rdparty/bgfx/src/glcontext_wgl.cpp | 2 + 3rdparty/bgfx/src/glimports.h | 6 + 3rdparty/bgfx/src/image.cpp | 1226 ++++++++- 3rdparty/bgfx/src/image.h | 31 +- 3rdparty/bgfx/src/renderer_d3d11.cpp | 66 +- 3rdparty/bgfx/src/renderer_d3d11.h | 1 + 3rdparty/bgfx/src/renderer_d3d12.cpp | 25 +- 3rdparty/bgfx/src/renderer_d3d9.cpp | 213 +- 3rdparty/bgfx/src/renderer_d3d9.h | 12 +- 3rdparty/bgfx/src/renderer_gl.cpp | 158 +- 3rdparty/bgfx/src/renderer_gl.h | 19 +- 3rdparty/bgfx/src/renderer_mtl.mm | 28 +- 3rdparty/bgfx/src/renderer_null.cpp | 9 + 3rdparty/bgfx/src/shader_dx9bc.cpp | 3 +- 3rdparty/bgfx/src/shader_dxbc.cpp | 3 +- 3rdparty/bgfx/tools/geometryc/geometryc.cpp | 6 +- 3rdparty/bgfx/tools/makedisttex.cpp | 195 -- 3rdparty/bgfx/tools/shaderc/shaderc.cpp | 2853 ++++++++++---------- 3rdparty/bgfx/tools/shaderc/shaderc.h | 134 +- 3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp | 354 +-- 3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp | 1185 ++++---- 3rdparty/bgfx/tools/texturec/texturec.cpp | 362 ++- 3rdparty/bx/.appveyor.yml | 21 + 3rdparty/bx/.travis.yml | 20 + 3rdparty/bx/README.md | 3 + 3rdparty/bx/include/bx/bx.h | 27 + 3rdparty/bx/include/bx/config.h | 1 + 3rdparty/bx/include/bx/error.h | 111 + 3rdparty/bx/include/bx/fpumath.h | 18 +- 3rdparty/bx/include/bx/handlealloc.h | 2 +- 3rdparty/bx/include/bx/os.h | 15 +- 3rdparty/bx/include/bx/platform.h | 36 +- 3rdparty/bx/include/bx/readerwriter.h | 159 +- 3rdparty/bx/makefile | 5 + 3rdparty/bx/scripts/genie.lua | 8 +- 3rdparty/bx/scripts/toolchain.lua | 103 +- 3rdparty/bx/tools/bin/darwin/genie | Bin 422176 -> 422176 bytes 3rdparty/bx/tools/bin/linux/genie | Bin 396856 -> 396856 bytes 3rdparty/bx/tools/bin/windows/genie.exe | Bin 399872 -> 400384 bytes 3rdparty/bx/tools/bin2c/bin2c.cpp | 6 +- 380 files changed, 7507 insertions(+), 3883 deletions(-) create mode 100644 3rdparty/bgfx/.appveyor.yml create mode 100644 3rdparty/bgfx/.travis.yml create mode 100644 3rdparty/bgfx/3rdparty/etc2/LICENSE.txt create mode 100644 3rdparty/bgfx/3rdparty/etc2/Math.hpp create mode 100644 3rdparty/bgfx/3rdparty/etc2/ProcessCommon.hpp create mode 100644 3rdparty/bgfx/3rdparty/etc2/ProcessRGB.cpp create mode 100644 3rdparty/bgfx/3rdparty/etc2/ProcessRGB.hpp create mode 100644 3rdparty/bgfx/3rdparty/etc2/Tables.cpp create mode 100644 3rdparty/bgfx/3rdparty/etc2/Tables.hpp create mode 100644 3rdparty/bgfx/3rdparty/etc2/Types.hpp create mode 100644 3rdparty/bgfx/3rdparty/etc2/Vector.hpp delete mode 100644 3rdparty/bgfx/scripts/makedisttex.lua delete mode 100644 3rdparty/bgfx/tools/makedisttex.cpp create mode 100644 3rdparty/bx/.appveyor.yml create mode 100644 3rdparty/bx/.travis.yml create mode 100644 3rdparty/bx/include/bx/error.h diff --git a/3rdparty/bgfx/.appveyor.yml b/3rdparty/bgfx/.appveyor.yml new file mode 100644 index 00000000000..852cf22cf98 --- /dev/null +++ b/3rdparty/bgfx/.appveyor.yml @@ -0,0 +1,22 @@ +shallow_clone: true + +os: + - Visual Studio 2015 + +environment: + matrix: + - TOOLSET: vs2010 + - TOOLSET: vs2012 + - TOOLSET: vs2013 + - TOOLSET: vs2015 + +configuration: + - Debug + - Release + +install: + - git clone https://github.com/bkaradzic/bx ..\bx + - ..\bx\tools\bin\windows\genie --with-tools %TOOLSET% + +build: + project: .build/projects/$(TOOLSET)/bgfx.sln diff --git a/3rdparty/bgfx/.travis.yml b/3rdparty/bgfx/.travis.yml new file mode 100644 index 00000000000..8c081703032 --- /dev/null +++ b/3rdparty/bgfx/.travis.yml @@ -0,0 +1,22 @@ +language: cpp +matrix: + include: + - compiler: gcc + os: linux + - compiler: clang + os: osx + +before_script: + git clone https://github.com/bkaradzic/bx ../bx + +script: + make build + +branches: + only: + - master + +notifications: + email: false + +osx_image: xcode7.3 diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h index 17e646e0773..7daa83b3604 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h @@ -42,6 +42,7 @@ #define VS2008_SAL_COMPAT // BK - SAL compatibility for VS2008 +#if _MSC_VER < 1600 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \ extern "C++" { \ inline ENUMTYPE operator | (ENUMTYPE _a, ENUMTYPE _b) { return ENUMTYPE ( ( (int) _a) | ( (int)_b) ); } \ @@ -52,6 +53,7 @@ inline ENUMTYPE operator ^ (ENUMTYPE _a, ENUMTYPE _b) { return ENUMTYPE ( ( (int) _a) ^ ( (int)_b) ); } \ inline ENUMTYPE operator ^= (ENUMTYPE &_a, ENUMTYPE _b) { return (ENUMTYPE &)( ( (int &)_a) ^= ( (int)_b) ); } \ } +#endif // _MSC_VER < 1600 #undef _Out_ #define _Out_ diff --git a/3rdparty/bgfx/3rdparty/etc2/LICENSE.txt b/3rdparty/bgfx/3rdparty/etc2/LICENSE.txt new file mode 100644 index 00000000000..2254f9ece88 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/etc2/LICENSE.txt @@ -0,0 +1,24 @@ +Copyright (c) 2013, Bartosz Taudul +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3rdparty/bgfx/3rdparty/etc2/Math.hpp b/3rdparty/bgfx/3rdparty/etc2/Math.hpp new file mode 100644 index 00000000000..3a92a2e7317 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/etc2/Math.hpp @@ -0,0 +1,90 @@ +#ifndef __DARKRL__MATH_HPP__ +#define __DARKRL__MATH_HPP__ + +#include +#include + +#include "Types.hpp" + +template +inline T AlignPOT( T val ) +{ + if( val == 0 ) return 1; + val--; + for( unsigned int i=1; i> i; + } + return val + 1; +} + +inline int CountSetBits( uint32 val ) +{ + val -= ( val >> 1 ) & 0x55555555; + val = ( ( val >> 2 ) & 0x33333333 ) + ( val & 0x33333333 ); + val = ( ( val >> 4 ) + val ) & 0x0f0f0f0f; + val += val >> 8; + val += val >> 16; + return val & 0x0000003f; +} + +inline int CountLeadingZeros( uint32 val ) +{ + val |= val >> 1; + val |= val >> 2; + val |= val >> 4; + val |= val >> 8; + val |= val >> 16; + return 32 - CountSetBits( val ); +} + +inline float sRGB2linear( float v ) +{ + const float a = 0.055f; + if( v <= 0.04045f ) + { + return v / 12.92f; + } + else + { + return powf( ( v + a ) / ( 1 + a ), 2.4f ); + } +} + +inline float linear2sRGB( float v ) +{ + const float a = 0.055f; + if( v <= 0.0031308f ) + { + return 12.92f * v; + } + else + { + return ( 1 + a ) * pow( v, 1/2.4f ) - a; + } +} + +template +inline T SmoothStep( T x ) +{ + return x*x*(3-2*x); +} + +inline uint8 clampu8( int32 val ) +{ + return std::min( std::max( 0, val ), 255 ); +} + +template +inline T sq( T val ) +{ + return val * val; +} + +static inline int mul8bit( int a, int b ) +{ + int t = a*b + 128; + return ( t + ( t >> 8 ) ) >> 8; +} + +#endif diff --git a/3rdparty/bgfx/3rdparty/etc2/ProcessCommon.hpp b/3rdparty/bgfx/3rdparty/etc2/ProcessCommon.hpp new file mode 100644 index 00000000000..7e6addbcdc2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/etc2/ProcessCommon.hpp @@ -0,0 +1,51 @@ +#ifndef __PROCESSCOMMON_HPP__ +#define __PROCESSCOMMON_HPP__ + +#include +#include + +#include "Types.hpp" + +template +static size_t GetLeastError( const T* err, size_t num ) +{ + size_t idx = 0; + for( size_t i=1; i> 24 ) | + ( ( d & 0x000000FF00000000 ) << 24 ) | + ( ( d & 0x00FF000000000000 ) >> 8 ) | + ( ( d & 0x0000FF0000000000 ) << 8 ); +} + +template +static uint64 EncodeSelectors( uint64 d, const T terr[2][8], const S tsel[16][8], const uint32* id ) +{ + size_t tidx[2]; + tidx[0] = GetLeastError( terr[0], 8 ); + tidx[1] = GetLeastError( terr[1], 8 ); + + d |= tidx[0] << 26; + d |= tidx[1] << 29; + for( int i=0; i<16; i++ ) + { + uint64 t = tsel[i][tidx[id[i]%2]]; + d |= ( t & 0x1 ) << ( i + 32 ); + d |= ( t & 0x2 ) << ( i + 47 ); + } + + return d; +} + +#endif diff --git a/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.cpp b/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.cpp new file mode 100644 index 00000000000..de03845c838 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.cpp @@ -0,0 +1,719 @@ +#include + +#include "Math.hpp" +#include "ProcessCommon.hpp" +#include "ProcessRGB.hpp" +#include "Tables.hpp" +#include "Types.hpp" +#include "Vector.hpp" + +#include + +#ifdef __SSE4_1__ +# ifdef _MSC_VER +# include +# include +# else +# include +# endif +#endif + +namespace +{ + +typedef uint16 v4i[4]; + +void Average( const uint8* data, v4i* a ) +{ +#ifdef __SSE4_1__ + __m128i d0 = _mm_loadu_si128(((__m128i*)data) + 0); + __m128i d1 = _mm_loadu_si128(((__m128i*)data) + 1); + __m128i d2 = _mm_loadu_si128(((__m128i*)data) + 2); + __m128i d3 = _mm_loadu_si128(((__m128i*)data) + 3); + + __m128i d0l = _mm_unpacklo_epi8(d0, _mm_setzero_si128()); + __m128i d0h = _mm_unpackhi_epi8(d0, _mm_setzero_si128()); + __m128i d1l = _mm_unpacklo_epi8(d1, _mm_setzero_si128()); + __m128i d1h = _mm_unpackhi_epi8(d1, _mm_setzero_si128()); + __m128i d2l = _mm_unpacklo_epi8(d2, _mm_setzero_si128()); + __m128i d2h = _mm_unpackhi_epi8(d2, _mm_setzero_si128()); + __m128i d3l = _mm_unpacklo_epi8(d3, _mm_setzero_si128()); + __m128i d3h = _mm_unpackhi_epi8(d3, _mm_setzero_si128()); + + __m128i sum0 = _mm_add_epi16(d0l, d1l); + __m128i sum1 = _mm_add_epi16(d0h, d1h); + __m128i sum2 = _mm_add_epi16(d2l, d3l); + __m128i sum3 = _mm_add_epi16(d2h, d3h); + + __m128i sum0l = _mm_unpacklo_epi16(sum0, _mm_setzero_si128()); + __m128i sum0h = _mm_unpackhi_epi16(sum0, _mm_setzero_si128()); + __m128i sum1l = _mm_unpacklo_epi16(sum1, _mm_setzero_si128()); + __m128i sum1h = _mm_unpackhi_epi16(sum1, _mm_setzero_si128()); + __m128i sum2l = _mm_unpacklo_epi16(sum2, _mm_setzero_si128()); + __m128i sum2h = _mm_unpackhi_epi16(sum2, _mm_setzero_si128()); + __m128i sum3l = _mm_unpacklo_epi16(sum3, _mm_setzero_si128()); + __m128i sum3h = _mm_unpackhi_epi16(sum3, _mm_setzero_si128()); + + __m128i b0 = _mm_add_epi32(sum0l, sum0h); + __m128i b1 = _mm_add_epi32(sum1l, sum1h); + __m128i b2 = _mm_add_epi32(sum2l, sum2h); + __m128i b3 = _mm_add_epi32(sum3l, sum3h); + + __m128i a0 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b2, b3), _mm_set1_epi32(4)), 3); + __m128i a1 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b0, b1), _mm_set1_epi32(4)), 3); + __m128i a2 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b1, b3), _mm_set1_epi32(4)), 3); + __m128i a3 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b0, b2), _mm_set1_epi32(4)), 3); + + _mm_storeu_si128((__m128i*)&a[0], _mm_packus_epi32(_mm_shuffle_epi32(a0, _MM_SHUFFLE(3, 0, 1, 2)), _mm_shuffle_epi32(a1, _MM_SHUFFLE(3, 0, 1, 2)))); + _mm_storeu_si128((__m128i*)&a[2], _mm_packus_epi32(_mm_shuffle_epi32(a2, _MM_SHUFFLE(3, 0, 1, 2)), _mm_shuffle_epi32(a3, _MM_SHUFFLE(3, 0, 1, 2)))); +#else + uint32 r[4]; + uint32 g[4]; + uint32 b[4]; + + memset(r, 0, sizeof(r)); + memset(g, 0, sizeof(g)); + memset(b, 0, sizeof(b)); + + for( int j=0; j<4; j++ ) + { + for( int i=0; i<4; i++ ) + { + int index = (j & 2) + (i >> 1); + b[index] += *data++; + g[index] += *data++; + r[index] += *data++; + data++; + } + } + + a[0][0] = uint16( (r[2] + r[3] + 4) / 8 ); + a[0][1] = uint16( (g[2] + g[3] + 4) / 8 ); + a[0][2] = uint16( (b[2] + b[3] + 4) / 8 ); + a[0][3] = 0; + a[1][0] = uint16( (r[0] + r[1] + 4) / 8 ); + a[1][1] = uint16( (g[0] + g[1] + 4) / 8 ); + a[1][2] = uint16( (b[0] + b[1] + 4) / 8 ); + a[1][3] = 0; + a[2][0] = uint16( (r[1] + r[3] + 4) / 8 ); + a[2][1] = uint16( (g[1] + g[3] + 4) / 8 ); + a[2][2] = uint16( (b[1] + b[3] + 4) / 8 ); + a[2][3] = 0; + a[3][0] = uint16( (r[0] + r[2] + 4) / 8 ); + a[3][1] = uint16( (g[0] + g[2] + 4) / 8 ); + a[3][2] = uint16( (b[0] + b[2] + 4) / 8 ); + a[3][3] = 0; +#endif +} + +void CalcErrorBlock( const uint8* data, uint err[4][4] ) +{ +#ifdef __SSE4_1__ + __m128i d0 = _mm_loadu_si128(((__m128i*)data) + 0); + __m128i d1 = _mm_loadu_si128(((__m128i*)data) + 1); + __m128i d2 = _mm_loadu_si128(((__m128i*)data) + 2); + __m128i d3 = _mm_loadu_si128(((__m128i*)data) + 3); + + __m128i dm0 = _mm_and_si128(d0, _mm_set1_epi32(0x00FFFFFF)); + __m128i dm1 = _mm_and_si128(d1, _mm_set1_epi32(0x00FFFFFF)); + __m128i dm2 = _mm_and_si128(d2, _mm_set1_epi32(0x00FFFFFF)); + __m128i dm3 = _mm_and_si128(d3, _mm_set1_epi32(0x00FFFFFF)); + + __m128i d0l = _mm_unpacklo_epi8(dm0, _mm_setzero_si128()); + __m128i d0h = _mm_unpackhi_epi8(dm0, _mm_setzero_si128()); + __m128i d1l = _mm_unpacklo_epi8(dm1, _mm_setzero_si128()); + __m128i d1h = _mm_unpackhi_epi8(dm1, _mm_setzero_si128()); + __m128i d2l = _mm_unpacklo_epi8(dm2, _mm_setzero_si128()); + __m128i d2h = _mm_unpackhi_epi8(dm2, _mm_setzero_si128()); + __m128i d3l = _mm_unpacklo_epi8(dm3, _mm_setzero_si128()); + __m128i d3h = _mm_unpackhi_epi8(dm3, _mm_setzero_si128()); + + __m128i sum0 = _mm_add_epi16(d0l, d1l); + __m128i sum1 = _mm_add_epi16(d0h, d1h); + __m128i sum2 = _mm_add_epi16(d2l, d3l); + __m128i sum3 = _mm_add_epi16(d2h, d3h); + + __m128i sum0l = _mm_unpacklo_epi16(sum0, _mm_setzero_si128()); + __m128i sum0h = _mm_unpackhi_epi16(sum0, _mm_setzero_si128()); + __m128i sum1l = _mm_unpacklo_epi16(sum1, _mm_setzero_si128()); + __m128i sum1h = _mm_unpackhi_epi16(sum1, _mm_setzero_si128()); + __m128i sum2l = _mm_unpacklo_epi16(sum2, _mm_setzero_si128()); + __m128i sum2h = _mm_unpackhi_epi16(sum2, _mm_setzero_si128()); + __m128i sum3l = _mm_unpacklo_epi16(sum3, _mm_setzero_si128()); + __m128i sum3h = _mm_unpackhi_epi16(sum3, _mm_setzero_si128()); + + __m128i b0 = _mm_add_epi32(sum0l, sum0h); + __m128i b1 = _mm_add_epi32(sum1l, sum1h); + __m128i b2 = _mm_add_epi32(sum2l, sum2h); + __m128i b3 = _mm_add_epi32(sum3l, sum3h); + + __m128i a0 = _mm_add_epi32(b2, b3); + __m128i a1 = _mm_add_epi32(b0, b1); + __m128i a2 = _mm_add_epi32(b1, b3); + __m128i a3 = _mm_add_epi32(b0, b2); + + _mm_storeu_si128((__m128i*)&err[0], a0); + _mm_storeu_si128((__m128i*)&err[1], a1); + _mm_storeu_si128((__m128i*)&err[2], a2); + _mm_storeu_si128((__m128i*)&err[3], a3); +#else + uint terr[4][4]; + + memset(terr, 0, 16 * sizeof(uint)); + + for( int j=0; j<4; j++ ) + { + for( int i=0; i<4; i++ ) + { + int index = (j & 2) + (i >> 1); + uint d = *data++; + terr[index][0] += d; + d = *data++; + terr[index][1] += d; + d = *data++; + terr[index][2] += d; + data++; + } + } + + for( int i=0; i<3; i++ ) + { + err[0][i] = terr[2][i] + terr[3][i]; + err[1][i] = terr[0][i] + terr[1][i]; + err[2][i] = terr[1][i] + terr[3][i]; + err[3][i] = terr[0][i] + terr[2][i]; + } + for( int i=0; i<4; i++ ) + { + err[i][3] = 0; + } +#endif +} + +uint CalcError( const uint block[4], const v4i& average ) +{ + uint err = 0x3FFFFFFF; // Big value to prevent negative values, but small enough to prevent overflow + err -= block[0] * 2 * average[2]; + err -= block[1] * 2 * average[1]; + err -= block[2] * 2 * average[0]; + err += 8 * ( sq( average[0] ) + sq( average[1] ) + sq( average[2] ) ); + return err; +} + +void ProcessAverages( v4i* a ) +{ +#ifdef __SSE4_1__ + for( int i=0; i<2; i++ ) + { + __m128i d = _mm_loadu_si128((__m128i*)a[i*2].data()); + + __m128i t = _mm_add_epi16(_mm_mullo_epi16(d, _mm_set1_epi16(31)), _mm_set1_epi16(128)); + + __m128i c = _mm_srli_epi16(_mm_add_epi16(t, _mm_srli_epi16(t, 8)), 8); + + __m128i c1 = _mm_shuffle_epi32(c, _MM_SHUFFLE(3, 2, 3, 2)); + __m128i diff = _mm_sub_epi16(c, c1); + diff = _mm_max_epi16(diff, _mm_set1_epi16(-4)); + diff = _mm_min_epi16(diff, _mm_set1_epi16(3)); + + __m128i co = _mm_add_epi16(c1, diff); + + c = _mm_blend_epi16(co, c, 0xF0); + + __m128i a0 = _mm_or_si128(_mm_slli_epi16(c, 3), _mm_srli_epi16(c, 2)); + + _mm_storeu_si128((__m128i*)a[4+i*2].data(), a0); + } + + for( int i=0; i<2; i++ ) + { + __m128i d = _mm_loadu_si128((__m128i*)a[i*2].data()); + + __m128i t0 = _mm_add_epi16(_mm_mullo_epi16(d, _mm_set1_epi16(15)), _mm_set1_epi16(128)); + __m128i t1 = _mm_srli_epi16(_mm_add_epi16(t0, _mm_srli_epi16(t0, 8)), 8); + + __m128i t2 = _mm_or_si128(t1, _mm_slli_epi16(t1, 4)); + + _mm_storeu_si128((__m128i*)a[i*2].data(), t2); + } +#else + for( int i=0; i<2; i++ ) + { + for( int j=0; j<3; j++ ) + { + int32 c1 = mul8bit( a[i*2+1][j], 31 ); + int32 c2 = mul8bit( a[i*2][j], 31 ); + + int32 diff = c2 - c1; + if( diff > 3 ) diff = 3; + else if( diff < -4 ) diff = -4; + + int32 co = c1 + diff; + + a[5+i*2][j] = ( c1 << 3 ) | ( c1 >> 2 ); + a[4+i*2][j] = ( co << 3 ) | ( co >> 2 ); + } + } + + for( int i=0; i<4; i++ ) + { + a[i][0] = g_avg2[mul8bit( a[i][0], 15 )]; + a[i][1] = g_avg2[mul8bit( a[i][1], 15 )]; + a[i][2] = g_avg2[mul8bit( a[i][2], 15 )]; + } +#endif +} + +void EncodeAverages( uint64& _d, const v4i* a, size_t idx ) +{ + uint64 d = _d; + d |= ( idx << 24 ); + size_t base = idx << 1; + + if( ( idx & 0x2 ) == 0 ) + { + for( int i=0; i<3; i++ ) + { + d |= uint64( a[base+0][i] >> 4 ) << ( i*8 ); + d |= uint64( a[base+1][i] >> 4 ) << ( i*8 + 4 ); + } + } + else + { + for( int i=0; i<3; i++ ) + { + d |= uint64( a[base+1][i] & 0xF8 ) << ( i*8 ); + int32 c = ( ( a[base+0][i] & 0xF8 ) - ( a[base+1][i] & 0xF8 ) ) >> 3; + c &= ~0xFFFFFFF8; + d |= ((uint64)c) << ( i*8 ); + } + } + _d = d; +} + +uint64 CheckSolid( const uint8* src ) +{ +#ifdef __SSE4_1__ + __m128i d0 = _mm_loadu_si128(((__m128i*)src) + 0); + __m128i d1 = _mm_loadu_si128(((__m128i*)src) + 1); + __m128i d2 = _mm_loadu_si128(((__m128i*)src) + 2); + __m128i d3 = _mm_loadu_si128(((__m128i*)src) + 3); + + __m128i c = _mm_shuffle_epi32(d0, _MM_SHUFFLE(0, 0, 0, 0)); + + __m128i c0 = _mm_cmpeq_epi8(d0, c); + __m128i c1 = _mm_cmpeq_epi8(d1, c); + __m128i c2 = _mm_cmpeq_epi8(d2, c); + __m128i c3 = _mm_cmpeq_epi8(d3, c); + + __m128i m0 = _mm_and_si128(c0, c1); + __m128i m1 = _mm_and_si128(c2, c3); + __m128i m = _mm_and_si128(m0, m1); + + if (!_mm_testc_si128(m, _mm_set1_epi32(-1))) + { + return 0; + } +#else + const uint8* ptr = src + 4; + for( int i=1; i<16; i++ ) + { + if( memcmp( src, ptr, 4 ) != 0 ) + { + return 0; + } + ptr += 4; + } +#endif + return 0x02000000 | + ( uint( src[0] & 0xF8 ) << 16 ) | + ( uint( src[1] & 0xF8 ) << 8 ) | + ( uint( src[2] & 0xF8 ) ); +} + +void PrepareAverages( v4i a[8], const uint8* src, uint err[4] ) +{ + Average( src, a ); + ProcessAverages( a ); + + uint errblock[4][4]; + CalcErrorBlock( src, errblock ); + + for( int i=0; i<4; i++ ) + { + err[i/2] += CalcError( errblock[i], a[i] ); + err[2+i/2] += CalcError( errblock[i], a[i+4] ); + } +} + +void FindBestFit( uint64 terr[2][8], uint16 tsel[16][8], v4i a[8], const uint32* id, const uint8* data ) +{ + for( size_t i=0; i<16; i++ ) + { + uint16* sel = tsel[i]; + uint bid = id[i]; + uint64* ter = terr[bid%2]; + + uint8 b = *data++; + uint8 g = *data++; + uint8 r = *data++; + data++; + + int dr = a[bid][0] - r; + int dg = a[bid][1] - g; + int db = a[bid][2] - b; + +#ifdef __SSE4_1__ + // Reference implementation + + __m128i pix = _mm_set1_epi32(dr * 77 + dg * 151 + db * 28); + // Taking the absolute value is way faster. The values are only used to sort, so the result will be the same. + __m128i error0 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[0])); + __m128i error1 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[1])); + __m128i error2 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[0])); + __m128i error3 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[1])); + + __m128i index0 = _mm_and_si128(_mm_cmplt_epi32(error1, error0), _mm_set1_epi32(1)); + __m128i minError0 = _mm_min_epi32(error0, error1); + + __m128i index1 = _mm_sub_epi32(_mm_set1_epi32(2), _mm_cmplt_epi32(error3, error2)); + __m128i minError1 = _mm_min_epi32(error2, error3); + + __m128i minIndex0 = _mm_blendv_epi8(index0, index1, _mm_cmplt_epi32(minError1, minError0)); + __m128i minError = _mm_min_epi32(minError0, minError1); + + // Squaring the minimum error to produce correct values when adding + __m128i minErrorLow = _mm_shuffle_epi32(minError, _MM_SHUFFLE(1, 1, 0, 0)); + __m128i squareErrorLow = _mm_mul_epi32(minErrorLow, minErrorLow); + squareErrorLow = _mm_add_epi64(squareErrorLow, _mm_loadu_si128(((__m128i*)ter) + 0)); + _mm_storeu_si128(((__m128i*)ter) + 0, squareErrorLow); + __m128i minErrorHigh = _mm_shuffle_epi32(minError, _MM_SHUFFLE(3, 3, 2, 2)); + __m128i squareErrorHigh = _mm_mul_epi32(minErrorHigh, minErrorHigh); + squareErrorHigh = _mm_add_epi64(squareErrorHigh, _mm_loadu_si128(((__m128i*)ter) + 1)); + _mm_storeu_si128(((__m128i*)ter) + 1, squareErrorHigh); + + // Taking the absolute value is way faster. The values are only used to sort, so the result will be the same. + error0 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[2])); + error1 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[3])); + error2 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[2])); + error3 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[3])); + + index0 = _mm_and_si128(_mm_cmplt_epi32(error1, error0), _mm_set1_epi32(1)); + minError0 = _mm_min_epi32(error0, error1); + + index1 = _mm_sub_epi32(_mm_set1_epi32(2), _mm_cmplt_epi32(error3, error2)); + minError1 = _mm_min_epi32(error2, error3); + + __m128i minIndex1 = _mm_blendv_epi8(index0, index1, _mm_cmplt_epi32(minError1, minError0)); + minError = _mm_min_epi32(minError0, minError1); + + // Squaring the minimum error to produce correct values when adding + minErrorLow = _mm_shuffle_epi32(minError, _MM_SHUFFLE(1, 1, 0, 0)); + squareErrorLow = _mm_mul_epi32(minErrorLow, minErrorLow); + squareErrorLow = _mm_add_epi64(squareErrorLow, _mm_loadu_si128(((__m128i*)ter) + 2)); + _mm_storeu_si128(((__m128i*)ter) + 2, squareErrorLow); + minErrorHigh = _mm_shuffle_epi32(minError, _MM_SHUFFLE(3, 3, 2, 2)); + squareErrorHigh = _mm_mul_epi32(minErrorHigh, minErrorHigh); + squareErrorHigh = _mm_add_epi64(squareErrorHigh, _mm_loadu_si128(((__m128i*)ter) + 3)); + _mm_storeu_si128(((__m128i*)ter) + 3, squareErrorHigh); + __m128i minIndex = _mm_packs_epi32(minIndex0, minIndex1); + _mm_storeu_si128((__m128i*)sel, minIndex); +#else + int pix = dr * 77 + dg * 151 + db * 28; + + for( int t=0; t<8; t++ ) + { + const int64* tab = g_table256[t]; + uint idx = 0; + uint64 err = sq( tab[0] + pix ); + for( int j=1; j<4; j++ ) + { + uint64 local = sq( tab[j] + pix ); + if( local < err ) + { + err = local; + idx = j; + } + } + *sel++ = idx; + *ter++ += err; + } +#endif + } +} + +#ifdef __SSE4_1__ +// Non-reference implementation, but faster. Produces same results as the AVX2 version +void FindBestFit( uint32 terr[2][8], uint16 tsel[16][8], v4i a[8], const uint32* id, const uint8* data ) +{ + for( size_t i=0; i<16; i++ ) + { + uint16* sel = tsel[i]; + uint bid = id[i]; + uint32* ter = terr[bid%2]; + + uint8 b = *data++; + uint8 g = *data++; + uint8 r = *data++; + data++; + + int dr = a[bid][0] - r; + int dg = a[bid][1] - g; + int db = a[bid][2] - b; + + // The scaling values are divided by two and rounded, to allow the differences to be in the range of signed int16 + // This produces slightly different results, but is significant faster + __m128i pixel = _mm_set1_epi16(dr * 38 + dg * 76 + db * 14); + __m128i pix = _mm_abs_epi16(pixel); + + // Taking the absolute value is way faster. The values are only used to sort, so the result will be the same. + // Since the selector table is symmetrical, we need to calculate the difference only for half of the entries. + __m128i error0 = _mm_abs_epi16(_mm_sub_epi16(pix, g_table128_SIMD[0])); + __m128i error1 = _mm_abs_epi16(_mm_sub_epi16(pix, g_table128_SIMD[1])); + + __m128i index = _mm_and_si128(_mm_cmplt_epi16(error1, error0), _mm_set1_epi16(1)); + __m128i minError = _mm_min_epi16(error0, error1); + + // Exploiting symmetry of the selector table and use the sign bit + // This produces slightly different results, but is needed to produce same results as AVX2 implementation + __m128i indexBit = _mm_andnot_si128(_mm_srli_epi16(pixel, 15), _mm_set1_epi8(-1)); + __m128i minIndex = _mm_or_si128(index, _mm_add_epi16(indexBit, indexBit)); + + // Squaring the minimum error to produce correct values when adding + __m128i squareErrorLo = _mm_mullo_epi16(minError, minError); + __m128i squareErrorHi = _mm_mulhi_epi16(minError, minError); + + __m128i squareErrorLow = _mm_unpacklo_epi16(squareErrorLo, squareErrorHi); + __m128i squareErrorHigh = _mm_unpackhi_epi16(squareErrorLo, squareErrorHi); + + squareErrorLow = _mm_add_epi32(squareErrorLow, _mm_loadu_si128(((__m128i*)ter) + 0)); + _mm_storeu_si128(((__m128i*)ter) + 0, squareErrorLow); + squareErrorHigh = _mm_add_epi32(squareErrorHigh, _mm_loadu_si128(((__m128i*)ter) + 1)); + _mm_storeu_si128(((__m128i*)ter) + 1, squareErrorHigh); + + _mm_storeu_si128((__m128i*)sel, minIndex); + } +} +#endif + +uint8_t convert6(float f) +{ + int i = (std::min(std::max(static_cast(f), 0), 1023) - 15) >> 1; + return (i + 11 - ((i + 11) >> 7) - ((i + 4) >> 7)) >> 3; +} + +uint8_t convert7(float f) +{ + int i = (std::min(std::max(static_cast(f), 0), 1023) - 15) >> 1; + return (i + 9 - ((i + 9) >> 8) - ((i + 6) >> 8)) >> 2; +} + +std::pair Planar(const uint8* src) +{ + int32 r = 0; + int32 g = 0; + int32 b = 0; + + for (int i = 0; i < 16; ++i) + { + b += src[i * 4 + 0]; + g += src[i * 4 + 1]; + r += src[i * 4 + 2]; + } + + int32 difRyz = 0; + int32 difGyz = 0; + int32 difByz = 0; + int32 difRxz = 0; + int32 difGxz = 0; + int32 difBxz = 0; + + const int32 scaling[] = { -255, -85, 85, 255 }; + + for (int i = 0; i < 16; ++i) + { + int32 difB = (static_cast(src[i * 4 + 0]) << 4) - b; + int32 difG = (static_cast(src[i * 4 + 1]) << 4) - g; + int32 difR = (static_cast(src[i * 4 + 2]) << 4) - r; + + difRyz += difR * scaling[i % 4]; + difGyz += difG * scaling[i % 4]; + difByz += difB * scaling[i % 4]; + + difRxz += difR * scaling[i / 4]; + difGxz += difG * scaling[i / 4]; + difBxz += difB * scaling[i / 4]; + } + + const float scale = -4.0f / ((255 * 255 * 8.0f + 85 * 85 * 8.0f) * 16.0f); + + float aR = difRxz * scale; + float aG = difGxz * scale; + float aB = difBxz * scale; + + float bR = difRyz * scale; + float bG = difGyz * scale; + float bB = difByz * scale; + + float dR = r * (4.0f / 16.0f); + float dG = g * (4.0f / 16.0f); + float dB = b * (4.0f / 16.0f); + + // calculating the three colors RGBO, RGBH, and RGBV. RGB = df - af * x - bf * y; + float cofR = (aR * 255.0f + (bR * 255.0f + dR)); + float cofG = (aG * 255.0f + (bG * 255.0f + dG)); + float cofB = (aB * 255.0f + (bB * 255.0f + dB)); + float chfR = (aR * -425.0f + (bR * 255.0f + dR)); + float chfG = (aG * -425.0f + (bG * 255.0f + dG)); + float chfB = (aB * -425.0f + (bB * 255.0f + dB)); + float cvfR = (aR * 255.0f + (bR * -425.0f + dR)); + float cvfG = (aG * 255.0f + (bG * -425.0f + dG)); + float cvfB = (aB * 255.0f + (bB * -425.0f + dB)); + + // convert to r6g7b6 + int32 coR = convert6(cofR); + int32 coG = convert7(cofG); + int32 coB = convert6(cofB); + int32 chR = convert6(chfR); + int32 chG = convert7(chfG); + int32 chB = convert6(chfB); + int32 cvR = convert6(cvfR); + int32 cvG = convert7(cvfG); + int32 cvB = convert6(cvfB); + + // Error calculation + int32 ro0 = coR; + int32 go0 = coG; + int32 bo0 = coB; + int32 ro1 = (ro0 >> 4) | (ro0 << 2); + int32 go1 = (go0 >> 6) | (go0 << 1); + int32 bo1 = (bo0 >> 4) | (bo0 << 2); + int32 ro2 = (ro1 << 2) + 2; + int32 go2 = (go1 << 2) + 2; + int32 bo2 = (bo1 << 2) + 2; + + int32 rh0 = chR; + int32 gh0 = chG; + int32 bh0 = chB; + int32 rh1 = (rh0 >> 4) | (rh0 << 2); + int32 gh1 = (gh0 >> 6) | (gh0 << 1); + int32 bh1 = (bh0 >> 4) | (bh0 << 2); + + int32 rh2 = rh1 - ro1; + int32 gh2 = gh1 - go1; + int32 bh2 = bh1 - bo1; + + int32 rv0 = cvR; + int32 gv0 = cvG; + int32 bv0 = cvB; + int32 rv1 = (rv0 >> 4) | (rv0 << 2); + int32 gv1 = (gv0 >> 6) | (gv0 << 1); + int32 bv1 = (bv0 >> 4) | (bv0 << 2); + + int32 rv2 = rv1 - ro1; + int32 gv2 = gv1 - go1; + int32 bv2 = bv1 - bo1; + + uint64 error = 0; + + for (int i = 0; i < 16; ++i) + { + int32 cR = clampu8((rh2 * (i / 4) + rv2 * (i % 4) + ro2) >> 2); + int32 cG = clampu8((gh2 * (i / 4) + gv2 * (i % 4) + go2) >> 2); + int32 cB = clampu8((bh2 * (i / 4) + bv2 * (i % 4) + bo2) >> 2); + + int32 difB = static_cast(src[i * 4 + 0]) - cB; + int32 difG = static_cast(src[i * 4 + 1]) - cG; + int32 difR = static_cast(src[i * 4 + 2]) - cR; + + int32 dif = difR * 38 + difG * 76 + difB * 14; + + error += dif * dif; + } + + /**/ + uint32 rgbv = cvB | (cvG << 6) | (cvR << 13); + uint32 rgbh = chB | (chG << 6) | (chR << 13); + uint32 hi = rgbv | ((rgbh & 0x1FFF) << 19); + uint32 lo = (chR & 0x1) | 0x2 | ((chR << 1) & 0x7C); + lo |= ((coB & 0x07) << 7) | ((coB & 0x18) << 8) | ((coB & 0x20) << 11); + lo |= ((coG & 0x3F) << 17) | ((coG & 0x40) << 18); + lo |= coR << 25; + + const int32 idx = (coR & 0x20) | ((coG & 0x20) >> 1) | ((coB & 0x1E) >> 1); + + lo |= g_flags[idx]; + + uint64 result = static_cast(bx::endianSwap(lo)); + result |= static_cast(static_cast(bx::endianSwap(hi))) << 32; + + return std::make_pair(result, error); +} + +template +uint64 EncodeSelectors( uint64 d, const T terr[2][8], const S tsel[16][8], const uint32* id, const uint64 value, const uint64 error) +{ + size_t tidx[2]; + tidx[0] = GetLeastError( terr[0], 8 ); + tidx[1] = GetLeastError( terr[1], 8 ); + + if ((terr[0][tidx[0]] + terr[1][tidx[1]]) >= error) + { + return value; + } + + d |= tidx[0] << 26; + d |= tidx[1] << 29; + for( int i=0; i<16; i++ ) + { + uint64 t = tsel[i][tidx[id[i]%2]]; + d |= ( t & 0x1 ) << ( i + 32 ); + d |= ( t & 0x2 ) << ( i + 47 ); + } + + return FixByteOrder(d); +} +} + +uint64 ProcessRGB( const uint8* src ) +{ + uint64 d = CheckSolid( src ); + if( d != 0 ) return d; + + v4i a[8]; + uint err[4] = {}; + PrepareAverages( a, src, err ); + size_t idx = GetLeastError( err, 4 ); + EncodeAverages( d, a, idx ); + +#if defined __SSE4_1__ && !defined REFERENCE_IMPLEMENTATION + uint32 terr[2][8] = {}; +#else + uint64 terr[2][8] = {}; +#endif + uint16 tsel[16][8]; + const uint32* id = g_id[idx]; + FindBestFit( terr, tsel, a, id, src ); + + return FixByteOrder( EncodeSelectors( d, terr, tsel, id ) ); +} + +uint64 ProcessRGB_ETC2( const uint8* src ) +{ + std::pair result = Planar( src ); + + uint64 d = 0; + + v4i a[8]; + uint err[4] = {}; + PrepareAverages( a, src, err ); + size_t idx = GetLeastError( err, 4 ); + EncodeAverages( d, a, idx ); + + uint64 terr[2][8] = {}; + uint16 tsel[16][8]; + const uint32* id = g_id[idx]; + FindBestFit( terr, tsel, a, id, src ); + + return EncodeSelectors( d, terr, tsel, id, result.first, result.second ); +} diff --git a/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.hpp b/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.hpp new file mode 100644 index 00000000000..21434a3b267 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/etc2/ProcessRGB.hpp @@ -0,0 +1,9 @@ +#ifndef __PROCESSRGB_HPP__ +#define __PROCESSRGB_HPP__ + +#include "Types.hpp" + +uint64 ProcessRGB( const uint8* src ); +uint64 ProcessRGB_ETC2( const uint8* src ); + +#endif diff --git a/3rdparty/bgfx/3rdparty/etc2/Tables.cpp b/3rdparty/bgfx/3rdparty/etc2/Tables.cpp new file mode 100644 index 00000000000..968fbf5838c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/etc2/Tables.cpp @@ -0,0 +1,109 @@ +#include "Tables.hpp" + +const int32 g_table[8][4] = { + { 2, 8, -2, -8 }, + { 5, 17, -5, -17 }, + { 9, 29, -9, -29 }, + { 13, 42, -13, -42 }, + { 18, 60, -18, -60 }, + { 24, 80, -24, -80 }, + { 33, 106, -33, -106 }, + { 47, 183, -47, -183 } +}; + +const int64 g_table256[8][4] = { + { 2*256, 8*256, -2*256, -8*256 }, + { 5*256, 17*256, -5*256, -17*256 }, + { 9*256, 29*256, -9*256, -29*256 }, + { 13*256, 42*256, -13*256, -42*256 }, + { 18*256, 60*256, -18*256, -60*256 }, + { 24*256, 80*256, -24*256, -80*256 }, + { 33*256, 106*256, -33*256, -106*256 }, + { 47*256, 183*256, -47*256, -183*256 } +}; + +const uint32 g_id[4][16] = { + { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2 }, + { 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4 }, + { 7, 7, 6, 6, 7, 7, 6, 6, 7, 7, 6, 6, 7, 7, 6, 6 } +}; + +const uint32 g_avg2[16] = { + 0x00, + 0x11, + 0x22, + 0x33, + 0x44, + 0x55, + 0x66, + 0x77, + 0x88, + 0x99, + 0xAA, + 0xBB, + 0xCC, + 0xDD, + 0xEE, + 0xFF +}; + +const uint32 g_flags[64] = { + 0x80800402, 0x80800402, 0x80800402, 0x80800402, + 0x80800402, 0x80800402, 0x80800402, 0x8080E002, + 0x80800402, 0x80800402, 0x8080E002, 0x8080E002, + 0x80800402, 0x8080E002, 0x8080E002, 0x8080E002, + 0x80000402, 0x80000402, 0x80000402, 0x80000402, + 0x80000402, 0x80000402, 0x80000402, 0x8000E002, + 0x80000402, 0x80000402, 0x8000E002, 0x8000E002, + 0x80000402, 0x8000E002, 0x8000E002, 0x8000E002, + 0x00800402, 0x00800402, 0x00800402, 0x00800402, + 0x00800402, 0x00800402, 0x00800402, 0x0080E002, + 0x00800402, 0x00800402, 0x0080E002, 0x0080E002, + 0x00800402, 0x0080E002, 0x0080E002, 0x0080E002, + 0x00000402, 0x00000402, 0x00000402, 0x00000402, + 0x00000402, 0x00000402, 0x00000402, 0x0000E002, + 0x00000402, 0x00000402, 0x0000E002, 0x0000E002, + 0x00000402, 0x0000E002, 0x0000E002, 0x0000E002 +}; + +#ifdef __SSE4_1__ +const uint8 g_flags_AVX2[64] = +{ + 0x63, 0x63, 0x63, 0x63, + 0x63, 0x63, 0x63, 0x7D, + 0x63, 0x63, 0x7D, 0x7D, + 0x63, 0x7D, 0x7D, 0x7D, + 0x43, 0x43, 0x43, 0x43, + 0x43, 0x43, 0x43, 0x5D, + 0x43, 0x43, 0x5D, 0x5D, + 0x43, 0x5D, 0x5D, 0x5D, + 0x23, 0x23, 0x23, 0x23, + 0x23, 0x23, 0x23, 0x3D, + 0x23, 0x23, 0x3D, 0x3D, + 0x23, 0x3D, 0x3D, 0x3D, + 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x1D, + 0x03, 0x03, 0x1D, 0x1D, + 0x03, 0x1D, 0x1D, 0x1D, +}; + +const __m128i g_table_SIMD[2] = +{ + _mm_setr_epi16( 2, 5, 9, 13, 18, 24, 33, 47), + _mm_setr_epi16( 8, 17, 29, 42, 60, 80, 106, 183) +}; +const __m128i g_table128_SIMD[2] = +{ + _mm_setr_epi16( 2*128, 5*128, 9*128, 13*128, 18*128, 24*128, 33*128, 47*128), + _mm_setr_epi16( 8*128, 17*128, 29*128, 42*128, 60*128, 80*128, 106*128, 183*128) +}; +const __m128i g_table256_SIMD[4] = +{ + _mm_setr_epi32( 2*256, 5*256, 9*256, 13*256), + _mm_setr_epi32( 8*256, 17*256, 29*256, 42*256), + _mm_setr_epi32( 18*256, 24*256, 33*256, 47*256), + _mm_setr_epi32( 60*256, 80*256, 106*256, 183*256) +}; +#endif + diff --git a/3rdparty/bgfx/3rdparty/etc2/Tables.hpp b/3rdparty/bgfx/3rdparty/etc2/Tables.hpp new file mode 100644 index 00000000000..b570526dc57 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/etc2/Tables.hpp @@ -0,0 +1,25 @@ +#ifndef __TABLES_HPP__ +#define __TABLES_HPP__ + +#include "Types.hpp" +#ifdef __SSE4_1__ +#include +#endif + +extern const int32 g_table[8][4]; +extern const int64 g_table256[8][4]; + +extern const uint32 g_id[4][16]; + +extern const uint32 g_avg2[16]; + +extern const uint32 g_flags[64]; + +#ifdef __SSE4_1__ +extern const uint8 g_flags_AVX2[64]; +extern const __m128i g_table_SIMD[2]; +extern const __m128i g_table128_SIMD[2]; +extern const __m128i g_table256_SIMD[4]; +#endif + +#endif diff --git a/3rdparty/bgfx/3rdparty/etc2/Types.hpp b/3rdparty/bgfx/3rdparty/etc2/Types.hpp new file mode 100644 index 00000000000..b31da22e4d8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/etc2/Types.hpp @@ -0,0 +1,17 @@ +#ifndef __DARKRL__TYPES_HPP__ +#define __DARKRL__TYPES_HPP__ + +#include + +typedef int8_t int8; +typedef uint8_t uint8; +typedef int16_t int16; +typedef uint16_t uint16; +typedef int32_t int32; +typedef uint32_t uint32; +typedef int64_t int64; +typedef uint64_t uint64; + +typedef unsigned int uint; + +#endif diff --git a/3rdparty/bgfx/3rdparty/etc2/Vector.hpp b/3rdparty/bgfx/3rdparty/etc2/Vector.hpp new file mode 100644 index 00000000000..3005fdc5395 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/etc2/Vector.hpp @@ -0,0 +1,222 @@ +#ifndef __DARKRL__VECTOR_HPP__ +#define __DARKRL__VECTOR_HPP__ + +#include +#include +#include + +#include "Math.hpp" +#include "Types.hpp" + +template +struct Vector2 +{ + Vector2() : x( 0 ), y( 0 ) {} + Vector2( T v ) : x( v ), y( v ) {} + Vector2( T _x, T _y ) : x( _x ), y( _y ) {} + + bool operator==( const Vector2& rhs ) const { return x == rhs.x && y == rhs.y; } + bool operator!=( const Vector2& rhs ) const { return !( *this == rhs ); } + + Vector2& operator+=( const Vector2& rhs ) + { + x += rhs.x; + y += rhs.y; + return *this; + } + Vector2& operator-=( const Vector2& rhs ) + { + x -= rhs.x; + y -= rhs.y; + return *this; + } + Vector2& operator*=( const Vector2& rhs ) + { + x *= rhs.x; + y *= rhs.y; + return *this; + } + + T x, y; +}; + +template +Vector2 operator+( const Vector2& lhs, const Vector2& rhs ) +{ + return Vector2( lhs.x + rhs.x, lhs.y + rhs.y ); +} + +template +Vector2 operator-( const Vector2& lhs, const Vector2& rhs ) +{ + return Vector2( lhs.x - rhs.x, lhs.y - rhs.y ); +} + +template +Vector2 operator*( const Vector2& lhs, const float& rhs ) +{ + return Vector2( lhs.x * rhs, lhs.y * rhs ); +} + +template +Vector2 operator/( const Vector2& lhs, const T& rhs ) +{ + return Vector2( lhs.x / rhs, lhs.y / rhs ); +} + + +typedef Vector2 v2i; +typedef Vector2 v2f; + + +template +struct Vector3 +{ + Vector3() : x( 0 ), y( 0 ), z( 0 ) {} + Vector3( T v ) : x( v ), y( v ), z( v ) {} + Vector3( T _x, T _y, T _z ) : x( _x ), y( _y ), z( _z ) {} + template + Vector3( const Vector3& v ) : x( T( v.x ) ), y( T( v.y ) ), z( T( v.z ) ) {} + + T Luminance() const { return T( x * 0.3f + y * 0.59f + z * 0.11f ); } + void Clamp() + { + x = std::min( T(1), std::max( T(0), x ) ); + y = std::min( T(1), std::max( T(0), y ) ); + z = std::min( T(1), std::max( T(0), z ) ); + } + + bool operator==( const Vector3& rhs ) const { return x == rhs.x && y == rhs.y && z == rhs.z; } + bool operator!=( const Vector2& rhs ) const { return !( *this == rhs ); } + + T& operator[]( uint idx ) { assert( idx < 3 ); return ((T*)this)[idx]; } + const T& operator[]( uint idx ) const { assert( idx < 3 ); return ((T*)this)[idx]; } + + Vector3 operator+=( const Vector3& rhs ) + { + x += rhs.x; + y += rhs.y; + z += rhs.z; + return *this; + } + + Vector3 operator*=( const Vector3& rhs ) + { + x *= rhs.x; + y *= rhs.y; + z *= rhs.z; + return *this; + } + + Vector3 operator*=( const float& rhs ) + { + x *= rhs; + y *= rhs; + z *= rhs; + return *this; + } + + T x, y, z; + T padding; +}; + +template +Vector3 operator+( const Vector3& lhs, const Vector3& rhs ) +{ + return Vector3( lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z ); +} + +template +Vector3 operator-( const Vector3& lhs, const Vector3& rhs ) +{ + return Vector3( lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z ); +} + +template +Vector3 operator*( const Vector3& lhs, const Vector3& rhs ) +{ + return Vector3( lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z ); +} + +template +Vector3 operator*( const Vector3& lhs, const float& rhs ) +{ + return Vector3( T( lhs.x * rhs ), T( lhs.y * rhs ), T( lhs.z * rhs ) ); +} + +template +Vector3 operator/( const Vector3& lhs, const T& rhs ) +{ + return Vector3( lhs.x / rhs, lhs.y / rhs, lhs.z / rhs ); +} + +template +bool operator<( const Vector3& lhs, const Vector3& rhs ) +{ + return lhs.Luminance() < rhs.Luminance(); +} + +typedef Vector3 v3i; +typedef Vector3 v3f; +typedef Vector3 v3b; + + +static inline v3b v3f_to_v3b( const v3f& v ) +{ + return v3b( uint8( std::min( 1.f, v.x ) * 255 ), uint8( std::min( 1.f, v.y ) * 255 ), uint8( std::min( 1.f, v.z ) * 255 ) ); +} + +template +Vector3 Mix( const Vector3& v1, const Vector3& v2, float amount ) +{ + return v1 + ( v2 - v1 ) * amount; +} + +template<> +inline v3b Mix( const v3b& v1, const v3b& v2, float amount ) +{ + return v3b( v3f( v1 ) + ( v3f( v2 ) - v3f( v1 ) ) * amount ); +} + +template +Vector3 Desaturate( const Vector3& v ) +{ + T l = v.Luminance(); + return Vector3( l, l, l ); +} + +template +Vector3 Desaturate( const Vector3& v, float mul ) +{ + T l = T( v.Luminance() * mul ); + return Vector3( l, l, l ); +} + +template +Vector3 pow( const Vector3& base, float exponent ) +{ + return Vector3( + pow( base.x, exponent ), + pow( base.y, exponent ), + pow( base.z, exponent ) ); +} + +template +Vector3 sRGB2linear( const Vector3& v ) +{ + return Vector3( + sRGB2linear( v.x ), + sRGB2linear( v.y ), + sRGB2linear( v.z ) ); +} + +template +Vector3 linear2sRGB( const Vector3& v ) +{ + return Vector3( + linear2sRGB( v.x ), + linear2sRGB( v.y ), + linear2sRGB( v.z ) ); +} + +#endif diff --git a/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp b/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp index 0dd59c63cbe..3d23d2ba0ab 100644 --- a/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp +++ b/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp @@ -293,7 +293,7 @@ namespace Forsyth assert(vertexData.activeFaceListSize > 0); uint* begin = &activeFaceList[vertexData.activeFaceListStart]; - uint* end = &activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize]; + uint* end = &(activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize - 1]) + 1; uint* it = std::find(begin, end, bestFace); assert(it != end); std::swap(*it, *(end-1)); diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/.gitignore b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/.gitignore index 1c9b0ddd6db..722300c5026 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/.gitignore +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glcpp/.gitignore @@ -1,7 +1,5 @@ glcpp glcpp-parse.output -glcpp-parse.c -glcpp-parse.h *.o *.lo diff --git a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucdarwin.h b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucdarwin.h index 04900cfb0a0..968f4bc0069 100644 --- a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucdarwin.h +++ b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucdarwin.h @@ -29,7 +29,7 @@ #endif #define NV_FASTCALL __attribute__((fastcall)) -#define NV_FORCEINLINE __attribute__((always_inline)) inline +#define NV_FORCEINLINE inline #define NV_DEPRECATED __attribute__((deprecated)) #define NV_THREAD_LOCAL //ACS: there's no "__thread" or equivalent on iOS/OSX diff --git a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnuclinux.h b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnuclinux.h index 5d2e4b8dcd0..117d342ea7d 100644 --- a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnuclinux.h +++ b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnuclinux.h @@ -31,7 +31,7 @@ #define NV_FASTCALL __attribute__((fastcall)) //#if __GNUC__ > 3 // It seems that GCC does not assume always_inline implies inline. I think this depends on the GCC version :( -#define NV_FORCEINLINE inline __attribute__((always_inline)) +#define NV_FORCEINLINE inline //#else // Some compilers complain that inline and always_inline are redundant. //#define NV_FORCEINLINE __attribute__((always_inline)) diff --git a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucwin32.h b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucwin32.h index e416d3d4153..68465c8247f 100644 --- a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucwin32.h +++ b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsgnucwin32.h @@ -19,7 +19,7 @@ #endif #define NV_FASTCALL __attribute__((fastcall)) -#define NV_FORCEINLINE __attribute__((always_inline)) +#define NV_FORCEINLINE inline #define NV_DEPRECATED __attribute__((deprecated)) #if __GNUC__ > 2 diff --git a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsvcwin32.h b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsvcwin32.h index 7b3876ab4b3..a6c6bf93bda 100644 --- a/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsvcwin32.h +++ b/3rdparty/bgfx/3rdparty/nvtt/nvcore/defsvcwin32.h @@ -48,7 +48,7 @@ #endif #define NV_NOINLINE __declspec(noinline) -#define NV_FORCEINLINE __forceinline +#define NV_FORCEINLINE inline #define NV_THREAD_LOCAL __declspec(thread) diff --git a/3rdparty/bgfx/3rdparty/nvtt/nvmath/nvmath.h b/3rdparty/bgfx/3rdparty/nvtt/nvmath/nvmath.h index 7a64f600153..94f7ec7947a 100644 --- a/3rdparty/bgfx/3rdparty/nvtt/nvmath/nvmath.h +++ b/3rdparty/bgfx/3rdparty/nvtt/nvmath/nvmath.h @@ -35,7 +35,12 @@ namespace nv inline bool isFinite(const float f) { +#if defined(_MSC_VER) && _MSC_VER <= 1800 + (void)f; + return true; +#else return std::isfinite(f); +#endif // defined(_MSC_VER) && _MSC_VER <= 1800 } // Eliminates negative zeros from a float array. diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp index c7adf2efba6..0949fe7de96 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp @@ -17,6 +17,7 @@ - PROGRAMMER GUIDE (read me!) - API BREAKING CHANGES (read me when you update!) - FREQUENTLY ASKED QUESTIONS (FAQ), TIPS + - How can I help? - How do I update to a newer version of ImGui? - Can I have multiple widgets with the same label? Can I have widget without a label? (Yes) - I integrated ImGui in my engine and the text or lines are blurry.. @@ -148,6 +149,7 @@ Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code. Also read releases logs https://github.com/ocornut/imgui/releases for more details. + - 2016/01/23 (1.48) - fixed not honoring exact width passed to PushItemWidth(), previously it would add extra FramePadding.x*2 over that width. if you had manual pixel-perfect alignment in place it might affect you. - 2015/12/27 (1.48) - fixed ImDrawList::AddRect() which used to render a rectangle 1 px too large on each axis. - 2015/12/04 (1.47) - renamed Color() helpers to ValueColor() - dangerously named, rarely used and probably to be made obsolete. - 2015/08/29 (1.45) - with the addition of horizontal scrollbar we made various fixes to inconsistencies with dealing with cursor position. @@ -236,6 +238,10 @@ FREQUENTLY ASKED QUESTIONS (FAQ), TIPS ====================================== + Q: How can I help? + A: - If you are experienced enough with ImGui and with C/C++, look at the todo list and see how you want/can help! + - Become a Patron/donate. Convince your company to become a Patron or provide serious funding for development time. + Q: How do I update to a newer version of ImGui? A: Overwrite the following files: imgui.cpp @@ -359,6 +365,7 @@ Q: How can I load multiple fonts? A: Use the font atlas to pack them into a single texture: + (Read extra_fonts/README.txt and the code in ImFontAtlas for more details.) ImGuiIO& io = ImGui::GetIO(); ImFont* font0 = io.Fonts->AddFontDefault(); @@ -371,7 +378,7 @@ // Options ImFontConfig config; config.OversampleH = 3; - config.OversampleV = 3; + config.OversampleV = 1; config.GlyphExtraSpacing.x = 1.0f; io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, &config); @@ -383,8 +390,6 @@ io.Fonts->LoadFromFileTTF("fontawesome-webfont.ttf", 16.0f, &config, ranges); io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, NULL, &config, io.Fonts->GetGlyphRangesJapanese()); - Read extra_fonts/README.txt or ImFontAtlas class for more details. - Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic? A: When loading a font, pass custom Unicode ranges to specify the glyphs to load. ImGui will support UTF-8 encoding across the board. Character input depends on you passing the right character code to io.AddInputCharacter(). The example applications do that. @@ -402,9 +407,10 @@ ISSUES & TODO-LIST ================== - Issue numbers (#) refer to github issues. + Issue numbers (#) refer to github issues listed at https://github.com/ocornut/imgui/issues The list below consist mostly of notes of things to do before they are requested/discussed by users (at that point it usually happens on the github) + - doc: add a proper documentation+regression testing system (#435) - window: maximum window size settings (per-axis). for large popups in particular user may not want the popup to fill all space. - window: add a way for very transient windows (non-saved, temporary overlay over hundreds of objects) to "clean" up from the global window list. perhaps a lightweight explicit cleanup pass. - window: calling SetNextWindowSize() every frame with <= 0 doesn't do anything, may be useful to allow (particularly when used for a single axis). @@ -421,7 +427,7 @@ - window/tooltip: allow to set the width of a tooltip to allow TextWrapped() etc. while keeping the height automatic. - draw-list: maintaining bounding box per command would allow to merge draw command when clipping isn't relied on (typical non-scrolling window or non-overflowing column would merge with previous command). !- scrolling: allow immediately effective change of scroll if we haven't appended items yet - - splitter: formalize the splitter idiom into an official api (we want to handle n-way split) + - splitter/separator: formalize the splitter idiom into an official api (we want to handle n-way split) (#319) - widgets: display mode: widget-label, label-widget (aligned on column or using fixed size), label-newline-tab-widget etc. - widgets: clean up widgets internal toward exposing everything. - widgets: add disabled and read-only modes (#211) @@ -444,13 +450,14 @@ - layout: horizontal flow until no space left (#404) - layout: more generic alignment state (left/right/centered) for single items? - layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 layout code. item width should include frame padding. + - columns: declare column set (each column: fixed size, %, fill, distribute default size among fills) (#513, #125) + - columns: add a conditional parameter to SetColumnOffset() (#513, #125) - columns: separator function or parameter that works within the column (currently Separator() bypass all columns) (#125) - - columns: declare column set (each column: fixed size, %, fill, distribute default size among fills) (#125) - - columns: columns header to act as button (~sort op) and allow resize/reorder (#125) - - columns: user specify columns size (#125) + - columns: columns header to act as button (~sort op) and allow resize/reorder (#513, #125) + - columns: user specify columns size (#513, #125) - columns: flag to add horizontal separator above/below? - columns/layout: setup minimum line height (equivalent of automatically calling AlignFirstTextHeightToWidgets) - - combo: sparse combo boxes (via function call?) + - combo: sparse combo boxes (via function call?) / iterators - combo: contents should extends to fit label if combo widget is small - combo/listbox: keyboard control. need InputText-like non-active focus + key handling. considering keyboard for custom listbox (pr #203) - listbox: multiple selection @@ -460,15 +467,16 @@ !- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402) - popups: add variant using global identifier similar to Begin/End (#402) - popups: border options. richer api like BeginChild() perhaps? (#197) - - menus: local shortcuts, global shortcuts (#126) + - menus: local shortcuts, global shortcuts (#456, #126) - menus: icons - menus: menubars: some sort of priority / effect of main menu-bar on desktop size? - statusbar: add a per-window status bar helper similar to what menubar does. - - tabs + - tabs (#261, #351) - separator: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y) - - gauge: various forms of gauge/loading bars widgets - color: the color helpers/typing is a mess and needs sorting out. - - color: add a better color picker + - color: add a better color picker (#346) + - node/graph editor (#306) + - pie menus patterns (#434) - plot: PlotLines() should use the polygon-stroke facilities (currently issues with averaging normals) - plot: make it easier for user to draw extra stuff into the graph (e.g: draw basis, highlight certain points, 2d plots, multiple plots) - plot: "smooth" automatic scale over time, user give an input 0.0(full user scale) 1.0(full derived from value) @@ -491,12 +499,14 @@ - textwrapped: figure out better way to use TextWrapped() in an always auto-resize context (tooltip, etc.) (git issue #249) - settings: write more decent code to allow saving/loading new fields - settings: api for per-tool simple persistent data (bool,int,float,columns sizes,etc.) in .ini file + - style: add window shadows. - style/optimization: store rounded corners in texture to use 1 quad per corner (filled and wireframe) to lower the cost of rounding. - style: color-box not always square? - style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc. - style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation). - style: global scale setting. - text: simple markup language for color change? + - font: dynamic font atlas to avoid baking huge ranges into bitmap and make scaling easier. - font: helper to add glyph redirect/replacements (e.g. redirect alternate apostrophe unicode code points to ascii one, etc.) - log: LogButtons() options for specifying depth and/or hiding depth slider - log: have more control over the log scope (e.g. stop logging when leaving current tree node scope) @@ -506,14 +516,16 @@ - filters: handle wildcards (with implicit leading/trailing *), regexps - shortcuts: add a shortcut api, e.g. parse "&Save" and/or "Save (CTRL+S)", pass in to widgets or provide simple ways to use (button=activate, input=focus) !- keyboard: tooltip & combo boxes are messing up / not honoring keyboard tabbing - - keyboard: full keyboard navigation and focus. + - keyboard: full keyboard navigation and focus. (#323) - focus: SetKeyboardFocusHere() on with >= 0 offset could be done on same frame (else latch and modulate on beginning of next frame) - input: rework IO system to be able to pass actual ordered/timestamped events. + - input: allow to decide and pass explicit double-clicks (e.g. for windows by the CS_DBLCLKS style). - input: support track pad style scrolling & slider edit. - misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL) - misc: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon? - style editor: have a more global HSV setter (e.g. alter hue on all elements). consider replacing active/hovered by offset in HSV space? (#438) - style editor: color child window height expressed in multiple of line height. + - remote: make a system like RemoteImGui first-class citizen/project (#75) - drawlist: user probably can't call Clear() because we expect a texture to be pushed in the stack. - examples: directx9/directx11: save/restore device state more thoroughly. - optimization: use another hash function than crc32, e.g. FNV1a @@ -528,13 +540,13 @@ #include "imgui.h" #define IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_PLACEMENT_NEW #include "imgui_internal.h" #include // toupper, isprint #include // sqrtf, fabsf, fmodf, powf, cosf, sinf, floorf, ceilf #include // NULL, malloc, free, qsort, atoi #include // vsnprintf, sscanf, printf -#include // new (ptr) #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier #include // intptr_t #else @@ -611,7 +623,7 @@ static void ClosePopupToLevel(int remaining); static void ClosePopup(ImGuiID id); static bool IsPopupOpen(ImGuiID id); static ImGuiWindow* GetFrontMostModalRootWindow(); -static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, ImGuiWindowFlags flags, int* last_dir, const ImRect& r_inner); +static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, int* last_dir, const ImRect& rect_to_avoid); static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data); static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end); @@ -1535,6 +1547,7 @@ ImGuiWindow::ImGuiWindow(const char* name) ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f); ScrollbarX = ScrollbarY = false; ScrollbarSizes = ImVec2(0.0f, 0.0f); + BorderSize = 0.0f; Active = WasActive = false; Accessed = false; Collapsed = false; @@ -1553,7 +1566,7 @@ ImGuiWindow::ImGuiWindow(const char* name) FontWindowScale = 1.0f; DrawList = (ImDrawList*)ImGui::MemAlloc(sizeof(ImDrawList)); - new(DrawList) ImDrawList(); + IM_PLACEMENT_NEW(DrawList) ImDrawList(); DrawList->_OwnerName = Name; RootWindow = NULL; RootNonPopupWindow = NULL; @@ -1827,7 +1840,7 @@ size_t ImGui::GetInternalStateSize() void ImGui::SetInternalState(void* state, bool construct) { if (construct) - new (state) ImGuiState(); + IM_PLACEMENT_NEW(state) ImGuiState(); GImGui = (ImGuiState*)state; } @@ -1872,7 +1885,7 @@ void ImGui::NewFrame() { // Initialize on first frame g.LogClipboard = (ImGuiTextBuffer*)ImGui::MemAlloc(sizeof(ImGuiTextBuffer)); - new(g.LogClipboard) ImGuiTextBuffer(); + IM_PLACEMENT_NEW(g.LogClipboard) ImGuiTextBuffer(); IM_ASSERT(g.Settings.empty()); LoadSettings(); @@ -2276,15 +2289,19 @@ static void AddDrawListToRenderList(ImVector& out_render_list, ImDr { if (!draw_list->CmdBuffer.empty() && !draw_list->VtxBuffer.empty()) { - if (draw_list->CmdBuffer.back().ElemCount == 0) + // Remove trailing command if unused + ImDrawCmd& last_cmd = draw_list->CmdBuffer.back(); + if (last_cmd.ElemCount == 0 && last_cmd.UserCallback == NULL) draw_list->CmdBuffer.pop_back(); + out_render_list.push_back(draw_list); // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices) // If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly. const unsigned long long int max_vtx_idx = (unsigned long long int)1L << (sizeof(ImDrawIdx)*8); (void)max_vtx_idx; - IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx); // Too many vertices in same ImDrawList + IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); // Sanity check. Bug or mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. + IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx); // Too many vertices in same ImDrawList. See comment above. GImGui->IO.MetricsRenderVertices += draw_list->VtxBuffer.Size; GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size; @@ -2488,17 +2505,8 @@ static const char* FindTextDisplayEnd(const char* text, const char* text_end) if (!text_end) text_end = (const char*)-1; - ImGuiState& g = *GImGui; - if (g.DisableHideTextAfterDoubleHash > 0) - { - while (text_display_end < text_end && *text_display_end != '\0') - text_display_end++; - } - else - { - while (text_display_end < text_end && *text_display_end != '\0' && (text_display_end[0] != '#' || text_display_end[1] != '#')) - text_display_end++; - } + while (text_display_end < text_end && *text_display_end != '\0' && (text_display_end[0] != '#' || text_display_end[1] != '#')) + text_display_end++; return text_display_end; } @@ -2736,6 +2744,8 @@ ImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_tex ImFont* font = g.Font; const float font_size = g.FontSize; + if (text == text_display_end) + return ImVec2(0.0f, font_size); ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL); // Cancel out character spacing for the last character of a line (it is baked into glyph->XAdvance field) @@ -3421,7 +3431,7 @@ static void CheckStacksSize(ImGuiWindow* window, bool write) IM_ASSERT(p_backup == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup)); } -static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, ImGuiWindowFlags flags, int* last_dir, const ImRect& r_inner) +static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, int* last_dir, const ImRect& r_inner) { const ImGuiStyle& style = GImGui->Style; @@ -3431,7 +3441,7 @@ static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, r_outer.Reduce(ImVec2((size.x - r_outer.GetWidth() > safe_padding.x*2) ? safe_padding.x : 0.0f, (size.y - r_outer.GetHeight() > safe_padding.y*2) ? safe_padding.y : 0.0f)); ImVec2 base_pos_clamped = ImClamp(base_pos, r_outer.Min, r_outer.Max - size); - for (int n = (*last_dir != -1) ? -1 : 0; n < 4; n++) // Right, down, up, left. Favor last used direction. + for (int n = (*last_dir != -1) ? -1 : 0; n < 4; n++) // Last, Right, down, up, left. (Favor last used direction). { const int dir = (n == -1) ? *last_dir : n; ImRect rect(dir == 0 ? r_inner.Max.x : r_outer.Min.x, dir == 1 ? r_inner.Max.y : r_outer.Min.y, dir == 3 ? r_inner.Min.x : r_outer.Max.x, dir == 2 ? r_inner.Min.y : r_outer.Max.y); @@ -3441,12 +3451,8 @@ static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, return ImVec2(dir == 0 ? r_inner.Max.x : dir == 3 ? r_inner.Min.x - size.x : base_pos_clamped.x, dir == 1 ? r_inner.Max.y : dir == 2 ? r_inner.Min.y - size.y : base_pos_clamped.y); } - // Fallback + // Fallback, try to keep within display *last_dir = -1; - if (flags & ImGuiWindowFlags_Tooltip) // For tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible. - return base_pos + ImVec2(2,2); - - // Otherwise try to keep within display ImVec2 pos = base_pos; pos.x = ImMax(ImMin(pos.x + size.x, r_outer.Max.x) - size.x, r_outer.Min.x); pos.y = ImMax(ImMin(pos.y + size.y, r_outer.Max.y) - size.y, r_outer.Min.y); @@ -3470,7 +3476,7 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl // Create window the first time ImGuiWindow* window = (ImGuiWindow*)ImGui::MemAlloc(sizeof(ImGuiWindow)); - new(window) ImGuiWindow(name); + IM_PLACEMENT_NEW(window) ImGuiWindow(name); window->Flags = flags; if (flags & ImGuiWindowFlags_NoSavedSettings) @@ -3810,19 +3816,21 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ rect_to_avoid = ImRect(-FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight(), FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight() + parent_window->MenuBarHeight()); else rect_to_avoid = ImRect(parent_window->Pos.x + style.ItemSpacing.x, -FLT_MAX, parent_window->Pos.x + parent_window->Size.x - style.ItemSpacing.x - parent_window->ScrollbarSizes.x, FLT_MAX); // We want some overlap to convey the relative depth of each popup (here hard-coded to 4) - window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, flags, &window->AutoPosLastDirection, rect_to_avoid); + window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid); } else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_appearing_after_being_hidden) { ImRect rect_to_avoid(window->PosFloat.x - 1, window->PosFloat.y - 1, window->PosFloat.x + 1, window->PosFloat.y + 1); - window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, flags, &window->AutoPosLastDirection, rect_to_avoid); + window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid); } // Position tooltip (always follows mouse) if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api) { ImRect rect_to_avoid(g.IO.MousePos.x - 16, g.IO.MousePos.y - 8, g.IO.MousePos.x + 24, g.IO.MousePos.y + 24); // FIXME: Completely hard-coded. Perhaps center on cursor hit-point instead? - window->PosFloat = FindBestPopupWindowPos(g.IO.MousePos, window->Size, flags, &window->AutoPosLastDirection, rect_to_avoid); + window->PosFloat = FindBestPopupWindowPos(g.IO.MousePos, window->Size, &window->AutoPosLastDirection, rect_to_avoid); + if (window->AutoPosLastDirection == -1) + window->PosFloat = g.IO.MousePos + ImVec2(2,2); // If there's not enough room, for tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible. } // User moving window (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows. @@ -3936,9 +3944,10 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ } // Scrollbars - window->ScrollbarY = (window->SizeContents.y > window->Size.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar); - window->ScrollbarX = (window->SizeContents.x > window->Size.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar); + window->ScrollbarY = (flags & ImGuiWindowFlags_ForceVerticalScrollbar) || ((window->SizeContents.y > window->Size.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar)); + window->ScrollbarX = (flags & ImGuiWindowFlags_ForceHorizontalScrollbar) || ((window->SizeContents.x > window->Size.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar)); window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f); + window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f; // Window background if (bg_alpha > 0.0f) @@ -3978,11 +3987,10 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ // (after the input handling so we don't have a frame of latency) if (!(flags & ImGuiWindowFlags_NoResize)) { - const float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f; const ImVec2 br = window->Rect().GetBR(); - window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, -border_size)); - window->DrawList->PathLineTo(br + ImVec2(-border_size, -resize_corner_size)); - window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding - border_size, br.y - window_rounding - border_size), window_rounding, 0, 3); + window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, -window->BorderSize)); + window->DrawList->PathLineTo(br + ImVec2(-window->BorderSize, -resize_corner_size)); + window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding - window->BorderSize, br.y - window_rounding - window->BorderSize), window_rounding, 0, 3); window->DrawList->PathFill(resize_col); } @@ -4072,13 +4080,12 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ // We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame // Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior. const ImRect title_bar_rect = window->TitleBarRect(); - const float border_size = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f; + const float border_size = window->BorderSize; ImRect clip_rect; clip_rect.Min.x = title_bar_rect.Min.x + 0.5f + ImMax(border_size, window->WindowPadding.x*0.5f); clip_rect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + 0.5f + border_size; clip_rect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x - ImMax(border_size, window->WindowPadding.x*0.5f); clip_rect.Max.y = window->Pos.y + window->Size.y - border_size - window->ScrollbarSizes.y; - PushClipRect(clip_rect.Min, clip_rect.Max, true); // Clear 'accessed' flag last thing @@ -4094,7 +4101,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ window->Collapsed = parent_window && parent_window->Collapsed; if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) - window->Collapsed |= (window->ClipRect.Min.x >= window->ClipRect.Max.x || window->ClipRect.Min.y >= window->ClipRect.Max.y); + window->Collapsed |= (window->ClippedWindowRect.Min.x >= window->ClippedWindowRect.Max.x || window->ClippedWindowRect.Min.y >= window->ClippedWindowRect.Max.y); // We also hide the window from rendering because we've already added its border to the command list. // (we could perform the check earlier in the function but it is simpler at this point) @@ -4145,7 +4152,7 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal) bool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX); float other_scrollbar_size_w = other_scrollbar ? style.ScrollbarSize : 0.0f; const ImRect window_rect = window->Rect(); - const float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f; + const float border_size = window->BorderSize; ImRect bb = horizontal ? ImRect(window->Pos.x + border_size, window_rect.Max.y - style.ScrollbarSize, window_rect.Max.x - other_scrollbar_size_w - border_size, window_rect.Max.y - border_size) : ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + border_size, window_rect.Max.x - border_size, window_rect.Max.y - other_scrollbar_size_w - border_size); @@ -4278,8 +4285,8 @@ static void PushMultiItemsWidths(int components, float w_full) const ImGuiStyle& style = GImGui->Style; if (w_full <= 0.0f) w_full = ImGui::CalcItemWidth(); - const float w_item_one = ImMax(1.0f, (float)(int)((w_full - (style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)) / (float)components)); - const float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1))); + const float w_item_one = ImMax(1.0f, (float)(int)((w_full - (style.ItemInnerSpacing.x) * (components-1)) / (float)components)); + const float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.ItemInnerSpacing.x) * (components-1))); window->DC.ItemWidthStack.push_back(w_item_last); for (int i = 0; i < components-1; i++) window->DC.ItemWidthStack.push_back(w_item_one); @@ -4300,9 +4307,8 @@ float ImGui::CalcItemWidth() if (w < 0.0f) { // Align to a right-side limit. We include 1 frame padding in the calculation because this is how the width is always used (we add 2 frame padding to it), but we could move that responsibility to the widget as well. - ImGuiState& g = *GImGui; float width_to_right_edge = ImGui::GetContentRegionAvail().x; - w = ImMax(1.0f, width_to_right_edge + w - g.Style.FramePadding.x * 2.0f); + w = ImMax(1.0f, width_to_right_edge + w); } w = (float)(int)w; return w; @@ -5163,8 +5169,8 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args) const float w = CalcItemWidth(); const ImVec2 label_size = CalcTextSize(label, NULL, true); - const ImRect value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + style.FramePadding.x*2, label_size.y + style.FramePadding.y*2)); - const ImRect total_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + style.FramePadding.x*2 + (label_size.x > 0.0f ? style.ItemInnerSpacing.x : 0.0f), style.FramePadding.y*2) + label_size); + const ImRect value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2)); + const ImRect total_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + (label_size.x > 0.0f ? style.ItemInnerSpacing.x : 0.0f), style.FramePadding.y*2) + label_size); ItemSize(total_bb, style.FramePadding.y); if (!ItemAdd(total_bb, NULL)) return; @@ -5173,7 +5179,8 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args) const char* value_text_begin = &g.TempBuffer[0]; const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); RenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImGuiAlign_VCenter); - RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label); + if (label_size.x > 0.0f) + RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label); } void ImGui::LabelText(const char* label, const char* fmt, ...) @@ -5271,7 +5278,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags ImGuiState& g = *GImGui; const ImGuiStyle& style = g.Style; const ImGuiID id = window->GetID(label); - const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true); + const ImVec2 label_size = CalcTextSize(label, NULL, true); ImVec2 pos = window->DC.CursorPos; if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset) @@ -5361,7 +5368,7 @@ static bool CloseWindowButton(bool* p_opened) } if (p_opened != NULL && pressed) - *p_opened = !*p_opened; + *p_opened = false; return pressed; } @@ -5599,8 +5606,9 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display str_id = label; if (label == NULL) label = str_id; + const bool label_hide_text_after_double_hash = (label == str_id); // Only search and hide text after ## if we have passed label and ID separately, otherwise allow "##" within format string. const ImGuiID id = window->GetID(str_id); - const ImVec2 label_size = CalcTextSize(label, NULL, true); + const ImVec2 label_size = CalcTextSize(label, NULL, label_hide_text_after_double_hash); // We vertically grow up to current line height up the typical widget height. const float text_base_offset_y = ImMax(0.0f, window->DC.CurrentLineTextBaseOffset - padding.y); // Latch before ItemSize changes it @@ -5663,7 +5671,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display RenderCollapseTriangle(bb.Min + ImVec2(padding.x, g.FontSize*0.15f + text_base_offset_y), opened, 0.70f, false); if (g.LogEnabled) LogRenderedText(text_pos, ">"); - RenderText(text_pos, label); + RenderText(text_pos, label, NULL, label_hide_text_after_double_hash); } return opened; @@ -5963,7 +5971,7 @@ bool ImGui::InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label char buf[32]; DataTypeFormatString(data_type, data_ptr, decimal_precision, buf, IM_ARRAYSIZE(buf)); - bool value_changed = InputTextEx(label, buf, IM_ARRAYSIZE(buf), aabb.GetSize() - g.Style.FramePadding*2.0f, ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll); + bool value_changed = InputTextEx(label, buf, IM_ARRAYSIZE(buf), aabb.GetSize(), ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll); if (g.ScalarAsInputTextId == 0) { // First frame @@ -6164,7 +6172,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c const float w = CalcItemWidth(); const ImVec2 label_size = CalcTextSize(label, NULL, true); - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f); + const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f)); const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); // NB- we don't call ItemSize() yet because we may turn into a text edit box below @@ -6255,7 +6263,6 @@ bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float char value_buf[64]; char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v); RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImGuiAlign_Center); - if (label_size.x > 0.0f) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); @@ -6462,7 +6469,7 @@ bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, f const float w = CalcItemWidth(); const ImVec2 label_size = CalcTextSize(label, NULL, true); - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f); + const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f)); const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding); const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); @@ -6667,9 +6674,9 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge ImGuiState& g = *GImGui; const ImGuiStyle& style = g.Style; - const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true); + const ImVec2 label_size = CalcTextSize(label, NULL, true); if (graph_size.x == 0.0f) - graph_size.x = CalcItemWidth() + (style.FramePadding.x * 2); + graph_size.x = CalcItemWidth(); if (graph_size.y == 0.0f) graph_size.y = label_size.y + (style.FramePadding.y * 2); @@ -6758,7 +6765,8 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge if (overlay_text) RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImGuiAlign_Center); - RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); + if (label_size.x > 0.0f) + RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); } struct ImGuiPlotArrayGetterData @@ -6809,15 +6817,16 @@ void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* over const ImGuiStyle& style = g.Style; ImVec2 pos = window->DC.CursorPos; - const ImRect bb(pos, pos + CalcItemSize(size_arg, CalcItemWidth() + style.FramePadding.x*2.0f, g.FontSize + style.FramePadding.y*2.0f)); + ImRect bb(pos, pos + CalcItemSize(size_arg, CalcItemWidth(), g.FontSize + style.FramePadding.y*2.0f)); ItemSize(bb, style.FramePadding.y); if (!ItemAdd(bb, NULL)) return; // Render fraction = ImSaturate(fraction); - const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y); RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); + bb.Reduce(ImVec2(window->BorderSize, window->BorderSize)); + const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y); RenderFrame(bb.Min, fill_br, GetColorU32(ImGuiCol_PlotHistogram), false, style.FrameRounding); // Default displaying the fraction as percentage string, but user can override it @@ -6875,7 +6884,8 @@ bool ImGui::Checkbox(const char* label, bool* v) if (g.LogEnabled) LogRenderedText(text_bb.GetTL(), *v ? "[x]" : "[ ]"); - RenderText(text_bb.GetTL(), label); + if (label_size.x > 0.0f) + RenderText(text_bb.GetTL(), label); return pressed; } @@ -6942,7 +6952,8 @@ bool ImGui::RadioButton(const char* label, bool active) if (g.LogEnabled) LogRenderedText(text_bb.GetTL(), active ? "(x)" : "( )"); - RenderText(text_bb.GetTL(), label); + if (label_size.x > 0.0f) + RenderText(text_bb.GetTL(), label); return pressed; } @@ -7218,9 +7229,9 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 const bool is_editable = (flags & ImGuiInputTextFlags_ReadOnly) == 0; const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0; - const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true); - ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), is_multiline ? ImGui::GetTextLineHeight() * 8.0f : label_size.y); // Arbitrary default of 8 lines high for multi-line - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size + style.FramePadding*2.0f); + const ImVec2 label_size = CalcTextSize(label, NULL, true); + ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), (is_multiline ? ImGui::GetTextLineHeight() * 8.0f : label_size.y) + style.FramePadding.y*2.0f); // Arbitrary default of 8 lines high for multi-line + const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size); const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? (style.ItemInnerSpacing.x + label_size.x) : 0.0f, 0.0f)); ImGuiWindow* draw_window = window; @@ -7580,7 +7591,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); // Render - const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x + style.FramePadding.x*2.0f, frame_bb.Min.y + size.y + style.FramePadding.y*2.0f); + const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x, frame_bb.Min.y + size.y); // Not using frame_bb.Max because we have adjusted size ImVec2 render_pos = is_multiline ? draw_window->DC.CursorPos : frame_bb.Min + style.FramePadding; ImVec2 text_size(0.f, 0.f); if (g.ActiveId == id || (edit_state.Id == id && is_multiline && g.ActiveId == draw_window->GetID("#SCROLLY"))) @@ -7771,15 +7782,13 @@ bool ImGui::InputScalarEx(const char* label, ImGuiDataType data_type, void* data ImGuiState& g = *GImGui; const ImGuiStyle& style = g.Style; - const float w = CalcItemWidth(); - const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true); - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f); + const ImVec2 label_size = CalcTextSize(label, NULL, true); ImGui::BeginGroup(); ImGui::PushID(label); - const ImVec2 button_sz = ImVec2(g.FontSize, g.FontSize) + style.FramePadding * 2; + const ImVec2 button_sz = ImVec2(g.FontSize, g.FontSize) + style.FramePadding*2.0f; if (step_ptr) - ImGui::PushItemWidth(ImMax(1.0f, w - (button_sz.x + style.ItemInnerSpacing.x)*2)); + ImGui::PushItemWidth(ImMax(1.0f, CalcItemWidth() - (button_sz.x + style.ItemInnerSpacing.x)*2)); char buf[64]; DataTypeFormatString(data_type, data_ptr, scalar_format, buf, IM_ARRAYSIZE(buf)); @@ -7989,7 +7998,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi const float w = CalcItemWidth(); const ImVec2 label_size = CalcTextSize(label, NULL, true); - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f); + const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f)); const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); ItemSize(total_bb, style.FramePadding.y); if (!ItemAdd(total_bb, &id)) @@ -8091,7 +8100,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl PopClipRect(); ImGuiID id = window->GetID(label); - ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true); + ImVec2 label_size = CalcTextSize(label, NULL, true); ImVec2 size(size_arg.x != 0.0f ? size_arg.x : label_size.x, size_arg.y != 0.0f ? size_arg.y : label_size.y); ImVec2 pos = window->DC.CursorPos; pos.y += window->DC.CurrentLineTextBaseOffset; @@ -8175,10 +8184,10 @@ bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg) const ImGuiStyle& style = ImGui::GetStyle(); const ImGuiID id = ImGui::GetID(label); - const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true); + const ImVec2 label_size = CalcTextSize(label, NULL, true); // Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar. - ImVec2 size = CalcItemSize(size_arg, CalcItemWidth() + style.FramePadding.x * 2.0f, ImGui::GetTextLineHeightWithSpacing() * 7.4f + style.ItemSpacing.y); + ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), ImGui::GetTextLineHeightWithSpacing() * 7.4f + style.ItemSpacing.y); ImVec2 frame_size = ImVec2(size.x, ImMax(size.y, label_size.y)); ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size); ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); @@ -8333,8 +8342,7 @@ bool ImGui::BeginMenuBar() ImGui::BeginGroup(); // Save position ImGui::PushID("##menubar"); ImRect rect = window->MenuBarRect(); - float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f; - PushClipRect(ImVec2(rect.Min.x+0.5f, rect.Min.y-0.5f+border_size), ImVec2(rect.Max.x+0.5f, rect.Max.y-0.5f), false); + PushClipRect(ImVec2(rect.Min.x+0.5f, rect.Min.y-0.5f+window->BorderSize), ImVec2(rect.Max.x+0.5f, rect.Max.y-0.5f), false); window->DC.CursorPos = ImVec2(rect.Min.x + window->DC.MenuBarOffsetX, rect.Min.y);// + g.Style.FramePadding.y); window->DC.LayoutType = ImGuiLayoutType_Horizontal; window->DC.MenuBarAppending = true; @@ -8527,7 +8535,6 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha) edit_mode = g.ColorEditModeStorage.GetInt(id, 0) % 3; float f[4] = { col[0], col[1], col[2], col[3] }; - if (edit_mode == ImGuiColorEditMode_HSV) ImGui::ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]); @@ -8547,8 +8554,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha) { // RGB/HSV 0..255 Sliders const float w_items_all = w_full - (square_sz + style.ItemInnerSpacing.x); - const float w_item_one = ImMax(1.0f, (float)(int)((w_items_all - (style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)) / (float)components)); - const float w_item_last = ImMax(1.0f, (float)(int)(w_items_all - (w_item_one + style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1))); + const float w_item_one = ImMax(1.0f, (float)(int)((w_items_all - (style.ItemInnerSpacing.x) * (components-1)) / (float)components)); + const float w_item_last = ImMax(1.0f, (float)(int)(w_items_all - (w_item_one + style.ItemInnerSpacing.x) * (components-1))); const bool hide_prefix = (w_item_one <= CalcTextSize("M:999").x); const char* ids[4] = { "##X", "##Y", "##Z", "##W" }; @@ -8583,18 +8590,19 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha) else ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X", i[0], i[1], i[2]); ImGui::PushItemWidth(w_slider_all - style.ItemInnerSpacing.x); - value_changed |= ImGui::InputText("##Text", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase); + if (ImGui::InputText("##Text", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase)) + { + value_changed |= true; + char* p = buf; + while (*p == '#' || ImCharIsSpace(*p)) + p++; + i[0] = i[1] = i[2] = i[3] = 0; + if (alpha) + sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned) + else + sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]); + } ImGui::PopItemWidth(); - char* p = buf; - while (*p == '#' || ImCharIsSpace(*p)) - p++; - - // Treat at unsigned (%X is unsigned) - i[0] = i[1] = i[2] = i[3] = 0; - if (alpha) - sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); - else - sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]); } break; } @@ -8615,15 +8623,15 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha) const char* button_titles[3] = { "RGB", "HSV", "HEX" }; if (ButtonEx(button_titles[edit_mode], ImVec2(0,0), ImGuiButtonFlags_DontClosePopups)) g.ColorEditModeStorage.SetInt(id, (edit_mode + 1) % 3); // Don't set local copy of 'edit_mode' right away! - ImGui::SameLine(); } - else + + const char* label_display_end = FindTextDisplayEnd(label); + if (label != label_display_end) { - ImGui::SameLine(0, style.ItemInnerSpacing.x); + ImGui::SameLine(0, (window->DC.ColorEditMode == ImGuiColorEditMode_UserSelectShowButton) ? -1.0f : style.ItemInnerSpacing.x); + ImGui::TextUnformatted(label, label_display_end); } - ImGui::TextUnformatted(label, FindTextDisplayEnd(label)); - // Convert back for (int n = 0; n < 4; n++) f[n] = i[n] / 255.0f; @@ -9283,7 +9291,6 @@ void ImGui::ShowMetricsWindow(bool* opened) }; ImGuiState& g = *GImGui; // Access private state - g.DisableHideTextAfterDoubleHash++; // Not exposed (yet). Disable processing that hides text after '##' markers. Funcs::NodeWindows(g.Windows, "Windows"); if (ImGui::TreeNode("DrawList", "Active DrawLists (%d)", g.RenderDrawLists[0].Size)) { @@ -9309,7 +9316,6 @@ void ImGui::ShowMetricsWindow(bool* opened) ImGui::Text("ActiveID: 0x%08X/0x%08X", g.ActiveId, g.ActiveIdPreviousFrame); ImGui::TreePop(); } - g.DisableHideTextAfterDoubleHash--; } ImGui::End(); } diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h index b7b0a0113a6..9e4a6c892ad 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h @@ -18,17 +18,18 @@ #define IMGUI_VERSION "1.48 WIP" +// Define attributes of all API symbols declarations, e.g. for DLL under Windows. +#ifndef IMGUI_API +#define IMGUI_API +#endif + // Define assertion handler. #ifndef IM_ASSERT #include #define IM_ASSERT(_EXPR, ...) assert(_EXPR) #endif -// Define attributes of all API symbols declarations, e.g. for DLL under Windows. -#ifndef IMGUI_API -#define IMGUI_API -#endif - +// Some compilers support applying printf-style warnings to user functions. #if defined(__clang__) || defined(__GNUC__) #define IM_PRINTFARGS(FMT) __attribute__((format(printf, FMT, (FMT+1)))) #else @@ -36,39 +37,50 @@ #endif // Forward declarations -struct ImDrawCmd; -struct ImDrawList; -struct ImDrawData; -struct ImFont; -struct ImFontAtlas; -struct ImColor; -struct ImGuiIO; -struct ImGuiStorage; -struct ImGuiStyle; - +struct ImDrawChannel; // Temporary storage for outputting drawing commands out of order, used by ImDrawList::ChannelsSplit() +struct ImDrawCmd; // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call) +struct ImDrawData; // All draw command lists required to render the frame +struct ImDrawList; // A single draw command list (generally one per window) +struct ImDrawVert; // A single vertex (20 bytes by default, override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT) +struct ImFont; // Runtime data for a single font within a parent ImFontAtlas +struct ImFontAtlas; // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF font loader +struct ImFontConfig; // Configuration data when adding a font or merging fonts +struct ImColor; // Helper functions to create a color that can be converted to either u32 or float4 +struct ImGuiIO; // Main configuration and I/O between your application and ImGui +struct ImGuiOnceUponAFrame; // Simple helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro +struct ImGuiStorage; // Simple custom key value storage +struct ImGuiStyle; // Runtime data for styling/colors +struct ImGuiTextFilter; // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" +struct ImGuiTextBuffer; // Text buffer for logging/accumulating text +struct ImGuiTextEditCallbackData; // Shared state of ImGui::InputText() when using custom callbacks (advanced) +struct ImGuiListClipper; // Helper to manually clip large list of items + +// Enumerations (declared as int for compatibility and to not pollute the top of this file) typedef unsigned int ImU32; typedef unsigned short ImWchar; // character for keyboard input/display typedef void* ImTextureID; // user data to refer to a texture (e.g. store your texture handle/id) typedef ImU32 ImGuiID; // unique ID used by widgets (typically hashed from a stack of string) -typedef int ImGuiCol; // enum ImGuiCol_ -typedef int ImGuiStyleVar; // enum ImGuiStyleVar_ -typedef int ImGuiKey; // enum ImGuiKey_ -typedef int ImGuiAlign; // enum ImGuiAlign_ -typedef int ImGuiColorEditMode; // enum ImGuiColorEditMode_ -typedef int ImGuiMouseCursor; // enum ImGuiMouseCursor_ -typedef int ImGuiWindowFlags; // enum ImGuiWindowFlags_ -typedef int ImGuiSetCond; // enum ImGuiSetCond_ -typedef int ImGuiInputTextFlags; // enum ImGuiInputTextFlags_ -typedef int ImGuiSelectableFlags; // enum ImGuiSelectableFlags_ -struct ImGuiTextEditCallbackData; // for advanced uses of InputText() +typedef int ImGuiCol; // a color identifier for styling // enum ImGuiCol_ +typedef int ImGuiStyleVar; // a variable identifier for styling // enum ImGuiStyleVar_ +typedef int ImGuiKey; // a key identifier (ImGui-side enum) // enum ImGuiKey_ +typedef int ImGuiAlign; // alignment // enum ImGuiAlign_ +typedef int ImGuiColorEditMode; // color edit mode for ColorEdit*() // enum ImGuiColorEditMode_ +typedef int ImGuiMouseCursor; // a mouse cursor identifier // enum ImGuiMouseCursor_ +typedef int ImGuiWindowFlags; // window flags for Begin*() // enum ImGuiWindowFlags_ +typedef int ImGuiSetCond; // condition flags for Set*() // enum ImGuiSetCond_ +typedef int ImGuiInputTextFlags; // flags for InputText*() // enum ImGuiInputTextFlags_ +typedef int ImGuiSelectableFlags; // flags for Selectable() // enum ImGuiSelectableFlags_ typedef int (*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data); +// Others helpers at bottom of the file: +// class ImVector<> // Lightweight std::vector like class. +// IMGUI_ONCE_UPON_A_FRAME // Execute a block of code once per frame only (convenient for creating UI within deep-nested code that runs multiple times) + struct ImVec2 { float x, y; ImVec2() { x = y = 0.0f; } ImVec2(float _x, float _y) { x = _x; y = _y; } - #ifdef IM_VEC2_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec2. IM_VEC2_CLASS_EXTRA #endif @@ -79,25 +91,11 @@ struct ImVec4 float x, y, z, w; ImVec4() { x = y = z = w = 0.0f; } ImVec4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; } - #ifdef IM_VEC4_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec4. IM_VEC4_CLASS_EXTRA #endif }; -// Helpers at bottom of the file: -// - class ImVector<> // Lightweight std::vector like class. -// - IMGUI_ONCE_UPON_A_FRAME // Execute a block of code once per frame only (convenient for creating UI within deep-nested code that runs multiple times) -// - struct ImGuiTextFilter // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" -// - struct ImGuiTextBuffer // Text buffer for logging/accumulating text -// - struct ImGuiStorage // Custom key value storage (if you need to alter open/close states manually) -// - struct ImGuiTextEditCallbackData // Shared state of ImGui::InputText() when using custom callbacks -// - struct ImGuiListClipper // Helper to manually clip large list of items. -// - struct ImColor // Helper functions to created packed 32-bit RGBA color values -// - struct ImDrawList // Draw command list -// - struct ImFontAtlas // Bake multiple fonts into a single texture, TTF font loader, bake glyphs into bitmap -// - struct ImFont // Single font - // ImGui end-user API // In a namespace so that user can add extra functions in a separate file (e.g. Value() helpers for your vector or common types) namespace ImGui @@ -376,6 +374,7 @@ namespace ImGui IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item in screen space IMGUI_API ImVec2 GetItemRectMax(); // " IMGUI_API ImVec2 GetItemRectSize(); // " + IMGUI_API void SetItemAllowOverlap(); // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area. IMGUI_API bool IsWindowHovered(); // is current window hovered and hoverable (not blocked by a popup) (differentiate child windows from each others) IMGUI_API bool IsWindowFocused(); // is current window focused IMGUI_API bool IsRootWindowFocused(); // is current root window focused (top parent window in case of child windows) @@ -453,17 +452,19 @@ enum ImGuiWindowFlags_ ImGuiWindowFlags_NoTitleBar = 1 << 0, // Disable title-bar ImGuiWindowFlags_NoResize = 1 << 1, // Disable user resizing with the lower-right grip ImGuiWindowFlags_NoMove = 1 << 2, // Disable user moving the window - ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbar (window can still scroll with mouse or programatically) - ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user scrolling with mouse wheel + ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbars (window can still scroll with mouse or programatically) + ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame ImGuiWindowFlags_ShowBorders = 1 << 7, // Show borders around windows and items ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file ImGuiWindowFlags_NoInputs = 1 << 9, // Disable catching mouse or keyboard inputs ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar - ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Enable horizontal scrollbar (off by default). You need to use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. + ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Allow horizontal scrollbar to appear (off by default). You need to use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state ImGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13, // Disable bringing window to front when taking focus (e.g. clicking on it or programatically giving it focus) + ImGuiWindowFlags_ForceVerticalScrollbar = 1 << 14, // Always show vertical scrollbar (even if ContentSize.y < Size.y) + ImGuiWindowFlags_ForceHorizontalScrollbar=1 << 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x) // [Internal] ImGuiWindowFlags_ChildWindow = 1 << 20, // Don't use! For internal use by BeginChild() ImGuiWindowFlags_ChildWindowAutoFitX = 1 << 21, // Don't use! For internal use by BeginChild() @@ -837,7 +838,7 @@ public: inline iterator insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(value_type)); Data[off] = v; Size++; return Data + off; } }; -// Helper: execute a block of code once a frame only +// Helper: execute a block of code at maximum once a frame // Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame. // Usage: // IMGUI_ONCE_UPON_A_FRAME @@ -919,30 +920,30 @@ struct ImGuiStorage Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; } Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; } }; - ImVector Data; + ImVector Data; // - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N) // - Set***() functions find pair, insertion on demand if missing. // - Sorted insertion is costly but should amortize. A typical frame shouldn't need to insert any new pair. - IMGUI_API void Clear(); - IMGUI_API int GetInt(ImGuiID key, int default_val = 0) const; - IMGUI_API void SetInt(ImGuiID key, int val); - IMGUI_API float GetFloat(ImGuiID key, float default_val = 0.0f) const; - IMGUI_API void SetFloat(ImGuiID key, float val); - IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL - IMGUI_API void SetVoidPtr(ImGuiID key, void* val); + IMGUI_API void Clear(); + IMGUI_API int GetInt(ImGuiID key, int default_val = 0) const; + IMGUI_API void SetInt(ImGuiID key, int val); + IMGUI_API float GetFloat(ImGuiID key, float default_val = 0.0f) const; + IMGUI_API void SetFloat(ImGuiID key, float val); + IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL + IMGUI_API void SetVoidPtr(ImGuiID key, void* val); // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set. // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. // - A typical use case where this is convenient: // float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar; // - You can also use this to quickly create temporary editable values during a session of using Edit&Continue, without restarting your application. - IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0); - IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0); - IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL); + IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0); + IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0); + IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL); // Use on your own storage if you know only integer are being stored (open/close all tree nodes) - IMGUI_API void SetAllInt(int val); + IMGUI_API void SetAllInt(int val); }; // Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used. @@ -1028,15 +1029,20 @@ struct ImGuiListClipper // Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList. //----------------------------------------------------------------------------- +// Helpers macros to generate 32-bits encoded colors +#define IM_COL32(R,G,B,A) (((ImU32)(A)<<24) | ((ImU32)(B)<<16) | ((ImU32)(G)<<8) | ((ImU32)(R))) +#define IM_COL32_WHITE (0xFFFFFFFF) +#define IM_COL32_BLACK (0xFF000000) +#define IM_COL32_BLACK_TRANS (0x00000000) // Transparent black + // Draw callbacks for advanced uses. // NB- You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering (you can poke into the draw list for that) -// Draw callback are useful for example if you want to render a complex 3D scene inside a UI element. +// Draw callback may be useful for example, if you want to render a complex 3D scene inside a UI element, change your GPU render state, etc. // The expected behavior from your rendering loop is: // if (cmd.UserCallback != NULL) // cmd.UserCallback(parent_list, cmd); // else // RenderTriangles() -// It is up to you to decide if your rendering loop or the callback should be responsible for backup/restoring rendering state. typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd); // Typically, 1 command = 1 gpu draw call (unless command is a callback) @@ -1066,9 +1072,9 @@ struct ImDrawVert ImU32 col; }; #else -// You can change the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h +// You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h // The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine. -// The type has to be described by the #define (you can either declare the struct or use a typedef) +// The type has to be described within the macro (you can either declare the struct or use a typedef) IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT; #endif @@ -1086,7 +1092,6 @@ struct ImDrawChannel // If you want to add custom rendering within a window, you can use ImGui::GetWindowDrawList() to access the current draw list and add your own primitives. // You can interleave normal ImGui:: calls and adding primitives to the current draw list. // All positions are in screen coordinates (0,0=top-left, 1 pixel per unit). Primitives are always added to the list and not culled (culling is done at render time and at a higher-level by ImGui:: functions). -// Note that this only gives you access to rendering polygons. If your intent is to create custom widgets and the publicly exposed functions/data aren't sufficient, you can add code in imgui_user.inl struct ImDrawList { // This is what you have to render @@ -1108,7 +1113,7 @@ struct ImDrawList ImDrawList() { _OwnerName = NULL; Clear(); } ~ImDrawList() { ClearFreeMemory(); } - IMGUI_API void PushClipRect(const ImVec4& clip_rect); // Scissoring. The values are x1, y1, x2, y2. Only apply to rendering. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) + IMGUI_API void PushClipRect(const ImVec4& clip_rect); // Scissoring. Note that the values are (x1,y1,x2,y2) and NOT (x1,y1,w,h). This is passed down to your render function but not used for CPU-side clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) IMGUI_API void PushClipRectFullScreen(); IMGUI_API void PopClipRect(); IMGUI_API void PushTextureID(const ImTextureID& texture_id); @@ -1156,8 +1161,9 @@ struct ImDrawList IMGUI_API void Clear(); IMGUI_API void ClearFreeMemory(); IMGUI_API void PrimReserve(int idx_count, int vtx_count); - IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); + IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles) IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col); + IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col); inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } inline void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col){ _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; } inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; } diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp index 5f734abb1e7..8fd48b0b01b 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp @@ -223,8 +223,7 @@ void ImGui::ShowTestWindow(bool* p_opened) if (ImGui::TreeNode("Fonts", "Fonts (%d)", ImGui::GetIO().Fonts->Fonts.Size)) { - ImGui::SameLine(); - ShowHelpMarker("Tip: Load fonts with io.Fonts->AddFontFromFileTTF()\nbefore calling io.Fonts->GetTex* functions."); + ImGui::SameLine(); ShowHelpMarker("Tip: Load fonts with io.Fonts->AddFontFromFileTTF()\nbefore calling io.Fonts->GetTex* functions."); ImFontAtlas* atlas = ImGui::GetIO().Fonts; if (ImGui::TreeNode("Atlas texture", "Atlas texture (%dx%d pixels)", atlas->TexWidth, atlas->TexHeight)) { @@ -442,9 +441,9 @@ void ImGui::ShowTestWindow(bool* p_opened) ImGui::Text("Password input"); static char bufpass[64] = "password123"; - ImGui::InputText("password", bufpass, 64, ImGuiInputTextFlags_Password); + ImGui::InputText("password", bufpass, 64, ImGuiInputTextFlags_Password | ImGuiInputTextFlags_CharsNoBlank); ImGui::SameLine(); ShowHelpMarker("Display all characters as '*'.\nDisable clipboard cut and copy.\nDisable logging.\n"); - ImGui::InputText("password (clear)", bufpass, 64); + ImGui::InputText("password (clear)", bufpass, 64, ImGuiInputTextFlags_CharsNoBlank); ImGui::TreePop(); } @@ -812,26 +811,36 @@ void ImGui::ShowTestWindow(bool* p_opened) if (ImGui::TreeNode("Widgets Width")) { static float f = 0.0f; - ImGui::Text("PushItemWidth(100)"); + ImGui::Text("PushItemWidth(100)"); + ImGui::SameLine(); ShowHelpMarker("Fixed width."); ImGui::PushItemWidth(100); ImGui::DragFloat("float##1", &f); ImGui::PopItemWidth(); - ImGui::Text("PushItemWidth(GetWindowWidth() * 0.5f);"); + ImGui::Text("PushItemWidth(GetWindowWidth() * 0.5f)"); + ImGui::SameLine(); ShowHelpMarker("Half of window width."); ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f); ImGui::DragFloat("float##2", &f); ImGui::PopItemWidth(); - ImGui::Text("PushItemWidth(GetContentRegionAvailWidth() * 0.5f);"); + ImGui::Text("PushItemWidth(GetContentRegionAvailWidth() * 0.5f)"); + ImGui::SameLine(); ShowHelpMarker("Half of available width.\n(~ right-cursor_pos)\n(works within a column set)"); ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() * 0.5f); ImGui::DragFloat("float##3", &f); ImGui::PopItemWidth(); - ImGui::Text("PushItemWidth(-100);"); + ImGui::Text("PushItemWidth(-100)"); + ImGui::SameLine(); ShowHelpMarker("Align to right edge minus 100"); ImGui::PushItemWidth(-100); ImGui::DragFloat("float##4", &f); ImGui::PopItemWidth(); + ImGui::Text("PushItemWidth(-1)"); + ImGui::SameLine(); ShowHelpMarker("Align to right edge"); + ImGui::PushItemWidth(-1); + ImGui::DragFloat("float##5", &f); + ImGui::PopItemWidth(); + ImGui::TreePop(); } diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp index b5d25eaa0be..256bbfdd751 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp @@ -14,10 +14,10 @@ #include "imgui.h" #define IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_PLACEMENT_NEW #include "imgui_internal.h" #include // vsnprintf, sscanf, printf -#include // new (ptr) #if !defined(alloca) && !defined(__FreeBSD__) #ifdef _WIN32 #include // alloca @@ -37,7 +37,7 @@ #pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok. #pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it. #pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness // -#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier // +//#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier // #endif #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used @@ -267,7 +267,7 @@ void ImDrawList::ChannelsSplit(int channels_count) { if (i >= old_channels_count) { - new(&_Channels[i]) ImDrawChannel(); + IM_PLACEMENT_NEW(&_Channels[i]) ImDrawChannel(); } else { @@ -346,13 +346,13 @@ void ImDrawList::PrimReserve(int idx_count, int vtx_count) _IdxWritePtr = IdxBuffer.Data + idx_buffer_size; } +// Fully unrolled with inline call to keep our debug builds decently fast. void ImDrawList::PrimRect(const ImVec2& a, const ImVec2& c, ImU32 col) { - const ImVec2 uv = GImGui->FontTexUvWhitePixel; - const ImVec2 b(c.x, a.y); - const ImVec2 d(a.x, c.y); - _IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx+1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx+2); - _IdxWritePtr[3] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[4] = (ImDrawIdx)(_VtxCurrentIdx+2); _IdxWritePtr[5] = (ImDrawIdx)(_VtxCurrentIdx+3); + ImVec2 b(c.x, a.y), d(a.x, c.y), uv(GImGui->FontTexUvWhitePixel); + ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx; + _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2); + _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3); _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col; _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col; _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv; _VtxWritePtr[2].col = col; @@ -364,12 +364,24 @@ void ImDrawList::PrimRect(const ImVec2& a, const ImVec2& c, ImU32 col) void ImDrawList::PrimRectUV(const ImVec2& a, const ImVec2& c, const ImVec2& uv_a, const ImVec2& uv_c, ImU32 col) { - const ImVec2 b(c.x, a.y); - const ImVec2 d(a.x, c.y); - const ImVec2 uv_b(uv_c.x, uv_a.y); - const ImVec2 uv_d(uv_a.x, uv_c.y); - _IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx+1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx+2); - _IdxWritePtr[3] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[4] = (ImDrawIdx)(_VtxCurrentIdx+2); _IdxWritePtr[5] = (ImDrawIdx)(_VtxCurrentIdx+3); + ImVec2 b(c.x, a.y), d(a.x, c.y), uv_b(uv_c.x, uv_a.y), uv_d(uv_a.x, uv_c.y); + ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx; + _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2); + _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3); + _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col; + _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col; + _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col; + _VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv_d; _VtxWritePtr[3].col = col; + _VtxWritePtr += 4; + _VtxCurrentIdx += 4; + _IdxWritePtr += 6; +} + +void ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col) +{ + ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx; + _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2); + _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3); _VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col; _VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col; _VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col; @@ -893,7 +905,7 @@ void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, CmdBuffer.back().ElemCount -= idx_unused; _VtxWritePtr -= vtx_unused; _IdxWritePtr -= idx_unused; - _VtxCurrentIdx = (ImDrawIdx)VtxBuffer.Size; + _VtxCurrentIdx = (unsigned int)VtxBuffer.Size; } // This is one of the few function breaking the encapsulation of ImDrawLst, but it is just so useful. @@ -1087,7 +1099,7 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg) if (!font_cfg->MergeMode) { ImFont* font = (ImFont*)ImGui::MemAlloc(sizeof(ImFont)); - new (font) ImFont(); + IM_PLACEMENT_NEW(font) ImFont(); Fonts.push_back(font); } @@ -1235,8 +1247,9 @@ bool ImFontAtlas::Build() } } - // Start packing - TexWidth = (TexDesiredWidth > 0) ? TexDesiredWidth : (total_glyph_count > 2000) ? 2048 : (total_glyph_count > 1000) ? 1024 : 512; // Width doesn't actually matters much but some API/GPU have texture size limitations, and increasing width can decrease height. + // Start packing. We need a known width for the skyline algorithm. Using a cheap heuristic here to decide of width. User can override TexDesiredWidth if they wish. + // After packing is done, width shouldn't matter much, but some API/GPU have texture size limitations and increasing width can decrease height. + TexWidth = (TexDesiredWidth > 0) ? TexDesiredWidth : (total_glyph_count > 4000) ? 4096 : (total_glyph_count > 2000) ? 2048 : (total_glyph_count > 1000) ? 1024 : 512; TexHeight = 0; const int max_tex_height = 1024*32; stbtt_pack_context spc; diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h index 3c028c38cb8..54c777e0dfa 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h @@ -137,6 +137,15 @@ static inline float ImLengthSqr(const ImVec4& lhs) static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = lhs.x*lhs.x + lhs.y*lhs.y; if (d > 0.0f) return 1.0f / sqrtf(d); return fail_value; } static inline ImVec2 ImRound(ImVec2 v) { return ImVec2((float)(int)v.x, (float)(int)v.y); } +// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax. +// Defining a custom placement new() with a dummy parameter allows us to bypass including which on some platforms complains when user has disabled exceptions. +#ifdef IMGUI_DEFINE_PLACEMENT_NEW +struct ImPlacementNewDummy {}; +inline void* operator new(size_t, ImPlacementNewDummy, void* ptr) { return ptr; } +inline void operator delete(void*, ImPlacementNewDummy, void*) {} +#define IM_PLACEMENT_NEW(_PTR) new(ImPlacementNewDummy() ,_PTR) +#endif + //----------------------------------------------------------------------------- // Types //----------------------------------------------------------------------------- @@ -371,7 +380,6 @@ struct ImGuiState ImGuiWindow* MovedWindow; // Track the child window we clicked on to move a window. Pointer is only valid if ActiveID is the "#MOVE" identifier of a window. ImVector Settings; // .ini Settings float SettingsDirtyTimer; // Save .ini settinngs on disk when time reaches zero - int DisableHideTextAfterDoubleHash; ImVector ColorModifiers; // Stack for PushStyleColor()/PopStyleColor() ImVector StyleModifiers; // Stack for PushStyleVar()/PopStyleVar() ImVector FontStack; // Stack for PushFont()/PopFont() @@ -455,7 +463,6 @@ struct ImGuiState ActiveIdWindow = NULL; MovedWindow = NULL; SettingsDirtyTimer = 0.0f; - DisableHideTextAfterDoubleHash = 0; SetNextWindowPosVal = ImVec2(0.0f, 0.0f); SetNextWindowSizeVal = ImVec2(0.0f, 0.0f); @@ -600,7 +607,8 @@ struct IMGUI_API ImGuiWindow ImVec2 ScrollTarget; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change) ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered bool ScrollbarX, ScrollbarY; - ImVec2 ScrollbarSizes; // + ImVec2 ScrollbarSizes; + float BorderSize; bool Active; // Set to true on Begin() bool WasActive; bool Accessed; // Set to true when any widget access the current window @@ -684,7 +692,6 @@ namespace ImGui IMGUI_API void FocusableItemUnregister(ImGuiWindow* window); IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y); IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x); - IMGUI_API void SetItemAllowOverlap(); // Allow last item to be overlapped by a subsequent item IMGUI_API void OpenPopupEx(const char* str_id, bool reopen_existing); diff --git a/3rdparty/bgfx/3rdparty/pvrtc/BitScale.h b/3rdparty/bgfx/3rdparty/pvrtc/BitScale.h index a9e5cec32e6..b600fe9350e 100644 --- a/3rdparty/bgfx/3rdparty/pvrtc/BitScale.h +++ b/3rdparty/bgfx/3rdparty/pvrtc/BitScale.h @@ -2,7 +2,7 @@ #pragma once -#include +#include //============================================================================ diff --git a/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c b/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c index d8af75bb010..6b3a35695f2 100644 --- a/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c +++ b/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c @@ -5506,7 +5506,8 @@ static void* rmtglGetProcAddress(OpenGL* opengl, const char* symbol) #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) - return NSGLGetProcAddress((const GLubyte*)symbol); + extern void* nsglGetProcAddress(const GLubyte* _name); + return nsglGetProcAddress((const GLubyte*)symbol); #elif defined(RMT_PLATFORM_LINUX) diff --git a/3rdparty/bgfx/3rdparty/stb/stb_image.c b/3rdparty/bgfx/3rdparty/stb/stb_image.c index bc305501477..130d6c01d61 100644 --- a/3rdparty/bgfx/3rdparty/stb/stb_image.c +++ b/3rdparty/bgfx/3rdparty/stb/stb_image.c @@ -1,5 +1,6 @@ #ifdef __GNUC__ # pragma GCC diagnostic ignored "-Wshadow" +# pragma GCC diagnostic ignored "-Warray-bounds" #elif defined(_MSC_VER) # pragma warning(disable:4312) // warning C4312: 'type cast': conversion from '' to '' of greater size # pragma warning(disable:4456) // warning C4456: declaration of 'k' hides previous local declaration diff --git a/3rdparty/bgfx/3rdparty/tinyexr/tinyexr.h b/3rdparty/bgfx/3rdparty/tinyexr/tinyexr.h index d6ed38b7254..90cd29584cc 100644 --- a/3rdparty/bgfx/3rdparty/tinyexr/tinyexr.h +++ b/3rdparty/bgfx/3rdparty/tinyexr/tinyexr.h @@ -1306,8 +1306,17 @@ typedef struct { m_tree[TINFL_MAX_HUFF_SYMBOLS_0 * 2]; } tinfl_huff_table; -#if MINIZ_HAS_64BIT_REGISTERS -#define TINFL_USE_64BIT_BITBUF 1 + +#ifndef MINIZ_HAS_64BIT_REGISTERS +# define MINIZ_HAS_64BIT_REGISTERS 0 +#endif + +#ifndef TINFL_USE_64BIT_BITBUF +# if MINIZ_HAS_64BIT_REGISTERS +# define TINFL_USE_64BIT_BITBUF 1 +# else +# define TINFL_USE_64BIT_BITBUF 0 +# endif #endif #if TINFL_USE_64BIT_BITBUF @@ -4318,7 +4327,7 @@ void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, #include #include -#if defined(_MSC_VER) || defined(__MINGW64__) +#if defined(_MSC_VER) //|| defined(__MINGW64__) static FILE *mz_fopen(const char *pFilename, const char *pMode) { FILE *pFile = NULL; fopen_s(&pFile, pFilename, pMode); diff --git a/3rdparty/bgfx/README.md b/3rdparty/bgfx/README.md index 0548f2d68ca..19c0a07167a 100644 --- a/3rdparty/bgfx/README.md +++ b/3rdparty/bgfx/README.md @@ -1,6 +1,9 @@ [bgfx](https://github.com/bkaradzic/bgfx) - Cross-platform rendering library ============================================================================ +[![Build Status](https://travis-ci.org/bkaradzic/bgfx.svg?branch=master)](https://travis-ci.org/bkaradzic/bgfx) +[![Build status](https://ci.appveyor.com/api/projects/status/ipa3ojgeaet1oko5?svg=true)](https://ci.appveyor.com/project/bkaradzic/bgfx) + [What is it?](https://bkaradzic.github.io/bgfx/overview.html) ------------------------------------------------------------- @@ -29,12 +32,12 @@ Supported platforms: * asm.js/Emscripten (1.25.0) * FreeBSD * iOS (iPhone, iPad, AppleTV) - * Linux ![](https://tc27.draster.com/app/rest/builds/buildType:(id:Bgfx_Linux)/statusIcon) + * Linux * MIPS Creator CI20 * Native Client (PPAPI 37+, ARM, x86, x64, PNaCl) * OSX (10.9+) * RaspberryPi - * Windows (XP, Vista, 7, 8, 10) ![](https://tc27.draster.com/app/rest/builds/buildType:(id:Bgfx_Windows)/statusIcon) + * Windows (XP, Vista, 7, 8, 10) * WinRT (WinPhone 8.0+) Supported compilers: @@ -51,11 +54,13 @@ Languages: * [Go language API bindings](https://github.com/james4k/go-bgfx) * [Java language API bindings](https://github.com/enleeten/twilight-bgfx) * [Haskell language API bindings](https://github.com/haskell-game/bgfx) + * [Rust language API bindings](https://github.com/rhoot/bgfx-rs) -Build status ------------- +Build +----- -https://tc27.draster.com/guestAuth/overview.html + - AppVeyor https://ci.appveyor.com/project/bkaradzic/bgfx + - TravisCI https://travis-ci.org/bkaradzic/bgfx Who is using it? ---------------- @@ -107,6 +112,9 @@ https://github.com/jpcy/ioq3-renderer-bgfx - A renderer for ioquake3 written in C++ and using bgfx to support multiple rendering APIs. ![ioq3-renderer-bgfx screenshot](https://camo.githubusercontent.com/052aa40c05120e56306294d3a1bb5f99f97de8c8/687474703a2f2f692e696d6775722e636f6d2f64364f6856594b2e6a7067) +http://makingartstudios.itch.io/dls - DLS the digital logic simulator game. +![dls-screenshot](https://img.itch.io/aW1hZ2UvMzk3MTgvMTc5MjQ4LnBuZw==/original/kA%2FQPb.png) + [Building](https://bkaradzic.github.io/bgfx/build.html) ------------------------------------------------------- diff --git a/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h b/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h index f26ec2830b7..694e76a6b0d 100644 --- a/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h +++ b/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h @@ -26,35 +26,36 @@ static const uint8_t fs_metaballs_glsl[398] = 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, // gl_FragColor = 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tmpvar_2;.}... }; -static const uint8_t fs_metaballs_dx9[429] = +static const uint8_t fs_metaballs_dx9[433] = { - 0x46, 0x53, 0x48, 0x04, 0x03, 0x2c, 0xf5, 0x3f, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x03, 0xff, 0xff, // FSH..,.?........ - 0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... + 0x46, 0x53, 0x48, 0x04, 0x03, 0x2c, 0xf5, 0x3f, 0x00, 0x00, 0xa4, 0x01, 0x00, 0x03, 0xff, 0xff, // FSH..,.?........ + 0xfe, 0xff, 0x17, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... 0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................ 0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh - 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9. - 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, // 29.952.3111.Q... - 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0xf0, 0x41, 0xcd, 0xcc, 0x0c, 0x40, 0x2f, 0xba, 0xe8, 0x3e, // .......A...@/..> - 0x00, 0x00, 0x80, 0x3f, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0x90, // ...?............ - 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x01, 0x00, 0x07, 0x90, 0x08, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x01, 0x00, 0xe4, 0x90, 0x07, 0x00, 0x00, 0x02, // ................ - 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, // ................ - 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xaa, 0x90, 0x20, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, // ........ ....... - 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0xa0, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, // ................ - 0x00, 0x00, 0x00, 0x90, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x90, // ..............U. - 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x90, 0x05, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x0e, 0x80, 0x02, 0x00, 0x90, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x0e, 0x00, 0x00, 0x02, // ..........U..... - 0x02, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, // ......U......... - 0x00, 0x00, 0xaa, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x00, 0x00, 0xff, 0x80, // ................ - 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x00, 0x00, 0x00, 0x81, // ................ - 0x01, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, // ................ - 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0f, 0x00, 0x00, 0x02, // ..........U..... - 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, // ................ - 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x01, 0x80, // ................ - 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, // ..............U. - 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x01, 0x00, 0x00, 0x02, // ................ - 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0xff, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ............. + 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, // ader Compiler 10 + 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, // .0.10011.16384.. + 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0xf0, 0x41, 0xcd, 0xcc, 0x0c, 0x40, // Q..........A...@ + 0x2f, 0xba, 0xe8, 0x3e, 0x00, 0x00, 0x80, 0x3f, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, // /..>...?........ + 0x00, 0x00, 0x07, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x01, 0x00, 0x07, 0x90, // ................ + 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x01, 0x00, 0xe4, 0x90, // ................ + 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, // ................ + 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xaa, 0x90, 0x20, 0x00, 0x00, 0x03, // ............ ... + 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0xa0, 0x0f, 0x00, 0x00, 0x02, // ................ + 0x02, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x90, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, // ................ + 0x00, 0x00, 0x55, 0x90, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x90, // ..U............. + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0e, 0x80, 0x02, 0x00, 0x90, 0x80, 0x00, 0x00, 0x55, 0xa0, // ..............U. + 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, // ..........U..... + 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, // ................ + 0x00, 0x00, 0xff, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, // ................ + 0x00, 0x00, 0x00, 0x81, 0x01, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, // ................ + 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, // ..............U. + 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x05, 0x00, 0x00, 0x03, // ................ + 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x0e, 0x00, 0x00, 0x02, // ................ + 0x00, 0x08, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x02, 0x80, // ................ + 0x00, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, // ..U............. + 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0xff, 0xa0, 0xff, 0xff, 0x00, 0x00, // ................ + 0x00, // . }; static const uint8_t fs_metaballs_dx11[660] = { diff --git a/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h b/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h index 70f3e56b654..1e35cc2394e 100644 --- a/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h +++ b/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h @@ -35,12 +35,12 @@ static const uint8_t vs_metaballs_glsl[537] = 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, // v_color0 = a_col 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}... }; -static const uint8_t vs_metaballs_dx9[457] = +static const uint8_t vs_metaballs_dx9[461] = { 0x56, 0x53, 0x48, 0x04, 0x03, 0x2c, 0xf5, 0x3f, 0x02, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..,.?...u_mod 0x65, 0x6c, 0x04, 0x20, 0x04, 0x00, 0x03, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // el. .....u_model - 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x98, 0x01, // ViewProj........ - 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x2e, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, // ........CTAB.... + 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x9c, 0x01, // ViewProj........ + 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x2f, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, // ....../.CTAB.... 0x83, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, // ................ 0x00, 0x91, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, // ....|...D....... 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, // ....L........... @@ -51,21 +51,21 @@ static const uint8_t vs_metaballs_dx9[457] = 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, // ........vs_3_0.M 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, // icrosoft (R) HLS 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, // L Shader Compile - 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, // r 9.29.952.3111. - 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................ - 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, // ................ - 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, // ................ - 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, // ................ - 0x05, 0x00, 0x01, 0x80, 0x02, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ................ - 0x01, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, // ......U......... - 0x00, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, // ................ - 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, // ................ - 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, // ................ - 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x05, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, // ..............U. - 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x04, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, // ................ - 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, 0xe0, 0x06, 0x00, 0xe4, 0xa0, // ................ - 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, // ................ - 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ......... + 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, // r 10.0.10011.163 + 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, // 84.............. + 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................ + 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, // ................ + 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, // ................ + 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x02, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, // ................ + 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, // ..........U..... + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, // ................ + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, // ................ + 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, // ................ + 0x03, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x05, 0x00, 0xe4, 0xa0, // ................ + 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x04, 0x00, 0xe4, 0xa0, // ..U............. + 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, 0xe0, // ................ + 0x06, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, // ................ + 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............. }; static const uint8_t vs_metaballs_dx11[726] = { diff --git a/3rdparty/bgfx/examples/08-update/update.cpp b/3rdparty/bgfx/examples/08-update/update.cpp index 65045d383fd..8a5d851ba7c 100644 --- a/3rdparty/bgfx/examples/08-update/update.cpp +++ b/3rdparty/bgfx/examples/08-update/update.cpp @@ -240,7 +240,7 @@ public: , BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT ); - m_m_texture2dData = (uint8_t*)malloc(m_texture2dSize*m_texture2dSize*4); + m_texture2dData = (uint8_t*)malloc(m_texture2dSize*m_texture2dSize*4); m_rr = rand()%255; m_gg = rand()%255; @@ -255,13 +255,13 @@ public: virtual int shutdown() BX_OVERRIDE { - // m_m_texture2dData is managed from main thread, and it's passed to renderer + // m_texture2dData is managed from main thread, and it's passed to renderer // just as MemoryRef. At this point render might be using it. We must wait // previous frame to finish before we can free it. bgfx::frame(); // Cleanup. - free(m_m_texture2dData); + free(m_texture2dData); for (uint32_t ii = 0; ii < BX_COUNTOF(m_textures); ++ii) { @@ -380,7 +380,7 @@ public: const uint16_t tx = rand()%(m_texture2dSize-tw); const uint16_t ty = rand()%(m_texture2dSize-th); - uint8_t* dst = &m_m_texture2dData[(ty*m_texture2dSize+tx)*4]; + uint8_t* dst = &m_texture2dData[(ty*m_texture2dSize+tx)*4]; uint8_t* next = dst + pitch; // Using makeRef to pass texture memory without copying. @@ -537,7 +537,7 @@ public: return false; } - uint8_t* m_m_texture2dData; + uint8_t* m_texture2dData; uint32_t m_width; uint32_t m_height; diff --git a/3rdparty/bgfx/examples/09-hdr/hdr.cpp b/3rdparty/bgfx/examples/09-hdr/hdr.cpp index 14f6edca81b..047fb0aa565 100644 --- a/3rdparty/bgfx/examples/09-hdr/hdr.cpp +++ b/3rdparty/bgfx/examples/09-hdr/hdr.cpp @@ -205,7 +205,7 @@ class HDR : public entry::AppI m_mesh = meshLoad("meshes/bunny.bin"); m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP); - m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY); + m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY); m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true); m_lum[0] = bgfx::createFrameBuffer(128, 128, bgfx::TextureFormat::BGRA8); @@ -308,7 +308,7 @@ class HDR : public entry::AppI bgfx::destroyFrameBuffer(m_fbh); m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, ( (msaa+1)<m_progDraw , s_renderStates[RenderState::Default] + , true ); // Bunny. @@ -2988,6 +2992,7 @@ int _main_(int _argc, char** _argv) , mtxBunny , *currentSmSettings->m_progDraw , s_renderStates[RenderState::Default] + , true ); // Hollow cube. @@ -2999,6 +3004,7 @@ int _main_(int _argc, char** _argv) , mtxHollowcube , *currentSmSettings->m_progDraw , s_renderStates[RenderState::Default] + , true ); // Cube. @@ -3010,6 +3016,7 @@ int _main_(int _argc, char** _argv) , mtxCube , *currentSmSettings->m_progDraw , s_renderStates[RenderState::Default] + , true ); // Trees. @@ -3023,6 +3030,7 @@ int _main_(int _argc, char** _argv) , mtxTrees[ii] , *currentSmSettings->m_progDraw , s_renderStates[RenderState::Default] + , true ); } diff --git a/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h b/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h index cf32868ff42..684132a061e 100644 --- a/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h +++ b/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h @@ -7,17 +7,17 @@ static const uint8_t fs_drawstress_glsl[89] = 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ragColor = v_col 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}... }; -static const uint8_t fs_drawstress_dx9[137] = +static const uint8_t fs_drawstress_dx9[141] = { - 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I..|..... - 0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... + 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I........ + 0xfe, 0xff, 0x17, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... 0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................ 0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh - 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9. - 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, // 29.952.3111..... - 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, // ................ - 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ......... + 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, // ader Compiler 10 + 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, // .0.10011.16384.. + 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, // ................ + 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............. }; static const uint8_t fs_drawstress_dx11[260] = { diff --git a/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h b/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h index 27cb89d15c3..2a2fcef2ada 100644 --- a/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h +++ b/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h @@ -22,11 +22,11 @@ static const uint8_t vs_drawstress_glsl[325] = 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // lor0 = a_color0; 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... }; -static const uint8_t vs_drawstress_dx9[319] = +static const uint8_t vs_drawstress_dx9[323] = { 0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH....I...u_mod 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x1c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........#.CTAB.. + 0x20, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // .......$.CTAB.. 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W............. 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0..... 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ @@ -34,16 +34,17 @@ static const uint8_t vs_drawstress_dx9[319] = 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft ( 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C - 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952 - 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111........... - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................ - 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, // ................ - 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ....U........... - 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ - 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................ - 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100 + 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // 11.16384........ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U....... + 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................ + 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................ + 0x00, 0x00, 0x00, // ... }; static const uint8_t vs_drawstress_dx11[510] = { diff --git a/3rdparty/bgfx/examples/27-terrain/terrain.cpp b/3rdparty/bgfx/examples/27-terrain/terrain.cpp index 32686a7746e..71ab88aa128 100644 --- a/3rdparty/bgfx/examples/27-terrain/terrain.cpp +++ b/3rdparty/bgfx/examples/27-terrain/terrain.cpp @@ -69,7 +69,7 @@ class Terrain : public entry::AppI m_debug = BGFX_DEBUG_TEXT; m_reset = BGFX_RESET_VSYNC; - bgfx::init(bgfx::RendererType::Direct3D11, args.m_pciId); + bgfx::init(args.m_type, args.m_pciId); bgfx::reset(m_width, m_height, m_reset); // Enable m_debug text. @@ -313,11 +313,11 @@ class Terrain : public entry::AppI // Raise/Lower and scale by brush power. height += (bx::fclamp(brushAttn * m_brush.m_power, 0.0, m_brush.m_power) * m_brush.m_raise) - ? 1.0 - : -1.0 + ? 1.0f + : -1.0f ; - m_terrain.m_heightMap[heightMapPos] = (uint8_t)bx::fclamp(height, 0.0, 255.0); + m_terrain.m_heightMap[heightMapPos] = (uint8_t)bx::fclamp(height, 0.0f, 255.0f); m_terrain.m_dirty = true; } } @@ -328,8 +328,8 @@ class Terrain : public entry::AppI float ray_clip[4]; ray_clip[0] = ( (2.0f * m_mouseState.m_mx) / m_width - 1.0f) * -1.0f; ray_clip[1] = ( (1.0f - (2.0f * m_mouseState.m_my) / m_height) ) * -1.0f; - ray_clip[2] = -1.0; - ray_clip[3] = 1.0; + ray_clip[2] = -1.0f; + ray_clip[3] = 1.0f; float invProjMtx[16]; bx::mtxInverse(invProjMtx, m_projMtx); @@ -436,13 +436,15 @@ class Terrain : public entry::AppI imguiEndScrollArea(); imguiEndFrame(); - // Update camera. - cameraUpdate(deltaTime, m_mouseState); - - bool leftMouseButtonDown = !!m_mouseState.m_buttons[entry::MouseButton::Left]; - if (leftMouseButtonDown) + if (!imguiMouseOverArea() ) { - mousePickTerrain(); + // Update camera. + cameraUpdate(deltaTime, m_mouseState); + + if (!!m_mouseState.m_buttons[entry::MouseButton::Left]) + { + mousePickTerrain(); + } } // Update terrain. diff --git a/3rdparty/bgfx/examples/common/aviwriter.h b/3rdparty/bgfx/examples/common/aviwriter.h index 79acd7e4df9..dad992ab595 100644 --- a/3rdparty/bgfx/examples/common/aviwriter.h +++ b/3rdparty/bgfx/examples/common/aviwriter.h @@ -26,7 +26,7 @@ struct AviWriter bool open(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _fps, bool _yflip) { - if (0 != m_writer->open(_filePath) ) + if (!bx::open(m_writer, _filePath) ) { return false; } @@ -36,7 +36,7 @@ struct AviWriter m_numFrames = 0; m_width = _width; m_height = _height; - + // Bgfx returns _yflip true for OpenGL since bottom left corner is 0, 0. In D3D top left corner // is 0, 0. DIB expect OpenGL style coordinates, so this is inverted logic for AVI writer. m_yflip = !_yflip; @@ -163,7 +163,7 @@ struct AviWriter m_writer->seek(m_lengthOffset, bx::Whence::Begin); bx::write(m_writer, m_numFrames); - m_writer->close(); + bx::close(m_writer); delete [] m_frame; m_frame = NULL; diff --git a/3rdparty/bgfx/examples/common/bgfx_utils.cpp b/3rdparty/bgfx/examples/common/bgfx_utils.cpp index cdec2abbdfc..9b03d3d70b9 100644 --- a/3rdparty/bgfx/examples/common/bgfx_utils.cpp +++ b/3rdparty/bgfx/examples/common/bgfx_utils.cpp @@ -24,7 +24,7 @@ namespace stl = tinystl; void* load(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const char* _filePath, uint32_t* _size) { - if (0 == bx::open(_reader, _filePath) ) + if (bx::open(_reader, _filePath) ) { uint32_t size = (uint32_t)bx::getSize(_reader); void* data = BX_ALLOC(_allocator, size); @@ -45,6 +45,7 @@ void* load(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const char* _fi { *_size = 0; } + return NULL; } @@ -60,7 +61,7 @@ void unload(void* _ptr) static const bgfx::Memory* loadMem(bx::FileReaderI* _reader, const char* _filePath) { - if (0 == bx::open(_reader, _filePath) ) + if (bx::open(_reader, _filePath) ) { uint32_t size = (uint32_t)bx::getSize(_reader); const bgfx::Memory* mem = bgfx::alloc(size+1); @@ -76,7 +77,7 @@ static const bgfx::Memory* loadMem(bx::FileReaderI* _reader, const char* _filePa static void* loadMem(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const char* _filePath, uint32_t* _size) { - if (0 == bx::open(_reader, _filePath) ) + if (bx::open(_reader, _filePath) ) { uint32_t size = (uint32_t)bx::getSize(_reader); void* data = BX_ALLOC(_allocator, size); @@ -408,7 +409,9 @@ struct Mesh bx::AllocatorI* allocator = entry::getAllocator(); uint32_t chunk; - while (4 == bx::read(_reader, chunk) ) + bx::Error err; + while (4 == bx::read(_reader, chunk, &err) + && err.isOk() ) { switch (chunk) { @@ -596,10 +599,14 @@ Mesh* meshLoad(bx::ReaderSeekerI* _reader) Mesh* meshLoad(const char* _filePath) { bx::FileReaderI* reader = entry::getFileReader(); - bx::open(reader, _filePath); - Mesh* mesh = meshLoad(reader); - bx::close(reader); - return mesh; + if (bx::open(reader, _filePath) ) + { + Mesh* mesh = meshLoad(reader); + bx::close(reader); + return mesh; + } + + return NULL; } void meshUnload(Mesh* _mesh) diff --git a/3rdparty/bgfx/examples/common/entry/entry_ios.mm b/3rdparty/bgfx/examples/common/entry/entry_ios.mm index e12c224e623..052c161abd4 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_ios.mm +++ b/3rdparty/bgfx/examples/common/entry/entry_ios.mm @@ -185,7 +185,7 @@ static void* m_device = NULL; } } #endif - + return [CAEAGLLayer class]; } @@ -197,15 +197,15 @@ static void* m_device = NULL; { return nil; } - + bgfx::PlatformData pd; pd.ndt = NULL; pd.nwh = self.layer; - pd.context = m_device; + pd.context = m_device; pd.backBuffer = NULL; pd.backBufferDS = NULL; bgfx::setPlatformData(pd); - + return self; } @@ -309,7 +309,7 @@ static void* m_device = NULL; [m_window setRootViewController:viewController]; [m_window makeKeyAndVisible]; - + [m_window makeKeyAndVisible]; //float scaleFactor = [[UIScreen mainScreen] scale]; // should use this, but ui is too small on ipad retina diff --git a/3rdparty/bgfx/examples/common/entry/entry_p.h b/3rdparty/bgfx/examples/common/entry/entry_p.h index 880f44123e4..502eed673ad 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_p.h +++ b/3rdparty/bgfx/examples/common/entry/entry_p.h @@ -14,7 +14,7 @@ #include // memcpy #ifndef ENTRY_CONFIG_USE_SDL -# define ENTRY_CONFIG_USE_SDL 0 +# define ENTRY_CONFIG_USE_SDL BX_PLATFORM_STEAMLINK #endif // ENTRY_CONFIG_USE_SDL #ifndef ENTRY_CONFIG_USE_GLFW diff --git a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp index c5ab2c7d57a..2bff902302c 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp @@ -11,13 +11,24 @@ # define SDL_MAIN_HANDLED #endif // BX_PLATFORM_WINDOWS +#include + #include + +BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG() +BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wextern-c-compat") #include +BX_PRAGMA_DIAGNOSTIC_POP_CLANG() + #include +#if defined(None) // X11 defines this... +# undef None +#endif // defined(None) #include #include #include +#include #include #include @@ -74,6 +85,22 @@ namespace entry return GamepadAxis::Enum(s_translateGamepadAxis[_sdl]); } + struct AxisDpadRemap + { + Key::Enum first; + Key::Enum second; + }; + + static AxisDpadRemap s_axisDpad[] = + { + { Key::GamepadLeft, Key::GamepadRight }, + { Key::GamepadUp, Key::GamepadDown }, + { Key::None, Key::None }, + { Key::GamepadLeft, Key::GamepadRight }, + { Key::GamepadUp, Key::GamepadDown }, + { Key::None, Key::None }, + }; + struct GamepadSDL { GamepadSDL() @@ -91,17 +118,59 @@ namespace entry m_deadzone[GamepadAxis::RightZ] = 30; } - void create(int32_t _jid) + void create(const SDL_JoyDeviceEvent& _jev) { - m_controller = SDL_GameControllerOpen(_jid); + m_joystick = SDL_JoystickOpen(_jev.which); + SDL_Joystick* joystick = m_joystick; + m_jid = SDL_JoystickInstanceID(joystick); + } + + void create(const SDL_ControllerDeviceEvent& _cev) + { + m_controller = SDL_GameControllerOpen(_cev.which); SDL_Joystick* joystick = SDL_GameControllerGetJoystick(m_controller); m_jid = SDL_JoystickInstanceID(joystick); } + void update(EventQueue& _eventQueue, WindowHandle _handle, GamepadHandle _gamepad, GamepadAxis::Enum _axis, int32_t _value) + { + if (filter(_axis, &_value) ) + { + _eventQueue.postAxisEvent(_handle, _gamepad, _axis, _value); + + if (Key::None != s_axisDpad[_axis].first) + { + if (_value == 0) + { + _eventQueue.postKeyEvent(_handle, s_axisDpad[_axis].first, 0, false); + _eventQueue.postKeyEvent(_handle, s_axisDpad[_axis].second, 0, false); + } + else + { + _eventQueue.postKeyEvent(_handle + , 0 > _value ? s_axisDpad[_axis].first : s_axisDpad[_axis].second + , 0 + , true + ); + } + } + } + } + void destroy() { - SDL_GameControllerClose(m_controller); - m_controller = NULL; + if (NULL != m_controller) + { + SDL_GameControllerClose(m_controller); + m_controller = NULL; + } + + if (NULL != m_joystick) + { + SDL_JoystickClose(m_joystick); + m_joystick = NULL; + } + m_jid = INT32_MAX; } @@ -119,6 +188,7 @@ namespace entry int32_t m_value[GamepadAxis::Count]; int32_t m_deadzone[GamepadAxis::Count]; + SDL_Joystick* m_joystick; SDL_GameController* m_controller; // SDL_Haptic* m_haptic; SDL_JoystickID m_jid; @@ -326,7 +396,6 @@ namespace entry m_mte.m_argv = _argv; SDL_Init(0 - | SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER ); @@ -356,10 +425,18 @@ namespace entry WindowHandle defaultWindow = { 0 }; setWindowSize(defaultWindow, m_width, m_height, true); - SDL_RWops* rw = SDL_RWFromFile("gamecontrollerdb.txt", "rb"); - if (NULL != rw) + bx::CrtFileReader reader; + if (bx::open(&reader, "gamecontrollerdb.txt") ) { - SDL_GameControllerAddMappingsFromRW(rw, 1); + bx::AllocatorI* allocator = getAllocator(); + uint32_t size = (uint32_t)bx::getSize(&reader); + void* data = BX_ALLOC(allocator, size); + bx::read(&reader, data, size); + bx::close(&reader); + + SDL_GameControllerAddMapping( (char*)data); + + BX_FREE(allocator, data); } bool exit = false; @@ -477,6 +554,7 @@ namespace entry } } break; + case SDL_KEYUP: { const SDL_KeyboardEvent& kev = event.key; @@ -530,6 +608,18 @@ namespace entry } break; + case SDL_JOYAXISMOTION: + { + const SDL_JoyAxisEvent& jev = event.jaxis; + GamepadHandle handle = findGamepad(jev.which); + if (isValid(handle) ) + { + GamepadAxis::Enum axis = translateGamepadAxis(jev.axis); + m_gamepad[handle.idx].update(m_eventQueue, defaultWindow, handle, axis, jev.value); + } + } + break; + case SDL_CONTROLLERAXISMOTION: { const SDL_ControllerAxisEvent& aev = event.caxis; @@ -537,10 +627,23 @@ namespace entry if (isValid(handle) ) { GamepadAxis::Enum axis = translateGamepadAxis(aev.axis); - int32_t value = aev.value; - if (m_gamepad[handle.idx].filter(axis, &value) ) + m_gamepad[handle.idx].update(m_eventQueue, defaultWindow, handle, axis, aev.value); + } + } + break; + + case SDL_JOYBUTTONDOWN: + case SDL_JOYBUTTONUP: + { + const SDL_JoyButtonEvent& bev = event.jbutton; + GamepadHandle handle = findGamepad(bev.which); + + if (isValid(handle) ) + { + Key::Enum key = translateGamepad(bev.button); + if (Key::Count != key) { - m_eventQueue.postAxisEvent(defaultWindow, handle, axis, value); + m_eventQueue.postKeyEvent(defaultWindow, key, 0, event.type == SDL_JOYBUTTONDOWN); } } } @@ -562,14 +665,38 @@ namespace entry } break; - case SDL_CONTROLLERDEVICEADDED: + case SDL_JOYDEVICEADDED: { - const SDL_ControllerDeviceEvent& cev = event.cdevice; + GamepadHandle handle = { m_gamepadAlloc.alloc() }; + if (isValid(handle) ) + { + const SDL_JoyDeviceEvent& jev = event.jdevice; + m_gamepad[handle.idx].create(jev); + m_eventQueue.postGamepadEvent(defaultWindow, handle, true); + } + } + break; + + case SDL_JOYDEVICEREMOVED: + { + const SDL_JoyDeviceEvent& jev = event.jdevice; + GamepadHandle handle = findGamepad(jev.which); + if (isValid(handle) ) + { + m_gamepad[handle.idx].destroy(); + m_gamepadAlloc.free(handle.idx); + m_eventQueue.postGamepadEvent(defaultWindow, handle, false); + } + } + break; + case SDL_CONTROLLERDEVICEADDED: + { GamepadHandle handle = { m_gamepadAlloc.alloc() }; if (isValid(handle) ) { - m_gamepad[handle.idx].create(cev.which); + const SDL_ControllerDeviceEvent& cev = event.cdevice; + m_gamepad[handle.idx].create(cev); m_eventQueue.postGamepadEvent(defaultWindow, handle, true); } } diff --git a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp index 247bed44385..37f403ee480 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp @@ -358,7 +358,7 @@ namespace entry s_translateKey[VK_HOME] = Key::Home; s_translateKey[VK_END] = Key::End; s_translateKey[VK_PRIOR] = Key::PageUp; - s_translateKey[VK_NEXT] = Key::PageUp; + s_translateKey[VK_NEXT] = Key::PageDown; s_translateKey[VK_SNAPSHOT] = Key::Print; s_translateKey[VK_OEM_PLUS] = Key::Plus; s_translateKey[VK_OEM_MINUS] = Key::Minus; diff --git a/3rdparty/bgfx/examples/common/entry/entry_x11.cpp b/3rdparty/bgfx/examples/common/entry/entry_x11.cpp index a058479fabb..8ced748dcbe 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_x11.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_x11.cpp @@ -61,6 +61,23 @@ namespace entry GamepadAxis::RightZ, }; + struct AxisDpadRemap + { + Key::Enum first; + Key::Enum second; + }; + + static AxisDpadRemap s_axisDpad[] = + { + { Key::GamepadLeft, Key::GamepadRight }, + { Key::GamepadUp, Key::GamepadDown }, + { Key::None, Key::None }, + { Key::GamepadLeft, Key::GamepadRight }, + { Key::GamepadUp, Key::GamepadDown }, + { Key::None, Key::None }, + }; + BX_STATIC_ASSERT(BX_COUNTOF(s_translateAxis) == BX_COUNTOF(s_axisDpad) ); + struct Joystick { Joystick() @@ -135,6 +152,24 @@ namespace entry if (filter(axis, &value) ) { _eventQueue.postAxisEvent(defaultWindow, handle, axis, value); + + if (Key::None != s_axisDpad[axis].first) + { + if (m_value[axis] == 0) + { + _eventQueue.postKeyEvent(defaultWindow, s_axisDpad[axis].first, 0, false); + _eventQueue.postKeyEvent(defaultWindow, s_axisDpad[axis].second, 0, false); + } + else + { + _eventQueue.postKeyEvent(defaultWindow + , 0 > m_value[axis] ? s_axisDpad[axis].first : s_axisDpad[axis].second + , 0 + , true + ); + } + } + } } } diff --git a/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h index 69a3484dc65..4bf319a2ecf 100644 --- a/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h +++ b/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h @@ -36,37 +36,38 @@ static const uint8_t fs_font_basic_glsl[553] = 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_4;.}... }; -static const uint8_t fs_font_basic_dx9[462] = +static const uint8_t fs_font_basic_dx9[466] = { 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xb0, 0x01, 0x00, 0x03, 0xff, // Color0.......... - 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S.. + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xb4, 0x01, 0x00, 0x03, 0xff, // Color0.......... + 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S.. 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................ 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, // .L...0.......... 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .<.......s_texCo 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, // lor............. 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9 - 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q.. - 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........@...?... - 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, // ....?Q.......... - 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0xc0, 0x1f, 0x00, 0x00, // ...........@.... - 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................ - 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, // ................ - 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, 0x90, 0x00, 0x00, 0x00, // ................ - 0xa0, 0x00, 0x00, 0x55, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, // ...U............ - 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, 0x81, 0x00, 0x00, 0xaa, // .X.........U.... - 0xa0, 0x00, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, // ................ - 0x80, 0x00, 0x00, 0x55, 0x81, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ...U.X.......... - 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................ - 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // .......U........ - 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, // .........X...... - 0x80, 0x00, 0x00, 0xe4, 0x8c, 0x00, 0x00, 0xff, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x42, 0x00, 0x00, // .............B.. - 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, // ................ - 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, // ................ - 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, 0x90, 0x01, 0x00, 0x00, // ................ - 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // .............. + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. + 0xab, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, // .Q..........@... + 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, // ?.......?Q...... + 0xa0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, // ...............@ + 0xc0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................ + 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, // ................ + 0x90, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x55, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // .......U........ + 0x80, 0x00, 0x00, 0x00, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, // .....X.........U + 0x81, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, // ................ + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x81, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, // .......U.X...... + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, // ...........U.... + 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x58, 0x00, 0x00, // .............X.. + 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x8c, 0x00, 0x00, 0xff, 0xa0, 0x00, 0x00, 0xaa, // ................ + 0xa0, 0x42, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, // .B.............. + 0xa0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, // ................ + 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, // ................ + 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, // ................ + 0x00, 0x00, // .. }; static const uint8_t fs_font_basic_dx11[617] = { diff --git a/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h index 030ec333753..9bd34a78a05 100644 --- a/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h +++ b/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h @@ -65,56 +65,56 @@ static const uint8_t fs_font_distance_field_glsl[1019] = 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp 0x76, 0x61, 0x72, 0x5f, 0x39, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_9;.}... }; -static const uint8_t fs_font_distance_field_dx9[754] = +static const uint8_t fs_font_distance_field_dx9[758] = { 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd4, 0x02, 0x00, 0x03, 0xff, // Color0.......... - 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S.. + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd8, 0x02, 0x00, 0x03, 0xff, // Color0.......... + 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S.. 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................ 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, // .L...0.......... 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .<.......s_texCo 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, // lor............. 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9 - 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q.. - 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........@...?... - 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, // ....?Q.......... - 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0xc0, 0x51, 0x00, 0x00, // ...........@.Q.. - 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........A...?... - 0xc0, 0x00, 0x00, 0x40, 0x40, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, // ...@@........... - 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, // ................ - 0x80, 0x01, 0x00, 0xff, 0x90, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x55, 0xa0, 0x13, 0x00, 0x00, // ...........U.... - 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, // .........X...... - 0x80, 0x00, 0x00, 0x55, 0x81, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, // ...U............ - 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x81, 0x58, 0x00, 0x00, // ...........U.X.. - 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xaa, // ................ - 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, // ...............U - 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, // ................ - 0xa0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x8c, 0x00, 0x00, 0xff, // .X.............. - 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, // .....B.......... - 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xc6, // ................ - 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x80, 0x01, 0x00, 0x90, // ................ - 0x91, 0x5c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x08, 0x00, 0x00, // ................ - 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xf9, 0x80, 0x00, 0x00, 0xf9, 0x80, 0x07, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // .......U........ - 0x80, 0x00, 0x00, 0x55, 0x80, 0x5b, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, // ...U.[.......... - 0x90, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, // ................ - 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x06, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, // ................ - 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, // ...U............ - 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, // ...U.......U.... - 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x55, // .......U.......U - 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0xaa, 0x81, 0x00, 0x00, 0xe4, // ................ - 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x05, 0x00, 0x00, // ...........U.... - 0x03, 0x00, 0x00, 0x11, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, // .......U........ - 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0xff, // ................ - 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, // ................ - 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, // ...............U - 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, // ................ - 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, // ................ - 0x00, 0x00, // .. + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. + 0xab, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, // .Q..........@... + 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, // ?.......?Q...... + 0xa0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, // ...............@ + 0xc0, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, // .Q..........A... + 0x3f, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0x40, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, // ?......@@....... + 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, // ................ + 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, 0x90, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x55, // ...............U + 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x58, 0x00, 0x00, // .............X.. + 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, 0x81, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xff, // .......U........ + 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, // ...............U + 0x81, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xaa, // .X.............. + 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................ + 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, // ...U............ + 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, // .....X.......... + 0x8c, 0x00, 0x00, 0xff, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, // .........B...... + 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................ + 0x80, 0x01, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, // ................ + 0x80, 0x01, 0x00, 0x90, 0x91, 0x5c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x80, 0x00, 0x00, 0xe4, // ................ + 0x80, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xf9, 0x80, 0x00, 0x00, 0xf9, // ................ + 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x00, // ...........U.... + 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x5b, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, // .......U.[...... + 0x80, 0x01, 0x00, 0xe4, 0x90, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x01, 0x00, 0xe4, // ................ + 0x80, 0x01, 0x00, 0xe4, 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, // ................ + 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x04, 0x00, 0x00, // .......U........ + 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x55, // .......U.......U + 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, // ...........U.... + 0xa0, 0x02, 0x00, 0x55, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0xaa, // ...U............ + 0x81, 0x00, 0x00, 0xe4, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, // ...............U + 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x11, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0x00, // ...........U.... + 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xaa, // ................ + 0xa0, 0x02, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................ + 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................ + 0x80, 0x00, 0x00, 0x55, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, // ...U............ + 0x80, 0x00, 0x00, 0xff, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................ + 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...... }; static const uint8_t fs_font_distance_field_dx11[1053] = { diff --git a/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h index 46bdf5ab710..154481dc393 100644 --- a/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h +++ b/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h @@ -81,65 +81,65 @@ static const uint8_t fs_font_distance_field_subpixel_glsl[1268] = 0x20, 0x2a, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x77, 0x29, 0x3b, 0x0a, // * v_color0.w);. 0x7d, 0x0a, 0x0a, 0x00, // }... }; -static const uint8_t fs_font_distance_field_subpixel_dx9[902] = +static const uint8_t fs_font_distance_field_subpixel_dx9[906] = { 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x68, 0x03, 0x00, 0x03, 0xff, // Color0.....h.... - 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S.. + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x6c, 0x03, 0x00, 0x03, 0xff, // Color0.....l.... + 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S.. 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................ 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, // .L...0.......... 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .<.......s_texCo 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, // lor............. 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9 - 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q.. - 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........@...?... - 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, // ....?Q.......... - 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0xc0, 0x51, 0x00, 0x00, // ...........@.Q.. - 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, // ...........@@... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x03, 0x00, 0x0f, 0xa0, 0xc1, 0xaa, 0x2a, // .....Q.........* - 0x3e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, // >...A...?....... - 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................ - 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, // ................ - 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, 0x90, 0x00, 0x00, 0x00, // ................ - 0xa0, 0x00, 0x00, 0x55, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, // ...U............ - 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, 0x81, 0x00, 0x00, 0xaa, // .X.........U.... - 0xa0, 0x00, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, // ................ - 0x80, 0x00, 0x00, 0x55, 0x81, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ...U.X.......... - 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................ - 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // .......U........ - 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, // .........X...... - 0x80, 0x00, 0x00, 0xe4, 0x8c, 0x00, 0x00, 0xff, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x5b, 0x00, 0x00, // .............[.. - 0x02, 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, // ................ - 0x80, 0x01, 0x00, 0xe4, 0x80, 0x03, 0x00, 0x00, 0xa1, 0x01, 0x00, 0xe4, 0x90, 0x42, 0x00, 0x00, // .............B.. - 0x03, 0x02, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, // ................ - 0x03, 0x02, 0x00, 0x01, 0x80, 0x02, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, // ................ - 0x04, 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x03, 0x00, 0x00, 0xa0, 0x01, 0x00, 0xe4, // ................ - 0x90, 0x08, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, // ................ - 0x80, 0x07, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, // ................ - 0x02, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x42, 0x00, 0x00, 0x03, 0x03, 0x00, 0x0f, // .........B...... - 0x80, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, 0x03, 0x02, 0x00, 0x04, // ................ - 0x80, 0x03, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................ - 0x80, 0x02, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x02, // ................ - 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, // .......U........ - 0x80, 0x01, 0x00, 0xe4, 0x91, 0x5c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................ - 0x80, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, // ................ - 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................ - 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, // ................ - 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x55, 0xa1, 0x03, 0x00, 0xaa, 0xa0, 0x04, 0x00, 0x00, // .......U........ - 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x55, 0xa0, 0x03, 0x00, 0xaa, // ...........U.... - 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0x81, 0x00, 0x00, 0x00, // ...........U.... - 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0e, 0x80, 0x00, 0x00, 0x55, 0x81, 0x02, 0x00, 0x90, // ...........U.... - 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x02, 0x00, 0x55, 0x80, 0x00, 0x00, 0xff, // ...........U.... - 0x90, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, // ................ - 0x03, 0x00, 0x00, 0x17, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xf9, 0x80, 0x04, 0x00, 0x00, // ................ - 0x04, 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x55, // ...............U - 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, // ................ - 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, // ................ - 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xff, // ................ - 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...... + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. + 0xab, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, // .Q..........@... + 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, // ?.......?Q...... + 0xa0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, // ...............@ + 0xc0, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, // .Q.............@ + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x03, 0x00, 0x0f, // @........Q...... + 0xa0, 0xc1, 0xaa, 0x2a, 0x3e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ...*>...A...?... + 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, 0x90, 0x1f, 0x00, 0x00, // ................ + 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, // ................ + 0x90, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x55, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // .......U........ + 0x80, 0x00, 0x00, 0x00, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, // .....X.........U + 0x81, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, // ................ + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x81, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, // .......U.X...... + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, // ...........U.... + 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x58, 0x00, 0x00, // .............X.. + 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x8c, 0x00, 0x00, 0xff, 0xa0, 0x00, 0x00, 0xaa, // ................ + 0xa0, 0x5b, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x04, 0x00, 0x00, // .[.............. + 0x04, 0x02, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x03, 0x00, 0x00, 0xa1, 0x01, 0x00, 0xe4, // ................ + 0x90, 0x42, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, // .B.............. + 0xa0, 0x09, 0x00, 0x00, 0x03, 0x02, 0x00, 0x01, 0x80, 0x02, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, // ................ + 0x80, 0x04, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x03, 0x00, 0x00, // ................ + 0xa0, 0x01, 0x00, 0xe4, 0x90, 0x08, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0xe4, // ................ + 0x80, 0x01, 0x00, 0xe4, 0x80, 0x07, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, // ................ + 0x80, 0x06, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x42, 0x00, 0x00, // .............B.. + 0x03, 0x03, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, // ................ + 0x03, 0x02, 0x00, 0x04, 0x80, 0x03, 0x00, 0xc6, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x01, 0x80, 0x02, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, // ................ + 0x03, 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, // ...........U.... + 0x02, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x91, 0x5c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, // ................ + 0x80, 0x00, 0x00, 0xe4, 0x80, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0xe4, // ................ + 0x80, 0x00, 0x00, 0xe4, 0x80, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................ + 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x55, 0xa1, 0x03, 0x00, 0xaa, // ...........U.... + 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x55, // ...............U + 0xa0, 0x03, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, // ...............U + 0x81, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0e, 0x80, 0x00, 0x00, 0x55, // ...............U + 0x81, 0x02, 0x00, 0x90, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x02, 0x00, 0x55, // ...............U + 0x80, 0x00, 0x00, 0xff, 0x90, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................ + 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x17, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xf9, // ................ + 0x80, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, // ................ + 0xa0, 0x02, 0x00, 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, // ...U............ + 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................ + 0x80, 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................ + 0x80, 0x00, 0x00, 0xff, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // .......... }; static const uint8_t fs_font_distance_field_subpixel_dx11[1305] = { diff --git a/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h index 5df95fa7cce..884743b9973 100644 --- a/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h +++ b/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h @@ -28,11 +28,11 @@ static const uint8_t vs_font_basic_glsl[431] = 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // d0;. v_color0 = 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // a_color0;.}... }; -static const uint8_t vs_font_basic_dx9[335] = +static const uint8_t vs_font_basic_dx9[339] = { 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x2c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ,.......#.CTAB.. + 0x30, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // 0.......$.CTAB.. 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W............. 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0..... 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ @@ -40,17 +40,18 @@ static const uint8_t vs_font_basic_dx9[335] = 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft ( 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C - 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952 - 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111........... - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ - 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ - 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0xe0, 0x05, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, // ............U... - 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, // ................ - 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................ - 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, // ................ - 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100 + 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // 11.16384........ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................ + 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, // ................ + 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................ + 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, // U............... + 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................ + 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................ + 0x00, 0x00, 0x00, // ... }; static const uint8_t vs_font_basic_dx11[580] = { diff --git a/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h index 6fea18b931a..ebc7589c408 100644 --- a/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h +++ b/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h @@ -28,11 +28,11 @@ static const uint8_t vs_font_distance_field_glsl[431] = 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // d0;. v_color0 = 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // a_color0;.}... }; -static const uint8_t vs_font_distance_field_dx9[335] = +static const uint8_t vs_font_distance_field_dx9[339] = { 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x2c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ,.......#.CTAB.. + 0x30, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // 0.......$.CTAB.. 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W............. 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0..... 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ @@ -40,17 +40,18 @@ static const uint8_t vs_font_distance_field_dx9[335] = 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft ( 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C - 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952 - 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111........... - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ - 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ - 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0xe0, 0x05, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, // ............U... - 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, // ................ - 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................ - 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, // ................ - 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100 + 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // 11.16384........ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................ + 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, // ................ + 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................ + 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, // U............... + 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................ + 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................ + 0x00, 0x00, 0x00, // ... }; static const uint8_t vs_font_distance_field_dx11[580] = { diff --git a/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h index bd885e453e3..6b0d75236d6 100644 --- a/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h +++ b/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h @@ -28,11 +28,11 @@ static const uint8_t vs_font_distance_field_subpixel_glsl[431] = 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // d0;. v_color0 = 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // a_color0;.}... }; -static const uint8_t vs_font_distance_field_subpixel_dx9[335] = +static const uint8_t vs_font_distance_field_subpixel_dx9[339] = { 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x2c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ,.......#.CTAB.. + 0x30, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // 0.......$.CTAB.. 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W............. 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0..... 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ @@ -40,17 +40,18 @@ static const uint8_t vs_font_distance_field_subpixel_dx9[335] = 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft ( 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C - 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952 - 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111........... - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ - 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ - 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0xe0, 0x05, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, // ............U... - 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, // ................ - 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................ - 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, // ................ - 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100 + 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // 11.16384........ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................ + 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, // ................ + 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................ + 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, // U............... + 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................ + 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................ + 0x00, 0x00, 0x00, // ... }; static const uint8_t vs_font_distance_field_subpixel_dx11[580] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h index 611a46bc560..d64b2bdf7ca 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h @@ -7,17 +7,17 @@ static const uint8_t fs_imgui_color_glsl[89] = 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ragColor = v_col 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}... }; -static const uint8_t fs_imgui_color_dx9[137] = +static const uint8_t fs_imgui_color_dx9[141] = { - 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I..|..... - 0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... + 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I........ + 0xfe, 0xff, 0x17, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... 0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................ 0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh - 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9. - 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, // 29.952.3111..... - 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, // ................ - 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ......... + 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, // ader Compiler 10 + 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, // .0.10011.16384.. + 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, // ................ + 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............. }; static const uint8_t fs_imgui_color_dx11[260] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h index 265aef506c1..f274ada3d9c 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h @@ -24,12 +24,12 @@ static const uint8_t fs_imgui_cubemap_glsl[363] = 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_1;.}... }; -static const uint8_t fs_imgui_cubemap_dx9[390] = +static const uint8_t fs_imgui_cubemap_dx9[394] = { 0x46, 0x53, 0x48, 0x04, 0xe3, 0xc2, 0x5c, 0x65, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH....e...s_tex 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, // Color0......u_im 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, // ageLodEnabled... - 0x00, 0x01, 0x00, 0x50, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, // ...P.......0.CTA + 0x00, 0x01, 0x00, 0x54, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x31, 0x00, 0x43, 0x54, 0x41, // ...T.......1.CTA 0x42, 0x1c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, // B............... 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, // .............D.. 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........P...... @@ -40,17 +40,17 @@ static const uint8_t fs_imgui_cubemap_dx9[390] = 0x65, 0x64, 0x00, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // ed.............. 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9 - 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q.. - 0x05, 0x01, 0x00, 0x0f, 0xa0, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x00, 0x00, 0x00, // .......L?..L>... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, // ................ - 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x01, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, // ................ - 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, // ....._.......... - 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................ - 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, // ...........U.... - 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x55, // .......U.......U - 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ...... + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. + 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, // .Q.........L?..L + 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, // >............... + 0x80, 0x00, 0x00, 0x07, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, // ................ + 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, // ................ + 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ........._...... + 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, // ................ + 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, // ...............U + 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, // ...........U.... + 0xa0, 0x01, 0x00, 0x55, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ...U...... }; static const uint8_t fs_imgui_cubemap_dx11[441] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h index 8496e53c794..618848fa5a1 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h @@ -24,12 +24,12 @@ static const uint8_t fs_imgui_image_glsl[360] = 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // agColor = tmpvar 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _1;.}... }; -static const uint8_t fs_imgui_image_dx9[394] = +static const uint8_t fs_imgui_image_dx9[398] = { 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH.o.><...s_tex 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, // Color0......u_im 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, // ageLodEnabled... - 0x00, 0x01, 0x00, 0x54, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, // ...T.......0.CTA + 0x00, 0x01, 0x00, 0x58, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x31, 0x00, 0x43, 0x54, 0x41, // ...X.......1.CTA 0x42, 0x1c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, // B............... 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, // .............D.. 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........P...... @@ -40,17 +40,17 @@ static const uint8_t fs_imgui_image_dx9[394] = 0x65, 0x64, 0x00, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // ed.............. 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9 - 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q.. - 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, // ........?......L - 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, // ?..L>........... - 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, // ................ - 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ........._...... - 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, // ................ - 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0x80, 0x01, 0x00, 0xe4, // ................ - 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x00, 0x00, 0xaa, // ...........U.... - 0x80, 0x00, 0x00, 0xff, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // .......... + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. + 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, // .Q..........?... + 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ...L?..L>....... + 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, // ................ + 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, // ................ + 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, // ............._.. + 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, // ................ + 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, // ...............U + 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0xff, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // .............. }; static const uint8_t fs_imgui_image_dx11[445] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h index 237bdb1e10c..593de84d168 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h @@ -28,13 +28,13 @@ static const uint8_t fs_imgui_image_swizz_glsl[425] = 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_1;.}... }; -static const uint8_t fs_imgui_image_swizz_dx9[458] = +static const uint8_t fs_imgui_image_swizz_dx9[462] = { 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x03, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH.o.><...s_tex 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, // Color0......u_im 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, // ageLodEnabled... 0x00, 0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x12, 0x01, 0x01, // ....u_swizzle... - 0x00, 0x01, 0x00, 0x84, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x38, 0x00, 0x43, 0x54, 0x41, // ...........8.CTA + 0x00, 0x01, 0x00, 0x88, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x39, 0x00, 0x43, 0x54, 0x41, // ...........9.CTA 0x42, 0x1c, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x03, 0x00, 0x00, // B............... 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, // .............X.. 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........d...... @@ -47,18 +47,18 @@ static const uint8_t fs_imgui_image_swizz_dx9[458] = 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, // .........u_swizz 0x6c, 0x65, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // le.ps_3_0.Micros 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha - 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, // der Compiler 9.2 - 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0x51, 0x00, 0x00, // 9.952.3111...Q.. - 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, // ........?......L - 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, // ?..L>........... - 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, // ................ - 0x03, 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ........._...... - 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................ - 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, // ................ - 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, // ...............U - 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, // ................ - 0x80, 0x00, 0x00, 0x40, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ...@...... + 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10. + 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0xab, // 0.10011.16384... + 0xab, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, // .Q..........?... + 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ...L?..L>....... + 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, // ................ + 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, // ................ + 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, // ............._.. + 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x00, 0x00, 0x0c, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, // ................ + 0x80, 0x00, 0x00, 0x55, 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0x00, // ...U............ + 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0x40, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // .......@...... }; static const uint8_t fs_imgui_image_swizz_dx11[493] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h index 5a54b079fe2..14d7aef3e0b 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h @@ -42,12 +42,12 @@ static const uint8_t fs_imgui_latlong_glsl[651] = 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_4;.}... }; -static const uint8_t fs_imgui_latlong_dx9[554] = +static const uint8_t fs_imgui_latlong_dx9[558] = { 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH.o.><...s_tex 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, // Color0......u_im 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, // ageLodEnabled... - 0x00, 0x01, 0x00, 0xf4, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, // ...........0.CTA + 0x00, 0x01, 0x00, 0xf8, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x31, 0x00, 0x43, 0x54, 0x41, // ...........1.CTA 0x42, 0x1c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, // B............... 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, // .............D.. 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........P...... @@ -58,27 +58,27 @@ static const uint8_t fs_imgui_latlong_dx9[554] = 0x65, 0x64, 0x00, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // ed.............. 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9 - 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q.. - 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0xdb, 0x0f, 0xc9, 0x40, 0xdb, 0x0f, 0x49, // ........?...@..I - 0xc0, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0xcd, 0xcc, 0x4c, // .....Q.........L - 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, // ?..L>........... - 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ - 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, // ................ - 0xa0, 0x00, 0x00, 0x00, 0x90, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................ - 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x55, // ...............U - 0xa0, 0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, // .....%.......... - 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0x00, // ...........U.... - 0xa0, 0x01, 0x00, 0x00, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................ - 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x55, // ...............U - 0xa0, 0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, // .....%.......... - 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x05, 0x80, 0x01, 0x00, 0xc5, 0x80, 0x02, 0x00, 0x55, // ...............U - 0x81, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ........._...... - 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, // ................ - 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, // ...............U - 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, // ...........U.... - 0xa0, 0x02, 0x00, 0x55, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ...U...... + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. + 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0xdb, 0x0f, 0xc9, // .Q..........?... + 0x40, 0xdb, 0x0f, 0x49, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, // @..I.....Q...... + 0xa0, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...L?..L>....... + 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, // ................ + 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, // ................ + 0x80, 0x01, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, // ................ + 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................ + 0x80, 0x01, 0x00, 0x55, 0xa0, 0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, // ...U.....%...... + 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, // ...............U + 0x90, 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, // ................ + 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, // ................ + 0x80, 0x01, 0x00, 0x55, 0xa0, 0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, // ...U.....%...... + 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x05, 0x80, 0x01, 0x00, 0xc5, // ................ + 0x80, 0x02, 0x00, 0x55, 0x81, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x00, // ...U............ + 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, // ............._.. + 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // ................ + 0x80, 0x00, 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x55, // ...U...........U + 0x80, 0x02, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x55, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // .......U...... }; static const uint8_t fs_imgui_latlong_dx11[617] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h index 08d722db698..5fc0768dd13 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h @@ -20,25 +20,25 @@ static const uint8_t fs_imgui_texture_glsl[290] = 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, // r = tmpvar_1;.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_imgui_texture_dx9[258] = +static const uint8_t fs_imgui_texture_dx9[262] = { 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xe4, 0x00, 0x00, 0x03, 0xff, // Color0.......... - 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S.. + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xe8, 0x00, 0x00, 0x03, 0xff, // Color0.......... + 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S.. 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................ 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, // .L...0.......... 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .<.......s_texCo 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, // lor............. 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9 - 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, // .29.952.3111.... - 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................ - 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, // ................ - 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, // .B.............. - 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, // ................ - 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, // ................ - 0x00, 0x00, // .. + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. + 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................ + 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, // .....B.......... + 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, // ................ + 0x80, 0x00, 0x00, 0xff, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, // ................ + 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...... }; static const uint8_t fs_imgui_texture_dx11[421] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h index ed79a9399c5..bbfafdf88d5 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h @@ -16,10 +16,10 @@ static const uint8_t fs_ocornut_imgui_glsl[238] = 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x2a, 0x20, 0x76, // = (tmpvar_1 * v 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _color0);.}... }; -static const uint8_t fs_ocornut_imgui_dx9[237] = +static const uint8_t fs_ocornut_imgui_dx9[241] = { 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd4, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x21, 0x00, // 0.............!. + 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd8, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x22, 0x00, // 0.............". 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, // CTAB....O....... 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, // ............H... 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x38, 0x00, 0x00, 0x00, // 0...........8... @@ -27,12 +27,13 @@ static const uint8_t fs_ocornut_imgui_dx9[237] = 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, // ............ps_3 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, // _0.Microsoft (R) 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, // HLSL Shader Com - 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, // piler 9.29.952.3 - 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, // 111............. - 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................ - 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ........B....... - 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x0f, 0x80, // ................ - 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............. + 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, // piler 10.0.10011 + 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, // .16384.......... + 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, // ................ + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, // ............B... + 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, // ................ + 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, // ................ + 0x00, // . }; static const uint8_t fs_ocornut_imgui_dx11[396] = { diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h index 4867ea1a86c..1b8aa95fb28 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h @@ -22,27 +22,27 @@ static const uint8_t vs_imgui_color_glsl[324] = 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, // or0 = a_color0;. 0x7d, 0x0a, 0x0a, 0x00, // }... }; -static const uint8_t vs_imgui_color_dx9[290] = +static const uint8_t vs_imgui_color_dx9[294] = { 0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH....I...u_vie - 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x04, 0x01, 0x00, 0x03, 0xfe, // wProj........... - 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S.. + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x08, 0x01, 0x00, 0x03, 0xfe, // wProj........... + 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S.. 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................ 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .L...0.......... 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // .<.......u_viewP 0x72, 0x6f, 0x6a, 0x00, 0xab, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // roj............. 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....vs_3_0.Micr 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9 - 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, // .29.952.3111.... - 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ - 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, // ................ - 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x05, 0x00, 0x00, // ................ - 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, // ...........U.... - 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, // ................ - 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, // ................ - 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, // ................ - 0x00, 0x00, // .. + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. + 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................ + 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, // ................ + 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, // ...............U + 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, // ................ + 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, // ................ + 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...... }; static const uint8_t vs_imgui_color_dx11[465] = { diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h index 6467376b5a7..154c4e416e3 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h @@ -22,11 +22,11 @@ static const uint8_t vs_imgui_cubemap_glsl[329] = 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x2e, // rmal = a_normal. 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // xyz;.}... }; -static const uint8_t vs_imgui_cubemap_dx9[319] = +static const uint8_t vs_imgui_cubemap_dx9[323] = { 0x56, 0x53, 0x48, 0x04, 0xe3, 0xc2, 0x5c, 0x65, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH....e...u_mod 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x1c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........#.CTAB.. + 0x20, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // .......$.CTAB.. 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W............. 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0..... 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ @@ -34,16 +34,17 @@ static const uint8_t vs_imgui_cubemap_dx9[319] = 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft ( 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C - 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952 - 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111........... - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, // ................ - 0x00, 0x80, 0x01, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, // ................ - 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ....U........... - 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ - 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................ - 0x00, 0x02, 0x01, 0x00, 0x07, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100 + 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x03, 0x00, // 11.16384........ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U....... + 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................ + 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................ + 0x00, 0x00, 0x00, // ... }; static const uint8_t vs_imgui_cubemap_dx11[510] = { diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h index b34b38c4122..f3711052b08 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h @@ -22,27 +22,27 @@ static const uint8_t vs_imgui_image_glsl[336] = 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x61, // v_texcoord0 = a 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _texcoord0;.}... }; -static const uint8_t vs_imgui_image_dx9[290] = +static const uint8_t vs_imgui_image_dx9[294] = { 0x56, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH.o.><...u_vie - 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x04, 0x01, 0x00, 0x03, 0xfe, // wProj........... - 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S.. + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x08, 0x01, 0x00, 0x03, 0xfe, // wProj........... + 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S.. 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................ 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .L...0.......... 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // .<.......u_viewP 0x72, 0x6f, 0x6a, 0x00, 0xab, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // roj............. 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....vs_3_0.Micr 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9 - 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, // .29.952.3111.... - 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................ - 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, // ................ - 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, // ................ - 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, // ...........U.... - 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, // ................ - 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, // ................ - 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, // ................ - 0x00, 0x00, // .. + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. + 0xab, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................ + 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, // ................ + 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, // ...............U + 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, // ................ + 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, // ................ + 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, // ................ + 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...... }; static const uint8_t vs_imgui_image_dx11[473] = { diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h index 8b84198ba33..4cf8bb28af7 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h @@ -23,11 +23,11 @@ static const uint8_t vs_imgui_latlong_glsl[337] = 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // a_texcoord0;.}.. 0x00, // . }; -static const uint8_t vs_imgui_latlong_dx9[319] = +static const uint8_t vs_imgui_latlong_dx9[323] = { 0x56, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH.o.><...u_mod 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x1c, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........#.CTAB.. + 0x20, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // .......$.CTAB.. 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W............. 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0..... 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ @@ -35,16 +35,17 @@ static const uint8_t vs_imgui_latlong_dx9[319] = 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft ( 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C - 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952 - 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111........... - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ - 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, // ................ - 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ....U........... - 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ - 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................ - 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100 + 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // 11.16384........ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U....... + 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................ + 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................ + 0x00, 0x00, 0x00, // ... }; static const uint8_t vs_imgui_latlong_dx11[518] = { diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h index a5c839c5c08..34ab3e2da96 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h @@ -28,29 +28,29 @@ static const uint8_t vs_imgui_texture_glsl[419] = 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, // r0 = a_color0;.} 0x0a, 0x0a, 0x00, // ... }; -static const uint8_t vs_imgui_texture_dx9[326] = +static const uint8_t vs_imgui_texture_dx9[330] = { 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie - 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x28, 0x01, 0x00, 0x03, 0xfe, // wProj......(.... - 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S.. + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x2c, 0x01, 0x00, 0x03, 0xfe, // wProj......,.... + 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S.. 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................ 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .L...0.......... 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // .<.......u_viewP 0x72, 0x6f, 0x6a, 0x00, 0xab, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, // roj............. 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....vs_3_0.Micr 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9 - 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, // .29.952.3111.... - 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ - 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, // ................ - 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, // ................ - 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................ - 0x80, 0x02, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, // ................ - 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, // ...U............ - 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ................ - 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, // ................ - 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, 0xe0, 0x02, 0x00, 0xe4, // ................ - 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ...... + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. + 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................ + 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................ + 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, // ................ + 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, // ................ + 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ................ + 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, // .......U........ + 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, // ................ + 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // .......... }; static const uint8_t vs_imgui_texture_dx11[575] = { diff --git a/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h index ba968aaa2a6..81ed318597a 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h @@ -34,11 +34,11 @@ static const uint8_t vs_ocornut_imgui_glsl[523] = 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, // v_color0 = a_c 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // olor0;.}... }; -static const uint8_t vs_ocornut_imgui_dx9[367] = +static const uint8_t vs_ocornut_imgui_dx9[371] = { 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0b, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie - 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x50, 0x01, 0x00, 0x03, // wTexel......P... - 0xfe, 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, // ....".CTAB....S. + 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x54, 0x01, 0x00, 0x03, // wTexel......T... + 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, // ....#.CTAB....S. 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, // ................ 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, // ..L...0......... 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..<.......u_view @@ -46,19 +46,20 @@ static const uint8_t vs_ocornut_imgui_dx9[367] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // ......vs_3_0.Mic 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler - 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, // 9.29.952.3111.Q. - 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, // .........@...... - 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .?.............. - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ - 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ - 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x03, 0xe0, 0x05, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xe4, 0x90, 0x04, 0x00, // ................ - 0x00, 0x04, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, // ................ - 0x55, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0xe0, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, // U...........U... - 0x00, 0xa1, 0x01, 0x00, 0xaa, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0xe0, 0x01, 0x00, // ................ - 0xb4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, // ................ - 0x00, 0x02, 0x02, 0x00, 0x03, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... + 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, // 10.0.10011.16384 + 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // ..Q..........@.. + 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // .....?.......... + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................ + 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, // ................ + 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................ + 0xe4, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0x00, 0xa0, 0x01, 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0xe0, 0x00, 0x00, // ....U........... + 0x55, 0x80, 0x01, 0x00, 0x00, 0xa1, 0x01, 0x00, 0xaa, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // U............... + 0x0c, 0xe0, 0x01, 0x00, 0xb4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................ + 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................ + 0x00, 0x00, 0x00, // ... }; static const uint8_t vs_ocornut_imgui_dx11[612] = { diff --git a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h index f2de36d49ad..c7ed6294e86 100644 --- a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h +++ b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h @@ -195,7 +195,7 @@ static const uint8_t fs_nanovg_fill_glsl[3095] = 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, // gColor = result_ 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 1;.}... }; -static const uint8_t fs_nanovg_fill_dx9[1543] = +static const uint8_t fs_nanovg_fill_dx9[1547] = { 0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x08, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, // 0......u_extentR @@ -206,8 +206,8 @@ static const uint8_t fs_nanovg_fill_dx9[1543] = 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, // _params.......u_ 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x12, // scissorExtScale. 0x01, 0x08, 0x00, 0x01, 0x00, 0x0c, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, // ......u_scissorM - 0x61, 0x74, 0x13, 0x01, 0x00, 0x00, 0x03, 0x00, 0x6c, 0x05, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, // at......l....... - 0x63, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x01, 0x00, 0x00, 0x00, 0x03, // c.CTAB....W..... + 0x61, 0x74, 0x13, 0x01, 0x00, 0x00, 0x03, 0x00, 0x70, 0x05, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, // at......p....... + 0x64, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x01, 0x00, 0x00, 0x00, 0x03, // d.CTAB....W..... 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x01, // ..............P. 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xc4, 0x00, // ................ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x09, 0x00, 0x01, 0x00, // ................ @@ -231,69 +231,69 @@ static const uint8_t fs_nanovg_fill_dx9[1543] = 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // orMat.ps_3_0.Mic 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler - 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, // 9.29.952.3111.Q. - 0x00, 0x05, 0x0b, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .........?...@.. - 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x0c, 0x00, 0x0f, 0xa0, 0x00, 0x00, // .....?Q......... - 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, // .....?..@@...... - 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ - 0x01, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, // ................ - 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x90, 0x0b, 0x00, // ................ - 0x55, 0xa0, 0x0b, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // U............... - 0x00, 0x8c, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // ................ - 0x00, 0x80, 0x0a, 0x00, 0x55, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, // ....U........... - 0x00, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, // ................ - 0x55, 0x90, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // U............... - 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x04, 0x00, // ................ - 0xd0, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x80, 0x03, 0x00, // ....U........... - 0xd0, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ - 0x06, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0xd0, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x01, 0x00, // ................ - 0x01, 0x80, 0x09, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x09, 0x00, // ................ - 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x80, 0x00, 0x00, 0xe9, 0x80, 0x01, 0x00, // U............... - 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0c, 0x80, 0x01, 0x00, 0x44, 0xa0, 0x00, 0x00, // ............D... - 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0c, 0x80, 0x00, 0x00, 0x44, 0xa0, 0x00, 0x00, // U...........D... - 0x00, 0x90, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0c, 0x80, 0x01, 0x00, // ................ - 0xe4, 0x80, 0x02, 0x00, 0x44, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0c, 0x80, 0x01, 0x00, // ....D........... - 0xe4, 0x8b, 0x08, 0x00, 0x44, 0xa1, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x07, 0x80, 0x0b, 0x00, // ....D........... - 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x1c, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x08, 0x00, // ................ - 0xe4, 0xa1, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x80, 0x01, 0x00, // ................ - 0xff, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // ................ - 0xff, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x04, 0x80, 0x02, 0x00, // ................ - 0xaa, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x23, 0x00, 0x00, 0x02, 0x02, 0x00, 0x0c, 0x80, 0x0a, 0x00, // ......#......... - 0xb4, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x08, // ..B............. - 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0f, 0x80, 0x03, 0x00, 0x00, 0x80, 0x0c, 0x00, // ................ - 0x40, 0xa0, 0x0c, 0x00, 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x03, 0x00, 0x0f, 0x80, 0x02, 0x00, // @.....X......... - 0xff, 0x81, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, // ................ - 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xff, 0x80, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, // ..........)..... - 0xff, 0xa0, 0x02, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x04, 0x00, 0x0f, 0x80, 0x0b, 0x00, // ....U........... - 0xff, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, 0x04, 0x80, 0x0c, 0x00, // ..*............. - 0xaa, 0xa0, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x05, 0x00, 0xaa, 0x80, 0x42, 0x00, // ..)...........B. - 0x00, 0x03, 0x05, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x04, 0x00, // ................ - 0x00, 0x04, 0x06, 0x00, 0x0f, 0x80, 0x05, 0x00, 0x00, 0x80, 0x0c, 0x00, 0x40, 0xa0, 0x0c, 0x00, // ............@... - 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x05, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xff, 0x81, 0x05, 0x00, // ..X............. - 0xe4, 0x80, 0x06, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x05, 0x00, 0x08, 0x80, 0x00, 0x00, // ................ - 0xff, 0x80, 0x05, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0x03, 0x04, 0x00, 0x0f, 0x80, 0x05, 0x00, // ................ - 0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x04, 0x00, // ......*......... - 0x0f, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x2b, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x58, 0x00, // ......+...+...X. - 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xaa, 0x8c, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................ - 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x09, 0x00, 0xaa, 0xa1, 0x09, 0x00, // ................ - 0x60, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xe4, 0x8b, 0x02, 0x00, // `............... - 0xf4, 0x81, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x00, 0x00, 0xa4, 0x80, 0x0c, 0x00, // ................ - 0x00, 0xa0, 0x5a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x80, 0x02, 0x00, 0xed, 0x80, 0x02, 0x00, // ..Z............. - 0xed, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................ - 0xff, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x0b, 0x00, // ................ - 0x00, 0x03, 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x0a, 0x00, // ........U....... - 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x55, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x02, 0x00, // ........U....... - 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, // ............U... - 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x09, 0x00, 0xaa, 0xa1, 0x04, 0x00, // ........U....... - 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x80, 0x00, 0x00, // ................ - 0x55, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x05, 0x00, // U............... - 0x00, 0x03, 0x00, 0x00, 0x12, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, // ............U... - 0x00, 0x02, 0x03, 0x00, 0x0f, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x03, 0x00, // ................ - 0x0f, 0x80, 0x03, 0x00, 0xe4, 0x81, 0x07, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x03, 0x00, // ................ - 0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x05, 0x00, // ....U........... - 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xff, 0x80, 0x58, 0x00, // ..............X. - 0x00, 0x04, 0x00, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xaa, 0x81, 0x03, 0x00, 0xe4, 0x80, 0x01, 0x00, // ................ - 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ....... + 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, // 10.0.10011.16384 + 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, // ..Q..........?.. + 0x00, 0x40, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x0c, 0x00, // .@.......?Q..... + 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, // .........?..@@.. + 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, // ................ + 0x00, 0x90, 0x0b, 0x00, 0x55, 0xa0, 0x0b, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ....U........... + 0x01, 0x80, 0x00, 0x00, 0x00, 0x8c, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x55, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x01, 0x00, // ........U....... + 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x01, 0x80, 0x01, 0x00, 0x55, 0x90, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ....U........... + 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x06, 0x80, 0x04, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U....... + 0x06, 0x80, 0x03, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0xd0, 0xa0, 0x06, 0x00, // ................ + 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x09, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x01, 0x00, // ................ + 0x02, 0x80, 0x09, 0x00, 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x80, 0x00, 0x00, // ....U........... + 0xe9, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0c, 0x80, 0x01, 0x00, // ................ + 0x44, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0c, 0x80, 0x00, 0x00, // D...U........... + 0x44, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // D............... + 0x0c, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x44, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // ........D....... + 0x0c, 0x80, 0x01, 0x00, 0xe4, 0x8b, 0x08, 0x00, 0x44, 0xa1, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, // ........D....... + 0x07, 0x80, 0x0b, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x1c, 0x80, 0x01, 0x00, // ................ + 0xe4, 0x80, 0x08, 0x00, 0xe4, 0xa1, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x08, 0x80, 0x01, 0x00, 0xff, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // ................ + 0x04, 0x80, 0x02, 0x00, 0xaa, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x23, 0x00, 0x00, 0x02, 0x02, 0x00, // ..........#..... + 0x0c, 0x80, 0x0a, 0x00, 0xb4, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x01, 0x00, // ......B......... + 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0f, 0x80, 0x03, 0x00, // ................ + 0x00, 0x80, 0x0c, 0x00, 0x40, 0xa0, 0x0c, 0x00, 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x03, 0x00, // ....@.....X..... + 0x0f, 0x80, 0x02, 0x00, 0xff, 0x81, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, // ................ + 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xff, 0x80, 0x29, 0x00, // ..............). + 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x04, 0x00, // ........U....... + 0x0f, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, // ......*......... + 0x04, 0x80, 0x0c, 0x00, 0xaa, 0xa0, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x05, 0x00, // ......)......... + 0xaa, 0x80, 0x42, 0x00, 0x00, 0x03, 0x05, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, // ..B............. + 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x06, 0x00, 0x0f, 0x80, 0x05, 0x00, 0x00, 0x80, 0x0c, 0x00, // ................ + 0x40, 0xa0, 0x0c, 0x00, 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x05, 0x00, 0x0f, 0x80, 0x02, 0x00, // @.....X......... + 0xff, 0x81, 0x05, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x05, 0x00, // ................ + 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x05, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0x03, 0x04, 0x00, // ................ + 0x0f, 0x80, 0x05, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, // ..........*..... + 0x00, 0x02, 0x04, 0x00, 0x0f, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x2b, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..........+...+. + 0x00, 0x00, 0x58, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xaa, 0x8c, 0x03, 0x00, // ..X............. + 0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x09, 0x00, // ................ + 0xaa, 0xa1, 0x09, 0x00, 0x60, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, // ....`........... + 0xe4, 0x8b, 0x02, 0x00, 0xf4, 0x81, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x00, 0x00, // ................ + 0xa4, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x5a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x80, 0x02, 0x00, // ......Z......... + 0xed, 0x80, 0x02, 0x00, 0xed, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................ + 0xff, 0x80, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, // ............U... + 0xaa, 0x80, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x55, 0x80, 0x0c, 0x00, // ............U... + 0x00, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, // ................ + 0x55, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x09, 0x00, // U...........U... + 0xaa, 0xa1, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x02, 0x00, // ................ + 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x0a, 0x00, // ....U........... + 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x12, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, // ................ + 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, 0x0f, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x02, 0x00, // U............... + 0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0x81, 0x07, 0x00, 0xe4, 0xa0, 0x04, 0x00, // ................ + 0x00, 0x04, 0x03, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x06, 0x00, // ........U....... + 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, // ................ + 0xff, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xaa, 0x81, 0x03, 0x00, // ..X............. + 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ........... }; static const uint8_t fs_nanovg_fill_dx11[2298] = { diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp index 3fd944178d0..fc276ff32fd 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp @@ -128,6 +128,7 @@ namespace uint64_t state; bgfx::TextureHandle th; + bgfx::TextureHandle texMissing; bgfx::TransientVertexBuffer tvb; uint8_t viewid; @@ -263,6 +264,11 @@ namespace , true ); + const bgfx::Memory* mem = bgfx::alloc(4*4*4); + uint32_t* bgra8 = (uint32_t*)mem->data; + memset(bgra8, 0, 4*4*4); + gl->texMissing = bgfx::createTexture2D(4, 4, 0, bgfx::TextureFormat::BGRA8, 0, mem); + gl->u_scissorMat = bgfx::createUniform("u_scissorMat", bgfx::UniformType::Mat3); gl->u_paintMat = bgfx::createUniform("u_paintMat", bgfx::UniformType::Mat3); gl->u_innerCol = bgfx::createUniform("u_innerCol", bgfx::UniformType::Vec4); @@ -323,9 +329,20 @@ namespace , 1 , NVG_TEXTURE_RGBA == _type ? bgfx::TextureFormat::RGBA8 : bgfx::TextureFormat::R8 , BGFX_TEXTURE_NONE - , mem ); + if (NULL != mem) + { + bgfx::updateTexture2D(tex->id + , 0 + , 0 + , 0 + , tex->width + , tex->height + , mem + ); + } + return bgfx::isValid(tex->id) ? tex->id.idx : 0; } @@ -347,7 +364,12 @@ namespace uint32_t bytesPerPixel = NVG_TEXTURE_RGBA == tex->type ? 4 : 1; uint32_t pitch = tex->width * bytesPerPixel; - bgfx::updateTexture2D(tex->id, 0, x, y, w, h + bgfx::updateTexture2D(tex->id + , 0 + , x + , y + , w + , h , bgfx::copy(data + y*pitch + x*bytesPerPixel, h*pitch) , pitch ); @@ -444,8 +466,7 @@ namespace memcpy(frag->extent, paint->extent, sizeof(frag->extent) ); frag->strokeMult = (width*0.5f + fringe*0.5f) / fringe; - bgfx::TextureHandle invalid = BGFX_INVALID_HANDLE; - gl->th = invalid; + gl->th = gl->texMissing; if (paint->image != 0) { tex = glnvg__findTexture(gl, paint->image); @@ -460,7 +481,7 @@ namespace else { frag->type = NSVG_SHADER_FILLGRAD; - frag->radius = paint->radius; + frag->radius = paint->radius; frag->feather = paint->feather; } @@ -502,7 +523,7 @@ namespace bgfx::setUniform(gl->u_extentRadius, &frag->extent[0]); bgfx::setUniform(gl->u_params, &frag->feather); - bgfx::TextureHandle handle = BGFX_INVALID_HANDLE; + bgfx::TextureHandle handle = gl->texMissing; if (image != 0) { @@ -976,6 +997,7 @@ namespace } bgfx::destroyProgram(gl->prog); + bgfx::destroyTexture(gl->texMissing); bgfx::destroyUniform(gl->u_scissorMat); bgfx::destroyUniform(gl->u_paintMat); diff --git a/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h b/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h index aeac0d14115..e744417898c 100644 --- a/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h +++ b/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h @@ -35,12 +35,12 @@ static const uint8_t vs_nanovg_fill_glsl[541] = 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, // gl_Position = t 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mpvar_1;.}... }; -static const uint8_t vs_nanovg_fill_dx9[432] = +static const uint8_t vs_nanovg_fill_dx9[436] = { 0x56, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x02, 0x00, 0x0b, 0x75, 0x5f, 0x68, 0x61, 0x6c, // VSH........u_hal 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x01, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, // fTexel.......u_v - 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x80, 0x01, 0x00, // iewSize......... - 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x2a, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x72, // .....*.CTAB....r + 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x84, 0x01, 0x00, // iewSize......... + 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x72, // .....+.CTAB....r 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, // ................ 0x91, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, // ...k...D........ 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, // ...P.......`.... @@ -50,20 +50,21 @@ static const uint8_t vs_nanovg_fill_dx9[432] = 0x77, 0x53, 0x69, 0x7a, 0x65, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // wSize.vs_3_0.Mic 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler - 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0x51, // 9.29.952.3111..Q - 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x00, // ..............?. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, // ................ - 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, // ................ - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, // ................ - 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x02, // ................ - 0x00, 0x03, 0xe0, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0xa0, 0x01, // ................ - 0x00, 0xe4, 0x90, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x02, // ................ - 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xd0, 0x90, 0x00, 0x00, 0xd0, 0x90, 0x04, // ................ - 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, // .........U...... - 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x04, // .............U.. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0xe0, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0x00, 0x81, 0x02, // ................ - 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0xe0, 0x02, 0x00, 0x64, 0xa0, 0x01, // .U...........d.. - 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ................ + 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, // 10.0.10011.16384 + 0x00, 0xab, 0xab, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0xbf, 0x00, // ...Q............ + 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, // ..?............. + 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, // ................ + 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, // ................ + 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, // ................ + 0x00, 0x01, 0x80, 0x02, 0x00, 0x03, 0xe0, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x03, 0xe0, 0x01, // ................ + 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xe4, 0x90, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, // ................ + 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xd0, 0x90, 0x00, // ................ + 0x00, 0xd0, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x55, 0x80, 0x00, // .............U.. + 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, // ................ + 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0xe0, 0x00, 0x00, 0xaa, 0x80, 0x00, // .U.............. + 0x00, 0x00, 0x81, 0x02, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0xe0, 0x02, // .....U.......... + 0x00, 0x64, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, // .d.............. + 0xff, 0x00, 0x00, 0x00, // .... }; static const uint8_t vs_nanovg_fill_dx11[577] = { diff --git a/3rdparty/bgfx/examples/common/shaderlib.sh b/3rdparty/bgfx/examples/common/shaderlib.sh index da7bad784cb..a6a51199a1f 100644 --- a/3rdparty/bgfx/examples/common/shaderlib.sh +++ b/3rdparty/bgfx/examples/common/shaderlib.sh @@ -60,11 +60,11 @@ vec3 decodeNormalSphereMap(vec2 _encodedNormal) return vec3(normalize(_encodedNormal.xy) * sqrt(1.0 - zz*zz), zz); } -// Reference: -// Octahedron normal vector encoding -// http://kriscg.blogspot.com/2014/04/octahedron-normal-vector-encoding.html vec2 octahedronWrap(vec2 _val) { + // Reference: + // Octahedron normal vector encoding + // http://kriscg.blogspot.com/2014/04/octahedron-normal-vector-encoding.html return (1.0 - abs(_val.yx) ) * mix(vec2_splat(-1.0), vec2_splat(1.0), vec2(greaterThanEqual(_val.xy, vec2_splat(0.0) ) ) ); } @@ -87,11 +87,11 @@ vec3 decodeNormalOctahedron(vec2 _encodedNormal) return normalize(normal); } -// Reference: -// RGB/XYZ Matrices -// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html vec3 convertRGB2XYZ(vec3 _rgb) { + // Reference: + // RGB/XYZ Matrices + // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html vec3 xyz; xyz.x = dot(vec3(0.4124564, 0.3575761, 0.1804375), _rgb); xyz.y = dot(vec3(0.2126729, 0.7151522, 0.0721750), _rgb); @@ -246,6 +246,24 @@ vec4 toFilmic(vec4 _rgba) return vec4(toFilmic(_rgba.xyz), _rgba.w); } +vec3 toAcesFilmic(vec3 _rgb) +{ + // Reference: + // ACES Filmic Tone Mapping Curve + // https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ + float aa = 2.51f; + float bb = 0.03f; + float cc = 2.43f; + float dd = 0.59f; + float ee = 0.14f; + return saturate( (_rgb*(aa*_rgb + bb) )/(_rgb*(cc*_rgb + dd) + ee) ); +} + +vec4 toAcesFilmic(vec4 _rgba) +{ + return vec4(toAcesFilmic(_rgba.xyz), _rgba.w); +} + vec3 luma(vec3 _rgb) { float yy = dot(vec3(0.2126729, 0.7151522, 0.0721750), _rgb); diff --git a/3rdparty/bgfx/examples/runtime/gamecontrollerdb.txt b/3rdparty/bgfx/examples/runtime/gamecontrollerdb.txt index 9ad8778a00b..7c23f500c73 100644 --- a/3rdparty/bgfx/examples/runtime/gamecontrollerdb.txt +++ b/3rdparty/bgfx/examples/runtime/gamecontrollerdb.txt @@ -8,7 +8,6 @@ ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4, 4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows, 25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows, 4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows, -xinput,X360 Controller,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b0,guide:b14,leftshoulder:b8,leftstick:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:a5,rightx:a2,righty:a3,start:b4,x:b12,y:b13,platform:Windows, 6d0418c2000000000000504944564944,Logitech RumblePad 2 USB,platform:Windows,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3, 36280100000000000000504944564944,OUYA Controller,platform:Windows,a:b0,b:b3,y:b2,x:b1,start:b14,guide:b15,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b8,dpleft:b10,dpdown:b9,dpright:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b12,righttrigger:b13, 4f0400b3000000000000504944564944,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Windows, @@ -16,6 +15,18 @@ xinput,X360 Controller,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b 00f0f100000000000000504944564944,RetroUSB.com Super RetroPort,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Windows, 28040140000000000000504944564944,GamePad Pro USB,platform:Windows,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,lefttrigger:b6,righttrigger:b7, ff113133000000000000504944564944,SVEN X-PAD,platform:Windows,a:b2,b:b3,y:b1,x:b0,start:b5,back:b4,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b8,righttrigger:b9, +8f0e0300000000000000504944564944,Piranha xtreme,platform:Windows,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2, +8f0e0d31000000000000504944564944,Multilaser JS071 USB,platform:Windows,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7, +10080300000000000000504944564944,PS2 USB,platform:Windows,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a4,righty:a2,lefttrigger:b4,righttrigger:b5, +79000600000000000000504944564944,G-Shark GS-GP702,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,platform:Windows, +4b12014d000000000000504944564944,NYKO AIRFLO,a:b0,b:b1,x:b2,y:b3,back:b8,guide:b10,start:b9,leftstick:a0,rightstick:a2,leftshoulder:a3,rightshoulder:b5,dpup:h0.1,dpdown:h0.0,dpleft:h0.8,dpright:h0.2,leftx:h0.6,lefty:h0.12,rightx:h0.9,righty:h0.4,lefttrigger:b6,righttrigger:b7,platform:Windows, +d6206dca000000000000504944564944,PowerA Pro Ex,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.0,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows, +a3060cff000000000000504944564944,Saitek P2500,a:b2,b:b3,y:b1,x:b0,start:b4,guide:b10,back:b5,leftstick:b8,rightstick:b9,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,platform:Windows, +8f0e0300000000000000504944564944,Trust GTX 28,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows, +4f0415b3000000000000504944564944,Thrustmaster Dual Analog 3.2,platform:Windows,x:b1,a:b0,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3, +6f0e1e01000000000000504944564944,Rock Candy Gamepad for PS3,platform:Windows,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,guide:b12,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2, +83056020000000000000504944564944,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,y:b2,x:b3,start:b7,back:b6,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Windows, +10080100000000000000504944564944,PS1 USB,platform:Windows,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2, # OS X 0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X, @@ -28,6 +39,13 @@ ff113133000000000000504944564944,SVEN X-PAD,platform:Windows,a:b2,b:b3,y:b1,x:b0 5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X, 891600000000000000fd000000000000,Razer Onza Tournament,a:b0,b:b1,y:b3,x:b2,start:b8,guide:b10,back:b9,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b11,dpleft:b13,dpdown:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Mac OS X, 4f0400000000000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Mac OS X, +8f0e0000000000000300000000000000,Piranha xtreme,platform:Mac OS X,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2, +0d0f0000000000004d00000000000000,HORI Gem Pad 3,platform:Mac OS X,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7, +79000000000000000600000000000000,G-Shark GP-702,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b6,righttrigger:b7,platform:Mac OS X, +4f0400000000000015b3000000000000,Thrustmaster Dual Analog 3.2,platform:Mac OS X,x:b1,a:b0,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3, +AD1B00000000000001F9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X, +050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,y:b9,x:b10,start:b6,guide:b8,back:b7,dpup:b2,dpleft:b0,dpdown:b3,dpright:b1,leftx:a0,lefty:a1,lefttrigger:b12,righttrigger:,leftshoulder:b11,platform:Mac OS X, +83050000000000006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Mac OS X, # Linux 0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux, @@ -39,6 +57,7 @@ ff113133000000000000504944564944,SVEN X-PAD,platform:Windows,a:b2,b:b3,y:b1,x:b0 030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, 030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux, 030000004c050000c405000011010000,Sony DualShock 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,platform:Linux, +030000006f0e00003001000001010000,EA Sports PS3 Controller,platform:Linux,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7, 03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, 030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, 030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, @@ -73,3 +92,17 @@ ff113133000000000000504944564944,SVEN X-PAD,platform:Windows,a:b2,b:b3,y:b1,x:b0 03000000666600000488000000010000,Super Joy Box 5 Pro,platform:Linux,a:b2,b:b1,x:b3,y:b0,back:b9,start:b8,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,dpup:b12,dpleft:b15,dpdown:b14,dpright:b13, 05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,platform:Linux,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2, 05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,platform:Linux,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2, +030000008916000001fd000024010000,Razer Onza Classic Edition,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:b11,dpdown:b14,dpright:b12,dpup:b13,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4, +030000005e040000d102000001010000,Microsoft X-Box One pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4, +03000000790000001100000010010000,RetroLink Saturn Classic Controller,platform:Linux,x:b3,a:b0,b:b1,y:b4,back:b5,guide:b2,start:b8,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1, +050000007e0500003003000001000000,Nintendo Wii U Pro Controller,platform:Linux,a:b0,b:b1,x:b3,y:b2,back:b8,start:b9,guide:b10,leftshoulder:b4,rightshoulder:b5,leftstick:b11,rightstick:b12,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:b13,dpleft:b15,dpdown:b14,dpright:b16, +030000005e0400008e02000004010000,Microsoft X-Box 360 pad,platform:Linux,a:b0,b:b1,x:b2,y:b3,back:b6,start:b7,guide:b8,leftshoulder:b4,rightshoulder:b5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2, +030000000d0f00002200000011010000,HORI CO.,LTD. REAL ARCADE Pro.V3,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1, +030000000d0f00001000000011010000,HORI CO.,LTD. FIGHTING STICK 3,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7 +03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3, +0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),platform:Linux,a:b0,b:b1,x:b2,y:b3,start:b7,back:b6,guide:b8,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,lefttrigger:a5,righttrigger:a4,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a2,righty:a3, +03000000ff1100003133000010010000,PC Game Controller,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Linux, +030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4, +030000006f0e00001304000000010000,Generic X-Box pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:a0,rightstick:a3,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4, +03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4, +03000000830500006020000010010000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Linux, diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_particle.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_particle.bin index 0b6b5ca926c..e9ac1a71c49 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_particle.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_particle.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin index 91bf18c2ea8..e599c4ec016 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin index c928ae4e8f1..c2ac4161f46 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin index c97ca5675b0..acb5c01247e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin index 720d6b8dc55..3430e96d811 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin index 9f95aece5c2..6c4859be087 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin index f925d7d809b..95467349adc 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin index d4834651b14..d1612f8ca11 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin index c4eacfeab5f..f6b2ac6587d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin index 0d561a3cc8c..52ac4285db6 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin index 28db96648ca..221a4278dd8 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin index 871b1ffeeeb..03b37762125 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin index 245584b6255..11f1c23b014 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin index 77396aed05d..19d9bba4d4a 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin index 1ee9d986f8e..9581dddcd64 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin index b45bb02343e..8746b286f44 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin index 74dbfb1da69..9957e3b8588 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin index a46422934f3..3c72697a9d3 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin index 7f9f9ea632d..834b235eebe 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin index 546505bb112..0ae83c419f1 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin index 5b77da87cc3..87536cda4d4 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin index faad3b63666..5129fdb6b0b 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin index 4cdde93ea09..08a5970da44 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin index 99228d720c5..39d3bff0226 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin index 25fddf2151b..0991b66851f 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh.bin index 44fd0cfd999..bd64ce32deb 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin index 071e3a6f3a4..5f675f24a27 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin index ba7432d9619..0f69b9b3764 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bump.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bump.bin index a074cd8a3e2..2cc6dbea34d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bump.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bump.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_callback.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_callback.bin index 57876856254..9dadf5e9261 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_callback.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_callback.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_cubes.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_cubes.bin index bdffeb9c076..5bfd5497f0b 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_cubes.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_cubes.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_combine.bin index cc13a509ba8..fc355b76371 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_combine.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_combine.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug.bin index 4cac33773e7..33a85bb2955 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug_line.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug_line.bin index bdffeb9c076..5bfd5497f0b 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug_line.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_debug_line.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_geom.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_geom.bin index c8cbf705ea2..f9f1020c1e6 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_geom.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_geom.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_light.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_light.bin index 5c16613bad5..78cbbc32f25 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_light.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_deferred_light.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_blur.bin index f426518b036..4d331a3cab1 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_blur.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_blur.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_bright.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_bright.bin index 38c67736508..1670d6734f8 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_bright.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_bright.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lum.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lum.bin index f2be253e8b7..e5ca082614c 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lum.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lum.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lumavg.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lumavg.bin index 0fe106a0adb..b73df0e1d7f 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lumavg.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_lumavg.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_mesh.bin index 7c2c50723bd..7553b3acc94 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_mesh.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_mesh.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_skybox.bin index 0598ce6cc4f..d02ad5de9e4 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_skybox.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_skybox.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_tonemap.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_tonemap.bin index f9c5bdf5f56..993845cb75b 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_tonemap.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_hdr_tonemap.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin index 873b11cf560..3a3ecaba313 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin index a68ed6cf51d..2e49131b0a3 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_instancing.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_instancing.bin index bdffeb9c076..5bfd5497f0b 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_instancing.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_instancing.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_mesh.bin index 09e8453a1d6..ac5cc0d0512 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_mesh.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_mesh.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit.bin index 38475da682f..05269c3a821 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb.bin index b041df0bda7..29c0b1608bd 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_blit.bin index 6e7587839de..b209ea65d9d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_blit.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_blit.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate.bin index 332cd07bc4a..4c5d7f1b374 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.bin index 082338cd294..ff4c6e01b17 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_particle.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_particle.bin index c52033f7e3b..c20337adffc 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_particle.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_particle.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_raymarching.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_raymarching.bin index d3cd94464fb..64a2ea353d2 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_raymarching.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_raymarching.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.bin index 1759b12105b..b48ca9a9d75 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin index d0c8760806a..99f5564ce4d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin index 20951048b0c..420080db2fd 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin index af417ecab7a..2b80ccad6c3 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin index 4e7732f4fca..3bbfea99ae7 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin index cf1fc2e04a7..c9d81f6fa64 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin index 292a4b08b79..308f93ef2e3 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin index 77938acdc89..3de4dcbce87 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin index 975f1e5efed..c53e8814a34 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin index 72026a33e4c..d29c6e8c1ed 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin index 5617f4386b0..ca069354ca4 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin index 5cea5e1128a..c316724a908 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin index d033bd26429..bef6549d95b 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin index 4ed6a979733..55bce42f02a 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin index 0a87a3d68dc..7427157c5fa 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin index c5c2fe28bd4..a8c173e3c39 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin index 695b9378a8d..984458101ee 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin index c226b1e4713..e96824aae10 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin index cdc2cf41abb..bf00e8523f3 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin index d969966ce64..ac96c99da43 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin index 9ef4d3962f9..0e69a3950ac 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin index 87e13f45af2..a1ce662b545 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin index aeaa4e73b9e..80befb85a01 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin index 8866fbbb2d6..f0bdfd66f7b 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin index bb19f6244d2..856c659ffe6 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.bin index 3b34c1191f9..769c938165e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.bin index e9210b80d52..35f6b45a29d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.bin index 8eeb1b3e105..4a9dd81714e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.bin index 4a693345ca4..605ede3bb29 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.bin index 1c98ebebaa9..e73a81647e3 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.bin index f146f09bfc0..227ada1b7b9 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.bin index 89745b960ce..a83254c5e89 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_texture.bin index 4cac33773e7..33a85bb2955 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.bin index b4f15210552..6fa413cd90c 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin index f2b3c657c04..23cba5789f1 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.bin index e9210b80d52..35f6b45a29d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.bin index 8eeb1b3e105..4a9dd81714e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.bin index d2b3c50f5ec..3502c300df9 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.bin index 3b34c1191f9..769c938165e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.bin index f35fe6e1dfd..7528dcbf854 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.bin index 57089f27fe2..e240cc56e5f 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin index 49110e0ed14..19ca642da9a 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin index 7752be6658d..e4fa04e2975 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.bin index b201b42a274..a3163370c84 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.bin index 57089f27fe2..e240cc56e5f 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin index 49110e0ed14..19ca642da9a 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin index 7752be6658d..e4fa04e2975 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin index 4ba5d987404..29eab256097 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.bin index 95a432fd6e7..3b5a8f31a62 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.bin index 6e349468748..40f240d9f77 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin index a299cf2199c..fe9b49ff047 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture.bin index 4cac33773e7..33a85bb2955 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.bin index 216041c92be..1c09e0732be 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh.bin index 4ea4fa1d0b6..5e7db6345db 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin index 764e661c6e9..e244ed7a481 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow.bin index 1759b12105b..b48ca9a9d75 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow_pd.bin index 5c8c5a455f5..25b96b2653f 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow_pd.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_sms_shadow_pd.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_black.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_black.bin index 1759b12105b..b48ca9a9d75 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_black.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_black.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_lighting.bin index 812a7288250..c11e9833063 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_lighting.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_lighting.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_texture.bin index 3b34c1191f9..769c938165e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_color_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture.bin index 4cac33773e7..33a85bb2955 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.bin index 00b56862be3..c2d78611cd0 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_tree.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_tree.bin index a40cefb711a..f2e470f0574 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_tree.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_tree.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update.bin index 9b583ab3ef4..c67c50a41d1 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_3d.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_3d.bin index abc86d23a09..d489147527a 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_3d.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_3d.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_cmp.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_cmp.bin index 97e41b8eee1..77ee54087de 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_cmp.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_update_cmp.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blit.bin index 8793fcf84de..2ca54ab6730 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blit.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blit.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blur.bin index 905e8dd5d7a..f6316a80f0e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blur.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_blur.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_fb.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_fb.bin index 8b22edabe2b..c3e8cd2f156 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_fb.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_vectordisplay_fb.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump.bin index ae10af6fa40..4c80f4cad6d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump_instanced.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump_instanced.bin index 19f743864cb..fc28518a841 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump_instanced.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_bump_instanced.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_callback.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_callback.bin index 5b24007c6dc..91c7a717fe5 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_callback.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_callback.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_cubes.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_cubes.bin index 6bed4a49eb9..fcfb16e0d0d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_cubes.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_cubes.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_combine.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_combine.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_combine.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug_line.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug_line.bin index 6bed4a49eb9..fcfb16e0d0d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug_line.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_debug_line.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_geom.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_geom.bin index ae10af6fa40..4c80f4cad6d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_geom.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_geom.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_light.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_light.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_light.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_deferred_light.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_blur.bin index aafc58d61d7..db3143a6259 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_blur.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_blur.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_bright.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_bright.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_bright.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_bright.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lum.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lum.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lum.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lum.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lumavg.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lumavg.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lumavg.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_lumavg.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_mesh.bin index f8a154140aa..7bafd238112 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_mesh.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_mesh.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_skybox.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_skybox.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_skybox.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_tonemap.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_tonemap.bin index c1734e3e3fc..56f1ecb2e44 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_tonemap.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_hdr_tonemap.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin index a4e8c3d11e9..4218e8ab377 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin index 92fb53dd59b..c0e84000a3a 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_instancing.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_instancing.bin index 9cc463534d9..1334941f88a 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_instancing.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_instancing.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_mesh.bin index 62f5bd31dae..242f27e7b1f 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_mesh.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_mesh.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit.bin index 0bd10c7a53f..9f612d35860 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit_blit.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit_blit.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_oit_blit.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_particle.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_particle.bin index fa1d3b9a442..d727140eef3 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_particle.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_particle.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_raymarching.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_raymarching.bin index 63ec02a3531..9db127f1b78 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_raymarching.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_raymarching.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color.bin index 4550c08d137..63a27d6a014 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.bin index 93a692801b5..afd241b6c2e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.bin index 6b819879e75..5b190835b30 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.bin index 3bc8a261ee5..4953a46cb26 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.bin index 9e7c86f7bb1..3fe61829886 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.bin index 2c6c09c36c8..fb516014651 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.bin index 7a0105a308d..37de03aa63e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_depth.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_depth.bin index 4550c08d137..63a27d6a014 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_depth.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_depth.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.bin index 17606423b6c..056267dd34d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.bin index 3e5827745c0..46332ef6918 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.bin index 329980ae388..0d28593e06a 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.bin index a04a6320173..96799c4e15d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.bin index 347b4ed021b..c2695fe4a16 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.bin index f948ab9105f..305be162e1d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svback.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svback.bin index ff9efe36483..5875aa635d7 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svback.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svback.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.bin index 4550c08d137..63a27d6a014 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svside.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svside.bin index 7571a1e53fa..2b3dd0ebae0 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svside.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_svside.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.bin index e632b911c39..c97d58d5a67 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_mesh.bin index f5b0d896104..d33c32f16d0 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_mesh.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_mesh.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow.bin index 4550c08d137..63a27d6a014 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow_pd.bin index 3bd185477f5..94b26f0a41d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow_pd.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_sms_shadow_pd.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color.bin index 4550c08d137..63a27d6a014 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_lighting.bin index bedf096177e..0c0fe9fffee 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_lighting.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_lighting.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_texture.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_color_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture.bin index a299604962c..fe8592c138d 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.bin index 7257af2e87f..fcdfc2e180c 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_tree.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_tree.bin index 9e69b0bb4a4..71f4167608c 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_tree.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_tree.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_update.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_update.bin index 1c043f0ad5c..155eea03f6c 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_update.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_update.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_vectordisplay_fb.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_vectordisplay_fb.bin index 63ec02a3531..9db127f1b78 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_vectordisplay_fb.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_vectordisplay_fb.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin index e594526cf19..df53debb5b1 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin index 51ae8f2dbaf..2ae88a47fff 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin index 72ed5111aee..700694d399e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin index 7c77f0cbbfe..525a27cdd51 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin index 789141dcccc..04c38666671 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin index 3c1d07e15f6..27d8231f863 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin index 1503d413ab3..4ca43066c34 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin index f79e214b2da..4b3fea74139 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin index c6f6593ea1e..7c5095f0e29 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin index 74c0c1cf2a9..b77c2c824c4 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin index c0e05951bdd..3988caee216 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin index 19062f01b8c..9a8ae99224e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin index 6187725d9f2..1965c493afa 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin index 133e398538c..31b8e22ba35 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin index 422bf35ec8e..c867113fd8c 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin index 9f78cbeee15..c78a27741db 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin index 5ee79f73a28..85cebb56f07 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin index 4bb6fa06e51..93c5b80ef33 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin index d0be094575a..4769169ac7f 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin index 44a131f69ad..18a43e1ea27 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin index ccababe2e1b..f42d12496d6 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin index 74ff8b8dd26..50e5c4f14cb 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin index 754e424ea12..3e96ec50a4c 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin index 53f2ea31f22..df85bd9510c 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin index 0b0a1bbbf16..2d63ad15e45 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin index ad331bd4ffd..772ec28f6ed 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin index c50ce9cc452..d8509532b15 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin index d6bdeb0b6c9..3997cd62a98 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin index c1c6b516290..a366ac46963 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin index db9d665275d..0fd472eda28 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin index c50ce9cc452..d8509532b15 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin index 227b76c4fa2..5844d74493e 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin index d6bdeb0b6c9..384de3f5387 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin and b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin index 32f69e5aed2..1bfc2361d5c 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin index d77b34792fa..f8ae5bc9b81 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin index 4f66a07bb0f..f5a580f1289 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin index 7249ac3fc01..1e7a4d25acd 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin index 57a0637840f..3c41f4ed3f7 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin index daa9d7bc412..b930d047c81 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin index 5213127e2b3..5b5e123eaec 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin index 0728fd38ac9..9e5441e5839 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin index 40a6fe35f34..62a4fab7411 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin index 27694944113..7ae79a1339c 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin index 68de56248ff..52a0b821316 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin index e9d07c376e4..08808de87a7 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin index eceb44fdf0f..3218ab5f3cc 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin index d7893ba4369..0f8e094c7e9 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin index 3638832c180..797ec0bcdbe 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin index 957f309bc5e..c649bf07a24 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin index 03143cba754..5f0c1c7c365 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin index 202b3b76236..5b07162b001 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin index 492e6e805b1..34d5c091ce2 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin index 81ea89086ae..53f13abd5c8 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin index 46a9e14444f..3ba96599cd4 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin index 5af575e1be6..d1d4d641bdb 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin index 17290531064..5b675445db3 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin index 79058cad0d7..cbcecf1feb4 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin index 5915c930f4e..a2aeda4ead7 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin index 93b5a2a0bb2..fd9d3902609 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin index f8fa7a5d8b6..f1180dceb51 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin index 6148b430945..960eba1e085 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin index d59593b94a3..a592392cdd6 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin index 6602f5e43e0..acda8d5f64f 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin index f8fa7a5d8b6..f1180dceb51 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin index 8e0fb26cd2b..a036a3a6254 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin index 6148b430945..7286ee6bf99 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin index ccec78ba002..4d4b4469ace 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin and b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin differ diff --git a/3rdparty/bgfx/include/bgfx/bgfxdefines.h b/3rdparty/bgfx/include/bgfx/bgfxdefines.h index d0e4db91bce..3c1b3671a6b 100644 --- a/3rdparty/bgfx/include/bgfx/bgfxdefines.h +++ b/3rdparty/bgfx/include/bgfx/bgfxdefines.h @@ -6,7 +6,7 @@ #ifndef BGFX_DEFINES_H_HEADER_GUARD #define BGFX_DEFINES_H_HEADER_GUARD -#define BGFX_API_VERSION UINT32_C(2) +#define BGFX_API_VERSION UINT32_C(7) /// #define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write. @@ -300,7 +300,7 @@ #define BGFX_TEXTURE_RT_MSAA_X16 UINT32_C(0x00005000) //!< #define BGFX_TEXTURE_RT_MSAA_SHIFT 12 //!< #define BGFX_TEXTURE_RT_MSAA_MASK UINT32_C(0x00007000) //!< -#define BGFX_TEXTURE_RT_BUFFER_ONLY UINT32_C(0x00008000) //!< +#define BGFX_TEXTURE_RT_WRITE_ONLY UINT32_C(0x00008000) //!< #define BGFX_TEXTURE_RT_MASK UINT32_C(0x0000f000) //!< #define BGFX_TEXTURE_COMPARE_LESS UINT32_C(0x00010000) //!< #define BGFX_TEXTURE_COMPARE_LEQUAL UINT32_C(0x00020000) //!< diff --git a/3rdparty/bgfx/include/bgfx/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/bgfxplatform.h index b9107a26e39..1b6e336b675 100644 --- a/3rdparty/bgfx/include/bgfx/bgfxplatform.h +++ b/3rdparty/bgfx/include/bgfx/bgfxplatform.h @@ -11,6 +11,7 @@ // necessary to use this header in conjunction with creating windows. #include +#include namespace bgfx { @@ -45,10 +46,10 @@ namespace bgfx /// struct PlatformData { - void* ndt; //!< Native display type - void* nwh; //!< Native window handle - void* context; //!< GL context, or D3D device - void* backBuffer; //!< GL backbuffer, or D3D render target view + void* ndt; //!< Native display type. + void* nwh; //!< Native window handle. + void* context; //!< GL context, or D3D device. + void* backBuffer; //!< GL backbuffer, or D3D render target view. void* backBufferDS; //!< Backbuffer depth/stencil. }; @@ -58,7 +59,73 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_set_platform_data`. /// - void setPlatformData(const PlatformData& _hooks); + void setPlatformData(const PlatformData& _data); + + /// Internal data. + /// + /// @attention C99 equivalent is `bgfx_internal_data_t`. + /// + struct InternalData + { + const struct Caps* caps; //!< Renderer capabilities. + void* context; //!< GL context, or D3D device. + }; + + /// Get internal data for interop. + /// + /// @attention It's expected you understand some bgfx internals before you + /// use this call. + /// + /// @warning Must be called only on render thread. + /// + /// @attention C99 equivalent is `bgfx_get_internal_data`. + /// + const InternalData* getInternalData(); + + /// Override internal texture with externally created texture. Previously + /// created internal texture will released. + /// + /// @attention It's expected you understand some bgfx internals before you + /// use this call. + /// + /// @param[in] _handle Texture handle. + /// @param[in] _ptr Native API pointer to texture. + /// + /// @returns Native API pointer to texture. If result is 0, texture is not created yet from the + /// main thread. + /// + /// @warning Must be called only on render thread. + /// + /// @attention C99 equivalent is `bgfx_override_internal_texture_ptr`. + /// + uintptr_t overrideInternal(TextureHandle _handle, uintptr_t _ptr); + + /// Override internal texture by creating new texture. Previously created + /// internal texture will released. + /// + /// @attention It's expected you understand some bgfx internals before you + /// use this call. + /// + /// @param[in] _handle Texture handle. + /// @param[in] _width Width. + /// @param[in] _height Height. + /// @param[in] _numMips Number of mip-maps. + /// @param[in] _format Texture format. See: `TextureFormat::Enum`. + /// @param[in] _flags Default texture sampling mode is linear, and wrap mode + /// is repeat. + /// - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + /// mode. + /// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + /// sampling. + /// + /// @returns Native API pointer to texture. If result is 0, texture is not created yet from the + /// main thread. + /// + /// @warning Must be called only on render thread. + /// + /// @attention C99 equivalent is `bgfx_override_internal_texture`. + /// + uintptr_t overrideInternal(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags = BGFX_TEXTURE_NONE); } // namespace bgfx diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfx.h b/3rdparty/bgfx/include/bgfx/c99/bgfx.h index a3b31ee9ed3..fa585759ce9 100644 --- a/3rdparty/bgfx/include/bgfx/c99/bgfx.h +++ b/3rdparty/bgfx/include/bgfx/c99/bgfx.h @@ -40,7 +40,6 @@ #endif // defined(__cplusplus) #include -#include typedef enum bgfx_renderer_type { @@ -429,140 +428,6 @@ typedef struct bgfx_allocator_vtbl } bgfx_allocator_vtbl_t; -/**/ -typedef struct bgfx_interface_vtbl -{ - bgfx_render_frame_t (*render_frame)(); - void (*set_platform_data)(bgfx_platform_data_t* _pd); - void (*vertex_decl_begin)(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer); - void (*vertex_decl_add)(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); - void (*vertex_decl_skip)(bgfx_vertex_decl_t* _decl, uint8_t _num); - void (*vertex_decl_end)(bgfx_vertex_decl_t* _decl); - void (*vertex_pack)(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, void* _data, uint32_t _index); - void (*vertex_unpack)(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, const void* _data, uint32_t _index); - void (*vertex_convert)(const bgfx_vertex_decl_t* _destDecl, void* _destData, const bgfx_vertex_decl_t* _srcDecl, const void* _srcData, uint32_t _num); - uint16_t (*weld_vertices)(uint16_t* _output, const bgfx_vertex_decl_t* _decl, const void* _data, uint16_t _num, float _epsilon); - void (*image_swizzle_bgra8)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst); - void (*image_rgba8_downsample_2x2)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst); - uint8_t (*get_supported_renderers)(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT]); - const char* (*get_renderer_name)(bgfx_renderer_type_t _type); - bool (*init)(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_allocator_interface_t* _allocator); - void (*shutdown)(); - void (*reset)(uint32_t _width, uint32_t _height, uint32_t _flags); - uint32_t (*frame)(); - bgfx_renderer_type_t (*get_renderer_type)(); - const bgfx_caps_t* (*get_caps)(); - const bgfx_hmd_t* (*get_hmd)(); - const bgfx_stats_t* (*get_stats)(); - const bgfx_memory_t* (*alloc)(uint32_t _size); - const bgfx_memory_t* (*copy)(const void* _data, uint32_t _size); - const bgfx_memory_t* (*make_ref)(const void* _data, uint32_t _size); - const bgfx_memory_t* (*make_ref_release)(const void* _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void* _userData); - void (*set_debug)(uint32_t _debug); - void (*dbg_text_clear)(uint8_t _attr, bool _small); - void (*dbg_text_printf)(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...); - void (*dbg_text_image)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch); - bgfx_index_buffer_handle_t (*create_index_buffer)(const bgfx_memory_t* _mem, uint16_t _flags); - void (*destroy_index_buffer)(bgfx_index_buffer_handle_t _handle); - bgfx_vertex_buffer_handle_t (*create_vertex_buffer)(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags); - void (*destroy_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle); - bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer)(uint32_t _num, uint16_t _flags); - bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer_mem)(const bgfx_memory_t* _mem, uint16_t _flags); - void (*update_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t* _mem); - void (*destroy_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle); - bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint16_t _flags); - bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer_mem)(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags); - void (*update_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem); - void (*destroy_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle); - bool (*check_avail_transient_index_buffer)(uint32_t _num); - bool (*check_avail_transient_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t* _decl); - bool (*check_avail_instance_data_buffer)(uint32_t _num, uint16_t _stride); - bool (*check_avail_transient_buffers)(uint32_t _numVertices, const bgfx_vertex_decl_t* _decl, uint32_t _numIndices); - void (*alloc_transient_index_buffer)(bgfx_transient_index_buffer_t* _tib, uint32_t _num); - void (*alloc_transient_vertex_buffer)(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t* _decl); - bool (*alloc_transient_buffers)(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices); - const bgfx_instance_data_buffer_t* (*alloc_instance_data_buffer)(uint32_t _num, uint16_t _stride); - bgfx_indirect_buffer_handle_t (*create_indirect_buffer)(uint32_t _num); - void (*destroy_indirect_buffer)(bgfx_indirect_buffer_handle_t _handle); - bgfx_shader_handle_t (*create_shader)(const bgfx_memory_t* _mem); - uint16_t (*get_shader_uniforms)(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, uint16_t _max); - void (*destroy_shader)(bgfx_shader_handle_t _handle); - bgfx_program_handle_t (*create_program)(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders); - bgfx_program_handle_t (*create_compute_program)(bgfx_shader_handle_t _csh, bool _destroyShaders); - void (*destroy_program)(bgfx_program_handle_t _handle); - void (*calc_texture_size)(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format); - bgfx_texture_handle_t (*create_texture)(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info); - bgfx_texture_handle_t (*create_texture_2d)(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); - bgfx_texture_handle_t (*create_texture_2d_scaled)(bgfx_backbuffer_ratio_t _ratio, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags); - bgfx_texture_handle_t (*create_texture_3d)(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); - bgfx_texture_handle_t (*create_texture_cube)(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); - void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); - void (*update_texture_3d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem); - void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); - void (*destroy_texture)(bgfx_texture_handle_t _handle); - bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags); - bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags); - bgfx_frame_buffer_handle_t (*create_frame_buffer_from_handles)(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures); - bgfx_frame_buffer_handle_t (*create_frame_buffer_from_nwh)(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat); - void (*destroy_frame_buffer)(bgfx_frame_buffer_handle_t _handle); - bgfx_uniform_handle_t (*create_uniform)(const char* _name, bgfx_uniform_type_t _type, uint16_t _num); - void (*destroy_uniform)(bgfx_uniform_handle_t _handle); - bgfx_occlusion_query_handle_t (*create_occlusion_query)(); - bgfx_occlusion_query_result_t (*get_result)(bgfx_occlusion_query_handle_t _handle); - void (*destroy_occlusion_query)(bgfx_occlusion_query_handle_t _handle); - void (*set_palette_color)(uint8_t _index, const float _rgba[4]); - void (*set_view_name)(uint8_t _id, const char* _name); - void (*set_view_rect)(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); - void (*set_view_scissor)(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); - void (*set_view_clear)(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil); - void (*set_view_clear_mrt)(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7); - void (*set_view_seq)(uint8_t _id, bool _enabled); - void (*set_view_frame_buffer)(uint8_t _id, bgfx_frame_buffer_handle_t _handle); - void (*set_view_transform)(uint8_t _id, const void* _view, const void* _proj); - void (*set_view_transform_stereo)(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR); - void (*set_view_remap)(uint8_t _id, uint8_t _num, const void* _remap); - void (*set_marker)(const char* _marker); - void (*set_state)(uint64_t _state, uint32_t _rgba); - void (*set_condition)(bgfx_occlusion_query_handle_t _handle, bool _visible); - void (*set_stencil)(uint32_t _fstencil, uint32_t _bstencil); - uint16_t (*set_scissor)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); - void (*set_scissor_cached)(uint16_t _cache); - uint32_t (*set_transform)(const void* _mtx, uint16_t _num); - uint32_t (*alloc_transform)(bgfx_transform_t* _transform, uint16_t _num); - void (*set_transform_cached)(uint32_t _cache, uint16_t _num); - void (*set_uniform)(bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num); - void (*set_index_buffer)(bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); - void (*set_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); - void (*set_transient_index_buffer)(const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices); - void (*set_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); - void (*set_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _numVertices); - void (*set_transient_vertex_buffer)(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices); - void (*set_instance_data_buffer)(const bgfx_instance_data_buffer_t* _idb, uint32_t _num); - void (*set_instance_data_from_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); - void (*set_instance_data_from_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); - void (*set_texture)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags); - void (*set_texture_from_frame_buffer)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, uint32_t _flags); - uint32_t (*touch)(uint8_t _id); - uint32_t (*submit)(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth); - uint32_t (*submit_occlusion_query)(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth); - uint32_t (*submit_indirect)(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth); - void (*set_image)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); - void (*set_image_from_frame_buffer)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_access_t _access, bgfx_texture_format_t _format); - void (*set_compute_index_buffer)(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); - void (*set_compute_vertex_buffer)(uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); - void (*set_compute_dynamic_index_buffer)(uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); - void (*set_compute_dynamic_vertex_buffer)(uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); - void (*set_compute_indirect_buffer)(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); - uint32_t (*dispatch)(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags); - uint32_t (*dispatch_indirect)(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); - void (*discard)(); - void (*blit)(uint8_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); - void (*save_screen_shot)(const char* _filePath); - -} bgfx_interface_vtbl_t; - -typedef bgfx_interface_vtbl_t* (*PFN_BGFX_GET_INTERFACE)(uint32_t _version); - /**/ BGFX_C_API void bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer); diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h index ff2125f18c4..1fb82c974f8 100644 --- a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h +++ b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h @@ -13,6 +13,7 @@ // necessary to use this header in conjunction with creating windows. #include +#include typedef enum bgfx_render_frame { @@ -41,6 +42,160 @@ typedef struct bgfx_platform_data } bgfx_platform_data_t; -BGFX_C_API void bgfx_set_platform_data(bgfx_platform_data_t* _pd); +/**/ +BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t* _data); + +typedef struct bgfx_internal_data +{ + const struct bgfx_caps* caps; + void* context; + +} bgfx_internal_data_t; + +/**/ +BGFX_C_API const bgfx_internal_data_t* bgfx_get_internal_data(); + +/**/ +BGFX_C_API uintptr_t bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, uintptr_t _ptr); + +/**/ +BGFX_C_API uintptr_t bgfx_override_internal_texture(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags); + +/**/ +typedef struct bgfx_interface_vtbl +{ + bgfx_render_frame_t (*render_frame)(); + void (*set_platform_data)(const bgfx_platform_data_t* _data); + const bgfx_internal_data_t* (*get_internal_data)(); + uintptr_t (*override_internal_texture_ptr)(bgfx_texture_handle_t _handle, uintptr_t _ptr); + uintptr_t (*override_internal_texture)(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags); + void (*vertex_decl_begin)(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer); + void (*vertex_decl_add)(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); + void (*vertex_decl_skip)(bgfx_vertex_decl_t* _decl, uint8_t _num); + void (*vertex_decl_end)(bgfx_vertex_decl_t* _decl); + void (*vertex_pack)(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, void* _data, uint32_t _index); + void (*vertex_unpack)(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, const void* _data, uint32_t _index); + void (*vertex_convert)(const bgfx_vertex_decl_t* _destDecl, void* _destData, const bgfx_vertex_decl_t* _srcDecl, const void* _srcData, uint32_t _num); + uint16_t (*weld_vertices)(uint16_t* _output, const bgfx_vertex_decl_t* _decl, const void* _data, uint16_t _num, float _epsilon); + void (*image_swizzle_bgra8)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst); + void (*image_rgba8_downsample_2x2)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst); + uint8_t (*get_supported_renderers)(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT]); + const char* (*get_renderer_name)(bgfx_renderer_type_t _type); + bool (*init)(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_allocator_interface_t* _allocator); + void (*shutdown)(); + void (*reset)(uint32_t _width, uint32_t _height, uint32_t _flags); + uint32_t (*frame)(); + bgfx_renderer_type_t (*get_renderer_type)(); + const bgfx_caps_t* (*get_caps)(); + const bgfx_hmd_t* (*get_hmd)(); + const bgfx_stats_t* (*get_stats)(); + const bgfx_memory_t* (*alloc)(uint32_t _size); + const bgfx_memory_t* (*copy)(const void* _data, uint32_t _size); + const bgfx_memory_t* (*make_ref)(const void* _data, uint32_t _size); + const bgfx_memory_t* (*make_ref_release)(const void* _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void* _userData); + void (*set_debug)(uint32_t _debug); + void (*dbg_text_clear)(uint8_t _attr, bool _small); + void (*dbg_text_printf)(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...); + void (*dbg_text_image)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch); + bgfx_index_buffer_handle_t (*create_index_buffer)(const bgfx_memory_t* _mem, uint16_t _flags); + void (*destroy_index_buffer)(bgfx_index_buffer_handle_t _handle); + bgfx_vertex_buffer_handle_t (*create_vertex_buffer)(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags); + void (*destroy_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle); + bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer)(uint32_t _num, uint16_t _flags); + bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer_mem)(const bgfx_memory_t* _mem, uint16_t _flags); + void (*update_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t* _mem); + void (*destroy_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle); + bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint16_t _flags); + bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer_mem)(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags); + void (*update_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem); + void (*destroy_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle); + bool (*check_avail_transient_index_buffer)(uint32_t _num); + bool (*check_avail_transient_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t* _decl); + bool (*check_avail_instance_data_buffer)(uint32_t _num, uint16_t _stride); + bool (*check_avail_transient_buffers)(uint32_t _numVertices, const bgfx_vertex_decl_t* _decl, uint32_t _numIndices); + void (*alloc_transient_index_buffer)(bgfx_transient_index_buffer_t* _tib, uint32_t _num); + void (*alloc_transient_vertex_buffer)(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t* _decl); + bool (*alloc_transient_buffers)(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices); + const bgfx_instance_data_buffer_t* (*alloc_instance_data_buffer)(uint32_t _num, uint16_t _stride); + bgfx_indirect_buffer_handle_t (*create_indirect_buffer)(uint32_t _num); + void (*destroy_indirect_buffer)(bgfx_indirect_buffer_handle_t _handle); + bgfx_shader_handle_t (*create_shader)(const bgfx_memory_t* _mem); + uint16_t (*get_shader_uniforms)(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, uint16_t _max); + void (*destroy_shader)(bgfx_shader_handle_t _handle); + bgfx_program_handle_t (*create_program)(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders); + bgfx_program_handle_t (*create_compute_program)(bgfx_shader_handle_t _csh, bool _destroyShaders); + void (*destroy_program)(bgfx_program_handle_t _handle); + void (*calc_texture_size)(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format); + bgfx_texture_handle_t (*create_texture)(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info); + bgfx_texture_handle_t (*create_texture_2d)(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); + bgfx_texture_handle_t (*create_texture_2d_scaled)(bgfx_backbuffer_ratio_t _ratio, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags); + bgfx_texture_handle_t (*create_texture_3d)(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); + bgfx_texture_handle_t (*create_texture_cube)(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); + void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); + void (*update_texture_3d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem); + void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); + void (*destroy_texture)(bgfx_texture_handle_t _handle); + bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags); + bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags); + bgfx_frame_buffer_handle_t (*create_frame_buffer_from_handles)(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures); + bgfx_frame_buffer_handle_t (*create_frame_buffer_from_nwh)(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat); + void (*destroy_frame_buffer)(bgfx_frame_buffer_handle_t _handle); + bgfx_uniform_handle_t (*create_uniform)(const char* _name, bgfx_uniform_type_t _type, uint16_t _num); + void (*destroy_uniform)(bgfx_uniform_handle_t _handle); + bgfx_occlusion_query_handle_t (*create_occlusion_query)(); + bgfx_occlusion_query_result_t (*get_result)(bgfx_occlusion_query_handle_t _handle); + void (*destroy_occlusion_query)(bgfx_occlusion_query_handle_t _handle); + void (*set_palette_color)(uint8_t _index, const float _rgba[4]); + void (*set_view_name)(uint8_t _id, const char* _name); + void (*set_view_rect)(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); + void (*set_view_scissor)(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); + void (*set_view_clear)(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil); + void (*set_view_clear_mrt)(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7); + void (*set_view_seq)(uint8_t _id, bool _enabled); + void (*set_view_frame_buffer)(uint8_t _id, bgfx_frame_buffer_handle_t _handle); + void (*set_view_transform)(uint8_t _id, const void* _view, const void* _proj); + void (*set_view_transform_stereo)(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR); + void (*set_view_remap)(uint8_t _id, uint8_t _num, const void* _remap); + void (*set_marker)(const char* _marker); + void (*set_state)(uint64_t _state, uint32_t _rgba); + void (*set_condition)(bgfx_occlusion_query_handle_t _handle, bool _visible); + void (*set_stencil)(uint32_t _fstencil, uint32_t _bstencil); + uint16_t (*set_scissor)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); + void (*set_scissor_cached)(uint16_t _cache); + uint32_t (*set_transform)(const void* _mtx, uint16_t _num); + uint32_t (*alloc_transform)(bgfx_transform_t* _transform, uint16_t _num); + void (*set_transform_cached)(uint32_t _cache, uint16_t _num); + void (*set_uniform)(bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num); + void (*set_index_buffer)(bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); + void (*set_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); + void (*set_transient_index_buffer)(const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices); + void (*set_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); + void (*set_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _numVertices); + void (*set_transient_vertex_buffer)(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices); + void (*set_instance_data_buffer)(const bgfx_instance_data_buffer_t* _idb, uint32_t _num); + void (*set_instance_data_from_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); + void (*set_instance_data_from_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); + void (*set_texture)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags); + void (*set_texture_from_frame_buffer)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, uint32_t _flags); + uint32_t (*touch)(uint8_t _id); + uint32_t (*submit)(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth); + uint32_t (*submit_occlusion_query)(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth); + uint32_t (*submit_indirect)(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth); + void (*set_image)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); + void (*set_image_from_frame_buffer)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_access_t _access, bgfx_texture_format_t _format); + void (*set_compute_index_buffer)(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); + void (*set_compute_vertex_buffer)(uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); + void (*set_compute_dynamic_index_buffer)(uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); + void (*set_compute_dynamic_vertex_buffer)(uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); + void (*set_compute_indirect_buffer)(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); + uint32_t (*dispatch)(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags); + uint32_t (*dispatch_indirect)(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); + void (*discard)(); + void (*blit)(uint8_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); + void (*save_screen_shot)(const char* _filePath); + +} bgfx_interface_vtbl_t; + +typedef bgfx_interface_vtbl_t* (*PFN_BGFX_GET_INTERFACE)(uint32_t _version); #endif // BGFX_PLATFORM_C99_H_HEADER_GUARD diff --git a/3rdparty/bgfx/makefile b/3rdparty/bgfx/makefile index f583e7891db..afa61759a85 100644 --- a/3rdparty/bgfx/makefile +++ b/3rdparty/bgfx/makefile @@ -20,7 +20,8 @@ endif # $(info $(OS)) -GENIE=../bx/tools/bin/$(OS)/genie $(GENIE_FLAGS) +BX_DIR?=../bx +GENIE?=$(BX_DIR)/tools/bin/$(OS)/genie all: $(GENIE) --with-tools --with-shared-lib vs2008 @@ -214,6 +215,14 @@ rpi-release: .build/projects/gmake-rpi $(MAKE) -R -C .build/projects/gmake-rpi config=release rpi: rpi-debug rpi-release +build-darwin: osx + +build-linux: linux-debug64 linux-release64 + +build-windows: mingw-gcc + +build: build-$(OS) + rebuild-shaders: $(MAKE) -R -C examples rebuild @@ -268,16 +277,16 @@ BUILD_TOOLS_SUFFIX=Release EXE=.exe endif -tools/bin/$(OS)/shaderc$(EXE): .build/projects/$(BUILD_PROJECT_DIR) - $(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f shaderc.make config=$(BUILD_TOOLS_CONFIG) - $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/shaderc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@) - -tools/bin/$(OS)/geometryc$(EXE): .build/projects/$(BUILD_PROJECT_DIR) +geometryc: .build/projects/$(BUILD_PROJECT_DIR) $(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f geometryc.make config=$(BUILD_TOOLS_CONFIG) - $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/geometryc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@) + $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/geometryc$(BUILD_TOOLS_SUFFIX)$(EXE) tools/bin/$(OS)/geometryc$(EXE) + +shaderc: .build/projects/$(BUILD_PROJECT_DIR) + $(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f shaderc.make config=$(BUILD_TOOLS_CONFIG) + $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/shaderc$(BUILD_TOOLS_SUFFIX)$(EXE) tools/bin/$(OS)/shaderc$(EXE) -tools/bin/$(OS)/texturec$(EXE): .build/projects/$(BUILD_PROJECT_DIR) +texturec: .build/projects/$(BUILD_PROJECT_DIR) $(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f texturec.make config=$(BUILD_TOOLS_CONFIG) - $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/texturec$(BUILD_TOOLS_SUFFIX)$(EXE) $(@) + $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/texturec$(BUILD_TOOLS_SUFFIX)$(EXE) tools/bin/$(OS)/texturec$(EXE) -tools: tools/bin/$(OS)/shaderc$(EXE) tools/bin/$(OS)/geometryc$(EXE) tools/bin/$(OS)/texturec$(EXE) +tools: geometryc shaderc texturec diff --git a/3rdparty/bgfx/scripts/bgfx.lua b/3rdparty/bgfx/scripts/bgfx.lua index ce2effb0f88..cc646b6e261 100644 --- a/3rdparty/bgfx/scripts/bgfx.lua +++ b/3rdparty/bgfx/scripts/bgfx.lua @@ -36,7 +36,7 @@ function bgfxProject(_name, _kind, _defines) includedirs { path.join(BGFX_DIR, "3rdparty"), path.join(BGFX_DIR, "3rdparty/dxsdk/include"), - path.join(BGFX_DIR, "../bx/include"), + path.join(BX_DIR, "include"), } defines { diff --git a/3rdparty/bgfx/scripts/genie.lua b/3rdparty/bgfx/scripts/genie.lua index 0696469ca1c..77fe35d4cb6 100644 --- a/3rdparty/bgfx/scripts/genie.lua +++ b/3rdparty/bgfx/scripts/genie.lua @@ -66,9 +66,13 @@ solution "bgfx" startproject "example-00-helloworld" BGFX_DIR = path.getabsolute("..") +BX_DIR = os.getenv("BX_DIR") + local BGFX_BUILD_DIR = path.join(BGFX_DIR, ".build") local BGFX_THIRD_PARTY_DIR = path.join(BGFX_DIR, "3rdparty") -BX_DIR = path.getabsolute(path.join(BGFX_DIR, "../bx")) +if not BX_DIR then + BX_DIR = path.getabsolute(path.join(BGFX_DIR, "../bx")) +end if not os.isdir(BX_DIR) then print("bx not found at " .. BX_DIR) @@ -140,20 +144,15 @@ function exampleProject(_name) defines { "ENTRY_CONFIG_USE_SDL=1" } links { "SDL2" } - configuration { "x32", "windows" } - libdirs { "$(SDL2_DIR)/lib/x86" } - - configuration { "x64", "windows" } - libdirs { "$(SDL2_DIR)/lib/x64" } + configuration { "osx" } + libdirs { "$(SDL2_DIR)/lib" } configuration {} end if _OPTIONS["with-glfw"] then defines { "ENTRY_CONFIG_USE_GLFW=1" } - links { - "glfw3" - } + links { "glfw3" } configuration { "linux or freebsd" } links { @@ -415,7 +414,6 @@ end if _OPTIONS["with-tools"] then group "tools" - dofile "makedisttex.lua" dofile "shaderc.lua" dofile "texturec.lua" dofile "geometryc.lua" diff --git a/3rdparty/bgfx/scripts/makedisttex.lua b/3rdparty/bgfx/scripts/makedisttex.lua deleted file mode 100644 index 01705a08262..00000000000 --- a/3rdparty/bgfx/scripts/makedisttex.lua +++ /dev/null @@ -1,19 +0,0 @@ --- --- Copyright 2010-2016 Branimir Karadzic. All rights reserved. --- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause --- - -project "makedisttex" - uuid "b0561b30-91bb-11e1-b06e-023ad46e7d26" - kind "ConsoleApp" - - includedirs { - path.join(BX_DIR, "include"), - path.join(BGFX_DIR, "3rdparty"), - } - - files { - path.join(BGFX_DIR, "3rdparty/edtaa3/**.cpp"), - path.join(BGFX_DIR, "3rdparty/edtaa3/**.h"), - path.join(BGFX_DIR, "tools/makedisttex.cpp"), - } diff --git a/3rdparty/bgfx/scripts/shader.mk b/3rdparty/bgfx/scripts/shader.mk index 002b7564b3e..d7e0e151597 100644 --- a/3rdparty/bgfx/scripts/shader.mk +++ b/3rdparty/bgfx/scripts/shader.mk @@ -6,6 +6,11 @@ THISDIR:=$(dir $(lastword $(MAKEFILE_LIST))) include $(THISDIR)/tools.mk +# Define SHADERS_DIR if your shader files are in a different dir than the makefile including this. +# Notice: If defined, SHADERS_DIR should end with dir slash '/'. +# Example: +# SHADERS_DIR=shader_files/ + ifndef TARGET .PHONY: all all: @@ -67,18 +72,18 @@ CS_FLAGS+=-i $(THISDIR)../src/ BUILD_OUTPUT_DIR=$(addprefix ./, $(RUNTIME_DIR)/$(SHADER_PATH)) BUILD_INTERMEDIATE_DIR=$(addprefix $(BUILD_DIR)/, $(SHADER_PATH)) -VS_SOURCES=$(wildcard vs_*.sc) -VS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(VS_SOURCES)))) +VS_SOURCES=$(notdir $(wildcard $(addprefix $(SHADERS_DIR), vs_*.sc))) +VS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(notdir $(VS_SOURCES))))) -FS_SOURCES=$(wildcard fs_*.sc) -FS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(FS_SOURCES)))) +FS_SOURCES=$(notdir $(wildcard $(addprefix $(SHADERS_DIR), fs_*.sc))) +FS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(notdir $(FS_SOURCES))))) -CS_SOURCES=$(wildcard cs_*.sc) -CS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(CS_SOURCES)))) +CS_SOURCES=$(notdir $(wildcard $(addprefix $(SHADERS_DIR), cs_*.sc))) +CS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(notdir $(CS_SOURCES))))) -VS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(VS_SOURCES)))) -FS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(FS_SOURCES)))) -CS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(CS_SOURCES)))) +VS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(notdir $(VS_SOURCES))))) +FS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(notdir $(FS_SOURCES))))) +CS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(notdir $(CS_SOURCES))))) BIN = $(VS_BIN) $(FS_BIN) ASM = $(VS_ASM) $(FS_ASM) @@ -98,17 +103,17 @@ endif endif endif -$(BUILD_INTERMEDIATE_DIR)/vs_%.bin : vs_%.sc +$(BUILD_INTERMEDIATE_DIR)/vs_%.bin : $(SHADERS_DIR)vs_%.sc @echo [$(<)] $(SILENT) $(SHADERC) $(VS_FLAGS) --type vertex --depends -o $(@) -f $(<) --disasm $(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F) -$(BUILD_INTERMEDIATE_DIR)/fs_%.bin : fs_%.sc +$(BUILD_INTERMEDIATE_DIR)/fs_%.bin : $(SHADERS_DIR)fs_%.sc @echo [$(<)] $(SILENT) $(SHADERC) $(FS_FLAGS) --type fragment --depends -o $(@) -f $(<) --disasm $(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F) -$(BUILD_INTERMEDIATE_DIR)/cs_%.bin : cs_%.sc +$(BUILD_INTERMEDIATE_DIR)/cs_%.bin : $(SHADERS_DIR)cs_%.sc @echo [$(<)] $(SILENT) $(SHADERC) $(CS_FLAGS) --type compute --depends -o $(@) -f $(<) --disasm $(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F) diff --git a/3rdparty/bgfx/scripts/shaderc.lua b/3rdparty/bgfx/scripts/shaderc.lua index b2a5b5c54a0..4c09f847745 100644 --- a/3rdparty/bgfx/scripts/shaderc.lua +++ b/3rdparty/bgfx/scripts/shaderc.lua @@ -55,11 +55,6 @@ project "shaderc" path.join(GLSL_OPTIMIZER, "include/c99"), } - configuration { "vs* or mingw*" } - links { - "d3dcompiler", - } - configuration {} defines { -- fcpp @@ -73,6 +68,7 @@ project "shaderc" path.join(BX_DIR, "include"), path.join(BGFX_DIR, "include"), + path.join(BGFX_DIR, "3rdparty/dxsdk/include"), FCPP_DIR, path.join(GLSL_OPTIMIZER, "include"), diff --git a/3rdparty/bgfx/scripts/texturec.lua b/3rdparty/bgfx/scripts/texturec.lua index 8b9beed609e..dac357b6b86 100644 --- a/3rdparty/bgfx/scripts/texturec.lua +++ b/3rdparty/bgfx/scripts/texturec.lua @@ -19,8 +19,12 @@ project "texturec" path.join(BGFX_DIR, "src/image.*"), path.join(BGFX_DIR, "3rdparty/libsquish/**.cpp"), path.join(BGFX_DIR, "3rdparty/libsquish/**.h"), + path.join(BGFX_DIR, "3rdparty/edtaa3/**.cpp"), + path.join(BGFX_DIR, "3rdparty/edtaa3/**.h"), path.join(BGFX_DIR, "3rdparty/etc1/**.cpp"), path.join(BGFX_DIR, "3rdparty/etc1/**.h"), + path.join(BGFX_DIR, "3rdparty/etc2/**.cpp"), + path.join(BGFX_DIR, "3rdparty/etc2/**.hpp"), path.join(BGFX_DIR, "3rdparty/nvtt/**.cpp"), path.join(BGFX_DIR, "3rdparty/nvtt/**.h"), path.join(BGFX_DIR, "3rdparty/pvrtc/**.cpp"), diff --git a/3rdparty/bgfx/src/bgfx.cpp b/3rdparty/bgfx/src/bgfx.cpp index a6882850ba9..aae0311ebd5 100644 --- a/3rdparty/bgfx/src/bgfx.cpp +++ b/3rdparty/bgfx/src/bgfx.cpp @@ -112,10 +112,10 @@ namespace bgfx strcat(filePath, ".tga"); bx::CrtFileWriter writer; - if (0 == writer.open(filePath) ) + if (bx::open(&writer, filePath) ) { imageWriteTga(&writer, _width, _height, _pitch, _data, false, _yflip); - writer.close(); + bx::close(&writer); } #endif // BX_CONFIG_CRT_FILE_READER_WRITER } @@ -277,6 +277,7 @@ namespace bgfx static Context* s_ctx = NULL; static bool s_renderFrameCalled = false; + InternalData g_internalData; PlatformData g_platformData; void AllocatorStub::checkLeaks() @@ -292,19 +293,75 @@ namespace bgfx #endif // BGFX_CONFIG_MEMORY_TRACKING } - void setPlatformData(const PlatformData& _pd) + void setPlatformData(const PlatformData& _data) { if (NULL != s_ctx) { BGFX_FATAL(true - && g_platformData.ndt == _pd.ndt - && g_platformData.nwh == _pd.nwh - && g_platformData.context == _pd.context + && g_platformData.ndt == _data.ndt + && g_platformData.nwh == _data.nwh + && g_platformData.context == _data.context , Fatal::UnableToInitialize , "Only backbuffer pointer can be changed after initialization!" ); } - memcpy(&g_platformData, &_pd, sizeof(PlatformData) ); + memcpy(&g_platformData, &_data, sizeof(PlatformData) ); + } + + const InternalData* getInternalData() + { + BGFX_CHECK_RENDER_THREAD(); + return &g_internalData; + } + + uintptr_t overrideInternal(TextureHandle _handle, uintptr_t _ptr) + { + BGFX_CHECK_RENDER_THREAD(); + RendererContextI* rci = s_ctx->m_renderCtx; + if (0 == rci->getInternal(_handle) ) + { + return 0; + } + + rci->overrideInternal(_handle, _ptr); + + return rci->getInternal(_handle); + } + + uintptr_t overrideInternal(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags) + { + BGFX_CHECK_RENDER_THREAD(); + RendererContextI* rci = s_ctx->m_renderCtx; + if (0 == rci->getInternal(_handle) ) + { + return 0; + } + + uint32_t size = sizeof(uint32_t) + sizeof(TextureCreate); + Memory* mem = const_cast(alloc(size) ); + + bx::StaticMemoryBlockWriter writer(mem->data, mem->size); + uint32_t magic = BGFX_CHUNK_MAGIC_TEX; + bx::write(&writer, magic); + + TextureCreate tc; + tc.m_flags = _flags; + tc.m_width = _width; + tc.m_height = _height; + tc.m_sides = 0; + tc.m_depth = 0; + tc.m_numMips = uint8_t(bx::uint16_max(1, _numMips) ); + tc.m_format = _format; + tc.m_cubeMap = false; + tc.m_mem = NULL; + bx::write(&writer, tc); + + rci->destroyTexture(_handle); + rci->createTexture(_handle, mem, _flags, 0); + + release(mem); + + return rci->getInternal(_handle); } void setGraphicsDebuggerPresent(bool _present) @@ -1026,6 +1083,15 @@ namespace bgfx static void dumpCaps() { + BX_TRACE("Sort key masks:"); + BX_TRACE("\t View %016" PRIx64, SORT_KEY_VIEW_MASK); + BX_TRACE("\t Draw bit %016" PRIx64, SORT_KEY_DRAW_BIT); + BX_TRACE("\t Seq %016" PRIx64, SORT_KEY_SEQ_MASK); + BX_TRACE("\tD Trans %016" PRIx64, SORT_KEY_DRAW_TRANS_MASK); + BX_TRACE("\tD Program %016" PRIx64, SORT_KEY_DRAW_PROGRAM_MASK); + BX_TRACE("\tC Program %016" PRIx64, SORT_KEY_COMPUTE_PROGRAM_MASK); + BX_TRACE("\tD Depth %016" PRIx64, SORT_KEY_DRAW_DEPTH_MASK); + BX_TRACE("Supported capabilities (renderer %s, vendor 0x%04x, device 0x%04x):" , s_ctx->m_renderCtx->getRendererName() , g_caps.vendorId @@ -1217,6 +1283,8 @@ namespace bgfx frame(); } + g_internalData.caps = getCaps(); + return true; } @@ -1263,6 +1331,7 @@ namespace bgfx m_render->destroy(); #endif // BGFX_CONFIG_MULTITHREADED + memset(&g_internalData, 0, sizeof(InternalData) ); s_ctx = NULL; m_submit->destroy(); @@ -2825,13 +2894,6 @@ again: ); } - uint32_t size = sizeof(uint32_t)+sizeof(TextureCreate); - const Memory* mem = alloc(size); - - bx::StaticMemoryBlockWriter writer(mem->data, mem->size); - uint32_t magic = BGFX_CHUNK_MAGIC_TEX; - bx::write(&writer, magic); - if (BackbufferRatio::Count != _ratio) { _width = uint16_t(s_ctx->m_resolution.m_width); @@ -2839,6 +2901,13 @@ again: getTextureSizeFromRatio(_ratio, _width, _height); } + uint32_t size = sizeof(uint32_t)+sizeof(TextureCreate); + const Memory* mem = alloc(size); + + bx::StaticMemoryBlockWriter writer(mem->data, mem->size); + uint32_t magic = BGFX_CHUNK_MAGIC_TEX; + bx::write(&writer, magic); + TextureCreate tc; tc.m_flags = _flags; tc.m_width = _width; @@ -2846,7 +2915,7 @@ again: tc.m_sides = 0; tc.m_depth = 0; tc.m_numMips = _numMips; - tc.m_format = uint8_t(_format); + tc.m_format = _format; tc.m_cubeMap = false; tc.m_mem = _mem; bx::write(&writer, tc); @@ -2897,15 +2966,15 @@ again: bx::write(&writer, magic); TextureCreate tc; - tc.m_flags = _flags; - tc.m_width = _width; - tc.m_height = _height; - tc.m_sides = 0; - tc.m_depth = _depth; + tc.m_flags = _flags; + tc.m_width = _width; + tc.m_height = _height; + tc.m_sides = 0; + tc.m_depth = _depth; tc.m_numMips = _numMips; - tc.m_format = uint8_t(_format); + tc.m_format = _format; tc.m_cubeMap = false; - tc.m_mem = _mem; + tc.m_mem = _mem; bx::write(&writer, tc); return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count); @@ -2947,7 +3016,7 @@ again: tc.m_sides = 6; tc.m_depth = 0; tc.m_numMips = _numMips; - tc.m_format = uint8_t(_format); + tc.m_format = _format; tc.m_cubeMap = true; tc.m_mem = _mem; bx::write(&writer, tc); @@ -3488,6 +3557,32 @@ again: #include #include +#define FLAGS_MASK_TEST(_flags, _mask) ( (_flags) == ( (_flags) & (_mask) ) ) + +BX_STATIC_ASSERT(FLAGS_MASK_TEST(0 + | BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER + | BGFX_TEXTURE_INTERNAL_SHARED + , BGFX_TEXTURE_RESERVED_MASK + ) ); + +BX_STATIC_ASSERT(FLAGS_MASK_TEST(0 + | BGFX_RESET_INTERNAL_FORCE + , BGFX_RESET_RESERVED_MASK + ) ); + +BX_STATIC_ASSERT(FLAGS_MASK_TEST(0 + | BGFX_STATE_INTERNAL_SCISSOR + | BGFX_STATE_INTERNAL_OCCLUSION_QUERY + , BGFX_STATE_RESERVED_MASK + ) ); + +BX_STATIC_ASSERT(FLAGS_MASK_TEST(0 + | BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE + , BGFX_SUBMIT_RESERVED_MASK + ) ); + +#undef FLAGS_MASK_TEST + BX_STATIC_ASSERT(bgfx::Fatal::Count == bgfx::Fatal::Enum(BGFX_FATAL_COUNT) ); BX_STATIC_ASSERT(bgfx::RendererType::Count == bgfx::RendererType::Enum(BGFX_RENDERER_TYPE_COUNT) ); BX_STATIC_ASSERT(bgfx::Attrib::Count == bgfx::Attrib::Enum(BGFX_ATTRIB_COUNT) ); @@ -3504,6 +3599,7 @@ BX_STATIC_ASSERT(sizeof(bgfx::InstanceDataBuffer) == sizeof(bgfx_instance_dat BX_STATIC_ASSERT(sizeof(bgfx::TextureInfo) == sizeof(bgfx_texture_info_t) ); BX_STATIC_ASSERT(sizeof(bgfx::Caps) == sizeof(bgfx_caps_t) ); BX_STATIC_ASSERT(sizeof(bgfx::PlatformData) == sizeof(bgfx_platform_data_t) ); +BX_STATIC_ASSERT(sizeof(bgfx::InternalData) == sizeof(bgfx_internal_data_t) ); namespace bgfx { @@ -4364,9 +4460,26 @@ BGFX_C_API bgfx_render_frame_t bgfx_render_frame() return bgfx_render_frame_t(bgfx::renderFrame() ); } -BGFX_C_API void bgfx_set_platform_data(bgfx_platform_data_t* _pd) +BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t* _data) +{ + bgfx::setPlatformData(*(const bgfx::PlatformData*)_data); +} + +BGFX_C_API const bgfx_internal_data_t* bgfx_get_internal_data() { - bgfx::setPlatformData(*(bgfx::PlatformData*)_pd); + return (const bgfx_internal_data_t*)bgfx::getInternalData(); +} + +BGFX_C_API uintptr_t bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, uintptr_t _ptr) +{ + union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; + return bgfx::overrideInternal(handle.cpp, _ptr); +} + +BGFX_C_API uintptr_t bgfx_override_internal_texture(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags) +{ + union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; + return bgfx::overrideInternal(handle.cpp, _width, _height, _numMips, bgfx::TextureFormat::Enum(_format), _flags); } BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) @@ -4376,6 +4489,9 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) #define BGFX_IMPORT \ BGFX_IMPORT_FUNC(render_frame) \ BGFX_IMPORT_FUNC(set_platform_data) \ + BGFX_IMPORT_FUNC(get_internal_data) \ + BGFX_IMPORT_FUNC(override_internal_texture_ptr) \ + BGFX_IMPORT_FUNC(override_internal_texture) \ BGFX_IMPORT_FUNC(vertex_decl_begin) \ BGFX_IMPORT_FUNC(vertex_decl_add) \ BGFX_IMPORT_FUNC(vertex_decl_skip) \ diff --git a/3rdparty/bgfx/src/bgfx_p.h b/3rdparty/bgfx/src/bgfx_p.h index fc13eeb06b7..9e4e5a17184 100644 --- a/3rdparty/bgfx/src/bgfx_p.h +++ b/3rdparty/bgfx/src/bgfx_p.h @@ -201,6 +201,7 @@ namespace stl #define BGFX_MAX_COMPUTE_BINDINGS 8 #define BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER UINT32_C(0x10000000) +#define BGFX_TEXTURE_INTERNAL_SHARED UINT32_C(0x20000000) #define BGFX_RESET_INTERNAL_FORCE UINT32_C(0x80000000) @@ -212,9 +213,9 @@ namespace stl #define BGFX_RENDERER_DIRECT3D9_NAME "Direct3D 9" #define BGFX_RENDERER_DIRECT3D11_NAME "Direct3D 11" #define BGFX_RENDERER_DIRECT3D12_NAME "Direct3D 12" -#define BGFX_RENDERER_METAL_NAME "Metal" -#define BGFX_RENDERER_VULKAN_NAME "Vulkan" -#define BGFX_RENDERER_NULL_NAME "NULL" +#define BGFX_RENDERER_METAL_NAME "Metal" +#define BGFX_RENDERER_VULKAN_NAME "Vulkan" +#define BGFX_RENDERER_NULL_NAME "NULL" #if BGFX_CONFIG_RENDERER_OPENGL # if BGFX_CONFIG_RENDERER_OPENGL >= 31 && BGFX_CONFIG_RENDERER_OPENGL <= 33 @@ -256,6 +257,7 @@ namespace stl namespace bgfx { + extern InternalData g_internalData; extern PlatformData g_platformData; #if BGFX_CONFIG_MAX_DRAW_CALLS < (64<<10) @@ -309,13 +311,13 @@ namespace bgfx struct TextureCreate { + TextureFormat::Enum m_format; uint32_t m_flags; uint16_t m_width; uint16_t m_height; uint16_t m_sides; uint16_t m_depth; uint8_t m_numMips; - uint8_t m_format; bool m_cubeMap; const Memory* m_mem; }; @@ -448,13 +450,7 @@ namespace bgfx const uint32_t width = (bx::uint32_min(m_width, _width +_x)-_x)*2; const uint32_t height = bx::uint32_min(m_height, _height+_y)-_y; const uint32_t dstPitch = m_width*2; - - for (uint32_t yy = 0; yy < height; ++yy) - { - memcpy(dst, src, width); - dst += dstPitch; - src += _pitch; - } + bx::memCopy(dst, src, width, height, _pitch, dstPitch); } } @@ -700,26 +696,28 @@ namespace bgfx void operator=(const CommandBuffer&); }; -#define SORT_KEY_DRAW_BIT (UINT64_C(1)<<0x36) +#define SORT_KEY_NUM_BITS_TRANS 2 -#define SORT_KEY_SEQ_SHIFT 0x2b -#define SORT_KEY_SEQ_MASK (UINT64_C(0x7ff)<> SORT_KEY_SEQ_SHIFT); + m_seq = uint32_t( (_key & SORT_KEY_SEQ_MASK ) >> SORT_KEY_SEQ_SHIFT); m_view = uint8_t( (_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT); if (_key & SORT_KEY_DRAW_BIT) { @@ -832,15 +830,15 @@ namespace bgfx void reset() { m_depth = 0; - m_program = 0; m_seq = 0; + m_program = 0; m_view = 0; m_trans = 0; } uint32_t m_depth; + uint32_t m_seq; uint16_t m_program; - uint16_t m_seq; uint8_t m_view; uint8_t m_trans; }; @@ -2041,6 +2039,8 @@ namespace bgfx virtual void updateTextureEnd() = 0; virtual void readTexture(TextureHandle _handle, void* _data) = 0; virtual void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height) = 0; + virtual void overrideInternal(TextureHandle _handle, uintptr_t _ptr) = 0; + virtual uintptr_t getInternal(TextureHandle _handle) = 0; virtual void destroyTexture(TextureHandle _handle) = 0; virtual void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) = 0; virtual void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) = 0; diff --git a/3rdparty/bgfx/src/bgfx_shader.sh b/3rdparty/bgfx/src/bgfx_shader.sh index a82a03e2fbb..77998652e9d 100644 --- a/3rdparty/bgfx/src/bgfx_shader.sh +++ b/3rdparty/bgfx/src/bgfx_shader.sh @@ -12,6 +12,22 @@ #ifndef __cplusplus +#if BGFX_SHADER_LANGUAGE_HLSL > 3 +# define BRANCH [branch] +# define LOOP [loop] +# define UNROLL [unroll] +#else +# define BRANCH +# define LOOP +# define UNROLL +#endif // BGFX_SHADER_LANGUAGE_HLSL > 3 + +#if BGFX_SHADER_LANGUAGE_HLSL > 3 && BGFX_SHADER_TYPE_FRAGMENT +# define EARLY_DEPTH_STENCIL [earlydepthstencil] +#else +# define EARLY_DEPTH_STENCIL +#endif // BGFX_SHADER_LANGUAGE_HLSL > 3 && BGFX_SHADER_TYPE_FRAGMENT + #if BGFX_SHADER_LANGUAGE_HLSL # define dFdx(_x) ddx(_x) # define dFdy(_y) ddy(-_y) @@ -59,13 +75,13 @@ struct BgfxSampler2DShadow float bgfxShadow2D(BgfxSampler2DShadow _sampler, vec3 _coord) { - return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, _coord.xy, _coord.z * 2.0 - 1.0); + return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, _coord.xy, _coord.z); } float bgfxShadow2DProj(BgfxSampler2DShadow _sampler, vec4 _coord) { vec3 coord = _coord.xyz * rcp(_coord.w); - return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, coord.xy, coord.z * 2.0 - 1.0); + return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, coord.xy, coord.z); } struct BgfxSampler3D @@ -180,9 +196,9 @@ float bgfxShadow2D(sampler2DShadow _sampler, vec3 _coord) { #if 0 float occluder = tex2D(_sampler, _coord.xy).x; - return step(_coord.z * 2.0 - 1.0, occluder); + return step(_coord.z, occluder); #else - return tex2Dproj(_sampler, vec4(_coord.xy, _coord.z * 2.0 - 1.0, 1.0) ).x; + return tex2Dproj(_sampler, vec4(_coord.xy, _coord.z, 1.0) ).x; #endif // 0 } @@ -191,7 +207,7 @@ float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord) #if 0 vec3 coord = _coord.xyz * rcp(_coord.w); float occluder = tex2D(_sampler, coord.xy).x; - return step(coord.z * 2.0 - 1.0, occluder); + return step(coord.z, occluder); #else return tex2Dproj(_sampler, _coord).x; #endif // 0 diff --git a/3rdparty/bgfx/src/config.h b/3rdparty/bgfx/src/config.h index 5966105ea15..edfa69da75a 100644 --- a/3rdparty/bgfx/src/config.h +++ b/3rdparty/bgfx/src/config.h @@ -65,6 +65,7 @@ || BX_PLATFORM_NACL \ || BX_PLATFORM_QNX \ || BX_PLATFORM_RPI \ + || BX_PLATFORM_STEAMLINK \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_OPENGLES @@ -77,8 +78,10 @@ || BGFX_CONFIG_RENDERER_DIRECT3D9 \ || BGFX_CONFIG_RENDERER_DIRECT3D11 \ || BGFX_CONFIG_RENDERER_DIRECT3D12 \ + || BGFX_CONFIG_RENDERER_METAL \ || BGFX_CONFIG_RENDERER_OPENGL \ || BGFX_CONFIG_RENDERER_OPENGLES \ + || BGFX_CONFIG_RENDERER_VULKAN \ ? 1 : 0) ) # endif // BGFX_CONFIG_RENDERER_NULL #else @@ -175,19 +178,7 @@ #endif // BGFX_CONFIG_DEBUG_OCCLUSION #ifndef BGFX_CONFIG_MULTITHREADED -# define BGFX_CONFIG_MULTITHREADED ( (!BGFX_CONFIG_RENDERER_NULL)&&(0 \ - || BX_PLATFORM_ANDROID \ - || BX_PLATFORM_BSD \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_IOS \ - || BX_PLATFORM_NACL \ - || BX_PLATFORM_OSX \ - || BX_PLATFORM_QNX \ - || BX_PLATFORM_RPI \ - || BX_PLATFORM_WINDOWS \ - || BX_PLATFORM_WINRT \ - || BX_PLATFORM_XBOX360 \ - ? 1 : 0) ) +# define BGFX_CONFIG_MULTITHREADED ( (0 == BX_PLATFORM_EMSCRIPTEN) ? 1 : 0) #endif // BGFX_CONFIG_MULTITHREADED #ifndef BGFX_CONFIG_MAX_DRAW_CALLS @@ -206,6 +197,21 @@ # define BGFX_CONFIG_MAX_RECT_CACHE (4<<10) #endif // BGFX_CONFIG_MAX_RECT_CACHE +#ifndef BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH +# define BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH 32 +#endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH + +#ifndef BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ +# define BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ 11 +#endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ + +#ifndef BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM +# define BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM 9 +#endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM + +// Cannot be configured directly. Must must be power of 2. +#define BGFX_CONFIG_MAX_PROGRAMS (1< + void encodeRgbE(float* _dst, const float* _src) + { + // Reference: + // https://www.opengl.org/registry/specs/EXT/texture_shared_exponent.txt + const int32_t expMax = (1<>23) & 0xff) - 127) ) ) + 1 + expBias; + float denom = bx::fpow(2.0f, float(expShared - expBias - MantissaBits) ); + + if ( (1< + void decodeRgbE(float* _dst, const float* _src) + { + const int32_t expBias = (1<<(ExpBits - 1) ) - 1; + const float exponent = _src[3]-float(expBias-MantissaBits); + const float scale = bx::fpow(2.0f, exponent); + _dst[0] = _src[0] * scale; + _dst[1] = _src[1] * scale; + _dst[2] = _src[2] * scale; + } + + // RGB9E5F + void packRgb9E5F(void* _dst, const float* _src) + { + float tmp[4]; + encodeRgbE<9, 5>(tmp, _src); + + *( (uint32_t*)_dst) = 0 + | (uint32_t(tmp[0]) ) + | (uint32_t(tmp[1]) << 9) + | (uint32_t(tmp[2]) <<18) + | (uint32_t(tmp[3]) <<27) + ; + } + + void unpackRgb9E5F(float* _dst, const void* _src) + { + uint32_t packed = *( (const uint32_t*)_src); + + float tmp[4]; + tmp[0] = float( ( (packed ) & 0x1ff) ) / 511.0f; + tmp[1] = float( ( (packed>> 9) & 0x1ff) ) / 511.0f; + tmp[2] = float( ( (packed>>18) & 0x1ff) ) / 511.0f; + tmp[3] = float( ( (packed>>27) & 0x1f) ); + + decodeRgbE<9, 5>(_dst, tmp); + } + + // RGBA32I + void packRgba32I(void* _dst, const float* _src) + { + memcpy(_dst, _src, 16); + } + + void unpackRgba32I(float* _dst, const void* _src) + { + memcpy(_dst, _src, 16); + } + + // RGBA32U + void packRgba32U(void* _dst, const float* _src) + { + memcpy(_dst, _src, 16); + } + + void unpackRgba32U(float* _dst, const void* _src) + { + memcpy(_dst, _src, 16); + } + + // RGBA32F + void packRgba32F(void* _dst, const float* _src) + { + memcpy(_dst, _src, 16); + } + + void unpackRgba32F(float* _dst, const void* _src) + { + memcpy(_dst, _src, 16); + } + + // R5G6B5 + void packR5G6B5(void* _dst, const float* _src) + { + *( (uint16_t*)_dst) = 0 + | uint16_t(toUnorm(_src[0], 31.0f) ) + | uint16_t(toUnorm(_src[1], 63.0f)<< 5) + | uint16_t(toUnorm(_src[2], 31.0f)<<11) + ; + } + + void unpackR5G6B5(float* _dst, const void* _src) + { + uint16_t packed = *( (const uint16_t*)_src); + _dst[0] = float( ( (packed ) & 0x1f) ) / 31.0f; + _dst[1] = float( ( (packed>> 5) & 0x3f) ) / 63.0f; + _dst[2] = float( ( (packed>>11) & 0x1f) ) / 31.0f; + } + + // RGBA4 + void packRgba4(void* _dst, const float* _src) + { + *( (uint16_t*)_dst) = 0 + | uint16_t(toUnorm(_src[0], 15.0f) ) + | uint16_t(toUnorm(_src[1], 15.0f)<< 4) + | uint16_t(toUnorm(_src[2], 15.0f)<< 8) + | uint16_t(toUnorm(_src[3], 15.0f)<<12) + ; + } + + void unpackRgba4(float* _dst, const void* _src) + { + uint16_t packed = *( (const uint16_t*)_src); + _dst[0] = float( ( (packed ) & 0xf) ) / 15.0f; + _dst[1] = float( ( (packed>> 4) & 0xf) ) / 15.0f; + _dst[2] = float( ( (packed>> 8) & 0xf) ) / 15.0f; + _dst[3] = float( ( (packed>>12) & 0xf) ) / 15.0f; + } + + // RGB5A1 + void packRgb5a1(void* _dst, const float* _src) + { + *( (uint16_t*)_dst) = 0 + | uint16_t(toUnorm(_src[0], 31.0f) ) + | uint16_t(toUnorm(_src[1], 31.0f)<< 5) + | uint16_t(toUnorm(_src[2], 31.0f)<<10) + | uint16_t(toUnorm(_src[3], 1.0f)<<15) + ; + } + + void unpackRgb5a1(float* _dst, const void* _src) + { + uint16_t packed = *( (const uint16_t*)_src); + _dst[0] = float( ( (packed ) & 0x1f) ) / 31.0f; + _dst[1] = float( ( (packed>> 5) & 0x1f) ) / 31.0f; + _dst[2] = float( ( (packed>>10) & 0x1f) ) / 31.0f; + _dst[3] = float( ( (packed>>14) & 0x1) ); + } + + // RGB10A2 + void packRgb10A2(void* _dst, const float* _src) + { + *( (uint32_t*)_dst) = 0 + | (toUnorm(_src[0], 1023.0f) ) + | (toUnorm(_src[1], 1023.0f)<<10) + | (toUnorm(_src[2], 1023.0f)<<20) + | (toUnorm(_src[3], 3.0f)<<30) + ; + } + + void unpackRgb10A2(float* _dst, const void* _src) + { + uint32_t packed = *( (const uint32_t*)_src); + _dst[0] = float( ( (packed ) & 0x3ff) ) / 1023.0f; + _dst[1] = float( ( (packed>>10) & 0x3ff) ) / 1023.0f; + _dst[2] = float( ( (packed>>20) & 0x3ff) ) / 1023.0f; + _dst[3] = float( ( (packed>>30) & 0x3) ) / 3.0f; + } + + // R11G11B10F + void packR11G11B10F(void* _dst, const float* _src) + { + *( (uint32_t*)_dst) = 0 + | ( (bx::halfFromFloat(_src[0])>> 4) & 0x7ff) + | ( (bx::halfFromFloat(_src[0])<< 7) & 0x3ff800) + | ( (bx::halfFromFloat(_src[0])<<17) & 0xffc00000) + ; + } + + void unpackR11G11B10F(float* _dst, const void* _src) + { + uint32_t packed = *( (const uint32_t*)_src); + _dst[0] = bx::halfToFloat( (packed<< 4) & 0x7ff0); + _dst[1] = bx::halfToFloat( (packed>> 7) & 0x7ff0); + _dst[2] = bx::halfToFloat( (packed>>17) & 0x7fe0); + } + + typedef void (*PackFn)(void*, const float*); + typedef void (*UnpackFn)(float*, const void*); + + struct PackUnpack + { + PackFn pack; + UnpackFn unpack; + }; + + static PackUnpack s_packUnpack[] = + { + { NULL, NULL }, // BC1 + { NULL, NULL }, // BC2 + { NULL, NULL }, // BC3 + { NULL, NULL }, // BC4 + { NULL, NULL }, // BC5 + { NULL, NULL }, // BC6H + { NULL, NULL }, // BC7 + { NULL, NULL }, // ETC1 + { NULL, NULL }, // ETC2 + { NULL, NULL }, // ETC2A + { NULL, NULL }, // ETC2A1 + { NULL, NULL }, // PTC12 + { NULL, NULL }, // PTC14 + { NULL, NULL }, // PTC12A + { NULL, NULL }, // PTC14A + { NULL, NULL }, // PTC22 + { NULL, NULL }, // PTC24 + { NULL, NULL }, // Unknown + { NULL, NULL }, // R1 + { packR8, unpackR8 }, // A8 + { packR8, unpackR8 }, // R8 + { packR8I, unpackR8I }, // R8I + { packR8U, unpackR8U }, // R8U + { packR8S, unpackR8S }, // R8S + { packR16, unpackR16 }, // R16 + { packR16I, unpackR16I }, // R16I + { packR16U, unpackR16U }, // R16U + { packR16F, unpackR16F }, // R16F + { packR16S, unpackR16S }, // R16S + { packR32I, unpackR32I }, // R32I + { packR32U, unpackR32U }, // R32U + { packR32F, unpackR32F }, // R32F + { packRg8, unpackRg8 }, // RG8 + { packRg8I, unpackRg8I }, // RG8I + { packRg8U, unpackRg8U }, // RG8U + { packRg8S, unpackRg8S }, // RG8S + { packRg16, unpackRg16 }, // RG16 + { packRg16I, unpackRg16I }, // RG16I + { packRg16U, unpackRg16U }, // RG16U + { packRg16F, unpackRg16F }, // RG16F + { packRg16S, unpackRg16S }, // RG16S + { packRg32I, unpackRg32I }, // RG32I + { packRg32U, unpackRg32U }, // RG32U + { packRg32F, unpackRg32F }, // RG32F + { packRgb9E5F, unpackRgb9E5F }, // RGB9E5F + { packBgra8, unpackBgra8 }, // BGRA8 + { packRgba8, unpackRgba8 }, // RGBA8 + { packRgba8I, unpackRgba8I }, // RGBA8I + { packRgba8U, unpackRgba8U }, // RGBA8U + { packRgba8S, unpackRgba8S }, // RGBA8S + { packRgba16, unpackRgba16 }, // RGBA16 + { packRgba16I, unpackRgba16I }, // RGBA16I + { packRgba16U, unpackRgba16U }, // RGBA16U + { packRgba16F, unpackRgba16F }, // RGBA16F + { packRgba16S, unpackRgba16S }, // RGBA16S + { packRgba32I, unpackRgba32I }, // RGBA32I + { packRgba32U, unpackRgba32U }, // RGBA32U + { packRgba32F, unpackRgba32F }, // RGBA32F + { packR5G6B5, unpackR5G6B5 }, // R5G6B5 + { packRgba4, unpackRgba4 }, // RGBA4 + { packRgb5a1, unpackRgb5a1 }, // RGB5A1 + { packRgb10A2, unpackRgb10A2 }, // RGB10A2 + { packR11G11B10F, unpackR11G11B10F }, // R11G11B10F + { NULL, NULL }, // UnknownDepth + { NULL, NULL }, // D16 + { NULL, NULL }, // D24 + { NULL, NULL }, // D24S8 + { NULL, NULL }, // D32 + { NULL, NULL }, // D16F + { NULL, NULL }, // D24F + { NULL, NULL }, // D32F + { NULL, NULL }, // D0S8 + }; + BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_packUnpack) ); + + bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height) + { + UnpackFn unpack = s_packUnpack[_srcFormat].unpack; + PackFn pack = s_packUnpack[_dstFormat].pack; + if (NULL == pack + || NULL == unpack) + { + return false; + } + + const uint8_t* src = (uint8_t*)_src; + uint8_t* dst = (uint8_t*)_dst; + + const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel; + const uint32_t dstBpp = s_imageBlockInfo[_dstFormat].bitsPerPixel; + const uint32_t srcPitch = _width * srcBpp / 8; + const uint32_t dstPitch = _width * dstBpp / 8; + + for (uint32_t yy = 0; yy < _height; ++yy, src += srcPitch, dst += dstPitch) + { + for (uint32_t xx = 0; xx < _width; ++xx) + { + float rgba[4]; + unpack(rgba, &src[xx*srcBpp/8]); + pack(&dst[xx*dstBpp/8], rgba); + } + } + + return true; } uint8_t bitRangeConvert(uint32_t _in, uint32_t _from, uint32_t _to) @@ -1324,6 +2213,34 @@ namespace bgfx } } + const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _mips) + { + const uint8_t numMips = _mips ? imageGetNumMips(_format, _width, _height) : 1; + uint32_t size = imageGetSize(_format, _width, _height, 0, false, numMips); + const Memory* image = alloc(size); + + _imageContainer.m_data = image->data; + _imageContainer.m_format = _format; + _imageContainer.m_size = image->size; + _imageContainer.m_offset = 0; + _imageContainer.m_width = _width; + _imageContainer.m_height = _height; + _imageContainer.m_depth = _depth; + _imageContainer.m_numMips = numMips; + _imageContainer.m_hasAlpha = false; + _imageContainer.m_cubeMap = _cubeMap; + _imageContainer.m_ktx = false; + _imageContainer.m_ktxLE = false; + _imageContainer.m_srgb = false; + + return image; + } + + void imageFree(const Memory* _memory) + { + release(_memory); + } + // DDS #define DDS_MAGIC BX_MAKEFOURCC('D', 'D', 'S', ' ') #define DDS_HEADER_SIZE 124 @@ -1670,7 +2587,7 @@ namespace bgfx _imageContainer.m_width = width; _imageContainer.m_height = height; _imageContainer.m_depth = depth; - _imageContainer.m_format = uint8_t(format); + _imageContainer.m_format = format; _imageContainer.m_numMips = uint8_t( (caps[0] & DDSCAPS_MIPMAP) ? mips : 1); _imageContainer.m_hasAlpha = hasAlpha; _imageContainer.m_cubeMap = cubeMap; @@ -1852,7 +2769,7 @@ namespace bgfx { KTX_RG32UI, KTX_ZERO, KTX_RG, KTX_UNSIGNED_INT, }, // RG32U { KTX_RG32F, KTX_ZERO, KTX_RG, KTX_FLOAT, }, // RG32F { KTX_RGB9_E5, KTX_ZERO, KTX_RGB, KTX_UNSIGNED_INT_5_9_9_9_REV, }, // RGB9E5F - { KTX_RGBA8, KTX_SRGB8_ALPHA8, KTX_BGRA, KTX_UNSIGNED_BYTE, }, // BGRA8 + { KTX_BGRA, KTX_SRGB8_ALPHA8, KTX_BGRA, KTX_UNSIGNED_BYTE, }, // BGRA8 { KTX_RGBA8, KTX_SRGB8_ALPHA8, KTX_RGBA, KTX_UNSIGNED_BYTE, }, // RGBA8 { KTX_RGBA8I, KTX_ZERO, KTX_RGBA, KTX_BYTE, }, // RGBA8I { KTX_RGBA8UI, KTX_ZERO, KTX_RGBA, KTX_UNSIGNED_BYTE, }, // RGBA8U @@ -1946,7 +2863,7 @@ namespace bgfx _imageContainer.m_width = width; _imageContainer.m_height = height; _imageContainer.m_depth = depth; - _imageContainer.m_format = uint8_t(format); + _imageContainer.m_format = format; _imageContainer.m_numMips = uint8_t(numMips); _imageContainer.m_hasAlpha = hasAlpha; _imageContainer.m_cubeMap = numFaces > 1; @@ -2094,7 +3011,7 @@ namespace bgfx _imageContainer.m_width = width; _imageContainer.m_height = height; _imageContainer.m_depth = depth; - _imageContainer.m_format = uint8_t(format); + _imageContainer.m_format = format; _imageContainer.m_numMips = uint8_t(numMips); _imageContainer.m_hasAlpha = hasAlpha; _imageContainer.m_cubeMap = numFaces > 1; @@ -2161,16 +3078,17 @@ namespace bgfx return imageParse(_imageContainer, &reader); } - void imageDecodeToBgra8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, uint8_t _type) + void imageDecodeToBgra8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format) { - const uint8_t* src = _src; + const uint8_t* src = (const uint8_t*)_src; + uint8_t* dst = (uint8_t*)_dst; uint32_t width = _width/4; uint32_t height = _height/4; uint8_t temp[16*4]; - switch (_type) + switch (_format) { case TextureFormat::BC1: for (uint32_t yy = 0; yy < height; ++yy) @@ -2180,11 +3098,11 @@ namespace bgfx decodeBlockDxt1(temp, src); src += 8; - uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4]; - memcpy(&dst[0*_pitch], &temp[ 0], 16); - memcpy(&dst[1*_pitch], &temp[16], 16); - memcpy(&dst[2*_pitch], &temp[32], 16); - memcpy(&dst[3*_pitch], &temp[48], 16); + uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; + memcpy(&block[0*_pitch], &temp[ 0], 16); + memcpy(&block[1*_pitch], &temp[16], 16); + memcpy(&block[2*_pitch], &temp[32], 16); + memcpy(&block[3*_pitch], &temp[48], 16); } } break; @@ -2199,11 +3117,11 @@ namespace bgfx decodeBlockDxt(temp, src); src += 8; - uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4]; - memcpy(&dst[0*_pitch], &temp[ 0], 16); - memcpy(&dst[1*_pitch], &temp[16], 16); - memcpy(&dst[2*_pitch], &temp[32], 16); - memcpy(&dst[3*_pitch], &temp[48], 16); + uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; + memcpy(&block[0*_pitch], &temp[ 0], 16); + memcpy(&block[1*_pitch], &temp[16], 16); + memcpy(&block[2*_pitch], &temp[32], 16); + memcpy(&block[3*_pitch], &temp[48], 16); } } break; @@ -2218,11 +3136,11 @@ namespace bgfx decodeBlockDxt(temp, src); src += 8; - uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4]; - memcpy(&dst[0*_pitch], &temp[ 0], 16); - memcpy(&dst[1*_pitch], &temp[16], 16); - memcpy(&dst[2*_pitch], &temp[32], 16); - memcpy(&dst[3*_pitch], &temp[48], 16); + uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; + memcpy(&block[0*_pitch], &temp[ 0], 16); + memcpy(&block[1*_pitch], &temp[16], 16); + memcpy(&block[2*_pitch], &temp[32], 16); + memcpy(&block[3*_pitch], &temp[48], 16); } } break; @@ -2235,11 +3153,11 @@ namespace bgfx decodeBlockDxt45A(temp, src); src += 8; - uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4]; - memcpy(&dst[0*_pitch], &temp[ 0], 16); - memcpy(&dst[1*_pitch], &temp[16], 16); - memcpy(&dst[2*_pitch], &temp[32], 16); - memcpy(&dst[3*_pitch], &temp[48], 16); + uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; + memcpy(&block[0*_pitch], &temp[ 0], 16); + memcpy(&block[1*_pitch], &temp[16], 16); + memcpy(&block[2*_pitch], &temp[32], 16); + memcpy(&block[3*_pitch], &temp[48], 16); } } break; @@ -2249,10 +3167,10 @@ namespace bgfx { for (uint32_t xx = 0; xx < width; ++xx) { - decodeBlockDxt45A(temp+1, src); - src += 8; decodeBlockDxt45A(temp+2, src); src += 8; + decodeBlockDxt45A(temp+1, src); + src += 8; for (uint32_t ii = 0; ii < 16; ++ii) { @@ -2263,11 +3181,11 @@ namespace bgfx temp[ii*4+3] = 0; } - uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4]; - memcpy(&dst[0*_pitch], &temp[ 0], 16); - memcpy(&dst[1*_pitch], &temp[16], 16); - memcpy(&dst[2*_pitch], &temp[32], 16); - memcpy(&dst[3*_pitch], &temp[48], 16); + uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; + memcpy(&block[0*_pitch], &temp[ 0], 16); + memcpy(&block[1*_pitch], &temp[16], 16); + memcpy(&block[2*_pitch], &temp[32], 16); + memcpy(&block[3*_pitch], &temp[48], 16); } } break; @@ -2281,11 +3199,11 @@ namespace bgfx decodeBlockEtc12(temp, src); src += 8; - uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4]; - memcpy(&dst[0*_pitch], &temp[ 0], 16); - memcpy(&dst[1*_pitch], &temp[16], 16); - memcpy(&dst[2*_pitch], &temp[32], 16); - memcpy(&dst[3*_pitch], &temp[48], 16); + uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; + memcpy(&block[0*_pitch], &temp[ 0], 16); + memcpy(&block[1*_pitch], &temp[16], 16); + memcpy(&block[2*_pitch], &temp[32], 16); + memcpy(&block[3*_pitch], &temp[48], 16); } } break; @@ -2317,11 +3235,11 @@ namespace bgfx { decodeBlockPtc14(temp, src, xx, yy, width, height); - uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4]; - memcpy(&dst[0*_pitch], &temp[ 0], 16); - memcpy(&dst[1*_pitch], &temp[16], 16); - memcpy(&dst[2*_pitch], &temp[32], 16); - memcpy(&dst[3*_pitch], &temp[48], 16); + uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; + memcpy(&block[0*_pitch], &temp[ 0], 16); + memcpy(&block[1*_pitch], &temp[16], 16); + memcpy(&block[2*_pitch], &temp[32], 16); + memcpy(&block[3*_pitch], &temp[48], 16); } } break; @@ -2333,11 +3251,11 @@ namespace bgfx { decodeBlockPtc14A(temp, src, xx, yy, width, height); - uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4]; - memcpy(&dst[0*_pitch], &temp[ 0], 16); - memcpy(&dst[1*_pitch], &temp[16], 16); - memcpy(&dst[2*_pitch], &temp[32], 16); - memcpy(&dst[3*_pitch], &temp[48], 16); + uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; + memcpy(&block[0*_pitch], &temp[ 0], 16); + memcpy(&block[1*_pitch], &temp[16], 16); + memcpy(&block[2*_pitch], &temp[32], 16); + memcpy(&block[3*_pitch], &temp[48], 16); } } break; @@ -2367,9 +3285,9 @@ namespace bgfx } } - void imageDecodeToRgba8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, uint8_t _type) + void imageDecodeToRgba8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format) { - switch (_type) + switch (_format) { case TextureFormat::RGBA8: memcpy(_dst, _src, _pitch*_height); @@ -2380,12 +3298,136 @@ namespace bgfx break; default: - imageDecodeToBgra8(_dst, _src, _width, _height, _pitch, _type); + imageDecodeToBgra8(_dst, _src, _width, _height, _pitch, _format); imageSwizzleBgra8(_width, _height, _pitch, _dst, _dst); break; } } + void imageRgba8ToRgba32fRef(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) + { + const uint32_t dstwidth = _width; + const uint32_t dstheight = _height; + + if (0 == dstwidth + || 0 == dstheight) + { + return; + } + + float* dst = (float*)_dst; + const uint8_t* src = (const uint8_t*)_src; + + for (uint32_t yy = 0, ystep = _pitch; yy < dstheight; ++yy, src += ystep) + { + const uint8_t* rgba = src; + for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 4, dst += 4) + { + dst[0] = powf(rgba[ 0], 2.2f); + dst[1] = powf(rgba[ 1], 2.2f); + dst[2] = powf(rgba[ 2], 2.2f); + dst[3] = rgba[ 3]; + } + } + } + + void imageRgba8ToRgba32f(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) + { + const uint32_t dstwidth = _width; + const uint32_t dstheight = _height; + + if (0 == dstwidth + || 0 == dstheight) + { + return; + } + + float* dst = (float*)_dst; + const uint8_t* src = (const uint8_t*)_src; + + using namespace bx; + const float4_t unpack = float4_ld(1.0f, 1.0f/256.0f, 1.0f/65536.0f, 1.0f/16777216.0f); + const float4_t umask = float4_ild(0xff, 0xff00, 0xff0000, 0xff000000); + const float4_t wflip = float4_ild(0, 0, 0, 0x80000000); + const float4_t wadd = float4_ld(0.0f, 0.0f, 0.0f, 32768.0f*65536.0f); + + for (uint32_t yy = 0, ystep = _pitch; yy < dstheight; ++yy, src += ystep) + { + const uint8_t* rgba = src; + for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 4, dst += 4) + { + const float4_t abgr0 = float4_splat(rgba); + const float4_t abgr0m = float4_and(abgr0, umask); + const float4_t abgr0x = float4_xor(abgr0m, wflip); + const float4_t abgr0f = float4_itof(abgr0x); + const float4_t abgr0c = float4_add(abgr0f, wadd); + const float4_t abgr0n = float4_mul(abgr0c, unpack); + + float4_st(dst, abgr0n); + } + } + } + + void imageDecodeToRgba32f(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format) + { + const uint8_t* src = (const uint8_t*)_src; + uint8_t* dst = (uint8_t*)_dst; + + switch (_format) + { + case TextureFormat::BC5: + { + uint32_t width = _width/4; + uint32_t height = _height/4; + + for (uint32_t yy = 0; yy < height; ++yy) + { + for (uint32_t xx = 0; xx < width; ++xx) + { + uint8_t temp[16*4]; + + decodeBlockDxt45A(temp+2, src); + src += 8; + decodeBlockDxt45A(temp+1, src); + src += 8; + + for (uint32_t ii = 0; ii < 16; ++ii) + { + float nx = temp[ii*4+2]*2.0f/255.0f - 1.0f; + float ny = temp[ii*4+1]*2.0f/255.0f - 1.0f; + float nz = sqrtf(1.0f - nx*nx - ny*ny); + + const uint32_t offset = (yy*4 + ii/4)*_width*16 + (xx*4 + ii%4)*16; + float* block = (float*)&dst[offset]; + block[0] = nx; + block[1] = ny; + block[2] = nz; + block[3] = 0.0f; + } + } + } + } + break; + + case TextureFormat::RGBA32F: + memcpy(_dst, _src, _pitch*_height); + break; + + case TextureFormat::RGBA8: + imageRgba8ToRgba32f(_dst, _width, _height, _pitch, _src); + break; + + default: + { + void* temp = BX_ALLOC(_allocator, imageGetSize(_format, uint16_t(_pitch/4), uint16_t(_height) ) ); + imageDecodeToRgba8(temp, _src, _width, _height, _pitch, _format); + imageRgba8ToRgba32f(_dst, _width, _height, _pitch, temp); + BX_FREE(_allocator, temp); + } + break; + } + } + bool imageGetRawData(const ImageContainer& _imageContainer, uint8_t _side, uint8_t _lod, const void* _data, uint32_t _size, ImageMip& _mip) { uint32_t offset = _imageContainer.m_offset; @@ -2443,7 +3485,7 @@ namespace bgfx _mip.m_size = size; _mip.m_data = &data[offset]; _mip.m_bpp = bpp; - _mip.m_format = uint8_t(format); + _mip.m_format = format; _mip.m_hasAlpha = hasAlpha; return true; } @@ -2484,7 +3526,7 @@ namespace bgfx _mip.m_size = size; _mip.m_data = &data[offset]; _mip.m_bpp = bpp; - _mip.m_format = uint8_t(format); + _mip.m_format = format; _mip.m_hasAlpha = hasAlpha; return true; } @@ -2504,7 +3546,7 @@ namespace bgfx return false; } - void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip) + void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, bool _grayscale, bool _yflip) { uint8_t type = _grayscale ? 3 : 2; uint8_t bpp = _grayscale ? 8 : 32; @@ -2523,16 +3565,16 @@ namespace bgfx uint32_t dstPitch = _width*bpp/8; if (_yflip) { - uint8_t* data = (uint8_t*)_src + _srcPitch*_height - _srcPitch; + uint8_t* data = (uint8_t*)_src + _pitch*_height - _pitch; for (uint32_t yy = 0; yy < _height; ++yy) { bx::write(_writer, data, dstPitch); - data -= _srcPitch; + data -= _pitch; } } - else if (_srcPitch == dstPitch) + else if (_pitch == dstPitch) { - bx::write(_writer, _src, _height*_srcPitch); + bx::write(_writer, _src, _height*_pitch); } else { @@ -2540,7 +3582,7 @@ namespace bgfx for (uint32_t yy = 0; yy < _height; ++yy) { bx::write(_writer, data, dstPitch); - data += _srcPitch; + data += _pitch; } } } diff --git a/3rdparty/bgfx/src/image.h b/3rdparty/bgfx/src/image.h index 50824e5fd9e..458d7e51c46 100644 --- a/3rdparty/bgfx/src/image.h +++ b/3rdparty/bgfx/src/image.h @@ -13,12 +13,12 @@ namespace bgfx struct ImageContainer { void* m_data; + TextureFormat::Enum m_format; uint32_t m_size; uint32_t m_offset; uint32_t m_width; uint32_t m_height; uint32_t m_depth; - uint8_t m_format; uint8_t m_numMips; bool m_hasAlpha; bool m_cubeMap; @@ -29,12 +29,12 @@ namespace bgfx struct ImageMip { + TextureFormat::Enum m_format; uint32_t m_width; uint32_t m_height; uint32_t m_blockSize; uint32_t m_size; uint8_t m_bpp; - uint8_t m_format; bool m_hasAlpha; const uint8_t* m_data; }; @@ -103,19 +103,31 @@ namespace bgfx void imageCheckerboard(uint32_t _width, uint32_t _height, uint32_t _step, uint32_t _0, uint32_t _1, void* _dst); /// - void imageRgba8Downsample2x2(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst); + void imageRgba8Downsample2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst); /// - void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst); + void imageRgba32fDownsample2x2NormalMap(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst); + + /// + void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst); /// void imageCopy(uint32_t _height, uint32_t _srcPitch, const void* _src, uint32_t _dstPitch, void* _dst); /// - void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _srcPitch, const void* _src, void* _dst); + void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _pitch, const void* _src, void* _dst); + + /// + bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height); + + /// + const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0, bool _cubeMap = false, bool _mips = false); + + /// + void imageFree(const Memory* _memory); /// - void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip); + void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, bool _grayscale, bool _yflip); /// void imageWriteKtx(bx::WriterI* _writer, TextureFormat::Enum _format, bool _cubeMap, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, const void* _src); @@ -130,10 +142,13 @@ namespace bgfx bool imageParse(ImageContainer& _imageContainer, const void* _data, uint32_t _size); /// - void imageDecodeToBgra8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, uint8_t _type); + void imageDecodeToBgra8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format); + + /// + void imageDecodeToRgba8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format); /// - void imageDecodeToRgba8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, uint8_t _type); + void imageDecodeToRgba32f(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format); /// bool imageGetRawData(const ImageContainer& _imageContainer, uint8_t _side, uint8_t _index, const void* _data, uint32_t _size, ImageMip& _mip); diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp index 9fc75a8c452..1e36af03985 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.cpp +++ b/3rdparty/bgfx/src/renderer_d3d11.cpp @@ -487,6 +487,8 @@ namespace bgfx { namespace d3d11 return false; }; + // Reference: + // https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK enum AGS_RETURN_CODE { AGS_SUCCESS, @@ -1465,6 +1467,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } BGFX_GPU_PROFILER_BIND(m_device, m_deviceCtx); + + g_internalData.context = m_device; return true; error: @@ -1742,7 +1746,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); tc.m_sides = 0; tc.m_depth = 0; tc.m_numMips = 1; - tc.m_format = texture.m_requestedFormat; + tc.m_format = TextureFormat::Enum(texture.m_requestedFormat); tc.m_cubeMap = false; tc.m_mem = NULL; bx::write(&writer, tc); @@ -1753,6 +1757,22 @@ BX_PRAGMA_DIAGNOSTIC_POP(); release(mem); } + void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE + { + // Resource ref. counts might be messed up outside of bgfx. + // Disabling ref. count check once texture is overridden. + setGraphicsDebuggerPresent(true); + m_textures[_handle.idx].overrideInternal(_ptr); + } + + uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE + { + // Resource ref. counts might be messed up outside of bgfx. + // Disabling ref. count check once texture is overridden. + setGraphicsDebuggerPresent(true); + return uintptr_t(m_textures[_handle.idx].m_ptr); + } + void destroyTexture(TextureHandle _handle) BX_OVERRIDE { m_textures[_handle.idx].destroy(); @@ -2224,6 +2244,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } else { + m_deviceCtx->ClearState(); + m_deviceCtx->Flush(); + if (resize) { m_deviceCtx->OMSetRenderTargets(1, s_zero.m_rtv, NULL); @@ -3078,6 +3101,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); D3D11_MAPPED_SUBRESOURCE mapped; DX_CHECK(m_deviceCtx->Map(m_captureTexture, 0, D3D11_MAP_READ, 0, &mapped) ); + imageSwizzleBgra8(getBufferWidth() + , getBufferHeight() + , mapped.RowPitch + , mapped.pData + , mapped.pData + ); + g_callback->captureFrame(mapped.pData, getBufferHeight()*mapped.RowPitch); m_deviceCtx->Unmap(m_captureTexture, 0); @@ -3999,7 +4029,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } - const bool bufferOnly = 0 != (m_flags&(BGFX_TEXTURE_RT_BUFFER_ONLY|BGFX_TEXTURE_READ_BACK) ); + const bool writeOnly = 0 != (m_flags&(BGFX_TEXTURE_RT_WRITE_ONLY|BGFX_TEXTURE_READ_BACK) ); const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE); const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK); const bool srgb = 0 != (m_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb; @@ -4043,7 +4073,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); desc.Format = format; desc.SampleDesc = msaa; desc.Usage = kk == 0 || blit ? D3D11_USAGE_DEFAULT : D3D11_USAGE_IMMUTABLE; - desc.BindFlags = bufferOnly ? 0 : D3D11_BIND_SHADER_RESOURCE; + desc.BindFlags = writeOnly ? 0 : D3D11_BIND_SHADER_RESOURCE; desc.CPUAccessFlags = 0; if (isDepth( (TextureFormat::Enum)m_textureFormat) ) @@ -4116,7 +4146,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); break; } - if (!bufferOnly) + if (!writeOnly) { DX_CHECK(s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, &srvd, &m_srv) ); } @@ -4147,7 +4177,19 @@ BX_PRAGMA_DIAGNOSTIC_POP(); s_renderD3D11->m_srvUavLru.invalidateWithParent(getHandle().idx); DX_RELEASE(m_srv, 0); DX_RELEASE(m_uav, 0); - DX_RELEASE(m_ptr, 0); + if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED) ) + { + DX_RELEASE(m_ptr, 0); + } + } + + void TextureD3D11::overrideInternal(uintptr_t _ptr) + { + destroy(); + m_flags |= BGFX_TEXTURE_INTERNAL_SHARED; + m_ptr = (ID3D11Resource*)_ptr; + + s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, NULL, &m_srv); } void TextureD3D11::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) @@ -4175,7 +4217,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (convert) { temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height); - imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, m_requestedFormat); + imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, TextureFormat::Enum(m_requestedFormat) ); data = temp; } @@ -4727,7 +4769,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { // reset the framebuffer to be the backbuffer; depending on the swap effect, // if we don't do this we'll only see one frame of output and then nothing - setFrameBuffer(fbh); + FrameBufferHandle invalid = BGFX_INVALID_HANDLE; + setFrameBuffer(invalid); bool viewRestart = false; uint8_t eye = 0; @@ -4887,12 +4930,18 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } else { + bool depthStencil = isDepth(TextureFormat::Enum(src.m_textureFormat) ); + BX_CHECK(!depthStencil + || (width == src.m_width && height == src.m_height) + , "When blitting depthstencil surface, source resolution must match destination." + ); + D3D11_BOX box; box.left = blit.m_srcX; box.top = blit.m_srcY; box.front = 0; box.right = blit.m_srcX + width; - box.bottom = blit.m_srcY + height;; + box.bottom = blit.m_srcY + height; box.back = 1; const uint32_t srcZ = TextureD3D11::TextureCube == src.m_type @@ -4904,7 +4953,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); : 0 ; - bool depthStencil = isDepth(TextureFormat::Enum(src.m_textureFormat) ); deviceCtx->CopySubresourceRegion(dst.m_ptr , dstZ*dst.m_numMips+blit.m_dstMip , blit.m_dstX diff --git a/3rdparty/bgfx/src/renderer_d3d11.h b/3rdparty/bgfx/src/renderer_d3d11.h index 67c05eb8161..151d3ce5cc7 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.h +++ b/3rdparty/bgfx/src/renderer_d3d11.h @@ -223,6 +223,7 @@ namespace bgfx { namespace d3d11 void create(const Memory* _mem, uint32_t _flags, uint8_t _skip); void destroy(); + void overrideInternal(uintptr_t _ptr); void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); void commit(uint8_t _stage, uint32_t _flags, const float _palette[][4]); void resolve(); diff --git a/3rdparty/bgfx/src/renderer_d3d12.cpp b/3rdparty/bgfx/src/renderer_d3d12.cpp index 22251bebf9d..76eb52e0e21 100644 --- a/3rdparty/bgfx/src/renderer_d3d12.cpp +++ b/3rdparty/bgfx/src/renderer_d3d12.cpp @@ -1042,6 +1042,8 @@ namespace bgfx { namespace d3d12 m_gpuTimer.init(); m_occlusionQuery.init(); } + + g_internalData.context = m_device; return true; error: @@ -1359,7 +1361,7 @@ namespace bgfx { namespace d3d12 tc.m_sides = 0; tc.m_depth = 0; tc.m_numMips = 1; - tc.m_format = texture.m_requestedFormat; + tc.m_format = TextureFormat::Enum(texture.m_requestedFormat); tc.m_cubeMap = false; tc.m_mem = NULL; bx::write(&writer, tc); @@ -1370,6 +1372,17 @@ namespace bgfx { namespace d3d12 release(mem); } + void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE + { + BX_UNUSED(_handle, _ptr); + } + + uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE + { + BX_UNUSED(_handle); + return 0; + } + void destroyTexture(TextureHandle _handle) BX_OVERRIDE { m_textures[_handle.idx].destroy(); @@ -1860,8 +1873,8 @@ data.NumQualityLevels = 0; if (isValid(frameBuffer.m_depth) ) { TextureD3D12& texture = m_textures[frameBuffer.m_depth.idx]; - const bool bufferOnly = 0 != (texture.m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY); - if (!bufferOnly) + const bool writeOnly = 0 != (texture.m_flags&BGFX_TEXTURE_RT_WRITE_ONLY); + if (!writeOnly) { texture.setState(m_commandList, D3D12_RESOURCE_STATE_DEPTH_READ); } @@ -3801,7 +3814,7 @@ data.NumQualityLevels = 0; blockHeight = blockInfo.blockHeight; } - const bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY); + const bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY); const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE); const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK); @@ -3813,7 +3826,7 @@ data.NumQualityLevels = 0; , textureHeight , imageContainer.m_cubeMap ? "x6" : "" , renderTarget ? 'x' : ' ' - , bufferOnly ? 'x' : ' ' + , writeOnly ? 'x' : ' ' , computeWrite ? 'x' : ' ' , swizzle ? " (swizzle BGRA8 -> RGBA8)" : "" ); @@ -3969,7 +3982,7 @@ data.NumQualityLevels = 0; resourceDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; } - if (bufferOnly) + if (writeOnly) { resourceDesc.Flags |= D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE; state &= ~D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; diff --git a/3rdparty/bgfx/src/renderer_d3d9.cpp b/3rdparty/bgfx/src/renderer_d3d9.cpp index dc51a9eef3f..4fb4d435b4a 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.cpp +++ b/3rdparty/bgfx/src/renderer_d3d9.cpp @@ -603,85 +603,85 @@ namespace bgfx { namespace d3d9 s_textureFormat[TextureFormat::BC5].m_fmt = s_extendedFormats[ExtendedFormat::Ati2].m_supported ? D3DFMT_ATI2 : D3DFMT_UNKNOWN; g_caps.supported |= m_instancingSupport ? BGFX_CAPS_INSTANCING : 0; + } - for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) - { - uint8_t support = 0; + for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) + { + uint8_t support = 0; - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , 0 - , D3DRTYPE_TEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_2D : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , D3DUSAGE_QUERY_SRGBREAD - , D3DRTYPE_TEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , 0 - , D3DRTYPE_VOLUMETEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_3D : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , D3DUSAGE_QUERY_SRGBREAD - , D3DRTYPE_VOLUMETEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , 0 - , D3DRTYPE_CUBETEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , D3DUSAGE_QUERY_SRGBREAD - , D3DRTYPE_CUBETEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , D3DUSAGE_QUERY_VERTEXTEXTURE - , D3DRTYPE_TEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_VERTEX : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , isDepth(TextureFormat::Enum(ii) ) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET - , D3DRTYPE_TEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceMultiSampleType(m_adapter - , m_deviceType - , s_textureFormat[ii].m_fmt - , true - , D3DMULTISAMPLE_2_SAMPLES - , NULL - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA : BGFX_CAPS_FORMAT_TEXTURE_NONE; + support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter + , m_deviceType + , adapterFormat + , 0 + , D3DRTYPE_TEXTURE + , s_textureFormat[ii].m_fmt + ) ) ? BGFX_CAPS_FORMAT_TEXTURE_2D : BGFX_CAPS_FORMAT_TEXTURE_NONE; - g_caps.formats[ii] = support; - } + support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter + , m_deviceType + , adapterFormat + , D3DUSAGE_QUERY_SRGBREAD + , D3DRTYPE_TEXTURE + , s_textureFormat[ii].m_fmt + ) ) ? BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE; + + support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter + , m_deviceType + , adapterFormat + , 0 + , D3DRTYPE_VOLUMETEXTURE + , s_textureFormat[ii].m_fmt + ) ) ? BGFX_CAPS_FORMAT_TEXTURE_3D : BGFX_CAPS_FORMAT_TEXTURE_NONE; + + support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter + , m_deviceType + , adapterFormat + , D3DUSAGE_QUERY_SRGBREAD + , D3DRTYPE_VOLUMETEXTURE + , s_textureFormat[ii].m_fmt + ) ) ? BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE; + + support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter + , m_deviceType + , adapterFormat + , 0 + , D3DRTYPE_CUBETEXTURE + , s_textureFormat[ii].m_fmt + ) ) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE : BGFX_CAPS_FORMAT_TEXTURE_NONE; + + support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter + , m_deviceType + , adapterFormat + , D3DUSAGE_QUERY_SRGBREAD + , D3DRTYPE_CUBETEXTURE + , s_textureFormat[ii].m_fmt + ) ) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE; + + support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter + , m_deviceType + , adapterFormat + , D3DUSAGE_QUERY_VERTEXTEXTURE + , D3DRTYPE_TEXTURE + , s_textureFormat[ii].m_fmt + ) ) ? BGFX_CAPS_FORMAT_TEXTURE_VERTEX : BGFX_CAPS_FORMAT_TEXTURE_NONE; + + support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter + , m_deviceType + , adapterFormat + , isDepth(TextureFormat::Enum(ii) ) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET + , D3DRTYPE_TEXTURE + , s_textureFormat[ii].m_fmt + ) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER : BGFX_CAPS_FORMAT_TEXTURE_NONE; + + support |= SUCCEEDED(m_d3d9->CheckDeviceMultiSampleType(m_adapter + , m_deviceType + , s_textureFormat[ii].m_fmt + , true + , D3DMULTISAMPLE_2_SAMPLES + , NULL + ) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA : BGFX_CAPS_FORMAT_TEXTURE_NONE; + + g_caps.formats[ii] = support; } m_fmtDepth = D3DFMT_D24S8; @@ -752,6 +752,7 @@ namespace bgfx { namespace d3d9 m_initialized = true; + g_internalData.context = m_device; return true; error: @@ -996,6 +997,22 @@ namespace bgfx { namespace d3d9 texture.m_height = _height; } + void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE + { + // Resource ref. counts might be messed up outside of bgfx. + // Disabling ref. count check once texture is overridden. + setGraphicsDebuggerPresent(true); + m_textures[_handle.idx].overrideInternal(_ptr); + } + + uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE + { + // Resource ref. counts might be messed up outside of bgfx. + // Disabling ref. count check once texture is overridden. + setGraphicsDebuggerPresent(true); + return uintptr_t(m_textures[_handle.idx].m_ptr); + } + void destroyTexture(TextureHandle _handle) BX_OVERRIDE { m_textures[_handle.idx].destroy(); @@ -1925,30 +1942,34 @@ namespace bgfx { namespace d3d9 device->SetVertexShader(program.m_vsh->m_vertexShader); device->SetPixelShader(program.m_fsh->m_pixelShader); + float mrtClear[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS][4]; + if (BGFX_CLEAR_COLOR_USE_PALETTE & _clear.m_flags) { - float mrtClear[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS][4]; for (uint32_t ii = 0; ii < numMrt; ++ii) { - uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE-1, _clear.m_index[ii]); + uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE - 1, _clear.m_index[ii]); memcpy(mrtClear[ii], _palette[index], 16); } - - DX_CHECK(m_device->SetPixelShaderConstantF(0, mrtClear[0], numMrt) ); } else { float rgba[4] = { - _clear.m_index[0]*1.0f/255.0f, - _clear.m_index[1]*1.0f/255.0f, - _clear.m_index[2]*1.0f/255.0f, - _clear.m_index[3]*1.0f/255.0f, + _clear.m_index[0] * 1.0f / 255.0f, + _clear.m_index[1] * 1.0f / 255.0f, + _clear.m_index[2] * 1.0f / 255.0f, + _clear.m_index[3] * 1.0f / 255.0f, }; - DX_CHECK(m_device->SetPixelShaderConstantF(0, rgba, 1) ); + for (uint32_t ii = 0; ii < numMrt; ++ii) + { + memcpy(mrtClear[ii], rgba, 16); + } } + DX_CHECK(device->SetPixelShaderConstantF(0, mrtClear[0], numMrt)); + DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, stride) ); DX_CHECK(device->SetStreamSourceFreq(0, 1) ); DX_CHECK(device->SetStreamSource(1, NULL, 0, 0) ); @@ -2427,10 +2448,10 @@ namespace bgfx { namespace d3d9 uint32_t msaaQuality = ( (m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT); msaaQuality = bx::uint32_satsub(msaaQuality, 1); - bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY); + bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY); if (0 != msaaQuality - || bufferOnly) + || writeOnly) { const Msaa& msaa = s_msaa[msaaQuality]; @@ -2461,7 +2482,7 @@ namespace bgfx { namespace d3d9 ) ); } - if (bufferOnly) + if (writeOnly) { // This is render buffer, there is no sampling, no need // to create texture. @@ -2798,8 +2819,8 @@ namespace bgfx { namespace d3d9 m_height = textureHeight; m_depth = imageContainer.m_depth; m_numMips = numMips; - m_requestedFormat = imageContainer.m_format; - m_textureFormat = imageContainer.m_format; + m_requestedFormat = + m_textureFormat = uint8_t(imageContainer.m_format); const TextureFormatInfo& tfi = s_textureFormat[m_requestedFormat]; uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); @@ -2837,7 +2858,7 @@ namespace bgfx { namespace d3d9 , 0 != (m_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : "" ); - if (0 != (_flags&BGFX_TEXTURE_RT_BUFFER_ONLY) ) + if (0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY) ) { return; } @@ -2892,13 +2913,7 @@ namespace bgfx { namespace d3d9 , mip.m_format ); - uint32_t dstpitch = pitch; - for (uint32_t yy = 0; yy < height; ++yy) - { - uint8_t* src = &temp[yy*srcpitch]; - uint8_t* dst = &bits[yy*dstpitch]; - memcpy(dst, src, dstpitch); - } + bx::memCopy(bits, temp, pitch, height, srcpitch, pitch); BX_FREE(g_allocator, temp); } @@ -2950,7 +2965,7 @@ namespace bgfx { namespace d3d9 if (convert) { temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height); - imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, m_requestedFormat); + imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, TextureFormat::Enum(m_requestedFormat) ); data = temp; } diff --git a/3rdparty/bgfx/src/renderer_d3d9.h b/3rdparty/bgfx/src/renderer_d3d9.h index 0bef1737058..aecfba57322 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.h +++ b/3rdparty/bgfx/src/renderer_d3d9.h @@ -325,12 +325,22 @@ namespace bgfx { namespace d3d9 void destroy() { - DX_RELEASE(m_ptr, 0); + if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED) ) + { + DX_RELEASE(m_ptr, 0); + } DX_RELEASE(m_surface, 0); DX_RELEASE(m_staging, 0); m_textureFormat = TextureFormat::Unknown; } + void overrideInternal(uintptr_t _ptr) + { + destroy(); + m_flags |= BGFX_TEXTURE_INTERNAL_SHARED; + m_ptr = (IDirect3DBaseTexture9*)_ptr; + } + void updateBegin(uint8_t _side, uint8_t _mip); void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); void updateEnd(); diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp index 35fbdc427cf..be4ab0a09d7 100644 --- a/3rdparty/bgfx/src/renderer_gl.cpp +++ b/3rdparty/bgfx/src/renderer_gl.cpp @@ -260,9 +260,9 @@ namespace bgfx { namespace gl { GL_RGBA32I, GL_ZERO, GL_RGBA, GL_INT, false }, // RGBA32I { GL_RGBA32UI, GL_ZERO, GL_RGBA, GL_UNSIGNED_INT, false }, // RGBA32U { GL_RGBA32F, GL_ZERO, GL_RGBA, GL_FLOAT, false }, // RGBA32F - { GL_RGB565, GL_ZERO, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, false }, // R5G6B5 - { GL_RGBA4, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, false }, // RGBA4 - { GL_RGB5_A1, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, false }, // RGB5A1 + { GL_RGB565, GL_ZERO, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false }, // R5G6B5 + { GL_RGBA4, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, false }, // RGBA4 + { GL_RGB5_A1, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false }, // RGB5A1 { GL_RGB10_A2, GL_ZERO, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false }, // RGB10A2 { GL_R11F_G11F_B10F, GL_ZERO, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, false }, // R11G11B10F { GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO, false }, // UnknownDepth @@ -1209,6 +1209,34 @@ namespace bgfx { namespace gl _minFilter = s_textureFilterMin[min][_hasMips ? mip+1 : 0]; } + void updateExtension(const char* _name) + { + bool supported = false; + for (uint32_t ii = 0; ii < Extension::Count; ++ii) + { + Extension& extension = s_extension[ii]; + if (!extension.m_supported + && extension.m_initialize) + { + const char* ext = _name; + if (0 == strncmp(ext, "GL_", 3) ) // skip GL_ + { + ext += 3; + } + + if (0 == strcmp(ext, extension.m_name) ) + { + extension.m_supported = true; + supported = true; + break; + } + } + } + + BX_TRACE("GL_EXTENSION %s: %s", supported ? " (supported)" : "", _name); + BX_UNUSED(supported); + } + struct RendererContextGL : public RendererContextI { RendererContextGL() @@ -1365,42 +1393,31 @@ namespace bgfx { namespace gl strncpy(name, pos, len); name[len] = '\0'; - bool supported = false; - for (uint32_t ii = 0; ii < Extension::Count; ++ii) - { - Extension& extension = s_extension[ii]; - if (!extension.m_supported - && extension.m_initialize) - { - const char* ext = name; - if (0 == strncmp(ext, "GL_", 3) ) // skip GL_ - { - ext += 3; - } - - if (0 == strcmp(ext, extension.m_name) ) - { - extension.m_supported = true; - supported = true; - break; - } - } - } - - BX_TRACE("GL_EXTENSION %3d%s: %s", index, supported ? " (supported)" : "", name); - BX_UNUSED(supported); + updateExtension(name); pos += len+1; ++index; } + } + else if (NULL != glGetStringi) + { + GLint numExtensions = 0; + glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions); + glGetError(); // ignore error if glGetIntegerv returns NULL. - BX_TRACE("Supported extensions:"); - for (uint32_t ii = 0; ii < Extension::Count; ++ii) + for (GLint index = 0; index < numExtensions; ++index) { - if (s_extension[ii].m_supported) - { - BX_TRACE("\t%2d: %s", ii, s_extension[ii].m_name); - } + const char* name = (const char*)glGetStringi(GL_EXTENSIONS, index); + updateExtension(name); + } + } + + BX_TRACE("Supported extensions:"); + for (uint32_t ii = 0; ii < Extension::Count; ++ii) + { + if (s_extension[ii].m_supported) + { + BX_TRACE("\t%2d: %s", ii, s_extension[ii].m_name); } } } @@ -1502,9 +1519,9 @@ namespace bgfx { namespace gl // internalFormat and format must match: // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml setTextureFormat(TextureFormat::RGBA8, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE); - setTextureFormat(TextureFormat::R5G6B5, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5); - setTextureFormat(TextureFormat::RGBA4, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4); - setTextureFormat(TextureFormat::RGB5A1, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1); + setTextureFormat(TextureFormat::R5G6B5, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV); + setTextureFormat(TextureFormat::RGBA4, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV); + setTextureFormat(TextureFormat::RGB5A1, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV); if (s_extension[Extension::OES_texture_half_float].m_supported || s_extension[Extension::OES_texture_float ].m_supported) @@ -2200,7 +2217,7 @@ namespace bgfx { namespace gl tc.m_sides = 0; tc.m_depth = 0; tc.m_numMips = 1; - tc.m_format = texture.m_requestedFormat; + tc.m_format = TextureFormat::Enum(texture.m_requestedFormat); tc.m_cubeMap = false; tc.m_mem = NULL; bx::write(&writer, tc); @@ -2211,6 +2228,16 @@ namespace bgfx { namespace gl release(mem); } + void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE + { + m_textures[_handle.idx].overrideInternal(_ptr); + } + + uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE + { + return uintptr_t(m_textures[_handle.idx].m_id); + } + void destroyTexture(TextureHandle _handle) BX_OVERRIDE { m_textures[_handle.idx].destroy(); @@ -2882,6 +2909,11 @@ namespace bgfx { namespace gl , m_capture ) ); + if (GL_RGBA == m_readPixelsFmt) + { + imageSwizzleBgra8(m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, m_capture, m_capture); + } + g_callback->captureFrame(m_capture, m_captureSize); } } @@ -3171,29 +3203,34 @@ namespace bgfx { namespace gl GL_CHECK(glUseProgram(program.m_id) ); program.bindAttributes(vertexDecl, 0); + float mrtClear[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS][4]; + if (BGFX_CLEAR_COLOR_USE_PALETTE & _clear.m_flags) { - float mrtClear[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS][4]; for (uint32_t ii = 0; ii < numMrt; ++ii) { uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE-1, _clear.m_index[ii]); memcpy(mrtClear[ii], _palette[index], 16); } - - GL_CHECK(glUniform4fv(0, numMrt, mrtClear[0]) ); } else { float rgba[4] = { - _clear.m_index[0]*1.0f/255.0f, - _clear.m_index[1]*1.0f/255.0f, - _clear.m_index[2]*1.0f/255.0f, - _clear.m_index[3]*1.0f/255.0f, + _clear.m_index[0] * 1.0f / 255.0f, + _clear.m_index[1] * 1.0f / 255.0f, + _clear.m_index[2] * 1.0f / 255.0f, + _clear.m_index[3] * 1.0f / 255.0f, }; - GL_CHECK(glUniform4fv(0, 1, rgba) ); + + for (uint32_t ii = 0; ii < numMrt; ++ii) + { + memcpy(mrtClear[ii], rgba, 16); + } } + GL_CHECK(glUniform4fv(0, numMrt, mrtClear[0]) ); + GL_CHECK(glDrawArrays(GL_TRIANGLE_STRIP , 0 , 4 @@ -3909,7 +3946,7 @@ namespace bgfx { namespace gl } } - bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _format, uint8_t _numMips, uint32_t _flags) + bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, uint8_t _numMips, uint32_t _flags) { m_target = _target; m_numMips = _numMips; @@ -3918,13 +3955,13 @@ namespace bgfx { namespace gl m_height = _height; m_depth = _depth; m_currentSamplerHash = UINT32_MAX; - m_requestedFormat = _format; - m_textureFormat = _format; + m_requestedFormat = + m_textureFormat = uint8_t(_format); - const bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY); + const bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY); const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE ); - if (!bufferOnly) + if (!writeOnly) { GL_CHECK(glGenTextures(1, &m_id) ); BX_CHECK(0 != m_id, "Failed to generate texture id."); @@ -3998,7 +4035,7 @@ namespace bgfx { namespace gl msaaQuality = bx::uint32_min(s_renderGL->m_maxMsaa, msaaQuality == 0 ? 0 : 1<m_num) { if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) ) diff --git a/3rdparty/bgfx/src/renderer_gl.h b/3rdparty/bgfx/src/renderer_gl.h index 34804d6b23c..06b1525fd64 100644 --- a/3rdparty/bgfx/src/renderer_gl.h +++ b/3rdparty/bgfx/src/renderer_gl.h @@ -321,6 +321,18 @@ typedef uint64_t GLuint64; # define GL_R11F_G11F_B10F 0x8C3A #endif // GL_R11F_G11F_B10F +#ifndef GL_UNSIGNED_SHORT_5_6_5_REV +# define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#endif // GL_UNSIGNED_SHORT_5_6_5_REV + +#ifndef GL_UNSIGNED_SHORT_1_5_5_5_REV +# define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#endif // GL_UNSIGNED_SHORT_1_5_5_5_REV + +#ifndef GL_UNSIGNED_SHORT_4_4_4_4_REV +# define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#endif // GL_UNSIGNED_SHORT_4_4_4_4_REV + #ifndef GL_UNSIGNED_INT_10F_11F_11F_REV # define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B #endif // GL_UNSIGNED_INT_10F_11F_11F_REV @@ -742,6 +754,10 @@ typedef uint64_t GLuint64; # define GL_FRAMEBUFFER_SRGB 0x8DB9 #endif // GL_FRAMEBUFFER_SRGB +#ifndef GL_NUM_EXTENSIONS +# define GL_NUM_EXTENSIONS 0x821D +#endif // GL_NUM_EXTENSIONS + // _KHR or _ARB... #define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 @@ -1103,9 +1119,10 @@ namespace bgfx { namespace gl { } - bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _format, uint8_t _numMips, uint32_t _flags); + bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, uint8_t _numMips, uint32_t _flags); void create(const Memory* _mem, uint32_t _flags, uint8_t _skip); void destroy(); + void overrideInternal(uintptr_t _ptr); void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); void setSamplerState(uint32_t _flags, const float _rgba[4]); void commit(uint32_t _stage, uint32_t _flags, const float _palette[][4]); diff --git a/3rdparty/bgfx/src/renderer_mtl.mm b/3rdparty/bgfx/src/renderer_mtl.mm index bb52c45b855..833a53bea0d 100644 --- a/3rdparty/bgfx/src/renderer_mtl.mm +++ b/3rdparty/bgfx/src/renderer_mtl.mm @@ -495,6 +495,7 @@ namespace bgfx { namespace mtl m_occlusionQuery.preReset(); + g_internalData.context = m_device; return true; } @@ -666,7 +667,7 @@ namespace bgfx { namespace mtl tc.m_sides = 0; tc.m_depth = 0; tc.m_numMips = 1; - tc.m_format = texture.m_requestedFormat; + tc.m_format = TextureFormat::Enum(texture.m_requestedFormat); tc.m_cubeMap = false; tc.m_mem = NULL; bx::write(&writer, tc); @@ -677,6 +678,17 @@ namespace bgfx { namespace mtl release(mem); } + void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE + { + BX_UNUSED(_handle, _ptr); + } + + uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE + { + BX_UNUSED(_handle); + return 0; + } + void destroyTexture(TextureHandle _handle) BX_OVERRIDE { m_textures[_handle.idx].destroy(); @@ -1887,7 +1899,7 @@ namespace bgfx { namespace mtl , 0 != (_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : "" ); - const bool bufferOnly = 0 != (_flags&BGFX_TEXTURE_RT_BUFFER_ONLY); + const bool writeOnly = 0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY); // const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE); // const bool renderTarget = 0 != (_flags&BGFX_TEXTURE_RT_MASK); const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb; @@ -1919,11 +1931,11 @@ namespace bgfx { namespace mtl desc.resourceOptions = MTLResourceStorageModePrivate; desc.cpuCacheMode = MTLCPUCacheModeDefaultCache; - desc.storageMode = (MTLStorageMode)(bufferOnly + desc.storageMode = (MTLStorageMode)(writeOnly ? 2 /*MTLStorageModePrivate*/ : 1 /*MTLStorageModeManaged*/ ); - desc.usage = bufferOnly + desc.usage = writeOnly ? MTLTextureUsageShaderWrite : MTLTextureUsageShaderRead ; @@ -2040,7 +2052,13 @@ namespace bgfx { namespace mtl if (convert) { temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height); - imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, m_requestedFormat); + imageDecodeToBgra8(temp + , data + , _rect.m_width + , _rect.m_height + , srcpitch + , TextureFormat::Enum(m_requestedFormat) + ); data = temp; } diff --git a/3rdparty/bgfx/src/renderer_null.cpp b/3rdparty/bgfx/src/renderer_null.cpp index 021944e15cd..a68e66f0d68 100644 --- a/3rdparty/bgfx/src/renderer_null.cpp +++ b/3rdparty/bgfx/src/renderer_null.cpp @@ -121,6 +121,15 @@ namespace bgfx { namespace noop { } + void overrideInternal(TextureHandle /*_handle*/, uintptr_t /*_ptr*/) BX_OVERRIDE + { + } + + uintptr_t getInternal(TextureHandle /*_handle*/) BX_OVERRIDE + { + return 0; + } + void destroyTexture(TextureHandle /*_handle*/) BX_OVERRIDE { } diff --git a/3rdparty/bgfx/src/shader_dx9bc.cpp b/3rdparty/bgfx/src/shader_dx9bc.cpp index 81d3dfb606a..071a9e2705e 100644 --- a/3rdparty/bgfx/src/shader_dx9bc.cpp +++ b/3rdparty/bgfx/src/shader_dx9bc.cpp @@ -722,8 +722,7 @@ namespace bgfx { bx::MemoryReader reader(_src.byteCode.data(), uint32_t(_src.byteCode.size() ) ); - bx::CrtAllocator r; - bx::MemoryBlock mb(&r); + bx::MemoryBlock mb(g_allocator); bx::MemoryWriter writer(&mb); for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;) diff --git a/3rdparty/bgfx/src/shader_dxbc.cpp b/3rdparty/bgfx/src/shader_dxbc.cpp index a1fde52f7ab..36d81842c8d 100644 --- a/3rdparty/bgfx/src/shader_dxbc.cpp +++ b/3rdparty/bgfx/src/shader_dxbc.cpp @@ -1903,8 +1903,7 @@ namespace bgfx { bx::MemoryReader reader(_src.byteCode.data(), uint32_t(_src.byteCode.size() ) ); - bx::CrtAllocator r; - bx::MemoryBlock mb(&r); + bx::MemoryBlock mb(g_allocator); bx::MemoryWriter writer(&mb); for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;) diff --git a/3rdparty/bgfx/tools/geometryc/geometryc.cpp b/3rdparty/bgfx/tools/geometryc/geometryc.cpp index 4856d71ea12..b5fc62affe2 100644 --- a/3rdparty/bgfx/tools/geometryc/geometryc.cpp +++ b/3rdparty/bgfx/tools/geometryc/geometryc.cpp @@ -811,7 +811,7 @@ int main(int _argc, const char* _argv[]) PrimitiveArray primitives; bx::CrtFileWriter writer; - if (0 != writer.open(outFilePath) ) + if (bx::open(&writer, outFilePath) ) { printf("Unable to open output file '%s'.", outFilePath); exit(EXIT_FAILURE); @@ -1000,8 +1000,8 @@ int main(int _argc, const char* _argv[]) ); } - printf("size: %d\n", uint32_t(writer.seek() ) ); - writer.close(); + printf("size: %d\n", uint32_t(bx::seek(&writer) ) ); + bx::close(&writer); delete [] indexData; delete [] vertexData; diff --git a/3rdparty/bgfx/tools/makedisttex.cpp b/3rdparty/bgfx/tools/makedisttex.cpp deleted file mode 100644 index 6bc99b5289d..00000000000 --- a/3rdparty/bgfx/tools/makedisttex.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright 2011-2016 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -#include -#include -#include -#include - -#include - -#define STB_IMAGE_IMPLEMENTATION -#include - -#define BX_NAMESPACE 1 -#include -#include -#include - -long int fsize(FILE* _file) -{ - long int pos = ftell(_file); - fseek(_file, 0L, SEEK_END); - long int size = ftell(_file); - fseek(_file, pos, SEEK_SET); - return size; -} - -void edtaa3(double* _img, uint16_t _width, uint16_t _height, double* _out) -{ - uint32_t size = _width*_height; - - short* xdist = (short*)malloc(size*sizeof(short) ); - short* ydist = (short*)malloc(size*sizeof(short) ); - double* gx = (double*)malloc(size*sizeof(double) ); - double* gy = (double*)malloc(size*sizeof(double) ); - - computegradient(_img, _width, _height, gx, gy); - edtaa3(_img, gx, gy, _width, _height, xdist, ydist, _out); - - for (uint32_t ii = 0; ii < size; ++ii) - { - if (_out[ii] < 0.0) - { - _out[ii] = 0.0; - } - } - - free(xdist); - free(ydist); - free(gx); - free(gy); -} - -void saveTga(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, bool _grayscale, const void* _data) -{ - FILE* file = fopen(_filePath, "wb"); - if ( NULL != file ) - { - uint8_t type = _grayscale ? 3 : 2; - uint8_t bpp = _grayscale ? 8 : 32; - uint8_t xorig = 0; - uint8_t yorig = 0; - - putc(0, file); - putc(0, file); - putc(type, file); - putc(0, file); - putc(0, file); - putc(0, file); - putc(0, file); - putc(0, file); - putc(0, file); - putc(xorig, file); - putc(0, file); - putc(yorig, file); - putc(_width&0xff, file); - putc( (_width>>8)&0xff, file); - putc(_height&0xff, file); - putc( (_height>>8)&0xff, file); - putc(bpp, file); - putc(32, file); - - uint32_t width = _width * bpp / 8; - uint8_t* data = (uint8_t*)_data; - for (uint32_t yy = 0; yy < _height; ++yy) - { - fwrite(data, width, 1, file); - data += _pitch; - } - - fclose(file); - } -} - -inline double min(double _a, double _b) -{ - return _a > _b ? _b : _a; -} - -inline double max(double _a, double _b) -{ - return _a > _b ? _a : _b; -} - -inline double clamp(double _val, double _min, double _max) -{ - return max(min(_val, _max), _min); -} - -inline double saturate(double _val) -{ - return clamp(_val, 0.0, 1.0); -} - -int main(int _argc, const char* _argv[]) -{ - bx::CommandLine cmdLine(_argc, _argv); - - const char* inFilePath = cmdLine.findOption('i'); - if (NULL == inFilePath) - { - fprintf(stderr, "Input file name must be specified.\n"); - return EXIT_FAILURE; - } - - const char* outFilePath = cmdLine.findOption('o'); - if (NULL == outFilePath) - { - fprintf(stderr, "Output file name must be specified.\n"); - return EXIT_FAILURE; - } - - double edge = 16.0; - const char* edgeOpt = cmdLine.findOption('e'); - if (NULL != edgeOpt) - { - edge = atof(edgeOpt); - } - - int width; - int height; - int comp; - - stbi_uc* img = stbi_load(inFilePath, &width, &height, &comp, 1); - - if (NULL == img) - { - fprintf(stderr, "Failed to load %s.\n", inFilePath); - return EXIT_FAILURE; - } - - uint32_t size = width*height; - - double* imgIn = (double*)malloc(size*sizeof(double) ); - double* outside = (double*)malloc(size*sizeof(double) ); - double* inside = (double*)malloc(size*sizeof(double) ); - - for (uint32_t ii = 0; ii < size; ++ii) - { - imgIn[ii] = double(img[ii])/255.0; - } - - edtaa3(imgIn, width, height, outside); - - for (uint32_t ii = 0; ii < size; ++ii) - { - imgIn[ii] = 1.0 - imgIn[ii]; - } - - edtaa3(imgIn, width, height, inside); - - free(imgIn); - - uint8_t* grayscale = (uint8_t*)malloc(size); - - double edgeOffset = edge*0.5; - double invEdge = 1.0/edge; - - for (uint32_t ii = 0; ii < size; ++ii) - { - double dist = saturate( ( (outside[ii] - inside[ii])+edgeOffset) * invEdge); - grayscale[ii] = 255-uint8_t(dist * 255.0); - } - - free(inside); - free(outside); - - saveTga(outFilePath, width, height, width, true, grayscale); - - free(grayscale); - - return EXIT_SUCCESS; -} diff --git a/3rdparty/bgfx/tools/shaderc/shaderc.cpp b/3rdparty/bgfx/tools/shaderc/shaderc.cpp index 4b6c7ec0ff1..915119afc91 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc.cpp +++ b/3rdparty/bgfx/tools/shaderc/shaderc.cpp @@ -4,8 +4,7 @@ */ #include "shaderc.h" - -bool g_verbose = false; +#include #define MAX_TAGS 256 extern "C" @@ -13,215 +12,124 @@ extern "C" #include } // extern "C" -#define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', 0x2) -#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x4) -#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x4) - -long int fsize(FILE* _file) -{ - long int pos = ftell(_file); - fseek(_file, 0L, SEEK_END); - long int size = ftell(_file); - fseek(_file, pos, SEEK_SET); - return size; -} - -static const char* s_ARB_shader_texture_lod[] = -{ - "texture2DLod", - "texture2DProjLod", - "texture3DLod", - "texture3DProjLod", - "textureCubeLod", - "shadow2DLod", - "shadow2DProjLod", - NULL - // "texture1DLod", - // "texture1DProjLod", - // "shadow1DLod", - // "shadow1DProjLod", -}; - -static const char* s_EXT_shadow_samplers[] = +namespace bgfx { - "shadow2D", - "shadow2DProj", - "sampler2DShadow", - NULL -}; + bool g_verbose = false; -static const char* s_OES_standard_derivatives[] = -{ - "dFdx", - "dFdy", - "fwidth", - NULL -}; + #define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', 0x2) + #define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x4) + #define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x4) -static const char* s_OES_texture_3D[] = -{ - "texture3D", - "texture3DProj", - "texture3DLod", - "texture3DProjLod", - NULL -}; - -static const char* s_130[] = -{ - "uint", - "uint2", - "uint3", - "uint4", - "isampler3D", - "usampler3D", - NULL -}; - -const char* s_uniformTypeName[UniformType::Count] = -{ - "int", - NULL, - "vec4", - "mat3", - "mat4", -}; - -const char* interpolationDx11(const char* _glsl) -{ - if (0 == strcmp(_glsl, "smooth") ) - { - return "linear"; - } - else if (0 == strcmp(_glsl, "flat") ) + long int fsize(FILE* _file) { - return "nointerpolation"; + long int pos = ftell(_file); + fseek(_file, 0L, SEEK_END); + long int size = ftell(_file); + fseek(_file, pos, SEEK_SET); + return size; } - return _glsl; // noperspective -} - -const char* getUniformTypeName(UniformType::Enum _enum) -{ - return s_uniformTypeName[_enum]; -} - -UniformType::Enum nameToUniformTypeEnum(const char* _name) -{ - for (uint32_t ii = 0; ii < UniformType::Count; ++ii) + static const char* s_ARB_shader_texture_lod[] = { - if (NULL != s_uniformTypeName[ii] - && 0 == strcmp(_name, s_uniformTypeName[ii]) ) - { - return UniformType::Enum(ii); - } - } - - return UniformType::Count; -} - -int32_t writef(bx::WriterI* _writer, const char* _format, ...) -{ - va_list argList; - va_start(argList, _format); - - char temp[2048]; - - char* out = temp; - int32_t max = sizeof(temp); - int32_t len = bx::vsnprintf(out, max, _format, argList); - if (len > max) + "texture2DLod", + "texture2DProjLod", + "texture3DLod", + "texture3DProjLod", + "textureCubeLod", + "shadow2DLod", + "shadow2DProjLod", + NULL + // "texture1DLod", + // "texture1DProjLod", + // "shadow1DLod", + // "shadow1DProjLod", + }; + + static const char* s_EXT_shadow_samplers[] = { - out = (char*)alloca(len); - len = bx::vsnprintf(out, len, _format, argList); - } - - len = bx::write(_writer, out, len); - - va_end(argList); + "shadow2D", + "shadow2DProj", + "sampler2DShadow", + NULL + }; - return len; -} - -class Bin2cWriter : public bx::CrtFileWriter -{ -public: - Bin2cWriter(const char* _name) - : m_name(_name) + static const char* s_OES_standard_derivatives[] = { - } + "dFdx", + "dFdy", + "fwidth", + NULL + }; - virtual ~Bin2cWriter() + static const char* s_OES_texture_3D[] = { - } - - virtual int32_t close() BX_OVERRIDE + "texture3D", + "texture3DProj", + "texture3DLod", + "texture3DProjLod", + NULL + }; + + static const char* s_130[] = + { + "uint", + "uint2", + "uint3", + "uint4", + "isampler3D", + "usampler3D", + NULL + }; + + const char* s_uniformTypeName[UniformType::Count] = + { + "int", + NULL, + "vec4", + "mat3", + "mat4", + }; + + const char* interpolationDx11(const char* _glsl) { - generate(); - return bx::CrtFileWriter::close(); + if (0 == strcmp(_glsl, "smooth") ) + { + return "linear"; + } + else if (0 == strcmp(_glsl, "flat") ) + { + return "nointerpolation"; + } + + return _glsl; // noperspective } - virtual int32_t write(const void* _data, int32_t _size) BX_OVERRIDE + const char* getUniformTypeName(UniformType::Enum _enum) { - const char* data = (const char*)_data; - m_buffer.insert(m_buffer.end(), data, data+_size); - return _size; + return s_uniformTypeName[_enum]; } -private: - void generate() + UniformType::Enum nameToUniformTypeEnum(const char* _name) { -#define HEX_DUMP_WIDTH 16 -#define HEX_DUMP_SPACE_WIDTH 96 -#define HEX_DUMP_FORMAT "%-" BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "." BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "s" - const uint8_t* data = &m_buffer[0]; - uint32_t size = (uint32_t)m_buffer.size(); - - outf("static const uint8_t %s[%d] =\n{\n", m_name.c_str(), size); - - if (NULL != data) + for (uint32_t ii = 0; ii < UniformType::Count; ++ii) { - char hex[HEX_DUMP_SPACE_WIDTH+1]; - char ascii[HEX_DUMP_WIDTH+1]; - uint32_t hexPos = 0; - uint32_t asciiPos = 0; - for (uint32_t ii = 0; ii < size; ++ii) - { - bx::snprintf(&hex[hexPos], sizeof(hex)-hexPos, "0x%02x, ", data[asciiPos]); - hexPos += 6; - - ascii[asciiPos] = isprint(data[asciiPos]) && data[asciiPos] != '\\' ? data[asciiPos] : '.'; - asciiPos++; - - if (HEX_DUMP_WIDTH == asciiPos) - { - ascii[asciiPos] = '\0'; - outf("\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); - data += asciiPos; - hexPos = 0; - asciiPos = 0; - } - } - - if (0 != asciiPos) + if (NULL != s_uniformTypeName[ii] + && 0 == strcmp(_name, s_uniformTypeName[ii]) ) { - ascii[asciiPos] = '\0'; - outf("\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); + return UniformType::Enum(ii); } } - outf("};\n"); -#undef HEX_DUMP_WIDTH -#undef HEX_DUMP_SPACE_WIDTH -#undef HEX_DUMP_FORMAT + return UniformType::Count; } - int32_t outf(const char* _format, ...) + int32_t writef(bx::WriterI* _writer, const char* _format, ...) { va_list argList; va_start(argList, _format); char temp[2048]; + char* out = temp; int32_t max = sizeof(temp); int32_t len = bx::vsnprintf(out, max, _format, argList); @@ -231,1365 +139,1252 @@ private: len = bx::vsnprintf(out, len, _format, argList); } - int32_t size = bx::CrtFileWriter::write(out, len); + len = bx::write(_writer, out, len); va_end(argList); - return size; + return len; } - std::string m_filePath; - std::string m_name; - typedef std::vector Buffer; - Buffer m_buffer; -}; - -struct Varying -{ - std::string m_precision; - std::string m_interpolation; - std::string m_name; - std::string m_type; - std::string m_init; - std::string m_semantics; -}; - -typedef std::unordered_map VaryingMap; - -class File -{ -public: - File(const char* _filePath) - : m_data(NULL) + class Bin2cWriter : public bx::CrtFileWriter { - FILE* file = fopen(_filePath, "r"); - if (NULL != file) + public: + Bin2cWriter(const char* _name) + : m_name(_name) { - m_size = fsize(file); - m_data = new char[m_size+1]; - m_size = (uint32_t)fread(m_data, 1, m_size, file); - m_data[m_size] = '\0'; - fclose(file); } - } - - ~File() - { - delete [] m_data; - } - const char* getData() const - { - return m_data; - } + virtual ~Bin2cWriter() + { + } - uint32_t getSize() const - { - return m_size; - } + virtual void close() BX_OVERRIDE + { + generate(); + return bx::CrtFileWriter::close(); + } -private: - char* m_data; - uint32_t m_size; -}; + virtual int32_t write(const void* _data, int32_t _size, bx::Error*) BX_OVERRIDE + { + const char* data = (const char*)_data; + m_buffer.insert(m_buffer.end(), data, data+_size); + return _size; + } -void strInsert(char* _str, const char* _insert) -{ - size_t len = strlen(_insert); - memmove(&_str[len], _str, strlen(_str) ); - memcpy(_str, _insert, len); -} + private: + void generate() + { +#define HEX_DUMP_WIDTH 16 +#define HEX_DUMP_SPACE_WIDTH 96 +#define HEX_DUMP_FORMAT "%-" BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "." BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "s" + const uint8_t* data = &m_buffer[0]; + uint32_t size = (uint32_t)m_buffer.size(); -void strReplace(char* _str, const char* _find, const char* _replace) -{ - const size_t len = strlen(_find); + outf("static const uint8_t %s[%d] =\n{\n", m_name.c_str(), size); - char* replace = (char*)alloca(len+1); - bx::strlcpy(replace, _replace, len+1); - for (size_t ii = strlen(replace); ii < len; ++ii) - { - replace[ii] = ' '; - } - replace[len] = '\0'; + if (NULL != data) + { + char hex[HEX_DUMP_SPACE_WIDTH+1]; + char ascii[HEX_DUMP_WIDTH+1]; + uint32_t hexPos = 0; + uint32_t asciiPos = 0; + for (uint32_t ii = 0; ii < size; ++ii) + { + bx::snprintf(&hex[hexPos], sizeof(hex)-hexPos, "0x%02x, ", data[asciiPos]); + hexPos += 6; - BX_CHECK(len >= strlen(_replace), ""); - for (char* ptr = strstr(_str, _find); NULL != ptr; ptr = strstr(ptr + len, _find) ) - { - memcpy(ptr, replace, len); - } -} + ascii[asciiPos] = isprint(data[asciiPos]) && data[asciiPos] != '\\' ? data[asciiPos] : '.'; + asciiPos++; -void strNormalizeEol(char* _str) -{ - strReplace(_str, "\r\n", "\n"); - strReplace(_str, "\r", "\n"); -} + if (HEX_DUMP_WIDTH == asciiPos) + { + ascii[asciiPos] = '\0'; + outf("\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); + data += asciiPos; + hexPos = 0; + asciiPos = 0; + } + } -void printCode(const char* _code, int32_t _line, int32_t _start, int32_t _end) -{ - fprintf(stderr, "Code:\n---\n"); + if (0 != asciiPos) + { + ascii[asciiPos] = '\0'; + outf("\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); + } + } - LineReader lr(_code); - for (int32_t line = 1; !lr.isEof() && line < _end; ++line) - { - if (line >= _start) - { - fprintf(stderr, "%s%3d: %s", _line == line ? ">>> " : " ", line, lr.getLine().c_str() ); - } - else - { - lr.skipLine(); + outf("};\n"); +#undef HEX_DUMP_WIDTH +#undef HEX_DUMP_SPACE_WIDTH +#undef HEX_DUMP_FORMAT } - } - - fprintf(stderr, "---\n"); -} -void writeFile(const char* _filePath, const void* _data, int32_t _size) -{ - bx::CrtFileWriter out; - if (0 == out.open(_filePath) ) - { - out.write(_data, _size); - out.close(); - } -} + int32_t outf(const char* _format, ...) + { + va_list argList; + va_start(argList, _format); + + char temp[2048]; + char* out = temp; + int32_t max = sizeof(temp); + int32_t len = bx::vsnprintf(out, max, _format, argList); + if (len > max) + { + out = (char*)alloca(len); + len = bx::vsnprintf(out, len, _format, argList); + } -struct Preprocessor -{ - Preprocessor(const char* _filePath, bool _gles, const char* _includeDir = NULL) - : m_tagptr(m_tags) - , m_scratchPos(0) - , m_fgetsPos(0) - { - m_tagptr->tag = FPPTAG_USERDATA; - m_tagptr->data = this; - m_tagptr++; + bx::Error err; + int32_t size = bx::CrtFileWriter::write(out, len, &err); - m_tagptr->tag = FPPTAG_DEPENDS; - m_tagptr->data = (void*)fppDepends; - m_tagptr++; + va_end(argList); - m_tagptr->tag = FPPTAG_INPUT; - m_tagptr->data = (void*)fppInput; - m_tagptr++; + return size; + } - m_tagptr->tag = FPPTAG_OUTPUT; - m_tagptr->data = (void*)fppOutput; - m_tagptr++; + std::string m_filePath; + std::string m_name; + typedef std::vector Buffer; + Buffer m_buffer; + }; - m_tagptr->tag = FPPTAG_ERROR; - m_tagptr->data = (void*)fppError; - m_tagptr++; + struct Varying + { + std::string m_precision; + std::string m_interpolation; + std::string m_name; + std::string m_type; + std::string m_init; + std::string m_semantics; + }; - m_tagptr->tag = FPPTAG_IGNOREVERSION; - m_tagptr->data = (void*)0; - m_tagptr++; + typedef std::unordered_map VaryingMap; - m_tagptr->tag = FPPTAG_LINE; - m_tagptr->data = (void*)0; - m_tagptr++; + class File + { + public: + File(const char* _filePath) + : m_data(NULL) + { + FILE* file = fopen(_filePath, "r"); + if (NULL != file) + { + m_size = fsize(file); + m_data = new char[m_size+1]; + m_size = (uint32_t)fread(m_data, 1, m_size, file); + m_data[m_size] = '\0'; + fclose(file); + } + } - m_tagptr->tag = FPPTAG_INPUT_NAME; - m_tagptr->data = scratch(_filePath); - m_tagptr++; + ~File() + { + delete [] m_data; + } - if (NULL != _includeDir) + const char* getData() const { - addInclude(_includeDir); + return m_data; } - if (!_gles) + uint32_t getSize() const { - m_default = "#define lowp\n#define mediump\n#define highp\n"; + return m_size; } - } - void setDefine(const char* _define) + private: + char* m_data; + uint32_t m_size; + }; + + void strInsert(char* _str, const char* _insert) { - m_tagptr->tag = FPPTAG_DEFINE; - m_tagptr->data = scratch(_define); - m_tagptr++; + size_t len = strlen(_insert); + memmove(&_str[len], _str, strlen(_str) ); + memcpy(_str, _insert, len); } - void setDefaultDefine(const char* _name) + void strReplace(char* _str, const char* _find, const char* _replace) { - char temp[1024]; - bx::snprintf(temp, BX_COUNTOF(temp) - , "#ifndef %s\n" - "# define %s 0\n" - "#endif // %s\n" - "\n" - , _name - , _name - , _name - ); + const size_t len = strlen(_find); + + char* replace = (char*)alloca(len+1); + bx::strlcpy(replace, _replace, len+1); + for (size_t ii = strlen(replace); ii < len; ++ii) + { + replace[ii] = ' '; + } + replace[len] = '\0'; - m_default += temp; + BX_CHECK(len >= strlen(_replace), ""); + for (char* ptr = strstr(_str, _find); NULL != ptr; ptr = strstr(ptr + len, _find) ) + { + memcpy(ptr, replace, len); + } } - void writef(const char* _format, ...) + void strNormalizeEol(char* _str) { - va_list argList; - va_start(argList, _format); - bx::stringPrintfVargs(m_default, _format, argList); - va_end(argList); + strReplace(_str, "\r\n", "\n"); + strReplace(_str, "\r", "\n"); } - void addInclude(const char* _includeDir) + void printCode(const char* _code, int32_t _line, int32_t _start, int32_t _end) { - char* start = scratch(_includeDir); + fprintf(stderr, "Code:\n---\n"); - for (char* split = strchr(start, ';'); NULL != split; split = strchr(start, ';')) + LineReader lr(_code); + for (int32_t line = 1; !lr.isEof() && line < _end; ++line) { - *split = '\0'; - m_tagptr->tag = FPPTAG_INCLUDE_DIR; - m_tagptr->data = start; - m_tagptr++; - start = split + 1; + if (line >= _start) + { + fprintf(stderr, "%s%3d: %s", _line == line ? ">>> " : " ", line, lr.getLine().c_str() ); + } + else + { + lr.skipLine(); + } } - m_tagptr->tag = FPPTAG_INCLUDE_DIR; - m_tagptr->data = start; - m_tagptr++; + fprintf(stderr, "---\n"); } - void addDependency(const char* _fileName) + void writeFile(const char* _filePath, const void* _data, int32_t _size) { - m_depends += " \\\n "; - m_depends += _fileName; + bx::CrtFileWriter out; + if (bx::open(&out, _filePath) ) + { + bx::write(&out, _data, _size); + bx::close(&out); + } } - bool run(const char* _input) + struct Preprocessor { - m_fgetsPos = 0; + Preprocessor(const char* _filePath, bool _gles, const char* _includeDir = NULL) + : m_tagptr(m_tags) + , m_scratchPos(0) + , m_fgetsPos(0) + { + m_tagptr->tag = FPPTAG_USERDATA; + m_tagptr->data = this; + m_tagptr++; - m_preprocessed.clear(); - m_input = m_default; - m_input += "\n\n"; + m_tagptr->tag = FPPTAG_DEPENDS; + m_tagptr->data = (void*)fppDepends; + m_tagptr++; - size_t len = strlen(_input)+1; - char* temp = new char[len]; - bx::eolLF(temp, len, _input); - m_input += temp; - delete [] temp; + m_tagptr->tag = FPPTAG_INPUT; + m_tagptr->data = (void*)fppInput; + m_tagptr++; - fppTag* tagptr = m_tagptr; + m_tagptr->tag = FPPTAG_OUTPUT; + m_tagptr->data = (void*)fppOutput; + m_tagptr++; - tagptr->tag = FPPTAG_END; - tagptr->data = 0; - tagptr++; + m_tagptr->tag = FPPTAG_ERROR; + m_tagptr->data = (void*)fppError; + m_tagptr++; - int result = fppPreProcess(m_tags); + m_tagptr->tag = FPPTAG_IGNOREVERSION; + m_tagptr->data = (void*)0; + m_tagptr++; - return 0 == result; - } + m_tagptr->tag = FPPTAG_LINE; + m_tagptr->data = (void*)0; + m_tagptr++; - char* fgets(char* _buffer, int _size) - { - int ii = 0; - for (char ch = m_input[m_fgetsPos]; m_fgetsPos < m_input.size() && ii < _size-1; ch = m_input[++m_fgetsPos]) - { - _buffer[ii++] = ch; + m_tagptr->tag = FPPTAG_INPUT_NAME; + m_tagptr->data = scratch(_filePath); + m_tagptr++; + + if (NULL != _includeDir) + { + addInclude(_includeDir); + } - if (ch == '\n' || ii == _size) + if (!_gles) { - _buffer[ii] = '\0'; - m_fgetsPos++; - return _buffer; + m_default = "#define lowp\n#define mediump\n#define highp\n"; } } - return NULL; - } + void setDefine(const char* _define) + { + m_tagptr->tag = FPPTAG_DEFINE; + m_tagptr->data = scratch(_define); + m_tagptr++; + } - static void fppDepends(char* _fileName, void* _userData) - { - Preprocessor* thisClass = (Preprocessor*)_userData; - thisClass->addDependency(_fileName); - } + void setDefaultDefine(const char* _name) + { + char temp[1024]; + bx::snprintf(temp, BX_COUNTOF(temp) + , "#ifndef %s\n" + "# define %s 0\n" + "#endif // %s\n" + "\n" + , _name + , _name + , _name + ); + + m_default += temp; + } - static char* fppInput(char* _buffer, int _size, void* _userData) - { - Preprocessor* thisClass = (Preprocessor*)_userData; - return thisClass->fgets(_buffer, _size); - } + void writef(const char* _format, ...) + { + va_list argList; + va_start(argList, _format); + bx::stringPrintfVargs(m_default, _format, argList); + va_end(argList); + } - static void fppOutput(int _ch, void* _userData) - { - Preprocessor* thisClass = (Preprocessor*)_userData; - thisClass->m_preprocessed += _ch; - } + void addInclude(const char* _includeDir) + { + char* start = scratch(_includeDir); - static void fppError(void* /*_userData*/, char* _format, va_list _vargs) - { - vfprintf(stderr, _format, _vargs); - } + for (char* split = strchr(start, ';'); NULL != split; split = strchr(start, ';') ) + { + *split = '\0'; + m_tagptr->tag = FPPTAG_INCLUDE_DIR; + m_tagptr->data = start; + m_tagptr++; + start = split + 1; + } - char* scratch(const char* _str) - { - char* result = &m_scratch[m_scratchPos]; - strcpy(result, _str); - m_scratchPos += (uint32_t)strlen(_str)+1; + m_tagptr->tag = FPPTAG_INCLUDE_DIR; + m_tagptr->data = start; + m_tagptr++; + } - return result; - } + void addDependency(const char* _fileName) + { + m_depends += " \\\n "; + m_depends += _fileName; + } - fppTag m_tags[MAX_TAGS]; - fppTag* m_tagptr; + bool run(const char* _input) + { + m_fgetsPos = 0; - std::string m_depends; - std::string m_default; - std::string m_input; - std::string m_preprocessed; - char m_scratch[16<<10]; - uint32_t m_scratchPos; - uint32_t m_fgetsPos; -}; + m_preprocessed.clear(); + m_input = m_default; + m_input += "\n\n"; -typedef std::vector InOut; + size_t len = strlen(_input)+1; + char* temp = new char[len]; + bx::eolLF(temp, len, _input); + m_input += temp; + delete [] temp; -uint32_t parseInOut(InOut& _inout, const char* _str, const char* _eol) -{ - uint32_t hash = 0; - _str = bx::strws(_str); + fppTag* tagptr = m_tagptr; - if (_str < _eol) - { - const char* delim; - do + tagptr->tag = FPPTAG_END; + tagptr->data = 0; + tagptr++; + + int result = fppPreProcess(m_tags); + + return 0 == result; + } + + char* fgets(char* _buffer, int _size) { - delim = strpbrk(_str, " ,"); - if (NULL != delim) + int ii = 0; + for (char ch = m_input[m_fgetsPos]; m_fgetsPos < m_input.size() && ii < _size-1; ch = m_input[++m_fgetsPos]) { - delim = delim > _eol ? _eol : delim; - std::string token; - token.assign(_str, delim-_str); - _inout.push_back(token); - _str = bx::strws(delim + 1); + _buffer[ii++] = ch; + + if (ch == '\n' || ii == _size) + { + _buffer[ii] = '\0'; + m_fgetsPos++; + return _buffer; + } } + + return NULL; } - while (delim < _eol && _str < _eol && NULL != delim); - std::sort(_inout.begin(), _inout.end() ); + static void fppDepends(char* _fileName, void* _userData) + { + Preprocessor* thisClass = (Preprocessor*)_userData; + thisClass->addDependency(_fileName); + } - bx::HashMurmur2A murmur; - murmur.begin(); - for (InOut::const_iterator it = _inout.begin(), itEnd = _inout.end(); it != itEnd; ++it) + static char* fppInput(char* _buffer, int _size, void* _userData) { - murmur.add(it->c_str(), (uint32_t)it->size() ); + Preprocessor* thisClass = (Preprocessor*)_userData; + return thisClass->fgets(_buffer, _size); } - hash = murmur.end(); - } - return hash; -} + static void fppOutput(int _ch, void* _userData) + { + Preprocessor* thisClass = (Preprocessor*)_userData; + thisClass->m_preprocessed += _ch; + } -void addFragData(Preprocessor& _preprocessor, char* _data, uint32_t _idx, bool _comma) -{ - char find[32]; - bx::snprintf(find, sizeof(find), "gl_FragData[%d]", _idx); + static void fppError(void* /*_userData*/, char* _format, va_list _vargs) + { + vfprintf(stderr, _format, _vargs); + } - char replace[32]; - bx::snprintf(replace, sizeof(replace), "gl_FragData_%d_", _idx); + char* scratch(const char* _str) + { + char* result = &m_scratch[m_scratchPos]; + strcpy(result, _str); + m_scratchPos += (uint32_t)strlen(_str)+1; - strReplace(_data, find, replace); + return result; + } - _preprocessor.writef( - " \\\n\t%sout vec4 gl_FragData_%d_ : SV_TARGET%d" - , _comma ? ", " : " " - , _idx - , _idx - ); -} + fppTag m_tags[MAX_TAGS]; + fppTag* m_tagptr; -void voidFragData(char* _data, uint32_t _idx) -{ - char find[32]; - bx::snprintf(find, sizeof(find), "gl_FragData[%d]", _idx); + std::string m_depends; + std::string m_default; + std::string m_input; + std::string m_preprocessed; + char m_scratch[16<<10]; + uint32_t m_scratchPos; + uint32_t m_fgetsPos; + }; - strReplace(_data, find, "bgfx_VoidFrag"); -} + typedef std::vector InOut; -// c - compute -// d - domain -// f - fragment -// g - geometry -// h - hull -// v - vertex -// -// OpenGL #version Features Direct3D Features Shader Model -// 2.1 120 vf 9.0 vf 2.0 -// 3.0 130 -// 3.1 140 -// 3.2 150 vgf -// 3.3 330 10.0 vgf 4.0 -// 4.0 400 vhdgf -// 4.1 410 -// 4.2 420 11.0 vhdgf+c 5.0 -// 4.3 430 vhdgf+c -// 4.4 440 - -void help(const char* _error = NULL) -{ - if (NULL != _error) + uint32_t parseInOut(InOut& _inout, const char* _str, const char* _eol) { - fprintf(stderr, "Error:\n%s\n\n", _error); - } + uint32_t hash = 0; + _str = bx::strws(_str); - fprintf(stderr - , "shaderc, bgfx shader compiler tool\n" - "Copyright 2011-2016 Branimir Karadzic. All rights reserved.\n" - "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n" - ); - - fprintf(stderr - , "Usage: shaderc -f -o --type --platform \n" - - "\n" - "Options:\n" - " -f Input file path.\n" - " -i Include path (for multiple paths use semicolon).\n" - " -o Output file path.\n" - " --bin2c Generate C header file.\n" - " --depends Generate makefile style depends file.\n" - " --platform Target platform.\n" - " android\n" - " asm.js\n" - " ios\n" - " linux\n" - " nacl\n" - " osx\n" - " windows\n" - " --preprocess Preprocess only.\n" - " --raw Do not process shader. No preprocessor, and no glsl-optimizer (GLSL only).\n" - " --type Shader type (vertex, fragment)\n" - " --varyingdef Path to varying.def.sc file.\n" - " --verbose Verbose.\n" - - "\n" - "Options (DX9 and DX11 only):\n" - - "\n" - " --debug Debug information.\n" - " --disasm Disassemble compiled shader.\n" - " -p, --profile Shader model (f.e. ps_3_0).\n" - " -O Optimization level (0, 1, 2, 3).\n" - " --Werror Treat warnings as errors.\n" - - "\n" - "For additional information, see https://github.com/bkaradzic/bgfx\n" - ); -} - -int main(int _argc, const char* _argv[]) -{ - bx::CommandLine cmdLine(_argc, _argv); + if (_str < _eol) + { + const char* delim; + do + { + delim = strpbrk(_str, " ,"); + if (NULL != delim) + { + delim = delim > _eol ? _eol : delim; + std::string token; + token.assign(_str, delim-_str); + _inout.push_back(token); + _str = bx::strws(delim + 1); + } + } + while (delim < _eol && _str < _eol && NULL != delim); - if (cmdLine.hasArg('h', "help") ) - { - help(); - return EXIT_FAILURE; - } + std::sort(_inout.begin(), _inout.end() ); - g_verbose = cmdLine.hasArg("verbose"); + bx::HashMurmur2A murmur; + murmur.begin(); + for (InOut::const_iterator it = _inout.begin(), itEnd = _inout.end(); it != itEnd; ++it) + { + murmur.add(it->c_str(), (uint32_t)it->size() ); + } + hash = murmur.end(); + } - const char* filePath = cmdLine.findOption('f'); - if (NULL == filePath) - { - help("Shader file name must be specified."); - return EXIT_FAILURE; + return hash; } - const char* outFilePath = cmdLine.findOption('o'); - if (NULL == outFilePath) + void addFragData(Preprocessor& _preprocessor, char* _data, uint32_t _idx, bool _comma) { - help("Output file name must be specified."); - return EXIT_FAILURE; - } + char find[32]; + bx::snprintf(find, sizeof(find), "gl_FragData[%d]", _idx); - const char* type = cmdLine.findOption('\0', "type"); - if (NULL == type) - { - help("Must specify shader type."); - return EXIT_FAILURE; + char replace[32]; + bx::snprintf(replace, sizeof(replace), "gl_FragData_%d_", _idx); + + strReplace(_data, find, replace); + + _preprocessor.writef( + " \\\n\t%sout vec4 gl_FragData_%d_ : SV_TARGET%d" + , _comma ? ", " : " " + , _idx + , _idx + ); } - const char* platform = cmdLine.findOption('\0', "platform"); - if (NULL == platform) + void voidFragData(char* _data, uint32_t _idx) { - help("Must specify platform."); - return EXIT_FAILURE; - } + char find[32]; + bx::snprintf(find, sizeof(find), "gl_FragData[%d]", _idx); - bool raw = cmdLine.hasArg('\0', "raw"); + strReplace(_data, find, "bgfx_VoidFrag"); + } - uint32_t glsl = 0; - uint32_t essl = 0; - uint32_t hlsl = 2; - uint32_t d3d = 11; - uint32_t metal = 0; - const char* profile = cmdLine.findOption('p', "profile"); - if (NULL != profile) + // c - compute + // d - domain + // f - fragment + // g - geometry + // h - hull + // v - vertex + // + // OpenGL #version Features Direct3D Features Shader Model + // 2.1 120 vf 9.0 vf 2.0 + // 3.0 130 + // 3.1 140 + // 3.2 150 vgf + // 3.3 330 10.0 vgf 4.0 + // 4.0 400 vhdgf + // 4.1 410 + // 4.2 420 11.0 vhdgf+c 5.0 + // 4.3 430 vhdgf+c + // 4.4 440 + + void help(const char* _error = NULL) { - if (0 == strncmp(&profile[1], "s_4_0_level", 11) ) + if (NULL != _error) { - hlsl = 2; + fprintf(stderr, "Error:\n%s\n\n", _error); } - else if (0 == strncmp(&profile[1], "s_3", 3) ) - { - hlsl = 3; - d3d = 9; - } - else if (0 == strncmp(&profile[1], "s_4", 3) ) - { - hlsl = 4; - } - else if (0 == strncmp(&profile[1], "s_5", 3) ) - { - hlsl = 5; - } - else if (0 == strcmp(profile, "metal") ) - { - metal = 1; - } - else - { - glsl = atoi(profile); - } - } - else - { - essl = 2; - } - - const char* bin2c = NULL; - if (cmdLine.hasArg("bin2c") ) - { - bin2c = cmdLine.findOption("bin2c"); - if (NULL == bin2c) - { - bin2c = bx::baseName(outFilePath); - uint32_t len = (uint32_t)strlen(bin2c); - char* temp = (char*)alloca(len+1); - for (char *out = temp; *bin2c != '\0';) - { - char ch = *bin2c++; - if (isalnum(ch) ) - { - *out++ = ch; - } - else - { - *out++ = '_'; - } - } - temp[len] = '\0'; - bin2c = temp; - } - } + fprintf(stderr + , "shaderc, bgfx shader compiler tool\n" + "Copyright 2011-2016 Branimir Karadzic. All rights reserved.\n" + "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n" + ); - bool depends = cmdLine.hasArg("depends"); - bool preprocessOnly = cmdLine.hasArg("preprocess"); - const char* includeDir = cmdLine.findOption('i'); + fprintf(stderr + , "Usage: shaderc -f -o --type --platform \n" - Preprocessor preprocessor(filePath, 0 != essl, includeDir); + "\n" + "Options:\n" + " -f Input file path.\n" + " -i Include path (for multiple paths use semicolon).\n" + " -o Output file path.\n" + " --bin2c Generate C header file.\n" + " --depends Generate makefile style depends file.\n" + " --platform Target platform.\n" + " android\n" + " asm.js\n" + " ios\n" + " linux\n" + " nacl\n" + " osx\n" + " windows\n" + " --preprocess Preprocess only.\n" + " --define Add defines to preprocessor (semicolon separated).\n" + " --raw Do not process shader. No preprocessor, and no glsl-optimizer (GLSL only).\n" + " --type Shader type (vertex, fragment)\n" + " --varyingdef Path to varying.def.sc file.\n" + " --verbose Verbose.\n" - std::string dir; - { - const char* base = bx::baseName(filePath); + "\n" + "Options (DX9 and DX11 only):\n" - if (base != filePath) - { - dir.assign(filePath, base-filePath); - preprocessor.addInclude(dir.c_str() ); - } - } + "\n" + " --debug Debug information.\n" + " --disasm Disassemble compiled shader.\n" + " -p, --profile Shader model (f.e. ps_3_0).\n" + " -O Optimization level (0, 1, 2, 3).\n" + " --Werror Treat warnings as errors.\n" - preprocessor.setDefaultDefine("BX_PLATFORM_ANDROID"); - preprocessor.setDefaultDefine("BX_PLATFORM_EMSCRIPTEN"); - preprocessor.setDefaultDefine("BX_PLATFORM_IOS"); - preprocessor.setDefaultDefine("BX_PLATFORM_LINUX"); - preprocessor.setDefaultDefine("BX_PLATFORM_NACL"); - preprocessor.setDefaultDefine("BX_PLATFORM_OSX"); - preprocessor.setDefaultDefine("BX_PLATFORM_WINDOWS"); - preprocessor.setDefaultDefine("BX_PLATFORM_XBOX360"); -// preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_ESSL"); - preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_GLSL"); - preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_HLSL"); - preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_METAL"); - preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_COMPUTE"); - preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_FRAGMENT"); - preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_VERTEX"); - - char glslDefine[128]; - bx::snprintf(glslDefine, BX_COUNTOF(glslDefine), "BGFX_SHADER_LANGUAGE_GLSL=%d", essl ? 1 : glsl); - - if (0 == bx::stricmp(platform, "android") ) - { - preprocessor.setDefine("BX_PLATFORM_ANDROID=1"); - preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); - } - else if (0 == bx::stricmp(platform, "asm.js") ) - { - preprocessor.setDefine("BX_PLATFORM_EMSCRIPTEN=1"); - preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); - } - else if (0 == bx::stricmp(platform, "ios") ) - { - preprocessor.setDefine("BX_PLATFORM_IOS=1"); - preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); - } - else if (0 == bx::stricmp(platform, "linux") ) - { - preprocessor.setDefine("BX_PLATFORM_LINUX=1"); - preprocessor.setDefine(glslDefine); - } - else if (0 == bx::stricmp(platform, "nacl") ) - { - preprocessor.setDefine("BX_PLATFORM_NACL=1"); - preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); - } - else if (0 == bx::stricmp(platform, "osx") ) - { - preprocessor.setDefine("BX_PLATFORM_OSX=1"); - preprocessor.setDefine(glslDefine); - char temp[256]; - bx::snprintf(temp, sizeof(temp), "BGFX_SHADER_LANGUAGE_METAL=%d", metal); - preprocessor.setDefine(temp); - } - else if (0 == bx::stricmp(platform, "windows") ) - { - preprocessor.setDefine("BX_PLATFORM_WINDOWS=1"); - char temp[256]; - bx::snprintf(temp, sizeof(temp), "BGFX_SHADER_LANGUAGE_HLSL=%d", hlsl); - preprocessor.setDefine(temp); - } - else if (0 == bx::stricmp(platform, "xbox360") ) - { - preprocessor.setDefine("BX_PLATFORM_XBOX360=1"); - preprocessor.setDefine("BGFX_SHADER_LANGUAGE_HLSL=3"); - } - else - { - fprintf(stderr, "Unknown platform %s?!", platform); - return EXIT_FAILURE; + "\n" + "For additional information, see https://github.com/bkaradzic/bgfx\n" + ); } - preprocessor.setDefine("M_PI=3.1415926535897932384626433832795"); - - char shaderType = tolower(type[0]); - switch (shaderType) + int compileShader(int _argc, const char* _argv[]) { - case 'c': - preprocessor.setDefine("BGFX_SHADER_TYPE_COMPUTE=1"); - break; + bx::CommandLine cmdLine(_argc, _argv); - case 'f': - preprocessor.setDefine("BGFX_SHADER_TYPE_FRAGMENT=1"); - break; + if (cmdLine.hasArg('h', "help") ) + { + help(); + return EXIT_FAILURE; + } - case 'v': - preprocessor.setDefine("BGFX_SHADER_TYPE_VERTEX=1"); - break; + g_verbose = cmdLine.hasArg("verbose"); - default: - fprintf(stderr, "Unknown type: %s?!", type); - return EXIT_FAILURE; - } + const char* filePath = cmdLine.findOption('f'); + if (NULL == filePath) + { + help("Shader file name must be specified."); + return EXIT_FAILURE; + } - bool compiled = false; + const char* outFilePath = cmdLine.findOption('o'); + if (NULL == outFilePath) + { + help("Output file name must be specified."); + return EXIT_FAILURE; + } - FILE* file = fopen(filePath, "r"); - if (NULL == file) - { - fprintf(stderr, "Unable to open file '%s'.\n", filePath); - } - else - { - VaryingMap varyingMap; - - std::string defaultVarying = dir + "varying.def.sc"; - const char* varyingdef = cmdLine.findOption("varyingdef", defaultVarying.c_str() ); - File attribdef(varyingdef); - const char* parse = attribdef.getData(); - if (NULL != parse - && *parse != '\0') + const char* type = cmdLine.findOption('\0', "type"); + if (NULL == type) { - preprocessor.addDependency(varyingdef); + help("Must specify shader type."); + return EXIT_FAILURE; } - else + + const char* platform = cmdLine.findOption('\0', "platform"); + if (NULL == platform) { - fprintf(stderr, "ERROR: Failed to parse varying def file: \"%s\" No input/output semantics will be generated in the code!\n", varyingdef); + help("Must specify platform."); + return EXIT_FAILURE; } - while (NULL != parse - && *parse != '\0') + bool raw = cmdLine.hasArg('\0', "raw"); + + uint32_t glsl = 0; + uint32_t essl = 0; + uint32_t hlsl = 2; + uint32_t d3d = 11; + uint32_t metal = 0; + const char* profile = cmdLine.findOption('p', "profile"); + if (NULL != profile) { - parse = bx::strws(parse); - const char* eol = strchr(parse, ';'); - if (NULL == eol) + if (0 == strncmp(&profile[1], "s_4_0_level", 11) ) { - eol = bx::streol(parse); + hlsl = 2; } - - if (NULL != eol) + else if (0 == strncmp(&profile[1], "s_3", 3) ) { - const char* precision = NULL; - const char* interpolation = NULL; - const char* typen = parse; - - if (0 == strncmp(typen, "lowp", 4) - || 0 == strncmp(typen, "mediump", 7) - || 0 == strncmp(typen, "highp", 5) ) - { - precision = typen; - typen = parse = bx::strws(bx::strword(parse) ); - } - - if (0 == strncmp(typen, "flat", 4) - || 0 == strncmp(typen, "smooth", 6) - || 0 == strncmp(typen, "noperspective", 13) ) - { - interpolation = typen; - typen = parse = bx::strws(bx::strword(parse) ); - } + hlsl = 3; + d3d = 9; + } + else if (0 == strncmp(&profile[1], "s_4", 3) ) + { + hlsl = 4; + } + else if (0 == strncmp(&profile[1], "s_5", 3) ) + { + hlsl = 5; + } + else if (0 == strcmp(profile, "metal") ) + { + metal = 1; + } + else + { + glsl = atoi(profile); + } + } + else + { + essl = 2; + } - const char* name = parse = bx::strws(bx::strword(parse) ); - const char* column = parse = bx::strws(bx::strword(parse) ); - const char* semantics = parse = bx::strws((*parse == ':' ? ++parse : parse)); - const char* assign = parse = bx::strws(bx::strword(parse) ); - const char* init = parse = bx::strws((*parse == '=' ? ++parse : parse)); - - if (typen < eol - && name < eol - && column < eol - && ':' == *column - && semantics < eol) + const char* bin2c = NULL; + if (cmdLine.hasArg("bin2c") ) + { + bin2c = cmdLine.findOption("bin2c"); + if (NULL == bin2c) + { + bin2c = bx::baseName(outFilePath); + uint32_t len = (uint32_t)strlen(bin2c); + char* temp = (char*)alloca(len+1); + for (char *out = temp; *bin2c != '\0';) { - Varying var; - if (NULL != precision) - { - var.m_precision.assign(precision, bx::strword(precision)-precision); - } - - if (NULL != interpolation) + char ch = *bin2c++; + if (isalnum(ch) ) { - var.m_interpolation.assign(interpolation, bx::strword(interpolation)-interpolation); + *out++ = ch; } - - var.m_type.assign(typen, bx::strword(typen)-typen); - var.m_name.assign(name, bx::strword(name)-name); - var.m_semantics.assign(semantics, bx::strword(semantics)-semantics); - - if (d3d == 9 - && var.m_semantics == "BITANGENT") + else { - var.m_semantics = "BINORMAL"; + *out++ = '_'; } - - if (assign < eol - && '=' == *assign - && init < eol) - { - var.m_init.assign(init, eol-init); - } - - varyingMap.insert(std::make_pair(var.m_name, var) ); } + temp[len] = '\0'; - parse = bx::strws(bx::strnl(eol) ); + bin2c = temp; } } - InOut shaderInputs; - InOut shaderOutputs; - uint32_t inputHash = 0; - uint32_t outputHash = 0; + bool depends = cmdLine.hasArg("depends"); + bool preprocessOnly = cmdLine.hasArg("preprocess"); + const char* includeDir = cmdLine.findOption('i'); - char* data; - char* input; - { - const size_t padding = 1024; - uint32_t size = (uint32_t)fsize(file); - data = new char[size+padding+1]; - size = (uint32_t)fread(data, 1, size, file); - // Compiler generates "error X3000: syntax error: unexpected end of file" - // if input doesn't have empty line at EOF. - data[size] = '\n'; - memset(&data[size+1], 0, padding); - fclose(file); - - strNormalizeEol(data); - - input = const_cast(bx::strws(data) ); - while (input[0] == '$') - { - const char* str = bx::strws(input+1); - const char* eol = bx::streol(str); - const char* nl = bx::strnl(eol); - input = const_cast(nl); + Preprocessor preprocessor(filePath, 0 != essl, includeDir); - if (0 == strncmp(str, "input", 5) ) - { - str += 5; - const char* comment = strstr(str, "//"); - eol = NULL != comment && comment < eol ? comment : eol; - inputHash = parseInOut(shaderInputs, str, eol); - } - else if (0 == strncmp(str, "output", 6) ) - { - str += 6; - const char* comment = strstr(str, "//"); - eol = NULL != comment && comment < eol ? comment : eol; - outputHash = parseInOut(shaderOutputs, str, eol); - } - else if (0 == strncmp(str, "raw", 3) ) - { - raw = true; - str += 3; - } + std::string dir; + { + const char* base = bx::baseName(filePath); - input = const_cast(bx::strws(input) ); + if (base != filePath) + { + dir.assign(filePath, base-filePath); + preprocessor.addInclude(dir.c_str() ); } + } - if (!raw) + const char* defines = cmdLine.findOption("define"); + while (NULL != defines + && '\0' != *defines) + { + defines = bx::strws(defines); + const char* eol = strchr(defines, ';'); + if (NULL == eol) { - // To avoid commented code being recognized as used feature, - // first preprocess pass is used to strip all comments before - // substituting code. - preprocessor.run(input); - delete [] data; - - size = (uint32_t)preprocessor.m_preprocessed.size(); - data = new char[size+padding+1]; - memcpy(data, preprocessor.m_preprocessed.c_str(), size); - memset(&data[size], 0, padding+1); - input = data; + eol = defines + strlen(defines); } + std::string define(defines, eol); + preprocessor.setDefine(define.c_str() ); + defines = ';' == *eol ? eol+1 : eol; } - if (raw) + preprocessor.setDefaultDefine("BX_PLATFORM_ANDROID"); + preprocessor.setDefaultDefine("BX_PLATFORM_EMSCRIPTEN"); + preprocessor.setDefaultDefine("BX_PLATFORM_IOS"); + preprocessor.setDefaultDefine("BX_PLATFORM_LINUX"); + preprocessor.setDefaultDefine("BX_PLATFORM_NACL"); + preprocessor.setDefaultDefine("BX_PLATFORM_OSX"); + preprocessor.setDefaultDefine("BX_PLATFORM_WINDOWS"); + preprocessor.setDefaultDefine("BX_PLATFORM_XBOX360"); + // preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_ESSL"); + preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_GLSL"); + preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_HLSL"); + preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_METAL"); + preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_COMPUTE"); + preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_FRAGMENT"); + preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_VERTEX"); + + char glslDefine[128]; + bx::snprintf(glslDefine, BX_COUNTOF(glslDefine), "BGFX_SHADER_LANGUAGE_GLSL=%d", essl ? 1 : glsl); + + if (0 == bx::stricmp(platform, "android") ) + { + preprocessor.setDefine("BX_PLATFORM_ANDROID=1"); + preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); + } + else if (0 == bx::stricmp(platform, "asm.js") ) { - bx::CrtFileWriter* writer = NULL; + preprocessor.setDefine("BX_PLATFORM_EMSCRIPTEN=1"); + preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); + } + else if (0 == bx::stricmp(platform, "ios") ) + { + preprocessor.setDefine("BX_PLATFORM_IOS=1"); + preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); + } + else if (0 == bx::stricmp(platform, "linux") ) + { + preprocessor.setDefine("BX_PLATFORM_LINUX=1"); + preprocessor.setDefine(glslDefine); + } + else if (0 == bx::stricmp(platform, "nacl") ) + { + preprocessor.setDefine("BX_PLATFORM_NACL=1"); + preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1"); + } + else if (0 == bx::stricmp(platform, "osx") ) + { + preprocessor.setDefine("BX_PLATFORM_OSX=1"); + preprocessor.setDefine(glslDefine); + char temp[256]; + bx::snprintf(temp, sizeof(temp), "BGFX_SHADER_LANGUAGE_METAL=%d", metal); + preprocessor.setDefine(temp); + } + else if (0 == bx::stricmp(platform, "windows") ) + { + preprocessor.setDefine("BX_PLATFORM_WINDOWS=1"); + char temp[256]; + bx::snprintf(temp, sizeof(temp), "BGFX_SHADER_LANGUAGE_HLSL=%d", hlsl); + preprocessor.setDefine(temp); + } + else if (0 == bx::stricmp(platform, "xbox360") ) + { + preprocessor.setDefine("BX_PLATFORM_XBOX360=1"); + preprocessor.setDefine("BGFX_SHADER_LANGUAGE_HLSL=3"); + } + else + { + fprintf(stderr, "Unknown platform %s?!", platform); + return EXIT_FAILURE; + } - if (NULL != bin2c) - { - writer = new Bin2cWriter(bin2c); - } - else - { - writer = new bx::CrtFileWriter; - } + preprocessor.setDefine("M_PI=3.1415926535897932384626433832795"); - if (0 != writer->open(outFilePath) ) - { - fprintf(stderr, "Unable to open output file '%s'.", outFilePath); - return EXIT_FAILURE; - } + char shaderType = tolower(type[0]); + switch (shaderType) + { + case 'c': + preprocessor.setDefine("BGFX_SHADER_TYPE_COMPUTE=1"); + break; - if ('f' == shaderType) - { - bx::write(writer, BGFX_CHUNK_MAGIC_FSH); - bx::write(writer, inputHash); - } - else if ('v' == shaderType) - { - bx::write(writer, BGFX_CHUNK_MAGIC_VSH); - bx::write(writer, outputHash); - } - else - { - bx::write(writer, BGFX_CHUNK_MAGIC_CSH); - bx::write(writer, outputHash); - } + case 'f': + preprocessor.setDefine("BGFX_SHADER_TYPE_FRAGMENT=1"); + break; - if (0 != glsl) - { - bx::write(writer, uint16_t(0) ); + case 'v': + preprocessor.setDefine("BGFX_SHADER_TYPE_VERTEX=1"); + break; - uint32_t shaderSize = (uint32_t)strlen(input); - bx::write(writer, shaderSize); - bx::write(writer, input, shaderSize); - bx::write(writer, uint8_t(0) ); + default: + fprintf(stderr, "Unknown type: %s?!", type); + return EXIT_FAILURE; + } - compiled = true; - } - else - { - compiled = compileHLSLShader(cmdLine, d3d, input, writer); - } + bool compiled = false; - writer->close(); - delete writer; + FILE* file = fopen(filePath, "r"); + if (NULL == file) + { + fprintf(stderr, "Unable to open file '%s'.\n", filePath); } - else if ('c' == shaderType) // Compute + else { - char* entry = strstr(input, "void main()"); - if (NULL == entry) + VaryingMap varyingMap; + + std::string defaultVarying = dir + "varying.def.sc"; + const char* varyingdef = cmdLine.findOption("varyingdef", defaultVarying.c_str() ); + File attribdef(varyingdef); + const char* parse = attribdef.getData(); + if (NULL != parse + && *parse != '\0') { - fprintf(stderr, "Shader entry point 'void main()' is not found.\n"); + preprocessor.addDependency(varyingdef); } else { - if (0 != glsl - || 0 != essl - || 0 != metal) + fprintf(stderr, "ERROR: Failed to parse varying def file: \"%s\" No input/output semantics will be generated in the code!\n", varyingdef); + } + + while (NULL != parse + && *parse != '\0') + { + parse = bx::strws(parse); + const char* eol = strchr(parse, ';'); + if (NULL == eol) { + eol = bx::streol(parse); } - else + + if (NULL != eol) { - preprocessor.writef( - "#define lowp\n" - "#define mediump\n" - "#define highp\n" - "#define ivec2 int2\n" - "#define ivec3 int3\n" - "#define ivec4 int4\n" - "#define uvec2 uint2\n" - "#define uvec3 uint3\n" - "#define uvec4 uint4\n" - "#define vec2 float2\n" - "#define vec3 float3\n" - "#define vec4 float4\n" - "#define mat2 float2x2\n" - "#define mat3 float3x3\n" - "#define mat4 float4x4\n" - ); - - entry[4] = '_'; - - preprocessor.writef("#define void_main()"); - preprocessor.writef(" \\\n\tvoid main("); - - uint32_t arg = 0; - - const bool hasLocalInvocationID = NULL != strstr(input, "gl_LocalInvocationID"); - const bool hasLocalInvocationIndex = NULL != strstr(input, "gl_LocalInvocationIndex"); - const bool hasGlobalInvocationID = NULL != strstr(input, "gl_GlobalInvocationID"); - const bool hasWorkGroupID = NULL != strstr(input, "gl_WorkGroupID"); - - if (hasLocalInvocationID) - { - preprocessor.writef( - " \\\n\t%sint3 gl_LocalInvocationID : SV_GroupThreadID" - , arg++ > 0 ? ", " : " " - ); - } + const char* precision = NULL; + const char* interpolation = NULL; + const char* typen = parse; - if (hasLocalInvocationIndex) + if (0 == strncmp(typen, "lowp", 4) + || 0 == strncmp(typen, "mediump", 7) + || 0 == strncmp(typen, "highp", 5) ) { - preprocessor.writef( - " \\\n\t%sint gl_LocalInvocationIndex : SV_GroupIndex" - , arg++ > 0 ? ", " : " " - ); + precision = typen; + typen = parse = bx::strws(bx::strword(parse) ); } - if (hasGlobalInvocationID) + if (0 == strncmp(typen, "flat", 4) + || 0 == strncmp(typen, "smooth", 6) + || 0 == strncmp(typen, "noperspective", 13) ) { - preprocessor.writef( - " \\\n\t%sint3 gl_GlobalInvocationID : SV_DispatchThreadID" - , arg++ > 0 ? ", " : " " - ); + interpolation = typen; + typen = parse = bx::strws(bx::strword(parse) ); } - if (hasWorkGroupID) + const char* name = parse = bx::strws(bx::strword(parse) ); + const char* column = parse = bx::strws(bx::strword(parse) ); + const char* semantics = parse = bx::strws( (*parse == ':' ? ++parse : parse) ); + const char* assign = parse = bx::strws(bx::strword(parse) ); + const char* init = parse = bx::strws( (*parse == '=' ? ++parse : parse) ); + + if (typen < eol + && name < eol + && column < eol + && ':' == *column + && semantics < eol) { - preprocessor.writef( - " \\\n\t%sint3 gl_WorkGroupID : SV_GroupID" - , arg++ > 0 ? ", " : " " - ); - } - - preprocessor.writef( - " \\\n\t)\n" - ); - } - - if (preprocessor.run(input) ) - { - BX_TRACE("Input file: %s", filePath); - BX_TRACE("Output file: %s", outFilePath); - - if (preprocessOnly) - { - bx::CrtFileWriter writer; - - if (0 != writer.open(outFilePath) ) + Varying var; + if (NULL != precision) { - fprintf(stderr, "Unable to open output file '%s'.", outFilePath); - return EXIT_FAILURE; + var.m_precision.assign(precision, bx::strword(precision)-precision); } - writer.write(preprocessor.m_preprocessed.c_str(), (int32_t)preprocessor.m_preprocessed.size() ); - writer.close(); - - return EXIT_SUCCESS; - } - - { - bx::CrtFileWriter* writer = NULL; - - if (NULL != bin2c) + if (NULL != interpolation) { - writer = new Bin2cWriter(bin2c); + var.m_interpolation.assign(interpolation, bx::strword(interpolation)-interpolation); } - else + + var.m_type.assign(typen, bx::strword(typen)-typen); + var.m_name.assign(name, bx::strword(name)-name); + var.m_semantics.assign(semantics, bx::strword(semantics)-semantics); + + if (d3d == 9 + && var.m_semantics == "BITANGENT") { - writer = new bx::CrtFileWriter; + var.m_semantics = "BINORMAL"; } - if (0 != writer->open(outFilePath) ) + if (assign < eol + && '=' == *assign + && init < eol) { - fprintf(stderr, "Unable to open output file '%s'.", outFilePath); - return EXIT_FAILURE; + var.m_init.assign(init, eol-init); } - bx::write(writer, BGFX_CHUNK_MAGIC_CSH); - bx::write(writer, outputHash); + varyingMap.insert(std::make_pair(var.m_name, var) ); + } - if (0 != glsl - || 0 != essl) - { - std::string code; + parse = bx::strws(bx::strnl(eol) ); + } + } - if (essl) - { - bx::stringPrintf(code, "#version 310 es\n"); - } - else - { - bx::stringPrintf(code, "#version %d\n", glsl == 0 ? 430 : glsl); - } + InOut shaderInputs; + InOut shaderOutputs; + uint32_t inputHash = 0; + uint32_t outputHash = 0; - code += preprocessor.m_preprocessed; -#if 1 - bx::write(writer, uint16_t(0) ); + char* data; + char* input; + { + const size_t padding = 1024; + uint32_t size = (uint32_t)fsize(file); + data = new char[size+padding+1]; + size = (uint32_t)fread(data, 1, size, file); + // Compiler generates "error X3000: syntax error: unexpected end of file" + // if input doesn't have empty line at EOF. + data[size] = '\n'; + memset(&data[size+1], 0, padding); + fclose(file); - uint32_t shaderSize = (uint32_t)code.size(); - bx::write(writer, shaderSize); - bx::write(writer, code.c_str(), shaderSize); - bx::write(writer, uint8_t(0) ); + strNormalizeEol(data); - compiled = true; -#else - compiled = compileGLSLShader(cmdLine, essl, code, writer); -#endif // 0 - } - else - { - compiled = compileHLSLShader(cmdLine, d3d, preprocessor.m_preprocessed, writer); - } + input = const_cast(bx::strws(data) ); + while (input[0] == '$') + { + const char* str = bx::strws(input+1); + const char* eol = bx::streol(str); + const char* nl = bx::strnl(eol); + input = const_cast(nl); - writer->close(); - delete writer; + if (0 == strncmp(str, "input", 5) ) + { + str += 5; + const char* comment = strstr(str, "//"); + eol = NULL != comment && comment < eol ? comment : eol; + inputHash = parseInOut(shaderInputs, str, eol); } - - if (compiled) + else if (0 == strncmp(str, "output", 6) ) { - if (depends) - { - std::string ofp = outFilePath; - ofp += ".d"; - bx::CrtFileWriter writer; - if (0 == writer.open(ofp.c_str() ) ) - { - writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() ); - writer.close(); - } - } + str += 6; + const char* comment = strstr(str, "//"); + eol = NULL != comment && comment < eol ? comment : eol; + outputHash = parseInOut(shaderOutputs, str, eol); + } + else if (0 == strncmp(str, "raw", 3) ) + { + raw = true; + str += 3; } + + input = const_cast(bx::strws(input) ); + } + + if (!raw) + { + // To avoid commented code being recognized as used feature, + // first preprocess pass is used to strip all comments before + // substituting code. + preprocessor.run(input); + delete [] data; + + size = (uint32_t)preprocessor.m_preprocessed.size(); + data = new char[size+padding+1]; + memcpy(data, preprocessor.m_preprocessed.c_str(), size); + memset(&data[size], 0, padding+1); + input = data; } } - } - else // Vertex/Fragment - { - char* entry = strstr(input, "void main()"); - if (NULL == entry) + + if (raw) { - fprintf(stderr, "Shader entry point 'void main()' is not found.\n"); + bx::CrtFileWriter* writer = NULL; + + if (NULL != bin2c) + { + writer = new Bin2cWriter(bin2c); + } + else + { + writer = new bx::CrtFileWriter; + } + + if (!bx::open(writer, outFilePath) ) + { + fprintf(stderr, "Unable to open output file '%s'.", outFilePath); + return EXIT_FAILURE; + } + + if ('f' == shaderType) + { + bx::write(writer, BGFX_CHUNK_MAGIC_FSH); + bx::write(writer, inputHash); + } + else if ('v' == shaderType) + { + bx::write(writer, BGFX_CHUNK_MAGIC_VSH); + bx::write(writer, outputHash); + } + else + { + bx::write(writer, BGFX_CHUNK_MAGIC_CSH); + bx::write(writer, outputHash); + } + + if (0 != glsl) + { + bx::write(writer, uint16_t(0) ); + + uint32_t shaderSize = (uint32_t)strlen(input); + bx::write(writer, shaderSize); + bx::write(writer, input, shaderSize); + bx::write(writer, uint8_t(0) ); + + compiled = true; + } + else + { + compiled = compileHLSLShader(cmdLine, d3d, input, writer); + } + + bx::close(writer); + delete writer; } - else + else if ('c' == shaderType) // Compute { - if (0 != glsl - || 0 != essl - || 0 != metal) + char* entry = strstr(input, "void main()"); + if (NULL == entry) { - if (120 == glsl - || 0 != essl) + fprintf(stderr, "Shader entry point 'void main()' is not found.\n"); + } + else + { + if (0 != glsl + || 0 != essl + || 0 != metal) { - preprocessor.writef( - "#define ivec2 vec2\n" - "#define ivec3 vec3\n" - "#define ivec4 vec4\n" - ); } - - if (0 == essl) + else { - // bgfx shadow2D/Proj behave like EXT_shadow_samplers - // not as GLSL language 1.2 specs shadow2D/Proj. preprocessor.writef( - "#define shadow2D(_sampler, _coord) bgfxShadow2D(_sampler, _coord).x\n" - "#define shadow2DProj(_sampler, _coord) bgfxShadow2DProj(_sampler, _coord).x\n" + "#define lowp\n" + "#define mediump\n" + "#define highp\n" + "#define ivec2 int2\n" + "#define ivec3 int3\n" + "#define ivec4 int4\n" + "#define uvec2 uint2\n" + "#define uvec3 uint3\n" + "#define uvec4 uint4\n" + "#define vec2 float2\n" + "#define vec3 float3\n" + "#define vec4 float4\n" + "#define mat2 float2x2\n" + "#define mat3 float3x3\n" + "#define mat4 float4x4\n" ); - } - for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it) - { - VaryingMap::const_iterator varyingIt = varyingMap.find(*it); - if (varyingIt != varyingMap.end() ) - { - const Varying& var = varyingIt->second; - const char* name = var.m_name.c_str(); + entry[4] = '_'; - if (0 == strncmp(name, "a_", 2) - || 0 == strncmp(name, "i_", 2) ) - { - preprocessor.writef("attribute %s %s %s %s;\n" - , var.m_precision.c_str() - , var.m_interpolation.c_str() - , var.m_type.c_str() - , name - ); - } - else - { - preprocessor.writef("%s varying %s %s %s;\n" - , var.m_interpolation.c_str() - , var.m_precision.c_str() - , var.m_type.c_str() - , name - ); - } - } - } + preprocessor.writef("#define void_main()"); + preprocessor.writef(" \\\n\tvoid main("); - for (InOut::const_iterator it = shaderOutputs.begin(), itEnd = shaderOutputs.end(); it != itEnd; ++it) - { - VaryingMap::const_iterator varyingIt = varyingMap.find(*it); - if (varyingIt != varyingMap.end() ) + uint32_t arg = 0; + + const bool hasLocalInvocationID = NULL != strstr(input, "gl_LocalInvocationID"); + const bool hasLocalInvocationIndex = NULL != strstr(input, "gl_LocalInvocationIndex"); + const bool hasGlobalInvocationID = NULL != strstr(input, "gl_GlobalInvocationID"); + const bool hasWorkGroupID = NULL != strstr(input, "gl_WorkGroupID"); + + if (hasLocalInvocationID) { - const Varying& var = varyingIt->second; - preprocessor.writef("%s varying %s %s;\n" - , var.m_interpolation.c_str() - , var.m_type.c_str() - , var.m_name.c_str() + preprocessor.writef( + " \\\n\t%sint3 gl_LocalInvocationID : SV_GroupThreadID" + , arg++ > 0 ? ", " : " " ); } - } - } - else - { - preprocessor.writef( - "#define lowp\n" - "#define mediump\n" - "#define highp\n" - "#define ivec2 int2\n" - "#define ivec3 int3\n" - "#define ivec4 int4\n" - "#define uvec2 uint2\n" - "#define uvec3 uint3\n" - "#define uvec4 uint4\n" - "#define vec2 float2\n" - "#define vec3 float3\n" - "#define vec4 float4\n" - "#define mat2 float2x2\n" - "#define mat3 float3x3\n" - "#define mat4 float4x4\n" - ); - - if (hlsl < 4) - { - preprocessor.writef( - "#define flat\n" - "#define smooth\n" - "#define noperspective\n" - ); - } - - entry[4] = '_'; - if ('f' == shaderType) - { - const char* brace = strstr(entry, "{"); - if (NULL != brace) + if (hasLocalInvocationIndex) { - strInsert(const_cast(brace+1), "\nvec4 bgfx_VoidFrag;\n"); + preprocessor.writef( + " \\\n\t%sint gl_LocalInvocationIndex : SV_GroupIndex" + , arg++ > 0 ? ", " : " " + ); } - const bool hasFragCoord = NULL != strstr(input, "gl_FragCoord") || hlsl > 3 || hlsl == 2; - const bool hasFragDepth = NULL != strstr(input, "gl_FragDepth"); - const bool hasFrontFacing = NULL != strstr(input, "gl_FrontFacing"); - const bool hasPrimitiveId = NULL != strstr(input, "gl_PrimitiveID"); - - bool hasFragData[8] = {}; - uint32_t numFragData = 0; - for (uint32_t ii = 0; ii < BX_COUNTOF(hasFragData); ++ii) + if (hasGlobalInvocationID) { - char temp[32]; - bx::snprintf(temp, BX_COUNTOF(temp), "gl_FragData[%d]", ii); - hasFragData[ii] = NULL != strstr(input, temp); - numFragData += hasFragData[ii]; + preprocessor.writef( + " \\\n\t%sint3 gl_GlobalInvocationID : SV_DispatchThreadID" + , arg++ > 0 ? ", " : " " + ); } - if (0 == numFragData) + if (hasWorkGroupID) { - // GL errors when both gl_FragColor and gl_FragData is used. - // This will trigger the same error with HLSL compiler too. - preprocessor.writef("#define gl_FragColor gl_FragData_0_\n"); + preprocessor.writef( + " \\\n\t%sint3 gl_WorkGroupID : SV_GroupID" + , arg++ > 0 ? ", " : " " + ); } - preprocessor.writef("#define void_main()"); - preprocessor.writef(" \\\n\tvoid main("); + preprocessor.writef( + " \\\n\t)\n" + ); + } - uint32_t arg = 0; + if (preprocessor.run(input) ) + { + BX_TRACE("Input file: %s", filePath); + BX_TRACE("Output file: %s", outFilePath); - if (hasFragCoord) + if (preprocessOnly) { - preprocessor.writef(" \\\n\tvec4 gl_FragCoord : SV_POSITION"); - ++arg; - } + bx::CrtFileWriter writer; - for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it) - { - VaryingMap::const_iterator varyingIt = varyingMap.find(*it); - if (varyingIt != varyingMap.end() ) + if (!bx::open(&writer, outFilePath) ) { - const Varying& var = varyingIt->second; - preprocessor.writef(" \\\n\t%s%s %s %s : %s" - , arg++ > 0 ? ", " : " " - , interpolationDx11(var.m_interpolation.c_str() ) - , var.m_type.c_str() - , var.m_name.c_str() - , var.m_semantics.c_str() - ); + fprintf(stderr, "Unable to open output file '%s'.", outFilePath); + return EXIT_FAILURE; } - } - addFragData(preprocessor, input, 0, arg++ > 0); + bx::write(&writer, preprocessor.m_preprocessed.c_str(), (int32_t)preprocessor.m_preprocessed.size() ); + bx::close(&writer); - const uint32_t maxRT = d3d > 9 ? BX_COUNTOF(hasFragData) : 4; + return EXIT_SUCCESS; + } - for (uint32_t ii = 1; ii < BX_COUNTOF(hasFragData); ++ii) { - if (ii < maxRT) + bx::CrtFileWriter* writer = NULL; + + if (NULL != bin2c) { - if (hasFragData[ii]) - { - addFragData(preprocessor, input, ii, arg++ > 0); - } + writer = new Bin2cWriter(bin2c); } else { - voidFragData(input, ii); + writer = new bx::CrtFileWriter; } - } - if (hasFragDepth) - { - preprocessor.writef( - " \\\n\t%sout float gl_FragDepth : SV_DEPTH" - , arg++ > 0 ? ", " : " " - ); - } + if (!bx::open(writer, outFilePath) ) + { + fprintf(stderr, "Unable to open output file '%s'.", outFilePath); + return EXIT_FAILURE; + } - if (hasFrontFacing - && hlsl >= 3) - { - preprocessor.writef( - " \\\n\t%sfloat __vface : VFACE" - , arg++ > 0 ? ", " : " " - ); - } + bx::write(writer, BGFX_CHUNK_MAGIC_CSH); + bx::write(writer, outputHash); - if (hasPrimitiveId) - { - if (d3d > 9) + if (0 != glsl + || 0 != essl) { - preprocessor.writef( - " \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID" - , arg++ > 0 ? ", " : " " - ); + std::string code; + + if (essl) + { + bx::stringPrintf(code, "#version 310 es\n"); + } + else + { + bx::stringPrintf(code, "#version %d\n", glsl == 0 ? 430 : glsl); + } + + code += preprocessor.m_preprocessed; + #if 1 + bx::write(writer, uint16_t(0) ); + + uint32_t shaderSize = (uint32_t)code.size(); + bx::write(writer, shaderSize); + bx::write(writer, code.c_str(), shaderSize); + bx::write(writer, uint8_t(0) ); + + compiled = true; + #else + compiled = compileGLSLShader(cmdLine, essl, code, writer); + #endif // 0 } else { - fprintf(stderr, "PrimitiveID builtin is not supported by this D3D9 HLSL.\n"); - return EXIT_FAILURE; + compiled = compileHLSLShader(cmdLine, d3d, preprocessor.m_preprocessed, writer); } - } - preprocessor.writef( - " \\\n\t)\n" - ); + bx::close(writer); + delete writer; + } - if (hasFrontFacing) + if (compiled) { - if (hlsl >= 3) + if (depends) { - preprocessor.writef( - "#define gl_FrontFacing (__vface <= 0.0)\n" - ); - } - else - { - preprocessor.writef( - "#define gl_FrontFacing false\n" - ); + std::string ofp = outFilePath; + ofp += ".d"; + bx::CrtFileWriter writer; + if (bx::open(&writer, ofp.c_str() ) ) + { + writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() ); + bx::close(&writer); + } } } } - else if ('v' == shaderType) + } + } + else // Vertex/Fragment + { + char* entry = strstr(input, "void main()"); + if (NULL == entry) + { + fprintf(stderr, "Shader entry point 'void main()' is not found.\n"); + } + else + { + if (0 != glsl + || 0 != essl + || 0 != metal) { - const char* brace = strstr(entry, "{"); - if (NULL != brace) + if (120 == glsl + || 0 != essl) { - const char* end = bx::strmb(brace, '{', '}'); - if (NULL != end) - { - strInsert(const_cast(end), "__RETURN__;\n"); - } + preprocessor.writef( + "#define ivec2 vec2\n" + "#define ivec3 vec3\n" + "#define ivec4 vec4\n" + ); } - preprocessor.writef( - "struct Output\n" - "{\n" - "\tvec4 gl_Position : SV_POSITION;\n" - "#define gl_Position _varying_.gl_Position\n" - ); - for (InOut::const_iterator it = shaderOutputs.begin(), itEnd = shaderOutputs.end(); it != itEnd; ++it) + if (0 == essl) { - VaryingMap::const_iterator varyingIt = varyingMap.find(*it); - if (varyingIt != varyingMap.end() ) - { - const Varying& var = varyingIt->second; - preprocessor.writef("\t%s %s : %s;\n", var.m_type.c_str(), var.m_name.c_str(), var.m_semantics.c_str() ); - preprocessor.writef("#define %s _varying_.%s\n", var.m_name.c_str(), var.m_name.c_str() ); - } + // bgfx shadow2D/Proj behave like EXT_shadow_samplers + // not as GLSL language 1.2 specs shadow2D/Proj. + preprocessor.writef( + "#define shadow2D(_sampler, _coord) bgfxShadow2D(_sampler, _coord).x\n" + "#define shadow2DProj(_sampler, _coord) bgfxShadow2DProj(_sampler, _coord).x\n" + ); } - preprocessor.writef( - "};\n" - ); - preprocessor.writef("#define void_main() \\\n"); - preprocessor.writef("Output main("); - bool first = true; for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it) { VaryingMap::const_iterator varyingIt = varyingMap.find(*it); if (varyingIt != varyingMap.end() ) { const Varying& var = varyingIt->second; - preprocessor.writef("%s%s %s : %s\\\n", first ? "" : "\t, ", var.m_type.c_str(), var.m_name.c_str(), var.m_semantics.c_str() ); - first = false; + const char* name = var.m_name.c_str(); + + if (0 == strncmp(name, "a_", 2) + || 0 == strncmp(name, "i_", 2) ) + { + preprocessor.writef("attribute %s %s %s %s;\n" + , var.m_precision.c_str() + , var.m_interpolation.c_str() + , var.m_type.c_str() + , name + ); + } + else + { + preprocessor.writef("%s varying %s %s %s;\n" + , var.m_interpolation.c_str() + , var.m_precision.c_str() + , var.m_type.c_str() + , name + ); + } } } - preprocessor.writef( - ") \\\n" - "{ \\\n" - "\tOutput _varying_;" - ); for (InOut::const_iterator it = shaderOutputs.begin(), itEnd = shaderOutputs.end(); it != itEnd; ++it) { @@ -1597,218 +1392,450 @@ int main(int _argc, const char* _argv[]) if (varyingIt != varyingMap.end() ) { const Varying& var = varyingIt->second; - preprocessor.writef(" \\\n\t%s", var.m_name.c_str() ); - if (!var.m_init.empty() ) - { - preprocessor.writef(" = %s", var.m_init.c_str() ); - } - preprocessor.writef(";"); + preprocessor.writef("%s varying %s %s;\n" + , var.m_interpolation.c_str() + , var.m_type.c_str() + , var.m_name.c_str() + ); } } - - preprocessor.writef( - "\n#define __RETURN__ \\\n" - "\t} \\\n" - "\treturn _varying_" - ); } - } - - if (preprocessor.run(input) ) - { - BX_TRACE("Input file: %s", filePath); - BX_TRACE("Output file: %s", outFilePath); - - if (preprocessOnly) + else { - bx::CrtFileWriter writer; + preprocessor.writef( + "#define lowp\n" + "#define mediump\n" + "#define highp\n" + "#define ivec2 int2\n" + "#define ivec3 int3\n" + "#define ivec4 int4\n" + "#define uvec2 uint2\n" + "#define uvec3 uint3\n" + "#define uvec4 uint4\n" + "#define vec2 float2\n" + "#define vec3 float3\n" + "#define vec4 float4\n" + "#define mat2 float2x2\n" + "#define mat3 float3x3\n" + "#define mat4 float4x4\n" + ); - if (0 != writer.open(outFilePath) ) + if (hlsl < 4) { - fprintf(stderr, "Unable to open output file '%s'.", outFilePath); - return EXIT_FAILURE; + preprocessor.writef( + "#define flat\n" + "#define smooth\n" + "#define noperspective\n" + ); } - if (0 != glsl) + entry[4] = '_'; + + if ('f' == shaderType) { - if (NULL == profile) + const char* brace = strstr(entry, "{"); + if (NULL != brace) { - writef(&writer - , "#ifdef GL_ES\n" - "precision highp float;\n" - "#endif // GL_ES\n\n" - ); + strInsert(const_cast(brace+1), "\nvec4 bgfx_VoidFrag;\n"); } - } - writer.write(preprocessor.m_preprocessed.c_str(), (int32_t)preprocessor.m_preprocessed.size() ); - writer.close(); - return EXIT_SUCCESS; - } - - { - bx::CrtFileWriter* writer = NULL; + const bool hasFragCoord = NULL != strstr(input, "gl_FragCoord") || hlsl > 3 || hlsl == 2; + const bool hasFragDepth = NULL != strstr(input, "gl_FragDepth"); + const bool hasFrontFacing = NULL != strstr(input, "gl_FrontFacing"); + const bool hasPrimitiveId = NULL != strstr(input, "gl_PrimitiveID"); - if (NULL != bin2c) - { - writer = new Bin2cWriter(bin2c); - } - else - { - writer = new bx::CrtFileWriter; - } + bool hasFragData[8] = {}; + uint32_t numFragData = 0; + for (uint32_t ii = 0; ii < BX_COUNTOF(hasFragData); ++ii) + { + char temp[32]; + bx::snprintf(temp, BX_COUNTOF(temp), "gl_FragData[%d]", ii); + hasFragData[ii] = NULL != strstr(input, temp); + numFragData += hasFragData[ii]; + } - if (0 != writer->open(outFilePath) ) - { - fprintf(stderr, "Unable to open output file '%s'.", outFilePath); - return EXIT_FAILURE; - } + if (0 == numFragData) + { + // GL errors when both gl_FragColor and gl_FragData is used. + // This will trigger the same error with HLSL compiler too. + preprocessor.writef("#define gl_FragColor gl_FragData_0_\n"); + } - if ('f' == shaderType) - { - bx::write(writer, BGFX_CHUNK_MAGIC_FSH); - bx::write(writer, inputHash); - } - else if ('v' == shaderType) - { - bx::write(writer, BGFX_CHUNK_MAGIC_VSH); - bx::write(writer, outputHash); - } - else - { - bx::write(writer, BGFX_CHUNK_MAGIC_CSH); - bx::write(writer, outputHash); - } + preprocessor.writef("#define void_main()"); + preprocessor.writef(" \\\n\tvoid main("); - if (0 != glsl - || 0 != essl - || 0 != metal) - { - std::string code; + uint32_t arg = 0; - bool hasTextureLod = NULL != bx::findIdentifierMatch(input, s_ARB_shader_texture_lod /*EXT_shader_texture_lod*/); + if (hasFragCoord) + { + preprocessor.writef(" \\\n\tvec4 gl_FragCoord : SV_POSITION"); + ++arg; + } - if (0 == essl) + for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it) { - const bool need130 = 120 == glsl - && bx::findIdentifierMatch(input, s_130) - ; + VaryingMap::const_iterator varyingIt = varyingMap.find(*it); + if (varyingIt != varyingMap.end() ) + { + const Varying& var = varyingIt->second; + preprocessor.writef(" \\\n\t%s%s %s %s : %s" + , arg++ > 0 ? ", " : " " + , interpolationDx11(var.m_interpolation.c_str() ) + , var.m_type.c_str() + , var.m_name.c_str() + , var.m_semantics.c_str() + ); + } + } - if (0 != metal) + addFragData(preprocessor, input, 0, arg++ > 0); + + const uint32_t maxRT = d3d > 9 ? BX_COUNTOF(hasFragData) : 4; + + for (uint32_t ii = 1; ii < BX_COUNTOF(hasFragData); ++ii) + { + if (ii < maxRT) { - bx::stringPrintf(code, "#version 120\n"); + if (hasFragData[ii]) + { + addFragData(preprocessor, input, ii, arg++ > 0); + } } else { - bx::stringPrintf(code, "#version %s\n", need130 ? "130" : profile); + voidFragData(input, ii); } + } - bx::stringPrintf(code - , "#define bgfxShadow2D shadow2D\n" - "#define bgfxShadow2DProj shadow2DProj\n" + if (hasFragDepth) + { + preprocessor.writef( + " \\\n\t%sout float gl_FragDepth : SV_DEPTH" + , arg++ > 0 ? ", " : " " + ); + } + + if (hasFrontFacing + && hlsl >= 3) + { + preprocessor.writef( + " \\\n\t%sfloat __vface : VFACE" + , arg++ > 0 ? ", " : " " ); + } - if (hasTextureLod - && 130 > glsl) + if (hasPrimitiveId) + { + if (d3d > 9) { - bx::stringPrintf(code - , "#extension GL_ARB_shader_texture_lod : enable\n" + preprocessor.writef( + " \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID" + , arg++ > 0 ? ", " : " " ); } + else + { + fprintf(stderr, "PrimitiveID builtin is not supported by this D3D9 HLSL.\n"); + return EXIT_FAILURE; + } } - else + + preprocessor.writef( + " \\\n\t)\n" + ); + + if (hasFrontFacing) { - // Pretend that all extensions are available. - // This will be stripped later. - if (hasTextureLod) + if (hlsl >= 3) { - bx::stringPrintf(code - , "#extension GL_EXT_shader_texture_lod : enable\n" - "#define texture2DLod texture2DLodEXT\n" - "#define texture2DProjLod texture2DProjLodEXT\n" - "#define textureCubeLod textureCubeLodEXT\n" -// "#define texture2DGrad texture2DGradEXT\n" -// "#define texture2DProjGrad texture2DProjGradEXT\n" -// "#define textureCubeGrad textureCubeGradEXT\n" + preprocessor.writef( + "#define gl_FrontFacing (__vface <= 0.0)\n" + ); + } + else + { + preprocessor.writef( + "#define gl_FrontFacing false\n" ); } + } + } + else if ('v' == shaderType) + { + const char* brace = strstr(entry, "{"); + if (NULL != brace) + { + const char* end = bx::strmb(brace, '{', '}'); + if (NULL != end) + { + strInsert(const_cast(end), "__RETURN__;\n"); + } + } - if (NULL != bx::findIdentifierMatch(input, s_OES_standard_derivatives) ) + preprocessor.writef( + "struct Output\n" + "{\n" + "\tvec4 gl_Position : SV_POSITION;\n" + "#define gl_Position _varying_.gl_Position\n" + ); + for (InOut::const_iterator it = shaderOutputs.begin(), itEnd = shaderOutputs.end(); it != itEnd; ++it) + { + VaryingMap::const_iterator varyingIt = varyingMap.find(*it); + if (varyingIt != varyingMap.end() ) { - bx::stringPrintf(code, "#extension GL_OES_standard_derivatives : enable\n"); + const Varying& var = varyingIt->second; + preprocessor.writef("\t%s %s : %s;\n", var.m_type.c_str(), var.m_name.c_str(), var.m_semantics.c_str() ); + preprocessor.writef("#define %s _varying_.%s\n", var.m_name.c_str(), var.m_name.c_str() ); } + } + preprocessor.writef( + "};\n" + ); - if (NULL != bx::findIdentifierMatch(input, s_OES_texture_3D) ) + preprocessor.writef("#define void_main() \\\n"); + preprocessor.writef("Output main("); + bool first = true; + for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it) + { + VaryingMap::const_iterator varyingIt = varyingMap.find(*it); + if (varyingIt != varyingMap.end() ) { - bx::stringPrintf(code, "#extension GL_OES_texture_3D : enable\n"); + const Varying& var = varyingIt->second; + preprocessor.writef("%s%s %s : %s\\\n", first ? "" : "\t, ", var.m_type.c_str(), var.m_name.c_str(), var.m_semantics.c_str() ); + first = false; } + } + preprocessor.writef( + ") \\\n" + "{ \\\n" + "\tOutput _varying_;" + ); - if (NULL != bx::findIdentifierMatch(input, s_EXT_shadow_samplers) ) + for (InOut::const_iterator it = shaderOutputs.begin(), itEnd = shaderOutputs.end(); it != itEnd; ++it) + { + VaryingMap::const_iterator varyingIt = varyingMap.find(*it); + if (varyingIt != varyingMap.end() ) { - bx::stringPrintf(code - , "#extension GL_EXT_shadow_samplers : enable\n" - "#define shadow2D shadow2DEXT\n" - "#define shadow2DProj shadow2DProjEXT\n" - ); + const Varying& var = varyingIt->second; + preprocessor.writef(" \\\n\t%s", var.m_name.c_str() ); + if (!var.m_init.empty() ) + { + preprocessor.writef(" = %s", var.m_init.c_str() ); + } + preprocessor.writef(";"); } + } + + preprocessor.writef( + "\n#define __RETURN__ \\\n" + "\t} \\\n" + "\treturn _varying_" + ); + } + } + + if (preprocessor.run(input) ) + { + BX_TRACE("Input file: %s", filePath); + BX_TRACE("Output file: %s", outFilePath); + + if (preprocessOnly) + { + bx::CrtFileWriter writer; + + if (!bx::open(&writer, outFilePath) ) + { + fprintf(stderr, "Unable to open output file '%s'.", outFilePath); + return EXIT_FAILURE; + } - if (NULL != bx::findIdentifierMatch(input, "gl_FragDepth") ) + if (0 != glsl) + { + if (NULL == profile) { - bx::stringPrintf(code - , "#extension GL_EXT_frag_depth : enable\n" - "#define gl_FragDepth gl_FragDepthEXT\n" + writef(&writer + , "#ifdef GL_ES\n" + "precision highp float;\n" + "#endif // GL_ES\n\n" ); } } + bx::write(&writer, preprocessor.m_preprocessed.c_str(), (int32_t)preprocessor.m_preprocessed.size() ); + bx::close(&writer); - code += preprocessor.m_preprocessed; - compiled = compileGLSLShader(cmdLine - , metal ? BX_MAKEFOURCC('M', 'T', 'L', 0) : essl - , code - , writer - ); + return EXIT_SUCCESS; } - else + { - compiled = compileHLSLShader(cmdLine - , d3d - , preprocessor.m_preprocessed - , writer - ); - } + bx::CrtFileWriter* writer = NULL; - writer->close(); - delete writer; - } + if (NULL != bin2c) + { + writer = new Bin2cWriter(bin2c); + } + else + { + writer = new bx::CrtFileWriter; + } - if (compiled) - { - if (depends) + if (!bx::open(writer, outFilePath) ) + { + fprintf(stderr, "Unable to open output file '%s'.", outFilePath); + return EXIT_FAILURE; + } + + if ('f' == shaderType) + { + bx::write(writer, BGFX_CHUNK_MAGIC_FSH); + bx::write(writer, inputHash); + } + else if ('v' == shaderType) + { + bx::write(writer, BGFX_CHUNK_MAGIC_VSH); + bx::write(writer, outputHash); + } + else + { + bx::write(writer, BGFX_CHUNK_MAGIC_CSH); + bx::write(writer, outputHash); + } + + if (0 != glsl + || 0 != essl + || 0 != metal) + { + std::string code; + + bool hasTextureLod = NULL != bx::findIdentifierMatch(input, s_ARB_shader_texture_lod /*EXT_shader_texture_lod*/); + + if (0 == essl) + { + const bool need130 = 120 == glsl + && bx::findIdentifierMatch(input, s_130) + ; + + if (0 != metal) + { + bx::stringPrintf(code, "#version 120\n"); + } + else + { + bx::stringPrintf(code, "#version %s\n", need130 ? "130" : profile); + } + + bx::stringPrintf(code + , "#define bgfxShadow2D shadow2D\n" + "#define bgfxShadow2DProj shadow2DProj\n" + ); + + if (hasTextureLod + && 130 > glsl) + { + bx::stringPrintf(code + , "#extension GL_ARB_shader_texture_lod : enable\n" + ); + } + } + else + { + // Pretend that all extensions are available. + // This will be stripped later. + if (hasTextureLod) + { + bx::stringPrintf(code + , "#extension GL_EXT_shader_texture_lod : enable\n" + "#define texture2DLod texture2DLodEXT\n" + "#define texture2DProjLod texture2DProjLodEXT\n" + "#define textureCubeLod textureCubeLodEXT\n" + // "#define texture2DGrad texture2DGradEXT\n" + // "#define texture2DProjGrad texture2DProjGradEXT\n" + // "#define textureCubeGrad textureCubeGradEXT\n" + ); + } + + if (NULL != bx::findIdentifierMatch(input, s_OES_standard_derivatives) ) + { + bx::stringPrintf(code, "#extension GL_OES_standard_derivatives : enable\n"); + } + + if (NULL != bx::findIdentifierMatch(input, s_OES_texture_3D) ) + { + bx::stringPrintf(code, "#extension GL_OES_texture_3D : enable\n"); + } + + if (NULL != bx::findIdentifierMatch(input, s_EXT_shadow_samplers) ) + { + bx::stringPrintf(code + , "#extension GL_EXT_shadow_samplers : enable\n" + "#define shadow2D shadow2DEXT\n" + "#define shadow2DProj shadow2DProjEXT\n" + ); + } + + if (NULL != bx::findIdentifierMatch(input, "gl_FragDepth") ) + { + bx::stringPrintf(code + , "#extension GL_EXT_frag_depth : enable\n" + "#define gl_FragDepth gl_FragDepthEXT\n" + ); + } + } + + code += preprocessor.m_preprocessed; + compiled = compileGLSLShader(cmdLine + , metal ? BX_MAKEFOURCC('M', 'T', 'L', 0) : essl + , code + , writer + ); + } + else + { + compiled = compileHLSLShader(cmdLine + , d3d + , preprocessor.m_preprocessed + , writer + ); + } + + bx::close(writer); + delete writer; + } + + if (compiled) { - std::string ofp = outFilePath; - ofp += ".d"; - bx::CrtFileWriter writer; - if (0 == writer.open(ofp.c_str() ) ) + if (depends) { - writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() ); - writer.close(); + std::string ofp = outFilePath; + ofp += ".d"; + bx::CrtFileWriter writer; + if (bx::open(&writer, ofp.c_str() ) ) + { + writef(&writer, "%s : %s\n", outFilePath, preprocessor.m_depends.c_str() ); + bx::close(&writer); + } } } } } } + + delete [] data; } - delete [] data; - } + if (compiled) + { + return EXIT_SUCCESS; + } - if (compiled) - { - return EXIT_SUCCESS; + remove(outFilePath); + + fprintf(stderr, "Failed to build shader.\n"); + return EXIT_FAILURE; } - remove(outFilePath); +} // namespace bgfx - fprintf(stderr, "Failed to build shader.\n"); - return EXIT_FAILURE; +int main(int _argc, const char* _argv[]) +{ + return bgfx::compileShader(_argc, _argv); } diff --git a/3rdparty/bgfx/tools/shaderc/shaderc.h b/3rdparty/bgfx/tools/shaderc/shaderc.h index b7818ff1867..29bf450e474 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc.h +++ b/3rdparty/bgfx/tools/shaderc/shaderc.h @@ -6,9 +6,14 @@ #ifndef SHADERC_H_HEADER_GUARD #define SHADERC_H_HEADER_GUARD +namespace bgfx +{ + extern bool g_verbose; +} + #define _BX_TRACE(_format, ...) \ BX_MACRO_BLOCK_BEGIN \ - if (g_verbose) \ + if (bgfx::g_verbose) \ { \ fprintf(stderr, BX_FILE_LINE_LITERAL "" _format "\n", ##__VA_ARGS__); \ } \ @@ -39,8 +44,6 @@ # define SHADERC_CONFIG_HLSL BX_PLATFORM_WINDOWS #endif // SHADERC_CONFIG_HLSL -extern bool g_verbose; - #include #include #include @@ -61,83 +64,74 @@ extern bool g_verbose; #include #include "../../src/vertexdecl.h" -class LineReader +namespace bgfx { -public: - LineReader(const char* _str) - : m_str(_str) - , m_pos(0) - , m_size((uint32_t)strlen(_str)) - { - } - - std::string getLine() - { - const char* str = &m_str[m_pos]; - skipLine(); - - const char* eol = &m_str[m_pos]; - - std::string tmp; - tmp.assign(str, eol - str); - return tmp; - } + extern bool g_verbose; - bool isEof() const + class LineReader { - return m_str[m_pos] == '\0'; - } + public: + LineReader(const char* _str) + : m_str(_str) + , m_pos(0) + , m_size((uint32_t)strlen(_str)) + { + } + + std::string getLine() + { + const char* str = &m_str[m_pos]; + skipLine(); + + const char* eol = &m_str[m_pos]; + + std::string tmp; + tmp.assign(str, eol - str); + return tmp; + } + + bool isEof() const + { + return m_str[m_pos] == '\0'; + } + + void skipLine() + { + const char* str = &m_str[m_pos]; + const char* nl = bx::strnl(str); + m_pos += (uint32_t)(nl - str); + } + + const char* m_str; + uint32_t m_pos; + uint32_t m_size; + }; - void skipLine() - { - const char* str = &m_str[m_pos]; - const char* nl = bx::strnl(str); - m_pos += (uint32_t)(nl - str); - } + #define BGFX_UNIFORM_FRAGMENTBIT UINT8_C(0x10) + #define BGFX_UNIFORM_SAMPLERBIT UINT8_C(0x20) - const char* m_str; - uint32_t m_pos; - uint32_t m_size; -}; + const char* getUniformTypeName(UniformType::Enum _enum); + UniformType::Enum nameToUniformTypeEnum(const char* _name); -struct UniformType -{ - enum Enum + struct Uniform { - Int1, - End, - - Vec4, - Mat3, - Mat4, - - Count + std::string name; + UniformType::Enum type; + uint8_t num; + uint16_t regIndex; + uint16_t regCount; }; -}; -#define BGFX_UNIFORM_FRAGMENTBIT UINT8_C(0x10) -#define BGFX_UNIFORM_SAMPLERBIT UINT8_C(0x20) + typedef std::vector UniformArray; -const char* getUniformTypeName(UniformType::Enum _enum); -UniformType::Enum nameToUniformTypeEnum(const char* _name); + void printCode(const char* _code, int32_t _line = 0, int32_t _start = 0, int32_t _end = INT32_MAX); + void strReplace(char* _str, const char* _find, const char* _replace); + int32_t writef(bx::WriterI* _writer, const char* _format, ...); + void writeFile(const char* _filePath, const void* _data, int32_t _size); -struct Uniform -{ - std::string name; - UniformType::Enum type; - uint8_t num; - uint16_t regIndex; - uint16_t regCount; -}; - -typedef std::vector UniformArray; - -void printCode(const char* _code, int32_t _line = 0, int32_t _start = 0, int32_t _end = INT32_MAX); -void strReplace(char* _str, const char* _find, const char* _replace); -int32_t writef(bx::WriterI* _writer, const char* _format, ...); -void writeFile(const char* _filePath, const void* _data, int32_t _size); - -bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool firstPass = true); -bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _gles, const std::string& _code, bx::WriterI* _writer); + bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool firstPass = true); + bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _gles, const std::string& _code, bx::WriterI* _writer); + +} // namespace bgfx #endif // SHADERC_H_HEADER_GUARD diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp index 674b19d16fd..0a4ce15d937 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp +++ b/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp @@ -6,207 +6,211 @@ #include "shaderc.h" #include "glsl_optimizer.h" -bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _gles, const std::string& _code, bx::WriterI* _writer) +namespace bgfx { - char ch = tolower(_cmdLine.findOption('\0', "type")[0]); - const glslopt_shader_type type = ch == 'f' - ? kGlslOptShaderFragment - : (ch == 'c' ? kGlslOptShaderCompute : kGlslOptShaderVertex); - - glslopt_target target = kGlslTargetOpenGL; - switch (_gles) + bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _gles, const std::string& _code, bx::WriterI* _writer) { - case BX_MAKEFOURCC('M', 'T', 'L', 0): - target = kGlslTargetMetal; - break; - - case 2: - target = kGlslTargetOpenGLES20; - break; - - case 3: - target = kGlslTargetOpenGLES30; - break; - - default: - target = kGlslTargetOpenGL; - break; - } - - glslopt_ctx* ctx = glslopt_initialize(target); - - glslopt_shader* shader = glslopt_optimize(ctx, type, _code.c_str(), 0); + char ch = tolower(_cmdLine.findOption('\0', "type")[0]); + const glslopt_shader_type type = ch == 'f' + ? kGlslOptShaderFragment + : (ch == 'c' ? kGlslOptShaderCompute : kGlslOptShaderVertex); - if (!glslopt_get_status(shader) ) - { - const char* log = glslopt_get_log(shader); - int32_t source = 0; - int32_t line = 0; - int32_t column = 0; - int32_t start = 0; - int32_t end = INT32_MAX; - - if (3 == sscanf(log, "%u:%u(%u):", &source, &line, &column) - && 0 != line) + glslopt_target target = kGlslTargetOpenGL; + switch (_gles) { - start = bx::uint32_imax(1, line-10); - end = start + 20; - } + case BX_MAKEFOURCC('M', 'T', 'L', 0): + target = kGlslTargetMetal; + break; - printCode(_code.c_str(), line, start, end); - fprintf(stderr, "Error: %s\n", log); - glslopt_cleanup(ctx); - return false; - } + case 2: + target = kGlslTargetOpenGLES20; + break; - const char* optimizedShader = glslopt_get_output(shader); - - // Trim all directives. - while ('#' == *optimizedShader) - { - optimizedShader = bx::strnl(optimizedShader); - } + case 3: + target = kGlslTargetOpenGLES30; + break; - if (0 != _gles) - { - char* code = const_cast(optimizedShader); - strReplace(code, "gl_FragDepthEXT", "gl_FragDepth"); - - strReplace(code, "texture2DLodEXT", "texture2DLod"); - strReplace(code, "texture2DProjLodEXT", "texture2DProjLod"); - strReplace(code, "textureCubeLodEXT", "textureCubeLod"); - strReplace(code, "texture2DGradEXT", "texture2DGrad"); - strReplace(code, "texture2DProjGradEXT", "texture2DProjGrad"); - strReplace(code, "textureCubeGradEXT", "textureCubeGrad"); - - strReplace(code, "shadow2DEXT", "shadow2D"); - strReplace(code, "shadow2DProjEXT", "shadow2DProj"); - } + default: + target = kGlslTargetOpenGL; + break; + } - UniformArray uniforms; + glslopt_ctx* ctx = glslopt_initialize(target); - { - const char* parse = optimizedShader; + glslopt_shader* shader = glslopt_optimize(ctx, type, _code.c_str(), 0); - while (NULL != parse - && *parse != '\0') + if (!glslopt_get_status(shader) ) { - parse = bx::strws(parse); - const char* eol = strchr(parse, ';'); - if (NULL != eol) + const char* log = glslopt_get_log(shader); + int32_t source = 0; + int32_t line = 0; + int32_t column = 0; + int32_t start = 0; + int32_t end = INT32_MAX; + + if (3 == sscanf(log, "%u:%u(%u):", &source, &line, &column) + && 0 != line) { - const char* qualifier = parse; - parse = bx::strws(bx::strword(parse) ); - - if (0 == strncmp(qualifier, "attribute", 9) - || 0 == strncmp(qualifier, "varying", 7) ) - { - // skip attributes and varyings. - parse = eol + 1; - continue; - } - - if (0 != strncmp(qualifier, "uniform", 7) ) - { - // end if there is no uniform keyword. - parse = NULL; - continue; - } - - const char* precision = NULL; - const char* typen = parse; - - if (0 == strncmp(typen, "lowp", 4) - || 0 == strncmp(typen, "mediump", 7) - || 0 == strncmp(typen, "highp", 5) ) - { - precision = typen; - typen = parse = bx::strws(bx::strword(parse) ); - } - - BX_UNUSED(precision); + start = bx::uint32_imax(1, line-10); + end = start + 20; + } - char uniformType[256]; - parse = bx::strword(parse); + printCode(_code.c_str(), line, start, end); + fprintf(stderr, "Error: %s\n", log); + glslopt_cleanup(ctx); + return false; + } - if (0 == strncmp(typen, "sampler", 7) ) - { - strcpy(uniformType, "int"); - } - else - { - bx::strlcpy(uniformType, typen, parse-typen+1); - } + const char* optimizedShader = glslopt_get_output(shader); - const char* name = parse = bx::strws(parse); + // Trim all directives. + while ('#' == *optimizedShader) + { + optimizedShader = bx::strnl(optimizedShader); + } - char uniformName[256]; - uint8_t num = 1; - const char* array = bx::strnstr(name, "[", eol-parse); - if (NULL != array) - { - bx::strlcpy(uniformName, name, array-name+1); + if (0 != _gles) + { + char* code = const_cast(optimizedShader); + strReplace(code, "gl_FragDepthEXT", "gl_FragDepth"); + + strReplace(code, "texture2DLodEXT", "texture2DLod"); + strReplace(code, "texture2DProjLodEXT", "texture2DProjLod"); + strReplace(code, "textureCubeLodEXT", "textureCubeLod"); + strReplace(code, "texture2DGradEXT", "texture2DGrad"); + strReplace(code, "texture2DProjGradEXT", "texture2DProjGrad"); + strReplace(code, "textureCubeGradEXT", "textureCubeGrad"); + + strReplace(code, "shadow2DEXT", "shadow2D"); + strReplace(code, "shadow2DProjEXT", "shadow2DProj"); + } - char arraySize[32]; - const char* end = bx::strnstr(array, "]", eol-array); - bx::strlcpy(arraySize, array+1, end-array); - num = atoi(arraySize); - } - else - { - bx::strlcpy(uniformName, name, eol-name+1); - } + UniformArray uniforms; - Uniform un; - un.type = nameToUniformTypeEnum(uniformType); + { + const char* parse = optimizedShader; - if (UniformType::Count != un.type) + while (NULL != parse + && *parse != '\0') + { + parse = bx::strws(parse); + const char* eol = strchr(parse, ';'); + if (NULL != eol) { - BX_TRACE("name: %s (type %d, num %d)", uniformName, un.type, num); + const char* qualifier = parse; + parse = bx::strws(bx::strword(parse) ); + + if (0 == strncmp(qualifier, "attribute", 9) + || 0 == strncmp(qualifier, "varying", 7) ) + { + // skip attributes and varyings. + parse = eol + 1; + continue; + } + + if (0 != strncmp(qualifier, "uniform", 7) ) + { + // end if there is no uniform keyword. + parse = NULL; + continue; + } + + const char* precision = NULL; + const char* typen = parse; + + if (0 == strncmp(typen, "lowp", 4) + || 0 == strncmp(typen, "mediump", 7) + || 0 == strncmp(typen, "highp", 5) ) + { + precision = typen; + typen = parse = bx::strws(bx::strword(parse) ); + } + + BX_UNUSED(precision); + + char uniformType[256]; + parse = bx::strword(parse); + + if (0 == strncmp(typen, "sampler", 7) ) + { + strcpy(uniformType, "int"); + } + else + { + bx::strlcpy(uniformType, typen, parse-typen+1); + } + + const char* name = parse = bx::strws(parse); + + char uniformName[256]; + uint8_t num = 1; + const char* array = bx::strnstr(name, "[", eol-parse); + if (NULL != array) + { + bx::strlcpy(uniformName, name, array-name+1); + + char arraySize[32]; + const char* end = bx::strnstr(array, "]", eol-array); + bx::strlcpy(arraySize, array+1, end-array); + num = atoi(arraySize); + } + else + { + bx::strlcpy(uniformName, name, eol-name+1); + } + + Uniform un; + un.type = nameToUniformTypeEnum(uniformType); + + if (UniformType::Count != un.type) + { + BX_TRACE("name: %s (type %d, num %d)", uniformName, un.type, num); + + un.name = uniformName; + un.num = num; + un.regIndex = 0; + un.regCount = num; + uniforms.push_back(un); + } - un.name = uniformName; - un.num = num; - un.regIndex = 0; - un.regCount = num; - uniforms.push_back(un); + parse = eol + 1; } - - parse = eol + 1; } } - } - uint16_t count = (uint16_t)uniforms.size(); - bx::write(_writer, count); + uint16_t count = (uint16_t)uniforms.size(); + bx::write(_writer, count); - for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it) - { - const Uniform& un = *it; - uint8_t nameSize = (uint8_t)un.name.size(); - bx::write(_writer, nameSize); - bx::write(_writer, un.name.c_str(), nameSize); - uint8_t uniformType = un.type; - bx::write(_writer, uniformType); - bx::write(_writer, un.num); - bx::write(_writer, un.regIndex); - bx::write(_writer, un.regCount); - - BX_TRACE("%s, %s, %d, %d, %d" - , un.name.c_str() - , getUniformTypeName(un.type) - , un.num - , un.regIndex - , un.regCount - ); - } + for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it) + { + const Uniform& un = *it; + uint8_t nameSize = (uint8_t)un.name.size(); + bx::write(_writer, nameSize); + bx::write(_writer, un.name.c_str(), nameSize); + uint8_t uniformType = un.type; + bx::write(_writer, uniformType); + bx::write(_writer, un.num); + bx::write(_writer, un.regIndex); + bx::write(_writer, un.regCount); + + BX_TRACE("%s, %s, %d, %d, %d" + , un.name.c_str() + , getUniformTypeName(un.type) + , un.num + , un.regIndex + , un.regCount + ); + } - uint32_t shaderSize = (uint32_t)strlen(optimizedShader); - bx::write(_writer, shaderSize); - bx::write(_writer, optimizedShader, shaderSize); - uint8_t nul = 0; - bx::write(_writer, nul); + uint32_t shaderSize = (uint32_t)strlen(optimizedShader); + bx::write(_writer, shaderSize); + bx::write(_writer, optimizedShader, shaderSize); + uint8_t nul = 0; + bx::write(_writer, nul); - glslopt_cleanup(ctx); + glslopt_cleanup(ctx); + + return true; + } - return true; -} +} // namespace bgfx diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp index cdac5edd7b3..8f861047ded 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp +++ b/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp @@ -7,677 +7,796 @@ #if SHADERC_CONFIG_HLSL -#define INITGUID +#if defined(__MINGW32__) +# define __REQUIRED_RPCNDR_H_VERSION__ 475 +# define __in +# define __out +#endif // defined(__MINGW32__) + #include #include +#include #ifndef D3D_SVF_USED # define D3D_SVF_USED 2 #endif // D3D_SVF_USED -struct CTHeader -{ - uint32_t Size; - uint32_t Creator; - uint32_t Version; - uint32_t Constants; - uint32_t ConstantInfo; - uint32_t Flags; - uint32_t Target; -}; - -struct CTInfo -{ - uint32_t Name; - uint16_t RegisterSet; - uint16_t RegisterIndex; - uint16_t RegisterCount; - uint16_t Reserved; - uint32_t TypeInfo; - uint32_t DefaultValue; -}; - -struct CTType -{ - uint16_t Class; - uint16_t Type; - uint16_t Rows; - uint16_t Columns; - uint16_t Elements; - uint16_t StructMembers; - uint32_t StructMemberInfo; -}; - -struct RemapInputSemantic +namespace bgfx { - bgfx::Attrib::Enum m_attr; - const char* m_name; - uint8_t m_index; -}; + typedef HRESULT(WINAPI* PFN_D3D_COMPILE)(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData + , _In_ SIZE_T SrcDataSize + , _In_opt_ LPCSTR pSourceName + , _In_reads_opt_(_Inexpressible_(pDefines->Name != NULL) ) CONST D3D_SHADER_MACRO* pDefines + , _In_opt_ ID3DInclude* pInclude + , _In_opt_ LPCSTR pEntrypoint + , _In_ LPCSTR pTarget + , _In_ UINT Flags1 + , _In_ UINT Flags2 + , _Out_ ID3DBlob** ppCode + , _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorMsgs + ); -static const RemapInputSemantic s_remapInputSemantic[bgfx::Attrib::Count+1] = -{ - { bgfx::Attrib::Position, "POSITION", 0 }, - { bgfx::Attrib::Normal, "NORMAL", 0 }, - { bgfx::Attrib::Tangent, "TANGENT", 0 }, - { bgfx::Attrib::Bitangent, "BITANGENT", 0 }, - { bgfx::Attrib::Color0, "COLOR", 0 }, - { bgfx::Attrib::Color1, "COLOR", 1 }, - { bgfx::Attrib::Indices, "BLENDINDICES", 0 }, - { bgfx::Attrib::Weight, "BLENDWEIGHT", 0 }, - { bgfx::Attrib::TexCoord0, "TEXCOORD", 0 }, - { bgfx::Attrib::TexCoord1, "TEXCOORD", 1 }, - { bgfx::Attrib::TexCoord2, "TEXCOORD", 2 }, - { bgfx::Attrib::TexCoord3, "TEXCOORD", 3 }, - { bgfx::Attrib::TexCoord4, "TEXCOORD", 4 }, - { bgfx::Attrib::TexCoord5, "TEXCOORD", 5 }, - { bgfx::Attrib::TexCoord6, "TEXCOORD", 6 }, - { bgfx::Attrib::TexCoord7, "TEXCOORD", 7 }, - { bgfx::Attrib::Count, "", 0 }, -}; - -const RemapInputSemantic& findInputSemantic(const char* _name, uint8_t _index) -{ - for (uint32_t ii = 0; ii < bgfx::Attrib::Count; ++ii) - { - const RemapInputSemantic& ris = s_remapInputSemantic[ii]; - if (0 == strcmp(ris.m_name, _name) - && ris.m_index == _index) - { - return ris; - } - } + typedef HRESULT(WINAPI* PFN_D3D_DISASSEMBLE)(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData + , _In_ SIZE_T SrcDataSize + , _In_ UINT Flags + , _In_opt_ LPCSTR szComments + , _Out_ ID3DBlob** ppDisassembly + ); - return s_remapInputSemantic[bgfx::Attrib::Count]; -} + typedef HRESULT(WINAPI* PFN_D3D_REFLECT)(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData + , _In_ SIZE_T SrcDataSize + , _In_ REFIID pInterface + , _Out_ void** ppReflector + ); -struct UniformRemap -{ - UniformType::Enum id; - D3D_SHADER_VARIABLE_CLASS paramClass; - D3D_SHADER_VARIABLE_TYPE paramType; - uint8_t columns; - uint8_t rows; -}; - -static const UniformRemap s_uniformRemap[] = -{ - { UniformType::Int1, D3D_SVC_SCALAR, D3D_SVT_INT, 0, 0 }, - { UniformType::Vec4, D3D_SVC_VECTOR, D3D_SVT_FLOAT, 0, 0 }, - { UniformType::Mat3, D3D_SVC_MATRIX_COLUMNS, D3D_SVT_FLOAT, 3, 3 }, - { UniformType::Mat4, D3D_SVC_MATRIX_COLUMNS, D3D_SVT_FLOAT, 4, 4 }, - { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER, 0, 0 }, - { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER2D, 0, 0 }, - { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER3D, 0, 0 }, - { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLERCUBE, 0, 0 }, -}; - -UniformType::Enum findUniformType(const D3D11_SHADER_TYPE_DESC& constDesc) -{ - for (uint32_t ii = 0; ii < BX_COUNTOF(s_uniformRemap); ++ii) - { - const UniformRemap& remap = s_uniformRemap[ii]; + typedef HRESULT(WINAPI* PFN_D3D_STRIP_SHADER)(_In_reads_bytes_(BytecodeLength) LPCVOID pShaderBytecode + , _In_ SIZE_T BytecodeLength + , _In_ UINT uStripFlags + , _Out_ ID3DBlob** ppStrippedBlob + ); + + PFN_D3D_COMPILE D3DCompile; + PFN_D3D_DISASSEMBLE D3DDisassemble; + PFN_D3D_REFLECT D3DReflect; + PFN_D3D_STRIP_SHADER D3DStripShader; - if (remap.paramClass == constDesc.Class - && remap.paramType == constDesc.Type) + struct D3DCompiler + { + const char* fileName; + const GUID IID_ID3D11ShaderReflection; + }; + + static const D3DCompiler s_d3dcompiler[] = + { // BK - the only different in interface is GetRequiresFlags at the end + // of IID_ID3D11ShaderReflection47 (which is not used anyway). + { "D3DCompiler_47.dll", { 0x8d536ca1, 0x0cca, 0x4956, { 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84 } } }, + { "D3DCompiler_46.dll", { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } } }, + { "D3DCompiler_45.dll", { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } } }, + { "D3DCompiler_44.dll", { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } } }, + { "D3DCompiler_43.dll", { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } } }, + }; + + static const D3DCompiler* s_compiler; + static void* s_d3dcompilerdll; + + const D3DCompiler* load() + { + for (uint32_t ii = 0; ii < BX_COUNTOF(s_d3dcompiler); ++ii) { - if (D3D_SVC_MATRIX_COLUMNS != constDesc.Class) + const D3DCompiler* compiler = &s_d3dcompiler[ii]; + s_d3dcompilerdll = bx::dlopen(compiler->fileName); + if (NULL == s_d3dcompilerdll) { - return remap.id; + continue; } - if (remap.columns == constDesc.Columns - && remap.rows == constDesc.Rows) + D3DCompile = (PFN_D3D_COMPILE )bx::dlsym(s_d3dcompilerdll, "D3DCompile"); + D3DDisassemble = (PFN_D3D_DISASSEMBLE )bx::dlsym(s_d3dcompilerdll, "D3DDisassemble"); + D3DReflect = (PFN_D3D_REFLECT )bx::dlsym(s_d3dcompilerdll, "D3DReflect"); + D3DStripShader = (PFN_D3D_STRIP_SHADER)bx::dlsym(s_d3dcompilerdll, "D3DStripShader"); + + if (NULL == D3DCompile + || NULL == D3DDisassemble + || NULL == D3DReflect + || NULL == D3DStripShader) { - return remap.id; + bx::dlclose(s_d3dcompilerdll); + continue; } - } - } - return UniformType::Count; -} - -static uint32_t s_optimizationLevelDx11[4] = -{ - D3DCOMPILE_OPTIMIZATION_LEVEL0, - D3DCOMPILE_OPTIMIZATION_LEVEL1, - D3DCOMPILE_OPTIMIZATION_LEVEL2, - D3DCOMPILE_OPTIMIZATION_LEVEL3, -}; + BX_TRACE("Loaded %s compiler.", compiler->fileName); + return compiler; + } -typedef std::vector UniformNameList; + fprintf(stderr, "Error: Unable to open D3DCompiler_*.dll shader compiler.\n"); + return NULL; + } -static bool isSampler(D3D_SHADER_VARIABLE_TYPE _svt) -{ - switch (_svt) + void unload() { - case D3D_SVT_SAMPLER: - case D3D_SVT_SAMPLER1D: - case D3D_SVT_SAMPLER2D: - case D3D_SVT_SAMPLER3D: - case D3D_SVT_SAMPLERCUBE: - return true; - - default: - break; + bx::dlclose(s_d3dcompilerdll); } - return false; -} - -bool getReflectionDataDx9(ID3DBlob* _code, UniformArray& _uniforms) -{ - // see reference for magic values: https://msdn.microsoft.com/en-us/library/ff552891(VS.85).aspx - const uint32_t D3DSIO_COMMENT = 0x0000FFFE; - const uint32_t D3DSIO_END = 0x0000FFFF; - const uint32_t D3DSI_OPCODE_MASK = 0x0000FFFF; - const uint32_t D3DSI_COMMENTSIZE_MASK = 0x7FFF0000; - const uint32_t CTAB_CONSTANT = MAKEFOURCC('C','T','A','B'); - - // parse the shader blob for the constant table - const size_t codeSize = _code->GetBufferSize(); - const uint32_t* ptr = (const uint32_t*)_code->GetBufferPointer(); - const uint32_t* end = (const uint32_t*)( (const uint8_t*)ptr + codeSize); - const CTHeader* header = NULL; - - ptr++; // first byte is shader type / version; skip it since we already know - - while (ptr < end && *ptr != D3DSIO_END) + struct CTHeader { - uint32_t cur = *ptr++; - if ( (cur & D3DSI_OPCODE_MASK) != D3DSIO_COMMENT) - { - continue; - } + uint32_t Size; + uint32_t Creator; + uint32_t Version; + uint32_t Constants; + uint32_t ConstantInfo; + uint32_t Flags; + uint32_t Target; + }; + + struct CTInfo + { + uint32_t Name; + uint16_t RegisterSet; + uint16_t RegisterIndex; + uint16_t RegisterCount; + uint16_t Reserved; + uint32_t TypeInfo; + uint32_t DefaultValue; + }; + + struct CTType + { + uint16_t Class; + uint16_t Type; + uint16_t Rows; + uint16_t Columns; + uint16_t Elements; + uint16_t StructMembers; + uint32_t StructMemberInfo; + }; + + struct RemapInputSemantic + { + bgfx::Attrib::Enum m_attr; + const char* m_name; + uint8_t m_index; + }; - // try to find CTAB comment block - uint32_t commentSize = (cur & D3DSI_COMMENTSIZE_MASK) >> 16; - uint32_t fourcc = *ptr; - if (fourcc == CTAB_CONSTANT) + static const RemapInputSemantic s_remapInputSemantic[bgfx::Attrib::Count + 1] = + { + { bgfx::Attrib::Position, "POSITION", 0 }, + { bgfx::Attrib::Normal, "NORMAL", 0 }, + { bgfx::Attrib::Tangent, "TANGENT", 0 }, + { bgfx::Attrib::Bitangent, "BITANGENT", 0 }, + { bgfx::Attrib::Color0, "COLOR", 0 }, + { bgfx::Attrib::Color1, "COLOR", 1 }, + { bgfx::Attrib::Indices, "BLENDINDICES", 0 }, + { bgfx::Attrib::Weight, "BLENDWEIGHT", 0 }, + { bgfx::Attrib::TexCoord0, "TEXCOORD", 0 }, + { bgfx::Attrib::TexCoord1, "TEXCOORD", 1 }, + { bgfx::Attrib::TexCoord2, "TEXCOORD", 2 }, + { bgfx::Attrib::TexCoord3, "TEXCOORD", 3 }, + { bgfx::Attrib::TexCoord4, "TEXCOORD", 4 }, + { bgfx::Attrib::TexCoord5, "TEXCOORD", 5 }, + { bgfx::Attrib::TexCoord6, "TEXCOORD", 6 }, + { bgfx::Attrib::TexCoord7, "TEXCOORD", 7 }, + { bgfx::Attrib::Count, "", 0 }, + }; + + const RemapInputSemantic& findInputSemantic(const char* _name, uint8_t _index) + { + for (uint32_t ii = 0; ii < bgfx::Attrib::Count; ++ii) { - // found the constant table data - header = (const CTHeader*)(ptr + 1); - uint32_t tableSize = (commentSize - 1) * 4; - if (tableSize < sizeof(CTHeader) || header->Size != sizeof(CTHeader) ) + const RemapInputSemantic& ris = s_remapInputSemantic[ii]; + if (0 == strcmp(ris.m_name, _name) + && ris.m_index == _index) { - fprintf(stderr, "Error: Invalid constant table data\n"); - return false; + return ris; } - break; } - // this is a different kind of comment section, so skip over it - ptr += commentSize - 1; + return s_remapInputSemantic[bgfx::Attrib::Count]; } - if (!header) + struct UniformRemap { - fprintf(stderr, "Error: Could not find constant table data\n"); - return false; - } + UniformType::Enum id; + D3D_SHADER_VARIABLE_CLASS paramClass; + D3D_SHADER_VARIABLE_TYPE paramType; + uint8_t columns; + uint8_t rows; + }; + + static const UniformRemap s_uniformRemap[] = + { + { UniformType::Int1, D3D_SVC_SCALAR, D3D_SVT_INT, 0, 0 }, + { UniformType::Vec4, D3D_SVC_VECTOR, D3D_SVT_FLOAT, 0, 0 }, + { UniformType::Mat3, D3D_SVC_MATRIX_COLUMNS, D3D_SVT_FLOAT, 3, 3 }, + { UniformType::Mat4, D3D_SVC_MATRIX_COLUMNS, D3D_SVT_FLOAT, 4, 4 }, + { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER, 0, 0 }, + { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER2D, 0, 0 }, + { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLER3D, 0, 0 }, + { UniformType::Int1, D3D_SVC_OBJECT, D3D_SVT_SAMPLERCUBE, 0, 0 }, + }; + + UniformType::Enum findUniformType(const D3D11_SHADER_TYPE_DESC& constDesc) + { + for (uint32_t ii = 0; ii < BX_COUNTOF(s_uniformRemap); ++ii) + { + const UniformRemap& remap = s_uniformRemap[ii]; - const uint8_t* headerBytePtr = (const uint8_t*)header; - const char* creator = (const char*)(headerBytePtr + header->Creator); + if (remap.paramClass == constDesc.Class + && remap.paramType == constDesc.Type) + { + if (D3D_SVC_MATRIX_COLUMNS != constDesc.Class) + { + return remap.id; + } + + if (remap.columns == constDesc.Columns + && remap.rows == constDesc.Rows) + { + return remap.id; + } + } + } - BX_TRACE("Creator: %s 0x%08x", creator, header->Version); - BX_TRACE("Num constants: %d", header->Constants); - BX_TRACE("# cl ty RxC S By Name"); + return UniformType::Count; + } - const CTInfo* ctInfoArray = (const CTInfo*)(headerBytePtr + header->ConstantInfo); - for (uint32_t ii = 0; ii < header->Constants; ++ii) + static uint32_t s_optimizationLevelD3D11[4] = { - const CTInfo& ctInfo = ctInfoArray[ii]; - const CTType& ctType = *(const CTType*)(headerBytePtr + ctInfo.TypeInfo); - const char* name = (const char*)(headerBytePtr + ctInfo.Name); - - BX_TRACE("%3d %2d %2d [%dx%d] %d %s[%d] c%d (%d)" - , ii - , ctType.Class - , ctType.Type - , ctType.Rows - , ctType.Columns - , ctType.StructMembers - , name - , ctType.Elements - , ctInfo.RegisterIndex - , ctInfo.RegisterCount - ); + D3DCOMPILE_OPTIMIZATION_LEVEL0, + D3DCOMPILE_OPTIMIZATION_LEVEL1, + D3DCOMPILE_OPTIMIZATION_LEVEL2, + D3DCOMPILE_OPTIMIZATION_LEVEL3, + }; - D3D11_SHADER_TYPE_DESC desc; - desc.Class = (D3D_SHADER_VARIABLE_CLASS)ctType.Class; - desc.Type = (D3D_SHADER_VARIABLE_TYPE)ctType.Type; - desc.Rows = ctType.Rows; - desc.Columns = ctType.Columns; + typedef std::vector UniformNameList; - UniformType::Enum type = findUniformType(desc); - if (UniformType::Count != type) + static bool isSampler(D3D_SHADER_VARIABLE_TYPE _svt) + { + switch (_svt) { - Uniform un; - un.name = '$' == name[0] ? name + 1 : name; - un.type = isSampler(desc.Type) - ? UniformType::Enum(BGFX_UNIFORM_SAMPLERBIT | type) - : type - ; - un.num = (uint8_t)ctType.Elements; - un.regIndex = ctInfo.RegisterIndex; - un.regCount = ctInfo.RegisterCount; - - _uniforms.push_back(un); + case D3D_SVT_SAMPLER: + case D3D_SVT_SAMPLER1D: + case D3D_SVT_SAMPLER2D: + case D3D_SVT_SAMPLER3D: + case D3D_SVT_SAMPLERCUBE: + return true; + + default: + break; } - } - - return true; -} -bool getReflectionDataDx11(ID3DBlob* _code, bool _vshader, UniformArray& _uniforms, uint8_t& _numAttrs, uint16_t* _attrs, uint16_t& _size, UniformNameList& unusedUniforms) -{ - ID3D11ShaderReflection* reflect = NULL; - HRESULT hr = D3DReflect(_code->GetBufferPointer() - , _code->GetBufferSize() - , IID_ID3D11ShaderReflection - , (void**)&reflect - ); - if (FAILED(hr) ) - { - fprintf(stderr, "Error: 0x%08x\n", (uint32_t)hr); return false; } - D3D11_SHADER_DESC desc; - hr = reflect->GetDesc(&desc); - if (FAILED(hr) ) + bool getReflectionDataD3D9(ID3DBlob* _code, UniformArray& _uniforms) { - fprintf(stderr, BX_FILE_LINE_LITERAL "Error: 0x%08x\n", (uint32_t)hr); - return false; - } + // see reference for magic values: https://msdn.microsoft.com/en-us/library/ff552891(VS.85).aspx + const uint32_t D3DSIO_COMMENT = 0x0000FFFE; + const uint32_t D3DSIO_END = 0x0000FFFF; + const uint32_t D3DSI_OPCODE_MASK = 0x0000FFFF; + const uint32_t D3DSI_COMMENTSIZE_MASK = 0x7FFF0000; + const uint32_t CTAB_CONSTANT = MAKEFOURCC('C', 'T', 'A', 'B'); + + // parse the shader blob for the constant table + const size_t codeSize = _code->GetBufferSize(); + const uint32_t* ptr = (const uint32_t*)_code->GetBufferPointer(); + const uint32_t* end = (const uint32_t*)( (const uint8_t*)ptr + codeSize); + const CTHeader* header = NULL; + + ptr++; // first byte is shader type / version; skip it since we already know + + while (ptr < end && *ptr != D3DSIO_END) + { + uint32_t cur = *ptr++; + if ( (cur & D3DSI_OPCODE_MASK) != D3DSIO_COMMENT) + { + continue; + } - BX_TRACE("Creator: %s 0x%08x", desc.Creator, desc.Version); - BX_TRACE("Num constant buffers: %d", desc.ConstantBuffers); + // try to find CTAB comment block + uint32_t commentSize = (cur & D3DSI_COMMENTSIZE_MASK) >> 16; + uint32_t fourcc = *ptr; + if (fourcc == CTAB_CONSTANT) + { + // found the constant table data + header = (const CTHeader*)(ptr + 1); + uint32_t tableSize = (commentSize - 1) * 4; + if (tableSize < sizeof(CTHeader) || header->Size != sizeof(CTHeader) ) + { + fprintf(stderr, "Error: Invalid constant table data\n"); + return false; + } + break; + } - BX_TRACE("Input:"); + // this is a different kind of comment section, so skip over it + ptr += commentSize - 1; + } - if (_vshader) // Only care about input semantic on vertex shaders - { - for (uint32_t ii = 0; ii < desc.InputParameters; ++ii) + if (!header) { - D3D11_SIGNATURE_PARAMETER_DESC spd; - reflect->GetInputParameterDesc(ii, &spd); - BX_TRACE("\t%2d: %s%d, vt %d, ct %d, mask %x, reg %d" + fprintf(stderr, "Error: Could not find constant table data\n"); + return false; + } + + const uint8_t* headerBytePtr = (const uint8_t*)header; + const char* creator = (const char*)(headerBytePtr + header->Creator); + + BX_TRACE("Creator: %s 0x%08x", creator, header->Version); + BX_TRACE("Num constants: %d", header->Constants); + BX_TRACE("# cl ty RxC S By Name"); + + const CTInfo* ctInfoArray = (const CTInfo*)(headerBytePtr + header->ConstantInfo); + for (uint32_t ii = 0; ii < header->Constants; ++ii) + { + const CTInfo& ctInfo = ctInfoArray[ii]; + const CTType& ctType = *(const CTType*)(headerBytePtr + ctInfo.TypeInfo); + const char* name = (const char*)(headerBytePtr + ctInfo.Name); + + BX_TRACE("%3d %2d %2d [%dx%d] %d %s[%d] c%d (%d)" , ii - , spd.SemanticName - , spd.SemanticIndex - , spd.SystemValueType - , spd.ComponentType - , spd.Mask - , spd.Register + , ctType.Class + , ctType.Type + , ctType.Rows + , ctType.Columns + , ctType.StructMembers + , name + , ctType.Elements + , ctInfo.RegisterIndex + , ctInfo.RegisterCount ); - const RemapInputSemantic& ris = findInputSemantic(spd.SemanticName, spd.SemanticIndex); - if (ris.m_attr != bgfx::Attrib::Count) + D3D11_SHADER_TYPE_DESC desc; + desc.Class = (D3D_SHADER_VARIABLE_CLASS)ctType.Class; + desc.Type = (D3D_SHADER_VARIABLE_TYPE)ctType.Type; + desc.Rows = ctType.Rows; + desc.Columns = ctType.Columns; + + UniformType::Enum type = findUniformType(desc); + if (UniformType::Count != type) { - _attrs[_numAttrs] = bgfx::attribToId(ris.m_attr); - ++_numAttrs; + Uniform un; + un.name = '$' == name[0] ? name + 1 : name; + un.type = isSampler(desc.Type) + ? UniformType::Enum(BGFX_UNIFORM_SAMPLERBIT | type) + : type + ; + un.num = (uint8_t)ctType.Elements; + un.regIndex = ctInfo.RegisterIndex; + un.regCount = ctInfo.RegisterCount; + + _uniforms.push_back(un); } } - } - BX_TRACE("Output:"); - for (uint32_t ii = 0; ii < desc.OutputParameters; ++ii) - { - D3D11_SIGNATURE_PARAMETER_DESC spd; - reflect->GetOutputParameterDesc(ii, &spd); - BX_TRACE("\t%2d: %s%d, %d, %d", ii, spd.SemanticName, spd.SemanticIndex, spd.SystemValueType, spd.ComponentType); + return true; } - for (uint32_t ii = 0, num = bx::uint32_min(1, desc.ConstantBuffers); ii < num; ++ii) + bool getReflectionDataD3D11(ID3DBlob* _code, bool _vshader, UniformArray& _uniforms, uint8_t& _numAttrs, uint16_t* _attrs, uint16_t& _size, UniformNameList& unusedUniforms) { - ID3D11ShaderReflectionConstantBuffer* cbuffer = reflect->GetConstantBufferByIndex(ii); - D3D11_SHADER_BUFFER_DESC bufferDesc; - hr = cbuffer->GetDesc(&bufferDesc); + ID3D11ShaderReflection* reflect = NULL; + HRESULT hr = D3DReflect(_code->GetBufferPointer() + , _code->GetBufferSize() + , s_compiler->IID_ID3D11ShaderReflection + , (void**)&reflect + ); + if (FAILED(hr) ) + { + fprintf(stderr, "Error: D3DReflect failed 0x%08x\n", (uint32_t)hr); + return false; + } + + D3D11_SHADER_DESC desc; + hr = reflect->GetDesc(&desc); + if (FAILED(hr) ) + { + fprintf(stderr, "Error: ID3D11ShaderReflection::GetDesc failed 0x%08x\n", (uint32_t)hr); + return false; + } + + BX_TRACE("Creator: %s 0x%08x", desc.Creator, desc.Version); + BX_TRACE("Num constant buffers: %d", desc.ConstantBuffers); - _size = (uint16_t)bufferDesc.Size; + BX_TRACE("Input:"); - if (SUCCEEDED(hr) ) + if (_vshader) // Only care about input semantic on vertex shaders { - BX_TRACE("%s, %d, vars %d, size %d" - , bufferDesc.Name - , bufferDesc.Type - , bufferDesc.Variables - , bufferDesc.Size - ); + for (uint32_t ii = 0; ii < desc.InputParameters; ++ii) + { + D3D11_SIGNATURE_PARAMETER_DESC spd; + reflect->GetInputParameterDesc(ii, &spd); + BX_TRACE("\t%2d: %s%d, vt %d, ct %d, mask %x, reg %d" + , ii + , spd.SemanticName + , spd.SemanticIndex + , spd.SystemValueType + , spd.ComponentType + , spd.Mask + , spd.Register + ); - for (uint32_t jj = 0; jj < bufferDesc.Variables; ++jj) + const RemapInputSemantic& ris = findInputSemantic(spd.SemanticName, spd.SemanticIndex); + if (ris.m_attr != bgfx::Attrib::Count) + { + _attrs[_numAttrs] = bgfx::attribToId(ris.m_attr); + ++_numAttrs; + } + } + } + + BX_TRACE("Output:"); + for (uint32_t ii = 0; ii < desc.OutputParameters; ++ii) + { + D3D11_SIGNATURE_PARAMETER_DESC spd; + reflect->GetOutputParameterDesc(ii, &spd); + BX_TRACE("\t%2d: %s%d, %d, %d", ii, spd.SemanticName, spd.SemanticIndex, spd.SystemValueType, spd.ComponentType); + } + + for (uint32_t ii = 0, num = bx::uint32_min(1, desc.ConstantBuffers); ii < num; ++ii) + { + ID3D11ShaderReflectionConstantBuffer* cbuffer = reflect->GetConstantBufferByIndex(ii); + D3D11_SHADER_BUFFER_DESC bufferDesc; + hr = cbuffer->GetDesc(&bufferDesc); + + _size = (uint16_t)bufferDesc.Size; + + if (SUCCEEDED(hr) ) { - ID3D11ShaderReflectionVariable* var = cbuffer->GetVariableByIndex(jj); - ID3D11ShaderReflectionType* type = var->GetType(); - D3D11_SHADER_VARIABLE_DESC varDesc; - hr = var->GetDesc(&varDesc); - if (SUCCEEDED(hr) ) + BX_TRACE("%s, %d, vars %d, size %d" + , bufferDesc.Name + , bufferDesc.Type + , bufferDesc.Variables + , bufferDesc.Size + ); + + for (uint32_t jj = 0; jj < bufferDesc.Variables; ++jj) { - D3D11_SHADER_TYPE_DESC constDesc; - hr = type->GetDesc(&constDesc); + ID3D11ShaderReflectionVariable* var = cbuffer->GetVariableByIndex(jj); + ID3D11ShaderReflectionType* type = var->GetType(); + D3D11_SHADER_VARIABLE_DESC varDesc; + hr = var->GetDesc(&varDesc); if (SUCCEEDED(hr) ) { - UniformType::Enum uniformType = findUniformType(constDesc); - - if (UniformType::Count != uniformType - && 0 != (varDesc.uFlags & D3D_SVF_USED) ) + D3D11_SHADER_TYPE_DESC constDesc; + hr = type->GetDesc(&constDesc); + if (SUCCEEDED(hr) ) { - Uniform un; - un.name = varDesc.Name; - un.type = uniformType; - un.num = constDesc.Elements; - un.regIndex = varDesc.StartOffset; - un.regCount = BX_ALIGN_16(varDesc.Size) / 16; - _uniforms.push_back(un); - - BX_TRACE("\t%s, %d, size %d, flags 0x%08x, %d (used)" - , varDesc.Name - , varDesc.StartOffset - , varDesc.Size - , varDesc.uFlags - , uniformType - ); - } - else - { - if (0 == (varDesc.uFlags & D3D_SVF_USED) ) + UniformType::Enum uniformType = findUniformType(constDesc); + + if (UniformType::Count != uniformType + && 0 != (varDesc.uFlags & D3D_SVF_USED) ) { - unusedUniforms.push_back(varDesc.Name); + Uniform un; + un.name = varDesc.Name; + un.type = uniformType; + un.num = constDesc.Elements; + un.regIndex = varDesc.StartOffset; + un.regCount = BX_ALIGN_16(varDesc.Size) / 16; + _uniforms.push_back(un); + + BX_TRACE("\t%s, %d, size %d, flags 0x%08x, %d (used)" + , varDesc.Name + , varDesc.StartOffset + , varDesc.Size + , varDesc.uFlags + , uniformType + ); } + else + { + if (0 == (varDesc.uFlags & D3D_SVF_USED) ) + { + unusedUniforms.push_back(varDesc.Name); + } - BX_TRACE("\t%s, unknown type", varDesc.Name); + BX_TRACE("\t%s, unknown type", varDesc.Name); + } } } } } } - } - - BX_TRACE("Bound:"); - for (uint32_t ii = 0; ii < desc.BoundResources; ++ii) - { - D3D11_SHADER_INPUT_BIND_DESC bindDesc; - hr = reflect->GetResourceBindingDesc(ii, &bindDesc); - if (SUCCEEDED(hr) ) + BX_TRACE("Bound:"); + for (uint32_t ii = 0; ii < desc.BoundResources; ++ii) { - if (D3D_SIT_SAMPLER == bindDesc.Type) - { - BX_TRACE("\t%s, %d, %d, %d" - , bindDesc.Name - , bindDesc.Type - , bindDesc.BindPoint - , bindDesc.BindCount - ); + D3D11_SHADER_INPUT_BIND_DESC bindDesc; - const char * end = strstr(bindDesc.Name, "Sampler"); - if (NULL != end) + hr = reflect->GetResourceBindingDesc(ii, &bindDesc); + if (SUCCEEDED(hr) ) + { + if (D3D_SIT_SAMPLER == bindDesc.Type) { - Uniform un; - un.name.assign(bindDesc.Name, (end - bindDesc.Name) ); - un.type = UniformType::Enum(BGFX_UNIFORM_SAMPLERBIT | UniformType::Int1); - un.num = 1; - un.regIndex = bindDesc.BindPoint; - un.regCount = bindDesc.BindCount; - _uniforms.push_back(un); + BX_TRACE("\t%s, %d, %d, %d" + , bindDesc.Name + , bindDesc.Type + , bindDesc.BindPoint + , bindDesc.BindCount + ); + + const char * end = strstr(bindDesc.Name, "Sampler"); + if (NULL != end) + { + Uniform un; + un.name.assign(bindDesc.Name, (end - bindDesc.Name) ); + un.type = UniformType::Enum(BGFX_UNIFORM_SAMPLERBIT | UniformType::Int1); + un.num = 1; + un.regIndex = bindDesc.BindPoint; + un.regCount = bindDesc.BindCount; + _uniforms.push_back(un); + } } } } - } - - if (NULL != reflect) - { - reflect->Release(); - } - - return true; -} -bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool _firstPass) -{ - BX_TRACE("DX11"); + if (NULL != reflect) + { + reflect->Release(); + } - const char* profile = _cmdLine.findOption('p', "profile"); - if (NULL == profile) - { - fprintf(stderr, "Shader profile must be specified.\n"); - return false; + return true; } - bool debug = _cmdLine.hasArg('\0', "debug"); - - uint32_t flags = D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY; - flags |= debug ? D3DCOMPILE_DEBUG : 0; - flags |= _cmdLine.hasArg('\0', "avoid-flow-control") ? D3DCOMPILE_AVOID_FLOW_CONTROL : 0; - flags |= _cmdLine.hasArg('\0', "no-preshader") ? D3DCOMPILE_NO_PRESHADER : 0; - flags |= _cmdLine.hasArg('\0', "partial-precision") ? D3DCOMPILE_PARTIAL_PRECISION : 0; - flags |= _cmdLine.hasArg('\0', "prefer-flow-control") ? D3DCOMPILE_PREFER_FLOW_CONTROL : 0; - flags |= _cmdLine.hasArg('\0', "backwards-compatibility") ? D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY : 0; + bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool _firstPass) + { + const char* profile = _cmdLine.findOption('p', "profile"); + if (NULL == profile) + { + fprintf(stderr, "Error: Shader profile must be specified.\n"); + return false; + } - bool werror = _cmdLine.hasArg('\0', "Werror"); + s_compiler = load(); - if (werror) - { - flags |= D3DCOMPILE_WARNINGS_ARE_ERRORS; - } + bool result = false; + bool debug = _cmdLine.hasArg('\0', "debug"); - uint32_t optimization = 3; - if (_cmdLine.hasArg(optimization, 'O') ) - { - optimization = bx::uint32_min(optimization, BX_COUNTOF(s_optimizationLevelDx11)-1); - flags |= s_optimizationLevelDx11[optimization]; - } - else - { - flags |= D3DCOMPILE_SKIP_OPTIMIZATION; - } + uint32_t flags = D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY; + flags |= debug ? D3DCOMPILE_DEBUG : 0; + flags |= _cmdLine.hasArg('\0', "avoid-flow-control") ? D3DCOMPILE_AVOID_FLOW_CONTROL : 0; + flags |= _cmdLine.hasArg('\0', "no-preshader") ? D3DCOMPILE_NO_PRESHADER : 0; + flags |= _cmdLine.hasArg('\0', "partial-precision") ? D3DCOMPILE_PARTIAL_PRECISION : 0; + flags |= _cmdLine.hasArg('\0', "prefer-flow-control") ? D3DCOMPILE_PREFER_FLOW_CONTROL : 0; + flags |= _cmdLine.hasArg('\0', "backwards-compatibility") ? D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY : 0; - BX_TRACE("Profile: %s", profile); - BX_TRACE("Flags: 0x%08x", flags); + bool werror = _cmdLine.hasArg('\0', "Werror"); - ID3DBlob* code; - ID3DBlob* errorMsg; + if (werror) + { + flags |= D3DCOMPILE_WARNINGS_ARE_ERRORS; + } - // Output preprocessed shader so that HLSL can be debugged via GPA - // or PIX. Compiling through memory won't embed preprocessed shader - // file path. - std::string hlslfp; + uint32_t optimization = 3; + if (_cmdLine.hasArg(optimization, 'O') ) + { + optimization = bx::uint32_min(optimization, BX_COUNTOF(s_optimizationLevelD3D11) - 1); + flags |= s_optimizationLevelD3D11[optimization]; + } + else + { + flags |= D3DCOMPILE_SKIP_OPTIMIZATION; + } - if (debug) - { - hlslfp = _cmdLine.findOption('o'); - hlslfp += ".hlsl"; - writeFile(hlslfp.c_str(), _code.c_str(), (int32_t)_code.size() ); - } + BX_TRACE("Profile: %s", profile); + BX_TRACE("Flags: 0x%08x", flags); - HRESULT hr = D3DCompile(_code.c_str() - , _code.size() - , hlslfp.c_str() - , NULL - , NULL - , "main" - , profile - , flags - , 0 - , &code - , &errorMsg - ); - if (FAILED(hr) - || (werror && NULL != errorMsg) ) - { - const char* log = (char*)errorMsg->GetBufferPointer(); + ID3DBlob* code; + ID3DBlob* errorMsg; - int32_t line = 0; - int32_t column = 0; - int32_t start = 0; - int32_t end = INT32_MAX; + // Output preprocessed shader so that HLSL can be debugged via GPA + // or PIX. Compiling through memory won't embed preprocessed shader + // file path. + std::string hlslfp; - if (2 == sscanf(log, "(%u,%u):", &line, &column) - && 0 != line) + if (debug) { - start = bx::uint32_imax(1, line-10); - end = start + 20; + hlslfp = _cmdLine.findOption('o'); + hlslfp += ".hlsl"; + writeFile(hlslfp.c_str(), _code.c_str(), (int32_t)_code.size() ); } - printCode(_code.c_str(), line, start, end); - fprintf(stderr, "Error: 0x%08x %s\n", (uint32_t)hr, log); - errorMsg->Release(); - return false; - } + HRESULT hr = D3DCompile(_code.c_str() + , _code.size() + , hlslfp.c_str() + , NULL + , NULL + , "main" + , profile + , flags + , 0 + , &code + , &errorMsg + ); + if (FAILED(hr) + || (werror && NULL != errorMsg) ) + { + const char* log = (char*)errorMsg->GetBufferPointer(); - UniformArray uniforms; - uint8_t numAttrs = 0; - uint16_t attrs[bgfx::Attrib::Count]; - uint16_t size = 0; + int32_t line = 0; + int32_t column = 0; + int32_t start = 0; + int32_t end = INT32_MAX; - if (_d3d == 9) - { - if (!getReflectionDataDx9(code, uniforms) ) - { + if (2 == sscanf(log, "(%u,%u):", &line, &column) + && 0 != line) + { + start = bx::uint32_imax(1, line - 10); + end = start + 20; + } + + printCode(_code.c_str(), line, start, end); + fprintf(stderr, "Error: D3DCompile failed 0x%08x %s\n", (uint32_t)hr, log); + errorMsg->Release(); return false; } - } - else - { - UniformNameList unusedUniforms; - if (!getReflectionDataDx11(code, profile[0] == 'v', uniforms, numAttrs, attrs, size, unusedUniforms) ) + + UniformArray uniforms; + uint8_t numAttrs = 0; + uint16_t attrs[bgfx::Attrib::Count]; + uint16_t size = 0; + + if (_d3d == 9) { - return false; + if (!getReflectionDataD3D9(code, uniforms) ) + { + fprintf(stderr, "Error: Unable to get D3D9 reflection data.\n"); + goto error; + } } - - if (_firstPass - && unusedUniforms.size() > 0) + else { - const size_t strLength = strlen("uniform"); + UniformNameList unusedUniforms; + if (!getReflectionDataD3D11(code, profile[0] == 'v', uniforms, numAttrs, attrs, size, unusedUniforms) ) + { + fprintf(stderr, "Unable to get D3D11 reflection data.\n"); + goto error; + } - // first time through, we just find unused uniforms and get rid of them - std::string output; - LineReader reader(_code.c_str() ); - while (!reader.isEof() ) + if (_firstPass + && unusedUniforms.size() > 0) { - std::string line = reader.getLine(); - for (UniformNameList::iterator it = unusedUniforms.begin(), itEnd = unusedUniforms.end(); it != itEnd; ++it) + const size_t strLength = strlen("uniform"); + + // first time through, we just find unused uniforms and get rid of them + std::string output; + LineReader reader(_code.c_str() ); + while (!reader.isEof() ) { - size_t index = line.find("uniform "); - if (index == std::string::npos) + std::string line = reader.getLine(); + for (UniformNameList::iterator it = unusedUniforms.begin(), itEnd = unusedUniforms.end(); it != itEnd; ++it) { - continue; - } + size_t index = line.find("uniform "); + if (index == std::string::npos) + { + continue; + } - // matching lines like: uniform u_name; - // we want to replace "uniform" with "static" so that it's no longer - // included in the uniform blob that the application must upload - // we can't just remove them, because unused functions might still reference - // them and cause a compile error when they're gone - if (!!bx::findIdentifierMatch(line.c_str(), it->c_str() ) ) - { - line = line.replace(index, strLength, "static"); - unusedUniforms.erase(it); - break; + // matching lines like: uniform u_name; + // we want to replace "uniform" with "static" so that it's no longer + // included in the uniform blob that the application must upload + // we can't just remove them, because unused functions might still reference + // them and cause a compile error when they're gone + if (!!bx::findIdentifierMatch(line.c_str(), it->c_str() ) ) + { + line = line.replace(index, strLength, "static"); + unusedUniforms.erase(it); + break; + } } + + output += line; } - output += line; + // recompile with the unused uniforms converted to statics + return compileHLSLShader(_cmdLine, _d3d, output.c_str(), _writer, false); } - - // recompile with the unused uniforms converted to statics - return compileHLSLShader(_cmdLine, _d3d, output.c_str(), _writer, false); } - } - uint16_t count = (uint16_t)uniforms.size(); - bx::write(_writer, count); + { + uint16_t count = (uint16_t)uniforms.size(); + bx::write(_writer, count); - uint32_t fragmentBit = profile[0] == 'p' ? BGFX_UNIFORM_FRAGMENTBIT : 0; - for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it) - { - const Uniform& un = *it; - uint8_t nameSize = (uint8_t)un.name.size(); - bx::write(_writer, nameSize); - bx::write(_writer, un.name.c_str(), nameSize); - uint8_t type = un.type|fragmentBit; - bx::write(_writer, type); - bx::write(_writer, un.num); - bx::write(_writer, un.regIndex); - bx::write(_writer, un.regCount); - - BX_TRACE("%s, %s, %d, %d, %d" - , un.name.c_str() - , getUniformTypeName(un.type) - , un.num - , un.regIndex - , un.regCount - ); - } + uint32_t fragmentBit = profile[0] == 'p' ? BGFX_UNIFORM_FRAGMENTBIT : 0; + for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it) + { + const Uniform& un = *it; + uint8_t nameSize = (uint8_t)un.name.size(); + bx::write(_writer, nameSize); + bx::write(_writer, un.name.c_str(), nameSize); + uint8_t type = un.type | fragmentBit; + bx::write(_writer, type); + bx::write(_writer, un.num); + bx::write(_writer, un.regIndex); + bx::write(_writer, un.regCount); + + BX_TRACE("%s, %s, %d, %d, %d" + , un.name.c_str() + , getUniformTypeName(un.type) + , un.num + , un.regIndex + , un.regCount + ); + } + } - { - ID3DBlob* stripped; - hr = D3DStripShader(code->GetBufferPointer() - , code->GetBufferSize() - , D3DCOMPILER_STRIP_REFLECTION_DATA - | D3DCOMPILER_STRIP_TEST_BLOBS - , &stripped - ); + { + ID3DBlob* stripped; + hr = D3DStripShader(code->GetBufferPointer() + , code->GetBufferSize() + , D3DCOMPILER_STRIP_REFLECTION_DATA + | D3DCOMPILER_STRIP_TEST_BLOBS + , &stripped + ); + + if (SUCCEEDED(hr) ) + { + code->Release(); + code = stripped; + } + } - if (SUCCEEDED(hr) ) { - code->Release(); - code = stripped; + uint16_t shaderSize = (uint16_t)code->GetBufferSize(); + bx::write(_writer, shaderSize); + bx::write(_writer, code->GetBufferPointer(), shaderSize); + uint8_t nul = 0; + bx::write(_writer, nul); } - } - uint16_t shaderSize = (uint16_t)code->GetBufferSize(); - bx::write(_writer, shaderSize); - bx::write(_writer, code->GetBufferPointer(), shaderSize); - uint8_t nul = 0; - bx::write(_writer, nul); + if (_d3d > 9) + { + bx::write(_writer, numAttrs); + bx::write(_writer, attrs, numAttrs*sizeof(uint16_t) ); - if (_d3d > 9) - { - bx::write(_writer, numAttrs); - bx::write(_writer, attrs, numAttrs*sizeof(uint16_t) ); + bx::write(_writer, size); + } - bx::write(_writer, size); - } + if (_cmdLine.hasArg('\0', "disasm") ) + { + ID3DBlob* disasm; + D3DDisassemble(code->GetBufferPointer() + , code->GetBufferSize() + , 0 + , NULL + , &disasm + ); - if (_cmdLine.hasArg('\0', "disasm") ) - { - ID3DBlob* disasm; - D3DDisassemble(code->GetBufferPointer() - , code->GetBufferSize() - , 0 - , NULL - , &disasm - ); + if (NULL != disasm) + { + std::string disasmfp = _cmdLine.findOption('o'); + disasmfp += ".disasm"; - if (NULL != disasm) - { - std::string disasmfp = _cmdLine.findOption('o'); - disasmfp += ".disasm"; + writeFile(disasmfp.c_str(), disasm->GetBufferPointer(), (uint32_t)disasm->GetBufferSize() ); + disasm->Release(); + } + } - writeFile(disasmfp.c_str(), disasm->GetBufferPointer(), (uint32_t)disasm->GetBufferSize() ); - disasm->Release(); + if (NULL != errorMsg) + { + errorMsg->Release(); } - } - if (NULL != errorMsg) - { - errorMsg->Release(); - } + result = true; - code->Release(); + error: + code->Release(); + unload(); + return result; + } - return true; -} +} // namespace bgfx #else -bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool _firstPass) +namespace bgfx { - BX_UNUSED(_cmdLine, _d3d, _code, _writer, _firstPass); - fprintf(stderr, "HLSL compiler is not supported on this platform.\n"); - return false; -} + + bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool _firstPass) + { + BX_UNUSED(_cmdLine, _d3d, _code, _writer, _firstPass); + fprintf(stderr, "HLSL compiler is not supported on this platform.\n"); + return false; + } + +} // namespace bgfx #endif // SHADERC_CONFIG_HLSL diff --git a/3rdparty/bgfx/tools/texturec/texturec.cpp b/3rdparty/bgfx/tools/texturec/texturec.cpp index 7c66cdd310c..81bccfeb6f6 100644 --- a/3rdparty/bgfx/tools/texturec/texturec.cpp +++ b/3rdparty/bgfx/tools/texturec/texturec.cpp @@ -13,9 +13,11 @@ #include "image.h" #include #include +#include #include #include #include +#include #define STB_IMAGE_IMPLEMENTATION #include @@ -54,7 +56,7 @@ namespace bgfx ::free(mem); } - void imageEncodeFromRgba8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint8_t _format) + bool imageEncodeFromRgba8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint8_t _format) { TextureFormat::Enum format = TextureFormat::Enum(_format); @@ -65,32 +67,52 @@ namespace bgfx case TextureFormat::BC3: case TextureFormat::BC4: case TextureFormat::BC5: - squish::CompressImage(_src, _width, _height, _dst + squish::CompressImage( (const uint8_t*)_src, _width, _height, _dst , format == TextureFormat::BC2 ? squish::kDxt3 : format == TextureFormat::BC3 ? squish::kDxt5 : format == TextureFormat::BC4 ? squish::kBc4 : format == TextureFormat::BC5 ? squish::kBc5 : squish::kDxt1 ); - break; + return true; case TextureFormat::BC6H: - nvtt::compressBC6H(_src, _width, _height, 4, _dst); - break; + nvtt::compressBC6H( (const uint8_t*)_src, _width, _height, 4, _dst); + return true; case TextureFormat::BC7: - nvtt::compressBC7(_src, _width, _height, 4, _dst); - break; + nvtt::compressBC7( (const uint8_t*)_src, _width, _height, 4, _dst); + return true; case TextureFormat::ETC1: - etc1_encode_image(_src, _width, _height, 4, _width*4, _dst); - break; + etc1_encode_image( (const uint8_t*)_src, _width, _height, 4, _width*4, (uint8_t*)_dst); + return true; case TextureFormat::ETC2: - case TextureFormat::ETC2A: - case TextureFormat::ETC2A1: - case TextureFormat::PTC12: - break; + { + const uint32_t blockWidth = (_width +3)/4; + const uint32_t blockHeight = (_height+3)/4; + const uint32_t pitch = _width*4; + const uint8_t* src = (const uint8_t*)_src; + uint64_t* dst = (uint64_t*)_dst; + for (uint32_t yy = 0; yy < blockHeight; ++yy) + { + for (uint32_t xx = 0; xx < blockWidth; ++xx) + { + uint8_t block[4*4*4]; + const uint8_t* ptr = &src[(yy*pitch+xx*4)*4]; + + for (uint32_t ii = 0; ii < 16; ++ii) + { // BGRx + memcpy(&block[ii*4], &ptr[(ii%4)*pitch + (ii&~3)], 4); + bx::xchg(block[ii*4+0], block[ii*4+2]); + } + + *dst++ = ProcessRGB_ETC2(block); + } + } + } + return true; case TextureFormat::PTC14: { @@ -98,14 +120,11 @@ namespace bgfx RgbBitmap bmp; bmp.width = _width; bmp.height = _height; - bmp.data = const_cast(_src); + bmp.data = (uint8_t*)const_cast(_src); PvrTcEncoder::EncodeRgb4Bpp(_dst, bmp); bmp.data = NULL; } - break; - - case TextureFormat::PTC12A: - break; + return true; case TextureFormat::PTC14A: { @@ -113,27 +132,186 @@ namespace bgfx RgbaBitmap bmp; bmp.width = _width; bmp.height = _height; - bmp.data = const_cast(_src); + bmp.data = (uint8_t*)const_cast(_src); PvrTcEncoder::EncodeRgba4Bpp(_dst, bmp); bmp.data = NULL; } - break; - - case TextureFormat::PTC22: - case TextureFormat::PTC24: - break; + return true; case TextureFormat::BGRA8: imageSwizzleBgra8(_width, _height, _width*4, _src, _dst); - break; + return true; case TextureFormat::RGBA8: memcpy(_dst, _src, _width*_height*4); - break; + return true; default: - break; + return imageConvert(_dst, format, _src, TextureFormat::RGBA8, _width, _height); + } + + return false; + } + + bool imageEncodeFromRgba32f(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint8_t _format) + { + TextureFormat::Enum format = TextureFormat::Enum(_format); + + const uint8_t* src = (const uint8_t*)_src; + + switch (format) + { + case TextureFormat::RGBA8: + { + uint8_t* dst = (uint8_t*)_dst; + for (uint32_t yy = 0; yy < _height; ++yy) + { + for (uint32_t xx = 0; xx < _width; ++xx) + { + const uint32_t offset = yy*_width + xx; + const float* input = (const float*)&src[offset * 16]; + uint8_t* output = &dst[offset * 4]; + output[0] = uint8_t(input[0]*255.0f + 0.5f); + output[1] = uint8_t(input[1]*255.0f + 0.5f); + output[2] = uint8_t(input[2]*255.0f + 0.5f); + output[3] = uint8_t(input[3]*255.0f + 0.5f); + } + } + } + return true; + + case TextureFormat::BC5: + { + uint8_t* temp = (uint8_t*)BX_ALLOC(_allocator, _width*_height*4); + for (uint32_t yy = 0; yy < _height; ++yy) + { + for (uint32_t xx = 0; xx < _width; ++xx) + { + const uint32_t offset = yy*_width + xx; + const float* input = (const float*)&src[offset * 16]; + uint8_t* output = &temp[offset * 4]; + output[0] = uint8_t(input[0]*255.0f + 0.5f); + output[1] = uint8_t(input[1]*255.0f + 0.5f); + output[2] = uint8_t(input[2]*255.0f + 0.5f); + output[3] = uint8_t(input[3]*255.0f + 0.5f); + } + } + + imageEncodeFromRgba8(_dst, temp, _width, _height, _format); + BX_FREE(_allocator, temp); + } + return true; + + default: + return imageConvert(_dst, format, _src, TextureFormat::RGBA32F, _width, _height); + } + + return false; + } + + void imageRgba32f11to01(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) + { + const uint8_t* src = (const uint8_t*)_src; + uint8_t* dst = (uint8_t*)_dst; + + for (uint32_t yy = 0; yy < _height; ++yy) + { + for (uint32_t xx = 0; xx < _width; ++xx) + { + const uint32_t offset = yy*_pitch + xx * 16; + const float* input = (const float*)&src[offset]; + float* output = (float*)&dst[offset]; + output[0] = input[0]*0.5f + 0.5f; + output[1] = input[1]*0.5f + 0.5f; + output[2] = input[2]*0.5f + 0.5f; + output[3] = input[3]*0.5f + 0.5f; + } + } + } + + static void edtaa3(bx::AllocatorI* _allocator, double* _dst, uint32_t _width, uint32_t _height, double* _src) + { + const uint32_t numPixels = _width*_height; + + short* xdist = (short *)BX_ALLOC(_allocator, numPixels*sizeof(short) ); + short* ydist = (short *)BX_ALLOC(_allocator, numPixels*sizeof(short) ); + double* gx = (double*)BX_ALLOC(_allocator, numPixels*sizeof(double) ); + double* gy = (double*)BX_ALLOC(_allocator, numPixels*sizeof(double) ); + + ::computegradient(_src, _width, _height, gx, gy); + ::edtaa3(_src, gx, gy, _width, _height, xdist, ydist, _dst); + + for (uint32_t ii = 0; ii < numPixels; ++ii) + { + if (_dst[ii] < 0.0) + { + _dst[ii] = 0.0; + } } + + BX_FREE(_allocator, xdist); + BX_FREE(_allocator, ydist); + BX_FREE(_allocator, gx); + BX_FREE(_allocator, gy); + } + + inline double min(double _a, double _b) + { + return _a > _b ? _b : _a; + } + + inline double max(double _a, double _b) + { + return _a > _b ? _a : _b; + } + + inline double clamp(double _val, double _min, double _max) + { + return max(min(_val, _max), _min); + } + + void imageMakeDist(bx::AllocatorI* _allocator, void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, float _edge, const void* _src) + { + const uint32_t numPixels = _width*_height; + + double* imgIn = (double*)BX_ALLOC(_allocator, numPixels*sizeof(double) ); + double* outside = (double*)BX_ALLOC(_allocator, numPixels*sizeof(double) ); + double* inside = (double*)BX_ALLOC(_allocator, numPixels*sizeof(double) ); + + for (uint32_t yy = 0; yy < _height; ++yy) + { + const uint8_t* src = (const uint8_t*)_src + yy*_pitch; + double* dst = &imgIn[yy*_width]; + for (uint32_t xx = 0; xx < _width; ++xx) + { + dst[xx] = double(src[xx])/255.0; + } + } + + edtaa3(_allocator, outside, _width, _height, imgIn); + + for (uint32_t ii = 0; ii < numPixels; ++ii) + { + imgIn[ii] = 1.0 - imgIn[ii]; + } + + edtaa3(_allocator, inside, _width, _height, imgIn); + + BX_FREE(_allocator, imgIn); + + uint8_t* dst = (uint8_t*)_dst; + + double edgeOffset = _edge*0.5; + double invEdge = 1.0/_edge; + + for (uint32_t ii = 0; ii < numPixels; ++ii) + { + double dist = clamp( ( (outside[ii] - inside[ii])+edgeOffset) * invEdge, 0.0, 1.0); + dst[ii] = 255-uint8_t(dist * 255.0); + } + + BX_FREE(_allocator, inside); + BX_FREE(_allocator, outside); } } // namespace bgfx @@ -168,6 +346,8 @@ void help(const char* _error = NULL) " -o Output file path (file will be written in KTX format).\n" " -t Output format type (BC1/2/3/4/5, ETC1, PVR14, etc.).\n" " -m, --mips Generate mip-maps.\n" + " -n, --normalmap Input texture is normal map.\n" + " --sdf Compute SDF texture.\n" "\n" "For additional information, see https://github.com/bkaradzic/bgfx\n" @@ -198,14 +378,23 @@ int main(int _argc, const char* _argv[]) return EXIT_FAILURE; } + bool sdf = false; + double edge = 16.0; + const char* edgeOpt = cmdLine.findOption("sdf"); + if (NULL != edgeOpt) + { + sdf = true; + edge = atof(edgeOpt); + } + BX_UNUSED(sdf, edge); + bx::CrtFileReader reader; - if (0 != bx::open(&reader, inputFileName) ) + if (!bx::open(&reader, inputFileName) ) { help("Failed to open input file."); return EXIT_FAILURE; } - const bool mips = cmdLine.hasArg('m', "mips"); const char* type = cmdLine.findOption('t'); bgfx::TextureFormat::Enum format = bgfx::TextureFormat::BGRA8; @@ -220,6 +409,9 @@ int main(int _argc, const char* _argv[]) } } + const bool mips = cmdLine.hasArg('m', "mips"); + const bool normalMap = cmdLine.hasArg('n', "normalmap"); + uint32_t size = (uint32_t)bx::getSize(&reader); const bgfx::Memory* mem = bgfx::alloc(size); bx::read(&reader, mem->data, mem->size); @@ -271,46 +463,99 @@ int main(int _argc, const char* _argv[]) ImageMip mip; if (imageGetRawData(imageContainer, 0, 0, mem->data, mem->size, mip) ) { - uint32_t size = imageGetSize(TextureFormat::RGBA8, mip.m_width, mip.m_height); - uint8_t* rgba = (uint8_t*)BX_ALLOC(&allocator, size); - - imageDecodeToRgba8(rgba - , mip.m_data - , mip.m_width - , mip.m_height - , mip.m_width*mip.m_bpp/8 - , mip.m_format - ); - uint8_t numMips = mips ? imageGetNumMips(format, mip.m_width, mip.m_height) : 1 ; - imageContainer.m_size = imageGetSize(format, mip.m_width, mip.m_height, 0, false, numMips); - imageContainer.m_format = format; - output = alloc(imageContainer.m_size); - imageEncodeFromRgba8(output->data, rgba, mip.m_width, mip.m_height, format); + void* temp = NULL; + + if (normalMap) + { + uint32_t size = imageGetSize(TextureFormat::RGBA32F, mip.m_width, mip.m_height); + temp = BX_ALLOC(&allocator, size); + float* rgba = (float*)temp; + float* rgbaDst = (float*)BX_ALLOC(&allocator, size); + + imageDecodeToRgba32f(&allocator + , rgba + , mip.m_data + , mip.m_width + , mip.m_height + , mip.m_width*mip.m_bpp/8 + , mip.m_format + ); + + if (TextureFormat::BC5 != mip.m_format) + { + for (uint32_t yy = 0; yy < mip.m_height; ++yy) + { + for (uint32_t xx = 0; xx < mip.m_width; ++xx) + { + const uint32_t offset = (yy*mip.m_width + xx) * 4; + float* inout = &rgba[offset]; + inout[0] = inout[0] * 2.0f/255.0f - 1.0f; + inout[1] = inout[1] * 2.0f/255.0f - 1.0f; + inout[2] = inout[2] * 2.0f/255.0f - 1.0f; + inout[3] = inout[3] * 2.0f/255.0f - 1.0f; + } + } + } + + output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, false, mips); + + imageRgba32f11to01(rgbaDst, mip.m_width, mip.m_height, mip.m_width*16, rgba); + imageEncodeFromRgba32f(&allocator, output->data, rgbaDst, mip.m_width, mip.m_height, format); - for (uint8_t lod = 1; lod < numMips; ++lod) + for (uint8_t lod = 1; lod < numMips; ++lod) + { + imageRgba32fDownsample2x2NormalMap(mip.m_width, mip.m_height, mip.m_width*16, rgba, rgba); + imageRgba32f11to01(rgbaDst, mip.m_width, mip.m_height, mip.m_width*16, rgba); + + ImageMip dstMip; + imageGetRawData(imageContainer, 0, lod, output->data, output->size, dstMip); + uint8_t* data = const_cast(dstMip.m_data); + imageEncodeFromRgba32f(&allocator, data, rgbaDst, dstMip.m_width, dstMip.m_height, format); + } + + BX_FREE(&allocator, rgbaDst); + } + else { - ImageMip mip1; - imageGetRawData(imageContainer, 0, lod, output->data, output->size, mip1); - uint8_t* data = const_cast(mip1.m_data); - - uint32_t width = bx::uint32_max(1, mip.m_width >>lod); - uint32_t height = bx::uint32_max(1, mip.m_height>>lod); - imageRgba8Downsample2x2(width, height, width*4, rgba, rgba); - imageEncodeFromRgba8(data, rgba, mip.m_width, mip.m_height, format); + uint32_t size = imageGetSize(TextureFormat::RGBA8, mip.m_width, mip.m_height); + temp = BX_ALLOC(&allocator, size); + uint8_t* rgba = (uint8_t*)temp; + + imageDecodeToRgba8(rgba + , mip.m_data + , mip.m_width + , mip.m_height + , mip.m_width*mip.m_bpp/8 + , mip.m_format + ); + + output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, false, mips); + + imageEncodeFromRgba8(output->data, rgba, mip.m_width, mip.m_height, format); + + for (uint8_t lod = 1; lod < numMips; ++lod) + { + imageRgba8Downsample2x2(mip.m_width, mip.m_height, mip.m_width*4, rgba, rgba); + + ImageMip dstMip; + imageGetRawData(imageContainer, 0, lod, output->data, output->size, dstMip); + uint8_t* data = const_cast(dstMip.m_data); + imageEncodeFromRgba8(data, rgba, dstMip.m_width, dstMip.m_height, format); + } } - BX_FREE(&allocator, rgba); + BX_FREE(&allocator, temp); } if (NULL != output) { bx::CrtFileWriter writer; - if (0 == bx::open(&writer, outputFileName) ) + if (bx::open(&writer, outputFileName) ) { if (NULL != bx::stristr(outputFileName, ".ktx") ) { @@ -319,8 +564,13 @@ int main(int _argc, const char* _argv[]) bx::close(&writer); } + else + { + help("Failed to open output file."); + return EXIT_FAILURE; + } - release(output); + imageFree(output); } } diff --git a/3rdparty/bx/.appveyor.yml b/3rdparty/bx/.appveyor.yml new file mode 100644 index 00000000000..286a3c9cc3b --- /dev/null +++ b/3rdparty/bx/.appveyor.yml @@ -0,0 +1,21 @@ +shallow_clone: true + +os: + - Visual Studio 2015 + +environment: + matrix: + - TOOLSET: vs2010 + - TOOLSET: vs2012 + - TOOLSET: vs2013 + - TOOLSET: vs2015 + +configuration: + - Debug + - Release + +install: + tools\bin\windows\genie %TOOLSET% + +build: + project: .build/projects/$(TOOLSET)/bx.sln diff --git a/3rdparty/bx/.travis.yml b/3rdparty/bx/.travis.yml new file mode 100644 index 00000000000..7b8e2d62283 --- /dev/null +++ b/3rdparty/bx/.travis.yml @@ -0,0 +1,20 @@ +language: cpp +matrix: + include: + - compiler: gcc + os: linux + - compiler: clang + os: osx + +script: + make test + +branches: + only: + - master + +notifications: + email: false + +osx_image: + xcode61 diff --git a/3rdparty/bx/README.md b/3rdparty/bx/README.md index c864c84fbab..88cb1bf55ac 100644 --- a/3rdparty/bx/README.md +++ b/3rdparty/bx/README.md @@ -3,6 +3,9 @@ bx Base library. +[![Build Status](https://travis-ci.org/bkaradzic/bx.svg?branch=master)](https://travis-ci.org/bkaradzic/bx) +[![Build status](https://ci.appveyor.com/api/projects/status/edras3mltmoy31g5?svg=true)](https://ci.appveyor.com/project/bkaradzic/bx) + Contact ------- diff --git a/3rdparty/bx/include/bx/bx.h b/3rdparty/bx/include/bx/bx.h index 7ada4b2b970..80e9b765e10 100644 --- a/3rdparty/bx/include/bx/bx.h +++ b/3rdparty/bx/include/bx/bx.h @@ -8,6 +8,7 @@ #include // uint32_t #include // size_t +#include // memcpy #include "config.h" #include "macros.h" @@ -52,6 +53,32 @@ namespace bx return 0 == (un.addr & (_align-1) ); } + /// Scatter/gather memcpy. + inline void memCopy(void* _dst, const void* _src, uint32_t _size, uint32_t _num, uint32_t _srcPitch, uint32_t _dstPitch) + { + const uint8_t* src = (const uint8_t*)_src; + uint8_t* dst = (uint8_t*)_dst; + + for (uint32_t ii = 0; ii < _num; ++ii) + { + memcpy(dst, src, _size); + src += _srcPitch; + dst += _dstPitch; + } + } + + /// + inline void gather(void* _dst, const void* _src, uint32_t _size, uint32_t _num, uint32_t _srcPitch) + { + memCopy(_dst, _src, _size, _num, _srcPitch, _size); + } + + /// + inline void scatter(void* _dst, const void* _src, uint32_t _size, uint32_t _num, uint32_t _dstPitch) + { + memCopy(_dst, _src, _size, _num, _size, _dstPitch); + } + } // namespace bx // Annoying C++0x stuff.. diff --git a/3rdparty/bx/include/bx/config.h b/3rdparty/bx/include/bx/config.h index 3837193e19a..6b8cfe45a7f 100644 --- a/3rdparty/bx/include/bx/config.h +++ b/3rdparty/bx/include/bx/config.h @@ -30,6 +30,7 @@ || BX_PLATFORM_OSX \ || BX_PLATFORM_QNX \ || BX_PLATFORM_RPI \ + || BX_PLATFORM_STEAMLINK \ || BX_PLATFORM_WINDOWS \ || BX_PLATFORM_WINRT \ ? 1 : 0) diff --git a/3rdparty/bx/include/bx/error.h b/3rdparty/bx/include/bx/error.h new file mode 100644 index 00000000000..d98a111f5af --- /dev/null +++ b/3rdparty/bx/include/bx/error.h @@ -0,0 +1,111 @@ +/* + * Copyright 2010-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause + */ + +#ifndef BX_ERROR_H_HEADER_GUARD +#define BX_ERROR_H_HEADER_GUARD + +#include "bx.h" + +#define BX_ERROR_SET(_ptr, _result, _msg) \ + BX_MACRO_BLOCK_BEGIN \ + BX_TRACE("Error %d: %s", _result.code, "" _msg); \ + _ptr->setError(_result, "" _msg); \ + BX_MACRO_BLOCK_END + +#define BX_ERROR_USE_TEMP_WHEN_NULL(_ptr) \ + const bx::Error tmpError; /* It should not be used directly! */ \ + _ptr = NULL == _ptr ? const_cast(&tmpError) : _ptr + +#define BX_ERROR_SCOPE(_ptr) \ + BX_ERROR_USE_TEMP_WHEN_NULL(_ptr); \ + bx::ErrorScope bxErrorScope(const_cast(&tmpError) ) + +#define BX_ERROR_RESULT(_err, _code) \ + BX_STATIC_ASSERT(_code != 0, "ErrorCode 0 is reserved!"); \ + static const bx::ErrorResult _err = { _code } + +namespace bx +{ + /// + struct ErrorResult + { + uint32_t code; + }; + + /// + class Error + { + BX_CLASS(Error + , NO_COPY + , NO_ASSIGNMENT + ); + + public: + Error() + : m_code(0) + { + } + + void setError(ErrorResult _errorResult, const char* _msg) + { + BX_CHECK(0 != _errorResult.code, "Invalid ErrorResult passed to setError!"); + + if (!isOk() ) + { + return; + } + + m_code = _errorResult.code; + m_msg = _msg; + } + + bool isOk() const + { + return 0 == m_code; + } + + ErrorResult get() const + { + ErrorResult result = { m_code }; + return result; + } + + bool operator==(ErrorResult _rhs) const + { + return _rhs.code == m_code; + } + + private: + const char* m_msg; + uint32_t m_code; + }; + + /// + class ErrorScope + { + BX_CLASS(ErrorScope + , NO_COPY + , NO_ASSIGNMENT + ); + + public: + ErrorScope(Error* _err) + : m_err(_err) + { + BX_CHECK(NULL != _err, "_err can't be NULL"); + } + + ~ErrorScope() + { + BX_CHECK(m_err->isOk(), "Error: %d", m_err->get().code); + } + + private: + Error* m_err; + }; + +} // namespace bx + +#endif // BX_ERROR_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/fpumath.h b/3rdparty/bx/include/bx/fpumath.h index 0763f5bcb5f..b76da2f9a31 100644 --- a/3rdparty/bx/include/bx/fpumath.h +++ b/3rdparty/bx/include/bx/fpumath.h @@ -29,9 +29,19 @@ namespace bx return _rad * 180.0f / pi; } + inline float ffloor(float _f) + { + return floorf(_f); + } + + inline float fceil(float _f) + { + return ceilf(_f); + } + inline float fround(float _f) { - return floorf(_f + 0.5f); + return ffloor(_f + 0.5f); } inline float fmin(float _a, float _b) @@ -705,14 +715,14 @@ namespace bx mtxProjRh(_result, _fovy, _aspect, _near, _far, _oglNdc); } - inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f) + inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) { const float aa = 2.0f/(_right - _left); const float bb = 2.0f/(_top - _bottom); - const float cc = 1.0f/(_far - _near); + const float cc = (_oglNdc ? 2.0f : 1.0f) / (_far - _near); const float dd = (_left + _right)/(_left - _right); const float ee = (_top + _bottom)/(_bottom - _top); - const float ff = _near / (_near - _far); + const float ff = _oglNdc ? (_near + _far)/(_near - _far) : _near/(_near - _far); memset(_result, 0, sizeof(float)*16); _result[ 0] = aa; diff --git a/3rdparty/bx/include/bx/handlealloc.h b/3rdparty/bx/include/bx/handlealloc.h index d947256a9e2..7b10209ab2d 100644 --- a/3rdparty/bx/include/bx/handlealloc.h +++ b/3rdparty/bx/include/bx/handlealloc.h @@ -253,7 +253,7 @@ namespace bx } private: - void insertBefore(int16_t _before, uint16_t _handle) + void insertBefore(uint16_t _before, uint16_t _handle) { Link& curr = m_links[_handle]; curr.m_next = _before; diff --git a/3rdparty/bx/include/bx/os.h b/3rdparty/bx/include/bx/os.h index 50fca7f0fbe..074ec0e513c 100644 --- a/3rdparty/bx/include/bx/os.h +++ b/3rdparty/bx/include/bx/os.h @@ -20,16 +20,17 @@ || BX_PLATFORM_NACL \ || BX_PLATFORM_OSX \ || BX_PLATFORM_PS4 \ - || BX_PLATFORM_RPI - + || BX_PLATFORM_RPI \ + || BX_PLATFORM_STEAMLINK # include // sched_yield # if BX_PLATFORM_BSD \ || BX_PLATFORM_IOS \ || BX_PLATFORM_NACL \ || BX_PLATFORM_OSX \ - || BX_PLATFORM_PS4 + || BX_PLATFORM_PS4 \ + || BX_PLATFORM_STEAMLINK # include // mach_port_t -# endif // BX_PLATFORM_IOS || BX_PLATFORM_OSX || BX_PLATFORM_NACL +# endif // BX_PLATFORM_* # if BX_PLATFORM_NACL # include // nanosleep @@ -42,7 +43,9 @@ # if BX_PLATFORM_ANDROID # include // mallinfo -# elif BX_PLATFORM_LINUX || BX_PLATFORM_RPI +# elif BX_PLATFORM_LINUX \ + || BX_PLATFORM_RPI \ + || BX_PLATFORM_STEAMLINK # include // syscall # include # elif BX_PLATFORM_OSX @@ -99,7 +102,7 @@ namespace bx { #if BX_PLATFORM_WINDOWS return ::GetCurrentThreadId(); -#elif BX_PLATFORM_LINUX || BX_PLATFORM_RPI +#elif BX_PLATFORM_LINUX || BX_PLATFORM_RPI || BX_PLATFORM_STEAMLINK return (pid_t)::syscall(SYS_gettid); #elif BX_PLATFORM_IOS || BX_PLATFORM_OSX return (mach_port_t)::pthread_mach_thread_np(pthread_self() ); diff --git a/3rdparty/bx/include/bx/platform.h b/3rdparty/bx/include/bx/platform.h index c41ae0d11be..3f245d5dff9 100644 --- a/3rdparty/bx/include/bx/platform.h +++ b/3rdparty/bx/include/bx/platform.h @@ -22,6 +22,7 @@ #define BX_PLATFORM_PS4 0 #define BX_PLATFORM_QNX 0 #define BX_PLATFORM_RPI 0 +#define BX_PLATFORM_STEAMLINK 0 #define BX_PLATFORM_WINDOWS 0 #define BX_PLATFORM_WINRT 0 #define BX_PLATFORM_XBOX360 0 @@ -152,20 +153,24 @@ # undef BX_PLATFORM_WINRT # define BX_PLATFORM_WINRT 1 # endif -#elif defined(__VCCOREVER__) -// RaspberryPi compiler defines __linux__ -# undef BX_PLATFORM_RPI -# define BX_PLATFORM_RPI 1 -#elif defined(__native_client__) -// NaCl compiler defines __linux__ -# include -# undef BX_PLATFORM_NACL -# define BX_PLATFORM_NACL PPAPI_RELEASE #elif defined(__ANDROID__) // Android compiler defines __linux__ # include # undef BX_PLATFORM_ANDROID # define BX_PLATFORM_ANDROID __ANDROID_API__ +#elif defined(__native_client__) +// NaCl compiler defines __linux__ +# include +# undef BX_PLATFORM_NACL +# define BX_PLATFORM_NACL PPAPI_RELEASE +#elif defined(__STEAMLINK__) +// SteamLink compiler defines __linux__ +# undef BX_PLATFORM_STEAMLINK +# define BX_PLATFORM_STEAMLINK 1 +#elif defined(__VCCOREVER__) +// RaspberryPi compiler defines __linux__ +# undef BX_PLATFORM_RPI +# define BX_PLATFORM_RPI 1 #elif defined(__linux__) # undef BX_PLATFORM_LINUX # define BX_PLATFORM_LINUX 1 @@ -204,6 +209,7 @@ || BX_PLATFORM_NACL \ || BX_PLATFORM_OSX \ || BX_PLATFORM_QNX \ + || BX_PLATFORM_STEAMLINK \ || BX_PLATFORM_PS4 \ || BX_PLATFORM_RPI \ ) @@ -223,15 +229,15 @@ BX_STRINGIZE(__clang_minor__) "." \ BX_STRINGIZE(__clang_patchlevel__) #elif BX_COMPILER_MSVC -# if BX_COMPILER_MSVC >= 1900 +# if BX_COMPILER_MSVC >= 1900 // Visual Studio 2015 # define BX_COMPILER_NAME "MSVC 14.0" -# elif BX_COMPILER_MSVC >= 1800 +# elif BX_COMPILER_MSVC >= 1800 // Visual Studio 2013 # define BX_COMPILER_NAME "MSVC 12.0" -# elif BX_COMPILER_MSVC >= 1700 +# elif BX_COMPILER_MSVC >= 1700 // Visual Studio 2012 # define BX_COMPILER_NAME "MSVC 11.0" -# elif BX_COMPILER_MSVC >= 1600 +# elif BX_COMPILER_MSVC >= 1600 // Visual Studio 2010 # define BX_COMPILER_NAME "MSVC 10.0" -# elif BX_COMPILER_MSVC >= 1500 +# elif BX_COMPILER_MSVC >= 1500 // Visual Studio 2008 # define BX_COMPILER_NAME "MSVC 9.0" # else # define BX_COMPILER_NAME "MSVC" @@ -263,6 +269,8 @@ # define BX_PLATFORM_NAME "QNX" #elif BX_PLATFORM_RPI # define BX_PLATFORM_NAME "RaspberryPi" +#elif BX_PLATFORM_STEAMLINK +# define BX_PLATFORM_NAME "SteamLink" #elif BX_PLATFORM_WINDOWS # define BX_PLATFORM_NAME "Windows" #elif BX_PLATFORM_WINRT diff --git a/3rdparty/bx/include/bx/readerwriter.h b/3rdparty/bx/include/bx/readerwriter.h index c673eed388a..ef8c810a870 100644 --- a/3rdparty/bx/include/bx/readerwriter.h +++ b/3rdparty/bx/include/bx/readerwriter.h @@ -12,6 +12,7 @@ #include "bx.h" #include "allocator.h" +#include "error.h" #include "uint32_t.h" #if BX_COMPILER_MSVC_COMPATIBLE @@ -22,6 +23,10 @@ # define ftello64 ftello #endif // BX_ +BX_ERROR_RESULT(BX_ERROR_READERWRITER_OPEN, BX_MAKEFOURCC('R', 'W', 0, 1) ); +BX_ERROR_RESULT(BX_ERROR_READERWRITER_READ, BX_MAKEFOURCC('R', 'W', 0, 2) ); +BX_ERROR_RESULT(BX_ERROR_READERWRITER_WRITE, BX_MAKEFOURCC('R', 'W', 0, 3) ); + namespace bx { struct Whence @@ -37,7 +42,7 @@ namespace bx struct BX_NO_VTABLE ReaderI { virtual ~ReaderI() = 0; - virtual int32_t read(void* _data, int32_t _size) = 0; + virtual int32_t read(void* _data, int32_t _size, Error* _err) = 0; }; inline ReaderI::~ReaderI() @@ -47,7 +52,7 @@ namespace bx struct BX_NO_VTABLE WriterI { virtual ~WriterI() = 0; - virtual int32_t write(const void* _data, int32_t _size) = 0; + virtual int32_t write(const void* _data, int32_t _size, Error* _err) = 0; }; inline WriterI::~WriterI() @@ -65,40 +70,46 @@ namespace bx } /// Read data. - inline int32_t read(ReaderI* _reader, void* _data, int32_t _size) + inline int32_t read(ReaderI* _reader, void* _data, int32_t _size, Error* _err = NULL) { - return _reader->read(_data, _size); + BX_ERROR_SCOPE(_err); + return _reader->read(_data, _size, _err); } /// Write value. template - inline int32_t read(ReaderI* _reader, Ty& _value) + inline int32_t read(ReaderI* _reader, Ty& _value, Error* _err = NULL) { + BX_ERROR_SCOPE(_err); BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); - return _reader->read(&_value, sizeof(Ty) ); + return _reader->read(&_value, sizeof(Ty), _err); } /// Read value and converts it to host endianess. _fromLittleEndian specifies /// underlying stream endianess. template - inline int32_t readHE(ReaderI* _reader, Ty& _value, bool _fromLittleEndian) + inline int32_t readHE(ReaderI* _reader, Ty& _value, bool _fromLittleEndian, Error* _err = NULL) { + BX_ERROR_SCOPE(_err); BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); Ty value; - int32_t result = _reader->read(&value, sizeof(Ty) ); + int32_t result = _reader->read(&value, sizeof(Ty), _err); _value = toHostEndian(value, _fromLittleEndian); return result; } /// Write data. - inline int32_t write(WriterI* _writer, const void* _data, int32_t _size) + inline int32_t write(WriterI* _writer, const void* _data, int32_t _size, Error* _err = NULL) { - return _writer->write(_data, _size); + BX_ERROR_SCOPE(_err); + return _writer->write(_data, _size, _err); } /// Write repeat the same value. - inline int32_t writeRep(WriterI* _writer, uint8_t _byte, int32_t _size) + inline int32_t writeRep(WriterI* _writer, uint8_t _byte, int32_t _size, Error* _err = NULL) { + BX_ERROR_SCOPE(_err); + const uint32_t tmp0 = uint32_sels(64 - _size, 64, _size); const uint32_t tmp1 = uint32_sels(256 - _size, 256, tmp0); const uint32_t blockSize = uint32_sels(1024 - _size, 1024, tmp1); @@ -108,7 +119,7 @@ namespace bx int32_t size = 0; while (0 < _size) { - int32_t bytes = write(_writer, temp, uint32_min(blockSize, _size) ); + int32_t bytes = write(_writer, temp, uint32_min(blockSize, _size), _err); size += bytes; _size -= bytes; } @@ -118,29 +129,32 @@ namespace bx /// Write value. template - inline int32_t write(WriterI* _writer, const Ty& _value) + inline int32_t write(WriterI* _writer, const Ty& _value, Error* _err = NULL) { + BX_ERROR_SCOPE(_err); BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); - return _writer->write(&_value, sizeof(Ty) ); + return _writer->write(&_value, sizeof(Ty), _err); } /// Write value as little endian. template - inline int32_t writeLE(WriterI* _writer, const Ty& _value) + inline int32_t writeLE(WriterI* _writer, const Ty& _value, Error* _err = NULL) { + BX_ERROR_SCOPE(_err); BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); Ty value = toLittleEndian(_value); - int32_t result = _writer->write(&value, sizeof(Ty) ); + int32_t result = _writer->write(&value, sizeof(Ty), _err); return result; } /// Write value as big endian. template - inline int32_t writeBE(WriterI* _writer, const Ty& _value) + inline int32_t writeBE(WriterI* _writer, const Ty& _value, Error* _err = NULL) { + BX_ERROR_SCOPE(_err); BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); Ty value = toBigEndian(_value); - int32_t result = _writer->write(&value, sizeof(Ty) ); + int32_t result = _writer->write(&value, sizeof(Ty), _err); return result; } @@ -198,34 +212,36 @@ namespace bx struct BX_NO_VTABLE FileReaderI : public ReaderSeekerI { - virtual int32_t open(const char* _filePath) = 0; - virtual int32_t close() = 0; + virtual bool open(const char* _filePath, Error* _err) = 0; + virtual void close() = 0; }; struct BX_NO_VTABLE FileWriterI : public WriterSeekerI { - virtual int32_t open(const char* _filePath, bool _append = false) = 0; - virtual int32_t close() = 0; + virtual bool open(const char* _filePath, bool _append, Error* _err) = 0; + virtual void close() = 0; }; - inline int32_t open(FileReaderI* _reader, const char* _filePath) + inline bool open(FileReaderI* _reader, const char* _filePath, Error* _err = NULL) { - return _reader->open(_filePath); + BX_ERROR_USE_TEMP_WHEN_NULL(_err); + return _reader->open(_filePath, _err); } - inline int32_t close(FileReaderI* _reader) + inline void close(FileReaderI* _reader) { - return _reader->close(); + _reader->close(); } - inline int32_t open(FileWriterI* _writer, const char* _filePath, bool _append = false) + inline bool open(FileWriterI* _writer, const char* _filePath, bool _append = false, Error* _err = NULL) { - return _writer->open(_filePath, _append); + BX_ERROR_USE_TEMP_WHEN_NULL(_err); + return _writer->open(_filePath, _append, _err); } - inline int32_t close(FileWriterI* _writer) + inline void close(FileWriterI* _writer) { - return _writer->close(); + _writer->close(); } struct BX_NO_VTABLE MemoryBlockI @@ -332,8 +348,10 @@ namespace bx return m_pos; } - virtual int32_t write(const void* /*_data*/, int32_t _size) BX_OVERRIDE + virtual int32_t write(const void* /*_data*/, int32_t _size, Error* _err) BX_OVERRIDE { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + int32_t morecore = int32_t(m_pos - m_top) + _size; if (0 < morecore) @@ -344,6 +362,10 @@ namespace bx int64_t reminder = m_top-m_pos; int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) ); m_pos += size; + if (size != _size) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "SizerWriter: write truncated."); + } return size; } @@ -386,12 +408,18 @@ namespace bx return m_pos; } - virtual int32_t read(void* _data, int32_t _size) BX_OVERRIDE + virtual int32_t read(void* _data, int32_t _size, Error* _err) BX_OVERRIDE { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + int64_t reminder = m_top-m_pos; int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) ); memcpy(_data, &m_data[m_pos], size); m_pos += size; + if (size != _size) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "MemoryReader: read truncated."); + } return size; } @@ -452,8 +480,10 @@ namespace bx return m_pos; } - virtual int32_t write(const void* _data, int32_t _size) BX_OVERRIDE + virtual int32_t write(const void* _data, int32_t _size, Error* _err) BX_OVERRIDE { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + int32_t morecore = int32_t(m_pos - m_size) + _size; if (0 < morecore) @@ -468,6 +498,10 @@ namespace bx memcpy(&m_data[m_pos], _data, size); m_pos += size; m_top = int64_max(m_top, m_pos); + if (size != _size) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "MemoryWriter: write truncated."); + } return size; } @@ -509,16 +543,23 @@ namespace bx { } - virtual int32_t open(const char* _filePath) BX_OVERRIDE + virtual bool open(const char* _filePath, Error* _err) BX_OVERRIDE { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + m_file = fopen(_filePath, "rb"); - return NULL == m_file; + if (NULL == m_file) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileReader: Failed to open file."); + return false; + } + + return true; } - virtual int32_t close() BX_OVERRIDE + virtual void close() BX_OVERRIDE { fclose(m_file); - return 0; } virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE @@ -527,9 +568,18 @@ namespace bx return ftello64(m_file); } - virtual int32_t read(void* _data, int32_t _size) BX_OVERRIDE + virtual int32_t read(void* _data, int32_t _size, Error* _err) BX_OVERRIDE { - return (int32_t)fread(_data, 1, _size, m_file); + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + int32_t size = (int32_t)fread(_data, 1, _size, m_file); + if (size != _size) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "CrtFileReader: read failed."); + return size >= 0 ? size : 0; + } + + return size; } private: @@ -548,24 +598,22 @@ namespace bx { } - virtual int32_t open(const char* _filePath, bool _append = false) BX_OVERRIDE + virtual bool open(const char* _filePath, bool _append, Error* _err) BX_OVERRIDE { - if (_append) - { - m_file = fopen(_filePath, "ab"); - } - else + m_file = fopen(_filePath, _append ? "ab" : "wb"); + + if (NULL == m_file) { - m_file = fopen(_filePath, "wb"); + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileWriter: Failed to open file."); + return false; } - return NULL == m_file; + return true; } - virtual int32_t close() BX_OVERRIDE + virtual void close() BX_OVERRIDE { fclose(m_file); - return 0; } virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE @@ -574,9 +622,18 @@ namespace bx return ftello64(m_file); } - virtual int32_t write(const void* _data, int32_t _size) BX_OVERRIDE + virtual int32_t write(const void* _data, int32_t _size, Error* _err) BX_OVERRIDE { - return (int32_t)fwrite(_data, 1, _size, m_file); + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + int32_t size = (int32_t)fwrite(_data, 1, _size, m_file); + if (size != _size) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "CrtFileWriter: write failed."); + return size >= 0 ? size : 0; + } + + return size; } private: diff --git a/3rdparty/bx/makefile b/3rdparty/bx/makefile index 5f3455bdbff..685479b05d8 100644 --- a/3rdparty/bx/makefile +++ b/3rdparty/bx/makefile @@ -220,3 +220,8 @@ tools/bin/$(OS)/bin2c$(EXE): .build/$(BUILD_OUTPUT_DIR)/bin/bin2cRelease$(EXE) $(SILENT) cp $(<) $(@) tools: tools/bin/$(OS)/bin2c$(EXE) + +.build/$(BUILD_OUTPUT_DIR)/bin/bx.testRelease$(EXE): .build/projects/$(BUILD_PROJECT_DIR) + $(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) bx.test config=$(BUILD_TOOLS_CONFIG) + +test: .build/$(BUILD_OUTPUT_DIR)/bin/bx.testRelease$(EXE) diff --git a/3rdparty/bx/scripts/genie.lua b/3rdparty/bx/scripts/genie.lua index 2399a70ce3d..580e3d66157 100644 --- a/3rdparty/bx/scripts/genie.lua +++ b/3rdparty/bx/scripts/genie.lua @@ -58,17 +58,18 @@ project "bx.test" path.join(BX_DIR, "tests/**.H"), } - configuration { "vs*" } + configuration { "vs* or mingw*" } + links { + "psapi", + } configuration { "android*" } - kind "ConsoleApp" targetextension ".so" linkoptions { "-shared", } configuration { "nacl or nacl-arm" } - kind "ConsoleApp" targetextension ".nexe" links { "ppapi", @@ -76,7 +77,6 @@ project "bx.test" } configuration { "pnacl" } - kind "ConsoleApp" targetextension ".pexe" links { "ppapi", diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua index 4b616c24c2a..ad3a3e647e1 100644 --- a/3rdparty/bx/scripts/toolchain.lua +++ b/3rdparty/bx/scripts/toolchain.lua @@ -13,29 +13,30 @@ function toolchain(_buildDir, _libDir) value = "GCC", description = "Choose GCC flavor", allowed = { - { "android-arm", "Android - ARM" }, - { "android-mips", "Android - MIPS" }, - { "android-x86", "Android - x86" }, - { "asmjs", "Emscripten/asm.js" }, - { "freebsd", "FreeBSD" }, - { "linux-gcc", "Linux (GCC compiler)" }, - { "linux-gcc-5", "Linux (GCC-5 compiler)" }, - { "linux-clang", "Linux (Clang compiler)" }, - { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" }, - { "linux-arm-gcc", "Linux (ARM, GCC compiler)" }, - { "ios-arm", "iOS - ARM" }, - { "ios-simulator", "iOS - Simulator" }, - { "tvos-arm64", "tvOS - ARM64" }, - { "tvos-simulator", "tvOS - Simulator" }, - { "mingw-gcc", "MinGW" }, - { "mingw-clang", "MinGW (clang compiler)" }, - { "nacl", "Native Client" }, - { "nacl-arm", "Native Client - ARM" }, - { "osx", "OSX" }, - { "pnacl", "Native Client - PNaCl" }, - { "ps4", "PS4" }, - { "qnx-arm", "QNX/Blackberry - ARM" }, - { "rpi", "RaspberryPi" }, + { "android-arm", "Android - ARM" }, + { "android-mips", "Android - MIPS" }, + { "android-x86", "Android - x86" }, + { "asmjs", "Emscripten/asm.js" }, + { "freebsd", "FreeBSD" }, + { "linux-gcc", "Linux (GCC compiler)" }, + { "linux-gcc-5", "Linux (GCC-5 compiler)" }, + { "linux-clang", "Linux (Clang compiler)" }, + { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" }, + { "linux-arm-gcc", "Linux (ARM, GCC compiler)" }, + { "linux-steamlink", "Steam Link" }, + { "ios-arm", "iOS - ARM" }, + { "ios-simulator", "iOS - Simulator" }, + { "tvos-arm64", "tvOS - ARM64" }, + { "tvos-simulator", "tvOS - Simulator" }, + { "mingw-gcc", "MinGW" }, + { "mingw-clang", "MinGW (clang compiler)" }, + { "nacl", "Native Client" }, + { "nacl-arm", "Native Client - ARM" }, + { "osx", "OSX" }, + { "pnacl", "Native Client - PNaCl" }, + { "ps4", "PS4" }, + { "qnx-arm", "QNX/Blackberry - ARM" }, + { "rpi", "RaspberryPi" }, }, } @@ -86,6 +87,11 @@ function toolchain(_buildDir, _libDir) description = "Set tvOS target version (default: 9.0).", } + newoption { + trigger = "with-dynamic-runtime", + description = "Dynamically link with the runtime rather than statically", + } + -- Avoid error when invoking genie --help. if (_ACTION == nil) then return false end @@ -157,7 +163,7 @@ function toolchain(_buildDir, _libDir) elseif "asmjs" == _OPTIONS["gcc"] then if not os.getenv("EMSCRIPTEN") then - print("Set EMSCRIPTEN enviroment variables.") + print("Set EMSCRIPTEN enviroment variable.") end premake.gcc.cc = "$(EMSCRIPTEN)/emcc" @@ -214,6 +220,16 @@ function toolchain(_buildDir, _libDir) elseif "linux-arm-gcc" == _OPTIONS["gcc"] then location (path.join(_buildDir, "projects", _ACTION .. "-linux-arm-gcc")) + elseif "linux-steamlink" == _OPTIONS["gcc"] then + if not os.getenv("MARVELL_SDK_PATH") then + print("Set MARVELL_SDK_PATH enviroment variable.") + end + + premake.gcc.cc = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-gcc" + premake.gcc.cxx = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-g++" + premake.gcc.ar = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-ar" + location (path.join(_buildDir, "projects", _ACTION .. "-linux-steamlink")) + elseif "mingw-gcc" == _OPTIONS["gcc"] then premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc" premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++" @@ -231,7 +247,7 @@ function toolchain(_buildDir, _libDir) elseif "nacl" == _OPTIONS["gcc"] then if not os.getenv("NACL_SDK_ROOT") then - print("Set NACL_SDK_ROOT enviroment variables.") + print("Set NACL_SDK_ROOT enviroment variable.") end naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_x86_newlib/bin/x86_64-nacl-" @@ -249,7 +265,7 @@ function toolchain(_buildDir, _libDir) elseif "nacl-arm" == _OPTIONS["gcc"] then if not os.getenv("NACL_SDK_ROOT") then - print("Set NACL_SDK_ROOT enviroment variables.") + print("Set NACL_SDK_ROOT enviroment variable.") end naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_arm_newlib/bin/arm-nacl-" @@ -277,7 +293,7 @@ function toolchain(_buildDir, _libDir) elseif "pnacl" == _OPTIONS["gcc"] then if not os.getenv("NACL_SDK_ROOT") then - print("Set NACL_SDK_ROOT enviroment variables.") + print("Set NACL_SDK_ROOT enviroment variable.") end naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_pnacl/bin/pnacl-" @@ -295,7 +311,7 @@ function toolchain(_buildDir, _libDir) elseif "ps4" == _OPTIONS["gcc"] then if not os.getenv("PS4_SDK_ROOT") then - print("Set PS4_SDK_ROOT enviroment variables.") + print("Set PS4_SDK_ROOT enviroment variable.") end ps4Toolchain = "$(PS4_SDK_ROOT)/host_tools/bin/orbis-" @@ -308,7 +324,7 @@ function toolchain(_buildDir, _libDir) elseif "qnx-arm" == _OPTIONS["gcc"] then if not os.getenv("QNX_HOST") then - print("Set QNX_HOST enviroment variables.") + print("Set QNX_HOST enviroment variable.") end premake.gcc.cc = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-gcc" @@ -376,8 +392,11 @@ function toolchain(_buildDir, _libDir) end end + if not _OPTIONS["with-dynamic-runtime"] then + flags { "StaticRuntime" } + end + flags { - "StaticRuntime", "NoPCH", "NativeWChar", "NoRTTI", @@ -686,6 +705,30 @@ function toolchain(_buildDir, _libDir) "-Wl,-z,now", } + configuration { "linux-steamlink" } + targetdir (path.join(_buildDir, "steamlink/bin")) + objdir (path.join(_buildDir, "steamlink/obj")) + libdirs { path.join(_libDir, "lib/steamlink") } + includedirs { path.join(bxDir, "include/compat/linux") } + defines { + "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it. + } + buildoptions { + "-std=c++0x", + "-Wfatal-errors", + "-Wunused-value", + "-Wundef", + "-pthread", + "-marm", + "-mfloat-abi=hard", + "--sysroot=$(MARVELL_SDK_PATH)/rootfs", + } + linkoptions { + "-static-libgcc", + "-static-libstdc++", + "--sysroot=$(MARVELL_SDK_PATH)/rootfs", + } + configuration { "android-arm" } targetdir (path.join(_buildDir, "android-arm/bin")) objdir (path.join(_buildDir, "android-arm/obj")) diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie index f7df2742735..f79dbd8456f 100644 Binary files a/3rdparty/bx/tools/bin/darwin/genie and b/3rdparty/bx/tools/bin/darwin/genie differ diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie index d22c9e96473..c3a323a0b1e 100644 Binary files a/3rdparty/bx/tools/bin/linux/genie and b/3rdparty/bx/tools/bin/linux/genie differ diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe index cb0d3e7d3df..7e62285f703 100644 Binary files a/3rdparty/bx/tools/bin/windows/genie.exe and b/3rdparty/bx/tools/bin/windows/genie.exe differ diff --git a/3rdparty/bx/tools/bin2c/bin2c.cpp b/3rdparty/bx/tools/bin2c/bin2c.cpp index afdcaa65cdc..bdb92a4c04f 100644 --- a/3rdparty/bx/tools/bin2c/bin2c.cpp +++ b/3rdparty/bx/tools/bin2c/bin2c.cpp @@ -23,7 +23,7 @@ public: { } - virtual int32_t write(const void* _data, int32_t _size) BX_OVERRIDE + virtual int32_t write(const void* _data, int32_t _size, bx::Error* /*_err*/ = NULL) BX_OVERRIDE { const char* data = (const char*)_data; m_buffer.insert(m_buffer.end(), data, data+_size); @@ -148,14 +148,14 @@ int main(int _argc, const char* _argv[]) size_t size = 0; bx::CrtFileReader fr; - if (0 == bx::open(&fr, filePath) ) + if (bx::open(&fr, filePath) ) { size = (size_t)bx::getSize(&fr); data = malloc(size); bx::read(&fr, data, size); bx::CrtFileWriter fw; - if (0 == bx::open(&fw, outFilePath) ) + if (bx::open(&fw, outFilePath) ) { Bin2cWriter writer(&fw, name); bx::write(&writer, data, size); -- cgit v1.2.3-70-g09d2 From 34bc216ef9b17e6464910fc678119a4c3670356d Mon Sep 17 00:00:00 2001 From: Michele Fochi aka motoschifo Date: Sun, 7 Feb 2016 11:05:55 +0100 Subject: VideoSnaps patch http://adb.arcadeitalia.net/videosnaps.php --- src/emu/ioport.cpp | 197 ++++++++++++++++++++++++++++++++++++++++++++++++++++- src/emu/ioport.h | 7 ++ src/emu/ui/ui.cpp | 26 +++++++ src/emu/ui/ui.h | 6 ++ src/emu/video.cpp | 57 +++++++++++++++- src/emu/video.h | 18 +++++ 6 files changed, 308 insertions(+), 3 deletions(-) diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index 282cc5c256c..501ba5d783b 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -2454,6 +2454,9 @@ ioport_manager::ioport_manager(running_machine &machine) m_playback_file(machine.options().input_directory(), OPEN_FLAG_READ), m_playback_accumulated_speed(0), m_playback_accumulated_frames(0), + m_timecode_file(machine.options().input_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS), + m_timecode_count(0), + m_timecode_last_time(attotime::zero), m_has_configs(false), m_has_analog(false), m_has_dips(false), @@ -2564,6 +2567,7 @@ time_t ioport_manager::initialize() // open playback and record files if specified time_t basetime = playback_init(); record_init(); + timecode_init(); return basetime; } @@ -2657,6 +2661,7 @@ void ioport_manager::exit() // close any playback or recording files playback_end(); record_end(); + timecode_end(); } @@ -3428,6 +3433,12 @@ void ioport_manager::playback_end(const char *message) m_playback_accumulated_speed /= m_playback_accumulated_frames; osd_printf_info("Total playback frames: %d\n", UINT32(m_playback_accumulated_frames)); osd_printf_info("Average recorded speed: %d%%\n", UINT32((m_playback_accumulated_speed * 200 + 1) >> 21)); + + // Close the Mame at the end of inp file playback + //if (strcmp(message, "End of file")) { + osd_printf_info("Exiting MAME now...\n"); + machine().schedule_exit(); + //} } } @@ -3510,6 +3521,29 @@ void ioport_manager::record_write(bool value) record_write(byte); } +template +void ioport_manager::timecode_write(_Type value) +{ + // protect against NULL handles if previous reads fail + if (!m_timecode_file.is_open()) + return; + + // read the value; if we fail, end playback + if (m_timecode_file.write(&value, sizeof(value)) != sizeof(value)) + timecode_end("Out of space"); +} + +/*template<> +void ioport_manager::timecode_write(bool value) +{ + UINT8 byte = UINT8(value); + timecode_write(byte); +}*/ +template<> +void ioport_manager::timecode_write(std::string value) { + timecode_write(value.c_str()); +} + //------------------------------------------------- // record_init - initialize INP recording @@ -3554,6 +3588,41 @@ void ioport_manager::record_init() } +void ioport_manager::timecode_init() { + // if no file, nothing to do + const char *record_filename = machine().options().record(); + if (record_filename[0] == 0) { + machine().video().set_timecode_enabled(false); + return; + } + //osd_printf_error("DEBUG FILENAME-1: %s\n", record_filename); + machine().video().set_timecode_enabled(true); + + // open the record file + std::string filename; + filename.append(record_filename).append(".timecode"); + //sprintf(filename, "%s.timecode", record_filename); + + //osd_printf_error("DEBUG FILENAME-2: %s\n", filename.c_str()); + + file_error filerr = m_timecode_file.open(filename.c_str()); + assert_always(filerr == FILERR_NONE, "Failed to open file for timecode recording"); + + m_timecode_file.puts(std::string("# ==========================================\n").c_str()); + m_timecode_file.puts(std::string("# TIMECODE FILE FOR VIDEO PREVIEW GENERATION\n").c_str()); + m_timecode_file.puts(std::string("# ==========================================\n").c_str()); + m_timecode_file.puts(std::string("#\n").c_str()); + m_timecode_file.puts(std::string("# VIDEO_PART: code of video timecode\n").c_str()); + m_timecode_file.puts(std::string("# START: start time (hh:mm:ss.mmm)\n").c_str()); + m_timecode_file.puts(std::string("# ELAPSED: elapsed time (hh:mm:ss.mmm)\n").c_str()); + m_timecode_file.puts(std::string("# MSEC_START: start time (milliseconds)\n").c_str()); + m_timecode_file.puts(std::string("# MSEC_ELAPSED: elapsed time (milliseconds)\n").c_str()); + m_timecode_file.puts(std::string("# FRAME_START: start time (frames)\n").c_str()); + m_timecode_file.puts(std::string("# FRAME_ELAPSED: elapsed time (frames)\n").c_str()); + m_timecode_file.puts(std::string("#\n").c_str()); + m_timecode_file.puts(std::string("# VIDEO_PART======= START======= ELAPSED===== MSEC_START===== MSEC_ELAPSED=== FRAME_START==== FRAME_ELAPSED==\n").c_str()); +} + //------------------------------------------------- // record_end - end INP recording //------------------------------------------------- @@ -3573,6 +3642,19 @@ void ioport_manager::record_end(const char *message) } +void ioport_manager::timecode_end(const char *message) +{ + // only applies if we have a live file + if (m_timecode_file.is_open()) { + // close the file + m_timecode_file.close(); + + // pop a message + if (message != nullptr) + machine().popmessage("Recording Timecode Ended\nReason: %s", message); + } +} + //------------------------------------------------- // record_frame - start of frame callback for // recording @@ -3584,12 +3666,123 @@ void ioport_manager::record_frame(const attotime &curtime) if (m_record_file.is_open()) { // first the absolute time - record_write(curtime.seconds()); - record_write(curtime.attoseconds()); + record_write(curtime.m_seconds); + record_write(curtime.m_attoseconds); // then the current speed record_write(UINT32(machine().video().speed_percent() * double(1 << 20))); } + + if (m_timecode_file.is_open() && machine().video().get_timecode_write()) { + // Display the timecode + std::string current_time_str; + m_timecode_count++; + strcatprintf(current_time_str, "%02d:%02d:%02d.%03d", + (int)curtime.m_seconds / (60 * 60), + (curtime.m_seconds / 60) % 60, + curtime.m_seconds % 60, + (int)(curtime.m_attoseconds/ATTOSECONDS_PER_MILLISECOND)); + + // Elapsed from previous timecode + attotime elapsed_time = curtime - m_timecode_last_time; + m_timecode_last_time = curtime; + std::string elapsed_time_str; + strcatprintf(elapsed_time_str, "%02d:%02d:%02d.%03d", + elapsed_time.m_seconds / (60 * 60), + (elapsed_time.m_seconds / 60) % 60, + elapsed_time.m_seconds % 60, + int(elapsed_time.m_attoseconds/ATTOSECONDS_PER_MILLISECOND)); + + // Number of ms from beginning of playback + int mseconds_start = curtime.m_seconds*1000 + curtime.m_attoseconds/ATTOSECONDS_PER_MILLISECOND; + std::string mseconds_start_str; + strcatprintf(mseconds_start_str, "%015d", mseconds_start); + + // Number of ms from previous timecode + int mseconds_elapsed = elapsed_time.m_seconds*1000 + elapsed_time.m_attoseconds/ATTOSECONDS_PER_MILLISECOND; + std::string mseconds_elapsed_str; + strcatprintf(mseconds_elapsed_str, "%015d", mseconds_elapsed); + + // Number of frames from beginning of playback + int frame_start = mseconds_start * 60 / 1000; + std::string frame_start_str; + strcatprintf(frame_start_str, "%015d", frame_start); + + // Number of frames from previous timecode + int frame_elapsed = mseconds_elapsed * 60 / 1000; + std::string frame_elapsed_str; + strcatprintf(frame_elapsed_str, "%015d", frame_elapsed); + + std::string messaggio; + std::string timecode_text; + std::string timecode_key; + bool show_timecode_counter = false; + if (m_timecode_count==1) { + messaggio += "INTRO STARTED AT " + current_time_str; + timecode_key = "INTRO_START"; + timecode_text = "INTRO"; + show_timecode_counter = true; + } + else if (m_timecode_count==2) { + messaggio += "INTRO DURATION " + elapsed_time_str; + timecode_key = "INTRO_STOP"; + machine().video().add_to_total_time(elapsed_time); + //timecode_text += "INTRO"; + } + else if (m_timecode_count==3) { + messaggio += "GAMEPLAY STARTED AT " + current_time_str; + timecode_key = "GAMEPLAY_START"; + timecode_text += "GAMEPLAY"; + show_timecode_counter = true; + } + else if (m_timecode_count==4) { + messaggio += "GAMEPLAY DURATION " + elapsed_time_str; + timecode_key = "GAMEPLAY_STOP"; + machine().video().add_to_total_time(elapsed_time); + //timecode_text += "GAMEPLAY"; + } + else if (m_timecode_count % 2 == 1) { + std::string timecode_count_str; + strcatprintf(timecode_count_str, "%03d", (m_timecode_count-3)/2); + timecode_key = "EXTRA_START_" + timecode_count_str; + timecode_count_str.clear(); + strcatprintf(timecode_count_str, "%d", (m_timecode_count-3)/2); + messaggio += "EXTRA " + timecode_count_str + " STARTED AT " + current_time_str; + timecode_text += "EXTRA " + timecode_count_str; + show_timecode_counter = true; + } + else { + machine().video().add_to_total_time(elapsed_time); + + std::string timecode_count_str; + strcatprintf(timecode_count_str, "%d", (m_timecode_count-4)/2); + messaggio += "EXTRA " + timecode_count_str + " DURATION " + elapsed_time_str; + + //std::string timecode_count_str; + timecode_count_str.clear(); + strcatprintf(timecode_count_str, "%03d", (m_timecode_count-4)/2); + timecode_key = "EXTRA_STOP_" + timecode_count_str; + } + + osd_printf_info("%s \n", messaggio.c_str()); + machine().popmessage("%s \n", messaggio.c_str()); + + std::string riga_file; + riga_file.append(timecode_key).append(19-timecode_key.length(), ' '); + //riga_file += "INTRO_START " + + riga_file += + " " + current_time_str + " " + elapsed_time_str + + " " + mseconds_start_str + " " + mseconds_elapsed_str + + " " + frame_start_str + " " + frame_elapsed_str + + "\n"; + m_timecode_file.puts(riga_file.c_str()); + + machine().video().set_timecode_write(false); + //machine().video().set_timecode_text(timecode_text); + machine().video().set_timecode_text(timecode_text); + machine().video().set_timecode_start(m_timecode_last_time); + machine().ui().set_show_timecode_counter(show_timecode_counter); + } } diff --git a/src/emu/ioport.h b/src/emu/ioport.h index 9ba2818c5d0..3fbff3e852c 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -1452,6 +1452,10 @@ private: void record_frame(const attotime &curtime); void record_port(ioport_port &port); + template void timecode_write(_Type value); + void timecode_init(); + void timecode_end(const char *message = NULL); + // internal state running_machine & m_machine; // reference to owning machine bool m_safe_to_read; // clear at start; set after state is loaded @@ -1474,6 +1478,9 @@ private: emu_file m_playback_file; // playback file (NULL if not recording) UINT64 m_playback_accumulated_speed; // accumulated speed during playback UINT32 m_playback_accumulated_frames; // accumulated frames during playback + emu_file m_timecode_file; // timecode/frames playback file (NULL if not recording) + int m_timecode_count; + attotime m_timecode_last_time; // has... bool m_has_configs; diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 6d996ac50a0..860da34e212 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -286,6 +286,8 @@ void ui_manager::init() m_popup_text_end = 0; m_use_natural_keyboard = false; m_mouse_arrow_texture = nullptr; + m_show_timecode_counter = false; + m_show_timecode_total = false; m_load_save_hold = false; get_font_rows(&machine()); @@ -1035,6 +1037,16 @@ bool ui_manager::is_menu_active(void) } +bool ui_manager::show_timecode_counter() +{ + return m_show_timecode_counter; +} +bool ui_manager::show_timecode_total() +{ + return m_show_timecode_total; +} + + /*************************************************************************** TEXT GENERATORS @@ -1559,6 +1571,20 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); } + // Show the duration of current part (intro or gameplay or extra) + if (machine.ui().show_timecode_counter()) { + std::string tempstring; + machine.ui().draw_text_full(container, machine.video().timecode_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, + JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0,0xf0,0x10,0x10), ARGB_BLACK, NULL, NULL); + } + // Show the total time elapsed for the video preview (all parts intro, gameplay, extras) + if (machine.ui().show_timecode_total()) { + std::string tempstring; + machine.ui().draw_text_full(container, machine.video().timecode_total_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, + JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0,0x10,0xf0,0x10), ARGB_BLACK, NULL, NULL); + } + + // draw the profiler if visible if (machine.ui().show_profiler()) { diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h index 5a07a0800b5..3da9bfb1bab 100644 --- a/src/emu/ui/ui.h +++ b/src/emu/ui/ui.h @@ -171,6 +171,10 @@ public: // other void process_natural_keyboard(); + void set_show_timecode_counter(bool value) { m_show_timecode_counter = value; m_show_timecode_total = true; } + bool show_timecode_counter(); + bool show_timecode_total(); + // word wrap void wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, int &totallines, std::vector &xstart, std::vector &xend, float text_size = 1.0f); @@ -195,6 +199,8 @@ private: std::unique_ptr m_non_char_keys_down; render_texture * m_mouse_arrow_texture; bool m_mouse_show; + bool m_show_timecode_counter; + bool m_show_timecode_total; bool m_load_save_hold; ui_options m_ui_options; diff --git a/src/emu/video.cpp b/src/emu/video.cpp index d05a1b8327c..4b2a315d75c 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -108,7 +108,13 @@ video_manager::video_manager(running_machine &machine) m_avi_frame_period(attotime::zero), m_avi_next_frame_time(attotime::zero), m_avi_frame(0), - m_dummy_recording(false) + m_dummy_recording(false), + m_timecode_enabled(false), + m_timecode_write(false), + m_timecode_text(""), + m_timecode_start(attotime::zero), + m_timecode_total(attotime::zero) + { // request a callback upon exiting machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(video_manager::exit), this)); @@ -335,6 +341,13 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file) void video_manager::save_active_screen_snapshots() { + // If record inp is acrive, no snapshot will be created + if (m_timecode_enabled) { + // This flag will write the line on file inp.timecode (see function ioport_manager::record_frame) + m_timecode_write = true; + return; + } + // if we're native, then write one snapshot per visible screen if (m_snap_native) { @@ -360,6 +373,48 @@ void video_manager::save_active_screen_snapshots() } } +std::string &video_manager::timecode_text(std::string &str) { + str.clear(); + str += " "; + + if (!m_timecode_text.empty()) { + str += m_timecode_text + " "; + } + + attotime elapsed_time = machine().time() - m_timecode_start; + std::string elapsed_time_str; + strcatprintf(elapsed_time_str, "%02d:%02d", + (elapsed_time.m_seconds / 60) % 60, + elapsed_time.m_seconds % 60); + str += elapsed_time_str; + + bool paused = machine().paused(); + if (paused) { + str.append(" [paused]"); + } + + str += " "; + + return str; +} + +std::string &video_manager::timecode_total_text(std::string &str) { + str.clear(); + str += " TOTAL "; + + attotime elapsed_time = m_timecode_total; + if (machine().ui().show_timecode_counter()) { + elapsed_time += machine().time() - m_timecode_start; + } + std::string elapsed_time_str; + strcatprintf(elapsed_time_str, "%02d:%02d", + (elapsed_time.m_seconds / 60) % 60, + elapsed_time.m_seconds % 60); + str += elapsed_time_str + " "; + return str; +} + + //------------------------------------------------- // begin_recording - begin recording of a movie diff --git a/src/emu/video.h b/src/emu/video.h index aef70a57f15..2403fe295f6 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -92,6 +92,17 @@ public: void begin_recording(const char *name, movie_format format); void end_recording(movie_format format); void add_sound_to_recording(const INT16 *sound, int numsamples); + + void set_timecode_enabled(bool value) { m_timecode_enabled = value; } + bool get_timecode_enabled() { return m_timecode_enabled; } + bool get_timecode_write() { return m_timecode_write; } + void set_timecode_write(bool value) { m_timecode_write = value; } + void set_timecode_text(std::string &str) { m_timecode_text = str; } + void set_timecode_start(attotime time) { m_timecode_start = time; } + void add_to_total_time(attotime time) { m_timecode_total += time; } + std::string &timecode_text(std::string &str); + std::string &timecode_total_text(std::string &str); + private: // internal helpers @@ -184,6 +195,13 @@ private: static const attoseconds_t ATTOSECONDS_PER_SPEED_UPDATE = ATTOSECONDS_PER_SECOND / 4; static const int PAUSED_REFRESH_RATE = 30; + + bool m_timecode_enabled; // inp.timecode record enabled + bool m_timecode_write; // Show/hide timer at right (partial time) + std::string m_timecode_text; // Message for that video part (intro, gameplay, extra) + attotime m_timecode_start; // Starting timer for that video part (intro, gameplay, extra) + attotime m_timecode_total; // Show/hide timer at left (total elapsed on resulting video preview) + }; #endif /* __VIDEO_H__ */ -- cgit v1.2.3-70-g09d2 From 4bcc966c7af18258e0f18e64d3ed4b9135940d3b Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 7 Feb 2016 13:50:05 +0100 Subject: z80: added crude implementation of WAIT pin --- src/devices/bus/abcbus/lux10828.cpp | 8 ++--- src/devices/cpu/z80/z80.cpp | 72 +++++++++++++++---------------------- src/devices/cpu/z80/z80.h | 1 + src/mame/drivers/adam.cpp | 2 +- src/mame/drivers/ep64.cpp | 2 +- src/mame/drivers/horizon.cpp | 2 +- src/mame/drivers/mpz80.cpp | 2 +- src/mame/drivers/mrgame.cpp | 2 +- src/mame/drivers/nightgal.cpp | 4 +-- src/mame/drivers/super6.cpp | 6 ++-- src/mame/drivers/xor100.cpp | 8 ++--- 11 files changed, 47 insertions(+), 62 deletions(-) diff --git a/src/devices/bus/abcbus/lux10828.cpp b/src/devices/bus/abcbus/lux10828.cpp index 32bc5e619bc..e14bdf9a20e 100644 --- a/src/devices/bus/abcbus/lux10828.cpp +++ b/src/devices/bus/abcbus/lux10828.cpp @@ -310,14 +310,14 @@ WRITE_LINE_MEMBER( luxor_55_10828_device::fdc_intrq_w ) m_fdc_irq = state; m_pio->port_b_write(state << 7); - if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); + if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, CLEAR_LINE); } WRITE_LINE_MEMBER( luxor_55_10828_device::fdc_drq_w ) { m_fdc_drq = state; - if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); + if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, CLEAR_LINE); } @@ -654,7 +654,7 @@ READ8_MEMBER( luxor_55_10828_device::fdc_r ) { logerror("Z80 WAIT not supported by MAME core\n"); - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, ASSERT_LINE); } return m_fdc->gen_r(offset); @@ -671,7 +671,7 @@ WRITE8_MEMBER( luxor_55_10828_device::fdc_w ) { logerror("Z80 WAIT not supported by MAME core\n"); - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, ASSERT_LINE); } m_fdc->gen_w(offset, data); diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp index 055e98ecdd7..a46edbec749 100644 --- a/src/devices/cpu/z80/z80.cpp +++ b/src/devices/cpu/z80/z80.cpp @@ -10,6 +10,7 @@ * - If LD A,I or LD A,R is interrupted, P/V flag gets reset, even if IFF2 * was set before this instruction (implemented, but not enabled: we need * document Z80 types first, see below) + * - WAIT only stalls between instructions now, it should stall immediately. * - Ideally, the tiny differences between Z80 types should be supported, * currently known differences: * - LD A,I/R P/V flag reset glitch is fixed on CMOS Z80 @@ -113,10 +114,6 @@ #define VERBOSE 0 -/* Debug purpose: set to 1 to test /WAIT pin behaviour. - */ -#define STALLS_ON_WAIT_ASSERT 0 - /* On an NMOS Z80, if LD A,I or LD A,R is interrupted, P/V flag gets reset, even if IFF2 was set before this instruction. This issue was fixed on the CMOS Z80, so until knowing (most) Z80 types on hardware, it's disabled */ @@ -3478,10 +3475,16 @@ void nsc800_device::device_reset() } /**************************************************************************** - * Execute 'cycles' T-states. Return number of T-states really executed + * Execute 'cycles' T-states. ****************************************************************************/ void z80_device::execute_run() { + if (m_wait_state) + { + // stalled + m_icount = 0; + return; + } /* check for NMIs on the way in; they can only be set externally */ /* via timers, and can't be dynamically enabled, so it is safe */ @@ -3523,29 +3526,23 @@ void z80_device::execute_run() PRVPC = PCD; debugger_instruction_hook(this, PCD); m_r++; -#if STALLS_ON_WAIT_ASSERT - static int test_cycles; - - if(m_wait_state == ASSERT_LINE) - { - m_icount --; - test_cycles ++; - } - else - { - if(test_cycles != 0) - printf("stalls for %d z80 cycles\n",test_cycles); - test_cycles = 0; - EXEC(op,rop()); - } -#else EXEC(op,rop()); -#endif + + if (m_wait_state) + m_icount = 0; + } while (m_icount > 0); } void nsc800_device::execute_run() { + if (m_wait_state) + { + // stalled + m_icount = 0; + return; + } + /* check for NMIs on the way in; they can only be set externally */ /* via timers, and can't be dynamically enabled, so it is safe */ /* to just check here */ @@ -3579,6 +3576,10 @@ void nsc800_device::execute_run() debugger_instruction_hook(this, PCD); m_r++; EXEC(op,rop()); + + if (m_wait_state) + m_icount = 0; + } while (m_icount > 0); } @@ -3609,6 +3610,9 @@ void z80_device::execute_set_input(int inputnum, int state) case Z80_INPUT_LINE_WAIT: m_wait_state = state; break; + + default: + break; } } @@ -3616,17 +3620,6 @@ void nsc800_device::execute_set_input(int inputnum, int state) { switch (inputnum) { - case Z80_INPUT_LINE_BUSRQ: - m_busrq_state = state; - break; - - case INPUT_LINE_NMI: - /* mark an NMI pending on the rising edge */ - if (m_nmi_state == CLEAR_LINE && state != CLEAR_LINE) - m_nmi_pending = TRUE; - m_nmi_state = state; - break; - case NSC800_RSTA: m_nsc800_irq_state[NSC800_RSTA] = state; break; @@ -3639,17 +3632,8 @@ void nsc800_device::execute_set_input(int inputnum, int state) m_nsc800_irq_state[NSC800_RSTC] = state; break; - case INPUT_LINE_IRQ0: - /* update the IRQ state via the daisy chain */ - m_irq_state = state; - if (m_daisy.present()) - m_irq_state = m_daisy.update_irq_state(); - - /* the main execute loop will take the interrupt */ - break; - - case Z80_INPUT_LINE_WAIT: - m_wait_state = state; + default: + z80_device::execute_set_input(inputnum, state); break; } } diff --git a/src/devices/cpu/z80/z80.h b/src/devices/cpu/z80/z80.h index c523f101a24..faed3eb832c 100644 --- a/src/devices/cpu/z80/z80.h +++ b/src/devices/cpu/z80/z80.h @@ -19,6 +19,7 @@ enum NSC800_RSTB, NSC800_RSTC, Z80_INPUT_LINE_WAIT, + Z80_INPUT_LINE_BOGUSWAIT, /* WAIT pin implementation used to be nonexistent, please remove this when all drivers are updated with Z80_INPUT_LINE_WAIT */ Z80_INPUT_LINE_BUSRQ }; diff --git a/src/mame/drivers/adam.cpp b/src/mame/drivers/adam.cpp index a52eb37e567..4369295343b 100644 --- a/src/mame/drivers/adam.cpp +++ b/src/mame/drivers/adam.cpp @@ -1067,7 +1067,7 @@ static MACHINE_CONFIG_START( adam, adam_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD(SN76489A_TAG, SN76489A, XTAL_7_15909MHz/2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SN76496_READY_HANDLER(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) + MCFG_SN76496_READY_HANDLER(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_BOGUSWAIT)) // devices MCFG_ADAMNET_BUS_ADD() diff --git a/src/mame/drivers/ep64.cpp b/src/mame/drivers/ep64.cpp index eb537de944b..84a529841f9 100644 --- a/src/mame/drivers/ep64.cpp +++ b/src/mame/drivers/ep64.cpp @@ -516,7 +516,7 @@ static MACHINE_CONFIG_START( ep64, ep64_state ) MCFG_EP64_EXPANSION_BUS_SLOT_DAVE(DAVE_TAG) MCFG_EP64_EXPANSION_BUS_SLOT_IRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) MCFG_EP64_EXPANSION_BUS_SLOT_NMI_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_NMI)) - MCFG_EP64_EXPANSION_BUS_SLOT_WAIT_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) + MCFG_EP64_EXPANSION_BUS_SLOT_WAIT_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_BOGUSWAIT)) MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(ep64_state, write_centronics_busy)) diff --git a/src/mame/drivers/horizon.cpp b/src/mame/drivers/horizon.cpp index 11076e517f2..8a0badd1c4b 100644 --- a/src/mame/drivers/horizon.cpp +++ b/src/mame/drivers/horizon.cpp @@ -168,7 +168,7 @@ static MACHINE_CONFIG_START( horizon, horizon_state ) // S-100 MCFG_S100_BUS_ADD() - MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) + MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_BOGUSWAIT)) //MCFG_S100_SLOT_ADD("s100_1", horizon_s100_cards, NULL, NULL) // CPU MCFG_S100_SLOT_ADD("s100_2", horizon_s100_cards, nullptr) // RAM MCFG_S100_SLOT_ADD("s100_3", horizon_s100_cards, "mdsad") // MDS diff --git a/src/mame/drivers/mpz80.cpp b/src/mame/drivers/mpz80.cpp index 0c42707b541..e5e05a051a4 100644 --- a/src/mame/drivers/mpz80.cpp +++ b/src/mame/drivers/mpz80.cpp @@ -716,7 +716,7 @@ static MACHINE_CONFIG_START( mpz80, mpz80_state ) MCFG_S100_BUS_ADD() MCFG_S100_IRQ_CALLBACK(WRITELINE(mpz80_state, s100_pint_w)) MCFG_S100_NMI_CALLBACK(WRITELINE(mpz80_state, s100_nmi_w)) - MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) + MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_BOGUSWAIT)) MCFG_S100_SLOT_ADD("s100_1", mpz80_s100_cards, "mm65k16s") MCFG_S100_SLOT_ADD("s100_2", mpz80_s100_cards, "wunderbus") MCFG_S100_SLOT_ADD("s100_3", mpz80_s100_cards, "dj2db") diff --git a/src/mame/drivers/mrgame.cpp b/src/mame/drivers/mrgame.cpp index beb0a9e0bca..bcb1e89957a 100644 --- a/src/mame/drivers/mrgame.cpp +++ b/src/mame/drivers/mrgame.cpp @@ -492,7 +492,7 @@ static MACHINE_CONFIG_START( mrgame, mrgame_state ) MCFG_DAC_ADD("dacr") MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) MCFG_SOUND_ADD("tms", TMS5220, 672000) // uses a RC combination. 672k copied from jedi.h - MCFG_TMS52XX_READYQ_HANDLER(INPUTLINE("audiocpu2", Z80_INPUT_LINE_WAIT)) + MCFG_TMS52XX_READYQ_HANDLER(INPUTLINE("audiocpu2", Z80_INPUT_LINE_BOGUSWAIT)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 1150cc05c45..98976ef8b88 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -425,12 +425,12 @@ READ8_MEMBER(nightgal_state::royalqn_nsc_blit_r) TIMER_CALLBACK_MEMBER(nightgal_state::z80_wait_ack_cb) { - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); + m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, CLEAR_LINE); } void nightgal_state::z80_wait_assert_cb() { - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, ASSERT_LINE); // Note: cycles_to_attotime requires z80 context to work, calling for example m_subcpu as context gives a x4 cycle boost in z80 terms (reads execute_cycles_to_clocks() from NCS?) even if they runs at same speed basically. // TODO: needs a getter that tells a given CPU how many cycles requires an executing opcode for the r/w operation, which stacks with wait state penalty for accessing this specific area. diff --git a/src/mame/drivers/super6.cpp b/src/mame/drivers/super6.cpp index 599aadbcdf5..838db3e3b20 100644 --- a/src/mame/drivers/super6.cpp +++ b/src/mame/drivers/super6.cpp @@ -193,7 +193,7 @@ READ8_MEMBER( super6_state::fdc_r ) // don't crash please... but it's true, WAIT does nothing in our Z80 //fatalerror("Z80 WAIT not supported by MAME core\n"); - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, ASSERT_LINE); return !m_fdc->intrq_r() << 7; } @@ -409,14 +409,14 @@ SLOT_INTERFACE_END WRITE_LINE_MEMBER( super6_state::fdc_intrq_w ) { - if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); + if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, CLEAR_LINE); m_ctc->trg3(!state); } WRITE_LINE_MEMBER( super6_state::fdc_drq_w ) { - if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); + if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, CLEAR_LINE); m_dma->rdy_w(state); } diff --git a/src/mame/drivers/xor100.cpp b/src/mame/drivers/xor100.cpp index 3d85c372c7d..05b81f316ac 100644 --- a/src/mame/drivers/xor100.cpp +++ b/src/mame/drivers/xor100.cpp @@ -189,7 +189,7 @@ READ8_MEMBER( xor100_state::fdc_wait_r ) if (!m_fdc_irq && !m_fdc_drq) { fatalerror("Z80 WAIT not supported by MAME core\n"); - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, ASSERT_LINE); } } @@ -442,7 +442,7 @@ void xor100_state::fdc_intrq_w(bool state) if (state) { fatalerror("Z80 WAIT not supported by MAME core\n"); - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, ASSERT_LINE); } } @@ -453,7 +453,7 @@ void xor100_state::fdc_drq_w(bool state) if (state) { fatalerror("Z80 WAIT not supported by MAME core\n"); - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, ASSERT_LINE); } } @@ -568,7 +568,7 @@ static MACHINE_CONFIG_START( xor100, xor100_state ) // S-100 MCFG_S100_BUS_ADD() - MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) + MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_BOGUSWAIT)) MCFG_S100_SLOT_ADD("s100_1", xor100_s100_cards, nullptr) MCFG_S100_SLOT_ADD("s100_2", xor100_s100_cards, nullptr) MCFG_S100_SLOT_ADD("s100_3", xor100_s100_cards, nullptr) -- cgit v1.2.3-70-g09d2 From 462b96ab1d2c88adb73d1b39c0050095885625a4 Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 7 Feb 2016 14:09:48 +0100 Subject: z80: put take_nmi in the execution loop: eg. z80 writes to another device NMI enable register --- src/devices/cpu/z80/z80.cpp | 95 ++++++++++++++++++++------------------------- src/devices/cpu/z80/z80.h | 1 + 2 files changed, 43 insertions(+), 53 deletions(-) diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp index a46edbec749..4f38a4e1866 100644 --- a/src/devices/cpu/z80/z80.cpp +++ b/src/devices/cpu/z80/z80.cpp @@ -3125,6 +3125,27 @@ OP(op,fe) { cp(arg()); OP(op,ff) { rst(0x38); } /* RST 7 */ +void z80_device::take_nmi() +{ + /* there isn't a valid previous program counter */ + PRVPC = -1; + + /* Check if processor was halted */ + leave_halt(); + +#if HAS_LDAIR_QUIRK + /* reset parity flag after LD A,I or LD A,R */ + if (m_after_ldair) F &= ~PF; +#endif + + m_iff1 = 0; + push(m_pc); + PCD = 0x0066; + WZ=PCD; + m_icount -= 11; + m_nmi_pending = FALSE; +} + void z80_device::take_interrupt() { int irq_vector; @@ -3207,6 +3228,11 @@ void z80_device::take_interrupt() m_icount -= m_cc_ex[0xff]; } WZ=PCD; + +#if HAS_LDAIR_QUIRK + /* reset parity flag after LD A,I or LD A,R */ + if (m_after_ldair) F &= ~PF; +#endif } void nsc800_device::take_interrupt_nsc800() @@ -3240,6 +3266,11 @@ void nsc800_device::take_interrupt_nsc800() m_icount -= m_cc_op[0xff] + cc_ex[0xff]; WZ=PCD; + +#if HAS_LDAIR_QUIRK + /* reset parity flag after LD A,I or LD A,R */ + if (m_after_ldair) F &= ~PF; +#endif } /**************************************************************************** @@ -3486,40 +3517,14 @@ void z80_device::execute_run() return; } - /* check for NMIs on the way in; they can only be set externally */ - /* via timers, and can't be dynamically enabled, so it is safe */ - /* to just check here */ - if (m_nmi_pending) - { - LOG(("Z80 '%s' take NMI\n", tag())); - PRVPC = -1; /* there isn't a valid previous program counter */ - leave_halt(); /* Check if processor was halted */ - -#if HAS_LDAIR_QUIRK - /* reset parity flag after LD A,I or LD A,R */ - if (m_after_ldair) F &= ~PF; -#endif - m_after_ldair = FALSE; - - m_iff1 = 0; - push(m_pc); - PCD = 0x0066; - WZ=PCD; - m_icount -= 11; - m_nmi_pending = FALSE; - } - do { - /* check for IRQs before each instruction */ - if (m_irq_state != CLEAR_LINE && m_iff1 && !m_after_ei) - { -#if HAS_LDAIR_QUIRK - /* reset parity flag after LD A,I or LD A,R */ - if (m_after_ldair) F &= ~PF; -#endif + // check for interrupts before each instruction + if (m_nmi_pending) + take_nmi(); + else if (m_irq_state != CLEAR_LINE && m_iff1 && !m_after_ei) take_interrupt(); - } + m_after_ei = FALSE; m_after_ldair = FALSE; @@ -3543,34 +3548,18 @@ void nsc800_device::execute_run() return; } - /* check for NMIs on the way in; they can only be set externally */ - /* via timers, and can't be dynamically enabled, so it is safe */ - /* to just check here */ - if (m_nmi_pending) - { - LOG(("Z80 '%s' take NMI\n", tag())); - PRVPC = -1; /* there isn't a valid previous program counter */ - leave_halt(); /* Check if processor was halted */ - - m_iff1 = 0; - push(m_pc); - PCD = 0x0066; - WZ=PCD; - m_icount -= 11; - m_nmi_pending = FALSE; - } - do { - /* check for NSC800 IRQs line RSTA, RSTB, RSTC */ - if ((m_nsc800_irq_state[NSC800_RSTA] != CLEAR_LINE || m_nsc800_irq_state[NSC800_RSTB] != CLEAR_LINE || m_nsc800_irq_state[NSC800_RSTC] != CLEAR_LINE) && m_iff1 && !m_after_ei) + // check for interrupts before each instruction + if (m_nmi_pending) + take_nmi(); + else if ((m_nsc800_irq_state[NSC800_RSTA] != CLEAR_LINE || m_nsc800_irq_state[NSC800_RSTB] != CLEAR_LINE || m_nsc800_irq_state[NSC800_RSTC] != CLEAR_LINE) && m_iff1 && !m_after_ei) take_interrupt_nsc800(); - - /* check for IRQs before each instruction */ - if (m_irq_state != CLEAR_LINE && m_iff1 && !m_after_ei) + else if (m_irq_state != CLEAR_LINE && m_iff1 && !m_after_ei) take_interrupt(); m_after_ei = FALSE; + m_after_ldair = FALSE; PRVPC = PCD; debugger_instruction_hook(this, PCD); diff --git a/src/devices/cpu/z80/z80.h b/src/devices/cpu/z80/z80.h index faed3eb832c..70c8b8f68ac 100644 --- a/src/devices/cpu/z80/z80.h +++ b/src/devices/cpu/z80/z80.h @@ -239,6 +239,7 @@ protected: void ei(); void take_interrupt(); + void take_nmi(); // address spaces const address_space_config m_program_config; -- cgit v1.2.3-70-g09d2 From 5b432512fae69fd4f8e37861bac1dda5752d7d61 Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 7 Feb 2016 14:37:29 +0100 Subject: z80: removed obsolete irq_line write handler --- src/devices/cpu/z80/z80.cpp | 43 ++++++++++++++----------------------------- src/devices/cpu/z80/z80.h | 2 -- src/mame/drivers/bw12.cpp | 4 ++-- src/mame/drivers/camplynx.cpp | 4 ++-- src/mame/drivers/fantland.cpp | 2 +- src/mame/drivers/suna16.cpp | 2 +- 6 files changed, 20 insertions(+), 37 deletions(-) diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp index 4f38a4e1866..e798a1153b2 100644 --- a/src/devices/cpu/z80/z80.cpp +++ b/src/devices/cpu/z80/z80.cpp @@ -3510,15 +3510,15 @@ void nsc800_device::device_reset() ****************************************************************************/ void z80_device::execute_run() { - if (m_wait_state) - { - // stalled - m_icount = 0; - return; - } - do { + if (m_wait_state) + { + // stalled + m_icount = 0; + return; + } + // check for interrupts before each instruction if (m_nmi_pending) take_nmi(); @@ -3532,24 +3532,20 @@ void z80_device::execute_run() debugger_instruction_hook(this, PCD); m_r++; EXEC(op,rop()); - - if (m_wait_state) - m_icount = 0; - } while (m_icount > 0); } void nsc800_device::execute_run() { - if (m_wait_state) - { - // stalled - m_icount = 0; - return; - } - do { + if (m_wait_state) + { + // stalled + m_icount = 0; + return; + } + // check for interrupts before each instruction if (m_nmi_pending) take_nmi(); @@ -3565,10 +3561,6 @@ void nsc800_device::execute_run() debugger_instruction_hook(this, PCD); m_r++; EXEC(op,rop()); - - if (m_wait_state) - m_icount = 0; - } while (m_icount > 0); } @@ -3745,10 +3737,3 @@ nsc800_device::nsc800_device(const machine_config &mconfig, const char *tag, dev } const device_type NSC800 = &device_creator; - - - -WRITE_LINE_MEMBER( z80_device::irq_line ) -{ - set_input_line( INPUT_LINE_IRQ0, state ); -} diff --git a/src/devices/cpu/z80/z80.h b/src/devices/cpu/z80/z80.h index 70c8b8f68ac..38cc207347e 100644 --- a/src/devices/cpu/z80/z80.h +++ b/src/devices/cpu/z80/z80.h @@ -42,8 +42,6 @@ class z80_device : public cpu_device public: z80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - DECLARE_WRITE_LINE_MEMBER( irq_line ); - void z80_set_cycle_tables(const UINT8 *op, const UINT8 *cb, const UINT8 *ed, const UINT8 *xy, const UINT8 *xycb, const UINT8 *ex); template static devcb_base &set_irqack_cb(device_t &device, _Object object) { return downcast(device).m_irqack_cb.set_callback(object); } template static devcb_base &set_refresh_cb(device_t &device, _Object object) { return downcast(device).m_refresh_cb.set_callback(object); } diff --git a/src/mame/drivers/bw12.cpp b/src/mame/drivers/bw12.cpp index fb9e1ce66c2..e0b9a4584de 100644 --- a/src/mame/drivers/bw12.cpp +++ b/src/mame/drivers/bw12.cpp @@ -574,8 +574,8 @@ static MACHINE_CONFIG_START( common, bw12_state ) MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) MCFG_PIA_CA2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) MCFG_PIA_CB2_HANDLER(WRITELINE(bw12_state, pia_cb2_w)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE(Z80_TAG, z80_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE(Z80_TAG, z80_device, irq_line)) + MCFG_PIA_IRQA_HANDLER(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_PIA_IRQB_HANDLER(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_16MHz/4, 0, 0, 0, 0) MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) diff --git a/src/mame/drivers/camplynx.cpp b/src/mame/drivers/camplynx.cpp index 96cc919dfb9..d5647dfbcde 100644 --- a/src/mame/drivers/camplynx.cpp +++ b/src/mame/drivers/camplynx.cpp @@ -831,7 +831,7 @@ static MACHINE_CONFIG_START( lynx48k, camplynx_state ) MCFG_MC6845_SHOW_BORDER_AREA(false) MCFG_MC6845_CHAR_WIDTH(8) MCFG_MC6845_UPDATE_ROW_CB(camplynx_state, lynx48k_update_row) - MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE("maincpu", z80_device, irq_line)) + MCFG_MC6845_OUT_VSYNC_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( lynx96k, lynx48k ) @@ -871,7 +871,7 @@ static MACHINE_CONFIG_START( lynx128k, camplynx_state ) MCFG_MC6845_SHOW_BORDER_AREA(false) MCFG_MC6845_CHAR_WIDTH(8) MCFG_MC6845_UPDATE_ROW_CB(camplynx_state, lynx128k_update_row) - MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE("maincpu", z80_device, irq_line)) + MCFG_MC6845_OUT_VSYNC_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) MCFG_FRAGMENT_ADD(lynx_disk) MACHINE_CONFIG_END diff --git a/src/mame/drivers/fantland.cpp b/src/mame/drivers/fantland.cpp index 4abd445eb35..af10ddd4bd1 100644 --- a/src/mame/drivers/fantland.cpp +++ b/src/mame/drivers/fantland.cpp @@ -1047,7 +1047,7 @@ static MACHINE_CONFIG_START( wheelrun, fantland_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ymsnd", YM3526, XTAL_14MHz/4) - MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", z80_device, irq_line)) + MCFG_YM3526_IRQ_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_IRQ0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/suna16.cpp b/src/mame/drivers/suna16.cpp index e2d375bc148..f33d0142f62 100644 --- a/src/mame/drivers/suna16.cpp +++ b/src/mame/drivers/suna16.cpp @@ -1021,7 +1021,7 @@ static MACHINE_CONFIG_START( bestbest, suna16_state ) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MCFG_SOUND_ADD("ymsnd", YM3526, XTAL_24MHz/8) /* 3MHz */ - MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", z80_device, irq_line)) + MCFG_YM3526_IRQ_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_IRQ0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) -- cgit v1.2.3-70-g09d2 From 178167b8fe6dd339ba0d759cec0d08f823e84710 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 7 Feb 2016 15:49:55 +0100 Subject: Initial support for BGFX [Dario Manesku, Branimir Karadic, Miodrag Milanovic] Need optimization and cleanup, note that all shaders can be built only on windows due to usage of DirectX DLLs --- .gitignore | 1 + 3rdparty/bgfx/tools/bin/windows/.gitignore | 1 - 3rdparty/bgfx/tools/bin/windows/geometryc.exe | Bin 0 -> 1041934 bytes 3rdparty/bgfx/tools/bin/windows/shaderc.exe | Bin 0 -> 2096654 bytes 3rdparty/bgfx/tools/bin/windows/texturec.exe | Bin 0 -> 5843221 bytes makefile | 4 + shaders/dx11/fs_line.bin | Bin 0 -> 260 bytes shaders/dx11/fs_quad.bin | Bin 0 -> 260 bytes shaders/dx11/fs_quad_texture.bin | Bin 0 -> 396 bytes shaders/dx11/vs_line.bin | Bin 0 -> 465 bytes shaders/dx11/vs_quad.bin | Bin 0 -> 465 bytes shaders/dx11/vs_quad_texture.bin | Bin 0 -> 575 bytes shaders/dx9/fs_line.bin | Bin 0 -> 141 bytes shaders/dx9/fs_quad.bin | Bin 0 -> 141 bytes shaders/dx9/fs_quad_texture.bin | Bin 0 -> 241 bytes shaders/dx9/vs_line.bin | Bin 0 -> 294 bytes shaders/dx9/vs_quad.bin | Bin 0 -> 294 bytes shaders/dx9/vs_quad_texture.bin | Bin 0 -> 330 bytes shaders/gles/fs_line.bin | Bin 0 -> 89 bytes shaders/gles/fs_quad.bin | Bin 0 -> 89 bytes shaders/gles/fs_quad_texture.bin | Bin 0 -> 238 bytes shaders/gles/vs_line.bin | Bin 0 -> 324 bytes shaders/gles/vs_quad.bin | Bin 0 -> 324 bytes shaders/gles/vs_quad_texture.bin | Bin 0 -> 419 bytes shaders/glsl/fs_line.bin | Bin 0 -> 83 bytes shaders/glsl/fs_quad.bin | Bin 0 -> 83 bytes shaders/glsl/fs_quad_texture.bin | Bin 0 -> 181 bytes shaders/glsl/vs_line.bin | Bin 0 -> 294 bytes shaders/glsl/vs_quad.bin | Bin 0 -> 294 bytes shaders/glsl/vs_quad_texture.bin | Bin 0 -> 377 bytes shaders/metal/fs_line.bin | Bin 0 -> 404 bytes shaders/metal/fs_quad.bin | Bin 0 -> 404 bytes shaders/metal/fs_quad_texture.bin | Bin 0 -> 634 bytes shaders/metal/vs_line.bin | Bin 0 -> 653 bytes shaders/metal/vs_quad.bin | Bin 0 -> 653 bytes shaders/metal/vs_quad_texture.bin | Bin 0 -> 757 bytes src/osd/modules/render/bgfx/fs_line.sc | 11 + src/osd/modules/render/bgfx/fs_quad.sc | 11 + src/osd/modules/render/bgfx/fs_quad_texture.sc | 14 + src/osd/modules/render/bgfx/makefile | 13 + src/osd/modules/render/bgfx/varying.def.sc | 7 + src/osd/modules/render/bgfx/vs_line.sc | 13 + src/osd/modules/render/bgfx/vs_quad.sc | 13 + src/osd/modules/render/bgfx/vs_quad_texture.sc | 14 + src/osd/modules/render/drawbgfx.cpp | 580 +++++++++++++++++++++---- 45 files changed, 604 insertions(+), 78 deletions(-) delete mode 100644 3rdparty/bgfx/tools/bin/windows/.gitignore create mode 100644 3rdparty/bgfx/tools/bin/windows/geometryc.exe create mode 100644 3rdparty/bgfx/tools/bin/windows/shaderc.exe create mode 100644 3rdparty/bgfx/tools/bin/windows/texturec.exe create mode 100644 shaders/dx11/fs_line.bin create mode 100644 shaders/dx11/fs_quad.bin create mode 100644 shaders/dx11/fs_quad_texture.bin create mode 100644 shaders/dx11/vs_line.bin create mode 100644 shaders/dx11/vs_quad.bin create mode 100644 shaders/dx11/vs_quad_texture.bin create mode 100644 shaders/dx9/fs_line.bin create mode 100644 shaders/dx9/fs_quad.bin create mode 100644 shaders/dx9/fs_quad_texture.bin create mode 100644 shaders/dx9/vs_line.bin create mode 100644 shaders/dx9/vs_quad.bin create mode 100644 shaders/dx9/vs_quad_texture.bin create mode 100644 shaders/gles/fs_line.bin create mode 100644 shaders/gles/fs_quad.bin create mode 100644 shaders/gles/fs_quad_texture.bin create mode 100644 shaders/gles/vs_line.bin create mode 100644 shaders/gles/vs_quad.bin create mode 100644 shaders/gles/vs_quad_texture.bin create mode 100644 shaders/glsl/fs_line.bin create mode 100644 shaders/glsl/fs_quad.bin create mode 100644 shaders/glsl/fs_quad_texture.bin create mode 100644 shaders/glsl/vs_line.bin create mode 100644 shaders/glsl/vs_quad.bin create mode 100644 shaders/glsl/vs_quad_texture.bin create mode 100644 shaders/metal/fs_line.bin create mode 100644 shaders/metal/fs_quad.bin create mode 100644 shaders/metal/fs_quad_texture.bin create mode 100644 shaders/metal/vs_line.bin create mode 100644 shaders/metal/vs_quad.bin create mode 100644 shaders/metal/vs_quad_texture.bin create mode 100644 src/osd/modules/render/bgfx/fs_line.sc create mode 100644 src/osd/modules/render/bgfx/fs_quad.sc create mode 100644 src/osd/modules/render/bgfx/fs_quad_texture.sc create mode 100644 src/osd/modules/render/bgfx/makefile create mode 100644 src/osd/modules/render/bgfx/varying.def.sc create mode 100644 src/osd/modules/render/bgfx/vs_line.sc create mode 100644 src/osd/modules/render/bgfx/vs_quad.sc create mode 100644 src/osd/modules/render/bgfx/vs_quad_texture.sc diff --git a/.gitignore b/.gitignore index 0edfb01a5b7..a3357981d32 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ !/samples/ !/scripts/ !/src/ +!/shaders/ !/tests/ !/doxygen/ !/web/ diff --git a/3rdparty/bgfx/tools/bin/windows/.gitignore b/3rdparty/bgfx/tools/bin/windows/.gitignore deleted file mode 100644 index 72e8ffc0db8..00000000000 --- a/3rdparty/bgfx/tools/bin/windows/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/3rdparty/bgfx/tools/bin/windows/geometryc.exe b/3rdparty/bgfx/tools/bin/windows/geometryc.exe new file mode 100644 index 00000000000..f1e001cf2ea Binary files /dev/null and b/3rdparty/bgfx/tools/bin/windows/geometryc.exe differ diff --git a/3rdparty/bgfx/tools/bin/windows/shaderc.exe b/3rdparty/bgfx/tools/bin/windows/shaderc.exe new file mode 100644 index 00000000000..0e1b0346140 Binary files /dev/null and b/3rdparty/bgfx/tools/bin/windows/shaderc.exe differ diff --git a/3rdparty/bgfx/tools/bin/windows/texturec.exe b/3rdparty/bgfx/tools/bin/windows/texturec.exe new file mode 100644 index 00000000000..652b3b729de Binary files /dev/null and b/3rdparty/bgfx/tools/bin/windows/texturec.exe differ diff --git a/makefile b/makefile index eae7d59071c..2595a9bba6b 100644 --- a/makefile +++ b/makefile @@ -1367,3 +1367,7 @@ cppcheck: @echo Generate CppCheck analysis report cppcheck --enable=all src/ $(CPPCHECK_PARAMS) -j9 +.PHONY: shaders + +shaders: + $(SILENT) $(MAKE) -C $(SRC)/osd/modules/render/bgfx rebuild diff --git a/shaders/dx11/fs_line.bin b/shaders/dx11/fs_line.bin new file mode 100644 index 00000000000..5bd281a0889 Binary files /dev/null and b/shaders/dx11/fs_line.bin differ diff --git a/shaders/dx11/fs_quad.bin b/shaders/dx11/fs_quad.bin new file mode 100644 index 00000000000..5bd281a0889 Binary files /dev/null and b/shaders/dx11/fs_quad.bin differ diff --git a/shaders/dx11/fs_quad_texture.bin b/shaders/dx11/fs_quad_texture.bin new file mode 100644 index 00000000000..80d85fb1107 Binary files /dev/null and b/shaders/dx11/fs_quad_texture.bin differ diff --git a/shaders/dx11/vs_line.bin b/shaders/dx11/vs_line.bin new file mode 100644 index 00000000000..24d50eb25ac Binary files /dev/null and b/shaders/dx11/vs_line.bin differ diff --git a/shaders/dx11/vs_quad.bin b/shaders/dx11/vs_quad.bin new file mode 100644 index 00000000000..24d50eb25ac Binary files /dev/null and b/shaders/dx11/vs_quad.bin differ diff --git a/shaders/dx11/vs_quad_texture.bin b/shaders/dx11/vs_quad_texture.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/shaders/dx11/vs_quad_texture.bin differ diff --git a/shaders/dx9/fs_line.bin b/shaders/dx9/fs_line.bin new file mode 100644 index 00000000000..5bfd5497f0b Binary files /dev/null and b/shaders/dx9/fs_line.bin differ diff --git a/shaders/dx9/fs_quad.bin b/shaders/dx9/fs_quad.bin new file mode 100644 index 00000000000..5bfd5497f0b Binary files /dev/null and b/shaders/dx9/fs_quad.bin differ diff --git a/shaders/dx9/fs_quad_texture.bin b/shaders/dx9/fs_quad_texture.bin new file mode 100644 index 00000000000..ef8fa0730c3 Binary files /dev/null and b/shaders/dx9/fs_quad_texture.bin differ diff --git a/shaders/dx9/vs_line.bin b/shaders/dx9/vs_line.bin new file mode 100644 index 00000000000..9bd4a9797e0 Binary files /dev/null and b/shaders/dx9/vs_line.bin differ diff --git a/shaders/dx9/vs_quad.bin b/shaders/dx9/vs_quad.bin new file mode 100644 index 00000000000..9bd4a9797e0 Binary files /dev/null and b/shaders/dx9/vs_quad.bin differ diff --git a/shaders/dx9/vs_quad_texture.bin b/shaders/dx9/vs_quad_texture.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/shaders/dx9/vs_quad_texture.bin differ diff --git a/shaders/gles/fs_line.bin b/shaders/gles/fs_line.bin new file mode 100644 index 00000000000..de509a3eeb5 Binary files /dev/null and b/shaders/gles/fs_line.bin differ diff --git a/shaders/gles/fs_quad.bin b/shaders/gles/fs_quad.bin new file mode 100644 index 00000000000..de509a3eeb5 Binary files /dev/null and b/shaders/gles/fs_quad.bin differ diff --git a/shaders/gles/fs_quad_texture.bin b/shaders/gles/fs_quad_texture.bin new file mode 100644 index 00000000000..22e2f0c23d0 Binary files /dev/null and b/shaders/gles/fs_quad_texture.bin differ diff --git a/shaders/gles/vs_line.bin b/shaders/gles/vs_line.bin new file mode 100644 index 00000000000..db0ff91e152 Binary files /dev/null and b/shaders/gles/vs_line.bin differ diff --git a/shaders/gles/vs_quad.bin b/shaders/gles/vs_quad.bin new file mode 100644 index 00000000000..db0ff91e152 Binary files /dev/null and b/shaders/gles/vs_quad.bin differ diff --git a/shaders/gles/vs_quad_texture.bin b/shaders/gles/vs_quad_texture.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/shaders/gles/vs_quad_texture.bin differ diff --git a/shaders/glsl/fs_line.bin b/shaders/glsl/fs_line.bin new file mode 100644 index 00000000000..6f8e3df8290 Binary files /dev/null and b/shaders/glsl/fs_line.bin differ diff --git a/shaders/glsl/fs_quad.bin b/shaders/glsl/fs_quad.bin new file mode 100644 index 00000000000..6f8e3df8290 Binary files /dev/null and b/shaders/glsl/fs_quad.bin differ diff --git a/shaders/glsl/fs_quad_texture.bin b/shaders/glsl/fs_quad_texture.bin new file mode 100644 index 00000000000..db0fe2b487b Binary files /dev/null and b/shaders/glsl/fs_quad_texture.bin differ diff --git a/shaders/glsl/vs_line.bin b/shaders/glsl/vs_line.bin new file mode 100644 index 00000000000..7c8490550c7 Binary files /dev/null and b/shaders/glsl/vs_line.bin differ diff --git a/shaders/glsl/vs_quad.bin b/shaders/glsl/vs_quad.bin new file mode 100644 index 00000000000..7c8490550c7 Binary files /dev/null and b/shaders/glsl/vs_quad.bin differ diff --git a/shaders/glsl/vs_quad_texture.bin b/shaders/glsl/vs_quad_texture.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/shaders/glsl/vs_quad_texture.bin differ diff --git a/shaders/metal/fs_line.bin b/shaders/metal/fs_line.bin new file mode 100644 index 00000000000..fb726f353c0 Binary files /dev/null and b/shaders/metal/fs_line.bin differ diff --git a/shaders/metal/fs_quad.bin b/shaders/metal/fs_quad.bin new file mode 100644 index 00000000000..fb726f353c0 Binary files /dev/null and b/shaders/metal/fs_quad.bin differ diff --git a/shaders/metal/fs_quad_texture.bin b/shaders/metal/fs_quad_texture.bin new file mode 100644 index 00000000000..6a3da392480 Binary files /dev/null and b/shaders/metal/fs_quad_texture.bin differ diff --git a/shaders/metal/vs_line.bin b/shaders/metal/vs_line.bin new file mode 100644 index 00000000000..d2eeed80dfd Binary files /dev/null and b/shaders/metal/vs_line.bin differ diff --git a/shaders/metal/vs_quad.bin b/shaders/metal/vs_quad.bin new file mode 100644 index 00000000000..d2eeed80dfd Binary files /dev/null and b/shaders/metal/vs_quad.bin differ diff --git a/shaders/metal/vs_quad_texture.bin b/shaders/metal/vs_quad_texture.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/shaders/metal/vs_quad_texture.bin differ diff --git a/src/osd/modules/render/bgfx/fs_line.sc b/src/osd/modules/render/bgfx/fs_line.sc new file mode 100644 index 00000000000..1fcd3b27284 --- /dev/null +++ b/src/osd/modules/render/bgfx/fs_line.sc @@ -0,0 +1,11 @@ +$input v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "../../../../../3rdparty/bgfx/examples/common/common.sh" + +void main() +{ + gl_FragColor = v_color0; +} diff --git a/src/osd/modules/render/bgfx/fs_quad.sc b/src/osd/modules/render/bgfx/fs_quad.sc new file mode 100644 index 00000000000..1fcd3b27284 --- /dev/null +++ b/src/osd/modules/render/bgfx/fs_quad.sc @@ -0,0 +1,11 @@ +$input v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "../../../../../3rdparty/bgfx/examples/common/common.sh" + +void main() +{ + gl_FragColor = v_color0; +} diff --git a/src/osd/modules/render/bgfx/fs_quad_texture.sc b/src/osd/modules/render/bgfx/fs_quad_texture.sc new file mode 100644 index 00000000000..5a45a056171 --- /dev/null +++ b/src/osd/modules/render/bgfx/fs_quad_texture.sc @@ -0,0 +1,14 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "../../../../../3rdparty/bgfx/examples/common/common.sh" + +SAMPLER2D(s_tex, 0); + +void main() +{ + vec4 texel = texture2D(s_tex, v_texcoord0); + gl_FragColor = texel * v_color0; +} diff --git a/src/osd/modules/render/bgfx/makefile b/src/osd/modules/render/bgfx/makefile new file mode 100644 index 00000000000..86735a61c38 --- /dev/null +++ b/src/osd/modules/render/bgfx/makefile @@ -0,0 +1,13 @@ +BGFX_DIR=../../../../../3rdparty/bgfx +RUNTIME_DIR=../../../../.. +BUILD_DIR=../../../../../build + +include $(BGFX_DIR)/scripts/shader.mk + +rebuild: + @make -s --no-print-directory TARGET=0 clean all + @make -s --no-print-directory TARGET=1 clean all + @make -s --no-print-directory TARGET=2 clean all + @make -s --no-print-directory TARGET=3 clean all + @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/src/osd/modules/render/bgfx/varying.def.sc b/src/osd/modules/render/bgfx/varying.def.sc new file mode 100644 index 00000000000..4745725e015 --- /dev/null +++ b/src/osd/modules/render/bgfx/varying.def.sc @@ -0,0 +1,7 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec3 v_pos : TEXCOORD1 = vec3(0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/vs_line.sc b/src/osd/modules/render/bgfx/vs_line.sc new file mode 100644 index 00000000000..874ffcf46ac --- /dev/null +++ b/src/osd/modules/render/bgfx/vs_line.sc @@ -0,0 +1,13 @@ +$input a_position, a_color0 +$output v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "../../../../../3rdparty/bgfx/examples/common/common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/vs_quad.sc b/src/osd/modules/render/bgfx/vs_quad.sc new file mode 100644 index 00000000000..84e23c5a09b --- /dev/null +++ b/src/osd/modules/render/bgfx/vs_quad.sc @@ -0,0 +1,13 @@ +$input a_position, a_color0 +$output v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "../../../../../3rdparty/bgfx/examples/common/common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/vs_quad_texture.sc b/src/osd/modules/render/bgfx/vs_quad_texture.sc new file mode 100644 index 00000000000..c3699f6fbd9 --- /dev/null +++ b/src/osd/modules/render/bgfx/vs_quad_texture.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "../../../../../3rdparty/bgfx/examples/common/common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index ee808bfc197..20b92aeff71 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic +// copyright-holders:Miodrag Milanovic, Dario Manesku, Branimir Karadzic //============================================================ // // drawbgfx.c - BGFX drawer @@ -30,6 +30,8 @@ #include #include +#include +#include //============================================================ // DEBUGGING @@ -110,6 +112,11 @@ public: INT64 m_last_blit_time; INT64 m_last_blit_pixels; + bgfx::ProgramHandle m_progQuad; + bgfx::ProgramHandle m_progQuadTexture; + bgfx::ProgramHandle m_progLine; + bgfx::UniformHandle m_s_texColor; + // Original display_mode }; @@ -155,7 +162,7 @@ static void drawbgfx_exit(void) //============================================================ // renderer_bgfx::create //============================================================ - +bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName); int renderer_bgfx::create() { // create renderer @@ -177,7 +184,12 @@ int renderer_bgfx::create() #endif // Enable debug text. - bgfx::setDebug(BGFX_DEBUG_STATS);// BGFX_DEBUG_TEXT); + bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS + // Create program from shaders. + m_progQuad = loadProgram("vs_quad", "fs_quad"); + m_progQuadTexture = loadProgram("vs_quad_texture", "fs_quad_texture"); + m_progLine = loadProgram("vs_line", "fs_line"); + m_s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1); osd_printf_verbose("Leave drawsdl2_window_create\n"); return 0; @@ -192,6 +204,12 @@ void renderer_bgfx::destroy() // free the memory in the window // destroy_all_textures(); + // + bgfx::destroyUniform(m_s_texColor); + // Cleanup. + bgfx::destroyProgram(m_progQuad); + bgfx::destroyProgram(m_progQuadTexture); + bgfx::destroyProgram(m_progLine); // Shutdown bgfx. bgfx::shutdown(); @@ -215,39 +233,421 @@ int renderer_bgfx::xy_to_render_target(int x, int y, int *xt, int *yt) } #endif +static const bgfx::Memory* loadMem(bx::FileReaderI* _reader, const char* _filePath) +{ + if (bx::open(_reader, _filePath)) + { + uint32_t size = (uint32_t)bx::getSize(_reader); + const bgfx::Memory* mem = bgfx::alloc(size + 1); + bx::read(_reader, mem->data, size); + bx::close(_reader); + mem->data[mem->size - 1] = '\0'; + return mem; + } + + return NULL; +} +static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name) +{ + char filePath[512]; + + const char* shaderPath = "shaders/dx9/"; + + switch (bgfx::getRendererType()) + { + case bgfx::RendererType::Direct3D11: + case bgfx::RendererType::Direct3D12: + shaderPath = "shaders/dx11/"; + break; + + case bgfx::RendererType::OpenGL: + shaderPath = "shaders/glsl/"; + break; + + case bgfx::RendererType::Metal: + shaderPath = "shaders/metal/"; + break; + + case bgfx::RendererType::OpenGLES: + shaderPath = "shaders/gles/"; + break; + + default: + break; + } + + strcpy(filePath, shaderPath); + strcat(filePath, _name); + strcat(filePath, ".bin"); + + return bgfx::createShader(loadMem(_reader, filePath)); +} + +bgfx::ProgramHandle loadProgram(bx::FileReaderI* _reader, const char* _vsName, const char* _fsName) +{ + bgfx::ShaderHandle vsh = loadShader(_reader, _vsName); + bgfx::ShaderHandle fsh = BGFX_INVALID_HANDLE; + if (NULL != _fsName) + { + fsh = loadShader(_reader, _fsName); + } + + return bgfx::createProgram(vsh, fsh, true /* destroy shaders when program is destroyed */); +} +static auto s_fileReader = new bx::CrtFileReader; + +bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName) +{ + + return loadProgram(s_fileReader, _vsName, _fsName); +} //============================================================ // drawbgfx_window_draw //============================================================ +struct PosColorTexCoord0Vertex +{ + float m_x; + float m_y; + float m_z; + uint32_t m_rgba; + float m_u; + float m_v; + + static void init() + { + ms_decl.begin() + .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) + .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) + .add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float) + .end(); + } + + static bgfx::VertexDecl ms_decl; +}; +bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl; + +void screenQuad(float _x1 + , float _y1 + , float _x2 + , float _y2 + , uint32_t _abgr + , render_quad_texuv uv + ) +{ + if (bgfx::checkAvailTransientVertexBuffer(6, PosColorTexCoord0Vertex::ms_decl)) + { + bgfx::TransientVertexBuffer vb; + bgfx::allocTransientVertexBuffer(&vb, 6, PosColorTexCoord0Vertex::ms_decl); + PosColorTexCoord0Vertex* vertex = (PosColorTexCoord0Vertex*)vb.data; + + const float minx = _x1; + const float miny = _y1; + const float maxx = _x2; + const float maxy = _y2; + const float zz = 0.0f; + + vertex[0].m_x = minx; + vertex[0].m_y = miny; + vertex[0].m_z = zz; + vertex[0].m_rgba = _abgr; + vertex[0].m_u = uv.tl.u; + vertex[0].m_v = uv.tl.v; + + vertex[1].m_x = maxx; + vertex[1].m_y = miny; + vertex[1].m_z = zz; + vertex[1].m_rgba = _abgr; + vertex[1].m_u = uv.tr.u; + vertex[1].m_v = uv.tr.v; + + vertex[2].m_x = maxx; + vertex[2].m_y = maxy; + vertex[2].m_z = zz; + vertex[2].m_rgba = _abgr; + vertex[2].m_u = uv.br.u; + vertex[2].m_v = uv.br.v; + + vertex[3].m_x = maxx; + vertex[3].m_y = maxy; + vertex[3].m_z = zz; + vertex[3].m_rgba = _abgr; + vertex[3].m_u = uv.br.u; + vertex[3].m_v = uv.br.v; + + vertex[4].m_x = minx; + vertex[4].m_y = maxy; + vertex[4].m_z = zz; + vertex[4].m_rgba = _abgr; + vertex[4].m_u = uv.bl.u; + vertex[4].m_v = uv.bl.v; + + vertex[5].m_x = minx; + vertex[5].m_y = miny; + vertex[5].m_z = zz; + vertex[5].m_rgba = _abgr; + vertex[5].m_u = uv.tl.u; + vertex[5].m_v = uv.tl.v; + bgfx::setVertexBuffer(&vb); + } +} + + +struct PosColorVertex +{ + float m_x; + float m_y; + uint32_t m_abgr; + + static void init() + { + ms_decl + .begin() + .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float) + .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) + .end(); + } + + static bgfx::VertexDecl ms_decl; +}; +bgfx::VertexDecl PosColorVertex::ms_decl; + +#define MAX_TEMP_COORDS 100 + +void drawPolygon(const float* _coords, uint32_t _numCoords, float _r, uint32_t _abgr) +{ + float tempCoords[MAX_TEMP_COORDS * 2]; + float tempNormals[MAX_TEMP_COORDS * 2]; + + _numCoords = _numCoords < MAX_TEMP_COORDS ? _numCoords : MAX_TEMP_COORDS; + + for (uint32_t ii = 0, jj = _numCoords - 1; ii < _numCoords; jj = ii++) + { + const float* v0 = &_coords[jj * 2]; + const float* v1 = &_coords[ii * 2]; + float dx = v1[0] - v0[0]; + float dy = v1[1] - v0[1]; + float d = sqrtf(dx * dx + dy * dy); + if (d > 0) + { + d = 1.0f / d; + dx *= d; + dy *= d; + } + + tempNormals[jj * 2 + 0] = dy; + tempNormals[jj * 2 + 1] = -dx; + } + + for (uint32_t ii = 0, jj = _numCoords - 1; ii < _numCoords; jj = ii++) + { + float dlx0 = tempNormals[jj * 2 + 0]; + float dly0 = tempNormals[jj * 2 + 1]; + float dlx1 = tempNormals[ii * 2 + 0]; + float dly1 = tempNormals[ii * 2 + 1]; + float dmx = (dlx0 + dlx1) * 0.5f; + float dmy = (dly0 + dly1) * 0.5f; + float dmr2 = dmx * dmx + dmy * dmy; + if (dmr2 > 0.000001f) + { + float scale = 1.0f / dmr2; + if (scale > 10.0f) + { + scale = 10.0f; + } + + dmx *= scale; + dmy *= scale; + } + + tempCoords[ii * 2 + 0] = _coords[ii * 2 + 0] + dmx * _r; + tempCoords[ii * 2 + 1] = _coords[ii * 2 + 1] + dmy * _r; + } + + uint32_t numVertices = _numCoords * 6 + (_numCoords - 2) * 3; + if (bgfx::checkAvailTransientVertexBuffer(numVertices, PosColorVertex::ms_decl)) + { + bgfx::TransientVertexBuffer tvb; + bgfx::allocTransientVertexBuffer(&tvb, numVertices, PosColorVertex::ms_decl); + uint32_t trans = _abgr & 0xffffff; + + PosColorVertex* vertex = (PosColorVertex*)tvb.data; + for (uint32_t ii = 0, jj = _numCoords - 1; ii < _numCoords; jj = ii++) + { + vertex->m_x = _coords[ii * 2 + 0]; + vertex->m_y = _coords[ii * 2 + 1]; + vertex->m_abgr = _abgr; + ++vertex; + + vertex->m_x = _coords[jj * 2 + 0]; + vertex->m_y = _coords[jj * 2 + 1]; + vertex->m_abgr = _abgr; + ++vertex; + + vertex->m_x = tempCoords[jj * 2 + 0]; + vertex->m_y = tempCoords[jj * 2 + 1]; + vertex->m_abgr = trans; + ++vertex; + + vertex->m_x = tempCoords[jj * 2 + 0]; + vertex->m_y = tempCoords[jj * 2 + 1]; + vertex->m_abgr = trans; + ++vertex; + + vertex->m_x = tempCoords[ii * 2 + 0]; + vertex->m_y = tempCoords[ii * 2 + 1]; + vertex->m_abgr = trans; + ++vertex; + + vertex->m_x = _coords[ii * 2 + 0]; + vertex->m_y = _coords[ii * 2 + 1]; + vertex->m_abgr = _abgr; + ++vertex; + } + + for (uint32_t ii = 2; ii < _numCoords; ++ii) + { + vertex->m_x = _coords[0]; + vertex->m_y = _coords[1]; + vertex->m_abgr = _abgr; + ++vertex; + + vertex->m_x = _coords[(ii - 1) * 2 + 0]; + vertex->m_y = _coords[(ii - 1) * 2 + 1]; + vertex->m_abgr = _abgr; + ++vertex; + + vertex->m_x = _coords[ii * 2 + 0]; + vertex->m_y = _coords[ii * 2 + 1]; + vertex->m_abgr = _abgr; + ++vertex; + } + + bgfx::setVertexBuffer(&tvb); + } +} + +void drawLine(float _x0, float _y0, float _x1, float _y1, float _r, uint32_t _abgr, float _fth = 1.0f) +{ + float dx = _x1 - _x0; + float dy = _y1 - _y0; + float d = sqrtf(dx * dx + dy * dy); + if (d > 0.0001f) + { + d = 1.0f / d; + dx *= d; + dy *= d; + } + + float nx = dy; + float ny = -dx; + float verts[4 * 2]; + _r -= _fth; + _r *= 0.5f; + if (_r < 0.01f) + { + _r = 0.01f; + } + + dx *= _r; + dy *= _r; + nx *= _r; + ny *= _r; + + verts[0] = _x0 - dx - nx; + verts[1] = _y0 - dy - ny; + + verts[2] = _x0 - dx + nx; + verts[3] = _y0 - dy + ny; + + verts[4] = _x1 + dx + nx; + verts[5] = _y1 + dy + ny; + + verts[6] = _x1 + dx - nx; + verts[7] = _y1 + dy - ny; + + drawPolygon(verts, 4, _fth, _abgr); +} + +void initVertexDecls() +{ + PosColorTexCoord0Vertex::init(); + PosColorVertex::init(); +} + +static inline +uint32_t u32Color(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255) +{ + return 0 + | (uint32_t(_r) << 0) + | (uint32_t(_g) << 8) + | (uint32_t(_b) << 16) + | (uint32_t(_a) << 24) + ; +} + int renderer_bgfx::draw(int update) { - //if (has_flags(FI_CHANGED) || (window().width() != m_last_width) || (window().height() != m_last_height)) - // do something - //clear_flags(FI_CHANGED); + initVertexDecls(); - bgfx::setViewClear(0 - , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH - , 0x000000ff - , 1.0f - , 0 - ); // Set view 0 default viewport. + int width, height; #ifdef OSD_WINDOWS RECT client; GetClientRect(window().m_hwnd, &client); - bgfx::setViewRect(0, 0, 0, rect_width(&client), rect_height(&client)); + width = rect_width(&client); + height = rect_height(&client); #else - bgfx::setViewRect(0, 0, 0, m_blit_dim.width(), m_blit_dim.height()); + width = m_blit_dim.width(); + height = m_blit_dim.height(); #endif + bgfx::setViewRect(0, 0, 0, width, height); + bgfx::reset(width, height, BGFX_RESET_VSYNC); + // Setup view transform. + { + float view[16]; + bx::mtxIdentity(view); + + float left = 0.0f; + float top = 0.0f; + float right = width; + float bottom = height; + float proj[16]; + bx::mtxOrtho(proj, left, right, bottom, top, 0.0f, 100.0f); + bgfx::setViewTransform(0, view, proj); + } + bgfx::setViewClear(0 + , BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH + , 0x000000ff + , 1.0f + , 0 + ); + // This dummy draw call is here to make sure that view 0 is cleared // if no other draw calls are submitted to view 0. bgfx::touch(0); window().m_primlist->acquire_lock(); + // Draw quad. // now draw for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next()) { + uint64_t flags = BGFX_STATE_RGB_WRITE; + switch (prim->flags & PRIMFLAG_BLENDMODE_MASK) + { + case PRIMFLAG_BLENDMODE(BLENDMODE_NONE): + break; + case PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA): + flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA); + break; + case PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY): + flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO); + break; + case PRIMFLAG_BLENDMODE(BLENDMODE_ADD): + flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_ONE); + } + switch (prim->type) { /** @@ -255,72 +655,98 @@ int renderer_bgfx::draw(int update) * since entering and leaving one is most expensive.. */ case render_primitive::LINE: - // check if it's really a point -/* - if (((prim->bounds.x1 - prim->bounds.x0) == 0) && ((prim->bounds.y1 - prim->bounds.y0) == 0)) - { - curPrimitive=GL_POINTS; - } else { - curPrimitive=GL_LINES; - } - - if(pendingPrimitive!=GL_NO_PRIMITIVE && pendingPrimitive!=curPrimitive) - { - glEnd(); - pendingPrimitive=GL_NO_PRIMITIVE; - } - - if ( pendingPrimitive==GL_NO_PRIMITIVE ) - { - set_blendmode(sdl, PRIMFLAG_GET_BLENDMODE(prim->flags)); - } - - glColor4f(prim->color.r, prim->color.g, prim->color.b, prim->color.a); - - if(pendingPrimitive!=curPrimitive) - { - glBegin(curPrimitive); - pendingPrimitive=curPrimitive; - } - - // check if it's really a point - if (curPrimitive==GL_POINTS) - { - glVertex2f(prim->bounds.x0+hofs, prim->bounds.y0+vofs); - } - else - { - glVertex2f(prim->bounds.x0+hofs, prim->bounds.y0+vofs); - glVertex2f(prim->bounds.x1+hofs, prim->bounds.y1+vofs); - }*/ + + drawLine(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, + 1.0f, + u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), + 1.0f); + bgfx::setState(flags); + bgfx::submit(0, m_progLine); break; case render_primitive::QUAD: -/* - if(pendingPrimitive!=GL_NO_PRIMITIVE) - { - glEnd(); - pendingPrimitive=GL_NO_PRIMITIVE; - } - - glColor4f(prim->color.r, prim->color.g, prim->color.b, prim->color.a); - - set_blendmode(sdl, PRIMFLAG_GET_BLENDMODE(prim->flags)); - - texture = texture_update(window, prim, 0); - - - sdl->texVerticex[0]=prim->bounds.x0 + hofs; - sdl->texVerticex[1]=prim->bounds.y0 + vofs; - sdl->texVerticex[2]=prim->bounds.x1 + hofs; - sdl->texVerticex[3]=prim->bounds.y0 + vofs; - sdl->texVerticex[4]=prim->bounds.x1 + hofs; - sdl->texVerticex[5]=prim->bounds.y1 + vofs; - sdl->texVerticex[6]=prim->bounds.x0 + hofs; - sdl->texVerticex[7]=prim->bounds.y1 + vofs; - - glDrawArrays(GL_QUADS, 0, 4); -*/ + if (prim->texture.base == nullptr) { + render_quad_texuv uv; + uv.tl.u = uv.tl.v = uv.tr.u = uv.tr.v = 0; + uv.bl.u = uv.bl.v = uv.br.u = uv.br.v = 0; + screenQuad(prim->bounds.x0, prim->bounds.y0,prim->bounds.x1, prim->bounds.y1, + u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255),uv); + bgfx::setState(flags); + bgfx::submit(0, m_progQuad); + } else { + screenQuad(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, + 0xFFFFFFFF,prim->texcoords); + bgfx::TextureHandle m_texture; + // render based on the texture coordinates + switch (prim->flags & PRIMFLAG_TEXFORMAT_MASK) + { + case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTEA16): + case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16): + { + auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); + + int y, x; + + for (y = 0; y < prim->texture.height; y++) + { + unsigned char *pARGB32 = (unsigned char *)prim->texture.base + y*prim->texture.rowpixels*2; + unsigned char *pRGBA8 = (unsigned char *)mem->data + y*prim->texture.width * 4; + for (x = 0; x < prim->texture.width*2; x+=2) + { + pRGBA8[x*2 + 0] = prim->texture.palette[pARGB32[x + 0] + pARGB32[x + 1] * 256].r(); + pRGBA8[x*2 + 1] = prim->texture.palette[pARGB32[x + 0] + pARGB32[x + 1] * 256].g(); + pRGBA8[x*2 + 2] = prim->texture.palette[pARGB32[x + 0] + pARGB32[x + 1] * 256].b(); + pRGBA8[x*2 + 3] = prim->texture.palette[pARGB32[x + 0] + pARGB32[x + 1] * 256].a(); + } + } + m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width + , (uint16_t)prim->texture.height + , 1 + , bgfx::TextureFormat::RGBA8 + , 0 + , mem + ); + } + break; + case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16): + break; + case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32): + case PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32): + { + + auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); + int y, x; + + for (y = 0; y < prim->texture.height; y++) + { + unsigned char *pARGB32 = (unsigned char *)prim->texture.base + y*prim->texture.rowpixels*4; + unsigned char *pRGBA8 = (unsigned char *)mem->data + y*prim->texture.width *4; + for (x = 0; x < prim->texture.width *4; x+=4 ) + { + pRGBA8[x] = pARGB32[x+2]; + pRGBA8[x+1] = pARGB32[x+1]; + pRGBA8[x+2] = pARGB32[x+0]; + pRGBA8[x + 3] = pARGB32[x + 3]; + } + } + m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width + , (uint16_t)prim->texture.height + , 1 + , bgfx::TextureFormat::RGBA8 + , 0 + , mem + ); + } + break; + + default: + break; + } + bgfx::setTexture(0, m_s_texColor, m_texture); + bgfx::setState(flags); + bgfx::submit(0, m_progQuadTexture); + bgfx::destroyTexture(m_texture); + } break; default: -- cgit v1.2.3-70-g09d2 From af51222c6ce5c74a85daf6217e6085fb85bc78fc Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sun, 7 Feb 2016 15:13:45 +0000 Subject: added hat trick hero 93 pals [Alex Cmaylo] --- src/mame/drivers/taito_f3.cpp | 70 ++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/src/mame/drivers/taito_f3.cpp b/src/mame/drivers/taito_f3.cpp index 1d33d59194a..17d62e4f18e 100644 --- a/src/mame/drivers/taito_f3.cpp +++ b/src/mame/drivers/taito_f3.cpp @@ -678,15 +678,15 @@ ROM_START( arabianm ) ROM_LOAD16_BYTE("d29-02.ic18", 0x600000, 0x100000, CRC(ed894fe1) SHA1(5bf2fb6abdcf25bc525a2c3b29dbf7aca0b18fea) ) // -std- ROM_REGION( 0x1200, "plds", 0 ) - ROM_LOAD( "palce20v8h.1", 0x0000, 0x0157, CRC(5dd5c8f9) SHA1(5e6153d9e08985b2326dfd6d73f7b90136a7a4b1) ) /* D29-11 */ - ROM_LOAD( "pal20l8b.2", 0x0200, 0x0144, CRC(c91437e2) SHA1(5bd6fb57fd7e0ff957a6ef9509b8f2e35a8ca29a) ) /* D29-12 */ - ROM_LOAD( "palce20v8h.3", 0x0400, 0x0157, CRC(74d61d36) SHA1(c34d8b2d227f69c167d1516dea53e4bcb76491d1) ) /* D29-13 */ - ROM_LOAD( "palce16v8h.11", 0x0600, 0x0117, CRC(51088324) SHA1(b985835b92c9d1e1dae6ae7cba9fa83c4db58bbb) ) /* D29-16 */ - ROM_LOAD( "pal16l8b.22", 0x0800, 0x0104, CRC(3e01e854) SHA1(72f48982673ac8337dac3358b7a79e45c60b9601) ) /* D29-09 */ - ROM_LOAD( "palce16v8h.31", 0x0a00, 0x0117, CRC(e0789727) SHA1(74add02cd194741de5ca6e36a99f9dd3e756fbdf) ) /* D29-17 */ - ROM_LOAD( "pal16l8b.62", 0x0c00, 0x0104, CRC(7093e2f3) SHA1(62bb0085ed93cc8a5fb3a1b08ce9c8071ebda657) ) /* D29-10 */ - ROM_LOAD( "palce20v8h.69", 0x0e00, 0x0157, CRC(25d205d5) SHA1(8859fd498e4d84a55424899d23db470be217eaba) ) /* D29-14 */ - ROM_LOAD( "pal20l8b.70", 0x1000, 0x0144, CRC(92b5b97c) SHA1(653ab0467f71d93eceb8143b124cdedaf1ede750) ) /* D29-15 */ + ROM_LOAD( "D29-11.IC15.bin", 0x0000, 0x0157, CRC(5dd5c8f9) SHA1(5e6153d9e08985b2326dfd6d73f7b90136a7a4b1) ) // palce20v8h.1 + ROM_LOAD( "pal20l8b.2", 0x0200, 0x0144, CRC(c91437e2) SHA1(5bd6fb57fd7e0ff957a6ef9509b8f2e35a8ca29a) ) /* D29-12 */ + ROM_LOAD( "D29-13.IC14.bin", 0x0400, 0x0157, CRC(74d61d36) SHA1(c34d8b2d227f69c167d1516dea53e4bcb76491d1) ) // palce20v8h.3 + ROM_LOAD( "palce16v8h.11", 0x0600, 0x0117, CRC(51088324) SHA1(b985835b92c9d1e1dae6ae7cba9fa83c4db58bbb) ) /* D29-16 */ + ROM_LOAD( "pal16l8b.22", 0x0800, 0x0104, CRC(3e01e854) SHA1(72f48982673ac8337dac3358b7a79e45c60b9601) ) /* D29-09 */ + ROM_LOAD( "palce16v8h.31", 0x0a00, 0x0117, CRC(e0789727) SHA1(74add02cd194741de5ca6e36a99f9dd3e756fbdf) ) /* D29-17 */ + ROM_LOAD( "pal16l8b.62", 0x0c00, 0x0104, CRC(7093e2f3) SHA1(62bb0085ed93cc8a5fb3a1b08ce9c8071ebda657) ) /* D29-10 */ + ROM_LOAD( "D29-14.IC28.bin", 0x0e00, 0x0157, CRC(25d205d5) SHA1(8859fd498e4d84a55424899d23db470be217eaba) ) // palce20v8h.69 + ROM_LOAD( "pal20l8b.70", 0x1000, 0x0144, CRC(92b5b97c) SHA1(653ab0467f71d93eceb8143b124cdedaf1ede750) ) /* D29-15 */ ROM_END ROM_START( arabianmj ) @@ -718,15 +718,15 @@ ROM_START( arabianmj ) ROM_LOAD16_BYTE("d29-02.ic18", 0x600000, 0x100000, CRC(ed894fe1) SHA1(5bf2fb6abdcf25bc525a2c3b29dbf7aca0b18fea) ) // -std- ROM_REGION( 0x1200, "plds", 0 ) - ROM_LOAD( "palce20v8h.1", 0x0000, 0x0157, CRC(5dd5c8f9) SHA1(5e6153d9e08985b2326dfd6d73f7b90136a7a4b1) ) /* D29-11 */ - ROM_LOAD( "pal20l8b.2", 0x0200, 0x0144, CRC(c91437e2) SHA1(5bd6fb57fd7e0ff957a6ef9509b8f2e35a8ca29a) ) /* D29-12 */ - ROM_LOAD( "palce20v8h.3", 0x0400, 0x0157, CRC(74d61d36) SHA1(c34d8b2d227f69c167d1516dea53e4bcb76491d1) ) /* D29-13 */ - ROM_LOAD( "palce16v8h.11", 0x0600, 0x0117, CRC(51088324) SHA1(b985835b92c9d1e1dae6ae7cba9fa83c4db58bbb) ) /* D29-16 */ - ROM_LOAD( "pal16l8b.22", 0x0800, 0x0104, CRC(3e01e854) SHA1(72f48982673ac8337dac3358b7a79e45c60b9601) ) /* D29-09 */ - ROM_LOAD( "palce16v8h.31", 0x0a00, 0x0117, CRC(e0789727) SHA1(74add02cd194741de5ca6e36a99f9dd3e756fbdf) ) /* D29-17 */ - ROM_LOAD( "pal16l8b.62", 0x0c00, 0x0104, CRC(7093e2f3) SHA1(62bb0085ed93cc8a5fb3a1b08ce9c8071ebda657) ) /* D29-10 */ - ROM_LOAD( "palce20v8h.69", 0x0e00, 0x0157, CRC(25d205d5) SHA1(8859fd498e4d84a55424899d23db470be217eaba) ) /* D29-14 */ - ROM_LOAD( "pal20l8b.70", 0x1000, 0x0144, CRC(92b5b97c) SHA1(653ab0467f71d93eceb8143b124cdedaf1ede750) ) /* D29-15 */ + ROM_LOAD( "D29-11.IC15.bin", 0x0000, 0x0157, CRC(5dd5c8f9) SHA1(5e6153d9e08985b2326dfd6d73f7b90136a7a4b1) ) // palce20v8h.1 + ROM_LOAD( "pal20l8b.2", 0x0200, 0x0144, CRC(c91437e2) SHA1(5bd6fb57fd7e0ff957a6ef9509b8f2e35a8ca29a) ) /* D29-12 */ + ROM_LOAD( "D29-13.IC14.bin", 0x0400, 0x0157, CRC(74d61d36) SHA1(c34d8b2d227f69c167d1516dea53e4bcb76491d1) ) // palce20v8h.3 + ROM_LOAD( "palce16v8h.11", 0x0600, 0x0117, CRC(51088324) SHA1(b985835b92c9d1e1dae6ae7cba9fa83c4db58bbb) ) /* D29-16 */ + ROM_LOAD( "pal16l8b.22", 0x0800, 0x0104, CRC(3e01e854) SHA1(72f48982673ac8337dac3358b7a79e45c60b9601) ) /* D29-09 */ + ROM_LOAD( "palce16v8h.31", 0x0a00, 0x0117, CRC(e0789727) SHA1(74add02cd194741de5ca6e36a99f9dd3e756fbdf) ) /* D29-17 */ + ROM_LOAD( "pal16l8b.62", 0x0c00, 0x0104, CRC(7093e2f3) SHA1(62bb0085ed93cc8a5fb3a1b08ce9c8071ebda657) ) /* D29-10 */ + ROM_LOAD( "D29-14.IC28.bin", 0x0e00, 0x0157, CRC(25d205d5) SHA1(8859fd498e4d84a55424899d23db470be217eaba) ) // palce20v8h.69 + ROM_LOAD( "pal20l8b.70", 0x1000, 0x0144, CRC(92b5b97c) SHA1(653ab0467f71d93eceb8143b124cdedaf1ede750) ) /* D29-15 */ ROM_END ROM_START( arabianmu ) @@ -758,15 +758,15 @@ ROM_START( arabianmu ) ROM_LOAD16_BYTE("d29-02.ic18", 0x600000, 0x100000, CRC(ed894fe1) SHA1(5bf2fb6abdcf25bc525a2c3b29dbf7aca0b18fea) ) // -std- ROM_REGION( 0x1200, "plds", 0 ) - ROM_LOAD( "palce20v8h.1", 0x0000, 0x0157, CRC(5dd5c8f9) SHA1(5e6153d9e08985b2326dfd6d73f7b90136a7a4b1) ) /* D29-11 */ - ROM_LOAD( "pal20l8b.2", 0x0200, 0x0144, CRC(c91437e2) SHA1(5bd6fb57fd7e0ff957a6ef9509b8f2e35a8ca29a) ) /* D29-12 */ - ROM_LOAD( "palce20v8h.3", 0x0400, 0x0157, CRC(74d61d36) SHA1(c34d8b2d227f69c167d1516dea53e4bcb76491d1) ) /* D29-13 */ - ROM_LOAD( "palce16v8h.11", 0x0600, 0x0117, CRC(51088324) SHA1(b985835b92c9d1e1dae6ae7cba9fa83c4db58bbb) ) /* D29-16 */ - ROM_LOAD( "pal16l8b.22", 0x0800, 0x0104, CRC(3e01e854) SHA1(72f48982673ac8337dac3358b7a79e45c60b9601) ) /* D29-09 */ - ROM_LOAD( "palce16v8h.31", 0x0a00, 0x0117, CRC(e0789727) SHA1(74add02cd194741de5ca6e36a99f9dd3e756fbdf) ) /* D29-17 */ - ROM_LOAD( "pal16l8b.62", 0x0c00, 0x0104, CRC(7093e2f3) SHA1(62bb0085ed93cc8a5fb3a1b08ce9c8071ebda657) ) /* D29-10 */ - ROM_LOAD( "palce20v8h.69", 0x0e00, 0x0157, CRC(25d205d5) SHA1(8859fd498e4d84a55424899d23db470be217eaba) ) /* D29-14 */ - ROM_LOAD( "pal20l8b.70", 0x1000, 0x0144, CRC(92b5b97c) SHA1(653ab0467f71d93eceb8143b124cdedaf1ede750) ) /* D29-15 */ + ROM_LOAD( "D29-11.IC15.bin", 0x0000, 0x0157, CRC(5dd5c8f9) SHA1(5e6153d9e08985b2326dfd6d73f7b90136a7a4b1) ) // palce20v8h.1 + ROM_LOAD( "pal20l8b.2", 0x0200, 0x0144, CRC(c91437e2) SHA1(5bd6fb57fd7e0ff957a6ef9509b8f2e35a8ca29a) ) /* D29-12 */ + ROM_LOAD( "D29-13.IC14.bin", 0x0400, 0x0157, CRC(74d61d36) SHA1(c34d8b2d227f69c167d1516dea53e4bcb76491d1) ) // palce20v8h.3 + ROM_LOAD( "palce16v8h.11", 0x0600, 0x0117, CRC(51088324) SHA1(b985835b92c9d1e1dae6ae7cba9fa83c4db58bbb) ) /* D29-16 */ + ROM_LOAD( "pal16l8b.22", 0x0800, 0x0104, CRC(3e01e854) SHA1(72f48982673ac8337dac3358b7a79e45c60b9601) ) /* D29-09 */ + ROM_LOAD( "palce16v8h.31", 0x0a00, 0x0117, CRC(e0789727) SHA1(74add02cd194741de5ca6e36a99f9dd3e756fbdf) ) /* D29-17 */ + ROM_LOAD( "pal16l8b.62", 0x0c00, 0x0104, CRC(7093e2f3) SHA1(62bb0085ed93cc8a5fb3a1b08ce9c8071ebda657) ) /* D29-10 */ + ROM_LOAD( "D29-14.IC28.bin", 0x0e00, 0x0157, CRC(25d205d5) SHA1(8859fd498e4d84a55424899d23db470be217eaba) ) // palce20v8h.69 + ROM_LOAD( "pal20l8b.70", 0x1000, 0x0144, CRC(92b5b97c) SHA1(653ab0467f71d93eceb8143b124cdedaf1ede750) ) /* D29-15 */ ROM_END ROM_START( ridingf ) @@ -1068,8 +1068,24 @@ ROM_START( hthero93u ) ROM_LOAD16_BYTE("d49-04.38", 0x000000, 0x200000, CRC(44b365a9) SHA1(14c4a6b193a0069360406c74c500ba24f2a55b62) ) // C8 C9 CA CB // half empty ROM_LOAD16_BYTE("d49-05.41", 0x600000, 0x100000, CRC(ed894fe1) SHA1(5bf2fb6abdcf25bc525a2c3b29dbf7aca0b18fea) ) // -std- + + ROM_REGION(0x800000, "palsgame" , ROMREGION_ERASE00 ) // all unprotected / unlocked (dumped from single PCB version of game) + ROM_LOAD ("D49-12.IC60.bin", 0x000, 0x104, CRC(aa4cff37) SHA1(58e67e3807a32c403b1ef145d4bc5f91e1537554) ) + ROM_LOAD ("D49-21.IC17.bin", 0x000, 0x104, CRC(821775d4) SHA1(f066cf6ee2118dd57c904fcff3bb287d57e16367) ) + + ROM_REGION(0x800000, "palsbase" , ROMREGION_ERASE00 ) // all unprotected / unlocked (dumped from single PCB version of game) + // these should be the same on this and Arabian Magic, but the dumps don't match in all cases, maybe the AM ones were protected? + ROM_LOAD ("D29-11.IC15.bin", 0x000000, 0x157, CRC(5dd5c8f9) SHA1(5e6153d9e08985b2326dfd6d73f7b90136a7a4b1) ) + ROM_LOAD ("D29-12.IC12.bin", 0x000000, 0x144, CRC(c872f1fd) SHA1(6bcf766f76d83c18fa1c095716a1298581aa06c2) ) + ROM_LOAD ("D29-13.IC14.bin", 0x000000, 0x157, CRC(74d61d36) SHA1(c34d8b2d227f69c167d1516dea53e4bcb76491d1) ) + ROM_LOAD ("D29-14.IC28.bin", 0x000000, 0x157, CRC(25d205d5) SHA1(8859fd498e4d84a55424899d23db470be217eaba) ) + ROM_LOAD ("D29-15.IC29.bin", 0x000000, 0x157, CRC(692eb582) SHA1(db40eb294cecc65d4a0d65e75b6daef75dcc2fb7) ) + ROM_LOAD ("D29-16.IC7.bin", 0x000000, 0x117, CRC(11875f52) SHA1(2c3a7a15b3184421ca1bc88383eeccf49ee0d22c) ) + ROM_LOAD ("D29-17.IC16.bin", 0x000000, 0x117, CRC(a0f74b51) SHA1(9d19e9099be965152a3cfbc5593e6abedb7c9d71) ) + ROM_END + ROM_START( trstar ) ROM_REGION(0x200000, "maincpu", 0) /* 68020 code */ ROM_LOAD32_BYTE("d53-15-1.24", 0x000000, 0x40000, CRC(098bba94) SHA1(b77990213ac790d15bdc0dc1e8f7adf04fe5e952) ) -- cgit v1.2.3-70-g09d2 From db8397c4703d19c1fb9cb7e2b816452c609ac98b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 7 Feb 2016 17:22:29 +0100 Subject: propagate color to texture (nw) --- src/osd/modules/render/drawbgfx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 20b92aeff71..0ff8b199859 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -675,7 +675,7 @@ int renderer_bgfx::draw(int update) bgfx::submit(0, m_progQuad); } else { screenQuad(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, - 0xFFFFFFFF,prim->texcoords); + u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255),prim->texcoords); bgfx::TextureHandle m_texture; // render based on the texture coordinates switch (prim->flags & PRIMFLAG_TEXFORMAT_MASK) -- cgit v1.2.3-70-g09d2 From ee3b2ca1b6afdd95bd22f347d8e765d5872194d2 Mon Sep 17 00:00:00 2001 From: Ville Linde Date: Sun, 7 Feb 2016 18:43:13 +0200 Subject: viper: fix U13 fail (nw) --- src/mame/drivers/viper.cpp | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/mame/drivers/viper.cpp b/src/mame/drivers/viper.cpp index 12a63346d22..831d34f32fd 100644 --- a/src/mame/drivers/viper.cpp +++ b/src/mame/drivers/viper.cpp @@ -327,21 +327,21 @@ some other components. It will be documented at a later date. Game status: ppp2nd POST: "DIP SWITCH ERROR", "NO SECURITY ERROR" boxingm Goes to attract mode when ran with memory card check. Coins up. - code1d,b Inf loop on blue screen (writes to I2C before) - gticlub2 Inf loop on blue screen (writes to I2C before) + code1d,b RTC self check bad + gticlub2 Attract mode works. Coins up. Hangs in car selection. gticlub2ea Doesn't boot: bad CHD? jpark3 POST?: Shows "Now loading..." then black screen (sets global timer 1 on EPIC...) - mocapglf Inf loop on blue screen (writes to I2C before) - mocapb,j POST: U13 bad - p911,e,j,uc,kc POST: U13 bad - p9112 POST: U13 bad + mocapglf Security code error + mocapb,j Crash after self checks + p911,e,j,uc,kc "Distribution error" + p9112 RTC self check bad popn9 Doesn't boot: bad CHD? - sscopex/sogeki Inf loop on blue screen + sscopex/sogeki Security code error thrild2,a Attract mode with partial graphics. Coins up. Hangs in car selection screen. thrild2c Inf loop on blue screen tsurugi Goes to attract mode when ran with memory card check. Coins up. tsurugij No NVRAM - wcombat Hangs on blue screen + wcombat Stuck on network check xtrial Attract mode. Hangs. mfightc,c Passes POST. Waits for network connection from main unit? Spams writes to 0xffe08000 (8-bit) */ @@ -355,7 +355,7 @@ some other components. It will be documented at a later date. #include "video/voodoo.h" #define VIPER_DEBUG_LOG -#define VIPER_DEBUG_EPIC_INTS 1 +#define VIPER_DEBUG_EPIC_INTS 0 #define VIPER_DEBUG_EPIC_TIMERS 0 #define VIPER_DEBUG_EPIC_REGS 0 #define VIPER_DEBUG_EPIC_I2C 0 @@ -363,7 +363,6 @@ some other components. It will be documented at a later date. #define SDRAM_CLOCK 166666666 // Main SDRAMs run at 166MHz -static UINT32 *workram; static emu_timer *ds2430_timer; @@ -377,7 +376,8 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_ata(*this, "ata"), - m_voodoo(*this, "voodoo") + m_voodoo(*this, "voodoo"), + m_workram(*this, "workram") { } @@ -430,6 +430,9 @@ public: INTERRUPT_GEN_MEMBER(viper_vblank); TIMER_CALLBACK_MEMBER(epic_global_timer_callback); TIMER_CALLBACK_MEMBER(ds2430_timer_callback); +#if VIPER_DEBUG_EPIC_REGS + const char* epic_get_register_name(UINT32 reg); +#endif void epic_update_interrupts(); void mpc8240_interrupt(int irq); void mpc8240_epic_init(); @@ -439,6 +442,7 @@ public: required_device m_maincpu; required_device m_ata; required_device m_voodoo; + required_shared_ptr m_workram; }; UINT32 viper_state::screen_update_viper(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) @@ -624,7 +628,7 @@ struct MPC8240_EPIC static MPC8240_EPIC epic; #if VIPER_DEBUG_EPIC_REGS -const viper_state::char* epic_get_register_name(UINT32 reg) +const char* viper_state::epic_get_register_name(UINT32 reg) { switch (reg >> 16) { @@ -866,7 +870,9 @@ READ32_MEMBER(viper_state::epic_r) { if (epic.i2c_state == I2C_STATE_ADDRESS_CYCLE) { +#if VIPER_DEBUG_EPIC_I2C printf("I2C address cycle read\n"); +#endif epic.i2c_state = I2C_STATE_DATA_TRANSFER; @@ -876,7 +882,9 @@ READ32_MEMBER(viper_state::epic_r) // generate interrupt if interrupt are enabled if (epic.i2c_cr & 0x40) { +#if VIPER_DEBUG_EPIC_I2C printf("I2C interrupt\n"); +#endif mpc8240_interrupt(MPC8240_I2C_IRQ); // set interrupt flag in status register @@ -885,7 +893,9 @@ READ32_MEMBER(viper_state::epic_r) } else if (epic.i2c_state == I2C_STATE_DATA_TRANSFER) { +#if VIPER_DEBUG_EPIC_I2C printf("I2C data read\n"); +#endif epic.i2c_state = I2C_STATE_ADDRESS_CYCLE; @@ -967,7 +977,7 @@ READ32_MEMBER(viper_state::epic_r) ret |= epic.irq[MPC8240_I2C_IRQ].priority << 16; ret |= epic.irq[MPC8240_I2C_IRQ].vector; ret |= epic.irq[MPC8240_I2C_IRQ].active ? 0x40000000 : 0; - return ret; + break; } } break; @@ -1756,7 +1766,7 @@ READ64_MEMBER(viper_state::unk1_r) reg |= (unk1_bit << 5); reg |= 0x40; // if this bit is 0, loads a disk copier instead //r |= 0x04; // screen flip - //reg |= 0x08; // memory card check (1 = enable) + reg |= 0x08; // memory card check (1 = enable) r |= reg << 40; @@ -1852,8 +1862,8 @@ void viper_state::DS2430_w(int bit) case DS2430_STATE_READ_MEM: { + unk1_bit = (ds2430_rom[(ds2430_data_count/8)] >> (ds2430_data_count%8)) & 1; ds2430_data_count++; - unk1_bit = rand () & 1; printf("DS2430_w: read mem %d, bit = %d\n", ds2430_data_count, unk1_bit); if (ds2430_data_count >= 256) @@ -2045,7 +2055,7 @@ WRITE64_MEMBER(viper_state::unk_serial_w) /*****************************************************************************/ static ADDRESS_MAP_START(viper_map, AS_PROGRAM, 64, viper_state ) - AM_RANGE(0x00000000, 0x00ffffff) AM_MIRROR(0x1000000) AM_RAM + AM_RANGE(0x00000000, 0x00ffffff) AM_MIRROR(0x1000000) AM_RAM AM_SHARE("workram") AM_RANGE(0x80000000, 0x800fffff) AM_READWRITE32(epic_r, epic_w,U64(0xffffffffffffffff)) AM_RANGE(0x82000000, 0x83ffffff) AM_READWRITE(voodoo3_r, voodoo3_w) AM_RANGE(0x84000000, 0x85ffffff) AM_READWRITE(voodoo3_lfb_r, voodoo3_lfb_w) @@ -2144,7 +2154,7 @@ void viper_state::machine_start() m_maincpu->ppcdrc_set_options(PPCDRC_COMPATIBLE_OPTIONS); /* configure fast RAM regions for DRC */ - m_maincpu->ppcdrc_add_fastram(0x00000000, 0x00ffffff, FALSE, workram); + m_maincpu->ppcdrc_add_fastram(0x00000000, 0x00ffffff, FALSE, m_workram); ds2430_rom = (UINT8*)memregion("ds2430")->base(); } -- cgit v1.2.3-70-g09d2 From e3d8dbb3645c5976ce0af573f75be6d2f2367d24 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 7 Feb 2016 19:18:45 +0100 Subject: optimized code a bit, reused Aarons code (nw) --- src/osd/modules/render/drawbgfx.cpp | 371 +++++++++++++++++++++++++++--------- 1 file changed, 277 insertions(+), 94 deletions(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 0ff8b199859..0dc0e44554f 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Dario Manesku, Branimir Karadzic +// copyright-holders:Miodrag Milanovic,Dario Manesku,Branimir Karadzic,Aaron Giles //============================================================ // // drawbgfx.c - BGFX drawer @@ -586,6 +586,172 @@ uint32_t u32Color(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255) ; } +static UINT32 getABGR(UINT32 ARGB) { + return + ((ARGB >> 24) << 24) | // Alpha + ((ARGB >> 16) & 0xFF) | // Red -> Blue + ((ARGB >> 8) & 0xFF) << 8 | // Green + ((ARGB)& 0xFF) << 16; // Blue -> Red +} + + +//============================================================ +// copyline_palette16 +//============================================================ + +static inline void copyline_palette16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette) +{ + for (int x = 0; x < width; x++) + *dst++ = 0xff000000 | getABGR(palette[*src++]); +} + + +//============================================================ +// copyline_palettea16 +//============================================================ + +static inline void copyline_palettea16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette) +{ + for (int x = 0; x < width; x++) + *dst++ = getABGR(palette[*src++]); +} + + +//============================================================ +// copyline_rgb32 +//============================================================ + +static inline void copyline_rgb32(UINT32 *dst, const UINT32 *src, int width, const rgb_t *palette) +{ + int x; + + // palette (really RGB map) case + if (palette != NULL) + { + for (x = 0; x < width; x++) + { + rgb_t srcpix = *src++; + *dst++ = 0xff000000 | palette[0x200 + srcpix.b()] | palette[0x100 + srcpix.g()] | palette[srcpix.r()]; + } + } + + // direct case + else + { + for (x = 0; x < width; x++) + *dst++ = getABGR(0xff000000 | *src++); + } +} + + +//============================================================ +// copyline_argb32 +//============================================================ + +static inline void copyline_argb32(UINT32 *dst, const UINT32 *src, int width, const rgb_t *palette) +{ + int x; + // palette (really RGB map) case + if (palette != NULL) + { + for (x = 0; x < width; x++) + { + rgb_t srcpix = *src++; + *dst++ = (srcpix & 0xff000000) | palette[0x200 + srcpix.b()] | palette[0x100 + srcpix.g()] | palette[srcpix.r()]; + } + } + + // direct case + else + { + for (x = 0; x < width; x++) + *dst++ = getABGR(*src++); + } +} + +static inline UINT32 ycc_to_rgb(UINT8 y, UINT8 cb, UINT8 cr) +{ + /* original equations: + + C = Y - 16 + D = Cb - 128 + E = Cr - 128 + + R = clip(( 298 * C + 409 * E + 128) >> 8) + G = clip(( 298 * C - 100 * D - 208 * E + 128) >> 8) + B = clip(( 298 * C + 516 * D + 128) >> 8) + + R = clip(( 298 * (Y - 16) + 409 * (Cr - 128) + 128) >> 8) + G = clip(( 298 * (Y - 16) - 100 * (Cb - 128) - 208 * (Cr - 128) + 128) >> 8) + B = clip(( 298 * (Y - 16) + 516 * (Cb - 128) + 128) >> 8) + + R = clip(( 298 * Y - 298 * 16 + 409 * Cr - 409 * 128 + 128) >> 8) + G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8) + B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8) + + R = clip(( 298 * Y - 298 * 16 + 409 * Cr - 409 * 128 + 128) >> 8) + G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8) + B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8) + */ + int r, g, b, common; + + common = 298 * y - 298 * 16; + r = (common + 409 * cr - 409 * 128 + 128) >> 8; + g = (common - 100 * cb + 100 * 128 - 208 * cr + 208 * 128 + 128) >> 8; + b = (common + 516 * cb - 516 * 128 + 128) >> 8; + + if (r < 0) r = 0; + else if (r > 255) r = 255; + if (g < 0) g = 0; + else if (g > 255) g = 255; + if (b < 0) b = 0; + else if (b > 255) b = 255; + + return rgb_t(0xff, b, g, r); +} + +//============================================================ +// copyline_yuy16_to_argb +//============================================================ + +static inline void copyline_yuy16_to_argb(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette, int xprescale) +{ + int x; + + assert(width % 2 == 0); + + // palette (really RGB map) case + if (palette != NULL) + { + for (x = 0; x < width / 2; x++) + { + UINT16 srcpix0 = *src++; + UINT16 srcpix1 = *src++; + UINT8 cb = srcpix0 & 0xff; + UINT8 cr = srcpix1 & 0xff; + for (int x2 = 0; x2 < xprescale; x2++) + *dst++ = ycc_to_rgb(palette[0x000 + (srcpix0 >> 8)], cb, cr); + for (int x2 = 0; x2 < xprescale; x2++) + *dst++ = ycc_to_rgb(palette[0x000 + (srcpix1 >> 8)], cb, cr); + } + } + + // direct case + else + { + for (x = 0; x < width; x += 2) + { + UINT16 srcpix0 = *src++; + UINT16 srcpix1 = *src++; + UINT8 cb = srcpix0 & 0xff; + UINT8 cr = srcpix1 & 0xff; + for (int x2 = 0; x2 < xprescale; x2++) + *dst++ = ycc_to_rgb(srcpix0 >> 8, cb, cr); + for (int x2 = 0; x2 < xprescale; x2++) + *dst++ = ycc_to_rgb(srcpix1 >> 8, cb, cr); + } + } +} int renderer_bgfx::draw(int update) { initVertexDecls(); @@ -636,121 +802,138 @@ int renderer_bgfx::draw(int update) uint64_t flags = BGFX_STATE_RGB_WRITE; switch (prim->flags & PRIMFLAG_BLENDMODE_MASK) { - case PRIMFLAG_BLENDMODE(BLENDMODE_NONE): - break; - case PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA): - flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA); - break; - case PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY): - flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO); - break; - case PRIMFLAG_BLENDMODE(BLENDMODE_ADD): - flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_ONE); + case PRIMFLAG_BLENDMODE(BLENDMODE_NONE): + break; + case PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA): + flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA); + break; + case PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY): + flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO); + break; + case PRIMFLAG_BLENDMODE(BLENDMODE_ADD): + flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_ONE); } - + bool alpha = false; switch (prim->type) { /** * Try to stay in one Begin/End block as long as possible, * since entering and leaving one is most expensive.. */ - case render_primitive::LINE: - - drawLine(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, - 1.0f, - u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), - 1.0f); + case render_primitive::LINE: + + drawLine(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, + 1.0f, + u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), + 1.0f); + bgfx::setState(flags); + bgfx::submit(0, m_progLine); + break; + + case render_primitive::QUAD: + if (prim->texture.base == nullptr) { + render_quad_texuv uv; + uv.tl.u = uv.tl.v = uv.tr.u = uv.tr.v = 0; + uv.bl.u = uv.bl.v = uv.br.u = uv.br.v = 0; + screenQuad(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, + u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), uv); bgfx::setState(flags); - bgfx::submit(0, m_progLine); - break; - - case render_primitive::QUAD: - if (prim->texture.base == nullptr) { - render_quad_texuv uv; - uv.tl.u = uv.tl.v = uv.tr.u = uv.tr.v = 0; - uv.bl.u = uv.bl.v = uv.br.u = uv.br.v = 0; - screenQuad(prim->bounds.x0, prim->bounds.y0,prim->bounds.x1, prim->bounds.y1, - u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255),uv); - bgfx::setState(flags); - bgfx::submit(0, m_progQuad); - } else { - screenQuad(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, - u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255),prim->texcoords); - bgfx::TextureHandle m_texture; - // render based on the texture coordinates - switch (prim->flags & PRIMFLAG_TEXFORMAT_MASK) - { + bgfx::submit(0, m_progQuad); + } + else { + screenQuad(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, + u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), prim->texcoords); + bgfx::TextureHandle m_texture; + // render based on the texture coordinates + switch (prim->flags & PRIMFLAG_TEXFORMAT_MASK) + { case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTEA16): + alpha = true; case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16): + { + auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); + if (alpha) { - auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); - - int y, x; - - for (y = 0; y < prim->texture.height; y++) + for (int y = 0; y < prim->texture.height; y++) { - unsigned char *pARGB32 = (unsigned char *)prim->texture.base + y*prim->texture.rowpixels*2; - unsigned char *pRGBA8 = (unsigned char *)mem->data + y*prim->texture.width * 4; - for (x = 0; x < prim->texture.width*2; x+=2) - { - pRGBA8[x*2 + 0] = prim->texture.palette[pARGB32[x + 0] + pARGB32[x + 1] * 256].r(); - pRGBA8[x*2 + 1] = prim->texture.palette[pARGB32[x + 0] + pARGB32[x + 1] * 256].g(); - pRGBA8[x*2 + 2] = prim->texture.palette[pARGB32[x + 0] + pARGB32[x + 1] * 256].b(); - pRGBA8[x*2 + 3] = prim->texture.palette[pARGB32[x + 0] + pARGB32[x + 1] * 256].a(); - } + copyline_palettea16((UINT32*)mem->data + y*prim->texture.width, (UINT16*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); } - m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width - , (uint16_t)prim->texture.height - , 1 - , bgfx::TextureFormat::RGBA8 - , 0 - , mem - ); - } - break; - case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16): - break; - case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32): - case PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32): + } + else { - - auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); - int y, x; + for (int y = 0; y < prim->texture.height; y++) + { + copyline_palette16((UINT32*)mem->data + y*prim->texture.width, (UINT16*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); + } + } - for (y = 0; y < prim->texture.height; y++) + m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width + , (uint16_t)prim->texture.height + , 1 + , bgfx::TextureFormat::RGBA8 + , 0 + , mem + ); + } + break; + case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16): + { + auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); + for (int y = 0; y < prim->texture.height; y++) + { + copyline_yuy16_to_argb((UINT32*)mem->data + y*prim->texture.width, (UINT16*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette, 1); + } + m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width + , (uint16_t)prim->texture.height + , 1 + , bgfx::TextureFormat::RGBA8 + , 0 + , mem + ); + } + break; + case PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32): + alpha = true; + case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32): + { + auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); + if (alpha) + { + for (int y = 0; y < prim->texture.height; y++) { - unsigned char *pARGB32 = (unsigned char *)prim->texture.base + y*prim->texture.rowpixels*4; - unsigned char *pRGBA8 = (unsigned char *)mem->data + y*prim->texture.width *4; - for (x = 0; x < prim->texture.width *4; x+=4 ) - { - pRGBA8[x] = pARGB32[x+2]; - pRGBA8[x+1] = pARGB32[x+1]; - pRGBA8[x+2] = pARGB32[x+0]; - pRGBA8[x + 3] = pARGB32[x + 3]; - } + copyline_argb32((UINT32*)mem->data + y*prim->texture.width, (UINT32*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); + } + } + else + { + for (int y = 0; y < prim->texture.height; y++) + { + copyline_rgb32((UINT32*)mem->data + y*prim->texture.width, (UINT32*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); } - m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width - , (uint16_t)prim->texture.height - , 1 - , bgfx::TextureFormat::RGBA8 - , 0 - , mem - ); } - break; - default: - break; + m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width + , (uint16_t)prim->texture.height + , 1 + , bgfx::TextureFormat::RGBA8 + , 0 + , mem + ); } - bgfx::setTexture(0, m_s_texColor, m_texture); - bgfx::setState(flags); - bgfx::submit(0, m_progQuadTexture); - bgfx::destroyTexture(m_texture); + break; + + default: + break; } - break; + bgfx::setTexture(0, m_s_texColor, m_texture); + bgfx::setState(flags); + bgfx::submit(0, m_progQuadTexture); + bgfx::destroyTexture(m_texture); + } + break; - default: - throw emu_fatalerror("Unexpected render_primitive type"); + default: + throw emu_fatalerror("Unexpected render_primitive type"); } } -- cgit v1.2.3-70-g09d2 From 4fa31121f2987142ec4bfe14d8663c5848522882 Mon Sep 17 00:00:00 2001 From: Felipe Corrêa da Silva Sanches Date: Sun, 7 Feb 2016 15:44:57 -0200 Subject: new skeleton driver: Argox Rabbit Printer (model OS-214) --- scripts/target/mame/mess.lua | 1 + src/mame/drivers/argox.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++ src/mame/mess.lst | 1 + 3 files changed, 56 insertions(+) create mode 100644 src/mame/drivers/argox.cpp diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index cfbf4e0667a..1621febf7c7 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -3028,6 +3028,7 @@ files { MAME_DIR .. "src/mame/drivers/ampro.cpp", MAME_DIR .. "src/mame/drivers/amust.cpp", MAME_DIR .. "src/mame/drivers/applix.cpp", + MAME_DIR .. "src/mame/drivers/argox.cpp", MAME_DIR .. "src/mame/drivers/attache.cpp", MAME_DIR .. "src/mame/drivers/aussiebyte.cpp", MAME_DIR .. "src/mame/includes/aussiebyte.h", diff --git a/src/mame/drivers/argox.cpp b/src/mame/drivers/argox.cpp new file mode 100644 index 00000000000..1e760a2c389 --- /dev/null +++ b/src/mame/drivers/argox.cpp @@ -0,0 +1,54 @@ +// license:GPL2+ +// copyright-holders:Felipe Sanches +/*************************************************************************** + + Argox Rabbit Printer + model: 0S-214 + + Skeleton driver by Felipe Correa da Silva Sanches + +***************************************************************************/ + +#include "emu.h" +#include "cpu/h8/h83002.h" + +class os214_state : public driver_device +{ +public: + os214_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + DECLARE_DRIVER_INIT(os214); + required_device m_maincpu; +}; + +static ADDRESS_MAP_START( os214_prg_map, AS_PROGRAM, 16, os214_state ) + AM_RANGE(0x000000, 0x07ffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( os214_io_map, AS_IO, 8, os214_state ) +// ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( os214, os214_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", H83002, XTAL_16MHz) /* X1 xtal value is correct, + but there can be some clock divider perhaps ? */ + MCFG_CPU_PROGRAM_MAP(os214_prg_map) + MCFG_CPU_IO_MAP(os214_io_map) +MACHINE_CONFIG_END + +DRIVER_INIT_MEMBER( os214_state, os214 ) +{ +} + +ROM_START( os214 ) + ROM_REGION( 0x080000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "u9_s2a2-4.03_argox_am.u9", 0x000000, 0x040000, CRC(3bd8b2b1) SHA1(546f9fd8d7e1f589f6e594a332a3429041b49eea) ) + ROM_LOAD16_BYTE( "u8_s2a2-4.03_argox_am.u8", 0x000001, 0x040000, CRC(d49f52af) SHA1(0ca5a70c6c3995f275226af26db965f6ba7ed123) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1996, os214, 0, 0, os214, 0, os214_state, os214, "Argox", "Rabbit Printer (model OS-214)", MACHINE_IS_SKELETON) diff --git a/src/mame/mess.lst b/src/mame/mess.lst index b681d947a1c..ab9173f3110 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2427,6 +2427,7 @@ hec2mdhrx hec2mx80 hec2mx40 hector1 +os214 victor poly880 sc1 -- cgit v1.2.3-70-g09d2 From a3e1adf275a9ce26f26279acd827d5ed42ab9a81 Mon Sep 17 00:00:00 2001 From: Felipe Corrêa da Silva Sanches Date: Sun, 7 Feb 2016 16:35:10 -0200 Subject: [argox os214] overall description of the PCB --- src/mame/drivers/argox.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/mame/drivers/argox.cpp b/src/mame/drivers/argox.cpp index 1e760a2c389..737afea4be2 100644 --- a/src/mame/drivers/argox.cpp +++ b/src/mame/drivers/argox.cpp @@ -7,6 +7,37 @@ Skeleton driver by Felipe Correa da Silva Sanches + OVERALL HARDWARE DESCRIPTION: + + There's a sticker labeled "V4.21" + The board is labeled "ARGOX INFORMATION 48.20401.002 DATE:2003/03/20 REV:4.2" + + There's a soldered IC at U10 which is labeled "A511 093060006 55-20401-003 E" and "OK" + I guess it may be another flash ROM + + External interfaces: + * RS232 serial interface + * Centronics port + + Connectors: + * 4-pin labeled "PEELER" (unused) + * 4-pin labeled "RIBBON" + * 4-pin labeled "MEDIA" + * 4-pin labeled "MOTOR" + * 6-pin labeled "MOTOR" (unpopulated) + * 4-pin labeled "CUTTER" (unused) + * 18-pin unlabeled JP18 (with 4 unused pins) Connects to the printing subassembly + * 9-pin labeled "KEYPAD" (unpopulated) + * 6-pin labeled "LED/KEY" (connects to FEED button, POWER LED and READY LED) + + Jumpers: + * set of 2 jumpers (JP1 and JP2) with a jumper inserted at JP2 + * set of 6 unlabelled with jumpers inserted at position #0 and #3 + + DIP sockets: + * u8 and u9 hold the FLASH ROM chips + * U19 is an unpopulated DIP16 socket + ***************************************************************************/ #include "emu.h" -- cgit v1.2.3-70-g09d2 From 9d4945d3862cd095c0f1ca4c8d5d8691995d7d62 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 7 Feb 2016 19:46:58 +0100 Subject: removed vsync flag (nw) --- src/osd/modules/render/drawbgfx.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 0dc0e44554f..45215263c1e 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -173,14 +173,14 @@ int renderer_bgfx::create() bgfx::winSetHwnd(window().m_hwnd); bgfx::init(); - bgfx::reset(rect_width(&client), rect_height(&client), BGFX_RESET_VSYNC); + bgfx::reset(rect_width(&client), rect_height(&client), BGFX_RESET_NONE); #else osd_dim d = window().get_size(); m_blittimer = 3; bgfx::sdlSetWindow(window().sdl_window()); bgfx::init(); - bgfx::reset(d.width(), d.height(), BGFX_RESET_VSYNC); + bgfx::reset(d.width(), d.height(), BGFX_RESET_NONE); #endif // Enable debug text. @@ -768,7 +768,7 @@ int renderer_bgfx::draw(int update) height = m_blit_dim.height(); #endif bgfx::setViewRect(0, 0, 0, width, height); - bgfx::reset(width, height, BGFX_RESET_VSYNC); + bgfx::reset(width, height, BGFX_RESET_NONE); // Setup view transform. { float view[16]; -- cgit v1.2.3-70-g09d2 From a572b3da0f764978b96c4e5e900a9dda4f0e0005 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 7 Feb 2016 19:55:56 +0100 Subject: respect waitsync param (nw) --- src/osd/modules/render/drawbgfx.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 45215263c1e..c5d8f204fa7 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -172,19 +172,19 @@ int renderer_bgfx::create() GetClientRect(window().m_hwnd, &client); bgfx::winSetHwnd(window().m_hwnd); - bgfx::init(); - bgfx::reset(rect_width(&client), rect_height(&client), BGFX_RESET_NONE); + bgfx::init(); + bgfx::reset(rect_width(&client), rect_height(&client), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); #else osd_dim d = window().get_size(); m_blittimer = 3; bgfx::sdlSetWindow(window().sdl_window()); bgfx::init(); - bgfx::reset(d.width(), d.height(), BGFX_RESET_NONE); + bgfx::reset(d.width(), d.height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); #endif // Enable debug text. - bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS + bgfx::setDebug(BGFX_DEBUG_STATS); //BGFX_DEBUG_STATS // Create program from shaders. m_progQuad = loadProgram("vs_quad", "fs_quad"); m_progQuadTexture = loadProgram("vs_quad_texture", "fs_quad_texture"); @@ -768,7 +768,7 @@ int renderer_bgfx::draw(int update) height = m_blit_dim.height(); #endif bgfx::setViewRect(0, 0, 0, width, height); - bgfx::reset(width, height, BGFX_RESET_NONE); + bgfx::reset(width, height, video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); // Setup view transform. { float view[16]; -- cgit v1.2.3-70-g09d2 From 1c728dddf027899a121969389048726992c2464d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 7 Feb 2016 19:58:34 +0100 Subject: remove debug data (nw) --- src/osd/modules/render/drawbgfx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index c5d8f204fa7..56b692afb65 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -184,7 +184,7 @@ int renderer_bgfx::create() #endif // Enable debug text. - bgfx::setDebug(BGFX_DEBUG_STATS); //BGFX_DEBUG_STATS + bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS // Create program from shaders. m_progQuad = loadProgram("vs_quad", "fs_quad"); m_progQuadTexture = loadProgram("vs_quad_texture", "fs_quad_texture"); -- cgit v1.2.3-70-g09d2 From 08086e4efea2e7c1a7c42ac16868378f4206c4de Mon Sep 17 00:00:00 2001 From: Ville Linde Date: Sun, 7 Feb 2016 21:11:15 +0200 Subject: new NOT_WORKING Silent Scope Fortune Hunter [Guru] --- src/mame/arcade.lst | 1 + src/mame/drivers/viper.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 45f41a0882a..74471f81868 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -4135,6 +4135,7 @@ p9112 // 2001 popn9 // 2003 sscopex // 2001 sogeki // 2001 +sscopefh // 2002 thrild2 // 2001 thrild2a // 2001 thrild2c // 2001 diff --git a/src/mame/drivers/viper.cpp b/src/mame/drivers/viper.cpp index 831d34f32fd..eb02e79e85e 100644 --- a/src/mame/drivers/viper.cpp +++ b/src/mame/drivers/viper.cpp @@ -2506,6 +2506,17 @@ ROM_START(sogeki) //* DISK_IMAGE( "a13b02", 0, SHA1(c25a61b76d365794c2da4a9e7de88a5519e944ec) ) ROM_END +ROM_START(sscopefh) + VIPER_BIOS + + ROM_REGION(0x28, "ds2430", ROMREGION_ERASE00) /* DS2430 */ + + ROM_REGION(0x2000, "m48t58", ROMREGION_ERASE00) /* M48T58 Timekeeper NVRAM */ + + DISK_REGION( "ata:0:hdd:image" ) + DISK_IMAGE( "ccca02", 0, SHA1(ec0d9a1520f17c73750de71dba8b31bc8c9d0409) ) +ROM_END + ROM_START(thrild2) //* VIPER_BIOS @@ -2740,6 +2751,7 @@ GAME(2001, p9112, kviper, viper, viper, viper_state, vipercf, ROT90, "K GAME(2003, popn9, kviper, viper, viper, viper_state, vipercf, ROT0, "Konami", "Pop'n Music 9 (ver JAB)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, sscopex, kviper, viper, viper, viper_state, vipercf, ROT0, "Konami", "Silent Scope EX (ver UAA)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, sogeki, sscopex, viper, viper, viper_state, vipercf, ROT0, "Konami", "Sogeki (ver JAA)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) +GAME(2002, sscopefh, kviper, viper, viper, viper_state, vipercf, ROT0, "Konami", "Silent Scope Fortune Hunter", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, thrild2, kviper, viper, viper, viper_state, vipercf, ROT0, "Konami", "Thrill Drive 2 (ver EBB)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, thrild2a, thrild2, viper, viper, viper_state, vipercf, ROT0, "Konami", "Thrill Drive 2 (ver AAA)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, thrild2c, thrild2, viper, viper, viper_state, vipercf, ROT0, "Konami", "Thrill Drive 2 (ver EAA)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) -- cgit v1.2.3-70-g09d2 From 827c9da5869433a4e49da358b9efbf25c3c8aefc Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 7 Feb 2016 20:24:03 +0100 Subject: use proper texture format bgfx::TextureFormat::BGRA8 (nw) --- src/osd/modules/render/drawbgfx.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 56b692afb65..facccee703f 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -586,15 +586,6 @@ uint32_t u32Color(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255) ; } -static UINT32 getABGR(UINT32 ARGB) { - return - ((ARGB >> 24) << 24) | // Alpha - ((ARGB >> 16) & 0xFF) | // Red -> Blue - ((ARGB >> 8) & 0xFF) << 8 | // Green - ((ARGB)& 0xFF) << 16; // Blue -> Red -} - - //============================================================ // copyline_palette16 //============================================================ @@ -602,7 +593,7 @@ static UINT32 getABGR(UINT32 ARGB) { static inline void copyline_palette16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette) { for (int x = 0; x < width; x++) - *dst++ = 0xff000000 | getABGR(palette[*src++]); + *dst++ = 0xff000000 | palette[*src++]; } @@ -613,7 +604,7 @@ static inline void copyline_palette16(UINT32 *dst, const UINT16 *src, int width, static inline void copyline_palettea16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette) { for (int x = 0; x < width; x++) - *dst++ = getABGR(palette[*src++]); + *dst++ = palette[*src++]; } @@ -631,7 +622,7 @@ static inline void copyline_rgb32(UINT32 *dst, const UINT32 *src, int width, con for (x = 0; x < width; x++) { rgb_t srcpix = *src++; - *dst++ = 0xff000000 | palette[0x200 + srcpix.b()] | palette[0x100 + srcpix.g()] | palette[srcpix.r()]; + *dst++ = 0xff000000 | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()]; } } @@ -639,7 +630,7 @@ static inline void copyline_rgb32(UINT32 *dst, const UINT32 *src, int width, con else { for (x = 0; x < width; x++) - *dst++ = getABGR(0xff000000 | *src++); + *dst++ = 0xff000000 | *src++; } } @@ -657,7 +648,7 @@ static inline void copyline_argb32(UINT32 *dst, const UINT32 *src, int width, co for (x = 0; x < width; x++) { rgb_t srcpix = *src++; - *dst++ = (srcpix & 0xff000000) | palette[0x200 + srcpix.b()] | palette[0x100 + srcpix.g()] | palette[srcpix.r()]; + *dst++ = (srcpix & 0xff000000) | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()]; } } @@ -665,7 +656,7 @@ static inline void copyline_argb32(UINT32 *dst, const UINT32 *src, int width, co else { for (x = 0; x < width; x++) - *dst++ = getABGR(*src++); + *dst++ = *src++; } } @@ -707,7 +698,7 @@ static inline UINT32 ycc_to_rgb(UINT8 y, UINT8 cb, UINT8 cr) if (b < 0) b = 0; else if (b > 255) b = 255; - return rgb_t(0xff, b, g, r); + return rgb_t(0xff, r, g, b); } //============================================================ @@ -870,7 +861,7 @@ int renderer_bgfx::draw(int update) m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width , (uint16_t)prim->texture.height , 1 - , bgfx::TextureFormat::RGBA8 + , bgfx::TextureFormat::BGRA8 , 0 , mem ); @@ -886,7 +877,7 @@ int renderer_bgfx::draw(int update) m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width , (uint16_t)prim->texture.height , 1 - , bgfx::TextureFormat::RGBA8 + , bgfx::TextureFormat::BGRA8 , 0 , mem ); @@ -915,7 +906,7 @@ int renderer_bgfx::draw(int update) m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width , (uint16_t)prim->texture.height , 1 - , bgfx::TextureFormat::RGBA8 + , bgfx::TextureFormat::BGRA8 , 0 , mem ); -- cgit v1.2.3-70-g09d2 From ce49486fed87d7a1982ac816f0102b902ff9d510 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 7 Feb 2016 20:34:48 +0100 Subject: optimize a bit (nw) --- src/osd/modules/render/drawbgfx.cpp | 45 +++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index facccee703f..960a4243bf2 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -887,29 +887,40 @@ int renderer_bgfx::draw(int update) alpha = true; case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32): { - auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); - if (alpha) + if (prim->texture.rowpixels!=prim->texture.width) { - for (int y = 0; y < prim->texture.height; y++) + auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); + if (alpha) { - copyline_argb32((UINT32*)mem->data + y*prim->texture.width, (UINT32*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); + for (int y = 0; y < prim->texture.height; y++) + { + copyline_argb32((UINT32*)mem->data + y*prim->texture.width, (UINT32*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); + } } - } - else - { - for (int y = 0; y < prim->texture.height; y++) + else { - copyline_rgb32((UINT32*)mem->data + y*prim->texture.width, (UINT32*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); + for (int y = 0; y < prim->texture.height; y++) + { + copyline_rgb32((UINT32*)mem->data + y*prim->texture.width, (UINT32*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); + } } - } - m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width - , (uint16_t)prim->texture.height - , 1 - , bgfx::TextureFormat::BGRA8 - , 0 - , mem - ); + m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width + , (uint16_t)prim->texture.height + , 1 + , bgfx::TextureFormat::BGRA8 + , 0 + , mem + ); + } else { + m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width + , (uint16_t)prim->texture.height + , 1 + , bgfx::TextureFormat::BGRA8 + , 0 + , bgfx::copy(prim->texture.base, prim->texture.width*prim->texture.height*4) + ); + } } break; -- cgit v1.2.3-70-g09d2 From 576915e70c2af2261635d5f4d388cc11c0112516 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Sun, 7 Feb 2016 15:32:28 -0500 Subject: Arkanoid.cpp: documentation cleanup/updates (n/w) --- src/mame/drivers/arkanoid.cpp | 73 +++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/src/mame/drivers/arkanoid.cpp b/src/mame/drivers/arkanoid.cpp index e4e33fcdea2..c93fd804064 100644 --- a/src/mame/drivers/arkanoid.cpp +++ b/src/mame/drivers/arkanoid.cpp @@ -1434,8 +1434,8 @@ MACHINE_CONFIG_END /* ROMs */ /* rom numbering, with guesses for version numbers and missing roms: A75 01 = Z80 code 1/2 v1.0 Japan (NOT DUMPED) - A75 01-1 = Z80 code 1/2 v1.1 Japan and USA/Romstar - A75 02 = Z80 code 2/2 v1.0 Japan + A75 01-1 = Z80 code 1/2 v1.1 Japan and USA/Romstar and World + A75 02 = Z80 code 2/2 v1.0 Japan (has 'Notice: This game is for use in Japan only' screen) A75 03 = GFX 1/3 A75 04 = GFX 2/3 A75 05 = GFX 3/3 @@ -1443,8 +1443,8 @@ MACHINE_CONFIG_END A75 07 = PROM red A75 08 = PROM green A75 09 = PROM blue - A75 10 = Z80 code 2/2 v1.1 USA/Romstar - A75 11 = Z80 code 2/2 v1.2 Japan(World?) (paired with 01-1 v1.1 Japan) + A75 10 = Z80 code 2/2 v1.0 USA/Romstar (has 'Licensed to Romstar for U.S.A' notice on title) + A75 11 = Z80 code 2/2 v1.0 World (A75 12 through 17 are unknown, could be another two sets of z80 code plus mc68705p5) A75 18 = Z80 code v2.0 2/2 USA/Romstar A75 19 = Z80 code v2.0 1/2 USA/Romstar @@ -1468,7 +1468,7 @@ MACHINE_CONFIG_END A75 37 = Z80 code 2/2 (Tournament v2.0?) (NOT DUMPED) */ -ROM_START( arkanoid ) // v1.2 Japan(world?) +ROM_START( arkanoid ) // v1.0 World ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "a75-01-1.ic17", 0x0000, 0x8000, CRC(5bcda3b0) SHA1(52cadd38b5f8e8856f007a9c602d6b508f30be65) ) ROM_LOAD( "a75-11.ic16", 0x8000, 0x8000, CRC(eafd7191) SHA1(d2f8843b716718b1de209e97a874e8ce600f3f87) ) @@ -1486,12 +1486,11 @@ ROM_START( arkanoid ) // v1.2 Japan(world?) ROM_LOAD( "a75-08.ic23", 0x0200, 0x0200, CRC(abb002fb) SHA1(c14f56b8ef103600862e7930709d293b0aa97a73) ) /* green component */ ROM_LOAD( "a75-09.ic22", 0x0400, 0x0200, CRC(a7c6c277) SHA1(adaa003dcd981576ea1cc5f697d709b2d6b2ea29) ) /* blue component */ - // these were decapped, sort them! // All of these MCUs work in place of A75 06, see comments for each. ROM_REGION( 0x1800, "alt_mcus", 0 ) /* 2k for the microcontroller */ - ROM_LOAD( "arkanoid_mcu.ic14", 0x0800, 0x0800, CRC(4e44b50a) SHA1(c61e7d158dc8e2b003c8158053ec139b904599af) ) // This matches the legitimate Taito rom, with a "Programmed By Yasu 1986" string in it, but has a 0x00 fill after the end of the code instead of 0xFF. This matches the legit rom otherwise and may itself be legit, perhaps an artifact of a 68705 programmer at Taito using a sparse s-record/ihex file and not clearing the ram in the chip programmer to 0xFF (or 0x00?) before programming the MCU. - ROM_LOAD( "a75-06__bootleg_68705.ic14", 0x1000, 0x0800, CRC(515d77b6) SHA1(a302937683d11f663abd56a2fd7c174374e4d7fb) ) // This was NOT decapped, it came from an unprotected bootleg, and used to be used by the main set. It is definitely a bootleg mcu with no timer or int selftest, and compltely different code altogether, probably implemented by pirates by blackbox-reverse engineering the real MCU. - ROM_LOAD( "arkanoid1_68705p3.ic14", 0x0000, 0x0800, CRC(1b68e2d8) SHA1(f642a7cb624ee14fb0e410de5ae1fc799d2fa1c2) ) // This is the same as the 515d77b6 rom above except the bootrom (0x785-0x7f7) is intact. No other difference. + ROM_LOAD( "arkanoid_mcu.ic14", 0x0000, 0x0800, CRC(4e44b50a) SHA1(c61e7d158dc8e2b003c8158053ec139b904599af) ) // Decapped: This matches the legitimate Taito rom, with a "Programmed By Yasu 1986" string in it, but has a 0x00 fill after the end of the code instead of 0xFF. This matches the legit rom otherwise and may itself be legit, perhaps an artifact of a 68705 programmer at Taito using a sparse s-record/ihex file and not clearing the ram in the chip programmer to 0xFF (or 0x00?) before programming the MCU. + ROM_LOAD( "a75-06__bootleg_68705.ic14", 0x0800, 0x0800, CRC(515d77b6) SHA1(a302937683d11f663abd56a2fd7c174374e4d7fb) ) // NOT decapped: This came from an unprotected bootleg, and used to be used by the main set. It is definitely a bootleg mcu with no timer or int selftest, and compltely different code altogether, probably implemented by pirates by blackbox-reverse engineering the real MCU. + ROM_LOAD( "arkanoid1_68705p3.ic14", 0x1000, 0x0800, CRC(1b68e2d8) SHA1(f642a7cb624ee14fb0e410de5ae1fc799d2fa1c2) ) // Decapped: This is the same as the bootleg 515d77b6 rom above except the bootrom (0x785-0x7f7) is intact. No other difference. ROM_END ROM_START( arkanoidu ) // V2.0 US/Romstar @@ -1514,7 +1513,7 @@ ROM_START( arkanoidu ) // V2.0 US/Romstar ROM_END /* Observed on a real TAITO J1100075A pcb (with K1100181A sticker), pcb is white painted, and has a "ROMSTAR(C) // All Rights Reserved // Serial No. // No 14128" sticker */ -ROM_START( arkanoiduo ) // V1.1 USA/Romstar +ROM_START( arkanoiduo ) // V1.0 USA/Romstar ROM_REGION( 0x10000, "maincpu", 0 ) /* Silkscreen: "IC17 27256" and "IC16 27256" */ ROM_LOAD( "a75__01-1.ic17", 0x0000, 0x8000, CRC(5bcda3b0) SHA1(52cadd38b5f8e8856f007a9c602d6b508f30be65) ) ROM_LOAD( "a75__10.ic16", 0x8000, 0x8000, CRC(a1769e15) SHA1(fbb45731246a098b29eb08de5d63074b496aaaba) ) @@ -1533,7 +1532,7 @@ ROM_START( arkanoiduo ) // V1.1 USA/Romstar ROM_LOAD( "a75-09.ic22", 0x0400, 0x0200, CRC(a7c6c277) SHA1(adaa003dcd981576ea1cc5f697d709b2d6b2ea29) ) /* Chip Silkscreen: "A75-09"; blue component */ ROM_REGION( 0x8000, "altgfx", 0 ) - ROM_LOAD( "a75__03(alternate).ic64", 0x00000, 0x8000, CRC(983d4485) SHA1(603a8798d1f531a70a527a5c6122f0ffd6adcfb6) ) // this was found on a legit v1.1 Romstar USA pcb with serial number 29342; the only difference seems to be the first 32 tiles are all 0xFF instead of 0x00. Those tiles don't seem to be used by the game at all. This is likely another incidence of "Taito forgot to clear programmer ram before burning a rom from a sparse s-record/ihex file" + ROM_LOAD( "a75__03(alternate).ic64", 0x00000, 0x8000, CRC(983d4485) SHA1(603a8798d1f531a70a527a5c6122f0ffd6adcfb6) ) // this was found on a legit v1.0 Romstar USA pcb with serial number 29342; the only difference seems to be the first 32 tiles are all 0xFF instead of 0x00. Those tiles don't seem to be used by the game at all. This is likely another incidence of "Taito forgot to clear programmer ram before burning a rom from a sparse s-record/ihex file" ROM_END ROM_START( arkanoidj ) // V2.1 Japan @@ -1616,7 +1615,7 @@ ROM_END // Everything from here on is bootlegs -ROM_START( arkanoidjbl ) +ROM_START( arkanoidjbl ) // bootleg with MCU copied from real Taito code, but notice screen hacked up. ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "e1.6d", 0x0000, 0x8000, CRC(dd4f2b72) SHA1(399a8636030a702dafc1da926f115df6f045bef1) ) /* Hacked up Notice warning text */ ROM_LOAD( "e2.6f", 0x8000, 0x8000, CRC(bbc33ceb) SHA1(e9b6fef98d0d20e77c7a1c25eff8e9a8c668a258) ) /* == A75-02.IC16 */ @@ -1636,7 +1635,7 @@ ROM_START( arkanoidjbl ) ROM_END -ROM_START( arkanoidjbl2 ) +ROM_START( arkanoidjbl2 ) // Bootleg with ??? MCU, probably the a75-06__bootleg_68705.ic14 515d77b6 one ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "1.ic81", 0x0000, 0x8000, CRC(9ff93dc2) SHA1(eee0975b799a8e6717f646dd40716dc454476106) ) ROM_LOAD( "2.ic82", 0x8000, 0x8000, CRC(bbc33ceb) SHA1(e9b6fef98d0d20e77c7a1c25eff8e9a8c668a258) ) /* == A75-02.IC16 */ @@ -1652,10 +1651,10 @@ ROM_START( arkanoidjbl2 ) ROM_REGION( 0x0600, "proms", 0 ) /* BPROMs are silkscreened as 7621, actual BPROMs used are MMI 6306-1N */ ROM_LOAD( "a75-07.ic24", 0x0000, 0x0200, CRC(0af8b289) SHA1(6bc589e8a609b4cf450aebedc8ce02d5d45c970f) ) /* red component */ ROM_LOAD( "a75-08.ic23", 0x0200, 0x0200, CRC(abb002fb) SHA1(c14f56b8ef103600862e7930709d293b0aa97a73) ) /* green component */ - ROM_LOAD( "a75-09.ic23", 0x0400, 0x0200, CRC(a7c6c277) SHA1(adaa003dcd981576ea1cc5f697d709b2d6b2ea29) ) /* blue component */ + ROM_LOAD( "a75-09.ic22", 0x0400, 0x0200, CRC(a7c6c277) SHA1(adaa003dcd981576ea1cc5f697d709b2d6b2ea29) ) /* blue component */ ROM_END -ROM_START( ark1ball ) /* This set requires a MCU. No MCU rom was supplied so we use current A75-06.IC14 for now */ +ROM_START( ark1ball ) /* This set requires a MCU. No MCU rom was supplied so we use the a75-06__bootleg_68705.ic14 515d77b6 one for now */ ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "a-1.7d", 0x0000, 0x8000, CRC(dd4f2b72) SHA1(399a8636030a702dafc1da926f115df6f045bef1) ) ROM_LOAD( "2palline.7f", 0x8000, 0x8000, CRC(ed6b62ab) SHA1(4d4991b422756bd304fc5ef236aac1422fe1f999) ) @@ -1675,7 +1674,7 @@ ROM_START( ark1ball ) /* This set requires a MCU. No MCU rom was supplied so we ROM_LOAD( "a75-09.bpr", 0x0400, 0x0200, CRC(a7c6c277) SHA1(adaa003dcd981576ea1cc5f697d709b2d6b2ea29) ) /* blue component */ ROM_END -ROM_START( arkangc ) +ROM_START( arkangc ) // Game Corporation set with no mcu, d008 read after reading paddle at d018 patched out or not present ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "arkgc.1", 0x0000, 0x8000, CRC(c54232e6) SHA1(beb759cee68009a06824b755d2aa26d7d436b5b0) ) ROM_LOAD( "arkgc.2", 0x8000, 0x8000, CRC(9f0d4754) SHA1(731c9224616a338084edd6944c754d68eabba7f2) ) @@ -1691,7 +1690,7 @@ ROM_START( arkangc ) ROM_LOAD( "a75-09.bpr", 0x0400, 0x0200, CRC(a7c6c277) SHA1(adaa003dcd981576ea1cc5f697d709b2d6b2ea29) ) /* blue component */ ROM_END -ROM_START( arkangc2 ) +ROM_START( arkangc2 ) // Game Corporation set with no mcu, has d008 read after reading paddle at d018, and bit 1 must be set ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "1.81", 0x0000, 0x8000, CRC(bd6eb996) SHA1(a048ff01156166595dca0b6bee46344f7db548a8) ) ROM_LOAD( "2.82", 0x8000, 0x8000, CRC(29dbe452) SHA1(b99cb98549bddf1e673e2e715c80664001581f9f) ) @@ -1707,6 +1706,7 @@ ROM_START( arkangc2 ) ROM_LOAD( "a75-09.bpr", 0x0400, 0x0200, CRC(a7c6c277) SHA1(adaa003dcd981576ea1cc5f697d709b2d6b2ea29) ) /* blue component */ ROM_END +// This set (block2) and the next one (arkblock3) have the same 'space invader' scrambled block gfx, and an unknown (sound?) rom. No mention of what device(s) the extra rom is connected to. ROM_START( block2 ) ROM_REGION( 0x18000, "maincpu", 0 ) ROM_LOAD( "1.bin", 0x00000, 0x8000, CRC(2b026cae) SHA1(73d1d5d3e6d65fbe378ce85ff501610573ae5e95) ) @@ -1727,8 +1727,7 @@ ROM_START( block2 ) ROM_LOAD( "a75-09.bpr", 0x0400, 0x0200, CRC(a7c6c277) SHA1(adaa003dcd981576ea1cc5f697d709b2d6b2ea29) ) /* blue component */ ROM_END -// this set has the same 'space invader' scrambled block gfx, and unknown (sound?) rom as the one above -// sadly no mention of what chip it might be for in the readme. +// see comment for 'block2' set ROM_START( arkbloc3 ) ROM_REGION( 0x18000, "maincpu", 0 ) ROM_LOAD( "blockbl.001", 0x00000, 0x8000, CRC(bf7197a0) SHA1(4fbc0cbc09d292ab0f2e4a35b30505b2f7e4dc0d) ) @@ -1749,7 +1748,7 @@ ROM_START( arkbloc3 ) ROM_LOAD( "a75-09.bpr", 0x0400, 0x0200, CRC(a7c6c277) SHA1(adaa003dcd981576ea1cc5f697d709b2d6b2ea29) ) /* blue component */ ROM_END -ROM_START( arkblock ) +ROM_START( arkblock ) // no mcu, no d008/d018/f000/f002 protection, just leftover writes ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "ark-6.bin", 0x0000, 0x8000, CRC(0be015de) SHA1(f4209085b59d2c96a62ac9657c7bf097da55362b) ) ROM_LOAD( "arkgc.2", 0x8000, 0x8000, CRC(9f0d4754) SHA1(731c9224616a338084edd6944c754d68eabba7f2) ) @@ -1765,7 +1764,7 @@ ROM_START( arkblock ) ROM_LOAD( "a75-09.bpr", 0x0400, 0x0200, CRC(a7c6c277) SHA1(adaa003dcd981576ea1cc5f697d709b2d6b2ea29) ) /* blue component */ ROM_END -ROM_START( arkbloc2 ) +ROM_START( arkbloc2 ) // no mcu, no d008/d018/f000/f002 protection, just leftover writes ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "block01.bin", 0x0000, 0x8000, CRC(5be667e1) SHA1(fbc5c97d836c404a2e6c007c3836e36b52ae75a1) ) ROM_LOAD( "block02.bin", 0x8000, 0x8000, CRC(4f883ef1) SHA1(cb090a57fc75f17a3e2ba637f0e3ec93c1d02cea) ) @@ -1800,38 +1799,38 @@ Note: 1x 8 switches dip Dumped 19/03/2006 */ -ROM_START( arkgcbl ) +ROM_START( arkgcbl ) // similar to arkangc, but has added d008/d018/f000/f002 protection, likely using the PAL16R8 ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "16.6e", 0x0000, 0x8000, CRC(b0f73900) SHA1(2c9a36cc1d2a3f33ec81d63c1c325554b818d2d3) ) - ROM_LOAD( "17.6f", 0x8000, 0x8000, CRC(9827f297) SHA1(697874e73e045eb5a7bf333d7310934b239c0adf) ) + ROM_LOAD( "electric__16.6e", 0x0000, 0x8000, CRC(b0f73900) SHA1(2c9a36cc1d2a3f33ec81d63c1c325554b818d2d3) ) + ROM_LOAD( "electric__17.6f", 0x8000, 0x8000, CRC(9827f297) SHA1(697874e73e045eb5a7bf333d7310934b239c0adf) ) ROM_REGION( 0x18000, "gfx1", 0 ) - ROM_LOAD( "a75-03.rom", 0x00000, 0x8000, CRC(038b74ba) SHA1(ac053cc4908b4075f918748b89570e07a0ba5116) ) - ROM_LOAD( "a75-04.rom", 0x08000, 0x8000, CRC(71fae199) SHA1(5d253c46ccf4cd2976a5fb8b8713f0f345443d06) ) - ROM_LOAD( "a75-05.rom", 0x10000, 0x8000, CRC(c76374e2) SHA1(7520dd48de20db60a2038f134dcaa454988e7874) ) + ROM_LOAD( "electric__18.3a", 0x00000, 0x8000, CRC(038b74ba) SHA1(ac053cc4908b4075f918748b89570e07a0ba5116) ) // = a75-03.ic64 + ROM_LOAD( "electric__19.3c", 0x08000, 0x8000, CRC(71fae199) SHA1(5d253c46ccf4cd2976a5fb8b8713f0f345443d06) ) // = a75-04.ic63 + ROM_LOAD( "electric__20.3d", 0x10000, 0x8000, CRC(c76374e2) SHA1(7520dd48de20db60a2038f134dcaa454988e7874) ) // = a75-05.ic62 ROM_REGION( 0x0600, "proms", 0 ) ROM_LOAD( "82s129.5k", 0x0000, 0x0100, CRC(fa70b64d) SHA1(273669d05f793cf1ee0741b175be281307fa9b5e) ) /* red component + */ - ROM_LOAD( "82s129.5jk", 0x0100, 0x0100, CRC(cca69884) SHA1(fdcd66110c8eb901a401f8618821c7980946a511) ) /* red component = a75-07.bpr*/ + ROM_LOAD( "82s129.5jk", 0x0100, 0x0100, CRC(cca69884) SHA1(fdcd66110c8eb901a401f8618821c7980946a511) ) /* red component = a75-07.ic24*/ ROM_LOAD( "82s129.5l", 0x0200, 0x0100, CRC(3e4d2bf5) SHA1(c475887302dd137d6965769070b7d55f488c1b25) ) /* green component + */ - ROM_LOAD( "82s129.5kl", 0x0300, 0x0100, CRC(085d625a) SHA1(26c96a1c1b7562fed84c31dd92fdf7829e96a9c7) ) /* green component = a75-08.bpr*/ + ROM_LOAD( "82s129.5kl", 0x0300, 0x0100, CRC(085d625a) SHA1(26c96a1c1b7562fed84c31dd92fdf7829e96a9c7) ) /* green component = a75-08.ic23*/ ROM_LOAD( "82s129.5mn", 0x0400, 0x0100, CRC(0fe0b108) SHA1(fcf27619208922345a1e42b3a219b4274f66968d) ) /* blue component + */ - ROM_LOAD( "63s141.5m", 0x0500, 0x0100, CRC(5553f675) SHA1(c50255af8d99664b92e0bb34a527fd42ebf7e759) ) /* blue component = a75-09.bpr*/ + ROM_LOAD( "63s141.5m", 0x0500, 0x0100, CRC(5553f675) SHA1(c50255af8d99664b92e0bb34a527fd42ebf7e759) ) /* blue component = a75-09.ic22*/ ROM_REGION( 0x0200, "pal", 0 ) - ROM_LOAD( "pal16r8.5f", 0x0000, 0x0104, CRC(36471917) SHA1(d0f295a94d480b44416e66be4b480b299aad5c3c) ) + ROM_LOAD( "pal16r8.5f", 0x0000, 0x0104, CRC(36471917) SHA1(d0f295a94d480b44416e66be4b480b299aad5c3c) ) /* likely used for the d008/d018/f000/f002 protection */ ROM_END /* this one still has the original copyright intact */ -ROM_START( arkgcbla ) +ROM_START( arkgcbla ) // similar to arkangc, but has added d008/d018/f000/f002 protection, likely using the PAL16R8 ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "k101.e7", 0x0000, 0x8000, CRC(892a556e) SHA1(10d1a92f8ab1b8184b05182a2de070b163a603e2) ) ROM_LOAD( "k102.f7", 0x8000, 0x8000, CRC(d208d05c) SHA1(0aa99a0cb8211e7b90d681c91cc77aa7078a0ccc) ) ROM_REGION( 0x18000, "gfx1", 0 ) - ROM_LOAD( "a75-03.rom", 0x00000, 0x8000, CRC(038b74ba) SHA1(ac053cc4908b4075f918748b89570e07a0ba5116) ) - ROM_LOAD( "a75-04.rom", 0x08000, 0x8000, CRC(71fae199) SHA1(5d253c46ccf4cd2976a5fb8b8713f0f345443d06) ) - ROM_LOAD( "a75-05.rom", 0x10000, 0x8000, CRC(c76374e2) SHA1(7520dd48de20db60a2038f134dcaa454988e7874) ) + ROM_LOAD( "a75-03.rom", 0x00000, 0x8000, CRC(038b74ba) SHA1(ac053cc4908b4075f918748b89570e07a0ba5116) ) // = a75-03.ic64 + ROM_LOAD( "a75-04.rom", 0x08000, 0x8000, CRC(71fae199) SHA1(5d253c46ccf4cd2976a5fb8b8713f0f345443d06) ) // = a75-04.ic63 + ROM_LOAD( "a75-05.rom", 0x10000, 0x8000, CRC(c76374e2) SHA1(7520dd48de20db60a2038f134dcaa454988e7874) ) // = a75-05.ic62 ROM_REGION( 0x0600, "proms", 0 ) ROM_LOAD( "82s129.5k", 0x0000, 0x0100, CRC(fa70b64d) SHA1(273669d05f793cf1ee0741b175be281307fa9b5e) ) /* red component + */ @@ -1842,7 +1841,7 @@ ROM_START( arkgcbla ) ROM_LOAD( "63s141.5m", 0x0500, 0x0100, CRC(5553f675) SHA1(c50255af8d99664b92e0bb34a527fd42ebf7e759) ) /* blue component = a75-09.bpr*/ ROM_REGION( 0x0200, "pal", 0 ) - ROM_LOAD( "pal16r8.5f", 0x0000, 0x0104, CRC(36471917) SHA1(d0f295a94d480b44416e66be4b480b299aad5c3c) ) + ROM_LOAD( "pal16r8.5f", 0x0000, 0x0104, CRC(36471917) SHA1(d0f295a94d480b44416e66be4b480b299aad5c3c) ) /* likely used for the d008/d018/f000/f002 protection */ ROM_END @@ -2143,7 +2142,7 @@ GAME( 1986, arkangc, arkanoid, bootleg, arkangc, arkanoid_state, arkangc, GAME( 1986, arkangc2, arkanoid, bootleg, arkangc2, arkanoid_state, arkangc2, ROT90, "bootleg (Game Corporation)", "Arkanoid (Game Corporation bootleg, set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, arkblock, arkanoid, bootleg, arkangc, arkanoid_state, arkblock, ROT90, "bootleg (Game Corporation)", "Block (Game Corporation bootleg, set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, arkbloc2, arkanoid, bootleg, arkangc, arkanoid_state, arkbloc2, ROT90, "bootleg (Game Corporation)", "Block (Game Corporation bootleg, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, arkbloc3, arkanoid, bootleg, block2, arkanoid_state, block2, ROT90, "bootleg (Game Corporation)", "Block (Game Corporation bootleg, set 3)", MACHINE_SUPPORTS_SAVE ) // Both these sets have an extra unknown rom +GAME( 1986, arkbloc3, arkanoid, bootleg, block2, arkanoid_state, block2, ROT90, "bootleg (Game Corporation)", "Block (Game Corporation bootleg, set 3)", MACHINE_SUPPORTS_SAVE ) // Both these sets (arkblock3, block2) have an extra unknown rom GAME( 1986, block2, arkanoid, bootleg, block2, arkanoid_state, block2, ROT90, "bootleg (S.P.A. Co.)", "Block 2 (S.P.A. Co. bootleg)", MACHINE_SUPPORTS_SAVE ) // and scrambled gfx roms with 'space invader' themed gfx GAME( 1986, arkgcbl, arkanoid, bootleg, arkgcbl, arkanoid_state, arkgcbl, ROT90, "bootleg", "Arkanoid (bootleg on Block hardware, set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, arkgcbla, arkanoid, bootleg, arkgcbl, arkanoid_state, arkgcbl, ROT90, "bootleg", "Arkanoid (bootleg on Block hardware, set 2)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From 993ada833736fdf8ed2956dc6cd4cb3b874d52c1 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sun, 7 Feb 2016 20:40:48 +0000 Subject: redumped Cat and Mouse graphic rom as the correct size [Vernimark] (we still need to work out how it banks, there's a clear wire mod going all the way across multiple components on the PCB from one of the pins on the ROM, which I guess is how it's done on hardware) see http://www.citylan.it/wiki/index.php/Cat_and_Mouse_%28set_1%29 --- src/mame/drivers/laserbat.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/mame/drivers/laserbat.cpp b/src/mame/drivers/laserbat.cpp index 2d9ea56a2e4..c9617fb8de5 100644 --- a/src/mame/drivers/laserbat.cpp +++ b/src/mame/drivers/laserbat.cpp @@ -62,10 +62,6 @@ * Service coin 1 input grants two credits the first time it's pushed, but remembers this and won't grant credits again unless unless you trigger the tilt input - * Flyer suggests there should be an "old lady" sprite, which is not - present in our ROM dump - * Sprite ROM is likely double size, banking could be controlled by - one of the many unused CSOUND bits, the NEG2 bit, or even H128 * Judging by the PLA program, the colour weight resistors are likely different to what Laser Battle/Lazarian uses - we need a detailed colour photo of the game board or a schematic to confirm values @@ -703,12 +699,8 @@ ROM_START( catnmous ) ROM_LOAD( "type01.10g", 0x0800, 0x0800, CRC(e5259f9b) SHA1(396753291ab36c3ed72208d619665fc0f33d1e17) ) ROM_LOAD( "type01.11g", 0x1000, 0x0800, CRC(2999f378) SHA1(929082383b2b0006de171587adb932ce57316963) ) - ROM_REGION( 0x0800, "gfx2", 0 ) - // This needs double checking, might be a case of the wrong ROM type being marked on the PCB like with the final program rom. - // Flyers indicate there should be an 'old lady' character, and even show a graphic for one approaching from the right. - // This graphic is not present in our ROM and instead we get incorrect looking sprites, so the rom could be half size with - // an additional sprite bank bit coming from somewhere? - ROM_LOAD( "type01.14l", 0x0000, 0x0800, BAD_DUMP CRC(af79179a) SHA1(de61af7d02c93be326a33ee51572e3da7a25dab0) ) + ROM_REGION( 0x1000, "gfx2", 0 ) + ROM_LOAD( "cat'n_mouse-type01-mem_n.14l.14l", 0x0000, 0x1000, CRC(83502383) SHA1(9561f87e1a6425bb9544e71340336db8d43c1fd9) ) ROM_REGION( 0x0100, "gfxmix", 0 ) ROM_LOAD( "82s100.13m", 0x0000, 0x00f5, CRC(6b724cdb) SHA1(8a0ca3b171b103661a3b2fffbca3d7162089e243) ) @@ -748,9 +740,8 @@ ROM_START( catnmousa ) ROM_LOAD( "catnmous.10g", 0x0800, 0x0800, CRC(e5259f9b) SHA1(396753291ab36c3ed72208d619665fc0f33d1e17) ) ROM_LOAD( "catnmous.11g", 0x1000, 0x0800, CRC(2999f378) SHA1(929082383b2b0006de171587adb932ce57316963) ) - ROM_REGION( 0x0800, "gfx2", 0 ) - // see comment in parent set - ROM_LOAD( "catnmous.14l", 0x0000, 0x0800, BAD_DUMP CRC(af79179a) SHA1(de61af7d02c93be326a33ee51572e3da7a25dab0) ) + ROM_REGION( 0x1000, "gfx2", 0 ) + ROM_LOAD( "cat'n_mouse-type01-mem_n.14l.14l", 0x0000, 0x1000, CRC(83502383) SHA1(9561f87e1a6425bb9544e71340336db8d43c1fd9) ) ROM_REGION( 0x0100, "gfxmix", 0 ) // copied from parent set to give working graphics, need dump to confirm -- cgit v1.2.3-70-g09d2 From 037f20e685536277c29dad542d9fe801579de4b3 Mon Sep 17 00:00:00 2001 From: Ville Linde Date: Sun, 7 Feb 2016 22:36:30 +0200 Subject: new clones Police 24/7 (ver EAA, alt) [Guru] Thrill Drive 2 (ver EAA, 2 alt versions) [Guru] Tsurugi (ver EAB, alt) [Guru] World Combat (ver AAD, alt) [Guru] --- src/mame/arcade.lst | 5 ++++ src/mame/drivers/viper.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 74471f81868..0e7f947520a 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -4130,6 +4130,7 @@ p911 // 2001 p911uc // 2001 p911kc // 2001 p911e // 2001 +p911ea // 2001 p911j // 2001 p9112 // 2001 popn9 // 2003 @@ -4138,10 +4139,14 @@ sogeki // 2001 sscopefh // 2002 thrild2 // 2001 thrild2a // 2001 +thrild2ab // 2001 +thrild2ac // 2001 thrild2c // 2001 tsurugi // 2001 +tsurugie // 2001 tsurugij // 2001 wcombat // 2002 +wcombatb // 2002 wcombatk // 2002 wcombatj // 2002 wcombatu // 2002 diff --git a/src/mame/drivers/viper.cpp b/src/mame/drivers/viper.cpp index eb02e79e85e..e71413b1f1d 100644 --- a/src/mame/drivers/viper.cpp +++ b/src/mame/drivers/viper.cpp @@ -2439,6 +2439,19 @@ ROM_START(p911e) //* DISK_IMAGE( "a00eaa02", 0, SHA1(81565a2dce2e2b0a7927078a784354948af1f87c) ) ROM_END +ROM_START(p911ea) + VIPER_BIOS + + ROM_REGION(0x28, "ds2430", ROMREGION_ERASE00) /* DS2430 */ + ROM_LOAD("ds2430.u3", 0x00, 0x28, CRC(f1511505) SHA1(ed7cd9b2763b3e377df9663943160f9871f65105)) + + ROM_REGION(0x2000, "m48t58", ROMREGION_ERASE00) /* M48T58 Timekeeper NVRAM */ + ROM_LOAD("a00eaa_nvram.u39", 0x000000, 0x2000, CRC(4f3497b6) SHA1(3045c54f98dff92cdf3a1fc0cd4c76ba82d632d7) ) + + DISK_REGION( "ata:0:hdd:image" ) + DISK_IMAGE( "a00eaa02", 0, SHA1(fa057bf17f4c0fb9b9a09b820ff7a101e44fab7d) ) +ROM_END + ROM_START(p911j) //* VIPER_BIOS @@ -2544,6 +2557,32 @@ ROM_START(thrild2a) //* DISK_IMAGE( "a41a02", 0, SHA1(bbb71e23bddfa07dfa30b6565a35befd82b055b8) ) ROM_END +ROM_START(thrild2ab) + VIPER_BIOS + + ROM_REGION(0x28, "ds2430", ROMREGION_ERASE00) /* DS2430 */ + ROM_LOAD("ds2430.u3", 0x00, 0x28, CRC(f1511505) SHA1(ed7cd9b2763b3e377df9663943160f9871f65105)) + + ROM_REGION(0x2000, "m48t58", ROMREGION_ERASE00) /* M48T58 Timekeeper NVRAM */ + ROM_LOAD("a41aaa_nvram.u39", 0x00000, 0x2000, CRC(d5de9b8e) SHA1(768bcd46a6ad20948f60f5e0ecd2f7b9c2901061)) + + DISK_REGION( "ata:0:hdd:image" ) + DISK_IMAGE( "a41a02_alt", 0, SHA1(7a9cfdab7000765ffdd9198b209f7a74741248f2) ) +ROM_END + +ROM_START(thrild2ac) + VIPER_BIOS + + ROM_REGION(0x28, "ds2430", ROMREGION_ERASE00) /* DS2430 */ + ROM_LOAD("ds2430.u3", 0x00, 0x28, CRC(f1511505) SHA1(ed7cd9b2763b3e377df9663943160f9871f65105)) + + ROM_REGION(0x2000, "m48t58", ROMREGION_ERASE00) /* M48T58 Timekeeper NVRAM */ + ROM_LOAD("a41aaa_nvram.u39", 0x00000, 0x2000, CRC(d5de9b8e) SHA1(768bcd46a6ad20948f60f5e0ecd2f7b9c2901061)) + + DISK_REGION( "ata:0:hdd:image" ) + DISK_IMAGE( "a41a02_alt2", 0, SHA1(c8bfbac4f5a1a2241df7417ad2f9eba7d9e9a9df) ) +ROM_END + /* This CF card has sticker 941EAA02 */ ROM_START(thrild2c) //* VIPER_BIOS @@ -2584,6 +2623,17 @@ ROM_START(tsurugij) //* DISK_IMAGE( "a30c02", 0, SHA1(533b5669b00884a800df9ba29651777a76559862) ) ROM_END +ROM_START(tsurugie) + VIPER_BIOS + + ROM_REGION(0x28, "ds2430", ROMREGION_ERASE00) /* DS2430 */ + + ROM_REGION(0x2000, "m48t58", ROMREGION_ERASE00) /* M48T58 Timekeeper NVRAM */ + + DISK_REGION( "ata:0:hdd:image" ) + DISK_IMAGE( "a30eab02", 0, SHA1(fcc5b69f89e246f26ca4b8546cc409d3488bbdd9) ) +ROM_END + /* This CF card has sticker C22D02 */ ROM_START(wcombat) //* VIPER_BIOS @@ -2598,6 +2648,19 @@ ROM_START(wcombat) //* DISK_IMAGE( "c22d02", 0, SHA1(69a24c9e36b073021d55bec27d89fcc0254a60cc) ) // chs 978,8,32 ROM_END +ROM_START(wcombatb) //* + VIPER_BIOS + + ROM_REGION(0x28, "ds2430", ROMREGION_ERASE00) /* DS2430 */ + ROM_LOAD("ds2430.u3", 0x00, 0x28, CRC(f1511505) SHA1(ed7cd9b2763b3e377df9663943160f9871f65105)) + + ROM_REGION(0x2000, "m48t58", ROMREGION_ERASE00) /* M48T58 Timekeeper NVRAM */ + ROM_LOAD("wcombat_nvram.u39", 0x00000, 0x2000, CRC(4f8b5858) SHA1(68066241c6f9db7f45e55b3c5da101987f4ce53c)) + + DISK_REGION( "ata:0:hdd:image" ) + DISK_IMAGE( "c22d02_alt", 0, SHA1(772e3fe7910f5115ec8f2235bb48ba9fcac6950d) ) // chs 978,8,32 +ROM_END + ROM_START(wcombatk) //* VIPER_BIOS @@ -2746,6 +2809,7 @@ GAME(2001, p911, kviper, viper, viper, viper_state, vipercf, ROT90, "K GAME(2001, p911uc, p911, viper, viper, viper_state, vipercf, ROT90, "Konami", "Police 911 (ver UAC)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, p911kc, p911, viper, viper, viper_state, vipercf, ROT90, "Konami", "Police 911 (ver KAC)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, p911e, p911, viper, viper, viper_state, vipercf, ROT90, "Konami", "Police 24/7 (ver EAA)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) +GAME(2001, p911ea, p911, viper, viper, viper_state, vipercf, ROT90, "Konami", "Police 24/7 (ver EAA, alt)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, p911j, p911, viper, viper, viper_state, vipercf, ROT90, "Konami", "Keisatsukan Shinjuku 24ji (ver JAC)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, p9112, kviper, viper, viper, viper_state, vipercf, ROT90, "Konami", "Police 911 2 (VER. UAA:B)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2003, popn9, kviper, viper, viper, viper_state, vipercf, ROT0, "Konami", "Pop'n Music 9 (ver JAB)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) @@ -2754,10 +2818,14 @@ GAME(2001, sogeki, sscopex, viper, viper, viper_state, vipercf, ROT0, "Ko GAME(2002, sscopefh, kviper, viper, viper, viper_state, vipercf, ROT0, "Konami", "Silent Scope Fortune Hunter", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, thrild2, kviper, viper, viper, viper_state, vipercf, ROT0, "Konami", "Thrill Drive 2 (ver EBB)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, thrild2a, thrild2, viper, viper, viper_state, vipercf, ROT0, "Konami", "Thrill Drive 2 (ver AAA)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) +GAME(2001, thrild2ab, thrild2, viper, viper, viper_state, vipercf, ROT0, "Konami", "Thrill Drive 2 (ver AAA, alt)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) +GAME(2001, thrild2ac, thrild2, viper, viper, viper_state, vipercf, ROT0, "Konami", "Thrill Drive 2 (ver AAA, alt 2)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2001, thrild2c, thrild2, viper, viper, viper_state, vipercf, ROT0, "Konami", "Thrill Drive 2 (ver EAA)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2002, tsurugi, kviper, viper, viper, viper_state, vipercf, ROT0, "Konami", "Tsurugi (ver EAB)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) +GAME(2002, tsurugie, tsurugi, viper, viper, viper_state, vipercf, ROT0, "Konami", "Tsurugi (ver EAB, alt)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2002, tsurugij, tsurugi, viper, viper, viper_state, vipercf, ROT0, "Konami", "Tsurugi (ver JAC)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2002, wcombat, kviper, viper, viper, viper_state, vipercf, ROT0, "Konami", "World Combat (ver AAD:B)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) +GAME(2002, wcombatb, wcombat, viper, viper, viper_state, vipercf, ROT0, "Konami", "World Combat (ver AAD:B, alt)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2002, wcombatk, wcombat, viper, viper, viper_state, vipercf, ROT0, "Konami", "World Combat (ver KBC:B)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2002, wcombatu, wcombat, viper, viper, viper_state, vipercf, ROT0, "Konami", "World Combat / Warzaid (ver UCD:B)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) GAME(2002, wcombatj, wcombat, viper, viper, viper_state, vipercf, ROT0, "Konami", "World Combat (ver JAA)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) -- cgit v1.2.3-70-g09d2 From fecf115d6b367b0c055f77fa5751688e9307dfee Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 7 Feb 2016 23:29:58 +0100 Subject: hh_ucom4: mcompgin WIP,skeleton (nw, will do that later) --- src/mame/drivers/hh_ucom4.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++- src/mame/layout/mcompgin.lay | 20 +++++++++++++ src/mame/mess.lst | 3 +- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 src/mame/layout/mcompgin.lay diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp index d7578b8e173..8c4bab84e3b 100644 --- a/src/mame/drivers/hh_ucom4.cpp +++ b/src/mame/drivers/hh_ucom4.cpp @@ -46,7 +46,7 @@ @512 uPD557LC 1980, Castle Toy Tactix - *060 uPD650C 1979, Mattel Computer Gin + @060 uPD650C 1979, Mattel Computer Gin *085 uPD650C 1980, Roland TR-808 *127 uPD650C 198?, Sony OA-S1100 Typecorder (subcpu, have dump) 128 uPD650C 1981, Roland TR-606 -> tr606.cpp @@ -65,6 +65,7 @@ TODO: // internal artwork #include "efball.lh" +#include "mcompgin.lh" #include "mvbfree.lh" #include "tactix.lh" // clickable @@ -1578,6 +1579,60 @@ MACHINE_CONFIG_END +/*************************************************************************** + + Mattel Computer Gin + * NEC uCOM-43 MCU, labeled D650C 060 + +***************************************************************************/ + +class mcompgin_state : public hh_ucom4_state +{ +public: + mcompgin_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE8_MEMBER(speaker_w); +}; + +// handlers + +void mcompgin_state::prepare_display() +{ +} + +WRITE8_MEMBER(mcompgin_state::speaker_w) +{ +} + + +// config + +static INPUT_PORTS_START( mcompgin ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( mcompgin, mcompgin_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D650, 400000) // approximation + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_mcompgin) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + /*************************************************************************** Mego Mini-Vid Break Free (manufactured in Japan) @@ -2444,6 +2499,12 @@ ROM_START( edracula ) ROM_END +ROM_START( mcompgin ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d650c-060", 0x0000, 0x0800, CRC(92a4d8be) SHA1(d67f14a2eb53b79a7d9eb08103325299bc643781) ) +ROM_END + + ROM_START( mvbfree ) ROM_REGION( 0x0800, "maincpu", 0 ) ROM_LOAD( "d553c-049", 0x0000, 0x0800, CRC(d64a8399) SHA1(97887e486fa29b1fc4a5a40cacf3c960f67aacbf) ) @@ -2504,6 +2565,8 @@ CONS( 1981, galaxy2, 0, 0, galaxy2, galaxy2, driver_device, 0, "Epoch" CONS( 1982, astrocmd, 0, 0, astrocmd, astrocmd, driver_device, 0, "Epoch", "Astro Command", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) CONS( 1982, edracula, 0, 0, edracula, edracula, driver_device, 0, "Epoch", "Dracula (Epoch)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1979, mcompgin, 0, 0, mcompgin, mcompgin, driver_device, 0, "Mattel", "Computer Gin", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) + CONS( 1979, mvbfree, 0, 0, mvbfree, mvbfree, driver_device, 0, "Mego", "Mini-Vid Break Free", MACHINE_SUPPORTS_SAVE ) CONS( 1980, tccombat, 0, 0, tccombat, tccombat, driver_device, 0, "Tomy", "Cosmic Combat", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mame/layout/mcompgin.lay b/src/mame/layout/mcompgin.lay new file mode 100644 index 00000000000..9d3e4d2766a --- /dev/null +++ b/src/mame/layout/mcompgin.lay @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/mess.lst b/src/mame/mess.lst index d43909d9e41..a13d6f81c9b 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2261,7 +2261,6 @@ gckong // Gakken gdigdug // Gakken mwcbaseb // Mattel pbqbert // Parker Brothers -mvbfree // Mego kingman // Tomy tmtron // Tomy vinvader // VTech @@ -2374,6 +2373,8 @@ efball // Epoch galaxy2 // Epoch astrocmd // Epoch edracula // Epoch +mcompgin // Mattel +mvbfree // Mego tccombat // Tomy tmpacman // Tomy tmtennis // Tomy -- cgit v1.2.3-70-g09d2 From c9cce7cec7715574c3665b756d0a8638a34c5587 Mon Sep 17 00:00:00 2001 From: dlabi Date: Sun, 7 Feb 2016 23:36:14 +0100 Subject: Sord m5 driver update added support for RAM expansions EM-5,64KBI,64KBF,64KRX added m5p_brno mod Sord m5+1024kB ramdisk+cp/m 2 cart slots --- hash/m5_cart.xml | 143 +++++-- hash/m5_flop.xml | 16 + src/devices/bus/m5/rom.cpp | 63 +++ src/devices/bus/m5/rom.h | 50 +++ src/devices/bus/m5/slot.cpp | 275 +++++++++++++ src/devices/bus/m5/slot.h | 119 ++++++ src/mame/drivers/m5.cpp | 979 ++++++++++++++++++++++++++++++++++++++++++-- src/mame/includes/m5.h | 112 ++++- src/mame/mess.lst | 1 + 9 files changed, 1669 insertions(+), 89 deletions(-) create mode 100644 hash/m5_flop.xml create mode 100644 src/devices/bus/m5/rom.cpp create mode 100644 src/devices/bus/m5/rom.h create mode 100644 src/devices/bus/m5/slot.cpp create mode 100644 src/devices/bus/m5/slot.h diff --git a/hash/m5_cart.xml b/hash/m5_cart.xml index b23d9269ae3..7ff0947beaa 100644 --- a/hash/m5_cart.xml +++ b/hash/m5_cart.xml @@ -57,8 +57,8 @@ Learning Soft: Programming Languages: - - FLAC - - FLAC-II + - FALC + - FALC-II - BASIC-I - BASIC-G - BASIC-F @@ -97,7 +97,7 @@ and why some of the dumps below have weird size? - + @@ -162,7 +162,7 @@ and why some of the dumps below have weird size? - + @@ -232,14 +232,14 @@ and why some of the dumps below have weird size? - Pooyan (Alt) + Pooyan (Alt)Modified version cooperating with 64kB RAM 1982 Konami - + @@ -252,7 +252,7 @@ and why some of the dumps below have weird size? - + @@ -265,7 +265,7 @@ and why some of the dumps below have weird size? - + @@ -278,7 +278,7 @@ and why some of the dumps below have weird size? - + @@ -344,7 +344,7 @@ and why some of the dumps below have weird size? - + @@ -357,7 +357,7 @@ and why some of the dumps below have weird size? - + @@ -394,7 +394,7 @@ and why some of the dumps below have weird size? Takara - + @@ -405,7 +405,7 @@ and why some of the dumps below have weird size? Takara - + @@ -431,7 +431,7 @@ and why some of the dumps below have weird size? Sord - + @@ -442,7 +442,7 @@ and why some of the dumps below have weird size? Sord - + @@ -453,7 +453,7 @@ and why some of the dumps below have weird size? Sord - + @@ -465,7 +465,7 @@ and why some of the dumps below have weird size? - + @@ -476,32 +476,32 @@ and why some of the dumps below have weird size? Sord - + - + BASIC-W 198? Sord? - + - + M5 Terminal 19?? <unknown> - + @@ -512,7 +512,7 @@ and why some of the dumps below have weird size? <unknown> - + @@ -536,7 +536,7 @@ and why some of the dumps below have weird size? - + @@ -548,7 +548,7 @@ and why some of the dumps below have weird size? - + @@ -560,7 +560,7 @@ and why some of the dumps below have weird size? - + @@ -572,7 +572,7 @@ and why some of the dumps below have weird size? - + @@ -580,11 +580,10 @@ and why some of the dumps below have weird size? - + Unknown CSMAZE - 19?? + 1983 <unknown> @@ -606,4 +605,88 @@ but we need more info --> + + + + + EM-5 Expansion memory 32Kb + 198? + Sord + + + + + + + + + + + EM-64 Expansion memory 64Kb + 198? + unknown + + + + + + + + + 64Kbf Expansion memory 64Kb + 199? + unknown + + + + + + + + + + + + 64Krx Expansion board 64Kb + 199? + unknown + + + + + + + + + + + + + + + + + + + Boot for Brno ramdisk + 1989 + <Pavel Brychta a spol.> + + + + + + + + + Brno windows boot + 1989 + <Ladislav Novak> + + + + + + + diff --git a/hash/m5_flop.xml b/hash/m5_flop.xml new file mode 100644 index 00000000000..1c9beb03a8e --- /dev/null +++ b/hash/m5_flop.xml @@ -0,0 +1,16 @@ + + + + + + Booting diskette for CP/M.[Brno mod] + 1989 + + + + + + + + + diff --git a/src/devices/bus/m5/rom.cpp b/src/devices/bus/m5/rom.cpp new file mode 100644 index 00000000000..bffd33df541 --- /dev/null +++ b/src/devices/bus/m5/rom.cpp @@ -0,0 +1,63 @@ +// license:BSD-3-Clause +// copyright-holders:Fabio Priuli +/*********************************************************************************************************** + + + M5 cart emulation + + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "rom.h" + + +//------------------------------------------------- +// m5_rom_device - constructor +//------------------------------------------------- + +const device_type M5_ROM_STD = &device_creator; +const device_type M5_ROM_RAM = &device_creator; + + +m5_rom_device::m5_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_m5_cart_interface( mconfig, *this ) +{ +} + +m5_rom_device::m5_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, M5_ROM_STD, "M5 Standard ROM Carts", tag, owner, clock, "m5_rom", __FILE__), + device_m5_cart_interface( mconfig, *this ) +{ +} + + +m5_ram_device::m5_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : m5_rom_device(mconfig, M5_ROM_RAM, "M5 Expansion memory cart", tag, owner, clock, "m5_ram", __FILE__) +{ +} + + +/*------------------------------------------------- + mapper specific handlers + -------------------------------------------------*/ + +READ8_MEMBER(m5_rom_device::read_rom) +{ + if (offset < m_rom_size) + return m_rom[offset]; + else + return 0xff; +} + +READ8_MEMBER(m5_ram_device::read_ram) +{ + return m_ram[offset]; +} + +WRITE8_MEMBER(m5_ram_device::write_ram) +{ + m_ram[offset] = data; +} diff --git a/src/devices/bus/m5/rom.h b/src/devices/bus/m5/rom.h new file mode 100644 index 00000000000..8bf62a90fa8 --- /dev/null +++ b/src/devices/bus/m5/rom.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:Fabio Priuli +#ifndef __M5_ROM_H +#define __M5_ROM_H + +#include "slot.h" + + +// ======================> m5_rom_device + +class m5_rom_device : public device_t, + public device_m5_cart_interface +{ +public: + // construction/destruction + m5_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + m5_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start() {} + virtual void device_reset() {} + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom); +}; + +// ======================> m5_ram_device + +class m5_ram_device : public m5_rom_device +{ +public: + // construction/destruction + m5_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start() {} + virtual void device_reset() {} + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_ram); + virtual DECLARE_WRITE8_MEMBER(write_ram); +}; + + +// device type definition +extern const device_type M5_ROM_STD; +extern const device_type M5_ROM_RAM; + + +#endif diff --git a/src/devices/bus/m5/slot.cpp b/src/devices/bus/m5/slot.cpp new file mode 100644 index 00000000000..0f3d275f699 --- /dev/null +++ b/src/devices/bus/m5/slot.cpp @@ -0,0 +1,275 @@ +// license:BSD-3-Clause +// copyright-holders:Fabio Priuli +/*********************************************************************************************************** + + M5 cart emulation + (through slot devices) + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "slot.h" + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type M5_CART_SLOT = &device_creator; + +//************************************************************************** +// M5 Cartridges Interface +//************************************************************************** + +//------------------------------------------------- +// device_m5_cart_interface - constructor +//------------------------------------------------- + +device_m5_cart_interface::device_m5_cart_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device), + m_rom(NULL), + m_rom_size(0) +{ +} + + +//------------------------------------------------- +// ~device_m5_cart_interface - destructor +//------------------------------------------------- + +device_m5_cart_interface::~device_m5_cart_interface() +{ +} + +//------------------------------------------------- +// rom_alloc - alloc the space for the cart +//------------------------------------------------- + +void device_m5_cart_interface::rom_alloc(UINT32 size, const char *tag) +{ + if (m_rom == NULL) + { + m_rom = device().machine().memory().region_alloc(std::string(tag).append(M5SLOT_ROM_REGION_TAG).c_str(), size, 1, ENDIANNESS_LITTLE)->base(); + m_rom_size = size; + } +} + + +//------------------------------------------------- +// ram_alloc - alloc the space for the ram +//------------------------------------------------- + +void device_m5_cart_interface::ram_alloc(UINT32 size) +{ + m_ram.resize(size); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// m5_cart_slot_device - constructor +//------------------------------------------------- +m5_cart_slot_device::m5_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, M5_CART_SLOT, "M5 Cartridge Slot", tag, owner, clock, "m5_cart_slot", __FILE__), + device_image_interface(mconfig, *this), + device_slot_interface(mconfig, *this), + m_type(M5_STD), m_cart(nullptr) +{ +} + + +//------------------------------------------------- +// m5_cart_slot_device - destructor +//------------------------------------------------- + +m5_cart_slot_device::~m5_cart_slot_device() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void m5_cart_slot_device::device_start() +{ + m_cart = dynamic_cast(get_card_device()); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void m5_cart_slot_device::device_config_complete() +{ + // set brief and instance name + update_names(); +} + + +//------------------------------------------------- +// M5 PCB +//------------------------------------------------- + +struct m5_slot +{ + int pcb_id; + const char *slot_option; +}; + +// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it +static const m5_slot slot_list[] = +{ + {EM_5,"em-5"}, + {MEM64KBI,"64kbi"}, + {MEM64KBF,"64kbf"}, + {MEM64KRX,"64krx"} +}; + +static int m5_get_pcb_id(const char *slot) +{ + for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + { + if (!core_stricmp(slot_list[i].slot_option, slot)) + return slot_list[i].pcb_id; + } + + return 0; +} + +static const char *m5_get_slot(int type) +{ + for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + { + if (slot_list[i].pcb_id == type) + return slot_list[i].slot_option; + } + + return "std"; +} + + +/*------------------------------------------------- + call load + -------------------------------------------------*/ + +bool m5_cart_slot_device::call_load() +{ + if (m_cart) + { + m_type=M5_STD; + + if (software_entry() != NULL) + { + const char *pcb_name = get_feature("slot"); + //software_info *name=m_software_info_ptr; + if (pcb_name) //is it ram cart? + m_type = m5_get_pcb_id(m_full_software_name.c_str()); + else + m_type=M5_STD; //standard cart(no feature line in xml) + } + + if (m_type == M5_STD || m_type>2) //carts with roms + { + + UINT32 size = (software_entry() == NULL) ? length() : get_software_region_length("rom"); + + if (size > 0x5000 && m_type == M5_STD) + { + seterror(IMAGE_ERROR_UNSPECIFIED, "Image extends beyond the expected size for an M5 cart"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, tag()); + + if (software_entry() == NULL) + fread(m_cart->get_rom_base(), size); + else + memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); + + } + if (!M5_STD) + if (get_software_region("ram")) + m_cart->ram_alloc(get_software_region_length("ram")); + + + //printf("Type: %s\n", m5_get_slot(m_type)); + } + + return IMAGE_INIT_PASS; +} + + +/*------------------------------------------------- + call softlist load + -------------------------------------------------*/ + +bool m5_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) +{ + load_software_part_region(*this, swlist, swname, start_entry); + return TRUE; +} + + +/*------------------------------------------------- + get default card software + -------------------------------------------------*/ + +void m5_cart_slot_device::get_default_card_software(std::string &result) +{ + if (open_image_file(mconfig().options())) + { + const char *slot_string = "std"; + UINT32 size = core_fsize(m_file); + int type = M5_STD; + + + slot_string = m5_get_slot(type); + + //printf("type: %s\n", slot_string); + clear(); + + result.assign(slot_string); + return; + } + + software_get_default_slot(result, "std"); +} + +/*------------------------------------------------- + read + -------------------------------------------------*/ + +READ8_MEMBER(m5_cart_slot_device::read_rom) +{ + if (m_cart) + return m_cart->read_rom(space, offset); + else + return 0xff; +} + +/*------------------------------------------------- + read + -------------------------------------------------*/ + +READ8_MEMBER(m5_cart_slot_device::read_ram) +{ + if (m_cart) + return m_cart->read_ram(space, offset); + else + return 0xff; +} + +/*------------------------------------------------- + write + -------------------------------------------------*/ + +WRITE8_MEMBER(m5_cart_slot_device::write_ram) +{ + if (m_cart) + m_cart->write_ram(space, offset, data); +} diff --git a/src/devices/bus/m5/slot.h b/src/devices/bus/m5/slot.h new file mode 100644 index 00000000000..8010f9f5b26 --- /dev/null +++ b/src/devices/bus/m5/slot.h @@ -0,0 +1,119 @@ +// license:BSD-3-Clause +// copyright-holders:Fabio Priuli +#ifndef __M5_SLOT_H +#define __M5_SLOT_H + +/*************************************************************************** + TYPE DEFINITIONS + ***************************************************************************/ + + +/* PCB */ +enum +{ + EM_5 = 1, + MEM64KBI, + MEM64KBF, + MEM64KRX +}; + + +#define M5_STD 0 + + +// ======================> device_m5_cart_interface + +class device_m5_cart_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_m5_cart_interface(const machine_config &mconfig, device_t &device); + virtual ~device_m5_cart_interface(); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom) { return 0xff; } + virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; } + virtual DECLARE_WRITE8_MEMBER(write_ram) {} + + void rom_alloc(UINT32 size, const char *tag); + void ram_alloc(UINT32 size); + UINT8* get_rom_base() { return m_rom; } + UINT8* get_ram_base() { return &m_ram[0]; } + UINT32 get_rom_size() { return m_rom_size; } + UINT32 get_ram_size() { return m_ram.size(); } + + void save_ram() { device().save_item(NAME(m_ram)); } + +protected: + // internal state + UINT8 *m_rom; + UINT32 m_rom_size; + dynamic_buffer m_ram; +}; + + +// ======================> m5_cart_slot_device + +class m5_cart_slot_device : public device_t, + public device_image_interface, + public device_slot_interface +{ +public: + // construction/destruction + m5_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~m5_cart_slot_device(); + + // device-level overrides + virtual void device_start(); + virtual void device_config_complete(); + + // image-level overrides + virtual bool call_load(); + virtual void call_unload() {} + virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry); + + int get_type() { return m_type; } + + void save_ram() { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); } + + virtual iodevice_t image_type() const { return IO_CARTSLOT; } + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 0; } + virtual bool is_creatable() const { return 0; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 1; } + virtual const option_guide *create_option_guide() const { return NULL; } + virtual const char *image_interface() const { return "m5_cart"; } + virtual const char *file_extensions() const { return "bin,rom"; } + + // slot interface overrides + virtual void get_default_card_software(std::string &result); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom); + virtual DECLARE_READ8_MEMBER(read_ram); + virtual DECLARE_WRITE8_MEMBER(write_ram); + virtual DECLARE_SETOFFSET_MEMBER (read_off); + +protected: + + int m_type; + device_m5_cart_interface* m_cart; +}; + + + +// device type definition +extern const device_type M5_CART_SLOT; + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS + ***************************************************************************/ + +#define M5SLOT_ROM_REGION_TAG ":cart:rom" + +#define MCFG_M5_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ + MCFG_DEVICE_ADD(_tag, M5_CART_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) +#endif diff --git a/src/mame/drivers/m5.cpp b/src/mame/drivers/m5.cpp index 91b05cf42b5..f9487075fb9 100644 --- a/src/mame/drivers/m5.cpp +++ b/src/mame/drivers/m5.cpp @@ -1,26 +1,267 @@ // license:BSD-3-Clause -// copyright-holders:Curt Coder +// copyright-holders:Curt Coder, Ales Dlabac /*************************************************************************** Sord m.5 http://www.retropc.net/mm/m5/ - http://www.museo8bits.es/wiki/index.php/Sord_M5 - http://k5.web.klfree.net/content/view/10/11/ - http://k5.web.klfree.net/images/stories/sord/m5heap.htm + http://www.museo8bits.es/wiki/index.php/Sord_M5 not working + http://k5.web.klfree.net/content/view/10/11/ not working + http://k5.web.klfree.net/images/stories/sord/m5heap.htm not working + http://k5.klfree.net/index.php?option=com_content&task=view&id=5&Itemid=3 + http://k5.klfree.net/index.php?option=com_content&task=view&id=10&Itemid=11 + http://k5.klfree.net/index.php?option=com_content&task=view&id=14&Itemid=3 + http://www.dlabi.cz/?s=sord + https://www.facebook.com/groups/59667560188/ + http://www.oldcomp.cz/viewtopic.php?f=103&t=1164 ****************************************************************************/ -/* +/*************************************************************************** TODO: - - floppy + - fd5 floppy - SI-5 serial interface (8251, ROM) - - 64KB RAM expansions - + - ramdisk for KRX Memory expansion + - add to brno mod support for lzr floppy disc format + - move dipswitch declaration to sofwarelist file? + - in brno mod include basic-i + - 64krx: get windows ROM version with cpm & ramdisk support (Stuchlik S.E.I. version) + + + + CHANGELOG: + +5.2.2016 + - added BRNO modification - 1024kB Ramdisk + CP/M support + - 32/64KB RAM expansions EM-5, 64KBI, 64KBF, 64KRX + - since now own version of rom and slot handlers + - 2 slots for carts + + +****************************************************************************** + + +Controlling (paging) of homebrew 64KB RAM carts +================================================ + +Used ports: +EM-64, 64KBI: OUT 6CH,00H - enables ROM + OUT 6CH,01H - enables RAM +64KBF: OUT 30H,00000xxxB - enables RAM or ROM, see bellow +64KRD, 64KRX: OUT 7FH,00000000B - enables RAM + OUT 7FH,11111111B - enables ROM + OUT 7FH,xxxxxxxxB - enables RAM and ROM, see bellow + +=========================================================================================================================== + +RAM/ROM modes of EM-64/64KBI cart +------------------------------------------ +mode 0: 0x0000-0x6fff ROM 0x7000-0xffff RAM (it is possible to limit actual ROM size by DIP switch only to 32kb) +mode 1: 0x0000-0xffff RAM + +=========================================================================================================================== + +RAM/ROM modes of 64KBF version 2C cart +------------------------------------------ +Memory paging is done by using "OUT &30,mod". + +MODE READ WRITE +---------------------------------------------------------------------- + 00 8 KB MON + 20 KB BF + 36 KB RAM 28 KB DIS + 36 KB RAM + 01 64 KB RAM 64 KB RAM + 02 8 KB MON + 56 KB RAM 64 KB RAM + 03 64 KB RAM 28 KB DIS + 36 KB RAM + 04 64 KB RAM 16 KB DIS + 48 KB RAM + 05 8 KB MON + 20 KB BF + 36 KB RAM 64 KB RAM + 06 8 KB MON + 20 KB DIS + 36 KB RAM 64 KB RAM + 07 64 KB DIS 64 KB DIS + +Version LZR ( 2C ) +================ + ++------------+ +|////////////| READ ONLY AREA ++------------+ +|\\\\\\\\\\\\| WRITE ONLY AREA ++------------+ +|XXXXXXXXXXXX| R&W AREA ++------------+ +| | DISABLED R&W ++------------+ + + 0 0 0 1 1 2 2 2 3 3 4 4 4 5 5 6 6 +kB 0 4 8 2 6 0 4 8 2 6 0 4 8 2 6 0 4 + +-------+-------------------+ +ROM |MONITOR| BASIC-F | + +-------+-------+-------+---+---+-------+-------+-------+-------+ +RAM | | | | | | | | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +CART | | | | | | | | | + +-------+-------+-------+-------+-------+-------+-------+-------+ + + +Mode + +-------+-------------------+ + |///////|///////////////////| + +-------+-------+-------+---+---+-------+-------+-------+-------+ +M0 | | | | |XXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX| + +-------+-------+-------+-------+-------+-------+-------+-------+ + + +-------+-------------------+ + | | | + +-------+-------+-------+---+---+-------+-------+-------+-------+ +M1 |XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX| + +-------+-------+-------+-------+-------+-------+-------+-------+ + + +-------+-------------------+ + |///////| | + +-------+-------+-------+---+---+-------+-------+-------+-------+ +M2 |\\\\\\\|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX| + +-------+-------+-------+-------+-------+-------+-------+-------+ + + +-------+-------------------+ + | | | + +-------+-------+-------+---+---+-------+-------+-------+-------+ +M3 |///////|///////|///////|///|XXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX| + +-------+-------+-------+-------+-------+-------+-------+-------+ + + +-------+-------------------+ + | | | + +-------+-------+-------+---+---+-------+-------+-------+-------+ +M4 |///////|///////|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX| + +-------+-------+-------+-------+-------+-------+-------+-------+ + + +-------+-------------------+ + |///////|///////////////////| + +-------+-------+-------+---+---+-------+-------+-------+-------+ +M5 |\\\\\\\|\\\\\\\|\\\\\\\|\\\|XXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX| + +-------+-------+-------+-------+-------+-------+-------+-------+ + + +-------+-------------------+ + |///////| | + +-------+-------+-------+---+---+-------+-------+-------+-------+ +M6 |\\\\\\\|\\\\\\\|\\\\\\\|\\\|XXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX| + +-------+-------+-------+---+---+-------+-------+-------+-------+ + |///////|///////|///| + +-------+-------+---+ + + +-------+-------------------+ + | | | + +-------+-------+-------+---+---+-------+-------+-------+-------+ +M7 | | | | | | | | | + +-------+-------+-------+-------+-------+-------+-------+-------+ + |XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX| + +---------------------------------------------------------------+ + +=========================================================================================================== + +Memory map of ROM and RAM in configuration SORD M5 + 64 KRX memory cart +----------------------------------------------------------------------- + + cart inside Sord inside Sord cart cart +FFFF +----------+ +----------+ +----------+ +----------+ +----------+ + | | | | | | + | | | EPROM 16K| | EPROM 16K| + | | | 5 | | 7 | +C000 | DRAM | +----------+ +----------+ + | | | | | | + | | | EPROM 16K| | EPROM 16K| + | | | 4 | | 6 | +7FFF +----------+ +----------+ +----------+ +----------+ + | SRAM | +7000 +----------+ +----------+ + | | +6000 | | +----------+ + | | | | +5000 | | | EPROM 8K | + | | | 3 | +4000 | | +----------+ +----------+ + | | | | +3000 | DRAM | | EPROM 8K | + | | | 2 | +2000 | | +----------+ + | | | | +1000 | | | EPROM 8K | + | | | 1 | +0000 +----------+ +----------+ +----------+ +----------+ +----------+ + +1 - MONITOR ROM +2 - WINDOWS + BASIC-F 3rd part +3 - BASIC-I +4 - 2nd part of BASIC-F + 1st part of BASIC-F +5 - 1st part of BASIC-G + 2nd part of BASIC-G +6 - 1st part of MSX 1.C +7 - 2nd part of MSX 1.C + +Note: position 3 could be replaced with SRAM 8KB with battery power backup! + +Upon powering up either SRAM + 1,2,3,4,5 or SRAM + 1,2,3,6,7 are selected. +Switching between 4,5 and 6,7 is provided by hw switch, selecting ROM/RAM mode happens +using OUT (7FH),A, where each bit of A means 8KB memory chunk ( state: 0=RAM, +1=ROM, bit: 0=1, 1=2, 2=3, 3=always SRAM, 4=4, 5=5, 6=6, 7=7 ). + + */ +/* +************************************************************* +* BRNO MOD * +************************************************************* +HW and SW was originaly created by Pavel Brychta with help of Jiri Kubin and L. Novak +This driver mod was implemented by Ales Dlabac with great help of Pavel Brychta. Without him this would never happen +This mod exists in two versions. First one is "windows"(brno_rom12.rom) version and was created by Ladislav Novak. +Second version vesion is "pure text" and was created by Pavel Brychta and Jiri Kubin + +Function: +Whole Sord's address area (0000-FFFF) is divided to 16 4kB banks. To this 16 banks +you can map any of possible 256 ramdisc blocks what allows user to have 1024kB large ramdisc. +Ofcourse to be able to realise this is necessary page out all roms + +As pagination port MMU(page select) is used. +For RAM write protection port CASEN is used. 0=access to ramdisk enabled, 0xff=ramdisk access disabled(data protection), &80=ROM2+48k RAM, &81=ROM2+4k RAM(this is not implemented) +For ROM detaching port RAMEN is used. 0=rom enable; 0xff=rom+sord ram disabled (ramdisk visible) + +SORD M5 RAM memory map in address area 7000H-7FFFH +7000H 7300H 7800H 7E00H 7FFFH + +---------+-----------------------+----------------------------+---------+ + | a. | | c. | d. | + +a. SORD system variables and stack +c. Area where the first sector of 1st track is loaded, simultaneously is reserved for Hook program +d. Reserved for memory tests and ramdisk mapping(pagination). After boot is used as buffer for cursor position, + type of floppy and so on. Area consists of: + +7FFFH .... bootloader version +7FFEH .... identification byte of floppy - is transfered from EPROM, it might be changed by SETUP +7FFDH .... namber of last Ramdisk segment of RAM +7FFBH .... address of cursor in VRAM in 40 columns CRT. For 80 columns CRT both bytes are zero +7FF9H .... X,Y cursor actual position for 40 columns CRTs. In case of 80 columns CRT both bytes are zero + +System floppy disk header on track 00 of 1st sector + byte 0-1 ... system disk identification SY + byte 2 ... # of physical sectors for BIOS or DOS plus # of segments for DIR + byte 3-4 ... Start address for loading of BIOS or DOS + byte 5 ... # of bytes for possible HOOK program + byte 6- ... HOOK program, or either BIOS or DOS + +In case of HOOK, bytes 8 and 9 contains characters 'H' and 'O' for HOOK testing + +Few other notes: + Ramdisc warm boot is provided by pressing Ctrl+C + Against real HW/SW is possible to store ramdisc dump to file by pressing Ctrl+S which could be loaded back in as snapshot + + + Floppy formats as follows: + + A: Ramdisk 1024kB, 8 sectors, + B: Floppy format "Heat Magnolia" SingleSide SingleDensity , 40 tracks, 9 sectors, 512 sec. length, 128 dirs, offset 3, 166kB + C: Floppy format "Robotron aka PC1715", DS DD, 80 tracks, 5 sectors, 1024 sec. length, 128 dirs, offset 2, 780kB + +**********************************************************************************************************************************/ + + #include "emu.h" #include "cpu/z80/z80.h" @@ -31,14 +272,17 @@ #include "bus/centronics/ctronics.h" #include "machine/i8255.h" #include "machine/ram.h" +#include "machine/wd_fdc.h" //brno mod #include "machine/upd765.h" #include "machine/z80ctc.h" #include "sound/sn76496.h" #include "video/tms9928a.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "includes/m5.h" +#include "bus/m5/slot.h" +#include "bus/m5/rom.h" #include "softlist.h" +#include "includes/m5.h" + + //************************************************************************** @@ -232,6 +476,211 @@ WRITE8_MEMBER( m5_state::fd5_tc_w ) m_fdc->tc_w(false); } +//************************************************************************** +// 64KBI support for oldest memory module +//************************************************************************** + +READ8_MEMBER( m5_state::mem64KBI_r ) //in 0x6c +{ + return BIT(m_ram_mode, 0); +} + +WRITE8_MEMBER( m5_state::mem64KBI_w ) //out 0x6c +{ + + if (m_ram_type != MEM64KBI) return; + + address_space &program = m_maincpu->space(AS_PROGRAM); + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart_ram->tag()).append(M5SLOT_ROM_REGION_TAG).c_str()); + memory_region *ram_region=memregion(region_tag.assign(m_cart_ram->tag()).append(":ram").c_str()); + + if (m_ram_mode == BIT(data, 0)) + return; + + m_ram_mode = BIT(data, 0); + + //if 32kb only mode don't map top ram + if (m_ram_mode && (m_DIPS->read() & 4) != 4) + { + program.install_ram(0x0000, 0x6fff, ram_region->base()); + } + else + { + program.install_rom(0x0000, 0x1fff, memregion(Z80_TAG)->base()); + program.unmap_write(0x0000, 0x1fff); + + //if AUTOSTART is on don't load any ROM cart + if (m_cart && (m_DIPS->read() & 2) != 2) + { + program.install_read_handler(0x2000, 0x6fff, read8_delegate(FUNC(m5_cart_slot_device::read_rom), (m5_cart_slot_device*)m_cart)); //m_cart pointer to rom cart + program.unmap_write(0x2000, 0x3fff); + } + else + program.unmap_readwrite(0x2000, 0x3fff); + } + + logerror("64KBI: ROM %s", m_ram_mode == 0 ? "enabled\n" : "disabled\n"); +} + +//************************************************************************** +// 64KBF paging +//************************************************************************** + +WRITE8_MEMBER( m5_state::mem64KBF_w ) //out 0x30 +{ + if (m_ram_type != MEM64KBF) return; + + address_space &program = m_maincpu->space(AS_PROGRAM); + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart_ram->tag()).append(M5SLOT_ROM_REGION_TAG).c_str()); //ROM region of the cart + memory_region *ram_region=memregion(region_tag.assign(m_cart_ram->tag()).append(":ram").c_str()); //RAM region of the cart + memory_region *rom_region=memregion(region_tag.assign(m_cart->tag()).append(M5SLOT_ROM_REGION_TAG).c_str()); //region where clasic ROM cartridge resides + + if (m_ram_mode == data) + return; + + m_ram_mode = data; + + switch(m_ram_mode) + { + case 0: + program.unmap_write(0x0000, 0x6fff); + membank("bank1r")->set_base(memregion(Z80_TAG)->base()); + membank("bank2r")->set_base(m_cart_rom->base()); + membank("bank3r")->set_base(m_cart_rom->base()+0x2000); + membank("bank4r")->set_base(m_cart_rom->base()+0x4000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + break; + case 1: + program.install_write_bank(0x0000,0x1fff,"bank1w"); + program.install_write_bank(0x2000,0x3fff,"bank2w"); + program.install_write_bank(0x4000,0x5fff,"bank3w"); + program.install_write_bank(0x6000,0x6fff,"bank4w"); + membank("bank1r")->set_base(ram_region->base()+0x0000); membank("bank1w")->set_base(ram_region->base()+0x0000); + membank("bank2r")->set_base(ram_region->base()+0x2000); membank("bank2w")->set_base(ram_region->base()+0x2000); + membank("bank3r")->set_base(ram_region->base()+0x4000); membank("bank3w")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(ram_region->base()+0x6000); membank("bank4w")->set_base(ram_region->base()+0x6000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + break; + case 2: + program.install_write_bank(0x0000,0x1fff,"bank1w"); + program.install_write_bank(0x2000,0x3fff,"bank2w"); + program.install_write_bank(0x4000,0x5fff,"bank3w"); + program.install_write_bank(0x6000,0x6fff,"bank4w"); + membank("bank1r")->set_base(memregion(Z80_TAG)->base()); membank("bank1w")->set_base(ram_region->base()+0x0000); + membank("bank2r")->set_base(ram_region->base()+0x2000); membank("bank2w")->set_base(ram_region->base()+0x2000); + membank("bank3r")->set_base(ram_region->base()+0x4000); membank("bank3w")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(ram_region->base()+0x6000); membank("bank4w")->set_base(ram_region->base()+0x6000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + break; + case 3: + program.unmap_write(0x0000, 0x6fff); + membank("bank1r")->set_base(ram_region->base()+0x0000); + membank("bank2r")->set_base(ram_region->base()+0x2000); + membank("bank3r")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(ram_region->base()+0x6000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + break; + case 4: + program.unmap_write(0x0000, 0x3fff); + program.install_write_bank(0x4000,0x5fff,"bank3w"); + program.install_write_bank(0x6000,0x6fff,"bank4w"); + membank("bank1r")->set_base(ram_region->base()+0x0000); + membank("bank2r")->set_base(ram_region->base()+0x2000); + membank("bank3r")->set_base(ram_region->base()+0x4000); membank("bank3w")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(ram_region->base()+0x6000); membank("bank4w")->set_base(ram_region->base()+0x6000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + break; + case 5: + program.install_write_bank(0x0000,0x1fff,"bank1w"); + program.install_write_bank(0x2000,0x3fff,"bank2w"); + program.install_write_bank(0x4000,0x5fff,"bank3w"); + program.install_write_bank(0x6000,0x6fff,"bank4w"); + membank("bank1r")->set_base(memregion(Z80_TAG)->base()); membank("bank1w")->set_base(ram_region->base()+0x0000); + membank("bank2r")->set_base(m_cart_rom->base()); membank("bank2w")->set_base(ram_region->base()+0x2000); + membank("bank3r")->set_base(m_cart_rom->base()+0x2000); membank("bank3w")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(m_cart_rom->base()+0x4000); membank("bank4w")->set_base(ram_region->base()+0x6000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + break; + case 6: + program.install_write_bank(0x0000,0x1fff,"bank1w"); + program.install_write_bank(0x2000,0x3fff,"bank2w"); + program.install_write_bank(0x4000,0x5fff,"bank3w"); + program.install_write_bank(0x6000,0x6fff,"bank4w"); + membank("bank1r")->set_base(memregion(Z80_TAG)->base()); membank("bank1w")->set_base(ram_region->base()+0x0000); + membank("bank2r")->set_base(rom_region->base()+0x0000); membank("bank2w")->set_base(ram_region->base()+0x2000); + membank("bank3r")->set_base(rom_region->base()+0x2000); membank("bank3w")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(rom_region->base()+0x4000); membank("bank4w")->set_base(ram_region->base()+0x6000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + break; + case 7: //probably this won't work - it should redirect rw to another ram module + program.install_write_bank(0x0000,0x1fff,"bank1w"); + program.install_write_bank(0x2000,0x3fff,"bank2w"); + program.install_write_bank(0x4000,0x5fff,"bank3w"); + program.install_write_bank(0x6000,0x6fff,"bank4w"); + program.install_readwrite_bank(0x7000,0x7fff,"sram"); + membank("bank1r")->set_base(rom_region->base()+0x0000); membank("bank1w")->set_base(rom_region->base()+0x0000); + membank("bank2r")->set_base(rom_region->base()+0x2000); membank("bank2w")->set_base(rom_region->base()+0x2000); + membank("bank3r")->set_base(rom_region->base()+0x4000); membank("bank3w")->set_base(rom_region->base()+0x4000); + membank("bank4r")->set_base(rom_region->base()+0x6000); membank("bank4w")->set_base(rom_region->base()+0x6000); + membank("sram")->set_base(rom_region->base()+0x7000); + membank("bank5r")->set_base(rom_region->base()+0x8000); membank("bank5w")->set_base(rom_region->base()+0x8000); + membank("bank6r")->set_base(rom_region->base()+0xc000); membank("bank6w")->set_base(rom_region->base()+0xc000); + break; + } + + logerror("64KBF RAM mode set to %d\n", m_ram_mode); +} + +//************************************************************************** +// 64KRX paging +//************************************************************************** + +WRITE8_MEMBER( m5_state::mem64KRX_w ) //out 0x7f +{ + + if (m_ram_type != MEM64KRX) return; + if (m_ram_mode == data) return; + + address_space &program = m_maincpu->space(AS_PROGRAM); + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart_ram->tag()).append(M5SLOT_ROM_REGION_TAG).c_str()); + memory_region *ram_region=memregion(region_tag.assign(m_cart_ram->tag()).append(":ram").c_str()); + + m_ram_mode = data; + + BIT(m_ram_mode, 0) ? membank("bank1r")->set_base(memregion(Z80_TAG)->base()) : membank("bank1r")->set_base(ram_region->base()); + BIT(m_ram_mode, 1) ? membank("bank2r")->set_base(m_cart_rom->base()) : membank("bank2r")->set_base(ram_region->base()+0x2000); + BIT(m_ram_mode, 2) ? membank("bank3r")->set_base(m_cart_rom->base()+0x2000) : membank("bank3r")->set_base(ram_region->base()+0x4000); + + if ((m_DIPS->read() & 0x01)) + { + BIT(m_ram_mode, 4) ? membank("bank5r")->set_base(m_cart_rom->base()+0x6000) : membank("bank5r")->set_base(ram_region->base()+0x8000); + BIT(m_ram_mode, 5) ? membank("bank6r")->set_base(m_cart_rom->base()+0xa000) : membank("bank6r")->set_base(ram_region->base()+0xc000); + } + else + { + BIT(m_ram_mode, 6) ? membank("bank5r")->set_base(m_cart_rom->base()+0xe000) : membank("bank5r")->set_base(ram_region->base()+0x8000); + BIT(m_ram_mode, 7) ? membank("bank6r")->set_base(m_cart_rom->base()+0x12000): membank("bank6r")->set_base(ram_region->base()+0xc000); + } + + //if KRX ROM is paged out page in cart ROM if any + if (m_cart && BIT(m_ram_mode, 1) == 0 ) + { + program.install_read_handler(0x2000, 0x6fff, read8_delegate(FUNC(m5_cart_slot_device::read_rom),(m5_cart_slot_device*)m_cart)); + program.unmap_write(0x2000, 0x6fff); + } + + logerror("64KRX RAM mode set to %02x\n", m_ram_mode); +} //************************************************************************** @@ -244,10 +693,13 @@ WRITE8_MEMBER( m5_state::fd5_tc_w ) static ADDRESS_MAP_START( m5_mem, AS_PROGRAM, 8, m5_state ) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM - //AM_RANGE(0x2000, 0x6fff) // mapped by the cartslot - AM_RANGE(0x7000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_RAM + AM_RANGE(0x0000, 0x1fff) AM_READ_BANK("bank1r") AM_WRITE_BANK("bank1w") //monitor rom(bios) + AM_RANGE(0x2000, 0x3fff) AM_READ_BANK("bank2r") AM_WRITE_BANK("bank2w") + AM_RANGE(0x4000, 0x5fff) AM_READ_BANK("bank3r") AM_WRITE_BANK("bank3w") + AM_RANGE(0x6000, 0x6fff) AM_READ_BANK("bank4r") AM_WRITE_BANK("bank4w") + AM_RANGE(0x7000, 0x7fff) AM_RAM //4kb internal RAM + AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank5r") AM_WRITE_BANK("bank5w") + AM_RANGE(0xc000, 0xffff) AM_READ_BANK("bank6r") AM_WRITE_BANK("bank6w") ADDRESS_MAP_END @@ -262,7 +714,7 @@ static ADDRESS_MAP_START( m5_io, AS_IO, 8, m5_state ) AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) AM_RANGE(0x20, 0x20) AM_MIRROR(0x0f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) - AM_RANGE(0x30, 0x30) AM_MIRROR(0x08) AM_READ_PORT("Y0") // 64KBF bank select + AM_RANGE(0x30, 0x30) AM_MIRROR(0x08) AM_READ_PORT("Y0") AM_WRITE( mem64KBF_w) // 64KBF paging AM_RANGE(0x31, 0x31) AM_MIRROR(0x08) AM_READ_PORT("Y1") AM_RANGE(0x32, 0x32) AM_MIRROR(0x08) AM_READ_PORT("Y2") AM_RANGE(0x33, 0x33) AM_MIRROR(0x08) AM_READ_PORT("Y3") @@ -273,9 +725,9 @@ static ADDRESS_MAP_START( m5_io, AS_IO, 8, m5_state ) AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_DEVWRITE("cent_data_out", output_latch_device, write) AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_READWRITE(sts_r, com_w) // AM_RANGE(0x60, 0x63) SIO -// AM_RANGE(0x6c, 0x6c) EM-64/64KBI bank select - AM_RANGE(0x70, 0x73) AM_MIRROR(0x0c) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) -// AM_RANGE(0x7f, 0x7f) 64KRD/64KRX bank select + AM_RANGE(0x6c, 0x6c) AM_READWRITE(mem64KBI_r, mem64KBI_w) //EM-64/64KBI paging + AM_RANGE(0x70, 0x73) /*AM_MIRROR(0x0c) don't know if necessary mirror this*/ AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) + AM_RANGE(0x7f, 0x7f) AM_WRITE( mem64KRX_w) //64KRD/64KRX paging ADDRESS_MAP_END @@ -396,6 +848,17 @@ static INPUT_PORTS_START( m5 ) PORT_START("RESET") PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) /* 1st line, 1st key from right! */ + + PORT_START("DIPS") + PORT_DIPNAME(0x01, 0x01, "KRX: BASIC[on]/MSX[off]") //switching between BASIC and MSX ROMs which share same address area + PORT_DIPSETTING( 0x00, DEF_STR( Off )) + PORT_DIPSETTING( 0x01, DEF_STR( On )) + PORT_DIPNAME(0x02, 0x00, "KBI: AUTOSTART") //pages out cart and starts loading from tape + PORT_DIPSETTING( 0x00, DEF_STR( Off )) + PORT_DIPSETTING( 0x02, DEF_STR( On )) + PORT_DIPNAME(0x04, 0x00, "KBI: 32kb only") //compatible with em-5 + PORT_DIPSETTING( 0x00, DEF_STR( Off )) + PORT_DIPSETTING( 0x04, DEF_STR( On )) INPUT_PORTS_END //------------------------------------------------- @@ -421,7 +884,7 @@ READ8_MEMBER( m5_state::ppi_pa_r ) return m_fd5_data; } -READ8_MEMBER( m5_state::ppi_pc_r ) +READ8_MEMBER(m5_state::ppi_pc_r ) { /* @@ -511,6 +974,11 @@ static SLOT_INTERFACE_START( m5_floppies ) SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) SLOT_INTERFACE_END +static SLOT_INTERFACE_START(m5_cart) + SLOT_INTERFACE_INTERNAL("std", M5_ROM_STD) + SLOT_INTERFACE_INTERNAL("ram", M5_ROM_RAM) +SLOT_INTERFACE_END + //------------------------------------------------- // z80_daisy_config m5_daisy_chain //------------------------------------------------- @@ -518,54 +986,416 @@ SLOT_INTERFACE_END static const z80_daisy_config m5_daisy_chain[] = { { Z80CTC_TAG }, - { nullptr } + { NULL } }; +//------------------------------------------------- +// BRNO mod code below +//------------------------------------------------- -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** //------------------------------------------------- -// MACHINE_START( m5 ) +// ADDRESS_MAP( m5_mem_brno ) //------------------------------------------------- -void m5_state::machine_start() + +static ADDRESS_MAP_START( m5_mem_brno, AS_PROGRAM, 8, brno_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_READWRITE_BANK("bank1") + AM_RANGE(0x1000, 0x1fff) AM_READWRITE_BANK("bank2") + AM_RANGE(0x2000, 0x2fff) AM_READWRITE_BANK("bank3") + AM_RANGE(0x3000, 0x3fff) AM_READWRITE_BANK("bank4") + AM_RANGE(0x4000, 0x4fff) AM_READWRITE_BANK("bank5") + AM_RANGE(0x5000, 0x5fff) AM_READWRITE_BANK("bank6") + AM_RANGE(0x6000, 0x6fff) AM_READWRITE_BANK("bank7") + AM_RANGE(0x7000, 0x7fff) AM_READWRITE_BANK("bank8") + AM_RANGE(0x8000, 0x8fff) AM_READWRITE_BANK("bank9") + AM_RANGE(0x9000, 0x9fff) AM_READWRITE_BANK("bank10") + AM_RANGE(0xa000, 0xafff) AM_READWRITE_BANK("bank11") + AM_RANGE(0xb000, 0xbfff) AM_READWRITE_BANK("bank12") + AM_RANGE(0xc000, 0xcfff) AM_READWRITE_BANK("bank13") + AM_RANGE(0xd000, 0xdfff) AM_READWRITE_BANK("bank14") + AM_RANGE(0xe000, 0xefff) AM_READWRITE_BANK("bank15") + AM_RANGE(0xf000, 0xffff) AM_READWRITE_BANK("bank16") +ADDRESS_MAP_END + +//------------------------------------------------- +// ADDRESS_MAP( brno_io ) +//------------------------------------------------- +static ADDRESS_MAP_START( brno_io, AS_IO, 8, brno_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) + AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) + AM_RANGE(0x20, 0x20) AM_MIRROR(0x0f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) + AM_RANGE(0x30, 0x30) AM_READ_PORT("Y0") + AM_RANGE(0x31, 0x31) AM_READ_PORT("Y1") + AM_RANGE(0x32, 0x32) AM_READ_PORT("Y2") + AM_RANGE(0x33, 0x33) AM_READ_PORT("Y3") + AM_RANGE(0x34, 0x34) AM_READ_PORT("Y4") + AM_RANGE(0x35, 0x35) AM_READ_PORT("Y5") + AM_RANGE(0x36, 0x36) AM_READ_PORT("Y6") + AM_RANGE(0x37, 0x37) AM_READ_PORT("JOY") + AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_READWRITE(sts_r, com_w) +// AM_RANGE(0x60, 0x63) // SIO + AM_RANGE(0x64, 0x67) AM_READWRITE(mmu_r, mmu_w) // MMU - page select (ramdisk memory paging) + AM_RANGE(0x68, 0x6b) AM_READWRITE(ramsel_r, ramsel_w) // CASEN 0=access to ramdisk enabled, 0xff=ramdisk access disabled(data protection), &80=ROM2+48k RAM, &81=ROM2+4k RAM + AM_RANGE(0x6c, 0x6f) AM_READWRITE(romsel_r, romsel_w) // RAMEN 0=rom enable; 0xff=rom+sord ram disabled (ramdisk visible) +// AM_RANGE(0x70, 0x73) AM_MIRROR(0x04) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) // PIO + AM_RANGE(0x78, 0x7b) AM_DEVREADWRITE(WD2797_TAG, wd_fdc_t, read, write) // WD2797 registers -> 78 - status/cmd, 79 - track #, 7a - sector #, 7b - data + AM_RANGE(0x7c, 0x7c) AM_READWRITE(fd_r, fd_w) // drive select +ADDRESS_MAP_END + + +READ8_MEMBER( brno_state::mmu_r ) +{ + return 0; +} + + +WRITE8_MEMBER( brno_state::mmu_w ) +{ + + m_ramcpu = m_maincpu->state_int(Z80_B); + m_rambank = ~data; //m_maincpu->state_int(Z80_A); + m_rammap[m_ramcpu >> 4]=m_rambank; + + + switch (m_ramcpu>>4) + { + case 0: membank("bank1")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 1: membank("bank2")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 2: membank("bank3")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 3: membank("bank4")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 4: membank("bank5")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 5: membank("bank6")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 6: membank("bank7")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 7: if (!m_romen) membank("bank8")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 8: membank("bank9")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 9: membank("bank10")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 10: membank("bank11")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 11: membank("bank12")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 12: membank("bank13")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 13: membank("bank14")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 14: membank("bank15")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + case 15: membank("bank16")->set_base(memregion(RAMDISK)->base()+(m_rambank << 12));break; + } + + //logerror("RAMdisk page change(CPURAM<=BANK): &%02X00<=%02X at address &%04X\n",m_ramcpu,m_rambank,m_maincpu->state_int(Z80_PC)-2); + + +} + +READ8_MEMBER( brno_state::ramsel_r ) +{ + return m_ramen; +} + + +WRITE8_MEMBER( brno_state::ramsel_w ) //out 6b +{ + //address_space &program = m_maincpu->space(AS_PROGRAM); + + if (!data) + m_ramen=true; + else + m_ramen=false; + + logerror("CASEN change: out (&6b),%x\n",data); +} + +READ8_MEMBER( brno_state::romsel_r ) +{ + return m_romen; +} + +WRITE8_MEMBER( brno_state::romsel_w ) //out 6c { address_space &program = m_maincpu->space(AS_PROGRAM); - // configure RAM - switch (m_ram->size()) + if (!data) { - case 4*1024: - program.unmap_readwrite(0x8000, 0xffff); - break; + program.install_rom(0x0000, 0x6fff, memregion(Z80_TAG)->base()); + program.unmap_write(0x0000, 0x6fff); + m_romen=true; + } - case 36*1024: - break; + else + { + program.install_readwrite_bank(0x0000, 0x0fff, "bank1"); + program.install_readwrite_bank(0x1000, 0x1fff, "bank2"); + program.install_readwrite_bank(0x2000, 0x2fff, "bank3"); + program.install_readwrite_bank(0x3000, 0x3fff, "bank4"); + program.install_readwrite_bank(0x4000, 0x4fff, "bank5"); + program.install_readwrite_bank(0x5000, 0x5fff, "bank6"); + program.install_readwrite_bank(0x6000, 0x6fff, "bank7"); + + m_romen=false; + } + + logerror("RAMEN change: out (&6c),%x\n",data); +} + + +//------------------------------------------------- +// FD port 7c - Floppy select +//------------------------------------------------- - case 68*1024: - break; +READ8_MEMBER( brno_state::fd_r ) +{ + return 0; +} + + +WRITE8_MEMBER( brno_state::fd_w ) +{ + floppy_image_device *floppy; + m_floppy = NULL; + int disk = 0; + + + floppy = m_floppy0->get_device(); + if (floppy) + { + if(BIT(data,0)) + { + m_floppy= floppy; + disk=1; + } + else + { + floppy->mon_w(1); + } } + floppy = m_floppy1->get_device(); + if (floppy) + { + if(BIT(data,1)) + { + m_floppy= floppy; + disk=2; + } + else + { + floppy->mon_w(1); + } + } + + m_fdc->set_floppy(m_floppy); + if (m_floppy) + { + m_floppy->set_rpm(300); + m_floppy->mon_w(0); + logerror("Select floppy %d\n", disk); + } + +} - if (m_cart->exists()) - program.install_read_handler(0x2000, 0x6fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + +FLOPPY_FORMATS_MEMBER( brno_state::floppy_formats ) + FLOPPY_DSK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( brno_floppies ) + SLOT_INTERFACE("35hd", FLOPPY_35_DD) +SLOT_INTERFACE_END + + +//------------------------------------------------- +// SNAPSHOT LOADER - BRNO +//------------------------------------------------- + +SNAPSHOT_LOAD_MEMBER( brno_state, brno ) +{ + + + UINT8* rmd = memregion(RAMDISK)->base(); + + + popmessage("Loading file %s\r\n", image.filename()); + //image.message(" aaaaa:%s",image.basename_noext()); + + + + if (strcmp(image.basename_noext(), "ramdump") == 0) + { + logerror("Dumping ramdisk to file.\r\n"); + } + + if (strcmp(image.filetype(), "rmd") == 0) + { + + + image.fread( rmd+0x10000, snapshot_size-0x10000); + + + // image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Not a Z1013 image"); + // image.message(" Not a Z1013 image"); + } + else + return IMAGE_INIT_FAIL; + + + + return IMAGE_INIT_PASS; +} + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( m5 ) +//------------------------------------------------- +void m5_state::machine_start() +{ // register for state saving save_item(NAME(m_fd5_data)); save_item(NAME(m_fd5_com)); save_item(NAME(m_intra)); save_item(NAME(m_ibfa)); save_item(NAME(m_obfa)); + } - void m5_state::machine_reset() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + std::string region_tag; + + //is ram/rom cart plugged in? + if (m_cart1->exists()) + if (m_cart1->get_type() > 0) + m_cart_ram=m_cart1; + else + m_cart=m_cart1; + if (m_cart2->exists()) + if (m_cart2->get_type() > 0) + m_cart_ram=m_cart2; + else + m_cart=m_cart2; + + // no cart inserted - there is nothing to do - not allowed in original Sord m5 + if (m_cart_ram == NULL && m_cart == NULL) + { + membank("bank1r")->set_base(memregion(Z80_TAG)->base()); + program.unmap_write(0x0000, 0x1fff); + // program.unmap_readwrite(0x2000, 0x6fff); //if you uncomment this line Sord starts cassete loading but it is not correct on real hw + program.unmap_readwrite(0x8000, 0xffff); + return; + } + + //cart is ram module + if (m_cart_ram->exists()) + { + m_ram_type=m_cart_ram->get_type(); + + m_cart_rom = memregion(region_tag.assign(m_cart_ram->tag()).append(M5SLOT_ROM_REGION_TAG).c_str()); + memory_region *ram_region=memregion(region_tag.assign(m_cart_ram->tag()).append(":ram").c_str()); + + switch (m_ram_type) + { + case EM_5: + program.install_readwrite_handler(0x8000, 0xffff, read8_delegate(FUNC(m5_cart_slot_device::read_ram),(m5_cart_slot_device*)m_cart_ram), write8_delegate(FUNC(m5_cart_slot_device::write_ram),(m5_cart_slot_device*)m_cart_ram)); + if (m_cart) + { + program.install_read_handler(0x2000, 0x6fff, read8_delegate(FUNC(m5_cart_slot_device::read_rom),(m5_cart_slot_device*)m_cart)); + program.unmap_write(0x2000, 0x6fff); + } + break; + case MEM64KBI: + program.install_rom(0x0000, 0x1fff, memregion(Z80_TAG)->base()); + program.unmap_write(0x0000, 0x1fff); + program.install_ram(0x8000, 0xffff, ram_region->base()+0x8000); + + //if AUTOSTART is on then page out cart and start tape loading + if (m_cart && ((m_DIPS->read() & 2) != 2)) + { + program.install_read_handler(0x2000, 0x3fff, read8_delegate(FUNC(m5_cart_slot_device::read_rom),(m5_cart_slot_device*)m_cart)); + program.unmap_write(0x2000, 0x3fff); + } + else + program.unmap_readwrite(0x2000, 0x6fff); //monitor rom is testing this area for 0xFFs otherwise thinks there is some ROM cart plugged in + + break; + case MEM64KBF: + program.unmap_write(0x0000, 0x6fff); + membank("bank1r")->set_base(memregion(Z80_TAG)->base()); + membank("bank2r")->set_base(m_cart_rom->base()); + membank("bank3r")->set_base(m_cart_rom->base()+0x2000); + membank("bank4r")->set_base(m_cart_rom->base()+0x4000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + break; + case MEM64KRX: + membank("bank1r")->set_base(memregion(Z80_TAG)->base()); membank("bank1w")->set_base(ram_region->base()); + membank("bank2r")->set_base(m_cart_rom->base()); membank("bank2w")->set_base(ram_region->base()+0x2000); + membank("bank3r")->set_base(m_cart_rom->base()+0x2000); membank("bank3w")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(ram_region->base()+0x6000); membank("bank4w")->set_base(ram_region->base()+0x6000); + + //page in BASIC or MSX + if ((m_DIPS->read() & 0x01)) + { + membank("bank5r")->set_base(m_cart_rom->base()+0x6000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(m_cart_rom->base()+0xa000); membank("bank6w")->set_base(ram_region->base()+0xc000); + } + else + { + membank("bank5r")->set_base(m_cart_rom->base()+0xe000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(m_cart_rom->base()+0x12000); membank("bank6w")->set_base(ram_region->base()+0xc000); + } + break; + default: + program.unmap_readwrite(0x8000, 0xffff); + } + //I don't have idea what to do with savestates, please someone take care of it + //m_cart_ram->save_ram(); + } + + m_ram_mode=0; +} + + + +void brno_state::machine_start() { } +void brno_state::machine_reset() +{ + /* enable ROM1+ROM2 */ + address_space &program = m_maincpu->space(AS_PROGRAM); + + program.install_rom(0x0000, 0x5fff, memregion(Z80_TAG)->base()); + program.unmap_write(0x0000, 0x5fff); + + //is ram/rom cart plugged in? + if (m_cart1->exists()) + if (m_cart1->get_type() > 0) + m_cart_ram=m_cart1; + else + m_cart=m_cart1; + if (m_cart2->exists()) + if (m_cart2->get_type() > 0) + m_cart_ram=m_cart2; + else + m_cart=m_cart2; + + + if (m_cart) + { + program.install_read_handler(0x2000, 0x5fff, read8_delegate(FUNC(m5_cart_slot_device::read_rom),(m5_cart_slot_device*)m_cart)); + program.unmap_write(0x2000, 0x5fff); + } + + m_romen=true; + m_ramen=false; +} //************************************************************************** // MACHINE CONFIGURATION @@ -619,18 +1449,18 @@ static MACHINE_CONFIG_START( m5, m5_state ) MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", m5_floppies, "525dd", m5_state::floppy_formats) // cartridge - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "m5_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - //MCFG_GENERIC_MANDATORY + MCFG_M5_CARTRIDGE_ADD("cartslot1", m5_cart, NULL) + MCFG_M5_CARTRIDGE_ADD("cartslot2", m5_cart, NULL) // software lists MCFG_SOFTWARE_LIST_ADD("cart_list", "m5_cart") MCFG_SOFTWARE_LIST_ADD("cass_list", "m5_cass") + //MCFG_SOFTWARE_LIST_ADD("flop_list", "m5_flop") // internal ram MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("4K") - MCFG_RAM_EXTRA_OPTIONS("36K,68K") + MCFG_RAM_EXTRA_OPTIONS("36K,64K") //68K is not possible, 'cos internal ram always overlays any expansion memory in that area MACHINE_CONFIG_END @@ -661,6 +1491,48 @@ static MACHINE_CONFIG_DERIVED( pal, m5 ) MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) MACHINE_CONFIG_END +//------------------------------------------------- +// MACHINE_CONFIG( m5p_brno ) +//------------------------------------------------- + + +static MACHINE_CONFIG_DERIVED_CLASS( brno, m5, brno_state ) + + // basic machine hardware + MCFG_CPU_MODIFY(Z80_TAG) + MCFG_CPU_PROGRAM_MAP(m5_mem_brno) + MCFG_CPU_IO_MAP(brno_io) +// MCFG_CPU_CONFIG(m5_daisy_chain) + + + //remove devices used for fd5 floppy + MCFG_DEVICE_REMOVE(Z80_FD5_TAG) + MCFG_DEVICE_REMOVE(I8255A_TAG) + MCFG_DEVICE_REMOVE(UPD765_TAG) + + // video hardware + MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(m5_state, sordm5_video_interrupt_callback)) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) + + + // floppy + MCFG_WD2797_ADD(WD2797_TAG, XTAL_1MHz) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG":0", brno_floppies, "35hd", brno_state::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG":1", brno_floppies, "35hd", brno_state::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + // only one floppy drive + //MCFG_DEVICE_REMOVE(WD2797_TAG":1") + + MCFG_SNAPSHOT_ADD("snapshot", brno_state, brno, "rmd", 0) + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list","m5_flop") + +MACHINE_CONFIG_END //************************************************************************** @@ -692,7 +1564,21 @@ ROM_START( m5p ) ROM_LOAD( "sordfd5.rom", 0x0000, 0x4000, CRC(7263bbc5) SHA1(b729500d3d2b2e807d384d44b76ea5ad23996f4a)) ROM_END +//------------------------------------------------- +// ROM( brno ) +//------------------------------------------------- + +ROM_START( m5p_brno ) + ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASEFF ) + ROM_LOAD( "sordint.ic21", 0x0000, 0x2000, CRC(78848d39) SHA1(ac042c4ae8272ad6abe09ae83492ef9a0026d0b2)) // monitor rom + //ROM_LOAD( "brno_rom1.rom", 0x2000, 0x2000, CRC(f4cfb2ee) SHA1(23f41d2d9ac915545409dd0163f3dc298f04eea2)) //windows + //ROM_LOAD( "brno_rom12.rom", 0x2000, 0x4000, CRC(cac52406) SHA1(91f6ba97e85a2b3a317689635d425ee97413bbe3)) //windows+BI + ROM_LOAD( "brno_boot.rom", 0x2000, 0xd80, CRC(60008729) SHA1(FB26E2AE9F74B0AE0D723B417A038A8EF3D72782)) + //Ramdisc area (maximum is 1024kB 256x 4kB banks) + ROM_REGION(1024*1024,RAMDISK,0) + ROM_FILL(0,1024*1024,0xff) +ROM_END //************************************************************************** // DRIVER INITIALIZATION @@ -715,6 +1601,14 @@ DRIVER_INIT_MEMBER(m5_state,pal) { } +//------------------------------------------------- +// ROM( BRNO ) +//------------------------------------------------- + +DRIVER_INIT_MEMBER(brno_state,brno) +{ +// logerror("Driver init entered\n" ); +} //************************************************************************** @@ -724,3 +1618,4 @@ DRIVER_INIT_MEMBER(m5_state,pal) // YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS COMP( 1983, m5, 0, 0, ntsc, m5, m5_state, ntsc, "Sord", "m.5 (Japan)", 0 ) COMP( 1983, m5p, m5, 0, pal, m5, m5_state, pal, "Sord", "m.5 (Europe)", 0 ) +COMP( 1983, m5p_brno, m5, 0, brno, m5, brno_state, brno, "Sord", "m.5 (Europe) BRNO mod", 0 ) diff --git a/src/mame/includes/m5.h b/src/mame/includes/m5.h index 7ba55be8172..b338985cd2c 100644 --- a/src/mame/includes/m5.h +++ b/src/mame/includes/m5.h @@ -1,9 +1,12 @@ // license:BSD-3-Clause -// copyright-holders:Curt Coder +// copyright-holders:Curt Coder, Ales Dlabac #ifndef __M5__ #define __M5__ + #include "machine/z80ctc.h" +#include "imagedev/snapquik.h" + #define Z80_TAG "ic17" #define Z80CTC_TAG "ic19" @@ -15,6 +18,10 @@ #define UPD765_TAG "upd765" #define CENTRONICS_TAG "centronics" #define SCREEN_TAG "screen" +//brno mod +#define WD2797_TAG "5f" +#define RAMDISK "ramdisk" + class m5_state : public driver_device { @@ -22,36 +29,40 @@ public: m5_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, Z80_TAG), - m_fd5cpu(*this, Z80_FD5_TAG), m_ctc(*this, Z80CTC_TAG), + m_fd5cpu(*this, Z80_FD5_TAG), m_ppi(*this, I8255A_TAG), m_fdc(*this, UPD765_TAG), + m_floppy0(*this, UPD765_TAG ":0:525dd"), m_cassette(*this, "cassette"), - m_cart(*this, "cartslot"), + m_cart1(*this, "cartslot1"), + m_cart2(*this, "cartslot2"), m_centronics(*this, CENTRONICS_TAG), m_ram(*this, RAM_TAG), - m_floppy0(*this, UPD765_TAG ":0:525dd"), - m_reset(*this, "RESET") + m_reset(*this, "RESET"), + m_DIPS(*this, "DIPS") { } required_device m_maincpu; - required_device m_fd5cpu; required_device m_ctc; - required_device m_ppi; - required_device m_fdc; + //I've changed following devices to optional since we have to remove them in BRNO mod (I don't know better solution) + optional_device m_fd5cpu; + optional_device m_ppi; + optional_device m_fdc; + optional_device m_floppy0; required_device m_cassette; - required_device m_cart; + optional_device m_cart1; + optional_device m_cart2; required_device m_centronics; required_device m_ram; - required_device m_floppy0; required_ioport m_reset; + optional_ioport m_DIPS; - virtual void machine_start() override; - virtual void machine_reset() override; + virtual void machine_start(); + virtual void machine_reset(); DECLARE_READ8_MEMBER( sts_r ); DECLARE_WRITE8_MEMBER( com_w ); - DECLARE_READ8_MEMBER( ppi_pa_r ); DECLARE_WRITE8_MEMBER( ppi_pa_w ); DECLARE_WRITE8_MEMBER( ppi_pb_w ); @@ -65,23 +76,90 @@ public: DECLARE_WRITE8_MEMBER( fd5_ctrl_w ); DECLARE_WRITE8_MEMBER( fd5_tc_w ); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + // video state // const TMS9928a_interface *m_vdp_intf; int m_centronics_busy; DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - // floppy state + DECLARE_DRIVER_INIT(pal); + DECLARE_DRIVER_INIT(ntsc); + DECLARE_WRITE_LINE_MEMBER(sordm5_video_interrupt_callback); + + // memory + DECLARE_READ8_MEMBER( mem64KBI_r ); + DECLARE_WRITE8_MEMBER( mem64KBI_w ); + DECLARE_WRITE8_MEMBER( mem64KBF_w ); + DECLARE_WRITE8_MEMBER( mem64KRX_w ); + UINT8 m_ram_mode; + UINT8 m_ram_type; + memory_region *m_cart_rom; + m5_cart_slot_device *m_cart_ram, *m_cart; + + // floppy state for fd5 UINT8 m_fd5_data; UINT8 m_fd5_com; int m_intra; int m_ibfa; int m_obfa; - DECLARE_DRIVER_INIT(pal); - DECLARE_DRIVER_INIT(ntsc); - DECLARE_WRITE_LINE_MEMBER(sordm5_video_interrupt_callback); +}; + + +class brno_state : public m5_state +{ +public: + brno_state(const machine_config &mconfig, device_type type, const char *tag) + : m5_state(mconfig, type, tag), + + m_fdc(*this, WD2797_TAG), + m_floppy0(*this, WD2797_TAG":0"), + m_floppy1(*this, WD2797_TAG":1") + // m_ramdisk(*this, RAMDISK) + { } + + + required_device m_fdc; + required_device m_floppy0; + optional_device m_floppy1; + floppy_image_device *m_floppy; + + + + DECLARE_READ8_MEMBER( mmu_r ); + DECLARE_WRITE8_MEMBER( mmu_w ); + DECLARE_READ8_MEMBER( ramsel_r ); + DECLARE_WRITE8_MEMBER(ramsel_w ); + DECLARE_READ8_MEMBER( romsel_r ); + DECLARE_WRITE8_MEMBER(romsel_w ); + + DECLARE_READ8_MEMBER( fd_r ); + DECLARE_WRITE8_MEMBER( fd_w ); DECLARE_FLOPPY_FORMATS( floppy_formats ); + + +// DECLARE_WRITE_LINE_MEMBER( wd2797_intrq_w ); +// DECLARE_WRITE_LINE_MEMBER( wd2797_drq_w ); +// DECLARE_WRITE_LINE_MEMBER( wd2797_index_callback); + + //required_device m_ramdisk; + DECLARE_DRIVER_INIT(brno); + DECLARE_SNAPSHOT_LOAD_MEMBER( brno ); +// DECLARE_DEVICE_IMAGE_LOAD_MEMBER(m5_cart); + + + virtual void machine_start(); + virtual void machine_reset(); + + UINT8 m_rambank; // bank # + UINT8 m_ramcpu; //where Ramdisk bank is mapped + bool m_romen; + bool m_ramen; + + + UINT8 m_rammap[16]; // memory map }; #endif diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 459fae8a81f..8dc5fab0589 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -1153,6 +1153,7 @@ jupace // Jupiter Ace // Sord m5 m5p +m5p_brno // APF Electronics Inc. apfm1000 -- cgit v1.2.3-70-g09d2 From efa5b5c4efcbc7083262e785f584f0c3fc0736f4 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Sun, 7 Feb 2016 17:36:13 -0500 Subject: Add New Skeleton Driver: Xerox Notetaker [Lord Nightmare, bitsavers] New Skeleton Driver Added ------------------------------------------------- Xerox Notetaker --- scripts/target/mame/mess.lua | 1 + src/mame/drivers/notetaker.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++ src/mame/mame.lst | 2 +- src/mame/mess.lst | 1 + 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/mame/drivers/notetaker.cpp diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index f89b2b0557e..b137fc7cb1a 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -3129,6 +3129,7 @@ files { MAME_DIR .. "src/mame/drivers/mx2178.cpp", MAME_DIR .. "src/mame/drivers/mycom.cpp", MAME_DIR .. "src/mame/drivers/myvision.cpp", + MAME_DIR .. "src/mame/drivers/notetaker.cpp", MAME_DIR .. "src/mame/drivers/ngen.cpp", MAME_DIR .. "src/mame/machine/ngen_kb.cpp", MAME_DIR .. "src/mame/machine/ngen_kb.h", diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp new file mode 100644 index 00000000000..79b412f64ed --- /dev/null +++ b/src/mame/drivers/notetaker.cpp @@ -0,0 +1,66 @@ +/* Xerox Notetaker + * Driver by Jonathan Gevaryahu + * prototype only, one? unit manufactured + * This device was the origin of Smalltalk-78 + * NO MEDIA for this device has survived, only a ram dump + * see http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker + * + * MISSING DUMP for 8741 I/O MCU +*/ + +#include "cpu/i86/i86.h" + +class notetaker_state : public driver_device +{ +public: + notetaker_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") + { + } +// devices + required_device m_maincpu; + +//declarations + +//variables + +}; + +static ADDRESS_MAP_START(notetaker_mem, AS_PROGRAM, 16, notetaker_state) + AM_RANGE(0x00000, 0x01fff) AM_RAM + AM_RANGE(0xff000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(notetaker_io, AS_IO, 16, notetaker_state) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( notetakr ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( notetakr, notetaker_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, XTAL_14_7456MHz/3) /* unknown crystal and divider */ + MCFG_CPU_PROGRAM_MAP(notetaker_mem) + MCFG_CPU_IO_MAP(notetaker_io) + + /* video hardware */ + //MCFG_DEFAULT_LAYOUT(layout_notetaker) + + /* Devices */ + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( notetakr ) + ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) + ROMX_LOAD( "NTIOLO_EPROM.BIN", 0xff000, 0x0800, CRC(b72aa4c7) SHA1(85dab2399f906c7695dc92e7c18f32e2303c5892), ROM_SKIP(1)) + ROMX_LOAD( "NTIOHI_EPROM.BIN", 0xff001, 0x0800, CRC(1119691d) SHA1(4c20b595b554e6f5489ab2c3fb364b4a052f05e3), ROM_SKIP(1)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, notetakr, 0, 0, notetakr, notetakr, driver_device, 0, "Xerox", "Notetaker", MACHINE_IS_SKELETON) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index b4737de8fa8..edf48cd75d1 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -2,7 +2,7 @@ // copyright-holders:Aaron Giles /****************************************************************************** - ume.lst + mame.lst List of all enabled drivers in the system. This file is parsed by makelist.exe, sorted, and output as C code describing the drivers. diff --git a/src/mame/mess.lst b/src/mame/mess.lst index a13d6f81c9b..38dcc5d9234 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2454,6 +2454,7 @@ vcs80 v1050 x820 x820ii +notetakr x168 xor100 iq151 -- cgit v1.2.3-70-g09d2 From 120818e45378198656c325f704eff46b158973e1 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Sun, 7 Feb 2016 19:47:14 -0300 Subject: Mystery Number: Corrected release year and manufacturer. --- src/mame/drivers/itgamble.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/itgamble.cpp b/src/mame/drivers/itgamble.cpp index 8c9cf972924..c4caaa27b74 100644 --- a/src/mame/drivers/itgamble.cpp +++ b/src/mame/drivers/itgamble.cpp @@ -713,4 +713,4 @@ GAME( 200?, abacus, 0, itgamble, itgamble, driver_device, 0, ROT0, "", "Book Theatre (Ver 1.2)", MACHINE_IS_SKELETON ) /* different hardware */ -GAME( 200?, mnumber, 0, mnumber, itgamble, driver_device, 0, ROT0, "M.M. - B.R.L.", "Mystery Number", MACHINE_IS_SKELETON ) +GAME( 2000, mnumber, 0, mnumber, itgamble, driver_device, 0, ROT0, "MM / BRL Bologna", "Mystery Number", MACHINE_IS_SKELETON ) -- cgit v1.2.3-70-g09d2 From ade11fd0f496c4e0818925942cd311e1f6060cd0 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Sun, 7 Feb 2016 19:51:45 -0300 Subject: Nibble driver: Added more specs... --- src/mame/drivers/nibble.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/nibble.cpp b/src/mame/drivers/nibble.cpp index edb798c94e5..f89a14f0f38 100644 --- a/src/mame/drivers/nibble.cpp +++ b/src/mame/drivers/nibble.cpp @@ -32,6 +32,7 @@ 2x XTAL - 11.98135 KDS9C 2x 8 DIP switches banks. 1x 3.6V lithium battery. + 1x Reset push button. ************************************************************************** @@ -137,7 +138,6 @@ void nibble_state::machine_start() { } - void nibble_state::machine_reset() { } @@ -148,7 +148,7 @@ void nibble_state::machine_reset() *************************/ static ADDRESS_MAP_START( nibble_map, AS_PROGRAM, 8, nibble_state ) - ADDRESS_MAP_GLOBAL_MASK(0x3fff) +// ADDRESS_MAP_GLOBAL_MASK(0x3fff) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xc3ff) AM_WRITE(nibble_videoram_w) AM_SHARE("videoram") // placeholder // AM_RANGE(0xff00, 0xff01) AM_DEVWRITE("crtc", mc6845_device, address_w) -- cgit v1.2.3-70-g09d2 From 189306db372fd00e6676fa1507092f8460b1f04f Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Sun, 7 Feb 2016 17:53:58 -0500 Subject: forgot copyright header (nw) --- src/mame/drivers/notetaker.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index 79b412f64ed..08cf3d588f0 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -1,3 +1,5 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu /* Xerox Notetaker * Driver by Jonathan Gevaryahu * prototype only, one? unit manufactured -- cgit v1.2.3-70-g09d2 From 7a4e38987f2298711093459356aa475fdb5923d7 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Mon, 8 Feb 2016 10:35:40 +1100 Subject: ui: fixed text in custom colours setup screen --- src/emu/ui/custui.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index fb1459837ab..355f486918a 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -479,21 +479,21 @@ void ui_menu_colors_ui::handle() void ui_menu_colors_ui::populate() { item_append("Normal text", nullptr, 0, (void *)(FPTR)MUI_TEXT_COLOR); - item_append("Selected m_color", nullptr, 0, (void *)(FPTR)MUI_SELECTED_COLOR); + item_append("Selected color", nullptr, 0, (void *)(FPTR)MUI_SELECTED_COLOR); item_append("Normal text background", nullptr, 0, (void *)(FPTR)MUI_TEXT_BG_COLOR); - item_append("Selected background m_color", nullptr, 0, (void *)(FPTR)MUI_SELECTED_BG_COLOR); - item_append("Subitem m_color", nullptr, 0, (void *)(FPTR)MUI_SUBITEM_COLOR); + item_append("Selected background color", nullptr, 0, (void *)(FPTR)MUI_SELECTED_BG_COLOR); + item_append("Subitem color", nullptr, 0, (void *)(FPTR)MUI_SUBITEM_COLOR); item_append("Clone", nullptr, 0, (void *)(FPTR)MUI_CLONE_COLOR); item_append("Border", nullptr, 0, (void *)(FPTR)MUI_BORDER_COLOR); item_append("Background", nullptr, 0, (void *)(FPTR)MUI_BACKGROUND_COLOR); item_append("Dipswitch", nullptr, 0, (void *)(FPTR)MUI_DIPSW_COLOR); - item_append("Unavailable m_color", nullptr, 0, (void *)(FPTR)MUI_UNAVAILABLE_COLOR); - item_append("Slider m_color", nullptr, 0, (void *)(FPTR)MUI_SLIDER_COLOR); + item_append("Unavailable color", nullptr, 0, (void *)(FPTR)MUI_UNAVAILABLE_COLOR); + item_append("Slider color", nullptr, 0, (void *)(FPTR)MUI_SLIDER_COLOR); item_append("Gfx viewer background", nullptr, 0, (void *)(FPTR)MUI_GFXVIEWER_BG_COLOR); - item_append("Mouse over m_color", nullptr, 0, (void *)(FPTR)MUI_MOUSEOVER_COLOR); - item_append("Mouse over background m_color", nullptr, 0, (void *)(FPTR)MUI_MOUSEOVER_BG_COLOR); - item_append("Mouse down m_color", nullptr, 0, (void *)(FPTR)MUI_MOUSEDOWN_COLOR); - item_append("Mouse down background m_color", nullptr, 0, (void *)(FPTR)MUI_MOUSEDOWN_BG_COLOR); + item_append("Mouse over color", nullptr, 0, (void *)(FPTR)MUI_MOUSEOVER_COLOR); + item_append("Mouse over background color", nullptr, 0, (void *)(FPTR)MUI_MOUSEOVER_BG_COLOR); + item_append("Mouse down color", nullptr, 0, (void *)(FPTR)MUI_MOUSEDOWN_COLOR); + item_append("Mouse down background color", nullptr, 0, (void *)(FPTR)MUI_MOUSEDOWN_BG_COLOR); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); item_append("Restore originals colors", nullptr, 0, (void *)(FPTR)MUI_RESTORE); @@ -540,7 +540,7 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom // bottom text // get the text for 'UI Select' std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)); - topbuf.assign("Double click or press ").append(ui_select_text.c_str()).append(" to change the m_color value"); + topbuf.assign("Double click or press ").append(ui_select_text.c_str()).append(" to change the color value"); mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); -- cgit v1.2.3-70-g09d2 From 9a3e057bd615c27f8f07112994ba9d3427718364 Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Sun, 7 Feb 2016 22:39:22 +0000 Subject: atom: fdc callbacks on connected devices only (nw) --- src/mame/drivers/atom.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/atom.cpp b/src/mame/drivers/atom.cpp index 6952735fb9e..6e8cb6e473f 100644 --- a/src/mame/drivers/atom.cpp +++ b/src/mame/drivers/atom.cpp @@ -602,8 +602,14 @@ WRITE_LINE_MEMBER( atom_state::atom_8271_interrupt_callback ) WRITE_LINE_MEMBER( atom_state::motor_w ) { - m_fdc->subdevice("0")->get_device()->mon_w(!state); - m_fdc->subdevice("1")->get_device()->mon_w(!state); + for (int i=0; i != 2; i++) { + char devname[1]; + sprintf(devname, "%d", i); + floppy_connector *con = m_fdc->subdevice(devname); + if (con) { + con->get_device()->mon_w(!state); + } + } } TIMER_DEVICE_CALLBACK_MEMBER(atom_state::cassette_output_tick) -- cgit v1.2.3-70-g09d2 From 7816f4d0a55ef29b051d0cdce4a269b4dda165d7 Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Mon, 8 Feb 2016 00:20:07 +0000 Subject: electron: added cassette softlist and implemented BREAK key --- hash/electron_cass.xml | 10418 ++++++++++++++++++++++++++++++++++++++++ src/mame/drivers/electron.cpp | 37 +- src/mame/includes/electron.h | 15 +- src/mame/machine/electron.cpp | 12 +- 4 files changed, 10455 insertions(+), 27 deletions(-) create mode 100644 hash/electron_cass.xml diff --git a/hash/electron_cass.xml b/hash/electron_cass.xml new file mode 100644 index 00000000000..1ce422fddd5 --- /dev/null +++ b/hash/electron_cass.xml @@ -0,0 +1,10418 @@ + + + + + + + + + + + + + + + + + 3D Bomb Alley + 198? + Software Invasion + + + + + + + + + 3D Dotty + 1987 + Blue Ribbon + + + + + + + + + 3D Dotty (Play It Again Sam 10) + 1989 + Superior Software/Acornsoft + + + + + + + + + 3D Maze + 1983 + I.J.K. + + + + + + + + + 3D Pool + 1989 + Firebird + + + + + + + + + 3D Tank Zone + 1983 + Dynabyte + + + + + + + + + Five Stones of Anadon + 1983 + Softek + + + + + + + + + 747 Flight Simulator + 1984 + DACC + + + + + + + + + 747 + 1984 + Doctor Soft + + + + + + + + + A Question of Sport + 198? + Superior Software/Acornsoft + + + + + + + + + A Vous La France! + 198? + BBC Soft + + + + + + + + + Abyss + 1984 + CCS + + + + + + + + + Acorn User Issue 42 (Jan 1986) + 1986 + Acorn User + + + + + + + + + Acorn User Issue 48 (Jul 1986) + 1986 + Acorn User + + + + + + + + + Acorn User Issue 50 (Sep 1986) + 1986 + Acorn User + + + + + + + + + Acorn User Issue 52 (Nov 1986) + 1986 + Acorn User + + + + + + + + + Acorn User Issue 53 (Dec 1986) + 1986 + Acorn User + + + + + + + + + Acorn User Issue 54 (Jan 1987) + 1987 + Acorn User + + + + + + + + + Acorn User Issue 55 (Feb 1987) + 1987 + Acorn User + + + + + + + + + Acorn User Issue 56 (Mar 1987) + 1987 + Acorn User + + + + + + + + + Acorn User Issue 57 (Apr 1987) + 1987 + Acorn User + + + + + + + + + Acorn User Issue 58 (May 1987) + 1987 + Acorn User + + + + + + + + + Acorn User Issue 59 (Jun 1987) + 1987 + Acorn User + + + + + + + + + Acorn User Issue 60 (Jul 1987) + 1987 + Acorn User + + + + + + + + + Adventure 4 Pack + 1987 + Potter + + + + + + + + + + + + + + + + + + + + + + + + + + + + Adventure Anthology + 198? + Database + + + + + + + + + Adventureland + 198? + Adventure International + + + + + + + + + Adventure + 1984 + Micro Power + + + + + + + + + Airline + 1983 + CCS + + + + + + + + + Alien Break In + 1983 + Romik + + + + + + + + + Alien Dropout + 1984 + Superior Software + + + + + + + + + Alphatron + 1984 + Tynesoft + + + + + + + + + American Suds + 1986 + Riverdale + + + + + + + + + + + + + + + + + + + + + + + + + + + + Anarchy Zone + 1988 + Atlantis + + + + + + + + + Angles + 198? + Garland Computing + + + + + + + + + Annabel Gray + 19?? + Lee + + + + + + + + + + + + + + + + Answer Back - General Knowledge Junior Quiz + 1984 + Kosmos + + + + + + + + + Answer Back - General Knowledge Senior Quiz + 1984 + Kosmos + + + + + + + + + Answer Back - Sports Quiz + 1984 + Kosmos + + + + + + + + + Arcade Game Creator + 198? + Database + + + + + + + + + Arcade Soccer + 1989 + 4th Dimension + + + + + + + + + Arcadians (Ger) + 1984 + Acornsoft + + + + + + + + + + Arcadians (The Acornsoft Hits Vol.2) + 1987 + Superior Software/Acornsoft + + + + + + + + + Arcadians + 1984 + Acornsoft + + + + + + + + + + Arena 3000 + 198? + Microdeal + + + + + + + + + Repton Around the World in 40 Screens + 1987 + Superior Software/Acornsoft + + + + + + + + + Arrow of Death Part 1 + 198? + Adventure International + + + + + + + + + Arrow of Death Part 2 + 198? + Adventure International + + + + + + + + + Assembly Language Course + 198? + Honeyfold + + + + + + + + + Astro Plumber + 1985 + Blue Ribbon + + + + + + + + + Atom Smasher + 1983 + Romik + + + + + + + + + Auf Wiedersehen Pet + 1984 + Tynesoft + + + + + + + + + Ballistix + 1989 + Superior Software/Acornsoft + + + + + + + + + Balloon Buster + 1989 + Blue Ribbon + + + + + + + + + Bandits at 3 O'clock + 1984 + Micro Power + + + + + + + + + Bar Billiards + 1987 + Blue Ribbon + + + + + + + + + Barbarian + 1988 + Superior Software/Acornsoft + + + + + + + + + Barbarian 2 + 1989 + Superior Software/Acornsoft + + + + + + + + + Baron + 1989 + Superior Software/Acornsoft + + + + + + + + + Battle 1917 + 1983 + CCS + + + + + + + + + Battlefields + 1985 + BBC Soft + + + + + + + + + Battlezone 2000 + 1983 + Lothlorien + + + + + + + + + Battlezone Six + 198? + Kansas + + + + + + + + + Baum der Weisheit (Ger) + 1983 + Acornsoft + + + + + + + + + + BBC Mastermind Quizmaster + 1984 + Mirrorsoft-Ivan Berg + + + + + + + + + Beach Head (Americana) + 198? + Americana + + + + + + + + + Beach Head + 1984 + U.S. Gold + + + + + + + + + Beebtrek + 1984 + Software For All + + + + + + + + + Bert Boot + 1984 + Highlight Software + + + + + + + + + Best of Acorn User + 198? + Acorn User + + + + + + + + + Best of PCW Software + 198? + PCW + + + + + + + + + The Best Four: Language + 1985 + ASK + + + + + + + + + + + + + + + + + + + + + + + + + + + + Biology + 1983 + Acornsoft/Ivan Berg + + + + + + + + + Birdie Barrage + 1984 + CDS + + + + + + + + + Birds of Prey + 1983 + Romik + + + + + + + + + Birdstrike + 198? + Firebird + + + + + + + + + Blagger + 198? + Alligata + + + + + + + + + Blagger (Play It Again Sam 12) + 1990 + Superior Software/Acornsoft + + + + + + + + + Blitzkrieg + 1984 + Software Invasion + + + + + + + + + Blockbusters Gold Run + 1985 + Macsen + + + + + + + + + Blockbusters + 1985 + Macsen + + + + + + + + + Blood of the Mutineers + 1988 + Robico + + + + + + + + + Blue Dragon + 1984 + MP Software + + + + + + + + + + Bobby Charlton Soccer + 1985 + DACC + + + + + + + + + Boffin + 1985 + Addictive + + + + + + + + + Bomber Baron + 198? + Optyx + + + + + + + + + Bone Cruncher + 1987 + Superior Software/Acornsoft + + + + + + + + + Boulder Dash + 1988 + Tynesoft + + + + + + + + + Bouncing Bombs + 198? + Tynesoft + + + + + + + + + Boxer + 1984 + Acornsoft + + + + + + + + + + Bozo the Brave + 1985 + Tynesoft + + + + + + + + + Braz + 1987 + Livewire + + + + + + + + + Breakthrough + 1990 + Audiogenic + + + + + + + + + + Brian Cloughs Football Fortunes + 1987 + CDS + + + + + + + + + Brian Jacks Superstar Challenge + 1985 + Martech + + + + + + + + + Bridgemaster + 19?? + J Keyne + + + + + + + + + + + + + + + + + + + + + + + + Buckaroo Banzai + 198? + Adventure International + + + + + + + + + + Buffalo Bills Rodeo Games + 1989 + Tynesoft + + + + + + + + + Bug Blaster + 1984 + Alligata + + + + + + + + + Bug Eyes (Audiogenic) + 198? + Audiogenic + + + + + + + + + Bug Eyes + 1985 + Icon + + + + + + + + + Bug Blaster (Play It Again Sam 5) + 1987 + Superior Software/Acornsoft + + + + + + + + + Bugs + 1984 + >Virgin Games + + + + + + + + + Bullseye + 1984 + Macsen + + + + + + + + + Bumble Bee + 1984 + Micro Power + + + + + + + + + Bun Fun + 1984 + Squirrel Soft + + + + + + + + + Business Games + 1984 + Acornsoft + + + + + + + + + + + + + + + + + Camelot + 1989 + Superior Software/Acornsoft + + + + + + + + + Cascade 50 + 1984 + Cascade + + + + + + + + + + + + + + + + Castle Assault + 1985 + Blue Ribbon + + + + + + + + + Castle Frankenstein + 1984 + Epic + + + + + + + + + Castle of Riddles + 1984 + Acornsoft + + + + + + + + + + Castle of the Skull Lord + 1984 + Samurai + + + + + + + + + Castles and Clowns + 198? + Macmillian + + + + + + + + + + + + + + + + Caterpillar (I.J.K.) + 1984 + I.J.K. + + + + + + + + + Caterpillar (Romik) + 1984 + Romik + + + + + + + + + Caveman + 198? + Kansas + + + + + + + + + + Caveman Capers + 1985 + Icon + + + + + + + + + Caveman Capers (Alternative) + 198? + Alternative + + + + + + + + + Centibug + 1984 + Superior Software + + + + + + + + + Chess (Acornsoft) + 1984 + Acornsoft + + + + + + + + + + Chess (Micro Power) + 1984 + Micro Power + + + + + + + + + Chess (Superior Software) + 1984 + Superior Software + + + + + + + + + Chip Buster + 198? + Software Invasion + + + + + + + + + Chuckie Egg + 1984 + A&F Software + + + + + + + + + Chukee The Upgrade + 1984 + Bit Twiddlers + + + + + + + + + Circus + 198? + Adventure International + + + + + + + + + Circus Games + 1988 + Tynesoft + + + + + + + + + Citadel (Play It Again Sam 1) + 1987 + Superior Software/Acornsoft + + + + + + + + + Classic Adventure + 1984 + Melbourne House + + + + + + + + + + Classic Arcade Games + 198? + Database + + + + + + + + + 9 Classic Card and Board Games Vol.1 + 198? + Database + + + + + + + + + 9 Classic Card and Board Games Vol.2 + 1986 + Database + + + + + + + + + Clogger + 1988 + Impact + + + + + + + + + Codename: Droid + 1987 + Superior Software/Acornsoft + + + + + + + + + Colossus Bridge 4 + 1988 + CDS + + + + + + + + + Colossus Chess 4 + 1988 + CDS + + + + + + + + + Combat Lynx Alternative) + 198? + Alternative + + + + + + + + + Combat Lynx + 1984 + Durell + + + + + + + + + Commander 3 Joystick + 1984 + Bud Computers + + + + + + + + + + + + + + + + Commando + 1985 + Elite + + + + + + + + + Commando (Play It Again Sam-3) + 1989 + Superior Software/Acornsoft + + + + + + + + + Commonwealth Games + 1986 + Tynesoft + + + + + + + + + Condition Red + 198? + Blue Ribbon + + + + + + + + + Confuzion (Alternative) + 198? + Alternative + + + + + + + + + Confuzion + 1985 + Incentive + + + + + + + + + Constellation + 1984 + Superior Software + + + + + + + + + Contract Bridge + 1984 + Alligata + + + + + + + + + Cops n Robbers + 1987 + Atlantis + + + + + + + + + Corn Cropper + 1984 + CCS + + + + + + + + + Corporate Climber + 198? + Dynabyte + + + + + + + + + Cosmic Camouflage + 1988 + Superior Software/Acornsoft + + + + + + + + + Count with Oliver + 1985 + Mirrorsoft + + + + + + + + + + + + + + + + Counting Fun + 1984 + Gemini + + + + + + + + + Crack Up + 1989 + Atlantis + + + + + + + + + Crazee Rider + 1987 + Superior Software/Acornsoft + + + + + + + + + Crazy Er*bert + 1987 + Alternative + + + + + + + + + Crazy Tracer + 1983 + Acornsoft + + + + + + + + + + Creepy Cave + 1987 + Atlantis + + + + + + + + + Cricket + 1986 + Bug Byte + + + + + + + + + Crime & Detection Quiz + 1983 + Acornsoft/Ivan Berg + + + + + + + + + + Croaker + 1984 + Micro Power + + + + + + + + + Crown Jewels + 1984 + Alligata + + + + + + + + + Crystal Castles + 1986 + U.S. Gold + + + + + + + + + Custard Pie Fight + 1984 + Comsoft + + + + + + + + + Cybertron Mission + 1984 + Micro Power + + + + + + + + + Cyborg Warriors + 1991 + Superior Software/Acornsoft + + + + + + + + + Cylon Attack + 1984 + A&F Software + + + + + + + + + Cylon Invasion + 1985 + Tynesoft + + + + + + + + + Dallas + 1983 + CCS + + + + + + + + + Danger UXB + 1983 + Micro Power + + + + + + + + + Dare Devil Dennis + 1984 + Visions + + + + + + + + + Darts + 1985 + Blue Ribbon + + + + + + + + + Data File + 198? + Kansas + + + + + + + + + Dead or Alive + 1988 + Alternative + + + + + + + + + Death Star (The Superior Collection Vol.3) + 1987 + Superior Software + + + + + + + + + Death Star (Blue Ribbon) + 198? + Superior Software/Blue Ribbon + + + + + + + + + Denis Through the Drinking Glass + 1984 + Melbourne House + + + + + + + + + Depot Master Finsbury Park + 1989 + Ashley Greenup + + + + + + + + + Depot Master Old Oak Common (Dee-Kay) + 198? + Dee-Kay + + + + + + + + + Depot Master Old Oak Common + 1989 + Ashley Greenup + + + + + + + + + Desk Diary + 1983 + Acornsoft + + + + + + + + + + Despatch Rider + 1987 + Audiogenic + + + + + + + + + Diamond Mine (Blue Ribbon) + 1985 + Blue Ribbon + + + + + + + + + Diamond Mine + 1983 + MRM Software + + + + + + + + + Diamond Mine 2 + 1985 + Blue Ribbon + + + + + + + + + Diamond Pete + 198? + Alligata + + + + + + + + + Disassembler + 198? + Superior Software + + + + + + + + + Dodgy Geezers + 1986 + Melbourne House + + + + + + + + + Dogfight for Aces Only + 198? + slogger + + + + + + + + + Dominoes (Blue Ribbon) + 198? + Blue Ribbon + + + + + + + + + Dominoes (Garland) + 1984 + Garland Computing + + + + + + + + + Dracula Island + 1986 + Kansas + + + + + + + + + Drain Mania + 1985 + Icon + + + + + + + + + Draughts (Computer Concepts) + 1983 + Computer Concepts + + + + + + + + + Draughts and Reversi + 198? + Acornsoft + + + + + + + + + + + + + + + + + Draughts (Superior Software) + 1984 + Superior Software + + + + + + + + + Draw + 198? + Micro Power + + + + + + + + + Dunjunz + 1987 + Bug Byte + + + + + + + + + Eddie Kidd Jump Challenge + 1985 + Martech + + + + + + + + + Einfuhrungs Kassette (Ger) + 1983 + Acornsoft + + + + + + + + + Electron Computing 1 + 1983 + Electron Computing + + + + + + + + + Electron Computing 2 + 1983 + Electron Computing + + + + + + + + + Electron Computing 3 + 1983 + Electron Computing + + + + + + + + + Electron Computing 4 + 1983 + Electron Computing + + + + + + + + + Electron Computing 5 + 1983 + Electron Computing + + + + + + + + + Electron Computing 6 + 1983 + Electron Computing + + + + + + + + + Electron Computing 7 + 1983 + Electron Computing + + + + + + + + + Elbug Introductory Cassette + 1983 + Elbug + + + + + + + + + Electron Invaders + 1984 + Micro Power + + + + + + + + + Electron User Vol.1-1 + 1984 + Electron User + + + + + + + + + Electron User Vol.1-5 + 1984 + Electron User + + + + + + + + + Electron User Vol.1-6 + 1984 + Electron User + + + + + + + + + Electron User Vol.1-7 + 1984 + Electron User + + + + + + + + + Electron User Vol.1-8 + 1984 + Electron User + + + + + + + + + Electron User Vol.1-9 + 1984 + Electron User + + + + + + + + + Electron User Vol.1-10 + 1984 + Electron User + + + + + + + + + Electron User Vol.1-11 + 1984 + Electron User + + + + + + + + + Electron User Vol.1-12 + 1984 + Electron User + + + + + + + + + Electron User Vol.2-1 + 1984 + Electron User + + + + + + + + + Electron User Vol.2-2 + 1984 + Electron User + + + + + + + + + Electron User Vol.2-3 + 1984 + Electron User + + + + + + + + + Electron User Vol.2-4 + 1985 + Electron User + + + + + + + + + Electron User Vol.2-5 + 1985 + Electron User + + + + + + + + + Electron User Vol.2-6 + 1985 + Electron User + + + + + + + + + Electron User Vol.2-7 + 1985 + Electron User + + + + + + + + + Electron User Vol.2-8 + 1985 + Electron User + + + + + + + + + Electron User Vol.2-9 + 1985 + Electron User + + + + + + + + + Electron User Vol.2-10 + 1985 + Electron User + + + + + + + + + Electron User Vol.2-11 + 1985 + Electron User + + + + + + + + + Electron User Vol.2-12 + 1985 + Electron User + + + + + + + + + Electron User Vol.3-1 + 1985 + Electron User + + + + + + + + + Electron User Vol.3-2 + 1985 + Electron User + + + + + + + + + Electron User Vol.3-3 + 1985 + Electron User + + + + + + + + + Electron User Vol.3-4 + 1986 + Electron User + + + + + + + + + Electron User Vol.3-5 + 1986 + Electron User + + + + + + + + + Electron User Vol.3-6 + 1986 + Electron User + + + + + + + + + Electron User Vol.3-7 + 1986 + Electron User + + + + + + + + + Electron User Vol.3-8 + 1986 + Electron User + + + + + + + + + Electron User Vol.3-9 + 1986 + Electron User + + + + + + + + + Electron User Vol.3-10 + 1986 + Electron User + + + + + + + + + Electron User Vol.3-11 + 1986 + Electron User + + + + + + + + + Electron User Vol.3-12 + 1986 + Electron User + + + + + + + + + Electron User Vol.4-1 + 1986 + Electron User + + + + + + + + + Electron User Vol.4-2 + 1986 + Electron User + + + + + + + + + Electron User Vol.4-3 + 1986 + Electron User + + + + + + + + + Electron User Vol.4-4 + 1987 + Electron User + + + + + + + + + Electron User Vol.4-5 + 1987 + Electron User + + + + + + + + + Electron User Vol.4-6 + 1987 + Electron User + + + + + + + + + Electron User Vol.4-7 + 1987 + Electron User + + + + + + + + + Electron User Vol.4-8 + 1987 + Electron User + + + + + + + + + Electron User Vol.4-9 + 1987 + Electron User + + + + + + + + + Electron User Vol.4-10 + 1987 + Electron User + + + + + + + + + Electron User Vol.4-11 + 1987 + Electron User + + + + + + + + + Electron User Vol.4-12 + 1987 + Electron User + + + + + + + + + Electron User Vol.5-1 + 1987 + Electron User + + + + + + + + + Electron User Vol.5-2 + 1987 + Electron User + + + + + + + + + Electron User Vol.5-3 + 1987 + Electron User + + + + + + + + + Electron User Vol.5-4 + 1988 + Electron User + + + + + + + + + Electron User Vol.5-5 + 1988 + Electron User + + + + + + + + + Electron User Vol.5-6 + 1988 + Electron User + + + + + + + + + Electron User Vol.5-7 + 1988 + Electron User + + + + + + + + + Electron User Vol.5-8 + 1988 + Electron User + + + + + + + + + Electron User Vol.5-9 + 1988 + Electron User + + + + + + + + + Electron User Vol.5-10 + 1988 + Electron User + + + + + + + + + Electron User Vol.5-11 + 1988 + Electron User + + + + + + + + + Electron User Vol.5-12 + 1988 + Electron User + + + + + + + + + Electron User Vol.6-1 + 1988 + Electron User + + + + + + + + + Electron User Vol.6-2 + 1988 + Electron User + + + + + + + + + Electron User Vol.6-3 + 1988 + Electron User + + + + + + + + + Electron User Vol.6-4 + 1989 + Electron User + + + + + + + + + Electron User Vol.6-5 + 1989 + Electron User + + + + + + + + + Electron User Vol.6-6 + 1989 + Electron User + + + + + + + + + Electron User Vol.6-7 + 1989 + Electron User + + + + + + + + + Electron User Vol.6-8 + 1989 + Electron User + + + + + + + + + Electron User Vol.6-9 + 1989 + Electron User + + + + + + + + + Electron User Vol.6-10 + 1989 + Electron User + + + + + + + + + Electron User Vol.6-11 + 1989 + Electron User + + + + + + + + + Electron User Vol.6-12 + 1989 + Electron User + + + + + + + + + Electron User Vol.7-1 + 1989 + Electron User + + + + + + + + + Electron User Vol.7-2 + 1989 + Electron User + + + + + + + + + Electron User Vol.7-3 + 1989 + Electron User + + + + + + + + + Electron User Vol.7-4 + 1990 + Electron User + + + + + + + + + Electron User Vol.7-5 + 1990 + Electron User + + + + + + + + + Electron User Vol.7-6 + 1990 + Electron User + + + + + + + + + Electron User Vol.7-7 + 1990 + Electron User + + + + + + + + + Electron User Vol.7-8 + 1990 + Electron User + + + + + + + + + Electron User Vol.7-9 + 1990 + Electron User + + + + + + + + + Electron User Vol.7-10 + 1990 + Electron User + + + + + + + + + Elite + 1984 + Acornsoft + + + + + + + + + + Elite (Superior Software) + 198? + Superior Software/Acornsoft + + + + + + + + + Elixir + 1987 + Superior Software/Acornsoft + + + + + + + + + Empire + 1985 + Shards Software + + + + + + + + + Enigma + 1983 + Brainbox + + + + + + + + + Er*Bert + 1984 + Microbyte + + + + + + + + + Escape from Moonbase Alpha + 1983 + Micro Power + + + + + + + + + Escape from Pulsar Seven + 198? + Adventure International + + + + + + + + + E-Type + 1990 + 4th Dimension + + + + + + + + + European Knowledge + 198? + Micro Power + + + + + + + + + Evening Star + 1987 + Hewson Consultants + + + + + + + + + Exile + 1988 + Superior Software/Acornsoft + + + + + + + + + Exploring Adventures + 1984 + Duckworth + + + + + + + + + + + + + + + + + + + + + + Factfile 500 - Junior General Knowledge + 1985 + Kosmos + + + + + + + + + Factfile 500 - Senior General Knowledge + 1985 + Kosmos + + + + + + + + + Factfile 500 - Super Sports + 1985 + Kosmos + + + + + + + + + Fantasia Diamond + 1984 + Hewson Consultants + + + + + + + + + Feasibility Experiment + 198? + Adventure International + + + + + + + + + Felicity Farm Girl + 1984 + Gemini + + + + + + + + + Felix and the Fruit Monsters + 1983 + Micro Power + + + + + + + + + Felix in the Factory + 1983 + Micro Power + + + + + + + + + Felix Meets the Evil Weevils + 1984 + Micro Power + + + + + + + + + Fighter Pilot + 1984 + Kansas + + + + + + + + + Finest Favourites + 198? + Acorn User + + + + + + + + + Fire Island + 1984 + Hollsoft + + + + + + + + + Firebug + 1984 + Acornsoft + + + + + + + + + + Fire Track + 198? + Superior Software/Acornsoft + + + + + + + + + Firien Wood + 1983 + MP Software + + + + + + + + + + First Byte Joystick Utility + 198? + First Byte + + + + + + + + + + + + + + + + First Moves Chess + 1985 + Longman + + + + + + + + + First Steps with the Mr.Men + 1983 + Mirrorsoft + + + + + + + + + + + + + + + + + + + + + + + + + + + + Flight Path 737 + 198? + Midas + + + + + + + + + FSS3 - Flint Strikes Back + 1983 + Potter + + + + + + + + + Football Manager + 1984 + Addictive + + + + + + + + + Footballer of the Year + 198? + Gremlin + + + + + + + + + Footballer of the Year (Kixx) + 198? + Kixx + + + + + + + + + French On The Run + 198? + Database + + + + + + + + + FORTH (Ger) + 1983 + Acornsoft + + + + + + + + + + FORTH + 1983 + Acornsoft + + + + + + + + + + Frak! + 1984 + Aardvark + + + + + + + + + Frak! (Alternative) + 198? + Alternative + + + + + + + + + Frak! (Play It Again Sam 4) + 1988 + Superior Software/Acornsoft + + + + + + + + + Frankenstein 2000 (Atlantis) + 198? + Atlantis + + + + + + + + + Frankenstein 2000 + 1985 + Icon + + + + + + + + + Frankenstein 2000 (Audiogenic) + 198? + Audiogenic + + + + + + + + + Free Fall + 1983 + Acornsoft + + + + + + + + + + Freier Fall (Ger) + 1983 + Acornsoft + + + + + + + + + + French on the Run (Swift) + 198? + Swift + + + + + + + + + Frenzy + 1983 + Micro Power + + + + + + + + + Froot Raid + 1987 + Audiogenic + + + + + + + + + Fruit Catcher + 198? + Live Wire + + + + + + + + + Fruit Machine + 1984 + Doctor Soft + + + + + + + + + Fruit Machine (Superior Software) + 1983 + Superior Software + + + + + + + + + Fruit Machine (Alligata) + 1983 + Alligata + + + + + + + + + Fruit Machine Simulator + 198? + Codemasters + + + + + + + + + Fun School 2 (For 6-8 year olds) + 1989 + Database Educational Software + + + + + + + + + Fun School 2 (For the Over-8s) + 1989 + Database Educational Software + + + + + + + + + Fun School 2 (For Under 6s) + 1989 + Database Educational Software + + + + + + + + + Fun With Numbers + 1984 + Golem + + + + + + + + + Future Shock + 1986 + Tynesoft + + + + + + + + + Galactic Commander + 1983 + Micro Power + + + + + + + + + Galactic Patrol + 1984 + Mastertronic + + + + + + + + + Galadriel in Distress + 1984 + Potter + + + + + + + + + Galaforce + 1986 + Superior Software/Acornsoft + + + + + + + + + Galaforce 2 + 1988 + Superior Software/Acornsoft + + + + + + + + + Galilee + 1985 + Shards Software + + + + + + + + + Acorn User Games Compendium + 198? + Acorn User + + + + + + + + + Gatecrasher + 198? + Quicksilva + + + + + + + + + Gauntlet + 198? + Micro Power + + + + + + + + + Ghost Town + 198? + Adventure International + + + + + + + + + Ghouls + 1984 + Micro Power + + + + + + + + + Ghouls (Play It Again Sam 7) + 1989 + Superior Software/Blue Ribbon + + + + + + + + + Gisburne's Castle + 1985 + Martech + + + + + + + + + Go + 1984 + Acornsoft + + + + + + + + + + Goal! + 1986 + Tynesoft + + + + + + + + + Golden Voyage + 198? + Adventure International + + + + + + + + + Golf (Blue Ribbon) + 198? + Blue Ribbon + + + + + + + + + Golf (Yes Software) + 1986 + Yes Software + + + + + + + + + Gorph + 1984 + Doctor Soft + + + + + + + + + Graham Gooch's Test Cricket (Alternative) + 198? + Alternative + + + + + + + + + Graham Gooch's Test Cricket + 1985 + Audiogenic + + + + + + + + + Acorn User Graphics + 1985 + Acorn User + + + + + + + + + Graphito + 1984 + Addison-Wesley + + + + + + + + + + + + + + + + Gremlins + 198? + Adventure International + + + + + + + + + Grid Iron + 1988 + Top Ten + + + + + + + + + Grid Iron 2 + 1991 + Alternative + + + + + + + + + Guardian + 198? + Alligata + + + + + + + + + Guardian (Play It Again Sam 4) + 1988 + Superior Software/Acornsoft + + + + + + + + + Gunfighter + 198? + Atlantis + + + + + + + + + Gunsmoke + 1983 + Software Invasion + + + + + + + + + Gyroscope + 198? + Melbourne House + + + + + + + + + Hampstead + 1984 + Melbourne House + + + + + + + + + Hard Hat Harry + 2011 + Retro Software + + + + + + + + + Hareraiser (Prelude) + 198? + Haresoft + + + + + + + + + Harlequin + 1984 + Kansas + + + + + + + + + Haushaltbudget (Ger) + 1983 + Acornsoft + + + + + + + + + + Heathrow ATC + 1984 + Hewson Consultants + + + + + + + + + + Hell Hole + 198? + Alligata + + + + + + + + + Helter Skelter + 1990 + Audiogenic + + + + + + + + + Hercules + 198? + Power House + + + + + + + + + Mr Men: Here and There + 1985 + Mirrorsoft + + + + + + + + + Hex + 1988 + Larsoft + + + + + + + + + + Hi-Q Quiz + 1989 + Blue Ribbon + + + + + + + + + History Quiz + 1983 + Acornsoft/Ivan Berg + + + + + + + + + + Hobgoblin + 1989 + Atlantis + + + + + + + + + Hobgoblin 2 + 1990 + Atlantis + + + + + + + + + Holed Out + 1989 + 4th Dimension + + + + + + + + + Holed Out Extra Courses Vol.1 + 1990 + 4th Dimension + + + + + + + + + Holed Out Extra Courses Vol.2 + 1990 + 4th Dimension + + + + + + + + + Hopper + 1983 + Acornsoft + + + + + + + + + + Hopper (Play It Again Sam 6) + 1989 + Superior Software/Acornsoft + + + + + + + + + Horserace + 1983 + Dynabyte + + + + + + + + + Hostages + 1990 + Superior Software/Acornsoft + + + + + + + + + The Hulk + 1990 + Americana + + + + + + + + + Questprobe: The Hulk + 198? + Adventure International + + + + + + + + + Questprobe: Human Torch and The Thing + 198? + Adventure International + + + + + + + + + Hunchback + 1983 + Ocean + + + + + + + + + Hunchback (Play It Again Sam 6) + 198? + Superior Software/Acornsoft + + + + + + + + + Hunkidory + 1986 + Bug Byte + + + + + + + + + Hyper Viper + 2011 + Retro Software + + + + + + + + + Hyperball + 1990 + Superior Software/Acornsoft + + + + + + + + + Hyperdrive + 1983 + I.J.K. + + + + + + + + + Ian Botham's Test Match + 1986 + Tynesoft + + + + + + + + + Icarus + 1988 + Mandarin + + + + + + + + + Ice Hockey + 1986 + Bug Byte + + + + + + + + + Identify Europe + 198? + Kosmos + + + + + + + + + Identikit + 1984 + Stell + + + + + + + + + ImageV2 Tape Copier + 198? + Peter Donn + + + + + + + + + + Imogen + 1987 + Superior Software/Acornsoft + + + + + + + + + Impact + 1987 + Audiogenic + + + + + + + + + Impossible Mission + 1986 + U.S. Gold + + + + + + + + + In Search of Atahaulpa + 198? + Lee + + + + + + + + + + + + + + + + Indoor Soccer + 1988 + Alternative + + + + + + + + + Indoor Sports + 1988 + Tynesoft + + + + + + + + + Inertia + 1990 + 4th Dimension + + + + + + + + + Intergalactic Trader + 1983 + Micro Power + + + + + + + + + Introductory Cassette + 1983 + Acornsoft + + + + + + + + + Inu + 19?? + MRJ + + + + + + + + + Invaders (I.J.K.) + 198? + I.J.K. + + + + + + + + + Invaders (Superior Software) + 1983 + Superior Software + + + + + + + + + Jack Attack + 1986 + Bug Byte + + + + + + + + + Jet-Boot Jack + 1984 + English Software + + + + + + + + + Jet-Power Jack + 1984 + Micro Power + + + + + + + + + Jet Set Willy + 1984 + Tynesoft + + + + + + + + + Jet Set Willy II + 1985 + Tynesoft + + + + + + + + + Joe Blade + 1987 + Players + + + + + + + + + Joe Blade II + 1988 + Players + + + + + + + + + Joey + 1985 + Blue Ribbon + + + + + + + + + Johnny Reb + 1984 + Lothlorien + + + + + + + + + Joyport + 1984 + Signpoint + + + + + + + + + Juggle Puzzle + 1984 + Acornsoft/ASK + + + + + + + + + + Jungle Jive + 1984 + >Virgin Games + + + + + + + + + Junior Maths Pack + 1983 + Micro Power + + + + + + + + + Kamakazi + 1983 + A&F Software + + + + + + + + + Kane + 1986 + Mastertronic + + + + + + + + + Karate Combat (The Superior Collection Vol.3) + 1987 + Superior Software + + + + + + + + + Kastle + 198? + Tynesoft + + + + + + + + + Kayleth + 1986 + U.S. Gold + + + + + + + + + Killapede + 1986 + Players + + + + + + + + + Killer Gorilla + 1984 + Micro Power + + + + + + + + + Killer Gorilla 2 (Play It Again Sam 3) + 1989 + Superior Software/Acornsoft + + + + + + + + + Killer Gorilla (Play It Again Sam 3) + 1989 + Superior Software/Acornsoft + + + + + + + + + Kissin' Kousins + 1985 + English Software + + + + + + + + + Know Your Own Personality + 1984 + Mirrorsoft + + + + + + + + + Kourtyard + 1988 + Godax + + + + + + + + + Kreative Graphiken (Ger) + 1983 + Acornsoft + + + + + + + + + + + + + + + + + Laser Reflex + 1984 + Talent + + + + + + + + + + League Challenge + 1986 + Atlantis + + + + + + + + + Lemming Syndrome + 1983 + Dynabyte + + + + + + + + + Let's Compute Issue 1 + 1990 + Let's Compute + + + + + + + + + Licence to Kill + 1989 + Alternative + + + + + + + + + LISP (Ger) + 198? + Acornsoft + + + + + + + + + + LISP + 198? + Acornsoft + + + + + + + + + + Locks of Luck + 1986 + Magus + + + + + + + + + Locomotion + 1985 + BBC Soft + + + + + + + + + Honey Logo + 1985 + Honeyfold + + + + + + + + + Logo (Extensions and Samples) + 1984 + Acornsoft + + + + + + + + + + Look Sharp! + 1985 + Mirrorsoft + + + + + + + + + + + + + + + + Loony Loco + 198? + Kansas + + + + + + + + + Loopz + 1990 + Audiogenic + + + + + + + + + Lunar Rescue + 1983 + Alligata + + + + + + + + + Magic Mushrooms + 1985 + Acornsoft + + + + + + + + + + Magic Mushrooms (The Acornsoft Hits Vol.1) + 1987 + Superior Software/Acornsoft + + + + + + + + + Magnetic Moon + 1987 + Elk Adventure Club + + + + + + + + + + + + + + + + + + + + + + Mango + 1987 + Blue Ribbon + + + + + + + + + Maniac Mower + 198? + Kansas + + + + + + + + + Master Break + 198? + Superior Software/Acornsoft + + + + + + + + + Maths Invaders + 1984 + Stell + + + + + + + + + Maths 'O' Level Revision Part One + 1984 + Ampalsoft + + + + + + + + + + + + + + + + + + + + + + + + + + + + Maths Tutor + 1985 + Century + + + + + + + + + Maths with a Story: 1 + 1984 + BBC Soft + + + + + + + + + Maths with a Story: 2 + 1984 + BBC Soft + + + + + + + + + Maze + 1983 + Acornsoft + + + + + + + + + + Maze (The Acornsoft Hits Vol.1) + 1987 + Superior Software/Acornsoft + + + + + + + + + Me & My Micro + 1984 + Acornsoft + + + + + + + + + + Mega Force + 198? + Tynesoft + + + + + + + + + Mendips Stone + 1986 + Dee-Kay + + + + + + + + + Merlin Teaches Tables 2 + 1984 + Hodder and Stoughton + + + + + + + + + + + + + + + + Meteors + 198? + Acornsoft + + + + + + + + + + Meteors (The Acornsoft Hits Vol.2) + 1987 + Superior Software/Acornsoft + + + + + + + + + Meteors (Ger) + 198? + Acornsoft + + + + + + + + + + Mexico 86 + 1986 + Qualsoft + + + + + + + + + + + + + + + + Micro Olympics + 1984 + database + + + + + + + + + Microball + 1986 + Alternative + + + + + + + + + Plus 1 Joystick Utility + 1986 + Micro Power + + + + + + + + + Mikie + 1986 + Imagine + + + + + + + + + Millionaire + 1984 + Incentive + + + + + + + + + Mined-Out + 1983 + Quicksilva + + + + + + + + + Mineshaft + 1984 + Durell + + + + + + + + + + Mineshaft (Alternative) + 1990 + Alternative + + + + + + + + + + Mini Office (Summit) + 198? + Summit + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mini Office + 1984 + Database + + + + + + + + + + + + + + + + + + + + + + + + + + + + Missile Control + 1983 + Gemini + + + + + + + + + Mission XP2 + 1984 + Hollsoft + + + + + + + + + Monkey Nuts + 1988 + Bug Byte + + + + + + + + + Monsters + 1983 + Acornsoft + + + + + + + + + + Monsters (Play It Again Sam 11) + 1990 + Superior Software/Acornsoft + + + + + + + + + Monsters (The Acornsoft Hits Vol.1) + 1987 + Superior Software/Acornsoft + + + + + + + + + Moon Buggy + 1985 + Kansas + + + + + + + + + Moon Raider + 1983 + Micro Power + + + + + + + + + Moon Raider (Play It Again Sam 5) + 1989 + Superior Software/Acornsoft + + + + + + + + + Mouse Trap + 198? + Tynesoft + + + + + + + + + Mr Wiz + 1984 + Superior Software + + + + + + + + + Mr Wiz (The Superior Collection Vol.3) + 1987 + Superior Software + + + + + + + + + Mr Wiz (Blue Ribbon) + 198? + Superior Software/Blue Ribbon + + + + + + + + + Myorem + 1986 + Robico + + + + + + + + + Mystery Fun House + 198? + Adventure International + + + + + + + + + The Mystery of the Java Star + 1985 + Shards Software + + + + + + + + + Network (Play It Again Sam 15) + 1991 + Superior Software/Acornsoft + + + + + + + + + Night Strike + 198? + Alternative + + + + + + + + + Nightmare Maze + 1984 + MRM Software + + + + + + + + + Nightworld + 1986 + Alligata + + + + + + + + > + Nightmare Maze (Blue Ribbon) + 1984 + Blue Ribbon + + + + + + + + + Number Gulper + 1984 + Acornsoft/ASK + + + + + + + + + + Olympic Spectacular + 198? + Alternative + + + + + + + + + Omega Orb + 1986 + Audiogenic + + + + + + + + + Omega Orb (Atlantis) + 198? + Atlantis + + + + + + + + + Osprey! + 198? + Bourne Educational Software + + + + + + + + + Overdrive + 1984 + Superior Software + + + + + + + + + Overdrive (The Superior Collection Vol.3) + 1987 + Superior Software + + + + + + + + + Oxbridge + 1986 + Tynesoft + + + + + + + + + Palace of Magic + 1987 + Superior Software/Acornsoft + + + + + + + + + Pandemonium (Play It Again Sam 13) + 1990 + Superior Software/Acornsoft + + + + + + + + + Panik + 1987 + Atlantis + + + + + + + + + Paperboy + 1984 + Elite + + + + + + + + + Paras + 1983 + Lothlorien + + + + + + + + + Paul Daniels' Magic Show + 1984 + Acornsoft + + + + + + + + + + PCW Games Collection + 198? + PCW + + + + + + + + + Pedro + 1984 + Imagine + + + + + + + + + Peeko-Computer (Ger) + 1983 + Acornsoft + + + + + + + + + + Peeko-Computer + 1983 + Acornsoft + + + + + + + + + + Peg Leg + 1984 + I.J.K. + + + + + + + + + Pengi + 1984 + Visions + + + + + + + + + Pengwyn + 1984 + Postern + + + + + + + + + Percy Penguin + 1984 + Superior Software + + + + + + + + + Percy Penguin (Play It Again Sam 13) + 1990 + Superior Software/Acornsoft + + + + + + + + + Percy Penguin (Blue Ribbon) + 198? + Superior Software/Blue Ribbon + + + + + + + + + Perplexity + 1989 + Superior Software/Acornsoft + + + + + + + + + Perseus and Andromeda + 198? + Adventure International + + + + + + + + + Pettigrews Diary + 1984 + Shards Software + + + + + + + + + Phantom Combat + 1985 + Doctor Soft + + + + + + + + + Pharoahs Tomb + 1983 + A&F Software + + + + + + + + + Philosophers Quest + 1983 + Acornsoft + + + + + + + + + + Pinball + 1983 + Microbyte + + + + + + + + + Pinball Arcade + 1984 + Kansas + + + + + + + + + Pipeline + 1989 + Superior Software/Acornsoft + + + + + + + + + Pipe Mania + 1989 + Empire + + + + + + + + + Pirate Adventure + 198? + Adventure International + + + + + + + + + + Plan B + 1987 + Bug Byte + + + + + + + + + Plan B2 + 1987 + Bug Byte + + + + + + + + + Plane Crash + 1989 + Labyrinth + + + + + + + + + Planetoid (Ger) + 1983 + Acornsoft + + + + + + + + + + Planetoid (The Acornsoft Hits Vol.1) + 1987 + Superior Software/Acornsoft + + + + + + + + + Planetoid + 1983 + Acornsoft + + + + + + + + + + Play Your Cards Right + 198? + Britannia + + + + + + + + + Playbox + 1984 + Comsoft + + + + + + + + + Plunder + 1984 + CCS + + + + + + + + + Podd + 1984 + Acornsoft/ASK + + + + + + + + + + Poker + 1986 + Duckworth + + + + + + + + + Pony Express + 1984 + Hollsoft + + + + + + + + + Pool Hall + 1984 + Dynabyte + + + + + + + + + Positron + 1983 + Micro Power + + + + + + + + + Predator + 1988 + Superior Software/Acornsoft + + + + + + + + + Primary Art + 1984 + Alligata + + + + + + + + + Pro Golf + 1988 + Atlantis + + + + + + + + + Pro Boxing Simulator + 198? + Codemasters + + + + + + + + + Project Thesius + 1986 + Robico + + + + + + + + + Psycastria + 1986 + Audiogenic + + + + + + + + + Psycastria (Alternative) + 198? + Alternative + + + + + + + + + Psycastria 2 + 1989 + Audiogenic + + + + + + + + + Psycastria 2 (Atlantis) + 19?? + Atlantis + + + + + + + + + Pyramid of Doom + 198? + Adventure International + + + + + + + + + Q*Bix + 1984 + Alligata + + + + + + + + + Quest + 1988 + Superior Software/Acornsoft + + + + + + + + + Quest for Freedom + 1986 + I.J.K. + + + + + + + + + Quick Thinking! + 1985 + Mirrorsoft + + + + + + + + + + + + + + Qwak + 1989 + Superior Software/Acornsoft + + + + + + + + + Ransack! + 1987 + Audiogenic + + + + + + + + + Ravage + 1985 + Blue Ribbon + + + + + + + + + Ravenskull + 1987 + Superior Software + + + + + + + + + Ravenskull (Play It Again Sam) + 198? + Superior Software + + + + + + + + + Read Right Away 3 + 1985 + Highlight Software + + + + + + + + + + + + + + Village of the Lost Souls + 1987 + Robico + + + + + + + + + Rebel Planet + 1986 + U.S. Gold + + + + + + + + + Red Coats + 1985 + Lothlorien + + + + + + + + + Reluctant Hero + 1987 + Elk Adventure Club + + + + + + + + + + + + + + + + Repton + 1985 + Superior Software + + + + + + + + + Repton (Blue Ribbon) + 198? + Superior Software/Blue Ribbon + + + + + + + + + Repton 2 (Blue Ribbon) + 198? + Superior Software/Blue Ribbon + + + + + + + + + Repton 2 + 1985 + Superior Software + + + + + + + + + Repton 2 (The Superior Collection Vol.3) + 1987 + Superior Software + + + + + + + + + Repton 3 + 1986 + Superior Software + + + + + + + + + Repton Infinity + 1988 + Superior Software/Acornsoft + + + + + + + + + Repton (The Superior Collection Vol.3) + 1987 + Superior Software + + + + + + + + + Repton Thru Time + 1988 + Superior Software/Acornsoft + + + + + + + + + FSS2 - Return of Flint + 1983 + Potter + + + + + + + + + Return of R2 + 1987 + Blue Ribbon + + + + + + + + + Revenge of Zor + 1983 + Kansas + + + + + + + + + Reversi (Kansas) + 198? + Kansas + + + + + + + + + Reversi (Superior Software) + 1983 + Superior Software + + + + + + + + + Rick Hanson + 1986 + Robico + + + + + + + + + Ricochet + 1989 + Superior Software/Acornsoft + + + + + + + + + Rig Attack + 1985 + Tynesoft + + + + + + + + + Rik the Roadie + 1987 + Alternative + + + + + + + + + Ring of Time + 1983 + Kansas + + + + + + + + + Robin of Sherwood + 198? + Adventure International + + + + + + + + + Roboto + 1985 + Bug Byte + + + + + + + + + Robotron: 2084 + 1983 + Atarisoft + + + + + + + + + Rohak the Swordsman + 1987 + Elk Adventure Club + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Roman Empire + 1983 + Lothlorien + + + + + + + + + Round Ones + 1988 + Alternative + + + + + + + + + Row of Four + 1983 + Software For All + + + + + + + + + RTC Birmingham + 1987 + Dee-Kay + + + + + + + + + RTC Crewe + 1987 + Dee-Kay + + + + + + + + + RTC Doncaster + 1988 + Dee-Kay + + + + + + + + + Rubble Trouble + 1983 + Micro Power + + + + + + + + + Runestaff + 1987 + Squaresoft + + + + + + + + + Sadim Castle + 1984 + MP Software + + + + + + + + + + The Rick Hanson Trilogy + 1986 + Robico + + + + + + + + + + + + + + + + + + + + + + Saigon + 1988 + Tynesoft + + + + + + + + + Saracoid + 1984 + Audiogenic + + + + + + + + + SAS Commander + 1984 + Comsoft + + + + + + + + + Savage Island Part One + 198? + Adventure International + + + + + + + + + Savage Island Part Two + 198? + Adventure International + + + + + + + + + Savage Pond + 1984 + Starcade + + + + + + + + + Savage Pond (Bug Byte) + 1986 + Bug Byte + + + + + + + + + Science Fiction Quiz + 1983 + Acornsoft/Ivan Berg + + + + + + + + + + Sea Queen + 198? + Danosoft + + + + + + + + + Secret Mission + 198? + Adventure International + + + + + + + + + Serpents Lair + 1984 + Comsoft + + + + + + + + + Shanghai Warriors + 1989 + Players + + + + + + + + + Shark + 1988 + Audiogenic + + + + + + + + + Shark Attack + 1984 + Romik + + + + + + + + + Shedmaster Bounds Green + 1987 + Dee-Kay + + + + + + + + + Shedmaster Finsbury Park + 198? + Dee-Kay + + + + + + + + + Shuffle + 1986 + Budgie + + + + + + + + + Sim + 1984 + Viper + + + + + + + + + Sim City + 1990 + Superior Software/Acornsoft + + + + + + + + + Skirmish + 1988 + Godax + + + + + + + + + Skirmish (Play It Again Sam-12) + 1990 + Superior Software/Acornsoft + + + + + + + + + Skyhawk + 1986 + Bug Byte + + + + + + + + + Smash and Grab + 1984 + Superior Software + + + + + + + + + Smash and Grab (The Superior Collection Vol.3) + 1987 + Superior Software + + + + + + + + + Snake + 198? + Kansas + + + + + + + + + Snapper + 1983 + Acornsoft + + + + + + + + + + Snapper (Play It Again Sam 7) + 1989 + Superior Software/Acornsoft + + + + + + + + + Snooker (Visions) + 198? + Visions + + + + + + + + + + Snooker (Blue Ribbon) + 198? + Superior Software/Blue Ribbon + + + + + + + + + Snooker (Acornsoft) + 1983 + Acornsoft + + + + + + + + + + Soccer Boss + 1989 + Alternative + + + + + + + + + Soccer Supremo + 1984 + Qualsoft + + + + + + + + + The Soft Centre Collection + 1985 + Soft Centre + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sorceror of Claymorgue Castle + 198? + Adventure International + + + + + + + + + South Devon Hydraulics + 1986 + Dee-Kay + + + + + + + + + Southern Belle + 1986 + Hewson Consultants + + + + + + + + + Space Caverns + 1985 + Tynesoft + + + + + + + + + Space Ranger + 1986 + Audiogenic + + + + + + + + + Space Shuttle + 1983 + Microdeal + + + + + + + + + Space Station Alpha + 198? + Icon + + + + + + + + + Spaceman Sid + 1984 + English Software + + + + + + + + + S-Pascal (Ger) + 198? + Acornsoft + + + + + + + + + + Special Operations + 1984 + Lothlorien + + + + + + + + + Spectapede + 198? + Mastertronic + + + + + + + + + Spellbinder + 1987 + Superior Software/Acornsoft + + + + + + + + + Sphere of Destiny + 1986 + Audiogenic + + + + + + + + + Sphere of Destiny 2 + 1988 + Audiogenic + + + + + + + + + Sphinx Adventure + 1983 + Acornsoft + + + + + + + + + + Spiderman + 198? + Adventure International + + + + + + + + + Spitfire 40 (Alternative) + 198? + Alternative + + + + + + + + + Spitfire 40 + 1985 + Mirrorsoft + + + + + + + + + Spooksville + 1988 + Blue Ribbon + + + + + + + + + Sporting Triangles + 1990 + CDS + + + + + + + + + + + + + + + + Spy vs Spy + 1984 + Tynesoft + + + + + + + + + Spycat + 1988 + Superior Software/Acornsoft + + + + + + + + + Squeakaliser + 198? + Bug Byte + + + + + + + + + Stairway to Hell + 1985 + Software Invasion + + + + + + + + + Star Drifter + 1985 + Firebird + + + + + + + + + Star Force Seven + 198? + Bug Byte + + + + + + + + + Star Port + 1990 + Superior Software/Acornsoft + + + + + + + + + Star Seeker + 1985 + Mirrorsoft + + + + + + + + + Star Wars + 1987 + Domark + + + + + + + + + Starmaze 2 + 1984 + Mastertronic + + + + + + + + + Starship Command + 1983 + Acornsoft + + + + + + + + + + Starship Command (Ger) + 1983 + Acornsoft + + + + + + + + + + Starship Quest + 1987 + Elk Adventure Club + + + + + + + + + + + + + + + + + + + + + + Starship Command (Blue Ribbon) + 198? + Superior Software/Blue Ribbon + + + + + + + + + Starter Pack: Beginners + 1984 + Collins Software + + + + + + + + + Steve Davis Snooker + 1986 + CDS + + + + + + + + + Steve Davis Snooker (Play It Again Sam 9) + 1989 + Superior Software/Acornsoft + + + + + + + + + Stix + 1984 + Supersoft + + + + + + + + + Stock Car + 1983 + Micro Power + + + + + + + + + Stormcycle + 1989 + Atlantis + + + + + + + + + Stranded + 1984 + Superior Software + + + + + + + + + Strange Odyssey + 198? + Adventure International + + + + + + + + + Stratobomber + 1983 + I.J.K. + + + + + + + + + Strike Force Harrier (Alternative) + 198? + Alternative + + + + + + + + + Strike Force Harrier + 1985 + Mirrorsoft + + + + + + + + + Strip Poker II Plus + 1989 + Anco + + + + + + + + + Stripper II + 198? + Aggressive + + + + + + + + + Stryker's Run + 1986 + Superior Software + + + + + + + + + Subway Vigilante + 1989 + Players + + + + + + + + + Suds + 1986 + Riverdale + + + + + + + + + + + + + + + + + + + + + + + + + + + + FSS1 - Super Spy Flint + 1983 + Potter + + + + + + + + + Super Golf + 1984 + Squirrel + + + + + + + + + Super Hangman + 1983 + I.J.K. + + + + + + + + + Super Pool + 1984 + Software Invasion + + + + + + + + + Super Fruit + 1984 + Simonsoft + + + + + + + + + Superior Soccer + 1989 + Superior Software/Acornsoft + + + + + + + + + Superman: The Game + 1988 + First Star + + + + + + + + + Survivors + 1987 + Atlantis + + + + + + + + + Swag + 1984 + Micro Power + + + + + + + + + Swoop + 1983 + Micro Power + + + + + + + + + Symmetry + 198? + Garland Computing + + + + + + + + + Syncron (The Superior Collection Vol.3) + 1987 + Superior Software + + + + + + + + + System_8 + 198? + Blue Ribbon + + + + + + + + + Tales of the Arabian Nights + 1985 + Interceptor + + + + + + + + + Tank Attack + 1989 + CDS + + + + + + + + + Tarzan + 1987 + Martech + + + + + + + + + Tarzan Boy + 1984 + Alligata + + + + + + + + + Tempest + 1985 + Superior Software + + + + + + + + + Templeton + 1986 + Bug Byte + + + + + + + + + Ten Little Indians + 1983 + Adventure International + + + + + + + + + Ten of the Best! Vol.1 + 1984 + Database + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ten of the Best! Vol.2 + 1984 + Database + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ten of the Best! Vol.3 + 1984 + Database + + + + + + + + + Tennis + 198? + Bug Byte + + + + + + + + + Terminkalendar (Ger) + 1983 + Acornsoft + + + + + + + + + + Terrormolinos + 1985 + Melbourne House + + + + + + + + + Tesselator + 1985 + Addison-Wesley + + + + + + + + + Test Match + 1983 + CRL + + + + + + + + + + + + + + + + Tetris + 1988 + Mirrorsoft + + + + + + + + + Thai Boxing + 1984 + Anco + + + + + + + + + Thames Local + 1986 + Dee-Kay + + + + + + + + + The Adventure Creator + 1986 + Incentive + + + + + + + + + + + + + + + + The Art Studio + 1989 + Impact + + + + + + + + + + + + + + + + The Axe of Kolt + 1987 + Elk Adventure Club + + + + + + + + + + + + + + + + + + + + + + + + + + + + The Banished Prince + 1984 + Orbit + + + + + + + + + The Big KO! + 1987 + Tynesoft + + + + + + + + + The Boss + 1985 + Peaksoft + + + + + + + + + The Count + 198? + Adventure International + + + + + + + + + The Dating Game + 1983 + Acornsoft/Ivan Berg + + + + + + + + + + The Druids Circle + 1984 + Hollsoft + + + + + + + + + The Electron Tape - BASIC, Sound and Graphics + 1983 + Addison-Wesley + + + + + + + + + The Eye of Zolton + 1983 + Softek + + + + + + + + + The Ferryman Awaits + 1986 + Kansas + + + + + + + + + The Five Doctors + 1984 + DW Gore + + + + + + + + + The Five Doctors & The Twin Dilemma + 1984 + W Games + + + + + + + + + The Four Wands + 1988 + DW Gore + + + + + + + + + + + + + + + + + + + + + + The Golden Baton + 198? + Adventure International + + + + + + + + + The Golden Figurine + 1988 + Atlantis + + + + + + + + + The Great Wall + 1984 + Artic + + + + + + + + + The Greedy Dwarf + 1984 + Goldstar + + + + + + + + + The Hacker + 198? + Firebird + + + + + + + + + The Hunt: Search for Shauna + 1987 + Robico + + + + + + + + + The Inca Treasure + 1989 + DW Gore + + + + + + + + + The Ket Trilogy + 1985 + Incentive + + + + + + + + + The Kingdom of Klein + 1984 + Epic + + + + + + + + + The Last Ninja + 1988 + Superior Software/Acornsoft + + + + + + + + + The Last Ninja 2 + 1988 + Superior Software/Acornsoft + + + + + + + + + The Last of the Free + 1986 + Audiogenic + + + + + + + + + The Last of the Free (Atlantis) + 1989 + Atlantis + + + + + + + + + The Life of Repton + 1987 + Superior Software/Acornsoft + + + + + + + + + The Magic Sword + 1984 + Database Software + + + + + + + + + The Mine + 1984 + Micro Power + + + + + + + + + The Nine Dancers + 1986 + Larsoft + + + + + + + + + + The Puppetman + 1987 + Larsoft + + + + + + + + + The Quest for the Holy Grail + 198? + Epic + + + + + + + + + The Quill + 198? + Gilsoft + + + + + + + + + Rising of Salandra - Parts 1 & 2 + 1984 + Larsoft + + + + + + + + + + + + + + + + + The Spanish Tutor - Level A + 1984 + Kosmos + + + + + + + + + The Staff of Law + 1984 + Potter + + + + + + + + + The Stolen Lamp + 1984 + Lothlorien + + + + + + + + + Survivor + 1985 + MP Software + + + + + + + + + + The Time Machine + 198? + Adventure International + + + + + + + + + The Twin Orbs of Aalinor + 1985 + Potter + + + + + + + + + + The Valley + 198? + ASP Software + + + + + + + + + The Valley of the Kings + 1985 + MP Software + + + + + + + + + + The Way of the Exploding Fist + 1985 + Melbourne House + + + + + + + + + Wheel of Fortune + 1984 + Epic + + + + + + + + + Thrust + 1986 + Superior Software + + + + + + + + + Thunderstruck + 1985 + Audiogenic + + + + + + + + + Thunderstruck 2: Mind Master + 1986 + Audiogenic + + + + + + + + + Time + 1984 + Stell + + + + + + + + + Tomb of Death + 1984 + Hollsoft + + + + + + + + + Tomcat + 1989 + Players + + + + + + + + + Tops and Tails + 1985 + Macmillian + + + + + + + + + + + + + + + + Traditional Games + 1983 + Gemini + + + + + + + + + + + + + + + + + + + + + + + + + + + + Trapper + 1987 + Blue Ribbon + + + + + + + + + Treasure Hunt + 1986 + Macsen + + + + + + + + + Tree of Knowledge + 198? + Acornsoft + + + + + + + + + + Trek II + 1985 + Tynesoft + + + + + + + + + Triple Decker 1 + 1988 + Alternative + + + + + + + + + + + + + + + + + + + + + + Triple Decker 2 + 1988 + Alternative + + + + + + + + + + + + + + + + + + + + + + Triple Decker 3 + 1988 + Alternative + + + + + + + + + + + + + + + + + + + + + + Triple Decker 4 + 1988 + Alternative + + + + + + + + + + + + + + + + + + + + + + Triple Decker 5 + 1988 + Alternative + + + + + + + + + + + + + + + + + + + + + + Triple Decker 6 + 1988 + Alternative + + + + + + + + + + + + + + + + + + + + + + Triple Decker 7 + 1988 + Alternative + + + + + + + + + + + + + + + + + + + + + + Triple Decker 8 + 198? + Alternative + + + + + + + + + + + + + + + + + + + + + + Triple Decker 09 + 1988 + Alternative + + + + + + + + + + + + + + + + + + + + + + Triple Decker 10 + 1988 + Alternative + + + + + + + + + + + + + + + + + + + + + + Turf Form + 1988 + Blue Ribbon + + + + + + + + + Turtle Graphics + 198? + Acornsoft + + + + + + + + + Twelfth Night + 198? + Penguin Study Software + + + + + + + + + Twin Kingdom Valley + 1983 + Bug Byte + + + + + + + + + U.K. PM + 1984 + I.J.K. + + + + + + + + + Ultron + 1984 + Icon + + + + + + + + + Uranians + 1986 + Bug Byte + + + + + + + + + US Drag Racing + 198? + Tynesoft + + + + + + + + + Vegas Jackpot + 1984 + Mastertronic + + + + + + + + + Video Card Arcade + 1987 + Blue Ribbon + + + + + + + + + Videos Revenge (Alternative) + 1987 + Alternative + + + + + + + + + Videos Revenge (Firebird) + 198? + Firebird + + + + + + + + + Videos Revenge + 198? + Budgie + + + + + + + + + Videos Revenge (Play It Again Sam 17) + 1991 + Superior Software/Blue Ribbon + + + + + + + + + Vindaloo + 1986 + Tynesoft + + + + + + + + + Voodoo Castle + 198? + Adventure International + + + + + + + + + Vortex + 1983 + Software Invasion + + + + + + + + + Voxbox Demonstration + 1985 + Millsgrade + + + + + + + + + + + + + + + + Walk the Plank + 198? + Mastertronic + + + + + + + + + Warehouse + 1988 + Top Ten + + + + + + + + + Warp-1 + 1984 + Icon + + + + + + + + + Waterloo + 1984 + Lothlorien + + + + + + + + + Waxworks + 198? + Adventure International + + + + + + + + + Web War + 1984 + Artic + + + + + + + + + + Weetabix versus The Titchies + 1984 + Romik + + + + + + + + + West + 198? + Talent + + + + + + + + + + Wet Zone + 198? + Tynesoft + + + + + + + + + Where + 1983 + Micro Power + + + + + + + + + Which Salt? + 1984 + Micro Power + + + + + + + + + White Knight Mk11 + 1983 + BBC Soft + + + + + + + + + White Magic + 1989 + 4th Dimension + + + + + + + + + Whoopsy + 1985 + Shards Software + + + + + + + + + Winter Olmpiad 88 + 1988 + Tynesoft + + + + + + + + + Winter Olympics + 1986 + Tynesoft + + + + + + + + + Wizard of Akyrz + 198? + Adventure International + + + + + + + + + Wizzys Mansion + 1986 + Audiogenic + + + + + + + + + + Woks + 1984 + Artic + + + + + + + + + Wongo + 1986 + Icon + + + + + + + + + Woodbury End + 1986 + Shards Software + + + + + + + + + Woodland Terror + 1984 + MP Software + + + + + + + + + + Woodland Terror (early) + 1984 + MP Software + + + + + + + + + + Word Hunt + 198? + Acornsoft + + + + + + + + + + Word Sequencing + 1984 + Acornsoft + + + + + + + + + + World Geography + 198? + Superior Software + + + + + + + + + Wychwood + 1987 + Larsoft + + + + + + + + + + Xadomy + 1984 + Brassington Enterprises + + + + + + + + + Xanagrams + 1984 + Postern + + + + + + + + + XOR + 1987 + Logotron + + + + + + + + + XOR: Procyon's Mazes + 1987 + Logotron + + + + + + + + + Yie Ar Kung Fu + 1984 + Imagine + + + + + + + + + Yie Ar Kung Fu 2 + 198? + Imagine + + + + + + + + + Your Computer Vol.5-4 + 1985 + Your Computer + + + + + + + + + Zalaga + 1983 + Aardvark + + + + + + + + + Zalaga (Play It Again Sam 10) + 1989 + Superior Software/Acornsoft + + + + + + + + + Zalaga (Alternative) + 198? + Alternative + + + + + + + + + Zany Kong Junior + 198? + Superior Software + + + + + + + + + Zeichenbrett (Ger) + 198? + Acornsoft + + + + + + + + + + Zenon + 1989 + Impact + + + + + + + + + Ziggy + 1987 + Audiogenic + + + + + + + + + Zorakk the Conqueror + 198? + Icon + + + + + + + diff --git a/src/mame/drivers/electron.cpp b/src/mame/drivers/electron.cpp index dc1e2142212..106fc034a03 100644 --- a/src/mame/drivers/electron.cpp +++ b/src/mame/drivers/electron.cpp @@ -64,7 +64,6 @@ Incomplete: Missing: - Support for floppy disks - Other peripherals - - Keyboard is missing the 'Break' key ******************************************************************************/ #include "emu.h" @@ -93,34 +92,39 @@ PALETTE_INIT_MEMBER(electron_state, electron) } static ADDRESS_MAP_START(electron_mem, AS_PROGRAM, 8, electron_state ) - AM_RANGE(0x0000, 0x7fff) AM_RAM AM_REGION("maincpu", 0x00000) /* 32KB of RAM */ - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2") /* Banked ROM pages */ - AM_RANGE(0xc000, 0xfbff) AM_ROM AM_REGION("user1", 0x40000) /* OS ROM */ - AM_RANGE(0xfc00, 0xfcff) AM_READWRITE(electron_jim_r, electron_jim_w ) /* JIM pages */ - AM_RANGE(0xfd00, 0xfdff) AM_READWRITE(electron_1mhz_r, electron_1mhz_w ) /* 1 MHz bus */ - AM_RANGE(0xfe00, 0xfeff) AM_READWRITE(electron_ula_r, electron_ula_w ) /* Electron ULA */ - AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("user1", 0x43f00) /* OS ROM continued */ + AM_RANGE(0x0000, 0x7fff) AM_RAM AM_REGION("maincpu", 0x00000) /* 32KB of RAM */ + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2") /* Banked ROM pages */ + AM_RANGE(0xc000, 0xfbff) AM_ROM AM_REGION("user1", 0x40000) /* OS ROM */ + AM_RANGE(0xfc00, 0xfcff) AM_READWRITE(electron_fred_r, electron_fred_w ) /* FRED */ + AM_RANGE(0xfd00, 0xfdff) AM_READWRITE(electron_jim_r, electron_jim_w ) /* JIM */ + AM_RANGE(0xfe00, 0xfeff) AM_READWRITE(electron_sheila_r, electron_sheila_w ) /* SHEILA */ + AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("user1", 0x43f00) /* OS ROM continued */ ADDRESS_MAP_END +INPUT_CHANGED_MEMBER(electron_state::trigger_reset) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); +} + static INPUT_PORTS_START( electron ) PORT_START("LINE.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92 | \\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR('|') PORT_CHAR('\\') // on the real keyboard, this would be on the 1st row, the 3rd key after 0 PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR('[') PORT_CHAR(']') - /* PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_) */ + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_START("LINE.1") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90 ^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR('^') PORT_CHAR('~') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93 _ }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR('_') PORT_CHAR('}') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_START("LINE.2") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91 \xC2\xA3 {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('\xA3') PORT_CHAR('{') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - /* PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_) */ + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("LINE.3") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') @@ -188,10 +192,12 @@ static INPUT_PORTS_START( electron ) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_START("BRK") /* BREAK */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_CHANGED_MEMBER(DEVICE_SELF, electron_state, trigger_reset, 0) INPUT_PORTS_END static MACHINE_CONFIG_START( electron, electron_state ) - MCFG_CPU_ADD( "maincpu", M6502, 2000000 ) + MCFG_CPU_ADD( "maincpu", M6502, XTAL_16MHz/8 ) MCFG_CPU_PROGRAM_MAP( electron_mem) MCFG_SCREEN_ADD("screen", RASTER) @@ -212,11 +218,13 @@ static MACHINE_CONFIG_START( electron, electron_state ) MCFG_CASSETTE_ADD( "cassette" ) MCFG_CASSETTE_FORMATS(uef_cassette_formats) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("electron_cass") MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "electron_cart") MCFG_GENERIC_LOAD(electron_state, electron_cart) /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_list","electron_cass") MCFG_SOFTWARE_LIST_ADD("cart_list","electron_cart") MACHINE_CONFIG_END @@ -246,5 +254,6 @@ ROM_START(electron) /* 3c000 15 available for cartridges with a language ROM */ ROM_END -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP ( 1983, electron, 0, 0, electron, electron, driver_device, 0, "Acorn", "Acorn Electron", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +COMP ( 1983, electron, 0, 0, electron, electron, driver_device, 0, "Acorn", "Acorn Electron", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +//COMP ( 1985, btm2501, electron, 0, electron, electron, driver_device, 0, "British Telecom Business Systems", "Merlin M2501", MACHINE_NOT_WORKING ) diff --git a/src/mame/includes/electron.h b/src/mame/includes/electron.h index 81d6b9ca171..bfa6de0f5a7 100644 --- a/src/mame/includes/electron.h +++ b/src/mame/includes/electron.h @@ -23,10 +23,10 @@ #define INT_HIGH_TONE 0x40 #define INT_TRANSMIT_EMPTY 0x20 #define INT_RECEIVE_FULL 0x10 -#define INT_RTC 0x08 +#define INT_RTC 0x08 #define INT_DISPLAY_END 0x04 -#define INT_SET 0x100 -#define INT_CLEAR 0x200 +#define INT_SET 0x100 +#define INT_CLEAR 0x200 /* ULA context */ @@ -83,12 +83,12 @@ public: int m_map16[256]; emu_timer *m_scanline_timer; DECLARE_READ8_MEMBER(electron_read_keyboard); + DECLARE_READ8_MEMBER(electron_fred_r); + DECLARE_WRITE8_MEMBER(electron_fred_w); DECLARE_READ8_MEMBER(electron_jim_r); DECLARE_WRITE8_MEMBER(electron_jim_w); - DECLARE_READ8_MEMBER(electron_1mhz_r); - DECLARE_WRITE8_MEMBER(electron_1mhz_w); - DECLARE_READ8_MEMBER(electron_ula_r); - DECLARE_WRITE8_MEMBER(electron_ula_w); + DECLARE_READ8_MEMBER(electron_sheila_r); + DECLARE_WRITE8_MEMBER(electron_sheila_w); void electron_tape_start(); void electron_tape_stop(); virtual void machine_start() override; @@ -108,6 +108,7 @@ public: inline void electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); void electron_interrupt_handler(int mode, int interrupt); DECLARE_DEVICE_IMAGE_LOAD_MEMBER( electron_cart ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; diff --git a/src/mame/machine/electron.cpp b/src/mame/machine/electron.cpp index cbeb410bc23..a8df99e819f 100644 --- a/src/mame/machine/electron.cpp +++ b/src/mame/machine/electron.cpp @@ -145,25 +145,25 @@ READ8_MEMBER(electron_state::electron_read_keyboard) return data; } -READ8_MEMBER(electron_state::electron_jim_r) +READ8_MEMBER(electron_state::electron_fred_r) { return 0xff; } -WRITE8_MEMBER(electron_state::electron_jim_w) +WRITE8_MEMBER(electron_state::electron_fred_w) { } -READ8_MEMBER(electron_state::electron_1mhz_r) +READ8_MEMBER(electron_state::electron_jim_r) { return 0xff; } -WRITE8_MEMBER(electron_state::electron_1mhz_w) +WRITE8_MEMBER(electron_state::electron_jim_w) { } -READ8_MEMBER(electron_state::electron_ula_r) +READ8_MEMBER(electron_state::electron_sheila_r) { UINT8 data = ((UINT8 *)memregion("user1")->base())[0x43E00 + offset]; switch ( offset & 0x0f ) @@ -186,7 +186,7 @@ READ8_MEMBER(electron_state::electron_ula_r) static const int electron_palette_offset[4] = { 0, 4, 5, 1 }; static const UINT16 electron_screen_base[8] = { 0x3000, 0x3000, 0x3000, 0x4000, 0x5800, 0x5800, 0x6000, 0x5800 }; -WRITE8_MEMBER(electron_state::electron_ula_w) +WRITE8_MEMBER(electron_state::electron_sheila_w) { int i = electron_palette_offset[(( offset >> 1 ) & 0x03)]; logerror( "ULA: write offset %02x <- %02x\n", offset & 0x0f, data ); -- cgit v1.2.3-70-g09d2 From 68f167c8866691c57eb676a031c87e45630f8e1b Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Mon, 8 Feb 2016 01:23:35 +0100 Subject: ui: The video mode in the menu display options are now obtained directly from the settings. (nw) --- src/emu/ui/datmenu.cpp | 15 ++++------- src/emu/ui/dsplmenu.cpp | 70 +++++++++++++++++++++++++++++++------------------ src/emu/ui/dsplmenu.h | 10 +++---- src/emu/ui/menu.cpp | 49 ++++++++++++++++------------------ src/emu/ui/selgame.cpp | 12 ++++----- src/emu/ui/selsoft.cpp | 9 +++---- src/emu/ui/ui.cpp | 5 ++-- src/emu/ui/ui.h | 2 +- src/emu/ui/utils.h | 3 --- 9 files changed, 90 insertions(+), 85 deletions(-) diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp index 2f8a8490a9b..72ab7509ae0 100644 --- a/src/emu/ui/datmenu.cpp +++ b/src/emu/ui/datmenu.cpp @@ -148,10 +148,9 @@ void ui_menu_command_content::populate() float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); std::vector xstart; std::vector xend; - int total_lines; convert_command_glyph(buffer); - machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), - total_lines, xstart, xend); + int total_lines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, + 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), xstart, xend); for (int r = 0; r < total_lines; r++) { std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); @@ -294,10 +293,8 @@ void ui_menu_history_sw::populate() float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); std::vector xstart; std::vector xend; - int total_lines; - - machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), - total_lines, xstart, xend); + int total_lines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), + xstart, xend); for (int r = 0; r < total_lines; r++) { @@ -544,9 +541,7 @@ bool ui_menu_dats::get_data(const game_driver *driver, int flags) float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); std::vector xstart; std::vector xend; - int tlines; - - machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), tlines, xstart, xend); + int tlines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), xstart, xend); for (int r = 0; r < tlines; r++) { std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp index cea63f34759..71ca4812cf8 100644 --- a/src/emu/ui/dsplmenu.cpp +++ b/src/emu/ui/dsplmenu.cpp @@ -21,17 +21,16 @@ #include "../osd/modules/lib/osdobj_common.h" #endif -ui_menu_display_options::video_modes ui_menu_display_options::m_video[] = { - { "auto", "Auto" }, - { "opengl", "OpenGL" }, -#if defined(UI_WINDOWS) && !defined(UI_SDL) - { "d3d", "Direct3D" }, - { "gdi", "GDI" }, - { "ddraw", "DirectDraw" } -#else - { "soft", "Software" }, - { "accel", "SDL2 Accelerated" } -#endif + +ui_menu_display_options::video_modes ui_menu_display_options::m_video = { + { "auto", "Auto" }, + { "opengl", "OpenGL" }, + { "bgfx", "BGFX" }, + { "d3d", "Direct3D" }, + { "gdi", "GDI" }, + { "ddraw", "DirectDraw" }, + { "soft", "Software" }, + { "accel", "SDL2 Accelerated" } }; ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = { @@ -65,9 +64,30 @@ ui_menu_display_options::ui_menu_display_options(running_machine &machine, rende for (int d = 2; d < ARRAY_LENGTH(m_options); ++d) m_options[d].status = options.int_value(m_options[d].option); + // create video list + m_list.push_back("auto"); + + std::string descr = options.description(OSDOPTION_VIDEO); + std::string delim = ", "; + descr.erase(0, descr.find(":") + 2); + size_t start = 0; + size_t end = descr.find_first_of(delim, start); + while (end != std::string::npos) + { + std::string name = descr.substr(start, end - start); + if (name != "none" && name != "or") + m_list.push_back(name); + start = descr.find_first_not_of(delim, end); + if (start == std::string::npos) + break; + end = descr.find_first_of(delim, start); + if (end == std::string::npos) + end = descr.size(); + } + m_options[1].status = 0; - for (int cur = 0; cur < ARRAY_LENGTH(m_video); ++cur) - if (!core_stricmp(options.video(), m_video[cur].option)) + for (int cur = 0; cur < m_list.size(); ++cur) + if (options.video() == m_list[cur]) { m_options[1].status = cur; break; @@ -83,15 +103,15 @@ ui_menu_display_options::~ui_menu_display_options() std::string error_string; for (int d = 2; d < ARRAY_LENGTH(m_options); ++d) { - if (machine().options().int_value(m_options[d].option)!=m_options[d].status) + if (machine().options().int_value(m_options[d].option) != m_options[d].status) { machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); machine().options().mark_changed(m_options[d].option); } } - if (strcmp(machine().options().value(m_options[1].option), m_video[m_options[1].status].option)!=0) + if (machine().options().value(m_options[1].option) != m_list[m_options[1].status]) { - machine().options().set_value(m_options[1].option, m_video[m_options[1].status].option, OPTION_PRIORITY_CMDLINE, error_string); + machine().options().set_value(m_options[1].option, m_list[m_options[1].status].c_str(), OPTION_PRIORITY_CMDLINE, error_string); machine().options().mark_changed(m_options[1].option); } @@ -122,10 +142,10 @@ void ui_menu_display_options::handle() } else if (m_event->iptkey == IPT_UI_SELECT && !strcmp(m_options[value].option, OSDOPTION_VIDEO)) { - int total = ARRAY_LENGTH(m_video); + int total = m_list.size(); std::vector s_sel(total); for (int index = 0; index < total; ++index) - s_sel[index] = m_video[index].label; + s_sel[index] = m_video[m_list[index]]; ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, m_options[value].status)); } @@ -148,15 +168,15 @@ void ui_menu_display_options::handle() void ui_menu_display_options::populate() { // add video mode option - std::string v_text(m_video[m_options[1].status].label); - UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_video) - 1, m_options[1].status); + std::string v_text(m_video[m_list[m_options[1].status]]); + UINT32 arrow_flags = get_arrow_flags(0, m_list.size() - 1, m_options[1].status); item_append(m_options[1].description, v_text.c_str(), arrow_flags, (void *)(FPTR)1); // add options items for (int opt = 2; opt < ARRAY_LENGTH(m_options); ++opt) if (strcmp(m_options[opt].option, OSDOPTION_PRESCALE) != 0) item_append(m_options[opt].description, m_options[opt].status ? "On" : "Off", - m_options[opt].status ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)opt); + m_options[opt].status ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)opt); else { strprintf(v_text, "%d", m_options[opt].status); @@ -176,8 +196,8 @@ void ui_menu_display_options::custom_render(void *selectedref, float top, float { float width; ui_manager &mui = machine().ui(); - mui.draw_text_full(container, "Display Options", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + mui.draw_text_full(container, "Display Options", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, + ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -196,6 +216,6 @@ void ui_menu_display_options::custom_render(void *selectedref, float top, float y1 += UI_BOX_TB_BORDER; // draw the text within it - mui.draw_text_full(container, "Display Options", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + mui.draw_text_full(container, "Display Options", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, + UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } diff --git a/src/emu/ui/dsplmenu.h b/src/emu/ui/dsplmenu.h index 364ce12844e..814304ec6bd 100644 --- a/src/emu/ui/dsplmenu.h +++ b/src/emu/ui/dsplmenu.h @@ -33,14 +33,12 @@ private: const char *option; }; - struct video_modes - { - const char *option; - const char *label; - }; + using video_modes = std::unordered_map; - static video_modes m_video[]; + static video_modes m_video; static dspl_option m_options[]; + + std::vector m_list; }; #endif /* __UI_DSPLMENU_H__ */ diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index da22c83e126..bd1eec20c05 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -459,7 +459,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) float ud_arrow_width = line_height * machine().render().ui_aspect(); float gutter_width = lr_arrow_width * 1.3f; - int selected_subitem_too_big = FALSE; + bool selected_subitem_too_big = false; int itemnum, linenum; bool mouse_hit, mouse_button; float mouse_x = -1, mouse_y = -1; @@ -662,7 +662,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) { subitem_text = "..."; if (itemnum == selected) - selected_subitem_too_big = TRUE; + selected_subitem_too_big = true; } // customize subitem text color @@ -1326,29 +1326,28 @@ void ui_menu::init_ui(running_machine &machine) for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x) { toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); + sw_toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); toolbar_texture[x] = mrender.texture_alloc(); + sw_toolbar_texture[x] = mrender.texture_alloc(); UINT32 *dst = &toolbar_bitmap[x]->pix32(0); memcpy(dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32)); if (toolbar_bitmap[x]->valid()) toolbar_texture[x]->set_bitmap(*toolbar_bitmap[x], toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32); else toolbar_bitmap[x]->reset(); - } - - // create a texture for toolbar - for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x) - { - sw_toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); - sw_toolbar_texture[x] = mrender.texture_alloc(); + if (x == 0 || x == 2) { - UINT32 *dst; dst = &sw_toolbar_bitmap[x]->pix32(0); memcpy(dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32)); - sw_toolbar_texture[x]->set_bitmap(*sw_toolbar_bitmap[x], sw_toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32); + if (sw_toolbar_bitmap[x]->valid()) + sw_toolbar_texture[x]->set_bitmap(*sw_toolbar_bitmap[x], sw_toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32); + else + sw_toolbar_bitmap[x]->reset(); } else sw_toolbar_bitmap[x]->reset(); + } } @@ -1361,7 +1360,7 @@ void ui_menu::draw_select_game(bool noinput) { float line_height = machine().ui().get_line_height(); float ud_arrow_width = line_height * machine().render().ui_aspect(); - float gutter_width = 0.4f * line_height * machine().render().ui_aspect() * 1.3f; + float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); mouse_x = -1, mouse_y = -1; float right_panel_size = (ui_globals::panels_status == HIDE_BOTH || ui_globals::panels_status == HIDE_RIGHT_PANEL) ? 2.0f * UI_BOX_LR_BORDER : 0.3f; float visible_width = 1.0f - 4.0f * UI_BOX_LR_BORDER; @@ -1381,14 +1380,14 @@ void ui_menu::draw_select_game(bool noinput) float visible_extra_menu_height = customtop + custombottom + extra_height; // locate mouse - mouse_hit = FALSE; - mouse_button = FALSE; + mouse_hit = false; + mouse_button = false; if (!noinput) { mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button); if (mouse_target != nullptr) if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y)) - mouse_hit = TRUE; + mouse_hit = true; } // account for extra space at the top and bottom @@ -1473,9 +1472,8 @@ void ui_menu::draw_select_game(bool noinput) // if we have some background hilighting to do, add a quad behind everything else if (bgcolor != UI_TEXT_BG_COLOR) - mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, - bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, - PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(255, 43, 43, 43), + hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); // if we're on the top line, display the up arrow if (linenum == 0 && top_line != 0) @@ -1498,7 +1496,7 @@ void ui_menu::draw_select_game(bool noinput) // if we're just a divider, draw a line else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, - UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); // draw the item centered else if (pitem.subtext == nullptr) { @@ -1518,9 +1516,8 @@ void ui_menu::draw_select_game(bool noinput) space = mui.get_line_height() * container->manager().ui_aspect() * 1.5f; } - mui.draw_text_full(container, itemtext, effective_left + space, line_y, effective_width - space, - JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, - bgcolor, nullptr, nullptr); + mui.draw_text_full(container, itemtext, effective_left + space, line_y, effective_width - space, JUSTIFY_LEFT, WRAP_TRUNCATE, + DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr); } else { @@ -1573,14 +1570,14 @@ void ui_menu::draw_select_game(bool noinput) // if we have some background hilighting to do, add a quad behind everything else if (bgcolor != UI_TEXT_BG_COLOR) mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(255, 43, 43, 43), - hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) container->add_line(visible_left, line + 0.5f * line_height, visible_left + visible_width, line + 0.5f * line_height, - UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); else - mui.draw_text_full(container, itemtext, effective_left, line, effective_width, - JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + mui.draw_text_full(container, itemtext, effective_left, line, effective_width, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); line += line_height; } diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 9642826e024..2b5139f6cc3 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -650,7 +650,7 @@ void ui_menu_select_game::populate() { UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; - if (old_item_selected == -1 && !reselect_last::driver.empty() && m_displaylist[curitem]->name == reselect_last::driver) + if (old_item_selected == -1 && m_displaylist[curitem]->name == reselect_last::driver) old_item_selected = curitem; bool cloneof = strcmp(m_displaylist[curitem]->parent, "0"); @@ -678,7 +678,7 @@ void ui_menu_select_game::populate() UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW | MENU_FLAG_UI_FAVORITE; if (mfavorite.startempty == 1) { - if (old_item_selected == -1 && !reselect_last::driver.empty() && mfavorite.shortname == reselect_last::driver) + if (old_item_selected == -1 && mfavorite.shortname == reselect_last::driver) old_item_selected = curitem; bool cloneof = strcmp(mfavorite.driver->parent, "0"); @@ -695,7 +695,7 @@ void ui_menu_select_game::populate() } else { - if (old_item_selected == -1 && !reselect_last::driver.empty() && mfavorite.shortname == reselect_last::driver) + if (old_item_selected == -1 && mfavorite.shortname == reselect_last::driver) old_item_selected = curitem; item_append(mfavorite.longname.c_str(), mfavorite.devicetype.c_str(), mfavorite.parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui), (void *)&mfavorite); @@ -2217,9 +2217,9 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or return; } else if (ui_globals::curdats_view != UI_STORY_LOAD && ui_globals::curdats_view != UI_COMMAND_LOAD) - mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, xstart, xend, text_size); + totallines = mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size); else - mui.wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * gutter_width), totallines, xstart, xend, text_size); + totallines = mui.wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * gutter_width), xstart, xend, text_size); int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size)); if (totallines < r_visible_lines) @@ -2364,7 +2364,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or return; } else - mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, xstart, xend, text_size); + totallines = mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size); int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size)); if (totallines < r_visible_lines) diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index fc3d21b550d..5d1acb27c34 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -19,7 +19,6 @@ #include "ui/datfile.h" #include "ui/inifile.h" #include "ui/selector.h" -#include "ui/custmenu.h" #include "rendfont.h" #include "rendutil.h" #include "softlist.h" @@ -416,8 +415,7 @@ void ui_menu_select_software::populate() if (reselect_last::software == "[Start empty]" && !reselect_last::driver.empty()) old_software = 0; - else if (!reselect_last::software.empty() && m_displaylist[curitem]->shortname == reselect_last::software - && m_displaylist[curitem]->listname == reselect_last::swlist) + else if (m_displaylist[curitem]->shortname == reselect_last::software && m_displaylist[curitem]->listname == reselect_last::swlist) old_software = m_has_empty_start ? curitem + 1 : curitem; item_append(m_displaylist[curitem]->longname.c_str(), m_displaylist[curitem]->devicetype.c_str(), @@ -822,7 +820,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) if (ui_swinfo->startempty == 1) { std::vector biosname; - if (has_multiple_bios(ui_swinfo->driver, biosname) && !mopt.skip_bios_menu()) + if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo->driver, false, true)); else { @@ -1479,8 +1477,7 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa return; } else - mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, - xstart, xend, text_size); + totallines = mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size); int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size)); if (totallines < r_visible_lines) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 6d996ac50a0..013f1c5c4bb 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -2591,7 +2591,7 @@ void ui_manager::set_use_natural_keyboard(bool use_natural_keyboard) // wrap_text //------------------------------------------------- -void ui_manager::wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, int &count, std::vector &xstart, std::vector &xend, float text_size) +int ui_manager::wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, std::vector &xstart, std::vector &xend, float text_size) { float lineheight = get_line_height() * text_size; const char *ends = origs + strlen(origs); @@ -2600,7 +2600,7 @@ void ui_manager::wrap_text(render_container *container, const char *origs, float const char *linestart; float maxwidth = 0; float aspect = machine().render().ui_aspect(container); - count = 0; + int count = 0; // loop over lines while (*s != 0) @@ -2716,6 +2716,7 @@ void ui_manager::wrap_text(render_container *container, const char *origs, float break; } } + return count; } //------------------------------------------------- diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h index 5a07a0800b5..9cfdfe4241a 100644 --- a/src/emu/ui/ui.h +++ b/src/emu/ui/ui.h @@ -172,7 +172,7 @@ public: void process_natural_keyboard(); // word wrap - void wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, int &totallines, std::vector &xstart, std::vector &xend, float text_size = 1.0f); + int wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, std::vector &xstart, std::vector &xend, float text_size = 1.0f); // draw an outlined box with given line color and filled with a texture void draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture = nullptr, UINT32 flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index 473ac5f32ea..f89b27d88e8 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -16,9 +16,6 @@ #include "osdepend.h" #include "render.h" #include "libjpeg/jpeglib.h" -//#include -//#include "drivenum.h" -//#include #define MAX_CHAR_INFO 256 #define MAX_CUST_FILTER 8 -- cgit v1.2.3-70-g09d2 From 8b509eedd9e23b1453e0e3755da12a1d341c6770 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 8 Feb 2016 01:25:22 +0100 Subject: New NOT_WORKING machine added ------------- Mattel Computer Gin [hap, Kevin Horton] - bad dump likely, locks up right at boot doing nonsense code --- src/mame/drivers/hh_ucom4.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp index 8c4bab84e3b..1c54ff21e37 100644 --- a/src/mame/drivers/hh_ucom4.cpp +++ b/src/mame/drivers/hh_ucom4.cpp @@ -1594,9 +1594,7 @@ public: { } void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE8_MEMBER(speaker_w); + DECLARE_WRITE8_MEMBER(unk_w); }; // handlers @@ -1605,20 +1603,41 @@ void mcompgin_state::prepare_display() { } -WRITE8_MEMBER(mcompgin_state::speaker_w) +WRITE8_MEMBER(mcompgin_state::unk_w) { + // E=lcd } // config static INPUT_PORTS_START( mcompgin ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) // 21 select + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) // 23 deal + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) // 22 discard + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) // 20 draw + + PORT_START("IN.1") // port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) // 24 comp + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) // 25 score + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON7 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON8 ) INPUT_PORTS_END static MACHINE_CONFIG_START( mcompgin, mcompgin_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", NEC_D650, 400000) // approximation + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(mcompgin_state, unk_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(mcompgin_state, unk_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(mcompgin_state, unk_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(mcompgin_state, unk_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(mcompgin_state, unk_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(mcompgin_state, unk_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(mcompgin_state, unk_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_mcompgin) @@ -2501,7 +2520,7 @@ ROM_END ROM_START( mcompgin ) ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d650c-060", 0x0000, 0x0800, CRC(92a4d8be) SHA1(d67f14a2eb53b79a7d9eb08103325299bc643781) ) + ROM_LOAD( "d650c-060", 0x0000, 0x0800, BAD_DUMP CRC(92a4d8be) SHA1(d67f14a2eb53b79a7d9eb08103325299bc643781) ) ROM_END -- cgit v1.2.3-70-g09d2 From 4710c9c26391c8287c1786c18d69b1d7e9a36f7a Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Mon, 8 Feb 2016 01:53:08 +0100 Subject: suppressed C4592 warning in VS 2015. (nw) --- scripts/genie.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/genie.lua b/scripts/genie.lua index 7883eb6a0b4..34705beefa5 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1234,6 +1234,7 @@ configuration { "vs2015" } "/wd4463", -- warning C4463: overflow; assigning 1 to bit-field that can only hold values from -1 to 0 "/wd4297", -- warning C4297: 'xxx::~xxx': function assumed not to throw an exception but does "/wd4319", -- warning C4319: 'operator' : zero extending 'type' to 'type' of greater size + "/wd4592", -- warning C4592: symbol will be dynamically initialized (implementation limitation) } configuration { "winphone8* or winstore8*" } removelinks { -- cgit v1.2.3-70-g09d2 From c325f1c988944a8872783621b9f5d9200aa669d4 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Sun, 7 Feb 2016 22:00:17 -0300 Subject: New clones added or promoted from NOT_WORKING status ---------------------------------------------------- Moon Light (bootleg of Golden Star, set 2) [f205v, Roberto Fresca] --- src/mame/arcade.lst | 1 + src/mame/drivers/goldstar.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 0e7f947520a..92a07f211c9 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -10074,6 +10074,7 @@ haekaka // (c) 2001 Sammy goldstar // (c) 198? IGS goldstbl // (c) 198? IGS moonlght // bootleg +moonlghtb // bootleg chry10 // bootleg chrygld // bootleg goldfrui // bootleg diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index e4a1485a892..989f85ffbb7 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -8211,6 +8211,8 @@ ROM_START( chrygld ) ROM_END +/* Moon Light (set 1) +*/ ROM_START( moonlght ) ROM_REGION( 0x20000, "maincpu", 0 ) ROM_LOAD( "4.bin", 0x0000, 0x20000, CRC(ecb06cfb) SHA1(e32613cac5583a0fecf04fca98796b91698e530c) ) @@ -8225,6 +8227,53 @@ ROM_START( moonlght ) ROM_LOAD( "gs1-snd.bin", 0x0000, 0x20000, CRC(9d58960f) SHA1(c68edf95743e146398aabf6b9617d18e1f9bf25b) ) ROM_END +/* Moon Light (set 2) + + GFX devices are 4 times bigger and contains 4 times the same data. + Maybe the manufacturers run out of proper devices... + + The background is not set properly due to a palette error. The program ROM stores + the palette at offset 0xC700 onwards... The value stored at 0xC780 (color 0x80) should + be black to mask the reels tilemaps and turn them 'invisible'. This program has a value + of 0x40 instead, turning the tilemaps blue and therefore visible. The results is an odd + effect that shouldn't be there. Maybe is product of a bad dump. Need to be checked with + the real board. + + Also the cards gfx are corrupt. Tiles are ok, so maybe the code is triggering wrong + pointers to the tiles. + +28.bin FIXED BITS (00xxxxxx) +29.bin 00xxxxxxxxxxxxxxx = 0xFF + moon-gfx1.bin BADADDR --xxxxxxxxxxxxxxxxx + moon-gfx2.bin FIXED BITS (00xxxxxx) + moon-gfx2.bin BADADDR --xxxxxxxxxxxxxxxxx +29.bin moon-gfx1.bin [1/4] IDENTICAL +29.bin moon-gfx1.bin [2/4] IDENTICAL +29.bin moon-gfx1.bin [3/4] IDENTICAL +29.bin moon-gfx1.bin [4/4] IDENTICAL +4.bin [1/4] moon-main.bin [1/4] 99.615479% +4.bin [3/4] moon-main.bin [3/4] 99.426270% +4.bin [2/4] moon-main.bin [2/4] 97.201538% +4.bin [4/4] moon-main.bin [4/4] 95.953369% +28.bin moon-gfx2.bin [1/4] 94.188690% +28.bin moon-gfx2.bin [2/4] 94.188690% +28.bin moon-gfx2.bin [3/4] 94.188690% +28.bin moon-gfx2.bin [4/4] 94.188690% +*/ +ROM_START( moonlghtb ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "moon-main.bin", 0x0000, 0x20000, CRC(0a4b5dd0) SHA1(825801e9b72c10fed8e07f42b3b475688bdbd878) ) + + ROM_REGION( 0x80000, "gfx1", 0 ) + ROM_LOAD( "moon-gfx2.bin", 0x00000, 0x80000, CRC(2ce5b722) SHA1(feb87fbf3b8d875842df80cd1edfef5071ed60c7) ) + + ROM_REGION( 0x80000, "gfx2", 0 ) + ROM_LOAD( "moon-gfx1.bin", 0x00000, 0x80000, CRC(ea7d4234) SHA1(4016227aabf176c6e0fd822ebc59cade811f4ce8) ) + + ROM_REGION( 0x40000, "oki", 0 ) /* Audio ADPCM */ + ROM_LOAD( "moon-sound.bin", 0x0000, 0x20000, CRC(9d58960f) SHA1(c68edf95743e146398aabf6b9617d18e1f9bf25b) ) +ROM_END + /* Gold Fruit @@ -13274,7 +13323,8 @@ DRIVER_INIT_MEMBER(goldstar_state, wcherry) YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS LAYOUT */ GAMEL( 199?, goldstar, 0, goldstar, goldstar, goldstar_state, goldstar, ROT0, "IGS", "Golden Star", 0, layout_goldstar ) GAMEL( 199?, goldstbl, goldstar, goldstbl, goldstar, driver_device, 0, ROT0, "IGS", "Golden Star (Blue version)", 0, layout_goldstar ) -GAME( 199?, moonlght, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (bootleg of Golden Star)", 0 ) +GAME( 199?, moonlght, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (bootleg of Golden Star, set 1)", 0 ) +GAME( 199?, moonlghtb, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (bootleg of Golden Star, set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_COLORS ) // need to check the odd palette value at 0xc780. should be black. also cards gfx are corrupt. GAMEL( 199?, chrygld, 0, chrygld, chrygld, cb3_state, chrygld, ROT0, "bootleg", "Cherry Gold I", 0, layout_chrygld ) GAMEL( 199?, chry10, 0, chrygld, chry10, cb3_state, chry10, ROT0, "bootleg", "Cherry 10 (bootleg with PIC16F84)", 0, layout_chrygld ) GAME( 199?, goldfrui, goldstar, goldfrui, goldstar, driver_device, 0, ROT0, "bootleg", "Gold Fruit", 0 ) // maybe fullname should be 'Gold Fruit (main 40%)' -- cgit v1.2.3-70-g09d2 From 9205d549a775eba342e6b5ad00dd5ac27c3ce40a Mon Sep 17 00:00:00 2001 From: arbee Date: Sun, 7 Feb 2016 21:11:28 -0500 Subject: apple1: completely rewrote the driver in modern idioms. All functionality should be the same. [R. Belmont] --- src/mame/drivers/apple1.cpp | 725 ++++++++++++++++++++++++++++++-------------- src/mame/includes/apple1.h | 92 ------ src/mame/machine/apple1.cpp | 404 ------------------------ src/mame/video/apple1.cpp | 392 ------------------------ 4 files changed, 505 insertions(+), 1108 deletions(-) delete mode 100644 src/mame/includes/apple1.h delete mode 100644 src/mame/machine/apple1.cpp delete mode 100644 src/mame/video/apple1.cpp diff --git a/src/mame/drivers/apple1.cpp b/src/mame/drivers/apple1.cpp index a99810887bc..65e2d0604e1 100644 --- a/src/mame/drivers/apple1.cpp +++ b/src/mame/drivers/apple1.cpp @@ -1,197 +1,509 @@ -// license:??? -// copyright-holders:Paul Daniels, Colin Howell, R. Belmont -/********************************************************************** +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + apple1.cpp - Apple I + + Next generation driver written in February 2016 by R. Belmont. + Thanks to the original crew. + + Apple I has: + 6502 @ 1.023 MHz (~0.960 MHz with RAM refresh) + 4 or 8 KB RAM on-board + 256 byte Monitor ROM + No IRQs, no sound, dumb terminal video + 6820 PIA for keyboard / terminal interface + + ------------------------------------------------------------------- + + How to use cassettes: + The system has no error checking or checksums, and the cassette + has no header. + Therefore, you must know the details, and pass these to the + interface yourself. + + BASIC has no cassette handling. You must enter the monitor + with: CALL -151 + then when finished, re-enter BASIC with: E2B3R + + Examples: + + A machine-language program will typically be like this: + C100R (enter the interface) + 0300.0FFFR (enter the load and end addresses, then load the tape) + You start the tape. + When the prompt returns you stop the tape. + 0300R (run your program) + + + To Load Tape Basic: + C100R + E000.EFFFR + You start the tape. + When the prompt returns you stop the tape. + E000R (It must say 4C - if not, your tape is no good). + The BASIC prompt will appear + >@ + + + A BASIC program is split into two areas, one for the scratch pad, + and one for the program proper. + In BASIC you may have to adjust the allowed memory area, such as + LOMEM = 768 + Then, go to the monitor: CALL -151 + C100R (enter the interface) + 00A4.00FFR 0300.0FFFR (load the 2 parts) + You start the tape. + When the prompt returns you stop the tape. + E2B3R (back to BASIC) + You can LIST or RUN now. + + + Saving is almost the same, when you specify the address range, enter + W instead of R. The difficulty is finding out how long your program is. + + Insert a blank tape + C100R + 0300.0FFFW + Quickly press Record. + When the prompt returns, press Stop. -Apple I - -CPU: 6502 @ 1.023 MHz - (Effective speed with RAM refresh waits is 0.960 MHz.) - -RAM: 4-8 KB on main board (4 KB standard) - - Additional memory could be added via the expansion - connector, but the user was responsible for making sure - the extra memory was properly interfaced. - - Some users replaced the onboard 4-kilobit RAM chips with - 16-kilobit RAM chips, increasing on-board memory to 32 KB, - but this required modifying the RAM interface circuitry. - -ROM: 256 bytes for Monitor program - - Optional cassette interface included 256 bytes for - cassette routines. - -Interrupts: None. - (The system board had jumpers to allow interrupts, but - these were not connected in a standard system.) - -Video: Dumb terminal, based on 7 1K-bit shift registers - -Sound: None - -Hardware: Motorola 6820 PIA for keyboard and display interface - -Memory map: - -$0000-$1FFF: RAM address space - $0000-$00FF: 6502 zero page - $0024-$002B: Zero page locations used by the Monitor - $0100-$01FF: 6502 processor stack - $0200-$027F: Keyboard input buffer storage used by the Monitor - $0280-$0FFF: RAM space available for a program in a 4 KB system - $1000-$1FFF: Extra RAM space available for a program in an 8 KB system - not using cassette BASIC - -$2000-$BFFF: Unused address space, available for RAM in systems larger - than 8 KB. - -$C000-$CFFF: Address space for optional cassette interface - $C000-$C0FF: Cassette interface I/O range - $C100-$C1FF: Cassette interface ROM - -$D000-$DFFF: I/O address space - $D010-$D013: Motorola 6820 PIA registers. - $D010: Keyboard input port - $D011: Control register for keyboard input port, with - key-available flag. - $D012: Display output port (bit 7 is a status input) - $D013: Control register for display output port - (PIA registers also mirrored at $D014-$D017, $D018-$D01B, $D01C-$D01F, - $D030-$D03F, $D050-$D05F, ... , $DFD0-$DFDF, $DFF0-$DFFF.) - -$E000-$EFFF: Extra RAM space available for a program in an 8 KB system - modified to use cassette BASIC - (The system simulated here always includes this RAM.) - -If you wanted to load the BASIC as rom, here are the details: -ROM_LOAD("basic.bin", 0xE000, 0x1000, CRC(d5e86efc) SHA1(04269c1c66e7d5b4aa5035462c6e612bf2ae9b91) ) - - -$F000-$FFFF: ROM address space - $FF00-$FFFF: Apple Monitor ROM - - -How to use cassettes: -The system has no error checking or checksums, and the cassette -has no header. -Therefore, you must know the details, and pass these to the -interface yourself. -BASIC has no cassette handling. You must enter the monitor -with: CALL -151 -then when finished, re-enter BASIC with: E2B3R +**********************************************************************/ +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/6821pia.h" +#include "imagedev/snapquik.h" +#include "machine/ram.h" -Examples: +#include "bus/a1bus/a1bus.h" +#include "bus/a1bus/a1cassette.h" +#include "bus/a1bus/a1cffa.h" -A machine-language program will typically be like this: -C100R (enter the interface) -0300.0FFFR (enter the load and end addresses, then load the tape) -You start the tape. -When the prompt returns you stop the tape. -0300R (run your program) +#include "softlist.h" +#define A1_CPU_TAG "maincpu" +#define A1_PIA_TAG "pia6821" +#define A1_BUS_TAG "a1bus" +#define A1_BASICRAM_TAG "basicram" -To Load Tape Basic: -C100R -E000.EFFFR -You start the tape. -When the prompt returns you stop the tape. -E000R (It must say 4C - if not, your tape is no good). -The BASIC prompt will appear ->@ +class apple1_state : public driver_device +{ +public: + apple1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, A1_CPU_TAG), + m_pia(*this, A1_PIA_TAG), + m_ram(*this, RAM_TAG), + m_basicram(*this, A1_BASICRAM_TAG), + m_kb0(*this, "KEY0"), + m_kb1(*this, "KEY1"), + m_kb2(*this, "KEY2"), + m_kb3(*this, "KEY3"), + m_kbspecial(*this, "KBSPECIAL") + { } + + required_device m_maincpu; + required_device m_pia; + required_device m_ram; + required_shared_ptr m_basicram; + required_ioport m_kb0, m_kb1, m_kb2, m_kb3, m_kbspecial; + + virtual void machine_start() override; + virtual void machine_reset() override; + + DECLARE_PALETTE_INIT(apple2); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER(ram_r); + DECLARE_WRITE8_MEMBER(ram_w); + DECLARE_READ8_MEMBER(pia_keyboard_r); + DECLARE_WRITE8_MEMBER(pia_display_w); + DECLARE_WRITE_LINE_MEMBER(pia_display_gate_w); + DECLARE_SNAPSHOT_LOAD_MEMBER( apple1 ); + TIMER_CALLBACK_MEMBER(ready_start_cb); + TIMER_CALLBACK_MEMBER(ready_end_cb); + TIMER_CALLBACK_MEMBER(keyboard_strobe_cb); + +private: + UINT8 *m_ram_ptr, *m_char_ptr; + int m_ram_size, m_char_size; + + UINT8 m_vram[40*24]; + int m_cursx, m_cursy; + + bool m_reset_down; + bool m_clear_down; + + UINT8 m_transchar; + UINT16 m_lastports[4]; + + void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, const UINT8 *textgfx_data, UINT32 textgfx_datalen); + void poll_keyboard(); + + emu_timer *m_ready_start_timer, *m_ready_end_timer, *m_kbd_strobe_timer; +}; +static const UINT8 apple1_keymap[] = +{ + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '=', '[', ']', ';', '\'', // KEY0 + ',', '.', '/', '\\', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', // KEY1 + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '\r', '_', // KEY2 + ' ', '\x1b', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // KEY3 -A BASIC program is split into two areas, one for the scratch pad, -and one for the program proper. -In BASIC you may have to adjust the allowed memory area, such as -LOMEM = 768 -Then, go to the monitor: CALL -151 -C100R (enter the interface) -00A4.00FFR 0300.0FFFR (load the 2 parts) -You start the tape. -When the prompt returns you stop the tape. -E2B3R (back to BASIC) -You can LIST or RUN now. + ')', '!', '@', '#', '$', '%', '^', '&', '*', '(', '_', '+', '[', ']', ':', '"', // KEY0 + shift + '<', '>', '?', '\\', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', // KEY1 + shift + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '\r', '_', // KEY2 + shift + ' ', '\x1b', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // KEY3 + shift + '0', '1', '\x00', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', '8', '9', '\x1f', '=', '\x1b', '\x1d', ';', '\'', // KEY0 + CTRL + ',', '.', '/', '\x1c', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', // KEY1 + CTRL + '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\r', '_', // KEY2 + CTRL + ' ', '\x1b', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // KEY3 + CTRL -Saving is almost the same, when you specify the address range, enter -W instead of R. The difficulty is finding out how long your program is. +}; -Insert a blank tape -C100R -0300.0FFFW -Quickly press Record. -When the prompt returns, press Stop. +// header is "LOAD:abcdDATA:" where abcd is the starting address +SNAPSHOT_LOAD_MEMBER( apple1_state, apple1 ) +{ + UINT64 snapsize; + UINT8 *data; + UINT16 start, end; + static const char hd1[6] = "LOAD:"; + static const char hd2[6] = "DATA:"; + + // get the snapshot's size + snapsize = image.length(); + + if (snapsize < 12) + { + logerror("Snapshot is too short\n"); + return IMAGE_INIT_FAIL; + } + + if ((snapsize - 12) > 65535) + { + logerror("Snapshot is too long\n"); + return IMAGE_INIT_FAIL; + } + + data = (UINT8 *)image.ptr(); + if (!data) + { + logerror("Internal error loading snapshot\n"); + return IMAGE_INIT_FAIL; + } + + if ((memcmp(hd1, data, 5)) || (memcmp(hd2, &data[7], 5))) + { + logerror("Snapshot is invalid\n"); + return IMAGE_INIT_FAIL; + } + + start = (data[5]<<8) | data[6]; + end = (snapsize - 12) + start; + + // check if this fits in RAM; load below 0xe000 must fit in RAMSIZE, + // load at 0xe000 must fit in 4K + if (((start < 0xe000) && (end > (m_ram_size - 1))) || (end > 0xefff)) + { + logerror("Snapshot can't fit in RAM\n"); + return IMAGE_INIT_FAIL; + } + + if (start < 0xe000) + { + memcpy(m_ram_ptr + start, &data[12], snapsize - 12); + } + else if ((start >= 0xe000) && (start <= 0xefff)) + { + memcpy(m_basicram + (start - 0xe000), &data[12], snapsize - 12); + } + else + { + logerror("Snapshot has invalid load address %04x\n", start); + return IMAGE_INIT_FAIL; + } + + return IMAGE_INIT_PASS; +} + +void apple1_state::poll_keyboard() +{ + UINT8 special = m_kbspecial->read(); + UINT16 ports[4]; + int rawkey = 0; + bool bKeypress = false; + + // handle special keys first: + if (special & 0x10) // RESET + { + m_reset_down = true; + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_pia->reset(); + } + else if (m_reset_down) + { + m_reset_down = false; + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + } + + if (special & 0x20) // CLEAR SCREEN + { + m_clear_down = true; + memset(m_vram, 0, sizeof(m_vram)); + m_cursx = m_cursy = 0; + } + else + { + m_clear_down = false; + } + + // lower the keyboard strobe + m_pia->ca1_w(0); + + // cache all the rows + ports[0] = m_kb0->read(); + ports[1] = m_kb1->read(); + ports[2] = m_kb2->read(); + ports[3] = m_kb3->read(); + + for (int port = 0; port < 4; port++) + { + UINT16 ptread = ports[port] ^ m_lastports[port]; + + for (int bit = 0; bit < 16; bit++) + { + // key changed? + if (ptread & (1 << bit)) + { + // key down? + if (ports[port] & (1 << bit)) + { + rawkey = (port * 16) + bit; + m_lastports[port] |= (1 << bit); + port = 4; // force outer for loop to quit too + bKeypress = true; + } + else // key up + { + m_lastports[port] &= ~(1 << bit); + } + break; + } + } + } + + if (bKeypress) + { + if ((special & 0xc) != 0) + { + m_transchar = apple1_keymap[rawkey + (8*16)]; + } + else if ((special & 0x3) != 0) + { + m_transchar = apple1_keymap[rawkey + (4*16)]; + } + else + { + m_transchar = apple1_keymap[rawkey]; + } + // pulse the strobe line + m_pia->ca1_w(1); + } +} + +void apple1_state::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, + const UINT8 *textgfx_data, UINT32 textgfx_datalen) +{ + int x, y, i; + const UINT8 *chardata; + UINT16 color; + int fg = 1, bg = 0; + int charcode = (code & 0x1f) | (((code ^ 0x40) & 0x40) >> 1); + + /* look up the character data */ + chardata = &textgfx_data[(charcode * 8)]; + + for (y = 0; y < 8; y++) + { + for (x = 0; x < 7; x++) + { + color = (chardata[y] & (1 << (6-x))) ? fg : bg; + + for (i = 0; i < xscale; i++) + { + bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + } + } + } +} + +UINT32 apple1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int vramad; + int cursor_blink = 0; + UINT8 curs_save = 0; + + poll_keyboard(); + + // the cursor 555 timer counts 0.52 of a second; the cursor is ON for + // 2 of those counts and OFF for the last one. + if (((int)(machine().time().as_double() / (0.52 / 3.0)) % 3) < 2) + { + curs_save = m_vram[(m_cursy * 40) + m_cursx]; + m_vram[(m_cursy * 40) + m_cursx] = 0x40; + cursor_blink = 1; + } + + for (int row = 0; row < cliprect.max_y; row += 8) + { + for (int col = 0; col < 40; col++) + { + vramad = ((row/8) * 40) + col; + + plot_text_character(bitmap, col * 14, row, 2, m_vram[vramad], + m_char_ptr, m_char_size); + } + } + + if (cursor_blink) + { + m_vram[(m_cursy * 40) + m_cursx] = curs_save; + } + + return 0; +} + +void apple1_state::machine_start() +{ + m_ram_ptr = m_ram->pointer(); + m_ram_size = m_ram->size(); + m_char_ptr = memregion("gfx1")->base(); + m_char_size = memregion("gfx1")->bytes(); -**********************************************************************/ + m_reset_down = m_clear_down = false; -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "machine/6821pia.h" -#include "includes/apple1.h" -#include "imagedev/snapquik.h" -#include "machine/ram.h" + m_ready_start_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple1_state::ready_start_cb), this)); + m_ready_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple1_state::ready_end_cb), this)); + m_kbd_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple1_state::keyboard_strobe_cb), this)); +} -#include "bus/a1bus/a1bus.h" -#include "bus/a1bus/a1cassette.h" -#include "bus/a1bus/a1cffa.h" +void apple1_state::machine_reset() +{ + memset(m_vram, 0, sizeof(m_vram)); + m_transchar = 0; + m_cursx = m_cursy = 0; + m_lastports[0] = m_lastports[1] = m_lastports[2] = m_lastports[3] = 0; +} -#include "softlist.h" +READ8_MEMBER(apple1_state::ram_r) +{ + if (offset < m_ram_size) + { + return m_ram_ptr[offset]; + } -/* port i/o functions */ + return 0xff; +} -/* memory w/r functions */ +WRITE8_MEMBER(apple1_state::ram_w) +{ + if (offset < m_ram_size) + { + m_ram_ptr[offset] = data; + } +} static ADDRESS_MAP_START( apple1_map, AS_PROGRAM, 8, apple1_state ) - /* In $D000-$DFFF, PIA is selected by address bit 4 being high, - and PIA registers are addressed with address bits 0-1. All - other address bits are ignored. Thus $D010-$D013 is mirrored - at all $Dxxx addresses with bit 4 high. */ - AM_RANGE(0xd010, 0xd013) AM_MIRROR(0x0fec) AM_DEVREADWRITE("pia",pia6821_device, read, write) + AM_RANGE(0x0000, 0xbfff) AM_READWRITE(ram_r, ram_w) + AM_RANGE(0xd010, 0xd013) AM_MIRROR(0x0fec) AM_DEVREADWRITE(A1_PIA_TAG, pia6821_device, read, write) + AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE(A1_BASICRAM_TAG) + AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION(A1_CPU_TAG, 0) +ADDRESS_MAP_END - /* We always include the remapped RAM for cassette BASIC, both for - simplicity and to allow the running of BASIC programs. */ - AM_RANGE(0xe000, 0xefff) AM_RAM +READ8_MEMBER(apple1_state::pia_keyboard_r) +{ + return m_transchar | 0x80; // bit 7 is wired high, similar-ish to the Apple II +} - AM_RANGE(0xf000, 0xfeff) AM_NOP +WRITE8_MEMBER(apple1_state::pia_display_w) +{ + data &= 0x7f; // D7 is ignored by the video h/w + + // ignore characters if CLEAR is down + if (m_clear_down) + { + return; + } + + // video h/w rejects control characters except CR + if ((data < 32) && (data != '\r')) + { + return; + } + + if (data == '\r') + { + m_cursx = 0; + m_cursy++; + } + else + { + m_vram[(m_cursy * 40) + m_cursx] = data; + + m_cursx++; + if (m_cursx > 39) + { + m_cursx = 0; + m_cursy++; + } + } + + // scroll the screen if we're at the bottom + if (m_cursy > 23) + { + for (int sy = 0; sy < 23; sy++) + { + memcpy(&m_vram[sy * 40], &m_vram[(sy + 1) * 40], 40); + } + memset(&m_vram[23*40], 0, 40); + m_cursy = 23; + } +} + +// CB2 here is connected two places: Port B bit 7 for CPU readback, +// and to the display hardware +WRITE_LINE_MEMBER(apple1_state::pia_display_gate_w) +{ + m_pia->portb_w((state << 7) ^ 0x80); - /* Monitor ROM: */ - AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("maincpu", 0) -ADDRESS_MAP_END + // falling edge means start the display timer + if (state == CLEAR_LINE) + { + m_ready_start_timer->adjust(machine().first_screen()->time_until_pos(m_cursy, m_cursx)); + } +} -/* graphics output */ +TIMER_CALLBACK_MEMBER(apple1_state::ready_start_cb) +{ + // we're ready, pulse CB1 for 3500 nanoseconds + m_pia->cb1_w(0); + m_ready_end_timer->adjust(attotime::from_nsec(3500)); +} -const gfx_layout apple1_charlayout = +TIMER_CALLBACK_MEMBER(apple1_state::ready_end_cb) { - 7, 8, /* character cell is 7 pixels wide by 8 pixels high */ - 64, /* 64 characters in 2513 character generator ROM */ - 1, /* 1 bitplane */ - { 0 }, - /* 5 visible pixels per row, starting at bit 3, with MSB being 0: */ - { 3, 4, 5, 6, 7 }, - /* pixel rows stored from top to bottom: */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8 * 8 /* 8 8-bit pixel rows per character */ -}; + m_pia->cb1_w(1); +} -static GFXDECODE_START( apple1 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, apple1_charlayout, 0, 1 ) -GFXDECODE_END - -/* keyboard input */ -/* - It's very likely that the keyboard assgnments are totally wrong: the code in machine/apple1.c - makes arbitrary assumptions about the mapping of the keys. The schematics that are available - on the web can help revealing the real layout. - The large picture of Woz's Apple I at http://home.earthlink.net/~judgementcall/apple1.jpg - show probably how the real keyboard was meant to be: note how the shifted symbols on the digits - and on some letters are different from the ones produced by current emulation and the presence - of the gray keys. -*/ +TIMER_CALLBACK_MEMBER(apple1_state::keyboard_strobe_cb) +{ + m_pia->ca1_w(0); +} static INPUT_PORTS_START( apple1 ) - PORT_START("KEY0") /* first sixteen keys */ + PORT_START("KEY0") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') @@ -209,7 +521,7 @@ static INPUT_PORTS_START( apple1 ) PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_START("KEY1") /* second sixteen keys */ + PORT_START("KEY1") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') @@ -227,7 +539,7 @@ static INPUT_PORTS_START( apple1 ) PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_START("KEY2") /* third sixteen keys */ + PORT_START("KEY2") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') @@ -243,21 +555,19 @@ static INPUT_PORTS_START( apple1 ) PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backarrow") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('_') + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('_') - PORT_START("KEY3") /* fourth sixteen keys */ + PORT_START("KEY3") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_START("KEY4") /* shift keys */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control (Left)") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control (Right)") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START("KEY5") /* RESET and CLEAR SCREEN pushbutton switches */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_START("KBSPECIAL") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Control") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) INPUT_PORTS_END static SLOT_INTERFACE_START(apple1_cards) @@ -265,69 +575,44 @@ static SLOT_INTERFACE_START(apple1_cards) SLOT_INTERFACE("cffa", A1BUS_CFFA) SLOT_INTERFACE_END -/* machine definition */ static MACHINE_CONFIG_START( apple1, apple1_state ) - /* basic machine hardware */ - /* Actual CPU speed is 1.023 MHz, but RAM refresh effectively - slows it to 960 kHz. */ - MCFG_CPU_ADD("maincpu", M6502, 960000) /* 1.023 MHz */ + MCFG_CPU_ADD(A1_CPU_TAG, M6502, 960000) // effective CPU speed MCFG_CPU_PROGRAM_MAP(apple1_map) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - + // video timings are identical to the Apple II, unsurprisingly MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - /* Video is blanked for 70 out of 262 scanlines per refresh cycle. - Each scanline is composed of 65 character times, 40 of which - are visible, and each character time is 7 dot times; a dot time - is 2 cycles of the fundamental 14.31818 MHz oscillator. The - total blanking time is about 4450 microseconds. */ - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((int) (70 * 65 * 7 * 2 / 14.31818))) - /* It would be nice if we could implement some sort of display - overscan here. */ - MCFG_SCREEN_SIZE(40 * 7, 24 * 8) - MCFG_SCREEN_VISIBLE_AREA(0, 40 * 7 - 1, 0, 24 * 8 - 1) - MCFG_SCREEN_UPDATE_DRIVER(apple1_state, screen_update_apple1) + MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz, (65*7)*2, 0, (40*7)*2, 262, 0, 192) + MCFG_SCREEN_UPDATE_DRIVER(apple1_state, screen_update) MCFG_SCREEN_PALETTE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", apple1) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_DEVICE_ADD( "pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(apple1_state,apple1_pia0_kbdin)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(apple1_state,apple1_pia0_dspout)) - MCFG_PIA_CB2_HANDLER(WRITELINE(apple1_state,apple1_pia0_dsp_write_signal)) + MCFG_DEVICE_ADD( A1_PIA_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(apple1_state, pia_keyboard_r)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(apple1_state, pia_display_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(apple1_state, pia_display_gate_w)) - MCFG_DEVICE_ADD("a1bus", A1BUS, 0) + MCFG_DEVICE_ADD(A1_BUS_TAG, A1BUS, 0) MCFG_A1BUS_CPU("maincpu") - MCFG_A1BUS_SLOT_ADD("a1bus", "exp", apple1_cards, "cassette") + MCFG_A1BUS_SLOT_ADD(A1_BUS_TAG, "exp", apple1_cards, "cassette") - /* snapshot */ MCFG_SNAPSHOT_ADD("snapshot", apple1_state, apple1, "snp", 0) - MCFG_SOFTWARE_LIST_ADD("cass_list","apple1") + MCFG_SOFTWARE_LIST_ADD("cass_list", "apple1") - /* Note that because we always include 4K of RAM at $E000-$EFFF, - the RAM amounts listed here will be 4K below the actual RAM - total. */ - /* internal ram */ MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("48K") MCFG_RAM_EXTRA_OPTIONS("4K,8K,12K,16K,20K,24K,28K,32K,36K,40K,44K") - MACHINE_CONFIG_END ROM_START(apple1) - ROM_REGION(0x100, "maincpu",0) - /* 256-byte main monitor ROM, in two 82s129 or mmi6301 256x4 proms at A1 and A2 called APPLE-A1(bits D3-D0) and APPLE-A2(bits D7-D4) */ - ROM_LOAD_NIB_HIGH( "apple-a2.a2", 0x0000, 0x0100, CRC(254bfb95) SHA1(b6468b72295b7d8ac288d104d252f24de1f1d611) ) - ROM_LOAD_NIB_LOW( "apple-a1.a1", 0x0000, 0x0100, CRC(434f8ce6) SHA1(9deee2d39903209b20c3fc6b58e16372f8efece1) ) - /* 512-byte Signetics 2513 character generator ROM at location D2-D3 */ + ROM_REGION(0x100, A1_CPU_TAG, 0) + ROM_LOAD_NIB_HIGH("apple-a2.a2", 0x0000, 0x0100, CRC(254bfb95) SHA1(b6468b72295b7d8ac288d104d252f24de1f1d611) ) + ROM_LOAD_NIB_LOW("apple-a1.a1", 0x0000, 0x0100, CRC(434f8ce6) SHA1(9deee2d39903209b20c3fc6b58e16372f8efece1) ) ROM_REGION(0x0200, "gfx1",0) ROM_LOAD("s2513.d2", 0x0000, 0x0200, CRC(a7e567fc) SHA1(b18aae0a2d4f92f5a7e22640719bbc4652f3f4ee)) // apple1.vid ROM_END +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME */ +COMP( 1976, apple1, 0, 0, apple1, apple1, driver_device, 0, "Apple Computer", "Apple I", MACHINE_NO_SOUND_HW ) -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1976, apple1, 0, 0, apple1, apple1, apple1_state, apple1, "Apple Computer", "Apple I" , MACHINE_NO_SOUND ) diff --git a/src/mame/includes/apple1.h b/src/mame/includes/apple1.h deleted file mode 100644 index 35215b9e9a3..00000000000 --- a/src/mame/includes/apple1.h +++ /dev/null @@ -1,92 +0,0 @@ -// license:??? -// copyright-holders:Paul Daniels, Colin Howell, R. Belmont -/***************************************************************************** - * - * includes/apple1.h - * - ****************************************************************************/ - -#ifndef APPLE1_H_ -#define APPLE1_H_ - -#include "imagedev/snapquik.h" -#include "machine/ram.h" - -typedef short termchar_t; - -struct terminal_t -{ - tilemap_t *tm; - int gfx; - int blank_char; - int char_bits; - int num_cols; - int num_rows; - int (*getcursorcode)(int original_code); - int cur_offset; - int cur_hidden; - termchar_t mem[1]; -}; - - -class apple1_state : public driver_device -{ -public: - apple1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen") { } - - int m_vh_clrscrn_pressed; - int m_kbd_data; - UINT32 m_kbd_last_scan[4]; - int m_reset_flag; - terminal_t *m_current_terminal; - terminal_t *m_terminal; - int m_blink_on; - DECLARE_DRIVER_INIT(apple1); - TILE_GET_INFO_MEMBER(terminal_gettileinfo); - virtual void machine_reset() override; - virtual void video_start() override; - UINT32 screen_update_apple1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(apple1_kbd_poll); - TIMER_CALLBACK_MEMBER(apple1_kbd_strobe_end); - TIMER_CALLBACK_MEMBER(apple1_dsp_ready_start); - TIMER_CALLBACK_MEMBER(apple1_dsp_ready_end); - DECLARE_READ8_MEMBER(apple1_pia0_kbdin); - DECLARE_WRITE8_MEMBER(apple1_pia0_dspout); - DECLARE_WRITE_LINE_MEMBER(apple1_pia0_dsp_write_signal); - required_device m_maincpu; - void terminal_draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, terminal_t *terminal); - void verify_coords(terminal_t *terminal, int x, int y); - void terminal_putchar(terminal_t *terminal, int x, int y, int ch); - int terminal_getchar(terminal_t *terminal, int x, int y); - void terminal_putblank(terminal_t *terminal, int x, int y); - void terminal_dirtycursor(terminal_t *terminal); - void terminal_setcursor(terminal_t *terminal, int x, int y); - void terminal_hidecursor(terminal_t *terminal); - void terminal_showcursor(terminal_t *terminal); - void terminal_getcursor(terminal_t *terminal, int *x, int *y); - void terminal_fill(terminal_t *terminal, int val); - void terminal_clear(terminal_t *terminal); - void apple1_vh_dsp_w (int data); - void apple1_vh_dsp_clr (); - void apple1_vh_cursor_blink (); - int apple1_verify_header (UINT8 *data); - terminal_t *terminal_create(int gfx, int blank_char, int char_bits,int (*getcursorcode)(int original_code),int num_cols, int num_rows); - attotime apple1_vh_dsp_time_to_ready(); - DECLARE_SNAPSHOT_LOAD_MEMBER( apple1 ); - required_device m_ram; - required_device m_gfxdecode; - required_device m_screen; -}; - - -/*----------- defined in drivers/apple1.c -----------*/ - -extern const gfx_layout apple1_charlayout; - - -#endif /* APPLE1_H_ */ diff --git a/src/mame/machine/apple1.cpp b/src/mame/machine/apple1.cpp deleted file mode 100644 index 59b360aea7e..00000000000 --- a/src/mame/machine/apple1.cpp +++ /dev/null @@ -1,404 +0,0 @@ -// license:??? -// copyright-holders:Paul Daniels, Colin Howell, R. Belmont -/*************************************************************************** - - machine.c - - Functions to emulate general aspects of the machine (RAM, ROM, interrupts, - I/O ports) - - The Apple I used a Motorola 6820 PIA for its keyboard and display - I/O. The keyboard was mapped to PIA port A, and the display to port - B. - - Port A, the keyboard, was an input port connected to a standard - ASCII-encoded keyboard. The high bit of the port was tied to +5V. - The keyboard strobe signal was connected to the PIA's CA1 control - input so that the keyboard could signal each keypress to the PIA. - The processor could check for a keypress by testing the IRQA1 flag - in the Port A Control Register and then reading the character value - from Port A. - - The keyboard connector also had two special lines, RESET and CLEAR - SCREEN, which were meant to be connected to pushbutton switches on - the keyboard. RESET was tied to the reset inputs for the CPU and - PIA; it allowed the user to stop a program and return control to the - Monitor. CLEAR SCREEN was directly tied to the video hardware and - would clear the display. - - Port B, the display, was an output port which accepted 7-bit ASCII - characters from the PIA and wrote them on the display. The details - of this are described in video/apple1.c. Control line CB2 served - as an output signal to inform the display of a new character. (CB2 - was also connected to line 7 of port B, which was configured as an - input, so that the CPU could more easily check the status of the - write.) The CB1 control input signaled the PIA when the display had - finished writing the character and could accept a new one. - - MAME models the 6821 instead of the earlier 6820 used in the Apple - I, but there is no difference in functionality between the two - chips; the 6821 simply has a better ability to drive electrical - loads. - - The Apple I had an optional cassette interface which plugged into - the expansion connector. This is described below in the "Cassette - interface I/O" section. - -***************************************************************************/ - -#include "emu.h" -#include "includes/apple1.h" -#include "machine/6821pia.h" -#include "cpu/m6502/m6502.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" - -/***************************************************************************** -** Structures -*****************************************************************************/ - -/* Use the same keyboard mapping as on a modern keyboard. This is not - the same as the keyboard mapping of the actual teletype-style - keyboards used with the Apple I, but it's less likely to cause - confusion for people who haven't memorized that layout. - - The Backspace key is mapped to the '_' (underscore) character - because the Apple I ROM Monitor used "back-arrow" to erase - characters, rather than backspace, and back-arrow is an earlier - form of the underscore. */ - -#define ESCAPE '\x1b' - -static const UINT8 apple1_unshifted_keymap[] = -{ - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', '-', '=', '[', ']', ';', '\'', - ',', '.', '/', '\\', 'A', 'B', 'C', 'D', - 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', - 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', - 'U', 'V', 'W', 'X', 'Y', 'Z', '\r', '_', - ' ', ESCAPE -}; - -static const UINT8 apple1_shifted_keymap[] = -{ - ')', '!', '@', '#', '$', '%', '^', '&', - '*', '(', '_', '+', '[', ']', ':', '"', - '<', '>', '?', '\\', 'A', 'B', 'C', 'D', - 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', - 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', - 'U', 'V', 'W', 'X', 'Y', 'Z', '\r', '_', - ' ', ESCAPE -}; - -/* Control key mappings, like the other mappings, conform to a modern - keyboard where possible. Note that the Apple I ROM Monitor ignores - most control characters. */ - -static const UINT8 apple1_control_keymap[] = -{ - '0', '1', '\x00', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', - '8', '9', '\x1f', '=', '\x1b', '\x1d', ';', '\'', - ',', '.', '/', '\x1c', '\x01', '\x02', '\x03', '\x04', - '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', - '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x12', '\x13', '\x14', - '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\r', '_', - '\x00', ESCAPE -}; - - - -/***************************************************************************** -** DRIVER_INIT: driver-specific setup, executed once at MESS startup. -*****************************************************************************/ - -DRIVER_INIT_MEMBER(apple1_state,apple1) -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - /* Set up the handlers for MESS's dynamically-sized RAM. */ - space.install_readwrite_bank(0x0000, m_ram->size() - 1, "bank1"); - membank("bank1")->set_base(m_ram->pointer()); - - /* Poll the keyboard input ports periodically. These include both - ordinary keys and the RESET and CLEAR SCREEN pushbutton - switches. We can't handle these switches in a VBLANK_INT or - PERIODIC_INT because both switches need to be monitored even - while the CPU is suspended during RESET; VBLANK_INT and - PERIODIC_INT callbacks aren't run while the CPU is in this - state. - - A 120-Hz poll rate seems to be fast enough to ensure no - keystrokes are missed. */ - machine().scheduler().timer_pulse(attotime::from_hz(120), timer_expired_delegate(FUNC(apple1_state::apple1_kbd_poll),this)); -} - - -void apple1_state::machine_reset() -{ - /* Reset the display hardware. */ - apple1_vh_dsp_clr(); -} - - -/***************************************************************************** -** apple1_verify_header -*****************************************************************************/ -int apple1_state::apple1_verify_header (UINT8 *data) -{ - /* Verify the format for the snapshot */ - if ((data[0] == 'L') && - (data[1] == 'O') && - (data[2] == 'A') && - (data[3] == 'D') && - (data[4] == ':') && - (data[7] == 'D') && - (data[8] == 'A') && - (data[9] == 'T') && - (data[10]== 'A') && - (data[11]== ':')) - { - return(IMAGE_VERIFY_PASS); - } - else - { - return(IMAGE_VERIFY_FAIL); - } -} - -#define SNAP_HEADER_LEN 12 - -/***************************************************************************** -** snapshot_load_apple1 -** -** Format of the binary snapshot image is: -** -** [ LOAD:xxyyDATA:zzzzzz...] -** -** where xxyy is the binary starting address (in big-endian byte -** order) to load the binary data zzzzzz to. -** -** The image can be of arbitrary length, but it must fit in available -** memory. -*****************************************************************************/ -SNAPSHOT_LOAD_MEMBER( apple1_state,apple1) -{ - UINT64 filesize, datasize; - UINT8 *snapbuf, *snapptr; - UINT16 start_addr, end_addr, addr; - - filesize = image.length(); - - /* Read the snapshot data into a temporary array */ - if (filesize < SNAP_HEADER_LEN) - return IMAGE_INIT_FAIL; - snapbuf = (UINT8*)image.ptr(); - if (!snapbuf) - return IMAGE_INIT_FAIL; - - /* Verify the snapshot header */ - if (apple1_verify_header(snapbuf) == IMAGE_VERIFY_FAIL) - { - logerror("apple1 - Snapshot Header is in incorrect format - needs to be LOAD:xxyyDATA:\n"); - return IMAGE_INIT_FAIL; - } - - datasize = filesize - SNAP_HEADER_LEN; - - /* Extract the starting address to load the snapshot to. */ - start_addr = (snapbuf[5] << 8) | (snapbuf[6]); - logerror("apple1 - LoadAddress is 0x%04x\n", start_addr); - - end_addr = start_addr + datasize - 1; - - if ((start_addr < 0xE000 && end_addr > m_ram->size() - 1) - || end_addr > 0xEFFF) - { - logerror("apple1 - Snapshot won't fit in this memory configuration;\n" - "needs memory from $%04X to $%04X.\n", start_addr, end_addr); - return IMAGE_INIT_FAIL; - } - - /* Copy the data into memory space. */ - for (addr = start_addr, snapptr = snapbuf + SNAP_HEADER_LEN; - addr <= end_addr; - addr++, snapptr++) - m_maincpu->space(AS_PROGRAM).write_byte(addr, *snapptr); - - - return IMAGE_INIT_PASS; -} - - -/***************************************************************************** -** apple1_kbd_poll -** -** Keyboard polling handles both ordinary keys and the special RESET -** and CLEAR SCREEN switches. -** -** For ordinary keys, this implements 2-key rollover to reduce the -** chance of missed keypresses. If we press a key and then press a -** second key while the first hasn't been completely released, as -** might happen during rapid typing, only the second key is -** registered; the first key is ignored. -** -** If multiple newly-pressed keys are found, the one closest to the -** end of the input ports list is counted; the others are ignored. -*****************************************************************************/ -TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_poll) -{ - int port, bit; - int key_pressed; - UINT32 shiftkeys, ctrlkeys; - pia6821_device *pia = machine().device("pia"); - static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" }; - - /* This holds the values of all the input ports for ordinary keys - seen during the last scan. */ - - /* First we check the RESET and CLEAR SCREEN pushbutton switches. */ - - /* The RESET switch resets the CPU and the 6820 PIA. */ - if (ioport("KEY5")->read() & 0x0001) - { - if (!m_reset_flag) { - m_reset_flag = 1; - /* using PULSE_LINE does not allow us to press and hold key */ - m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - pia->reset(); - } - } - else if (m_reset_flag) { - /* RESET released--allow the processor to continue. */ - m_reset_flag = 0; - m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - } - - /* The CLEAR SCREEN switch clears the video hardware. */ - if (ioport("KEY5")->read() & 0x0002) - { - if (!m_vh_clrscrn_pressed) - { - /* Ignore further video writes, and clear the screen. */ - m_vh_clrscrn_pressed = 1; - apple1_vh_dsp_clr(); - } - } - else if (m_vh_clrscrn_pressed) - { - /* CLEAR SCREEN released--pay attention to video writes again. */ - m_vh_clrscrn_pressed = 0; - } - - /* Now we scan all the input ports for ordinary keys, recording - new keypresses while ignoring keys that were already pressed in - the last scan. */ - - m_kbd_data = 0; - key_pressed = 0; - - /* The keyboard strobe line should always be low when a scan starts. */ - pia->ca1_w(0); - - shiftkeys = ioport("KEY4")->read() & 0x0003; - ctrlkeys = ioport("KEY4")->read() & 0x000c; - - for (port = 0; port < 4; port++) - { - UINT32 portval, newkeys; - - portval = ioport(keynames[port])->read(); - newkeys = portval & ~(m_kbd_last_scan[port]); - - if (newkeys) - { - key_pressed = 1; - for (bit = 0; bit < 16; bit++) { - if (newkeys & 1) - { - m_kbd_data = (ctrlkeys) - ? apple1_control_keymap[port*16 + bit] - : (shiftkeys) - ? apple1_shifted_keymap[port*16 + bit] - : apple1_unshifted_keymap[port*16 + bit]; - } - newkeys >>= 1; - } - } - m_kbd_last_scan[port] = portval; - } - - if (key_pressed) - { - /* The keyboard will pulse its strobe line when a key is - pressed. A 10-usec pulse is typical. */ - pia->ca1_w(1); - machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(apple1_state::apple1_kbd_strobe_end),this)); - } -} - -TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_strobe_end) -{ - pia6821_device *pia = machine().device("pia"); - - /* End of the keyboard strobe pulse. */ - pia->ca1_w(0); -} - - -/***************************************************************************** -** READ/WRITE HANDLERS -*****************************************************************************/ -READ8_MEMBER(apple1_state::apple1_pia0_kbdin) -{ - /* Bit 7 of the keyboard input is permanently wired high. This is - what the ROM Monitor software expects. */ - return m_kbd_data | 0x80; -} - -WRITE8_MEMBER(apple1_state::apple1_pia0_dspout) -{ - /* Send an ASCII character to the video hardware. */ - apple1_vh_dsp_w(data); -} - -WRITE_LINE_MEMBER(apple1_state::apple1_pia0_dsp_write_signal) -{ - device_t *device = machine().device("pia"); - /* PIA output CB2 is inverted to become the DA signal, used to - signal a display write to the video hardware. */ - - /* DA is directly connected to PIA input PB7, so the processor can - read bit 7 of port B to test whether the display has completed - a write. */ - pia6821_device *pia = downcast(device); - pia->portb_w((!state) << 7); - - /* Once DA is asserted, the display will wait until it can perform - the write, when the cursor position is about to be refreshed. - Only then will it assert \RDA to signal readiness for another - write. Thus the write delay depends on the cursor position and - where the display is in the refresh cycle. */ - if (!state) - machine().scheduler().timer_set(apple1_vh_dsp_time_to_ready(), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_start),this)); -} - -TIMER_CALLBACK_MEMBER(apple1_state::apple1_dsp_ready_start) -{ - pia6821_device *pia = machine().device("pia"); - - /* When the display asserts \RDA to signal it is ready, it - triggers a 74123 one-shot to send a 3.5-usec low pulse to PIA - input CB1. The end of this pulse will tell the PIA that the - display is ready for another write. */ - pia->cb1_w(0); - machine().scheduler().timer_set(attotime::from_nsec(3500), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_end),this)); -} - -TIMER_CALLBACK_MEMBER(apple1_state::apple1_dsp_ready_end) -{ - pia6821_device *pia = machine().device("pia"); - - /* The one-shot pulse has ended; return CB1 to high, so we can do - another display write. */ - pia->cb1_w(1); -} diff --git a/src/mame/video/apple1.cpp b/src/mame/video/apple1.cpp deleted file mode 100644 index 2dc880127b5..00000000000 --- a/src/mame/video/apple1.cpp +++ /dev/null @@ -1,392 +0,0 @@ -// license:??? -// copyright-holders:Paul Daniels, Colin Howell, R. Belmont -/*************************************************************************** - - apple1.c - - Functions to emulate the video hardware of the Apple I. - - The Apple I video hardware was basically a dumb video terminal; in - fact it was based on Steve Wozniak's own design for a simple video - terminal. It had 40 columns by 24 lines of uppercase-only text. - Text could only be output at 60 characters per second, one character - per video frame. The cursor (a blinking @) could only be advanced - using spaces or carriage returns. Carriage returns were the only - control characters recognized. Previously written text could not be - altered, only scrolled off the top of the screen. - - The video memory used seven 1k-bit dynamic shift registers. Six of - these held the 6-bit visible character codes, and one stored the - cursor location as a simple bitmap--the bit for the cursor position - was set to 0, and all the other bits were 1. - - These shift registers were continuously recirculated, completing one - cycle per video frame. As a new line of characters was about to be - scanned by the video beam, that character line would be recirculated - into the shift registers and would simultaneously be stored into a - 6x40-bit line buffer (also a shift register). At this point, if the - cursor location was in this line, a new character could be written - into that location in the shift registers and the cursor could be - advanced. (Carriage returns were not written into the shift - registers; they only advanced the cursor.) - - The characters in the line buffer were recirculated 7 times to - display the 8 scan lines of the characters, before being replaced by - a new line of characters from the main shift registers. - - Cursor blinking was performed by a Signetics 555 timer IC whose - output was gated into the character code signals as they passed into - the line buffer. - - Character images were provided by a Signetics 2513 character - generator ROM, a chip also used in computer terminals such as the - ADM-3A. This ROM had 9 address lines and 5 data lines; it contained - 64 character images, each 5 pixels wide by 8 pixels high, with one - line of pixels being blank for vertical separation. The video - circuitry added the 2 pixels of horizontal separation for each - character. - - A special CLEAR SCREEN switch on the keyboard, directly connected to - the video hardware, could be used to clear the video memory and - return the cursor to the home position. This was completely - independent of the processor. - - A schematic of the Apple I video hardware can be found in the - Apple-1 Operation Manual; look for the schematic titled "Terminal - Section". Most of the functionality modeled here was determined by - reading this schematic. Many of the chips used were standard 74xx - TTL chips, but the shift registers used for the video memory and - line buffer were Signetics 25xx PMOS ICs. These were already - becoming obsolete when the Apple I was built, and detailed - information on them is very hard to find today. - -***************************************************************************/ - -#include "emu.h" -#include "includes/apple1.h" - - -/*************************************************************************** - - Terminal code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(apple1_state::terminal_gettileinfo) -{ - int ch, gfxfont, code, color; - - ch = m_current_terminal->mem[tile_index]; - code = ch & ((1 << m_current_terminal->char_bits) - 1); - color = ch >> m_current_terminal->char_bits; - gfxfont = m_current_terminal->gfx; - - if ((tile_index == m_current_terminal->cur_offset) && !m_current_terminal->cur_hidden && m_current_terminal->getcursorcode) - code = m_current_terminal->getcursorcode(code); - - SET_TILE_INFO_MEMBER(gfxfont, /* gfx */ - code, /* character */ - color, /* color */ - 0); /* flags */ -} - -void apple1_state::terminal_draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, terminal_t *terminal) -{ - m_current_terminal = terminal; - terminal->tm->draw(screen, dest, cliprect, 0, 0); - m_current_terminal = nullptr; -} - -void apple1_state::verify_coords(terminal_t *terminal, int x, int y) -{ - assert(x >= 0); - assert(y >= 0); - assert(x < terminal->num_cols); - assert(y < terminal->num_rows); -} - -void apple1_state::terminal_putchar(terminal_t *terminal, int x, int y, int ch) -{ - int offs; - - verify_coords(terminal, x, y); - - offs = y * terminal->num_cols + x; - if (terminal->mem[offs] != ch) - { - terminal->mem[offs] = ch; - terminal->tm->mark_tile_dirty(offs); - } -} - -int apple1_state::terminal_getchar(terminal_t *terminal, int x, int y) -{ - int offs; - - verify_coords(terminal, x, y); - offs = y * terminal->num_cols + x; - return terminal->mem[offs]; -} - -void apple1_state::terminal_putblank(terminal_t *terminal, int x, int y) -{ - terminal_putchar(terminal, x, y, terminal->blank_char); -} - -void apple1_state::terminal_dirtycursor(terminal_t *terminal) -{ - if (terminal->cur_offset >= 0) - terminal->tm->mark_tile_dirty(terminal->cur_offset); -} - -void apple1_state::terminal_setcursor(terminal_t *terminal, int x, int y) -{ - terminal_dirtycursor(terminal); - terminal->cur_offset = y * terminal->num_cols + x; - terminal_dirtycursor(terminal); -} - -void apple1_state::terminal_hidecursor(terminal_t *terminal) -{ - terminal->cur_hidden = 1; - terminal_dirtycursor(terminal); -} - -void apple1_state::terminal_showcursor(terminal_t *terminal) -{ - terminal->cur_hidden = 0; - terminal_dirtycursor(terminal); -} - -void apple1_state::terminal_getcursor(terminal_t *terminal, int *x, int *y) -{ - *x = terminal->cur_offset % terminal->num_cols; - *y = terminal->cur_offset / terminal->num_cols; -} - -void apple1_state::terminal_fill(terminal_t *terminal, int val) -{ - int i; - for (i = 0; i < terminal->num_cols * terminal->num_rows; i++) - terminal->mem[i] = val; - terminal->tm->mark_all_dirty(); -} - -void apple1_state::terminal_clear(terminal_t *terminal) -{ - terminal_fill(terminal, terminal->blank_char); -} - -terminal_t *apple1_state::terminal_create( - int gfx, int blank_char, int char_bits, - int (*getcursorcode)(int original_code), - int num_cols, int num_rows) -{ - terminal_t *term; - int char_width, char_height; - - char_width = m_gfxdecode->gfx(gfx)->width(); - char_height = m_gfxdecode->gfx(gfx)->height(); - - term = (terminal_t *) auto_alloc_array(machine(), char, sizeof(terminal_t) - sizeof(term->mem) - + (num_cols * num_rows * sizeof(termchar_t))); - - term->tm = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(apple1_state::terminal_gettileinfo),this), TILEMAP_SCAN_ROWS, - char_width, char_height, num_cols, num_rows); - - term->gfx = gfx; - term->blank_char = blank_char; - term->char_bits = char_bits; - term->num_cols = num_cols; - term->num_rows = num_rows; - term->getcursorcode = getcursorcode; - term->cur_offset = -1; - term->cur_hidden = 0; - terminal_clear(term); - return term; -} - - -/**************************************************************************/ - - - -/* The cursor blinking is generated by a free-running timer with a - 0.52-second period. It is on for 2/3 of this period and off for - 1/3. */ -#define CURSOR_OFF_LENGTH (0.52/3) - -/**************************************************************************/ - -static int apple1_getcursorcode(int original_code) -{ - /* Cursor uses symbol 0 (an @ sign) in the character generator ROM. */ - return 0; -} - -/**************************************************************************/ - -void apple1_state::video_start() -{ - m_blink_on = 1; /* cursor is visible initially */ - m_terminal = terminal_create( - 0, /* graphics font 0 (the only one we have) */ - 32, /* Blank character is symbol 32 in the ROM */ - 8, /* use 8 bits for the character code */ - apple1_getcursorcode, - 40, 24); /* 40 columns, 24 rows */ - - terminal_setcursor(m_terminal, 0, 0); -} - -/* This function handles all writes to the video display. */ -void apple1_state::apple1_vh_dsp_w (int data) -{ - int x, y; - int cursor_x, cursor_y; - - /* While CLEAR SCREEN is being held down, the hardware is forced - to clear the video memory, so video writes have no effect. */ - if (m_vh_clrscrn_pressed) - return; - - /* The video display port only accepts the 7 lowest bits of the char. */ - data &= 0x7f; - - terminal_getcursor(m_terminal, &cursor_x, &cursor_y); - - if (data == '\r') { - /* Carriage-return moves the cursor to the start of the next - line. */ - cursor_x = 0; - cursor_y++; - } - else if (data < ' ') { - /* Except for carriage-return, the video hardware completely - ignores all control characters. */ - return; - } - else { - /* For visible characters, only 6 bits of the ASCII code are - used, because the 2513 character generator ROM only - contains 64 symbols. The low 5 bits of the ASCII code are - used directly. Bit 6 is ignored, since it is the same for - all the available characters in the ROM. Bit 7 is inverted - before being used as the high bit of the 6-bit ROM symbol - index, because the block of 32 ASCII symbols containing the - uppercase letters comes first in the ROM. */ - - int romindx = (data & 0x1f) | (((data ^ 0x40) & 0x40) >> 1); - - terminal_putchar(m_terminal, cursor_x, cursor_y, romindx); - if (cursor_x < 39) - { - cursor_x++; - } - else - { - cursor_x = 0; - cursor_y++; - } - } - - /* If the cursor went past the bottom line, scroll the text up one line. */ - if (cursor_y == 24) - { - for (y = 1; y < 24; y++) - for (x = 0; x < 40; x++) - terminal_putchar(m_terminal, x, y-1, - terminal_getchar(m_terminal, x, y)); - - for (x = 0; x < 40; x++) - terminal_putblank(m_terminal, x, 23); - - cursor_y--; - } - - terminal_setcursor(m_terminal, cursor_x, cursor_y); -} - -/* This function handles clearing the video display on cold-boot or in - response to a press of the CLEAR SCREEN switch. */ -void apple1_state::apple1_vh_dsp_clr () -{ - terminal_setcursor(m_terminal, 0, 0); - terminal_clear(m_terminal); -} - -/* Calculate how long it will take for the display to assert the RDA - signal in response to a video display write. This signal indicates - the display has completed the write and is ready to accept another - write. */ -attotime apple1_state::apple1_vh_dsp_time_to_ready () -{ - int cursor_x, cursor_y; - int cursor_scanline; - double scanline_period = m_screen->scan_period().as_double(); - double cursor_hfrac; - - /* The video hardware refreshes the screen by reading the - character codes from its circulating shift-register memory. - Because of the way this memory works, a new character can only - be written into the cursor location at the moment this location - is about to be read. This happens during the first scanline of - the cursor's character line, when the beam reaches the cursor's - horizontal position. */ - - terminal_getcursor(m_terminal, &cursor_x, &cursor_y); - cursor_scanline = cursor_y * apple1_charlayout.height; - - /* Each scanline is composed of 455 pixel times. The first 175 of - these are the horizontal blanking period; the remaining 280 are - for the visible part of the scanline. */ - cursor_hfrac = (175 + cursor_x * apple1_charlayout.width) / 455; - - if (m_screen->vpos() == cursor_scanline) { - /* video_screen_get_hpos() doesn't account for the horizontal - blanking interval; it acts as if the scanline period is - entirely composed of visible pixel times. However, we can - still use it to find what fraction of the current scanline - period has elapsed. */ - double current_hfrac = m_screen->hpos() / - m_screen->width(); - if (current_hfrac < cursor_hfrac) - return attotime::from_double(scanline_period * (cursor_hfrac - current_hfrac)); - } - - return attotime::from_double( - m_screen->time_until_pos(cursor_scanline, 0).as_double() + - scanline_period * cursor_hfrac); -} - -/* Blink the cursor on or off, as appropriate. */ -void apple1_state::apple1_vh_cursor_blink () -{ - int new_blink_on; - - /* The cursor is on for 2/3 of its blink period and off for 1/3. - This is most easily handled by dividing the total elapsed time - by the length of the off-portion of the cycle, giving us the - number of one-third-cycles elapsed, then checking the result - modulo 3. */ - - if (((int) (machine().time().as_double() / CURSOR_OFF_LENGTH)) % 3 < 2) - new_blink_on = 1; - else - new_blink_on = 0; - - if (new_blink_on != m_blink_on) { /* have we changed state? */ - if (new_blink_on) - terminal_showcursor(m_terminal); - else - terminal_hidecursor(m_terminal); - m_blink_on = new_blink_on; - } -} - -UINT32 apple1_state::screen_update_apple1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - apple1_vh_cursor_blink(); - terminal_draw(screen, bitmap, cliprect, m_terminal); - return 0; -} -- cgit v1.2.3-70-g09d2 From b9e37eb1dd12c99bd6b169aaee6cee3e37aad955 Mon Sep 17 00:00:00 2001 From: arbee Date: Sun, 7 Feb 2016 21:19:16 -0500 Subject: Missed a file (nw) --- scripts/target/mame/mess.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index b137fc7cb1a..bf7e09eabea 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -1186,9 +1186,6 @@ files { createMESSProjects(_target, _subtarget, "apple") files { MAME_DIR .. "src/mame/drivers/apple1.cpp", - MAME_DIR .. "src/mame/includes/apple1.h", - MAME_DIR .. "src/mame/machine/apple1.cpp", - MAME_DIR .. "src/mame/video/apple1.cpp", MAME_DIR .. "src/mame/drivers/apple2.cpp", MAME_DIR .. "src/mame/includes/apple2.h", MAME_DIR .. "src/mame/drivers/apple2e.cpp", -- cgit v1.2.3-70-g09d2 From 503ae769d1bd7867bfdfb0535ecf1da547810cee Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 8 Feb 2016 12:55:10 +1100 Subject: malloc.h is nonstandard, malloc/realloc/free are in stdlib.h --- 3rdparty/bx/include/bx/allocator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/bx/include/bx/allocator.h b/3rdparty/bx/include/bx/allocator.h index 50d526535b6..3a6ca4f6e26 100644 --- a/3rdparty/bx/include/bx/allocator.h +++ b/3rdparty/bx/include/bx/allocator.h @@ -13,7 +13,7 @@ #include #if BX_CONFIG_ALLOCATOR_CRT -# include +# include #endif // BX_CONFIG_ALLOCATOR_CRT #if BX_CONFIG_ALLOCATOR_DEBUG -- cgit v1.2.3-70-g09d2 From f489eeaaef76676b848b5958912191011a387a38 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 8 Feb 2016 13:24:12 +1100 Subject: catnmous: fix sprite banking --- src/mame/audio/laserbat.cpp | 10 +++++++++- src/mame/drivers/laserbat.cpp | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mame/audio/laserbat.cpp b/src/mame/audio/laserbat.cpp index 5e8ee062b45..b16c4d73388 100644 --- a/src/mame/audio/laserbat.cpp +++ b/src/mame/audio/laserbat.cpp @@ -282,7 +282,7 @@ WRITE8_MEMBER(laserbat_state::csound2_w) | 6 | SOUND 5 | PIA CA1 | | 7 | | | | 8 | | | - | 9 | | | + | 9 | | 14L A11 | | 10 | | | | 11 | | | | 12 | | | @@ -292,6 +292,10 @@ WRITE8_MEMBER(laserbat_state::csound2_w) | 16 | RESET | Unknown | +-----+----------+-------------+ + Bit 9 is used to select the sprite ROM bank. There's a wire visible + on the component side of the PCB connecting it to the high address + bit (A11) of the sprite ROM at 14L. + There could well be other connections on the sound board - these are just what can be deduced by tracing the sound program. @@ -308,8 +312,12 @@ WRITE8_MEMBER(catnmous_state::csound1_w) WRITE8_MEMBER(catnmous_state::csound2_w) { + // the bottom bit is used for sprite banking, of all things + m_gfx2 = memregion("gfx2")->base() + ((data & 0x01) ? 0x0800 : 0x0000); + // the top bit is called RESET on the wiring diagram - assume it resets the sound CPU m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x80) ? ASSERT_LINE : CLEAR_LINE); + m_csound2 = data; } diff --git a/src/mame/drivers/laserbat.cpp b/src/mame/drivers/laserbat.cpp index c9617fb8de5..38f7d3cbb39 100644 --- a/src/mame/drivers/laserbat.cpp +++ b/src/mame/drivers/laserbat.cpp @@ -62,6 +62,9 @@ * Service coin 1 input grants two credits the first time it's pushed, but remembers this and won't grant credits again unless unless you trigger the tilt input + * The sprite ROM is twice the size as Laser Battle with the bank + selected using bit 9 of the 16-bit sound interface (there's a wire + making this connection visible on the component side of the PCB) * Judging by the PLA program, the colour weight resistors are likely different to what Laser Battle/Lazarian uses - we need a detailed colour photo of the game board or a schematic to confirm values @@ -71,7 +74,6 @@ TODO: - work out where all the magic layer offsets come from - - catnmous sprite ROM appears to be underdumped - need to confirm colour weight resistors on catnmous (detailed photo required): R58, R59, R60, R61, R62, R65, R66, R67, R68, R69, R72, R73, R74, R75 (network connected between 11M, 12M, Q5, Q7, Q8) -- cgit v1.2.3-70-g09d2 From 695febb4ac53f49a6e0f66113a86230c549bf265 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 8 Feb 2016 15:38:02 +1100 Subject: catnmous: better approximation of colours, should be pretty close now --- src/mame/drivers/laserbat.cpp | 18 ++--- src/mame/includes/laserbat.h | 9 ++- src/mame/video/laserbat.cpp | 155 ++++++++++++++++++++++++++++-------------- 3 files changed, 119 insertions(+), 63 deletions(-) diff --git a/src/mame/drivers/laserbat.cpp b/src/mame/drivers/laserbat.cpp index 38f7d3cbb39..0c590a19cec 100644 --- a/src/mame/drivers/laserbat.cpp +++ b/src/mame/drivers/laserbat.cpp @@ -74,9 +74,6 @@ TODO: - work out where all the magic layer offsets come from - - need to confirm colour weight resistors on catnmous (detailed photo required): - R58, R59, R60, R61, R62, R65, R66, R67, R68, R69, R72, R73, R74, R75 - (network connected between 11M, 12M, Q5, Q7, Q8) - sound in laserbat (with schematics) and in catnmous */ @@ -497,9 +494,6 @@ static MACHINE_CONFIG_START( laserbat_base, laserbat_state_base ) MCFG_SCREEN_UPDATE_DRIVER(laserbat_state_base, screen_update_laserbat) MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", 256) - MCFG_PALETTE_INIT_OWNER(laserbat_state_base, laserbat) - MCFG_PLS100_ADD("gfxmix") MCFG_DEVICE_ADD("pvi1", S2636, XTAL_14_31818MHz/3) @@ -520,6 +514,10 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED_CLASS( laserbat, laserbat_base, laserbat_state ) + // video hardware + MCFG_PALETTE_ADD("palette", 256) + MCFG_PALETTE_INIT_OWNER(laserbat_state, laserbat) + // sound board devices MCFG_SPEAKER_STANDARD_MONO("mono") @@ -548,6 +546,10 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED_CLASS( catnmous, laserbat_base, catnmous_state ) + // video hardware + MCFG_PALETTE_ADD("palette", 256) + MCFG_PALETTE_INIT_OWNER(catnmous_state, catnmous) + // sound board devices MCFG_CPU_ADD("audiocpu", M6802, 3580000) // ? MCFG_CPU_PROGRAM_MAP(catnmous_sound_map) @@ -758,5 +760,5 @@ ROM_END GAME( 1981, laserbat, 0, laserbat, laserbat, laserbat_state_base, laserbat, ROT0, "Zaccaria", "Laser Battle", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1981, lazarian, laserbat, laserbat, lazarian, laserbat_state_base, laserbat, ROT0, "Zaccaria (Bally Midway license)", "Lazarian", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1982, catnmous, 0, catnmous, catnmous, laserbat_state_base, laserbat, ROT90, "Zaccaria", "Cat and Mouse (set 1)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1982, catnmousa, catnmous, catnmous, catnmous, laserbat_state_base, laserbat, ROT90, "Zaccaria", "Cat and Mouse (set 2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1982, catnmous, 0, catnmous, catnmous, laserbat_state_base, laserbat, ROT90, "Zaccaria", "Cat and Mouse (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1982, catnmousa, catnmous, catnmous, catnmous, laserbat_state_base, laserbat, ROT90, "Zaccaria", "Cat and Mouse (set 2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/laserbat.h b/src/mame/includes/laserbat.h index f50cd4e1bd9..f6d35ca93d6 100644 --- a/src/mame/includes/laserbat.h +++ b/src/mame/includes/laserbat.h @@ -65,9 +65,6 @@ public: DECLARE_DRIVER_INIT(laserbat); INTERRUPT_GEN_MEMBER(laserbat_interrupt); - // video initialisation - DECLARE_PALETTE_INIT(laserbat); - // video memory and control ports DECLARE_WRITE8_MEMBER(videoram_w); DECLARE_WRITE8_MEMBER(wcoh_w); @@ -162,6 +159,9 @@ public: { } + // video initialisation + DECLARE_PALETTE_INIT(laserbat); + // sound control ports virtual DECLARE_WRITE8_MEMBER(csound2_w) override; @@ -193,6 +193,9 @@ public: { } + // video initialisation + DECLARE_PALETTE_INIT(catnmous); + // sound control ports virtual DECLARE_WRITE8_MEMBER(csound1_w) override; virtual DECLARE_WRITE8_MEMBER(csound2_w) override; diff --git a/src/mame/video/laserbat.cpp b/src/mame/video/laserbat.cpp index fca20043f37..2431304816f 100644 --- a/src/mame/video/laserbat.cpp +++ b/src/mame/video/laserbat.cpp @@ -82,58 +82,6 @@ #include "includes/laserbat.h" -PALETTE_INIT_MEMBER(laserbat_state_base, laserbat) -{ - /* - Uses GRBGRBGR pixel format. The two topmost bist are the LSBs - for red and green. LSB for blue is always effectively 1. The - middle group is the MSB. Yet another crazy thing they did. - - Each colour channel has an emitter follower buffer amlpifier - biased with a 1k resistor to +5V and a 3k3 resistor to ground. - Output is adjusted by connecting additional resistors across the - leg to ground using an open collector buffer - 270R, 820R and - 1k0 for unset MSB to LSB, respectively (blue has no LSB so it - has no 1k0 resistor). - - Assuming 0.7V drop across the emitter follower and no drop - across the open collector buffer, these are the approximate - output voltages: - - 0.0000, 0.1031, 0.1324, 0.2987 , 0.7194, 1.2821, 1.4711, 3.1372 - - The game never sets the colour to any value above 4, effectively - treating it as 5-level red and green, and 3-level blue, for a - total of 75 usable colours. - - From the fact that there's no DC offset on red and green, and - the highest value used is just over 0.7V, I'm guessing the game - expects to drive a standard 0.7V RGB monitor, and higher colour - values would simply saturate the input. To make it not look - like the inside of a coal mine, I've applied gamma decoding at - 2.2 - - However there's that nasty DC offset on the blue caused by the - fact that it has no LSB, but it's eliminated at the AC-coupling - of the input and output of the buffer amplifier on the monitor - interface board. I'm treating it as though it has the same gain - as the other channels. After gamma adjustment, medium red and - medium blue as used by the game have almost the same intensity. - */ - - int const weights[] = { 0, 107, 120, 173, 255, 255, 255, 255 }; - int const blue_weights[] = { 0, 0, 60, 121, 241, 255, 255, 255, 255 }; - for (int entry = 0; palette.entries() > entry; entry++) - { - UINT8 const bits(entry & 0xff); - UINT8 const r(((bits & 0x01) << 1) | ((bits & 0x08) >> 1) | ((bits & 0x40) >> 6)); - UINT8 const g(((bits & 0x02) >> 0) | ((bits & 0x10) >> 2) | ((bits & 0x80) >> 7)); - UINT8 const b(((bits & 0x04) >> 1) | ((bits & 0x20) >> 3) | 0x01); - palette.set_pen_color(entry, rgb_t(weights[r], weights[g], blue_weights[b])); - } -} - - WRITE8_MEMBER(laserbat_state_base::videoram_w) { if (!m_mpx_bkeff) @@ -375,3 +323,106 @@ TIMER_CALLBACK_MEMBER(laserbat_state_base::video_line) } } } + + +PALETTE_INIT_MEMBER(laserbat_state, laserbat) +{ + /* + Uses GRBGRBGR pixel format. The two topmost bist are the LSBs + for red and green. LSB for blue is always effectively 1. The + middle group is the MSB. Yet another crazy thing they did. + + Each colour channel has an emitter follower buffer amlpifier + biased with a 1k resistor to +5V and a 3k3 resistor to ground. + Output is adjusted by connecting additional resistors across the + leg to ground using an open collector buffer - 270R, 820R and + 1k0 for unset MSB to LSB, respectively (blue has no LSB so it + has no 1k0 resistor). + + Assuming 0.7V drop across the emitter follower and no drop + across the open collector buffer, these are the approximate + output voltages: + + 0.0000, 0.1031, 0.1324, 0.2987, 0.7194, 1.2821, 1.4711, 3.1372 + + The game never sets the colour to any value above 4, effectively + treating it as 5-level red and green, and 3-level blue, for a + total of 75 usable colours. + + From the fact that there's no DC offset on red and green, and + the highest value used is just over 0.7V, I'm guessing the game + expects to drive a standard 0.7V RGB monitor, and higher colour + values would simply saturate the input. To make it not look + like the inside of a coal mine, I've applied gamma decoding at + 2.2 + + However there's that nasty DC offset on the blue caused by the + fact that it has no LSB, but it's eliminated at the AC-coupling + of the input and output of the buffer amplifier on the monitor + interface board. I'm treating it as though it has the same gain + as the other channels. After gamma adjustment, medium red and + medium blue as used by the game have almost the same intensity. + */ + + int const weights[] = { 0, 107, 120, 173, 255, 255, 255, 255 }; + int const blue_weights[] = { 0, 0, 60, 121, 241, 255, 255, 255 }; + for (int entry = 0; palette.entries() > entry; entry++) + { + UINT8 const bits(entry & 0xff); + UINT8 const r(((bits & 0x01) << 1) | ((bits & 0x08) >> 1) | ((bits & 0x40) >> 6)); + UINT8 const g(((bits & 0x02) >> 0) | ((bits & 0x10) >> 2) | ((bits & 0x80) >> 7)); + UINT8 const b(((bits & 0x04) >> 1) | ((bits & 0x20) >> 3) | 0x01); + palette.set_pen_color(entry, rgb_t(weights[r], weights[g], blue_weights[b])); + } +} + + +PALETTE_INIT_MEMBER(catnmous_state, catnmous) +{ + /* + Uses GRBGRBGR pixel format. The two topmost bist are the LSBs + for red and green. The middle group is the MSB. Yet another + crazy thing they did. + + Each colour channel has an emitter follower buffer amlpifier + biased with a 1k resistor to +5V and a 3k3 resistor to ground. + Output is adjusted by connecting additional resistors across the + leg to ground using an open collector buffer. Red and green use + 560R, 820R and 1k0 for unset MSB to LSB, respectively. Blue + uses 47R and 820R on the PCB we have a photo of, although the + 47R resistor looks like it could be a bad repair (opposite + orientation and burn marks on PCB). + + Assuming 0.7V drop across the emitter follower and no drop + across the open collector buffer, these are the approximate + output voltages for red and green: + + 0.2419, 0.4606, 0.5229, 0.7194, 0.9188, 1.2821, 1.4711, 3.1372 + + The game uses all colour values except 4. The DC offset will be + eliminated by the AC coupling on the monitor interface board. + The differences steps aren't very linear, they vary from 0.06V + to 0.36V with no particular order. The input would be expected + to saturate somewhere inside the big jump to the highest level. + + Let's assume the 47R resistor is a bad repair and it's supposed + to be 470R. That gives us these output voltages for blue: + + 0.3752, 0.7574, 1.2821, 3.1372 + + To make life easier, I'll assume the monitor is expected to have + half the gain of a standard monitor and no gamma decoding is + necessary. + */ + + int const weights[] = { 0, 40, 51, 87, 123, 189, 224, 255 }; + int const blue_weights[] = { 0, 70, 165, 255 }; + for (int entry = 0; palette.entries() > entry; entry++) + { + UINT8 const bits(entry & 0xff); + UINT8 const r(((bits & 0x01) << 1) | ((bits & 0x08) >> 1) | ((bits & 0x40) >> 6)); + UINT8 const g(((bits & 0x02) >> 0) | ((bits & 0x10) >> 2) | ((bits & 0x80) >> 7)); + UINT8 const b(((bits & 0x04) >> 2) | ((bits & 0x20) >> 4)); + palette.set_pen_color(entry, rgb_t(weights[r], weights[g], blue_weights[b])); + } +} -- cgit v1.2.3-70-g09d2 From 6bed300184b19746b5b012bf6a5b49690cb59374 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Sun, 7 Feb 2016 19:27:17 -0500 Subject: more notetaker notes (nw) --- src/mame/drivers/notetaker.cpp | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index 08cf3d588f0..899f16ad5ea 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -8,20 +8,35 @@ * see http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker * * MISSING DUMP for 8741 I/O MCU + +TODO: Pretty much everything. +* Get the bootrom to do something sane instead of infinite-looping (is the dump good?) +* Get bootrom/ram bankswitching working +* Get the running machine smalltalk-78 memory dump loaded as a rom and forced into ram on startup, since no boot disks have survived +* floppy controller (rather complex and somewhat raw/low level) +* crt5027 video controller +* pic8259 interrupt controller +* i8251? serial/EIA controller +* 6402 keyboard UART +* HLE for the missing 8741 which reads the mouse quadratures and buttons + */ #include "cpu/i86/i86.h" +//#include "video/tms9927.h" class notetaker_state : public driver_device { public: notetaker_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") + m_maincpu(*this, "maincpu")//, + //m_vtac(*this, "crt5027") { } // devices required_device m_maincpu; + //required_device m_vtac; //declarations @@ -34,8 +49,19 @@ static ADDRESS_MAP_START(notetaker_mem, AS_PROGRAM, 16, notetaker_state) AM_RANGE(0xff000, 0xfffff) AM_ROM ADDRESS_MAP_END +// io memory map comes from http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker/memos/19790605_Definition_of_8086_Ports.pdf static ADDRESS_MAP_START(notetaker_io, AS_IO, 16, notetaker_state) ADDRESS_MAP_UNMAP_HIGH + //AM_RANGE(0x02, 0x03) AM_READWRITE interrupt control register, high byte only + //AM_RANGE(0x20, 0x21) AM_WRITE processor (rom mapping, etc) control register + //AM_RANGE(0x42, 0x43) AM_READ read keyboard data (high byte only) [from mcu?] + //AM_RANGE(0x44, 0x45) AM_READ read keyboard fifo state (high byte only) [from mcu?] + //AM_RANGE(0x48, 0x49) AM_WRITE kbd->uart control register [to mcu?] + //AM_RANGE(0x4a, 0x4b) AM_WRITE kbd->uart data register [to mcu?] + //AM_RANGE(0x4c, 0x4d) AM_WRITE kbd data reset [to mcu?] + //AM_RANGE(0x4e, 0x4f) AM_WRITE kbd chip [mcu?] reset [to mcu?] + //AM_RANGE(0x60, 0x61) AM_WRITE DAC sample and hold and frequency setup + //AM_RANGE(0x140, 0x15f) AM_DEVREADWRITE("crt5027", crt5027_device, read, write) ADDRESS_MAP_END /* Input ports */ @@ -49,8 +75,19 @@ static MACHINE_CONFIG_START( notetakr, notetaker_state ) MCFG_CPU_IO_MAP(notetaker_io) /* video hardware */ - //MCFG_DEFAULT_LAYOUT(layout_notetaker) + /*MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(250)) + MCFG_SCREEN_UPDATE_DRIVER(notetaker_state, screen_update) + MCFG_SCREEN_SIZE(64*6, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 32*8-1) + + MCFG_PALETTE_ADD_3BIT_RGB("palette") + MCFG_DEVICE_ADD("crt5027", CRT5027, XTAL_17_9712MHz/2) + //MCFG_TMS9927_CHAR_WIDTH(6) + //MCFG_TMS9927_VSYN_CALLBACK(DEVWRITELINE(TMS5501_TAG, tms5501_device, sens_w)) + MCFG_VIDEO_SET_SCREEN("screen")*/ /* Devices */ MACHINE_CONFIG_END -- cgit v1.2.3-70-g09d2 From 0901dacf2f248c288b464d2d44c32684a7fbae9e Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Mon, 8 Feb 2016 00:24:11 -0500 Subject: Descrambled the ROM on the Xerox Notetaker, and mapped it in the correct areas to make it start to boot. [Lord Nightmare] --- src/mame/drivers/notetaker.cpp | 47 +++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index 899f16ad5ea..0780ff3ad3f 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -1,16 +1,15 @@ // license:BSD-3-Clause // copyright-holders:Jonathan Gevaryahu -/* Xerox Notetaker +/* Xerox Notetaker, 1978 * Driver by Jonathan Gevaryahu - * prototype only, one? unit manufactured + * prototype only, three? units manufactured (one at CHM, not sure where the other two are) * This device was the origin of Smalltalk-78 * NO MEDIA for this device has survived, only a ram dump * see http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker * - * MISSING DUMP for 8741 I/O MCU + * MISSING DUMP for 8741? I/O MCU which does mouse-related stuff TODO: Pretty much everything. -* Get the bootrom to do something sane instead of infinite-looping (is the dump good?) * Get bootrom/ram bankswitching working * Get the running machine smalltalk-78 memory dump loaded as a rom and forced into ram on startup, since no boot disks have survived * floppy controller (rather complex and somewhat raw/low level) @@ -18,7 +17,7 @@ TODO: Pretty much everything. * pic8259 interrupt controller * i8251? serial/EIA controller * 6402 keyboard UART -* HLE for the missing 8741 which reads the mouse quadratures and buttons +* HLE for the missing MCU which reads the mouse quadratures and buttons */ @@ -39,14 +38,17 @@ public: //required_device m_vtac; //declarations + DECLARE_DRIVER_INIT(notetakr); //variables }; static ADDRESS_MAP_START(notetaker_mem, AS_PROGRAM, 16, notetaker_state) - AM_RANGE(0x00000, 0x01fff) AM_RAM - AM_RANGE(0xff000, 0xfffff) AM_ROM + // AM_RANGE(0x00000, 0x01fff) AM_RAM + AM_RANGE(0x00000, 0x00fff) AM_ROM AM_REGION("maincpu", 0xFF000) // I think this copy of rom is actually banked via io reg 0x20, there is ram which lives behind here? + // ram lives here? + AM_RANGE(0xff000, 0xfffff) AM_ROM // is this banked too? ADDRESS_MAP_END // io memory map comes from http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker/memos/19790605_Definition_of_8086_Ports.pdf @@ -92,14 +94,39 @@ static MACHINE_CONFIG_START( notetakr, notetaker_state ) MACHINE_CONFIG_END +DRIVER_INIT_MEMBER(notetaker_state,notetakr) +{ + // descramble the rom; the whole thing is a gigantic scrambled mess probably to ease + // interfacing with older xerox technologies which used A0 and D0 as the MSB bits + // or maybe because someone screwed up somewhere along the line. we may never know. + // see http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker/schematics/19790423_Notetaker_IO_Processor.pdf pages 12 and onward + UINT16 *romsrc = (UINT16 *)(memregion("maincpuload")->base()); + UINT16 *romdst = (UINT16 *)(memregion("maincpu")->base()); + UINT16 *temppointer; + UINT16 wordtemp; + UINT16 addrtemp; + romsrc += 0x7f800; // set the src pointer to 0xff000 (>>1 because 16 bits data) + romdst += 0x7f800; // set the dest pointer to 0xff000 (>>1 because 16 bits data) + for (int i = 0; i < 0x800; i++) + { + wordtemp = BITSWAP16(*romsrc, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7); + addrtemp = BITSWAP16(i, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + temppointer = romdst+(addrtemp&0x7FF); + *temppointer = wordtemp; + romsrc++; + } +} + /* ROM definition */ ROM_START( notetakr ) - ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x100000, "maincpuload", ROMREGION_ERASEFF ) // load roms here before descrambling ROMX_LOAD( "NTIOLO_EPROM.BIN", 0xff000, 0x0800, CRC(b72aa4c7) SHA1(85dab2399f906c7695dc92e7c18f32e2303c5892), ROM_SKIP(1)) ROMX_LOAD( "NTIOHI_EPROM.BIN", 0xff001, 0x0800, CRC(1119691d) SHA1(4c20b595b554e6f5489ab2c3fb364b4a052f05e3), ROM_SKIP(1)) + ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) // area for descrambled roms ROM_END /* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, notetakr, 0, 0, notetakr, notetakr, driver_device, 0, "Xerox", "Notetaker", MACHINE_IS_SKELETON) +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, notetakr, 0, 0, notetakr, notetakr, notetaker_state, notetakr, "Xerox", "Notetaker", MACHINE_IS_SKELETON) +//COMP( 1978, notetakr, 0, 0, notetakr, notetakr, driver_device, notetakr, "Xerox", "Notetaker", MACHINE_IS_SKELETON) -- cgit v1.2.3-70-g09d2 From 1edb7e79410f30fb31bed795f5962ee9ab51f3e1 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Mon, 8 Feb 2016 01:32:59 -0500 Subject: Xerox Notetaker: Correct CPU Clock speed, and map at least some of RAM [Lord Nightmare] --- src/mame/drivers/notetaker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index 0780ff3ad3f..d4822956ef0 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -47,7 +47,7 @@ public: static ADDRESS_MAP_START(notetaker_mem, AS_PROGRAM, 16, notetaker_state) // AM_RANGE(0x00000, 0x01fff) AM_RAM AM_RANGE(0x00000, 0x00fff) AM_ROM AM_REGION("maincpu", 0xFF000) // I think this copy of rom is actually banked via io reg 0x20, there is ram which lives behind here? - // ram lives here? + AM_RANGE(0x01000, 0x01fff) AM_RAM // ram lives here, or at least some of it does for the stack. AM_RANGE(0xff000, 0xfffff) AM_ROM // is this banked too? ADDRESS_MAP_END @@ -72,7 +72,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( notetakr, notetaker_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, XTAL_14_7456MHz/3) /* unknown crystal and divider */ + MCFG_CPU_ADD("maincpu", I8086, XTAL_24MHz/3) /* 24Mhz crystal divided down by i8284 clock generator */ MCFG_CPU_PROGRAM_MAP(notetaker_mem) MCFG_CPU_IO_MAP(notetaker_io) -- cgit v1.2.3-70-g09d2 From 9aae6e21812a7743c16229e7d0fca17b925ec63d Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 8 Feb 2016 18:17:23 +1100 Subject: Remove outdated comment --- src/mame/drivers/laserbat.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mame/drivers/laserbat.cpp b/src/mame/drivers/laserbat.cpp index 0c590a19cec..0f3ed93c3b1 100644 --- a/src/mame/drivers/laserbat.cpp +++ b/src/mame/drivers/laserbat.cpp @@ -65,9 +65,6 @@ * The sprite ROM is twice the size as Laser Battle with the bank selected using bit 9 of the 16-bit sound interface (there's a wire making this connection visible on the component side of the PCB) - * Judging by the PLA program, the colour weight resistors are likely - different to what Laser Battle/Lazarian uses - we need a detailed - colour photo of the game board or a schematic to confirm values * Sound board emulation is based on tracing the program and guessing what's connected where - we really need someone to trace out the 1b11107 sound board if we want to get this right -- cgit v1.2.3-70-g09d2 From 03c8434a4f8d27d2d3ec7bbdaa31b13f89e17852 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 8 Feb 2016 09:08:53 +0100 Subject: fix SDL display for BGFX (nw) --- src/osd/modules/render/drawbgfx.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 960a4243bf2..4b9da495b4a 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -84,13 +84,8 @@ public: window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect()); return &window().target()->get_primitives(); #else - osd_dim nd = window().blit_surface_size(); - if (nd != m_blit_dim) - { - m_blit_dim = nd; - notify_changed(); - } - window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect()); + osd_dim wdim = window().get_size(); + window().target()->set_bounds(wdim.width(), wdim.height(), window().aspect()); return &window().target()->get_primitives(); #endif } @@ -175,12 +170,10 @@ int renderer_bgfx::create() bgfx::init(); bgfx::reset(rect_width(&client), rect_height(&client), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); #else - osd_dim d = window().get_size(); - m_blittimer = 3; - + osd_dim wdim = window().get_size(); bgfx::sdlSetWindow(window().sdl_window()); bgfx::init(); - bgfx::reset(d.width(), d.height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + bgfx::reset(wdim.width(), wdim.height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); #endif // Enable debug text. @@ -755,8 +748,9 @@ int renderer_bgfx::draw(int update) width = rect_width(&client); height = rect_height(&client); #else - width = m_blit_dim.width(); - height = m_blit_dim.height(); + osd_dim wdim = window().get_size(); + width = wdim.width(); + height = wdim.height(); #endif bgfx::setViewRect(0, 0, 0, width, height); bgfx::reset(width, height, video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); -- cgit v1.2.3-70-g09d2 From 8d339ed46dd8e04fdd864363961f0a48ef4c7194 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Mon, 8 Feb 2016 03:17:43 -0500 Subject: Xerox Notetaker: Corrected RAM amount. Attached the pic8259 interrupt controller, though no interrupts are attached to that yet. Added documentation of i/o writes during the boot process. [Lord Nightmare] --- src/mame/drivers/notetaker.cpp | 50 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index d4822956ef0..70a3c4ea122 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -12,9 +12,9 @@ TODO: Pretty much everything. * Get bootrom/ram bankswitching working * Get the running machine smalltalk-78 memory dump loaded as a rom and forced into ram on startup, since no boot disks have survived -* floppy controller (rather complex and somewhat raw/low level) +* floppy controller wd1791 * crt5027 video controller -* pic8259 interrupt controller +* pic8259 interrupt controller - this is attached as a device, but the interrupts are not hooked to it yet. * i8251? serial/EIA controller * 6402 keyboard UART * HLE for the missing MCU which reads the mouse quadratures and buttons @@ -22,6 +22,7 @@ TODO: Pretty much everything. */ #include "cpu/i86/i86.h" +#include "machine/pic8259.h" //#include "video/tms9927.h" class notetaker_state : public driver_device @@ -29,12 +30,14 @@ class notetaker_state : public driver_device public: notetaker_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu")//, + m_maincpu(*this, "maincpu"), + m_pic(*this, "pic8259")//, //m_vtac(*this, "crt5027") { } // devices required_device m_maincpu; + required_device m_pic; //required_device m_vtac; //declarations @@ -47,14 +50,14 @@ public: static ADDRESS_MAP_START(notetaker_mem, AS_PROGRAM, 16, notetaker_state) // AM_RANGE(0x00000, 0x01fff) AM_RAM AM_RANGE(0x00000, 0x00fff) AM_ROM AM_REGION("maincpu", 0xFF000) // I think this copy of rom is actually banked via io reg 0x20, there is ram which lives behind here? - AM_RANGE(0x01000, 0x01fff) AM_RAM // ram lives here, or at least some of it does for the stack. - AM_RANGE(0xff000, 0xfffff) AM_ROM // is this banked too? + AM_RANGE(0x01000, 0x3ffff) AM_RAM // ram lives here, 256KB + AM_RANGE(0xff000, 0xfffff) AM_ROM // is this banked too? Don't think so... ADDRESS_MAP_END // io memory map comes from http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker/memos/19790605_Definition_of_8086_Ports.pdf static ADDRESS_MAP_START(notetaker_io, AS_IO, 16, notetaker_state) ADDRESS_MAP_UNMAP_HIGH - //AM_RANGE(0x02, 0x03) AM_READWRITE interrupt control register, high byte only + AM_RANGE(0x02, 0x03) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xFF00) //AM_RANGE(0x20, 0x21) AM_WRITE processor (rom mapping, etc) control register //AM_RANGE(0x42, 0x43) AM_READ read keyboard data (high byte only) [from mcu?] //AM_RANGE(0x44, 0x45) AM_READ read keyboard fifo state (high byte only) [from mcu?] @@ -63,9 +66,40 @@ static ADDRESS_MAP_START(notetaker_io, AS_IO, 16, notetaker_state) //AM_RANGE(0x4c, 0x4d) AM_WRITE kbd data reset [to mcu?] //AM_RANGE(0x4e, 0x4f) AM_WRITE kbd chip [mcu?] reset [to mcu?] //AM_RANGE(0x60, 0x61) AM_WRITE DAC sample and hold and frequency setup + //AM_RANGE(0x100, 0x101) AM_WRITE I/O register (adc speed, crtc pixel clock enable, etc) //AM_RANGE(0x140, 0x15f) AM_DEVREADWRITE("crt5027", crt5027_device, read, write) ADDRESS_MAP_END +/* writes during boot: +0x88 to port 0x020 (PCR; boot sequence done(1), processor not locked(0), battery charger off(0), rom not disabled(0) correction off&cr4 off(1), cr3 on(0), cr2 on(0), cr1 on (0);) +0x02 to port 0x100 (IOR write: enable 5v only relay control for powering up 4116 dram enabled) +0x03 to port 0x100 (IOR write: in addition to above, enable 12v relay control for powering up 4116 dram enabled) + +0x13 to port 0x000 (?????) +0x08 to port 0x002 PIC (UART int enabled) +0x0D to port 0x002 PIC (UART, wd1791, and parity error int enabled) +0xff to port 0x002 PIC (all ints enabled) +0x0000 to port 0x04e (reset keyboard fifo/controller) +0x0000 to port 0x1ae (reset UART) +0x0016 to port 0x048 (kbd control reg write) +0x0005 to port 0x1a8 (UART control reg write) +0x5f to port 0x140 \ +0xf2 to port 0x142 \ +0x7d to port 0x144 \ +0x1d to port 0x146 \_ set up CRTC +0x04 to port 0x148 / +0x10 to port 0x14a / +0x00 to port 0x154 / +0x1e to port 0x15a / +0x0a03 to port 0x100 (IOR write: set bit clock to 12Mhz) +0x2a03 to port 0x100 (IOR write: enable crtc clock chain) +0x00 to port 0x15c (fire off crtc timing chain) +read from 0x0002 (byte wide) (check interrupts) +0xaf to port 0x002 PIC (mask out kb int and 30hz display int) +0x0400 to 0x060 (select DAC fifo frequency 2) +read from 0x44 (byte wide) in a loop forever (read keyboard fifo status) +*/ + /* Input ports */ static INPUT_PORTS_START( notetakr ) INPUT_PORTS_END @@ -75,6 +109,10 @@ static MACHINE_CONFIG_START( notetakr, notetaker_state ) MCFG_CPU_ADD("maincpu", I8086, XTAL_24MHz/3) /* 24Mhz crystal divided down by i8284 clock generator */ MCFG_CPU_PROGRAM_MAP(notetaker_mem) MCFG_CPU_IO_MAP(notetaker_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + MCFG_PIC8259_ADD("pic8259", INPUTLINE("maincpu", 0), VCC, NULL) + + //Note there is a second i8086 cpu on the 'emulator board', which is probably loaded with code once smalltalk boots /* video hardware */ /*MCFG_SCREEN_ADD("screen", RASTER) -- cgit v1.2.3-70-g09d2 From 411a28a1c2c70e2140a199554788a35a7510aa72 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 8 Feb 2016 09:55:23 +0100 Subject: renamed k28 to k28m2 --- hash/k28.xml | 81 -------------------------------------------- hash/k28m2.xml | 81 ++++++++++++++++++++++++++++++++++++++++++++ src/mame/drivers/tispeak.cpp | 18 +++++----- src/mame/layout/k28.lay | 26 -------------- src/mame/layout/k28m2.lay | 26 ++++++++++++++ src/mame/mess.lst | 2 +- 6 files changed, 117 insertions(+), 117 deletions(-) delete mode 100644 hash/k28.xml create mode 100644 hash/k28m2.xml delete mode 100644 src/mame/layout/k28.lay create mode 100644 src/mame/layout/k28m2.lay diff --git a/hash/k28.xml b/hash/k28.xml deleted file mode 100644 index 842c7da0312..00000000000 --- a/hash/k28.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - Expansion Module 1 - 1986? - Tiger Electronics - - - - - - - - - - Expansion Module 2 - 1986 - Tiger Electronics - - - - - - - - - - Expansion Module 3 - 1986 - Tiger Electronics - - - - - - - - - - Expansion Module 4 - 1986 - Tiger Electronics - - - - - - - - - - - - Expansion Module 6 - 1987 - Tiger Electronics - - - - - - - - - - diff --git a/hash/k28m2.xml b/hash/k28m2.xml new file mode 100644 index 00000000000..27ce1fdf58f --- /dev/null +++ b/hash/k28m2.xml @@ -0,0 +1,81 @@ + + + + + + + Expansion Module 1 + 1986? + Tiger Electronics + + + + + + + + + + Expansion Module 2 + 1986 + Tiger Electronics + + + + + + + + + + Expansion Module 3 + 1986 + Tiger Electronics + + + + + + + + + + Expansion Module 4 + 1986 + Tiger Electronics + + + + + + + + + + + + Expansion Module 6 + 1987 + Tiger Electronics + + + + + + + + + + diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index 0bfc1888c5c..e6f70a5daad 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -396,7 +396,7 @@ K28 modules: #include "softlist.h" // internal artwork -#include "k28.lh" +#include "k28m2.lh" #include "lantutor.lh" #include "snmath.lh" #include "snspell.lh" @@ -1105,7 +1105,7 @@ static INPUT_PORTS_START( tntell ) INPUT_PORTS_END -static INPUT_PORTS_START( k28 ) +static INPUT_PORTS_START( k28m2 ) PORT_START("IN.0") // O0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") // -> auto_power_off PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('A') PORT_NAME("A/1") @@ -1341,7 +1341,7 @@ static MACHINE_CONFIG_DERIVED( tntell, vocaid ) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( k28, tispeak_state ) +static MACHINE_CONFIG_START( k28m2, tispeak_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1400, MASTER_CLOCK/2) @@ -1350,7 +1350,7 @@ static MACHINE_CONFIG_START( k28, tispeak_state ) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, k28_write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_k28) + MCFG_DEFAULT_LAYOUT(layout_k28m2) /* sound hardware */ MCFG_DEVICE_ADD("tms6100", TMS6100, MASTER_CLOCK/4) @@ -1360,11 +1360,11 @@ static MACHINE_CONFIG_START( k28, tispeak_state ) MCFG_FRAGMENT_ADD(tms5110_route) /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "k28") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "k28m2") MCFG_GENERIC_EXTENSIONS("vsm") MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) - MCFG_SOFTWARE_LIST_ADD("cart_list", "k28") + MCFG_SOFTWARE_LIST_ADD("cart_list", "k28m2") MACHINE_CONFIG_END @@ -1709,14 +1709,14 @@ ROM_START( vocaid ) ROM_END -ROM_START( k28 ) +ROM_START( k28m2 ) ROM_REGION( 0x1000, "maincpu", 0 ) ROM_LOAD( "mp7324", 0x0000, 0x1000, CRC(08d15ab6) SHA1(5b0f6c53e6732a362c4bb25d966d4072fdd33db8) ) ROM_REGION( 867, "maincpu:mpla", 0 ) ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) ROM_REGION( 557, "maincpu:opla", 0 ) - ROM_LOAD( "tms1400_k28_output.pla", 0, 557, CRC(3a5c7005) SHA1(3fe5819c138a90e7fc12817415f2622ca81b40b2) ) + ROM_LOAD( "tms1400_k28m2_output.pla", 0, 557, CRC(3a5c7005) SHA1(3fe5819c138a90e7fc12817415f2622ca81b40b2) ) ROM_REGION( 0x10000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff? = space reserved for cartridge ROM_LOAD( "cm62084.vsm", 0x0000, 0x4000, CRC(cd1376f7) SHA1(96fa484c392c451599bc083b8376cad9c998df7d) ) @@ -1754,4 +1754,4 @@ COMP( 1981, tntellfr, tntell, 0, tntell, tntell, tispeak_state, tn COMP( 1982, vocaid, 0, 0, vocaid, tntell, driver_device, 0, "Texas Instruments", "Vocaid", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) -COMP( 1985, k28, 0, 0, k28, k28, tispeak_state, snspell, "Tiger Electronics", "K28: Talking Learning Computer (model 7-232)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) +COMP( 1985, k28m2, 0, 0, k28m2, k28m2, tispeak_state, snspell, "Tiger Electronics", "K28: Talking Learning Computer (model 7-232)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) diff --git a/src/mame/layout/k28.lay b/src/mame/layout/k28.lay deleted file mode 100644 index dde1a20e295..00000000000 --- a/src/mame/layout/k28.lay +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mame/layout/k28m2.lay b/src/mame/layout/k28m2.lay new file mode 100644 index 00000000000..dde1a20e295 --- /dev/null +++ b/src/mame/layout/k28m2.lay @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 38dcc5d9234..152952c48a9 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2358,7 +2358,7 @@ tntelluk tntellfr tntellp vocaid -k28 // Tiger Electronics +k28m2 // Tiger Electronics // hh_ucom4 ufombs // Bambino -- cgit v1.2.3-70-g09d2 From 98272782961985d0873bd602fe77c0ee374674a6 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 8 Feb 2016 10:52:20 +0100 Subject: Fixed compile when using params like OVERRIDE_CXX='ccache g++' OVERRIDE_CC='ccache gcc' from QMC2 (nw) --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index 2595a9bba6b..308b2cb0958 100644 --- a/makefile +++ b/makefile @@ -1270,7 +1270,7 @@ $(SRC)/devices/cpu/m68000/m68kops.cpp: $(SRC)/devices/cpu/m68000/m68k_in.cpp $(S ifeq ($(TARGETOS),asmjs) $(SILENT) $(MAKE) -C $(SRC)/devices/cpu/m68000 else - $(SILENT) $(MAKE) -C $(SRC)/devices/cpu/m68000 CC=$(CC) CXX=$(CXX) + $(SILENT) $(MAKE) -C $(SRC)/devices/cpu/m68000 CC="$(CC)" CXX="$(CXX)" endif #------------------------------------------------- -- cgit v1.2.3-70-g09d2 From b0a3533fc529484ae42e0e5331e8f0f1fa8a991e Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 8 Feb 2016 10:58:55 +0100 Subject: k28: added skeleton driver for the SC-01 k28 (not a cloneset of the other one) --- scripts/target/mame/mess.lua | 1 + src/mame/drivers/k28.cpp | 181 +++++++++++++++++++++++++++++++++++++++++++ src/mame/drivers/tispeak.cpp | 2 +- src/mame/layout/k28.lay | 68 ++++++++++++++++ src/mame/layout/snmath.lay | 2 +- src/mame/mess.lst | 1 + 6 files changed, 253 insertions(+), 2 deletions(-) create mode 100644 src/mame/drivers/k28.cpp create mode 100644 src/mame/layout/k28.lay diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index bf7e09eabea..a0282f34804 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -2767,6 +2767,7 @@ files { MAME_DIR .. "src/mame/includes/gamecom.h", MAME_DIR .. "src/mame/machine/gamecom.cpp", MAME_DIR .. "src/mame/video/gamecom.cpp", + MAME_DIR .. "src/mame/drivers/k28.cpp", } createMESSProjects(_target, _subtarget, "tigertel") diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp new file mode 100644 index 00000000000..8748b965e50 --- /dev/null +++ b/src/mame/drivers/k28.cpp @@ -0,0 +1,181 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Kevin Horton +/*************************************************************************** + + K28 + +***************************************************************************/ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" +#include "machine/tms6100.h" +#include "sound/votrax.h" + +#include "k28.lh" + + +class k28_state : public driver_device +{ +public: + k28_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_inp_matrix(*this, "IN") + { } + + // devices + required_device m_maincpu; + required_ioport_array<7> m_inp_matrix; + + UINT16 m_inp_mux; + +protected: + virtual void machine_start() override; +}; + +void k28_state::machine_start() +{ + // zerofill + m_inp_mux = 0; + + // register for savestates + save_item(NAME(m_inp_mux)); +} + + +/*************************************************************************** + + I/O, Address Map(s) + +***************************************************************************/ + +static ADDRESS_MAP_START( k28_mcu_map, AS_IO, 8, k28_state ) + ADDRESS_MAP_UNMAP_LOW + //AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) + //AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) + //AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) + //AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T1) +ADDRESS_MAP_END + + + +/*************************************************************************** + + Inputs + +***************************************************************************/ + +static INPUT_PORTS_START( k28 ) + PORT_START("IN.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) + + PORT_START("IN.1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) + + PORT_START("IN.2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) + + PORT_START("IN.3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) + + PORT_START("IN.4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) + + PORT_START("IN.5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) + + PORT_START("IN.6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) +INPUT_PORTS_END + + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + +static MACHINE_CONFIG_START( k28, k28_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8021, XTAL_3_579545MHz) + MCFG_CPU_IO_MAP(k28_mcu_map) + + MCFG_DEFAULT_LAYOUT(layout_k28) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_DEVICE_ADD("speech", VOTRAX_SC01, 760000) // measured 760kHz + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) +MACHINE_CONFIG_END + + + +/*************************************************************************** + + ROM Defs, Game driver(s) + +***************************************************************************/ + +ROM_START( k28 ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "k28_8021.bin", 0x0000, 0x0400, CRC(15536d20) SHA1(fac98ce652340ffb2d00952697c3a9ce75393fa4) ) + + ROM_REGION( 0x10000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff? = space reserved for cartridge + ROM_LOAD( "cm62050.vsm", 0x0000, 0x4000, CRC(6afb8645) SHA1(e22435568ed11c6516a3b4008131f99cd4e47aa9) ) + ROM_LOAD( "cm62051.vsm", 0x4000, 0x4000, CRC(0fa61baa) SHA1(831be669423ba60c7f85a896b4b09a1295478bd9) ) +ROM_END + + + +COMP( 1981, k28, 0, 0, k28, k28, driver_device, 0, "Tiger Electronics", "K28: Talking Learning Computer (model 7-230)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index e6f70a5daad..40dfb8e3f07 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -358,7 +358,7 @@ Tiger Electronics K28 (model 7-232) Sold in Hong Kong, distributed in US as: - Sears: Talkatron - Learning Computer Earlier K28 models 7-230 and 7-231 are on different hardware, showing a different -keyboard, VFD display, and use the SC-01 speech chip. +keyboard, VFD display, and use the SC-01 speech chip. --> driver k28.cpp K28 model 7-232 (HK), 1985 - MCU: TMS1400 MP7324 diff --git a/src/mame/layout/k28.lay b/src/mame/layout/k28.lay new file mode 100644 index 00000000000..14f53a0704d --- /dev/null +++ b/src/mame/layout/k28.lay @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/snmath.lay b/src/mame/layout/snmath.lay index ca1eb371aea..14f53a0704d 100644 --- a/src/mame/layout/snmath.lay +++ b/src/mame/layout/snmath.lay @@ -8,7 +8,7 @@ - + diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 152952c48a9..e23e5b7885b 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2393,6 +2393,7 @@ microvsn // Milton Bradley monty // Ritam mmonty // Ritam wildfire // Parker Bros +k28 // Tiger Electronics //********** Misc ********************************************************** -- cgit v1.2.3-70-g09d2 From 99dedc08efdfdf7d657da8bbc4d8b0fd2325382f Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 8 Feb 2016 11:35:21 +0100 Subject: vigilant.cpp: Added video timing PROM. [Pasky] --- src/mame/drivers/vigilant.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/mame/drivers/vigilant.cpp b/src/mame/drivers/vigilant.cpp index 12f0dc881bd..9f18d577e2e 100644 --- a/src/mame/drivers/vigilant.cpp +++ b/src/mame/drivers/vigilant.cpp @@ -650,6 +650,9 @@ ROM_START( vigilant ) // World Rev E ROM_LOAD( "VG_B-8R.ic90", 0x0000, 0x0117, CRC(df368a7a) SHA1(597d85d1f90b7ee0188f2d849792ee02ff2ea48b) ) ROM_LOAD( "VG_B-4M.ic38", 0x0200, 0x0117, CRC(dbca4204) SHA1(d8e190f2dc4d6285f22be331d01ed402520d2017) ) ROM_LOAD( "VG_B-1B.ic1", 0x0400, 0x0117, CRC(922e5167) SHA1(08efdfdfeb35f3f73b6fd3d5c0c2a386dea5f617) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "tbp24s10_7a.ic52", 0x0000, 0x0100, CRC(c324835e) SHA1(cf6ffe38523badfda211d341410e93e647de87a9) ) // tbp24s10, 82s129-equivalent - video timing ROM_END ROM_START( vigilantg ) // US Rev G @@ -687,6 +690,9 @@ ROM_START( vigilantg ) // US Rev G ROM_LOAD( "VG_B-8R.ic90", 0x0000, 0x0117, CRC(df368a7a) SHA1(597d85d1f90b7ee0188f2d849792ee02ff2ea48b) ) ROM_LOAD( "VG_B-4M.ic38", 0x0200, 0x0117, CRC(dbca4204) SHA1(d8e190f2dc4d6285f22be331d01ed402520d2017) ) ROM_LOAD( "VG_B-1B.ic1", 0x0400, 0x0117, CRC(922e5167) SHA1(08efdfdfeb35f3f73b6fd3d5c0c2a386dea5f617) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "tbp24s10_7a.ic52", 0x0000, 0x0100, CRC(c324835e) SHA1(cf6ffe38523badfda211d341410e93e647de87a9) ) // tbp24s10, 82s129-equivalent - video timing ROM_END ROM_START( vigilanto ) // US (earliest base version) @@ -726,6 +732,9 @@ ROM_START( vigilanto ) // US (earliest base version) ROM_LOAD( "VG_B-8R.ic90", 0x0000, 0x0117, CRC(df368a7a) SHA1(597d85d1f90b7ee0188f2d849792ee02ff2ea48b) ) ROM_LOAD( "VG_B-4M.ic38", 0x0200, 0x0117, CRC(dbca4204) SHA1(d8e190f2dc4d6285f22be331d01ed402520d2017) ) ROM_LOAD( "VG_B-1B.ic1", 0x0400, 0x0117, CRC(922e5167) SHA1(08efdfdfeb35f3f73b6fd3d5c0c2a386dea5f617) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "tbp24s10_7a.ic52", 0x0000, 0x0100, CRC(c324835e) SHA1(cf6ffe38523badfda211d341410e93e647de87a9) ) // tbp24s10, 82s129-equivalent - video timing ROM_END ROM_START( vigilanta ) // World Rev A @@ -765,6 +774,9 @@ ROM_START( vigilanta ) // World Rev A ROM_LOAD( "VG_B-8R.ic90", 0x0000, 0x0117, CRC(df368a7a) SHA1(597d85d1f90b7ee0188f2d849792ee02ff2ea48b) ) ROM_LOAD( "VG_B-4M.ic38", 0x0200, 0x0117, CRC(dbca4204) SHA1(d8e190f2dc4d6285f22be331d01ed402520d2017) ) ROM_LOAD( "VG_B-1B.ic1", 0x0400, 0x0117, CRC(922e5167) SHA1(08efdfdfeb35f3f73b6fd3d5c0c2a386dea5f617) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "tbp24s10_7a.ic52", 0x0000, 0x0100, CRC(c324835e) SHA1(cf6ffe38523badfda211d341410e93e647de87a9) ) // tbp24s10, 82s129-equivalent - video timing ROM_END ROM_START( vigilantb ) // US Rev B @@ -804,6 +816,9 @@ ROM_START( vigilantb ) // US Rev B ROM_LOAD( "VG_B-8R.ic90", 0x0000, 0x0117, CRC(df368a7a) SHA1(597d85d1f90b7ee0188f2d849792ee02ff2ea48b) ) ROM_LOAD( "VG_B-4M.ic38", 0x0200, 0x0117, CRC(dbca4204) SHA1(d8e190f2dc4d6285f22be331d01ed402520d2017) ) ROM_LOAD( "VG_B-1B.ic1", 0x0400, 0x0117, CRC(922e5167) SHA1(08efdfdfeb35f3f73b6fd3d5c0c2a386dea5f617) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "tbp24s10_7a.ic52", 0x0000, 0x0100, CRC(c324835e) SHA1(cf6ffe38523badfda211d341410e93e647de87a9) ) // tbp24s10, 82s129-equivalent - video timing ROM_END ROM_START( vigilantc ) // World Rev C @@ -843,6 +858,9 @@ ROM_START( vigilantc ) // World Rev C ROM_LOAD( "VG_B-8R.ic90", 0x0000, 0x0117, CRC(df368a7a) SHA1(597d85d1f90b7ee0188f2d849792ee02ff2ea48b) ) ROM_LOAD( "VG_B-4M.ic38", 0x0200, 0x0117, CRC(dbca4204) SHA1(d8e190f2dc4d6285f22be331d01ed402520d2017) ) ROM_LOAD( "VG_B-1B.ic1", 0x0400, 0x0117, CRC(922e5167) SHA1(08efdfdfeb35f3f73b6fd3d5c0c2a386dea5f617) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "tbp24s10_7a.ic52", 0x0000, 0x0100, CRC(c324835e) SHA1(cf6ffe38523badfda211d341410e93e647de87a9) ) // tbp24s10, 82s129-equivalent - video timing ROM_END ROM_START( vigilantd ) // Japan Rev D @@ -882,6 +900,9 @@ ROM_START( vigilantd ) // Japan Rev D ROM_LOAD( "VG_B-8R.ic90", 0x0000, 0x0117, CRC(df368a7a) SHA1(597d85d1f90b7ee0188f2d849792ee02ff2ea48b) ) ROM_LOAD( "VG_B-4M.ic38", 0x0200, 0x0117, CRC(dbca4204) SHA1(d8e190f2dc4d6285f22be331d01ed402520d2017) ) ROM_LOAD( "VG_B-1B.ic1", 0x0400, 0x0117, CRC(922e5167) SHA1(08efdfdfeb35f3f73b6fd3d5c0c2a386dea5f617) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "tbp24s10_7a.ic52", 0x0000, 0x0100, CRC(c324835e) SHA1(cf6ffe38523badfda211d341410e93e647de87a9) ) // tbp24s10, 82s129-equivalent - video timing ROM_END ROM_START( vigilantbl ) /* Bootleg */ -- cgit v1.2.3-70-g09d2 From f736cd5abcea21c8b2c8c4f2d2909952856ac22d Mon Sep 17 00:00:00 2001 From: Michele Fochi Date: Mon, 8 Feb 2016 13:25:25 +0100 Subject: Added new options: -[no]exit_after_playback (default=no) -[no]record_input (default=no) Added new UI shortcut to save current timecode (default F12) Translated variable names and comments to english language --- src/emu/emuopts.cpp | 3 ++ src/emu/emuopts.h | 4 +++ src/emu/inpttype.h | 1 + src/emu/ioport.cpp | 72 +++++++++++++++++++++++------------------------ src/emu/ioport.h | 1 + src/emu/ui/ui.cpp | 4 +++ src/emu/video.cpp | 22 ++++++++++----- src/emu/video.h | 1 + src/osd/windows/input.cpp | 5 ++++ 9 files changed, 70 insertions(+), 43 deletions(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 716432b9088..f5d014750b2 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -60,6 +60,9 @@ const options_entry emu_options::s_option_entries[] = { OPTION_AUTOSAVE, "0", OPTION_BOOLEAN, "enable automatic restore at startup, and automatic save at exit time" }, { OPTION_PLAYBACK ";pb", nullptr, OPTION_STRING, "playback an input file" }, { OPTION_RECORD ";rec", nullptr, OPTION_STRING, "record an input file" }, + { OPTION_RECORD_TIMECODE, "0", OPTION_BOOLEAN, "record an input timecode file (requires -record option)" }, + { OPTION_EXIT_AFTER_PLAYBACK, "0", OPTION_BOOLEAN, "close the program at the end of playback" }, + { OPTION_MNGWRITE, nullptr, OPTION_STRING, "optional filename to write a MNG movie of the current session" }, { OPTION_AVIWRITE, nullptr, OPTION_STRING, "optional filename to write an AVI movie of the current session" }, #ifdef MAME_DEBUG diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index d8d6e162e94..916a0f263f5 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -71,6 +71,8 @@ enum #define OPTION_AUTOSAVE "autosave" #define OPTION_PLAYBACK "playback" #define OPTION_RECORD "record" +#define OPTION_RECORD_TIMECODE "record_timecode" +#define OPTION_EXIT_AFTER_PLAYBACK "exit_after_playback" #define OPTION_MNGWRITE "mngwrite" #define OPTION_AVIWRITE "aviwrite" #ifdef MAME_DEBUG @@ -244,6 +246,8 @@ public: bool autosave() const { return bool_value(OPTION_AUTOSAVE); } const char *playback() const { return value(OPTION_PLAYBACK); } const char *record() const { return value(OPTION_RECORD); } + bool record_timecode() const { return bool_value(OPTION_RECORD_TIMECODE); } + bool exit_after_playback() const { return bool_value(OPTION_EXIT_AFTER_PLAYBACK); } const char *mng_write() const { return value(OPTION_MNGWRITE); } const char *avi_write() const { return value(OPTION_AVIWRITE); } #ifdef MAME_DEBUG diff --git a/src/emu/inpttype.h b/src/emu/inpttype.h index d927680ab4d..504a9e4aa8d 100644 --- a/src/emu/inpttype.h +++ b/src/emu/inpttype.h @@ -727,6 +727,7 @@ void construct_core_types_UI(simple_list &typelist) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_FAST_FORWARD, "Fast Forward", input_seq(KEYCODE_INSERT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SHOW_FPS, "Show FPS", input_seq(KEYCODE_F11, input_seq::not_code, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SNAPSHOT, "Save Snapshot", input_seq(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TIMECODE, "Write current timecode", input_seq(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RECORD_MOVIE, "Record Movie", input_seq(KEYCODE_F12, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TOGGLE_CHEAT, "Toggle Cheat", input_seq(KEYCODE_F6) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP, "UI Up", input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) ) diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index 501ba5d783b..ec88792df12 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -3434,11 +3434,11 @@ void ioport_manager::playback_end(const char *message) osd_printf_info("Total playback frames: %d\n", UINT32(m_playback_accumulated_frames)); osd_printf_info("Average recorded speed: %d%%\n", UINT32((m_playback_accumulated_speed * 200 + 1) >> 21)); - // Close the Mame at the end of inp file playback - //if (strcmp(message, "End of file")) { + // close the program at the end of inp file playback + if (machine().options().exit_after_playback()) { osd_printf_info("Exiting MAME now...\n"); machine().schedule_exit(); - //} + } } } @@ -3589,24 +3589,27 @@ void ioport_manager::record_init() void ioport_manager::timecode_init() { + // check if option -record_timecode is enabled + if (!machine().options().record_timecode()) { + machine().video().set_timecode_enabled(false); + return; + } // if no file, nothing to do const char *record_filename = machine().options().record(); if (record_filename[0] == 0) { machine().video().set_timecode_enabled(false); return; } - //osd_printf_error("DEBUG FILENAME-1: %s\n", record_filename); + machine().video().set_timecode_enabled(true); // open the record file std::string filename; filename.append(record_filename).append(".timecode"); - //sprintf(filename, "%s.timecode", record_filename); - - //osd_printf_error("DEBUG FILENAME-2: %s\n", filename.c_str()); + osd_printf_info("Record input timecode file: %s\n", record_filename); file_error filerr = m_timecode_file.open(filename.c_str()); - assert_always(filerr == FILERR_NONE, "Failed to open file for timecode recording"); + assert_always(filerr == FILERR_NONE, "Failed to open file for input timecode recording"); m_timecode_file.puts(std::string("# ==========================================\n").c_str()); m_timecode_file.puts(std::string("# TIMECODE FILE FOR VIDEO PREVIEW GENERATION\n").c_str()); @@ -3666,8 +3669,8 @@ void ioport_manager::record_frame(const attotime &curtime) if (m_record_file.is_open()) { // first the absolute time - record_write(curtime.m_seconds); - record_write(curtime.m_attoseconds); + record_write(curtime.seconds()); + record_write(curtime.attoseconds()); // then the current speed record_write(UINT32(machine().video().speed_percent() * double(1 << 20))); @@ -3678,28 +3681,28 @@ void ioport_manager::record_frame(const attotime &curtime) std::string current_time_str; m_timecode_count++; strcatprintf(current_time_str, "%02d:%02d:%02d.%03d", - (int)curtime.m_seconds / (60 * 60), - (curtime.m_seconds / 60) % 60, - curtime.m_seconds % 60, - (int)(curtime.m_attoseconds/ATTOSECONDS_PER_MILLISECOND)); + (int)curtime.seconds() / (60 * 60), + (curtime.seconds() / 60) % 60, + curtime.seconds() % 60, + (int)(curtime.attoseconds()/ATTOSECONDS_PER_MILLISECOND)); // Elapsed from previous timecode attotime elapsed_time = curtime - m_timecode_last_time; m_timecode_last_time = curtime; std::string elapsed_time_str; strcatprintf(elapsed_time_str, "%02d:%02d:%02d.%03d", - elapsed_time.m_seconds / (60 * 60), - (elapsed_time.m_seconds / 60) % 60, - elapsed_time.m_seconds % 60, - int(elapsed_time.m_attoseconds/ATTOSECONDS_PER_MILLISECOND)); + elapsed_time.seconds() / (60 * 60), + (elapsed_time.seconds() / 60) % 60, + elapsed_time.seconds() % 60, + int(elapsed_time.attoseconds()/ATTOSECONDS_PER_MILLISECOND)); // Number of ms from beginning of playback - int mseconds_start = curtime.m_seconds*1000 + curtime.m_attoseconds/ATTOSECONDS_PER_MILLISECOND; + int mseconds_start = curtime.seconds()*1000 + curtime.attoseconds()/ATTOSECONDS_PER_MILLISECOND; std::string mseconds_start_str; strcatprintf(mseconds_start_str, "%015d", mseconds_start); // Number of ms from previous timecode - int mseconds_elapsed = elapsed_time.m_seconds*1000 + elapsed_time.m_attoseconds/ATTOSECONDS_PER_MILLISECOND; + int mseconds_elapsed = elapsed_time.seconds()*1000 + elapsed_time.attoseconds()/ATTOSECONDS_PER_MILLISECOND; std::string mseconds_elapsed_str; strcatprintf(mseconds_elapsed_str, "%015d", mseconds_elapsed); @@ -3713,30 +3716,30 @@ void ioport_manager::record_frame(const attotime &curtime) std::string frame_elapsed_str; strcatprintf(frame_elapsed_str, "%015d", frame_elapsed); - std::string messaggio; + std::string message; std::string timecode_text; std::string timecode_key; bool show_timecode_counter = false; if (m_timecode_count==1) { - messaggio += "INTRO STARTED AT " + current_time_str; + message += "TIMECODE: Intro started at " + current_time_str; timecode_key = "INTRO_START"; timecode_text = "INTRO"; show_timecode_counter = true; } else if (m_timecode_count==2) { - messaggio += "INTRO DURATION " + elapsed_time_str; + message += "TIMECODE: Intro duration " + elapsed_time_str; timecode_key = "INTRO_STOP"; machine().video().add_to_total_time(elapsed_time); //timecode_text += "INTRO"; } else if (m_timecode_count==3) { - messaggio += "GAMEPLAY STARTED AT " + current_time_str; + message += "TIMECODE: Gameplay started at " + current_time_str; timecode_key = "GAMEPLAY_START"; timecode_text += "GAMEPLAY"; show_timecode_counter = true; } else if (m_timecode_count==4) { - messaggio += "GAMEPLAY DURATION " + elapsed_time_str; + message += "TIMECODE: Gameplay duration " + elapsed_time_str; timecode_key = "GAMEPLAY_STOP"; machine().video().add_to_total_time(elapsed_time); //timecode_text += "GAMEPLAY"; @@ -3747,7 +3750,7 @@ void ioport_manager::record_frame(const attotime &curtime) timecode_key = "EXTRA_START_" + timecode_count_str; timecode_count_str.clear(); strcatprintf(timecode_count_str, "%d", (m_timecode_count-3)/2); - messaggio += "EXTRA " + timecode_count_str + " STARTED AT " + current_time_str; + message += "TIMECODE: Extra " + timecode_count_str + " started at " + current_time_str; timecode_text += "EXTRA " + timecode_count_str; show_timecode_counter = true; } @@ -3756,29 +3759,26 @@ void ioport_manager::record_frame(const attotime &curtime) std::string timecode_count_str; strcatprintf(timecode_count_str, "%d", (m_timecode_count-4)/2); - messaggio += "EXTRA " + timecode_count_str + " DURATION " + elapsed_time_str; + message += "TIMECODE: Extra " + timecode_count_str + " duration " + elapsed_time_str; - //std::string timecode_count_str; timecode_count_str.clear(); strcatprintf(timecode_count_str, "%03d", (m_timecode_count-4)/2); timecode_key = "EXTRA_STOP_" + timecode_count_str; } - osd_printf_info("%s \n", messaggio.c_str()); - machine().popmessage("%s \n", messaggio.c_str()); + osd_printf_info("%s \n", message.c_str()); + machine().popmessage("%s \n", message.c_str()); - std::string riga_file; - riga_file.append(timecode_key).append(19-timecode_key.length(), ' '); - //riga_file += "INTRO_START " + - riga_file += + std::string line_to_add; + line_to_add.append(timecode_key).append(19-timecode_key.length(), ' '); + line_to_add += " " + current_time_str + " " + elapsed_time_str + " " + mseconds_start_str + " " + mseconds_elapsed_str + " " + frame_start_str + " " + frame_elapsed_str + "\n"; - m_timecode_file.puts(riga_file.c_str()); + m_timecode_file.puts(line_to_add.c_str()); machine().video().set_timecode_write(false); - //machine().video().set_timecode_text(timecode_text); machine().video().set_timecode_text(timecode_text); machine().video().set_timecode_start(m_timecode_last_time); machine().ui().set_show_timecode_counter(show_timecode_counter); diff --git a/src/emu/ioport.h b/src/emu/ioport.h index 3fbff3e852c..6048f52e9c0 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -343,6 +343,7 @@ enum ioport_type IPT_UI_FAST_FORWARD, IPT_UI_SHOW_FPS, IPT_UI_SNAPSHOT, + IPT_UI_TIMECODE, IPT_UI_RECORD_MOVIE, IPT_UI_TOGGLE_CHEAT, IPT_UI_UP, diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 860da34e212..af60e5de777 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -1648,6 +1648,10 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co machine.ui().image_handler_ingame(); + // handle a save input timecode request + if (machine.ui_input().pressed(IPT_UI_TIMECODE)) + machine.video().save_input_timecode(); + if (ui_disabled) return ui_disabled; if (machine.ui_input().pressed(IPT_UI_CANCEL)) diff --git a/src/emu/video.cpp b/src/emu/video.cpp index 4b2a315d75c..11f081636b8 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -341,13 +341,6 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file) void video_manager::save_active_screen_snapshots() { - // If record inp is acrive, no snapshot will be created - if (m_timecode_enabled) { - // This flag will write the line on file inp.timecode (see function ioport_manager::record_frame) - m_timecode_write = true; - return; - } - // if we're native, then write one snapshot per visible screen if (m_snap_native) { @@ -373,6 +366,21 @@ void video_manager::save_active_screen_snapshots() } } + +//------------------------------------------------- +// save_input_timecode - add a line of current +// timestamp to inp.timecode file +//------------------------------------------------- + +void video_manager::save_input_timecode() +{ + // if record timecode input is not active, do nothing + if (!m_timecode_enabled) { + return; + } + m_timecode_write = true; +} + std::string &video_manager::timecode_text(std::string &str) { str.clear(); str += " "; diff --git a/src/emu/video.h b/src/emu/video.h index 2403fe295f6..e7ff281a260 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -87,6 +87,7 @@ public: // snapshots void save_snapshot(screen_device *screen, emu_file &file); void save_active_screen_snapshots(); + void save_input_timecode(); // movies void begin_recording(const char *name, movie_format format); diff --git a/src/osd/windows/input.cpp b/src/osd/windows/input.cpp index 9157036ffd5..6a9d534a2f6 100644 --- a/src/osd/windows/input.cpp +++ b/src/osd/windows/input.cpp @@ -789,6 +789,11 @@ void windows_osd_interface::customize_input_type_list(simple_listdefseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_LALT); break; + // add a NOT-lalt to write timecode file + case IPT_UI_TIMECODE: // emu/input.c: input_seq(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT) + entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_LALT); + break; + // lctrl-lalt-F5 to toggle post-processing case IPT_OSD_4: entry->configure_osd("POST_PROCESS", "Toggle Post-Processing"); -- cgit v1.2.3-70-g09d2 From 3607505b4de075af46481aee7e286ca641594c07 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 8 Feb 2016 14:26:53 +0100 Subject: fixed texture clamping and added respect of filter parameter (nw) --- src/osd/modules/render/drawbgfx.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 4b9da495b4a..6eaaa2d2fb2 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -782,6 +782,9 @@ int renderer_bgfx::draw(int update) // Draw quad. // now draw + uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP; + if (video_config.filter==0) texture_flags |= BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; + for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next()) { uint64_t flags = BGFX_STATE_RGB_WRITE; @@ -856,7 +859,7 @@ int renderer_bgfx::draw(int update) , (uint16_t)prim->texture.height , 1 , bgfx::TextureFormat::BGRA8 - , 0 + , texture_flags , mem ); } @@ -872,7 +875,7 @@ int renderer_bgfx::draw(int update) , (uint16_t)prim->texture.height , 1 , bgfx::TextureFormat::BGRA8 - , 0 + , texture_flags , mem ); } @@ -903,7 +906,7 @@ int renderer_bgfx::draw(int update) , (uint16_t)prim->texture.height , 1 , bgfx::TextureFormat::BGRA8 - , 0 + , texture_flags , mem ); } else { @@ -911,7 +914,7 @@ int renderer_bgfx::draw(int update) , (uint16_t)prim->texture.height , 1 , bgfx::TextureFormat::BGRA8 - , 0 + , texture_flags , bgfx::copy(prim->texture.base, prim->texture.width*prim->texture.height*4) ); } -- cgit v1.2.3-70-g09d2 From 5a3595a09185ccca69dcdf1339187cb5eed3c6cd Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 8 Feb 2016 17:34:55 +0000 Subject: new clones Frogger (Sega set 3) [Team Europe] --- src/mame/arcade.lst | 1 + src/mame/drivers/galaxian.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 92a07f211c9..3ff82a8e40d 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -382,6 +382,7 @@ hustlerb4 // bootleg frogger // GX392 (c) 1981 Konami froggers1 // (c) 1981 Sega froggers2 // 834-0068 (c) 1981 Sega +froggers3 // froggermc // 800-3110 (c) 1981 Sega amidar // GX337 (c) 1982 Konami amidar1 // GX337 (c) 1981 Konami diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp index 9fb23df9be1..09b615701cf 100644 --- a/src/mame/drivers/galaxian.cpp +++ b/src/mame/drivers/galaxian.cpp @@ -9750,6 +9750,7 @@ ROM_START( frogger ) ROM_LOAD( "pr-91.6l", 0x0000, 0x0020, CRC(413703bf) SHA1(66648b2b28d3dcbda5bdb2605d1977428939dd3c) ) ROM_END + ROM_START( froggers1 ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "frogger.26", 0x0000, 0x1000, CRC(597696d6) SHA1(e7e021776cad00f095a1ebbef407b7c0a8f5d835) ) /* We need the correct Sega "EPR" labels for these 3 */ @@ -9789,6 +9790,26 @@ ROM_START( froggers2 ) ROM_LOAD( "pr-91.6l", 0x0000, 0x0020, CRC(413703bf) SHA1(66648b2b28d3dcbda5bdb2605d1977428939dd3c) ) ROM_END +ROM_START( froggers3 ) + ROM_REGION( 0x10000, "maincpu", 0 ) // different code revision, but didn't have Sega labels (other roms on PCB did) so might be unofficial mod + ROM_LOAD( "29", 0x0000, 0x1000, CRC(a58e43a7) SHA1(f4d4646cf295ae351279eec87347d4ef980bea26) ) + ROM_LOAD( "30", 0x1000, 0x1000, CRC(119bbedb) SHA1(6a8ef356cbef39c68002e1bb9d2ac0ac8805ac2d) ) + ROM_LOAD( "31", 0x2000, 0x1000, CRC(405595e9) SHA1(1cbcae7159d716b801a5dde8009503d6fcc790c0) ) + + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "epr-608.ic32", 0x0000, 0x0800, CRC(e8ab0256) SHA1(f090afcfacf5f13cdfa0dfda8e3feb868c6ce8bc) ) + ROM_LOAD( "epr-609.ic33", 0x0800, 0x0800, CRC(7380a48f) SHA1(75582a94b696062cbdb66a4c5cf0bc0bb94f81ee) ) + ROM_LOAD( "epr-610.ic34", 0x1000, 0x0800, CRC(31d7eb27) SHA1(2e1d34ae4da385fd7cac94707d25eeddf4604e1a) ) + + ROM_REGION( 0x1000, "gfx1", 0 ) + ROM_LOAD( "epr-607.ic101", 0x0000, 0x0800, CRC(05f7d883) SHA1(78831fd287da18928651a8adb7e578d291493eff) ) + ROM_LOAD( "epr-606.ic102", 0x0800, 0x0800, CRC(f524ee30) SHA1(dd768967add61467baa08d5929001f157d6cd911) ) + + ROM_REGION( 0x0020, "proms", 0 ) + ROM_LOAD( "pr-91.6l", 0x0000, 0x0020, CRC(413703bf) SHA1(66648b2b28d3dcbda5bdb2605d1977428939dd3c) ) +ROM_END + + ROM_START( froggermc ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "epr-1031.15", 0x0000, 0x1000, CRC(4b7c8d11) SHA1(9200b33cac0ef5a6647c95ebd25237fa62fcdf30) ) @@ -11391,6 +11412,7 @@ GAME( 1980, kingballj, kingball, kingball, kingball, galaxian_state, kingb GAME( 1981, frogger, 0, frogger, frogger, galaxian_state, frogger, ROT90, "Konami", "Frogger", MACHINE_SUPPORTS_SAVE ) GAME( 1981, froggers1, frogger, frogger, frogger, galaxian_state, frogger, ROT90, "Konami (Sega license)", "Frogger (Sega set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, froggers2, frogger, frogger, frogger, galaxian_state, frogger, ROT90, "Konami (Sega license)", "Frogger (Sega set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1981, froggers3, frogger, frogger, frogger, galaxian_state, frogger, ROT90, "Konami (Sega license)", "Frogger (Sega set 3)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, froggermc, frogger, froggermc, froggermc, galaxian_state, froggermc, ROT90, "Konami (Sega license)", "Frogger (Moon Cresta hardware)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, froggers, frogger, froggers, frogger, galaxian_state, froggers, ROT90, "bootleg", "Frog", MACHINE_SUPPORTS_SAVE ) GAME( 1981, frogf, frogger, frogf, frogger, galaxian_state, froggers, ROT90, "bootleg (Falcon)", "Frog (Falcon bootleg)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From 56ec560c881af787396032015b5194e14cd1148f Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 8 Feb 2016 18:58:42 +0100 Subject: Fix sequence of primitives while rendering (nw) --- src/osd/modules/render/drawbgfx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 6eaaa2d2fb2..8f0bc447d6e 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -752,6 +752,7 @@ int renderer_bgfx::draw(int update) width = wdim.width(); height = wdim.height(); #endif + bgfx::setViewSeq(0, true); bgfx::setViewRect(0, 0, 0, width, height); bgfx::reset(width, height, video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); // Setup view transform. @@ -779,7 +780,6 @@ int renderer_bgfx::draw(int update) bgfx::touch(0); window().m_primlist->acquire_lock(); - // Draw quad. // now draw uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP; -- cgit v1.2.3-70-g09d2 From ae55e9ffcba46faa090121ee56c4f8f0f7a69133 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 8 Feb 2016 19:21:46 +0100 Subject: fix compile (nw) --- src/devices/bus/m5/rom.h | 14 +++++++------- src/devices/bus/m5/slot.h | 30 +++++++++++++++--------------- src/mame/drivers/m5.cpp | 16 +++++++++++----- src/mame/includes/m5.h | 8 ++++---- 4 files changed, 37 insertions(+), 31 deletions(-) diff --git a/src/devices/bus/m5/rom.h b/src/devices/bus/m5/rom.h index 8bf62a90fa8..dedd7555f1c 100644 --- a/src/devices/bus/m5/rom.h +++ b/src/devices/bus/m5/rom.h @@ -17,11 +17,11 @@ public: m5_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); // device-level overrides - virtual void device_start() {} - virtual void device_reset() {} + virtual void device_start() override {} + virtual void device_reset() override {} // reading and writing - virtual DECLARE_READ8_MEMBER(read_rom); + virtual DECLARE_READ8_MEMBER(read_rom) override; }; // ======================> m5_ram_device @@ -33,12 +33,12 @@ public: m5_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); // device-level overrides - virtual void device_start() {} - virtual void device_reset() {} + virtual void device_start() override {} + virtual void device_reset() override {} // reading and writing - virtual DECLARE_READ8_MEMBER(read_ram); - virtual DECLARE_WRITE8_MEMBER(write_ram); + virtual DECLARE_READ8_MEMBER(read_ram) override; + virtual DECLARE_WRITE8_MEMBER(write_ram) override; }; diff --git a/src/devices/bus/m5/slot.h b/src/devices/bus/m5/slot.h index 8010f9f5b26..4f9c7e8fb41 100644 --- a/src/devices/bus/m5/slot.h +++ b/src/devices/bus/m5/slot.h @@ -64,30 +64,30 @@ public: virtual ~m5_cart_slot_device(); // device-level overrides - virtual void device_start(); - virtual void device_config_complete(); + virtual void device_start() override; + virtual void device_config_complete() override; // image-level overrides - virtual bool call_load(); - virtual void call_unload() {} - virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry); + virtual bool call_load() override; + virtual void call_unload() override {} + virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) override; int get_type() { return m_type; } void save_ram() { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); } - virtual iodevice_t image_type() const { return IO_CARTSLOT; } - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 0; } - virtual bool is_creatable() const { return 0; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 1; } - virtual const option_guide *create_option_guide() const { return NULL; } - virtual const char *image_interface() const { return "m5_cart"; } - virtual const char *file_extensions() const { return "bin,rom"; } + virtual iodevice_t image_type() const override { return IO_CARTSLOT; } + virtual bool is_readable() const override { return 1; } + virtual bool is_writeable() const override { return 0; } + virtual bool is_creatable() const override { return 0; } + virtual bool must_be_loaded() const override { return 0; } + virtual bool is_reset_on_load() const override { return 1; } + virtual const option_guide *create_option_guide() const override { return NULL; } + virtual const char *image_interface() const override { return "m5_cart"; } + virtual const char *file_extensions() const override { return "bin,rom"; } // slot interface overrides - virtual void get_default_card_software(std::string &result); + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom); diff --git a/src/mame/drivers/m5.cpp b/src/mame/drivers/m5.cpp index f9487075fb9..6c48e8786d0 100644 --- a/src/mame/drivers/m5.cpp +++ b/src/mame/drivers/m5.cpp @@ -1268,17 +1268,20 @@ void m5_state::machine_reset() std::string region_tag; //is ram/rom cart plugged in? - if (m_cart1->exists()) + if (m_cart1->exists()) + { if (m_cart1->get_type() > 0) m_cart_ram=m_cart1; else m_cart=m_cart1; - if (m_cart2->exists()) + } + if (m_cart2->exists()) + { if (m_cart2->get_type() > 0) m_cart_ram=m_cart2; else m_cart=m_cart2; - + } // no cart inserted - there is nothing to do - not allowed in original Sord m5 if (m_cart_ram == NULL && m_cart == NULL) { @@ -1375,17 +1378,20 @@ void brno_state::machine_reset() program.unmap_write(0x0000, 0x5fff); //is ram/rom cart plugged in? - if (m_cart1->exists()) + if (m_cart1->exists()) + { if (m_cart1->get_type() > 0) m_cart_ram=m_cart1; else m_cart=m_cart1; + } if (m_cart2->exists()) + { if (m_cart2->get_type() > 0) m_cart_ram=m_cart2; else m_cart=m_cart2; - + } if (m_cart) { diff --git a/src/mame/includes/m5.h b/src/mame/includes/m5.h index b338985cd2c..9b5d82b0c00 100644 --- a/src/mame/includes/m5.h +++ b/src/mame/includes/m5.h @@ -58,8 +58,8 @@ public: required_ioport m_reset; optional_ioport m_DIPS; - virtual void machine_start(); - virtual void machine_reset(); + virtual void machine_start() override; + virtual void machine_reset() override; DECLARE_READ8_MEMBER( sts_r ); DECLARE_WRITE8_MEMBER( com_w ); @@ -150,8 +150,8 @@ public: // DECLARE_DEVICE_IMAGE_LOAD_MEMBER(m5_cart); - virtual void machine_start(); - virtual void machine_reset(); + virtual void machine_start() override; + virtual void machine_reset() override; UINT8 m_rambank; // bank # UINT8 m_ramcpu; //where Ramdisk bank is mapped -- cgit v1.2.3-70-g09d2 From a29920336dc4c7a9efe53b32bc821e421525f836 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 8 Feb 2016 19:29:42 +0100 Subject: real fix (nw) --- scripts/src/bus.lua | 14 ++++++++++++++ scripts/target/mame/mess.lua | 1 + src/devices/bus/m5/slot.cpp | 11 ++++++----- src/devices/bus/m5/slot.h | 1 - 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index bafa63a269d..9514e9f5a74 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -2558,3 +2558,17 @@ if (BUSES["CGENIE_PARALLEL"]~=null) then MAME_DIR .. "src/devices/bus/cgenie/parallel/printer.h", } end + +--------------------------------------------------- +-- +--@src/devices/bus/m5/slot.h,BUSES["M5"] = true +--------------------------------------------------- +if (BUSES["M5"]~=null) then + files { + MAME_DIR .. "src/devices/bus/m5/slot.cpp", + MAME_DIR .. "src/devices/bus/m5/slot.h", + MAME_DIR .. "src/devices/bus/m5/rom.cpp", + MAME_DIR .. "src/devices/bus/m5/rom.h", + } +end + diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 5a7e1c82d3a..c1e73771342 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -619,6 +619,7 @@ BUSES["ISA"] = true BUSES["ISBX"] = true BUSES["KC"] = true BUSES["LPCI"] = true +BUSES["M5"] = true BUSES["MACPDS"] = true BUSES["MIDI"] = true BUSES["MEGADRIVE"] = true diff --git a/src/devices/bus/m5/slot.cpp b/src/devices/bus/m5/slot.cpp index 0f3d275f699..162d802136e 100644 --- a/src/devices/bus/m5/slot.cpp +++ b/src/devices/bus/m5/slot.cpp @@ -210,7 +210,7 @@ bool m5_cart_slot_device::call_load() bool m5_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { - load_software_part_region(*this, swlist, swname, start_entry); + machine().rom_load().load_software_part_region(*this, swlist, swname, start_entry); return TRUE; } @@ -219,12 +219,13 @@ bool m5_cart_slot_device::call_softlist_load(software_list_device &swlist, const get default card software -------------------------------------------------*/ -void m5_cart_slot_device::get_default_card_software(std::string &result) +std::string m5_cart_slot_device::get_default_card_software() { + std::string result; if (open_image_file(mconfig().options())) { const char *slot_string = "std"; - UINT32 size = core_fsize(m_file); + //UINT32 size = core_fsize(m_file); int type = M5_STD; @@ -234,10 +235,10 @@ void m5_cart_slot_device::get_default_card_software(std::string &result) clear(); result.assign(slot_string); - return; + return result; } - software_get_default_slot(result, "std"); + return software_get_default_slot("std"); } /*------------------------------------------------- diff --git a/src/devices/bus/m5/slot.h b/src/devices/bus/m5/slot.h index 4f9c7e8fb41..177977043cf 100644 --- a/src/devices/bus/m5/slot.h +++ b/src/devices/bus/m5/slot.h @@ -93,7 +93,6 @@ public: virtual DECLARE_READ8_MEMBER(read_rom); virtual DECLARE_READ8_MEMBER(read_ram); virtual DECLARE_WRITE8_MEMBER(write_ram); - virtual DECLARE_SETOFFSET_MEMBER (read_off); protected: -- cgit v1.2.3-70-g09d2 From d8e6dac5f368c2144ac3991ad924cd61f1b8cc07 Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 8 Feb 2016 19:49:36 +0100 Subject: SCREEN_RAW_PARAMS for jangou.cpp, nw --- src/mame/drivers/jangou.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index a72c7c1a9b6..8a720ba9abe 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -969,12 +969,8 @@ static MACHINE_CONFIG_START( jangou, jangou_state ) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) //not accurate - MCFG_SCREEN_SIZE(256, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 240-1) + MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4,320,0,256,264,16,240) // assume same as nightgal.cpp MCFG_SCREEN_UPDATE_DRIVER(jangou_state, screen_update_jangou) MCFG_SCREEN_PALETTE("palette") @@ -1384,7 +1380,7 @@ DRIVER_INIT_MEMBER(jangou_state,luckygrl) *************************************/ GAME( 1983, jangou, 0, jangou, jangou, driver_device, 0, ROT0, "Nichibutsu", "Jangou [BET] (Japan)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1983, macha, 0, jangou, macha, driver_device, 0, ROT0, "Logitec", "Monoshiri Quiz Osyaberi Macha (Japan)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +GAME( 1983, macha, 0, jangou, macha, driver_device, 0, ROT0, "Logitec", "Monoshiri Quiz Osyaberi Macha (Japan)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) GAME( 1984, jngolady, 0, jngolady, jngolady, jangou_state, jngolady, ROT0, "Nichibutsu", "Jangou Lady (Japan)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) GAME( 1984, cntrygrl, 0, cntrygrl, cntrygrl, driver_device, 0, ROT0, "Royal Denshi", "Country Girl (Japan set 1)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) GAME( 1984, cntrygrla, cntrygrl, cntrygrl, cntrygrl, driver_device, 0, ROT0, "Nichibutsu", "Country Girl (Japan set 2)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From 905ae4ce266b19e755db59daf3120072ca04292e Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 8 Feb 2016 19:54:49 +0100 Subject: Note, nw --- src/mame/drivers/jangou.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index 8a720ba9abe..213ba9f5613 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -264,7 +264,7 @@ WRITE8_MEMBER(jangou_state::blitter_process_w) } } -/* What is the bit 5 (0x20) for?*/ +/* What is bit 5 (0x20) for?*/ WRITE8_MEMBER(jangou_state::blit_vregs_w) { // printf("%02x %02x\n", offset, data); @@ -285,7 +285,7 @@ WRITE8_MEMBER(jangou_state::mux_w) WRITE8_MEMBER(jangou_state::output_w) { /* - --x- ---- ? (polls between high and low in irq routine,probably signals the vblank routine) + --x- ---- ? (polls between high and low in irq routine, most likely irq mask) ---- -x-- flip screen ---- ---x coin counter */ -- cgit v1.2.3-70-g09d2 From 766c14a55c3df7c4943bb1d5e5536823fac96bf9 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Mon, 8 Feb 2016 17:13:55 -0300 Subject: Moon Light (Set 2): Fix the program ROM addressing. This fix the corrupt graphics in the double-Up feature. [Roberto Fresca] --- src/mame/drivers/goldstar.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 989f85ffbb7..360127875b7 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -8239,9 +8239,10 @@ ROM_END effect that shouldn't be there. Maybe is product of a bad dump. Need to be checked with the real board. - Also the cards gfx are corrupt. Tiles are ok, so maybe the code is triggering wrong - pointers to the tiles. + The hardware uses only the second half of the program ROM (double sized), that replaces + the double-up's cards graphics with 'drakkars' (scandinavian / viking ships). +---------------------------------------------------------------------------------------- 28.bin FIXED BITS (00xxxxxx) 29.bin 00xxxxxxxxxxxxxxx = 0xFF moon-gfx1.bin BADADDR --xxxxxxxxxxxxxxxxx @@ -8261,8 +8262,9 @@ ROM_END 28.bin moon-gfx2.bin [4/4] 94.188690% */ ROM_START( moonlghtb ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "moon-main.bin", 0x0000, 0x20000, CRC(0a4b5dd0) SHA1(825801e9b72c10fed8e07f42b3b475688bdbd878) ) + ROM_REGION( 0x20000, "maincpu", 0 ) // using only the second half of the program ROM. + ROM_LOAD( "moon-main.bin", 0x10000, 0x10000, CRC(0a4b5dd0) SHA1(825801e9b72c10fed8e07f42b3b475688bdbd878) ) + ROM_CONTINUE( 0x00000, 0x10000) ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "moon-gfx2.bin", 0x00000, 0x80000, CRC(2ce5b722) SHA1(feb87fbf3b8d875842df80cd1edfef5071ed60c7) ) @@ -13324,7 +13326,7 @@ DRIVER_INIT_MEMBER(goldstar_state, wcherry) GAMEL( 199?, goldstar, 0, goldstar, goldstar, goldstar_state, goldstar, ROT0, "IGS", "Golden Star", 0, layout_goldstar ) GAMEL( 199?, goldstbl, goldstar, goldstbl, goldstar, driver_device, 0, ROT0, "IGS", "Golden Star (Blue version)", 0, layout_goldstar ) GAME( 199?, moonlght, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (bootleg of Golden Star, set 1)", 0 ) -GAME( 199?, moonlghtb, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (bootleg of Golden Star, set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_COLORS ) // need to check the odd palette value at 0xc780. should be black. also cards gfx are corrupt. +GAME( 199?, moonlghtb, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (bootleg of Golden Star, set 2)", MACHINE_IMPERFECT_COLORS ) // need to check the odd palette value at 0xc780. should be black. GAMEL( 199?, chrygld, 0, chrygld, chrygld, cb3_state, chrygld, ROT0, "bootleg", "Cherry Gold I", 0, layout_chrygld ) GAMEL( 199?, chry10, 0, chrygld, chry10, cb3_state, chry10, ROT0, "bootleg", "Cherry 10 (bootleg with PIC16F84)", 0, layout_chrygld ) GAME( 199?, goldfrui, goldstar, goldfrui, goldstar, driver_device, 0, ROT0, "bootleg", "Gold Fruit", 0 ) // maybe fullname should be 'Gold Fruit (main 40%)' -- cgit v1.2.3-70-g09d2 From 4cf4d96429d4d491f219a1e137f3d44cadde6fd8 Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 8 Feb 2016 20:50:58 +0100 Subject: Moved JANGOU_BLITTER into a device [Angelo Salese] --- scripts/src/video.lua | 12 +++ src/devices/video/jangou_blitter.cpp | 152 +++++++++++++++++++++++++++++++++++ src/devices/video/jangou_blitter.h | 65 +++++++++++++++ src/mame/drivers/jangou.cpp | 132 +++--------------------------- 4 files changed, 242 insertions(+), 119 deletions(-) create mode 100644 src/devices/video/jangou_blitter.cpp create mode 100644 src/devices/video/jangou_blitter.h diff --git a/scripts/src/video.lua b/scripts/src/video.lua index fafc07e37f6..96a310f154b 100644 --- a/scripts/src/video.lua +++ b/scripts/src/video.lua @@ -842,3 +842,15 @@ if (VIDEOS["CRTC_EGA"]~=null) then MAME_DIR .. "src/devices/video/crtc_ega.h", } end + +-------------------------------------------------- +-- +--@src/devices/video/jangou_blitter.h,VIDEOS["JANGOU_BLITTER"] = true +-------------------------------------------------- + +if (VIDEOS["JANGOU_BLITTER"]~=null) then + files { + MAME_DIR .. "src/devices/video/jangou_blitter.cpp", + MAME_DIR .. "src/devices/video/jangou_blitter.h", + } +end diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp new file mode 100644 index 00000000000..fa78662e21f --- /dev/null +++ b/src/devices/video/jangou_blitter.cpp @@ -0,0 +1,152 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Jangou Custom Blitter Chip, codename "???" (name scratched afaik) + + device emulation by Angelo Salese, from original jangou.cpp implementation + by Angelo Salese, David Haywood and Phil Bennett + +***************************************************************************/ + +#include "emu.h" +#include "jangou_blitter.h" + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +const device_type JANGOU_BLITTER = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// jangou_blitter_device - constructor +//------------------------------------------------- + +jangou_blitter_device::jangou_blitter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, JANGOU_BLITTER, "Jangou Blitter Custom Chip", tag, owner, clock, "jangou_blitter", __FILE__) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void jangou_blitter_device::device_start() +{ + m_gfxrom = machine().root_device().memregion("gfx")->base(); + if (m_gfxrom == null) + fatalerror("JANGOU_BLITTER: \"gfx\" memory base not found"); + + save_item(NAME(m_pen_data)); + save_item(NAME(m_blit_data)); + save_item(NAME(m_blit_buffer)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void jangou_blitter_device::device_reset() +{ + int i; + + for (i = 0; i < 6; i++) + m_blit_data[i] = 0; + + for (i = 0; i < 16; i++) + m_pen_data[i] = 0; +} + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +// TODO: inline these +UINT8 jangou_blitter_device::gfx_nibble( UINT16 niboffset ) +{ + if (niboffset & 1) + return (m_gfxrom[(niboffset >> 1) & 0xffff] & 0xf0) >> 4; + else + return (m_gfxrom[(niboffset >> 1) & 0xffff] & 0x0f); +} + +void jangou_blitter_device::plot_gfx_pixel( UINT8 pix, int x, int y ) +{ + if (y < 0 || y >= 512) + return; + if (x < 0 || x >= 512) + return; + + if (x & 1) + m_blit_buffer[(y * 256) + (x >> 1)] = (m_blit_buffer[(y * 256) + (x >> 1)] & 0x0f) | ((pix << 4) & 0xf0); + else + m_blit_buffer[(y * 256) + (x >> 1)] = (m_blit_buffer[(y * 256) + (x >> 1)] & 0xf0) | (pix & 0x0f); +} + +WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) +{ + int src, x, y, h, w, flipx; + m_blit_data[offset] = data; + + if (offset == 5) + { + int count = 0; + int xcount, ycount; + + /* printf("%02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2], + m_blit_data[3], m_blit_data[4], m_blit_data[5]); */ + w = (m_blit_data[4] & 0xff) + 1; + h = (m_blit_data[5] & 0xff) + 1; + src = ((m_blit_data[1] << 8)|(m_blit_data[0] << 0)); + x = (m_blit_data[2] & 0xff); + y = (m_blit_data[3] & 0xff); + + // lowest bit of src controls flipping / draw direction? + flipx = (m_blit_data[0] & 1); + + if (!flipx) + src += (w * h) - 1; + else + src -= (w * h) - 1; + + for (ycount = 0; ycount < h; ycount++) + { + for(xcount = 0; xcount < w; xcount++) + { + int drawx = (x + xcount) & 0xff; + int drawy = (y + ycount) & 0xff; + UINT8 dat = gfx_nibble(src + count); + UINT8 cur_pen_hi = m_pen_data[(dat & 0xf0) >> 4]; + UINT8 cur_pen_lo = m_pen_data[(dat & 0x0f) >> 0]; + + dat = cur_pen_lo | (cur_pen_hi << 4); + + if ((dat & 0xff) != 0) + plot_gfx_pixel(dat, drawx, drawy); + + if (!flipx) + count--; + else + count++; + } + } + } +} + +WRITE8_MEMBER( jangou_blitter_device::blitter_vregs_w) +{ + // printf("%02x %02x\n", offset, data); + m_pen_data[offset] = data & 0xf; +} + diff --git a/src/devices/video/jangou_blitter.h b/src/devices/video/jangou_blitter.h new file mode 100644 index 00000000000..ad4193c4191 --- /dev/null +++ b/src/devices/video/jangou_blitter.h @@ -0,0 +1,65 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + +Template for skeleton device + +***************************************************************************/ + +#pragma once + +#ifndef __JANGOU_BLITTERDEV_H__ +#define __JANGOU_BLITTERDEV_H__ + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_JANGOU_BLITTER_ADD(_tag,_freq) \ + MCFG_DEVICE_ADD(_tag, JANGOU_BLITTER, _freq) + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> jangou_blitter_device + +class jangou_blitter_device : public device_t +{ +public: + // construction/destruction + jangou_blitter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // I/O operations + DECLARE_WRITE8_MEMBER( blitter_process_w ); + DECLARE_WRITE8_MEMBER( blitter_vregs_w ); + UINT8 m_blit_buffer[256 * 256]; + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + +private: + void plot_gfx_pixel( UINT8 pix, int x, int y ); + UINT8 gfx_nibble( UINT16 niboffset ); + UINT8 m_pen_data[0x10]; + UINT8 m_blit_data[6]; + UINT8 *m_gfxrom; +}; + + +// device type definition +extern const device_type JANGOU_BLITTER; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index 213ba9f5613..ac8b03fca0f 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -32,9 +32,9 @@ $c088-$c095 player tiles #include "sound/hc55516.h" #include "sound/msm5205.h" #include "video/resnet.h" +#include "video/jangou_blitter.h" #include "machine/nvram.h" - #define MASTER_CLOCK XTAL_19_968MHz class jangou_state : public driver_device @@ -47,7 +47,8 @@ public: m_nsc(*this, "nsc"), m_msm(*this, "msm"), m_cvsd(*this, "cvsd"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_blitter(*this, "blitter") { } /* sound-related */ // Jangou CVSD Sound @@ -70,13 +71,9 @@ public: optional_device m_msm; optional_device m_cvsd; required_device m_palette; + required_device m_blitter; /* video-related */ - UINT8 m_pen_data[0x10]; - UINT8 m_blit_data[6]; - UINT8 m_blit_buffer[256 * 256]; - DECLARE_WRITE8_MEMBER(blitter_process_w); - DECLARE_WRITE8_MEMBER(blit_vregs_w); DECLARE_WRITE8_MEMBER(mux_w); DECLARE_WRITE8_MEMBER(output_w); DECLARE_WRITE8_MEMBER(sound_latch_w); @@ -102,8 +99,6 @@ public: DECLARE_MACHINE_RESET(common); UINT32 screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(cvsd_bit_timer_callback); - UINT8 jangou_gfx_nibble( UINT16 niboffset ); - void plot_jangou_gfx_pixel( UINT8 pix, int x, int y ); DECLARE_WRITE_LINE_MEMBER(jngolady_vclk_cb); }; @@ -157,7 +152,6 @@ PALETTE_INIT_MEMBER(jangou_state, jangou) void jangou_state::video_start() { - save_item(NAME(m_blit_buffer)); } UINT32 jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -166,7 +160,7 @@ UINT32 jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 &b for (y = cliprect.min_y; y <= cliprect.max_y; ++y) { - UINT8 *src = &m_blit_buffer[y * 512 / 2 + cliprect.min_x]; + UINT8 *src = &m_blitter->m_blit_buffer[y * 256 + cliprect.min_x]; UINT16 *dst = &bitmap.pix16(y, cliprect.min_x); for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) @@ -180,97 +174,6 @@ UINT32 jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 &b return 0; } -/* -Blitter Memory Map: - -src lo word[$12] -src hi word[$13] -x [$14] -y [$15] -h [$16] -w [$17] -*/ - -UINT8 jangou_state::jangou_gfx_nibble( UINT16 niboffset ) -{ - const UINT8 *const blit_rom = memregion("gfx")->base(); - - if (niboffset & 1) - return (blit_rom[(niboffset >> 1) & 0xffff] & 0xf0) >> 4; - else - return (blit_rom[(niboffset >> 1) & 0xffff] & 0x0f); -} - -void jangou_state::plot_jangou_gfx_pixel( UINT8 pix, int x, int y ) -{ - if (y < 0 || y >= 512) - return; - if (x < 0 || x >= 512) - return; - - if (x & 1) - m_blit_buffer[(y * 256) + (x >> 1)] = (m_blit_buffer[(y * 256) + (x >> 1)] & 0x0f) | ((pix << 4) & 0xf0); - else - m_blit_buffer[(y * 256) + (x >> 1)] = (m_blit_buffer[(y * 256) + (x >> 1)] & 0xf0) | (pix & 0x0f); -} - -WRITE8_MEMBER(jangou_state::blitter_process_w) -{ - int src, x, y, h, w, flipx; - m_blit_data[offset] = data; - - if (offset == 5) - { - int count = 0; - int xcount, ycount; - - /* printf("%02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2], - m_blit_data[3], m_blit_data[4], m_blit_data[5]); */ - w = (m_blit_data[4] & 0xff) + 1; - h = (m_blit_data[5] & 0xff) + 1; - src = ((m_blit_data[1] << 8)|(m_blit_data[0] << 0)); - x = (m_blit_data[2] & 0xff); - y = (m_blit_data[3] & 0xff); - - // lowest bit of src controls flipping / draw direction? - flipx = (m_blit_data[0] & 1); - - if (!flipx) - src += (w * h) - 1; - else - src -= (w * h) - 1; - - for (ycount = 0; ycount < h; ycount++) - { - for(xcount = 0; xcount < w; xcount++) - { - int drawx = (x + xcount) & 0xff; - int drawy = (y + ycount) & 0xff; - UINT8 dat = jangou_gfx_nibble(src + count); - UINT8 cur_pen_hi = m_pen_data[(dat & 0xf0) >> 4]; - UINT8 cur_pen_lo = m_pen_data[(dat & 0x0f) >> 0]; - - dat = cur_pen_lo | (cur_pen_hi << 4); - - if ((dat & 0xff) != 0) - plot_jangou_gfx_pixel(dat, drawx, drawy); - - if (!flipx) - count--; - else - count++; - } - } - } -} - -/* What is bit 5 (0x20) for?*/ -WRITE8_MEMBER(jangou_state::blit_vregs_w) -{ - // printf("%02x %02x\n", offset, data); - m_pen_data[offset] = data & 0xf; -} - /************************************* * * I/O @@ -418,8 +321,8 @@ static ADDRESS_MAP_START( cpu0_io, AS_IO, 8, jangou_state ) AM_RANGE(0x10,0x10) AM_READ_PORT("DSW") //dsw + blitter busy flag AM_RANGE(0x10,0x10) AM_WRITE(output_w) AM_RANGE(0x11,0x11) AM_WRITE(mux_w) - AM_RANGE(0x12,0x17) AM_WRITE(blitter_process_w) - AM_RANGE(0x20,0x2f) AM_WRITE(blit_vregs_w) + AM_RANGE(0x12,0x17) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_process_w) + AM_RANGE(0x20,0x2f) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_vregs_w) AM_RANGE(0x30,0x30) AM_WRITENOP //? polls 0x03 continuously AM_RANGE(0x31,0x31) AM_WRITE(sound_latch_w) ADDRESS_MAP_END @@ -489,8 +392,8 @@ static ADDRESS_MAP_START( cntrygrl_cpu0_io, AS_IO, 8, jangou_state ) AM_RANGE(0x10,0x10) AM_READ_PORT("DSW") //dsw + blitter busy flag AM_RANGE(0x10,0x10) AM_WRITE(output_w) AM_RANGE(0x11,0x11) AM_WRITE(mux_w) - AM_RANGE(0x12,0x17) AM_WRITE(blitter_process_w) - AM_RANGE(0x20,0x2f) AM_WRITE(blit_vregs_w ) + AM_RANGE(0x12,0x17) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_process_w) + AM_RANGE(0x20,0x2f) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_vregs_w) AM_RANGE(0x30,0x30) AM_WRITENOP //? polls 0x03 continuously // AM_RANGE(0x31,0x31) AM_WRITE(sound_latch_w) ADDRESS_MAP_END @@ -514,8 +417,8 @@ static ADDRESS_MAP_START( roylcrdn_cpu0_io, AS_IO, 8, jangou_state ) AM_RANGE(0x10,0x10) AM_WRITENOP /* Writes continuosly 0's in attract mode, and 1's in game */ AM_RANGE(0x11,0x11) AM_WRITE(mux_w) AM_RANGE(0x13,0x13) AM_READNOP /* Often reads bit7 with unknown purposes */ - AM_RANGE(0x12,0x17) AM_WRITE(blitter_process_w) - AM_RANGE(0x20,0x2f) AM_WRITE(blit_vregs_w) + AM_RANGE(0x12,0x17) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_process_w) + AM_RANGE(0x20,0x2f) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_vregs_w) AM_RANGE(0x30,0x30) AM_WRITENOP /* Seems to write 0x10 on each sound event */ ADDRESS_MAP_END @@ -896,8 +799,6 @@ INPUT_PORTS_END MACHINE_START_MEMBER(jangou_state,common) { - save_item(NAME(m_pen_data)); - save_item(NAME(m_blit_data)); save_item(NAME(m_mux_data)); } @@ -925,15 +826,7 @@ MACHINE_START_MEMBER(jangou_state,jngolady) MACHINE_RESET_MEMBER(jangou_state,common) { - int i; - m_mux_data = 0; - - for (i = 0; i < 6; i++) - m_blit_data[i] = 0; - - for (i = 0; i < 16; i++) - m_pen_data[i] = 0; } void jangou_state::machine_reset() @@ -967,7 +860,8 @@ static MACHINE_CONFIG_START( jangou, jangou_state ) MCFG_CPU_PROGRAM_MAP(cpu1_map) MCFG_CPU_IO_MAP(cpu1_io) - + MCFG_JANGOU_BLITTER_ADD("blitter", MASTER_CLOCK/4) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4,320,0,256,264,16,240) // assume same as nightgal.cpp -- cgit v1.2.3-70-g09d2 From a77ab067f94e20eebaa39d5b5ff050cad79d47f6 Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 8 Feb 2016 20:51:23 +0100 Subject: null -> nullptr --- src/devices/video/jangou_blitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index fa78662e21f..2cea24cfd8b 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -43,7 +43,7 @@ jangou_blitter_device::jangou_blitter_device(const machine_config &mconfig, cons void jangou_blitter_device::device_start() { m_gfxrom = machine().root_device().memregion("gfx")->base(); - if (m_gfxrom == null) + if (m_gfxrom == nullptr) fatalerror("JANGOU_BLITTER: \"gfx\" memory base not found"); save_item(NAME(m_pen_data)); -- cgit v1.2.3-70-g09d2 From 78592ed5eea2e92efe836eb22de6e2e84429620a Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 8 Feb 2016 20:58:48 +0100 Subject: Added region size, nw --- src/devices/video/jangou_blitter.cpp | 17 ++++++++++++----- src/devices/video/jangou_blitter.h | 1 + src/mame/drivers/jangou.cpp | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index 2cea24cfd8b..e7390d44a8f 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -5,8 +5,12 @@ Jangou Custom Blitter Chip, codename "???" (name scratched afaik) device emulation by Angelo Salese, from original jangou.cpp implementation - by Angelo Salese, David Haywood and Phil Bennett + by Angelo Salese, David Haywood and Phil Bennett + TODO: + - BLTFLIP mechanism; + - clean-ups; + ***************************************************************************/ #include "emu.h" @@ -42,10 +46,13 @@ jangou_blitter_device::jangou_blitter_device(const machine_config &mconfig, cons void jangou_blitter_device::device_start() { - m_gfxrom = machine().root_device().memregion("gfx")->base(); + memory_region *devregion = machine().root_device().memregion("gfx"); + m_gfxrom = devregion->base(); if (m_gfxrom == nullptr) fatalerror("JANGOU_BLITTER: \"gfx\" memory base not found"); - + m_gfxrommask = devregion->bytes()-1; + + save_item(NAME(m_pen_data)); save_item(NAME(m_blit_data)); save_item(NAME(m_blit_buffer)); @@ -76,9 +83,9 @@ void jangou_blitter_device::device_reset() UINT8 jangou_blitter_device::gfx_nibble( UINT16 niboffset ) { if (niboffset & 1) - return (m_gfxrom[(niboffset >> 1) & 0xffff] & 0xf0) >> 4; + return (m_gfxrom[(niboffset >> 1) & m_gfxrommask] & 0xf0) >> 4; else - return (m_gfxrom[(niboffset >> 1) & 0xffff] & 0x0f); + return (m_gfxrom[(niboffset >> 1) & m_gfxrommask] & 0x0f); } void jangou_blitter_device::plot_gfx_pixel( UINT8 pix, int x, int y ) diff --git a/src/devices/video/jangou_blitter.h b/src/devices/video/jangou_blitter.h index ad4193c4191..d96ff1d11f7 100644 --- a/src/devices/video/jangou_blitter.h +++ b/src/devices/video/jangou_blitter.h @@ -48,6 +48,7 @@ private: UINT8 m_pen_data[0x10]; UINT8 m_blit_data[6]; UINT8 *m_gfxrom; + UINT32 m_gfxrommask; }; diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index ac8b03fca0f..9d158c2bf3c 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -1180,7 +1180,7 @@ ROM_START( roylcrdn ) ROM_LOAD( "prg.p2", 0x1000, 0x1000, CRC(7e10259d) SHA1(d1279922a8c2475c3c73d9960b0a728c0ef851fb) ) ROM_LOAD( "prg.p3", 0x2000, 0x1000, CRC(06ef7073) SHA1(d3f990d710629b23daec76cd7ad6ccc7e066e710) ) - ROM_REGION( 0x20000, "gfx", 0 ) + ROM_REGION( 0x10000, "gfx", 0 ) ROM_LOAD( "chrgen.cr1", 0x0000, 0x1000, CRC(935d0e1c) SHA1(0d5b067f6931585c8138b211cf73e5f585af8101) ) ROM_LOAD( "chrgen.cr2", 0x1000, 0x1000, CRC(4429362e) SHA1(0bbb6dedf919e0453be2db6343827c5787d139f3) ) ROM_LOAD( "chrgen.cr3", 0x2000, 0x1000, CRC(dc059cc9) SHA1(3041e83b9a265adfe4e1da889ae6a18593de0894) ) @@ -1196,7 +1196,7 @@ ROM_START( luckygrl ) ROM_LOAD( "7.9f", 0x01000, 0x01000, CRC(14a44d23) SHA1(4f84a8f986a8fd9d5ac0636be1bb036c3b2746c2) ) ROM_LOAD( "6.9e", 0x02000, 0x01000, CRC(06850aa8) SHA1(c23cb6b7b26d5586b1a095dee88228d1613ae7d0) ) - ROM_REGION( 0x80000, "gfx", 0 ) + ROM_REGION( 0x10000, "gfx", 0 ) ROM_LOAD( "1.5r", 0x00000, 0x2000, CRC(fb429678) SHA1(00e37e90550d9190d06977a5f5ed75b691750cc1) ) ROM_LOAD( "piggy2.5r", 0x02000, 0x2000, CRC(a3919845) SHA1(45fffe34b7a29ecf8c8feb4152b5c7330ea3ad83) ) ROM_LOAD( "3.5n", 0x04000, 0x2000, CRC(130cfb89) SHA1(86b2a2142675cbd69d7cccab9b00f4c8863cdcbc) ) -- cgit v1.2.3-70-g09d2 From 7a1eb1d2add20aab3b78f9e1712af823085e715e Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 8 Feb 2016 21:36:36 +0100 Subject: Moved Night Gal to use JANGOU_BLITTER --- src/devices/video/jangou_blitter.cpp | 17 ++-- src/devices/video/jangou_blitter.h | 4 +- src/mame/drivers/nightgal.cpp | 187 +++++------------------------------ 3 files changed, 30 insertions(+), 178 deletions(-) diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index e7390d44a8f..be11e07b315 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -52,7 +52,6 @@ void jangou_blitter_device::device_start() fatalerror("JANGOU_BLITTER: \"gfx\" memory base not found"); m_gfxrommask = devregion->bytes()-1; - save_item(NAME(m_pen_data)); save_item(NAME(m_blit_data)); save_item(NAME(m_blit_buffer)); @@ -65,13 +64,8 @@ void jangou_blitter_device::device_start() void jangou_blitter_device::device_reset() { - int i; - - for (i = 0; i < 6; i++) - m_blit_data[i] = 0; - - for (i = 0; i < 16; i++) - m_pen_data[i] = 0; + memset(m_blit_data, 0, ARRAY_LENGTH(m_blit_data)); + memset(m_pen_data, 0, ARRAY_LENGTH(m_pen_data)); } @@ -80,7 +74,7 @@ void jangou_blitter_device::device_reset() //************************************************************************** // TODO: inline these -UINT8 jangou_blitter_device::gfx_nibble( UINT16 niboffset ) +UINT8 jangou_blitter_device::gfx_nibble( UINT32 niboffset ) { if (niboffset & 1) return (m_gfxrom[(niboffset >> 1) & m_gfxrommask] & 0xf0) >> 4; @@ -111,11 +105,12 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) int count = 0; int xcount, ycount; - /* printf("%02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2], - m_blit_data[3], m_blit_data[4], m_blit_data[5]); */ + //printf("%02x %02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2], + // m_blit_data[3], m_blit_data[4], m_blit_data[5],m_blit_data[6]); w = (m_blit_data[4] & 0xff) + 1; h = (m_blit_data[5] & 0xff) + 1; src = ((m_blit_data[1] << 8)|(m_blit_data[0] << 0)); + src |= (m_blit_data[6] & 3) << 16; x = (m_blit_data[2] & 0xff); y = (m_blit_data[3] & 0xff); diff --git a/src/devices/video/jangou_blitter.h b/src/devices/video/jangou_blitter.h index d96ff1d11f7..735fea64a73 100644 --- a/src/devices/video/jangou_blitter.h +++ b/src/devices/video/jangou_blitter.h @@ -44,9 +44,9 @@ protected: private: void plot_gfx_pixel( UINT8 pix, int x, int y ); - UINT8 gfx_nibble( UINT16 niboffset ); + UINT8 gfx_nibble( UINT32 niboffset ); UINT8 m_pen_data[0x10]; - UINT8 m_blit_data[6]; + UINT8 m_blit_data[7]; UINT8 *m_gfxrom; UINT32 m_gfxrommask; }; diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 98976ef8b88..b89e04c5ad3 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -24,6 +24,7 @@ TODO: #include "sound/2203intf.h" #include "cpu/z80/z80.h" #include "cpu/m6800/m6800.h" +#include "video/jangou_blitter.h" #include "video/resnet.h" #define MASTER_CLOCK XTAL_19_968MHz @@ -36,7 +37,6 @@ public: m_comms_ram(*this, "comms_ram"), m_maincpu(*this, "maincpu"), m_subcpu(*this, "sub"), - m_gfxrom(*this, "gfx1"), m_io_cr_clear(*this, "CR_CLEAR"), m_io_coins(*this, "COINS"), m_io_pl1_1(*this, "PL1_1"), @@ -56,13 +56,11 @@ public: m_io_dswa(*this, "DSWA"), m_io_dswb(*this, "DSWB"), m_io_dswc(*this, "DSWC"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_blitter(*this, "blitter") { } /* video-related */ UINT8 m_blit_raw_data[3]; - UINT8 m_true_blit[7]; - UINT8 m_pen_data[0x10]; - UINT8 m_pen_raw_data[0x10]; /* misc */ UINT8 m_nsc_latch; @@ -76,17 +74,14 @@ public: required_device m_subcpu; /* memory */ - UINT8 m_blit_buffer[256*256]; DECLARE_READ8_MEMBER(blitter_status_r); - DECLARE_WRITE8_MEMBER(nsc_true_blitter_w); - DECLARE_WRITE8_MEMBER(sexygal_nsc_true_blitter_w); + //DECLARE_WRITE8_MEMBER(sexygal_nsc_true_blitter_w); DECLARE_WRITE8_MEMBER(royalqn_blitter_0_w); DECLARE_WRITE8_MEMBER(royalqn_blitter_1_w); DECLARE_WRITE8_MEMBER(royalqn_blitter_2_w); DECLARE_READ8_MEMBER(royalqn_nsc_blit_r); DECLARE_READ8_MEMBER(royalqn_comm_r); DECLARE_WRITE8_MEMBER(royalqn_comm_w); - DECLARE_WRITE8_MEMBER(blit_true_vregs_w); DECLARE_WRITE8_MEMBER(mux_w); DECLARE_READ8_MEMBER(input_1p_r); DECLARE_READ8_MEMBER(input_2p_r); @@ -100,7 +95,6 @@ public: UINT32 screen_update_nightgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); protected: - required_region_ptr m_gfxrom; required_ioport m_io_cr_clear; required_ioport m_io_coins; required_ioport m_io_pl1_1; @@ -121,11 +115,10 @@ protected: required_ioport m_io_dswb; required_ioport m_io_dswc; required_device m_palette; + required_device m_blitter; void z80_wait_assert_cb(); TIMER_CALLBACK_MEMBER( z80_wait_ack_cb ); - - UINT8 nightgal_gfx_nibble( int niboffset ); - void plot_nightgal_gfx_pixel( UINT8 pix, int x, int y ); + }; @@ -137,7 +130,6 @@ READ8_MEMBER(nightgal_state::blitter_status_r) void nightgal_state::video_start() { - save_item(NAME(m_blit_buffer)); } UINT32 nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -146,7 +138,7 @@ UINT32 nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind1 for (y = cliprect.min_y; y <= cliprect.max_y; ++y) { - UINT8 *src = &m_blit_buffer[y * 512 / 2 + cliprect.min_x]; + UINT8 *src = &m_blitter->m_blit_buffer[y * 256 + cliprect.min_x]; UINT16 *dst = &bitmap.pix16(y, cliprect.min_x); for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) @@ -161,85 +153,8 @@ UINT32 nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind1 return 0; } -UINT8 nightgal_state::nightgal_gfx_nibble( int niboffset ) -{ - if (niboffset & 1) - { - return (m_gfxrom[(niboffset >> 1) & 0x1ffff] & 0xf0) >> 4; - } - else - { - return (m_gfxrom[(niboffset >> 1) & 0x1ffff] & 0x0f); - } -} - -void nightgal_state::plot_nightgal_gfx_pixel( UINT8 pix, int x, int y ) -{ - if (y >= 512) return; - if (x >= 512) return; - if (y < 0) return; - if (x < 0) return; - - if (x & 1) - m_blit_buffer[(y * 256) + (x >> 1)] = (m_blit_buffer[(y * 256) + (x >> 1)] & 0x0f) | ((pix << 4) & 0xf0); - else - m_blit_buffer[(y * 256) + (x >> 1)] = (m_blit_buffer[(y * 256) + (x >> 1)] & 0xf0) | (pix & 0x0f); -} - -WRITE8_MEMBER(nightgal_state::nsc_true_blitter_w) -{ - int src, x, y, h, w, flipx; - m_true_blit[offset] = data; - - /*trigger blitter write to ram,might not be correct...*/ - if (offset == 5) - { - //printf("%02x %02x %02x %02x %02x %02x %02x\n", m_true_blit[0], m_true_blit[1], m_true_blit[2], m_true_blit[3], m_true_blit[4], m_true_blit[5], m_true_blit[6]); - w = (m_true_blit[4] & 0xff) + 1; - h = (m_true_blit[5] & 0xff) + 1; - src = ((m_true_blit[1] << 8) | (m_true_blit[0] << 0)); - src |= (m_true_blit[6] & 3) << 16; - - x = (m_true_blit[2] & 0xff); - y = (m_true_blit[3] & 0xff); - - // lowest bit of src controls flipping / draw direction? - flipx = (m_true_blit[0] & 1); - - if (!flipx) - src += (w * h) - 1; - else - src -= (w * h) - 1; - - { - int count = 0; - int xcount, ycount; - for (ycount = 0; ycount < h; ycount++) - { - for (xcount = 0; xcount < w; xcount++) - { - int drawx = (x + xcount) & 0xff; - int drawy = (y + ycount) & 0xff; - UINT8 dat = nightgal_gfx_nibble(src + count); - UINT8 cur_pen_hi = m_pen_data[(dat & 0xf0) >> 4]; - UINT8 cur_pen_lo = m_pen_data[(dat & 0x0f) >> 0]; - - dat = cur_pen_lo | (cur_pen_hi << 4); - - if ((dat & 0xff) != 0) - plot_nightgal_gfx_pixel(dat, drawx, drawy); - - if (!flipx) - count--; - else - count++; - } - } - } - } -} - /* different register writes (probably a PAL line swapping).*/ +#ifdef UNUSED_FUNCTION WRITE8_MEMBER(nightgal_state::sexygal_nsc_true_blitter_w) { int src, x, y, h, w, flipx; @@ -294,6 +209,7 @@ WRITE8_MEMBER(nightgal_state::sexygal_nsc_true_blitter_w) } } } +#endif /* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */ PALETTE_INIT_MEMBER(nightgal_state, nightgal) @@ -359,46 +275,7 @@ master-slave algorithm -executes a wai (i.e. halt) opcode then expects to receive another irq... */ -#define MAIN_Z80_RUN if(offset == 2) m_z80_latch = 0x00 -#define MAIN_Z80_HALT if(offset == 2) m_z80_latch = 0x80 -//#define SUB_NCS_RUN m_ncs_latch = 0x00 -//#define SUB_NCS_HALT m_ncs_latch = 0x80 -#ifdef UNUSED_CODE -WRITE8_MEMBER(nightgal_state::nsc_latch_w) -{ - m_subcpu->set_input_line(0, HOLD_LINE ); -} - -READ8_MEMBER(nightgal_state::nsc_latch_r) -{ - return m_z80_latch; -} - -WRITE8_MEMBER(nightgal_state::z80_latch_w) -{ - m_nsc_latch = data; -} - -READ8_MEMBER(nightgal_state::z80_latch_r) -{ - return m_nsc_latch; -} - -/*z80 -> MCU video params*/ -WRITE8_MEMBER(nightgal_state::blitter_w) -{ - m_blit_raw_data[offset] = data; - MAIN_Z80_HALT; -} - -READ8_MEMBER(nightgal_state::nsc_blit_r) -{ - MAIN_Z80_RUN; - return m_blit_raw_data[offset]; -} -#endif /* TODO: simplify this (error in the document) */ - WRITE8_MEMBER(nightgal_state::royalqn_blitter_0_w) { m_blit_raw_data[0] = data; @@ -449,21 +326,6 @@ WRITE8_MEMBER(nightgal_state::royalqn_comm_w) m_comms_ram[offset] = data & 0x80; } -#ifdef UNUSED_CODE -WRITE8_MEMBER(nightgal_state::blit_vregs_w) -{ - m_pen_raw_data[offset] = data; -} - -READ8_MEMBER(nightgal_state::blit_vregs_r) -{ - return m_pen_raw_data[offset]; -} -#endif -WRITE8_MEMBER(nightgal_state::blit_true_vregs_w) -{ - m_pen_data[offset] = data; -} /******************************************** * @@ -557,9 +419,9 @@ static ADDRESS_MAP_START( sexygal_nsc_map, AS_PROGRAM, 8, nightgal_state ) AM_RANGE(0x0000, 0x007f) AM_RAM AM_RANGE(0x0080, 0x0080) AM_READ(blitter_status_r) AM_RANGE(0x0081, 0x0083) AM_READ(royalqn_nsc_blit_r) - AM_RANGE(0x0080, 0x0086) AM_WRITE(sexygal_nsc_true_blitter_w) + AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_process_w) + AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_vregs_w) - AM_RANGE(0x00a0, 0x00af) AM_WRITE(blit_true_vregs_w) AM_RANGE(0x00b0, 0x00b0) AM_WRITENOP // bltflip register AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r, royalqn_comm_w) AM_SHARE("comms_ram") @@ -595,9 +457,8 @@ static ADDRESS_MAP_START( royalqn_nsc_map, AS_PROGRAM, 8, nightgal_state ) AM_RANGE(0x0000, 0x007f) AM_RAM AM_RANGE(0x0080, 0x0080) AM_READ(blitter_status_r) AM_RANGE(0x0081, 0x0083) AM_READ(royalqn_nsc_blit_r) - AM_RANGE(0x0080, 0x0086) AM_WRITE(nsc_true_blitter_w) - - AM_RANGE(0x00a0, 0x00af) AM_WRITE(blit_true_vregs_w) + AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_process_w) + AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_vregs_w) AM_RANGE(0x00b0, 0x00b0) AM_WRITENOP // bltflip register AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r,royalqn_comm_w) @@ -851,9 +712,6 @@ void nightgal_state::machine_start() save_item(NAME(m_mux_data)); save_item(NAME(m_blit_raw_data)); - save_item(NAME(m_true_blit)); - save_item(NAME(m_pen_data)); - save_item(NAME(m_pen_raw_data)); } void nightgal_state::machine_reset() @@ -863,9 +721,6 @@ void nightgal_state::machine_reset() m_mux_data = 0; memset(m_blit_raw_data, 0, ARRAY_LENGTH(m_blit_raw_data)); - memset(m_true_blit, 0, ARRAY_LENGTH(m_true_blit)); - memset(m_pen_data, 0, ARRAY_LENGTH(m_pen_data)); - memset(m_pen_raw_data, 0, ARRAY_LENGTH(m_pen_raw_data)); } static MACHINE_CONFIG_START( royalqn, nightgal_state ) @@ -881,6 +736,8 @@ static MACHINE_CONFIG_START( royalqn, nightgal_state ) MCFG_QUANTUM_PERFECT_CPU("maincpu") + MCFG_JANGOU_BLITTER_ADD("blitter", MASTER_CLOCK/4) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4,320,0,256,264,16,240) @@ -963,7 +820,7 @@ ROM_START( nightgal ) ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "ngal_09.bin", 0x0c000, 0x02000, CRC(da3dcc08) SHA1(6f5319c1777dabf7041286698ac8f25eca1545a1) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "gfx", 0 ) ROM_LOAD( "ngal_01.bin", 0x00000, 0x02000, CRC(8e4c92ad) SHA1(13cebe765ebabe6be79c9c9ac3f778550e450380) ) ROM_LOAD( "ngal_02.bin", 0x02000, 0x02000, CRC(c60f7dc1) SHA1(273fd05c62e1efe26538efd2d4f0973c5eba65e4) ) ROM_LOAD( "ngal_03.bin", 0x04000, 0x02000, CRC(824b7d9e) SHA1(04d3340cbb954add0d70c093df4ccb669e5ed12b) ) @@ -1013,7 +870,7 @@ ROM_START( ngtbunny ) ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "5.3m", 0x0c000, 0x02000, CRC(b8a82966) SHA1(9f86b3208fb48f9735cfc4f8e62680f0cb4a92f0) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "gfx", 0 ) ROM_LOAD( "1.3a", 0x00000, 0x02000, CRC(16776c5f) SHA1(a2925eaed938ae3985ea796658b62d6fafb6412b) ) ROM_LOAD( "2.3c", 0x02000, 0x02000, CRC(dffd2cc6) SHA1(34f45b20596f69c44dc01c7aef765ab3ddaa076b) ) ROM_LOAD( "3.3d", 0x04000, 0x02000, CRC(c532ca49) SHA1(b01b08e99e24649c45ce1833f830775d6f532f6b) ) @@ -1032,7 +889,7 @@ ROM_START( royalngt ) ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "rn5.3l", 0x0c000, 0x02000, CRC(b8a82966) SHA1(9f86b3208fb48f9735cfc4f8e62680f0cb4a92f0) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "gfx", 0 ) ROM_LOAD( "rn1.3a", 0x00000, 0x02000, CRC(16776c5f) SHA1(a2925eaed938ae3985ea796658b62d6fafb6412b) ) ROM_LOAD( "rn2.3c", 0x02000, 0x02000, CRC(dffd2cc6) SHA1(34f45b20596f69c44dc01c7aef765ab3ddaa076b) ) ROM_LOAD( "rn3.3d", 0x04000, 0x02000, CRC(31fb1d47) SHA1(41441bc2613c95dc810cad569cbaa0c023c819ba) ) @@ -1053,7 +910,7 @@ ROM_START( royalqn ) ROM_REGION( 0xc000, "samples", ROMREGION_ERASE00 ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "gfx", 0 ) ROM_LOAD( "rq1.3a", 0x00000, 0x02000, CRC(066449dc) SHA1(34838f5e3569b313306ce465e481b934e938c837) ) ROM_LOAD( "rq2.3c", 0x02000, 0x02000, CRC(c467adb5) SHA1(755ebde6229bbf0c7d9293e0becb7506d9aa9d49) ) ROM_LOAD( "rq3.3d", 0x04000, 0x02000, CRC(7e5a7a2d) SHA1(5770cd832de59ff4f61ac40eca8c2238ff7b582d) ) @@ -1121,7 +978,7 @@ ROM_START( sexygal ) ROM_LOAD( "13.s7b", 0x04000, 0x04000, CRC(5eb75f56) SHA1(b7d81d786d1ac8d65a6a122140954eb89d76e8b4) ) ROM_LOAD( "14.s6b", 0x08000, 0x04000, CRC(b4a2497b) SHA1(7231f57b4548899c886625e883b9972c0f30e9f2) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "gfx", 0 ) ROM_LOAD( "2.3c", 0x00000, 0x04000, CRC(f719e09d) SHA1(c78411b4f974b3dd261d51e522e086fc30a96fcb) ) ROM_LOAD( "3.3d", 0x04000, 0x04000, CRC(a84d9a89) SHA1(91d5978e35ba4acf9353a13ec22c22aeb8a35f12) ) ROM_LOAD( "4.3e", 0x08000, 0x04000, CRC(f1cdbedb) SHA1(caacf2887a3a05e498d57d570a1e9873f95a5d5f) ) @@ -1148,7 +1005,7 @@ ROM_START( sweetgal ) ROM_LOAD( "v2_13.bin", 0x04000, 0x04000, CRC(60785a0d) SHA1(71eaec3512c0b18b93c083c1808eec51cfd4f520) ) ROM_LOAD( "v2_14.bin", 0x08000, 0x04000, CRC(149e84c1) SHA1(5c4e18637bef2f31bc3578cae6525fb6280fbc06) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "gfx", 0 ) ROM_LOAD( "2.3c", 0x00000, 0x04000, CRC(3a3d78f7) SHA1(71e35529f30c43ee8ec2363f85fe17042f1d304e) ) // sldh ROM_LOAD( "3.3d", 0x04000, 0x04000, CRC(c6f9b884) SHA1(32d6fe1906a3f1f528f30dbd3f89971b2ea1925b) ) // sldh // all roms below match sexygal @@ -1215,7 +1072,7 @@ ROM_START( ngalsumr ) ROM_LOAD( "2s.ic6", 0x04000, 0x04000, CRC(ca2a735f) SHA1(5980525a67fb0ffbfa04b82d805eee2463236ce3) ) ROM_LOAD( "3s.ic5", 0x08000, 0x04000, CRC(5cf15267) SHA1(72e4b2aa59a50af6b1b25d5279b3b125bfe06d86) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "gfx", 0 ) ROM_LOAD( "1.3a", 0x00000, 0x04000, CRC(9626f812) SHA1(ca7162811a0ba05dfaa2aa8cc93a2e898b326e9e) ) ROM_LOAD( "2.3c", 0x04000, 0x04000, CRC(0d59cf7a) SHA1(600bc70d29853fb936f8adaef048d925cbae0ce9) ) ROM_LOAD( "3.3d", 0x08000, 0x04000, CRC(2fb2ec0b) SHA1(2f1735e33906783b8c0b283455a2a079431e6f11) ) -- cgit v1.2.3-70-g09d2 From 2050fda6e38eb7034ab8b7b13c5ea7e286cac400 Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 8 Feb 2016 22:44:33 +0100 Subject: NCS8105 ADCX opcode is actually an ADDX, fixes gfx garbage in nightgal.cpp [Angelo Salese] --- src/devices/cpu/m6800/6800ops.inc | 3 ++- src/devices/video/jangou_blitter.cpp | 19 ++++++++++++-- src/devices/video/jangou_blitter.h | 1 + src/mame/drivers/nightgal.cpp | 51 ++++++++++++++++++------------------ 4 files changed, 45 insertions(+), 29 deletions(-) diff --git a/src/devices/cpu/m6800/6800ops.inc b/src/devices/cpu/m6800/6800ops.inc index c9712dca9ff..6dc59863f09 100644 --- a/src/devices/cpu/m6800/6800ops.inc +++ b/src/devices/cpu/m6800/6800ops.inc @@ -2073,11 +2073,12 @@ OP_HANDLER( ldd_ix ) } /* $ec ADCX immediate -**** NSC8105 only. Flags are a guess - copied from addb_im() */ +// actually this is ADDX, causes garbage in nightgal.cpp otherwise OP_HANDLER( adcx_im ) { UINT16 t,r; IMMBYTE(t); - r = X+t+(CC&0x01); + r = X+t; CLR_HNZVC; SET_FLAGS8(X,t,r); SET_H(X,t,r); diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index be11e07b315..4427fe01f74 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -105,8 +105,8 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) int count = 0; int xcount, ycount; - //printf("%02x %02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2], - // m_blit_data[3], m_blit_data[4], m_blit_data[5],m_blit_data[6]); + printf("%02x %02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2], + m_blit_data[3], m_blit_data[4], m_blit_data[5],m_blit_data[6]); w = (m_blit_data[4] & 0xff) + 1; h = (m_blit_data[5] & 0xff) + 1; src = ((m_blit_data[1] << 8)|(m_blit_data[0] << 0)); @@ -146,6 +146,21 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) } } +WRITE8_MEMBER( jangou_blitter_device::blitter_alt_process_w) +{ + switch(offset) + { + case 0: blitter_process_w(space,0,data); break; + case 1: blitter_process_w(space,1,data); break; + case 2: blitter_process_w(space,6,data); break; + case 3: blitter_process_w(space,2,data); break; + case 4: blitter_process_w(space,3,data); break; + case 5: blitter_process_w(space,4,data); break; + case 6: blitter_process_w(space,5,data); break; + + } +} + WRITE8_MEMBER( jangou_blitter_device::blitter_vregs_w) { // printf("%02x %02x\n", offset, data); diff --git a/src/devices/video/jangou_blitter.h b/src/devices/video/jangou_blitter.h index 735fea64a73..a8a4934a475 100644 --- a/src/devices/video/jangou_blitter.h +++ b/src/devices/video/jangou_blitter.h @@ -34,6 +34,7 @@ public: // I/O operations DECLARE_WRITE8_MEMBER( blitter_process_w ); + DECLARE_WRITE8_MEMBER( blitter_alt_process_w ); DECLARE_WRITE8_MEMBER( blitter_vregs_w ); UINT8 m_blit_buffer[256 * 256]; diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index b89e04c5ad3..12642968006 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -302,12 +302,12 @@ READ8_MEMBER(nightgal_state::royalqn_nsc_blit_r) TIMER_CALLBACK_MEMBER(nightgal_state::z80_wait_ack_cb) { - m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, CLEAR_LINE); + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); } void nightgal_state::z80_wait_assert_cb() { - m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, ASSERT_LINE); + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); // Note: cycles_to_attotime requires z80 context to work, calling for example m_subcpu as context gives a x4 cycle boost in z80 terms (reads execute_cycles_to_clocks() from NCS?) even if they runs at same speed basically. // TODO: needs a getter that tells a given CPU how many cycles requires an executing opcode for the r/w operation, which stacks with wait state penalty for accessing this specific area. @@ -419,13 +419,12 @@ static ADDRESS_MAP_START( sexygal_nsc_map, AS_PROGRAM, 8, nightgal_state ) AM_RANGE(0x0000, 0x007f) AM_RAM AM_RANGE(0x0080, 0x0080) AM_READ(blitter_status_r) AM_RANGE(0x0081, 0x0083) AM_READ(royalqn_nsc_blit_r) - AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_process_w) + AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_alt_process_w) AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_vregs_w) - AM_RANGE(0x00b0, 0x00b0) AM_WRITENOP // bltflip register AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r, royalqn_comm_w) AM_SHARE("comms_ram") - AM_RANGE(0xc000, 0xffff) AM_ROM AM_WRITENOP + AM_RANGE(0xc000, 0xdfff) AM_MIRROR(0x2000) AM_ROM AM_REGION("subrom", 0) ADDRESS_MAP_END /******************************** @@ -464,7 +463,7 @@ static ADDRESS_MAP_START( royalqn_nsc_map, AS_PROGRAM, 8, nightgal_state ) AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r,royalqn_comm_w) AM_RANGE(0x4000, 0x4000) AM_NOP AM_RANGE(0x8000, 0x8000) AM_NOP //open bus or protection check - AM_RANGE(0xc000, 0xdfff) AM_MIRROR(0x2000) AM_ROM + AM_RANGE(0xc000, 0xdfff) AM_MIRROR(0x2000) AM_ROM AM_REGION("subrom", 0) ADDRESS_MAP_END /******************************************** @@ -817,8 +816,8 @@ ROM_START( nightgal ) ROM_LOAD( "ngal_11.bin", 0x02000, 0x02000, CRC(c52f7942) SHA1(e23b9e4936f9b3111ea14c0250190ee6de1ed4ab) ) ROM_LOAD( "ngal_12.bin", 0x04000, 0x02000, CRC(515e69a7) SHA1(234247c829c2b082360d7d44c1488fc5fcf45cd2) ) - ROM_REGION( 0x10000, "sub", 0 ) - ROM_LOAD( "ngal_09.bin", 0x0c000, 0x02000, CRC(da3dcc08) SHA1(6f5319c1777dabf7041286698ac8f25eca1545a1) ) + ROM_REGION( 0x2000, "subrom", 0 ) + ROM_LOAD( "ngal_09.bin", 0x0000, 0x02000, CRC(da3dcc08) SHA1(6f5319c1777dabf7041286698ac8f25eca1545a1) ) ROM_REGION( 0x20000, "gfx", 0 ) ROM_LOAD( "ngal_01.bin", 0x00000, 0x02000, CRC(8e4c92ad) SHA1(13cebe765ebabe6be79c9c9ac3f778550e450380) ) @@ -867,8 +866,8 @@ ROM_START( ngtbunny ) ROM_LOAD( "7.3p", 0x02000, 0x02000, CRC(34024380) SHA1(ba535e2b198f55e68a45ad7030b12c9aa1389aea) ) ROM_LOAD( "8.3s", 0x04000, 0x02000, CRC(9bf96168) SHA1(f0e9302bc9577fe779b56cb72035672368c94481) ) - ROM_REGION( 0x10000, "sub", 0 ) - ROM_LOAD( "5.3m", 0x0c000, 0x02000, CRC(b8a82966) SHA1(9f86b3208fb48f9735cfc4f8e62680f0cb4a92f0) ) + ROM_REGION( 0x2000, "subrom", 0 ) + ROM_LOAD( "5.3m", 0x0000, 0x02000, CRC(b8a82966) SHA1(9f86b3208fb48f9735cfc4f8e62680f0cb4a92f0) ) ROM_REGION( 0x20000, "gfx", 0 ) ROM_LOAD( "1.3a", 0x00000, 0x02000, CRC(16776c5f) SHA1(a2925eaed938ae3985ea796658b62d6fafb6412b) ) @@ -886,8 +885,8 @@ ROM_START( royalngt ) ROM_LOAD( "rn7.3p", 0x02000, 0x02000, CRC(ae9c082b) SHA1(ee3effea653f972fd732453e9ab72f48e75410f8) ) ROM_LOAD( "rn8.3s", 0x04000, 0x02000, CRC(1371a83a) SHA1(c7107b62534837dd51bb4a93ba9a690f91393930) ) - ROM_REGION( 0x10000, "sub", 0 ) - ROM_LOAD( "rn5.3l", 0x0c000, 0x02000, CRC(b8a82966) SHA1(9f86b3208fb48f9735cfc4f8e62680f0cb4a92f0) ) + ROM_REGION( 0x2000, "subrom", 0 ) + ROM_LOAD( "rn5.3l", 0x00000, 0x02000, CRC(b8a82966) SHA1(9f86b3208fb48f9735cfc4f8e62680f0cb4a92f0) ) ROM_REGION( 0x20000, "gfx", 0 ) ROM_LOAD( "rn1.3a", 0x00000, 0x02000, CRC(16776c5f) SHA1(a2925eaed938ae3985ea796658b62d6fafb6412b) ) @@ -905,8 +904,8 @@ ROM_START( royalqn ) ROM_LOAD( "a11.3t", 0x02000, 0x02000, CRC(e7c5395b) SHA1(5131ab9b0fbf1b7b4d410aa2a57eceaf47f8ec3a) ) ROM_LOAD( "a12.3v", 0x04000, 0x02000, CRC(4e8efda4) SHA1(1959491fd899a4d85fd067d7674592ec25188a75) ) - ROM_REGION( 0x10000, "sub", 0 ) - ROM_LOAD( "rq9.3p", 0x0c000, 0x02000, CRC(34b4cf82) SHA1(01f49ca11a695d41c181e92217e228bc1656ee57) ) + ROM_REGION( 0x2000, "subrom", 0 ) + ROM_LOAD( "rq9.3p", 0x0000, 0x02000, CRC(34b4cf82) SHA1(01f49ca11a695d41c181e92217e228bc1656ee57) ) ROM_REGION( 0xc000, "samples", ROMREGION_ERASE00 ) @@ -971,8 +970,8 @@ ROM_START( sexygal ) ROM_LOAD( "11.3pr", 0x04000, 0x04000, CRC(a3138b42) SHA1(1bf7f6e2c4020251379cc72fa731c17795f35e2e) ) ROM_LOAD( "12.s8b", 0x08000, 0x04000, CRC(7ac4a984) SHA1(7b41c522387938fe7625c9a6c62a385d6635cc5e) ) - ROM_REGION( 0x10000, "sub", 0 ) - ROM_LOAD( "1.3a", 0x0c000, 0x04000, CRC(f814cf27) SHA1(ceba1f14a202d926380039d7cb4669eb8be58539) ) // has a big (16 byte wide) ASCII 'Y.M' art, written in YMs (!) + ROM_REGION( 0x4000, "subrom", 0 ) + ROM_LOAD( "1.3a", 0x00000, 0x04000, CRC(f814cf27) SHA1(ceba1f14a202d926380039d7cb4669eb8be58539) ) // has a big (16 byte wide) ASCII 'Y.M' art, written in YMs (!) ROM_REGION( 0xc000, "samples", 0 ) ROM_LOAD( "13.s7b", 0x04000, 0x04000, CRC(5eb75f56) SHA1(b7d81d786d1ac8d65a6a122140954eb89d76e8b4) ) @@ -997,8 +996,8 @@ ROM_START( sweetgal ) ROM_LOAD( "10.3n", 0x00000, 0x04000, CRC(0f6c4bf0) SHA1(50e5c6f08e124641f5df8938ccfcdebde18f6a0f) ) // sldh ROM_LOAD( "11.3p", 0x04000, 0x04000, CRC(7388e9b3) SHA1(e318d2d3888679bbd43a0aab68252fd359b7969d) ) - ROM_REGION( 0x10000, "sub", 0 ) - ROM_LOAD( "1.3a", 0x0e000, 0x2000, CRC(5342c757) SHA1(b4ff84c45bd2c6a6a468f1d0daaf5b19c4dbf8fe) ) // sldh + ROM_REGION( 0x2000, "subrom", 0 ) + ROM_LOAD( "1.3a", 0x0000, 0x2000, CRC(5342c757) SHA1(b4ff84c45bd2c6a6a468f1d0daaf5b19c4dbf8fe) ) // sldh ROM_REGION( 0xc000, "samples", 0 ) // sound samples ROM_LOAD( "v2_12.bin", 0x00000, 0x04000, CRC(66a35be2) SHA1(4f0d73d753387acacc5ccc90e91d848a5ecce55e) ) @@ -1064,8 +1063,8 @@ ROM_START( ngalsumr ) ROM_LOAD( "9.3t", 0x02000, 0x02000, CRC(879fc493) SHA1(ec7c6928b5d4e46dcc99271466e7eb801f601a70) ) ROM_LOAD( "10.3v", 0x04000, 0x02000, CRC(31211088) SHA1(960b781c420602be3de66565a030cf5ebdcc2ffb) ) - ROM_REGION( 0x10000, "sub", 0 ) - ROM_LOAD( "7.3p", 0x0c000, 0x02000, BAD_DUMP CRC(20c55a25) SHA1(9dc88cb6c016b594264f7272d4fd5f30567e7c5d) ) // either encrypted or bit-rotted. + ROM_REGION( 0x2000, "subrom", 0 ) + ROM_LOAD( "7.3p", 0x0000, 0x02000, BAD_DUMP CRC(20c55a25) SHA1(9dc88cb6c016b594264f7272d4fd5f30567e7c5d) ) // either encrypted or bit-rotted. ROM_REGION( 0xc000, "samples", 0 ) ROM_LOAD( "1s.ic7", 0x00000, 0x04000, CRC(47ad8a0f) SHA1(e3b1e13f0a5c613bd205338683bef8d005b54830) ) @@ -1086,22 +1085,22 @@ ROM_END DRIVER_INIT_MEMBER(nightgal_state,royalqn) { - UINT8 *ROM = memregion("sub")->base(); + UINT8 *ROM = memregion("subrom")->base(); /* patch open bus / protection */ - ROM[0xc27e] = 0x02; - ROM[0xc27f] = 0x02; + ROM[0x027e] = 0x02; + ROM[0x027f] = 0x02; } DRIVER_INIT_MEMBER(nightgal_state,ngalsumr) { - UINT8 *ROM = memregion("sub")->base(); + //UINT8 *ROM = memregion("subrom")->base(); /* patch blantantly wrong ROM checks */ //ROM[0xd6ce] = 0x02; //ROM[0xd6cf] = 0x02; // adcx $05 converted to 0x04 for debug purposes - ROM[0xd782] = 0x04; + //ROM[0x1782] = 0x04; //ROM[0xd655] = 0x20; //ROM[0xd3f9] = 0x02; //ROM[0xd3fa] = 0x02; @@ -1112,7 +1111,7 @@ DRIVER_INIT_MEMBER(nightgal_state,ngalsumr) GAME( 1984, nightgal, 0, royalqn, sexygal, driver_device, 0, ROT0, "Nichibutsu", "Night Gal (Japan 840920 AG 1-00)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1984, ngtbunny, 0, royalqn, sexygal, driver_device, 0, ROT0, "Nichibutsu", "Night Bunny (Japan 840601 MRN 2-10)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1984, royalngt, ngtbunny, royalqn, sexygal, driver_device, 0, ROT0, "Royal Denshi", "Royal Night [BET] (Japan 840220 RN 2-00)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1984, royalqn, 0, royalqn, sexygal, nightgal_state, royalqn, ROT0, "Royal Denshi", "Royal Queen [BET] (Japan 841010 RQ 0-07)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1984, royalqn, 0, royalqn, sexygal, nightgal_state, royalqn, ROT0, "Royal Denshi", "Royal Queen [BET] (Japan 841010 RQ 0-07)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) /* Type 2 HW */ GAME( 1985, sexygal, 0, sexygal, sexygal, driver_device, 0, ROT0, "Nichibutsu", "Sexy Gal (Japan 850501 SXG 1-00)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) GAME( 1985, sweetgal, sexygal, sexygal, sexygal, driver_device, 0, ROT0, "Nichibutsu", "Sweet Gal (Japan 850510 SWG 1-02)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From feba972bc6bbe2b8f7da9577649b8a1bc13245e4 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Mon, 8 Feb 2016 17:20:01 -0500 Subject: minor mostly comment related changes to sdk86.cpp and tsispch.cpp (nw) --- src/mame/drivers/sdk86.cpp | 4 ++-- src/mame/drivers/tsispch.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/sdk86.cpp b/src/mame/drivers/sdk86.cpp index dd341654595..c655c0cd23e 100644 --- a/src/mame/drivers/sdk86.cpp +++ b/src/mame/drivers/sdk86.cpp @@ -208,5 +208,5 @@ ROM_END /* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1979, sdk86, 0, 0, sdk86, sdk86, driver_device, 0, "Intel", "SDK-86", MACHINE_NO_SOUND_HW) +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 1979, sdk86, 0, 0, sdk86, sdk86, driver_device, 0, "Intel", "SDK-86", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/tsispch.cpp b/src/mame/drivers/tsispch.cpp index 52bc57fa118..7617c1fb7ef 100644 --- a/src/mame/drivers/tsispch.cpp +++ b/src/mame/drivers/tsispch.cpp @@ -245,6 +245,7 @@ WRITE_LINE_MEMBER( tsispch_state::dsp_to_8086_p1_w ) void tsispch_state::machine_reset() { fprintf(stderr,"machine reset\n"); + m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // starts in reset } DRIVER_INIT_MEMBER(tsispch_state,prose2k) @@ -291,7 +292,6 @@ DRIVER_INIT_MEMBER(tsispch_state,prose2k) dspprg++; } m_paramReg = 0x00; // on power up, all leds on, reset to upd7720 is high - m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // starts in reset } /****************************************************************************** @@ -543,6 +543,6 @@ ROM_START( prose2ko ) Drivers ******************************************************************************/ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, prose2k, 0, 0, prose2k, prose2k, tsispch_state, prose2k, "Telesensory Systems Inc/Speech Plus", "Prose 2000/2020 v3.4.1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1982, prose2ko, prose2k, 0, prose2k, prose2k, tsispch_state, prose2k, "Telesensory Systems Inc/Speech Plus", "Prose 2000/2020 v1.1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, prose2k, 0, 0, prose2k, prose2k, tsispch_state, prose2k, "Telesensory Systems Inc/Speech Plus", "Prose 2000/2020 v3.4.1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1982, prose2ko, prose2k, 0, prose2k, prose2k, tsispch_state, prose2k, "Telesensory Systems Inc/Speech Plus", "Prose 2000/2020 v1.1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -- cgit v1.2.3-70-g09d2 From fb922ca5207795584302a43e74ae4b2d5018b860 Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 8 Feb 2016 23:54:33 +0100 Subject: Added opcode $b2, Night Gal Summer shows some garbage now --- src/devices/cpu/m6800/6800ops.inc | 13 ++++++++++++- src/devices/cpu/m6800/6800tbl.inc | 2 +- src/devices/cpu/m6800/m6800.h | 1 + src/devices/video/jangou_blitter.cpp | 5 ++--- src/mame/drivers/nightgal.cpp | 21 +++++++++++++++++---- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/devices/cpu/m6800/6800ops.inc b/src/devices/cpu/m6800/6800ops.inc index 6dc59863f09..c0147b6acee 100644 --- a/src/devices/cpu/m6800/6800ops.inc +++ b/src/devices/cpu/m6800/6800ops.inc @@ -2284,7 +2284,7 @@ OP_HANDLER( stx_ex ) WM16(EAD,&m_x); } -/* NCS specific, guessed opcodes (tested by Night Gal Summer) */ +/* NSC8105 specific, guessed opcodes (tested by Night Gal Summer) */ // $bb - load A from [X + $0] OP_HANDLER( ldax_imm ) { @@ -2294,6 +2294,17 @@ OP_HANDLER( ldax_imm ) SET_NZ8(A); } +// $b2 - assuming correct, store first byte to (X + $disp8) +OP_HANDLER( nsc_unk ) +{ + IMM8; + UINT8 val = RM(EAD); + IMM8; + EA = X + RM(EAD); + + WM(EAD,val); +} + // $00 - store A to [X + $0] OP_HANDLER( stax_imm ) { diff --git a/src/devices/cpu/m6800/6800tbl.inc b/src/devices/cpu/m6800/6800tbl.inc index c830f9ebe75..266ddb2a55c 100644 --- a/src/devices/cpu/m6800/6800tbl.inc +++ b/src/devices/cpu/m6800/6800tbl.inc @@ -150,7 +150,7 @@ const m6800_cpu_device::op_func m6800_cpu_device::nsc8105_insn[0x100] = { // a8 &m6800_cpu_device::asl_ix, &m6800_cpu_device::dec_ix, &m6800_cpu_device::rol_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::inc_ix, &m6800_cpu_device::jmp_ix, &m6800_cpu_device::tst_ix, &m6800_cpu_device::clr_ix, // b0 -&m6800_cpu_device::neg_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::com_ex, &m6800_cpu_device::lsr_ex, &m6800_cpu_device::ror_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::asr_ex, +&m6800_cpu_device::neg_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::nsc_unk,&m6800_cpu_device::com_ex, &m6800_cpu_device::lsr_ex, &m6800_cpu_device::ror_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::asr_ex, // b8 &m6800_cpu_device::asl_ex, &m6800_cpu_device::dec_ex, &m6800_cpu_device::rol_ex, &m6800_cpu_device::ldax_imm,&m6800_cpu_device::inc_ex, &m6800_cpu_device::jmp_ex, &m6800_cpu_device::tst_ex, &m6800_cpu_device::clr_ex, &m6800_cpu_device::subb_im,&m6800_cpu_device::sbcb_im,&m6800_cpu_device::cmpb_im,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_im,&m6800_cpu_device::ldb_im, &m6800_cpu_device::bitb_im,&m6800_cpu_device::stb_im, diff --git a/src/devices/cpu/m6800/m6800.h b/src/devices/cpu/m6800/m6800.h index a096bd922cd..6ddffe64242 100644 --- a/src/devices/cpu/m6800/m6800.h +++ b/src/devices/cpu/m6800/m6800.h @@ -428,6 +428,7 @@ protected: void trap(); void ldax_imm(); void stax_imm(); + void nsc_unk(); }; diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index 4427fe01f74..07953576a45 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -105,8 +105,7 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) int count = 0; int xcount, ycount; - printf("%02x %02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2], - m_blit_data[3], m_blit_data[4], m_blit_data[5],m_blit_data[6]); + //printf("%02x %02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2],m_blit_data[3], m_blit_data[4], m_blit_data[5],m_blit_data[6]); w = (m_blit_data[4] & 0xff) + 1; h = (m_blit_data[5] & 0xff) + 1; src = ((m_blit_data[1] << 8)|(m_blit_data[0] << 0)); @@ -148,6 +147,7 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) WRITE8_MEMBER( jangou_blitter_device::blitter_alt_process_w) { + // TODO: convert this into a more useable function switch(offset) { case 0: blitter_process_w(space,0,data); break; @@ -157,7 +157,6 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_alt_process_w) case 4: blitter_process_w(space,3,data); break; case 5: blitter_process_w(space,4,data); break; case 6: blitter_process_w(space,5,data); break; - } } diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 12642968006..6ce5f775589 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -1071,7 +1071,7 @@ ROM_START( ngalsumr ) ROM_LOAD( "2s.ic6", 0x04000, 0x04000, CRC(ca2a735f) SHA1(5980525a67fb0ffbfa04b82d805eee2463236ce3) ) ROM_LOAD( "3s.ic5", 0x08000, 0x04000, CRC(5cf15267) SHA1(72e4b2aa59a50af6b1b25d5279b3b125bfe06d86) ) - ROM_REGION( 0x20000, "gfx", 0 ) + ROM_REGION( 0x20000, "gfx", ROMREGION_ERASEFF ) ROM_LOAD( "1.3a", 0x00000, 0x04000, CRC(9626f812) SHA1(ca7162811a0ba05dfaa2aa8cc93a2e898b326e9e) ) ROM_LOAD( "2.3c", 0x04000, 0x04000, CRC(0d59cf7a) SHA1(600bc70d29853fb936f8adaef048d925cbae0ce9) ) ROM_LOAD( "3.3d", 0x08000, 0x04000, CRC(2fb2ec0b) SHA1(2f1735e33906783b8c0b283455a2a079431e6f11) ) @@ -1094,17 +1094,30 @@ DRIVER_INIT_MEMBER(nightgal_state,royalqn) DRIVER_INIT_MEMBER(nightgal_state,ngalsumr) { - //UINT8 *ROM = memregion("subrom")->base(); +#if 0 + UINT8 *ROM = memregion("subrom")->base(); + +// ROM[0x165a] = 0x02; // illegal +// ROM[0x165b] = 0x02; // sts xx xx xx +// ROM[0x165c] = 0x02; +// ROM[0x165d] = 0x02; +// ROM[0x165e] = 0x02; // sts xx xx xx +// ROM[0x165f] = 0x02; +// ROM[0x1660] = 0x02; +// ROM[0x1661] = 0x02; // sts xx xx xx + ROM[0x1662] = 0x20; +// ROM[0x1663] = 0x02; /* patch blantantly wrong ROM checks */ - //ROM[0xd6ce] = 0x02; - //ROM[0xd6cf] = 0x02; + ROM[0x16ce] = 0x02; + ROM[0x16cf] = 0x02; // adcx $05 converted to 0x04 for debug purposes //ROM[0x1782] = 0x04; //ROM[0xd655] = 0x20; //ROM[0xd3f9] = 0x02; //ROM[0xd3fa] = 0x02; //ROM[0xd3a0] = 0x02; +#endif } /* Type 1 HW */ -- cgit v1.2.3-70-g09d2 From 3b66df80702ad75f1eb893bfe1711a4098497405 Mon Sep 17 00:00:00 2001 From: angelosa Date: Mon, 8 Feb 2016 23:59:53 +0100 Subject: ID version, nw --- src/mame/drivers/nightgal.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 6ce5f775589..33b46f8ea5b 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -1064,7 +1064,7 @@ ROM_START( ngalsumr ) ROM_LOAD( "10.3v", 0x04000, 0x02000, CRC(31211088) SHA1(960b781c420602be3de66565a030cf5ebdcc2ffb) ) ROM_REGION( 0x2000, "subrom", 0 ) - ROM_LOAD( "7.3p", 0x0000, 0x02000, BAD_DUMP CRC(20c55a25) SHA1(9dc88cb6c016b594264f7272d4fd5f30567e7c5d) ) // either encrypted or bit-rotted. + ROM_LOAD( "7.3p", 0x0000, 0x02000, CRC(20c55a25) SHA1(9dc88cb6c016b594264f7272d4fd5f30567e7c5d) ) ROM_REGION( 0xc000, "samples", 0 ) ROM_LOAD( "1s.ic7", 0x00000, 0x04000, CRC(47ad8a0f) SHA1(e3b1e13f0a5c613bd205338683bef8d005b54830) ) @@ -1129,4 +1129,4 @@ GAME( 1984, royalqn, 0, royalqn, sexygal, nightgal_state, royalqn, ROT0, GAME( 1985, sexygal, 0, sexygal, sexygal, driver_device, 0, ROT0, "Nichibutsu", "Sexy Gal (Japan 850501 SXG 1-00)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) GAME( 1985, sweetgal, sexygal, sexygal, sexygal, driver_device, 0, ROT0, "Nichibutsu", "Sweet Gal (Japan 850510 SWG 1-02)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) /* Type 3 HW */ -GAME( 1985, ngalsumr, 0, ngalsumr,sexygal, nightgal_state, ngalsumr,ROT0, "Nichibutsu", "Night Gal Summer", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) +GAME( 1985, ngalsumr, 0, ngalsumr,sexygal, nightgal_state, ngalsumr,ROT0, "Nichibutsu", "Night Gal Summer (Japan 850702 NGS 0-01)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From c43792362c5d66f33b13d0a2c17d0af5a963cde2 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Tue, 9 Feb 2016 10:49:18 +1100 Subject: Fixed the build. --- scripts/target/mame/arcade.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 496d50eb71a..d4bc8eb26b1 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -295,6 +295,7 @@ VIDEOS["HUC6270"] = true --VIDEOS["HUC6272"] = true --VIDEOS["I8244"] = true VIDEOS["I8275"] = true +VIDEOS["JANGOU_BLITTER"] = true VIDEOS["M50458"] = true VIDEOS["MB90082"] = true VIDEOS["MB_VCU"] = true -- cgit v1.2.3-70-g09d2 From 7dbaa4cab5cde78ca22b16f0b8665b43181cea41 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 9 Feb 2016 00:49:02 +0100 Subject: k28: hooked up most I/O --- src/mame/drivers/k28.cpp | 94 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 88 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp index 8748b965e50..d7e398da367 100644 --- a/src/mame/drivers/k28.cpp +++ b/src/mame/drivers/k28.cpp @@ -20,14 +20,27 @@ public: k28_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_tms6100(*this, "tms6100"), + m_speech(*this, "speech"), m_inp_matrix(*this, "IN") { } // devices required_device m_maincpu; + required_device m_tms6100; + required_device m_speech; required_ioport_array<7> m_inp_matrix; - UINT16 m_inp_mux; + UINT8 m_inp_mux; + UINT8 m_phoneme; + int m_speech_strobe; + + DECLARE_WRITE8_MEMBER(mcu_p0_w); + DECLARE_READ8_MEMBER(mcu_p1_r); + DECLARE_READ8_MEMBER(mcu_p2_r); + DECLARE_WRITE8_MEMBER(mcu_p2_w); + DECLARE_WRITE8_MEMBER(mcu_prog_w); + DECLARE_READ8_MEMBER(mcu_t1_r); protected: virtual void machine_start() override; @@ -37,9 +50,13 @@ void k28_state::machine_start() { // zerofill m_inp_mux = 0; + m_speech_strobe = 0; + m_phoneme = 0x3f; // register for savestates save_item(NAME(m_inp_mux)); + save_item(NAME(m_speech_strobe)); + save_item(NAME(m_phoneme)); } @@ -49,12 +66,76 @@ void k28_state::machine_start() ***************************************************************************/ +WRITE8_MEMBER(k28_state::mcu_p0_w) +{ + // d0,d1: phoneme high bits + // d0-d2: input mux high bits + m_inp_mux = (m_inp_mux & 0xf) | (~data << 4 & 0x70); + m_phoneme = (m_phoneme & 0xf) | (data << 4 & 0x30); + + // d3: SC-01 strobe, latch phoneme on rising edge + if (data & 8 && m_speech_strobe == 0) + m_speech->write(space, 0, m_phoneme); + m_speech_strobe = data & 8; + + //printf("%d",data>>4&1); + + // d4: VSM chip enable + // d6: VSM M0 + // d7: VSM M1 + m_tms6100->cs_w(~data >> 4 & 1); + m_tms6100->m0_w(data >> 6 & 1); + m_tms6100->m1_w(data >> 7 & 1); + m_tms6100->clk_w(1); + m_tms6100->clk_w(0); +} + +READ8_MEMBER(k28_state::mcu_p1_r) +{ + UINT8 data = 0; + + // multiplexed inputs (active low) + for (int i = 0; i < 7; i++) + if (m_inp_mux >> i & 1) + data |= m_inp_matrix[i]->read(); + + return data ^ 0xff; +} + +READ8_MEMBER(k28_state::mcu_p2_r) +{ + // d3: VSM data + return (m_tms6100->data_line_r()) ? 8 : 0; +} + +WRITE8_MEMBER(k28_state::mcu_p2_w) +{ + // d0-d3: VSM data, input mux and SC-01 phoneme lower nibble + m_tms6100->add_w(space, 0, data); + m_inp_mux = (m_inp_mux & ~0xf) | (~data & 0xf); + m_phoneme = (m_phoneme & ~0xf) | (data & 0xf); +} + +WRITE8_MEMBER(k28_state::mcu_prog_w) +{ + // 8021 PROG: MM5445 CLK pin +} + +READ8_MEMBER(k28_state::mcu_t1_r) +{ + printf("1"); + + // 8021 T1: SC-01 A/R pin + return m_speech->request(); +} + + static ADDRESS_MAP_START( k28_mcu_map, AS_IO, 8, k28_state ) - ADDRESS_MAP_UNMAP_LOW - //AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) - //AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) - //AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) - //AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T1) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_WRITE(mcu_p0_w) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(mcu_p1_r) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(mcu_p2_r, mcu_p2_w) + AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_WRITE(mcu_prog_w) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(mcu_t1_r) ADDRESS_MAP_END @@ -151,6 +232,7 @@ static MACHINE_CONFIG_START( k28, k28_state ) MCFG_CPU_ADD("maincpu", I8021, XTAL_3_579545MHz) MCFG_CPU_IO_MAP(k28_mcu_map) + MCFG_DEVICE_ADD("tms6100", TMS6100, XTAL_3_579545MHz) MCFG_DEFAULT_LAYOUT(layout_k28) /* sound hardware */ -- cgit v1.2.3-70-g09d2 From f9f0e40b8ddfc5a736adb6afb54aed4a19557d2f Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Mon, 8 Feb 2016 20:21:28 -0500 Subject: Correct ROM labels and removed endian-swap during descramble for notetaker in favor of loading ROMs the other way round. Add ROM locations. [Lord Nightmare] --- src/mame/drivers/notetaker.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index 70a3c4ea122..ccf114c4d42 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -147,8 +147,8 @@ DRIVER_INIT_MEMBER(notetaker_state,notetakr) romdst += 0x7f800; // set the dest pointer to 0xff000 (>>1 because 16 bits data) for (int i = 0; i < 0x800; i++) { - wordtemp = BITSWAP16(*romsrc, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7); - addrtemp = BITSWAP16(i, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + wordtemp = BITSWAP16(*romsrc, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); // data bus is completely reversed + addrtemp = BITSWAP16(i, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); // address bus is completely reversed; 11-15 should always be zero temppointer = romdst+(addrtemp&0x7FF); *temppointer = wordtemp; romsrc++; @@ -158,8 +158,8 @@ DRIVER_INIT_MEMBER(notetaker_state,notetakr) /* ROM definition */ ROM_START( notetakr ) ROM_REGION( 0x100000, "maincpuload", ROMREGION_ERASEFF ) // load roms here before descrambling - ROMX_LOAD( "NTIOLO_EPROM.BIN", 0xff000, 0x0800, CRC(b72aa4c7) SHA1(85dab2399f906c7695dc92e7c18f32e2303c5892), ROM_SKIP(1)) - ROMX_LOAD( "NTIOHI_EPROM.BIN", 0xff001, 0x0800, CRC(1119691d) SHA1(4c20b595b554e6f5489ab2c3fb364b4a052f05e3), ROM_SKIP(1)) + ROMX_LOAD( "biop__2.00_hi.b2716.h1", 0xff000, 0x0800, CRC(1119691d) SHA1(4c20b595b554e6f5489ab2c3fb364b4a052f05e3), ROM_SKIP(1)) + ROMX_LOAD( "biop__2.00_lo.b2716.g1", 0xff001, 0x0800, CRC(b72aa4c7) SHA1(85dab2399f906c7695dc92e7c18f32e2303c5892), ROM_SKIP(1)) ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) // area for descrambled roms ROM_END -- cgit v1.2.3-70-g09d2 From e5d240d4e70a26c422a9ce3d74f19f2ee28de877 Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 9 Feb 2016 03:00:35 +0100 Subject: Improved opcode $bb, added extra protection ports --- src/devices/cpu/m6800/6800ops.inc | 11 ++++++----- src/mame/drivers/nightgal.cpp | 41 +++++++++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/devices/cpu/m6800/6800ops.inc b/src/devices/cpu/m6800/6800ops.inc index c0147b6acee..4e92e401be7 100644 --- a/src/devices/cpu/m6800/6800ops.inc +++ b/src/devices/cpu/m6800/6800ops.inc @@ -2288,10 +2288,10 @@ OP_HANDLER( stx_ex ) // $bb - load A from [X + $0] OP_HANDLER( ldax_imm ) { - EA=X; - A=RM(EAD); - CLR_NZV; - SET_NZ8(A); + UINT8 val; + {EA=X+((M_RDOP_ARG(PCD)<<8) | M_RDOP_ARG((PCD+1)&0xffff));PC+=2;} + val = RM(EAD); + CLR_NZVC; SET_NZ8(val); } // $b2 - assuming correct, store first byte to (X + $disp8) @@ -2301,7 +2301,8 @@ OP_HANDLER( nsc_unk ) UINT8 val = RM(EAD); IMM8; EA = X + RM(EAD); - + CLR_NZV; + SET_NZ8(val); WM(EAD,val); } diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 33b46f8ea5b..bb602aafdf9 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -10,12 +10,10 @@ driver by David Haywood & Angelo Salese many thanks to Charles MacDonald for the schematics / documentation of this HW. TODO: - - Night Gal Summer trips illegal opcodes on the NCS side, needs to check if bit-rotted or encrypted ROM; - - Fix Sweet Gal/Sexy Gal gfxs if necessary (i.e. if the bugs aren't all caused by irq/nmi wrong firing); + - is opcode $bb right for Night Gal Summer? + - extra protection for Night Gal Summer (ports 0x6000-3 for z80 and 0x8000-0x8020-1 for MCU); + - Fix Sweet Gal/Sexy Gal layer clearances; - unemulated WAIT pin for Z80, MCU asserts it when accessing communication RAM - - Abstract the video chip to a proper video file and get the name of that chip; - - Minor graphic glitches in Royal Queen (cross hatch test, some little glitches during gameplay), - presumably due of the unemulated wait states on the comms. *******************************************************************************************/ @@ -88,6 +86,9 @@ public: DECLARE_WRITE8_MEMBER(output_w); DECLARE_DRIVER_INIT(ngalsumr); DECLARE_DRIVER_INIT(royalqn); + DECLARE_READ8_MEMBER(ngalsumr_unk_r); + DECLARE_WRITE8_MEMBER(ngalsumr_unk_w); + DECLARE_READ8_MEMBER(ngalsumr_color_r); virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; @@ -431,6 +432,7 @@ ADDRESS_MAP_END * Royal Queen ********************************/ + static ADDRESS_MAP_START( royalqn_map, AS_PROGRAM, 8, nightgal_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_NOP @@ -453,13 +455,14 @@ static ADDRESS_MAP_START( royalqn_io, AS_IO, 8, nightgal_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( royalqn_nsc_map, AS_PROGRAM, 8, nightgal_state ) - AM_RANGE(0x0000, 0x007f) AM_RAM + AM_RANGE(0x0000, 0x007f) AM_RAM AM_SHARE("xx") AM_RANGE(0x0080, 0x0080) AM_READ(blitter_status_r) AM_RANGE(0x0081, 0x0083) AM_READ(royalqn_nsc_blit_r) AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_process_w) AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_vregs_w) AM_RANGE(0x00b0, 0x00b0) AM_WRITENOP // bltflip register + AM_RANGE(0x1000, 0x1007) AM_RAM AM_SHARE("xx") AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r,royalqn_comm_w) AM_RANGE(0x4000, 0x4000) AM_NOP AM_RANGE(0x8000, 0x8000) AM_NOP //open bus or protection check @@ -1092,8 +1095,34 @@ DRIVER_INIT_MEMBER(nightgal_state,royalqn) ROM[0x027f] = 0x02; } +// returns flipped gfxs if active? +READ8_MEMBER(nightgal_state::ngalsumr_unk_r) +{ + return 0; +} + +WRITE8_MEMBER(nightgal_state::ngalsumr_unk_w) +{ + //m_z80_latch = data; +} + +// check with the unknown opcode, wants currently active color for 1bpp gfxs? +READ8_MEMBER(nightgal_state::ngalsumr_color_r) +{ + if(offset == 0xc) + return 1; + + + return 0; +} + DRIVER_INIT_MEMBER(nightgal_state,ngalsumr) { + m_maincpu->space(AS_PROGRAM).install_write_handler(0x6000, 0x6000, write8_delegate(FUNC(nightgal_state::ngalsumr_unk_w), this) ); + // 0x6003 some kind of f/f state + m_subcpu->space(AS_PROGRAM).install_read_handler(0x9020, 0x9021, read8_delegate(FUNC(nightgal_state::ngalsumr_unk_r), this) ); + m_subcpu->space(AS_PROGRAM).install_read_handler(0x9030, 0x903f, read8_delegate(FUNC(nightgal_state::ngalsumr_color_r),this) ); + #if 0 UINT8 *ROM = memregion("subrom")->base(); -- cgit v1.2.3-70-g09d2 From e8476f1db8015f03f692758581dd94bcd732e6e9 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 9 Feb 2016 03:27:25 +0100 Subject: k28: added VFD driver --- src/mame/drivers/k28.cpp | 208 ++++++++++++++++++++++++++++++----------------- 1 file changed, 134 insertions(+), 74 deletions(-) diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp index d7e398da367..dd4f890cebd 100644 --- a/src/mame/drivers/k28.cpp +++ b/src/mame/drivers/k28.cpp @@ -34,6 +34,11 @@ public: UINT8 m_inp_mux; UINT8 m_phoneme; int m_speech_strobe; + int m_vfd_data_enable; + int m_vfd_data_in; + int m_vfd_clock; + UINT64 m_vfd_shiftreg; + int m_vfd_shiftcount; DECLARE_WRITE8_MEMBER(mcu_p0_w); DECLARE_READ8_MEMBER(mcu_p1_r); @@ -50,13 +55,23 @@ void k28_state::machine_start() { // zerofill m_inp_mux = 0; - m_speech_strobe = 0; m_phoneme = 0x3f; + m_speech_strobe = 0; + m_vfd_data_enable = 0; + m_vfd_data_in = 0; + m_vfd_clock = 0; + m_vfd_shiftreg = 0; + m_vfd_shiftcount = 0; // register for savestates save_item(NAME(m_inp_mux)); - save_item(NAME(m_speech_strobe)); save_item(NAME(m_phoneme)); + save_item(NAME(m_speech_strobe)); + save_item(NAME(m_vfd_data_enable)); + save_item(NAME(m_vfd_data_in)); + save_item(NAME(m_vfd_clock)); + save_item(NAME(m_vfd_shiftreg)); + save_item(NAME(m_vfd_shiftcount)); } @@ -74,12 +89,16 @@ WRITE8_MEMBER(k28_state::mcu_p0_w) m_phoneme = (m_phoneme & 0xf) | (data << 4 & 0x30); // d3: SC-01 strobe, latch phoneme on rising edge - if (data & 8 && m_speech_strobe == 0) + int strobe = ~data >> 3 & 1; + if (!strobe && m_speech_strobe) m_speech->write(space, 0, m_phoneme); - m_speech_strobe = data & 8; - - //printf("%d",data>>4&1); + m_speech_strobe = strobe; + // d5: VFD driver data enable + m_vfd_data_enable = ~data >> 5 & 1; + if (m_vfd_data_enable) + m_vfd_shiftreg = (m_vfd_shiftreg & U64(~1)) | m_vfd_data_in; + // d4: VSM chip enable // d6: VSM M0 // d7: VSM M1 @@ -110,6 +129,11 @@ READ8_MEMBER(k28_state::mcu_p2_r) WRITE8_MEMBER(k28_state::mcu_p2_w) { + // d0: VFD driver serial data + m_vfd_data_in = data & 1; + if (m_vfd_data_enable) + m_vfd_shiftreg = (m_vfd_shiftreg & U64(~1)) | m_vfd_data_in; + // d0-d3: VSM data, input mux and SC-01 phoneme lower nibble m_tms6100->add_w(space, 0, data); m_inp_mux = (m_inp_mux & ~0xf) | (~data & 0xf); @@ -118,13 +142,49 @@ WRITE8_MEMBER(k28_state::mcu_p2_w) WRITE8_MEMBER(k28_state::mcu_prog_w) { - // 8021 PROG: MM5445 CLK pin + // 8021 PROG: clock VFD driver + int state = (data) ? 1 : 0; + bool rise = state == 1 && !m_vfd_clock; + m_vfd_clock = state; + + // on rising edge + if (rise) + { + // leading 1 triggers shift start + if (m_vfd_shiftcount == 0 && ~m_vfd_shiftreg & 1) + return; + + // output shiftreg on 35th clock + if (m_vfd_shiftcount == 35) + { + m_vfd_shiftcount = 0; + + // output 0-15: digit segment data + UINT16 seg_data = (UINT16)(m_vfd_shiftreg >> 19); + seg_data = BITSWAP16(seg_data,0,1,13,9,10,12,14,8,3,4,5,2,15,11,6,7); + + // output 16-24: digit select + UINT16 digit_sel = (UINT16)(m_vfd_shiftreg >> 10) & 0x1ff; + + // output 25: power-off request on falling edge + + // update display + for (int i = 0; i < 9; i++) + if (digit_sel >> (8-i) & 1) + { + output().set_digit_value(i, seg_data & 0x3fff); + } + } + else + { + m_vfd_shiftreg <<= 1; + m_vfd_shiftcount++; + } + } } READ8_MEMBER(k28_state::mcu_t1_r) { - printf("1"); - // 8021 T1: SC-01 A/R pin return m_speech->request(); } @@ -147,74 +207,74 @@ ADDRESS_MAP_END ***************************************************************************/ static INPUT_PORTS_START( k28 ) - PORT_START("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) - - PORT_START("IN.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) - - PORT_START("IN.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) - - PORT_START("IN.3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) + PORT_START("IN.0") // 0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) // YES + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) // NO + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) // SEL + + PORT_START("IN.1") // 1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) // SCRL PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) - - PORT_START("IN.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) + + PORT_START("IN.2") // 2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) // MENU + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) + + PORT_START("IN.6") // 3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) // OFF + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME(UTF8_DIVIDE) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) + + PORT_START("IN.5") // 4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) // ON + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) - - PORT_START("IN.5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) - - PORT_START("IN.6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) + + PORT_START("IN.4") // 5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) // REPT + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) + + PORT_START("IN.3") // 6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) // PROMPT + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) INPUT_PORTS_END -- cgit v1.2.3-70-g09d2 From f1ca5a23611a36b37c812b0f2f0456652713a4c2 Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 9 Feb 2016 03:42:26 +0100 Subject: Improved protection, nw --- src/mame/drivers/nightgal.cpp | 53 +++++++------------------------------------ 1 file changed, 8 insertions(+), 45 deletions(-) diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index bb602aafdf9..d11900aa822 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -86,7 +86,6 @@ public: DECLARE_WRITE8_MEMBER(output_w); DECLARE_DRIVER_INIT(ngalsumr); DECLARE_DRIVER_INIT(royalqn); - DECLARE_READ8_MEMBER(ngalsumr_unk_r); DECLARE_WRITE8_MEMBER(ngalsumr_unk_w); DECLARE_READ8_MEMBER(ngalsumr_color_r); virtual void machine_start() override; @@ -1076,11 +1075,11 @@ ROM_START( ngalsumr ) ROM_REGION( 0x20000, "gfx", ROMREGION_ERASEFF ) ROM_LOAD( "1.3a", 0x00000, 0x04000, CRC(9626f812) SHA1(ca7162811a0ba05dfaa2aa8cc93a2e898b326e9e) ) - ROM_LOAD( "2.3c", 0x04000, 0x04000, CRC(0d59cf7a) SHA1(600bc70d29853fb936f8adaef048d925cbae0ce9) ) - ROM_LOAD( "3.3d", 0x08000, 0x04000, CRC(2fb2ec0b) SHA1(2f1735e33906783b8c0b283455a2a079431e6f11) ) - ROM_LOAD( "4.3f", 0x0c000, 0x04000, CRC(c7b85199) SHA1(1c4ed2faf82f45d8a23c168793b02969f1201df6) ) - ROM_LOAD( "5.3h", 0x10000, 0x04000, CRC(feaca6a3) SHA1(6658c01ac5769e8317a1c7eec6802e7c96885710) ) - ROM_LOAD( "6.3l", 0x14000, 0x04000, CRC(de9e05f8) SHA1(724468eade222b513b7f39f0a24515f343428130) ) + ROM_LOAD( "3.3d", 0x04000, 0x04000, CRC(2fb2ec0b) SHA1(2f1735e33906783b8c0b283455a2a079431e6f11) ) + ROM_LOAD( "5.3h", 0x08000, 0x04000, CRC(feaca6a3) SHA1(6658c01ac5769e8317a1c7eec6802e7c96885710) ) + ROM_LOAD( "2.3c", 0x10000, 0x04000, CRC(0d59cf7a) SHA1(600bc70d29853fb936f8adaef048d925cbae0ce9) ) + ROM_LOAD( "4.3f", 0x14000, 0x04000, CRC(c7b85199) SHA1(1c4ed2faf82f45d8a23c168793b02969f1201df6) ) + ROM_LOAD( "6.3l", 0x18000, 0x04000, CRC(de9e05f8) SHA1(724468eade222b513b7f39f0a24515f343428130) ) ROM_REGION( 0x20, "proms", 0 ) ROM_LOAD( "ng2.6u", 0x00, 0x20, CRC(0162a24a) SHA1(f7e1623c5bca3725f2e59ae2096b9bc42e0363bf) ) @@ -1095,58 +1094,22 @@ DRIVER_INIT_MEMBER(nightgal_state,royalqn) ROM[0x027f] = 0x02; } -// returns flipped gfxs if active? -READ8_MEMBER(nightgal_state::ngalsumr_unk_r) -{ - return 0; -} - WRITE8_MEMBER(nightgal_state::ngalsumr_unk_w) { //m_z80_latch = data; } -// check with the unknown opcode, wants currently active color for 1bpp gfxs? +// check with the unknown opcode, maybe it actually just masks with first parameter and second one is displacement byte offset? READ8_MEMBER(nightgal_state::ngalsumr_color_r) { - if(offset == 0xc) - return 1; - - - return 0; + return (m_comms_ram[offset] & 0x80); } DRIVER_INIT_MEMBER(nightgal_state,ngalsumr) { m_maincpu->space(AS_PROGRAM).install_write_handler(0x6000, 0x6000, write8_delegate(FUNC(nightgal_state::ngalsumr_unk_w), this) ); // 0x6003 some kind of f/f state - m_subcpu->space(AS_PROGRAM).install_read_handler(0x9020, 0x9021, read8_delegate(FUNC(nightgal_state::ngalsumr_unk_r), this) ); - m_subcpu->space(AS_PROGRAM).install_read_handler(0x9030, 0x903f, read8_delegate(FUNC(nightgal_state::ngalsumr_color_r),this) ); - -#if 0 - UINT8 *ROM = memregion("subrom")->base(); - -// ROM[0x165a] = 0x02; // illegal -// ROM[0x165b] = 0x02; // sts xx xx xx -// ROM[0x165c] = 0x02; -// ROM[0x165d] = 0x02; -// ROM[0x165e] = 0x02; // sts xx xx xx -// ROM[0x165f] = 0x02; -// ROM[0x1660] = 0x02; -// ROM[0x1661] = 0x02; // sts xx xx xx - ROM[0x1662] = 0x20; -// ROM[0x1663] = 0x02; - - /* patch blantantly wrong ROM checks */ - ROM[0x16ce] = 0x02; - ROM[0x16cf] = 0x02; - // adcx $05 converted to 0x04 for debug purposes - //ROM[0x1782] = 0x04; - //ROM[0xd655] = 0x20; - //ROM[0xd3f9] = 0x02; - //ROM[0xd3fa] = 0x02; - //ROM[0xd3a0] = 0x02; -#endif + m_subcpu->space(AS_PROGRAM).install_read_handler(0x9000, 0x903f, read8_delegate(FUNC(nightgal_state::ngalsumr_color_r),this) ); } /* Type 1 HW */ -- cgit v1.2.3-70-g09d2 From ba8d12552f1f94a1cc1c713468ac56f028b56dbc Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Tue, 9 Feb 2016 00:08:36 -0300 Subject: Some cleanups... (nw) --- src/mame/drivers/galaxi.cpp | 69 ++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/src/mame/drivers/galaxi.cpp b/src/mame/drivers/galaxi.cpp index 679bd63b40d..de2e1e47512 100644 --- a/src/mame/drivers/galaxi.cpp +++ b/src/mame/drivers/galaxi.cpp @@ -1,46 +1,41 @@ // license:BSD-3-Clause -// copyright-holders:Luca Elia +// copyright-holders:Luca Elia,Roberto Fresca /*************************************************************************** -Galaxi (C)2000 B.R.L. + Galaxi (C)2000 B.R.L. -driver by Luca Elia + Driver by Luca Elia. + Additional work by Roberto Fresca. -Hardware info (29/07/2008 f205v): -Chips: + Hardware info (29/07/2008 f205v): + + Chips: 1x missing main CPU (u1)(from the socket I would say it's a 68000) 1x A40MX04-PL84 (u29) 1x AD-65 (equivalent to M6295) (u9)(sound) 1x MC1458P (u10)(sound) 1x TDA2003 (u8)(sound) 1x oscillator 10.000MHz (QZ1) - 1x oscillator 16.000000 (QZ2) -ROMs: + 1x oscillator 16.000000 (QZ2) + ROMs: 1x AT27C020 (1) 2x M27C4001 (2,3) 2x AT49F010 (4,5) 2x DS1230Y (non volatile SRAM) -Notes: + Notes: 1x 28x2 edge connector 1x trimmer (volume) -- This hardware is almost identical to that in magic10.c - - -[31/08/2008] (Roberto Fresca) - -- Added Magic Joker. -- Fixed the 3rd background offset to Galaxi. -- Remapped inputs to match the standard poker games. - -[12/09/2008] (Roberto Fresca) - -- Added lamps support to magjoker & galaxi. + - This hardware is almost identical to that in magic10.c + CPU is a MC68000P10, from the other games boards... ***************************************************************************/ +#define CPU_CLOCK (XTAL_10MHz) +#define SND_CLOCK (XTAL_16MHz)/16 + #include "emu.h" #include "cpu/m68000/m68000.h" #include "sound/okim6295.h" @@ -229,7 +224,7 @@ UINT32 galaxi_state::screen_update_galaxi(screen_device &screen, bitmap_ind16 &b } /*************************************************************************** - Memory Maps + Handlers ***************************************************************************/ void galaxi_state::show_out( ) @@ -295,6 +290,10 @@ CUSTOM_INPUT_MEMBER(galaxi_state::hopper_r) } +/*************************************************************************** + Memory Maps +***************************************************************************/ + static ADDRESS_MAP_START( galaxi_map, AS_PROGRAM, 16, galaxi_state ) AM_RANGE(0x000000, 0x03ffff) AM_ROM @@ -343,6 +342,7 @@ static ADDRESS_MAP_START( lastfour_map, AS_PROGRAM, 16, galaxi_state ) AM_RANGE(0x600000, 0x607fff) AM_RAM AM_SHARE("nvram") // 2x DS1230Y (non volatile SRAM) ADDRESS_MAP_END + /*************************************************************************** Input Ports ***************************************************************************/ @@ -389,7 +389,7 @@ INPUT_PORTS_END /*************************************************************************** - Graphics Layout + Graphics Layout & Graphics Decode ***************************************************************************/ static const gfx_layout layout_8x8x4 = @@ -421,7 +421,7 @@ GFXDECODE_END /*************************************************************************** - Machine Drivers + Machine Start & Reset ***************************************************************************/ void galaxi_state::machine_start() @@ -438,10 +438,14 @@ void galaxi_state::machine_reset() m_out = 0; } +/*************************************************************************** + Machine Drivers +***************************************************************************/ + static MACHINE_CONFIG_START( galaxi, galaxi_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz) // ? + MCFG_CPU_ADD("maincpu", M68000, CPU_CLOCK) MCFG_CPU_PROGRAM_MAP(galaxi_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", galaxi_state, irq4_line_hold) @@ -460,19 +464,16 @@ static MACHINE_CONFIG_START( galaxi, galaxi_state ) MCFG_PALETTE_ADD("palette", 0x400) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_OKIM6295_ADD("oki", XTAL_16MHz/16, OKIM6295_PIN7_LOW) // ? + MCFG_OKIM6295_ADD("oki", SND_CLOCK, OKIM6295_PIN7_LOW) // ? MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( magjoker, galaxi ) - /* basic machine hardware */ - /* sound hardware */ MCFG_SOUND_MODIFY("oki") @@ -481,11 +482,15 @@ static MACHINE_CONFIG_DERIVED( magjoker, galaxi ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 4.0) MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( lastfour, galaxi ) + + /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(lastfour_map) MACHINE_CONFIG_END + /*************************************************************************** ROMs Loading ***************************************************************************/ @@ -533,7 +538,7 @@ ROM_END Game Drivers ***************************************************************************/ -/* YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS LAYOUT */ -GAMEL( 2000, galaxi, 0, galaxi, galaxi, driver_device, 0, ROT0, "B.R.L.", "Galaxi (v2.0)", MACHINE_SUPPORTS_SAVE, layout_galaxi ) -GAMEL( 2000, magjoker, 0, magjoker, magjoker, driver_device, 0, ROT0, "B.R.L.", "Magic Joker (v1.25.10.2000)", MACHINE_SUPPORTS_SAVE, layout_galaxi ) -GAMEL( 2001, lastfour, 0, lastfour, magjoker, driver_device, 0, ROT0, "B.R.L.", "Last Four (09:12 16/01/2001)",MACHINE_SUPPORTS_SAVE, layout_galaxi ) +/* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS LAYOUT */ +GAMEL( 2000, galaxi, 0, galaxi, galaxi, driver_device, 0, ROT0, "B.R.L.", "Galaxi (v2.0)", MACHINE_SUPPORTS_SAVE, layout_galaxi ) +GAMEL( 2000, magjoker, 0, magjoker, magjoker, driver_device, 0, ROT0, "B.R.L.", "Magic Joker (v1.25.10.2000)", MACHINE_SUPPORTS_SAVE, layout_galaxi ) +GAMEL( 2001, lastfour, 0, lastfour, magjoker, driver_device, 0, ROT0, "B.R.L.", "Last Four (09:12 16/01/2001)", MACHINE_SUPPORTS_SAVE, layout_galaxi ) -- cgit v1.2.3-70-g09d2 From a7cd9b951bc3bd07e16c310bcbb9fcf3a2d6cdfc Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 9 Feb 2016 04:08:59 +0100 Subject: k28: copypasted display handler, due to strobed VFD --- src/mame/drivers/k28.cpp | 247 +++++++++++++++++++++++++++++++++++++++-------- src/mame/layout/k28.lay | 48 ++++----- 2 files changed, 231 insertions(+), 64 deletions(-) diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp index dd4f890cebd..d3fea3246b6 100644 --- a/src/mame/drivers/k28.cpp +++ b/src/mame/drivers/k28.cpp @@ -22,7 +22,10 @@ public: m_maincpu(*this, "maincpu"), m_tms6100(*this, "tms6100"), m_speech(*this, "speech"), - m_inp_matrix(*this, "IN") + m_inp_matrix(*this, "IN"), + m_display_wait(33), + m_display_maxy(1), + m_display_maxx(0) { } // devices @@ -31,6 +34,23 @@ public: required_device m_speech; required_ioport_array<7> m_inp_matrix; + // display common + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) + + UINT32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + UINT32 m_display_cache[0x20]; // (internal use) + UINT8 m_display_decay[0x20][0x20]; // (internal use) + + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + void display_update(); + void set_display_size(int maxx, int maxy); + void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); + void display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask); + + bool m_power_on; UINT8 m_inp_mux; UINT8 m_phoneme; int m_speech_strobe; @@ -38,6 +58,7 @@ public: int m_vfd_data_in; int m_vfd_clock; UINT64 m_vfd_shiftreg; + UINT64 m_vfd_shiftreg_out; int m_vfd_shiftcount; DECLARE_WRITE8_MEMBER(mcu_p0_w); @@ -46,14 +67,27 @@ public: DECLARE_WRITE8_MEMBER(mcu_p2_w); DECLARE_WRITE8_MEMBER(mcu_prog_w); DECLARE_READ8_MEMBER(mcu_t1_r); + + DECLARE_INPUT_CHANGED_MEMBER(power_on); + void power_off(); protected: virtual void machine_start() override; + virtual void machine_reset() override; }; + +// machine start/reset/power + void k28_state::machine_start() { // zerofill + memset(m_display_state, 0, sizeof(m_display_state)); + memset(m_display_cache, ~0, sizeof(m_display_cache)); + memset(m_display_decay, 0, sizeof(m_display_decay)); + memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // ! + + m_power_on = false; m_inp_mux = 0; m_phoneme = 0x3f; m_speech_strobe = 0; @@ -61,9 +95,20 @@ void k28_state::machine_start() m_vfd_data_in = 0; m_vfd_clock = 0; m_vfd_shiftreg = 0; + m_vfd_shiftreg_out = 0; m_vfd_shiftcount = 0; // register for savestates + save_item(NAME(m_display_maxy)); + save_item(NAME(m_display_maxx)); + save_item(NAME(m_display_wait)); + + save_item(NAME(m_display_state)); + /* save_item(NAME(m_display_cache)); */ // don't save! + save_item(NAME(m_display_decay)); + save_item(NAME(m_display_segmask)); + + save_item(NAME(m_power_on)); save_item(NAME(m_inp_mux)); save_item(NAME(m_phoneme)); save_item(NAME(m_speech_strobe)); @@ -71,9 +116,132 @@ void k28_state::machine_start() save_item(NAME(m_vfd_data_in)); save_item(NAME(m_vfd_clock)); save_item(NAME(m_vfd_shiftreg)); + save_item(NAME(m_vfd_shiftreg_out)); save_item(NAME(m_vfd_shiftcount)); } +void k28_state::machine_reset() +{ + m_power_on = true; +} + +INPUT_CHANGED_MEMBER(k28_state::power_on) +{ + if (newval && !m_power_on) + { + m_power_on = true; + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + } +} + +void k28_state::power_off() +{ + m_power_on = false; + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); +} + + +/*************************************************************************** + + Helper Functions + +***************************************************************************/ + +// The device may strobe the outputs very fast, it is unnoticeable to the user. +// To prevent flickering here, we need to simulate a decay. + +void k28_state::display_update() +{ + UINT32 active_state[0x20]; + + for (int y = 0; y < m_display_maxy; y++) + { + active_state[y] = 0; + + for (int x = 0; x <= m_display_maxx; x++) + { + // turn on powered segments + if (m_power_on && m_display_state[y] >> x & 1) + m_display_decay[y][x] = m_display_wait; + + // determine active state + UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; + active_state[y] |= (ds << x); + } + } + + // on difference, send to output + for (int y = 0; y < m_display_maxy; y++) + if (m_display_cache[y] != active_state[y]) + { + if (m_display_segmask[y] != 0) + output().set_digit_value(y, active_state[y] & m_display_segmask[y]); + + const int mul = (m_display_maxx <= 10) ? 10 : 100; + for (int x = 0; x <= m_display_maxx; x++) + { + int state = active_state[y] >> x & 1; + char buf1[0x10]; // lampyx + char buf2[0x10]; // y.x + + if (x == m_display_maxx) + { + // always-on if selected + sprintf(buf1, "lamp%da", y); + sprintf(buf2, "%d.a", y); + } + else + { + sprintf(buf1, "lamp%d", y * mul + x); + sprintf(buf2, "%d.%d", y, x); + } + output().set_value(buf1, state); + output().set_value(buf2, state); + } + } + + memcpy(m_display_cache, active_state, sizeof(m_display_cache)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(k28_state::display_decay_tick) +{ + // slowly turn off unpowered segments + for (int y = 0; y < m_display_maxy; y++) + for (int x = 0; x <= m_display_maxx; x++) + if (m_display_decay[y][x] != 0) + m_display_decay[y][x]--; + + display_update(); +} + +void k28_state::set_display_size(int maxx, int maxy) +{ + m_display_maxx = maxx; + m_display_maxy = maxy; +} + +void k28_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) +{ + set_display_size(maxx, maxy); + + // update current state + UINT32 mask = (1 << maxx) - 1; + for (int y = 0; y < maxy; y++) + m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; + + display_update(); +} + +void k28_state::display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask) +{ + // expects m_display_segmask to be not-0 + for (int y = 0; y < maxy; y++) + m_display_segmask[y] &= segmask; + + display_matrix(maxx, maxy, setx, sety); +} + + /*************************************************************************** @@ -165,15 +333,12 @@ WRITE8_MEMBER(k28_state::mcu_prog_w) // output 16-24: digit select UINT16 digit_sel = (UINT16)(m_vfd_shiftreg >> 10) & 0x1ff; + display_matrix_seg(16, 9, seg_data, digit_sel, 0x3fff); // output 25: power-off request on falling edge - - // update display - for (int i = 0; i < 9; i++) - if (digit_sel >> (8-i) & 1) - { - output().set_digit_value(i, seg_data & 0x3fff); - } + if (~m_vfd_shiftreg & m_vfd_shiftreg_out & 0x200) + power_off(); + m_vfd_shiftreg_out = m_vfd_shiftreg; } else { @@ -207,7 +372,7 @@ ADDRESS_MAP_END ***************************************************************************/ static INPUT_PORTS_START( k28 ) - PORT_START("IN.0") // 0 + PORT_START("IN.0") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) // YES PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) @@ -217,7 +382,7 @@ static INPUT_PORTS_START( k28 ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) // SEL - PORT_START("IN.1") // 1 + PORT_START("IN.1") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) // SCRL PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) @@ -227,7 +392,7 @@ static INPUT_PORTS_START( k28 ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) - PORT_START("IN.2") // 2 + PORT_START("IN.2") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) // MENU PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) @@ -237,27 +402,17 @@ static INPUT_PORTS_START( k28 ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) - PORT_START("IN.6") // 3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) // OFF - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME(UTF8_DIVIDE) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) - - PORT_START("IN.5") // 4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) // ON - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) + PORT_START("IN.3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) // PROMPT + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) - PORT_START("IN.4") // 5 + PORT_START("IN.4") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) // REPT PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) @@ -267,15 +422,25 @@ static INPUT_PORTS_START( k28 ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) - PORT_START("IN.3") // 6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) // PROMPT - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) + PORT_START("IN.5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, k28_state, power_on, 0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) + + PORT_START("IN.6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") // -> auto_power_off + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME(UTF8_DIVIDE) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) INPUT_PORTS_END @@ -293,6 +458,8 @@ static MACHINE_CONFIG_START( k28, k28_state ) MCFG_CPU_IO_MAP(k28_mcu_map) MCFG_DEVICE_ADD("tms6100", TMS6100, XTAL_3_579545MHz) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", k28_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_k28) /* sound hardware */ diff --git a/src/mame/layout/k28.lay b/src/mame/layout/k28.lay index 14f53a0704d..70e4c1e0577 100644 --- a/src/mame/layout/k28.lay +++ b/src/mame/layout/k28.lay @@ -28,41 +28,41 @@ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + -- cgit v1.2.3-70-g09d2 From 16def4781d3ac823336a3ddb2f631d1d1adf66c7 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 9 Feb 2016 04:35:26 +0100 Subject: k28: fix sc01 strobe --- src/devices/sound/votrax.h | 2 +- src/mame/drivers/k28.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/devices/sound/votrax.h b/src/devices/sound/votrax.h index 540f2b5feb1..471a42873f9 100644 --- a/src/devices/sound/votrax.h +++ b/src/devices/sound/votrax.h @@ -42,7 +42,7 @@ public: // writers DECLARE_WRITE8_MEMBER( write ); DECLARE_WRITE8_MEMBER( inflection_w ); - DECLARE_READ_LINE_MEMBER( request ) { return m_request_state; } + DECLARE_READ_LINE_MEMBER( request ) { m_stream->update(); return m_request_state; } protected: // device-level overrides diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp index d3fea3246b6..bc70ae9f3d6 100644 --- a/src/mame/drivers/k28.cpp +++ b/src/mame/drivers/k28.cpp @@ -257,7 +257,7 @@ WRITE8_MEMBER(k28_state::mcu_p0_w) m_phoneme = (m_phoneme & 0xf) | (data << 4 & 0x30); // d3: SC-01 strobe, latch phoneme on rising edge - int strobe = ~data >> 3 & 1; + int strobe = data >> 3 & 1; if (!strobe && m_speech_strobe) m_speech->write(space, 0, m_phoneme); m_speech_strobe = strobe; @@ -423,7 +423,7 @@ static INPUT_PORTS_START( k28 ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_START("IN.5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, k28_state, power_on, 0) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, k28_state, power_on, nullptr) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) -- cgit v1.2.3-70-g09d2 From 4cd05f07375d649aa714f20b19db89eb4c04f3b2 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Mon, 8 Feb 2016 23:48:50 -0500 Subject: Xerox Notetaker: Implement ROM/RAM overlay as per schematics. Documented Address map and part of I/O map. [Lord Nightmare] --- src/mame/drivers/notetaker.cpp | 102 +++++++++++++++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 13 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index ccf114c4d42..dd2e07217c3 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -9,8 +9,7 @@ * * MISSING DUMP for 8741? I/O MCU which does mouse-related stuff -TODO: Pretty much everything. -* Get bootrom/ram bankswitching working +TODO: everything below. * Get the running machine smalltalk-78 memory dump loaded as a rom and forced into ram on startup, since no boot disks have survived * floppy controller wd1791 * crt5027 video controller @@ -41,24 +40,93 @@ public: //required_device m_vtac; //declarations + DECLARE_WRITE16_MEMBER(IPConReg_w); + DECLARE_READ16_MEMBER(maincpu_r); + DECLARE_WRITE16_MEMBER(maincpu_w); DECLARE_DRIVER_INIT(notetakr); //variables - + UINT8 m_BootSeqDone; + UINT8 m_DisableROM; + +// overrides + virtual void machine_reset() override; }; +WRITE16_MEMBER(notetaker_state::IPConReg_w) +{ + m_BootSeqDone = (data&0x80)?1:0; + //m_ProcLock = (data&0x40)?1:0; + //m_CharCtr = (data&0x20)?1:0; + m_DisableROM = (data&0x10)?1:0; + //m_CorrOn = (data&0x08)?1:0; // also LedInd5 + //m_LedInd6 = (data&0x04)?1:0; + //m_LedInd7 = (data&0x02)?1:0; + //m_LedInd8 = (data&0x01)?1:0; +} + +READ16_MEMBER(notetaker_state::maincpu_r) +{ + UINT16 *rom = (UINT16 *)(memregion("maincpu")->base()); + rom += 0x7f800; + UINT16 *ram = (UINT16 *)(memregion("ram")->base()); + if ( (m_BootSeqDone == 0) || ((m_DisableROM == 0) && ((offset&0x7F800) == 0)) ) + { + rom += (offset&0x7FF); + return *rom; + } + else + { + ram += (offset); + return *ram; + } +} + +WRITE16_MEMBER(notetaker_state::maincpu_w) +{ + UINT16 *ram = (UINT16 *)(memregion("ram")->base()); + ram += offset; + *ram = data; +} + +/* Address map comes from http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker/schematics/19790423_Notetaker_IO_Processor.pdf +a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 BootSeqDone DisableROM +x x x x x x x x * * * * * * * * * * * * 0 x R ROM +0 0 0 0 0 0 0 0 * * * * * * * * * * * * 1 0 R ROM +< anything not all zeroes > * * * * * * * * * * * * 1 0 RW RAM +x x x x ? ? * * * * * * * * * * * * * * x x W RAM +x x x x ? ? * * * * * * * * * * * * * * 1 1 RW RAM + +More or less: +BootSeqDone is 0, DisableROM is ignored, mem map is 0x00000-0xfffff reading is the 0x1000-long ROM, repeated every 0x1000 bytes. writing goes to RAM. +BootSeqDone is 1, DisableROM is 0, mem map is 0x00000-0x00fff reading is the 0x1000-long ROM, remainder of memory map goes to RAM or open bus. writing goes to RAM. +BootSeqDone is 1, DisableROM is 1, mem map is entirely RAM or open bus for both reading and writing. +*/ static ADDRESS_MAP_START(notetaker_mem, AS_PROGRAM, 16, notetaker_state) - // AM_RANGE(0x00000, 0x01fff) AM_RAM - AM_RANGE(0x00000, 0x00fff) AM_ROM AM_REGION("maincpu", 0xFF000) // I think this copy of rom is actually banked via io reg 0x20, there is ram which lives behind here? + /*AM_RANGE(0x00000, 0x00fff) AM_ROM AM_REGION("maincpu", 0xFF000) // I think this copy of rom is actually banked via io reg 0x20, there is RAM which lives behind here? AM_RANGE(0x01000, 0x3ffff) AM_RAM // ram lives here, 256KB - AM_RANGE(0xff000, 0xfffff) AM_ROM // is this banked too? Don't think so... + AM_RANGE(0xff000, 0xfffff) AM_ROM // is this banked too? Don't think so...*/ + AM_RANGE(0x00000, 0xfffff) AM_READWRITE(maincpu_r, maincpu_w) // bypass MAME's memory map system as we need finer grained control ADDRESS_MAP_END -// io memory map comes from http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker/memos/19790605_Definition_of_8086_Ports.pdf +/* io memory map comes from http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker/memos/19790605_Definition_of_8086_Ports.pdf + and from the schematic at http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker/schematics/19790423_Notetaker_IO_Processor.pdf +a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 +? ? ? ? 0 x x x x x x 0 0 0 0 x x x * . RW IntCon (PIC8259) +? ? ? ? 0 x x x x x x 0 0 0 1 x x x x . W IPConReg +? ? ? ? 0 x x x x x x 0 0 1 0 x x x x . W KbdInt +? ? ? ? 0 x x x x x x 0 0 1 1 x x x x . W FIFOReg +? ? ? ? 0 x x x x x x 0 1 0 0 x x x x . . Open Bus +? ? ? ? 0 x x x x x x 0 1 0 1 x x x x . . Open Bus +? ? ? ? 0 x x x x x x 0 1 1 0 x x x x . W FIFOBus +? ? ? ? 0 x x x x x x 0 1 1 1 x x x x . . Open Bus +0 0 0 0 0 0 0 0 * * * * * * * * * * * . R ROM, but ONLY if BootSegDone is TRUE, and /DisableROM is FALSE + +*/ static ADDRESS_MAP_START(notetaker_io, AS_IO, 16, notetaker_state) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x02, 0x03) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xFF00) - //AM_RANGE(0x20, 0x21) AM_WRITE processor (rom mapping, etc) control register + AM_RANGE(0x00, 0x03) AM_MIRROR(0x7E1C) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x20, 0x21) AM_MIRROR(0x7E1E) AM_WRITE(IPConReg_w) // processor (rom mapping, etc) control register //AM_RANGE(0x42, 0x43) AM_READ read keyboard data (high byte only) [from mcu?] //AM_RANGE(0x44, 0x45) AM_READ read keyboard fifo state (high byte only) [from mcu?] //AM_RANGE(0x48, 0x49) AM_WRITE kbd->uart control register [to mcu?] @@ -100,6 +168,13 @@ read from 0x0002 (byte wide) (check interrupts) >1 because 16 bits data) + // leave the src pointer alone, since we've only used a 0x1000 long address space romdst += 0x7f800; // set the dest pointer to 0xff000 (>>1 because 16 bits data) for (int i = 0; i < 0x800; i++) { @@ -157,10 +232,11 @@ DRIVER_INIT_MEMBER(notetaker_state,notetakr) /* ROM definition */ ROM_START( notetakr ) - ROM_REGION( 0x100000, "maincpuload", ROMREGION_ERASEFF ) // load roms here before descrambling - ROMX_LOAD( "biop__2.00_hi.b2716.h1", 0xff000, 0x0800, CRC(1119691d) SHA1(4c20b595b554e6f5489ab2c3fb364b4a052f05e3), ROM_SKIP(1)) - ROMX_LOAD( "biop__2.00_lo.b2716.g1", 0xff001, 0x0800, CRC(b72aa4c7) SHA1(85dab2399f906c7695dc92e7c18f32e2303c5892), ROM_SKIP(1)) + ROM_REGION( 0x1000, "maincpuload", ROMREGION_ERASEFF ) // load roms here before descrambling + ROMX_LOAD( "biop__2.00_hi.b2716.h1", 0x0000, 0x0800, CRC(1119691d) SHA1(4c20b595b554e6f5489ab2c3fb364b4a052f05e3), ROM_SKIP(1)) + ROMX_LOAD( "biop__2.00_lo.b2716.g1", 0x0001, 0x0800, CRC(b72aa4c7) SHA1(85dab2399f906c7695dc92e7c18f32e2303c5892), ROM_SKIP(1)) ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) // area for descrambled roms + ROM_REGION( 0x100000, "ram", ROMREGION_ERASEFF ) // ram cards ROM_END /* Driver */ -- cgit v1.2.3-70-g09d2 From 574734988c8493532aa1892cfdd1f0db8d32f1d7 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 9 Feb 2016 19:41:48 +1100 Subject: laserbat/lazarian: fix TMS clocks, Guillaume Tell Overture is recognisable again --- src/mame/drivers/laserbat.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/laserbat.cpp b/src/mame/drivers/laserbat.cpp index 0f3ed93c3b1..3ba7b7018f1 100644 --- a/src/mame/drivers/laserbat.cpp +++ b/src/mame/drivers/laserbat.cpp @@ -533,10 +533,10 @@ static MACHINE_CONFIG_DERIVED_CLASS( laserbat, laserbat_base, laserbat_state ) MCFG_SN76477_ENVELOPE_PARAMS(0, 1) // GND, Vreg MCFG_SN76477_ENABLE(0) // AB SOUND - MCFG_TMS3615_ADD("synth_high", XTAL_4MHz/16/2) // from the other one's /2 clock output + MCFG_TMS3615_ADD("synth_low", XTAL_4MHz/16/2) // from the other one's /2 clock output MCFG_SOUND_ROUTE(TMS3615_FOOTAGE_8, "mono", 1.0) - MCFG_TMS3615_ADD("synth_low", XTAL_4MHz/16) // 4MHz divided down with a 74LS161 + MCFG_TMS3615_ADD("synth_high", XTAL_4MHz/16) // 4MHz divided down with a 74LS161 MCFG_SOUND_ROUTE(TMS3615_FOOTAGE_8, "mono", 1.0) MACHINE_CONFIG_END -- cgit v1.2.3-70-g09d2 From 0439abe3c7c3636dad33a93b77e7fb0e6d7f7fdf Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 9 Feb 2016 21:35:21 +1100 Subject: add note about demo sounds (nw) --- src/mame/drivers/laserbat.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mame/drivers/laserbat.cpp b/src/mame/drivers/laserbat.cpp index 3ba7b7018f1..58d0fd3f464 100644 --- a/src/mame/drivers/laserbat.cpp +++ b/src/mame/drivers/laserbat.cpp @@ -65,6 +65,8 @@ * The sprite ROM is twice the size as Laser Battle with the bank selected using bit 9 of the 16-bit sound interface (there's a wire making this connection visible on the component side of the PCB) + * If demo sounds are enabled (using DIP switches), background music + is played every sixth time through the attract loop * Sound board emulation is based on tracing the program and guessing what's connected where - we really need someone to trace out the 1b11107 sound board if we want to get this right -- cgit v1.2.3-70-g09d2 From a8c8ec182f5af929f5085b2cda1ca41be0f7c2be Mon Sep 17 00:00:00 2001 From: Branimir Karadžić Date: Tue, 9 Feb 2016 14:27:17 +0100 Subject: Update BGFX with latest code (nw) --- 3rdparty/bgfx/README.md | 2 + 3rdparty/bgfx/examples/common/imgui/imgui.cpp | 2 +- 3rdparty/bgfx/examples/common/nanovg/nanovg.h | 6 +- .../bgfx/examples/common/nanovg/nanovg_bgfx.cpp | 64 ++++++++++++++-------- 3rdparty/bgfx/src/bgfx_p.h | 10 +++- 3rdparty/bgfx/src/renderer_d3d11.cpp | 4 +- 3rdparty/bgfx/src/renderer_gl.cpp | 5 +- 3rdparty/bx/include/bx/allocator.h | 2 +- 3rdparty/bx/include/bx/thread.h | 11 +++- 9 files changed, 72 insertions(+), 34 deletions(-) diff --git a/3rdparty/bgfx/README.md b/3rdparty/bgfx/README.md index 19c0a07167a..2b444eb809f 100644 --- a/3rdparty/bgfx/README.md +++ b/3rdparty/bgfx/README.md @@ -115,6 +115,8 @@ C++ and using bgfx to support multiple rendering APIs. http://makingartstudios.itch.io/dls - DLS the digital logic simulator game. ![dls-screenshot](https://img.itch.io/aW1hZ2UvMzk3MTgvMTc5MjQ4LnBuZw==/original/kA%2FQPb.png) +https://github.com/mamedev/mame MAME - Multiple Arcade Machine Emulator + [Building](https://bkaradzic.github.io/bgfx/build.html) ------------------------------------------------------- diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.cpp b/3rdparty/bgfx/examples/common/imgui/imgui.cpp index 3bc68d3d61d..2655e6ce0a1 100644 --- a/3rdparty/bgfx/examples/common/imgui/imgui.cpp +++ b/3rdparty/bgfx/examples/common/imgui/imgui.cpp @@ -468,7 +468,7 @@ struct Imgui IMGUI_create(_data, _size, _fontSize, m_allocator); - m_nvg = nvgCreate(1, m_view); + m_nvg = nvgCreate(1, m_view, m_allocator); nvgCreateFontMem(m_nvg, "default", (unsigned char*)_data, INT32_MAX, 0); nvgFontSize(m_nvg, _fontSize); nvgFontFace(m_nvg, "default"); diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg.h b/3rdparty/bgfx/examples/common/nanovg/nanovg.h index 1f55dcd3f70..692d1bd2be8 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg.h +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg.h @@ -598,8 +598,10 @@ struct NVGparams { }; typedef struct NVGparams NVGparams; -NVGcontext* nvgCreate(int edgeaa, unsigned char viewid); -void nvgViewId(struct NVGcontext* ctx, unsigned char viewid); +namespace bx { struct AllocatorI; } + +NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId, bx::AllocatorI* _allocator = NULL); +void nvgViewId(struct NVGcontext* ctx, unsigned char _viewId); void nvgDelete(struct NVGcontext* ctx); // Constructor and destructor, called by the render back-end. diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp index fc276ff32fd..1da34bd790f 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp @@ -23,14 +23,13 @@ #define NVG_ANTIALIAS 1 #include -#include -#include #include #include "nanovg.h" #include #include +#include BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244); // warning C4244: '=' : conversion from '' to '', possible loss of data @@ -113,6 +112,8 @@ namespace struct GLNVGcontext { + bx::AllocatorI* m_allocator; + bgfx::ProgramHandle prog; bgfx::UniformHandle u_scissorMat; bgfx::UniformHandle u_paintMat; @@ -131,7 +132,7 @@ namespace bgfx::TextureHandle texMissing; bgfx::TransientVertexBuffer tvb; - uint8_t viewid; + uint8_t m_viewId; struct GLNVGtexture* textures; float view[2]; @@ -177,7 +178,7 @@ namespace { int old = gl->ctextures; gl->ctextures = (gl->ctextures == 0) ? 2 : gl->ctextures*2; - gl->textures = (struct GLNVGtexture*)realloc(gl->textures, sizeof(struct GLNVGtexture)*gl->ctextures); + gl->textures = (struct GLNVGtexture*)BX_REALLOC(gl->m_allocator, gl->textures, sizeof(struct GLNVGtexture)*gl->ctextures); memset(&gl->textures[old], 0xff, (gl->ctextures-old)*sizeof(struct GLNVGtexture) ); if (gl->textures == NULL) @@ -548,7 +549,7 @@ namespace struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; gl->view[0] = (float)width; gl->view[1] = (float)height; - bgfx::setViewRect(gl->viewid, 0, 0, width, height); + bgfx::setViewRect(gl->m_viewId, 0, 0, width, height); } static void fan(uint32_t _start, uint32_t _count) @@ -596,7 +597,7 @@ namespace bgfx::setVertexBuffer(&gl->tvb); bgfx::setTexture(0, gl->s_tex, gl->th); fan(paths[i].fillOffset, paths[i].fillCount); - bgfx::submit(gl->viewid, gl->prog); + bgfx::submit(gl->m_viewId, gl->prog); } } @@ -620,7 +621,7 @@ namespace ); bgfx::setVertexBuffer(&gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); bgfx::setTexture(0, gl->s_tex, gl->th); - bgfx::submit(gl->viewid, gl->prog); + bgfx::submit(gl->m_viewId, gl->prog); } } @@ -635,7 +636,7 @@ namespace | BGFX_STENCIL_OP_FAIL_Z_ZERO | BGFX_STENCIL_OP_PASS_Z_ZERO ); - bgfx::submit(gl->viewid, gl->prog); + bgfx::submit(gl->m_viewId, gl->prog); } static void glnvg__convexFill(struct GLNVGcontext* gl, struct GLNVGcall* call) @@ -652,7 +653,7 @@ namespace bgfx::setVertexBuffer(&gl->tvb); bgfx::setTexture(0, gl->s_tex, gl->th); fan(paths[i].fillOffset, paths[i].fillCount); - bgfx::submit(gl->viewid, gl->prog); + bgfx::submit(gl->m_viewId, gl->prog); } if (gl->edgeAntiAlias) @@ -665,7 +666,7 @@ namespace ); bgfx::setVertexBuffer(&gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); bgfx::setTexture(0, gl->s_tex, gl->th); - bgfx::submit(gl->viewid, gl->prog); + bgfx::submit(gl->m_viewId, gl->prog); } } } @@ -685,7 +686,7 @@ namespace ); bgfx::setVertexBuffer(&gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); bgfx::setTexture(0, gl->s_tex, gl->th); - bgfx::submit(gl->viewid, gl->prog); + bgfx::submit(gl->m_viewId, gl->prog); } } @@ -698,7 +699,7 @@ namespace bgfx::setState(gl->state); bgfx::setVertexBuffer(&gl->tvb, call->vertexOffset, call->vertexCount); bgfx::setTexture(0, gl->s_tex, gl->th); - bgfx::submit(gl->viewid, gl->prog); + bgfx::submit(gl->m_viewId, gl->prog); } } @@ -791,7 +792,7 @@ namespace if (gl->ncalls+1 > gl->ccalls) { gl->ccalls = gl->ccalls == 0 ? 32 : gl->ccalls * 2; - gl->calls = (struct GLNVGcall*)realloc(gl->calls, sizeof(struct GLNVGcall) * gl->ccalls); + gl->calls = (struct GLNVGcall*)BX_REALLOC(gl->m_allocator, gl->calls, sizeof(struct GLNVGcall) * gl->ccalls); } ret = &gl->calls[gl->ncalls++]; memset(ret, 0, sizeof(struct GLNVGcall) ); @@ -804,7 +805,7 @@ namespace if (gl->npaths + n > gl->cpaths) { GLNVGpath* paths; int cpaths = glnvg__maxi(gl->npaths + n, 128) + gl->cpaths / 2; // 1.5x Overallocate - paths = (GLNVGpath*)realloc(gl->paths, sizeof(GLNVGpath) * cpaths); + paths = (GLNVGpath*)BX_REALLOC(gl->m_allocator, gl->paths, sizeof(GLNVGpath) * cpaths); if (paths == NULL) return -1; gl->paths = paths; gl->cpaths = cpaths; @@ -821,7 +822,7 @@ namespace { NVGvertex* verts; int cverts = glnvg__maxi(gl->nverts + n, 4096) + gl->cverts/2; // 1.5x Overallocate - verts = (NVGvertex*)realloc(gl->verts, sizeof(NVGvertex) * cverts); + verts = (NVGvertex*)BX_REALLOC(gl->m_allocator, gl->verts, sizeof(NVGvertex) * cverts); if (verts == NULL) return -1; gl->verts = verts; gl->cverts = cverts; @@ -837,7 +838,7 @@ namespace if (gl->nuniforms+n > gl->cuniforms) { gl->cuniforms = gl->cuniforms == 0 ? glnvg__maxi(n, 32) : gl->cuniforms * 2; - gl->uniforms = (unsigned char*)realloc(gl->uniforms, gl->cuniforms * structSize); + gl->uniforms = (unsigned char*)BX_REALLOC(gl->m_allocator, gl->uniforms, gl->cuniforms * structSize); } ret = gl->nuniforms * structSize; gl->nuniforms += n; @@ -1023,18 +1024,32 @@ namespace } } - free(gl->textures); - - free(gl); + BX_FREE(gl->m_allocator, gl->uniforms); + BX_FREE(gl->m_allocator, gl->verts); + BX_FREE(gl->m_allocator, gl->paths); + BX_FREE(gl->m_allocator, gl->calls); + BX_FREE(gl->m_allocator, gl->textures); + BX_FREE(gl->m_allocator, gl); } } // namespace -NVGcontext* nvgCreate(int edgeaa, unsigned char viewid) +NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId, bx::AllocatorI* _allocator) { + if (NULL == _allocator) + { +#if BX_CONFIG_ALLOCATOR_CRT + static bx::CrtAllocator allocator; + _allocator = &allocator; +#else + BX_CHECK(false, "No allocator has been passed to nvgCreate(). Either specify a bx::AllocatorI instance or enable BX_CONFIG_ALLOCATOR_CRT directive."); + return NULL; +#endif // BX_CONFIG_ALLOCATOR_CRT + } + struct NVGparams params; struct NVGcontext* ctx = NULL; - struct GLNVGcontext* gl = (struct GLNVGcontext*)malloc(sizeof(struct GLNVGcontext) ); + struct GLNVGcontext* gl = (struct GLNVGcontext*)BX_ALLOC(_allocator, sizeof(struct GLNVGcontext) ); if (gl == NULL) goto error; memset(gl, 0, sizeof(struct GLNVGcontext) ); @@ -1053,8 +1068,9 @@ NVGcontext* nvgCreate(int edgeaa, unsigned char viewid) params.userPtr = gl; params.edgeAntiAlias = edgeaa; + gl->m_allocator = _allocator; gl->edgeAntiAlias = edgeaa; - gl->viewid = uint8_t(viewid); + gl->m_viewId = uint8_t(_viewId); ctx = nvgCreateInternal(¶ms); if (ctx == NULL) goto error; @@ -1071,11 +1087,11 @@ error: return NULL; } -void nvgViewId(struct NVGcontext* ctx, unsigned char viewid) +void nvgViewId(struct NVGcontext* ctx, unsigned char _viewId) { struct NVGparams* params = nvgInternalParams(ctx); struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr; - gl->viewid = uint8_t(viewid); + gl->m_viewId = uint8_t(_viewId); } void nvgDelete(struct NVGcontext* ctx) diff --git a/3rdparty/bgfx/src/bgfx_p.h b/3rdparty/bgfx/src/bgfx_p.h index 9e4e5a17184..594310d284f 100644 --- a/3rdparty/bgfx/src/bgfx_p.h +++ b/3rdparty/bgfx/src/bgfx_p.h @@ -925,6 +925,10 @@ namespace bgfx float* toPtr(uint32_t _cacheIdx) { + BX_CHECK(_cacheIdx < BGFX_CONFIG_MAX_MATRIX_CACHE, "Matrix cache out of bounds index %d (max: %d)" + , _cacheIdx + , BGFX_CONFIG_MAX_MATRIX_CACHE + ); return m_cache[_cacheIdx].un.val; } @@ -1493,8 +1497,12 @@ namespace bgfx void setTransform(uint32_t _cache, uint16_t _num) { + BX_CHECK(_cache < BGFX_CONFIG_MAX_MATRIX_CACHE, "Matrix cache out of bounds index %d (max: %d)" + , _cache + , BGFX_CONFIG_MAX_MATRIX_CACHE + ); m_draw.m_matrix = _cache; - m_draw.m_num = _num; + m_draw.m_num = uint16_t(bx::uint32_min(_cache+_num, BGFX_CONFIG_MAX_MATRIX_CACHE-1) - _cache); } void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp index 1e36af03985..5bacc5561d4 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.cpp +++ b/3rdparty/bgfx/src/renderer_d3d11.cpp @@ -3397,7 +3397,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS]; Matrix4 m_predefinedUniforms[PredefinedUniform::Count]; UniformRegistry m_uniformReg; - ViewState m_viewState; StateCacheT m_blendStateCache; StateCacheT m_depthStencilStateCache; @@ -4729,8 +4728,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); _render->m_hmdInitialized = m_ovr.isInitialized(); const bool hmdEnabled = m_ovr.isEnabled() || m_ovr.isDebug(); - ViewState& viewState = m_viewState; - viewState.reset(_render, hmdEnabled); + ViewState viewState(_render, hmdEnabled); bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME); bool scissorEnabled = false; diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp index be4ab0a09d7..ff6184ccc98 100644 --- a/3rdparty/bgfx/src/renderer_gl.cpp +++ b/3rdparty/bgfx/src/renderer_gl.cpp @@ -2389,7 +2389,10 @@ namespace bgfx { namespace gl if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) { - GL_CHECK(glBindSampler(0, 0) ); + if (m_samplerObjectSupport) + { + GL_CHECK(glBindSampler(0, 0) ); + } } } } diff --git a/3rdparty/bx/include/bx/allocator.h b/3rdparty/bx/include/bx/allocator.h index 3a6ca4f6e26..50d526535b6 100644 --- a/3rdparty/bx/include/bx/allocator.h +++ b/3rdparty/bx/include/bx/allocator.h @@ -13,7 +13,7 @@ #include #if BX_CONFIG_ALLOCATOR_CRT -# include +# include #endif // BX_CONFIG_ALLOCATOR_CRT #if BX_CONFIG_ALLOCATOR_DEBUG diff --git a/3rdparty/bx/include/bx/thread.h b/3rdparty/bx/include/bx/thread.h index fb9e07df6f8..015bd57eff8 100644 --- a/3rdparty/bx/include/bx/thread.h +++ b/3rdparty/bx/include/bx/thread.h @@ -8,6 +8,9 @@ #if BX_PLATFORM_POSIX # include +# if defined(__GLIBC__) && !( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12) ) ) +# include +# endif // defined(__GLIBC__) ... #elif BX_PLATFORM_WINRT using namespace Platform; using namespace Windows::Foundation; @@ -149,7 +152,13 @@ namespace bx { #if BX_PLATFORM_OSX || BX_PLATFORM_IOS pthread_setname_np(_name); -#elif (BX_PLATFORM_LINUX && defined(__GLIBC__)) || BX_PLATFORM_BSD +#elif BX_PLATFORM_LINUX +# if defined(__GLIBC__) && (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12) ) + pthread_setname_np(m_handle, _name); +# else + prctl(PR_SET_NAME,_name, 0, 0, 0); +# endif // defined(__GLIBC__) ... +#elif BX_PLATFORM_BSD pthread_setname_np(m_handle, _name); #elif BX_PLATFORM_WINDOWS && BX_COMPILER_MSVC # pragma pack(push, 8) -- cgit v1.2.3-70-g09d2 From d2759d9bcd7facf77a2361a8c69ced95698bc7d5 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 9 Feb 2016 14:47:55 +0100 Subject: maygay1b.cpp: fixed MT06137 (nw) --- src/mame/drivers/maygay1b.cpp | 4 +--- src/mame/includes/maygay1b.h | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mame/drivers/maygay1b.cpp b/src/mame/drivers/maygay1b.cpp index 8d129794d27..220854829ee 100644 --- a/src/mame/drivers/maygay1b.cpp +++ b/src/mame/drivers/maygay1b.cpp @@ -709,9 +709,7 @@ DRIVER_INIT_MEMBER(maygay1b_state,m1) //AM_RANGE(0x2420, 0x2421) AM_WRITE(latch_ch2_w ) // oki // if there is no OKI region disable writes here, the rom might be missing, so alert user - UINT8 *okirom = memregion( "msm6376" )->base(); - - if (!okirom) { + if (m_oki_region == nullptr) { m_maincpu->space(AS_PROGRAM).install_write_handler(0x2420, 0x2421, write8_delegate(FUNC(maygay1b_state::m1ab_no_oki_w), this)); } } diff --git a/src/mame/includes/maygay1b.h b/src/mame/includes/maygay1b.h index b76f3192a33..142c71ae407 100644 --- a/src/mame/includes/maygay1b.h +++ b/src/mame/includes/maygay1b.h @@ -53,7 +53,8 @@ public: m_reel3(*this, "reel3"), m_reel4(*this, "reel4"), m_reel5(*this, "reel5"), - m_meters(*this, "meters") + m_meters(*this, "meters"), + m_oki_region(*this, "msm6376") {} required_device m_maincpu; @@ -79,6 +80,7 @@ public: required_device m_reel4; required_device m_reel5; required_device m_meters; + optional_region_ptr m_oki_region; UINT8 m_lamppos; int m_lamp_strobe; -- cgit v1.2.3-70-g09d2 From 59000f8a975d54c42eef63b43ea2af111a1281e7 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 9 Feb 2016 14:51:44 +0100 Subject: m5_cart.xml: fixed validation (nw) --- hash/m5_cart.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash/m5_cart.xml b/hash/m5_cart.xml index 7ff0947beaa..194e624fd79 100644 --- a/hash/m5_cart.xml +++ b/hash/m5_cart.xml @@ -667,7 +667,7 @@ come from... they might be eventually removed --> - + Boot for Brno ramdisk 1989 <Pavel Brychta a spol.> -- cgit v1.2.3-70-g09d2 From b7def3d28c7feebde9faabe6b1387ea531c35046 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 9 Feb 2016 15:13:06 +0100 Subject: fix for osx and bsd (nw) --- scripts/src/osd/sdl_cfg.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/src/osd/sdl_cfg.lua b/scripts/src/osd/sdl_cfg.lua index 2dc1a7e465a..dd902d1fe60 100644 --- a/scripts/src/osd/sdl_cfg.lua +++ b/scripts/src/osd/sdl_cfg.lua @@ -151,3 +151,21 @@ elseif _OPTIONS["targetos"]=="os2" then backtick(sdlconfigcmd() .. " --cflags"), } end + +configuration { "osx*" } + includedirs { + MAME_DIR .. "3rdparty/bx/include/compat/osx", + } + +configuration { "freebsd" } + includedirs { + MAME_DIR .. "3rdparty/bx/include/compat/freebsd", + } + +configuration { "netbsd" } + includedirs { + MAME_DIR .. "3rdparty/bx/include/compat/freebsd", + } + +configuration { } + -- cgit v1.2.3-70-g09d2 From 9d2ad254e324ef4d7ba7b23e3d4d6859dc21ea02 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 9 Feb 2016 16:36:32 +0100 Subject: k28: finished driver New NOT_WORKING machine added ------------------- Tiger K28 (model 7-230) [hap, Kevin Horton] --- src/mame/drivers/k28.cpp | 144 +++++++++++++++++++++++++------------------ src/mame/drivers/tispeak.cpp | 2 +- 2 files changed, 85 insertions(+), 61 deletions(-) diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp index bc70ae9f3d6..3ad385ada9c 100644 --- a/src/mame/drivers/k28.cpp +++ b/src/mame/drivers/k28.cpp @@ -2,7 +2,20 @@ // copyright-holders:hap, Kevin Horton /*************************************************************************** - K28 + Tiger Electronics K28: Talking Learning Computer (model 7-230) + * 8021 MCU with 1KB internal ROM + * MM5445 VFD driver, 9-digit alphanumeric display same as snmath + * 2*TMS6100 (32KB VSM) + * SC-01 speech chip + + Model 7-232 was released a few years later, it is on entirely different hardware + and emulated in tispeak.cpp. + + TODO: + - is model 7-231 the same hardware or just a redesigned case? (one is gray, + other is blue and looks more like a toy) + - external module support (no dumps yet) + - SC-01 frog speech is why this driver is marked NOT_WORKING ***************************************************************************/ @@ -22,6 +35,7 @@ public: m_maincpu(*this, "maincpu"), m_tms6100(*this, "tms6100"), m_speech(*this, "speech"), + m_onbutton_timer(*this, "on_button"), m_inp_matrix(*this, "IN"), m_display_wait(33), m_display_maxy(1), @@ -32,6 +46,7 @@ public: required_device m_maincpu; required_device m_tms6100; required_device m_speech; + required_device m_onbutton_timer; required_ioport_array<7> m_inp_matrix; // display common @@ -123,15 +138,16 @@ void k28_state::machine_start() void k28_state::machine_reset() { m_power_on = true; + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + + // the game relies on reading the on-button as pressed when it's turned on + m_onbutton_timer->adjust(attotime::from_msec(250)); } INPUT_CHANGED_MEMBER(k28_state::power_on) { if (newval && !m_power_on) - { - m_power_on = true; - m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - } + machine_reset(); } void k28_state::power_off() @@ -284,7 +300,13 @@ READ8_MEMBER(k28_state::mcu_p1_r) // multiplexed inputs (active low) for (int i = 0; i < 7; i++) if (m_inp_mux >> i & 1) + { data |= m_inp_matrix[i]->read(); + + // force press on-button at boot + if (i == 5 && m_onbutton_timer->enabled()) + data |= 1; + } return data ^ 0xff; } @@ -373,74 +395,74 @@ ADDRESS_MAP_END static INPUT_PORTS_START( k28 ) PORT_START("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) // YES - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) // NO - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) // SEL + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("Yes") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("No") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Select") PORT_START("IN.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) // SCRL - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("Scroll") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("<") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear") PORT_START("IN.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) // MENU - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("Menu") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_NAME(">") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Enter") PORT_START("IN.3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) // PROMPT - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("Prompt") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") PORT_START("IN.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) // REPT - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("Repeat") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") PORT_START("IN.5") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, k28_state, power_on, nullptr) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("=") PORT_START("IN.6") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") // -> auto_power_off - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME(UTF8_DIVIDE) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") INPUT_PORTS_END @@ -457,14 +479,16 @@ static MACHINE_CONFIG_START( k28, k28_state ) MCFG_CPU_ADD("maincpu", I8021, XTAL_3_579545MHz) MCFG_CPU_IO_MAP(k28_mcu_map) - MCFG_DEVICE_ADD("tms6100", TMS6100, XTAL_3_579545MHz) + MCFG_DEVICE_ADD("tms6100", TMS6100, XTAL_3_579545MHz) // CLK tied to 8021 ALE pin + + MCFG_TIMER_ADD_NONE("on_button") MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", k28_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_k28) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_DEVICE_ADD("speech", VOTRAX_SC01, 760000) // measured 760kHz + MCFG_DEVICE_ADD("speech", VOTRAX_SC01, 760000) // measured 760kHz on its RC pin MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) MACHINE_CONFIG_END diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index 40dfb8e3f07..ddffa1012ac 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -1125,7 +1125,7 @@ static INPUT_PORTS_START( k28m2 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_START("IN.3") // O3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("Prompt") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("Prompt") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('D') PORT_NAME("D/4") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('M') PORT_NAME("M/" UTF8_MULTIPLY) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') -- cgit v1.2.3-70-g09d2 From 444f3bb8bed1d25807d295ab83089860f8f0cc97 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 9 Feb 2016 18:40:55 +0100 Subject: k28: notes --- src/mame/drivers/k28.cpp | 29 +++++++++++++++-------------- src/mame/drivers/tispeak.cpp | 4 +++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp index 3ad385ada9c..71c6b2389f4 100644 --- a/src/mame/drivers/k28.cpp +++ b/src/mame/drivers/k28.cpp @@ -2,18 +2,19 @@ // copyright-holders:hap, Kevin Horton /*************************************************************************** - Tiger Electronics K28: Talking Learning Computer (model 7-230) - * 8021 MCU with 1KB internal ROM - * MM5445 VFD driver, 9-digit alphanumeric display same as snmath + Tiger Electronics K28: Talking Learning Computer (model 7-230/7-231) + * PCB marked PB-123 WIZARD, TIGER + * Intel P8021 MCU with 1KB internal ROM + * MM5445N VFD driver, 9-digit alphanumeric display same as snmath * 2*TMS6100 (32KB VSM) - * SC-01 speech chip + * SC-01-A speech chip - Model 7-232 was released a few years later, it is on entirely different hardware - and emulated in tispeak.cpp. + 3 models exist: + - 7-230: darkblue case, toy-ish looks + - 7-231: gray case, hardware is the same + - 7-232: this one is completely different hw --> driver tispeak.cpp TODO: - - is model 7-231 the same hardware or just a redesigned case? (one is gray, - other is blue and looks more like a toy) - external module support (no dumps yet) - SC-01 frog speech is why this driver is marked NOT_WORKING @@ -395,11 +396,11 @@ ADDRESS_MAP_END static INPUT_PORTS_START( k28 ) PORT_START("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("Yes") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("Yes/True") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("No") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("No/False") PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Select") @@ -412,7 +413,7 @@ static INPUT_PORTS_START( k28 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("<") PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Erase/Clear") PORT_START("IN.2") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("Menu") @@ -422,7 +423,7 @@ static INPUT_PORTS_START( k28 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_NAME(">") PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Enter") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Enter/Start") PORT_START("IN.3") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("Prompt") @@ -435,7 +436,7 @@ static INPUT_PORTS_START( k28 ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") PORT_START("IN.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("Repeat") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("Say It Again(Repeat)") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') @@ -502,7 +503,7 @@ MACHINE_CONFIG_END ROM_START( k28 ) ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "k28_8021.bin", 0x0000, 0x0400, CRC(15536d20) SHA1(fac98ce652340ffb2d00952697c3a9ce75393fa4) ) + ROM_LOAD( "p8021", 0x0000, 0x0400, CRC(15536d20) SHA1(fac98ce652340ffb2d00952697c3a9ce75393fa4) ) ROM_REGION( 0x10000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff? = space reserved for cartridge ROM_LOAD( "cm62050.vsm", 0x0000, 0x4000, CRC(6afb8645) SHA1(e22435568ed11c6516a3b4008131f99cd4e47aa9) ) diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index ddffa1012ac..dac42ee4d65 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -357,7 +357,7 @@ Tiger Electronics K28 (model 7-232) Sold in Hong Kong, distributed in US as: - Coleco: Talking Teacher - Sears: Talkatron - Learning Computer -Earlier K28 models 7-230 and 7-231 are on different hardware, showing a different +1981 K28 models 7-230 and 7-231 are on different hardware, showing a different keyboard, VFD display, and use the SC-01 speech chip. --> driver k28.cpp K28 model 7-232 (HK), 1985 @@ -377,6 +377,8 @@ K28 modules: - Expansion Module 4: VSM: 16KB CM62217 - Expansion Module 5: VSM: 16KB CM62218* - Expansion Module 6: VSM: 16KB CM62219 + + note: these won't work on the 1981 version(s) ---------------------------------------------------------------------------- -- cgit v1.2.3-70-g09d2 From 233ec3099a69b382a230da6ccda37639f44d2dd6 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Tue, 9 Feb 2016 13:03:46 -0500 Subject: Note that one of the buccaneers proms matches the vigilante video sync prom [caius, David Haywood] --- src/mame/drivers/vigilant.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/vigilant.cpp b/src/mame/drivers/vigilant.cpp index 9f18d577e2e..239a7c85a53 100644 --- a/src/mame/drivers/vigilant.cpp +++ b/src/mame/drivers/vigilant.cpp @@ -1031,7 +1031,7 @@ ROM_START( buccanrs ) ROM_LOAD( "2.u74", 0x00000, 0x10000, CRC(36ee1dac) SHA1(6dfd2a885c0b1c9347abc4b204ade66551c4b404) ) ROM_REGION( 0x400, "proms", 0 ) - ROM_LOAD( "prom1.u54", 0x0000, 0x0100, CRC(c324835e) SHA1(cf6ffe38523badfda211d341410e93e647de87a9) ) + ROM_LOAD( "prom1.u54", 0x0000, 0x0100, CRC(c324835e) SHA1(cf6ffe38523badfda211d341410e93e647de87a9) ) // == ic52 video timing prom from vigilante ROM_LOAD( "prom4.u79", 0x0100, 0x0100, CRC(e6506ef4) SHA1(079841da7640b14d94aaaeb572bf018932b58293) ) ROM_LOAD( "prom3.u88", 0x0200, 0x0100, CRC(b43d094f) SHA1(2bed4892d8a91d7faac5a07bf858d9294eb30606) ) ROM_LOAD( "prom2.u99", 0x0300, 0x0100, CRC(e0aa8869) SHA1(ac8bdfeba69420ba56ec561bf3d0f1229d02cea2) ) @@ -1070,7 +1070,7 @@ ROM_START( buccanrsa ) ROM_LOAD( "2.u74", 0x00000, 0x10000, CRC(36ee1dac) SHA1(6dfd2a885c0b1c9347abc4b204ade66551c4b404) ) ROM_REGION( 0x400, "proms", 0 ) - ROM_LOAD( "prom1.u54", 0x0000, 0x0100, CRC(c324835e) SHA1(cf6ffe38523badfda211d341410e93e647de87a9) ) + ROM_LOAD( "prom1.u54", 0x0000, 0x0100, CRC(c324835e) SHA1(cf6ffe38523badfda211d341410e93e647de87a9) ) // == ic52 video timing prom from vigilante ROM_LOAD( "prom4.u79", 0x0100, 0x0100, CRC(e6506ef4) SHA1(079841da7640b14d94aaaeb572bf018932b58293) ) ROM_LOAD( "prom3.u88", 0x0200, 0x0100, CRC(b43d094f) SHA1(2bed4892d8a91d7faac5a07bf858d9294eb30606) ) ROM_LOAD( "prom2.u99", 0x0300, 0x0100, CRC(e0aa8869) SHA1(ac8bdfeba69420ba56ec561bf3d0f1229d02cea2) ) -- cgit v1.2.3-70-g09d2 From 8e30db1e7441983971abaf8fa8c04a8c5475c6b0 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 9 Feb 2016 18:04:52 +0000 Subject: making a start on this '96 Flag Rally driver dumped thanks to Nosunosu, ShouTime --- scripts/target/mame/arcade.lua | 1 + src/mame/arcade.lst | 1 + src/mame/drivers/flagrall.cpp | 225 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 227 insertions(+) create mode 100644 src/mame/drivers/flagrall.cpp diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index d4bc8eb26b1..e41da449e2e 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -4286,6 +4286,7 @@ files { MAME_DIR .. "src/mame/drivers/extrema.cpp", MAME_DIR .. "src/mame/drivers/fastinvaders.cpp", MAME_DIR .. "src/mame/drivers/fireball.cpp", + MAME_DIR .. "src/mame/drivers/flagrall.cpp", MAME_DIR .. "src/mame/drivers/flipjack.cpp", MAME_DIR .. "src/mame/drivers/flower.cpp", MAME_DIR .. "src/mame/includes/flower.h", diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 3ff82a8e40d..b7e3c2ad46b 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -10758,6 +10758,7 @@ coolpool // (c) 1992 Catalina Games 9ballsht3 // (c) 1993 E-Scape EnterMedia + "marketed by Bundra Games" 9ballshtc // (c) 1993 E-Scape EnterMedia + "marketed by Bundra Games" megaphx // (c) 1991 Dinamic / Inder +flagrall // ? gumbo // (c) 1994 Min Corp. mspuzzleg // (c) 1994 Min Corp. mspuzzle // (c) 1994 Min Corp. diff --git a/src/mame/drivers/flagrall.cpp b/src/mame/drivers/flagrall.cpp new file mode 100644 index 00000000000..2ac6bc7cab9 --- /dev/null +++ b/src/mame/drivers/flagrall.cpp @@ -0,0 +1,225 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "sound/okim6295.h" + +class flagrall_state : public driver_device +{ +public: + flagrall_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + // m_bg_videoram(*this, "bg_videoram"), + // m_fg_videoram(*this, "fg_videoram"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode") { } + + /* memory pointers */ +// required_shared_ptr m_bg_videoram; +// required_shared_ptr m_fg_videoram; + + /* video-related */ +// tilemap_t *m_bg_tilemap; +// tilemap_t *m_fg_tilemap; +// DECLARE_WRITE16_MEMBER(flagrall_bg_videoram_w); +// DECLARE_WRITE16_MEMBER(flagrall_fg_videoram_w); +// TILE_GET_INFO_MEMBER(get_flagrall_bg_tile_info); +// TILE_GET_INFO_MEMBER(get_flagrall_fg_tile_info); + virtual void video_start() override; + UINT32 screen_update_flagrall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; + required_device m_gfxdecode; +}; + + +/* +WRITE16_MEMBER(flagrall_state::flagrall_bg_videoram_w) +{ + COMBINE_DATA(&m_bg_videoram[offset]); + m_bg_tilemap->mark_tile_dirty(offset); +} + +TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_bg_tile_info) +{ + int tileno = m_bg_videoram[tile_index]; + SET_TILE_INFO_MEMBER(0, tileno, 0, 0); +} + + +WRITE16_MEMBER(flagrall_state::flagrall_fg_videoram_w) +{ + COMBINE_DATA(&m_fg_videoram[offset]); + m_fg_tilemap->mark_tile_dirty(offset); +} + +TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_fg_tile_info) +{ + int tileno = m_fg_videoram[tile_index]; + SET_TILE_INFO_MEMBER(1, tileno, 1, 0); +} +*/ + +void flagrall_state::video_start() +{ +// m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); +// m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_fg_tile_info),this), TILEMAP_SCAN_ROWS, 4, 4, 128, 64); +// m_fg_tilemap->set_transparent_pen(0xff); +} + +UINT32 flagrall_state::screen_update_flagrall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ +// m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); +// m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + + +static ADDRESS_MAP_START( flagrall_map, AS_PROGRAM, 16, flagrall_state ) + AM_RANGE(0x000000, 0x07ffff) AM_ROM + AM_RANGE(0x100000, 0x10ffff) AM_RAM // main ram + +// AM_RANGE(0x200000, 0x2003ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // clears 0x200 - 0x3ff on startup, but writes 00 values to the other half at times? + AM_RANGE(0x240000, 0x240fff) AM_RAM // ?? + AM_RANGE(0x280000, 0x280fff) AM_RAM // ?? + AM_RANGE(0x2c0000, 0x2c07ff) AM_RAM // ?? + + AM_RANGE(0x340000, 0x340001) AM_WRITENOP // ?? + AM_RANGE(0x380000, 0x380001) AM_WRITENOP // ?? + AM_RANGE(0x3c0000, 0x3c0001) AM_WRITENOP // ?? + + AM_RANGE(0x400000, 0x400001) AM_READ_PORT("DSW") + AM_RANGE(0x440000, 0x440001) AM_READ_PORT("DSW") + AM_RANGE(0x4c0000, 0x4c0001) AM_READ_PORT("DSW") + + AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP // ?? oki? +ADDRESS_MAP_END + + +static INPUT_PORTS_START( flagrall ) + PORT_START("DSW") + PORT_DIPNAME( 0x0001, 0x0001, "0" ) + PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) +INPUT_PORTS_END + +static const gfx_layout flagrall_layout = +{ + 16,16, + RGN_FRAC(1,1), + 8, + { 0,1,2,3,4,5,6,7 }, + { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, + { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 }, + 16*128, +}; + + + +static GFXDECODE_START( flagrall ) + GFXDECODE_ENTRY( "gfx1", 0, flagrall_layout, 0x0, 2 ) /* bg tiles */ + GFXDECODE_ENTRY( "gfx2", 0, flagrall_layout, 0x0, 2 ) /* fg tiles */ +GFXDECODE_END + + +static MACHINE_CONFIG_START( flagrall, flagrall_state ) + + MCFG_CPU_ADD("maincpu", M68000, 16000000 ) // ? + MCFG_CPU_PROGRAM_MAP(flagrall_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", flagrall_state, irq4_line_hold) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", flagrall) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(64*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(8*8, 48*8-1, 2*8, 30*8-1) + MCFG_SCREEN_UPDATE_DRIVER(flagrall_state, screen_update_flagrall) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 0x200) + MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_OKIM6295_ADD("oki", 16000000/16, OKIM6295_PIN7_HIGH) // not verified + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.47) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.47) +MACHINE_CONFIG_END + + +ROM_START( flagrall ) + ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "11_u34.bin", 0x00001, 0x40000, CRC(24dd439d) SHA1(88857ad5ed69f29de86702dcc746d35b69b3b93d) ) + ROM_LOAD16_BYTE( "12_u35.bin", 0x00000, 0x40000, CRC(373b71a5) SHA1(be9ab93129e2ffd9bfe296c341dbdf47f1949ac7) ) + + ROM_REGION( 0x100000, "oki", 0 ) /* Samples */ + // only one OKI, both roms have sample tables, presumably banked + ROM_LOAD( "13_su4.bin", 0x00000, 0x80000, CRC(7b0630b3) SHA1(c615e6630ffd12c122762751c25c249393bf7abd) ) + ROM_LOAD( "14_su6.bin", 0x80000, 0x40000, CRC(593b038f) SHA1(b00dcf321fe541ee52c34b79e69c44f3d7a9cd7c) ) + + ROM_REGION( 0x300000, "gfx1", 0 ) + ROM_LOAD32_BYTE( "1_u5.bin", 0x000000, 0x080000, CRC(9377704b) SHA1(ac516a8ba6d1a70086469504c2a46d47a1f4560b) ) + ROM_LOAD32_BYTE( "5_u6.bin", 0x000001, 0x080000, CRC(1ac0bd0c) SHA1(ab71bb84e61f5c7168601695f332a8d4a30d9948) ) + ROM_LOAD32_BYTE( "2_u7.bin", 0x000002, 0x080000, CRC(5f6db2b3) SHA1(84caa019d3b75be30a14d19ccc2f28e5e94028bd) ) + ROM_LOAD32_BYTE( "6_u8.bin", 0x000003, 0x080000, CRC(79e4643c) SHA1(274f2741f39c63e32f49c6a1a72ded1263bdcdaa) ) + + ROM_LOAD32_BYTE( "3_u58.bin", 0x200000, 0x040000, CRC(c913df7d) SHA1(96e89ecb9e5f4d596d71d7ba35af7b2af4670342) ) + ROM_LOAD32_BYTE( "4_u59.bin", 0x200001, 0x040000, CRC(cb192384) SHA1(329b4c1a4dc388d9f4ce063f9a54cbf3b967682a) ) + ROM_LOAD32_BYTE( "7_u60.bin", 0x200002, 0x040000, CRC(f187a7bf) SHA1(f4ce9ac9fe376250fe426de6ee404fc7841ef08a) ) + ROM_LOAD32_BYTE( "8_u61.bin", 0x200003, 0x040000, CRC(b73fa441) SHA1(a5a3533563070c870276ead5e2f9cb9aaba303cc)) + + ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_LOAD( "9_u103.bin", 0x00000, 0x80000, CRC(01e6d654) SHA1(821d61a5b16f5cb76e2a805c8504db1ef38c3a48) ) + ROM_LOAD( "10_u102.bin", 0x80000, 0x80000, CRC(b1fd3279) SHA1(4a75581e13d43bef441ce81eae518c2f6bc1d5f8) ) +ROM_END + + +GAME( 199?, flagrall, 0, flagrall, flagrall, driver_device, 0, ROT0, "", "Flag Rally '96", MACHINE_SUPPORTS_SAVE ) // or '96 Flag Rally? + -- cgit v1.2.3-70-g09d2 From b817606f083e5a981d9e786eb4c3de9b349569fc Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 9 Feb 2016 18:36:15 +0000 Subject: correct palette format, display a few things, this however is NOT a tilemap (nw) --- src/mame/drivers/flagrall.cpp | 190 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 171 insertions(+), 19 deletions(-) diff --git a/src/mame/drivers/flagrall.cpp b/src/mame/drivers/flagrall.cpp index 2ac6bc7cab9..e940bbe374a 100644 --- a/src/mame/drivers/flagrall.cpp +++ b/src/mame/drivers/flagrall.cpp @@ -10,21 +10,21 @@ class flagrall_state : public driver_device public: flagrall_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - // m_bg_videoram(*this, "bg_videoram"), + m_bg_videoram(*this, "bg_videoram"), // m_fg_videoram(*this, "fg_videoram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode") { } /* memory pointers */ -// required_shared_ptr m_bg_videoram; + required_shared_ptr m_bg_videoram; // required_shared_ptr m_fg_videoram; /* video-related */ -// tilemap_t *m_bg_tilemap; + tilemap_t *m_bg_tilemap; // tilemap_t *m_fg_tilemap; -// DECLARE_WRITE16_MEMBER(flagrall_bg_videoram_w); + DECLARE_WRITE16_MEMBER(flagrall_bg_videoram_w); // DECLARE_WRITE16_MEMBER(flagrall_fg_videoram_w); -// TILE_GET_INFO_MEMBER(get_flagrall_bg_tile_info); + TILE_GET_INFO_MEMBER(get_flagrall_bg_tile_info); // TILE_GET_INFO_MEMBER(get_flagrall_fg_tile_info); virtual void video_start() override; UINT32 screen_update_flagrall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -33,7 +33,7 @@ public: }; -/* + WRITE16_MEMBER(flagrall_state::flagrall_bg_videoram_w) { COMBINE_DATA(&m_bg_videoram[offset]); @@ -42,11 +42,11 @@ WRITE16_MEMBER(flagrall_state::flagrall_bg_videoram_w) TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_bg_tile_info) { - int tileno = m_bg_videoram[tile_index]; - SET_TILE_INFO_MEMBER(0, tileno, 0, 0); + int tileno = m_bg_videoram[tile_index]/2; + SET_TILE_INFO_MEMBER(0, tileno, 1, 0); } - +/* WRITE16_MEMBER(flagrall_state::flagrall_fg_videoram_w) { COMBINE_DATA(&m_fg_videoram[offset]); @@ -62,14 +62,15 @@ TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_fg_tile_info) void flagrall_state::video_start() { -// m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + // doesn't actually seem to be be a tilemap, there is other data at the end of it ? sprite strips I guess + m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 20, 64); // m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_fg_tile_info),this), TILEMAP_SCAN_ROWS, 4, 4, 128, 64); // m_fg_tilemap->set_transparent_pen(0xff); } UINT32 flagrall_state::screen_update_flagrall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { -// m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); // m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); return 0; } @@ -79,25 +80,26 @@ static ADDRESS_MAP_START( flagrall_map, AS_PROGRAM, 16, flagrall_state ) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x100000, 0x10ffff) AM_RAM // main ram -// AM_RANGE(0x200000, 0x2003ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // clears 0x200 - 0x3ff on startup, but writes 00 values to the other half at times? + AM_RANGE(0x200000, 0x2003ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // clears 0x200 - 0x3ff on startup, but writes 00 values to the other half at times? AM_RANGE(0x240000, 0x240fff) AM_RAM // ?? - AM_RANGE(0x280000, 0x280fff) AM_RAM // ?? + AM_RANGE(0x280000, 0x280fff) AM_RAM_WRITE(flagrall_bg_videoram_w) AM_SHARE("bg_videoram") AM_RANGE(0x2c0000, 0x2c07ff) AM_RAM // ?? AM_RANGE(0x340000, 0x340001) AM_WRITENOP // ?? AM_RANGE(0x380000, 0x380001) AM_WRITENOP // ?? AM_RANGE(0x3c0000, 0x3c0001) AM_WRITENOP // ?? - AM_RANGE(0x400000, 0x400001) AM_READ_PORT("DSW") - AM_RANGE(0x440000, 0x440001) AM_READ_PORT("DSW") - AM_RANGE(0x4c0000, 0x4c0001) AM_READ_PORT("DSW") + AM_RANGE(0x400000, 0x400001) AM_READ_PORT("IN0") + AM_RANGE(0x440000, 0x440001) AM_READ_PORT("IN1") + AM_RANGE(0x480000, 0x480001) AM_READ_PORT("IN2") + AM_RANGE(0x4c0000, 0x4c0001) AM_READ_PORT("IN3") AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP // ?? oki? ADDRESS_MAP_END static INPUT_PORTS_START( flagrall ) - PORT_START("DSW") + PORT_START("IN0") PORT_DIPNAME( 0x0001, 0x0001, "0" ) PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) @@ -146,6 +148,156 @@ static INPUT_PORTS_START( flagrall ) PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + + PORT_START("IN1") + PORT_DIPNAME( 0x0001, 0x0001, "1" ) + PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + + PORT_START("IN2") + PORT_DIPNAME( 0x0001, 0x0001, "2" ) + PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0080, 0x0080, "Test" ) // some kind of test mode toggle, or at least 'show girls' might be service switch + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + + PORT_START("IN3") + PORT_DIPNAME( 0x0001, 0x0001, "3" ) + PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) INPUT_PORTS_END static const gfx_layout flagrall_layout = @@ -179,12 +331,12 @@ static MACHINE_CONFIG_START( flagrall, flagrall_state ) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(8*8, 48*8-1, 2*8, 30*8-1) + MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(flagrall_state, screen_update_flagrall) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD("palette", 0x200) - MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) + MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") -- cgit v1.2.3-70-g09d2 From 13c13da643943cbaa862cd1abc4ee467664ce390 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 9 Feb 2016 19:07:43 +0000 Subject: this one is a tilemap tho, I think (nw) --- src/mame/drivers/flagrall.cpp | 105 +++++++++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 41 deletions(-) diff --git a/src/mame/drivers/flagrall.cpp b/src/mame/drivers/flagrall.cpp index e940bbe374a..f6f48935c4a 100644 --- a/src/mame/drivers/flagrall.cpp +++ b/src/mame/drivers/flagrall.cpp @@ -10,68 +10,91 @@ class flagrall_state : public driver_device public: flagrall_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_bg_videoram(*this, "bg_videoram"), - // m_fg_videoram(*this, "fg_videoram"), + m_spr_info(*this, "spr_info"), + m_spr_videoram(*this, "spr_videoram"), + m_bak_videoram(*this, "bak_videoram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode") { } /* memory pointers */ - required_shared_ptr m_bg_videoram; -// required_shared_ptr m_fg_videoram; + required_shared_ptr m_spr_info; + required_shared_ptr m_spr_videoram; + required_shared_ptr m_bak_videoram; /* video-related */ - tilemap_t *m_bg_tilemap; -// tilemap_t *m_fg_tilemap; - DECLARE_WRITE16_MEMBER(flagrall_bg_videoram_w); -// DECLARE_WRITE16_MEMBER(flagrall_fg_videoram_w); - TILE_GET_INFO_MEMBER(get_flagrall_bg_tile_info); -// TILE_GET_INFO_MEMBER(get_flagrall_fg_tile_info); + tilemap_t *m_spr_tilemap; + tilemap_t *m_bak_tilemap; + DECLARE_WRITE16_MEMBER(flagrall_spr_videoram_w); + DECLARE_WRITE16_MEMBER(flagrall_bak_videoram_w); + TILE_GET_INFO_MEMBER(get_flagrall_spr_tile_info); + TILE_GET_INFO_MEMBER(get_flagrall_bak_tile_info); virtual void video_start() override; UINT32 screen_update_flagrall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device m_maincpu; required_device m_gfxdecode; + + DECLARE_WRITE16_MEMBER(flagrall_xscroll_w); + DECLARE_WRITE16_MEMBER(flagrall_yscroll_w); + + + UINT16 xscroll; + UINT16 yscroll; + }; -WRITE16_MEMBER(flagrall_state::flagrall_bg_videoram_w) +WRITE16_MEMBER(flagrall_state::flagrall_spr_videoram_w) { - COMBINE_DATA(&m_bg_videoram[offset]); - m_bg_tilemap->mark_tile_dirty(offset); + COMBINE_DATA(&m_spr_videoram[offset]); + m_spr_tilemap->mark_tile_dirty(offset); } -TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_bg_tile_info) +TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_spr_tile_info) { - int tileno = m_bg_videoram[tile_index]/2; + int tileno = m_spr_videoram[tile_index]/2; SET_TILE_INFO_MEMBER(0, tileno, 1, 0); } -/* -WRITE16_MEMBER(flagrall_state::flagrall_fg_videoram_w) +WRITE16_MEMBER(flagrall_state::flagrall_xscroll_w) +{ + COMBINE_DATA(&xscroll); + m_bak_tilemap->set_scrollx(0, xscroll-64); +} + +WRITE16_MEMBER(flagrall_state::flagrall_yscroll_w) { - COMBINE_DATA(&m_fg_videoram[offset]); - m_fg_tilemap->mark_tile_dirty(offset); + COMBINE_DATA(&yscroll); + m_bak_tilemap->set_scrolly(0, yscroll); } -TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_fg_tile_info) +WRITE16_MEMBER(flagrall_state::flagrall_bak_videoram_w) { - int tileno = m_fg_videoram[tile_index]; - SET_TILE_INFO_MEMBER(1, tileno, 1, 0); + COMBINE_DATA(&m_bak_videoram[offset]); + m_bak_tilemap->mark_tile_dirty(offset); } -*/ + +TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_bak_tile_info) +{ + int tileno = m_bak_videoram[tile_index]; + SET_TILE_INFO_MEMBER(1, tileno, 0, 0); +} + void flagrall_state::video_start() { // doesn't actually seem to be be a tilemap, there is other data at the end of it ? sprite strips I guess - m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 20, 64); -// m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_fg_tile_info),this), TILEMAP_SCAN_ROWS, 4, 4, 128, 64); -// m_fg_tilemap->set_transparent_pen(0xff); + m_spr_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_spr_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 20, 64); + m_spr_tilemap->set_transparent_pen(0x00); + + m_bak_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_bak_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); } UINT32 flagrall_state::screen_update_flagrall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); -// m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + m_bak_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + m_spr_tilemap->draw(screen, bitmap, cliprect, 0, 0); return 0; } @@ -81,20 +104,20 @@ static ADDRESS_MAP_START( flagrall_map, AS_PROGRAM, 16, flagrall_state ) AM_RANGE(0x100000, 0x10ffff) AM_RAM // main ram AM_RANGE(0x200000, 0x2003ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // clears 0x200 - 0x3ff on startup, but writes 00 values to the other half at times? - AM_RANGE(0x240000, 0x240fff) AM_RAM // ?? - AM_RANGE(0x280000, 0x280fff) AM_RAM_WRITE(flagrall_bg_videoram_w) AM_SHARE("bg_videoram") - AM_RANGE(0x2c0000, 0x2c07ff) AM_RAM // ?? + AM_RANGE(0x240000, 0x240fff) AM_RAM AM_SHARE("spr_info") + AM_RANGE(0x280000, 0x280fff) AM_RAM_WRITE(flagrall_spr_videoram_w) AM_SHARE("spr_videoram") + AM_RANGE(0x2c0000, 0x2c07ff) AM_RAM_WRITE(flagrall_bak_videoram_w) AM_SHARE("bak_videoram") - AM_RANGE(0x340000, 0x340001) AM_WRITENOP // ?? - AM_RANGE(0x380000, 0x380001) AM_WRITENOP // ?? - AM_RANGE(0x3c0000, 0x3c0001) AM_WRITENOP // ?? + AM_RANGE(0x340000, 0x340001) AM_WRITE(flagrall_xscroll_w) + AM_RANGE(0x380000, 0x380001) AM_WRITE(flagrall_yscroll_w) +// AM_RANGE(0x3c0000, 0x3c0001) AM_WRITENOP // ?? AM_RANGE(0x400000, 0x400001) AM_READ_PORT("IN0") AM_RANGE(0x440000, 0x440001) AM_READ_PORT("IN1") AM_RANGE(0x480000, 0x480001) AM_READ_PORT("IN2") AM_RANGE(0x4c0000, 0x4c0001) AM_READ_PORT("IN3") - AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP // ?? oki? +// AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP // ?? oki? ADDRESS_MAP_END @@ -314,8 +337,8 @@ static const gfx_layout flagrall_layout = static GFXDECODE_START( flagrall ) - GFXDECODE_ENTRY( "gfx1", 0, flagrall_layout, 0x0, 2 ) /* bg tiles */ - GFXDECODE_ENTRY( "gfx2", 0, flagrall_layout, 0x0, 2 ) /* fg tiles */ + GFXDECODE_ENTRY( "sprites", 0, flagrall_layout, 0x0, 2 ) /* sprite tiles */ + GFXDECODE_ENTRY( "tiles", 0, flagrall_layout, 0x0, 2 ) /* bg tiles */ GFXDECODE_END @@ -356,7 +379,7 @@ ROM_START( flagrall ) ROM_LOAD( "13_su4.bin", 0x00000, 0x80000, CRC(7b0630b3) SHA1(c615e6630ffd12c122762751c25c249393bf7abd) ) ROM_LOAD( "14_su6.bin", 0x80000, 0x40000, CRC(593b038f) SHA1(b00dcf321fe541ee52c34b79e69c44f3d7a9cd7c) ) - ROM_REGION( 0x300000, "gfx1", 0 ) + ROM_REGION( 0x300000, "sprites", 0 ) ROM_LOAD32_BYTE( "1_u5.bin", 0x000000, 0x080000, CRC(9377704b) SHA1(ac516a8ba6d1a70086469504c2a46d47a1f4560b) ) ROM_LOAD32_BYTE( "5_u6.bin", 0x000001, 0x080000, CRC(1ac0bd0c) SHA1(ab71bb84e61f5c7168601695f332a8d4a30d9948) ) ROM_LOAD32_BYTE( "2_u7.bin", 0x000002, 0x080000, CRC(5f6db2b3) SHA1(84caa019d3b75be30a14d19ccc2f28e5e94028bd) ) @@ -367,9 +390,9 @@ ROM_START( flagrall ) ROM_LOAD32_BYTE( "7_u60.bin", 0x200002, 0x040000, CRC(f187a7bf) SHA1(f4ce9ac9fe376250fe426de6ee404fc7841ef08a) ) ROM_LOAD32_BYTE( "8_u61.bin", 0x200003, 0x040000, CRC(b73fa441) SHA1(a5a3533563070c870276ead5e2f9cb9aaba303cc)) - ROM_REGION( 0x100000, "gfx2", 0 ) - ROM_LOAD( "9_u103.bin", 0x00000, 0x80000, CRC(01e6d654) SHA1(821d61a5b16f5cb76e2a805c8504db1ef38c3a48) ) - ROM_LOAD( "10_u102.bin", 0x80000, 0x80000, CRC(b1fd3279) SHA1(4a75581e13d43bef441ce81eae518c2f6bc1d5f8) ) + ROM_REGION( 0x100000, "tiles", 0 ) + ROM_LOAD( "10_u102.bin", 0x00000, 0x80000, CRC(b1fd3279) SHA1(4a75581e13d43bef441ce81eae518c2f6bc1d5f8) ) + ROM_LOAD( "9_u103.bin", 0x80000, 0x80000, CRC(01e6d654) SHA1(821d61a5b16f5cb76e2a805c8504db1ef38c3a48) ) ROM_END -- cgit v1.2.3-70-g09d2 From af839de735068b56f572610a6a2d3e998888014b Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 9 Feb 2016 19:21:47 +0000 Subject: misc (nw) --- src/mame/drivers/flagrall.cpp | 84 +++++++++++-------------------------------- 1 file changed, 21 insertions(+), 63 deletions(-) diff --git a/src/mame/drivers/flagrall.cpp b/src/mame/drivers/flagrall.cpp index f6f48935c4a..b393ca9ffd1 100644 --- a/src/mame/drivers/flagrall.cpp +++ b/src/mame/drivers/flagrall.cpp @@ -35,11 +35,13 @@ public: DECLARE_WRITE16_MEMBER(flagrall_xscroll_w); DECLARE_WRITE16_MEMBER(flagrall_yscroll_w); + DECLARE_WRITE16_MEMBER(flagrall_ctrl_w); + UINT16 xscroll; UINT16 yscroll; - + UINT16 ctrl; }; @@ -59,7 +61,7 @@ TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_spr_tile_info) WRITE16_MEMBER(flagrall_state::flagrall_xscroll_w) { COMBINE_DATA(&xscroll); - m_bak_tilemap->set_scrollx(0, xscroll-64); + m_bak_tilemap->set_scrollx(0, xscroll); } WRITE16_MEMBER(flagrall_state::flagrall_yscroll_w) @@ -68,6 +70,16 @@ WRITE16_MEMBER(flagrall_state::flagrall_yscroll_w) m_bak_tilemap->set_scrolly(0, yscroll); } +WRITE16_MEMBER(flagrall_state::flagrall_ctrl_w) +{ + COMBINE_DATA(&ctrl); + + popmessage("control write %04x", ctrl); +} + + + + WRITE16_MEMBER(flagrall_state::flagrall_bak_videoram_w) { COMBINE_DATA(&m_bak_videoram[offset]); @@ -110,14 +122,14 @@ static ADDRESS_MAP_START( flagrall_map, AS_PROGRAM, 16, flagrall_state ) AM_RANGE(0x340000, 0x340001) AM_WRITE(flagrall_xscroll_w) AM_RANGE(0x380000, 0x380001) AM_WRITE(flagrall_yscroll_w) -// AM_RANGE(0x3c0000, 0x3c0001) AM_WRITENOP // ?? + AM_RANGE(0x3c0000, 0x3c0001) AM_WRITE(flagrall_ctrl_w) AM_RANGE(0x400000, 0x400001) AM_READ_PORT("IN0") AM_RANGE(0x440000, 0x440001) AM_READ_PORT("IN1") AM_RANGE(0x480000, 0x480001) AM_READ_PORT("IN2") - AM_RANGE(0x4c0000, 0x4c0001) AM_READ_PORT("IN3") +// AM_RANGE(0x4c0000, 0x4c0001) AM_READ_PORT("IN3") -// AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP // ?? oki? + AM_RANGE(0x4c0000, 0x4c0001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) ADDRESS_MAP_END @@ -173,13 +185,9 @@ static INPUT_PORTS_START( flagrall ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_START("IN1") - PORT_DIPNAME( 0x0001, 0x0001, "1" ) - PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_DIPNAME( 0x0004, 0x0004, "1" ) PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) @@ -271,56 +279,6 @@ static INPUT_PORTS_START( flagrall ) PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - - PORT_START("IN3") - PORT_DIPNAME( 0x0001, 0x0001, "3" ) - PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) INPUT_PORTS_END static const gfx_layout flagrall_layout = @@ -396,5 +354,5 @@ ROM_START( flagrall ) ROM_END -GAME( 199?, flagrall, 0, flagrall, flagrall, driver_device, 0, ROT0, "", "Flag Rally '96", MACHINE_SUPPORTS_SAVE ) // or '96 Flag Rally? +GAME( 199?, flagrall, 0, flagrall, flagrall, driver_device, 0, ROT0, "", "Flag Rally '96", MACHINE_NOT_WORKING ) // or '96 Flag Rally? -- cgit v1.2.3-70-g09d2 From e8d0922fb1619a9e748597cd68fd9aa71d08ba64 Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 9 Feb 2016 20:14:40 +0100 Subject: Fixed DASM for the new opcodes, nw --- src/devices/cpu/m6800/6800dasm.cpp | 16 ++++++++++++---- src/devices/cpu/m6800/6800ops.inc | 20 ++++++-------------- src/devices/cpu/m6800/6800tbl.inc | 6 +++--- src/devices/cpu/m6800/m6800.h | 5 ++--- src/mame/drivers/nightgal.cpp | 8 -------- 5 files changed, 23 insertions(+), 32 deletions(-) diff --git a/src/devices/cpu/m6800/6800dasm.cpp b/src/devices/cpu/m6800/6800dasm.cpp index 49f908013cd..2e94ef3b62d 100644 --- a/src/devices/cpu/m6800/6800dasm.cpp +++ b/src/devices/cpu/m6800/6800dasm.cpp @@ -52,7 +52,8 @@ enum op_names { rts, sba, sbca, sbcb, sec, sev, sta, stb, _std, sei, sts, stx, suba, subb, subd, swi, wai, tab, tap, tba, tim, tpa, tst, tsta, - tstb, tsx, txs, asx1, asx2, xgdx, addx, adcx + tstb, tsx, txs, asx1, asx2, xgdx, addx, adcx, + bitx }; static const char *const op_name_str[] = { @@ -71,7 +72,8 @@ static const char *const op_name_str[] = { "rts", "sba", "sbca", "sbcb", "sec", "sev", "sta", "stb", "std", "sei", "sts", "stx", "suba", "subb", "subd", "swi", "wai", "tab", "tap", "tba", "tim", "tpa", "tst", "tsta", - "tstb", "tsx", "txs", "asx1", "asx2", "xgdx", "addx", "adcx" + "tstb", "tsx", "txs", "asx1", "asx2", "xgdx", "addx", "adcx", + "bitx" }; /* @@ -82,7 +84,7 @@ static const char *const op_name_str[] = { * 2 invalid opcode for 1:6800/6802/6808, 2:6801/6803, 4:HD63701 */ -static const UINT8 table[0x102][3] = { +static const UINT8 table[0x104][3] = { {ill, inh,7},{nop, inh,0},{ill, inh,7},{ill, inh,7},/* 00 */ {lsrd,inh,1},{asld,inh,1},{tap, inh,0},{tpa, inh,0}, {inx, inh,0},{dex, inh,0},{clv, inh,0},{sev, inh,0}, @@ -151,7 +153,11 @@ static const UINT8 table[0x102][3] = { /* extra instruction $fc for NSC-8105 */ {addx,ext,0}, /* extra instruction $ec for NSC-8105 */ - {adcx,imb,0} + {adcx,imb,0}, + /* extra instruction $bb for NSC-8105 */ + {bitx,imx,0}, + /* extra instruction $b2 for NSC-8105 */ + {stx,imx,0} }; /* some macros to keep things short */ @@ -188,6 +194,8 @@ static unsigned Dasm680x (int subtype, char *buf, unsigned pc, const UINT8 *opro /* and check for extra instruction */ if (code == 0xfc) code = 0x0100; if (code == 0xec) code = 0x0101; + if (code == 0x7b) code = 0x0102; + if (code == 0x71) code = 0x0103; } opcode = table[code][0]; diff --git a/src/devices/cpu/m6800/6800ops.inc b/src/devices/cpu/m6800/6800ops.inc index 4e92e401be7..078529d16ab 100644 --- a/src/devices/cpu/m6800/6800ops.inc +++ b/src/devices/cpu/m6800/6800ops.inc @@ -2285,17 +2285,18 @@ OP_HANDLER( stx_ex ) } /* NSC8105 specific, guessed opcodes (tested by Night Gal Summer) */ -// $bb - load A from [X + $0] -OP_HANDLER( ldax_imm ) +// $bb - $mask & [X + $disp8] +OP_HANDLER( btst_ix ) { UINT8 val; - {EA=X+((M_RDOP_ARG(PCD)<<8) | M_RDOP_ARG((PCD+1)&0xffff));PC+=2;} - val = RM(EAD); + UINT8 mask = M_RDOP_ARG(PCD); + {EA=X+(M_RDOP_ARG(PCD+1));PC+=2;} + val = RM(EAD) & mask; CLR_NZVC; SET_NZ8(val); } // $b2 - assuming correct, store first byte to (X + $disp8) -OP_HANDLER( nsc_unk ) +OP_HANDLER( stx_nsc ) { IMM8; UINT8 val = RM(EAD); @@ -2304,13 +2305,4 @@ OP_HANDLER( nsc_unk ) CLR_NZV; SET_NZ8(val); WM(EAD,val); -} - -// $00 - store A to [X + $0] -OP_HANDLER( stax_imm ) -{ - CLR_NZV; - SET_NZ8(A); - EA=X; - WM(EAD,A); } \ No newline at end of file diff --git a/src/devices/cpu/m6800/6800tbl.inc b/src/devices/cpu/m6800/6800tbl.inc index 266ddb2a55c..10515e54bdc 100644 --- a/src/devices/cpu/m6800/6800tbl.inc +++ b/src/devices/cpu/m6800/6800tbl.inc @@ -106,7 +106,7 @@ const m6800_cpu_device::op_func m6800_cpu_device::hd63701_insn[0x100] = { const m6800_cpu_device::op_func m6800_cpu_device::nsc8105_insn[0x100] = { // 0 -&m6800_cpu_device::stax_imm,&m6800_cpu_device::illegal,&m6800_cpu_device::nop, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::tap, &m6800_cpu_device::illegal,&m6800_cpu_device::tpa, +&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::nop, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::tap, &m6800_cpu_device::illegal,&m6800_cpu_device::tpa, // 8 &m6800_cpu_device::inx, &m6800_cpu_device::clv, &m6800_cpu_device::dex, &m6800_cpu_device::sev, &m6800_cpu_device::clc, &m6800_cpu_device::cli, &m6800_cpu_device::sec, &m6800_cpu_device::sei, // 10 @@ -150,9 +150,9 @@ const m6800_cpu_device::op_func m6800_cpu_device::nsc8105_insn[0x100] = { // a8 &m6800_cpu_device::asl_ix, &m6800_cpu_device::dec_ix, &m6800_cpu_device::rol_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::inc_ix, &m6800_cpu_device::jmp_ix, &m6800_cpu_device::tst_ix, &m6800_cpu_device::clr_ix, // b0 -&m6800_cpu_device::neg_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::nsc_unk,&m6800_cpu_device::com_ex, &m6800_cpu_device::lsr_ex, &m6800_cpu_device::ror_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::asr_ex, +&m6800_cpu_device::neg_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::stx_nsc,&m6800_cpu_device::com_ex, &m6800_cpu_device::lsr_ex, &m6800_cpu_device::ror_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::asr_ex, // b8 -&m6800_cpu_device::asl_ex, &m6800_cpu_device::dec_ex, &m6800_cpu_device::rol_ex, &m6800_cpu_device::ldax_imm,&m6800_cpu_device::inc_ex, &m6800_cpu_device::jmp_ex, &m6800_cpu_device::tst_ex, &m6800_cpu_device::clr_ex, +&m6800_cpu_device::asl_ex, &m6800_cpu_device::dec_ex, &m6800_cpu_device::rol_ex, &m6800_cpu_device::btst_ix,&m6800_cpu_device::inc_ex, &m6800_cpu_device::jmp_ex, &m6800_cpu_device::tst_ex, &m6800_cpu_device::clr_ex, &m6800_cpu_device::subb_im,&m6800_cpu_device::sbcb_im,&m6800_cpu_device::cmpb_im,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_im,&m6800_cpu_device::ldb_im, &m6800_cpu_device::bitb_im,&m6800_cpu_device::stb_im, &m6800_cpu_device::eorb_im,&m6800_cpu_device::orb_im, &m6800_cpu_device::adcb_im,&m6800_cpu_device::addb_im,&m6800_cpu_device::illegal,&m6800_cpu_device::ldx_im, &m6800_cpu_device::illegal,&m6800_cpu_device::stx_im, &m6800_cpu_device::subb_di,&m6800_cpu_device::sbcb_di,&m6800_cpu_device::cmpb_di,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_di,&m6800_cpu_device::ldb_di, &m6800_cpu_device::bitb_di,&m6800_cpu_device::stb_di, diff --git a/src/devices/cpu/m6800/m6800.h b/src/devices/cpu/m6800/m6800.h index 6ddffe64242..82696a6ee43 100644 --- a/src/devices/cpu/m6800/m6800.h +++ b/src/devices/cpu/m6800/m6800.h @@ -426,9 +426,8 @@ protected: void cpx_im(); void cpx_ix(); void trap(); - void ldax_imm(); - void stax_imm(); - void nsc_unk(); + void btst_ix(); + void stx_nsc(); }; diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index d11900aa822..736059fbc05 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -87,7 +87,6 @@ public: DECLARE_DRIVER_INIT(ngalsumr); DECLARE_DRIVER_INIT(royalqn); DECLARE_WRITE8_MEMBER(ngalsumr_unk_w); - DECLARE_READ8_MEMBER(ngalsumr_color_r); virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; @@ -1099,17 +1098,10 @@ WRITE8_MEMBER(nightgal_state::ngalsumr_unk_w) //m_z80_latch = data; } -// check with the unknown opcode, maybe it actually just masks with first parameter and second one is displacement byte offset? -READ8_MEMBER(nightgal_state::ngalsumr_color_r) -{ - return (m_comms_ram[offset] & 0x80); -} - DRIVER_INIT_MEMBER(nightgal_state,ngalsumr) { m_maincpu->space(AS_PROGRAM).install_write_handler(0x6000, 0x6000, write8_delegate(FUNC(nightgal_state::ngalsumr_unk_w), this) ); // 0x6003 some kind of f/f state - m_subcpu->space(AS_PROGRAM).install_read_handler(0x9000, 0x903f, read8_delegate(FUNC(nightgal_state::ngalsumr_color_r),this) ); } /* Type 1 HW */ -- cgit v1.2.3-70-g09d2 From 8dbafe19ea326d26e9363def492d718fe9746b2f Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 9 Feb 2016 20:23:17 +0100 Subject: Fixed silly left-over in nightgal.cpp, improves Night Gal Summer at very least --- src/devices/video/jangou_blitter.cpp | 6 ++++++ src/devices/video/jangou_blitter.h | 1 + src/mame/drivers/nightgal.cpp | 7 +++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index 07953576a45..8b0ff953ff8 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -166,3 +166,9 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_vregs_w) m_pen_data[offset] = data & 0xf; } +WRITE8_MEMBER( jangou_blitter_device::blitter_bltflip_w) +{ + // TODO: this flips gfx nibbles. + +} + diff --git a/src/devices/video/jangou_blitter.h b/src/devices/video/jangou_blitter.h index a8a4934a475..c0c5dff30ca 100644 --- a/src/devices/video/jangou_blitter.h +++ b/src/devices/video/jangou_blitter.h @@ -36,6 +36,7 @@ public: DECLARE_WRITE8_MEMBER( blitter_process_w ); DECLARE_WRITE8_MEMBER( blitter_alt_process_w ); DECLARE_WRITE8_MEMBER( blitter_vregs_w ); + DECLARE_WRITE8_MEMBER( blitter_bltflip_w ); UINT8 m_blit_buffer[256 * 256]; protected: diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 736059fbc05..ab3e73a941c 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -420,7 +420,7 @@ static ADDRESS_MAP_START( sexygal_nsc_map, AS_PROGRAM, 8, nightgal_state ) AM_RANGE(0x0081, 0x0083) AM_READ(royalqn_nsc_blit_r) AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_alt_process_w) AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_vregs_w) - AM_RANGE(0x00b0, 0x00b0) AM_WRITENOP // bltflip register + AM_RANGE(0x00b0, 0x00b0) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_bltflip_w) AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r, royalqn_comm_w) AM_SHARE("comms_ram") AM_RANGE(0xc000, 0xdfff) AM_MIRROR(0x2000) AM_ROM AM_REGION("subrom", 0) @@ -453,14 +453,13 @@ static ADDRESS_MAP_START( royalqn_io, AS_IO, 8, nightgal_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( royalqn_nsc_map, AS_PROGRAM, 8, nightgal_state ) - AM_RANGE(0x0000, 0x007f) AM_RAM AM_SHARE("xx") + AM_RANGE(0x0000, 0x007f) AM_RAM AM_RANGE(0x0080, 0x0080) AM_READ(blitter_status_r) AM_RANGE(0x0081, 0x0083) AM_READ(royalqn_nsc_blit_r) AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_process_w) AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_vregs_w) - AM_RANGE(0x00b0, 0x00b0) AM_WRITENOP // bltflip register + AM_RANGE(0x00b0, 0x00b0) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_bltflip_w) - AM_RANGE(0x1000, 0x1007) AM_RAM AM_SHARE("xx") AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r,royalqn_comm_w) AM_RANGE(0x4000, 0x4000) AM_NOP AM_RANGE(0x8000, 0x8000) AM_NOP //open bus or protection check -- cgit v1.2.3-70-g09d2 From 1fce2478870c61385ad28cc07c1541309d133757 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 9 Feb 2016 19:35:41 +0000 Subject: sprites (nw) --- src/mame/drivers/flagrall.cpp | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/mame/drivers/flagrall.cpp b/src/mame/drivers/flagrall.cpp index b393ca9ffd1..20950fc9615 100644 --- a/src/mame/drivers/flagrall.cpp +++ b/src/mame/drivers/flagrall.cpp @@ -22,12 +22,10 @@ public: required_shared_ptr m_bak_videoram; /* video-related */ - tilemap_t *m_spr_tilemap; tilemap_t *m_bak_tilemap; - DECLARE_WRITE16_MEMBER(flagrall_spr_videoram_w); DECLARE_WRITE16_MEMBER(flagrall_bak_videoram_w); - TILE_GET_INFO_MEMBER(get_flagrall_spr_tile_info); TILE_GET_INFO_MEMBER(get_flagrall_bak_tile_info); + virtual void video_start() override; UINT32 screen_update_flagrall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device m_maincpu; @@ -46,17 +44,6 @@ public: -WRITE16_MEMBER(flagrall_state::flagrall_spr_videoram_w) -{ - COMBINE_DATA(&m_spr_videoram[offset]); - m_spr_tilemap->mark_tile_dirty(offset); -} - -TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_spr_tile_info) -{ - int tileno = m_spr_videoram[tile_index]/2; - SET_TILE_INFO_MEMBER(0, tileno, 1, 0); -} WRITE16_MEMBER(flagrall_state::flagrall_xscroll_w) { @@ -95,10 +82,6 @@ TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_bak_tile_info) void flagrall_state::video_start() { - // doesn't actually seem to be be a tilemap, there is other data at the end of it ? sprite strips I guess - m_spr_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_spr_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 20, 64); - m_spr_tilemap->set_transparent_pen(0x00); - m_bak_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_bak_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); } @@ -106,7 +89,22 @@ UINT32 flagrall_state::screen_update_flagrall(screen_device &screen, bitmap_ind1 { m_bak_tilemap->draw(screen, bitmap, cliprect, 0, 0); - m_spr_tilemap->draw(screen, bitmap, cliprect, 0, 0); + for (int i = 0;i < 0x1000 / 2;i++) + { + gfx_element *gfx = m_gfxdecode->gfx(0); + + int sprx = m_spr_info[i] >> 8; + int spry = m_spr_info[i] & 0x00ff; + sprx |= (m_spr_videoram[i] & 0x01) << 8; + UINT16 sprtile = m_spr_videoram[i] >> 1; + + gfx->transpen(bitmap,cliprect,sprtile,1,0,0,sprx,spry,0); + gfx->transpen(bitmap,cliprect,sprtile,1,0,0,sprx,spry-0x100,0); + gfx->transpen(bitmap,cliprect,sprtile,1,0,0,sprx-0x200,spry,0); + gfx->transpen(bitmap,cliprect,sprtile,1,0,0,sprx-0x200,spry-0x100,0); + + } + return 0; } @@ -117,7 +115,7 @@ static ADDRESS_MAP_START( flagrall_map, AS_PROGRAM, 16, flagrall_state ) AM_RANGE(0x200000, 0x2003ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // clears 0x200 - 0x3ff on startup, but writes 00 values to the other half at times? AM_RANGE(0x240000, 0x240fff) AM_RAM AM_SHARE("spr_info") - AM_RANGE(0x280000, 0x280fff) AM_RAM_WRITE(flagrall_spr_videoram_w) AM_SHARE("spr_videoram") + AM_RANGE(0x280000, 0x280fff) AM_RAM AM_SHARE("spr_videoram") AM_RANGE(0x2c0000, 0x2c07ff) AM_RAM_WRITE(flagrall_bak_videoram_w) AM_SHARE("bak_videoram") AM_RANGE(0x340000, 0x340001) AM_WRITE(flagrall_xscroll_w) @@ -127,7 +125,6 @@ static ADDRESS_MAP_START( flagrall_map, AS_PROGRAM, 16, flagrall_state ) AM_RANGE(0x400000, 0x400001) AM_READ_PORT("IN0") AM_RANGE(0x440000, 0x440001) AM_READ_PORT("IN1") AM_RANGE(0x480000, 0x480001) AM_READ_PORT("IN2") -// AM_RANGE(0x4c0000, 0x4c0001) AM_READ_PORT("IN3") AM_RANGE(0x4c0000, 0x4c0001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) ADDRESS_MAP_END -- cgit v1.2.3-70-g09d2 From 18b8f32b2a41e5bcb53005210610627dad48fd9e Mon Sep 17 00:00:00 2001 From: David Haywood Date: Tue, 9 Feb 2016 20:21:20 +0000 Subject: new WORKING game '96 Flag Rally [Nosunosu, ShouTime, David Haywood] note, clocks and refresh rate etc. have NOT been verified. --- src/mame/drivers/flagrall.cpp | 233 ++++++++++++++++-------------------------- 1 file changed, 87 insertions(+), 146 deletions(-) diff --git a/src/mame/drivers/flagrall.cpp b/src/mame/drivers/flagrall.cpp index 20950fc9615..a138705ab36 100644 --- a/src/mame/drivers/flagrall.cpp +++ b/src/mame/drivers/flagrall.cpp @@ -14,7 +14,12 @@ public: m_spr_videoram(*this, "spr_videoram"), m_bak_videoram(*this, "bak_videoram"), m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode"), + m_oki(*this, "oki"), + xscroll(0), + yscroll(0), + ctrl(0) + { } /* memory pointers */ required_shared_ptr m_spr_info; @@ -30,13 +35,12 @@ public: UINT32 screen_update_flagrall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device m_maincpu; required_device m_gfxdecode; + required_device m_oki; DECLARE_WRITE16_MEMBER(flagrall_xscroll_w); DECLARE_WRITE16_MEMBER(flagrall_yscroll_w); DECLARE_WRITE16_MEMBER(flagrall_ctrl_w); - - UINT16 xscroll; UINT16 yscroll; UINT16 ctrl; @@ -61,7 +65,22 @@ WRITE16_MEMBER(flagrall_state::flagrall_ctrl_w) { COMBINE_DATA(&ctrl); - popmessage("control write %04x", ctrl); + // 0x0200 on startup + // 0x0100 on startup + + // 0x80 - ? + // 0x40 - ? + // 0x20 - toggles, might trigger vram -> buffer transfer? + // 0x10 - unknown, always on? + // 0x08 - ? + // 0x06 - oki bank + // 0x01 - ? + + if (ctrl & 0xfcc9) + popmessage("unk control %04x", ctrl & 0xfcc9); + + m_oki->set_bank_base(0x40000 * ((data & 0x6)>>1) ); + } @@ -89,6 +108,13 @@ UINT32 flagrall_state::screen_update_flagrall(screen_device &screen, bitmap_ind1 { m_bak_tilemap->draw(screen, bitmap, cliprect, 0, 0); + // sprites are simple, 2 ram areas + + // area 1 (1 word per sprite) + // xxxx xxxx yyyy yyyy (x / y = low 8 x / y position bits) + // area 2 (1 word per sprites) + // tttt tttt tttt tttX (t = tile number, X = high x-bit) + for (int i = 0;i < 0x1000 / 2;i++) { gfx_element *gfx = m_gfxdecode->gfx(0); @@ -113,7 +139,7 @@ static ADDRESS_MAP_START( flagrall_map, AS_PROGRAM, 16, flagrall_state ) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x100000, 0x10ffff) AM_RAM // main ram - AM_RANGE(0x200000, 0x2003ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // clears 0x200 - 0x3ff on startup, but writes 00 values to the other half at times? + AM_RANGE(0x200000, 0x2003ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x240000, 0x240fff) AM_RAM AM_SHARE("spr_info") AM_RANGE(0x280000, 0x280fff) AM_RAM AM_SHARE("spr_videoram") AM_RANGE(0x2c0000, 0x2c07ff) AM_RAM_WRITE(flagrall_bak_videoram_w) AM_SHARE("bak_videoram") @@ -132,150 +158,64 @@ ADDRESS_MAP_END static INPUT_PORTS_START( flagrall ) PORT_START("IN0") - PORT_DIPNAME( 0x0001, 0x0001, "0" ) - PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("IN1") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_DIPNAME( 0x0004, 0x0004, "1" ) - PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("IN2") - PORT_DIPNAME( 0x0001, 0x0001, "2" ) - PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, "Test" ) // some kind of test mode toggle, or at least 'show girls' might be service switch - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2") + PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x0002, DEF_STR( 1C_2C ) ) + PORT_DIPUNUSED_DIPLOC( 0x0004, IP_ACTIVE_LOW, "SW1:3" ) + PORT_DIPUNUSED_DIPLOC( 0x0008, IP_ACTIVE_LOW, "SW1:4" ) + PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0020, 0x0020, "Dip Control" ) PORT_DIPLOCATION("SW1:6") + PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPUNUSED_DIPLOC( 0x0040, IP_ACTIVE_LOW, "SW1:7" ) + PORT_DIPNAME( 0x0080, 0x0080, "Picture Test" ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + + PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") + PORT_DIPSETTING( 0x0200, "1" ) + PORT_DIPSETTING( 0x0100, "2" ) + PORT_DIPSETTING( 0x0300, "3" ) + PORT_DIPSETTING( 0x0000, "5" ) + PORT_DIPNAME( 0x0400, 0x0400, "Bonus Type" ) PORT_DIPLOCATION("SW2:3") + PORT_DIPSETTING ( 0x0400, "0" ) + PORT_DIPSETTING( 0x0000, "1" ) + PORT_DIPUNUSED_DIPLOC( 0x0800, IP_ACTIVE_LOW, "SW2:4" ) + PORT_DIPNAME( 0x3000, 0x3000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6") + PORT_DIPSETTING( 0x0000, DEF_STR( Very_Hard ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( Hard ) ) + PORT_DIPSETTING( 0x2000, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0x3000, DEF_STR( Normal ) ) + PORT_DIPUNUSED_DIPLOC( 0x4000, IP_ACTIVE_LOW, "SW2:7" ) + PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW2:8") + PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) INPUT_PORTS_END static const gfx_layout flagrall_layout = @@ -306,7 +246,7 @@ static MACHINE_CONFIG_START( flagrall, flagrall_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", flagrall) MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_REFRESH_RATE(60) // not verified MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1) @@ -330,7 +270,7 @@ ROM_START( flagrall ) ROM_LOAD16_BYTE( "12_u35.bin", 0x00000, 0x40000, CRC(373b71a5) SHA1(be9ab93129e2ffd9bfe296c341dbdf47f1949ac7) ) ROM_REGION( 0x100000, "oki", 0 ) /* Samples */ - // only one OKI, both roms have sample tables, presumably banked + // 3x banks ROM_LOAD( "13_su4.bin", 0x00000, 0x80000, CRC(7b0630b3) SHA1(c615e6630ffd12c122762751c25c249393bf7abd) ) ROM_LOAD( "14_su6.bin", 0x80000, 0x40000, CRC(593b038f) SHA1(b00dcf321fe541ee52c34b79e69c44f3d7a9cd7c) ) @@ -351,5 +291,6 @@ ROM_START( flagrall ) ROM_END -GAME( 199?, flagrall, 0, flagrall, flagrall, driver_device, 0, ROT0, "", "Flag Rally '96", MACHINE_NOT_WORKING ) // or '96 Flag Rally? +GAME( 199?, flagrall, 0, flagrall, flagrall, driver_device, 0, ROT0, "", "'96 Flag Rally", 0 ) + -- cgit v1.2.3-70-g09d2 From f7fc08eb36d106e0430114b8ba283b75c06360bb Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 9 Feb 2016 21:06:35 +0100 Subject: Update source notes and optimized, nw --- src/devices/video/jangou_blitter.cpp | 42 +++++++++++++++++++++++++----------- src/devices/video/jangou_blitter.h | 1 + 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index 8b0ff953ff8..9df1a351a40 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -5,7 +5,7 @@ Jangou Custom Blitter Chip, codename "???" (name scratched afaik) device emulation by Angelo Salese, from original jangou.cpp implementation - by Angelo Salese, David Haywood and Phil Bennett + by Angelo Salese, David Haywood and Phil Bennett. TODO: - BLTFLIP mechanism; @@ -66,6 +66,7 @@ void jangou_blitter_device::device_reset() { memset(m_blit_data, 0, ARRAY_LENGTH(m_blit_data)); memset(m_pen_data, 0, ARRAY_LENGTH(m_pen_data)); + m_bltflip = false; } @@ -105,14 +106,23 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) int count = 0; int xcount, ycount; - //printf("%02x %02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2],m_blit_data[3], m_blit_data[4], m_blit_data[5],m_blit_data[6]); w = (m_blit_data[4] & 0xff) + 1; h = (m_blit_data[5] & 0xff) + 1; src = ((m_blit_data[1] << 8)|(m_blit_data[0] << 0)); src |= (m_blit_data[6] & 3) << 16; x = (m_blit_data[2] & 0xff); y = (m_blit_data[3] & 0xff); - + + #if 0 + if(m_bltflip == true) + { + printf("%02x %02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2],m_blit_data[3], m_blit_data[4], m_blit_data[5],m_blit_data[6]); + printf("=>"); + for(int i=0;i<0x10;i++) + printf("%02x ",m_pen_data[i]); + printf("\n"); + } + #endif // lowest bit of src controls flipping / draw direction? flipx = (m_blit_data[0] & 1); @@ -121,6 +131,7 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) else src -= (w * h) - 1; + for (ycount = 0; ycount < h; ycount++) { for(xcount = 0; xcount < w; xcount++) @@ -128,13 +139,10 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) int drawx = (x + xcount) & 0xff; int drawy = (y + ycount) & 0xff; UINT8 dat = gfx_nibble(src + count); - UINT8 cur_pen_hi = m_pen_data[(dat & 0xf0) >> 4]; - UINT8 cur_pen_lo = m_pen_data[(dat & 0x0f) >> 0]; - - dat = cur_pen_lo | (cur_pen_hi << 4); - - if ((dat & 0xff) != 0) - plot_gfx_pixel(dat, drawx, drawy); + UINT8 cur_pen = m_pen_data[(dat & 0x0f) >> 0]; + + if (cur_pen != 0) + plot_gfx_pixel(cur_pen, drawx, drawy); if (!flipx) count--; @@ -142,6 +150,15 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) count++; } } + + UINT32 new_src = src + count; + + // update source and height after blitter operation + m_blit_data[0] = new_src & 0xfe; + m_blit_data[1] = new_src >> 8; + m_blit_data[5] = 0; + m_blit_data[6] = new_src >> 16; + m_bltflip = false; } } @@ -168,7 +185,8 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_vregs_w) WRITE8_MEMBER( jangou_blitter_device::blitter_bltflip_w) { - // TODO: this flips gfx nibbles. - + // TODO: unsure about how this works, Charles says it swaps the nibble but afaik it's used for CPU tiles in Night Gal Summer/Sexy Gal and they seems fine? + // Maybe flipx is actually bltflip for later HW? + m_bltflip = true; } diff --git a/src/devices/video/jangou_blitter.h b/src/devices/video/jangou_blitter.h index c0c5dff30ca..7fe1ce51481 100644 --- a/src/devices/video/jangou_blitter.h +++ b/src/devices/video/jangou_blitter.h @@ -51,6 +51,7 @@ private: UINT8 m_blit_data[7]; UINT8 *m_gfxrom; UINT32 m_gfxrommask; + bool m_bltflip; }; -- cgit v1.2.3-70-g09d2 From 66ba72bc9ef1ec2ce4ae9f18b975ac378735ba1a Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 9 Feb 2016 21:18:43 +0100 Subject: Revert set params, nw --- src/devices/video/jangou_blitter.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index 9df1a351a40..89d643fe5bb 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -139,9 +139,11 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) int drawx = (x + xcount) & 0xff; int drawy = (y + ycount) & 0xff; UINT8 dat = gfx_nibble(src + count); - UINT8 cur_pen = m_pen_data[(dat & 0x0f) >> 0]; - - if (cur_pen != 0) + UINT8 cur_pen = m_pen_data[dat & 0x0f]; + + //dat = cur_pen_lo | (cur_pen_hi << 4); + + if ((cur_pen & 0xff) != 0) plot_gfx_pixel(cur_pen, drawx, drawy); if (!flipx) @@ -151,14 +153,15 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) } } - UINT32 new_src = src + count; + //UINT32 new_src = src + count; // update source and height after blitter operation - m_blit_data[0] = new_src & 0xfe; - m_blit_data[1] = new_src >> 8; - m_blit_data[5] = 0; - m_blit_data[6] = new_src >> 16; - m_bltflip = false; + // TODO: Jangou doesn't agree with this, later HW? + //m_blit_data[0] = new_src & 0xfe; + //m_blit_data[1] = new_src >> 8; + //m_blit_data[5] = 0; + //m_blit_data[6] = new_src >> 16; + //m_bltflip = false; } } @@ -179,8 +182,8 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_alt_process_w) WRITE8_MEMBER( jangou_blitter_device::blitter_vregs_w) { - // printf("%02x %02x\n", offset, data); - m_pen_data[offset] = data & 0xf; + // bit 5 set by Jangou, left-over? + m_pen_data[offset] = data & 0x0f; } WRITE8_MEMBER( jangou_blitter_device::blitter_bltflip_w) -- cgit v1.2.3-70-g09d2 From 068efa2a6ed5b2c796c77a386af335fdf33b8484 Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 9 Feb 2016 21:21:40 +0100 Subject: Better algo for sexygal --- src/devices/video/jangou_blitter.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index 89d643fe5bb..a7d7aa7e566 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -165,19 +165,12 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) } } +// Sexy Gal swaps around upper src address WRITE8_MEMBER( jangou_blitter_device::blitter_alt_process_w) { - // TODO: convert this into a more useable function - switch(offset) - { - case 0: blitter_process_w(space,0,data); break; - case 1: blitter_process_w(space,1,data); break; - case 2: blitter_process_w(space,6,data); break; - case 3: blitter_process_w(space,2,data); break; - case 4: blitter_process_w(space,3,data); break; - case 5: blitter_process_w(space,4,data); break; - case 6: blitter_process_w(space,5,data); break; - } + const UINT8 translate_addr[7] = { 0, 1, 6, 2, 3, 4, 5 }; + + blitter_process_w(space,translate_addr[offset],data); } WRITE8_MEMBER( jangou_blitter_device::blitter_vregs_w) -- cgit v1.2.3-70-g09d2 From 63dee56d13e2e0851f632a94c63181dd3a561123 Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 9 Feb 2016 22:04:17 +0100 Subject: Implemented flip screen to jangou and nightgal --- src/devices/video/jangou_blitter.cpp | 21 +++++------ src/devices/video/jangou_blitter.h | 1 + src/mame/drivers/jangou.cpp | 24 ++++++++----- src/mame/drivers/nightgal.cpp | 70 +++++------------------------------- 4 files changed, 35 insertions(+), 81 deletions(-) diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index a7d7aa7e566..c78c6ce97bb 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -84,12 +84,12 @@ UINT8 jangou_blitter_device::gfx_nibble( UINT32 niboffset ) } void jangou_blitter_device::plot_gfx_pixel( UINT8 pix, int x, int y ) -{ - if (y < 0 || y >= 512) +{ + if (y < 0 || y >= 256) return; - if (x < 0 || x >= 512) + if (x < 0 || x >= 256) return; - + if (x & 1) m_blit_buffer[(y * 256) + (x >> 1)] = (m_blit_buffer[(y * 256) + (x >> 1)] & 0x0f) | ((pix << 4) & 0xf0); else @@ -157,11 +157,13 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) // update source and height after blitter operation // TODO: Jangou doesn't agree with this, later HW? - //m_blit_data[0] = new_src & 0xfe; - //m_blit_data[1] = new_src >> 8; - //m_blit_data[5] = 0; - //m_blit_data[6] = new_src >> 16; - //m_bltflip = false; + #if 0 + m_blit_data[0] = new_src & 0xfe; + m_blit_data[1] = new_src >> 8; + m_blit_data[5] = 0; + m_blit_data[6] = new_src >> 16; + #endif + m_bltflip = false; } } @@ -185,4 +187,3 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_bltflip_w) // Maybe flipx is actually bltflip for later HW? m_bltflip = true; } - diff --git a/src/devices/video/jangou_blitter.h b/src/devices/video/jangou_blitter.h index 7fe1ce51481..4babfa62a4d 100644 --- a/src/devices/video/jangou_blitter.h +++ b/src/devices/video/jangou_blitter.h @@ -37,6 +37,7 @@ public: DECLARE_WRITE8_MEMBER( blitter_alt_process_w ); DECLARE_WRITE8_MEMBER( blitter_vregs_w ); DECLARE_WRITE8_MEMBER( blitter_bltflip_w ); + UINT8 m_blit_buffer[256 * 256]; protected: diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index 9d158c2bf3c..23e10763d69 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -100,6 +100,8 @@ public: UINT32 screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(cvsd_bit_timer_callback); DECLARE_WRITE_LINE_MEMBER(jngolady_vclk_cb); + + std::unique_ptr m_tmp_bitmap; }; @@ -152,6 +154,7 @@ PALETTE_INIT_MEMBER(jangou_state, jangou) void jangou_state::video_start() { + m_tmp_bitmap = std::make_unique(256, 256); } UINT32 jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -161,7 +164,7 @@ UINT32 jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 &b for (y = cliprect.min_y; y <= cliprect.max_y; ++y) { UINT8 *src = &m_blitter->m_blit_buffer[y * 256 + cliprect.min_x]; - UINT16 *dst = &bitmap.pix16(y, cliprect.min_x); + UINT16 *dst = &m_tmp_bitmap->pix16(y, cliprect.min_x); for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) { @@ -170,6 +173,9 @@ UINT32 jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 &b *dst++ = m_palette->pen((srcpix >> 4) & 0xf); } } + //void copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle &cliprect) + + copybitmap(bitmap, *m_tmp_bitmap, flip_screen(), flip_screen(),0,0, cliprect); return 0; } @@ -194,7 +200,7 @@ WRITE8_MEMBER(jangou_state::output_w) */ // printf("%02x\n", data); machine().bookkeeping().coin_counter_w(0, data & 0x01); -// flip_screen_set(data & 0x04); + flip_screen_set(data & 0x04); // machine().bookkeeping().coin_lockout_w(0, ~data & 0x20); } @@ -1273,13 +1279,13 @@ DRIVER_INIT_MEMBER(jangou_state,luckygrl) * *************************************/ -GAME( 1983, jangou, 0, jangou, jangou, driver_device, 0, ROT0, "Nichibutsu", "Jangou [BET] (Japan)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1983, macha, 0, jangou, macha, driver_device, 0, ROT0, "Logitec", "Monoshiri Quiz Osyaberi Macha (Japan)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1984, jngolady, 0, jngolady, jngolady, jangou_state, jngolady, ROT0, "Nichibutsu", "Jangou Lady (Japan)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1984, cntrygrl, 0, cntrygrl, cntrygrl, driver_device, 0, ROT0, "Royal Denshi", "Country Girl (Japan set 1)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1984, cntrygrla, cntrygrl, cntrygrl, cntrygrl, driver_device, 0, ROT0, "Nichibutsu", "Country Girl (Japan set 2)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1984, fruitbun, cntrygrl, cntrygrl, cntrygrl, driver_device, 0, ROT0, "Nichibutsu", "Fruits & Bunny (World?)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1985, roylcrdn, 0, roylcrdn, roylcrdn, driver_device, 0, ROT0, "Nichibutsu", "Royal Card (Nichibutsu)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +GAME( 1983, jangou, 0, jangou, jangou, driver_device, 0, ROT0, "Nichibutsu", "Jangou [BET] (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, macha, 0, jangou, macha, driver_device, 0, ROT0, "Logitec", "Monoshiri Quiz Osyaberi Macha (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, jngolady, 0, jngolady, jngolady, jangou_state, jngolady, ROT0, "Nichibutsu", "Jangou Lady (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, cntrygrl, 0, cntrygrl, cntrygrl, driver_device, 0, ROT0, "Royal Denshi", "Country Girl (Japan set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, cntrygrla, cntrygrl, cntrygrl, cntrygrl, driver_device, 0, ROT0, "Nichibutsu", "Country Girl (Japan set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, fruitbun, cntrygrl, cntrygrl, cntrygrl, driver_device, 0, ROT0, "Nichibutsu", "Fruits & Bunny (World?)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, roylcrdn, 0, roylcrdn, roylcrdn, driver_device, 0, ROT0, "Nichibutsu", "Royal Card (Nichibutsu)", MACHINE_SUPPORTS_SAVE ) /* The following might not run there... */ GAME( 1984?, luckygrl, 0, cntrygrl, cntrygrl, jangou_state, luckygrl, ROT0, "Wing Co., Ltd.", "Lucky Girl? (Wing)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index ab3e73a941c..44ebf0ebec4 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -118,6 +118,7 @@ protected: void z80_wait_assert_cb(); TIMER_CALLBACK_MEMBER( z80_wait_ack_cb ); + std::unique_ptr m_tmp_bitmap; }; @@ -129,6 +130,7 @@ READ8_MEMBER(nightgal_state::blitter_status_r) void nightgal_state::video_start() { + m_tmp_bitmap = std::make_unique(256, 256); } UINT32 nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -138,7 +140,7 @@ UINT32 nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind1 for (y = cliprect.min_y; y <= cliprect.max_y; ++y) { UINT8 *src = &m_blitter->m_blit_buffer[y * 256 + cliprect.min_x]; - UINT16 *dst = &bitmap.pix16(y, cliprect.min_x); + UINT16 *dst = &m_tmp_bitmap->pix16(y, cliprect.min_x); for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) { @@ -148,68 +150,11 @@ UINT32 nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind1 } } + copybitmap(bitmap, *m_tmp_bitmap, flip_screen(), flip_screen(),0,0, cliprect); return 0; } -/* different register writes (probably a PAL line swapping).*/ -#ifdef UNUSED_FUNCTION -WRITE8_MEMBER(nightgal_state::sexygal_nsc_true_blitter_w) -{ - int src, x, y, h, w, flipx; - m_true_blit[offset] = data; - - /*trigger blitter write to ram,might not be correct...*/ - if (offset == 6) - { - //printf("%02x %02x %02x %02x %02x %02x %02x\n", m_true_blit[0], m_true_blit[1], m_true_blit[2], m_true_blit[3], m_true_blit[4], m_true_blit[5], m_true_blit[6]); - w = (m_true_blit[5] & 0xff) + 1; - h = (m_true_blit[6] & 0xff) + 1; - src = ((m_true_blit[1] << 8) | (m_true_blit[0] << 0)); - src |= (m_true_blit[2] & 3) << 16; - - - x = (m_true_blit[3] & 0xff); - y = (m_true_blit[4] & 0xff); - - // lowest bit of src controls flipping / draw direction? - flipx = (m_true_blit[0] & 1); - - if (!flipx) - src += (w * h) - 1; - else - src -= (w * h) - 1; - - { - int count = 0; - int xcount, ycount; - for (ycount = 0; ycount < h; ycount++) - { - for (xcount = 0; xcount < w; xcount++) - { - int drawx = (x + xcount) & 0xff; - int drawy = (y + ycount) & 0xff; - UINT8 dat = nightgal_gfx_nibble(src + count); - UINT8 cur_pen_hi = m_pen_data[(dat & 0xf0) >> 4]; - UINT8 cur_pen_lo = m_pen_data[(dat & 0x0f) >> 0]; - - dat = cur_pen_lo | cur_pen_hi << 4; - - if ((dat & 0xff) != 0) - plot_nightgal_gfx_pixel(dat, drawx, drawy); - - if (!flipx) - count--; - else - count++; - } - } - //m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE ); - } - } -} -#endif - /* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */ PALETTE_INIT_MEMBER(nightgal_state, nightgal) { @@ -385,6 +330,7 @@ WRITE8_MEMBER(nightgal_state::output_w) ---- ---x out counter */ machine().bookkeeping().coin_counter_w(0, data & 0x02); + flip_screen_set((data & 0x04) == 0); } /******************************************** @@ -1109,7 +1055,7 @@ GAME( 1984, ngtbunny, 0, royalqn, sexygal, driver_device, 0, ROT0, GAME( 1984, royalngt, ngtbunny, royalqn, sexygal, driver_device, 0, ROT0, "Royal Denshi", "Royal Night [BET] (Japan 840220 RN 2-00)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1984, royalqn, 0, royalqn, sexygal, nightgal_state, royalqn, ROT0, "Royal Denshi", "Royal Queen [BET] (Japan 841010 RQ 0-07)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) /* Type 2 HW */ -GAME( 1985, sexygal, 0, sexygal, sexygal, driver_device, 0, ROT0, "Nichibutsu", "Sexy Gal (Japan 850501 SXG 1-00)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) -GAME( 1985, sweetgal, sexygal, sexygal, sexygal, driver_device, 0, ROT0, "Nichibutsu", "Sweet Gal (Japan 850510 SWG 1-02)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) +GAME( 1985, sexygal, 0, sexygal, sexygal, driver_device, 0, ROT0, "Nichibutsu", "Sexy Gal (Japan 850501 SXG 1-00)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1985, sweetgal, sexygal, sexygal, sexygal, driver_device, 0, ROT0, "Nichibutsu", "Sweet Gal (Japan 850510 SWG 1-02)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) /* Type 3 HW */ -GAME( 1985, ngalsumr, 0, ngalsumr,sexygal, nightgal_state, ngalsumr,ROT0, "Nichibutsu", "Night Gal Summer (Japan 850702 NGS 0-01)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) +GAME( 1985, ngalsumr, 0, ngalsumr,sexygal, nightgal_state, ngalsumr,ROT0, "Nichibutsu", "Night Gal Summer (Japan 850702 NGS 0-01)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From 8c8cf1df87a774c5a5943253ab01f1e7dae32d9c Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 9 Feb 2016 22:22:07 +0100 Subject: Moved blitter status around, function cleanups --- src/devices/video/jangou_blitter.cpp | 15 +++++--- src/devices/video/jangou_blitter.h | 9 ++--- src/mame/drivers/jangou.cpp | 49 ++++++++----------------- src/mame/drivers/nightgal.cpp | 69 +++++++++++++++++++----------------- 4 files changed, 65 insertions(+), 77 deletions(-) diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index c78c6ce97bb..e2acdb37ca1 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -96,7 +96,7 @@ void jangou_blitter_device::plot_gfx_pixel( UINT8 pix, int x, int y ) m_blit_buffer[(y * 256) + (x >> 1)] = (m_blit_buffer[(y * 256) + (x >> 1)] & 0xf0) | (pix & 0x0f); } -WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) +WRITE8_MEMBER( jangou_blitter_device::process_w ) { int src, x, y, h, w, flipx; m_blit_data[offset] = data; @@ -168,22 +168,27 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w ) } // Sexy Gal swaps around upper src address -WRITE8_MEMBER( jangou_blitter_device::blitter_alt_process_w) +WRITE8_MEMBER( jangou_blitter_device::alt_process_w ) { const UINT8 translate_addr[7] = { 0, 1, 6, 2, 3, 4, 5 }; - blitter_process_w(space,translate_addr[offset],data); + process_w(space,translate_addr[offset],data); } -WRITE8_MEMBER( jangou_blitter_device::blitter_vregs_w) +WRITE8_MEMBER( jangou_blitter_device::vregs_w ) { // bit 5 set by Jangou, left-over? m_pen_data[offset] = data & 0x0f; } -WRITE8_MEMBER( jangou_blitter_device::blitter_bltflip_w) +WRITE8_MEMBER( jangou_blitter_device::bltflip_w ) { // TODO: unsure about how this works, Charles says it swaps the nibble but afaik it's used for CPU tiles in Night Gal Summer/Sexy Gal and they seems fine? // Maybe flipx is actually bltflip for later HW? m_bltflip = true; } + +READ_LINE_MEMBER( jangou_blitter_device::status_r ) +{ + return false; +} diff --git a/src/devices/video/jangou_blitter.h b/src/devices/video/jangou_blitter.h index 4babfa62a4d..7a39172e7ca 100644 --- a/src/devices/video/jangou_blitter.h +++ b/src/devices/video/jangou_blitter.h @@ -33,10 +33,11 @@ public: jangou_blitter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); // I/O operations - DECLARE_WRITE8_MEMBER( blitter_process_w ); - DECLARE_WRITE8_MEMBER( blitter_alt_process_w ); - DECLARE_WRITE8_MEMBER( blitter_vregs_w ); - DECLARE_WRITE8_MEMBER( blitter_bltflip_w ); + DECLARE_WRITE8_MEMBER( process_w ); + DECLARE_WRITE8_MEMBER( alt_process_w ); + DECLARE_WRITE8_MEMBER( vregs_w ); + DECLARE_WRITE8_MEMBER( bltflip_w ); + DECLARE_READ_LINE_MEMBER( status_r ); UINT8 m_blit_buffer[256 * 256]; diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index 23e10763d69..d8dd8401ba7 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -324,11 +324,10 @@ static ADDRESS_MAP_START( cpu0_io, AS_IO, 8, jangou_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x01,0x01) AM_DEVREAD("aysnd", ay8910_device, data_r) AM_RANGE(0x02,0x03) AM_DEVWRITE("aysnd", ay8910_device, data_address_w) - AM_RANGE(0x10,0x10) AM_READ_PORT("DSW") //dsw + blitter busy flag - AM_RANGE(0x10,0x10) AM_WRITE(output_w) + AM_RANGE(0x10,0x10) AM_READ_PORT("DSW") AM_WRITE(output_w) //dsw + blitter busy flag AM_RANGE(0x11,0x11) AM_WRITE(mux_w) - AM_RANGE(0x12,0x17) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_process_w) - AM_RANGE(0x20,0x2f) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_vregs_w) + AM_RANGE(0x12,0x17) AM_DEVWRITE("blitter",jangou_blitter_device, process_w) + AM_RANGE(0x20,0x2f) AM_DEVWRITE("blitter",jangou_blitter_device, vregs_w) AM_RANGE(0x30,0x30) AM_WRITENOP //? polls 0x03 continuously AM_RANGE(0x31,0x31) AM_WRITE(sound_latch_w) ADDRESS_MAP_END @@ -398,8 +397,8 @@ static ADDRESS_MAP_START( cntrygrl_cpu0_io, AS_IO, 8, jangou_state ) AM_RANGE(0x10,0x10) AM_READ_PORT("DSW") //dsw + blitter busy flag AM_RANGE(0x10,0x10) AM_WRITE(output_w) AM_RANGE(0x11,0x11) AM_WRITE(mux_w) - AM_RANGE(0x12,0x17) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_process_w) - AM_RANGE(0x20,0x2f) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_vregs_w) + AM_RANGE(0x12,0x17) AM_DEVWRITE("blitter",jangou_blitter_device, process_w) + AM_RANGE(0x20,0x2f) AM_DEVWRITE("blitter",jangou_blitter_device, vregs_w) AM_RANGE(0x30,0x30) AM_WRITENOP //? polls 0x03 continuously // AM_RANGE(0x31,0x31) AM_WRITE(sound_latch_w) ADDRESS_MAP_END @@ -423,8 +422,8 @@ static ADDRESS_MAP_START( roylcrdn_cpu0_io, AS_IO, 8, jangou_state ) AM_RANGE(0x10,0x10) AM_WRITENOP /* Writes continuosly 0's in attract mode, and 1's in game */ AM_RANGE(0x11,0x11) AM_WRITE(mux_w) AM_RANGE(0x13,0x13) AM_READNOP /* Often reads bit7 with unknown purposes */ - AM_RANGE(0x12,0x17) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_process_w) - AM_RANGE(0x20,0x2f) AM_DEVWRITE("blitter",jangou_blitter_device, blitter_vregs_w) + AM_RANGE(0x12,0x17) AM_DEVWRITE("blitter",jangou_blitter_device, process_w) + AM_RANGE(0x20,0x2f) AM_DEVWRITE("blitter",jangou_blitter_device, vregs_w) AM_RANGE(0x30,0x30) AM_WRITENOP /* Seems to write 0x10 on each sound event */ ADDRESS_MAP_END @@ -523,7 +522,7 @@ static INPUT_PORTS_START( jangou ) PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") // guess - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // blitter busy flag + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r) INPUT_PORTS_END static INPUT_PORTS_START( macha ) @@ -584,7 +583,7 @@ static INPUT_PORTS_START( macha ) PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") // guess - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // blitter busy flag + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r) INPUT_PORTS_END @@ -669,7 +668,7 @@ static INPUT_PORTS_START( cntrygrl ) PORT_DIPNAME( 0x40, 0x40, "Coin B setting" ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x40, DEF_STR( 1C_5C ) ) PORT_DIPSETTING( 0x00, "1 Coin / 10 Credits" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // blitter busy flag + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r) PORT_START("IN_NOMUX") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -710,7 +709,7 @@ static INPUT_PORTS_START( jngolady ) PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) //blitter busy flag + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r) INPUT_PORTS_END static INPUT_PORTS_START( roylcrdn ) @@ -768,29 +767,9 @@ static INPUT_PORTS_START( roylcrdn ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) PORT_NAME("Credit Clear") /* Credit Clear */ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) /* Spare 1 */ - PORT_START("DSW") /* Not a real DSW on PCB */ - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* blitter busy flag */ + PORT_START("DSW") + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r) PORT_START("IN_NOMUX") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 44ebf0ebec4..01eb90382fe 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -72,7 +72,6 @@ public: required_device m_subcpu; /* memory */ - DECLARE_READ8_MEMBER(blitter_status_r); //DECLARE_WRITE8_MEMBER(sexygal_nsc_true_blitter_w); DECLARE_WRITE8_MEMBER(royalqn_blitter_0_w); DECLARE_WRITE8_MEMBER(royalqn_blitter_1_w); @@ -121,13 +120,6 @@ protected: std::unique_ptr m_tmp_bitmap; }; - - -READ8_MEMBER(nightgal_state::blitter_status_r) -{ - return 0x80; -} - void nightgal_state::video_start() { m_tmp_bitmap = std::make_unique(256, 256); @@ -203,23 +195,9 @@ PALETTE_INIT_MEMBER(nightgal_state, nightgal) ********************************************/ /* -(note:when I say "0x80" I just mean a negative result) -master-slave algorithm --z80 writes the data for the mcu; --z80 writes 0 to c200; --it waits with the bit 0x80 on c100 clears (i.e. the z80 halts),when this happens the z80 continues his logic algorithm (so stop it until we are done!!!) - --nsc takes an irq --puts ff to [1100] --it waits that the bit 0x80 on [1100] clears --(puts default clut data,only the first time around) --reads params from z80 and puts them on the blitter chip --expects that bit [80] is equal to 0x80; --clears [1100] and expects that [1100] is 0 --executes a wai (i.e. halt) opcode then expects to receive another irq... -*/ - -/* TODO: simplify this (error in the document) */ + There are three unidirectional latches that also sends an irq from z80 to MCU. + */ +// TODO: simplify this (error in the document) WRITE8_MEMBER(nightgal_state::royalqn_blitter_0_w) { m_blit_raw_data[0] = data; @@ -362,11 +340,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sexygal_nsc_map, AS_PROGRAM, 8, nightgal_state ) AM_RANGE(0x0000, 0x007f) AM_RAM - AM_RANGE(0x0080, 0x0080) AM_READ(blitter_status_r) + AM_RANGE(0x0080, 0x0080) AM_READ_PORT("BLIT_PORT") AM_RANGE(0x0081, 0x0083) AM_READ(royalqn_nsc_blit_r) - AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_alt_process_w) - AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_vregs_w) - AM_RANGE(0x00b0, 0x00b0) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_bltflip_w) + AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, alt_process_w) + AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, vregs_w) + AM_RANGE(0x00b0, 0x00b0) AM_DEVWRITE("blitter", jangou_blitter_device, bltflip_w) AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r, royalqn_comm_w) AM_SHARE("comms_ram") AM_RANGE(0xc000, 0xdfff) AM_MIRROR(0x2000) AM_ROM AM_REGION("subrom", 0) @@ -400,11 +378,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( royalqn_nsc_map, AS_PROGRAM, 8, nightgal_state ) AM_RANGE(0x0000, 0x007f) AM_RAM - AM_RANGE(0x0080, 0x0080) AM_READ(blitter_status_r) + AM_RANGE(0x0080, 0x0080) AM_READ_PORT("BLIT_PORT") AM_RANGE(0x0081, 0x0083) AM_READ(royalqn_nsc_blit_r) - AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_process_w) - AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_vregs_w) - AM_RANGE(0x00b0, 0x00b0) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_bltflip_w) + AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, process_w) + AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, vregs_w) + AM_RANGE(0x00b0, 0x00b0) AM_DEVWRITE("blitter", jangou_blitter_device, bltflip_w) AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r,royalqn_comm_w) AM_RANGE(0x4000, 0x4000) AM_NOP @@ -648,6 +626,31 @@ static INPUT_PORTS_START( sexygal ) PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("BLIT_PORT") + PORT_DIPNAME( 0x01, 0x01, "BLIT_PORT" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r) + INPUT_PORTS_END void nightgal_state::machine_start() -- cgit v1.2.3-70-g09d2 From 4dc1a46dd3bf956849293f7b1a4fce40a42d69f3 Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 9 Feb 2016 22:34:20 +0100 Subject: Minor, nw --- src/mame/drivers/nightgal.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 01eb90382fe..38a3a3953f9 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -10,9 +10,9 @@ driver by David Haywood & Angelo Salese many thanks to Charles MacDonald for the schematics / documentation of this HW. TODO: - - is opcode $bb right for Night Gal Summer? - - extra protection for Night Gal Summer (ports 0x6000-3 for z80 and 0x8000-0x8020-1 for MCU); + - extra protection for Night Gal Summer (ports 0x6000-3 for z80); - Fix Sweet Gal/Sexy Gal layer clearances; + - NMI origin for Sexy Gal / Night Gal Summer - unemulated WAIT pin for Z80, MCU asserts it when accessing communication RAM *******************************************************************************************/ @@ -218,7 +218,7 @@ READ8_MEMBER(nightgal_state::royalqn_nsc_blit_r) { if(offset == 2) m_subcpu->set_input_line(0, CLEAR_LINE ); - + return m_blit_raw_data[offset]; } @@ -710,7 +710,7 @@ static MACHINE_CONFIG_DERIVED( sexygal, royalqn ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(sexygal_map) MCFG_CPU_IO_MAP(sexygal_io) - MCFG_CPU_PERIODIC_INT_DRIVER(nightgal_state, nmi_line_pulse, 244)//??? + MCFG_CPU_PERIODIC_INT_DRIVER(nightgal_state, nmi_line_pulse, 60)//??? MCFG_CPU_MODIFY("sub") MCFG_CPU_PROGRAM_MAP(sexygal_nsc_map) @@ -728,7 +728,7 @@ static MACHINE_CONFIG_DERIVED( ngalsumr, royalqn ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(royalqn_map) MCFG_CPU_IO_MAP(royalqn_io) - MCFG_CPU_PERIODIC_INT_DRIVER(nightgal_state, nmi_line_pulse, 244)//??? + MCFG_CPU_PERIODIC_INT_DRIVER(nightgal_state, nmi_line_pulse, 60)//??? MACHINE_CONFIG_END /* -- cgit v1.2.3-70-g09d2 From f5d4d25d10f35f58b5d87a9d22e77062ec5fe5aa Mon Sep 17 00:00:00 2001 From: David Haywood Date: Wed, 10 Feb 2016 02:44:19 +0000 Subject: move flagrall to the 1945kiii driver, nearly the same thing. I wonder what this hw was originally cloned from. --- scripts/target/mame/arcade.lua | 1 - src/mame/drivers/1945kiii.cpp | 197 +++++++++++++++++++++++---- src/mame/drivers/flagrall.cpp | 296 ----------------------------------------- 3 files changed, 170 insertions(+), 324 deletions(-) delete mode 100644 src/mame/drivers/flagrall.cpp diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index e41da449e2e..d4bc8eb26b1 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -4286,7 +4286,6 @@ files { MAME_DIR .. "src/mame/drivers/extrema.cpp", MAME_DIR .. "src/mame/drivers/fastinvaders.cpp", MAME_DIR .. "src/mame/drivers/fireball.cpp", - MAME_DIR .. "src/mame/drivers/flagrall.cpp", MAME_DIR .. "src/mame/drivers/flipjack.cpp", MAME_DIR .. "src/mame/drivers/flower.cpp", MAME_DIR .. "src/mame/includes/flower.h", diff --git a/src/mame/drivers/1945kiii.cpp b/src/mame/drivers/1945kiii.cpp index 55b4b8c6ee3..93b649814e9 100644 --- a/src/mame/drivers/1945kiii.cpp +++ b/src/mame/drivers/1945kiii.cpp @@ -2,6 +2,8 @@ // copyright-holders:David Haywood /* +what is this HW cloned from? I doubt it's an original design + 1945 K-3 driver --------------- @@ -54,8 +56,8 @@ class k3_state : public driver_device public: k3_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_oki1(*this, "oki1"), - m_oki2(*this, "oki2") , + m_oki2(*this, "oki2"), + m_oki1(*this, "oki1") , m_spriteram_1(*this, "spritera1"), m_spriteram_2(*this, "spritera2"), m_bgram(*this, "bgram"), @@ -64,8 +66,8 @@ public: m_palette(*this, "palette") { } /* devices */ + optional_device m_oki2; required_device m_oki1; - required_device m_oki2; /* memory pointers */ required_shared_ptr m_spriteram_1; required_shared_ptr m_spriteram_2; @@ -78,6 +80,7 @@ public: DECLARE_WRITE16_MEMBER(k3_scrollx_w); DECLARE_WRITE16_MEMBER(k3_scrolly_w); DECLARE_WRITE16_MEMBER(k3_soundbanks_w); + DECLARE_WRITE16_MEMBER(flagrall_soundbanks_w); TILE_GET_INFO_MEMBER(get_k3_bg_tile_info); virtual void machine_start() override; virtual void video_start() override; @@ -103,7 +106,7 @@ TILE_GET_INFO_MEMBER(k3_state::get_k3_bg_tile_info) void k3_state::video_start() { - m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k3_state::get_k3_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 64); + m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k3_state::get_k3_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); } void k3_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -151,31 +154,71 @@ WRITE16_MEMBER(k3_state::k3_scrolly_w) WRITE16_MEMBER(k3_state::k3_soundbanks_w) { - m_oki1->set_bank_base((data & 4) ? 0x40000 : 0); - m_oki2->set_bank_base((data & 2) ? 0x40000 : 0); + m_oki2->set_bank_base((data & 4) ? 0x40000 : 0); + m_oki1->set_bank_base((data & 2) ? 0x40000 : 0); } -static ADDRESS_MAP_START( k3_map, AS_PROGRAM, 16, k3_state ) - AM_RANGE(0x0009ce, 0x0009cf) AM_WRITENOP // bug in code? (clean up log) - AM_RANGE(0x0009d2, 0x0009d3) AM_WRITENOP // bug in code? (clean up log) +WRITE16_MEMBER(k3_state::flagrall_soundbanks_w) +{ + + data &= mem_mask; + + // 0x0200 on startup + // 0x0100 on startup + + // 0x80 - ? + // 0x40 - ? + // 0x20 - toggles, might trigger vram -> buffer transfer? + // 0x10 - unknown, always on? + // 0x08 - ? + // 0x06 - oki bank + // 0x01 - ? + + if (data & 0xfcc9) + popmessage("unk control %04x", data & 0xfcc9); + + m_oki1->set_bank_base(0x40000 * ((data & 0x6)>>1) ); + +} + + +static ADDRESS_MAP_START( k3_base_map, AS_PROGRAM, 16, k3_state ) + AM_RANGE(0x0009ce, 0x0009cf) AM_WRITENOP // k3 - bug in code? (clean up log) + AM_RANGE(0x0009d2, 0x0009d3) AM_WRITENOP // l3 - bug in code? (clean up log) AM_RANGE(0x000000, 0x0fffff) AM_ROM // ROM AM_RANGE(0x100000, 0x10ffff) AM_RAM // Main Ram AM_RANGE(0x200000, 0x200fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x240000, 0x240fff) AM_RAM AM_SHARE("spritera1") AM_RANGE(0x280000, 0x280fff) AM_RAM AM_SHARE("spritera2") - AM_RANGE(0x2c0000, 0x2c0fff) AM_RAM_WRITE(k3_bgram_w) AM_SHARE("bgram") + AM_RANGE(0x2c0000, 0x2c07ff) AM_RAM_WRITE(k3_bgram_w) AM_SHARE("bgram") + AM_RANGE(0x2c0800, 0x2c0fff) AM_RAM // or does k3 have a bigger tilemap? (flagrall is definitely 32x32 tiles) AM_RANGE(0x340000, 0x340001) AM_WRITE(k3_scrollx_w) AM_RANGE(0x380000, 0x380001) AM_WRITE(k3_scrolly_w) - AM_RANGE(0x3c0000, 0x3c0001) AM_WRITE(k3_soundbanks_w) AM_RANGE(0x400000, 0x400001) AM_READ_PORT("INPUTS") AM_RANGE(0x440000, 0x440001) AM_READ_PORT("SYSTEM") AM_RANGE(0x480000, 0x480001) AM_READ_PORT("DSW") - AM_RANGE(0x4c0000, 0x4c0001) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0xff00) - AM_RANGE(0x500000, 0x500001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0xff00) - AM_RANGE(0x8c0000, 0x8cffff) AM_RAM // not used? ADDRESS_MAP_END +static ADDRESS_MAP_START( k3_map, AS_PROGRAM, 16, k3_state ) + AM_IMPORT_FROM( k3_base_map ) + + AM_RANGE(0x3c0000, 0x3c0001) AM_WRITE(k3_soundbanks_w) + + AM_RANGE(0x4c0000, 0x4c0001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0xff00) + AM_RANGE(0x500000, 0x500001) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0xff00) + AM_RANGE(0x8c0000, 0x8cffff) AM_RAM // not used? (bug in code?) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( flagrall_map, AS_PROGRAM, 16, k3_state ) + AM_IMPORT_FROM( k3_base_map ) + + AM_RANGE(0x3c0000, 0x3c0001) AM_WRITE(flagrall_soundbanks_w) + AM_RANGE(0x4c0000, 0x4c0001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff) +ADDRESS_MAP_END + + static INPUT_PORTS_START( k3 ) PORT_START("INPUTS") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) @@ -238,18 +281,81 @@ static INPUT_PORTS_START( k3 ) INPUT_PORTS_END +static INPUT_PORTS_START( flagrall ) + PORT_START("INPUTS") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("SYSTEM") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("DSW") + PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2") + PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x0002, DEF_STR( 1C_2C ) ) + PORT_DIPUNUSED_DIPLOC( 0x0004, IP_ACTIVE_LOW, "SW1:3" ) + PORT_DIPUNUSED_DIPLOC( 0x0008, IP_ACTIVE_LOW, "SW1:4" ) + PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0020, 0x0020, "Dip Control" ) PORT_DIPLOCATION("SW1:6") + PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPUNUSED_DIPLOC( 0x0040, IP_ACTIVE_LOW, "SW1:7" ) + PORT_DIPNAME( 0x0080, 0x0080, "Picture Test" ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + + PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") + PORT_DIPSETTING( 0x0200, "1" ) + PORT_DIPSETTING( 0x0100, "2" ) + PORT_DIPSETTING( 0x0300, "3" ) + PORT_DIPSETTING( 0x0000, "5" ) + PORT_DIPNAME( 0x0400, 0x0400, "Bonus Type" ) PORT_DIPLOCATION("SW2:3") + PORT_DIPSETTING ( 0x0400, "0" ) + PORT_DIPSETTING( 0x0000, "1" ) + PORT_DIPUNUSED_DIPLOC( 0x0800, IP_ACTIVE_LOW, "SW2:4" ) + PORT_DIPNAME( 0x3000, 0x3000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6") + PORT_DIPSETTING( 0x0000, DEF_STR( Very_Hard ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( Hard ) ) + PORT_DIPSETTING( 0x2000, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0x3000, DEF_STR( Normal ) ) + PORT_DIPUNUSED_DIPLOC( 0x4000, IP_ACTIVE_LOW, "SW2:7" ) + PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW2:8") + PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) +INPUT_PORTS_END + + static const gfx_layout k3_layout = { 16,16, RGN_FRAC(1,1), 8, { 0,1,2,3,4,5,6,7 }, - { 0,8,16,24,32,40,48,56, 64, 72, 80, 88, 96, 104, 112, 120 }, - { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, - 8*128, 9*128,10*128,11*128,12*128,13*128,14*128,15*128 }, - 16*128 + { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, + { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 }, + 16*128, }; + static GFXDECODE_START( 1945kiii ) GFXDECODE_ENTRY( "gfx1", 0, k3_layout, 0x0, 2 ) /* bg tiles */ GFXDECODE_ENTRY( "gfx2", 0, k3_layout, 0x0, 2 ) /* bg tiles */ @@ -260,20 +366,19 @@ void k3_state::machine_start() { } -static MACHINE_CONFIG_START( k3, k3_state ) +static MACHINE_CONFIG_START( flagrall, k3_state ) - MCFG_CPU_ADD("maincpu", M68000, MASTER_CLOCK) - MCFG_CPU_PROGRAM_MAP(k3_map) + MCFG_CPU_ADD("maincpu", M68000, MASTER_CLOCK ) // ? + MCFG_CPU_PROGRAM_MAP(flagrall_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", k3_state, irq4_line_hold) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", 1945kiii) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(64*8, 64*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) + MCFG_SCREEN_SIZE(64*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(k3_state, screen_update_k3) MCFG_SCREEN_PALETTE("palette") @@ -284,9 +389,19 @@ static MACHINE_CONFIG_START( k3, k3_state ) MCFG_OKIM6295_ADD("oki1", MASTER_CLOCK/16, OKIM6295_PIN7_HIGH) /* dividers? */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( k3, flagrall ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(k3_map) MCFG_OKIM6295_ADD("oki2", MASTER_CLOCK/16, OKIM6295_PIN7_HIGH) /* dividers? */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) MACHINE_CONFIG_END @@ -296,10 +411,10 @@ ROM_START( 1945kiii ) ROM_LOAD16_BYTE( "prg-1.u51", 0x00001, 0x80000, CRC(6b345f27) SHA1(60867fa0e2ea7ebdd4b8046315ee0c83e5cf0d74) ) ROM_LOAD16_BYTE( "prg-2.u52", 0x00000, 0x80000, CRC(ce09b98c) SHA1(a06bb712b9cf2249cc535de4055b14a21c68e0c5) ) - ROM_REGION( 0x080000, "oki1", 0 ) /* Samples */ + ROM_REGION( 0x080000, "oki2", 0 ) /* Samples */ ROM_LOAD( "snd-2.su4", 0x00000, 0x80000, CRC(47e3952e) SHA1(d56524621a3f11981e4434e02f5fdb7e89fff0b4) ) - ROM_REGION( 0x080000, "oki2", 0 ) /* Samples */ + ROM_REGION( 0x080000, "oki1", 0 ) /* Samples */ ROM_LOAD( "snd-1.su7", 0x00000, 0x80000, CRC(bbb7f0ff) SHA1(458cf3a0c2d42110bc2427db675226c6b8d30999) ) ROM_REGION( 0x400000, "gfx1", 0 ) // sprites @@ -310,4 +425,32 @@ ROM_START( 1945kiii ) ROM_LOAD( "m16m-3.u61", 0x00000, 0x200000, CRC(32fc80dd) SHA1(bee32493a250e9f21997114bba26b9535b1b636c) ) ROM_END -GAME( 2000, 1945kiii, 0, k3, k3, driver_device, 0, ROT270, "Oriental Soft", "1945k III", MACHINE_SUPPORTS_SAVE ) +ROM_START( flagrall ) + ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "11_u34.bin", 0x00001, 0x40000, CRC(24dd439d) SHA1(88857ad5ed69f29de86702dcc746d35b69b3b93d) ) + ROM_LOAD16_BYTE( "12_u35.bin", 0x00000, 0x40000, CRC(373b71a5) SHA1(be9ab93129e2ffd9bfe296c341dbdf47f1949ac7) ) + + ROM_REGION( 0x100000, "oki1", 0 ) /* Samples */ + // 3x banks + ROM_LOAD( "13_su4.bin", 0x00000, 0x80000, CRC(7b0630b3) SHA1(c615e6630ffd12c122762751c25c249393bf7abd) ) + ROM_LOAD( "14_su6.bin", 0x80000, 0x40000, CRC(593b038f) SHA1(b00dcf321fe541ee52c34b79e69c44f3d7a9cd7c) ) + + ROM_REGION( 0x300000, "gfx1", 0 ) + ROM_LOAD32_BYTE( "1_u5.bin", 0x000000, 0x080000, CRC(9377704b) SHA1(ac516a8ba6d1a70086469504c2a46d47a1f4560b) ) + ROM_LOAD32_BYTE( "5_u6.bin", 0x000001, 0x080000, CRC(1ac0bd0c) SHA1(ab71bb84e61f5c7168601695f332a8d4a30d9948) ) + ROM_LOAD32_BYTE( "2_u7.bin", 0x000002, 0x080000, CRC(5f6db2b3) SHA1(84caa019d3b75be30a14d19ccc2f28e5e94028bd) ) + ROM_LOAD32_BYTE( "6_u8.bin", 0x000003, 0x080000, CRC(79e4643c) SHA1(274f2741f39c63e32f49c6a1a72ded1263bdcdaa) ) + + ROM_LOAD32_BYTE( "3_u58.bin", 0x200000, 0x040000, CRC(c913df7d) SHA1(96e89ecb9e5f4d596d71d7ba35af7b2af4670342) ) + ROM_LOAD32_BYTE( "4_u59.bin", 0x200001, 0x040000, CRC(cb192384) SHA1(329b4c1a4dc388d9f4ce063f9a54cbf3b967682a) ) + ROM_LOAD32_BYTE( "7_u60.bin", 0x200002, 0x040000, CRC(f187a7bf) SHA1(f4ce9ac9fe376250fe426de6ee404fc7841ef08a) ) + ROM_LOAD32_BYTE( "8_u61.bin", 0x200003, 0x040000, CRC(b73fa441) SHA1(a5a3533563070c870276ead5e2f9cb9aaba303cc)) + + ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_LOAD( "10_u102.bin", 0x00000, 0x80000, CRC(b1fd3279) SHA1(4a75581e13d43bef441ce81eae518c2f6bc1d5f8) ) + ROM_LOAD( "9_u103.bin", 0x80000, 0x80000, CRC(01e6d654) SHA1(821d61a5b16f5cb76e2a805c8504db1ef38c3a48) ) +ROM_END + + +GAME( 2000, 1945kiii, 0, k3, k3, driver_device, 0, ROT270, "Oriental Soft", "1945k III", MACHINE_SUPPORTS_SAVE ) +GAME( 1996?,flagrall, 0, flagrall, flagrall, driver_device, 0, ROT0, "", "'96 Flag Rally", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/flagrall.cpp b/src/mame/drivers/flagrall.cpp deleted file mode 100644 index a138705ab36..00000000000 --- a/src/mame/drivers/flagrall.cpp +++ /dev/null @@ -1,296 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "sound/okim6295.h" - -class flagrall_state : public driver_device -{ -public: - flagrall_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_spr_info(*this, "spr_info"), - m_spr_videoram(*this, "spr_videoram"), - m_bak_videoram(*this, "bak_videoram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_oki(*this, "oki"), - xscroll(0), - yscroll(0), - ctrl(0) - { } - - /* memory pointers */ - required_shared_ptr m_spr_info; - required_shared_ptr m_spr_videoram; - required_shared_ptr m_bak_videoram; - - /* video-related */ - tilemap_t *m_bak_tilemap; - DECLARE_WRITE16_MEMBER(flagrall_bak_videoram_w); - TILE_GET_INFO_MEMBER(get_flagrall_bak_tile_info); - - virtual void video_start() override; - UINT32 screen_update_flagrall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_oki; - - DECLARE_WRITE16_MEMBER(flagrall_xscroll_w); - DECLARE_WRITE16_MEMBER(flagrall_yscroll_w); - DECLARE_WRITE16_MEMBER(flagrall_ctrl_w); - - UINT16 xscroll; - UINT16 yscroll; - UINT16 ctrl; -}; - - - - -WRITE16_MEMBER(flagrall_state::flagrall_xscroll_w) -{ - COMBINE_DATA(&xscroll); - m_bak_tilemap->set_scrollx(0, xscroll); -} - -WRITE16_MEMBER(flagrall_state::flagrall_yscroll_w) -{ - COMBINE_DATA(&yscroll); - m_bak_tilemap->set_scrolly(0, yscroll); -} - -WRITE16_MEMBER(flagrall_state::flagrall_ctrl_w) -{ - COMBINE_DATA(&ctrl); - - // 0x0200 on startup - // 0x0100 on startup - - // 0x80 - ? - // 0x40 - ? - // 0x20 - toggles, might trigger vram -> buffer transfer? - // 0x10 - unknown, always on? - // 0x08 - ? - // 0x06 - oki bank - // 0x01 - ? - - if (ctrl & 0xfcc9) - popmessage("unk control %04x", ctrl & 0xfcc9); - - m_oki->set_bank_base(0x40000 * ((data & 0x6)>>1) ); - -} - - - - -WRITE16_MEMBER(flagrall_state::flagrall_bak_videoram_w) -{ - COMBINE_DATA(&m_bak_videoram[offset]); - m_bak_tilemap->mark_tile_dirty(offset); -} - -TILE_GET_INFO_MEMBER(flagrall_state::get_flagrall_bak_tile_info) -{ - int tileno = m_bak_videoram[tile_index]; - SET_TILE_INFO_MEMBER(1, tileno, 0, 0); -} - - -void flagrall_state::video_start() -{ - m_bak_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flagrall_state::get_flagrall_bak_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); -} - -UINT32 flagrall_state::screen_update_flagrall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bak_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - // sprites are simple, 2 ram areas - - // area 1 (1 word per sprite) - // xxxx xxxx yyyy yyyy (x / y = low 8 x / y position bits) - // area 2 (1 word per sprites) - // tttt tttt tttt tttX (t = tile number, X = high x-bit) - - for (int i = 0;i < 0x1000 / 2;i++) - { - gfx_element *gfx = m_gfxdecode->gfx(0); - - int sprx = m_spr_info[i] >> 8; - int spry = m_spr_info[i] & 0x00ff; - sprx |= (m_spr_videoram[i] & 0x01) << 8; - UINT16 sprtile = m_spr_videoram[i] >> 1; - - gfx->transpen(bitmap,cliprect,sprtile,1,0,0,sprx,spry,0); - gfx->transpen(bitmap,cliprect,sprtile,1,0,0,sprx,spry-0x100,0); - gfx->transpen(bitmap,cliprect,sprtile,1,0,0,sprx-0x200,spry,0); - gfx->transpen(bitmap,cliprect,sprtile,1,0,0,sprx-0x200,spry-0x100,0); - - } - - return 0; -} - - -static ADDRESS_MAP_START( flagrall_map, AS_PROGRAM, 16, flagrall_state ) - AM_RANGE(0x000000, 0x07ffff) AM_ROM - AM_RANGE(0x100000, 0x10ffff) AM_RAM // main ram - - AM_RANGE(0x200000, 0x2003ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") - AM_RANGE(0x240000, 0x240fff) AM_RAM AM_SHARE("spr_info") - AM_RANGE(0x280000, 0x280fff) AM_RAM AM_SHARE("spr_videoram") - AM_RANGE(0x2c0000, 0x2c07ff) AM_RAM_WRITE(flagrall_bak_videoram_w) AM_SHARE("bak_videoram") - - AM_RANGE(0x340000, 0x340001) AM_WRITE(flagrall_xscroll_w) - AM_RANGE(0x380000, 0x380001) AM_WRITE(flagrall_yscroll_w) - AM_RANGE(0x3c0000, 0x3c0001) AM_WRITE(flagrall_ctrl_w) - - AM_RANGE(0x400000, 0x400001) AM_READ_PORT("IN0") - AM_RANGE(0x440000, 0x440001) AM_READ_PORT("IN1") - AM_RANGE(0x480000, 0x480001) AM_READ_PORT("IN2") - - AM_RANGE(0x4c0000, 0x4c0001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( flagrall ) - PORT_START("IN0") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("IN1") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("IN2") - PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2") - PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x0002, DEF_STR( 1C_2C ) ) - PORT_DIPUNUSED_DIPLOC( 0x0004, IP_ACTIVE_LOW, "SW1:3" ) - PORT_DIPUNUSED_DIPLOC( 0x0008, IP_ACTIVE_LOW, "SW1:4" ) - PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:5") - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, "Dip Control" ) PORT_DIPLOCATION("SW1:6") - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPUNUSED_DIPLOC( 0x0040, IP_ACTIVE_LOW, "SW1:7" ) - PORT_DIPNAME( 0x0080, 0x0080, "Picture Test" ) PORT_DIPLOCATION("SW1:8") - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - - PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") - PORT_DIPSETTING( 0x0200, "1" ) - PORT_DIPSETTING( 0x0100, "2" ) - PORT_DIPSETTING( 0x0300, "3" ) - PORT_DIPSETTING( 0x0000, "5" ) - PORT_DIPNAME( 0x0400, 0x0400, "Bonus Type" ) PORT_DIPLOCATION("SW2:3") - PORT_DIPSETTING ( 0x0400, "0" ) - PORT_DIPSETTING( 0x0000, "1" ) - PORT_DIPUNUSED_DIPLOC( 0x0800, IP_ACTIVE_LOW, "SW2:4" ) - PORT_DIPNAME( 0x3000, 0x3000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6") - PORT_DIPSETTING( 0x0000, DEF_STR( Very_Hard ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( Hard ) ) - PORT_DIPSETTING( 0x2000, DEF_STR( Easy ) ) - PORT_DIPSETTING( 0x3000, DEF_STR( Normal ) ) - PORT_DIPUNUSED_DIPLOC( 0x4000, IP_ACTIVE_LOW, "SW2:7" ) - PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW2:8") - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) -INPUT_PORTS_END - -static const gfx_layout flagrall_layout = -{ - 16,16, - RGN_FRAC(1,1), - 8, - { 0,1,2,3,4,5,6,7 }, - { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, - { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 }, - 16*128, -}; - - - -static GFXDECODE_START( flagrall ) - GFXDECODE_ENTRY( "sprites", 0, flagrall_layout, 0x0, 2 ) /* sprite tiles */ - GFXDECODE_ENTRY( "tiles", 0, flagrall_layout, 0x0, 2 ) /* bg tiles */ -GFXDECODE_END - - -static MACHINE_CONFIG_START( flagrall, flagrall_state ) - - MCFG_CPU_ADD("maincpu", M68000, 16000000 ) // ? - MCFG_CPU_PROGRAM_MAP(flagrall_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", flagrall_state, irq4_line_hold) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", flagrall) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) // not verified - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(flagrall_state, screen_update_flagrall) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 0x200) - MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_OKIM6295_ADD("oki", 16000000/16, OKIM6295_PIN7_HIGH) // not verified - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.47) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.47) -MACHINE_CONFIG_END - - -ROM_START( flagrall ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "11_u34.bin", 0x00001, 0x40000, CRC(24dd439d) SHA1(88857ad5ed69f29de86702dcc746d35b69b3b93d) ) - ROM_LOAD16_BYTE( "12_u35.bin", 0x00000, 0x40000, CRC(373b71a5) SHA1(be9ab93129e2ffd9bfe296c341dbdf47f1949ac7) ) - - ROM_REGION( 0x100000, "oki", 0 ) /* Samples */ - // 3x banks - ROM_LOAD( "13_su4.bin", 0x00000, 0x80000, CRC(7b0630b3) SHA1(c615e6630ffd12c122762751c25c249393bf7abd) ) - ROM_LOAD( "14_su6.bin", 0x80000, 0x40000, CRC(593b038f) SHA1(b00dcf321fe541ee52c34b79e69c44f3d7a9cd7c) ) - - ROM_REGION( 0x300000, "sprites", 0 ) - ROM_LOAD32_BYTE( "1_u5.bin", 0x000000, 0x080000, CRC(9377704b) SHA1(ac516a8ba6d1a70086469504c2a46d47a1f4560b) ) - ROM_LOAD32_BYTE( "5_u6.bin", 0x000001, 0x080000, CRC(1ac0bd0c) SHA1(ab71bb84e61f5c7168601695f332a8d4a30d9948) ) - ROM_LOAD32_BYTE( "2_u7.bin", 0x000002, 0x080000, CRC(5f6db2b3) SHA1(84caa019d3b75be30a14d19ccc2f28e5e94028bd) ) - ROM_LOAD32_BYTE( "6_u8.bin", 0x000003, 0x080000, CRC(79e4643c) SHA1(274f2741f39c63e32f49c6a1a72ded1263bdcdaa) ) - - ROM_LOAD32_BYTE( "3_u58.bin", 0x200000, 0x040000, CRC(c913df7d) SHA1(96e89ecb9e5f4d596d71d7ba35af7b2af4670342) ) - ROM_LOAD32_BYTE( "4_u59.bin", 0x200001, 0x040000, CRC(cb192384) SHA1(329b4c1a4dc388d9f4ce063f9a54cbf3b967682a) ) - ROM_LOAD32_BYTE( "7_u60.bin", 0x200002, 0x040000, CRC(f187a7bf) SHA1(f4ce9ac9fe376250fe426de6ee404fc7841ef08a) ) - ROM_LOAD32_BYTE( "8_u61.bin", 0x200003, 0x040000, CRC(b73fa441) SHA1(a5a3533563070c870276ead5e2f9cb9aaba303cc)) - - ROM_REGION( 0x100000, "tiles", 0 ) - ROM_LOAD( "10_u102.bin", 0x00000, 0x80000, CRC(b1fd3279) SHA1(4a75581e13d43bef441ce81eae518c2f6bc1d5f8) ) - ROM_LOAD( "9_u103.bin", 0x80000, 0x80000, CRC(01e6d654) SHA1(821d61a5b16f5cb76e2a805c8504db1ef38c3a48) ) -ROM_END - - -GAME( 199?, flagrall, 0, flagrall, flagrall, driver_device, 0, ROT0, "", "'96 Flag Rally", 0 ) - - -- cgit v1.2.3-70-g09d2 From 7dc9bd6c82c187032e2e6ef9437f82f0800cc7d3 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 10 Feb 2016 00:16:09 -0300 Subject: Moon Light: Rearrange and split by program. this generated new sets due to the hidden extra programs in the program ROMs. [Roberto Fresca] New clones added or promoted from NOT_WORKING status ---------------------------------------------------- Moon Light (v.0629, high program) [Roberto Fresca, f205v] Moon Light (v.02L0A, low program) [Roberto Fresca, f205v] Moon Light (v.02L0A, high program, alt gfx) [Roberto Fresca, f205v] --- src/mame/arcade.lst | 2 ++ src/mame/drivers/goldstar.cpp | 64 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index b7e3c2ad46b..cbf2ba36ceb 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -10075,7 +10075,9 @@ haekaka // (c) 2001 Sammy goldstar // (c) 198? IGS goldstbl // (c) 198? IGS moonlght // bootleg +moonlghta // bootleg moonlghtb // bootleg +moonlghtc // bootleg chry10 // bootleg chrygld // bootleg goldfrui // bootleg diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 360127875b7..8c3c4d71612 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -8211,11 +8211,17 @@ ROM_START( chrygld ) ROM_END -/* Moon Light (set 1) +/* Moon Light (V.0629) + Rip off / clone of Gold Star. + + The program ROM is double size and stores two different programs. + Whilst we have not idea about the real addressing, we can support + both sets separately. + */ ROM_START( moonlght ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "4.bin", 0x0000, 0x20000, CRC(ecb06cfb) SHA1(e32613cac5583a0fecf04fca98796b91698e530c) ) + ROM_REGION( 0x20000, "maincpu", 0 ) // using only the first half of the program ROM. + ROM_LOAD( "4.bin", 0x0000, 0x20000, CRC(ecb06cfb) SHA1(e32613cac5583a0fecf04fca98796b91698e530c) ) // low program, normal gfx ROM_REGION( 0x20000, "gfx1", 0 ) ROM_LOAD( "28.bin", 0x00000, 0x20000, CRC(76915c0f) SHA1(3f6d1c0dd3d9bf29538181a0e930291b822dad8c) ) @@ -8227,7 +8233,27 @@ ROM_START( moonlght ) ROM_LOAD( "gs1-snd.bin", 0x0000, 0x20000, CRC(9d58960f) SHA1(c68edf95743e146398aabf6b9617d18e1f9bf25b) ) ROM_END -/* Moon Light (set 2) +ROM_START( moonlghta ) + ROM_REGION( 0x20000, "maincpu", 0 ) // using only the second half of the program ROM. + ROM_LOAD( "4.bin", 0x10000, 0x10000, CRC(ecb06cfb) SHA1(e32613cac5583a0fecf04fca98796b91698e530c) ) // high program, normal gfx + ROM_CONTINUE( 0x00000, 0x10000) + + ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_LOAD( "28.bin", 0x00000, 0x20000, CRC(76915c0f) SHA1(3f6d1c0dd3d9bf29538181a0e930291b822dad8c) ) + + ROM_REGION( 0x20000, "gfx2", 0 ) + ROM_LOAD( "29.bin", 0x00000, 0x20000, CRC(8a5f274d) SHA1(0f2ad61b00e220fc509c01c11c1a8f4e47b54f2a) ) + + ROM_REGION( 0x40000, "oki", 0 ) /* Audio ADPCM */ + ROM_LOAD( "gs1-snd.bin", 0x0000, 0x20000, CRC(9d58960f) SHA1(c68edf95743e146398aabf6b9617d18e1f9bf25b) ) +ROM_END + +/* Moon Light (V.02L0A) + Rip off / clone of Gold Star. + + The program ROM is double size and stores two different programs. + Whilst we have not idea about the real addressing, we can support + both sets separately. GFX devices are 4 times bigger and contains 4 times the same data. Maybe the manufacturers run out of proper devices... @@ -8239,8 +8265,8 @@ ROM_END effect that shouldn't be there. Maybe is product of a bad dump. Need to be checked with the real board. - The hardware uses only the second half of the program ROM (double sized), that replaces - the double-up's cards graphics with 'drakkars' (scandinavian / viking ships). + The hardware currently uses only the second half of the program ROM (high program), that + replaces the double-up's cards graphics with 'drakkars' (scandinavian / viking ships). ---------------------------------------------------------------------------------------- 28.bin FIXED BITS (00xxxxxx) @@ -8262,15 +8288,29 @@ ROM_END 28.bin moon-gfx2.bin [4/4] 94.188690% */ ROM_START( moonlghtb ) + ROM_REGION( 0x20000, "maincpu", 0 ) // using only the first half of the program ROM. + ROM_LOAD( "moon-main.bin", 0x00000, 0x20000, CRC(0a4b5dd0) SHA1(825801e9b72c10fed8e07f42b3b475688bdbd878) ) // low program, normal gfx + + ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_LOAD( "28.bin", 0x00000, 0x20000, CRC(76915c0f) SHA1(3f6d1c0dd3d9bf29538181a0e930291b822dad8c) ) // Normal GFX, from the other PCB + + ROM_REGION( 0x20000, "gfx2", 0 ) + ROM_LOAD( "29.bin", 0x00000, 0x20000, CRC(8a5f274d) SHA1(0f2ad61b00e220fc509c01c11c1a8f4e47b54f2a) ) // Normal GFX, from the other PCB + + ROM_REGION( 0x40000, "oki", 0 ) /* Audio ADPCM */ + ROM_LOAD( "moon-sound.bin", 0x0000, 0x20000, CRC(9d58960f) SHA1(c68edf95743e146398aabf6b9617d18e1f9bf25b) ) +ROM_END + +ROM_START( moonlghtc ) ROM_REGION( 0x20000, "maincpu", 0 ) // using only the second half of the program ROM. - ROM_LOAD( "moon-main.bin", 0x10000, 0x10000, CRC(0a4b5dd0) SHA1(825801e9b72c10fed8e07f42b3b475688bdbd878) ) + ROM_LOAD( "moon-main.bin", 0x10000, 0x10000, CRC(0a4b5dd0) SHA1(825801e9b72c10fed8e07f42b3b475688bdbd878) ) // high program, alt gfx ROM_CONTINUE( 0x00000, 0x10000) ROM_REGION( 0x80000, "gfx1", 0 ) - ROM_LOAD( "moon-gfx2.bin", 0x00000, 0x80000, CRC(2ce5b722) SHA1(feb87fbf3b8d875842df80cd1edfef5071ed60c7) ) + ROM_LOAD( "moon-gfx2.bin", 0x00000, 0x80000, CRC(2ce5b722) SHA1(feb87fbf3b8d875842df80cd1edfef5071ed60c7) ) // Alt GFX set. Ships instead of cards ROM_REGION( 0x80000, "gfx2", 0 ) - ROM_LOAD( "moon-gfx1.bin", 0x00000, 0x80000, CRC(ea7d4234) SHA1(4016227aabf176c6e0fd822ebc59cade811f4ce8) ) + ROM_LOAD( "moon-gfx1.bin", 0x00000, 0x80000, CRC(ea7d4234) SHA1(4016227aabf176c6e0fd822ebc59cade811f4ce8) ) // Alt GFX set. Ships instead of cards ROM_REGION( 0x40000, "oki", 0 ) /* Audio ADPCM */ ROM_LOAD( "moon-sound.bin", 0x0000, 0x20000, CRC(9d58960f) SHA1(c68edf95743e146398aabf6b9617d18e1f9bf25b) ) @@ -13325,8 +13365,10 @@ DRIVER_INIT_MEMBER(goldstar_state, wcherry) YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS LAYOUT */ GAMEL( 199?, goldstar, 0, goldstar, goldstar, goldstar_state, goldstar, ROT0, "IGS", "Golden Star", 0, layout_goldstar ) GAMEL( 199?, goldstbl, goldstar, goldstbl, goldstar, driver_device, 0, ROT0, "IGS", "Golden Star (Blue version)", 0, layout_goldstar ) -GAME( 199?, moonlght, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (bootleg of Golden Star, set 1)", 0 ) -GAME( 199?, moonlghtb, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (bootleg of Golden Star, set 2)", MACHINE_IMPERFECT_COLORS ) // need to check the odd palette value at 0xc780. should be black. +GAME( 199?, moonlght, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (v.0629, low program)", 0 ) +GAME( 199?, moonlghta, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (v.0629, high program)", 0 ) +GAME( 199?, moonlghtb, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (v.02L0A, low program)", MACHINE_IMPERFECT_COLORS ) // need to check the odd palette value at 0xc780. should be black. +GAME( 199?, moonlghtc, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (v.02L0A, high program, alt gfx)", MACHINE_IMPERFECT_COLORS ) // need to check the odd palette value at 0xc780. should be black. GAMEL( 199?, chrygld, 0, chrygld, chrygld, cb3_state, chrygld, ROT0, "bootleg", "Cherry Gold I", 0, layout_chrygld ) GAMEL( 199?, chry10, 0, chrygld, chry10, cb3_state, chry10, ROT0, "bootleg", "Cherry 10 (bootleg with PIC16F84)", 0, layout_chrygld ) GAME( 199?, goldfrui, goldstar, goldfrui, goldstar, driver_device, 0, ROT0, "bootleg", "Gold Fruit", 0 ) // maybe fullname should be 'Gold Fruit (main 40%)' -- cgit v1.2.3-70-g09d2 From d300a51020bbf185c35fa89dcce9e814d3d3408d Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Tue, 9 Feb 2016 23:42:10 -0500 Subject: Xerox Notetaker: Added the IO Processor firmware v1.50 as an alt bios after typing it from the asm source listing on bitsavers. Added two PROMs as NO_DUMP. Updated comments and history a bit, but needs further improvement. [Lord Nightmare] --- src/mame/drivers/notetaker.cpp | 52 +++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index dd2e07217c3..260fb5af071 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -2,22 +2,34 @@ // copyright-holders:Jonathan Gevaryahu /* Xerox Notetaker, 1978 * Driver by Jonathan Gevaryahu - * prototype only, three? units manufactured (one at CHM, not sure where the other two are) - * This device was the origin of Smalltalk-78 - * NO MEDIA for this device has survived, only a ram dump - * see http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker + * + * + * Designed by Alan Kay and Many others, with BIOS written by Bruce Horn + * History of the machine can be found at http://freudenbergs.de/bert/publications/Ingalls-2014-Smalltalk78.pdf + * prototypes only, around 10 units manufactured 1978-1980 (one at CHM, not sure where the others are) + * This device was the origin of Smalltalk-78 (which acted as the operating system of the Notetaker) + * The Notetaker also introduced the BitBlt graphical operation, which was used to do most graphical functions in Smalltalk-78 + * As far as I am aware, no media (world disks/boot disks) for the Notetaker have survived, only an incomplete ram dump of the smalltalk-76 + * 'world' which was used to bootstrap smalltalk-78 originally + * + * see http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker for additional information + * http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19790620_Z-IOP_1.5_ls.pdf is listing of the biop v1.5 code * * MISSING DUMP for 8741? I/O MCU which does mouse-related stuff TODO: everything below. * Get the running machine smalltalk-78 memory dump loaded as a rom and forced into ram on startup, since no boot disks have survived * floppy controller wd1791 + According to http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19790620_Z-IOP_1.5_ls.pdf the format is 128 bytes per sector, 16 sectors per track (one sided) + According to the schematics, we're missing an 82s147 DISKSEP.PROM used as a data separator * crt5027 video controller -* pic8259 interrupt controller - this is attached as a device, but the interrupts are not hooked to it yet. * i8251? serial/EIA controller -* 6402 keyboard UART +* Harris 6402 keyboard UART * HLE for the missing MCU which reads the mouse quadratures and buttons +WIP: +* pic8259 interrupt controller - this is attached as a device, but the interrupts are not hooked to it yet. + */ #include "cpu/i86/i86.h" @@ -56,13 +68,14 @@ public: WRITE16_MEMBER(notetaker_state::IPConReg_w) { m_BootSeqDone = (data&0x80)?1:0; - //m_ProcLock = (data&0x40)?1:0; - //m_CharCtr = (data&0x20)?1:0; - m_DisableROM = (data&0x10)?1:0; + //m_ProcLock = (data&0x40)?1:0; // processor lock + //m_CharCtr = (data&0x20)?1:0; // battery charge control + m_DisableROM = (data&0x10)?1:0; // disable rom at 0000-0fff //m_CorrOn = (data&0x08)?1:0; // also LedInd5 //m_LedInd6 = (data&0x04)?1:0; //m_LedInd7 = (data&0x02)?1:0; //m_LedInd8 = (data&0x01)?1:0; + popmessage("LEDS: CR1: %d, CR2: %d, CR3: %d, CR4: %d", (data&0x04)>>2, (data&0x08)>>3, (data&0x02)>>1, (data&0x01)); // cr1 and 2 are in the reverse order as expected, according to the schematic } READ16_MEMBER(notetaker_state::maincpu_r) @@ -143,7 +156,7 @@ ADDRESS_MAP_END 0x02 to port 0x100 (IOR write: enable 5v only relay control for powering up 4116 dram enabled) 0x03 to port 0x100 (IOR write: in addition to above, enable 12v relay control for powering up 4116 dram enabled) -0x13 to port 0x000 (?????) +0x13 to port 0x000 PIC (?????) 0x08 to port 0x002 PIC (UART int enabled) 0x0D to port 0x002 PIC (UART, wd1791, and parity error int enabled) 0xff to port 0x002 PIC (all ints enabled) @@ -181,13 +194,13 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( notetakr, notetaker_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, XTAL_24MHz/3) /* 24Mhz crystal divided down by i8284 clock generator */ + MCFG_CPU_ADD("maincpu", I8086, XTAL_24MHz/3) /* iD8086-2 @ E4A; 24Mhz crystal divided down to 8Mhz by i8284 clock generator */ MCFG_CPU_PROGRAM_MAP(notetaker_mem) MCFG_CPU_IO_MAP(notetaker_io) MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - MCFG_PIC8259_ADD("pic8259", INPUTLINE("maincpu", 0), VCC, NULL) + MCFG_PIC8259_ADD("pic8259", INPUTLINE("maincpu", 0), VCC, NULL) // iP8259A-2 @ E6 - //Note there is a second i8086 cpu on the 'emulator board', which is probably loaded with code once smalltalk boots + //Note there is a second i8086 cpu on the 'emulator board', which is probably loaded with code once smalltalk-78 loads /* video hardware */ /*MCFG_SCREEN_ADD("screen", RASTER) @@ -209,7 +222,7 @@ MACHINE_CONFIG_END DRIVER_INIT_MEMBER(notetaker_state,notetakr) { - // descramble the rom; the whole thing is a gigantic scrambled mess probably to ease + // descramble the rom; the whole thing is a gigantic scrambled mess either to ease // interfacing with older xerox technologies which used A0 and D0 as the MSB bits // or maybe because someone screwed up somewhere along the line. we may never know. // see http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker/schematics/19790423_Notetaker_IO_Processor.pdf pages 12 and onward @@ -233,10 +246,17 @@ DRIVER_INIT_MEMBER(notetaker_state,notetakr) /* ROM definition */ ROM_START( notetakr ) ROM_REGION( 0x1000, "maincpuload", ROMREGION_ERASEFF ) // load roms here before descrambling - ROMX_LOAD( "biop__2.00_hi.b2716.h1", 0x0000, 0x0800, CRC(1119691d) SHA1(4c20b595b554e6f5489ab2c3fb364b4a052f05e3), ROM_SKIP(1)) - ROMX_LOAD( "biop__2.00_lo.b2716.g1", 0x0001, 0x0800, CRC(b72aa4c7) SHA1(85dab2399f906c7695dc92e7c18f32e2303c5892), ROM_SKIP(1)) + ROM_SYSTEM_BIOS( 0, "v2.00", "IO Monitor v2.00" ) // dumped from Notetaker + ROMX_LOAD( "biop__2.00_hi.b2716.h1", 0x0000, 0x0800, CRC(1119691d) SHA1(4c20b595b554e6f5489ab2c3fb364b4a052f05e3), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "biop__2.00_lo.b2716.g1", 0x0001, 0x0800, CRC(b72aa4c7) SHA1(85dab2399f906c7695dc92e7c18f32e2303c5892), ROM_SKIP(1) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v1.50", "IO Monitor v1.50" ) // typed from the source listing at http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19790620_Z-IOP_1.5_ls.pdf and scrambled + ROMX_LOAD( "z-iop_1.50_hi.h1", 0x0000, 0x0800, CRC(2994656e) SHA1(ca2bb38eb9075c5c2f3cc5439b209e7e216084da), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "z-iop_1.50_lo.g1", 0x0001, 0x0800, CRC(3bcd08ff) SHA1(b687e295322dcbaafed59ad2573ab12373cb6537), ROM_SKIP(1) | ROM_BIOS(2)) ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) // area for descrambled roms ROM_REGION( 0x100000, "ram", ROMREGION_ERASEFF ) // ram cards + ROM_REGION( 0x1000, "proms", ROMREGION_ERASEFF ) + ROM_LOAD( "disksep.prom.82s147.a4", 0x000, 0x200, NO_DUMP ) // disk data separator prom from the disk/display module board + ROM_LOAD( "setmemrq.prom.82s126.d9", 0x200, 0x100, NO_DUMP ) // SETMEMRQ memory timing prom from the disk/display module board ROM_END /* Driver */ -- cgit v1.2.3-70-g09d2 From 5258f167af35470690710e3f63069fc124f2dffc Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Wed, 10 Feb 2016 01:55:10 -0500 Subject: Fix a typo in the 1.50 rom from typing it from the pdf which broke the BitBlt function; there may be more typos in there. (nw) --- src/mame/drivers/notetaker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index 260fb5af071..d1bfcc2e5d2 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -251,7 +251,7 @@ ROM_START( notetakr ) ROMX_LOAD( "biop__2.00_lo.b2716.g1", 0x0001, 0x0800, CRC(b72aa4c7) SHA1(85dab2399f906c7695dc92e7c18f32e2303c5892), ROM_SKIP(1) | ROM_BIOS(1)) ROM_SYSTEM_BIOS( 1, "v1.50", "IO Monitor v1.50" ) // typed from the source listing at http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19790620_Z-IOP_1.5_ls.pdf and scrambled ROMX_LOAD( "z-iop_1.50_hi.h1", 0x0000, 0x0800, CRC(2994656e) SHA1(ca2bb38eb9075c5c2f3cc5439b209e7e216084da), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "z-iop_1.50_lo.g1", 0x0001, 0x0800, CRC(3bcd08ff) SHA1(b687e295322dcbaafed59ad2573ab12373cb6537), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "z-iop_1.50_lo.g1", 0x0001, 0x0800, CRC(2cb79a67) SHA1(692aafd2aeea27533f6288dbb1cb8678ea08fade), ROM_SKIP(1) | ROM_BIOS(2)) ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) // area for descrambled roms ROM_REGION( 0x100000, "ram", ROMREGION_ERASEFF ) // ram cards ROM_REGION( 0x1000, "proms", ROMREGION_ERASEFF ) -- cgit v1.2.3-70-g09d2 From 999917d76f1a9321aebe89c64a8564e2fa50661e Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 11 Feb 2016 01:37:24 +1100 Subject: Replace some interrupt gen members with MCFG glue (nw) --- src/mame/audio/laserbat.cpp | 6 ------ src/mame/drivers/laserbat.cpp | 19 ++++++++----------- src/mame/drivers/zaccaria.cpp | 13 ++++--------- src/mame/includes/laserbat.h | 10 ---------- src/mame/includes/zaccaria.h | 3 +-- 5 files changed, 13 insertions(+), 38 deletions(-) diff --git a/src/mame/audio/laserbat.cpp b/src/mame/audio/laserbat.cpp index b16c4d73388..ef26a168f31 100644 --- a/src/mame/audio/laserbat.cpp +++ b/src/mame/audio/laserbat.cpp @@ -388,9 +388,3 @@ READ8_MEMBER(catnmous_state::psg1_portb_r) // assume they're not connected and read high from the internal pull-ups return m_csound1 | 0xe0; } - -INTERRUPT_GEN_MEMBER(catnmous_state::cb1_toggle) -{ - m_cb1 = !m_cb1; - m_pia->cb1_w(m_cb1 ? 1 : 0); -} diff --git a/src/mame/drivers/laserbat.cpp b/src/mame/drivers/laserbat.cpp index 58d0fd3f464..c1a072ac821 100644 --- a/src/mame/drivers/laserbat.cpp +++ b/src/mame/drivers/laserbat.cpp @@ -83,6 +83,8 @@ #include "cpu/m6800/m6800.h" #include "cpu/s2650/s2650.h" +#include "machine/clock.h" + WRITE8_MEMBER(laserbat_state_base::ct_io_w) { @@ -459,13 +461,6 @@ void laserbat_state::machine_start() save_item(NAME(m_keys)); } -void catnmous_state::machine_start() -{ - laserbat_state_base::machine_start(); - - save_item(NAME(m_cb1)); -} - void laserbat_state_base::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) @@ -550,9 +545,11 @@ static MACHINE_CONFIG_DERIVED_CLASS( catnmous, laserbat_base, catnmous_state ) MCFG_PALETTE_INIT_OWNER(catnmous_state, catnmous) // sound board devices - MCFG_CPU_ADD("audiocpu", M6802, 3580000) // ? + MCFG_CPU_ADD("audiocpu", M6802, XTAL_3_579545MHz) MCFG_CPU_PROGRAM_MAP(catnmous_sound_map) - MCFG_CPU_PERIODIC_INT_DRIVER(catnmous_state, cb1_toggle, (double)3580000/4096) + + MCFG_DEVICE_ADD("timebase", CLOCK, XTAL_3_579545MHz/4096/2) // CPU clock divided with 4040 and half of 7474 + MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("pia", pia6821_device, cb1_w)) MCFG_DEVICE_ADD("pia", PIA6821, 0) MCFG_PIA_READPA_HANDLER(READ8(catnmous_state, pia_porta_r)) @@ -563,11 +560,11 @@ static MACHINE_CONFIG_DERIVED_CLASS( catnmous, laserbat_base, catnmous_state ) MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("psg1", AY8910, 3580000/2) // ? + MCFG_SOUND_ADD("psg1", AY8910, XTAL_3_579545MHz/2) // CPU clock divided with 4040 MCFG_AY8910_PORT_B_READ_CB(READ8(catnmous_state, psg1_portb_r)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - MCFG_SOUND_ADD("psg2", AY8910, 3580000/2) // ? + MCFG_SOUND_ADD("psg2", AY8910, XTAL_3_579545MHz/2) // CPU clock divided with 4040 MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/zaccaria.cpp b/src/mame/drivers/zaccaria.cpp index a002b46b6d0..3cc556bf7ab 100644 --- a/src/mame/drivers/zaccaria.cpp +++ b/src/mame/drivers/zaccaria.cpp @@ -54,7 +54,6 @@ void zaccaria_state::machine_start() save_item(NAME(m_port0a)); save_item(NAME(m_acs)); save_item(NAME(m_last_port0b)); - save_item(NAME(m_toggle)); save_item(NAME(m_nmi_mask)); } @@ -65,7 +64,6 @@ void zaccaria_state::machine_reset() m_port0a = 0; m_acs = 0; m_last_port0b = 0; - m_toggle = 0; m_nmi_mask = 0; } @@ -158,12 +156,6 @@ WRITE8_MEMBER(zaccaria_state::port0b_w) m_last_port0b = data; } -INTERRUPT_GEN_MEMBER(zaccaria_state::cb1_toggle) -{ - m_pia0->cb1_w(m_toggle & 1); - m_toggle ^= 1; -} - WRITE8_MEMBER(zaccaria_state::port1b_w) { // bit 0 = /RS @@ -510,7 +502,10 @@ static MACHINE_CONFIG_START( zaccaria, zaccaria_state ) MCFG_CPU_ADD("audiocpu", M6802,XTAL_3_579545MHz) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(sound_map_1) - MCFG_CPU_PERIODIC_INT_DRIVER(zaccaria_state, cb1_toggle, (double)XTAL_3_579545MHz/4096) + + MCFG_DEVICE_ADD("timebase", CLOCK, XTAL_3_579545MHz/4096/2) /* verified on pcb */ + MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("pia0", pia6821_device, cb1_w)) + // MCFG_QUANTUM_TIME(attotime::from_hz(1000000)) MCFG_CPU_ADD("audio2", M6802,XTAL_3_579545MHz) /* verified on pcb */ diff --git a/src/mame/includes/laserbat.h b/src/mame/includes/laserbat.h index f6d35ca93d6..1df1e972b4e 100644 --- a/src/mame/includes/laserbat.h +++ b/src/mame/includes/laserbat.h @@ -189,7 +189,6 @@ public: , m_pia(*this, "pia") , m_psg1(*this, "psg1") , m_psg2(*this, "psg2") - , m_cb1(false) { } @@ -211,20 +210,11 @@ public: DECLARE_WRITE8_MEMBER(psg1_porta_w); DECLARE_READ8_MEMBER(psg1_portb_r); - // periodic signal generators - INTERRUPT_GEN_MEMBER(cb1_toggle); - protected: - // initialisation/startup - virtual void machine_start() override; - // sound board devices required_device m_audiocpu; required_device m_pia; required_device m_psg1; required_device m_psg2; - - // control line states - bool m_cb1; }; diff --git a/src/mame/includes/zaccaria.h b/src/mame/includes/zaccaria.h index 8371e6b6fb0..62a76a1df44 100644 --- a/src/mame/includes/zaccaria.h +++ b/src/mame/includes/zaccaria.h @@ -1,6 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria #include "machine/6821pia.h" +#include "machine/clock.h" #include "sound/ay8910.h" #include "sound/tms5220.h" @@ -48,7 +49,6 @@ public: int m_port0a; int m_acs; int m_last_port0b; - int m_toggle; tilemap_t *m_bg_tilemap; UINT8 m_nmi_mask; @@ -76,7 +76,6 @@ public: virtual void video_start() override; DECLARE_PALETTE_INIT(zaccaria); UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(cb1_toggle); INTERRUPT_GEN_MEMBER(vblank_irq); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT8 *spriteram,int color,int section); }; -- cgit v1.2.3-70-g09d2 From cd1d9b7a2b997350ff548741808356206630bca4 Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Wed, 10 Feb 2016 12:14:32 -0500 Subject: Fix DTD/XML validation error (nw) --- hash/electron_cass.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash/electron_cass.xml b/hash/electron_cass.xml index 1ce422fddd5..e3233beae5b 100644 --- a/hash/electron_cass.xml +++ b/hash/electron_cass.xml @@ -1,4 +1,4 @@ - + -- cgit v1.2.3-70-g09d2 From a686075690f70e97eb01fe50a9953193da9d87be Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 10 Feb 2016 16:30:36 -0300 Subject: New clones added or promoted from NOT_WORKING status ---------------------------------------------------- Cherry Gold I (set 2, encrypted bootleg) [Roberto Fresca, f205v] --- src/mame/arcade.lst | 1 + src/mame/drivers/goldstar.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index cbf2ba36ceb..69bf96f7021 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -10080,6 +10080,7 @@ moonlghtb // bootleg moonlghtc // bootleg chry10 // bootleg chrygld // bootleg +chryglda // bootleg goldfrui // bootleg wcherry // bootleg super9 // (c) 2001 Playmark diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 8c3c4d71612..95bc6184865 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -8538,6 +8538,58 @@ ROM_START( cb3e ) ROM_END +/* Cherry Gold I (bootleg) + It runs in CB3e similar hardware... + +1x TMPZ84C00AP-6 u15 8-bit Microprocessor +3x D71055C u30, u39, u40 Programmable Peripheral Interface +1x WF19054 u27 Programmable Sound Generator +1x SN76489AN u28 Digital Complex Sound Generator +1x oscillator unmarked Y1 + +ROMs +1x D27256 1.u3 +1x AM27512 3.u22 +1x D27C010 2u6 +1x N82S147AF u1 + +RAMs +4x HM6116LP-4 u9, u10, u11, u12 +1x D4016C-1 u23 + +PLDs +1x unknowun Cl-001 (QFP144) CY144A read protected +4x GAL20V8A-15LNC pl1, pl4, pl5, pl6 read protected +2x PALCE20V8H-25PC/4 u2,u? read protected +1x PALCE22V10H-25PC/4 u? read protected + +Others +1x 36x2 edge connector +1x 10x2 edge connector +1x pushbutton (TS) +2x trimmer (volume)(VR1,VR2) +5x 8x2 switches DIP(SW1-5) +1x battery 5,5V + +Notes +PCB is marked "REV.3" +*/ +ROM_START( chryglda ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "3.u22", 0x00000, 0x10000, CRC(059857c5) SHA1(f4becfda1e25ab347f55f35dc9f5818ef9344e2c) ) + + ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_LOAD( "2.u6", 0x00000, 0x20000, CRC(1359dfac) SHA1(78eb934055cda9e10d8e939c79bfa62262ecad7d) ) + + ROM_REGION( 0x08000, "gfx2", 0 ) + ROM_LOAD( "1.u3", 0x00000, 0x08000, CRC(919bd692) SHA1(1aeb66f1e4555b731858833445000593e613f74d) ) + + ROM_REGION( 0x0200, "proms", 0 ) + ROM_LOAD( "n82s147af.u1", 0x00000, 0x0100, CRC(d4eaa276) SHA1(b6598ee64ac3d41ca979c8667de8576cfb304451) ) + ROM_CONTINUE( 0x00000, 0x0100) // 2nd half has the data. +ROM_END + + ROM_START( cmv801 ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "prg512", 0x0000, 0x10000, CRC(2f6e3fe9) SHA1(c5ffa51478a0dc2d8ff6a0f286cfb461011bb55d) ) @@ -13369,7 +13421,7 @@ GAME( 199?, moonlght, goldstar, moonlght, goldstar, driver_device, 0, GAME( 199?, moonlghta, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (v.0629, high program)", 0 ) GAME( 199?, moonlghtb, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (v.02L0A, low program)", MACHINE_IMPERFECT_COLORS ) // need to check the odd palette value at 0xc780. should be black. GAME( 199?, moonlghtc, goldstar, moonlght, goldstar, driver_device, 0, ROT0, "bootleg", "Moon Light (v.02L0A, high program, alt gfx)", MACHINE_IMPERFECT_COLORS ) // need to check the odd palette value at 0xc780. should be black. -GAMEL( 199?, chrygld, 0, chrygld, chrygld, cb3_state, chrygld, ROT0, "bootleg", "Cherry Gold I", 0, layout_chrygld ) +GAMEL( 199?, chrygld, 0, chrygld, chrygld, cb3_state, chrygld, ROT0, "bootleg", "Cherry Gold I (set 1)", 0, layout_chrygld ) GAMEL( 199?, chry10, 0, chrygld, chry10, cb3_state, chry10, ROT0, "bootleg", "Cherry 10 (bootleg with PIC16F84)", 0, layout_chrygld ) GAME( 199?, goldfrui, goldstar, goldfrui, goldstar, driver_device, 0, ROT0, "bootleg", "Gold Fruit", 0 ) // maybe fullname should be 'Gold Fruit (main 40%)' GAME( 2001, super9, goldstar, super9, goldstar, goldstar_state, super9, ROT0, "Playmark", "Super Nove (Playmark)", MACHINE_NOT_WORKING ) // need to decode gfx and see the program loops/reset... @@ -13385,6 +13437,7 @@ GAMEL( 199?, cb3b, ncb3, cherrys, ncb3, cb3_state, cherrys, GAME( 199?, cb3c, ncb3, cb3c, chrygld, cb3_state, cb3, ROT0, "bootleg", "Cherry Bonus III (alt, set 2)", MACHINE_NOT_WORKING) GAMEL( 199?, cb3d, ncb3, ncb3, ncb3, driver_device, 0, ROT0, "bootleg", "Cherry Bonus III (set 3)", 0, layout_cherryb3 ) GAMEL( 199?, cb3e, ncb3, cb3e, chrygld, cb3_state, cb3e, ROT0, "bootleg", "Cherry Bonus III (set 4, encrypted bootleg)", 0, layout_chrygld ) +GAMEL( 199?, chryglda, ncb3, cb3e, chrygld, cb3_state, cb3e, ROT0, "bootleg", "Cherry Gold I (set 2, encrypted bootleg)", 0, layout_chrygld ) // Runs in CB3e hardware. GAME( 1996, cmast97, ncb3, cm97, chrygld, driver_device, 0, ROT0, "Dyna", "Cherry Master '97", MACHINE_NOT_WORKING) // fix prom decode -- cgit v1.2.3-70-g09d2 From a9cfa69af926a252a623beacecc36212837c94cc Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Wed, 10 Feb 2016 14:37:51 -0500 Subject: Update NoteTaker notes and history a bit (nw) --- src/mame/drivers/notetaker.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index d1bfcc2e5d2..1e7bde4ff6f 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -1,19 +1,24 @@ // license:BSD-3-Clause // copyright-holders:Jonathan Gevaryahu -/* Xerox Notetaker, 1978 +/* Xerox NoteTaker, 1978 * Driver by Jonathan Gevaryahu * - * - * Designed by Alan Kay and Many others, with BIOS written by Bruce Horn + * + * Designed by Alan Kay and many others, with BIOS written by Bruce Horn (BitBlt function in BIOS written by Dan Ingalls) * History of the machine can be found at http://freudenbergs.de/bert/publications/Ingalls-2014-Smalltalk78.pdf - * prototypes only, around 10 units manufactured 1978-1980 (one at CHM, not sure where the others are) - * This device was the origin of Smalltalk-78 (which acted as the operating system of the Notetaker) - * The Notetaker also introduced the BitBlt graphical operation, which was used to do most graphical functions in Smalltalk-78 - * As far as I am aware, no media (world disks/boot disks) for the Notetaker have survived, only an incomplete ram dump of the smalltalk-76 - * 'world' which was used to bootstrap smalltalk-78 originally - * + * prototypes only, around 10 units manufactured 1978-1980 + One at CHM (missing? mouse, no media) + One at Xerox Museum at PARC (with mouse and 2 floppies, no floppy images available) + * This device was the origin of Smalltalk-78 (which acted as the operating system of the NoteTaker) + * The NoteTaker also used the BitBlt graphical operation to do most graphical functions in Smalltalk-78 + BitBlt was not invented for the NoteTaker, but for the Alto; however unlike the Alto, the NoteTaker used it for almost every graphical operation. + * As far as I am aware, no media (world disks/boot disks) for the NoteTaker have survived (except maybe the two disks at Xerox Museum at PARC), but an incomplete dump of the Smalltalk-76 'world' which was used to bootstrap Smalltalk-78 originally did survive on the Alto disks at CHM + * see http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker for additional information * http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19790620_Z-IOP_1.5_ls.pdf is listing of the biop v1.5 code + * see http://xeroxalto.computerhistory.org/Filene/Smalltalk-76/ for the smalltalk-76 dump + * see http://xeroxalto.computerhistory.org/Indigo/BasicDisks/Smalltalk14.bfs!1_/ for more notetaker/smalltalk related files * * MISSING DUMP for 8741? I/O MCU which does mouse-related stuff @@ -116,9 +121,13 @@ BootSeqDone is 1, DisableROM is 0, mem map is 0x00000-0x00fff reading is t BootSeqDone is 1, DisableROM is 1, mem map is entirely RAM or open bus for both reading and writing. */ static ADDRESS_MAP_START(notetaker_mem, AS_PROGRAM, 16, notetaker_state) - /*AM_RANGE(0x00000, 0x00fff) AM_ROM AM_REGION("maincpu", 0xFF000) // I think this copy of rom is actually banked via io reg 0x20, there is RAM which lives behind here? - AM_RANGE(0x01000, 0x3ffff) AM_RAM // ram lives here, 256KB - AM_RANGE(0xff000, 0xfffff) AM_ROM // is this banked too? Don't think so...*/ + /* + AM_RANGE(0x00000, 0x00fff) AM_ROM AM_REGION("maincpu", 0xFF000) // rom is here if either BootSeqDone OR DisableROM are zero. the 1.5 source code implies writes here are ignored + AM_RANGE(0x01000, 0x01fff) AM_RAM // 4k of ram, local to the io processor + AM_RANGE(0x02000, 0x3ffff) AM_RAM AM_BASE("sharedram") // 256k of ram (less 8k), shared between both processors + // note 4000-8fff? is the framebuffer for the screen? + AM_RANGE(0xff000, 0xfffff) AM_ROM // rom is only banked in here if bootseqdone is 0, so the reset vector is in the proper place + */ AM_RANGE(0x00000, 0xfffff) AM_READWRITE(maincpu_r, maincpu_w) // bypass MAME's memory map system as we need finer grained control ADDRESS_MAP_END @@ -256,7 +265,7 @@ ROM_START( notetakr ) ROM_REGION( 0x100000, "ram", ROMREGION_ERASEFF ) // ram cards ROM_REGION( 0x1000, "proms", ROMREGION_ERASEFF ) ROM_LOAD( "disksep.prom.82s147.a4", 0x000, 0x200, NO_DUMP ) // disk data separator prom from the disk/display module board - ROM_LOAD( "setmemrq.prom.82s126.d9", 0x200, 0x100, NO_DUMP ) // SETMEMRQ memory timing prom from the disk/display module board + ROM_LOAD( "setmemrq.prom.82s126.d9", 0x200, 0x100, NO_DUMP ) // SETMEMRQ memory timing prom from the disk/display module board; The equations for this one are actually listed on the schematic, so it should be pretty easy to recreate. ROM_END /* Driver */ -- cgit v1.2.3-70-g09d2 From bc2ef66756bf9605c1b6ab176798a1c1613a0eb0 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Wed, 10 Feb 2016 22:25:43 +0100 Subject: simpleselgame: The zeroing of the search does not require a reload. nw --- src/emu/ui/simpleselgame.cpp | 4 ++-- src/emu/ui/simpleselgame.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/emu/ui/simpleselgame.cpp b/src/emu/ui/simpleselgame.cpp index 8f5ada60071..0c0705e8414 100644 --- a/src/emu/ui/simpleselgame.cpp +++ b/src/emu/ui/simpleselgame.cpp @@ -181,8 +181,8 @@ void ui_simple_menu_select_game::inkey_cancel(const ui_menu_event *menu_event) // escape pressed with non-empty text clears the text if (m_search[0] != 0) { - // since we have already been popped, we must recreate ourself from scratch - ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); + m_search[0] = '\0'; + reset(UI_MENU_RESET_SELECT_FIRST); } } diff --git a/src/emu/ui/simpleselgame.h b/src/emu/ui/simpleselgame.h index 50fcf10a432..316e3747b2f 100644 --- a/src/emu/ui/simpleselgame.h +++ b/src/emu/ui/simpleselgame.h @@ -27,6 +27,7 @@ public: // force game select menu static void force_game_select(running_machine &machine, render_container *container); + virtual bool menu_has_search_active() override { return (m_search[0] != 0); } private: // internal state enum { VISIBLE_GAMES_IN_LIST = 15 }; -- cgit v1.2.3-70-g09d2 From 186febc3dc45a7339b80bc50a1a3e5b270b855c4 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Wed, 10 Feb 2016 22:27:02 +0100 Subject: dsplmenu: re-added opengl video item. nw --- src/emu/ui/dsplmenu.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp index 71ca4812cf8..57797f6281e 100644 --- a/src/emu/ui/dsplmenu.cpp +++ b/src/emu/ui/dsplmenu.cpp @@ -66,23 +66,25 @@ ui_menu_display_options::ui_menu_display_options(running_machine &machine, rende // create video list m_list.push_back("auto"); + m_list.push_back("opengl"); // TODO: check USE_OPENGL std::string descr = options.description(OSDOPTION_VIDEO); - std::string delim = ", "; descr.erase(0, descr.find(":") + 2); - size_t start = 0; - size_t end = descr.find_first_of(delim, start); - while (end != std::string::npos) + std::string delim = ", "; + size_t p1, p2 = 0; + for (;;) { - std::string name = descr.substr(start, end - start); - if (name != "none" && name != "or") - m_list.push_back(name); - start = descr.find_first_not_of(delim, end); - if (start == std::string::npos) + p1 = descr.find_first_not_of(delim, p2); + if (p1 == std::string::npos) + break; + p2 = descr.find_first_of(delim, p1 + 1); + if (p2 != std::string::npos) + m_list.push_back(descr.substr(p1, p2 - p1)); + else + { + m_list.push_back(descr.substr(p1)); break; - end = descr.find_first_of(delim, start); - if (end == std::string::npos) - end = descr.size(); + } } m_options[1].status = 0; -- cgit v1.2.3-70-g09d2 From cd05adafe0fa1b23713cfbea9402f8decbf3f345 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Wed, 10 Feb 2016 22:38:08 +0100 Subject: ui: Removed the creation of cache file 'info_', and also removed 'Screen Type', '(no)Samples' and 'Stereo' filters. (TODO: pending to restore them in a proper manner). --- src/emu/ui/custmenu.cpp | 36 ------ src/emu/ui/optsmenu.cpp | 34 ------ src/emu/ui/optsmenu.h | 1 - src/emu/ui/selgame.cpp | 297 +++++++----------------------------------------- src/emu/ui/selgame.h | 15 +-- src/emu/ui/utils.cpp | 8 +- src/emu/ui/utils.h | 6 - 7 files changed, 48 insertions(+), 349 deletions(-) diff --git a/src/emu/ui/custmenu.cpp b/src/emu/ui/custmenu.cpp index 45ca407a84b..2abbd533d75 100644 --- a/src/emu/ui/custmenu.cpp +++ b/src/emu/ui/custmenu.cpp @@ -106,29 +106,6 @@ void ui_menu_custom_filter::handle() ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, custfltr::other[pos])); } } - else if ((FPTR)m_event->itemref >= SCREEN_FILTER && (FPTR)m_event->itemref < SCREEN_FILTER + MAX_CUST_FILTER) - { - int pos = (int)((FPTR)m_event->itemref - SCREEN_FILTER); - if (m_event->iptkey == IPT_UI_LEFT && custfltr::screen[pos] > 0) - { - custfltr::screen[pos]--; - changed = true; - } - else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::screen[pos] < screen_filters::length - 1) - { - custfltr::screen[pos]++; - changed = true; - } - else if (m_event->iptkey == IPT_UI_SELECT) - { - size_t total = screen_filters::length; - std::vector s_sel(total); - for (size_t index = 0; index < total; ++index) - s_sel[index] = screen_filters::text[index]; - - ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, custfltr::screen[pos])); - } - } else if ((FPTR)m_event->itemref >= YEAR_FILTER && (FPTR)m_event->itemref < YEAR_FILTER + MAX_CUST_FILTER) { int pos = (int)((FPTR)m_event->itemref - YEAR_FILTER); @@ -207,16 +184,6 @@ void ui_menu_custom_filter::populate() convert_command_glyph(fbuff); item_append(fbuff.c_str(), c_year::ui[custfltr::year[x]].c_str(), arrow_flags, (void *)(FPTR)(YEAR_FILTER + x)); } - - // add screen subitem - else if (custfltr::other[x] == FILTER_SCREEN) - { - arrow_flags = get_arrow_flags(0, screen_filters::length - 1, custfltr::screen[x]); - std::string fbuff("^!Screen type"); - convert_command_glyph(fbuff); - item_append(fbuff.c_str(), screen_filters::text[custfltr::screen[x]], arrow_flags, (void *)(FPTR)(SCREEN_FILTER + x)); - } - } item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); @@ -228,7 +195,6 @@ void ui_menu_custom_filter::populate() item_append("Add filter", nullptr, 0, (void *)(FPTR)ADD_FILTER); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } @@ -287,8 +253,6 @@ void ui_menu_custom_filter::save_custom_filters() cinfo.append(" Manufacturer filter = ").append(c_mnfct::ui[custfltr::mnfct[x]]).append("\n"); else if (custfltr::other[x] == FILTER_YEAR) cinfo.append(" Year filter = ").append(c_year::ui[custfltr::year[x]]).append("\n"); - else if (custfltr::other[x] == FILTER_SCREEN) - cinfo.append(" Screen filter = ").append(screen_filters::text[custfltr::screen[x]]).append("\n"); } file.puts(cinfo.c_str()); file.close(); diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp index 1884547d8c5..44ed9e11a37 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/emu/ui/optsmenu.cpp @@ -77,7 +77,6 @@ void ui_menu_game_options::handle() } break; } - case FILE_CATEGORY_FILTER: { if (m_event->iptkey == IPT_UI_LEFT) @@ -105,7 +104,6 @@ void ui_menu_game_options::handle() } break; } - case CATEGORY_FILTER: { if (m_event->iptkey == IPT_UI_LEFT) @@ -131,7 +129,6 @@ void ui_menu_game_options::handle() } break; } - case MANUFACT_CAT_FILTER: if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) { @@ -142,7 +139,6 @@ void ui_menu_game_options::handle() ui_menu::stack_push(global_alloc_clear(machine(), container, c_mnfct::ui, c_mnfct::actual)); break; - case YEAR_CAT_FILTER: if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) { @@ -153,44 +149,22 @@ void ui_menu_game_options::handle() ui_menu::stack_push(global_alloc_clear(machine(), container, c_year::ui, c_year::actual)); break; - - case SCREEN_CAT_FILTER: - if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) - { - (m_event->iptkey == IPT_UI_RIGHT) ? screen_filters::actual++ : screen_filters::actual--; - changed = true; - } - else if (m_event->iptkey == IPT_UI_SELECT) - { - std::vector text(screen_filters::length); - for (int x = 0; x < screen_filters::length; ++x) - text[x] = screen_filters::text[x]; - - ui_menu::stack_push(global_alloc_clear(machine(), container, text, screen_filters::actual)); - } - - break; - case MISC_MENU: if (m_event->iptkey == IPT_UI_SELECT) ui_menu::stack_push(global_alloc_clear(machine(), container)); break; - case SOUND_MENU: if (m_event->iptkey == IPT_UI_SELECT) ui_menu::stack_push(global_alloc_clear(machine(), container)); break; - case DISPLAY_MENU: if (m_event->iptkey == IPT_UI_SELECT) ui_menu::stack_push(global_alloc_clear(machine(), container)); break; - case CUSTOM_MENU: if (m_event->iptkey == IPT_UI_SELECT) ui_menu::stack_push(global_alloc_clear(machine(), container)); break; - case CONTROLLER_MENU: if (m_event->iptkey == IPT_UI_SELECT) ui_menu::stack_push(global_alloc_clear(machine(), container)); @@ -258,14 +232,6 @@ void ui_menu_game_options::populate() convert_command_glyph(fbuff); item_append(fbuff.c_str(), c_year::ui[c_year::actual].c_str(), arrow_flags, (void *)(FPTR)YEAR_CAT_FILTER); } - // add screen subitem - else if (main_filters::actual == FILTER_SCREEN) - { - arrow_flags = get_arrow_flags(0, screen_filters::length - 1, screen_filters::actual); - fbuff = "^!Screen type"; - convert_command_glyph(fbuff); - item_append(fbuff.c_str(), screen_filters::text[screen_filters::actual], arrow_flags, (void *)(FPTR)SCREEN_CAT_FILTER); - } // add custom subitem else if (main_filters::actual == FILTER_CUSTOM) { diff --git a/src/emu/ui/optsmenu.h b/src/emu/ui/optsmenu.h index b62e5712de9..13e857ec7ba 100644 --- a/src/emu/ui/optsmenu.h +++ b/src/emu/ui/optsmenu.h @@ -29,7 +29,6 @@ private: FILE_CATEGORY_FILTER, MANUFACT_CAT_FILTER, YEAR_CAT_FILTER, - SCREEN_CAT_FILTER, CATEGORY_FILTER, MISC_MENU, DISPLAY_MENU, diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 2b5139f6cc3..bf03a4af034 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -37,6 +37,9 @@ extern const char UI_VERSION_TAG[]; static bool first_start = true; static const char *dats_info[] = { "General Info", "History", "Mameinfo", "Sysinfo", "Messinfo", "Command", "Mamescore" }; +std::vector ui_menu_select_game::m_sortedlist; +int ui_menu_select_game::m_isabios = 0; + //------------------------------------------------- // sort //------------------------------------------------- @@ -162,7 +165,7 @@ ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_contai ui_options &moptions = machine.ui().options(); // load drivers cache - load_cache_info(); + init_sorted_list(); // build drivers list if (!load_available_machines()) @@ -184,6 +187,7 @@ ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_contai sub_filter = tmp.substr(found + 1); } + main_filters::actual = FILTER_ALL; for (size_t ind = 0; ind < main_filters::length; ++ind) if (last_filter == main_filters::text[ind]) { @@ -205,12 +209,6 @@ ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_contai if (sub_filter == c_year::ui[id]) c_year::actual = id; } - else if (main_filters::actual == FILTER_SCREEN) - { - for (size_t id = 0; id < screen_filters::length; ++id) - if (sub_filter == screen_filters::text[id]) - screen_filters::actual = id; - } first_start = false; } @@ -253,8 +251,6 @@ ui_menu_select_game::~ui_menu_select_game() filter.append(",").append(c_mnfct::ui[c_mnfct::actual]); else if (main_filters::actual == FILTER_YEAR) filter.append(",").append(c_year::ui[c_year::actual]); - else if (main_filters::actual == FILTER_SCREEN) - filter.append(",").append(screen_filters::text[screen_filters::actual]); mopt.set_value(OPTION_LAST_USED_FILTER, filter.c_str(), OPTION_PRIORITY_CMDLINE, error_string); mopt.set_value(OPTION_LAST_USED_MACHINE, last_driver.c_str(), OPTION_PRIORITY_CMDLINE, error_string); @@ -573,14 +569,6 @@ void ui_menu_select_game::handle() ui_menu::stack_push(global_alloc_clear(machine(), container, c_mnfct::ui, c_mnfct::actual, SELECTOR_GAME, l_hover)); else if (l_hover == FILTER_YEAR) ui_menu::stack_push(global_alloc_clear(machine(), container, c_year::ui, c_year::actual, SELECTOR_GAME, l_hover)); - else if (l_hover == FILTER_SCREEN) - { - std::vector text(screen_filters::length); - for (int x = 0; x < screen_filters::length; ++x) - text[x] = screen_filters::text[x]; - - ui_menu::stack_push(global_alloc_clear(machine(), container, text, screen_filters::actual, SELECTOR_GAME, l_hover)); - } else { if (l_hover >= FILTER_ALL) @@ -618,28 +606,15 @@ void ui_menu_select_game::populate() case FILTER_CATEGORY: build_category(); break; - case FILTER_MANUFACTURER: build_list(m_tmp, c_mnfct::ui[c_mnfct::actual].c_str()); break; - case FILTER_YEAR: build_list(m_tmp, c_year::ui[c_year::actual].c_str()); break; - - case FILTER_SCREEN: - case FILTER_STEREO: - case FILTER_SAMPLES: - case FILTER_NOSAMPLES: - case FILTER_CHD: - case FILTER_NOCHD: - build_from_cache(m_tmp, screen_filters::actual); - break; - case FILTER_CUSTOM: build_custom(); break; - default: build_list(m_tmp); break; @@ -805,7 +780,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott ui_manager &mui = machine().ui(); float tbarspace = mui.get_line_height(); - strprintf(tempbuf[0], "MAME %s ( %d / %d machines (%d BIOS) )", bare_build_version, visible_items, (driver_list::total() - 1), m_isabios + m_issbios); + strprintf(tempbuf[0], "MAME %s ( %d / %d machines (%d BIOS) )", bare_build_version, visible_items, (driver_list::total() - 1), m_isabios); std::string filtered; if (main_filters::actual == FILTER_CATEGORY && !machine().inifile().ini_index.empty()) @@ -821,9 +796,6 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott else if (main_filters::actual == FILTER_YEAR) filtered.assign(main_filters::text[main_filters::actual]).append(" (").append(c_year::ui[c_year::actual]).append(") -"); - else if (main_filters::actual == FILTER_SCREEN) - filtered.assign(main_filters::text[main_filters::actual]).append(" (").append(screen_filters::text[screen_filters::actual]).append(") -"); - // display the current typeahead if (no_active_search()) tempbuf[1].clear(); @@ -1362,6 +1334,27 @@ void ui_menu_select_game::build_list(std::vector &s_drivers m_displaylist.push_back(s_driver); break; } + case FILTER_CHD: + for (const rom_entry *rom = s_driver->rom; !ROMENTRY_ISEND(rom); ++rom) + if (ROMENTRY_ISREGION(rom) && ROMREGION_ISDISKDATA(rom)) + { + m_displaylist.push_back(s_driver); + break; + } + break; + case FILTER_NOCHD: + { + bool found = false; + for (const rom_entry *rom = s_driver->rom; !ROMENTRY_ISEND(rom); ++rom) + if (ROMENTRY_ISREGION(rom) && ROMREGION_ISDISKDATA(rom)) + { + found = true; + break; + } + if (!found) + m_displaylist.push_back(s_driver); + break; + } } } } @@ -1408,16 +1401,6 @@ void ui_menu_select_game::build_custom() case FILTER_MANUFACTURER: build_list(s_drivers, c_mnfct::ui[custfltr::mnfct[count]].c_str(), filter, bioscheck); break; - case FILTER_SCREEN: - build_from_cache(s_drivers, custfltr::screen[count], filter, bioscheck); - break; - case FILTER_CHD: - case FILTER_NOCHD: - case FILTER_SAMPLES: - case FILTER_NOSAMPLES: - case FILTER_STEREO: - build_from_cache(s_drivers, 0, filter, bioscheck); - break; default: build_list(s_drivers, nullptr, filter, bioscheck); break; @@ -1441,59 +1424,6 @@ void ui_menu_select_game::build_category() m_displaylist = m_tmp; } -//------------------------------------------------- -// build list from cache -//------------------------------------------------- - -void ui_menu_select_game::build_from_cache(std::vector &s_drivers, int screens, int filter, bool bioscheck) -{ - if (s_drivers.empty()) - { - s_drivers = m_sortedlist; - filter = main_filters::actual; - } - - for (auto & s_driver : s_drivers) - { - if (!bioscheck && filter != FILTER_BIOS && (s_driver->flags & MACHINE_IS_BIOS_ROOT) != 0) - continue; - int idx = driver_list::find(s_driver->name); - - switch (filter) - { - case FILTER_SCREEN: - if (driver_cache[idx].b_screen == screens) - m_displaylist.push_back(s_driver); - break; - - case FILTER_SAMPLES: - if (driver_cache[idx].b_samples) - m_displaylist.push_back(s_driver); - break; - - case FILTER_NOSAMPLES: - if (!driver_cache[idx].b_samples) - m_displaylist.push_back(s_driver); - break; - - case FILTER_STEREO: - if (driver_cache[idx].b_stereo) - m_displaylist.push_back(s_driver); - break; - - case FILTER_CHD: - if (driver_cache[idx].b_chd) - m_displaylist.push_back(s_driver); - break; - - case FILTER_NOCHD: - if (!driver_cache[idx].b_chd) - m_displaylist.push_back(s_driver); - break; - } - } -} - //------------------------------------------------- // populate search list //------------------------------------------------- @@ -1591,13 +1521,15 @@ void ui_menu_select_game::general_info(const game_driver *driver, std::string &b strcatprintf(buffer, "Support Cocktail: %s\n", ((driver->flags & MACHINE_NO_COCKTAIL) ? "Yes" : "No")); strcatprintf(buffer, "Driver is Bios: %s\n", ((driver->flags & MACHINE_IS_BIOS_ROOT) ? "Yes" : "No")); strcatprintf(buffer, "Support Save: %s\n", ((driver->flags & MACHINE_SUPPORTS_SAVE) ? "Yes" : "No")); - - int idx = driver_list::find(driver->name); - strcatprintf(buffer, "Screen Type: %s\n", screen_filters::text[driver_cache[idx].b_screen]); strcatprintf(buffer, "Screen Orentation: %s\n", ((driver->flags & ORIENTATION_SWAP_XY) ? "Vertical" : "Horizontal")); - strcatprintf(buffer, "Requires Samples: %s\n", (driver_cache[idx].b_samples ? "Yes" : "No")); - strcatprintf(buffer, "Sound Channel: %s\n", (driver_cache[idx].b_stereo ? "Stereo" : "Mono")); - strcatprintf(buffer, "Requires CHD: %s\n", (driver_cache[idx].b_chd ? "Yes" : "No")); + bool found = false; + for (const rom_entry *rom = driver->rom; !ROMENTRY_ISEND(rom); ++rom) + if (ROMENTRY_ISREGION(rom) && ROMREGION_ISDISKDATA(rom)) + { + found = true; + break; + } + strcatprintf(buffer, "Requires CHD: %s\n", (found ? "Yes" : "No")); // audit the game first to see if we're going to work if (machine().ui().options().info_audit()) @@ -1681,17 +1613,10 @@ void ui_menu_select_game::inkey_export() // save drivers infos to file //------------------------------------------------- -void ui_menu_select_game::save_cache_info() +void ui_menu_select_game::init_sorted_list() { - // attempt to open the output file - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - - if (file.open("info_", emulator_info::get_configname(), ".ini") == FILERR_NONE) - { - m_sortedlist.clear(); - - // generate header - std::string buffer = std::string("#\n").append(UI_VERSION_TAG).append(bare_build_version).append("\n#\n\n"); + if (!m_sortedlist.empty()) + return; // generate full list for (int x = 0; x < driver_list::total(); ++x) @@ -1699,6 +1624,8 @@ void ui_menu_select_game::save_cache_info() const game_driver *driver = &driver_list::driver(x); if (driver == &GAME_NAME(___empty)) continue; + if (driver->flags & MACHINE_IS_BIOS_ROOT) + m_isabios++; m_sortedlist.push_back(driver); c_mnfct::set(driver->manufacturer); @@ -1709,135 +1636,6 @@ void ui_menu_select_game::save_cache_info() std::stable_sort(c_mnfct::ui.begin(), c_mnfct::ui.end()); std::stable_sort(c_year::ui.begin(), c_year::ui.end()); std::stable_sort(m_sortedlist.begin(), m_sortedlist.end(), sort_game_list); - - int index = 0; - m_isabios = 0; - m_issbios = 0; - m_isarcades = 0; - m_issystems = 0; - for (int x = 0; x < driver_list::total(); ++x) - { - const game_driver *driver = &driver_list::driver(x); - if (driver == &GAME_NAME(___empty)) - continue; - - if (driver->flags & MACHINE_TYPE_ARCADE) - { - if (driver->flags & MACHINE_IS_BIOS_ROOT) - m_isabios++; - m_isarcades++; - } - else - { - if (driver->flags & MACHINE_IS_BIOS_ROOT) - m_issbios++; - m_issystems++; - } - cache_info infos; - machine_config config(*driver, machine().options()); - - samples_device_iterator iter(config.root_device()); - infos.b_samples = (iter.first() != nullptr) ? 1 : 0; - - const screen_device *screen = config.first_screen(); - infos.b_screen = (screen != nullptr) ? screen->screen_type() : 0; - - speaker_device_iterator siter(config.root_device()); - sound_interface_iterator snditer(config.root_device()); - infos.b_stereo = (snditer.first() != nullptr && siter.count() > 1) ? 1 : 0; - infos.b_chd = 0; - for (const rom_entry *rom = driver->rom; !ROMENTRY_ISEND(rom); ++rom) - if (ROMENTRY_ISREGION(rom) && ROMREGION_ISDISKDATA(rom)) - { - infos.b_chd = 1; - break; - } - driver_cache[x].b_screen = infos.b_screen; - driver_cache[x].b_samples = infos.b_samples; - driver_cache[x].b_stereo = infos.b_stereo; - driver_cache[x].b_chd = infos.b_chd; - int find = driver_list::find(m_sortedlist[index++]->name); - strcatprintf(buffer, "%d,%d,%d,%d,%d\n", infos.b_screen, infos.b_samples, infos.b_stereo, infos.b_chd, find); - } - - strcatprintf(buffer, "%d,%d,%d,%d\n", m_isabios, m_issbios, m_isarcades, m_issystems); - file.puts(buffer.c_str()); - file.close(); - } -} - -//------------------------------------------------- -// load drivers infos from file -//------------------------------------------------- - -void ui_menu_select_game::load_cache_info() -{ - driver_cache.resize(driver_list::total() + 1); - - // try to load driver cache - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_READ); - if (file.open("info_", emulator_info::get_configname(), ".ini") != FILERR_NONE) - { - save_cache_info(); - return; - } - - std::string readbuf; - char rbuf[MAX_CHAR_INFO]; - file.gets(rbuf, MAX_CHAR_INFO); - file.gets(rbuf, MAX_CHAR_INFO); - readbuf = chartrimcarriage(rbuf); - std::string a_rev = std::string(UI_VERSION_TAG).append(bare_build_version); - - // version not matching ? save and exit - if (a_rev != readbuf) - { - file.close(); - save_cache_info(); - return; - } - - size_t pos = 0, end = 0; - file.gets(rbuf, MAX_CHAR_INFO); - file.gets(rbuf, MAX_CHAR_INFO); - for (int x = 0; x < driver_list::total(); ++x) - { - const game_driver *driver = &driver_list::driver(x); - if (driver == &GAME_NAME(___empty)) - continue; - - c_mnfct::set(driver->manufacturer); - c_year::set(driver->year); - file.gets(rbuf, MAX_CHAR_INFO); - readbuf = chartrimcarriage(rbuf); - pos = readbuf.find_first_of(','); - driver_cache[x].b_screen = std::stoi(readbuf.substr(0, pos)); - end = readbuf.find_first_of(',', ++pos); - driver_cache[x].b_samples = std::stoi(readbuf.substr(pos, end)); - pos = end; - end = readbuf.find_first_of(',', ++pos); - driver_cache[x].b_stereo = std::stoi(readbuf.substr(pos, end)); - pos = end; - end = readbuf.find_first_of(',', ++pos); - driver_cache[x].b_chd = std::stoi(readbuf.substr(pos, end)); - pos = end; - int find = std::stoi(readbuf.substr(++pos)); - m_sortedlist.push_back(&driver_list::driver(find)); - } - file.gets(rbuf, MAX_CHAR_INFO); - readbuf = chartrimcarriage(rbuf); - pos = readbuf.find_first_of(','); - m_isabios = std::stoi(readbuf.substr(0, pos)); - end = readbuf.find_first_of(',', ++pos); - m_issbios = std::stoi(readbuf.substr(pos, end)); - pos = end; - end = readbuf.find_first_of(',', ++pos); - m_isarcades = std::stoi(readbuf.substr(pos, end)); - pos = end; - m_issystems = std::stoi(readbuf.substr(++pos)); - file.close(); - std::stable_sort(c_mnfct::ui.begin(), c_mnfct::ui.end()); - std::stable_sort(c_year::ui.begin(), c_year::ui.end()); } //------------------------------------------------- @@ -1944,14 +1742,6 @@ void ui_menu_select_game::load_custom_filters() if (!strncmp(db, c_year::ui[z].c_str(), c_year::ui[z].length())) custfltr::year[x] = z; } - else if (y == FILTER_SCREEN) - { - file.gets(buffer, MAX_CHAR_INFO); - char *db = strchr(buffer, '=') + 2; - for (size_t z = 0; z < screen_filters::length; ++z) - if (!strncmp(db, screen_filters::text[z], strlen(screen_filters::text[z]))) - custfltr::screen[x] = z; - } } } file.close(); @@ -2004,7 +1794,6 @@ float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y } x2 = x1 + left_width + 2.0f * UI_BOX_LR_BORDER; - //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); // take off the borders @@ -2077,7 +1866,6 @@ float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y float ar_x1 = ar_x0 + lr_arrow_width; float ar_y1 = 0.5f * (y2 + y1) + 0.9f * line_height; - //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y) @@ -2100,7 +1888,6 @@ float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y float ar_x1 = ar_x0 + lr_arrow_width; float ar_y1 = 0.5f * (y2 + y1) + 0.9f * line_height; - //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y) @@ -2396,6 +2183,10 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or } } +//------------------------------------------------- +// draw right panel +//------------------------------------------------- + void ui_menu_select_game::draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) { ui_manager &mui = machine().ui(); diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h index d09c9789ee0..67906471663 100644 --- a/src/emu/ui/selgame.h +++ b/src/emu/ui/selgame.h @@ -37,19 +37,12 @@ public: virtual void draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) override; private: - struct cache_info - { - UINT8 b_screen, b_stereo, b_samples, b_chd; - }; - - std::vector driver_cache; - enum { VISIBLE_GAMES_IN_SEARCH = 200 }; char m_search[40]; int m_prev_selected; - int m_isabios, m_issbios, m_isarcades, m_issystems; + static int m_isabios; - std::vector m_sortedlist; + static std::vector m_sortedlist; std::vector m_availsortedlist; std::vector m_unavailsortedlist; std::vector m_displaylist; @@ -62,12 +55,10 @@ private: void build_category(); void build_available_list(); void build_list(std::vector &vec, const char *filter_text = nullptr, int filter = 0, bool bioscheck = false); - void build_from_cache(std::vector &vec, int screens = 0, int filter = 0, bool bioscheck = false); bool no_active_search(); void populate_search(); - void load_cache_info(); - void save_cache_info(); + void init_sorted_list(); bool load_available_machines(); void load_custom_filters(); diff --git a/src/emu/ui/utils.cpp b/src/emu/ui/utils.cpp index eb8078a4ab1..79bec2fc149 100644 --- a/src/emu/ui/utils.cpp +++ b/src/emu/ui/utils.cpp @@ -27,8 +27,7 @@ std::vector c_mnfct::ui; UINT16 main_filters::actual = 0; const char *main_filters::text[] = { "All", "Available", "Unavailable", "Working", "Not Mechanical", "Category", "Favorites", "BIOS", "Originals", "Clones", "Not Working", "Mechanical", "Manufacturers", "Years", "Support Save", - "Not Support Save", "CHD", "No CHD", "Use Samples", "Not Use Samples", "Stereo", "Vertical", - "Horizontal", "Screen Type", "Custom" }; + "Not Support Save", "CHD", "No CHD", "Vertical", "Horizontal", "Custom" }; size_t main_filters::length = ARRAY_LENGTH(main_filters::text); // Software filters @@ -37,11 +36,6 @@ const char *sw_filters::text[] = { "All", "Available", "Unavailable", "Originals "Partial Supported", "Unsupported", "Region", "Device Type", "Software List", "Custom" }; size_t sw_filters::length = ARRAY_LENGTH(sw_filters::text); -// Screens -UINT16 screen_filters::actual = 0; -const char *screen_filters::text[] = { "", "Raster", "Vector", "LCD" }; -size_t screen_filters::length = ARRAY_LENGTH(screen_filters::text); - // Globals UINT8 ui_globals::rpanel = 0; UINT8 ui_globals::curimage_view = 0; diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index f89b27d88e8..1cc08e2ae7e 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -42,12 +42,8 @@ enum FILTER_NOSAVE, FILTER_CHD, FILTER_NOCHD, - FILTER_SAMPLES, - FILTER_NOSAMPLES, - FILTER_STEREO, FILTER_VERTICAL, FILTER_HORIZONTAL, - FILTER_SCREEN, FILTER_CUSTOM, FILTER_LAST = FILTER_CUSTOM }; @@ -226,8 +222,6 @@ struct name##_filters \ main_struct(main); main_struct(sw); -main_struct(ume); -main_struct(screen); // Custom filter struct custfltr -- cgit v1.2.3-70-g09d2 From f37594a53a2b470d43c00ed4c070fe40a56c7a20 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Wed, 10 Feb 2016 22:38:52 +0100 Subject: fixed wrong 'game' text. --- src/emu/ui/selgame.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index bf03a4af034..a7c4940b29c 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -548,8 +548,8 @@ void ui_menu_select_game::handle() // if we're in an error state, overlay an error message if (ui_error) - machine().ui().draw_text_box(container, "The selected game is missing one or more required ROM or CHD images. " - "Please select a different game.\n\nPress any key (except ESC) to continue.", JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); + machine().ui().draw_text_box(container, "The selected machine is missing one or more required ROM or CHD images. " + "Please select a different machine.\n\nPress any key (except ESC) to continue.", JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); // handle filters selection from key shortcuts if (check_filter) @@ -1618,24 +1618,24 @@ void ui_menu_select_game::init_sorted_list() if (!m_sortedlist.empty()) return; - // generate full list - for (int x = 0; x < driver_list::total(); ++x) - { - const game_driver *driver = &driver_list::driver(x); - if (driver == &GAME_NAME(___empty)) - continue; + // generate full list + for (int x = 0; x < driver_list::total(); ++x) + { + const game_driver *driver = &driver_list::driver(x); + if (driver == &GAME_NAME(___empty)) + continue; if (driver->flags & MACHINE_IS_BIOS_ROOT) m_isabios++; - m_sortedlist.push_back(driver); - c_mnfct::set(driver->manufacturer); - c_year::set(driver->year); - } + m_sortedlist.push_back(driver); + c_mnfct::set(driver->manufacturer); + c_year::set(driver->year); + } - // sort manufacturers - years and driver - std::stable_sort(c_mnfct::ui.begin(), c_mnfct::ui.end()); - std::stable_sort(c_year::ui.begin(), c_year::ui.end()); - std::stable_sort(m_sortedlist.begin(), m_sortedlist.end(), sort_game_list); + // sort manufacturers - years and driver + std::stable_sort(c_mnfct::ui.begin(), c_mnfct::ui.end()); + std::stable_sort(c_year::ui.begin(), c_year::ui.end()); + std::stable_sort(m_sortedlist.begin(), m_sortedlist.end(), sort_game_list); } //------------------------------------------------- -- cgit v1.2.3-70-g09d2 From 96f78891f95c2f30ddfac71560538d666239da81 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Wed, 10 Feb 2016 22:39:45 +0100 Subject: menu: standard menu now correctly handle the double click of the mouse. nw --- src/emu/ui/menu.cpp | 119 +++++++++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 52 deletions(-) diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index bd1eec20c05..d1cef3a20a8 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -506,7 +506,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) if (visible_main_menu_height + visible_extra_menu_height + 2.0f * UI_BOX_TB_BORDER > 1.0f) visible_main_menu_height = 1.0f - 2.0f * UI_BOX_TB_BORDER - visible_extra_menu_height; - int visible_lines = floor(visible_main_menu_height / line_height); + visible_lines = floor(visible_main_menu_height / line_height); visible_main_menu_height = (float)visible_lines * line_height; // compute top/left of inner menu area by centering @@ -525,10 +525,8 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); // determine the first visible line based on the current selection - int top_line = selected - visible_lines / 2; - if (top_line < 0) + if (top_line < 0 || selected == 0) top_line = 0; - if (top_line + visible_lines >= item.size()) { if (history_flag) @@ -818,7 +816,7 @@ void ui_menu::draw_text_box() void ui_menu::handle_events(UINT32 flags) { - int stop = FALSE; + bool stop = false; ui_event local_menu_event; bool historyflag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); @@ -835,35 +833,33 @@ void ui_menu::handle_events(UINT32 flags) selected = hover; else if (hover == HOVER_ARROW_UP) { - selected -= visitems - 1; - validate_selection(1); + selected -= visitems; + if (selected < 0) + selected = 0; + top_line -= visitems - (top_line + visible_lines == item.size() - 1); } else if (hover == HOVER_ARROW_DOWN) { - selected += visitems - 1; - validate_selection(1); + selected += visible_lines - 2 + (selected == 0); + if (selected > item.size() - 1) + selected = item.size() - 1; + top_line += visible_lines - 2; } } break; // if we are hovering over a valid item, fake a UI_SELECT with a double-click case UI_EVENT_MOUSE_DOUBLE_CLICK: - if ((flags & UI_MENU_PROCESS_ONLYCHAR) == 0) + if ((flags & UI_MENU_PROCESS_ONLYCHAR) == 0 && hover >= 0 && hover < item.size()) { - if (hover >= 0 && hover < item.size()) + selected = hover; + menu_event.iptkey = IPT_UI_SELECT; + if (selected == item.size() - 1) { - selected = hover; - if (local_menu_event.event_type == UI_EVENT_MOUSE_DOUBLE_CLICK) - { - menu_event.iptkey = IPT_UI_SELECT; - if (selected == item.size() - 1) - { - menu_event.iptkey = IPT_UI_CANCEL; - ui_menu::stack_pop(machine()); - } - } - stop = TRUE; + menu_event.iptkey = IPT_UI_CANCEL; + ui_menu::stack_pop(machine()); } + stop = true; } break; @@ -878,11 +874,17 @@ void ui_menu::handle_events(UINT32 flags) else selected -= local_menu_event.num_lines; validate_selection(-1); + if (selected < top_line + (top_line != 0)) + top_line -= local_menu_event.num_lines; } else { selected += local_menu_event.num_lines; validate_selection(1); + if (selected > item.size() - 1) + selected = item.size() - 1; + if (selected >= top_line + visitems + (top_line != 0)) + top_line += local_menu_event.num_lines; } } break; @@ -891,7 +893,7 @@ void ui_menu::handle_events(UINT32 flags) case UI_EVENT_CHAR: menu_event.iptkey = IPT_SPECIAL; menu_event.unichar = local_menu_event.ch; - stop = TRUE; + stop = true; break; // ignore everything else @@ -909,9 +911,7 @@ void ui_menu::handle_events(UINT32 flags) void ui_menu::handle_keys(UINT32 flags) { - int ignorepause = ui_menu::stack_has_special_main_menu(); - int ignoreright; - int ignoreleft; + bool ignorepause = ui_menu::stack_has_special_main_menu(); int code; // bail if no items @@ -947,8 +947,8 @@ void ui_menu::handle_keys(UINT32 flags) validate_selection(1); // swallow left/right keys if they are not appropriate - ignoreleft = ((item[selected].flags & MENU_FLAG_LEFT_ARROW) == 0); - ignoreright = ((item[selected].flags & MENU_FLAG_RIGHT_ARROW) == 0); + bool ignoreleft = ((item[selected].flags & MENU_FLAG_LEFT_ARROW) == 0); + bool ignoreright = ((item[selected].flags & MENU_FLAG_RIGHT_ARROW) == 0); // accept left/right keys as-is with repeat if (!ignoreleft && exclusive_input_pressed(IPT_UI_LEFT, (flags & UI_MENU_PROCESS_LR_REPEAT) ? 6 : 0)) @@ -959,60 +959,80 @@ void ui_menu::handle_keys(UINT32 flags) // up backs up by one item if (exclusive_input_pressed(IPT_UI_UP, 6)) { - if (historyflag && selected <= (visitems / 2)) - return; - else if (historyflag && visitems == item.size()) + if (historyflag) { - selected = item.size() - 1; - return; + if (selected <= (visitems / 2)) + return; + else if (visitems == item.size()) + { + selected = item.size() - 1; + return; + } + else if (selected == item.size() - 1) + selected = (item.size() - 1) - (visitems / 2); } - else if (historyflag && selected == item.size() - 1) - selected = (item.size() - 1) - (visitems / 2); + + if (selected == 0) + return; - selected = (selected + item.size() - 1) % item.size(); + selected--; validate_selection(-1); + top_line -= (selected == top_line && top_line != 0); } // down advances by one item if (exclusive_input_pressed(IPT_UI_DOWN, 6)) { - if (historyflag && (selected < visitems / 2)) - selected = visitems / 2; - else if (historyflag && (selected + (visitems / 2) >= item.size())) + if (historyflag) { - selected = item.size() - 1; - return; + if (selected < visitems / 2) + selected = visitems / 2; + else if (selected + (visitems / 2) >= item.size()) + { + selected = item.size() - 1; + return; + } } - selected = (selected + 1) % item.size(); - validate_selection(1); + if (selected == item.size() - 1) + return; + + selected++; + top_line += (selected == top_line + visitems + (top_line != 0)); } // page up backs up by visitems if (exclusive_input_pressed(IPT_UI_PAGE_UP, 6)) { - selected -= visitems - 1; + selected -= visitems; + top_line -= visitems - (top_line + visible_lines == item.size() - 1); + if (selected < 0) + selected = 0; validate_selection(1); } // page down advances by visitems if (exclusive_input_pressed(IPT_UI_PAGE_DOWN, 6)) { - selected += visitems - 1; + selected += visible_lines - 2 + (selected == 0); + top_line += visible_lines - 2; + + if (selected > item.size() - 1) + selected = item.size() - 1; validate_selection(-1); } // home goes to the start if (exclusive_input_pressed(IPT_UI_HOME, 0)) { - selected = 0; + selected = top_line = 0; validate_selection(1); } // end goes to the last if (exclusive_input_pressed(IPT_UI_END, 0)) { - selected = item.size() - 1; + selected = top_line = item.size() - 1; validate_selection(-1); } @@ -1681,12 +1701,7 @@ void ui_menu::handle_main_keys(UINT32 flags) } if (!ignoreright && exclusive_input_pressed(IPT_UI_RIGHT, (flags & UI_MENU_PROCESS_LR_REPEAT) ? 6 : 0)) - { - // Swap the right panel -// if (minput.code_pressed(KEYCODE_LCONTROL) || minput.code_pressed(JOYCODE_BUTTON1)) -// menu_event.iptkey = IPT_UI_RIGHT_PANEL; return; - } // up backs up by one item if (exclusive_input_pressed(IPT_UI_UP, 6)) -- cgit v1.2.3-70-g09d2 From 5edf31d247fce31dace951af8a3b0d5be54f175a Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Wed, 10 Feb 2016 16:55:55 -0500 Subject: Updated NoteTaker documentation and history section, with cited sources. [Lord Nightmare] --- src/mame/drivers/notetaker.cpp | 53 ++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index 1e7bde4ff6f..e19f6983b2c 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -2,39 +2,52 @@ // copyright-holders:Jonathan Gevaryahu /* Xerox NoteTaker, 1978 * Driver by Jonathan Gevaryahu - * - * - * Designed by Alan Kay and many others, with BIOS written by Bruce Horn (BitBlt function in BIOS written by Dan Ingalls) + + * Notetaker Team At Xerox PARC 1976-1980: + Alan Kay - Team Lead + Bruce Horn - BIOS code and more + Ted Kaehler - SmallTalk-76 code porting[2] and more ( http://tedkaehler.weather-dimensions.com/us/ted/index.html ) + Dan Ingalls - BitBlt engine and SmallTalk kernel and more[3] + Doug Fairbairn - NoteTaker Hardware ( http://www.computerhistory.org/atchm/author/dfairbairn/ ) + + * History of the machine can be found at http://freudenbergs.de/bert/publications/Ingalls-2014-Smalltalk78.pdf - * prototypes only, around 10 units manufactured 1978-1980 - One at CHM (missing? mouse, no media) - One at Xerox Museum at PARC (with mouse and 2 floppies, no floppy images available) - * This device was the origin of Smalltalk-78 (which acted as the operating system of the NoteTaker) - * The NoteTaker also used the BitBlt graphical operation to do most graphical functions in Smalltalk-78 - BitBlt was not invented for the NoteTaker, but for the Alto; however unlike the Alto, the NoteTaker used it for almost every graphical operation. + + * Prototypes only, 10 units[2] manufactured 1978-1980 + Known surviving units: + * One at CHM (missing? mouse, no media) + * One at Xerox Museum at PARC (with mouse and 2 floppies, floppies were not imaged to the best of my knowledge) + + * The NoteTaker used the BitBlt graphical operation (from SmallTalk-76) to do most graphical functions, in order to fit the SmallTalk code and programs within 256K of RAM[2]. The actual BitBlt code lives in ROM[3]. + * As far as I am aware, no media (world disks/boot disks) for the NoteTaker have survived (except maybe the two disks at Xerox Museum at PARC), but an incomplete dump of the Smalltalk-76 'world' which was used to bootstrap Smalltalk-78 originally did survive on the Alto disks at CHM * see http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker for additional information - * http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19790620_Z-IOP_1.5_ls.pdf is listing of the biop v1.5 code * see http://xeroxalto.computerhistory.org/Filene/Smalltalk-76/ for the smalltalk-76 dump - * see http://xeroxalto.computerhistory.org/Indigo/BasicDisks/Smalltalk14.bfs!1_/ for more notetaker/smalltalk related files - * - * MISSING DUMP for 8741? I/O MCU which does mouse-related stuff + * see http://xeroxalto.computerhistory.org/Indigo/BasicDisks/Smalltalk14.bfs!1_/ for more notetaker/smalltalk related files, including SmallTalk-80 files based on the notetaker smalltalk-78 + + References: + * [1] http://freudenbergs.de/bert/publications/Ingalls-2014-Smalltalk78.pdf + * [2] "Smalltalk and Object Orientation: An Introduction" By John Hunt, pages 45-46 [ISBN 978-3-540-76115-0] + * [3] http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19790620_Z-IOP_1.5_ls.pdf + * [4] http://xeroxalto.computerhistory.org/Filene/Smalltalk-76/ + * MISSING DUMP for 8741? Keyboard MCU which does row-column scanning and mouse-related stuff TODO: everything below. -* Get the running machine smalltalk-78 memory dump loaded as a rom and forced into ram on startup, since no boot disks have survived +* figure out the correct memory maps for the 256kB of shared ram, and what part of ram constitutes the framebuffer +* figure out how the emulation-cpu boots and where its 4k of local ram maps to +* Get smalltalk-78 loaded as a rom and forced into ram on startup, since no boot disks have survived (or if any survived, they are not dumped) * floppy controller wd1791 - According to http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19790620_Z-IOP_1.5_ls.pdf the format is 128 bytes per sector, 16 sectors per track (one sided) + According to [3] the format is 128 bytes per sector, 16 sectors per track (one sided) According to the schematics, we're missing an 82s147 DISKSEP.PROM used as a data separator -* crt5027 video controller -* i8251? serial/EIA controller +* crt5027 video controller; we're missing a PROM used to handle memory arbitration between the crtc and the rest of the system, but the equations are on the schematic +* Harris 6402 serial/EIA UART * Harris 6402 keyboard UART -* HLE for the missing MCU which reads the mouse quadratures and buttons +* HLE for the missing MCU which reads the mouse quadratures and buttons and talks serially to the Keyboard UART WIP: * pic8259 interrupt controller - this is attached as a device, but the interrupts are not hooked to it yet. - +* i/o cpu i/o area needs the memory map worked out per the schematics - partly done */ #include "cpu/i86/i86.h" -- cgit v1.2.3-70-g09d2 From f101be8fc46115cdbca6c53e43fe4ad1a192ffe4 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 10 Feb 2016 19:37:51 -0300 Subject: New clones added or promoted from NOT_WORKING status ---------------------------------------------------- Cherry Master I (ver.1.01, set 8, V4-B-) [Roberto Fresca, f205v] --- src/mame/arcade.lst | 1 + src/mame/drivers/goldstar.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 69bf96f7021..b09e97b6241 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -12284,6 +12284,7 @@ cmasterbv // (c) 1991 Dyna Electronics / Gerald Duhamel? cmasterd // (c) 1991 Dyna Electronics cmastere // (c) 1991 Dyna Electronics cmasterf // (c) 1991 Dyna Electronics +cmasterg // (c) 1991 Dyna Electronics cmast91 // (c) 1991 Dyna Electronics cmast92 // (c) 1992 Dyna Electronics cmast97 // (c) 1996 Dyna Electronics diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 95bc6184865..79168384b46 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -9179,6 +9179,71 @@ ROM_START( cmasterf ) ROM_END +/* Cherry Master I (CM1-1.01) + Sticker with "Cherry Master V4 -B-" on the PCB. + Similar to cmasterb. Different program. + +1x TMPZ84C00AP-6 u80 8-bit Microprocessor +1x D8255AC-5 u36 Programmable Peripheral Interface +1x D71055C u54 Parallel Interface Unit +1x YM2149F u13 Programmable Sound Generator +1x oscillator 12.000MHz Y1 + +ROMs +4x 2764 1,2,3,4 +4x 27256 5,6,7,9 +1x 27512 8 +3x N82S129AN u46, u79, u84 + +RAMs +1x LC3517AL-10 u82 +4x D4016CX-15-10 u22, u26, u28, u38 + +PLDs +4x PALCE16V8H-25pc/4 u51, u66, u73, u74 + +Others +1x 36x2 edge connector +1x 10x2 edge connector +1x pushbutton (SW6) +1x trimmer (volume)(VR1) +5x 8x2 switches DIP(SW1-SW5) +1x battery 5.5V(BT1) +*/ +ROM_START( cmasterg ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "9.u81", 0x0000, 0x1000, CRC(10979629) SHA1(a7342e37c75c85aef8a86ab5366a9e27f2c4bab8) ) + ROM_CONTINUE(0x4000,0x1000) + ROM_CONTINUE(0x3000,0x1000) + ROM_CONTINUE(0x7000,0x1000) + ROM_CONTINUE(0x1000,0x1000) + ROM_CONTINUE(0x6000,0x1000) + ROM_CONTINUE(0x2000,0x1000) + ROM_CONTINUE(0x5000,0x1000) + + ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_LOAD( "7.u16", 0x00000, 0x8000, CRC(19cc1d67) SHA1(47487f9362bfb36a32100ed772960628844462bf) ) + ROM_LOAD( "6.u11", 0x08000, 0x8000, CRC(63b3df4e) SHA1(9bacd23da598805ec18ec5ad15cab95d71eb9262) ) + ROM_LOAD( "5.u4", 0x10000, 0x8000, CRC(e39fff9c) SHA1(22fdc517fa478441622c6245cecb5728c5595757) ) + + ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_LOAD( "4.u15", 0x0000, 0x2000, CRC(8607ffd9) SHA1(9bc94715554aa2473ae2ed249a47f29c7886b3dc) ) + ROM_LOAD( "3.u10", 0x2000, 0x2000, CRC(c32367be) SHA1(ff217021b9c58e23b2226f8b0a7f5da966225715) ) + ROM_LOAD( "2.u14", 0x4000, 0x2000, CRC(6dfcb188) SHA1(22430429c798954d9d979e62699b58feae7fdbf4) ) + ROM_LOAD( "1.u9", 0x6000, 0x2000, CRC(9678ead2) SHA1(e80aefa98b2363fe9e6b2415762695ace272e4d3) ) + + ROM_REGION( 0x10000, "user1", 0 ) + ROM_LOAD( "8.u53", 0x0000, 0x10000, CRC(e92443d3) SHA1(4b6ca4521841610054165f085ae05510e77af191) ) + + ROM_REGION( 0x200, "proms", 0 ) + ROM_LOAD( "n82s129an.u84", 0x0000, 0x0100, CRC(0489b760) SHA1(78f8632b17a76335183c5c204cdec856988368b0) ) + ROM_LOAD( "n82s129an.u79", 0x0100, 0x0100, CRC(21eb5b19) SHA1(9b8425bdb97f11f4855c998c7792c3291fd07470) ) + + ROM_REGION( 0x100, "proms2", 0 ) + ROM_LOAD( "n82s129an.u46", 0x0000, 0x0100, CRC(50ec383b) SHA1(ae95b92bd3946b40134bcdc22708d5c6b0f4c23e) ) +ROM_END + + ROM_START( cmast99 ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "cm99-041-8.u81", 0x0000, 0x1000, CRC(e0872d9f) SHA1(6d8f5e09e5c9daf834d5c74434eae86e5dd7e194) ) @@ -13466,6 +13531,7 @@ GAMEL( 1991, cmasterbv, cmaster, cm, cmasterb, cmaster_state, cmv4, GAMEL( 1991, cmasterd, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 5)", 0, layout_cmasterb ) GAMEL( 1991, cmastere, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 6)", 0, layout_cmasterb ) GAMEL( 1991, cmasterf, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 7)", 0, layout_cmasterb ) +GAMEL( 1991, cmasterg, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 8, V4-B-)", 0, layout_cmasterb ) GAME( 199?, cmast99, 0, cm, cmv4, cmaster_state, cmv4, ROT0, "????", "Cherry Master '99", MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From 097ae2fe5c0c32d540301ceac6600c5161dacb50 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 10 Feb 2016 20:15:11 -0300 Subject: Cherry Master I (ver.1.01, set 8, V4-B-) improvements: Added proper inputs. More accurate DIP switches. [Roberto Fresca] --- src/mame/drivers/goldstar.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 79168384b46..d57f327ae69 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -1668,6 +1668,7 @@ static INPUT_PORTS_START( cmasterb ) /* Test Mode For Disp. Of Doll not checked */ INPUT_PORTS_END + static INPUT_PORTS_START( cmezspin ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -1738,6 +1739,7 @@ static INPUT_PORTS_START( cmezspin ) /* Test Mode For Disp. Of Doll not checked */ INPUT_PORTS_END + static INPUT_PORTS_START( cmasterc ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -1796,6 +1798,66 @@ static INPUT_PORTS_START( cmasterc ) /* Test Mode For Disp. Of Doll not checked */ INPUT_PORTS_END + +static INPUT_PORTS_START( cmasterg ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH ) PORT_NAME("Big / Stop All") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_LOW ) PORT_NAME("Small / Info") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start") + + PORT_INCLUDE( cmv4_coins ) + + PORT_INCLUDE( cmv4_service ) + + PORT_INCLUDE( cmv4_dsw1 ) + PORT_MODIFY("DSW1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSW1:1") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + /* Hopper Out Switch not checked */ + /* Payout Mode not checked */ + /* '7' In Double Up Game OK */ + PORT_DIPNAME( 0x10, 0x00, "Double Up Game Pay Rate" ) PORT_DIPLOCATION("DSW1:5") /* OK */ + PORT_DIPSETTING( 0x00, "60%" ) + PORT_DIPSETTING( 0x10, "70%" ) + /* Double Up Game OK */ + /* Bet Max OK */ + + PORT_INCLUDE( cmv4_dsw2 ) + PORT_MODIFY("DSW2") + PORT_DIPNAME( 0x07, 0x00, "Main Game Pay Rate" ) PORT_DIPLOCATION("DSW2:1,2,3") /* OK */ + PORT_DIPSETTING( 0x07, "45%" ) + PORT_DIPSETTING( 0x06, "50%" ) + PORT_DIPSETTING( 0x05, "55%" ) + PORT_DIPSETTING( 0x04, "60%" ) + PORT_DIPSETTING( 0x03, "65%" ) + PORT_DIPSETTING( 0x02, "70%" ) + PORT_DIPSETTING( 0x01, "75%" ) + PORT_DIPSETTING( 0x00, "80%" ) + /* Hopper Limit OK */ + /* 100+ Odds Sound not checked */ + /* Key In Type OK */ + /* Center Super 7 Bet Limit related with Min. Bet For Bonus Play (DSW4-6) */ + + PORT_INCLUDE( cmv4_dsw3 ) /* all OK */ + + PORT_INCLUDE( cmv4_dsw4 ) /* all OK */ + + PORT_INCLUDE( cmv4_dsw5 ) + /* Display of Doll On Demo only affects payout table screen */ + /* Coin In Limit OK */ + /* Condition For 3 Kind Of Bonus not checked */ + /* Display Of Doll At All Fr. Bonus not checked */ + /* DSW5-7 listed as unused */ + /* Test Mode For Disp. Of Doll not checked */ +INPUT_PORTS_END + + static INPUT_PORTS_START( cmast91 ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -13531,7 +13593,7 @@ GAMEL( 1991, cmasterbv, cmaster, cm, cmasterb, cmaster_state, cmv4, GAMEL( 1991, cmasterd, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 5)", 0, layout_cmasterb ) GAMEL( 1991, cmastere, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 6)", 0, layout_cmasterb ) GAMEL( 1991, cmasterf, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 7)", 0, layout_cmasterb ) -GAMEL( 1991, cmasterg, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 8, V4-B-)", 0, layout_cmasterb ) +GAMEL( 1991, cmasterg, cmaster, cm, cmasterg, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 8, V4-B-)", 0, layout_cmasterb ) GAME( 199?, cmast99, 0, cm, cmv4, cmaster_state, cmv4, ROT0, "????", "Cherry Master '99", MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From 5e5f2788d68256b51fb7cd0d9c3a4938286b497e Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Thu, 11 Feb 2016 00:26:12 +0100 Subject: Rearranged some filters. nw --- src/emu/ui/custmenu.cpp | 6 +++--- src/emu/ui/menu.cpp | 20 +++++++++++++++++--- src/emu/ui/selgame.cpp | 36 ++++++++++++++++++------------------ src/emu/ui/selgame.h | 2 +- src/emu/ui/utils.cpp | 8 ++++---- src/emu/ui/utils.h | 6 +++--- 6 files changed, 46 insertions(+), 32 deletions(-) diff --git a/src/emu/ui/custmenu.cpp b/src/emu/ui/custmenu.cpp index 2abbd533d75..27cdf2c17c4 100644 --- a/src/emu/ui/custmenu.cpp +++ b/src/emu/ui/custmenu.cpp @@ -83,14 +83,14 @@ void ui_menu_custom_filter::handle() { custfltr::other[pos]--; for ( ; custfltr::other[pos] > FILTER_UNAVAILABLE && (custfltr::other[pos] == FILTER_CATEGORY - || custfltr::other[pos] == FILTER_FAVORITE_GAME); custfltr::other[pos]--) ; + || custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]--) ; changed = true; } else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::other[pos] < FILTER_LAST - 1) { custfltr::other[pos]++; for ( ; custfltr::other[pos] < FILTER_LAST && (custfltr::other[pos] == FILTER_CATEGORY - || custfltr::other[pos] == FILTER_FAVORITE_GAME); custfltr::other[pos]++) ; + || custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]++) ; changed = true; } else if (m_event->iptkey == IPT_UI_SELECT) @@ -98,7 +98,7 @@ void ui_menu_custom_filter::handle() size_t total = main_filters::length; std::vector s_sel(total); for (size_t index = 0; index < total; ++index) - if (index <= FILTER_UNAVAILABLE || index == FILTER_CATEGORY || index == FILTER_FAVORITE_GAME || index == FILTER_CUSTOM) + if (index <= FILTER_UNAVAILABLE || index == FILTER_CATEGORY || index == FILTER_FAVORITE || index == FILTER_CUSTOM) s_sel[index] = "_skip_"; else s_sel[index] = main_filters::text[index]; diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index d1cef3a20a8..886b069bd7d 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -2193,11 +2193,14 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float { bool no_available = false; float line_height = machine().ui().get_line_height(); + static int old_panel_width_pixel = -1; + static int old_panel_height_pixel = -1; + // if it fails, use the default image if (!tmp_bitmap->valid()) { - tmp_bitmap->reset(); + //tmp_bitmap->reset(); tmp_bitmap->allocate(256, 256); for (int x = 0; x < 256; x++) for (int y = 0; y < 256; y++) @@ -2213,6 +2216,16 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float int screen_height = machine().render().ui_target().height(); int panel_width_pixel = panel_width * screen_width; int panel_height_pixel = panel_height * screen_height; + + if (old_panel_height_pixel == -1 || old_panel_width_pixel == -1) + snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel); + + if (old_panel_height_pixel != panel_height_pixel) + old_panel_height_pixel = panel_height_pixel; + + if (old_panel_height_pixel != panel_width_pixel) + old_panel_width_pixel = panel_width_pixel; + float ratio = 0.0f; // Calculate resize ratios for resizing @@ -2254,8 +2267,9 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float else dest_bitmap = tmp_bitmap; - snapx_bitmap->reset(); - snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel); + //snapx_bitmap->reset(); + if (old_panel_height_pixel != panel_height_pixel || old_panel_width_pixel != panel_width_pixel) + snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel); int x1 = (0.5f * panel_width_pixel) - (0.5f * dest_xPixel); int y1 = (0.5f * panel_height_pixel) - (0.5f * dest_yPixel); diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index a7c4940b29c..e911f948945 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -235,7 +235,7 @@ ui_menu_select_game::~ui_menu_select_game() const game_driver *driver = nullptr; ui_software_info *swinfo = nullptr; ui_options &mopt = machine().ui().options(); - if (main_filters::actual == FILTER_FAVORITE_GAME) + if (isfavorite()) swinfo = (selected >= 0 && selected < item.size()) ? (ui_software_info *)item[selected].ref : nullptr; else driver = (selected >= 0 && selected < item.size()) ? (const game_driver *)item[selected].ref : nullptr; @@ -298,10 +298,10 @@ void ui_menu_select_game::handle() // handle selections else if (m_event->iptkey == IPT_UI_SELECT) { - if (main_filters::actual != FILTER_FAVORITE_GAME) - inkey_select(m_event); - else + if (isfavorite()) inkey_select_favorite(m_event); + else + inkey_select(m_event); } // handle UI_LEFT @@ -374,7 +374,7 @@ void ui_menu_select_game::handle() // handle UI_HISTORY else if (m_event->iptkey == IPT_UI_HISTORY && enabled_dats) { - if (main_filters::actual != FILTER_FAVORITE_GAME) + if (!isfavorite()) { const game_driver *driver = (const game_driver *)m_event->itemref; if ((FPTR)driver > 3) @@ -396,7 +396,7 @@ void ui_menu_select_game::handle() // handle UI_MAMEINFO else if (m_event->iptkey == IPT_UI_MAMEINFO && enabled_dats) { - if (main_filters::actual != FILTER_FAVORITE_GAME) + if (!isfavorite()) { const game_driver *driver = (const game_driver *)m_event->itemref; if ((FPTR)driver > 3) @@ -423,7 +423,7 @@ void ui_menu_select_game::handle() // handle UI_STORY else if (m_event->iptkey == IPT_UI_STORY && enabled_dats) { - if (main_filters::actual != FILTER_FAVORITE_GAME) + if (!isfavorite()) { const game_driver *driver = (const game_driver *)m_event->itemref; if ((FPTR)driver > 3) @@ -440,7 +440,7 @@ void ui_menu_select_game::handle() // handle UI_SYSINFO else if (m_event->iptkey == IPT_UI_SYSINFO && enabled_dats) { - if (main_filters::actual != FILTER_FAVORITE_GAME) + if (!isfavorite()) { const game_driver *driver = (const game_driver *)m_event->itemref; if ((FPTR)driver > 3) @@ -457,7 +457,7 @@ void ui_menu_select_game::handle() // handle UI_COMMAND else if (m_event->iptkey == IPT_UI_COMMAND && enabled_dats) { - if (main_filters::actual != FILTER_FAVORITE_GAME) + if (!isfavorite()) { const game_driver *driver = (const game_driver *)m_event->itemref; if ((FPTR)driver > 3) @@ -474,7 +474,7 @@ void ui_menu_select_game::handle() // handle UI_FAVORITES else if (m_event->iptkey == IPT_UI_FAVORITES) { - if (main_filters::actual != FILTER_FAVORITE_GAME) + if (!isfavorite()) { const game_driver *driver = (const game_driver *)m_event->itemref; if ((FPTR)driver > 3) @@ -588,10 +588,10 @@ void ui_menu_select_game::populate() ui_globals::switch_image = true; int old_item_selected = -1; - if (main_filters::actual != FILTER_FAVORITE_GAME) + if (!isfavorite()) { // if search is not empty, find approximate matches - if (m_search[0] != 0 && !no_active_search()) + if (m_search[0] != 0 && !isfavorite()) populate_search(); else { @@ -797,7 +797,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott filtered.assign(main_filters::text[main_filters::actual]).append(" (").append(c_year::ui[c_year::actual]).append(") -"); // display the current typeahead - if (no_active_search()) + if (isfavorite()) tempbuf[1].clear(); else tempbuf[1].assign(filtered).append(" Search: ").append(m_search).append("_"); @@ -834,7 +834,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott } // determine the text to render below - if (main_filters::actual != FILTER_FAVORITE_GAME) + if (!isfavorite()) driver = ((FPTR)selectedref > 3) ? (const game_driver *)selectedref : nullptr; else { @@ -1184,9 +1184,9 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) // returns if the search can be activated //------------------------------------------------- -inline bool ui_menu_select_game::no_active_search() +inline bool ui_menu_select_game::isfavorite() { - return (main_filters::actual == FILTER_FAVORITE_GAME); + return (main_filters::actual == FILTER_FAVORITE); } //------------------------------------------------- @@ -1198,14 +1198,14 @@ void ui_menu_select_game::inkey_special(const ui_menu_event *m_event) int buflen = strlen(m_search); // if it's a backspace and we can handle it, do so - if (((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0) && !no_active_search()) + if (((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0) && !isfavorite()) { *(char *)utf8_previous_char(&m_search[buflen]) = 0; reset(UI_MENU_RESET_SELECT_FIRST); } // if it's any other key and we're not maxed out, update - else if ((m_event->unichar >= ' ' && m_event->unichar < 0x7f) && !no_active_search()) + else if ((m_event->unichar >= ' ' && m_event->unichar < 0x7f) && !isfavorite()) { buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar); m_search[buflen] = 0; diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h index 67906471663..4c1cf548d60 100644 --- a/src/emu/ui/selgame.h +++ b/src/emu/ui/selgame.h @@ -56,7 +56,7 @@ private: void build_available_list(); void build_list(std::vector &vec, const char *filter_text = nullptr, int filter = 0, bool bioscheck = false); - bool no_active_search(); + bool isfavorite(); void populate_search(); void init_sorted_list(); bool load_available_machines(); diff --git a/src/emu/ui/utils.cpp b/src/emu/ui/utils.cpp index 79bec2fc149..608b6b16a88 100644 --- a/src/emu/ui/utils.cpp +++ b/src/emu/ui/utils.cpp @@ -25,15 +25,15 @@ std::vector c_mnfct::ui; // Main filters UINT16 main_filters::actual = 0; -const char *main_filters::text[] = { "All", "Available", "Unavailable", "Working", "Not Mechanical", "Category", "Favorites", "BIOS", - "Originals", "Clones", "Not Working", "Mechanical", "Manufacturers", "Years", "Support Save", - "Not Support Save", "CHD", "No CHD", "Vertical", "Horizontal", "Custom" }; +const char *main_filters::text[] = { "All", "Available", "Unavailable", "Working", "Not Working", "Mechanical", "Not Mechanical", + "Category", "Favorites", "BIOS", "Originals", "Clones", "Manufacturers", "Years", "Support Save", + "Not Support Save", "CHD", "No CHD", "Vertical", "Horizontal", "Custom" }; size_t main_filters::length = ARRAY_LENGTH(main_filters::text); // Software filters UINT16 sw_filters::actual = 0; const char *sw_filters::text[] = { "All", "Available", "Unavailable", "Originals", "Clones", "Years", "Publishers", "Supported", - "Partial Supported", "Unsupported", "Region", "Device Type", "Software List", "Custom" }; + "Partial Supported", "Unsupported", "Region", "Device Type", "Software List", "Custom" }; size_t sw_filters::length = ARRAY_LENGTH(sw_filters::text); // Globals diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index 1cc08e2ae7e..81c509f9958 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -28,14 +28,14 @@ enum FILTER_AVAILABLE, FILTER_UNAVAILABLE, FILTER_WORKING, + FILTER_NOT_WORKING, + FILTER_MECHANICAL, FILTER_NOT_MECHANICAL, FILTER_CATEGORY, - FILTER_FAVORITE_GAME, + FILTER_FAVORITE, FILTER_BIOS, FILTER_PARENT, FILTER_CLONES, - FILTER_NOT_WORKING, - FILTER_MECHANICAL, FILTER_MANUFACTURER, FILTER_YEAR, FILTER_SAVE, -- cgit v1.2.3-70-g09d2 From c1124bed4fbad8597d490c82725ee7d56ba47d25 Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Wed, 10 Feb 2016 20:27:38 -0500 Subject: Fix more validation errors in electron_cass.xml and now passes on this end (nw) --- hash/electron_cass.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hash/electron_cass.xml b/hash/electron_cass.xml index e3233beae5b..8dce4799365 100644 --- a/hash/electron_cass.xml +++ b/hash/electron_cass.xml @@ -1229,7 +1229,7 @@ Bugs 1984 - >Virgin Games + Virgin Games @@ -5066,7 +5066,7 @@ Jungle Jive 1984 - >Virgin Games + Virgin Games @@ -6065,7 +6065,7 @@ - > + Nightmare Maze (Blue Ribbon) 1984 Blue Ribbon -- cgit v1.2.3-70-g09d2 From 433d80de99211cdf1f1de542537ba7b0d1364cfa Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Wed, 10 Feb 2016 20:42:05 -0500 Subject: Format fixes for m5_cart.xml (nw) --- hash/m5_cart.xml | 142 +++++++++++++++++++++++++++---------------------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/hash/m5_cart.xml b/hash/m5_cart.xml index 194e624fd79..c090bd9cfe1 100644 --- a/hash/m5_cart.xml +++ b/hash/m5_cart.xml @@ -608,85 +608,85 @@ come from... they might be eventually removed --> - - EM-5 Expansion memory 32Kb - 198? - Sord - - - - - - + + EM-5 Expansion memory 32Kb + 198? + Sord + + + + + + - - EM-64 Expansion memory 64Kb - 198? - unknown - - - - - - - - - 64Kbf Expansion memory 64Kb - 199? - unknown - - - - - - - - - + + EM-64 Expansion memory 64Kb + 198? + unknown + + + + + + + + + 64Kbf Expansion memory 64Kb + 199? + unknown + + + + + + + + + - - 64Krx Expansion board 64Kb - 199? - unknown - - - - - - + + 64Krx Expansion board 64Kb + 199? + unknown + + + + + + - - - - + + + + - - + + - - Boot for Brno ramdisk - 1989 - <Pavel Brychta a spol.> - - - - - - - - - Brno windows boot - 1989 - <Ladislav Novak> - - - - - - + + Boot for Brno ramdisk + 1989 + <Pavel Brychta a spol.> + + + + + + + + + Brno windows boot + 1989 + <Ladislav Novak> + + + + + + -- cgit v1.2.3-70-g09d2 From b8ed5b6d320ad255a72bdee2907a0621a85a1399 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 10 Feb 2016 23:35:22 -0300 Subject: New clones added or promoted from NOT_WORKING status ---------------------------------------------------- Cherry Master I (ver.1.10) [Roberto Fresca, Ioannis Bampoulas] --- src/mame/arcade.lst | 1 + src/mame/drivers/goldstar.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index b09e97b6241..cf2e8719110 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -12285,6 +12285,7 @@ cmasterd // (c) 1991 Dyna Electronics cmastere // (c) 1991 Dyna Electronics cmasterf // (c) 1991 Dyna Electronics cmasterg // (c) 1991 Dyna Electronics +cmasterh // (c) 1991 Dyna Electronics cmast91 // (c) 1991 Dyna Electronics cmast92 // (c) 1992 Dyna Electronics cmast97 // (c) 1996 Dyna Electronics diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index d57f327ae69..8e8de0276bf 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -9306,6 +9306,43 @@ ROM_START( cmasterg ) ROM_END +/* Cherry Master I (V1.10) + Original Dyna upgrade for Cherry Master boards. +*/ +ROM_START( cmasterh ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "cm_v1.10_dyna.bin", 0x0000, 0x1000, CRC(872f2ef0) SHA1(ec68a03a1e8ab793d4a5eae1ce25f91608351c55) ) + ROM_CONTINUE(0x4000,0x1000) + ROM_CONTINUE(0x3000,0x1000) + ROM_CONTINUE(0x7000,0x1000) + ROM_CONTINUE(0x1000,0x1000) + ROM_CONTINUE(0x6000,0x1000) + ROM_CONTINUE(0x2000,0x1000) + ROM_CONTINUE(0x5000,0x1000) + + ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_LOAD( "7.u16", 0x00000, 0x8000, CRC(19cc1d67) SHA1(47487f9362bfb36a32100ed772960628844462bf) ) + ROM_LOAD( "6.u11", 0x08000, 0x8000, CRC(63b3df4e) SHA1(9bacd23da598805ec18ec5ad15cab95d71eb9262) ) + ROM_LOAD( "5.u4", 0x10000, 0x8000, CRC(e39fff9c) SHA1(22fdc517fa478441622c6245cecb5728c5595757) ) + + ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_LOAD( "4.u15", 0x0000, 0x2000, CRC(8607ffd9) SHA1(9bc94715554aa2473ae2ed249a47f29c7886b3dc) ) + ROM_LOAD( "3.u10", 0x2000, 0x2000, CRC(c32367be) SHA1(ff217021b9c58e23b2226f8b0a7f5da966225715) ) + ROM_LOAD( "2.u14", 0x4000, 0x2000, CRC(6dfcb188) SHA1(22430429c798954d9d979e62699b58feae7fdbf4) ) + ROM_LOAD( "1.u9", 0x6000, 0x2000, CRC(9678ead2) SHA1(e80aefa98b2363fe9e6b2415762695ace272e4d3) ) + + ROM_REGION( 0x10000, "user1", 0 ) + ROM_LOAD( "8.u53", 0x0000, 0x10000, CRC(e92443d3) SHA1(4b6ca4521841610054165f085ae05510e77af191) ) + + ROM_REGION( 0x200, "proms", 0 ) + ROM_LOAD( "n82s129an.u84", 0x0000, 0x0100, CRC(0489b760) SHA1(78f8632b17a76335183c5c204cdec856988368b0) ) + ROM_LOAD( "n82s129an.u79", 0x0100, 0x0100, CRC(21eb5b19) SHA1(9b8425bdb97f11f4855c998c7792c3291fd07470) ) + + ROM_REGION( 0x100, "proms2", 0 ) + ROM_LOAD( "n82s129an.u46", 0x0000, 0x0100, CRC(50ec383b) SHA1(ae95b92bd3946b40134bcdc22708d5c6b0f4c23e) ) +ROM_END + + ROM_START( cmast99 ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "cm99-041-8.u81", 0x0000, 0x1000, CRC(e0872d9f) SHA1(6d8f5e09e5c9daf834d5c74434eae86e5dd7e194) ) @@ -13594,6 +13631,7 @@ GAMEL( 1991, cmasterd, cmaster, cm, cmasterb, cmaster_state, cmv4, GAMEL( 1991, cmastere, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 6)", 0, layout_cmasterb ) GAMEL( 1991, cmasterf, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 7)", 0, layout_cmasterb ) GAMEL( 1991, cmasterg, cmaster, cm, cmasterg, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 8, V4-B-)", 0, layout_cmasterb ) +GAMEL( 1991, cmasterh, cmaster, cm, cmasterg, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.10)", 0, layout_cmasterb ) GAME( 199?, cmast99, 0, cm, cmv4, cmaster_state, cmv4, ROT0, "????", "Cherry Master '99", MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From a273d1e89a00d98666df4e8f127e7fd3c59fa698 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Wed, 10 Feb 2016 23:38:11 -0300 Subject: Cherry Master v1.10: Fixed inputs / DIP switches. [Roberto Fresca] --- src/mame/drivers/goldstar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 8e8de0276bf..6ceb0648c59 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -13631,7 +13631,7 @@ GAMEL( 1991, cmasterd, cmaster, cm, cmasterb, cmaster_state, cmv4, GAMEL( 1991, cmastere, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 6)", 0, layout_cmasterb ) GAMEL( 1991, cmasterf, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 7)", 0, layout_cmasterb ) GAMEL( 1991, cmasterg, cmaster, cm, cmasterg, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 8, V4-B-)", 0, layout_cmasterb ) -GAMEL( 1991, cmasterh, cmaster, cm, cmasterg, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.10)", 0, layout_cmasterb ) +GAMEL( 1991, cmasterh, cmaster, cm, cmasterb, cmaster_state, cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.10)", 0, layout_cmasterb ) GAME( 199?, cmast99, 0, cm, cmv4, cmaster_state, cmv4, ROT0, "????", "Cherry Master '99", MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From ff8da84bdd402267b1770046a36146d2902f84a7 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Thu, 11 Feb 2016 00:40:04 -0300 Subject: comments... (nw) --- src/mame/drivers/goldstar.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 6ceb0648c59..b376c0c99af 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -13614,7 +13614,6 @@ GAMEL( 198?, cmv801, 0, cm, cmv801, cmaster_state, cm, - // most of these are almost certainly bootlegs, with added features, hacked payouts etc. identifying which are // the original, unmodified dyna versions is almost impossible due to lack of documentation from back in the day, // even original boards almost always run modified sets @@ -13735,7 +13734,7 @@ GAMEL( 198?, cmpacman, 0, cm, cmpacman, cmaster_state, cm, RO GAMEL( 198?, cmtetris, 0, cm, cmtetris, cmaster_state, cm, ROT0, "", "Tetris + Cherry Master (Corsica, v8.01, set 1)", 0, layout_cmpacman ) // need to press K/L to switch between games... GAMEL( 198?, cmtetrsa, 0, cm, cmtetris, cmaster_state, cm, ROT0, "", "Tetris + Cherry Master (Corsica, v8.01, set 2)", MACHINE_NOT_WORKING, layout_cmpacman ) // seems banked... GAMEL( 198?, cmtetrsb, 0, cm, cmtetris, cmaster_state, cm, ROT0, "", "Tetris + Cherry Master (+K, Canada Version, encrypted)", MACHINE_NOT_WORKING, layout_cmpacman ) // different Tetris game. press insert to throttle and see the attract running. -GAMEL( 1997, crazybon, 0, pkrmast, crazybon, driver_device, 0, ROT0, "bootleg (Crazy Co.)", "Crazy Bonus 2002", MACHINE_IMPERFECT_COLORS, layout_crazybon ) +GAMEL( 1997, crazybon, 0, pkrmast, crazybon, driver_device, 0, ROT0, "bootleg (Crazy Co.)", "Crazy Bonus 2002", MACHINE_IMPERFECT_COLORS, layout_crazybon ) // Windows ME desktop... but not found the way to switch it. /* other possible stealth sets: - cmv4a ---> see the 1fxx zone. put a bp in 1f9f to see the loop. -- cgit v1.2.3-70-g09d2 From 7c77d6e38e5f9dc8358a053830ce34366a2a6b81 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Thu, 11 Feb 2016 00:15:44 -0500 Subject: Xerox NoteTaker: Finish documenting the I/O CPU's I/O ports, update history documentation a bit more [Lord Nightmare] --- src/mame/drivers/notetaker.cpp | 71 ++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index e19f6983b2c..644fb45e477 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -8,8 +8,10 @@ Bruce Horn - BIOS code and more Ted Kaehler - SmallTalk-76 code porting[2] and more ( http://tedkaehler.weather-dimensions.com/us/ted/index.html ) Dan Ingalls - BitBlt engine and SmallTalk kernel and more[3] - Doug Fairbairn - NoteTaker Hardware ( http://www.computerhistory.org/atchm/author/dfairbairn/ ) - + Doug Fairbairn - NoteTaker Hardware/Electronics Design ( http://www.computerhistory.org/atchm/author/dfairbairn/ ) + James Leung - NoteTaker Hardware/Electronics Design + Ron Freeman - NoteTaker Hardware/Electronics Design + * History of the machine can be found at http://freudenbergs.de/bert/publications/Ingalls-2014-Smalltalk78.pdf @@ -31,6 +33,7 @@ * [2] "Smalltalk and Object Orientation: An Introduction" By John Hunt, pages 45-46 [ISBN 978-3-540-76115-0] * [3] http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19790620_Z-IOP_1.5_ls.pdf * [4] http://xeroxalto.computerhistory.org/Filene/Smalltalk-76/ + * [5] http://bitsavers.trailing-edge.com/pdf/xerox/notetaker/memos/19790118_NoteTaker_System_Manual.pdf * MISSING DUMP for 8741? Keyboard MCU which does row-column scanning and mouse-related stuff TODO: everything below. @@ -38,16 +41,16 @@ TODO: everything below. * figure out how the emulation-cpu boots and where its 4k of local ram maps to * Get smalltalk-78 loaded as a rom and forced into ram on startup, since no boot disks have survived (or if any survived, they are not dumped) * floppy controller wd1791 - According to [3] the format is 128 bytes per sector, 16 sectors per track (one sided) + According to [3] and [5] the format is double density/MFM, 128 bytes per sector, 16 sectors per track, 1 or 2 sided, for 170K or 340K per disk. According to the schematics, we're missing an 82s147 DISKSEP.PROM used as a data separator * crt5027 video controller; we're missing a PROM used to handle memory arbitration between the crtc and the rest of the system, but the equations are on the schematic * Harris 6402 serial/EIA UART * Harris 6402 keyboard UART -* HLE for the missing MCU which reads the mouse quadratures and buttons and talks serially to the Keyboard UART +* HLE for the missing i8748[5] MCU in the keyboard which reads the mouse quadratures and buttons and talks serially to the Keyboard UART WIP: * pic8259 interrupt controller - this is attached as a device, but the interrupts are not hooked to it yet. -* i/o cpu i/o area needs the memory map worked out per the schematics - partly done +* i/o cpu i/o area needs the memory map worked out per the schematics - mostly done */ #include "cpu/i86/i86.h" @@ -147,28 +150,48 @@ ADDRESS_MAP_END /* io memory map comes from http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker/memos/19790605_Definition_of_8086_Ports.pdf and from the schematic at http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/notetaker/schematics/19790423_Notetaker_IO_Processor.pdf a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 -? ? ? ? 0 x x x x x x 0 0 0 0 x x x * . RW IntCon (PIC8259) -? ? ? ? 0 x x x x x x 0 0 0 1 x x x x . W IPConReg -? ? ? ? 0 x x x x x x 0 0 1 0 x x x x . W KbdInt -? ? ? ? 0 x x x x x x 0 0 1 1 x x x x . W FIFOReg -? ? ? ? 0 x x x x x x 0 1 0 0 x x x x . . Open Bus -? ? ? ? 0 x x x x x x 0 1 0 1 x x x x . . Open Bus -? ? ? ? 0 x x x x x x 0 1 1 0 x x x x . W FIFOBus -? ? ? ? 0 x x x x x x 0 1 1 1 x x x x . . Open Bus -0 0 0 0 0 0 0 0 * * * * * * * * * * * . R ROM, but ONLY if BootSegDone is TRUE, and /DisableROM is FALSE - +x x x x 0 x x x x x x 0 0 0 0 x x x * . RW IntCon (PIC8259) +x x x x 0 x x x x x x 0 0 0 1 x x x x . W IPConReg +x x x x 0 x x x x x x 0 0 1 0 x 0 0 0 . . KbdInt:Open Bus +x x x x 0 x x x x x x 0 0 1 0 x 0 0 1 . R KbdInt:ReadKeyData +x x x x 0 x x x x x x 0 0 1 0 x 0 1 0 . R KbdInt:ReadOPStatus +x x x x 0 x x x x x x 0 0 1 0 x 0 1 1 . . KbdInt:Open Bus +x x x x 0 x x x x x x 0 0 1 0 x 1 0 0 . W KbdInt:LoadKeyCtlReg +x x x x 0 x x x x x x 0 0 1 0 x 1 0 1 . W KbdInt:LoadKeyData +x x x x 0 x x x x x x 0 0 1 0 x 1 1 0 . W KbdInt:KeyDataReset +x x x x 0 x x x x x x 0 0 1 0 x 1 1 1 . W KbdInt:KeyChipReset +x x x x 0 x x x x x x 0 0 1 1 x x x x . W FIFOReg +x x x x 0 x x x x x x 0 1 0 0 x x x x . . Open Bus +x x x x 0 x x x x x x 0 1 0 1 x x x x . . Open Bus +x x x x 0 x x x x x x 0 1 1 0 x x x x . W FIFOBus +x x x x 0 x x x x x x 0 1 1 1 x x x x . . Open Bus +x x x x 0 x x x x x x 1 0 0 0 x x x x . RW SelDiskReg +x x x x 0 x x x x x x 1 0 0 1 x x * * . RW SelDiskInt +x x x x 0 x x x x x x 1 0 1 0 * * * * . W SelCrtInt +x x x x 0 x x x x x x 1 0 1 1 x x x x . W LoadDispAddr +x x x x 0 x x x x x x 1 1 0 0 x x x x . . Open Bus +x x x x 0 x x x x x x 0 1 0 1 x 0 0 0 . R SelEIA:ReadEIAStatus +x x x x 0 x x x x x x 0 1 0 1 x 0 0 1 . R SelEIA:ReadEIAData +x x x x 0 x x x x x x 0 1 0 1 x 0 1 0 . . SelEIA:Open Bus +x x x x 0 x x x x x x 0 1 0 1 x 0 1 1 . . SelEIA:Open Bus +x x x x 0 x x x x x x 0 1 0 1 x 1 0 0 . W SelEIA:LoadEIACtlReg +x x x x 0 x x x x x x 0 1 0 1 x 1 0 1 . W SelEIA:LoadEIAData +x x x x 0 x x x x x x 0 1 0 1 x 1 1 0 . W SelEIA:EIADataReset +x x x x 0 x x x x x x 0 1 0 1 x 1 1 1 . W SelEIA:EIAChipReset +x x x x 0 x x x x x x 1 1 1 0 x x x x . R SelADCHi +x x x x 0 x x x x x x 1 1 1 1 x x x x . W CRTSwitch */ static ADDRESS_MAP_START(notetaker_io, AS_IO, 16, notetaker_state) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x03) AM_MIRROR(0x7E1C) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x20, 0x21) AM_MIRROR(0x7E1E) AM_WRITE(IPConReg_w) // processor (rom mapping, etc) control register - //AM_RANGE(0x42, 0x43) AM_READ read keyboard data (high byte only) [from mcu?] - //AM_RANGE(0x44, 0x45) AM_READ read keyboard fifo state (high byte only) [from mcu?] - //AM_RANGE(0x48, 0x49) AM_WRITE kbd->uart control register [to mcu?] - //AM_RANGE(0x4a, 0x4b) AM_WRITE kbd->uart data register [to mcu?] - //AM_RANGE(0x4c, 0x4d) AM_WRITE kbd data reset [to mcu?] - //AM_RANGE(0x4e, 0x4f) AM_WRITE kbd chip [mcu?] reset [to mcu?] - //AM_RANGE(0x60, 0x61) AM_WRITE DAC sample and hold and frequency setup + AM_RANGE(0x00, 0x03) AM_MIRROR(0xF7E1C) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x20, 0x21) AM_MIRROR(0xF7E1E) AM_WRITE(IPConReg_w) // processor (rom mapping, etc) control register + //AM_RANGE(0x42, 0x43) AM_MIRROR(0xF7E10) AM_READ(ReadKeyData_r) // read keyboard data (high byte only) [from mcu?] + //AM_RANGE(0x44, 0x45) AM_MIRROR(0xF7E10) AM_READ(ReadOPStatus_r) // read keyboard fifo state (high byte only) [from mcu?] + //AM_RANGE(0x48, 0x49) AM_MIRROR(0xF7E10) AM_WRITE(LoadKeyCtlReg_w) // kbd uart control register + //AM_RANGE(0x4a, 0x4b) AM_MIRROR(0xF7E10) AM_WRITE(LoadKeyData_w) // kbd uart data register + //AM_RANGE(0x4c, 0x4d) AM_MIRROR(0xF7E10) AM_WRITE(KeyDataReset_w) // kbd uart ddr switch (data reset) + //AM_RANGE(0x4e, 0x4f) AM_MIRROR(0xF7E10) AM_WRITE(KeyChipReset_w) // kbd uart reset + //AM_RANGE(0x60, 0x61) AM_MIRROR(0xF7E1E) AM_WRITE(FIFOReg_w) // DAC sample and hold and frequency setup //AM_RANGE(0x100, 0x101) AM_WRITE I/O register (adc speed, crtc pixel clock enable, etc) //AM_RANGE(0x140, 0x15f) AM_DEVREADWRITE("crt5027", crt5027_device, read, write) ADDRESS_MAP_END -- cgit v1.2.3-70-g09d2 From 4743f08e1bee9c5919405b3b417cf51afcf9792b Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Thu, 11 Feb 2016 00:33:36 -0500 Subject: oops. that doesn't work. (n/w) --- src/mame/drivers/notetaker.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index 644fb45e477..ca36c069361 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -183,15 +183,15 @@ x x x x 0 x x x x x x 1 1 1 1 x x x x */ static ADDRESS_MAP_START(notetaker_io, AS_IO, 16, notetaker_state) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x03) AM_MIRROR(0xF7E1C) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x20, 0x21) AM_MIRROR(0xF7E1E) AM_WRITE(IPConReg_w) // processor (rom mapping, etc) control register - //AM_RANGE(0x42, 0x43) AM_MIRROR(0xF7E10) AM_READ(ReadKeyData_r) // read keyboard data (high byte only) [from mcu?] - //AM_RANGE(0x44, 0x45) AM_MIRROR(0xF7E10) AM_READ(ReadOPStatus_r) // read keyboard fifo state (high byte only) [from mcu?] - //AM_RANGE(0x48, 0x49) AM_MIRROR(0xF7E10) AM_WRITE(LoadKeyCtlReg_w) // kbd uart control register - //AM_RANGE(0x4a, 0x4b) AM_MIRROR(0xF7E10) AM_WRITE(LoadKeyData_w) // kbd uart data register - //AM_RANGE(0x4c, 0x4d) AM_MIRROR(0xF7E10) AM_WRITE(KeyDataReset_w) // kbd uart ddr switch (data reset) - //AM_RANGE(0x4e, 0x4f) AM_MIRROR(0xF7E10) AM_WRITE(KeyChipReset_w) // kbd uart reset - //AM_RANGE(0x60, 0x61) AM_MIRROR(0xF7E1E) AM_WRITE(FIFOReg_w) // DAC sample and hold and frequency setup + AM_RANGE(0x00, 0x03) AM_MIRROR(0x7E1C) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x20, 0x21) AM_MIRROR(0x7E1E) AM_WRITE(IPConReg_w) // processor (rom mapping, etc) control register + //AM_RANGE(0x42, 0x43) AM_MIRROR(0x7E10) AM_READ(ReadKeyData_r) // read keyboard data (high byte only) [from mcu?] + //AM_RANGE(0x44, 0x45) AM_MIRROR(0x7E10) AM_READ(ReadOPStatus_r) // read keyboard fifo state (high byte only) [from mcu?] + //AM_RANGE(0x48, 0x49) AM_MIRROR(0x7E10) AM_WRITE(LoadKeyCtlReg_w) // kbd uart control register + //AM_RANGE(0x4a, 0x4b) AM_MIRROR(0x7E10) AM_WRITE(LoadKeyData_w) // kbd uart data register + //AM_RANGE(0x4c, 0x4d) AM_MIRROR(0x7E10) AM_WRITE(KeyDataReset_w) // kbd uart ddr switch (data reset) + //AM_RANGE(0x4e, 0x4f) AM_MIRROR(0x7E10) AM_WRITE(KeyChipReset_w) // kbd uart reset + //AM_RANGE(0x60, 0x61) AM_MIRROR(0x7E1E) AM_WRITE(FIFOReg_w) // DAC sample and hold and frequency setup //AM_RANGE(0x100, 0x101) AM_WRITE I/O register (adc speed, crtc pixel clock enable, etc) //AM_RANGE(0x140, 0x15f) AM_DEVREADWRITE("crt5027", crt5027_device, read, write) ADDRESS_MAP_END -- cgit v1.2.3-70-g09d2 From 3a5c9d62a782561165b4cf3c6cf603b3a70c77d6 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 11 Feb 2016 10:32:58 +0100 Subject: make window index part of osd_window (nw) --- src/osd/modules/osdwindow.h | 2 ++ src/osd/sdl/window.h | 3 +-- src/osd/windows/window.cpp | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h index be4f016f0f9..a702569c581 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -38,6 +38,7 @@ public: m_hwnd(0), m_dc(0), m_focus_hwnd(0), m_resize_state(0), #endif m_primlist(NULL), + m_index(0), m_prescale(1) {} virtual ~osd_window() { } @@ -78,6 +79,7 @@ public: render_primitive_list *m_primlist; osd_window_config m_win_config; + int m_index; protected: int m_prescale; }; diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index 3de110fe536..c890b6c0ff2 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -52,7 +52,7 @@ public: #else m_sdlsurf(NULL), #endif - m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0), m_index(0) + m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0) { m_win_config = *config; m_index = index; @@ -165,7 +165,6 @@ private: // monitor info osd_monitor_info * m_monitor; int m_fullscreen; - int m_index; osd_renderer * m_renderer; // static callbacks ... diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index dd219949534..4dcbd1661e7 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -659,6 +659,7 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in window->m_win_config = *config; window->m_monitor = monitor; window->m_fullscreen = !video_config.windowed; + window->m_index = index; // see if we are safe for fullscreen window->m_fullscreen_safe = TRUE; -- cgit v1.2.3-70-g09d2 From 335aedb3e60425740e7748f6a7d4283754ba6ed9 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Thu, 11 Feb 2016 12:52:09 +0100 Subject: Fixed UI crash. (nw) --- src/emu/ui/menu.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index 886b069bd7d..cfd81dc9787 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -2193,9 +2193,6 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float { bool no_available = false; float line_height = machine().ui().get_line_height(); - static int old_panel_width_pixel = -1; - static int old_panel_height_pixel = -1; - // if it fails, use the default image if (!tmp_bitmap->valid()) @@ -2216,16 +2213,6 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float int screen_height = machine().render().ui_target().height(); int panel_width_pixel = panel_width * screen_width; int panel_height_pixel = panel_height * screen_height; - - if (old_panel_height_pixel == -1 || old_panel_width_pixel == -1) - snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel); - - if (old_panel_height_pixel != panel_height_pixel) - old_panel_height_pixel = panel_height_pixel; - - if (old_panel_height_pixel != panel_width_pixel) - old_panel_width_pixel = panel_width_pixel; - float ratio = 0.0f; // Calculate resize ratios for resizing @@ -2268,8 +2255,7 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float dest_bitmap = tmp_bitmap; //snapx_bitmap->reset(); - if (old_panel_height_pixel != panel_height_pixel || old_panel_width_pixel != panel_width_pixel) - snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel); + snapx_bitmap->allocate(panel_width_pixel, panel_height_pixel); int x1 = (0.5f * panel_width_pixel) - (0.5f * dest_xPixel); int y1 = (0.5f * panel_height_pixel) - (0.5f * dest_yPixel); -- cgit v1.2.3-70-g09d2 From 9c07f76389d0b73df8034cb0f55b1092e7dfc6bd Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 11 Feb 2016 16:40:40 +0000 Subject: new skeleton Cross Puzzle [Ryan Holtz, Smitdogg, The Dumping Union] --- scripts/target/mame/arcade.lua | 1 + src/mame/arcade.lst | 1 + src/mame/drivers/amazonlf.cpp | 91 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 src/mame/drivers/amazonlf.cpp diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index d4bc8eb26b1..ba487965464 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -4247,6 +4247,7 @@ files { MAME_DIR .. "src/mame/machine/inder_vid.cpp", MAME_DIR .. "src/mame/machine/inder_vid.h", MAME_DIR .. "src/mame/drivers/corona.cpp", + MAME_DIR .. "src/mame/drivers/amazonlf.cpp", MAME_DIR .. "src/mame/drivers/crystal.cpp", MAME_DIR .. "src/mame/video/vrender0.cpp", MAME_DIR .. "src/mame/video/vrender0.h", diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index cf2e8719110..bf808c28c26 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -10559,6 +10559,7 @@ fastdraw_130 // (c) 1995 aplatoon // (c) 199? Nova? zortonbr // (c) 1993 Web Picmatic +crospuzl // // Crystal System crysbios crysking // 2001 Brezzasoft. Crystal of the kings diff --git a/src/mame/drivers/amazonlf.cpp b/src/mame/drivers/amazonlf.cpp new file mode 100644 index 00000000000..129af7c3631 --- /dev/null +++ b/src/mame/drivers/amazonlf.cpp @@ -0,0 +1,91 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/* + + uses ADC 'Amazon-LF' SoC, EISC CPU core - similar to crystal system? + +*/ + +#include "emu.h" +#include "cpu/se3208/se3208.h" + + +class amazonlf_state : public driver_device +{ +public: + amazonlf_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_screen(*this, "screen") + { } + + /* devices */ + required_device m_maincpu; + required_device m_screen; + + + virtual void machine_start() override; + virtual void machine_reset() override; + UINT32 screen_update_amazonlf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void screen_eof_amazonlf(screen_device &screen, bool state); +}; + +static ADDRESS_MAP_START( amazonlf_mem, AS_PROGRAM, 32, amazonlf_state ) + AM_RANGE(0x00000000, 0x0007ffff) AM_ROM +ADDRESS_MAP_END + +void amazonlf_state::machine_start() +{ +} + +void amazonlf_state::machine_reset() +{ +} + +UINT32 amazonlf_state::screen_update_amazonlf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +void amazonlf_state::screen_eof_amazonlf(screen_device &screen, bool state) +{ +} + + +static INPUT_PORTS_START(amazonlf) + +INPUT_PORTS_END + + + + + +static MACHINE_CONFIG_START( amazonlf, amazonlf_state ) + + MCFG_CPU_ADD("maincpu", SE3208, 25175000) // ? + MCFG_CPU_PROGRAM_MAP(amazonlf_mem) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479) + MCFG_SCREEN_UPDATE_DRIVER(amazonlf_state, screen_update_amazonlf) + MCFG_SCREEN_VBLANK_DRIVER(amazonlf_state, screen_eof_amazonlf) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_RRRRRGGGGGGBBBBB("palette") +MACHINE_CONFIG_END + + +ROM_START( crospuzl ) + ROM_REGION( 0x80010, "maincpu", 0 ) + ROM_LOAD("en29lv040a.u5", 0x000000, 0x80010, CRC(d50e8500) SHA1(d681cd18cd0e48854c24291d417d2d6d28fe35c1) ) + + ROM_REGION32_LE( 0x8400010, "user1", ROMREGION_ERASEFF ) // Flash + // mostly empty, but still looks good + ROM_LOAD("k9f1g08u0a.riser", 0x000000, 0x8400010, CRC(7f3c88c3) SHA1(db3169a7b4caab754e9d911998a2ece13c65ce5b) ) +ROM_END + + +GAME( 200?, crospuzl, 0, amazonlf, amazonlf, driver_device, 0, ROT0, "", "Cross Puzzle", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -- cgit v1.2.3-70-g09d2 From d93b1366bec1b34fd9439532b20ac48ef876aea5 Mon Sep 17 00:00:00 2001 From: yz70s Date: Thu, 11 Feb 2016 19:13:20 +0100 Subject: chihiro.cpp: fiddle with backface culling (nw) --- src/mame/video/chihiro.cpp | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/src/mame/video/chihiro.cpp b/src/mame/video/chihiro.cpp index 845110e59b4..825986b10e9 100644 --- a/src/mame/video/chihiro.cpp +++ b/src/mame/video/chihiro.cpp @@ -2552,6 +2552,7 @@ void nv2a_renderer::clear_depth_buffer(int what, UINT32 value) UINT32 nv2a_renderer::render_triangle_culling(const rectangle &cliprect, render_delegate callback, int paramcount, const vertex_t &_v1, const vertex_t &_v2, const vertex_t &_v3) { float areax2; + NV2A_GL_CULL_FACE face = NV2A_GL_CULL_FACE::FRONT; if (backface_culling_enabled == false) return render_triangle(cliprect, callback, paramcount, _v1, _v2, _v3); @@ -2559,13 +2560,25 @@ UINT32 nv2a_renderer::render_triangle_culling(const rectangle &cliprect, render_ return 0; areax2 = _v1.x*(_v2.y - _v3.y) + _v2.x*(_v3.y - _v1.y) + _v3.x*(_v1.y - _v2.y); if (backface_culling_winding == NV2A_GL_FRONT_FACE::CCW) - areax2 = -areax2; - // if areax2 >= 0 then front faced else back faced - if ((backface_culling_culled == NV2A_GL_CULL_FACE::FRONT) && (areax2 >= 0)) - return 0; - if ((backface_culling_culled == NV2A_GL_CULL_FACE::BACK) && (areax2 < 0)) - return 0; - return render_triangle(cliprect, callback, paramcount, _v1, _v2, _v3); + { + if (-areax2 <= 0) + face = NV2A_GL_CULL_FACE::BACK; + else + face = NV2A_GL_CULL_FACE::FRONT; + } else + { + if (areax2 <= 0) + face = NV2A_GL_CULL_FACE::BACK; + else + face = NV2A_GL_CULL_FACE::FRONT; + } + if (face == NV2A_GL_CULL_FACE::FRONT) + if (backface_culling_culled == NV2A_GL_CULL_FACE::BACK) + return render_triangle(cliprect, callback, paramcount, _v1, _v2, _v3); + if (face == NV2A_GL_CULL_FACE::BACK) + if (backface_culling_culled == NV2A_GL_CULL_FACE::FRONT) + return render_triangle(cliprect, callback, paramcount, _v1, _v2, _v3); + return 0; } int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UINT32 subchannel, UINT32 method, UINT32 address, int &countlen) @@ -2580,6 +2593,16 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN printf("A:%08X MTHD:%08X D:%08X\n\r",address,maddress,data); #endif if (maddress == 0x17fc) { +#if 1 // useful while debugging to see what coordinates have been used + static int debugvc = 0; + if (debugvc) + if (data == 0) + { + printf("%d %d\n\r", primitive_type, vertex_first); + for (int n = 0; n < vertex_first; n++) + printf("%d X:%f Y:%f Z:%f W:%f x:%f y:%f\n\r", n, vertex_software[n].attribute[0].fv[0], vertex_software[n].attribute[0].fv[1], vertex_software[n].attribute[0].fv[2], vertex_software[n].attribute[0].fv[3], vertex_xy[n].x, vertex_xy[n].y); + } +#endif vertex_count = 0; vertex_first = 0; indexesleft_count = 0; -- cgit v1.2.3-70-g09d2 From 3c71d46bc5390a367110b4c9b66de2e73cd24a94 Mon Sep 17 00:00:00 2001 From: yz70s Date: Thu, 11 Feb 2016 19:15:05 +0100 Subject: xbox.cpp: more usb (nw) --- src/mame/includes/xbox.h | 10 ++++- src/mame/machine/xbox.cpp | 97 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 87 insertions(+), 20 deletions(-) diff --git a/src/mame/includes/xbox.h b/src/mame/includes/xbox.h index ea4db5c7db4..58d7588fc62 100644 --- a/src/mame/includes/xbox.h +++ b/src/mame/includes/xbox.h @@ -111,7 +111,7 @@ struct USBSetupPacket { UINT16 wLength; }; -struct USBStandardDeviceDscriptor { +struct USBStandardDeviceDescriptor { UINT8 bLength; UINT8 bDescriptorType; UINT16 bcdUSB; @@ -190,10 +190,14 @@ enum USBDescriptorType { class ohci_function_device { public: - ohci_function_device(); + ohci_function_device(running_machine &machine); void execute_reset(); int execute_transfer(int address, int endpoint, int pid, UINT8 *buffer, int size); private: + void add_device_descriptor(USBStandardDeviceDescriptor &descriptor); + void add_configuration_descriptor(USBStandardConfigurationDescriptor &descriptor); + void add_interface_descriptor(USBStandardInterfaceDescriptor &descriptor); + void add_endpoint_descriptor(USBStandardEndpointDescriptor &descriptor); int address; int newaddress; int controldirection; @@ -202,6 +206,8 @@ private: bool settingaddress; int remain; UINT8 *position; + UINT8 *descriptors; + int descriptors_pos; }; class xbox_base_state : public driver_device diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp index d341d9804d5..dcd197b155f 100644 --- a/src/mame/machine/xbox.cpp +++ b/src/mame/machine/xbox.cpp @@ -633,7 +633,8 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) int changed = 0; int list = 1; bool cont = false; - int pid, remain, mps; + bool retire = false; + int pid, remain, mps, done; hcca = ohcist.hc_regs[HcHCCA]; if (ohcist.state == UsbOperational) { @@ -709,21 +710,20 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) if ((ohcist.transfer_descriptor.be ^ ohcist.transfer_descriptor.cbp) & 0xfffff000) a |= 0x1000; remain = a - b + 1; - if (pid == InPid) { - mps = ohcist.endpoint_descriptor.mps; + mps = ohcist.endpoint_descriptor.mps; + if ((pid == InPid) || (pid == OutPid)) { if (remain < mps) mps = remain; } - else { - mps = ohcist.endpoint_descriptor.mps; - } - if (ohcist.transfer_descriptor.cbp == 0) + if (ohcist.transfer_descriptor.cbp == 0) { + remain = 0; mps = 0; + } b = ohcist.transfer_descriptor.cbp; // if sending ... if (pid != InPid) { // ... get mps bytes - for (int c = 0; c < mps; c++) { + for (int c = 0; c < remain; c++) { ohcist.buffer[c] = ohcist.space->read_byte(b); b++; if ((b & 0xfff) == 0) @@ -732,11 +732,11 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) } // should check for time available // execute transaction - mps=ohcist.ports[1].function->execute_transfer(ohcist.endpoint_descriptor.fa, ohcist.endpoint_descriptor.en, pid, ohcist.buffer, mps); + done=ohcist.ports[1].function->execute_transfer(ohcist.endpoint_descriptor.fa, ohcist.endpoint_descriptor.en, pid, ohcist.buffer, mps); // if receiving ... if (pid == InPid) { - // ... store mps bytes - for (int c = 0; c < mps; c++) { + // ... store done bytes + for (int c = 0; c < done; c++) { ohcist.space->write_byte(b,ohcist.buffer[c]); b++; if ((b & 0xfff) == 0) @@ -746,9 +746,20 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) // status writeback (CompletionCode field, DataToggleControl field, CurrentBufferPointer field, ErrorCount field) ohcist.transfer_descriptor.cc = NoError; ohcist.transfer_descriptor.t = (ohcist.transfer_descriptor.t ^ 1) | 2; + // if all data is transferred (or there was no data to transfer) cbp must be 0 ? + if ((done == remain) || (pid == SetupPid)) + b = 0; ohcist.transfer_descriptor.cbp = b; ohcist.transfer_descriptor.ec = 0; - if ((remain == mps) || (mps == 0)) { + retire = false; + if ((done == mps) && (done == remain)) { + retire = true; + } + if ((done != mps) && (done <= remain)) + retire = true; + if (done == 0) + retire = true; + if (retire == true) { // retire transfer descriptor a = ohcist.endpoint_descriptor.headp; ohcist.endpoint_descriptor.headp = ohcist.transfer_descriptor.nexttd; @@ -822,16 +833,53 @@ void xbox_base_state::usb_ohci_plug(int port, ohci_function_device *function) } } -static USBStandardDeviceDscriptor devdesc = {18,1,0x201,0xff,0x34,0x56,64,0x100,0x101,0x301,0,0,0,1}; +static USBStandardDeviceDescriptor devdesc = {18,1,0x110,0x00,0x00,0x00,64,0x45e,0x202,0x100,0,0,0,1}; +static USBStandardConfigurationDescriptor condesc = {9,2,0x20,1,1,0,0x80,50}; +static USBStandardInterfaceDescriptor intdesc = {9,4,0,0,2,0x58,0x42,0,0}; +static USBStandardEndpointDescriptor enddesc82 = {7,5,0x82,3,0x20,4}; +static USBStandardEndpointDescriptor enddesc02 = {7,5,0x02,3,0x20,4}; -ohci_function_device::ohci_function_device() +ohci_function_device::ohci_function_device(running_machine &machine) { + descriptors = auto_alloc_array(machine, UINT8, 1024); + descriptors_pos = 0; address = 0; newaddress = 0; controldirection = 0; + controltype = 0; + controlrecipient = 0; remain = 0; position = nullptr; settingaddress = false; + add_device_descriptor(devdesc); + add_configuration_descriptor(condesc); + add_interface_descriptor(intdesc); + add_endpoint_descriptor(enddesc82); + add_endpoint_descriptor(enddesc02); +} + +void ohci_function_device::add_device_descriptor(USBStandardDeviceDescriptor &descriptor) +{ + memcpy(descriptors + descriptors_pos, &descriptor, sizeof(descriptor)); + descriptors_pos += sizeof(descriptor); +} + +void ohci_function_device::add_configuration_descriptor(USBStandardConfigurationDescriptor &descriptor) +{ + memcpy(descriptors + descriptors_pos, &descriptor, sizeof(descriptor)); + descriptors_pos += sizeof(descriptor); +} + +void ohci_function_device::add_interface_descriptor(USBStandardInterfaceDescriptor &descriptor) +{ + memcpy(descriptors + descriptors_pos, &descriptor, sizeof(descriptor)); + descriptors_pos += sizeof(descriptor); +} + +void ohci_function_device::add_endpoint_descriptor(USBStandardEndpointDescriptor &descriptor) +{ + memcpy(descriptors + descriptors_pos, &descriptor, sizeof(descriptor)); + descriptors_pos += sizeof(descriptor); } void ohci_function_device::execute_reset() @@ -868,11 +916,20 @@ int ohci_function_device::execute_transfer(int address, int endpoint, int pid, U case GET_DESCRIPTOR: if ((p->wValue >> 8) == DEVICE) { // device descriptor //p->wValue & 255; - position = (UINT8 *)&devdesc; - remain = sizeof(devdesc); + position = descriptors; + remain = descriptors[0]; } else if ((p->wValue >> 8) == CONFIGURATION) { // configuration descriptor - remain = 0; + position = descriptors + 18; + remain = descriptors[18+2]; + } + else if ((p->wValue >> 8) == INTERFACE) { // interface descriptor + position = descriptors + 18 + 9; + remain = descriptors[18 + 9]; + } + else if ((p->wValue >> 8) == ENDPOINT) { // endpoint descriptor + position = descriptors + 18 + 9 + 9; + remain = descriptors[18 + 9 + 9]; } if (remain > p->wLength) remain = p->wLength; @@ -887,6 +944,7 @@ int ohci_function_device::execute_transfer(int address, int endpoint, int pid, U break; } } + size = 0; } else if (pid == InPid) { // if no data has been transferred (except for the setup stage) @@ -1588,6 +1646,8 @@ ADDRESS_MAP_END void xbox_base_state::machine_start() { + ohci_function_device *usb_device; + nvidia_nv2a = std::make_unique(machine()); memset(pic16lc_buffer, 0, sizeof(pic16lc_buffer)); pic16lc_buffer[0] = 'B'; @@ -1626,7 +1686,8 @@ void xbox_base_state::machine_start() ohcist.space = &m_maincpu->space(); ohcist.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xbox_base_state::usb_ohci_timer), this), (void *)"USB OHCI Timer"); ohcist.timer->enable(false); - usb_ohci_plug(1, new ohci_function_device()); // test connect + usb_device = new ohci_function_device(machine()); + usb_ohci_plug(1, usb_device); // test connect #endif memset(&superiost, 0, sizeof(superiost)); superiost.configuration_mode = false; -- cgit v1.2.3-70-g09d2 From 4f59bc6bc796de4746809b87827a0a297944eb23 Mon Sep 17 00:00:00 2001 From: yz70s Date: Thu, 11 Feb 2016 19:41:47 +0100 Subject: xbox.cpp: little correction (nw) --- src/mame/machine/xbox.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp index dcd197b155f..bed1f2b01d9 100644 --- a/src/mame/machine/xbox.cpp +++ b/src/mame/machine/xbox.cpp @@ -1646,7 +1646,9 @@ ADDRESS_MAP_END void xbox_base_state::machine_start() { +#ifdef USB_ENABLED ohci_function_device *usb_device; +#endif nvidia_nv2a = std::make_unique(machine()); memset(pic16lc_buffer, 0, sizeof(pic16lc_buffer)); -- cgit v1.2.3-70-g09d2 From 6d484910fb254b554288cc7a5e1ef11ba6cf4cb8 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Thu, 11 Feb 2016 16:44:13 -0300 Subject: Some notes... (nw) --- src/mame/drivers/goldstar.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index b376c0c99af..7581dcb9e77 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -9308,6 +9308,7 @@ ROM_END /* Cherry Master I (V1.10) Original Dyna upgrade for Cherry Master boards. + It laks of STOP ALL button. */ ROM_START( cmasterh ) ROM_REGION( 0x10000, "maincpu", 0 ) -- cgit v1.2.3-70-g09d2 From 0c5784200ca3c5a9e5d7f984d87a606280d4af45 Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 11 Feb 2016 20:51:54 +0100 Subject: fidel68k: new skeleton driver (nw) --- scripts/target/mame/mess.lua | 1 + src/mame/drivers/fidel6502.cpp | 255 +++++++++++++++++++++++++++++++++++++++- src/mame/drivers/fidel68k.cpp | 98 ++++++++++++++++ src/mame/drivers/fidelz80.cpp | 260 +---------------------------------------- src/mame/layout/fidel_eag.lay | 20 ++++ src/mame/mess.lst | 2 + 6 files changed, 378 insertions(+), 258 deletions(-) create mode 100644 src/mame/drivers/fidel68k.cpp create mode 100644 src/mame/layout/fidel_eag.lay diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index c1e73771342..cb9a150224a 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -1700,6 +1700,7 @@ files { MAME_DIR .. "src/mame/drivers/fidelz80.cpp", MAME_DIR .. "src/mame/includes/fidelz80.h", MAME_DIR .. "src/mame/drivers/fidel6502.cpp", + MAME_DIR .. "src/mame/drivers/fidel68k.cpp", } createMESSProjects(_target, _subtarget, "force") diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index f4f1013eb7b..c331937fab4 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -3,7 +3,260 @@ /****************************************************************************** Fidelity Electronics 6502 based board driver - See drivers/fidelz80.cpp for hardware description + +****************************************************************************** + +Champion Sensory Chess Challenger (CSC) +--------------------------------------- + +Memory map: +----------- +0000-07FF: 2K of RAM +0800-0FFF: 1K of RAM (note: mirrored twice) +1000-17FF: PIA 0 (display, TSI speech chip) +1800-1FFF: PIA 1 (keypad, LEDs) +2000-3FFF: 101-64019 ROM (also used on the regular sensory chess challenger) +4000-7FFF: mirror of 0000-3FFF +8000-9FFF: not used +A000-BFFF: 101-1025A03 ROM +C000-DFFF: 101-1025A02 ROM +E000-FDFF: 101-1025A01 ROM +FE00-FFFF: 512 byte 74S474 PROM + +CPU is a 6502 running at 1.95MHz (3.9MHz resonator, divided by 2) + +NMI is not used. +IRQ is connected to a 600Hz oscillator (38.4KHz divided by 64). +Reset is connected to a power-on reset circuit. + +PIA 0: +------ +PA0 - 7seg segments E, TSI A0 +PA1 - 7seg segments D, TSI A1 +PA2 - 7seg segments C, TSI A2 +PA3 - 7seg segments H, TSI A3 +PA4 - 7seg segments G, TSI A4 +PA5 - 7seg segments F, TSI A5 +PA6 - 7seg segments B +PA7 - 7seg segments A + +PB0 - A12 on speech ROM (if used... not used on this model, ROM is 4K) +PB1 - START line on TSI +PB2 - white wire +PB3 - BUSY line from TSI +PB4 - hi/lo TSI speaker volume +PB5 - button row 9 +PB6 - selection jumper (resistor to 5V) +PB7 - selection jumper (resistor to ground) + +CA1 - NC +CA2 - violet wire + +CB1 - NC +CB2 - NC (connects to pin 14 of soldered connector) + +PIA 1: +------ +PA0 - button row 1 +PA1 - button row 2 +PA2 - button row 3 +PA3 - button row 4 +PA4 - button row 5 +PA5 - button row 6 +PA6 - 7442 selector bit 0 +PA7 - 7442 selector bit 1 + +PB0 - LED row 1 +PB1 - LED row 2 +PB2 - LED row 3 +PB3 - LED row 4 +PB4 - LED row 5 +PB5 - LED row 6 +PB6 - LED row 7 +PB7 - LED row 8 + +CA1 - button row 7 +CA2 - selector bit 3 + +CB1 - button row 8 +CB2 - selector bit 2 + +Selector: (attached to PIA 1, outputs 1 of 10 pins low. 7442) +--------- +output # (selected turns this column on, and all others off) +0 - LED column A, button column A, 7seg digit 1 +1 - LED column B, button column B, 7seg digit 2 +2 - LED column C, button column C, 7seg digit 3 +3 - LED column D, button column D, 7seg digit 4 +4 - LED column E, button column E +5 - LED column F, button column F +6 - LED column G, button column G +7 - LED column H, button column H +8 - button column I +9 - Tone line (toggle to make a tone in the buzzer) + +The rows/columns are indicated on the game board: + + ABCDEFGH I +-------------- +| | 8 +| | 7 +| | 6 +| | 5 +| | 4 +| | 3 +| | 2 +| | 1 +-------------- + +The "lone LED" is above the control column. +column I is the "control column" on the right for starting a new game, etc. + +The upper 6 buttons are connected as such: + +column A - speak +column B - RV +column C - TM +column D - LV +column E - DM +column F - ST + +these 6 buttons use row 9 (connects to PIA 0) + +LED display: +------------ +43 21 (digit number) +----- +88:88 + +The LED display is four 7 segment digits. normal ABCDEFG lettering is used for segments. + +The upper dot is connected to digit 3 common +The lower dot is connected to digit 4 common +The lone LED is connected to digit 1 common + +All three of the above are called "segment H". + + +****************************************************************************** + +Sensory Chess Challenger (SC12-B, 6086) +4 versions are known to exist: A,B,C, and X, with increasing CPU speed. +--------------------------------- +RE information from netlist by Berger + +8*(8+1) buttons, 8+8+2 red LEDs +DIN 41524C printer port +36-pin edge connector +CPU is a R65C02P4, running at 4MHz + +NE556 dual-timer IC: +- timer#1, one-shot at power-on, to CPU _RESET +- timer#2: R1=82K, R2=1K, C=22nf, to CPU _IRQ: ~780Hz, active low=15.25us + +Memory map: +----------- +6000-0FFF: 4K RAM (2016 * 2) +2000-5FFF: cartridge +6000-7FFF: control(W) +8000-9FFF: 8K ROM SSS SCM23C65E4 +A000-BFFF: keypad(R) +C000-DFFF: 4K ROM TI TMS2732AJL-45 +E000-FFFF: 8K ROM Toshiba TMM2764D-2 + +control: (74LS377) +-------- +Q0-Q3: 7442 A0-A3 +Q4: enable printer port pin 1 input +Q5: printer port pin 5 output +Q6,Q7: LEDs common anode + +7442 0-8: input mux and LEDs cathode +7442 9: buzzer + +The keypad is read through a 74HC251, where S0,1,2 is from CPU A0,1,2, Y is connected to CPU D7. +If control Q4 is set, printer data can be read from I0. + + +****************************************************************************** + +Voice Excellence (model 6092) +---------------- +PCB 1: 510.1117A02, appears to be identical to other "Excellence" boards +CPU: GTE G65SC102P-3, 32 KB PRG ROM: AMI 101-1080A01(IC5), 8192x8 SRAM SRM2264C10(IC6) +2 rows of LEDs on the side: 1*8 green, 1*8 red + +PCB 2: 510.1117A01 +Speech: TSI S14001A, 32 KB ROM: AMI 101-1081A01(IC2) +Dip Switches set ROM A13 and ROM A14, on the side of the board + +ROM A12 is tied to S14001A's A11 (yuck) +ROM A11 is however tied to the CPU's XYZ + +0000_07FF - Spanish 1/4 +0800_0FFF - Spanish 3/4 +1000_17FF - Spanish 2/4 +1800_1FFF - Spanish 4/4 + +2000_27FF - French 1/4 +2800_2FFF - French 3/4 +3000_3FFF - French 2/4 +3800_3FFF - French 4/4 + +4000_47FF - German 1/4 +4800_4FFF - German 3/4 +5000_57FF - German 2/4 +5800_5FFF - German 4/4 + +6000_67FF - English 1/2 +6800_6FFF - Bridge Challenger 1/2 +7000_77FF - English 2/2 +7800_7FFF - Bridge Challenger 2/2 + +------------------ +RE info by hap, based on PCB photos + +Memory map: +----------- +0000-3FFF: 8K RAM (SRM2264) +4000-7FFF: control (R/W) +8000-FFFF: 32K ROM (M27256 compatible) + +control (W): +------------ +Z80 A0-A2 to 3*74259, Z80 Dx to D (_C unused) + +Z80 D0: +- Q4,Q5: led commons +- Q6,Q7,Q2,Q1: 7seg panel digit select +- Q0-Q3: 7442 A0-A3 + + 0-7: led data + + 0-8: keypad mux + + 9: buzzer out + +Z80 D1: (model 6093) +- Q0-Q7: 7seg data + +Z80 D2: (model 6092) +- Q0-Q5: TSI C0-C5 +- Q6: TSI START pin +- Q7: TSI ROM A11 + +A11 from TSI is tied to TSI ROM A12(!) +TSI ROM A13,A14 are hardwired to the 2 language switches. +Sound comes from the Audio out pin, digital out pins are N/C. + +control (R): +------------ +Z80 A0-A2 to 2*74251, Z80 Dx to output + +Z80 D7 to Y: +- D0-D7: keypad row data + +Z80 D6 to W: (model 6092, tied to VCC otherwise) +- D0,D1: language switches +- D2-D6: VCC +- D7: TSI BUSY ******************************************************************************/ diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp new file mode 100644 index 00000000000..2c89571272c --- /dev/null +++ b/src/mame/drivers/fidel68k.cpp @@ -0,0 +1,98 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/****************************************************************************** + + Fidelity Electronics 68000 based board driver + +******************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" + +#include "includes/fidelz80.h" + +// internal artwork +#include "fidel_eag.lh" + + +class fidel68k_state : public fidelz80base_state +{ +public: + fidel68k_state(const machine_config &mconfig, device_type type, const char *tag) + : fidelz80base_state(mconfig, type, tag) + { } + + // EAG + //.. +}; + + + +// Devices, I/O + +/****************************************************************************** + EAG +******************************************************************************/ + + + +/****************************************************************************** + Address Maps +******************************************************************************/ + +// EAG + +static ADDRESS_MAP_START( eag_map, AS_PROGRAM, 16, fidel68k_state ) + AM_RANGE(0x000000, 0x01ffff) AM_ROM +ADDRESS_MAP_END + + + +/****************************************************************************** + Input Ports +******************************************************************************/ + +static INPUT_PORTS_START( eag ) + +INPUT_PORTS_END + + + +/****************************************************************************** + Machine Drivers +******************************************************************************/ + +static MACHINE_CONFIG_START( eag, fidel68k_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(eag_map) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_fidel_eag) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +ROM_START( feagv2 ) + ROM_REGION16_BE( 0x20000, "maincpu", 0 ) + ROM_LOAD16_BYTE("V2_6114_E5.bin", 0x00000, 0x10000, CRC(f9c7bada) SHA1(60e545f829121b9a4f1100d9e85ac83797715e80) ) + ROM_LOAD16_BYTE("V2_6114_O5.bin", 0x00001, 0x10000, CRC(04f97b22) SHA1(8b2845dd115498f7b385e8948eca6a5893c223d1) ) +ROM_END + + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +COMP( 198?, feagv2, 0, 0, eag, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde V2", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 3ebb4f2919e..0b89945fd0a 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -3,7 +3,8 @@ /****************************************************************************** Fidelity Electronics Z80 based board driver - for 6502 based boards, see drivers/fidel6502.cpp (documentation is in this driver) + for 6502 based boards, see drivers/fidel6502.cpp + for 68000 based boards, see drivers/fidel68k.cpp TODO: - Figure out why it says the first speech line twice; it shouldn't? @@ -345,140 +346,6 @@ by the grids. hi = grid on, hi = segment on. A detailed description of the hardware can be found also in the patent 4,373,719. -****************************************************************************** - -Champion Sensory Chess Challenger (CSC) ---------------------------------------- - -Memory map: ------------ -0000-07FF: 2K of RAM -0800-0FFF: 1K of RAM (note: mirrored twice) -1000-17FF: PIA 0 (display, TSI speech chip) -1800-1FFF: PIA 1 (keypad, LEDs) -2000-3FFF: 101-64019 ROM (also used on the regular sensory chess challenger) -4000-7FFF: mirror of 0000-3FFF -8000-9FFF: not used -A000-BFFF: 101-1025A03 ROM -C000-DFFF: 101-1025A02 ROM -E000-FDFF: 101-1025A01 ROM -FE00-FFFF: 512 byte 74S474 PROM - -CPU is a 6502 running at 1.95MHz (3.9MHz resonator, divided by 2) - -NMI is not used. -IRQ is connected to a 600Hz oscillator (38.4KHz divided by 64). -Reset is connected to a power-on reset circuit. - -PIA 0: ------- -PA0 - 7seg segments E, TSI A0 -PA1 - 7seg segments D, TSI A1 -PA2 - 7seg segments C, TSI A2 -PA3 - 7seg segments H, TSI A3 -PA4 - 7seg segments G, TSI A4 -PA5 - 7seg segments F, TSI A5 -PA6 - 7seg segments B -PA7 - 7seg segments A - -PB0 - A12 on speech ROM (if used... not used on this model, ROM is 4K) -PB1 - START line on TSI -PB2 - white wire -PB3 - BUSY line from TSI -PB4 - hi/lo TSI speaker volume -PB5 - button row 9 -PB6 - selection jumper (resistor to 5V) -PB7 - selection jumper (resistor to ground) - -CA1 - NC -CA2 - violet wire - -CB1 - NC -CB2 - NC (connects to pin 14 of soldered connector) - -PIA 1: ------- -PA0 - button row 1 -PA1 - button row 2 -PA2 - button row 3 -PA3 - button row 4 -PA4 - button row 5 -PA5 - button row 6 -PA6 - 7442 selector bit 0 -PA7 - 7442 selector bit 1 - -PB0 - LED row 1 -PB1 - LED row 2 -PB2 - LED row 3 -PB3 - LED row 4 -PB4 - LED row 5 -PB5 - LED row 6 -PB6 - LED row 7 -PB7 - LED row 8 - -CA1 - button row 7 -CA2 - selector bit 3 - -CB1 - button row 8 -CB2 - selector bit 2 - -Selector: (attached to PIA 1, outputs 1 of 10 pins low. 7442) ---------- -output # (selected turns this column on, and all others off) -0 - LED column A, button column A, 7seg digit 1 -1 - LED column B, button column B, 7seg digit 2 -2 - LED column C, button column C, 7seg digit 3 -3 - LED column D, button column D, 7seg digit 4 -4 - LED column E, button column E -5 - LED column F, button column F -6 - LED column G, button column G -7 - LED column H, button column H -8 - button column I -9 - Tone line (toggle to make a tone in the buzzer) - -The rows/columns are indicated on the game board: - - ABCDEFGH I --------------- -| | 8 -| | 7 -| | 6 -| | 5 -| | 4 -| | 3 -| | 2 -| | 1 --------------- - -The "lone LED" is above the control column. -column I is the "control column" on the right for starting a new game, etc. - -The upper 6 buttons are connected as such: - -column A - speak -column B - RV -column C - TM -column D - LV -column E - DM -column F - ST - -these 6 buttons use row 9 (connects to PIA 0) - -LED display: ------------- -43 21 (digit number) ------ -88:88 - -The LED display is four 7 segment digits. normal ABCDEFG lettering is used for segments. - -The upper dot is connected to digit 3 common -The lower dot is connected to digit 4 common -The lone LED is connected to digit 1 common - -All three of the above are called "segment H". - - ****************************************************************************** Voice Sensory Chess Challenger (VSC) @@ -550,7 +417,7 @@ This sequence repeats every 16 addresses. So to recap: 10-FF: mirrors of 00-0F. -Refer to the Sensory Champ. Chess Chall. above for explanations of the below +Refer to the Sensory Champ. Chess Chall. for explanations of the below I/O names and labels. It's the same. 8255: @@ -614,127 +481,6 @@ Anyways, the two jumpers are connected to button columns A and B and the common connects to Z80A PIO PB.5, which basically makes a 10th button row. I would expect that the software reads these once on startup only. - -****************************************************************************** - -Sensory Chess Challenger (SC12-B, 6086) -4 versions are known to exist: A,B,C, and X, with increasing CPU speed. ---------------------------------- -RE information from netlist by Berger - -8*(8+1) buttons, 8+8+2 red LEDs -DIN 41524C printer port -36-pin edge connector -CPU is a R65C02P4, running at 4MHz - -NE556 dual-timer IC: -- timer#1, one-shot at power-on, to CPU _RESET -- timer#2: R1=82K, R2=1K, C=22nf, to CPU _IRQ: ~780Hz, active low=15.25us - -Memory map: ------------ -6000-0FFF: 4K RAM (2016 * 2) -2000-5FFF: cartridge -6000-7FFF: control(W) -8000-9FFF: 8K ROM SSS SCM23C65E4 -A000-BFFF: keypad(R) -C000-DFFF: 4K ROM TI TMS2732AJL-45 -E000-FFFF: 8K ROM Toshiba TMM2764D-2 - -control: (74LS377) --------- -Q0-Q3: 7442 A0-A3 -Q4: enable printer port pin 1 input -Q5: printer port pin 5 output -Q6,Q7: LEDs common anode - -7442 0-8: input mux and LEDs cathode -7442 9: buzzer - -The keypad is read through a 74HC251, where S0,1,2 is from CPU A0,1,2, Y is connected to CPU D7. -If control Q4 is set, printer data can be read from I0. - - -****************************************************************************** - -Voice Excellence (model 6092) ----------------- -PCB 1: 510.1117A02, appears to be identical to other "Excellence" boards -CPU: GTE G65SC102P-3, 32 KB PRG ROM: AMI 101-1080A01(IC5), 8192x8 SRAM SRM2264C10(IC6) -2 rows of LEDs on the side: 1*8 green, 1*8 red - -PCB 2: 510.1117A01 -Speech: TSI S14001A, 32 KB ROM: AMI 101-1081A01(IC2) -Dip Switches set ROM A13 and ROM A14, on the side of the board - -ROM A12 is tied to S14001A's A11 (yuck) -ROM A11 is however tied to the CPU's XYZ - -0000_07FF - Spanish 1/4 -0800_0FFF - Spanish 3/4 -1000_17FF - Spanish 2/4 -1800_1FFF - Spanish 4/4 - -2000_27FF - French 1/4 -2800_2FFF - French 3/4 -3000_3FFF - French 2/4 -3800_3FFF - French 4/4 - -4000_47FF - German 1/4 -4800_4FFF - German 3/4 -5000_57FF - German 2/4 -5800_5FFF - German 4/4 - -6000_67FF - English 1/2 -6800_6FFF - Bridge Challenger 1/2 -7000_77FF - English 2/2 -7800_7FFF - Bridge Challenger 2/2 - ------------------- -RE info by hap, based on PCB photos - -Memory map: ------------ -0000-3FFF: 8K RAM (SRM2264) -4000-7FFF: control (R/W) -8000-FFFF: 32K ROM (M27256 compatible) - -control (W): ------------- -Z80 A0-A2 to 3*74259, Z80 Dx to D (_C unused) - -Z80 D0: -- Q4,Q5: led commons -- Q6,Q7,Q2,Q1: 7seg panel digit select -- Q0-Q3: 7442 A0-A3 - + 0-7: led data - + 0-8: keypad mux - + 9: buzzer out - -Z80 D1: (model 6093) -- Q0-Q7: 7seg data - -Z80 D2: (model 6092) -- Q0-Q5: TSI C0-C5 -- Q6: TSI START pin -- Q7: TSI ROM A11 - -A11 from TSI is tied to TSI ROM A12(!) -TSI ROM A13,A14 are hardwired to the 2 language switches. -Sound comes from the Audio out pin, digital out pins are N/C. - -control (R): ------------- -Z80 A0-A2 to 2*74251, Z80 Dx to output - -Z80 D7 to Y: -- D0-D7: keypad row data - -Z80 D6 to W: (model 6092, tied to VCC otherwise) -- D0,D1: language switches -- D2-D6: VCC -- D7: TSI BUSY - ******************************************************************************/ #include "emu.h" diff --git a/src/mame/layout/fidel_eag.lay b/src/mame/layout/fidel_eag.lay new file mode 100644 index 00000000000..9d3e4d2766a --- /dev/null +++ b/src/mame/layout/fidel_eag.lay @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 5d885ff4781..fca9f76e047 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2167,6 +2167,8 @@ fscc12 fexcel fexcelv +feagv2 + // Hegener & Glaser Munich //mephisto // Mephisto 1 - roms needed - not in driver mm2 // Mephisto 2 -- cgit v1.2.3-70-g09d2 From 7d75908e3793654246d472c5bb81bc1399d84168 Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 11 Feb 2016 23:08:03 +0100 Subject: fidel68k: notes --- src/mame/drivers/fidel68k.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp index 2c89571272c..bb2231e78af 100644 --- a/src/mame/drivers/fidel68k.cpp +++ b/src/mame/drivers/fidel68k.cpp @@ -4,6 +4,24 @@ Fidelity Electronics 68000 based board driver +****************************************************************************** + +Elite Avant Garde (EAG) +----------------------- + +- MC68HC000P12F 16MHz CPU, 16MHz XTAL +- MB1422A DRAM Controller, 25MHz XTAL near, 4 DRAM slots(this model: slot 1 and 2 64KB) +- 2*27C512 EPROM, 2*KM6264AL-10 SRAM, 2*AT28C64X EEPROM(parallel) +- OKI M82C51A-2 USART, 4.9152MHz XTAL, assume it's used for factory test/debug +- other special: Chessboard squares are magnet sensors + + +Memory map: +----------- +000000-01FFFF: 128KB ROM +104000-107FFF: 16KB SRAM +604000-607FFF: 16KB EEPROM + ******************************************************************************/ #include "emu.h" @@ -43,7 +61,11 @@ public: // EAG static ADDRESS_MAP_START( eag_map, AS_PROGRAM, 16, fidel68k_state ) + ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0x01ffff) AM_ROM + AM_RANGE(0x104000, 0x107fff) AM_RAM + AM_RANGE(0x200000, 0x20ffff) AM_RAM + AM_RANGE(0x604000, 0x607fff) AM_RAM ADDRESS_MAP_END @@ -85,8 +107,8 @@ MACHINE_CONFIG_END ROM_START( feagv2 ) ROM_REGION16_BE( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE("V2_6114_E5.bin", 0x00000, 0x10000, CRC(f9c7bada) SHA1(60e545f829121b9a4f1100d9e85ac83797715e80) ) - ROM_LOAD16_BYTE("V2_6114_O5.bin", 0x00001, 0x10000, CRC(04f97b22) SHA1(8b2845dd115498f7b385e8948eca6a5893c223d1) ) + ROM_LOAD16_BYTE("6114_e5.u18", 0x00000, 0x10000, CRC(f9c7bada) SHA1(60e545f829121b9a4f1100d9e85ac83797715e80) ) // 27c512 + ROM_LOAD16_BYTE("6114_o5.u19", 0x00001, 0x10000, CRC(04f97b22) SHA1(8b2845dd115498f7b385e8948eca6a5893c223d1) ) // 27c512 ROM_END @@ -95,4 +117,4 @@ ROM_END ******************************************************************************/ /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 198?, feagv2, 0, 0, eag, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde V2", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +COMP( 1989, feagv2, 0, 0, eag, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde V2", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From 201560352911d7862a03b7b1a7e6701d1e5620a2 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Fri, 12 Feb 2016 11:16:24 +1100 Subject: Fixed the build (nw). --- src/mame/video/chihiro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/video/chihiro.cpp b/src/mame/video/chihiro.cpp index 825986b10e9..d1fab8ff46d 100644 --- a/src/mame/video/chihiro.cpp +++ b/src/mame/video/chihiro.cpp @@ -2598,7 +2598,7 @@ int nv2a_renderer::geforce_exec_method(address_space & space, UINT32 chanel, UIN if (debugvc) if (data == 0) { - printf("%d %d\n\r", primitive_type, vertex_first); + //printf("%d %d\n\r", primitive_type, vertex_first); for (int n = 0; n < vertex_first; n++) printf("%d X:%f Y:%f Z:%f W:%f x:%f y:%f\n\r", n, vertex_software[n].attribute[0].fv[0], vertex_software[n].attribute[0].fv[1], vertex_software[n].attribute[0].fv[2], vertex_software[n].attribute[0].fv[3], vertex_xy[n].x, vertex_xy[n].y); } -- cgit v1.2.3-70-g09d2 From d634cebf09369573d89a2910bead1999f6aeab1d Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Thu, 11 Feb 2016 20:54:32 -0500 Subject: Change clock speed to match music pitch based on video for karatedo from https://www.youtube.com/watch?v=wiKH6qXWcTs PCM/Samples are still pitched too low as detailed at http://mametesters.org/view.php?id=5607 (nw) --- src/mame/drivers/kchamp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/kchamp.cpp b/src/mame/drivers/kchamp.cpp index 49b65cf2f19..913b14a16f7 100644 --- a/src/mame/drivers/kchamp.cpp +++ b/src/mame/drivers/kchamp.cpp @@ -481,10 +481,10 @@ static MACHINE_CONFIG_START( kchamp, kchamp_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay1", AY8910, XTAL_12MHz/8) + MCFG_SOUND_ADD("ay1", AY8910, XTAL_12MHz/12) /* Guess based on actual pcb recordings of karatedo */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) - MCFG_SOUND_ADD("ay2", AY8910, XTAL_12MHz/8) + MCFG_SOUND_ADD("ay2", AY8910, XTAL_12MHz/12) /* Guess based on actual pcb recordings of karatedo */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) MCFG_DAC_ADD("dac") -- cgit v1.2.3-70-g09d2 From ae49c58f72af51bfd542a6198891384bfb39dcee Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 12 Feb 2016 11:13:59 +0000 Subject: figured out algorithm and replaced SnowBoard Championship lookup table with proper emulation of device [Samuel Neves & Peter Wilhelmsen] --- src/mame/drivers/gaelco2.cpp | 6 ---- src/mame/machine/gaelco2.cpp | 78 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 67 insertions(+), 17 deletions(-) diff --git a/src/mame/drivers/gaelco2.cpp b/src/mame/drivers/gaelco2.cpp index 06a068e372c..44739b59053 100644 --- a/src/mame/drivers/gaelco2.cpp +++ b/src/mame/drivers/gaelco2.cpp @@ -1046,9 +1046,6 @@ ROM_START( snowboara ) ROM_LOAD( "sb44", 0x0000000, 0x0400000, CRC(1bbe88bc) SHA1(15bce9ada2b742ba4d537fa8efc0f29f661bff00) ) /* GFX only */ ROM_LOAD( "sb45", 0x0400000, 0x0400000, CRC(373983d9) SHA1(05e35a8b27cab469885f0ec2a5df200a366b50a1) ) /* Sound only */ ROM_LOAD( "sb46", 0x0800000, 0x0400000, CRC(22e7c648) SHA1(baddb9bc13accd83bea61533d7286cf61cd89279) ) /* GFX only */ - - DISK_REGION( "decrypt" ) - DISK_IMAGE( "snowboar", 0, SHA1(fecf611bd9289d24a0b1cabaaf030e2cee322cfa) ) ROM_END ROM_START( snowboar ) @@ -1086,9 +1083,6 @@ ROM_START( snowboar ) ROM_LOAD( "sb.e2", 0x1100000, 0x0080000, CRC(f5948c6c) SHA1(91bba817ced194b02885ce84b7a8132ef5ca631a) ) /* GFX only */ ROM_LOAD( "sb.e3", 0x1180000, 0x0080000, CRC(4baa678f) SHA1(a7fbbd687e2d8d7e96207c8ace0799a3cc9c3272) ) /* GFX only */ ROM_FILL( 0x1200000, 0x0200000, 0x00 ) /* Empty */ - - DISK_REGION( "decrypt" ) - DISK_IMAGE( "snowboar", 0, SHA1(fecf611bd9289d24a0b1cabaaf030e2cee322cfa) ) ROM_END diff --git a/src/mame/machine/gaelco2.cpp b/src/mame/machine/gaelco2.cpp index 6d39cdd0962..0ac284242d7 100644 --- a/src/mame/machine/gaelco2.cpp +++ b/src/mame/machine/gaelco2.cpp @@ -287,19 +287,75 @@ WRITE16_MEMBER(gaelco2_state::gaelco2_eeprom_data_w) ***************************************************************************/ -READ16_MEMBER(gaelco2_state::snowboar_protection_r) +static UINT32 rol(UINT32 x, unsigned int c) { - chd_file * table = machine().rom_load().get_disk_handle(":decrypt"); - UINT8 temp[1024]; - table->read_hunk(snowboard_latch>>9, &temp[0]); - UINT16 data = (temp[(snowboard_latch & 0x1ff)*2]<<8) | temp[((snowboard_latch & 0x1ff)*2)+1]; - - // TODO: replace above lookup (8GB table) with emulation of device - - logerror("%06x: protection read (input %08x output %04x)\n", space.device().safe_pc(), snowboard_latch, data); - + return (x << c) | (x >> (32 - c)); +} + +static UINT16 get_lo(UINT32 x) +{ + return ((x & 0x00000010) << 1) | + ((x & 0x00000800) << 3) | + ((x & 0x40000000) >> 27) | + ((x & 0x00000005) << 6) | + ((x & 0x00000008) << 8) | + rol(x & 0x00800040, 9) | + ((x & 0x04000000) >> 16) | + ((x & 0x00008000) >> 14) | + ((x & 0x00002000) >> 11) | + ((x & 0x00020000) >> 10) | + ((x & 0x00100000) >> 8) | + ((x & 0x00044000) >> 5) | + ((x & 0x00000020) >> 1); +} + +static UINT16 get_hi(UINT32 x) +{ + return ((x & 0x00001400) >> 0) | + ((x & 0x10000000) >> 26) | + ((x & 0x02000000) >> 24) | + ((x & 0x08000000) >> 21) | + ((x & 0x00000002) << 12) | + ((x & 0x01000000) >> 19) | + ((x & 0x20000000) >> 18) | + ((x & 0x80000000) >> 16) | + ((x & 0x00200000) >> 13) | + ((x & 0x00010000) >> 12) | + ((x & 0x00080000) >> 10) | + ((x & 0x00000200) >> 9) | + ((x & 0x00400000) >> 8) | + ((x & 0x00000080) >> 4) | + ((x & 0x00000100) >> 1); +} + +static UINT16 get_out(UINT16 x) +{ + return ((x & 0xc840) << 0) | + ((x & 0x0080) << 2) | + ((x & 0x0004) << 3) | + ((x & 0x0008) << 5) | + ((x & 0x0010) << 8) | + ((x & 0x0002) << 9) | + ((x & 0x0001) << 13) | + ((x & 0x0200) >> 9) | + ((x & 0x1400) >> 8) | + ((x & 0x0100) >> 7) | + ((x & 0x2000) >> 6) | + ((x & 0x0020) >> 2); +} + +UINT16 mangle(UINT32 x) +{ + UINT16 a = get_lo(x); + UINT16 b = get_hi(x); + return get_out(((a ^ 0x0010) - (b ^ 0x0024)) ^ 0x5496); +} - return data; +READ16_MEMBER(gaelco2_state::snowboar_protection_r) +{ + UINT16 ret = mangle(snowboard_latch); + ret = ((ret & 0xff00) >> 8) | ((ret & 0x00ff) << 8); + return ret; } -- cgit v1.2.3-70-g09d2 From 12a23988b3d9d42bfae59d188c988e929c8bf21e Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 11 Feb 2016 23:25:56 +1100 Subject: Add a BC548 transistor model --- src/lib/netlist/devices/net_lib.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/netlist/devices/net_lib.cpp b/src/lib/netlist/devices/net_lib.cpp index 3b8edc8ac84..4df6811dddc 100644 --- a/src/lib/netlist/devices/net_lib.cpp +++ b/src/lib/netlist/devices/net_lib.cpp @@ -41,8 +41,9 @@ NETLIST_START(bjt_models) NET_MODEL("2N5190 NPN(IS=9.198E-14 NF=1.003 ISE=4.468E-16 NE=1.65 BF=338.8 IKF=0.4913 VAF=107.9 NR=1.002 ISC=5.109E-15 NC=1.071 BR=29.48 IKR=0.193 VAR=25 RB=1 IRB=1000 RBM=1 RE=0.2126 RC=0.143 XTB=0 EG=1.11 XTI=3 CJE=3.825E-11 VJE=0.7004 MJE=0.364 TF=5.229E-10 XTF=219.7 VTF=3.502 ITF=7.257 PTF=0 CJC=1.27E-11 VJC=0.4431 MJC=0.3983 XCJC=0.4555 TR=7E-11 CJS=0 VJS=0.75 MJS=0.333 FC=0.905 Vceo=45 Icrating=500m mfg=Philips)") NET_MODEL("2SC945 NPN(IS=3.577E-14 BF=2.382E+02 NF=1.01 VAF=1.206E+02 IKF=3.332E-01 ISE=3.038E-16 NE=1.205 BR=1.289E+01 NR=1.015 VAR=1.533E+01 IKR=2.037E-01 ISC=3.972E-14 NC=1.115 RB=3.680E+01 IRB=1.004E-04 RBM=1 RE=8.338E-01 RC=1.557E+00 CJE=1.877E-11 VJE=7.211E-01 MJE=3.486E-01 TF=4.149E-10 XTF=1.000E+02 VTF=9.956 ITF=5.118E-01 PTF=0 CJC=6.876p VJC=3.645E-01 MJC=3.074E-01 TR=5.145E-08 XTB=1.5 EG=1.11 XTI=3 FC=0.5 Vceo=50 Icrating=100m MFG=NEC)") - NET_MODEL("BC237B NPN(IS=1.8E-14 ISE=5.0E-14 ISC=1.72E-13 XTI=3 BF=400 BR=35.5 IKF=0.14 IKR=0.03 XTB=1.5 VAF=80 VAR=12.5 VJE=0.58 VJC=0.54 RE=0.6 RC=0.25 RB=0.56 CJE=13E-12 CJC=4E-12 XCJC=0.75 FC=0.5 NF=0.9955 NR=1.005 NE=1.46 NC=1.27 MJE=0.33 MJC=0.33 TF=0.64E-9 TR=50.72E-9 EG=1.11 KF=0 AF=1 VCEO=45V ICRATING=100M MFG=ZETEX)") + NET_MODEL("BC237B NPN(IS=1.8E-14 ISE=5.0E-14 ISC=1.72E-13 XTI=3 BF=400 BR=35.5 IKF=0.14 IKR=0.03 XTB=1.5 VAF=80 VAR=12.5 VJE=0.58 VJC=0.54 RE=0.6 RC=0.25 RB=0.56 CJE=13E-12 CJC=4E-12 XCJC=0.75 FC=0.5 NF=0.9955 NR=1.005 NE=1.46 NC=1.27 MJE=0.33 MJC=0.33 TF=0.64E-9 TR=50.72E-9 EG=1.11 KF=0 AF=1 VCEO=45 ICRATING=100M MFG=ZETEX)") NET_MODEL("BC556B PNP(IS=3.83E-14 NF=1.008 ISE=1.22E-14 NE=1.528 BF=344.4 IKF=0.08039 VAF=21.11 NR=1.005 ISC=2.85E-13 NC=1.28 BR=14.84 IKR=0.047 VAR=32.02 RB=1 IRB=1.00E-06 RBM=1 RE=0.6202 RC=0.5713 XTB=0 EG=1.11 XTI=3 CJE=1.23E-11 VJE=0.6106 MJE=0.378 TF=5.60E-10 XTF=3.414 VTF=5.23 ITF=0.1483 PTF=0 CJC=1.08E-11 VJC=0.1022 MJC=0.3563 XCJC=0.6288 TR=1.00E-32 CJS=0 VJS=0.75 MJS=0.333 FC=0.8027 Vceo=65 Icrating=100m mfg=Philips)") + NET_MODEL("BC548C NPN(IS=1.95E-14 ISE=1.31E-15 ISC=1.0E-13 XTI=3 BF=466 BR=2.42 IKF=0.18 IKR=1 XTB=1.5 VAF=91.7 VAR=24.7 VJE=0.632 VJC=0.339 RE=1 RC=1.73 RB=26.5 RBM=10 IRB=10 CJE=1.33E-11 CJC=5.17E-12 XCJC=1 FC=0.9 NF=0.993 NR=1.2 NE=1.32 NC=2.00 MJE=0.326 MJC=0.319 TF=6.52E-10 TR=0 PTF=0 ITF=1.03 VTF=1.65 XTF=100 EG=1.11 KF=1E-9 AF=1 VCEO=40 ICrating=800M MFG=Siemens)") NET_MODEL("BC817-25 NPN(IS=9.198E-14 NF=1.003 ISE=4.468E-16 NE=1.65 BF=338.8 IKF=0.4913 VAF=107.9 NR=1.002 ISC=5.109E-15 NC=1.071 BR=29.48 IKR=0.193 VAR=25 RB=1 IRB=1000 RBM=1 RE=0.2126 RC=0.143 XTB=0 EG=1.11 XTI=3 CJE=3.825E-11 VJE=0.7004 MJE=0.364 TF=5.229E-10 XTF=219.7 VTF=3.502 ITF=7.257 PTF=0 CJC=1.27E-11 VJC=0.4431 MJC=0.3983 XCJC=0.4555 TR=7E-11 CJS=0 VJS=0.75 MJS=0.333 FC=0.905 Vceo=45 Icrating=500m mfg=Philips)") NETLIST_END() -- cgit v1.2.3-70-g09d2 From 5ad3e6664d52b2bf379936c4b764ceb35a2f6f2a Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Fri, 12 Feb 2016 22:20:25 +1100 Subject: Make Zaccaria 1B11142 sound board a device in preparation for netlist sound --- scripts/target/mame/arcade.lua | 2 + src/mame/audio/laserbat.cpp | 10 -- src/mame/audio/zaccaria.cpp | 294 +++++++++++++++++++++++++++++++++++++++++ src/mame/audio/zaccaria.h | 80 +++++++++++ src/mame/drivers/laserbat.cpp | 4 +- src/mame/drivers/zaccaria.cpp | 262 +++++------------------------------- src/mame/includes/laserbat.h | 2 - src/mame/includes/zaccaria.h | 85 +++++------- 8 files changed, 441 insertions(+), 298 deletions(-) create mode 100644 src/mame/audio/zaccaria.cpp create mode 100644 src/mame/audio/zaccaria.h diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index ba487965464..f59119796fc 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -4021,6 +4021,8 @@ files { createMAMEProjects(_target, _subtarget, "zaccaria") files { + MAME_DIR .. "src/mame/audio/zaccaria.cpp", + MAME_DIR .. "src/mame/audio/zaccaria.h", MAME_DIR .. "src/mame/drivers/laserbat.cpp", MAME_DIR .. "src/mame/includes/laserbat.h", MAME_DIR .. "src/mame/video/laserbat.cpp", diff --git a/src/mame/audio/laserbat.cpp b/src/mame/audio/laserbat.cpp index ef26a168f31..a10e749757f 100644 --- a/src/mame/audio/laserbat.cpp +++ b/src/mame/audio/laserbat.cpp @@ -355,16 +355,6 @@ WRITE8_MEMBER(catnmous_state::pia_portb_w) m_psg2->data_address_w(space, (data >> 2) & 0x01, m_pia->a_output()); } -WRITE_LINE_MEMBER(catnmous_state::pia_irqa) -{ - m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE_LINE_MEMBER(catnmous_state::pia_irqb) -{ - m_audiocpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); -} - WRITE8_MEMBER(catnmous_state::psg1_porta_w) { // similar to zaccaria.c since we have no clue how this board really works diff --git a/src/mame/audio/zaccaria.cpp b/src/mame/audio/zaccaria.cpp new file mode 100644 index 00000000000..9f9b71c9a7b --- /dev/null +++ b/src/mame/audio/zaccaria.cpp @@ -0,0 +1,294 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +#include "emu.h" +#include "audio/zaccaria.h" + +#include "cpu/m6800/m6800.h" +#include "machine/clock.h" +#include "sound/dac.h" + + +device_type const ZACCARIA_1B11142 = &device_creator; + + +/* + * slave sound cpu, produces music and sound effects + * mapping: + * A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00 + * 0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram + * 0 0 0 x x x x x x x x x x x x x Open bus (for area that doesn't overlap ram) + * 0 0 1 x x x x x x x x x x x x x Open bus + * 0 1 0 x x x x x x x x x 0 0 x x Open bus + * 0 1 0 x x x x x x x x x 0 1 x x Open bus + * 0 1 0 x x x x x x x x x 1 0 x x Open bus + * 0 1 0 x x x x x x x x x 1 1 * * RW 6821 PIA @ 4I + * 0 1 1 x x x x x x x x x x x x x Open bus + * 1 0 % % * * * * * * * * * * * * R /CS4A: Enable ROM 13 + * 1 1 % % * * * * * * * * * * * * R /CS5A: Enable ROM 9 + * note that the % bits go to pins 2 (6802 A12) and 26 (6802 A13) of the roms + * monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care + * hence for actual chips used, the mem map is: + * 1 0 x * * * * * * * * * * * * * R /CS4A: Enable ROM 13 + * 1 1 x * * * * * * * * * * * * * R /CS5A: Enable ROM 9 + * + * 6821 PIA: + * CA1 comes from the master sound cpu's latch bit 7 (which is also connected to the AY chip at 4G's IOB1) + * CB1 comes from the 6802's clock divided by 4096*2 (about 437Hz) + * CA2 and CB2 are not connected + * PA0-7 connect to the data busses of the AY-3-8910 chips + * PB0 and PB1 connect to the BC1 and BDIR pins of the AY chip at 4G + * PB2 and PB3 connect to the BC1 and BDIR pins of the AY chip at 4H. + */ +static ADDRESS_MAP_START(zac1b11142_melody_map, AS_PROGRAM, 8, zac1b11142_audio_device) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x007f) AM_RAM // 6802 internal RAM + AM_RANGE(0x400c, 0x400f) AM_MIRROR(0x1ff0) AM_DEVREADWRITE("pia_4i", pia6821_device, read, write) + AM_RANGE(0x8000, 0x9fff) AM_MIRROR(0x2000) AM_ROM // rom 13 + AM_RANGE(0xc000, 0xdfff) AM_MIRROR(0x2000) AM_ROM // rom 9 +ADDRESS_MAP_END + + +/* + * master sound cpu, controls speech directly + * mapping: + * A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00 + * 0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram + * x 0 0 0 x x x x 1 x x 0 x x * * Open bus (test mode writes as if there was another PIA here) + * x 0 0 0 x x x x 1 x x 1 x x * * RW 6821 PIA @ 1I + * x 0 0 1 0 0 x x x x x x x x x x W MC1408 DAC + * x x 0 1 0 1 x x x x x x x x x x W Command to slave melody cpu + * x x 0 1 1 0 x x x x x x x x x x R Command read latch from z80 + * x x 0 1 1 1 x x x x x x x x x x Open bus + * % % 1 0 * * * * * * * * * * * * R /CS1A: Enable ROM 8 + * % % 1 1 * * * * * * * * * * * * R /CS0A: Enable ROM 7 + * note that the % bits go to pins 2 (6802 A14) and 26 (6802 A15) of the roms + * monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care + * hence for actual chips used, the mem map is: + * x * 1 0 * * * * * * * * * * * * R /CS1A: Enable ROM 8 + * x * 1 1 * * * * * * * * * * * * R /CS0A: Enable ROM 7 + * + * 6821 PIA: + * PA0-7, PB0-1, CA2 and CB1 connect to the TMS5200 + * CA1 and CB2 are not connected, though the test mode assumes there's something connected to CB2 (possibly another LED like the one connected to PB4) + * PB3 connects to 'ACS' which goes to the Z80 + */ +static ADDRESS_MAP_START(zac1b11142_audio_map, AS_PROGRAM, 8, zac1b11142_audio_device) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x007f) AM_RAM // 6802 internal RAM + AM_RANGE(0x0090, 0x0093) AM_MIRROR(0x8f6c) AM_DEVREADWRITE("pia_1i", pia6821_device, read, write) + AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x83ff) AM_DEVWRITE("dac_1f", dac_device, write_unsigned8) // MC1408 + AM_RANGE(0x1400, 0x1400) AM_MIRROR(0xc3ff) AM_WRITE(melody_command_w) + AM_RANGE(0x1800, 0x1800) AM_MIRROR(0xc3ff) AM_READ(host_command_r) + AM_RANGE(0x2000, 0x2fff) AM_MIRROR(0x8000) AM_ROM // ROM 8 with A12 low + AM_RANGE(0x3000, 0x3fff) AM_MIRROR(0x8000) AM_ROM // ROM 7 with A12 low + AM_RANGE(0x6000, 0x6fff) AM_MIRROR(0x8000) AM_ROM // ROM 8 with A12 high + AM_RANGE(0x7000, 0x7fff) AM_MIRROR(0x8000) AM_ROM // ROM 7 with A12 high +ADDRESS_MAP_END + + +MACHINE_CONFIG_FRAGMENT(zac1b11142_config) + MCFG_CPU_ADD("melodycpu", M6802, XTAL_3_579545MHz) // verified on pcb + MCFG_CPU_PROGRAM_MAP(zac1b11142_melody_map) + + MCFG_DEVICE_ADD("timebase", CLOCK, XTAL_3_579545MHz/4096/2) // CPU clock divided using 4040 and half of 74LS74 + MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("pia_4i", pia6821_device, cb1_w)) + + MCFG_DEVICE_ADD("pia_4i", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(zac1b11142_audio_device, pia_4i_porta_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(zac1b11142_audio_device, pia_4i_porta_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(zac1b11142_audio_device, pia_4i_portb_w)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("melodycpu", m6802_cpu_device, nmi_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("melodycpu", m6802_cpu_device, irq_line)) + + MCFG_SOUND_ADD("ay_4g", AY8910, XTAL_3_579545MHz/2) // CPU clock divided using 4040 + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(zac1b11142_audio_device, ay_4g_porta_w)) + MCFG_AY8910_PORT_B_READ_CB(READ8(zac1b11142_audio_device, ay_4g_portb_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.15) + + MCFG_SOUND_ADD("ay_4h", AY8910, XTAL_3_579545MHz/2) // CPU clock divided using 4040 + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(zac1b11142_audio_device, ay_4h_porta_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(zac1b11142_audio_device, ay_4h_portb_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.15) + + MCFG_CPU_ADD("audiocpu", M6802, XTAL_3_579545MHz) // verified on pcb + MCFG_CPU_PROGRAM_MAP(zac1b11142_audio_map) + MCFG_CPU_PERIODIC_INT_DRIVER(zac1b11142_audio_device, input_poll, 60) + + MCFG_DEVICE_ADD("pia_1i", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(DEVREAD8("speech", tms5220_device, status_r)) + MCFG_PIA_WRITEPA_HANDLER(DEVWRITE8("speech", tms5220_device, data_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(zac1b11142_audio_device, pia_1i_portb_w)) + + MCFG_DAC_ADD("dac_1f") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.80) + + // There is no xtal, the clock is obtained from a RC oscillator as shown in the TMS5220 datasheet (R=100kOhm C=22pF) + // 162kHz measured on pin 3 20 minutes after power on, clock would then be 162.3*4=649.2kHz + MCFG_SOUND_ADD("speech", TMS5200, 649200) // ROMCLK pin measured at 162.3Khz, OSC is exactly *4 of that) + MCFG_TMS52XX_IRQ_HANDLER(DEVWRITELINE("pia_1i", pia6821_device, cb1_w)) + MCFG_TMS52XX_READYQ_HANDLER(DEVWRITELINE("pia_1i", pia6821_device, ca2_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.80) +MACHINE_CONFIG_END + + +INPUT_PORTS_START(zac1b11142_ioports) + PORT_START("1B11142") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("P1") +INPUT_PORTS_END + + +zac1b11142_audio_device::zac1b11142_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ZACCARIA_1B11142, "Zaccaria 1B11142 Sound Board", tag, owner, clock, "zac1b11142", __FILE__) + , device_mixer_interface(mconfig, *this, 1) + , m_acs_cb(*this) + , m_melodycpu(*this, "melodycpu") + , m_pia_4i(*this, "pia_4i") + , m_ay_4g(*this, "ay_4g") + , m_ay_4h(*this, "ay_4h") + , m_audiocpu(*this, "audiocpu") + , m_pia_1i(*this, "pia_1i") + , m_speech(*this, "speech") + , m_inputs(*this, "1B11142") + , m_host_command(0) + , m_melody_command(0) +{ +} + +WRITE8_MEMBER(zac1b11142_audio_device::hs_w) +{ + m_host_command = data; + m_audiocpu->set_input_line(INPUT_LINE_IRQ0, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE); +} + +READ_LINE_MEMBER(zac1b11142_audio_device::acs_r) +{ + return (~m_pia_1i->b_output() >> 3) & 0x01; +} + +WRITE_LINE_MEMBER(zac1b11142_audio_device::ressound_w) +{ + // TODO: there is a pulse-stretching network attached that should be simulated + m_melodycpu->set_input_line(INPUT_LINE_RESET, state); + // TODO: holds the reset line of m_pia_4i - can't implement this in MAME at this time + // TODO: holds the reset line of m_ay_4g - can't implement this in MAME at this time + // TODO: holds the reset line of m_ay_4h - can't implement this in MAME at this time + m_audiocpu->set_input_line(INPUT_LINE_RESET, state); + // TODO: holds the reset line of m_pia_1i - can't implement this in MAME at this time + // TODO: does some funky stuff with the VDD and VSS lines on the speech chip +} + +READ8_MEMBER(zac1b11142_audio_device::pia_4i_porta_r) +{ + UINT8 const control = m_pia_4i->b_output(); + UINT8 data = 0xff; + + if (0x01 == (control & 0x03)) + data &= m_ay_4g->data_r(space, 0); + + if (0x04 == (control & 0x0c)) + data &= m_ay_4h->data_r(space, 0); + + return data; +} + +WRITE8_MEMBER(zac1b11142_audio_device::pia_4i_porta_w) +{ + UINT8 const control = m_pia_4i->b_output(); + + if (control & 0x02) + m_ay_4g->data_address_w(space, (control >> 0) & 0x01, data); + + if (control & 0x08) + m_ay_4h->data_address_w(space, (control >> 2) & 0x01, data); +} + +WRITE8_MEMBER(zac1b11142_audio_device::pia_4i_portb_w) +{ + if (data & 0x02) + m_ay_4g->data_address_w(space, (data >> 0) & 0x01, m_pia_4i->a_output()); + + if (data & 0x08) + m_ay_4h->data_address_w(space, (data >> 2) & 0x01, m_pia_4i->a_output()); +} + +WRITE8_MEMBER(zac1b11142_audio_device::ay_4g_porta_w) +{ + // TODO: (data & 0x07) controls tromba mix volume + // TODO: (data & 0x08) controls cassa gate + // TODO: (data & 0x10) controls rullante gate +} + +READ8_MEMBER(zac1b11142_audio_device::ay_4g_portb_r) +{ + return m_melody_command; +} + +WRITE8_MEMBER(zac1b11142_audio_device::ay_4h_porta_w) +{ + // TODO: data & 0x01 controls LEVEL + // TODO: data & 0x02 controls LEVELT +} + +WRITE8_MEMBER(zac1b11142_audio_device::ay_4h_portb_w) +{ + // TODO: data & 0x01 controls ANAL3 filter +} + +READ8_MEMBER(zac1b11142_audio_device::host_command_r) +{ + return m_host_command; +} + +WRITE8_MEMBER(zac1b11142_audio_device::melody_command_w) +{ + m_melody_command = data; + m_pia_4i->ca1_w((data >> 7) & 0x01); +} + +WRITE8_MEMBER(zac1b11142_audio_device::pia_1i_portb_w) +{ + m_speech->rsq_w((data >> 0) & 0x01); + m_speech->wsq_w((data >> 1) & 0x01); + m_acs_cb((~data >> 3) & 0x01); + // TODO: a LED output().set_led_value(0, (data >> 4) & 0x01); +} + +INTERRUPT_GEN_MEMBER(zac1b11142_audio_device::input_poll) +{ + m_audiocpu->set_input_line(INPUT_LINE_NMI, (m_inputs->read() & 0x80) ? CLEAR_LINE : ASSERT_LINE); +} + +machine_config_constructor zac1b11142_audio_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(zac1b11142_config); +} + +ioport_constructor zac1b11142_audio_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(zac1b11142_ioports); +} + +void zac1b11142_audio_device::device_config_complete() +{ +} + +void zac1b11142_audio_device::device_start() +{ + m_acs_cb.resolve_safe(); + + save_item(NAME(m_host_command)); + save_item(NAME(m_melody_command)); +} + +void zac1b11142_audio_device::device_reset() +{ + m_host_command = 0; + m_melody_command = 0; +} diff --git a/src/mame/audio/zaccaria.h b/src/mame/audio/zaccaria.h new file mode 100644 index 00000000000..de796f9cf06 --- /dev/null +++ b/src/mame/audio/zaccaria.h @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +#pragma once + +#ifndef __AUDIO_ZACCARIA_H__ +#define __AUDIO_ZACCARIA_H__ + +#include "emu.h" +#include "machine/6821pia.h" +#include "machine/netlist.h" +#include "sound/ay8910.h" +#include "sound/tms5220.h" + + +extern device_type const ZACCARIA_1B11142; + + +#define MCFG_ZACCARIA_1B11142(_tag) \ + MCFG_DEVICE_ADD(_tag, ZACCARIA_1B11142, 0) + +#define MCFG_ZACCARIA_1B11142_SET_ACS_CALLBACK(_devcb) \ + devcb = &zac1b11142_audio_device::static_set_acs_cb(*device, DEVCB_##_devcb); + + +class zac1b11142_audio_device : public device_t, public device_mixer_interface +{ +public: + template static devcb_base &static_set_acs_cb(device_t &device, _Object object) + { return downcast(device).m_acs_cb.set_callback(object); } + + zac1b11142_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock); + ~zac1b11142_audio_device() { } + + // host interface + DECLARE_WRITE8_MEMBER(hs_w); + DECLARE_READ_LINE_MEMBER(acs_r); + DECLARE_WRITE_LINE_MEMBER(ressound_w); + + // melody section handlers + DECLARE_READ8_MEMBER(pia_4i_porta_r); + DECLARE_WRITE8_MEMBER(pia_4i_porta_w); + DECLARE_WRITE8_MEMBER(pia_4i_portb_w); + DECLARE_WRITE8_MEMBER(ay_4g_porta_w); + DECLARE_READ8_MEMBER(ay_4g_portb_r); + DECLARE_WRITE8_MEMBER(ay_4h_porta_w); + DECLARE_WRITE8_MEMBER(ay_4h_portb_w); + + // master audio section handlers + DECLARE_READ8_MEMBER(host_command_r); + DECLARE_WRITE8_MEMBER(melody_command_w); + DECLARE_WRITE8_MEMBER(pia_1i_portb_w); + + // input ports don't push + INTERRUPT_GEN_MEMBER(input_poll); + +protected: + virtual machine_config_constructor device_mconfig_additions() const override; + virtual ioport_constructor device_input_ports() const override; + virtual void device_config_complete() override; + virtual void device_start() override; + virtual void device_reset() override; + + devcb_write_line m_acs_cb; + + required_device m_melodycpu; + required_device m_pia_4i; + required_device m_ay_4g; + required_device m_ay_4h; + + required_device m_audiocpu; + required_device m_pia_1i; + required_device m_speech; + + required_ioport m_inputs; + + UINT8 m_host_command; + UINT8 m_melody_command; +}; + +#endif // __AUDIO_ZACCARIA_H__ \ No newline at end of file diff --git a/src/mame/drivers/laserbat.cpp b/src/mame/drivers/laserbat.cpp index c1a072ac821..60aeeef360b 100644 --- a/src/mame/drivers/laserbat.cpp +++ b/src/mame/drivers/laserbat.cpp @@ -555,8 +555,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( catnmous, laserbat_base, catnmous_state ) MCFG_PIA_READPA_HANDLER(READ8(catnmous_state, pia_porta_r)) MCFG_PIA_WRITEPA_HANDLER(WRITE8(catnmous_state, pia_porta_w)) MCFG_PIA_WRITEPB_HANDLER(WRITE8(catnmous_state, pia_portb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(catnmous_state, pia_irqa)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(catnmous_state, pia_irqb)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("audiocpu", m6802_cpu_device, nmi_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("audiocpu", m6802_cpu_device, irq_line)) MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/zaccaria.cpp b/src/mame/drivers/zaccaria.cpp index 3cc556bf7ab..328c9614af7 100644 --- a/src/mame/drivers/zaccaria.cpp +++ b/src/mame/drivers/zaccaria.cpp @@ -41,29 +41,19 @@ Notes: #include "emu.h" #include "cpu/z80/z80.h" -#include "cpu/m6800/m6800.h" #include "machine/i8255.h" -#include "sound/dac.h" #include "includes/zaccaria.h" void zaccaria_state::machine_start() { save_item(NAME(m_dsw_sel)); - save_item(NAME(m_active_8910)); - save_item(NAME(m_port0a)); - save_item(NAME(m_acs)); - save_item(NAME(m_last_port0b)); save_item(NAME(m_nmi_mask)); } void zaccaria_state::machine_reset() { m_dsw_sel = 0; - m_active_8910 = 0; - m_port0a = 0; - m_acs = 0; - m_last_port0b = 0; m_nmi_mask = 0; } @@ -71,21 +61,21 @@ WRITE8_MEMBER(zaccaria_state::dsw_sel_w) { switch (data & 0xf0) { - case 0xe0: - m_dsw_sel = 0; - break; + case 0xe0: + m_dsw_sel = 0; + break; - case 0xd0: - m_dsw_sel = 1; - break; + case 0xd0: + m_dsw_sel = 1; + break; - case 0xb0: - m_dsw_sel = 2; - break; + case 0xb0: + m_dsw_sel = 2; + break; - default: - logerror("%s: portsel = %02x\n", machine().describe_context(), data); - break; + default: + logerror("%s: portsel = %02x\n", machine().describe_context(), data); + break; } } @@ -95,94 +85,6 @@ READ8_MEMBER(zaccaria_state::dsw_r) } -WRITE8_MEMBER(zaccaria_state::ay8910_port0a_w) -{ - /* bits 0-2 go to a 74LS156 with open collector outputs - * one out of 8 Resitors is than used to form a resistor - * divider with Analog input 5 (tromba) - */ - - // bits 3-4 control the analog drum emulation on 8910 #0 ch. A - - static const int table[8] = { 8200, 5600, 3300, 1500, 820, 390, 150, 47 }; - int b0, b1, b2, ba, v; - b0 = data & 0x01; - b1 = (data & 0x02) >> 1; - b2 = (data & 0x04) >> 2; - ba = (b0<<2) | (b1<<1) | b2; - /* 150 below to scale to volume 100 */ - v = (150 * table[ba]) / (4700 + table[ba]); - //printf("dac1w %02d %04d\n", ba, v); - m_ay2->set_volume(1, v); -} - -READ8_MEMBER(zaccaria_state::port0a_r) -{ - return (m_active_8910 == 0) ? m_ay1->data_r(space, 0) : m_ay2->data_r(space, 0); -} - -WRITE8_MEMBER(zaccaria_state::port0a_w) -{ - m_port0a = data; -} - -WRITE8_MEMBER(zaccaria_state::port0b_w) -{ - /* bit 1 goes to 8910 #0 BDIR pin */ - if ((m_last_port0b & 0x02) == 0x02 && (data & 0x02) == 0x00) - { - /* bit 0 goes to the 8910 #0 BC1 pin */ - m_ay1->data_address_w(space, m_last_port0b, m_port0a); - } - else if ((m_last_port0b & 0x02) == 0x00 && (data & 0x02) == 0x02) - { - /* bit 0 goes to the 8910 #0 BC1 pin */ - if (m_last_port0b & 0x01) - m_active_8910 = 0; - } - /* bit 3 goes to 8910 #1 BDIR pin */ - if ((m_last_port0b & 0x08) == 0x08 && (data & 0x08) == 0x00) - { - /* bit 2 goes to the 8910 #1 BC1 pin */ - m_ay2->data_address_w(space, m_last_port0b >> 2, m_port0a); - } - else if ((m_last_port0b & 0x08) == 0x00 && (data & 0x08) == 0x08) - { - /* bit 2 goes to the 8910 #1 BC1 pin */ - if (m_last_port0b & 0x04) - m_active_8910 = 1; - } - - m_last_port0b = data; -} - -WRITE8_MEMBER(zaccaria_state::port1b_w) -{ - // bit 0 = /RS - m_tms->rsq_w((data >> 0) & 0x01); - // bit 1 = /WS - m_tms->wsq_w((data >> 1) & 0x01); - - // bit 3 = "ACS" (goes, inverted, to input port 6 bit 3) - m_acs = ~data & 0x08; - - // bit 4 = led (for testing?) - output().set_led_value(0,~data & 0x10); -} - - -WRITE8_MEMBER(zaccaria_state::sound_command_w) -{ - soundlatch_byte_w(space, 0, data); - m_audio2->set_input_line(0, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE); -} - -WRITE8_MEMBER(zaccaria_state::sound1_command_w) -{ - m_pia0->ca1_w(data & 0x80); - soundlatch2_byte_w(space, 0, data); -} - GAME_EXTERN(monymony); READ8_MEMBER(zaccaria_state::prot1_r) @@ -245,83 +147,23 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, zaccaria_state ) AM_RANGE(0x6800, 0x683f) AM_WRITE(attributes_w) AM_SHARE("attributesram") AM_RANGE(0x6840, 0x685f) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x6881, 0x68c0) AM_RAM AM_SHARE("spriteram2") - AM_RANGE(0x6c00, 0x6c00) AM_WRITE(flip_screen_x_w) - AM_RANGE(0x6c01, 0x6c01) AM_WRITE(flip_screen_y_w) - AM_RANGE(0x6c02, 0x6c02) AM_WRITENOP /* sound reset */ - AM_RANGE(0x6c06, 0x6c06) AM_WRITE(coin_w) - AM_RANGE(0x6c07, 0x6c07) AM_WRITE(nmi_mask_w) - AM_RANGE(0x6c00, 0x6c07) AM_READ(prot2_r) - AM_RANGE(0x6e00, 0x6e00) AM_READWRITE(dsw_r, sound_command_w) + AM_RANGE(0x6c00, 0x6c00) AM_MIRROR(0x81f8) AM_WRITE(flip_screen_x_w) + AM_RANGE(0x6c01, 0x6c01) AM_MIRROR(0x81f8) AM_WRITE(flip_screen_y_w) + AM_RANGE(0x6c02, 0x6c02) AM_MIRROR(0x81f8) AM_WRITE(ressound_w) + AM_RANGE(0x6c06, 0x6c06) AM_MIRROR(0x81f8) AM_WRITE(coin_w) + AM_RANGE(0x6c07, 0x6c07) AM_MIRROR(0x81f8) AM_WRITE(nmi_mask_w) + AM_RANGE(0x6c00, 0x6c07) AM_MIRROR(0x81f8) AM_READ(prot2_r) + AM_RANGE(0x6e00, 0x6e00) AM_MIRROR(0x81f8) AM_READ(dsw_r) AM_DEVWRITE("audiopcb", zac1b11142_audio_device, hs_w) AM_RANGE(0x7000, 0x77ff) AM_RAM AM_RANGE(0x7800, 0x7803) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) AM_RANGE(0x7c00, 0x7c00) AM_READ(watchdog_reset_r) AM_RANGE(0x8000, 0xdfff) AM_ROM ADDRESS_MAP_END -/* slave sound cpu, produces music and sound effects */ -/* mapping: - A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00 - 0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram - 0 0 0 x x x x x x x x x x x x x Open bus (for area that doesn't overlap ram) - 0 0 1 x x x x x x x x x x x x x Open bus - 0 1 0 x x x x x x x x x 0 0 x x Open bus - 0 1 0 x x x x x x x x x 0 1 x x Open bus - 0 1 0 x x x x x x x x x 1 0 x x Open bus - 0 1 0 x x x x x x x x x 1 1 * * RW 6821 PIA @ 4I - 0 1 1 x x x x x x x x x x x x x Open bus - 1 0 % % * * * * * * * * * * * * R /CS4A: Enable Rom 13 - 1 1 % % * * * * * * * * * * * * R /CS5A: Enable Rom 9 - note that the % bits go to pins 2 (6802 A12) and 26 (6802 A13) of the roms - monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care - hence for actual chips used, the mem map is: - 1 0 x * * * * * * * * * * * * * R /CS4A: Enable Rom 13 - 1 1 x * * * * * * * * * * * * * R /CS5A: Enable Rom 9 - - 6821 PIA: CA1 comes from the master sound cpu's latch bit 7 (which is also connected to the AY chip at 4G's IOB1); CB1 comes from a periodic counter clocked by the 6802's clock, divided by 4096. CA2 and CB2 are disconnected. PA0-7 connect to the data busses of the AY-3-8910 chips; PB0 and PB1 connect to the BC1 and BDIR pins of the AY chip at 4G; PB2 and PB3 connect to the BC1 and BDIR pins of the AY chip at 4H. -*/ -static ADDRESS_MAP_START( sound_map_1, AS_PROGRAM, 8, zaccaria_state ) - AM_RANGE(0x0000, 0x007f) AM_RAM - AM_RANGE(0x500c, 0x500f) AM_DEVREADWRITE("pia0", pia6821_device, read, write) AM_MIRROR(0x1ff0) - AM_RANGE(0x8000, 0x9fff) AM_ROM AM_MIRROR(0x2000) // rom 13 - AM_RANGE(0xc000, 0xdfff) AM_ROM AM_MIRROR(0x2000) // rom 9 -ADDRESS_MAP_END - -/* master sound cpu, controls speech directly */ -/* mapping: - A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00 - 0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram -**** x 0 0 0 x x x x 1 x x 0 x x * * Open bus (test mode writes as if there was another PIA here) - x 0 0 0 x x x x 1 x x 1 x x * * RW 6821 PIA @ 1I - x 0 0 1 0 0 x x x x x x x x x x W MC1408 DAC - x x 0 1 0 1 x x x x x x x x x x W Command to slave sound1 cpu - x x 0 1 1 0 x x x x x x x x x x R Command read latch from z80 - x x 0 1 1 1 x x x x x x x x x x Open bus - % % 1 0 * * * * * * * * * * * * R /CS1A: Enable Rom 8 - % % 1 1 * * * * * * * * * * * * R /CS0A: Enable Rom 7 - note that the % bits go to pins 2 (6802 A14) and 26 (6802 A15) of the roms - monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care - hence for actual chips used, the mem map is: - x * 1 0 * * * * * * * * * * * * R /CS1A: Enable Rom 8 - x * 1 1 * * * * * * * * * * * * R /CS0A: Enable Rom 7 - - 6821 PIA: PA0-7, CA2 and CB1 connect to the TMS5200; CA1 and CB2 are disconnected, though the test mode assumes there's something connected to CB2 (possibly another LED like the one connected to PB4); PB3 connects to 'ACS' which goes to the z80. -*/ -static ADDRESS_MAP_START( sound_map_2, AS_PROGRAM, 8, zaccaria_state ) - AM_RANGE(0x0000, 0x007f) AM_RAM /* 6802 internal ram */ - AM_RANGE(0x0090, 0x0093) AM_DEVREADWRITE("pia1", pia6821_device, read, write) AM_MIRROR(0x8F6C) - AM_RANGE(0x1000, 0x1000) AM_DEVWRITE("mc1408", dac_device, write_unsigned8) AM_MIRROR(0x83FF) /* MC1408 */ - AM_RANGE(0x1400, 0x1400) AM_WRITE(sound1_command_w) AM_MIRROR(0xC3FF) - AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_byte_r) AM_MIRROR(0xC3FF) - AM_RANGE(0x2000, 0x2fff) AM_ROM AM_MIRROR(0x8000) // rom 8 with A12 low - AM_RANGE(0x3000, 0x3fff) AM_ROM AM_MIRROR(0x8000) // rom 7 with A12 low - AM_RANGE(0x6000, 0x6fff) AM_ROM AM_MIRROR(0x8000) // rom 8 with A12 high - AM_RANGE(0x7000, 0x7fff) AM_ROM AM_MIRROR(0x8000) // rom 7 with A12 high -ADDRESS_MAP_END - -CUSTOM_INPUT_MEMBER(zaccaria_state::acs_r) +WRITE8_MEMBER(zaccaria_state::ressound_w) { - return (m_acs & 0x08) ? 1 : 0; + m_audiopcb->ressound_w(data & 0x01); } static INPUT_PORTS_START( monymony ) @@ -429,7 +271,7 @@ static INPUT_PORTS_START( monymony ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaccaria_state,acs_r, NULL) /* "ACS" - from pin 13 of a PIA on the sound board */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("audiopcb", zac1b11142_audio_device, acs_r) /* other bits come from a protection device */ INPUT_PORTS_END @@ -500,36 +342,12 @@ static MACHINE_CONFIG_START( zaccaria, zaccaria_state ) MCFG_CPU_VBLANK_INT_DRIVER("screen", zaccaria_state, vblank_irq) // MCFG_QUANTUM_TIME(attotime::from_hz(1000000)) - MCFG_CPU_ADD("audiocpu", M6802,XTAL_3_579545MHz) /* verified on pcb */ - MCFG_CPU_PROGRAM_MAP(sound_map_1) - - MCFG_DEVICE_ADD("timebase", CLOCK, XTAL_3_579545MHz/4096/2) /* verified on pcb */ - MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("pia0", pia6821_device, cb1_w)) - -// MCFG_QUANTUM_TIME(attotime::from_hz(1000000)) - - MCFG_CPU_ADD("audio2", M6802,XTAL_3_579545MHz) /* verified on pcb */ - MCFG_CPU_PROGRAM_MAP(sound_map_2) -// MCFG_QUANTUM_TIME(attotime::from_hz(1000000)) - MCFG_DEVICE_ADD("ppi8255", I8255A, 0) MCFG_I8255_IN_PORTA_CB(IOPORT("P1")) MCFG_I8255_IN_PORTB_CB(IOPORT("P2")) MCFG_I8255_IN_PORTC_CB(IOPORT("SYSTEM")) MCFG_I8255_OUT_PORTC_CB(WRITE8(zaccaria_state, dsw_sel_w)) - MCFG_DEVICE_ADD( "pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(zaccaria_state, port0a_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(zaccaria_state, port0a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(zaccaria_state, port0b_w)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("audiocpu", m6802_cpu_device, nmi_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("audiocpu", m6802_cpu_device, irq_line)) - - MCFG_DEVICE_ADD( "pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(DEVREAD8("tms", tms5220_device, status_r)) - MCFG_PIA_WRITEPA_HANDLER(DEVWRITE8("tms", tms5220_device, data_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(zaccaria_state,port1b_w)) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60.57) /* verified on pcb */ @@ -546,24 +364,8 @@ static MACHINE_CONFIG_START( zaccaria, zaccaria_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("ay1", AY8910, XTAL_3_579545MHz/2) /* verified on pcb */ - MCFG_AY8910_PORT_B_READ_CB(READ8(driver_device, soundlatch2_byte_r)) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(zaccaria_state, ay8910_port0a_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) - - MCFG_SOUND_ADD("ay2", AY8910, XTAL_3_579545MHz/2) /* verified on pcb */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) - - MCFG_DAC_ADD("mc1408") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - - /* There is no xtal, the clock is obtained from a RC oscillator as shown in the TMS5220 datasheet (R=100kOhm C=22pF) */ - /* 162kHz measured on pin 3 20 minutesa fter power on. Clock would then be 162*4=648kHz. */ - MCFG_SOUND_ADD("tms", TMS5200, 649200) /* ROMCLK pin measured at 162.3Khz, OSC is exactly *4 of that) */ - MCFG_TMS52XX_IRQ_HANDLER(DEVWRITELINE("pia1", pia6821_device, cb1_w)) - MCFG_TMS52XX_READYQ_HANDLER(DEVWRITELINE("pia1", pia6821_device, ca2_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + MCFG_ZACCARIA_1B11142("audiopcb") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MACHINE_CONFIG_END @@ -589,11 +391,11 @@ ROM_START( monymony ) ROM_LOAD( "cpu6.2c", 0x5000, 0x1000, CRC(31da62b1) SHA1(486f07087244f8537510afacb64ddd59eb512a4d) ) ROM_CONTINUE( 0xd000, 0x1000 ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for first 6802 */ + ROM_REGION( 0x10000, "audiopcb:melodycpu", 0 ) /* 64k for first 6802 */ ROM_LOAD( "snd13.2g", 0x8000, 0x2000, CRC(78b01b98) SHA1(2aabed56cdae9463deb513c0c5021f6c8dfd271e) ) ROM_LOAD( "snd9.1i", 0xc000, 0x2000, CRC(94e3858b) SHA1(04961f67b95798b530bd83355dec612389f22255) ) - ROM_REGION( 0x10000, "audio2", 0 ) /* 64k for second 6802 */ + ROM_REGION( 0x10000, "audiopcb:audiocpu", 0 ) /* 64k for second 6802 */ ROM_LOAD( "snd8.1h", 0x2000, 0x1000, CRC(aad76193) SHA1(e08fc184efced392ee902c4cc9daaaf3310cdfe2) ) ROM_CONTINUE( 0x6000, 0x1000 ) ROM_LOAD( "snd7.1g", 0x3000, 0x1000, CRC(1e8ffe3e) SHA1(858ee7abe88d5801237e519cae2b50ae4bf33a58) ) @@ -624,11 +426,11 @@ ROM_START( jackrabt ) ROM_LOAD( "cpu-01.5h", 0xc000, 0x1000, CRC(785e1a01) SHA1(a748d300be9455cad4f912e01c2279bb8465edfe) ) ROM_LOAD( "cpu-01.6h", 0xd000, 0x1000, CRC(dd5979cf) SHA1(e9afe7002b2258a1c3132bdd951c6e20d473fb6a) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for first 6802 */ + ROM_REGION( 0x10000, "audiopcb:melodycpu", 0 ) /* 64k for first 6802 */ ROM_LOAD( "13snd.2g", 0x8000, 0x2000, CRC(fc05654e) SHA1(ed9c66672fe89c41e320e1d27b53f5efa92dce9c) ) ROM_LOAD( "9snd.1i", 0xc000, 0x2000, CRC(3dab977f) SHA1(3e79c06d2e70b050f01b7ac58be5127ba87904b0) ) - ROM_REGION( 0x10000, "audio2", 0 ) /* 64k for second 6802 */ + ROM_REGION( 0x10000, "audiopcb:audiocpu", 0 ) /* 64k for second 6802 */ ROM_LOAD( "8snd.1h", 0x2000, 0x1000, CRC(f4507111) SHA1(0513f0831b94aeda84aa4f3b4a7c60dfc5113b2d) ) ROM_CONTINUE( 0x6000, 0x1000 ) ROM_LOAD( "7snd.1g", 0x3000, 0x1000, CRC(c722eff8) SHA1(d8d1c091ab80ea2d6616e4dc030adc9905c0a496) ) @@ -663,11 +465,11 @@ ROM_START( jackrabt2 ) ROM_LOAD( "6cpu2.2c", 0x5000, 0x1000, CRC(404496eb) SHA1(44381e27e540fe9d8cacab4c3b1fe9a4f20d26a8) ) ROM_CONTINUE( 0xd000, 0x1000 ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for first 6802 */ + ROM_REGION( 0x10000, "audiopcb:melodycpu", 0 ) /* 64k for first 6802 */ ROM_LOAD( "13snd.2g", 0x8000, 0x2000, CRC(fc05654e) SHA1(ed9c66672fe89c41e320e1d27b53f5efa92dce9c) ) ROM_LOAD( "9snd.1i", 0xc000, 0x2000, CRC(3dab977f) SHA1(3e79c06d2e70b050f01b7ac58be5127ba87904b0) ) - ROM_REGION( 0x10000, "audio2", 0 ) /* 64k for second 6802 */ + ROM_REGION( 0x10000, "audiopcb:audiocpu", 0 ) /* 64k for second 6802 */ ROM_LOAD( "8snd.1h", 0x2000, 0x1000, CRC(f4507111) SHA1(0513f0831b94aeda84aa4f3b4a7c60dfc5113b2d) ) ROM_CONTINUE( 0x6000, 0x1000 ) ROM_LOAD( "7snd.1g", 0x3000, 0x1000, CRC(c722eff8) SHA1(d8d1c091ab80ea2d6616e4dc030adc9905c0a496) ) @@ -704,11 +506,11 @@ ROM_START( jackrabts ) ROM_LOAD( "6cpu.2c", 0x5000, 0x1000, CRC(f53d6356) SHA1(9b167edca59cf81a2468368a372bab132f15e2ea) ) ROM_CONTINUE( 0xd000, 0x1000 ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for first 6802 */ + ROM_REGION( 0x10000, "audiopcb:melodycpu", 0 ) /* 64k for first 6802 */ ROM_LOAD( "13snd.2g", 0x8000, 0x2000, CRC(fc05654e) SHA1(ed9c66672fe89c41e320e1d27b53f5efa92dce9c) ) ROM_LOAD( "9snd.1i", 0xc000, 0x2000, CRC(3dab977f) SHA1(3e79c06d2e70b050f01b7ac58be5127ba87904b0) ) - ROM_REGION( 0x10000, "audio2", 0 ) /* 64k for second 6802 */ + ROM_REGION( 0x10000, "audiopcb:audiocpu", 0 ) /* 64k for second 6802 */ ROM_LOAD( "8snd.1h", 0x2000, 0x1000, CRC(f4507111) SHA1(0513f0831b94aeda84aa4f3b4a7c60dfc5113b2d) ) ROM_CONTINUE( 0x6000, 0x1000 ) ROM_LOAD( "7snd.1g", 0x3000, 0x1000, CRC(c722eff8) SHA1(d8d1c091ab80ea2d6616e4dc030adc9905c0a496) ) diff --git a/src/mame/includes/laserbat.h b/src/mame/includes/laserbat.h index 1df1e972b4e..a07cdd97a87 100644 --- a/src/mame/includes/laserbat.h +++ b/src/mame/includes/laserbat.h @@ -203,8 +203,6 @@ public: DECLARE_READ8_MEMBER(pia_porta_r); DECLARE_WRITE8_MEMBER(pia_porta_w); DECLARE_WRITE8_MEMBER(pia_portb_w); - DECLARE_WRITE_LINE_MEMBER(pia_irqa); - DECLARE_WRITE_LINE_MEMBER(pia_irqb); // PSG handlers DECLARE_WRITE8_MEMBER(psg1_porta_w); diff --git a/src/mame/includes/zaccaria.h b/src/mame/includes/zaccaria.h index 62a76a1df44..6bcfa72798d 100644 --- a/src/mame/includes/zaccaria.h +++ b/src/mame/includes/zaccaria.h @@ -1,60 +1,25 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria -#include "machine/6821pia.h" -#include "machine/clock.h" -#include "sound/ay8910.h" -#include "sound/tms5220.h" +#include "emu.h" +#include "audio/zaccaria.h" class zaccaria_state : public driver_device { public: zaccaria_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audio2(*this, "audio2"), - m_pia0(*this, "pia0"), - m_ay1(*this, "ay1"), - m_ay2(*this, "ay2"), - m_tms(*this, "tms"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_videoram(*this, "videoram"), - m_attributesram(*this, "attributesram"), - m_spriteram(*this, "spriteram"), - m_spriteram2(*this, "spriteram2"), - m_dsw_port(*this, "DSW") { } - - - - /* devices */ - required_device m_maincpu; - required_device m_audio2; - required_device m_pia0; - required_device m_ay1; - required_device m_ay2; - required_device m_tms; - required_device m_gfxdecode; - required_device m_palette; - - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_attributesram; - required_shared_ptr m_spriteram; - required_shared_ptr m_spriteram2; - - required_ioport_array<3> m_dsw_port; - - int m_dsw_sel; - int m_active_8910; - int m_port0a; - int m_acs; - int m_last_port0b; - tilemap_t *m_bg_tilemap; - UINT8 m_nmi_mask; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_audiopcb(*this, "audiopcb") + , m_videoram(*this, "videoram") + , m_attributesram(*this, "attributesram") + , m_spriteram(*this, "spriteram") + , m_spriteram2(*this, "spriteram2") + , m_dsw_port(*this, "DSW") + { } DECLARE_READ8_MEMBER(dsw_r); - DECLARE_WRITE8_MEMBER(sound_command_w); - DECLARE_WRITE8_MEMBER(sound1_command_w); DECLARE_READ8_MEMBER(prot1_r); DECLARE_READ8_MEMBER(prot2_r); DECLARE_WRITE8_MEMBER(coin_w); @@ -63,13 +28,8 @@ public: DECLARE_WRITE8_MEMBER(attributes_w); DECLARE_WRITE8_MEMBER(flip_screen_x_w); DECLARE_WRITE8_MEMBER(flip_screen_y_w); - DECLARE_CUSTOM_INPUT_MEMBER(acs_r); + DECLARE_WRITE8_MEMBER(ressound_w); DECLARE_WRITE8_MEMBER(dsw_sel_w); - DECLARE_WRITE8_MEMBER(ay8910_port0a_w); - DECLARE_READ8_MEMBER(port0a_r); - DECLARE_WRITE8_MEMBER(port0a_w); - DECLARE_WRITE8_MEMBER(port0b_w); - DECLARE_WRITE8_MEMBER(port1b_w); TILE_GET_INFO_MEMBER(get_tile_info); virtual void machine_start() override; virtual void machine_reset() override; @@ -78,4 +38,21 @@ public: UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_irq); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT8 *spriteram,int color,int section); + +protected: + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_audiopcb; + + required_shared_ptr m_videoram; + required_shared_ptr m_attributesram; + required_shared_ptr m_spriteram; + required_shared_ptr m_spriteram2; + + required_ioport_array<3> m_dsw_port; + + int m_dsw_sel; + tilemap_t *m_bg_tilemap; + UINT8 m_nmi_mask; }; -- cgit v1.2.3-70-g09d2 From 3a2fe0398a50d902a0a56dae2e69d40eb6f991f9 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 12 Feb 2016 13:34:12 +0000 Subject: new clones Super Bobble Bobble (bootleg, set 4) [jordigahan] --- src/mame/arcade.lst | 1 + src/mame/drivers/bublbobl.cpp | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index bf808c28c26..d3307077951 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -2107,6 +2107,7 @@ sboblbobl // bootleg sboblbobla // bootleg sboblboblb // bootleg sboblboblc // bootleg +sboblbobld // bootleg bublboblb // bootleg bub68705 // bootleg dland // bootleg diff --git a/src/mame/drivers/bublbobl.cpp b/src/mame/drivers/bublbobl.cpp index f2fba272e1d..f79a6e7c61a 100644 --- a/src/mame/drivers/bublbobl.cpp +++ b/src/mame/drivers/bublbobl.cpp @@ -1550,6 +1550,42 @@ ROM_START( sboblboblc ) ROM_END + +ROM_START( sboblbobld ) + ROM_REGION( 0x30000, "maincpu", 0 ) + ROM_LOAD( "3.bin", 0x00000, 0x08000, CRC(524cdc4f) SHA1(f778e53f664e911a5b992a4f85bcad1097eaa36f) ) + /* ROMs banked at 8000-bfff */ + ROM_LOAD( "5.bin", 0x10000, 0x08000, CRC(13118eb1) SHA1(5a5da40c2cc82420f70bc58ffa32de1088c6c82f) ) + ROM_LOAD( "4.bin", 0x18000, 0x08000, CRC(13fe9baa) SHA1(ca1ca240d755621e533d9bbbdd8d953154670499) ) + /* 20000-2ffff empty */ + + ROM_REGION( 0x10000, "slave", 0 ) /* 64k for the second CPU */ + ROM_LOAD( "1.bin", 0x0000, 0x08000, CRC(ae11a07b) SHA1(af7a335c8da637103103cc274e077f123908ebb7) ) + + ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the third CPU */ + ROM_LOAD( "2.bin", 0x0000, 0x08000, CRC(4f9a26e8) SHA1(3105b34b88a7134493c2b3f584729f8b0407a011) ) + + ROM_REGION( 0x80000, "gfx1", ROMREGION_INVERT ) + ROM_LOAD( "12", 0x00000, 0x8000, CRC(20358c22) SHA1(2297af6c53d5807bf90a8e081075b8c72a994fc5) ) /* 1st plane */ + ROM_LOAD( "13", 0x08000, 0x8000, CRC(930168a9) SHA1(fd358c3c3b424bca285f67a1589eb98a345ff670) ) + ROM_LOAD( "14", 0x10000, 0x8000, CRC(9773e512) SHA1(33c1687ee575d66bf0e98add45d06da827813765) ) + ROM_LOAD( "15", 0x18000, 0x8000, CRC(d045549b) SHA1(0c12077d3ddc2ce6aa45a0224ad5540f3f218446) ) + ROM_LOAD( "16", 0x20000, 0x8000, CRC(d0af35c5) SHA1(c5a89f4d73acc0db86654540b3abfd77b3757db5) ) + ROM_LOAD( "17", 0x28000, 0x8000, CRC(7b5369a8) SHA1(1307b26d80e6f36ebe6c442bebec41d20066eaf9) ) + /* 0x30000-0x3ffff empty */ + ROM_LOAD( "6", 0x40000, 0x8000, CRC(6b61a413) SHA1(44eddf12fb46fceca2addbe6da929aaea7636b13) ) /* 2nd plane */ + ROM_LOAD( "7", 0x48000, 0x8000, CRC(b5492d97) SHA1(d5b045e3ebaa44809757a4220cefb3c6815470da) ) + ROM_LOAD( "8", 0x50000, 0x8000, CRC(d69762d5) SHA1(3326fef4e0bd86681a3047dc11886bb171ecb609) ) + ROM_LOAD( "9", 0x58000, 0x8000, CRC(9f243b68) SHA1(32dce8d311a4be003693182a999e4053baa6bb0a) ) + ROM_LOAD( "10", 0x60000, 0x8000, CRC(66e9438c) SHA1(b94e62b6fbe7f4e08086d0365afc5cff6e0ccafd) ) + ROM_LOAD( "11", 0x68000, 0x8000, CRC(9ef863ad) SHA1(29f91b5a3765e4d6e6c3382db1d8d8297b6e56c8) ) + /* 0x70000-0x7ffff empty */ + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "a71-25.41", 0x0000, 0x0100, CRC(2d0f8545) SHA1(089c31e2f614145ef2743164f7b52ae35bc06808) ) /* video timing */ + +ROM_END + ROM_START( bub68705 ) ROM_REGION( 0x30000, "maincpu", 0 ) /* Program roms match Bubble Bobble (older) */ ROM_LOAD( "2.bin", 0x00000, 0x08000, CRC(32c8305b) SHA1(6bf69b3edfbefd33cd670a762b4bf0b39629a220) ) @@ -1861,6 +1897,7 @@ GAME( 1986, boblbobl, bublbobl, boblbobl, boblbobl, bublbobl_state, bublbobl GAME( 1986, sboblbobl, bublbobl, boblbobl, sboblbobl, bublbobl_state, bublbobl, ROT0, "bootleg (Datsu)", "Super Bobble Bobble (bootleg, set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, sboblbobla, bublbobl, boblbobl, boblbobl, bublbobl_state, bublbobl, ROT0, "bootleg", "Super Bobble Bobble (bootleg, set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, sboblboblb, bublbobl, boblbobl, sboblboblb, bublbobl_state, bublbobl, ROT0, "bootleg", "Super Bobble Bobble (bootleg, set 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, sboblbobld, bublbobl, boblbobl, sboblboblb, bublbobl_state, bublbobl, ROT0, "bootleg", "Super Bobble Bobble (bootleg, set 4)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, sboblboblc, bublbobl, boblbobl, sboblboblb, bublbobl_state, bublbobl, ROT0, "bootleg", "Super Bubble Bobble (bootleg)", MACHINE_SUPPORTS_SAVE ) // the title screen on this one isn't hacked GAME( 1986, bub68705, bublbobl, bub68705, bublbobl, bublbobl_state, bublbobl, ROT0, "bootleg", "Bubble Bobble (bootleg with 68705)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From 61bada0d914cdcd33cdef2f132743e7bf6a50d48 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 12 Feb 2016 14:49:36 +0100 Subject: Added multi window support for BGFX backend (nw) --- src/osd/modules/osdwindow.h | 4 +- src/osd/modules/render/drawbgfx.cpp | 145 +++++++++++++++++++++++++++--------- src/osd/sdl/window.cpp | 12 +++ src/osd/windows/window.cpp | 12 +++ 4 files changed, 136 insertions(+), 37 deletions(-) diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h index a702569c581..3145a784c42 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -37,8 +37,9 @@ public: #else m_hwnd(0), m_dc(0), m_focus_hwnd(0), m_resize_state(0), #endif - m_primlist(NULL), + m_primlist(nullptr), m_index(0), + m_main(nullptr), m_prescale(1) {} virtual ~osd_window() { } @@ -80,6 +81,7 @@ public: render_primitive_list *m_primlist; osd_window_config m_win_config; int m_index; + osd_window *m_main; protected: int m_prescale; }; diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 8f0bc447d6e..293fe3c41b2 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -63,7 +63,8 @@ public: : osd_renderer(w, FLAG_NONE), m_blittimer(0), m_blit_dim(0, 0), m_last_hofs(0), m_last_vofs(0), - m_last_blit_time(0), m_last_blit_pixels(0) + m_last_blit_time(0), m_last_blit_pixels(0), + m_dimensions(0,0) {} virtual int create() override; @@ -111,8 +112,9 @@ public: bgfx::ProgramHandle m_progQuadTexture; bgfx::ProgramHandle m_progLine; bgfx::UniformHandle m_s_texColor; - + bgfx::FrameBufferHandle fbh; // Original display_mode + osd_dim m_dimensions; }; @@ -158,6 +160,28 @@ static void drawbgfx_exit(void) // renderer_bgfx::create //============================================================ bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName); + + +#ifdef OSD_SDL +static void* sdlNativeWindowHandle(SDL_Window* _window) +{ + SDL_SysWMinfo wmi; + SDL_VERSION(&wmi.version); + if (!SDL_GetWindowWMInfo(_window, &wmi)) + { + return NULL; + } + +# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD + return (void*)wmi.info.x11.window; +# elif BX_PLATFORM_OSX + return wmi.info.cocoa.window; +# elif BX_PLATFORM_WINDOWS + return wmi.info.win.window; +# endif // BX_PLATFORM_ +} + +#endif int renderer_bgfx::create() { // create renderer @@ -165,26 +189,39 @@ int renderer_bgfx::create() #ifdef OSD_WINDOWS RECT client; GetClientRect(window().m_hwnd, &client); - - bgfx::winSetHwnd(window().m_hwnd); - bgfx::init(); - bgfx::reset(rect_width(&client), rect_height(&client), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + if (window().m_index == 0) + { + bgfx::winSetHwnd(window().m_hwnd); + bgfx::init(); + bgfx::reset(rect_width(&client), rect_height(&client), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + // Enable debug text. + bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS + m_dimensions = osd_dim(rect_width(&client), rect_height(&client)); + } + else { + fbh = bgfx::createFrameBuffer(window().m_hwnd, rect_width(&client), rect_height(&client)); + bgfx::touch(window().m_index); + } #else osd_dim wdim = window().get_size(); - bgfx::sdlSetWindow(window().sdl_window()); - bgfx::init(); - bgfx::reset(wdim.width(), wdim.height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + if (window().m_index == 0) + { + bgfx::sdlSetWindow(window().sdl_window()); + bgfx::init(); + bgfx::reset(wdim.width(), wdim.height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + m_dimensions = osd_dim(wdim.width(), wdim.height()); + } + else { + fbh = bgfx::createFrameBuffer(sdlNativeWindowHandle(window().sdl_window()), wdim.width(), wdim.height()); + bgfx::touch(window().m_index); + } #endif - - // Enable debug text. - bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS // Create program from shaders. m_progQuad = loadProgram("vs_quad", "fs_quad"); m_progQuadTexture = loadProgram("vs_quad_texture", "fs_quad_texture"); m_progLine = loadProgram("vs_line", "fs_line"); m_s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1); - osd_printf_verbose("Leave drawsdl2_window_create\n"); return 0; } @@ -195,17 +232,19 @@ int renderer_bgfx::create() void renderer_bgfx::destroy() { // free the memory in the window - - // destroy_all_textures(); - // - bgfx::destroyUniform(m_s_texColor); - // Cleanup. - bgfx::destroyProgram(m_progQuad); - bgfx::destroyProgram(m_progQuadTexture); - bgfx::destroyProgram(m_progLine); - - // Shutdown bgfx. - bgfx::shutdown(); + if (window().m_index == 0) + { + // destroy_all_textures(); + // + bgfx::destroyUniform(m_s_texColor); + // Cleanup. + bgfx::destroyProgram(m_progQuad); + bgfx::destroyProgram(m_progQuadTexture); + bgfx::destroyProgram(m_progLine); + + // Shutdown bgfx. + bgfx::shutdown(); + } } @@ -738,8 +777,8 @@ static inline void copyline_yuy16_to_argb(UINT32 *dst, const UINT16 *src, int wi } int renderer_bgfx::draw(int update) { - initVertexDecls(); - + initVertexDecls(); + int index = window().m_index; // Set view 0 default viewport. int width, height; #ifdef OSD_WINDOWS @@ -747,14 +786,48 @@ int renderer_bgfx::draw(int update) GetClientRect(window().m_hwnd, &client); width = rect_width(&client); height = rect_height(&client); + #else osd_dim wdim = window().get_size(); width = wdim.width(); height = wdim.height(); #endif - bgfx::setViewSeq(0, true); - bgfx::setViewRect(0, 0, 0, width, height); - bgfx::reset(width, height, video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + if (index == 0) + { + if ((m_dimensions != osd_dim(width, height))) { + bgfx::reset(width, height, video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + m_dimensions = osd_dim(width, height); + } + } + else { + if ((m_dimensions != osd_dim(width, height))) { + bgfx::reset(window().m_main->get_size().width(), window().m_main->get_size().height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + if (bgfx::isValid(fbh)) + { + bgfx::destroyFrameBuffer(fbh); + } +#ifdef OSD_WINDOWS + fbh = bgfx::createFrameBuffer(window().m_hwnd, width, height); +#else + fbh = bgfx::createFrameBuffer(sdlNativeWindowHandle(window().sdl_window()), width, height); +#endif + bgfx::setViewFrameBuffer(index, fbh); + m_dimensions = osd_dim(width, height); + bgfx::setViewClear(index + , BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH + , 0x000000ff + , 1.0f + , 0 + ); + bgfx::touch(index); + bgfx::frame(); + return 0; + } + } + if (index != 0) bgfx::setViewFrameBuffer(index, fbh); + bgfx::setViewSeq(index, true); + bgfx::setViewRect(index, 0, 0, width, height); + // Setup view transform. { float view[16]; @@ -766,9 +839,9 @@ int renderer_bgfx::draw(int update) float bottom = height; float proj[16]; bx::mtxOrtho(proj, left, right, bottom, top, 0.0f, 100.0f); - bgfx::setViewTransform(0, view, proj); + bgfx::setViewTransform(index, view, proj); } - bgfx::setViewClear(0 + bgfx::setViewClear(index , BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH , 0x000000ff , 1.0f @@ -777,7 +850,7 @@ int renderer_bgfx::draw(int update) // This dummy draw call is here to make sure that view 0 is cleared // if no other draw calls are submitted to view 0. - bgfx::touch(0); + bgfx::touch(index); window().m_primlist->acquire_lock(); // Draw quad. @@ -815,7 +888,7 @@ int renderer_bgfx::draw(int update) u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), 1.0f); bgfx::setState(flags); - bgfx::submit(0, m_progLine); + bgfx::submit(index, m_progLine); break; case render_primitive::QUAD: @@ -826,7 +899,7 @@ int renderer_bgfx::draw(int update) screenQuad(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), uv); bgfx::setState(flags); - bgfx::submit(0, m_progQuad); + bgfx::submit(index, m_progQuad); } else { screenQuad(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, @@ -926,7 +999,7 @@ int renderer_bgfx::draw(int update) } bgfx::setTexture(0, m_s_texColor, m_texture); bgfx::setState(flags); - bgfx::submit(0, m_progQuadTexture); + bgfx::submit(index, m_progQuadTexture); bgfx::destroyTexture(m_texture); } break; @@ -939,7 +1012,7 @@ int renderer_bgfx::draw(int update) window().m_primlist->release_lock(); // Advance to next frame. Rendering thread will be kicked to // process submitted rendering primitives. - bgfx::frame(); + if (index==0) bgfx::frame(); return 0; } diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 47ab3cdd162..85f945874d9 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -1269,6 +1269,18 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt ) SDL_WM_SetCaption(window->m_title, "SDLMAME"); #endif + // set main window + if (window->m_index > 0) + { + for (auto w = sdl_window_list; w != NULL; w = w->m_next) + { + if (w->m_index == 0) + { + window->m_main = w; + break; + } + } + } window->monitor()->refresh(); // initialize the drawing backend if (window->renderer().create()) diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 4dcbd1661e7..f39199d7b50 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -661,6 +661,18 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in window->m_fullscreen = !video_config.windowed; window->m_index = index; + // set main window + if (index > 0) + { + for (auto w = win_window_list; w != NULL; w = w->m_next) + { + if (w->m_index == 0) + { + window->m_main = w; + break; + } + } + } // see if we are safe for fullscreen window->m_fullscreen_safe = TRUE; for (win = win_window_list; win != NULL; win = win->m_next) -- cgit v1.2.3-70-g09d2 From 244e00775a6d2a232a495d7404644f30ffa91157 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 12 Feb 2016 15:15:11 +0100 Subject: simplify code (nw) --- src/osd/modules/render/drawbgfx.cpp | 41 +++++++++++-------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 293fe3c41b2..7644bccb9f1 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -180,42 +180,34 @@ static void* sdlNativeWindowHandle(SDL_Window* _window) return wmi.info.win.window; # endif // BX_PLATFORM_ } - #endif + int renderer_bgfx::create() { // create renderer -#ifdef OSD_WINDOWS - RECT client; - GetClientRect(window().m_hwnd, &client); + osd_dim wdim = window().get_size(); if (window().m_index == 0) { +#ifdef OSD_WINDOWS bgfx::winSetHwnd(window().m_hwnd); - bgfx::init(); - bgfx::reset(rect_width(&client), rect_height(&client), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); - // Enable debug text. - bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS - m_dimensions = osd_dim(rect_width(&client), rect_height(&client)); - } - else { - fbh = bgfx::createFrameBuffer(window().m_hwnd, rect_width(&client), rect_height(&client)); - bgfx::touch(window().m_index); - } #else - osd_dim wdim = window().get_size(); - if (window().m_index == 0) - { bgfx::sdlSetWindow(window().sdl_window()); +#endif bgfx::init(); bgfx::reset(wdim.width(), wdim.height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + // Enable debug text. + bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS m_dimensions = osd_dim(wdim.width(), wdim.height()); } else { +#ifdef OSD_WINDOWS + fbh = bgfx::createFrameBuffer(window().m_hwnd, wdim.width(), wdim.height()); +#else fbh = bgfx::createFrameBuffer(sdlNativeWindowHandle(window().sdl_window()), wdim.width(), wdim.height()); +#endif bgfx::touch(window().m_index); } -#endif // Create program from shaders. m_progQuad = loadProgram("vs_quad", "fs_quad"); m_progQuadTexture = loadProgram("vs_quad_texture", "fs_quad_texture"); @@ -780,18 +772,9 @@ int renderer_bgfx::draw(int update) initVertexDecls(); int index = window().m_index; // Set view 0 default viewport. - int width, height; -#ifdef OSD_WINDOWS - RECT client; - GetClientRect(window().m_hwnd, &client); - width = rect_width(&client); - height = rect_height(&client); - -#else osd_dim wdim = window().get_size(); - width = wdim.width(); - height = wdim.height(); -#endif + int width = wdim.width(); + int height = wdim.height(); if (index == 0) { if ((m_dimensions != osd_dim(width, height))) { -- cgit v1.2.3-70-g09d2 From e7e6420ca7ada52e8df29739832aab6d4f943b94 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 12 Feb 2016 15:58:24 +0100 Subject: cleanup and fix for xy_to_render_target (nw) --- src/osd/modules/render/drawbgfx.cpp | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 7644bccb9f1..6a0b1ca448f 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -60,10 +60,7 @@ class renderer_bgfx : public osd_renderer { public: renderer_bgfx(osd_window *w) - : osd_renderer(w, FLAG_NONE), m_blittimer(0), - m_blit_dim(0, 0), - m_last_hofs(0), m_last_vofs(0), - m_last_blit_time(0), m_last_blit_pixels(0), + : osd_renderer(w, FLAG_NONE), m_dimensions(0,0) {} @@ -79,35 +76,11 @@ public: virtual void destroy() override; virtual render_primitive_list *get_primitives() override { -#ifdef OSD_WINDOWS - RECT client; - GetClientRect(window().m_hwnd, &client); - window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect()); - return &window().target()->get_primitives(); -#else osd_dim wdim = window().get_size(); window().target()->set_bounds(wdim.width(), wdim.height(), window().aspect()); return &window().target()->get_primitives(); -#endif } - // void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y); - - //texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup); - //texture_info *texture_update(const render_primitive &prim); - - INT32 m_blittimer; - - //simple_list m_texlist; // list of active textures - - osd_dim m_blit_dim; - float m_last_hofs; - float m_last_vofs; - - // Stats - INT64 m_last_blit_time; - INT64 m_last_blit_pixels; - bgfx::ProgramHandle m_progQuad; bgfx::ProgramHandle m_progQuadTexture; bgfx::ProgramHandle m_progLine; @@ -247,11 +220,11 @@ void renderer_bgfx::destroy() #ifdef OSD_SDL int renderer_bgfx::xy_to_render_target(int x, int y, int *xt, int *yt) { - *xt = x - m_last_hofs; - *yt = y - m_last_vofs; - if (*xt<0 || *xt >= m_blit_dim.width()) + *xt = x; + *yt = y; + if (*xt<0 || *xt >= m_dimensions.width()) return 0; - if (*yt<0 || *yt >= m_blit_dim.height()) + if (*yt<0 || *yt >= m_dimensions.height()) return 0; return 1; } -- cgit v1.2.3-70-g09d2 From e8f547428d6a544b5d36a2d11d1f597e44543e3e Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 12 Feb 2016 16:29:18 +0100 Subject: proper memory handling (nw) --- src/osd/modules/render/drawbgfx.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 6a0b1ca448f..35a50609cf4 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -127,6 +127,8 @@ int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks) static void drawbgfx_exit(void) { + // Shutdown bgfx. + bgfx::shutdown(); } //============================================================ @@ -196,20 +198,15 @@ int renderer_bgfx::create() void renderer_bgfx::destroy() { - // free the memory in the window - if (window().m_index == 0) + if (window().m_index > 0) { - // destroy_all_textures(); - // - bgfx::destroyUniform(m_s_texColor); - // Cleanup. - bgfx::destroyProgram(m_progQuad); - bgfx::destroyProgram(m_progQuadTexture); - bgfx::destroyProgram(m_progLine); - - // Shutdown bgfx. - bgfx::shutdown(); + bgfx::destroyFrameBuffer(fbh); } + bgfx::destroyUniform(m_s_texColor); + // Cleanup. + bgfx::destroyProgram(m_progQuad); + bgfx::destroyProgram(m_progQuadTexture); + bgfx::destroyProgram(m_progLine); } -- cgit v1.2.3-70-g09d2 From 36eb2f3e733f1896f9361010999f24990d5c5f55 Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Fri, 12 Feb 2016 10:56:05 -0500 Subject: Fix incorrectly logged hashes for m5_flop.zml (nw) --- hash/m5_flop.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash/m5_flop.xml b/hash/m5_flop.xml index 1c9beb03a8e..54ab259fc8c 100644 --- a/hash/m5_flop.xml +++ b/hash/m5_flop.xml @@ -8,7 +8,7 @@ - + -- cgit v1.2.3-70-g09d2 From babb30af6b24d79c7473b1144e075f80f9222a8d Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 13 Feb 2016 02:43:30 +1100 Subject: Move Zaccaria 1B11107 board into audio/zaccaria.cpp so it can share common stuff with 1B11142. Yes, I realise catnmous sounds different, the intermediate mixer seems to have that effect. It will all change again when we get netlist filtering anyway. --- src/mame/audio/laserbat.cpp | 69 +------ src/mame/audio/zaccaria.cpp | 422 +++++++++++++++++++++++++++++------------- src/mame/audio/zaccaria.h | 81 ++++++-- src/mame/drivers/laserbat.cpp | 34 +--- src/mame/includes/laserbat.h | 23 +-- 5 files changed, 380 insertions(+), 249 deletions(-) diff --git a/src/mame/audio/laserbat.cpp b/src/mame/audio/laserbat.cpp index a10e749757f..963f3aa7f76 100644 --- a/src/mame/audio/laserbat.cpp +++ b/src/mame/audio/laserbat.cpp @@ -230,7 +230,9 @@ WRITE8_MEMBER(laserbat_state::csound2_w) The Cat and Mouse sound board has a 6802 processor with three ROMs, a 6821 PIA, two AY-3-8910 PSGs, and some other logic and analog circuitry. Unfortunately we lack a schematic, so all knowledge of - this board is based on tracing the sound program. + this board is based on tracing the sound program, examining PCB + photos and cross-referencing with the schematic for the 1B11142 + schematic. The 6821 PIA is mapped at addresses $005C..$005F. The known PIA signal assignments are as follows: @@ -306,7 +308,8 @@ WRITE8_MEMBER(laserbat_state::csound2_w) WRITE8_MEMBER(catnmous_state::csound1_w) { - m_pia->ca1_w((data & 0x20) ? 1 : 0); + m_audiopcb->sound_w(space, offset, data); + m_csound1 = data; } @@ -315,66 +318,8 @@ WRITE8_MEMBER(catnmous_state::csound2_w) // the bottom bit is used for sprite banking, of all things m_gfx2 = memregion("gfx2")->base() + ((data & 0x01) ? 0x0800 : 0x0000); - // the top bit is called RESET on the wiring diagram - assume it resets the sound CPU - m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x80) ? ASSERT_LINE : CLEAR_LINE); + // the top bit is called RESET on the wiring diagram + m_audiopcb->reset_w((data & 0x80) ? 1 : 0); m_csound2 = data; } - -READ8_MEMBER(catnmous_state::pia_porta_r) -{ - UINT8 const control = m_pia->b_output(); - UINT8 data = 0xff; - - if (0x01 == (control & 0x03)) - data &= m_psg1->data_r(space, 0); - - if (0x04 == (control & 0x0c)) - data &= m_psg2->data_r(space, 0); - - return data; -} - -WRITE8_MEMBER(catnmous_state::pia_porta_w) -{ - UINT8 const control = m_pia->b_output(); - - if (control & 0x02) - m_psg1->data_address_w(space, (control >> 0) & 0x01, data); - - if (control & 0x08) - m_psg2->data_address_w(space, (control >> 2) & 0x01, data); -} - -WRITE8_MEMBER(catnmous_state::pia_portb_w) -{ - if (data & 0x02) - m_psg1->data_address_w(space, (data >> 0) & 0x01, m_pia->a_output()); - - if (data & 0x08) - m_psg2->data_address_w(space, (data >> 2) & 0x01, m_pia->a_output()); -} - -WRITE8_MEMBER(catnmous_state::psg1_porta_w) -{ - // similar to zaccaria.c since we have no clue how this board really works - // this code could be completely wrong/inappropriate for this game for all we know - static double const table[8] = { - RES_K(8.2), - RES_R(820), - RES_K(3.3), - RES_R(150), - RES_K(5.6), - RES_R(390), - RES_K(1.5), - RES_R(47) }; - RES_VOLTAGE_DIVIDER(RES_K(4.7), table[data & 0x07]); - m_psg2->set_volume(1, 150 * RES_VOLTAGE_DIVIDER(RES_K(4.7), table[data & 0x07])); -} - -READ8_MEMBER(catnmous_state::psg1_portb_r) -{ - // the sound program masks out the three most significant bits - // assume they're not connected and read high from the internal pull-ups - return m_csound1 | 0xe0; -} diff --git a/src/mame/audio/zaccaria.cpp b/src/mame/audio/zaccaria.cpp index 9f9b71c9a7b..0df34d1d626 100644 --- a/src/mame/audio/zaccaria.cpp +++ b/src/mame/audio/zaccaria.cpp @@ -5,73 +5,125 @@ #include "cpu/m6800/m6800.h" #include "machine/clock.h" +#include "machine/rescap.h" #include "sound/dac.h" +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +device_type const ZACCARIA_1B11107 = &device_creator; device_type const ZACCARIA_1B11142 = &device_creator; + +//************************************************************************** +// MEMORY MAPS +//************************************************************************** + /* - * slave sound cpu, produces music and sound effects - * mapping: - * A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00 - * 0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram - * 0 0 0 x x x x x x x x x x x x x Open bus (for area that doesn't overlap ram) - * 0 0 1 x x x x x x x x x x x x x Open bus - * 0 1 0 x x x x x x x x x 0 0 x x Open bus - * 0 1 0 x x x x x x x x x 0 1 x x Open bus - * 0 1 0 x x x x x x x x x 1 0 x x Open bus - * 0 1 0 x x x x x x x x x 1 1 * * RW 6821 PIA @ 4I - * 0 1 1 x x x x x x x x x x x x x Open bus - * 1 0 % % * * * * * * * * * * * * R /CS4A: Enable ROM 13 - * 1 1 % % * * * * * * * * * * * * R /CS5A: Enable ROM 9 - * note that the % bits go to pins 2 (6802 A12) and 26 (6802 A13) of the roms - * monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care - * hence for actual chips used, the mem map is: - * 1 0 x * * * * * * * * * * * * * R /CS4A: Enable ROM 13 - * 1 1 x * * * * * * * * * * * * * R /CS5A: Enable ROM 9 - * - * 6821 PIA: - * CA1 comes from the master sound cpu's latch bit 7 (which is also connected to the AY chip at 4G's IOB1) - * CB1 comes from the 6802's clock divided by 4096*2 (about 437Hz) - * CA2 and CB2 are not connected - * PA0-7 connect to the data busses of the AY-3-8910 chips - * PB0 and PB1 connect to the BC1 and BDIR pins of the AY chip at 4G - * PB2 and PB3 connect to the BC1 and BDIR pins of the AY chip at 4H. - */ -static ADDRESS_MAP_START(zac1b11142_melody_map, AS_PROGRAM, 8, zac1b11142_audio_device) + base melody/SFX generator CPU map + 1B11107 and 1B11142 both have a 6802 with internal RAM and a PIA accessed at 0x500c +*/ +static ADDRESS_MAP_START(zac1b111xx_melody_base_map, AS_PROGRAM, 8, zac1b111xx_melody_base) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x007f) AM_RAM // 6802 internal RAM - AM_RANGE(0x400c, 0x400f) AM_MIRROR(0x1ff0) AM_DEVREADWRITE("pia_4i", pia6821_device, read, write) - AM_RANGE(0x8000, 0x9fff) AM_MIRROR(0x2000) AM_ROM // rom 13 - AM_RANGE(0xc000, 0xdfff) AM_MIRROR(0x2000) AM_ROM // rom 9 + AM_RANGE(0x400c, 0x400f) AM_MIRROR(0x1ff0) AM_DEVREADWRITE("melodypia", pia6821_device, read, write) ADDRESS_MAP_END /* - * master sound cpu, controls speech directly - * mapping: - * A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00 - * 0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram - * x 0 0 0 x x x x 1 x x 0 x x * * Open bus (test mode writes as if there was another PIA here) - * x 0 0 0 x x x x 1 x x 1 x x * * RW 6821 PIA @ 1I - * x 0 0 1 0 0 x x x x x x x x x x W MC1408 DAC - * x x 0 1 0 1 x x x x x x x x x x W Command to slave melody cpu - * x x 0 1 1 0 x x x x x x x x x x R Command read latch from z80 - * x x 0 1 1 1 x x x x x x x x x x Open bus - * % % 1 0 * * * * * * * * * * * * R /CS1A: Enable ROM 8 - * % % 1 1 * * * * * * * * * * * * R /CS0A: Enable ROM 7 - * note that the % bits go to pins 2 (6802 A14) and 26 (6802 A15) of the roms - * monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care - * hence for actual chips used, the mem map is: - * x * 1 0 * * * * * * * * * * * * R /CS1A: Enable ROM 8 - * x * 1 1 * * * * * * * * * * * * R /CS0A: Enable ROM 7 - * - * 6821 PIA: - * PA0-7, PB0-1, CA2 and CB1 connect to the TMS5200 - * CA1 and CB2 are not connected, though the test mode assumes there's something connected to CB2 (possibly another LED like the one connected to PB4) - * PB3 connects to 'ACS' which goes to the Z80 - */ + 1B11107 sound CPU, produces music and sound effects + mapping (from tracing sound program and cross-referencing 1B1142 schematic): + A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00 + 0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram + 0 0 0 x x x x x x x x x x x x x Open bus (for area that doesn't overlap RAM) + 0 0 1 x x x x x x x x x x x x x Open bus + 0 1 0 x x x x x x x x x 0 0 x x Open bus + 0 1 0 x x x x x x x x x 0 1 x x Open bus + 0 1 0 x x x x x x x x x 1 0 x x Open bus + 0 1 0 x x x x x x x x x 1 1 * * RW 6821 PIA @ 1G + 0 1 1 x x x x x x x x x x x x x Open bus + 1 0 x x x x x x x x x x x x x x Open bus + 1 1 0 0 * * * * * * * * * * * * R Enable ROM @ 1F + 1 1 0 1 * * * * * * * * * * * * Open bus + 1 1 1 0 * * * * * * * * * * * * R Enable ROM @ 1D + 1 1 1 1 * * * * * * * * * * * * R Enable ROM @ 1E + + 6821 PIA: + * CA1 comes from the SOUND 5 line on the input (which may also be connected to an input on the AY chip at 1H) + * CB1 comes from the 6802's clock divided by 4096*2 (about 437Hz) + * PA0-7 connect to the data busses of the AY-3-8910 chips + * PB0 and PB1 connect to the BC1 and BDIR pins of the AY chip at 1H + * PB2 and PB3 connect to the BC1 and BDIR pins of the AY chip at 1I +*/ +static ADDRESS_MAP_START(zac1b11107_melody_map, AS_PROGRAM, 8, zac1b11107_audio_device) + AM_IMPORT_FROM(zac1b111xx_melody_base_map) + AM_RANGE(0xc000, 0xcfff) AM_ROM // ROM @ 1F + AM_RANGE(0xe000, 0xffff) AM_ROM // ROM @ 1D, 1E +ADDRESS_MAP_END + + +/* + 1B11142 slave sound CPU, produces music and sound effects + mapping: + A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00 + 0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram + 0 0 0 x x x x x x x x x x x x x Open bus (for area that doesn't overlap RAM) + 0 0 1 x x x x x x x x x x x x x Open bus + 0 1 0 x x x x x x x x x 0 0 x x Open bus + 0 1 0 x x x x x x x x x 0 1 x x Open bus + 0 1 0 x x x x x x x x x 1 0 x x Open bus + 0 1 0 x x x x x x x x x 1 1 * * RW 6821 PIA @ 4I + 0 1 1 x x x x x x x x x x x x x Open bus + 1 0 % % * * * * * * * * * * * * R /CS4A: Enable ROM 13 + 1 1 % % * * * * * * * * * * * * R /CS5A: Enable ROM 9 + note that the % bits go to pins 2 (6802 A12) and 26 (6802 A13) of the roms + monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care + hence for actual chips used, the mem map is: + 1 0 x * * * * * * * * * * * * * R /CS4A: Enable ROM 13 + 1 1 x * * * * * * * * * * * * * R /CS5A: Enable ROM 9 + + 6821 PIA: + * CA1 comes from the master sound cpu's latch bit 7 (which is also connected to the AY chip at 4G's IOB1) + * CB1 comes from the 6802's clock divided by 4096*2 (about 437Hz) + * CA2 and CB2 are not connected + * PA0-7 connect to the data busses of the AY-3-8910 chips + * PB0 and PB1 connect to the BC1 and BDIR pins of the AY chip at 4G + * PB2 and PB3 connect to the BC1 and BDIR pins of the AY chip at 4H +*/ +static ADDRESS_MAP_START(zac1b11142_melody_map, AS_PROGRAM, 8, zac1b11142_audio_device) + AM_IMPORT_FROM(zac1b111xx_melody_base_map) + AM_RANGE(0x8000, 0x9fff) AM_MIRROR(0x2000) AM_ROM // ROM 13 + AM_RANGE(0xc000, 0xdfff) AM_MIRROR(0x2000) AM_ROM // ROM 9 +ADDRESS_MAP_END + + +/* + 1B11142 master sound CPU, controls DAC and speech directly + mapping: + A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00 + 0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram + x 0 0 0 x x x x 1 x x 0 x x * * Open bus (test mode writes as if there was another PIA here) + x 0 0 0 x x x x 1 x x 1 x x * * RW 6821 PIA @ 1I + x 0 0 1 0 0 x x x x x x x x x x W MC1408 DAC + x x 0 1 0 1 x x x x x x x x x x W Command to slave melody cpu + x x 0 1 1 0 x x x x x x x x x x R Command read latch from z80 + x x 0 1 1 1 x x x x x x x x x x Open bus + % % 1 0 * * * * * * * * * * * * R /CS1A: Enable ROM 8 + % % 1 1 * * * * * * * * * * * * R /CS0A: Enable ROM 7 + note that the % bits go to pins 2 (6802 A14) and 26 (6802 A15) of the roms + monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care + hence for actual chips used, the mem map is: + x * 1 0 * * * * * * * * * * * * R /CS1A: Enable ROM 8 + x * 1 1 * * * * * * * * * * * * R /CS0A: Enable ROM 7 + + 6821 PIA: + PA0-7, PB0-1, CA2 and CB1 connect to the TMS5200 + CA1 and CB2 are not connected, though the test mode assumes there's something connected to CB2 (possibly another LED like the one connected to PB4) + PB3 connects to 'ACS' which goes to the Z80 +*/ static ADDRESS_MAP_START(zac1b11142_audio_map, AS_PROGRAM, 8, zac1b11142_audio_device) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x007f) AM_RAM // 6802 internal RAM @@ -86,29 +138,58 @@ static ADDRESS_MAP_START(zac1b11142_audio_map, AS_PROGRAM, 8, zac1b11142_audio_d ADDRESS_MAP_END -MACHINE_CONFIG_FRAGMENT(zac1b11142_config) + +//************************************************************************** +// MACHINE FRAGMENTS +//************************************************************************** + +MACHINE_CONFIG_FRAGMENT(zac1b111xx_base_config) MCFG_CPU_ADD("melodycpu", M6802, XTAL_3_579545MHz) // verified on pcb - MCFG_CPU_PROGRAM_MAP(zac1b11142_melody_map) + MCFG_CPU_PROGRAM_MAP(zac1b111xx_melody_base_map) MCFG_DEVICE_ADD("timebase", CLOCK, XTAL_3_579545MHz/4096/2) // CPU clock divided using 4040 and half of 74LS74 - MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("pia_4i", pia6821_device, cb1_w)) + MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("melodypia", pia6821_device, cb1_w)) - MCFG_DEVICE_ADD("pia_4i", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(zac1b11142_audio_device, pia_4i_porta_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(zac1b11142_audio_device, pia_4i_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(zac1b11142_audio_device, pia_4i_portb_w)) + MCFG_DEVICE_ADD("melodypia", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(zac1b111xx_melody_base, melodypia_porta_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(zac1b111xx_melody_base, melodypia_porta_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(zac1b111xx_melody_base, melodypia_portb_w)) MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("melodycpu", m6802_cpu_device, nmi_line)) MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("melodycpu", m6802_cpu_device, irq_line)) - MCFG_SOUND_ADD("ay_4g", AY8910, XTAL_3_579545MHz/2) // CPU clock divided using 4040 + MCFG_SOUND_ADD("melodypsg1", AY8910, XTAL_3_579545MHz/2) // CPU clock divided using 4040 + MCFG_AY8910_PORT_B_READ_CB(READ8(zac1b111xx_melody_base, melodypsg1_portb_r)) + + MCFG_SOUND_ADD("melodypsg2", AY8910, XTAL_3_579545MHz/2) // CPU clock divided using 4040 +MACHINE_CONFIG_END + + +MACHINE_CONFIG_DERIVED(zac1b11107_config, zac1b111xx_base_config) + MCFG_CPU_MODIFY("melodycpu") + MCFG_CPU_PROGRAM_MAP(zac1b11107_melody_map) + + MCFG_DEVICE_MODIFY("melodypsg1") + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(zac1b11107_audio_device, melodypsg1_porta_w)) + MCFG_MIXER_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.5, 0) + + MCFG_DEVICE_MODIFY("melodypsg2") + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(zac1b11107_audio_device, melodypsg2_porta_w)) + MCFG_MIXER_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.5, 0) +MACHINE_CONFIG_END + + +MACHINE_CONFIG_DERIVED(zac1b11142_config, zac1b111xx_base_config) + MCFG_CPU_MODIFY("melodycpu") + MCFG_CPU_PROGRAM_MAP(zac1b11142_melody_map) + + MCFG_DEVICE_MODIFY("melodypsg1") MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(zac1b11142_audio_device, ay_4g_porta_w)) - MCFG_AY8910_PORT_B_READ_CB(READ8(zac1b11142_audio_device, ay_4g_portb_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.15) + MCFG_MIXER_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.15, 0) - MCFG_SOUND_ADD("ay_4h", AY8910, XTAL_3_579545MHz/2) // CPU clock divided using 4040 + MCFG_DEVICE_MODIFY("melodypsg2") MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(zac1b11142_audio_device, ay_4h_porta_w)) MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(zac1b11142_audio_device, ay_4h_portb_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.15) + MCFG_MIXER_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.15, 0) MCFG_CPU_ADD("audiocpu", M6802, XTAL_3_579545MHz) // verified on pcb MCFG_CPU_PROGRAM_MAP(zac1b11142_audio_map) @@ -120,17 +201,22 @@ MACHINE_CONFIG_FRAGMENT(zac1b11142_config) MCFG_PIA_WRITEPB_HANDLER(WRITE8(zac1b11142_audio_device, pia_1i_portb_w)) MCFG_DAC_ADD("dac_1f") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.80) + MCFG_MIXER_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.80, 0) // There is no xtal, the clock is obtained from a RC oscillator as shown in the TMS5220 datasheet (R=100kOhm C=22pF) // 162kHz measured on pin 3 20 minutes after power on, clock would then be 162.3*4=649.2kHz MCFG_SOUND_ADD("speech", TMS5200, 649200) // ROMCLK pin measured at 162.3Khz, OSC is exactly *4 of that) MCFG_TMS52XX_IRQ_HANDLER(DEVWRITELINE("pia_1i", pia6821_device, cb1_w)) MCFG_TMS52XX_READYQ_HANDLER(DEVWRITELINE("pia_1i", pia6821_device, ca2_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.80) + MCFG_MIXER_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.80, 0) MACHINE_CONFIG_END + +//************************************************************************** +// I/O PORT DEFINITIONS +//************************************************************************** + INPUT_PORTS_START(zac1b11142_ioports) PORT_START("1B11142") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -140,82 +226,175 @@ INPUT_PORTS_START(zac1b11142_ioports) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("P1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("P1") // test button? generates NMI on master CPU INPUT_PORTS_END -zac1b11142_audio_device::zac1b11142_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ZACCARIA_1B11142, "Zaccaria 1B11142 Sound Board", tag, owner, clock, "zac1b11142", __FILE__) + +//************************************************************************** +// BASE MELODY GENERATOR DEVICE CLASS +//************************************************************************** + +zac1b111xx_melody_base::zac1b111xx_melody_base( + machine_config const &mconfig, + device_type devtype, + char const *name, + char const *tag, + device_t *owner, + UINT32 clock, + char const *shortname, + char const *source) + : device_t(mconfig, devtype, name, tag, owner, clock, shortname, source) , device_mixer_interface(mconfig, *this, 1) - , m_acs_cb(*this) , m_melodycpu(*this, "melodycpu") - , m_pia_4i(*this, "pia_4i") - , m_ay_4g(*this, "ay_4g") - , m_ay_4h(*this, "ay_4h") - , m_audiocpu(*this, "audiocpu") - , m_pia_1i(*this, "pia_1i") - , m_speech(*this, "speech") - , m_inputs(*this, "1B11142") - , m_host_command(0) + , m_melodypia(*this, "melodypia") + , m_melodypsg1(*this, "melodypsg1") + , m_melodypsg2(*this, "melodypsg2") , m_melody_command(0) { } -WRITE8_MEMBER(zac1b11142_audio_device::hs_w) +READ8_MEMBER(zac1b111xx_melody_base::melodypia_porta_r) { - m_host_command = data; - m_audiocpu->set_input_line(INPUT_LINE_IRQ0, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE); + UINT8 const control = m_melodypia->b_output(); + UINT8 data = 0xff; + + if (0x01 == (control & 0x03)) + data &= m_melodypsg1->data_r(space, 0); + + if (0x04 == (control & 0x0c)) + data &= m_melodypsg2->data_r(space, 0); + + return data; } -READ_LINE_MEMBER(zac1b11142_audio_device::acs_r) +WRITE8_MEMBER(zac1b111xx_melody_base::melodypia_porta_w) { - return (~m_pia_1i->b_output() >> 3) & 0x01; + UINT8 const control = m_melodypia->b_output(); + + if (control & 0x02) + m_melodypsg1->data_address_w(space, (control >> 0) & 0x01, data); + + if (control & 0x08) + m_melodypsg2->data_address_w(space, (control >> 2) & 0x01, data); } -WRITE_LINE_MEMBER(zac1b11142_audio_device::ressound_w) +WRITE8_MEMBER(zac1b111xx_melody_base::melodypia_portb_w) { - // TODO: there is a pulse-stretching network attached that should be simulated - m_melodycpu->set_input_line(INPUT_LINE_RESET, state); - // TODO: holds the reset line of m_pia_4i - can't implement this in MAME at this time - // TODO: holds the reset line of m_ay_4g - can't implement this in MAME at this time - // TODO: holds the reset line of m_ay_4h - can't implement this in MAME at this time - m_audiocpu->set_input_line(INPUT_LINE_RESET, state); - // TODO: holds the reset line of m_pia_1i - can't implement this in MAME at this time - // TODO: does some funky stuff with the VDD and VSS lines on the speech chip + if (data & 0x02) + m_melodypsg1->data_address_w(space, (data >> 0) & 0x01, m_melodypia->a_output()); + + if (data & 0x08) + m_melodypsg2->data_address_w(space, (data >> 2) & 0x01, m_melodypia->a_output()); } -READ8_MEMBER(zac1b11142_audio_device::pia_4i_porta_r) +READ8_MEMBER(zac1b111xx_melody_base::melodypsg1_portb_r) { - UINT8 const control = m_pia_4i->b_output(); - UINT8 data = 0xff; + return m_melody_command; +} - if (0x01 == (control & 0x03)) - data &= m_ay_4g->data_r(space, 0); +void zac1b111xx_melody_base::device_start() +{ + save_item(NAME(m_melody_command)); +} - if (0x04 == (control & 0x0c)) - data &= m_ay_4h->data_r(space, 0); +void zac1b111xx_melody_base::device_reset() +{ + m_melody_command = 0; +} - return data; + + +//************************************************************************** +// 1B11107-SPECIFIC IMPLEMENTATION +//************************************************************************** + +zac1b11107_audio_device::zac1b11107_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock) + : zac1b111xx_melody_base(mconfig, ZACCARIA_1B11107, "Zaccaria 1B11107 Sound Board", tag, owner, clock, "zac1b11107", __FILE__) +{ } -WRITE8_MEMBER(zac1b11142_audio_device::pia_4i_porta_w) +WRITE8_MEMBER(zac1b11107_audio_device::sound_w) { - UINT8 const control = m_pia_4i->b_output(); + // the sound program masks out the three most significant bits + // assume the top two bits are not connected and read high from the internal pull-ups + m_melodypia->ca1_w((data >> 5) & 0x01); + m_melody_command = data | 0xc0; +} - if (control & 0x02) - m_ay_4g->data_address_w(space, (control >> 0) & 0x01, data); +WRITE_LINE_MEMBER(zac1b11107_audio_device::reset_w) +{ + // TODO: there is a pulse-stretching network attached that should be simulated + m_melodycpu->set_input_line(INPUT_LINE_RESET, state); + // TODO: holds the reset line of m_melodypia - can't implement this in MAME at this time + // TODO: holds the reset line of m_melodypsg1 - can't implement this in MAME at this time + // TODO: holds the reset line of m_melodypsg2 - can't implement this in MAME at this time +} - if (control & 0x08) - m_ay_4h->data_address_w(space, (control >> 2) & 0x01, data); +WRITE8_MEMBER(zac1b11107_audio_device::melodypsg1_porta_w) +{ + // similar to 1B11142 + // TODO: move this to netlist audio where it belongs, along with the rest of the filtering + static double const table[8] = { + RES_K(8.2), + RES_R(820), + RES_K(3.3), + RES_R(150), + RES_K(5.6), + RES_R(390), + RES_K(1.5), + RES_R(47) }; + m_melodypsg2->set_volume(1, 150 * RES_VOLTAGE_DIVIDER(RES_K(4.7), table[data & 0x07])); } -WRITE8_MEMBER(zac1b11142_audio_device::pia_4i_portb_w) +WRITE8_MEMBER(zac1b11107_audio_device::melodypsg2_porta_w) { - if (data & 0x02) - m_ay_4g->data_address_w(space, (data >> 0) & 0x01, m_pia_4i->a_output()); + // TODO: assume LEVELT is controlled here as is the case for 1B11142? +} - if (data & 0x08) - m_ay_4h->data_address_w(space, (data >> 2) & 0x01, m_pia_4i->a_output()); +machine_config_constructor zac1b11107_audio_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(zac1b11107_config); +} + + + +//************************************************************************** +// 1B11142-SPECIFIC IMPLEMENTATION +//************************************************************************** + +zac1b11142_audio_device::zac1b11142_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock) + : zac1b111xx_melody_base(mconfig, ZACCARIA_1B11142, "Zaccaria 1B11142 Sound Board", tag, owner, clock, "zac1b11142", __FILE__) + , m_acs_cb(*this) + , m_audiocpu(*this, "audiocpu") + , m_pia_1i(*this, "pia_1i") + , m_speech(*this, "speech") + , m_inputs(*this, "1B11142") + , m_host_command(0) +{ +} + +WRITE8_MEMBER(zac1b11142_audio_device::hs_w) +{ + m_host_command = data; + m_audiocpu->set_input_line(INPUT_LINE_IRQ0, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE); +} + +READ_LINE_MEMBER(zac1b11142_audio_device::acs_r) +{ + return (~m_pia_1i->b_output() >> 3) & 0x01; +} + +WRITE_LINE_MEMBER(zac1b11142_audio_device::ressound_w) +{ + // TODO: there is a pulse-stretching network attached that should be simulated + m_melodycpu->set_input_line(INPUT_LINE_RESET, state); + // TODO: holds the reset line of m_melodypia - can't implement this in MAME at this time + // TODO: holds the reset line of m_melodypsg1 - can't implement this in MAME at this time + // TODO: holds the reset line of m_melodypsg2 - can't implement this in MAME at this time + m_audiocpu->set_input_line(INPUT_LINE_RESET, state); + // TODO: holds the reset line of m_pia_1i - can't implement this in MAME at this time + // TODO: does some funky stuff with the VDD and VSS lines on the speech chip } WRITE8_MEMBER(zac1b11142_audio_device::ay_4g_porta_w) @@ -225,11 +404,6 @@ WRITE8_MEMBER(zac1b11142_audio_device::ay_4g_porta_w) // TODO: (data & 0x10) controls rullante gate } -READ8_MEMBER(zac1b11142_audio_device::ay_4g_portb_r) -{ - return m_melody_command; -} - WRITE8_MEMBER(zac1b11142_audio_device::ay_4h_porta_w) { // TODO: data & 0x01 controls LEVEL @@ -248,8 +422,8 @@ READ8_MEMBER(zac1b11142_audio_device::host_command_r) WRITE8_MEMBER(zac1b11142_audio_device::melody_command_w) { + m_melodypia->ca1_w((data >> 7) & 0x01); m_melody_command = data; - m_pia_4i->ca1_w((data >> 7) & 0x01); } WRITE8_MEMBER(zac1b11142_audio_device::pia_1i_portb_w) @@ -275,20 +449,18 @@ ioport_constructor zac1b11142_audio_device::device_input_ports() const return INPUT_PORTS_NAME(zac1b11142_ioports); } -void zac1b11142_audio_device::device_config_complete() -{ -} - void zac1b11142_audio_device::device_start() { + zac1b111xx_melody_base::device_start(); + m_acs_cb.resolve_safe(); save_item(NAME(m_host_command)); - save_item(NAME(m_melody_command)); } void zac1b11142_audio_device::device_reset() { + zac1b111xx_melody_base::device_reset(); + m_host_command = 0; - m_melody_command = 0; } diff --git a/src/mame/audio/zaccaria.h b/src/mame/audio/zaccaria.h index de796f9cf06..1414b9d2959 100644 --- a/src/mame/audio/zaccaria.h +++ b/src/mame/audio/zaccaria.h @@ -12,9 +12,22 @@ #include "sound/tms5220.h" +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +extern device_type const ZACCARIA_1B11107; extern device_type const ZACCARIA_1B11142; + +//************************************************************************** +// DEVICE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_ZACCARIA_1B11107(_tag) \ + MCFG_DEVICE_ADD(_tag, ZACCARIA_1B11107, 0) + #define MCFG_ZACCARIA_1B11142(_tag) \ MCFG_DEVICE_ADD(_tag, ZACCARIA_1B11142, 0) @@ -22,14 +35,67 @@ extern device_type const ZACCARIA_1B11142; devcb = &zac1b11142_audio_device::static_set_acs_cb(*device, DEVCB_##_devcb); -class zac1b11142_audio_device : public device_t, public device_mixer_interface + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class zac1b111xx_melody_base : public device_t, public device_mixer_interface +{ +public: + zac1b111xx_melody_base( + machine_config const &mconfig, + device_type devtype, + char const *name, + char const *tag, + device_t *owner, + UINT32 clock, + char const *shortname, + char const *source); + + DECLARE_READ8_MEMBER(melodypia_porta_r); + DECLARE_WRITE8_MEMBER(melodypia_porta_w); + DECLARE_WRITE8_MEMBER(melodypia_portb_w); + DECLARE_READ8_MEMBER(melodypsg1_portb_r); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + + required_device m_melodycpu; + required_device m_melodypia; + required_device m_melodypsg1; + required_device m_melodypsg2; + + UINT8 m_melody_command; +}; + + +class zac1b11107_audio_device : public zac1b111xx_melody_base +{ +public: + zac1b11107_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock); + + // host interface + DECLARE_WRITE8_MEMBER(sound_w); + DECLARE_WRITE_LINE_MEMBER(reset_w); + + // PSG output handlers + DECLARE_WRITE8_MEMBER(melodypsg1_porta_w); + DECLARE_WRITE8_MEMBER(melodypsg2_porta_w); + +protected: + virtual machine_config_constructor device_mconfig_additions() const override; +}; + + +class zac1b11142_audio_device : public zac1b111xx_melody_base { public: template static devcb_base &static_set_acs_cb(device_t &device, _Object object) { return downcast(device).m_acs_cb.set_callback(object); } zac1b11142_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock); - ~zac1b11142_audio_device() { } // host interface DECLARE_WRITE8_MEMBER(hs_w); @@ -37,11 +103,7 @@ public: DECLARE_WRITE_LINE_MEMBER(ressound_w); // melody section handlers - DECLARE_READ8_MEMBER(pia_4i_porta_r); - DECLARE_WRITE8_MEMBER(pia_4i_porta_w); - DECLARE_WRITE8_MEMBER(pia_4i_portb_w); DECLARE_WRITE8_MEMBER(ay_4g_porta_w); - DECLARE_READ8_MEMBER(ay_4g_portb_r); DECLARE_WRITE8_MEMBER(ay_4h_porta_w); DECLARE_WRITE8_MEMBER(ay_4h_portb_w); @@ -56,17 +118,11 @@ public: protected: virtual machine_config_constructor device_mconfig_additions() const override; virtual ioport_constructor device_input_ports() const override; - virtual void device_config_complete() override; virtual void device_start() override; virtual void device_reset() override; devcb_write_line m_acs_cb; - required_device m_melodycpu; - required_device m_pia_4i; - required_device m_ay_4g; - required_device m_ay_4h; - required_device m_audiocpu; required_device m_pia_1i; required_device m_speech; @@ -74,7 +130,6 @@ protected: required_ioport m_inputs; UINT8 m_host_command; - UINT8 m_melody_command; }; #endif // __AUDIO_ZACCARIA_H__ \ No newline at end of file diff --git a/src/mame/drivers/laserbat.cpp b/src/mame/drivers/laserbat.cpp index 60aeeef360b..3f3342c3ed0 100644 --- a/src/mame/drivers/laserbat.cpp +++ b/src/mame/drivers/laserbat.cpp @@ -197,14 +197,6 @@ static ADDRESS_MAP_START( laserbat_io_map, AS_IO, 8, laserbat_state_base ) ADDRESS_MAP_END -static ADDRESS_MAP_START( catnmous_sound_map, AS_PROGRAM, 8, catnmous_state ) - AM_RANGE(0x0000, 0x007f) AM_RAM - AM_RANGE(0x500c, 0x500f) AM_DEVREADWRITE("pia", pia6821_device, read, write) - AM_RANGE(0xc000, 0xcfff) AM_ROM - AM_RANGE(0xe000, 0xffff) AM_ROM -ADDRESS_MAP_END - - static INPUT_PORTS_START( laserbat_base ) PORT_START("ROW0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) @@ -545,27 +537,9 @@ static MACHINE_CONFIG_DERIVED_CLASS( catnmous, laserbat_base, catnmous_state ) MCFG_PALETTE_INIT_OWNER(catnmous_state, catnmous) // sound board devices - MCFG_CPU_ADD("audiocpu", M6802, XTAL_3_579545MHz) - MCFG_CPU_PROGRAM_MAP(catnmous_sound_map) - - MCFG_DEVICE_ADD("timebase", CLOCK, XTAL_3_579545MHz/4096/2) // CPU clock divided with 4040 and half of 7474 - MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("pia", pia6821_device, cb1_w)) - - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(catnmous_state, pia_porta_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(catnmous_state, pia_porta_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(catnmous_state, pia_portb_w)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("audiocpu", m6802_cpu_device, nmi_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("audiocpu", m6802_cpu_device, irq_line)) - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("psg1", AY8910, XTAL_3_579545MHz/2) // CPU clock divided with 4040 - MCFG_AY8910_PORT_B_READ_CB(READ8(catnmous_state, psg1_portb_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - MCFG_SOUND_ADD("psg2", AY8910, XTAL_3_579545MHz/2) // CPU clock divided with 4040 - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + MCFG_ZACCARIA_1B11107("audiopcb") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MACHINE_CONFIG_END @@ -705,7 +679,7 @@ ROM_START( catnmous ) ROM_REGION( 0x0100, "gfxmix", 0 ) ROM_LOAD( "82s100.13m", 0x0000, 0x00f5, CRC(6b724cdb) SHA1(8a0ca3b171b103661a3b2fffbca3d7162089e243) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x10000, "audiopcb:melodycpu", 0 ) ROM_LOAD( "sound01.1f", 0xc000, 0x1000, CRC(473c44de) SHA1(ff08b02d45a2c23cabb5db716aa203225a931424) ) ROM_LOAD( "sound01.1d", 0xe000, 0x1000, CRC(f65cb9d0) SHA1(a2fe7563c6da055bf6aa20797b2d9fa184f0133c) ) ROM_LOAD( "sound01.1e", 0xf000, 0x1000, CRC(1bd90c93) SHA1(20fd2b765a42e25cf7f716e6631b8c567785a866) ) @@ -747,7 +721,7 @@ ROM_START( catnmousa ) // copied from parent set to give working graphics, need dump to confirm ROM_LOAD( "catnmousa_82s100.13m", 0x0000, 0x00f5, CRC(6b724cdb) SHA1(8a0ca3b171b103661a3b2fffbca3d7162089e243) BAD_DUMP ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x10000, "audiopcb:melodycpu", 0 ) ROM_LOAD( "snd.1f", 0xc000, 0x1000, CRC(473c44de) SHA1(ff08b02d45a2c23cabb5db716aa203225a931424) ) ROM_LOAD( "snd.1d", 0xe000, 0x1000, CRC(f65cb9d0) SHA1(a2fe7563c6da055bf6aa20797b2d9fa184f0133c) ) ROM_LOAD( "snd.1e", 0xf000, 0x1000, CRC(1bd90c93) SHA1(20fd2b765a42e25cf7f716e6631b8c567785a866) ) diff --git a/src/mame/includes/laserbat.h b/src/mame/includes/laserbat.h index a07cdd97a87..e3b130a109d 100644 --- a/src/mame/includes/laserbat.h +++ b/src/mame/includes/laserbat.h @@ -6,6 +6,8 @@ *************************************************************************/ +#include "audio/zaccaria.h" + #include "machine/6821pia.h" #include "machine/pla.h" #include "machine/s2636.h" @@ -185,10 +187,7 @@ class catnmous_state : public laserbat_state_base public: catnmous_state(const machine_config &mconfig, device_type type, const char *tag) : laserbat_state_base(mconfig, type, tag) - , m_audiocpu(*this, "audiocpu") - , m_pia(*this, "pia") - , m_psg1(*this, "psg1") - , m_psg2(*this, "psg2") + , m_audiopcb(*this, "audiopcb") { } @@ -199,20 +198,6 @@ public: virtual DECLARE_WRITE8_MEMBER(csound1_w) override; virtual DECLARE_WRITE8_MEMBER(csound2_w) override; - // PIA handlers - DECLARE_READ8_MEMBER(pia_porta_r); - DECLARE_WRITE8_MEMBER(pia_porta_w); - DECLARE_WRITE8_MEMBER(pia_portb_w); - - // PSG handlers - DECLARE_WRITE8_MEMBER(psg1_porta_w); - DECLARE_READ8_MEMBER(psg1_portb_r); - protected: - - // sound board devices - required_device m_audiocpu; - required_device m_pia; - required_device m_psg1; - required_device m_psg2; + required_device m_audiopcb; }; -- cgit v1.2.3-70-g09d2 From bffacc884ff6769c3442fb4f26132e31484983f2 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 12 Feb 2016 20:50:56 +0100 Subject: punchout: hopefully fixed spunchout protection --- src/mame/drivers/hh_ucom4.cpp | 2 +- src/mame/drivers/punchout.cpp | 58 +++++++++++++++++++------------------------ src/mame/includes/punchout.h | 2 ++ 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp index 1c54ff21e37..b410de7cf55 100644 --- a/src/mame/drivers/hh_ucom4.cpp +++ b/src/mame/drivers/hh_ucom4.cpp @@ -2520,7 +2520,7 @@ ROM_END ROM_START( mcompgin ) ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d650c-060", 0x0000, 0x0800, BAD_DUMP CRC(92a4d8be) SHA1(d67f14a2eb53b79a7d9eb08103325299bc643781) ) + ROM_LOAD( "d650c-060", 0x0000, 0x0800, BAD_DUMP CRC(92a4d8be) SHA1(d67f14a2eb53b79a7d9eb08103325299bc643781) ) // d5 stuck: xx1x xxxx ROM_END diff --git a/src/mame/drivers/punchout.cpp b/src/mame/drivers/punchout.cpp index d7d54a6a2c4..9355d7f7726 100644 --- a/src/mame/drivers/punchout.cpp +++ b/src/mame/drivers/punchout.cpp @@ -12,7 +12,6 @@ the bottom screen. driver by Nicola Salmoria TODO: -- finish spunchout protection, currently using a hacky workaround - add useless driver config to choose between pink and white color proms - video raw params - pixel clock is derived from 20.16mhz xtal - money bag placement might not be 100% correct in Arm Wrestling @@ -148,10 +147,7 @@ WRITE8_MEMBER(punchout_state::punchout_speech_vcu_w) WRITE8_MEMBER(punchout_state::punchout_2a03_reset_w) { - if (data & 1) - m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - else - m_audiocpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 1) ? ASSERT_LINE : CLEAR_LINE); } WRITE8_MEMBER(punchout_state::nmi_mask_w) @@ -192,20 +188,19 @@ static ADDRESS_MAP_START( punchout_io_map, AS_IO, 8, punchout_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1") - AM_RANGE(0x00, 0x01) AM_WRITENOP /* the 2A03 #1 is not present */ + AM_RANGE(0x00, 0x01) AM_WRITENOP // the 2A03 #1 is not present AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW2") AM_WRITE(soundlatch_byte_w) AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW1") AM_WRITE(soundlatch2_byte_w) - AM_RANGE(0x04, 0x04) AM_DEVWRITE("vlm", vlm5030_device, data_w) /* VLM5030 */ -// AM_RANGE(0x05, 0x05) AM_WRITENOP /* unused */ -// AM_RANGE(0x06, 0x06) AM_WRITENOP + AM_RANGE(0x04, 0x04) AM_DEVWRITE("vlm", vlm5030_device, data_w) + AM_RANGE(0x05, 0x07) AM_WRITENOP // spunchout protection AM_RANGE(0x08, 0x08) AM_WRITE(nmi_mask_w) - AM_RANGE(0x09, 0x09) AM_WRITENOP /* watchdog reset, seldom used because 08 clears the watchdog as well */ - AM_RANGE(0x0a, 0x0a) AM_WRITENOP /* ?? */ + AM_RANGE(0x09, 0x09) AM_WRITENOP // watchdog reset, seldom used because 08 clears the watchdog as well + AM_RANGE(0x0a, 0x0a) AM_WRITENOP // ? AM_RANGE(0x0b, 0x0b) AM_WRITE(punchout_2a03_reset_w) - AM_RANGE(0x0c, 0x0c) AM_WRITE(punchout_speech_reset_w) /* VLM5030 */ - AM_RANGE(0x0d, 0x0d) AM_WRITE(punchout_speech_st_w) /* VLM5030 */ - AM_RANGE(0x0e, 0x0e) AM_WRITE(punchout_speech_vcu_w) /* VLM5030 */ - AM_RANGE(0x0f, 0x0f) AM_WRITENOP /* enable NVRAM ? */ + AM_RANGE(0x0c, 0x0c) AM_WRITE(punchout_speech_reset_w) + AM_RANGE(0x0d, 0x0d) AM_WRITE(punchout_speech_st_w) + AM_RANGE(0x0e, 0x0e) AM_WRITE(punchout_speech_vcu_w) + AM_RANGE(0x0f, 0x0f) AM_WRITENOP // enable NVRAM? ADDRESS_MAP_END @@ -229,15 +224,6 @@ READ8_MEMBER(punchout_state::spunchout_exp_r) ret |= m_rp5h01->counter_r() ? 0x00 : 0x40; ret |= m_rp5h01->data_r() ? 0x00 : 0x80; - // FIXME - hack d6/d7 state until we figure out why the game resets - /* PC = 0x0313 */ - /* (ret or 0x10) -> (D7DF),(D7A0) - (D7DF),(D7A0) = 0d0h(ret nc) */ - ret &= 0x3f; - if (space.device().safe_pcbase() == 0x0313) - { - ret |= 0xc0; - } - return ret; } @@ -245,22 +231,30 @@ WRITE8_MEMBER(punchout_state::spunchout_exp_w) { // d0-d3: D0-D3 to RP5C01 m_rtc->write(space, offset >> 4 & 0xf, data & 0xf); +} - // d0: 74LS74 1D + 74LS74 2D - // 74LS74 1Q -> RP5H01 DATA CLOCK + TEST +WRITE8_MEMBER(punchout_state::spunchout_rp5h01_reset_w) +{ + // d0: 74LS74 2D // 74LS74 2Q -> RP5H01 RESET // 74LS74 _2Q -> 74LS74 _1 RESET - m_rp5h01->clock_w(data & 1); - m_rp5h01->test_w(data & 1); m_rp5h01->reset_w(data & 1); - m_rp5h01->clock_w(0); - m_rp5h01->test_w(0); + if (data & 1) + spunchout_rp5h01_clock_w(space, 0, 0); +} - // d4-d7: unused? +WRITE8_MEMBER(punchout_state::spunchout_rp5h01_clock_w) +{ + // d0: 74LS74 1D + // 74LS74 1Q -> RP5H01 DATA CLOCK + TEST + m_rp5h01->clock_w(data & 1); + m_rp5h01->test_w(data & 1); } static ADDRESS_MAP_START( spnchout_io_map, AS_IO, 8, punchout_state ) - AM_RANGE(0x07, 0x07) AM_MIRROR(0xf0) AM_MASK(0xf0) AM_READWRITE(spunchout_exp_r, spunchout_exp_w) /* protection ports */ + AM_RANGE(0x05, 0x05) AM_MIRROR(0xf0) AM_WRITE(spunchout_rp5h01_reset_w) + AM_RANGE(0x06, 0x06) AM_MIRROR(0xf0) AM_WRITE(spunchout_rp5h01_clock_w) + AM_RANGE(0x07, 0x07) AM_MIRROR(0xf0) AM_MASK(0xf0) AM_READWRITE(spunchout_exp_r, spunchout_exp_w) // protection ports AM_IMPORT_FROM( punchout_io_map ) ADDRESS_MAP_END diff --git a/src/mame/includes/punchout.h b/src/mame/includes/punchout.h index b8e3bf4cd43..874b31678d1 100644 --- a/src/mame/includes/punchout.h +++ b/src/mame/includes/punchout.h @@ -60,6 +60,8 @@ public: DECLARE_WRITE8_MEMBER(punchout_2a03_reset_w); DECLARE_READ8_MEMBER(spunchout_exp_r); DECLARE_WRITE8_MEMBER(spunchout_exp_w); + DECLARE_WRITE8_MEMBER(spunchout_rp5h01_reset_w); + DECLARE_WRITE8_MEMBER(spunchout_rp5h01_clock_w); DECLARE_WRITE8_MEMBER(nmi_mask_w); DECLARE_WRITE8_MEMBER(punchout_bg_top_videoram_w); DECLARE_WRITE8_MEMBER(punchout_bg_bot_videoram_w); -- cgit v1.2.3-70-g09d2 From cb917f6d175b2afe3df43d3ada457faf3125b339 Mon Sep 17 00:00:00 2001 From: MetalliC <0vetal0@gmail.com> Date: Fri, 12 Feb 2016 22:21:17 +0200 Subject: chihiro.c: redumped "Sega Network Taisen Mahjong MJ 2 (Rev G)" [ANY] re-parented set --- src/mame/arcade.lst | 4 ++-- src/mame/drivers/chihiro.cpp | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index d3307077951..86155df03e7 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -5923,8 +5923,8 @@ mj2c // 2004.12 Sega Network Taisen Mahjong MJ 2 (Rev C) // 2004.12 Sega Network Taisen Mahjong MJ 2 (Rev D) ghostsqu // 2004.12.09 Ghost Squad (Rev A) // 2005.02 Sega Network Taisen Mahjong MJ 2 (Rev E) -mj2 // 2005.02 Sega Network Taisen Mahjong MJ 2 (Rev F) -mj2g // 2005.02.02 Sega Network Taisen Mahjong MJ 2 (Rev G) +mj2f // 2005.02 Sega Network Taisen Mahjong MJ 2 (Rev F) +mj2 // 2005.02.02 Sega Network Taisen Mahjong MJ 2 (Rev G) // 2005.03 Sangokushi Taisen gundamos // 2005.03 Gundam Battle Operating Simulator // 2005.04 Quest of D Ver.1.20 diff --git a/src/mame/drivers/chihiro.cpp b/src/mame/drivers/chihiro.cpp index 366ef73c704..0b81164dd90 100644 --- a/src/mame/drivers/chihiro.cpp +++ b/src/mame/drivers/chihiro.cpp @@ -1015,7 +1015,7 @@ ROM_START( mj2c ) ROM_LOAD( "317-0374-jpn.pic", 0x000000, 0x004000, CRC(004f77a1) SHA1(bc5c6950293f3bff60bf7913d20a2046aa19ea69) ) ROM_END -ROM_START( mj2 ) +ROM_START( mj2f ) CHIHIRO_BIOS DISK_REGION( "gdrom" ) @@ -1041,12 +1041,11 @@ track01.bin 150 599 1058400 track02.raw 750 2101 3179904 track03.bin 45150 549299 1185760800 */ -ROM_START( mj2g ) +ROM_START( mj2 ) CHIHIRO_BIOS DISK_REGION( "gdrom" ) - // this is not CHDv4, but a really bad dump, only ~1/3 of disk content is dumped - DISK_IMAGE_READONLY( "gdx-0006g", 0, BAD_DUMP SHA1(e306837d5c093fdf1e9ff02239a8563535b1c181) ) + DISK_IMAGE_READONLY( "gdx-0006g", 0, SHA1(b8c8b440d4cd2488be78e3a002058ea5b176a1f2) ) ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) ROM_LOAD( "317-0374-jpn.pic", 0x000000, 0x004000, CRC(004f77a1) SHA1(bc5c6950293f3bff60bf7913d20a2046aa19ea69) ) @@ -1237,8 +1236,8 @@ ROM_END /* 0006C */ GAME( 2004, mj2c, mj2, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 2 (Rev C) (GDX-0006C)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) // 0006D GAME( 2004, mj2d, mj2, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 2 (Rev D) (GDX-0006D)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) // 0006E GAME( 2004, mj2e, mj2, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 2 (Rev E) (GDX-0006E)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) -/* 0006F */ GAME( 2004, mj2, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 2 (Rev F) (GDX-0006F)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) -/* 0006G */ GAME( 2004, mj2g, mj2, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 2 (Rev G) (GDX-0006G)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) +/* 0006F */ GAME( 2004, mj2f, mj2, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 2 (Rev F) (GDX-0006F)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) +/* 0006G */ GAME( 2004, mj2, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Sega Network Taisen Mahjong MJ 2 (Rev G) (GDX-0006G)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) /* 0007 */ GAME( 2004, ollie, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega / Amusement Vision", "Ollie King (GDX-0007)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) // 0008 GAME( 2004, wangmdjo, wangmidj, chihirogd, chihiro, driver_device, 0, ROT0, "Namco", "Wangan Midnight Maximum Tune (Japan) (GDX-0008)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) // 0008A GAME( 2004, wangmdja, wangmidj, chihirogd, chihiro, driver_device, 0, ROT0, "Namco", "Wangan Midnight Maximum Tune (Japan) (Rev A) (GDX-0008A)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) -- cgit v1.2.3-70-g09d2 From 548da52a7d721a3a4d9b845ec503d82a0cbc50bc Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Fri, 12 Feb 2016 19:07:04 -0300 Subject: More technical notes... (nw) --- src/mame/drivers/goldstar.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 7581dcb9e77..a5b49c515b0 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -9308,8 +9308,14 @@ ROM_END /* Cherry Master I (V1.10) Original Dyna upgrade for Cherry Master boards. + The game runs in an original Dyna D9001 PCB. It laks of STOP ALL button. -*/ + + From the owner (sic): + - The reels cannot be stop, not exist all stop button or cannot be stop from small, big, double-up button. + - The odds still be "high" (on the version 4.x be "low" odds). + - Not hold a pair option to, and the min bet to start is fixed x1. + */ ROM_START( cmasterh ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "cm_v1.10_dyna.bin", 0x0000, 0x1000, CRC(872f2ef0) SHA1(ec68a03a1e8ab793d4a5eae1ce25f91608351c55) ) -- cgit v1.2.3-70-g09d2 From ae6a55f07554860fb4050ef21df16af7579cd12e Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Sat, 13 Feb 2016 02:42:38 +0100 Subject: Grouped display of DAT file information in a single view. (WIP) nw --- src/emu/inpttype.h | 6 +- src/emu/ioport.h | 6 +- src/emu/ui/datfile.cpp | 27 ++- src/emu/ui/datfile.h | 15 +- src/emu/ui/datmenu.cpp | 573 +++++++++++++----------------------------------- src/emu/ui/datmenu.h | 77 ++----- src/emu/ui/mainmenu.cpp | 69 +----- src/emu/ui/mainmenu.h | 9 +- src/emu/ui/menu.cpp | 271 +++++++++++++++++------ src/emu/ui/menu.h | 13 +- src/emu/ui/selgame.cpp | 88 +------- src/emu/ui/selsoft.cpp | 11 +- src/emu/ui/toolbar.h | 69 ------ src/emu/ui/utils.h | 4 +- 14 files changed, 436 insertions(+), 802 deletions(-) diff --git a/src/emu/inpttype.h b/src/emu/inpttype.h index 504a9e4aa8d..96395a60e7c 100644 --- a/src/emu/inpttype.h +++ b/src/emu/inpttype.h @@ -755,12 +755,8 @@ void construct_core_types_UI(simple_list &typelist) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LOAD_STATE, "Load State", input_seq(KEYCODE_F7, input_seq::not_code, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TAPE_START, "UI (First) Tape Start", input_seq(KEYCODE_F2, input_seq::not_code, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TAPE_STOP, "UI (First) Tape Stop", input_seq(KEYCODE_F2, KEYCODE_LSHIFT) ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_HISTORY, "UI Show History", input_seq(KEYCODE_LALT, KEYCODE_H) ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_MAMEINFO, "UI Show Mame/Messinfo", input_seq(KEYCODE_LALT, KEYCODE_M) ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_COMMAND, "UI Show Command Info", input_seq(KEYCODE_LALT, KEYCODE_C) ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SYSINFO, "UI Show Sysinfo", input_seq(KEYCODE_LALT, KEYCODE_S) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DATS, "UI External DAT View", input_seq(KEYCODE_LALT, KEYCODE_D) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_FAVORITES, "UI Add/Remove favorites",input_seq(KEYCODE_LALT, KEYCODE_F) ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_STORY, "UI Show Story.dat", input_seq(KEYCODE_LALT, KEYCODE_T) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP_FILTER, NULL, input_seq() ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN_FILTER, NULL, input_seq() ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LEFT_PANEL, NULL, input_seq() ) diff --git a/src/emu/ioport.h b/src/emu/ioport.h index 6048f52e9c0..d398a8df2c1 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -371,12 +371,8 @@ enum ioport_type IPT_UI_LOAD_STATE, IPT_UI_TAPE_START, IPT_UI_TAPE_STOP, - IPT_UI_HISTORY, - IPT_UI_MAMEINFO, - IPT_UI_COMMAND, - IPT_UI_SYSINFO, + IPT_UI_DATS, IPT_UI_FAVORITES, - IPT_UI_STORY, IPT_UI_UP_FILTER, IPT_UI_DOWN_FILTER, IPT_UI_LEFT_PANEL, diff --git a/src/emu/ui/datfile.cpp b/src/emu/ui/datfile.cpp index 5e8af15b335..9171242d072 100644 --- a/src/emu/ui/datfile.cpp +++ b/src/emu/ui/datfile.cpp @@ -165,6 +165,21 @@ void datfile_manager::init_command() osd_printf_verbose("Command.dat games found = %i\n", count); } +bool datfile_manager::has_software(std::string &softlist, std::string &softname, std::string &parentname) +{ + // Find software in software list index + if (m_swindex.find(softlist) == m_swindex.end()) + return false; + + m_itemsiter = m_swindex[softlist].find(softname); + if (m_itemsiter == m_swindex[softlist].end() && !parentname.empty()) + m_itemsiter = m_swindex[softlist].find(parentname); + + if (m_itemsiter == m_swindex[softlist].end()) + return false; + + return true; +} //------------------------------------------------- // load software info //------------------------------------------------- @@ -174,18 +189,10 @@ void datfile_manager::load_software_info(std::string &softlist, std::string &buf if (!m_swindex.empty() && parseopen("history.dat")) { // Find software in software list index - if (m_swindex.find(softlist) == m_swindex.end()) - return; - - drvindex::iterator itemsiter; - itemsiter = m_swindex[softlist].find(softname); - if (itemsiter == m_swindex[softlist].end() && !parentname.empty()) - itemsiter = m_swindex[softlist].find(parentname); - - if (itemsiter == m_swindex[softlist].end()) + if (!has_software(softlist, softname, parentname)) return; - long s_offset = (*itemsiter).second; + long s_offset = (*m_itemsiter).second; char rbuf[64 * 1024]; fseek(fp, s_offset, SEEK_SET); std::string readbuf; diff --git a/src/emu/ui/datfile.h b/src/emu/ui/datfile.h index 959419eb0f7..8002a26daf4 100644 --- a/src/emu/ui/datfile.h +++ b/src/emu/ui/datfile.h @@ -31,13 +31,25 @@ public: void load_software_info(std::string &softlist, std::string &buffer, std::string &softname, std::string &parentname); void command_sub_menu(const game_driver *drv, std::vector &menuitems); void reset_run() { first_run = true; } + bool has_software(std::string &softlist, std::string &softname, std::string &parentname); std::string rev_history() const { return m_history_rev; } std::string rev_mameinfo() const { return m_mame_rev; } std::string rev_messinfo() const { return m_mess_rev; } std::string rev_sysinfo() const { return m_sysinfo_rev; } std::string rev_storyinfo() const { return m_story_rev; } - + + bool has_history(const game_driver *driver) { return (m_histidx.find(driver) != m_histidx.end()); } + bool has_mameinfo(const game_driver *driver) { return (m_mameidx.find(driver) != m_mameidx.end()); } + bool has_messinfo(const game_driver *driver) { return (m_messidx.find(driver) != m_messidx.end()); } + bool has_command(const game_driver *driver) { return (m_cmdidx.find(driver) != m_cmdidx.end()); } + bool has_sysinfo(const game_driver *driver) { return (m_sysidx.find(driver) != m_sysidx.end()); } + bool has_story(const game_driver *driver) { return (m_storyidx.find(driver) != m_storyidx.end()); } + + bool has_data(const game_driver *d) + { + return (has_history(d) || has_mameinfo(d) || has_messinfo(d) || has_command(d) || has_sysinfo(d) || has_story(d)); + } private: using drvindex = std::unordered_map; using dataindex = std::unordered_map; @@ -63,6 +75,7 @@ private: int index_mame_mess_info(dataindex &index, drvindex &index_drv, int &drvcount); int index_datafile(dataindex &index, int &swcount); void index_menuidx(const game_driver *drv, dataindex &idx, drvindex &index); + drvindex::iterator m_itemsiter; void load_data_text(const game_driver *drv, std::string &buffer, dataindex &idx, std::string &tag); void load_driver_text(const game_driver *drv, std::string &buffer, drvindex &idx, std::string &tag); diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp index 72ab7509ae0..5e2d574edc0 100644 --- a/src/emu/ui/datmenu.cpp +++ b/src/emu/ui/datmenu.cpp @@ -18,107 +18,54 @@ #include "ui/utils.h" #include "softlist.h" -/************************************************** - MENU COMMAND -**************************************************/ //------------------------------------------------- // ctor / dtor //------------------------------------------------- -ui_menu_command::ui_menu_command(running_machine &machine, render_container *container, const game_driver *driver) : ui_menu(machine, container) +ui_menu_dats_view::ui_menu_dats_view(running_machine &machine, render_container *container, const game_driver *driver) : ui_menu(machine, container) { - m_driver = (driver == nullptr) ? &machine.system() : driver; -} - -ui_menu_command::~ui_menu_command() -{ -} - -//------------------------------------------------- -// populate -//------------------------------------------------- - -void ui_menu_command::populate() -{ - std::vector text; - machine().datfile().command_sub_menu(m_driver, text); - - if (!text.empty()) + image_interface_iterator iter(machine.root_device()); + for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) { - for (size_t menu_items = 0; menu_items < text.size(); menu_items++) - item_append(text[menu_items].c_str(), nullptr, 0, (void *)(FPTR)menu_items); + if (image->filename()) + { + m_list = strensure(image->software_list_name()); + m_short = strensure(image->software_entry()->shortname()); + m_long = strensure(image->software_entry()->longname()); + m_parent = strensure(image->software_entry()->parentname()); + } } - else - item_append("No available Command for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); - - item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; - -} - -//------------------------------------------------- -// handle -//------------------------------------------------- - -void ui_menu_command::handle() -{ - // process the menu - const ui_menu_event *m_event = process(0); + m_driver = (driver == nullptr) ? &machine.system() : driver; - if (m_event != nullptr && m_event->iptkey == IPT_UI_SELECT) - { - std::string m_title(item[selected].text); - ui_menu::stack_push(global_alloc_clear(machine(), container, m_title, m_driver)); - } + init_items(); } //------------------------------------------------- -// perform our special rendering +// ctor //------------------------------------------------- -void ui_menu_command::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +ui_menu_dats_view::ui_menu_dats_view(running_machine &machine, render_container *container, ui_software_info *swinfo, const game_driver *driver) : ui_menu(machine, container) { - float width; - ui_manager &mui = machine().ui(); - std::string tempbuf = std::string("Command Info - Game: ").append(m_driver->description); - - // get the size of the text - mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); - width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; - float maxwidth = MAX(width, origx2 - origx1); - - // compute our bounds - float x1 = 0.5f - 0.5f * maxwidth; - float x2 = x1 + maxwidth; - float y1 = origy1 - top; - float y2 = origy1 - UI_BOX_TB_BORDER; - - // draw a box - mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); - - // take off the borders - x1 += UI_BOX_LR_BORDER; - x2 -= UI_BOX_LR_BORDER; - y1 += UI_BOX_TB_BORDER; + m_list = swinfo->listname; + m_short = swinfo->shortname; + m_long = swinfo->longname; + m_parent = swinfo->parentname; + m_driver = (driver == nullptr) ? &machine.system() : driver; + m_swinfo = swinfo; - // draw the text within it - mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + issoft = true; + if (machine.datfile().has_software(m_list, m_short, m_parent)) + m_items_list.emplace_back("Software History", UI_HISTORY_LOAD, machine.datfile().rev_history()); + if (swinfo && !swinfo->usage.empty()) + m_items_list.emplace_back("Software Usage", 0, ""); } //------------------------------------------------- -// ctor / dtor +// dtor //------------------------------------------------- -ui_menu_command_content::ui_menu_command_content(running_machine &machine, render_container *container, std::string p_title, const game_driver *driver) : ui_menu(machine, container) -{ - m_driver = (driver == nullptr) ? &machine.system() : driver; - m_title = p_title; -} - -ui_menu_command_content::~ui_menu_command_content() +ui_menu_dats_view::~ui_menu_dats_view() { } @@ -126,212 +73,69 @@ ui_menu_command_content::~ui_menu_command_content() // handle //------------------------------------------------- -void ui_menu_command_content::handle() +void ui_menu_dats_view::handle() { - // process the menu - process(0); -} - -//------------------------------------------------- -// populate -//------------------------------------------------- - -void ui_menu_command_content::populate() -{ - machine().pause(); - std::string buffer; - machine().datfile().load_command_info(buffer, m_title); - float line_height = machine().ui().get_line_height(); - - if (!buffer.empty()) + const ui_menu_event *m_event = process(MENU_FLAG_UI_DATS); + if (m_event != nullptr) { - float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); - std::vector xstart; - std::vector xend; - convert_command_glyph(buffer); - int total_lines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, - 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), xstart, xend); - for (int r = 0; r < total_lines; r++) + if (m_event->iptkey == IPT_UI_LEFT && actual > 0) { - std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); - int first_dspace = tempbuf.find(" "); - if (first_dspace > 0 ) - { - std::string first_part(tempbuf.substr(0, first_dspace)); - std::string last_part(tempbuf.substr(first_dspace)); - strtrimspace(last_part); - item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_UI_HISTORY, nullptr); - } - else - item_append(tempbuf.c_str(), nullptr, MENU_FLAG_UI_HISTORY, nullptr); + actual--; + reset(UI_MENU_RESET_SELECT_FIRST); } - item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - } - - machine().resume(); - customtop = custombottom = line_height + 3.0f * UI_BOX_TB_BORDER; -} - -//------------------------------------------------- -// perform our special rendering -//------------------------------------------------- - -void ui_menu_command_content::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) -{ - float width; - ui_manager &mui = machine().ui(); - - // get the size of the text - mui.draw_text_full(container, m_title.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); - width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; - float maxwidth = MAX(width, origx2 - origx1); - - // compute our bounds - float x1 = 0.5f - 0.5f * maxwidth; - float x2 = x1 + maxwidth; - float y1 = origy1 - top; - float y2 = origy1 - UI_BOX_TB_BORDER; - - // draw a box - mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); - - // take off the borders - x1 += UI_BOX_LR_BORDER; - x2 -= UI_BOX_LR_BORDER; - y1 += UI_BOX_TB_BORDER; - // draw the text within it - mui.draw_text_full(container, m_title.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - - std::string tempbuf = std::string("Command Info - Game: ").append(m_driver->description); - - mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); - width += 2 * UI_BOX_LR_BORDER; - maxwidth = MAX(origx2 - origx1, width); - - // compute our bounds - x1 = 0.5f - 0.5f * maxwidth; - x2 = x1 + maxwidth; - y1 = origy2 + UI_BOX_TB_BORDER; - y2 = origy2 + bottom; - - // draw a box - mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); - - // take off the borders - x1 += UI_BOX_LR_BORDER; - x2 -= UI_BOX_LR_BORDER; - y1 += UI_BOX_TB_BORDER; - - // draw the text within it - mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); -} - -/************************************************** - MENU SOFTWARE HISTORY -**************************************************/ -//------------------------------------------------- -// ctor / dtor -//------------------------------------------------- - -ui_menu_history_sw::ui_menu_history_sw(running_machine &machine, render_container *container, ui_software_info *swinfo, const game_driver *driver) : ui_menu(machine, container) -{ - m_list = swinfo->listname; - m_short = swinfo->shortname; - m_long = swinfo->longname; - m_parent = swinfo->parentname; - m_driver = (driver == nullptr) ? &machine.system() : driver; -} - -ui_menu_history_sw::ui_menu_history_sw(running_machine &machine, render_container *container, const game_driver *driver) : ui_menu(machine, container) -{ - image_interface_iterator iter(machine.root_device()); - for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) - { - if (image->filename()) + if (m_event->iptkey == IPT_UI_RIGHT && actual < m_items_list.size() - 1) { - m_list = strensure(image->software_list_name()); - m_short = strensure(image->software_entry()->shortname()); - m_long = strensure(image->software_entry()->longname()); - m_parent = strensure(image->software_entry()->parentname()); + actual++; + reset(UI_MENU_RESET_SELECT_FIRST); } } - m_driver = (driver == nullptr) ? &machine.system() : driver; -} - -ui_menu_history_sw::~ui_menu_history_sw() -{ -} - -//------------------------------------------------- -// handle -//------------------------------------------------- - -void ui_menu_history_sw::handle() -{ - // process the menu - process(0); } //------------------------------------------------- // populate //------------------------------------------------- -void ui_menu_history_sw::populate() +void ui_menu_dats_view::populate() { machine().pause(); - std::string buffer; - machine().datfile().load_software_info(m_list, buffer, m_short, m_parent); - float line_height = machine().ui().get_line_height(); - - if (!buffer.empty()) - { - float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); - std::vector xstart; - std::vector xend; - int total_lines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), - xstart, xend); - - for (int r = 0; r < total_lines; r++) - { - std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); - item_append(tempbuf.c_str(), nullptr, MENU_FLAG_UI_HISTORY, nullptr); - } - } + if (!issoft) + get_data(); else - item_append("No available History for this software.", nullptr, MENU_FLAG_DISABLE, nullptr); + get_data_sw(); + item_append(MENU_SEPARATOR_ITEM, nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), nullptr); + customtop = 2.0f * machine().ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER; + custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; machine().resume(); - - item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - customtop = custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- // perform our special rendering //------------------------------------------------- -void ui_menu_history_sw::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { - float width; - std::string tempbuf = std::string("Software info - ").append(m_long); ui_manager &mui = machine().ui(); + float maxwidth = origx2 - origx1; + float width; + std::string driver; - // get the size of the text - mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); - width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; - float maxwidth = MAX(width, origx2 - origx1); + if (issoft) + driver = m_swinfo->longname; + else + driver = m_driver->description; + + mui.draw_text_full(container, driver.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + width += 2 * UI_BOX_LR_BORDER; + maxwidth = MAX(origx2 - origx1, width); // compute our bounds float x1 = 0.5f - 0.5f * maxwidth; float x2 = x1 + maxwidth; float y1 = origy1 - top; - float y2 = origy1 - UI_BOX_TB_BORDER; + float y2 = origy1 - 2.0f * UI_BOX_TB_BORDER - mui.get_line_height(); // draw a box mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); @@ -341,166 +145,58 @@ void ui_menu_history_sw::custom_render(void *selectedref, float top, float botto x2 -= UI_BOX_LR_BORDER; y1 += UI_BOX_TB_BORDER; - // draw the text within it - mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - - tempbuf.assign("System driver: ").append(m_driver->description); - - mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); - width += 2 * UI_BOX_LR_BORDER; - maxwidth = MAX(origx2 - origx1, width); - - // compute our bounds - x1 = 0.5f - 0.5f * maxwidth; - x2 = x1 + maxwidth; - y1 = origy2 + UI_BOX_TB_BORDER; - y2 = origy2 + bottom; + mui.draw_text_full(container, driver.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - // draw a box - mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); // take off the borders - x1 += UI_BOX_LR_BORDER; - x2 -= UI_BOX_LR_BORDER; - y1 += UI_BOX_TB_BORDER; - - // draw the text within it - mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); -} - -/************************************************** - MENU DATS -**************************************************/ -//------------------------------------------------- -// ctor / dtor -//------------------------------------------------- - -ui_menu_dats::ui_menu_dats(running_machine &machine, render_container *container, int _flags, const game_driver *driver) : ui_menu(machine, container) -{ - m_driver = (driver == nullptr) ? &machine.system() : driver; - m_flags = _flags; -} - -ui_menu_dats::~ui_menu_dats() -{ -} - -//------------------------------------------------- -// handle -//------------------------------------------------- - -void ui_menu_dats::handle() -{ - // process the menu - process(0); -} - -//------------------------------------------------- -// populate -//------------------------------------------------- - -void ui_menu_dats::populate() -{ - machine().pause(); - switch (m_flags) - { - case UI_HISTORY_LOAD: - if (!get_data(m_driver, m_flags)) - item_append("No available History for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); - break; - - case UI_MAMEINFO_LOAD: - if (!get_data(m_driver, m_flags)) - item_append("No available MameInfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); - break; - - case UI_MESSINFO_LOAD: - if (!get_data(m_driver, m_flags)) - item_append("No available MessInfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); - break; - - case UI_STORY_LOAD: - if (!get_data(m_driver, UI_STORY_LOAD)) - item_append("No available Mamescore for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); - break; - - case UI_SYSINFO_LOAD: - if (!get_data(m_driver, UI_SYSINFO_LOAD)) - item_append("No available Sysinfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); - break; - } + x1 -= UI_BOX_LR_BORDER; + x2 += UI_BOX_LR_BORDER; + y1 -= UI_BOX_TB_BORDER; - machine().resume(); - item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - customtop = custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; -} - -//------------------------------------------------- -// perform our special rendering -//------------------------------------------------- - -void ui_menu_dats::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) -{ - float width; - std::string tempbuf, revision; - datfile_manager &datfile = machine().datfile(); - ui_manager &mui = machine().ui(); - - switch (m_flags) + maxwidth = 0; + for (auto & elem : m_items_list) { - case UI_HISTORY_LOAD: - tempbuf.assign("History - Game / System: ").append(m_driver->description); - revision.assign("History.dat Revision: ").append(datfile.rev_history()); - break; - - case UI_MESSINFO_LOAD: - tempbuf.assign("MessInfo - System: ").append(m_driver->description); - revision.assign("Messinfo.dat Revision: ").append(datfile.rev_messinfo()); - break; - - case UI_MAMEINFO_LOAD: - tempbuf.assign("MameInfo - Game: ").append(m_driver->description); - revision.assign("Mameinfo.dat Revision: ").append(datfile.rev_mameinfo()); - break; - - case UI_SYSINFO_LOAD: - tempbuf.assign("Sysinfo - System: ").append(m_driver->description); - revision.assign("Sysinfo.dat Revision: ").append(datfile.rev_sysinfo()); - break; - - case UI_STORY_LOAD: - tempbuf.assign("MAMESCORE - Game: ").append(m_driver->description); - revision.assign("Story.dat Revision: ").append(machine().datfile().rev_storyinfo()); - break; + mui.draw_text_full(container, elem.label.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, + DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + maxwidth += width; } - // get the size of the text - mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); - width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; - float maxwidth = MAX(width, origx2 - origx1); + float space = (1.0f - maxwidth) / (m_items_list.size() * 2); // compute our bounds - float x1 = 0.5f - 0.5f * maxwidth; - float x2 = x1 + maxwidth; - float y1 = origy1 - top; - float y2 = origy1 - UI_BOX_TB_BORDER; + y1 = y2 + UI_BOX_TB_BORDER; + y2 += mui.get_line_height() + 2.0f * UI_BOX_TB_BORDER; // draw a box - mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); // take off the borders - x1 += UI_BOX_LR_BORDER; x2 -= UI_BOX_LR_BORDER; y1 += UI_BOX_TB_BORDER; // draw the text within it - mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + int x = 0; + for (auto & elem : m_items_list) + { + x1 += space; + rgb_t fcolor = (actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR; + rgb_t bcolor = (actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR; + mui.draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, JUSTIFY_LEFT, WRAP_NEVER, + DRAW_NONE, fcolor, bcolor, &width, nullptr); + if (bcolor != UI_TEXT_BG_COLOR) + mui.draw_textured_box(container, x1 - (space / 2), y1, x1 + width + (space / 2), y2, bcolor, rgb_t(255, 43, 43, 43), + hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + + mui.draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, JUSTIFY_LEFT, WRAP_NEVER, + DRAW_NORMAL, fcolor, bcolor, &width, nullptr); + x1 += width + space; + ++x; + } + // bottom + std::string revision; + revision.assign("Revision: ").append(m_items_list[actual].revision); mui.draw_text_full(container, revision.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; @@ -529,36 +225,79 @@ void ui_menu_dats::custom_render(void *selectedref, float top, float bottom, flo // load data from DATs //------------------------------------------------- -bool ui_menu_dats::get_data(const game_driver *driver, int flags) +void ui_menu_dats_view::get_data() { - std::string buffer; - machine().datfile().load_data_info(driver, buffer, flags); - - if (buffer.empty()) - return false; - - float line_height = machine().ui().get_line_height(); - float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); std::vector xstart; std::vector xend; - int tlines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), xstart, xend); - for (int r = 0; r < tlines; r++) + std::string buffer; + std::vector m_item; + if (m_items_list[actual].option == UI_COMMAND_LOAD) { - std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); - // special case for mamescore - if (flags == UI_STORY_LOAD) + machine().datfile().command_sub_menu(m_driver, m_item); + if (!m_item.empty()) { - size_t last_underscore = tempbuf.find_last_of('_'); - if (last_underscore != std::string::npos) + for (size_t x = 0; x < m_item.size(); ++x) { - std::string last_part(tempbuf.substr(last_underscore + 1)); - int primary = tempbuf.find("___"); - std::string first_part(tempbuf.substr(0, primary)); - item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_UI_HISTORY, nullptr); + std::string t_buffer; + buffer.append(m_item[x]).append("\n"); + machine().datfile().load_command_info(t_buffer, m_item[x]); + if (!t_buffer.empty()) + buffer.append(t_buffer).append("\n"); } + convert_command_glyph(buffer); } + } + else + machine().datfile().load_data_info(m_driver, buffer, m_items_list[actual].option); + + int totallines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend); + for (int x = 0; x < totallines; ++x) + { + std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x])); + item_append(tempbuf.c_str(), nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_DISABLE), (void *)(FPTR)(x + 1)); + + } +} + +void ui_menu_dats_view::get_data_sw() +{ + std::vector xstart; + std::vector xend; + std::string buffer; + std::vector m_item; + if (m_items_list[actual].option == 0) + buffer = m_swinfo->usage; + else + { + if (m_swinfo->startempty == 1) + machine().datfile().load_data_info(m_swinfo->driver, buffer, UI_HISTORY_LOAD); else - item_append(tempbuf.c_str(), nullptr, MENU_FLAG_UI_HISTORY, nullptr); + machine().datfile().load_software_info(m_swinfo->listname, buffer, m_swinfo->shortname, m_swinfo->parentname); } - return true; + + int totallines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend); + for (int x = 0; x < totallines; ++x) + { + std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x])); + item_append(tempbuf.c_str(), nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_DISABLE), (void *)(FPTR)(x + 1)); + + } +} + +void ui_menu_dats_view::init_items() +{ + datfile_manager &datfile = machine().datfile(); + if (datfile.has_history(m_driver)) + m_items_list.emplace_back("History", UI_HISTORY_LOAD, datfile.rev_history()); + if (datfile.has_mameinfo(m_driver)) + m_items_list.emplace_back("Mameinfo", UI_MAMEINFO_LOAD, datfile.rev_mameinfo()); + if (datfile.has_messinfo(m_driver)) + m_items_list.emplace_back("Messinfo", UI_MESSINFO_LOAD, datfile.rev_messinfo()); + if (datfile.has_sysinfo(m_driver)) + m_items_list.emplace_back("Sysinfo", UI_SYSINFO_LOAD, datfile.rev_sysinfo()); + if (datfile.has_story(m_driver)) + m_items_list.emplace_back("Mamescore", UI_STORY_LOAD, datfile.rev_storyinfo()); + if (datfile.has_command(m_driver)) + m_items_list.emplace_back("Command", UI_COMMAND_LOAD, ""); } + diff --git a/src/emu/ui/datmenu.h b/src/emu/ui/datmenu.h index 652c6492c43..f799e5fa7d0 100644 --- a/src/emu/ui/datmenu.h +++ b/src/emu/ui/datmenu.h @@ -20,74 +20,33 @@ struct ui_software_info; // class dats menu //------------------------------------------------- -class ui_menu_dats : public ui_menu +class ui_menu_dats_view : public ui_menu { public: - ui_menu_dats(running_machine &machine, render_container *container, int _flags, const game_driver *driver = nullptr); - virtual ~ui_menu_dats(); + ui_menu_dats_view(running_machine &machine, render_container *container, ui_software_info *swinfo, const game_driver *driver = nullptr); + ui_menu_dats_view(running_machine &machine, render_container *container, const game_driver *driver = nullptr); + virtual ~ui_menu_dats_view(); virtual void populate() override; virtual void handle() override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; private: + int actual; const game_driver *m_driver; - int m_flags; - - bool get_data(const game_driver *driver, int flags); -}; - -//------------------------------------------------- -// class command data menu -//------------------------------------------------- - -class ui_menu_command : public ui_menu -{ -public: - ui_menu_command(running_machine &machine, render_container *container, const game_driver *driver = nullptr); - virtual ~ui_menu_command(); - virtual void populate() override; - virtual void handle() override; - virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; - -private: - const game_driver *m_driver; -}; - -//------------------------------------------------- -// class command content data menu -//------------------------------------------------- - -class ui_menu_command_content : public ui_menu -{ -public: - ui_menu_command_content(running_machine &machine, render_container *container, std::string title, const game_driver *driver = nullptr); - virtual ~ui_menu_command_content(); - virtual void populate() override; - virtual void handle() override; - virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; - -private: - const game_driver *m_driver; - std::string m_title; -}; - -//------------------------------------------------- -// class software history menu -//------------------------------------------------- - -class ui_menu_history_sw : public ui_menu -{ -public: - ui_menu_history_sw(running_machine &machine, render_container *container, ui_software_info *swinfo, const game_driver *driver = nullptr); - ui_menu_history_sw(running_machine &machine, render_container *container, const game_driver *driver = nullptr); - virtual ~ui_menu_history_sw(); - virtual void populate() override; - virtual void handle() override; - virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; - -private: + ui_software_info *m_swinfo; std::string m_list, m_short, m_long, m_parent; - const game_driver *m_driver; + void get_data(); + void get_data_sw(); + void init_items(); + bool issoft; + struct list_items + { + list_items(std::string l, int i, std::string rev) { label = l; option = i; revision = rev; } + std::string label; + int option; + std::string revision; + }; + std::vector m_items_list; }; #endif /* __UI_DATMENU_H__ */ diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp index 9ea41a3963d..3ea29398fd2 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/emu/ui/mainmenu.cpp @@ -136,45 +136,9 @@ void ui_menu_main::populate() if (machine().options().cheat() && machine().cheat().first() != nullptr) item_append("Cheat", nullptr, 0, (void *)CHEAT); - /* add history menu */ - if (machine().ui().options().enabled_dats()) - item_append("History Info", nullptr, 0, (void *)HISTORY); - - // add software history menu - if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().ui().options().enabled_dats()) - { - image_interface_iterator iter(machine().root_device()); - for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) - { - const char *name = image->filename(); - if (name != nullptr) - { - item_append("Software History Info", nullptr, 0, (void *)SW_HISTORY); - break; - } - } - } - - /* add mameinfo / messinfo menu */ - if (machine().ui().options().enabled_dats()) - { - if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0) - item_append("MameInfo", nullptr, 0, (void *)MAMEINFO); - else if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0) - item_append("MessInfo", nullptr, 0, (void *)MAMEINFO); - } - - /* add sysinfo menu */ - if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().ui().options().enabled_dats()) - item_append("SysInfo", nullptr, 0, (void *)SYSINFO); - - /* add command list menu */ - if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().ui().options().enabled_dats()) - item_append("Commands Info", nullptr, 0, (void *)COMMAND); - - /* add story menu */ - if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().ui().options().enabled_dats()) - item_append("Mamescores", nullptr, 0, (void *)STORYINFO); + // add dats menu + if (machine().ui().options().enabled_dats() && machine().datfile().has_data(&machine().system())) + item_append("External DAT View", nullptr, 0, (void *)EXTERNAL_DATS); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); @@ -300,27 +264,8 @@ void ui_menu_main::handle() ui_menu::stack_push(global_alloc_clear(machine(), container, nullptr)); break; - case HISTORY: - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_HISTORY_LOAD)); - break; - - case MAMEINFO: - if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0) - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MAMEINFO_LOAD)); - else - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MESSINFO_LOAD)); - break; - - case SYSINFO: - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_SYSINFO_LOAD)); - break; - - case COMMAND: - ui_menu::stack_push(global_alloc_clear(machine(), container)); - break; - - case STORYINFO: - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_STORY_LOAD)); + case EXTERNAL_DATS: + ui_menu::stack_push(global_alloc_clear(machine(), container)); break; case ADD_FAVORITE: @@ -333,10 +278,6 @@ void ui_menu_main::handle() reset(UI_MENU_RESET_REMEMBER_POSITION); break; - case SW_HISTORY: - ui_menu::stack_push(global_alloc_clear(machine(), container)); - break; - case QUIT_GAME: ui_menu::stack_pop(machine()); machine().ui().request_quit(); diff --git a/src/emu/ui/mainmenu.h b/src/emu/ui/mainmenu.h index ca697558dbd..59c937d853f 100644 --- a/src/emu/ui/mainmenu.h +++ b/src/emu/ui/mainmenu.h @@ -46,16 +46,13 @@ private: BIOS_SELECTION, BARCODE_READ, PTY_INFO, - HISTORY, - MAMEINFO, - SYSINFO, + EXTERNAL_DATS, ADD_FAVORITE, REMOVE_FAVORITE, - COMMAND, - STORYINFO, - SW_HISTORY, QUIT_GAME }; + + bool submenu; }; #endif /* __UI_MAINMENU_H__ */ diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index cfd81dc9787..f831ffa725f 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -59,9 +59,13 @@ static const ui_arts_info arts_info[] = { nullptr } }; -static const char *hover_msg[] = { "Add or remove favorites", "Export displayed list to file", "Show history.dat info", - "Show mameinfo.dat / messinfo.dat info", "Show command.dat info", "Setup directories", - "Configure options" }; +static const char *hover_msg[] = { + "Add or remove favorites", + "Export displayed list to file", + "Show DATs view", + "Setup directories", + "Configure options" +}; /*************************************************************************** GLOBAL VARIABLES @@ -340,6 +344,8 @@ const ui_menu_event *ui_menu::process(UINT32 flags) draw_select_game(flags & UI_MENU_PROCESS_NOINPUT); else if ((item[0].flags & MENU_FLAG_UI_PALETTE ) != 0) draw_palette_menu(); + else if ((item[0].flags & MENU_FLAG_UI_DATS) != 0) + draw_dats_menu(); else draw(flags & UI_MENU_PROCESS_CUSTOM_ONLY, flags & UI_MENU_PROCESS_NOIMAGE, flags & UI_MENU_PROCESS_NOINPUT); @@ -463,7 +469,6 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) int itemnum, linenum; bool mouse_hit, mouse_button; float mouse_x = -1, mouse_y = -1; - bool history_flag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); if (machine().ui().options().use_background_image() && &machine().system() == &GAME_NAME(___empty) && bgrnd_bitmap->valid() && !noimage) container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); @@ -528,14 +533,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) if (top_line < 0 || selected == 0) top_line = 0; if (top_line + visible_lines >= item.size()) - { - if (history_flag) - selected = item.size() - 1; top_line = item.size() - visible_lines; - } - - if (history_flag && selected != item.size() - 1) - selected = top_line + visible_lines / 2; // determine effective positions taking into account the hilighting arrows float effective_width = visible_width - 2.0f * gutter_width; @@ -572,12 +570,11 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) float line_y1 = line_y + line_height; // set the hover if this is our item - if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && pitem.is_selectable() - && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) + if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && pitem.is_selectable()) hover = itemnum; // if we're selected, draw with a different background - if (itemnum == selected && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) + if (itemnum == selected) { fgcolor = UI_SELECTED_COLOR; bgcolor = UI_SELECTED_BG_COLOR; @@ -586,8 +583,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) } // else if the mouse is over this item, draw with a different background - else if (itemnum == hover && (((pitem.flags & MENU_FLAG_UI_HISTORY) == 0) || (linenum == 0 && top_line != 0) - || (linenum == visible_lines - 1 && itemnum != item.size() - 1))) + else if (itemnum == hover && ((linenum == 0 && top_line != 0) || (linenum == visible_lines - 1 && itemnum != item.size() - 1))) { fgcolor = UI_MOUSEOVER_COLOR; bgcolor = UI_MOUSEOVER_BG_COLOR; @@ -631,11 +627,6 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); - // draw the subitem left-justified - else if (pitem.subtext == nullptr && (pitem.flags & MENU_FLAG_UI_HISTORY) != 0) - machine().ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, - JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); - // if we don't have a subitem, just draw the string centered else if (pitem.subtext == nullptr) machine().ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, @@ -818,7 +809,6 @@ void ui_menu::handle_events(UINT32 flags) { bool stop = false; ui_event local_menu_event; - bool historyflag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); // loop while we have interesting events while (!stop && machine().ui_input().pop_event(&local_menu_event)) @@ -833,6 +823,11 @@ void ui_menu::handle_events(UINT32 flags) selected = hover; else if (hover == HOVER_ARROW_UP) { + if ((flags & MENU_FLAG_UI_DATS) != 0) + { + top_line -= visitems - (top_line + visible_lines == item.size() - 1); + return; + } selected -= visitems; if (selected < 0) selected = 0; @@ -840,6 +835,11 @@ void ui_menu::handle_events(UINT32 flags) } else if (hover == HOVER_ARROW_DOWN) { + if ((flags & MENU_FLAG_UI_DATS) != 0) + { + top_line += visible_lines - 2; + return; + } selected += visible_lines - 2 + (selected == 0); if (selected > item.size() - 1) selected = item.size() - 1; @@ -869,16 +869,23 @@ void ui_menu::handle_events(UINT32 flags) { if (local_menu_event.zdelta > 0) { - if (historyflag && selected == item.size() - 1) - selected -= visitems + 1; - else - selected -= local_menu_event.num_lines; + if ((flags & MENU_FLAG_UI_DATS) != 0) + { + top_line -= local_menu_event.num_lines; + return; + } + selected -= local_menu_event.num_lines; validate_selection(-1); if (selected < top_line + (top_line != 0)) top_line -= local_menu_event.num_lines; } else { + if ((flags & MENU_FLAG_UI_DATS) != 0) + { + top_line += local_menu_event.num_lines; + return; + } selected += local_menu_event.num_lines; validate_selection(1); if (selected > item.size() - 1) @@ -917,8 +924,6 @@ void ui_menu::handle_keys(UINT32 flags) // bail if no items if (item.empty()) return; - bool historyflag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); - // if we hit select, return TRUE or pop the stack, depending on the item if (exclusive_input_pressed(IPT_UI_SELECT, 0)) @@ -950,6 +955,9 @@ void ui_menu::handle_keys(UINT32 flags) bool ignoreleft = ((item[selected].flags & MENU_FLAG_LEFT_ARROW) == 0); bool ignoreright = ((item[selected].flags & MENU_FLAG_RIGHT_ARROW) == 0); + if ((item[0].flags & MENU_FLAG_UI_DATS) != 0) + ignoreleft = ignoreright = false; + // accept left/right keys as-is with repeat if (!ignoreleft && exclusive_input_pressed(IPT_UI_LEFT, (flags & UI_MENU_PROCESS_LR_REPEAT) ? 6 : 0)) return; @@ -959,23 +967,12 @@ void ui_menu::handle_keys(UINT32 flags) // up backs up by one item if (exclusive_input_pressed(IPT_UI_UP, 6)) { - if (historyflag) + if ((item[0].flags & MENU_FLAG_UI_DATS) != 0) { - if (selected <= (visitems / 2)) - return; - else if (visitems == item.size()) - { - selected = item.size() - 1; - return; - } - else if (selected == item.size() - 1) - selected = (item.size() - 1) - (visitems / 2); - } - - if (selected == 0) + top_line--; return; - - selected--; + } + (selected == 0) ? selected = top_line = item.size() - 1 : --selected; validate_selection(-1); top_line -= (selected == top_line && top_line != 0); } @@ -983,21 +980,12 @@ void ui_menu::handle_keys(UINT32 flags) // down advances by one item if (exclusive_input_pressed(IPT_UI_DOWN, 6)) { - if (historyflag) + if ((item[0].flags & MENU_FLAG_UI_DATS) != 0) { - if (selected < visitems / 2) - selected = visitems / 2; - else if (selected + (visitems / 2) >= item.size()) - { - selected = item.size() - 1; - return; - } - } - - if (selected == item.size() - 1) + top_line++; return; - - selected++; + } + (selected == item.size() - 1) ? selected = top_line = 0 : ++selected; top_line += (selected == top_line + visitems + (top_line != 0)); } @@ -1939,19 +1927,9 @@ void ui_menu::handle_main_events(UINT32 flags) menu_event.iptkey = IPT_UI_EXPORT; stop = true; } - else if (hover == HOVER_B_HISTORY) - { - menu_event.iptkey = IPT_UI_HISTORY; - stop = true; - } - else if (hover == HOVER_B_MAMEINFO) - { - menu_event.iptkey = IPT_UI_MAMEINFO; - stop = true; - } - else if (hover == HOVER_B_COMMAND) + else if (hover == HOVER_B_DATS) { - menu_event.iptkey = IPT_UI_COMMAND; + menu_event.iptkey = IPT_UI_DATS; stop = true; } else if (hover == HOVER_B_SETTINGS) @@ -2050,7 +2028,6 @@ float ui_menu::draw_right_box_title(float x1, float y1, float x2, float y2) float midl = (x2 - x1) * 0.5f; // add outlined box for options - //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); // add separator line @@ -2089,7 +2066,7 @@ float ui_menu::draw_right_box_title(float x1, float y1, float x2, float y2) mui.draw_text_full(container, buffer[cells].c_str(), x1 + UI_LINE_WIDTH, y1, midl - UI_LINE_WIDTH, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); - x1 = x1 + midl; + x1 += midl; } return (y1 + line_height + UI_LINE_WIDTH); @@ -2450,7 +2427,7 @@ void ui_menu::info_arrow(int ub, float origx1, float origx2, float oy1, float li } //------------------------------------------------- -// draw - draw a menu +// draw - draw palette menu //------------------------------------------------- void ui_menu::draw_palette_menu() @@ -2559,14 +2536,14 @@ void ui_menu::draw_palette_menu() hover = itemnum; // if we're selected, draw with a different background - if (itemnum == selected && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) + if (itemnum == selected) { fgcolor = UI_SELECTED_COLOR; bgcolor = UI_SELECTED_BG_COLOR; } // else if the mouse is over this item, draw with a different background - else if (itemnum == hover && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) + else if (itemnum == hover) { fgcolor = UI_MOUSEOVER_COLOR; bgcolor = UI_MOUSEOVER_BG_COLOR; @@ -2636,4 +2613,152 @@ void ui_menu::draw_palette_menu() // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != item.size()); +} + +//------------------------------------------------- +// draw - draw dats menu +//------------------------------------------------- + +void ui_menu::draw_dats_menu() +{ + float line_height = machine().ui().get_line_height(); + float ud_arrow_width = line_height * machine().render().ui_aspect(); + float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); + mouse_x = -1, mouse_y = -1; + float visible_width = 1.0f - 2.0f * UI_BOX_LR_BORDER; + float visible_left = (1.0f - visible_width) * 0.5f; + ui_manager &mui = machine().ui(); + + // draw background image if available + if (machine().ui().options().use_background_image() && bgrnd_bitmap->valid()) + container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + + hover = item.size() + 1; + visible_items = item.size() - 2; + float extra_height = 2.0f * line_height; + float visible_extra_menu_height = customtop + custombottom + extra_height; + + // locate mouse + mouse_hit = false; + mouse_button = false; + mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button); + if (mouse_target != nullptr) + if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y)) + mouse_hit = true; + + // account for extra space at the top and bottom + float visible_main_menu_height = 1.0f - 2.0f * UI_BOX_TB_BORDER - visible_extra_menu_height; + visible_lines = floor(visible_main_menu_height / line_height); + visible_main_menu_height = (float)(visible_lines * line_height); + + // compute top/left of inner menu area by centering + float visible_top = (1.0f - (visible_main_menu_height + visible_extra_menu_height)) * 0.5f; + + // if the menu is at the bottom of the extra, adjust + visible_top += customtop; + + // compute left box size + float x1 = visible_left; + float y1 = visible_top - UI_BOX_TB_BORDER; + float x2 = x1 + visible_width; + float y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER + extra_height; + float line = visible_top + (float)(visible_lines * line_height); + + //machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); + mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + + if (visible_items < visible_lines) + visible_lines = visible_items; + if (top_line < 0) + top_line = 0; + if (top_line + visible_lines >= visible_items) + top_line = visible_items - visible_lines; + + // determine effective positions taking into account the hilighting arrows + float effective_width = visible_width - 2.0f * gutter_width; + float effective_left = visible_left + gutter_width; + + int n_loop = (visible_items >= visible_lines) ? visible_lines : visible_items; + + for (int linenum = 0; linenum < n_loop; linenum++) + { + float line_y = visible_top + (float)linenum * line_height; + int itemnum = top_line + linenum; + const ui_menu_item &pitem = item[itemnum]; + const char *itemtext = pitem.text; + rgb_t fgcolor = UI_TEXT_COLOR; + rgb_t bgcolor = UI_TEXT_BG_COLOR; + float line_x0 = x1 + 0.5f * UI_LINE_WIDTH; + float line_y0 = line_y; + float line_x1 = x2 - 0.5f * UI_LINE_WIDTH; + float line_y1 = line_y + line_height; + + // if we're on the top line, display the up arrow + if (linenum == 0 && top_line != 0) + { + draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height, + 0.5f * (x1 + x2) + 0.5f * ud_arrow_width, line_y + 0.75f * line_height, fgcolor, ROT0); + + if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y) + { + fgcolor = UI_MOUSEOVER_COLOR; + bgcolor = UI_MOUSEOVER_BG_COLOR; + highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor); + hover = HOVER_ARROW_UP; + } + } + // if we're on the bottom line, display the down arrow + else if (linenum == visible_lines - 1 && itemnum != visible_items - 1) + { + draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height, + 0.5f * (x1 + x2) + 0.5f * ud_arrow_width, line_y + 0.75f * line_height, fgcolor, ROT0 ^ ORIENTATION_FLIP_Y); + + if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y) + { + fgcolor = UI_MOUSEOVER_COLOR; + bgcolor = UI_MOUSEOVER_BG_COLOR; + highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor); + hover = HOVER_ARROW_DOWN; + } + } + + // draw dats text + else if (pitem.subtext == nullptr) + { + mui.draw_text_full(container, itemtext, effective_left, line_y, effective_width, JUSTIFY_LEFT, WRAP_NEVER, + DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + } + } + + for (size_t count = visible_items; count < item.size(); count++) + { + const ui_menu_item &pitem = item[count]; + const char *itemtext = pitem.text; + float line_x0 = x1 + 0.5f * UI_LINE_WIDTH; + float line_y0 = line; + float line_x1 = x2 - 0.5f * UI_LINE_WIDTH; + float line_y1 = line + line_height; + rgb_t fgcolor = UI_SELECTED_COLOR; + rgb_t bgcolor = UI_SELECTED_BG_COLOR; + + if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && pitem.is_selectable()) + hover = count; + + if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) + container->add_line(visible_left, line + 0.5f * line_height, visible_left + visible_width, line + 0.5f * line_height, + UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + else + { + highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor); + mui.draw_text_full(container, itemtext, effective_left, line, effective_width, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + } + line += line_height; + } + + // if there is something special to add, do it by calling the virtual method + custom_render((selected >= 0 && selected < item.size()) ? item[selected].ref : nullptr, customtop, custombottom, x1, y1, x2, y2); + + // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow + visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != visible_items); } \ No newline at end of file diff --git a/src/emu/ui/menu.h b/src/emu/ui/menu.h index 174d2866fac..512436dc232 100644 --- a/src/emu/ui/menu.h +++ b/src/emu/ui/menu.h @@ -28,7 +28,7 @@ #define MENU_FLAG_REDTEXT (1 << 4) #define MENU_FLAG_DISABLE (1 << 5) #define MENU_FLAG_UI (1 << 6) -#define MENU_FLAG_UI_HISTORY (1 << 7) +#define MENU_FLAG_UI_DATS (1 << 7) #define MENU_FLAG_UI_SWLIST (1 << 8) #define MENU_FLAG_UI_FAVORITE (1 << 9) #define MENU_FLAG_UI_PALETTE (1 << 10) @@ -250,10 +250,12 @@ protected: static std::unique_ptr snapx_bitmap; static render_texture *snapx_texture; + static std::unique_ptr hilight_main_bitmap; + static render_texture *hilight_main_texture; private: static std::unique_ptr no_avail_bitmap, bgrnd_bitmap, star_bitmap; - static std::unique_ptr hilight_main_bitmap; - static render_texture *hilight_main_texture, *bgrnd_texture, *star_texture; +// static std::unique_ptr hilight_main_bitmap; + static render_texture *bgrnd_texture, *star_texture; static bitmap_argb32 *icons_bitmap[]; static render_texture *icons_texture[]; @@ -264,9 +266,12 @@ private: // draw game list void draw_select_game(bool noinput); - // draw game list + // draw palette menu void draw_palette_menu(); + // draw dats menu + void draw_dats_menu(); + void get_title_search(std::string &title, std::string &search); // handle keys diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index e911f948945..0945c6a4fda 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -371,14 +371,14 @@ void ui_menu_select_game::handle() reset(UI_MENU_RESET_SELECT_FIRST); } - // handle UI_HISTORY - else if (m_event->iptkey == IPT_UI_HISTORY && enabled_dats) + // handle UI_DATS + else if (m_event->iptkey == IPT_UI_DATS && enabled_dats) { if (!isfavorite()) { const game_driver *driver = (const game_driver *)m_event->itemref; if ((FPTR)driver > 3) - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_HISTORY_LOAD, driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, driver)); } else { @@ -386,91 +386,13 @@ void ui_menu_select_game::handle() if ((FPTR)swinfo > 3) { if (swinfo->startempty == 1) - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_HISTORY_LOAD, swinfo->driver)); + ui_menu::stack_push(global_alloc_clear(machine(), container, swinfo->driver)); else - ui_menu::stack_push(global_alloc_clear(machine(), container, swinfo)); + ui_menu::stack_push(global_alloc_clear(machine(), container, swinfo)); } } } - // handle UI_MAMEINFO - else if (m_event->iptkey == IPT_UI_MAMEINFO && enabled_dats) - { - if (!isfavorite()) - { - const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 3) - { - if ((driver->flags & MACHINE_TYPE_ARCADE) != 0) - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MAMEINFO_LOAD, driver)); - else - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MESSINFO_LOAD, driver)); - } - } - else - { - ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 3 && swinfo->startempty == 1) - { - if ((swinfo->driver->flags & MACHINE_TYPE_ARCADE) != 0) - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MAMEINFO_LOAD, swinfo->driver)); - else - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_MESSINFO_LOAD, swinfo->driver)); - } - } - } - - // handle UI_STORY - else if (m_event->iptkey == IPT_UI_STORY && enabled_dats) - { - if (!isfavorite()) - { - const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 3) - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_STORY_LOAD, driver)); - } - else - { - ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 3 && swinfo->startempty == 1) - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_STORY_LOAD, swinfo->driver)); - } - } - - // handle UI_SYSINFO - else if (m_event->iptkey == IPT_UI_SYSINFO && enabled_dats) - { - if (!isfavorite()) - { - const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 3) - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_SYSINFO_LOAD, driver)); - } - else - { - ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 3 && swinfo->startempty == 1) - ui_menu::stack_push(global_alloc_clear(machine(), container, UI_SYSINFO_LOAD, swinfo->driver)); - } - } - - // handle UI_COMMAND - else if (m_event->iptkey == IPT_UI_COMMAND && enabled_dats) - { - if (!isfavorite()) - { - const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 3) - ui_menu::stack_push(global_alloc_clear(machine(), container, driver)); - } - else - { - ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 3 && swinfo->startempty == 1) - ui_menu::stack_push(global_alloc_clear(machine(), container, swinfo->driver)); - } - } - // handle UI_FAVORITES else if (m_event->iptkey == IPT_UI_FAVORITES) { diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index 5d1acb27c34..95a113189cd 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -211,13 +211,18 @@ void ui_menu_select_software::handle() } } - // handle UI_HISTORY - else if (m_event->iptkey == IPT_UI_HISTORY && machine().ui().options().enabled_dats()) + // handle UI_DATS + else if (m_event->iptkey == IPT_UI_DATS && machine().ui().options().enabled_dats()) { ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; if ((FPTR)ui_swinfo > 1) - ui_menu::stack_push(global_alloc_clear(machine(), container, ui_swinfo, m_driver)); + { + if (ui_swinfo->startempty == 1) + ui_menu::stack_push(global_alloc_clear(machine(), container, ui_swinfo->driver)); + else + ui_menu::stack_push(global_alloc_clear(machine(), container, ui_swinfo)); + } } // handle UI_UP_FILTER diff --git a/src/emu/ui/toolbar.h b/src/emu/ui/toolbar.h index f15f4499229..095aa0e3cdd 100644 --- a/src/emu/ui/toolbar.h +++ b/src/emu/ui/toolbar.h @@ -106,75 +106,6 @@ static const UINT32 toolbar_bitmap_bmp[][1024] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x07999999, 0x2D999999, 0x50999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x72407283, 0x6626687D, 0x22467584, 0x800B5C76, 0x1A0A5B75, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, -{ - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0E999999, 0x59999999, 0x9E999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0x8B999999, 0x41999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x0F999999, 0xC8AEAEAE, 0xFFDADADA, 0xFFF7F7F7, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFF1F1F1, 0xFFCDCDCD, 0x7BA1A1A1, 0x08999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x5B999999, 0xFFDADADA, 0xFFF8F8F8, 0xFFF2F2F2, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFF0F0F0, 0xFFF3F3F3, 0xFFFAFAFA, 0xD8BFBFBF, 0x2E999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xA3999999, 0xFFEEEEEE, 0xFFF0F0F0, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFF2F2F2, 0xFCD1D1D1, 0x53999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFB5B5B5, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFD3D3D3, 0xFFEDEDED, 0xFFEDEDED, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFDADADA, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFE4E4E4, 0xFFEDEDED, 0xFFEDEDED, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFD0D0D0, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFCFCFCF, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFD8D8D8, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFE1E1E1, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFCFCFCF, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFB4B4B4, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFD0D0D0, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFCECECE, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFCDCDCD, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFCDCDCD, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFCCCCCC, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFCBCBCB, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFB2B2B2, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFCCCCCC, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFCBCBCB, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFD2D2D2, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFDBDBDB, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFCACACA, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFBAC5A7, 0xFFB5C29F, 0xFFD6D8D1, 0xFF9AB077, 0xFFD1D5CA, 0xFFC9C9C9, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFDCDDDA, 0xFFB2C09C, 0xFFB9C3A7, 0xFF95B06E, 0xFF99BE65, 0xFF94AE6B, 0xFF91B959, 0xFFB3C09D, 0xFF9EAD84, 0x5C778B57, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFDADBD8, 0xFFC9CEBF, 0xFF90AE62, 0xFF93BE57, 0xFF8EB853, 0xFF97C060, 0xFFA2C86F, 0xFF94BE5D, 0xFF89B24D, 0xFF8DB852, 0x6B678E2C, 0x0E446804, 0x03466A06, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFC0C0C0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFDDDEDC, 0xFFA5B68A, 0xFF92B263, 0xFF86AD4F, 0xFF8FB957, 0xFF8BB551, 0xFFB8D295, 0xFFEAF2E1, 0xFFB4D08F, 0xFF8DB754, 0xFF89B350, 0xCE76A038, 0xA16E962E, 0x27517612, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFBFBFBF, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFDEDEDE, 0xFFB2BC9F, 0xFF81AA47, 0xFF87B14F, 0xFF84AE4C, 0xFF80AB46, 0xFFC7DAAE, 0xFFFFFFFF, 0xFFC3D8A8, 0xFF84AE4B, 0xFF85AF4D, 0xFF8AB552, 0xBE6F9633, 0x1A466B07, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFB4BFA1, 0xFF8FAA64, 0xFF7BA53F, 0xFF7FA845, 0xFF7EA745, 0xFF7BA53F, 0xFFC0D4A4, 0xFFFFFFFF, 0xFFBAD09D, 0xFF7DA743, 0xFF7EA745, 0xFF80A946, 0xD9709931, 0x815C831C, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFAAB893, 0xFF7C9F48, 0xFF779F3C, 0xFF769F3B, 0xFF769F3B, 0xFF739C37, 0xFFB4CA93, 0xFFFEFEFD, 0xFFA9C284, 0xFF739D38, 0xFF769F3B, 0xFF769E3B, 0xFB769E3B, 0xBE628925, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFCBCFC5, 0xFF7D9A4F, 0xFF729935, 0xFF709834, 0xFF709734, 0xFF6E9631, 0xFFA7BF82, 0xFFFDFDFC, 0xFF9BB670, 0xFF6D9530, 0xFF709734, 0xFF709835, 0xF268902A, 0x5E517611, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFF98A979, 0xFF6A8F2F, 0xFF678E2A, 0xFF688F2A, 0xFF688F2A, 0xFF678E29, 0xFF90AC63, 0xFFE7EDDE, 0xFF7FA04C, 0xFF668D27, 0xFF688F2A, 0xFF678E2A, 0xFB688F2A, 0xDC5A801A, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFCACEC4, 0xFFA3B28B, 0xFF5E8420, 0xFF618824, 0xFF618823, 0xFF618823, 0xFF678C2B, 0xFF83A153, 0xFF618824, 0xFF608723, 0xFF618823, 0xFF628924, 0xBC557A16, 0x434E730F, - 0x00000000, 0x00000000, 0x00000000, 0x91999999, 0xFFD2D2D2, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD8D8D7, 0xFF93A575, 0xFF5A811C, 0xFF597F1A, 0xFF597F1A, 0xFF567D15, 0xFFA1B77D, 0xFFF3F6EF, 0xFF98B072, 0xFF587E18, 0xFF597F1A, 0xFD59801A, 0xCF547A14, 0x27476B07, - 0x00000000, 0x00000000, 0x00000000, 0x45999999, 0xFFBCBCBC, 0xFFD8D8D8, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD8D8D7, 0xFFB3BDA3, 0xFF9BAC80, 0xFF658430, 0xFF557B16, 0xFF517810, 0xFF91A968, 0xFFDAE2CC, 0xFF8BA560, 0xFF527913, 0xFA537914, 0x9B4D720D, 0x5C4C710D, 0x15476C08, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7B9C9C9C, 0xD7B1B1B1, 0xFAC1C1C1, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFB8BBB3, 0xFF6E8744, 0xFF5E7A2D, 0xFF54761A, 0xFD4C720C, 0xF64C720C, 0xFB4C720B, 0xC54B700B, 0xD94C720D, 0x53496E0A, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x07999999, 0x2D999999, 0x50999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55969793, 0x55728354, 0x557E8A69, 0xAB52731A, 0xBC4A6E0A, 0x70486C0A, 0xE0496D08, 0x41466B06, 0x2F476B07, 0x16476B07, 0x00000000, 0x00000000 -}, - -{ - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0E999999, 0x59999999, 0x9E999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0xAA999999, 0x8B999999, 0x41999999, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x0F999999, 0xC8AEAEAE, 0xFFDADADA, 0xFFF7F7F7, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFF1F1F1, 0xFFCDCDCD, 0x7BA1A1A1, 0x08999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x5B999999, 0xFFDADADA, 0xFFF8F8F8, 0xFFF2F2F2, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFF0F0F0, 0xFFF3F3F3, 0xFFFAFAFA, 0xD8BFBFBF, 0x2E999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xA3999999, 0xFFEEEEEE, 0xFFF0F0F0, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFEFEFEF, 0xFFF2F2F2, 0xFCD1D1D1, 0x53999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFB5B5B5, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFD3D3D3, 0xFFEDEDED, 0xFFEDEDED, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEDEDED, 0xFFEDEDED, 0xFFEDEDED, 0xFFDADADA, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFD1D1D1, 0xFFE4E4E4, 0xFFEDEDED, 0xFFEDEDED, 0xFFD1D1D1, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFECECEC, 0xFFD0D0D0, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFCFCFCF, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFD8D8D8, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFCFCFCF, 0xFFE1E1E1, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFCFCFCF, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFB4B4B4, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFD0D0D0, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFCECECE, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFCDCDCD, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFCDCDCD, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFCCCCCC, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFCBCBCB, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFB2B2B2, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF999999, 0xFF9A9A9A, 0xFFCCCCCC, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFCBCBCB, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFD2D2D2, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFCACACA, 0xFFC6B7B1, 0xFFC6B5B0, 0xFFDBDBDA, 0xFFDAB9AF, 0xFFE1DBD9, 0xFFCACACA, 0x55999999, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE1DFDE, 0xFFDEC9C0, 0xFFDDCDC7, 0xFFDB9673, 0xFFE49259, 0xFFDAA68E, 0xFFE4803C, 0xFFDCBAAC, 0xFFCAB2A9, 0x59A68679, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFDED6D3, 0xFFDD8F62, 0xFFE78F50, 0xFFE8813C, 0xFFF0852D, 0xFFEB7D2A, 0xFFF0832C, 0xFFE2884F, 0xFFE38341, 0x63CF612D, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0E0E0, 0xFFE0DFDE, 0xFFDAB7AA, 0xFFDC9D7E, 0xFFDE7B42, 0xFFEB7F2A, 0xFFEA7C27, 0xFFED9D5F, 0xFFF6CFB1, 0xFFEE9A5B, 0xFFEB7E28, 0xFFE67729, 0xA4D76225, 0x66D55A22, 0x18C5461C, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFC0C0C0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFDFDEDE, 0xFFD59F8C, 0xFFE77426, 0xFFE87627, 0xFFE47426, 0xFFE46F1E, 0xFFF3C09C, 0xFFFFFFFF, 0xFFF2B992, 0xFFE37324, 0xFFE67426, 0xFDE87727, 0xD1DC6523, 0x28C3441C, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFBFBFBF, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFDBC8C1, 0xFFD9A08A, 0xFFDE6521, 0xFFE06B21, 0xFFE06B21, 0xFFDF661A, 0xFFF0B794, 0xFFFFFFFF, 0xFFEEB28D, 0xFFE0691F, 0xFFDF6B21, 0xFFE06B21, 0xBED85A1F, 0x46CF4F1D, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFDDDDDD, 0xFFD3947C, 0xFFDC6527, 0xFFDE631D, 0xFFDB621D, 0xFFDC621D, 0xFFDB5E17, 0xFFECAD89, 0xFFFFFEFE, 0xFFEAA37A, 0xFFDB5F1A, 0xFFDC621D, 0xFFDC621D, 0xFBE1641E, 0xDED2541C, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFDCDCDC, 0xFFD9CFCD, 0xFFD17857, 0xFFD75819, 0xFFD65719, 0xFFD65719, 0xFFD55414, 0xFFE69A75, 0xFFFEFDFC, 0xFFE38C61, 0xFFD55313, 0xFFD65719, 0xFFD65719, 0xF2D45319, 0x5EC6451A, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFDBDBDB, 0xFFD39B89, 0xFFD85925, 0xFFD35015, 0xFFD24F15, 0xFFD24F15, 0xFFD14D12, 0xFFE18B65, 0xFFFEFBF9, 0xFFDC784C, 0xFFD14B11, 0xFFD24F15, 0xFFD24E15, 0xFBD85015, 0xC0D04917, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFD5B9B1, 0xFFCC7D64, 0xFFCC4513, 0xFFCD4410, 0xFFCD4410, 0xFFCD440F, 0xFFD15425, 0xFFE08F71, 0xFFCE4917, 0xFFCD430F, 0xFFCD4410, 0xFFCE4410, 0xD7C84315, 0x7CC34118, - 0x00000000, 0x00000000, 0x00000000, 0xAA999999, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFDADADA, 0xFFD1A598, 0xFFCD3E0E, 0xFFC93C0C, 0xFFC93C0D, 0xFFC83A0A, 0xFFD66B47, 0xFFEAB4A0, 0xFFD4633C, 0xFFC93B0B, 0xFFC93C0D, 0xFFCB3D0B, 0xBDCB3E12, 0x19BF3E19, - 0x00000000, 0x00000000, 0x00000000, 0x91999999, 0xFFD2D2D2, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD8D7D6, 0xFFCE9383, 0xFFC96A4E, 0xFFC4451F, 0xFFC53408, 0xFFC32E03, 0xFFDF907A, 0xFFF8E9E4, 0xFFDD8B72, 0xFFC43206, 0xFCC5350A, 0xCAC23911, 0x99C23B13, 0x24C03D18, - 0x00000000, 0x00000000, 0x00000000, 0x45999999, 0xFFBCBCBC, 0xFFD8D8D8, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD9D9D9, 0xFFD8D5D4, 0xFFD5C6C1, 0xFFC55A3D, 0xFFC1320B, 0xFFC13109, 0xFFC53D18, 0xFFCE5A3C, 0xFFC43B17, 0xF9C1310B, 0xFCC13109, 0x62BF3812, 0x0ABD3E1B, 0x02BE3E1A, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7B9C9C9C, 0xD7B1B1B1, 0xFAC1C1C1, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC3C3C3, 0xFFC2BEBD, 0xFFBA9185, 0xFFBDA19A, 0xFFBC5F46, 0xF2BB3D1C, 0xCBB84A2B, 0xE9BE2E09, 0x52BE3915, 0x5FBE3B17, 0x2BBE3A16, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x07999999, 0x2D999999, 0x50999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x55999999, 0x72B05D46, 0x66B74B2D, 0x22AE644F, 0x80BE3814, 0x1ABE3C18, 0x00000000, 0x00000000, 0x00000000, 0x00000000 -}, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index 81c509f9958..232fb3ccb41 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -129,9 +129,7 @@ enum HOVER_ARROW_DOWN, HOVER_B_FAV, HOVER_B_EXPORT, - HOVER_B_HISTORY, - HOVER_B_MAMEINFO, - HOVER_B_COMMAND, + HOVER_B_DATS, HOVER_B_FOLDERS, HOVER_B_SETTINGS, HOVER_RPANEL_ARROW, -- cgit v1.2.3-70-g09d2 From bd7aee24218c2e6d52e6799b2bcdfa1160049715 Mon Sep 17 00:00:00 2001 From: cracyc Date: Fri, 12 Feb 2016 21:37:08 -0600 Subject: x68k: ELSE if (nw) pic8259: spurious irq 7 (nw) pc9801: windows 3.1 checks port 61h? (nw) --- src/devices/machine/pic8259.cpp | 5 ++++- src/mame/drivers/pc9801.cpp | 7 +++++++ src/mame/video/x68k.cpp | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/devices/machine/pic8259.cpp b/src/devices/machine/pic8259.cpp index 40fe6fd916c..3064e212850 100644 --- a/src/devices/machine/pic8259.cpp +++ b/src/devices/machine/pic8259.cpp @@ -133,7 +133,10 @@ UINT32 pic8259_device::acknowledge() } } } - return 0; + logerror("Spurious IRQ\n"); + if(m_is_x86) + return m_base + 7; + return 0xcd0000 + (m_vector_addr_high << 8) + m_vector_addr_low + (7 << (3-m_vector_size)); } diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index 66670fe7c9a..7185014c285 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -734,6 +734,7 @@ public: UINT8 freq_index; }m_mouse; TIMER_DEVICE_CALLBACK_MEMBER( mouse_irq_cb ); + DECLARE_READ8_MEMBER(unk_r); DECLARE_DRIVER_INIT(pc9801_kanji); inline void set_dma_channel(int channel, int state); @@ -2485,6 +2486,7 @@ static ADDRESS_MAP_START( pc9821_io, AS_IO, 32, pc9801_state ) AM_RANGE(0x0050, 0x0053) AM_WRITE8(pc9801rs_nmi_w, 0xffffffff) AM_RANGE(0x005c, 0x005f) AM_READ16(pc9821_timestamp_r,0xffffffff) AM_WRITENOP // artic AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("upd7220_chr", upd7220_device, read, write, 0x00ff00ff) //upd7220 character ports / + AM_RANGE(0x0060, 0x0063) AM_READ8(unk_r, 0xff00ff00) // mouse related (unmapped checking for AT keyb controller\PS/2 mouse?) AM_RANGE(0x0064, 0x0067) AM_WRITE8(vrtc_clear_w, 0x000000ff) AM_RANGE(0x0068, 0x006b) AM_WRITE8(pc9821_video_ff_w, 0x00ff00ff) //mode FF / AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00ff00) @@ -2969,6 +2971,11 @@ WRITE8_MEMBER(pc9801_state::ppi_mouse_portc_w) m_mouse.control = data; } +READ8_MEMBER(pc9801_state::unk_r) +{ + return 0xff; +} + /**************************************** * * UPD765 interface diff --git a/src/mame/video/x68k.cpp b/src/mame/video/x68k.cpp index 13f6288b642..7a11c89175b 100644 --- a/src/mame/video/x68k.cpp +++ b/src/mame/video/x68k.cpp @@ -867,7 +867,7 @@ bool x68k_state::x68k_draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprec else bitmap.pix16(scanline, pixel) = (pal[colour] & 0xfffe) + blend; } - if(((m_video.reg[2] & 0x1800) == 0x1000) && (colour & 1)) + else if(((m_video.reg[2] & 0x1800) == 0x1000) && (colour & 1)) m_special.pix16(scanline, pixel) = colour; else bitmap.pix16(scanline, pixel) = colour; -- cgit v1.2.3-70-g09d2 From 60ab02633b43bf28afa43dc56e3faf381aac4296 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Sat, 13 Feb 2016 09:03:17 +0100 Subject: New clones added or promoted from NOT_WORKING status ---------------------------------------------------- 1943: Midway Kaisen (bootleg) [Andrea Palazzetti] --- src/mame/arcade.lst | 1 + src/mame/drivers/1943.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 86155df03e7..0a2733bd867 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -3092,6 +3092,7 @@ supduck // (c) Comad 1943j // 6/1987 (c) 1987 (Japan) Rev B 1943ja // 6/1987 (c) 1987 (Japan) 1943b // bootleg +1943bj // bootleg blktiger // 8/1987 (c) 1987 (US) blktigera // 8/1987 (c) 1987 (US) blktigerb1 // bootleg diff --git a/src/mame/drivers/1943.cpp b/src/mame/drivers/1943.cpp index c91260a9b63..3dc4c5aa98c 100644 --- a/src/mame/drivers/1943.cpp +++ b/src/mame/drivers/1943.cpp @@ -694,7 +694,6 @@ ROM_START( 1943kai ) ROM_LOAD( "bm6.4b", 0x0b00, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ ROM_END - ROM_START( 1943b ) ROM_REGION( 0x30000, "maincpu", 0 ) /* 64k for code + 128k for the banked ROMs images */ ROM_LOAD( "1.12d", 0x00000, 0x08000, CRC(9a2d70ab) SHA1(6f84e906656f132ffcb63022f6d067580d261431) ) // protection patched out, disclaimer patched out @@ -746,6 +745,64 @@ ROM_START( 1943b ) ROM_LOAD( "bm6.4b", 0x0b00, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ ROM_END +ROM_START( 1943bj ) + ROM_REGION( 0x30000, "maincpu", 0 ) /* 64k for code + 128k for the banked ROMs images */ + ROM_LOAD( "mkb03.12d", 0x00000, 0x08000, CRC(b3b7c7cd) SHA1(6197023f4384fd2ac72b686c26a6ff2877345b61) ) // protection patched out + ROM_LOAD( "bm02.13d", 0x10000, 0x10000, CRC(af971575) SHA1(af1d8ce73e8671b7b41248ce6486c9b5aaf6a233) ) + ROM_LOAD( "bm03.14d", 0x20000, 0x10000, CRC(300ec713) SHA1(f66d2356b413a418c887b4085a5315475c7a8bba) ) + + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "bm04.5h", 0x00000, 0x8000, CRC(ee2bd2d7) SHA1(4d2d019a9f8452fbbb247e893280568a2e86073e) ) + + ROM_REGION( 0x8000, "gfx1", 0 ) + ROM_LOAD( "bm05.4k", 0x00000, 0x8000, CRC(46cb9d3d) SHA1(96fd0e714b91fe13a2ca0d185ada9e4b4baa0c0b) ) /* characters */ + + ROM_REGION( 0x40000, "gfx2", 0 ) + /* double size roms - same gfx different layout */ + ROM_LOAD( "mkb12.12f", 0x00000, 0x8000, CRC(075e9a7f) SHA1(2b826d6d202d37cff1aeb58f225e70be7ba9a206) ) /* bg tiles */ + ROM_CONTINUE( 0x10000, 0x08000 ) + ROM_LOAD( "mkb11.14f", 0x08000, 0x8000, CRC(05aca09a) SHA1(21cc251e61343be27e969885b013fa6e8b5aa210) ) + ROM_CONTINUE( 0x18000, 0x08000 ) + ROM_LOAD( "mkb09.12j", 0x20000, 0x8000, CRC(0f4b7e0e) SHA1(1dd2a4a78ab45bb122895e5a0961e527f77713d1) ) + ROM_CONTINUE( 0x30000, 0x08000 ) + ROM_LOAD( "mkb10.14j", 0x28000, 0x8000, CRC(61a90c0a) SHA1(8aae483e51d645d9e4d2604dbca432c13a3e8d0d) ) + ROM_CONTINUE( 0x38000, 0x08000 ) + + ROM_REGION( 0x10000, "gfx3", 0 ) + ROM_LOAD( "mkb08.14k", 0x00000, 0x8000, CRC(798215e3) SHA1(1c732b60cd430aa0acd1698b4fe1984385223b28) ) /* fg tiles */ + ROM_LOAD( "bm25.14l", 0x08000, 0x8000, CRC(092cf9c1) SHA1(19fe3c714b1d52cbb21dea25cdee5af841f525db) ) + + ROM_REGION( 0x40000, "gfx4", 0 ) + ROM_LOAD( "bm06.10a", 0x00000, 0x8000, CRC(97acc8af) SHA1(c9fa07cb61f6905408b355edabfe453fb652ff0d) ) /* sprites */ + ROM_LOAD( "bm07.11a", 0x08000, 0x8000, CRC(d78f7197) SHA1(6367c7e80e80d4a0d33d7840b5c843c63c80123e) ) + ROM_LOAD( "bm08.12a", 0x10000, 0x8000, CRC(1a626608) SHA1(755c27a07728fd686168e9d9e4dee3d8f274892a) ) + ROM_LOAD( "bm09.14a", 0x18000, 0x8000, CRC(92408400) SHA1(3ab299bad1ba115efead53ebd92254abe7a092ba) ) + ROM_LOAD( "bm10.10c", 0x20000, 0x8000, CRC(8438a44a) SHA1(873629b00cf3f6d8976a7fdafe63cd16e47b7491) ) + ROM_LOAD( "bm11.11c", 0x28000, 0x8000, CRC(6c69351d) SHA1(c213d5c3e76a5749bc32539604716dcef6dcb694) ) + ROM_LOAD( "bm12.12c", 0x30000, 0x8000, CRC(5e7efdb7) SHA1(fef271a38dc1a9e45a0c6e27e28e713c77c8f8c9) ) + ROM_LOAD( "bm13.14c", 0x38000, 0x8000, CRC(1143829a) SHA1(2b3a65e354a205c05a87f783e9938b64bc62396f) ) + + ROM_REGION( 0x10000, "gfx5", 0 ) /* tilemaps */ + /* front background */ + ROM_LOAD( "bm14.5f", 0x0000, 0x8000, CRC(4d3c6401) SHA1(ce4f6dbf8fa030ad45cbb5afd58df27fed2d4618) ) + /* back background probably same gfx different layout */ + ROM_LOAD( "mkb07.8k", 0xc000, 0x4000, CRC(ae1b317f) SHA1(d311c198d77ec932d776427e2ebfffe90e5330c3) ) + ROM_CONTINUE( 0x8000, 0x4000 ) + + ROM_REGION( 0x0c00, "proms", 0 ) + ROM_LOAD( "bm1.12a", 0x0000, 0x0100, CRC(74421f18) SHA1(5b8b59f6f4e5ad358611de50608f47f41a5b0e51) ) /* red component */ + ROM_LOAD( "bm2.13a", 0x0100, 0x0100, CRC(ac27541f) SHA1(1796c4c9041dfe28e6319576f21df1dbcb8d12bf) ) /* green component */ + ROM_LOAD( "bm3.14a", 0x0200, 0x0100, CRC(251fb6ff) SHA1(d1118159b3d429d841e4efa938728ebedadd7ec5) ) /* blue component */ + ROM_LOAD( "bm5.7f", 0x0300, 0x0100, CRC(206713d0) SHA1(fa609f6d675af18c379838583505724d28bcff0e) ) /* char lookup table */ + ROM_LOAD( "bm10.7l", 0x0400, 0x0100, CRC(33c2491c) SHA1(13da924e4b182759c4aae49034f3a7cbe556ea65) ) /* foreground lookup table */ + ROM_LOAD( "bm9.6l", 0x0500, 0x0100, CRC(aeea4af7) SHA1(98f4570ee061e9aa58d8ed2d2f8ae59ce2ec5795) ) /* foreground palette bank */ + ROM_LOAD( "bm12.12m", 0x0600, 0x0100, CRC(c18aa136) SHA1(684f04d9a5b94ae1db5fb95763e65271f4cf8e01) ) /* background lookup table */ + ROM_LOAD( "bm11.12l", 0x0700, 0x0100, CRC(405aae37) SHA1(94a06f81b775c4e49d57d42fc064d3072a253bbd) ) /* background palette bank */ + ROM_LOAD( "bm8.8c", 0x0800, 0x0100, CRC(c2010a9e) SHA1(be9852500209066e2f0ff2770e0c217d1636a0b5) ) /* sprite lookup table */ + ROM_LOAD( "bm7.7c", 0x0900, 0x0100, CRC(b56f30c3) SHA1(9f5e6db464d21457a33ec8bdfdff069632b791db) ) /* sprite palette bank */ + ROM_LOAD( "bm4.12c", 0x0a00, 0x0100, CRC(91a8a2e1) SHA1(9583c87eff876f04bc2ccf7218cd8081f1bcdb94) ) /* priority encoder / palette selector (not used) */ + ROM_LOAD( "bm6.4b", 0x0b00, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ +ROM_END DRIVER_INIT_MEMBER(_1943_state,1943) { @@ -767,4 +824,5 @@ GAME( 1987, 1943ua, 1943, 1943, 1943, _1943_state, 1943, ROT270, "Capcom" GAME( 1987, 1943j, 1943, 1943, 1943, _1943_state, 1943, ROT270, "Capcom", "1943: Midway Kaisen (Japan, Rev B)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, 1943ja, 1943, 1943, 1943, _1943_state, 1943, ROT270, "Capcom", "1943: Midway Kaisen (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, 1943b, 1943, 1943, 1943, _1943_state, 1943b,ROT270, "bootleg", "1943: Battle of Midway (bootleg, hack of Japan set)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, 1943kai, 0, 1943, 1943, _1943_state, 1943, ROT270, "Capcom", "1943 Kai: Midway Kaisen (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, 1943bj, 1943, 1943, 1943, _1943_state, 1943b,ROT270, "bootleg", "1943: Midway Kaisen (bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, 1943kai, 0, 1943, 1943, _1943_state, 1943, ROT270, "Capcom", "1943 Kai: Midway Kaisen (Japan)", MACHINE_SUPPORTS_SAVE ) \ No newline at end of file -- cgit v1.2.3-70-g09d2 From b7320361df1a12f612d4f76ad102ed3e9450de0b Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Sat, 13 Feb 2016 09:12:17 +0100 Subject: mitchell.cpp: dumped a blockjoy board and noted a rom label difference (Andrea Palazzetti) --- src/mame/drivers/mitchell.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mame/drivers/mitchell.cpp b/src/mame/drivers/mitchell.cpp index f075e7b1957..df82f162383 100644 --- a/src/mame/drivers/mitchell.cpp +++ b/src/mame/drivers/mitchell.cpp @@ -2091,6 +2091,8 @@ ROM_START( blockjoy ) ROM_REGION( 0x50000, "maincpu", 0 ) ROM_LOAD( "ble_05.bin", 0x00000, 0x08000, CRC(fa2a4536) SHA1(8f584745116bd0ced4d66719cd80c0372b797134) ) ROM_LOAD( "blf_06.bin", 0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) ) +// a ble_06a labeled rom has been dumped and verified identical to blf_06.bin. + // this seems to be a bad version of the above rom, although the rom code is different it is 99% the same, and level 6 // is impossible to finish due to a missing block. Probably bitrot // ROM_LOAD( "ble_06.bin", 0x10000, 0x20000, BAD_DUMP CRC(58a77402) SHA1(cb24b1edd53a0965c3a9a34fe764b5c1f8dd9733) ) -- cgit v1.2.3-70-g09d2 From ebe987034ad2def64df67525f2fcf8eb265f5154 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Sat, 13 Feb 2016 09:30:08 +0100 Subject: galpanic.cpp: oki address map instead of memcpy, added save state support, removed some leftovers (nw) --- src/mame/drivers/galpanic.cpp | 50 +++++++++++++++++++++++-------------------- src/mame/includes/galpanic.h | 23 ++++++++++---------- src/mame/video/galpanic.cpp | 31 +++++++++++---------------- 3 files changed, 50 insertions(+), 54 deletions(-) diff --git a/src/mame/drivers/galpanic.cpp b/src/mame/drivers/galpanic.cpp index b47226747c1..1f9c349de33 100644 --- a/src/mame/drivers/galpanic.cpp +++ b/src/mame/drivers/galpanic.cpp @@ -74,7 +74,12 @@ Stephh's additional notes : #include "includes/galpanic.h" #include "includes/galpnipt.h" -void galpanic_state::screen_eof_galpanic(screen_device &screen, bool state) +void galpanic_state::machine_start() +{ + membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000); +} + +void galpanic_state::screen_eof(screen_device &screen, bool state) { // rising edge if (state) @@ -83,7 +88,7 @@ void galpanic_state::screen_eof_galpanic(screen_device &screen, bool state) } } -TIMER_DEVICE_CALLBACK_MEMBER(galpanic_state::galpanic_scanline) +TIMER_DEVICE_CALLBACK_MEMBER(galpanic_state::scanline) { int scanline = param; @@ -98,13 +103,11 @@ TIMER_DEVICE_CALLBACK_MEMBER(galpanic_state::galpanic_scanline) -WRITE16_MEMBER(galpanic_state::galpanic_6295_bankswitch_w) +WRITE16_MEMBER(galpanic_state::m6295_bankswitch_w) { if (ACCESSING_BITS_8_15) { - UINT8 *rom = memregion("oki")->base(); - - memcpy(&rom[0x30000],&rom[0x40000 + ((data >> 8) & 0x0f) * 0x10000],0x10000); + membank("okibank")->set_entry((data >> 8) & 0x0f); // used before title screen m_pandora->set_clear_bitmap((data & 0x8000)>>15); @@ -113,7 +116,7 @@ WRITE16_MEMBER(galpanic_state::galpanic_6295_bankswitch_w) -WRITE16_MEMBER(galpanic_state::galpanic_coin_w) +WRITE16_MEMBER(galpanic_state::coin_w) { if (ACCESSING_BITS_8_15) { @@ -131,15 +134,15 @@ static ADDRESS_MAP_START( galpanic_map, AS_PROGRAM, 16, galpanic_state ) AM_RANGE(0x000000, 0x3fffff) AM_ROM AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_SHARE("fgvideoram") - AM_RANGE(0x520000, 0x53ffff) AM_RAM_WRITE(galpanic_bgvideoram_w) AM_SHARE("bgvideoram") /* + work RAM */ + AM_RANGE(0x520000, 0x53ffff) AM_RAM_WRITE(bgvideoram_w) AM_SHARE("bgvideoram") /* + work RAM */ AM_RANGE(0x600000, 0x6007ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") /* 1024 colors, but only 512 seem to be used */ AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE("pandora", kaneko_pandora_device, spriteram_LSB_r, spriteram_LSB_w) AM_RANGE(0x702000, 0x704fff) AM_RAM AM_RANGE(0x800000, 0x800001) AM_READ_PORT("DSW1") AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2") AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM") - AM_RANGE(0x900000, 0x900001) AM_WRITE(galpanic_6295_bankswitch_w) - AM_RANGE(0xa00000, 0xa00001) AM_WRITE(galpanic_coin_w) /* coin counters */ + AM_RANGE(0x900000, 0x900001) AM_WRITE(m6295_bankswitch_w) + AM_RANGE(0xa00000, 0xa00001) AM_WRITE(coin_w) /* coin counters */ AM_RANGE(0xb00000, 0xb00001) AM_WRITENOP /* ??? */ AM_RANGE(0xc00000, 0xc00001) AM_WRITENOP /* ??? */ AM_RANGE(0xd00000, 0xd00001) AM_WRITENOP /* ??? */ @@ -147,6 +150,10 @@ static ADDRESS_MAP_START( galpanic_map, AS_PROGRAM, 16, galpanic_state ) ADDRESS_MAP_END +static ADDRESS_MAP_START( galpanic_oki_map, AS_0, 8, galpanic_state ) + AM_RANGE(0x00000, 0x2ffff) AM_ROM + AM_RANGE(0x30000, 0x3ffff) AM_ROMBANK("okibank") +ADDRESS_MAP_END static INPUT_PORTS_START( galpanic ) @@ -221,7 +228,7 @@ static MACHINE_CONFIG_START( galpanic, galpanic_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(galpanic_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", galpanic_state, galpanic_scanline, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", galpanic_state, scanline, "screen", 0, 1) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -229,8 +236,8 @@ static MACHINE_CONFIG_START( galpanic, galpanic_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0) /* frames per second, vblank duration */) MCFG_SCREEN_SIZE(256, 256) MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 224-1) - MCFG_SCREEN_UPDATE_DRIVER(galpanic_state, screen_update_galpanic) - MCFG_SCREEN_VBLANK_DRIVER(galpanic_state, screen_eof_galpanic) + MCFG_SCREEN_UPDATE_DRIVER(galpanic_state, screen_update) + MCFG_SCREEN_VBLANK_DRIVER(galpanic_state, screen_eof) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", galpanic) @@ -246,12 +253,11 @@ static MACHINE_CONFIG_START( galpanic, galpanic_state ) MCFG_DEVICE_ADD("calc1_mcu", KANEKO_HIT, 0) kaneko_hit_device::set_type(*device, 0); - MCFG_VIDEO_START_OVERRIDE(galpanic_state,galpanic) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_OKIM6295_ADD("oki", XTAL_12MHz/6, OKIM6295_PIN7_LOW) /* verified on pcb */ + MCFG_DEVICE_ADDRESS_MAP(AS_0, galpanic_oki_map) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END @@ -287,11 +293,10 @@ ROM_START( galpanic ) /* PAMERA-04 PCB with the PAMERA-SUB daughter card and unp ROM_REGION( 0x100000, "gfx1", 0 ) /* sprites */ ROM_LOAD( "pm006e.67", 0x000000, 0x100000, CRC(57aec037) SHA1(e6ba095b6892d4dcd76ba3343a97dd98ae29dc24) ) - ROM_REGION( 0x140000, "oki", 0 ) /* OKIM6295 samples */ + ROM_REGION( 0x100000, "oki", 0 ) /* OKIM6295 samples */ /* 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs */ ROM_LOAD( "pm008e.l", 0x00000, 0x80000, CRC(d9379ba8) SHA1(5ae7c743319b1a12f2b101a9f0f8fe0728ed1476) ) - ROM_RELOAD( 0x40000, 0x80000 ) - ROM_LOAD( "pm007e.u", 0xc0000, 0x80000, CRC(c7ed7950) SHA1(133258b058d3c562208d0d00b9fac71202647c32) ) + ROM_LOAD( "pm007e.u", 0x80000, 0x80000, CRC(c7ed7950) SHA1(133258b058d3c562208d0d00b9fac71202647c32) ) ROM_END ROM_START( galpanica ) /* PAMERA-04 PCB with the CALC1 MCU used */ @@ -308,12 +313,11 @@ ROM_START( galpanica ) /* PAMERA-04 PCB with the CALC1 MCU used */ ROM_REGION( 0x100000, "gfx1", 0 ) /* sprites */ ROM_LOAD( "pm006e.67", 0x000000, 0x100000, CRC(57aec037) SHA1(e6ba095b6892d4dcd76ba3343a97dd98ae29dc24) ) - ROM_REGION( 0x140000, "oki", 0 ) /* OKIM6295 samples */ + ROM_REGION( 0x100000, "oki", 0 ) /* OKIM6295 samples */ /* 00000-2ffff is fixed, 30000-3ffff is bank switched from all the ROMs */ ROM_LOAD( "pm008e.l", 0x00000, 0x80000, CRC(d9379ba8) SHA1(5ae7c743319b1a12f2b101a9f0f8fe0728ed1476) ) - ROM_RELOAD( 0x40000, 0x80000 ) - ROM_LOAD( "pm007e.u", 0xc0000, 0x80000, CRC(c7ed7950) SHA1(133258b058d3c562208d0d00b9fac71202647c32) ) + ROM_LOAD( "pm007e.u", 0x80000, 0x80000, CRC(c7ed7950) SHA1(133258b058d3c562208d0d00b9fac71202647c32) ) ROM_END -GAME( 1990, galpanic, 0, galpanic, galpanic, driver_device, 0, ROT90, "Kaneko", "Gals Panic (Unprotected)", MACHINE_NO_COCKTAIL ) -GAME( 1990, galpanica,galpanic, galpanica,galpanica, driver_device, 0, ROT90, "Kaneko", "Gals Panic (MCU Protected)", MACHINE_NO_COCKTAIL ) +GAME( 1990, galpanic, 0, galpanic, galpanic, driver_device, 0, ROT90, "Kaneko", "Gals Panic (Unprotected)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +GAME( 1990, galpanica,galpanic, galpanica,galpanica, driver_device, 0, ROT90, "Kaneko", "Gals Panic (MCU Protected)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/galpanic.h b/src/mame/includes/galpanic.h index 788ca087540..0ab503e6742 100644 --- a/src/mame/includes/galpanic.h +++ b/src/mame/includes/galpanic.h @@ -10,7 +10,6 @@ public: m_maincpu(*this, "maincpu"), m_bgvideoram(*this, "bgvideoram"), m_fgvideoram(*this, "fgvideoram"), - m_spriteram(*this, "spriteram"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), @@ -20,23 +19,23 @@ public: required_device m_maincpu; required_shared_ptr m_bgvideoram; required_shared_ptr m_fgvideoram; - bitmap_ind16 m_bitmap; - bitmap_ind16 m_sprites_bitmap; - optional_shared_ptr m_spriteram; required_device m_gfxdecode; required_device m_screen; required_device m_palette; required_device m_pandora; - DECLARE_WRITE16_MEMBER(galpanic_6295_bankswitch_w); - DECLARE_WRITE16_MEMBER(galpanic_coin_w); + bitmap_ind16 m_bitmap; + + DECLARE_WRITE16_MEMBER(m6295_bankswitch_w); + DECLARE_WRITE16_MEMBER(coin_w); + DECLARE_WRITE16_MEMBER(bgvideoram_w); - DECLARE_VIDEO_START(galpanic); + virtual void machine_start() override; + virtual void video_start() override; DECLARE_PALETTE_INIT(galpanic); - UINT32 screen_update_galpanic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void screen_eof_galpanic(screen_device &screen, bool state); - TIMER_DEVICE_CALLBACK_MEMBER(galpanic_scanline); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void screen_eof(screen_device &screen, bool state); + TIMER_DEVICE_CALLBACK_MEMBER(scanline); void draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); - /*----------- defined in video/galpanic.c -----------*/ - DECLARE_WRITE16_MEMBER( galpanic_bgvideoram_w ); }; diff --git a/src/mame/video/galpanic.cpp b/src/mame/video/galpanic.cpp index 487a22aeefb..cf33cb88bdd 100644 --- a/src/mame/video/galpanic.cpp +++ b/src/mame/video/galpanic.cpp @@ -5,52 +5,45 @@ #include "includes/galpanic.h" -VIDEO_START_MEMBER(galpanic_state,galpanic) +void galpanic_state::video_start() { m_screen->register_screen_bitmap(m_bitmap); + + save_item(NAME(m_bitmap)); } PALETTE_INIT_MEMBER(galpanic_state,galpanic) { - int i; - /* first 1024 colors are dynamic */ /* initialize 555 RGB lookup */ - for (i = 0;i < 32768;i++) + for (int i = 0;i < 32768;i++) palette.set_pen_color(i+1024,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0)); } -WRITE16_MEMBER(galpanic_state::galpanic_bgvideoram_w) +WRITE16_MEMBER(galpanic_state::bgvideoram_w) { - int sx,sy; - - data = COMBINE_DATA(&m_bgvideoram[offset]); - sy = offset / 256; - sx = offset % 256; + int sy = offset / 256; + int sx = offset % 256; m_bitmap.pix16(sy, sx) = 1024 + (data >> 1); } void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs; - - for (offs = 0;offs < m_fgvideoram.bytes()/2;offs++) + for (int offs = 0;offs < m_fgvideoram.bytes()/2;offs++) { - int sx,sy,color; - - sx = offs % 256; - sy = offs / 256; - color = m_fgvideoram[offs]; + int sx = offs % 256; + int sy = offs / 256; + int color = m_fgvideoram[offs]; if (color) bitmap.pix16(sy, sx) = color; } } -UINT32 galpanic_state::screen_update_galpanic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 galpanic_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* copy the temporary bitmap to the screen */ copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect); -- cgit v1.2.3-70-g09d2 From a30effe1a79085a0327da54c9774acfacccc1e69 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Sat, 13 Feb 2016 12:45:39 +0100 Subject: Amiga: Fixed expansion port interrupts, DMAC WIP --- src/devices/bus/amiga/zorro/zorro.h | 4 +++- src/devices/machine/dmac.cpp | 39 ++++++++++++++++++++----------------- src/devices/machine/dmac.h | 2 +- src/mame/drivers/amiga.cpp | 17 ++++++++++++++++ 4 files changed, 42 insertions(+), 20 deletions(-) diff --git a/src/devices/bus/amiga/zorro/zorro.h b/src/devices/bus/amiga/zorro/zorro.h index fb14b7f09ca..7a37e334ada 100644 --- a/src/devices/bus/amiga/zorro/zorro.h +++ b/src/devices/bus/amiga/zorro/zorro.h @@ -166,8 +166,10 @@ #define MCFG_EXPANSION_SLOT_ADD(_cputag, _slot_intf, _def_slot) \ MCFG_DEVICE_ADD(EXP_SLOT_TAG, EXP_SLOT, 0) \ + device_t *temp = device; \ zorro_device::set_cputag(*device, _cputag); \ - MCFG_ZORRO_SLOT_ADD(EXP_SLOT_TAG, "slot", _slot_intf, _def_slot) + MCFG_ZORRO_SLOT_ADD(EXP_SLOT_TAG, "slot", _slot_intf, _def_slot) \ + device = temp; // callbacks #define MCFG_EXPANSION_SLOT_OVR_HANDLER(_devcb) \ diff --git a/src/devices/machine/dmac.cpp b/src/devices/machine/dmac.cpp index 34992fc4f5c..ba1167eb2d5 100644 --- a/src/devices/machine/dmac.cpp +++ b/src/devices/machine/dmac.cpp @@ -145,6 +145,8 @@ void dmac_device::check_interrupts() // any interrupts pending? if (m_istr & ISTR_INT_MASK) m_istr |= ISTR_INT_P; + else + m_istr &= ~ISTR_INT_P; } else m_istr &= ~ISTR_INT_P; @@ -202,18 +204,19 @@ READ16_MEMBER( dmac_device::register_read ) case 0x48: case 0x49: - case 0x50: - case 0x58: - case 0x59: - case 0x5a: - case 0x5b: - case 0x5c: - case 0x5e: - case 0x5f: data = m_scsi_read_handler(offset); if (VERBOSE) - logerror("%s('%s'): read scsi data @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); + logerror("%s('%s'): read scsi register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); + + break; + + case 0x50: + case 0x51: + case 0x52: + case 0x53: + if (VERBOSE) + logerror("%s('%s'): read xt register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); break; @@ -306,20 +309,20 @@ WRITE16_MEMBER( dmac_device::register_write ) case 0x48: case 0x49: - case 0x50: - case 0x58: - case 0x59: - case 0x5a: - case 0x5b: - case 0x5c: - case 0x5e: - case 0x5f: if (VERBOSE) - logerror("%s('%s'): write scsi data @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); + logerror("%s('%s'): write scsi register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); m_scsi_write_handler(offset, data, 0xff); break; + case 0x50: + case 0x51: + case 0x52: + case 0x53: + if (VERBOSE) + logerror("%s('%s'): write xt register @ %02x %04x [mask = %04x]\n", shortname(), basetag(), offset, data, mem_mask); + break; + case 0x70: if (VERBOSE) logerror("%s('%s'): write dma start strobe %04x [mask = %04x]\n", shortname(), basetag(), data, mem_mask); diff --git a/src/devices/machine/dmac.h b/src/devices/machine/dmac.h index 2d86c427013..8580b4c86ab 100644 --- a/src/devices/machine/dmac.h +++ b/src/devices/machine/dmac.h @@ -128,7 +128,7 @@ private: ISTR_FE_FLG = 0x001 // fifo-empty flag }; - static const int ISTR_INT_MASK = 0x1fc; + static const int ISTR_INT_MASK = 0x1ec; // callbacks devcb_write_line m_cfgout_handler; diff --git a/src/mame/drivers/amiga.cpp b/src/mame/drivers/amiga.cpp index edca3b6b9b9..f89e0536569 100644 --- a/src/mame/drivers/amiga.cpp +++ b/src/mame/drivers/amiga.cpp @@ -103,6 +103,9 @@ public: DECLARE_DRIVER_INIT( pal ); DECLARE_DRIVER_INIT( ntsc ); + DECLARE_WRITE_LINE_MEMBER( side_int2_w ); + DECLARE_WRITE_LINE_MEMBER( side_int6_w ); + protected: virtual void machine_reset() override; @@ -616,6 +619,18 @@ void a500_state::machine_reset() m_side->reset(); } +WRITE_LINE_MEMBER( a500_state::side_int2_w ) +{ + m_side_int2 = state; + update_int2(); +} + +WRITE_LINE_MEMBER( a500_state::side_int6_w ) +{ + m_side_int6 = state; + update_int6(); +} + bool a500_state::int2_pending() { return m_cia_0_irq || m_side_int2; @@ -1457,6 +1472,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( a500, amiga_base, a500_state ) // cpu slot MCFG_EXPANSION_SLOT_ADD("maincpu", a500_expansion_cards, nullptr) + MCFG_EXPANSION_SLOT_INT2_HANDLER(WRITELINE(a500_state, side_int2_w)) + MCFG_EXPANSION_SLOT_INT6_HANDLER(WRITELINE(a500_state, side_int6_w)) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED_CLASS( a500n, a500, a500_state ) -- cgit v1.2.3-70-g09d2 From 3b0e77d746511a50a6f3135de68f4c9bc79ca8b6 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Sat, 13 Feb 2016 13:12:16 +0100 Subject: ram device: switch to bsd3 by request --- src/devices/machine/ram.cpp | 13 ++----------- src/devices/machine/ram.h | 4 ++-- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/devices/machine/ram.cpp b/src/devices/machine/ram.cpp index 92728b55303..7dd8f9250a4 100644 --- a/src/devices/machine/ram.cpp +++ b/src/devices/machine/ram.cpp @@ -1,5 +1,5 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best +// license: BSD-3-Clause +// copyright-holders: Dirk Best /************************************************************************* RAM device @@ -23,8 +23,6 @@ // device type definition const device_type RAM = &device_creator; - - //------------------------------------------------- // ram_device - constructor //------------------------------------------------- @@ -38,8 +36,6 @@ ram_device::ram_device(const machine_config &mconfig, const char *tag, device_t m_default_value = 0xCD; } - - //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -68,7 +64,6 @@ void ram_device::device_start() save_item(NAME(m_pointer)); } - //------------------------------------------------- // device_validity_check - device-specific validity // checks @@ -171,8 +166,6 @@ void ram_device::device_validity_check(validity_checker &valid) const } } - - //------------------------------------------------- // parse_string - convert a ram string to an // integer value @@ -210,8 +203,6 @@ UINT32 ram_device::parse_string(const char *s) return ram; } - - //------------------------------------------------- // default_size //------------------------------------------------- diff --git a/src/devices/machine/ram.h b/src/devices/machine/ram.h index 7d3f054895f..5140309f825 100644 --- a/src/devices/machine/ram.h +++ b/src/devices/machine/ram.h @@ -1,5 +1,5 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best +// license: BSD-3-Clause +// copyright-holders: Dirk Best /************************************************************************* RAM device -- cgit v1.2.3-70-g09d2 From 9599b015a7720c290e8538703779f1f5fbc519bb Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Sat, 13 Feb 2016 17:38:17 +0100 Subject: fixed crash clicking on the DATs icon in the toolbar if there is no info available. --- src/emu/ui/selgame.cpp | 4 ++-- src/emu/ui/selsoft.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 0945c6a4fda..592e24ebb41 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -377,13 +377,13 @@ void ui_menu_select_game::handle() if (!isfavorite()) { const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 3) + if ((FPTR)driver > 3 && machine().datfile().has_data(driver)) ui_menu::stack_push(global_alloc_clear(machine(), container, driver)); } else { ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 3) + if ((FPTR)swinfo > 3 && machine().datfile().has_data(swinfo->driver)) { if (swinfo->startempty == 1) ui_menu::stack_push(global_alloc_clear(machine(), container, swinfo->driver)); diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index 95a113189cd..d5697c3ba03 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -216,7 +216,7 @@ void ui_menu_select_software::handle() { ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)ui_swinfo > 1) + if ((FPTR)ui_swinfo > 1 && machine().datfile().has_data(ui_swinfo->driver)) { if (ui_swinfo->startempty == 1) ui_menu::stack_push(global_alloc_clear(machine(), container, ui_swinfo->driver)); -- cgit v1.2.3-70-g09d2 From 79b177fd486c3be11ed75fd1156e1b1bacf73a6b Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 13 Feb 2016 12:45:18 -0500 Subject: apple1: add save state support to new driver [R. Belmont] --- src/mame/drivers/apple1.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/apple1.cpp b/src/mame/drivers/apple1.cpp index 65e2d0604e1..881209946ff 100644 --- a/src/mame/drivers/apple1.cpp +++ b/src/mame/drivers/apple1.cpp @@ -387,6 +387,15 @@ void apple1_state::machine_start() m_ready_start_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple1_state::ready_start_cb), this)); m_ready_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple1_state::ready_end_cb), this)); m_kbd_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple1_state::keyboard_strobe_cb), this)); + + // setup save states + save_item(NAME(m_vram)); + save_item(NAME(m_cursx)); + save_item(NAME(m_cursy)); + save_item(NAME(m_reset_down)); + save_item(NAME(m_clear_down)); + save_item(NAME(m_transchar)); + save_item(NAME(m_lastports)); } void apple1_state::machine_reset() @@ -614,5 +623,5 @@ ROM_START(apple1) ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME */ -COMP( 1976, apple1, 0, 0, apple1, apple1, driver_device, 0, "Apple Computer", "Apple I", MACHINE_NO_SOUND_HW ) +COMP( 1976, apple1, 0, 0, apple1, apple1, driver_device, 0, "Apple Computer", "Apple I", MACHINE_NO_SOUND_HW | MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From 244c9ce07acbccc72be2a87372220e5193b33ee8 Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 13 Feb 2016 13:14:27 -0500 Subject: New machines added or promoted from NOT_WORKING status - Apple IIe (Spanish) [robcfg, R. Belmont] --- src/mame/drivers/apple2e.cpp | 135 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index 99bc10dc341..8cf7052f829 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -2901,6 +2901,128 @@ static INPUT_PORTS_START( apple2euk ) PORT_INCLUDE(apple2_sysconfig) INPUT_PORTS_END +static INPUT_PORTS_START( apple2ees ) + PORT_START("X0") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xa3) // a3 is Unicode for the pound sign + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START("X1") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("X2") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0xf1) PORT_CHAR(0xf1) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + + PORT_START("X3") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') + + PORT_START("X4") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('`') PORT_CHAR(0xbf) // inverted question mark + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('\'') PORT_CHAR('?') + + PORT_START("X5") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('~') PORT_CHAR('^') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*') + + PORT_START("X6") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0xc7) PORT_CHAR(0xa1) // c with cedilla / inverted exclamation point + + PORT_START("X7") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE)PORT_CHAR(8) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + + PORT_START("X8") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyb_special") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) + + PORT_INCLUDE( apple2_gameport ) + PORT_INCLUDE(apple2_sysconfig) +INPUT_PORTS_END + INPUT_PORTS_START( apple2ep ) PORT_START("X0") PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) @@ -3433,6 +3555,18 @@ ROM_START(apple2euk) ROM_LOAD( "341-0150-a.e12", 0x000, 0x800, CRC(66ffacd7) SHA1(47bb9608be38ff75429a989b930a93b47099648e) ) ROM_END +ROM_START(apple2ees) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD( "341-0212-a.e9", 0x000000, 0x002000, CRC(bc5575ef) SHA1(aa20c257255ef552295d32a3f56ccbb52b8716c3) ) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD ( "342-0135-b.64", 0x0000, 0x2000, CRC(e248835e) SHA1(523838c19c79f481fa02df56856da1ec3816d16e)) + ROM_LOAD ( "342-0134-a.64", 0x2000, 0x2000, CRC(fc3d59d8) SHA1(8895a4b703f2184b673078f411f4089889b61c54)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "341-0211-a.f12", 0x000000, 0x000800, CRC(fac15d54) SHA1(abe019de22641b0647e829a1d4745759bdffe86a) ) +ROM_END + ROM_START(mprof3) ROM_REGION(0x2000,"gfx1",0) ROM_LOAD ( "mpf3.chr", 0x0000, 0x1000,CRC(2597bc19) SHA1(e114dcbb512ec24fb457248c1b53cbd78039ed20)) @@ -3613,6 +3747,7 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ COMP( 1983, apple2e, 0, apple2, apple2e, apple2e, driver_device, 0, "Apple Computer", "Apple //e", MACHINE_SUPPORTS_SAVE ) COMP( 1983, apple2euk,apple2e, 0, apple2e, apple2euk,driver_device, 0, "Apple Computer", "Apple //e (UK)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, apple2ees,apple2e, 0, apple2e, apple2ees,driver_device, 0, "Apple Computer", "Apple //e (Spain)", MACHINE_SUPPORTS_SAVE ) COMP( 1983, mprof3, apple2e, 0, mprof3, apple2e, driver_device, 0, "Multitech", "Microprofessor III", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) COMP( 1985, apple2ee, apple2e, 0, apple2ee, apple2e, driver_device, 0, "Apple Computer", "Apple //e (enhanced)", MACHINE_SUPPORTS_SAVE ) COMP( 1985, apple2eeuk,apple2e, 0, apple2ee, apple2euk, driver_device,0, "Apple Computer", "Apple //e (enhanced, UK)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From fda5edee96106f725b3b1c4824c1e6c72349a7b4 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Sat, 13 Feb 2016 15:46:05 -0300 Subject: New clones added or promoted from NOT_WORKING status ---------------------------------------------------- Space Rocks (Spanish clone of Asteroids) [pako ikarihardmods] --- src/mame/arcade.lst | 1 + src/mame/drivers/asteroid.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 0a2733bd867..e3e49058ee2 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -7226,6 +7226,7 @@ asteroid // 035127-035145 (c) 1979 asteroid2 // 035127-035145 (c) 1979 asteroid1 // 035127-035145 no copyright notice asteroidb // (bootleg) +spcrocks // J.Estevez (c) 1981 aerolitos // Rodmar Elec. bootleg asterock // Sidam bootleg (c) 1979 asterockv // Videotron bootleg(c) 1979 diff --git a/src/mame/drivers/asteroid.cpp b/src/mame/drivers/asteroid.cpp index fc1d88c7169..fbaf3ba8be5 100644 --- a/src/mame/drivers/asteroid.cpp +++ b/src/mame/drivers/asteroid.cpp @@ -772,6 +772,23 @@ ROM_START( asteroidb ) ROM_LOAD( "034602-01.c8", 0x0000, 0x0100, CRC(97953db8) SHA1(8cbded64d1dd35b18c4d5cece00f77e7b2cab2ad) ) ROM_END +/* Space Rocks (J.Estevez, Barcelona). + Seems to be a legit spanish set, since there are documented cabs + registered in Spain. +*/ +ROM_START( spcrocks ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "1.bin", 0x6800, 0x0800, CRC(0cc75459) SHA1(2af85c9689b878155004da47fedbde5853a18723) ) + ROM_LOAD( "2.bin", 0x7000, 0x0800, CRC(096ed35c) SHA1(064d680ded7f30c543f93ae5ca85f90d550f73e5) ) + ROM_LOAD( "3.bin", 0x7800, 0x0800, CRC(b912754d) SHA1(d4ada3e162ff454a48468f6309947276df0c5331) ) + /* Vector ROM */ + ROM_LOAD( "e.bin", 0x5000, 0x0800, CRC(148ef465) SHA1(4b1158112364bc55b8aab4127949f9238c36b238) ) + + /* DVG PROM */ + ROM_REGION( 0x100, "user1", 0 ) + ROM_LOAD( "034602-01.c8", 0x0000, 0x0100, CRC(97953db8) SHA1(8cbded64d1dd35b18c4d5cece00f77e7b2cab2ad) ) +ROM_END + ROM_START( aerolitos ) ROM_REGION( 0x8000, "maincpu", 0 ) ROM_LOAD( "2516_1e.bin", 0x6800, 0x0800, CRC(0cc75459) SHA1(2af85c9689b878155004da47fedbde5853a18723) ) @@ -1023,6 +1040,7 @@ GAME( 1979, asteroid, 0, asteroid, asteroid, driver_device, 0, GAME( 1979, asteroid2, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "Atari", "Asteroids (rev 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1979, asteroid1, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "Atari", "Asteroids (rev 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1979, asteroidb, asteroid, asteroid, asteroidb, asteroid_state, asteroidb, ROT0, "bootleg", "Asteroids (bootleg on Lunar Lander hardware)", MACHINE_SUPPORTS_SAVE ) +GAME( 1981, spcrocks, asteroid, asteroid, aerolitos, driver_device, 0, ROT0, "J.Estevez (Barcelona)", "Space Rocks (Spanish clone of Asteroids)", MACHINE_SUPPORTS_SAVE ) // Space Rocks seems to be a legit set. Cabinet registered to 'J.Estevez (Barcelona). GAME( 1980, aerolitos, asteroid, asteroid, aerolitos, driver_device, 0, ROT0, "bootleg (Rodmar Elec.)","Aerolitos (Spanish bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) // 'Aerolitos' appears on the cabinet, this was distributed in Spain, the Spanish text is different to that contained in the original version (corrected) GAME( 1979, asterock, asteroid, asterock, asterock, asteroid_state, asterock, ROT0, "bootleg (Sidam)", "Asterock (Sidam bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) GAME( 1979, asterockv, asteroid, asterock, asterock, asteroid_state, asterock, ROT0, "bootleg (Videotron)", "Asterock (Videotron bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From f5e8c864c200c131e2e708643219f446234a4dff Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 13 Feb 2016 19:54:01 +0100 Subject: fix issue with SOURCES=src/mame/drivers/namcops2.cpp (nw) --- scripts/build/makedep.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/build/makedep.py b/scripts/build/makedep.py index eba69370621..88035d776af 100644 --- a/scripts/build/makedep.py +++ b/scripts/build/makedep.py @@ -204,7 +204,9 @@ def parse_file_for_drivers(root, srcfile): if len(content)>0: if content.startswith('COMP') or content.startswith('CONS') or content.startswith('GAME') or content.startswith('SYST') or content.startswith('GAMEL'): name = content[4:] - drivers.append(name.rsplit(',', 14)[1]) + splitname = name.rsplit(',', 14) + if len(splitname)>1: + drivers.append(splitname[1]) return 0 def parse_lua_file(srcfile): -- cgit v1.2.3-70-g09d2 From c62ba64a5028055f4bff0bd8c840bcdb16fa08d6 Mon Sep 17 00:00:00 2001 From: Wilbert Pol Date: Sat, 13 Feb 2016 20:16:10 +0100 Subject: commented out unused member; fixes clang build (nw) --- src/emu/ui/mainmenu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emu/ui/mainmenu.h b/src/emu/ui/mainmenu.h index 59c937d853f..0684e230ad8 100644 --- a/src/emu/ui/mainmenu.h +++ b/src/emu/ui/mainmenu.h @@ -52,7 +52,7 @@ private: QUIT_GAME }; - bool submenu; + //bool submenu; }; #endif /* __UI_MAINMENU_H__ */ -- cgit v1.2.3-70-g09d2 From 3276c835c93c354072010fd9b12b2c421d4e24f2 Mon Sep 17 00:00:00 2001 From: Kevin Eshbach Date: Sat, 13 Feb 2016 15:01:27 -0500 Subject: Removing files that were moved to the Opal_Jr directory --- regtests/jedutil/eqns/pal10l8/pal10l8.eqn | 0 regtests/jedutil/eqns/pal12h6/pal12h6.eqn | 0 regtests/jedutil/eqns/pal12l6/pal12l6.eqn | 0 regtests/jedutil/eqns/pal14h4/pal14h4.eqn | 0 regtests/jedutil/eqns/pal14l4/pal14l4.eqn | 0 regtests/jedutil/eqns/pal16c1/pal16c1.eqn | 0 regtests/jedutil/eqns/pal16h2/pal16h2.eqn | 0 regtests/jedutil/eqns/pal16l2/pal16l2.eqn | 0 regtests/jedutil/eqns/pal16l8/pal16l8.eqn | 0 regtests/jedutil/eqns/pal16r4/pal16r4.eqn | 0 regtests/jedutil/eqns/pal16r6/pal16r6.eqn | 0 regtests/jedutil/eqns/pal16r8/pal16r8.eqn | 0 regtests/jedutil/eqns/pal20l10/pal20l10.eqn | 0 regtests/jedutil/eqns/pal20l8/pal20l8.eqn | 0 regtests/jedutil/eqns/pal20r4/pal20r4.eqn | 0 regtests/jedutil/eqns/pal20r6/pal20r6.eqn | 0 regtests/jedutil/eqns/pal20r8/pal20r8.eqn | 0 regtests/jedutil/eqns/readme.txt | 0 18 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 regtests/jedutil/eqns/pal10l8/pal10l8.eqn delete mode 100644 regtests/jedutil/eqns/pal12h6/pal12h6.eqn delete mode 100644 regtests/jedutil/eqns/pal12l6/pal12l6.eqn delete mode 100644 regtests/jedutil/eqns/pal14h4/pal14h4.eqn delete mode 100644 regtests/jedutil/eqns/pal14l4/pal14l4.eqn delete mode 100644 regtests/jedutil/eqns/pal16c1/pal16c1.eqn delete mode 100644 regtests/jedutil/eqns/pal16h2/pal16h2.eqn delete mode 100644 regtests/jedutil/eqns/pal16l2/pal16l2.eqn delete mode 100644 regtests/jedutil/eqns/pal16l8/pal16l8.eqn delete mode 100644 regtests/jedutil/eqns/pal16r4/pal16r4.eqn delete mode 100644 regtests/jedutil/eqns/pal16r6/pal16r6.eqn delete mode 100644 regtests/jedutil/eqns/pal16r8/pal16r8.eqn delete mode 100644 regtests/jedutil/eqns/pal20l10/pal20l10.eqn delete mode 100644 regtests/jedutil/eqns/pal20l8/pal20l8.eqn delete mode 100644 regtests/jedutil/eqns/pal20r4/pal20r4.eqn delete mode 100644 regtests/jedutil/eqns/pal20r6/pal20r6.eqn delete mode 100644 regtests/jedutil/eqns/pal20r8/pal20r8.eqn delete mode 100644 regtests/jedutil/eqns/readme.txt diff --git a/regtests/jedutil/eqns/pal10l8/pal10l8.eqn b/regtests/jedutil/eqns/pal10l8/pal10l8.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal12h6/pal12h6.eqn b/regtests/jedutil/eqns/pal12h6/pal12h6.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal12l6/pal12l6.eqn b/regtests/jedutil/eqns/pal12l6/pal12l6.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal14h4/pal14h4.eqn b/regtests/jedutil/eqns/pal14h4/pal14h4.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal14l4/pal14l4.eqn b/regtests/jedutil/eqns/pal14l4/pal14l4.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal16c1/pal16c1.eqn b/regtests/jedutil/eqns/pal16c1/pal16c1.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal16h2/pal16h2.eqn b/regtests/jedutil/eqns/pal16h2/pal16h2.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal16l2/pal16l2.eqn b/regtests/jedutil/eqns/pal16l2/pal16l2.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal16l8/pal16l8.eqn b/regtests/jedutil/eqns/pal16l8/pal16l8.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal16r4/pal16r4.eqn b/regtests/jedutil/eqns/pal16r4/pal16r4.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal16r6/pal16r6.eqn b/regtests/jedutil/eqns/pal16r6/pal16r6.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal16r8/pal16r8.eqn b/regtests/jedutil/eqns/pal16r8/pal16r8.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal20l10/pal20l10.eqn b/regtests/jedutil/eqns/pal20l10/pal20l10.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal20l8/pal20l8.eqn b/regtests/jedutil/eqns/pal20l8/pal20l8.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal20r4/pal20r4.eqn b/regtests/jedutil/eqns/pal20r4/pal20r4.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal20r6/pal20r6.eqn b/regtests/jedutil/eqns/pal20r6/pal20r6.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/pal20r8/pal20r8.eqn b/regtests/jedutil/eqns/pal20r8/pal20r8.eqn deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/regtests/jedutil/eqns/readme.txt b/regtests/jedutil/eqns/readme.txt deleted file mode 100644 index e69de29bb2d..00000000000 -- cgit v1.2.3-70-g09d2 From 00aec891925e530ced84f63a04aefaf0a4631582 Mon Sep 17 00:00:00 2001 From: Michele Fochi Date: Sat, 13 Feb 2016 20:41:19 +0100 Subject: Added support for autofire under cheat menu and available only if cheats activated. --- src/emu/inpttype.h | 1 + src/emu/ioport.cpp | 23 ++++- src/emu/ioport.h | 14 +++ src/emu/ui/cheatopt.cpp | 220 +++++++++++++++++++++++++++++++++++++++++++++--- src/emu/ui/cheatopt.h | 25 ++++++ src/emu/ui/mainmenu.cpp | 2 +- src/emu/ui/ui.cpp | 15 ++++ 7 files changed, 284 insertions(+), 16 deletions(-) diff --git a/src/emu/inpttype.h b/src/emu/inpttype.h index 96395a60e7c..4d711e4d676 100644 --- a/src/emu/inpttype.h +++ b/src/emu/inpttype.h @@ -730,6 +730,7 @@ void construct_core_types_UI(simple_list &typelist) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TIMECODE, "Write current timecode", input_seq(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RECORD_MOVIE, "Record Movie", input_seq(KEYCODE_F12, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TOGGLE_CHEAT, "Toggle Cheat", input_seq(KEYCODE_F6) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TOGGLE_AUTOFIRE, "Toggle Autofire", input_seq() ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP, "UI Up", input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN, "UI Down", input_seq(KEYCODE_DOWN, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0)) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LEFT, "UI Left", input_seq(KEYCODE_LEFT, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(0)) ) diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index ec88792df12..17e11748df1 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -1699,6 +1699,7 @@ void ioport_field::get_user_settings(user_settings &settings) else { settings.toggle = m_live->toggle; + settings.autofire = m_live->autofire; } } @@ -1737,6 +1738,7 @@ void ioport_field::set_user_settings(const user_settings &settings) else { m_live->toggle = settings.toggle; + m_live->autofire = settings.autofire; } } @@ -1904,6 +1906,19 @@ void ioport_field::frame_update(ioport_value &result, bool mouse_down) // if the state changed, look for switch down/switch up bool curstate = mouse_down || machine().input().seq_pressed(seq()) || m_digital_value; + if (m_live->autofire && !machine().ioport().get_autofire_toggle()) + { + if (curstate) + { + if (m_live->autopressed > machine().ioport().get_autofire_delay()) + m_live->autopressed = 0; + else if (m_live->autopressed > machine().ioport().get_autofire_delay() / 2) + curstate = false; + m_live->autopressed++; + } + else + m_live->autopressed = 0; + } bool changed = false; if (curstate != m_live->last) { @@ -2156,7 +2171,9 @@ ioport_field_live::ioport_field_live(ioport_field &field, analog_field *analog) impulse(0), last(0), toggle(field.toggle()), - joydir(digital_joystick::JOYDIR_COUNT) + joydir(digital_joystick::JOYDIR_COUNT), + autofire(false), + autopressed(0) { // fill in the basic values for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype) @@ -2460,7 +2477,9 @@ ioport_manager::ioport_manager(running_machine &machine) m_has_configs(false), m_has_analog(false), m_has_dips(false), - m_has_bioses(false) + m_has_bioses(false), + m_autofire_toggle(false), + m_autofire_delay(3) // 1 seems too fast for a bunch of games { memset(m_type_to_entry, 0, sizeof(m_type_to_entry)); } diff --git a/src/emu/ioport.h b/src/emu/ioport.h index d398a8df2c1..6d9d941fa4a 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -382,6 +382,7 @@ enum ioport_type IPT_UI_EXPORT, IPT_UI_AUDIT_FAST, IPT_UI_AUDIT_ALL, + IPT_UI_TOGGLE_AUTOFIRE, // additional OSD-specified UI port types (up to 16) IPT_OSD_1, @@ -1095,6 +1096,7 @@ public: struct user_settings { ioport_value value; // for DIP switches + bool autofire; // for autofire settings input_seq seq[SEQ_TYPE_TOTAL]; // sequences of all types INT32 sensitivity; // for analog controls INT32 delta; // for analog controls @@ -1171,6 +1173,8 @@ struct ioport_field_live bool last; // were we pressed last time? bool toggle; // current toggle setting digital_joystick::direction_t joydir; // digital joystick direction index + bool autofire; // autofire + int autopressed; // autofire status std::string name; // overridden name }; @@ -1413,6 +1417,12 @@ public: ioport_type token_to_input_type(const char *string, int &player) const; std::string input_type_to_token(ioport_type type, int player); + // autofire + bool get_autofire_toggle() { return m_autofire_toggle; } + void set_autofire_toggle(bool toggle) { m_autofire_toggle = toggle; } + int get_autofire_delay() { return m_autofire_delay; } + void set_autofire_delay(int delay) { m_autofire_delay = delay; } + private: // internal helpers void init_port_types(); @@ -1484,6 +1494,10 @@ private: bool m_has_analog; bool m_has_dips; bool m_has_bioses; + + // autofire + bool m_autofire_toggle; // autofire toggle + int m_autofire_delay; // autofire delay }; diff --git a/src/emu/ui/cheatopt.cpp b/src/emu/ui/cheatopt.cpp index 015ccba6908..a2b9ccffd6c 100644 --- a/src/emu/ui/cheatopt.cpp +++ b/src/emu/ui/cheatopt.cpp @@ -24,6 +24,7 @@ void ui_menu_cheat::handle() /* process the menu */ const ui_menu_event *menu_event = process(UI_MENU_PROCESS_LR_REPEAT); + /* handle events */ if (menu_event != nullptr && menu_event->itemref != nullptr) { @@ -33,7 +34,7 @@ void ui_menu_cheat::handle() machine().popmessage(nullptr); /* handle reset all + reset all cheats for reload all option */ - if ((FPTR)menu_event->itemref < 3 && menu_event->iptkey == IPT_UI_SELECT) + if (menu_event->itemref < ITEMREF_CHEATS_FIRST_ITEM && menu_event->iptkey == IPT_UI_SELECT) { for (cheat_entry *curcheat = machine().cheat().first(); curcheat != nullptr; curcheat = curcheat->next()) if (curcheat->select_default_state()) @@ -42,7 +43,7 @@ void ui_menu_cheat::handle() /* handle individual cheats */ - else if ((FPTR)menu_event->itemref > 2) + else if (menu_event->itemref > ITEMREF_CHEATS_FIRST_ITEM) { cheat_entry *curcheat = reinterpret_cast(menu_event->itemref); const char *string; @@ -80,7 +81,7 @@ void ui_menu_cheat::handle() } /* handle reload all */ - if ((FPTR)menu_event->itemref == 2 && menu_event->iptkey == IPT_UI_SELECT) + if (menu_event->itemref == ITEMREF_CHEATS_RELOAD_ALL && menu_event->iptkey == IPT_UI_SELECT) { /* re-init cheat engine and thus reload cheats/cheats have already been turned off by here */ machine().cheat().reload(); @@ -90,6 +91,12 @@ void ui_menu_cheat::handle() machine().popmessage("All cheats reloaded"); } + /* handle autofire menu */ + if (menu_event->itemref == ITEMREF_CHEATS_AUTOFIRE_SETTINGS && menu_event->iptkey == IPT_UI_SELECT) + { + ui_menu::stack_push(global_alloc_clear(machine(), container)); + } + /* if things changed, update */ if (changed) reset(UI_MENU_RESET_REMEMBER_REF); @@ -110,23 +117,210 @@ void ui_menu_cheat::populate() /* iterate over cheats */ std::string text; std::string subtext; - for (cheat_entry *curcheat = machine().cheat().first(); curcheat != nullptr; curcheat = curcheat->next()) - { - UINT32 flags; - curcheat->menu_text(text, subtext, flags); - item_append(text.c_str(), subtext.c_str(), flags, curcheat); - } + + // add the autofire menu + item_append("Autofire Settings", nullptr, 0, (void *)ITEMREF_CHEATS_AUTOFIRE_SETTINGS); /* add a separator */ item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - /* add a reset all option */ - item_append("Reset All", nullptr, 0, (void *)1); + // add other cheats + if (machine().cheat().first() != nullptr) { + for (cheat_entry *curcheat = machine().cheat().first(); curcheat != nullptr; curcheat = curcheat->next()) + { + UINT32 flags; + curcheat->menu_text(text, subtext, flags); + item_append(text.c_str(), subtext.c_str(), flags, curcheat); + } + + /* add a separator */ + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + /* add a reset all option */ + item_append("Reset All", nullptr, 0, (void *)ITEMREF_CHEATS_RESET_ALL); - /* add a reload all cheats option */ - item_append("Reload All", nullptr, 0, (void *)2); + /* add a reload all cheats option */ + item_append("Reload All", nullptr, 0, (void *)ITEMREF_CHEATS_RELOAD_ALL); + } } ui_menu_cheat::~ui_menu_cheat() { } + + + + + +/*------------------------------------------------- + menu_autofire - handle the autofire settings + menu +-------------------------------------------------*/ + +ui_menu_autofire::ui_menu_autofire(running_machine &machine, render_container *container) : ui_menu(machine, container) +{ + screen_device_iterator iter(machine.root_device()); + const screen_device *screen = iter.first(); + + if (screen == nullptr) + { + refresh = 60.0; + } + else + { + refresh = ATTOSECONDS_TO_HZ(screen->refresh_attoseconds()); + } +} + +ui_menu_autofire::~ui_menu_autofire() +{ +} + +void ui_menu_autofire::handle() +{ + ioport_field *field; + bool changed = false; + + /* process the menu */ + const ui_menu_event *menu_event = process(0); + + /* handle events */ + if (menu_event != nullptr && menu_event->itemref != nullptr) + { + // menu item is changed using left/right keys only + if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) + { + if (menu_event->itemref == ITEMREF_AUTOFIRE_STATUS) + { + // toggle autofire status + bool autofire_toggle = machine().ioport().get_autofire_toggle(); // (menu_event->iptkey == IPT_UI_LEFT); + machine().ioport().set_autofire_toggle(!autofire_toggle); + changed = true; + } + else if (menu_event->itemref == ITEMREF_AUTOFIRE_DELAY) + { + // change autofire frequency + int autofire_delay = machine().ioport().get_autofire_delay(); + if (menu_event->iptkey == IPT_UI_LEFT) + { + autofire_delay--; + if (autofire_delay < 1) + autofire_delay = 1; + } + else + { + autofire_delay++; + if (autofire_delay > 30) + autofire_delay = 30; + } + machine().ioport().set_autofire_delay(autofire_delay); + changed = true; + } + else + { + // enable autofire on specific button + field = (ioport_field *)menu_event->itemref; + ioport_field::user_settings settings; + field->get_user_settings(settings); + settings.autofire = (menu_event->iptkey == IPT_UI_RIGHT); + field->set_user_settings(settings); + changed = true; + } + } + } + + // if toggle settings changed, redraw menu to reflect new options + if (!changed) + { + changed = (last_toggle != machine().ioport().get_autofire_toggle()); + } + + /* if something changed, rebuild the menu */ + if (changed) + { + reset(UI_MENU_RESET_REMEMBER_REF); + } +} + + +/*------------------------------------------------- + menu_autofire_populate - populate the autofire + menu +-------------------------------------------------*/ + +void ui_menu_autofire::populate() +{ + ioport_field *field; + ioport_port *port; + char temp_text[64]; + + /* add autofire toggle item */ + bool autofire_toggle = machine().ioport().get_autofire_toggle(); + item_append("Autofire Status", (autofire_toggle ? "Disabled" : "Enabled"), + (autofire_toggle ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW), (void *)ITEMREF_AUTOFIRE_STATUS); + + /* iterate over the input ports and add autofire toggle items */ + int menu_items = 0; + for (port = machine().ioport().first_port(); port != nullptr; port = port->next()) + { + bool is_first_button = true; + for (field = port->first_field(); field != nullptr; field = field->next()) + { + if ((field->name()) && ((field->type() >= IPT_BUTTON1 && field->type() <= IPT_BUTTON16))) // IPT_BUTTON1 + 15))) + { + menu_items++; + ioport_field::user_settings settings; + field->get_user_settings(settings); + + if (is_first_button) + { + /* add a separator for each player */ + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + is_first_button = false; + } + /* add an autofire item */ + if (!autofire_toggle) + { + // item is enabled and can be switched to values on/off + item_append(field->name(), (settings.autofire ? "On" : "Off"), + (settings.autofire ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW), (void *)field); + } + else + { + // item is disabled + item_append(field->name(), (settings.autofire ? "On" : "Off"), + MENU_FLAG_DISABLE | MENU_FLAG_INVERT, nullptr); + } + } + } + } + + /* add text item if no buttons found */ + if (menu_items==0) + { + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + item_append("No buttons found on this machine!", nullptr, MENU_FLAG_DISABLE, nullptr); + } + + /* add a separator */ + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + /* add autofire delay item */ + int value = machine().ioport().get_autofire_delay(); + snprintf(temp_text, ARRAY_LENGTH(temp_text), "%d = %.2f Hz", value, (float)refresh/value); + if (!autofire_toggle) + { + item_append("Autofire Delay", temp_text, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)ITEMREF_AUTOFIRE_DELAY); + } + else + { + item_append("Autofire Delay", temp_text, MENU_FLAG_DISABLE | MENU_FLAG_INVERT, nullptr); + } + + /* add a separator */ + item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); + + last_toggle = autofire_toggle; +} + + diff --git a/src/emu/ui/cheatopt.h b/src/emu/ui/cheatopt.h index 0358af493ab..a9321df7304 100644 --- a/src/emu/ui/cheatopt.h +++ b/src/emu/ui/cheatopt.h @@ -13,6 +13,12 @@ #ifndef __UI_CHEATOPT_H__ #define __UI_CHEATOPT_H__ +// itemrefs for key menu items +#define ITEMREF_CHEATS_RESET_ALL ((void *) 0x0001) +#define ITEMREF_CHEATS_RELOAD_ALL ((void *) 0x0002) +#define ITEMREF_CHEATS_AUTOFIRE_SETTINGS ((void *) 0x0003) +#define ITEMREF_CHEATS_FIRST_ITEM ((void *) 0x0004) + class ui_menu_cheat : public ui_menu { public: ui_menu_cheat(running_machine &machine, render_container *container); @@ -21,4 +27,23 @@ public: virtual void handle() override; }; + +// itemrefs for key menu items +#define ITEMREF_AUTOFIRE_STATUS ((void *) 0x0001) +#define ITEMREF_AUTOFIRE_DELAY ((void *) 0x0002) +#define ITEMREF_AUTOFIRE_FIRST_BUTTON ((void *) 0x0003) + +class ui_menu_autofire : public ui_menu { +public: + ui_menu_autofire(running_machine &machine, render_container *container); + virtual ~ui_menu_autofire(); + virtual void populate() override; + virtual void handle() override; + +private: + float refresh; + bool last_toggle; +}; + + #endif /* __UI_CHEATOPT_H__ */ diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp index 3ea29398fd2..bd1ac36ee48 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/emu/ui/mainmenu.cpp @@ -133,7 +133,7 @@ void ui_menu_main::populate() item_append("Crosshair Options", nullptr, 0, (void *)CROSSHAIR); /* add cheat menu */ - if (machine().options().cheat() && machine().cheat().first() != nullptr) + if (machine().options().cheat()) item_append("Cheat", nullptr, 0, (void *)CHEAT); // add dats menu diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index c92e700b433..38bfea64fd9 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -1769,6 +1769,21 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (machine.ui_input().pressed(IPT_UI_THROTTLE)) machine.video().toggle_throttle(); + // toggle autofire + if (machine.ui_input().pressed(IPT_UI_TOGGLE_AUTOFIRE)) + { + if (!machine.options().cheat()) + { + machine.popmessage("Autofire can't be enabled"); + } + else + { + bool autofire_toggle = machine.ioport().get_autofire_toggle(); + machine.ioport().set_autofire_toggle(!autofire_toggle); + machine.popmessage("Autofire %s", autofire_toggle ? "Disabled" : "Enabled"); + } + } + // check for fast forward if (machine.ioport().type_pressed(IPT_UI_FAST_FORWARD)) { -- cgit v1.2.3-70-g09d2 From a18fb2ccb1345752d2097a8c1998b8d582c92624 Mon Sep 17 00:00:00 2001 From: Kevin Eshbach Date: Sat, 13 Feb 2016 15:12:36 -0500 Subject: Adding regression tests for the AMPAL18P8 --- .../baseline/ampal18p8/pal10h8-as-ampal18p8.txt | 97 +++++++++++++++++ .../baseline/ampal18p8/pal10l8-as-ampal18p8.txt | 97 +++++++++++++++++ .../baseline/ampal18p8/pal12h6-as-ampal18p8.txt | 75 +++++++++++++ .../baseline/ampal18p8/pal12l6-as-ampal18p8.txt | 75 +++++++++++++ .../baseline/ampal18p8/pal14h4-as-ampal18p8.txt | 53 +++++++++ .../baseline/ampal18p8/pal14l4-as-ampal18p8.txt | 53 +++++++++ .../baseline/ampal18p8/pal16h2-as-ampal18p8.txt | 31 ++++++ .../baseline/ampal18p8/pal16l2-as-ampal18p8.txt | 31 ++++++ .../baseline/ampal18p8/pal16l8-as-ampal18p8.txt | 89 +++++++++++++++ .../eqns/PALASM/ampal18p8/pal10h8-as-ampal18p8.pds | 119 +++++++++++++++++++++ .../eqns/PALASM/ampal18p8/pal10l8-as-ampal18p8.pds | 119 +++++++++++++++++++++ .../eqns/PALASM/ampal18p8/pal12h6-as-ampal18p8.pds | 101 +++++++++++++++++ .../eqns/PALASM/ampal18p8/pal12l6-as-ampal18p8.pds | 101 +++++++++++++++++ .../eqns/PALASM/ampal18p8/pal14h4-as-ampal18p8.pds | 83 ++++++++++++++ .../eqns/PALASM/ampal18p8/pal14l4-as-ampal18p8.pds | 83 ++++++++++++++ .../eqns/PALASM/ampal18p8/pal16h2-as-ampal18p8.pds | 65 +++++++++++ .../eqns/PALASM/ampal18p8/pal16l2-as-ampal18p8.pds | 65 +++++++++++ .../eqns/PALASM/ampal18p8/pal16l8-as-ampal18p8.pds | 119 +++++++++++++++++++++ .../jeds/ampal18p8/pal10h8-as-ampal18p8.jed | 90 ++++++++++++++++ .../jeds/ampal18p8/pal10l8-as-ampal18p8.jed | 90 ++++++++++++++++ .../jeds/ampal18p8/pal12h6-as-ampal18p8.jed | 90 ++++++++++++++++ .../jeds/ampal18p8/pal12l6-as-ampal18p8.jed | 90 ++++++++++++++++ .../jeds/ampal18p8/pal14h4-as-ampal18p8.jed | 90 ++++++++++++++++ .../jeds/ampal18p8/pal14l4-as-ampal18p8.jed | 90 ++++++++++++++++ .../jeds/ampal18p8/pal16h2-as-ampal18p8.jed | 90 ++++++++++++++++ .../jeds/ampal18p8/pal16l2-as-ampal18p8.jed | 90 ++++++++++++++++ .../jeds/ampal18p8/pal16l8-as-ampal18p8.jed | 90 ++++++++++++++++ 27 files changed, 2266 insertions(+) create mode 100644 regtests/jedutil/baseline/ampal18p8/pal10h8-as-ampal18p8.txt create mode 100644 regtests/jedutil/baseline/ampal18p8/pal10l8-as-ampal18p8.txt create mode 100644 regtests/jedutil/baseline/ampal18p8/pal12h6-as-ampal18p8.txt create mode 100644 regtests/jedutil/baseline/ampal18p8/pal12l6-as-ampal18p8.txt create mode 100644 regtests/jedutil/baseline/ampal18p8/pal14h4-as-ampal18p8.txt create mode 100644 regtests/jedutil/baseline/ampal18p8/pal14l4-as-ampal18p8.txt create mode 100644 regtests/jedutil/baseline/ampal18p8/pal16h2-as-ampal18p8.txt create mode 100644 regtests/jedutil/baseline/ampal18p8/pal16l2-as-ampal18p8.txt create mode 100644 regtests/jedutil/baseline/ampal18p8/pal16l8-as-ampal18p8.txt create mode 100644 regtests/jedutil/eqns/PALASM/ampal18p8/pal10h8-as-ampal18p8.pds create mode 100644 regtests/jedutil/eqns/PALASM/ampal18p8/pal10l8-as-ampal18p8.pds create mode 100644 regtests/jedutil/eqns/PALASM/ampal18p8/pal12h6-as-ampal18p8.pds create mode 100644 regtests/jedutil/eqns/PALASM/ampal18p8/pal12l6-as-ampal18p8.pds create mode 100644 regtests/jedutil/eqns/PALASM/ampal18p8/pal14h4-as-ampal18p8.pds create mode 100644 regtests/jedutil/eqns/PALASM/ampal18p8/pal14l4-as-ampal18p8.pds create mode 100644 regtests/jedutil/eqns/PALASM/ampal18p8/pal16h2-as-ampal18p8.pds create mode 100644 regtests/jedutil/eqns/PALASM/ampal18p8/pal16l2-as-ampal18p8.pds create mode 100644 regtests/jedutil/eqns/PALASM/ampal18p8/pal16l8-as-ampal18p8.pds create mode 100644 regtests/jedutil/jeds/ampal18p8/pal10h8-as-ampal18p8.jed create mode 100644 regtests/jedutil/jeds/ampal18p8/pal10l8-as-ampal18p8.jed create mode 100644 regtests/jedutil/jeds/ampal18p8/pal12h6-as-ampal18p8.jed create mode 100644 regtests/jedutil/jeds/ampal18p8/pal12l6-as-ampal18p8.jed create mode 100644 regtests/jedutil/jeds/ampal18p8/pal14h4-as-ampal18p8.jed create mode 100644 regtests/jedutil/jeds/ampal18p8/pal14l4-as-ampal18p8.jed create mode 100644 regtests/jedutil/jeds/ampal18p8/pal16h2-as-ampal18p8.jed create mode 100644 regtests/jedutil/jeds/ampal18p8/pal16l2-as-ampal18p8.jed create mode 100644 regtests/jedutil/jeds/ampal18p8/pal16l8-as-ampal18p8.jed diff --git a/regtests/jedutil/baseline/ampal18p8/pal10h8-as-ampal18p8.txt b/regtests/jedutil/baseline/ampal18p8/pal10h8-as-ampal18p8.txt new file mode 100644 index 00000000000..5b8dae63d99 --- /dev/null +++ b/regtests/jedutil/baseline/ampal18p8/pal10h8-as-ampal18p8.txt @@ -0,0 +1,97 @@ +Inputs: + +1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19 + +Outputs: + +12 (Combinatorial, Output feedback output, Active high) +13 (Combinatorial, Output feedback output, Active high) +14 (Combinatorial, Output feedback output, Active high) +15 (Combinatorial, Output feedback output, Active high) +16 (Combinatorial, Output feedback output, Active high) +17 (Combinatorial, Output feedback output, Active high) +18 (Combinatorial, Output feedback output, Active high) +19 (Combinatorial, Output feedback output, Active high) + +Equations: + +o12 = i2 + + i1 & i3 + + i4 & /i11 + + i5 + + i6 + + /i1 & i7 + + i8 + + i9 & i11 +o12.oe = vcc + +o13 = /i2 + + /i4 + + /i3 & /i6 + + /i8 + + /i11 + + /i9 + + /i1 & /i7 + + /i5 +o13.oe = vcc + +o14 = i4 + + /i8 & i11 + + /i6 + + /i2 + + i5 & /i11 + + i7 + + /i3 & /i9 + + /i1 +o14.oe = vcc + +o15 = i5 + + /i1 + + i1 & i7 + + /i3 + + i1 & /i3 + + i2 & i9 + + /i8 + + i4 +o15.oe = vcc + +o16 = i6 + + i3 & i11 + + i6 & i8 + + /i1 + + /i8 + + /i7 & /i8 + + /i2 & /i9 + + /i5 & i7 & i8 +o16.oe = vcc + +o17 = i7 + + i2 & i9 + + i3 & i4 + + /i5 + + /i9 + + /i8 + + /i1 & /i11 + + i6 & i9 +o17.oe = vcc + +o18 = /i1 + + /i3 + + /i5 + + /i7 + + /i9 + + /i11 + + i1 & i7 & i11 + + i3 & i5 & i9 +o18.oe = vcc + +o19 = i3 & i11 + + i1 + + /i1 & /i9 + + /i3 & /i5 & /i7 + + i2 + + i4 + + i6 + + i8 +o19.oe = vcc + diff --git a/regtests/jedutil/baseline/ampal18p8/pal10l8-as-ampal18p8.txt b/regtests/jedutil/baseline/ampal18p8/pal10l8-as-ampal18p8.txt new file mode 100644 index 00000000000..78a3cef7b0d --- /dev/null +++ b/regtests/jedutil/baseline/ampal18p8/pal10l8-as-ampal18p8.txt @@ -0,0 +1,97 @@ +Inputs: + +1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19 + +Outputs: + +12 (Combinatorial, Output feedback output, Active low) +13 (Combinatorial, Output feedback output, Active low) +14 (Combinatorial, Output feedback output, Active low) +15 (Combinatorial, Output feedback output, Active low) +16 (Combinatorial, Output feedback output, Active low) +17 (Combinatorial, Output feedback output, Active low) +18 (Combinatorial, Output feedback output, Active low) +19 (Combinatorial, Output feedback output, Active low) + +Equations: + +/o12 = /i1 & i7 + + i8 + + i9 & i11 + + i2 + + i1 & i3 + + i5 + + i4 & /i11 + + i6 +o12.oe = vcc + +/o13 = /i8 + + /i11 + + /i9 + + /i3 & /i6 + + /i1 & /i7 + + /i2 + + /i4 + + /i5 +o13.oe = vcc + +/o14 = /i3 & /i9 + + /i6 + + /i2 + + i4 + + /i8 & i11 + + i7 + + i5 & /i11 + + /i1 +o14.oe = vcc + +/o15 = i4 + + i1 & /i3 + + i2 & i9 + + i5 + + i1 & i7 + + /i3 + + /i8 + + /i1 +o15.oe = vcc + +/o16 = i6 + + /i2 & /i9 + + i3 & i11 + + /i8 + + i6 & i8 + + /i1 + + /i5 & i7 & i8 + + /i7 & /i8 +o16.oe = vcc + +/o17 = i3 & i4 + + /i5 + + /i9 + + /i1 & /i11 + + i7 + + i2 & i9 + + i6 & i9 + + /i8 +o17.oe = vcc + +/o18 = /i9 + + i3 & i5 & i9 + + /i7 + + /i11 + + /i1 + + /i3 + + /i5 + + i1 & i7 & i11 +o18.oe = vcc + +/o19 = /i3 & /i5 & /i7 + + i2 + + i8 + + i3 & i11 + + i1 + + i4 + + i6 + + /i1 & /i9 +o19.oe = vcc + diff --git a/regtests/jedutil/baseline/ampal18p8/pal12h6-as-ampal18p8.txt b/regtests/jedutil/baseline/ampal18p8/pal12h6-as-ampal18p8.txt new file mode 100644 index 00000000000..4f70393f5b5 --- /dev/null +++ b/regtests/jedutil/baseline/ampal18p8/pal12h6-as-ampal18p8.txt @@ -0,0 +1,75 @@ +Inputs: + +1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19 + +Outputs: + +13 (Combinatorial, Output feedback output, Active high) +14 (Combinatorial, Output feedback output, Active high) +15 (Combinatorial, Output feedback output, Active high) +16 (Combinatorial, Output feedback output, Active high) +17 (Combinatorial, Output feedback output, Active high) +18 (Combinatorial, Output feedback output, Active high) + +Equations: + +o13 = /i2 + + /i4 + + /i3 & /i6 + + /i8 + + /i11 + + /i9 + + /i1 & /i7 + + /i5 +o13.oe = vcc + +o14 = i4 + + /i8 & i11 + + /i6 + + /i2 + + i5 & /i11 + + i7 + + /i3 & /i9 + + /i1 & /i12 +o14.oe = vcc + +o15 = i5 & i19 + + /i1 + + i1 & i7 + + /i3 + + i1 & /i3 + + i2 & i9 + + /i8 + + i4 +o15.oe = vcc + +o16 = i6 + + i3 & i11 + + i6 & i8 + + /i1 + + /i8 + + /i7 & /i8 + + /i2 & /i9 + + /i5 & i7 & i8 +o16.oe = vcc + +o17 = i7 & i12 + + i2 & i9 + + i3 & i4 + + /i5 + + /i9 + + /i8 + + /i1 & /i11 + + i6 & i9 +o17.oe = vcc + +o18 = /i1 + + /i3 + + /i5 + + /i7 + + /i9 & /i19 + + /i11 + + i1 & i7 & i11 + + i3 & i5 & i9 +o18.oe = vcc + diff --git a/regtests/jedutil/baseline/ampal18p8/pal12l6-as-ampal18p8.txt b/regtests/jedutil/baseline/ampal18p8/pal12l6-as-ampal18p8.txt new file mode 100644 index 00000000000..31e39086292 --- /dev/null +++ b/regtests/jedutil/baseline/ampal18p8/pal12l6-as-ampal18p8.txt @@ -0,0 +1,75 @@ +Inputs: + +1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19 + +Outputs: + +13 (Combinatorial, Output feedback output, Active low) +14 (Combinatorial, Output feedback output, Active low) +15 (Combinatorial, Output feedback output, Active low) +16 (Combinatorial, Output feedback output, Active low) +17 (Combinatorial, Output feedback output, Active low) +18 (Combinatorial, Output feedback output, Active low) + +Equations: + +/o13 = /i8 + + /i11 + + /i9 + + /i3 & /i6 + + /i1 & /i7 + + /i2 + + /i4 & /i12 + + /i5 +o13.oe = vcc + +/o14 = /i3 & /i9 & i19 + + /i6 + + /i2 + + i4 + + /i8 & i11 + + i7 + + i5 & /i11 + + /i1 +o14.oe = vcc + +/o15 = i4 + + i1 & /i3 + + i2 & i9 + + i5 + + i1 & i7 + + /i3 + + /i8 + + /i1 +o15.oe = vcc + +/o16 = i6 + + /i2 & /i9 + + i3 & i11 + + /i8 + + i6 & i8 + + /i1 + + /i5 & i7 & i8 + + /i7 & /i8 & i12 +o16.oe = vcc + +/o17 = i3 & i4 + + /i5 + + /i9 + + /i1 & /i11 + + i7 + + i2 & i9 & /i19 + + i6 & i9 + + /i8 +o17.oe = vcc + +/o18 = /i9 + + i3 & i5 & i9 + + /i7 + + /i11 + + /i1 + + /i3 + + /i5 + + i1 & i7 & i11 +o18.oe = vcc + diff --git a/regtests/jedutil/baseline/ampal18p8/pal14h4-as-ampal18p8.txt b/regtests/jedutil/baseline/ampal18p8/pal14h4-as-ampal18p8.txt new file mode 100644 index 00000000000..4c7f55a1dba --- /dev/null +++ b/regtests/jedutil/baseline/ampal18p8/pal14h4-as-ampal18p8.txt @@ -0,0 +1,53 @@ +Inputs: + +1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19 + +Outputs: + +14 (Combinatorial, Output feedback output, Active high) +15 (Combinatorial, Output feedback output, Active high) +16 (Combinatorial, Output feedback output, Active high) +17 (Combinatorial, Output feedback output, Active high) + +Equations: + +o14 = i4 + + /i8 & i11 + + /i12 + + /i2 + + i5 & /i11 + + i7 & i12 + + /i3 & /i9 + + /i1 +o14.oe = vcc + +o15 = i5 + + /i13 + + i1 & i7 + + /i3 + + /i3 & i13 + + i2 & i9 + + /i8 + + i4 +o15.oe = vcc + +o16 = i6 + + i3 & i11 + + i6 & i18 + + /i1 + + /i18 + + /i7 & /i8 + + /i2 & /i9 + + /i5 & i7 & i8 +o16.oe = vcc + +o17 = i7 + + i2 & i19 + + i3 & i4 + + /i5 + + /i9 + + /i19 + + /i1 & /i11 + + i6 & i9 +o17.oe = vcc + diff --git a/regtests/jedutil/baseline/ampal18p8/pal14l4-as-ampal18p8.txt b/regtests/jedutil/baseline/ampal18p8/pal14l4-as-ampal18p8.txt new file mode 100644 index 00000000000..967c5f1702d --- /dev/null +++ b/regtests/jedutil/baseline/ampal18p8/pal14l4-as-ampal18p8.txt @@ -0,0 +1,53 @@ +Inputs: + +1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19 + +Outputs: + +14 (Combinatorial, Output feedback output, Active low) +15 (Combinatorial, Output feedback output, Active low) +16 (Combinatorial, Output feedback output, Active low) +17 (Combinatorial, Output feedback output, Active low) + +Equations: + +/o14 = /i8 & i11 + + i4 + + /i12 + + i5 & /i11 + + i1 + + i7 & i12 + + /i3 & /i9 + + /i2 +o14.oe = vcc + +/o15 = i1 & i7 + + /i8 + + i5 + + /i13 + + /i3 + + i2 & i9 + + i4 + + /i3 & i13 +o15.oe = vcc + +/o16 = /i18 + + i3 & i11 + + i6 + + i6 & i18 + + /i1 + + /i5 & i7 & i8 + + /i2 & /i9 + + /i7 & /i8 +o16.oe = vcc + +/o17 = i2 & i19 + + /i9 + + /i19 + + i3 & i4 + + i6 & i9 + + /i5 + + /i1 & /i11 + + i7 +o17.oe = vcc + diff --git a/regtests/jedutil/baseline/ampal18p8/pal16h2-as-ampal18p8.txt b/regtests/jedutil/baseline/ampal18p8/pal16h2-as-ampal18p8.txt new file mode 100644 index 00000000000..358dc093584 --- /dev/null +++ b/regtests/jedutil/baseline/ampal18p8/pal16h2-as-ampal18p8.txt @@ -0,0 +1,31 @@ +Inputs: + +1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19 + +Outputs: + +15 (Combinatorial, Output feedback output, Active high) +16 (Combinatorial, Output feedback output, Active high) + +Equations: + +o15 = i5 + + /i13 & /i14 + + i1 & i7 + + /i3 & i14 + + /i3 & i13 + + i2 & i9 + + /i8 + + i4 +o15.oe = vcc + +o16 = i6 + + i3 & i11 + + i6 & i18 + + /i1 & /i17 + + /i18 + + /i7 & /i8 + + /i2 & /i9 + + /i5 & i7 & i8 & i17 +o16.oe = vcc + diff --git a/regtests/jedutil/baseline/ampal18p8/pal16l2-as-ampal18p8.txt b/regtests/jedutil/baseline/ampal18p8/pal16l2-as-ampal18p8.txt new file mode 100644 index 00000000000..615dda7cdb6 --- /dev/null +++ b/regtests/jedutil/baseline/ampal18p8/pal16l2-as-ampal18p8.txt @@ -0,0 +1,31 @@ +Inputs: + +1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19 + +Outputs: + +15 (Combinatorial, Output feedback output, Active low) +16 (Combinatorial, Output feedback output, Active low) + +Equations: + +/o15 = i5 & /i11 + + /i3 & i14 + + /i3 & i13 + + /i13 & /i14 + + i1 & i7 & i12 + + /i8 & i18 + + i2 & i9 + + i4 & i17 & /i19 +o15.oe = vcc + +/o16 = /i2 & /i9 & i19 + + i3 & i11 & /i18 + + /i5 & i7 & i8 & i17 + + i6 & i18 + + /i1 & i14 & /i17 + + i13 & /i18 + + /i7 & /i8 & /i12 + + i6 +o16.oe = vcc + diff --git a/regtests/jedutil/baseline/ampal18p8/pal16l8-as-ampal18p8.txt b/regtests/jedutil/baseline/ampal18p8/pal16l8-as-ampal18p8.txt new file mode 100644 index 00000000000..5608bdc0ccc --- /dev/null +++ b/regtests/jedutil/baseline/ampal18p8/pal16l8-as-ampal18p8.txt @@ -0,0 +1,89 @@ +Inputs: + +1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19 + +Outputs: + +12 (Combinatorial, Output feedback output, Active high) +13 (Combinatorial, Output feedback output, Active low) +14 (Combinatorial, Output feedback output, Active low) +15 (Combinatorial, Output feedback output, Active low) +16 (Combinatorial, Output feedback output, Active low) +17 (Combinatorial, Output feedback output, Active low) +18 (Combinatorial, Output feedback output, Active high) +19 (Combinatorial, Output feedback output, Active high) + +Equations: + +o12 = i1 & /i2 + + /i1 & i3 + + /i3 & i7 + + i4 & o13 + + i6 & /o13 + + i6 & /i7 + + /i6 & /i8 & /i9 +o12.oe = /i5 + +/o13 = i3 + + o14 + + /i11 + + i2 + + /i4 & /o14 + + i8 & i9 + + i5 +o13.oe = vcc + +/o14 = i4 + + /i8 & i11 + + o15 + + /i2 + + i5 & /i11 + + i7 + + /i3 & /i9 +o14.oe = i1 + +/o15 = i5 + + /o16 + + i1 & i7 + + /i3 + + /i3 & o16 + + i2 & i9 + + /i8 +o15.oe = vcc + +/o16 = i6 + + i3 & i11 + + i6 & o17 + + /i1 + + /o17 + + /i7 & /i8 + + /i2 & /i9 +o16.oe = /i11 + +/o17 = i7 + + i2 & o18 + + i3 & i4 + + /i5 + + /i9 + + /o18 + + /i1 & /i11 +o17.oe = vcc + +o18 = i3 + + i8 + + i9 & i11 + + i1 + + /i4 + + i2 + + i5 & /i7 +o18.oe = vcc + +o19 = o18 + + o17 + + o16 + + o15 + + o14 + + o13 + + /o13 & /o14 & /o15 & /o16 & /o17 & /o18 +o19.oe = i3 + diff --git a/regtests/jedutil/eqns/PALASM/ampal18p8/pal10h8-as-ampal18p8.pds b/regtests/jedutil/eqns/PALASM/ampal18p8/pal10h8-as-ampal18p8.pds new file mode 100644 index 00000000000..3cf9c714392 --- /dev/null +++ b/regtests/jedutil/eqns/PALASM/ampal18p8/pal10h8-as-ampal18p8.pds @@ -0,0 +1,119 @@ +;PALASM Design Description + +;---------------------------------- Declaration Segment ------------ +TITLE PAL10H8 Test +PATTERN A +REVISION 1.0 +AUTHOR MAMEDev +COMPANY MAMEDev +DATE 08/25/13 + +CHIP PAL10H8Test PAL18P8 + +SIGNATURE #b0010011001100110011001100110011001100110011001100110011001100100 + +;---------------------------------- PIN Declarations --------------- +PIN 1 I1 COMBINATORIAL ; +PIN 2 I2 COMBINATORIAL ; +PIN 3 I3 COMBINATORIAL ; +PIN 4 I4 COMBINATORIAL ; +PIN 5 I5 COMBINATORIAL ; +PIN 6 I6 COMBINATORIAL ; +PIN 7 I7 COMBINATORIAL ; +PIN 8 I8 COMBINATORIAL ; +PIN 9 I9 COMBINATORIAL ; +PIN 10 GND ; +PIN 11 I11 COMBINATORIAL ; +PIN 12 O12 COMBINATORIAL ; +PIN 13 O13 COMBINATORIAL ; +PIN 14 O14 COMBINATORIAL ; +PIN 15 O15 COMBINATORIAL ; +PIN 16 O16 COMBINATORIAL ; +PIN 17 O17 COMBINATORIAL ; +PIN 18 O18 COMBINATORIAL ; +PIN 19 O19 COMBINATORIAL ; +PIN 20 VCC ; + +;----------------------------------- Boolean Equation Segment ------ +EQUATIONS + +MINIMIZE_OFF + +O12 = I2 + + I1 * I3 + + I4 * /I11 + + I5 + + I6 + + /I1 * I7 + + I8 + + I9 * I11 + +O13 = /I2 + + /I4 + + /I3 * /I6 + + /I8 + + /I11 + + /I9 + + /I1 * /I7 + + /I5 + +O14 = I4 + + /I8 * I11 + + /I6 + + /I2 + + I5 * /I11 + + I7 + + /I3 * /I9 + + /I1 + +O15 = I5 + + /I1 + + I1 * I7 + + /I3 + + I1 * /I3 + + I2 * I9 + + /I8 + + I4 + +O16 = I6 + + I3 * I11 + + I6 * I8 + + /I1 + + /I8 + + /I7 * /I8 + + /I2 * /I9 + + /i5 * I7 * I8 + +O17 = I7 + + I2 * I9 + + I3 * I4 + + /I5 + + /I9 + + /I8 + + /I1 * /I11 + + I6 * I9 + +O18 = /I1 + + /I3 + + /I5 + + /I7 + + /I9 + + /I11 + + I1 * I7 * I11 + + I3 * I5 * I9 + +O19 = I3 * I11 + + I1 + + /I1 * /I9 + + /I3 * /I5 * /I7 + + I2 + + I4 + + I6 + + I8 + +MINIMIZE_ON + +;----------------------------------- Simulation Segment ------------ +SIMULATION + +;------------------------------------------------------------------- diff --git a/regtests/jedutil/eqns/PALASM/ampal18p8/pal10l8-as-ampal18p8.pds b/regtests/jedutil/eqns/PALASM/ampal18p8/pal10l8-as-ampal18p8.pds new file mode 100644 index 00000000000..4841fd124fe --- /dev/null +++ b/regtests/jedutil/eqns/PALASM/ampal18p8/pal10l8-as-ampal18p8.pds @@ -0,0 +1,119 @@ +;PALASM Design Description + +;---------------------------------- Declaration Segment ------------ +TITLE PAL10L8 Test +PATTERN A +REVISION 1.0 +AUTHOR MAMEDev +COMPANY MAMEDev +DATE 08/25/13 + +CHIP PAL10L8Test PAL18P8 + +SIGNATURE #b0010011001100110011001100110011001100110011001100110011001100100 + +;---------------------------------- PIN Declarations --------------- +PIN 1 I1 COMBINATORIAL ; +PIN 2 I2 COMBINATORIAL ; +PIN 3 I3 COMBINATORIAL ; +PIN 4 I4 COMBINATORIAL ; +PIN 5 I5 COMBINATORIAL ; +PIN 6 I6 COMBINATORIAL ; +PIN 7 I7 COMBINATORIAL ; +PIN 8 I8 COMBINATORIAL ; +PIN 9 I9 COMBINATORIAL ; +PIN 10 GND ; +PIN 11 I11 COMBINATORIAL ; +PIN 12 O12 COMBINATORIAL ; +PIN 13 O13 COMBINATORIAL ; +PIN 14 O14 COMBINATORIAL ; +PIN 15 O15 COMBINATORIAL ; +PIN 16 O16 COMBINATORIAL ; +PIN 17 O17 COMBINATORIAL ; +PIN 18 O18 COMBINATORIAL ; +PIN 19 O19 COMBINATORIAL ; +PIN 20 VCC ; + +;----------------------------------- Boolean Equation Segment ------ +EQUATIONS + +MINIMIZE_OFF + +/O12 = /I1 * I7 + + I8 + + I9 * I11 + + I2 + + I1 * I3 + + I5 + + I4 * /I11 + + I6 + +/O13 = /I8 + + /I11 + + /I9 + + /I3 * /I6 + + /I1 * /I7 + + /I2 + + /I4 + + /I5 + +/O14 = /I3 * /I9 + + /I6 + + /I2 + + I4 + + /I8 * I11 + + I7 + + I5 * /I11 + + /I1 + +/O15 = I4 + + I1 * /I3 + + I2 * I9 + + I5 + + I1 * I7 + + /I3 + + /I8 + + /I1 + +/O16 = I6 + + /I2 * /I9 + + I3 * I11 + + /I8 + + I6 * I8 + + /I1 + + /i5 * I7 * I8 + + /I7 * /I8 + +/O17 = I3 * I4 + + /I5 + + /I9 + + /I1 * /I11 + + I7 + + I2 * I9 + + I6 * I9 + + /I8 + +/O18 = /I9 + + I3 * I5 * I9 + + /I7 + + /I11 + + /I1 + + /I3 + + /I5 + + I1 * I7 * I11 + +/O19 = /I3 * /I5 * /I7 + + I2 + + I8 + + I3 * I11 + + I1 + + I4 + + I6 + + /I1 * /I9 + +MINIMIZE_ON + +;----------------------------------- Simulation Segment ------------ +SIMULATION + +;------------------------------------------------------------------- diff --git a/regtests/jedutil/eqns/PALASM/ampal18p8/pal12h6-as-ampal18p8.pds b/regtests/jedutil/eqns/PALASM/ampal18p8/pal12h6-as-ampal18p8.pds new file mode 100644 index 00000000000..ebe77ff8db4 --- /dev/null +++ b/regtests/jedutil/eqns/PALASM/ampal18p8/pal12h6-as-ampal18p8.pds @@ -0,0 +1,101 @@ +;PALASM Design Description + +;---------------------------------- Declaration Segment ------------ +TITLE PAL12H6 Test +PATTERN A +REVISION 1.0 +AUTHOR MAMEDev +COMPANY MAMEDev +DATE 08/25/13 + +CHIP PAL12H6Test PAL18P8 + +SIGNATURE #b0010011001100110011001100110011001100110011001100110011001100100 + +;---------------------------------- PIN Declarations --------------- +PIN 1 I1 COMBINATORIAL ; +PIN 2 I2 COMBINATORIAL ; +PIN 3 I3 COMBINATORIAL ; +PIN 4 I4 COMBINATORIAL ; +PIN 5 I5 COMBINATORIAL ; +PIN 6 I6 COMBINATORIAL ; +PIN 7 I7 COMBINATORIAL ; +PIN 8 I8 COMBINATORIAL ; +PIN 9 I9 COMBINATORIAL ; +PIN 10 GND ; +PIN 11 I11 COMBINATORIAL ; +PIN 12 I12 COMBINATORIAL ; +PIN 13 O13 COMBINATORIAL ; +PIN 14 O14 COMBINATORIAL ; +PIN 15 O15 COMBINATORIAL ; +PIN 16 O16 COMBINATORIAL ; +PIN 17 O17 COMBINATORIAL ; +PIN 18 O18 COMBINATORIAL ; +PIN 19 I19 COMBINATORIAL ; +PIN 20 VCC ; + +;----------------------------------- Boolean Equation Segment ------ +EQUATIONS + +MINIMIZE_OFF + +O13 = /I2 + + /I4 + + /I3 * /I6 + + /I8 + + /I11 + + /I9 + + /I1 * /I7 + + /I5 + +O14 = I4 + + /I8 * I11 + + /I6 + + /I2 + + I5 * /I11 + + I7 + + /I3 * /I9 + + /I1 * /I12 + +O15 = I5 * I19 + + /I1 + + I1 * I7 + + /I3 + + I1 * /I3 + + I2 * I9 + + /I8 + + I4 + +O16 = I6 + + I3 * I11 + + I6 * I8 + + /I1 + + /I8 + + /I7 * /I8 + + /I2 * /I9 + + /i5 * I7 * I8 + +O17 = I7 * I12 + + I2 * I9 + + I3 * I4 + + /I5 + + /I9 + + /I8 + + /I1 * /I11 + + I6 * I9 + +O18 = /I1 + + /I3 + + /I5 + + /I7 + + /I9 * /I19 + + /I11 + + I1 * I7 * I11 + + I3 * I5 * I9 + +MINIMIZE_ON + +;----------------------------------- Simulation Segment ------------ +SIMULATION + +;------------------------------------------------------------------- diff --git a/regtests/jedutil/eqns/PALASM/ampal18p8/pal12l6-as-ampal18p8.pds b/regtests/jedutil/eqns/PALASM/ampal18p8/pal12l6-as-ampal18p8.pds new file mode 100644 index 00000000000..3568dd79538 --- /dev/null +++ b/regtests/jedutil/eqns/PALASM/ampal18p8/pal12l6-as-ampal18p8.pds @@ -0,0 +1,101 @@ +;PALASM Design Description + +;---------------------------------- Declaration Segment ------------ +TITLE PAL12L6 Test +PATTERN A +REVISION 1.0 +AUTHOR MAMEDev +COMPANY MAMEDev +DATE 08/25/13 + +CHIP PAL12L6Test PAL18P8 + +SIGNATURE #b0010011001100110011001100110011001100110011001100110011001100100 + +;---------------------------------- PIN Declarations --------------- +PIN 1 I1 COMBINATORIAL ; +PIN 2 I2 COMBINATORIAL ; +PIN 3 I3 COMBINATORIAL ; +PIN 4 I4 COMBINATORIAL ; +PIN 5 I5 COMBINATORIAL ; +PIN 6 I6 COMBINATORIAL ; +PIN 7 I7 COMBINATORIAL ; +PIN 8 I8 COMBINATORIAL ; +PIN 9 I9 COMBINATORIAL ; +PIN 10 GND ; +PIN 11 I11 COMBINATORIAL ; +PIN 12 I12 COMBINATORIAL ; +PIN 13 O13 COMBINATORIAL ; +PIN 14 O14 COMBINATORIAL ; +PIN 15 O15 COMBINATORIAL ; +PIN 16 O16 COMBINATORIAL ; +PIN 17 O17 COMBINATORIAL ; +PIN 18 O18 COMBINATORIAL ; +PIN 19 I19 COMBINATORIAL ; +PIN 20 VCC ; + +;----------------------------------- Boolean Equation Segment ------ +EQUATIONS + +MINIMIZE_OFF + +/O13 = /I8 + + /I11 + + /I9 + + /I3 * /I6 + + /I1 * /I7 + + /I2 + + /I4 * /I12 + + /I5 + +/O14 = /I3 * /I9 * I19 + + /I6 + + /I2 + + I4 + + /I8 * I11 + + I7 + + I5 * /I11 + + /I1 + +/O15 = I4 + + I1 * /I3 + + I2 * I9 + + I5 + + I1 * I7 + + /I3 + + /I8 + + /I1 + +/O16 = I6 + + /I2 * /I9 + + I3 * I11 + + /I8 + + I6 * I8 + + /I1 + + /i5 * I7 * I8 + + /I7 * /I8 * I12 + +/O17 = I3 * I4 + + /I5 + + /I9 + + /I1 * /I11 + + I7 + + I2 * I9 * /I19 + + I6 * I9 + + /I8 + +/O18 = /I9 + + I3 * I5 * I9 + + /I7 + + /I11 + + /I1 + + /I3 + + /I5 + + I1 * I7 * I11 + +MINIMIZE_ON + +;----------------------------------- Simulation Segment ------------ +SIMULATION + +;------------------------------------------------------------------- diff --git a/regtests/jedutil/eqns/PALASM/ampal18p8/pal14h4-as-ampal18p8.pds b/regtests/jedutil/eqns/PALASM/ampal18p8/pal14h4-as-ampal18p8.pds new file mode 100644 index 00000000000..1da96c947de --- /dev/null +++ b/regtests/jedutil/eqns/PALASM/ampal18p8/pal14h4-as-ampal18p8.pds @@ -0,0 +1,83 @@ +;PALASM Design Description + +;---------------------------------- Declaration Segment ------------ +TITLE PAL14H4 Test +PATTERN A +REVISION 1.0 +AUTHOR MAMEDev +COMPANY MAMEDev +DATE 08/25/13 + +CHIP PAL14H4Test PAL18P8 + +SIGNATURE #b0010011001100110011001100110011001100110011001100110011001100100 + +;---------------------------------- PIN Declarations --------------- +PIN 1 I1 COMBINATORIAL ; +PIN 2 I2 COMBINATORIAL ; +PIN 3 I3 COMBINATORIAL ; +PIN 4 I4 COMBINATORIAL ; +PIN 5 I5 COMBINATORIAL ; +PIN 6 I6 COMBINATORIAL ; +PIN 7 I7 COMBINATORIAL ; +PIN 8 I8 COMBINATORIAL ; +PIN 9 I9 COMBINATORIAL ; +PIN 10 GND ; +PIN 11 I11 COMBINATORIAL ; +PIN 12 I12 COMBINATORIAL ; +PIN 13 I13 COMBINATORIAL ; +PIN 14 O14 COMBINATORIAL ; +PIN 15 O15 COMBINATORIAL ; +PIN 16 O16 COMBINATORIAL ; +PIN 17 O17 COMBINATORIAL ; +PIN 18 I18 COMBINATORIAL ; +PIN 19 I19 COMBINATORIAL ; +PIN 20 VCC ; + +;----------------------------------- Boolean Equation Segment ------ +EQUATIONS + +MINIMIZE_OFF + +O14 = I4 + + /I8 * I11 + + /I12 + + /I2 + + I5 * /I11 + + I7 * I12 + + /I3 * /I9 + + /I1 + +O15 = I5 + + /I13 + + I1 * I7 + + /I3 + + /I3 * I13 + + I2 * I9 + + /I8 + + I4 + +O16 = I6 + + I3 * I11 + + I6 * I18 + + /I1 + + /I18 + + /I7 * /I8 + + /I2 * /I9 + + /i5 * I7 * I8 + +O17 = I7 + + I2 * I19 + + I3 * I4 + + /I5 + + /I9 + + /I19 + + /I1 * /I11 + + I6 * I9 + +MINIMIZE_ON + +;----------------------------------- Simulation Segment ------------ +SIMULATION + +;------------------------------------------------------------------- diff --git a/regtests/jedutil/eqns/PALASM/ampal18p8/pal14l4-as-ampal18p8.pds b/regtests/jedutil/eqns/PALASM/ampal18p8/pal14l4-as-ampal18p8.pds new file mode 100644 index 00000000000..a2857768646 --- /dev/null +++ b/regtests/jedutil/eqns/PALASM/ampal18p8/pal14l4-as-ampal18p8.pds @@ -0,0 +1,83 @@ +;PALASM Design Description + +;---------------------------------- Declaration Segment ------------ +TITLE PAL14L4 Test +PATTERN A +REVISION 1.0 +AUTHOR MAMEDev +COMPANY MAMEDev +DATE 08/25/13 + +CHIP PAL14L4Test PAL18P8 + +SIGNATURE #b0010011001100110011001100110011001100110011001100110011001100100 + +;---------------------------------- PIN Declarations --------------- +PIN 1 I1 COMBINATORIAL ; +PIN 2 I2 COMBINATORIAL ; +PIN 3 I3 COMBINATORIAL ; +PIN 4 I4 COMBINATORIAL ; +PIN 5 I5 COMBINATORIAL ; +PIN 6 I6 COMBINATORIAL ; +PIN 7 I7 COMBINATORIAL ; +PIN 8 I8 COMBINATORIAL ; +PIN 9 I9 COMBINATORIAL ; +PIN 10 GND ; +PIN 11 I11 COMBINATORIAL ; +PIN 12 I12 COMBINATORIAL ; +PIN 13 I13 COMBINATORIAL ; +PIN 14 O14 COMBINATORIAL ; +PIN 15 O15 COMBINATORIAL ; +PIN 16 O16 COMBINATORIAL ; +PIN 17 O17 COMBINATORIAL ; +PIN 18 I18 COMBINATORIAL ; +PIN 19 I19 COMBINATORIAL ; +PIN 20 VCC ; + +;----------------------------------- Boolean Equation Segment ------ +EQUATIONS + +MINIMIZE_OFF + +/O14 = /I8 * I11 + + I4 + + /I12 + + I5 * /I11 + + I1 + + I7 * I12 + + /I3 * /I9 + + /I2 + +/O15 = I1 * I7 + + /I8 + + I5 + + /I13 + + /I3 + + I2 * I9 + + I4 + + /I3 * I13 + +/O16 = /I18 + + I3 * I11 + + I6 + + I6 * I18 + + /I1 + + /i5 * I7 * I8 + + /I2 * /I9 + + /I7 * /I8 + +/O17 = I2 * I19 + + /I9 + + /I19 + + I3 * I4 + + I6 * I9 + + /I5 + + /I1 * /I11 + + I7 + +MINIMIZE_ON + +;----------------------------------- Simulation Segment ------------ +SIMULATION + +;------------------------------------------------------------------- diff --git a/regtests/jedutil/eqns/PALASM/ampal18p8/pal16h2-as-ampal18p8.pds b/regtests/jedutil/eqns/PALASM/ampal18p8/pal16h2-as-ampal18p8.pds new file mode 100644 index 00000000000..d9b7a4509a9 --- /dev/null +++ b/regtests/jedutil/eqns/PALASM/ampal18p8/pal16h2-as-ampal18p8.pds @@ -0,0 +1,65 @@ +;PALASM Design Description + +;---------------------------------- Declaration Segment ------------ +TITLE PAL16H2 Test +PATTERN A +REVISION 1.0 +AUTHOR MAMEDev +COMPANY MAMEDev +DATE 08/25/13 + +CHIP PAL16H2Test PAL18P8 + +SIGNATURE #b0010011001100110011001100110011001100110011001100110011001100100 + +;---------------------------------- PIN Declarations --------------- +PIN 1 I1 COMBINATORIAL ; +PIN 2 I2 COMBINATORIAL ; +PIN 3 I3 COMBINATORIAL ; +PIN 4 I4 COMBINATORIAL ; +PIN 5 I5 COMBINATORIAL ; +PIN 6 I6 COMBINATORIAL ; +PIN 7 I7 COMBINATORIAL ; +PIN 8 I8 COMBINATORIAL ; +PIN 9 I9 COMBINATORIAL ; +PIN 10 GND ; +PIN 11 I11 COMBINATORIAL ; +PIN 12 I12 COMBINATORIAL ; +PIN 13 I13 COMBINATORIAL ; +PIN 14 I14 COMBINATORIAL ; +PIN 15 O15 COMBINATORIAL ; +PIN 16 O16 COMBINATORIAL ; +PIN 17 I17 COMBINATORIAL ; +PIN 18 I18 COMBINATORIAL ; +PIN 19 I19 COMBINATORIAL ; +PIN 20 VCC ; + +;----------------------------------- Boolean Equation Segment ------ +EQUATIONS + +MINIMIZE_OFF + +O15 = I5 + + /I13 * /I14 + + I1 * I7 + + /I3 * I14 + + /I3 * I13 + + I2 * I9 + + /I8 + + I4 + +O16 = I6 + + I3 * I11 + + I6 * I18 + + /I1 * /I17 + + /I18 + + /I7 * /I8 + + /I2 * /I9 + + /i5 * I7 * I8 * I17 + +MINIMIZE_ON + +;----------------------------------- Simulation Segment ------------ +SIMULATION + +;------------------------------------------------------------------- diff --git a/regtests/jedutil/eqns/PALASM/ampal18p8/pal16l2-as-ampal18p8.pds b/regtests/jedutil/eqns/PALASM/ampal18p8/pal16l2-as-ampal18p8.pds new file mode 100644 index 00000000000..3b7fd87a2c9 --- /dev/null +++ b/regtests/jedutil/eqns/PALASM/ampal18p8/pal16l2-as-ampal18p8.pds @@ -0,0 +1,65 @@ +;PALASM Design Description + +;---------------------------------- Declaration Segment ------------ +TITLE PAL16L2 Test +PATTERN A +REVISION 1.0 +AUTHOR MAMEDev +COMPANY MAMEDev +DATE 08/25/13 + +CHIP PAL16L2Test PAL18P8 + +SIGNATURE #b0010011001100110011001100110011001100110011001100110011001100100 + +;---------------------------------- PIN Declarations --------------- +PIN 1 I1 COMBINATORIAL ; +PIN 2 I2 COMBINATORIAL ; +PIN 3 I3 COMBINATORIAL ; +PIN 4 I4 COMBINATORIAL ; +PIN 5 I5 COMBINATORIAL ; +PIN 6 I6 COMBINATORIAL ; +PIN 7 I7 COMBINATORIAL ; +PIN 8 I8 COMBINATORIAL ; +PIN 9 I9 COMBINATORIAL ; +PIN 10 GND ; +PIN 11 I11 COMBINATORIAL ; +PIN 12 I12 COMBINATORIAL ; +PIN 13 I13 COMBINATORIAL ; +PIN 14 I14 COMBINATORIAL ; +PIN 15 O15 COMBINATORIAL ; +PIN 16 O16 COMBINATORIAL ; +PIN 17 I17 COMBINATORIAL ; +PIN 18 I18 COMBINATORIAL ; +PIN 19 I19 COMBINATORIAL ; +PIN 20 VCC ; + +;----------------------------------- Boolean Equation Segment ------ +EQUATIONS + +MINIMIZE_OFF + +/O15 = I5 * /I11 + + /I3 * I14 + + /I3 * I13 + + /I13 * /I14 + + I1 * I7 * I12 + + /I8 * I18 + + I2 * I9 + + I4 * I17 * /I19 + +/O16 = /I2 * /I9 * I19 + + I3 * I11 * /I18 + + /i5 * I7 * I8 * I17 + + I6 * I18 + + /I1 * I14 * /I17 + + I13 * /I18 + + /I7 * /I8 * /I12 + + I6 + +MINIMIZE_ON + +;----------------------------------- Simulation Segment ------------ +SIMULATION + +;------------------------------------------------------------------- diff --git a/regtests/jedutil/eqns/PALASM/ampal18p8/pal16l8-as-ampal18p8.pds b/regtests/jedutil/eqns/PALASM/ampal18p8/pal16l8-as-ampal18p8.pds new file mode 100644 index 00000000000..ff01258418b --- /dev/null +++ b/regtests/jedutil/eqns/PALASM/ampal18p8/pal16l8-as-ampal18p8.pds @@ -0,0 +1,119 @@ +;PALASM Design Description + +;---------------------------------- Declaration Segment ------------ +TITLE PAL16L8 Test 1 +PATTERN A +REVISION 1.0 +AUTHOR MAMEDev +COMPANY MAMEDev +DATE 08/25/13 + +CHIP PAL16L8 PAL18P8 + +SIGNATURE #b1110011001100110011001100110011001100110011001100110011001100110 + +;---------------------------------- PIN Declarations --------------- +PIN 1 I1 COMBINATORIAL ; +PIN 2 I2 COMBINATORIAL ; +PIN 3 I3 COMBINATORIAL ; +PIN 4 I4 COMBINATORIAL ; +PIN 5 I5 COMBINATORIAL ; +PIN 6 I6 COMBINATORIAL ; +PIN 7 I7 COMBINATORIAL ; +PIN 8 I8 COMBINATORIAL ; +PIN 9 I9 COMBINATORIAL ; +PIN 10 GND ; +PIN 11 I11 COMBINATORIAL ; +PIN 12 O12 COMBINATORIAL ; +PIN 13 O13 COMBINATORIAL ; +PIN 14 O14 COMBINATORIAL ; +PIN 15 O15 COMBINATORIAL ; +PIN 16 O16 COMBINATORIAL ; +PIN 17 O17 COMBINATORIAL ; +PIN 18 O18 COMBINATORIAL ; +PIN 19 O19 COMBINATORIAL ; +PIN 20 VCC ; + +;----------------------------------- Boolean Equation Segment ------ +EQUATIONS + +MINIMIZE_OFF + +O12 = I1 * /I2 + + /I1 * I3 + + /I3 * I7 + + I4 * O13 + + I6 * /O13 + + I6 * /I7 + + /I6 * /I8 * /I9 +O12.TRST = /I5 + +/O13 = I3 + + O14 + + /I11 + + I2 + + /I4 * /O14 + + I8 * I9 + + I5 +O13.TRST = VCC + +/O14 = I4 + + /I8 * I11 + + O15 + + /I2 + + I5 * /I11 + + I7 + + /I3 * /I9 +O14.TRST = I1 + +/O15 = I5 + + /O16 + + I1 * I7 + + /I3 + + /I3 * O16 + + I2 * I9 + + /I8 +O15.TRST = VCC + +/O16 = I6 + + I3 * I11 + + I6 * O17 + + /I1 + + /O17 + + /I7 * /I8 + + /I2 * /I9 +O16.TRST = /I11 + +/O17 = I7 + + I2 * O18 + + I3 * I4 + + /I5 + + /I9 + + /O18 + + /I1 * /I11 +O17.TRST = VCC + +O18 = I3 + + I8 + + I9 * I11 + + I1 + + /I4 + + I2 + + I5 * /I7 +O18.TRST = VCC + +O19 = O18 + + O17 + + O16 + + O15 + + O14 + + O13 + + /O13 * /O14 * /O15 * /O16 * /O17 * /O18 +O19.TRST = I3 + +MINIMIZE_ON + +;----------------------------------- Simulation Segment ------------ +SIMULATION + +;------------------------------------------------------------------- diff --git a/regtests/jedutil/jeds/ampal18p8/pal10h8-as-ampal18p8.jed b/regtests/jedutil/jeds/ampal18p8/pal10h8-as-ampal18p8.jed new file mode 100644 index 00000000000..0fb38aa728c --- /dev/null +++ b/regtests/jedutil/jeds/ampal18p8/pal10h8-as-ampal18p8.jed @@ -0,0 +1,90 @@ + +PALASM4 PAL ASSEMBLER - MARKET RELEASE 1.5a (8-20-92) + (C) - COPYRIGHT ADVANCED MICRO DEVICES INC., 1992 + + +TITLE :PAL10H8 Test AUTHOR :MAMEDev +PATTERN :A COMPANY:MAMEDev +REVISION:1.0 DATE :08/25/13 + + +PAL18P8 +PAL10H8TEST* +QP20* +QF2600* +G0*F0* +L0000 111111111111111111111111111111111111* +L0036 111101111111111111111111111111011111* +L0072 110111111111111111111111111111111111* +L0108 111011111111111111111111111110111111* +L0144 111110111111101111111011111111111111* +L0180 011111111111111111111111111111111111* +L0216 111111110111111111111111111111111111* +L0252 111111111111111101111111111111111111* +L0288 111111111111111111111111011111111111* +L0324 111111111111111111111111111111111111* +L0360 111011111111111111111111111111111111* +L0396 111110111111111111111111111111111111* +L0432 111111111111101111111111111111111111* +L0468 111111111111111111111011111111111111* +L0504 111111111111111111111111111110111111* +L0540 111111111111111111111111111111101111* +L0576 110111111111111111110111111111011111* +L0612 111101111111011111111111111101111111* +L0648 111111111111111111111111111111111111* +L0684 111111111111111111110111111111111111* +L0720 011111111111111111111111111101111111* +L0756 111101110111111111111111111111111111* +L0792 111111111111101111111111111111111111* +L0828 111111111111111111111111111110111111* +L0864 111111111111111111111111101111111111* +L0900 111011111111111111111111111111101111* +L0936 111111111111111101111111111101111111* +L0972 111111111111111111111111111111111111* +L1008 111111111111111101111111111111111111* +L1044 111101111111111111111111111111011111* +L1080 111111111111111101111111011111111111* +L1116 111011111111111111111111111111111111* +L1152 111111111111111111111111101111111111* +L1188 111111111111111111111011101111111111* +L1224 101111111111111111111111111110111111* +L1260 111111111111101111110111011111111111* +L1296 111111111111111111111111111111111111* +L1332 111111111111011111111111111111111111* +L1368 111011111111111111111111111111111111* +L1404 110111111111111111110111111111111111* +L1440 111110111111111111111111111111111111* +L1476 110110111111111111111111111111111111* +L1512 011111111111111111111111111101111111* +L1548 111111111111111111111111101111111111* +L1584 111111110111111111111111111111111111* +L1620 111111111111111111111111111111111111* +L1656 111111110111111111111111111111111111* +L1692 111111111111111111111111101111011111* +L1728 111111111111111110111111111111111111* +L1764 101111111111111111111111111111111111* +L1800 111111111111011111111111111111101111* +L1836 111111111111111111110111111111111111* +L1872 111110111111111111111111111110111111* +L1908 111011111111111111111111111111111111* +L1944 111111111111111111111111111111111111* +L1980 101111111111111111111111111111111111* +L2016 111111111011111111111111111111111111* +L2052 111110111111111110111111111111111111* +L2088 111111111111111111111111101111111111* +L2124 111111111111111111111111111111101111* +L2160 111111111111111111111111111110111111* +L2196 111011111111111111111011111111111111* +L2232 111111111111101111111111111111111111* +L2268 111111111111111111111111111111111111* +L2304 011111111111111111111111111111111111* +L2340 110101111111111111111111111111111111* +L2376 111111110111111111111111111111101111* +L2412 111111111111011111111111111111111111* +L2448 111111111111111101111111111111111111* +L2484 111011111111111111110111111111111111* +L2520 111111111111111111111111011111111111* +L2556 111111111111111111111111111101011111* +L2592 11111111* +C3B70* +67FE diff --git a/regtests/jedutil/jeds/ampal18p8/pal10l8-as-ampal18p8.jed b/regtests/jedutil/jeds/ampal18p8/pal10l8-as-ampal18p8.jed new file mode 100644 index 00000000000..8c4757be5ad --- /dev/null +++ b/regtests/jedutil/jeds/ampal18p8/pal10l8-as-ampal18p8.jed @@ -0,0 +1,90 @@ + +PALASM4 PAL ASSEMBLER - MARKET RELEASE 1.5a (8-20-92) + (C) - COPYRIGHT ADVANCED MICRO DEVICES INC., 1992 + + +TITLE :PAL10L8 Test AUTHOR :MAMEDev +PATTERN :A COMPANY:MAMEDev +REVISION:1.0 DATE :08/25/13 + + +PAL18P8 +PAL10L8TEST* +QP20* +QF2600* +G0*F0* +L0000 111111111111111111111111111111111111* +L0036 111110111111101111111011111111111111* +L0072 011111111111111111111111111111111111* +L0108 111111111111111111111111011111111111* +L0144 111101111111111111111111111111011111* +L0180 110111111111111111111111111111111111* +L0216 111111110111111111111111111111111111* +L0252 111111111111111101111111111111111111* +L0288 111011111111111111111111111110111111* +L0324 111111111111111111111111111111111111* +L0360 111111111111111111111111111110111111* +L0396 111101111111011111111111111101111111* +L0432 111111111111111111111011111111111111* +L0468 111111111111111111111111111111101111* +L0504 111011111111111111111111111111111111* +L0540 111110111111111111111111111111111111* +L0576 111111111111101111111111111111111111* +L0612 110111111111111111110111111111011111* +L0648 111111111111111111111111111111111111* +L0684 111101110111111111111111111111111111* +L0720 111111111111101111111111111111111111* +L0756 111111111111111111111111111110111111* +L0792 111011111111111111111111111111101111* +L0828 111111111111111111110111111111111111* +L0864 011111111111111111111111111101111111* +L0900 111111111111111101111111111101111111* +L0936 111111111111111111111111101111111111* +L0972 111111111111111111111111111111111111* +L1008 111111111111111101111111111111111111* +L1044 101111111111111111111111111110111111* +L1080 111101111111111111111111111111011111* +L1116 111111111111111111111111101111111111* +L1152 111111111111111101111111011111111111* +L1188 111011111111111111111111111111111111* +L1224 111111111111101111110111011111111111* +L1260 111111111111111111111011101111111111* +L1296 111111111111111111111111111111111111* +L1332 111111110111111111111111111111111111* +L1368 110110111111111111111111111111111111* +L1404 011111111111111111111111111101111111* +L1440 111111111111011111111111111111111111* +L1476 110111111111111111110111111111111111* +L1512 111110111111111111111111111111111111* +L1548 111111111111111111111111101111111111* +L1584 111011111111111111111111111111111111* +L1620 111111111111111111111111111111111111* +L1656 111110111111111111111111111110111111* +L1692 111111111111111110111111111111111111* +L1728 101111111111111111111111111111111111* +L1764 111111110111111111111111111111111111* +L1800 111111111111111111111111101111011111* +L1836 111111111111111111110111111111111111* +L1872 111111111111011111111111111111101111* +L1908 111011111111111111111111111111111111* +L1944 111111111111111111111111111111111111* +L1980 111111111111111111111111101111111111* +L2016 111111111111111111111111111111101111* +L2052 111111111111111111111111111110111111* +L2088 111110111111111110111111111111111111* +L2124 111011111111111111111011111111111111* +L2160 101111111111111111111111111111111111* +L2196 111111111011111111111111111111111111* +L2232 111111111111101111111111111111111111* +L2268 111111111111111111111111111111111111* +L2304 111011111111111111110111111111111111* +L2340 111111111111111111111111011111111111* +L2376 111111111111111111111111111101011111* +L2412 011111111111111111111111111111111111* +L2448 110101111111111111111111111111111111* +L2484 111111111111011111111111111111111111* +L2520 111111110111111111111111111111101111* +L2556 111111111111111101111111111111111111* +L2592 00000000* +C3981* +67F3 diff --git a/regtests/jedutil/jeds/ampal18p8/pal12h6-as-ampal18p8.jed b/regtests/jedutil/jeds/ampal18p8/pal12h6-as-ampal18p8.jed new file mode 100644 index 00000000000..0af9422206e --- /dev/null +++ b/regtests/jedutil/jeds/ampal18p8/pal12h6-as-ampal18p8.jed @@ -0,0 +1,90 @@ + +PALASM4 PAL ASSEMBLER - MARKET RELEASE 1.5a (8-20-92) + (C) - COPYRIGHT ADVANCED MICRO DEVICES INC., 1992 + + +TITLE :PAL12H6 Test AUTHOR :MAMEDev +PATTERN :A COMPANY:MAMEDev +REVISION:1.0 DATE :08/25/13 + + +PAL18P8 +PAL12H6TEST* +QP20* +QF2600* +G0*F0* +L0000 000000000000000000000000000000000000* +L0036 000000000000000000000000000000000000* +L0072 000000000000000000000000000000000000* +L0108 000000000000000000000000000000000000* +L0144 000000000000000000000000000000000000* +L0180 000000000000000000000000000000000000* +L0216 000000000000000000000000000000000000* +L0252 000000000000000000000000000000000000* +L0288 000000000000000000000000000000000000* +L0324 111111111111111111111111111111111111* +L0360 111011111111111111111111111111111111* +L0396 111110111111111111111111111111111111* +L0432 111111111111101111111111111111111111* +L0468 111111111111111111111011111111111111* +L0504 111111111111111111111111111110111011* +L0540 111111111111111111111111111111101111* +L0576 110111111111111111110111111111011111* +L0612 111101111111011111111111111101111111* +L0648 111111111111111111111111111111111111* +L0684 111111111111111111110111111111111101* +L0720 011111111111111111111111111101111111* +L0756 111101110111111111111111111111111111* +L0792 111111111111101111111111111111111111* +L0828 111111111111111111111111111110111111* +L0864 111111111111111111111111101111111111* +L0900 111011111111111111111111111111101111* +L0936 111111111111111101111111111101111111* +L0972 111111111111111111111111111111111111* +L1008 111111111111111101111111111111111111* +L1044 111101111111111111111111111111011111* +L1080 111111111111111101111111011111111111* +L1116 111011111111111111111111111111111111* +L1152 111111111111111111111111101111111111* +L1188 111111111111111111111011101111111111* +L1224 101111111111111111111111111110111111* +L1260 111111111111101111110111011111111111* +L1296 111111111111111111111111111111111111* +L1332 111111111111011111111111111111110111* +L1368 111011111111111111111111111111111111* +L1404 110111111111111111110111111111111111* +L1440 111110111111111111111111111111111111* +L1476 110110111111111111111111111111111111* +L1512 011111111111111111111111111101111111* +L1548 111111111111111111111111101111111111* +L1584 111111110111111111111111111111111111* +L1620 111111111111111111111111111111111111* +L1656 111111110111111111111111111111111111* +L1692 111111111111111111111111101111011111* +L1728 111111111111111110111111111111111111* +L1764 101111111111111111111111111111111111* +L1800 111111111111011111111111111111101111* +L1836 111111111111111111110111111111111111* +L1872 111110111111111111111111111110111111* +L1908 111011111111111111111111111111111110* +L1944 111111111111111111111111111111111111* +L1980 101111111111111111111111111111111111* +L2016 111111111011111111111111111111111111* +L2052 111110111111111110111111111111111111* +L2088 111111111111111111111111101111111111* +L2124 111111111111111111111111111111101111* +L2160 111111111111111111111111111110111111* +L2196 111011111111111111111011111111111111* +L2232 111111111111101111111111111111111111* +L2268 000000000000000000000000000000000000* +L2304 000000000000000000000000000000000000* +L2340 000000000000000000000000000000000000* +L2376 000000000000000000000000000000000000* +L2412 000000000000000000000000000000000000* +L2448 000000000000000000000000000000000000* +L2484 000000000000000000000000000000000000* +L2520 000000000000000000000000000000000000* +L2556 000000000000000000000000000000000000* +L2592 01111110* +CEBC7* +65AD diff --git a/regtests/jedutil/jeds/ampal18p8/pal12l6-as-ampal18p8.jed b/regtests/jedutil/jeds/ampal18p8/pal12l6-as-ampal18p8.jed new file mode 100644 index 00000000000..0e75276288c --- /dev/null +++ b/regtests/jedutil/jeds/ampal18p8/pal12l6-as-ampal18p8.jed @@ -0,0 +1,90 @@ + +PALASM4 PAL ASSEMBLER - MARKET RELEASE 1.5a (8-20-92) + (C) - COPYRIGHT ADVANCED MICRO DEVICES INC., 1992 + + +TITLE :PAL12L6 Test AUTHOR :MAMEDev +PATTERN :A COMPANY:MAMEDev +REVISION:1.0 DATE :08/25/13 + + +PAL18P8 +PAL12L6TEST* +QP20* +QF2600* +G0*F0* +L0000 000000000000000000000000000000000000* +L0036 000000000000000000000000000000000000* +L0072 000000000000000000000000000000000000* +L0108 000000000000000000000000000000000000* +L0144 000000000000000000000000000000000000* +L0180 000000000000000000000000000000000000* +L0216 000000000000000000000000000000000000* +L0252 000000000000000000000000000000000000* +L0288 000000000000000000000000000000000000* +L0324 111111111111111111111111111111111111* +L0360 111111111111111111111111111110111111* +L0396 111101111111011111111111111101111111* +L0432 111111111111111111111011111111111111* +L0468 111111111111111111111111111111101111* +L0504 111011111111111111111111111111111111* +L0540 111110111111111111111111111111111111* +L0576 111111111111101111111111111111111111* +L0612 110111111111111111110111111111011111* +L0648 111111111111111111111111111111111111* +L0684 111101110111111111111111111111111111* +L0720 111111111111101111111111111111111111* +L0756 111111111111111111111111111110111111* +L0792 111011111111111111111111111111101111* +L0828 111111111111111111110111111111111111* +L0864 011111111111111111111111111101111011* +L0900 111111111111111101111111111101111111* +L0936 111111111111111111111111101111111111* +L0972 111111111111111111111111111111111111* +L1008 111111111111111101111111111111111111* +L1044 101111111111111111111111111110111111* +L1080 111101111111111111111111111111011111* +L1116 111111111111111111111111101111111111* +L1152 111111111111111101111111011111111111* +L1188 111011111111111111111111111111111111* +L1224 111111111111101111110111011111111111* +L1260 111111111111111111111011101111111101* +L1296 111111111111111111111111111111111111* +L1332 111111110111111111111111111111111111* +L1368 110110111111111111111111111111111111* +L1404 011111111111111111111111111101111111* +L1440 111111111111011111111111111111111111* +L1476 110111111111111111110111111111111111* +L1512 111110111111111111111111111111111111* +L1548 111111111111111111111111101111111111* +L1584 111011111111111111111111111111111111* +L1620 111111111111111111111111111111111111* +L1656 111110111111111111111111111110110111* +L1692 111111111111111110111111111111111111* +L1728 101111111111111111111111111111111111* +L1764 111111110111111111111111111111111111* +L1800 111111111111111111111111101111011111* +L1836 111111111111111111110111111111111111* +L1872 111111111111011111111111111111101111* +L1908 111011111111111111111111111111111111* +L1944 111111111111111111111111111111111111* +L1980 111111111111111111111111101111111111* +L2016 111111111111111111111111111111101111* +L2052 111111111111111111111111111110111111* +L2088 111110111111111110111111111111111111* +L2124 111011111111111111111011111111111111* +L2160 101111111111111111111111111111111111* +L2196 111111111011111111111111111111111110* +L2232 111111111111101111111111111111111111* +L2268 000000000000000000000000000000000000* +L2304 000000000000000000000000000000000000* +L2340 000000000000000000000000000000000000* +L2376 000000000000000000000000000000000000* +L2412 000000000000000000000000000000000000* +L2448 000000000000000000000000000000000000* +L2484 000000000000000000000000000000000000* +L2520 000000000000000000000000000000000000* +L2556 000000000000000000000000000000000000* +L2592 00000000* +CEA1D* +65A5 diff --git a/regtests/jedutil/jeds/ampal18p8/pal14h4-as-ampal18p8.jed b/regtests/jedutil/jeds/ampal18p8/pal14h4-as-ampal18p8.jed new file mode 100644 index 00000000000..4c12853a026 --- /dev/null +++ b/regtests/jedutil/jeds/ampal18p8/pal14h4-as-ampal18p8.jed @@ -0,0 +1,90 @@ + +PALASM4 PAL ASSEMBLER - MARKET RELEASE 1.5a (8-20-92) + (C) - COPYRIGHT ADVANCED MICRO DEVICES INC., 1992 + + +TITLE :PAL14H4 Test AUTHOR :MAMEDev +PATTERN :A COMPANY:MAMEDev +REVISION:1.0 DATE :08/25/13 + + +PAL18P8 +PAL14H4TEST* +QP20* +QF2600* +G0*F0* +L0000 000000000000000000000000000000000000* +L0036 000000000000000000000000000000000000* +L0072 000000000000000000000000000000000000* +L0108 000000000000000000000000000000000000* +L0144 000000000000000000000000000000000000* +L0180 000000000000000000000000000000000000* +L0216 000000000000000000000000000000000000* +L0252 000000000000000000000000000000000000* +L0288 000000000000000000000000000000000000* +L0324 000000000000000000000000000000000000* +L0360 000000000000000000000000000000000000* +L0396 000000000000000000000000000000000000* +L0432 000000000000000000000000000000000000* +L0468 000000000000000000000000000000000000* +L0504 000000000000000000000000000000000000* +L0540 000000000000000000000000000000000000* +L0576 000000000000000000000000000000000000* +L0612 000000000000000000000000000000000000* +L0648 111111111111111111111111111111111111* +L0684 111111111111111111110111111111111111* +L0720 011111111111111111111111111111110111* +L0756 111101110111111111111111111111111111* +L0792 111111111111101111111111111111111111* +L0828 111111111111111111111111111110111111* +L0864 111111111111111111111111111111111011* +L0900 111011111111111111111111111111101111* +L0936 111111111111111101111111111101111111* +L0972 111111111111111111111111111111111111* +L1008 111111111111111101111111111111111111* +L1044 111101111111111111111111111111011111* +L1080 111111011111111101111111111111111111* +L1116 111011111111111111111111111111111111* +L1152 111111101111111111111111111111111111* +L1188 111111111111111111111011101111111111* +L1224 101111111111111111111111111110111111* +L1260 111111111111101111110111011111111111* +L1296 111111111111111111111111111111111111* +L1332 111111111111011111111111111111111111* +L1368 111111111111111111111111111011111111* +L1404 110111111111111111110111111111111111* +L1440 111110111111111111111111111111111111* +L1476 111110111111111111111111110111111111* +L1512 011111111111111111111111111101111111* +L1548 111111111111111111111111101111111111* +L1584 111111110111111111111111111111111111* +L1620 111111111111111111111111111111111111* +L1656 111111110111111111111111111111111111* +L1692 111111111111111111111111101111011111* +L1728 111111111111111111111111111111111110* +L1764 101111111111111111111111111111111111* +L1800 111111111111011111111111111111101111* +L1836 111111111111111111110111111111111101* +L1872 111110111111111111111111111110111111* +L1908 111011111111111111111111111111111111* +L1944 000000000000000000000000000000000000* +L1980 000000000000000000000000000000000000* +L2016 000000000000000000000000000000000000* +L2052 000000000000000000000000000000000000* +L2088 000000000000000000000000000000000000* +L2124 000000000000000000000000000000000000* +L2160 000000000000000000000000000000000000* +L2196 000000000000000000000000000000000000* +L2232 000000000000000000000000000000000000* +L2268 000000000000000000000000000000000000* +L2304 000000000000000000000000000000000000* +L2340 000000000000000000000000000000000000* +L2376 000000000000000000000000000000000000* +L2412 000000000000000000000000000000000000* +L2448 000000000000000000000000000000000000* +L2484 000000000000000000000000000000000000* +L2520 000000000000000000000000000000000000* +L2556 000000000000000000000000000000000000* +L2592 00111100* +C9C6F* +6333 diff --git a/regtests/jedutil/jeds/ampal18p8/pal14l4-as-ampal18p8.jed b/regtests/jedutil/jeds/ampal18p8/pal14l4-as-ampal18p8.jed new file mode 100644 index 00000000000..26c645dcc77 --- /dev/null +++ b/regtests/jedutil/jeds/ampal18p8/pal14l4-as-ampal18p8.jed @@ -0,0 +1,90 @@ + +PALASM4 PAL ASSEMBLER - MARKET RELEASE 1.5a (8-20-92) + (C) - COPYRIGHT ADVANCED MICRO DEVICES INC., 1992 + + +TITLE :PAL14L4 Test AUTHOR :MAMEDev +PATTERN :A COMPANY:MAMEDev +REVISION:1.0 DATE :08/25/13 + + +PAL18P8 +PAL14L4TEST* +QP20* +QF2600* +G0*F0* +L0000 000000000000000000000000000000000000* +L0036 000000000000000000000000000000000000* +L0072 000000000000000000000000000000000000* +L0108 000000000000000000000000000000000000* +L0144 000000000000000000000000000000000000* +L0180 000000000000000000000000000000000000* +L0216 000000000000000000000000000000000000* +L0252 000000000000000000000000000000000000* +L0288 000000000000000000000000000000000000* +L0324 000000000000000000000000000000000000* +L0360 000000000000000000000000000000000000* +L0396 000000000000000000000000000000000000* +L0432 000000000000000000000000000000000000* +L0468 000000000000000000000000000000000000* +L0504 000000000000000000000000000000000000* +L0540 000000000000000000000000000000000000* +L0576 000000000000000000000000000000000000* +L0612 000000000000000000000000000000000000* +L0648 111111111111111111111111111111111111* +L0684 011111111111111111111111111111110111* +L0720 111111111111111111111111111110111111* +L0756 111111111111111111111111111111111011* +L0792 111101110111111111111111111111111111* +L0828 111111111111111101111111111101111111* +L0864 111111111111101111111111111111111111* +L0900 111011111111111111111111111111101111* +L0936 111111111111111111110111111111111111* +L0972 111111111111111111111111111111111111* +L1008 111111101111111111111111111111111111* +L1044 111101111111111111111111111111011111* +L1080 111111111111111101111111111111111111* +L1116 111111011111111101111111111111111111* +L1152 111011111111111111111111111111111111* +L1188 111111111111101111110111011111111111* +L1224 101111111111111111111111111110111111* +L1260 111111111111111111111011101111111111* +L1296 111111111111111111111111111111111111* +L1332 110111111111111111110111111111111111* +L1368 111111111111111111111111101111111111* +L1404 111111111111011111111111111111111111* +L1440 111111111111111111111111111011111111* +L1476 111110111111111111111111111111111111* +L1512 011111111111111111111111111101111111* +L1548 111111110111111111111111111111111111* +L1584 111110111111111111111111110111111111* +L1620 111111111111111111111111111111111111* +L1656 111111111111111111111111101111011111* +L1692 111111110111111111111111111111111111* +L1728 111111111111111111111111111111111110* +L1764 111111111111011111111111111111101111* +L1800 110111111111111111111111111111111111* +L1836 111111111111111111110111111111111101* +L1872 111110111111111111111111111110111111* +L1908 101111111111111111111111111111111111* +L1944 000000000000000000000000000000000000* +L1980 000000000000000000000000000000000000* +L2016 000000000000000000000000000000000000* +L2052 000000000000000000000000000000000000* +L2088 000000000000000000000000000000000000* +L2124 000000000000000000000000000000000000* +L2160 000000000000000000000000000000000000* +L2196 000000000000000000000000000000000000* +L2232 000000000000000000000000000000000000* +L2268 000000000000000000000000000000000000* +L2304 000000000000000000000000000000000000* +L2340 000000000000000000000000000000000000* +L2376 000000000000000000000000000000000000* +L2412 000000000000000000000000000000000000* +L2448 000000000000000000000000000000000000* +L2484 000000000000000000000000000000000000* +L2520 000000000000000000000000000000000000* +L2556 000000000000000000000000000000000000* +L2592 00000000* +C9D90* +6321 diff --git a/regtests/jedutil/jeds/ampal18p8/pal16h2-as-ampal18p8.jed b/regtests/jedutil/jeds/ampal18p8/pal16h2-as-ampal18p8.jed new file mode 100644 index 00000000000..5482c396281 --- /dev/null +++ b/regtests/jedutil/jeds/ampal18p8/pal16h2-as-ampal18p8.jed @@ -0,0 +1,90 @@ + +PALASM4 PAL ASSEMBLER - MARKET RELEASE 1.5a (8-20-92) + (C) - COPYRIGHT ADVANCED MICRO DEVICES INC., 1992 + + +TITLE :PAL16H2 Test AUTHOR :MAMEDev +PATTERN :A COMPANY:MAMEDev +REVISION:1.0 DATE :08/25/13 + + +PAL18P8 +PAL16H2TEST* +QP20* +QF2600* +G0*F0* +L0000 000000000000000000000000000000000000* +L0036 000000000000000000000000000000000000* +L0072 000000000000000000000000000000000000* +L0108 000000000000000000000000000000000000* +L0144 000000000000000000000000000000000000* +L0180 000000000000000000000000000000000000* +L0216 000000000000000000000000000000000000* +L0252 000000000000000000000000000000000000* +L0288 000000000000000000000000000000000000* +L0324 000000000000000000000000000000000000* +L0360 000000000000000000000000000000000000* +L0396 000000000000000000000000000000000000* +L0432 000000000000000000000000000000000000* +L0468 000000000000000000000000000000000000* +L0504 000000000000000000000000000000000000* +L0540 000000000000000000000000000000000000* +L0576 000000000000000000000000000000000000* +L0612 000000000000000000000000000000000000* +L0648 000000000000000000000000000000000000* +L0684 000000000000000000000000000000000000* +L0720 000000000000000000000000000000000000* +L0756 000000000000000000000000000000000000* +L0792 000000000000000000000000000000000000* +L0828 000000000000000000000000000000000000* +L0864 000000000000000000000000000000000000* +L0900 000000000000000000000000000000000000* +L0936 000000000000000000000000000000000000* +L0972 111111111111111111111111111111111111* +L1008 111111111111111101111111111111111111* +L1044 111101111111111111111111111111011111* +L1080 111111011111111101111111111111111111* +L1116 111011111110111111111111111111111111* +L1152 111111101111111111111111111111111111* +L1188 111111111111111111111011101111111111* +L1224 101111111111111111111111111110111111* +L1260 111111111101101111110111011111111111* +L1296 111111111111111111111111111111111111* +L1332 111111111111011111111111111111111111* +L1368 111111111111111111111110111011111111* +L1404 110111111111111111110111111111111111* +L1440 111110111111111111111101111111111111* +L1476 111110111111111111111111110111111111* +L1512 011111111111111111111111111101111111* +L1548 111111111111111111111111101111111111* +L1584 111111110111111111111111111111111111* +L1620 000000000000000000000000000000000000* +L1656 000000000000000000000000000000000000* +L1692 000000000000000000000000000000000000* +L1728 000000000000000000000000000000000000* +L1764 000000000000000000000000000000000000* +L1800 000000000000000000000000000000000000* +L1836 000000000000000000000000000000000000* +L1872 000000000000000000000000000000000000* +L1908 000000000000000000000000000000000000* +L1944 000000000000000000000000000000000000* +L1980 000000000000000000000000000000000000* +L2016 000000000000000000000000000000000000* +L2052 000000000000000000000000000000000000* +L2088 000000000000000000000000000000000000* +L2124 000000000000000000000000000000000000* +L2160 000000000000000000000000000000000000* +L2196 000000000000000000000000000000000000* +L2232 000000000000000000000000000000000000* +L2268 000000000000000000000000000000000000* +L2304 000000000000000000000000000000000000* +L2340 000000000000000000000000000000000000* +L2376 000000000000000000000000000000000000* +L2412 000000000000000000000000000000000000* +L2448 000000000000000000000000000000000000* +L2484 000000000000000000000000000000000000* +L2520 000000000000000000000000000000000000* +L2556 000000000000000000000000000000000000* +L2592 00011000* +C4CCB* +60C1 diff --git a/regtests/jedutil/jeds/ampal18p8/pal16l2-as-ampal18p8.jed b/regtests/jedutil/jeds/ampal18p8/pal16l2-as-ampal18p8.jed new file mode 100644 index 00000000000..46172b48c41 --- /dev/null +++ b/regtests/jedutil/jeds/ampal18p8/pal16l2-as-ampal18p8.jed @@ -0,0 +1,90 @@ + +PALASM4 PAL ASSEMBLER - MARKET RELEASE 1.5a (8-20-92) + (C) - COPYRIGHT ADVANCED MICRO DEVICES INC., 1992 + + +TITLE :PAL16L2 Test AUTHOR :MAMEDev +PATTERN :A COMPANY:MAMEDev +REVISION:1.0 DATE :08/25/13 + + +PAL18P8 +PAL16L2TEST* +QP20* +QF2600* +G0*F0* +L0000 000000000000000000000000000000000000* +L0036 000000000000000000000000000000000000* +L0072 000000000000000000000000000000000000* +L0108 000000000000000000000000000000000000* +L0144 000000000000000000000000000000000000* +L0180 000000000000000000000000000000000000* +L0216 000000000000000000000000000000000000* +L0252 000000000000000000000000000000000000* +L0288 000000000000000000000000000000000000* +L0324 000000000000000000000000000000000000* +L0360 000000000000000000000000000000000000* +L0396 000000000000000000000000000000000000* +L0432 000000000000000000000000000000000000* +L0468 000000000000000000000000000000000000* +L0504 000000000000000000000000000000000000* +L0540 000000000000000000000000000000000000* +L0576 000000000000000000000000000000000000* +L0612 000000000000000000000000000000000000* +L0648 000000000000000000000000000000000000* +L0684 000000000000000000000000000000000000* +L0720 000000000000000000000000000000000000* +L0756 000000000000000000000000000000000000* +L0792 000000000000000000000000000000000000* +L0828 000000000000000000000000000000000000* +L0864 000000000000000000000000000000000000* +L0900 000000000000000000000000000000000000* +L0936 000000000000000000000000000000000000* +L0972 111111111111111111111111111111111111* +L1008 101111111111111111111111111110110111* +L1044 111101101111111111111111111111011111* +L1080 111111111101101111110111011111111111* +L1116 111111011111111101111111111111111111* +L1152 111011111110111111111101111111111111* +L1188 111111101111111111111111110111111111* +L1224 111111111111111111111011101111111110* +L1260 111111111111111101111111111111111111* +L1296 111111111111111111111111111111111111* +L1332 111111111111011111111111111111101111* +L1368 111110111111111111111101111111111111* +L1404 111110111111111111111111110111111111* +L1440 111111111111111111111110111011111111* +L1476 110111111111111111110111111111111101* +L1512 111111011111111111111111101111111111* +L1548 011111111111111111111111111101111111* +L1584 111111110101111111111111111111111011* +L1620 000000000000000000000000000000000000* +L1656 000000000000000000000000000000000000* +L1692 000000000000000000000000000000000000* +L1728 000000000000000000000000000000000000* +L1764 000000000000000000000000000000000000* +L1800 000000000000000000000000000000000000* +L1836 000000000000000000000000000000000000* +L1872 000000000000000000000000000000000000* +L1908 000000000000000000000000000000000000* +L1944 000000000000000000000000000000000000* +L1980 000000000000000000000000000000000000* +L2016 000000000000000000000000000000000000* +L2052 000000000000000000000000000000000000* +L2088 000000000000000000000000000000000000* +L2124 000000000000000000000000000000000000* +L2160 000000000000000000000000000000000000* +L2196 000000000000000000000000000000000000* +L2232 000000000000000000000000000000000000* +L2268 000000000000000000000000000000000000* +L2304 000000000000000000000000000000000000* +L2340 000000000000000000000000000000000000* +L2376 000000000000000000000000000000000000* +L2412 000000000000000000000000000000000000* +L2448 000000000000000000000000000000000000* +L2484 000000000000000000000000000000000000* +L2520 000000000000000000000000000000000000* +L2556 000000000000000000000000000000000000* +L2592 00000000* +C4D56* +60A0 diff --git a/regtests/jedutil/jeds/ampal18p8/pal16l8-as-ampal18p8.jed b/regtests/jedutil/jeds/ampal18p8/pal16l8-as-ampal18p8.jed new file mode 100644 index 00000000000..24a3d01d789 --- /dev/null +++ b/regtests/jedutil/jeds/ampal18p8/pal16l8-as-ampal18p8.jed @@ -0,0 +1,90 @@ + +PALASM4 PAL ASSEMBLER - MARKET RELEASE 1.5a (8-20-92) + (C) - COPYRIGHT ADVANCED MICRO DEVICES INC., 1992 + + +TITLE :PAL16L8 Test 1 AUTHOR :MAMEDev +PATTERN :A COMPANY:MAMEDev +REVISION:1.0 DATE :08/25/13 + + +PAL18P8 +PAL16L8* +QP20* +QF2600* +G0*F0* +L0000 111101111111111111111111111111111111* +L0036 111111011111111111111111111111111111* +L0072 111111111101111111111111111111111111* +L0108 111111111111110111111111111111111111* +L0144 111111111111111111011111111111111111* +L0180 111111111111111111111101111111111111* +L0216 111111111111111111111111110111111111* +L0252 111111101110111011101110111011111111* +L0288 000000000000000000000000000000000000* +L0324 111111111111111111111111111111111111* +L0360 111101111111111111111111111111111111* +L0396 111111111111111111111111011111111111* +L0432 111111111111111111111111111101011111* +L0468 110111111111111111111111111111111111* +L0504 111111111011111111111111111111111111* +L0540 011111111111111111111111111111111111* +L0576 111111111111011111111011111111111111* +L0612 000000000000000000000000000000000000* +L0648 111111111111111111111111111111111111* +L0684 111111111111111111110111111111111111* +L0720 011111011111111111111111111111111111* +L0756 111101110111111111111111111111111111* +L0792 111111111111101111111111111111111111* +L0828 111111111111111111111111111110111111* +L0864 111111101111111111111111111111111111* +L0900 111011111111111111111111111111101111* +L0936 000000000000000000000000000000000000* +L0972 111111111111111111111111111111101111* +L1008 111111111111111101111111111111111111* +L1044 111101111111111111111111111111011111* +L1080 111111111101111101111111111111111111* +L1116 111011111111111111111111111111111111* +L1152 111111111110111111111111111111111111* +L1188 111111111111111111111011101111111111* +L1224 101111111111111111111111111110111111* +L1260 000000000000000000000000000000000000* +L1296 111111111111111111111111111111111111* +L1332 111111111111011111111111111111111111* +L1368 111111111111111011111111111111111111* +L1404 110111111111111111110111111111111111* +L1440 111110111111111111111111111111111111* +L1476 111110111111110111111111111111111111* +L1512 011111111111111111111111111101111111* +L1548 111111111111111111111111101111111111* +L1584 000000000000000000000000000000000000* +L1620 110111111111111111111111111111111111* +L1656 111111110111111111111111111111111111* +L1692 111111111111111111111111101111011111* +L1728 111111111111111111011111111111111111* +L1764 101111111111111111111111111111111111* +L1800 111111111111011111111111111111101111* +L1836 111111111111111111110111111111111111* +L1872 111110111111111111111111111110111111* +L1908 000000000000000000000000000000000000* +L1944 111111111111111111111111111111111111* +L1980 111101111111111111111111111111111111* +L2016 111111111111111111111101111111111111* +L2052 111111111111111111111111111111101111* +L2088 011111111111111111111111111111111111* +L2124 111111111011111111111110111111111111* +L2160 111111111111111111111111011101111111* +L2196 111111111111011111111111111111111111* +L2232 000000000000000000000000000000000000* +L2268 111111111111101111111111111111111111* +L2304 100111111111111111111111111111111111* +L2340 111001111111111111111111111111111111* +L2376 111110111111111111110111111111111111* +L2412 111111110111111111111111110111111111* +L2448 111111111111111101111111111011111111* +L2484 111111111111111101111011111111111111* +L2520 111111111111111110111111101110111111* +L2556 000000000000000000000000000000000000* +L2592 11000001* +C1616* +6599 -- cgit v1.2.3-70-g09d2 From 7c5b979ffae1a2b1e8884146f5b566f9ed2f966d Mon Sep 17 00:00:00 2001 From: Michele Fochi Date: Sat, 13 Feb 2016 21:21:22 +0100 Subject: Fix osd message --- src/emu/ui/ui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 38bfea64fd9..953882f8b07 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -1780,7 +1780,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co { bool autofire_toggle = machine.ioport().get_autofire_toggle(); machine.ioport().set_autofire_toggle(!autofire_toggle); - machine.popmessage("Autofire %s", autofire_toggle ? "Disabled" : "Enabled"); + machine.popmessage("Autofire %s", autofire_toggle ? "Enabled" : "Disabled"); } } -- cgit v1.2.3-70-g09d2 From ee9f7d9655df79b0e31ce04f5cdb2037686b25ef Mon Sep 17 00:00:00 2001 From: Kevin Eshbach Date: Sat, 13 Feb 2016 15:23:40 -0500 Subject: Added support for the AMPAL18P8 --- src/tools/jedutil.cpp | 126 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 109 insertions(+), 17 deletions(-) diff --git a/src/tools/jedutil.cpp b/src/tools/jedutil.cpp index 284b77ae217..a6cfc279e2a 100644 --- a/src/tools/jedutil.cpp +++ b/src/tools/jedutil.cpp @@ -57,11 +57,13 @@ 18CV8 = QP20 QF2696 + AMPAL18P8 = QP20 QF2600 + EPL10P8 = QP20 EPL12P6 = QP20 EPL14P4 = QP20 EPL16P2 = QP20 - EPL16P8 = QP20 + EPL16P8 = QP20 QF2072 EPL16RP8 = QP20 EPL16RP6 = QP20 EPL16RP4 = QP20 @@ -272,6 +274,7 @@ static void print_pal16r8_product_terms(const pal_data* pal, const jed_data* jed static void print_palce16v8_product_terms(const pal_data* pal, const jed_data* jed); static void print_gal16v8_product_terms(const pal_data* pal, const jed_data* jed); static void print_peel18cv8_product_terms(const pal_data* pal, const jed_data* jed); +static void print_ampal18p8_product_terms(const pal_data* pal, const jed_data* jed); static void print_gal18v10_product_terms(const pal_data* pal, const jed_data* jed); static void print_pal20l8_product_terms(const pal_data* pal, const jed_data* jed); static void print_pal20l10_product_terms(const pal_data* pal, const jed_data* jed); @@ -332,6 +335,7 @@ static void config_pal16r8_pins(const pal_data* pal, const jed_data* jed); static void config_palce16v8_pins(const pal_data* pal, const jed_data* jed); static void config_gal16v8_pins(const pal_data* pal, const jed_data* jed); static void config_peel18cv8_pins(const pal_data* pal, const jed_data* jed); +static void config_ampal18p8_pins(const pal_data* pal, const jed_data* jed); static void config_gal18v10_pins(const pal_data* pal, const jed_data* jed); static void config_pal20l8_pins(const pal_data* pal, const jed_data* jed); static void config_pal20l10_pins(const pal_data* pal, const jed_data* jed); @@ -530,6 +534,16 @@ static pin_fuse_rows peel18cv8pinfuserows[] = { {18, 2340, 288, 540}, {19, 2304, 0, 252}}; +static pin_fuse_rows ampal18p8pinfuserows[] = { + {12, 2268, 2304, 2556}, + {13, 1944, 1980, 2232}, + {14, 1620, 1656, 1908}, + {15, 1296, 1332, 1584}, + {16, 972, 1008, 1260}, + {17, 648, 684, 936}, + {18, 324, 360, 612}, + {19, 0, 36, 288}}; + static pin_fuse_rows gal18v10pinfuserows[] = { {9, 3096, 3132, 3384}, {11, 2772, 2808, 3060}, @@ -1172,6 +1186,26 @@ static pin_fuse_columns peel18cv8pinfusecolumns[] = { {18, 11, 10}, {19, 7, 6}}; +static pin_fuse_columns ampal18p8pinfusecolumns[] = { + {1, 3, 2}, + {2, 1, 0}, + {3, 5, 4}, + {4, 9, 8}, + {5, 13, 12}, + {6, 17, 16}, + {7, 21, 20}, + {8, 25, 24}, + {9, 29, 28}, + {11, 31, 30}, + {12, 35, 34}, + {13, 27, 26}, + {14, 23, 22}, + {15, 19, 18}, + {16, 15, 14}, + {17, 11, 10}, + {18, 7, 6}, + {19, 33, 32}}; + static pin_fuse_columns gal18v10pinfusecolumns[] = { {1, 1, 0}, {2, 5, 4}, @@ -1985,6 +2019,13 @@ static pal_data paldata[] = { config_peel18cv8_pins, nullptr, get_peel18cv8_pin_fuse_state}, + {"AMPAL18P8", 2600, + ampal18p8pinfuserows, ARRAY_LENGTH(ampal18p8pinfuserows), + ampal18p8pinfusecolumns, ARRAY_LENGTH(ampal18p8pinfusecolumns), + print_ampal18p8_product_terms, + config_ampal18p8_pins, + nullptr, + nullptr}, {"GAL18V10", 3540, gal18v10pinfuserows, ARRAY_LENGTH(gal18v10pinfuserows), gal18v10pinfusecolumns, ARRAY_LENGTH(gal18v10pinfusecolumns), @@ -2079,57 +2120,57 @@ static pal_data paldata[] = { epl10p8pinfusecolumns, ARRAY_LENGTH(epl10p8pinfusecolumns), print_epl10p8_product_terms, config_epl10p8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"EPL12P6", 786, epl12p6pinfuserows, ARRAY_LENGTH(epl12p6pinfuserows), epl12p6pinfusecolumns, ARRAY_LENGTH(epl12p6pinfusecolumns), print_epl12p6_product_terms, config_epl12p6_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"EPL14P4", 908, epl14p4pinfuserows, ARRAY_LENGTH(epl14p4pinfuserows), epl14p4pinfusecolumns, ARRAY_LENGTH(epl14p4pinfusecolumns), print_epl14p4_product_terms, config_epl14p4_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"EPL16P2", 1030, epl16p2pinfuserows, ARRAY_LENGTH(epl16p2pinfuserows), epl16p2pinfusecolumns, ARRAY_LENGTH(epl16p2pinfusecolumns), print_epl16p2_product_terms, config_epl16p2_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"EPL16P8", 2072, epl16p8pinfuserows, ARRAY_LENGTH(epl16p8pinfuserows), epl16p8pinfusecolumns, ARRAY_LENGTH(epl16p8pinfusecolumns), print_epl16p8_product_terms, config_epl16p8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"EPL16RP8", 2072, epl16rp8pinfuserows, ARRAY_LENGTH(epl16rp8pinfuserows), epl16rp8pinfusecolumns, ARRAY_LENGTH(epl16rp8pinfusecolumns), print_epl16rp8_product_terms, config_epl16rp8_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"EPL16RP6", 2072, epl16rp6pinfuserows, ARRAY_LENGTH(epl16rp6pinfuserows), epl16rp6pinfusecolumns, ARRAY_LENGTH(epl16rp6pinfusecolumns), print_epl16rp6_product_terms, config_epl16rp6_pins, - NULL, - NULL}, + nullptr, + nullptr}, {"EPL16RP4", 2072, epl16rp4pinfuserows, ARRAY_LENGTH(epl16rp4pinfuserows), epl16rp4pinfusecolumns, ARRAY_LENGTH(epl16rp4pinfusecolumns), print_epl16rp4_product_terms, config_epl16rp4_pins, - NULL, - NULL}, + nullptr, + nullptr}, #endif {"PAL10P8", 328, pal10p8pinfuserows, ARRAY_LENGTH(pal10p8pinfuserows), @@ -3408,6 +3449,17 @@ static void print_peel18cv8_product_terms(const pal_data* pal, const jed_data* j +/*------------------------------------------------- + print_ampal18p8_product_terms - prints the product + terms for an AMPAL18P8 +-------------------------------------------------*/ + +static void print_ampal18p8_product_terms(const pal_data* pal, const jed_data* jed) +{ + print_product_terms(pal, jed); +} + + /*------------------------------------------------- print_gal18v10_product_terms - prints the product terms for a GAL18V10 @@ -5238,6 +5290,46 @@ static void config_peel18cv8_pins(const pal_data* pal, const jed_data* jed) +/*------------------------------------------------- + config_ampal18p8_pins - configures the pins + for an AMPAL18P8 +-------------------------------------------------*/ + +static void config_ampal18p8_pins(const pal_data* pal, const jed_data* jed) +{ + static UINT16 input_pins[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19}; + pin_output_config output_pins[8]; + UINT16 index, output_pin_count; + + set_input_pins(input_pins, ARRAY_LENGTH(input_pins)); + + output_pin_count = 0; + + for (index = 0; index < pal->pinfuserowscount; ++index) + { + if (does_output_enable_fuse_row_allow_output(pal, jed, pal->pinfuserows[index].fuserowoutputenable)) + { + output_pins[output_pin_count].pin = pal->pinfuserows[index].pin; + output_pins[output_pin_count].flags = OUTPUT_COMBINATORIAL | OUTPUT_FEEDBACK_OUTPUT; + + if (jed_get_fuse(jed, 2591 + (8 - index))) + { + output_pins[output_pin_count].flags |= OUTPUT_ACTIVEHIGH; + } + else + { + output_pins[output_pin_count].flags |= OUTPUT_ACTIVELOW; + } + + ++output_pin_count; + } + } + + set_output_pins(output_pins, output_pin_count); +} + + + /*------------------------------------------------- config_gal18v10_pins - configures the pins for a GAL18V10 -- cgit v1.2.3-70-g09d2 From d9886e2667b122bfc4dc84a7d7d85d7c95a7ad56 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Sun, 14 Feb 2016 00:29:15 -0300 Subject: New machines added or promoted from NOT_WORKING status ------------------------------------------------------ Super Cherry Master (v1.0) [Roberto Fresca, Ioannis Bampoulas] --- src/mame/arcade.lst | 1 + src/mame/drivers/goldstar.cpp | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index e3e49058ee2..af0edd40de0 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -12430,6 +12430,7 @@ excitbj // (c) 1992 Wing Co. Ltd carb2002 // bootleg carb2003 // bootleg nfm // bootleg +scmaster // unknown unkch1 // bootleg unkch2 // bootleg unkch3 // bootleg diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index a5b49c515b0..9b5c25495d9 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -11988,9 +11988,24 @@ ROM_START( nfm ) ROM_END +/* Super Cherry Master. + Dyna. +*/ +ROM_START( scmaster ) // all roms unique + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "27c512.u6", 0x00000, 0x10000, CRC(4eef290a) SHA1(27cca383de49d5f0072ecdda11591b78727469c6) ) + + ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_LOAD( "27c010.u29", 0x00000, 0x20000, CRC(98bd34b6) SHA1(e3ff6536eb421ed2e2f5d4354099078ba4ae5671) ) + + ROM_REGION( 0x40000, "gfx2", 0 ) + ROM_LOAD( "27c020.u41", 0x00000, 0x40000, CRC(ece34be2) SHA1(fdfaaffb12a7f6de6bf21b46ad50e845abc00734) ) +ROM_END + + ROM_START( unkch1 ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "u6.bin", 0x0000, 0x10000, CRC(30309996) SHA1(290f35f587fdf78dcb4f09403c510deec533c9c2) ) + ROM_LOAD( "u6.bin", 0x00000, 0x10000, CRC(30309996) SHA1(290f35f587fdf78dcb4f09403c510deec533c9c2) ) ROM_REGION( 0x20000, "gfx1", 0 ) ROM_LOAD( "u29.bin", 0x00000, 0x20000, CRC(6db245a1) SHA1(e9f85ba29b0af483eae6f999f49f1e431d9d2e27) ) @@ -12002,7 +12017,7 @@ ROM_END ROM_START( unkch2 ) // only gfx2 differs from unkch1 ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "u6.bin", 0x0000, 0x10000, CRC(30309996) SHA1(290f35f587fdf78dcb4f09403c510deec533c9c2) ) + ROM_LOAD( "u6.bin", 0x00000, 0x10000, CRC(30309996) SHA1(290f35f587fdf78dcb4f09403c510deec533c9c2) ) ROM_REGION( 0x20000, "gfx1", 0 ) ROM_LOAD( "u29.bin", 0x00000, 0x20000, CRC(6db245a1) SHA1(e9f85ba29b0af483eae6f999f49f1e431d9d2e27) ) @@ -12014,7 +12029,7 @@ ROM_END ROM_START( unkch3 ) // gfx2 is the same as unkch1, others differ ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "u6.3", 0x0000, 0x10000, CRC(902f9e42) SHA1(ac5843089748d457f70ea52d15285a0ccda705ad) ) + ROM_LOAD( "u6.3", 0x00000, 0x10000, CRC(902f9e42) SHA1(ac5843089748d457f70ea52d15285a0ccda705ad) ) ROM_REGION( 0x20000, "gfx1", 0 ) ROM_LOAD( "u29.3", 0x00000, 0x20000, CRC(546929e6) SHA1(f97fe5687f8776f0abe68962a0246c9bbeb6acd1) ) @@ -12026,7 +12041,7 @@ ROM_END ROM_START( unkch4 ) // all roms unique ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "u6.4", 0x0000, 0x10000, CRC(eb191efa) SHA1(3004f26f9af7633df572f609647716cc4ac75990) ) + ROM_LOAD( "u6.4", 0x00000, 0x10000, CRC(eb191efa) SHA1(3004f26f9af7633df572f609647716cc4ac75990) ) ROM_REGION( 0x20000, "gfx1", 0 ) ROM_LOAD( "u29.4", 0x00000, 0x20000, CRC(eaec0034) SHA1(6b2d3922873979eafcd4c71c52017263482b82ab) ) @@ -12158,7 +12173,7 @@ ROM_END and Eagle & Fun World stickers (serial numbers). - For custom IC's 06B49P, and 06B53P, see the reverse-engineering notes in lucky74.c. + For custom IC's 06B49P, and 06B53P, see the reverse-engineering notes in lucky74.cpp. ------------------------ @@ -13726,11 +13741,15 @@ GAME( 2003, carb2003, nfb96, amcoe2, nfb96bl, driver_device, 0, GAME( 2003, nfm, 0, nfm, nfm, driver_device, 0, ROT0, "Ming-Yang Electronic", "New Fruit Machine (Ming-Yang Electronic)", MACHINE_NOT_WORKING ) // vFB02-07A "Copyright By Ms. Liu Orchis 2003/03/06" -// these have 'cherry 1994' in the program roms, but also "Super Cherry / New Cherry Gold '99" probably hacks of a 1994 version of Cherry Bonus / Cherry Master (Super Cherry Master?) -GAMEL(1999, unkch1, 0, unkch, unkch, unkch_state, unkch1, ROT0, "bootleg", "New Cherry Gold '99 (bootleg of Super Cherry Master) (set 1)", 0, layout_unkch ) -GAMEL(1999, unkch2, unkch1, unkch, unkch, unkch_state, unkch1, ROT0, "bootleg", "Super Cherry Gold (bootleg of Super Cherry Master)", 0, layout_unkch ) -GAMEL(1999, unkch3, unkch1, unkch, unkch3, unkch_state, unkch3, ROT0, "bootleg", "New Cherry Gold '99 (bootleg of Super Cherry Master) (set 2)", 0, layout_unkch ) // cards have been hacked to look like barrels, girl removed? -GAMEL(1999, unkch4, unkch1, unkch, unkch4, unkch_state, unkch4, ROT0, "bootleg", "Grand Cherry Master (bootleg of Super Cherry Master)", 0, layout_unkch ) // by 'Toy System' Hungary + +// super cherry master sets... +GAMEL(1999, scmaster, 0, unkch, unkch4, unkch_state, unkch4, ROT0, "bootleg", "Super Cherry Master (v1.0)", 0, layout_unkch ) + +// these have 'cherry 1994' in the program roms, but also "Super Cherry / New Cherry Gold '99". probably hacks of a 1994 version of Super Cherry Master. +GAMEL(1999, unkch1, scmaster, unkch, unkch, unkch_state, unkch1, ROT0, "bootleg", "New Cherry Gold '99 (bootleg of Super Cherry Master) (set 1)", 0, layout_unkch ) +GAMEL(1999, unkch2, scmaster, unkch, unkch, unkch_state, unkch1, ROT0, "bootleg", "Super Cherry Gold (bootleg of Super Cherry Master)", 0, layout_unkch ) +GAMEL(1999, unkch3, scmaster, unkch, unkch3, unkch_state, unkch3, ROT0, "bootleg", "New Cherry Gold '99 (bootleg of Super Cherry Master) (set 2)", 0, layout_unkch ) // cards have been hacked to look like barrels, girl removed? +GAMEL(1999, unkch4, scmaster, unkch, unkch4, unkch_state, unkch4, ROT0, "bootleg", "Grand Cherry Master (bootleg of Super Cherry Master)", 0, layout_unkch ) // by 'Toy System' Hungary /* Stealth sets. -- cgit v1.2.3-70-g09d2 From 7e00da8dc701f1bb69ec8e0fec214e5da9fba404 Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Sun, 14 Feb 2016 01:16:39 -0300 Subject: Changed year... --- src/mame/arcade.lst | 2 +- src/mame/drivers/goldstar.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index af0edd40de0..e4be5acd94a 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -12430,7 +12430,7 @@ excitbj // (c) 1992 Wing Co. Ltd carb2002 // bootleg carb2003 // bootleg nfm // bootleg -scmaster // unknown +scmaster // 1994, unknown unkch1 // bootleg unkch2 // bootleg unkch3 // bootleg diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 9b5c25495d9..5f11e3936bf 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -13743,7 +13743,7 @@ GAME( 2003, nfm, 0, nfm, nfm, driver_device, 0, // super cherry master sets... -GAMEL(1999, scmaster, 0, unkch, unkch4, unkch_state, unkch4, ROT0, "bootleg", "Super Cherry Master (v1.0)", 0, layout_unkch ) +GAMEL(1994, scmaster, 0, unkch, unkch4, unkch_state, unkch4, ROT0, "bootleg", "Super Cherry Master (v1.0)", 0, layout_unkch ) // these have 'cherry 1994' in the program roms, but also "Super Cherry / New Cherry Gold '99". probably hacks of a 1994 version of Super Cherry Master. GAMEL(1999, unkch1, scmaster, unkch, unkch, unkch_state, unkch1, ROT0, "bootleg", "New Cherry Gold '99 (bootleg of Super Cherry Master) (set 1)", 0, layout_unkch ) -- cgit v1.2.3-70-g09d2 From 80e8fe80e6354acc7157bd82066e719365642a1b Mon Sep 17 00:00:00 2001 From: RobertoFresca Date: Sun, 14 Feb 2016 04:08:29 -0300 Subject: New machines marked as NOT_WORKING ---------------------------------- New Cherry '96 (bootleg of New Fruit Bonus?) [Roberto Fresca, Ioannis Bampoulas] --- src/mame/arcade.lst | 1 + src/mame/drivers/goldstar.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index e4be5acd94a..ad56461db61 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -12435,6 +12435,7 @@ unkch1 // bootleg unkch2 // bootleg unkch3 // bootleg unkch4 // bootleg +cherry96 // bootleg ns8lines // unknown ns8linew // unknown ladylinr // (c) 198? TAB Austria diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 5f11e3936bf..99f5d8bfb6d 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -12051,6 +12051,18 @@ ROM_START( unkch4 ) // all roms unique ROM_END +ROM_START( cherry96 ) // all roms unique + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "new_96-16-3.u6", 0x00000, 0x10000, CRC(84d5f2fc) SHA1(e3ed0670350920c661c5a40581966671b8a8c7df) ) + + ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_LOAD( "new_96-16-2.u29", 0x00000, 0x20000, CRC(dd8f7450) SHA1(c897e5151809d4e0a0b1e46609f07bb0156b489a) ) + + ROM_REGION( 0x40000, "gfx2", 0 ) + ROM_LOAD( "new_96-16-1.u41", 0x00000, 0x20000, CRC(9ab19bdc) SHA1(2f34789729b5d12f6fa098a29253d5a80aef5b39) ) +ROM_END + + /* Cherry Master '97 @@ -13751,6 +13763,8 @@ GAMEL(1999, unkch2, scmaster, unkch, unkch, unkch_state, unkch1, GAMEL(1999, unkch3, scmaster, unkch, unkch3, unkch_state, unkch3, ROT0, "bootleg", "New Cherry Gold '99 (bootleg of Super Cherry Master) (set 2)", 0, layout_unkch ) // cards have been hacked to look like barrels, girl removed? GAMEL(1999, unkch4, scmaster, unkch, unkch4, unkch_state, unkch4, ROT0, "bootleg", "Grand Cherry Master (bootleg of Super Cherry Master)", 0, layout_unkch ) // by 'Toy System' Hungary +GAME( 1996, cherry96, scmaster, unkch, unkch4, unkch_state, unkch4, ROT0, "bootleg", "New Cherry '96 (bootleg of New Fruit Bonus?)", MACHINE_NOT_WORKING ) // need to be moved to another machine... + /* Stealth sets. These have hidden games inside that can be switched to avoid inspections, police or whatever purposes)... */ -- cgit v1.2.3-70-g09d2 From 2db49088141b6238e92aecc4c073076a02c73065 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 14 Feb 2016 08:16:35 +0100 Subject: Added lua-zlib, lfs and luv support for LUA, exposed all using luaengine (nw) --- 3rdparty/lua-zlib/.gitattributes | 1 + 3rdparty/lua-zlib/CMakeLists.txt | 62 + 3rdparty/lua-zlib/Makefile | 62 + 3rdparty/lua-zlib/README | 151 +++ 3rdparty/lua-zlib/amnon_david.gz | Bin 0 -> 65 bytes 3rdparty/lua-zlib/cmake/Modules/FindLuaJIT.cmake | 63 + 3rdparty/lua-zlib/lua_zlib.c | 401 ++++++ 3rdparty/lua-zlib/rockspec | 35 + 3rdparty/lua-zlib/tap.lua | 24 + 3rdparty/lua-zlib/test.lua | 198 +++ 3rdparty/lua-zlib/tom_macwright.gz | 4 + 3rdparty/lua-zlib/tom_macwright.out | Bin 0 -> 245 bytes 3rdparty/lua-zlib/zlib.def | 2 + 3rdparty/luafilesystem/.travis.yml | 33 + 3rdparty/luafilesystem/.travis/platform.sh | 15 + 3rdparty/luafilesystem/.travis/setup_lua.sh | 101 ++ 3rdparty/luafilesystem/LICENSE | 21 + 3rdparty/luafilesystem/Makefile | 25 + 3rdparty/luafilesystem/Makefile.win | 25 + 3rdparty/luafilesystem/README | 23 + 3rdparty/luafilesystem/config | 24 + 3rdparty/luafilesystem/config.win | 19 + 3rdparty/luafilesystem/doc/us/doc.css | 212 ++++ 3rdparty/luafilesystem/doc/us/examples.html | 103 ++ 3rdparty/luafilesystem/doc/us/index.html | 218 ++++ 3rdparty/luafilesystem/doc/us/license.html | 122 ++ 3rdparty/luafilesystem/doc/us/luafilesystem.png | Bin 0 -> 8535 bytes 3rdparty/luafilesystem/doc/us/manual.html | 280 +++++ .../rockspecs/luafilesystem-1.3.0-1.rockspec | 27 + .../rockspecs/luafilesystem-1.4.0-1.rockspec | 27 + .../rockspecs/luafilesystem-1.4.0-2.rockspec | 43 + .../rockspecs/luafilesystem-1.4.1-1.rockspec | 43 + .../rockspecs/luafilesystem-1.4.1rc1-1.rockspec | 43 + .../rockspecs/luafilesystem-1.4.2-1.rockspec | 26 + .../rockspecs/luafilesystem-1.5.0-1.rockspec | 27 + .../rockspecs/luafilesystem-1.6.0-1.rockspec | 27 + .../rockspecs/luafilesystem-1.6.1-1.rockspec | 27 + .../rockspecs/luafilesystem-1.6.2-1.rockspec | 27 + .../rockspecs/luafilesystem-1.6.3-1.rockspec | 28 + .../rockspecs/luafilesystem-cvs-1.rockspec | 44 + .../rockspecs/luafilesystem-cvs-2.rockspec | 26 + .../rockspecs/luafilesystem-cvs-3.rockspec | 27 + 3rdparty/luafilesystem/src/.gitignore | 2 + 3rdparty/luafilesystem/src/lfs.c | 906 ++++++++++++++ 3rdparty/luafilesystem/src/lfs.def | 4 + 3rdparty/luafilesystem/src/lfs.h | 34 + 3rdparty/luafilesystem/tests/test.lua | 175 +++ 3rdparty/luafilesystem/vc6/lfs.def | 5 + 3rdparty/luafilesystem/vc6/luafilesystem.dsw | 33 + 3rdparty/luafilesystem/vc6/luafilesystem_dll.dsp | 127 ++ 3rdparty/luv/.ci/install.bat | 270 ++++ 3rdparty/luv/.ci/platform.sh | 15 + 3rdparty/luv/.ci/set_compiler_env.bat | 40 + 3rdparty/luv/.ci/setenv_lua.sh | 3 + 3rdparty/luv/.ci/setup_lua.sh | 122 ++ 3rdparty/luv/.ci/winmake.bat | 457 +++++++ 3rdparty/luv/.gitignore | 10 + 3rdparty/luv/.travis.yml | 36 + 3rdparty/luv/CMakeLists.txt | 191 +++ 3rdparty/luv/LICENSE.txt | 202 +++ 3rdparty/luv/Makefile | 61 + 3rdparty/luv/README.md | 213 ++++ 3rdparty/luv/appveyor.yml | 42 + 3rdparty/luv/cmake/Modules/FindLibuv.cmake | 11 + 3rdparty/luv/cmake/Modules/FindLuaJIT.cmake | 55 + 3rdparty/luv/deps/lua.cmake | 128 ++ 3rdparty/luv/deps/lua_one.c | 97 ++ 3rdparty/luv/deps/luajit.cmake | 407 ++++++ 3rdparty/luv/deps/uv.cmake | 224 ++++ 3rdparty/luv/docs.md | 1309 ++++++++++++++++++++ 3rdparty/luv/examples/cqueues-main.lua | 31 + 3rdparty/luv/examples/cqueues-slave.lua | 55 + 3rdparty/luv/examples/echo-server-client.lua | 68 + 3rdparty/luv/examples/killing-children.lua | 24 + 3rdparty/luv/examples/lots-o-dns.lua | 49 + 3rdparty/luv/examples/repl.lua | 89 ++ 3rdparty/luv/examples/talking-to-children.lua | 47 + 3rdparty/luv/examples/tcp-cluster.lua | 84 ++ 3rdparty/luv/examples/timers.lua | 68 + 3rdparty/luv/examples/uvbook/helloworld.lua | 5 + 3rdparty/luv/examples/uvbook/idle-basic.lua | 14 + 3rdparty/luv/examples/uvbook/onchange.lua | 30 + 3rdparty/luv/examples/uvbook/queue-work.lua | 19 + 3rdparty/luv/examples/uvbook/tcp-echo-client.lua | 21 + 3rdparty/luv/examples/uvbook/tcp-echo-server.lua | 22 + 3rdparty/luv/examples/uvbook/thread-create.lua | 38 + 3rdparty/luv/examples/uvbook/uvcat.lua | 37 + 3rdparty/luv/examples/uvbook/uvtee.lua | 35 + 3rdparty/luv/lib/tap.lua | 165 +++ 3rdparty/luv/lib/utils.lua | 165 +++ 3rdparty/luv/luv-1.8.0-4.rockspec | 34 + 3rdparty/luv/msvcbuild.bat | 13 + 3rdparty/luv/src/async.c | 63 + 3rdparty/luv/src/check.c | 59 + 3rdparty/luv/src/constants.c | 649 ++++++++++ 3rdparty/luv/src/dns.c | 296 +++++ 3rdparty/luv/src/fs.c | 614 +++++++++ 3rdparty/luv/src/fs_event.c | 97 ++ 3rdparty/luv/src/fs_poll.c | 90 ++ 3rdparty/luv/src/handle.c | 173 +++ 3rdparty/luv/src/idle.c | 59 + 3rdparty/luv/src/lhandle.c | 116 ++ 3rdparty/luv/src/lhandle.h | 67 + 3rdparty/luv/src/loop.c | 92 ++ 3rdparty/luv/src/lreq.c | 71 ++ 3rdparty/luv/src/lreq.h | 43 + 3rdparty/luv/src/lthreadpool.h | 48 + 3rdparty/luv/src/luv.c | 519 ++++++++ 3rdparty/luv/src/luv.h | 109 ++ 3rdparty/luv/src/misc.c | 316 +++++ 3rdparty/luv/src/pipe.c | 114 ++ 3rdparty/luv/src/poll.c | 100 ++ 3rdparty/luv/src/prepare.c | 59 + 3rdparty/luv/src/process.c | 266 ++++ 3rdparty/luv/src/req.c | 52 + 3rdparty/luv/src/schema.c | 16 + 3rdparty/luv/src/signal.c | 72 ++ 3rdparty/luv/src/stream.c | 263 ++++ 3rdparty/luv/src/tcp.c | 182 +++ 3rdparty/luv/src/thread.c | 353 ++++++ 3rdparty/luv/src/timer.c | 84 ++ 3rdparty/luv/src/tty.c | 65 + 3rdparty/luv/src/udp.c | 260 ++++ 3rdparty/luv/src/util.c | 56 + 3rdparty/luv/src/util.h | 26 + 3rdparty/luv/src/work.c | 224 ++++ 3rdparty/luv/tests/manual-test-cluster.lua | 213 ++++ 3rdparty/luv/tests/run.lua | 33 + 3rdparty/luv/tests/test-async.lua | 32 + 3rdparty/luv/tests/test-conversions.lua | 6 + 3rdparty/luv/tests/test-dns.lua | 125 ++ 3rdparty/luv/tests/test-fs.lua | 90 ++ 3rdparty/luv/tests/test-leaks.lua | 186 +++ 3rdparty/luv/tests/test-misc.lua | 85 ++ .../luv/tests/test-prepare-check-idle-async.lua | 49 + 3rdparty/luv/tests/test-process.lua | 101 ++ 3rdparty/luv/tests/test-sigchld-after-lua_close.sh | 45 + 3rdparty/luv/tests/test-signal.lua | 40 + 3rdparty/luv/tests/test-tcp.lua | 114 ++ 3rdparty/luv/tests/test-thread.lua | 47 + 3rdparty/luv/tests/test-timer.lua | 87 ++ 3rdparty/luv/tests/test-work.lua | 48 + scripts/genie.lua | 5 +- scripts/src/3rdparty.lua | 73 +- scripts/src/main.lua | 3 +- src/emu/luaengine.cpp | 75 +- 146 files changed, 16054 insertions(+), 34 deletions(-) create mode 100644 3rdparty/lua-zlib/.gitattributes create mode 100644 3rdparty/lua-zlib/CMakeLists.txt create mode 100644 3rdparty/lua-zlib/Makefile create mode 100644 3rdparty/lua-zlib/README create mode 100644 3rdparty/lua-zlib/amnon_david.gz create mode 100644 3rdparty/lua-zlib/cmake/Modules/FindLuaJIT.cmake create mode 100644 3rdparty/lua-zlib/lua_zlib.c create mode 100644 3rdparty/lua-zlib/rockspec create mode 100644 3rdparty/lua-zlib/tap.lua create mode 100644 3rdparty/lua-zlib/test.lua create mode 100644 3rdparty/lua-zlib/tom_macwright.gz create mode 100644 3rdparty/lua-zlib/tom_macwright.out create mode 100644 3rdparty/lua-zlib/zlib.def create mode 100644 3rdparty/luafilesystem/.travis.yml create mode 100644 3rdparty/luafilesystem/.travis/platform.sh create mode 100644 3rdparty/luafilesystem/.travis/setup_lua.sh create mode 100644 3rdparty/luafilesystem/LICENSE create mode 100644 3rdparty/luafilesystem/Makefile create mode 100644 3rdparty/luafilesystem/Makefile.win create mode 100644 3rdparty/luafilesystem/README create mode 100644 3rdparty/luafilesystem/config create mode 100644 3rdparty/luafilesystem/config.win create mode 100644 3rdparty/luafilesystem/doc/us/doc.css create mode 100644 3rdparty/luafilesystem/doc/us/examples.html create mode 100644 3rdparty/luafilesystem/doc/us/index.html create mode 100644 3rdparty/luafilesystem/doc/us/license.html create mode 100644 3rdparty/luafilesystem/doc/us/luafilesystem.png create mode 100644 3rdparty/luafilesystem/doc/us/manual.html create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-1.3.0-1.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.0-1.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.0-2.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.1-1.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.1rc1-1.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.2-1.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-1.5.0-1.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.0-1.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.1-1.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.2-1.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.3-1.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-1.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-2.rockspec create mode 100644 3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-3.rockspec create mode 100644 3rdparty/luafilesystem/src/.gitignore create mode 100644 3rdparty/luafilesystem/src/lfs.c create mode 100644 3rdparty/luafilesystem/src/lfs.def create mode 100644 3rdparty/luafilesystem/src/lfs.h create mode 100644 3rdparty/luafilesystem/tests/test.lua create mode 100644 3rdparty/luafilesystem/vc6/lfs.def create mode 100644 3rdparty/luafilesystem/vc6/luafilesystem.dsw create mode 100644 3rdparty/luafilesystem/vc6/luafilesystem_dll.dsp create mode 100644 3rdparty/luv/.ci/install.bat create mode 100644 3rdparty/luv/.ci/platform.sh create mode 100644 3rdparty/luv/.ci/set_compiler_env.bat create mode 100644 3rdparty/luv/.ci/setenv_lua.sh create mode 100644 3rdparty/luv/.ci/setup_lua.sh create mode 100644 3rdparty/luv/.ci/winmake.bat create mode 100644 3rdparty/luv/.gitignore create mode 100644 3rdparty/luv/.travis.yml create mode 100644 3rdparty/luv/CMakeLists.txt create mode 100644 3rdparty/luv/LICENSE.txt create mode 100644 3rdparty/luv/Makefile create mode 100644 3rdparty/luv/README.md create mode 100644 3rdparty/luv/appveyor.yml create mode 100644 3rdparty/luv/cmake/Modules/FindLibuv.cmake create mode 100644 3rdparty/luv/cmake/Modules/FindLuaJIT.cmake create mode 100644 3rdparty/luv/deps/lua.cmake create mode 100644 3rdparty/luv/deps/lua_one.c create mode 100644 3rdparty/luv/deps/luajit.cmake create mode 100644 3rdparty/luv/deps/uv.cmake create mode 100644 3rdparty/luv/docs.md create mode 100644 3rdparty/luv/examples/cqueues-main.lua create mode 100644 3rdparty/luv/examples/cqueues-slave.lua create mode 100644 3rdparty/luv/examples/echo-server-client.lua create mode 100644 3rdparty/luv/examples/killing-children.lua create mode 100644 3rdparty/luv/examples/lots-o-dns.lua create mode 100644 3rdparty/luv/examples/repl.lua create mode 100644 3rdparty/luv/examples/talking-to-children.lua create mode 100644 3rdparty/luv/examples/tcp-cluster.lua create mode 100644 3rdparty/luv/examples/timers.lua create mode 100644 3rdparty/luv/examples/uvbook/helloworld.lua create mode 100644 3rdparty/luv/examples/uvbook/idle-basic.lua create mode 100644 3rdparty/luv/examples/uvbook/onchange.lua create mode 100644 3rdparty/luv/examples/uvbook/queue-work.lua create mode 100644 3rdparty/luv/examples/uvbook/tcp-echo-client.lua create mode 100644 3rdparty/luv/examples/uvbook/tcp-echo-server.lua create mode 100644 3rdparty/luv/examples/uvbook/thread-create.lua create mode 100644 3rdparty/luv/examples/uvbook/uvcat.lua create mode 100644 3rdparty/luv/examples/uvbook/uvtee.lua create mode 100644 3rdparty/luv/lib/tap.lua create mode 100644 3rdparty/luv/lib/utils.lua create mode 100644 3rdparty/luv/luv-1.8.0-4.rockspec create mode 100644 3rdparty/luv/msvcbuild.bat create mode 100644 3rdparty/luv/src/async.c create mode 100644 3rdparty/luv/src/check.c create mode 100644 3rdparty/luv/src/constants.c create mode 100644 3rdparty/luv/src/dns.c create mode 100644 3rdparty/luv/src/fs.c create mode 100644 3rdparty/luv/src/fs_event.c create mode 100644 3rdparty/luv/src/fs_poll.c create mode 100644 3rdparty/luv/src/handle.c create mode 100644 3rdparty/luv/src/idle.c create mode 100644 3rdparty/luv/src/lhandle.c create mode 100644 3rdparty/luv/src/lhandle.h create mode 100644 3rdparty/luv/src/loop.c create mode 100644 3rdparty/luv/src/lreq.c create mode 100644 3rdparty/luv/src/lreq.h create mode 100644 3rdparty/luv/src/lthreadpool.h create mode 100644 3rdparty/luv/src/luv.c create mode 100644 3rdparty/luv/src/luv.h create mode 100644 3rdparty/luv/src/misc.c create mode 100644 3rdparty/luv/src/pipe.c create mode 100644 3rdparty/luv/src/poll.c create mode 100644 3rdparty/luv/src/prepare.c create mode 100644 3rdparty/luv/src/process.c create mode 100644 3rdparty/luv/src/req.c create mode 100644 3rdparty/luv/src/schema.c create mode 100644 3rdparty/luv/src/signal.c create mode 100644 3rdparty/luv/src/stream.c create mode 100644 3rdparty/luv/src/tcp.c create mode 100644 3rdparty/luv/src/thread.c create mode 100644 3rdparty/luv/src/timer.c create mode 100644 3rdparty/luv/src/tty.c create mode 100644 3rdparty/luv/src/udp.c create mode 100644 3rdparty/luv/src/util.c create mode 100644 3rdparty/luv/src/util.h create mode 100644 3rdparty/luv/src/work.c create mode 100644 3rdparty/luv/tests/manual-test-cluster.lua create mode 100644 3rdparty/luv/tests/run.lua create mode 100644 3rdparty/luv/tests/test-async.lua create mode 100644 3rdparty/luv/tests/test-conversions.lua create mode 100644 3rdparty/luv/tests/test-dns.lua create mode 100644 3rdparty/luv/tests/test-fs.lua create mode 100644 3rdparty/luv/tests/test-leaks.lua create mode 100644 3rdparty/luv/tests/test-misc.lua create mode 100644 3rdparty/luv/tests/test-prepare-check-idle-async.lua create mode 100644 3rdparty/luv/tests/test-process.lua create mode 100644 3rdparty/luv/tests/test-sigchld-after-lua_close.sh create mode 100644 3rdparty/luv/tests/test-signal.lua create mode 100644 3rdparty/luv/tests/test-tcp.lua create mode 100644 3rdparty/luv/tests/test-thread.lua create mode 100644 3rdparty/luv/tests/test-timer.lua create mode 100644 3rdparty/luv/tests/test-work.lua diff --git a/3rdparty/lua-zlib/.gitattributes b/3rdparty/lua-zlib/.gitattributes new file mode 100644 index 00000000000..54be6288857 --- /dev/null +++ b/3rdparty/lua-zlib/.gitattributes @@ -0,0 +1 @@ +lua_zlib.c export-subst ident diff --git a/3rdparty/lua-zlib/CMakeLists.txt b/3rdparty/lua-zlib/CMakeLists.txt new file mode 100644 index 00000000000..1cda6b7532b --- /dev/null +++ b/3rdparty/lua-zlib/CMakeLists.txt @@ -0,0 +1,62 @@ +# Copyright (C) 2007-2009 LuaDist. +# Submitted by David Manura +# Redistribution and use of this file is allowed according to the +# terms of the MIT license. +# For details see the COPYRIGHT file distributed with LuaDist. +# Please note that the package source code is licensed under its own +# license. + +PROJECT(lua-zlib C) +CMAKE_MINIMUM_REQUIRED (VERSION 2.6) + +option(USE_LUA "Use Lua (also called 'C' Lua) includes (default)" ON) +option(USE_LUAJIT "Use LuaJIT includes instead of 'C' Lua ones (recommended, if you're using LuaJIT, but disabled by default)") +set(USE_LUA_VERSION 5.1 CACHE STRING "Set the Lua version to use (default: 5.1)") + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") + +if(USE_LUAJIT) +# Find luajit + find_package(LuaJIT REQUIRED) + set(USE_LUA OFF) +# / Find lua +endif() + +if(USE_LUA) +# Find lua + find_package(Lua ${USE_LUA_VERSION} EXACT REQUIRED) +# / Find lua +endif() + + +# Basic configurations + SET(INSTALL_CMOD share/lua/cmod CACHE PATH "Directory to install Lua binary modules (configure lua via LUA_CPATH)") +# / configs + +# Find zlib + FIND_PACKAGE(ZLIB REQUIRED) +# / Find zlib + +# Define how to build zlib.so: + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS} ${LUA_INCLUDE_DIR}) + ADD_LIBRARY(cmod_zlib MODULE + lua_zlib.c zlib.def) + SET_TARGET_PROPERTIES(cmod_zlib PROPERTIES PREFIX "") + SET_TARGET_PROPERTIES(cmod_zlib PROPERTIES OUTPUT_NAME zlib) + TARGET_LINK_LIBRARIES(cmod_zlib ${ZLIB_LIBRARIES}) +# / build zlib.so + +# Define how to test zlib.so: + INCLUDE(CTest) + SET(LUA_BIN "lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}") + FIND_PROGRAM(LUA NAMES ${LUA_BIN} lua luajit lua.bat) + ADD_TEST(basic ${LUA} ${CMAKE_CURRENT_SOURCE_DIR}/test.lua ${CMAKE_CURRENT_SOURCE_DIR}/ ${CMAKE_CURRENT_BINARY_DIR}/) + SET_TESTS_PROPERTIES(basic + PROPERTIES + FAIL_REGULAR_EXPRESSION + "not ok") +# / test zlib.so + +# Where to install stuff + INSTALL (TARGETS cmod_zlib DESTINATION ${INSTALL_CMOD}) +# / Where to install. diff --git a/3rdparty/lua-zlib/Makefile b/3rdparty/lua-zlib/Makefile new file mode 100644 index 00000000000..801ea0436f2 --- /dev/null +++ b/3rdparty/lua-zlib/Makefile @@ -0,0 +1,62 @@ +# This Makefile is based on LuaSec's Makefile. Thanks to the LuaSec developers. +# Inform the location to intall the modules +LUAPATH ?= /usr/share/lua/5.1 +LUACPATH ?= /usr/lib/lua/5.1 +INCDIR ?= -I/usr/include/lua5.1 +LIBDIR ?= -L/usr/lib + +# For Mac OS X: set the system version +MACOSX_VERSION = 10.4 + +CMOD = zlib.so +OBJS = lua_zlib.o + +LIBS = -lz -llua -lm +WARN = -Wall -pedantic + +BSD_CFLAGS = -O2 -fPIC $(WARN) $(INCDIR) $(DEFS) +BSD_LDFLAGS = -O -shared -fPIC $(LIBDIR) + +LNX_CFLAGS = -O2 -fPIC $(WARN) $(INCDIR) $(DEFS) +LNX_LDFLAGS = -O -shared -fPIC $(LIBDIR) + +MAC_ENV = env MACOSX_DEPLOYMENT_TARGET='$(MACVER)' +MAC_CFLAGS = -O2 -fPIC -fno-common $(WARN) $(INCDIR) $(DEFS) +MAC_LDFLAGS = -bundle -undefined dynamic_lookup -fPIC $(LIBDIR) + +CC = gcc +LD = $(MYENV) gcc +CFLAGS = $(MYCFLAGS) +LDFLAGS = $(MYLDFLAGS) + +.PHONY: all clean install none linux bsd macosx + +all: + @echo "Usage: $(MAKE) " + @echo " * linux" + @echo " * bsd" + @echo " * macosx" + +install: $(CMOD) + cp $(CMOD) $(LUACPATH) + +uninstall: + rm $(LUACPATH)/zlib.so + +linux: + @$(MAKE) $(CMOD) MYCFLAGS="$(LNX_CFLAGS)" MYLDFLAGS="$(LNX_LDFLAGS)" INCDIR="$(INCDIR)" LIBDIR="$(LIBDIR)" DEFS="$(DEFS)" + +bsd: + @$(MAKE) $(CMOD) MYCFLAGS="$(BSD_CFLAGS)" MYLDFLAGS="$(BSD_LDFLAGS)" INCDIR="$(INCDIR)" LIBDIR="$(LIBDIR)" DEFS="$(DEFS)" + +macosx: + @$(MAKE) $(CMOD) MYCFLAGS="$(MAC_CFLAGS)" MYLDFLAGS="$(MAC_LDFLAGS)" MYENV="$(MAC_ENV)" INCDIR="$(INCDIR)" LIBDIR="$(LIBDIR)" DEFS="$(DEFS)" + +clean: + rm -f $(OBJS) $(CMOD) + +.c.o: + $(CC) -c $(CFLAGS) $(DEFS) $(INCDIR) -o $@ $< + +$(CMOD): $(OBJS) + $(LD) $(LDFLAGS) $(LIBDIR) $(OBJS) $(LIBS) -o $@ diff --git a/3rdparty/lua-zlib/README b/3rdparty/lua-zlib/README new file mode 100644 index 00000000000..8c1ef8d5f8d --- /dev/null +++ b/3rdparty/lua-zlib/README @@ -0,0 +1,151 @@ +********************************************************************** +* Author : Brian Maher +* Library : lua_zlib - Lua 5.1 interface to zlib +* +* The MIT License +* +* Copyright (c) 2009 Brian Maher +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +********************************************************************** + +To use this library, you need zlib, get it here: + http://www.gzip.org/zlib/ + +To build this library, you can use CMake and get it here: + http://www.cmake.org/cmake/resources/software.html + +...or you can use GNU Make. + make + +Loading the library: + + If you built the library as a loadable package + [local] zlib = require 'zlib' + + If you compiled the package statically into your application, call + the function "luaopen_zlib(L)". It will create a table with the zlib + functions and leave it on the stack. + +-- zlib functions -- + +int major, int minor, int patch = zlib.version() + + returns numeric zlib version for the major, minor, and patch + levels of the version dynamically linked in. + +function stream = zlib.deflate([ int compression_level ], [ int window_size ]) + + If no compression_level is provided uses Z_DEFAULT_COMPRESSION (6), + compression level is a number from 1-9 where zlib.BEST_SPEED is 1 + and zlib.BEST_COMPRESSION is 9. + + Returns a "stream" function that compresses (or deflates) all + strings passed in. Specifically, use it as such: + + string deflated, bool eof, int bytes_in, int bytes_out = + stream(string input [, 'sync' | 'full' | 'finish']) + + Takes input and deflates and returns a portion of it, + optionally forcing a flush. + + A 'sync' flush will force all pending output to be flushed to + the return value and the output is aligned on a byte boundary, + so that the decompressor can get all input data available so + far. Flushing may degrade compression for some compression + algorithms and so it should be used only when necessary. + + A 'full' flush will flush all output as with 'sync', and the + compression state is reset so that decompression can restart + from this point if previous compressed data has been damaged + or if random access is desired. Using Z_FULL_FLUSH too often + can seriously degrade the compression. + + A 'finish' flush will force all pending output to be processed + and results in the stream become unusable. Any future + attempts to print anything other than the empty string will + result in an error that begins with IllegalState. + + The eof result is true if 'finish' was specified, otherwise + it is false. + + The bytes_in is how many bytes of input have been passed to + stream, and bytes_out is the number of bytes returned in + deflated string chunks. + +function stream = zlib.inflate([int windowBits]) + + Returns a "stream" function that decompresses (or inflates) all + strings passed in. Optionally specify a windowBits argument + that is passed to inflateInit2(), see zlib.h for details about + this argument. By default, gzip header detection is done, and + the max window size is used. + + The "stream" function should be used as such: + + string inflated, bool eof, int bytes_in, int bytes_out = + stream(string input) + + Takes input and inflates and returns a portion of it. If it + detects the end of a deflation stream, then total will be the + total number of bytes read from input and all future calls to + stream() with a non empty string will result in an error that + begins with IllegalState. + + No flush options are provided since the maximal amount of + input is always processed. + + eof will be true when the input string is determined to be at + the "end of the file". + + The bytes_in is how many bytes of input have been passed to + stream, and bytes_out is the number of bytes returned in + inflated string chunks. + + +function compute_checksum = zlib.adler32() +function compute_checksum = zlib.crc32() + + Create a new checksum computation function using either the + adler32 or crc32 algorithms. This resulting function should be + used as such: + + int checksum = compute_checksum(string input | + function compute_checksum) + + The compute_checksum function takes as input either a string + that is logically getting appended to or another + compute_checksum function that is logically getting appended. + The result is the updated checksum. + + For example, these uses will all result in the same checksum: + + -- All in one call: + local csum = zlib.crc32()("one two") + + -- Multiple calls: + local compute = zlib.crc32() + compute("one") + assert(csum == compute(" two")) + + -- Multiple compute_checksums joined: + local compute1, compute2 = zlib.crc32(), zlib.crc32() + compute1("one") + compute2(" two") + assert(csum == compute1(compute2)) diff --git a/3rdparty/lua-zlib/amnon_david.gz b/3rdparty/lua-zlib/amnon_david.gz new file mode 100644 index 00000000000..c56de231d1a Binary files /dev/null and b/3rdparty/lua-zlib/amnon_david.gz differ diff --git a/3rdparty/lua-zlib/cmake/Modules/FindLuaJIT.cmake b/3rdparty/lua-zlib/cmake/Modules/FindLuaJIT.cmake new file mode 100644 index 00000000000..e626a5a1d94 --- /dev/null +++ b/3rdparty/lua-zlib/cmake/Modules/FindLuaJIT.cmake @@ -0,0 +1,63 @@ +# Locate LuaJIT library +# This module defines +# LUAJIT_FOUND, if false, do not try to link to Lua +# LUA_LIBRARIES +# LUA_INCLUDE_DIR, where to find lua.h +# LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8) + +## Copied from default CMake FindLua51.cmake + +find_path(LUA_INCLUDE_DIR luajit.h + HINTS + ENV LUA_DIR + PATH_SUFFIXES include/luajit-2.0 include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) + +find_library(LUA_LIBRARY + NAMES luajit-5.1 + HINTS + ENV LUA_DIR + PATH_SUFFIXES lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw + /opt/local + /opt/csw + /opt +) + +if(LUA_LIBRARY) + # include the math library for Unix + if(UNIX AND NOT APPLE) + find_library(LUA_MATH_LIBRARY m) + set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") + # For Windows and Mac, don't need to explicitly include the math library + else() + set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") + endif() +endif() + +if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/luajit.h") + file(STRINGS "${LUA_INCLUDE_DIR}/luajit.h" luajit_version_str REGEX "^#define[ \t]+LUAJIT_VERSION[ \t]+\"LuaJIT .+\"") + + string(REGEX REPLACE "^#define[ \t]+LUAJIT_VERSION[ \t]+\"LuaJIT ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${luajit_version_str}") + unset(luajit_version_str) +endif() + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT + REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR + VERSION_VAR LUAJIT_VERSION_STRING) + +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) + diff --git a/3rdparty/lua-zlib/lua_zlib.c b/3rdparty/lua-zlib/lua_zlib.c new file mode 100644 index 00000000000..b619258c75f --- /dev/null +++ b/3rdparty/lua-zlib/lua_zlib.c @@ -0,0 +1,401 @@ +#include +#include +#include +#include +#include +#include + +/* + * ** compatibility with Lua 5.2 + * */ +#if (LUA_VERSION_NUM >= 502) +#undef luaL_register +#define luaL_register(L,n,f) \ + { if ((n) == NULL) luaL_setfuncs(L,f,0); else luaL_newlib(L,f); } + +#endif + +#if (LUA_VERSION_NUM >= 503) +#undef luaL_optint +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L,(n),(d))) +#endif + +#define DEF_MEM_LEVEL 8 + +typedef uLong (*checksum_t) (uLong crc, const Bytef *buf, uInt len); +typedef uLong (*checksum_combine_t)(uLong crc1, uLong crc2, z_off_t len2); + + +static int lz_deflate(lua_State *L); +static int lz_deflate_delete(lua_State *L); +static int lz_inflate_delete(lua_State *L); +static int lz_inflate(lua_State *L); +static int lz_checksum(lua_State *L); +static int lz_checksum_new(lua_State *L, checksum_t checksum, checksum_combine_t combine); +static int lz_adler32(lua_State *L); +static int lz_crc32(lua_State *L); + +static int lz_version(lua_State *L) { + const char* version = zlibVersion(); + int count = strlen(version) + 1; + char* cur = (char*)memcpy(lua_newuserdata(L, count), + version, count); + + count = 0; + while ( *cur ) { + char* begin = cur; + /* Find all digits: */ + while ( isdigit(*cur) ) cur++; + if ( begin != cur ) { + int is_end = *cur == '\0'; + *cur = '\0'; + lua_pushnumber(L, atoi(begin)); + count++; + if ( is_end ) break; + cur++; + } + while ( *cur && ! isdigit(*cur) ) cur++; + } + + return count; +} + +static int lz_assert(lua_State *L, int result, const z_stream* stream, const char* file, int line) { + /* Both of these are "normal" return codes: */ + if ( result == Z_OK || result == Z_STREAM_END ) return result; + switch ( result ) { + case Z_NEED_DICT: + lua_pushfstring(L, "RequiresDictionary: input stream requires a dictionary to be deflated (%s) at %s line %d", + stream->msg, file, line); + break; + case Z_STREAM_ERROR: + lua_pushfstring(L, "InternalError: inconsistent internal zlib stream (%s) at %s line %d", + stream->msg, file, line); + break; + case Z_DATA_ERROR: + lua_pushfstring(L, "InvalidInput: input string does not conform to zlib format or checksum failed at %s line %d", + file, line); + break; + case Z_MEM_ERROR: + lua_pushfstring(L, "OutOfMemory: not enough memory (%s) at %s line %d", + stream->msg, file, line); + break; + case Z_BUF_ERROR: + lua_pushfstring(L, "InternalError: no progress possible (%s) at %s line %d", + stream->msg, file, line); + break; + case Z_VERSION_ERROR: + lua_pushfstring(L, "IncompatibleLibrary: built with version %s, but dynamically linked with version %s (%s) at %s line %d", + ZLIB_VERSION, zlibVersion(), stream->msg, file, line); + break; + default: + lua_pushfstring(L, "ZLibError: unknown code %d (%s) at %s line %d", + result, stream->msg, file, line); + } + lua_error(L); + return result; +} + +/** + * @upvalue z_stream - Memory for the z_stream. + * @upvalue remainder - Any remainder from the last deflate call. + * + * @param string - "print" to deflate stream. + * @param int - flush output buffer? Z_SYNC_FLUSH, Z_FULL_FLUSH, or Z_FINISH. + * + * if no params, terminates the stream (as if we got empty string and Z_FINISH). + */ +static int lz_filter_impl(lua_State *L, int (*filter)(z_streamp, int), int (*end)(z_streamp), const char* name) { + int flush = Z_NO_FLUSH, result; + z_stream* stream; + luaL_Buffer buff; + size_t avail_in; + + if ( filter == deflate ) { + const char *const opts[] = { "none", "sync", "full", "finish", NULL }; + flush = luaL_checkoption(L, 2, opts[0], opts); + if ( flush ) flush++; + /* Z_NO_FLUSH(0) Z_SYNC_FLUSH(2), Z_FULL_FLUSH(3), Z_FINISH (4) */ + + /* No arguments or nil, we are terminating the stream: */ + if ( lua_gettop(L) == 0 || lua_isnil(L, 1) ) { + flush = Z_FINISH; + } + } + + stream = (z_stream*)lua_touserdata(L, lua_upvalueindex(1)); + if ( stream == NULL ) { + if ( lua_gettop(L) >= 1 && lua_isstring(L, 1) ) { + lua_pushfstring(L, "IllegalState: calling %s function when stream was previously closed", name); + lua_error(L); + } + lua_pushstring(L, ""); + lua_pushboolean(L, 1); + return 2; /* Ignore duplicate calls to "close". */ + } + + luaL_buffinit(L, &buff); + + if ( lua_gettop(L) > 1 ) lua_pushvalue(L, 1); + + if ( lua_isstring(L, lua_upvalueindex(2)) ) { + lua_pushvalue(L, lua_upvalueindex(2)); + if ( lua_gettop(L) > 1 && lua_isstring(L, -2) ) { + lua_concat(L, 2); + } + } + + /* Do the actual deflate'ing: */ + if (lua_gettop(L) > 0) { + stream->next_in = (unsigned char*)lua_tolstring(L, -1, &avail_in); + } else { + stream->next_in = NULL; + avail_in = 0; + } + stream->avail_in = avail_in; + + if ( ! stream->avail_in && ! flush ) { + /* Passed empty string, make it a noop instead of erroring out. */ + lua_pushstring(L, ""); + lua_pushboolean(L, 0); + lua_pushinteger(L, stream->total_in); + lua_pushinteger(L, stream->total_out); + return 4; + } + + do { + stream->next_out = (unsigned char*)luaL_prepbuffer(&buff); + stream->avail_out = LUAL_BUFFERSIZE; + result = filter(stream, flush); + if ( Z_BUF_ERROR != result ) { + /* Ignore Z_BUF_ERROR since that just indicates that we + * need a larger buffer in order to proceed. Thanks to + * Tobias Markmann for finding this bug! + */ + lz_assert(L, result, stream, __FILE__, __LINE__); + } + luaL_addsize(&buff, LUAL_BUFFERSIZE - stream->avail_out); + } while ( stream->avail_out == 0 ); + + /* Need to do this before we alter the stack: */ + luaL_pushresult(&buff); + + /* Save remainder in lua_upvalueindex(2): */ + if ( NULL != stream->next_in ) { + lua_pushlstring(L, (char*)stream->next_in, stream->avail_in); + lua_replace(L, lua_upvalueindex(2)); + } + + /* "close" the stream/remove finalizer: */ + if ( result == Z_STREAM_END ) { + /* Clear-out the metatable so end is not called twice: */ + lua_pushnil(L); + lua_setmetatable(L, lua_upvalueindex(1)); + + /* nil the upvalue: */ + lua_pushnil(L); + lua_replace(L, lua_upvalueindex(1)); + + /* Close the stream: */ + lz_assert(L, end(stream), stream, __FILE__, __LINE__); + + lua_pushboolean(L, 1); + } else { + lua_pushboolean(L, 0); + } + lua_pushinteger(L, stream->total_in); + lua_pushinteger(L, stream->total_out); + return 4; +} + +static void lz_create_deflate_mt(lua_State *L) { + luaL_newmetatable(L, "lz.deflate.meta"); /* {} */ + + lua_pushcfunction(L, lz_deflate_delete); + lua_setfield(L, -2, "__gc"); + + lua_pop(L, 1); /* */ +} + +static int lz_deflate_new(lua_State *L) { + int level = luaL_optint(L, 1, Z_DEFAULT_COMPRESSION); + int window_size = luaL_optint(L, 2, MAX_WBITS); + + /* Allocate the stream: */ + z_stream* stream = (z_stream*)lua_newuserdata(L, sizeof(z_stream)); + + stream->zalloc = Z_NULL; + stream->zfree = Z_NULL; + + int result = deflateInit2(stream, level, Z_DEFLATED, window_size, + DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); + + lz_assert(L, result, stream, __FILE__, __LINE__); + + /* Don't allow destructor to execute unless deflateInit2 was successful: */ + luaL_getmetatable(L, "lz.deflate.meta"); + lua_setmetatable(L, -2); + + lua_pushnil(L); + lua_pushcclosure(L, lz_deflate, 2); + return 1; +} + +static int lz_deflate(lua_State *L) { + return lz_filter_impl(L, deflate, deflateEnd, "deflate"); +} + +static int lz_deflate_delete(lua_State *L) { + z_stream* stream = (z_stream*)lua_touserdata(L, 1); + + /* Ignore errors. */ + deflateEnd(stream); + + return 0; +} + + +static void lz_create_inflate_mt(lua_State *L) { + luaL_newmetatable(L, "lz.inflate.meta"); /* {} */ + + lua_pushcfunction(L, lz_inflate_delete); + lua_setfield(L, -2, "__gc"); + + lua_pop(L, 1); /* */ +} + +static int lz_inflate_new(lua_State *L) { + /* Allocate the stream */ + z_stream* stream = (z_stream*)lua_newuserdata(L, sizeof(z_stream)); + + /* By default, we will do gzip header detection w/ max window size */ + int window_size = lua_isnumber(L, 1) ? lua_tointeger(L, 1) : MAX_WBITS + 32; + + stream->zalloc = Z_NULL; + stream->zfree = Z_NULL; + stream->next_in = Z_NULL; + stream->avail_in = 0; + + lz_assert(L, inflateInit2(stream, window_size), stream, __FILE__, __LINE__); + + /* Don't allow destructor to execute unless deflateInit was successful: */ + luaL_getmetatable(L, "lz.inflate.meta"); + lua_setmetatable(L, -2); + + lua_pushnil(L); + lua_pushcclosure(L, lz_inflate, 2); + return 1; +} + +static int lz_inflate(lua_State *L) { + return lz_filter_impl(L, inflate, inflateEnd, "inflate"); +} + +static int lz_inflate_delete(lua_State *L) { + z_stream* stream = (z_stream*)lua_touserdata(L, 1); + + /* Ignore errors: */ + inflateEnd(stream); + + return 0; +} + +static int lz_checksum(lua_State *L) { + if ( lua_gettop(L) <= 0 ) { + lua_pushvalue(L, lua_upvalueindex(3)); + lua_pushvalue(L, lua_upvalueindex(4)); + } else if ( lua_isfunction(L, 1) ) { + checksum_combine_t combine = (checksum_combine_t) + lua_touserdata(L, lua_upvalueindex(2)); + + lua_pushvalue(L, 1); + lua_call(L, 0, 2); + if ( ! lua_isnumber(L, -2) || ! lua_isnumber(L, -1) ) { + luaL_argerror(L, 1, "expected function to return two numbers"); + } + + /* Calculate and replace the checksum */ + lua_pushnumber(L, + combine(lua_tonumber(L, lua_upvalueindex(3)), + lua_tonumber(L, -2), + lua_tonumber(L, -1))); + lua_pushvalue(L, -1); + lua_replace(L, lua_upvalueindex(3)); + + /* Calculate and replace the length */ + lua_pushnumber(L, + lua_tonumber(L, lua_upvalueindex(4)) + lua_tonumber(L, -2)); + lua_pushvalue(L, -1); + lua_replace(L, lua_upvalueindex(4)); + } else { + const Bytef* str; + size_t len; + + checksum_t checksum = (checksum_t) + lua_touserdata(L, lua_upvalueindex(1)); + str = (const Bytef*)luaL_checklstring(L, 1, &len); + + /* Calculate and replace the checksum */ + lua_pushnumber(L, + checksum(lua_tonumber(L, lua_upvalueindex(3)), + str, + len)); + lua_pushvalue(L, -1); + lua_replace(L, lua_upvalueindex(3)); + + /* Calculate and replace the length */ + lua_pushnumber(L, + lua_tonumber(L, lua_upvalueindex(4)) + len); + lua_pushvalue(L, -1); + lua_replace(L, lua_upvalueindex(4)); + } + return 2; +} + +static int lz_checksum_new(lua_State *L, checksum_t checksum, checksum_combine_t combine) { + lua_pushlightuserdata(L, checksum); + lua_pushlightuserdata(L, combine); + lua_pushnumber(L, checksum(0L, Z_NULL, 0)); + lua_pushnumber(L, 0); + lua_pushcclosure(L, lz_checksum, 4); + return 1; +} + +static int lz_adler32(lua_State *L) { + return lz_checksum_new(L, adler32, adler32_combine); +} + +static int lz_crc32(lua_State *L) { + return lz_checksum_new(L, crc32, crc32_combine); +} + +static const luaL_Reg zlib_functions[] = { + { "deflate", lz_deflate_new }, + { "inflate", lz_inflate_new }, + { "adler32", lz_adler32 }, + { "crc32", lz_crc32 }, + { "version", lz_version }, + { NULL, NULL } +}; + +#define SETLITERAL(n,v) (lua_pushliteral(L, n), lua_pushliteral(L, v), lua_settable(L, -3)) +#define SETINT(n,v) (lua_pushliteral(L, n), lua_pushinteger(L, v), lua_settable(L, -3)) + +LUALIB_API int luaopen_zlib(lua_State * const L) { + lz_create_deflate_mt(L); + lz_create_inflate_mt(L); + + luaL_register(L, "zlib", zlib_functions); + + SETINT("BEST_SPEED", Z_BEST_SPEED); + SETINT("BEST_COMPRESSION", Z_BEST_COMPRESSION); + + SETLITERAL("_COPYRIGHT", "Copyright (c) 2009-2010 Brian Maher"); + SETLITERAL("_DESCRIPTION", "Yet another binding to the zlib library"); + SETLITERAL("_VERSION", "lua-zlib $Id$ $Format:%d$"); + + /* Expose this to lua so we can do a test: */ + SETINT("_TEST_BUFSIZ", LUAL_BUFFERSIZE); + + return 1; +} diff --git a/3rdparty/lua-zlib/rockspec b/3rdparty/lua-zlib/rockspec new file mode 100644 index 00000000000..d248bc099ed --- /dev/null +++ b/3rdparty/lua-zlib/rockspec @@ -0,0 +1,35 @@ +package = "lua-zlib" +version = "0.3-1" +source = { + url = "git://github.com/brimworks/lua-zlib.git", + tag = "v0.4", +} +description = { + summary = "Simple streaming interface to zlib for Lua.", + detailed = [[ + Simple streaming interface to zlib for Lua. + Consists of two functions: inflate and deflate. + Both functions return "stream functions" (takes a buffer of input and returns a buffer of output). + This project is hosted on github. + ]], + homepage = "https://github.com/brimworks/lua-zlib", + license = "MIT" +} +dependencies = { + "lua >= 5.1, < 5.3" +} +external_dependencies = { + ZLIB = { + header = "zlib.h" + } +} + +build = { + type = "builtin", + modules = { + zlib = { + sources = { "lua_zlib.c" }; + libraries = { "z" }, + }; + } +} diff --git a/3rdparty/lua-zlib/tap.lua b/3rdparty/lua-zlib/tap.lua new file mode 100644 index 00000000000..05266a9c997 --- /dev/null +++ b/3rdparty/lua-zlib/tap.lua @@ -0,0 +1,24 @@ +local tap_module = {} + +local os = require("os") + +local counter = 1 +local failed = false + +function tap_module.ok(assert_true, desc) + local msg = ( assert_true and "ok " or "not ok " ) .. counter + if ( not assert_true ) then + failed = true + end + if ( desc ) then + msg = msg .. " - " .. desc + end + print(msg) + counter = counter + 1 +end + +function tap_module.exit() + os.exit(failed and 1 or 0) +end + +return tap_module diff --git a/3rdparty/lua-zlib/test.lua b/3rdparty/lua-zlib/test.lua new file mode 100644 index 00000000000..d64e1835506 --- /dev/null +++ b/3rdparty/lua-zlib/test.lua @@ -0,0 +1,198 @@ +print "1..9" + +local src_dir, build_dir = ... +package.path = (src_dir or "./") .. "?.lua;" .. package.path +package.cpath = (build_dir or "./") .. "?.so;" .. package.cpath + +local tap = require("tap") +local lz = require("zlib") +local ok = tap.ok +local table = require("table") +local io = require("io") + +function main() + test_stats() + test_buff_err() + test_small_inputs() + test_basic() + test_large() + test_no_input() + test_invalid_input() + test_streaming() + test_illegal_state() + test_checksum() + test_version() + test_tom_macwright() + test_amnon_david() +end + +function test_tom_macwright() + local deflated = + assert(io.open(src_dir.. "/tom_macwright.gz")):read("*a") + + local inflated = lz.inflate()(deflated) + + local expected_inflated = + assert(io.open(src_dir.. "/tom_macwright.out")):read("*a") + + ok(expected_inflated == inflated, "Tom MacWright Test") +end + +function test_amnon_david() + local body = assert(io.open(src_dir.."/amnon_david.gz")):read("*a") + + local inflate = lz.inflate() + local inflated, eof, bytes_in, bytes_out = inflate(body) + + local deflate = lz.deflate() + local deflated, eof, bytes_in, bytes_out = deflate(inflated, "full") +end + +function test_stats() + local string = ("one"):rep(20) + local deflated, eof, bin, bout = lz.deflate()(string, 'finish') + ok(eof == true, "eof is true (" .. tostring(eof) .. ")"); + ok(bin > bout, "bytes in is greater than bytes out?") + ok(#deflated == bout, "bytes out is the same size as deflated string length") + ok(#string == bin, "bytes in is the same size as the input string length") +end + +-- Thanks to Tobias Markmann for the bug report! We are trying to +-- force inflate() to return a Z_BUF_ERROR (which should be recovered +-- from). For some reason this only happens when the input is exactly +-- LUAL_BUFFERSIZE (at least on my machine). +function test_buff_err() + local text = ("X"):rep(lz._TEST_BUFSIZ); + + local deflated = lz.deflate()(text, 'finish') + + for i=1,#deflated do + lz.inflate()(deflated:sub(1,i)) + end +end + +function test_small_inputs() + local text = ("X"):rep(lz._TEST_BUFSIZ); + + local deflated = lz.deflate()(text, 'finish') + + local inflated = {} + local inflator = lz.inflate() + for i=1,#deflated do + local part = inflator(deflated:sub(i,i)) + table.insert(inflated, part) + end + inflated = table.concat(inflated) + ok(inflated == text, "Expected " .. #text .. " Xs got " .. #inflated) +end + +function test_basic() + local test_string = "abcdefghijklmnopqrstuv" + + ok(lz.inflate()(lz.deflate()(), "finish") == "") + + -- Input to deflate is same as output to inflate: + local deflated = lz.deflate()(test_string, "finish") + local inflated = lz.inflate()(deflated, "finish") + + ok(test_string == inflated, "'" .. tostring(test_string) .. "' == '" .. tostring(inflated) .. "'") +end + +function test_large() + -- Try a larger string: + local numbers = "" + for i=1, 100 do numbers = numbers .. string.format("%3d", i) end + local numbers_table = {} + for i=1, 10000 do numbers_table[i] = numbers end + local test_string = table.concat(numbers_table, "\n") + + local deflated = lz.deflate()(test_string, "finish") + local inflated = lz.inflate()(deflated, "finish") + ok(test_string == inflated, "large string") +end + +function test_no_input() + local stream = lz.deflate() + local deflated = stream("") + deflated = deflated .. stream("") + deflated = deflated .. stream(nil, "finish") + ok("" == lz.inflate()(deflated, "finish"), "empty string") +end + +function test_invalid_input() + local stream = lz.inflate() + local isok, err = pcall( + function() + stream("bad input") + end) + ok(not isok) + ok(string.find(err, "^InvalidInput"), + string.format("InvalidInput error (%s)", err)) +end + +function test_streaming() + local shrink = lz.deflate(lz.BEST_COMPRESSION) + local enlarge = lz.inflate() + local expected = {} + local got = {} + local chant = "Isn't He great, isn't He wonderful?\n" + for i=1,100 do + if ( i == 100 ) then + chant = nil + print "EOF round" + end + local shrink_part, shrink_eof = shrink(chant) + local enlarge_part, enlarge_eof = enlarge(shrink_part) + if ( i == 100 ) then + if not shrink_eof then error("expected eof after shrinking flush") end + if not enlarge_eof then error("expected eof after enlarging") end + else + if shrink_eof then error("unexpected eof after shrinking") end + if enlarge_eof then error("unexpected eof after enlarging") end + end + if enlarge_part then table.insert(got, enlarge_part) end + if chant then table.insert(expected, chant) end + end + ok(table.concat(got) == table.concat(expected), "streaming works") +end + +function test_illegal_state() + local stream = lz.deflate() + stream("abc") + stream() -- eof/close + + local _, emsg = pcall( + function() + stream("printing on 'closed' handle") + end) + ok(string.find(emsg, "^IllegalState"), + string.format("IllegalState error (%s)", emsg)) + + local enlarge = lz.inflate() +end + +function test_checksum() + for _, factory in pairs{lz.crc32, lz.adler32} do + local csum = factory()("one two") + + -- Multiple calls: + local compute = factory() + compute("one") + assert(csum == compute(" two")) + + -- Multiple compute_checksums joined: + local compute1, compute2 = factory(), factory() + compute1("one") + compute2(" two") + assert(csum == compute1(compute2)) + end +end + +function test_version() + local major, minor, patch = lz.version() + ok(1 == major, "major version 1 == " .. major); + ok(type(minor) == "number", "minor version is number (" .. minor .. ")") + ok(type(patch) == "number", "patch version is number (" .. patch .. ")") +end + +main() diff --git a/3rdparty/lua-zlib/tom_macwright.gz b/3rdparty/lua-zlib/tom_macwright.gz new file mode 100644 index 00000000000..bb9060b2535 --- /dev/null +++ b/3rdparty/lua-zlib/tom_macwright.gz @@ -0,0 +1,4 @@ +x[ +0E*fIg(NL#m[\scy*=&N:'I1Yi[pzU +R?0JzQꁭ%Iw +cǩ)˘lbgФ!ሌv򧮮K EF}H \ No newline at end of file diff --git a/3rdparty/lua-zlib/tom_macwright.out b/3rdparty/lua-zlib/tom_macwright.out new file mode 100644 index 00000000000..ca88bcb6c2d Binary files /dev/null and b/3rdparty/lua-zlib/tom_macwright.out differ diff --git a/3rdparty/lua-zlib/zlib.def b/3rdparty/lua-zlib/zlib.def new file mode 100644 index 00000000000..d6c5a916b64 --- /dev/null +++ b/3rdparty/lua-zlib/zlib.def @@ -0,0 +1,2 @@ +EXPORTS +luaopen_zlib diff --git a/3rdparty/luafilesystem/.travis.yml b/3rdparty/luafilesystem/.travis.yml new file mode 100644 index 00000000000..67b5812e09e --- /dev/null +++ b/3rdparty/luafilesystem/.travis.yml @@ -0,0 +1,33 @@ +language: c + +env: + global: + - LUAROCKS=2.2.0-rc1 + matrix: + - LUA=lua5.1 + - LUA=lua5.2 + - LUA=lua5.3 + - LUA=luajit + +branches: + only: + - master + +before_install: + - bash .travis/setup_lua.sh + - sudo pip install cpp-coveralls + +install: + - sudo luarocks make rockspecs/luafilesystem-cvs-3.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage" + +script: + - cd tests + - sudo lua test.lua + +after_success: + - coveralls -b .. -r .. -E usr + +notifications: + email: + on_success: change + on_failure: always diff --git a/3rdparty/luafilesystem/.travis/platform.sh b/3rdparty/luafilesystem/.travis/platform.sh new file mode 100644 index 00000000000..4a3af0d487e --- /dev/null +++ b/3rdparty/luafilesystem/.travis/platform.sh @@ -0,0 +1,15 @@ +if [ -z "$PLATFORM" ]; then + PLATFORM=$TRAVIS_OS_NAME; +fi + +if [ "$PLATFORM" == "osx" ]; then + PLATFORM="macosx"; +fi + +if [ -z "$PLATFORM" ]; then + if [ "$(uname)" == "Linux" ]; then + PLATFORM="linux"; + else + PLATFORM="macosx"; + fi; +fi diff --git a/3rdparty/luafilesystem/.travis/setup_lua.sh b/3rdparty/luafilesystem/.travis/setup_lua.sh new file mode 100644 index 00000000000..373e24d979b --- /dev/null +++ b/3rdparty/luafilesystem/.travis/setup_lua.sh @@ -0,0 +1,101 @@ +#! /bin/bash + +# A script for setting up environment for travis-ci testing. +# Sets up Lua and Luarocks. +# LUA must be "lua5.1", "lua5.2" or "luajit". +# luajit2.0 - master v2.0 +# luajit2.1 - master v2.1 + +LUAJIT_BASE="LuaJIT-2.0.3" + +source .travis/platform.sh + +LUAJIT="no" + +if [ "$PLATFORM" == "macosx" ]; then + if [ "$LUA" == "luajit" ]; then + LUAJIT="yes"; + fi + if [ "$LUA" == "luajit2.0" ]; then + LUAJIT="yes"; + fi + if [ "$LUA" == "luajit2.1" ]; then + LUAJIT="yes"; + fi; +elif [ "$(expr substr $LUA 1 6)" == "luajit" ]; then + LUAJIT="yes"; +fi + +if [ "$LUAJIT" == "yes" ]; then + + if [ "$LUA" == "luajit" ]; then + curl http://luajit.org/download/$LUAJIT_BASE.tar.gz | tar xz; + else + git clone http://luajit.org/git/luajit-2.0.git $LUAJIT_BASE; + fi + + cd $LUAJIT_BASE + + if [ "$LUA" == "luajit2.1" ]; then + git checkout v2.1; + fi + + make && sudo make install + + if [ "$LUA" == "luajit2.1" ]; then + sudo ln -s /usr/local/bin/luajit-2.1.0-alpha /usr/local/bin/luajit + sudo ln -s /usr/local/bin/luajit /usr/local/bin/lua; + else + sudo ln -s /usr/local/bin/luajit /usr/local/bin/lua; + fi; + +else + if [ "$LUA" == "lua5.1" ]; then + curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz + cd lua-5.1.5; + elif [ "$LUA" == "lua5.2" ]; then + curl http://www.lua.org/ftp/lua-5.2.3.tar.gz | tar xz + cd lua-5.2.3; + elif [ "$LUA" == "lua5.3" ]; then + curl http://www.lua.org/work/lua-5.3.0-beta.tar.gz | tar xz + cd lua-5.3.0-beta; + fi + sudo make $PLATFORM install; +fi + +cd $TRAVIS_BUILD_DIR; + +LUAROCKS_BASE=luarocks-$LUAROCKS + +# curl http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz + +git clone https://github.com/keplerproject/luarocks.git $LUAROCKS_BASE +cd $LUAROCKS_BASE + +git checkout v$LUAROCKS + +if [ "$LUA" == "luajit" ]; then + ./configure --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.0; +elif [ "$LUA" == "luajit2.0" ]; then + ./configure --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.0; +elif [ "$LUA" == "luajit2.1" ]; then + ./configure --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.1; +else + ./configure; +fi + +make build && sudo make install + +cd $TRAVIS_BUILD_DIR + +rm -rf $LUAROCKS_BASE + +if [ "$LUAJIT" == "yes" ]; then + rm -rf $LUAJIT_BASE; +elif [ "$LUA" == "lua5.1" ]; then + rm -rf lua-5.1.5; +elif [ "$LUA" == "lua5.2" ]; then + rm -rf lua-5.2.3; +elif [ "$LUA" == "lua5.3" ]; then + rm -rf lua-5.3.0-beta; +fi diff --git a/3rdparty/luafilesystem/LICENSE b/3rdparty/luafilesystem/LICENSE new file mode 100644 index 00000000000..8475345a64e --- /dev/null +++ b/3rdparty/luafilesystem/LICENSE @@ -0,0 +1,21 @@ +Copyright © 2003-2014 Kepler Project. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/3rdparty/luafilesystem/Makefile b/3rdparty/luafilesystem/Makefile new file mode 100644 index 00000000000..b834a4d51ab --- /dev/null +++ b/3rdparty/luafilesystem/Makefile @@ -0,0 +1,25 @@ +# $Id: Makefile,v 1.36 2009/09/21 17:02:44 mascarenhas Exp $ + +T= lfs + +CONFIG= ./config + +include $(CONFIG) + +SRCS= src/$T.c +OBJS= src/$T.o + +lib: src/lfs.so + +src/lfs.so: $(OBJS) + MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; $(CC) $(CFLAGS) $(LIB_OPTION) -o src/lfs.so $(OBJS) + +test: lib + LUA_CPATH=./src/?.so lua tests/test.lua + +install: + mkdir -p $(LUA_LIBDIR) + cp src/lfs.so $(LUA_LIBDIR) + +clean: + rm -f src/lfs.so $(OBJS) diff --git a/3rdparty/luafilesystem/Makefile.win b/3rdparty/luafilesystem/Makefile.win new file mode 100644 index 00000000000..65cab812408 --- /dev/null +++ b/3rdparty/luafilesystem/Makefile.win @@ -0,0 +1,25 @@ +# $Id: Makefile.win,v 1.11 2008/05/07 19:06:37 carregal Exp $ + +T= lfs + +include config.win + +SRCS= src\$T.c +OBJS= src\$T.obj + +lib: src\lfs.dll + +.c.obj: + $(CC) /c /Fo$@ $(CFLAGS) $< + +src\lfs.dll: $(OBJS) + link /dll /def:src\$T.def /out:src\lfs.dll $(OBJS) "$(LUA_LIB)" + IF EXIST src\lfs.dll.manifest mt -manifest src\lfs.dll.manifest -outputresource:src\lfs.dll;2 + +install: src\lfs.dll + IF NOT EXIST "$(LUA_LIBDIR)" mkdir "$(LUA_LIBDIR)" + copy src\lfs.dll "$(LUA_LIBDIR)" + +clean: + del src\lfs.dll $(OBJS) src\$T.lib src\$T.exp + IF EXIST src\lfs.dll.manifest del src\lfs.dll.manifest \ No newline at end of file diff --git a/3rdparty/luafilesystem/README b/3rdparty/luafilesystem/README new file mode 100644 index 00000000000..9d37a4e2513 --- /dev/null +++ b/3rdparty/luafilesystem/README @@ -0,0 +1,23 @@ +LuaFileSystem - File System Library for Lua +Copyright 2003-2015 Kepler Project + +http://keplerproject.github.io/luafilesystem + +Description +----------- +LuaFileSystem is a Lua library developed to complement the set of functions +related to file systems offered by the standard Lua distribution. + +LuaFileSystem offers a portable way to access the underlying directory structure and file attributes. +LuaFileSystem is free software and uses the same license as Lua 5.1 + +LuaRocks Installation +--------------------- + +``` +luarocks install luafilesystem +``` + +Documentation +------------- +Please check the documentation at doc/us/ for more information. diff --git a/3rdparty/luafilesystem/config b/3rdparty/luafilesystem/config new file mode 100644 index 00000000000..cfd4c6a6d3e --- /dev/null +++ b/3rdparty/luafilesystem/config @@ -0,0 +1,24 @@ +# Installation directories + +# Default installation prefix +PREFIX=/usr/local + +# System's libraries directory (where binary libraries are installed) +LUA_LIBDIR= $(PREFIX)/lib/lua/5.1 + +# Lua includes directory +LUA_INC= $(PREFIX)/include + +# OS dependent +LIB_OPTION= -shared #for Linux +#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X + +LIBNAME= $T.so.$V + +# Compilation directives +WARN= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic +INCS= -I$(LUA_INC) +CFLAGS= $(WARN) $(INCS) +CC= gcc + +# $Id: config,v 1.21 2007/10/27 22:42:32 carregal Exp $ diff --git a/3rdparty/luafilesystem/config.win b/3rdparty/luafilesystem/config.win new file mode 100644 index 00000000000..50e81f64206 --- /dev/null +++ b/3rdparty/luafilesystem/config.win @@ -0,0 +1,19 @@ +# Installation directories +# System's libraries directory (where binary libraries are installed) +LUA_LIBDIR= "c:\lua5.1" + +# Lua includes directory +LUA_INC= "c:\lua5.1\include" + +# Lua library +LUA_LIB= "c:\lua5.1\lua5.1.lib" + +LIBNAME= $T.dll + +# Compilation directives +WARN= /O2 +INCS= /I$(LUA_INC) +CFLAGS= /MD $(WARN) $(INCS) +CC= cl + +# $Id: config.win,v 1.7 2008/03/25 17:39:29 mascarenhas Exp $ diff --git a/3rdparty/luafilesystem/doc/us/doc.css b/3rdparty/luafilesystem/doc/us/doc.css new file mode 100644 index 00000000000..e816a7e2c63 --- /dev/null +++ b/3rdparty/luafilesystem/doc/us/doc.css @@ -0,0 +1,212 @@ +body { + margin-left: 1em; + margin-right: 1em; + font-family: arial, helvetica, geneva, sans-serif; + background-color:#ffffff; margin:0px; +} + +code { + font-family: "Andale Mono", monospace; +} + +tt { + font-family: "Andale Mono", monospace; +} + +body, td, th { font-size: 11pt; } + +h1, h2, h3, h4 { margin-left: 0em; } + +textarea, pre, tt { font-size:10pt; } +body, td, th { color:#000000; } +small { font-size:0.85em; } +h1 { font-size:1.5em; } +h2 { font-size:1.25em; } +h3 { font-size:1.15em; } +h4 { font-size:1.06em; } + +a:link { font-weight:bold; color: #004080; text-decoration: none; } +a:visited { font-weight:bold; color: #006699; text-decoration: none; } +a:link:hover { text-decoration:underline; } +hr { color:#cccccc } +img { border-width: 0px; } + +h3 { padding-top: 1em; } + +p { margin-left: 1em; } + +p.name { + font-family: "Andale Mono", monospace; + padding-top: 1em; + margin-left: 0em; +} + +blockquote { margin-left: 3em; } + +.example { + background-color: rgb(245, 245, 245); + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: silver; + border-right-color: silver; + border-bottom-color: silver; + border-left-color: silver; + padding: 1em; + margin-left: 1em; + margin-right: 1em; + font-family: "Andale Mono", monospace; + font-size: smaller; +} + +hr { + margin-left: 0em; + background: #00007f; + border: 0px; + height: 1px; +} + +ul { list-style-type: disc; } + +table.index { border: 1px #00007f; } +table.index td { text-align: left; vertical-align: top; } +table.index ul { padding-top: 0em; margin-top: 0em; } + +table { + border: 1px solid black; + border-collapse: collapse; + margin-left: auto; + margin-right: auto; +} + +th { + border: 1px solid black; + padding: 0.5em; +} + +td { + border: 1px solid black; + padding: 0.5em; +} +div.header, div.footer { margin-left: 0em; } + +#container { + margin-left: 1em; + margin-right: 1em; + background-color: #f0f0f0; +} + +#product { + text-align: center; + border-bottom: 1px solid #cccccc; + background-color: #ffffff; +} + +#product big { + font-size: 2em; +} + +#product_logo { +} + +#product_name { +} + +#product_description { +} + +#main { + background-color: #f0f0f0; + border-left: 2px solid #cccccc; +} + +#navigation { + float: left; + width: 12em; + margin: 0; + vertical-align: top; + background-color: #f0f0f0; + overflow:visible; +} + +#navigation h1 { + background-color:#e7e7e7; + font-size:1.1em; + color:#000000; + text-align:left; + margin:0px; + padding:0.2em; + border-top:1px solid #dddddd; + border-bottom:1px solid #dddddd; +} + +#navigation ul { + font-size:1em; + list-style-type: none; + padding: 0; + margin: 1px; +} + +#navigation li { + text-indent: -1em; + margin: 0em 0em 0em 0.5em; + display: block; + padding: 3px 0px 0px 12px; +} + +#navigation li li a { + padding: 0px 3px 0px -1em; +} + +#content { + margin-left: 12em; + padding: 1em; + border-left: 2px solid #cccccc; + border-right: 2px solid #cccccc; + background-color: #ffffff; +} + +#about { + clear: both; + margin: 0; + padding: 5px; + border-top: 2px solid #cccccc; + background-color: #ffffff; +} + +@media print { + body { + font: 10pt "Times New Roman", "TimeNR", Times, serif; + } + a { + font-weight:bold; color: #004080; text-decoration: underline; + } + #main { + background-color: #ffffff; border-left: 0px; + } + #container { + margin-left: 2%; margin-right: 2%; background-color: #ffffff; + } + #content { + margin-left: 0px; padding: 1em; border-left: 0px; border-right: 0px; background-color: #ffffff; + } + #navigation { + display: none; + } + #product_logo { + display: none; + } + #about img { + display: none; + } + .example { + font-family: "Andale Mono", monospace; + font-size: 8pt; + page-break-inside: avoid; + } +} diff --git a/3rdparty/luafilesystem/doc/us/examples.html b/3rdparty/luafilesystem/doc/us/examples.html new file mode 100644 index 00000000000..2c1644cb8a0 --- /dev/null +++ b/3rdparty/luafilesystem/doc/us/examples.html @@ -0,0 +1,103 @@ + + + + LuaFileSystem + + + + + + +
+ +
+ +
LuaFileSystem
+
File System Library for the Lua Programming Language
+
+ +
+ + + +
+ +

Examples

+ +

Directory iterator

+ +

The following example iterates over a directory and recursively lists the +attributes for each file inside it.

+ +
+local lfs = require"lfs"
+
+function attrdir (path)
+    for file in lfs.dir(path) do
+        if file ~= "." and file ~= ".." then
+            local f = path..'/'..file
+            print ("\t "..f)
+            local attr = lfs.attributes (f)
+            assert (type(attr) == "table")
+            if attr.mode == "directory" then
+                attrdir (f)
+            else
+                for name, value in pairs(attr) do
+                    print (name, value)
+                end
+            end
+        end
+    end
+end
+
+attrdir (".")
+
+ +
+ +
+ +
+

Valid XHTML 1.0!

+

$Id: examples.html,v 1.8 2007/12/14 15:28:04 carregal Exp $

+
+ +
+ + + diff --git a/3rdparty/luafilesystem/doc/us/index.html b/3rdparty/luafilesystem/doc/us/index.html new file mode 100644 index 00000000000..2bb7f5d2cbb --- /dev/null +++ b/3rdparty/luafilesystem/doc/us/index.html @@ -0,0 +1,218 @@ + + + + LuaFileSystem + + + + + + +
+ +
+ +
LuaFileSystem
+
File System Library for the Lua Programming Language
+
+ +
+ + + +
+ +

Overview

+ +

LuaFileSystem is a Lua library +developed to complement the set of functions related to file +systems offered by the standard Lua distribution.

+ +

LuaFileSystem offers a portable way to access +the underlying directory structure and file attributes.

+ +

LuaFileSystem is free software and uses the same +license as Lua 5.1.

+ +

Status

+ +

Current version is 1.6.3. It works with Lua 5.1, 5.2 and 5.3.

+ +

Download

+ +

LuaFileSystem source can be downloaded from its +Github +page.

+ +

History

+ +
+
Version 1.6.3 [15/Jan/2015]
+
    +
  • Lua 5.3 support.
  • +
  • Assorted bugfixes.
  • +
+ +
Version 1.6.2 [??/Oct/2012]
+
    +
  • Full Lua 5.2 compatibility (with Lua 5.1 fallbacks)
  • +
+ +
Version 1.6.1 [01/Oct/2012]
+
    +
  • fix build for Lua 5.2
  • +
+ +
Version 1.6.0 [26/Sep/2012]
+
    +
  • getcwd fix for Android
  • +
  • support for Lua 5.2
  • +
  • add lfs.link
  • +
  • other bug fixes
  • +
+ +
Version 1.5.0 [20/Oct/2009]
+
    +
  • Added explicit next and close methods to second return value of lfs.dir +(the directory object), for explicit iteration or explicit closing.
  • +
  • Added directory locking via lfs.lock_dir function (see the manual).
  • +
+
Version 1.4.2 [03/Feb/2009]
+
+
    +
  • fixed bug [#13198] + lfs.attributes(filename, 'size') overflow on files > 2 Gb again (bug report and patch by KUBO Takehiro).
  • +
  • fixed bug [#39794] + Compile error on Solaris 10 (bug report and patch by Aaron B).
  • +
  • fixed compilation problems with Borland C.
  • +
+
+ +
Version 1.4.1 [07/May/2008]
+
+
    +
  • documentation review
  • +
  • fixed Windows compilation issues
  • +
  • fixed bug in the Windows tests (patch by Shmuel Zeigerman)
  • +
  • fixed bug [#2185] + lfs.attributes(filename, 'size') overflow on files > 2 Gb +
  • +
+
+ +
Version 1.4.0 [13/Feb/2008]
+
+
    +
  • added function + lfs.setmode + (works only in Windows systems).
  • +
  • lfs.attributes + raises an error if attribute does not exist
  • +
+
+ +
Version 1.3.0 [26/Oct/2007]
+
+ +
+ +
Version 1.2.1 [08/May/2007]
+
+
    +
  • compatible only with Lua 5.1 (Lua 5.0 support was dropped)
  • +
+
+ +
Version 1.2 [15/Mar/2006]
+
+ +
+ +
Version 1.1 [30/May/2005]
+
+ +
+ +
Version 1.0 [21/Jan/2005]
+
+ +
Version 1.0 Beta [10/Nov/2004]
+
+
+ +

Credits

+ +

LuaFileSystem was designed by Roberto Ierusalimschy, +André Carregal and Tomás Guisasola as part of the +Kepler Project, +which holds its copyright. LuaFileSystem is currently maintained by Fábio Mascarenhas.

+ +

Contact us

+ +

For more information please +contact us. +Comments are welcome!

+ +

You can also reach other Kepler developers and users on the Kepler Project +mailing list.

+ +
+ +
+ +
+

Valid XHTML 1.0!

+

$Id: index.html,v 1.44 2009/02/04 21:21:33 carregal Exp $

+
+ +
+ + + diff --git a/3rdparty/luafilesystem/doc/us/license.html b/3rdparty/luafilesystem/doc/us/license.html new file mode 100644 index 00000000000..30033817229 --- /dev/null +++ b/3rdparty/luafilesystem/doc/us/license.html @@ -0,0 +1,122 @@ + + + + LuaFileSystem + + + + + + +
+ +
+ +
LuaFileSystem
+
File System Library for the Lua Programming Language
+
+ +
+ + + +
+ +

License

+ +

+LuaFileSystem is free software: it can be used for both academic +and commercial purposes at absolutely no cost. There are no +royalties or GNU-like "copyleft" restrictions. LuaFileSystem +qualifies as +Open Source +software. +Its licenses are compatible with +GPL. +LuaFileSystem is not in the public domain and the +Kepler Project +keep its copyright. +The legal details are below. +

+ +

The spirit of the license is that you are free to use +LuaFileSystem for any purpose at no cost without having to ask us. +The only requirement is that if you do use LuaFileSystem, then you +should give us credit by including the appropriate copyright notice +somewhere in your product or its documentation.

+ +

The LuaFileSystem library is designed and implemented by Roberto +Ierusalimschy, André Carregal and Tomás Guisasola. +The implementation is not derived from licensed software.

+ +
+

Copyright © 2003 Kepler Project.

+ +

Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions:

+ +

The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software.

+ +

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.

+ +
+ +
+ +
+

Valid XHTML 1.0!

+

$Id: license.html,v 1.13 2008/02/11 22:42:21 carregal Exp $

+
+ +
+ + + diff --git a/3rdparty/luafilesystem/doc/us/luafilesystem.png b/3rdparty/luafilesystem/doc/us/luafilesystem.png new file mode 100644 index 00000000000..e1dd8c65b52 Binary files /dev/null and b/3rdparty/luafilesystem/doc/us/luafilesystem.png differ diff --git a/3rdparty/luafilesystem/doc/us/manual.html b/3rdparty/luafilesystem/doc/us/manual.html new file mode 100644 index 00000000000..33c1cbea573 --- /dev/null +++ b/3rdparty/luafilesystem/doc/us/manual.html @@ -0,0 +1,280 @@ + + + + LuaFileSystem + + + + + + +
+ +
+ +
LuaFileSystem
+
File System Library for the Lua Programming Language
+
+ +
+ + + +
+ +

Introduction

+ +

LuaFileSystem is a Lua library +developed to complement the set of functions related to file +systems offered by the standard Lua distribution.

+ +

LuaFileSystem offers a portable way to access +the underlying directory structure and file attributes.

+ +

Building

+ +

+LuaFileSystem should be built with Lua 5.1 so the language library +and header files for the target version must be installed properly. +

+ +

+LuaFileSystem offers a Makefile and a separate configuration file, +config, +which should be edited to suit your installation before running +make. +The file has some definitions like paths to the external libraries, +compiler options and the like. +

+ +

On Windows, the C runtime used to compile LuaFileSystem must be the same +runtime that Lua uses, or some LuaFileSystem functions will not work.

+ +

Installation

+ +

The easiest way to install LuaFileSystem is to use LuaRocks:

+ +
+luarocks install luafilesystem
+
+ +

If you prefer to install LuaFileSystem manually, the compiled binary should be copied to a directory in your +C path.

+ +

Reference

+ +

+LuaFileSystem offers the following functions: +

+ +
+
lfs.attributes (filepath [, aname])
+
Returns a table with the file attributes corresponding to + filepath (or nil followed by an error message + in case of error). + If the second optional argument is given, then only the value of the + named attribute is returned (this use is equivalent to + lfs.attributes(filepath).aname, but the table is not created + and only one attribute is retrieved from the O.S.). + The attributes are described as follows; + attribute mode is a string, all the others are numbers, + and the time related attributes use the same time reference of + os.time: +
+
dev
+
on Unix systems, this represents the device that the inode resides on. On Windows systems, + represents the drive number of the disk containing the file
+ +
ino
+
on Unix systems, this represents the inode number. On Windows systems this has no meaning
+ +
mode
+
string representing the associated protection mode (the values could be + file, directory, link, socket, + named pipe, char device, block device or + other)
+ +
nlink
+
number of hard links to the file
+ +
uid
+
user-id of owner (Unix only, always 0 on Windows)
+ +
gid
+
group-id of owner (Unix only, always 0 on Windows)
+ +
rdev
+
on Unix systems, represents the device type, for special file inodes. + On Windows systems represents the same as dev
+ +
access
+
time of last access
+ +
modification
+
time of last data modification
+ +
change
+
time of last file status change
+ +
size
+
file size, in bytes
+ +
blocks
+
block allocated for file; (Unix only)
+ +
blksize
+
optimal file system I/O blocksize; (Unix only)
+
+ This function uses stat internally thus if the given + filepath is a symbolic link, it is followed (if it points to + another link the chain is followed recursively) and the information + is about the file it refers to. + To obtain information about the link itself, see function + lfs.symlinkattributes. +
+ +
lfs.chdir (path)
+
Changes the current working directory to the given + path.
+ Returns true in case of success or nil plus an + error string.
+ +
lfs.lock_dir(path, [seconds_stale])
+
Creates a lockfile (called lockfile.lfs) in path if it does not + exist and returns the lock. If the lock already exists checks if + it's stale, using the second parameter (default for the second + parameter is INT_MAX, which in practice means the lock will never + be stale. To free the the lock call lock:free().
+ In case of any errors it returns nil and the error message. In + particular, if the lock exists and is not stale it returns the + "File exists" message.
+ +
lfs.currentdir ()
+
Returns a string with the current working directory or nil + plus an error string.
+ +
iter, dir_obj = lfs.dir (path)
+
+ Lua iterator over the entries of a given directory. + Each time the iterator is called with dir_obj it returns a directory entry's name as a string, or + nil if there are no more entries. You can also iterate by calling dir_obj:next(), and + explicitly close the directory before the iteration finished with dir_obj:close(). + Raises an error if path is not a directory. +
+ +
lfs.lock (filehandle, mode[, start[, length]])
+
Locks a file or a part of it. This function works on open files; the + file handle should be specified as the first argument. + The string mode could be either + r (for a read/shared lock) or w (for a + write/exclusive lock). The optional arguments start + and length can be used to specify a starting point and + its length; both should be numbers.
+ Returns true if the operation was successful; in + case of error, it returns nil plus an error string. +
+ +
lfs.link (old, new[, symlink])
+
Creates a link. The first argument is the object to link to + and the second is the name of the link. If the optional third + argument is true, the link will by a symbolic link (by default, a + hard link is created). +
+ +
lfs.mkdir (dirname)
+
Creates a new directory. The argument is the name of the new + directory.
+ Returns true if the operation was successful; + in case of error, it returns nil plus an error string. +
+ +
lfs.rmdir (dirname)
+
Removes an existing directory. The argument is the name of the directory.
+ Returns true if the operation was successful; + in case of error, it returns nil plus an error string.
+ +
lfs.setmode (file, mode)
+
Sets the writing mode for a file. The mode string can be either "binary" or "text". + Returns true followed the previous mode string for the file, or + nil followed by an error string in case of errors. + On non-Windows platforms, where the two modes are identical, + setting the mode has no effect, and the mode is always returned as binary. +
+ +
lfs.symlinkattributes (filepath [, aname])
+
Identical to lfs.attributes except that + it obtains information about the link itself (not the file it refers to). + On Windows this function does not yet support links, and is identical to + lfs.attributes. +
+ +
lfs.touch (filepath [, atime [, mtime]])
+
Set access and modification times of a file. This function is + a bind to utime function. The first argument is the + filename, the second argument (atime) is the access time, + and the third argument (mtime) is the modification time. + Both times are provided in seconds (which should be generated with + Lua standard function os.time). + If the modification time is omitted, the access time provided is used; + if both times are omitted, the current time is used.
+ Returns true if the operation was successful; + in case of error, it returns nil plus an error string. +
+ +
lfs.unlock (filehandle[, start[, length]])
+
Unlocks a file or a part of it. This function works on + open files; the file handle should be specified as the first + argument. The optional arguments start and + length can be used to specify a starting point and its + length; both should be numbers.
+ Returns true if the operation was successful; + in case of error, it returns nil plus an error string. +
+
+ +
+ +
+ +
+

Valid XHTML 1.0!

+

$Id: manual.html,v 1.45 2009/06/03 20:53:55 mascarenhas Exp $

+
+ +
+ + + diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-1.3.0-1.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.3.0-1.rockspec new file mode 100644 index 00000000000..d4d484f68a7 --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.3.0-1.rockspec @@ -0,0 +1,27 @@ +package = "LuaFileSystem" +version = "1.3.0-1" +source = { + url = "http://luaforge.net/frs/download.php/2679/luafilesystem-1.3.0.tar.gz" +} +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} +dependencies = { + "lua >= 5.1" +} +build = { + type = "make", + build_variables = { + LUA_INC = "$(LUA_INCDIR)", + LIB_OPTION = "$(LIBFLAG)" + }, + install_variables = { + LUA_LIBDIR = "$(LIBDIR)" + } +} diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.0-1.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.0-1.rockspec new file mode 100644 index 00000000000..b6936182394 --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.0-1.rockspec @@ -0,0 +1,27 @@ +package = "LuaFileSystem" +version = "1.4.0-1" +source = { + url = "http://luaforge.net/frs/download.php/3158/luafilesystem-1.4.0.tar.gz" +} +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} +dependencies = { + "lua >= 5.1" +} +build = { + type = "make", + build_variables = { + LUA_INC = "$(LUA_INCDIR)", + LIB_OPTION = "$(LIBFLAG)" + }, + install_variables = { + LUA_LIBDIR = "$(LIBDIR)" + } +} diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.0-2.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.0-2.rockspec new file mode 100644 index 00000000000..f7ed871527f --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.0-2.rockspec @@ -0,0 +1,43 @@ +package = "LuaFileSystem" +version = "1.4.0-2" +source = { + url = "http://luaforge.net/frs/download.php/3158/luafilesystem-1.4.0.tar.gz" +} +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} +dependencies = { + "lua >= 5.1" +} +build = { + platforms = { + unix = { + type = "make", + build_variables = { + LIB_OPTION = "$(LIBFLAG)", + CFLAGS = "$(CFLAGS) -I$(LUA_INCDIR)", + }, + install_variables = { + LUA_LIBDIR = "$(LIBDIR)" + } + }, + win32 = { + type = "make", + build_variables = { + LUA_LIB = "$(LUA_LIBDIR)\\lua5.1.lib", + CFLAGS = "/MD $(CFLAGS) /I$(LUA_INCDIR)", + }, + install_variables = { + LUA_LIBDIR = "$(LIBDIR)", + LUA_DIR = "$(LUADIR)", + BIN_DIR = "$(BINDIR)" + } + } + } +} \ No newline at end of file diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.1-1.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.1-1.rockspec new file mode 100644 index 00000000000..db3a3ebb6df --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.1-1.rockspec @@ -0,0 +1,43 @@ +package = "LuaFileSystem" +version = "1.4.1-1" +source = { + url = "http://luaforge.net/frs/download.php/3345/luafilesystem-1.4.1.tar.gz", +} +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} +dependencies = { + "lua >= 5.1" +} +build = { + platforms = { + unix = { + type = "make", + build_variables = { + LIB_OPTION = "$(LIBFLAG)", + CFLAGS = "$(CFLAGS) -I$(LUA_INCDIR) $(STAT64)", + }, + install_variables = { + LUA_LIBDIR = "$(LIBDIR)" + } + }, + win32 = { + type = "make", + build_variables = { + LUA_LIB = "$(LUA_LIBDIR)\\lua5.1.lib", + CFLAGS = "/MD $(CFLAGS) /I$(LUA_INCDIR)", + }, + install_variables = { + LUA_LIBDIR = "$(LIBDIR)", + LUA_DIR = "$(LUADIR)", + BIN_DIR = "$(BINDIR)" + } + } + } +} diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.1rc1-1.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.1rc1-1.rockspec new file mode 100644 index 00000000000..1194711715b --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.1rc1-1.rockspec @@ -0,0 +1,43 @@ +package = "LuaFileSystem" +version = "1.4.1rc1-1" +source = { + url = "http://luafilesystem.luaforge.net/luafilesystem-1.4.1rc1.tar.gz", +} +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} +dependencies = { + "lua >= 5.1" +} +build = { + platforms = { + unix = { + type = "make", + build_variables = { + LIB_OPTION = "$(LIBFLAG)", + CFLAGS = "$(CFLAGS) -I$(LUA_INCDIR) $(STAT64)", + }, + install_variables = { + LUA_LIBDIR = "$(LIBDIR)" + } + }, + win32 = { + type = "make", + build_variables = { + LUA_LIB = "$(LUA_LIBDIR)\\lua5.1.lib", + CFLAGS = "/MD $(CFLAGS) /I$(LUA_INCDIR)", + }, + install_variables = { + LUA_LIBDIR = "$(LIBDIR)", + LUA_DIR = "$(LUADIR)", + BIN_DIR = "$(BINDIR)" + } + } + } +} diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.2-1.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.2-1.rockspec new file mode 100644 index 00000000000..7cfe92b78ef --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.4.2-1.rockspec @@ -0,0 +1,26 @@ +package = "LuaFileSystem" + +version = "1.4.2-1" + +source = { + url = "http://luaforge.net/frs/download.php/3931/luafilesystem-1.4.2.tar.gz", +} + +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} + +dependencies = { + "lua >= 5.1" +} + +build = { + type = "module", + modules = { lfs = "src/lfs.c" } +} \ No newline at end of file diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-1.5.0-1.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.5.0-1.rockspec new file mode 100644 index 00000000000..1170ad25c90 --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.5.0-1.rockspec @@ -0,0 +1,27 @@ +package = "LuaFileSystem" + +version = "1.5.0-1" + +source = { + url = "http://cloud.github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.5.0.tar.gz", +} + +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} + +dependencies = { + "lua >= 5.1" +} + +build = { + type = "module", + modules = { lfs = "src/lfs.c" }, + copy_directories = { "doc", "tests" } +} diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.0-1.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.0-1.rockspec new file mode 100644 index 00000000000..82d349cf016 --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.0-1.rockspec @@ -0,0 +1,27 @@ +package = "LuaFileSystem" + +version = "1.6.0-1" + +source = { + url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.0.tar.gz", +} + +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} + +dependencies = { + "lua >= 5.1" +} + +build = { + type = "builtin", + modules = { lfs = "src/lfs.c" }, + copy_directories = { "doc", "tests" } +} diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.1-1.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.1-1.rockspec new file mode 100644 index 00000000000..7f45e332c44 --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.1-1.rockspec @@ -0,0 +1,27 @@ +package = "LuaFileSystem" + +version = "1.6.1-1" + +source = { + url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.1.tar.gz", +} + +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} + +dependencies = { + "lua >= 5.1" +} + +build = { + type = "builtin", + modules = { lfs = "src/lfs.c" }, + copy_directories = { "doc", "tests" } +} diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.2-1.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.2-1.rockspec new file mode 100644 index 00000000000..1c11efc89e1 --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.2-1.rockspec @@ -0,0 +1,27 @@ +package = "LuaFileSystem" + +version = "1.6.2-1" + +source = { + url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.2.tar.gz", +} + +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} + +dependencies = { + "lua >= 5.1" +} + +build = { + type = "builtin", + modules = { lfs = "src/lfs.c" }, + copy_directories = { "doc", "tests" } +} diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.3-1.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.3-1.rockspec new file mode 100644 index 00000000000..89b25d42fe3 --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-1.6.3-1.rockspec @@ -0,0 +1,28 @@ +package = "LuaFileSystem" +version = "1.6.3-1" +source = { + url = "git://github.com/keplerproject/luafilesystem", + tag = "v_1_6_3", +} +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]], + license = "MIT/X11", +} +dependencies = { + "lua >= 5.1" +} +build = { + type = "builtin", + modules = { + lfs = "src/lfs.c" + }, + copy_directories = { + "doc", "tests" + } +} diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-1.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-1.rockspec new file mode 100644 index 00000000000..a02d4f14e71 --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-1.rockspec @@ -0,0 +1,44 @@ +package = "LuaFileSystem" +version = "cvs-1" +source = { + url = "cvs://:pserver:anonymous:@cvs.luaforge.net:/cvsroot/luafilesystem", + cvs_tag = "HEAD" +} +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} +dependencies = { + "lua >= 5.1" +} +build = { + platforms = { + unix = { + type = "make", + build_variables = { + LIB_OPTION = "$(LIBFLAG)", + CFLAGS = "$(CFLAGS) -I$(LUA_INCDIR)", + }, + install_variables = { + LUA_LIBDIR = "$(LIBDIR)" + } + }, + win32 = { + type = "make", + build_variables = { + LUA_LIB = "$(LUA_LIBDIR)\\lua5.1.lib", + CFLAGS = "$(CFLAGS) /I$(LUA_INCDIR)", + }, + install_variables = { + LUA_LIBDIR = "$(LIBDIR)", + LUA_DIR = "$(LUADIR)", + BIN_DIR = "$(BINDIR)" + } + } + } +} diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-2.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-2.rockspec new file mode 100644 index 00000000000..651c7cf1317 --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-2.rockspec @@ -0,0 +1,26 @@ +package = "LuaFileSystem" + +version = "cvs-2" + +source = { + url = "git://github.com/keplerproject/luafilesystem.git", +} + +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} + +dependencies = { + "lua >= 5.1" +} + +build = { + type = "module", + modules = { lfs = "src/lfs.c" } +} diff --git a/3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-3.rockspec b/3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-3.rockspec new file mode 100644 index 00000000000..a4388cd7619 --- /dev/null +++ b/3rdparty/luafilesystem/rockspecs/luafilesystem-cvs-3.rockspec @@ -0,0 +1,27 @@ +package = "LuaFileSystem" + +version = "cvs-3" + +source = { + url = "git://github.com/keplerproject/luafilesystem.git", +} + +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} + +dependencies = { + "lua >= 5.1, < 5.4" +} + +build = { + type = "builtin", + modules = { lfs = "src/lfs.c" }, + copy_directories = { "doc", "tests" } +} diff --git a/3rdparty/luafilesystem/src/.gitignore b/3rdparty/luafilesystem/src/.gitignore new file mode 100644 index 00000000000..9d22eb46a9c --- /dev/null +++ b/3rdparty/luafilesystem/src/.gitignore @@ -0,0 +1,2 @@ +*.o +*.so diff --git a/3rdparty/luafilesystem/src/lfs.c b/3rdparty/luafilesystem/src/lfs.c new file mode 100644 index 00000000000..ac483fa067b --- /dev/null +++ b/3rdparty/luafilesystem/src/lfs.c @@ -0,0 +1,906 @@ +/* +** LuaFileSystem +** Copyright Kepler Project 2003 (http://www.keplerproject.org/luafilesystem) +** +** File system manipulation library. +** This library offers these functions: +** lfs.attributes (filepath [, attributename]) +** lfs.chdir (path) +** lfs.currentdir () +** lfs.dir (path) +** lfs.lock (fh, mode) +** lfs.lock_dir (path) +** lfs.mkdir (path) +** lfs.rmdir (path) +** lfs.setmode (filepath, mode) +** lfs.symlinkattributes (filepath [, attributename]) -- thanks to Sam Roberts +** lfs.touch (filepath [, atime [, mtime]]) +** lfs.unlock (fh) +** +** $Id: lfs.c,v 1.61 2009/07/04 02:10:16 mascarenhas Exp $ +*/ + +#ifndef LFS_DO_NOT_USE_LARGE_FILE +#ifndef _WIN32 +#ifndef _AIX +#define _FILE_OFFSET_BITS 64 /* Linux, Solaris and HP-UX */ +#else +#define _LARGE_FILES 1 /* AIX */ +#endif +#endif +#endif + +#ifndef LFS_DO_NOT_USE_LARGE_FILE +#define _LARGEFILE64_SOURCE +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#include +#include +#include +#include +#ifdef __BORLANDC__ + #include +#else + #include +#endif +#include +#else +#include +#include +#include +#include +#include +#endif + +#include +#include +#include + +#include "lfs.h" + +#define LFS_VERSION "1.6.3" +#define LFS_LIBNAME "lfs" + +#if LUA_VERSION_NUM >= 503 /* Lua 5.3 */ + +#ifndef luaL_optlong +#define luaL_optlong luaL_optinteger +#endif + +#endif + +#if LUA_VERSION_NUM < 502 +# define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) +#endif + +/* Define 'strerror' for systems that do not implement it */ +#ifdef NO_STRERROR +#define strerror(_) "System unable to describe the error" +#endif + +/* Define 'getcwd' for systems that do not implement it */ +#ifdef NO_GETCWD +#define getcwd(p,s) NULL +#define getcwd_error "Function 'getcwd' not provided by system" +#else +#define getcwd_error strerror(errno) + #ifdef _WIN32 + /* MAX_PATH seems to be 260. Seems kind of small. Is there a better one? */ + #define LFS_MAXPATHLEN MAX_PATH + #else + /* For MAXPATHLEN: */ + #include + #define LFS_MAXPATHLEN MAXPATHLEN + #endif +#endif + +#define DIR_METATABLE "directory metatable" +typedef struct dir_data { + int closed; +#ifdef _WIN32 + intptr_t hFile; + char pattern[MAX_PATH+1]; +#else + DIR *dir; +#endif +} dir_data; + +#define LOCK_METATABLE "lock metatable" + +#ifdef _WIN32 + #ifdef __BORLANDC__ + #define lfs_setmode(L,file,m) ((void)L, setmode(_fileno(file), m)) + #define STAT_STRUCT struct stati64 + #else + #define lfs_setmode(L,file,m) ((void)L, _setmode(_fileno(file), m)) + #define STAT_STRUCT struct _stati64 + #endif +#define STAT_FUNC _stati64 +#define LSTAT_FUNC STAT_FUNC +#else +#define _O_TEXT 0 +#define _O_BINARY 0 +#define lfs_setmode(L,file,m) ((void)L, (void)file, (void)m, 0) +#define STAT_STRUCT struct stat +#define STAT_FUNC stat +#define LSTAT_FUNC lstat +#endif + +/* +** Utility functions +*/ +static int pusherror(lua_State *L, const char *info) +{ + lua_pushnil(L); + if (info==NULL) + lua_pushstring(L, strerror(errno)); + else + lua_pushfstring(L, "%s: %s", info, strerror(errno)); + lua_pushinteger(L, errno); + return 3; +} + +#ifndef _WIN32 +static int pushresult(lua_State *L, int i, const char *info) +{ + if (i==-1) + return pusherror(L, info); + lua_pushinteger(L, i); + return 1; +} +#endif +/* +** This function changes the working (current) directory +*/ +static int change_dir (lua_State *L) { + const char *path = luaL_checkstring(L, 1); + if (chdir(path)) { + lua_pushnil (L); + lua_pushfstring (L,"Unable to change working directory to '%s'\n%s\n", + path, chdir_error); + return 2; + } else { + lua_pushboolean (L, 1); + return 1; + } +} + +/* +** This function returns the current directory +** If unable to get the current directory, it returns nil +** and a string describing the error +*/ +static int get_dir (lua_State *L) { + char *path; + /* Passing (NULL, 0) is not guaranteed to work. Use a temp buffer and size instead. */ + char buf[LFS_MAXPATHLEN]; + if ((path = getcwd(buf, LFS_MAXPATHLEN)) == NULL) { + lua_pushnil(L); + lua_pushstring(L, getcwd_error); + return 2; + } + else { + lua_pushstring(L, path); + return 1; + } +} + +/* +** Check if the given element on the stack is a file and returns it. +*/ +static FILE *check_file (lua_State *L, int idx, const char *funcname) { +#if LUA_VERSION_NUM == 501 + FILE **fh = (FILE **)luaL_checkudata (L, idx, "FILE*"); + if (*fh == NULL) { + luaL_error (L, "%s: closed file", funcname); + return 0; + } else + return *fh; +#elif LUA_VERSION_NUM >= 502 && LUA_VERSION_NUM <= 503 + luaL_Stream *fh = (luaL_Stream *)luaL_checkudata (L, idx, "FILE*"); + if (fh->closef == 0 || fh->f == NULL) { + luaL_error (L, "%s: closed file", funcname); + return 0; + } else + return fh->f; +#else +#error unsupported Lua version +#endif +} + + +/* +** +*/ +static int _file_lock (lua_State *L, FILE *fh, const char *mode, const long start, long len, const char *funcname) { + int code; +#ifdef _WIN32 + /* lkmode valid values are: + LK_LOCK Locks the specified bytes. If the bytes cannot be locked, the program immediately tries again after 1 second. If, after 10 attempts, the bytes cannot be locked, the constant returns an error. + LK_NBLCK Locks the specified bytes. If the bytes cannot be locked, the constant returns an error. + LK_NBRLCK Same as _LK_NBLCK. + LK_RLCK Same as _LK_LOCK. + LK_UNLCK Unlocks the specified bytes, which must have been previously locked. + + Regions should be locked only briefly and should be unlocked before closing a file or exiting the program. + + http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__locking.asp + */ + int lkmode; + switch (*mode) { + case 'r': lkmode = LK_NBLCK; break; + case 'w': lkmode = LK_NBLCK; break; + case 'u': lkmode = LK_UNLCK; break; + default : return luaL_error (L, "%s: invalid mode", funcname); + } + if (!len) { + fseek (fh, 0L, SEEK_END); + len = ftell (fh); + } + fseek (fh, start, SEEK_SET); +#ifdef __BORLANDC__ + code = locking (fileno(fh), lkmode, len); +#else + code = _locking (fileno(fh), lkmode, len); +#endif +#else + struct flock f; + switch (*mode) { + case 'w': f.l_type = F_WRLCK; break; + case 'r': f.l_type = F_RDLCK; break; + case 'u': f.l_type = F_UNLCK; break; + default : return luaL_error (L, "%s: invalid mode", funcname); + } + f.l_whence = SEEK_SET; + f.l_start = (off_t)start; + f.l_len = (off_t)len; + code = fcntl (fileno(fh), F_SETLK, &f); +#endif + return (code != -1); +} + +#ifdef _WIN32 +typedef struct lfs_Lock { + HANDLE fd; +} lfs_Lock; +static int lfs_lock_dir(lua_State *L) { + size_t pathl; HANDLE fd; + lfs_Lock *lock; + char *ln; + const char *lockfile = "/lockfile.lfs"; + const char *path = luaL_checklstring(L, 1, &pathl); + ln = (char*)malloc(pathl + strlen(lockfile) + 1); + if(!ln) { + lua_pushnil(L); lua_pushstring(L, strerror(errno)); return 2; + } + strcpy(ln, path); strcat(ln, lockfile); + if((fd = CreateFile(ln, GENERIC_WRITE, 0, NULL, CREATE_NEW, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL)) == INVALID_HANDLE_VALUE) { + int en = GetLastError(); + free(ln); lua_pushnil(L); + if(en == ERROR_FILE_EXISTS || en == ERROR_SHARING_VIOLATION) + lua_pushstring(L, "File exists"); + else + lua_pushstring(L, strerror(en)); + return 2; + } + free(ln); + lock = (lfs_Lock*)lua_newuserdata(L, sizeof(lfs_Lock)); + lock->fd = fd; + luaL_getmetatable (L, LOCK_METATABLE); + lua_setmetatable (L, -2); + return 1; +} +static int lfs_unlock_dir(lua_State *L) { + lfs_Lock *lock = (lfs_Lock *)luaL_checkudata(L, 1, LOCK_METATABLE); + if(lock->fd != INVALID_HANDLE_VALUE) { + CloseHandle(lock->fd); + lock->fd=INVALID_HANDLE_VALUE; + } + return 0; +} +#else +typedef struct lfs_Lock { + char *ln; +} lfs_Lock; +static int lfs_lock_dir(lua_State *L) { + lfs_Lock *lock; + size_t pathl; + char *ln; + const char *lockfile = "/lockfile.lfs"; + const char *path = luaL_checklstring(L, 1, &pathl); + lock = (lfs_Lock*)lua_newuserdata(L, sizeof(lfs_Lock)); + ln = (char*)malloc(pathl + strlen(lockfile) + 1); + if(!ln) { + lua_pushnil(L); lua_pushstring(L, strerror(errno)); return 2; + } + strcpy(ln, path); strcat(ln, lockfile); + if(symlink("lock", ln) == -1) { + free(ln); lua_pushnil(L); + lua_pushstring(L, strerror(errno)); return 2; + } + lock->ln = ln; + luaL_getmetatable (L, LOCK_METATABLE); + lua_setmetatable (L, -2); + return 1; +} +static int lfs_unlock_dir(lua_State *L) { + lfs_Lock *lock = (lfs_Lock *)luaL_checkudata(L, 1, LOCK_METATABLE); + if(lock->ln) { + unlink(lock->ln); + free(lock->ln); + lock->ln = NULL; + } + return 0; +} +#endif + +static int lfs_g_setmode (lua_State *L, FILE *f, int arg) { + static const int mode[] = {_O_BINARY, _O_TEXT}; + static const char *const modenames[] = {"binary", "text", NULL}; + int op = luaL_checkoption(L, arg, NULL, modenames); + int res = lfs_setmode(L, f, mode[op]); + if (res != -1) { + int i; + lua_pushboolean(L, 1); + for (i = 0; modenames[i] != NULL; i++) { + if (mode[i] == res) { + lua_pushstring(L, modenames[i]); + goto exit; + } + } + lua_pushnil(L); + exit: + return 2; + } else { + int en = errno; + lua_pushnil(L); + lua_pushfstring(L, "%s", strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + +static int lfs_f_setmode(lua_State *L) { + return lfs_g_setmode(L, check_file(L, 1, "setmode"), 2); +} + +/* +** Locks a file. +** @param #1 File handle. +** @param #2 String with lock mode ('w'rite, 'r'ead). +** @param #3 Number with start position (optional). +** @param #4 Number with length (optional). +*/ +static int file_lock (lua_State *L) { + FILE *fh = check_file (L, 1, "lock"); + const char *mode = luaL_checkstring (L, 2); + const long start = (long) luaL_optinteger (L, 3, 0); + long len = (long) luaL_optinteger (L, 4, 0); + if (_file_lock (L, fh, mode, start, len, "lock")) { + lua_pushboolean (L, 1); + return 1; + } else { + lua_pushnil (L); + lua_pushfstring (L, "%s", strerror(errno)); + return 2; + } +} + + +/* +** Unlocks a file. +** @param #1 File handle. +** @param #2 Number with start position (optional). +** @param #3 Number with length (optional). +*/ +static int file_unlock (lua_State *L) { + FILE *fh = check_file (L, 1, "unlock"); + const long start = (long) luaL_optinteger (L, 2, 0); + long len = (long) luaL_optinteger (L, 3, 0); + if (_file_lock (L, fh, "u", start, len, "unlock")) { + lua_pushboolean (L, 1); + return 1; + } else { + lua_pushnil (L); + lua_pushfstring (L, "%s", strerror(errno)); + return 2; + } +} + + +/* +** Creates a link. +** @param #1 Object to link to. +** @param #2 Name of link. +** @param #3 True if link is symbolic (optional). +*/ +static int make_link(lua_State *L) +{ +#ifndef _WIN32 + const char *oldpath = luaL_checkstring(L, 1); + const char *newpath = luaL_checkstring(L, 2); + return pushresult(L, + (lua_toboolean(L,3) ? symlink : link)(oldpath, newpath), NULL); +#else + return pusherror(L, "make_link is not supported on Windows"); +#endif +} + + +/* +** Creates a directory. +** @param #1 Directory path. +*/ +static int make_dir (lua_State *L) { + const char *path = luaL_checkstring (L, 1); + int fail; +#ifdef _WIN32 + fail = _mkdir (path); +#else + fail = mkdir (path, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | + S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH ); +#endif + if (fail) { + lua_pushnil (L); + lua_pushfstring (L, "%s", strerror(errno)); + return 2; + } + lua_pushboolean (L, 1); + return 1; +} + + +/* +** Removes a directory. +** @param #1 Directory path. +*/ +static int remove_dir (lua_State *L) { + const char *path = luaL_checkstring (L, 1); + int fail; + + fail = rmdir (path); + + if (fail) { + lua_pushnil (L); + lua_pushfstring (L, "%s", strerror(errno)); + return 2; + } + lua_pushboolean (L, 1); + return 1; +} + + +/* +** Directory iterator +*/ +static int dir_iter (lua_State *L) { +#ifdef _WIN32 + struct _finddata_t c_file; +#else + struct dirent *entry; +#endif + dir_data *d = (dir_data *)luaL_checkudata (L, 1, DIR_METATABLE); + luaL_argcheck (L, d->closed == 0, 1, "closed directory"); +#ifdef _WIN32 + if (d->hFile == 0L) { /* first entry */ + if ((d->hFile = _findfirst (d->pattern, &c_file)) == -1L) { + lua_pushnil (L); + lua_pushstring (L, strerror (errno)); + d->closed = 1; + return 2; + } else { + lua_pushstring (L, c_file.name); + return 1; + } + } else { /* next entry */ + if (_findnext (d->hFile, &c_file) == -1L) { + /* no more entries => close directory */ + _findclose (d->hFile); + d->closed = 1; + return 0; + } else { + lua_pushstring (L, c_file.name); + return 1; + } + } +#else + if ((entry = readdir (d->dir)) != NULL) { + lua_pushstring (L, entry->d_name); + return 1; + } else { + /* no more entries => close directory */ + closedir (d->dir); + d->closed = 1; + return 0; + } +#endif +} + + +/* +** Closes directory iterators +*/ +static int dir_close (lua_State *L) { + dir_data *d = (dir_data *)lua_touserdata (L, 1); +#ifdef _WIN32 + if (!d->closed && d->hFile) { + _findclose (d->hFile); + } +#else + if (!d->closed && d->dir) { + closedir (d->dir); + } +#endif + d->closed = 1; + return 0; +} + + +/* +** Factory of directory iterators +*/ +static int dir_iter_factory (lua_State *L) { + const char *path = luaL_checkstring (L, 1); + dir_data *d; + lua_pushcfunction (L, dir_iter); + d = (dir_data *) lua_newuserdata (L, sizeof(dir_data)); + luaL_getmetatable (L, DIR_METATABLE); + lua_setmetatable (L, -2); + d->closed = 0; +#ifdef _WIN32 + d->hFile = 0L; + if (strlen(path) > MAX_PATH-2) + luaL_error (L, "path too long: %s", path); + else + sprintf (d->pattern, "%s/*", path); +#else + d->dir = opendir (path); + if (d->dir == NULL) + luaL_error (L, "cannot open %s: %s", path, strerror (errno)); +#endif + return 2; +} + + +/* +** Creates directory metatable. +*/ +static int dir_create_meta (lua_State *L) { + luaL_newmetatable (L, DIR_METATABLE); + + /* Method table */ + lua_newtable(L); + lua_pushcfunction (L, dir_iter); + lua_setfield(L, -2, "next"); + lua_pushcfunction (L, dir_close); + lua_setfield(L, -2, "close"); + + /* Metamethods */ + lua_setfield(L, -2, "__index"); + lua_pushcfunction (L, dir_close); + lua_setfield (L, -2, "__gc"); + return 1; +} + + +/* +** Creates lock metatable. +*/ +static int lock_create_meta (lua_State *L) { + luaL_newmetatable (L, LOCK_METATABLE); + + /* Method table */ + lua_newtable(L); + lua_pushcfunction(L, lfs_unlock_dir); + lua_setfield(L, -2, "free"); + + /* Metamethods */ + lua_setfield(L, -2, "__index"); + lua_pushcfunction(L, lfs_unlock_dir); + lua_setfield(L, -2, "__gc"); + return 1; +} + + +#ifdef _WIN32 + #ifndef S_ISDIR + #define S_ISDIR(mode) (mode&_S_IFDIR) + #endif + #ifndef S_ISREG + #define S_ISREG(mode) (mode&_S_IFREG) + #endif + #ifndef S_ISLNK + #define S_ISLNK(mode) (0) + #endif + #ifndef S_ISSOCK + #define S_ISSOCK(mode) (0) + #endif + #ifndef S_ISFIFO + #define S_ISFIFO(mode) (0) + #endif + #ifndef S_ISCHR + #define S_ISCHR(mode) (mode&_S_IFCHR) + #endif + #ifndef S_ISBLK + #define S_ISBLK(mode) (0) + #endif +#endif +/* +** Convert the inode protection mode to a string. +*/ +#ifdef _WIN32 +static const char *mode2string (unsigned short mode) { +#else +static const char *mode2string (mode_t mode) { +#endif + if ( S_ISREG(mode) ) + return "file"; + else if ( S_ISDIR(mode) ) + return "directory"; + else if ( S_ISLNK(mode) ) + return "link"; + else if ( S_ISSOCK(mode) ) + return "socket"; + else if ( S_ISFIFO(mode) ) + return "named pipe"; + else if ( S_ISCHR(mode) ) + return "char device"; + else if ( S_ISBLK(mode) ) + return "block device"; + else + return "other"; +} + + +/* +** Set access time and modification values for file +*/ +static int file_utime (lua_State *L) { + const char *file = luaL_checkstring (L, 1); + struct utimbuf utb, *buf; + + if (lua_gettop (L) == 1) /* set to current date/time */ + buf = NULL; + else { + utb.actime = luaL_optnumber (L, 2, 0); + utb.modtime = (time_t) luaL_optinteger (L, 3, utb.actime); + buf = &utb; + } + if (utime (file, buf)) { + lua_pushnil (L); + lua_pushfstring (L, "%s", strerror (errno)); + return 2; + } + lua_pushboolean (L, 1); + return 1; +} + + +/* inode protection mode */ +static void push_st_mode (lua_State *L, STAT_STRUCT *info) { + lua_pushstring (L, mode2string (info->st_mode)); +} +/* device inode resides on */ +static void push_st_dev (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer) info->st_dev); +} +/* inode's number */ +static void push_st_ino (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer) info->st_ino); +} +/* number of hard links to the file */ +static void push_st_nlink (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer)info->st_nlink); +} +/* user-id of owner */ +static void push_st_uid (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer)info->st_uid); +} +/* group-id of owner */ +static void push_st_gid (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer)info->st_gid); +} +/* device type, for special file inode */ +static void push_st_rdev (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer) info->st_rdev); +} +/* time of last access */ +static void push_st_atime (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer) info->st_atime); +} +/* time of last data modification */ +static void push_st_mtime (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer) info->st_mtime); +} +/* time of last file status change */ +static void push_st_ctime (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer) info->st_ctime); +} +/* file size, in bytes */ +static void push_st_size (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer)info->st_size); +} +#ifndef _WIN32 +/* blocks allocated for file */ +static void push_st_blocks (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer)info->st_blocks); +} +/* optimal file system I/O blocksize */ +static void push_st_blksize (lua_State *L, STAT_STRUCT *info) { + lua_pushinteger (L, (lua_Integer)info->st_blksize); +} +#endif + + /* +** Convert the inode protection mode to a permission list. +*/ + +#ifdef _WIN32 +static const char *perm2string (unsigned short mode) { + static char perms[10] = "---------"; + int i; + for (i=0;i<9;i++) perms[i]='-'; + if (mode & _S_IREAD) + { perms[0] = 'r'; perms[3] = 'r'; perms[6] = 'r'; } + if (mode & _S_IWRITE) + { perms[1] = 'w'; perms[4] = 'w'; perms[7] = 'w'; } + if (mode & _S_IEXEC) + { perms[2] = 'x'; perms[5] = 'x'; perms[8] = 'x'; } + return perms; +} +#else +static const char *perm2string (mode_t mode) { + static char perms[10] = "---------"; + int i; + for (i=0;i<9;i++) perms[i]='-'; + if (mode & S_IRUSR) perms[0] = 'r'; + if (mode & S_IWUSR) perms[1] = 'w'; + if (mode & S_IXUSR) perms[2] = 'x'; + if (mode & S_IRGRP) perms[3] = 'r'; + if (mode & S_IWGRP) perms[4] = 'w'; + if (mode & S_IXGRP) perms[5] = 'x'; + if (mode & S_IROTH) perms[6] = 'r'; + if (mode & S_IWOTH) perms[7] = 'w'; + if (mode & S_IXOTH) perms[8] = 'x'; + return perms; +} +#endif + +/* permssions string */ +static void push_st_perm (lua_State *L, STAT_STRUCT *info) { + lua_pushstring (L, perm2string (info->st_mode)); +} + +typedef void (*_push_function) (lua_State *L, STAT_STRUCT *info); + +struct _stat_members { + const char *name; + _push_function push; +}; + +struct _stat_members members[] = { + { "mode", push_st_mode }, + { "dev", push_st_dev }, + { "ino", push_st_ino }, + { "nlink", push_st_nlink }, + { "uid", push_st_uid }, + { "gid", push_st_gid }, + { "rdev", push_st_rdev }, + { "access", push_st_atime }, + { "modification", push_st_mtime }, + { "change", push_st_ctime }, + { "size", push_st_size }, + { "permissions", push_st_perm }, +#ifndef _WIN32 + { "blocks", push_st_blocks }, + { "blksize", push_st_blksize }, +#endif + { NULL, NULL } +}; + +/* +** Get file or symbolic link information +*/ +static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) { + STAT_STRUCT info; + const char *file = luaL_checkstring (L, 1); + int i; + + if (st(file, &info)) { + lua_pushnil (L); + lua_pushfstring (L, "cannot obtain information from file `%s'", file); + return 2; + } + if (lua_isstring (L, 2)) { + const char *member = lua_tostring (L, 2); + for (i = 0; members[i].name; i++) { + if (strcmp(members[i].name, member) == 0) { + /* push member value and return */ + members[i].push (L, &info); + return 1; + } + } + /* member not found */ + return luaL_error(L, "invalid attribute name"); + } + /* creates a table if none is given */ + if (!lua_istable (L, 2)) { + lua_newtable (L); + } + /* stores all members in table on top of the stack */ + for (i = 0; members[i].name; i++) { + lua_pushstring (L, members[i].name); + members[i].push (L, &info); + lua_rawset (L, -3); + } + return 1; +} + + +/* +** Get file information using stat. +*/ +static int file_info (lua_State *L) { + return _file_info_ (L, STAT_FUNC); +} + + +/* +** Get symbolic link information using lstat. +*/ +static int link_info (lua_State *L) { + return _file_info_ (L, LSTAT_FUNC); +} + + +/* +** Assumes the table is on top of the stack. +*/ +static void set_info (lua_State *L) { + lua_pushliteral (L, "_COPYRIGHT"); + lua_pushliteral (L, "Copyright (C) 2003-2012 Kepler Project"); + lua_settable (L, -3); + lua_pushliteral (L, "_DESCRIPTION"); + lua_pushliteral (L, "LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution"); + lua_settable (L, -3); + lua_pushliteral (L, "_VERSION"); + lua_pushliteral (L, "LuaFileSystem "LFS_VERSION); + lua_settable (L, -3); +} + + +static const struct luaL_Reg fslib[] = { + {"attributes", file_info}, + {"chdir", change_dir}, + {"currentdir", get_dir}, + {"dir", dir_iter_factory}, + {"link", make_link}, + {"lock", file_lock}, + {"mkdir", make_dir}, + {"rmdir", remove_dir}, + {"symlinkattributes", link_info}, + {"setmode", lfs_f_setmode}, + {"touch", file_utime}, + {"unlock", file_unlock}, + {"lock_dir", lfs_lock_dir}, + {NULL, NULL}, +}; + +int luaopen_lfs (lua_State *L) { + dir_create_meta (L); + lock_create_meta (L); + luaL_newlib (L, fslib); + lua_pushvalue(L, -1); + lua_setglobal(L, LFS_LIBNAME); + set_info (L); + return 1; +} diff --git a/3rdparty/luafilesystem/src/lfs.def b/3rdparty/luafilesystem/src/lfs.def new file mode 100644 index 00000000000..6c782eb6968 --- /dev/null +++ b/3rdparty/luafilesystem/src/lfs.def @@ -0,0 +1,4 @@ +LIBRARY lfs.dll +VERSION 1.6 +EXPORTS +luaopen_lfs diff --git a/3rdparty/luafilesystem/src/lfs.h b/3rdparty/luafilesystem/src/lfs.h new file mode 100644 index 00000000000..ea1720dba75 --- /dev/null +++ b/3rdparty/luafilesystem/src/lfs.h @@ -0,0 +1,34 @@ +/* +** LuaFileSystem +** Copyright Kepler Project 2003 (http://www.keplerproject.org/luafilesystem) +** +** $Id: lfs.h,v 1.5 2008/02/19 20:08:23 mascarenhas Exp $ +*/ + +/* Define 'chdir' for systems that do not implement it */ +#ifdef NO_CHDIR +#define chdir(p) (-1) +#define chdir_error "Function 'chdir' not provided by system" +#else +#define chdir_error strerror(errno) + +#endif + +#ifdef _WIN32 +#define chdir(p) (_chdir(p)) +#define getcwd(d, s) (_getcwd(d, s)) +#define rmdir(p) (_rmdir(p)) +#ifndef fileno +#define fileno(f) (_fileno(f)) +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +int luaopen_lfs (lua_State *L); + +#ifdef __cplusplus +} +#endif diff --git a/3rdparty/luafilesystem/tests/test.lua b/3rdparty/luafilesystem/tests/test.lua new file mode 100644 index 00000000000..abfbd4d9690 --- /dev/null +++ b/3rdparty/luafilesystem/tests/test.lua @@ -0,0 +1,175 @@ +#!/usr/bin/env lua5.1 + +local tmp = "/tmp" +local sep = string.match (package.config, "[^\n]+") +local upper = ".." + +local lfs = require"lfs" +print (lfs._VERSION) + +io.write(".") +io.flush() + +function attrdir (path) + for file in lfs.dir(path) do + if file ~= "." and file ~= ".." then + local f = path..sep..file + print ("\t=> "..f.." <=") + local attr = lfs.attributes (f) + assert (type(attr) == "table") + if attr.mode == "directory" then + attrdir (f) + else + for name, value in pairs(attr) do + print (name, value) + end + end + end + end +end + +-- Checking changing directories +local current = assert (lfs.currentdir()) +local reldir = string.gsub (current, "^.*%"..sep.."([^"..sep.."])$", "%1") +assert (lfs.chdir (upper), "could not change to upper directory") +assert (lfs.chdir (reldir), "could not change back to current directory") +assert (lfs.currentdir() == current, "error trying to change directories") +assert (lfs.chdir ("this couldn't be an actual directory") == nil, "could change to a non-existent directory") + +io.write(".") +io.flush() + +-- Changing creating and removing directories +local tmpdir = current..sep.."lfs_tmp_dir" +local tmpfile = tmpdir..sep.."tmp_file" +-- Test for existence of a previous lfs_tmp_dir +-- that may have resulted from an interrupted test execution and remove it +if lfs.chdir (tmpdir) then + assert (lfs.chdir (upper), "could not change to upper directory") + assert (os.remove (tmpfile), "could not remove file from previous test") + assert (lfs.rmdir (tmpdir), "could not remove directory from previous test") +end + +io.write(".") +io.flush() + +-- tries to create a directory +assert (lfs.mkdir (tmpdir), "could not make a new directory") +local attrib, errmsg = lfs.attributes (tmpdir) +if not attrib then + error ("could not get attributes of file `"..tmpdir.."':\n"..errmsg) +end +local f = io.open(tmpfile, "w") +f:close() + +io.write(".") +io.flush() + +-- Change access time +local testdate = os.time({ year = 2007, day = 10, month = 2, hour=0}) +assert (lfs.touch (tmpfile, testdate)) +local new_att = assert (lfs.attributes (tmpfile)) +assert (new_att.access == testdate, "could not set access time") +assert (new_att.modification == testdate, "could not set modification time") + +io.write(".") +io.flush() + +-- Change access and modification time +local testdate1 = os.time({ year = 2007, day = 10, month = 2, hour=0}) +local testdate2 = os.time({ year = 2007, day = 11, month = 2, hour=0}) + +assert (lfs.touch (tmpfile, testdate2, testdate1)) +local new_att = assert (lfs.attributes (tmpfile)) +assert (new_att.access == testdate2, "could not set access time") +assert (new_att.modification == testdate1, "could not set modification time") + +io.write(".") +io.flush() + +-- Checking link (does not work on Windows) +if lfs.link (tmpfile, "_a_link_for_test_", true) then + assert (lfs.attributes"_a_link_for_test_".mode == "file") + assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link") + assert (lfs.link (tmpfile, "_a_hard_link_for_test_")) + assert (lfs.attributes (tmpfile, "nlink") == 2) + assert (os.remove"_a_link_for_test_") + assert (os.remove"_a_hard_link_for_test_") +end + +io.write(".") +io.flush() + +-- Checking text/binary modes (only has an effect in Windows) +local f = io.open(tmpfile, "w") +local result, mode = lfs.setmode(f, "binary") +assert(result) -- on non-Windows platforms, mode is always returned as "binary" +result, mode = lfs.setmode(f, "text") +assert(result and mode == "binary") +f:close() + +io.write(".") +io.flush() + +-- Restore access time to current value +assert (lfs.touch (tmpfile, attrib.access, attrib.modification)) +new_att = assert (lfs.attributes (tmpfile)) +assert (new_att.access == attrib.access) +assert (new_att.modification == attrib.modification) + +io.write(".") +io.flush() + +-- Check consistency of lfs.attributes values +local attr = lfs.attributes (tmpfile) +for key, value in pairs(attr) do + assert (value == lfs.attributes (tmpfile, key), + "lfs.attributes values not consistent") +end + +-- Remove new file and directory +assert (os.remove (tmpfile), "could not remove new file") +assert (lfs.rmdir (tmpdir), "could not remove new directory") +assert (lfs.mkdir (tmpdir..sep.."lfs_tmp_dir") == nil, "could create a directory inside a non-existent one") + +io.write(".") +io.flush() + +-- Trying to get attributes of a non-existent file +assert (lfs.attributes ("this couldn't be an actual file") == nil, "could get attributes of a non-existent file") +assert (type(lfs.attributes (upper)) == "table", "couldn't get attributes of upper directory") + +io.write(".") +io.flush() + +-- Stressing directory iterator +count = 0 +for i = 1, 4000 do + for file in lfs.dir (tmp) do + count = count + 1 + end +end + +io.write(".") +io.flush() + +-- Stressing directory iterator, explicit version +count = 0 +for i = 1, 4000 do + local iter, dir = lfs.dir(tmp) + local file = dir:next() + while file do + count = count + 1 + file = dir:next() + end + assert(not pcall(dir.next, dir)) +end + +io.write(".") +io.flush() + +-- directory explicit close +local iter, dir = lfs.dir(tmp) +dir:close() +assert(not pcall(dir.next, dir)) +print"Ok!" diff --git a/3rdparty/luafilesystem/vc6/lfs.def b/3rdparty/luafilesystem/vc6/lfs.def new file mode 100644 index 00000000000..55ec688d3c3 --- /dev/null +++ b/3rdparty/luafilesystem/vc6/lfs.def @@ -0,0 +1,5 @@ +LIBRARY lfs.dll +DESCRIPTION "LuaFileSystem" +VERSION 1.2 +EXPORTS +luaopen_lfs diff --git a/3rdparty/luafilesystem/vc6/luafilesystem.dsw b/3rdparty/luafilesystem/vc6/luafilesystem.dsw new file mode 100644 index 00000000000..b4bb4b310f6 --- /dev/null +++ b/3rdparty/luafilesystem/vc6/luafilesystem.dsw @@ -0,0 +1,33 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "luafilesystem_dll"=.\luafilesystem_dll.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + luafilesystem + .. + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/3rdparty/luafilesystem/vc6/luafilesystem_dll.dsp b/3rdparty/luafilesystem/vc6/luafilesystem_dll.dsp new file mode 100644 index 00000000000..efe6c720b6c --- /dev/null +++ b/3rdparty/luafilesystem/vc6/luafilesystem_dll.dsp @@ -0,0 +1,127 @@ +# Microsoft Developer Studio Project File - Name="luafilesystem_dll" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=luafilesystem_dll - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "luafilesystem_dll.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "luafilesystem_dll.mak" CFG="luafilesystem_dll - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "luafilesystem_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "luafilesystem_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "luafilesystem_dll" +# PROP Scc_LocalPath ".." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "luafilesystem_dll - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../lib/vc6" +# PROP Intermediate_Dir "luafilesystem_dll/Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../external-src/lua50/include" /I "../../compat/src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x416 /d "NDEBUG" +# ADD RSC /l 0x416 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 lua50.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../bin/vc6/lfs.dll" /libpath:"../../external-src/lua50/lib/dll" +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Cmds=cd ../bin/vc6 zip.exe luafilesystem-1.2-win32.zip lfs.dll +# End Special Build Tool + +!ELSEIF "$(CFG)" == "luafilesystem_dll - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../lib/vc6" +# PROP Intermediate_Dir "luafilesystem_dll/Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../external-src/lua50/include" /I "../../compat/src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x416 /d "_DEBUG" +# ADD RSC /l 0x416 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 lua50.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../bin/vc6/lfsd.dll" /pdbtype:sept /libpath:"../../external-src/lua50/lib/dll" + +!ENDIF + +# Begin Target + +# Name "luafilesystem_dll - Win32 Release" +# Name "luafilesystem_dll - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE="..\..\compat\src\compat-5.1.c" +# End Source File +# Begin Source File + +SOURCE=..\src\lfs.c +# End Source File +# Begin Source File + +SOURCE=.\lfs.def +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE="..\..\compat\src\compat-5.1.h" +# End Source File +# Begin Source File + +SOURCE=..\src\lfs.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/3rdparty/luv/.ci/install.bat b/3rdparty/luv/.ci/install.bat new file mode 100644 index 00000000000..1ee346dccc9 --- /dev/null +++ b/3rdparty/luv/.ci/install.bat @@ -0,0 +1,270 @@ +@echo off + +cd %APPVEYOR_BUILD_FOLDER% + +:: ========================================================= +:: Set some defaults. Infer some variables. +:: +:: These are set globally +if "%LUA_VER%" NEQ "" ( + set LUA=lua + set LUA_SHORTV=%LUA_VER:~0,3% +) else ( + set LUA=luajit + set LJ_SHORTV=%LJ_VER:~0,3% + set LUA_SHORTV=5.1 +) + +:: defines LUA_DIR so Cmake can find this Lua install +if "%LUA%"=="luajit" ( + set LUA_DIR=c:\lua\%platform%\lj%LJ_SHORTV% +) else ( + set LUA_DIR=c:\lua\%platform%\%LUA_VER% +) + +:: Now we declare a scope +Setlocal EnableDelayedExpansion EnableExtensions + +if not defined LUAROCKS_URL set LUAROCKS_URL=http://keplerproject.github.io/luarocks/releases +if not defined LUAROCKS_REPO set LUAROCKS_REPO=https://luarocks.org +if not defined LUA_URL set LUA_URL=http://www.lua.org/ftp +if defined NOCOMPAT ( + set COMPATFLAG=--nocompat +) else ( + set COMPATFLAG= +) +if not defined LUAJIT_GIT_REPO set LUAJIT_GIT_REPO=https://github.com/LuaJIT/LuaJIT.git +if not defined LUAJIT_URL set LUAJIT_URL=https://github.com/LuaJIT/LuaJIT/archive + +if not defined LR_EXTERNAL set LR_EXTERNAL=c:\external +if not defined LUAROCKS_INSTALL set LUAROCKS_INSTALL=%LUA_DIR%\LuaRocks + + +:: LuaRocks <= 2.2.2 used a versioned directory +:: HEAD and newer versions do not, so act accordingly. +if defined LR_ROOT goto :skiplrver + +if "%LUAROCKS_VER%" EQU "HEAD" ( + set LR_ROOT=%LUAROCKS_INSTALL% + goto :skiplrver +) +set LR_ROOT=%LUAROCKS_INSTALL% +if %LUAROCKS_VER:~0,1% LEQ 2 ( + if %LUAROCKS_VER:~2,1% LEQ 2 ( + if %LUAROCKS_VER:~4,1% LEQ 3 ( + set LR_ROOT=%LUAROCKS_INSTALL%\!LUAROCKS_VER:~0,3! + ) + ) +) +:skiplrver + +if not defined LR_SYSTREE set LR_SYSTREE=%LUAROCKS_INSTALL%\systree + +if not defined SEVENZIP set SEVENZIP=7z +:: +:: ========================================================= + +:: first create some necessary directories: +mkdir downloads 2>NUL + +:: Download and compile Lua (or LuaJIT) +if "%LUA%"=="luajit" ( + if not exist %LUA_DIR% ( + if "%LJ_SHORTV%"=="2.1" ( + :: Clone repository and checkout 2.1 branch + set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER% + if not exist !lj_source_folder! ( + echo Cloning git repo %LUAJIT_GIT_REPO% !lj_source_folder! + git clone %LUAJIT_GIT_REPO% !lj_source_folder! || call :die "Failed to clone repository" + ) else ( + cd !lj_source_folder! + git pull || call :die "Failed to update repository" + ) + cd !lj_source_folder!\src + git checkout v2.1 || call :die + ) else ( + set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER% + if not exist !lj_source_folder! ( + echo Downloading... %LUAJIT_URL%/v%LJ_VER%.tar.gz + curl --location --silent --fail --max-time 120 --connect-timeout 30 %LUAJIT_URL%/v%LJ_VER%.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% x -si -ttar -aoa -odownloads + ) + cd !lj_source_folder!\src + ) + :: Compiles LuaJIT + if "%Configuration%"=="MinGW" ( + call mingw32-make + ) else ( + call msvcbuild.bat + ) + + mkdir %LUA_DIR% 2> NUL + for %%a in (bin bin\lua bin\lua\jit include lib) do ( mkdir "%LUA_DIR%\%%a" ) + + for %%a in (luajit.exe lua51.dll) do ( move "!lj_source_folder!\src\%%a" "%LUA_DIR%\bin" ) + copy "%LUA_DIR%\bin\luajit.exe" "%LUA_DIR%\bin\lua.exe" + + move "!lj_source_folder!\src\lua51.lib" "%LUA_DIR%\lib" + for %%a in (lauxlib.h lua.h lua.hpp luaconf.h lualib.h luajit.h) do ( + copy "!lj_source_folder!\src\%%a" "%LUA_DIR%\include" + ) + + copy "!lj_source_folder!\src\jit\*.lua" "%LUA_DIR%\bin\lua\jit" + + ) else ( + echo LuaJIT %LJ_VER% already installed at %LUA_DIR% + ) +) else ( + if not exist %LUA_DIR% ( + :: Download and compile Lua + if not exist downloads\lua-%LUA_VER% ( + curl --silent --fail --max-time 120 --connect-timeout 30 %LUA_URL%/lua-%LUA_VER%.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% x -si -ttar -aoa -odownloads + ) + + mkdir downloads\lua-%LUA_VER%\etc 2> NUL + copy %~dp0\winmake.bat downloads\lua-%LUA_VER%\etc\winmake.bat + + cd downloads\lua-%LUA_VER% + call etc\winmake %COMPATFLAG% + call etc\winmake install %LUA_DIR% + ) else ( + echo Lua %LUA_VER% already installed at %LUA_DIR% + ) +) + +if not exist %LUA_DIR%\bin\%LUA%.exe call :die "Missing Lua interpreter at %LUA_DIR%\bin\%LUA%.exe" + +set PATH=%LUA_DIR%\bin;%PATH% +call !LUA! -v + + + +:: ========================================================== +:: LuaRocks +:: ========================================================== + +if not exist "%LR_ROOT%" ( + :: Downloads and installs LuaRocks + cd %APPVEYOR_BUILD_FOLDER% + + if %LUAROCKS_VER%==HEAD ( + set lr_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luarocks-%LUAROCKS_VER%-win32 + if not exist !lr_source_folder! ( + git clone https://github.com/keplerproject/luarocks.git --single-branch --depth 1 !lr_source_folder! || call :die "Failed to clone LuaRocks repository" + ) else ( + cd !lr_source_folder! + git pull || call :die "Failed to update LuaRocks repository" + ) + ) else ( + if not exist downloads\luarocks-%LUAROCKS_VER%-win32.zip ( + echo Downloading LuaRocks... + curl --silent --fail --max-time 120 --connect-timeout 30 --output downloads\luarocks-%LUAROCKS_VER%-win32.zip %LUAROCKS_URL%/luarocks-%LUAROCKS_VER%-win32.zip + %SEVENZIP% x -aoa -odownloads downloads\luarocks-%LUAROCKS_VER%-win32.zip + ) + ) + + cd downloads\luarocks-%LUAROCKS_VER%-win32 + if "%Configuration%"=="MinGW" ( + call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%" /MW + ) else ( + call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%" + ) + + :: Configures LuaRocks to instruct CMake the correct generator to use. Else, CMake will pick the highest + :: Visual Studio version installed + if "%Configuration%"=="MinGW" ( + echo cmake_generator = "MinGW Makefiles" >> %LUAROCKS_INSTALL%\config-%LUA_SHORTV%.lua + ) else ( + set MSVS_GENERATORS[2008]=Visual Studio 9 2008 + set MSVS_GENERATORS[2010]=Visual Studio 10 2010 + set MSVS_GENERATORS[2012]=Visual Studio 11 2012 + set MSVS_GENERATORS[2013]=Visual Studio 12 2013 + set MSVS_GENERATORS[2015]=Visual Studio 14 2015 + + set CMAKE_GENERATOR=!MSVS_GENERATORS[%Configuration%]! + if "%platform%" EQU "x64" (set CMAKE_GENERATOR=!CMAKE_GENERATOR! Win64) + + echo cmake_generator = "!CMAKE_GENERATOR!" >> %LUAROCKS_INSTALL%\config-%LUA_SHORTV%.lua + ) +) + +if not exist "%LR_ROOT%" call :die "LuaRocks not found at %LR_ROOT%" + +set PATH=%LR_ROOT%;%LR_SYSTREE%\bin;%PATH% + +:: Lua will use just the system rocks +set LUA_PATH=%LR_ROOT%\lua\?.lua;%LR_ROOT%\lua\?\init.lua +set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?.lua +set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?\init.lua +set LUA_PATH=%LUA_PATH%;.\?.lua;.\?\init.lua +set LUA_CPATH=%LR_SYSTREE%\lib\lua\%LUA_SHORTV%\?.dll;.\?.dll + +call luarocks --version || call :die "Error with LuaRocks installation" +call luarocks list + + +if not exist "%LR_EXTERNAL%" ( + mkdir "%LR_EXTERNAL%" + mkdir "%LR_EXTERNAL%\lib" + mkdir "%LR_EXTERNAL%\include" +) + +set PATH=%LR_EXTERNAL%;%PATH% + +:: Exports the following variables: +:: (beware of whitespace between & and ^ below) +endlocal & set PATH=%PATH%&^ +set LR_SYSTREE=%LR_SYSTREE%&^ +set LUA_PATH=%LUA_PATH%&^ +set LUA_CPATH=%LUA_CPATH%&^ +set LR_EXTERNAL=%LR_EXTERNAL% + +echo. +echo ====================================================== +if "%LUA%"=="luajit" ( + echo Installation of LuaJIT %LJ_VER% and LuaRocks %LUAROCKS_VER% done. +) else ( + echo Installation of Lua %LUA_VER% and LuaRocks %LUAROCKS_VER% done. + if defined NOCOMPAT echo Lua was built with compatibility flags disabled. +) +echo Platform - %platform% +echo LUA - %LUA% +echo LUA_SHORTV - %LUA_SHORTV% +echo LJ_SHORTV - %LJ_SHORTV% +echo LUA_PATH - %LUA_PATH% +echo LUA_CPATH - %LUA_CPATH% +echo. +echo LR_EXTERNAL - %LR_EXTERNAL% +echo ====================================================== +echo. + +goto :eof + + + + + + + + + + + + + + + + + + +:: This blank space is intentional. If you see errors like "The system cannot find the batch label specified 'foo'" +:: then try adding or removing blank lines lines above. +:: Yes, really. +:: http://stackoverflow.com/questions/232651/why-the-system-cannot-find-the-batch-label-specified-is-thrown-even-if-label-e + +:: helper functions: + +:: for bailing out when an error occurred +:die %1 +echo %1 +exit /B 1 +goto :eof diff --git a/3rdparty/luv/.ci/platform.sh b/3rdparty/luv/.ci/platform.sh new file mode 100644 index 00000000000..7259a7d6369 --- /dev/null +++ b/3rdparty/luv/.ci/platform.sh @@ -0,0 +1,15 @@ +if [ -z "${PLATFORM:-}" ]; then + PLATFORM=$TRAVIS_OS_NAME; +fi + +if [ "$PLATFORM" == "osx" ]; then + PLATFORM="macosx"; +fi + +if [ -z "$PLATFORM" ]; then + if [ "$(uname)" == "Linux" ]; then + PLATFORM="linux"; + else + PLATFORM="macosx"; + fi; +fi diff --git a/3rdparty/luv/.ci/set_compiler_env.bat b/3rdparty/luv/.ci/set_compiler_env.bat new file mode 100644 index 00000000000..7e8462ec57e --- /dev/null +++ b/3rdparty/luv/.ci/set_compiler_env.bat @@ -0,0 +1,40 @@ +@echo off + +:: Now we declare a scope +Setlocal EnableDelayedExpansion EnableExtensions + +if not defined Configuration set Configuration=2015 + +if "%Configuration%"=="MinGW" ( goto :mingw ) + +set arch=x86 + +if "%platform%" EQU "x64" ( set arch=x86_amd64 ) + +if "%Configuration%"=="2015" ( + set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" +) + +if "%Configuration%"=="2013" ( + set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" +) + +if "%Configuration%"=="2012" ( + set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" +) + +if "%Configuration%"=="2010" ( + set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" +) + +if "%Configuration%"=="2008" ( + set SET_VS_ENV="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" +) + +:: Visual Studio detected +endlocal & call %SET_VS_ENV% %arch% +goto :eof + +:: MinGW detected +:mingw +endlocal & set PATH=c:\mingw\bin;%PATH% diff --git a/3rdparty/luv/.ci/setenv_lua.sh b/3rdparty/luv/.ci/setenv_lua.sh new file mode 100644 index 00000000000..55454389398 --- /dev/null +++ b/3rdparty/luv/.ci/setenv_lua.sh @@ -0,0 +1,3 @@ +export PATH=${PATH}:$HOME/.lua:$HOME/.local/bin:${TRAVIS_BUILD_DIR}/install/luarocks/bin +bash .ci/setup_lua.sh +eval `$HOME/.lua/luarocks path` diff --git a/3rdparty/luv/.ci/setup_lua.sh b/3rdparty/luv/.ci/setup_lua.sh new file mode 100644 index 00000000000..f8963331767 --- /dev/null +++ b/3rdparty/luv/.ci/setup_lua.sh @@ -0,0 +1,122 @@ +#! /bin/bash + +# A script for setting up environment for travis-ci testing. +# Sets up Lua and Luarocks. +# LUA must be "lua5.1", "lua5.2" or "luajit". +# luajit2.0 - master v2.0 +# luajit2.1 - master v2.1 + +set -eufo pipefail + +LUAJIT_VERSION="2.0.4" +LUAJIT_BASE="LuaJIT-$LUAJIT_VERSION" + +source .ci/platform.sh + +LUA_HOME_DIR=$TRAVIS_BUILD_DIR/install/lua + +LR_HOME_DIR=$TRAVIS_BUILD_DIR/install/luarocks + +mkdir $HOME/.lua + +LUAJIT="no" + +if [ "$PLATFORM" == "macosx" ]; then + if [ "$LUA" == "luajit" ]; then + LUAJIT="yes"; + fi + if [ "$LUA" == "luajit2.0" ]; then + LUAJIT="yes"; + fi + if [ "$LUA" == "luajit2.1" ]; then + LUAJIT="yes"; + fi; +elif [ "$(expr substr $LUA 1 6)" == "luajit" ]; then + LUAJIT="yes"; +fi + +mkdir -p "$LUA_HOME_DIR" + +if [ "$LUAJIT" == "yes" ]; then + + if [ "$LUA" == "luajit" ]; then + curl --location https://github.com/LuaJIT/LuaJIT/archive/v$LUAJIT_VERSION.tar.gz | tar xz; + else + git clone https://github.com/LuaJIT/LuaJIT.git $LUAJIT_BASE; + fi + + cd $LUAJIT_BASE + + if [ "$LUA" == "luajit2.1" ]; then + git checkout v2.1; + # force the INSTALL_TNAME to be luajit + perl -i -pe 's/INSTALL_TNAME=.+/INSTALL_TNAME= luajit/' Makefile + fi + + make && make install PREFIX="$LUA_HOME_DIR" + + ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/luajit + ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/lua; + +else + + if [ "$LUA" == "lua5.1" ]; then + curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz + cd lua-5.1.5; + elif [ "$LUA" == "lua5.2" ]; then + curl http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz + cd lua-5.2.4; + elif [ "$LUA" == "lua5.3" ]; then + curl http://www.lua.org/ftp/lua-5.3.2.tar.gz | tar xz + cd lua-5.3.2; + fi + + # Build Lua without backwards compatibility for testing + perl -i -pe 's/-DLUA_COMPAT_(ALL|5_2)//' src/Makefile + make $PLATFORM + make INSTALL_TOP="$LUA_HOME_DIR" install; + + ln -s $LUA_HOME_DIR/bin/lua $HOME/.lua/lua + ln -s $LUA_HOME_DIR/bin/luac $HOME/.lua/luac; + +fi + +cd $TRAVIS_BUILD_DIR + +lua -v + +LUAROCKS_BASE=luarocks-$LUAROCKS + +curl --location http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz + +cd $LUAROCKS_BASE + +if [ "$LUA" == "luajit" ]; then + ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR"; +elif [ "$LUA" == "luajit2.0" ]; then + ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR"; +elif [ "$LUA" == "luajit2.1" ]; then + ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.1" --prefix="$LR_HOME_DIR"; +else + ./configure --with-lua="$LUA_HOME_DIR" --prefix="$LR_HOME_DIR" +fi + +make build && make install + +ln -s $LR_HOME_DIR/bin/luarocks $HOME/.lua/luarocks + +cd $TRAVIS_BUILD_DIR + +luarocks --version + +rm -rf $LUAROCKS_BASE + +if [ "$LUAJIT" == "yes" ]; then + rm -rf $LUAJIT_BASE; +elif [ "$LUA" == "lua5.1" ]; then + rm -rf lua-5.1.5; +elif [ "$LUA" == "lua5.2" ]; then + rm -rf lua-5.2.4; +elif [ "$LUA" == "lua5.3" ]; then + rm -rf lua-5.3.2; +fi diff --git a/3rdparty/luv/.ci/winmake.bat b/3rdparty/luv/.ci/winmake.bat new file mode 100644 index 00000000000..dcad55d36f7 --- /dev/null +++ b/3rdparty/luv/.ci/winmake.bat @@ -0,0 +1,457 @@ +@ECHO OFF +SETLOCAL ENABLEDELAYEDEXPANSION + +REM ***************************** +REM * Customization section * +REM ***************************** + +REM use the /help option for generic usage information + +REM Where is the source code located (the unpacked Lua source archive, toplevel dir) +SET SOURCETREE=.\ + +REM set the toolchain to either MS or GCC (allcaps), leave blank to autodetect +SET TOOLCHAIN= + +REM set the compatibility flags, defaults to empty for 5.1, -DLUA_COMPAT_ALL for 5.2, +REM and -DLUA_COMPAT_5_2 for 5.3, which are the same as the unix make files +REM This setting can be overridden with the --nocompat flag +SET COMPATFLAG= + + + + + + + + + +REM ********************************** +REM * Nothing to customize below * +REM ********************************** + +SET BATCHNAME=%~n0 +SET SOURCE=%SOURCETREE%src\ +SET LUA_H=%SOURCE%lua.h +SET CURDIR=%CD% + +REM the following line ends with a TAB. DO NOT REMOVE IT! +SET TABCHAR= +REM Define LF to contain a linefeed character +set ^"LFCHAR=^ + +^" The above empty line is critical. DO NOT REMOVE + + +REM Supported toolchains (allcaps) +SET TOOLCHAINS=MS GCC +REM Commands which, if exiting without error, indicate presence of the toolchain +SET CHECK_GCC=gcc --version +SET CHECK_MS=cl + +REM ********************************** +REM * Check for help request * +REM ********************************** + +SET HELPCMDS=help -help --help /help ? -? /? +for %%L in ("!LFCHAR!") do for /f %%a in ("!HELPCMDS: =%%~L!") do ( + if "%%a"=="%~1" ( + echo. + echo Builds a standalone Lua installation. Supports Lua version 5.1, 5.2 and 5.3. + echo Your compiler must be in the system path, and this "%BATCHNAME%.bat" file must be located + echo in ".\etc\" in the unpacked Lua source archive. + echo. + echo USAGE etc\%BATCHNAME% [FLAG] [COMMAND] [...] + echo ^(execute from the root of the unpacked archive^) + echo. + echo Commands; + echo clean : cleans the source tree of build ^(intermediate^) files + echo install [path] : installs the build results into "path" + echo local : installs into ".\local\" in the unpacked Lua source structure + echo [toolchain] : uses a specific toolchain to build. If not provided then supported + echo toolchains will be tested and the first available will be picked. + echo Supported toolchains are: "%TOOLCHAINS%" ^(must use ALLCAPS^) + echo. + echo Flags; + echo --nocompat : Specifies that no compatibility flags should be set when building. + echo If not specified, the default compatibility flags will be used. + echo. + echo Example use; + echo set PATH=C:\path\to\your\compiler\;%%PATH%% + echo etc\%BATCHNAME% clean + echo etc\%BATCHNAME% + echo etc\%BATCHNAME% --nocompat GCC + echo etc\%BATCHNAME% install "C:\Program Files\Lua" + echo. + goto :EXITOK + ) +) + +REM ********************************** +REM * Check commandline * +REM ********************************** + +SET CMDOK=FALSE +if "%~1"=="" ( + SET CMDOK=TRUE +) +for %%a in (local install clean) do ( + if "%%a"=="%~1" ( + SET CMDOK=TRUE + ) +) +for %%a in (--nocompat) do ( + if "%%a"=="%~1" ( + SET NOCOMPAT=TRUE + if "%~2"=="" ( + SET CMDOK=TRUE + ) + SHIFT + ) +) +for %%a in (%TOOLCHAINS%) do ( + if "%%a"=="%~1" ( + SET CMDOK=TRUE + SET TOOLCHAIN=%~1 + ) +) +if NOT %CMDOK%==TRUE ( + echo. + echo Unknown command or toolchain specified. + goto :EXITERROR +) + +REM ************************************** +REM * Check for cleaning * +REM ************************************** + +if "%1"=="clean" ( + if NOT [%2]==[] ( + echo. + echo ERROR: The clean command does not take extra parameters. + ) else ( + echo Cleaning... + if exist "%SOURCE%*.exe" del "%SOURCE%*.exe" + if exist "%SOURCE%*.dll" del "%SOURCE%*.dll" + if exist "%SOURCE%*.o" del "%SOURCE%*.o" + if exist "%SOURCE%*.a" del "%SOURCE%*.a" + if exist "%SOURCE%*.obj" del "%SOURCE%*.obj" + if exist "%SOURCE%*.manifest" del "%SOURCE%*.manifest" + if exist "%SOURCE%*.lib" del "%SOURCE%*.lib" + echo Done. + ) + goto :EXITOK +) + +REM ************************************************** +REM * Fetch the Lua version from the source code * +REM ************************************************** + +Echo. +Echo Checking source code to extract Lua version... +IF NOT EXIST %LUA_H% ( + Echo Cannot locate Lua header file; %LUA_H% + goto :EXITERROR +) + +findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR" %LUA_H% > NUL +if NOT %ERRORLEVEL%==0 ( + rem ECHO We've got a Lua version 5.1 + rem findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION[ %TABCHAR%]" %LUA_H% + SET LUA_VER=5.1 +) else ( + rem ECHO We've got a Lua version 5.2+ + rem findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR[ %TABCHAR%]" %LUA_H% + rem findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MINOR[ %TABCHAR%]" %LUA_H% + + for /F "delims=" %%a in ('findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR[ %TABCHAR%]" %LUA_H%') do set LUA_MAJOR=%%a + SET LUA_MAJOR=!LUA_MAJOR:#define=! + SET LUA_MAJOR=!LUA_MAJOR:LUA_VERSION_MAJOR=! + SET LUA_MAJOR=!LUA_MAJOR: =! + SET LUA_MAJOR=!LUA_MAJOR:%TABCHAR%=! + SET LUA_MAJOR=!LUA_MAJOR:"=! + SET LUA_MAJOR=!LUA_MAJOR:~0,1! + + for /F "delims=" %%a in ('findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MINOR[ %TABCHAR%]" %LUA_H%') do set LUA_MINOR=%%a + SET LUA_MINOR=!LUA_MINOR:#define=! + SET LUA_MINOR=!LUA_MINOR:LUA_VERSION_MINOR=! + SET LUA_MINOR=!LUA_MINOR: =! + SET LUA_MINOR=!LUA_MINOR:%TABCHAR%=! + SET LUA_MINOR=!LUA_MINOR:"=! + SET LUA_MINOR=!LUA_MINOR:~0,1! + + SET LUA_VER=!LUA_MAJOR!.!LUA_MINOR! +) +SET LUA_SVER=!LUA_VER:.=! + +Echo Lua version found: %LUA_VER% +Echo. + +REM ************************************** +REM * Set some Lua version specifics * +REM ************************************** + +REM FILES_CORE; files for Lua core (+lauxlib, needed for Luac) +REM FILES_LIB; files for Lua standard libraries +REM FILES_DLL; vm files to be build with dll option +REM FILES_OTH; vm files to be build without dll, for static linking + +if %LUA_SVER%==51 ( + set FILES_CORE=lapi lcode ldebug ldo ldump lfunc lgc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio lauxlib + set FILES_LIB=lbaselib ldblib liolib lmathlib loslib ltablib lstrlib loadlib linit + set FILES_DLL=lua + set FILES_OTH=luac print + set INSTALL_H=lauxlib.h lua.h luaconf.h lualib.h ..\etc\lua.hpp +) +if %LUA_SVER%==52 ( + set FILES_CORE=lapi lcode lctype ldebug ldo ldump lfunc lgc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio lauxlib + set FILES_LIB=lbaselib lbitlib lcorolib ldblib liolib lmathlib loslib lstrlib ltablib loadlib linit + set FILES_DLL=lua + set FILES_OTH=luac + set INSTALL_H=lauxlib.h lua.h lua.hpp luaconf.h lualib.h + if "%COMPATFLAG%"=="" ( + set COMPATFLAG=-DLUA_COMPAT_ALL + ) +) +if %LUA_SVER%==53 ( + set FILES_CORE=lapi lcode lctype ldebug ldo ldump lfunc lgc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio lauxlib + set FILES_LIB=lbaselib lbitlib lcorolib ldblib liolib lmathlib loslib lstrlib ltablib lutf8lib loadlib linit + set FILES_DLL=lua + set FILES_OTH=luac + set INSTALL_H=lauxlib.h lua.h lua.hpp luaconf.h lualib.h + if "%COMPATFLAG%"=="" ( + set COMPATFLAG=-DLUA_COMPAT_5_2 + ) +) + +if "%NOCOMPAT%"=="TRUE" ( + set COMPATFLAG= +) + +SET FILES_BASE=%FILES_DLL% %FILES_CORE% %FILES_LIB% + +if "%FILES_BASE%"=="" ( + Echo Unknown Lua version; %LUA_VER% + goto :EXITERROR +) + +REM ********************************* +REM * Check available toolchain * +REM ********************************* + +if [%TOOLCHAIN%]==[] ( + Echo Testing for MS... + %CHECK_MS% + IF !ERRORLEVEL!==0 SET TOOLCHAIN=MS +) +if [%TOOLCHAIN%]==[] ( + Echo Testing for GCC... + %CHECK_GCC% + IF !ERRORLEVEL!==0 SET TOOLCHAIN=GCC +) +if [%TOOLCHAIN%]==[] ( + Echo No supported toolchain found ^(please make sure it is in the system path^) + goto :EXITERROR +) + +REM *************************** +REM * Configure toolchain * +REM *************************** + +if %TOOLCHAIN%==GCC ( + echo Using GCC toolchain... + SET OBJEXT=o + SET LIBFILE=liblua%LUA_SVER%.a +) +if %TOOLCHAIN%==MS ( + echo Using Microsoft toolchain... + SET OBJEXT=obj + SET LIBFILE=lua%LUA_SVER%.lib +) +echo. + +REM ************************************** +REM * Check for installing * +REM ************************************** + +if "%1"=="install" ( + if "%~2"=="" ( + echo. + echo ERROR: The install command requires a path where to install to. + goto :EXITERROR + ) + SET TARGETPATH=%~2 +) +if "%1"=="local" ( + if NOT "%~2"=="" ( + echo. + echo ERROR: The local command does not take extra parameters. + goto :EXITERROR + ) + SET TARGETPATH=%SOURCETREE%local +) +if NOT "%TARGETPATH%"=="" ( + mkdir "%TARGETPATH%\bin" + mkdir "%TARGETPATH%\include" + mkdir "%TARGETPATH%\lib\lua\%LUA_VER%" + mkdir "%TARGETPATH%\man\man1" + mkdir "%TARGETPATH%\share\lua\%LUA_VER%" + copy "%SOURCE%lua.exe" "%TARGETPATH%\bin" + copy "%SOURCE%luac.exe" "%TARGETPATH%\bin" + copy "%SOURCE%lua%LUA_SVER%.dll" "%TARGETPATH%\bin" + for %%a in (%INSTALL_H%) do ( copy "%SOURCE%%%a" "%TARGETPATH%\include" ) + copy "%SOURCE%%LIBFILE%" "%TARGETPATH%\lib" + copy "%SOURCETREE%doc\lua.1" "%TARGETPATH%\man\man1" + copy "%SOURCETREE%doc\luac.1" "%TARGETPATH%\man\man1" + + echo Installation completed in "%TARGETPATH%". + goto :EXITOK +) + +REM *********************** +REM * Compile sources * +REM *********************** +goto :after_compile_function +:compile_function + REM Params: %1 is filelist (must be quoted) + REM Return: same list, with the object file extension included, will be stored in global OBJLIST + + for %%a in (%~1) do ( + SET FILENAME=%%a + if %TOOLCHAIN%==GCC ( + SET COMPCMD=gcc -O2 -Wall !EXTRAFLAG! !COMPATFLAG! -c -o !FILENAME!.%OBJEXT% !FILENAME!.c + ) + if %TOOLCHAIN%==MS ( + SET COMPCMD=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE !COMPATFLAG! !EXTRAFLAG! !FILENAME!.c + ) + echo !COMPCMD! + !COMPCMD! + SET OBJLIST=!OBJLIST! !FILENAME!.%OBJEXT% + ) + +goto :eof +:after_compile_function + +CD %SOURCE% +REM Traverse the 4 lists of source files + +for %%b in (CORE LIB DLL OTH) do ( + SET LTYPE=%%b + SET OBJLIST= + if !LTYPE!==OTH ( + REM OTH is the only list of files build without DLL option + SET EXTRAFLAG= + ) else ( + SET EXTRAFLAG=-DLUA_BUILD_AS_DLL + ) + if !LTYPE!==CORE SET FILELIST=%FILES_CORE% + if !LTYPE!==LIB SET FILELIST=%FILES_LIB% + if !LTYPE!==DLL SET FILELIST=%FILES_DLL% + if !LTYPE!==OTH SET FILELIST=%FILES_OTH% + + echo Now compiling !LTYPE! file set... + call:compile_function "!FILELIST!" + + if !LTYPE!==CORE SET FILES_CORE_O=!OBJLIST! + if !LTYPE!==LIB SET FILES_LIB_O=!OBJLIST! + if !LTYPE!==DLL SET FILES_DLL_O=!OBJLIST! + if !LTYPE!==OTH SET FILES_OTH_O=!OBJLIST! +) + + +REM **************************** +REM * Link GCC based files * +REM **************************** + +if %TOOLCHAIN%==GCC ( + REM Link the LuaXX.dll file + SET LINKCMD=gcc -shared -o lua%LUA_SVER%.dll %FILES_CORE_O% %FILES_LIB_O% + echo !LINKCMD! + !LINKCMD! + + REM strip from LuaXX.dll + SET RANCMD=strip --strip-unneeded lua%LUA_SVER%.dll + echo !RANCMD! + !RANCMD! + + REM Link the Lua.exe file + SET LINKCMD=gcc -o lua.exe -s lua.%OBJEXT% lua%LUA_SVER%.dll -lm + echo !LINKCMD! + !LINKCMD! + + REM create lib archive + SET LIBCMD=ar rcu liblua%LUA_SVER%.a %FILES_CORE_O% %FILES_LIB_O% + echo !LIBCMD! + !LIBCMD! + + REM Speedup index using ranlib + SET RANCMD=ranlib liblua%LUA_SVER%.a + echo !RANCMD! + !RANCMD! + + REM Link Luac.exe file + SET LINKCMD=gcc -o luac.exe %FILES_OTH_O% liblua%LUA_SVER%.a -lm + echo !LINKCMD! + !LINKCMD! + +) + + +REM **************************** +REM * Link MS based files * +REM **************************** + +if %TOOLCHAIN%==MS ( + REM Link the LuaXX.dll file, and LuaXX.obj + SET LINKCMD=link /nologo /DLL /out:lua%LUA_SVER%.dll %FILES_CORE_O% %FILES_LIB_O% + echo !LINKCMD! + !LINKCMD! + + REM handle dll manifest + if exist lua%LUA_SVER%.dll.manifest ( + SET MANICMD=mt /nologo -manifest lua%LUA_SVER%.dll.manifest -outputresource:lua%LUA_SVER%.dll;2 + echo !MANICMD! + !MANICMD! + ) + + REM Link Lua.exe + SET LINKCMD=link /nologo /out:lua.exe lua.%OBJEXT% lua%LUA_SVER%.lib + echo !LINKCMD! + !LINKCMD! + + REM handle manifest + if exist lua.exe.manifest ( + SET MANICMD=mt /nologo -manifest lua.exe.manifest -outputresource:lua.exe + echo !MANICMD! + !MANICMD! + ) + + REM Link Luac.exe + SET LINKCMD=link /nologo /out:luac.exe %FILES_OTH_O% %FILES_CORE_O% + echo !LINKCMD! + !LINKCMD! + + REM handle manifest + if exist luac.exe.manifest ( + SET MANICMD=mt /nologo -manifest luac.exe.manifest -outputresource:luac.exe + echo !MANICMD! + !MANICMD! + ) +) + +CD %CURDIR% + +REM **************************** +REM * Finished building * +REM **************************** + +echo. +echo Build completed. +goto :EXITOK + +:EXITOK +exit /B 0 + +:EXITERROR +echo For help try; etc\%BATCHNAME% /help +exit /B 1 diff --git a/3rdparty/luv/.gitignore b/3rdparty/luv/.gitignore new file mode 100644 index 00000000000..8bcf497a42c --- /dev/null +++ b/3rdparty/luv/.gitignore @@ -0,0 +1,10 @@ +build +libluv.a +libluv.so +luv.so +luv.dll +luajit.exe +luv-*.tar.gz +luv-*.src.rock +luv-*/ +build.luarocks/ diff --git a/3rdparty/luv/.travis.yml b/3rdparty/luv/.travis.yml new file mode 100644 index 00000000000..b6909b894cc --- /dev/null +++ b/3rdparty/luv/.travis.yml @@ -0,0 +1,36 @@ +language: c +sudo: false + +addons: + apt: + sources: + - kalakris-cmake + packages: + - cmake + +env: + global: + - LUAROCKS=2.3.0 + matrix: + - WITH_LUA_ENGINE=Lua LUA=lua5.3 + - WITH_LUA_ENGINE=LuaJIT LUA=luajit2.1 + - PROCESS_CLEANUP_TEST=1 LUA=lua5.2 + +os: + - linux + - osx + +before_install: + - git submodule update --init --recursive + - git submodule update --recursive + +script: + - if [ "x$PROCESS_CLEANUP_TEST" = "x" ]; then make && make test; else ./tests/test-sigchld-after-lua_close.sh; fi + # Test rock installation + - source .ci/setenv_lua.sh + - luarocks make + - test $PWD = `lua -e "print(require'luv'.cwd())"` + +notifications: + email: true + irc: "irc.freenode.org#luvit" diff --git a/3rdparty/luv/CMakeLists.txt b/3rdparty/luv/CMakeLists.txt new file mode 100644 index 00000000000..9f079670de2 --- /dev/null +++ b/3rdparty/luv/CMakeLists.txt @@ -0,0 +1,191 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0053) + cmake_policy(SET CMP0053 NEW) # faster evaluation of variable references +endif() + +project (luv C ASM) + +set(LUV_VERSION_MAJOR 1) +set(LUV_VERSION_MINOR 8) +set(LUV_VERSION_PATCH 0) +set(LUV_VERSION ${LUV_VERSION_MAJOR}.${LUV_VERSION_MINOR}.${LUV_VERSION_PATCH}) + +option(BUILD_MODULE "Build as module" ON) +option(BUILD_SHARED_LIBS "Build shared library" OFF) +option(WITH_SHARED_LIBUV "Link to a shared libuv library instead of static linking" OFF) + +if (NOT WITH_LUA_ENGINE) + set(WITH_LUA_ENGINE "LuaJIT" + CACHE STRING "Link to LuaJIT or PUC Lua" FORCE) + set_property(CACHE WITH_LUA_ENGINE + PROPERTY STRINGS "Lua;LuaJIT") +endif (NOT WITH_LUA_ENGINE) + +if (NOT LUA_BUILD_TYPE) + set(LUA_BUILD_TYPE "Static" + CACHE STRING "Build Lua/LuaJIT as static, dynamic libary, or use system one" FORCE) + set_property(CACHE LUA_BUILD_TYPE + PROPERTY STRINGS "Static;Dynamic;System") +endif (NOT LUA_BUILD_TYPE) + +if (WITH_LUA_ENGINE STREQUAL Lua) + add_definitions(-DLUA_USE_DLOPEN) + set(USE_LUAJIT OFF) +else () + set(USE_LUAJIT ON) +endif () + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") + +if (WITH_SHARED_LIBUV) + find_package(Libuv) + if (LIBUV_FOUND) + include_directories(${LIBUV_INCLUDE_DIR}) + endif (LIBUV_FOUND) +else (WITH_SHARED_LIBUV) + include(deps/uv.cmake) + if (BUILD_MODULE) + add_definitions( -DBUILDING_UV_SHARED ) + endif (BUILD_MODULE) +endif (WITH_SHARED_LIBUV) + +if (LUA) + MESSAGE(STATUS "Lua: using information from luarocks") + + MESSAGE(STATUS "LUA_LIBDIR: " ${LUA_LIBDIR}) + MESSAGE(STATUS "LUA_INCDIR: " ${LUA_INCDIR}) + MESSAGE(STATUS "LUA: " ${LUA}) + + SET(LUA_EXECUTABLE "${LUA}") + SET(LUA_INCLUDE_DIR "${LUA_INCDIR}") + SET(LUA_PACKAGE_PATH "${LUADIR}") + SET(LUA_PACKAGE_CPATH "${LIBDIR}") + + SET(INSTALL_LIB_DIR ${LIBDIR}) + + GET_FILENAME_COMPONENT(LUA_EXEC_NAME ${LUA_EXECUTABLE} NAME_WE) + IF(LUA_EXEC_NAME STREQUAL "luajit") + FIND_LIBRARY(LUA_LIBRARIES + NAMES luajit libluajit + PATHS ${LUA_LIBDIR} + NO_DEFAULT_PATH) + ELSEIF(LUA_EXEC_NAME STREQUAL "lua") + FIND_LIBRARY(LUA_LIBRARIES + NAMES lua lua53 lua52 lua51 liblua liblua53 liblua52 liblua51 + PATHS ${LUA_LIBDIR} + NO_DEFAULT_PATH) + ENDIF() + MESSAGE(STATUS "Lua library: ${LUA_LIBRARIES}") + + include_directories(${LUA_INCLUDE_DIR}) +else (LUA) + if (LUA_BUILD_TYPE STREQUAL System) + if (USE_LUAJIT) + find_package(LuaJIT) + if (LUAJIT_FOUND) + include_directories(${LUAJIT_INCLUDE_DIR}) + link_directories(${LUAJIT_LIBRARIES}) + endif (LUAJIT_FOUND) + else (USE_LUAJIT) + find_package(Lua) + if (LUA_FOUND) + include_directories(${LUA_INCLUDE_DIR}) + endif (LUA_FOUND) + endif (USE_LUAJIT) + + else (LUA_BUILD_TYPE STREQUAL System) + if (LUA_BUILD_TYPE STREQUAL Static) + SET(WITH_SHARED_LUA OFF) + else (LUA_BUILD_TYPE STREQUAL Static) + SET(WITH_SHARED_LUA ON) + endif (LUA_BUILD_TYPE STREQUAL Static) + if (USE_LUAJIT) + include(deps/luajit.cmake) + include_directories(deps/luajit/src) + else(USE_LUAJIT) + include(deps/lua.cmake) + include_directories(deps/lua/src) + endif (USE_LUAJIT) + endif (LUA_BUILD_TYPE STREQUAL System) +endif (LUA) + +if (BUILD_MODULE) + add_library(luv MODULE src/luv.c) + set_target_properties(luv PROPERTIES PREFIX "") +else (BUILD_MODULE) + add_library(luv src/luv.c) + if (BUILD_SHARED_LIBS) + set_target_properties(luv + PROPERTIES VERSION ${LUV_VERSION} SOVERSION ${LUV_VERSION_MAJOR}) + endif (BUILD_SHARED_LIBS) +endif (BUILD_MODULE) + +if(APPLE) + set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS + "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress" + ) + # execute_process(COMMAND which luajit OUTPUT_VARIABLE LUAJIT) + # set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS + # "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -bundle_loader ${LUAJIT}" + # ) +endif() + +if(WIN32) + add_definitions(-DLUA_BUILD_AS_DLL -DLUA_LIB) + if (LUA) + target_link_libraries(luv uv ${LUA_LIBRARIES}) + else (LUA) + if (USE_LUAJIT) + target_link_libraries(luv uv luajit-5.1) + else (USE_LUAJIT) + if (LUA_BUILD_TYPE STREQUAL System) + target_link_libraries(luv uv ${LUA_LIBRARIES}) + else (LUA_BUILD_TYPE STREQUAL System) + target_link_libraries(luv uv lualib) + endif (LUA_BUILD_TYPE STREQUAL System) + endif (USE_LUAJIT) + endif (LUA) + # replace /MD to /MT to avoid link msvcr*.dll + set(CompilerFlags + CMAKE_C_FLAGS + CMAKE_C_FLAGS_DEBUG + CMAKE_C_FLAGS_MINSIZEREL + CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_RELEASE) + foreach(CompilerFlag ${CompilerFlags}) + string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") + endforeach() +elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + target_link_libraries(luv uv rt) +else() + target_link_libraries(luv uv) +endif() + +if (NOT LUA) + if (BUILD_MODULE) + if (WIN32) + set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + else (WIN32) + set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib/lua/${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}") + endif (WIN32) + else (BUILD_MODULE) + set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" + CACHE PATH "Installation directory for libraries") + set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include/luv" + CACHE PATH "Installation directory for headers") + endif (BUILD_MODULE) +endif () + +if (CMAKE_INSTALL_PREFIX) + install(TARGETS luv + ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" + LIBRARY DESTINATION "${INSTALL_LIB_DIR}" + ) + if (NOT BUILD_MODULE) + install( + FILES src/luv.h src/util.h src/lhandle.h src/lreq.h + DESTINATION "${INSTALL_INC_DIR}" + ) + endif (NOT BUILD_MODULE) +endif (CMAKE_INSTALL_PREFIX) diff --git a/3rdparty/luv/LICENSE.txt b/3rdparty/luv/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/3rdparty/luv/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/3rdparty/luv/Makefile b/3rdparty/luv/Makefile new file mode 100644 index 00000000000..1e7038c47ab --- /dev/null +++ b/3rdparty/luv/Makefile @@ -0,0 +1,61 @@ +LUV_TAG=$(shell git describe --tags) + +ifdef WITHOUT_AMALG + CMAKE_OPTIONS+= -DWITH_AMALG=OFF +endif + +BUILD_MODULE ?= ON +BUILD_SHARED_LIBS ?= OFF +WITH_SHARED_LIBUV ?= OFF +WITH_LUA_ENGINE ?= LuaJIT +LUA_BUILD_TYPE ?= Static + + +ifeq ($(WITH_LUA_ENGINE), LuaJIT) + LUABIN=build/luajit +else + LUABIN=build/lua +endif + +CMAKE_OPTIONS += \ + -DBUILD_MODULE=$(BUILD_MODULE) \ + -DBUILD_SHARED_LIBS=$(BUILD_SHARED_LIBS) \ + -DWITH_SHARED_LIBUV=$(WITH_SHARED_LIBUV) \ + -DWITH_LUA_ENGINE=$(WITH_LUA_ENGINE) \ + -DLUA_BUILD_TYPE=$(LUA_BUILD_TYPE) \ + +all: luv + +deps/libuv/include: + git submodule update --init deps/libuv + +deps/luajit/src: + git submodule update --init deps/luajit + +build/Makefile: deps/libuv/include deps/luajit/src + cmake -H. -Bbuild ${CMAKE_OPTIONS} -DWITH_AMALG=OFF + +luv: build/Makefile + cmake --build build --config Debug + ln -sf build/luv.so + +clean: + rm -rf build luv.so + +test: luv + ${LUABIN} tests/run.lua + +reset: + git submodule update --init --recursive && \ + git clean -f -d && \ + git checkout . + +publish-luarocks: + rm -rf luv-${LUV_TAG} + mkdir -p luv-${LUV_TAG}/deps + cp -r src cmake CMakeLists.txt LICENSE.txt README.md docs.md luv-${LUV_TAG}/ + cp -r deps/libuv deps/*.cmake deps/lua_one.c luv-${LUV_TAG}/deps/ + tar -czvf luv-${LUV_TAG}.tar.gz luv-${LUV_TAG} + github-release upload --user luvit --repo luv --tag ${LUV_TAG} \ + --file luv-${LUV_TAG}.tar.gz --name luv-${LUV_TAG}.tar.gz + luarocks upload luv-${LUV_TAG}.rockspec --api-key=${LUAROCKS_TOKEN} diff --git a/3rdparty/luv/README.md b/3rdparty/luv/README.md new file mode 100644 index 00000000000..47059d01ee7 --- /dev/null +++ b/3rdparty/luv/README.md @@ -0,0 +1,213 @@ +luv +=== + +[![Linux Build Status](https://travis-ci.org/luvit/luv.svg?branch=master)](https://travis-ci.org/luvit/luv) + +[![Windows Build status](https://ci.appveyor.com/api/projects/status/uo1qhdcc0vcqsiok/branch/master?svg=true)](https://ci.appveyor.com/project/racker-buildbot/luv/branch/master) + +[libuv](https://github.com/joyent/libuv) bindings for +[luajit](http://luajit.org/) and [lua](http://www.lua.org/) +[5.1](http://www.lua.org/manual/5.1/manual.html)/ +[5.2](http://www.lua.org/manual/5.2/manual.html)/ +[5.3](http://www.lua.org/manual/5.3/manual.html). + +This library makes libuv available to lua scripts. It was made for the [luvit](http://luvit.io/) project but should usable from nearly any lua project. + +The library can be used by multiple threads at once. Each thread is assumed to load the library from a different `lua_State`. Luv will create a unique `uv_loop_t` for each state. You can't share uv handles between states/loops. + +The best docs currently are the [libuv docs](http://docs.libuv.org/) themselves. Hopfully soon we'll have a copy locally tailored for lua. + +```lua +local uv = require('luv') + +-- Create a handle to a uv_timer_t +local timer = uv.new_timer() + +-- This will wait 1000ms and then continue inside the callback +timer:start(1000, 0, function () + -- timer here is the value we passed in before from new_timer. + + print ("Awake!") + + -- You must always close your uv handles or you'll leak memory + -- We can't depend on the GC since it doesn't know enough about libuv. + timer:close() +end) + +print("Sleeping"); + +-- uv.run will block and wait for all events to run. +-- When there are no longer any active handles, it will return +uv.run() +``` + + +Here is an example of an TCP echo server +```lua +local uv = require('luv') + +local function create_server(host, port, on_connection) + + local server = uv.new_tcp() + server:bind(host, port) + + server:listen(128, function(err) + -- Make sure there was no problem setting up listen + assert(not err, err) + + -- Accept the client + local client = uv.new_tcp() + server:accept(client) + + on_connection(client) + end) + + return server +end + +local server = create_server("0.0.0.0", 0, function (client) + + client:read_start(function (err, chunk) + + -- Crash on errors + assert(not err, err) + + if chunk then + -- Echo anything heard + client:write(chunk) + else + -- When the stream ends, close the socket + client:close() + end + end) +end) + +print("TCP Echo serverr listening on port " .. server:getsockname().port) + +uv.run() +``` + +More examples can be found in the [examples](examples) and [tests](tests) folders. + +## Building From Source + +To build, first install your compiler tools. + +### Get a Compiler + +On linux this probably means `gcc` and `make`. On Ubuntu, the `build-essential` +package is good for this. + +On OSX, you probably want XCode which comes with `clang` and `make` and friends. + +For windows the free Visual Studio Express works. If you get the 2013 edition, +make sure to get the `Windows Deskop` edition. The `Windows` version doesn't +include a working C compiler. Make sure to run all of setup including getting a +free license. + +### Install CMake + +Now install Cmake. The version in `brew` on OSX or most Linux package managers +is good. The version on Travis CI is too old and so I use a PPA there. On +windows use the installer and make sure to add cmake to your command prompt +path. + +### Install Git + +If you haven't already, install git and make sure it's in your path. This comes +with XCode on OSX. On Linux it's in your package manager. For windows, use the +installer at . Make sure it's available to your windows +command prompt. + +### Clone the Code + +Now open a terminal and clone the code. For windows I recommend the special +developer command prompt that came with Visual Studio. + +``` +git clone https://github.com/luvit/luv.git --recursive +cd luv +``` + +### Build the Code and Test + +On windows I wrote a small batch file that runs the correct cmake commands and +copies the output files for easy access. + +``` +C:\Code\luv> msvcbuild.bat +C:\Code\luv> luajit tests\run.lua +``` + +On unix systems, use the Makefile. + +``` +~/Code/luv> make test +``` + +This will build luv as a module library. Module libraries are plugins that are +not linked into other targets. + +#### Build with PUC Lua 5.3 +By default luv is linked with LuaJIT 2.0.4. If you rather like to link luv +with PUC Lua 5.3 you can run make with: + +``` +~/Code/luv> WITH_LUA_ENGINE=Lua make +``` + +#### Build as static library + +If you want to build luv as a static library run make with: + +``` +~/Code/luv> BUILD_MODULE=OFF make +``` + +This will create a static library `libluv.a`. + +#### Build as shared library + +If you want to build luv as a shared library run make with: + +``` +~/Code/luv> BUILD_MODULE=OFF BUILD_SHARED_LIBS=ON make +``` + +This will create a shared library `libluv.so`. + +#### Build with shared libraries + +By default the build system will build luv with the supplied dependencies. +These are: + * libuv + * LuaJIT or Lua + +However, if your target system has already one or more of these dependencies +installed you can link `luv` against them. + +##### Linking with shared libuv + +The default shared library name for libuv is `libuv`. To link against it use: + +``` +~/Code/luv> WITH_SHARED_LIBUV=ON make +``` + +##### Linking with shared LuaJIT + +The default shared library name for LuaJIT is `libluajit-5.1`. To link against +it use: + +``` +~/Code/luv> LUA_BUILD_TYPE=System make +``` + +##### Linking with shared Lua 5.x + +The default shared library name for Lua 5.x is `liblua5.x`. To link against +it use: + +``` +~/Code/luv> LUA_BUILD_TYPE=System WITH_LUA_ENGINE=Lua make +``` diff --git a/3rdparty/luv/appveyor.yml b/3rdparty/luv/appveyor.yml new file mode 100644 index 00000000000..b8d01898573 --- /dev/null +++ b/3rdparty/luv/appveyor.yml @@ -0,0 +1,42 @@ +os: Visual Studio 2015 + +# Test with the latest two releases of MSVC +configuration: + - 2015 + - 2013 + +# Test with the latest Lua and LuaJIT versions +environment: + LUAROCKS_VER: 2.3.0 + matrix: + - LUA_VER: 5.3.2 + NOCOMPAT: true # with compatibility flags disabled. + - LJ_VER: 2.1 + +platform: + - x86 + - x64 + +matrix: + fast_finish: true + +cache: + - c:\lua -> appveyor.yml + - c:\external -> appveyor.yml + +install: + - git submodule update --init + +build_script: + - msvcbuild.bat + - luajit.exe tests\run.lua + # Test rock installation + - call .ci\set_compiler_env.bat + - call .ci\install.bat + - luarocks make + - ps: if("$(Get-Location)" -eq $(lua -e "print(require'luv'.cwd())")) { "LuaRocks test OK" } else { "LuaRocks test failed"; exit 1 } + - luarocks remove luv + +artifacts: + - path: luv.dll + - path: luajit.exe diff --git a/3rdparty/luv/cmake/Modules/FindLibuv.cmake b/3rdparty/luv/cmake/Modules/FindLibuv.cmake new file mode 100644 index 00000000000..045362ae5db --- /dev/null +++ b/3rdparty/luv/cmake/Modules/FindLibuv.cmake @@ -0,0 +1,11 @@ +# Locate libuv library +# This module defines +# LIBUV_FOUND, if false, do not try to link to libuv +# LIBUV_LIBRARIES +# LIBUV_INCLUDE_DIR, where to find uv.h + +FIND_PATH(LIBUV_INCLUDE_DIR NAMES uv.h) +FIND_LIBRARY(LIBUV_LIBRARIES NAMES uv libuv) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUV DEFAULT_MSG LIBUV_LIBRARIES LIBUV_INCLUDE_DIR) diff --git a/3rdparty/luv/cmake/Modules/FindLuaJIT.cmake b/3rdparty/luv/cmake/Modules/FindLuaJIT.cmake new file mode 100644 index 00000000000..b9c2c3ee41a --- /dev/null +++ b/3rdparty/luv/cmake/Modules/FindLuaJIT.cmake @@ -0,0 +1,55 @@ +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# Copyright 2013 Rolf Eike Beer +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# We use code from the CMake project to detect the Lua version. + +# Locate LuaJIT library +# This module defines +# LUAJIT_FOUND, if false, do not try to link to Lua JIT +# LUAJIT_LIBRARIES +# LUAJIT_INCLUDE_DIR, where to find lua.h +# +# Additionally it defines the Lua API/ABI version: +# LUA_VERSION_STRING - the version of Lua found +# LUA_VERSION_MAJOR - the major version of Lua +# LUA_VERSION_MINOR - the minor version of Lua +# LUA_VERSION_PATCH - the patch version of Lua + +FIND_PATH(LUAJIT_INCLUDE_DIR NAMES lua.h PATH_SUFFIXES luajit-2.0) +FIND_LIBRARY(LUAJIT_LIBRARIES NAMES luajit-5.1) + +if (LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/lua.h") + # At least 5.[012] have different ways to express the version + # so all of them need to be tested. Lua 5.2 defines LUA_VERSION + # and LUA_RELEASE as joined by the C preprocessor, so avoid those. + file(STRINGS "${LUAJIT_INCLUDE_DIR}/lua.h" lua_version_strings + REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") + + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};") + if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};") + set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") + else () + string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + endif () + string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") + endif () + + unset(lua_version_strings) +endif() + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LUAJIT DEFAULT_MSG LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR) diff --git a/3rdparty/luv/deps/lua.cmake b/3rdparty/luv/deps/lua.cmake new file mode 100644 index 00000000000..393e67a107a --- /dev/null +++ b/3rdparty/luv/deps/lua.cmake @@ -0,0 +1,128 @@ +# Modfied from luajit.cmake +# Added LUAJIT_ADD_EXECUTABLE Ryan Phillips +# This CMakeLists.txt has been first taken from LuaDist +# Copyright (C) 2007-2011 LuaDist. +# Created by Peter Drahoš +# Redistribution and use of this file is allowed according to the terms of the MIT license. +# Debugged and (now seriously) modified by Ronan Collobert, for Torch7 + +#project(Lua53 C) + +SET(LUA_DIR ${CMAKE_CURRENT_LIST_DIR}/lua) + +SET(CMAKE_REQUIRED_INCLUDES + ${LUA_DIR} + ${LUA_DIR}/src + ${CMAKE_CURRENT_BINARY_DIR} +) + +OPTION(WITH_AMALG "Build eveything in one shot (needs memory)" ON) + +# Ugly warnings +IF(MSVC) + ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) +ENDIF() + +# Various includes +INCLUDE(CheckLibraryExists) +INCLUDE(CheckFunctionExists) +INCLUDE(CheckCSourceCompiles) +INCLUDE(CheckTypeSize) + +CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P) +IF(SIZEOF_VOID_P EQUAL 8) + ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE) +ENDIF() + +IF(NOT WIN32) + FIND_LIBRARY(DL_LIBRARY "dl") + IF(DL_LIBRARY) + SET(CMAKE_REQUIRED_LIBRARIES ${DL_LIBRARY}) + LIST(APPEND LIBS ${DL_LIBRARY}) + ENDIF(DL_LIBRARY) + CHECK_FUNCTION_EXISTS(dlopen LUA_USE_DLOPEN) + IF(NOT LUA_USE_DLOPEN) + MESSAGE(FATAL_ERROR "Cannot compile a useful lua. +Function dlopen() seems not to be supported on your platform. +Apparently you are not on a Windows platform as well. +So lua has no way to deal with shared libraries!") + ENDIF(NOT LUA_USE_DLOPEN) +ENDIF(NOT WIN32) + +check_library_exists(m sin "" LUA_USE_LIBM) +if ( LUA_USE_LIBM ) + list ( APPEND LIBS m ) +endif () + +## SOURCES +SET(SRC_LUALIB + ${LUA_DIR}/src/lbaselib.c + ${LUA_DIR}/src/lcorolib.c + ${LUA_DIR}/src/ldblib.c + ${LUA_DIR}/src/liolib.c + ${LUA_DIR}/src/lmathlib.c + ${LUA_DIR}/src/loadlib.c + ${LUA_DIR}/src/loslib.c + ${LUA_DIR}/src/lstrlib.c + ${LUA_DIR}/src/ltablib.c + ${LUA_DIR}/src/lutf8lib.c) + +SET(SRC_LUACORE + ${LUA_DIR}/src/lauxlib.c + ${LUA_DIR}/src/lapi.c + ${LUA_DIR}/src/lcode.c + ${LUA_DIR}/src/lctype.c + ${LUA_DIR}/src/ldebug.c + ${LUA_DIR}/src/ldo.c + ${LUA_DIR}/src/ldump.c + ${LUA_DIR}/src/lfunc.c + ${LUA_DIR}/src/lgc.c + ${LUA_DIR}/src/linit.c + ${LUA_DIR}/src/llex.c + ${LUA_DIR}/src/lmem.c + ${LUA_DIR}/src/lobject.c + ${LUA_DIR}/src/lopcodes.c + ${LUA_DIR}/src/lparser.c + ${LUA_DIR}/src/lstate.c + ${LUA_DIR}/src/lstring.c + ${LUA_DIR}/src/ltable.c + ${LUA_DIR}/src/ltm.c + ${LUA_DIR}/src/lundump.c + ${LUA_DIR}/src/lvm.c + ${LUA_DIR}/src/lzio.c + ${SRC_LUALIB}) + +## GENERATE + +IF(WITH_SHARED_LUA) + IF(WITH_AMALG) + add_library(lualib SHARED ${LUA_DIR}/../lua_one.c ${DEPS}) + ELSE() + add_library(lualib SHARED ${SRC_LUACORE} ${DEPS} ) + ENDIF() +ELSE() + IF(WITH_AMALG) + add_library(lualib STATIC ${LUA_DIR}/../lua_one.c ${DEPS} ) + ELSE() + add_library(lualib STATIC ${SRC_LUACORE} ${DEPS} ) + ENDIF() + set_target_properties(lualib PROPERTIES + PREFIX "lib" IMPORT_PREFIX "lib") +ENDIF() + +target_link_libraries (lualib ${LIBS} ) +set_target_properties (lualib PROPERTIES OUTPUT_NAME "lua53") + +IF(WIN32) + add_executable(lua ${LUA_DIR}/src/lua.c) + target_link_libraries(lua lualib) +ELSE() + IF(WITH_AMALG) + add_executable(lua ${LUA_DIR}/src/lua.c ${LUA_DIR}/lua_one.c ${DEPS}) + ELSE() + add_executable(lua ${LUA_DIR}/src/lua.c ${SRC_LUACORE} ${DEPS}) + ENDIF() + target_link_libraries(lua ${LIBS}) + SET_TARGET_PROPERTIES(lua PROPERTIES ENABLE_EXPORTS ON) +ENDIF(WIN32) + diff --git a/3rdparty/luv/deps/lua_one.c b/3rdparty/luv/deps/lua_one.c new file mode 100644 index 00000000000..2531883cc67 --- /dev/null +++ b/3rdparty/luv/deps/lua_one.c @@ -0,0 +1,97 @@ +/* +* one.c -- Lua core, libraries, and interpreter in a single file +*/ + +/* default is to build the full interpreter */ +#ifndef MAKE_LIB +#ifndef MAKE_LUAC +#ifndef MAKE_LUA +#define MAKE_LIB +#endif +#endif +#endif + +/* choose suitable platform-specific features */ +/* some of these may need extra libraries such as -ldl -lreadline -lncurses */ +#if 0 +#define LUA_USE_LINUX +#define LUA_USE_MACOSX +#define LUA_USE_POSIX +#define LUA_ANSI +#endif + +/* no need to change anything below this line ----------------------------- */ + +/* setup for luaconf.h */ +#if HAVE_LPREFIX +# include "lprefix.h" +#endif + +#define LUA_CORE +#define LUA_LIB +#define ltable_c +#define lvm_c +#include "luaconf.h" + +/* do not export internal symbols */ +#undef LUAI_FUNC +#undef LUAI_DDEC +#undef LUAI_DDEF +#define LUAI_FUNC static +#define LUAI_DDEC static +#define LUAI_DDEF static + +/* core -- used by all */ +#include "lapi.c" +#include "lcode.c" +#include "lctype.c" +#include "ldebug.c" +#include "ldo.c" +#include "ldump.c" +#include "lfunc.c" +#include "lgc.c" +#include "llex.c" +#include "lmem.c" +#include "lobject.c" +#include "lopcodes.c" +#include "lparser.c" +#include "lstate.c" +#include "lstring.c" +#include "ltable.c" +#include "ltm.c" +#include "lundump.c" +#include "lvm.c" +#include "lzio.c" + +/* auxiliary library -- used by all */ +#include "lauxlib.c" + +/* standard library -- not used by luac */ +#ifndef MAKE_LUAC +#include "lbaselib.c" +#if LUA_VERSION_NUM == 502 +# include "lbitlib.c" +#endif +#include "lcorolib.c" +#include "ldblib.c" +#include "liolib.c" +#include "lmathlib.c" +#include "loadlib.c" +#include "loslib.c" +#include "lstrlib.c" +#include "ltablib.c" +#if LUA_VERSION_NUM >= 503 +# include "lutf8lib.c" +#endif +#include "linit.c" +#endif + +/* lua */ +#ifdef MAKE_LUA +#include "lua.c" +#endif + +/* luac */ +#ifdef MAKE_LUAC +#include "luac.c" +#endif diff --git a/3rdparty/luv/deps/luajit.cmake b/3rdparty/luv/deps/luajit.cmake new file mode 100644 index 00000000000..e9d5b3582e1 --- /dev/null +++ b/3rdparty/luv/deps/luajit.cmake @@ -0,0 +1,407 @@ +# Added LUAJIT_ADD_EXECUTABLE Ryan Phillips +# This CMakeLists.txt has been first taken from LuaDist +# Copyright (C) 2007-2011 LuaDist. +# Created by Peter Drahoš +# Redistribution and use of this file is allowed according to the terms of the MIT license. +# Debugged and (now seriously) modified by Ronan Collobert, for Torch7 + +#project(LuaJIT C ASM) + +SET(LUAJIT_DIR ${CMAKE_CURRENT_LIST_DIR}/luajit) + +SET(CMAKE_REQUIRED_INCLUDES + ${LUAJIT_DIR} + ${LUAJIT_DIR}/src + ${CMAKE_CURRENT_BINARY_DIR} +) + +OPTION(WITH_AMALG "Build eveything in one shot (needs memory)" ON) + +# Ugly warnings +IF(MSVC) + ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) +ENDIF() + +# Various includes +INCLUDE(CheckLibraryExists) +INCLUDE(CheckFunctionExists) +INCLUDE(CheckCSourceCompiles) +INCLUDE(CheckTypeSize) + +# LuaJIT specific +option(LUAJIT_DISABLE_FFI "Disable FFI." OFF) +option(LUAJIT_ENABLE_LUA52COMPAT "Enable Lua 5.2 compatibility." ON) +option(LUAJIT_DISABLE_JIT "Disable JIT." OFF) +option(LUAJIT_CPU_SSE2 "Use SSE2 instead of x87 instructions." ON) +option(LUAJIT_CPU_NOCMOV "Disable NOCMOV." OFF) +MARK_AS_ADVANCED(LUAJIT_DISABLE_FFI LUAJIT_ENABLE_LUA52COMPAT LUAJIT_DISABLE_JIT LUAJIT_CPU_SSE2 LUAJIT_CPU_NOCMOV) + +IF(LUAJIT_DISABLE_FFI) + ADD_DEFINITIONS(-DLUAJIT_DISABLE_FFI) +ENDIF() + +IF(LUAJIT_ENABLE_LUA52COMPAT) + ADD_DEFINITIONS(-DLUAJIT_ENABLE_LUA52COMPAT) +ENDIF() + +IF(LUAJIT_DISABLE_JIT) + ADD_DEFINITIONS(-DLUAJIT_DISABLE_JIT) +ENDIF() + +IF(LUAJIT_CPU_SSE2) + ADD_DEFINITIONS(-DLUAJIT_CPU_SSE2) +ENDIF() + +IF(LUAJIT_CPU_NOCMOV) + ADD_DEFINITIONS(-DLUAJIT_CPU_NOCMOV) +ENDIF() +###### + + +CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P) +IF(SIZEOF_VOID_P EQUAL 8) + ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE) +ENDIF() + +if ( WIN32 AND NOT CYGWIN ) + add_definitions ( -DLUAJIT_OS=LUAJIT_OS_WINDOWS) + set ( LJVM_MODE coffasm ) +elseif ( APPLE ) + set ( CMAKE_EXE_LINKER_FLAGS "-pagezero_size 10000 -image_base 100000000 ${CMAKE_EXE_LINKER_FLAGS}" ) + set ( LJVM_MODE machasm ) +else () + set ( LJVM_MODE elfasm ) +endif () + +IF(NOT WIN32) + FIND_LIBRARY(DL_LIBRARY "dl") + IF(DL_LIBRARY) + SET(CMAKE_REQUIRED_LIBRARIES ${DL_LIBRARY}) + LIST(APPEND LIBS ${DL_LIBRARY}) + ENDIF(DL_LIBRARY) + CHECK_FUNCTION_EXISTS(dlopen LUA_USE_DLOPEN) + IF(NOT LUA_USE_DLOPEN) + MESSAGE(FATAL_ERROR "Cannot compile a useful lua. +Function dlopen() seems not to be supported on your platform. +Apparently you are not on a Windows platform as well. +So lua has no way to deal with shared libraries!") + ENDIF(NOT LUA_USE_DLOPEN) +ENDIF(NOT WIN32) + +check_library_exists(m sin "" LUA_USE_LIBM) +if ( LUA_USE_LIBM ) + list ( APPEND LIBS m ) +endif () + +## SOURCES +MACRO(LJ_TEST_ARCH stuff) + CHECK_C_SOURCE_COMPILES(" +#undef ${stuff} +#include \"lj_arch.h\" +#if ${stuff} +int main() { return 0; } +#else +#error \"not defined\" +#endif +" ${stuff}) +ENDMACRO() + +MACRO(LJ_TEST_ARCH_VALUE stuff value) + CHECK_C_SOURCE_COMPILES(" +#undef ${stuff} +#include \"lj_arch.h\" +#if ${stuff} == ${value} +int main() { return 0; } +#else +#error \"not defined\" +#endif +" ${stuff}_${value}) +ENDMACRO() + + +FOREACH(arch X64 X86 ARM PPC PPCSPE MIPS) + LJ_TEST_ARCH(LJ_TARGET_${arch}) + if(LJ_TARGET_${arch}) + STRING(TOLOWER ${arch} TARGET_LJARCH) + MESSAGE(STATUS "LuaJIT Target: ${TARGET_LJARCH}") + BREAK() + ENDIF() +ENDFOREACH() + +IF(NOT TARGET_LJARCH) + MESSAGE(FATAL_ERROR "architecture not supported") +ELSE() + MESSAGE(STATUS "LuaJIT target ${TARGET_LJARCH}") +ENDIF() + +FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/jit) +FILE(GLOB jit_files ${LUAJIT_DIR}/src/jit/*.lua) +FILE(COPY ${jit_files} DESTINATION ${CMAKE_BINARY_DIR}/jit) + +SET(DASM_ARCH ${TARGET_LJARCH}) +SET(DASM_FLAGS) +SET(TARGET_ARCH) +LIST(APPEND TARGET_ARCH "LUAJIT_TARGET=LUAJIT_ARCH_${TARGET_LJARCH}") +LJ_TEST_ARCH_VALUE(LJ_ARCH_BITS 64) +IF(LJ_ARCH_BITS_64) + SET(DASM_FLAGS ${DASM_FLAGS} -D P64) +ENDIF() +LJ_TEST_ARCH_VALUE(LJ_HASJIT 1) +IF(LJ_HASJIT_1) + SET(DASM_FLAGS ${DASM_FLAGS} -D JIT) +ENDIF() +LJ_TEST_ARCH_VALUE(LJ_HASFFI 1) +IF(LJ_HASFFI_1) + SET(DASM_FLAGS ${DASM_FLAGS} -D FFI) +ENDIF() +LJ_TEST_ARCH_VALUE(LJ_DUALNUM 1) +IF(LJ_DUALNUM_1) + SET(DASM_FLAGS ${DASM_FLAGS} -D DUALNUM) +ENDIF() +LJ_TEST_ARCH_VALUE(LJ_ARCH_HASFPU 1) +IF(LJ_ARCH_HASFPU_1) + SET(DASM_FLAGS ${DASM_FLAGS} -D FPU) + LIST(APPEND TARGET_ARCH "LJ_ARCH_HASFPU=1") +ELSE() + LIST(APPEND TARGET_ARCH "LJ_ARCH_HASFPU=0") +ENDIF() +LJ_TEST_ARCH_VALUE(LJ_ABI_SOFTFP 1) +IF(NOT LJ_ABI_SOFTFP_1) + SET(DASM_FLAGS ${DASM_FLAGS} -D HFABI) + LIST(APPEND TARGET_ARCH "LJ_ABI_SOFTFP=0") +ELSE() + LIST(APPEND TARGET_ARCH "LJ_ABI_SOFTFP=1") +ENDIF() +IF(WIN32) + SET(DASM_FLAGS ${DASM_FLAGS} -LN -D WIN) +ENDIF() +IF(TARGET_LJARCH STREQUAL "x86") + LJ_TEST_ARCH_VALUE(__SSE2__ 1) + IF(__SSE2__1) + SET(DASM_FLAGS ${DASM_FLAGS} -D SSE) + ENDIF() +ENDIF() +IF(TARGET_LJARCH STREQUAL "x64") + SET(DASM_ARCH "x86") +ENDIF() +IF(TARGET_LJARCH STREQUAL "ppc") + LJ_TEST_ARCH_VALUE(LJ_ARCH_SQRT 1) + IF(NOT LJ_ARCH_SQRT_1) + SET(DASM_FLAGS ${DASM_FLAGS} -D SQRT) + ENDIF() + LJ_TEST_ARCH_VALUE(LJ_ARCH_PPC64 1) + IF(NOT LJ_ARCH_PPC64_1) + SET(DASM_FLAGS ${DASM_FLAGS} -D GPR64) + ENDIF() +ENDIF() + +add_executable(minilua ${LUAJIT_DIR}/src/host/minilua.c) +SET_TARGET_PROPERTIES(minilua PROPERTIES COMPILE_DEFINITIONS "${TARGET_ARCH}") +CHECK_LIBRARY_EXISTS(m sin "" MINILUA_USE_LIBM) +if(MINILUA_USE_LIBM) + TARGET_LINK_LIBRARIES(minilua m) +endif() + +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/buildvm_arch.h + COMMAND minilua ${LUAJIT_DIR}/dynasm/dynasm.lua ${DASM_FLAGS} -o ${CMAKE_CURRENT_BINARY_DIR}/buildvm_arch.h ${LUAJIT_DIR}/src/vm_${DASM_ARCH}.dasc + DEPENDS ${LUAJIT_DIR}/dynasm/dynasm.lua minilua +) + +SET(SRC_LJLIB + ${LUAJIT_DIR}/src/lib_base.c + ${LUAJIT_DIR}/src/lib_math.c + ${LUAJIT_DIR}/src/lib_bit.c + ${LUAJIT_DIR}/src/lib_string.c + ${LUAJIT_DIR}/src/lib_table.c + ${LUAJIT_DIR}/src/lib_io.c + ${LUAJIT_DIR}/src/lib_os.c + ${LUAJIT_DIR}/src/lib_package.c + ${LUAJIT_DIR}/src/lib_debug.c + ${LUAJIT_DIR}/src/lib_jit.c + ${LUAJIT_DIR}/src/lib_ffi.c) + +SET(SRC_LJCORE + ${LUAJIT_DIR}/src/lj_gc.c + ${LUAJIT_DIR}/src/lj_err.c + ${LUAJIT_DIR}/src/lj_char.c + ${LUAJIT_DIR}/src/lj_buf.c + ${LUAJIT_DIR}/src/lj_profile.c + ${LUAJIT_DIR}/src/lj_strfmt.c + ${LUAJIT_DIR}/src/lj_bc.c + ${LUAJIT_DIR}/src/lj_obj.c + ${LUAJIT_DIR}/src/lj_str.c + ${LUAJIT_DIR}/src/lj_tab.c + ${LUAJIT_DIR}/src/lj_func.c + ${LUAJIT_DIR}/src/lj_udata.c + ${LUAJIT_DIR}/src/lj_meta.c + ${LUAJIT_DIR}/src/lj_debug.c + ${LUAJIT_DIR}/src/lj_state.c + ${LUAJIT_DIR}/src/lj_dispatch.c + ${LUAJIT_DIR}/src/lj_vmevent.c + ${LUAJIT_DIR}/src/lj_vmmath.c + ${LUAJIT_DIR}/src/lj_strscan.c + ${LUAJIT_DIR}/src/lj_api.c + ${LUAJIT_DIR}/src/lj_lex.c + ${LUAJIT_DIR}/src/lj_parse.c + ${LUAJIT_DIR}/src/lj_bcread.c + ${LUAJIT_DIR}/src/lj_bcwrite.c + ${LUAJIT_DIR}/src/lj_load.c + ${LUAJIT_DIR}/src/lj_ir.c + ${LUAJIT_DIR}/src/lj_opt_mem.c + ${LUAJIT_DIR}/src/lj_opt_fold.c + ${LUAJIT_DIR}/src/lj_opt_narrow.c + ${LUAJIT_DIR}/src/lj_opt_dce.c + ${LUAJIT_DIR}/src/lj_opt_loop.c + ${LUAJIT_DIR}/src/lj_opt_split.c + ${LUAJIT_DIR}/src/lj_opt_sink.c + ${LUAJIT_DIR}/src/lj_mcode.c + ${LUAJIT_DIR}/src/lj_snap.c + ${LUAJIT_DIR}/src/lj_record.c + ${LUAJIT_DIR}/src/lj_crecord.c + ${LUAJIT_DIR}/src/lj_ffrecord.c + ${LUAJIT_DIR}/src/lj_asm.c + ${LUAJIT_DIR}/src/lj_trace.c + ${LUAJIT_DIR}/src/lj_gdbjit.c + ${LUAJIT_DIR}/src/lj_ctype.c + ${LUAJIT_DIR}/src/lj_cdata.c + ${LUAJIT_DIR}/src/lj_cconv.c + ${LUAJIT_DIR}/src/lj_ccall.c + ${LUAJIT_DIR}/src/lj_ccallback.c + ${LUAJIT_DIR}/src/lj_carith.c + ${LUAJIT_DIR}/src/lj_clib.c + ${LUAJIT_DIR}/src/lj_cparse.c + ${LUAJIT_DIR}/src/lj_lib.c + ${LUAJIT_DIR}/src/lj_alloc.c + ${LUAJIT_DIR}/src/lj_vmmath.c + ${LUAJIT_DIR}/src/lib_aux.c + ${LUAJIT_DIR}/src/lib_init.c + ${SRC_LJLIB}) + +SET(SRC_BUILDVM + ${LUAJIT_DIR}/src/host/buildvm.c + ${LUAJIT_DIR}/src/host/buildvm_asm.c + ${LUAJIT_DIR}/src/host/buildvm_peobj.c + ${LUAJIT_DIR}/src/host/buildvm_lib.c + ${LUAJIT_DIR}/src/host/buildvm_fold.c + ${CMAKE_CURRENT_BINARY_DIR}/buildvm_arch.h) + +## GENERATE +ADD_EXECUTABLE(buildvm ${SRC_BUILDVM}) +SET_TARGET_PROPERTIES(buildvm PROPERTIES COMPILE_DEFINITIONS "${TARGET_ARCH}") + +macro(add_buildvm_target _target _mode) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target} + COMMAND buildvm ARGS -m ${_mode} -o ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${ARGN} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS buildvm ${ARGN} + ) +endmacro(add_buildvm_target) + +if (MSVC) + add_buildvm_target ( lj_vm.obj peobj ) + set (LJ_VM_SRC ${CMAKE_CURRENT_BINARY_DIR}/lj_vm.obj) +else () + add_buildvm_target ( lj_vm.S ${LJVM_MODE} ) + set (LJ_VM_SRC ${CMAKE_CURRENT_BINARY_DIR}/lj_vm.S) +endif () +add_buildvm_target ( lj_ffdef.h ffdef ${SRC_LJLIB} ) +add_buildvm_target ( lj_bcdef.h bcdef ${SRC_LJLIB} ) +add_buildvm_target ( lj_folddef.h folddef ${LUAJIT_DIR}/src/lj_opt_fold.c ) +add_buildvm_target ( lj_recdef.h recdef ${SRC_LJLIB} ) +add_buildvm_target ( lj_libdef.h libdef ${SRC_LJLIB} ) +add_buildvm_target ( vmdef.lua vmdef ${SRC_LJLIB} ) + +SET(DEPS + ${LJ_VM_SRC} + ${CMAKE_CURRENT_BINARY_DIR}/lj_ffdef.h + ${CMAKE_CURRENT_BINARY_DIR}/lj_bcdef.h + ${CMAKE_CURRENT_BINARY_DIR}/lj_libdef.h + ${CMAKE_CURRENT_BINARY_DIR}/lj_recdef.h + ${CMAKE_CURRENT_BINARY_DIR}/lj_folddef.h + ${CMAKE_CURRENT_BINARY_DIR}/vmdef.lua + ) + +## COMPILE +include_directories( + ${LUAJIT_DIR}/dynasm + ${LUAJIT_DIR}/src + ${CMAKE_CURRENT_BINARY_DIR} +) + +IF(WITH_SHARED_LUA) + IF(WITH_AMALG) + add_library(luajit-5.1 SHARED ${LUAJIT_DIR}/src/ljamalg.c ${DEPS} ) + ELSE() + add_library(luajit-5.1 SHARED ${SRC_LJCORE} ${DEPS} ) + ENDIF() + SET_TARGET_PROPERTIES(luajit-5.1 PROPERTIES OUTPUT_NAME "lua51") +ELSE() + IF(WITH_AMALG) + add_library(luajit-5.1 STATIC ${LUAJIT_DIR}/src/ljamalg.c ${DEPS} ) + ELSE() + add_library(luajit-5.1 STATIC ${SRC_LJCORE} ${DEPS} ) + ENDIF() + SET_TARGET_PROPERTIES(luajit-5.1 PROPERTIES + PREFIX "lib" IMPORT_PREFIX "lib" OUTPUT_NAME "luajit") +ENDIF() + +target_link_libraries (luajit-5.1 ${LIBS} ) + +IF(WIN32) + add_executable(luajit ${LUAJIT_DIR}/src/luajit.c) + target_link_libraries(luajit luajit-5.1) +ELSE() + IF(WITH_AMALG) + add_executable(luajit ${LUAJIT_DIR}/src/luajit.c ${LUAJIT_DIR}/src/ljamalg.c ${DEPS}) + ELSE() + add_executable(luajit ${LUAJIT_DIR}/src/luajit.c ${SRC_LJCORE} ${DEPS}) + ENDIF() + target_link_libraries(luajit ${LIBS}) + SET_TARGET_PROPERTIES(luajit PROPERTIES ENABLE_EXPORTS ON) +ENDIF() + +MACRO(LUAJIT_add_custom_commands luajit_target) + SET(target_srcs "") + FOREACH(file ${ARGN}) + IF(${file} MATCHES ".*\\.lua$") + set(file "${CMAKE_CURRENT_SOURCE_DIR}/${file}") + set(source_file ${file}) + string(LENGTH ${CMAKE_SOURCE_DIR} _luajit_source_dir_length) + string(LENGTH ${file} _luajit_file_length) + math(EXPR _begin "${_luajit_source_dir_length} + 1") + math(EXPR _stripped_file_length "${_luajit_file_length} - ${_luajit_source_dir_length} - 1") + string(SUBSTRING ${file} ${_begin} ${_stripped_file_length} stripped_file) + + set(generated_file "${CMAKE_BINARY_DIR}/jitted_tmp/${stripped_file}_${luajit_target}_generated${CMAKE_C_OUTPUT_EXTENSION}") + + add_custom_command( + OUTPUT ${generated_file} + MAIN_DEPENDENCY ${source_file} + DEPENDS luajit + COMMAND luajit + ARGS -bg + ${source_file} + ${generated_file} + COMMENT "Building Luajitted ${source_file}: ${generated_file}" + ) + + get_filename_component(basedir ${generated_file} PATH) + file(MAKE_DIRECTORY ${basedir}) + + set(target_srcs ${target_srcs} ${generated_file}) + set_source_files_properties( + ${generated_file} + properties + external_object true # this is an object file + generated true # to say that "it is OK that the obj-files do not exist before build time" + ) + ELSE() + set(target_srcs ${target_srcs} ${file}) + ENDIF(${file} MATCHES ".*\\.lua$") + ENDFOREACH(file) +ENDMACRO() + +MACRO(LUAJIT_ADD_EXECUTABLE luajit_target) + LUAJIT_add_custom_commands(${luajit_target} ${ARGN}) + add_executable(${luajit_target} ${target_srcs}) +ENDMACRO(LUAJIT_ADD_EXECUTABLE luajit_target) diff --git a/3rdparty/luv/deps/uv.cmake b/3rdparty/luv/deps/uv.cmake new file mode 100644 index 00000000000..b6570b26b60 --- /dev/null +++ b/3rdparty/luv/deps/uv.cmake @@ -0,0 +1,224 @@ +## Modifications +## Copyright 2014 The Luvit Authors. All Rights Reserved. + +## Original Copyright +# Copyright (c) 2014 David Capello +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +include(CheckTypeSize) + +cmake_minimum_required(VERSION 2.8.9) + +set(LIBUVDIR ${CMAKE_CURRENT_LIST_DIR}/libuv) + +include_directories( + ${LIBUVDIR}/src + ${LIBUVDIR}/include +) + +set(SOURCES + ${LIBUVDIR}/include/uv.h + ${LIBUVDIR}/include/tree.h + ${LIBUVDIR}/include/uv-errno.h + ${LIBUVDIR}/include/uv-threadpool.h + ${LIBUVDIR}/include/uv-version.h + ${LIBUVDIR}/src/fs-poll.c + ${LIBUVDIR}/src/heap-inl.h + ${LIBUVDIR}/src/inet.c + ${LIBUVDIR}/src/queue.h + ${LIBUVDIR}/src/threadpool.c + ${LIBUVDIR}/src/uv-common.c + ${LIBUVDIR}/src/uv-common.h + ${LIBUVDIR}/src/version.c +) + +if(WIN32) + add_definitions( + -D_WIN32_WINNT=0x0600 + -D_CRT_SECURE_NO_WARNINGS + -D_GNU_SOURCE + ) + set(SOURCES ${SOURCES} + ${LIBUVDIR}/include/uv-win.h + ${LIBUVDIR}/src/win/async.c + ${LIBUVDIR}/src/win/atomicops-inl.h + ${LIBUVDIR}/src/win/core.c + ${LIBUVDIR}/src/win/dl.c + ${LIBUVDIR}/src/win/error.c + ${LIBUVDIR}/src/win/fs.c + ${LIBUVDIR}/src/win/fs-event.c + ${LIBUVDIR}/src/win/getaddrinfo.c + ${LIBUVDIR}/src/win/getnameinfo.c + ${LIBUVDIR}/src/win/handle.c + ${LIBUVDIR}/src/win/handle-inl.h + ${LIBUVDIR}/src/win/internal.h + ${LIBUVDIR}/src/win/loop-watcher.c + ${LIBUVDIR}/src/win/pipe.c + ${LIBUVDIR}/src/win/thread.c + ${LIBUVDIR}/src/win/poll.c + ${LIBUVDIR}/src/win/process.c + ${LIBUVDIR}/src/win/process-stdio.c + ${LIBUVDIR}/src/win/req.c + ${LIBUVDIR}/src/win/req-inl.h + ${LIBUVDIR}/src/win/signal.c + ${LIBUVDIR}/src/win/snprintf.c + ${LIBUVDIR}/src/win/stream.c + ${LIBUVDIR}/src/win/stream-inl.h + ${LIBUVDIR}/src/win/tcp.c + ${LIBUVDIR}/src/win/tty.c + ${LIBUVDIR}/src/win/timer.c + ${LIBUVDIR}/src/win/udp.c + ${LIBUVDIR}/src/win/util.c + ${LIBUVDIR}/src/win/winapi.c + ${LIBUVDIR}/src/win/winapi.h + ${LIBUVDIR}/src/win/winsock.c + ${LIBUVDIR}/src/win/winsock.h + ) +else() + include_directories(${LIBUVDIR}/src/unix) + set(SOURCES ${SOURCES} + ${LIBUVDIR}/include/uv-unix.h + ${LIBUVDIR}/include/uv-linux.h + ${LIBUVDIR}/include/uv-sunos.h + ${LIBUVDIR}/include/uv-darwin.h + ${LIBUVDIR}/include/uv-bsd.h + ${LIBUVDIR}/include/uv-aix.h + ${LIBUVDIR}/src/unix/async.c + ${LIBUVDIR}/src/unix/atomic-ops.h + ${LIBUVDIR}/src/unix/core.c + ${LIBUVDIR}/src/unix/dl.c + ${LIBUVDIR}/src/unix/fs.c + ${LIBUVDIR}/src/unix/getaddrinfo.c + ${LIBUVDIR}/src/unix/getnameinfo.c + ${LIBUVDIR}/src/unix/internal.h + ${LIBUVDIR}/src/unix/loop.c + ${LIBUVDIR}/src/unix/loop-watcher.c + ${LIBUVDIR}/src/unix/pipe.c + ${LIBUVDIR}/src/unix/poll.c + ${LIBUVDIR}/src/unix/process.c + ${LIBUVDIR}/src/unix/signal.c + ${LIBUVDIR}/src/unix/spinlock.h + ${LIBUVDIR}/src/unix/stream.c + ${LIBUVDIR}/src/unix/tcp.c + ${LIBUVDIR}/src/unix/thread.c + ${LIBUVDIR}/src/unix/timer.c + ${LIBUVDIR}/src/unix/tty.c + ${LIBUVDIR}/src/unix/udp.c + ) +endif() + +check_type_size("void*" SIZEOF_VOID_P) +if(SIZEOF_VOID_P EQUAL 8) + add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE) +endif() + +## Freebsd +if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD") + set(SOURCES ${SOURCES} + ${LIBUVDIR}/src/unix/kqueue.c + ${LIBUVDIR}/src/unix/freebsd.c + ) +endif() + +## Linux +if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + add_definitions( + -D_GNU_SOURCE + ) + set(SOURCES ${SOURCES} + ${LIBUVDIR}/src/unix/proctitle.c + ${LIBUVDIR}/src/unix/linux-core.c + ${LIBUVDIR}/src/unix/linux-inotify.c + ${LIBUVDIR}/src/unix/linux-syscalls.c + ${LIBUVDIR}/src/unix/linux-syscalls.h + ) +endif() + +## SunOS +if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS") + add_definitions( + -D__EXTENSIONS__ + -D_XOPEN_SOURCE=500 + ) + set(SOURCES ${SOURCES} + ${LIBUVDIR}/src/unix/sunos.c + ) +endif() + +## Darwin +if(APPLE) + add_definitions( + -D=_DARWIN_USE_64_BIT_INODE + ) + set(SOURCES ${SOURCES} + ${LIBUVDIR}/src/unix/proctitle.c + ${LIBUVDIR}/src/unix/darwin.c + ${LIBUVDIR}/src/unix/fsevents.c + ${LIBUVDIR}/src/unix/darwin-proctitle.c + ${LIBUVDIR}/src/unix/kqueue.c + ) +endif() + +add_library(uv STATIC ${SOURCES}) +set_property(TARGET uv PROPERTY POSITION_INDEPENDENT_CODE ON) + +if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD") + target_link_libraries(uv + pthread + kvm + ) +endif() + +if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + target_link_libraries(uv + pthread + ) +endif() + +if(WIN32) + target_link_libraries(uv + ws2_32.lib + shell32.lib + psapi.lib + iphlpapi.lib + advapi32.lib + Userenv.lib + ) +endif() + +if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS") + target_link_libraries(uv + kstat + socket + sendfile + ) +endif() + +if(APPLE) + find_library(FOUNDATION_LIBRARY Foundation) + find_library(CORESERVICES_LIBRARY CoreServices) + find_library(APPLICATION_SERVICES_LIBRARY ApplicationServices) + target_link_libraries(uv + ${FOUNDATION_LIBRARY} + ${CORESERVICES_LIBRARY} + ${APPLICATION_SERVICES_LIBRARY} + ) +endif() diff --git a/3rdparty/luv/docs.md b/3rdparty/luv/docs.md new file mode 100644 index 00000000000..187dec24ff1 --- /dev/null +++ b/3rdparty/luv/docs.md @@ -0,0 +1,1309 @@ +# LibUV in Lua + +The [luv][] project provides access to the multi-platform support library +[libuv][] to lua code. It was primariliy developed for the [luvit][] project as +the `uv` builtin module, but can be used in other lua environments. + +### TCP Echo Server Example + +Here is a small example showing a TCP echo server: + +```lua +local uv = require('uv') + +local server = uv.new_tcp() +server:bind("127.0.0.1", 1337) +server:listen(128, function (err) + assert(not err, err) + local client = uv.new_tcp() + server:accept(client) + client:read_start(function (err, chunk) + assert(not err, err) + if chunk then + client:write(chunk) + else + client:shutdown() + client:close() + end + end) +end) +print("TCP server listening at 127.0.0.1 port 1337") +uv.run() +``` + +### Methods vs Functions + +As a quick note, [libuv][] is a C library and as such, there are no such things +as methods. The [luv][] bindings allow calling the libuv functions as either +functions or methods. For example, calling `server:bind(host, port)` is +equivalent to calling `uv.tcp_bind(server, host, port)`. All wrapped uv types +in lua have method shortcuts where is makes sense. Some are even renamed +shorter like the `tcp_` prefix that removed in method form. Under the hood it's +the exact same C function. + +## Table Of Contents + +The rest of the docs are organized by libuv type. There is some hierarchy as +most types are considered handles and some are considered streams. + + - [`uv_loop_t`][] — Event loop + - [`uv_handle_t`][] — Base handle + - [`uv_timer_t`][] — Timer handle + - [`uv_prepare_t`][] — Prepare handle + - [`uv_check_t`][] — Check handle + - [`uv_idle_t`][] — Idle handle + - [`uv_async_t`][] — Async handle + - [`uv_poll_t`][] — Poll handle + - [`uv_signal_t`][] — Signal handle + - [`uv_process_t`][] — Process handle + - [`uv_stream_t`][] — Stream handle + - [`uv_tcp_t`][] — TCP handle + - [`uv_pipe_t`][] — Pipe handle + - [`uv_tty_t`][] — TTY handle + - [`uv_udp_t`][] — UDP handle + - [`uv_fs_event_t`][] — FS Event handle + - [`uv_fs_poll_t`][] — FS Poll handle + - [Filesystem operations][] + - [DNS utility functions][] + - [Miscellaneous utilities][] + +## `uv_loop_t` — Event loop + +[`uv_loop_t`]: #uv_loop_t--event-loop + +The event loop is the central part of libuv’s functionality. It takes care of +polling for i/o and scheduling callbacks to be run based on different sources of +events. + +In [luv][], there is an implicit uv loop for every lua state that loads the +library. You can use this library in an multithreaded environment as long as +each thread has it's own lua state with corresponsding own uv loop. + +### `uv.loop_close()` + +Closes all internal loop resources. This function must only be called once the +loop has finished its execution or it will raise a UV_EBUSY error. + +### `uv.run([mode])` + +> optional `mode` defaults to `"default"` + +This function runs the event loop. It will act differently depending on the +specified mode: + + - `"default"`: Runs the event loop until there are no more active and + referenced handles or requests. Always returns `false`. + + - `"once"`: Poll for i/o once. Note that this function blocks if there are no + pending callbacks. Returns `false` when done (no active handles or requests + left), or `true` if more callbacks are expected (meaning you should run + the event loop again sometime in the future). + + - `"nowait"`: Poll for i/o once but don’t block if there are no + pending callbacks. Returns `false` if done (no active handles or requests + left), or `true` if more callbacks are expected (meaning you should run + the event loop again sometime in the future). + +Luvit will implicitly call `uv.run()` after loading user code, but if you use +the `luv` bindings directly, you need to call this after registering your +initial set of event callbacks to start the event loop. + +### `uv.loop_alive()` + +Returns true if there are active handles or request in the loop. + +### `uv.stop()` + +Stop the event loop, causing `uv_run()` to end as soon as possible. This +will happen not sooner than the next loop iteration. If this function was called +before blocking for i/o, the loop won’t block for i/o on this iteration. + +### `uv.backend_fd()` + +Get backend file descriptor. Only kqueue, epoll and event ports are supported. + +This can be used in conjunction with `uv_run("nowait")` to poll in one thread +and run the event loop’s callbacks in another. + +**Note**: Embedding a kqueue fd in another kqueue pollset doesn’t work on all +platforms. It’s not an error to add the fd but it never generates events. + +### `uv.backend_timeout()` + +Get the poll timeout. The return value is in milliseconds, or -1 for no timeout. + +### `uv.now()` + +Return the current timestamp in milliseconds. The timestamp is cached at the +start of the event loop tick, see `uv.update_time()` for details and rationale. + +The timestamp increases monotonically from some arbitrary point in time. Don’t +make assumptions about the starting point, you will only get disappointed. + +**Note**: Use `uv.hrtime()` if you need sub-millisecond granularity. + +### `uv.update_time()` + +Update the event loop’s concept of “now”. Libuv caches the current time at the +start of the event loop tick in order to reduce the number of time-related +system calls. + +You won’t normally need to call this function unless you have callbacks that +block the event loop for longer periods of time, where “longer” is somewhat +subjective but probably on the order of a millisecond or more. + +### `uv.walk(callback)` + +Walk the list of handles: `callback` will be executed with the handle. + +```lua +-- Example usage of uv.walk to close all handles that aren't already closing. +uv.walk(function (handle) + if not handle:is_closing() then + handle:close() + end +end) +``` + +## `uv_handle_t` — Base handle + +[`uv_handle_t`]: #uv_handle_t--base-handle + +`uv_handle_t` is the base type for all libuv handle types. + +Structures are aligned so that any libuv handle can be cast to `uv_handle_t`. +All API functions defined here work with any handle type. + +### `uv.is_active(handle)` + +> method form `handle:is_active()` + +Returns `true` if the handle is active, `false` if it’s inactive. What “active” +means depends on the type of handle: + + - A [`uv_async_t`][] handle is always active and cannot be deactivated, except + by closing it with uv_close(). + + - A [`uv_pipe_t`][], [`uv_tcp_t`][], [`uv_udp_t`][], etc. handlebasically any + handle that deals with i/ois active when it is doing something that + involves i/o, like reading, writing, connecting, accepting new connections, + etc. + + - A [`uv_check_t`][], [`uv_idle_t`][], [`uv_timer_t`][], etc. handle is active + when it has been started with a call to `uv.check_start()`, + `uv.idle_start()`, etc. + +Rule of thumb: if a handle of type `uv_foo_t` has a `uv.foo_start()` function, +then it’s active from the moment that function is called. Likewise, +`uv.foo_stop()` deactivates the handle again. + +### `uv.is_closing(handle)` + +> method form `handle:is_closing()` + +Returns `true` if the handle is closing or closed, `false` otherwise. + +**Note**: This function should only be used between the initialization of the +handle and the arrival of the close callback. + +### `uv.close(handle, callback)` + +> method form `handle:close(callback)` + +Request handle to be closed. `callback` will be called asynchronously after this +call. This MUST be called on each handle before memory is released. + +Handles that wrap file descriptors are closed immediately but `callback` will +still be deferred to the next iteration of the event loop. It gives you a chance +to free up any resources associated with the handle. + +In-progress requests, like `uv_connect_t` or `uv_write_t`, are cancelled and +have their callbacks called asynchronously with `status=UV_ECANCELED`. + +### `uv.ref(handle)` + +> method form `handle:ref()` + +Reference the given handle. References are idempotent, that is, if a handle is +already referenced calling this function again will have no effect. + +See [Reference counting][]. + +### `uv.unref(handle)` + +> method form `handle:unref()` + +Un-reference the given handle. References are idempotent, that is, if a handle +is not referenced calling this function again will have no effect. + +See [Reference counting][]. + +### `uv.has_ref(handle)` + +> method form `handle:has_ref()` + +Returns `true` if the handle referenced, `false` otherwise. + +See [Reference counting][]. + +### `uv.send_buffer_size(handle, [size]) -> size` + +> method form `handle:send_buffer_size(size)` + +Gets or sets the size of the send buffer that the operating system uses for the +socket. + +If `size` is omitted, it will return the current send buffer size, otherwise it +will use `size` to set the new send buffer size. + +This function works for TCP, pipe and UDP handles on Unix and for TCP and UDP +handles on Windows. + +**Note**: Linux will set double the size and return double the size of the +original set value. + +### `uv.recv_buffer_size(handle, [size])` + +> method form `handle:recv_buffer_size(size)` + +Gets or sets the size of the receive buffer that the operating system uses for +the socket. + +If `size` is omitted, it will return the current receive buffer size, otherwise +it will use `size` to set the new receive buffer size. + +This function works for TCP, pipe and UDP handles on Unix and for TCP and UDP +handles on Windows. + +**Note**: Linux will set double the size and return double the size of the +original set value. + +### `uv.fileno(handle)` + +> method form `handle:fileno()` + +Gets the platform dependent file descriptor equivalent. + +The following handles are supported: TCP, pipes, TTY, UDP and poll. Passing any +other handle type will fail with UV_EINVAL. + +If a handle doesn’t have an attached file descriptor yet or the handle itself +has been closed, this function will return UV_EBADF. + +**Warning**: Be very careful when using this function. libuv assumes it’s in +control of the file descriptor so any change to it may lead to malfunction. + +## Reference counting + +[reference counting]: #reference-counting + +The libuv event loop (if run in the default mode) will run until there are no +active and referenced handles left. The user can force the loop to exit early by +unreferencing handles which are active, for example by calling `uv.unref()` +after calling `uv.timer_start()`. + +A handle can be referenced or unreferenced, the refcounting scheme doesn’t use a +counter, so both operations are idempotent. + +All handles are referenced when active by default, see `uv.is_active()` for a +more detailed explanation on what being active involves. + +## `uv_timer_t` — Timer handle + +[`uv_timer_t`]: #uv_timer_t--timer-handle + +Timer handles are used to schedule callbacks to be called in the future. + +### `uv.new_timer() -> timer` + +Creates and initializes a new `uv_timer_t`. Returns the lua userdata wrapping +it. + +```lua +-- Creating a simple setTimeout wrapper +local function setTimeout(timeout, callback) + local timer = uv.new_timer() + timer:start(timeout, 0, function () + timer:stop() + timer:close() + callback() + end) + return timer +end + +-- Creating a simple setInterval wrapper +local function setInterval(interval, callback) + local timer = uv.new_timer() + timer:start(interval, interval, function () + timer:stop() + timer:close() + callback() + end) + return timer +end + +-- And clearInterval +local function clearInterval(timer) + timer:stop() + timer:close() +end +``` + +### `uv.timer_start(timer, timeout, repeat, callback)` + +> method form `timer:start(timeout, repeat, callback)` + +Start the timer. `timeout` and `repeat` are in milliseconds. + +If `timeout` is zero, the callback fires on the next event loop iteration. If +`repeat` is non-zero, the callback fires first after timeout milliseconds and +then repeatedly after repeat milliseconds. + +### `uv.timer_stop(timer)` + +> method form `timer:stop()` + +Stop the timer, the callback will not be called anymore. + +### `uv.timer_again(timer)` + +> method form `timer:again()` + +Stop the timer, and if it is repeating restart it using the repeat value as the +timeout. If the timer has never been started before it raises `EINVAL`. + +### `uv.timer_set_repeat(timer, repeat)` + +> method form `timer:set_repeat(repeat)` + +Set the repeat value in milliseconds. + +**Note**: If the repeat value is set from a timer callback it does not +immediately take effect. If the timer was non-repeating before, it will have +been stopped. If it was repeating, then the old repeat value will have been +used to schedule the next timeout. + +### `uv.timer_get_repeat(timer) -> repeat` + +> method form `timer:get_repeat() -> repeat` + +Get the timer repeat value. + +## `uv_prepare_t` — Prepare handle + +[`uv_prepare_t`]: #uv_prepare_t--prepare-handle + +Prepare handles will run the given callback once per loop iteration, right before polling for i/o. + +```lua +local prepare = uv.new_prepare() +prepare:start(function() + print("Before I/O polling") +end) +``` + +### `uv.new_prepare() -> prepare` + +Creates and initializes a new `uv_prepare_t`. Returns the lua userdata wrapping +it. + +### `uv.prepare_start(prepare, callback)` + +> method form `prepare:start(callback)` + +Start the handle with the given callback. + +### `uv.prepare_stop(prepare)` + +> method form `prepare:stop()` + +Stop the handle, the callback will no longer be called. + +## `uv_check_t` — Check handle + +[`uv_check_t`]: #uv_check_t--check-handle + +Check handles will run the given callback once per loop iteration, right after +polling for i/o. + +```lua +local check = uv.new_check() +check:start(function() + print("After I/O polling") +end) +``` + +### `uv.new_check() -> check` + +Creates and initializes a new `uv_check_t`. Returns the lua userdata wrapping +it. + +### `uv.check_start(check, callback)` + +> method form `check:start(callback)` + +Start the handle with the given callback. + +### `uv.check_stop(check)` + +> method form `check:stop()` + +Stop the handle, the callback will no longer be called. + +## `uv_idle_t` — Idle handle + +[`uv_idle_t`]: #uv_idle_t--idle-handle + +Idle handles will run the given callback once per loop iteration, right before +the [`uv_prepare_t`][] handles. + +**Note**: The notable difference with prepare handles is that when there are +active idle handles, the loop will perform a zero timeout poll instead of +blocking for i/o. + +**Warning**: Despite the name, idle handles will get their callbacks called on +every loop iteration, not when the loop is actually “idle”. + +```lua +local idle = uv.new_idle() +idle:start(function() + print("Before I/O polling, no blocking") +end) +``` +### `uv.new_idle() -> idle` + +Creates and initializes a new `uv_idle_t`. Returns the lua userdata wrapping +it. + +### `uv.idle_start(idle, callback)` + +> method form `idle:start(callback)` + +Start the handle with the given callback. + +### `uv.idle_stop(check)` + +> method form `idle:stop()` + +Stop the handle, the callback will no longer be called. + +## `uv_async_t` — Async handle + +[`uv_async_t`]: #uv_async_t--async-handle + +Async handles allow the user to “wakeup” the event loop and get a callback +called from another thread. + +```lua +local async +async = uv.new_async(function() + print("async operation ran") + async:close() +end) + +async:send() +``` + +### `uv.new_async(callback) -> async` + +Creates and initializes a new `uv_async_t`. Returns the lua userdata wrapping +it. A NULL callback is allowed. + +**Note**: Unlike other handle initialization functions, it immediately starts +the handle. + +### `uv.async_send(async)` + +> method form `async:send()` + +Wakeup the event loop and call the async handle’s callback. + +**Note**: It’s safe to call this function from any thread. The callback will be +called on the loop thread. + +**Warning**: libuv will coalesce calls to `uv.async_send(async)`, that is, not +every call to it will yield an execution of the callback, the only guarantee is +that it will be called at least once. Thus, calling this function may not +wakeup the event loop if it was already called previously within a short period +of time. + +## `uv_poll_t` — Poll handle + +[`uv_poll_t`]: #uv_poll_t--poll-handle + +Poll handles are used to watch file descriptors for readability and writability, +similar to the purpose of [poll(2)](http://linux.die.net/man/2/poll). + +The purpose of poll handles is to enable integrating external libraries that +rely on the event loop to signal it about the socket status changes, like c-ares +or libssh2. Using `uv_poll_t` for any other purpose is not recommended; +`uv_tcp_t`, `uv_udp_t`, etc. provide an implementation that is faster and more +scalable than what can be achieved with `uv_poll_t`, especially on Windows. + +It is possible that poll handles occasionally signal that a file descriptor is +readable or writable even when it isn’t. The user should therefore always be +prepared to handle EAGAIN or equivalent when it attempts to read from or write +to the fd. + +It is not okay to have multiple active poll handles for the same socket, this +can cause libuv to busyloop or otherwise malfunction. + +The user should not close a file descriptor while it is being polled by an +active poll handle. This can cause the handle to report an error, but it might +also start polling another socket. However the fd can be safely closed +immediately after a call to `uv.poll_stop()` or `uv.close()`. + +**Note** On windows only sockets can be polled with poll handles. On Unix any +file descriptor that would be accepted by poll(2) can be used. + + +### `uv.new_poll(fd) -> poll` + +Initialize the handle using a file descriptor. + +The file descriptor is set to non-blocking mode. + +### `uv.new_socket_poll(fd) -> poll` + +Initialize the handle using a socket descriptor. On Unix this is identical to +`uv.poll_init()`. On windows it takes a SOCKET handle. + +The socket is set to non-blocking mode. + +### `uv.poll_start(poll, events, callback)` + +> method form `poll:start()` + +Starts polling the file descriptor. `events` is `"r"`, `"w"`, or `"rw"` and +translates to a bitmask made up of UV_READABLE and UV_WRITABLE. As soon as an +event is detected the callback will be called with status set to 0, and the +detected events set on the events field. + +The user should not close the socket while the handle is active. If the user +does that anyway, the callback may be called reporting an error status, but this +is not guaranteed. + +**Note** Calling `uv.poll_start()`` on a handle that is already active is fine. +Doing so will update the events mask that is being watched for. + +## `uv.poll_stop(poll)` + +> method form `poll:stop()` + +Stop polling the file descriptor, the callback will no longer be called. + +## `uv_signal_t` — Signal handle + +[`uv_signal_t`]: #uv_signal_t--signal-handle + +Signal handles implement Unix style signal handling on a per-event loop bases. + +Reception of some signals is emulated on Windows: +* SIGINT is normally delivered when the user presses CTRL+C. However, like on +Unix, it is not generated when terminal raw mode is enabled. +* SIGBREAK is delivered when the user pressed CTRL + BREAK. +* SIGHUP is generated when the user closes the console window. On SIGHUP the +program is given approximately 10 seconds to perform cleanup. After that +Windows will unconditionally terminate it. +* SIGWINCH is raised whenever libuv detects that the console has been resized. +SIGWINCH is emulated by libuv when the program uses a uv_tty_t handle to write +to the console. SIGWINCH may not always be delivered in a timely manner; libuv +will only detect size changes when the cursor is being moved. When a readable +[`uv_tty_t`][] handle is used in raw mode, resizing the console buffer will +also trigger a SIGWINCH signal. + +Watchers for other signals can be successfully created, but these signals are +never received. These signals are: SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGTERM +and SIGKILL. + +Calls to raise() or abort() to programmatically raise a signal are not detected +by libuv; these will not trigger a signal watcher. + +**Note**: On Linux SIGRT0 and SIGRT1 (signals 32 and 33) are used by the NPTL +pthreads library to manage threads. Installing watchers for those signals will +lead to unpredictable behavior and is strongly discouraged. Future versions of +libuv may simply reject them. + +```lua +-- Create a new signal handler +local sigint = uv.new_signal() +-- Define a handler function +uv.signal_start(sigint, "sigint", function(signal) +print("got " .. signal .. ", shutting down") +os.exit(1) +end) +``` + +### `uv.new_signal() -> signal` + +Creates and initializes a new `uv_signal_t`. Returns the lua userdata wrapping +it. + +### `uv.signal_start(signal, signum, callback)` + +> method form `signal:start(signum, callback)` + +Start the handle with the given callback, watching for the given signal. + +### `uv.signal_stop(signal)` + +> method form `signal:stop()` + +Stop the handle, the callback will no longer be called. + +## `uv_process_t` — Process handle + +[`uv_process_t`]: #uv_process_t--process-handle + +Process handles will spawn a new process and allow the user to control it and +establish communication channels with it using streams. + +### `uv.disable_stdio_inheritance()` + +Disables inheritance for file descriptors / handles that this process inherited +from its parent. The effect is that child processes spawned by this process +don’t accidentally inherit these handles. + +It is recommended to call this function as early in your program as possible, +before the inherited file descriptors can be closed or duplicated. + +**Note** This function works on a best-effort basis: there is no guarantee that +libuv can discover all file descriptors that were inherited. In general it does +a better job on Windows than it does on Unix. + +### `uv.spawn(file, options, onexit) -> process, pid` + +Initializes the process handle and starts the process. If the process is +successfully spawned, this function will return the handle and pid of the child +process. + +Possible reasons for failing to spawn would include (but not be limited to) the +file to execute not existing, not having permissions to use the setuid or setgid +specified, or not having enough memory to allocate for the new process. + + +```lua +local stdout = uv.new_pipe(false) +local stderr = uv.new_pipe(false) +local stdin = uv.new_pipe(false) + +local handle, pid + +local function onexit(code, signal) + p("exit", {code=code,signal=signal}) +end + +local function onclose() + p("close") +end + +local function onread(err, chunk) + assert(not err, err) + if (chunk) then + p("data", {data=chunk}) + else + p("end") + end +end + +local function onshutdown() + uv.close(handle, onclose) +end + +handle, pid = uv.spawn("cat", { + stdio = {stdin, stdout, stderr} +}, onexit) + +p{ + handle=handle, + pid=pid +} + +uv.read_start(stdout, onread) +uv.read_start(stderr, onread) +uv.write(stdin, "Hello World") +uv.shutdown(stdin, onshutdown) +``` + + - `options.args` - Command line arguments as a list of string. The first string + should be the path to the program. On Windows this uses CreateProcess which + concatenates the arguments into a string this can cause some strange errors. + (See `options.verbatim` below for Windows.) + - `options.stdio` - Set the file descriptors that will be made available to the + child process. The convention is that the first entries are stdin, stdout, + and stderr. (**Note** On Windows file descriptors after the third are + available to the child process only if the child processes uses the MSVCRT + runtime.) + - `options.env` - Set environment variables for the new process. + - `options.cwd` - Set current working directory for the subprocess. + - `options.uid` - Set the child process' user id. + - `options.gid` - Set the child process' group id. + - `options.verbatim` - If true, do not wrap any arguments in quotes, or perform + any other escaping, when converting the argument list into a command line + string. This option is only meaningful on Windows systems. On Unix it is + silently ignored. + - `options.detached` - If true, spawn the child process in a detached state - + this will make it a process group leader, and will effectively enable the + child to keep running after the parent exits. Note that the child process + will still keep the parent's event loop alive unless the parent process calls + `uv.unref()` on the child's process handle. + - `options.hide` - If true, hide the subprocess console window that would + normally be created. This option is only meaningful on Windows systems. On + Unix it is silently ignored. + +The `options.stdio` entries can take many shapes. + +- If they are numbers, then the child process inherits that same zero-indexed fd + from the parent process. +- If `uv_stream_h` handles are passed in, those are used as a read-write pipe or + inherited stream depending if the stream has a valid fd. +- Including `nil` placeholders means to ignore that fd in the child. + +When the child process exits, the `onexit` callback will be called with exit +code and signal. + +### `uv.process_kill(process, sigmun)` + +> method form `process:kill(sigmun)` + +Sends the specified signal to the given process handle. + +### `uv.kill(pid, sigmun)` + +Sends the specified signal to the given PID. + +## `uv_stream_t` — Stream handle + +[`uv_stream_t`]: #uv_stream_t--stream-handle + +Stream handles provide an abstraction of a duplex communication channel. +[`uv_stream_t`][] is an abstract type, libuv provides 3 stream implementations in +the form of [`uv_tcp_t`][], [`uv_pipe_t`][] and [`uv_tty_t`][]. + +### `uv.shutdown(stream, [callback]) -> req` + +> (method form `stream:shutdown([callback]) -> req`) + +Shutdown the outgoing (write) side of a duplex stream. It waits for pending +write requests to complete. The callback is called after +shutdown is complete. + +### `uv.listen(stream, backlog, callback)` + +> (method form `stream:listen(backlog, callback)`) + +Start listening for incoming connections. `backlog` indicates the number of +connections the kernel might queue, same as `listen(2)`. When a new incoming +connection is received the callback is called. + +### `uv.accept(stream, client_stream)` + +> (method form `stream:accept(client_stream)`) + +This call is used in conjunction with `uv.listen()` to accept incoming +connections. Call this function after receiving a callback to accept the +connection. + +When the connection callback is called it is guaranteed that this function +will complete successfully the first time. If you attempt to use it more than +once, it may fail. It is suggested to only call this function once per +connection call. + +```lua +server:listen(128, function (err) + local client = uv.new_tcp() + server:accept(client) +end) +``` + +### `uv.read_start(stream, callback)` + +> (method form `stream:read_start(callback)`) + +Callback is of the form `(err, data)`. + +Read data from an incoming stream. The callback will be made several times until +there is no more data to read or `uv.read_stop()` is called. When we’ve reached +EOF, `data` will be `nil`. + +```lua +stream:read_start(function (err, chunk) + if err then + -- handle read error + elseif chunk then + -- handle data + else + -- handle disconnect + end +end) +``` + +### `uv.read_stop(stream)` + +> (method form `stream:read_stop()`) + +Stop reading data from the stream. The read callback will no longer be called. + +### `uv.write(stream, data, [callback])` + +> (method form `stream:write(data, [callback])`) + +Write data to stream. + +`data` can either be a lua string or a table of strings. If a table is passed +in, the C backend will use writev to send all strings in a single system call. + +The optional `callback` is for knowing when the write is +complete. + +### `uv.write2(stream, data, send_handle, callback)` + +> (method form `stream:write2(data, send_handle, callback)`) + +Extended write function for sending handles over a pipe. The pipe must be +initialized with ip option to `true`. + +**Note: `send_handle` must be a TCP socket or pipe, which is a server or a +connection (listening or connected state). Bound sockets or pipes will be +assumed to be servers. + +### `uv.try_write(stream, data)` + +> (method form `stream:try_write(data)`) + +Same as `uv.write()`, but won’t queue a write request if it can’t be completed +immediately. + +Will return number of bytes written (can be less than the supplied buffer size). + +### `uv.is_readable(stream)` + +> (method form `stream:is_readable()`) + +Returns `true` if the stream is readable, `false` otherwise. + +### `uv.is_writable(stream)` + +> (method form `stream:is_writable()`) + +Returns `true` if the stream is writable, `false` otherwise. + +### `uv.stream_set_blocking(stream, blocking)` + +> (method form `stream:set_blocking(blocking)`) + +Enable or disable blocking mode for a stream. + +When blocking mode is enabled all writes complete synchronously. The interface +remains unchanged otherwise, e.g. completion or failure of the operation will +still be reported through a callback which is made asynchronously. + +**Warning**: Relying too much on this API is not recommended. It is likely to +change significantly in the future. Currently this only works on Windows and +only for uv_pipe_t handles. Also libuv currently makes no ordering guarantee +when the blocking mode is changed after write requests have already been +submitted. Therefore it is recommended to set the blocking mode immediately +after opening or creating the stream. + +## `uv_tcp_t` — TCP handle + +[`uv_tcp_t`]: #uv_tcp_t--tcp-handle + +TCP handles are used to represent both TCP streams and servers. + +`uv_tcp_t` is a ‘subclass’ of [`uv_stream_t`][](#uv_stream_t--stream-handle). + +### `uv.new_tcp() -> tcp` + +Creates and initializes a new `uv_tcp_t`. Returns the lua userdata wrapping it. + +### `uv.tcp_open(tcp, sock)` + +> (method form `tcp:open(sock)`) + +Open an existing file descriptor or SOCKET as a TCP handle. + +**Note: The user is responsible for setting the file descriptor in non-blocking +mode. + +### `uv.tcp_nodelay(tcp, enable)` + +> (method form `tcp:nodelay(enable)`) + +Enable / disable Nagle’s algorithm. + +### `uv.tcp_keepalive(tcp, enable, [delay])` + +> (method form `tcp:keepalive(enable, [delay])`) + +Enable / disable TCP keep-alive. `delay` is the initial delay in seconds, ignored +when enable is `false`. + +### `uv.tcp_simultaneous_accepts(tcp, enable)` + +> (method form `tcp:simultaneous_accepts(enable)`) + +Enable / disable simultaneous asynchronous accept requests that are queued by +the operating system when listening for new TCP connections. + +This setting is used to tune a TCP server for the desired performance. Having +simultaneous accepts can significantly improve the rate of accepting connections +(which is why it is enabled by default) but may lead to uneven load distribution +in multi-process setups. + +### `uv.tcp_bind(tcp, address, port)` + +> (method form `tcp:bind(address, port)`) + +Bind the handle to an address and port. `address` should be an IP address and +not a domain name. + +When the port is already taken, you can expect to see an UV_EADDRINUSE error +from either `uv.tcp_bind()`, `uv.listen()` or `uv.tcp_connect()`. That is, a +successful call to this function does not guarantee that the call to `uv.listen()` +or `uv.tcp_connect()` will succeed as well. + +Use a port of `0` to let the OS assign an ephemeral port. You can look it up +later using `uv.tcp_getsockname()`. + +### `uv.tcp_getsockname(tcp)` + +> (method form `tcp:getsockname()`) + +Get the current address to which the handle is bound. + +### `uv.tcp_getpeername(tcp)` + +> (method form `tcp:getpeername()`) + +Get the address of the peer connected to the handle. + +### `uv.tcp_connect(tcp, address, port, callback) -> req` + +> (method form `tcp:connect(host, port, callback) -> req`) + +### `uv.tcp_write_queue_size(tcp) -> size` + +> (method form `tcp:write_queue_size() -> size`) + +Establish an IPv4 or IPv6 TCP connection. + +The callback is made when the connection has been established or when a +connection error happened. + +```lua +local client = uv.new_tcp() +client:connect("127.0.0.1", 8080, function (err) + -- check error and carry on. +end) +``` + +## `uv_pipe_t` — Pipe handle + +[`uv_pipe_t`]: #uv_pipe_t--pipe-handle + +Pipe handles provide an abstraction over local domain sockets on Unix and named +pipes on Windows. + +```lua +local pipe = uv.new_pipe(false) + +pipe:bind('/tmp/sock.test') + +pipe:listen(128, function() + local client = uv.new_pipe(false) + pipe:accept(client) + client:write("hello!\n") + client:close() +end) +``` + +### `uv.new_pipe(ipc) -> pipe` + +Creates and initializes a new `uv_pipe_t`. Returns the lua userdata wrapping +it. The `ipc` argument is a boolean to indicate if this pipe will be used for +handle passing between processes. + +### `uv.pipe_open(file) -> pipe` + +Open an existing file descriptor or [`uv_handle_t`][] as a pipe. + +**Note**: The file descriptor is set to non-blocking mode. + +### `uv.pipe_bind(pipe, name)` + +> (method form `pipe:bind(name)`) + +Bind the pipe to a file path (Unix) or a name (Windows). + +**Note**: Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes, +typically between 92 and 108 bytes. + +### `uv.pipe_connect(pipe, name, callback)` + +> (method form `pipe:connect(name, callback)`) + +Connect to the Unix domain socket or the named pipe. + +**Note**: Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes, +typically between 92 and 108 bytes. + +### `uv.pipe_getsockname(pipe)` + +> (method form `pipe:getsockname()`) + +Returns the name of the Unix domain socket or the named pipe. + +### `uv.pipe_pending_instances(pipe, count)` + +> (method form `pipe:pending_instances(count)`) + +Set the number of pending pipe instance handles when the pipe server is waiting for connections. + +**Note**: This setting applies to Windows only. + +### `uv.pipe_pending_count(pipe)` + +> (method form `pipe:pending_count()`) + +Returns the pending pipe count for the named pipe. + +### `uv.pipe_pending_type(pipe)` + +> (method form `pipe:pending_type()`) + +Used to receive handles over IPC pipes. + +First - call [`uv.pipe_pending_count`][], if it’s > 0 then initialize a handle +of the given type, returned by [`uv.pipe_pending_type`][] and call +[`uv.accept(pipe, handle)`][]. + +## `uv_tty_t` — TTY handle + +[`uv_tty_t`]: #uv_tty_t--tty-handle + +TTY handles represent a stream for the console. + +```lua +-- Simple echo program +local stdin = uv.new_tty(0, true) +local stdout = uv.new_tty(1, false) + +stdin:read_start(function (err, data) + assert(not err, err) + if data then + stdout:write(data) + else + stdin:close() + stdout:close() + end +end) +``` + +### uv.new_tty(fd, readable) -> tty + +Initialize a new TTY stream with the given file descriptor. Usually the file +descriptor will be: + + - 0 - stdin + - 1 - stdout + - 2 - stderr + +`readable, specifies if you plan on calling uv_read_start() with this stream. +`stdin is readable, stdout is not. + +On Unix this function will try to open /dev/tty and use it if the passed file +descriptor refers to a TTY. This lets libuv put the tty in non-blocking mode +without affecting other processes that share the tty. + +Note: If opening `/dev/tty` fails, libuv falls back to blocking writes for +non-readable TTY streams. + +### uv.tty_set_mode(mode) + +> (method form `tty:set_mode(mode)`) + +Set the TTY using the specified terminal mode. + +Parameter `mode` is a C enum with the following values: + +- 0 - UV_TTY_MODE_NORMAL: Initial/normal terminal mode + +- 1 - UV_TTY_MODE_RAW: Raw input mode (On Windows, ENABLE_WINDOW_INPUT is + also enabled) + +- 2 - UV_TTY_MODE_IO: Binary-safe I/O mode for IPC (Unix-only) + +## uv.tty_reset_mode() + +To be called when the program exits. Resets TTY settings to default values for +the next process to take over. + +This function is async signal-safe on Unix platforms but can fail with error +code UV_EBUSY if you call it when execution is inside uv_tty_set_mode(). + +## uv.tty_get_winsize() -> w, h + +> (method form `tty:get_winsize() -> w, h`) + +Gets the current Window size. + +## `uv_udp_t` — UDP handle + +[`uv_udp_t`]: #uv_udp_t--udp-handle + +UDP handles encapsulate UDP communication for both clients and servers. + +### uv.new_udp() -> udp + +Initialize a new UDP handle. The actual socket is created lazily. + +### uv.udp_open(udp, fd) + +> (method form `udp:open(fd)`) + +Opens an existing file descriptor or Windows SOCKET as a UDP handle. + +Unix only: The only requirement of the sock argument is that it follows the +datagram contract (works in unconnected mode, supports sendmsg()/recvmsg(), +etc). In other words, other datagram-type sockets like raw sockets or netlink +sockets can also be passed to this function. + +The file descriptor is set to non-blocking mode. + +Note: The passed file descriptor or SOCKET is not checked for its type, but +it’s required that it represents a valid datagram socket. + +### uv.udp_bind(udp, host, port) + +> (method form `udp:bind(host, port)`) + +Bind the UDP handle to an IP address and port. + +### uv.udp_getsockname(udp) + +> (method form `udp:getsockname()`) + +Get the local IP and port of the UDP handle. + +### uv.udp_set_membership(udp, multicast_addr, interface_addr, membership) + +> (method form `udp:set_membership(multicast_addr, interface_addr, membership)`) + +Set membership for a multicast address. + +`multicast_addr` is multicast address to set membership for. + +`interface_addr` is interface address. + +`membership` can be the string `"leave"` or `"join"`. + +### uv.udp_set_multicast_loop(udp, on) + +> (method form `udp:set_multicast_loop(on)`) + +Set IP multicast loop flag. Makes multicast packets loop back to local +sockets. + +`on` is a boolean. + +### uv.udp_set_multicast_ttl(udp, tty) + +> (method form `udp:set_multicast_ttl(tty)`) + +Set the multicast ttl. + +`ttl` is an integer 1 through 255. + +### uv.udp_set_multicast_interface(udp, interface_addr) + +> (method form `udp:set_multicast_interface(interface_addr)`) + +Set the multicast interface to send or receive data on. + +### uv.udp_set_broadcast(udp, on) + +Set broadcast on or off. + +> (method form `udp:set_broadcast(, on)`) + +### uv.udp_set_ttl(udp, ttl) + +> (method form `udp:set_ttl(ttl)`) + +Set the time to live. + +`ttl` is an integer 1 through 255. + +### uv.udp_send(udp, data, host, port, callback) + +> (method form `udp:send(data, host, port, callback)`) + +Send data over the UDP socket. If the socket has not previously been bound +with `uv_udp_bind()` it will be bound to `0.0.0.0` (the “all interfaces” IPv4 +address) and a random port number. + +### uv.udp_try_send(udp, data, host, port) + +> (method form `udp:try_send(data, host, port)`) + +Same as `uv_udp_send()`, but won’t queue a send request if it can’t be +completed immediately. + +### uv.udp_recv_start(udp, callback) + +> (method form `udp:recv_start(callback)`) + +Prepare for receiving data. If the socket has not previously been bound with +`uv_udp_bind()` it is bound to `0.0.0.0` (the “all interfaces” IPv4 address) +and a random port number. + +### uv.udp_recv_stop(udp) + +> (method form `udp:recv_stop()`) + +## `uv_fs_event_t` — FS Event handle + +[`uv_fs_event_t`]: #uv_fs_event_t--fs-event-handle + +**TODO**: port docs from [docs.libuv.org](http://docs.libuv.org/en/v1.x/fs_event.html) +using [functions](https://github.com/luvit/luv/blob/25278a3871962cab29763692fdc3b270a7e96fe9/src/luv.c#L174-L177) +and [methods](https://github.com/luvit/luv/blob/25278a3871962cab29763692fdc3b270a7e96fe9/src/luv.c#L265-L270) +from [fs_event.c](https://github.com/luvit/luv/blob/master/src/fs_event.c) + +## `uv_fs_poll_t` — FS Poll handle + +[`uv_fs_poll_t`]: #uv_fs_poll_t--fs-poll-handle + +**TODO**: port docs from [docs.libuv.org](http://docs.libuv.org/en/v1.x/fs_poll.html) +using [functions](https://github.com/luvit/luv/blob/25278a3871962cab29763692fdc3b270a7e96fe9/src/luv.c#L180-L183) +and [methods](https://github.com/luvit/luv/blob/25278a3871962cab29763692fdc3b270a7e96fe9/src/luv.c#L272-L277) +from [fs_poll.c](https://github.com/luvit/luv/blob/master/src/fs_poll.c) + +## Filesystem operations + +[Filesystem operations]:#filesystem-operations + +**TODO**: port docs from [docs.libuv.org](http://docs.libuv.org/en/v1.x/fs.html) +using [functions](https://github.com/luvit/luv/blob/25278a3871962cab29763692fdc3b270a7e96fe9/src/luv.c#L186-L213) +from [fs.c](https://github.com/luvit/luv/blob/master/src/fs.c) + +## DNS utility functions + +[DNS utility functions]: #dns-utility-functions + +**TODO**: port docs from [docs.libuv.org](http://docs.libuv.org/en/v1.x/dns.html) +using [functions](https://github.com/luvit/luv/blob/25278a3871962cab29763692fdc3b270a7e96fe9/src/luv.c#L216-L217) +from [dns.c](https://github.com/luvit/luv/blob/master/src/dns.c) + +## Miscellaneous utilities + +[Miscellaneous utilities]: #miscellaneous-utilities + +**TODO**: port docs from [docs.libuv.org](http://docs.libuv.org/en/v1.x/misc.html) +using [functions](https://github.com/luvit/luv/blob/25278a3871962cab29763692fdc3b270a7e96fe9/src/luv.c#L220-L235) +from [misc.c](https://github.com/luvit/luv/blob/master/src/misc.c) + +[luv]: https://github.com/luvit/luv +[luvit]: https://github.com/luvit/luvit +[libuv]: https://github.com/libuv/libuv diff --git a/3rdparty/luv/examples/cqueues-main.lua b/3rdparty/luv/examples/cqueues-main.lua new file mode 100644 index 00000000000..ff60ec2b1c9 --- /dev/null +++ b/3rdparty/luv/examples/cqueues-main.lua @@ -0,0 +1,31 @@ +--[[ +Demonstrates using luv with a cqueues mainloop +]] + +local cqueues = require "cqueues" +local uv = require "luv" + +local cq = cqueues.new() + +cq:wrap(function() + while cqueues.poll({ + pollfd = uv.backend_fd(); + timeout = uv.backend_timeout() / 1000; + events = "r"; + }) do + uv.run("nowait") + end +end) + +cq:wrap(function() + while true do + cqueues.sleep(1) + print("HELLO FROM CQUEUES") + end +end) + +uv.new_timer():start(1000, 1000, function() + print("HELLO FROM LUV") +end) + +assert(cq:loop()) diff --git a/3rdparty/luv/examples/cqueues-slave.lua b/3rdparty/luv/examples/cqueues-slave.lua new file mode 100644 index 00000000000..599e7c6ded7 --- /dev/null +++ b/3rdparty/luv/examples/cqueues-slave.lua @@ -0,0 +1,55 @@ +--[[ +Demonstrates using cqueues with a luv mainloop + +Starts a simple sleep+print loop using each library's native form. +They should print intertwined. +]] + +local cqueues = require "cqueues" +local uv = require "luv" + +local cq = cqueues.new() + +do + local timer = uv.new_timer() + local function reset_timer() + local timeout = cq:timeout() + if timeout then + -- libuv takes milliseconds as an integer, + -- while cqueues gives timeouts as a floating point number + -- use `math.ceil` as we'd rather wake up late than early + timer:set_repeat(math.ceil(timeout * 1000)) + timer:again() + else + -- stop timer for now; it may be restarted later. + timer:stop() + end + end + local function onready() + -- Step the cqueues loop once (sleeping for max 0 seconds) + assert(cq:step(0)) + reset_timer() + end + -- Need to call `start` on libuv timer now + -- to provide callback and so that `again` works + timer:start(0, 0, onready) + -- Ask libuv to watch the cqueue pollfd + uv.new_poll(cq:pollfd()):start(cq:events(), onready) +end + +-- Adds a new function to the scheduler `cq` +-- The functions is an infinite loop that sleeps for 1 second and prints +cq:wrap(function() + while true do + cqueues.sleep(1) + print("HELLO FROM CQUEUES") + end +end) + +-- Start a luv timer that fires every 1 second +uv.new_timer():start(1000, 1000, function() + print("HELLO FROM LUV") +end) + +-- Run luv mainloop +uv.run() diff --git a/3rdparty/luv/examples/echo-server-client.lua b/3rdparty/luv/examples/echo-server-client.lua new file mode 100644 index 00000000000..ea4e6d2132d --- /dev/null +++ b/3rdparty/luv/examples/echo-server-client.lua @@ -0,0 +1,68 @@ +local p = require('lib/utils').prettyPrint +local uv = require('luv') + +local function create_server(host, port, on_connection) + + local server = uv.new_tcp() + p(1, server) + uv.tcp_bind(server, host, port) + + uv.listen(server, 128, function(err) + assert(not err, err) + local client = uv.new_tcp() + uv.accept(server, client) + on_connection(client) + end) + + return server +end + +local server = create_server("0.0.0.0", 0, function (client) + p("new client", client, uv.tcp_getsockname(client), uv.tcp_getpeername(client)) + uv.read_start(client, function (err, chunk) + p("onread", {err=err,chunk=chunk}) + + -- Crash on errors + assert(not err, err) + + if chunk then + -- Echo anything heard + uv.write(client, chunk) + else + -- When the stream ends, close the socket + uv.close(client) + end + end) +end) + +local address = uv.tcp_getsockname(server) +p("server", server, address) + +local client = uv.new_tcp() +uv.tcp_connect(client, "127.0.0.1", address.port, function (err) + assert(not err, err) + + uv.read_start(client, function (err, chunk) + p("received at client", {err=err,chunk=chunk}) + assert(not err, err) + if chunk then + uv.shutdown(client) + p("client done shutting down") + else + uv.close(client) + uv.close(server) + end + end) + + p("writing from client") + uv.write(client, "Hello") + uv.write(client, "World") + +end) + +-- Start the main event loop +uv.run() +-- Close any stray handles when done +uv.walk(uv.close) +uv.run() +uv.loop_close() diff --git a/3rdparty/luv/examples/killing-children.lua b/3rdparty/luv/examples/killing-children.lua new file mode 100644 index 00000000000..6aab693d0c1 --- /dev/null +++ b/3rdparty/luv/examples/killing-children.lua @@ -0,0 +1,24 @@ +local p = require('lib/utils').prettyPrint +local uv = require('luv') + + + +local child, pid +child, pid = uv.spawn("sleep", { + args = {"100"} +}, function (code, signal) + p("EXIT", {code=code,signal=signal}) + uv.close(child) +end) + +p{child=child, pid=pid} + +-- uv.kill(pid, "SIGTERM") +uv.process_kill(child, "SIGTERM") + +repeat + print("\ntick.") +until uv.run('once') == 0 + +print("done") + diff --git a/3rdparty/luv/examples/lots-o-dns.lua b/3rdparty/luv/examples/lots-o-dns.lua new file mode 100644 index 00000000000..59a1b0fe534 --- /dev/null +++ b/3rdparty/luv/examples/lots-o-dns.lua @@ -0,0 +1,49 @@ +local p = require('lib/utils').prettyPrint +local uv = require('luv') + +uv.getaddrinfo(nil, 80, nil, p) + +local domains = { + "facebook.com", + "google.com", + "mail.google.com", + "maps.google.com", + "plus.google.com", + "play.google.com", + "apple.com", + "hp.com", + "yahoo.com", + "mozilla.com", + "developer.mozilla.com", + "luvit.io", + "creationix.com", + "howtonode.org", + "github.com", + "gist.github.com" +} + +local i = 1 +local function next() + uv.getaddrinfo(domains[i], nil, { + v4mapped = true, + all = true, + addrconfig = true, + canonname = true, + numericserv = true, + socktype = "STREAM" + }, function (err, data) + assert(not err, err) + p(data) + i = i + 1 + if i <= #domains then + next() + end + end) +end +next(); + +repeat + print("\nTick..") +until uv.run('once') == 0 + +print("done") diff --git a/3rdparty/luv/examples/repl.lua b/3rdparty/luv/examples/repl.lua new file mode 100644 index 00000000000..92be0f17d87 --- /dev/null +++ b/3rdparty/luv/examples/repl.lua @@ -0,0 +1,89 @@ +local uv = require('luv') +local utils = require('lib/utils') + +if uv.guess_handle(0) ~= "tty" or + uv.guess_handle(1) ~= "tty" then + error "stdio must be a tty" +end +local stdin = uv.new_tty(0, true) +local stdout = require('lib/utils').stdout + +local debug = require('debug') +local c = utils.color + +local function gatherResults(success, ...) + local n = select('#', ...) + return success, { n = n, ... } +end + +local function printResults(results) + for i = 1, results.n do + results[i] = utils.dump(results[i]) + end + print(table.concat(results, '\t')) +end + +local buffer = '' + +local function evaluateLine(line) + if line == "<3\n" then + print("I " .. c("Bred") .. "♥" .. c() .. " you too!") + return '>' + end + local chunk = buffer .. line + local f, err = loadstring('return ' .. chunk, 'REPL') -- first we prefix return + + if not f then + f, err = loadstring(chunk, 'REPL') -- try again without return + end + + if f then + buffer = '' + local success, results = gatherResults(xpcall(f, debug.traceback)) + + if success then + -- successful call + if results.n > 0 then + printResults(results) + end + else + -- error + print(results[1]) + end + else + + if err:match "''$" then + -- Lua expects some more input; stow it away for next time + buffer = chunk .. '\n' + return '>>' + else + print(err) + buffer = '' + end + end + + return '>' +end + +local function displayPrompt(prompt) + uv.write(stdout, prompt .. ' ') +end + +local function onread(err, line) + if err then error(err) end + if line then + local prompt = evaluateLine(line) + displayPrompt(prompt) + else + uv.close(stdin) + end +end + +coroutine.wrap(function() + displayPrompt '>' + uv.read_start(stdin, onread) +end)() + +uv.run() + +print("") diff --git a/3rdparty/luv/examples/talking-to-children.lua b/3rdparty/luv/examples/talking-to-children.lua new file mode 100644 index 00000000000..10a53ef8c88 --- /dev/null +++ b/3rdparty/luv/examples/talking-to-children.lua @@ -0,0 +1,47 @@ +local p = require('lib/utils').prettyPrint +local uv = require('luv') + +local stdout = uv.new_pipe(false) +local stderr = uv.new_pipe( false) +local stdin = uv.new_pipe(false) + +local handle, pid + +local function onexit(code, signal) + p("exit", {code=code,signal=signal}) +end + +local function onclose() + p("close") +end + +local function onread(err, chunk) + assert(not err, err) + if (chunk) then + p("data", {data=chunk}) + else + p("end") + end +end + +local function onshutdown() + uv.close(handle, onclose) +end + +handle, pid = uv.spawn("cat", { + stdio = {stdin, stdout, stderr} +}, onexit) + +p{ + handle=handle, + pid=pid +} + +uv.read_start(stdout, onread) +uv.read_start(stderr, onread) +uv.write(stdin, "Hello World") +uv.shutdown(stdin, onshutdown) + +uv.run() +uv.walk(uv.close) +uv.run() diff --git a/3rdparty/luv/examples/tcp-cluster.lua b/3rdparty/luv/examples/tcp-cluster.lua new file mode 100644 index 00000000000..e69ceffc62d --- /dev/null +++ b/3rdparty/luv/examples/tcp-cluster.lua @@ -0,0 +1,84 @@ + +-- This function will be run in a child process +local child_code = string.dump(function () + local p = require('lib/utils').prettyPrint + local uv = require('luv') + + -- The parent is going to pass us the server handle over a pipe + -- This will be our local file descriptor at PIPE_FD + local pipe = uv.new_pipe(true) + local pipe_fd = tonumber(os.getenv("PIPE_FD")) + assert(uv.pipe_open(pipe, pipe_fd)) + + -- Configure the server handle + local server = uv.new_tcp() + local function onconnection() + local client = uv.new_tcp() + uv.accept(server, client) + p("New TCP", client, "on", server) + p{client=client} + uv.write(client, "BYE!\n"); + uv.shutdown(client, function () + uv.close(client) + uv.close(server) + end) + end + + -- Read the server handle from the parent + local function onread(err, data) + p("onread", {err=err,data=data}) + assert(not err, err) + if uv.pipe_pending_count(pipe) > 0 then + local pending_type = uv.pipe_pending_type(pipe) + p("pending_type", pending_type) + assert(pending_type == "tcp") + assert(uv.accept(pipe, server)) + assert(uv.listen(server, 128, onconnection)) + p("Received server handle from parent process", server) + elseif data then + p("ondata", data) + else + p("onend", data) + end + end + uv.read_start(pipe, onread) + + -- Start the event loop! + uv.run() +end) + +local p = require('lib/utils').prettyPrint +local uv = require('luv') + +local exepath = assert(uv.exepath()) +local cpu_count = # assert(uv.cpu_info()) + +local server = uv.new_tcp() +assert(uv.tcp_bind(server, "::1", 1337)) +print("Master process bound to TCP port 1337 on ::1") + + +local function onexit(status, signal) + p("Child exited", {status=status,signal=signal}) +end + +local function spawnChild() + local pipe = uv.new_pipe(true) + local input = uv.new_pipe(false) + local _, pid = assert(uv.spawn(exepath, { + stdio = {input,1,2,pipe}, + env= {"PIPE_FD=3"} + }, onexit)) + uv.write(input, child_code) + uv.shutdown(input) + p("Spawned child", pid, "and sending handle", server) + assert(uv.write2(pipe, "123", server)) + assert(uv.shutdown(pipe)) +end + +-- Spawn a child process for each CPU core +for _ = 1, cpu_count do + spawnChild() +end + +uv.run() diff --git a/3rdparty/luv/examples/timers.lua b/3rdparty/luv/examples/timers.lua new file mode 100644 index 00000000000..049235e6fb1 --- /dev/null +++ b/3rdparty/luv/examples/timers.lua @@ -0,0 +1,68 @@ +local p = require('lib/utils').prettyPrint +local uv = require('luv') + +local function set_timeout(timeout, callback) + local timer = uv.new_timer() + local function ontimeout() + p("ontimeout", timer) + uv.timer_stop(timer) + uv.close(timer) + callback(timer) + end + uv.timer_start(timer, timeout, 0, ontimeout) + return timer +end + +local function clear_timeout(timer) + uv.timer_stop(timer) + uv.close(timer) +end + +local function set_interval(interval, callback) + local timer = uv.new_timer() + local function ontimeout() + p("interval", timer) + callback(timer) + end + uv.timer_start(timer, interval, interval, ontimeout) + return timer +end + +local clear_interval = clear_timeout + +local i = set_interval(300, function() + print("interval...") +end) + +set_timeout(1000, function() + clear_interval(i) +end) + + +local handle = uv.new_timer() +local delay = 1024 +local function ontimeout() + p("tick", delay) + delay = delay / 2 + if delay >= 1 then + uv.timer_set_repeat(handle, delay) + uv.timer_again(handle) + else + uv.timer_stop(handle) + uv.close(handle) + p("done") + end +end +uv.timer_start(handle, delay, 0, ontimeout) + + +repeat + print("\ntick.") +until uv.run('once') == 0 + +print("done") + +uv.walk(uv.close) +uv.run() +uv.loop_close() + diff --git a/3rdparty/luv/examples/uvbook/helloworld.lua b/3rdparty/luv/examples/uvbook/helloworld.lua new file mode 100644 index 00000000000..2c77d0c51bc --- /dev/null +++ b/3rdparty/luv/examples/uvbook/helloworld.lua @@ -0,0 +1,5 @@ +local uv = require('luv') + +print('Now quitting.') +uv.run('default') +uv.loop_close() diff --git a/3rdparty/luv/examples/uvbook/idle-basic.lua b/3rdparty/luv/examples/uvbook/idle-basic.lua new file mode 100644 index 00000000000..dc2a47b3c30 --- /dev/null +++ b/3rdparty/luv/examples/uvbook/idle-basic.lua @@ -0,0 +1,14 @@ +local uv = require('luv') + +local counter = 0 +local idle = uv.new_idle() +idle:start(function() + counter = counter + 1 + if counter >= 10e6 then + idle:stop() + end +end) + +print("Idling...") +uv.run('default') +uv.loop_close() \ No newline at end of file diff --git a/3rdparty/luv/examples/uvbook/onchange.lua b/3rdparty/luv/examples/uvbook/onchange.lua new file mode 100644 index 00000000000..07b3f9b1d78 --- /dev/null +++ b/3rdparty/luv/examples/uvbook/onchange.lua @@ -0,0 +1,30 @@ +local uv = require('luv') + +if #arg==0 then + print(string.format("Usage: %s [file2 ...]",arg[0])); + return +end + +for i=1,#arg do + local fse = uv.new_fs_event() + assert(uv.fs_event_start(fse,arg[i],{ + --"watch_entry"=true,"stat"=true, + recursive=true + },function (err,fname,status) + if(err) then + print("Error "..err) + else + print(string.format('Change detected in %s', + uv.fs_event_getpath(fse))) + for k,v in pairs(status) do + print(k,v) + end + print('file changed:'..(fname and fname or '')) + end + end)) + +end + +uv.run('default') +uv.loop_close() + diff --git a/3rdparty/luv/examples/uvbook/queue-work.lua b/3rdparty/luv/examples/uvbook/queue-work.lua new file mode 100644 index 00000000000..cf52abfb216 --- /dev/null +++ b/3rdparty/luv/examples/uvbook/queue-work.lua @@ -0,0 +1,19 @@ +local uv = require('luv') + +local ctx = uv.new_work( + function(n) --work,in threadpool + local uv = require('luv') + local t = uv.thread_self() + uv.sleep(100) + return n*n,n + end, + function(r,n) print(string.format('%d => %d',n,r)) end --after work, in loop thread +) +uv.queue_work(ctx,2) +uv.queue_work(ctx,4) +uv.queue_work(ctx,6) +uv.queue_work(ctx,8) +uv.queue_work(ctx,10) + +uv.run('default') +uv.loop_close() diff --git a/3rdparty/luv/examples/uvbook/tcp-echo-client.lua b/3rdparty/luv/examples/uvbook/tcp-echo-client.lua new file mode 100644 index 00000000000..40dd22a311f --- /dev/null +++ b/3rdparty/luv/examples/uvbook/tcp-echo-client.lua @@ -0,0 +1,21 @@ +local uv = require('luv') + + +local client = uv.new_tcp() +uv.tcp_connect(client, "127.0.0.1", 1337, function (err) + assert(not err, err) + uv.read_start(client, function (err, chunk) + assert(not err, err) + if chunk then + print(chunk) + else + uv.close(client) + end + end) + + uv.write(client, "Hello") + uv.write(client, "World") +end) +print('CTRL-C to break') +uv.run('default') +uv.loop_close() diff --git a/3rdparty/luv/examples/uvbook/tcp-echo-server.lua b/3rdparty/luv/examples/uvbook/tcp-echo-server.lua new file mode 100644 index 00000000000..269c49114cf --- /dev/null +++ b/3rdparty/luv/examples/uvbook/tcp-echo-server.lua @@ -0,0 +1,22 @@ +local uv = require('luv') + + +local server = uv.new_tcp() +server:bind("127.0.0.1", 1337) +server:listen(128, function (err) + assert(not err, err) + local client = uv.new_tcp() + server:accept(client) + client:read_start(function (err, chunk) + assert(not err, err) + if chunk then + client:write(chunk) + else + client:shutdown() + client:close() + end + end) +end) + +uv.run('default') +uv.loop_close() diff --git a/3rdparty/luv/examples/uvbook/thread-create.lua b/3rdparty/luv/examples/uvbook/thread-create.lua new file mode 100644 index 00000000000..4b42587adbf --- /dev/null +++ b/3rdparty/luv/examples/uvbook/thread-create.lua @@ -0,0 +1,38 @@ +local uv = require('luv') + +local step = 10 + +local hare_id = uv.new_thread(function(step,...) + local ffi = require'ffi' + local uv = require('luv') + local sleep + if ffi.os=='Windows' then + ffi.cdef "void Sleep(int ms);" + sleep = ffi.C.Sleep + else + ffi.cdef "unsigned int usleep(unsigned int seconds);" + sleep = ffi.C.usleep + end + while (step>0) do + step = step - 1 + uv.sleep(math.random(1000)) + print("Hare ran another step") + end + print("Hare done running!") +end, step,true,'abcd','false') + +local tortoise_id = uv.new_thread(function(step,...) + local uv = require('luv') + while (step>0) do + step = step - 1 + uv.sleep(math.random(100)) + print("Tortoise ran another step") + end + print("Tortoise done running!") +end,step,'abcd','false') + +print(hare_id==hare_id,uv.thread_equal(hare_id,hare_id)) +print(tortoise_id==hare_id,uv.thread_equal(tortoise_id,hare_id)) + +uv.thread_join(hare_id) +uv.thread_join(tortoise_id) diff --git a/3rdparty/luv/examples/uvbook/uvcat.lua b/3rdparty/luv/examples/uvbook/uvcat.lua new file mode 100644 index 00000000000..99fdd68000b --- /dev/null +++ b/3rdparty/luv/examples/uvbook/uvcat.lua @@ -0,0 +1,37 @@ +local uv = require('luv') + + +local fname = arg[1] and arg[1] or arg[0] + +uv.fs_open(fname, 'r', tonumber('644', 8), function(err,fd) + if err then + print("error opening file:"..err) + else + local stat = uv.fs_fstat(fd) + local off = 0 + local block = 10 + + local function on_read(err,chunk) + if(err) then + print("Read error: "..err); + elseif #chunk==0 then + uv.fs_close(fd) + else + off = block + off + uv.fs_write(1,chunk,-1,function(err,chunk) + if err then + print("Write error: "..err) + else + uv.fs_read(fd, block, off, on_read) + end + end) + end + end + uv.fs_read(fd, block, off, on_read) + end +end) + + + +uv.run('default') +uv.loop_close() diff --git a/3rdparty/luv/examples/uvbook/uvtee.lua b/3rdparty/luv/examples/uvbook/uvtee.lua new file mode 100644 index 00000000000..c91b066ae21 --- /dev/null +++ b/3rdparty/luv/examples/uvbook/uvtee.lua @@ -0,0 +1,35 @@ +local uv = require('luv') + +if not arg[1] then + print(string.format("please run %s filename",arg[0])) + return +end + + +local stdin = uv.new_tty(0, true) +local stdout = uv.new_tty(1, true) +--local stdin_pipe = uv.new_pipe(false) +--uv.pipe_open(stdin_pipe,0) + +local fname = arg[1] + +uv.fs_open(fname, 'w+', tonumber('644', 8), function(err,fd) + if err then + print("error opening file:"..err) + else + local fpipe = uv.new_pipe(false) + uv.pipe_open(fpipe, fd) + + uv.read_start(stdin, function(err,chunk) + if err then + print('Read error: '..err) + else + uv.write(stdout,chunk) + uv.write(fpipe,chunk) + end + end); + end +end) + +uv.run('default') +uv.loop_close() diff --git a/3rdparty/luv/lib/tap.lua b/3rdparty/luv/lib/tap.lua new file mode 100644 index 00000000000..d1cfb59c249 --- /dev/null +++ b/3rdparty/luv/lib/tap.lua @@ -0,0 +1,165 @@ +local uv = require('luv') +local dump = require('lib/utils').dump +local stdout = require('lib/utils').stdout + +local function protect(...) + local n = select('#', ...) + local arguments = {...} + for i = 1, n do + arguments[i] = tostring(arguments[i]) + end + + local text = table.concat(arguments, "\t") + text = " " .. string.gsub(text, "\n", "\n ") + print(text) +end + +local function pprotect(...) + local n = select('#', ...) + local arguments = { ... } + + for i = 1, n do + arguments[i] = dump(arguments[i]) + end + + protect(table.concat(arguments, "\t")) +end + + +local tests = {}; + +local function run() + local passed = 0 + + if #tests < 1 then + error("No tests specified!") + end + + print("1.." .. #tests) + for i = 1, #tests do + local test = tests[i] + local cwd = uv.cwd() + local pass, err = xpcall(function () + local expected = 0 + local function expect(fn, count) + expected = expected + (count or 1) + return function (...) + expected = expected - 1 + local ret = fn(...) + collectgarbage() + return ret + end + end + test.fn(protect, pprotect, expect, uv) + collectgarbage() + uv.run() + collectgarbage() + if expected > 0 then + error("Missing " .. expected .. " expected call" .. (expected == 1 and "" or "s")) + elseif expected < 0 then + error("Found " .. -expected .. " unexpected call" .. (expected == -1 and "" or "s")) + end + collectgarbage() + local unclosed = 0 + uv.walk(function (handle) + if handle == stdout then return end + unclosed = unclosed + 1 + print("UNCLOSED", handle) + end) + if unclosed > 0 then + error(unclosed .. " unclosed handle" .. (unclosed == 1 and "" or "s")) + end + if uv.cwd() ~= cwd then + error("Test moved cwd from " .. cwd .. " to " .. uv.cwd()) + end + collectgarbage() + end, debug.traceback) + + -- Flush out any more opened handles + uv.stop() + uv.walk(function (handle) + if handle == stdout then return end + if not uv.is_closing(handle) then uv.close(handle) end + end) + uv.run() + uv.chdir(cwd) + + if pass then + print("ok " .. i .. " " .. test.name) + passed = passed + 1 + else + protect(err) + print("not ok " .. i .. " " .. test.name) + end + end + + local failed = #tests - passed + if failed == 0 then + print("# All tests passed") + else + print("#" .. failed .. " failed test" .. (failed == 1 and "" or "s")) + end + + -- Close all then handles, including stdout + uv.walk(uv.close) + uv.run() + + os.exit(-failed) +end + +local single = true +local prefix + +local function tap(suite) + + if type(suite) == "function" then + -- Pass in suite directly for single mode + suite(function (name, fn) + if prefix then + name = prefix .. ' - ' .. name + end + tests[#tests + 1] = { + name = name, + fn = fn + } + end) + prefix = nil + elseif type(suite) == "string" then + prefix = suite + single = false + else + -- Or pass in false to collect several runs of tests + -- And then pass in true in a later call to flush tests queue. + single = suite + end + + if single then run() end + +end + + +--[[ +-- Sample Usage + +local passed, failed, total = tap(function (test) + + test("add 1 to 2", function(print) + print("Adding 1 to 2") + assert(1 + 2 == 3) + end) + + test("close handle", function (print, p, expect, uv) + local handle = uv.new_timer() + uv.close(handle, expect(function (self) + assert(self == handle) + end)) + end) + + test("simulate failure", function () + error("Oopsie!") + end) + +end) +]] + +return tap diff --git a/3rdparty/luv/lib/utils.lua b/3rdparty/luv/lib/utils.lua new file mode 100644 index 00000000000..777879ec28c --- /dev/null +++ b/3rdparty/luv/lib/utils.lua @@ -0,0 +1,165 @@ + +local uv = require('luv') +local utils = {} +local usecolors + +if uv.guess_handle(1) == "tty" then + utils.stdout = uv.new_tty(1, false) + usecolors = true +else + utils.stdout = uv.new_pipe(false) + uv.pipe_open(utils.stdout, 1) + usecolors = false +end + +local colors = { + black = "0;30", + red = "0;31", + green = "0;32", + yellow = "0;33", + blue = "0;34", + magenta = "0;35", + cyan = "0;36", + white = "0;37", + B = "1;", + Bblack = "1;30", + Bred = "1;31", + Bgreen = "1;32", + Byellow = "1;33", + Bblue = "1;34", + Bmagenta = "1;35", + Bcyan = "1;36", + Bwhite = "1;37" +} + +function utils.color(color_name) + if usecolors then + return "\27[" .. (colors[color_name] or "0") .. "m" + else + return "" + end +end + +function utils.colorize(color_name, string, reset_name) + return utils.color(color_name) .. tostring(string) .. utils.color(reset_name) +end + +local backslash, null, newline, carriage, tab, quote, quote2, obracket, cbracket + +function utils.loadColors(n) + if n ~= nil then usecolors = n end + backslash = utils.colorize("Bgreen", "\\\\", "green") + null = utils.colorize("Bgreen", "\\0", "green") + newline = utils.colorize("Bgreen", "\\n", "green") + carriage = utils.colorize("Bgreen", "\\r", "green") + tab = utils.colorize("Bgreen", "\\t", "green") + quote = utils.colorize("Bgreen", '"', "green") + quote2 = utils.colorize("Bgreen", '"') + obracket = utils.colorize("B", '[') + cbracket = utils.colorize("B", ']') +end + +utils.loadColors() + +function utils.dump(o, depth) + local t = type(o) + if t == 'string' then + return quote .. o:gsub("\\", backslash):gsub("%z", null):gsub("\n", newline):gsub("\r", carriage):gsub("\t", tab) .. quote2 + end + if t == 'nil' then + return utils.colorize("Bblack", "nil") + end + if t == 'boolean' then + return utils.colorize("yellow", tostring(o)) + end + if t == 'number' then + return utils.colorize("blue", tostring(o)) + end + if t == 'userdata' then + return utils.colorize("magenta", tostring(o)) + end + if t == 'thread' then + return utils.colorize("Bred", tostring(o)) + end + if t == 'function' then + return utils.colorize("cyan", tostring(o)) + end + if t == 'cdata' then + return utils.colorize("Bmagenta", tostring(o)) + end + if t == 'table' then + if type(depth) == 'nil' then + depth = 0 + end + if depth > 1 then + return utils.colorize("yellow", tostring(o)) + end + local indent = (" "):rep(depth) + + -- Check to see if this is an array + local is_array = true + local i = 1 + for k,v in pairs(o) do + if not (k == i) then + is_array = false + end + i = i + 1 + end + + local first = true + local lines = {} + i = 1 + local estimated = 0 + for k,v in (is_array and ipairs or pairs)(o) do + local s + if is_array then + s = "" + else + if type(k) == "string" and k:find("^[%a_][%a%d_]*$") then + s = k .. ' = ' + else + s = '[' .. utils.dump(k, 100) .. '] = ' + end + end + s = s .. utils.dump(v, depth + 1) + lines[i] = s + estimated = estimated + #s + i = i + 1 + end + if estimated > 200 then + return "{\n " .. indent .. table.concat(lines, ",\n " .. indent) .. "\n" .. indent .. "}" + else + return "{ " .. table.concat(lines, ", ") .. " }" + end + end + -- This doesn't happen right? + return tostring(o) +end + + + +-- Print replacement that goes through libuv. This is useful on windows +-- to use libuv's code to translate ansi escape codes to windows API calls. +function print(...) + local n = select('#', ...) + local arguments = {...} + for i = 1, n do + arguments[i] = tostring(arguments[i]) + end + uv.write(utils.stdout, table.concat(arguments, "\t") .. "\n") +end + +-- A nice global data dumper +function utils.prettyPrint(...) + local n = select('#', ...) + local arguments = { ... } + + for i = 1, n do + arguments[i] = utils.dump(arguments[i]) + end + + print(table.concat(arguments, "\t")) +end + +return utils + diff --git a/3rdparty/luv/luv-1.8.0-4.rockspec b/3rdparty/luv/luv-1.8.0-4.rockspec new file mode 100644 index 00000000000..23855203e0d --- /dev/null +++ b/3rdparty/luv/luv-1.8.0-4.rockspec @@ -0,0 +1,34 @@ +package = "luv" +version = "1.8.0-4" +source = { + url = 'https://github.com/luvit/luv/releases/download/1.8.0-4/luv-1.8.0-4.tar.gz', +} + +description = { + summary = "Bare libuv bindings for lua", + detailed = [[ +libuv bindings for luajit and lua 5.1/5.2/5.3. + +This library makes libuv available to lua scripts. It was made for the luvit +project but should usable from nearly any lua project. + ]], + homepage = "https://github.com/luvit/luv", + license = "Apache 2.0" +} + +dependencies = { + "lua >= 5.1" +} + +build = { + type = 'cmake', + variables = { + CMAKE_C_FLAGS="$(CFLAGS)", + CMAKE_MODULE_LINKER_FLAGS="$(LIBFLAG)", + LUA_LIBDIR="$(LUA_LIBDIR)", + LUA_INCDIR="$(LUA_INCDIR)", + LUA="$(LUA)", + LIBDIR="$(LIBDIR)", + LUADIR="$(LUADIR)", + }, +} diff --git a/3rdparty/luv/msvcbuild.bat b/3rdparty/luv/msvcbuild.bat new file mode 100644 index 00000000000..7a5c7bd4c31 --- /dev/null +++ b/3rdparty/luv/msvcbuild.bat @@ -0,0 +1,13 @@ +@echo off + +set VS=12 +if "%configuration%"=="2015" (set VS=14) +if "%configuration%"=="2013" (set VS=12) + +if not defined platform set platform=x64 +if "%platform%" EQU "x64" (set VS=%VS% Win64) + +cmake -H. -Bbuild -G"Visual Studio %VS%" +cmake --build build --config Release +copy build\Release\luv.dll . +copy build\Release\luajit.exe . diff --git a/3rdparty/luv/src/async.c b/3rdparty/luv/src/async.c new file mode 100644 index 00000000000..87ae0cc0460 --- /dev/null +++ b/3rdparty/luv/src/async.c @@ -0,0 +1,63 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" +#include "lthreadpool.h" + +static uv_async_t* luv_check_async(lua_State* L, int index) { + uv_async_t* handle = luv_checkudata(L, index, "uv_async"); + luaL_argcheck(L, handle->type == UV_ASYNC && handle->data, index, "Expected uv_async_t"); + return handle; +} + +static void luv_async_cb(uv_async_t* handle) { + lua_State* L = luv_state(handle->loop); + luv_handle_t* data = handle->data; + int n = luv_thread_arg_push(L, data->extra); + luv_call_callback(L, data, LUV_ASYNC, n); + luv_thread_arg_clear(data->extra); +} + +static int luv_new_async(lua_State* L) { + uv_async_t* handle; + luv_handle_t* data; + int ret; + luaL_checktype(L, 1, LUA_TFUNCTION); + handle = luv_newuserdata(L, sizeof(*handle)); + ret = uv_async_init(luv_loop(L), handle, luv_async_cb); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + data = luv_setup_handle(L); + data->extra = malloc(sizeof(luv_thread_arg_t)); + memset(data->extra, 0, sizeof(luv_thread_arg_t)); + handle->data = data; + luv_check_callback(L, handle->data, LUV_ASYNC, 1); + return 1; +} + +static int luv_async_send(lua_State* L) { + int ret; + uv_async_t* handle = luv_check_async(L, 1); + luv_thread_arg_t* arg = ((luv_handle_t*) handle->data)->extra; + + luv_thread_arg_set(L, arg, 2, lua_gettop(L), 0); + ret = uv_async_send(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} diff --git a/3rdparty/luv/src/check.c b/3rdparty/luv/src/check.c new file mode 100644 index 00000000000..dbd330ae255 --- /dev/null +++ b/3rdparty/luv/src/check.c @@ -0,0 +1,59 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static uv_check_t* luv_check_check(lua_State* L, int index) { + uv_check_t* handle = luv_checkudata(L, index, "uv_check"); + luaL_argcheck(L, handle->type == UV_CHECK && handle->data, index, "Expected uv_check_t"); + return handle; +} + +static int luv_new_check(lua_State* L) { + uv_check_t* handle = luv_newuserdata(L, sizeof(*handle)); + int ret = uv_check_init(luv_loop(L), handle); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static void luv_check_cb(uv_check_t* handle) { + lua_State* L = luv_state(handle->loop); + luv_handle_t* data = handle->data; + luv_call_callback(L, data, LUV_CHECK, 0); +} + +static int luv_check_start(lua_State* L) { + uv_check_t* handle = luv_check_check(L, 1); + int ret; + luv_check_callback(L, handle->data, LUV_CHECK, 2); + ret = uv_check_start(handle, luv_check_cb); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_check_stop(lua_State* L) { + uv_check_t* handle = luv_check_check(L, 1); + int ret = uv_check_stop(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + diff --git a/3rdparty/luv/src/constants.c b/3rdparty/luv/src/constants.c new file mode 100644 index 00000000000..3417028c438 --- /dev/null +++ b/3rdparty/luv/src/constants.c @@ -0,0 +1,649 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "luv.h" + +static int luv_constants(lua_State* L) { + lua_newtable(L); + + // File open bitwise flags O_* +#ifdef O_RDONLY + lua_pushinteger(L, O_RDONLY); + lua_setfield(L, -2, "O_RDONLY"); +#endif +#ifdef O_WRONLY + lua_pushinteger(L, O_WRONLY); + lua_setfield(L, -2, "O_WRONLY"); +#endif +#ifdef O_RDWR + lua_pushinteger(L, O_RDWR); + lua_setfield(L, -2, "O_RDWR"); +#endif +#ifdef O_APPEND + lua_pushinteger(L, O_APPEND); + lua_setfield(L, -2, "O_APPEND"); +#endif +#ifdef O_CREAT + lua_pushinteger(L, O_CREAT); + lua_setfield(L, -2, "O_CREAT"); +#endif +#ifdef O_DSYNC + lua_pushinteger(L, O_DSYNC); + lua_setfield(L, -2, "O_DSYNC"); +#endif +#ifdef O_EXCL + lua_pushinteger(L, O_EXCL); + lua_setfield(L, -2, "O_EXCL"); +#endif +#ifdef O_EXLOCK + lua_pushinteger(L, O_EXLOCK); + lua_setfield(L, -2, "O_EXLOCK"); +#endif +#ifdef O_NOCTTY + lua_pushinteger(L, O_NOCTTY); + lua_setfield(L, -2, "O_NOCTTY"); +#endif +#ifdef O_NONBLOCK + lua_pushinteger(L, O_NONBLOCK); + lua_setfield(L, -2, "O_NONBLOCK"); +#endif +#ifdef O_RSYNC + lua_pushinteger(L, O_RSYNC); + lua_setfield(L, -2, "O_RSYNC"); +#endif +#ifdef O_SYNC + lua_pushinteger(L, O_SYNC); + lua_setfield(L, -2, "O_SYNC"); +#endif +#ifdef O_TRUNC + lua_pushinteger(L, O_TRUNC); + lua_setfield(L, -2, "O_TRUNC"); +#endif + + // Socket types SOCK_* +#ifdef SOCK_STREAM + lua_pushinteger(L, SOCK_STREAM); + lua_setfield(L, -2, "SOCK_STREAM"); +#endif +#ifdef SOCK_DGRAM + lua_pushinteger(L, SOCK_DGRAM); + lua_setfield(L, -2, "SOCK_DGRAM"); +#endif +#ifdef SOCK_SEQPACKET + lua_pushinteger(L, SOCK_SEQPACKET); + lua_setfield(L, -2, "SOCK_SEQPACKET"); +#endif +#ifdef SOCK_RAW + lua_pushinteger(L, SOCK_RAW); + lua_setfield(L, -2, "SOCK_RAW"); +#endif +#ifdef SOCK_RDM + lua_pushinteger(L, SOCK_RDM); + lua_setfield(L, -2, "SOCK_RDM"); +#endif + + // AF_* +#ifdef AF_UNIX + lua_pushinteger(L, AF_UNIX); + lua_setfield(L, -2, "AF_UNIX"); +#endif +#ifdef AF_INET + lua_pushinteger(L, AF_INET); + lua_setfield(L, -2, "AF_INET"); +#endif +#ifdef AF_INET6 + lua_pushinteger(L, AF_INET6); + lua_setfield(L, -2, "AF_INET6"); +#endif +#ifdef AF_IPX + lua_pushinteger(L, AF_IPX); + lua_setfield(L, -2, "AF_IPX"); +#endif +#ifdef AF_NETLINK + lua_pushinteger(L, AF_NETLINK); + lua_setfield(L, -2, "AF_NETLINK"); +#endif +#ifdef AF_X25 + lua_pushinteger(L, AF_X25); + lua_setfield(L, -2, "AF_X25"); +#endif +#ifdef AF_AX25 + lua_pushinteger(L, AF_AX25); + lua_setfield(L, -2, "AF_AX25"); +#endif +#ifdef AF_ATMPVC + lua_pushinteger(L, AF_ATMPVC); + lua_setfield(L, -2, "AF_ATMPVC"); +#endif +#ifdef AF_APPLETALK + lua_pushinteger(L, AF_APPLETALK); + lua_setfield(L, -2, "AF_APPLETALK"); +#endif +#ifdef AF_PACKET + lua_pushinteger(L, AF_PACKET); + lua_setfield(L, -2, "AF_PACKET"); +#endif + + // AI_* +#ifdef AI_ADDRCONFIG + lua_pushinteger(L, AI_ADDRCONFIG); + lua_setfield(L, -2, "AI_ADDRCONFIG"); +#endif +#ifdef AI_V4MAPPED + lua_pushinteger(L, AI_V4MAPPED); + lua_setfield(L, -2, "AI_V4MAPPED"); +#endif +#ifdef AI_ALL + lua_pushinteger(L, AI_ALL); + lua_setfield(L, -2, "AI_ALL"); +#endif +#ifdef AI_NUMERICHOST + lua_pushinteger(L, AI_NUMERICHOST); + lua_setfield(L, -2, "AI_NUMERICHOST"); +#endif +#ifdef AI_PASSIVE + lua_pushinteger(L, AI_PASSIVE); + lua_setfield(L, -2, "AI_PASSIVE"); +#endif +#ifdef AI_NUMERICSERV + lua_pushinteger(L, AI_NUMERICSERV); + lua_setfield(L, -2, "AI_NUMERICSERV"); +#endif + + // Signals +#ifdef SIGHUP + lua_pushinteger(L, SIGHUP); + lua_setfield(L, -2, "SIGHUP"); +#endif +#ifdef SIGINT + lua_pushinteger(L, SIGINT); + lua_setfield(L, -2, "SIGINT"); +#endif +#ifdef SIGQUIT + lua_pushinteger(L, SIGQUIT); + lua_setfield(L, -2, "SIGQUIT"); +#endif +#ifdef SIGILL + lua_pushinteger(L, SIGILL); + lua_setfield(L, -2, "SIGILL"); +#endif +#ifdef SIGTRAP + lua_pushinteger(L, SIGTRAP); + lua_setfield(L, -2, "SIGTRAP"); +#endif +#ifdef SIGABRT + lua_pushinteger(L, SIGABRT); + lua_setfield(L, -2, "SIGABRT"); +#endif +#ifdef SIGIOT + lua_pushinteger(L, SIGIOT); + lua_setfield(L, -2, "SIGIOT"); +#endif +#ifdef SIGBUS + lua_pushinteger(L, SIGBUS); + lua_setfield(L, -2, "SIGBUS"); +#endif +#ifdef SIGFPE + lua_pushinteger(L, SIGFPE); + lua_setfield(L, -2, "SIGFPE"); +#endif +#ifdef SIGKILL + lua_pushinteger(L, SIGKILL); + lua_setfield(L, -2, "SIGKILL"); +#endif +#ifdef SIGUSR1 + lua_pushinteger(L, SIGUSR1); + lua_setfield(L, -2, "SIGUSR1"); +#endif +#ifdef SIGSEGV + lua_pushinteger(L, SIGSEGV); + lua_setfield(L, -2, "SIGSEGV"); +#endif +#ifdef SIGUSR2 + lua_pushinteger(L, SIGUSR2); + lua_setfield(L, -2, "SIGUSR2"); +#endif +#ifdef SIGPIPE + lua_pushinteger(L, SIGPIPE); + lua_setfield(L, -2, "SIGPIPE"); +#endif +#ifdef SIGALRM + lua_pushinteger(L, SIGALRM); + lua_setfield(L, -2, "SIGALRM"); +#endif +#ifdef SIGTERM + lua_pushinteger(L, SIGTERM); + lua_setfield(L, -2, "SIGTERM"); +#endif +#ifdef SIGCHLD + lua_pushinteger(L, SIGCHLD); + lua_setfield(L, -2, "SIGCHLD"); +#endif +#ifdef SIGSTKFLT + lua_pushinteger(L, SIGSTKFLT); + lua_setfield(L, -2, "SIGSTKFLT"); +#endif +#ifdef SIGCONT + lua_pushinteger(L, SIGCONT); + lua_setfield(L, -2, "SIGCONT"); +#endif +#ifdef SIGSTOP + lua_pushinteger(L, SIGSTOP); + lua_setfield(L, -2, "SIGSTOP"); +#endif +#ifdef SIGTSTP + lua_pushinteger(L, SIGTSTP); + lua_setfield(L, -2, "SIGTSTP"); +#endif +#ifdef SIGBREAK + lua_pushinteger(L, SIGBREAK); + lua_setfield(L, -2, "SIGBREAK"); +#endif +#ifdef SIGTTIN + lua_pushinteger(L, SIGTTIN); + lua_setfield(L, -2, "SIGTTIN"); +#endif +#ifdef SIGTTOU + lua_pushinteger(L, SIGTTOU); + lua_setfield(L, -2, "SIGTTOU"); +#endif +#ifdef SIGURG + lua_pushinteger(L, SIGURG); + lua_setfield(L, -2, "SIGURG"); +#endif +#ifdef SIGXCPU + lua_pushinteger(L, SIGXCPU); + lua_setfield(L, -2, "SIGXCPU"); +#endif +#ifdef SIGXFSZ + lua_pushinteger(L, SIGXFSZ); + lua_setfield(L, -2, "SIGXFSZ"); +#endif +#ifdef SIGVTALRM + lua_pushinteger(L, SIGVTALRM); + lua_setfield(L, -2, "SIGVTALRM"); +#endif +#ifdef SIGPROF + lua_pushinteger(L, SIGPROF); + lua_setfield(L, -2, "SIGPROF"); +#endif +#ifdef SIGWINCH + lua_pushinteger(L, SIGWINCH); + lua_setfield(L, -2, "SIGWINCH"); +#endif +#ifdef SIGIO + lua_pushinteger(L, SIGIO); + lua_setfield(L, -2, "SIGIO"); +#endif +#ifdef SIGPOLL + lua_pushinteger(L, SIGPOLL); + lua_setfield(L, -2, "SIGPOLL"); +#endif +#ifdef SIGLOST + lua_pushinteger(L, SIGLOST); + lua_setfield(L, -2, "SIGLOST"); +#endif +#ifdef SIGPWR + lua_pushinteger(L, SIGPWR); + lua_setfield(L, -2, "SIGPWR"); +#endif +#ifdef SIGSYS + lua_pushinteger(L, SIGSYS); + lua_setfield(L, -2, "SIGSYS"); +#endif + return 1; +} + +static int luv_af_string_to_num(const char* string) { + if (!string) return AF_UNSPEC; +#ifdef AF_UNIX + if (strcmp(string, "unix") == 0) return AF_UNIX; +#endif +#ifdef AF_INET + if (strcmp(string, "inet") == 0) return AF_INET; +#endif +#ifdef AF_INET6 + if (strcmp(string, "inet6") == 0) return AF_INET6; +#endif +#ifdef AF_IPX + if (strcmp(string, "ipx") == 0) return AF_IPX; +#endif +#ifdef AF_NETLINK + if (strcmp(string, "netlink") == 0) return AF_NETLINK; +#endif +#ifdef AF_X25 + if (strcmp(string, "x25") == 0) return AF_X25; +#endif +#ifdef AF_AX25 + if (strcmp(string, "ax25") == 0) return AF_AX25; +#endif +#ifdef AF_ATMPVC + if (strcmp(string, "atmpvc") == 0) return AF_ATMPVC; +#endif +#ifdef AF_APPLETALK + if (strcmp(string, "appletalk") == 0) return AF_APPLETALK; +#endif +#ifdef AF_PACKET + if (strcmp(string, "packet") == 0) return AF_PACKET; +#endif + return 0; +} + +static const char* luv_af_num_to_string(const int num) { + switch (num) { +#ifdef AF_UNIX + case AF_UNIX: return "unix"; +#endif +#ifdef AF_INET + case AF_INET: return "inet"; +#endif +#ifdef AF_INET6 + case AF_INET6: return "inet6"; +#endif +#ifdef AF_IPX + case AF_IPX: return "ipx"; +#endif +#ifdef AF_NETLINK + case AF_NETLINK: return "netlink"; +#endif +#ifdef AF_X25 + case AF_X25: return "x25"; +#endif +#ifdef AF_AX25 + case AF_AX25: return "ax25"; +#endif +#ifdef AF_ATMPVC + case AF_ATMPVC: return "atmpvc"; +#endif +#ifdef AF_APPLETALK + case AF_APPLETALK: return "appletalk"; +#endif +#ifdef AF_PACKET + case AF_PACKET: return "packet"; +#endif + } + return NULL; +} + + +static int luv_sock_string_to_num(const char* string) { + if (!string) return 0; +#ifdef SOCK_STREAM + if (strcmp(string, "stream") == 0) return SOCK_STREAM; +#endif +#ifdef SOCK_DGRAM + if (strcmp(string, "dgram") == 0) return SOCK_DGRAM; +#endif +#ifdef SOCK_SEQPACKET + if (strcmp(string, "seqpacket") == 0) return SOCK_SEQPACKET; +#endif +#ifdef SOCK_RAW + if (strcmp(string, "raw") == 0) return SOCK_RAW; +#endif +#ifdef SOCK_RDM + if (strcmp(string, "rdm") == 0) return SOCK_RDM; +#endif + return 0; +} + +static const char* luv_sock_num_to_string(const int num) { + switch (num) { +#ifdef SOCK_STREAM + case SOCK_STREAM: return "stream"; +#endif +#ifdef SOCK_DGRAM + case SOCK_DGRAM: return "dgram"; +#endif +#ifdef SOCK_SEQPACKET + case SOCK_SEQPACKET: return "seqpacket"; +#endif +#ifdef SOCK_RAW + case SOCK_RAW: return "raw"; +#endif +#ifdef SOCK_RDM + case SOCK_RDM: return "rdm"; +#endif + } + return NULL; +} + +static int luv_sig_string_to_num(const char* string) { + if (!string) return 0; +#ifdef SIGHUP + if (strcmp(string, "sighup") == 0) return SIGHUP; +#endif +#ifdef SIGINT + if (strcmp(string, "sigint") == 0) return SIGINT; +#endif +#ifdef SIGQUIT + if (strcmp(string, "sigquit") == 0) return SIGQUIT; +#endif +#ifdef SIGILL + if (strcmp(string, "sigill") == 0) return SIGILL; +#endif +#ifdef SIGTRAP + if (strcmp(string, "sigtrap") == 0) return SIGTRAP; +#endif +#ifdef SIGABRT + if (strcmp(string, "sigabrt") == 0) return SIGABRT; +#endif +#ifdef SIGIOT + if (strcmp(string, "sigiot") == 0) return SIGIOT; +#endif +#ifdef SIGBUS + if (strcmp(string, "sigbus") == 0) return SIGBUS; +#endif +#ifdef SIGFPE + if (strcmp(string, "sigfpe") == 0) return SIGFPE; +#endif +#ifdef SIGKILL + if (strcmp(string, "sigkill") == 0) return SIGKILL; +#endif +#ifdef SIGUSR1 + if (strcmp(string, "sigusr1") == 0) return SIGUSR1; +#endif +#ifdef SIGSEGV + if (strcmp(string, "sigsegv") == 0) return SIGSEGV; +#endif +#ifdef SIGUSR2 + if (strcmp(string, "sigusr2") == 0) return SIGUSR2; +#endif +#ifdef SIGPIPE + if (strcmp(string, "sigpipe") == 0) return SIGPIPE; +#endif +#ifdef SIGALRM + if (strcmp(string, "sigalrm") == 0) return SIGALRM; +#endif +#ifdef SIGTERM + if (strcmp(string, "sigterm") == 0) return SIGTERM; +#endif +#ifdef SIGCHLD + if (strcmp(string, "sigchld") == 0) return SIGCHLD; +#endif +#ifdef SIGSTKFLT + if (strcmp(string, "sigstkflt") == 0) return SIGSTKFLT; +#endif +#ifdef SIGCONT + if (strcmp(string, "sigcont") == 0) return SIGCONT; +#endif +#ifdef SIGSTOP + if (strcmp(string, "sigstop") == 0) return SIGSTOP; +#endif +#ifdef SIGTSTP + if (strcmp(string, "sigtstp") == 0) return SIGTSTP; +#endif +#ifdef SIGBREAK + if (strcmp(string, "sigbreak") == 0) return SIGBREAK; +#endif +#ifdef SIGTTIN + if (strcmp(string, "sigttin") == 0) return SIGTTIN; +#endif +#ifdef SIGTTOU + if (strcmp(string, "sigttou") == 0) return SIGTTOU; +#endif +#ifdef SIGURG + if (strcmp(string, "sigurg") == 0) return SIGURG; +#endif +#ifdef SIGXCPU + if (strcmp(string, "sigxcpu") == 0) return SIGXCPU; +#endif +#ifdef SIGXFSZ + if (strcmp(string, "sigxfsz") == 0) return SIGXFSZ; +#endif +#ifdef SIGVTALRM + if (strcmp(string, "sigvtalrm") == 0) return SIGVTALRM; +#endif +#ifdef SIGPROF + if (strcmp(string, "sigprof") == 0) return SIGPROF; +#endif +#ifdef SIGWINCH + if (strcmp(string, "sigwinch") == 0) return SIGWINCH; +#endif +#ifdef SIGIO + if (strcmp(string, "sigio") == 0) return SIGIO; +#endif +#ifdef SIGPOLL + if (strcmp(string, "sigpoll") == 0) return SIGPOLL; +#endif +#ifdef SIGLOST + if (strcmp(string, "siglost") == 0) return SIGLOST; +#endif +#ifdef SIGPWR + if (strcmp(string, "sigpwr") == 0) return SIGPWR; +#endif +#ifdef SIGSYS + if (strcmp(string, "sigsys") == 0) return SIGSYS; +#endif + return 0; +} + +static const char* luv_sig_num_to_string(const int num) { + switch (num) { +#ifdef SIGHUP + case SIGHUP: return "sighup"; +#endif +#ifdef SIGINT + case SIGINT: return "sigint"; +#endif +#ifdef SIGQUIT + case SIGQUIT: return "sigquit"; +#endif +#ifdef SIGILL + case SIGILL: return "sigill"; +#endif +#ifdef SIGTRAP + case SIGTRAP: return "sigtrap"; +#endif +#ifdef SIGABRT + case SIGABRT: return "sigabrt"; +#endif +#ifdef SIGIOT +# if SIGIOT != SIGABRT + case SIGIOT: return "sigiot"; +# endif +#endif +#ifdef SIGBUS + case SIGBUS: return "sigbus"; +#endif +#ifdef SIGFPE + case SIGFPE: return "sigfpe"; +#endif +#ifdef SIGKILL + case SIGKILL: return "sigkill"; +#endif +#ifdef SIGUSR1 + case SIGUSR1: return "sigusr1"; +#endif +#ifdef SIGSEGV + case SIGSEGV: return "sigsegv"; +#endif +#ifdef SIGUSR2 + case SIGUSR2: return "sigusr2"; +#endif +#ifdef SIGPIPE + case SIGPIPE: return "sigpipe"; +#endif +#ifdef SIGALRM + case SIGALRM: return "sigalrm"; +#endif +#ifdef SIGTERM + case SIGTERM: return "sigterm"; +#endif +#ifdef SIGCHLD + case SIGCHLD: return "sigchld"; +#endif +#ifdef SIGSTKFLT + case SIGSTKFLT: return "sigstkflt"; +#endif +#ifdef SIGCONT + case SIGCONT: return "sigcont"; +#endif +#ifdef SIGSTOP + case SIGSTOP: return "sigstop"; +#endif +#ifdef SIGTSTP + case SIGTSTP: return "sigtstp"; +#endif +#ifdef SIGBREAK + case SIGBREAK: return "sigbreak"; +#endif +#ifdef SIGTTIN + case SIGTTIN: return "sigttin"; +#endif +#ifdef SIGTTOU + case SIGTTOU: return "sigttou"; +#endif +#ifdef SIGURG + case SIGURG: return "sigurg"; +#endif +#ifdef SIGXCPU + case SIGXCPU: return "sigxcpu"; +#endif +#ifdef SIGXFSZ + case SIGXFSZ: return "sigxfsz"; +#endif +#ifdef SIGVTALRM + case SIGVTALRM: return "sigvtalrm"; +#endif +#ifdef SIGPROF + case SIGPROF: return "sigprof"; +#endif +#ifdef SIGWINCH + case SIGWINCH: return "sigwinch"; +#endif +#ifdef SIGIO + case SIGIO: return "sigio"; +#endif +#ifdef SIGPOLL +# if SIGPOLL != SIGIO + case SIGPOLL: return "sigpoll"; +# endif +#endif +#ifdef SIGLOST + case SIGLOST: return "siglost"; +#endif +#ifdef SIGPWR +# if SIGPWR != SIGLOST + case SIGPWR: return "sigpwr"; +# endif +#endif +#ifdef SIGSYS + case SIGSYS: return "sigsys"; +#endif + } + return NULL; +} diff --git a/3rdparty/luv/src/dns.c b/3rdparty/luv/src/dns.c new file mode 100644 index 00000000000..f3446f30985 --- /dev/null +++ b/3rdparty/luv/src/dns.c @@ -0,0 +1,296 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "luv.h" +#ifndef WIN32 +#include +#include +#include +#endif + +static void luv_pushaddrinfo(lua_State* L, struct addrinfo* res) { + char ip[INET6_ADDRSTRLEN]; + int port, i = 0; + const char *addr; + struct addrinfo* curr = res; + lua_newtable(L); + for (curr = res; curr; curr = curr->ai_next) { + if (curr->ai_family == AF_INET || curr->ai_family == AF_INET6) { + lua_newtable(L); + if (curr->ai_family == AF_INET) { + addr = (char*) &((struct sockaddr_in*) curr->ai_addr)->sin_addr; + port = ((struct sockaddr_in*) curr->ai_addr)->sin_port; + } else { + addr = (char*) &((struct sockaddr_in6*) curr->ai_addr)->sin6_addr; + port = ((struct sockaddr_in6*) curr->ai_addr)->sin6_port; + } + lua_pushstring(L, luv_af_num_to_string(curr->ai_family)); + lua_setfield(L, -2, "family"); + uv_inet_ntop(curr->ai_family, addr, ip, INET6_ADDRSTRLEN); + lua_pushstring(L, ip); + lua_setfield(L, -2, "addr"); + if (ntohs(port)) { + lua_pushinteger(L, ntohs(port)); + lua_setfield(L, -2, "port"); + } + lua_pushstring(L, luv_sock_num_to_string(curr->ai_socktype)); + lua_setfield(L, -2, "socktype"); + lua_pushstring(L, luv_af_num_to_string(curr->ai_protocol)); + lua_setfield(L, -2, "protocol"); + if (curr->ai_canonname) { + lua_pushstring(L, curr->ai_canonname); + lua_setfield(L, -2, "canonname"); + } + lua_rawseti(L, -2, ++i); + } + } +} + +static void luv_getaddrinfo_cb(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { + lua_State* L = luv_state(req->loop); + int nargs; + + if (status < 0) { + luv_status(L, status); + nargs = 1; + } + else { + lua_pushnil(L); + luv_pushaddrinfo(L, res); + nargs = 2; + } + luv_fulfill_req(L, req->data, nargs); + luv_cleanup_req(L, req->data); + req->data = NULL; + if (res) uv_freeaddrinfo(res); +} + + +static int luv_getaddrinfo(lua_State* L) { + uv_getaddrinfo_t* req; + const char* node; + const char* service; + struct addrinfo hints_s; + struct addrinfo* hints = &hints_s; + int ret, ref; + if (lua_isnoneornil(L, 1)) node = NULL; + else node = luaL_checkstring(L, 1); + if (lua_isnoneornil(L, 2)) service = NULL; + else service = luaL_checkstring(L, 2); + if (!lua_isnoneornil(L, 3)) luaL_checktype(L, 3, LUA_TTABLE); + else hints = NULL; + ref = lua_isnoneornil(L, 4) ? LUA_NOREF : luv_check_continuation(L, 4); + if (hints) { + // Initialize the hints + memset(hints, 0, sizeof(*hints)); + + // Process the `family` hint. + lua_getfield(L, 3, "family"); + if (lua_isnumber(L, -1)) { + hints->ai_family = lua_tointeger(L, -1); + } + else if (lua_isstring(L, -1)) { + hints->ai_family = luv_af_string_to_num(lua_tostring(L, -1)); + } + else if (lua_isnil(L, -1)) { + hints->ai_family = AF_UNSPEC; + } + else { + luaL_argerror(L, 3, "family hint must be string if set"); + } + lua_pop(L, 1); + + // Process `socktype` hint + lua_getfield(L, 3, "socktype"); + if (lua_isnumber(L, -1)) { + hints->ai_socktype = lua_tointeger(L, -1); + } + else if (lua_isstring(L, -1)) { + hints->ai_socktype = luv_sock_string_to_num(lua_tostring(L, -1)); + } + else if (!lua_isnil(L, -1)) { + return luaL_argerror(L, 3, "socktype hint must be string if set"); + } + lua_pop(L, 1); + + // Process the `protocol` hint + lua_getfield(L, 3, "protocol"); + if (lua_isnumber(L, -1)) { + hints->ai_protocol = lua_tointeger(L, -1); + } + else if (lua_isstring(L, -1)) { + int protocol = luv_af_string_to_num(lua_tostring(L, -1)); + if (protocol) { + hints->ai_protocol = protocol; + } + else { + return luaL_argerror(L, 3, "Invalid protocol hint"); + } + } + else if (!lua_isnil(L, -1)) { + return luaL_argerror(L, 3, "protocol hint must be string if set"); + } + lua_pop(L, 1); + + lua_getfield(L, 3, "addrconfig"); + if (lua_toboolean(L, -1)) hints->ai_flags |= AI_ADDRCONFIG; + lua_pop(L, 1); + + lua_getfield(L, 3, "v4mapped"); + if (lua_toboolean(L, -1)) hints->ai_flags |= AI_V4MAPPED; + lua_pop(L, 1); + + lua_getfield(L, 3, "all"); + if (lua_toboolean(L, -1)) hints->ai_flags |= AI_ALL; + lua_pop(L, 1); + + lua_getfield(L, 3, "numerichost"); + if (lua_toboolean(L, -1)) hints->ai_flags |= AI_NUMERICHOST; + lua_pop(L, 1); + + lua_getfield(L, 3, "passive"); + if (lua_toboolean(L, -1)) hints->ai_flags |= AI_PASSIVE; + lua_pop(L, 1); + + lua_getfield(L, 3, "numericserv"); + if (lua_toboolean(L, -1)) { + hints->ai_flags |= AI_NUMERICSERV; + /* On OS X upto at least OSX 10.9, getaddrinfo crashes + * if AI_NUMERICSERV is set and the servname is NULL or "0". + * This workaround avoids a segfault in libsystem. + */ + if (NULL == service) service = "00"; + } + lua_pop(L, 1); + + lua_getfield(L, 3, "canonname"); + if (lua_toboolean(L, -1)) hints->ai_flags |= AI_CANONNAME; + lua_pop(L, 1); + } + + req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + + ret = uv_getaddrinfo(luv_loop(L), req, ref == LUA_NOREF ? NULL : luv_getaddrinfo_cb, node, service, hints); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + if (ref == LUA_NOREF) { + + lua_pop(L, 1); + luv_pushaddrinfo(L, req->addrinfo); + uv_freeaddrinfo(req->addrinfo); + luv_cleanup_req(L, req->data); + } + return 1; +} + +static void luv_getnameinfo_cb(uv_getnameinfo_t* req, int status, const char* hostname, const char* service) { + lua_State* L = luv_state(req->loop); + + int nargs; + + if (status < 0) { + luv_status(L, status); + nargs = 1; + } + else { + lua_pushnil(L); + lua_pushstring(L, hostname); + lua_pushstring(L, service); + nargs = 3; + } + + luv_fulfill_req(L, req->data, nargs); + luv_cleanup_req(L, req->data); + req->data = NULL; +} + +static int luv_getnameinfo(lua_State* L) { + uv_getnameinfo_t* req; + struct sockaddr_storage addr; + const char* ip = NULL; + int flags = 0; + int ret, ref, port = 0; + + luaL_checktype(L, 1, LUA_TTABLE); + memset(&addr, 0, sizeof(addr)); + + lua_getfield(L, 1, "ip"); + if (lua_isstring(L, -1)) { + ip = lua_tostring(L, -1); + } + else if (!lua_isnil(L, -1)) { + luaL_argerror(L, 1, "ip property must be string if set"); + } + lua_pop(L, 1); + + lua_getfield(L, 1, "port"); + if (lua_isnumber(L, -1)) { + port = lua_tointeger(L, -1); + } + else if (!lua_isnil(L, -1)) { + luaL_argerror(L, 1, "port property must be integer if set"); + } + lua_pop(L, 1); + + if (ip || port) { + if (!ip) ip = "0.0.0.0"; + if (!uv_ip4_addr(ip, port, (struct sockaddr_in*)&addr)) { + addr.ss_family = AF_INET; + } + else if (!uv_ip6_addr(ip, port, (struct sockaddr_in6*)&addr)) { + addr.ss_family = AF_INET6; + } + else { + return luaL_argerror(L, 1, "Invalid ip address or port"); + } + } + + lua_getfield(L, 1, "family"); + if (lua_isnumber(L, -1)) { + addr.ss_family = lua_tointeger(L, -1); + } + else if (lua_isstring(L, -1)) { + addr.ss_family = luv_af_string_to_num(lua_tostring(L, -1)); + } + else if (!lua_isnil(L, -1)) { + luaL_argerror(L, 1, "family must be string if set"); + } + lua_pop(L, 1); + + ref = lua_isnoneornil(L, 2) ? LUA_NOREF : luv_check_continuation(L, 2); + + req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + + ret = uv_getnameinfo(luv_loop(L), req, ref == LUA_NOREF ? NULL : luv_getnameinfo_cb, (struct sockaddr*)&addr, flags); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + if (ref == LUA_NOREF) { + lua_pop(L, 1); + lua_pushstring(L, req->host); + lua_pushstring(L, req->service); + luv_cleanup_req(L, req->data); + return 2; + } + return 1; +} + diff --git a/3rdparty/luv/src/fs.c b/3rdparty/luv/src/fs.c new file mode 100644 index 00000000000..bacf11ea647 --- /dev/null +++ b/3rdparty/luv/src/fs.c @@ -0,0 +1,614 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "luv.h" + +static uv_fs_t* luv_check_fs(lua_State* L, int index) { + uv_fs_t* req = luaL_checkudata(L, index, "uv_req"); + luaL_argcheck(L, req->type = UV_FS && req->data, index, "Expected uv_fs_t"); + return req; +} + +static void luv_push_timespec_table(lua_State* L, const uv_timespec_t* t) { + lua_createtable(L, 0, 2); + lua_pushinteger(L, t->tv_sec); + lua_setfield(L, -2, "sec"); + lua_pushinteger(L, t->tv_nsec); + lua_setfield(L, -2, "nsec"); +} + +static void luv_push_stats_table(lua_State* L, const uv_stat_t* s) { + const char* type = NULL; + lua_createtable(L, 0, 23); + lua_pushinteger(L, s->st_dev); + lua_setfield(L, -2, "dev"); + lua_pushinteger(L, s->st_mode); + lua_setfield(L, -2, "mode"); + lua_pushinteger(L, s->st_nlink); + lua_setfield(L, -2, "nlink"); + lua_pushinteger(L, s->st_uid); + lua_setfield(L, -2, "uid"); + lua_pushinteger(L, s->st_gid); + lua_setfield(L, -2, "gid"); + lua_pushinteger(L, s->st_rdev); + lua_setfield(L, -2, "rdev"); + lua_pushinteger(L, s->st_ino); + lua_setfield(L, -2, "ino"); + lua_pushinteger(L, s->st_size); + lua_setfield(L, -2, "size"); + lua_pushinteger(L, s->st_blksize); + lua_setfield(L, -2, "blksize"); + lua_pushinteger(L, s->st_blocks); + lua_setfield(L, -2, "blocks"); + lua_pushinteger(L, s->st_flags); + lua_setfield(L, -2, "flags"); + lua_pushinteger(L, s->st_gen); + lua_setfield(L, -2, "gen"); + luv_push_timespec_table(L, &s->st_atim); + lua_setfield(L, -2, "atime"); + luv_push_timespec_table(L, &s->st_mtim); + lua_setfield(L, -2, "mtime"); + luv_push_timespec_table(L, &s->st_ctim); + lua_setfield(L, -2, "ctime"); + luv_push_timespec_table(L, &s->st_birthtim); + lua_setfield(L, -2, "birthtime"); + if (S_ISREG(s->st_mode)) { + type = "file"; + } + else if (S_ISDIR(s->st_mode)) { + type = "directory"; + } + else if (S_ISLNK(s->st_mode)) { + type = "link"; + } + else if (S_ISFIFO(s->st_mode)) { + type = "fifo"; + } +#ifdef S_ISSOCK + else if (S_ISSOCK(s->st_mode)) { + type = "socket"; + } +#endif + else if (S_ISCHR(s->st_mode)) { + type = "char"; + } + else if (S_ISBLK(s->st_mode)) { + type = "block"; + } + if (type) { + lua_pushstring(L, type); + lua_setfield(L, -2, "type"); + } +} + +static int luv_check_flags(lua_State* L, int index) { + const char* string; + if (lua_isnumber(L, index)) { + return lua_tointeger(L, index); + } + else if (!lua_isstring(L, index)) { + return luaL_argerror(L, index, "Expected string or integer for file open mode"); + } + string = lua_tostring(L, index); + + if (strcmp(string, "r") == 0) return O_RDONLY; +#ifdef O_SYNC + if (strcmp(string, "rs") == 0 || + strcmp(string, "sr") == 0) return O_RDONLY | O_SYNC; +#endif + if (strcmp(string, "r+") == 0) return O_RDWR; +#ifdef O_SYNC + if (strcmp(string, "rs+") == 0 || + strcmp(string, "sr+") == 0) return O_RDWR | O_SYNC; +#endif + if (strcmp(string, "w") == 0) return O_TRUNC | O_CREAT | O_WRONLY; + if (strcmp(string, "wx") == 0 || + strcmp(string, "xw") == 0) return O_TRUNC | O_CREAT | O_WRONLY | O_EXCL; + if (strcmp(string, "w+") == 0) return O_TRUNC | O_CREAT | O_RDWR; + if (strcmp(string, "wx+") == 0 || + strcmp(string, "xw+") == 0) return O_TRUNC | O_CREAT | O_RDWR | O_EXCL; + if (strcmp(string, "a") == 0) return O_APPEND | O_CREAT | O_WRONLY; + if (strcmp(string, "ax") == 0 || + strcmp(string, "xa") == 0) return O_APPEND | O_CREAT | O_WRONLY | O_EXCL; + if (strcmp(string, "a+") == 0) return O_APPEND | O_CREAT | O_RDWR; + if (strcmp(string, "ax+") == 0 || + strcmp(string, "xa+") == 0) return O_APPEND | O_CREAT | O_RDWR | O_EXCL; + + return luaL_error(L, "Unknown file open flag '%s'", string); +} + +static int luv_check_amode(lua_State* L, int index) { + size_t i; + int mode; + const char* string; + if (lua_isnumber(L, index)) { + return lua_tointeger(L, index); + } + else if (!lua_isstring(L, index)) { + return luaL_argerror(L, index, "Expected string or integer for file access mode check"); + } + string = lua_tostring(L, index); + mode = 0; + for (i = 0; i < strlen(string); ++i) { + switch (string[i]) { + case 'r': case 'R': + mode |= R_OK; + break; + case 'w': case 'W': + mode |= W_OK; + break; + case 'x': case 'X': + mode |= X_OK; + break; + default: + return luaL_argerror(L, index, "Unknown character in access mode string"); + } + } + return mode; +} + +/* Processes a result and pushes the data onto the stack + returns the number of items pushed */ +static int push_fs_result(lua_State* L, uv_fs_t* req) { + luv_req_t* data = req->data; + + if (req->fs_type == UV_FS_ACCESS) { + lua_pushboolean(L, req->result >= 0); + return 1; + } + + if (req->result < 0) { + lua_pushnil(L); + if (req->path) { + lua_pushfstring(L, "%s: %s: %s", uv_err_name(req->result), uv_strerror(req->result), req->path); + } + else { + lua_pushfstring(L, "%s: %s", uv_err_name(req->result), uv_strerror(req->result)); + } + return 2; + } + + switch (req->fs_type) { + case UV_FS_CLOSE: + case UV_FS_RENAME: + case UV_FS_UNLINK: + case UV_FS_RMDIR: + case UV_FS_MKDIR: + case UV_FS_FTRUNCATE: + case UV_FS_FSYNC: + case UV_FS_FDATASYNC: + case UV_FS_LINK: + case UV_FS_SYMLINK: + case UV_FS_CHMOD: + case UV_FS_FCHMOD: + case UV_FS_CHOWN: + case UV_FS_FCHOWN: + case UV_FS_UTIME: + case UV_FS_FUTIME: + lua_pushboolean(L, 1); + return 1; + + case UV_FS_OPEN: + case UV_FS_SENDFILE: + case UV_FS_WRITE: + lua_pushinteger(L, req->result); + return 1; + + case UV_FS_STAT: + case UV_FS_LSTAT: + case UV_FS_FSTAT: + luv_push_stats_table(L, &req->statbuf); + return 1; + + case UV_FS_MKDTEMP: + lua_pushstring(L, req->path); + return 1; + + case UV_FS_READLINK: + case UV_FS_REALPATH: + lua_pushstring(L, (char*)req->ptr); + return 1; + + case UV_FS_READ: + lua_pushlstring(L, data->data, req->result); + return 1; + + case UV_FS_SCANDIR: + // Expose the userdata for the request. + lua_rawgeti(L, LUA_REGISTRYINDEX, data->req_ref); + return 1; + + default: + lua_pushnil(L); + lua_pushfstring(L, "UNKNOWN FS TYPE %d\n", req->fs_type); + return 2; + } + +} + +static void luv_fs_cb(uv_fs_t* req) { + lua_State* L = luv_state(req->loop); + + int nargs = push_fs_result(L, req); + if (nargs == 2 && lua_isnil(L, -nargs)) { + // If it was an error, convert to (err, value) format. + lua_remove(L, -nargs); + nargs--; + } + else { + // Otherwise insert a nil in front to convert to (err, value) format. + lua_pushnil(L); + lua_insert(L, -nargs - 1); + nargs++; + } + luv_fulfill_req(L, req->data, nargs); + if (req->fs_type != UV_FS_SCANDIR) { + luv_cleanup_req(L, req->data); + req->data = NULL; + uv_fs_req_cleanup(req); + } +} + +#define FS_CALL(func, req, ...) { \ + int ret, sync; \ + luv_req_t* data = req->data; \ + sync = data->callback_ref == LUA_NOREF; \ + ret = uv_fs_##func(luv_loop(L), req, __VA_ARGS__, \ + sync ? NULL : luv_fs_cb); \ + if (req->fs_type != UV_FS_ACCESS && ret < 0) { \ + lua_pushnil(L); \ + if (req->path) { \ + lua_pushfstring(L, "%s: %s: %s", uv_err_name(req->result), uv_strerror(req->result), req->path); \ + } \ + else { \ + lua_pushfstring(L, "%s: %s", uv_err_name(req->result), uv_strerror(req->result)); \ + } \ + lua_pushstring(L, uv_err_name(req->result)); \ + luv_cleanup_req(L, req->data); \ + req->data = NULL; \ + uv_fs_req_cleanup(req); \ + return 3; \ + } \ + if (sync) { \ + int nargs = push_fs_result(L, req); \ + if (req->fs_type != UV_FS_SCANDIR) { \ + luv_cleanup_req(L, req->data); \ + req->data = NULL; \ + uv_fs_req_cleanup(req); \ + } \ + return nargs; \ + } \ + lua_rawgeti(L, LUA_REGISTRYINDEX, data->req_ref); \ + return 1; \ +} + +static int luv_fs_close(lua_State* L) { + uv_file file = luaL_checkinteger(L, 1); + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(close, req, file); +} + +static int luv_fs_open(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + int flags = luv_check_flags(L, 2); + int mode = luaL_checkinteger(L, 3); + int ref = luv_check_continuation(L, 4); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(open, req, path, flags, mode); +} + +static int luv_fs_read(lua_State* L) { + uv_file file = luaL_checkinteger(L, 1); + int64_t len = luaL_checkinteger(L, 2); + int64_t offset = luaL_checkinteger(L, 3); + uv_buf_t buf; + int ref; + uv_fs_t* req; + char* data = malloc(len); + if (!data) return luaL_error(L, "Failure to allocate buffer"); + buf = uv_buf_init(data, len); + ref = luv_check_continuation(L, 4); + req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + // TODO: find out why we can't just use req->ptr for the base + ((luv_req_t*)req->data)->data = buf.base; + FS_CALL(read, req, file, &buf, 1, offset); +} + +static int luv_fs_unlink(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(unlink, req, path); +} + +static int luv_fs_write(lua_State* L) { + uv_file file = luaL_checkinteger(L, 1); + uv_buf_t buf; + int64_t offset; + int ref; + uv_fs_t* req; + size_t count; + uv_buf_t *bufs = NULL; + + if (lua_istable(L, 2)) { + bufs = luv_prep_bufs(L, 2, &count); + buf.base = NULL; + } + else if (lua_isstring(L, 2)) { + luv_check_buf(L, 2, &buf); + count = 1; + } + else { + return luaL_argerror(L, 2, "data must be string or table of strings"); + } + + offset = luaL_checkinteger(L, 3); + ref = luv_check_continuation(L, 4); + req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + req->ptr = buf.base; + ((luv_req_t*)req->data)->data = bufs; + FS_CALL(write, req, file, bufs ? bufs : &buf, count, offset); +} + +static int luv_fs_mkdir(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + int mode = luaL_checkinteger(L, 2); + int ref = luv_check_continuation(L, 3); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(mkdir, req, path, mode); +} + +static int luv_fs_mkdtemp(lua_State* L) { + const char* tpl = luaL_checkstring(L, 1); + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(mkdtemp, req, tpl); +} + +static int luv_fs_rmdir(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(rmdir, req, path); +} + +static int luv_fs_scandir(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + int flags = 0; // TODO: find out what these flags are. + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(scandir, req, path, flags); +} + +static int luv_fs_scandir_next(lua_State* L) { + uv_fs_t* req = luv_check_fs(L, 1); + uv_dirent_t ent; + int ret = uv_fs_scandir_next(req, &ent); + const char* type; + if (ret == UV_EOF) { + luv_cleanup_req(L, req->data); + req->data = NULL; + uv_fs_req_cleanup(req); + return 0; + } + if (ret < 0) return luv_error(L, ret); + lua_pushstring(L, ent.name); + switch (ent.type) { + case UV_DIRENT_UNKNOWN: return 1; + case UV_DIRENT_FILE: type = "file"; break; + case UV_DIRENT_DIR: type = "directory"; break; + case UV_DIRENT_LINK: type = "link"; break; + case UV_DIRENT_FIFO: type = "fifo"; break; + case UV_DIRENT_SOCKET: type = "socket"; break; + case UV_DIRENT_CHAR: type = "char"; break; + case UV_DIRENT_BLOCK: type = "block"; break; + default: assert(0); + } + lua_pushstring(L, type); + return 2; +} + +static int luv_fs_stat(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(stat, req, path); +} + +static int luv_fs_fstat(lua_State* L) { + uv_file file = luaL_checkinteger(L, 1); + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(fstat, req, file); +} + +static int luv_fs_lstat(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(lstat, req, path); +} + +static int luv_fs_rename(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + const char* new_path = luaL_checkstring(L, 2); + int ref = luv_check_continuation(L, 3); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(rename, req, path, new_path); +} + +static int luv_fs_fsync(lua_State* L) { + uv_file file = luaL_checkinteger(L, 1); + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(fsync, req, file); +} + +static int luv_fs_fdatasync(lua_State* L) { + uv_file file = luaL_checkinteger(L, 1); + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(fdatasync, req, file); +} + +static int luv_fs_ftruncate(lua_State* L) { + uv_file file = luaL_checkinteger(L, 1); + int64_t offset = luaL_checkinteger(L, 2); + int ref = luv_check_continuation(L, 3); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(ftruncate, req, file, offset); +} + +static int luv_fs_sendfile(lua_State* L) { + uv_file out_fd = luaL_checkinteger(L, 1); + uv_file in_fd = luaL_checkinteger(L, 2); + int64_t in_offset = luaL_checkinteger(L, 3); + size_t length = luaL_checkinteger(L, 4); + int ref = luv_check_continuation(L, 5); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(sendfile, req, out_fd, in_fd, in_offset, length); +} + +static int luv_fs_access(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + int amode = luv_check_amode(L, 2); + int ref = luv_check_continuation(L, 3); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(access, req, path, amode); +} + +static int luv_fs_chmod(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + int mode = luaL_checkinteger(L, 2); + int ref = luv_check_continuation(L, 3); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(chmod, req, path, mode); +} + +static int luv_fs_fchmod(lua_State* L) { + uv_file file = luaL_checkinteger(L, 1); + int mode = luaL_checkinteger(L, 2); + int ref = luv_check_continuation(L, 3); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(fchmod, req, file, mode); +} + +static int luv_fs_utime(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + double atime = luaL_checknumber(L, 2); + double mtime = luaL_checknumber(L, 3); + int ref = luv_check_continuation(L, 4); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(utime, req, path, atime, mtime); +} + +static int luv_fs_futime(lua_State* L) { + uv_file file = luaL_checkinteger(L, 1); + double atime = luaL_checknumber(L, 2); + double mtime = luaL_checknumber(L, 3); + int ref = luv_check_continuation(L, 4); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(futime, req, file, atime, mtime); +} + +static int luv_fs_link(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + const char* new_path = luaL_checkstring(L, 2); + int ref = luv_check_continuation(L, 3); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(link, req, path, new_path); +} + +static int luv_fs_symlink(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + const char* new_path = luaL_checkstring(L, 2); + int flags = 0, ref; + uv_fs_t* req; + if (lua_type(L, 3) == LUA_TTABLE) { + lua_getfield(L, 3, "dir"); + if (lua_toboolean(L, -1)) flags |= UV_FS_SYMLINK_DIR; + lua_pop(L, 1); + lua_getfield(L, 3, "junction"); + if (lua_toboolean(L, -1)) flags |= UV_FS_SYMLINK_JUNCTION; + lua_pop(L, 1); + } + ref = luv_check_continuation(L, 4); + req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + + FS_CALL(symlink, req, path, new_path, flags); +} + +static int luv_fs_readlink(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(readlink, req, path); +} + +static int luv_fs_realpath(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + int ref = luv_check_continuation(L, 2); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(realpath, req, path); +} + +static int luv_fs_chown(lua_State* L) { + const char* path = luaL_checkstring(L, 1); + uv_uid_t uid = luaL_checkinteger(L, 2); + uv_uid_t gid = luaL_checkinteger(L, 3); + int ref = luv_check_continuation(L, 4); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(chown, req, path, uid, gid); +} + +static int luv_fs_fchown(lua_State* L) { + uv_file file = luaL_checkinteger(L, 1); + uv_uid_t uid = luaL_checkinteger(L, 2); + uv_uid_t gid = luaL_checkinteger(L, 3); + int ref = luv_check_continuation(L, 4); + uv_fs_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + FS_CALL(fchown, req, file, uid, gid); +} diff --git a/3rdparty/luv/src/fs_event.c b/3rdparty/luv/src/fs_event.c new file mode 100644 index 00000000000..52bda788421 --- /dev/null +++ b/3rdparty/luv/src/fs_event.c @@ -0,0 +1,97 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "luv.h" + +static uv_fs_event_t* luv_check_fs_event(lua_State* L, int index) { + uv_fs_event_t* handle = luv_checkudata(L, index, "uv_fs_event"); + luaL_argcheck(L, handle->type == UV_FS_EVENT && handle->data, index, "Expected uv_fs_event_t"); + return handle; +} + +static int luv_new_fs_event(lua_State* L) { + uv_fs_event_t* handle = luv_newuserdata(L, sizeof(*handle)); + int ret = uv_fs_event_init(luv_loop(L), handle); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static void luv_fs_event_cb(uv_fs_event_t* handle, const char* filename, int events, int status) { + lua_State* L = luv_state(handle->loop); + + // err + luv_status(L, status); + + // filename + lua_pushstring(L, filename); + + // events + lua_newtable(L); + if (events & UV_RENAME) { + lua_pushboolean(L, 1); + lua_setfield(L, -2, "rename"); + } + if (events & UV_CHANGE) { + lua_pushboolean(L, 1); + lua_setfield(L, -2, "change"); + } + + luv_call_callback(L, handle->data, LUV_FS_EVENT, 3); +} + +static int luv_fs_event_start(lua_State* L) { + uv_fs_event_t* handle = luv_check_fs_event(L, 1); + const char* path = luaL_checkstring(L, 2); + int flags = 0, ret; + luaL_checktype(L, 3, LUA_TTABLE); + lua_getfield(L, 3, "watch_entry"); + if (lua_toboolean(L, -1)) flags |= UV_FS_EVENT_WATCH_ENTRY; + lua_pop(L, 1); + lua_getfield(L, 3, "stat"); + if (lua_toboolean(L, -1)) flags |= UV_FS_EVENT_STAT; + lua_pop(L, 1); + lua_getfield(L, 3, "recursive"); + if (lua_toboolean(L, -1)) flags |= UV_FS_EVENT_RECURSIVE; + lua_pop(L, 1); + luv_check_callback(L, handle->data, LUV_FS_EVENT, 4); + ret = uv_fs_event_start(handle, luv_fs_event_cb, path, flags); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_fs_event_stop(lua_State* L) { + uv_fs_event_t* handle = luv_check_fs_event(L, 1); + int ret = uv_fs_event_stop(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_fs_event_getpath(lua_State* L) { + uv_fs_event_t* handle = luv_check_fs_event(L, 1); + size_t len = 2*PATH_MAX; + char buf[2*PATH_MAX]; + int ret = uv_fs_event_getpath(handle, buf, &len); + if (ret < 0) return luv_error(L, ret); + lua_pushlstring(L, buf, len); + return 1; +} diff --git a/3rdparty/luv/src/fs_poll.c b/3rdparty/luv/src/fs_poll.c new file mode 100644 index 00000000000..7ead32f322c --- /dev/null +++ b/3rdparty/luv/src/fs_poll.c @@ -0,0 +1,90 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "luv.h" + +static uv_fs_poll_t* luv_check_fs_poll(lua_State* L, int index) { + uv_fs_poll_t* handle = luv_checkudata(L, index, "uv_fs_poll"); + luaL_argcheck(L, handle->type == UV_FS_POLL && handle->data, index, "Expected uv_fs_poll_t"); + return handle; +} + +static int luv_new_fs_poll(lua_State* L) { + uv_fs_poll_t* handle = luv_newuserdata(L, sizeof(*handle)); + int ret = uv_fs_poll_init(luv_loop(L), handle); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static void luv_fs_poll_cb(uv_fs_poll_t* handle, int status, const uv_stat_t* prev, const uv_stat_t* curr) { + lua_State* L = luv_state(handle->loop); + + // err + luv_status(L, status); + + // prev + if (prev) { + luv_push_stats_table(L, prev); + } + else { + lua_pushnil(L); + } + + // curr + if (curr) { + luv_push_stats_table(L, curr); + } + else { + lua_pushnil(L); + } + + luv_call_callback(L, handle->data, LUV_FS_POLL, 3); +} + +static int luv_fs_poll_start(lua_State* L) { + uv_fs_poll_t* handle = luv_check_fs_poll(L, 1); + const char* path = luaL_checkstring(L, 2); + unsigned int interval = luaL_checkinteger(L, 3); + int ret; + luv_check_callback(L, handle->data, LUV_FS_POLL, 4); + ret = uv_fs_poll_start(handle, luv_fs_poll_cb, path, interval); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_fs_poll_stop(lua_State* L) { + uv_fs_poll_t* handle = luv_check_fs_poll(L, 1); + int ret = uv_fs_poll_stop(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_fs_poll_getpath(lua_State* L) { + uv_fs_poll_t* handle = luv_check_fs_poll(L, 1); + size_t len = 2*PATH_MAX; + char buf[2*PATH_MAX]; + int ret = uv_fs_poll_getpath(handle, buf, &len); + if (ret < 0) return luv_error(L, ret); + lua_pushlstring(L, buf, len); + return 1; +} diff --git a/3rdparty/luv/src/handle.c b/3rdparty/luv/src/handle.c new file mode 100644 index 00000000000..3efd2982641 --- /dev/null +++ b/3rdparty/luv/src/handle.c @@ -0,0 +1,173 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static void* luv_newuserdata(lua_State* L, size_t sz) { + void* handle = malloc(sz); + if (handle) { + *(void**)lua_newuserdata(L, sizeof(void*)) = handle; + } + return handle; +} + +static void* luv_checkudata(lua_State* L, int ud, const char* tname) { + return *(void**) luaL_checkudata(L, ud, tname); +} + +static uv_handle_t* luv_check_handle(lua_State* L, int index) { + int isHandle; + uv_handle_t* handle; + if (!(handle = *(void**)lua_touserdata(L, index))) { goto fail; } + lua_getfield(L, LUA_REGISTRYINDEX, "uv_handle"); + lua_getmetatable(L, index < 0 ? index - 1 : index); + lua_rawget(L, -2); + isHandle = lua_toboolean(L, -1); + lua_pop(L, 2); + if (isHandle) { return handle; } + fail: luaL_argerror(L, index, "Expected uv_handle userdata"); + return NULL; +} + +// Show the libuv type instead of generic "userdata" +static int luv_handle_tostring(lua_State* L) { + uv_handle_t* handle = luv_check_handle(L, 1); + switch (handle->type) { +#define XX(uc, lc) case UV_##uc: lua_pushfstring(L, "uv_"#lc"_t: %p", handle); break; + UV_HANDLE_TYPE_MAP(XX) +#undef XX + default: lua_pushfstring(L, "uv_handle_t: %p", handle); break; + } + return 1; +} + +static int luv_is_active(lua_State* L) { + uv_handle_t* handle = luv_check_handle(L, 1); + int ret = uv_is_active(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushboolean(L, ret); + return 1; +} + +static int luv_is_closing(lua_State* L) { + uv_handle_t* handle = luv_check_handle(L, 1); + int ret = uv_is_closing(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushboolean(L, ret); + return 1; +} + +static void luv_close_cb(uv_handle_t* handle) { + lua_State* L = luv_state(handle->loop); + luv_handle_t* data = handle->data; + if (!data) return; + luv_call_callback(L, data, LUV_CLOSED, 0); + luv_cleanup_handle(L, data); + handle->data = NULL; +} + +static int luv_close(lua_State* L) { + uv_handle_t* handle = luv_check_handle(L, 1); + if (uv_is_closing(handle)) { + luaL_error(L, "handle %p is already closing", handle); + } + if (!lua_isnoneornil(L, 2)) { + luv_check_callback(L, handle->data, LUV_CLOSED, 2); + } + uv_close(handle, luv_close_cb); + return 0; +} + +static void luv_gc_cb(uv_handle_t* handle) { + luv_close_cb(handle); + free(handle); +} + +static int luv_handle_gc(lua_State* L) { + void** udata = lua_touserdata(L, 1); + uv_handle_t* handle = *udata; + if (handle != NULL) { + if (!uv_is_closing(handle)) + uv_close(handle, luv_gc_cb); + else + free(*udata); + + *udata = NULL; + } + + return 0; +} + +static int luv_ref(lua_State* L) { + uv_handle_t* handle = luv_check_handle(L, 1); + uv_ref(handle); + return 0; +} + +static int luv_unref(lua_State* L) { + uv_handle_t* handle = luv_check_handle(L, 1); + uv_unref(handle); + return 0; +} + +static int luv_has_ref(lua_State* L) { + uv_handle_t* handle = luv_check_handle(L, 1); + int ret = uv_has_ref(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushboolean(L, ret); + return 1; +} + +static int luv_send_buffer_size(lua_State* L) { + uv_handle_t* handle = luv_check_handle(L, 1); + int value; + int ret; + if (lua_isnoneornil(L, 2)) { + value = 0; + } + else { + value = luaL_checkinteger(L, 2); + } + ret = uv_send_buffer_size(handle, &value); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_recv_buffer_size(lua_State* L) { + uv_handle_t* handle = luv_check_handle(L, 1); + int value; + int ret; + if (lua_isnoneornil(L, 2)) { + value = 0; + } + else { + value = luaL_checkinteger(L, 2); + } + ret = uv_recv_buffer_size(handle, &value); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_fileno(lua_State* L) { + uv_handle_t* handle = luv_check_handle(L, 1); + uv_os_fd_t fd; + int ret = uv_fileno(handle, &fd); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, (LUA_INTEGER)(ptrdiff_t)fd); + return 1; +} diff --git a/3rdparty/luv/src/idle.c b/3rdparty/luv/src/idle.c new file mode 100644 index 00000000000..132cbe43c33 --- /dev/null +++ b/3rdparty/luv/src/idle.c @@ -0,0 +1,59 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static uv_idle_t* luv_check_idle(lua_State* L, int index) { + uv_idle_t* handle = luv_checkudata(L, index, "uv_idle"); + luaL_argcheck(L, handle->type == UV_IDLE && handle->data, index, "Expected uv_idle_t"); + return handle; +} + +static int luv_new_idle(lua_State* L) { + uv_idle_t* handle = luv_newuserdata(L, sizeof(*handle)); + int ret = uv_idle_init(luv_loop(L), handle); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static void luv_idle_cb(uv_idle_t* handle) { + lua_State* L = luv_state(handle->loop); + luv_handle_t* data = handle->data; + luv_call_callback(L, data, LUV_IDLE, 0); +} + +static int luv_idle_start(lua_State* L) { + uv_idle_t* handle = luv_check_idle(L, 1); + int ret; + luv_check_callback(L, handle->data, LUV_IDLE, 2); + ret = uv_idle_start(handle, luv_idle_cb); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_idle_stop(lua_State* L) { + uv_idle_t* handle = luv_check_idle(L, 1); + int ret = uv_idle_stop(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + diff --git a/3rdparty/luv/src/lhandle.c b/3rdparty/luv/src/lhandle.c new file mode 100644 index 00000000000..c8cf294504e --- /dev/null +++ b/3rdparty/luv/src/lhandle.c @@ -0,0 +1,116 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "lhandle.h" + +static luv_handle_t* luv_setup_handle(lua_State* L) { + luv_handle_t* data; + const uv_handle_t* handle = *(void**)lua_touserdata(L, -1); + luaL_checktype(L, -1, LUA_TUSERDATA); + + data = malloc(sizeof(*data)); + if (!data) luaL_error(L, "Can't allocate luv handle"); + + #define XX(uc, lc) case UV_##uc: \ + luaL_getmetatable(L, "uv_"#lc); \ + break; + switch (handle->type) { + UV_HANDLE_TYPE_MAP(XX) + default: + luaL_error(L, "Unknown handle type"); + return NULL; + } + #undef XX + + lua_setmetatable(L, -2); + + lua_pushvalue(L, -1); + + data->ref = luaL_ref(L, LUA_REGISTRYINDEX); + data->callbacks[0] = LUA_NOREF; + data->callbacks[1] = LUA_NOREF; + data->extra = NULL; + return data; +} + +static void luv_check_callback(lua_State* L, luv_handle_t* data, luv_callback_id id, int index) { + luaL_checktype(L, index, LUA_TFUNCTION); + luaL_unref(L, LUA_REGISTRYINDEX, data->callbacks[id]); + lua_pushvalue(L, index); + data->callbacks[id] = luaL_ref(L, LUA_REGISTRYINDEX); +} + +static int traceback (lua_State *L) { + if (!lua_isstring(L, 1)) /* 'message' not a string? */ + return 1; /* keep it intact */ + lua_pushglobaltable(L); + lua_getfield(L, -1, "debug"); + lua_remove(L, -2); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + return 1; + } + lua_getfield(L, -1, "traceback"); + if (!lua_isfunction(L, -1)) { + lua_pop(L, 2); + return 1; + } + lua_pushvalue(L, 1); /* pass error message */ + lua_pushinteger(L, 2); /* skip this function and traceback */ + lua_call(L, 2, 1); /* call debug.traceback */ + return 1; +} + +static void luv_call_callback(lua_State* L, luv_handle_t* data, luv_callback_id id, int nargs) { + int ref = data->callbacks[id]; + if (ref == LUA_NOREF) { + lua_pop(L, nargs); + } + else { + // Get the traceback function in case of error + lua_pushcfunction(L, traceback); + // And insert it before the args if there are any. + if (nargs) { + lua_insert(L, -1 - nargs); + } + // Get the callback + lua_rawgeti(L, LUA_REGISTRYINDEX, ref); + // And insert it before the args if there are any. + if (nargs) { + lua_insert(L, -1 - nargs); + } + + if (lua_pcall(L, nargs, 0, -2 - nargs)) { + fprintf(stderr, "Uncaught Error: %s\n", lua_tostring(L, -1)); + exit(-1); + } + // Remove the traceback function + lua_pop(L, 1); + } +} + +static void luv_cleanup_handle(lua_State* L, luv_handle_t* data) { + luaL_unref(L, LUA_REGISTRYINDEX, data->ref); + luaL_unref(L, LUA_REGISTRYINDEX, data->callbacks[0]); + luaL_unref(L, LUA_REGISTRYINDEX, data->callbacks[1]); + if (data->extra) + free(data->extra); + free(data); +} + +static void luv_find_handle(lua_State* L, luv_handle_t* data) { + lua_rawgeti(L, LUA_REGISTRYINDEX, data->ref); +} diff --git a/3rdparty/luv/src/lhandle.h b/3rdparty/luv/src/lhandle.h new file mode 100644 index 00000000000..f6c0733719b --- /dev/null +++ b/3rdparty/luv/src/lhandle.h @@ -0,0 +1,67 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#ifndef LUV_LHANDLE_H +#define LUV_LHANDLE_H + +#include "luv.h" + +/* There are two slots for holding callbacks. One is for the CLOSED event. + The other slot is for all others since they never conflict in practice. +*/ +#define luv_callback_id int +#define LUV_CLOSED 0 +#define LUV_TIMEOUT 1 +#define LUV_PREPARE 1 +#define LUV_IDLE 1 +#define LUV_CHECK 1 +#define LUV_ASYNC 1 +#define LUV_POLL 1 +#define LUV_SIGNAL 1 +#define LUV_EXIT 1 +#define LUV_CONNECTION 1 +#define LUV_READ 1 +#define LUV_RECV 1 +#define LUV_FS_EVENT 1 +#define LUV_FS_POLL 1 + +/* Ref for userdata and event callbacks */ +typedef struct { + int ref; + int callbacks[2]; + void* extra; +} luv_handle_t; + +/* Setup the handle at the top of the stack */ +static luv_handle_t* luv_setup_handle(lua_State* L); + +/* Store a lua callback in a luv_handle for future callbacks. + Either replace an existing callback by id or append a new one at the end. +*/ +static void luv_check_callback(lua_State* L, luv_handle_t* data, luv_callback_id id, int index); + +/* Lookup a function and call it with nargs + If there is no such function, pop the args. +*/ +static void luv_call_callback(lua_State* L, luv_handle_t* data, luv_callback_id id, int nargs); + +/* Push a userdata on the stack from a handle */ +static void luv_find_handle(lua_State* L, luv_handle_t* data); + +/* Recursivly free the luv_handle and all event handlers */ +static void luv_cleanup_handle(lua_State* L, luv_handle_t* data); + +#endif diff --git a/3rdparty/luv/src/loop.c b/3rdparty/luv/src/loop.c new file mode 100644 index 00000000000..33c49d3f64c --- /dev/null +++ b/3rdparty/luv/src/loop.c @@ -0,0 +1,92 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static int luv_loop_close(lua_State* L) { + int ret = uv_loop_close(luv_loop(L)); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +// These are the same order as uv_run_mode which also starts at 0 +static const char *const luv_runmodes[] = { + "default", "once", "nowait", NULL +}; + +static int luv_run(lua_State* L) { + int mode = luaL_checkoption(L, 1, "default", luv_runmodes); + int ret = uv_run(luv_loop(L), mode); + if (ret < 0) return luv_error(L, ret); + lua_pushboolean(L, ret); + return 1; +} + +static int luv_loop_alive(lua_State* L) { + int ret = uv_loop_alive(luv_loop(L)); + if (ret < 0) return luv_error(L, ret); + lua_pushboolean(L, ret); + return 1; +} + +static int luv_stop(lua_State* L) { + uv_stop(luv_loop(L)); + return 0; +} + +static int luv_backend_fd(lua_State* L) { + int ret = uv_backend_fd(luv_loop(L)); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_backend_timeout(lua_State* L) { + int ret = uv_backend_timeout(luv_loop(L)); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_now(lua_State* L) { + uint64_t now = uv_now(luv_loop(L)); + lua_pushinteger(L, now); + return 1; +} + +static int luv_update_time(lua_State* L) { + uv_update_time(luv_loop(L)); + return 0; +} + +static void luv_walk_cb(uv_handle_t* handle, void* arg) { + lua_State* L = arg; + luv_handle_t* data = handle->data; + + // Sanity check + // Most invalid values are large and refs are small, 0x1000000 is arbitrary. + assert(data && data->ref < 0x1000000); + + lua_pushvalue(L, 1); // Copy the function + luv_find_handle(L, data); // Get the userdata + lua_call(L, 1, 0); // Call the function +} + +static int luv_walk(lua_State* L) { + luaL_checktype(L, 1, LUA_TFUNCTION); + uv_walk(luv_loop(L), luv_walk_cb, L); + return 0; +} diff --git a/3rdparty/luv/src/lreq.c b/3rdparty/luv/src/lreq.c new file mode 100644 index 00000000000..38ed6a77eb0 --- /dev/null +++ b/3rdparty/luv/src/lreq.c @@ -0,0 +1,71 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "lreq.h" + + +static int luv_check_continuation(lua_State* L, int index) { + if (lua_isnoneornil(L, index)) return LUA_NOREF; + luaL_checktype(L, index, LUA_TFUNCTION); + lua_pushvalue(L, index); + return luaL_ref(L, LUA_REGISTRYINDEX); +} + +// Store a lua callback in a luv_req for the continuation. +// The uv_req_t is assumed to be at the top of the stack +static luv_req_t* luv_setup_req(lua_State* L, int callback_ref) { + luv_req_t* data; + + luaL_checktype(L, -1, LUA_TUSERDATA); + + data = malloc(sizeof(*data)); + if (!data) luaL_error(L, "Problem allocating luv request"); + + luaL_getmetatable(L, "uv_req"); + lua_setmetatable(L, -2); + + lua_pushvalue(L, -1); + data->req_ref = luaL_ref(L, LUA_REGISTRYINDEX); + data->callback_ref = callback_ref; + data->data_ref = LUA_NOREF; + data->data = NULL; + + return data; +} + + +static void luv_fulfill_req(lua_State* L, luv_req_t* data, int nargs) { + if (data->callback_ref == LUA_NOREF) { + lua_pop(L, nargs); + } + else { + // Get the callback + lua_rawgeti(L, LUA_REGISTRYINDEX, data->callback_ref); + // And insert it before the args if there are any. + if (nargs) { + lua_insert(L, -1 - nargs); + } + lua_call(L, nargs, 0); + } +} + +static void luv_cleanup_req(lua_State* L, luv_req_t* data) { + luaL_unref(L, LUA_REGISTRYINDEX, data->req_ref); + luaL_unref(L, LUA_REGISTRYINDEX, data->callback_ref); + luaL_unref(L, LUA_REGISTRYINDEX, data->data_ref); + free(data->data); + free(data); +} diff --git a/3rdparty/luv/src/lreq.h b/3rdparty/luv/src/lreq.h new file mode 100644 index 00000000000..a8b147e057b --- /dev/null +++ b/3rdparty/luv/src/lreq.h @@ -0,0 +1,43 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#ifndef LUV_LREQ_H +#define LUV_LREQ_H + +#include "luv.h" + +typedef struct { + int req_ref; /* ref for uv_req_t's userdata */ + int callback_ref; /* ref for callback */ + int data_ref; /* ref for write data */ + void* data; /* extra data */ +} luv_req_t; + +/* Used in the top of a setup function to check the arg + and ref the callback to an integer. +*/ +static int luv_check_continuation(lua_State* L, int index); + +/* setup a luv_req_t. The userdata is assumed to be at the + top of the stack. +*/ +static luv_req_t* luv_setup_req(lua_State* L, int ref); + +static void luv_fulfill_req(lua_State* L, luv_req_t* data, int nargs); + +static void luv_cleanup_req(lua_State* L, luv_req_t* data); + +#endif diff --git a/3rdparty/luv/src/lthreadpool.h b/3rdparty/luv/src/lthreadpool.h new file mode 100644 index 00000000000..0994746bc52 --- /dev/null +++ b/3rdparty/luv/src/lthreadpool.h @@ -0,0 +1,48 @@ +/* +* Copyright 2014 The Luvit Authors. All Rights Reserved. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +#ifndef LUV_LTHREADPOOL_H +#define LUV_LTHREADPOOL_H + +#include "luv.h" + +#define LUV_THREAD_MAXNUM_ARG 9 + +typedef struct { + /* only support LUA_TNIL, LUA_TBOOLEAN, LUA_TLIGHTUSERDATA, LUA_TNUMBER, LUA_TSTRING*/ + int type; + union + { + lua_Number num; + int boolean; + void* userdata; + struct { + const char* base; + size_t len; + } str; + } val; +} luv_val_t; + +typedef struct { + int argc; + luv_val_t argv[LUV_THREAD_MAXNUM_ARG]; +} luv_thread_arg_t; + +static int luv_thread_arg_set(lua_State* L, luv_thread_arg_t* args, int idx, int top, int flag); +static int luv_thread_arg_push(lua_State* L, const luv_thread_arg_t* args); +static void luv_thread_arg_clear(luv_thread_arg_t* args); + +#endif //LUV_LTHREADPOOL_H diff --git a/3rdparty/luv/src/luv.c b/3rdparty/luv/src/luv.c new file mode 100644 index 00000000000..7b552d68d53 --- /dev/null +++ b/3rdparty/luv/src/luv.c @@ -0,0 +1,519 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "luv.h" +#include "util.c" +#include "lhandle.c" +#include "lreq.c" +#include "loop.c" +#include "req.c" +#include "handle.c" +#include "timer.c" +#include "prepare.c" +#include "check.c" +#include "idle.c" +#include "async.c" +#include "poll.c" +#include "signal.c" +#include "process.c" +#include "stream.c" +#include "tcp.c" +#include "pipe.c" +#include "tty.c" +#include "udp.c" +#include "fs_event.c" +#include "fs_poll.c" +#include "fs.c" +#include "dns.c" +#include "thread.c" +#include "work.c" +#include "misc.c" +#include "constants.c" + +static const luaL_Reg luv_functions[] = { + // loop.c + {"loop_close", luv_loop_close}, + {"run", luv_run}, + {"loop_alive", luv_loop_alive}, + {"stop", luv_stop}, + {"backend_fd", luv_backend_fd}, + {"backend_timeout", luv_backend_timeout}, + {"now", luv_now}, + {"update_time", luv_update_time}, + {"walk", luv_walk}, + + // req.c + {"cancel", luv_cancel}, + + // handle.c + {"is_active", luv_is_active}, + {"is_closing", luv_is_closing}, + {"close", luv_close}, + {"ref", luv_ref}, + {"unref", luv_unref}, + {"has_ref", luv_has_ref}, + {"send_buffer_size", luv_send_buffer_size}, + {"recv_buffer_size", luv_recv_buffer_size}, + {"fileno", luv_fileno}, + + // timer.c + {"new_timer", luv_new_timer}, + {"timer_start", luv_timer_start}, + {"timer_stop", luv_timer_stop}, + {"timer_again", luv_timer_again}, + {"timer_set_repeat", luv_timer_set_repeat}, + {"timer_get_repeat", luv_timer_get_repeat}, + + // prepare.c + {"new_prepare", luv_new_prepare}, + {"prepare_start", luv_prepare_start}, + {"prepare_stop", luv_prepare_stop}, + + // check.c + {"new_check", luv_new_check}, + {"check_start", luv_check_start}, + {"check_stop", luv_check_stop}, + + // idle.c + {"new_idle", luv_new_idle}, + {"idle_start", luv_idle_start}, + {"idle_stop", luv_idle_stop}, + + // async.c + {"new_async", luv_new_async}, + {"async_send", luv_async_send}, + + // poll.c + {"new_poll", luv_new_poll}, + {"new_socket_poll", luv_new_socket_poll}, + {"poll_start", luv_poll_start}, + {"poll_stop", luv_poll_stop}, + + // signal.c + {"new_signal", luv_new_signal}, + {"signal_start", luv_signal_start}, + {"signal_stop", luv_signal_stop}, + + // process.c + {"disable_stdio_inheritance", luv_disable_stdio_inheritance}, + {"spawn", luv_spawn}, + {"process_kill", luv_process_kill}, + {"kill", luv_kill}, + + // stream.c + {"shutdown", luv_shutdown}, + {"listen", luv_listen}, + {"accept", luv_accept}, + {"read_start", luv_read_start}, + {"read_stop", luv_read_stop}, + {"write", luv_write}, + {"write2", luv_write2}, + {"try_write", luv_try_write}, + {"is_readable", luv_is_readable}, + {"is_writable", luv_is_writable}, + {"stream_set_blocking", luv_stream_set_blocking}, + + // tcp.c + {"new_tcp", luv_new_tcp}, + {"tcp_open", luv_tcp_open}, + {"tcp_nodelay", luv_tcp_nodelay}, + {"tcp_keepalive", luv_tcp_keepalive}, + {"tcp_simultaneous_accepts", luv_tcp_simultaneous_accepts}, + {"tcp_bind", luv_tcp_bind}, + {"tcp_getpeername", luv_tcp_getpeername}, + {"tcp_getsockname", luv_tcp_getsockname}, + {"tcp_connect", luv_tcp_connect}, + {"tcp_write_queue_size", luv_write_queue_size}, + + // pipe.c + {"new_pipe", luv_new_pipe}, + {"pipe_open", luv_pipe_open}, + {"pipe_bind", luv_pipe_bind}, + {"pipe_connect", luv_pipe_connect}, + {"pipe_getsockname", luv_pipe_getsockname}, + {"pipe_getpeername", luv_pipe_getpeername}, + {"pipe_pending_instances", luv_pipe_pending_instances}, + {"pipe_pending_count", luv_pipe_pending_count}, + {"pipe_pending_type", luv_pipe_pending_type}, + + // tty.c + {"new_tty", luv_new_tty}, + {"tty_set_mode", luv_tty_set_mode}, + {"tty_reset_mode", luv_tty_reset_mode}, + {"tty_get_winsize", luv_tty_get_winsize}, + + // udp.c + {"new_udp", luv_new_udp}, + {"udp_open", luv_udp_open}, + {"udp_bind", luv_udp_bind}, + {"udp_getsockname", luv_udp_getsockname}, + {"udp_set_membership", luv_udp_set_membership}, + {"udp_set_multicast_loop", luv_udp_set_multicast_loop}, + {"udp_set_multicast_ttl", luv_udp_set_multicast_ttl}, + {"udp_set_multicast_interface", luv_udp_set_multicast_interface}, + {"udp_set_broadcast", luv_udp_set_broadcast}, + {"udp_set_ttl", luv_udp_set_ttl}, + {"udp_send", luv_udp_send}, + {"udp_try_send", luv_udp_try_send}, + {"udp_recv_start", luv_udp_recv_start}, + {"udp_recv_stop", luv_udp_recv_stop}, + + // fs_event.c + {"new_fs_event", luv_new_fs_event}, + {"fs_event_start", luv_fs_event_start}, + {"fs_event_stop", luv_fs_event_stop}, + {"fs_event_getpath", luv_fs_event_getpath}, + + // fs_poll.c + {"new_fs_poll", luv_new_fs_poll}, + {"fs_poll_start", luv_fs_poll_start}, + {"fs_poll_stop", luv_fs_poll_stop}, + {"fs_poll_getpath", luv_fs_poll_getpath}, + + // fs.c + {"fs_close", luv_fs_close}, + {"fs_open", luv_fs_open}, + {"fs_read", luv_fs_read}, + {"fs_unlink", luv_fs_unlink}, + {"fs_write", luv_fs_write}, + {"fs_mkdir", luv_fs_mkdir}, + {"fs_mkdtemp", luv_fs_mkdtemp}, + {"fs_rmdir", luv_fs_rmdir}, + {"fs_scandir", luv_fs_scandir}, + {"fs_scandir_next", luv_fs_scandir_next}, + {"fs_stat", luv_fs_stat}, + {"fs_fstat", luv_fs_fstat}, + {"fs_lstat", luv_fs_lstat}, + {"fs_rename", luv_fs_rename}, + {"fs_fsync", luv_fs_fsync}, + {"fs_fdatasync", luv_fs_fdatasync}, + {"fs_ftruncate", luv_fs_ftruncate}, + {"fs_sendfile", luv_fs_sendfile}, + {"fs_access", luv_fs_access}, + {"fs_chmod", luv_fs_chmod}, + {"fs_fchmod", luv_fs_fchmod}, + {"fs_utime", luv_fs_utime}, + {"fs_futime", luv_fs_futime}, + {"fs_link", luv_fs_link}, + {"fs_symlink", luv_fs_symlink}, + {"fs_readlink", luv_fs_readlink}, + {"fs_realpath", luv_fs_realpath}, + {"fs_chown", luv_fs_chown}, + {"fs_fchown", luv_fs_fchown}, + + // dns.c + {"getaddrinfo", luv_getaddrinfo}, + {"getnameinfo", luv_getnameinfo}, + + // misc.c + {"chdir", luv_chdir}, + {"os_homedir", luv_os_homedir}, + {"cpu_info", luv_cpu_info}, + {"cwd", luv_cwd}, + {"exepath", luv_exepath}, + {"get_process_title", luv_get_process_title}, + {"get_total_memory", luv_get_total_memory}, + {"get_free_memory", luv_get_free_memory}, + {"getpid", luv_getpid}, +#ifndef _WIN32 + {"getuid", luv_getuid}, + {"setuid", luv_setuid}, + {"getgid", luv_getgid}, + {"setgid", luv_setgid}, +#endif + {"getrusage", luv_getrusage}, + {"guess_handle", luv_guess_handle}, + {"hrtime", luv_hrtime}, + {"interface_addresses", luv_interface_addresses}, + {"loadavg", luv_loadavg}, + {"resident_set_memory", luv_resident_set_memory}, + {"set_process_title", luv_set_process_title}, + {"uptime", luv_uptime}, + {"version", luv_version}, + {"version_string", luv_version_string}, + + // thread.c + {"new_thread", luv_new_thread}, + {"thread_equal", luv_thread_equal}, + {"thread_self", luv_thread_self}, + {"thread_join", luv_thread_join}, + {"sleep", luv_thread_sleep}, + + // work.c + {"new_work", luv_new_work}, + {"queue_work", luv_queue_work}, + + {NULL, NULL} +}; + +static const luaL_Reg luv_handle_methods[] = { + // handle.c + {"is_active", luv_is_active}, + {"is_closing", luv_is_closing}, + {"close", luv_close}, + {"ref", luv_ref}, + {"unref", luv_unref}, + {"has_ref", luv_has_ref}, + {"send_buffer_size", luv_send_buffer_size}, + {"recv_buffer_size", luv_recv_buffer_size}, + {"fileno", luv_fileno}, + {NULL, NULL} +}; + +static const luaL_Reg luv_async_methods[] = { + {"send", luv_async_send}, + {NULL, NULL} +}; + +static const luaL_Reg luv_check_methods[] = { + {"start", luv_check_start}, + {"stop", luv_check_stop}, + {NULL, NULL} +}; + +static const luaL_Reg luv_fs_event_methods[] = { + {"start", luv_fs_event_start}, + {"stop", luv_fs_event_stop}, + {"getpath", luv_fs_event_getpath}, + {NULL, NULL} +}; + +static const luaL_Reg luv_fs_poll_methods[] = { + {"start", luv_fs_poll_start}, + {"stop", luv_fs_poll_stop}, + {"getpath", luv_fs_poll_getpath}, + {NULL, NULL} +}; + +static const luaL_Reg luv_idle_methods[] = { + {"start", luv_idle_start}, + {"stop", luv_idle_stop}, + {NULL, NULL} +}; + +static const luaL_Reg luv_stream_methods[] = { + {"shutdown", luv_shutdown}, + {"listen", luv_listen}, + {"accept", luv_accept}, + {"read_start", luv_read_start}, + {"read_stop", luv_read_stop}, + {"write", luv_write}, + {"write2", luv_write2}, + {"try_write", luv_try_write}, + {"is_readable", luv_is_readable}, + {"is_writable", luv_is_writable}, + {"set_blocking", luv_stream_set_blocking}, + {NULL, NULL} +}; + +static const luaL_Reg luv_pipe_methods[] = { + {"open", luv_pipe_open}, + {"bind", luv_pipe_bind}, + {"connect", luv_pipe_connect}, + {"getsockname", luv_pipe_getsockname}, + {"getpeername", luv_pipe_getpeername}, + {"pending_instances", luv_pipe_pending_instances}, + {"pending_count", luv_pipe_pending_count}, + {"pending_type", luv_pipe_pending_type}, + {NULL, NULL} +}; + +static const luaL_Reg luv_poll_methods[] = { + {"start", luv_poll_start}, + {"stop", luv_poll_stop}, + {NULL, NULL} +}; + +static const luaL_Reg luv_prepare_methods[] = { + {"start", luv_prepare_start}, + {"stop", luv_prepare_stop}, + {NULL, NULL} +}; + +static const luaL_Reg luv_process_methods[] = { + {"kill", luv_process_kill}, + {NULL, NULL} +}; + +static const luaL_Reg luv_tcp_methods[] = { + {"open", luv_tcp_open}, + {"nodelay", luv_tcp_nodelay}, + {"keepalive", luv_tcp_keepalive}, + {"simultaneous_accepts", luv_tcp_simultaneous_accepts}, + {"bind", luv_tcp_bind}, + {"getpeername", luv_tcp_getpeername}, + {"getsockname", luv_tcp_getsockname}, + {"connect", luv_tcp_connect}, + {"write_queue_size", luv_write_queue_size}, + {NULL, NULL} +}; + +static const luaL_Reg luv_timer_methods[] = { + {"start", luv_timer_start}, + {"stop", luv_timer_stop}, + {"again", luv_timer_again}, + {"set_repeat", luv_timer_set_repeat}, + {"get_repeat", luv_timer_get_repeat}, + {NULL, NULL} +}; + +static const luaL_Reg luv_tty_methods[] = { + {"set_mode", luv_tty_set_mode}, + {"get_winsize", luv_tty_get_winsize}, + {NULL, NULL} +}; + +static const luaL_Reg luv_udp_methods[] = { + {"open", luv_udp_open}, + {"bind", luv_udp_bind}, + {"bindgetsockname", luv_udp_getsockname}, + {"set_membership", luv_udp_set_membership}, + {"set_multicast_loop", luv_udp_set_multicast_loop}, + {"set_multicast_ttl", luv_udp_set_multicast_ttl}, + {"set_multicast_interface", luv_udp_set_multicast_interface}, + {"set_broadcast", luv_udp_set_broadcast}, + {"set_ttl", luv_udp_set_ttl}, + {"send", luv_udp_send}, + {"try_send", luv_udp_try_send}, + {"recv_start", luv_udp_recv_start}, + {"recv_stop", luv_udp_recv_stop}, + {NULL, NULL} +}; + +static const luaL_Reg luv_signal_methods[] = { + {"start", luv_signal_start}, + {"stop", luv_signal_stop}, + {NULL, NULL} +}; + +static void luv_handle_init(lua_State* L) { + + lua_newtable(L); +#define XX(uc, lc) \ + luaL_newmetatable (L, "uv_"#lc); \ + lua_pushcfunction(L, luv_handle_tostring); \ + lua_setfield(L, -2, "__tostring"); \ + lua_pushcfunction(L, luv_handle_gc); \ + lua_setfield(L, -2, "__gc"); \ + luaL_newlib(L, luv_##lc##_methods); \ + luaL_setfuncs(L, luv_handle_methods, 0); \ + lua_setfield(L, -2, "__index"); \ + lua_pushboolean(L, 1); \ + lua_rawset(L, -3); + + UV_HANDLE_TYPE_MAP(XX) +#undef XX + lua_setfield(L, LUA_REGISTRYINDEX, "uv_handle"); + + lua_newtable(L); + + luaL_getmetatable(L, "uv_pipe"); + lua_getfield(L, -1, "__index"); + luaL_setfuncs(L, luv_stream_methods, 0); + lua_pop(L, 1); + lua_pushboolean(L, 1); + lua_rawset(L, -3); + + luaL_getmetatable(L, "uv_tcp"); + lua_getfield(L, -1, "__index"); + luaL_setfuncs(L, luv_stream_methods, 0); + lua_pop(L, 1); + lua_pushboolean(L, 1); + lua_rawset(L, -3); + + luaL_getmetatable(L, "uv_tty"); + lua_getfield(L, -1, "__index"); + luaL_setfuncs(L, luv_stream_methods, 0); + lua_pop(L, 1); + lua_pushboolean(L, 1); + lua_rawset(L, -3); + + lua_setfield(L, LUA_REGISTRYINDEX, "uv_stream"); +} + +LUALIB_API lua_State* luv_state(uv_loop_t* loop) { + return loop->data; +} + +// TODO: find out if storing this somehow in an upvalue is faster +LUALIB_API uv_loop_t* luv_loop(lua_State* L) { + uv_loop_t* loop; + lua_pushstring(L, "uv_loop"); + lua_rawget(L, LUA_REGISTRYINDEX); + loop = lua_touserdata(L, -1); + lua_pop(L, 1); + return loop; +} + +static void walk_cb(uv_handle_t *handle, void *arg) +{ + (void)arg; + if (!uv_is_closing(handle)) { + uv_close(handle, luv_close_cb); + } +} + +static int loop_gc(lua_State *L) { + uv_loop_t* loop = luv_loop(L); + // Call uv_close on every active handle + uv_walk(loop, walk_cb, NULL); + // Run the event loop until all handles are successfully closed + while (uv_loop_close(loop)) { + uv_run(loop, UV_RUN_DEFAULT); + } + return 0; +} + +LUALIB_API int luaopen_luv (lua_State *L) { + + uv_loop_t* loop; + int ret; + + // Setup the uv_loop meta table for a proper __gc + luaL_newmetatable(L, "uv_loop.meta"); + lua_pushstring(L, "__gc"); + lua_pushcfunction(L, loop_gc); + lua_settable(L, -3); + + loop = lua_newuserdata(L, sizeof(*loop)); + ret = uv_loop_init(loop); + if (ret < 0) { + return luaL_error(L, "%s: %s\n", uv_err_name(ret), uv_strerror(ret)); + } + // setup the metatable for __gc + luaL_getmetatable(L, "uv_loop.meta"); + lua_setmetatable(L, -2); + // Tell the state how to find the loop. + lua_pushstring(L, "uv_loop"); + lua_insert(L, -2); + lua_rawset(L, LUA_REGISTRYINDEX); + lua_pop(L, 1); + + // Tell the loop how to find the state. + loop->data = L; + + luv_req_init(L); + luv_handle_init(L); + luv_thread_init(L); + luv_work_init(L); + + luaL_newlib(L, luv_functions); + luv_constants(L); + lua_setfield(L, -2, "constants"); + + return 1; +} diff --git a/3rdparty/luv/src/luv.h b/3rdparty/luv/src/luv.h new file mode 100644 index 00000000000..681384da363 --- /dev/null +++ b/3rdparty/luv/src/luv.h @@ -0,0 +1,109 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#ifndef LUV_H +#define LUV_H +#include +#include +#include +#include "uv.h" + +#include +#include +#include + +#if defined(_WIN32) +# include +# include +# include +# ifndef __MINGW32__ +# define S_ISREG(x) (((x) & _S_IFMT) == _S_IFREG) +# define S_ISDIR(x) (((x) & _S_IFMT) == _S_IFDIR) +# define S_ISFIFO(x) (((x) & _S_IFMT) == _S_IFIFO) +# define S_ISCHR(x) (((x) & _S_IFMT) == _S_IFCHR) +# define S_ISBLK(x) 0 +# endif +# define S_ISLNK(x) (((x) & S_IFLNK) == S_IFLNK) +# define S_ISSOCK(x) 0 +#else +# include +#endif + +#ifndef PATH_MAX +#define PATH_MAX (8096) +#endif + +#ifndef MAX_TITLE_LENGTH +#define MAX_TITLE_LENGTH (8192) +#endif + +#if LUA_VERSION_NUM < 502 +# define lua_rawlen lua_objlen +/* lua_...uservalue: Something very different, but it should get the job done */ +# define lua_getuservalue lua_getfenv +# define lua_setuservalue lua_setfenv +# define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) +# define luaL_setfuncs(L,l,n) (assert(n==0), luaL_register(L,NULL,l)) +# define lua_resume(L,F,n) lua_resume(L,n) +# define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX) +#endif + +/* There is a 1-1 relation between a lua_State and a uv_loop_t + These helpers will give you one if you have the other + These are exposed for extensions built with luv + This allows luv to be used in multithreaded applications. +*/ +LUALIB_API lua_State* luv_state(uv_loop_t* loop); +/* All libuv callbacks will lua_call directly from this root-per-thread state +*/ +LUALIB_API uv_loop_t* luv_loop(lua_State* L); + +/* This is the main hook to load the library. + This can be called multiple times in a process as long + as you use a different lua_State and thread for each. +*/ +LUALIB_API int luaopen_luv (lua_State *L); + +#include "util.h" +#include "lhandle.h" +#include "lreq.h" + +/* From stream.c */ +static uv_stream_t* luv_check_stream(lua_State* L, int index); +static void luv_alloc_cb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf); +static void luv_check_buf(lua_State *L, int idx, uv_buf_t *pbuf); +static uv_buf_t* luv_prep_bufs(lua_State* L, int index, size_t *count); + +/* from tcp.c */ +static void parse_sockaddr(lua_State* L, struct sockaddr_storage* address, int addrlen); +static void luv_connect_cb(uv_connect_t* req, int status); + +/* From fs.c */ +static void luv_push_stats_table(lua_State* L, const uv_stat_t* s); + +/* from constants.c */ +static int luv_af_string_to_num(const char* string); +static const char* luv_af_num_to_string(const int num); +static int luv_sock_string_to_num(const char* string); +static const char* luv_sock_num_to_string(const int num); +static int luv_sig_string_to_num(const char* string); +static const char* luv_sig_num_to_string(const int num); + +typedef lua_State* (*luv_acquire_vm)(); +typedef void (*luv_release_vm)(lua_State* L); +LUALIB_API void luv_set_thread_cb(luv_acquire_vm acquire, luv_release_vm release); + +#endif diff --git a/3rdparty/luv/src/misc.c b/3rdparty/luv/src/misc.c new file mode 100644 index 00000000000..64c9e3d5822 --- /dev/null +++ b/3rdparty/luv/src/misc.c @@ -0,0 +1,316 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "luv.h" +#ifdef _WIN32 +#include +#endif + +static int luv_guess_handle(lua_State* L) { + uv_file file = luaL_checkinteger(L, 1); + switch (uv_guess_handle(file)) { +#define XX(uc, lc) case UV_##uc: lua_pushstring(L, #lc); break; + UV_HANDLE_TYPE_MAP(XX) +#undef XX + case UV_FILE: lua_pushstring(L, "file"); break; + default: return 0; + } + return 1; +} + +static int luv_version(lua_State* L) { + lua_pushinteger(L, uv_version()); + return 1; +} + +static int luv_version_string(lua_State* L) { + lua_pushstring(L, uv_version_string()); + return 1; +} + +static int luv_get_process_title(lua_State* L) { + char title[MAX_TITLE_LENGTH]; + int ret = uv_get_process_title(title, MAX_TITLE_LENGTH); + if (ret < 0) return luv_error(L, ret); + lua_pushstring(L, title); + return 1; +} + +static int luv_set_process_title(lua_State* L) { + const char* title = luaL_checkstring(L, 1); + int ret = uv_set_process_title(title); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_resident_set_memory(lua_State* L) { + size_t rss; + int ret = uv_resident_set_memory(&rss); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, rss); + return 1; +} + +static int luv_uptime(lua_State* L) { + double uptime; + int ret = uv_uptime(&uptime); + if (ret < 0) return luv_error(L, ret); + lua_pushnumber(L, uptime); + return 1; +} + +static void luv_push_timeval_table(lua_State* L, const uv_timeval_t* t) { + lua_createtable(L, 0, 2); + lua_pushinteger(L, t->tv_sec); + lua_setfield(L, -2, "sec"); + lua_pushinteger(L, t->tv_usec); + lua_setfield(L, -2, "usec"); +} + +static int luv_getrusage(lua_State* L) { + uv_rusage_t rusage; + int ret = uv_getrusage(&rusage); + if (ret < 0) return luv_error(L, ret); + lua_createtable(L, 0, 16); + // user CPU time used + luv_push_timeval_table(L, &rusage.ru_utime); + lua_setfield(L, -2, "utime"); + // system CPU time used + luv_push_timeval_table(L, &rusage.ru_stime); + lua_setfield(L, -2, "stime"); + // maximum resident set size + lua_pushinteger(L, rusage.ru_maxrss); + lua_setfield(L, -2, "maxrss"); + // integral shared memory size + lua_pushinteger(L, rusage.ru_ixrss); + lua_setfield(L, -2, "ixrss"); + // integral unshared data size + lua_pushinteger(L, rusage.ru_idrss); + lua_setfield(L, -2, "idrss"); + // integral unshared stack size + lua_pushinteger(L, rusage.ru_isrss); + lua_setfield(L, -2, "isrss"); + // page reclaims (soft page faults) + lua_pushinteger(L, rusage.ru_minflt); + lua_setfield(L, -2, "minflt"); + // page faults (hard page faults) + lua_pushinteger(L, rusage.ru_majflt); + lua_setfield(L, -2, "majflt"); + // swaps + lua_pushinteger(L, rusage.ru_nswap); + lua_setfield(L, -2, "nswap"); + // block input operations + lua_pushinteger(L, rusage.ru_inblock); + lua_setfield(L, -2, "inblock"); + // block output operations + lua_pushinteger(L, rusage.ru_oublock); + lua_setfield(L, -2, "oublock"); + // IPC messages sent + lua_pushinteger(L, rusage.ru_msgsnd); + lua_setfield(L, -2, "msgsnd"); + // IPC messages received + lua_pushinteger(L, rusage.ru_msgrcv); + lua_setfield(L, -2, "msgrcv"); + // signals received + lua_pushinteger(L, rusage.ru_nsignals); + lua_setfield(L, -2, "nsignals"); + // voluntary context switches + lua_pushinteger(L, rusage.ru_nvcsw); + lua_setfield(L, -2, "nvcsw"); + // involuntary context switches + lua_pushinteger(L, rusage.ru_nivcsw); + lua_setfield(L, -2, "nivcsw"); + return 1; +} + +static int luv_cpu_info(lua_State* L) { + uv_cpu_info_t* cpu_infos; + int count, i; + int ret = uv_cpu_info(&cpu_infos, &count); + if (ret < 0) return luv_error(L, ret); + lua_newtable(L); + + for (i = 0; i < count; i++) { + lua_newtable(L); + lua_pushstring(L, cpu_infos[i].model); + lua_setfield(L, -2, "model"); + lua_pushnumber(L, cpu_infos[i].speed); + lua_setfield(L, -2, "speed"); + lua_newtable(L); + lua_pushnumber(L, cpu_infos[i].cpu_times.user); + lua_setfield(L, -2, "user"); + lua_pushnumber(L, cpu_infos[i].cpu_times.nice); + lua_setfield(L, -2, "nice"); + lua_pushnumber(L, cpu_infos[i].cpu_times.sys); + lua_setfield(L, -2, "sys"); + lua_pushnumber(L, cpu_infos[i].cpu_times.idle); + lua_setfield(L, -2, "idle"); + lua_pushnumber(L, cpu_infos[i].cpu_times.irq); + lua_setfield(L, -2, "irq"); + lua_setfield(L, -2, "times"); + lua_rawseti(L, -2, i + 1); + } + + uv_free_cpu_info(cpu_infos, count); + return 1; +} + +static int luv_interface_addresses(lua_State* L) { + uv_interface_address_t* interfaces; + int count, i; + char ip[INET6_ADDRSTRLEN]; + char netmask[INET6_ADDRSTRLEN]; + + uv_interface_addresses(&interfaces, &count); + + lua_newtable(L); + + for (i = 0; i < count; i++) { + lua_getfield(L, -1, interfaces[i].name); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + lua_newtable(L); + lua_pushvalue(L, -1); + lua_setfield(L, -3, interfaces[i].name); + } + lua_newtable(L); + lua_pushboolean(L, interfaces[i].is_internal); + lua_setfield(L, -2, "internal"); + + lua_pushlstring(L, interfaces[i].phys_addr, sizeof(interfaces[i].phys_addr)); + lua_setfield(L, -2, "mac"); + + if (interfaces[i].address.address4.sin_family == AF_INET) { + uv_ip4_name(&interfaces[i].address.address4, ip, sizeof(ip)); + uv_ip4_name(&interfaces[i].netmask.netmask4, netmask, sizeof(netmask)); + } else if (interfaces[i].address.address4.sin_family == AF_INET6) { + uv_ip6_name(&interfaces[i].address.address6, ip, sizeof(ip)); + uv_ip6_name(&interfaces[i].netmask.netmask6, netmask, sizeof(netmask)); + } else { + strncpy(ip, "", INET6_ADDRSTRLEN); + strncpy(netmask, "", INET6_ADDRSTRLEN); + } + lua_pushstring(L, ip); + lua_setfield(L, -2, "ip"); + lua_pushstring(L, netmask); + lua_setfield(L, -2, "netmask"); + + lua_pushstring(L, luv_af_num_to_string(interfaces[i].address.address4.sin_family)); + lua_setfield(L, -2, "family"); + lua_rawseti(L, -2, lua_rawlen (L, -2) + 1); + lua_pop(L, 1); + } + uv_free_interface_addresses(interfaces, count); + return 1; +} + +static int luv_loadavg(lua_State* L) { + double avg[3]; + uv_loadavg(avg); + lua_pushnumber(L, avg[0]); + lua_pushnumber(L, avg[1]); + lua_pushnumber(L, avg[2]); + return 3; +} + +static int luv_exepath(lua_State* L) { + size_t size = 2*PATH_MAX; + char exe_path[2*PATH_MAX]; + int ret = uv_exepath(exe_path, &size); + if (ret < 0) return luv_error(L, ret); + lua_pushlstring(L, exe_path, size); + return 1; +} + +static int luv_cwd(lua_State* L) { + size_t size = 2*PATH_MAX; + char path[2*PATH_MAX]; + int ret = uv_cwd(path, &size); + if (ret < 0) return luv_error(L, ret); + lua_pushlstring(L, path, size); + return 1; +} + +static int luv_chdir(lua_State* L) { + int ret = uv_chdir(luaL_checkstring(L, 1)); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_os_homedir(lua_State* L) { + size_t size = 2*PATH_MAX; + char homedir[2*PATH_MAX]; + int ret = uv_os_homedir(homedir, &size); + if (ret < 0) return luv_error(L, ret); + lua_pushlstring(L, homedir, size); + return 1; +} + +static int luv_get_total_memory(lua_State* L) { + lua_pushnumber(L, uv_get_total_memory()); + return 1; +} + +static int luv_get_free_memory(lua_State* L) { + lua_pushnumber(L, uv_get_free_memory()); + return 1; +} + +static int luv_hrtime(lua_State* L) { + lua_pushnumber(L, uv_hrtime()); + return 1; +} + +static int luv_getpid(lua_State* L){ + int pid = getpid(); + lua_pushinteger(L, pid); + return 1; +} + +#ifndef _WIN32 +static int luv_getuid(lua_State* L){ + int uid = getuid(); + lua_pushinteger(L, uid); + return 1; +} + +static int luv_getgid(lua_State* L){ + int gid = getgid(); + lua_pushinteger(L, gid); + return 1; +} + +static int luv_setuid(lua_State* L){ + int uid = luaL_checkinteger(L, 1); + int r = setuid(uid); + if (-1 == r) { + luaL_error(L, "Error setting UID"); + } + return 0; +} + +static int luv_setgid(lua_State* L){ + int gid = luaL_checkinteger(L, 1); + int r = setgid(gid); + if (-1 == r) { + luaL_error(L, "Error setting GID"); + } + return 0; +} +#endif diff --git a/3rdparty/luv/src/pipe.c b/3rdparty/luv/src/pipe.c new file mode 100644 index 00000000000..b490c1597b3 --- /dev/null +++ b/3rdparty/luv/src/pipe.c @@ -0,0 +1,114 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static uv_pipe_t* luv_check_pipe(lua_State* L, int index) { + uv_pipe_t* handle = luv_checkudata(L, index, "uv_pipe"); + luaL_argcheck(L, handle->type == UV_NAMED_PIPE && handle->data, index, "Expected uv_pipe_t"); + return handle; +} + +static int luv_new_pipe(lua_State* L) { + uv_pipe_t* handle; + int ipc, ret; + luaL_checktype(L, 1, LUA_TBOOLEAN); + ipc = lua_toboolean(L, 1); + handle = luv_newuserdata(L, sizeof(*handle)); + ret = uv_pipe_init(luv_loop(L), handle, ipc); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static int luv_pipe_open(lua_State* L) { + uv_pipe_t* handle = luv_check_pipe(L, 1); + uv_file file = luaL_checkinteger(L, 2); + int ret = uv_pipe_open(handle, file); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_pipe_bind(lua_State* L) { + uv_pipe_t* handle = luv_check_pipe(L, 1); + const char* name = luaL_checkstring(L, 2); + int ret = uv_pipe_bind(handle, name); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_pipe_connect(lua_State* L) { + uv_pipe_t* handle = luv_check_pipe(L, 1); + const char* name = luaL_checkstring(L, 2); + int ref = luv_check_continuation(L, 3); + uv_connect_t* req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + uv_pipe_connect(req, handle, name, luv_connect_cb); + return 1; +} + +static int luv_pipe_getsockname(lua_State* L) { + uv_pipe_t* handle = luv_check_pipe(L, 1); + size_t len = 2*PATH_MAX; + char buf[2*PATH_MAX]; + int ret = uv_pipe_getsockname(handle, buf, &len); + if (ret < 0) return luv_error(L, ret); + lua_pushlstring(L, buf, len); + return 1; +} + +static int luv_pipe_getpeername(lua_State* L) { + uv_pipe_t* handle = luv_check_pipe(L, 1); + size_t len = 2*PATH_MAX; + char buf[2*PATH_MAX]; + int ret = uv_pipe_getpeername(handle, buf, &len); + if (ret < 0) return luv_error(L, ret); + lua_pushlstring(L, buf, len); + return 1; +} + +static int luv_pipe_pending_instances(lua_State* L) { + uv_pipe_t* handle = luv_check_pipe(L, 1); + int count = luaL_checkinteger(L, 2); + uv_pipe_pending_instances(handle, count); + return 0; +} + +static int luv_pipe_pending_count(lua_State* L) { + uv_pipe_t* handle = luv_check_pipe(L, 1); + lua_pushinteger(L, uv_pipe_pending_count(handle)); + return 1; +} + +static int luv_pipe_pending_type(lua_State* L) { + uv_pipe_t* handle = luv_check_pipe(L, 1); + uv_handle_type type = uv_pipe_pending_type(handle); + const char* type_name; + switch (type) { +#define XX(uc, lc) \ + case UV_##uc: type_name = #lc; break; + UV_HANDLE_TYPE_MAP(XX) +#undef XX + default: return 0; + } + lua_pushstring(L, type_name); + return 1; +} diff --git a/3rdparty/luv/src/poll.c b/3rdparty/luv/src/poll.c new file mode 100644 index 00000000000..e007c9f9634 --- /dev/null +++ b/3rdparty/luv/src/poll.c @@ -0,0 +1,100 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static uv_poll_t* luv_check_poll(lua_State* L, int index) { + uv_poll_t* handle = luv_checkudata(L, index, "uv_poll"); + luaL_argcheck(L, handle->type == UV_POLL && handle->data, index, "Expected uv_poll_t"); + return handle; +} + +static int luv_new_poll(lua_State* L) { + int fd = luaL_checkinteger(L, 1); + uv_poll_t* handle = luv_newuserdata(L, sizeof(*handle)); + int ret = uv_poll_init(luv_loop(L), handle, fd); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static int luv_new_socket_poll(lua_State* L) { + int fd = luaL_checkinteger(L, 1); + uv_poll_t* handle = luv_newuserdata(L, sizeof(*handle)); + int ret = uv_poll_init_socket(luv_loop(L), handle, fd); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +// These are the same order as uv_run_mode which also starts at 0 +static const char *const luv_pollevents[] = { + "r", "w", "rw", NULL +}; + +static void luv_poll_cb(uv_poll_t* handle, int status, int events) { + lua_State* L = luv_state(handle->loop); + luv_handle_t* data = handle->data; + const char* evtstr; + + if (status < 0) { + fprintf(stderr, "%s: %s\n", uv_err_name(status), uv_strerror(status)); + lua_pushstring(L, uv_err_name(status)); + } + else { + lua_pushnil(L); + } + + switch (events) { + case UV_READABLE: evtstr = "r"; break; + case UV_WRITABLE: evtstr = "w"; break; + case UV_READABLE|UV_WRITABLE: evtstr = "rw"; break; + default: evtstr = ""; break; + } + lua_pushstring(L, evtstr); + + luv_call_callback(L, data, LUV_POLL, 2); +} + +static int luv_poll_start(lua_State* L) { + uv_poll_t* handle = luv_check_poll(L, 1); + int events, ret; + switch (luaL_checkoption(L, 2, "rw", luv_pollevents)) { + case 0: events = UV_READABLE; break; + case 1: events = UV_WRITABLE; break; + case 2: events = UV_READABLE | UV_WRITABLE; break; + default: events = 0; /* unreachable */ + } + luv_check_callback(L, handle->data, LUV_POLL, 3); + ret = uv_poll_start(handle, events, luv_poll_cb); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_poll_stop(lua_State* L) { + uv_poll_t* handle = luv_check_poll(L, 1); + int ret = uv_poll_stop(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} diff --git a/3rdparty/luv/src/prepare.c b/3rdparty/luv/src/prepare.c new file mode 100644 index 00000000000..6577439a466 --- /dev/null +++ b/3rdparty/luv/src/prepare.c @@ -0,0 +1,59 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static uv_prepare_t* luv_check_prepare(lua_State* L, int index) { + uv_prepare_t* handle = luv_checkudata(L, index, "uv_prepare"); + luaL_argcheck(L, handle->type == UV_PREPARE && handle->data, index, "Expected uv_prepare_t"); + return handle; +} + +static int luv_new_prepare(lua_State* L) { + uv_prepare_t* handle = luv_newuserdata(L, sizeof(*handle)); + int ret = uv_prepare_init(luv_loop(L), handle); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static void luv_prepare_cb(uv_prepare_t* handle) { + lua_State* L = luv_state(handle->loop); + luv_handle_t* data = handle->data; + luv_call_callback(L, data, LUV_PREPARE, 0); +} + +static int luv_prepare_start(lua_State* L) { + uv_prepare_t* handle = luv_check_prepare(L, 1); + int ret; + luv_check_callback(L, handle->data, LUV_PREPARE, 2); + ret = uv_prepare_start(handle, luv_prepare_cb); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_prepare_stop(lua_State* L) { + uv_prepare_t* handle = luv_check_prepare(L, 1); + int ret = uv_prepare_stop(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + diff --git a/3rdparty/luv/src/process.c b/3rdparty/luv/src/process.c new file mode 100644 index 00000000000..d939503868b --- /dev/null +++ b/3rdparty/luv/src/process.c @@ -0,0 +1,266 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static int luv_disable_stdio_inheritance(lua_State* L) { + (void)L; + uv_disable_stdio_inheritance(); + return 0; +} + +static uv_process_t* luv_check_process(lua_State* L, int index) { + uv_process_t* handle = luv_checkudata(L, index, "uv_process"); + luaL_argcheck(L, handle->type == UV_PROCESS && handle->data, index, "Expected uv_process_t"); + return handle; +} + +static void exit_cb(uv_process_t* handle, int64_t exit_status, int term_signal) { + lua_State* L = luv_state(handle->loop); + luv_handle_t* data = handle->data; + lua_pushinteger(L, exit_status); + lua_pushinteger(L, term_signal); + luv_call_callback(L, data, LUV_EXIT, 2); +} + +static void luv_spawn_close_cb(uv_handle_t* handle) { + lua_State *L = luv_state(handle->loop); + luv_cleanup_handle(L, handle->data); +} + +static void luv_clean_options(uv_process_options_t* options) { + free(options->args); + free(options->stdio); + free(options->env); +} + +static int luv_spawn(lua_State* L) { + uv_process_t* handle; + uv_process_options_t options; + size_t i, len = 0; + int ret; + + memset(&options, 0, sizeof(options)); + options.exit_cb = exit_cb; + options.file = luaL_checkstring(L, 1); + options.flags = 0; + + // Make sure the 2nd argument is a table + luaL_checktype(L, 2, LUA_TTABLE); + + // get the args list + lua_getfield(L, 2, "args"); + // +1 for inserted command at front + if (lua_type(L, -1) == LUA_TTABLE) { + len = 1 + lua_rawlen(L, -1); + } + else if (lua_type(L, -1) != LUA_TNIL) { + luv_clean_options(&options); + return luaL_argerror(L, 3, "args option must be table"); + } + else { + len = 1; + } + // +1 for null terminator at end + options.args = malloc((len + 1) * sizeof(*options.args)); + if (!options.args) { + luv_clean_options(&options); + return luaL_error(L, "Problem allocating args"); + } + options.args[0] = (char*)options.file; + for (i = 1; i < len; ++i) { + lua_rawgeti(L, -1, i); + options.args[i] = (char*)lua_tostring(L, -1); + lua_pop(L, 1); + } + options.args[len] = NULL; + lua_pop(L, 1); + + // get the stdio list + lua_getfield(L, 2, "stdio"); + if (lua_type(L, -1) == LUA_TTABLE) { + options.stdio_count = len = lua_rawlen(L, -1); + options.stdio = malloc(len * sizeof(*options.stdio)); + if (!options.stdio) { + luv_clean_options(&options); + return luaL_error(L, "Problem allocating stdio"); + } + for (i = 0; i < len; ++i) { + lua_rawgeti(L, -1, i + 1); + // integers are assumed to be file descripters + if (lua_type(L, -1) == LUA_TNUMBER) { + options.stdio[i].flags = UV_INHERIT_FD; + options.stdio[i].data.fd = lua_tointeger(L, -1); + } + // userdata is assumed to be a uv_stream_t instance + else if (lua_type(L, -1) == LUA_TUSERDATA) { + uv_os_fd_t fd; + uv_stream_t* stream = luv_check_stream(L, -1); + int err = uv_fileno((uv_handle_t*)stream, &fd); + if (err == UV_EINVAL || err == UV_EBADF) { + // stdin (fd 0) is read-only, stdout and stderr (fds 1 & 2) are + // write-only, and all fds > 2 are read-write + int flags = UV_CREATE_PIPE; + if (i == 0 || i > 2) + flags |= UV_READABLE_PIPE; + if (i != 0) + flags |= UV_WRITABLE_PIPE; + options.stdio[i].flags = flags; + } + else { + options.stdio[i].flags = UV_INHERIT_STREAM; + } + options.stdio[i].data.stream = stream; + } + else if (lua_type(L, -1) == LUA_TNIL) { + options.stdio[i].flags = UV_IGNORE; + } + else { + luv_clean_options(&options); + return luaL_argerror(L, 2, "stdio table entries must be nil, uv_stream_t, or integer"); + } + lua_pop(L, 1); + } + } + else if (lua_type(L, -1) != LUA_TNIL) { + luv_clean_options(&options); + return luaL_argerror(L, 2, "stdio option must be table"); + } + lua_pop(L, 1); + + // Get the env + lua_getfield(L, 2, "env"); + if (lua_type(L, -1) == LUA_TTABLE) { + len = lua_rawlen(L, -1); + options.env = malloc((len + 1) * sizeof(*options.env)); + if (!options.env) { + luv_clean_options(&options); + return luaL_error(L, "Problem allocating env"); + } + for (i = 0; i < len; ++i) { + lua_rawgeti(L, -1, i + 1); + options.env[i] = (char*)lua_tostring(L, -1); + lua_pop(L, 1); + } + options.env[len] = NULL; + } + else if (lua_type(L, -1) != LUA_TNIL) { + luv_clean_options(&options); + return luaL_argerror(L, 2, "env option must be table"); + } + lua_pop(L, 1); + + // Get the cwd + lua_getfield(L, 2, "cwd"); + if (lua_type(L, -1) == LUA_TSTRING) { + options.cwd = (char*)lua_tostring(L, -1); + } + else if (lua_type(L, -1) != LUA_TNIL) { + luv_clean_options(&options); + return luaL_argerror(L, 2, "cwd option must be string"); + } + lua_pop(L, 1); + + // Check for uid + lua_getfield(L, 2, "uid"); + if (lua_type(L, -1) == LUA_TNUMBER) { + options.uid = lua_tointeger(L, -1); + options.flags |= UV_PROCESS_SETUID; + } + else if (lua_type(L, -1) != LUA_TNIL) { + luv_clean_options(&options); + return luaL_argerror(L, 2, "uid option must be number"); + } + lua_pop(L, 1); + + // Check for gid + lua_getfield(L, 2, "gid"); + if (lua_type(L, -1) == LUA_TNUMBER) { + options.gid = lua_tointeger(L, -1); + options.flags |= UV_PROCESS_SETGID; + } + else if (lua_type(L, -1) != LUA_TNIL) { + luv_clean_options(&options); + return luaL_argerror(L, 2, "gid option must be number"); + } + lua_pop(L, 1); + + // Check for the boolean flags + lua_getfield(L, 2, "verbatim"); + if (lua_toboolean(L, -1)) { + options.flags |= UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS; + } + lua_pop(L, 1); + lua_getfield(L, 2, "detached"); + if (lua_toboolean(L, -1)) { + options.flags |= UV_PROCESS_DETACHED; + } + lua_pop(L, 1); + lua_getfield(L, 2, "hide"); + if (lua_toboolean(L, -1)) { + options.flags |= UV_PROCESS_WINDOWS_HIDE; + } + lua_pop(L, 1); + + handle = luv_newuserdata(L, sizeof(*handle)); + handle->type = UV_PROCESS; + handle->data = luv_setup_handle(L); + + if (!lua_isnoneornil(L, 3)) { + luv_check_callback(L, handle->data, LUV_EXIT, 3); + } + + ret = uv_spawn(luv_loop(L), handle, &options); + + luv_clean_options(&options); + if (ret < 0) { + /* The async callback is required here because luajit GC may reclaim the + * luv handle before libuv is done closing it down. + */ + uv_close((uv_handle_t*)handle, luv_spawn_close_cb); + return luv_error(L, ret); + } + lua_pushinteger(L, handle->pid); + return 2; +} + +static int luv_parse_signal(lua_State* L, int slot) { + if (lua_isnumber(L, slot)) { + return lua_tonumber(L, slot); + } + if (lua_isstring(L, slot)) { + return luv_sig_string_to_num(lua_tostring(L, slot)); + } + return SIGTERM; +} + +static int luv_process_kill(lua_State* L) { + uv_process_t* handle = luv_check_process(L, 1); + int signum = luv_parse_signal(L, 2); + int ret = uv_process_kill(handle, signum); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_kill(lua_State* L) { + int pid = luaL_checkinteger(L, 1); + int signum = luv_parse_signal(L, 2); + int ret = uv_kill(pid, signum); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} diff --git a/3rdparty/luv/src/req.c b/3rdparty/luv/src/req.c new file mode 100644 index 00000000000..6d7b7e4a30b --- /dev/null +++ b/3rdparty/luv/src/req.c @@ -0,0 +1,52 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static uv_req_t* luv_check_req(lua_State* L, int index) { + uv_req_t* req = luaL_checkudata(L, index, "uv_req"); + luaL_argcheck(L, req->data, index, "Expected uv_req_t"); + return req; +} + +static int luv_req_tostring(lua_State* L) { + uv_req_t* req = luaL_checkudata(L, 1, "uv_req"); + switch (req->type) { +#define XX(uc, lc) case UV_##uc: lua_pushfstring(L, "uv_"#lc"_t: %p", req); break; + UV_REQ_TYPE_MAP(XX) +#undef XX + default: lua_pushfstring(L, "uv_req_t: %p", req); break; + } + return 1; +} + +static void luv_req_init(lua_State* L) { + luaL_newmetatable (L, "uv_req"); + lua_pushcfunction(L, luv_req_tostring); + lua_setfield(L, -2, "__tostring"); + lua_pop(L, 1); +} + +// Metamethod to allow storing anything in the userdata's environment +static int luv_cancel(lua_State* L) { + uv_req_t* req = luv_check_req(L, 1); + int ret = uv_cancel(req); + if (ret < 0) return luv_error(L, ret); + luv_cleanup_req(L, req->data); + req->data = NULL; + lua_pushinteger(L, ret); + return 1; +} diff --git a/3rdparty/luv/src/schema.c b/3rdparty/luv/src/schema.c new file mode 100644 index 00000000000..e7b82e11d66 --- /dev/null +++ b/3rdparty/luv/src/schema.c @@ -0,0 +1,16 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ diff --git a/3rdparty/luv/src/signal.c b/3rdparty/luv/src/signal.c new file mode 100644 index 00000000000..48ace2bf601 --- /dev/null +++ b/3rdparty/luv/src/signal.c @@ -0,0 +1,72 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static uv_signal_t* luv_check_signal(lua_State* L, int index) { + uv_signal_t* handle = luv_checkudata(L, index, "uv_signal"); + luaL_argcheck(L, handle->type == UV_SIGNAL && handle->data, index, "Expected uv_signal_t"); + return handle; +} + +static int luv_new_signal(lua_State* L) { + uv_signal_t* handle = luv_newuserdata(L, sizeof(*handle)); + int ret = uv_signal_init(luv_loop(L), handle); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static void luv_signal_cb(uv_signal_t* handle, int signum) { + lua_State* L = luv_state(handle->loop); + luv_handle_t* data = handle->data; + lua_pushstring(L, luv_sig_num_to_string(signum)); + luv_call_callback(L, data, LUV_SIGNAL, 1); +} + +static int luv_signal_start(lua_State* L) { + uv_signal_t* handle = luv_check_signal(L, 1); + int signum, ret; + if (lua_isnumber(L, 2)) { + signum = lua_tointeger(L, 2); + } + else if (lua_isstring(L, 2)) { + signum = luv_sig_string_to_num(luaL_checkstring(L, 2)); + luaL_argcheck(L, signum, 2, "Invalid Signal name"); + } + else { + return luaL_argerror(L, 2, "Missing Signal name"); + } + + if (!lua_isnoneornil(L, 3)) { + luv_check_callback(L, handle->data, LUV_SIGNAL, 3); + } + ret = uv_signal_start(handle, luv_signal_cb, signum); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_signal_stop(lua_State* L) { + uv_signal_t* handle = luv_check_signal(L, 1); + int ret = uv_signal_stop(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} diff --git a/3rdparty/luv/src/stream.c b/3rdparty/luv/src/stream.c new file mode 100644 index 00000000000..5009e04f097 --- /dev/null +++ b/3rdparty/luv/src/stream.c @@ -0,0 +1,263 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static void luv_check_buf(lua_State *L, int idx, uv_buf_t *pbuf) { + size_t len; + pbuf->base = (char*)luaL_checklstring(L, idx, &len); + pbuf->len = len; +} + +static uv_stream_t* luv_check_stream(lua_State* L, int index) { + int isStream; + uv_stream_t* handle; + if (!(handle = *(void**) lua_touserdata(L, index))) { goto fail; } + lua_getfield(L, LUA_REGISTRYINDEX, "uv_stream"); + lua_getmetatable(L, index < 0 ? index - 1 : index); + lua_rawget(L, -2); + isStream = lua_toboolean(L, -1); + lua_pop(L, 2); + if (isStream) { return handle; } + fail: luaL_argerror(L, index, "Expected uv_stream userdata"); + return NULL; +} + +static void luv_shutdown_cb(uv_shutdown_t* req, int status) { + lua_State* L = luv_state(req->handle->loop); + luv_status(L, status); + luv_fulfill_req(L, req->data, 1); + luv_cleanup_req(L, req->data); + req->data = NULL; +} + +static int luv_shutdown(lua_State* L) { + uv_stream_t* handle = luv_check_stream(L, 1); + int ref = luv_check_continuation(L, 2); + uv_shutdown_t* req = lua_newuserdata(L, sizeof(*req)); + int ret; + req->data = luv_setup_req(L, ref); + ret = uv_shutdown(req, handle, luv_shutdown_cb); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + return 1; +} + +static void luv_connection_cb(uv_stream_t* handle, int status) { + lua_State* L = luv_state(handle->loop); + luv_status(L, status); + luv_call_callback(L, handle->data, LUV_CONNECTION, 1); +} + +static int luv_listen(lua_State* L) { + uv_stream_t* handle = luv_check_stream(L, 1); + int backlog = luaL_checkinteger(L, 2); + int ret; + luv_check_callback(L, handle->data, LUV_CONNECTION, 3); + ret = uv_listen(handle, backlog, luv_connection_cb); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_accept(lua_State* L) { + uv_stream_t* server = luv_check_stream(L, 1); + uv_stream_t* client = luv_check_stream(L, 2); + int ret = uv_accept(server, client); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static void luv_alloc_cb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) { + (void)handle; + buf->base = malloc(suggested_size); + assert(buf->base); + buf->len = suggested_size; +} + +static void luv_read_cb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { + lua_State* L = luv_state(handle->loop); + int nargs; + + if (nread > 0) { + lua_pushnil(L); + lua_pushlstring(L, buf->base, nread); + nargs = 2; + } + + free(buf->base); + if (nread == 0) return; + + if (nread == UV_EOF) { + nargs = 0; + } + else if (nread < 0) { + luv_status(L, nread); + nargs = 1; + } + + luv_call_callback(L, handle->data, LUV_READ, nargs); +} + +static int luv_read_start(lua_State* L) { + uv_stream_t* handle = luv_check_stream(L, 1); + int ret; + luv_check_callback(L, handle->data, LUV_READ, 2); + ret = uv_read_start(handle, luv_alloc_cb, luv_read_cb); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_read_stop(lua_State* L) { + uv_stream_t* handle = luv_check_stream(L, 1); + int ret = uv_read_stop(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static void luv_write_cb(uv_write_t* req, int status) { + lua_State* L = luv_state(req->handle->loop); + luv_status(L, status); + luv_fulfill_req(L, req->data, 1); + luv_cleanup_req(L, req->data); + req->data = NULL; +} + +static uv_buf_t* luv_prep_bufs(lua_State* L, int index, size_t *count) { + uv_buf_t *bufs; + size_t i; + *count = lua_rawlen(L, index); + bufs = malloc(sizeof(uv_buf_t) * *count); + for (i = 0; i < *count; ++i) { + lua_rawgeti(L, index, i + 1); + luv_check_buf(L, -1, &bufs[i]); + lua_pop(L, 1); + } + return bufs; +} + +static int luv_write(lua_State* L) { + uv_stream_t* handle = luv_check_stream(L, 1); + uv_write_t* req; + int ret, ref; + ref = luv_check_continuation(L, 3); + req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + if (lua_istable(L, 2)) { + size_t count; + uv_buf_t *bufs = luv_prep_bufs(L, 2, &count); + ret = uv_write(req, handle, bufs, count, luv_write_cb); + free(bufs); + } + else if (lua_isstring(L, 2)) { + uv_buf_t buf; + luv_check_buf(L, 2, &buf); + ret = uv_write(req, handle, &buf, 1, luv_write_cb); + } + else { + return luaL_argerror(L, 2, "data must be string or table of strings"); + } + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + lua_pushvalue(L, 2); + ((luv_req_t*)req->data)->data_ref = luaL_ref(L, LUA_REGISTRYINDEX); + return 1; +} + +static int luv_write2(lua_State* L) { + uv_stream_t* handle = luv_check_stream(L, 1); + uv_write_t* req; + int ret, ref; + uv_stream_t* send_handle; + send_handle = luv_check_stream(L, 3); + ref = luv_check_continuation(L, 4); + req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + if (lua_istable(L, 2)) { + size_t count; + uv_buf_t *bufs = luv_prep_bufs(L, 2, &count); + ret = uv_write2(req, handle, bufs, count, send_handle, luv_write_cb); + free(bufs); + } + else if (lua_isstring(L, 2)) { + uv_buf_t buf; + luv_check_buf(L, 2, &buf); + ret = uv_write2(req, handle, &buf, 1, send_handle, luv_write_cb); + } + else { + return luaL_argerror(L, 2, "data must be string or table of strings"); + } + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + lua_pushvalue(L, 2); + ((luv_req_t*)req->data)->data_ref = luaL_ref(L, LUA_REGISTRYINDEX); + return 1; +} + +static int luv_try_write(lua_State* L) { + uv_stream_t* handle = luv_check_stream(L, 1); + int ret; + if (lua_istable(L, 2)) { + size_t count; + uv_buf_t *bufs = luv_prep_bufs(L, 2, &count); + ret = uv_try_write(handle, bufs, count); + free(bufs); + } + else if (lua_isstring(L, 2)) { + uv_buf_t buf; + luv_check_buf(L, 2, &buf); + ret = uv_try_write(handle, &buf, 1); + } + else { + return luaL_argerror(L, 2, "data must be string or table of strings"); + } + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_is_readable(lua_State* L) { + uv_stream_t* handle = luv_check_stream(L, 1); + lua_pushboolean(L, uv_is_readable(handle)); + return 1; +} + +static int luv_is_writable(lua_State* L) { + uv_stream_t* handle = luv_check_stream(L, 1); + lua_pushboolean(L, uv_is_writable(handle)); + return 1; +} + +static int luv_stream_set_blocking(lua_State* L) { + uv_stream_t* handle = luv_check_stream(L, 1); + int blocking, ret; + luaL_checktype(L, 2, LUA_TBOOLEAN); + blocking = lua_toboolean(L, 2); + ret = uv_stream_set_blocking(handle, blocking); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + diff --git a/3rdparty/luv/src/tcp.c b/3rdparty/luv/src/tcp.c new file mode 100644 index 00000000000..7ffef5ae763 --- /dev/null +++ b/3rdparty/luv/src/tcp.c @@ -0,0 +1,182 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static uv_tcp_t* luv_check_tcp(lua_State* L, int index) { + uv_tcp_t* handle = luv_checkudata(L, index, "uv_tcp"); + luaL_argcheck(L, handle->type == UV_TCP && handle->data, index, "Expected uv_tcp_t"); + return handle; +} + +static int luv_new_tcp(lua_State* L) { + uv_tcp_t* handle = luv_newuserdata(L, sizeof(*handle)); + int ret = uv_tcp_init(luv_loop(L), handle); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static int luv_tcp_open(lua_State* L) { + uv_tcp_t* handle = luv_check_tcp(L, 1); + uv_os_sock_t sock = luaL_checkinteger(L, 2); + int ret = uv_tcp_open(handle, sock); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_tcp_nodelay(lua_State* L) { + uv_tcp_t* handle = luv_check_tcp(L, 1); + int ret, enable; + luaL_checktype(L, 2, LUA_TBOOLEAN); + enable = lua_toboolean(L, 2); + ret = uv_tcp_nodelay(handle, enable); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_tcp_keepalive(lua_State* L) { + uv_tcp_t* handle = luv_check_tcp(L, 1); + int ret, enable; + unsigned int delay = 0; + luaL_checktype(L, 2, LUA_TBOOLEAN); + enable = lua_toboolean(L, 2); + if (enable) { + delay = luaL_checkinteger(L, 3); + } + ret = uv_tcp_keepalive(handle, enable, delay); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_tcp_simultaneous_accepts(lua_State* L) { + uv_tcp_t* handle = luv_check_tcp(L, 1); + int ret, enable; + luaL_checktype(L, 2, LUA_TBOOLEAN); + enable = lua_toboolean(L, 2); + ret = uv_tcp_simultaneous_accepts(handle, enable); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_tcp_bind(lua_State* L) { + uv_tcp_t* handle = luv_check_tcp(L, 1); + const char* host = luaL_checkstring(L, 2); + int port = luaL_checkinteger(L, 3); + unsigned int flags = 0; + struct sockaddr_storage addr; + int ret; + if (uv_ip4_addr(host, port, (struct sockaddr_in*)&addr) && + uv_ip6_addr(host, port, (struct sockaddr_in6*)&addr)) { + return luaL_error(L, "Invalid IP address or port [%s:%d]", host, port); + } + if (lua_type(L, 4) == LUA_TTABLE) { + lua_getfield(L, 4, "ipv6only"); + if (lua_toboolean(L, -1)) flags |= UV_TCP_IPV6ONLY; + lua_pop(L, 1); + } + ret = uv_tcp_bind(handle, (struct sockaddr*)&addr, flags); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static void parse_sockaddr(lua_State* L, struct sockaddr_storage* address, int addrlen) { + char ip[INET6_ADDRSTRLEN]; + int port = 0; + lua_newtable(L); + if (address->ss_family == AF_INET) { + struct sockaddr_in* addrin = (struct sockaddr_in*)address; + uv_inet_ntop(AF_INET, &(addrin->sin_addr), ip, addrlen); + port = ntohs(addrin->sin_port); + } else if (address->ss_family == AF_INET6) { + struct sockaddr_in6* addrin6 = (struct sockaddr_in6*)address; + uv_inet_ntop(AF_INET6, &(addrin6->sin6_addr), ip, addrlen); + port = ntohs(addrin6->sin6_port); + } + + lua_pushstring(L, luv_af_num_to_string(address->ss_family)); + lua_setfield(L, -2, "family"); + lua_pushinteger(L, port); + lua_setfield(L, -2, "port"); + lua_pushstring(L, ip); + lua_setfield(L, -2, "ip"); +} + +static int luv_tcp_getsockname(lua_State* L) { + uv_tcp_t* handle = luv_check_tcp(L, 1); + struct sockaddr_storage address; + int addrlen = sizeof(address); + int ret = uv_tcp_getsockname(handle, (struct sockaddr*)&address, &addrlen); + if (ret < 0) return luv_error(L, ret); + parse_sockaddr(L, &address, addrlen); + return 1; +} + +static int luv_tcp_getpeername(lua_State* L) { + uv_tcp_t* handle = luv_check_tcp(L, 1); + struct sockaddr_storage address; + int addrlen = sizeof(address); + int ret = uv_tcp_getpeername(handle, (struct sockaddr*)&address, &addrlen); + if (ret < 0) return luv_error(L, ret); + parse_sockaddr(L, &address, addrlen); + return 1; +} + + +static void luv_connect_cb(uv_connect_t* req, int status) { + lua_State* L = luv_state(req->handle->loop); + luv_status(L, status); + luv_fulfill_req(L, req->data, 1); + luv_cleanup_req(L, req->data); + req->data = NULL; +} + +static int luv_write_queue_size(lua_State* L) { + uv_tcp_t* handle = luv_check_tcp(L, 1); + lua_pushinteger(L, handle->write_queue_size); + return 1; +} + +static int luv_tcp_connect(lua_State* L) { + uv_tcp_t* handle = luv_check_tcp(L, 1); + const char* host = luaL_checkstring(L, 2); + int port = luaL_checkinteger(L, 3); + struct sockaddr_storage addr; + uv_connect_t* req; + int ret, ref; + if (uv_ip4_addr(host, port, (struct sockaddr_in*)&addr) && + uv_ip6_addr(host, port, (struct sockaddr_in6*)&addr)) { + return luaL_error(L, "Invalid IP address or port [%s:%d]", host, port); + } + ref = luv_check_continuation(L, 4); + + req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + ret = uv_tcp_connect(req, handle, (struct sockaddr*)&addr, luv_connect_cb); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + return 1; +} diff --git a/3rdparty/luv/src/thread.c b/3rdparty/luv/src/thread.c new file mode 100644 index 00000000000..cc53011e6ed --- /dev/null +++ b/3rdparty/luv/src/thread.c @@ -0,0 +1,353 @@ +/* +* Copyright 2014 The Luvit Authors. All Rights Reserved. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +#include "luv.h" +#include "lthreadpool.h" + +typedef struct { + uv_thread_t handle; + char* code; + int len; + int argc; + luv_thread_arg_t arg; +} luv_thread_t; + +static luv_acquire_vm acquire_vm_cb = NULL; +static luv_release_vm release_vm_cb = NULL; + +static lua_State* luv_thread_acquire_vm() { + lua_State* L = luaL_newstate(); + + // Add in the lua standard libraries + luaL_openlibs(L); + + // Get package.loaded, so we can store uv in it. + lua_getglobal(L, "package"); + lua_getfield(L, -1, "loaded"); + lua_remove(L, -2); // Remove package + + // Store uv module definition at loaded.uv + luaopen_luv(L); + lua_setfield(L, -2, "luv"); + lua_pop(L, 1); + + return L; +} + +static void luv_thread_release_vm(lua_State* L) { + lua_close(L); +} + +static int luv_thread_arg_set(lua_State* L, luv_thread_arg_t* args, int idx, int top, int flag) +{ + int i; + idx = idx > 0 ? idx : 1; + i = idx; + while (i <= top && i <= LUV_THREAD_MAXNUM_ARG + idx) + { + luv_val_t *arg = args->argv + i - idx; + arg->type = lua_type(L, i); + switch (arg->type) + { + case LUA_TNIL: + break; + case LUA_TBOOLEAN: + arg->val.boolean = lua_toboolean(L, i); + break; + case LUA_TNUMBER: + arg->val.num = lua_tonumber(L, i); + break; + case LUA_TLIGHTUSERDATA: + arg->val.userdata = lua_touserdata(L, i); + break; + case LUA_TSTRING: + { + const char* p = lua_tolstring(L, i, &arg->val.str.len); + arg->val.str.base = malloc(arg->val.str.len); + if (arg->val.str.base == NULL) + { + perror("out of memory"); + return 0; + } + memcpy((void*)arg->val.str.base, p, arg->val.str.len); + break; + } + case LUA_TUSERDATA: + if (flag == 1) { + arg->val.userdata = luv_check_handle(L, i); + break; + } + default: + fprintf(stderr, "Error: thread arg not support type '%s' at %d", + luaL_typename(L, arg->type), i); + exit(-1); + break; + } + i++; + } + args->argc = i - idx; + return args->argc; +} + +static void luv_thread_arg_clear(luv_thread_arg_t* args) { + int i; + for (i = 0; i < args->argc; i++) + { + if (args->argv[i].type == LUA_TSTRING) + { + free((void*)args->argv[i].val.str.base); + } + } + memset(args, 0, sizeof(*args)); + args->argc = 0; +} + +static void luv_thread_setup_handle(lua_State* L, uv_handle_t* handle) { + *(void**) lua_newuserdata(L, sizeof(void*)) = handle; + +#define XX(uc, lc) case UV_##uc: \ + luaL_getmetatable(L, "uv_"#lc); \ + break; + switch (handle->type) { + UV_HANDLE_TYPE_MAP(XX) + default: + luaL_error(L, "Unknown handle type"); + } +#undef XX + + lua_setmetatable(L, -2); +} + +static int luv_thread_arg_push(lua_State* L, const luv_thread_arg_t* args) { + int i = 0; + while (i < args->argc) + { + const luv_val_t* arg = args->argv + i; + switch (arg->type) + { + case LUA_TNIL: + lua_pushnil(L); + break; + case LUA_TBOOLEAN: + lua_pushboolean(L, arg->val.boolean); + break; + case LUA_TLIGHTUSERDATA: + lua_pushlightuserdata(L, arg->val.userdata); + break; + case LUA_TNUMBER: + lua_pushnumber(L, arg->val.num); + break; + case LUA_TSTRING: + lua_pushlstring(L, arg->val.str.base, arg->val.str.len); + break; + case LUA_TUSERDATA: + luv_thread_setup_handle(L, arg->val.userdata); + break; + default: + fprintf(stderr, "Error: thread arg not support type %s at %d", + luaL_typename(L, arg->type), i + 1); + } + i++; + }; + return i; +} + +int thread_dump(lua_State* L, const void* p, size_t sz, void* B) +{ + (void)L; + luaL_addlstring((luaL_Buffer*) B, (const char*) p, sz); + return 0; +} + +static const char* luv_thread_dumped(lua_State* L, int idx, size_t* l) { + if (lua_isstring(L, idx)) { + return lua_tolstring(L, idx, l); + } else { + const char* buff = NULL; + int top = lua_gettop(L); + luaL_Buffer b; + luaL_checktype(L, idx, LUA_TFUNCTION); + lua_pushvalue(L, idx); + luaL_buffinit(L, &b); +#if LUA_VERSION_NUM>=503 + int test_lua_dump = (lua_dump(L, thread_dump, &b, 1) == 0); +#else + int test_lua_dump = (lua_dump(L, thread_dump, &b) == 0); +#endif + if (test_lua_dump) { + luaL_pushresult(&b); + buff = lua_tolstring(L, -1, l); + } else + luaL_error(L, "Error: unable to dump given function"); + lua_settop(L, top); + + return buff; + } +} + +static luv_thread_t* luv_check_thread(lua_State* L, int index) +{ + luv_thread_t* thread = luaL_checkudata(L, index, "uv_thread"); + return thread; +} + +static int luv_thread_gc(lua_State* L) { + luv_thread_t* tid = luv_check_thread(L, 1); + free(tid->code); + tid->code = NULL; + tid->len = 0; + luv_thread_arg_clear(&tid->arg); + return 0; +} + +static int luv_thread_tostring(lua_State* L) +{ + luv_thread_t* thd = luv_check_thread(L, 1); + lua_pushfstring(L, "uv_thread_t: %p", thd->handle); + return 1; +} + +static void luv_thread_cb(void* varg) { + luv_thread_t* thd = (luv_thread_t*)varg; + lua_State* L = acquire_vm_cb(); + if (luaL_loadbuffer(L, thd->code, thd->len, "=thread") == 0) + { + int top = lua_gettop(L); + int i = luv_thread_arg_push(L, &thd->arg); + + for (i = 0; i < thd->arg.argc; i++) { + if (thd->arg.argv[i].type == LUA_TUSERDATA) { + lua_pushlightuserdata(L, thd->arg.argv[i].val.userdata); + lua_pushvalue(L, top + i + 1); + lua_rawset(L, LUA_REGISTRYINDEX); + } + } + + if (lua_pcall(L, i, 0, 0)) { + fprintf(stderr, "Uncaught Error in thread: %s\n", lua_tostring(L, -1)); + } + + for (i = 0; i < thd->arg.argc; i++) { + if (thd->arg.argv[i].type == LUA_TUSERDATA) { + lua_pushlightuserdata(L, thd->arg.argv[i].val.userdata); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushnil(L); + lua_setmetatable(L, -2); + lua_pop(L, 1); + + lua_pushlightuserdata(L, thd->arg.argv[i].val.userdata); + lua_pushnil(L); + lua_rawset(L, LUA_REGISTRYINDEX); + } + } + + } else { + fprintf(stderr, "Uncaught Error: %s\n", lua_tostring(L, -1)); + } + release_vm_cb(L); +} + +static int luv_new_thread(lua_State* L) { + int ret; + size_t len; + const char* buff; + luv_thread_t* thread; + thread = lua_newuserdata(L, sizeof(*thread)); + memset(thread, 0, sizeof(*thread)); + luaL_getmetatable(L, "uv_thread"); + lua_setmetatable(L, -2); + + buff = luv_thread_dumped(L, 1, &len); + + thread->argc = luv_thread_arg_set(L, &thread->arg, 2, lua_gettop(L) - 1, 1); + thread->len = len; + thread->code = malloc(thread->len); + memcpy(thread->code, buff, len); + + ret = uv_thread_create(&thread->handle, luv_thread_cb, thread); + if (ret < 0) return luv_error(L, ret); + + return 1; +} + +static int luv_thread_join(lua_State* L) { + luv_thread_t* tid = luv_check_thread(L, 1); + int ret = uv_thread_join(&tid->handle); + if (ret < 0) return luv_error(L, ret); + lua_pushboolean(L, 1); + return 1; +} + +static int luv_thread_self(lua_State* L) +{ + luv_thread_t* thread; + uv_thread_t t = uv_thread_self(); + thread = lua_newuserdata(L, sizeof(*thread)); + memset(thread, 0, sizeof(*thread)); + memcpy(&thread->handle, &t, sizeof(t)); + luaL_getmetatable(L, "uv_thread"); + lua_setmetatable(L, -2); + return 1; +} + +static int luv_thread_equal(lua_State* L) { + luv_thread_t* t1 = luv_check_thread(L, 1); + luv_thread_t* t2 = luv_check_thread(L, 2); + int ret = uv_thread_equal(&t1->handle, &t2->handle); + lua_pushboolean(L, ret); + return 1; +} + +/* Pause the calling thread for a number of milliseconds. */ +static int luv_thread_sleep(lua_State* L) { +#ifdef _WIN32 + DWORD msec = luaL_checkinteger(L, 1); + Sleep(msec); +#else + lua_Integer msec = luaL_checkinteger(L, 1); + usleep(msec * 1000); +#endif + return 0; +} + +static const luaL_Reg luv_thread_methods[] = { + {"equal", luv_thread_equal}, + {"join", luv_thread_join}, + {NULL, NULL} +}; + +static void luv_thread_init(lua_State* L) { + luaL_newmetatable(L, "uv_thread"); + lua_pushcfunction(L, luv_thread_tostring); + lua_setfield(L, -2, "__tostring"); + lua_pushcfunction(L, luv_thread_equal); + lua_setfield(L, -2, "__eq"); + lua_pushcfunction(L, luv_thread_gc); + lua_setfield(L, -2, "__gc"); + lua_newtable(L); + luaL_setfuncs(L, luv_thread_methods, 0); + lua_setfield(L, -2, "__index"); + lua_pop(L, 1); + + if (acquire_vm_cb == NULL) acquire_vm_cb = luv_thread_acquire_vm; + if (release_vm_cb == NULL) release_vm_cb = luv_thread_release_vm; +} + +LUALIB_API void luv_set_thread_cb(luv_acquire_vm acquire, luv_release_vm release) +{ + acquire_vm_cb = acquire; + release_vm_cb = release; +} diff --git a/3rdparty/luv/src/timer.c b/3rdparty/luv/src/timer.c new file mode 100644 index 00000000000..b283f1fc8b2 --- /dev/null +++ b/3rdparty/luv/src/timer.c @@ -0,0 +1,84 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static uv_timer_t* luv_check_timer(lua_State* L, int index) { + uv_timer_t* handle = luv_checkudata(L, index, "uv_timer"); + luaL_argcheck(L, handle->type == UV_TIMER && handle->data, index, "Expected uv_timer_t"); + return handle; +} + +static int luv_new_timer(lua_State* L) { + uv_timer_t* handle = luv_newuserdata(L, sizeof(*handle)); + int ret = uv_timer_init(luv_loop(L), handle); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static void luv_timer_cb(uv_timer_t* handle) { + lua_State* L = luv_state(handle->loop); + luv_handle_t* data = handle->data; + luv_call_callback(L, data, LUV_TIMEOUT, 0); +} + +static int luv_timer_start(lua_State* L) { + uv_timer_t* handle = luv_check_timer(L, 1); + uint64_t timeout; + uint64_t repeat; + int ret; + timeout = luaL_checkinteger(L, 2); + repeat = luaL_checkinteger(L, 3); + luv_check_callback(L, handle->data, LUV_TIMEOUT, 4); + ret = uv_timer_start(handle, luv_timer_cb, timeout, repeat); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_timer_stop(lua_State* L) { + uv_timer_t* handle = luv_check_timer(L, 1); + int ret = uv_timer_stop(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_timer_again(lua_State* L) { + uv_timer_t* handle = luv_check_timer(L, 1); + int ret = uv_timer_again(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_timer_set_repeat(lua_State* L) { + uv_timer_t* handle = luv_check_timer(L, 1); + uint64_t repeat = luaL_checkinteger(L, 2); + uv_timer_set_repeat(handle, repeat); + return 0; +} + +static int luv_timer_get_repeat(lua_State* L) { + uv_timer_t* handle = luv_check_timer(L, 1); + uint64_t repeat = uv_timer_get_repeat(handle); + lua_pushinteger(L, repeat); + return 1; +} diff --git a/3rdparty/luv/src/tty.c b/3rdparty/luv/src/tty.c new file mode 100644 index 00000000000..9232dc07603 --- /dev/null +++ b/3rdparty/luv/src/tty.c @@ -0,0 +1,65 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static uv_tty_t* luv_check_tty(lua_State* L, int index) { + uv_tty_t* handle = luv_checkudata(L, index, "uv_tty"); + luaL_argcheck(L, handle->type == UV_TTY && handle->data, index, "Expected uv_tty_t"); + return handle; +} + +static int luv_new_tty(lua_State* L) { + int readable, ret; + uv_tty_t* handle; + uv_file fd = luaL_checkinteger(L, 1); + luaL_checktype(L, 2, LUA_TBOOLEAN); + readable = lua_toboolean(L, 2); + handle = luv_newuserdata(L, sizeof(*handle)); + ret = uv_tty_init(luv_loop(L), handle, fd, readable); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static int luv_tty_set_mode(lua_State* L) { + uv_tty_t* handle = luv_check_tty(L, 1); + int mode = luaL_checkinteger(L, 2); + int ret = uv_tty_set_mode(handle, mode); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_tty_reset_mode(lua_State* L) { + int ret = uv_tty_reset_mode(); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_tty_get_winsize(lua_State* L) { + uv_tty_t* handle = luv_check_tty(L, 1); + int width, height; + int ret = uv_tty_get_winsize(handle, &width, &height); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, width); + lua_pushinteger(L, height); + return 2; +} diff --git a/3rdparty/luv/src/udp.c b/3rdparty/luv/src/udp.c new file mode 100644 index 00000000000..9cc25555559 --- /dev/null +++ b/3rdparty/luv/src/udp.c @@ -0,0 +1,260 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +static uv_udp_t* luv_check_udp(lua_State* L, int index) { + uv_udp_t* handle = luv_checkudata(L, index, "uv_udp"); + luaL_argcheck(L, handle->type == UV_UDP && handle->data, index, "Expected uv_udp_t"); + return handle; +} + +static int luv_new_udp(lua_State* L) { + uv_udp_t* handle = luv_newuserdata(L, sizeof(*handle)); + int ret = uv_udp_init(luv_loop(L), handle); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + handle->data = luv_setup_handle(L); + return 1; +} + +static int luv_udp_open(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + uv_os_sock_t sock = luaL_checkinteger(L, 2); + int ret = uv_udp_open(handle, sock); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_udp_bind(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + const char* host = luaL_checkstring(L, 2); + int port = luaL_checkinteger(L, 3); + unsigned int flags = 0; + struct sockaddr_storage addr; + int ret; + if (uv_ip4_addr(host, port, (struct sockaddr_in*)&addr) && + uv_ip6_addr(host, port, (struct sockaddr_in6*)&addr)) { + return luaL_error(L, "Invalid IP address or port [%s:%d]", host, port); + } + if (lua_type(L, 4) == LUA_TTABLE) { + luaL_checktype(L, 4, LUA_TTABLE); + lua_getfield(L, 4, "reuseaddr"); + if (lua_toboolean(L, -1)) flags |= UV_UDP_REUSEADDR; + lua_pop(L, 1); + lua_getfield(L, 4, "ipv6only"); + if (lua_toboolean(L, -1)) flags |= UV_UDP_IPV6ONLY; + lua_pop(L, 1); + } + ret = uv_udp_bind(handle, (struct sockaddr*)&addr, flags); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_udp_getsockname(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + struct sockaddr_storage address; + int addrlen = sizeof(address); + int ret = uv_udp_getsockname(handle, (struct sockaddr*)&address, &addrlen); + if (ret < 0) return luv_error(L, ret); + parse_sockaddr(L, &address, addrlen); + return 1; +} + +// These are the same order as uv_membership which also starts at 0 +static const char *const luv_membership_opts[] = { + "leave", "join", NULL +}; + +static int luv_udp_set_membership(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + const char* multicast_addr = luaL_checkstring(L, 2); + const char* interface_addr = luaL_checkstring(L, 3); + uv_membership membership = luaL_checkoption(L, 4, NULL, luv_membership_opts); + int ret = uv_udp_set_membership(handle, multicast_addr, interface_addr, membership); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_udp_set_multicast_loop(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + int on, ret; + luaL_checktype(L, 2, LUA_TBOOLEAN); + on = lua_toboolean(L, 2); + ret = uv_udp_set_multicast_loop(handle, on); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_udp_set_multicast_ttl(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + int ttl, ret; + ttl = luaL_checkinteger(L, 2); + ret = uv_udp_set_multicast_ttl(handle, ttl); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_udp_set_multicast_interface(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + const char* interface_addr = luaL_checkstring(L, 2); + int ret = uv_udp_set_multicast_interface(handle, interface_addr); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_udp_set_broadcast(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + int on, ret; + luaL_checktype(L, 2, LUA_TBOOLEAN); + on = lua_toboolean(L, 2); + ret =uv_udp_set_broadcast(handle, on); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_udp_set_ttl(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + int ttl, ret; + ttl = luaL_checknumber(L, 2); + ret = uv_udp_set_ttl(handle, ttl); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static void luv_udp_send_cb(uv_udp_send_t* req, int status) { + lua_State* L = luv_state(req->handle->loop); + luv_status(L, status); + luv_fulfill_req(L, req->data, 1); + luv_cleanup_req(L, req->data); + req->data = NULL; +} + +static int luv_udp_send(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + uv_udp_send_t* req; + uv_buf_t buf; + int ret, port, ref; + const char* host; + struct sockaddr_storage addr; + luv_check_buf(L, 2, &buf); + host = luaL_checkstring(L, 3); + port = luaL_checkinteger(L, 4); + if (uv_ip4_addr(host, port, (struct sockaddr_in*)&addr) && + uv_ip6_addr(host, port, (struct sockaddr_in6*)&addr)) { + return luaL_error(L, "Invalid IP address or port [%s:%d]", host, port); + } + ref = luv_check_continuation(L, 5); + req = lua_newuserdata(L, sizeof(*req)); + req->data = luv_setup_req(L, ref); + ret = uv_udp_send(req, handle, &buf, 1, (struct sockaddr*)&addr, luv_udp_send_cb); + if (ret < 0) { + lua_pop(L, 1); + return luv_error(L, ret); + } + return 1; + +} + +static int luv_udp_try_send(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + uv_buf_t buf; + int ret, port; + const char* host; + struct sockaddr_storage addr; + luv_check_buf(L, 2, &buf); + host = luaL_checkstring(L, 3); + port = luaL_checkinteger(L, 4); + if (uv_ip4_addr(host, port, (struct sockaddr_in*)&addr) && + uv_ip6_addr(host, port, (struct sockaddr_in6*)&addr)) { + return luaL_error(L, "Invalid IP address or port [%s:%d]", host, port); + } + ret = uv_udp_try_send(handle, &buf, 1, (struct sockaddr*)&addr); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static void luv_udp_recv_cb(uv_udp_t* handle, ssize_t nread, const uv_buf_t* buf, const struct sockaddr* addr, unsigned flags) { + lua_State* L = luv_state(handle->loop); + + // err + if (nread < 0) { + luv_status(L, nread); + } + else { + lua_pushnil(L); + } + + // data + if (nread == 0) { + if (addr) { + lua_pushstring(L, ""); + } + else { + lua_pushnil(L); + } + } + else if (nread > 0) { + lua_pushlstring(L, buf->base, nread); + } + if (buf) free(buf->base); + + // address + if (addr) { + parse_sockaddr(L, (struct sockaddr_storage*)addr, sizeof *addr); + } + else { + lua_pushnil(L); + } + + // flags + lua_newtable(L); + if (flags & UV_UDP_PARTIAL) { + lua_pushboolean(L, 1); + lua_setfield(L, -2, "partial"); + } + + luv_call_callback(L, handle->data, LUV_RECV, 4); +} + +static int luv_udp_recv_start(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + int ret; + luv_check_callback(L, handle->data, LUV_RECV, 2); + ret = uv_udp_recv_start(handle, luv_alloc_cb, luv_udp_recv_cb); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} + +static int luv_udp_recv_stop(lua_State* L) { + uv_udp_t* handle = luv_check_udp(L, 1); + int ret = uv_udp_recv_stop(handle); + if (ret < 0) return luv_error(L, ret); + lua_pushinteger(L, ret); + return 1; +} diff --git a/3rdparty/luv/src/util.c b/3rdparty/luv/src/util.c new file mode 100644 index 00000000000..c7b98c1759a --- /dev/null +++ b/3rdparty/luv/src/util.c @@ -0,0 +1,56 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include "luv.h" + +void luv_stack_dump(lua_State* L, const char* name) { + int i, l; + fprintf(stderr, "\nAPI STACK DUMP %p %d: %s\n", L, lua_status(L), name); + for (i = 1, l = lua_gettop(L); i <= l; i++) { + int type = lua_type(L, i); + switch (type) { + case LUA_TSTRING: + fprintf(stderr, " %d %s \"%s\"\n", i, lua_typename(L, type), lua_tostring(L, i)); + break; + case LUA_TNUMBER: + fprintf(stderr, " %d %s %ld\n", i, lua_typename(L, type), (long int) lua_tointeger(L, i)); + break; + case LUA_TUSERDATA: + fprintf(stderr, " %d %s %p\n", i, lua_typename(L, type), lua_touserdata(L, i)); + break; + default: + fprintf(stderr, " %d %s\n", i, lua_typename(L, type)); + break; + } + } + assert(l == lua_gettop(L)); +} + +static int luv_error(lua_State* L, int status) { + lua_pushnil(L); + lua_pushfstring(L, "%s: %s", uv_err_name(status), uv_strerror(status)); + lua_pushstring(L, uv_err_name(status)); + return 3; +} + +static void luv_status(lua_State* L, int status) { + if (status < 0) { + lua_pushstring(L, uv_err_name(status)); + } + else { + lua_pushnil(L); + } +} diff --git a/3rdparty/luv/src/util.h b/3rdparty/luv/src/util.h new file mode 100644 index 00000000000..c669c0430db --- /dev/null +++ b/3rdparty/luv/src/util.h @@ -0,0 +1,26 @@ +/* + * Copyright 2014 The Luvit Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#ifndef LUV_UTIL_H +#define LUV_UTIL_H + +#include "luv.h" + +void luv_stack_dump(lua_State* L, const char* name); +static int luv_error(lua_State* L, int ret); +static void luv_status(lua_State* L, int status); + +#endif diff --git a/3rdparty/luv/src/work.c b/3rdparty/luv/src/work.c new file mode 100644 index 00000000000..e40212f1e7c --- /dev/null +++ b/3rdparty/luv/src/work.c @@ -0,0 +1,224 @@ +/* +* Copyright 2014 The Luvit Authors. All Rights Reserved. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +#include "luv.h" + +#include "lthreadpool.h" + +typedef struct { + lua_State* L; /* vm in main */ + char* code; /* thread entry code */ + size_t len; + + uv_async_t async; + int async_cb; /* ref, run in main, call when async message received, NYI */ + int after_work_cb; /* ref, run in main ,call after work cb*/ +} luv_work_ctx_t; + +typedef struct { + uv_work_t work; + luv_work_ctx_t* ctx; + + luv_thread_arg_t arg; +} luv_work_t; + +static uv_key_t L_key; + +static luv_work_ctx_t* luv_check_work_ctx(lua_State* L, int index) +{ + luv_work_ctx_t* ctx = luaL_checkudata(L, index, "luv_work_ctx"); + return ctx; +} + +static int luv_work_ctx_gc(lua_State *L) +{ + luv_work_ctx_t* ctx = luv_check_work_ctx(L, 1); + free(ctx->code); + luaL_unref(L, LUA_REGISTRYINDEX, ctx->after_work_cb); + luaL_unref(L, LUA_REGISTRYINDEX, ctx->async_cb); + + return 0; +} + +static int luv_work_ctx_tostring(lua_State* L) +{ + luv_work_ctx_t* ctx = luv_check_work_ctx(L, 1); + lua_pushfstring(L, "luv_work_ctx_t: %p", ctx); + return 1; +} + +static void luv_work_cb(uv_work_t* req) +{ + luv_work_t* work = req->data; + luv_work_ctx_t* ctx = work->ctx; + lua_State *L = uv_key_get(&L_key); + int top; + if (L == NULL) { + /* vm reuse in threadpool */ + L = acquire_vm_cb(); + uv_key_set(&L_key, L); + } + + top = lua_gettop(L); + lua_pushlstring(L, ctx->code, ctx->len); + lua_rawget(L, LUA_REGISTRYINDEX); + if (lua_isnil(L, -1)) + { + lua_pop(L, 1); + + lua_pushlstring(L, ctx->code, ctx->len); + if (luaL_loadbuffer(L, ctx->code, ctx->len, "=pool") != 0) + { + fprintf(stderr, "Uncaught Error: %s\n", lua_tostring(L, -1)); + lua_pop(L, 2); + + lua_pushnil(L); + } else + { + lua_pushvalue(L, -1); + lua_insert(L, lua_gettop(L) - 2); + lua_rawset(L, LUA_REGISTRYINDEX); + } + } + + if (lua_isfunction(L, -1)) + { + int i = luv_thread_arg_push(L, &work->arg); + if (lua_pcall(L, i, LUA_MULTRET, 0)) { + fprintf(stderr, "Uncaught Error in thread: %s\n", lua_tostring(L, -1)); + } + luv_thread_arg_clear(&work->arg); + luv_thread_arg_set(L, &work->arg, top + 1, lua_gettop(L), 0); + lua_settop(L, top); + } else { + fprintf(stderr, "Uncaught Error: %s can't be work entry\n", + lua_typename(L, lua_type(L,-1))); + } +} + +static void luv_after_work_cb(uv_work_t* req, int status) { + luv_work_t* work = req->data; + luv_work_ctx_t* ctx = work->ctx; + lua_State*L = ctx->L; + int i; + (void)status; + lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->after_work_cb); + i = luv_thread_arg_push(L, &work->arg); + if (lua_pcall(L, i, 0, 0)) + { + fprintf(stderr, "Uncaught Error in thread: %s\n", lua_tostring(L, -1)); + } + + //ref down to ctx + lua_pushlightuserdata(L, work); + lua_pushnil(L); + lua_rawset(L, LUA_REGISTRYINDEX); + + luv_thread_arg_clear(&work->arg); + free(work); +} + +static void async_cb(uv_async_t *handle) +{ + luv_work_t*work = handle->data; + luv_work_ctx_t* ctx = work->ctx; + lua_State*L = ctx->L; + int i; + lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->async_cb); + i = luv_thread_arg_push(L, &work->arg); + if (lua_pcall(L, i, 0, 0)) + { + fprintf(stderr, "Uncaught Error in thread: %s\n", lua_tostring(L, -1)); + } +} + +static int luv_new_work(lua_State* L) { + size_t len; + const char* buff; + luv_work_ctx_t* ctx; + + buff = luv_thread_dumped(L, 1, &len); + luaL_checktype(L, 2, LUA_TFUNCTION); + if(!lua_isnoneornil(L, 3)) + luaL_checktype(L, 3, LUA_TFUNCTION); + + ctx = lua_newuserdata(L, sizeof(*ctx)); + memset(ctx, 0, sizeof(*ctx)); + + ctx->len = len; + ctx->code = malloc(ctx->len); + memcpy(ctx->code, buff, len); + + lua_pushvalue(L, 2); + ctx->after_work_cb = luaL_ref(L, LUA_REGISTRYINDEX); + if (lua_gettop(L) == 4) { + lua_pushvalue(L, 3); + ctx->async_cb = luaL_ref(L, LUA_REGISTRYINDEX); + uv_async_init(luv_loop(L), &ctx->async, async_cb); + } else + ctx->async_cb = LUA_REFNIL; + ctx->L = L; + luaL_getmetatable(L, "luv_work_ctx"); + lua_setmetatable(L, -2); + return 1; +} + +static int luv_queue_work(lua_State* L) { + int top = lua_gettop(L); + luv_work_ctx_t* ctx = luv_check_work_ctx(L, 1); + luv_work_t* work = malloc(sizeof(*work)); + int ret; + + luv_thread_arg_set(L, &work->arg, 2, top, 0); + work->ctx = ctx; + work->work.data = work; + ret = uv_queue_work(luv_loop(L), &work->work, luv_work_cb, luv_after_work_cb); + if (ret < 0) { + free(work); + return luv_error(L, ret); + } + + //ref up to ctx + lua_pushlightuserdata(L, work); + lua_pushvalue(L, 1); + lua_rawset(L, LUA_REGISTRYINDEX); + + lua_pushboolean(L, 1); + return 1; +} + +static const luaL_Reg luv_work_ctx_methods[] = { + {"queue", luv_queue_work}, + {NULL, NULL} +}; + +static int key_inited = 0; +static void luv_work_init(lua_State* L) { + luaL_newmetatable(L, "luv_work_ctx"); + lua_pushcfunction(L, luv_work_ctx_tostring); + lua_setfield(L, -2, "__tostring"); + lua_pushcfunction(L, luv_work_ctx_gc); + lua_setfield(L, -2, "__gc"); + lua_newtable(L); + luaL_setfuncs(L, luv_work_ctx_methods, 0); + lua_setfield(L, -2, "__index"); + lua_pop(L, 1); + + if (key_inited==0) { + key_inited = 1; + uv_key_create(&L_key); + } +} diff --git a/3rdparty/luv/tests/manual-test-cluster.lua b/3rdparty/luv/tests/manual-test-cluster.lua new file mode 100644 index 00000000000..304e4be634d --- /dev/null +++ b/3rdparty/luv/tests/manual-test-cluster.lua @@ -0,0 +1,213 @@ +-- This is quite the involved test. Basically it binds +-- to a tcp port, spawns n children (one per CPU core) +-- who all listen on the same shared port and act as a +-- load balancing cluster. +-- Then N clients are spawned that connect to the cluster +-- The application itself kills the worker upon connection +-- All N workers should accept exactly one request and all close. + +return require('lib/tap')(function (test) + + -- This function will be run in a child process + local worker_code = string.dump(function () + local dump = require('lib/utils').dump + + local function print(...) + local n = select('#', ...) + local arguments = {...} + for i = 1, n do + arguments[i] = tostring(arguments[i]) + end + + local text = table.concat(arguments, "\t") + text = " " .. string.gsub(text, "\n", "\n ") + _G.print(text) + end + + local function p(...) + local n = select('#', ...) + local arguments = { ... } + + for i = 1, n do + arguments[i] = dump(arguments[i]) + end + + print(table.concat(arguments, "\t")) + end + + local uv = require('luv') + local answer = -1 + + -- The parent is going to pass us the server handle over a pipe + -- This will be our local file descriptor at PIPE_FD + local pipe = uv.new_pipe(true) + local pipe_fd = tonumber(os.getenv("PIPE_FD")) + assert(uv.pipe_open(pipe, pipe_fd)) + + -- Configure the server handle + local server = uv.new_tcp() + local done = false + local function onconnection() + print("NOT ACCEPTING, already done") + if done then return end + local client = uv.new_tcp() + assert(uv.accept(server, client)) + p("New TCP", client, "on", server) + p{client=client} + assert(uv.write(client, "BYE!\n")); + assert(uv.shutdown(client, function () + uv.close(client) + uv.unref(server) + done = true + answer = 42 + end)) + end + + -- Read the server handle from the parent + local function onread(err, data) + p("onread", {err=err,data=data}) + assert(not err, err) + if uv.pipe_pending_count(pipe) > 0 then + local pending_type = uv.pipe_pending_type(pipe) + p("pending_type", pending_type) + assert(pending_type == "tcp") + assert(uv.accept(pipe, server)) + assert(uv.listen(server, 0, onconnection)) + p("Received server handle from parent process", server) + elseif data then + p("ondata", data) + else + p("onend", data) + end + end + uv.read_start(pipe, onread) + + -- Start the event loop! + uv.run() + + os.exit(answer) + end) + + local client_code = string.dump(function () + local dump = require('lib/utils').dump + + local function print(...) + local n = select('#', ...) + local arguments = {...} + for i = 1, n do + arguments[i] = tostring(arguments[i]) + end + + local text = table.concat(arguments, "\t") + text = " " .. string.gsub(text, "\n", "\n ") + _G.print(text) + end + + local function p(...) + local n = select('#', ...) + local arguments = { ... } + + for i = 1, n do + arguments[i] = dump(arguments[i]) + end + + print(table.concat(arguments, "\t")) + end + + local uv = require('luv') + + local host = os.getenv("HOST") + local port = tonumber(os.getenv("PORT")) + + local socket = uv.new_tcp() + + assert(uv.tcp_connect(socket, host, port, function (err) + p("client connected", {err=err}) + assert(not err, err) + end)) + + -- Start the event loop! + uv.run() + end) + + test("tcp cluster", function (print, p, expect, uv) + + local exepath = assert(uv.exepath()) + local cpu_count = # assert(uv.cpu_info()) + local left = cpu_count + + local server = uv.new_tcp() + assert(uv.tcp_bind(server, "::1", 0)) + + local address = uv.tcp_getsockname(server) + p{server=server,address=address} + + print("Master process bound to TCP port " .. address.port .. " on " .. address.ip) + + local function spawnWorker() + local pipe = uv.new_pipe(true) + local input = uv.new_pipe(false) + local child, pid + child, pid = assert(uv.spawn(exepath, { + cwd = uv.cwd(), + stdio = {input,1,2,pipe}, + env= {"PIPE_FD=3"} + }, expect(function (status, signal) + p("Worker exited", {status=status,signal=signal}) + assert(status == 42, "worker should return 42") + assert(signal == 0) + left = left - 1 + uv.close(child) + uv.close(input) + uv.close(pipe) + if left == 0 then + p("All workers are now dead") + uv.close(server) + end + end))) + p("Spawned worker", pid, "and sending handle", server) + assert(uv.write(input, worker_code)) + assert(uv.write2(pipe, "123", server)) + assert(uv.shutdown(input)) + assert(uv.shutdown(pipe)) + end + + local function spawnClient() + local input = uv.new_pipe(false) + local child, pid + child, pid = assert(uv.spawn(exepath, { + stdio = {input,1,2}, + cwd = uv.cwd(), + env= { + "HOST=" .. address.ip, + "PORT=" .. address.port, + } + }, expect(function (status, signal) + p("Client exited", {status=status,signal=signal}) + assert(status == 0) + assert(signal == 0) + uv.close(child) + end, left))) + p("Spawned client", pid) + assert(uv.write(input, client_code)) + assert(uv.shutdown(input)) + uv.close(input) + end + + -- Spawn a child process for each CPU core + for _ = 1, cpu_count do + spawnWorker() + end + + -- Spawn the clients after a short delay + local timer = uv.new_timer() + uv.timer_start(timer, 1000, 0, expect(function () + for _ = 1, cpu_count do + spawnClient() + end + uv.close(timer) + end)) + + end) +end) + diff --git a/3rdparty/luv/tests/run.lua b/3rdparty/luv/tests/run.lua new file mode 100644 index 00000000000..ea94e9bd58b --- /dev/null +++ b/3rdparty/luv/tests/run.lua @@ -0,0 +1,33 @@ +-- Run this from the parent directory as +-- +-- luajit tests/run.lua +-- + +local tap = require("lib/tap") +local uv = require("luv") + +local isWindows +if jit and jit.os then + -- Luajit provides explicit platform detection + isWindows = jit.os == "Windows" +else + -- Normal lua will only have \ for path separator on windows. + isWindows = package.config:find("\\") and true or false +end +_G.isWindows = isWindows + +local req = uv.fs_scandir("tests") + +while true do + local name = uv.fs_scandir_next(req) + if not name then break end + local match = string.match(name, "^test%-(.*).lua$") + if match then + local path = "tests/test-" .. match + tap(match) + require(path) + end +end + +-- run the tests! +tap(true) diff --git a/3rdparty/luv/tests/test-async.lua b/3rdparty/luv/tests/test-async.lua new file mode 100644 index 00000000000..88527cdb88d --- /dev/null +++ b/3rdparty/luv/tests/test-async.lua @@ -0,0 +1,32 @@ +return require('lib/tap')(function (test) + + test("test pass async between threads", function(p, p, expect, uv) + local before = os.time() + local async + async = uv.new_async(expect(function (a,b,c) + p('in async notify callback') + p(a,b,c) + assert(a=='a') + assert(b==true) + assert(c==250) + uv.close(async) + end)) + local args = {500, 'string', nil, false, 5, "helloworld",async} + local unpack = unpack or table.unpack + uv.new_thread(function(num,s,null,bool,five,hw,asy) + local uv = require'luv' + assert(type(num) == "number") + assert(type(s) == "string") + assert(null == nil) + assert(bool == false) + assert(five == 5) + assert(hw == 'helloworld') + assert(type(asy)=='userdata') + assert(uv.async_send(asy,'a',true,250)==0) + uv.sleep(1000) + end, unpack(args)):join() + local elapsed = (os.time() - before) * 1000 + assert(elapsed >= 1000, "elapsed should be at least delay ") + end) + +end) diff --git a/3rdparty/luv/tests/test-conversions.lua b/3rdparty/luv/tests/test-conversions.lua new file mode 100644 index 00000000000..f14056ddfb5 --- /dev/null +++ b/3rdparty/luv/tests/test-conversions.lua @@ -0,0 +1,6 @@ +return require('lib/tap')(function (test) + test("basic 64bit conversions", function (print, p, expect, uv) + assert(string.format("%x", 29913653248) == "6f6fe2000") + assert(string.format("%x", 32207650816) == "77fb9c000") + end) +end) diff --git a/3rdparty/luv/tests/test-dns.lua b/3rdparty/luv/tests/test-dns.lua new file mode 100644 index 00000000000..c24adba7164 --- /dev/null +++ b/3rdparty/luv/tests/test-dns.lua @@ -0,0 +1,125 @@ +return require('lib/tap')(function (test) + + test("Get all local http addresses", function (print, p, expect, uv) + assert(uv.getaddrinfo(nil, "http", nil, expect(function (err, res) + p(res, #res) + assert(not err, err) + assert(res[1].port == 80) + end))) + end) + + test("Get all local http addresses sync", function (print, p, expect, uv) + local res = assert(uv.getaddrinfo(nil, "http")) + p(res, #res) + assert(res[1].port == 80) + end) + + test("Get only ipv4 tcp adresses for luvit.io", function (print, p, expect, uv) + assert(uv.getaddrinfo("luvit.io", nil, { + socktype = "stream", + family = "inet", + }, expect(function (err, res) + assert(not err, err) + p(res, #res) + assert(#res == 1) + end))) + end) + + -- FIXME: this test always fails on AppVeyor for some reason + if _G.isWindows and not os.getenv'APPVEYOR' then + test("Get only ipv6 tcp adresses for luvit.io", function (print, p, expect, uv) + assert(uv.getaddrinfo("luvit.io", nil, { + socktype = "stream", + family = "inet6", + }, expect(function (err, res) + assert(not err, err) + p(res, #res) + assert(#res == 1) + end))) + end) + end + + test("Get ipv4 and ipv6 tcp adresses for luvit.io", function (print, p, expect, uv) + assert(uv.getaddrinfo("luvit.io", nil, { + socktype = "stream", + }, expect(function (err, res) + assert(not err, err) + p(res, #res) + assert(#res > 0) + end))) + end) + + test("Get all adresses for luvit.io", function (print, p, expect, uv) + assert(uv.getaddrinfo("luvit.io", nil, nil, expect(function (err, res) + assert(not err, err) + p(res, #res) + assert(#res > 0) + end))) + end) + + test("Lookup local ipv4 address", function (print, p, expect, uv) + assert(uv.getnameinfo({ + family = "inet", + }, expect(function (err, hostname, service) + p{err=err,hostname=hostname,service=service} + assert(not err, err) + assert(hostname) + assert(service) + end))) + end) + + test("Lookup local ipv4 address sync", function (print, p, expect, uv) + local hostname, service = assert(uv.getnameinfo({ + family = "inet", + })) + p{hostname=hostname,service=service} + assert(hostname) + assert(service) + end) + + test("Lookup local 127.0.0.1 ipv4 address", function (print, p, expect, uv) + assert(uv.getnameinfo({ + ip = "127.0.0.1", + }, expect(function (err, hostname, service) + p{err=err,hostname=hostname,service=service} + assert(not err, err) + assert(hostname) + assert(service) + end))) + end) + + test("Lookup local ipv6 address", function (print, p, expect, uv) + assert(uv.getnameinfo({ + family = "inet6", + }, expect(function (err, hostname, service) + p{err=err,hostname=hostname,service=service} + assert(not err, err) + assert(hostname) + assert(service) + end))) + end) + + test("Lookup local ::1 ipv6 address", function (print, p, expect, uv) + assert(uv.getnameinfo({ + ip = "::1", + }, expect(function (err, hostname, service) + p{err=err,hostname=hostname,service=service} + assert(not err, err) + assert(hostname) + assert(service) + end))) + end) + + test("Lookup local port 80 service", function (print, p, expect, uv) + assert(uv.getnameinfo({ + port = 80, + family = "inet6", + }, expect(function (err, hostname, service) + p{err=err,hostname=hostname,service=service} + assert(not err, err) + assert(hostname) + assert(service == "http") + end))) + end) + +end) diff --git a/3rdparty/luv/tests/test-fs.lua b/3rdparty/luv/tests/test-fs.lua new file mode 100644 index 00000000000..4bfd67e6578 --- /dev/null +++ b/3rdparty/luv/tests/test-fs.lua @@ -0,0 +1,90 @@ +return require('lib/tap')(function (test) + + test("read a file sync", function (print, p, expect, uv) + local fd = assert(uv.fs_open('README.md', 'r', tonumber('644', 8))) + p{fd=fd} + local stat = assert(uv.fs_fstat(fd)) + p{stat=stat} + local chunk = assert(uv.fs_read(fd, stat.size, 0)) + assert(#chunk == stat.size) + assert(uv.fs_close(fd)) + end) + + test("read a file async", function (print, p, expect, uv) + uv.fs_open('README.md', 'r', tonumber('644', 8), expect(function (err, fd) + assert(not err, err) + p{fd=fd} + uv.fs_fstat(fd, expect(function (err, stat) + assert(not err, err) + p{stat=stat} + uv.fs_read(fd, stat.size, 0, expect(function (err, chunk) + assert(not err, err) + p{chunk=#chunk} + assert(#chunk == stat.size) + uv.fs_close(fd, expect(function (err) + assert(not err, err) + end)) + end)) + end)) + end)) + end) + + test("fs.write", function (print, p, expect, uv) + local path = "_test_" + local fd = assert(uv.fs_open(path, "w", 438)) + uv.fs_write(fd, "Hello World\n", -1) + uv.fs_write(fd, {"with\n", "more\n", "lines\n"}, -1) + uv.fs_close(fd) + uv.fs_unlink(path) + end) + + test("fs.stat sync", function (print, p, expect, uv) + local stat = assert(uv.fs_stat("README.md")) + assert(stat.size) + end) + + test("fs.stat async", function (print, p, expect, uv) + assert(uv.fs_stat("README.md", expect(function (err, stat) + assert(not err, err) + assert(stat.size) + end))) + end) + + test("fs.stat sync error", function (print, p, expect, uv) + local stat, err, code = uv.fs_stat("BAD_FILE!") + p{err=err,code=code,stat=stat} + assert(not stat) + assert(err) + assert(code == "ENOENT") + end) + + test("fs.stat async error", function (print, p, expect, uv) + assert(uv.fs_stat("BAD_FILE@", expect(function (err, stat) + p{err=err,stat=stat} + assert(err) + assert(not stat) + end))) + end) + + test("fs.scandir", function (print, p, expect, uv) + local req = uv.fs_scandir('.') + local function iter() + return uv.fs_scandir_next(req) + end + for name, ftype in iter do + p{name=name, ftype=ftype} + assert(name) + -- ftype is not available in all filesystems; for example it's + -- provided for HFS+ (OSX), NTFS (Windows) but not for ext4 (Linux). + end + end) + + test("fs.realpath", function (print, p, expect, uv) + p(assert(uv.fs_realpath('.'))) + assert(uv.fs_realpath('.', expect(function (err, path) + assert(not err, err) + p(path) + end))) + end) + +end) diff --git a/3rdparty/luv/tests/test-leaks.lua b/3rdparty/luv/tests/test-leaks.lua new file mode 100644 index 00000000000..06c6e49a0cf --- /dev/null +++ b/3rdparty/luv/tests/test-leaks.lua @@ -0,0 +1,186 @@ +return require('lib/tap')(function (test) + + local function bench(uv, p, count, fn) + collectgarbage() + local before + local notify = count / 8 + for i = 1, count do + fn() + if i % notify == 0 then + uv.run() + collectgarbage() + local now = uv.resident_set_memory() + if not before then before = now end + p(i, now) + end + end + uv.run() + collectgarbage() + local after = uv.resident_set_memory() + p{ + before = before, + after = after, + } + assert(after < before * 1.5) + end + + test("fs-write", function (print, p, expect, uv) + bench(uv, p, 0x7000, function () + local path = "_test_" + local fd = assert(uv.fs_open(path, "w", 438)) + uv.fs_write(fd, "Hello World\n", -1) + uv.fs_write(fd, {"with\n", "more\n", "lines\n"}, -1) + uv.fs_close(fd) + uv.fs_unlink(path) + end) + end) + + test("lots-o-timers", function (print, p, expect, uv) + bench(uv, p, 0x10000, function () + local timer = uv.new_timer() + uv.close(timer) + end) + end) + + test("lots-o-timers with canceled callbacks", function (print, p, expect, uv) + bench(uv, p, 0x10000, function () + local timer = uv.new_timer() + uv.timer_start(timer, 100, 100, function () + end) + uv.timer_stop(timer) + uv.close(timer, function () + end) + uv.run() + end) + end) + + test("lots-o-timers with real timeouts", function (print, p, expect, uv) + bench(uv, p, 0x500, function () + local timer = uv.new_timer() + uv.timer_start(timer, 10, 0, expect(function () + uv.timer_stop(timer) + uv.close(timer, function () + end) + end)) + end) + end) + + test("reading file async", function (print, p, expect, uv) + local mode = tonumber("644", 8) + bench(uv, p, 0x500, function () + local onOpen, onStat, onRead, onClose + local fd, stat + + onOpen = expect(function (err, result) + assert(not err, err) + fd = result + uv.fs_fstat(fd, onStat) + end) + + onStat = expect(function (err, result) + assert(not err, err) + stat = result + uv.fs_read(fd, stat.size, 0, onRead) + end) + + onRead = expect(function (err, data) + assert(not err, err) + assert(#data == stat.size) + uv.fs_close(fd, onClose) + end) + + onClose = expect(function (err) + assert(not err, err) + end) + + assert(uv.fs_open("README.md", "r", mode, onOpen)) + end) + end) + + test("reading file sync", function (print, p, expect, uv) + local mode = tonumber("644", 8) + bench(uv, p, 0x2000, function () + local fd = assert(uv.fs_open("README.md", "r", mode)) + local stat = assert(uv.fs_fstat(fd)) + local data = assert(uv.fs_read(fd, stat.size, 0)) + assert(#data == stat.size) + assert(uv.fs_close(fd)) + end) + end) + + test("invalid file", function (print, p, expect, uv) + local mode = tonumber("644", 8) + bench(uv, p, 0x1500, function () + local req = uv.fs_open("BAD_FILE", "r", mode, expect(function (err, fd) + assert(not fd) + assert(err) + end)) + end) + end) + + test("invalid file sync", function (print, p, expect, uv) + local mode = tonumber("644", 8) + bench(uv, p, 0x20000, function () + local fd, err = uv.fs_open("BAD_FILE", "r", mode) + assert(not fd) + assert(err) + end) + end) + + test("invalid spawn args", function (print, p, expect, uv) + -- Regression test for #73 + bench(uv, p, 0x10000, function () + local ret, err = pcall(function () + return uv.spawn("ls", { + args = {"-l", "-h"}, + stdio = {0, 1, 2}, + env = {"EXTRA=true"}, + gid = false, -- Should be integer + }) + end) + assert(not ret) + assert(err) + end) + end) + + test("stream writing with string and array", function (print, p, expect, uv) + local port = 0 + local server = uv.new_tcp() + local data + local count = 0x800 + server:unref() + server:bind("127.0.0.1", port) + server:listen(128, expect(function (err) + assert(not err, err) + local client = uv.new_tcp() + server:accept(client) + client:write(data) + client:read_start(expect(function (err, data) + assert(not err, err) + assert(data) + client:close() + end)) + end, count)) + local address = server:getsockname() + bench(uv, p, count, function () + data = string.rep("Hello", 500) + local socket = uv.new_tcp() + socket:connect(address.ip, address.port, expect(function (err) + assert(not err, err) + socket:read_start(expect(function (err, chunk) + assert(not err, err) + assert(chunk) + local data = {} + for i = 0, 100 do + data[i + 1] = string.rep(string.char(i), 100) + end + socket:write(data) + socket:close() + end)) + end)) + uv.run() + end) + server:close() + end) + +end) diff --git a/3rdparty/luv/tests/test-misc.lua b/3rdparty/luv/tests/test-misc.lua new file mode 100644 index 00000000000..72a7b30785e --- /dev/null +++ b/3rdparty/luv/tests/test-misc.lua @@ -0,0 +1,85 @@ +return require('lib/tap')(function (test) + + test("uv.guess_handle", function (print, p, expect, uv) + local types = { + [0] = assert(uv.guess_handle(0)), + assert(uv.guess_handle(1)), + assert(uv.guess_handle(2)), + } + p("stdio fd types", types) + end) + + test("uv.version and uv.version_string", function (print, p, expect, uv) + local version = assert(uv.version()) + local version_string = assert(uv.version_string()) + p{version=version, version_string=version_string} + assert(type(version) == "number") + assert(type(version_string) == "string") + end) + + test("memory size", function (print, p, expect, uv) + local rss = uv.resident_set_memory() + local total = uv.get_total_memory() + local free = uv.get_free_memory() + p{rss=rss,total=total,free=free} + assert(rss < total) + end) + + test("uv.uptime", function (print, p, expect, uv) + local uptime = assert(uv.uptime()) + p{uptime=uptime} + end) + + test("uv.getrusage", function (print, p, expect, uv) + local rusage = assert(uv.getrusage()) + p(rusage) + end) + + test("uv.cpu_info", function (print, p, expect, uv) + local info = assert(uv.cpu_info()) + p(info) + end) + + test("uv.interface_addresses", function (print, p, expect, uv) + local addresses = assert(uv.interface_addresses()) + for name, info in pairs(addresses) do + p(name, addresses[name]) + end + end) + + test("uv.loadavg", function (print, p, expect, uv) + local avg = {assert(uv.loadavg())} + p(avg) + assert(#avg == 3) + end) + + test("uv.exepath", function (print, p, expect, uv) + local path = assert(uv.exepath()) + p(path) + end) + + test("uv.os_homedir", function (print, p, expect, uv) + local path = assert(uv.os_homedir()) + p(path) + end) + + test("uv.cwd and uv.chdir", function (print, p, expect, uv) + local old = assert(uv.cwd()) + p(old) + assert(uv.chdir("/")) + local cwd = assert(uv.cwd()) + p(cwd) + assert(cwd ~= old) + assert(uv.chdir(old)) + end) + + test("uv.hrtime", function (print, p, expect, uv) + local time = assert(uv.hrtime()) + p(time) + end) + + test("test_getpid", function (print, p, expect, uv) + assert(uv.getpid()) + end) + +end) diff --git a/3rdparty/luv/tests/test-prepare-check-idle-async.lua b/3rdparty/luv/tests/test-prepare-check-idle-async.lua new file mode 100644 index 00000000000..389c2633efb --- /dev/null +++ b/3rdparty/luv/tests/test-prepare-check-idle-async.lua @@ -0,0 +1,49 @@ +return require('lib/tap')(function (test) + + test("simple prepare", function (print, p, expect, uv) + local prepare = uv.new_prepare() + uv.prepare_start(prepare, expect(function () + p("prepare", prepare) + uv.prepare_stop(prepare) + uv.close(prepare, expect(function () + end)) + end)) + end) + + test("simple check", function (print, p, expect, uv) + local check = uv.new_check() + uv.check_start(check, expect(function () + p("check", check) + uv.check_stop(check) + uv.close(check, expect(function () + end)) + end)) + + -- Trigger with a timer + local timer = uv.new_timer() + uv.timer_start(timer, 10, 0, expect(function() + p("timeout", timer) + uv.timer_stop(timer) + uv.close(timer) + end)) + end) + + test("simple idle", function (print, p, expect, uv) + local idle = uv.new_idle() + uv.idle_start(idle, expect(function () + p("idle", idle) + uv.idle_stop(idle) + uv.close(idle, expect(function () + end)) + end)) + end) + + test("simple async", function (print, p, expect, uv) + local async + async = uv.new_async(expect(function () + uv.close(async) + end)) + uv.async_send(async) + end) + +end) diff --git a/3rdparty/luv/tests/test-process.lua b/3rdparty/luv/tests/test-process.lua new file mode 100644 index 00000000000..4d2b6fbfdab --- /dev/null +++ b/3rdparty/luv/tests/test-process.lua @@ -0,0 +1,101 @@ +return require('lib/tap')(function (test) + + test("test disable_stdio_inheritance", function (print, p, expect, uv) + uv.disable_stdio_inheritance() + end) + + test("process stdout", function (print, p, expect, uv) + local stdout = uv.new_pipe(false) + + local handle, pid + handle, pid = uv.spawn(uv.exepath(), { + args = {"-e", "print 'Hello World'"}, + stdio = {nil, stdout}, + }, expect(function (code, signal) + p("exit", {code=code, signal=signal}) + uv.close(handle) + end)) + + p{ + handle=handle, + pid=pid + } + + uv.read_start(stdout, expect(function (err, chunk) + p("stdout", {err=err,chunk=chunk}) + assert(not err, err) + uv.close(stdout) + end)) + + end) + + if _G.isWindows then return end + + test("spawn and kill by pid", function (print, p, expect, uv) + local handle, pid + handle, pid = uv.spawn("sleep", { + args = {1}, + }, expect(function (status, signal) + p("exit", handle, {status=status,signal=signal}) + assert(status == 0) + assert(signal == 2) + uv.close(handle) + end)) + p{handle=handle,pid=pid} + uv.kill(pid, "sigint") + end) + + test("spawn and kill by handle", function (print, p, expect, uv) + local handle, pid + handle, pid = uv.spawn("sleep", { + args = {1}, + }, expect(function (status, signal) + p("exit", handle, {status=status,signal=signal}) + assert(status == 0) + assert(signal == 15) + uv.close(handle) + end)) + p{handle=handle,pid=pid} + uv.process_kill(handle, "sigterm") + end) + + test("invalid command", function (print, p, expect, uv) + local handle, err + handle, err = uv.spawn("ksjdfksjdflkjsflksdf", {}, function(exit, code) + assert(false) + end) + assert(handle == nil) + assert(err) + end) + + test("process stdio", function (print, p, expect, uv) + local stdin = uv.new_pipe(false) + local stdout = uv.new_pipe(false) + + local handle, pid + handle, pid = uv.spawn("cat", { + stdio = {stdin, stdout}, + }, expect(function (code, signal) + p("exit", {code=code, signal=signal}) + uv.close(handle) + end)) + + p{ + handle=handle, + pid=pid + } + + uv.read_start(stdout, expect(function (err, chunk) + p("stdout", {err=err,chunk=chunk}) + assert(not err, err) + uv.close(stdout) + end)) + + uv.write(stdin, "Hello World") + uv.shutdown(stdin, expect(function () + uv.close(stdin) + end)) + + end) + +end) diff --git a/3rdparty/luv/tests/test-sigchld-after-lua_close.sh b/3rdparty/luv/tests/test-sigchld-after-lua_close.sh new file mode 100644 index 00000000000..e7d22d3df36 --- /dev/null +++ b/3rdparty/luv/tests/test-sigchld-after-lua_close.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# Verifies that luv will cleanup libuv process handles correctly even if +# not done by "userspace". +# Details: https://github.com/luvit/luv/issues/193 + +# This test modifies one of the examples to skip libuv process cleanup, +# purposely making it leave SIGCHLD signal handler. +# +patch -p1 << "EOF" +diff --git a/examples/talking-to-children.lua b/examples/talking-to-children.lua +index 10a53ef..6c6c53f 100644 +--- a/examples/talking-to-children.lua ++++ b/examples/talking-to-children.lua +@@ -41,7 +41,3 @@ uv.read_start(stdout, onread) + uv.read_start(stderr, onread) + uv.write(stdin, "Hello World") + uv.shutdown(stdin, onshutdown) +- +-uv.run() +-uv.walk(uv.close) +-uv.run() +EOF + +# It also requires a patched lua standalone interpreter that sends SIGCHLD to +# itself after calling lua_close, which would have freed all memory of the libuv +# event loop associated with the lua state. +( +cd deps/lua +patch -p1 << "EOF" +diff --git a/src/lua.c b/src/lua.c +index 7a47582..4dc19d5 100644 +--- a/src/lua.c ++++ b/src/lua.c +@@ -608,6 +608,7 @@ int main (int argc, char **argv) { + result = lua_toboolean(L, -1); /* get result */ + report(L, status); + lua_close(L); ++ kill(0, SIGCHLD); + return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE; + } +EOF +) + +WITH_LUA_ENGINE=Lua make +./build/lua examples/talking-to-children.lua diff --git a/3rdparty/luv/tests/test-signal.lua b/3rdparty/luv/tests/test-signal.lua new file mode 100644 index 00000000000..c05db77c888 --- /dev/null +++ b/3rdparty/luv/tests/test-signal.lua @@ -0,0 +1,40 @@ +local child_code = string.dump(function () + local uv = require('luv') + local signal = uv.new_signal() + uv.ref(signal) + uv.signal_start(signal, "sigint", function () + uv.unref(signal) + end) + uv.run() + os.exit(7) +end) + +return require('lib/tap')(function (test) + + if _G.isWindows then return end + + test("Catch SIGINT", function (print, p, expect, uv) + local child, pid + local input = uv.new_pipe(false) + child, pid = assert(uv.spawn(uv.exepath(), { + args = {"-"}, + -- cwd = uv.cwd(), + stdio = {input,1,2} + }, expect(function (code, signal) + p("exit", {pid=pid,code=code,signal=signal}) + assert(code == 7) + assert(signal == 0) + uv.close(input) + uv.close(child) + end))) + uv.write(input, child_code) + uv.shutdown(input) + local timer = uv.new_timer() + uv.timer_start(timer, 200, 0, expect(function () + print("Sending child SIGINT") + uv.process_kill(child, "sigint") + uv.close(timer) + end)) + end) + +end) diff --git a/3rdparty/luv/tests/test-tcp.lua b/3rdparty/luv/tests/test-tcp.lua new file mode 100644 index 00000000000..885d381ebce --- /dev/null +++ b/3rdparty/luv/tests/test-tcp.lua @@ -0,0 +1,114 @@ +return require('lib/tap')(function (test) + test("basic tcp server and client", function (print, p, expect, uv) + local server = uv.new_tcp() + uv.tcp_bind(server, "::", 0) + uv.listen(server, 128, expect(function (err) + p("server on connection", server) + assert(not err, err) + uv.close(server) + end)) + + local address = uv.tcp_getsockname(server) + p{server=server,address=address} + + local client = uv.new_tcp() + local req = uv.tcp_connect(client, "::1", address.port, expect(function (err) + p("client on connect", client, err) + assert(not err, err) + uv.shutdown(client, expect(function (err) + p("client on shutdown", client, err) + assert(not err, err) + uv.close(client, expect(function () + p("client on close", client) + end)) + end)) + end)) + p{client=client,req=req} + end) + + test("tcp echo server and client", function (print, p, expect, uv) + local server = uv.new_tcp() + assert(uv.tcp_bind(server, "127.0.0.1", 0)) + assert(uv.listen(server, 1, expect(function () + local client = uv.new_tcp() + assert(uv.accept(server, client)) + assert(uv.read_start(client, expect(function (err, data) + p("server read", {err=err,data=data}) + assert(not err, err) + if data then + assert(uv.write(client, data)) + else + assert(uv.read_stop(client)) + uv.close(client) + uv.close(server) + end + end, 2))) + end))) + + local address = uv.tcp_getsockname(server) + p{server=server,address=address} + + local socket = assert(uv.new_tcp()) + assert(uv.tcp_connect(socket, "127.0.0.1", address.port, expect(function () + assert(uv.read_start(socket, expect(function (err, data) + p("client read", {err=err,data=data}) + assert(not err, err) + assert(uv.read_stop(socket)) + uv.close(socket) + end))) + local req = assert(uv.write(socket, "Hello", function (err) + p("client onwrite", socket, err) + assert(not err, err) + end)) + p{socket=socket,req=req} + end))) + end) + + test("tcp echo server and client with methods", function (print, p, expect, uv) + local server = uv.new_tcp() + assert(server:bind("127.0.0.1", 0)) + assert(server:listen(1, expect(function () + local client = uv.new_tcp() + assert(server:accept(client)) + assert(client:read_start(expect(function (err, data) + p("server read", {err=err,data=data}) + assert(not err, err) + if data then + assert(client:write(data)) + else + assert(client:read_stop()) + client:close() + server:close() + end + end, 2))) + end))) + + local address = server:getsockname() + p{server=server,address=address} + + local socket = assert(uv.new_tcp()) + assert(socket:connect("127.0.0.1", address.port, expect(function () + assert(socket:read_start(expect(function (err, data) + p("client read", {err=err,data=data}) + assert(not err, err) + assert(socket:read_stop()) + socket:close() + end))) + local req = assert(socket:write("Hello", function (err) + p("client onwrite", socket, err) + assert(not err, err) + end)) + p{socket=socket,req=req} + end))) + end) + + test("tcp invalid ip address", function (print, p, expect, uv) + local ip = '127.0.0.100005' + local server = uv.new_tcp() + local status, err = pcall(function() uv.tcp_bind(server, ip, 1000) end) + assert(not status) + p(err) + assert(err:find(ip)) + uv.close(server) + end) +end) diff --git a/3rdparty/luv/tests/test-thread.lua b/3rdparty/luv/tests/test-thread.lua new file mode 100644 index 00000000000..838b51e4fff --- /dev/null +++ b/3rdparty/luv/tests/test-thread.lua @@ -0,0 +1,47 @@ +return require('lib/tap')(function (test) + + test("test thread create", function(print, p, expect, uv) + local delay = 1000 + local before = os.time() + local thread = uv.new_thread(function(delay) + require('luv').sleep(delay) + end,delay) + uv.thread_join(thread) + local elapsed = (os.time() - before) * 1000 + p({ + delay = delay, + elapsed = elapsed + }) + assert(elapsed >= delay, "elapsed should be at least delay ") + end) + + test("test thread create with arguments", function(print, p, expect, uv) + local before = os.time() + local args = {500, 'string', nil, false, 5, "helloworld"} + local unpack = unpack or table.unpack + uv.new_thread(function(num,s,null,bool,five,hw) + assert(type(num) == "number") + assert(type(s) == "string") + assert(null == nil) + assert(bool == false) + assert(five == 5) + assert(hw == 'helloworld') + require('luv').sleep(1000) + end, unpack(args)):join() + local elapsed = (os.time() - before) * 1000 + assert(elapsed >= 1000, "elapsed should be at least delay ") + end) + + test("test thread sleep msecs in main thread", function(print, p, expect, uv) + local delay = 1000 + local before = os.time() + uv.sleep(delay) + local elapsed = (os.time() - before) * 1000 + p({ + delay = delay, + elapsed = elapsed + }) + assert(elapsed >= delay, "elapsed should be at least delay ") + end) + +end) diff --git a/3rdparty/luv/tests/test-timer.lua b/3rdparty/luv/tests/test-timer.lua new file mode 100644 index 00000000000..f9eb9d89c5f --- /dev/null +++ b/3rdparty/luv/tests/test-timer.lua @@ -0,0 +1,87 @@ +return require('lib/tap')(function (test) + + -- This tests using timers for a simple timeout. + -- It also tests the handle close callback and + test("simple timeout", function (print, p, expect, uv) + local timer = uv.new_timer() + local function onclose() + p("closed", timer) + end + local function ontimeout() + p("timeout", timer) + uv.close(timer, expect(onclose)) + end + uv.timer_start(timer, 10, 0, expect(ontimeout)) + end) + + -- This is like the previous test, but using repeat. + test("simple interval", function (print, p, expect, uv) + local timer = uv.new_timer() + local count = 3 + local onclose = expect(function () + p("closed", timer) + end) + local function oninterval() + p("interval", timer) + count = count - 1 + if count == 0 then + uv.close(timer, onclose) + end + end + uv.timer_start(timer, 10, 10, oninterval) + end) + + -- Test two concurrent timers + -- There is a small race condition, but there are 100ms of wiggle room. + -- 400ms is halfway between 100+200ms and 100+400ms + test("timeout with interval", function (print, p, expect, uv) + local a = uv.new_timer() + local b = uv.new_timer() + uv.timer_start(a, 400, 0, expect(function () + p("timeout", a) + uv.timer_stop(b) + uv.close(a) + uv.close(b) + end)) + uv.timer_start(b, 100, 200, expect(function () + p("interval", b) + end, 2)) + end) + + -- This advanced test uses the rest of the uv_timer_t functions + -- to create an interval that shrinks over time. + test("shrinking interval", function (print, p, expect, uv) + local timer = uv.new_timer() + uv.timer_start(timer, 10, 0, expect(function () + local r = uv.timer_get_repeat(timer) + p("interval", timer, r) + if r == 0 then + uv.timer_set_repeat(timer, 8) + uv.timer_again(timer) + elseif r == 2 then + uv.timer_stop(timer) + uv.close(timer) + else + uv.timer_set_repeat(timer, r / 2) + end + end, 4)) + end) + + test("shrinking interval using methods", function (print, p, expect, uv) + local timer = uv.new_timer() + timer:start(10, 0, expect(function () + local r = timer:get_repeat() + p("interval", timer, r) + if r == 0 then + timer:set_repeat(8) + timer:again() + elseif r == 2 then + timer:stop() + timer:close() + else + timer:set_repeat(r / 2) + end + end, 4)) + end) + +end) diff --git a/3rdparty/luv/tests/test-work.lua b/3rdparty/luv/tests/test-work.lua new file mode 100644 index 00000000000..3a98b15e6bc --- /dev/null +++ b/3rdparty/luv/tests/test-work.lua @@ -0,0 +1,48 @@ +return require('lib/tap')(function (test) + test("test threadpool", function(print,p,expect,_uv) + p('Please be patient, the test cost a lots of time') + local count = 1000 --for memleaks dected + local step = 0 + local ctx + ctx = _uv.new_work( + function(n,s) --work,in threadpool + local uv = require('luv') + local t = uv.thread_self() + uv.sleep(100) + return n,n*n, tostring(uv.thread_self()),s + end, + function(n,r,id, s) + assert(n*n==r) + if step < count then + _uv.queue_work(ctx,n,s) + step = step + 1 + if (step % 100==0) then + p(string.format('run %d%%', math.floor(step*100/count))) + end + end + end --after work, in loop thread + ) + local ls = string.rep('-',4096) + + _uv.queue_work(ctx,2,ls) + _uv.queue_work(ctx,4,ls) + _uv.queue_work(ctx,6,ls) + _uv.queue_work(ctx,-2,ls) + _uv.queue_work(ctx,-11,ls) + _uv.queue_work(ctx,2,ls) + _uv.queue_work(ctx,4,ls) + _uv.queue_work(ctx,6,ls) + _uv.queue_work(ctx,-2,ls) + _uv.queue_work(ctx,-11,ls) + _uv.queue_work(ctx,2,ls) + _uv.queue_work(ctx,4,ls) + _uv.queue_work(ctx,6,ls) + _uv.queue_work(ctx,-2,ls) + _uv.queue_work(ctx,-11,ls) + _uv.queue_work(ctx,2,ls) + _uv.queue_work(ctx,4,ls) + _uv.queue_work(ctx,6,ls) + _uv.queue_work(ctx,-2,ls) + _uv.queue_work(ctx,-11,ls) + end) +end) diff --git a/scripts/genie.lua b/scripts/genie.lua index 34705beefa5..a51c3cbaa5d 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -671,9 +671,10 @@ end --DEFS += -DUSE_SYSTEM_JPEGLIB --endif - --To support casting in Lua 5.3 defines { - "LUA_COMPAT_APIINTCASTS", + "LUA_COMPAT_ALL", + "LUA_COMPAT_5_1", + "LUA_COMPAT_5_2", } if _ACTION == "gmake" then diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 16b86dcbe21..ef46f1cab24 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -398,6 +398,8 @@ end configuration { } defines { "LUA_COMPAT_ALL", + "LUA_COMPAT_5_1", + "LUA_COMPAT_5_2", } if not (_OPTIONS["targetos"]=="windows") and not (_OPTIONS["targetos"]=="asmjs") then defines { @@ -458,20 +460,19 @@ links { end -------------------------------------------------- --- sqlite3 lua library objects +-- small lua library objects -------------------------------------------------- -project "lsqlite3" +project "lualibs" uuid "1d84edab-94cf-48fb-83ee-b75bc697660e" kind "StaticLib" - -- options { - -- "ForceCPP", - -- } - configuration { "vs*" } buildoptions { "/wd4244", -- warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data + "/wd4055", -- warning C4055: 'type cast': from data pointer 'void *' to function pointer 'xxx' + "/wd4152", -- warning C4152: nonstandard extension, function/data pointer conversion in expression + "/wd4130", -- warning C4130: '==': logical operation on address of string constant } configuration { } @@ -487,9 +488,69 @@ project "lsqlite3" MAME_DIR .. "3rdparty/lua/src", } end + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end files { MAME_DIR .. "3rdparty/lsqlite3/lsqlite3.c", + MAME_DIR .. "3rdparty/lua-zlib/lua_zlib.c", + MAME_DIR .. "3rdparty/luafilesystem/src/lfs.c", + } + +-------------------------------------------------- +-- luv lua library objects +-------------------------------------------------- + +project "luv" + uuid "d98ec5ca-da2a-4a50-88a2-52061ca53871" + kind "StaticLib" + + if _OPTIONS["targetos"]=="windows" then + defines { + "_WIN32_WINNT=0x0600", + } + end + configuration { "vs*" } + buildoptions { + "/wd4244", -- warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data + } + + configuration { "gmake" } + buildoptions_c { + "-Wno-unused-function", + "-Wno-strict-prototypes", + "-Wno-unused-variable", + "-Wno-maybe-uninitialized", + "-Wno-undef", + } + + configuration { "vs2015" } + buildoptions { + "/wd4701", -- warning C4701: potentially uninitialized local variable 'xxx' used + "/wd4703", -- warning C4703: potentially uninitialized local pointer variable 'xxx' used + } + + configuration { } + defines { + "LUA_COMPAT_ALL", + } + + includedirs { + MAME_DIR .. "3rdparty/lua/src", + MAME_DIR .. "3rdparty/libuv/include", + } + if _OPTIONS["with-bundled-lua"] then + includedirs { + MAME_DIR .. "3rdparty/luv/deps/lua/src", + } + end + + files { + MAME_DIR .. "3rdparty/luv/src/luv.c", + MAME_DIR .. "3rdparty/luv/src/luv.h", } -------------------------------------------------- diff --git a/scripts/src/main.lua b/scripts/src/main.lua index 2397a489e00..9d0d9a9d9e1 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -128,7 +128,8 @@ end "jpeg", "7z", "lua", - "lsqlite3", + "lualibs", + "luv", "uv", "http-parser", } diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index c4136cd744a..dbf3d383093 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -18,6 +18,7 @@ #include "ui/ui.h" #include "luaengine.h" #include +#include "libuv/include/uv.h" //************************************************************************** // LUA ENGINE @@ -46,6 +47,10 @@ lua_engine* lua_engine::luaThis = nullptr; extern "C" { int luaopen_lsqlite3(lua_State *L); + int luaopen_zlib(lua_State *L); + int luaopen_luv(lua_State *L); + int luaopen_lfs(lua_State *L); + uv_loop_t* luv_loop(lua_State* L); } static void lstop(lua_State *L, lua_Debug *ar) @@ -886,8 +891,24 @@ lua_engine::lua_engine() lua_gc(m_lua_state, LUA_GCSTOP, 0); /* stop collector during initialization */ luaL_openlibs(m_lua_state); /* open libraries */ - luaopen_lsqlite3(m_lua_state); + // Get package.preload so we can store builtins in it. + lua_getglobal(m_lua_state, "package"); + lua_getfield(m_lua_state, -1, "preload"); + lua_remove(m_lua_state, -2); // Remove package + // Store uv module definition at preload.uv + lua_pushcfunction(m_lua_state, luaopen_luv); + lua_setfield(m_lua_state, -2, "luv"); + + lua_pushcfunction(m_lua_state, luaopen_zlib); + lua_setfield(m_lua_state, -2, "zlib"); + + lua_pushcfunction(m_lua_state, luaopen_lsqlite3); + lua_setfield(m_lua_state, -2, "lsqlite3"); + + lua_pushcfunction(m_lua_state, luaopen_lfs); + lua_setfield(m_lua_state, -2, "lfs"); + luaopen_ioport(m_lua_state); lua_gc(m_lua_state, LUA_GCRESTART, 0); @@ -1050,33 +1071,37 @@ void lua_engine::periodic_check() { std::lock_guard lock(g_mutex); if (msg.ready == 1) { - lua_settop(m_lua_state, 0); - int status = luaL_loadbuffer(m_lua_state, msg.text.c_str(), msg.text.length(), "=stdin"); - if (incomplete(status)==0) /* cannot try to add lines? */ - { - if (status == LUA_OK) status = docall(0, LUA_MULTRET); - report(status); - if (status == LUA_OK && lua_gettop(m_lua_state) > 0) /* any result to print? */ + lua_settop(m_lua_state, 0); + int status = luaL_loadbuffer(m_lua_state, msg.text.c_str(), msg.text.length(), "=stdin"); + if (incomplete(status)==0) /* cannot try to add lines? */ { - luaL_checkstack(m_lua_state, LUA_MINSTACK, "too many results to print"); - lua_getglobal(m_lua_state, "print"); - lua_insert(m_lua_state, 1); - if (lua_pcall(m_lua_state, lua_gettop(m_lua_state) - 1, 0, 0) != LUA_OK) - lua_writestringerror("%s\n", lua_pushfstring(m_lua_state, - "error calling " LUA_QL("print") " (%s)", - lua_tostring(m_lua_state, -1))); + if (status == LUA_OK) status = docall(0, LUA_MULTRET); + report(status); + if (status == LUA_OK && lua_gettop(m_lua_state) > 0) /* any result to print? */ + { + luaL_checkstack(m_lua_state, LUA_MINSTACK, "too many results to print"); + lua_getglobal(m_lua_state, "print"); + lua_insert(m_lua_state, 1); + if (lua_pcall(m_lua_state, lua_gettop(m_lua_state) - 1, 0, 0) != LUA_OK) + lua_writestringerror("%s\n", lua_pushfstring(m_lua_state, + "error calling " LUA_QL("print") " (%s)", + lua_tostring(m_lua_state, -1))); + } } + else + { + status = -1; + } + msg.status = status; + msg.response = msg.text; + msg.text = ""; + msg.ready = 0; + msg.done = 1; } - else - { - status = -1; - } - msg.status = status; - msg.response = msg.text; - msg.text = ""; - msg.ready = 0; - msg.done = 1; - } + auto loop = luv_loop(m_lua_state); + if (loop!=nullptr) + uv_run(loop, UV_RUN_NOWAIT); + } //------------------------------------------------- -- cgit v1.2.3-70-g09d2 From ccae0382bb750c1deded19e05b34933a8303465e Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 14 Feb 2016 10:58:18 +0100 Subject: Added plugins and boot.lua as startup script [Miodrag Milanovic] --- .gitignore | 1 + plugins/boot.lua | 26 ++ plugins/coro-channel/LICENSE | 22 ++ plugins/coro-channel/README.md | 2 + plugins/coro-channel/init.lua | 128 +++++++ plugins/coro-fs/LICENSE | 22 ++ plugins/coro-fs/README.md | 2 + plugins/coro-fs/init.lua | 222 ++++++++++++ plugins/coro-http/LICENSE | 22 ++ plugins/coro-http/README.md | 2 + plugins/coro-http/init.lua | 187 ++++++++++ plugins/coro-net/LICENSE | 22 ++ plugins/coro-net/README.md | 2 + plugins/coro-net/init.lua | 113 ++++++ plugins/coro-tls/LICENSE | 22 ++ plugins/coro-tls/README.md | 2 + plugins/coro-tls/init.lua | 122 +++++++ plugins/coro-wrapper/LICENSE | 22 ++ plugins/coro-wrapper/README.md | 2 + plugins/coro-wrapper/init.lua | 41 +++ plugins/http-codec/LICENSE | 202 +++++++++++ plugins/http-codec/README.md | 2 + plugins/http-codec/init.lua | 291 +++++++++++++++ plugins/json/LICENSE | 22 ++ plugins/json/README.md | 2 + plugins/json/init.lua | 732 ++++++++++++++++++++++++++++++++++++++ plugins/mime/LICENSE | 22 ++ plugins/mime/README.md | 2 + plugins/mime/init.lua | 194 ++++++++++ plugins/path/LICENSE | 202 +++++++++++ plugins/path/README.md | 2 + plugins/path/init.lua | 139 ++++++++ plugins/pretty-print/LICENSE | 202 +++++++++++ plugins/pretty-print/README.md | 2 + plugins/pretty-print/init.lua | 362 +++++++++++++++++++ plugins/querystring/LICENSE | 202 +++++++++++ plugins/querystring/README.md | 2 + plugins/querystring/init.lua | 105 ++++++ plugins/weblit/LICENSE | 22 ++ plugins/weblit/README.md | 239 +++++++++++++ plugins/weblit/app.lua | 261 ++++++++++++++ plugins/weblit/auto-headers.lua | 92 +++++ plugins/weblit/etag-cache.lua | 39 ++ plugins/weblit/init.lua | 8 + plugins/weblit/logger.lua | 10 + plugins/weblit/static.lua | 62 ++++ plugins/weblit/websocket.lua | 82 +++++ plugins/websocket-codec/LICENSE | 22 ++ plugins/websocket-codec/README.md | 2 + plugins/websocket-codec/init.lua | 261 ++++++++++++++ src/emu/debug/debugcpu.cpp | 3 + src/emu/emuopts.cpp | 1 + src/emu/emuopts.h | 2 + src/emu/machine.cpp | 4 +- src/emu/mame.cpp | 9 + 55 files changed, 4789 insertions(+), 1 deletion(-) create mode 100644 plugins/boot.lua create mode 100644 plugins/coro-channel/LICENSE create mode 100644 plugins/coro-channel/README.md create mode 100644 plugins/coro-channel/init.lua create mode 100644 plugins/coro-fs/LICENSE create mode 100644 plugins/coro-fs/README.md create mode 100644 plugins/coro-fs/init.lua create mode 100644 plugins/coro-http/LICENSE create mode 100644 plugins/coro-http/README.md create mode 100644 plugins/coro-http/init.lua create mode 100644 plugins/coro-net/LICENSE create mode 100644 plugins/coro-net/README.md create mode 100644 plugins/coro-net/init.lua create mode 100644 plugins/coro-tls/LICENSE create mode 100644 plugins/coro-tls/README.md create mode 100644 plugins/coro-tls/init.lua create mode 100644 plugins/coro-wrapper/LICENSE create mode 100644 plugins/coro-wrapper/README.md create mode 100644 plugins/coro-wrapper/init.lua create mode 100644 plugins/http-codec/LICENSE create mode 100644 plugins/http-codec/README.md create mode 100644 plugins/http-codec/init.lua create mode 100644 plugins/json/LICENSE create mode 100644 plugins/json/README.md create mode 100644 plugins/json/init.lua create mode 100644 plugins/mime/LICENSE create mode 100644 plugins/mime/README.md create mode 100644 plugins/mime/init.lua create mode 100644 plugins/path/LICENSE create mode 100644 plugins/path/README.md create mode 100644 plugins/path/init.lua create mode 100644 plugins/pretty-print/LICENSE create mode 100644 plugins/pretty-print/README.md create mode 100644 plugins/pretty-print/init.lua create mode 100644 plugins/querystring/LICENSE create mode 100644 plugins/querystring/README.md create mode 100644 plugins/querystring/init.lua create mode 100644 plugins/weblit/LICENSE create mode 100644 plugins/weblit/README.md create mode 100644 plugins/weblit/app.lua create mode 100644 plugins/weblit/auto-headers.lua create mode 100644 plugins/weblit/etag-cache.lua create mode 100644 plugins/weblit/init.lua create mode 100644 plugins/weblit/logger.lua create mode 100644 plugins/weblit/static.lua create mode 100644 plugins/weblit/websocket.lua create mode 100644 plugins/websocket-codec/LICENSE create mode 100644 plugins/websocket-codec/README.md create mode 100644 plugins/websocket-codec/init.lua diff --git a/.gitignore b/.gitignore index a3357981d32..148b004be92 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ !/hlsl/ !/keymaps/ !/nl_examples/ +!/plugins/ !/regtests/ !/samples/ !/scripts/ diff --git a/plugins/boot.lua b/plugins/boot.lua new file mode 100644 index 00000000000..e6cdde58004 --- /dev/null +++ b/plugins/boot.lua @@ -0,0 +1,26 @@ +local uv = require('luv') +local cwd = uv.cwd() +package.path = cwd .. "/plugins/?.lua;" .. cwd .. "/plugins/?/init.lua" + +require('weblit/app') + + .bind({ + host = "0.0.0.0", + port = 8080 + }) + + .use(require('weblit/logger')) + .use(require('weblit/auto-headers')) + .use(require('weblit/etag-cache')) + + .route({ + method = "GET", + path = "/", + }, function (req, res, go) + res.code = 200 + res.headers["Content-Type"] = "text/html" + res.body = "

Hello!

\n" + end) + + .start() + diff --git a/plugins/coro-channel/LICENSE b/plugins/coro-channel/LICENSE new file mode 100644 index 00000000000..5789b767285 --- /dev/null +++ b/plugins/coro-channel/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/plugins/coro-channel/README.md b/plugins/coro-channel/README.md new file mode 100644 index 00000000000..3f5bb397c69 --- /dev/null +++ b/plugins/coro-channel/README.md @@ -0,0 +1,2 @@ +# luv-coro-channel +A luv port of creationix/coro-channel from lit.luvit.io diff --git a/plugins/coro-channel/init.lua b/plugins/coro-channel/init.lua new file mode 100644 index 00000000000..0b715a0d470 --- /dev/null +++ b/plugins/coro-channel/init.lua @@ -0,0 +1,128 @@ +local exports = {} +exports.name = "creationix/coro-channel" +exports.version = "1.2.0" +exports.homepage = "https://github.com/luvit/lit/blob/master/deps/coro-channel.lua" +exports.description = "An adapter for wrapping uv streams as coro-streams and chaining filters." +exports.tags = {"coro", "adapter"} +exports.license = "MIT" +exports.author = { name = "Tim Caswell" } + +local function wrapRead(socket) + local paused = true + local queue = {} + local waiting + local onRead + + function onRead(err, chunk) + local data = err and {nil, err} or {chunk} + if waiting then + local thread = waiting + waiting = nil + assert(coroutine.resume(thread, unpack(data))) + else + queue[#queue + 1] = data + if not paused then + paused = true + assert(socket:read_stop()) + end + end + end + + return function () + if #queue > 0 then + return unpack(table.remove(queue, 1)) + end + if paused then + paused = false + assert(socket:read_start(onRead)) + end + waiting = coroutine.running() + return coroutine.yield() + end + +end + +local function wrapWrite(socket) + + local function wait() + local thread = coroutine.running() + return function (err) + assert(coroutine.resume(thread, err)) + end + end + + local function shutdown() + socket:shutdown(wait()) + coroutine.yield() + if not socket:is_closing() then + socket:close() + end + end + + return function (chunk) + if chunk == nil then + return shutdown() + end + assert(socket:write(chunk, wait())) + local err = coroutine.yield() + return not err, err + end + +end + +exports.wrapRead = wrapRead +exports.wrapWrite = wrapWrite + +-- Given a raw uv_stream_t userdata, return coro-friendly read/write functions. +function exports.wrapStream(socket) + return wrapRead(socket), wrapWrite(socket) +end + + +function exports.chain(...) + local args = {...} + local nargs = select("#", ...) + return function (read, write) + local threads = {} -- coroutine thread for each item + local waiting = {} -- flag when waiting to pull from upstream + local boxes = {} -- storage when waiting to write to downstream + for i = 1, nargs do + threads[i] = coroutine.create(args[i]) + waiting[i] = false + local r, w + if i == 1 then + r = read + else + function r() + local j = i - 1 + if boxes[j] then + local data = boxes[j] + boxes[j] = nil + assert(coroutine.resume(threads[j])) + return unpack(data) + else + waiting[i] = true + return coroutine.yield() + end + end + end + if i == nargs then + w = write + else + function w(...) + local j = i + 1 + if waiting[j] then + waiting[j] = false + assert(coroutine.resume(threads[j], ...)) + else + boxes[i] = {...} + coroutine.yield() + end + end + end + assert(coroutine.resume(threads[i], r, w)) + end + end +end + +return exports diff --git a/plugins/coro-fs/LICENSE b/plugins/coro-fs/LICENSE new file mode 100644 index 00000000000..5789b767285 --- /dev/null +++ b/plugins/coro-fs/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/plugins/coro-fs/README.md b/plugins/coro-fs/README.md new file mode 100644 index 00000000000..79ef57330a0 --- /dev/null +++ b/plugins/coro-fs/README.md @@ -0,0 +1,2 @@ +# luv-coro-fs +A luv port of lit's coro-fs module diff --git a/plugins/coro-fs/init.lua b/plugins/coro-fs/init.lua new file mode 100644 index 00000000000..f4be5bff832 --- /dev/null +++ b/plugins/coro-fs/init.lua @@ -0,0 +1,222 @@ +local exports = {} +exports.name = "creationix/coro-fs" +exports.version = "1.3.0" +exports.homepage = "https://github.com/luvit/lit/blob/master/deps/coro-fs.lua" +exports.description = "A coro style interface to the filesystem." +exports.tags = {"coro", "fs"} +exports.license = "MIT" +exports.author = { name = "Tim Caswell" } + +local uv = require('luv') +local fs = exports +local pathJoin = require('path').join + +local function noop() end + +local function makeCallback() + local thread = coroutine.running() + return function (err, value, ...) + if err then + assert(coroutine.resume(thread, nil, err)) + else + assert(coroutine.resume(thread, value == nil and true or value, ...)) + end + end +end + +function fs.mkdir(path, mode) + uv.fs_mkdir(path, mode or 511, makeCallback()) + return coroutine.yield() +end +function fs.open(path, flags, mode) + uv.fs_open(path, flags or "r", mode or 438, makeCallback()) + return coroutine.yield() +end +function fs.unlink(path) + uv.fs_unlink(path, makeCallback()) + return coroutine.yield() +end +function fs.stat(path) + uv.fs_stat(path, makeCallback()) + return coroutine.yield() +end +function fs.lstat(path) + uv.fs_lstat(path, makeCallback()) + return coroutine.yield() +end +function fs.symlink(target, path) + uv.fs_symlink(target, path, makeCallback()) + return coroutine.yield() +end +function fs.readlink(path) + uv.fs_readlink(path, makeCallback()) + return coroutine.yield() +end +function fs.fstat(fd) + uv.fs_fstat(fd, makeCallback()) + return coroutine.yield() +end +function fs.chmod(fd, path) + uv.fs_chmod(fd, path, makeCallback()) + return coroutine.yield() +end +function fs.fchmod(fd, mode) + uv.fs_fchmod(fd, mode, makeCallback()) + return coroutine.yield() +end +function fs.read(fd, length, offset) + uv.fs_read(fd, length or 1024*48, offset or -1, makeCallback()) + return coroutine.yield() +end +function fs.write(fd, data, offset) + uv.fs_write(fd, data, offset or -1, makeCallback()) + return coroutine.yield() +end +function fs.close(fd) + uv.fs_close(fd, makeCallback()) + return coroutine.yield() +end +function fs.access(path, flags) + uv.fs_access(path, flags or "", makeCallback()) + return coroutine.yield() +end +function fs.rename(path, newPath) + uv.fs_rename(path, newPath, makeCallback()) + return coroutine.yield() +end +function fs.rmdir(path) + uv.fs_rmdir(path, makeCallback()) + return coroutine.yield() +end +function fs.rmrf(path) + local success, err + success, err = fs.rmdir(path) + if success then return success end + if err:match("^ENOTDIR:") then return fs.unlink(path) end + if not err:match("^ENOTEMPTY:") then return success, err end + for entry in assert(fs.scandir(path)) do + local subPath = pathJoin(path, entry.name) + if entry.type == "directory" then + success, err = fs.rmrf(pathJoin(path, entry.name)) + else + success, err = fs.unlink(subPath) + end + if not success then return success, err end + end + return fs.rmdir(path) +end +function fs.scandir(path) + uv.fs_scandir(path, makeCallback()) + local req, err = coroutine.yield() + if not req then return nil, err end + return function () + return uv.fs_scandir_next(req) + end +end + +function fs.readFile(path) + local fd, stat, data, err + fd, err = fs.open(path) + if err then return nil, err end + stat, err = fs.fstat(fd) + if stat then + data, err = fs.read(fd, stat.size) + end + uv.fs_close(fd, noop) + return data, err +end + +function fs.writeFile(path, data, mkdir) + local fd, success, err + fd, err = fs.open(path, "w") + if err then + if mkdir and string.match(err, "^ENOENT:") then + success, err = fs.mkdirp(pathJoin(path, "..")) + if success then return fs.writeFile(path, data) end + end + return nil, err + end + success, err = fs.write(fd, data) + uv.fs_close(fd, noop) + return success, err +end + +function fs.mkdirp(path, mode) + local success, err = fs.mkdir(path, mode) + if success or string.match(err, "^EEXIST") then + return true + end + if string.match(err, "^ENOENT:") then + success, err = fs.mkdirp(pathJoin(path, ".."), mode) + if not success then return nil, err end + return fs.mkdir(path, mode) + end + return nil, err +end + +function fs.chroot(base) + local chroot = { + base = base, + fstat = fs.fstat, + fchmod = fs.fchmod, + read = fs.read, + write = fs.write, + close = fs.close, + } + local function resolve(path) + assert(path, "path missing") + return pathJoin(base, pathJoin(path)) + end + function chroot.mkdir(path, mode) + return fs.mkdir(resolve(path), mode) + end + function chroot.mkdirp(path, mode) + return fs.mkdirp(resolve(path), mode) + end + function chroot.open(path, flags, mode) + return fs.open(resolve(path), flags, mode) + end + function chroot.unlink(path) + return fs.unlink(resolve(path)) + end + function chroot.stat(path) + return fs.stat(resolve(path)) + end + function chroot.lstat(path) + return fs.lstat(resolve(path)) + end + function chroot.symlink(target, path) + -- TODO: should we resolve absolute target paths or treat it as opaque data? + return fs.symlink(target, resolve(path)) + end + function chroot.readlink(path) + return fs.readlink(resolve(path)) + end + function chroot.chmod(path, mode) + return fs.chmod(resolve(path), mode) + end + function chroot.access(path, flags) + return fs.access(resolve(path), flags) + end + function chroot.rename(path, newPath) + return fs.rename(resolve(path), resolve(newPath)) + end + function chroot.rmdir(path) + return fs.rmdir(resolve(path)) + end + function chroot.rmrf(path) + return fs.rmrf(resolve(path)) + end + function chroot.scandir(path, iter) + return fs.scandir(resolve(path), iter) + end + function chroot.readFile(path) + return fs.readFile(resolve(path)) + end + function chroot.writeFile(path, data, mkdir) + return fs.writeFile(resolve(path), data, mkdir) + end + return chroot +end + +return exports diff --git a/plugins/coro-http/LICENSE b/plugins/coro-http/LICENSE new file mode 100644 index 00000000000..5789b767285 --- /dev/null +++ b/plugins/coro-http/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/plugins/coro-http/README.md b/plugins/coro-http/README.md new file mode 100644 index 00000000000..271b6698f5d --- /dev/null +++ b/plugins/coro-http/README.md @@ -0,0 +1,2 @@ +# luv-coro-http +A luv port of lit's coro-http library. diff --git a/plugins/coro-http/init.lua b/plugins/coro-http/init.lua new file mode 100644 index 00000000000..49613403eaf --- /dev/null +++ b/plugins/coro-http/init.lua @@ -0,0 +1,187 @@ +local exports = {} +exports.name = "creationix/coro-http" +exports.version = "1.2.1-1" +exports.dependencies = { + "creationix/coro-net@1.1.1", + "creationix/coro-tls@1.2.1", + "creationix/coro-wrapper@1.0.0", + "luvit/http-codec@1.0.0" +} +exports.homepage = "https://github.com/luvit/lit/blob/master/deps/coro-http.lua" +exports.description = "An coro style http(s) client and server helper." +exports.tags = {"coro", "http"} +exports.license = "MIT" +exports.author = { name = "Tim Caswell" } + +local httpCodec = require('http-codec') +local net = require('coro-net') +local connect = net.connect +local createServer = net.createServer +--local tlsWrap = require('coro-tls').wrap +local wrapper = require('coro-wrapper') + +function exports.createServer(options, onConnect) + createServer(options, function (rawRead, rawWrite, socket) + local read = wrapper.reader(rawRead, httpCodec.decoder()) + local write = wrapper.writer(rawWrite, httpCodec.encoder()) + for head in read do + local parts = {} + for part in read do + if #part > 0 then + parts[#parts + 1] = part + else + break + end + end + local body = table.concat(parts) + head, body = onConnect(head, body, socket) + write(head) + if body then write(body) end + write("") + if not head.keepAlive then break end + end + end) +end + +local function parseUrl(url) + local protocol, host, hostname, port, path = url:match("^(https?:)//(([^/:]+):?([0-9]*))(/?.*)$") + if not protocol then error("Not a valid http url: " .. url) end + local tls = protocol == "https:" + port = port and tonumber(port) or (tls and 443 or 80) + if path == "" then path = "/" end + return { + tls = tls, + host = host, + hostname = hostname, + port = port, + path = path + } +end +exports.parseUrl = parseUrl + +local connections = {} + +local function getConnection(host, port, tls) + for i = #connections, 1, -1 do + local connection = connections[i] + if connection.host == host and connection.port == port and connection.tls == tls then + table.remove(connections, i) + -- Make sure the connection is still alive before reusing it. + if not connection.socket:is_closing() then + connection.reused = true + connection.socket:ref() + return connection + end + end + end + local read, write, socket = assert(connect({host=host,port=port})) + --if tls then + --read, write = tlsWrap(read, write) + --end + local httpRead, updateRead = wrapper.reader(read, httpCodec.decoder()) + return { + socket = socket, + host = host, + port = port, + tls = tls, + read = httpRead, + write = wrapper.writer(write, httpCodec.encoder()), + reset = function () + -- This is called after parsing the response head from a HEAD request. + -- If you forget, the codec might hang waiting for a body that doesn't exist. + updateRead(httpCodec.decoder()) + end + } +end +exports.getConnection = getConnection + +local function saveConnection(connection) + if connection.socket:is_closing() then return end + connections[#connections + 1] = connection + connection.socket:unref() +end +exports.saveConnection = saveConnection + +function exports.request(method, url, headers, body) + local uri = parseUrl(url) + local connection = getConnection(uri.hostname, uri.port, uri.tls) + local read = connection.read + local write = connection.write + + local req = { + method = method, + path = uri.path, + {"Host", uri.host} + } + local contentLength + local chunked + if headers then + for i = 1, #headers do + local key, value = unpack(headers[i]) + key = key:lower() + if key == "content-length" then + contentLength = value + elseif key == "content-encoding" and value:lower() == "chunked" then + chunked = true + end + req[#req + 1] = headers[i] + end + end + + if type(body) == "string" then + if not chunked and not contentLength then + req[#req + 1] = {"Content-Length", #body} + end + end + + write(req) + if body then write(body) end + local res = read() + if not res then + write() + -- If we get an immediate close on a reused socket, try again with a new socket. + -- TODO: think about if this could resend requests with side effects and cause + -- them to double execute in the remote server. + if connection.reused then + return exports.request(method, url, headers, body) + end + error("Connection closed") + end + + body = {} + if req.method == "HEAD" then + connection.reset() + else + while true do + local item = read() + if not item then + res.keepAlive = false + break + end + if #item == 0 then + break + end + body[#body + 1] = item + end + end + + if res.keepAlive then + saveConnection(connection) + else + write() + end + + -- Follow redirects + if method == "GET" and (res.code == 302 or res.code == 307) then + for i = 1, #res do + local key, location = unpack(res[i]) + if key:lower() == "location" then + return exports.request(method, location, headers) + end + end + end + + return res, table.concat(body) +end + +return exports diff --git a/plugins/coro-net/LICENSE b/plugins/coro-net/LICENSE new file mode 100644 index 00000000000..5789b767285 --- /dev/null +++ b/plugins/coro-net/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/plugins/coro-net/README.md b/plugins/coro-net/README.md new file mode 100644 index 00000000000..c8a94b9980a --- /dev/null +++ b/plugins/coro-net/README.md @@ -0,0 +1,2 @@ +# luv-coro-net +A luv port of creationix/coro-net from lit.luvit.io diff --git a/plugins/coro-net/init.lua b/plugins/coro-net/init.lua new file mode 100644 index 00000000000..3ae6c2ad824 --- /dev/null +++ b/plugins/coro-net/init.lua @@ -0,0 +1,113 @@ +local exports = {} +exports.name = "creationix/coro-net" +exports.version = "1.1.1-1" +exports.dependencies = { + "creationix/coro-channel@1.2.0" +} +exports.homepage = "https://github.com/luvit/lit/blob/master/deps/coro-net.lua" +exports.description = "An coro style client and server helper for tcp and pipes." +exports.tags = {"coro", "tcp", "pipe", "net"} +exports.license = "MIT" +exports.author = { name = "Tim Caswell" } + +local uv = require('luv') +local wrapStream = require('coro-channel').wrapStream + +local function makeCallback(timeout) + local thread = coroutine.running() + local timer, done + if timeout then + timer = uv.new_timer() + timer:start(timeout, 0, function () + if done then return end + done = true + timer:close() + return assert(coroutine.resume(thread, nil, "timeout")) + end) + end + return function (err, data) + if done then return end + done = true + if timer then timer:close() end + if err then + return assert(coroutine.resume(thread, nil, err)) + end + return assert(coroutine.resume(thread, data or true)) + end +end +exports.makeCallback = makeCallback + +local function normalize(options) + local t = type(options) + if t == "string" then + options = {path=options} + elseif t == "number" then + options = {port=options} + elseif t ~= "table" then + assert("Net options must be table, string, or number") + end + if options.port or options.host then + return true, + options.host or "127.0.0.1", + assert(options.port, "options.port is required for tcp connections") + elseif options.path then + return false, options.path + else + error("Must set either options.path or options.port") + end +end + +function exports.connect(options) + local socket, success, err + local isTcp, host, port = normalize(options) + if isTcp then + assert(uv.getaddrinfo(host, port, { + socktype = options.socktype or "stream", + family = options.family or "inet", + }, makeCallback(options.timeout))) + local res + res, err = coroutine.yield() + if not res then return nil, err end + socket = uv.new_tcp() + socket:connect(res[1].addr, res[1].port, makeCallback(options.timeout)) + else + socket = uv.new_pipe(false) + socket:connect(host, makeCallback(options.timeout)) + end + success, err = coroutine.yield() + if not success then return nil, err end + local read, write = wrapStream(socket) + return read, write, socket +end + +function exports.createServer(options, onConnect) + local server + local isTcp, host, port = normalize(options) + if isTcp then + server = uv.new_tcp() + assert(server:bind(host, port)) + else + server = uv.new_pipe(false) + assert(server:bind(host)) + end + assert(server:listen(256, function (err) + assert(not err, err) + local socket = isTcp and uv.new_tcp() or uv.new_pipe(false) + server:accept(socket) + coroutine.wrap(function () + local success, failure = xpcall(function () + local read, write = wrapStream(socket) + return onConnect(read, write, socket) + end, debug.traceback) + if not success then + print(failure) + end + if not socket:is_closing() then + socket:close() + end + end)() + end)) + return server +end + +return exports diff --git a/plugins/coro-tls/LICENSE b/plugins/coro-tls/LICENSE new file mode 100644 index 00000000000..5789b767285 --- /dev/null +++ b/plugins/coro-tls/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/plugins/coro-tls/README.md b/plugins/coro-tls/README.md new file mode 100644 index 00000000000..50aae3f7657 --- /dev/null +++ b/plugins/coro-tls/README.md @@ -0,0 +1,2 @@ +# luv-coro-tls +A luv port of lit's coro-tls module diff --git a/plugins/coro-tls/init.lua b/plugins/coro-tls/init.lua new file mode 100644 index 00000000000..03d6e1c3f76 --- /dev/null +++ b/plugins/coro-tls/init.lua @@ -0,0 +1,122 @@ +local exports = {} +exports.name = "creationix/coro-tls" +exports.version = "1.2.1" +exports.homepage = "https://github.com/luvit/lit/blob/master/deps/coro-tls.lua" +exports.description = "A coro-stream wrapper implementing tls sessions." +exports.tags = {"coro", "tls", "ssl"} +exports.license = "MIT" +exports.author = { name = "Tim Caswell" } + +local openssl = require('openssl') +local bit = require('bit') + +local DEFAULT_CIPHERS = 'ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:' .. -- TLS 1.2 + 'RC4:HIGH:!MD5:!aNULL:!EDH' -- TLS 1.0 + +-- Given a read/write pair, return a new read/write pair for plaintext +exports.wrap = function (read, write, options) + if not options then + options = {} + end + + local ctx = openssl.ssl.ctx_new(options.protocol or 'TLSv1_2', options.ciphers or DEFAULT_CIPHERS) + + local key, cert, ca + if options.key then + key = assert(openssl.pkey.read(options.key, true, 'pem')) + end + if options.cert then + cert = assert(openssl.x509.read(options.cert)) + end + if options.ca then + if type(options.ca) == "string" then + ca = { assert(openssl.x509.read(options.ca)) } + elseif type(options.ca) == "table" then + ca = {} + for i = 1, #options.ca do + ca[i] = assert(openssl.x509.read(options.ca[i])) + end + else + error("options.ca must be string or table of strings") + end + end + if key and cert then + assert(ctx:use(key, cert)) + end + if ca then + local store = openssl.x509.store:new() + for i = 1, #ca do + assert(store:add(ca[i])) + end + ctx:cert_store(store) + else + ctx:verify_mode({"none"}) + end + + ctx:options(bit.bor( + openssl.ssl.no_sslv2, + openssl.ssl.no_sslv3, + openssl.ssl.no_compression)) + local bin, bout = openssl.bio.mem(8192), openssl.bio.mem(8192) + local ssl = ctx:ssl(bin, bout, options.server) + + local function flush() + while bout:pending() > 0 do + write(bout:read()) + end + end + + -- Do handshake + while true do + if ssl:handshake() then break end + flush() + local chunk = read() + if chunk then + bin:write(chunk) + else + error("disconnect while handshaking") + end + end + flush() + + local done = false + local function shutdown() + if done then return end + done = true + while true do + if ssl:shutdown() then break end + flush() + local chunk = read() + if chunk then + bin:write(chunk) + else + break + end + end + flush() + write() + end + + local function plainRead() + while true do + local chunk = ssl:read() + if chunk then return chunk end + local cipher = read() + if not cipher then return end + bin:write(cipher) + end + end + + local function plainWrite(plain) + if not plain then + return shutdown() + end + ssl:write(plain) + flush() + end + + return plainRead, plainWrite + +end + +return exports diff --git a/plugins/coro-wrapper/LICENSE b/plugins/coro-wrapper/LICENSE new file mode 100644 index 00000000000..5789b767285 --- /dev/null +++ b/plugins/coro-wrapper/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/plugins/coro-wrapper/README.md b/plugins/coro-wrapper/README.md new file mode 100644 index 00000000000..a9351a7f531 --- /dev/null +++ b/plugins/coro-wrapper/README.md @@ -0,0 +1,2 @@ +# luv-coro-wrapper +A luv port of lit's coro-wrapper module diff --git a/plugins/coro-wrapper/init.lua b/plugins/coro-wrapper/init.lua new file mode 100644 index 00000000000..aab2683baf3 --- /dev/null +++ b/plugins/coro-wrapper/init.lua @@ -0,0 +1,41 @@ +local exports = {} +exports.name = "creationix/coro-wrapper" +exports.version = "1.0.0-1" +exports.homepage = "https://github.com/luvit/lit/blob/master/deps/coro-wrapper.lua" +exports.description = "An adapter for applying decoders to coro-streams." +exports.tags = {"coro", "decoder", "adapter"} +exports.license = "MIT" +exports.author = { name = "Tim Caswell" } + +function exports.reader(read, decode) + local buffer = "" + return function () + while true do + local item, extra = decode(buffer) + if item then + buffer = extra + return item + end + local chunk = read() + if not chunk then return end + buffer = buffer .. chunk + end + end, + function (newDecode) + decode = newDecode + end +end + +function exports.writer(write, encode) + return function (item) + if not item then + return write() + end + return write(encode(item)) + end, + function (newEncode) + encode = newEncode + end +end + +return exports diff --git a/plugins/http-codec/LICENSE b/plugins/http-codec/LICENSE new file mode 100644 index 00000000000..8f71f43fee3 --- /dev/null +++ b/plugins/http-codec/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/plugins/http-codec/README.md b/plugins/http-codec/README.md new file mode 100644 index 00000000000..80d050416ae --- /dev/null +++ b/plugins/http-codec/README.md @@ -0,0 +1,2 @@ +# luv-http-codec +A luv port of luvit's http-codec diff --git a/plugins/http-codec/init.lua b/plugins/http-codec/init.lua new file mode 100644 index 00000000000..11a32945729 --- /dev/null +++ b/plugins/http-codec/init.lua @@ -0,0 +1,291 @@ +--[[ + +Copyright 2014-2015 The Luvit Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS-IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--]] + +local exports = {} + +exports.name = "luvit/http-codec" +exports.version = "1.0.0-1" +exports.homepage = "https://github.com/luvit/luvit/blob/master/deps/http-codec.lua" +exports.description = "A simple pair of functions for converting between hex and raw strings." +exports.tags = {"codec", "http"} +exports.license = "Apache 2" +exports.author = { name = "Tim Caswell" } + +local sub = string.sub +local gsub = string.gsub +local lower = string.lower +local find = string.find +local format = string.format +local concat = table.concat +local match = string.match + +local STATUS_CODES = { + [100] = 'Continue', + [101] = 'Switching Protocols', + [102] = 'Processing', -- RFC 2518, obsoleted by RFC 4918 + [200] = 'OK', + [201] = 'Created', + [202] = 'Accepted', + [203] = 'Non-Authoritative Information', + [204] = 'No Content', + [205] = 'Reset Content', + [206] = 'Partial Content', + [207] = 'Multi-Status', -- RFC 4918 + [300] = 'Multiple Choices', + [301] = 'Moved Permanently', + [302] = 'Moved Temporarily', + [303] = 'See Other', + [304] = 'Not Modified', + [305] = 'Use Proxy', + [307] = 'Temporary Redirect', + [400] = 'Bad Request', + [401] = 'Unauthorized', + [402] = 'Payment Required', + [403] = 'Forbidden', + [404] = 'Not Found', + [405] = 'Method Not Allowed', + [406] = 'Not Acceptable', + [407] = 'Proxy Authentication Required', + [408] = 'Request Time-out', + [409] = 'Conflict', + [410] = 'Gone', + [411] = 'Length Required', + [412] = 'Precondition Failed', + [413] = 'Request Entity Too Large', + [414] = 'Request-URI Too Large', + [415] = 'Unsupported Media Type', + [416] = 'Requested Range Not Satisfiable', + [417] = 'Expectation Failed', + [418] = "I'm a teapot", -- RFC 2324 + [422] = 'Unprocessable Entity', -- RFC 4918 + [423] = 'Locked', -- RFC 4918 + [424] = 'Failed Dependency', -- RFC 4918 + [425] = 'Unordered Collection', -- RFC 4918 + [426] = 'Upgrade Required', -- RFC 2817 + [500] = 'Internal Server Error', + [501] = 'Not Implemented', + [502] = 'Bad Gateway', + [503] = 'Service Unavailable', + [504] = 'Gateway Time-out', + [505] = 'HTTP Version not supported', + [506] = 'Variant Also Negotiates', -- RFC 2295 + [507] = 'Insufficient Storage', -- RFC 4918 + [509] = 'Bandwidth Limit Exceeded', + [510] = 'Not Extended' -- RFC 2774 +} + +exports.encoder = function () + + local mode + local encodeHead, encodeRaw, encodeChunked + + function encodeHead(item) + if not item or item == "" then + return item + elseif not (type(item) == "table") then + error("expected a table but got a " .. type(item) .. " when encoding data") + end + local head, chunkedEncoding + local version = item.version or 1.1 + if item.method then + local path = item.path + assert(path and #path > 0, "expected non-empty path") + head = { item.method .. ' ' .. item.path .. ' HTTP/' .. version .. '\r\n' } + else + local reason = item.reason or STATUS_CODES[item.code] + head = { 'HTTP/' .. version .. ' ' .. item.code .. ' ' .. reason .. '\r\n' } + end + for i = 1, #item do + local key, value = unpack(item[i]) + local lowerKey = lower(key) + if lowerKey == "transfer-encoding" then + chunkedEncoding = lower(value) == "chunked" + end + value = gsub(tostring(value), "[\r\n]+", " ") + head[#head + 1] = key .. ': ' .. tostring(value) .. '\r\n' + end + head[#head + 1] = '\r\n' + + mode = chunkedEncoding and encodeChunked or encodeRaw + return concat(head) + end + + function encodeRaw(item) + if type(item) ~= "string" then + mode = encodeHead + return encodeHead(item) + end + return item + end + + function encodeChunked(item) + if type(item) ~= "string" then + mode = encodeHead + local extra = encodeHead(item) + if extra then + return "0\r\n\r\n" .. extra + else + return "0\r\n\r\n" + end + end + if #item == 0 then + mode = encodeHead + end + return format("%x", #item) .. "\r\n" .. item .. "\r\n" + end + + mode = encodeHead + return function (item) + return mode(item) + end +end + +exports.decoder = function () + + -- This decoder is somewhat stateful with 5 different parsing states. + local decodeHead, decodeEmpty, decodeRaw, decodeChunked, decodeCounted + local mode -- state variable that points to various decoders + local bytesLeft -- For counted decoder + + -- This state is for decoding the status line and headers. + function decodeHead(chunk) + if not chunk then return end + + local _, length = find(chunk, "\r?\n\r?\n", 1) + -- First make sure we have all the head before continuing + if not length then + if #chunk < 8 * 1024 then return end + -- But protect against evil clients by refusing heads over 8K long. + error("entity too large") + end + + -- Parse the status/request line + local head = {} + local _, offset + local version + _, offset, version, head.code, head.reason = + find(chunk, "^HTTP/(%d%.%d) (%d+) ([^\r\n]+)\r?\n") + if offset then + head.code = tonumber(head.code) + else + _, offset, head.method, head.path, version = + find(chunk, "^(%u+) ([^ ]+) HTTP/(%d%.%d)\r?\n") + if not offset then + error("expected HTTP data") + end + end + version = tonumber(version) + head.version = version + head.keepAlive = version > 1.0 + + -- We need to inspect some headers to know how to parse the body. + local contentLength + local chunkedEncoding + + -- Parse the header lines + while true do + local key, value + _, offset, key, value = find(chunk, "^([^:\r\n]+): *([^\r\n]+)\r?\n", offset + 1) + if not offset then break end + local lowerKey = lower(key) + + -- Inspect a few headers and remember the values + if lowerKey == "content-length" then + contentLength = tonumber(value) + elseif lowerKey == "transfer-encoding" then + chunkedEncoding = lower(value) == "chunked" + elseif lowerKey == "connection" then + head.keepAlive = lower(value) == "keep-alive" + end + head[#head + 1] = {key, value} + end + + if head.keepAlive and (not (chunkedEncoding or (contentLength and contentLength > 0))) + or (head.method == "GET" or head.method == "HEAD") then + mode = decodeEmpty + elseif chunkedEncoding then + mode = decodeChunked + elseif contentLength then + bytesLeft = contentLength + mode = decodeCounted + elseif not head.keepAlive then + mode = decodeRaw + end + + return head, sub(chunk, length + 1) + + end + + -- This is used for inserting a single empty string into the output string for known empty bodies + function decodeEmpty(chunk) + mode = decodeHead + return "", chunk or "" + end + + function decodeRaw(chunk) + if not chunk then return "", "" end + if #chunk == 0 then return end + return chunk, "" + end + + function decodeChunked(chunk) + local len, term + len, term = match(chunk, "^(%x+)(..)") + if not len then return end + assert(term == "\r\n") + local length = tonumber(len, 16) + if #chunk < length + 4 + #len then return end + if length == 0 then + mode = decodeHead + end + chunk = sub(chunk, #len + 3) + assert(sub(chunk, length + 1, length + 2) == "\r\n") + return sub(chunk, 1, length), sub(chunk, length + 3) + end + + function decodeCounted(chunk) + if bytesLeft == 0 then + mode = decodeEmpty + return mode(chunk) + end + local length = #chunk + -- Make sure we have at least one byte to process + if length == 0 then return end + + if length >= bytesLeft then + mode = decodeEmpty + end + + -- If the entire chunk fits, pass it all through + if length <= bytesLeft then + bytesLeft = bytesLeft - length + return chunk, "" + end + + return sub(chunk, 1, bytesLeft), sub(chunk, bytesLeft + 1) + end + + -- Switch between states by changing which decoder mode points to + mode = decodeHead + return function (chunk) + return mode(chunk) + end + +end + +return exports diff --git a/plugins/json/LICENSE b/plugins/json/LICENSE new file mode 100644 index 00000000000..5789b767285 --- /dev/null +++ b/plugins/json/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/plugins/json/README.md b/plugins/json/README.md new file mode 100644 index 00000000000..71965e3d0f7 --- /dev/null +++ b/plugins/json/README.md @@ -0,0 +1,2 @@ +# luv-json +A luv port of luvit's json module diff --git a/plugins/json/init.lua b/plugins/json/init.lua new file mode 100644 index 00000000000..d49352cc6ff --- /dev/null +++ b/plugins/json/init.lua @@ -0,0 +1,732 @@ +local exports = {} +exports.name = "luvit/json" +exports.version = "2.5.0" +exports.homepage = "http://dkolf.de/src/dkjson-lua.fsl" +exports.description = "David Kolf's JSON library repackaged for lit." +exports.tags = {"json", "codec"} +exports.license = "MIT" +exports.author = { + name = "David Kolf", + homepage = "http://dkolf.de/", +} +exports.contributors = { + "Tim Caswell", +} + +-- Module options: +local always_try_using_lpeg = false +local register_global_module_table = false +local global_module_name = 'json' + +--[==[ + +David Kolf's JSON module for Lua 5.1/5.2 + +Version 2.5 + + +For the documentation see the corresponding readme.txt or visit +. + +You can contact the author by sending an e-mail to 'david' at the +domain 'dkolf.de'. + + +Copyright (C) 2010-2013 David Heiko Kolf + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--]==] + +-- global dependencies: +local pairs, type, tostring, tonumber, getmetatable, setmetatable = + pairs, type, tostring, tonumber, getmetatable, setmetatable +local error, require, pcall, select = error, require, pcall, select +local floor, huge = math.floor, math.huge +local strrep, gsub, strsub, strbyte, strchar, strfind, strlen, strformat = + string.rep, string.gsub, string.sub, string.byte, string.char, + string.find, string.len, string.format +local strmatch = string.match +local concat = table.concat + +local json = exports +json.original_version = "dkjson 2.5" + +if register_global_module_table then + _G[global_module_name] = json +end + +_ENV = nil -- blocking globals in Lua 5.2 + +pcall (function() + -- Enable access to blocked metatables. + -- Don't worry, this module doesn't change anything in them. + local debmeta = require "debug".getmetatable + if debmeta then getmetatable = debmeta end +end) + +json.null = setmetatable ({}, { + __tojson = function () return "null" end +}) + +local function isarray (tbl) + local max, n, arraylen = 0, 0, 0 + for k,v in pairs (tbl) do + if k == 'n' and type(v) == 'number' then + arraylen = v + if v > max then + max = v + end + else + if type(k) ~= 'number' or k < 1 or floor(k) ~= k then + return false + end + if k > max then + max = k + end + n = n + 1 + end + end + if max > 10 and max > arraylen and max > n * 2 then + return false -- don't create an array with too many holes + end + return true, max +end + +local escapecodes = { + ["\""] = "\\\"", ["\\"] = "\\\\", ["\b"] = "\\b", ["\f"] = "\\f", + ["\n"] = "\\n", ["\r"] = "\\r", ["\t"] = "\\t" +} + +local function escapeutf8 (uchar) + local value = escapecodes[uchar] + if value then + return value + end + local a, b, c, d = strbyte (uchar, 1, 4) + a, b, c, d = a or 0, b or 0, c or 0, d or 0 + if a <= 0x7f then + value = a + elseif 0xc0 <= a and a <= 0xdf and b >= 0x80 then + value = (a - 0xc0) * 0x40 + b - 0x80 + elseif 0xe0 <= a and a <= 0xef and b >= 0x80 and c >= 0x80 then + value = ((a - 0xe0) * 0x40 + b - 0x80) * 0x40 + c - 0x80 + elseif 0xf0 <= a and a <= 0xf7 and b >= 0x80 and c >= 0x80 and d >= 0x80 then + value = (((a - 0xf0) * 0x40 + b - 0x80) * 0x40 + c - 0x80) * 0x40 + d - 0x80 + else + return "" + end + if value <= 0xffff then + return strformat ("\\u%.4x", value) + elseif value <= 0x10ffff then + -- encode as UTF-16 surrogate pair + value = value - 0x10000 + local highsur, lowsur = 0xD800 + floor (value/0x400), 0xDC00 + (value % 0x400) + return strformat ("\\u%.4x\\u%.4x", highsur, lowsur) + else + return "" + end +end + +local function fsub (str, pattern, repl) + -- gsub always builds a new string in a buffer, even when no match + -- exists. First using find should be more efficient when most strings + -- don't contain the pattern. + if strfind (str, pattern) then + return gsub (str, pattern, repl) + else + return str + end +end + +local function quotestring (value) + -- based on the regexp "escapable" in https://github.com/douglascrockford/JSON-js + value = fsub (value, "[%z\1-\31\"\\\127]", escapeutf8) + if strfind (value, "[\194\216\220\225\226\239]") then + value = fsub (value, "\194[\128-\159\173]", escapeutf8) + value = fsub (value, "\216[\128-\132]", escapeutf8) + value = fsub (value, "\220\143", escapeutf8) + value = fsub (value, "\225\158[\180\181]", escapeutf8) + value = fsub (value, "\226\128[\140-\143\168-\175]", escapeutf8) + value = fsub (value, "\226\129[\160-\175]", escapeutf8) + value = fsub (value, "\239\187\191", escapeutf8) + value = fsub (value, "\239\191[\176-\191]", escapeutf8) + end + return "\"" .. value .. "\"" +end +json.quotestring = quotestring + +local function replace(str, o, n) + local i, j = strfind (str, o, 1, true) + if i then + return strsub(str, 1, i-1) .. n .. strsub(str, j+1, -1) + else + return str + end +end + +-- locale independent num2str and str2num functions +local decpoint, numfilter + +local function updatedecpoint () + decpoint = strmatch(tostring(0.5), "([^05+])") + -- build a filter that can be used to remove group separators + numfilter = "[^0-9%-%+eE" .. gsub(decpoint, "[%^%$%(%)%%%.%[%]%*%+%-%?]", "%%%0") .. "]+" +end + +updatedecpoint() + +local function num2str (num) + return replace(fsub(tostring(num), numfilter, ""), decpoint, ".") +end + +local function str2num (str) + local num = tonumber(replace(str, ".", decpoint)) + if not num then + updatedecpoint() + num = tonumber(replace(str, ".", decpoint)) + end + return num +end + +local function addnewline2 (level, buffer, buflen) + buffer[buflen+1] = "\n" + buffer[buflen+2] = strrep (" ", level) + buflen = buflen + 2 + return buflen +end + +function json.addnewline (state) + if state.indent then + state.bufferlen = addnewline2 (state.level or 0, + state.buffer, state.bufferlen or #(state.buffer)) + end +end + +local encode2 -- forward declaration + +local function addpair (key, value, prev, indent, level, buffer, buflen, tables, globalorder, state) + local kt = type (key) + if kt ~= 'string' and kt ~= 'number' then + return nil, "type '" .. kt .. "' is not supported as a key by JSON." + end + if prev then + buflen = buflen + 1 + buffer[buflen] = "," + end + if indent then + buflen = addnewline2 (level, buffer, buflen) + end + buffer[buflen+1] = quotestring (key) + buffer[buflen+2] = ":" + return encode2 (value, indent, level, buffer, buflen + 2, tables, globalorder, state) +end + +local function appendcustom(res, buffer, state) + local buflen = state.bufferlen + if type (res) == 'string' then + buflen = buflen + 1 + buffer[buflen] = res + end + return buflen +end + +local function exception(reason, value, state, buffer, buflen, defaultmessage) + defaultmessage = defaultmessage or reason + local handler = state.exception + if not handler then + return nil, defaultmessage + else + state.bufferlen = buflen + local ret, msg = handler (reason, value, state, defaultmessage) + if not ret then return nil, msg or defaultmessage end + return appendcustom(ret, buffer, state) + end +end + +function json.encodeexception(reason, value, state, defaultmessage) + return quotestring("<" .. defaultmessage .. ">") +end + +encode2 = function (value, indent, level, buffer, buflen, tables, globalorder, state) + local valtype = type (value) + local valmeta = getmetatable (value) + valmeta = type (valmeta) == 'table' and valmeta -- only tables + local valtojson = valmeta and valmeta.__tojson + if valtojson then + if tables[value] then + return exception('reference cycle', value, state, buffer, buflen) + end + tables[value] = true + state.bufferlen = buflen + local ret, msg = valtojson (value, state) + if not ret then return exception('custom encoder failed', value, state, buffer, buflen, msg) end + tables[value] = nil + buflen = appendcustom(ret, buffer, state) + elseif value == nil then + buflen = buflen + 1 + buffer[buflen] = "null" + elseif valtype == 'number' then + local s + if value ~= value or value >= huge or -value >= huge then + -- This is the behaviour of the original JSON implementation. + s = "null" + else + s = num2str (value) + end + buflen = buflen + 1 + buffer[buflen] = s + elseif valtype == 'boolean' then + buflen = buflen + 1 + buffer[buflen] = value and "true" or "false" + elseif valtype == 'string' then + buflen = buflen + 1 + buffer[buflen] = quotestring (value) + elseif valtype == 'table' then + if tables[value] then + return exception('reference cycle', value, state, buffer, buflen) + end + tables[value] = true + level = level + 1 + local isa, n = isarray (value) + if n == 0 and valmeta and valmeta.__jsontype == 'object' then + isa = false + end + local msg + if isa then -- JSON array + buflen = buflen + 1 + buffer[buflen] = "[" + for i = 1, n do + buflen, msg = encode2 (value[i], indent, level, buffer, buflen, tables, globalorder, state) + if not buflen then return nil, msg end + if i < n then + buflen = buflen + 1 + buffer[buflen] = "," + end + end + buflen = buflen + 1 + buffer[buflen] = "]" + else -- JSON object + local prev = false + buflen = buflen + 1 + buffer[buflen] = "{" + local order = valmeta and valmeta.__jsonorder or globalorder + if order then + local used = {} + n = #order + for i = 1, n do + local k = order[i] + local v = value[k] + local _ + if v then + used[k] = true + buflen, _ = addpair (k, v, prev, indent, level, buffer, buflen, tables, globalorder, state) + prev = true -- add a seperator before the next element + end + end + for k,v in pairs (value) do + if not used[k] then + buflen, msg = addpair (k, v, prev, indent, level, buffer, buflen, tables, globalorder, state) + if not buflen then return nil, msg end + prev = true -- add a seperator before the next element + end + end + else -- unordered + for k,v in pairs (value) do + buflen, msg = addpair (k, v, prev, indent, level, buffer, buflen, tables, globalorder, state) + if not buflen then return nil, msg end + prev = true -- add a seperator before the next element + end + end + if indent then + buflen = addnewline2 (level - 1, buffer, buflen) + end + buflen = buflen + 1 + buffer[buflen] = "}" + end + tables[value] = nil + else + return exception ('unsupported type', value, state, buffer, buflen, + "type '" .. valtype .. "' is not supported by JSON.") + end + return buflen +end + +function json.encode (value, state) + state = state or {} + local oldbuffer = state.buffer + local buffer = oldbuffer or {} + state.buffer = buffer + updatedecpoint() + local ret, msg = encode2 (value, state.indent, state.level or 0, + buffer, state.bufferlen or 0, state.tables or {}, state.keyorder, state) + if not ret then + error (msg, 2) + elseif oldbuffer == buffer then + state.bufferlen = ret + return true + else + state.bufferlen = nil + state.buffer = nil + return concat (buffer) + end +end + +local function loc (str, where) + local line, pos, linepos = 1, 1, 0 + while true do + pos = strfind (str, "\n", pos, true) + if pos and pos < where then + line = line + 1 + linepos = pos + pos = pos + 1 + else + break + end + end + return "line " .. line .. ", column " .. (where - linepos) +end + +local function unterminated (str, what, where) + return nil, strlen (str) + 1, "unterminated " .. what .. " at " .. loc (str, where) +end + +local function scanwhite (str, pos) + while true do + pos = strfind (str, "%S", pos) + if not pos then return nil end + local sub2 = strsub (str, pos, pos + 1) + if sub2 == "\239\187" and strsub (str, pos + 2, pos + 2) == "\191" then + -- UTF-8 Byte Order Mark + pos = pos + 3 + elseif sub2 == "//" then + pos = strfind (str, "[\n\r]", pos + 2) + if not pos then return nil end + elseif sub2 == "/*" then + pos = strfind (str, "*/", pos + 2) + if not pos then return nil end + pos = pos + 2 + else + return pos + end + end +end + +local escapechars = { + ["\""] = "\"", ["\\"] = "\\", ["/"] = "/", ["b"] = "\b", ["f"] = "\f", + ["n"] = "\n", ["r"] = "\r", ["t"] = "\t" +} + +local function unichar (value) + if value < 0 then + return nil + elseif value <= 0x007f then + return strchar (value) + elseif value <= 0x07ff then + return strchar (0xc0 + floor(value/0x40), + 0x80 + (floor(value) % 0x40)) + elseif value <= 0xffff then + return strchar (0xe0 + floor(value/0x1000), + 0x80 + (floor(value/0x40) % 0x40), + 0x80 + (floor(value) % 0x40)) + elseif value <= 0x10ffff then + return strchar (0xf0 + floor(value/0x40000), + 0x80 + (floor(value/0x1000) % 0x40), + 0x80 + (floor(value/0x40) % 0x40), + 0x80 + (floor(value) % 0x40)) + else + return nil + end +end + +local function scanstring (str, pos) + local lastpos = pos + 1 + local buffer, n = {}, 0 + while true do + local nextpos = strfind (str, "[\"\\]", lastpos) + if not nextpos then + return unterminated (str, "string", pos) + end + if nextpos > lastpos then + n = n + 1 + buffer[n] = strsub (str, lastpos, nextpos - 1) + end + if strsub (str, nextpos, nextpos) == "\"" then + lastpos = nextpos + 1 + break + else + local escchar = strsub (str, nextpos + 1, nextpos + 1) + local value + if escchar == "u" then + value = tonumber (strsub (str, nextpos + 2, nextpos + 5), 16) + if value then + local value2 + if 0xD800 <= value and value <= 0xDBff then + -- we have the high surrogate of UTF-16. Check if there is a + -- low surrogate escaped nearby to combine them. + if strsub (str, nextpos + 6, nextpos + 7) == "\\u" then + value2 = tonumber (strsub (str, nextpos + 8, nextpos + 11), 16) + if value2 and 0xDC00 <= value2 and value2 <= 0xDFFF then + value = (value - 0xD800) * 0x400 + (value2 - 0xDC00) + 0x10000 + else + value2 = nil -- in case it was out of range for a low surrogate + end + end + end + value = value and unichar (value) + if value then + if value2 then + lastpos = nextpos + 12 + else + lastpos = nextpos + 6 + end + end + end + end + if not value then + value = escapechars[escchar] or escchar + lastpos = nextpos + 2 + end + n = n + 1 + buffer[n] = value + end + end + if n == 1 then + return buffer[1], lastpos + elseif n > 1 then + return concat (buffer), lastpos + else + return "", lastpos + end +end + +local scanvalue -- forward declaration + +local function scantable (what, closechar, str, startpos, nullval, objectmeta, arraymeta) + local tbl, n = {}, 0 + local pos = startpos + 1 + if what == 'object' then + setmetatable (tbl, objectmeta) + else + setmetatable (tbl, arraymeta) + end + while true do + pos = scanwhite (str, pos) + if not pos then return unterminated (str, what, startpos) end + local char = strsub (str, pos, pos) + if char == closechar then + return tbl, pos + 1 + end + local val1, err + val1, pos, err = scanvalue (str, pos, nullval, objectmeta, arraymeta) + if err then return nil, pos, err end + pos = scanwhite (str, pos) + if not pos then return unterminated (str, what, startpos) end + char = strsub (str, pos, pos) + if char == ":" then + if val1 == nil then + return nil, pos, "cannot use nil as table index (at " .. loc (str, pos) .. ")" + end + pos = scanwhite (str, pos + 1) + if not pos then return unterminated (str, what, startpos) end + local val2 + val2, pos, err = scanvalue (str, pos, nullval, objectmeta, arraymeta) + if err then return nil, pos, err end + tbl[val1] = val2 + pos = scanwhite (str, pos) + if not pos then return unterminated (str, what, startpos) end + char = strsub (str, pos, pos) + else + n = n + 1 + tbl[n] = val1 + end + if char == "," then + pos = pos + 1 + end + end +end + +scanvalue = function (str, pos, nullval, objectmeta, arraymeta) + pos = pos or 1 + pos = scanwhite (str, pos) + if not pos then + return nil, strlen (str) + 1, "no valid JSON value (reached the end)" + end + local char = strsub (str, pos, pos) + if char == "{" then + return scantable ('object', "}", str, pos, nullval, objectmeta, arraymeta) + elseif char == "[" then + return scantable ('array', "]", str, pos, nullval, objectmeta, arraymeta) + elseif char == "\"" then + return scanstring (str, pos) + else + local pstart, pend = strfind (str, "^%-?[%d%.]+[eE]?[%+%-]?%d*", pos) + if pstart then + local number = str2num (strsub (str, pstart, pend)) + if number then + return number, pend + 1 + end + end + pstart, pend = strfind (str, "^%a%w*", pos) + if pstart then + local name = strsub (str, pstart, pend) + if name == "true" then + return true, pend + 1 + elseif name == "false" then + return false, pend + 1 + elseif name == "null" then + return nullval, pend + 1 + end + end + return nil, pos, "no valid JSON value at " .. loc (str, pos) + end +end + +local function optionalmetatables(...) + if select("#", ...) > 0 then + return ... + else + return {__jsontype = 'object'}, {__jsontype = 'array'} + end +end + +function json.decode (str, pos, nullval, ...) + local objectmeta, arraymeta = optionalmetatables(...) + return scanvalue (str, pos, nullval, objectmeta, arraymeta) +end + +function json.use_lpeg () + local g = require ("lpeg") + + if g.version() == "0.11" then + error "due to a bug in LPeg 0.11, it cannot be used for JSON matching" + end + + local pegmatch = g.match + local P, S, R = g.P, g.S, g.R + + local function ErrorCall (str, pos, msg, state) + if not state.msg then + state.msg = msg .. " at " .. loc (str, pos) + state.pos = pos + end + return false + end + + local function Err (msg) + return g.Cmt (g.Cc (msg) * g.Carg (2), ErrorCall) + end + + local SingleLineComment = P"//" * (1 - S"\n\r")^0 + local MultiLineComment = P"/*" * (1 - P"*/")^0 * P"*/" + local Space = (S" \n\r\t" + P"\239\187\191" + SingleLineComment + MultiLineComment)^0 + + local PlainChar = 1 - S"\"\\\n\r" + local EscapeSequence = (P"\\" * g.C (S"\"\\/bfnrt" + Err "unsupported escape sequence")) / escapechars + local HexDigit = R("09", "af", "AF") + local function UTF16Surrogate (match, pos, high, low) + high, low = tonumber (high, 16), tonumber (low, 16) + if 0xD800 <= high and high <= 0xDBff and 0xDC00 <= low and low <= 0xDFFF then + return true, unichar ((high - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000) + else + return false + end + end + local function UTF16BMP (hex) + return unichar (tonumber (hex, 16)) + end + local U16Sequence = (P"\\u" * g.C (HexDigit * HexDigit * HexDigit * HexDigit)) + local UnicodeEscape = g.Cmt (U16Sequence * U16Sequence, UTF16Surrogate) + U16Sequence/UTF16BMP + local Char = UnicodeEscape + EscapeSequence + PlainChar + local String = P"\"" * g.Cs (Char ^ 0) * (P"\"" + Err "unterminated string") + local Integer = P"-"^(-1) * (P"0" + (R"19" * R"09"^0)) + local Fractal = P"." * R"09"^0 + local Exponent = (S"eE") * (S"+-")^(-1) * R"09"^1 + local Number = (Integer * Fractal^(-1) * Exponent^(-1))/str2num + local Constant = P"true" * g.Cc (true) + P"false" * g.Cc (false) + P"null" * g.Carg (1) + local SimpleValue = Number + String + Constant + local ArrayContent, ObjectContent + + -- The functions parsearray and parseobject parse only a single value/pair + -- at a time and store them directly to avoid hitting the LPeg limits. + local function parsearray (str, pos, nullval, state) + local obj, cont + local npos + local t, nt = {}, 0 + repeat + obj, cont, npos = pegmatch (ArrayContent, str, pos, nullval, state) + if not npos then break end + pos = npos + nt = nt + 1 + t[nt] = obj + until cont == 'last' + return pos, setmetatable (t, state.arraymeta) + end + + local function parseobject (str, pos, nullval, state) + local obj, key, cont + local npos + local t = {} + repeat + key, obj, cont, npos = pegmatch (ObjectContent, str, pos, nullval, state) + if not npos then break end + pos = npos + t[key] = obj + until cont == 'last' + return pos, setmetatable (t, state.objectmeta) + end + + local Array = P"[" * g.Cmt (g.Carg(1) * g.Carg(2), parsearray) * Space * (P"]" + Err "']' expected") + local Object = P"{" * g.Cmt (g.Carg(1) * g.Carg(2), parseobject) * Space * (P"}" + Err "'}' expected") + local Value = Space * (Array + Object + SimpleValue) + local ExpectedValue = Value + Space * Err "value expected" + ArrayContent = Value * Space * (P"," * g.Cc'cont' + g.Cc'last') * g.Cp() + local Pair = g.Cg (Space * String * Space * (P":" + Err "colon expected") * ExpectedValue) + ObjectContent = Pair * Space * (P"," * g.Cc'cont' + g.Cc'last') * g.Cp() + local DecodeValue = ExpectedValue * g.Cp () + + function json.decode (str, pos, nullval, ...) + local state = {} + state.objectmeta, state.arraymeta = optionalmetatables(...) + local obj, retpos = pegmatch (DecodeValue, str, pos, nullval, state) + if state.msg then + return nil, state.pos, state.msg + else + return obj, retpos + end + end + + -- use this function only once: + json.use_lpeg = function () return json end + + json.using_lpeg = true + + return json -- so you can get the module using json = require "dkjson".use_lpeg() +end + +if always_try_using_lpeg then + pcall (json.use_lpeg) +end + +json.parse = json.decode +json.stringify = json.encode + +return exports diff --git a/plugins/mime/LICENSE b/plugins/mime/LICENSE new file mode 100644 index 00000000000..5789b767285 --- /dev/null +++ b/plugins/mime/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/plugins/mime/README.md b/plugins/mime/README.md new file mode 100644 index 00000000000..550ba582b69 --- /dev/null +++ b/plugins/mime/README.md @@ -0,0 +1,2 @@ +# luv-mime +A luv port of weblit's mime module diff --git a/plugins/mime/init.lua b/plugins/mime/init.lua new file mode 100644 index 00000000000..ac41dad1cfc --- /dev/null +++ b/plugins/mime/init.lua @@ -0,0 +1,194 @@ +local exports = {} +exports.name = "creationix/mime" +exports.version = "0.1.2-1" +exports.description = "A simple mime type database useful for serving static files over http." +exports.tags = {"mime", "static"} +exports.license = "MIT" +exports.author = { name = "Tim Caswell" } +exports.homepage = "https://github.com/creationix/weblit/blob/master/libs/mime.lua" + +local mime = exports +local table = { + ["3gp"] = "video/3gpp", + a = "application/octet-stream", + ai = "application/postscript", + aif = "audio/x-aiff", + aiff = "audio/x-aiff", + asc = "application/pgp-signature", + asf = "video/x-ms-asf", + asm = "text/x-asm", + asx = "video/x-ms-asf", + atom = "application/atom+xml", + au = "audio/basic", + avi = "video/x-msvideo", + bat = "application/x-msdownload", + bin = "application/octet-stream", + bmp = "image/bmp", + bz2 = "application/x-bzip2", + c = "text/x-c", + cab = "application/vnd.ms-cab-compressed", + cc = "text/x-c", + chm = "application/vnd.ms-htmlhelp", + class = "application/octet-stream", + com = "application/x-msdownload", + conf = "text/plain", + cpp = "text/x-c", + crt = "application/x-x509-ca-cert", + css = "text/css", + csv = "text/csv", + cxx = "text/x-c", + deb = "application/x-debian-package", + der = "application/x-x509-ca-cert", + diff = "text/x-diff", + djv = "image/vnd.djvu", + djvu = "image/vnd.djvu", + dll = "application/x-msdownload", + dmg = "application/octet-stream", + doc = "application/msword", + dot = "application/msword", + dtd = "application/xml-dtd", + dvi = "application/x-dvi", + ear = "application/java-archive", + eml = "message/rfc822", + eps = "application/postscript", + exe = "application/x-msdownload", + f = "text/x-fortran", + f77 = "text/x-fortran", + f90 = "text/x-fortran", + flv = "video/x-flv", + ["for"] = "text/x-fortran", + gem = "application/octet-stream", + gemspec = "text/x-script.ruby", + gif = "image/gif", + gz = "application/x-gzip", + h = "text/x-c", + hh = "text/x-c", + htm = "text/html", + html = "text/html", + ico = "image/vnd.microsoft.icon", + ics = "text/calendar", + ifb = "text/calendar", + iso = "application/octet-stream", + jar = "application/java-archive", + java = "text/x-java-source", + jnlp = "application/x-java-jnlp-file", + jpeg = "image/jpeg", + jpg = "image/jpeg", + js = "application/javascript", + json = "application/json", + less = "text/css", + log = "text/plain", + lua = "text/x-lua", + luac = "application/x-lua-bytecode", + m3u = "audio/x-mpegurl", + m4v = "video/mp4", + man = "text/troff", + manifest = "text/cache-manifest", + markdown = "text/markdown", + mathml = "application/mathml+xml", + mbox = "application/mbox", + mdoc = "text/troff", + md = "text/markdown", + me = "text/troff", + mid = "audio/midi", + midi = "audio/midi", + mime = "message/rfc822", + mml = "application/mathml+xml", + mng = "video/x-mng", + mov = "video/quicktime", + mp3 = "audio/mpeg", + mp4 = "video/mp4", + mp4v = "video/mp4", + mpeg = "video/mpeg", + mpg = "video/mpeg", + ms = "text/troff", + msi = "application/x-msdownload", + odp = "application/vnd.oasis.opendocument.presentation", + ods = "application/vnd.oasis.opendocument.spreadsheet", + odt = "application/vnd.oasis.opendocument.text", + ogg = "application/ogg", + p = "text/x-pascal", + pas = "text/x-pascal", + pbm = "image/x-portable-bitmap", + pdf = "application/pdf", + pem = "application/x-x509-ca-cert", + pgm = "image/x-portable-graymap", + pgp = "application/pgp-encrypted", + pkg = "application/octet-stream", + pl = "text/x-script.perl", + pm = "text/x-script.perl-module", + png = "image/png", + pnm = "image/x-portable-anymap", + ppm = "image/x-portable-pixmap", + pps = "application/vnd.ms-powerpoint", + ppt = "application/vnd.ms-powerpoint", + ps = "application/postscript", + psd = "image/vnd.adobe.photoshop", + py = "text/x-script.python", + qt = "video/quicktime", + ra = "audio/x-pn-realaudio", + rake = "text/x-script.ruby", + ram = "audio/x-pn-realaudio", + rar = "application/x-rar-compressed", + rb = "text/x-script.ruby", + rdf = "application/rdf+xml", + roff = "text/troff", + rpm = "application/x-redhat-package-manager", + rss = "application/rss+xml", + rtf = "application/rtf", + ru = "text/x-script.ruby", + s = "text/x-asm", + sgm = "text/sgml", + sgml = "text/sgml", + sh = "application/x-sh", + sig = "application/pgp-signature", + snd = "audio/basic", + so = "application/octet-stream", + svg = "image/svg+xml", + svgz = "image/svg+xml", + swf = "application/x-shockwave-flash", + t = "text/troff", + tar = "application/x-tar", + tbz = "application/x-bzip-compressed-tar", + tci = "application/x-topcloud", + tcl = "application/x-tcl", + tex = "application/x-tex", + texi = "application/x-texinfo", + texinfo = "application/x-texinfo", + text = "text/plain", + tif = "image/tiff", + tiff = "image/tiff", + torrent = "application/x-bittorrent", + tr = "text/troff", + ttf = "application/x-font-ttf", + txt = "text/plain", + vcf = "text/x-vcard", + vcs = "text/x-vcalendar", + vrml = "model/vrml", + war = "application/java-archive", + wav = "audio/x-wav", + webm = "video/webm", + wma = "audio/x-ms-wma", + wmv = "video/x-ms-wmv", + wmx = "video/x-ms-wmx", + wrl = "model/vrml", + wsdl = "application/wsdl+xml", + xbm = "image/x-xbitmap", + xhtml = "application/xhtml+xml", + xls = "application/vnd.ms-excel", + xml = "application/xml", + xpm = "image/x-xpixmap", + xsl = "application/xml", + xslt = "application/xslt+xml", + yaml = "text/yaml", + yml = "text/yaml", + zip = "application/zip", +} +mime.table = table +mime.default = "application/octet-stream" + +function mime.getType(path) + return mime.table[path:lower():match("[^.]*$")] or mime.default +end + +return mime diff --git a/plugins/path/LICENSE b/plugins/path/LICENSE new file mode 100644 index 00000000000..8f71f43fee3 --- /dev/null +++ b/plugins/path/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/plugins/path/README.md b/plugins/path/README.md new file mode 100644 index 00000000000..75d881e35e3 --- /dev/null +++ b/plugins/path/README.md @@ -0,0 +1,2 @@ +# luv-path +A luv port of luvi's path module diff --git a/plugins/path/init.lua b/plugins/path/init.lua new file mode 100644 index 00000000000..d0e427d02ee --- /dev/null +++ b/plugins/path/init.lua @@ -0,0 +1,139 @@ +--[[ + +Copyright 2014 The Luvit Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS-IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--]] + +-- Extracted from https://github.com/luvit/luvi/blob/master/src/lua/init.lua + +local isWindows +if jit and jit.os then + -- Luajit provides explicit platform detection + isWindows = jit.os == "Windows" +else + -- Normal lua will only have \ for path separator on windows. + isWindows = package.config:find("\\") and true or false +end + +local uv = require('luv') + +local getPrefix, splitPath, joinParts + +if isWindows then + -- Windows aware path utilities + function getPrefix(path) + return path:match("^%a:\\") or + path:match("^/") or + path:match("^\\+") + end + function splitPath(path) + local parts = {} + for part in string.gmatch(path, '([^/\\]+)') do + table.insert(parts, part) + end + return parts + end + function joinParts(prefix, parts, i, j) + if not prefix then + return table.concat(parts, '/', i, j) + elseif prefix ~= '/' then + return prefix .. table.concat(parts, '\\', i, j) + else + return prefix .. table.concat(parts, '/', i, j) + end + end +else + -- Simple optimized versions for UNIX systems + function getPrefix(path) + return path:match("^/") + end + function splitPath(path) + local parts = {} + for part in string.gmatch(path, '([^/]+)') do + table.insert(parts, part) + end + return parts + end + function joinParts(prefix, parts, i, j) + if prefix then + return prefix .. table.concat(parts, '/', i, j) + end + return table.concat(parts, '/', i, j) + end +end + +local function pathJoin(...) + local inputs = {...} + local l = #inputs + + -- Find the last segment that is an absolute path + -- Or if all are relative, prefix will be nil + local i = l + local prefix + while true do + prefix = getPrefix(inputs[i]) + if prefix or i <= 1 then break end + i = i - 1 + end + + -- If there was one, remove its prefix from its segment + if prefix then + inputs[i] = inputs[i]:sub(#prefix) + end + + -- Split all the paths segments into one large list + local parts = {} + while i <= l do + local sub = splitPath(inputs[i]) + for j = 1, #sub do + parts[#parts + 1] = sub[j] + end + i = i + 1 + end + + -- Evaluate special segments in reverse order. + local skip = 0 + local reversed = {} + for idx = #parts, 1, -1 do + local part = parts[idx] + if part == '.' then + -- Ignore + elseif part == '..' then + skip = skip + 1 + elseif skip > 0 then + skip = skip - 1 + else + reversed[#reversed + 1] = part + end + end + + -- Reverse the list again to get the correct order + parts = reversed + for idx = 1, #parts / 2 do + local j = #parts - idx + 1 + parts[idx], parts[j] = parts[j], parts[idx] + end + + local path = joinParts(prefix, parts) + return path +end + +return { + isWindows = isWindows, + join = pathJoin, + getPrefix = getPrefix, + splitPath = splitPath, + joinparts = joinParts, +} diff --git a/plugins/pretty-print/LICENSE b/plugins/pretty-print/LICENSE new file mode 100644 index 00000000000..8f71f43fee3 --- /dev/null +++ b/plugins/pretty-print/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/plugins/pretty-print/README.md b/plugins/pretty-print/README.md new file mode 100644 index 00000000000..82372160e09 --- /dev/null +++ b/plugins/pretty-print/README.md @@ -0,0 +1,2 @@ +# luv-pretty-print +luvit's pretty-print module re-packaged as a luv submodule. diff --git a/plugins/pretty-print/init.lua b/plugins/pretty-print/init.lua new file mode 100644 index 00000000000..f1c112d6e4f --- /dev/null +++ b/plugins/pretty-print/init.lua @@ -0,0 +1,362 @@ +--[[ + +Copyright 2014-2015 The Luvit Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS-IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--]] + +-- Luv port by Tim Caswell + +local exports = {} +exports.name = "luvit/pretty-print" +exports.version = "1.0.3" +exports.homepage = "https://github.com/luvit/luvit/blob/master/deps/pretty-print.lua" +exports.description = "A lua value pretty printer and colorizer for terminals." +exports.tags = {"colors", "tty"} +exports.license = "Apache 2" +exports.author = { name = "Tim Caswell" } + +local uv = require('luv') + +local prettyPrint, dump, strip, color, colorize, loadColors +local theme = {} +local useColors = false +local defaultTheme + +local stdout, stdin, stderr, width + +local quote, quote2, dquote, dquote2, obracket, cbracket, obrace, cbrace, comma, equals, controls + +local themes = { + -- nice color theme using 16 ansi colors + [16] = { + property = "0;37", -- white + sep = "1;30", -- bright-black + braces = "1;30", -- bright-black + + ["nil"] = "1;30", -- bright-black + boolean = "0;33", -- yellow + number = "1;33", -- bright-yellow + string = "0;32", -- green + quotes = "1;32", -- bright-green + escape = "1;32", -- bright-green + ["function"] = "0;35", -- purple + thread = "1;35", -- bright-purple + + table = "1;34", -- bright blue + userdata = "1;36", -- bright cyan + cdata = "0;36", -- cyan + + err = "1;31", -- bright red + success = "1;33;42", -- bright-yellow on green + failure = "1;33;41", -- bright-yellow on red + highlight = "1;36;44", -- bright-cyan on blue + }, + -- nice color theme using ansi 256-mode colors + [256] = { + property = "38;5;253", + braces = "38;5;247", + sep = "38;5;240", + + ["nil"] = "38;5;244", + boolean = "38;5;220", -- yellow-orange + number = "38;5;202", -- orange + string = "38;5;34", -- darker green + quotes = "38;5;40", -- green + escape = "38;5;46", -- bright green + ["function"] = "38;5;129", -- purple + thread = "38;5;199", -- pink + + table = "38;5;27", -- blue + userdata = "38;5;39", -- blue2 + cdata = "38;5;69", -- teal + + err = "38;5;196", -- bright red + success = "38;5;120;48;5;22", -- bright green on dark green + failure = "38;5;215;48;5;52", -- bright red on dark red + highlight = "38;5;45;48;5;236", -- bright teal on dark grey + }, +} + +local special = { + [7] = 'a', + [8] = 'b', + [9] = 't', + [10] = 'n', + [11] = 'v', + [12] = 'f', + [13] = 'r' +} + +function strip(str) + return string.gsub(str, '\027%[[^m]*m', '') +end + + +function loadColors(index) + if index == nil then index = defaultTheme end + + -- Remove the old theme + for key in pairs(theme) do + theme[key] = nil + end + + if index then + local new = themes[index] + if not new then error("Invalid theme index: " .. tostring(index)) end + -- Add the new theme + for key in pairs(new) do + theme[key] = new[key] + end + useColors = true + else + useColors = false + end + + quote = colorize('quotes', "'", 'string') + quote2 = colorize('quotes', "'") + dquote = colorize('quotes', '"', 'string') + dquote2 = colorize('quotes', '"') + obrace = colorize('braces', '{ ') + cbrace = colorize('braces', '}') + obracket = colorize('property', '[') + cbracket = colorize('property', ']') + comma = colorize('sep', ', ') + equals = colorize('sep', ' = ') + + controls = {} + for i = 0, 31 do + local c = special[i] + if not c then + if i < 10 then + c = "00" .. tostring(i) + else + c = "0" .. tostring(i) + end + end + controls[i] = colorize('escape', '\\' .. c, 'string') + end + controls[92] = colorize('escape', '\\\\', 'string') + controls[34] = colorize('escape', '\\"', 'string') + controls[39] = colorize('escape', "\\'", 'string') + for i = 128, 255 do + local c + if i < 100 then + c = "0" .. tostring(i) + else + c = tostring(i) + end + controls[i] = colorize('escape', '\\' .. c, 'string') + end + +end + +function color(colorName) + return '\27[' .. (theme[colorName] or '0') .. 'm' +end + +function colorize(colorName, string, resetName) + return useColors and + (color(colorName) .. tostring(string) .. color(resetName)) or + tostring(string) +end + +local function stringEscape(c) + return controls[string.byte(c, 1)] +end + +function dump(value, recurse, nocolor) + local seen = {} + local output = {} + local offset = 0 + local stack = {} + + local function recalcOffset(index) + for i = index + 1, #output do + local m = string.match(output[i], "\n([^\n]*)$") + if m then + offset = #(strip(m)) + else + offset = offset + #(strip(output[i])) + end + end + end + + local function write(text, length) + if not length then length = #(strip(text)) end + -- Create room for data by opening parent blocks + -- Start at the root and go down. + local i = 1 + while offset + length > width and stack[i] do + local entry = stack[i] + if not entry.opened then + entry.opened = true + table.insert(output, entry.index + 1, "\n" .. string.rep(" ", i)) + -- Recalculate the offset + recalcOffset(entry.index) + -- Bump the index of all deeper entries + for j = i + 1, #stack do + stack[j].index = stack[j].index + 1 + end + end + i = i + 1 + end + output[#output + 1] = text + offset = offset + length + if offset > width then + return dump(stack) + end + end + + local function indent() + stack[#stack + 1] = { + index = #output, + opened = false, + } + end + + local function unindent() + stack[#stack] = nil + end + + local function process(value) + local typ = type(value) + if typ == 'string' then + if string.match(value, "'") and not string.match(value, '"') then + write(dquote .. string.gsub(value, '[%c\\\128-\255]', stringEscape) .. dquote2) + else + write(quote .. string.gsub(value, "[%c\\'\128-\255]", stringEscape) .. quote2) + end + elseif typ == 'table' and not seen[value] then + if not recurse then seen[value] = true end + write(obrace) + local i = 1 + -- Count the number of keys so we know when to stop adding commas + local total = 0 + for _ in pairs(value) do total = total + 1 end + + local nextIndex = 1 + for k, v in pairs(value) do + indent() + if k == nextIndex then + -- if the key matches the last numerical index + 1 + -- This is how lists print without keys + nextIndex = k + 1 + process(v) + else + if type(k) == "string" and string.find(k,"^[%a_][%a%d_]*$") then + write(colorize("property", k) .. equals) + else + write(obracket) + process(k) + write(cbracket .. equals) + end + if type(v) == "table" then + process(v) + else + indent() + process(v) + unindent() + end + end + if i < total then + write(comma) + else + write(" ") + end + i = i + 1 + unindent() + end + write(cbrace) + else + write(colorize(typ, tostring(value))) + end + end + + process(value) + local s = table.concat(output, "") + return nocolor and strip(s) or s +end + +-- Print replacement that goes through libuv. This is useful on windows +-- to use libuv's code to translate ansi escape codes to windows API calls. +function _G.print(...) + local n = select('#', ...) + local arguments = {...} + for i = 1, n do + arguments[i] = tostring(arguments[i]) + end + uv.write(stdout, table.concat(arguments, "\t") .. "\n") +end + +function prettyPrint(...) + local n = select('#', ...) + local arguments = { ... } + + for i = 1, n do + arguments[i] = dump(arguments[i]) + end + + print(table.concat(arguments, "\t")) +end + +function strip(str) + return string.gsub(str, '\027%[[^m]*m', '') +end + +if uv.guess_handle(0) == 'tty' then + stdin = assert(uv.new_tty(0, true)) +else + stdin = uv.new_pipe(false) + uv.pipe_open(stdin, 0) +end + +if uv.guess_handle(1) == 'tty' then + stdout = assert(uv.new_tty(1, false)) + width = uv.tty_get_winsize(stdout) + if width == 0 then width = 80 end + -- auto-detect when 16 color mode should be used + local term = os.getenv("TERM") + if term == 'xterm' or term == 'xterm-256color' then + defaultTheme = 256 + else + defaultTheme = 16 + end +else + stdout = uv.new_pipe(false) + uv.pipe_open(stdout, 1) + width = 80 +end +loadColors() + +if uv.guess_handle(2) == 'tty' then + stderr = assert(uv.new_tty(2, false)) +else + stderr = uv.new_pipe(false) + uv.pipe_open(stderr, 2) +end + +exports.loadColors = loadColors +exports.theme = theme +exports.print = print +exports.prettyPrint = prettyPrint +exports.dump = dump +exports.color = color +exports.colorize = colorize +exports.stdin = stdin +exports.stdout = stdout +exports.stderr = stderr +exports.strip = strip + +return exports diff --git a/plugins/querystring/LICENSE b/plugins/querystring/LICENSE new file mode 100644 index 00000000000..8f71f43fee3 --- /dev/null +++ b/plugins/querystring/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/plugins/querystring/README.md b/plugins/querystring/README.md new file mode 100644 index 00000000000..7f3437312bb --- /dev/null +++ b/plugins/querystring/README.md @@ -0,0 +1,2 @@ +# luv-querystring +A luv port of luvit's querystring diff --git a/plugins/querystring/init.lua b/plugins/querystring/init.lua new file mode 100644 index 00000000000..0e2675f9252 --- /dev/null +++ b/plugins/querystring/init.lua @@ -0,0 +1,105 @@ +--[[ + +Copyright 2015 The Luvit Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS-IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--]] + +local exports = {} +exports.name = "luvit/querystring" +exports.version = "1.0.2" +exports.license = "Apache 2" +exports.homepage = "https://github.com/luvit/luvit/blob/master/deps/querystring.lua" +exports.description = "Node-style query-string codec for luvit" +exports.tags = {"luvit", "url", "codec"} + +local find = string.find +local gsub = string.gsub +local char = string.char +local byte = string.byte +local format = string.format +local match = string.match +local gmatch = string.gmatch + +function exports.urldecode(str) + str = gsub(str, '+', ' ') + str = gsub(str, '%%(%x%x)', function(h) + return char(tonumber(h, 16)) + end) + str = gsub(str, '\r\n', '\n') + return str +end + +function exports.urlencode(str) + if str then + str = gsub(str, '\n', '\r\n') + str = gsub(str, '([^%w])', function(c) + return format('%%%02X', byte(c)) + end) + end + return str +end + +local function stringifyPrimitive(v) + return tostring(v) +end + +function exports.stringify(params, sep, eq) + if not sep then sep = '&' end + if not eq then eq = '=' end + if type(params) == "table" then + local fields = {} + for key,value in pairs(params) do + local keyString = exports.urlencode(stringifyPrimitive(key)) .. eq + if type(value) == "table" then + for _, v in ipairs(value) do + table.insert(fields, keyString .. exports.urlencode(stringifyPrimitive(v))) + end + else + table.insert(fields, keyString .. exports.urlencode(stringifyPrimitive(value))) + end + end + return table.concat(fields, sep) + end + return '' +end + +-- parse querystring into table. urldecode tokens +function exports.parse(str, sep, eq) + if not sep then sep = '&' end + if not eq then eq = '=' end + local vars = {} + for pair in gmatch(tostring(str), '[^' .. sep .. ']+') do + if not find(pair, eq) then + vars[exports.urldecode(pair)] = '' + else + local key, value = match(pair, '([^' .. eq .. ']*)' .. eq .. '(.*)') + if key then + key = exports.urldecode(key) + value = exports.urldecode(value) + local type = type(vars[key]) + if type=='nil' then + vars[key] = value + elseif type=='table' then + table.insert(vars[key], value) + else + vars[key] = {vars[key],value} + end + end + end + end + return vars +end + +return exports diff --git a/plugins/weblit/LICENSE b/plugins/weblit/LICENSE new file mode 100644 index 00000000000..5789b767285 --- /dev/null +++ b/plugins/weblit/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/plugins/weblit/README.md b/plugins/weblit/README.md new file mode 100644 index 00000000000..55d6085d22b --- /dev/null +++ b/plugins/weblit/README.md @@ -0,0 +1,239 @@ +# weblit + +A web framework for luv (ported from luvit/lit) + +Weblit is a collection of lit packages that together form a nice web framework. + +## weblit/app + +This is the core of the framework. It's export value is the app itself. The +config functions can be chained off this config for super terse syntax. + +```lua +require('weblit/app') + + .bind({ + host = "0.0.0.0", + port = 8080 + }) + + .use(require('weblit/logger')) + .use(require('weblit/auto-headers')) + .use(require('weblit/etag-cache')) + + .route({ + method = "GET", + path = "/do/:user/:action", + domain = "*.myapp.io" + }, function (req, res, go) + -- Handle route + end) + + .start() + +``` + +### bind(options) + +Use this to configure your server. You can bind to multiple addresses and +ports. For example, the same server can listen on port `8080` using normal HTTP +while also listening on port `8443` using HTTPS. + +```lua +-- Listen on port 8080 internally using plain HTTP. +.bind({ + host = "127.0.0.1", + port = 8080 +}) + +-- Also listen on port 8443 externally using encrypted HTTPS. +.bind({ + host = "0.0.0.0", + port = 8443, + tls = { + cert = module:load("cert.pem"), + key = module:load("key.pem", + } +}) +``` + +The `host` option defaults to `"127.0.0.1"`. The default port depends on if +you're running as root and if the connection is TLS encrypted. + + | Root | User +------|-----:|------: +HTTP | 80 | 8080 +HTTPS | 442 | 8443 + + +### use(middleware) + +This adds a raw middleware to the chain. It's signature is: + +```lua +.use(function (req, res, go) + -- Log the request table + p("request", req) + -- Hand off to the next layer. + return go() +end) +``` + +The `req` table will contain information about the HTTP request. This includes +several fields: + + - `socket` - The raw libuv `uv_tty_t` socket. + - `method` - The HTTP request method verb like `GET` or `POST`. + - `path` - The raw HTTP request path (including query string). + - `headers` - A list of headers. Each header is a table with two entries for + key and value. For convenience, there are special `__index` and + `__newindex` metamethods that let you treat this like a case insensitive + key/value store. + - `version` - The HTTP version (Usually either `1.0` or `1.1`). + - `keepAlive` - A flag telling you if this should be a keepalive connection. + - `body` - The request body as a string. In the future, this may also be a stream. + +The `res` table also has some conventions used to form the response a piece at a +time. Initially it contains: + + - `code` - The response status code. Initially contains `404`. + - `headers` - Another special headers table like in `req`. + - `body` - The response body to send. Initially contains `"Not Found\n"`. + +The `go` function is to be called if you wish to not handle a request. This +allows other middleware layers to get a chance to respond to the request. Use a +tail call if there is nothing more to do. + +Otherwise do further processing after `go` returns. At this point, all inner +layers have finished and a response is ready in `res`. + +### route(options, middleware) + +Route is like use, but allows you to pre-filter the requests before the middleware +is called. + +```lua +.route({ + method = "PUT", + path = "/upload/:username" +}, function (req, res, go) + local url = saveFile(req.params.username, req.body) + res.code = 201 + res.headers.Location = url +end) +``` + +The route options accept several parameters: + + - `method` - This is a simple filter on a specific HTTP method verb. + - `path` - This is either an exact match or can contain patterns. Segments + looking like `:name` will match single path segments while `:name:` will + match multiple segments. The matches will go into `req.params`. Also any + query string will be stripped off, parsed out, and stored in `req.query`. + - `host` - Will filter against the `Host` header. This can be an exact match + or a glob match like `*.mydomain.org`. + - `filter` - Filter is a custom lua function that accepts `req` and returns + `true` or `false`. + +If the request matches all the requirements, then the middleware is called the +same as with `use`. + +### start + +Bind to the port(s), listen on the socket(s) and start accepting connections. + +## weblit/logger + +This is a simple middleware that logs the request method, url and user agent. +It also includes the response status code. + +Make sure to use it at the top of your middleware chain so that it's able to see +the final response code sent to the client. + +```lua +.use(require('weblit/logger')) +``` + +## weblit/auto-headers + +This implements lots of conventions and useful defaults that help your app +implement a proper HTTP server. + +You should always use this near the top of the list. The only middleware that +goes before this is the logger. + + +```lua +.use(require('weblit/auto-headers')) +``` + +## weblit/etag-cache + +This caches responses in memory keyed by etag. If there is no etag, but there +is a response body, it will use the body to generate an etag. + +Put this in your list after auto-headers, but before custom server logic. + +```lua +.use(require('weblit/etag-cache')) +``` + +## weblit/static + +This middleware serves static files to the user. Use this to serve your client- +side web assets. + +Usage is pretty simplistic for now. + +```lua +local static = require('weblit/static') +app.use(static("path/to/static/assets")) +``` + +If you want to only match a sub-path, use the router. + +```lua +app.route({ + path = "/blog/:path:" +}, static(pathJoin(module.dir, "articles"))) +``` + +The `path` param will be used if it exists and the full path will be used +otherwise. + +## weblit/websocket + +This implements a websocket upgrade handler. You can choose the subprotocol and +other routing information. + +```lua +app.websocket({ + path = "/v2/socket", -- Prefix for matching + protocol = "virgo/2.0", -- Restrict to a websocket sub-protocol +}, function (req, read, write) + -- Log the request headers + p(req) + -- Log and echo all messages + for message in read do + write(message) + end + -- End the stream + write() +end) +``` + + +## weblit + +This is the metapackage that simply includes the other modules. + +It exposes the other modules as a single exports table. + +```lua +exports.app = require('weblit/app') +exports.autoHeaders = require('weblit/auto-headers') +exports.etagCache = require('weblit/etag-cache') +exports.logger = require('weblit/logger') +exports.static = require('weblit/static') +exports.websocket = require('weblit/websocket') +``` diff --git a/plugins/weblit/app.lua b/plugins/weblit/app.lua new file mode 100644 index 00000000000..d3839c1df8e --- /dev/null +++ b/plugins/weblit/app.lua @@ -0,0 +1,261 @@ + + +local createServer = require('coro-net').createServer +local wrapper = require('coro-wrapper') +local readWrap, writeWrap = wrapper.reader, wrapper.writer +local httpCodec = require('http-codec') +--local tlsWrap = require('coro-tls').wrap +local parseQuery = require('querystring').parse + +-- Ignore SIGPIPE if it exists on platform +local uv = require('luv') +if uv.constants.SIGPIPE then + uv.new_signal():start("sigpipe") +end + +local server = {} +local handlers = {} +local bindings = {} + +-- Provide a nice case insensitive interface to headers. +local headerMeta = { + __index = function (list, name) + if type(name) ~= "string" then + return rawget(list, name) + end + name = name:lower() + for i = 1, #list do + local key, value = unpack(list[i]) + if key:lower() == name then return value end + end + end, + __newindex = function (list, name, value) + -- non-string keys go through as-is. + if type(name) ~= "string" then + return rawset(list, name, value) + end + -- First remove any existing pairs with matching key + local lowerName = name:lower() + for i = #list, 1, -1 do + if list[i][1]:lower() == lowerName then + table.remove(list, i) + end + end + -- If value is nil, we're done + if value == nil then return end + -- Otherwise, set the key(s) + if (type(value) == "table") then + -- We accept a table of strings + for i = 1, #value do + rawset(list, #list + 1, {name, tostring(value[i])}) + end + else + -- Or a single value interperted as string + rawset(list, #list + 1, {name, tostring(value)}) + end + end, +} + +local function handleRequest(head, input, socket) + local req = { + socket = socket, + method = head.method, + path = head.path, + headers = setmetatable({}, headerMeta), + version = head.version, + keepAlive = head.keepAlive, + body = input + } + for i = 1, #head do + req.headers[i] = head[i] + end + + local res = { + code = 404, + headers = setmetatable({}, headerMeta), + body = "Not Found\n", + } + + local function run(i) + local success, err = pcall(function () + i = i or 1 + local go = i < #handlers + and function () + return run(i + 1) + end + or function () end + return handlers[i](req, res, go) + end) + if not success then + res.code = 500 + res.headers = setmetatable({}, headerMeta) + res.body = err + print(err) + end + end + run(1) + + local out = { + code = res.code, + keepAlive = res.keepAlive, + } + for i = 1, #res.headers do + out[i] = res.headers[i] + end + return out, res.body, res.upgrade +end + +local function handleConnection(rawRead, rawWrite, socket) + + -- Speak in HTTP events + local read, updateDecoder = readWrap(rawRead, httpCodec.decoder()) + local write, updateEncoder = writeWrap(rawWrite, httpCodec.encoder()) + + for head in read do + local parts = {} + for chunk in read do + if #chunk > 0 then + parts[#parts + 1] = chunk + else + break + end + end + local res, body, upgrade = handleRequest(head, #parts > 0 and table.concat(parts) or nil, socket) + write(res) + if upgrade then + return upgrade(read, write, updateDecoder, updateEncoder, socket) + end + write(body) + if not (res.keepAlive and head.keepAlive) then + break + end + end + write() + +end + +function server.bind(options) + if not options.host then + options.host = "127.0.0.1" + end + if not options.port then + options.port = require('uv').getuid() == 0 and + (options.tls and 443 or 80) or + (options.tls and 8443 or 8080) + end + bindings[#bindings + 1] = options + return server +end + +function server.use(handler) + handlers[#handlers + 1] = handler + return server +end + + +function server.start() + if #bindings == 0 then + server.bind({}) + end + for i = 1, #bindings do + local options = bindings[i] + createServer(options, function (rawRead, rawWrite, socket) + --local tls = options.tls + --if tls then + --rawRead, rawWrite = tlsWrap(rawRead, rawWrite, { + -- server = true, + --key = assert(tls.key, "tls key required"), + --cert = assert(tls.cert, "tls cert required"), + --}) + --end + return handleConnection(rawRead, rawWrite, socket) + end) + print("HTTP server listening at http" .. (options.tls and "s" or "") .. "://" .. options.host .. (options.port == (options.tls and 443 or 80) and "" or ":" .. options.port) .. "/") + end + return server +end + +local quotepattern = '(['..("%^$().[]*+-?"):gsub("(.)", "%%%1")..'])' +local function escape(str) + return str:gsub(quotepattern, "%%%1") +end + +local function compileGlob(glob) + local parts = {"^"} + for a, b in glob:gmatch("([^*]*)(%**)") do + if #a > 0 then + parts[#parts + 1] = escape(a) + end + if #b > 0 then + parts[#parts + 1] = "(.*)" + end + end + parts[#parts + 1] = "$" + local pattern = table.concat(parts) + return function (string) + return string and string:match(pattern) + end +end + +local function compileRoute(route) + local parts = {"^"} + local names = {} + for a, b, c, d in route:gmatch("([^:]*):([_%a][_%w]*)(:?)([^:]*)") do + if #a > 0 then + parts[#parts + 1] = escape(a) + end + if #c > 0 then + parts[#parts + 1] = "(.*)" + else + parts[#parts + 1] = "([^/]*)" + end + names[#names + 1] = b + if #d > 0 then + parts[#parts + 1] = escape(d) + end + end + if #parts == 1 then + return function (string) + if string == route then return {} end + end + end + parts[#parts + 1] = "$" + local pattern = table.concat(parts) + return function (string) + local matches = {string:match(pattern)} + if #matches > 0 then + local results = {} + for i = 1, #matches do + results[i] = matches[i] + results[names[i]] = matches[i] + end + return results + end + end +end + +function server.route(options, handler) + local method = options.method + local path = options.path and compileRoute(options.path) + local host = options.host and compileGlob(options.host) + local filter = options.filter + server.use(function (req, res, go) + if method and req.method ~= method then return go() end + if host and not host(req.headers.host) then return go() end + if filter and not filter(req) then return go() end + local params + if path then + local pathname, query = req.path:match("^([^?]*)%??(.*)") + params = path(pathname) + if not params then return go() end + if #query > 0 then + req.query = parseQuery(query) + end + end + req.params = params or {} + return handler(req, res, go) + end) + return server +end + +return server diff --git a/plugins/weblit/auto-headers.lua b/plugins/weblit/auto-headers.lua new file mode 100644 index 00000000000..44ad65779e9 --- /dev/null +++ b/plugins/weblit/auto-headers.lua @@ -0,0 +1,92 @@ + + +--[[ + +Response automatic values: + - Auto Server header + - Auto Date Header + - code defaults to 404 with body "Not Found\n" + - if there is a string body add Content-Length and ETag if missing + - if string body and no Content-Type, use text/plain for valid utf-8, application/octet-stream otherwise + - Auto add "; charset=utf-8" to Content-Type when body is known to be valid utf-8 + - Auto 304 responses for if-none-match requests + - Auto strip body with HEAD requests + - Auto chunked encoding if body with unknown length + - if Connection header set and not keep-alive, set res.keepAlive to false + - Add Connection Keep-Alive/Close if not found based on res.keepAlive + +--TODO: utf8 scanning + +]] + +--local digest = require('openssl').digest.digest +local date = require('os').date + +return function (req, res, go) + local isHead = false + if req.method == "HEAD" then + req.method = "GET" + isHead = true + end + + local requested = req.headers["if-none-match"] + + go() + + -- We could use the fancy metatable, but this is much faster + local lowerHeaders = {} + local headers = res.headers + for i = 1, #headers do + local key, value = unpack(headers[i]) + lowerHeaders[key:lower()] = value + end + + + if not lowerHeaders.server then + headers[#headers + 1] = {"Server", serverName} + end + if not lowerHeaders.date then + headers[#headers + 1] = {"Date", date("!%a, %d %b %Y %H:%M:%S GMT")} + end + + if not lowerHeaders.connection then + if req.keepAlive then + lowerHeaders.connection = "Keep-Alive" + headers[#headers + 1] = {"Connection", "Keep-Alive"} + else + headers[#headers + 1] = {"Connection", "Close"} + end + end + res.keepAlive = lowerHeaders.connection and lowerHeaders.connection:lower() == "keep-alive" + + local body = res.body + if body then + local needLength = not lowerHeaders["content-length"] and not lowerHeaders["transfer-encoding"] + if type(body) == "string" then + if needLength then + headers[#headers + 1] = {"Content-Length", #body} + end + -- if not lowerHeaders.etag then + -- local etag = '"' .. digest("sha1", body) .. '"' + -- lowerHeaders.etag = etag + --headers[#headers + 1] = {"ETag", etag} + -- end + else + if needLength then + headers[#headers + 1] = {"Transfer-Encoding", "chunked"} + end + end + if not lowerHeaders["content-type"] then + headers[#headers + 1] = {"Content-Type", "text/plain"} + end + end + + local etag = lowerHeaders.etag + if requested and res.code >= 200 and res.code < 300 and requested == etag then + res.code = 304 + body = nil + end + + if isHead then body = nil end + res.body = body +end diff --git a/plugins/weblit/etag-cache.lua b/plugins/weblit/etag-cache.lua new file mode 100644 index 00000000000..e8c5d149b35 --- /dev/null +++ b/plugins/weblit/etag-cache.lua @@ -0,0 +1,39 @@ + +local function clone(headers) + local copy = setmetatable({}, getmetatable(headers)) + for i = 1, #headers do + copy[i] = headers[i] + end + return copy +end + +local cache = {} +return function (req, res, go) + local requested = req.headers["If-None-Match"] + local host = req.headers.Host + local key = host and host .. "|" .. req.path or req.path + local cached = cache[key] + if not requested and cached then + req.headers["If-None-Match"] = cached.etag + end + go() + local etag = res.headers.ETag + if not etag then return end + if res.code >= 200 and res.code < 300 then + local body = res.body + if not body or type(body) == "string" then + cache[key] = { + etag = etag, + code = res.code, + headers = clone(res.headers), + body = body + } + end + elseif res.code == 304 then + if not requested and cached and etag == cached.etag then + res.code = cached.code + res.headers = clone(cached.headers) + res.body = cached.body + end + end +end diff --git a/plugins/weblit/init.lua b/plugins/weblit/init.lua new file mode 100644 index 00000000000..f9224b7880c --- /dev/null +++ b/plugins/weblit/init.lua @@ -0,0 +1,8 @@ +local exports = {} +exports.app = require('weblit/app') +exports.autoHeaders = require('weblit/auto-headers') +exports.etagCache = require('weblit/etag-cache') +exports.logger = require('weblit/logger') +exports.static = require('weblit/static') +exports.websocket = require('weblit/websocket') +return exports diff --git a/plugins/weblit/logger.lua b/plugins/weblit/logger.lua new file mode 100644 index 00000000000..912b4eed768 --- /dev/null +++ b/plugins/weblit/logger.lua @@ -0,0 +1,10 @@ + +return function (req, res, go) + -- Skip this layer for clients who don't send User-Agent headers. + local userAgent = req.headers["user-agent"] + if not userAgent then return go() end + -- Run all inner layers first. + go() + -- And then log after everything is done + --print(string.format("%s %s %s %s", req.method, req.path, userAgent, res.code)) +end diff --git a/plugins/weblit/static.lua b/plugins/weblit/static.lua new file mode 100644 index 00000000000..b34ea638fa1 --- /dev/null +++ b/plugins/weblit/static.lua @@ -0,0 +1,62 @@ + +local getType = require("mime").getType +local jsonStringify = require('json').stringify + +local makeChroot = require('coro-fs').chroot + +return function (rootPath) + + local fs = makeChroot(rootPath) + + return function (req, res, go) + if req.method ~= "GET" then return go() end + local path = (req.params and req.params.path) or req.path + path = path:match("^[^?#]*") + if path:byte(1) == 47 then + path = path:sub(2) + end + local stat = fs.stat(path) + if not stat then return go() end + + local function renderFile() + local body = assert(fs.readFile(path)) + res.code = 200 + res.headers["Content-Type"] = getType(path) + res.body = body + return + end + + local function renderDirectory() + if req.path:byte(-1) ~= 47 then + res.code = 301 + res.headers.Location = req.path .. '/' + return + end + local files = {} + for entry in fs.scandir(path) do + if entry.name == "index.html" and entry.type == "file" then + path = (#path > 0 and path .. "/" or "") .. "index.html" + return renderFile() + end + files[#files + 1] = entry + entry.url = "http://" .. req.headers.host .. req.path .. entry.name + end + local body = jsonStringify(files) .. "\n" + res.code = 200 + res.headers["Content-Type"] = "application/json" + res.body = body + return + end + + if stat.type == "directory" then + return renderDirectory() + elseif stat.type == "file" then + if req.path:byte(-1) == 47 then + res.code = 301 + res.headers.Location = req.path:match("^(.*[^/])/+$") + return + end + return renderFile() + end + end +end diff --git a/plugins/weblit/websocket.lua b/plugins/weblit/websocket.lua new file mode 100644 index 00000000000..d5dfe572ea6 --- /dev/null +++ b/plugins/weblit/websocket.lua @@ -0,0 +1,82 @@ + +local websocketCodec = require('websocket-codec') + +local function websocketHandler(options, handler) + return function (req, res, go) + -- Websocket connections must be GET requests + -- with 'Upgrade: websocket' + -- and 'Connection: Upgrade' headers + local headers = req.headers + local connection = headers.connection + local upgrade = headers.upgrade + if not ( + req.method == "GET" and + upgrade and upgrade:lower():find("websocket", 1, true) and + connection and connection:lower():find("upgrade", 1, true) + ) then + return go() + end + + if options.filter and not options.filter(req) then + return go() + end + + -- If there is a sub-protocol specified, filter on it. + local protocol = options.protocol + if protocol then + local list = headers["sec-websocket-protocol"] + local foundProtocol + if list then + for item in list:gmatch("[^, ]+") do + if item == protocol then + foundProtocol = true + break + end + end + end + if not foundProtocol then + return go() + end + end + + -- Make sure it's a new client speaking v13 of the protocol + assert(tonumber(headers["sec-websocket-version"]) >= 13, "only websocket protocol v13 supported") + + -- Get the security key + local key = assert(headers["sec-websocket-key"], "websocket security required") + + res.code = 101 + headers = res.headers + headers.Upgrade = "websocket" + headers.Connection = "Upgrade" + headers["Sec-WebSocket-Accept"] = websocketCodec.acceptKey(key) + if protocol then + headers["Sec-WebSocket-Protocol"] = protocol + end + function res.upgrade(read, write, updateDecoder, updateEncoder) + updateDecoder(websocketCodec.decode) + updateEncoder(websocketCodec.encode) + local success, err = pcall(handler, req, read, write) + if not success then + print(err) + write({ + opcode = 1, + payload = err, + }) + return write() + end + end + end +end + +local server = require('weblit-app') +function server.websocket(options, handler) + server.route({ + method = "GET", + path = options.path, + host = options.host, + }, websocketHandler(options, handler)) + return server +end + +return websocketHandler diff --git a/plugins/websocket-codec/LICENSE b/plugins/websocket-codec/LICENSE new file mode 100644 index 00000000000..5789b767285 --- /dev/null +++ b/plugins/websocket-codec/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tim Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/plugins/websocket-codec/README.md b/plugins/websocket-codec/README.md new file mode 100644 index 00000000000..50f41340dce --- /dev/null +++ b/plugins/websocket-codec/README.md @@ -0,0 +1,2 @@ +# luv-websocket-codec +A luv port of lit's websocket codec diff --git a/plugins/websocket-codec/init.lua b/plugins/websocket-codec/init.lua new file mode 100644 index 00000000000..8a7da7f9190 --- /dev/null +++ b/plugins/websocket-codec/init.lua @@ -0,0 +1,261 @@ +local exports = {} + +exports.name = "creationix/websocket-codec" +exports.version = "1.0.7" +exports.homepage = "https://github.com/luvit/lit/blob/master/deps/websocket-codec.lua" +exports.description = "A codec implementing websocket framing and helpers for handshakeing" +exports.tags = {"http", "websocket", "codec"} +exports.license = "MIT" +exports.author = { name = "Tim Caswell" } + +local digest = require('openssl').digest.digest +local base64 = require('openssl').base64 +local random = require('openssl').random +local bit = require('bit') + +local band = bit.band +local bor = bit.bor +local bxor = bit.bxor +local rshift = bit.rshift +local lshift = bit.lshift +local char = string.char +local byte = string.byte +local sub = string.sub +local gmatch = string.gmatch +local lower = string.lower +local gsub = string.gsub +local concat = table.concat + +local function applyMask(data, mask) + local bytes = { + [0] = byte(mask, 1), + [1] = byte(mask, 2), + [2] = byte(mask, 3), + [3] = byte(mask, 4) + } + local out = {} + for i = 1, #data do + out[i] = char( + bxor(byte(data, i), bytes[(i - 1) % 4]) + ) + end + return concat(out) +end + +function exports.decode(chunk) + if #chunk < 2 then return end + local second = byte(chunk, 2) + local len = band(second, 0x7f) + local offset + if len == 126 then + if #chunk < 4 then return end + len = bor( + lshift(byte(chunk, 3), 8), + byte(chunk, 4)) + offset = 4 + elseif len == 127 then + if #chunk < 10 then return end + len = bor( + lshift(byte(chunk, 3), 56), + lshift(byte(chunk, 4), 48), + lshift(byte(chunk, 5), 40), + lshift(byte(chunk, 6), 32), + lshift(byte(chunk, 7), 24), + lshift(byte(chunk, 8), 16), + lshift(byte(chunk, 9), 8), + byte(chunk, 10)) + offset = 10 + else + offset = 2 + end + local mask = band(second, 0x80) > 0 + if mask then + offset = offset + 4 + end + if #chunk < offset + len then return end + + local first = byte(chunk, 1) + local payload = sub(chunk, offset + 1, offset + len) + assert(#payload == len, "Length mismatch") + if mask then + payload = applyMask(payload, sub(chunk, offset - 3, offset)) + end + local extra = sub(chunk, offset + len + 1) + return { + fin = band(first, 0x80) > 0, + rsv1 = band(first, 0x40) > 0, + rsv2 = band(first, 0x20) > 0, + rsv3 = band(first, 0x10) > 0, + opcode = band(first, 0xf), + mask = mask, + len = len, + payload = payload + }, extra +end + +function exports.encode(item) + if type(item) == "string" then + item = { + opcode = 2, + payload = item + } + end + local payload = item.payload + assert(type(payload) == "string", "payload must be string") + local len = #payload + local fin = item.fin + if fin == nil then fin = true end + local rsv1 = item.rsv1 + local rsv2 = item.rsv2 + local rsv3 = item.rsv3 + local opcode = item.opcode or 2 + local mask = item.mask + local chars = { + char(bor( + fin and 0x80 or 0, + rsv1 and 0x40 or 0, + rsv2 and 0x20 or 0, + rsv3 and 0x10 or 0, + opcode + )), + char(bor( + mask and 0x80 or 0, + len < 126 and len or (len < 0x10000) and 126 or 127 + )) + } + if len >= 0x10000 then + chars[3] = char(band(rshift(len, 56), 0xff)) + chars[4] = char(band(rshift(len, 48), 0xff)) + chars[5] = char(band(rshift(len, 40), 0xff)) + chars[6] = char(band(rshift(len, 32), 0xff)) + chars[7] = char(band(rshift(len, 24), 0xff)) + chars[8] = char(band(rshift(len, 16), 0xff)) + chars[9] = char(band(rshift(len, 8), 0xff)) + chars[10] = char(band(len, 0xff)) + elseif len >= 126 then + chars[3] = char(band(rshift(len, 8), 0xff)) + chars[4] = char(band(len, 0xff)) + end + if mask then + local key = random(4) + return concat(chars) .. key .. applyMask(payload, key) + end + return concat(chars) .. payload +end + +local websocketGuid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" + +function exports.acceptKey(key) + return gsub(base64(digest("sha1", key .. websocketGuid, true)), "\n", "") +end +local acceptKey = exports.acceptKey + +-- Make a client handshake connection +function exports.handshake(options, request) + local key = gsub(base64(random(20)), "\n", "") + local host = options.host + local path = options.path or "/" + local protocol = options.protocol + local req = { + method = "GET", + path = path, + {"Connection", "Upgrade"}, + {"Upgrade", "websocket"}, + {"Sec-WebSocket-Version", "13"}, + {"Sec-WebSocket-Key", key}, + } + for i = 1, #options do + req[#req + 1] = options[i] + end + if host then + req[#req + 1] = {"Host", host} + end + if protocol then + req[#req + 1] = {"Sec-WebSocket-Protocol", protocol} + end + local res = request(req) + if not res then + return nil, "Missing response from server" + end + -- Parse the headers for quick reading + if res.code ~= 101 then + return nil, "response must be code 101" + end + + local headers = {} + for i = 1, #res do + local name, value = unpack(res[i]) + headers[lower(name)] = value + end + + if not headers.connection or lower(headers.connection) ~= "upgrade" then + return nil, "Invalid or missing connection upgrade header in response" + end + if headers["sec-websocket-accept"] ~= acceptKey(key) then + return nil, "challenge key missing or mismatched" + end + if protocol and headers["sec-websocket-protocol"] ~= protocol then + return nil, "protocol missing or mistmatched" + end + return true +end + +function exports.handleHandshake(head, protocol) + + -- WebSocket connections must be GET requests + if not head.method == "GET" then return end + + -- Parse the headers for quick reading + local headers = {} + for i = 1, #head do + local name, value = unpack(head[i]) + headers[lower(name)] = value + end + + -- Must have 'Upgrade: websocket' and 'Connection: Upgrade' headers + if not (headers.connection and headers.upgrade and + headers.connection:lower():find("upgrade", 1, true) and + headers.upgrade:lower():find("websocket", 1, true)) then return end + + -- Make sure it's a new client speaking v13 of the protocol + if tonumber(headers["sec-websocket-version"]) < 13 then + return nil, "only websocket protocol v13 supported" + end + + local key = headers["sec-websocket-key"] + if not key then + return nil, "websocket security key missing" + end + + -- If the server wants a specified protocol, check for it. + if protocol then + local foundProtocol = false + local list = headers["sec-websocket-protocol"] + if list then + for item in gmatch(list, "[^, ]+") do + if item == protocol then + foundProtocol = true + break + end + end + end + if not foundProtocol then + return nil, "specified protocol missing in request" + end + end + + local accept = acceptKey(key) + + local res = { + code = 101, + {"Upgrade", "websocket"}, + {"Connection", "Upgrade"}, + {"Sec-WebSocket-Accept", accept}, + } + if protocol then + res[#res + 1] = {"Sec-WebSocket-Protocol", protocol} + end + + return res +end +return exports diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 293657b1f45..c4686c5566f 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -19,6 +19,7 @@ #include "uiinput.h" #include "xmlfile.h" #include "coreutil.h" +#include "luaengine.h" #include @@ -1928,6 +1929,8 @@ void device_debug::instruction_hook(offs_t curpc) // flush any pending updates before waiting again machine.debug_view().flush_osd_updates(); + machine.manager().lua()->periodic_check(); + // clear the memory modified flag and wait global->memory_modified = false; if (machine.debug_flags & DEBUG_FLAG_OSD_ENABLED) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index f5d014750b2..97e107ebb49 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -43,6 +43,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_FONTPATH, ".", OPTION_STRING, "path to font files" }, { OPTION_CHEATPATH, "cheat", OPTION_STRING, "path to cheat files" }, { OPTION_CROSSHAIRPATH, "crosshair", OPTION_STRING, "path to crosshair files" }, + { OPTION_PLUGINSPATH, "plugins", OPTION_STRING, "path to plugin files" }, // output directory options { nullptr, nullptr, OPTION_HEADER, "CORE OUTPUT DIRECTORY OPTIONS" }, diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index 916a0f263f5..c8bbc58435a 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -56,6 +56,7 @@ enum #define OPTION_FONTPATH "fontpath" #define OPTION_CHEATPATH "cheatpath" #define OPTION_CROSSHAIRPATH "crosshairpath" +#define OPTION_PLUGINSPATH "pluginspath" // core directory options #define OPTION_CFG_DIRECTORY "cfg_directory" @@ -231,6 +232,7 @@ public: const char *font_path() const { return value(OPTION_FONTPATH); } const char *cheat_path() const { return value(OPTION_CHEATPATH); } const char *crosshair_path() const { return value(OPTION_CROSSHAIRPATH); } + const char *plugins_path() const { return value(OPTION_PLUGINSPATH); } // core directory options const char *cfg_directory() const { return value(OPTION_CFG_DIRECTORY); } diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index 7c59ef69a2d..5119dec397c 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -387,8 +387,10 @@ int running_machine::run(bool firstrun) // execute CPUs if not paused if (!m_paused) + { m_scheduler.timeslice(); - + manager().lua()->periodic_check(); + } // otherwise, just pump video updates through else m_video->frame_update(); diff --git a/src/emu/mame.cpp b/src/emu/mame.cpp index f17c04e3b68..55fc78928f8 100644 --- a/src/emu/mame.cpp +++ b/src/emu/mame.cpp @@ -167,6 +167,15 @@ int machine_manager::execute() int error = MAMERR_NONE; m_lua->initialize(); + { + emu_file file(options().plugins_path(), OPEN_FLAG_READ); + file_error filerr = file.open("boot.lua"); + if (filerr == FILERR_NONE) + { + m_lua->load_script(file.fullpath()); + } + } + if (m_options.console()) { m_lua->start_console(); } -- cgit v1.2.3-70-g09d2 From 618a7d4d283bb2b139b56d029cb09b750b3ba90a Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 14 Feb 2016 11:20:49 +0100 Subject: initialize LUA bit earlier to give more opportunities to scripts (nw) --- src/emu/clifront.cpp | 7 +++++-- src/emu/mame.cpp | 24 ++++++++++++++---------- src/emu/mame.h | 1 + 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/emu/clifront.cpp b/src/emu/clifront.cpp index a016d13a031..0679d419099 100644 --- a/src/emu/clifront.cpp +++ b/src/emu/clifront.cpp @@ -99,6 +99,8 @@ int cli_frontend::execute(int argc, char **argv) { // wrap the core execution in a try/catch to field all fatal errors m_result = MAMERR_NONE; + machine_manager *manager = machine_manager::instance(m_options, m_osd); + try { // first parse options to be able to get software from it @@ -106,6 +108,8 @@ int cli_frontend::execute(int argc, char **argv) m_options.parse_command_line(argc, argv, option_errors); m_options.parse_standard_inis(option_errors); + + manager->start_luaengine(); if (*(m_options.software_name()) != 0) { @@ -211,9 +215,7 @@ int cli_frontend::execute(int argc, char **argv) throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name()); // otherwise just run the game - machine_manager *manager = machine_manager::instance(m_options, m_osd); m_result = manager->execute(); - global_free(manager); } } @@ -264,6 +266,7 @@ int cli_frontend::execute(int argc, char **argv) } _7z_file_cache_clear(); + global_free(manager); return m_result; } diff --git a/src/emu/mame.cpp b/src/emu/mame.cpp index 55fc78928f8..813455e0b8d 100644 --- a/src/emu/mame.cpp +++ b/src/emu/mame.cpp @@ -151,6 +151,20 @@ void machine_manager::update_machine() m_lua->set_machine(m_machine); } + +void machine_manager::start_luaengine() +{ + m_lua->initialize(); + { + emu_file file(options().plugins_path(), OPEN_FLAG_READ); + file_error filerr = file.open("boot.lua"); + if (filerr == FILERR_NONE) + { + m_lua->load_script(file.fullpath()); + } + } +} + /*------------------------------------------------- execute - run the core emulation -------------------------------------------------*/ @@ -166,16 +180,6 @@ int machine_manager::execute() bool exit_pending = false; int error = MAMERR_NONE; - m_lua->initialize(); - { - emu_file file(options().plugins_path(), OPEN_FLAG_READ); - file_error filerr = file.open("boot.lua"); - if (filerr == FILERR_NONE) - { - m_lua->load_script(file.fullpath()); - } - } - if (m_options.console()) { m_lua->start_console(); } diff --git a/src/emu/mame.h b/src/emu/mame.h index eb2f510c114..fb490f80859 100644 --- a/src/emu/mame.h +++ b/src/emu/mame.h @@ -96,6 +96,7 @@ public: /* execute as configured by the OPTION_SYSTEMNAME option on the specified options */ int execute(); + void start_luaengine(); void schedule_new_driver(const game_driver &driver); private: osd_interface & m_osd; // reference to OSD system -- cgit v1.2.3-70-g09d2 From b60187faa2604b64e18f2b7d597796446f121e53 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 14 Feb 2016 15:29:12 +0100 Subject: Added multiple callback registration for lua scripts (nw) --- src/emu/luaengine.cpp | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/emu/luaengine.h | 14 +++++++ 2 files changed, 117 insertions(+) diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index dbf3d383093..c7ecdc81c3a 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -926,6 +926,98 @@ lua_engine::~lua_engine() close(); } +void lua_engine::execute_function(const char *id) +{ + lua_settop(m_lua_state, 0); + lua_getfield(m_lua_state, LUA_REGISTRYINDEX, id); + + if (lua_istable(m_lua_state, -1)) + { + lua_pushnil(m_lua_state); + while (lua_next(m_lua_state, -2) != 0) + { + if (lua_isfunction(m_lua_state, -1)) + { + lua_pcall(m_lua_state, 0, 0, 0); + } + else + { + lua_pop(m_lua_state, 1); + } + } + } +} + +int lua_engine::register_function(lua_State *L, const char *id) +{ + if (!lua_isnil(L, 1)) + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, 1); + lua_getfield(L, LUA_REGISTRYINDEX, id); + if (lua_isnil(L, -1)) + { + lua_newtable(L); + } + luaL_checktype(L, -1, LUA_TTABLE); + int len = lua_rawlen(L, -1); + lua_pushnumber(L, len + 1); + lua_pushvalue(L, 1); + lua_rawset(L, -3); /* Stores the pair in the table */ + + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, id); + return 1; +} + +int lua_engine::l_emu_register_start(lua_State *L) +{ + return register_function(L, "LUA_ON_START"); +} + +int lua_engine::l_emu_register_stop(lua_State *L) +{ + return register_function(L, "LUA_ON_STOP"); +} + +int lua_engine::l_emu_register_pause(lua_State *L) +{ + return register_function(L, "LUA_ON_PAUSE"); +} + +int lua_engine::l_emu_register_resume(lua_State *L) +{ + return register_function(L, "LUA_ON_RESUME"); +} + +int lua_engine::l_emu_register_frame(lua_State *L) +{ + return register_function(L, "LUA_ON_FRAME"); +} + +void lua_engine::on_machine_start() +{ + execute_function("LUA_ON_START"); +} + +void lua_engine::on_machine_stop() +{ + execute_function("LUA_ON_STOP"); +} + +void lua_engine::on_machine_pause() +{ + execute_function("LUA_ON_PAUSE"); +} + +void lua_engine::on_machine_resume() +{ + execute_function("LUA_ON_RESUME"); +} + +void lua_engine::on_machine_frame() +{ + execute_function("LUA_ON_FRAME"); +} void lua_engine::update_machine() { @@ -945,10 +1037,16 @@ void lua_engine::update_machine() } port = port->next(); } + machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(lua_engine::on_machine_start), this)); + machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(lua_engine::on_machine_stop), this)); + machine().add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(lua_engine::on_machine_pause), this)); + machine().add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(FUNC(lua_engine::on_machine_resume), this)); + machine().add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(lua_engine::on_machine_frame), this)); } lua_setglobal(m_lua_state, "ioport"); } + //------------------------------------------------- // initialize - initialize lua hookup to emu engine //------------------------------------------------- @@ -971,6 +1069,11 @@ void lua_engine::initialize() .addCFunction ("start", l_emu_start ) .addCFunction ("pause", l_emu_pause ) .addCFunction ("unpause", l_emu_unpause ) + .addCFunction ("register_start", l_emu_register_start ) + .addCFunction ("register_stop", l_emu_register_stop ) + .addCFunction ("register_pause", l_emu_register_pause ) + .addCFunction ("register_resume",l_emu_register_resume ) + .addCFunction ("register_frame", l_emu_register_frame ) .beginClass ("manager") .addFunction ("machine", &machine_manager::machine) .addFunction ("options", &machine_manager::options) diff --git a/src/emu/luaengine.h b/src/emu/luaengine.h index 9bc6275100e..37660a28201 100644 --- a/src/emu/luaengine.h +++ b/src/emu/luaengine.h @@ -45,6 +45,7 @@ public: void serve_lua(); void periodic_check(); bool frame_hook(); + void execute_function(const char *id); void resume(lua_State *L, int nparam = 0, lua_State *root = nullptr); void set_machine(running_machine *machine) { m_machine = machine; update_machine(); } @@ -78,6 +79,13 @@ private: running_machine &machine() const { return *m_machine; } void update_machine(); + + void on_machine_start(); + void on_machine_stop(); + void on_machine_pause(); + void on_machine_resume(); + void on_machine_frame(); + void output_notifier(const char *outname, INT32 value); static void s_output_notifier(const char *outname, INT32 value, void *param); @@ -102,6 +110,12 @@ private: static int l_emu_pause(lua_State *L); static int l_emu_unpause(lua_State *L); static int l_emu_set_hook(lua_State *L); + static int l_emu_register_start(lua_State *L); + static int l_emu_register_stop(lua_State *L); + static int l_emu_register_pause(lua_State *L); + static int l_emu_register_resume(lua_State *L); + static int l_emu_register_frame(lua_State *L); + static int register_function(lua_State *L, const char *id); // "emu.machine" namespace static luabridge::LuaRef l_machine_get_devices(const running_machine *r); -- cgit v1.2.3-70-g09d2 From 5a31d8513b9bc63637aa50bffb59d4ce1c246029 Mon Sep 17 00:00:00 2001 From: arbee Date: Sun, 14 Feb 2016 09:40:07 -0500 Subject: New machines added as MACHINE_NOT_WORKING ----------------------------------------- Wangan Midnight R (WMR1 Ver. A) [Darksoft, Guru, R. Belmont] --- src/mame/arcade.lst | 1 + src/mame/drivers/namcops2.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index ad56461db61..b4c9df0bb41 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -1107,6 +1107,7 @@ tekken4 tekken4a tekken4b tekken4c +wanganmr prdgp03 timecrs3 timecrs3e diff --git a/src/mame/drivers/namcops2.cpp b/src/mame/drivers/namcops2.cpp index a0eec46f766..d53c83c3085 100644 --- a/src/mame/drivers/namcops2.cpp +++ b/src/mame/drivers/namcops2.cpp @@ -1461,6 +1461,18 @@ ROM_START( wanganmd ) DISK_IMAGE_READONLY( "wmn1-a", 0, SHA1(4254e987e71d0d4038a87f11dc1a304396b3dffc) ) ROM_END +ROM_START( wanganmr ) + ROM_REGION(0x200000, "bios", 0) + SYSTEM246_BIOS + + ROM_REGION(0x840000, "key", ROMREGION_ERASE00) + ROM_LOAD( "wmr1vera.ic002", 0x000000, 0x800000, CRC(b431936b) SHA1(e2c543936cb5689a432662a69d0042c6179a3728) ) + ROM_LOAD( "wmr1vera_spr.ic002", 0x800000, 0x040000, CRC(b8b7539c) SHA1(f415bdc8e3ebf3b0c3d0d7607b894440e89b0fe7) ) + + DISK_REGION("dvd") // actually single-track CD-ROM + DISK_IMAGE_READONLY( "wmr1-a", 0, SHA1(02feab4380dcc2dd95c85b209192f858bafc721e) ) +ROM_END + ROM_START( vnight ) ROM_REGION(0x200000, "bios", 0) SYSTEM246_BIOS @@ -1585,6 +1597,7 @@ GAME(2002, tekken4, sys246, system246, system246, driver_device, 0, ROT0, "Na GAME(2002, tekken4a, tekken4, system246, system246, driver_device, 0, ROT0, "Namco", "Tekken 4 (TEF2 Ver. A)", MACHINE_IS_SKELETON) GAME(2002, tekken4b, tekken4, system246, system246, driver_device, 0, ROT0, "Namco", "Tekken 4 (TEF1 Ver. A)", MACHINE_IS_SKELETON) GAME(2002, tekken4c, tekken4, system246, system246, driver_device, 0, ROT0, "Namco", "Tekken 4 (TEF1 Ver. C)", MACHINE_IS_SKELETON) +GAME(2002, wanganmr, sys246, system246, system246, driver_device, 0, ROT0, "Namco", "Wangan Midnight R (WMR1 Ver. A)", MACHINE_IS_SKELETON) GAME(2003, prdgp03, sys246, system246, system246, driver_device, 0, ROT0, "Namco", "Pride GP 2003 (PR21 Ver. A)", MACHINE_IS_SKELETON) GAME(2003, timecrs3, sys246, system246, system246, driver_device, 0, ROT0, "Namco", "Time Crisis 3 (TST1)", MACHINE_IS_SKELETON) GAME(2003, timecrs3e,timecrs3, system246, system246, driver_device, 0, ROT0, "Namco", "Time Crisis 3 (TST2 Ver. A)", MACHINE_IS_SKELETON) -- cgit v1.2.3-70-g09d2 From 686ba42466ca46f9e49f13d45ae9a225aa2dbe51 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 14 Feb 2016 19:48:44 +0100 Subject: Added plugin info json files and made system automatically load available plugins and start them if flagged so (nw) --- plugins/boot.lua | 38 ++++++++++++++++++------------------- plugins/coro-channel/plugin.json | 8 ++++++++ plugins/coro-fs/plugin.json | 8 ++++++++ plugins/coro-http/plugin.json | 8 ++++++++ plugins/coro-net/plugin.json | 8 ++++++++ plugins/coro-tls/plugin.json | 8 ++++++++ plugins/coro-wrapper/plugin.json | 8 ++++++++ plugins/dummy/init.lua | 20 +++++++++++++++++++ plugins/dummy/plugin.json | 9 +++++++++ plugins/http-codec/plugin.json | 8 ++++++++ plugins/json/plugin.json | 8 ++++++++ plugins/mime/plugin.json | 8 ++++++++ plugins/path/plugin.json | 8 ++++++++ plugins/pretty-print/plugin.json | 8 ++++++++ plugins/querystring/plugin.json | 8 ++++++++ plugins/weblit/plugin.json | 8 ++++++++ plugins/webserver/init.lua | 34 +++++++++++++++++++++++++++++++++ plugins/webserver/plugin.json | 9 +++++++++ plugins/websocket-codec/plugin.json | 8 ++++++++ 19 files changed, 202 insertions(+), 20 deletions(-) create mode 100644 plugins/coro-channel/plugin.json create mode 100644 plugins/coro-fs/plugin.json create mode 100644 plugins/coro-http/plugin.json create mode 100644 plugins/coro-net/plugin.json create mode 100644 plugins/coro-tls/plugin.json create mode 100644 plugins/coro-wrapper/plugin.json create mode 100644 plugins/dummy/init.lua create mode 100644 plugins/dummy/plugin.json create mode 100644 plugins/http-codec/plugin.json create mode 100644 plugins/json/plugin.json create mode 100644 plugins/mime/plugin.json create mode 100644 plugins/path/plugin.json create mode 100644 plugins/pretty-print/plugin.json create mode 100644 plugins/querystring/plugin.json create mode 100644 plugins/weblit/plugin.json create mode 100644 plugins/webserver/init.lua create mode 100644 plugins/webserver/plugin.json create mode 100644 plugins/websocket-codec/plugin.json diff --git a/plugins/boot.lua b/plugins/boot.lua index e6cdde58004..4f8c6a0ee96 100644 --- a/plugins/boot.lua +++ b/plugins/boot.lua @@ -1,26 +1,24 @@ +require('lfs') local uv = require('luv') local cwd = uv.cwd() package.path = cwd .. "/plugins/?.lua;" .. cwd .. "/plugins/?/init.lua" -require('weblit/app') +local json = require('json') +function readAll(file) + local f = io.open(file, "rb") + local content = f:read("*all") + f:close() + return content +end - .bind({ - host = "0.0.0.0", - port = 8080 - }) - - .use(require('weblit/logger')) - .use(require('weblit/auto-headers')) - .use(require('weblit/etag-cache')) - - .route({ - method = "GET", - path = "/", - }, function (req, res, go) - res.code = 200 - res.headers["Content-Type"] = "text/html" - res.body = "

Hello!

\n" - end) - - .start() +for file in lfs.dir("plugins") do + if (file~="." and file~=".." and lfs.attributes("plugins/" .. file,"mode")=="directory") then + local filename = "plugins/" .. file .. "/plugin.json" + local meta = json.parse(readAll(filename)) + if (meta["plugin"]["type"]=="plugin") and (meta["plugin"]["start"]=="true") then + server = require(meta["plugin"]["name"]) + server.startplugin(); + end + end +end diff --git a/plugins/coro-channel/plugin.json b/plugins/coro-channel/plugin.json new file mode 100644 index 00000000000..5a3f5af8813 --- /dev/null +++ b/plugins/coro-channel/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "coro-channel", + "version": "1.2.0", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/coro-fs/plugin.json b/plugins/coro-fs/plugin.json new file mode 100644 index 00000000000..c35d9e27315 --- /dev/null +++ b/plugins/coro-fs/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "coro-fs", + "version": "1.3.0", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/coro-http/plugin.json b/plugins/coro-http/plugin.json new file mode 100644 index 00000000000..0c8047c9ebe --- /dev/null +++ b/plugins/coro-http/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "coro-http", + "version": "1.2.1-1", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/coro-net/plugin.json b/plugins/coro-net/plugin.json new file mode 100644 index 00000000000..cf839aad881 --- /dev/null +++ b/plugins/coro-net/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "coro-net", + "version": "1.1.1-1", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/coro-tls/plugin.json b/plugins/coro-tls/plugin.json new file mode 100644 index 00000000000..257224e2ea3 --- /dev/null +++ b/plugins/coro-tls/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "coro-tls", + "version": "1.2.1", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/coro-wrapper/plugin.json b/plugins/coro-wrapper/plugin.json new file mode 100644 index 00000000000..6075edba1fa --- /dev/null +++ b/plugins/coro-wrapper/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "coro-wrapper", + "version": "1.0.0-1", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/dummy/init.lua b/plugins/dummy/init.lua new file mode 100644 index 00000000000..8c4fbe6a0f5 --- /dev/null +++ b/plugins/dummy/init.lua @@ -0,0 +1,20 @@ +local exports = {} +exports.name = "dummy" +exports.version = "0.0.1" +exports.description = "A dummy example" +exports.license = "MIT" +exports.author = { name = "Miodrag Milanovic" } + +local dummy = exports + +function dummy.startplugin() + emu.register_start(function() + print("Starting " .. emu.gamename()) + end) + + emu.register_stop(function() + print("Exiting " .. emu.gamename()) + end) +end + +return exports diff --git a/plugins/dummy/plugin.json b/plugins/dummy/plugin.json new file mode 100644 index 00000000000..4d877fa4dfa --- /dev/null +++ b/plugins/dummy/plugin.json @@ -0,0 +1,9 @@ +{ + "plugin": { + "name": "dummy", + "version": "0.0.1", + "author": "Miodrag Milanovic", + "type": "plugin", + "start": "false", + } +} \ No newline at end of file diff --git a/plugins/http-codec/plugin.json b/plugins/http-codec/plugin.json new file mode 100644 index 00000000000..ce511afa785 --- /dev/null +++ b/plugins/http-codec/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "http-codec", + "version": "1.0.0-1", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/json/plugin.json b/plugins/json/plugin.json new file mode 100644 index 00000000000..c5a0c77355d --- /dev/null +++ b/plugins/json/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "json", + "version": "2.5.0", + "author": "David Kolf", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/mime/plugin.json b/plugins/mime/plugin.json new file mode 100644 index 00000000000..ee55fd559b3 --- /dev/null +++ b/plugins/mime/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "mime", + "version": "0.1.2-1", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/path/plugin.json b/plugins/path/plugin.json new file mode 100644 index 00000000000..c88de67d77c --- /dev/null +++ b/plugins/path/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "path", + "version": "1.0.0", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/pretty-print/plugin.json b/plugins/pretty-print/plugin.json new file mode 100644 index 00000000000..556608c8dd6 --- /dev/null +++ b/plugins/pretty-print/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "pretty-print", + "version": "1.0.3", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/querystring/plugin.json b/plugins/querystring/plugin.json new file mode 100644 index 00000000000..ddd3cc4291e --- /dev/null +++ b/plugins/querystring/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "querystring", + "version": "1.0.2", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/weblit/plugin.json b/plugins/weblit/plugin.json new file mode 100644 index 00000000000..69dd45ccc0e --- /dev/null +++ b/plugins/weblit/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "weblit", + "version": "1.0.0", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file diff --git a/plugins/webserver/init.lua b/plugins/webserver/init.lua new file mode 100644 index 00000000000..3d68b01e6d5 --- /dev/null +++ b/plugins/webserver/init.lua @@ -0,0 +1,34 @@ +local exports = {} +exports.name = "webserver" +exports.version = "1.0.0" +exports.description = "A simple web server" +exports.license = "MIT" +exports.author = { name = "Miodrag Milanovic" } + +local ws = exports + +local app = require('weblit/app') + +function ws.startplugin() + app.bind({ + host = "0.0.0.0", + port = 8080 + }) + + app.use(require('weblit/logger')) + app.use(require('weblit/auto-headers')) + app.use(require('weblit/etag-cache')) + + app.route({ + method = "GET", + path = "/", + }, function (req, res, go) + res.code = 200 + res.headers["Content-Type"] = "text/html" + res.body = "

Hello!

\n" + end) + + app.start() +end + +return exports diff --git a/plugins/webserver/plugin.json b/plugins/webserver/plugin.json new file mode 100644 index 00000000000..e420a5d5485 --- /dev/null +++ b/plugins/webserver/plugin.json @@ -0,0 +1,9 @@ +{ + "plugin": { + "name": "webserver", + "version": "1.0.0", + "author": "Miodrag Milanovic", + "type": "plugin", + "start": "false", + } +} \ No newline at end of file diff --git a/plugins/websocket-codec/plugin.json b/plugins/websocket-codec/plugin.json new file mode 100644 index 00000000000..00a49dbcba3 --- /dev/null +++ b/plugins/websocket-codec/plugin.json @@ -0,0 +1,8 @@ +{ + "plugin": { + "name": "websocket-codec", + "version": "1.0.7", + "author": "Tim Caswell", + "type": "library", + } +} \ No newline at end of file -- cgit v1.2.3-70-g09d2 From bb5edbc987495bb62c588e06c22030cf94803097 Mon Sep 17 00:00:00 2001 From: Sandro Ronco Date: Sun, 14 Feb 2016 22:04:17 +0100 Subject: snotec.xml: added 3 new cart dumps. [TeamEurope] --- hash/snotec.xml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/hash/snotec.xml b/hash/snotec.xml index 2873bd4f522..b34d3410bf3 100644 --- a/hash/snotec.xml +++ b/hash/snotec.xml @@ -72,4 +72,42 @@
+ + + Challenge Audition + 1998 + Bandai + + + + + + + + + + + Detective Conan + 1996 + Bandai + + + + + + + + + Magical Fortune + 1996 + Bandai + + + + + + + + + -- cgit v1.2.3-70-g09d2 From 94f44bbcea731903d6cd839f1646b5bea0be7b3b Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 15 Feb 2016 00:44:39 +0100 Subject: New working machine added ------------------------ Elite Avant Garde (model 6114) [hap, Micha] --- src/mame/drivers/fidel6502.cpp | 56 +++--- src/mame/drivers/fidel68k.cpp | 203 ++++++++++++++++++-- src/mame/drivers/fidelz80.cpp | 94 ++++----- src/mame/layout/fidel_eag.lay | 420 ++++++++++++++++++++++++++++++++++++++++- src/mame/layout/fidel_fev.lay | 3 +- 5 files changed, 683 insertions(+), 93 deletions(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index c331937fab4..1f28dd87b66 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -721,28 +721,28 @@ static INPUT_PORTS_START( sc12 ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h8") PORT_START("IN.8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV / Pawn") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM / Knight") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TB / Bishop") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV / Rook") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PV / Queen") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PB / King") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("RV/Pawn") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("DM/Knight") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("TB/Bishop") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("LV/Rook") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("PV/Queen") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("PB/King") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("CL") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("RE") INPUT_PORTS_END static INPUT_PORTS_START( fexcel ) PORT_INCLUDE( sc12 ) PORT_MODIFY("IN.8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Clear") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Move / Pawn") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Hint / Knight") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Take Back / Bishop") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Level / Rook") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Options / Queen") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Verify / King") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("New Game") PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_N) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Move/Pawn") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Hint/Knight") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Take Back/Bishop") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Level/Rook") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Options/Queen") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Verify/King") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_N) PORT_NAME("New Game") INPUT_PORTS_END static INPUT_PORTS_START( fexcelv ) @@ -763,30 +763,30 @@ static INPUT_PORTS_START( csc ) PORT_INCLUDE( sc12 ) PORT_MODIFY("IN.0") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Speaker") PORT_MODIFY("IN.1") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV") PORT_CODE(KEYCODE_V) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("RV") PORT_MODIFY("IN.2") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TM") PORT_CODE(KEYCODE_T) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("TM") PORT_MODIFY("IN.3") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_L) PORT_NAME("LV") PORT_MODIFY("IN.4") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("DM") PORT_MODIFY("IN.5") - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("ST") PORT_MODIFY("IN.8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Rook") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Knight") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bishop") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Queen") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Pawn") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Rook") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Knight") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Bishop") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Queen") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("King") PORT_START("IN.9") // hardwired PORT_CONFNAME( 0x01, 0x00, "Language" ) diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp index bb2231e78af..8c8f1c20dcd 100644 --- a/src/mame/drivers/fidel68k.cpp +++ b/src/mame/drivers/fidel68k.cpp @@ -3,34 +3,58 @@ /****************************************************************************** Fidelity Electronics 68000 based board driver + + TODO: + - how does dual-CPU work? + - the EAG manual mentions optional voice(speech) + - where does the cartridge slot map to? + - IRQ level/timing is unknown ****************************************************************************** -Elite Avant Garde (EAG) ------------------------ +Elite Avant Garde (EAG, model 6114) +----------------------------------- + +There are 5 versions of model 6114(V1 to V5). The one emulated here came from a V2, +but is practically emulated as a V4. + +V1: 128KB DRAM, no EEPROM +V2: 128KB DRAM +V3: 512KB DRAM +V4: 1MB DRAM +V5: 128KB+64KB DRAM, dual-CPU! (2*68K @ 16MHz) + +V6-V11 are on model 6117. Older 1986 model 6081 uses a 6502 CPU. - MC68HC000P12F 16MHz CPU, 16MHz XTAL -- MB1422A DRAM Controller, 25MHz XTAL near, 4 DRAM slots(this model: slot 1 and 2 64KB) +- MB1422A DRAM Controller, 25MHz XTAL near, 4 DRAM slots(V2: slot 1 and 2 64KB) - 2*27C512 EPROM, 2*KM6264AL-10 SRAM, 2*AT28C64X EEPROM(parallel) +- external module slot, no dumps yet - OKI M82C51A-2 USART, 4.9152MHz XTAL, assume it's used for factory test/debug - other special: Chessboard squares are magnet sensors - -Memory map: +Memory map: (of what is known) ----------- 000000-01FFFF: 128KB ROM 104000-107FFF: 16KB SRAM +200000-2FFFFF: hashtable DRAM (max. 1MB) +300000-30000F W hi d0: NE591: 7seg data +300000-30000F W lo d0: NE591: LED data +300000-30000F R lo d7: 74259?: keypad rows 0-7 +400000-400001 W lo d0-d3: 74145: led/keypad mux, buzzer out +700002-700003 R lo d7: 74251?: keypad row 8 604000-607FFF: 16KB EEPROM ******************************************************************************/ #include "emu.h" #include "cpu/m68000/m68000.h" +#include "machine/nvram.h" #include "includes/fidelz80.h" // internal artwork -#include "fidel_eag.lh" +#include "fidel_eag.lh" // clickable class fidel68k_state : public fidelz80base_state @@ -40,8 +64,13 @@ public: : fidelz80base_state(mconfig, type, tag) { } - // EAG - //.. + // EAG(6114) + void eag_prepare_display(); + DECLARE_READ8_MEMBER(eag_input1_r); + DECLARE_WRITE8_MEMBER(eag_leds_w); + DECLARE_WRITE8_MEMBER(eag_7seg_w); + DECLARE_WRITE8_MEMBER(eag_mux_w); + DECLARE_READ8_MEMBER(eag_input2_r); }; @@ -52,6 +81,56 @@ public: EAG ******************************************************************************/ +// misc handlers + +void fidel68k_state::eag_prepare_display() +{ + // 8*7seg leds, (8+1)*8 chessboard leds + UINT8 seg_data = BITSWAP8(m_7seg_data,0,1,3,2,7,5,6,4); + set_display_segmask(0x1ef, 0x7f); + display_matrix(16, 9, m_led_data << 8 | seg_data, m_inp_mux); +} + + +// TTL + +READ8_MEMBER(fidel68k_state::eag_input1_r) +{ + // a1-a3,d7: multiplexed inputs (active low) + return (read_inputs(9) >> offset & 1) ? 0 : 0x80; +} + +READ8_MEMBER(fidel68k_state::eag_input2_r) +{ + // d7: multiplexed inputs highest bit + return (read_inputs(9) & 0x100) ? 0x80 : 0; +} + +WRITE8_MEMBER(fidel68k_state::eag_leds_w) +{ + // a1-a3,d0: led data + m_led_data = (m_led_data & ~(1 << offset)) | ((data & 1) << offset); + eag_prepare_display(); +} + +WRITE8_MEMBER(fidel68k_state::eag_7seg_w) +{ + // a1-a3,d0(d8): digit segment data + m_7seg_data = (m_7seg_data & ~(1 << offset)) | ((data & 1) << offset); + eag_prepare_display(); +} + +WRITE8_MEMBER(fidel68k_state::eag_mux_w) +{ + // d0-d3: 74145 A-D + // 74145 0-8: input mux, digit/led select + // 74145 9: speaker out + UINT16 sel = 1 << (data & 0xf); + m_speaker->level_w(sel >> 9 & 1); + m_inp_mux = sel & 0x1ff; + eag_prepare_display(); +} + /****************************************************************************** @@ -61,11 +140,15 @@ public: // EAG static ADDRESS_MAP_START( eag_map, AS_PROGRAM, 16, fidel68k_state ) - ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_RANGE(0x104000, 0x107fff) AM_RAM - AM_RANGE(0x200000, 0x20ffff) AM_RAM - AM_RANGE(0x604000, 0x607fff) AM_RAM + AM_RANGE(0x200000, 0x2fffff) AM_RAM // DRAM, max 1MB + AM_RANGE(0x300000, 0x30000f) AM_MIRROR(0x000010) AM_READWRITE8(eag_input1_r, eag_leds_w, 0x00ff) + AM_RANGE(0x300000, 0x30000f) AM_MIRROR(0x000010) AM_WRITE8(eag_7seg_w, 0xff00) AM_READNOP + AM_RANGE(0x400000, 0x400001) AM_WRITE8(eag_mux_w, 0x00ff) + AM_RANGE(0x400002, 0x400007) AM_WRITENOP // ? + AM_RANGE(0x604000, 0x607fff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0x700002, 0x700003) AM_READ8(eag_input2_r, 0x00ff) ADDRESS_MAP_END @@ -75,7 +158,98 @@ ADDRESS_MAP_END ******************************************************************************/ static INPUT_PORTS_START( eag ) - + PORT_START("IN.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square h1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square g1") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square f1") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square e1") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square d1") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square c1") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square b1") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square a1") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("CL") + + PORT_START("IN.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square h2") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square g2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square f2") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square e2") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square d2") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square c2") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square b2") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square a2") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("DM") + + PORT_START("IN.2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square h3") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square g3") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square f3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square e3") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square d3") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square c3") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square b3") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square a3") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_N) PORT_NAME("New Game") + + PORT_START("IN.3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square h4") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square g4") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square f4") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square e4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square d4") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square c4") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square b4") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square a4") + + PORT_START("IN.4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square h5") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square g5") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square f5") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square e5") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square d5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square c5") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square b5") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square a5") + + PORT_START("IN.5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square h6") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square g6") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square f6") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square e6") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square d6") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square c6") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square b6") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square a6") + + PORT_START("IN.6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square h7") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square g7") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square f7") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square e7") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square d7") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square c7") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square b7") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square a7") + + PORT_START("IN.7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square h8") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square g8") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square f8") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square e8") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square d8") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square c8") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square b8") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Square a8") + + PORT_START("IN.8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("PB/King") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("PV/Queen") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("TM/Rook") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("ST/Bishop") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("TB/Knight") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("LV/Pawn") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_O) PORT_NAME("Option") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("RV") INPUT_PORTS_END @@ -89,6 +263,9 @@ static MACHINE_CONFIG_START( eag, fidel68k_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) MCFG_CPU_PROGRAM_MAP(eag_map) + MCFG_CPU_PERIODIC_INT_DRIVER(fidel68k_state, irq2_line_hold, 600) // complete guess + + MCFG_NVRAM_ADD_0FILL("nvram") MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_eag) @@ -117,4 +294,4 @@ ROM_END ******************************************************************************/ /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1989, feagv2, 0, 0, eag, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde V2", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +COMP( 1989, feagv2, 0, 0, eag, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde (model 6114)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index 0b89945fd0a..c43378b707b 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -1112,7 +1112,7 @@ static INPUT_PORTS_START( vcc_base ) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(KEYCODE_E) PORT_START("IN.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speaker") PORT_CODE(KEYCODE_SPACE) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_B) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_F) @@ -1300,22 +1300,22 @@ static INPUT_PORTS_START( vsc ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Square h8") PORT_START("IN.8") // buttons on the right - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Rook") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Knight") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bishop") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Queen") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Pawn") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Rook") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Knight") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Bishop") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Queen") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("King") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("CL") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("RE") PORT_START("IN.9") // buttons beside the display - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TM") PORT_CODE(KEYCODE_T) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV") PORT_CODE(KEYCODE_V) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("TM") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("RV") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Speaker") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_L) PORT_NAME("LV") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("DM") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("ST") PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("IN.10") // hardwired (2 diodes) @@ -1339,55 +1339,55 @@ INPUT_PORTS_END static INPUT_PORTS_START( vbrc ) PORT_START("IN.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("10") PORT_CODE(KEYCODE_0) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("A") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_NAME("10") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("6") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_START("IN.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_K) PORT_NAME("K") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_NAME("9") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("5") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_START("IN.2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("P") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("8") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("4") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_NAME("P") PORT_START("IN.3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("NT") PORT_CODE(KEYCODE_N) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_J) PORT_NAME("J") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("7") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("NT") PORT_START("IN.4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("EN") PORT_CODE(KEYCODE_E) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("SC") PORT_CODE(KEYCODE_S) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PL") PORT_CODE(KEYCODE_X) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Spades") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("EN") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("SC") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) PORT_NAME("PL") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Spades") PORT_START("IN.5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_C) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DB") PORT_CODE(KEYCODE_D) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("VL") PORT_CODE(KEYCODE_V) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Hearts") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("CL") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_NAME("DB") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("VL") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Hearts") PORT_START("IN.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Beep on/off") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("PB") PORT_CODE(KEYCODE_B) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CV") PORT_CODE(KEYCODE_G) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Diamonds") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Speaker") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("PB") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("CV") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Diamonds") PORT_START("IN.7") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("BR") PORT_CODE(KEYCODE_T) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DL") PORT_CODE(KEYCODE_L) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Clubs") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("BR") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_L) PORT_NAME("DL") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Clubs") PORT_START("RESET") // is not on matrix IN.7 d0 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, fidelz80_state, reset_button, 0) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, fidelz80_state, reset_button, 0) PORT_NAME("RE") INPUT_PORTS_END diff --git a/src/mame/layout/fidel_eag.lay b/src/mame/layout/fidel_eag.lay index 9d3e4d2766a..f321527a168 100644 --- a/src/mame/layout/fidel_eag.lay +++ b/src/mame/layout/fidel_eag.lay @@ -3,18 +3,430 @@ + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/src/mame/layout/fidel_fev.lay b/src/mame/layout/fidel_fev.lay index 1ecc3e9bcc7..93d4abaf163 100644 --- a/src/mame/layout/fidel_fev.lay +++ b/src/mame/layout/fidel_fev.lay @@ -221,6 +221,7 @@
+ @@ -412,7 +413,7 @@ - + -- cgit v1.2.3-70-g09d2 From 6db430bafcc5d43e8ad1810d3649e52441485c00 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Sun, 14 Feb 2016 16:58:51 -0600 Subject: Extend mame LUA api (nw) --- docs/luaengine.md | 22 ++++++- src/emu/luaengine.cpp | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/emu/luaengine.h | 8 +++ src/emu/video.h | 2 +- 4 files changed, 199 insertions(+), 2 deletions(-) diff --git a/docs/luaengine.md b/docs/luaengine.md index a17cefcdb80..ff79f46c21c 100644 --- a/docs/luaengine.md +++ b/docs/luaengine.md @@ -26,9 +26,10 @@ currently available to LUA scripts: * machine metadata (app version, current rom, rom details) * machine control (starting, pausing, resetting, stopping) * machine hooks (on frame painting and on user events) + * machine options (hard reset required for options to take affect) * devices introspection (device tree listing, memory and register enumeration) * screens introspection (screens listing, screen details, frames counting) - * screen HUD drawing (text, lines, boxes on multiple screens) + * screen snaps and HUD drawing (text, lines, boxes on multiple screens) * memory read/write (8/16/32/64 bits, signed and unsigned) * registers and states control (states enumeration, get and set) @@ -155,3 +156,22 @@ program 41 ``` +manager:machine().options[] +``` +> opts = manager:machine().options +> for k, entry in pairs(opts) do print(string.format("%10s: %s\n%11s %s", k, entry:value(), "", entry:description())) end +diff_directory: diff + directory to save hard drive image differeVnce files +joystick_contradictory: false + enable contradictory direction digital joystick input at the same time + scalemode: none + Scale mode: none, hwblit, hwbest, yv12, yuy2, yv12x2, yuy2x2 (-video soft only) + oslog: false + output error.log data to the system debugger +[...] +> print(opts["sleep"]:value()) +true +> print(opts["sleep"]:value("invalid")) +Illegal boolean value for sleep: "invalid"; reverting to 0 +false +``` diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index c7ecdc81c3a..1e193e6785f 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -373,6 +373,34 @@ void lua_engine::emu_set_hook(lua_State *L) } } +//------------------------------------------------- +// machine_options - return table of options +// -> manager:machine().options[] +//------------------------------------------------- + +luabridge::LuaRef lua_engine::l_machine_get_options(const running_machine *r) +{ + lua_State *L = luaThis->m_lua_state; + luabridge::LuaRef options_table = luabridge::LuaRef::newTable(L); + + int unadorned_index = 0; + for (core_options::entry *curentry = r->options().first(); curentry != nullptr; curentry = curentry->next()) + { + const char *name = curentry->name(); + bool is_unadorned = false; + // check if it's unadorned + if (name && strlen(name) && !strcmp(name, core_options::unadorned(unadorned_index))) + { + unadorned_index++; + is_unadorned = true; + } + if (!curentry->is_header() && !curentry->is_command() && !curentry->is_internal() && !is_unadorned) + options_table[name] = curentry; + } + + return options_table; +} + //------------------------------------------------- // machine_get_screens - return table of available screens userdata // -> manager:machine().screens[":screen"] @@ -591,6 +619,47 @@ int lua_engine::lua_addr_space::l_mem_write(lua_State *L) return 0; } +int lua_engine::lua_options_entry::l_entry_value(lua_State *L) +{ + core_options::entry *e = luabridge::Stack::get(L, 1); + if(!e) { + return 0; + } + + luaL_argcheck(L, !lua_isfunction(L, 2), 2, "optional argument: unsupported value"); + + if (!lua_isnone(L, 2)) + { + std::string error; + luaThis->machine().options().set_value(e->name(), + lua_isboolean(L, 2) ? (lua_toboolean(L, 2) ? "1" : "0") : lua_tostring(L, 2), + OPTION_PRIORITY_CMDLINE, error); + + if (!error.empty()) + { + lua_writestringerror("%s", error.c_str()); + } + } + + switch (e->type()) + { + case OPTION_BOOLEAN: + lua_pushboolean(L, (atoi(e->value()) != 0)); + break; + case OPTION_INTEGER: + lua_pushnumber(L, atoi(e->value())); + break; + case OPTION_FLOAT: + lua_pushnumber(L, atof(e->value())); + break; + default: + lua_pushstring(L, e->value()); + break; + } + + return 1; +} + //------------------------------------------------- // screen_height - return screen visible height // -> manager:machine().screens[":screen"]:height() @@ -623,6 +692,86 @@ int lua_engine::lua_screen::l_width(lua_State *L) return 1; } +//------------------------------------------------- +// screen_refresh - return screen refresh rate +// -> manager:machine().screens[":screen"]:refresh() +//------------------------------------------------- + +int lua_engine::lua_screen::l_refresh(lua_State *L) +{ + screen_device *sc = luabridge::Stack::get(L, 1); + if(!sc) { + return 0; + } + + lua_pushnumber(L, ATTOSECONDS_TO_HZ(sc->refresh_attoseconds())); + return 1; +} + +//------------------------------------------------- +// screen_snapshot - save png bitmap of screen to snapshots folder +// -> manager:machine().screens[":screen"]:snapshot("filename.png") +//------------------------------------------------- + +int lua_engine::lua_screen::l_snapshot(lua_State *L) +{ + screen_device *sc = luabridge::Stack::get(L, 1); + if(!sc || !sc->machine().render().is_live(*sc)) + { + return 0; + } + + luaL_argcheck(L, lua_isstring(L, 2) || lua_isnone(L, 2), 2, "optional argument: filename, string expected"); + + emu_file file(sc->machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + file_error filerr; + + if (!lua_isnone(L, 5)) { + const char *filename = lua_tostring(L, 2); + std::string snapstr(filename); + strreplace(snapstr, "/", PATH_SEPARATOR); + strreplace(snapstr, "%g", sc->machine().basename()); + filerr = file.open(snapstr.c_str()); + } + else + { + filerr = sc->machine().video().open_next(file, "png"); + } + + if (filerr != FILERR_NONE) + { + lua_writestringerror("Error creating snapshot, file_error=%d", filerr); + return 0; + } + + sc->machine().video().save_snapshot(sc, file); + file.close(); + return 1; +} + +//------------------------------------------------- +// screen_type - return human readable screen type +// -> manager:machine().screens[":screen"]:type() +//------------------------------------------------- + +int lua_engine::lua_screen::l_type(lua_State *L) +{ + screen_device *sc = luabridge::Stack::get(L, 1); + if(!sc) { + return 0; + } + + switch (sc->screen_type()) + { + case SCREEN_TYPE_RASTER: lua_pushliteral(L, "raster"); break; + case SCREEN_TYPE_VECTOR: lua_pushliteral(L, "vector"); break; + case SCREEN_TYPE_LCD: lua_pushliteral(L, "lcd"); break; + default: lua_pushliteral(L, "unknown"); break; + } + + return 1; +} + //------------------------------------------------- // draw_box - draw a box on a screen container // -> manager:machine().screens[":screen"]:draw_box(x1, y1, x2, y2, bgcolor, linecolor) @@ -1087,12 +1236,17 @@ void lua_engine::initialize() .addFunction ("system", &running_machine::system) .addProperty ("devices", &lua_engine::l_machine_get_devices) .addProperty ("screens", &lua_engine::l_machine_get_screens) + .addProperty ("options", &lua_engine::l_machine_get_options) .endClass () .beginClass ("game_driver") + .addData ("source_file", &game_driver::source_file) + .addData ("parent", &game_driver::parent) .addData ("name", &game_driver::name) .addData ("description", &game_driver::description) .addData ("year", &game_driver::year) .addData ("manufacturer", &game_driver::manufacturer) + .addData ("compatible_with", &game_driver::compatible_with) + .addData ("default_layout", &game_driver::default_layout) .endClass () .beginClass ("device") .addFunction ("name", &device_t::name) @@ -1101,6 +1255,16 @@ void lua_engine::initialize() .addProperty ("spaces", &lua_engine::l_dev_get_memspaces) .addProperty ("state", &lua_engine::l_dev_get_states) .endClass() + .beginClass ("lua_options_entry") + .addCFunction ("value", &lua_options_entry::l_entry_value) + .endClass() + .deriveClass ("core_options_entry") + .addFunction ("description", &core_options::entry::description) + .addFunction ("default_value", &core_options::entry::default_value) + .addFunction ("minimum", &core_options::entry::minimum) + .addFunction ("maximum", &core_options::entry::maximum) + .addFunction ("has_range", &core_options::entry::has_range) + .endClass() .beginClass ("lua_addr_space") .addCFunction ("read_i8", &lua_addr_space::l_mem_read) .addCFunction ("read_u8", &lua_addr_space::l_mem_read) @@ -1128,12 +1292,17 @@ void lua_engine::initialize() .addCFunction ("draw_text", &lua_screen::l_draw_text) .addCFunction ("height", &lua_screen::l_height) .addCFunction ("width", &lua_screen::l_width) + .addCFunction ("refresh", &lua_screen::l_refresh) + .addCFunction ("snapshot", &lua_screen::l_snapshot) + .addCFunction ("type", &lua_screen::l_type) .endClass() .deriveClass ("screen_dev") .addFunction ("frame_number", &screen_device::frame_number) .addFunction ("name", &screen_device::name) .addFunction ("shortname", &screen_device::shortname) .addFunction ("tag", &screen_device::tag) + .addFunction ("xscale", &screen_device::xscale) + .addFunction ("yscale", &screen_device::yscale) .endClass() .beginClass ("dev_space") .addFunction ("name", &device_state_entry::symbol) diff --git a/src/emu/luaengine.h b/src/emu/luaengine.h index 37660a28201..dc2df29a463 100644 --- a/src/emu/luaengine.h +++ b/src/emu/luaengine.h @@ -118,6 +118,7 @@ private: static int register_function(lua_State *L, const char *id); // "emu.machine" namespace + static luabridge::LuaRef l_machine_get_options(const running_machine *r); static luabridge::LuaRef l_machine_get_devices(const running_machine *r); static luabridge::LuaRef devtree_dfs(device_t *root, luabridge::LuaRef dev_table); static luabridge::LuaRef l_dev_get_states(const device_t *d); @@ -132,11 +133,18 @@ private: struct lua_screen { int l_height(lua_State *L); int l_width(lua_State *L); + int l_refresh(lua_State *L); + int l_type(lua_State *L); + int l_snapshot(lua_State *L); int l_draw_box(lua_State *L); int l_draw_line(lua_State *L); int l_draw_text(lua_State *L); }; + struct lua_options_entry { + int l_entry_value(lua_State *L); + }; + void resume(void *L, INT32 param); void start(); static int luaopen_ioport(lua_State *L); diff --git a/src/emu/video.h b/src/emu/video.h index e7ff281a260..7a1808ad095 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -76,6 +76,7 @@ public: // misc void toggle_throttle(); void toggle_record_movie(); + file_error open_next(emu_file &file, const char *extension); // render a frame void frame_update(bool debug = false); @@ -127,7 +128,6 @@ private: // snapshot/movie helpers void create_snapshot_bitmap(screen_device *screen); - file_error open_next(emu_file &file, const char *extension); void record_frame(); // internal state -- cgit v1.2.3-70-g09d2 From f24a89a8385b94165c25bdb04ab9f048a2453c74 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Sun, 14 Feb 2016 18:06:27 -0600 Subject: extend lua api more (nw) --- src/emu/luaengine.cpp | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/emu/luaengine.h | 2 ++ 2 files changed, 91 insertions(+) diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index 1e193e6785f..40e7d82af7a 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -438,6 +438,25 @@ luabridge::LuaRef lua_engine::l_machine_get_devices(const running_machine *r) return devs_table; } +//------------------------------------------------- +// render_get_targets - return table of render targets +// -> manager:machine():render().targets[0] +//------------------------------------------------- + +luabridge::LuaRef lua_engine::l_render_get_targets(const render_manager *r) +{ + lua_State *L = luaThis->m_lua_state; + luabridge::LuaRef target_table = luabridge::LuaRef::newTable(L); + + int tc = 0; + for (render_target *curr_rt = r->first_target(); curr_rt != nullptr; curr_rt = curr_rt->next()) + { + target_table[tc++] = curr_rt; + } + + return target_table; +} + // private helper for get_devices - DFS visit all devices in a running machine luabridge::LuaRef lua_engine::devtree_dfs(device_t *root, luabridge::LuaRef devs_table) { @@ -619,6 +638,36 @@ int lua_engine::lua_addr_space::l_mem_write(lua_State *L) return 0; } +//------------------------------------------------- +// ui_options - return table of options +// -> manager:machine():ui().options[] +//------------------------------------------------- + +luabridge::LuaRef lua_engine::l_ui_get_options(const ui_manager *u) +{ + lua_State *L = luaThis->m_lua_state; + luabridge::LuaRef options_table = luabridge::LuaRef::newTable(L); + + ui_manager &ui = luaThis->machine().ui(); + + int unadorned_index = 0; + for (core_options::entry *curentry = ui.options().first(); curentry != nullptr; curentry = curentry->next()) + { + const char *name = curentry->name(); + bool is_unadorned = false; + // check if it's unadorned + if (name && strlen(name) && !strcmp(name, core_options::unadorned(unadorned_index))) + { + unadorned_index++; + is_unadorned = true; + } + if (!curentry->is_header() && !curentry->is_command() && !curentry->is_internal() && !is_unadorned) + options_table[name] = curentry; + } + + return options_table; +} + int lua_engine::lua_options_entry::l_entry_value(lua_State *L) { core_options::entry *e = luabridge::Stack::get(L, 1); @@ -1234,6 +1283,8 @@ void lua_engine::initialize() .addFunction ("save", &running_machine::schedule_save) .addFunction ("load", &running_machine::schedule_load) .addFunction ("system", &running_machine::system) + .addFunction ("ui", &running_machine::ui) + .addFunction ("render", &running_machine::render) .addProperty ("devices", &lua_engine::l_machine_get_devices) .addProperty ("screens", &lua_engine::l_machine_get_screens) .addProperty ("options", &lua_engine::l_machine_get_options) @@ -1286,6 +1337,44 @@ void lua_engine::initialize() .deriveClass ("addr_space") .addFunction("name", &address_space::name) .endClass() + .beginClass ("target") + .addFunction ("width", &render_target::width) + .addFunction ("height", &render_target::height) + .addFunction ("pixel_aspect", &render_target::pixel_aspect) + .addFunction ("hidden", &render_target::hidden) + .addFunction ("is_ui_target", &render_target::is_ui_target) + .addFunction ("index", &render_target::index) + .addProperty ("max_update_rate", &render_target::max_update_rate, &render_target::set_max_update_rate) + .addProperty ("view", &render_target::view, &render_target::set_view) + .addProperty ("orientation", &render_target::orientation, &render_target::set_orientation) + .addProperty ("backdrops", &render_target::backdrops_enabled, &render_target::set_backdrops_enabled) + .addProperty ("overlays", &render_target::overlays_enabled, &render_target::set_overlays_enabled) + .addProperty ("bezels", &render_target::bezels_enabled, &render_target::set_bezels_enabled) + .addProperty ("marquees", &render_target::marquees_enabled, &render_target::set_marquees_enabled) + .addProperty ("screen_overlay", &render_target::screen_overlay_enabled, &render_target::set_screen_overlay_enabled) + .addProperty ("zoom", &render_target::zoom_to_screen, &render_target::set_zoom_to_screen) + .endClass() + .beginClass ("render_container") + .addFunction ("orientation", &render_container::orientation) + .addFunction ("xscale", &render_container::xscale) + .addFunction ("yscale", &render_container::yscale) + .addFunction ("xoffset", &render_container::xoffset) + .addFunction ("yoffset", &render_container::yoffset) + .addFunction ("is_empty", &render_container::is_empty) + .endClass() + .beginClass ("render") + .addFunction ("max_update_rate", &render_manager::max_update_rate) + .addFunction ("ui_target", &render_manager::ui_target) + .addFunction ("ui_container", &render_manager::ui_container) + .addProperty ("targets", &lua_engine::l_render_get_targets) + .endClass() + .beginClass ("ui") + .addFunction ("is_menu_active", &ui_manager::is_menu_active) + .addProperty ("show_fps", &ui_manager::show_fps, &ui_manager::set_show_fps) + .addProperty ("show_profiler", &ui_manager::show_profiler, &ui_manager::set_show_profiler) + .addProperty ("single_step", &ui_manager::single_step, &ui_manager::set_single_step) + .addProperty ("options", &lua_engine::l_ui_get_options) + .endClass() .beginClass ("lua_screen_dev") .addCFunction ("draw_box", &lua_screen::l_draw_box) .addCFunction ("draw_line", &lua_screen::l_draw_line) diff --git a/src/emu/luaengine.h b/src/emu/luaengine.h index dc2df29a463..72f28a06c15 100644 --- a/src/emu/luaengine.h +++ b/src/emu/luaengine.h @@ -120,6 +120,7 @@ private: // "emu.machine" namespace static luabridge::LuaRef l_machine_get_options(const running_machine *r); static luabridge::LuaRef l_machine_get_devices(const running_machine *r); + static luabridge::LuaRef l_render_get_targets(const render_manager *r); static luabridge::LuaRef devtree_dfs(device_t *root, luabridge::LuaRef dev_table); static luabridge::LuaRef l_dev_get_states(const device_t *d); static UINT64 l_state_get_value(const device_state_entry *d); @@ -141,6 +142,7 @@ private: int l_draw_text(lua_State *L); }; + static luabridge::LuaRef l_ui_get_options(const ui_manager *ui); struct lua_options_entry { int l_entry_value(lua_State *L); }; -- cgit v1.2.3-70-g09d2 From c283fa2e82daa48e4bfae5230b6cb80b0ff6430c Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Sun, 14 Feb 2016 18:38:48 -0600 Subject: extend lua api, parameters (nw) --- src/emu/luaengine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index 40e7d82af7a..970614b0c22 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -1316,6 +1316,10 @@ void lua_engine::initialize() .addFunction ("maximum", &core_options::entry::maximum) .addFunction ("has_range", &core_options::entry::has_range) .endClass() + .beginClass ("parameters") + .addFunction ("add", ¶meters_manager::add) + .addFunction ("lookup", ¶meters_manager::lookup) + .endClass() .beginClass ("lua_addr_space") .addCFunction ("read_i8", &lua_addr_space::l_mem_read) .addCFunction ("read_u8", &lua_addr_space::l_mem_read) -- cgit v1.2.3-70-g09d2 From bfafc1db404e4852a5d6cbe9e0e66560802ec4e1 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Sun, 14 Feb 2016 19:14:51 -0600 Subject: extend lua api, video (nw) --- src/emu/luaengine.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/emu/luaengine.h | 5 ++++ 2 files changed, 69 insertions(+) diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index 970614b0c22..52f65556156 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -709,6 +709,55 @@ int lua_engine::lua_options_entry::l_entry_value(lua_State *L) return 1; } +//------------------------------------------------- +// begin_recording - start avi +// -> manager:machine():video():begin_recording() +//------------------------------------------------- + +int lua_engine::lua_video::l_begin_recording(lua_State *L) +{ + video_manager *vm = luabridge::Stack::get(L, 1); + if (!vm) { + return 0; + } + + luaL_argcheck(L, lua_isstring(L, 2) || lua_isnone(L, 2), 2, "optional argument: filename, string expected"); + + const char *filename = lua_tostring(L, 2); + if (!lua_isnone(L, 2)) { + std::string vidname(filename); + strreplace(vidname, "/", PATH_SEPARATOR); + strreplace(vidname, "%g", luaThis->machine().basename()); + filename = vidname.c_str(); + } else { + filename = nullptr; + } + vm->begin_recording(filename, video_manager::MF_AVI); + + return 1; +} + +//------------------------------------------------- +// end_recording - start saving avi +// -> manager:machine():video():end_recording() +//------------------------------------------------- + +int lua_engine::lua_video::l_end_recording(lua_State *L) +{ + video_manager *vm = luabridge::Stack::get(L, 1); + if (!vm) { + return 0; + } + + if (!vm->is_recording()) { + lua_writestringerror("%s", "Error, no active recording to stop"); + return 0; + } + + vm->end_recording(video_manager::MF_AVI); + return 1; +} + //------------------------------------------------- // screen_height - return screen visible height // -> manager:machine().screens[":screen"]:height() @@ -1283,6 +1332,7 @@ void lua_engine::initialize() .addFunction ("save", &running_machine::schedule_save) .addFunction ("load", &running_machine::schedule_load) .addFunction ("system", &running_machine::system) + .addFunction ("video", &running_machine::video) .addFunction ("ui", &running_machine::ui) .addFunction ("render", &running_machine::render) .addProperty ("devices", &lua_engine::l_machine_get_devices) @@ -1320,6 +1370,20 @@ void lua_engine::initialize() .addFunction ("add", ¶meters_manager::add) .addFunction ("lookup", ¶meters_manager::lookup) .endClass() + .beginClass ("lua_video_manager") + .addCFunction ("begin_recording", &lua_video::l_begin_recording) + .addCFunction ("end_recording", &lua_video::l_end_recording) + .endClass() + .deriveClass ("video") + .addFunction ("snapshot", &video_manager::save_active_screen_snapshots) + .addFunction ("is_recording", &video_manager::is_recording) + .addFunction ("skip_this_frame", &video_manager::skip_this_frame) + .addFunction ("speed_factor", &video_manager::speed_factor) + .addFunction ("speed_percent", &video_manager::speed_percent) + .addProperty ("frameskip", &video_manager::frameskip, &video_manager::set_frameskip) + .addProperty ("throttled", &video_manager::throttled, &video_manager::set_throttled) + .addProperty ("throttle_rate", &video_manager::throttle_rate, &video_manager::set_throttle_rate) + .endClass() .beginClass ("lua_addr_space") .addCFunction ("read_i8", &lua_addr_space::l_mem_read) .addCFunction ("read_u8", &lua_addr_space::l_mem_read) diff --git a/src/emu/luaengine.h b/src/emu/luaengine.h index 72f28a06c15..58e7a1643f7 100644 --- a/src/emu/luaengine.h +++ b/src/emu/luaengine.h @@ -142,6 +142,11 @@ private: int l_draw_text(lua_State *L); }; + struct lua_video { + int l_begin_recording(lua_State *L); + int l_end_recording(lua_State *L); + }; + static luabridge::LuaRef l_ui_get_options(const ui_manager *ui); struct lua_options_entry { int l_entry_value(lua_State *L); -- cgit v1.2.3-70-g09d2 From 74dfcd6a84222ac4a601abf5f06ace300627f62d Mon Sep 17 00:00:00 2001 From: cracyc Date: Sun, 14 Feb 2016 19:45:23 -0600 Subject: i386: don't change IF when IOPL < CPL (nw) --- src/devices/cpu/i386/i386.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp index 62a65155a59..be65518f57b 100644 --- a/src/devices/cpu/i386/i386.cpp +++ b/src/devices/cpu/i386/i386.cpp @@ -2364,6 +2364,7 @@ void i386_device::i386_protected_mode_iret(int operand32) I386_SREG desc,stack; UINT8 CPL, RPL, DPL; UINT32 newflags; + UINT8 IOPL = m_IOP1 | (m_IOP2 << 1); CPL = m_CPL; UINT32 ea = i386_translate(SS, (STACK_32BIT)?REG32(ESP):REG16(SP), 0); @@ -2383,7 +2384,7 @@ void i386_device::i386_protected_mode_iret(int operand32) if(V8086_MODE) { UINT32 oldflags = get_flags(); - if(!m_IOP1 || !m_IOP2) + if(IOPL != 3) { logerror("IRET (%08x): Is in Virtual 8086 mode and IOPL != 3.\n",m_pc); FAULT(FAULT_GP,0) @@ -2455,6 +2456,8 @@ void i386_device::i386_protected_mode_iret(int operand32) { UINT32 oldflags = get_flags(); newflags = (newflags & ~0x00003000) | (oldflags & 0x00003000); + if(CPL > IOPL) + newflags = (newflags & ~0x200 ) | (oldflags & 0x200); } set_flags(newflags); m_eip = POP32() & 0xffff; // high 16 bits are ignored @@ -2584,6 +2587,8 @@ void i386_device::i386_protected_mode_iret(int operand32) { UINT32 oldflags = get_flags(); newflags = (newflags & ~0x00003000) | (oldflags & 0x00003000); + if(CPL > IOPL) + newflags = (newflags & ~0x200 ) | (oldflags & 0x200); } if(operand32 == 0) @@ -2753,6 +2758,8 @@ void i386_device::i386_protected_mode_iret(int operand32) { UINT32 oldflags = get_flags(); newflags = (newflags & ~0x00003000) | (oldflags & 0x00003000); + if(CPL > IOPL) + newflags = (newflags & ~0x200 ) | (oldflags & 0x200); } if(operand32 == 0) -- cgit v1.2.3-70-g09d2 From 62cded509482704245d6a2fef8f35027df70a9a4 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Sun, 14 Feb 2016 21:35:51 -0600 Subject: extend lua api, ioport (nw) --- src/emu/luaengine.cpp | 84 +++++++++++++++++++++++++++++++++++++++++++++++++-- src/emu/luaengine.h | 2 ++ 2 files changed, 83 insertions(+), 3 deletions(-) diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index 52f65556156..6bbb9c398b3 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -438,6 +438,44 @@ luabridge::LuaRef lua_engine::l_machine_get_devices(const running_machine *r) return devs_table; } +//------------------------------------------------- +// machine_ioports - return table of ioports +// -> manager:machine():ioport().ports[':P1'] +//------------------------------------------------- + +luabridge::LuaRef lua_engine::l_ioport_get_ports(const ioport_manager *m) +{ + ioport_manager *im = const_cast(m); + lua_State *L = luaThis->m_lua_state; + luabridge::LuaRef port_table = luabridge::LuaRef::newTable(L); + ioport_port *port; + + for (port = im->first_port(); port != nullptr; port = port->next()) { + port_table[port->tag()] = port; + } + + return port_table; +} + +//------------------------------------------------- +// ioport_fields - return table of ioport fields +// -> manager:machine().ioport().ports[':P1'].fields[':'] +//------------------------------------------------- + +luabridge::LuaRef lua_engine::l_ioports_port_get_fields(const ioport_port *i) +{ + ioport_port *p = const_cast(i); + lua_State *L = luaThis->m_lua_state; + luabridge::LuaRef f_table = luabridge::LuaRef::newTable(L); + ioport_field *field; + + for (field = p->first_field(); field != nullptr; field = field->next()) { + f_table[field->name()] = field; + } + + return f_table; +} + //------------------------------------------------- // render_get_targets - return table of render targets // -> manager:machine():render().targets[0] @@ -645,13 +683,12 @@ int lua_engine::lua_addr_space::l_mem_write(lua_State *L) luabridge::LuaRef lua_engine::l_ui_get_options(const ui_manager *u) { + ui_manager *ui = const_cast(u); lua_State *L = luaThis->m_lua_state; luabridge::LuaRef options_table = luabridge::LuaRef::newTable(L); - ui_manager &ui = luaThis->machine().ui(); - int unadorned_index = 0; - for (core_options::entry *curentry = ui.options().first(); curentry != nullptr; curentry = curentry->next()) + for (core_options::entry *curentry = ui->options().first(); curentry != nullptr; curentry = curentry->next()) { const char *name = curentry->name(); bool is_unadorned = false; @@ -1335,6 +1372,8 @@ void lua_engine::initialize() .addFunction ("video", &running_machine::video) .addFunction ("ui", &running_machine::ui) .addFunction ("render", &running_machine::render) + .addFunction ("ioport", &running_machine::ioport) + .addFunction ("parameters", &running_machine::parameters) .addProperty ("devices", &lua_engine::l_machine_get_devices) .addProperty ("screens", &lua_engine::l_machine_get_screens) .addProperty ("options", &lua_engine::l_machine_get_options) @@ -1356,6 +1395,45 @@ void lua_engine::initialize() .addProperty ("spaces", &lua_engine::l_dev_get_memspaces) .addProperty ("state", &lua_engine::l_dev_get_states) .endClass() + .beginClass ("ioport") + .addFunction ("has_configs", &ioport_manager::has_configs) + .addFunction ("has_analog", &ioport_manager::has_analog) + .addFunction ("has_dips", &ioport_manager::has_dips) + .addFunction ("has_bioses", &ioport_manager::has_bioses) + .addFunction ("has_keyboard", &ioport_manager::has_keyboard) + .addFunction ("count_players", &ioport_manager::count_players) + .addProperty ("ports", &lua_engine::l_ioport_get_ports) + .endClass() + .beginClass ("ioport_port") + .addFunction ("tag", &ioport_port::tag) + .addFunction ("active", &ioport_port::active) + .addFunction ("live", &ioport_port::live) + .addProperty ("fields", &lua_engine::l_ioports_port_get_fields) + .endClass() + .beginClass ("ioport_field") + .addFunction ("set_value", &ioport_field::set_value) + .addProperty ("device", &ioport_field::device) + .addProperty ("name", &ioport_field::name) + .addProperty ("player", &ioport_field::player, &ioport_field::set_player) + .addProperty ("mask", &ioport_field::mask) + .addProperty ("defvalue", &ioport_field::defvalue) + .addProperty ("sensitivity", &ioport_field::sensitivity) + .addProperty ("way", &ioport_field::way) + .addProperty ("is_analog", &ioport_field::is_analog) + .addProperty ("is_digitial_joystick", &ioport_field::is_digital_joystick) + .addProperty ("enabled", &ioport_field::enabled) + .addProperty ("unused", &ioport_field::unused) + .addProperty ("cocktail", &ioport_field::cocktail) + .addProperty ("toggle", &ioport_field::toggle) + .addProperty ("rotated", &ioport_field::rotated) + .addProperty ("analog_reverse", &ioport_field::analog_reverse) + .addProperty ("analog_reset", &ioport_field::analog_reset) + .addProperty ("analog_wraps", &ioport_field::analog_wraps) + .addProperty ("analog_invert", &ioport_field::analog_invert) + .addProperty ("impulse", &ioport_field::impulse) + .addProperty ("crosshair_scale", &ioport_field::crosshair_scale, &ioport_field::set_crosshair_scale) + .addProperty ("crosshair_offset", &ioport_field::crosshair_offset, &ioport_field::set_crosshair_offset) + .endClass() .beginClass ("lua_options_entry") .addCFunction ("value", &lua_options_entry::l_entry_value) .endClass() diff --git a/src/emu/luaengine.h b/src/emu/luaengine.h index 58e7a1643f7..f2e9571dbd7 100644 --- a/src/emu/luaengine.h +++ b/src/emu/luaengine.h @@ -120,7 +120,9 @@ private: // "emu.machine" namespace static luabridge::LuaRef l_machine_get_options(const running_machine *r); static luabridge::LuaRef l_machine_get_devices(const running_machine *r); + static luabridge::LuaRef l_ioport_get_ports(const ioport_manager *i); static luabridge::LuaRef l_render_get_targets(const render_manager *r); + static luabridge::LuaRef l_ioports_port_get_fields(const ioport_port *i); static luabridge::LuaRef devtree_dfs(device_t *root, luabridge::LuaRef dev_table); static luabridge::LuaRef l_dev_get_states(const device_t *d); static UINT64 l_state_get_value(const device_state_entry *d); -- cgit v1.2.3-70-g09d2 From 56c0fe0249e3d5d2bf0a10914284498e94da2e1f Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Sun, 14 Feb 2016 23:18:14 -0600 Subject: extend lua api, cheat (nw) --- src/emu/luaengine.cpp | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/emu/luaengine.h | 7 +++++ 2 files changed, 85 insertions(+) diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index 6bbb9c398b3..bf89139f310 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -14,6 +14,7 @@ #include "luabridge/Source/LuaBridge/LuaBridge.h" #include #include "emu.h" +#include "cheat.h" #include "drivenum.h" #include "ui/ui.h" #include "luaengine.h" @@ -438,6 +439,51 @@ luabridge::LuaRef lua_engine::l_machine_get_devices(const running_machine *r) return devs_table; } +//------------------------------------------------- +// machine_cheat_entries - return cheat entries +// -> manager:machine():cheat().entries[0] +//------------------------------------------------- + +luabridge::LuaRef lua_engine::l_cheat_get_entries(const cheat_manager *c) +{ + cheat_manager *cm = const_cast(c); + lua_State *L = luaThis->m_lua_state; + luabridge::LuaRef entry_table = luabridge::LuaRef::newTable(L); + + int cheatnum = 0; + for (cheat_entry *entry = cm->first(); entry != nullptr; entry = entry->next()) { + entry_table[cheatnum++] = entry; + } + + return entry_table; +} + +//------------------------------------------------- +// cheat_entry_state - return cheat entry state +// -> manager:machine():cheat().entries[0]:state() +//------------------------------------------------- + +int lua_engine::lua_cheat_entry::l_get_state(lua_State *L) +{ + cheat_entry *ce = luabridge::Stack::get(L, 1); + + switch (ce->state()) + { + case SCRIPT_STATE_ON: + lua_pushliteral(L, "on"); + case SCRIPT_STATE_RUN: + lua_pushliteral(L, "run"); + case SCRIPT_STATE_CHANGE: + lua_pushliteral(L, "change"); + case SCRIPT_STATE_COUNT: + lua_pushliteral(L, "count"); + default: + lua_pushliteral(L, "off"); + } + + return 1; +} + //------------------------------------------------- // machine_ioports - return table of ioports // -> manager:machine():ioport().ports[':P1'] @@ -1374,6 +1420,7 @@ void lua_engine::initialize() .addFunction ("render", &running_machine::render) .addFunction ("ioport", &running_machine::ioport) .addFunction ("parameters", &running_machine::parameters) + .addFunction ("cheat", &running_machine::cheat) .addProperty ("devices", &lua_engine::l_machine_get_devices) .addProperty ("screens", &lua_engine::l_machine_get_screens) .addProperty ("options", &lua_engine::l_machine_get_options) @@ -1395,6 +1442,37 @@ void lua_engine::initialize() .addProperty ("spaces", &lua_engine::l_dev_get_memspaces) .addProperty ("state", &lua_engine::l_dev_get_states) .endClass() + .beginClass ("cheat") + .addProperty ("enabled", &cheat_manager::enabled, &cheat_manager::set_enable) + .addFunction ("reload", &cheat_manager::reload) + .addFunction ("save_all", &cheat_manager::save_all) + .addProperty ("entries", &lua_engine::l_cheat_get_entries) + .endClass() + .beginClass ("lua_cheat_entry") + .addCFunction ("state", &lua_cheat_entry::l_get_state) + .endClass() + .deriveClass ("cheat_entry") + .addFunction ("description", &cheat_entry::description) + .addFunction ("comment", &cheat_entry::comment) + .addFunction ("has_run_script", &cheat_entry::has_run_script) + .addFunction ("has_on_script", &cheat_entry::has_on_script) + .addFunction ("has_off_script", &cheat_entry::has_off_script) + .addFunction ("has_change_script", &cheat_entry::has_change_script) + .addFunction ("execute_off_script", &cheat_entry::execute_off_script) + .addFunction ("execute_on_script", &cheat_entry::execute_on_script) + .addFunction ("execute_run_script", &cheat_entry::execute_run_script) + .addFunction ("execute_change_script", &cheat_entry::execute_change_script) + .addFunction ("is_text_only", &cheat_entry::is_text_only) + .addFunction ("is_oneshot", &cheat_entry::is_oneshot) + .addFunction ("is_onoff", &cheat_entry::is_onoff) + .addFunction ("is_value_parameter", &cheat_entry::is_value_parameter) + .addFunction ("is_itemlist_parameter", &cheat_entry::is_itemlist_parameter) + .addFunction ("is_oneshot_parameter", &cheat_entry::is_oneshot_parameter) + .addFunction ("activate", &cheat_entry::activate) + .addFunction ("select_default_state", &cheat_entry::select_default_state) + .addFunction ("select_previous_state", &cheat_entry::select_previous_state) + .addFunction ("select_next_state", &cheat_entry::select_next_state) + .endClass() .beginClass ("ioport") .addFunction ("has_configs", &ioport_manager::has_configs) .addFunction ("has_analog", &ioport_manager::has_analog) diff --git a/src/emu/luaengine.h b/src/emu/luaengine.h index f2e9571dbd7..94b90981819 100644 --- a/src/emu/luaengine.h +++ b/src/emu/luaengine.h @@ -24,6 +24,8 @@ #undef None #endif +class cheat_manager; + struct lua_State; namespace luabridge { @@ -149,6 +151,11 @@ private: int l_end_recording(lua_State *L); }; + static luabridge::LuaRef l_cheat_get_entries(const cheat_manager *c); + struct lua_cheat_entry { + int l_get_state(lua_State *L); + }; + static luabridge::LuaRef l_ui_get_options(const ui_manager *ui); struct lua_options_entry { int l_entry_value(lua_State *L); -- cgit v1.2.3-70-g09d2 From 09fd282dc8c398d59bbe00b0ad229b3cbed425b5 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 15 Feb 2016 11:20:54 +0100 Subject: fix build on some linuxes (nw) --- scripts/genie.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/genie.lua b/scripts/genie.lua index a51c3cbaa5d..4384b9f379b 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1050,6 +1050,7 @@ configuration { "nacl*" } configuration { "linux-*" } links { "dl", + "rt", } if _OPTIONS["distro"]=="debian-stable" then defines -- cgit v1.2.3-70-g09d2 From 5772715d6314a7b2a21c4aa030c0aa9f785044a6 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 15 Feb 2016 12:05:31 +0100 Subject: fix compile on some platforms (nw) --- makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 308b2cb0958..3f33bca63b3 100644 --- a/makefile +++ b/makefile @@ -311,6 +311,7 @@ PYTHON := $(PYTHON_EXECUTABLE) endif CC := $(SILENT)gcc LD := $(SILENT)g++ +CXX:= $(SILENT)g++ #------------------------------------------------- # specify OSD layer: windows, sdl, etc. @@ -1195,7 +1196,7 @@ endif ifndef MARVELL_ROOTFS $(error MARVELL_ROOTFS is not set) endif - $(SILENT) $(GENIE) $(PARAMS) --gcc=steamlink --gcc_version=$(GCC_VERSION) --USE_BGFX=0 --NO_OPENGL=1 --NO_USE_MIDI=1 --NO_X11=1 --NOASM=1 --SDL_INSTALL_ROOT=$(MARVELL_ROOTFS)/usr gmake + $(SILENT) $(GENIE) $(PARAMS) --gcc=steamlink --gcc_version=$(GCC_VERSION) --USE_BGFX=0 --NO_OPENGL=1 --NO_USE_MIDI=1 --NO_X11=1 --NOASM=1 --SDL_INSTALL_ROOT=$(MARVELL_ROOTFS)/usr gmake .PHONY: steamlink ifndef MARVELL_SDK_PATH -- cgit v1.2.3-70-g09d2 From 05214ecda55d379894a1a91d56c1863268b41c73 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 15 Feb 2016 12:06:56 +0100 Subject: small addition for steamlink (nw) --- scripts/toolchain.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index 7fad61ce928..27b571e18d0 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -496,7 +496,9 @@ function toolchain(_buildDir, _subDir) configuration { "steamlink" } objdir ( _buildDir .. "steamlink/obj") - + defines { + "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it. + } buildoptions { "-marm", "-mfloat-abi=hard", -- cgit v1.2.3-70-g09d2 From 1dc9266b930f5126cbd76e24fbbcf7acf3bb6bd4 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 15 Feb 2016 16:35:15 +0100 Subject: draw FPS counter even in menus (nw) will revert this when MG finish his work --- src/emu/ui/menu.cpp | 7 +++++++ src/emu/video.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index f831ffa725f..a06fb5e62ca 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -460,6 +460,13 @@ void ui_menu::set_selection(void *selected_itemref) void ui_menu::draw(bool customonly, bool noimage, bool noinput) { + // first draw the FPS counter + if (machine().ui().show_fps_counter()) + { + machine().ui().draw_text_full(container, machine().video().speed_text().c_str(), 0.0f, 0.0f, 1.0f, + JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); + } + float line_height = machine().ui().get_line_height(); float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); float ud_arrow_width = line_height * machine().render().ui_aspect(); diff --git a/src/emu/video.cpp b/src/emu/video.cpp index 11f081636b8..7dc9470d54a 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -684,7 +684,7 @@ inline int video_manager::effective_frameskip() const inline bool video_manager::effective_throttle() const { // if we're paused, or if the UI is active, we always throttle - if (machine().paused() || machine().ui().is_menu_active()) + if (machine().paused()) //|| machine().ui().is_menu_active()) return true; // if we're fast forwarding, we don't throttle -- cgit v1.2.3-70-g09d2 From 50466d1fb9ebf504fc2e6eb346596f069259f0ca Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Mon, 15 Feb 2016 10:25:18 -0600 Subject: fix compile (nw) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC 5.3.1 on Fedora 22 src/lib/util/aviio.cpp:1378:57: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized] --- src/lib/util/aviio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/util/aviio.cpp b/src/lib/util/aviio.cpp index 90918c06673..a448128070b 100644 --- a/src/lib/util/aviio.cpp +++ b/src/lib/util/aviio.cpp @@ -1297,7 +1297,7 @@ avi_error avi_read_sound_samples(avi_file *file, int channel, UINT32 firstsample UINT32 bytes_per_sample; file_error filerr; avi_stream *stream; - int offset; + int offset = 0; /* get the audio stream */ stream = get_audio_stream(file, channel, &offset); -- cgit v1.2.3-70-g09d2 From b0a7bcd3468fa309d3761742be7f69c671d7a1fc Mon Sep 17 00:00:00 2001 From: "therealmogminer@gmail.com" Date: Mon, 15 Feb 2016 17:57:16 +0100 Subject: Significant speed improvements to the BGFX renderer. [MooglyGuy] --- scripts/src/osd/modules.lua | 1 + src/emu/render.cpp | 21 +- src/emu/render.h | 10 +- src/emu/ui/menu.cpp | 36 +- src/osd/modules/render/binpacker.cpp | 195 ++++++++ src/osd/modules/render/binpacker.h | 183 +++++++ src/osd/modules/render/d3d/d3dhlsl.cpp | 11 +- src/osd/modules/render/drawbgfx.cpp | 871 ++++++++++++++++++--------------- src/osd/modules/render/drawbgfx.h | 115 +++++ 9 files changed, 1025 insertions(+), 418 deletions(-) create mode 100644 src/osd/modules/render/binpacker.cpp create mode 100644 src/osd/modules/render/binpacker.h create mode 100644 src/osd/modules/render/drawbgfx.h diff --git a/scripts/src/osd/modules.lua b/scripts/src/osd/modules.lua index 87e684a50f6..14d344fee09 100644 --- a/scripts/src/osd/modules.lua +++ b/scripts/src/osd/modules.lua @@ -104,6 +104,7 @@ function osdmodulesbuild() if USE_BGFX == 1 then files { MAME_DIR .. "src/osd/modules/render/drawbgfx.cpp", + MAME_DIR .. "src/osd/modules/render/binpacker.cpp", } defines { "USE_BGFX" diff --git a/src/emu/render.cpp b/src/emu/render.cpp index e25f62a8e13..cbcfd6b16b3 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -442,8 +442,10 @@ void render_texture::hq_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const // get_scaled - get a scaled bitmap (if we can) //------------------------------------------------- -void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist) +void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, bool packable) { + texinfo.hash = 0; + // source width/height come from the source bounds int swidth = m_sbounds.width(); int sheight = m_sbounds.height(); @@ -520,6 +522,17 @@ void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &t // palette will be set later texinfo.seqid = scaled->seqid; } + + UINT32 hash = 0; + if (packable) + { + //printf("Packable, %d, %d\n", texinfo.width, texinfo.height); + } + if (packable && texinfo.width <= 128 && texinfo.height <= 128) + { + hash = reinterpret_cast(texinfo.base) & 0xffffffff; + } + texinfo.hash = hash; } @@ -677,7 +690,7 @@ void render_container::add_char(float x0, float y0, float height, float aspect, // add it like a quad item &newitem = add_generic(CONTAINER_ITEM_QUAD, bounds.x0, bounds.y0, bounds.x1, bounds.y1, argb); newitem.m_texture = texture; - newitem.m_flags = PRIMFLAG_TEXORIENT(ROT0) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA); + newitem.m_flags = PRIMFLAG_TEXORIENT(ROT0) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_PACKABLE; newitem.m_internal = INTERNAL_FLAG_CHAR; } @@ -1751,7 +1764,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const width = MIN(width, m_maxtexwidth); height = MIN(height, m_maxtexheight); - curitem->texture()->get_scaled(width, height, prim->texture, list); + curitem->texture()->get_scaled(width, height, prim->texture, list, (curitem->flags() & PRIMFLAG_PACKABLE) ? true : false); // set the palette prim->texture.palette = curitem->texture()->get_adjusted_palette(container); @@ -1854,7 +1867,7 @@ void render_target::add_element_primitives(render_primitive_list &list, const ob // get the scaled texture and append it - texture->get_scaled(width, height, prim->texture, list); + texture->get_scaled(width, height, prim->texture, list, (prim->flags & PRIMFLAG_PACKABLE) ? true : false); // compute the clip rect render_bounds cliprect; diff --git a/src/emu/render.h b/src/emu/render.h index e40c86b1c3c..0fda591381a 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -62,7 +62,9 @@ enum BLENDMODE_NONE = 0, // no blending BLENDMODE_ALPHA, // standard alpha blend BLENDMODE_RGB_MULTIPLY, // apply source alpha to source pix, then multiply RGB values - BLENDMODE_ADD // apply source alpha to source pix, then add to destination + BLENDMODE_ADD, // apply source alpha to source pix, then add to destination + + BLENDMODE_COUNT }; @@ -105,6 +107,9 @@ const UINT32 PRIMFLAG_TYPE_MASK = 3 << PRIMFLAG_TYPE_SHIFT; const UINT32 PRIMFLAG_TYPE_LINE = 0 << PRIMFLAG_TYPE_SHIFT; const UINT32 PRIMFLAG_TYPE_QUAD = 1 << PRIMFLAG_TYPE_SHIFT; +const int PRIMFLAG_PACKABLE_SHIFT = 1; +const UINT32 PRIMFLAG_PACKABLE = 1 << PRIMFLAG_PACKABLE_SHIFT; + //************************************************************************** // MACROS //************************************************************************** @@ -206,6 +211,7 @@ struct render_texinfo UINT32 height; // height of the image UINT32 seqid; // sequence ID UINT64 osddata; // aux data to pass to osd + UINT32 hash; // hash (where applicable) const rgb_t * palette; // palette for PALETTE16 textures, bcg lookup table for RGB32/YUY16 }; @@ -430,7 +436,7 @@ public: private: // internal helpers - void get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist); + void get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, bool packable = false); const rgb_t *get_adjusted_palette(render_container &container); static const int MAX_TEXTURE_SCALES = 16; diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index a06fb5e62ca..fbe7d46e541 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -59,12 +59,12 @@ static const ui_arts_info arts_info[] = { nullptr } }; -static const char *hover_msg[] = { - "Add or remove favorites", - "Export displayed list to file", - "Show DATs view", - "Setup directories", - "Configure options" +static const char *hover_msg[] = { + "Add or remove favorites", + "Export displayed list to file", + "Show DATs view", + "Setup directories", + "Configure options" }; /*************************************************************************** @@ -1258,7 +1258,7 @@ void ui_menu::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const void ui_menu::highlight(render_container *container, float x0, float y0, float x1, float y1, rgb_t bgcolor) { - container->add_quad(x0, y0, x1, y1, bgcolor, hilight_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + container->add_quad(x0, y0, x1, y1, bgcolor, hilight_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE) | PRIMFLAG_PACKABLE); } @@ -1268,7 +1268,7 @@ void ui_menu::highlight(render_container *container, float x0, float y0, float x void ui_menu::draw_arrow(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, UINT32 orientation) { - container->add_quad(x0, y0, x1, y1, fgcolor, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(orientation)); + container->add_quad(x0, y0, x1, y1, fgcolor, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(orientation) | PRIMFLAG_PACKABLE); } //------------------------------------------------- @@ -1350,7 +1350,7 @@ void ui_menu::init_ui(running_machine &machine) toolbar_texture[x]->set_bitmap(*toolbar_bitmap[x], toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32); else toolbar_bitmap[x]->reset(); - + if (x == 0 || x == 2) { dst = &sw_toolbar_bitmap[x]->pix32(0); @@ -1487,7 +1487,7 @@ void ui_menu::draw_select_game(bool noinput) // if we have some background hilighting to do, add a quad behind everything else if (bgcolor != UI_TEXT_BG_COLOR) - mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(255, 43, 43, 43), + mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); // if we're on the top line, display the up arrow @@ -1531,7 +1531,7 @@ void ui_menu::draw_select_game(bool noinput) space = mui.get_line_height() * container->manager().ui_aspect() * 1.5f; } - mui.draw_text_full(container, itemtext, effective_left + space, line_y, effective_width - space, JUSTIFY_LEFT, WRAP_TRUNCATE, + mui.draw_text_full(container, itemtext, effective_left + space, line_y, effective_width - space, JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr); } else @@ -1591,7 +1591,7 @@ void ui_menu::draw_select_game(bool noinput) container->add_line(visible_left, line + 0.5f * line_height, visible_left + visible_width, line + 0.5f * line_height, UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); else - mui.draw_text_full(container, itemtext, effective_left, line, effective_width, JUSTIFY_CENTER, WRAP_TRUNCATE, + mui.draw_text_full(container, itemtext, effective_left, line, effective_width, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); line += line_height; } @@ -2116,7 +2116,7 @@ void ui_menu::draw_star(float x0, float y0) { float y1 = y0 + machine().ui().get_line_height(); float x1 = x0 + machine().ui().get_line_height() * container->manager().ui_aspect(); - container->add_quad(x0, y0, x1, y1, ARGB_WHITE, star_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + container->add_quad(x0, y0, x1, y1, ARGB_WHITE, star_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_PACKABLE); } //------------------------------------------------- @@ -2298,13 +2298,13 @@ void ui_menu::draw_common_arrow(float origx1, float origy1, float origx2, float // apply arrow if (current == dmin) - container->add_quad(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90)); + container->add_quad(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90) | PRIMFLAG_PACKABLE); else if (current == dmax) - container->add_quad(al_x0, al_y0, al_x1, al_y1, fgcolor_left, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90 ^ ORIENTATION_FLIP_X)); + container->add_quad(al_x0, al_y0, al_x1, al_y1, fgcolor_left, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90 ^ ORIENTATION_FLIP_X) | PRIMFLAG_PACKABLE); else { - container->add_quad(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90)); - container->add_quad(al_x0, al_y0, al_x1, al_y1, fgcolor_left, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90 ^ ORIENTATION_FLIP_X)); + container->add_quad(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90) | PRIMFLAG_PACKABLE); + container->add_quad(al_x0, al_y0, al_x1, al_y1, fgcolor_left, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90 ^ ORIENTATION_FLIP_X) | PRIMFLAG_PACKABLE); } } @@ -2409,7 +2409,7 @@ void ui_menu::draw_icon(int linenum, void *selectedref, float x0, float y0) } if (icons_bitmap[linenum]->valid()) - container->add_quad(x0, y0, x1, y1, ARGB_WHITE, icons_texture[linenum], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + container->add_quad(x0, y0, x1, y1, ARGB_WHITE, icons_texture[linenum], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_PACKABLE); } //------------------------------------------------- diff --git a/src/osd/modules/render/binpacker.cpp b/src/osd/modules/render/binpacker.cpp new file mode 100644 index 00000000000..2054dfa54cf --- /dev/null +++ b/src/osd/modules/render/binpacker.cpp @@ -0,0 +1,195 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// binpacker.cpp - Simple texture packer for dynamic atlasing +// +//============================================================ + +#include "binpacker.h" +#include + +bool rectangle_packer::pack(const std::vector& rects, std::vector>& packs, int pack_size) +{ + clear(); + + m_pack_size = pack_size; + + // Add rects to member array, and check to make sure none is too big + for (size_t rect = 0; rect < rects.size(); rect++) + { + m_rects.push_back(rectangle(0, 0, rects[rect].width(), rects[rect].height(), rects[rect].hash(), rects[rect].format(), rects[rect].rowpixels(), rects[rect].palette(), rects[rect].base())); + } + + // Sort from greatest to least area + std::sort(m_rects.rbegin(), m_rects.rend()); + + // Pack + while (m_num_packed < (int)m_rects.size()) + { + int i = m_packs.size(); + m_packs.push_back(rectangle(m_pack_size)); + m_roots.push_back(i); + if (!fill(i)) + { + return false; + } + } + + // Write out + packs.resize(m_roots.size()); + for (size_t i = 0; i < m_roots.size(); ++i) + { + packs[i].clear(); + add_pack_to_array(m_roots[i], packs[i]); + } + + return true; +} + +void rectangle_packer::clear() +{ + m_pack_size = 0; + m_num_packed = 0; + m_rects.clear(); + m_packs.clear(); + m_roots.clear(); +} + +bool rectangle_packer::fill(int pack) +{ + // For each rect + for (size_t rect = 0; rect < m_rects.size(); ++rect) + { + // If it's not already packed + if (!m_rects[rect].packed) + { + // If it fits in the current working area + if (fits(m_rects[rect], m_packs[pack])) + { + // Store in lower-left of working area, split, and recurse + m_num_packed++; + split(pack, rect); + fill(m_packs[pack].children[0]); + fill(m_packs[pack].children[1]); + return true; + } + } + } + return false; +} + +void rectangle_packer::split(int pack, int rect) +{ + // Split the working area either horizontally or vertically with respect + // to the rect we're storing, such that we get the largest possible child + // area. + + rectangle left = m_packs[pack]; + rectangle right = m_packs[pack]; + rectangle bottom = m_packs[pack]; + rectangle top = m_packs[pack]; + + left.y += m_rects[rect].h; + left.w = m_rects[rect].w; + left.h -= m_rects[rect].h; + + right.x += m_rects[rect].w; + right.w -= m_rects[rect].w; + + bottom.x += m_rects[rect].w; + bottom.h = m_rects[rect].h; + bottom.w -= m_rects[rect].w; + + top.y += m_rects[rect].h; + top.h -= m_rects[rect].h; + + int max_lr_area = left.get_area(); + if (right.get_area() > max_lr_area) + { + max_lr_area = right.get_area(); + } + + int max_bt_area = bottom.get_area(); + if (top.get_area() > max_bt_area) + { + max_bt_area = top.get_area(); + } + + if (max_lr_area > max_bt_area) + { + if (left.get_area() > right.get_area()) + { + m_packs.push_back(left); + m_packs.push_back(right); + } + else + { + m_packs.push_back(right); + m_packs.push_back(left); + } + } + else + { + if (bottom.get_area() > top.get_area()) + { + m_packs.push_back(bottom); + m_packs.push_back(top); + } + else + { + m_packs.push_back(top); + m_packs.push_back(bottom); + } + } + + // This pack area now represents the rect we've just stored, so save the + // relevant info to it, and assign children. + m_packs[pack].w = m_rects[rect].w; + m_packs[pack].h = m_rects[rect].h; + m_packs[pack].hash = m_rects[rect].hash; + m_packs[pack].format = m_rects[rect].format; + m_packs[pack].rowpixels = m_rects[rect].rowpixels; + m_packs[pack].palette = m_rects[rect].palette; + m_packs[pack].base = m_rects[rect].base; + m_packs[pack].children[0] = m_packs.size() - 2; + m_packs[pack].children[1] = m_packs.size() - 1; + + // Done with the rect + m_rects[rect].packed = true; + +} + +bool rectangle_packer::fits(rectangle& rect1, const rectangle& rect2) +{ + // Check to see if rect1 fits in rect2 + + if (rect1.w <= rect2.w && rect1.h <= rect2.h) + { + return true; + } + else + { + return false; + } +} + +void rectangle_packer::add_pack_to_array(int pack, std::vector& array) const +{ + if (m_packs[pack].hash != 0) + { + array.push_back(packed_rectangle(m_packs[pack].hash, m_packs[pack].format, + m_packs[pack].w, m_packs[pack].h, m_packs[pack].x, m_packs[pack].y, + m_packs[pack].rowpixels, m_packs[pack].palette, m_packs[pack].base)); + + if (m_packs[pack].children[0] != -1) + { + add_pack_to_array(m_packs[pack].children[0], array); + } + + if (m_packs[pack].children[1] != -1) + { + add_pack_to_array(m_packs[pack].children[1], array); + } + } +} diff --git a/src/osd/modules/render/binpacker.h b/src/osd/modules/render/binpacker.h new file mode 100644 index 00000000000..677083b5c09 --- /dev/null +++ b/src/osd/modules/render/binpacker.h @@ -0,0 +1,183 @@ +#pragma once + +#ifndef __RECTPACKER_H__ +#define __RECTPACKER_H__ + +#include "emu.h" + +#include + +class rectangle_packer +{ +public: + // The input and output are in terms of vectors of ints to avoid + // dependencies (although I suppose a public member struct could have been + // used). The parameters are: + + // packs : After packing, the outer array contains the packs (therefore + // the number of packs is packs.size()). Each inner array contains a + // sequence of sets of 3 ints. Each set represents a rectangle in the + // pack. The elements in the set are 1) the rect ID, 2) the x position + // of the rect with respect to the pack, and 3) the y position of the rect + // with respect to the pack. The widths and heights of the rects are not + // included, as it's assumed they are stored on the caller's side (they + // were after all the input to the function). + + class packable_rectangle + { + public: + packable_rectangle() : m_hash(0), m_width(-1), m_height(-1) { } + packable_rectangle(UINT32 hash, UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base) + : m_hash(hash) + , m_format(format) + , m_width(width) + , m_height(height) + , m_rowpixels(rowpixels) + , m_palette(palette) + , m_base(base) + { + } + + UINT32 hash() const { return m_hash; } + UINT32 format() const { return m_format; } + int width() const { return m_width; } + int height() const { return m_height; } + int rowpixels() const { return m_rowpixels; } + const rgb_t* palette() const { return m_palette; } + void* base() const { return m_base; } + + private: + UINT32 m_hash; + UINT32 m_format; + int m_width; + int m_height; + int m_rowpixels; + const rgb_t* m_palette; + void* m_base; + }; + + class packed_rectangle + { + public: + packed_rectangle() : m_hash(0), m_format(0), m_width(-1), m_height(-1), m_x(-1), m_y(-1), m_rowpixels(0), m_palette(nullptr), m_base(nullptr) { } + packed_rectangle(const packed_rectangle& rect) + : m_hash(rect.m_hash) + , m_format(rect.m_format) + , m_width(rect.m_width) + , m_height(rect.m_height) + , m_x(rect.m_x) + , m_y(rect.m_y) + , m_rowpixels(rect.m_rowpixels) + , m_palette(rect.m_palette) + , m_base(rect.m_base) + { + } + packed_rectangle(UINT32 hash, UINT32 format, int width, int height, int x, int y, int rowpixels, const rgb_t *palette, void *base) + : m_hash(hash) + , m_format(format) + , m_width(width) + , m_height(height) + , m_x(x) + , m_y(y) + , m_rowpixels(rowpixels) + , m_palette(palette) + , m_base(base) + { + } + + UINT32 hash() const { return m_hash; } + UINT32 format() const { return m_format; } + int width() const { return m_width; } + int height() const { return m_height; } + int x() const { return m_x; } + int y() const { return m_y; } + int rowpixels() const { return m_rowpixels; } + const rgb_t* palette() const { return m_palette; } + void* base() const { return m_base; } + + private: + UINT32 m_hash; + UINT32 m_format; + int m_width; + int m_height; + int m_x; + int m_y; + int m_rowpixels; + const rgb_t* m_palette; + void* m_base; + }; + + bool pack(const std::vector& rects, std::vector>& packs, int pack_size); + +private: + struct rectangle + { + rectangle(int size) + : x(0) + , y(0) + , w(size) + , h(size) + , hash(-1) + , format(0) + , rowpixels(0) + , palette(nullptr) + , base(nullptr) + , packed(false) + { + children[0] = -1; + children[1] = -1; + } + + rectangle(int x, int y, int w, int h, int hash, UINT32 format, int rowpixels, const rgb_t *palette, void *base) + : x(x) + , y(y) + , w(w) + , h(h) + , hash(hash) + , format(format) + , rowpixels(rowpixels) + , palette(palette) + , base(base) + , packed(false) + { + children[0] = -1; + children[1] = -1; + } + + int get_area() const + { + return w * h; + } + + bool operator<(const rectangle& rect) const + { + return get_area() < rect.get_area(); + } + + int x; + int y; + int w; + int h; + int hash; + UINT32 format; + int rowpixels; + const rgb_t* palette; + void* base; + int children[2]; + bool packed; + }; + + void clear(); + bool fill(int pack); + void split(int pack, int rect); + bool fits(rectangle& rect1, const rectangle& rect2); + void add_pack_to_array(int pack, std::vector& array) const; + + int m_pack_size; + int m_num_packed; + std::vector m_rects; + std::vector m_packs; + std::vector m_roots; +}; + +#endif // __RECTPACKER_H__ \ No newline at end of file diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 43d6ec9bc48..4cc53f2e41d 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -1416,14 +1416,9 @@ int shaders::post_pass(render_target *rt, int source_index, poly_info *poly, int float screen_scale[2] = { xscale, yscale }; float screen_offset[2] = { xoffset, yoffset }; - rgb_t back_color_rgb = !machine->first_screen()->has_palette() - ? rgb_t(0, 0, 0) - : machine->first_screen()->palette().palette()->entry_color(0); + rgb_t back_color_rgb = !machine->first_screen()->has_palette() ? rgb_t(0, 0, 0) : machine->first_screen()->palette().palette()->entry_color(0); back_color_rgb = apply_color_convolution(back_color_rgb); - float back_color[3] = { - static_cast(back_color_rgb.r()) / 255.0f, - static_cast(back_color_rgb.g()) / 255.0f, - static_cast(back_color_rgb.b()) / 255.0f }; + float back_color[3] = { static_cast(back_color_rgb.r()) / 255.0f, static_cast(back_color_rgb.g()) / 255.0f, static_cast(back_color_rgb.b()) / 255.0f }; curr_effect = post_effect; curr_effect->update_uniforms(); @@ -1463,9 +1458,9 @@ int shaders::downsample_pass(render_target *rt, int source_index, poly_info *pol curr_effect->set_bool("PrepareVector", prepare_vector); int bloom_index = 0; - float bloom_size = (d3d->get_width() < d3d->get_height()) ? d3d->get_width() : d3d->get_height(); float bloom_width = prepare_vector ? rt->target_width : rt->target_width / hlsl_prescale_x; float bloom_height = prepare_vector ? rt->target_height : rt->target_height / hlsl_prescale_y; + float bloom_size = (bloom_width < bloom_height) ? bloom_width : bloom_height; for (; bloom_size >= 2.0f && bloom_index < 11; bloom_size *= 0.5f) { bloom_dims[bloom_index][0] = (float)(int)bloom_width; diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 35a50609cf4..707360053aa 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -1,8 +1,8 @@ // license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic,Dario Manesku,Branimir Karadzic,Aaron Giles +// copyright-holders:Miodrag Milanovic,Ryan Holtz,Dario Manesku,Branimir Karadzic,Aaron Giles //============================================================ // -// drawbgfx.c - BGFX drawer +// drawbgfx.cpp - BGFX renderer // //============================================================ #define __STDC_LIMIT_MACROS @@ -32,6 +32,9 @@ #include #include #include +#include + +#include "drawbgfx.h" //============================================================ // DEBUGGING @@ -55,42 +58,6 @@ //============================================================ -/* sdl_info is the information about SDL for the current screen */ -class renderer_bgfx : public osd_renderer -{ -public: - renderer_bgfx(osd_window *w) - : osd_renderer(w, FLAG_NONE), - m_dimensions(0,0) - {} - - virtual int create() override; - virtual int draw(const int update) override; -#ifdef OSD_SDL - virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override; -#else - virtual void save() override { } - virtual void record() override { } - virtual void toggle_fsfx() override { } -#endif - virtual void destroy() override; - virtual render_primitive_list *get_primitives() override - { - osd_dim wdim = window().get_size(); - window().target()->set_bounds(wdim.width(), wdim.height(), window().aspect()); - return &window().target()->get_primitives(); - } - - bgfx::ProgramHandle m_progQuad; - bgfx::ProgramHandle m_progQuadTexture; - bgfx::ProgramHandle m_progLine; - bgfx::UniformHandle m_s_texColor; - bgfx::FrameBufferHandle fbh; - // Original display_mode - osd_dim m_dimensions; -}; - - //============================================================ // PROTOTYPES //============================================================ @@ -144,7 +111,7 @@ static void* sdlNativeWindowHandle(SDL_Window* _window) SDL_VERSION(&wmi.version); if (!SDL_GetWindowWMInfo(_window, &wmi)) { - return NULL; + return nullptr; } # if BX_PLATFORM_LINUX || BX_PLATFORM_BSD @@ -175,7 +142,8 @@ int renderer_bgfx::create() bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS m_dimensions = osd_dim(wdim.width(), wdim.height()); } - else { + else + { #ifdef OSD_WINDOWS fbh = bgfx::createFrameBuffer(window().m_hwnd, wdim.width(), wdim.height()); #else @@ -183,12 +151,18 @@ int renderer_bgfx::create() #endif bgfx::touch(window().m_index); } + + PosColorTexCoord0Vertex::init(); + PosColorVertex::init(); + // Create program from shaders. m_progQuad = loadProgram("vs_quad", "fs_quad"); m_progQuadTexture = loadProgram("vs_quad_texture", "fs_quad_texture"); - m_progLine = loadProgram("vs_line", "fs_line"); m_s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1); + uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_ANISOTROPIC | BGFX_TEXTURE_MAG_ANISOTROPIC; + m_texture_cache = bgfx::createTexture2D(CACHE_SIZE, CACHE_SIZE, 1, bgfx::TextureFormat::BGRA8, flags); + return 0; } @@ -198,7 +172,7 @@ int renderer_bgfx::create() void renderer_bgfx::destroy() { - if (window().m_index > 0) + if (window().m_index > 0) { bgfx::destroyFrameBuffer(fbh); } @@ -206,7 +180,6 @@ void renderer_bgfx::destroy() // Cleanup. bgfx::destroyProgram(m_progQuad); bgfx::destroyProgram(m_progQuadTexture); - bgfx::destroyProgram(m_progLine); } @@ -239,7 +212,7 @@ static const bgfx::Memory* loadMem(bx::FileReaderI* _reader, const char* _filePa return mem; } - return NULL; + return nullptr; } static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name) { @@ -277,11 +250,11 @@ static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name return bgfx::createShader(loadMem(_reader, filePath)); } -bgfx::ProgramHandle loadProgram(bx::FileReaderI* _reader, const char* _vsName, const char* _fsName) +bgfx::ProgramHandle renderer_bgfx::loadProgram(bx::FileReaderI* _reader, const char* _vsName, const char* _fsName) { bgfx::ShaderHandle vsh = loadShader(_reader, _vsName); bgfx::ShaderHandle fsh = BGFX_INVALID_HANDLE; - if (NULL != _fsName) + if (nullptr != _fsName) { fsh = loadShader(_reader, _fsName); } @@ -290,44 +263,70 @@ bgfx::ProgramHandle loadProgram(bx::FileReaderI* _reader, const char* _vsName, c } static auto s_fileReader = new bx::CrtFileReader; -bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName) +bgfx::ProgramHandle renderer_bgfx::loadProgram(const char* _vsName, const char* _fsName) { - return loadProgram(s_fileReader, _vsName, _fsName); } + //============================================================ // drawbgfx_window_draw //============================================================ -struct PosColorTexCoord0Vertex +bgfx::VertexDecl renderer_bgfx::PosColorTexCoord0Vertex::ms_decl; + +void renderer_bgfx::put_packed_quad(render_primitive *prim, UINT32 hash, PosColorTexCoord0Vertex* vertex) { - float m_x; - float m_y; - float m_z; - uint32_t m_rgba; - float m_u; - float m_v; - - static void init() - { - ms_decl.begin() - .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) - .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) - .add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float) - .end(); - } - - static bgfx::VertexDecl ms_decl; -}; -bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl; - -void screenQuad(float _x1 - , float _y1 - , float _x2 - , float _y2 - , uint32_t _abgr - , render_quad_texuv uv - ) + rectangle_packer::packed_rectangle& rect = m_hash_to_entry[hash]; + float u0 = float(rect.x()) / float(CACHE_SIZE); + float v0 = float(rect.y()) / float(CACHE_SIZE); + float u1 = u0 + float(rect.width()) / float(CACHE_SIZE); + float v1 = v0 + float(rect.height()) / float(CACHE_SIZE); + UINT32 rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255); + + vertex[0].m_x = prim->bounds.x0; + vertex[0].m_y = prim->bounds.y0; + vertex[0].m_z = 0; + vertex[0].m_rgba = rgba; + vertex[0].m_u = u0; + vertex[0].m_v = v0; + + vertex[1].m_x = prim->bounds.x1; + vertex[1].m_y = prim->bounds.y0; + vertex[1].m_z = 0; + vertex[1].m_rgba = rgba; + vertex[1].m_u = u1; + vertex[1].m_v = v0; + + vertex[2].m_x = prim->bounds.x1; + vertex[2].m_y = prim->bounds.y1; + vertex[2].m_z = 0; + vertex[2].m_rgba = rgba; + vertex[2].m_u = u1; + vertex[2].m_v = v1; + + vertex[3].m_x = prim->bounds.x1; + vertex[3].m_y = prim->bounds.y1; + vertex[3].m_z = 0; + vertex[3].m_rgba = rgba; + vertex[3].m_u = u1; + vertex[3].m_v = v1; + + vertex[4].m_x = prim->bounds.x0; + vertex[4].m_y = prim->bounds.y1; + vertex[4].m_z = 0; + vertex[4].m_rgba = rgba; + vertex[4].m_u = u0; + vertex[4].m_v = v1; + + vertex[5].m_x = prim->bounds.x0; + vertex[5].m_y = prim->bounds.y0; + vertex[5].m_z = 0; + vertex[5].m_rgba = rgba; + vertex[5].m_u = u0; + vertex[5].m_v = v0; +} + +void renderer_bgfx::render_textured_quad(int view, render_primitive* prim) { if (bgfx::checkAvailTransientVertexBuffer(6, PosColorTexCoord0Vertex::ms_decl)) { @@ -335,90 +334,86 @@ void screenQuad(float _x1 bgfx::allocTransientVertexBuffer(&vb, 6, PosColorTexCoord0Vertex::ms_decl); PosColorTexCoord0Vertex* vertex = (PosColorTexCoord0Vertex*)vb.data; - const float minx = _x1; - const float miny = _y1; - const float maxx = _x2; - const float maxy = _y2; - const float zz = 0.0f; - - vertex[0].m_x = minx; - vertex[0].m_y = miny; - vertex[0].m_z = zz; - vertex[0].m_rgba = _abgr; - vertex[0].m_u = uv.tl.u; - vertex[0].m_v = uv.tl.v; - - vertex[1].m_x = maxx; - vertex[1].m_y = miny; - vertex[1].m_z = zz; - vertex[1].m_rgba = _abgr; - vertex[1].m_u = uv.tr.u; - vertex[1].m_v = uv.tr.v; - - vertex[2].m_x = maxx; - vertex[2].m_y = maxy; - vertex[2].m_z = zz; - vertex[2].m_rgba = _abgr; - vertex[2].m_u = uv.br.u; - vertex[2].m_v = uv.br.v; - - vertex[3].m_x = maxx; - vertex[3].m_y = maxy; - vertex[3].m_z = zz; - vertex[3].m_rgba = _abgr; - vertex[3].m_u = uv.br.u; - vertex[3].m_v = uv.br.v; - - vertex[4].m_x = minx; - vertex[4].m_y = maxy; - vertex[4].m_z = zz; - vertex[4].m_rgba = _abgr; - vertex[4].m_u = uv.bl.u; - vertex[4].m_v = uv.bl.v; - - vertex[5].m_x = minx; - vertex[5].m_y = miny; - vertex[5].m_z = zz; - vertex[5].m_rgba = _abgr; - vertex[5].m_u = uv.tl.u; - vertex[5].m_v = uv.tl.v; + UINT32 rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255); + + vertex[0].m_x = prim->bounds.x0; + vertex[0].m_y = prim->bounds.y0; + vertex[0].m_z = 0; + vertex[0].m_rgba = rgba; + vertex[0].m_u = prim->texcoords.tl.u; + vertex[0].m_v = prim->texcoords.tl.v; + + vertex[1].m_x = prim->bounds.x1; + vertex[1].m_y = prim->bounds.y0; + vertex[1].m_z = 0; + vertex[1].m_rgba = rgba; + vertex[1].m_u = prim->texcoords.tr.u; + vertex[1].m_v = prim->texcoords.tr.v; + + vertex[2].m_x = prim->bounds.x1; + vertex[2].m_y = prim->bounds.y1; + vertex[2].m_z = 0; + vertex[2].m_rgba = rgba; + vertex[2].m_u = prim->texcoords.br.u; + vertex[2].m_v = prim->texcoords.br.v; + + vertex[3].m_x = prim->bounds.x1; + vertex[3].m_y = prim->bounds.y1; + vertex[3].m_z = 0; + vertex[3].m_rgba = rgba; + vertex[3].m_u = prim->texcoords.br.u; + vertex[3].m_v = prim->texcoords.br.v; + + vertex[4].m_x = prim->bounds.x0; + vertex[4].m_y = prim->bounds.y1; + vertex[4].m_z = 0; + vertex[4].m_rgba = rgba; + vertex[4].m_u = prim->texcoords.bl.u; + vertex[4].m_v = prim->texcoords.bl.v; + + vertex[5].m_x = prim->bounds.x0; + vertex[5].m_y = prim->bounds.y0; + vertex[5].m_z = 0; + vertex[5].m_rgba = rgba; + vertex[5].m_u = prim->texcoords.tl.u; + vertex[5].m_v = prim->texcoords.tl.v; bgfx::setVertexBuffer(&vb); - } -} + uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP; + if (video_config.filter == 0) + { + texture_flags |= BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; + } + + const bgfx::Memory* mem = mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK, + prim->texture.width, prim->texture.height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base); -struct PosColorVertex -{ - float m_x; - float m_y; - uint32_t m_abgr; + bgfx::TextureHandle texture = bgfx::createTexture2D((uint16_t)prim->texture.width, (uint16_t)prim->texture.height, 1, bgfx::TextureFormat::BGRA8, texture_flags, mem); - static void init() - { - ms_decl - .begin() - .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float) - .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) - .end(); + bgfx::setTexture(0, m_s_texColor, texture); + + set_bgfx_state(PRIMFLAG_GET_BLENDMODE(prim->flags)); + bgfx::submit(view, m_progQuadTexture); + + bgfx::destroyTexture(texture); } +} - static bgfx::VertexDecl ms_decl; -}; -bgfx::VertexDecl PosColorVertex::ms_decl; +bgfx::VertexDecl renderer_bgfx::PosColorVertex::ms_decl; #define MAX_TEMP_COORDS 100 -void drawPolygon(const float* _coords, uint32_t _numCoords, float _r, uint32_t _abgr) +void renderer_bgfx::put_polygon(const float* coords, UINT32 num_coords, float r, UINT32 rgba, PosColorVertex* vertex) { - float tempCoords[MAX_TEMP_COORDS * 2]; + float tempCoords[MAX_TEMP_COORDS * 3]; float tempNormals[MAX_TEMP_COORDS * 2]; - _numCoords = _numCoords < MAX_TEMP_COORDS ? _numCoords : MAX_TEMP_COORDS; + num_coords = num_coords < MAX_TEMP_COORDS ? num_coords : MAX_TEMP_COORDS; - for (uint32_t ii = 0, jj = _numCoords - 1; ii < _numCoords; jj = ii++) + for (uint32_t ii = 0, jj = num_coords - 1; ii < num_coords; jj = ii++) { - const float* v0 = &_coords[jj * 2]; - const float* v1 = &_coords[ii * 2]; + const float* v0 = &coords[jj * 3]; + const float* v1 = &coords[ii * 3]; float dx = v1[0] - v0[0]; float dy = v1[1] - v0[1]; float d = sqrtf(dx * dx + dy * dy); @@ -433,7 +428,7 @@ void drawPolygon(const float* _coords, uint32_t _numCoords, float _r, uint32_t _ tempNormals[jj * 2 + 1] = -dx; } - for (uint32_t ii = 0, jj = _numCoords - 1; ii < _numCoords; jj = ii++) + for (uint32_t ii = 0, jj = num_coords - 1; ii < num_coords; jj = ii++) { float dlx0 = tempNormals[jj * 2 + 0]; float dly0 = tempNormals[jj * 2 + 1]; @@ -454,77 +449,78 @@ void drawPolygon(const float* _coords, uint32_t _numCoords, float _r, uint32_t _ dmy *= scale; } - tempCoords[ii * 2 + 0] = _coords[ii * 2 + 0] + dmx * _r; - tempCoords[ii * 2 + 1] = _coords[ii * 2 + 1] + dmy * _r; + tempCoords[ii * 3 + 0] = coords[ii * 3 + 0] + dmx * r; + tempCoords[ii * 3 + 1] = coords[ii * 3 + 1] + dmy * r; + tempCoords[ii * 3 + 2] = coords[ii * 3 + 2]; } - uint32_t numVertices = _numCoords * 6 + (_numCoords - 2) * 3; - if (bgfx::checkAvailTransientVertexBuffer(numVertices, PosColorVertex::ms_decl)) + int vertIndex = 0; + UINT32 trans = rgba & 0x00ffffff; + for (uint32_t ii = 0, jj = num_coords - 1; ii < num_coords; jj = ii++) { - bgfx::TransientVertexBuffer tvb; - bgfx::allocTransientVertexBuffer(&tvb, numVertices, PosColorVertex::ms_decl); - uint32_t trans = _abgr & 0xffffff; - - PosColorVertex* vertex = (PosColorVertex*)tvb.data; - for (uint32_t ii = 0, jj = _numCoords - 1; ii < _numCoords; jj = ii++) - { - vertex->m_x = _coords[ii * 2 + 0]; - vertex->m_y = _coords[ii * 2 + 1]; - vertex->m_abgr = _abgr; - ++vertex; - - vertex->m_x = _coords[jj * 2 + 0]; - vertex->m_y = _coords[jj * 2 + 1]; - vertex->m_abgr = _abgr; - ++vertex; - - vertex->m_x = tempCoords[jj * 2 + 0]; - vertex->m_y = tempCoords[jj * 2 + 1]; - vertex->m_abgr = trans; - ++vertex; - - vertex->m_x = tempCoords[jj * 2 + 0]; - vertex->m_y = tempCoords[jj * 2 + 1]; - vertex->m_abgr = trans; - ++vertex; - - vertex->m_x = tempCoords[ii * 2 + 0]; - vertex->m_y = tempCoords[ii * 2 + 1]; - vertex->m_abgr = trans; - ++vertex; - - vertex->m_x = _coords[ii * 2 + 0]; - vertex->m_y = _coords[ii * 2 + 1]; - vertex->m_abgr = _abgr; - ++vertex; - } - - for (uint32_t ii = 2; ii < _numCoords; ++ii) - { - vertex->m_x = _coords[0]; - vertex->m_y = _coords[1]; - vertex->m_abgr = _abgr; - ++vertex; - - vertex->m_x = _coords[(ii - 1) * 2 + 0]; - vertex->m_y = _coords[(ii - 1) * 2 + 1]; - vertex->m_abgr = _abgr; - ++vertex; - - vertex->m_x = _coords[ii * 2 + 0]; - vertex->m_y = _coords[ii * 2 + 1]; - vertex->m_abgr = _abgr; - ++vertex; - } + vertex[vertIndex].m_x = coords[ii * 3 + 0]; + vertex[vertIndex].m_y = coords[ii * 3 + 1]; + vertex[vertIndex].m_z = coords[ii * 3 + 2]; + vertex[vertIndex].m_rgba = rgba; + vertIndex++; + + vertex[vertIndex].m_x = coords[jj * 3 + 0]; + vertex[vertIndex].m_y = coords[jj * 3 + 1]; + vertex[vertIndex].m_z = coords[jj * 3 + 2]; + vertex[vertIndex].m_rgba = rgba; + vertIndex++; + + vertex[vertIndex].m_x = tempCoords[jj * 3 + 0]; + vertex[vertIndex].m_y = tempCoords[jj * 3 + 1]; + vertex[vertIndex].m_z = tempCoords[jj * 3 + 2]; + vertex[vertIndex].m_rgba = trans; + vertIndex++; + + vertex[vertIndex].m_x = tempCoords[jj * 3 + 0]; + vertex[vertIndex].m_y = tempCoords[jj * 3 + 1]; + vertex[vertIndex].m_z = tempCoords[jj * 3 + 2]; + vertex[vertIndex].m_rgba = trans; + vertIndex++; + + vertex[vertIndex].m_x = tempCoords[ii * 3 + 0]; + vertex[vertIndex].m_y = tempCoords[ii * 3 + 1]; + vertex[vertIndex].m_z = tempCoords[ii * 3 + 2]; + vertex[vertIndex].m_rgba = trans; + vertIndex++; + + vertex[vertIndex].m_x = coords[ii * 3 + 0]; + vertex[vertIndex].m_y = coords[ii * 3 + 1]; + vertex[vertIndex].m_z = coords[ii * 3 + 2]; + vertex[vertIndex].m_rgba = rgba; + vertIndex++; + } - bgfx::setVertexBuffer(&tvb); + for (uint32_t ii = 2; ii < num_coords; ++ii) + { + vertex[vertIndex].m_x = coords[0]; + vertex[vertIndex].m_y = coords[1]; + vertex[vertIndex].m_z = coords[2]; + vertex[vertIndex].m_rgba = rgba; + vertIndex++; + + vertex[vertIndex].m_x = coords[(ii - 1) * 3 + 0]; + vertex[vertIndex].m_y = coords[(ii - 1) * 3 + 1]; + vertex[vertIndex].m_z = coords[(ii - 1) * 3 + 2]; + vertex[vertIndex].m_rgba = rgba; + vertIndex++; + + vertex[vertIndex].m_x = coords[ii * 3 + 0]; + vertex[vertIndex].m_y = coords[ii * 3 + 1]; + vertex[vertIndex].m_z = coords[ii * 3 + 2]; + vertex[vertIndex].m_rgba = rgba; + vertIndex++; } } -void drawLine(float _x0, float _y0, float _x1, float _y1, float _r, uint32_t _abgr, float _fth = 1.0f) +void renderer_bgfx::put_line(float x0, float y0, float x1, float y1, float r, UINT32 rgba, PosColorVertex* vertex, float fth) { - float dx = _x1 - _x0; - float dy = _y1 - _y0; + float dx = x1 - x0; + float dy = y1 - y0; float d = sqrtf(dx * dx + dy * dy); if (d > 0.0001f) { @@ -535,49 +531,41 @@ void drawLine(float _x0, float _y0, float _x1, float _y1, float _r, uint32_t _ab float nx = dy; float ny = -dx; - float verts[4 * 2]; - _r -= _fth; - _r *= 0.5f; - if (_r < 0.01f) + float verts[4 * 3]; + r -= fth; + r *= 0.5f; + if (r < 0.01f) { - _r = 0.01f; + r = 0.01f; } - dx *= _r; - dy *= _r; - nx *= _r; - ny *= _r; + dx *= r; + dy *= r; + nx *= r; + ny *= r; - verts[0] = _x0 - dx - nx; - verts[1] = _y0 - dy - ny; + verts[0] = x0 - dx - nx; + verts[1] = y0 - dy - ny; + verts[2] = 0; - verts[2] = _x0 - dx + nx; - verts[3] = _y0 - dy + ny; + verts[3] = x0 - dx + nx; + verts[4] = y0 - dy + ny; + verts[5] = 0; - verts[4] = _x1 + dx + nx; - verts[5] = _y1 + dy + ny; + verts[6] = x1 + dx + nx; + verts[7] = y1 + dy + ny; + verts[8] = 0; - verts[6] = _x1 + dx - nx; - verts[7] = _y1 + dy - ny; + verts[9] = x1 + dx - nx; + verts[10] = y1 + dy - ny; + verts[11] = 0; - drawPolygon(verts, 4, _fth, _abgr); + put_polygon(verts, 4, fth, rgba, vertex); } -void initVertexDecls() +uint32_t renderer_bgfx::u32Color(uint32_t r, uint32_t g, uint32_t b, uint32_t a = 255) { - PosColorTexCoord0Vertex::init(); - PosColorVertex::init(); -} - -static inline -uint32_t u32Color(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255) -{ - return 0 - | (uint32_t(_r) << 0) - | (uint32_t(_g) << 8) - | (uint32_t(_b) << 16) - | (uint32_t(_a) << 24) - ; + return (a << 24) | (b << 16) | (g << 8) | r; } //============================================================ @@ -609,9 +597,9 @@ static inline void copyline_palettea16(UINT32 *dst, const UINT16 *src, int width static inline void copyline_rgb32(UINT32 *dst, const UINT32 *src, int width, const rgb_t *palette) { int x; - + // palette (really RGB map) case - if (palette != NULL) + if (palette != nullptr) { for (x = 0; x < width; x++) { @@ -637,7 +625,7 @@ static inline void copyline_argb32(UINT32 *dst, const UINT32 *src, int width, co { int x; // palette (really RGB map) case - if (palette != NULL) + if (palette != nullptr) { for (x = 0; x < width; x++) { @@ -706,7 +694,7 @@ static inline void copyline_yuy16_to_argb(UINT32 *dst, const UINT16 *src, int wi assert(width % 2 == 0); // palette (really RGB map) case - if (palette != NULL) + if (palette != nullptr) { for (x = 0; x < width / 2; x++) { @@ -737,9 +725,38 @@ static inline void copyline_yuy16_to_argb(UINT32 *dst, const UINT16 *src, int wi } } } + +const bgfx::Memory* renderer_bgfx::mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base) +{ + const bgfx::Memory* mem = bgfx::alloc(width * height * 4); + for (int y = 0; y < height; y++) + { + switch (format) + { + case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16): + copyline_palette16((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette); + break; + case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTEA16): + copyline_palettea16((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette); + break; + case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16): + copyline_yuy16_to_argb((UINT32*)mem->data + y * width, (UINT16*)base + y * rowpixels, width, palette, 1); + break; + case PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32): + copyline_argb32((UINT32*)mem->data + y * width, (UINT32*)base + y * rowpixels, width, palette); + break; + case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32): + copyline_rgb32((UINT32*)mem->data + y * width, (UINT32*)base + y * rowpixels, width, palette); + break; + default: + break; + } + } + return mem; +} + int renderer_bgfx::draw(int update) { - initVertexDecls(); int index = window().m_index; // Set view 0 default viewport. osd_dim wdim = window().get_size(); @@ -806,154 +823,48 @@ int renderer_bgfx::draw(int update) bgfx::touch(index); window().m_primlist->acquire_lock(); - // Draw quad. - // now draw - uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP; - if (video_config.filter==0) texture_flags |= BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; - - for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next()) - { - uint64_t flags = BGFX_STATE_RGB_WRITE; - switch (prim->flags & PRIMFLAG_BLENDMODE_MASK) - { - case PRIMFLAG_BLENDMODE(BLENDMODE_NONE): - break; - case PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA): - flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA); - break; - case PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY): - flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO); - break; - case PRIMFLAG_BLENDMODE(BLENDMODE_ADD): - flags |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_ONE); - } - bool alpha = false; + + bgfx::TransientVertexBuffer flat_buffer[4]; + bgfx::TransientVertexBuffer textured_buffer[4]; + + allocate_buffers(flat_buffer, textured_buffer); + + int flat_vertices[4] = { 0, 0, 0, 0 }; + int textured_vertices[4] = { 0, 0, 0, 0 }; + + // Mark our texture atlas as dirty if we need to do so + bool atlas_valid = update_atlas(); + + memset(flat_vertices, 0, sizeof(int) * 4); + memset(textured_vertices, 0, sizeof(int) * 4); + + for (render_primitive *prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) + { + UINT32 blend = PRIMFLAG_GET_BLENDMODE(prim->flags); + switch (prim->type) { - /** - * Try to stay in one Begin/End block as long as possible, - * since entering and leaving one is most expensive.. - */ case render_primitive::LINE: - - drawLine(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, - 1.0f, - u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), - 1.0f); - bgfx::setState(flags); - bgfx::submit(index, m_progLine); + put_line(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, 1.0f, u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), (PosColorVertex*)flat_buffer[blend].data + flat_vertices[blend], 1.0f); + flat_vertices[blend] += 30; break; case render_primitive::QUAD: - if (prim->texture.base == nullptr) { - render_quad_texuv uv; - uv.tl.u = uv.tl.v = uv.tr.u = uv.tr.v = 0; - uv.bl.u = uv.bl.v = uv.br.u = uv.br.v = 0; - screenQuad(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, - u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), uv); - bgfx::setState(flags); - bgfx::submit(index, m_progQuad); + if (prim->texture.base == nullptr) + { + render_flat_quad(index, prim); } - else { - screenQuad(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, - u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), prim->texcoords); - bgfx::TextureHandle m_texture; - // render based on the texture coordinates - switch (prim->flags & PRIMFLAG_TEXFORMAT_MASK) + else + { + if (atlas_valid && (prim->flags & PRIMFLAG_PACKABLE) && prim->texture.hash != 0 && m_hash_to_entry[prim->texture.hash].hash()) { - case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTEA16): - alpha = true; - case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16): - { - auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); - if (alpha) - { - for (int y = 0; y < prim->texture.height; y++) - { - copyline_palettea16((UINT32*)mem->data + y*prim->texture.width, (UINT16*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); - } - } - else - { - for (int y = 0; y < prim->texture.height; y++) - { - copyline_palette16((UINT32*)mem->data + y*prim->texture.width, (UINT16*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); - } - } - - m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width - , (uint16_t)prim->texture.height - , 1 - , bgfx::TextureFormat::BGRA8 - , texture_flags - , mem - ); - } - break; - case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16): - { - auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); - for (int y = 0; y < prim->texture.height; y++) - { - copyline_yuy16_to_argb((UINT32*)mem->data + y*prim->texture.width, (UINT16*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette, 1); - } - m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width - , (uint16_t)prim->texture.height - , 1 - , bgfx::TextureFormat::BGRA8 - , texture_flags - , mem - ); - } - break; - case PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32): - alpha = true; - case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32): - { - if (prim->texture.rowpixels!=prim->texture.width) - { - auto mem = bgfx::alloc(prim->texture.width*prim->texture.height * 4); - if (alpha) - { - for (int y = 0; y < prim->texture.height; y++) - { - copyline_argb32((UINT32*)mem->data + y*prim->texture.width, (UINT32*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); - } - } - else - { - for (int y = 0; y < prim->texture.height; y++) - { - copyline_rgb32((UINT32*)mem->data + y*prim->texture.width, (UINT32*)prim->texture.base + y*prim->texture.rowpixels, prim->texture.width, prim->texture.palette); - } - } - - m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width - , (uint16_t)prim->texture.height - , 1 - , bgfx::TextureFormat::BGRA8 - , texture_flags - , mem - ); - } else { - m_texture = bgfx::createTexture2D((uint16_t)prim->texture.width - , (uint16_t)prim->texture.height - , 1 - , bgfx::TextureFormat::BGRA8 - , texture_flags - , bgfx::copy(prim->texture.base, prim->texture.width*prim->texture.height*4) - ); - } - } - break; - - default: - break; + put_packed_quad(prim, prim->texture.hash, (PosColorTexCoord0Vertex*)textured_buffer[blend].data + textured_vertices[blend]); + textured_vertices[blend] += 6; + } + else + { + render_textured_quad(index, prim); } - bgfx::setTexture(0, m_s_texColor, m_texture); - bgfx::setState(flags); - bgfx::submit(index, m_progQuadTexture); - bgfx::destroyTexture(m_texture); } break; @@ -962,6 +873,27 @@ int renderer_bgfx::draw(int update) } } + for (UINT32 blend_mode = 0; blend_mode < BLENDMODE_COUNT; blend_mode++) + { + if (flat_vertices[blend_mode] > 0) + { + set_bgfx_state(blend_mode); + bgfx::setVertexBuffer(&flat_buffer[blend_mode]); + bgfx::submit(index, m_progQuad); + } + } + + for (UINT32 blend_mode = 0; blend_mode < BLENDMODE_COUNT; blend_mode++) + { + if (textured_vertices[blend_mode] > 0) + { + set_bgfx_state(blend_mode); + bgfx::setVertexBuffer(&textured_buffer[blend_mode]); + bgfx::setTexture(0, m_s_texColor, m_texture_cache); + bgfx::submit(index, m_progQuadTexture); + } + } + window().m_primlist->release_lock(); // Advance to next frame. Rendering thread will be kicked to // process submitted rendering primitives. @@ -969,3 +901,170 @@ int renderer_bgfx::draw(int update) return 0; } + +void renderer_bgfx::set_bgfx_state(UINT32 blend) +{ + uint64_t flags = BGFX_STATE_RGB_WRITE | BGFX_STATE_ALPHA_WRITE | BGFX_STATE_DEPTH_TEST_ALWAYS; + + switch (blend) + { + case BLENDMODE_NONE: + bgfx::setState(flags); + break; + case BLENDMODE_ALPHA: + bgfx::setState(flags | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA)); + break; + case BLENDMODE_RGB_MULTIPLY: + bgfx::setState(flags | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO)); + break; + case BLENDMODE_ADD: + bgfx::setState(flags | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_ONE)); + break; + } +} + +void renderer_bgfx::render_flat_quad(int view, render_primitive *prim) +{ + if (bgfx::checkAvailTransientVertexBuffer(6, PosColorVertex::ms_decl)) + { + bgfx::TransientVertexBuffer vb; + bgfx::allocTransientVertexBuffer(&vb, 6, PosColorVertex::ms_decl); + PosColorVertex* vertex = (PosColorVertex*)vb.data; + + UINT32 rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255); + + vertex[0].m_x = prim->bounds.x0; + vertex[0].m_y = prim->bounds.y0; + vertex[0].m_z = 0; + vertex[0].m_rgba = rgba; + + vertex[1].m_x = prim->bounds.x1; + vertex[1].m_y = prim->bounds.y0; + vertex[1].m_z = 0; + vertex[1].m_rgba = rgba; + + vertex[2].m_x = prim->bounds.x1; + vertex[2].m_y = prim->bounds.y1; + vertex[2].m_z = 0; + vertex[2].m_rgba = rgba; + + vertex[3].m_x = prim->bounds.x1; + vertex[3].m_y = prim->bounds.y1; + vertex[3].m_z = 0; + vertex[3].m_rgba = rgba; + + vertex[4].m_x = prim->bounds.x0; + vertex[4].m_y = prim->bounds.y1; + vertex[4].m_z = 0; + vertex[4].m_rgba = rgba; + + vertex[5].m_x = prim->bounds.x0; + vertex[5].m_y = prim->bounds.y0; + vertex[5].m_z = 0; + vertex[5].m_rgba = rgba; + bgfx::setVertexBuffer(&vb); + + set_bgfx_state(PRIMFLAG_GET_BLENDMODE(prim->flags)); + bgfx::submit(view, m_progQuad); + } +} + +bool renderer_bgfx::update_atlas() +{ + bool atlas_dirty = check_for_dirty_atlas(); + + if (atlas_dirty) + { + m_hash_to_entry.clear(); + + std::vector> packed; + if (m_packer.pack(m_texinfo, packed, 1024)) + { + for (std::vector pack : packed) + { + for (rectangle_packer::packed_rectangle rect : pack) + { + if (rect.hash() == 0xffffffff) + { + continue; + } + m_hash_to_entry[rect.hash()] = rect; + const bgfx::Memory* mem = mame_texture_data_to_bgfx_texture_data(rect.format(), rect.width(), rect.height(), rect.rowpixels(), rect.palette(), rect.base()); + bgfx::updateTexture2D(m_texture_cache, 0, rect.x(), rect.y(), rect.width(), rect.height(), mem); + } + } + } + else + { + m_texinfo.clear(); + return false; + } + } + return true; +} + +bool renderer_bgfx::check_for_dirty_atlas() +{ + bool atlas_dirty = false; + + std::map acquired_infos; + for (render_primitive *prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) + { + bool pack = prim->flags & PRIMFLAG_PACKABLE; + if (prim->type == render_primitive::QUAD && prim->texture.base != nullptr && pack) + { + const UINT32 hash = prim->texture.hash; + + // If this texture is packable and not currently in the atlas, prepare the texture for putting in the atlas + if (hash != 0 && m_hash_to_entry[hash].hash() == 0 && acquired_infos[hash].hash() == 0) + { // Create create the texture and mark the atlas dirty + atlas_dirty = true; + + m_texinfo.push_back(rectangle_packer::packable_rectangle(hash, prim->flags & PRIMFLAG_TEXFORMAT_MASK, + prim->texture.width, prim->texture.height, + prim->texture.rowpixels, prim->texture.palette, prim->texture.base)); + acquired_infos[hash] = m_texinfo[m_texinfo.size() - 1]; + } + } + } + + return atlas_dirty; +} + +void renderer_bgfx::allocate_buffers(bgfx::TransientVertexBuffer *flat_buffer, bgfx::TransientVertexBuffer *textured_buffer) +{ + int flat_vertices[4] = { 0, 0, 0, 0 }; + int textured_vertices[4] = { 0, 0, 0, 0 }; + + for (render_primitive *prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) + { + switch (prim->type) + { + case render_primitive::LINE: + flat_vertices[PRIMFLAG_GET_BLENDMODE(prim->flags)] += 30; + break; + + case render_primitive::QUAD: + if (prim->flags & PRIMFLAG_PACKABLE && prim->texture.base != nullptr && prim->texture.hash != 0) + { + textured_vertices[PRIMFLAG_GET_BLENDMODE(prim->flags)] += 6; + } + break; + default: + // Do nothing + break; + } + } + + for (int blend_mode = 0; blend_mode < 4; blend_mode++) + { + if (flat_vertices[blend_mode] > 0 && bgfx::checkAvailTransientVertexBuffer(flat_vertices[blend_mode], PosColorVertex::ms_decl)) + { + bgfx::allocTransientVertexBuffer(&flat_buffer[blend_mode], flat_vertices[blend_mode], PosColorVertex::ms_decl); + } + if (textured_vertices[blend_mode] > 0 && bgfx::checkAvailTransientVertexBuffer(textured_vertices[blend_mode], PosColorTexCoord0Vertex::ms_decl)) + { + bgfx::allocTransientVertexBuffer(&textured_buffer[blend_mode], textured_vertices[blend_mode], PosColorTexCoord0Vertex::ms_decl); + } + } +} diff --git a/src/osd/modules/render/drawbgfx.h b/src/osd/modules/render/drawbgfx.h new file mode 100644 index 00000000000..b0cab8c8193 --- /dev/null +++ b/src/osd/modules/render/drawbgfx.h @@ -0,0 +1,115 @@ +#pragma once + +#ifndef __RENDER_BGFX__ +#define __RENDER_BGFX__ + +#include +#include + +#include "binpacker.h" + +/* sdl_info is the information about SDL for the current screen */ +class renderer_bgfx : public osd_renderer +{ +public: + renderer_bgfx(osd_window *w) + : osd_renderer(w, FLAG_NONE) + , m_dimensions(0, 0) + { + } + + virtual int create() override; + virtual int draw(const int update) override; +#ifdef OSD_SDL + virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override; +#else + virtual void save() override { } + virtual void record() override { } + virtual void toggle_fsfx() override { } +#endif + virtual void destroy() override; + virtual render_primitive_list *get_primitives() override + { + osd_dim wdim = window().get_size(); + window().target()->set_bounds(wdim.width(), wdim.height(), window().aspect()); + return &window().target()->get_primitives(); + } + +private: + struct PosColorTexCoord0Vertex + { + float m_x; + float m_y; + float m_z; + UINT32 m_rgba; + float m_u; + float m_v; + + static void init() + { + ms_decl.begin() + .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) + .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) + .add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float) + .end(); + } + + static bgfx::VertexDecl ms_decl; + }; + + struct PosColorVertex + { + float m_x; + float m_y; + float m_z; + UINT32 m_rgba; + + static void init() + { + ms_decl + .begin() + .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) + .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) + .end(); + } + + static bgfx::VertexDecl ms_decl; + }; + + void allocate_buffers(bgfx::TransientVertexBuffer *flat_buffer, bgfx::TransientVertexBuffer *textured_buffer); + + void render_textured_quad(int view, render_primitive* prim); + void render_flat_quad(int view, render_primitive *prim); + + void put_packed_quad(render_primitive *prim, UINT32 hash, PosColorTexCoord0Vertex* vertex); + void put_polygon(const float* coords, UINT32 num_coords, float r, UINT32 rgba, PosColorVertex* vertex); + void put_line(float x0, float y0, float x1, float y1, float r, UINT32 rgba, PosColorVertex* vertex, float fth = 1.0f); + + void set_bgfx_state(UINT32 blend); + + uint32_t u32Color(uint32_t r, uint32_t g, uint32_t b, uint32_t a); + + bool check_for_dirty_atlas(); + bool update_atlas(); + const bgfx::Memory* mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base); + + bgfx::ProgramHandle loadProgram(bx::FileReaderI* _reader, const char* _vsName, const char* _fsName); + bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName); + + bgfx::ProgramHandle m_progQuad; + bgfx::ProgramHandle m_progQuadTexture; + bgfx::UniformHandle m_s_texColor; + bgfx::FrameBufferHandle fbh; + bgfx::TextureHandle m_texture_cache; + + // Original display_mode + osd_dim m_dimensions; + + std::map m_hash_to_entry; + std::vector m_texinfo; + rectangle_packer m_packer; + + static const uint16_t CACHE_SIZE = 1024; +}; + +#endif \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 51eb416088a2f549e461ff0de5290d17dd224da5 Mon Sep 17 00:00:00 2001 From: "therealmogminer@gmail.com" Date: Mon, 15 Feb 2016 18:26:40 +0100 Subject: Hopefully fix text being weirdly rotated --- src/emu/render.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emu/render.h b/src/emu/render.h index 0fda591381a..ab464879ec7 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -107,7 +107,7 @@ const UINT32 PRIMFLAG_TYPE_MASK = 3 << PRIMFLAG_TYPE_SHIFT; const UINT32 PRIMFLAG_TYPE_LINE = 0 << PRIMFLAG_TYPE_SHIFT; const UINT32 PRIMFLAG_TYPE_QUAD = 1 << PRIMFLAG_TYPE_SHIFT; -const int PRIMFLAG_PACKABLE_SHIFT = 1; +const int PRIMFLAG_PACKABLE_SHIFT = 21; const UINT32 PRIMFLAG_PACKABLE = 1 << PRIMFLAG_PACKABLE_SHIFT; //************************************************************************** -- cgit v1.2.3-70-g09d2 From 4e7f9e86e81af80de19f90b50632a1b579d9e4c3 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Wed, 9 Dec 2015 09:41:34 -0600 Subject: Refactor MACOSX_USE_LIBSDL to USE_LIBSDL for windows and linux static library support (nw) --- makefile | 6 ++--- scripts/src/osd/sdl.lua | 54 +++++++++++++++++++++++++++------------------ scripts/src/osd/sdl_cfg.lua | 2 +- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/makefile b/makefile index 3f33bca63b3..88efddeb946 100644 --- a/makefile +++ b/makefile @@ -69,7 +69,7 @@ # SDL_INSTALL_ROOT = /opt/sdl2 # SDL_FRAMEWORK_PATH = $(HOME)/Library/Frameworks # SDL_LIBVER = sdl -# MACOSX_USE_LIBSDL = 1 +# USE_LIBSDL = 1 # CYGWIN_BUILD = 1 # BUILDDIR = build @@ -627,8 +627,8 @@ ifdef SDL_FRAMEWORK_PATH PARAMS += --SDL_FRAMEWORK_PATH='$(SDL_FRAMEWORK_PATH)' endif -ifdef MACOSX_USE_LIBSDL -PARAMS += --MACOSX_USE_LIBSDL='$(MACOSX_USE_LIBSDL)' +ifdef USE_LIBSDL +PARAMS += --USE_LIBSDL='$(USE_LIBSDL)' endif ifdef LDOPTS diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 6acb5a2d262..fd8cf22b026 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -54,14 +54,20 @@ function maintargetosdoptions(_target,_subtarget) end if _OPTIONS["targetos"]=="windows" then - if _OPTIONS["SDL_LIBVER"]=="sdl2" then - links { - "SDL2.dll", - } + if _OPTIONS["USE_LIBSDL"]~="1" then + if _OPTIONS["SDL_LIBVER"]=="sdl2" then + links { + "SDL2.dll", + } + else + links { + "SDL.dll", + } + end else - links { - "SDL.dll", - } + local str = backtick(sdlconfigcmd() .. " --libs | sed 's/ -lSDLmain//'") + addlibfromstring(str) + addoptionsfromstring(str) end links { "psapi", @@ -192,16 +198,16 @@ if not _OPTIONS["SDL_FRAMEWORK_PATH"] then end newoption { - trigger = "MACOSX_USE_LIBSDL", - description = "Use SDL library on OS (rather than framework)", + trigger = "USE_LIBSDL", + description = "Use SDL library on OS (rather than framework/dll)", allowed = { - { "0", "Use framework" }, + { "0", "Use framework/dll" }, { "1", "Use library" }, }, } -if not _OPTIONS["MACOSX_USE_LIBSDL"] then - _OPTIONS["MACOSX_USE_LIBSDL"] = "0" +if not _OPTIONS["USE_LIBSDL"] then + _OPTIONS["USE_LIBSDL"] = "0" end @@ -255,7 +261,7 @@ if BASE_TARGETOS=="unix" then "-weak_framework Metal", } end - if _OPTIONS["MACOSX_USE_LIBSDL"]~="1" then + if _OPTIONS["USE_LIBSDL"]~="1" then linkoptions { "-F" .. _OPTIONS["SDL_FRAMEWORK_PATH"], } @@ -269,7 +275,7 @@ if BASE_TARGETOS=="unix" then } end else - local str = backtick(sdlconfigcmd() .. " --libs | sed 's/-lSDLmain//'") + local str = backtick(sdlconfigcmd() .. " --libs --static | sed 's/-lSDLmain//'") addlibfromstring(str) addoptionsfromstring(str) end @@ -529,14 +535,20 @@ if _OPTIONS["with-tools"] then } if _OPTIONS["targetos"] == "windows" then - if _OPTIONS["SDL_LIBVER"] == "sdl2" then - links { - "SDL2.dll", - } + if _OPTIONS["USE_LIBSDL"]~="1" then + if _OPTIONS["SDL_LIBVER"] == "sdl2" then + links { + "SDL2.dll", + } + else + links { + "SDL.dll", + } + end else - links { - "SDL.dll", - } + local str = backtick(sdlconfigcmd() .. " --libs | sed 's/ -lSDLmain//'") + addlibfromstring(str) + addoptionsfromstring(str) end links { "psapi", diff --git a/scripts/src/osd/sdl_cfg.lua b/scripts/src/osd/sdl_cfg.lua index dd902d1fe60..431443ac059 100644 --- a/scripts/src/osd/sdl_cfg.lua +++ b/scripts/src/osd/sdl_cfg.lua @@ -81,7 +81,7 @@ if BASE_TARGETOS=="unix" then "SDLMAME_UNIX", } if _OPTIONS["targetos"]=="macosx" then - if _OPTIONS["MACOSX_USE_LIBSDL"]~="1" then + if _OPTIONS["USE_LIBSDL"]~="1" then buildoptions { "-F" .. _OPTIONS["SDL_FRAMEWORK_PATH"], } -- cgit v1.2.3-70-g09d2 From 36df7413dce0897215d3e01e54ac5334bb65d965 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Mon, 2 Nov 2015 21:05:34 -0600 Subject: add TOOLCHAIN make flag for explicit toolchain prefix cross compiling (nw) --- makefile | 20 ++++++++++++-------- scripts/genie.lua | 9 +++++++++ scripts/src/osd/sdl.lua | 2 +- scripts/toolchain.lua | 47 +++++++++++++++++++++++++++-------------------- 4 files changed, 49 insertions(+), 29 deletions(-) diff --git a/makefile b/makefile index 88efddeb946..cf6c49c75ff 100644 --- a/makefile +++ b/makefile @@ -75,6 +75,7 @@ # BUILDDIR = build # TARGETOS = windows # CROSS_BUILD = 1 +# TOOLCHAIN = # OVERRIDE_CC = cc # OVERRIDE_CXX = c++ # OVERRIDE_LD = ld @@ -270,9 +271,9 @@ WINDRES := $(MINGW32)/bin/windres endif else ifeq ($(ARCHITECTURE),_x64) -WINDRES := x86_64-w64-mingw32-windres +WINDRES := $(word 1,$(TOOLCHAIN) x86_64-w64-mingw32-)windres else -WINDRES := i686-w64-mingw32-windres +WINDRES := $(word 1,$(TOOLCHAIN) i686-w64-mingw32-)windres endif endif @@ -407,6 +408,9 @@ endif PARAMS+= --distro=$(DISTRO) +ifdef TOOLCHAIN +PARAMS += --TOOLCHAIN='$(TOOLCHAIN)' +endif ifdef OVERRIDE_CC PARAMS += --CC='$(OVERRIDE_CC)' ifndef CROSS_BUILD @@ -777,12 +781,12 @@ endif ifeq ($(OS),windows) ifeq (posix,$(SHELLTYPE)) -GCC_VERSION := $(shell $(subst @,,$(CC)) -dumpversion 2> /dev/null) -CLANG_VERSION := $(shell $(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$$/\1/" | head -n 1) +GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> /dev/null) +CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$$/\1/" | head -n 1) PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python) else -GCC_VERSION := $(shell $(subst @,,$(CC)) -dumpversion 2> NUL) -CLANG_VERSION := $(shell $(subst @,,$(CC)) --version 2> NUL| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$$/\1/" | head -n 1) +GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> NUL) +CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> NUL| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$$/\1/" | head -n 1) PYTHON_AVAILABLE := $(shell $(PYTHON) --version > NUL 2>&1 && echo python) endif ifdef MSBUILD @@ -799,9 +803,9 @@ MSBUILD_PARAMS += /p:Platform=win32 endif endif else -GCC_VERSION := $(shell $(subst @,,$(CC)) -dumpversion 2> /dev/null) +GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> /dev/null) ifneq ($(OS),solaris) -CLANG_VERSION := $(shell $(subst @,,$(CC)) --version 2> /dev/null | head -n 1 | grep -e 'version [0-9]\.[0-9]\(\.[0-9]\)\?' -o | grep -e '[0-9]\.[0-9]\(\.[0-9]\)\?' -o | tail -n 1) +CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null | head -n 1 | grep -e 'version [0-9]\.[0-9]\(\.[0-9]\)\?' -o | grep -e '[0-9]\.[0-9]\(\.[0-9]\)\?' -o | tail -n 1) endif PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python) endif diff --git a/scripts/genie.lua b/scripts/genie.lua index 4384b9f379b..8d52dc75391 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -197,6 +197,11 @@ newoption { description = "LD replacement", } +newoption { + trigger = "TOOLCHAIN", + description = "Toolchain prefix" +} + newoption { trigger = "PROFILE", description = "Enable profiling.", @@ -427,6 +432,10 @@ if(_OPTIONS["USE_BGFX"]~=nil) then USE_BGFX = tonumber(_OPTIONS["USE_BGFX"]) end +if(_OPTIONS["TOOLCHAIN"] == nil) then + _OPTIONS['TOOLCHAIN'] = "" +end + GEN_DIR = MAME_BUILD_DIR .. "generated/" if (_OPTIONS["target"] == nil) then return false end diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index fd8cf22b026..6a63e7caf91 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -106,7 +106,7 @@ end function sdlconfigcmd() if not _OPTIONS["SDL_INSTALL_ROOT"] then - return _OPTIONS["SDL_LIBVER"] .. "-config" + return _OPTIONS['TOOLCHAIN'] .. "pkg-config " .. _OPTIONS["SDL_LIBVER"] else return path.join(_OPTIONS["SDL_INSTALL_ROOT"],"bin",_OPTIONS["SDL_LIBVER"]) .. "-config" end diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index 27b571e18d0..aaf8811fed1 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -4,6 +4,11 @@ -- local naclToolchain = "" +local toolchainPrefix = "" + +if _OPTIONS['TOOLCHAIN'] then + toolchainPrefix = _OPTIONS["TOOLCHAIN"] +end newoption { trigger = "gcc", @@ -204,15 +209,18 @@ function toolchain(_buildDir, _subDir) if not os.getenv("MINGW32") then print("Set MINGW32 envrionment variable.") end - premake.gcc.cc = "$(MINGW32)/bin/i686-w64-mingw32-gcc" - premake.gcc.cxx = "$(MINGW32)/bin/i686-w64-mingw32-g++" + if not toolchainPrefix then + toolchainPrefix = "$(MINGW32)/bin/i686-w64-mingw32-" + end + premake.gcc.cc = toolchainPrefix .. "gcc" + premake.gcc.cxx = toolchainPrefix .. "g++" -- work around GCC 4.9.2 not having proper linker for LTO=1 usage local version_4_ar = str_to_version(_OPTIONS["gcc_version"]) if (version_4_ar < 50000) then - premake.gcc.ar = "$(MINGW32)/bin/ar" + premake.gcc.ar = toolchainPrefix .. "ar" end if (version_4_ar >= 50000) then - premake.gcc.ar = "$(MINGW32)/bin/gcc-ar" + premake.gcc.ar = toolchainPrefix .. "gcc-ar" end location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw32-gcc") end @@ -221,20 +229,22 @@ function toolchain(_buildDir, _subDir) if not os.getenv("MINGW64") then print("Set MINGW64 envrionment variable.") end - premake.gcc.cc = "$(MINGW64)/bin/x86_64-w64-mingw32-gcc" - premake.gcc.cxx = "$(MINGW64)/bin/x86_64-w64-mingw32-g++" + if not toolchainPrefix then + toolchainPrefix = "$(MINGW64)/bin/x86_64-w64-mingw32-" + end + premake.gcc.cc = toolchainPrefix .. "gcc" + premake.gcc.cxx = toolchainPrefix .. "g++" -- work around GCC 4.9.2 not having proper linker for LTO=1 usage local version_4_ar = str_to_version(_OPTIONS["gcc_version"]) if (version_4_ar < 50000) then - premake.gcc.ar = "$(MINGW64)/bin/ar" + premake.gcc.ar = toolchainPrefix .. "ar" end if (version_4_ar >= 50000) then - premake.gcc.ar = "$(MINGW64)/bin/gcc-ar" + premake.gcc.ar = toolchainPrefix .. "gcc-ar" end location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw64-gcc") end - if "mingw-clang" == _OPTIONS["gcc"] then premake.gcc.cc = "clang" premake.gcc.cxx = "clang++" @@ -283,18 +293,17 @@ function toolchain(_buildDir, _subDir) if "osx" == _OPTIONS["gcc"] then if os.is("linux") then - local osxToolchain = "x86_64-apple-darwin13-" - premake.gcc.cc = osxToolchain .. "clang" - premake.gcc.cxx = osxToolchain .. "clang++" - premake.gcc.ar = osxToolchain .. "ar" + premake.gcc.cc = toolchainPrefix .. "clang" + premake.gcc.cxx = toolchainPrefix .. "clang++" + premake.gcc.ar = toolchainPrefix .. "ar" end location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-osx") end if "osx-clang" == _OPTIONS["gcc"] then - premake.gcc.cc = "clang" - premake.gcc.cxx = "clang++" - premake.gcc.ar = "ar" + premake.gcc.cc = toolchainPrefix .. "clang" + premake.gcc.cxx = toolchainPrefix .. "clang++" + premake.gcc.ar = toolchainPrefix .. "ar" location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-osx-clang") end @@ -911,7 +920,6 @@ function toolchain(_buildDir, _subDir) end function strip() - configuration { "android-arm", "Release" } postbuildcommands { "$(SILENT) echo Stripping symbols.", @@ -939,13 +947,12 @@ function strip() configuration { "mingw*", "x64", "Release" } postbuildcommands { "$(SILENT) echo Stripping symbols.", - "$(SILENT) $(MINGW64)/bin/strip -s \"$(TARGET)\"", + "$(SILENT) " .. (_OPTIONS['TOOLCHAIN'] and toolchainPrefix or "$(MINGW64)/bin/") .. "strip -s \"$(TARGET)\"", } - configuration { "mingw*", "x32", "Release" } postbuildcommands { "$(SILENT) echo Stripping symbols.", - "$(SILENT) $(MINGW32)/bin/strip -s \"$(TARGET)\"" + "$(SILENT) " .. (_OPTIONS['TOOLCHAIN'] and toolchainPrefix or "$(MINGW32)/bin/") .. "strip -s \"$(TARGET)\"", } configuration { "pnacl" } -- cgit v1.2.3-70-g09d2 From 3570d4f0ebde2977fb8301f8f9a1c942cb149b17 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Mon, 2 Nov 2015 21:08:15 -0600 Subject: check STRIP_SYMBOLS in strip function and add strip support for osx (nw) --- scripts/genie.lua | 5 +---- scripts/src/osd/sdl.lua | 4 ++++ scripts/src/tools.lua | 31 +++++++++++++++++++++++++++++++ scripts/toolchain.lua | 10 ++++++++++ 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/scripts/genie.lua b/scripts/genie.lua index 8d52dc75391..dd955bd0ce9 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1309,10 +1309,7 @@ else startproject (_OPTIONS["subtarget"]) end mainProject(_OPTIONS["target"],_OPTIONS["subtarget"]) - -if (_OPTIONS["STRIP_SYMBOLS"]=="1") then - strip() -end +strip() if _OPTIONS["with-tools"] then group "tools" diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 6a63e7caf91..8ac53f39173 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -565,6 +565,8 @@ if _OPTIONS["with-tools"] then MAME_DIR .. "src/osd/sdl/SDLMain_tmpl.mm", } end + + strip() end @@ -606,4 +608,6 @@ if _OPTIONS["targetos"] == "macosx" and _OPTIONS["with-tools"] then files { MAME_DIR .. "src/osd/sdl/aueffectutil.mm", } + + strip() end diff --git a/scripts/src/tools.lua b/scripts/src/tools.lua index 19942651f0c..c3ed2654782 100644 --- a/scripts/src/tools.lua +++ b/scripts/src/tools.lua @@ -50,6 +50,8 @@ files { MAME_DIR .. "src/tools/romcmp.cpp", } +strip() + -------------------------------------------------- -- chdman -------------------------------------------------- @@ -104,6 +106,8 @@ files { MAME_DIR .. "src/version.cpp", } +strip() + -------------------------------------------------- -- jedutil -------------------------------------------------- @@ -145,6 +149,8 @@ files { MAME_DIR .. "src/tools/jedutil.cpp", } +strip() + -------------------------------------------------- -- unidasm -------------------------------------------------- @@ -201,6 +207,7 @@ files { MAME_DIR .. "src/emu/emucore.cpp", } +strip() -------------------------------------------------- -- ldresample @@ -255,6 +262,8 @@ files { MAME_DIR .. "src/tools/ldresample.cpp", } +strip() + -------------------------------------------------- -- ldverify -------------------------------------------------- @@ -308,6 +317,8 @@ files { MAME_DIR .. "src/tools/ldverify.cpp", } +strip() + -------------------------------------------------- -- regrep -------------------------------------------------- @@ -349,6 +360,8 @@ files { MAME_DIR .. "src/tools/regrep.cpp", } +strip() + -------------------------------------------------- -- srcclean --------------------------------------------------- @@ -390,6 +403,8 @@ files { MAME_DIR .. "src/tools/srcclean.cpp", } +strip() + -------------------------------------------------- -- src2html -------------------------------------------------- @@ -431,6 +446,8 @@ files { MAME_DIR .. "src/tools/src2html.cpp", } +strip() + -------------------------------------------------- -- split -------------------------------------------------- @@ -483,6 +500,8 @@ files { MAME_DIR .. "src/tools/split.cpp", } +strip() + -------------------------------------------------- -- pngcmp -------------------------------------------------- @@ -524,6 +543,8 @@ files { MAME_DIR .. "src/tools/pngcmp.cpp", } +strip() + -------------------------------------------------- -- nltool -------------------------------------------------- @@ -578,6 +599,8 @@ files { MAME_DIR .. "src/lib/netlist/prg/nltool.cpp", } +strip() + -------------------------------------------------- -- nlwav -------------------------------------------------- @@ -610,6 +633,8 @@ files { MAME_DIR .. "src/lib/netlist/prg/nlwav.cpp", } +strip() + -------------------------------------------------- -- castool -------------------------------------------------- @@ -664,6 +689,8 @@ files { MAME_DIR .. "src/tools/castool.cpp", } +strip() + -------------------------------------------------- -- floptool -------------------------------------------------- @@ -719,6 +746,8 @@ files { MAME_DIR .. "src/tools/floptool.cpp", } +strip() + -------------------------------------------------- -- imgtool -------------------------------------------------- @@ -822,3 +851,5 @@ files { MAME_DIR .. "src/tools/imgtool/modules/bml3.cpp", MAME_DIR .. "src/tools/imgtool/modules/hp48.cpp", } + +strip() diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index aaf8811fed1..40690b00831 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -920,6 +920,16 @@ function toolchain(_buildDir, _subDir) end function strip() + if not _OPTIONS["STRIP_SYMBOLS"]=="1" then + return true + end + + configuration { "osx-*", "Release" } + postbuildcommands { + "$(SILENT) echo Stripping symbols.", + "$(SILENT) " .. (_OPTIONS['TOOLCHAIN'] and toolchainPrefix) .. "strip \"$(TARGET)\"", + } + configuration { "android-arm", "Release" } postbuildcommands { "$(SILENT) echo Stripping symbols.", -- cgit v1.2.3-70-g09d2 From 591d1202ac2b9f75fdf957061ec42a04b644d2a5 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Tue, 3 Nov 2015 00:29:49 -0600 Subject: fix cross compile windows targetextension (nw) --- scripts/src/osd/sdl.lua | 5 ++++ scripts/src/tools.lua | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 8ac53f39173..edac636a8ad 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -566,6 +566,11 @@ if _OPTIONS["with-tools"] then } end + configuration { "mingw*" or "vs*" } + targetextension ".exe" + + configuration { } + strip() end diff --git a/scripts/src/tools.lua b/scripts/src/tools.lua index c3ed2654782..421f5cc76b5 100644 --- a/scripts/src/tools.lua +++ b/scripts/src/tools.lua @@ -50,6 +50,11 @@ files { MAME_DIR .. "src/tools/romcmp.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -106,6 +111,11 @@ files { MAME_DIR .. "src/version.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -149,6 +159,11 @@ files { MAME_DIR .. "src/tools/jedutil.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -207,6 +222,11 @@ files { MAME_DIR .. "src/emu/emucore.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -262,6 +282,11 @@ files { MAME_DIR .. "src/tools/ldresample.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -317,6 +342,11 @@ files { MAME_DIR .. "src/tools/ldverify.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -360,6 +390,11 @@ files { MAME_DIR .. "src/tools/regrep.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -403,6 +438,11 @@ files { MAME_DIR .. "src/tools/srcclean.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -446,6 +486,11 @@ files { MAME_DIR .. "src/tools/src2html.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -500,6 +545,11 @@ files { MAME_DIR .. "src/tools/split.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -543,6 +593,11 @@ files { MAME_DIR .. "src/tools/pngcmp.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -599,6 +654,11 @@ files { MAME_DIR .. "src/lib/netlist/prg/nltool.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -633,6 +693,11 @@ files { MAME_DIR .. "src/lib/netlist/prg/nlwav.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -689,6 +754,11 @@ files { MAME_DIR .. "src/tools/castool.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -746,6 +816,11 @@ files { MAME_DIR .. "src/tools/floptool.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -------------------------------------------------- @@ -852,4 +927,9 @@ files { MAME_DIR .. "src/tools/imgtool/modules/hp48.cpp", } +configuration { "mingw*" or "vs*" } + targetextension ".exe" + +configuration { } + strip() -- cgit v1.2.3-70-g09d2 From 43cb7eb2e69c16e7a9a3c1f4043bce6dd2b78e07 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Mon, 2 Nov 2015 20:41:18 -0600 Subject: genie make targets for packager scripts (nw) --- makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index cf6c49c75ff..a70d6a6db12 100644 --- a/makefile +++ b/makefile @@ -1240,10 +1240,13 @@ $(GENIE): $(GENIE_SRC) 3rdparty/genie/src/hosts/%.c: -clean: +.PHONY: genieclean +genieclean: + $(SILENT) $(MAKE) $(MAKEPARAMS) -C 3rdparty/genie/build/gmake.$(GENIEOS) -f genie.make clean + +clean: genieclean @echo Cleaning... -@rm -rf $(BUILDDIR) - $(SILENT) $(MAKE) $(MAKEPARAMS) -C 3rdparty/genie/build/gmake.$(GENIEOS) -f genie.make clean $(SILENT) $(MAKE) -C $(SRC)/devices/cpu/m68000 clean GEN_FOLDERS := $(GENDIR)/$(TARGET)/layout/ $(GENDIR)/$(TARGET)/$(SUBTARGET)/ @@ -1261,8 +1264,10 @@ endif $(GEN_FOLDERS): -$(call MKDIR,$@) +genie: $(GENIE) + generate: \ - $(GENIE) \ + genie \ $(GEN_FOLDERS) \ $(patsubst $(SRC)/%.lay,$(GENDIR)/%.lh,$(LAYOUTS)) \ $(SRC)/devices/cpu/m68000/m68kops.cpp -- cgit v1.2.3-70-g09d2 From 726d141193deaab9f9e5c915e4bd24ff46195f8c Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Tue, 3 Nov 2015 08:53:15 -0600 Subject: fix windows bgfx library link in sdl builds (nw) --- scripts/src/osd/sdl.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index edac636a8ad..591b75d0b29 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -99,6 +99,11 @@ function maintargetosdoptions(_target,_subtarget) configuration { "mingw*" or "vs*" } targetprefix "sdl" + if USE_BGFX == 1 then + links { + "psapi" + } + end configuration { } end -- cgit v1.2.3-70-g09d2 From 1ddc780160b8ba5bf0ab29b757e591700434e525 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Mon, 4 Jan 2016 21:41:56 -0600 Subject: osx clang, silence flac unknown attribute error (nw) --- scripts/src/3rdparty.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index ef46f1cab24..34376515c64 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -280,6 +280,11 @@ end buildoptions { "-Wno-enum-conversion", } + if _OPTIONS["targetos"]=="macosx" then + buildoptions_c { + "-Wno-unknown-attributes", + } + end end configuration { } -- cgit v1.2.3-70-g09d2 From b0607ac0576b3fd53149c99b5adec26311334098 Mon Sep 17 00:00:00 2001 From: cracyc Date: Mon, 15 Feb 2016 12:20:29 -0600 Subject: pc9801: no 32 (nw) --- src/mame/drivers/pc9801.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index 7185014c285..bd4e6c6fc5c 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -3689,6 +3689,10 @@ ROM_START( pc9821 ) ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) ROM_LOAD( "itf.rom", 0x18000, 0x08000, CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) ROM_LOAD( "bios.rom", 0x28000, 0x18000, BAD_DUMP CRC(34a19a59) SHA1(2e92346727b0355bc1ec9a7ded1b444a4917f2b9) ) + ROM_FILL(0x34c40, 4, 0) // hide the _32_ marker until we have a 32-bit clean IDE bios otherwise windows tries to + // make a 32-bit call into 16-bit code + ROM_FILL(0x37ffe, 1, 0x92) + ROM_FILL(0x37fff, 1, 0xd7) ROM_REGION( 0x10000, "sound_bios", 0 ) ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) -- cgit v1.2.3-70-g09d2 From 249b5f0b96e5cf68013055553b0892c538668f0f Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 15 Feb 2016 20:05:47 +0100 Subject: fixed logic in expression (nw) --- scripts/toolchain.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index 40690b00831..137a873ae09 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -920,7 +920,7 @@ function toolchain(_buildDir, _subDir) end function strip() - if not _OPTIONS["STRIP_SYMBOLS"]=="1" then + if _OPTIONS["STRIP_SYMBOLS"]~="1" then return true end -- cgit v1.2.3-70-g09d2 From 622df200dede8636585edf2c59c0a509139bfc73 Mon Sep 17 00:00:00 2001 From: "therealmogminer@gmail.com" Date: Mon, 15 Feb 2016 20:22:04 +0100 Subject: Fix errors with -rol and -ror, nw --- src/emu/render.cpp | 12 ++---- src/emu/render.h | 2 +- src/osd/modules/render/drawbgfx.cpp | 75 +++++++++++++++++++++++++------------ 3 files changed, 56 insertions(+), 33 deletions(-) diff --git a/src/emu/render.cpp b/src/emu/render.cpp index cbcfd6b16b3..8cb58de116f 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -442,7 +442,7 @@ void render_texture::hq_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const // get_scaled - get a scaled bitmap (if we can) //------------------------------------------------- -void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, bool packable) +void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, UINT32 flags) { texinfo.hash = 0; @@ -524,11 +524,7 @@ void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &t } UINT32 hash = 0; - if (packable) - { - //printf("Packable, %d, %d\n", texinfo.width, texinfo.height); - } - if (packable && texinfo.width <= 128 && texinfo.height <= 128) + if ((flags & PRIMFLAG_PACKABLE) && texinfo.width <= 128 && texinfo.height <= 128) { hash = reinterpret_cast(texinfo.base) & 0xffffffff; } @@ -1764,7 +1760,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const width = MIN(width, m_maxtexwidth); height = MIN(height, m_maxtexheight); - curitem->texture()->get_scaled(width, height, prim->texture, list, (curitem->flags() & PRIMFLAG_PACKABLE) ? true : false); + curitem->texture()->get_scaled(width, height, prim->texture, list, curitem->flags()); // set the palette prim->texture.palette = curitem->texture()->get_adjusted_palette(container); @@ -1867,7 +1863,7 @@ void render_target::add_element_primitives(render_primitive_list &list, const ob // get the scaled texture and append it - texture->get_scaled(width, height, prim->texture, list, (prim->flags & PRIMFLAG_PACKABLE) ? true : false); + texture->get_scaled(width, height, prim->texture, list, prim->flags); // compute the clip rect render_bounds cliprect; diff --git a/src/emu/render.h b/src/emu/render.h index ab464879ec7..1761deb2f20 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -436,7 +436,7 @@ public: private: // internal helpers - void get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, bool packable = false); + void get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, UINT32 flags = 0); const rgb_t *get_adjusted_palette(render_container &container); static const int MAX_TEXTURE_SCALES = 16; diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 707360053aa..4e7c7f15e43 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -283,47 +283,74 @@ void renderer_bgfx::put_packed_quad(render_primitive *prim, UINT32 hash, PosColo float v1 = v0 + float(rect.height()) / float(CACHE_SIZE); UINT32 rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255); - vertex[0].m_x = prim->bounds.x0; - vertex[0].m_y = prim->bounds.y0; + float x[4] = { prim->bounds.x0, prim->bounds.x1, prim->bounds.x0, prim->bounds.x1 }; + float y[4] = { prim->bounds.y0, prim->bounds.y0, prim->bounds.y1, prim->bounds.y1 }; + float u[4] = { u0, u1, u0, u1 }; + float v[4] = { v0, v0, v1, v1 }; + + if (PRIMFLAG_GET_TEXORIENT(prim->flags) & ORIENTATION_SWAP_XY) + { + std::swap(u[1], u[2]); + std::swap(v[1], v[2]); + } + + if (PRIMFLAG_GET_TEXORIENT(prim->flags) & ORIENTATION_FLIP_X) + { + std::swap(u[0], u[1]); + std::swap(v[0], v[1]); + std::swap(u[2], u[3]); + std::swap(v[2], v[3]); + } + + if (PRIMFLAG_GET_TEXORIENT(prim->flags) & ORIENTATION_FLIP_Y) + { + std::swap(u[0], u[2]); + std::swap(v[0], v[2]); + std::swap(u[1], u[3]); + std::swap(v[1], v[3]); + } + + vertex[0].m_x = x[0]; // 0 + vertex[0].m_y = y[0]; vertex[0].m_z = 0; vertex[0].m_rgba = rgba; - vertex[0].m_u = u0; - vertex[0].m_v = v0; + vertex[0].m_u = u[0]; + vertex[0].m_v = v[0]; - vertex[1].m_x = prim->bounds.x1; - vertex[1].m_y = prim->bounds.y0; + vertex[1].m_x = x[1]; // 1 + vertex[1].m_y = y[1]; vertex[1].m_z = 0; vertex[1].m_rgba = rgba; - vertex[1].m_u = u1; - vertex[1].m_v = v0; + vertex[1].m_u = u[1]; + vertex[1].m_v = v[1]; - vertex[2].m_x = prim->bounds.x1; - vertex[2].m_y = prim->bounds.y1; + vertex[2].m_x = x[3]; // 3 + vertex[2].m_y = y[3]; vertex[2].m_z = 0; vertex[2].m_rgba = rgba; - vertex[2].m_u = u1; - vertex[2].m_v = v1; + vertex[2].m_u = u[3]; + vertex[2].m_v = v[3]; - vertex[3].m_x = prim->bounds.x1; - vertex[3].m_y = prim->bounds.y1; + vertex[3].m_x = x[3]; // 3 + vertex[3].m_y = y[3]; vertex[3].m_z = 0; vertex[3].m_rgba = rgba; - vertex[3].m_u = u1; - vertex[3].m_v = v1; + vertex[3].m_u = u[3]; + vertex[3].m_v = v[3]; - vertex[4].m_x = prim->bounds.x0; - vertex[4].m_y = prim->bounds.y1; + vertex[4].m_x = x[2]; // 2 + vertex[4].m_y = y[2]; vertex[4].m_z = 0; vertex[4].m_rgba = rgba; - vertex[4].m_u = u0; - vertex[4].m_v = v1; + vertex[4].m_u = u[2]; + vertex[4].m_v = v[2]; - vertex[5].m_x = prim->bounds.x0; - vertex[5].m_y = prim->bounds.y0; + vertex[5].m_x = x[0]; // 0 + vertex[5].m_y = y[0]; vertex[5].m_z = 0; vertex[5].m_rgba = rgba; - vertex[5].m_u = u0; - vertex[5].m_v = v0; + vertex[5].m_u = u[0]; + vertex[5].m_v = v[0]; } void renderer_bgfx::render_textured_quad(int view, render_primitive* prim) -- cgit v1.2.3-70-g09d2 From 3f04c5f93295cd113181f28673ecb22575b4ce2d Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Mon, 15 Feb 2016 20:29:40 +0100 Subject: dsplmenu: fixed display options. nw --- src/emu/ui/dsplmenu.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp index 57797f6281e..01ee9c19578 100644 --- a/src/emu/ui/dsplmenu.cpp +++ b/src/emu/ui/dsplmenu.cpp @@ -79,7 +79,11 @@ ui_menu_display_options::ui_menu_display_options(running_machine &machine, rende break; p2 = descr.find_first_of(delim, p1 + 1); if (p2 != std::string::npos) + { + std::string txt(descr.substr(p1, p2 - p1)); + if (txt != "or" && txt != "none") m_list.push_back(descr.substr(p1, p2 - p1)); + } else { m_list.push_back(descr.substr(p1)); -- cgit v1.2.3-70-g09d2 From fec7343484e2154bc254951696862c0b749aae52 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 15 Feb 2016 21:24:58 +0100 Subject: New Working machine added -------------------- Coleco Electronic Quarterback [hap, Sean Riddle] --- src/mame/drivers/fidel68k.cpp | 2 +- src/mame/drivers/hh_tms1k.cpp | 326 +++++++++++++++++++++++++++++------------- src/mame/drivers/k28.cpp | 27 ++-- src/mame/includes/hh_tms1k.h | 1 + src/mame/layout/cqback.lay | 178 +++++++++++++++++++++++ src/mame/layout/h2hfootb.lay | 3 +- src/mame/mess.lst | 1 + 7 files changed, 427 insertions(+), 111 deletions(-) create mode 100644 src/mame/layout/cqback.lay diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp index 8c8f1c20dcd..7d79c26448c 100644 --- a/src/mame/drivers/fidel68k.cpp +++ b/src/mame/drivers/fidel68k.cpp @@ -294,4 +294,4 @@ ROM_END ******************************************************************************/ /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1989, feagv2, 0, 0, eag, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde (model 6114)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1989, feagv2, 0, 0, eag, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde (model 6114-2/3/4)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 68e14d4514b..ec688984120 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -47,7 +47,7 @@ MP3403 TMS1100 1978, Marx Electronic Bowling -> elecbowl.cpp @MP3404 TMS1100 1978, Parker Brothers Merlin @MP3405 TMS1100 1979, Coleco Amaze-A-Tron - *MP3415 TMS1100 1978, Coleco Electronic Quarterback + @MP3415 TMS1100 1978, Coleco Electronic Quarterback @MP3438A TMS1100 1979, Kenner Star Wars Electronic Battle Command MP3450A TMS1100 1979, MicroVision cartridge: Blockbuster MP3454 TMS1100 1979, MicroVision cartridge: Star Trek Phaser Strike @@ -115,6 +115,7 @@ #include "bigtrak.lh" #include "cnsector.lh" #include "comp4.lh" +#include "cqback.lh" #include "ebball.lh" #include "ebball2.lh" #include "ebball3.lh" @@ -316,6 +317,19 @@ UINT8 hh_tms1k_state::read_inputs(int columns) return ret; } +UINT8 hh_tms1k_state::read_rotated_inputs(int columns, UINT8 rowmask) +{ + UINT8 ret = 0; + UINT16 colmask = (1 << columns) - 1; + + // read selected input columns + for (int i = 0; i < 8; i++) + if (1 << i & rowmask && m_inp_matrix[i]->read() & m_inp_mux & colmask) + ret |= 1 << i; + + return ret; +} + // devices with a TMS0980 can auto power-off @@ -673,21 +687,20 @@ MACHINE_CONFIG_END /*************************************************************************** - Coleco Head to Head Baseball - * PCB labels Coleco rev C 73891/2 - * TMS1170NLN MP1525-N2 (die labeled MP1525) - * 9-digit cyan VFD display, and other LEDs behind bezel, 1bit sound + Coleco Electronic Quarterback + * TMS1100NLL MP3415 (die labeled MP3415) + * 9-digit LED grid, 1bit sound known releases: - - USA: Head to Head Baseball - - Japan: Computer Baseball, published by Tsukuda + - USA(1): Electronic Quarterback + - USA(2): Electronic Touchdown, distributed by Sears ***************************************************************************/ -class h2hbaseb_state : public hh_tms1k_state +class cqback_state : public hh_tms1k_state { public: - h2hbaseb_state(const machine_config &mconfig, device_type type, const char *tag) + cqback_state(const machine_config &mconfig, device_type type, const char *tag) : hh_tms1k_state(mconfig, type, tag) { } @@ -695,111 +708,83 @@ public: DECLARE_WRITE16_MEMBER(write_r); DECLARE_WRITE16_MEMBER(write_o); DECLARE_READ8_MEMBER(read_k); - - void set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(skill_switch); - -protected: - virtual void machine_reset() override; }; // handlers -void h2hbaseb_state::prepare_display() +void cqback_state::prepare_display() { - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); - display_matrix_seg(9, 9, (m_r & 0x100) | m_o, (m_r & 0xff) | (m_r >> 1 & 0x100), 0x7f); + // R9 selects between segments B/C or A'/D' + UINT16 seg = m_o; + if (m_r & 0x200) + seg = (m_o << 7 & 0x300) | (m_o & 0xf9); + + set_display_segmask(0x1ff, 0xff); + display_matrix(11, 9, seg, m_r & 0x1ff); } -WRITE16_MEMBER(h2hbaseb_state::write_r) +WRITE16_MEMBER(cqback_state::write_r) { // R10: speaker out m_speaker->level_w(data >> 10 & 1); - // R4-R7: input mux - m_inp_mux = data >> 4 & 0xf; + // R0-R4: input mux + m_inp_mux = data & 0x1f; - // R0-R7,R9: select vfd digit/led - // R8: led state + // R0-R9: select digit/segment m_r = data; prepare_display(); } -WRITE16_MEMBER(h2hbaseb_state::write_o) +WRITE16_MEMBER(cqback_state::write_o) { - // O0-O6: digit segments A-G - // O7: N/C + // O0-O7: digit segments m_o = data; prepare_display(); } -READ8_MEMBER(h2hbaseb_state::read_k) +READ8_MEMBER(cqback_state::read_k) { - // K: multiplexed inputs (note: K8(Vss row) is always on) - return m_inp_matrix[4]->read() | read_inputs(4); + // K: multiplexed inputs, rotated matrix + return read_rotated_inputs(5); } // config -static INPUT_PORTS_START( h2hbaseb ) - PORT_START("IN.0") // R4 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("N") - PORT_BIT( 0x0b, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("B") - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("S") - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // R7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Curve") // these two buttons appear twice on the board - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Fast Pitch") - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) +static INPUT_PORTS_START( cqback ) + PORT_START("IN.0") // K1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY PORT_NAME("P1 Left/Right") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Kick/Pass") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Display") - PORT_START("IN.4") // Vss! - PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Swing") + PORT_START("IN.1") // K2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_TOGGLE PORT_NAME("Play Selector") // pass + PORT_BIT( 0x02, 0x02, IPT_SPECIAL ) PORT_CONDITION("IN.1", 0x01, EQUALS, 0x00) // run/kick - PORT_START("IN.5") // fake - PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, h2hbaseb_state, skill_switch, NULL) - PORT_CONFSETTING( 0x00, "1" ) + PORT_START("IN.2") // K4 + PORT_CONFNAME( 0x03, 0x02, "Skill Level" ) + PORT_CONFSETTING( 0x02, "1" ) PORT_CONFSETTING( 0x01, "2" ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(h2hbaseb_state::skill_switch) -{ - set_clock(); -} - - -void h2hbaseb_state::set_clock() -{ - // MCU clock is from an RC circuit with C=47pf, and R value is depending on - // skill switch: R=51K(1) or 43K(2) - m_maincpu->set_unscaled_clock((m_inp_matrix[5]->read() & 1) ? 400000 : 350000); -} -void h2hbaseb_state::machine_reset() -{ - hh_tms1k_state::machine_reset(); - set_clock(); -} + PORT_START("IN.3") // K8 + PORT_CONFNAME( 0x01, 0x00, "Factory Test" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) // TP1-TP2 +INPUT_PORTS_END -static MACHINE_CONFIG_START( h2hbaseb, h2hbaseb_state ) +static MACHINE_CONFIG_START( cqback, cqback_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1170, 350000) // see set_clock - MCFG_TMS1XXX_READ_K_CB(READ8(h2hbaseb_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(h2hbaseb_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(h2hbaseb_state, write_o)) + MCFG_CPU_ADD("maincpu", TMS1100, 310000) // approximation - RC osc. R=33K, C=100pf + MCFG_TMS1XXX_READ_K_CB(READ8(cqback_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cqback_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cqback_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_h2hbaseb) + MCFG_DEFAULT_LAYOUT(layout_cqback) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -817,8 +802,12 @@ MACHINE_CONFIG_END * TMS1100NLLE (rev. E!) MP3460 (die labeled MP3460) * 2*SN75492N LED display drivers, 9-digit LED grid, 1bit sound + known releases: + - USA(1): Head to Head Football + - USA(2): Team Play Football, distributed by Sears + LED electronic football game. To distinguish between offense and defense, - offense blips (should) appear brighter. + offense blips (should) appear brighter. The hardware is similar to cqback. ***************************************************************************/ @@ -839,8 +828,8 @@ public: void h2hfootb_state::prepare_display() { - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); - display_matrix_seg(9, 9, m_o | (m_r >> 1 & 0x100), (m_r & 0x1ff), 0x7f); + set_display_segmask(0x1ff, 0x7f); + display_matrix(9, 9, m_o | (m_r >> 1 & 0x100), m_r & 0x1ff); } WRITE16_MEMBER(h2hfootb_state::write_r) @@ -866,15 +855,8 @@ WRITE16_MEMBER(h2hfootb_state::write_o) READ8_MEMBER(h2hfootb_state::read_k) { - // K: multiplexed inputs - UINT8 k = 0; - - // compared to the usual setup, the button matrix is rotated - for (int i = 0; i < 4; i++) - if (m_inp_matrix[i]->read() & m_inp_mux) - k |= 1 << i; - - return k; + // K: multiplexed inputs, rotated matrix + return read_rotated_inputs(9); } @@ -910,7 +892,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( h2hfootb, h2hfootb_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 325000) // approximation - RC osc. R=39K, C=100pf, but unknown RC curve + MCFG_CPU_ADD("maincpu", TMS1100, 310000) // approximation - RC osc. R=39K, C=100pf, but unknown RC curve MCFG_TMS1XXX_READ_K_CB(READ8(h2hfootb_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(h2hfootb_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(h2hfootb_state, write_o)) @@ -928,6 +910,146 @@ MACHINE_CONFIG_END +/*************************************************************************** + + Coleco Head to Head Baseball + * PCB labels Coleco rev C 73891/2 + * TMS1170NLN MP1525-N2 (die labeled MP1525) + * 9-digit cyan VFD display, and other LEDs behind bezel, 1bit sound + + known releases: + - USA: Head to Head Baseball + - Japan: Computer Baseball, published by Tsukuda + +***************************************************************************/ + +class h2hbaseb_state : public hh_tms1k_state +{ +public: + h2hbaseb_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(skill_switch); + +protected: + virtual void machine_reset() override; +}; + +// handlers + +void h2hbaseb_state::prepare_display() +{ + set_display_segmask(0x1ff, 0x7f); + display_matrix(9, 9, (m_r & 0x100) | m_o, (m_r & 0xff) | (m_r >> 1 & 0x100)); +} + +WRITE16_MEMBER(h2hbaseb_state::write_r) +{ + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // R4-R7: input mux + m_inp_mux = data >> 4 & 0xf; + + // R0-R7,R9: select vfd digit/led + // R8: led state + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(h2hbaseb_state::write_o) +{ + // O0-O6: digit segments A-G + // O7: N/C + m_o = data; + prepare_display(); +} + +READ8_MEMBER(h2hbaseb_state::read_k) +{ + // K: multiplexed inputs (note: K8(Vss row) is always on) + return m_inp_matrix[4]->read() | read_inputs(4); +} + + +// config + +static INPUT_PORTS_START( h2hbaseb ) + PORT_START("IN.0") // R4 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("N") + PORT_BIT( 0x0b, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("B") + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("S") + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // R7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Curve") // these two buttons appear twice on the board + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Fast Pitch") // " + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.4") // Vss! + PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Swing") + + PORT_START("IN.5") // fake + PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, h2hbaseb_state, skill_switch, NULL) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x01, "2" ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(h2hbaseb_state::skill_switch) +{ + set_clock(); +} + + +void h2hbaseb_state::set_clock() +{ + // MCU clock is from an RC circuit with C=47pf, and R value is depending on + // skill switch: R=51K(1) or 43K(2) + m_maincpu->set_unscaled_clock((m_inp_matrix[5]->read() & 1) ? 400000 : 350000); +} + +void h2hbaseb_state::machine_reset() +{ + hh_tms1k_state::machine_reset(); + set_clock(); +} + +static MACHINE_CONFIG_START( h2hbaseb, h2hbaseb_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1170, 350000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(READ8(h2hbaseb_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(h2hbaseb_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(h2hbaseb_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_h2hbaseb) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + /*************************************************************************** Coleco Total Control 4 @@ -4532,14 +4654,14 @@ ROM_START( amaztron ) ROM_END -ROM_START( h2hbaseb ) +ROM_START( cqback ) ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "mp1525", 0x0000, 0x0800, CRC(b5d6bf9b) SHA1(2cc9f35f077c1209c46d16ec853af87e4725c2fd) ) + ROM_LOAD( "mp3415.u4", 0x0000, 0x0800, CRC(65ebdabf) SHA1(9b5cf5adaf9132ced87f611ae8c3148b9b62ba89) ) ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_LOAD( "tms1100_common3_micro.pla", 0, 867, CRC(03574895) SHA1(04407cabfb3adee2ee5e4218612cb06c12c540f4) ) ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_h2hbaseb_output.pla", 0, 365, CRC(cb3d7e38) SHA1(6ab4a7c52e6010b7c7158463cb499973e52ff556) ) + ROM_LOAD( "tms1100_cqback_output.pla", 0, 365, CRC(c6dcbfd0) SHA1(593b6b7de981a28d1b4a33336b39df92d02ed4f4) ) ROM_END @@ -4554,6 +4676,17 @@ ROM_START( h2hfootb ) ROM_END +ROM_START( h2hbaseb ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "mp1525", 0x0000, 0x0800, CRC(b5d6bf9b) SHA1(2cc9f35f077c1209c46d16ec853af87e4725c2fd) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_h2hbaseb_output.pla", 0, 365, CRC(cb3d7e38) SHA1(6ab4a7c52e6010b7c7158463cb499973e52ff556) ) +ROM_END + + ROM_START( tc4 ) ROM_REGION( 0x1000, "maincpu", 0 ) ROM_LOAD( "mp7334", 0x0000, 0x1000, CRC(923f3821) SHA1(a9ae342d7ff8dae1dedcd1e4984bcfae68586581) ) @@ -4896,8 +5029,9 @@ ROM_END COMP( 1980, mathmagi, 0, 0, mathmagi, mathmagi, driver_device, 0, "APF Electronics Inc.", "Mathemagician", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) CONS( 1979, amaztron, 0, 0, amaztron, amaztron, driver_device, 0, "Coleco", "Amaze-A-Tron", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, h2hbaseb, 0, 0, h2hbaseb, h2hbaseb, driver_device, 0, "Coleco", "Head to Head Baseball", MACHINE_SUPPORTS_SAVE ) +CONS( 1978, cqback, 0, 0, cqback, cqback, driver_device, 0, "Coleco", "Electronic Quarterback", MACHINE_SUPPORTS_SAVE ) CONS( 1980, h2hfootb, 0, 0, h2hfootb, h2hfootb, driver_device, 0, "Coleco", "Head to Head Football", MACHINE_SUPPORTS_SAVE ) +CONS( 1980, h2hbaseb, 0, 0, h2hbaseb, h2hbaseb, driver_device, 0, "Coleco", "Head to Head Baseball", MACHINE_SUPPORTS_SAVE ) CONS( 1981, tc4, 0, 0, tc4, tc4, driver_device, 0, "Coleco", "Total Control 4", MACHINE_SUPPORTS_SAVE ) CONS( 1979, ebball, 0, 0, ebball, ebball, driver_device, 0, "Entex", "Electronic Baseball (Entex)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp index 71c6b2389f4..0dddfd432c8 100644 --- a/src/mame/drivers/k28.cpp +++ b/src/mame/drivers/k28.cpp @@ -63,8 +63,8 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); void display_update(); void set_display_size(int maxx, int maxy); + void set_display_segmask(UINT32 digits, UINT32 mask); void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); - void display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask); bool m_power_on; UINT8 m_inp_mux; @@ -101,7 +101,7 @@ void k28_state::machine_start() memset(m_display_state, 0, sizeof(m_display_state)); memset(m_display_cache, ~0, sizeof(m_display_cache)); memset(m_display_decay, 0, sizeof(m_display_decay)); - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // ! + memset(m_display_segmask, 0, sizeof(m_display_segmask)); m_power_on = false; m_inp_mux = 0; @@ -237,6 +237,17 @@ void k28_state::set_display_size(int maxx, int maxy) m_display_maxy = maxy; } +void k28_state::set_display_segmask(UINT32 digits, UINT32 mask) +{ + // set a segment mask per selected digit, but leave unselected ones alone + for (int i = 0; i < 0x20; i++) + { + if (digits & 1) + m_display_segmask[i] = mask; + digits >>= 1; + } +} + void k28_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) { set_display_size(maxx, maxy); @@ -249,15 +260,6 @@ void k28_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) display_update(); } -void k28_state::display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask) -{ - // expects m_display_segmask to be not-0 - for (int y = 0; y < maxy; y++) - m_display_segmask[y] &= segmask; - - display_matrix(maxx, maxy, setx, sety); -} - /*************************************************************************** @@ -356,7 +358,8 @@ WRITE8_MEMBER(k28_state::mcu_prog_w) // output 16-24: digit select UINT16 digit_sel = (UINT16)(m_vfd_shiftreg >> 10) & 0x1ff; - display_matrix_seg(16, 9, seg_data, digit_sel, 0x3fff); + set_display_segmask(0x1ff, 0x3fff); + display_matrix(16, 9, seg_data, digit_sel); // output 25: power-off request on falling edge if (~m_vfd_shiftreg & m_vfd_shiftreg_out & 0x200) diff --git a/src/mame/includes/hh_tms1k.h b/src/mame/includes/hh_tms1k.h index 0551bc8e17f..a53b1453d95 100644 --- a/src/mame/includes/hh_tms1k.h +++ b/src/mame/includes/hh_tms1k.h @@ -41,6 +41,7 @@ public: bool m_power_led; UINT8 read_inputs(int columns); + UINT8 read_rotated_inputs(int columns, UINT8 rowmask = 0xf); virtual DECLARE_INPUT_CHANGED_MEMBER(power_button); virtual DECLARE_WRITE_LINE_MEMBER(auto_power_off); diff --git a/src/mame/layout/cqback.lay b/src/mame/layout/cqback.lay new file mode 100644 index 00000000000..ebdfa1feaf8 --- /dev/null +++ b/src/mame/layout/cqback.lay @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/h2hfootb.lay b/src/mame/layout/h2hfootb.lay index 1bf59a074c9..9a31d4f72bb 100644 --- a/src/mame/layout/h2hfootb.lay +++ b/src/mame/layout/h2hfootb.lay @@ -34,7 +34,7 @@ - + @@ -139,7 +139,6 @@ - diff --git a/src/mame/mess.lst b/src/mame/mess.lst index fca9f76e047..83a0384dd3b 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2283,6 +2283,7 @@ gnwmndon // Nintendo // hh_tms1k mathmagi // APF amaztron // Coleco +cqback // Coleco h2hbaseb // Coleco h2hfootb // Coleco tc4 // Coleco -- cgit v1.2.3-70-g09d2 From 8bf3d168511d1220b4aa5e59a60d90c8ed5f7836 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 15 Feb 2016 22:53:16 +0100 Subject: New Working machine added ------------------- Fidelity Elite Avant Garde (model 6117-7) [hap, Micha] --- src/mame/drivers/fidel68k.cpp | 76 ++++++++++++++++++++++++++++++++++++++++--- src/mame/mess.lst | 1 + 2 files changed, 72 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp index 7d79c26448c..e39f08e9bd1 100644 --- a/src/mame/drivers/fidel68k.cpp +++ b/src/mame/drivers/fidel68k.cpp @@ -28,11 +28,16 @@ V6-V11 are on model 6117. Older 1986 model 6081 uses a 6502 CPU. - MC68HC000P12F 16MHz CPU, 16MHz XTAL - MB1422A DRAM Controller, 25MHz XTAL near, 4 DRAM slots(V2: slot 1 and 2 64KB) -- 2*27C512 EPROM, 2*KM6264AL-10 SRAM, 2*AT28C64X EEPROM(parallel) +- 2*27C512 64KB EPROM, 2*KM6264AL-10 8KB SRAM, 2*AT28C64X 8KB EEPROM - external module slot, no dumps yet - OKI M82C51A-2 USART, 4.9152MHz XTAL, assume it's used for factory test/debug - other special: Chessboard squares are magnet sensors +IRQ source is unknown. Several possibilities: +- NE555 timer IC +- MM/SN74HC4060 binary counter IC (near the M82C51A) +- one of the XTALs, plus divider of course + Memory map: (of what is known) ----------- 000000-01FFFF: 128KB ROM @@ -40,10 +45,42 @@ Memory map: (of what is known) 200000-2FFFFF: hashtable DRAM (max. 1MB) 300000-30000F W hi d0: NE591: 7seg data 300000-30000F W lo d0: NE591: LED data -300000-30000F R lo d7: 74259?: keypad rows 0-7 -400000-400001 W lo d0-d3: 74145: led/keypad mux, buzzer out -700002-700003 R lo d7: 74251?: keypad row 8 +300000-30000F R lo d7: 74259: keypad rows 0-7 +400000-400001 W lo d0-d3: 74145/7442: led/keypad mux, buzzer out +700002-700003 R lo d7: 74251: keypad row 8 +604000-607FFF: 16KB EEPROM + + +****************************************************************************** + +Elite Avant Garde (EAG, model 6117) +----------------------------------- + +There are 6 versions of model 6114(V6 to V11). The one emulated here came from a V7. +From a programmer's point of view, the hardware is very similar to model 6114. + +V6: 68020, 512KB hashtable RAM +V7: 68020, 1MB h.RAM +V8: 2*68020, 512KB+128KB h.RAM +V9: 68030, 1MB h.RAM +V10: 68040, 1MB h.RAM +V11: 68060, 2MB h.RAM, high speed + +- MC68020RC25E CPU, QFP 25MHz XTAL, 2*GAL16V8C +- 4*AS7C164-20PC 8KB SRAM, 2*KM684000ALG-7L 512KB CMOS SRAM +- 2*27C512? 64KB EPROM, 2*HM6264LP-15 8KB SRAM, 2*AT28C64B 8KB EEPROM +- same as 6114: M82C51A, SN74HC4060, module slot?, chessboard + +Memory map: +----------- +000000-01FFFF: 128KB ROM +104000-107FFF: 16KB SRAM (unused?) +200000-2FFFFF: hashtable SRAM +300000-30000F: see model 6114 +400000-400007: see model 6114 +700000-700003: see model 6114 604000-607FFF: 16KB EEPROM +800000-807FFF: 32KB SRAM ******************************************************************************/ @@ -142,7 +179,7 @@ WRITE8_MEMBER(fidel68k_state::eag_mux_w) static ADDRESS_MAP_START( eag_map, AS_PROGRAM, 16, fidel68k_state ) AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_RANGE(0x104000, 0x107fff) AM_RAM - AM_RANGE(0x200000, 0x2fffff) AM_RAM // DRAM, max 1MB + AM_RANGE(0x200000, 0x2fffff) AM_RAM // DRAM slots AM_RANGE(0x300000, 0x30000f) AM_MIRROR(0x000010) AM_READWRITE8(eag_input1_r, eag_leds_w, 0x00ff) AM_RANGE(0x300000, 0x30000f) AM_MIRROR(0x000010) AM_WRITE8(eag_7seg_w, 0xff00) AM_READNOP AM_RANGE(0x400000, 0x400001) AM_WRITE8(eag_mux_w, 0x00ff) @@ -151,6 +188,18 @@ static ADDRESS_MAP_START( eag_map, AS_PROGRAM, 16, fidel68k_state ) AM_RANGE(0x700002, 0x700003) AM_READ8(eag_input2_r, 0x00ff) ADDRESS_MAP_END +static ADDRESS_MAP_START( eagv7_map, AS_PROGRAM, 32, fidel68k_state ) + AM_RANGE(0x000000, 0x01ffff) AM_ROM + AM_RANGE(0x200000, 0x2fffff) AM_RAM + AM_RANGE(0x300000, 0x30000f) AM_MIRROR(0x000010) AM_READWRITE8(eag_input1_r, eag_leds_w, 0x00ff00ff) + AM_RANGE(0x300000, 0x30000f) AM_MIRROR(0x000010) AM_WRITE8(eag_7seg_w, 0xff00ff00) AM_READNOP + AM_RANGE(0x400000, 0x400003) AM_WRITE8(eag_mux_w, 0x00ff0000) + AM_RANGE(0x400004, 0x400007) AM_WRITENOP // ? + AM_RANGE(0x604000, 0x607fff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0x800000, 0x807fff) AM_RAM + AM_RANGE(0x700000, 0x700003) AM_READ8(eag_input2_r, 0x000000ff) +ADDRESS_MAP_END + /****************************************************************************** @@ -276,6 +325,14 @@ static MACHINE_CONFIG_START( eag, fidel68k_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( eagv7, eag ) + + /* basic machine hardware */ + MCFG_CPU_REPLACE("maincpu", M68020, XTAL_25MHz) + MCFG_CPU_PROGRAM_MAP(eagv7_map) + MCFG_CPU_PERIODIC_INT_DRIVER(fidel68k_state, irq2_line_hold, 600) // complete guess +MACHINE_CONFIG_END + /****************************************************************************** @@ -289,9 +346,18 @@ ROM_START( feagv2 ) ROM_END +ROM_START( feagv7 ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD16_BYTE("eag-v7b", 0x00000, 0x10000, CRC(f2f68b63) SHA1(621e5073e9c5083ac9a9b467f3ef8aa29beac5ac) ) + ROM_LOAD16_BYTE("eag-v7a", 0x00001, 0x10000, CRC(506b688f) SHA1(0a091c35d0f01166b57f964b111cde51c5720d58) ) +ROM_END + + + /****************************************************************************** Drivers ******************************************************************************/ /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ COMP( 1989, feagv2, 0, 0, eag, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde (model 6114-2/3/4)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1990, feagv7, 0, 0, eagv7, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde (model 6117-7)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/mess.lst b/src/mame/mess.lst index 83a0384dd3b..f35480c30b8 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2168,6 +2168,7 @@ fexcel fexcelv feagv2 +feagv7 // Hegener & Glaser Munich //mephisto // Mephisto 1 - roms needed - not in driver -- cgit v1.2.3-70-g09d2 From 51061219be40ded0634a030071916d4cdd083225 Mon Sep 17 00:00:00 2001 From: cracyc Date: Mon, 15 Feb 2016 16:19:49 -0600 Subject: upd7220: command 05 appears to blank the display (nw) --- src/devices/video/upd7220.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/devices/video/upd7220.cpp b/src/devices/video/upd7220.cpp index 23548f1ecd7..32d4d2c3c63 100644 --- a/src/devices/video/upd7220.cpp +++ b/src/devices/video/upd7220.cpp @@ -71,7 +71,8 @@ enum COMMAND_LPRD, COMMAND_DMAR, COMMAND_DMAW, - COMMAND_5A + COMMAND_5A, + COMMAND_05 }; enum @@ -93,6 +94,7 @@ enum #define UPD7220_COMMAND_CCHAR 0x4b #define UPD7220_COMMAND_START 0x6b #define UPD7220_COMMAND_BCTRL 0x0c // & 0xfe +#define UPD7220_COMMAND_05 0x05 #define UPD7220_COMMAND_ZOOM 0x46 #define UPD7220_COMMAND_CURS 0x49 #define UPD7220_COMMAND_PRAM 0x70 // & 0xf0 @@ -1049,6 +1051,7 @@ int upd7220_device::translate_command(UINT8 data) case UPD7220_COMMAND_CURD: command = COMMAND_CURD; break; case UPD7220_COMMAND_LPRD: command = COMMAND_LPRD; break; case UPD7220_COMMAND_5A: command = COMMAND_5A; break; + case UPD7220_COMMAND_05: command = COMMAND_05; break; default: switch (data & 0xfe) { @@ -1226,6 +1229,10 @@ void upd7220_device::process_fifo() //LOG(("uPD7220 '%s' DE: 1\n", tag())); break; + case COMMAND_05: + m_de = 0; + break; + case COMMAND_BCTRL: /* display blanking control */ m_de = m_cr & 0x01; -- cgit v1.2.3-70-g09d2 From add69b7d8acb83352a56b191ad0290b989e39f8a Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 16 Feb 2016 01:08:14 +0100 Subject: fidel68k: added cartridge slot --- hash/fidel_eag.xml | 9 ++++++ src/mame/drivers/fidel6502.cpp | 13 ++++---- src/mame/drivers/fidel68k.cpp | 67 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 73 insertions(+), 16 deletions(-) create mode 100644 hash/fidel_eag.xml diff --git a/hash/fidel_eag.xml b/hash/fidel_eag.xml new file mode 100644 index 00000000000..7aafce545c1 --- /dev/null +++ b/hash/fidel_eag.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 1f28dd87b66..6487959caea 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -309,8 +309,8 @@ public: DECLARE_READ_LINE_MEMBER(csc_pia1_cb1_r); // SC12/6086 - DECLARE_MACHINE_START(sc12); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(scc_cartridge); + DECLARE_READ8_MEMBER(sc12_cart_r); DECLARE_WRITE8_MEMBER(sc12_control_w); DECLARE_READ8_MEMBER(sc12_input_r); @@ -478,12 +478,12 @@ DEVICE_IMAGE_LOAD_MEMBER(fidel6502_state, scc_cartridge) return IMAGE_INIT_PASS; } -MACHINE_START_MEMBER(fidel6502_state, sc12) +READ8_MEMBER(fidel6502_state::sc12_cart_r) { if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - - fidelz80base_state::machine_start(); + return m_cart->read_rom(space, offset); + else + return 0; } @@ -617,6 +617,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sc12_map, AS_PROGRAM, 8, fidel6502_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x0fff) AM_RAM + AM_RANGE(0x2000, 0x5fff) AM_READ(sc12_cart_r) AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_WRITE(sc12_control_w) AM_RANGE(0x8000, 0x9fff) AM_ROM AM_RANGE(0xa000, 0xa007) AM_MIRROR(0x1ff8) AM_READ(sc12_input_r) @@ -859,8 +860,6 @@ static MACHINE_CONFIG_START( sc12, fidel6502_state ) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_sc12) - MCFG_MACHINE_START_OVERRIDE(fidel6502_state, sc12) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp index e39f08e9bd1..972d4a789f8 100644 --- a/src/mame/drivers/fidel68k.cpp +++ b/src/mame/drivers/fidel68k.cpp @@ -7,7 +7,6 @@ TODO: - how does dual-CPU work? - the EAG manual mentions optional voice(speech) - - where does the cartridge slot map to? - IRQ level/timing is unknown ****************************************************************************** @@ -29,15 +28,17 @@ V6-V11 are on model 6117. Older 1986 model 6081 uses a 6502 CPU. - MC68HC000P12F 16MHz CPU, 16MHz XTAL - MB1422A DRAM Controller, 25MHz XTAL near, 4 DRAM slots(V2: slot 1 and 2 64KB) - 2*27C512 64KB EPROM, 2*KM6264AL-10 8KB SRAM, 2*AT28C64X 8KB EEPROM -- external module slot, no dumps yet - OKI M82C51A-2 USART, 4.9152MHz XTAL, assume it's used for factory test/debug -- other special: Chessboard squares are magnet sensors +- other special: magnet sensors, external module slot IRQ source is unknown. Several possibilities: - NE555 timer IC - MM/SN74HC4060 binary counter IC (near the M82C51A) - one of the XTALs, plus divider of course +The module slot pinout is different from SCC series. The data on those appears +to be compatible with EAG though and will load fine with an adapter. + Memory map: (of what is known) ----------- 000000-01FFFF: 128KB ROM @@ -47,6 +48,7 @@ Memory map: (of what is known) 300000-30000F W lo d0: NE591: LED data 300000-30000F R lo d7: 74259: keypad rows 0-7 400000-400001 W lo d0-d3: 74145/7442: led/keypad mux, buzzer out +400000-4????? R hi: external module slot 700002-700003 R lo d7: 74251: keypad row 8 604000-607FFF: 16KB EEPROM @@ -69,16 +71,16 @@ V11: 68060, 2MB h.RAM, high speed - MC68020RC25E CPU, QFP 25MHz XTAL, 2*GAL16V8C - 4*AS7C164-20PC 8KB SRAM, 2*KM684000ALG-7L 512KB CMOS SRAM - 2*27C512? 64KB EPROM, 2*HM6264LP-15 8KB SRAM, 2*AT28C64B 8KB EEPROM -- same as 6114: M82C51A, SN74HC4060, module slot?, chessboard +- same as 6114: M82C51A, SN74HC4060, module slot, chessboard Memory map: ----------- 000000-01FFFF: 128KB ROM 104000-107FFF: 16KB SRAM (unused?) 200000-2FFFFF: hashtable SRAM -300000-30000F: see model 6114 -400000-400007: see model 6114 -700000-700003: see model 6114 +300000-30000x: see model 6114 +400000-40000x: see model 6114 +700000-70000x: see model 6114 604000-607FFF: 16KB EEPROM 800000-807FFF: 32KB SRAM @@ -87,6 +89,9 @@ Memory map: #include "emu.h" #include "cpu/m68000/m68000.h" #include "machine/nvram.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "softlist.h" #include "includes/fidelz80.h" @@ -98,11 +103,17 @@ class fidel68k_state : public fidelz80base_state { public: fidel68k_state(const machine_config &mconfig, device_type type, const char *tag) - : fidelz80base_state(mconfig, type, tag) + : fidelz80base_state(mconfig, type, tag), + m_cart(*this, "cartslot") { } - // EAG(6114) + // devices/pointers + optional_device m_cart; + + // EAG(6114/6117) void eag_prepare_display(); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(eag_cartridge); + DECLARE_READ8_MEMBER(eag_cart_r); DECLARE_READ8_MEMBER(eag_input1_r); DECLARE_WRITE8_MEMBER(eag_leds_w); DECLARE_WRITE8_MEMBER(eag_7seg_w); @@ -129,6 +140,34 @@ void fidel68k_state::eag_prepare_display() } +// cartridge + +DEVICE_IMAGE_LOAD_MEMBER(fidel68k_state, eag_cartridge) +{ + UINT32 size = m_cart->common_get_size("rom"); + + // max size is 16KB? + if (size > 0x4000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +READ8_MEMBER(fidel68k_state::eag_cart_r) +{ + if (m_cart->exists()) + return m_cart->read_rom(space, offset); + else + return 0; +} + + // TTL READ8_MEMBER(fidel68k_state::eag_input1_r) @@ -182,6 +221,7 @@ static ADDRESS_MAP_START( eag_map, AS_PROGRAM, 16, fidel68k_state ) AM_RANGE(0x200000, 0x2fffff) AM_RAM // DRAM slots AM_RANGE(0x300000, 0x30000f) AM_MIRROR(0x000010) AM_READWRITE8(eag_input1_r, eag_leds_w, 0x00ff) AM_RANGE(0x300000, 0x30000f) AM_MIRROR(0x000010) AM_WRITE8(eag_7seg_w, 0xff00) AM_READNOP + AM_RANGE(0x400000, 0x407fff) AM_READ8(eag_cart_r, 0xff00) AM_RANGE(0x400000, 0x400001) AM_WRITE8(eag_mux_w, 0x00ff) AM_RANGE(0x400002, 0x400007) AM_WRITENOP // ? AM_RANGE(0x604000, 0x607fff) AM_RAM AM_SHARE("nvram") @@ -190,9 +230,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( eagv7_map, AS_PROGRAM, 32, fidel68k_state ) AM_RANGE(0x000000, 0x01ffff) AM_ROM + AM_RANGE(0x104000, 0x107fff) AM_RAM AM_RANGE(0x200000, 0x2fffff) AM_RAM AM_RANGE(0x300000, 0x30000f) AM_MIRROR(0x000010) AM_READWRITE8(eag_input1_r, eag_leds_w, 0x00ff00ff) AM_RANGE(0x300000, 0x30000f) AM_MIRROR(0x000010) AM_WRITE8(eag_7seg_w, 0xff00ff00) AM_READNOP + AM_RANGE(0x400000, 0x407fff) AM_READ8(eag_cart_r, 0xff00ff00) AM_RANGE(0x400000, 0x400003) AM_WRITE8(eag_mux_w, 0x00ff0000) AM_RANGE(0x400004, 0x400007) AM_WRITENOP // ? AM_RANGE(0x604000, 0x607fff) AM_RAM AM_SHARE("nvram") @@ -323,6 +365,13 @@ static MACHINE_CONFIG_START( eag, fidel68k_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fidel_eag") + MCFG_GENERIC_EXTENSIONS("bin,dat") + MCFG_GENERIC_LOAD(fidel68k_state, eag_cartridge) + MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_eag") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("fidel_scc_list", "fidel_scc") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( eagv7, eag ) -- cgit v1.2.3-70-g09d2 From d13f3f0d102b7e3d0bc1a6975a554722547fba0f Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 16 Feb 2016 01:24:42 +0100 Subject: fidel68k cart test --- src/mame/drivers/fidel68k.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp index 972d4a789f8..5eedb9ca81c 100644 --- a/src/mame/drivers/fidel68k.cpp +++ b/src/mame/drivers/fidel68k.cpp @@ -162,7 +162,12 @@ DEVICE_IMAGE_LOAD_MEMBER(fidel68k_state, eag_cartridge) READ8_MEMBER(fidel68k_state::eag_cart_r) { if (m_cart->exists()) + { + static int yay=0; + if (!yay) { printf("Yay!\n"); yay=1; } + return m_cart->read_rom(space, offset); + } else return 0; } -- cgit v1.2.3-70-g09d2 From 30ef0dc4278294830fb67add0ced228c79b55f1c Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 16 Feb 2016 07:52:59 +0100 Subject: Update to latest BGFX including my SteamLink support (nw) --- .../src/glsl/ir_print_metal_visitor.cpp | 12 +- 3rdparty/bgfx/3rdparty/iconfontheaders/.gitignore | 58 ++ .../iconfontheaders/GenerateIconFontCppHeaders.py | 183 ++++ 3rdparty/bgfx/3rdparty/iconfontheaders/LICENSE | 22 + 3rdparty/bgfx/3rdparty/iconfontheaders/README.md | 29 + .../3rdparty/iconfontheaders/icons_font_awesome.h | 611 ++++++++++++++ .../bgfx/3rdparty/iconfontheaders/icons_kenney.h | 234 +++++ .../iconfontheaders/icons_material_design.h | 938 +++++++++++++++++++++ 3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp | 7 +- .../bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp | 12 +- 3rdparty/bgfx/README.md | 3 +- 3rdparty/bgfx/examples/10-font/font.cpp | 26 +- 3rdparty/bgfx/examples/common/bounds.cpp | 96 +++ 3rdparty/bgfx/examples/common/bounds.h | 6 + 3rdparty/bgfx/examples/common/entry/entry_sdl.cpp | 2 + 3rdparty/bgfx/examples/common/imgui/imgui.cpp | 7 + 3rdparty/bgfx/examples/common/imgui/imgui.h | 24 +- .../bgfx/examples/common/imgui/ocornut_imgui.cpp | 10 +- .../examples/runtime/font/kenney-icon-font.ttf | Bin 0 -> 46184 bytes 3rdparty/bgfx/include/bgfx/bgfx.h | 23 +- 3rdparty/bgfx/include/bgfx/bgfxdefines.h | 10 +- 3rdparty/bgfx/include/bgfx/bgfxplatform.h | 3 + 3rdparty/bgfx/include/bgfx/c99/bgfx.h | 11 +- 3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h | 2 +- 3rdparty/bgfx/scripts/bgfx.lua | 8 +- 3rdparty/bgfx/scripts/example-common.lua | 5 + 3rdparty/bgfx/scripts/genie.lua | 10 +- 3rdparty/bgfx/src/bgfx.cpp | 32 +- 3rdparty/bgfx/src/bgfx_p.h | 32 +- 3rdparty/bgfx/src/image.cpp | 52 +- 3rdparty/bgfx/src/renderer_d3d11.cpp | 43 +- 3rdparty/bgfx/src/renderer_d3d11.h | 4 +- 3rdparty/bgfx/src/renderer_d3d12.cpp | 10 +- 3rdparty/bgfx/src/renderer_d3d12.h | 4 +- 3rdparty/bgfx/src/renderer_d3d9.cpp | 10 +- 3rdparty/bgfx/src/renderer_d3d9.h | 2 +- 3rdparty/bgfx/src/renderer_gl.cpp | 30 +- 3rdparty/bgfx/src/renderer_gl.h | 5 +- 3rdparty/bgfx/src/renderer_mtl.h | 2 +- 3rdparty/bgfx/src/renderer_mtl.mm | 8 +- 3rdparty/bgfx/src/renderer_null.cpp | 2 +- 3rdparty/bgfx/tools/geometryc/geometryc.cpp | 2 +- 3rdparty/bx/include/bx/fpumath.h | 79 +- 3rdparty/bx/include/bx/hash.h | 2 +- 3rdparty/bx/scripts/toolchain.lua | 8 +- 3rdparty/bx/tools/bin/darwin/genie | Bin 422176 -> 422176 bytes 3rdparty/bx/tools/bin/linux/genie | Bin 396856 -> 396856 bytes 3rdparty/bx/tools/bin/windows/genie.exe | Bin 400384 -> 400896 bytes 48 files changed, 2505 insertions(+), 174 deletions(-) create mode 100644 3rdparty/bgfx/3rdparty/iconfontheaders/.gitignore create mode 100644 3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py create mode 100644 3rdparty/bgfx/3rdparty/iconfontheaders/LICENSE create mode 100644 3rdparty/bgfx/3rdparty/iconfontheaders/README.md create mode 100644 3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome.h create mode 100644 3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h create mode 100644 3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h create mode 100644 3rdparty/bgfx/examples/runtime/font/kenney-icon-font.ttf diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp index f9988a31f61..9f7071d9564 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp @@ -1020,7 +1020,17 @@ void ir_print_metal_visitor::visit(ir_expression *ir) const bool halfCast = (arg_prec == glsl_precision_medium || arg_prec == glsl_precision_low); buffer.asprintf_append (halfCast ? "((half)1.0/(" : "(1.0/("); } else { - buffer.asprintf_append ("%s(", operator_glsl_strs[ir->operation]); + switch(ir->operation) { + case ir_unop_dFdy: + case ir_unop_dFdy_coarse: + case ir_unop_dFdy_fine: + buffer.asprintf_append ("%s(-", operator_glsl_strs[ir->operation]); + break; + + default: + buffer.asprintf_append ("%s(", operator_glsl_strs[ir->operation]); + break; + } } if (ir->operands[0]) ir->operands[0]->accept(this); diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/.gitignore b/3rdparty/bgfx/3rdparty/iconfontheaders/.gitignore new file mode 100644 index 00000000000..31b83a9bc9a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/.gitignore @@ -0,0 +1,58 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ +.idea/ diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py b/3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py new file mode 100644 index 00000000000..09eae5c4566 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py @@ -0,0 +1,183 @@ +#!/usr/bin/python +# Convert Font Awesome, Google Material Design and Kenney Game icon font +# parameters to C++11 and C89 compatible formats. +# +#------------------------------------------------------------------------------ +# 1 - Source material +# +# 1.1 - Font Awesome - https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml +# 1.2 - Material Design - https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/codepoints +# 1.3 - Kenney icons - https://raw.githubusercontent.com/SamBrishes/kenney-icon-font/master/css/kenney-icons.css +# +#------------------------------------------------------------------------------ +# 2 - Data samples +# +# 2.1 - Font Awesome +# - input: - name: Music +# id: music +# unicode: f001 +# created: 1.0 +# filter: +# - note +# - sound +# categories: +# - Web Application Icons +# - output C++11: #define ICON_FA_MUSIC u8"\uf001" +# - output C89: #define ICON_FA_MUSIC "\xEF\x80\x81" +# +# 2.2 - Google Material Design icons +# - input: 3d_rotation e84d +# - output C++11: #define ICON_MD_3D_ROTATION u8"\ue84d" +# - output C89: #define ICON_MD_3D_ROTATION "\xEE\xA1\x8D" +# +# 2.3 - Kenney Game icons +# - input: .ki-home:before{ content: "\e900"; } +# - output C++11: #define ICON_KI_HOME u8"\ue900" +# - output C89: #define ICON_KI_HOME "\xEE\xA4\x80" +# +# 2.4 - All fonts +# - computed min and max unicode fonts ICON_MIN and ICON_MAX +# - output: #define ICON_MIN_FA 0xf000 +# #define ICON_MAX_FA 0xf295 +# +#------------------------------------------------------------------------------ +# 3 - Script dependencies +# +# 3.1 - Python 2.7 - https://www.python.org/download/releases/2.7/ +# 3.2 - Requests - http://docs.python-requests.org/ +# 3.3 - PyYAML - http://pyyaml.org/ +# +#------------------------------------------------------------------------------ + + +import requests +import yaml + + +LINE_FORMAT_MINMAX = '#define ICON_{!s}_{!s} 0x{!s}\n' + +UNICODE_MIN = 'ffff' +UNICODE_MAX = '0' +TIMEOUT = 2 + +MESSAGE_SUCCESS = '{!s} fonts - conversion success: {!s}' +MESSAGE_ERROR = '{!s} fonts - error \n\t{!s}' + + +def get_prelude( url ): + prelude = '// Generated by GenerateIconFontCppHeaders.py \n// from {!s}\n#pragma once\n\n'.format( url ) + return prelude + + +def line_format( font_abbr, font, unicode, cpp11 = True ): + if cpp11: + result = '#define ICON_{!s}_{!s} u8"\u{!s}"\n'.format( font_abbr, font, unicode ) + else: + unicode_base = ''.join([ '{0:x}'.format( ord( x )) for x in unichr( int( unicode, 16 )).encode( 'utf-8' )]).upper() + unicode = '\\x' + unicode_base[ :2 ] + '\\x' + unicode_base[ 2:4 ] + '\\x' + unicode_base[ 4: ] + result = '#define ICON_{!s}_{!s} "{!s}"\n'.format( font_abbr, font, unicode ) + return result + + +def convert_font_awesome( font_name, font_abbr, source_url, output_file, cpp11 ): + try: + response = requests.get( source_url, timeout = TIMEOUT ) + if response.status_code == 200: + input = yaml.safe_load( response.content ) + min = UNICODE_MIN + max = UNICODE_MAX + output_fonts = '' + for item in input[ 'icons' ]: + font = '' + for char in item[ 'id' ]: + font += '_' if ( char == '-' ) else str.upper( char ) + unicode = item[ 'unicode' ] + if unicode < min: + min = unicode + elif unicode >= max: + max = unicode + output_fonts += line_format( font_abbr, font, unicode, cpp11 ) + output = get_prelude( source_url ) + \ + LINE_FORMAT_MINMAX.format( 'MIN', font_abbr, min ) + \ + LINE_FORMAT_MINMAX.format( 'MAX', font_abbr, max ) + \ + output_fonts + with open( output_file, 'w' ) as f: + f.write( output ) + print( MESSAGE_SUCCESS.format( font_name, output_file )) + except Exception as e: + print( MESSAGE_ERROR.format( font_name, e )) + + +def convert_material_design( font_name, font_abbr, source_url, output_file, cpp11 ): + try: + response = requests.get( source_url, timeout = TIMEOUT ) + if response.status_code == 200: + input = str.split( response.content, '\n' ) + min = UNICODE_MIN + max = UNICODE_MAX + output_fonts = '' + for line in input: + words = str.split( line ) + if words: + font = '' + for char in words[ 0 ]: + font += '_' if ( char == '-' ) else str.upper( char ) + unicode = words[ 1 ] + if unicode < min: + min = unicode + elif unicode >= max: + max = unicode + output_fonts += line_format( font_abbr, font, unicode, cpp11 ) + output = get_prelude( source_url ) + \ + LINE_FORMAT_MINMAX.format( 'MIN', font_abbr, min ) + \ + LINE_FORMAT_MINMAX.format( 'MAX', font_abbr, max ) + \ + output_fonts + with open( output_file, 'w' ) as f: + f.write( output ) + print( MESSAGE_SUCCESS.format( font_name, output_file )) + except Exception as e: + print( MESSAGE_ERROR.format( font_name, e )) + + +def convert_kenney( font_name, font_abbr, source_url, output_file, cpp11 ): + try: + response = requests.get( source_url, timeout = TIMEOUT ) + if response.status_code == 200: + input = str.split( response.content, '\n' ) + min = UNICODE_MIN + max = UNICODE_MAX + output_fonts = '' + font_begin= '.ki-' + font_end = ':before' + unicode_begin = '"\\' + unicode_end = '";' + for line in input: + words = str.split( line ) + if words: + if font_begin in words[ 0 ]: + font = '' + word = words[ 0 ][( words[ 0 ].find( font_begin ) + len( font_begin )) : ( words[ 0 ].find( font_end ))] + for char in word: + font += '_' if ( char == '-' ) else str.upper( char ) + unicode = str( words[ 2 ][( words[ 2 ].find( unicode_begin ) + len( unicode_begin )) : words[ 2 ].find( unicode_end )]) + if unicode < min: + min = unicode + elif unicode >= max: + max = unicode + output_fonts += line_format( font_abbr, font, unicode, cpp11 ) + output = get_prelude( source_url ) + \ + LINE_FORMAT_MINMAX.format( 'MIN', font_abbr, min ) + \ + LINE_FORMAT_MINMAX.format( 'MAX', font_abbr, max ) + \ + output_fonts + with open( output_file, 'w' ) as f: + f.write( output ) + print( MESSAGE_SUCCESS.format( font_name, output_file )) + except Exception as e: + print( MESSAGE_ERROR.format( font_name, e )) + + +# Main + +convert_font_awesome( 'Font Awesome', 'FA', 'https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml', 'icons_font_awesome.h', False ) +convert_material_design( 'Material Design', 'MD', 'https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/codepoints', 'icons_material_design.h', False ) +convert_kenney( 'Kenney', 'KI', 'https://raw.githubusercontent.com/SamBrishes/kenney-icon-font/master/css/kenney-icons.css', 'icons_kenney.h', False ) diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/LICENSE b/3rdparty/bgfx/3rdparty/iconfontheaders/LICENSE new file mode 100644 index 00000000000..f54b795b715 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Juliette Foucaut + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/README.md b/3rdparty/bgfx/3rdparty/iconfontheaders/README.md new file mode 100644 index 00000000000..2170dee402f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/README.md @@ -0,0 +1,29 @@ +# IconFontCHeaders +C++11 and C89 headers for icon fonts Font Awesome, Google Material Design icons and Kenney game icons. + +A set of header files for using icon fonts in C and C++, along with the python generator used to create the files. + +Each header contains defines for one font, with each icon code point defined as ICON_*, along with the min and max code points for font loading purposes. + +## Fonts + +* [Font Awesome](http://fortawesome.github.io/Font-Awesome/) - [github repository](https://github.com/FortAwesome/Font-Awesome/) +* [Google Material Design icons](https://design.google.com/icons/) - [github repository](https://github.com/google/material-design-icons/) +* [Kenney Game icons](http://kenney.nl/assets/game-icons) and [Game icons expansion](http://kenney.nl/assets/game-icons-expansion) - [github repository](https://github.com/SamBrishes/kenney-icon-font) + +## Usage + +Using [dear imgui](https://github.com/ocornut/imgui) as an example UI library: + + #include "IconsFontAwesome.h" + + ImGuiIO& io = ImGui::GetIO(); + io.Fonts->AddFontDefault(); + + // merge in icons from Font Awesome + static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 }; + ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true; + io.Fonts->AddFontFromFileTTF( fontFile.c_str(), 16.0f, &icons_config, icons_ranges); + + // in an imgui window somewhere... + ImGui::Text( ICON_FA_FILE " File" ); // use string literal concatenation, ouputs a file icon and File as a string. diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome.h new file mode 100644 index 00000000000..346358f0044 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome.h @@ -0,0 +1,611 @@ +// Generated by GenerateIconFontCppHeaders.py +// from https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml +#pragma once + +#define ICON_MIN_FA 0xf000 +#define ICON_MAX_FA 0xf295 +#define ICON_FA_GLASS "\xEF\x80\x80" +#define ICON_FA_MUSIC "\xEF\x80\x81" +#define ICON_FA_SEARCH "\xEF\x80\x82" +#define ICON_FA_ENVELOPE_O "\xEF\x80\x83" +#define ICON_FA_HEART "\xEF\x80\x84" +#define ICON_FA_STAR "\xEF\x80\x85" +#define ICON_FA_STAR_O "\xEF\x80\x86" +#define ICON_FA_USER "\xEF\x80\x87" +#define ICON_FA_FILM "\xEF\x80\x88" +#define ICON_FA_TH_LARGE "\xEF\x80\x89" +#define ICON_FA_TH "\xEF\x80\x8A" +#define ICON_FA_TH_LIST "\xEF\x80\x8B" +#define ICON_FA_CHECK "\xEF\x80\x8C" +#define ICON_FA_TIMES "\xEF\x80\x8D" +#define ICON_FA_SEARCH_PLUS "\xEF\x80\x8E" +#define ICON_FA_SEARCH_MINUS "\xEF\x80\x90" +#define ICON_FA_POWER_OFF "\xEF\x80\x91" +#define ICON_FA_SIGNAL "\xEF\x80\x92" +#define ICON_FA_COG "\xEF\x80\x93" +#define ICON_FA_TRASH_O "\xEF\x80\x94" +#define ICON_FA_HOME "\xEF\x80\x95" +#define ICON_FA_FILE_O "\xEF\x80\x96" +#define ICON_FA_CLOCK_O "\xEF\x80\x97" +#define ICON_FA_ROAD "\xEF\x80\x98" +#define ICON_FA_DOWNLOAD "\xEF\x80\x99" +#define ICON_FA_ARROW_CIRCLE_O_DOWN "\xEF\x80\x9A" +#define ICON_FA_ARROW_CIRCLE_O_UP "\xEF\x80\x9B" +#define ICON_FA_INBOX "\xEF\x80\x9C" +#define ICON_FA_PLAY_CIRCLE_O "\xEF\x80\x9D" +#define ICON_FA_REPEAT "\xEF\x80\x9E" +#define ICON_FA_REFRESH "\xEF\x80\xA1" +#define ICON_FA_LIST_ALT "\xEF\x80\xA2" +#define ICON_FA_LOCK "\xEF\x80\xA3" +#define ICON_FA_FLAG "\xEF\x80\xA4" +#define ICON_FA_HEADPHONES "\xEF\x80\xA5" +#define ICON_FA_VOLUME_OFF "\xEF\x80\xA6" +#define ICON_FA_VOLUME_DOWN "\xEF\x80\xA7" +#define ICON_FA_VOLUME_UP "\xEF\x80\xA8" +#define ICON_FA_QRCODE "\xEF\x80\xA9" +#define ICON_FA_BARCODE "\xEF\x80\xAA" +#define ICON_FA_TAG "\xEF\x80\xAB" +#define ICON_FA_TAGS "\xEF\x80\xAC" +#define ICON_FA_BOOK "\xEF\x80\xAD" +#define ICON_FA_BOOKMARK "\xEF\x80\xAE" +#define ICON_FA_PRINT "\xEF\x80\xAF" +#define ICON_FA_CAMERA "\xEF\x80\xB0" +#define ICON_FA_FONT "\xEF\x80\xB1" +#define ICON_FA_BOLD "\xEF\x80\xB2" +#define ICON_FA_ITALIC "\xEF\x80\xB3" +#define ICON_FA_TEXT_HEIGHT "\xEF\x80\xB4" +#define ICON_FA_TEXT_WIDTH "\xEF\x80\xB5" +#define ICON_FA_ALIGN_LEFT "\xEF\x80\xB6" +#define ICON_FA_ALIGN_CENTER "\xEF\x80\xB7" +#define ICON_FA_ALIGN_RIGHT "\xEF\x80\xB8" +#define ICON_FA_ALIGN_JUSTIFY "\xEF\x80\xB9" +#define ICON_FA_LIST "\xEF\x80\xBA" +#define ICON_FA_OUTDENT "\xEF\x80\xBB" +#define ICON_FA_INDENT "\xEF\x80\xBC" +#define ICON_FA_VIDEO_CAMERA "\xEF\x80\xBD" +#define ICON_FA_PICTURE_O "\xEF\x80\xBE" +#define ICON_FA_PENCIL "\xEF\x81\x80" +#define ICON_FA_MAP_MARKER "\xEF\x81\x81" +#define ICON_FA_ADJUST "\xEF\x81\x82" +#define ICON_FA_TINT "\xEF\x81\x83" +#define ICON_FA_PENCIL_SQUARE_O "\xEF\x81\x84" +#define ICON_FA_SHARE_SQUARE_O "\xEF\x81\x85" +#define ICON_FA_CHECK_SQUARE_O "\xEF\x81\x86" +#define ICON_FA_ARROWS "\xEF\x81\x87" +#define ICON_FA_STEP_BACKWARD "\xEF\x81\x88" +#define ICON_FA_FAST_BACKWARD "\xEF\x81\x89" +#define ICON_FA_BACKWARD "\xEF\x81\x8A" +#define ICON_FA_PLAY "\xEF\x81\x8B" +#define ICON_FA_PAUSE "\xEF\x81\x8C" +#define ICON_FA_STOP "\xEF\x81\x8D" +#define ICON_FA_FORWARD "\xEF\x81\x8E" +#define ICON_FA_FAST_FORWARD "\xEF\x81\x90" +#define ICON_FA_STEP_FORWARD "\xEF\x81\x91" +#define ICON_FA_EJECT "\xEF\x81\x92" +#define ICON_FA_CHEVRON_LEFT "\xEF\x81\x93" +#define ICON_FA_CHEVRON_RIGHT "\xEF\x81\x94" +#define ICON_FA_PLUS_CIRCLE "\xEF\x81\x95" +#define ICON_FA_MINUS_CIRCLE "\xEF\x81\x96" +#define ICON_FA_TIMES_CIRCLE "\xEF\x81\x97" +#define ICON_FA_CHECK_CIRCLE "\xEF\x81\x98" +#define ICON_FA_QUESTION_CIRCLE "\xEF\x81\x99" +#define ICON_FA_INFO_CIRCLE "\xEF\x81\x9A" +#define ICON_FA_CROSSHAIRS "\xEF\x81\x9B" +#define ICON_FA_TIMES_CIRCLE_O "\xEF\x81\x9C" +#define ICON_FA_CHECK_CIRCLE_O "\xEF\x81\x9D" +#define ICON_FA_BAN "\xEF\x81\x9E" +#define ICON_FA_ARROW_LEFT "\xEF\x81\xA0" +#define ICON_FA_ARROW_RIGHT "\xEF\x81\xA1" +#define ICON_FA_ARROW_UP "\xEF\x81\xA2" +#define ICON_FA_ARROW_DOWN "\xEF\x81\xA3" +#define ICON_FA_SHARE "\xEF\x81\xA4" +#define ICON_FA_EXPAND "\xEF\x81\xA5" +#define ICON_FA_COMPRESS "\xEF\x81\xA6" +#define ICON_FA_PLUS "\xEF\x81\xA7" +#define ICON_FA_MINUS "\xEF\x81\xA8" +#define ICON_FA_ASTERISK "\xEF\x81\xA9" +#define ICON_FA_EXCLAMATION_CIRCLE "\xEF\x81\xAA" +#define ICON_FA_GIFT "\xEF\x81\xAB" +#define ICON_FA_LEAF "\xEF\x81\xAC" +#define ICON_FA_FIRE "\xEF\x81\xAD" +#define ICON_FA_EYE "\xEF\x81\xAE" +#define ICON_FA_EYE_SLASH "\xEF\x81\xB0" +#define ICON_FA_EXCLAMATION_TRIANGLE "\xEF\x81\xB1" +#define ICON_FA_PLANE "\xEF\x81\xB2" +#define ICON_FA_CALENDAR "\xEF\x81\xB3" +#define ICON_FA_RANDOM "\xEF\x81\xB4" +#define ICON_FA_COMMENT "\xEF\x81\xB5" +#define ICON_FA_MAGNET "\xEF\x81\xB6" +#define ICON_FA_CHEVRON_UP "\xEF\x81\xB7" +#define ICON_FA_CHEVRON_DOWN "\xEF\x81\xB8" +#define ICON_FA_RETWEET "\xEF\x81\xB9" +#define ICON_FA_SHOPPING_CART "\xEF\x81\xBA" +#define ICON_FA_FOLDER "\xEF\x81\xBB" +#define ICON_FA_FOLDER_OPEN "\xEF\x81\xBC" +#define ICON_FA_ARROWS_V "\xEF\x81\xBD" +#define ICON_FA_ARROWS_H "\xEF\x81\xBE" +#define ICON_FA_BAR_CHART "\xEF\x82\x80" +#define ICON_FA_TWITTER_SQUARE "\xEF\x82\x81" +#define ICON_FA_FACEBOOK_SQUARE "\xEF\x82\x82" +#define ICON_FA_CAMERA_RETRO "\xEF\x82\x83" +#define ICON_FA_KEY "\xEF\x82\x84" +#define ICON_FA_COGS "\xEF\x82\x85" +#define ICON_FA_COMMENTS "\xEF\x82\x86" +#define ICON_FA_THUMBS_O_UP "\xEF\x82\x87" +#define ICON_FA_THUMBS_O_DOWN "\xEF\x82\x88" +#define ICON_FA_STAR_HALF "\xEF\x82\x89" +#define ICON_FA_HEART_O "\xEF\x82\x8A" +#define ICON_FA_SIGN_OUT "\xEF\x82\x8B" +#define ICON_FA_LINKEDIN_SQUARE "\xEF\x82\x8C" +#define ICON_FA_THUMB_TACK "\xEF\x82\x8D" +#define ICON_FA_EXTERNAL_LINK "\xEF\x82\x8E" +#define ICON_FA_SIGN_IN "\xEF\x82\x90" +#define ICON_FA_TROPHY "\xEF\x82\x91" +#define ICON_FA_GITHUB_SQUARE "\xEF\x82\x92" +#define ICON_FA_UPLOAD "\xEF\x82\x93" +#define ICON_FA_LEMON_O "\xEF\x82\x94" +#define ICON_FA_PHONE "\xEF\x82\x95" +#define ICON_FA_SQUARE_O "\xEF\x82\x96" +#define ICON_FA_BOOKMARK_O "\xEF\x82\x97" +#define ICON_FA_PHONE_SQUARE "\xEF\x82\x98" +#define ICON_FA_TWITTER "\xEF\x82\x99" +#define ICON_FA_FACEBOOK "\xEF\x82\x9A" +#define ICON_FA_GITHUB "\xEF\x82\x9B" +#define ICON_FA_UNLOCK "\xEF\x82\x9C" +#define ICON_FA_CREDIT_CARD "\xEF\x82\x9D" +#define ICON_FA_RSS "\xEF\x82\x9E" +#define ICON_FA_HDD_O "\xEF\x82\xA0" +#define ICON_FA_BULLHORN "\xEF\x82\xA1" +#define ICON_FA_BELL "\xEF\x83\xB3" +#define ICON_FA_CERTIFICATE "\xEF\x82\xA3" +#define ICON_FA_HAND_O_RIGHT "\xEF\x82\xA4" +#define ICON_FA_HAND_O_LEFT "\xEF\x82\xA5" +#define ICON_FA_HAND_O_UP "\xEF\x82\xA6" +#define ICON_FA_HAND_O_DOWN "\xEF\x82\xA7" +#define ICON_FA_ARROW_CIRCLE_LEFT "\xEF\x82\xA8" +#define ICON_FA_ARROW_CIRCLE_RIGHT "\xEF\x82\xA9" +#define ICON_FA_ARROW_CIRCLE_UP "\xEF\x82\xAA" +#define ICON_FA_ARROW_CIRCLE_DOWN "\xEF\x82\xAB" +#define ICON_FA_GLOBE "\xEF\x82\xAC" +#define ICON_FA_WRENCH "\xEF\x82\xAD" +#define ICON_FA_TASKS "\xEF\x82\xAE" +#define ICON_FA_FILTER "\xEF\x82\xB0" +#define ICON_FA_BRIEFCASE "\xEF\x82\xB1" +#define ICON_FA_ARROWS_ALT "\xEF\x82\xB2" +#define ICON_FA_USERS "\xEF\x83\x80" +#define ICON_FA_LINK "\xEF\x83\x81" +#define ICON_FA_CLOUD "\xEF\x83\x82" +#define ICON_FA_FLASK "\xEF\x83\x83" +#define ICON_FA_SCISSORS "\xEF\x83\x84" +#define ICON_FA_FILES_O "\xEF\x83\x85" +#define ICON_FA_PAPERCLIP "\xEF\x83\x86" +#define ICON_FA_FLOPPY_O "\xEF\x83\x87" +#define ICON_FA_SQUARE "\xEF\x83\x88" +#define ICON_FA_BARS "\xEF\x83\x89" +#define ICON_FA_LIST_UL "\xEF\x83\x8A" +#define ICON_FA_LIST_OL "\xEF\x83\x8B" +#define ICON_FA_STRIKETHROUGH "\xEF\x83\x8C" +#define ICON_FA_UNDERLINE "\xEF\x83\x8D" +#define ICON_FA_TABLE "\xEF\x83\x8E" +#define ICON_FA_MAGIC "\xEF\x83\x90" +#define ICON_FA_TRUCK "\xEF\x83\x91" +#define ICON_FA_PINTEREST "\xEF\x83\x92" +#define ICON_FA_PINTEREST_SQUARE "\xEF\x83\x93" +#define ICON_FA_GOOGLE_PLUS_SQUARE "\xEF\x83\x94" +#define ICON_FA_GOOGLE_PLUS "\xEF\x83\x95" +#define ICON_FA_MONEY "\xEF\x83\x96" +#define ICON_FA_CARET_DOWN "\xEF\x83\x97" +#define ICON_FA_CARET_UP "\xEF\x83\x98" +#define ICON_FA_CARET_LEFT "\xEF\x83\x99" +#define ICON_FA_CARET_RIGHT "\xEF\x83\x9A" +#define ICON_FA_COLUMNS "\xEF\x83\x9B" +#define ICON_FA_SORT "\xEF\x83\x9C" +#define ICON_FA_SORT_DESC "\xEF\x83\x9D" +#define ICON_FA_SORT_ASC "\xEF\x83\x9E" +#define ICON_FA_ENVELOPE "\xEF\x83\xA0" +#define ICON_FA_LINKEDIN "\xEF\x83\xA1" +#define ICON_FA_UNDO "\xEF\x83\xA2" +#define ICON_FA_GAVEL "\xEF\x83\xA3" +#define ICON_FA_TACHOMETER "\xEF\x83\xA4" +#define ICON_FA_COMMENT_O "\xEF\x83\xA5" +#define ICON_FA_COMMENTS_O "\xEF\x83\xA6" +#define ICON_FA_BOLT "\xEF\x83\xA7" +#define ICON_FA_SITEMAP "\xEF\x83\xA8" +#define ICON_FA_UMBRELLA "\xEF\x83\xA9" +#define ICON_FA_CLIPBOARD "\xEF\x83\xAA" +#define ICON_FA_LIGHTBULB_O "\xEF\x83\xAB" +#define ICON_FA_EXCHANGE "\xEF\x83\xAC" +#define ICON_FA_CLOUD_DOWNLOAD "\xEF\x83\xAD" +#define ICON_FA_CLOUD_UPLOAD "\xEF\x83\xAE" +#define ICON_FA_USER_MD "\xEF\x83\xB0" +#define ICON_FA_STETHOSCOPE "\xEF\x83\xB1" +#define ICON_FA_SUITCASE "\xEF\x83\xB2" +#define ICON_FA_BELL_O "\xEF\x82\xA2" +#define ICON_FA_COFFEE "\xEF\x83\xB4" +#define ICON_FA_CUTLERY "\xEF\x83\xB5" +#define ICON_FA_FILE_TEXT_O "\xEF\x83\xB6" +#define ICON_FA_BUILDING_O "\xEF\x83\xB7" +#define ICON_FA_HOSPITAL_O "\xEF\x83\xB8" +#define ICON_FA_AMBULANCE "\xEF\x83\xB9" +#define ICON_FA_MEDKIT "\xEF\x83\xBA" +#define ICON_FA_FIGHTER_JET "\xEF\x83\xBB" +#define ICON_FA_BEER "\xEF\x83\xBC" +#define ICON_FA_H_SQUARE "\xEF\x83\xBD" +#define ICON_FA_PLUS_SQUARE "\xEF\x83\xBE" +#define ICON_FA_ANGLE_DOUBLE_LEFT "\xEF\x84\x80" +#define ICON_FA_ANGLE_DOUBLE_RIGHT "\xEF\x84\x81" +#define ICON_FA_ANGLE_DOUBLE_UP "\xEF\x84\x82" +#define ICON_FA_ANGLE_DOUBLE_DOWN "\xEF\x84\x83" +#define ICON_FA_ANGLE_LEFT "\xEF\x84\x84" +#define ICON_FA_ANGLE_RIGHT "\xEF\x84\x85" +#define ICON_FA_ANGLE_UP "\xEF\x84\x86" +#define ICON_FA_ANGLE_DOWN "\xEF\x84\x87" +#define ICON_FA_DESKTOP "\xEF\x84\x88" +#define ICON_FA_LAPTOP "\xEF\x84\x89" +#define ICON_FA_TABLET "\xEF\x84\x8A" +#define ICON_FA_MOBILE "\xEF\x84\x8B" +#define ICON_FA_CIRCLE_O "\xEF\x84\x8C" +#define ICON_FA_QUOTE_LEFT "\xEF\x84\x8D" +#define ICON_FA_QUOTE_RIGHT "\xEF\x84\x8E" +#define ICON_FA_SPINNER "\xEF\x84\x90" +#define ICON_FA_CIRCLE "\xEF\x84\x91" +#define ICON_FA_REPLY "\xEF\x84\x92" +#define ICON_FA_GITHUB_ALT "\xEF\x84\x93" +#define ICON_FA_FOLDER_O "\xEF\x84\x94" +#define ICON_FA_FOLDER_OPEN_O "\xEF\x84\x95" +#define ICON_FA_SMILE_O "\xEF\x84\x98" +#define ICON_FA_FROWN_O "\xEF\x84\x99" +#define ICON_FA_MEH_O "\xEF\x84\x9A" +#define ICON_FA_GAMEPAD "\xEF\x84\x9B" +#define ICON_FA_KEYBOARD_O "\xEF\x84\x9C" +#define ICON_FA_FLAG_O "\xEF\x84\x9D" +#define ICON_FA_FLAG_CHECKERED "\xEF\x84\x9E" +#define ICON_FA_TERMINAL "\xEF\x84\xA0" +#define ICON_FA_CODE "\xEF\x84\xA1" +#define ICON_FA_REPLY_ALL "\xEF\x84\xA2" +#define ICON_FA_STAR_HALF_O "\xEF\x84\xA3" +#define ICON_FA_LOCATION_ARROW "\xEF\x84\xA4" +#define ICON_FA_CROP "\xEF\x84\xA5" +#define ICON_FA_CODE_FORK "\xEF\x84\xA6" +#define ICON_FA_CHAIN_BROKEN "\xEF\x84\xA7" +#define ICON_FA_QUESTION "\xEF\x84\xA8" +#define ICON_FA_INFO "\xEF\x84\xA9" +#define ICON_FA_EXCLAMATION "\xEF\x84\xAA" +#define ICON_FA_SUPERSCRIPT "\xEF\x84\xAB" +#define ICON_FA_SUBSCRIPT "\xEF\x84\xAC" +#define ICON_FA_ERASER "\xEF\x84\xAD" +#define ICON_FA_PUZZLE_PIECE "\xEF\x84\xAE" +#define ICON_FA_MICROPHONE "\xEF\x84\xB0" +#define ICON_FA_MICROPHONE_SLASH "\xEF\x84\xB1" +#define ICON_FA_SHIELD "\xEF\x84\xB2" +#define ICON_FA_CALENDAR_O "\xEF\x84\xB3" +#define ICON_FA_FIRE_EXTINGUISHER "\xEF\x84\xB4" +#define ICON_FA_ROCKET "\xEF\x84\xB5" +#define ICON_FA_MAXCDN "\xEF\x84\xB6" +#define ICON_FA_CHEVRON_CIRCLE_LEFT "\xEF\x84\xB7" +#define ICON_FA_CHEVRON_CIRCLE_RIGHT "\xEF\x84\xB8" +#define ICON_FA_CHEVRON_CIRCLE_UP "\xEF\x84\xB9" +#define ICON_FA_CHEVRON_CIRCLE_DOWN "\xEF\x84\xBA" +#define ICON_FA_HTML5 "\xEF\x84\xBB" +#define ICON_FA_CSS3 "\xEF\x84\xBC" +#define ICON_FA_ANCHOR "\xEF\x84\xBD" +#define ICON_FA_UNLOCK_ALT "\xEF\x84\xBE" +#define ICON_FA_BULLSEYE "\xEF\x85\x80" +#define ICON_FA_ELLIPSIS_H "\xEF\x85\x81" +#define ICON_FA_ELLIPSIS_V "\xEF\x85\x82" +#define ICON_FA_RSS_SQUARE "\xEF\x85\x83" +#define ICON_FA_PLAY_CIRCLE "\xEF\x85\x84" +#define ICON_FA_TICKET "\xEF\x85\x85" +#define ICON_FA_MINUS_SQUARE "\xEF\x85\x86" +#define ICON_FA_MINUS_SQUARE_O "\xEF\x85\x87" +#define ICON_FA_LEVEL_UP "\xEF\x85\x88" +#define ICON_FA_LEVEL_DOWN "\xEF\x85\x89" +#define ICON_FA_CHECK_SQUARE "\xEF\x85\x8A" +#define ICON_FA_PENCIL_SQUARE "\xEF\x85\x8B" +#define ICON_FA_EXTERNAL_LINK_SQUARE "\xEF\x85\x8C" +#define ICON_FA_SHARE_SQUARE "\xEF\x85\x8D" +#define ICON_FA_COMPASS "\xEF\x85\x8E" +#define ICON_FA_CARET_SQUARE_O_DOWN "\xEF\x85\x90" +#define ICON_FA_CARET_SQUARE_O_UP "\xEF\x85\x91" +#define ICON_FA_CARET_SQUARE_O_RIGHT "\xEF\x85\x92" +#define ICON_FA_EUR "\xEF\x85\x93" +#define ICON_FA_GBP "\xEF\x85\x94" +#define ICON_FA_USD "\xEF\x85\x95" +#define ICON_FA_INR "\xEF\x85\x96" +#define ICON_FA_JPY "\xEF\x85\x97" +#define ICON_FA_RUB "\xEF\x85\x98" +#define ICON_FA_KRW "\xEF\x85\x99" +#define ICON_FA_BTC "\xEF\x85\x9A" +#define ICON_FA_FILE "\xEF\x85\x9B" +#define ICON_FA_FILE_TEXT "\xEF\x85\x9C" +#define ICON_FA_SORT_ALPHA_ASC "\xEF\x85\x9D" +#define ICON_FA_SORT_ALPHA_DESC "\xEF\x85\x9E" +#define ICON_FA_SORT_AMOUNT_ASC "\xEF\x85\xA0" +#define ICON_FA_SORT_AMOUNT_DESC "\xEF\x85\xA1" +#define ICON_FA_SORT_NUMERIC_ASC "\xEF\x85\xA2" +#define ICON_FA_SORT_NUMERIC_DESC "\xEF\x85\xA3" +#define ICON_FA_THUMBS_UP "\xEF\x85\xA4" +#define ICON_FA_THUMBS_DOWN "\xEF\x85\xA5" +#define ICON_FA_YOUTUBE_SQUARE "\xEF\x85\xA6" +#define ICON_FA_YOUTUBE "\xEF\x85\xA7" +#define ICON_FA_XING "\xEF\x85\xA8" +#define ICON_FA_XING_SQUARE "\xEF\x85\xA9" +#define ICON_FA_YOUTUBE_PLAY "\xEF\x85\xAA" +#define ICON_FA_DROPBOX "\xEF\x85\xAB" +#define ICON_FA_STACK_OVERFLOW "\xEF\x85\xAC" +#define ICON_FA_INSTAGRAM "\xEF\x85\xAD" +#define ICON_FA_FLICKR "\xEF\x85\xAE" +#define ICON_FA_ADN "\xEF\x85\xB0" +#define ICON_FA_BITBUCKET "\xEF\x85\xB1" +#define ICON_FA_BITBUCKET_SQUARE "\xEF\x85\xB2" +#define ICON_FA_TUMBLR "\xEF\x85\xB3" +#define ICON_FA_TUMBLR_SQUARE "\xEF\x85\xB4" +#define ICON_FA_LONG_ARROW_DOWN "\xEF\x85\xB5" +#define ICON_FA_LONG_ARROW_UP "\xEF\x85\xB6" +#define ICON_FA_LONG_ARROW_LEFT "\xEF\x85\xB7" +#define ICON_FA_LONG_ARROW_RIGHT "\xEF\x85\xB8" +#define ICON_FA_APPLE "\xEF\x85\xB9" +#define ICON_FA_WINDOWS "\xEF\x85\xBA" +#define ICON_FA_ANDROID "\xEF\x85\xBB" +#define ICON_FA_LINUX "\xEF\x85\xBC" +#define ICON_FA_DRIBBBLE "\xEF\x85\xBD" +#define ICON_FA_SKYPE "\xEF\x85\xBE" +#define ICON_FA_FOURSQUARE "\xEF\x86\x80" +#define ICON_FA_TRELLO "\xEF\x86\x81" +#define ICON_FA_FEMALE "\xEF\x86\x82" +#define ICON_FA_MALE "\xEF\x86\x83" +#define ICON_FA_GRATIPAY "\xEF\x86\x84" +#define ICON_FA_SUN_O "\xEF\x86\x85" +#define ICON_FA_MOON_O "\xEF\x86\x86" +#define ICON_FA_ARCHIVE "\xEF\x86\x87" +#define ICON_FA_BUG "\xEF\x86\x88" +#define ICON_FA_VK "\xEF\x86\x89" +#define ICON_FA_WEIBO "\xEF\x86\x8A" +#define ICON_FA_RENREN "\xEF\x86\x8B" +#define ICON_FA_PAGELINES "\xEF\x86\x8C" +#define ICON_FA_STACK_EXCHANGE "\xEF\x86\x8D" +#define ICON_FA_ARROW_CIRCLE_O_RIGHT "\xEF\x86\x8E" +#define ICON_FA_ARROW_CIRCLE_O_LEFT "\xEF\x86\x90" +#define ICON_FA_CARET_SQUARE_O_LEFT "\xEF\x86\x91" +#define ICON_FA_DOT_CIRCLE_O "\xEF\x86\x92" +#define ICON_FA_WHEELCHAIR "\xEF\x86\x93" +#define ICON_FA_VIMEO_SQUARE "\xEF\x86\x94" +#define ICON_FA_TRY "\xEF\x86\x95" +#define ICON_FA_PLUS_SQUARE_O "\xEF\x86\x96" +#define ICON_FA_SPACE_SHUTTLE "\xEF\x86\x97" +#define ICON_FA_SLACK "\xEF\x86\x98" +#define ICON_FA_ENVELOPE_SQUARE "\xEF\x86\x99" +#define ICON_FA_WORDPRESS "\xEF\x86\x9A" +#define ICON_FA_OPENID "\xEF\x86\x9B" +#define ICON_FA_UNIVERSITY "\xEF\x86\x9C" +#define ICON_FA_GRADUATION_CAP "\xEF\x86\x9D" +#define ICON_FA_YAHOO "\xEF\x86\x9E" +#define ICON_FA_GOOGLE "\xEF\x86\xA0" +#define ICON_FA_REDDIT "\xEF\x86\xA1" +#define ICON_FA_REDDIT_SQUARE "\xEF\x86\xA2" +#define ICON_FA_STUMBLEUPON_CIRCLE "\xEF\x86\xA3" +#define ICON_FA_STUMBLEUPON "\xEF\x86\xA4" +#define ICON_FA_DELICIOUS "\xEF\x86\xA5" +#define ICON_FA_DIGG "\xEF\x86\xA6" +#define ICON_FA_PIED_PIPER "\xEF\x86\xA7" +#define ICON_FA_PIED_PIPER_ALT "\xEF\x86\xA8" +#define ICON_FA_DRUPAL "\xEF\x86\xA9" +#define ICON_FA_JOOMLA "\xEF\x86\xAA" +#define ICON_FA_LANGUAGE "\xEF\x86\xAB" +#define ICON_FA_FAX "\xEF\x86\xAC" +#define ICON_FA_BUILDING "\xEF\x86\xAD" +#define ICON_FA_CHILD "\xEF\x86\xAE" +#define ICON_FA_PAW "\xEF\x86\xB0" +#define ICON_FA_SPOON "\xEF\x86\xB1" +#define ICON_FA_CUBE "\xEF\x86\xB2" +#define ICON_FA_CUBES "\xEF\x86\xB3" +#define ICON_FA_BEHANCE "\xEF\x86\xB4" +#define ICON_FA_BEHANCE_SQUARE "\xEF\x86\xB5" +#define ICON_FA_STEAM "\xEF\x86\xB6" +#define ICON_FA_STEAM_SQUARE "\xEF\x86\xB7" +#define ICON_FA_RECYCLE "\xEF\x86\xB8" +#define ICON_FA_CAR "\xEF\x86\xB9" +#define ICON_FA_TAXI "\xEF\x86\xBA" +#define ICON_FA_TREE "\xEF\x86\xBB" +#define ICON_FA_SPOTIFY "\xEF\x86\xBC" +#define ICON_FA_DEVIANTART "\xEF\x86\xBD" +#define ICON_FA_SOUNDCLOUD "\xEF\x86\xBE" +#define ICON_FA_DATABASE "\xEF\x87\x80" +#define ICON_FA_FILE_PDF_O "\xEF\x87\x81" +#define ICON_FA_FILE_WORD_O "\xEF\x87\x82" +#define ICON_FA_FILE_EXCEL_O "\xEF\x87\x83" +#define ICON_FA_FILE_POWERPOINT_O "\xEF\x87\x84" +#define ICON_FA_FILE_IMAGE_O "\xEF\x87\x85" +#define ICON_FA_FILE_ARCHIVE_O "\xEF\x87\x86" +#define ICON_FA_FILE_AUDIO_O "\xEF\x87\x87" +#define ICON_FA_FILE_VIDEO_O "\xEF\x87\x88" +#define ICON_FA_FILE_CODE_O "\xEF\x87\x89" +#define ICON_FA_VINE "\xEF\x87\x8A" +#define ICON_FA_CODEPEN "\xEF\x87\x8B" +#define ICON_FA_JSFIDDLE "\xEF\x87\x8C" +#define ICON_FA_LIFE_RING "\xEF\x87\x8D" +#define ICON_FA_CIRCLE_O_NOTCH "\xEF\x87\x8E" +#define ICON_FA_REBEL "\xEF\x87\x90" +#define ICON_FA_EMPIRE "\xEF\x87\x91" +#define ICON_FA_GIT_SQUARE "\xEF\x87\x92" +#define ICON_FA_GIT "\xEF\x87\x93" +#define ICON_FA_HACKER_NEWS "\xEF\x87\x94" +#define ICON_FA_TENCENT_WEIBO "\xEF\x87\x95" +#define ICON_FA_QQ "\xEF\x87\x96" +#define ICON_FA_WEIXIN "\xEF\x87\x97" +#define ICON_FA_PAPER_PLANE "\xEF\x87\x98" +#define ICON_FA_PAPER_PLANE_O "\xEF\x87\x99" +#define ICON_FA_HISTORY "\xEF\x87\x9A" +#define ICON_FA_CIRCLE_THIN "\xEF\x87\x9B" +#define ICON_FA_HEADER "\xEF\x87\x9C" +#define ICON_FA_PARAGRAPH "\xEF\x87\x9D" +#define ICON_FA_SLIDERS "\xEF\x87\x9E" +#define ICON_FA_SHARE_ALT "\xEF\x87\xA0" +#define ICON_FA_SHARE_ALT_SQUARE "\xEF\x87\xA1" +#define ICON_FA_BOMB "\xEF\x87\xA2" +#define ICON_FA_FUTBOL_O "\xEF\x87\xA3" +#define ICON_FA_TTY "\xEF\x87\xA4" +#define ICON_FA_BINOCULARS "\xEF\x87\xA5" +#define ICON_FA_PLUG "\xEF\x87\xA6" +#define ICON_FA_SLIDESHARE "\xEF\x87\xA7" +#define ICON_FA_TWITCH "\xEF\x87\xA8" +#define ICON_FA_YELP "\xEF\x87\xA9" +#define ICON_FA_NEWSPAPER_O "\xEF\x87\xAA" +#define ICON_FA_WIFI "\xEF\x87\xAB" +#define ICON_FA_CALCULATOR "\xEF\x87\xAC" +#define ICON_FA_PAYPAL "\xEF\x87\xAD" +#define ICON_FA_GOOGLE_WALLET "\xEF\x87\xAE" +#define ICON_FA_CC_VISA "\xEF\x87\xB0" +#define ICON_FA_CC_MASTERCARD "\xEF\x87\xB1" +#define ICON_FA_CC_DISCOVER "\xEF\x87\xB2" +#define ICON_FA_CC_AMEX "\xEF\x87\xB3" +#define ICON_FA_CC_PAYPAL "\xEF\x87\xB4" +#define ICON_FA_CC_STRIPE "\xEF\x87\xB5" +#define ICON_FA_BELL_SLASH "\xEF\x87\xB6" +#define ICON_FA_BELL_SLASH_O "\xEF\x87\xB7" +#define ICON_FA_TRASH "\xEF\x87\xB8" +#define ICON_FA_COPYRIGHT "\xEF\x87\xB9" +#define ICON_FA_AT "\xEF\x87\xBA" +#define ICON_FA_EYEDROPPER "\xEF\x87\xBB" +#define ICON_FA_PAINT_BRUSH "\xEF\x87\xBC" +#define ICON_FA_BIRTHDAY_CAKE "\xEF\x87\xBD" +#define ICON_FA_AREA_CHART "\xEF\x87\xBE" +#define ICON_FA_PIE_CHART "\xEF\x88\x80" +#define ICON_FA_LINE_CHART "\xEF\x88\x81" +#define ICON_FA_LASTFM "\xEF\x88\x82" +#define ICON_FA_LASTFM_SQUARE "\xEF\x88\x83" +#define ICON_FA_TOGGLE_OFF "\xEF\x88\x84" +#define ICON_FA_TOGGLE_ON "\xEF\x88\x85" +#define ICON_FA_BICYCLE "\xEF\x88\x86" +#define ICON_FA_BUS "\xEF\x88\x87" +#define ICON_FA_IOXHOST "\xEF\x88\x88" +#define ICON_FA_ANGELLIST "\xEF\x88\x89" +#define ICON_FA_CC "\xEF\x88\x8A" +#define ICON_FA_ILS "\xEF\x88\x8B" +#define ICON_FA_MEANPATH "\xEF\x88\x8C" +#define ICON_FA_BUYSELLADS "\xEF\x88\x8D" +#define ICON_FA_CONNECTDEVELOP "\xEF\x88\x8E" +#define ICON_FA_DASHCUBE "\xEF\x88\x90" +#define ICON_FA_FORUMBEE "\xEF\x88\x91" +#define ICON_FA_LEANPUB "\xEF\x88\x92" +#define ICON_FA_SELLSY "\xEF\x88\x93" +#define ICON_FA_SHIRTSINBULK "\xEF\x88\x94" +#define ICON_FA_SIMPLYBUILT "\xEF\x88\x95" +#define ICON_FA_SKYATLAS "\xEF\x88\x96" +#define ICON_FA_CART_PLUS "\xEF\x88\x97" +#define ICON_FA_CART_ARROW_DOWN "\xEF\x88\x98" +#define ICON_FA_DIAMOND "\xEF\x88\x99" +#define ICON_FA_SHIP "\xEF\x88\x9A" +#define ICON_FA_USER_SECRET "\xEF\x88\x9B" +#define ICON_FA_MOTORCYCLE "\xEF\x88\x9C" +#define ICON_FA_STREET_VIEW "\xEF\x88\x9D" +#define ICON_FA_HEARTBEAT "\xEF\x88\x9E" +#define ICON_FA_VENUS "\xEF\x88\xA1" +#define ICON_FA_MARS "\xEF\x88\xA2" +#define ICON_FA_MERCURY "\xEF\x88\xA3" +#define ICON_FA_TRANSGENDER "\xEF\x88\xA4" +#define ICON_FA_TRANSGENDER_ALT "\xEF\x88\xA5" +#define ICON_FA_VENUS_DOUBLE "\xEF\x88\xA6" +#define ICON_FA_MARS_DOUBLE "\xEF\x88\xA7" +#define ICON_FA_VENUS_MARS "\xEF\x88\xA8" +#define ICON_FA_MARS_STROKE "\xEF\x88\xA9" +#define ICON_FA_MARS_STROKE_V "\xEF\x88\xAA" +#define ICON_FA_MARS_STROKE_H "\xEF\x88\xAB" +#define ICON_FA_NEUTER "\xEF\x88\xAC" +#define ICON_FA_GENDERLESS "\xEF\x88\xAD" +#define ICON_FA_FACEBOOK_OFFICIAL "\xEF\x88\xB0" +#define ICON_FA_PINTEREST_P "\xEF\x88\xB1" +#define ICON_FA_WHATSAPP "\xEF\x88\xB2" +#define ICON_FA_SERVER "\xEF\x88\xB3" +#define ICON_FA_USER_PLUS "\xEF\x88\xB4" +#define ICON_FA_USER_TIMES "\xEF\x88\xB5" +#define ICON_FA_BED "\xEF\x88\xB6" +#define ICON_FA_VIACOIN "\xEF\x88\xB7" +#define ICON_FA_TRAIN "\xEF\x88\xB8" +#define ICON_FA_SUBWAY "\xEF\x88\xB9" +#define ICON_FA_MEDIUM "\xEF\x88\xBA" +#define ICON_FA_Y_COMBINATOR "\xEF\x88\xBB" +#define ICON_FA_OPTIN_MONSTER "\xEF\x88\xBC" +#define ICON_FA_OPENCART "\xEF\x88\xBD" +#define ICON_FA_EXPEDITEDSSL "\xEF\x88\xBE" +#define ICON_FA_BATTERY_FULL "\xEF\x89\x80" +#define ICON_FA_BATTERY_THREE_QUARTERS "\xEF\x89\x81" +#define ICON_FA_BATTERY_HALF "\xEF\x89\x82" +#define ICON_FA_BATTERY_QUARTER "\xEF\x89\x83" +#define ICON_FA_BATTERY_EMPTY "\xEF\x89\x84" +#define ICON_FA_MOUSE_POINTER "\xEF\x89\x85" +#define ICON_FA_I_CURSOR "\xEF\x89\x86" +#define ICON_FA_OBJECT_GROUP "\xEF\x89\x87" +#define ICON_FA_OBJECT_UNGROUP "\xEF\x89\x88" +#define ICON_FA_STICKY_NOTE "\xEF\x89\x89" +#define ICON_FA_STICKY_NOTE_O "\xEF\x89\x8A" +#define ICON_FA_CC_JCB "\xEF\x89\x8B" +#define ICON_FA_CC_DINERS_CLUB "\xEF\x89\x8C" +#define ICON_FA_CLONE "\xEF\x89\x8D" +#define ICON_FA_BALANCE_SCALE "\xEF\x89\x8E" +#define ICON_FA_HOURGLASS_O "\xEF\x89\x90" +#define ICON_FA_HOURGLASS_START "\xEF\x89\x91" +#define ICON_FA_HOURGLASS_HALF "\xEF\x89\x92" +#define ICON_FA_HOURGLASS_END "\xEF\x89\x93" +#define ICON_FA_HOURGLASS "\xEF\x89\x94" +#define ICON_FA_HAND_ROCK_O "\xEF\x89\x95" +#define ICON_FA_HAND_PAPER_O "\xEF\x89\x96" +#define ICON_FA_HAND_SCISSORS_O "\xEF\x89\x97" +#define ICON_FA_HAND_LIZARD_O "\xEF\x89\x98" +#define ICON_FA_HAND_SPOCK_O "\xEF\x89\x99" +#define ICON_FA_HAND_POINTER_O "\xEF\x89\x9A" +#define ICON_FA_HAND_PEACE_O "\xEF\x89\x9B" +#define ICON_FA_TRADEMARK "\xEF\x89\x9C" +#define ICON_FA_REGISTERED "\xEF\x89\x9D" +#define ICON_FA_CREATIVE_COMMONS "\xEF\x89\x9E" +#define ICON_FA_GG "\xEF\x89\xA0" +#define ICON_FA_GG_CIRCLE "\xEF\x89\xA1" +#define ICON_FA_TRIPADVISOR "\xEF\x89\xA2" +#define ICON_FA_ODNOKLASSNIKI "\xEF\x89\xA3" +#define ICON_FA_ODNOKLASSNIKI_SQUARE "\xEF\x89\xA4" +#define ICON_FA_GET_POCKET "\xEF\x89\xA5" +#define ICON_FA_WIKIPEDIA_W "\xEF\x89\xA6" +#define ICON_FA_SAFARI "\xEF\x89\xA7" +#define ICON_FA_CHROME "\xEF\x89\xA8" +#define ICON_FA_FIREFOX "\xEF\x89\xA9" +#define ICON_FA_OPERA "\xEF\x89\xAA" +#define ICON_FA_INTERNET_EXPLORER "\xEF\x89\xAB" +#define ICON_FA_TELEVISION "\xEF\x89\xAC" +#define ICON_FA_CONTAO "\xEF\x89\xAD" +#define ICON_FA_500PX "\xEF\x89\xAE" +#define ICON_FA_AMAZON "\xEF\x89\xB0" +#define ICON_FA_CALENDAR_PLUS_O "\xEF\x89\xB1" +#define ICON_FA_CALENDAR_MINUS_O "\xEF\x89\xB2" +#define ICON_FA_CALENDAR_TIMES_O "\xEF\x89\xB3" +#define ICON_FA_CALENDAR_CHECK_O "\xEF\x89\xB4" +#define ICON_FA_INDUSTRY "\xEF\x89\xB5" +#define ICON_FA_MAP_PIN "\xEF\x89\xB6" +#define ICON_FA_MAP_SIGNS "\xEF\x89\xB7" +#define ICON_FA_MAP_O "\xEF\x89\xB8" +#define ICON_FA_MAP "\xEF\x89\xB9" +#define ICON_FA_COMMENTING "\xEF\x89\xBA" +#define ICON_FA_COMMENTING_O "\xEF\x89\xBB" +#define ICON_FA_HOUZZ "\xEF\x89\xBC" +#define ICON_FA_VIMEO "\xEF\x89\xBD" +#define ICON_FA_BLACK_TIE "\xEF\x89\xBE" +#define ICON_FA_FONTICONS "\xEF\x8A\x80" +#define ICON_FA_REDDIT_ALIEN "\xEF\x8A\x81" +#define ICON_FA_EDGE "\xEF\x8A\x82" +#define ICON_FA_CREDIT_CARD_ALT "\xEF\x8A\x83" +#define ICON_FA_CODIEPIE "\xEF\x8A\x84" +#define ICON_FA_MODX "\xEF\x8A\x85" +#define ICON_FA_FORT_AWESOME "\xEF\x8A\x86" +#define ICON_FA_USB "\xEF\x8A\x87" +#define ICON_FA_PRODUCT_HUNT "\xEF\x8A\x88" +#define ICON_FA_MIXCLOUD "\xEF\x8A\x89" +#define ICON_FA_SCRIBD "\xEF\x8A\x8A" +#define ICON_FA_PAUSE_CIRCLE "\xEF\x8A\x8B" +#define ICON_FA_PAUSE_CIRCLE_O "\xEF\x8A\x8C" +#define ICON_FA_STOP_CIRCLE "\xEF\x8A\x8D" +#define ICON_FA_STOP_CIRCLE_O "\xEF\x8A\x8E" +#define ICON_FA_SHOPPING_BAG "\xEF\x8A\x90" +#define ICON_FA_SHOPPING_BASKET "\xEF\x8A\x91" +#define ICON_FA_HASHTAG "\xEF\x8A\x92" +#define ICON_FA_BLUETOOTH "\xEF\x8A\x93" +#define ICON_FA_BLUETOOTH_B "\xEF\x8A\x94" +#define ICON_FA_PERCENT "\xEF\x8A\x95" diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h new file mode 100644 index 00000000000..dbbcb48d904 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h @@ -0,0 +1,234 @@ +// Generated by GenerateIconFontCppHeaders.py +// from https://raw.githubusercontent.com/SamBrishes/kenney-icon-font/master/css/kenney-icons.css +#pragma once + +#define ICON_MIN_KI 0xe900 +#define ICON_MAX_KI 0xe9e3 +#define ICON_KI_HOME "\xEE\xA4\x80" +#define ICON_KI_ADJUST "\xEE\xA4\x81" +#define ICON_KI_WRENCH "\xEE\xA4\x82" +#define ICON_KI_COG "\xEE\xA4\x83" +#define ICON_KI_OFF "\xEE\xA4\x84" +#define ICON_KI_EXPAND "\xEE\xA4\x85" +#define ICON_KI_REDUCE "\xEE\xA4\x86" +#define ICON_KI_MOVIE "\xEE\xA4\x87" +#define ICON_KI_FLAP "\xEE\xA4\x88" +#define ICON_KI_SHOPPING_CART "\xEE\xA4\x89" +#define ICON_KI_SHOPPING_CASE "\xEE\xA4\x8A" +#define ICON_KI_EXTERNAL "\xEE\xA4\x8B" +#define ICON_KI_NETWORK "\xEE\xA4\x8C" +#define ICON_KI_CHECK "\xEE\xA4\x8D" +#define ICON_KI_TIMES "\xEE\xA4\x8E" +#define ICON_KI_TIMES_CIRCLE "\xEE\xA4\x8F" +#define ICON_KI_PLUS "\xEE\xA4\x90" +#define ICON_KI_PLUS_CIRCLE "\xEE\xA4\x91" +#define ICON_KI_MINUS "\xEE\xA4\x92" +#define ICON_KI_MINUS_CIRCLE "\xEE\xA4\x93" +#define ICON_KI_INFO "\xEE\xA4\x94" +#define ICON_KI_INFO_CIRCLE "\xEE\xA4\x95" +#define ICON_KI_QUESTION "\xEE\xA4\x96" +#define ICON_KI_QUESTION_CIRCLE "\xEE\xA4\x97" +#define ICON_KI_EXLAMATION "\xEE\xA4\x98" +#define ICON_KI_EXCLAMATION_CIRCLE "\xEE\xA4\x99" +#define ICON_KI_EXCLAMATION_TRIANGLE "\xEE\xA4\x9A" +#define ICON_KI_PAINT_BRUSH "\xEE\xA4\x9B" +#define ICON_KI_PENCIL "\xEE\xA4\x9C" +#define ICON_KI_CHECKBOX "\xEE\xA4\x9D" +#define ICON_KI_CHECKBOX_CHECKED "\xEE\xA4\x9E" +#define ICON_KI_RADIO "\xEE\xA4\x9F" +#define ICON_KI_RADIO_CHECKED "\xEE\xA4\xA0" +#define ICON_KI_SORT_VERTICAL "\xEE\xA4\xA1" +#define ICON_KI_SORT_HORIZONTAL "\xEE\xA4\xA2" +#define ICON_KI_GRID "\xEE\xA4\xA3" +#define ICON_KI_LIST "\xEE\xA4\xA4" +#define ICON_KI_ROWS "\xEE\xA4\xA5" +#define ICON_KI_CELLS "\xEE\xA4\xA6" +#define ICON_KI_SIGNAL_LOW "\xEE\xA4\xA7" +#define ICON_KI_SIGNAL_MEDIUM "\xEE\xA4\xA8" +#define ICON_KI_SIGNAL_HIGH "\xEE\xA4\xA9" +#define ICON_KI_TRASH "\xEE\xA4\xAA" +#define ICON_KI_TRASH_ALT "\xEE\xA4\xAB" +#define ICON_KI_RELOAD_INVERSE "\xEE\xA4\xAC" +#define ICON_KI_RELOAD "\xEE\xA4\xAD" +#define ICON_KI_TOP "\xEE\xA4\xAE" +#define ICON_KI_BOTTOM "\xEE\xA4\xAF" +#define ICON_KI_UPLOAD "\xEE\xA4\xB0" +#define ICON_KI_DOWNLOAD "\xEE\xA4\xB1" +#define ICON_KI_CLOUD "\xEE\xA4\xB2" +#define ICON_KI_CLOUD_UPLOAD "\xEE\xA4\xB3" +#define ICON_KI_CLOUD_DOWNLOAD "\xEE\xA4\xB4" +#define ICON_KI_SEARCH "\xEE\xA4\xB5" +#define ICON_KI_SEARCH_PLUS "\xEE\xA4\xB6" +#define ICON_KI_SEARCH_MINUS "\xEE\xA4\xB7" +#define ICON_KI_SEARCH_EQUAL "\xEE\xA4\xB8" +#define ICON_KI_LOCK "\xEE\xA4\xB9" +#define ICON_KI_UNLOCK "\xEE\xA4\xBA" +#define ICON_KI_USER "\xEE\xA4\xBB" +#define ICON_KI_USERS "\xEE\xA4\xBC" +#define ICON_KI_USERS_ALT "\xEE\xA4\xBD" +#define ICON_KI_SIGN_IN "\xEE\xA4\xBE" +#define ICON_KI_SIGN_IN_INVERSE "\xEE\xA4\xBF" +#define ICON_KI_SIGN_OUT "\xEE\xA5\x80" +#define ICON_KI_SIGN_OUT_INVERSE "\xEE\xA5\x81" +#define ICON_KI_ARROW_TOP "\xEE\xA5\x82" +#define ICON_KI_ARROW_RIGHT "\xEE\xA5\x83" +#define ICON_KI_ARROW_BOTTOM "\xEE\xA5\x84" +#define ICON_KI_ARROW_LEFT "\xEE\xA5\x85" +#define ICON_KI_ARROW_TOP_LEFT "\xEE\xA5\x86" +#define ICON_KI_ARROW_TOP_RIGHT "\xEE\xA5\x87" +#define ICON_KI_ARROW_BOTTOM_RIGHT "\xEE\xA5\x88" +#define ICON_KI_ARROW_BOTTOM_LEFT "\xEE\xA5\x89" +#define ICON_KI_CARET_TOP "\xEE\xA5\x8A" +#define ICON_KI_CARET_RIGHT "\xEE\xA5\x8B" +#define ICON_KI_CARET_BOTTOM "\xEE\xA5\x8C" +#define ICON_KI_CARET_LEFT "\xEE\xA5\x8D" +#define ICON_KI_NEXT_ALT "\xEE\xA5\x8E" +#define ICON_KI_NEXT "\xEE\xA5\x8F" +#define ICON_KI_PREVIOUS "\xEE\xA5\x90" +#define ICON_KI_PREVIOUS_ALT "\xEE\xA5\x91" +#define ICON_KI_FILL "\xEE\xA5\x92" +#define ICON_KI_ERASER "\xEE\xA5\x93" +#define ICON_KI_SAVE "\xEE\xA5\x94" +#define ICON_KI_STEP_BACKWARD "\xEE\xA5\x95" +#define ICON_KI_BACKWARD "\xEE\xA5\x96" +#define ICON_KI_PAUSE "\xEE\xA5\x97" +#define ICON_KI_FORWARD "\xEE\xA5\x98" +#define ICON_KI_STEP_FORWARD "\xEE\xA5\x99" +#define ICON_KI_STOP "\xEE\xA5\x9A" +#define ICON_KI_REC "\xEE\xA5\x9B" +#define ICON_KI_CURSOR "\xEE\xA5\x9C" +#define ICON_KI_POINTER "\xEE\xA5\x9D" +#define ICON_KI_EXIT "\xEE\xA5\x9E" +#define ICON_KI_FIGURE "\xEE\xA5\x9F" +#define ICON_KI_CAR "\xEE\xA5\xA0" +#define ICON_KI_COIN "\xEE\xA5\xA1" +#define ICON_KI_KEY "\xEE\xA5\xA2" +#define ICON_KI_CUB "\xEE\xA5\xA3" +#define ICON_KI_DIAMOND "\xEE\xA5\xA4" +#define ICON_KI_BADGE "\xEE\xA5\xA5" +#define ICON_KI_BADGE_ALT "\xEE\xA5\xA6" +#define ICON_KI_PODIUM "\xEE\xA5\xA7" +#define ICON_KI_PODIUM_ALT "\xEE\xA5\xA8" +#define ICON_KI_FLAG "\xEE\xA5\xA9" +#define ICON_KI_FIST "\xEE\xA5\xAA" +#define ICON_KI_FIST_CIRCLE "\xEE\xA5\xAB" +#define ICON_KI_HEART "\xEE\xA5\xAC" +#define ICON_KI_HEART_HALF "\xEE\xA5\xAD" +#define ICON_KI_HEART_HALF_O "\xEE\xA5\xAE" +#define ICON_KI_HEART_O "\xEE\xA5\xAF" +#define ICON_KI_STAR "\xEE\xA5\xB0" +#define ICON_KI_STAR_HALF "\xEE\xA5\xB1" +#define ICON_KI_STAR_HALF_O "\xEE\xA5\xB2" +#define ICON_KI_STAR_O "\xEE\xA5\xB3" +#define ICON_KI_BUTTON_B "\xEE\xA5\xB4" +#define ICON_KI_MUSIC_ON "\xEE\xA5\xB5" +#define ICON_KI_MUSIC_OFF "\xEE\xA5\xB6" +#define ICON_KI_SOUND_ON "\xEE\xA5\xB7" +#define ICON_KI_SOUND_OFF "\xEE\xA5\xB8" +#define ICON_KI_SOUND_OFF_ALT "\xEE\xA5\xB9" +#define ICON_KI_ROBOT "\xEE\xA5\xBA" +#define ICON_KI_COMPUTER "\xEE\xA5\xBB" +#define ICON_KI_TABLET "\xEE\xA5\xBC" +#define ICON_KI_SMARTPHONE "\xEE\xA5\xBD" +#define ICON_KI_DEVICE "\xEE\xA5\xBE" +#define ICON_KI_DEVICE_TILT_LEFT "\xEE\xA5\xBF" +#define ICON_KI_DEVICE_TILT_RIGHT "\xEE\xA6\x80" +#define ICON_KI_GAMEPAD "\xEE\xA6\x81" +#define ICON_KI_GAMEPAD_ALT "\xEE\xA6\x82" +#define ICON_KI_GAMEPAD_TILT_LEFT "\xEE\xA6\x83" +#define ICON_KI_GAMEPAD_TILT_RIGHT "\xEE\xA6\x84" +#define ICON_KI_PLAYER_ONE "\xEE\xA6\x85" +#define ICON_KI_PLAYER_TWO "\xEE\xA6\x86" +#define ICON_KI_PLAYER_THREE "\xEE\xA6\x87" +#define ICON_KI_PLAYER_FOUR "\xEE\xA6\x88" +#define ICON_KI_JOYSTICK "\xEE\xA6\x89" +#define ICON_KI_JOYSTICK_ALT "\xEE\xA6\x8A" +#define ICON_KI_JOYSTICK_LEFT "\xEE\xA6\x8B" +#define ICON_KI_JOYSTICK_RIGHT "\xEE\xA6\x8C" +#define ICON_KI_MOUSE_ALT "\xEE\xA6\x8D" +#define ICON_KI_MOUSE "\xEE\xA6\x8E" +#define ICON_KI_MOUSE_LEFT_BUTTON "\xEE\xA6\x8F" +#define ICON_KI_MOUSE_RIGHT_BUTTON "\xEE\xA6\x90" +#define ICON_KI_BUTTON_ONE "\xEE\xA6\x91" +#define ICON_KI_BUTTON_TWO "\xEE\xA6\x92" +#define ICON_KI_BUTTON_THREE "\xEE\xA6\x93" +#define ICON_KI_BUTTON_A "\xEE\xA6\x94" +#define ICON_KI_BUTTON_X "\xEE\xA6\x95" +#define ICON_KI_BUTON_Y "\xEE\xA6\x96" +#define ICON_KI_BUTTON_TIMES "\xEE\xA6\x97" +#define ICON_KI_BUTTON_SQUARE "\xEE\xA6\x98" +#define ICON_KI_BUTTON_CIRCLE "\xEE\xA6\x99" +#define ICON_KI_BUTTON_TRIANGLE "\xEE\xA6\x9A" +#define ICON_KI_BUTTON_LEFT "\xEE\xA6\x9B" +#define ICON_KI_BUTTON_L "\xEE\xA6\x9C" +#define ICON_KI_BUTTON_L1 "\xEE\xA6\x9D" +#define ICON_KI_BUTTON_L2 "\xEE\xA6\x9E" +#define ICON_KI_BUTTON_LB "\xEE\xA6\x9F" +#define ICON_KI_BUTTON_LT "\xEE\xA6\xA0" +#define ICON_KI_BUTTON_RT "\xEE\xA6\xA1" +#define ICON_KI_BUTTON_RB "\xEE\xA6\xA2" +#define ICON_KI_BUTTON_R2 "\xEE\xA6\xA3" +#define ICON_KI_BUTTON_R1 "\xEE\xA6\xA4" +#define ICON_KI_BUTTON_R "\xEE\xA6\xA5" +#define ICON_KI_BUTTON_RIGHT "\xEE\xA6\xA6" +#define ICON_KI_BUTTON_EMPTY "\xEE\xA6\xA7" +#define ICON_KI_BUTTON_START "\xEE\xA6\xA8" +#define ICON_KI_BUTTON_SELECT "\xEE\xA6\xA9" +#define ICON_KI_DPAD "\xEE\xA6\xAA" +#define ICON_KI_DPAD_ALT "\xEE\xA6\xAB" +#define ICON_KI_DPAD_TOP "\xEE\xA6\xAC" +#define ICON_KI_DPAD_RIGHT "\xEE\xA6\xAD" +#define ICON_KI_DPAD_BOTTOM "\xEE\xA6\xAE" +#define ICON_KI_DPAD_LEFT "\xEE\xA6\xAF" +#define ICON_KI_KEY_LARGE "\xEE\xA6\xB0" +#define ICON_KI_KEY_LARGE_3D "\xEE\xA6\xB1" +#define ICON_KI_KEY_SMALL "\xEE\xA6\xB2" +#define ICON_KI_KEY_SMALL_3D "\xEE\xA6\xB3" +#define ICON_KI_STICK_LEFT_TOP "\xEE\xA6\xB4" +#define ICON_KI_STICK_LEFT_SIDE "\xEE\xA6\xB5" +#define ICON_KI_STICK_RIGHT_SIDE "\xEE\xA6\xB6" +#define ICON_KI_STICK_RIGHT_TOP "\xEE\xA6\xB7" +#define ICON_KI_STICK_SIDE "\xEE\xA6\xB8" +#define ICON_KI_STICK_TILT_LEFT "\xEE\xA6\xB9" +#define ICON_KI_STICK_TILT_RIGHT "\xEE\xA6\xBA" +#define ICON_KI_MOVE_BL "\xEE\xA6\xBB" +#define ICON_KI_MOVE_BR "\xEE\xA6\xBC" +#define ICON_KI_MOVE_BT "\xEE\xA6\xBD" +#define ICON_KI_MOVE_BT_ALT "\xEE\xA6\xBE" +#define ICON_KI_MOVE_LB "\xEE\xA6\xBF" +#define ICON_KI_MOVE_LR "\xEE\xA7\x80" +#define ICON_KI_MOVE_LR_ALT "\xEE\xA7\x81" +#define ICON_KI_MOVE_LT "\xEE\xA7\x82" +#define ICON_KI_MOVE_RB "\xEE\xA7\x83" +#define ICON_KI_MOVE_RL "\xEE\xA7\x84" +#define ICON_KI_MOVE_RL_ALT "\xEE\xA7\x85" +#define ICON_KI_MOVE_RT "\xEE\xA7\x86" +#define ICON_KI_MOVE_TB "\xEE\xA7\x87" +#define ICON_KI_MOVE_TB_ALT "\xEE\xA7\x88" +#define ICON_KI_MOVE_TL "\xEE\xA7\x89" +#define ICON_KI_MOVE_TR "\xEE\xA7\x8A" +#define ICON_KI_STICK_MOVE_BL "\xEE\xA7\x8B" +#define ICON_KI_STICK_MOVE_BR "\xEE\xA7\x8C" +#define ICON_KI_STICK_MOVE_BT "\xEE\xA7\x8D" +#define ICON_KI_STICK_MOVE_BT_ALT "\xEE\xA7\x8E" +#define ICON_KI_STICK_MOVE_LB "\xEE\xA7\x8F" +#define ICON_KI_STICK_MOVE_LR "\xEE\xA7\x90" +#define ICON_KI_STICK_MOVE_LR_ALT "\xEE\xA7\x91" +#define ICON_KI_STICK_MOVE_LT "\xEE\xA7\x92" +#define ICON_KI_STICK_MOVE_RB "\xEE\xA7\x93" +#define ICON_KI_STICK_MOVE_RL "\xEE\xA7\x94" +#define ICON_KI_STICK_MOVE_RL_ALT "\xEE\xA7\x95" +#define ICON_KI_STICK_MOVE_RT "\xEE\xA7\x96" +#define ICON_KI_STICK_MOVE_TB "\xEE\xA7\x97" +#define ICON_KI_STICK_MOVE_TB_ALT "\xEE\xA7\x98" +#define ICON_KI_STICK_MOVE_TL "\xEE\xA7\x99" +#define ICON_KI_STICK_MOVE_TR "\xEE\xA7\x9A" +#define ICON_KI_GITHUB "\xEE\xA7\x9B" +#define ICON_KI_GITHUB_ALT "\xEE\xA7\x9C" +#define ICON_KI_TWITTER "\xEE\xA7\x9D" +#define ICON_KI_FACEBOOK "\xEE\xA7\x9E" +#define ICON_KI_GOOGLE_PLUS "\xEE\xA7\x9F" +#define ICON_KI_YOUTUBE "\xEE\xA7\xA2" +#define ICON_KI_WE_HEART "\xEE\xA7\xA3" +#define ICON_KI_WOLFCMS "\xEE\xA7\xA0" +#define ICON_KI_WOLFCMS_ALT "\xEE\xA7\xA1" diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h new file mode 100644 index 00000000000..00ec9f68e91 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h @@ -0,0 +1,938 @@ +// Generated by GenerateIconFontCppHeaders.py +// from https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/codepoints +#pragma once + +#define ICON_MIN_MD 0xe000 +#define ICON_MAX_MD 0xeb4c +#define ICON_MD_3D_ROTATION "\xEE\xA1\x8D" +#define ICON_MD_AC_UNIT "\xEE\xAC\xBB" +#define ICON_MD_ACCESS_ALARM "\xEE\x86\x90" +#define ICON_MD_ACCESS_ALARMS "\xEE\x86\x91" +#define ICON_MD_ACCESS_TIME "\xEE\x86\x92" +#define ICON_MD_ACCESSIBILITY "\xEE\xA1\x8E" +#define ICON_MD_ACCESSIBLE "\xEE\xA4\x94" +#define ICON_MD_ACCOUNT_BALANCE "\xEE\xA1\x8F" +#define ICON_MD_ACCOUNT_BALANCE_WALLET "\xEE\xA1\x90" +#define ICON_MD_ACCOUNT_BOX "\xEE\xA1\x91" +#define ICON_MD_ACCOUNT_CIRCLE "\xEE\xA1\x93" +#define ICON_MD_ADB "\xEE\x98\x8E" +#define ICON_MD_ADD "\xEE\x85\x85" +#define ICON_MD_ADD_A_PHOTO "\xEE\x90\xB9" +#define ICON_MD_ADD_ALARM "\xEE\x86\x93" +#define ICON_MD_ADD_ALERT "\xEE\x80\x83" +#define ICON_MD_ADD_BOX "\xEE\x85\x86" +#define ICON_MD_ADD_CIRCLE "\xEE\x85\x87" +#define ICON_MD_ADD_CIRCLE_OUTLINE "\xEE\x85\x88" +#define ICON_MD_ADD_LOCATION "\xEE\x95\xA7" +#define ICON_MD_ADD_SHOPPING_CART "\xEE\xA1\x94" +#define ICON_MD_ADD_TO_PHOTOS "\xEE\x8E\x9D" +#define ICON_MD_ADD_TO_QUEUE "\xEE\x81\x9C" +#define ICON_MD_ADJUST "\xEE\x8E\x9E" +#define ICON_MD_AIRLINE_SEAT_FLAT "\xEE\x98\xB0" +#define ICON_MD_AIRLINE_SEAT_FLAT_ANGLED "\xEE\x98\xB1" +#define ICON_MD_AIRLINE_SEAT_INDIVIDUAL_SUITE "\xEE\x98\xB2" +#define ICON_MD_AIRLINE_SEAT_LEGROOM_EXTRA "\xEE\x98\xB3" +#define ICON_MD_AIRLINE_SEAT_LEGROOM_NORMAL "\xEE\x98\xB4" +#define ICON_MD_AIRLINE_SEAT_LEGROOM_REDUCED "\xEE\x98\xB5" +#define ICON_MD_AIRLINE_SEAT_RECLINE_EXTRA "\xEE\x98\xB6" +#define ICON_MD_AIRLINE_SEAT_RECLINE_NORMAL "\xEE\x98\xB7" +#define ICON_MD_AIRPLANEMODE_ACTIVE "\xEE\x86\x95" +#define ICON_MD_AIRPLANEMODE_INACTIVE "\xEE\x86\x94" +#define ICON_MD_AIRPLAY "\xEE\x81\x95" +#define ICON_MD_AIRPORT_SHUTTLE "\xEE\xAC\xBC" +#define ICON_MD_ALARM "\xEE\xA1\x95" +#define ICON_MD_ALARM_ADD "\xEE\xA1\x96" +#define ICON_MD_ALARM_OFF "\xEE\xA1\x97" +#define ICON_MD_ALARM_ON "\xEE\xA1\x98" +#define ICON_MD_ALBUM "\xEE\x80\x99" +#define ICON_MD_ALL_INCLUSIVE "\xEE\xAC\xBD" +#define ICON_MD_ALL_OUT "\xEE\xA4\x8B" +#define ICON_MD_ANDROID "\xEE\xA1\x99" +#define ICON_MD_ANNOUNCEMENT "\xEE\xA1\x9A" +#define ICON_MD_APPS "\xEE\x97\x83" +#define ICON_MD_ARCHIVE "\xEE\x85\x89" +#define ICON_MD_ARROW_BACK "\xEE\x97\x84" +#define ICON_MD_ARROW_DOWNWARD "\xEE\x97\x9B" +#define ICON_MD_ARROW_DROP_DOWN "\xEE\x97\x85" +#define ICON_MD_ARROW_DROP_DOWN_CIRCLE "\xEE\x97\x86" +#define ICON_MD_ARROW_DROP_UP "\xEE\x97\x87" +#define ICON_MD_ARROW_FORWARD "\xEE\x97\x88" +#define ICON_MD_ARROW_UPWARD "\xEE\x97\x98" +#define ICON_MD_ART_TRACK "\xEE\x81\xA0" +#define ICON_MD_ASPECT_RATIO "\xEE\xA1\x9B" +#define ICON_MD_ASSESSMENT "\xEE\xA1\x9C" +#define ICON_MD_ASSIGNMENT "\xEE\xA1\x9D" +#define ICON_MD_ASSIGNMENT_IND "\xEE\xA1\x9E" +#define ICON_MD_ASSIGNMENT_LATE "\xEE\xA1\x9F" +#define ICON_MD_ASSIGNMENT_RETURN "\xEE\xA1\xA0" +#define ICON_MD_ASSIGNMENT_RETURNED "\xEE\xA1\xA1" +#define ICON_MD_ASSIGNMENT_TURNED_IN "\xEE\xA1\xA2" +#define ICON_MD_ASSISTANT "\xEE\x8E\x9F" +#define ICON_MD_ASSISTANT_PHOTO "\xEE\x8E\xA0" +#define ICON_MD_ATTACH_FILE "\xEE\x88\xA6" +#define ICON_MD_ATTACH_MONEY "\xEE\x88\xA7" +#define ICON_MD_ATTACHMENT "\xEE\x8A\xBC" +#define ICON_MD_AUDIOTRACK "\xEE\x8E\xA1" +#define ICON_MD_AUTORENEW "\xEE\xA1\xA3" +#define ICON_MD_AV_TIMER "\xEE\x80\x9B" +#define ICON_MD_BACKSPACE "\xEE\x85\x8A" +#define ICON_MD_BACKUP "\xEE\xA1\xA4" +#define ICON_MD_BATTERY_ALERT "\xEE\x86\x9C" +#define ICON_MD_BATTERY_CHARGING_FULL "\xEE\x86\xA3" +#define ICON_MD_BATTERY_FULL "\xEE\x86\xA4" +#define ICON_MD_BATTERY_STD "\xEE\x86\xA5" +#define ICON_MD_BATTERY_UNKNOWN "\xEE\x86\xA6" +#define ICON_MD_BEACH_ACCESS "\xEE\xAC\xBE" +#define ICON_MD_BEENHERE "\xEE\x94\xAD" +#define ICON_MD_BLOCK "\xEE\x85\x8B" +#define ICON_MD_BLUETOOTH "\xEE\x86\xA7" +#define ICON_MD_BLUETOOTH_AUDIO "\xEE\x98\x8F" +#define ICON_MD_BLUETOOTH_CONNECTED "\xEE\x86\xA8" +#define ICON_MD_BLUETOOTH_DISABLED "\xEE\x86\xA9" +#define ICON_MD_BLUETOOTH_SEARCHING "\xEE\x86\xAA" +#define ICON_MD_BLUR_CIRCULAR "\xEE\x8E\xA2" +#define ICON_MD_BLUR_LINEAR "\xEE\x8E\xA3" +#define ICON_MD_BLUR_OFF "\xEE\x8E\xA4" +#define ICON_MD_BLUR_ON "\xEE\x8E\xA5" +#define ICON_MD_BOOK "\xEE\xA1\xA5" +#define ICON_MD_BOOKMARK "\xEE\xA1\xA6" +#define ICON_MD_BOOKMARK_BORDER "\xEE\xA1\xA7" +#define ICON_MD_BORDER_ALL "\xEE\x88\xA8" +#define ICON_MD_BORDER_BOTTOM "\xEE\x88\xA9" +#define ICON_MD_BORDER_CLEAR "\xEE\x88\xAA" +#define ICON_MD_BORDER_COLOR "\xEE\x88\xAB" +#define ICON_MD_BORDER_HORIZONTAL "\xEE\x88\xAC" +#define ICON_MD_BORDER_INNER "\xEE\x88\xAD" +#define ICON_MD_BORDER_LEFT "\xEE\x88\xAE" +#define ICON_MD_BORDER_OUTER "\xEE\x88\xAF" +#define ICON_MD_BORDER_RIGHT "\xEE\x88\xB0" +#define ICON_MD_BORDER_STYLE "\xEE\x88\xB1" +#define ICON_MD_BORDER_TOP "\xEE\x88\xB2" +#define ICON_MD_BORDER_VERTICAL "\xEE\x88\xB3" +#define ICON_MD_BRANDING_WATERMARK "\xEE\x81\xAB" +#define ICON_MD_BRIGHTNESS_1 "\xEE\x8E\xA6" +#define ICON_MD_BRIGHTNESS_2 "\xEE\x8E\xA7" +#define ICON_MD_BRIGHTNESS_3 "\xEE\x8E\xA8" +#define ICON_MD_BRIGHTNESS_4 "\xEE\x8E\xA9" +#define ICON_MD_BRIGHTNESS_5 "\xEE\x8E\xAA" +#define ICON_MD_BRIGHTNESS_6 "\xEE\x8E\xAB" +#define ICON_MD_BRIGHTNESS_7 "\xEE\x8E\xAC" +#define ICON_MD_BRIGHTNESS_AUTO "\xEE\x86\xAB" +#define ICON_MD_BRIGHTNESS_HIGH "\xEE\x86\xAC" +#define ICON_MD_BRIGHTNESS_LOW "\xEE\x86\xAD" +#define ICON_MD_BRIGHTNESS_MEDIUM "\xEE\x86\xAE" +#define ICON_MD_BROKEN_IMAGE "\xEE\x8E\xAD" +#define ICON_MD_BRUSH "\xEE\x8E\xAE" +#define ICON_MD_BUBBLE_CHART "\xEE\x9B\x9D" +#define ICON_MD_BUG_REPORT "\xEE\xA1\xA8" +#define ICON_MD_BUILD "\xEE\xA1\xA9" +#define ICON_MD_BURST_MODE "\xEE\x90\xBC" +#define ICON_MD_BUSINESS "\xEE\x82\xAF" +#define ICON_MD_BUSINESS_CENTER "\xEE\xAC\xBF" +#define ICON_MD_CACHED "\xEE\xA1\xAA" +#define ICON_MD_CAKE "\xEE\x9F\xA9" +#define ICON_MD_CALL "\xEE\x82\xB0" +#define ICON_MD_CALL_END "\xEE\x82\xB1" +#define ICON_MD_CALL_MADE "\xEE\x82\xB2" +#define ICON_MD_CALL_MERGE "\xEE\x82\xB3" +#define ICON_MD_CALL_MISSED "\xEE\x82\xB4" +#define ICON_MD_CALL_MISSED_OUTGOING "\xEE\x83\xA4" +#define ICON_MD_CALL_RECEIVED "\xEE\x82\xB5" +#define ICON_MD_CALL_SPLIT "\xEE\x82\xB6" +#define ICON_MD_CALL_TO_ACTION "\xEE\x81\xAC" +#define ICON_MD_CAMERA "\xEE\x8E\xAF" +#define ICON_MD_CAMERA_ALT "\xEE\x8E\xB0" +#define ICON_MD_CAMERA_ENHANCE "\xEE\xA3\xBC" +#define ICON_MD_CAMERA_FRONT "\xEE\x8E\xB1" +#define ICON_MD_CAMERA_REAR "\xEE\x8E\xB2" +#define ICON_MD_CAMERA_ROLL "\xEE\x8E\xB3" +#define ICON_MD_CANCEL "\xEE\x97\x89" +#define ICON_MD_CARD_GIFTCARD "\xEE\xA3\xB6" +#define ICON_MD_CARD_MEMBERSHIP "\xEE\xA3\xB7" +#define ICON_MD_CARD_TRAVEL "\xEE\xA3\xB8" +#define ICON_MD_CASINO "\xEE\xAD\x80" +#define ICON_MD_CAST "\xEE\x8C\x87" +#define ICON_MD_CAST_CONNECTED "\xEE\x8C\x88" +#define ICON_MD_CENTER_FOCUS_STRONG "\xEE\x8E\xB4" +#define ICON_MD_CENTER_FOCUS_WEAK "\xEE\x8E\xB5" +#define ICON_MD_CHANGE_HISTORY "\xEE\xA1\xAB" +#define ICON_MD_CHAT "\xEE\x82\xB7" +#define ICON_MD_CHAT_BUBBLE "\xEE\x83\x8A" +#define ICON_MD_CHAT_BUBBLE_OUTLINE "\xEE\x83\x8B" +#define ICON_MD_CHECK "\xEE\x97\x8A" +#define ICON_MD_CHECK_BOX "\xEE\xA0\xB4" +#define ICON_MD_CHECK_BOX_OUTLINE_BLANK "\xEE\xA0\xB5" +#define ICON_MD_CHECK_CIRCLE "\xEE\xA1\xAC" +#define ICON_MD_CHEVRON_LEFT "\xEE\x97\x8B" +#define ICON_MD_CHEVRON_RIGHT "\xEE\x97\x8C" +#define ICON_MD_CHILD_CARE "\xEE\xAD\x81" +#define ICON_MD_CHILD_FRIENDLY "\xEE\xAD\x82" +#define ICON_MD_CHROME_READER_MODE "\xEE\xA1\xAD" +#define ICON_MD_CLASS "\xEE\xA1\xAE" +#define ICON_MD_CLEAR "\xEE\x85\x8C" +#define ICON_MD_CLEAR_ALL "\xEE\x82\xB8" +#define ICON_MD_CLOSE "\xEE\x97\x8D" +#define ICON_MD_CLOSED_CAPTION "\xEE\x80\x9C" +#define ICON_MD_CLOUD "\xEE\x8A\xBD" +#define ICON_MD_CLOUD_CIRCLE "\xEE\x8A\xBE" +#define ICON_MD_CLOUD_DONE "\xEE\x8A\xBF" +#define ICON_MD_CLOUD_DOWNLOAD "\xEE\x8B\x80" +#define ICON_MD_CLOUD_OFF "\xEE\x8B\x81" +#define ICON_MD_CLOUD_QUEUE "\xEE\x8B\x82" +#define ICON_MD_CLOUD_UPLOAD "\xEE\x8B\x83" +#define ICON_MD_CODE "\xEE\xA1\xAF" +#define ICON_MD_COLLECTIONS "\xEE\x8E\xB6" +#define ICON_MD_COLLECTIONS_BOOKMARK "\xEE\x90\xB1" +#define ICON_MD_COLOR_LENS "\xEE\x8E\xB7" +#define ICON_MD_COLORIZE "\xEE\x8E\xB8" +#define ICON_MD_COMMENT "\xEE\x82\xB9" +#define ICON_MD_COMPARE "\xEE\x8E\xB9" +#define ICON_MD_COMPARE_ARROWS "\xEE\xA4\x95" +#define ICON_MD_COMPUTER "\xEE\x8C\x8A" +#define ICON_MD_CONFIRMATION_NUMBER "\xEE\x98\xB8" +#define ICON_MD_CONTACT_MAIL "\xEE\x83\x90" +#define ICON_MD_CONTACT_PHONE "\xEE\x83\x8F" +#define ICON_MD_CONTACTS "\xEE\x82\xBA" +#define ICON_MD_CONTENT_COPY "\xEE\x85\x8D" +#define ICON_MD_CONTENT_CUT "\xEE\x85\x8E" +#define ICON_MD_CONTENT_PASTE "\xEE\x85\x8F" +#define ICON_MD_CONTROL_POINT "\xEE\x8E\xBA" +#define ICON_MD_CONTROL_POINT_DUPLICATE "\xEE\x8E\xBB" +#define ICON_MD_COPYRIGHT "\xEE\xA4\x8C" +#define ICON_MD_CREATE "\xEE\x85\x90" +#define ICON_MD_CREATE_NEW_FOLDER "\xEE\x8B\x8C" +#define ICON_MD_CREDIT_CARD "\xEE\xA1\xB0" +#define ICON_MD_CROP "\xEE\x8E\xBE" +#define ICON_MD_CROP_16_9 "\xEE\x8E\xBC" +#define ICON_MD_CROP_3_2 "\xEE\x8E\xBD" +#define ICON_MD_CROP_5_4 "\xEE\x8E\xBF" +#define ICON_MD_CROP_7_5 "\xEE\x8F\x80" +#define ICON_MD_CROP_DIN "\xEE\x8F\x81" +#define ICON_MD_CROP_FREE "\xEE\x8F\x82" +#define ICON_MD_CROP_LANDSCAPE "\xEE\x8F\x83" +#define ICON_MD_CROP_ORIGINAL "\xEE\x8F\x84" +#define ICON_MD_CROP_PORTRAIT "\xEE\x8F\x85" +#define ICON_MD_CROP_ROTATE "\xEE\x90\xB7" +#define ICON_MD_CROP_SQUARE "\xEE\x8F\x86" +#define ICON_MD_DASHBOARD "\xEE\xA1\xB1" +#define ICON_MD_DATA_USAGE "\xEE\x86\xAF" +#define ICON_MD_DATE_RANGE "\xEE\xA4\x96" +#define ICON_MD_DEHAZE "\xEE\x8F\x87" +#define ICON_MD_DELETE "\xEE\xA1\xB2" +#define ICON_MD_DELETE_FOREVER "\xEE\xA4\xAB" +#define ICON_MD_DELETE_SWEEP "\xEE\x85\xAC" +#define ICON_MD_DESCRIPTION "\xEE\xA1\xB3" +#define ICON_MD_DESKTOP_MAC "\xEE\x8C\x8B" +#define ICON_MD_DESKTOP_WINDOWS "\xEE\x8C\x8C" +#define ICON_MD_DETAILS "\xEE\x8F\x88" +#define ICON_MD_DEVELOPER_BOARD "\xEE\x8C\x8D" +#define ICON_MD_DEVELOPER_MODE "\xEE\x86\xB0" +#define ICON_MD_DEVICE_HUB "\xEE\x8C\xB5" +#define ICON_MD_DEVICES "\xEE\x86\xB1" +#define ICON_MD_DEVICES_OTHER "\xEE\x8C\xB7" +#define ICON_MD_DIALER_SIP "\xEE\x82\xBB" +#define ICON_MD_DIALPAD "\xEE\x82\xBC" +#define ICON_MD_DIRECTIONS "\xEE\x94\xAE" +#define ICON_MD_DIRECTIONS_BIKE "\xEE\x94\xAF" +#define ICON_MD_DIRECTIONS_BOAT "\xEE\x94\xB2" +#define ICON_MD_DIRECTIONS_BUS "\xEE\x94\xB0" +#define ICON_MD_DIRECTIONS_CAR "\xEE\x94\xB1" +#define ICON_MD_DIRECTIONS_RAILWAY "\xEE\x94\xB4" +#define ICON_MD_DIRECTIONS_RUN "\xEE\x95\xA6" +#define ICON_MD_DIRECTIONS_SUBWAY "\xEE\x94\xB3" +#define ICON_MD_DIRECTIONS_TRANSIT "\xEE\x94\xB5" +#define ICON_MD_DIRECTIONS_WALK "\xEE\x94\xB6" +#define ICON_MD_DISC_FULL "\xEE\x98\x90" +#define ICON_MD_DNS "\xEE\xA1\xB5" +#define ICON_MD_DO_NOT_DISTURB "\xEE\x98\x92" +#define ICON_MD_DO_NOT_DISTURB_ALT "\xEE\x98\x91" +#define ICON_MD_DO_NOT_DISTURB_OFF "\xEE\x99\x83" +#define ICON_MD_DO_NOT_DISTURB_ON "\xEE\x99\x84" +#define ICON_MD_DOCK "\xEE\x8C\x8E" +#define ICON_MD_DOMAIN "\xEE\x9F\xAE" +#define ICON_MD_DONE "\xEE\xA1\xB6" +#define ICON_MD_DONE_ALL "\xEE\xA1\xB7" +#define ICON_MD_DONUT_LARGE "\xEE\xA4\x97" +#define ICON_MD_DONUT_SMALL "\xEE\xA4\x98" +#define ICON_MD_DRAFTS "\xEE\x85\x91" +#define ICON_MD_DRAG_HANDLE "\xEE\x89\x9D" +#define ICON_MD_DRIVE_ETA "\xEE\x98\x93" +#define ICON_MD_DVR "\xEE\x86\xB2" +#define ICON_MD_EDIT "\xEE\x8F\x89" +#define ICON_MD_EDIT_LOCATION "\xEE\x95\xA8" +#define ICON_MD_EJECT "\xEE\xA3\xBB" +#define ICON_MD_EMAIL "\xEE\x82\xBE" +#define ICON_MD_ENHANCED_ENCRYPTION "\xEE\x98\xBF" +#define ICON_MD_EQUALIZER "\xEE\x80\x9D" +#define ICON_MD_ERROR "\xEE\x80\x80" +#define ICON_MD_ERROR_OUTLINE "\xEE\x80\x81" +#define ICON_MD_EURO_SYMBOL "\xEE\xA4\xA6" +#define ICON_MD_EV_STATION "\xEE\x95\xAD" +#define ICON_MD_EVENT "\xEE\xA1\xB8" +#define ICON_MD_EVENT_AVAILABLE "\xEE\x98\x94" +#define ICON_MD_EVENT_BUSY "\xEE\x98\x95" +#define ICON_MD_EVENT_NOTE "\xEE\x98\x96" +#define ICON_MD_EVENT_SEAT "\xEE\xA4\x83" +#define ICON_MD_EXIT_TO_APP "\xEE\xA1\xB9" +#define ICON_MD_EXPAND_LESS "\xEE\x97\x8E" +#define ICON_MD_EXPAND_MORE "\xEE\x97\x8F" +#define ICON_MD_EXPLICIT "\xEE\x80\x9E" +#define ICON_MD_EXPLORE "\xEE\xA1\xBA" +#define ICON_MD_EXPOSURE "\xEE\x8F\x8A" +#define ICON_MD_EXPOSURE_NEG_1 "\xEE\x8F\x8B" +#define ICON_MD_EXPOSURE_NEG_2 "\xEE\x8F\x8C" +#define ICON_MD_EXPOSURE_PLUS_1 "\xEE\x8F\x8D" +#define ICON_MD_EXPOSURE_PLUS_2 "\xEE\x8F\x8E" +#define ICON_MD_EXPOSURE_ZERO "\xEE\x8F\x8F" +#define ICON_MD_EXTENSION "\xEE\xA1\xBB" +#define ICON_MD_FACE "\xEE\xA1\xBC" +#define ICON_MD_FAST_FORWARD "\xEE\x80\x9F" +#define ICON_MD_FAST_REWIND "\xEE\x80\xA0" +#define ICON_MD_FAVORITE "\xEE\xA1\xBD" +#define ICON_MD_FAVORITE_BORDER "\xEE\xA1\xBE" +#define ICON_MD_FEATURED_PLAY_LIST "\xEE\x81\xAD" +#define ICON_MD_FEATURED_VIDEO "\xEE\x81\xAE" +#define ICON_MD_FEEDBACK "\xEE\xA1\xBF" +#define ICON_MD_FIBER_DVR "\xEE\x81\x9D" +#define ICON_MD_FIBER_MANUAL_RECORD "\xEE\x81\xA1" +#define ICON_MD_FIBER_NEW "\xEE\x81\x9E" +#define ICON_MD_FIBER_PIN "\xEE\x81\xAA" +#define ICON_MD_FIBER_SMART_RECORD "\xEE\x81\xA2" +#define ICON_MD_FILE_DOWNLOAD "\xEE\x8B\x84" +#define ICON_MD_FILE_UPLOAD "\xEE\x8B\x86" +#define ICON_MD_FILTER "\xEE\x8F\x93" +#define ICON_MD_FILTER_1 "\xEE\x8F\x90" +#define ICON_MD_FILTER_2 "\xEE\x8F\x91" +#define ICON_MD_FILTER_3 "\xEE\x8F\x92" +#define ICON_MD_FILTER_4 "\xEE\x8F\x94" +#define ICON_MD_FILTER_5 "\xEE\x8F\x95" +#define ICON_MD_FILTER_6 "\xEE\x8F\x96" +#define ICON_MD_FILTER_7 "\xEE\x8F\x97" +#define ICON_MD_FILTER_8 "\xEE\x8F\x98" +#define ICON_MD_FILTER_9 "\xEE\x8F\x99" +#define ICON_MD_FILTER_9_PLUS "\xEE\x8F\x9A" +#define ICON_MD_FILTER_B_AND_W "\xEE\x8F\x9B" +#define ICON_MD_FILTER_CENTER_FOCUS "\xEE\x8F\x9C" +#define ICON_MD_FILTER_DRAMA "\xEE\x8F\x9D" +#define ICON_MD_FILTER_FRAMES "\xEE\x8F\x9E" +#define ICON_MD_FILTER_HDR "\xEE\x8F\x9F" +#define ICON_MD_FILTER_LIST "\xEE\x85\x92" +#define ICON_MD_FILTER_NONE "\xEE\x8F\xA0" +#define ICON_MD_FILTER_TILT_SHIFT "\xEE\x8F\xA2" +#define ICON_MD_FILTER_VINTAGE "\xEE\x8F\xA3" +#define ICON_MD_FIND_IN_PAGE "\xEE\xA2\x80" +#define ICON_MD_FIND_REPLACE "\xEE\xA2\x81" +#define ICON_MD_FINGERPRINT "\xEE\xA4\x8D" +#define ICON_MD_FIRST_PAGE "\xEE\x97\x9C" +#define ICON_MD_FITNESS_CENTER "\xEE\xAD\x83" +#define ICON_MD_FLAG "\xEE\x85\x93" +#define ICON_MD_FLARE "\xEE\x8F\xA4" +#define ICON_MD_FLASH_AUTO "\xEE\x8F\xA5" +#define ICON_MD_FLASH_OFF "\xEE\x8F\xA6" +#define ICON_MD_FLASH_ON "\xEE\x8F\xA7" +#define ICON_MD_FLIGHT "\xEE\x94\xB9" +#define ICON_MD_FLIGHT_LAND "\xEE\xA4\x84" +#define ICON_MD_FLIGHT_TAKEOFF "\xEE\xA4\x85" +#define ICON_MD_FLIP "\xEE\x8F\xA8" +#define ICON_MD_FLIP_TO_BACK "\xEE\xA2\x82" +#define ICON_MD_FLIP_TO_FRONT "\xEE\xA2\x83" +#define ICON_MD_FOLDER "\xEE\x8B\x87" +#define ICON_MD_FOLDER_OPEN "\xEE\x8B\x88" +#define ICON_MD_FOLDER_SHARED "\xEE\x8B\x89" +#define ICON_MD_FOLDER_SPECIAL "\xEE\x98\x97" +#define ICON_MD_FONT_DOWNLOAD "\xEE\x85\xA7" +#define ICON_MD_FORMAT_ALIGN_CENTER "\xEE\x88\xB4" +#define ICON_MD_FORMAT_ALIGN_JUSTIFY "\xEE\x88\xB5" +#define ICON_MD_FORMAT_ALIGN_LEFT "\xEE\x88\xB6" +#define ICON_MD_FORMAT_ALIGN_RIGHT "\xEE\x88\xB7" +#define ICON_MD_FORMAT_BOLD "\xEE\x88\xB8" +#define ICON_MD_FORMAT_CLEAR "\xEE\x88\xB9" +#define ICON_MD_FORMAT_COLOR_FILL "\xEE\x88\xBA" +#define ICON_MD_FORMAT_COLOR_RESET "\xEE\x88\xBB" +#define ICON_MD_FORMAT_COLOR_TEXT "\xEE\x88\xBC" +#define ICON_MD_FORMAT_INDENT_DECREASE "\xEE\x88\xBD" +#define ICON_MD_FORMAT_INDENT_INCREASE "\xEE\x88\xBE" +#define ICON_MD_FORMAT_ITALIC "\xEE\x88\xBF" +#define ICON_MD_FORMAT_LINE_SPACING "\xEE\x89\x80" +#define ICON_MD_FORMAT_LIST_BULLETED "\xEE\x89\x81" +#define ICON_MD_FORMAT_LIST_NUMBERED "\xEE\x89\x82" +#define ICON_MD_FORMAT_PAINT "\xEE\x89\x83" +#define ICON_MD_FORMAT_QUOTE "\xEE\x89\x84" +#define ICON_MD_FORMAT_SHAPES "\xEE\x89\x9E" +#define ICON_MD_FORMAT_SIZE "\xEE\x89\x85" +#define ICON_MD_FORMAT_STRIKETHROUGH "\xEE\x89\x86" +#define ICON_MD_FORMAT_TEXTDIRECTION_L_TO_R "\xEE\x89\x87" +#define ICON_MD_FORMAT_TEXTDIRECTION_R_TO_L "\xEE\x89\x88" +#define ICON_MD_FORMAT_UNDERLINED "\xEE\x89\x89" +#define ICON_MD_FORUM "\xEE\x82\xBF" +#define ICON_MD_FORWARD "\xEE\x85\x94" +#define ICON_MD_FORWARD_10 "\xEE\x81\x96" +#define ICON_MD_FORWARD_30 "\xEE\x81\x97" +#define ICON_MD_FORWARD_5 "\xEE\x81\x98" +#define ICON_MD_FREE_BREAKFAST "\xEE\xAD\x84" +#define ICON_MD_FULLSCREEN "\xEE\x97\x90" +#define ICON_MD_FULLSCREEN_EXIT "\xEE\x97\x91" +#define ICON_MD_FUNCTIONS "\xEE\x89\x8A" +#define ICON_MD_G_TRANSLATE "\xEE\xA4\xA7" +#define ICON_MD_GAMEPAD "\xEE\x8C\x8F" +#define ICON_MD_GAMES "\xEE\x80\xA1" +#define ICON_MD_GAVEL "\xEE\xA4\x8E" +#define ICON_MD_GESTURE "\xEE\x85\x95" +#define ICON_MD_GET_APP "\xEE\xA2\x84" +#define ICON_MD_GIF "\xEE\xA4\x88" +#define ICON_MD_GOLF_COURSE "\xEE\xAD\x85" +#define ICON_MD_GPS_FIXED "\xEE\x86\xB3" +#define ICON_MD_GPS_NOT_FIXED "\xEE\x86\xB4" +#define ICON_MD_GPS_OFF "\xEE\x86\xB5" +#define ICON_MD_GRADE "\xEE\xA2\x85" +#define ICON_MD_GRADIENT "\xEE\x8F\xA9" +#define ICON_MD_GRAIN "\xEE\x8F\xAA" +#define ICON_MD_GRAPHIC_EQ "\xEE\x86\xB8" +#define ICON_MD_GRID_OFF "\xEE\x8F\xAB" +#define ICON_MD_GRID_ON "\xEE\x8F\xAC" +#define ICON_MD_GROUP "\xEE\x9F\xAF" +#define ICON_MD_GROUP_ADD "\xEE\x9F\xB0" +#define ICON_MD_GROUP_WORK "\xEE\xA2\x86" +#define ICON_MD_HD "\xEE\x81\x92" +#define ICON_MD_HDR_OFF "\xEE\x8F\xAD" +#define ICON_MD_HDR_ON "\xEE\x8F\xAE" +#define ICON_MD_HDR_STRONG "\xEE\x8F\xB1" +#define ICON_MD_HDR_WEAK "\xEE\x8F\xB2" +#define ICON_MD_HEADSET "\xEE\x8C\x90" +#define ICON_MD_HEADSET_MIC "\xEE\x8C\x91" +#define ICON_MD_HEALING "\xEE\x8F\xB3" +#define ICON_MD_HEARING "\xEE\x80\xA3" +#define ICON_MD_HELP "\xEE\xA2\x87" +#define ICON_MD_HELP_OUTLINE "\xEE\xA3\xBD" +#define ICON_MD_HIGH_QUALITY "\xEE\x80\xA4" +#define ICON_MD_HIGHLIGHT "\xEE\x89\x9F" +#define ICON_MD_HIGHLIGHT_OFF "\xEE\xA2\x88" +#define ICON_MD_HISTORY "\xEE\xA2\x89" +#define ICON_MD_HOME "\xEE\xA2\x8A" +#define ICON_MD_HOT_TUB "\xEE\xAD\x86" +#define ICON_MD_HOTEL "\xEE\x94\xBA" +#define ICON_MD_HOURGLASS_EMPTY "\xEE\xA2\x8B" +#define ICON_MD_HOURGLASS_FULL "\xEE\xA2\x8C" +#define ICON_MD_HTTP "\xEE\xA4\x82" +#define ICON_MD_HTTPS "\xEE\xA2\x8D" +#define ICON_MD_IMAGE "\xEE\x8F\xB4" +#define ICON_MD_IMAGE_ASPECT_RATIO "\xEE\x8F\xB5" +#define ICON_MD_IMPORT_CONTACTS "\xEE\x83\xA0" +#define ICON_MD_IMPORT_EXPORT "\xEE\x83\x83" +#define ICON_MD_IMPORTANT_DEVICES "\xEE\xA4\x92" +#define ICON_MD_INBOX "\xEE\x85\x96" +#define ICON_MD_INDETERMINATE_CHECK_BOX "\xEE\xA4\x89" +#define ICON_MD_INFO "\xEE\xA2\x8E" +#define ICON_MD_INFO_OUTLINE "\xEE\xA2\x8F" +#define ICON_MD_INPUT "\xEE\xA2\x90" +#define ICON_MD_INSERT_CHART "\xEE\x89\x8B" +#define ICON_MD_INSERT_COMMENT "\xEE\x89\x8C" +#define ICON_MD_INSERT_DRIVE_FILE "\xEE\x89\x8D" +#define ICON_MD_INSERT_EMOTICON "\xEE\x89\x8E" +#define ICON_MD_INSERT_INVITATION "\xEE\x89\x8F" +#define ICON_MD_INSERT_LINK "\xEE\x89\x90" +#define ICON_MD_INSERT_PHOTO "\xEE\x89\x91" +#define ICON_MD_INVERT_COLORS "\xEE\xA2\x91" +#define ICON_MD_INVERT_COLORS_OFF "\xEE\x83\x84" +#define ICON_MD_ISO "\xEE\x8F\xB6" +#define ICON_MD_KEYBOARD "\xEE\x8C\x92" +#define ICON_MD_KEYBOARD_ARROW_DOWN "\xEE\x8C\x93" +#define ICON_MD_KEYBOARD_ARROW_LEFT "\xEE\x8C\x94" +#define ICON_MD_KEYBOARD_ARROW_RIGHT "\xEE\x8C\x95" +#define ICON_MD_KEYBOARD_ARROW_UP "\xEE\x8C\x96" +#define ICON_MD_KEYBOARD_BACKSPACE "\xEE\x8C\x97" +#define ICON_MD_KEYBOARD_CAPSLOCK "\xEE\x8C\x98" +#define ICON_MD_KEYBOARD_HIDE "\xEE\x8C\x9A" +#define ICON_MD_KEYBOARD_RETURN "\xEE\x8C\x9B" +#define ICON_MD_KEYBOARD_TAB "\xEE\x8C\x9C" +#define ICON_MD_KEYBOARD_VOICE "\xEE\x8C\x9D" +#define ICON_MD_KITCHEN "\xEE\xAD\x87" +#define ICON_MD_LABEL "\xEE\xA2\x92" +#define ICON_MD_LABEL_OUTLINE "\xEE\xA2\x93" +#define ICON_MD_LANDSCAPE "\xEE\x8F\xB7" +#define ICON_MD_LANGUAGE "\xEE\xA2\x94" +#define ICON_MD_LAPTOP "\xEE\x8C\x9E" +#define ICON_MD_LAPTOP_CHROMEBOOK "\xEE\x8C\x9F" +#define ICON_MD_LAPTOP_MAC "\xEE\x8C\xA0" +#define ICON_MD_LAPTOP_WINDOWS "\xEE\x8C\xA1" +#define ICON_MD_LAST_PAGE "\xEE\x97\x9D" +#define ICON_MD_LAUNCH "\xEE\xA2\x95" +#define ICON_MD_LAYERS "\xEE\x94\xBB" +#define ICON_MD_LAYERS_CLEAR "\xEE\x94\xBC" +#define ICON_MD_LEAK_ADD "\xEE\x8F\xB8" +#define ICON_MD_LEAK_REMOVE "\xEE\x8F\xB9" +#define ICON_MD_LENS "\xEE\x8F\xBA" +#define ICON_MD_LIBRARY_ADD "\xEE\x80\xAE" +#define ICON_MD_LIBRARY_BOOKS "\xEE\x80\xAF" +#define ICON_MD_LIBRARY_MUSIC "\xEE\x80\xB0" +#define ICON_MD_LIGHTBULB_OUTLINE "\xEE\xA4\x8F" +#define ICON_MD_LINE_STYLE "\xEE\xA4\x99" +#define ICON_MD_LINE_WEIGHT "\xEE\xA4\x9A" +#define ICON_MD_LINEAR_SCALE "\xEE\x89\xA0" +#define ICON_MD_LINK "\xEE\x85\x97" +#define ICON_MD_LINKED_CAMERA "\xEE\x90\xB8" +#define ICON_MD_LIST "\xEE\xA2\x96" +#define ICON_MD_LIVE_HELP "\xEE\x83\x86" +#define ICON_MD_LIVE_TV "\xEE\x98\xB9" +#define ICON_MD_LOCAL_ACTIVITY "\xEE\x94\xBF" +#define ICON_MD_LOCAL_AIRPORT "\xEE\x94\xBD" +#define ICON_MD_LOCAL_ATM "\xEE\x94\xBE" +#define ICON_MD_LOCAL_BAR "\xEE\x95\x80" +#define ICON_MD_LOCAL_CAFE "\xEE\x95\x81" +#define ICON_MD_LOCAL_CAR_WASH "\xEE\x95\x82" +#define ICON_MD_LOCAL_CONVENIENCE_STORE "\xEE\x95\x83" +#define ICON_MD_LOCAL_DINING "\xEE\x95\x96" +#define ICON_MD_LOCAL_DRINK "\xEE\x95\x84" +#define ICON_MD_LOCAL_FLORIST "\xEE\x95\x85" +#define ICON_MD_LOCAL_GAS_STATION "\xEE\x95\x86" +#define ICON_MD_LOCAL_GROCERY_STORE "\xEE\x95\x87" +#define ICON_MD_LOCAL_HOSPITAL "\xEE\x95\x88" +#define ICON_MD_LOCAL_HOTEL "\xEE\x95\x89" +#define ICON_MD_LOCAL_LAUNDRY_SERVICE "\xEE\x95\x8A" +#define ICON_MD_LOCAL_LIBRARY "\xEE\x95\x8B" +#define ICON_MD_LOCAL_MALL "\xEE\x95\x8C" +#define ICON_MD_LOCAL_MOVIES "\xEE\x95\x8D" +#define ICON_MD_LOCAL_OFFER "\xEE\x95\x8E" +#define ICON_MD_LOCAL_PARKING "\xEE\x95\x8F" +#define ICON_MD_LOCAL_PHARMACY "\xEE\x95\x90" +#define ICON_MD_LOCAL_PHONE "\xEE\x95\x91" +#define ICON_MD_LOCAL_PIZZA "\xEE\x95\x92" +#define ICON_MD_LOCAL_PLAY "\xEE\x95\x93" +#define ICON_MD_LOCAL_POST_OFFICE "\xEE\x95\x94" +#define ICON_MD_LOCAL_PRINTSHOP "\xEE\x95\x95" +#define ICON_MD_LOCAL_SEE "\xEE\x95\x97" +#define ICON_MD_LOCAL_SHIPPING "\xEE\x95\x98" +#define ICON_MD_LOCAL_TAXI "\xEE\x95\x99" +#define ICON_MD_LOCATION_CITY "\xEE\x9F\xB1" +#define ICON_MD_LOCATION_DISABLED "\xEE\x86\xB6" +#define ICON_MD_LOCATION_OFF "\xEE\x83\x87" +#define ICON_MD_LOCATION_ON "\xEE\x83\x88" +#define ICON_MD_LOCATION_SEARCHING "\xEE\x86\xB7" +#define ICON_MD_LOCK "\xEE\xA2\x97" +#define ICON_MD_LOCK_OPEN "\xEE\xA2\x98" +#define ICON_MD_LOCK_OUTLINE "\xEE\xA2\x99" +#define ICON_MD_LOOKS "\xEE\x8F\xBC" +#define ICON_MD_LOOKS_3 "\xEE\x8F\xBB" +#define ICON_MD_LOOKS_4 "\xEE\x8F\xBD" +#define ICON_MD_LOOKS_5 "\xEE\x8F\xBE" +#define ICON_MD_LOOKS_6 "\xEE\x8F\xBF" +#define ICON_MD_LOOKS_ONE "\xEE\x90\x80" +#define ICON_MD_LOOKS_TWO "\xEE\x90\x81" +#define ICON_MD_LOOP "\xEE\x80\xA8" +#define ICON_MD_LOUPE "\xEE\x90\x82" +#define ICON_MD_LOW_PRIORITY "\xEE\x85\xAD" +#define ICON_MD_LOYALTY "\xEE\xA2\x9A" +#define ICON_MD_MAIL "\xEE\x85\x98" +#define ICON_MD_MAIL_OUTLINE "\xEE\x83\xA1" +#define ICON_MD_MAP "\xEE\x95\x9B" +#define ICON_MD_MARKUNREAD "\xEE\x85\x99" +#define ICON_MD_MARKUNREAD_MAILBOX "\xEE\xA2\x9B" +#define ICON_MD_MEMORY "\xEE\x8C\xA2" +#define ICON_MD_MENU "\xEE\x97\x92" +#define ICON_MD_MERGE_TYPE "\xEE\x89\x92" +#define ICON_MD_MESSAGE "\xEE\x83\x89" +#define ICON_MD_MIC "\xEE\x80\xA9" +#define ICON_MD_MIC_NONE "\xEE\x80\xAA" +#define ICON_MD_MIC_OFF "\xEE\x80\xAB" +#define ICON_MD_MMS "\xEE\x98\x98" +#define ICON_MD_MODE_COMMENT "\xEE\x89\x93" +#define ICON_MD_MODE_EDIT "\xEE\x89\x94" +#define ICON_MD_MONETIZATION_ON "\xEE\x89\xA3" +#define ICON_MD_MONEY_OFF "\xEE\x89\x9C" +#define ICON_MD_MONOCHROME_PHOTOS "\xEE\x90\x83" +#define ICON_MD_MOOD "\xEE\x9F\xB2" +#define ICON_MD_MOOD_BAD "\xEE\x9F\xB3" +#define ICON_MD_MORE "\xEE\x98\x99" +#define ICON_MD_MORE_HORIZ "\xEE\x97\x93" +#define ICON_MD_MORE_VERT "\xEE\x97\x94" +#define ICON_MD_MOTORCYCLE "\xEE\xA4\x9B" +#define ICON_MD_MOUSE "\xEE\x8C\xA3" +#define ICON_MD_MOVE_TO_INBOX "\xEE\x85\xA8" +#define ICON_MD_MOVIE "\xEE\x80\xAC" +#define ICON_MD_MOVIE_CREATION "\xEE\x90\x84" +#define ICON_MD_MOVIE_FILTER "\xEE\x90\xBA" +#define ICON_MD_MULTILINE_CHART "\xEE\x9B\x9F" +#define ICON_MD_MUSIC_NOTE "\xEE\x90\x85" +#define ICON_MD_MUSIC_VIDEO "\xEE\x81\xA3" +#define ICON_MD_MY_LOCATION "\xEE\x95\x9C" +#define ICON_MD_NATURE "\xEE\x90\x86" +#define ICON_MD_NATURE_PEOPLE "\xEE\x90\x87" +#define ICON_MD_NAVIGATE_BEFORE "\xEE\x90\x88" +#define ICON_MD_NAVIGATE_NEXT "\xEE\x90\x89" +#define ICON_MD_NAVIGATION "\xEE\x95\x9D" +#define ICON_MD_NEAR_ME "\xEE\x95\xA9" +#define ICON_MD_NETWORK_CELL "\xEE\x86\xB9" +#define ICON_MD_NETWORK_CHECK "\xEE\x99\x80" +#define ICON_MD_NETWORK_LOCKED "\xEE\x98\x9A" +#define ICON_MD_NETWORK_WIFI "\xEE\x86\xBA" +#define ICON_MD_NEW_RELEASES "\xEE\x80\xB1" +#define ICON_MD_NEXT_WEEK "\xEE\x85\xAA" +#define ICON_MD_NFC "\xEE\x86\xBB" +#define ICON_MD_NO_ENCRYPTION "\xEE\x99\x81" +#define ICON_MD_NO_SIM "\xEE\x83\x8C" +#define ICON_MD_NOT_INTERESTED "\xEE\x80\xB3" +#define ICON_MD_NOTE "\xEE\x81\xAF" +#define ICON_MD_NOTE_ADD "\xEE\xA2\x9C" +#define ICON_MD_NOTIFICATIONS "\xEE\x9F\xB4" +#define ICON_MD_NOTIFICATIONS_ACTIVE "\xEE\x9F\xB7" +#define ICON_MD_NOTIFICATIONS_NONE "\xEE\x9F\xB5" +#define ICON_MD_NOTIFICATIONS_OFF "\xEE\x9F\xB6" +#define ICON_MD_NOTIFICATIONS_PAUSED "\xEE\x9F\xB8" +#define ICON_MD_OFFLINE_PIN "\xEE\xA4\x8A" +#define ICON_MD_ONDEMAND_VIDEO "\xEE\x98\xBA" +#define ICON_MD_OPACITY "\xEE\xA4\x9C" +#define ICON_MD_OPEN_IN_BROWSER "\xEE\xA2\x9D" +#define ICON_MD_OPEN_IN_NEW "\xEE\xA2\x9E" +#define ICON_MD_OPEN_WITH "\xEE\xA2\x9F" +#define ICON_MD_PAGES "\xEE\x9F\xB9" +#define ICON_MD_PAGEVIEW "\xEE\xA2\xA0" +#define ICON_MD_PALETTE "\xEE\x90\x8A" +#define ICON_MD_PAN_TOOL "\xEE\xA4\xA5" +#define ICON_MD_PANORAMA "\xEE\x90\x8B" +#define ICON_MD_PANORAMA_FISH_EYE "\xEE\x90\x8C" +#define ICON_MD_PANORAMA_HORIZONTAL "\xEE\x90\x8D" +#define ICON_MD_PANORAMA_VERTICAL "\xEE\x90\x8E" +#define ICON_MD_PANORAMA_WIDE_ANGLE "\xEE\x90\x8F" +#define ICON_MD_PARTY_MODE "\xEE\x9F\xBA" +#define ICON_MD_PAUSE "\xEE\x80\xB4" +#define ICON_MD_PAUSE_CIRCLE_FILLED "\xEE\x80\xB5" +#define ICON_MD_PAUSE_CIRCLE_OUTLINE "\xEE\x80\xB6" +#define ICON_MD_PAYMENT "\xEE\xA2\xA1" +#define ICON_MD_PEOPLE "\xEE\x9F\xBB" +#define ICON_MD_PEOPLE_OUTLINE "\xEE\x9F\xBC" +#define ICON_MD_PERM_CAMERA_MIC "\xEE\xA2\xA2" +#define ICON_MD_PERM_CONTACT_CALENDAR "\xEE\xA2\xA3" +#define ICON_MD_PERM_DATA_SETTING "\xEE\xA2\xA4" +#define ICON_MD_PERM_DEVICE_INFORMATION "\xEE\xA2\xA5" +#define ICON_MD_PERM_IDENTITY "\xEE\xA2\xA6" +#define ICON_MD_PERM_MEDIA "\xEE\xA2\xA7" +#define ICON_MD_PERM_PHONE_MSG "\xEE\xA2\xA8" +#define ICON_MD_PERM_SCAN_WIFI "\xEE\xA2\xA9" +#define ICON_MD_PERSON "\xEE\x9F\xBD" +#define ICON_MD_PERSON_ADD "\xEE\x9F\xBE" +#define ICON_MD_PERSON_OUTLINE "\xEE\x9F\xBF" +#define ICON_MD_PERSON_PIN "\xEE\x95\x9A" +#define ICON_MD_PERSON_PIN_CIRCLE "\xEE\x95\xAA" +#define ICON_MD_PERSONAL_VIDEO "\xEE\x98\xBB" +#define ICON_MD_PETS "\xEE\xA4\x9D" +#define ICON_MD_PHONE "\xEE\x83\x8D" +#define ICON_MD_PHONE_ANDROID "\xEE\x8C\xA4" +#define ICON_MD_PHONE_BLUETOOTH_SPEAKER "\xEE\x98\x9B" +#define ICON_MD_PHONE_FORWARDED "\xEE\x98\x9C" +#define ICON_MD_PHONE_IN_TALK "\xEE\x98\x9D" +#define ICON_MD_PHONE_IPHONE "\xEE\x8C\xA5" +#define ICON_MD_PHONE_LOCKED "\xEE\x98\x9E" +#define ICON_MD_PHONE_MISSED "\xEE\x98\x9F" +#define ICON_MD_PHONE_PAUSED "\xEE\x98\xA0" +#define ICON_MD_PHONELINK "\xEE\x8C\xA6" +#define ICON_MD_PHONELINK_ERASE "\xEE\x83\x9B" +#define ICON_MD_PHONELINK_LOCK "\xEE\x83\x9C" +#define ICON_MD_PHONELINK_OFF "\xEE\x8C\xA7" +#define ICON_MD_PHONELINK_RING "\xEE\x83\x9D" +#define ICON_MD_PHONELINK_SETUP "\xEE\x83\x9E" +#define ICON_MD_PHOTO "\xEE\x90\x90" +#define ICON_MD_PHOTO_ALBUM "\xEE\x90\x91" +#define ICON_MD_PHOTO_CAMERA "\xEE\x90\x92" +#define ICON_MD_PHOTO_FILTER "\xEE\x90\xBB" +#define ICON_MD_PHOTO_LIBRARY "\xEE\x90\x93" +#define ICON_MD_PHOTO_SIZE_SELECT_ACTUAL "\xEE\x90\xB2" +#define ICON_MD_PHOTO_SIZE_SELECT_LARGE "\xEE\x90\xB3" +#define ICON_MD_PHOTO_SIZE_SELECT_SMALL "\xEE\x90\xB4" +#define ICON_MD_PICTURE_AS_PDF "\xEE\x90\x95" +#define ICON_MD_PICTURE_IN_PICTURE "\xEE\xA2\xAA" +#define ICON_MD_PICTURE_IN_PICTURE_ALT "\xEE\xA4\x91" +#define ICON_MD_PIE_CHART "\xEE\x9B\x84" +#define ICON_MD_PIE_CHART_OUTLINED "\xEE\x9B\x85" +#define ICON_MD_PIN_DROP "\xEE\x95\x9E" +#define ICON_MD_PLACE "\xEE\x95\x9F" +#define ICON_MD_PLAY_ARROW "\xEE\x80\xB7" +#define ICON_MD_PLAY_CIRCLE_FILLED "\xEE\x80\xB8" +#define ICON_MD_PLAY_CIRCLE_OUTLINE "\xEE\x80\xB9" +#define ICON_MD_PLAY_FOR_WORK "\xEE\xA4\x86" +#define ICON_MD_PLAYLIST_ADD "\xEE\x80\xBB" +#define ICON_MD_PLAYLIST_ADD_CHECK "\xEE\x81\xA5" +#define ICON_MD_PLAYLIST_PLAY "\xEE\x81\x9F" +#define ICON_MD_PLUS_ONE "\xEE\xA0\x80" +#define ICON_MD_POLL "\xEE\xA0\x81" +#define ICON_MD_POLYMER "\xEE\xA2\xAB" +#define ICON_MD_POOL "\xEE\xAD\x88" +#define ICON_MD_PORTABLE_WIFI_OFF "\xEE\x83\x8E" +#define ICON_MD_PORTRAIT "\xEE\x90\x96" +#define ICON_MD_POWER "\xEE\x98\xBC" +#define ICON_MD_POWER_INPUT "\xEE\x8C\xB6" +#define ICON_MD_POWER_SETTINGS_NEW "\xEE\xA2\xAC" +#define ICON_MD_PREGNANT_WOMAN "\xEE\xA4\x9E" +#define ICON_MD_PRESENT_TO_ALL "\xEE\x83\x9F" +#define ICON_MD_PRINT "\xEE\xA2\xAD" +#define ICON_MD_PRIORITY_HIGH "\xEE\x99\x85" +#define ICON_MD_PUBLIC "\xEE\xA0\x8B" +#define ICON_MD_PUBLISH "\xEE\x89\x95" +#define ICON_MD_QUERY_BUILDER "\xEE\xA2\xAE" +#define ICON_MD_QUESTION_ANSWER "\xEE\xA2\xAF" +#define ICON_MD_QUEUE "\xEE\x80\xBC" +#define ICON_MD_QUEUE_MUSIC "\xEE\x80\xBD" +#define ICON_MD_QUEUE_PLAY_NEXT "\xEE\x81\xA6" +#define ICON_MD_RADIO "\xEE\x80\xBE" +#define ICON_MD_RADIO_BUTTON_CHECKED "\xEE\xA0\xB7" +#define ICON_MD_RADIO_BUTTON_UNCHECKED "\xEE\xA0\xB6" +#define ICON_MD_RATE_REVIEW "\xEE\x95\xA0" +#define ICON_MD_RECEIPT "\xEE\xA2\xB0" +#define ICON_MD_RECENT_ACTORS "\xEE\x80\xBF" +#define ICON_MD_RECORD_VOICE_OVER "\xEE\xA4\x9F" +#define ICON_MD_REDEEM "\xEE\xA2\xB1" +#define ICON_MD_REDO "\xEE\x85\x9A" +#define ICON_MD_REFRESH "\xEE\x97\x95" +#define ICON_MD_REMOVE "\xEE\x85\x9B" +#define ICON_MD_REMOVE_CIRCLE "\xEE\x85\x9C" +#define ICON_MD_REMOVE_CIRCLE_OUTLINE "\xEE\x85\x9D" +#define ICON_MD_REMOVE_FROM_QUEUE "\xEE\x81\xA7" +#define ICON_MD_REMOVE_RED_EYE "\xEE\x90\x97" +#define ICON_MD_REMOVE_SHOPPING_CART "\xEE\xA4\xA8" +#define ICON_MD_REORDER "\xEE\xA3\xBE" +#define ICON_MD_REPEAT "\xEE\x81\x80" +#define ICON_MD_REPEAT_ONE "\xEE\x81\x81" +#define ICON_MD_REPLAY "\xEE\x81\x82" +#define ICON_MD_REPLAY_10 "\xEE\x81\x99" +#define ICON_MD_REPLAY_30 "\xEE\x81\x9A" +#define ICON_MD_REPLAY_5 "\xEE\x81\x9B" +#define ICON_MD_REPLY "\xEE\x85\x9E" +#define ICON_MD_REPLY_ALL "\xEE\x85\x9F" +#define ICON_MD_REPORT "\xEE\x85\xA0" +#define ICON_MD_REPORT_PROBLEM "\xEE\xA2\xB2" +#define ICON_MD_RESTAURANT "\xEE\x95\xAC" +#define ICON_MD_RESTAURANT_MENU "\xEE\x95\xA1" +#define ICON_MD_RESTORE "\xEE\xA2\xB3" +#define ICON_MD_RESTORE_PAGE "\xEE\xA4\xA9" +#define ICON_MD_RING_VOLUME "\xEE\x83\x91" +#define ICON_MD_ROOM "\xEE\xA2\xB4" +#define ICON_MD_ROOM_SERVICE "\xEE\xAD\x89" +#define ICON_MD_ROTATE_90_DEGREES_CCW "\xEE\x90\x98" +#define ICON_MD_ROTATE_LEFT "\xEE\x90\x99" +#define ICON_MD_ROTATE_RIGHT "\xEE\x90\x9A" +#define ICON_MD_ROUNDED_CORNER "\xEE\xA4\xA0" +#define ICON_MD_ROUTER "\xEE\x8C\xA8" +#define ICON_MD_ROWING "\xEE\xA4\xA1" +#define ICON_MD_RSS_FEED "\xEE\x83\xA5" +#define ICON_MD_RV_HOOKUP "\xEE\x99\x82" +#define ICON_MD_SATELLITE "\xEE\x95\xA2" +#define ICON_MD_SAVE "\xEE\x85\xA1" +#define ICON_MD_SCANNER "\xEE\x8C\xA9" +#define ICON_MD_SCHEDULE "\xEE\xA2\xB5" +#define ICON_MD_SCHOOL "\xEE\xA0\x8C" +#define ICON_MD_SCREEN_LOCK_LANDSCAPE "\xEE\x86\xBE" +#define ICON_MD_SCREEN_LOCK_PORTRAIT "\xEE\x86\xBF" +#define ICON_MD_SCREEN_LOCK_ROTATION "\xEE\x87\x80" +#define ICON_MD_SCREEN_ROTATION "\xEE\x87\x81" +#define ICON_MD_SCREEN_SHARE "\xEE\x83\xA2" +#define ICON_MD_SD_CARD "\xEE\x98\xA3" +#define ICON_MD_SD_STORAGE "\xEE\x87\x82" +#define ICON_MD_SEARCH "\xEE\xA2\xB6" +#define ICON_MD_SECURITY "\xEE\x8C\xAA" +#define ICON_MD_SELECT_ALL "\xEE\x85\xA2" +#define ICON_MD_SEND "\xEE\x85\xA3" +#define ICON_MD_SENTIMENT_DISSATISFIED "\xEE\xA0\x91" +#define ICON_MD_SENTIMENT_NEUTRAL "\xEE\xA0\x92" +#define ICON_MD_SENTIMENT_SATISFIED "\xEE\xA0\x93" +#define ICON_MD_SENTIMENT_VERY_DISSATISFIED "\xEE\xA0\x94" +#define ICON_MD_SENTIMENT_VERY_SATISFIED "\xEE\xA0\x95" +#define ICON_MD_SETTINGS "\xEE\xA2\xB8" +#define ICON_MD_SETTINGS_APPLICATIONS "\xEE\xA2\xB9" +#define ICON_MD_SETTINGS_BACKUP_RESTORE "\xEE\xA2\xBA" +#define ICON_MD_SETTINGS_BLUETOOTH "\xEE\xA2\xBB" +#define ICON_MD_SETTINGS_BRIGHTNESS "\xEE\xA2\xBD" +#define ICON_MD_SETTINGS_CELL "\xEE\xA2\xBC" +#define ICON_MD_SETTINGS_ETHERNET "\xEE\xA2\xBE" +#define ICON_MD_SETTINGS_INPUT_ANTENNA "\xEE\xA2\xBF" +#define ICON_MD_SETTINGS_INPUT_COMPONENT "\xEE\xA3\x80" +#define ICON_MD_SETTINGS_INPUT_COMPOSITE "\xEE\xA3\x81" +#define ICON_MD_SETTINGS_INPUT_HDMI "\xEE\xA3\x82" +#define ICON_MD_SETTINGS_INPUT_SVIDEO "\xEE\xA3\x83" +#define ICON_MD_SETTINGS_OVERSCAN "\xEE\xA3\x84" +#define ICON_MD_SETTINGS_PHONE "\xEE\xA3\x85" +#define ICON_MD_SETTINGS_POWER "\xEE\xA3\x86" +#define ICON_MD_SETTINGS_REMOTE "\xEE\xA3\x87" +#define ICON_MD_SETTINGS_SYSTEM_DAYDREAM "\xEE\x87\x83" +#define ICON_MD_SETTINGS_VOICE "\xEE\xA3\x88" +#define ICON_MD_SHARE "\xEE\xA0\x8D" +#define ICON_MD_SHOP "\xEE\xA3\x89" +#define ICON_MD_SHOP_TWO "\xEE\xA3\x8A" +#define ICON_MD_SHOPPING_BASKET "\xEE\xA3\x8B" +#define ICON_MD_SHOPPING_CART "\xEE\xA3\x8C" +#define ICON_MD_SHORT_TEXT "\xEE\x89\xA1" +#define ICON_MD_SHOW_CHART "\xEE\x9B\xA1" +#define ICON_MD_SHUFFLE "\xEE\x81\x83" +#define ICON_MD_SIGNAL_CELLULAR_4_BAR "\xEE\x87\x88" +#define ICON_MD_SIGNAL_CELLULAR_CONNECTED_NO_INTERNET_4_BAR "\xEE\x87\x8D" +#define ICON_MD_SIGNAL_CELLULAR_NO_SIM "\xEE\x87\x8E" +#define ICON_MD_SIGNAL_CELLULAR_NULL "\xEE\x87\x8F" +#define ICON_MD_SIGNAL_CELLULAR_OFF "\xEE\x87\x90" +#define ICON_MD_SIGNAL_WIFI_4_BAR "\xEE\x87\x98" +#define ICON_MD_SIGNAL_WIFI_4_BAR_LOCK "\xEE\x87\x99" +#define ICON_MD_SIGNAL_WIFI_OFF "\xEE\x87\x9A" +#define ICON_MD_SIM_CARD "\xEE\x8C\xAB" +#define ICON_MD_SIM_CARD_ALERT "\xEE\x98\xA4" +#define ICON_MD_SKIP_NEXT "\xEE\x81\x84" +#define ICON_MD_SKIP_PREVIOUS "\xEE\x81\x85" +#define ICON_MD_SLIDESHOW "\xEE\x90\x9B" +#define ICON_MD_SLOW_MOTION_VIDEO "\xEE\x81\xA8" +#define ICON_MD_SMARTPHONE "\xEE\x8C\xAC" +#define ICON_MD_SMOKE_FREE "\xEE\xAD\x8A" +#define ICON_MD_SMOKING_ROOMS "\xEE\xAD\x8B" +#define ICON_MD_SMS "\xEE\x98\xA5" +#define ICON_MD_SMS_FAILED "\xEE\x98\xA6" +#define ICON_MD_SNOOZE "\xEE\x81\x86" +#define ICON_MD_SORT "\xEE\x85\xA4" +#define ICON_MD_SORT_BY_ALPHA "\xEE\x81\x93" +#define ICON_MD_SPA "\xEE\xAD\x8C" +#define ICON_MD_SPACE_BAR "\xEE\x89\x96" +#define ICON_MD_SPEAKER "\xEE\x8C\xAD" +#define ICON_MD_SPEAKER_GROUP "\xEE\x8C\xAE" +#define ICON_MD_SPEAKER_NOTES "\xEE\xA3\x8D" +#define ICON_MD_SPEAKER_NOTES_OFF "\xEE\xA4\xAA" +#define ICON_MD_SPEAKER_PHONE "\xEE\x83\x92" +#define ICON_MD_SPELLCHECK "\xEE\xA3\x8E" +#define ICON_MD_STAR "\xEE\xA0\xB8" +#define ICON_MD_STAR_BORDER "\xEE\xA0\xBA" +#define ICON_MD_STAR_HALF "\xEE\xA0\xB9" +#define ICON_MD_STARS "\xEE\xA3\x90" +#define ICON_MD_STAY_CURRENT_LANDSCAPE "\xEE\x83\x93" +#define ICON_MD_STAY_CURRENT_PORTRAIT "\xEE\x83\x94" +#define ICON_MD_STAY_PRIMARY_LANDSCAPE "\xEE\x83\x95" +#define ICON_MD_STAY_PRIMARY_PORTRAIT "\xEE\x83\x96" +#define ICON_MD_STOP "\xEE\x81\x87" +#define ICON_MD_STOP_SCREEN_SHARE "\xEE\x83\xA3" +#define ICON_MD_STORAGE "\xEE\x87\x9B" +#define ICON_MD_STORE "\xEE\xA3\x91" +#define ICON_MD_STORE_MALL_DIRECTORY "\xEE\x95\xA3" +#define ICON_MD_STRAIGHTEN "\xEE\x90\x9C" +#define ICON_MD_STREETVIEW "\xEE\x95\xAE" +#define ICON_MD_STRIKETHROUGH_S "\xEE\x89\x97" +#define ICON_MD_STYLE "\xEE\x90\x9D" +#define ICON_MD_SUBDIRECTORY_ARROW_LEFT "\xEE\x97\x99" +#define ICON_MD_SUBDIRECTORY_ARROW_RIGHT "\xEE\x97\x9A" +#define ICON_MD_SUBJECT "\xEE\xA3\x92" +#define ICON_MD_SUBSCRIPTIONS "\xEE\x81\xA4" +#define ICON_MD_SUBTITLES "\xEE\x81\x88" +#define ICON_MD_SUBWAY "\xEE\x95\xAF" +#define ICON_MD_SUPERVISOR_ACCOUNT "\xEE\xA3\x93" +#define ICON_MD_SURROUND_SOUND "\xEE\x81\x89" +#define ICON_MD_SWAP_CALLS "\xEE\x83\x97" +#define ICON_MD_SWAP_HORIZ "\xEE\xA3\x94" +#define ICON_MD_SWAP_VERT "\xEE\xA3\x95" +#define ICON_MD_SWAP_VERTICAL_CIRCLE "\xEE\xA3\x96" +#define ICON_MD_SWITCH_CAMERA "\xEE\x90\x9E" +#define ICON_MD_SWITCH_VIDEO "\xEE\x90\x9F" +#define ICON_MD_SYNC "\xEE\x98\xA7" +#define ICON_MD_SYNC_DISABLED "\xEE\x98\xA8" +#define ICON_MD_SYNC_PROBLEM "\xEE\x98\xA9" +#define ICON_MD_SYSTEM_UPDATE "\xEE\x98\xAA" +#define ICON_MD_SYSTEM_UPDATE_ALT "\xEE\xA3\x97" +#define ICON_MD_TAB "\xEE\xA3\x98" +#define ICON_MD_TAB_UNSELECTED "\xEE\xA3\x99" +#define ICON_MD_TABLET "\xEE\x8C\xAF" +#define ICON_MD_TABLET_ANDROID "\xEE\x8C\xB0" +#define ICON_MD_TABLET_MAC "\xEE\x8C\xB1" +#define ICON_MD_TAG_FACES "\xEE\x90\xA0" +#define ICON_MD_TAP_AND_PLAY "\xEE\x98\xAB" +#define ICON_MD_TERRAIN "\xEE\x95\xA4" +#define ICON_MD_TEXT_FIELDS "\xEE\x89\xA2" +#define ICON_MD_TEXT_FORMAT "\xEE\x85\xA5" +#define ICON_MD_TEXTSMS "\xEE\x83\x98" +#define ICON_MD_TEXTURE "\xEE\x90\xA1" +#define ICON_MD_THEATERS "\xEE\xA3\x9A" +#define ICON_MD_THUMB_DOWN "\xEE\xA3\x9B" +#define ICON_MD_THUMB_UP "\xEE\xA3\x9C" +#define ICON_MD_THUMBS_UP_DOWN "\xEE\xA3\x9D" +#define ICON_MD_TIME_TO_LEAVE "\xEE\x98\xAC" +#define ICON_MD_TIMELAPSE "\xEE\x90\xA2" +#define ICON_MD_TIMELINE "\xEE\xA4\xA2" +#define ICON_MD_TIMER "\xEE\x90\xA5" +#define ICON_MD_TIMER_10 "\xEE\x90\xA3" +#define ICON_MD_TIMER_3 "\xEE\x90\xA4" +#define ICON_MD_TIMER_OFF "\xEE\x90\xA6" +#define ICON_MD_TITLE "\xEE\x89\xA4" +#define ICON_MD_TOC "\xEE\xA3\x9E" +#define ICON_MD_TODAY "\xEE\xA3\x9F" +#define ICON_MD_TOLL "\xEE\xA3\xA0" +#define ICON_MD_TONALITY "\xEE\x90\xA7" +#define ICON_MD_TOUCH_APP "\xEE\xA4\x93" +#define ICON_MD_TOYS "\xEE\x8C\xB2" +#define ICON_MD_TRACK_CHANGES "\xEE\xA3\xA1" +#define ICON_MD_TRAFFIC "\xEE\x95\xA5" +#define ICON_MD_TRAIN "\xEE\x95\xB0" +#define ICON_MD_TRAM "\xEE\x95\xB1" +#define ICON_MD_TRANSFER_WITHIN_A_STATION "\xEE\x95\xB2" +#define ICON_MD_TRANSFORM "\xEE\x90\xA8" +#define ICON_MD_TRANSLATE "\xEE\xA3\xA2" +#define ICON_MD_TRENDING_DOWN "\xEE\xA3\xA3" +#define ICON_MD_TRENDING_FLAT "\xEE\xA3\xA4" +#define ICON_MD_TRENDING_UP "\xEE\xA3\xA5" +#define ICON_MD_TUNE "\xEE\x90\xA9" +#define ICON_MD_TURNED_IN "\xEE\xA3\xA6" +#define ICON_MD_TURNED_IN_NOT "\xEE\xA3\xA7" +#define ICON_MD_TV "\xEE\x8C\xB3" +#define ICON_MD_UNARCHIVE "\xEE\x85\xA9" +#define ICON_MD_UNDO "\xEE\x85\xA6" +#define ICON_MD_UNFOLD_LESS "\xEE\x97\x96" +#define ICON_MD_UNFOLD_MORE "\xEE\x97\x97" +#define ICON_MD_UPDATE "\xEE\xA4\xA3" +#define ICON_MD_USB "\xEE\x87\xA0" +#define ICON_MD_VERIFIED_USER "\xEE\xA3\xA8" +#define ICON_MD_VERTICAL_ALIGN_BOTTOM "\xEE\x89\x98" +#define ICON_MD_VERTICAL_ALIGN_CENTER "\xEE\x89\x99" +#define ICON_MD_VERTICAL_ALIGN_TOP "\xEE\x89\x9A" +#define ICON_MD_VIBRATION "\xEE\x98\xAD" +#define ICON_MD_VIDEO_CALL "\xEE\x81\xB0" +#define ICON_MD_VIDEO_LABEL "\xEE\x81\xB1" +#define ICON_MD_VIDEO_LIBRARY "\xEE\x81\x8A" +#define ICON_MD_VIDEOCAM "\xEE\x81\x8B" +#define ICON_MD_VIDEOCAM_OFF "\xEE\x81\x8C" +#define ICON_MD_VIDEOGAME_ASSET "\xEE\x8C\xB8" +#define ICON_MD_VIEW_AGENDA "\xEE\xA3\xA9" +#define ICON_MD_VIEW_ARRAY "\xEE\xA3\xAA" +#define ICON_MD_VIEW_CAROUSEL "\xEE\xA3\xAB" +#define ICON_MD_VIEW_COLUMN "\xEE\xA3\xAC" +#define ICON_MD_VIEW_COMFY "\xEE\x90\xAA" +#define ICON_MD_VIEW_COMPACT "\xEE\x90\xAB" +#define ICON_MD_VIEW_DAY "\xEE\xA3\xAD" +#define ICON_MD_VIEW_HEADLINE "\xEE\xA3\xAE" +#define ICON_MD_VIEW_LIST "\xEE\xA3\xAF" +#define ICON_MD_VIEW_MODULE "\xEE\xA3\xB0" +#define ICON_MD_VIEW_QUILT "\xEE\xA3\xB1" +#define ICON_MD_VIEW_STREAM "\xEE\xA3\xB2" +#define ICON_MD_VIEW_WEEK "\xEE\xA3\xB3" +#define ICON_MD_VIGNETTE "\xEE\x90\xB5" +#define ICON_MD_VISIBILITY "\xEE\xA3\xB4" +#define ICON_MD_VISIBILITY_OFF "\xEE\xA3\xB5" +#define ICON_MD_VOICE_CHAT "\xEE\x98\xAE" +#define ICON_MD_VOICEMAIL "\xEE\x83\x99" +#define ICON_MD_VOLUME_DOWN "\xEE\x81\x8D" +#define ICON_MD_VOLUME_MUTE "\xEE\x81\x8E" +#define ICON_MD_VOLUME_OFF "\xEE\x81\x8F" +#define ICON_MD_VOLUME_UP "\xEE\x81\x90" +#define ICON_MD_VPN_KEY "\xEE\x83\x9A" +#define ICON_MD_VPN_LOCK "\xEE\x98\xAF" +#define ICON_MD_WALLPAPER "\xEE\x86\xBC" +#define ICON_MD_WARNING "\xEE\x80\x82" +#define ICON_MD_WATCH "\xEE\x8C\xB4" +#define ICON_MD_WATCH_LATER "\xEE\xA4\xA4" +#define ICON_MD_WB_AUTO "\xEE\x90\xAC" +#define ICON_MD_WB_CLOUDY "\xEE\x90\xAD" +#define ICON_MD_WB_INCANDESCENT "\xEE\x90\xAE" +#define ICON_MD_WB_IRIDESCENT "\xEE\x90\xB6" +#define ICON_MD_WB_SUNNY "\xEE\x90\xB0" +#define ICON_MD_WC "\xEE\x98\xBD" +#define ICON_MD_WEB "\xEE\x81\x91" +#define ICON_MD_WEB_ASSET "\xEE\x81\xA9" +#define ICON_MD_WEEKEND "\xEE\x85\xAB" +#define ICON_MD_WHATSHOT "\xEE\xA0\x8E" +#define ICON_MD_WIDGETS "\xEE\x86\xBD" +#define ICON_MD_WIFI "\xEE\x98\xBE" +#define ICON_MD_WIFI_LOCK "\xEE\x87\xA1" +#define ICON_MD_WIFI_TETHERING "\xEE\x87\xA2" +#define ICON_MD_WORK "\xEE\xA3\xB9" +#define ICON_MD_WRAP_TEXT "\xEE\x89\x9B" +#define ICON_MD_YOUTUBE_SEARCHED_FOR "\xEE\xA3\xBA" +#define ICON_MD_ZOOM_IN "\xEE\xA3\xBF" +#define ICON_MD_ZOOM_OUT "\xEE\xA4\x80" +#define ICON_MD_ZOOM_OUT_MAP "\xEE\x95\xAB" diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp index 0949fe7de96..aa8d8f1d657 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp @@ -830,10 +830,9 @@ int ImStrnicmp(const char* str1, const char* str2, int count) char* ImStrdup(const char *str) { - char *buff = (char*)ImGui::MemAlloc(strlen(str) + 1); - IM_ASSERT(buff); - strcpy(buff, str); - return buff; + size_t len = strlen(str) + 1; + void* buff = ImGui::MemAlloc(len); + return (char*)memcpy(buff, (const void*)str, len); } int ImStrlenW(const ImWchar* str) diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp index 8fd48b0b01b..7c9653772d9 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp @@ -1894,6 +1894,11 @@ struct ExampleAppConsole free(History[i]); } + // Portable helpers + static int Stricmp(const char* str1, const char* str2) { int d; while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } return d; } + static int Strnicmp(const char* str1, const char* str2, int n) { int d = 0; while (n > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; n--; } return d; } + static char* Strdup(const char *str) { size_t len = strlen(str) + 1; void* buff = ImGui::MemAlloc(len); return (char*)memcpy(buff, (const void*)str, len); } + void ClearLog() { for (int i = 0; i < Items.Size; i++) @@ -1910,7 +1915,7 @@ struct ExampleAppConsole vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); buf[IM_ARRAYSIZE(buf)-1] = 0; va_end(args); - Items.push_back(strdup(buf)); + Items.push_back(Strdup(buf)); ScrollToBottom = true; } @@ -1987,9 +1992,6 @@ struct ExampleAppConsole ImGui::End(); } - static int Stricmp(const char* str1, const char* str2) { int d; while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } return d; } - static int Strnicmp(const char* str1, const char* str2, int count) { int d = 0; while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; count--; } return d; } - void ExecCommand(const char* command_line) { AddLog("# %s\n", command_line); @@ -2003,7 +2005,7 @@ struct ExampleAppConsole History.erase(History.begin() + i); break; } - History.push_back(strdup(command_line)); + History.push_back(Strdup(command_line)); // Process command if (Stricmp(command_line, "CLEAR") == 0) diff --git a/3rdparty/bgfx/README.md b/3rdparty/bgfx/README.md index 2b444eb809f..521853b6f2b 100644 --- a/3rdparty/bgfx/README.md +++ b/3rdparty/bgfx/README.md @@ -37,6 +37,7 @@ Supported platforms: * Native Client (PPAPI 37+, ARM, x86, x64, PNaCl) * OSX (10.9+) * RaspberryPi + * SteamLink * Windows (XP, Vista, 7, 8, 10) * WinRT (WinPhone 8.0+) @@ -99,7 +100,7 @@ deployment model of web with the performance of native code and GPU acceleration https://github.com/nem0/LumixEngine LumixEngine is a MIT licensed 3D engine. The main goal is performance and Unity-like usability. -![LumixEngine screenshot](https://cloud.githubusercontent.com/assets/153526/10109455/450c51be-63c7-11e5-9c87-96d9d00efe02.png) +![LumixEngine screenshot](https://cloud.githubusercontent.com/assets/153526/12904252/3fcf130e-cece-11e5-878b-c9fe24c1b11a.png) https://github.com/podgorskiy/KeplerOrbits KeplerOrbits - Tool that calculates positions of celestial bodies using their orbital elements. [Web Demo](http://podgorskiy.com/KeplerOrbits/KeplerOrbits.html) diff --git a/3rdparty/bgfx/examples/10-font/font.cpp b/3rdparty/bgfx/examples/10-font/font.cpp index 97111e1b175..a15cef4baae 100644 --- a/3rdparty/bgfx/examples/10-font/font.cpp +++ b/3rdparty/bgfx/examples/10-font/font.cpp @@ -14,6 +14,9 @@ #include "font/text_buffer_manager.h" #include "entry/input.h" +#include +#include + #include #include @@ -105,10 +108,12 @@ int _main_(int _argc, char** _argv) } TrueTypeHandle fontAwesomeTtf = loadTtf(fontManager, "font/fontawesome-webfont.ttf"); + TrueTypeHandle fontKenneyTtf = loadTtf(fontManager, "font/kenney-icon-font.ttf"); // This font doesn't have any preloaded glyph's but the truetype file // is loaded so glyph will be generated as needed. FontHandle fontAwesome72 = fontManager->createFontByPixelSize(fontAwesomeTtf, 0, 72); + FontHandle fontKenney64 = fontManager->createFontByPixelSize(fontKenneyTtf, 0, 64); TrueTypeHandle visitorTtf = loadTtf(fontManager, "font/visitor1.ttf"); @@ -160,7 +165,24 @@ int _main_(int _argc, char** _argv) textBufferManager->appendText(staticText, fonts[0], L"dog\n"); textBufferManager->setStyle(staticText, STYLE_NORMAL); - textBufferManager->appendText(staticText, fontAwesome72, L"\xf011 \xf02e \xf061 \xf087 \xf0d9 \xf099 \xf05c \xf021 \xf113\n"); + textBufferManager->appendText(staticText, fontAwesome72, + " " ICON_FA_POWER_OFF + " " ICON_FA_TWITTER_SQUARE + " " ICON_FA_CERTIFICATE + " " ICON_FA_FLOPPY_O + " " ICON_FA_GITHUB + " " ICON_FA_GITHUB_ALT + "\n" + ); + textBufferManager->appendText(staticText, fontKenney64, + " " ICON_KI_COMPUTER + " " ICON_KI_JOYSTICK + " " ICON_KI_EXLAMATION + " " ICON_KI_STAR + " " ICON_KI_BUTTON_START + " " ICON_KI_DOWNLOAD + "\n" + ); // Create a transient buffer for real-time data. TextBufferHandle transientText = textBufferManager->createTextBuffer(FONT_TYPE_ALPHA, BufferType::Transient); @@ -242,10 +264,12 @@ int _main_(int _argc, char** _argv) bgfx::frame(); } + fontManager->destroyTtf(fontKenneyTtf); fontManager->destroyTtf(fontAwesomeTtf); fontManager->destroyTtf(visitorTtf); // Destroy the fonts. + fontManager->destroyFont(fontKenney64); fontManager->destroyFont(fontAwesome72); fontManager->destroyFont(visitor10); for (uint32_t ii = 0; ii < numFonts; ++ii) diff --git a/3rdparty/bgfx/examples/common/bounds.cpp b/3rdparty/bgfx/examples/common/bounds.cpp index d2228e7eb63..3937b550567 100644 --- a/3rdparty/bgfx/examples/common/bounds.cpp +++ b/3rdparty/bgfx/examples/common/bounds.cpp @@ -277,6 +277,102 @@ void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num _sphere.m_radius = bx::fsqrt(maxDistSq); } +void buildFrustumPlanes(Plane* _result, const float* _viewProj) +{ + const float xw = _viewProj[ 3]; + const float yw = _viewProj[ 7]; + const float zw = _viewProj[11]; + const float ww = _viewProj[15]; + + const float xz = _viewProj[ 2]; + const float yz = _viewProj[ 6]; + const float zz = _viewProj[10]; + const float wz = _viewProj[14]; + + Plane& near = _result[0]; + Plane& far = _result[1]; + Plane& left = _result[2]; + Plane& right = _result[3]; + Plane& top = _result[4]; + Plane& bottom = _result[5]; + + near.m_normal[0] = xw - xz; + near.m_normal[1] = yw - yz; + near.m_normal[2] = zw - zz; + near.m_dist = ww - wz; + + far.m_normal[0] = xw + xz; + far.m_normal[1] = yw + yz; + far.m_normal[2] = zw + zz; + far.m_dist = ww + wz; + + const float xx = _viewProj[ 0]; + const float yx = _viewProj[ 4]; + const float zx = _viewProj[ 8]; + const float wx = _viewProj[12]; + + left.m_normal[0] = xw - xx; + left.m_normal[1] = yw - yx; + left.m_normal[2] = zw - zx; + left.m_dist = ww - wx; + + right.m_normal[0] = xw + xx; + right.m_normal[1] = yw + yx; + right.m_normal[2] = zw + zx; + right.m_dist = ww + wx; + + const float xy = _viewProj[ 1]; + const float yy = _viewProj[ 5]; + const float zy = _viewProj[ 9]; + const float wy = _viewProj[13]; + + top.m_normal[0] = xw + xy; + top.m_normal[1] = yw + yy; + top.m_normal[2] = zw + zy; + top.m_dist = ww + wy; + + bottom.m_normal[0] = xw - xy; + bottom.m_normal[1] = yw - yy; + bottom.m_normal[2] = zw - zy; + bottom.m_dist = ww - wy; + + Plane* plane = _result; + for (uint32_t ii = 0; ii < 6; ++ii) + { + float invLen = 1.0f / bx::vec3Norm(plane->m_normal, plane->m_normal); + plane->m_dist *= invLen; + ++plane; + } +} + +void intersectPlanes(float _result[3], const Plane& _pa, const Plane& _pb, const Plane& _pc) +{ + float axb[3]; + bx::vec3Cross(axb, _pa.m_normal, _pb.m_normal); + + float bxc[3]; + bx::vec3Cross(bxc, _pb.m_normal, _pc.m_normal); + + float cxa[3]; + bx::vec3Cross(cxa, _pc.m_normal, _pa.m_normal); + + float tmp0[3]; + bx::vec3Mul(tmp0, bxc, _pa.m_dist); + + float tmp1[3]; + bx::vec3Mul(tmp1, cxa, _pb.m_dist); + + float tmp2[3]; + bx::vec3Mul(tmp2, axb, _pc.m_dist); + + float tmp[3]; + bx::vec3Add(tmp, tmp0, tmp1); + bx::vec3Add(tmp0, tmp, tmp2); + + float denom = bx::vec3Dot(_pa.m_normal, bxc); + bx::vec3Mul(_result, tmp0, -1.0f/denom); +} + Ray makeRay(float _x, float _y, const float* _invVp) { Ray ray; diff --git a/3rdparty/bgfx/examples/common/bounds.h b/3rdparty/bgfx/examples/common/bounds.h index f59c2b2230f..24f23414f10 100644 --- a/3rdparty/bgfx/examples/common/bounds.h +++ b/3rdparty/bgfx/examples/common/bounds.h @@ -94,6 +94,12 @@ void calcMaxBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num /// Calculate minimum bounding sphere. void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _numVertices, uint32_t _stride, float _step = 0.01f); +/// Returns 6 (near, far, left, right, top, bottom) planes representing frustum planes. +void buildFrustumPlanes(Plane* _planes, const float* _viewProj); + +/// Returns point from 3 intersecting planes. +void intersectPlanes(float _result[3], const Plane& _pa, const Plane& _pb, const Plane& _pc); + /// Make screen space ray from x, y coordinate and inverse view-projection matrix. Ray makeRay(float _x, float _y, const float* _invVp); diff --git a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp index 2bff902302c..989d0ae0667 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp @@ -218,6 +218,8 @@ namespace entry return wmi.info.cocoa.window; # elif BX_PLATFORM_WINDOWS return wmi.info.win.window; +# elif BX_PLATFORM_STEAMLINK + return wmi.info.vivante.window; # endif // BX_PLATFORM_ } diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.cpp b/3rdparty/bgfx/examples/common/imgui/imgui.cpp index 2655e6ce0a1..4cdc5f30fe5 100644 --- a/3rdparty/bgfx/examples/common/imgui/imgui.cpp +++ b/3rdparty/bgfx/examples/common/imgui/imgui.cpp @@ -3572,3 +3572,10 @@ bool imguiMouseOverArea() { return s_imgui.m_insideArea; } + +bgfx::ProgramHandle imguiGetImageProgram(uint8_t _mip) +{ + const float lodEnabled[4] = { float(_mip), 1.0f, 0.0f, 0.0f }; + bgfx::setUniform(s_imgui.u_imageLodEnabled, lodEnabled); + return s_imgui.m_imageProgram; +} diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.h b/3rdparty/bgfx/examples/common/imgui/imgui.h index 75269500c85..0ab18cb9f8a 100644 --- a/3rdparty/bgfx/examples/common/imgui/imgui.h +++ b/3rdparty/bgfx/examples/common/imgui/imgui.h @@ -208,12 +208,13 @@ bool imguiMouseOverArea(); namespace ImGui { -#define IMGUI_FLAGS_NONE UINT16_C(0x0000) -#define IMGUI_FLAGS_ALPHA_BLEND UINT16_C(0x0001) +#define IMGUI_FLAGS_NONE UINT8_C(0x00) +#define IMGUI_FLAGS_ALPHA_BLEND UINT8_C(0x01) // Helper function for passing bgfx::TextureHandle to ImGui::Image. inline void Image(bgfx::TextureHandle _handle - , uint16_t _flags + , uint8_t _flags + , uint8_t _mip , const ImVec2& _size , const ImVec2& _uv0 = ImVec2(0.0f, 0.0f) , const ImVec2& _uv1 = ImVec2(1.0f, 1.0f) @@ -221,9 +222,10 @@ namespace ImGui , const ImVec4& _borderCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f) ) { - union { struct { uint16_t flags; bgfx::TextureHandle handle; } s; ImTextureID ptr; } texture; - texture.s.flags = _flags; + union { struct { bgfx::TextureHandle handle; uint8_t flags; uint8_t mip; } s; ImTextureID ptr; } texture; texture.s.handle = _handle; + texture.s.flags = _flags; + texture.s.mip = _mip; Image(texture.ptr, _size, _uv0, _uv1, _tintCol, _borderCol); } @@ -236,12 +238,13 @@ namespace ImGui , const ImVec4& _borderCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f) ) { - Image(_handle, IMGUI_FLAGS_ALPHA_BLEND, _size, _uv0, _uv1, _tintCol, _borderCol); + Image(_handle, IMGUI_FLAGS_ALPHA_BLEND, 0, _size, _uv0, _uv1, _tintCol, _borderCol); } // Helper function for passing bgfx::TextureHandle to ImGui::ImageButton. inline bool ImageButton(bgfx::TextureHandle _handle - , uint16_t _flags + , uint8_t _flags + , uint8_t _mip , const ImVec2& _size , const ImVec2& _uv0 = ImVec2(0.0f, 0.0f) , const ImVec2& _uv1 = ImVec2(1.0f, 1.0f) @@ -250,9 +253,10 @@ namespace ImGui , const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f) ) { - union { struct { uint16_t flags; bgfx::TextureHandle handle; } s; ImTextureID ptr; } texture; - texture.s.flags = _flags; + union { struct { bgfx::TextureHandle handle; uint8_t flags; uint8_t mip; } s; ImTextureID ptr; } texture; texture.s.handle = _handle; + texture.s.flags = _flags; + texture.s.mip = _mip; return ImageButton(texture.ptr, _size, _uv0, _uv1, _framePadding, _bgCol, _tintCol); } @@ -266,7 +270,7 @@ namespace ImGui , const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f) ) { - return ImageButton(_handle, IMGUI_FLAGS_ALPHA_BLEND, _size, _uv0, _uv1, _framePadding, _bgCol, _tintCol); + return ImageButton(_handle, IMGUI_FLAGS_ALPHA_BLEND, 0, _size, _uv0, _uv1, _framePadding, _bgCol, _tintCol); } } // namespace ImGui diff --git a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp index 4545bb998a0..f6f0a4e2bdd 100644 --- a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp +++ b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp @@ -305,15 +305,21 @@ struct OcornutImguiContext ; bgfx::TextureHandle th = m_texture; + bgfx::ProgramHandle program = m_program; if (NULL != cmd->TextureId) { - union { ImTextureID ptr; struct { uint16_t flags; bgfx::TextureHandle handle; } s; } texture = { cmd->TextureId }; + union { ImTextureID ptr; struct { bgfx::TextureHandle handle; uint8_t flags; uint8_t mip; } s; } texture = { cmd->TextureId }; state |= 0 != (IMGUI_FLAGS_ALPHA_BLEND & texture.s.flags) ? BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) : BGFX_STATE_NONE ; th = texture.s.handle; + if (0 != texture.s.mip) + { + extern bgfx::ProgramHandle imguiGetImageProgram(uint8_t _mip); + program = imguiGetImageProgram(texture.s.mip); + } } else { @@ -331,7 +337,7 @@ struct OcornutImguiContext bgfx::setTexture(0, s_tex, th); bgfx::setVertexBuffer(&tvb, 0, numVertices); bgfx::setIndexBuffer(&tib, offset, cmd->ElemCount); - bgfx::submit(cmd->ViewId, m_program); + bgfx::submit(cmd->ViewId, program); } offset += cmd->ElemCount; diff --git a/3rdparty/bgfx/examples/runtime/font/kenney-icon-font.ttf b/3rdparty/bgfx/examples/runtime/font/kenney-icon-font.ttf new file mode 100644 index 00000000000..9a3e406003c Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/font/kenney-icon-font.ttf differ diff --git a/3rdparty/bgfx/include/bgfx/bgfx.h b/3rdparty/bgfx/include/bgfx/bgfx.h index 16c5e46a6e7..e30d7417158 100644 --- a/3rdparty/bgfx/include/bgfx/bgfx.h +++ b/3rdparty/bgfx/include/bgfx/bgfx.h @@ -532,6 +532,14 @@ namespace bgfx bool cubeMap; //!< Texture is cubemap. }; + /// + struct Attachment + { + TextureHandle handle; //!< Texture handle. + uint16_t mip; //!< Mip level. + uint16_t layer; //!< Cubemap side or depth layer/slice. + }; + /// Transform data. /// /// @attention C99 equivalent is `bgfx_transform_t`. @@ -1362,8 +1370,8 @@ namespace bgfx /// Update Cube texture. /// /// @param[in] _handle Texture handle. - /// @param[in] _side Cubemap side, where 0 is +X, 1 is -X, 2 is +Y, 3 is - /// -Y, 4 is +Z, and 5 is -Z. + /// @param[in] _side Cubemap side `BGFX_CUBE_MAP__`, + /// where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z. /// /// +----------+ /// |-z 2| @@ -1470,6 +1478,17 @@ namespace bgfx /// FrameBufferHandle createFrameBuffer(uint8_t _num, const TextureHandle* _handles, bool _destroyTextures = false); + /// Create frame buffer. + /// + /// @param[in] _num Number of texture attachments. + /// @param[in] _attachment Attachment info. See: `Attachment`. + /// @param[in] _destroyTextures If true, textures will be destroyed when + /// frame buffer is destroyed. + /// + /// @attention C99 equivalent is `bgfx_create_frame_buffer_from_handles`. + /// + FrameBufferHandle createFrameBuffer(uint8_t _num, const Attachment* _attachment, bool _destroyTextures = false); + /// Create frame buffer for multiple window rendering. /// /// @param[in] _nwh OS' target native window handle. diff --git a/3rdparty/bgfx/include/bgfx/bgfxdefines.h b/3rdparty/bgfx/include/bgfx/bgfxdefines.h index 3c1b3671a6b..b80622743a6 100644 --- a/3rdparty/bgfx/include/bgfx/bgfxdefines.h +++ b/3rdparty/bgfx/include/bgfx/bgfxdefines.h @@ -6,7 +6,7 @@ #ifndef BGFX_DEFINES_H_HEADER_GUARD #define BGFX_DEFINES_H_HEADER_GUARD -#define BGFX_API_VERSION UINT32_C(7) +#define BGFX_API_VERSION UINT32_C(9) /// #define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write. @@ -422,4 +422,12 @@ #define BGFX_HMD_DEVICE_RESOLUTION UINT8_C(0x01) //!< Has HMD native resolution. #define BGFX_HMD_RENDERING UINT8_C(0x02) //!< Rendering to HMD. +/// +#define BGFX_CUBE_MAP_POSITIVE_X UINT8_C(0x00) //!< Cubemap +x. +#define BGFX_CUBE_MAP_NEGATIVE_X UINT8_C(0x01) //!< Cubemap -x. +#define BGFX_CUBE_MAP_POSITIVE_Y UINT8_C(0x02) //!< Cubemap +y. +#define BGFX_CUBE_MAP_NEGATIVE_Y UINT8_C(0x03) //!< Cubemap -y. +#define BGFX_CUBE_MAP_POSITIVE_Z UINT8_C(0x04) //!< Cubemap +z. +#define BGFX_CUBE_MAP_NEGATIVE_Z UINT8_C(0x05) //!< Cubemap -z. + #endif // BGFX_DEFINES_H_HEADER_GUARD diff --git a/3rdparty/bgfx/include/bgfx/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/bgfxplatform.h index 1b6e336b675..52b330112d5 100644 --- a/3rdparty/bgfx/include/bgfx/bgfxplatform.h +++ b/3rdparty/bgfx/include/bgfx/bgfxplatform.h @@ -279,6 +279,9 @@ namespace bgfx # elif BX_PLATFORM_WINDOWS pd.ndt = NULL; pd.nwh = wmi.info.win.window; +# elif BX_PLATFORM_STEAMLINK + pd.ndt = wmi.info.vivante.display; + pd.nwh = wmi.info.vivante.window; # endif // BX_PLATFORM_ pd.context = NULL; pd.backBuffer = NULL; diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfx.h b/3rdparty/bgfx/include/bgfx/c99/bgfx.h index fa585759ce9..cba442ef0be 100644 --- a/3rdparty/bgfx/include/bgfx/c99/bgfx.h +++ b/3rdparty/bgfx/include/bgfx/c99/bgfx.h @@ -349,6 +349,15 @@ typedef struct bgfx_texture_info } bgfx_texture_info_t; +/**/ +typedef struct bgfx_attachment +{ + bgfx_texture_handle_t handle; + uint16_t mip; + uint16_t layer; + +} bgfx_attachment_t; + /**/ typedef struct bgfx_caps_gpu { @@ -639,7 +648,7 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags); /**/ -BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures); +BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures); /**/ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat); diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h index 1fb82c974f8..61ff57d2b29 100644 --- a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h +++ b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h @@ -137,7 +137,7 @@ typedef struct bgfx_interface_vtbl void (*destroy_texture)(bgfx_texture_handle_t _handle); bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags); bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags); - bgfx_frame_buffer_handle_t (*create_frame_buffer_from_handles)(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures); + bgfx_frame_buffer_handle_t (*create_frame_buffer_from_attachment)(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures); bgfx_frame_buffer_handle_t (*create_frame_buffer_from_nwh)(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat); void (*destroy_frame_buffer)(bgfx_frame_buffer_handle_t _handle); bgfx_uniform_handle_t (*create_uniform)(const char* _name, bgfx_uniform_type_t _type, uint16_t _num); diff --git a/3rdparty/bgfx/scripts/bgfx.lua b/3rdparty/bgfx/scripts/bgfx.lua index cc646b6e261..97ec723ddba 100644 --- a/3rdparty/bgfx/scripts/bgfx.lua +++ b/3rdparty/bgfx/scripts/bgfx.lua @@ -88,12 +88,18 @@ function bgfxProject(_name, _kind, _defines) "-weak_framework Metal", } - configuration { "not nacl" } + configuration { "not nacl", "not linux-steamlink" } includedirs { --nacl has GLES2 headers modified... + --steamlink has EGL headers modified... path.join(BGFX_DIR, "3rdparty/khronos"), } + configuration { "linux-steamlink" } + defines { + "EGL_API_FB", + } + configuration {} includedirs { diff --git a/3rdparty/bgfx/scripts/example-common.lua b/3rdparty/bgfx/scripts/example-common.lua index 1832f9836ac..fcaca364f64 100644 --- a/3rdparty/bgfx/scripts/example-common.lua +++ b/3rdparty/bgfx/scripts/example-common.lua @@ -60,6 +60,11 @@ project ("example-common") "ENTRY_CONFIG_USE_GLFW=1", } end + + configuration { "linux-steamlink" } + defines { + "EGL_API_FB", + } configuration { "osx or ios* or tvos*" } files { diff --git a/3rdparty/bgfx/scripts/genie.lua b/3rdparty/bgfx/scripts/genie.lua index 77fe35d4cb6..52554366dfb 100644 --- a/3rdparty/bgfx/scripts/genie.lua +++ b/3rdparty/bgfx/scripts/genie.lua @@ -304,13 +304,21 @@ function exampleProject(_name) kind "ConsoleApp" targetextension ".bc" - configuration { "linux-* or freebsd" } + configuration { "linux-* or freebsd", "not linux-steamlink" } links { "X11", "GL", "pthread", } + configuration { "linux-steamlink" } + links { + "EGL", + "GLESv2", + "SDL2", + "pthread", + } + configuration { "rpi" } links { "X11", diff --git a/3rdparty/bgfx/src/bgfx.cpp b/3rdparty/bgfx/src/bgfx.cpp index aae0311ebd5..e16d4f71c3f 100644 --- a/3rdparty/bgfx/src/bgfx.cpp +++ b/3rdparty/bgfx/src/bgfx.cpp @@ -2259,13 +2259,10 @@ again: uint8_t num; _cmdbuf.read(num); - TextureHandle textureHandles[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; - for (uint32_t ii = 0; ii < num; ++ii) - { - _cmdbuf.read(textureHandles[ii]); - } + Attachment attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; + _cmdbuf.read(attachment, sizeof(Attachment) * num); - m_renderCtx->createFrameBuffer(handle, num, textureHandles); + m_renderCtx->createFrameBuffer(handle, num, attachment); } } break; @@ -3111,6 +3108,19 @@ again: } FrameBufferHandle createFrameBuffer(uint8_t _num, const TextureHandle* _handles, bool _destroyTextures) + { + Attachment attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; + for (uint8_t ii = 0; ii < _num; ++ii) + { + Attachment& at = attachment[ii]; + at.handle = _handles[ii]; + at.mip = 0; + at.layer = 0; + } + return createFrameBuffer(_num, attachment, _destroyTextures); + } + + FrameBufferHandle createFrameBuffer(uint8_t _num, const Attachment* _attachment, bool _destroyTextures) { BGFX_CHECK_MAIN_THREAD(); BX_CHECK(_num != 0, "Number of frame buffer attachments can't be 0."); @@ -3118,8 +3128,8 @@ again: , _num , BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS ); - BX_CHECK(NULL != _handles, "_handles can't be NULL"); - return s_ctx->createFrameBuffer(_num, _handles, _destroyTextures); + BX_CHECK(NULL != _attachment, "_attachment can't be NULL"); + return s_ctx->createFrameBuffer(_num, _attachment, _destroyTextures); } FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _depthFormat) @@ -4114,10 +4124,10 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backb return handle.c; } -BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures) +BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures) { union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle; - handle.cpp = bgfx::createFrameBuffer(_num, (const bgfx::TextureHandle*)_handles, _destroyTextures); + handle.cpp = bgfx::createFrameBuffer(_num, (const bgfx::Attachment*)_attachment, _destroyTextures); return handle.c; } @@ -4560,7 +4570,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) BGFX_IMPORT_FUNC(destroy_texture) \ BGFX_IMPORT_FUNC(create_frame_buffer) \ BGFX_IMPORT_FUNC(create_frame_buffer_scaled) \ - BGFX_IMPORT_FUNC(create_frame_buffer_from_handles) \ + BGFX_IMPORT_FUNC(create_frame_buffer_from_attachment) \ BGFX_IMPORT_FUNC(create_frame_buffer_from_nwh) \ BGFX_IMPORT_FUNC(destroy_frame_buffer) \ BGFX_IMPORT_FUNC(create_uniform) \ diff --git a/3rdparty/bgfx/src/bgfx_p.h b/3rdparty/bgfx/src/bgfx_p.h index 594310d284f..1434b5ca41f 100644 --- a/3rdparty/bgfx/src/bgfx_p.h +++ b/3rdparty/bgfx/src/bgfx_p.h @@ -573,8 +573,14 @@ namespace bgfx const char* getPredefinedUniformName(PredefinedUniform::Enum _enum); PredefinedUniform::Enum nameToPredefinedUniformEnum(const char* _name); - struct CommandBuffer + class CommandBuffer { + BX_CLASS(CommandBuffer + , NO_COPY + , NO_ASSIGNMENT + ); + + public: CommandBuffer() : m_pos(0) , m_size(BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE) @@ -690,10 +696,6 @@ namespace bgfx uint32_t m_pos; uint32_t m_size; uint8_t m_buffer[BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE]; - - private: - CommandBuffer(const CommandBuffer&); - void operator=(const CommandBuffer&); }; #define SORT_KEY_NUM_BITS_TRANS 2 @@ -2050,7 +2052,7 @@ namespace bgfx virtual void overrideInternal(TextureHandle _handle, uintptr_t _ptr) = 0; virtual uintptr_t getInternal(TextureHandle _handle) = 0; virtual void destroyTexture(TextureHandle _handle) = 0; - virtual void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) = 0; + virtual void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) = 0; virtual void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) = 0; virtual void destroyFrameBuffer(FrameBufferHandle _handle) = 0; virtual void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) = 0; @@ -3182,14 +3184,14 @@ namespace bgfx cmdbuf.write(_mem); } - bool checkFrameBuffer(uint8_t _num, const TextureHandle* _handles) const + bool checkFrameBuffer(uint8_t _num, const Attachment* _attachment) const { uint8_t color = 0; uint8_t depth = 0; for (uint32_t ii = 0; ii < _num; ++ii) { - TextureHandle texHandle = _handles[ii]; + TextureHandle texHandle = _attachment[ii].handle; if (isDepth(TextureFormat::Enum(m_textureRef[texHandle.idx].m_format))) { ++depth; @@ -3205,9 +3207,9 @@ namespace bgfx ; } - BGFX_API_FUNC(FrameBufferHandle createFrameBuffer(uint8_t _num, const TextureHandle* _handles, bool _destroyTextures) ) + BGFX_API_FUNC(FrameBufferHandle createFrameBuffer(uint8_t _num, const Attachment* _attachment, bool _destroyTextures) ) { - BX_CHECK(checkFrameBuffer(_num, _handles) + BX_CHECK(checkFrameBuffer(_num, _attachment) , "Too many frame buffer attachments (num attachments: %d, max color attachments %d)!" , _num , g_caps.maxFBAttachments @@ -3226,26 +3228,26 @@ namespace bgfx FrameBufferRef& ref = m_frameBufferRef[handle.idx]; ref.m_window = false; memset(ref.un.m_th, 0xff, sizeof(ref.un.m_th) ); - BackbufferRatio::Enum bbRatio = BackbufferRatio::Enum(m_textureRef[_handles[0].idx].m_bbRatio); + BackbufferRatio::Enum bbRatio = BackbufferRatio::Enum(m_textureRef[_attachment[0].handle.idx].m_bbRatio); for (uint32_t ii = 0; ii < _num; ++ii) { - TextureHandle texHandle = _handles[ii]; + TextureHandle texHandle = _attachment[ii].handle; BGFX_CHECK_HANDLE("createFrameBuffer texture handle", m_textureHandle, texHandle); BX_CHECK(bbRatio == m_textureRef[texHandle.idx].m_bbRatio, "Mismatch in texture back-buffer ratio."); BX_UNUSED(bbRatio); - cmdbuf.write(texHandle); - ref.un.m_th[ii] = texHandle; textureIncRef(texHandle); } + + cmdbuf.write(_attachment, sizeof(Attachment) * _num); } if (_destroyTextures) { for (uint32_t ii = 0; ii < _num; ++ii) { - textureTakeOwnership(_handles[ii]); + textureTakeOwnership(_attachment[ii].handle); } } diff --git a/3rdparty/bgfx/src/image.cpp b/3rdparty/bgfx/src/image.cpp index 6f8f79775fa..34dcae9e54c 100644 --- a/3rdparty/bgfx/src/image.cpp +++ b/3rdparty/bgfx/src/image.cpp @@ -4,8 +4,6 @@ */ #include "bgfx_p.h" -#include // powf, sqrtf - #include "image.h" namespace bgfx @@ -345,30 +343,30 @@ namespace bgfx const uint8_t* rgba = src; for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 8, dst += 4) { - float rr = powf(rgba[ 0], 2.2f); - float gg = powf(rgba[ 1], 2.2f); - float bb = powf(rgba[ 2], 2.2f); - float aa = rgba[ 3]; - rr += powf(rgba[ 4], 2.2f); - gg += powf(rgba[ 5], 2.2f); - bb += powf(rgba[ 6], 2.2f); - aa += rgba[ 7]; - rr += powf(rgba[_pitch+0], 2.2f); - gg += powf(rgba[_pitch+1], 2.2f); - bb += powf(rgba[_pitch+2], 2.2f); - aa += rgba[_pitch+3]; - rr += powf(rgba[_pitch+4], 2.2f); - gg += powf(rgba[_pitch+5], 2.2f); - bb += powf(rgba[_pitch+6], 2.2f); - aa += rgba[_pitch+7]; + float rr = bx::fpow(rgba[ 0], 2.2f); + float gg = bx::fpow(rgba[ 1], 2.2f); + float bb = bx::fpow(rgba[ 2], 2.2f); + float aa = rgba[ 3]; + rr += bx::fpow(rgba[ 4], 2.2f); + gg += bx::fpow(rgba[ 5], 2.2f); + bb += bx::fpow(rgba[ 6], 2.2f); + aa += rgba[ 7]; + rr += bx::fpow(rgba[_pitch+0], 2.2f); + gg += bx::fpow(rgba[_pitch+1], 2.2f); + bb += bx::fpow(rgba[_pitch+2], 2.2f); + aa += rgba[_pitch+3]; + rr += bx::fpow(rgba[_pitch+4], 2.2f); + gg += bx::fpow(rgba[_pitch+5], 2.2f); + bb += bx::fpow(rgba[_pitch+6], 2.2f); + aa += rgba[_pitch+7]; rr *= 0.25f; gg *= 0.25f; bb *= 0.25f; aa *= 0.25f; - rr = powf(rr, 1.0f/2.2f); - gg = powf(gg, 1.0f/2.2f); - bb = powf(bb, 1.0f/2.2f); + rr = bx::fpow(rr, 1.0f/2.2f); + gg = bx::fpow(gg, 1.0f/2.2f); + bb = bx::fpow(bb, 1.0f/2.2f); dst[0] = (uint8_t)rr; dst[1] = (uint8_t)gg; dst[2] = (uint8_t)bb; @@ -3176,7 +3174,7 @@ namespace bgfx { float nx = temp[ii*4+2]*2.0f/255.0f - 1.0f; float ny = temp[ii*4+1]*2.0f/255.0f - 1.0f; - float nz = sqrtf(1.0f - nx*nx - ny*ny); + float nz = bx::fsqrt(1.0f - nx*nx - ny*ny); temp[ii*4+0] = uint8_t( (nz + 1.0f)*255.0f/2.0f); temp[ii*4+3] = 0; } @@ -3323,10 +3321,10 @@ namespace bgfx const uint8_t* rgba = src; for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 4, dst += 4) { - dst[0] = powf(rgba[ 0], 2.2f); - dst[1] = powf(rgba[ 1], 2.2f); - dst[2] = powf(rgba[ 2], 2.2f); - dst[3] = rgba[ 3]; + dst[0] = bx::fpow(rgba[0], 2.2f); + dst[1] = bx::fpow(rgba[1], 2.2f); + dst[2] = bx::fpow(rgba[2], 2.2f); + dst[3] = rgba[3]; } } } @@ -3395,7 +3393,7 @@ namespace bgfx { float nx = temp[ii*4+2]*2.0f/255.0f - 1.0f; float ny = temp[ii*4+1]*2.0f/255.0f - 1.0f; - float nz = sqrtf(1.0f - nx*nx - ny*ny); + float nz = bx::fsqrt(1.0f - nx*nx - ny*ny); const uint32_t offset = (yy*4 + ii/4)*_width*16 + (xx*4 + ii%4)*16; float* block = (float*)&dst[offset]; diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp index 5bacc5561d4..4446d6b0324 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.cpp +++ b/3rdparty/bgfx/src/renderer_d3d11.cpp @@ -1778,9 +1778,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_textures[_handle.idx].destroy(); } - void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE { - m_frameBuffers[_handle.idx].create(_num, _textureHandles); + m_frameBuffers[_handle.idx].create(_num, _attachment); } void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE @@ -4252,7 +4252,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); return handle; } - void FrameBufferD3D11::create(uint8_t _num, const TextureHandle* _handles) + void FrameBufferD3D11::create(uint8_t _num, const Attachment* _attachment) { for (uint32_t ii = 0; ii < BX_COUNTOF(m_rtv); ++ii) { @@ -4262,7 +4262,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_swapChain = NULL; m_numTh = _num; - memcpy(m_th, _handles, _num*sizeof(TextureHandle) ); + memcpy(m_attachment, _attachment, _num*sizeof(Attachment) ); postReset(); } @@ -4355,7 +4355,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_num = 0; for (uint32_t ii = 0; ii < m_numTh; ++ii) { - TextureHandle handle = m_th[ii]; + TextureHandle handle = m_attachment[ii].handle; if (isValid(handle) ) { const TextureD3D11& texture = s_renderD3D11->m_textures[handle.idx]; @@ -4404,7 +4404,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); : D3D11_DSV_DIMENSION_TEXTURE2D ; dsvDesc.Flags = 0; - dsvDesc.Texture2D.MipSlice = 0; + dsvDesc.Texture2D.MipSlice = m_attachment[ii].mip; DX_CHECK(s_renderD3D11->m_device->CreateDepthStencilView(texture.m_ptr, &dsvDesc, &m_dsv) ); } break; @@ -4417,14 +4417,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY; dsvDesc.Texture2DMSArray.ArraySize = 1; - dsvDesc.Texture2DMSArray.FirstArraySlice = 0; + dsvDesc.Texture2DMSArray.FirstArraySlice = m_attachment[ii].layer; } else { dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY; dsvDesc.Texture2DArray.ArraySize = 1; - dsvDesc.Texture2DArray.FirstArraySlice = 0; - dsvDesc.Texture2DArray.MipSlice = 0; + dsvDesc.Texture2DArray.FirstArraySlice = m_attachment[ii].layer; + dsvDesc.Texture2DArray.MipSlice = m_attachment[ii].mip; } dsvDesc.Flags = 0; DX_CHECK(s_renderD3D11->m_device->CreateDepthStencilView(texture.m_ptr, &dsvDesc, &m_dsv) ); @@ -4438,7 +4438,20 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { default: case TextureD3D11::Texture2D: - DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, NULL, &m_rtv[m_num]) ); + { + D3D11_RENDER_TARGET_VIEW_DESC desc; + desc.Format = s_textureFormat[texture.m_textureFormat].m_fmt; + if (1 < msaa.Count) + { + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS; + } + else + { + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + desc.Texture2D.MipSlice = m_attachment[ii].mip; + } + DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) ); + } break; case TextureD3D11::TextureCube: @@ -4449,14 +4462,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY; desc.Texture2DMSArray.ArraySize = 1; - desc.Texture2DMSArray.FirstArraySlice = 0; + desc.Texture2DMSArray.FirstArraySlice = m_attachment[ii].layer; } else { desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; desc.Texture2DArray.ArraySize = 1; - desc.Texture2DArray.FirstArraySlice = 0; - desc.Texture2DArray.MipSlice = 0; + desc.Texture2DArray.FirstArraySlice = m_attachment[ii].layer; + desc.Texture2DArray.MipSlice = m_attachment[ii].mip; } DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) ); } @@ -4467,9 +4480,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); D3D11_RENDER_TARGET_VIEW_DESC desc; desc.Format = s_textureFormat[texture.m_textureFormat].m_fmt; desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D; - desc.Texture3D.MipSlice = 0; + desc.Texture3D.MipSlice = m_attachment[ii].mip; desc.Texture3D.WSize = 1; - desc.Texture3D.FirstWSlice = 0; + desc.Texture3D.FirstWSlice = m_attachment[ii].layer; DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) ); } break; diff --git a/3rdparty/bgfx/src/renderer_d3d11.h b/3rdparty/bgfx/src/renderer_d3d11.h index 151d3ce5cc7..833eda40e1a 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.h +++ b/3rdparty/bgfx/src/renderer_d3d11.h @@ -261,7 +261,7 @@ namespace bgfx { namespace d3d11 { } - void create(uint8_t _num, const TextureHandle* _handles); + void create(uint8_t _num, const Attachment* _attachment); void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat); uint16_t destroy(); void preReset(bool _force = false); @@ -278,7 +278,7 @@ namespace bgfx { namespace d3d11 uint16_t m_denseIdx; uint8_t m_num; uint8_t m_numTh; - TextureHandle m_th[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; + Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; }; struct TimerQueryD3D11 diff --git a/3rdparty/bgfx/src/renderer_d3d12.cpp b/3rdparty/bgfx/src/renderer_d3d12.cpp index 76eb52e0e21..409d33bce10 100644 --- a/3rdparty/bgfx/src/renderer_d3d12.cpp +++ b/3rdparty/bgfx/src/renderer_d3d12.cpp @@ -1388,9 +1388,9 @@ namespace bgfx { namespace d3d12 m_textures[_handle.idx].destroy(); } - void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE { - m_frameBuffers[_handle.idx].create(_num, _textureHandles); + m_frameBuffers[_handle.idx].create(_num, _attachment); } void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE @@ -4184,10 +4184,10 @@ data.NumQualityLevels = 0; return _state; } - void FrameBufferD3D12::create(uint8_t _num, const TextureHandle* _handles) + void FrameBufferD3D12::create(uint8_t _num, const Attachment* _attachment) { m_numTh = _num; - memcpy(m_th, _handles, _num*sizeof(TextureHandle) ); + memcpy(m_attachment, _attachment, _num*sizeof(Attachment) ); postReset(); } @@ -4217,7 +4217,7 @@ data.NumQualityLevels = 0; m_num = 0; for (uint32_t ii = 0; ii < m_numTh; ++ii) { - TextureHandle handle = m_th[ii]; + TextureHandle handle = m_attachment[ii].handle; if (isValid(handle) ) { const TextureD3D12& texture = s_renderD3D12->m_textures[handle.idx]; diff --git a/3rdparty/bgfx/src/renderer_d3d12.h b/3rdparty/bgfx/src/renderer_d3d12.h index d046b275142..39f165a03da 100644 --- a/3rdparty/bgfx/src/renderer_d3d12.h +++ b/3rdparty/bgfx/src/renderer_d3d12.h @@ -295,7 +295,7 @@ namespace bgfx { namespace d3d12 m_depth.idx = bgfx::invalidHandle; } - void create(uint8_t _num, const TextureHandle* _handles); + void create(uint8_t _num, const Attachment* _attachment); void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat); uint16_t destroy(); void preReset(); @@ -311,7 +311,7 @@ namespace bgfx { namespace d3d12 uint16_t m_denseIdx; uint8_t m_num; uint8_t m_numTh; - TextureHandle m_th[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; + Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; }; struct CommandQueueD3D12 diff --git a/3rdparty/bgfx/src/renderer_d3d9.cpp b/3rdparty/bgfx/src/renderer_d3d9.cpp index 4fb4d435b4a..919a952260b 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.cpp +++ b/3rdparty/bgfx/src/renderer_d3d9.cpp @@ -1018,9 +1018,9 @@ namespace bgfx { namespace d3d9 m_textures[_handle.idx].destroy(); } - void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE { - m_frameBuffers[_handle.idx].create(_num, _textureHandles); + m_frameBuffers[_handle.idx].create(_num, _attachment); } void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE @@ -3062,7 +3062,7 @@ namespace bgfx { namespace d3d9 } } - void FrameBufferD3D9::create(uint8_t _num, const TextureHandle* _handles) + void FrameBufferD3D9::create(uint8_t _num, const Attachment* _attachment) { for (uint32_t ii = 0; ii < BX_COUNTOF(m_color); ++ii) { @@ -3074,7 +3074,7 @@ namespace bgfx { namespace d3d9 m_needResolve = false; for (uint32_t ii = 0; ii < _num; ++ii) { - TextureHandle handle = _handles[ii]; + TextureHandle handle = _attachment[ii].handle; if (isValid(handle) ) { const TextureD3D9& texture = s_renderD3D9->m_textures[handle.idx]; @@ -3102,7 +3102,7 @@ namespace bgfx { namespace d3d9 } else { - m_color[m_num] = texture.getSurface(); + m_color[m_num] = texture.getSurface(uint8_t(_attachment[ii].layer) ); } m_num++; } diff --git a/3rdparty/bgfx/src/renderer_d3d9.h b/3rdparty/bgfx/src/renderer_d3d9.h index aecfba57322..0b0e030dc5c 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.h +++ b/3rdparty/bgfx/src/renderer_d3d9.h @@ -389,7 +389,7 @@ namespace bgfx { namespace d3d9 m_depthHandle.idx = invalidHandle; } - void create(uint8_t _num, const TextureHandle* _handles); + void create(uint8_t _num, const Attachment* _attachment); void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat); uint16_t destroy(); HRESULT present(); diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp index ff6184ccc98..0feccaf9680 100644 --- a/3rdparty/bgfx/src/renderer_gl.cpp +++ b/3rdparty/bgfx/src/renderer_gl.cpp @@ -2243,9 +2243,9 @@ namespace bgfx { namespace gl m_textures[_handle.idx].destroy(); } - void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE { - m_frameBuffers[_handle.idx].create(_num, _textureHandles); + m_frameBuffers[_handle.idx].create(_num, _attachment); } void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE @@ -5017,12 +5017,12 @@ namespace bgfx { namespace gl BX_UNUSED(complete); } - void FrameBufferGL::create(uint8_t _num, const TextureHandle* _handles) + void FrameBufferGL::create(uint8_t _num, const Attachment* _attachment) { GL_CHECK(glGenFramebuffers(1, &m_fbo[0]) ); m_numTh = _num; - memcpy(m_th, _handles, _num*sizeof(TextureHandle) ); + memcpy(m_attachment, _attachment, _num*sizeof(Attachment) ); postReset(); } @@ -5040,15 +5040,15 @@ namespace bgfx { namespace gl uint32_t colorIdx = 0; for (uint32_t ii = 0; ii < m_numTh; ++ii) { - TextureHandle handle = m_th[ii]; + TextureHandle handle = m_attachment[ii].handle; if (isValid(handle) ) { const TextureGL& texture = s_renderGL->m_textures[handle.idx]; if (0 == colorIdx) { - m_width = texture.m_width; - m_height = texture.m_height; + m_width = bx::uint32_max(texture.m_width >> m_attachment[ii].mip, 1); + m_height = bx::uint32_max(texture.m_height >> m_attachment[ii].mip, 1); } GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx; @@ -5086,7 +5086,7 @@ namespace bgfx { namespace gl else { GLenum target = GL_TEXTURE_CUBE_MAP == texture.m_target - ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + m_attachment[ii].layer : texture.m_target ; @@ -5094,7 +5094,7 @@ namespace bgfx { namespace gl , attachment , target , texture.m_id - , 0 + , m_attachment[ii].mip ) ); } @@ -5134,7 +5134,7 @@ namespace bgfx { namespace gl colorIdx = 0; for (uint32_t ii = 0; ii < m_numTh; ++ii) { - TextureHandle handle = m_th[ii]; + TextureHandle handle = m_attachment[ii].handle; if (isValid(handle) ) { const TextureGL& texture = s_renderGL->m_textures[handle.idx]; @@ -5145,11 +5145,17 @@ namespace bgfx { namespace gl if (!isDepth( (TextureFormat::Enum)texture.m_textureFormat) ) { ++colorIdx; + + GLenum target = GL_TEXTURE_CUBE_MAP == texture.m_target + ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + m_attachment[ii].layer + : texture.m_target + ; + GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER , attachment - , texture.m_target + , target , texture.m_id - , 0 + , m_attachment[ii].mip ) ); } } diff --git a/3rdparty/bgfx/src/renderer_gl.h b/3rdparty/bgfx/src/renderer_gl.h index 06b1525fd64..91c49c22f02 100644 --- a/3rdparty/bgfx/src/renderer_gl.h +++ b/3rdparty/bgfx/src/renderer_gl.h @@ -13,6 +13,7 @@ || BX_PLATFORM_BSD \ || BX_PLATFORM_QNX \ || BX_PLATFORM_RPI \ + || BX_PLATFORM_STEAMLINK \ || BX_PLATFORM_WINDOWS \ ) ) @@ -1169,7 +1170,7 @@ namespace bgfx { namespace gl memset(m_fbo, 0, sizeof(m_fbo) ); } - void create(uint8_t _num, const TextureHandle* _handles); + void create(uint8_t _num, const Attachment* _attachment); void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat); void postReset(); uint16_t destroy(); @@ -1183,7 +1184,7 @@ namespace bgfx { namespace gl uint16_t m_denseIdx; uint8_t m_num; uint8_t m_numTh; - TextureHandle m_th[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; + Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; }; struct ProgramGL diff --git a/3rdparty/bgfx/src/renderer_mtl.h b/3rdparty/bgfx/src/renderer_mtl.h index 2b683cff891..f471ee5d457 100644 --- a/3rdparty/bgfx/src/renderer_mtl.h +++ b/3rdparty/bgfx/src/renderer_mtl.h @@ -694,7 +694,7 @@ namespace bgfx { namespace mtl m_depthHandle.idx = invalidHandle; } - void create(uint8_t _num, const TextureHandle* _handles); + void create(uint8_t _num, const Attachment* _attachment); void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat); void postReset(); uint16_t destroy(); diff --git a/3rdparty/bgfx/src/renderer_mtl.mm b/3rdparty/bgfx/src/renderer_mtl.mm index 833a53bea0d..08faee495f7 100644 --- a/3rdparty/bgfx/src/renderer_mtl.mm +++ b/3rdparty/bgfx/src/renderer_mtl.mm @@ -694,9 +694,9 @@ namespace bgfx { namespace mtl m_textures[_handle.idx].destroy(); } - void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE { - m_frameBuffers[_handle.idx].create(_num, _textureHandles); + m_frameBuffers[_handle.idx].create(_num, _attachment); } void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE @@ -2079,12 +2079,12 @@ namespace bgfx { namespace mtl : m_sampler, _stage); } - void FrameBufferMtl::create(uint8_t _num, const TextureHandle* _handles) + void FrameBufferMtl::create(uint8_t _num, const Attachment* _attachment) { m_num = 0; for (uint32_t ii = 0; ii < _num; ++ii) { - TextureHandle handle = _handles[ii]; + TextureHandle handle = _attachment[ii].handle; if (isValid(handle) ) { const TextureMtl& texture = s_renderMtl->m_textures[handle.idx]; diff --git a/3rdparty/bgfx/src/renderer_null.cpp b/3rdparty/bgfx/src/renderer_null.cpp index a68e66f0d68..9b3de91416b 100644 --- a/3rdparty/bgfx/src/renderer_null.cpp +++ b/3rdparty/bgfx/src/renderer_null.cpp @@ -134,7 +134,7 @@ namespace bgfx { namespace noop { } - void createFrameBuffer(FrameBufferHandle /*_handle*/, uint8_t /*_num*/, const TextureHandle* /*_textureHandles*/) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle /*_handle*/, uint8_t /*_num*/, const Attachment* /*_attachment*/) BX_OVERRIDE { } diff --git a/3rdparty/bgfx/tools/geometryc/geometryc.cpp b/3rdparty/bgfx/tools/geometryc/geometryc.cpp index b5fc62affe2..7687f3c5e38 100644 --- a/3rdparty/bgfx/tools/geometryc/geometryc.cpp +++ b/3rdparty/bgfx/tools/geometryc/geometryc.cpp @@ -811,7 +811,7 @@ int main(int _argc, const char* _argv[]) PrimitiveArray primitives; bx::CrtFileWriter writer; - if (bx::open(&writer, outFilePath) ) + if (!bx::open(&writer, outFilePath) ) { printf("Unable to open output file '%s'.", outFilePath); exit(EXIT_FAILURE); diff --git a/3rdparty/bx/include/bx/fpumath.h b/3rdparty/bx/include/bx/fpumath.h index b76da2f9a31..be125aa69eb 100644 --- a/3rdparty/bx/include/bx/fpumath.h +++ b/3rdparty/bx/include/bx/fpumath.h @@ -149,6 +149,11 @@ namespace bx return _a - floorf(_a); } + inline float fmod(float _a, float _b) + { + return fmodf(_a, _b); + } + inline bool fequal(float _a, float _b, float _epsilon) { // http://realtimecollisiondetection.net/blog/?p=89 @@ -169,7 +174,7 @@ namespace bx inline float fwrap(float _a, float _wrap) { - const float mod = fmodf(_a, _wrap); + const float mod = fmod(_a, _wrap); const float result = mod < 0.0f ? _wrap + mod : mod; return result; } @@ -422,8 +427,8 @@ namespace bx inline void quatRotateAxis(float* __restrict _result, const float* _axis, float _angle) { const float ha = _angle * 0.5f; - const float ca = cosf(ha); - const float sa = sinf(ha); + const float ca = fcos(ha); + const float sa = fsin(ha); _result[0] = _axis[0] * sa; _result[1] = _axis[1] * sa; _result[2] = _axis[2] * sa; @@ -433,8 +438,8 @@ namespace bx inline void quatRotateX(float* _result, float _ax) { const float hx = _ax * 0.5f; - const float cx = cosf(hx); - const float sx = sinf(hx); + const float cx = fcos(hx); + const float sx = fsin(hx); _result[0] = sx; _result[1] = 0.0f; _result[2] = 0.0f; @@ -444,8 +449,8 @@ namespace bx inline void quatRotateY(float* _result, float _ay) { const float hy = _ay * 0.5f; - const float cy = cosf(hy); - const float sy = sinf(hy); + const float cy = fcos(hy); + const float sy = fsin(hy); _result[0] = 0.0f; _result[1] = sy; _result[2] = 0.0f; @@ -455,8 +460,8 @@ namespace bx inline void quatRotateZ(float* _result, float _az) { const float hz = _az * 0.5f; - const float cz = cosf(hz); - const float sz = sinf(hz); + const float cz = fcos(hz); + const float sz = fsin(hz); _result[0] = 0.0f; _result[1] = 0.0f; _result[2] = sz; @@ -736,8 +741,8 @@ namespace bx inline void mtxRotateX(float* _result, float _ax) { - const float sx = sinf(_ax); - const float cx = cosf(_ax); + const float sx = fsin(_ax); + const float cx = fcos(_ax); memset(_result, 0, sizeof(float)*16); _result[ 0] = 1.0f; @@ -750,8 +755,8 @@ namespace bx inline void mtxRotateY(float* _result, float _ay) { - const float sy = sinf(_ay); - const float cy = cosf(_ay); + const float sy = fsin(_ay); + const float cy = fcos(_ay); memset(_result, 0, sizeof(float)*16); _result[ 0] = cy; @@ -764,8 +769,8 @@ namespace bx inline void mtxRotateZ(float* _result, float _az) { - const float sz = sinf(_az); - const float cz = cosf(_az); + const float sz = fsin(_az); + const float cz = fcos(_az); memset(_result, 0, sizeof(float)*16); _result[ 0] = cz; @@ -778,10 +783,10 @@ namespace bx inline void mtxRotateXY(float* _result, float _ax, float _ay) { - const float sx = sinf(_ax); - const float cx = cosf(_ax); - const float sy = sinf(_ay); - const float cy = cosf(_ay); + const float sx = fsin(_ax); + const float cx = fcos(_ax); + const float sy = fsin(_ay); + const float cy = fcos(_ay); memset(_result, 0, sizeof(float)*16); _result[ 0] = cy; @@ -797,12 +802,12 @@ namespace bx inline void mtxRotateXYZ(float* _result, float _ax, float _ay, float _az) { - const float sx = sinf(_ax); - const float cx = cosf(_ax); - const float sy = sinf(_ay); - const float cy = cosf(_ay); - const float sz = sinf(_az); - const float cz = cosf(_az); + const float sx = fsin(_ax); + const float cx = fcos(_ax); + const float sy = fsin(_ay); + const float cy = fcos(_ay); + const float sz = fsin(_az); + const float cz = fcos(_az); memset(_result, 0, sizeof(float)*16); _result[ 0] = cy*cz; @@ -819,12 +824,12 @@ namespace bx inline void mtxRotateZYX(float* _result, float _ax, float _ay, float _az) { - const float sx = sinf(_ax); - const float cx = cosf(_ax); - const float sy = sinf(_ay); - const float cy = cosf(_ay); - const float sz = sinf(_az); - const float cz = cosf(_az); + const float sx = fsin(_ax); + const float cx = fcos(_ax); + const float sy = fsin(_ay); + const float cy = fcos(_ay); + const float sz = fsin(_az); + const float cz = fcos(_az); memset(_result, 0, sizeof(float)*16); _result[ 0] = cy*cz; @@ -841,12 +846,12 @@ namespace bx inline void mtxSRT(float* _result, float _sx, float _sy, float _sz, float _ax, float _ay, float _az, float _tx, float _ty, float _tz) { - const float sx = sinf(_ax); - const float cx = cosf(_ax); - const float sy = sinf(_ay); - const float cy = cosf(_ay); - const float sz = sinf(_az); - const float cz = cosf(_az); + const float sx = fsin(_ax); + const float cx = fcos(_ax); + const float sy = fsin(_ay); + const float cy = fcos(_ay); + const float sz = fsin(_az); + const float cz = fcos(_az); const float sxsz = sx*sz; const float cycz = cy*cz; diff --git a/3rdparty/bx/include/bx/hash.h b/3rdparty/bx/include/bx/hash.h index de3f21c4c0e..4250115622f 100644 --- a/3rdparty/bx/include/bx/hash.h +++ b/3rdparty/bx/include/bx/hash.h @@ -103,7 +103,7 @@ namespace bx static void readUnaligned(const void* _data, uint32_t& _out) { const uint8_t* data = (const uint8_t*)_data; - if (BX_ENABLED(BX_CPU_ENDIAN_LITTLE) ) + if (BX_ENABLED(BX_CPU_ENDIAN_BIG) ) { _out = 0 | data[0]<<24 diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua index ad3a3e647e1..fc674de9570 100644 --- a/3rdparty/bx/scripts/toolchain.lua +++ b/3rdparty/bx/scripts/toolchain.lua @@ -1126,7 +1126,13 @@ function strip() "$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\"" } - configuration { "linux-* or rpi", "Release" } + configuration { "linux-steamlink", "Release" } + postbuildcommands { + "$(SILENT) echo Stripping symbols.", + "$(SILENT) $(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-strip -s \"$(TARGET)\"" + } + + configuration { "linux-* or rpi", "not linux-steamlink", "Release" } postbuildcommands { "$(SILENT) echo Stripping symbols.", "$(SILENT) strip -s \"$(TARGET)\"" diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie index f79dbd8456f..a7c61b7300e 100644 Binary files a/3rdparty/bx/tools/bin/darwin/genie and b/3rdparty/bx/tools/bin/darwin/genie differ diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie index c3a323a0b1e..223ef23852e 100644 Binary files a/3rdparty/bx/tools/bin/linux/genie and b/3rdparty/bx/tools/bin/linux/genie differ diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe index 7e62285f703..59575ce272e 100644 Binary files a/3rdparty/bx/tools/bin/windows/genie.exe and b/3rdparty/bx/tools/bin/windows/genie.exe differ -- cgit v1.2.3-70-g09d2 From 22e6c350edc9d947fe1f51e7b9cd362505bf0432 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 16 Feb 2016 11:36:13 +0100 Subject: Enabled BGFX support for SteamLink --- makefile | 2 +- scripts/genie.lua | 5 ++++- scripts/src/3rdparty.lua | 6 +++++- scripts/src/osd/sdl.lua | 1 - src/osd/modules/render/drawbgfx.cpp | 2 ++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index a70d6a6db12..9ead341d669 100644 --- a/makefile +++ b/makefile @@ -1200,7 +1200,7 @@ endif ifndef MARVELL_ROOTFS $(error MARVELL_ROOTFS is not set) endif - $(SILENT) $(GENIE) $(PARAMS) --gcc=steamlink --gcc_version=$(GCC_VERSION) --USE_BGFX=0 --NO_OPENGL=1 --NO_USE_MIDI=1 --NO_X11=1 --NOASM=1 --SDL_INSTALL_ROOT=$(MARVELL_ROOTFS)/usr gmake + $(SILENT) $(GENIE) $(PARAMS) --gcc=steamlink --gcc_version=$(GCC_VERSION) --NO_OPENGL=1 --NO_USE_MIDI=1 --NO_X11=1 --NOASM=1 --SDL_INSTALL_ROOT=$(MARVELL_ROOTFS)/usr gmake .PHONY: steamlink ifndef MARVELL_SDK_PATH diff --git a/scripts/genie.lua b/scripts/genie.lua index dd955bd0ce9..70901cf038f 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1073,7 +1073,10 @@ configuration { "linux-*" } configuration { "steamlink" } links { "dl", - } + "EGL", + "GLESv2", + "SDL2", + } defines { "EGL_API_FB", } diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 34376515c64..9f44143da1d 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -730,10 +730,14 @@ end MAME_DIR .. "3rdparty/bgfx/include", MAME_DIR .. "3rdparty/bgfx/3rdparty", MAME_DIR .. "3rdparty/bx/include", - MAME_DIR .. "3rdparty/bgfx/3rdparty/khronos", MAME_DIR .. "3rdparty/bgfx/3rdparty/dxsdk/include", } + configuration { "not steamlink"} + includedirs { + MAME_DIR .. "3rdparty/bgfx/3rdparty/khronos", + } + configuration { "vs*" } includedirs { MAME_DIR .. "3rdparty/bx/include/compat/msvc", diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 591b75d0b29..ae4a752860c 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -287,7 +287,6 @@ if BASE_TARGETOS=="unix" then else if _OPTIONS["NO_X11"]=="1" then _OPTIONS["USE_QTDEBUG"] = "0" - USE_BGFX = 0 else libdirs { "/usr/X11/lib", diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 4e7c7f15e43..30eb5676e61 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -120,6 +120,8 @@ static void* sdlNativeWindowHandle(SDL_Window* _window) return wmi.info.cocoa.window; # elif BX_PLATFORM_WINDOWS return wmi.info.win.window; +# elif BX_PLATFORM_STEAMLINK + return wmi.info.vivante.window; # endif // BX_PLATFORM_ } #endif -- cgit v1.2.3-70-g09d2 From 40e0a1bcb7bc87d1944b6eecde7c7ccfde2b4efe Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 16 Feb 2016 16:35:03 +0100 Subject: Remove SDL 1.2 support (nw) --- scripts/src/osd/sdl.lua | 100 ++------- scripts/src/osd/sdl_cfg.lua | 16 +- scripts/src/osd/windows_cfg.lua | 2 +- src/osd/modules/font/font_sdl.cpp | 4 - src/osd/modules/opengl/osd_opengl.h | 14 -- src/osd/modules/osdwindow.h | 4 - src/osd/modules/render/draw13.cpp | 36 --- src/osd/modules/render/drawbgfx.cpp | 4 - src/osd/modules/render/drawogl.cpp | 66 +----- src/osd/modules/render/drawsdl.cpp | 235 +------------------- src/osd/modules/sound/direct_sound.cpp | 9 - src/osd/modules/sound/sdl_sound.cpp | 4 - src/osd/modules/sync/sync_sdl.cpp | 4 - src/osd/sdl/SDLMain_tmpl.h | 13 -- src/osd/sdl/SDLMain_tmpl.mm | 386 --------------------------------- src/osd/sdl/input.cpp | 227 ------------------- src/osd/sdl/osdsdl.h | 8 - src/osd/sdl/sdlinc.h | 9 - src/osd/sdl/sdlmain.cpp | 60 +---- src/osd/sdl/sdlos_unix.cpp | 106 --------- src/osd/sdl/testkeys.cpp | 72 ------ src/osd/sdl/video.cpp | 201 +---------------- src/osd/sdl/video.h | 11 - src/osd/sdl/window.cpp | 190 +--------------- src/osd/sdl/window.h | 22 -- 25 files changed, 32 insertions(+), 1771 deletions(-) delete mode 100644 src/osd/sdl/SDLMain_tmpl.h delete mode 100644 src/osd/sdl/SDLMain_tmpl.mm diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index ae4a752860c..3d1a3663614 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -39,15 +39,9 @@ function maintargetosdoptions(_target,_subtarget) end if BASE_TARGETOS=="unix" and _OPTIONS["targetos"]~="macosx" then - if _OPTIONS["SDL_LIBVER"]=="sdl2" then - links { - "SDL2_ttf", - } - else - links { - "SDL_ttf", - } - end + links { + "SDL2_ttf", + } local str = backtick("pkg-config --libs fontconfig") addlibfromstring(str) addoptionsfromstring(str) @@ -55,15 +49,9 @@ function maintargetosdoptions(_target,_subtarget) if _OPTIONS["targetos"]=="windows" then if _OPTIONS["USE_LIBSDL"]~="1" then - if _OPTIONS["SDL_LIBVER"]=="sdl2" then - links { - "SDL2.dll", - } - else - links { - "SDL.dll", - } - end + links { + "SDL2.dll", + } else local str = backtick(sdlconfigcmd() .. " --libs | sed 's/ -lSDLmain//'") addlibfromstring(str) @@ -111,9 +99,9 @@ end function sdlconfigcmd() if not _OPTIONS["SDL_INSTALL_ROOT"] then - return _OPTIONS['TOOLCHAIN'] .. "pkg-config " .. _OPTIONS["SDL_LIBVER"] + return _OPTIONS['TOOLCHAIN'] .. "pkg-config sdl2" else - return path.join(_OPTIONS["SDL_INSTALL_ROOT"],"bin",_OPTIONS["SDL_LIBVER"]) .. "-config" + return path.join(_OPTIONS["SDL_INSTALL_ROOT"],"bin","sdl2") .. "-config" end end @@ -158,23 +146,6 @@ if not _OPTIONS["NO_USE_XINPUT"] then _OPTIONS["NO_USE_XINPUT"] = "1" end -newoption { - trigger = "SDL_LIBVER", - description = "Choose SDL version", - allowed = { - { "sdl", "SDL" }, - { "sdl2", "SDL 2" }, - }, -} - -if not _OPTIONS["SDL_LIBVER"] then - if _OPTIONS["targetos"]=="os2" then - _OPTIONS["SDL_LIBVER"] = "sdl" - else - _OPTIONS["SDL_LIBVER"] = "sdl2" - end -end - newoption { trigger = "SDL2_MULTIAPI", description = "Use couriersud's multi-keyboard patch for SDL 2.1? (this API was removed prior to the 2.0 release)", @@ -246,10 +217,6 @@ elseif _OPTIONS["targetos"]=="os2" then SYNC_IMPLEMENTATION = "os2" end -if _OPTIONS["SDL_LIBVER"]=="sdl" then - USE_BGFX = 0 -end - if BASE_TARGETOS=="unix" then if _OPTIONS["targetos"]=="macosx" then local os_version = str_to_version(backtick("sw_vers -productVersion")) @@ -270,15 +237,9 @@ if BASE_TARGETOS=="unix" then linkoptions { "-F" .. _OPTIONS["SDL_FRAMEWORK_PATH"], } - if _OPTIONS["SDL_LIBVER"]=="sdl2" then - links { - "SDL2.framework", - } - else - links { - "SDL.framework", - } - end + links { + "SDL2.framework", + } else local str = backtick(sdlconfigcmd() .. " --libs --static | sed 's/-lSDLmain//'") addlibfromstring(str) @@ -293,11 +254,6 @@ if BASE_TARGETOS=="unix" then "/usr/X11R6/lib", "/usr/openwin/lib", } - if _OPTIONS["SDL_LIBVER"]=="sdl" then - links { - "X11", - } - end end local str = backtick(sdlconfigcmd() .. " --libs") addlibfromstring(str) @@ -414,13 +370,6 @@ project ("osd_" .. _OPTIONS["osd"]) MAME_DIR .. "src/osd/modules/debugger/osx/watchpointsview.h", MAME_DIR .. "src/osd/modules/debugger/osx/debugosx.h", } - if _OPTIONS["SDL_LIBVER"]=="sdl" then - -- SDLMain_tmpl isn't necessary for SDL2 - files { - MAME_DIR .. "src/osd/sdl/SDLMain_tmpl.mm", - MAME_DIR .. "src/osd/sdl/SDLMain_tmpl.h", - } - end end files { @@ -441,12 +390,10 @@ project ("osd_" .. _OPTIONS["osd"]) MAME_DIR .. "src/osd/sdl/watchdog.h", MAME_DIR .. "src/osd/modules/render/drawsdl.cpp", } - if _OPTIONS["SDL_LIBVER"]=="sdl2" then - files { - MAME_DIR .. "src/osd/modules/render/draw13.cpp", - MAME_DIR .. "src/osd/modules/render/blit13.h", - } - end + files { + MAME_DIR .. "src/osd/modules/render/draw13.cpp", + MAME_DIR .. "src/osd/modules/render/blit13.h", + } project ("ocore_" .. _OPTIONS["osd"]) @@ -540,15 +487,9 @@ if _OPTIONS["with-tools"] then if _OPTIONS["targetos"] == "windows" then if _OPTIONS["USE_LIBSDL"]~="1" then - if _OPTIONS["SDL_LIBVER"] == "sdl2" then - links { - "SDL2.dll", - } - else - links { - "SDL.dll", - } - end + links { + "SDL2.dll", + } else local str = backtick(sdlconfigcmd() .. " --libs | sed 's/ -lSDLmain//'") addlibfromstring(str) @@ -563,11 +504,6 @@ if _OPTIONS["with-tools"] then files { MAME_DIR .. "src/osd/sdl/main.cpp", } - elseif _OPTIONS["targetos"] == "macosx" and _OPTIONS["SDL_LIBVER"] == "sdl" then - -- SDLMain_tmpl isn't necessary for SDL2 - files { - MAME_DIR .. "src/osd/sdl/SDLMain_tmpl.mm", - } end configuration { "mingw*" or "vs*" } diff --git a/scripts/src/osd/sdl_cfg.lua b/scripts/src/osd/sdl_cfg.lua index 431443ac059..bdeb7274ef1 100644 --- a/scripts/src/osd/sdl_cfg.lua +++ b/scripts/src/osd/sdl_cfg.lua @@ -56,18 +56,12 @@ if _OPTIONS["NO_USE_MIDI"]~="1" and _OPTIONS["targetos"]=="linux" then } end -if _OPTIONS["SDL_LIBVER"]=="sdl2" then - defines { - "SDLMAME_SDL2=1", - } - if _OPTIONS["SDL2_MULTIAPI"]=="1" then - defines { - "SDL2_MULTIAPI", - } - end -else +defines { + "SDLMAME_SDL2=1", +} +if _OPTIONS["SDL2_MULTIAPI"]=="1" then defines { - "SDLMAME_SDL2=0", + "SDL2_MULTIAPI", } end diff --git a/scripts/src/osd/windows_cfg.lua b/scripts/src/osd/windows_cfg.lua index 19ef05c3ce9..3e656017816 100644 --- a/scripts/src/osd/windows_cfg.lua +++ b/scripts/src/osd/windows_cfg.lua @@ -50,7 +50,7 @@ end if _OPTIONS["USE_SDL"]=="1" then defines { - "SDLMAME_SDL2=0", + "SDLMAME_SDL2=1", "USE_XINPUT=0", "USE_SDL=1", "USE_SDL_SOUND", diff --git a/src/osd/modules/font/font_sdl.cpp b/src/osd/modules/font/font_sdl.cpp index 1474bd61ec4..ad5d1699e3b 100644 --- a/src/osd/modules/font/font_sdl.cpp +++ b/src/osd/modules/font/font_sdl.cpp @@ -10,11 +10,7 @@ #if defined(SDLMAME_UNIX) && (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_SOLARIS)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN)) -#if (SDLMAME_SDL2) #include -#else -#include -#endif #ifndef SDLMAME_HAIKU #include #endif diff --git a/src/osd/modules/opengl/osd_opengl.h b/src/osd/modules/opengl/osd_opengl.h index 5e843543f46..a033fcd57f6 100644 --- a/src/osd/modules/opengl/osd_opengl.h +++ b/src/osd/modules/opengl/osd_opengl.h @@ -29,28 +29,14 @@ #endif #endif #else - #if (SDLMAME_SDL2) #include - #else - #include - #endif #if (SDL_VERSION_ATLEAST(1,2,10)) #if defined(SDLMAME_WIN32) // Avoid that winnt.h (included via sdl_opengl.h, windows.h, windef.h includes intrin.h #define __INTRIN_H_ #endif - #if (SDLMAME_SDL2) #include - #else - #include - #endif - #else - /* - * SDL 1.2.9 does not provide everything we need - * We therefore distribute it ourselves - */ - #include "SDL1211_opengl.h" #endif #endif diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h index 3145a784c42..d4c2a4101cc 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -57,11 +57,7 @@ public: #ifdef OSD_SDL virtual osd_dim blit_surface_size() = 0; virtual osd_monitor_info *monitor() const = 0; -#if (SDLMAME_SDL2) virtual SDL_Window *sdl_window() = 0; -#else - virtual SDL_Surface *sdl_surface() = 0; -#endif #else virtual osd_monitor_info *monitor() const = 0; virtual bool win_has_menu() = 0; diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp index f357d567e71..320cc9f3a62 100644 --- a/src/osd/modules/render/draw13.cpp +++ b/src/osd/modules/render/draw13.cpp @@ -203,12 +203,6 @@ private: INT32 m_blittimer; -#if (SDLMAME_SDL2) - //SDL_GLContext m_gl_context_id; -#else - // SDL surface - SDL_Surface *m_sdlsurf; -#endif simple_list m_texlist; // list of active textures @@ -601,32 +595,6 @@ static void drawsdl2_exit(void) //============================================================ // sdl_info::create -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a //============================================================ static void drawsdl_show_info(struct SDL_RendererInfo *render_info) @@ -661,7 +629,6 @@ static void drawsdl_show_info(struct SDL_RendererInfo *render_info) int sdl_info13::create() { -#if (SDLMAME_SDL2) // create renderer /* Enable bilinear filtering in case it is supported. @@ -699,9 +666,6 @@ int sdl_info13::create() SDL_GetRendererInfo(m_sdl_renderer, &render_info); drawsdl_show_info(&render_info); -#else - -#endif return 0; } diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 30eb5676e61..2e16f915f37 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -14,11 +14,7 @@ #define WIN32_LEAN_AND_MEAN #include #if defined(SDLMAME_WIN32) -#if (SDLMAME_SDL2) #include -#else -#include -#endif #endif #else #include "sdlinc.h" diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index 4a2744e4068..728b0810290 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -30,10 +30,6 @@ #include "modules/lib/osdlib.h" #include "modules/lib/osdobj_common.h" -#if defined(OSD_WINDOWS) && !defined(SDLMAME_SDL2) -#define SDLMAME_SDL2 0 -#endif - // OpenGL headers #include "modules/opengl/osd_opengl.h" @@ -344,7 +340,7 @@ private: HMODULE win_gl_context::m_module; -#elif SDLMAME_SDL2 +#else class sdl_gl_context : public osd_gl_context { @@ -395,51 +391,6 @@ private: char m_error[256]; }; -#else -// SDL 1.2 -class sdl12_gl_context : public osd_gl_context -{ -public: - sdl12_gl_context(SDL_Surface *window) : osd_gl_context(), m_window(window) - { - m_error[0] = 0; - } - virtual ~sdl12_gl_context() - { - } - virtual void MakeCurrent() - { - } - - virtual int SetSwapInterval(const int swap) - { - // Not supported on 1.2 - return 0; - } - - virtual const char *LastErrorMsg() - { - if (m_error[0] == 0) - return NULL; - else - return m_error; - } - - virtual void *getProcAddress(const char *proc) - { - return SDL_GL_GetProcAddress(proc); - } - - virtual void SwapBuffer() - { - SDL_GL_SwapBuffers(); - } - -private: - SDL_Surface *m_window; - char m_error[256]; -}; - #endif //============================================================ @@ -766,10 +717,8 @@ int drawogl_init(running_machine &machine, osd_draw_callbacks *callbacks) load_gl_lib(machine); #if defined(OSD_WINDOWS) osd_printf_verbose("Using Windows OpenGL driver\n"); -#elif SDLMAME_SDL2 - osd_printf_verbose("Using SDL multi-window OpenGL driver (SDL 2.0+)\n"); #else - osd_printf_verbose("Using SDL single-window OpenGL driver (SDL 1.2)\n"); + osd_printf_verbose("Using SDL multi-window OpenGL driver (SDL 2.0+)\n"); #endif return 0; @@ -1035,10 +984,8 @@ int sdl_info_ogl::create() // create renderer #if defined(OSD_WINDOWS) m_gl_context = global_alloc(win_gl_context(window().m_hwnd)); -#elif SDLMAME_SDL2 - m_gl_context = global_alloc(sdl_gl_context(window().sdl_window())); #else - m_gl_context = global_alloc(sdl12_gl_context(window().sdl_surface())); + m_gl_context = global_alloc(sdl_gl_context(window().sdl_window())); #endif if (m_gl_context->LastErrorMsg() != NULL) { @@ -1530,11 +1477,9 @@ int sdl_info_ogl::draw(const int update) if (m_init_context) { // do some one-time OpenGL setup -#if SDLMAME_SDL2 // FIXME: SRGB conversion is working on SDL2, may be of use // when we eventually target gamma and monitor profiles. //glEnable(GL_FRAMEBUFFER_SRGB); -#endif glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepth(1.0f); @@ -1560,11 +1505,6 @@ int sdl_info_ogl::draw(const int update) loadGLExtensions(); } -#if !defined(OSD_WINDOWS) && !SDLMAME_SDL2 - // force all textures to be regenerated - destroy_all_textures(); -#endif - m_surf_w = m_width; m_surf_h = m_height; diff --git a/src/osd/modules/render/drawsdl.cpp b/src/osd/modules/render/drawsdl.cpp index 221ac79ef4d..b9a40038082 100644 --- a/src/osd/modules/render/drawsdl.cpp +++ b/src/osd/modules/render/drawsdl.cpp @@ -40,11 +40,9 @@ struct sdl_scale_mode; -#if (SDLMAME_SDL2) #define DRAW2_SCALEMODE_NEAREST "0" #define DRAW2_SCALEMODE_LINEAR "1" #define DRAW2_SCALEMODE_BEST "2" -#endif /* sdl_info is the information about SDL for the current screen */ class sdl_info : public osd_renderer @@ -53,12 +51,8 @@ public: sdl_info(osd_window *w, int extra_flags) : osd_renderer(w, extra_flags), - #if (SDLMAME_SDL2) m_sdl_renderer(NULL), m_texture_id(NULL), - #else - m_yuvsurf(NULL), - #endif m_yuv_lookup(NULL), m_yuv_bitmap(NULL), //m_hw_scale_width(0), @@ -88,24 +82,14 @@ public: private: void destroy_all_textures(); void yuv_init(); -#if (SDLMAME_SDL2) void setup_texture(const osd_dim &size); -#endif void yuv_lookup_set(unsigned int pen, unsigned char red, unsigned char green, unsigned char blue); -#if (!SDLMAME_SDL2) - void yuv_overlay_init(); -#endif - INT32 m_blittimer; -#if (SDLMAME_SDL2) SDL_Renderer *m_sdl_renderer; SDL_Texture *m_texture_id; -#else - SDL_Overlay *m_yuvsurf; -#endif // YUV overlay UINT32 *m_yuv_lookup; @@ -127,11 +111,7 @@ struct sdl_scale_mode int is_yuv; /* Yuv mode? */ int mult_w; /* Width multiplier */ int mult_h; /* Height multiplier */ -#if (!SDLMAME_SDL2) - int m_extra_flags; /* Texture/surface flags */ -#else const char *sdl_scale_mode_hint; /* what to use as a hint ? */ -#endif int pixel_format; /* Pixel/Overlay format */ void (*yuv_blit)(const UINT16 *bitmap, UINT8 *ptr, const int pitch, const UINT32 *lookup, const int width, const int height); }; @@ -160,20 +140,6 @@ static void yuv_RGB_to_YUY2X2(const UINT16 *bitmap, UINT8 *ptr, const int pitch, // Static declarations -#if (!SDLMAME_SDL2) -static int shown_video_info = 0; - -static const sdl_scale_mode scale_modes[] = -{ - { "none", 0, 0, 1, 1, osd_renderer::FLAG_NEEDS_DOUBLEBUF, 0, 0 }, - { "async", 0, 0, 1, 1, osd_renderer::FLAG_NEEDS_DOUBLEBUF | osd_renderer::FLAG_NEEDS_ASYNCBLIT, 0, 0 }, - { "yv12", 1, 1, 1, 1, 0, SDL_YV12_OVERLAY, yuv_RGB_to_YV12 }, - { "yv12x2", 1, 1, 2, 2, 0, SDL_YV12_OVERLAY, yuv_RGB_to_YV12X2 }, - { "yuy2", 1, 1, 1, 1, 0, SDL_YUY2_OVERLAY, yuv_RGB_to_YUY2 }, - { "yuy2x2", 1, 1, 2, 1, 0, SDL_YUY2_OVERLAY, yuv_RGB_to_YUY2X2 }, - { NULL } -}; -#else static const sdl_scale_mode scale_modes[] = { { "none", 0, 0, 1, 1, DRAW2_SCALEMODE_NEAREST, 0, 0 }, @@ -186,7 +152,6 @@ static const sdl_scale_mode scale_modes[] = { "yuy2x2", 1, 1, 2, 1, DRAW2_SCALEMODE_BEST, SDL_PIXELFORMAT_YUY2, yuv_RGB_to_YUY2X2 }, { NULL } }; -#endif //============================================================ // drawsdl_scale_mode @@ -226,12 +191,7 @@ int drawsdl_scale_mode(const char *s) static osd_renderer *drawsdl_create(osd_window *window) { // FIXME: QUALITY HINTS -#if (SDLMAME_SDL2) return global_alloc(sdl_info(window, osd_renderer::FLAG_NONE)); -#else - const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode]; - return global_alloc(sdl_info(window, sm->m_extra_flags)); -#endif } //============================================================ @@ -244,11 +204,7 @@ int drawsdl_init(osd_draw_callbacks *callbacks) callbacks->create = drawsdl_create; callbacks->exit = drawsdl_exit; - if (SDLMAME_SDL2) - osd_printf_verbose("Using SDL multi-window soft driver (SDL 2.0+)\n"); - else - osd_printf_verbose("Using SDL single-window soft driver (SDL 1.2)\n"); - + osd_printf_verbose("Using SDL multi-window soft driver (SDL 2.0+)\n"); return 0; } @@ -264,7 +220,6 @@ static void drawsdl_exit(void) // setup_texture for window //============================================================ -#if (SDLMAME_SDL2) void sdl_info::setup_texture(const osd_dim &size) { const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode]; @@ -311,64 +266,11 @@ void sdl_info::setup_texture(const osd_dim &size) size.width(), size.height()); } } -#endif - -//============================================================ -// yuv_overlay_init -//============================================================ - -#if (!SDLMAME_SDL2) -void sdl_info::yuv_overlay_init() -{ - const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode]; - int minimum_width, minimum_height; - - window().target()->compute_minimum_size(minimum_width, minimum_height); - - if (window().prescale()) - { - minimum_width *= window().prescale(); - minimum_height *= window().prescale(); - } - - if (m_yuvsurf != NULL) - { - SDL_FreeYUVOverlay(m_yuvsurf); - m_yuvsurf = NULL; - } - - if (m_yuv_bitmap != NULL) - { - global_free_array(m_yuv_bitmap); - } - - osd_printf_verbose("SDL: Creating %d x %d YUV-Overlay ...\n", minimum_width, minimum_height); - - m_yuv_bitmap = global_alloc_array(UINT16, minimum_width*minimum_height); - - m_yuvsurf = SDL_CreateYUVOverlay(minimum_width * sdl_sm->mult_w, minimum_height * sdl_sm->mult_h, - sdl_sm->pixel_format, window().sdl_surface()); - - if ( m_yuvsurf == NULL ) { - osd_printf_error("SDL: Couldn't create SDL_yuv_overlay: %s\n", SDL_GetError()); - //return 1; - } - - if (!shown_video_info) - { - osd_printf_verbose("YUV Mode : %s\n", sdl_sm->name); - osd_printf_verbose("YUV Overlay Size : %d x %d\n", minimum_width, minimum_height); - osd_printf_verbose("YUV Acceleration : %s\n", m_yuvsurf->hw_overlay ? "Hardware" : "Software"); - shown_video_info = 1; - } -} -#endif //============================================================ // drawsdl_show_info //============================================================ -#if (SDLMAME_SDL2) static void drawsdl_show_info(struct SDL_RendererInfo *render_info) { #define RF_ENTRY(x) {x, #x } @@ -395,42 +297,14 @@ static void drawsdl_show_info(struct SDL_RendererInfo *render_info) if (render_info->flags & rflist[i].flag) osd_printf_verbose("renderer: flag %s\n", rflist[i].name); } -#endif //============================================================ // sdl_info::create -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a //============================================================ int sdl_info::create() { -#if (SDLMAME_SDL2) const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode]; // create renderer @@ -485,8 +359,6 @@ int sdl_info::create() int w = 0, h = 0; window().get_size(w, h); setup_texture(w, h); -#endif -#else #endif m_yuv_lookup = NULL; @@ -517,9 +389,7 @@ void sdl_info::destroy() global_free_array(m_yuv_bitmap); m_yuv_bitmap = NULL; } -#if (SDLMAME_SDL2) SDL_DestroyRenderer(m_sdl_renderer); -#endif } //============================================================ @@ -543,16 +413,8 @@ int sdl_info::xy_to_render_target(int x, int y, int *xt, int *yt) void sdl_info::destroy_all_textures() { -#if (SDLMAME_SDL2) SDL_DestroyTexture(m_texture_id); m_texture_id = NULL; -#else - if (m_yuvsurf != NULL) - { - SDL_FreeYUVOverlay(m_yuvsurf); - m_yuvsurf = NULL; - } -#endif } @@ -566,9 +428,7 @@ int sdl_info::draw(int update) UINT8 *surfptr; INT32 pitch; Uint32 rmask, gmask, bmask; -#if (SDLMAME_SDL2) Uint32 amask; -#endif INT32 vofs, hofs, blitwidth, blitheight, ch, cw; int bpp; @@ -584,68 +444,14 @@ int sdl_info::draw(int update) clear_flags(FI_CHANGED); m_blittimer = 3; m_last_dim = wdim; -#if (SDLMAME_SDL2) SDL_RenderSetViewport(m_sdl_renderer, NULL); if (m_texture_id != NULL) SDL_DestroyTexture(m_texture_id); setup_texture(m_blit_dim); m_blittimer = 3; -#else - const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode]; - if (sdl_sm->is_yuv) - { - yuv_overlay_init(); - } -#endif } // lock it if we need it -#if (!SDLMAME_SDL2) - - pitch = window().sdl_surface()->pitch; - bpp = window().sdl_surface()->format->BytesPerPixel; - rmask = window().sdl_surface()->format->Rmask; - gmask = window().sdl_surface()->format->Gmask; - bmask = window().sdl_surface()->format->Bmask; -// amask = sdlsurf->format->Amask; -#if 0 - if (window().blitwidth() != m_old_blitwidth || window().blitheight() != m_old_blitheight) - { - if (sm->is_yuv) - yuv_overlay_init(); - m_old_blitwidth = window().blitwidth(); - m_old_blitheight = window().blitheight(); - m_blittimer = 3; - } -#endif - if (SDL_MUSTLOCK(window().sdl_surface())) - SDL_LockSurface(window().sdl_surface()); - - // Clear if necessary - if (m_blittimer > 0) - { - memset(window().sdl_surface()->pixels, 0, wdim.height() * window().sdl_surface()->pitch); - m_blittimer--; - } - - - if (sm->is_yuv) - { - SDL_LockYUVOverlay(m_yuvsurf); - surfptr = m_yuvsurf->pixels[0]; // (UINT8 *) m_yuv_bitmap; - pitch = m_yuvsurf->pitches[0]; // (UINT8 *) m_yuv_bitmap; -#if 0 - printf("abcd %d\n", m_yuvsurf->h); - printf("abcd %d %d %d\n", m_yuvsurf->pitches[0], m_yuvsurf->pitches[1], m_yuvsurf->pitches[2]); - printf("abcd %p %p %p\n", m_yuvsurf->pixels[0], m_yuvsurf->pixels[1], m_yuvsurf->pixels[2]); - printf("abcd %ld %ld\n", m_yuvsurf->pixels[1] - m_yuvsurf->pixels[0], m_yuvsurf->pixels[2] - m_yuvsurf->pixels[1]); -#endif - } - else - surfptr = (UINT8 *)window().sdl_surface()->pixels; -#else - //SDL_SelectRenderer(window().sdl_window); - { Uint32 format; @@ -668,7 +474,6 @@ int sdl_info::draw(int update) SDL_LockTexture(m_texture_id, NULL, (void **) &surfptr, &pitch); -#endif // get ready to center the image vofs = hofs = 0; blitwidth = m_blit_dim.width(); @@ -703,25 +508,11 @@ int sdl_info::draw(int update) int mamewidth, mameheight; -#if !SDLMAME_SDL2 - if (!sm->is_yuv) - { - surfptr += ((vofs * pitch) + (hofs * bpp)); - mamewidth = blitwidth; //sdl_surface()->w; - mameheight = blitheight; //sdl_surface()->h; - } - else - { - mamewidth = m_yuvsurf->w / sm->mult_w; - mameheight = m_yuvsurf->h / sm->mult_h; - } -#else Uint32 fmt = 0; int access = 0; SDL_QueryTexture(m_texture_id, &fmt, &access, &mamewidth, &mameheight); mamewidth /= sm->mult_w; mameheight /= sm->mult_h; -#endif //printf("w h %d %d %d %d\n", mamewidth, mameheight, blitwidth, blitheight); // rescale bounds @@ -780,24 +571,6 @@ int sdl_info::draw(int update) window().m_primlist->release_lock(); // unlock and flip -#if (!SDLMAME_SDL2) - if (SDL_MUSTLOCK(window().sdl_surface())) SDL_UnlockSurface(window().sdl_surface()); - if (!sm->is_yuv) - { - SDL_Flip(window().sdl_surface()); - } - else - { - SDL_Rect r; - - SDL_UnlockYUVOverlay(m_yuvsurf); - r.x = hofs; - r.y = vofs; - r.w = blitwidth; - r.h = blitheight; - SDL_DisplayYUVOverlay(m_yuvsurf, &r); - } -#else SDL_UnlockTexture(m_texture_id); { SDL_Rect r; @@ -811,7 +584,6 @@ int sdl_info::draw(int update) SDL_RenderCopy(m_sdl_renderer,m_texture_id, NULL, &r); SDL_RenderPresent(m_sdl_renderer); } -#endif return 0; } //============================================================ @@ -950,12 +722,7 @@ static void yuv_RGB_to_YV12X2(const UINT16 *bitmap, UINT8 *ptr, const int pitch, pixels[0] = ptr; pixels[1] = ptr + pitch * height * 2; -#if (SDLMAME_SDL2) int p2 = (pitch >> 1); -#else - int p2 = (pitch + 7) & ~ 7;; - p2 = (p2 >> 1); -#endif pixels[2] = pixels[1] + p2 * height; for(y=0;y -#else -#include -#endif #include "../../sdl/window.h" #else #include "winmain.h" @@ -408,13 +404,8 @@ HRESULT sound_direct_sound::dsound_init() #ifdef SDLMAME_WIN32 SDL_SysWMinfo wminfo; SDL_VERSION(&wminfo.version); -#if SDLMAME_SDL2 SDL_GetWindowWMInfo(sdl_window_list->sdl_window(), &wminfo); HWND const window = wminfo.info.win.window; -#else // SDLMAME_SDL2 - SDL_GetWMInfo(&wminfo); - HWND const window = wminfo.window; -#endif // SDLMAME_SDL2 #else // SDLMAME_WIN32 HWND const window = win_window_list->m_hwnd; #endif // SDLMAME_WIN32 diff --git a/src/osd/modules/sound/sdl_sound.cpp b/src/osd/modules/sound/sdl_sound.cpp index de8d57af11c..c1e3e3dff2b 100644 --- a/src/osd/modules/sound/sdl_sound.cpp +++ b/src/osd/modules/sound/sdl_sound.cpp @@ -421,11 +421,7 @@ int sound_sdl::init(const osd_options &options) } osd_printf_verbose("Audio: Start initialization\n"); - #if (SDLMAME_SDL2) strncpy(audio_driver, SDL_GetCurrentAudioDriver(), sizeof(audio_driver)); - #else - SDL_AudioDriverName(audio_driver, sizeof(audio_driver)); - #endif osd_printf_verbose("Audio: Driver is %s\n", audio_driver); sdl_xfer_samples = SDL_XFER_SAMPLES; diff --git a/src/osd/modules/sync/sync_sdl.cpp b/src/osd/modules/sync/sync_sdl.cpp index 8a525723a45..73b735fefb3 100644 --- a/src/osd/modules/sync/sync_sdl.cpp +++ b/src/osd/modules/sync/sync_sdl.cpp @@ -191,11 +191,7 @@ osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam) return NULL; thread->callback = callback; thread->param = cbparam; -#ifdef SDLMAME_SDL2 thread->thread = SDL_CreateThread(worker_thread_entry, "Thread", thread); -#else - thread->thread = SDL_CreateThread(worker_thread_entry, thread); -#endif if ( thread->thread == NULL ) { free(thread); diff --git a/src/osd/sdl/SDLMain_tmpl.h b/src/osd/sdl/SDLMain_tmpl.h deleted file mode 100644 index c5ad2a346dd..00000000000 --- a/src/osd/sdl/SDLMain_tmpl.h +++ /dev/null @@ -1,13 +0,0 @@ -// license:Zlib|LGPL-2.1+ -// copyright-holders:http://libsdl.org/ -/* SDLMain.m - main entry point for our Cocoa-ized SDL app - Initial Version: Darrell Walisser - Non-NIB-Code & other changes: Max Horn - - Feel free to customize this file to suit your needs -*/ - -#import - -@interface SDLMain : NSObject -@end diff --git a/src/osd/sdl/SDLMain_tmpl.mm b/src/osd/sdl/SDLMain_tmpl.mm deleted file mode 100644 index 78b5d7f4937..00000000000 --- a/src/osd/sdl/SDLMain_tmpl.mm +++ /dev/null @@ -1,386 +0,0 @@ -// license:Zlib|LGPL-2.1+ -// copyright-holders:http://libsdl.org/ -/* SDLMain.m - main entry point for our Cocoa-ized SDL app - Initial Version: Darrell Walisser - Non-NIB-Code & other changes: Max Horn - - Feel free to customize this file to suit your needs -*/ - -#import "sdlinc.h" -#import "SDLMain_tmpl.h" -#import /* for MAXPATHLEN */ -#import - -/* For some reason, Apple removed setAppleMenu from the headers in 10.4, - but the method still is there and works. To avoid warnings, we declare - it ourselves here. */ -@interface NSApplication(SDL_Missing_Methods) -- (void)setAppleMenu:(NSMenu *)menu; -@end - -/* Use this flag to determine whether we use SDLMain.nib or not */ -#define SDL_USE_NIB_FILE 0 - -/* Use this flag to determine whether we use CPS (docking) or not */ -#define SDL_USE_CPS 0 -#ifdef SDL_USE_CPS -/* Portions of CPS.h */ -typedef struct CPSProcessSerNum -{ - UInt32 lo; - UInt32 hi; -} CPSProcessSerNum; - -extern "C" OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); -extern "C" OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); -extern "C" OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); - -#endif /* SDL_USE_CPS */ - -static int gArgc; -static char **gArgv; -static BOOL gFinderLaunch; -static BOOL gCalledAppMainline = FALSE; - -static NSString *getApplicationName(void) -{ - NSDictionary *dict; - NSString *appName = 0; - - /* Determine the application name */ - dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); - if (dict) - appName = [dict objectForKey: @"CFBundleName"]; - - if (![appName length]) - appName = [[NSProcessInfo processInfo] processName]; - - return appName; -} - -#if SDL_USE_NIB_FILE -/* A helper category for NSString */ -@interface NSString (ReplaceSubString) -- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; -@end -#endif - -@interface SDLApplication : NSApplication -@end - -@implementation SDLApplication -/* Invoked from the Quit menu item */ -- (void)terminate:(id)sender -{ - /* Post a SDL_QUIT event */ - SDL_Event event; - event.type = SDL_QUIT; - SDL_PushEvent(&event); -} -@end - -/* The main class of the application, the application's delegate */ -@implementation SDLMain - -/* Set the working directory to the .app's parent directory */ -- (void) setupWorkingDirectory:(BOOL)shouldChdir -{ - if (shouldChdir) - { - char parentdir[MAXPATHLEN]; - CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); - CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); - if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) { - assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ - } - CFRelease(url); - CFRelease(url2); - } - -} - -#if SDL_USE_NIB_FILE - -/* Fix menu to contain the real app name instead of "SDL App" */ -- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName -{ - NSRange aRange; - NSEnumerator *enumerator; - NSMenuItem *menuItem; - - aRange = [[aMenu title] rangeOfString:@"SDL App"]; - if (aRange.length != 0) - [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]]; - - enumerator = [[aMenu itemArray] objectEnumerator]; - while ((menuItem = [enumerator nextObject])) - { - aRange = [[menuItem title] rangeOfString:@"SDL App"]; - if (aRange.length != 0) - [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]]; - if ([menuItem hasSubmenu]) - [self fixMenu:[menuItem submenu] withAppName:appName]; - } - [ aMenu sizeToFit ]; -} - -#else - -static void setApplicationMenu(void) -{ - /* warning: this code is very odd */ - NSMenu *appleMenu; - NSMenuItem *menuItem; - NSString *title; - NSString *appName; - - appName = getApplicationName(); - appleMenu = [[NSMenu alloc] initWithTitle:@""]; - - /* Add menu items */ - title = [@"About " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; - - [appleMenu addItem:[NSMenuItem separatorItem]]; - - title = [@"Hide " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; - - menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; - [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; - - [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; - - [appleMenu addItem:[NSMenuItem separatorItem]]; - - title = [@"Quit " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; - - - /* Put menu into the menubar */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; - [menuItem setSubmenu:appleMenu]; - [[NSApp mainMenu] addItem:menuItem]; - - /* Tell the application object that this is now the application menu */ - [NSApp setAppleMenu:appleMenu]; - - /* Finally give up our references to the objects */ - [appleMenu release]; - [menuItem release]; -} - -/* Create a window menu */ -static void setupWindowMenu(void) -{ - NSMenu *windowMenu; - NSMenuItem *windowMenuItem; - NSMenuItem *menuItem; - - windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; - - /* "Minimize" item */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; - [windowMenu addItem:menuItem]; - [menuItem release]; - - /* Put menu into the menubar */ - windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; - [windowMenuItem setSubmenu:windowMenu]; - [[NSApp mainMenu] addItem:windowMenuItem]; - - /* Tell the application object that this is now the window menu */ - [NSApp setWindowsMenu:windowMenu]; - - /* Finally give up our references to the objects */ - [windowMenu release]; - [windowMenuItem release]; -} - -/* Replacement for NSApplicationMain */ -static void CustomApplicationMain (int argc, char **argv) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - SDLMain *sdlMain; - - /* Ensure the application object is initialised */ - [SDLApplication sharedApplication]; - -#ifdef SDL_USE_CPS - { - CPSProcessSerNum PSN; - /* Tell the dock about us */ - if (!CPSGetCurrentProcess(&PSN)) - if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) - if (!CPSSetFrontProcess(&PSN)) - [SDLApplication sharedApplication]; - } -#endif /* SDL_USE_CPS */ - - /* Set up the menubar */ - [NSApp setMainMenu:[[NSMenu alloc] init]]; - setApplicationMenu(); - setupWindowMenu(); - - /* Create SDLMain and make it the app delegate */ - sdlMain = [[SDLMain alloc] init]; - [NSApp setDelegate:sdlMain]; - - /* Start the main event loop */ - [NSApp run]; - - [sdlMain release]; - [pool release]; -} - -#endif - - -/* - * Catch document open requests...this lets us notice files when the app - * was launched by double-clicking a document, or when a document was - * dragged/dropped on the app's icon. You need to have a - * CFBundleDocumentsType section in your Info.plist to get this message, - * apparently. - * - * Files are added to gArgv, so to the app, they'll look like command line - * arguments. Previously, apps launched from the finder had nothing but - * an argv[0]. - * - * This message may be received multiple times to open several docs on launch. - * - * This message is ignored once the app's mainline has been called. - */ -- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename -{ - const char *temparg; - size_t arglen; - char *arg; - char **newargv; - - if (!gFinderLaunch) /* MacOS is passing command line args. */ - return FALSE; - - if (gCalledAppMainline) /* app has started, ignore this document. */ - return FALSE; - - temparg = [filename UTF8String]; - arglen = SDL_strlen(temparg) + 1; - arg = (char *) SDL_malloc(arglen); - if (arg == NULL) - return FALSE; - - newargv = (char **) SDL_realloc(gArgv, sizeof (char *) * (gArgc + 2)); - if (newargv == NULL) - { - SDL_free(arg); - return FALSE; - } - gArgv = newargv; - - SDL_strlcpy(arg, temparg, arglen); - gArgv[gArgc++] = arg; - gArgv[gArgc] = NULL; - return TRUE; -} - - -/* Called when the internal event loop has just started running */ -- (void) applicationDidFinishLaunching: (NSNotification *) note -{ - int status; - - /* Set the working directory to the .app's parent directory */ - [self setupWorkingDirectory:gFinderLaunch]; - -#if SDL_USE_NIB_FILE - /* Set the main menu to contain the real app name instead of "SDL App" */ - [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()]; -#endif - - /* Hand off to main application code */ - gCalledAppMainline = TRUE; - status = SDL_main (gArgc, gArgv); - - /* We're done, thank you for playing */ - exit(status); -} -@end - - -@implementation NSString (ReplaceSubString) - -- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString -{ - unsigned int bufferSize; - unsigned int selfLen = [self length]; - unsigned int aStringLen = [aString length]; - unichar *buffer; - NSRange localRange; - NSString *result; - - bufferSize = selfLen + aStringLen - aRange.length; - buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar)); - - /* Get first part into buffer */ - localRange.location = 0; - localRange.length = aRange.location; - [self getCharacters:buffer range:localRange]; - - /* Get middle part into buffer */ - localRange.location = 0; - localRange.length = aStringLen; - [aString getCharacters:(buffer+aRange.location) range:localRange]; - - /* Get last part into buffer */ - localRange.location = aRange.location + aRange.length; - localRange.length = selfLen - localRange.location; - [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange]; - - /* Build output string */ - result = [NSString stringWithCharacters:buffer length:bufferSize]; - - NSDeallocateMemoryPages(buffer, bufferSize); - - return result; -} - -@end - - - -#ifdef main -# undef main -#endif - - -/* Main entry point to executable - should *not* be SDL_main! */ -int main (int argc, char **argv) -{ - /* Copy the arguments into a global variable */ - /* This is passed if we are launched by double-clicking */ - if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { - gArgv = (char **) SDL_malloc(sizeof (char *) * 2); - gArgv[0] = argv[0]; - gArgv[1] = NULL; - gArgc = 1; - gFinderLaunch = YES; - } else { - int i; - gArgc = argc; - gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1)); - for (i = 0; i <= argc; i++) - gArgv[i] = argv[i]; - gFinderLaunch = NO; - } - -#if SDL_USE_NIB_FILE - [SDLApplication poseAsClass:[NSApplication class]]; - NSApplicationMain (argc, argv); -#else - CustomApplicationMain (argc, argv); -#endif - return 0; -} - diff --git a/src/osd/sdl/input.cpp b/src/osd/sdl/input.cpp index a050cbf024b..14162f6a929 100644 --- a/src/osd/sdl/input.cpp +++ b/src/osd/sdl/input.cpp @@ -235,7 +235,6 @@ struct kt_table { char * ui_name; }; -#if (SDLMAME_SDL2) #define OSD_SDL_INDEX(x) (x) #define OSD_SDL_INDEX_KEYSYM(keysym) ((keysym)->scancode) @@ -365,132 +364,6 @@ static kt_table sdl_key_trans_table[] = KTT_ENTRY0( BACKSLASH2, NONUSBACKSLASH, 0xdc, '\\', "BACKSLASH2" ), { ITEM_ID_INVALID } }; -#else - -#define OSD_SDL_INDEX(x) (SDLK_INDEX(x)-SDLK_FIRST) -#define OSD_SDL_INDEX_KEYSYM(keysym) (OSD_SDL_INDEX((keysym)->sym)) -#define GET_WINDOW(ev) sdl_window_list -#define GET_FOCUS_WINDOW(ev) sdl_window_list - -#define KTT_ENTRY0(MAME, SDL, VK, AS, UI) { ITEM_ID_ ## MAME, SDLK_ ## SDL, "ITEM_ID_" #MAME, (char *) UI } -#define KTT_ENTRY1(MAME, SDL) KTT_ENTRY0(MAME, SDL, MAME, MAME, #MAME) -// only for reference ... -#define KTT_ENTRY2(MAME, SDL) KTT_ENTRY0(MAME, SDL, 0, 0, #MAME) - - -static kt_table sdl_key_trans_table[] = -{ - // MAME key SDL key vkey ascii - KTT_ENTRY0( ESC, ESCAPE, 0x1b, 0x1b, "ESC" ), - KTT_ENTRY1( 1, 1 ), - KTT_ENTRY1( 2, 2 ), - KTT_ENTRY1( 3, 3 ), - KTT_ENTRY1( 4, 4 ), - KTT_ENTRY1( 5, 5 ), - KTT_ENTRY1( 6, 6 ), - KTT_ENTRY1( 7, 7 ), - KTT_ENTRY1( 8, 8 ), - KTT_ENTRY1( 9, 9 ), - KTT_ENTRY1( 0, 0 ), - KTT_ENTRY0( MINUS, MINUS, 0xbd, '-', "MINUS" ), - KTT_ENTRY0( EQUALS, EQUALS, 0xbb, '=', "EQUALS" ), - KTT_ENTRY0( BACKSPACE, BACKSPACE, 0x08, 0x08, "BACKSPACE" ), - KTT_ENTRY0( TAB, TAB, 0x09, 0x09, "TAB" ), - KTT_ENTRY1( Q, q ), - KTT_ENTRY1( W, w ), - KTT_ENTRY1( E, e ), - KTT_ENTRY1( R, r ), - KTT_ENTRY1( T, t ), - KTT_ENTRY1( Y, y ), - KTT_ENTRY1( U, u ), - KTT_ENTRY1( I, i ), - KTT_ENTRY1( O, o ), - KTT_ENTRY1( P, p ), - KTT_ENTRY0( OPENBRACE, LEFTBRACKET, 0xdb, '[', "OPENBRACE" ), - KTT_ENTRY0( CLOSEBRACE,RIGHTBRACKET, 0xdd, ']', "CLOSEBRACE" ), - KTT_ENTRY0( ENTER, RETURN, 0x0d, 0x0d, "RETURN" ), - KTT_ENTRY2( LCONTROL, LCTRL ), - KTT_ENTRY1( A, a ), - KTT_ENTRY1( S, s ), - KTT_ENTRY1( D, d ), - KTT_ENTRY1( F, f ), - KTT_ENTRY1( G, g ), - KTT_ENTRY1( H, h ), - KTT_ENTRY1( J, j ), - KTT_ENTRY1( K, k ), - KTT_ENTRY1( L, l ), - KTT_ENTRY0( COLON, SEMICOLON, 0xba, ';', "COLON" ), - KTT_ENTRY0( QUOTE, QUOTE, 0xde, '\'', "QUOTE" ), - KTT_ENTRY2( LSHIFT, LSHIFT ), - KTT_ENTRY0( BACKSLASH, BACKSLASH, 0xdc, '\\', "BACKSLASH" ), - KTT_ENTRY1( Z, z ), - KTT_ENTRY1( X, x ), - KTT_ENTRY1( C, c ), - KTT_ENTRY1( V, v ), - KTT_ENTRY1( B, b ), - KTT_ENTRY1( N, n ), - KTT_ENTRY1( M, m ), - KTT_ENTRY0( COMMA, COMMA, 0xbc, ',', "COMMA" ), - KTT_ENTRY0( STOP, PERIOD, 0xbe, '.', "STOP" ), - KTT_ENTRY0( SLASH, SLASH, 0xbf, '/', "SLASH" ), - KTT_ENTRY2( RSHIFT, RSHIFT ), - KTT_ENTRY0( ASTERISK, KP_MULTIPLY, '*', '*', "ASTERIX" ), - KTT_ENTRY2( LALT, LALT ), - KTT_ENTRY0( SPACE, SPACE, ' ', ' ', "SPACE" ), - KTT_ENTRY2( CAPSLOCK, CAPSLOCK ), - KTT_ENTRY2( F1, F1 ), - KTT_ENTRY2( F2, F2 ), - KTT_ENTRY2( F3, F3 ), - KTT_ENTRY2( F4, F4 ), - KTT_ENTRY2( F5, F5 ), - KTT_ENTRY2( F6, F6 ), - KTT_ENTRY2( F7, F7 ), - KTT_ENTRY2( F8, F8 ), - KTT_ENTRY2( F9, F9 ), - KTT_ENTRY2( F10, F10 ), - KTT_ENTRY2( NUMLOCK, NUMLOCK ), - KTT_ENTRY2( SCRLOCK, SCROLLOCK ), - KTT_ENTRY2( 7_PAD, KP7 ), - KTT_ENTRY2( 8_PAD, KP8 ), - KTT_ENTRY2( 9_PAD, KP9 ), - KTT_ENTRY2( MINUS_PAD, KP_MINUS ), - KTT_ENTRY2( 4_PAD, KP4 ), - KTT_ENTRY2( 5_PAD, KP5 ), - KTT_ENTRY2( 6_PAD, KP6 ), - KTT_ENTRY2( PLUS_PAD, KP_PLUS ), - KTT_ENTRY2( 1_PAD, KP1 ), - KTT_ENTRY2( 2_PAD, KP2 ), - KTT_ENTRY2( 3_PAD, KP3 ), - KTT_ENTRY2( 0_PAD, KP0 ), - KTT_ENTRY2( DEL_PAD, KP_PERIOD ), - KTT_ENTRY2( F11, F11 ), - KTT_ENTRY2( F12, F12 ), - KTT_ENTRY2( F13, F13 ), - KTT_ENTRY2( F14, F14 ), - KTT_ENTRY2( F15, F15 ), - KTT_ENTRY2( ENTER_PAD, KP_ENTER ), - KTT_ENTRY2( RCONTROL, RCTRL ), - KTT_ENTRY2( SLASH_PAD, KP_DIVIDE ), - KTT_ENTRY2( PRTSCR, PRINT ), - KTT_ENTRY2( RALT, RALT ), - KTT_ENTRY2( HOME, HOME ), - KTT_ENTRY2( UP, UP ), - KTT_ENTRY2( PGUP, PAGEUP ), - KTT_ENTRY2( LEFT, LEFT ), - KTT_ENTRY2( RIGHT, RIGHT ), - KTT_ENTRY2( END, END ), - KTT_ENTRY2( DOWN, DOWN ), - KTT_ENTRY2( PGDN, PAGEDOWN ), - KTT_ENTRY2( INSERT, INSERT ), - { ITEM_ID_DEL, SDLK_DELETE, "ITEM_ID_DEL", (char *)"DELETE" }, - KTT_ENTRY2( LWIN, LSUPER ), - KTT_ENTRY2( RWIN, RSUPER ), - KTT_ENTRY2( MENU, MENU ), - KTT_ENTRY0( TILDE, BACKQUOTE, 0xc0, '`', "TILDE" ), - KTT_ENTRY0( BACKSLASH2, HASH, 0xdc, '\\', "BACKSLASH2" ), - { ITEM_ID_INVALID } -}; -#endif struct key_lookup_table { @@ -498,7 +371,6 @@ struct key_lookup_table const char *name; }; -#if (SDLMAME_SDL2) #define KE(x) { SDL_SCANCODE_ ## x, "SDL_SCANCODE_" #x }, #define KE8(A, B, C, D, E, F, G, H) KE(A) KE(B) KE(C) KE(D) KE(E) KE(F) KE(G) KE(H) #define KE7(A, B, C, D, E, F, G) KE(A) KE(B) KE(C) KE(D) KE(E) KE(F) KE(G) @@ -527,46 +399,6 @@ static key_lookup_table sdl_lookup_table[] = KE(UNDO) {-1, ""} }; -#else -#define KE(x) { SDLK_ ## x, "SDLK_" #x }, -#define KE8(A, B, C, D, E, F, G, H) KE(A) KE(B) KE(C) KE(D) KE(E) KE(F) KE(G) KE(H) - -static key_lookup_table sdl_lookup_table[] = -{ - KE8(UNKNOWN, FIRST, BACKSPACE, TAB, CLEAR, RETURN, PAUSE, ESCAPE ) - KE8(SPACE, EXCLAIM, QUOTEDBL, HASH, DOLLAR, AMPERSAND, QUOTE, LEFTPAREN ) - KE8(RIGHTPAREN, ASTERISK, PLUS, COMMA, MINUS, PERIOD, SLASH, 0 ) - KE8(1, 2, 3, 4, 5, 6, 7, 8 ) - KE8(9, COLON, SEMICOLON, LESS, EQUALS, GREATER, QUESTION, AT ) - KE8(LEFTBRACKET,BACKSLASH, RIGHTBRACKET, CARET, UNDERSCORE, BACKQUOTE, 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, WORLD_0, WORLD_1, WORLD_2, WORLD_3, WORLD_4, WORLD_5, WORLD_6 ) - KE8(WORLD_7, WORLD_8, WORLD_9, WORLD_10, WORLD_11, WORLD_12, WORLD_13, WORLD_14 ) - KE8(WORLD_15, WORLD_16, WORLD_17, WORLD_18, WORLD_19, WORLD_20, WORLD_21, WORLD_22 ) - KE8(WORLD_23, WORLD_24, WORLD_25, WORLD_26, WORLD_27, WORLD_28, WORLD_29, WORLD_30 ) - KE8(WORLD_31, WORLD_32, WORLD_33, WORLD_34, WORLD_35, WORLD_36, WORLD_37, WORLD_38 ) - KE8(WORLD_39, WORLD_40, WORLD_41, WORLD_42, WORLD_43, WORLD_44, WORLD_45, WORLD_46 ) - KE8(WORLD_47, WORLD_48, WORLD_49, WORLD_50, WORLD_51, WORLD_52, WORLD_53, WORLD_54 ) - KE8(WORLD_55, WORLD_56, WORLD_57, WORLD_58, WORLD_59, WORLD_60, WORLD_61, WORLD_62 ) - KE8(WORLD_63, WORLD_64, WORLD_65, WORLD_66, WORLD_67, WORLD_68, WORLD_69, WORLD_70 ) - KE8(WORLD_71, WORLD_72, WORLD_73, WORLD_74, WORLD_75, WORLD_76, WORLD_77, WORLD_78 ) - KE8(WORLD_79, WORLD_80, WORLD_81, WORLD_82, WORLD_83, WORLD_84, WORLD_85, WORLD_86 ) - KE8(WORLD_87, WORLD_88, WORLD_89, WORLD_90, WORLD_91, WORLD_92, WORLD_93, WORLD_94 ) - KE8(WORLD_95, KP0, KP1, KP2, KP3, KP4, KP5, KP6 ) - KE8(KP7, KP8, KP9, 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, NUMLOCK, CAPSLOCK, SCROLLOCK, RSHIFT, LSHIFT, RCTRL ) - KE8(LCTRL, RALT, LALT, RMETA, LMETA, LSUPER, RSUPER, MODE ) - KE8(COMPOSE, HELP, PRINT, SYSREQ, BREAK, MENU, POWER, EURO ) - KE(UNDO) - KE(LAST) - {-1, ""} -}; -#endif //============================================================ // INLINE FUNCTIONS @@ -718,14 +550,9 @@ static void sdlinput_register_joysticks(running_machine &machine) { char *joy_name; -#if (SDLMAME_SDL2) joy = SDL_JoystickOpen(physical_stick); joy_name = remove_spaces(machine, SDL_JoystickName(joy)); SDL_JoystickClose(joy); -#else - joy_name = remove_spaces(machine, SDL_JoystickName(physical_stick)); -#endif - devmap_register(&joy_map, physical_stick, joy_name); } @@ -1518,7 +1345,6 @@ INT32 normalize_absolute_axis(INT32 raw, INT32 rawmin, INT32 rawmax) // sdlinput_poll //============================================================ -#if (SDLMAME_SDL2) static inline sdl_window_info * window_from_id(Uint32 windowID) { sdl_window_info *w; @@ -1554,8 +1380,6 @@ static inline void resize_all_windows(void) } } -#endif - void sdlinput_process_events_buf() { SDL_Event event; @@ -1563,10 +1387,8 @@ void sdlinput_process_events_buf() if (SDLMAME_EVENTS_IN_WORKER_THREAD) { std::lock_guard lock(input_lock); - #if (SDLMAME_SDL2) /* Make sure we get all pending events */ SDL_PumpEvents(); - #endif while(SDL_PollEvent(&event)) { if (event_buf_count < MAX_BUF_EVENTS) @@ -1731,12 +1553,8 @@ void sdlinput_poll(running_machine &machine) devinfo = generic_device_find_index( keyboard_list, keyboard_map.logical[0]); #endif devinfo->keyboard.state[OSD_SDL_INDEX_KEYSYM(&event.key.keysym)] = 0x80; -#if (SDLMAME_SDL2) if (event.key.keysym.sym < 0x20) machine.ui_input().push_char_event(sdl_window_list->target(), event.key.keysym.sym); -#else - ui_input_push_char_event(machine, sdl_window_list->target(), (unicode_char) event.key.keysym.unicode); -#endif break; case SDL_KEYUP: #ifdef SDL2_MULTIAPI @@ -1854,29 +1672,7 @@ void sdlinput_poll(running_machine &machine) } } } -#if (!SDLMAME_SDL2) - else if (event.button.button == 4) // SDL_BUTTON_WHEELUP - { - int cx, cy; - sdl_window_info *window = GET_FOCUS_WINDOW(&event.button); - if (window != NULL && window->xy_to_render_target(event.button.x,event.button.y, &cx, &cy) ) - { - machine.ui_input().push_mouse_wheel_event(window->target(), cx, cy, 120, 3); - } - } - - else if (event.button.button == 5) // SDL_BUTTON_WHEELDOWN - { - int cx, cy; - sdl_window_info *window = GET_FOCUS_WINDOW(&event.button); - if (window != NULL && window->xy_to_render_target(event.button.x,event.button.y, &cx, &cy) ) - { - machine.ui_input().push_mouse_wheel_event(window->target(), cx, cy, -120, 3); - } - } -#endif break; -#if (SDLMAME_SDL2) case SDL_MOUSEWHEEL: #ifdef SDL2_MULTIAPI devinfo = generic_device_find_index(mouse_list, mouse_map.logical[event.wheel.which]); @@ -1890,7 +1686,6 @@ void sdlinput_poll(running_machine &machine) machine.ui_input().push_mouse_wheel_event(window->target(), 0, 0, event.wheel.y, 3); } break; -#endif case SDL_MOUSEBUTTONUP: #ifdef SDL2_MULTIAPI devinfo = generic_device_find_index(mouse_list, mouse_map.logical[event.button.which]); @@ -1917,15 +1712,10 @@ void sdlinput_poll(running_machine &machine) #else devinfo = generic_device_find_index(mouse_list, mouse_map.logical[0]); #endif -#if (SDLMAME_SDL2) // FIXME: may apply to 1.2 as well ... //printf("Motion %d %d %d %s\n", event.motion.which, event.motion.x, event.motion.y, devinfo->name.c_str()); devinfo->mouse.lX += event.motion.xrel * INPUT_RELATIVE_PER_PIXEL; devinfo->mouse.lY += event.motion.yrel * INPUT_RELATIVE_PER_PIXEL; -#else - devinfo->mouse.lX = event.motion.xrel * INPUT_RELATIVE_PER_PIXEL; - devinfo->mouse.lY = event.motion.yrel * INPUT_RELATIVE_PER_PIXEL; -#endif { int cx=-1, cy=-1; sdl_window_info *window = GET_FOCUS_WINDOW(&event.motion); @@ -1940,22 +1730,6 @@ void sdlinput_poll(running_machine &machine) devinfo->joystick.balls[event.jball.ball * 2] = event.jball.xrel * INPUT_RELATIVE_PER_PIXEL; devinfo->joystick.balls[event.jball.ball * 2 + 1] = event.jball.yrel * INPUT_RELATIVE_PER_PIXEL; break; -#if (!SDLMAME_SDL2) - case SDL_APPMOUSEFOCUS: - app_has_mouse_focus = event.active.gain; - if (!event.active.gain) - { - sdl_window_info *window = GET_FOCUS_WINDOW(&event.motion); - ui_input_push_mouse_leave_event(machine, window->target()); - } - break; - case SDL_QUIT: - machine.schedule_exit(); - break; - case SDL_VIDEORESIZE: - sdl_window_list->resize(event.resize.w, event.resize.h); - break; -#else case SDL_TEXTINPUT: if (*event.text.text) { @@ -2023,7 +1797,6 @@ void sdlinput_poll(running_machine &machine) } break; } -#endif } } #if (SDLMAME_SDL2) diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index e82c75406cc..bca299eb49d 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -17,15 +17,9 @@ #if defined(SDLMAME_WIN32) - #if (SDLMAME_SDL2) #define SDLMAME_EVENTS_IN_WORKER_THREAD (0) #define SDLMAME_INIT_IN_WORKER_THREAD (0) #define SDL13_COMBINE_RESIZE (0) //(1) no longer needed - #else - #define SDLMAME_EVENTS_IN_WORKER_THREAD (0) - #define SDLMAME_INIT_IN_WORKER_THREAD (1) - #define SDL13_COMBINE_RESIZE (0) - #endif #else #define SDLMAME_EVENTS_IN_WORKER_THREAD (0) #define SDLMAME_INIT_IN_WORKER_THREAD (0) @@ -122,10 +116,8 @@ public: const char *joy_index(int index) const { return value(strformat("%s%d", SDLOPTION_JOYINDEX, index).c_str()); } bool sixaxis() const { return bool_value(SDLOPTION_SIXAXIS); } -#if (SDLMAME_SDL2) const char *mouse_index(int index) const { return value(strformat("%s%d", SDLOPTION_MOUSEINDEX, index).c_str()); } const char *keyboard_index(int index) const { return value(strformat("%s%d", SDLOPTION_KEYBINDEX, index).c_str()); } -#endif const char *video_driver() const { return value(SDLOPTION_VIDEODRIVER); } const char *render_driver() const { return value(SDLOPTION_RENDERDRIVER); } diff --git a/src/osd/sdl/sdlinc.h b/src/osd/sdl/sdlinc.h index 2bb5dfd0954..47ead42c0cf 100644 --- a/src/osd/sdl/sdlinc.h +++ b/src/osd/sdl/sdlinc.h @@ -3,20 +3,11 @@ #ifndef _sdlinc_h_ #define _sdlinc_h_ -#if (SDLMAME_SDL2) #include #include // on win32 this includes windows.h by itself and breaks us! #ifndef SDLMAME_WIN32 #include #endif -#else -#include -#include -// on win32 this includes windows.h by itself and breaks us! -#if !defined(SDLMAME_WIN32) && !defined(SDLMAME_DARWIN) && !defined(SDLMAME_MACOSX) -#include -#endif -#endif #endif diff --git a/src/osd/sdl/sdlmain.cpp b/src/osd/sdl/sdlmain.cpp index 2f382605cbb..530aa41c9d4 100644 --- a/src/osd/sdl/sdlmain.cpp +++ b/src/osd/sdl/sdlmain.cpp @@ -101,11 +101,7 @@ const options_entry sdl_options::s_option_entries[] = // OS X can be trusted to have working hardware OpenGL, so default to it on for the best user experience { SDLOPTION_CENTERH, "1", OPTION_BOOLEAN, "center horizontally within the view area" }, { SDLOPTION_CENTERV, "1", OPTION_BOOLEAN, "center vertically within the view area" }, -#if (SDLMAME_SDL2) { SDLOPTION_SCALEMODE ";sm", OSDOPTVAL_NONE, OPTION_STRING, "Scale mode: none, hwblit, hwbest, yv12, yuy2, yv12x2, yuy2x2 (-video soft only)" }, -#else - { SDLOPTION_SCALEMODE ";sm", OSDOPTVAL_NONE, OPTION_STRING, "Scale mode: none, async, yv12, yuy2, yv12x2, yuy2x2 (-video soft only)" }, -#endif // full screen options #ifdef SDLMAME_X11 @@ -143,7 +139,6 @@ const options_entry sdl_options::s_option_entries[] = { SDLOPTION_LIGHTGUNINDEX "8", OSDOPTVAL_AUTO, OPTION_STRING, "name of lightgun mapped to lightgun #8" }, #endif -#if (SDLMAME_SDL2) { NULL, NULL, OPTION_HEADER, "SDL MOUSE MAPPING" }, { SDLOPTION_MOUSEINDEX "1", OSDOPTVAL_AUTO, OPTION_STRING, "name of mouse mapped to mouse #1" }, { SDLOPTION_MOUSEINDEX "2", OSDOPTVAL_AUTO, OPTION_STRING, "name of mouse mapped to mouse #2" }, @@ -163,13 +158,11 @@ const options_entry sdl_options::s_option_entries[] = { SDLOPTION_KEYBINDEX "6", OSDOPTVAL_AUTO, OPTION_STRING, "name of keyboard mapped to keyboard #6" }, { SDLOPTION_KEYBINDEX "7", OSDOPTVAL_AUTO, OPTION_STRING, "name of keyboard mapped to keyboard #7" }, { SDLOPTION_KEYBINDEX "8", OSDOPTVAL_AUTO, OPTION_STRING, "name of keyboard mapped to keyboard #8" }, -#endif + // SDL low level driver options { NULL, NULL, OPTION_HEADER, "SDL LOWLEVEL DRIVER OPTIONS" }, { SDLOPTION_VIDEODRIVER ";vd", OSDOPTVAL_AUTO, OPTION_STRING, "sdl video driver to use ('x11', 'directfb', ... or 'auto' for SDL default" }, -#if (SDLMAME_SDL2) { SDLOPTION_RENDERDRIVER ";rd", OSDOPTVAL_AUTO, OPTION_STRING, "sdl render driver to use ('software', 'opengl', 'directfb' ... or 'auto' for SDL default" }, -#endif { SDLOPTION_AUDIODRIVER ";ad", OSDOPTVAL_AUTO, OPTION_STRING, "sdl audio driver to use ('alsa', 'arts', ... or 'auto' for SDL default" }, #if USE_OPENGL { SDLOPTION_GL_LIB, SDLOPTVAL_GLLIB, OPTION_STRING, "alternative libGL.so to use; 'auto' for system default" }, @@ -225,21 +218,6 @@ int main(int argc, char *argv[]) { int res = 0; -#if defined(SDLMAME_X11) && !(SDLMAME_SDL2) - XInitThreads(); -#endif - -#if defined(SDLMAME_WIN32) -#if !(SDLMAME_SDL2) - /* Load SDL dynamic link library */ - if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) { - fprintf(stderr, "WinMain() error: %s", SDL_GetError()); - return(FALSE); - } - SDL_SetModuleHandle(GetModuleHandle(NULL)); -#endif -#endif - // disable I/O buffering setvbuf(stdout, (char *) NULL, _IONBF, 0); setvbuf(stderr, (char *) NULL, _IONBF, 0); @@ -257,25 +235,6 @@ int main(int argc, char *argv[]) MorphToPM(); #endif -#if defined(SDLMAME_X11) && (SDL_MAJOR_VERSION == 1) && (SDL_MINOR_VERSION == 2) - if (SDL_Linked_Version()->patch < 10) - /* workaround for SDL choosing a 32-bit ARGB visual */ - { - Display *display; - if ((display = XOpenDisplay(NULL)) && (DefaultDepth(display, DefaultScreen(display)) >= 24)) - { - XVisualInfo vi; - char buf[130]; - if (XMatchVisualInfo(display, DefaultScreen(display), 24, TrueColor, &vi)) { - snprintf(buf, sizeof(buf), "0x%lx", vi.visualid); - osd_setenv(SDLENV_VISUALID, buf, 0); - } - } - if (display) - XCloseDisplay(display); - } -#endif - { sdl_options options; sdl_osd_interface osd(options); @@ -340,11 +299,7 @@ void sdl_osd_interface::osd_exit() if (!SDLMAME_INIT_IN_WORKER_THREAD) { /* FixMe: Bug in SDL2.0, Quitting joystick will cause SIGSEGV */ -#if SDLMAME_SDL2 SDL_QuitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO /*| SDL_INIT_JOYSTICK */); -#else - SDL_Quit(); -#endif } } @@ -419,7 +374,6 @@ static void defines_verbose(void) static void osd_sdl_info(void) { -#if SDLMAME_SDL2 int i, num = SDL_GetNumVideoDrivers(); osd_printf_verbose("Available videodrivers: "); @@ -456,8 +410,6 @@ static void osd_sdl_info(void) { osd_printf_verbose("\t%-20s\n", SDL_GetAudioDriver(i)); } - -#endif } @@ -512,7 +464,6 @@ void sdl_osd_interface::init(running_machine &machine) osd_setenv(SDLENV_VIDEODRIVER, stemp, 1); } -#if (SDLMAME_SDL2) stemp = options().render_driver(); if (stemp != NULL) { @@ -532,7 +483,6 @@ void sdl_osd_interface::init(running_machine &machine) #endif } } -#endif /* Set the SDL environment variable for drivers wanting to load the * lib at startup. @@ -567,15 +517,11 @@ void sdl_osd_interface::init(running_machine &machine) if (!SDLMAME_INIT_IN_WORKER_THREAD) { -#if (SDLMAME_SDL2) #ifdef SDLMAME_EMSCRIPTEN // timer brings in threads which are not supported in Emscripten if (SDL_InitSubSystem(SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) { #else if (SDL_InitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) { -#endif -#else - if (SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) { #endif osd_printf_error("Could not initialize SDL %s\n", SDL_GetError()); exit(-1); @@ -600,13 +546,9 @@ void sdl_osd_interface::init(running_machine &machine) m_watchdog->setTimeout(watchdog_timeout); } -#if (SDLMAME_SDL2) #ifdef SDLMAME_EMSCRIPTEN SDL_EventState(SDL_TEXTINPUT, SDL_FALSE); #else SDL_EventState(SDL_TEXTINPUT, SDL_TRUE); #endif -#else - SDL_EnableUNICODE(SDL_TRUE); -#endif } diff --git a/src/osd/sdl/sdlos_unix.cpp b/src/osd/sdl/sdlos_unix.cpp index 5811e0c7dc5..23080512e91 100644 --- a/src/osd/sdl/sdlos_unix.cpp +++ b/src/osd/sdl/sdlos_unix.cpp @@ -23,11 +23,6 @@ // MAME headers #include "osdcore.h" - - - -#if (SDLMAME_SDL2) - //============================================================ // osd_get_clipboard_text //============================================================ @@ -45,104 +40,3 @@ char *osd_get_clipboard_text(void) } return result; } - -#elif defined(SDL_VIDEO_DRIVER_X11) && defined(SDLMAME_X11) - -//============================================================ -// osd_get_clipboard_text -//============================================================ - -char *osd_get_clipboard_text(void) -{ - SDL_SysWMinfo info; - Display* display; - Window our_win; - Window selection_win; - Atom data_type; - int data_format; - unsigned long nitems; - unsigned long bytes_remaining; - unsigned char* prop; - char* result; - XEvent event; - Uint32 t0, t1; - Atom types[2]; - int i; - - /* get & validate SDL sys-wm info */ - SDL_VERSION(&info.version); - if ( ! SDL_GetWMInfo( &info ) ) - return NULL; - if ( info.subsystem != SDL_SYSWM_X11 ) - return NULL; - if ( (display = info.info.x11.display) == NULL ) - return NULL; - if ( (our_win = info.info.x11.window) == None ) - return NULL; - - /* request data to owner */ - selection_win = XGetSelectionOwner( display, XA_PRIMARY ); - if ( selection_win == None ) - return NULL; - - /* first, try UTF-8, then latin-1 */ - types[0] = XInternAtom( display, "UTF8_STRING", False ); - types[1] = XA_STRING; /* latin-1 */ - - for ( i = 0; i < ARRAY_LENGTH(types); i++ ) - { - XConvertSelection( display, XA_PRIMARY, types[i], types[i], our_win, CurrentTime ); - - /* wait for SelectionNotify, but no more than 100 ms */ - t0 = t1 = SDL_GetTicks(); - while ( 1 ) - { - if ( XCheckTypedWindowEvent( display, our_win, SelectionNotify, &event ) ) break; - SDL_Delay( 1 ); - t1 = SDL_GetTicks(); - if ( t1 - t0 > 100 ) - return NULL; - } - if ( event.xselection.property == None ) - continue; - - /* get property & check its type */ - if ( XGetWindowProperty( display, our_win, types[i], 0, 65536, False, types[i], - &data_type, &data_format, &nitems, &bytes_remaining, &prop ) - != Success ) - continue; - if ( ! prop ) - continue; - if ( (data_format != 8) || (data_type != types[i]) ) - { - XFree( prop ); - continue; - } - - /* return a copy & free original */ - if (prop != NULL) - { - result = (char *) osd_malloc_array(strlen((char *)prop)+1); - strcpy(result, (char *)prop); - } - else - result = NULL; - XFree( prop ); - return result; - } - - return NULL; -} - -#else -//============================================================ -// osd_get_clipboard_text -//============================================================ - -char *osd_get_clipboard_text(void) -{ - char *result = NULL; - - return result; -} -#endif diff --git a/src/osd/sdl/testkeys.cpp b/src/osd/sdl/testkeys.cpp index 444c1b9eeb2..850ec1ad506 100644 --- a/src/osd/sdl/testkeys.cpp +++ b/src/osd/sdl/testkeys.cpp @@ -24,7 +24,6 @@ struct key_lookup_table const char *name; }; -#if (SDLMAME_SDL2) #define KE(x) { SDL_SCANCODE_ ## x, "SDL_SCANCODE_" #x }, #define KE8(A, B, C, D, E, F, G, H) KE(A) KE(B) KE(C) KE(D) KE(E) KE(F) KE(G) KE(H) #define KE7(A, B, C, D, E, F, G) KE(A) KE(B) KE(C) KE(D) KE(E) KE(F) KE(G) @@ -53,46 +52,6 @@ static key_lookup_table sdl_lookup[] = KE5(MENU, NONUSBACKSLASH, UNDO, APOSTROPHE, GRAVE ) {-1, ""} }; -#else -#define KE(x) { SDLK_ ## x, "SDLK_" #x }, -#define KE8(A, B, C, D, E, F, G, H) KE(A) KE(B) KE(C) KE(D) KE(E) KE(F) KE(G) KE(H) - -static key_lookup_table sdl_lookup[] = -{ - KE8(UNKNOWN, FIRST, BACKSPACE, TAB, CLEAR, RETURN, PAUSE, ESCAPE ) - KE8(SPACE, EXCLAIM, QUOTEDBL, HASH, DOLLAR, AMPERSAND, QUOTE, LEFTPAREN ) - KE8(RIGHTPAREN, ASTERISK, PLUS, COMMA, MINUS, PERIOD, SLASH, 0 ) - KE8(1, 2, 3, 4, 5, 6, 7, 8 ) - KE8(9, COLON, SEMICOLON, LESS, EQUALS, GREATER, QUESTION, AT ) - KE8(LEFTBRACKET,BACKSLASH, RIGHTBRACKET, CARET, UNDERSCORE, BACKQUOTE, 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, WORLD_0, WORLD_1, WORLD_2, WORLD_3, WORLD_4, WORLD_5, WORLD_6 ) - KE8(WORLD_7, WORLD_8, WORLD_9, WORLD_10, WORLD_11, WORLD_12, WORLD_13, WORLD_14 ) - KE8(WORLD_15, WORLD_16, WORLD_17, WORLD_18, WORLD_19, WORLD_20, WORLD_21, WORLD_22 ) - KE8(WORLD_23, WORLD_24, WORLD_25, WORLD_26, WORLD_27, WORLD_28, WORLD_29, WORLD_30 ) - KE8(WORLD_31, WORLD_32, WORLD_33, WORLD_34, WORLD_35, WORLD_36, WORLD_37, WORLD_38 ) - KE8(WORLD_39, WORLD_40, WORLD_41, WORLD_42, WORLD_43, WORLD_44, WORLD_45, WORLD_46 ) - KE8(WORLD_47, WORLD_48, WORLD_49, WORLD_50, WORLD_51, WORLD_52, WORLD_53, WORLD_54 ) - KE8(WORLD_55, WORLD_56, WORLD_57, WORLD_58, WORLD_59, WORLD_60, WORLD_61, WORLD_62 ) - KE8(WORLD_63, WORLD_64, WORLD_65, WORLD_66, WORLD_67, WORLD_68, WORLD_69, WORLD_70 ) - KE8(WORLD_71, WORLD_72, WORLD_73, WORLD_74, WORLD_75, WORLD_76, WORLD_77, WORLD_78 ) - KE8(WORLD_79, WORLD_80, WORLD_81, WORLD_82, WORLD_83, WORLD_84, WORLD_85, WORLD_86 ) - KE8(WORLD_87, WORLD_88, WORLD_89, WORLD_90, WORLD_91, WORLD_92, WORLD_93, WORLD_94 ) - KE8(WORLD_95, KP0, KP1, KP2, KP3, KP4, KP5, KP6 ) - KE8(KP7, KP8, KP9, 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, NUMLOCK, CAPSLOCK, SCROLLOCK, RSHIFT, LSHIFT, RCTRL ) - KE8(LCTRL, RALT, LALT, RMETA, LMETA, LSUPER, RSUPER, MODE ) - KE8(COMPOSE, HELP, PRINT, SYSREQ, BREAK, MENU, POWER, EURO ) - KE(UNDO) - KE(LAST) - {-1, ""} -}; -#endif static const char * lookup_key_name(const key_lookup_table *kt, int kc) { @@ -114,23 +73,14 @@ int main(int argc, char *argv[]) { SDL_Event event; int quit = 0; -#if (SDLMAME_SDL2) char lasttext[20] = ""; -#else - char buf[20]; -#endif if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); exit(1); } -#if (SDLMAME_SDL2) SDL_CreateWindow("Input Test", 0, 0, 100, 100,0 ); -#else - SDL_SetVideoMode(100, 50, 16, SDL_ANYFORMAT); - SDL_EnableUNICODE(1); -#endif while(SDL_PollEvent(&event) || !quit) { switch(event.type) { case SDL_QUIT: @@ -141,46 +91,24 @@ int main(int argc, char *argv[]) quit=1; else { -#if (SDLMAME_SDL2) printf("ITEM_ID_XY %s 0x%x 0x%x %s\n", lookup_key_name(sdl_lookup, event.key.keysym.scancode), (int) event.key.keysym.scancode, (int) event.key.keysym.sym, ""); lasttext[0] = 0; -#else - memset(buf, 0, 19); - utf8_from_uchar(buf, sizeof(buf), event.key.keysym.unicode); - printf("ITEM_ID_XY %s 0x%x 0x%x %s\n", - lookup_key_name(sdl_lookup, event.key.keysym.sym), - (int) event.key.keysym.scancode, - (int) event.key.keysym.unicode, - buf); -#endif } break; case SDL_KEYUP: -#if (SDLMAME_SDL2) printf("ITEM_ID_XY %s 0x%x 0x%x %s\n", lookup_key_name(sdl_lookup, event.key.keysym.scancode), (int) event.key.keysym.scancode, (int) event.key.keysym.sym, lasttext); -#else - memset(buf, 0, 19); - utf8_from_uchar(buf, sizeof(buf), event.key.keysym.unicode); - printf("ITEM_ID_XY %s 0x%x 0x%x %s\n", - lookup_key_name(sdl_lookup, event.key.keysym.sym), - (int) event.key.keysym.scancode, - (int) event.key.keysym.unicode, - buf); -#endif break; -#if (SDLMAME_SDL2) case SDL_TEXTINPUT: strcpy(lasttext, event.text.text); break; -#endif } event.type = 0; diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index c5de6be41d9..4f694d4f967 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -142,7 +142,6 @@ inline osd_rect RECT_to_osd_rect(const RECT &r) #endif void sdl_monitor_info::refresh() { - #if (SDLMAME_SDL2) SDL_DisplayMode dmode; #if defined(SDLMAME_WIN32) @@ -156,128 +155,8 @@ void sdl_monitor_info::refresh() m_pos_size = SDL_Rect_to_osd_rect(dimensions); m_usuable_pos_size = SDL_Rect_to_osd_rect(dimensions); m_is_primary = (m_handle == 0); - - #else - #if defined(SDLMAME_WIN32) // Win32 version - MONITORINFOEX info; - info.cbSize = sizeof(info); - GetMonitorInfo((HMONITOR)m_handle, (LPMONITORINFO)&info); - m_pos_size = RECT_to_osd_rect(info.rcMonitor); - m_usuable_pos_size = RECT_to_osd_rect(info.rcWork); - m_is_primary = ((info.dwFlags & MONITORINFOF_PRIMARY) != 0); - char *temp = utf8_from_wstring(info.szDevice); - strncpy(m_name, temp, ARRAY_LENGTH(m_name) - 1); - osd_free(temp); - #elif defined(SDLMAME_MACOSX) // Mac OS X Core Imaging version - CGDirectDisplayID primary; - CGRect dbounds; - - // get the main display - primary = CGMainDisplayID(); - dbounds = CGDisplayBounds(primary); - - m_is_primary = (m_handle == 0); - m_pos_size = osd_rect(0, 0, dbounds.size.width - dbounds.origin.x, dbounds.size.height - dbounds.origin.y); - m_usuable_pos_size = m_pos_size; - strncpy(m_name, "Mac OS X display", ARRAY_LENGTH(m_name) - 1); - #elif defined(SDLMAME_X11) || defined(SDLMAME_NO_X11) // X11 version - { - #if defined(SDLMAME_X11) - // X11 version - int screen; - SDL_SysWMinfo info; - SDL_VERSION(&info.version); - - if ( SDL_GetWMInfo(&info) && (info.subsystem == SDL_SYSWM_X11) ) - { - screen = DefaultScreen(info.info.x11.display); - SDL_VideoDriverName(m_name, ARRAY_LENGTH(m_name) - 1); - m_pos_size = osd_rect(0, 0, - DisplayWidth(info.info.x11.display, screen), - DisplayHeight(info.info.x11.display, screen)); - - /* FIXME: If Xinerame is used we should compile a list of monitors - * like we do for other targets and ignore SDL. - */ - if ((XineramaIsActive(info.info.x11.display)) && video_config.restrictonemonitor) - { - XineramaScreenInfo *xineinfo; - int numscreens; - - xineinfo = XineramaQueryScreens(info.info.x11.display, &numscreens); - - m_pos_size = osd_rect(0, 0, xineinfo[0].width, xineinfo[0].height); - - XFree(xineinfo); - } - m_usuable_pos_size = m_pos_size; - m_is_primary = (m_handle == 0); - } - else - #endif // defined(SDLMAME_X11) - { - static int first_call=0; - static int cw = 0, ch = 0; - - SDL_VideoDriverName(m_name, ARRAY_LENGTH(m_name) - 1); - if (first_call==0) - { - const char *dimstr = osd_getenv(SDLENV_DESKTOPDIM); - const SDL_VideoInfo *sdl_vi; - - sdl_vi = SDL_GetVideoInfo(); - #if (SDL_VERSION_ATLEAST(1,2,10)) - cw = sdl_vi->current_w; - ch = sdl_vi->current_h; - #endif - first_call=1; - if ((cw==0) || (ch==0)) - { - if (dimstr != NULL) - { - sscanf(dimstr, "%dx%d", &cw, &ch); - } - if ((cw==0) || (ch==0)) - { - osd_printf_warning("WARNING: SDL_GetVideoInfo() for driver <%s> is broken.\n", m_name); - osd_printf_warning(" You should set SDLMAME_DESKTOPDIM to your desktop size.\n"); - osd_printf_warning(" e.g. export SDLMAME_DESKTOPDIM=800x600\n"); - osd_printf_warning(" Assuming 1024x768 now!\n"); - cw=1024; - ch=768; - } - } - } - m_pos_size = osd_rect(0, 0, cw, ch); - m_usuable_pos_size = m_pos_size; - m_is_primary = (m_handle == 0); - } - } - #elif defined(SDLMAME_OS2) // OS2 version - m_pos_size = osd_rect(0, 0, - WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ), - WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ) ); - m_usuable_pos_size = m_pos_size; - m_is_primary = (m_handle == 0); - strncpy(m_name, "OS/2 display", ARRAY_LENGTH(m_name) - 1); - #else - #error Unknown SDLMAME_xx OS type! - #endif - - { - static int info_shown=0; - if (!info_shown) - { - osd_printf_verbose("SDL Device Driver : %s\n", m_name); - osd_printf_verbose("SDL Monitor Dimensions: %d x %d\n", m_pos_size.width(), m_pos_size.height()); - info_shown = 1; - } - } - #endif // (SDLMAME_SDL2) } - - //============================================================ // sdlvideo_monitor_get_aspect //============================================================ @@ -324,68 +203,6 @@ void sdl_osd_interface::update(bool skip_redraw) } -//============================================================ -// add_primary_monitor -//============================================================ - -#if !defined(SDLMAME_WIN32) && !(SDLMAME_SDL2) -void sdl_monitor_info::add_primary_monitor(void *data) -{ - // make a list of monitors - osd_monitor_info::list = NULL; - osd_monitor_info **tailptr = &sdl_monitor_info::list; - - // allocate a new monitor info - osd_monitor_info *monitor = global_alloc_clear(0, "", 1.0f); - - //monitor->refresh(); - // guess the aspect ratio assuming square pixels - monitor->set_aspect((float)(monitor->position_size().width()) / (float)(monitor->position_size().height())); - - // hook us into the list - *tailptr = monitor; - //tailptr = &monitor->m_next; -} -#endif - - -//============================================================ -// monitor_enum_callback -//============================================================ - -#if defined(SDLMAME_WIN32) && !(SDLMAME_SDL2) -BOOL CALLBACK sdl_monitor_info::monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect, LPARAM data) -{ - osd_monitor_info ***tailptr = (osd_monitor_info ***)data; - osd_monitor_info *monitor; - MONITORINFOEX info; - BOOL result; - - // get the monitor info - info.cbSize = sizeof(info); - result = GetMonitorInfo(handle, (LPMONITORINFO)&info); - assert(result); - (void)result; // to silence gcc 4.6 - - // guess the aspect ratio assuming square pixels - float aspect = (float)(info.rcMonitor.right - info.rcMonitor.left) / (float)(info.rcMonitor.bottom - info.rcMonitor.top); - - // allocate a new monitor info - char *temp = utf8_from_wstring(info.szDevice); - // copy in the data - monitor = global_alloc(sdl_monitor_info((UINT64) handle, temp, aspect)); - osd_free(temp); - - // hook us into the list - **tailptr = monitor; - *tailptr = &monitor->m_next; - - // enumerate all the available monitors so to list their names in verbose mode - return TRUE; -} -#endif - - //============================================================ // init_monitors //============================================================ @@ -398,7 +215,6 @@ void sdl_monitor_info::init() osd_monitor_info::list = NULL; tailptr = &osd_monitor_info::list; - #if (SDLMAME_SDL2) { int i; @@ -427,11 +243,6 @@ void sdl_monitor_info::init() } } osd_printf_verbose("Leave init_monitors\n"); - #elif defined(SDLMAME_WIN32) - EnumDisplayMonitors(NULL, NULL, monitor_enum_callback, (LPARAM)&tailptr); - #else - add_primary_monitor((void *)&tailptr); - #endif } void sdl_monitor_info::exit() @@ -534,7 +345,7 @@ static void check_osd_inputs(running_machine &machine) machine.ui().popup_time(1, "Keepaspect %s", video_config.keepaspect? "enabled":"disabled"); } - #if (USE_OPENGL || SDLMAME_SDL2) + #if (USE_OPENGL) //FIXME: on a per window basis if (machine.ui_input().pressed(IPT_OSD_5)) { @@ -600,7 +411,7 @@ void sdl_osd_interface::extract_video_config() } else if (USE_OPENGL && (strcmp(stemp, SDLOPTVAL_OPENGL) == 0)) video_config.mode = VIDEO_MODE_OPENGL; - else if (SDLMAME_SDL2 && (strcmp(stemp, SDLOPTVAL_SDL2ACCEL) == 0)) + else if ((strcmp(stemp, SDLOPTVAL_SDL2ACCEL) == 0)) { video_config.mode = VIDEO_MODE_SDL2ACCEL; } @@ -693,19 +504,11 @@ void sdl_osd_interface::extract_video_config() // misc options: sanity check values // global options: sanity check values -#if (!SDLMAME_SDL2) - if (video_config.numscreens < 1 || video_config.numscreens > 1) //MAX_VIDEO_WINDOWS) - { - osd_printf_warning("Invalid numscreens value %d; reverting to 1\n", video_config.numscreens); - video_config.numscreens = 1; - } -#else if (video_config.numscreens < 1 || video_config.numscreens > MAX_VIDEO_WINDOWS) { osd_printf_warning("Invalid numscreens value %d; reverting to 1\n", video_config.numscreens); video_config.numscreens = 1; } -#endif // yuv settings ... stemp = options().scale_mode(); video_config.scale_mode = drawsdl_scale_mode(stemp); diff --git a/src/osd/sdl/video.h b/src/osd/sdl/video.h index 699f98512d1..c6a2b13cc31 100644 --- a/src/osd/sdl/video.h +++ b/src/osd/sdl/video.h @@ -11,11 +11,6 @@ #ifndef __SDLVIDEO__ #define __SDLVIDEO__ -#if defined(SDLMAME_WIN32) && !(SDLMAME_SDL2) -#define WIN32_LEAN_AND_MEAN -#include -#endif - #include "osdsdl.h" //============================================================ @@ -164,12 +159,6 @@ public: // STATIC static void init(); static void exit(); -#if !defined(SDLMAME_WIN32) && !(SDLMAME_SDL2) - static void add_primary_monitor(void *data); -#endif -#if defined(SDLMAME_WIN32) && !(SDLMAME_SDL2) - static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect, LPARAM data); -#endif private: void virtual refresh() override; diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 85f945874d9..d5279c23756 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -16,11 +16,7 @@ // standard SDL headers #include "sdlinc.h" -#if (SDLMAME_SDL2) #include -#else -#include -#endif // standard C headers #include @@ -92,10 +88,6 @@ static sdl_window_info **last_window_ptr; static int multithreading_enabled; static osd_work_queue *work_queue; -#if !(SDLMAME_SDL2) && (!defined(SDLMAME_EMSCRIPTEN)) -typedef int SDL_threadID; -#endif - static SDL_threadID main_threadid; static SDL_threadID window_threadid; @@ -189,11 +181,7 @@ static OSDWORK_CALLBACK(sdlwindow_thread_id) if (SDLMAME_INIT_IN_WORKER_THREAD) { -#if (SDLMAME_SDL2) if (SDL_InitSubSystem(SDL_INIT_TIMER|SDL_INIT_AUDIO| SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) -#else - if (SDL_Init(SDL_INIT_TIMER|SDL_INIT_AUDIO| SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) -#endif { osd_printf_error("Could not initialize SDL: %s.\n", SDL_GetError()); exit(-1); @@ -242,13 +230,11 @@ bool sdl_osd_interface::window_init() video_config.mode = VIDEO_MODE_SOFT; } #endif -#if SDLMAME_SDL2 if (video_config.mode == VIDEO_MODE_SDL2ACCEL) { if (drawsdl2_init(machine(), &draw)) video_config.mode = VIDEO_MODE_SOFT; } -#endif #ifdef USE_BGFX if (video_config.mode == VIDEO_MODE_BGFX) { @@ -262,7 +248,6 @@ bool sdl_osd_interface::window_init() return false; } -#if SDLMAME_SDL2 /* We may want to set a number of the hints SDL2 provides. * The code below will document which hints were set. */ @@ -294,7 +279,6 @@ bool sdl_osd_interface::window_init() osd_printf_verbose("\nHints:\n"); for (int i = 0; hints[i] != NULL; i++) osd_printf_verbose("\t%-40s %s\n", hints[i], SDL_GetHint(hints[i])); -#endif // set up the window list last_window_ptr = &sdl_window_list; @@ -478,14 +462,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_resize_wt ) ASSERT_WINDOW_THREAD(); -#if (SDLMAME_SDL2) SDL_SetWindowSize(window->sdl_window(), width, height); -#else - SDL_FreeSurface(window->m_sdlsurf); - - window->m_sdlsurf = SDL_SetVideoMode(width, height, 0, - SDL_SWSURFACE | SDL_ANYFORMAT | window->m_extra_flags); -#endif window->renderer().notify_changed(); osd_free(wp); @@ -559,7 +536,6 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt ) global_free(window->m_renderer); window->m_renderer = NULL; -#if (SDLMAME_SDL2) bool is_osx = false; #ifdef SDLMAME_MACOSX // FIXME: This is weird behaviour and certainly a bug in SDL @@ -572,15 +548,6 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt ) SDL_SetWindowFullscreen(window->sdl_window(), SDL_WINDOW_FULLSCREEN); // Try to set mode } SDL_DestroyWindow(window->sdl_window()); -#else - if (window->m_sdlsurf) - { - SDL_FreeSurface(window->m_sdlsurf); - window->m_sdlsurf = NULL; - } -#endif - - sdlinput_release_keys(); window->set_renderer(draw.create(window)); @@ -647,7 +614,6 @@ void sdl_window_info::update_cursor_state() c=SDL_CreateCursor(data, data, 8, 8, 0, 0); SDL_SetCursor(c); #else -#if (SDLMAME_SDL2) // do not do mouse capture if the debugger's enabled to avoid // the possibility of losing control if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED)) @@ -670,30 +636,6 @@ void sdl_window_info::update_cursor_state() } SDL_SetCursor(NULL); // Force an update in case the underlying driver has changed visibility } - -#else - // do not do mouse capture if the debugger's enabled to avoid - // the possibility of losing control - if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED)) - { - if ( fullscreen() || sdlinput_should_hide_mouse() ) - { - SDL_ShowCursor(SDL_DISABLE); - if (!SDL_WM_GrabInput(SDL_GRAB_QUERY)) - { - SDL_WM_GrabInput(SDL_GRAB_ON); - } - } - else - { - SDL_ShowCursor(SDL_ENABLE); - if (SDL_WM_GrabInput(SDL_GRAB_QUERY)) - { - SDL_WM_GrabInput(SDL_GRAB_OFF); - } - } - } -#endif #endif } @@ -793,7 +735,6 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_video_window_destroy_wt ) // free the textures etc window->renderer().destroy(); -#if (SDLMAME_SDL2) if (window->fullscreen() && video_config.switchres) { SDL_SetWindowFullscreen(window->sdl_window(), 0); // Try to set mode @@ -801,14 +742,6 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_video_window_destroy_wt ) SDL_SetWindowFullscreen(window->sdl_window(), SDL_WINDOW_FULLSCREEN); // Try to set mode } SDL_DestroyWindow(window->sdl_window()); -#else - if (window->m_sdlsurf) - { - SDL_FreeSurface(window->m_sdlsurf); - window->m_sdlsurf = NULL; - } -#endif - // release all keys ... sdlinput_release_keys(); @@ -853,7 +786,6 @@ void sdl_window_info::destroy() // pick_best_mode //============================================================ -#if SDLMAME_SDL2 osd_dim sdl_window_info::pick_best_mode() { int minimum_width, minimum_height, target_width, target_height; @@ -922,82 +854,6 @@ osd_dim sdl_window_info::pick_best_mode() } return ret; } -#else -osd_dim sdl_window_info::pick_best_mode() -{ - int minimum_width, minimum_height, target_width, target_height; - int i; - float size_score, best_score = 0.0f; - int best_width = 0, best_height = 0; - SDL_Rect **modes; - - // determine the minimum width/height for the selected target - m_target->compute_minimum_size(minimum_width, minimum_height); - - // use those as the target for now - target_width = minimum_width * MAX(1, prescale()); - target_height = minimum_height * MAX(1, prescale()); - - // if we're not stretching, allow some slop on the minimum since we can handle it - { - minimum_width -= 4; - minimum_height -= 4; - } - -#if 1 // defined(SDLMAME_WIN32) - /* - * We need to do this here. If SDL_ListModes is - * called in init_monitors, the call will crash - * on win32 - */ - modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_DOUBLEBUF); -#else - modes = window->m_monitor->modes; -#endif - - if (modes == (SDL_Rect **)0) - { - osd_printf_error("SDL: No modes available?!\n"); - exit(-1); - } - else if (modes == (SDL_Rect **)-1) // all modes are possible - { - return osd_dim(m_win_config.width, m_win_config.height); - } - else - { - for (i = 0; modes[i]; ++i) - { - // compute initial score based on difference between target and current - size_score = 1.0f / (1.0f + fabsf((INT32)modes[i]->w - target_width) + fabsf((INT32)modes[i]->h - target_height)); - - // if the mode is too small, give a big penalty - if (modes[i]->w < minimum_width || modes[i]->h < minimum_height) - size_score *= 0.01f; - - // if mode is smaller than we'd like, it only scores up to 0.1 - if (modes[i]->w < target_width || modes[i]->h < target_height) - size_score *= 0.1f; - - // if we're looking for a particular mode, that's a winner - if (modes[i]->w == m_win_config.width && modes[i]->h == m_win_config.height) - size_score = 2.0f; - - osd_printf_verbose("%4dx%4d -> %f\n", (int)modes[i]->w, (int)modes[i]->h, size_score); - - // best so far? - if (size_score > best_score) - { - best_score = size_score; - best_width = modes[i]->w; - best_height = modes[i]->h; - } - - } - } - return osd_dim(best_width, best_height); -} -#endif //============================================================ // sdlwindow_video_window_update @@ -1142,8 +998,6 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt ) */ osd_printf_verbose("Enter sdl_info::create\n"); -#if (SDLMAME_SDL2) - if (window->renderer().has_flags(osd_renderer::FLAG_NEEDS_OPENGL)) { SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); @@ -1227,49 +1081,7 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt ) SDL_SetWindowGrab(window->sdl_window(), SDL_TRUE); #endif -#else - window->m_extra_flags = (window->fullscreen() ? SDL_FULLSCREEN : SDL_RESIZABLE); - - if (window->renderer().has_flags(osd_renderer::FLAG_NEEDS_DOUBLEBUF)) - window->m_extra_flags |= SDL_DOUBLEBUF; - if (window->renderer().has_flags(osd_renderer::FLAG_NEEDS_ASYNCBLIT)) - window->m_extra_flags |= SDL_ASYNCBLIT; - - if (window->renderer().has_flags(osd_renderer::FLAG_NEEDS_OPENGL)) - { - window->m_extra_flags |= SDL_DOUBLEBUF | SDL_OPENGL; - SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); - #if (SDL_VERSION_ATLEAST(1,2,10)) && (!defined(SDLMAME_EMSCRIPTEN)) - SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, video_config.waitvsync ? 1 : 0); - #endif - // load_gl_lib(window->machine()); - } - - // create the SDL surface (which creates the window in windowed mode) -#if 0 - window->m_sdlsurf = SDL_SetVideoMode(tempwidth, tempheight, - 0, SDL_OPENGL | SDL_FULLSCREEN);// | window->m_extra_flags); - if (!window->m_sdlsurf) - printf("completely failed\n"); -#endif - window->m_sdlsurf = SDL_SetVideoMode(temp.width(), temp.height(), - 0, SDL_SWSURFACE | SDL_ANYFORMAT | window->m_extra_flags); - - if (!window->m_sdlsurf) - { - osd_printf_error("SDL Error: %s\n", SDL_GetError()); - return (void *) &result[1]; - } - if ( (video_config.mode == VIDEO_MODE_OPENGL) && !(window->m_sdlsurf->flags & SDL_OPENGL) ) - { - osd_printf_error("OpenGL not supported on this driver!\n"); - return (void *) &result[1]; - } - // set the window title - SDL_WM_SetCaption(window->m_title, "SDLMAME"); -#endif - - // set main window + // set main window if (window->m_index > 0) { for (auto w = sdl_window_list; w != NULL; w = w->m_next) diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index c890b6c0ff2..bdaaa311330 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -38,20 +38,13 @@ public: const osd_window_config *config) : osd_window(), m_next(NULL), // Following three are used by input code to defer resizes -#if (SDLMAME_SDL2) m_resize_width(0), m_resize_height(0), m_last_resize(0), -#endif m_minimum_dim(0,0), m_windowed_dim(0,0), m_rendered_event(0), m_target(0), -#if (SDLMAME_SDL2) m_sdl_window(NULL), - -#else - m_sdlsurf(NULL), -#endif m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0) { m_win_config = *config; @@ -81,13 +74,9 @@ public: osd_dim get_size() override { -#if (SDLMAME_SDL2) int w=0; int h=0; SDL_GetWindowSize(m_sdl_window, &w, &h); return osd_dim(w,h); -#else - return osd_dim(m_sdlsurf->w, m_sdlsurf->h); -#endif } int xy_to_render_target(int x, int y, int *xt, int *yt); @@ -97,11 +86,7 @@ public: int fullscreen() const override { return m_fullscreen; } render_target *target() override { return m_target; } -#if (SDLMAME_SDL2) SDL_Window *sdl_window() override { return m_sdl_window; } -#else - SDL_Surface *sdl_surface() { return m_sdlsurf; } -#endif osd_dim blit_surface_size() override; int prescale() const { return m_prescale; } @@ -109,12 +94,10 @@ public: // Pointer to next window sdl_window_info * m_next; -#if (SDLMAME_SDL2) // These are used in combine resizing events ... #if SDL13_COMBINE_RESIZE int m_resize_width; int m_resize_height; osd_ticks_t m_last_resize; -#endif private: // window handle and info @@ -129,15 +112,10 @@ private: osd_event * m_rendered_event; render_target * m_target; -#if (SDLMAME_SDL2) // Needs to be here as well so we can identify window SDL_Window *m_sdl_window; // Original display_mode SDL_DisplayMode m_original_mode; -#else - // SDL surface - SDL_Surface *m_sdlsurf; -#endif int m_extra_flags; -- cgit v1.2.3-70-g09d2 From 7caab6653ecea555ee5ffbc8767b52901f08fe39 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 16 Feb 2016 16:35:29 +0100 Subject: Remove not needed headers (nw) --- src/osd/sdl/video.cpp | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index 4f694d4f967..f700c2b6da4 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -7,33 +7,6 @@ // SDLMAME by Olivier Galibert and R. Belmont // //============================================================ - -#ifdef SDLMAME_X11 -#include -#endif - -#ifdef SDLMAME_MACOSX -#undef Status -#include -#endif - -#ifdef SDLMAME_WIN32 -// for multimonitor -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x501 -#endif - -#define WIN32_LEAN_AND_MEAN -#include - -#include "strconv.h" -#endif - -#ifdef SDLMAME_OS2 -#define INCL_WINSYS -#include -#endif - #include "sdlinc.h" // MAME headers -- cgit v1.2.3-70-g09d2 From 13b44026be2c3e336ac1b86a4310ffa84efe5685 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 16 Feb 2016 16:37:29 +0100 Subject: windows compile fix (nw) --- src/osd/sdl/video.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index f700c2b6da4..707376f8198 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -107,12 +107,7 @@ void sdl_osd_interface::video_exit() //============================================================ // sdlvideo_monitor_refresh //============================================================ -#if defined(SDLMAME_WIN32) // Win32 version -inline osd_rect RECT_to_osd_rect(const RECT &r) -{ - return osd_rect(r.left, r.top, r.right - r.left, r.bottom - r.top); -} -#endif + void sdl_monitor_info::refresh() { SDL_DisplayMode dmode; -- cgit v1.2.3-70-g09d2 From c16d050d54b23309613f05868e23e2ffdcbcb27e Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 16 Feb 2016 16:45:12 +0100 Subject: remove SDLMAME_SDL2 usage (nw) --- src/osd/sdl/input.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/osd/sdl/input.cpp b/src/osd/sdl/input.cpp index 14162f6a929..9cfcdb1cf16 100644 --- a/src/osd/sdl/input.cpp +++ b/src/osd/sdl/input.cpp @@ -1068,7 +1068,7 @@ static kt_table * sdlinput_read_keymap(running_machine &machine) { sdl2section = 1; } - else if (((SDLMAME_SDL2) ^ sdl2section) == 0) + else if (((1) ^ sdl2section) == 0) { mks[0]=0; sks[0]=0; @@ -1799,9 +1799,7 @@ void sdlinput_poll(running_machine &machine) } } } -#if (SDLMAME_SDL2) resize_all_windows(); -#endif } @@ -1812,10 +1810,6 @@ void sdlinput_poll(running_machine &machine) void sdlinput_release_keys() { - // FIXME: SDL >= 1.3 will nuke the window event buffer when - // a window is closed. This will leave keys in a pressed - // state when a window is destroyed and recreated. -#if (SDLMAME_SDL2) device_info *devinfo; int index; @@ -1826,7 +1820,6 @@ void sdlinput_release_keys() break; memset(&devinfo->keyboard.state, 0, sizeof(devinfo->keyboard.state)); } -#endif } -- cgit v1.2.3-70-g09d2 From e1ace736267d354caa3c9e1ff844bdc88d645864 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 16 Feb 2016 17:21:32 +0100 Subject: opengl as requirement (nw) --- scripts/src/emu.lua | 2 +- scripts/src/osd/modules.lua | 71 +- scripts/src/osd/osdmini_cfg.lua | 1 - scripts/src/osd/sdl_cfg.lua | 2 +- src/osd/modules/lib/osdobj_common.cpp | 2 - src/osd/modules/opengl/SDL1211_opengl.h | 6553 ------------------------------- src/osd/modules/opengl/osd_opengl.h | 10 +- src/osd/modules/render/draw13.cpp | 4 - src/osd/sdl/osdsdl.h | 2 - src/osd/sdl/sdlmain.cpp | 5 - src/osd/sdl/video.cpp | 106 +- src/osd/sdl/window.cpp | 2 - src/osd/windows/video.cpp | 92 +- src/osd/windows/video.h | 2 - src/osd/windows/window.cpp | 4 - 15 files changed, 123 insertions(+), 6735 deletions(-) delete mode 100644 src/osd/modules/opengl/SDL1211_opengl.h diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index e0358285114..e8d2abba10a 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -38,7 +38,7 @@ if _OPTIONS["with-bundled-lua"] then } end -if (_OPTIONS["targetos"] == "windows") then +if (_OPTIONS["targetos"] == "windows" and _OPTIONS["osd"] ~= "osdmini" ) then defines { "UI_WINDOWS", } diff --git a/scripts/src/osd/modules.lua b/scripts/src/osd/modules.lua index 14d344fee09..6e0bf611844 100644 --- a/scripts/src/osd/modules.lua +++ b/scripts/src/osd/modules.lua @@ -77,28 +77,18 @@ function osdmodulesbuild() } end - if _OPTIONS["NO_OPENGL"]=="1" then - defines { - "USE_OPENGL=0", - } - else - files { - MAME_DIR .. "src/osd/modules/render/drawogl.cpp", - MAME_DIR .. "src/osd/modules/opengl/gl_shader_tool.cpp", - MAME_DIR .. "src/osd/modules/opengl/gl_shader_mgr.cpp", - MAME_DIR .. "src/osd/modules/opengl/gl_shader_mgr.h", - MAME_DIR .. "src/osd/modules/opengl/gl_shader_tool.h", - MAME_DIR .. "src/osd/modules/opengl/osd_opengl.h", - MAME_DIR .. "src/osd/modules/opengl/SDL1211_opengl.h", - } + files { + MAME_DIR .. "src/osd/modules/render/drawogl.cpp", + MAME_DIR .. "src/osd/modules/opengl/gl_shader_tool.cpp", + MAME_DIR .. "src/osd/modules/opengl/gl_shader_mgr.cpp", + MAME_DIR .. "src/osd/modules/opengl/gl_shader_mgr.h", + MAME_DIR .. "src/osd/modules/opengl/gl_shader_tool.h", + MAME_DIR .. "src/osd/modules/opengl/osd_opengl.h", + } + if _OPTIONS["USE_DISPATCH_GL"]=="1" then defines { - "USE_OPENGL=1", + "USE_DISPATCH_GL=1", } - if _OPTIONS["USE_DISPATCH_GL"]=="1" then - defines { - "USE_DISPATCH_GL=1", - } - end end if USE_BGFX == 1 then @@ -257,21 +247,19 @@ end function osdmodulestargetconf() - if _OPTIONS["NO_OPENGL"]~="1" then - if _OPTIONS["targetos"]=="macosx" then + if _OPTIONS["targetos"]=="macosx" then + links { + "OpenGL.framework", + } + elseif _OPTIONS["USE_DISPATCH_GL"]~="1" then + if _OPTIONS["targetos"]=="windows" then links { - "OpenGL.framework", + "opengl32", + } + else + links { + "GL", } - elseif _OPTIONS["USE_DISPATCH_GL"]~="1" then - if _OPTIONS["targetos"]=="windows" then - links { - "opengl32", - } - else - links { - "GL", - } - end end end @@ -348,23 +336,6 @@ newoption { description = "Disable network access", } -newoption { - trigger = "NO_OPENGL", - description = "Disable use of OpenGL", - allowed = { - { "0", "Enable OpenGL" }, - { "1", "Disable OpenGL" }, - }, -} - -if not _OPTIONS["NO_OPENGL"] then - if _OPTIONS["targetos"]=="os2" then - _OPTIONS["NO_OPENGL"] = "1" - else - _OPTIONS["NO_OPENGL"] = "0" - end -end - newoption { trigger = "USE_DISPATCH_GL", description = "Use GL-dispatching", diff --git a/scripts/src/osd/osdmini_cfg.lua b/scripts/src/osd/osdmini_cfg.lua index 586075d3cac..09631dcbc0b 100644 --- a/scripts/src/osd/osdmini_cfg.lua +++ b/scripts/src/osd/osdmini_cfg.lua @@ -6,7 +6,6 @@ defines { "USE_QTDEBUG=0", "USE_SDL", "SDLMAME_NOASM=1", - "USE_OPENGL=0", "NO_USE_MIDI=1", "USE_XAUDIO2=0", } diff --git a/scripts/src/osd/sdl_cfg.lua b/scripts/src/osd/sdl_cfg.lua index bdeb7274ef1..0eb5a9333f2 100644 --- a/scripts/src/osd/sdl_cfg.lua +++ b/scripts/src/osd/sdl_cfg.lua @@ -12,7 +12,7 @@ if SDL_NETWORK~="" and not _OPTIONS["DONT_USE_NETWORK"] then } end -if _OPTIONS["NO_OPENGL"]~="1" and _OPTIONS["USE_DISPATCH_GL"]~="1" and _OPTIONS["MESA_INSTALL_ROOT"] then +if _OPTIONS["USE_DISPATCH_GL"]~="1" and _OPTIONS["MESA_INSTALL_ROOT"] then includedirs { path.join(_OPTIONS["MESA_INSTALL_ROOT"],"include"), } diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index b36bbf60df3..c65d60b9527 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -86,7 +86,6 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_FILTER ";glfilter;flt", "1", OPTION_BOOLEAN, "enable bilinear filtering on screen output" }, { OSDOPTION_PRESCALE, "1", OPTION_INTEGER, "scale screen rendering by this amount in software" }, -#if USE_OPENGL { NULL, NULL, OPTION_HEADER, "OpenGL-SPECIFIC OPTIONS" }, { OSDOPTION_GL_FORCEPOW2TEXTURE, "0", OPTION_BOOLEAN, "force power of two textures (default no)" }, { OSDOPTION_GL_NOTEXTURERECT, "0", OPTION_BOOLEAN, "don't use OpenGL GL_ARB_texture_rectangle (default on)" }, @@ -114,7 +113,6 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_SHADER_SCREEN "7", OSDOPTVAL_NONE, OPTION_STRING, "custom OpenGL GLSL shader screen bitmap 7" }, { OSDOPTION_SHADER_SCREEN "8", OSDOPTVAL_NONE, OPTION_STRING, "custom OpenGL GLSL shader screen bitmap 8" }, { OSDOPTION_SHADER_SCREEN "9", OSDOPTVAL_NONE, OPTION_STRING, "custom OpenGL GLSL shader screen bitmap 9" }, -#endif { NULL, NULL, OPTION_HEADER, "OSD SOUND OPTIONS" }, { OSDOPTION_SOUND, OSDOPTVAL_AUTO, OPTION_STRING, "sound output method: " }, diff --git a/src/osd/modules/opengl/SDL1211_opengl.h b/src/osd/modules/opengl/SDL1211_opengl.h deleted file mode 100644 index 2a5db6f3199..00000000000 --- a/src/osd/modules/opengl/SDL1211_opengl.h +++ /dev/null @@ -1,6553 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Sam Lantinga -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2006 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -/* This is a simple file to encapsulate the OpenGL API headers */ - -//#include - -#ifdef __WIN32__ -#define WIN32_LEAN_AND_MEAN -#ifndef NOMINMAX -#define NOMINMAX /* Don't defined min() and max() */ -#endif -#include -#endif -#ifndef NO_SDL_GLEXT -#define __glext_h_ /* Don't let gl.h include glext.h */ -#endif -#if defined(__MACOSX__) -#include /* Header File For The OpenGL Library */ -#include /* Header File For The GLU Library */ -#elif defined(__MACOS__) -#include /* Header File For The OpenGL Library */ -#include /* Header File For The GLU Library */ -#else -#include /* Header File For The OpenGL Library */ -#include /* Header File For The GLU Library */ -#endif -#ifndef NO_SDL_GLEXT -#undef __glext_h_ -#endif - -/* This file taken from "GLext.h" from the Jeff Molofee OpenGL tutorials. - It is included here because glext.h is not available on some systems. - If you don't want this version included, simply define "NO_SDL_GLEXT" - */ -#ifndef NO_SDL_GLEXT -#if !defined(__glext_h_) && !defined(GL_GLEXT_LEGACY) -#define __glext_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: This software was created using the -** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has -** not been independently verified as being compliant with the OpenGL(R) -** version 1.2.1 Specification. -*/ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#define WIN32_LEAN_AND_MEAN 1 -#include -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif -#ifndef GLAPI -#define GLAPI extern -#endif - -/*************************************************************/ - -/* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated 2005/06/20 */ -/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ -#define GL_GLEXT_VERSION 29 - -#ifndef GL_VERSION_1_2 -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_RESCALE_NORMAL 0x803A -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 -#define GL_SINGLE_COLOR 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR 0x81FA -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#endif - -#ifndef GL_ARB_imaging -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 -#define GL_FUNC_ADD 0x8006 -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_BLEND_EQUATION 0x8009 -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_CONVOLUTION_1D 0x8010 -#define GL_CONVOLUTION_2D 0x8011 -#define GL_SEPARABLE_2D 0x8012 -#define GL_CONVOLUTION_BORDER_MODE 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS 0x8015 -#define GL_REDUCE 0x8016 -#define GL_CONVOLUTION_FORMAT 0x8017 -#define GL_CONVOLUTION_WIDTH 0x8018 -#define GL_CONVOLUTION_HEIGHT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH 0x801A -#define GL_MAX_CONVOLUTION_HEIGHT 0x801B -#define GL_POST_CONVOLUTION_RED_SCALE 0x801C -#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D -#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E -#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F -#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 -#define GL_HISTOGRAM 0x8024 -#define GL_PROXY_HISTOGRAM 0x8025 -#define GL_HISTOGRAM_WIDTH 0x8026 -#define GL_HISTOGRAM_FORMAT 0x8027 -#define GL_HISTOGRAM_RED_SIZE 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE 0x802A -#define GL_HISTOGRAM_ALPHA_SIZE 0x802B -#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C -#define GL_HISTOGRAM_SINK 0x802D -#define GL_MINMAX 0x802E -#define GL_MINMAX_FORMAT 0x802F -#define GL_MINMAX_SINK 0x8030 -#define GL_TABLE_TOO_LARGE 0x8031 -#define GL_COLOR_MATRIX 0x80B1 -#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 -#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 -#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB -#define GL_COLOR_TABLE 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 -#define GL_PROXY_COLOR_TABLE 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 -#define GL_COLOR_TABLE_SCALE 0x80D6 -#define GL_COLOR_TABLE_BIAS 0x80D7 -#define GL_COLOR_TABLE_FORMAT 0x80D8 -#define GL_COLOR_TABLE_WIDTH 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF -#define GL_CONSTANT_BORDER 0x8151 -#define GL_REPLICATE_BORDER 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR 0x8154 -#endif - -#ifndef GL_VERSION_1_3 -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 -#define GL_MAX_TEXTURE_UNITS 0x84E2 -#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_MULTISAMPLE_BIT 0x20000000 -#define GL_NORMAL_MAP 0x8511 -#define GL_REFLECTION_MAP 0x8512 -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_COMPRESSED_ALPHA 0x84E9 -#define GL_COMPRESSED_LUMINANCE 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB -#define GL_COMPRESSED_INTENSITY 0x84EC -#define GL_COMPRESSED_RGB 0x84ED -#define GL_COMPRESSED_RGBA 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_CLAMP_TO_BORDER 0x812D -#define GL_COMBINE 0x8570 -#define GL_COMBINE_RGB 0x8571 -#define GL_COMBINE_ALPHA 0x8572 -#define GL_SOURCE0_RGB 0x8580 -#define GL_SOURCE1_RGB 0x8581 -#define GL_SOURCE2_RGB 0x8582 -#define GL_SOURCE0_ALPHA 0x8588 -#define GL_SOURCE1_ALPHA 0x8589 -#define GL_SOURCE2_ALPHA 0x858A -#define GL_OPERAND0_RGB 0x8590 -#define GL_OPERAND1_RGB 0x8591 -#define GL_OPERAND2_RGB 0x8592 -#define GL_OPERAND0_ALPHA 0x8598 -#define GL_OPERAND1_ALPHA 0x8599 -#define GL_OPERAND2_ALPHA 0x859A -#define GL_RGB_SCALE 0x8573 -#define GL_ADD_SIGNED 0x8574 -#define GL_INTERPOLATE 0x8575 -#define GL_SUBTRACT 0x84E7 -#define GL_CONSTANT 0x8576 -#define GL_PRIMARY_COLOR 0x8577 -#define GL_PREVIOUS 0x8578 -#define GL_DOT3_RGB 0x86AE -#define GL_DOT3_RGBA 0x86AF -#endif - -#ifndef GL_VERSION_1_4 -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_POINT_SIZE_MIN 0x8126 -#define GL_POINT_SIZE_MAX 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION 0x8129 -#define GL_GENERATE_MIPMAP 0x8191 -#define GL_GENERATE_MIPMAP_HINT 0x8192 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_FOG_COORDINATE_SOURCE 0x8450 -#define GL_FOG_COORDINATE 0x8451 -#define GL_FRAGMENT_DEPTH 0x8452 -#define GL_CURRENT_FOG_COORDINATE 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 -#define GL_FOG_COORDINATE_ARRAY 0x8457 -#define GL_COLOR_SUM 0x8458 -#define GL_CURRENT_SECONDARY_COLOR 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D -#define GL_SECONDARY_COLOR_ARRAY 0x845E -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_FILTER_CONTROL 0x8500 -#define GL_TEXTURE_LOD_BIAS 0x8501 -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_TEXTURE_DEPTH_SIZE 0x884A -#define GL_DEPTH_TEXTURE_MODE 0x884B -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_COMPARE_R_TO_TEXTURE 0x884E -#endif - -#ifndef GL_VERSION_1_5 -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_QUERY_COUNTER_BITS 0x8864 -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_READ_ONLY 0x88B8 -#define GL_WRITE_ONLY 0x88B9 -#define GL_READ_WRITE 0x88BA -#define GL_BUFFER_ACCESS 0x88BB -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_DRAW 0x88E4 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_SAMPLES_PASSED 0x8914 -#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE -#define GL_FOG_COORD GL_FOG_COORDINATE -#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE -#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE -#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE -#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER -#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY -#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING -#define GL_SRC0_RGB GL_SOURCE0_RGB -#define GL_SRC1_RGB GL_SOURCE1_RGB -#define GL_SRC2_RGB GL_SOURCE2_RGB -#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA -#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA -#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA -#endif - -#ifndef GL_VERSION_2_0 -#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_POINT_SPRITE 0x8861 -#define GL_COORD_REPLACE 0x8862 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_MAX_TEXTURE_COORDS 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_SHADER_TYPE 0x8B4F -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_DELETE_STATUS 0x8B80 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_UPPER_LEFT 0x8CA2 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#endif - -#ifndef GL_ARB_multitexture -#define GL_TEXTURE0_ARB 0x84C0 -#define GL_TEXTURE1_ARB 0x84C1 -#define GL_TEXTURE2_ARB 0x84C2 -#define GL_TEXTURE3_ARB 0x84C3 -#define GL_TEXTURE4_ARB 0x84C4 -#define GL_TEXTURE5_ARB 0x84C5 -#define GL_TEXTURE6_ARB 0x84C6 -#define GL_TEXTURE7_ARB 0x84C7 -#define GL_TEXTURE8_ARB 0x84C8 -#define GL_TEXTURE9_ARB 0x84C9 -#define GL_TEXTURE10_ARB 0x84CA -#define GL_TEXTURE11_ARB 0x84CB -#define GL_TEXTURE12_ARB 0x84CC -#define GL_TEXTURE13_ARB 0x84CD -#define GL_TEXTURE14_ARB 0x84CE -#define GL_TEXTURE15_ARB 0x84CF -#define GL_TEXTURE16_ARB 0x84D0 -#define GL_TEXTURE17_ARB 0x84D1 -#define GL_TEXTURE18_ARB 0x84D2 -#define GL_TEXTURE19_ARB 0x84D3 -#define GL_TEXTURE20_ARB 0x84D4 -#define GL_TEXTURE21_ARB 0x84D5 -#define GL_TEXTURE22_ARB 0x84D6 -#define GL_TEXTURE23_ARB 0x84D7 -#define GL_TEXTURE24_ARB 0x84D8 -#define GL_TEXTURE25_ARB 0x84D9 -#define GL_TEXTURE26_ARB 0x84DA -#define GL_TEXTURE27_ARB 0x84DB -#define GL_TEXTURE28_ARB 0x84DC -#define GL_TEXTURE29_ARB 0x84DD -#define GL_TEXTURE30_ARB 0x84DE -#define GL_TEXTURE31_ARB 0x84DF -#define GL_ACTIVE_TEXTURE_ARB 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 -#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 -#endif - -#ifndef GL_ARB_transpose_matrix -#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 -#endif - -#ifndef GL_ARB_multisample -#define GL_MULTISAMPLE_ARB 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F -#define GL_SAMPLE_COVERAGE_ARB 0x80A0 -#define GL_SAMPLE_BUFFERS_ARB 0x80A8 -#define GL_SAMPLES_ARB 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB -#define GL_MULTISAMPLE_BIT_ARB 0x20000000 -#endif - -#ifndef GL_ARB_texture_env_add -#endif - -#ifndef GL_ARB_texture_cube_map -#define GL_NORMAL_MAP_ARB 0x8511 -#define GL_REFLECTION_MAP_ARB 0x8512 -#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C -#endif - -#ifndef GL_ARB_texture_compression -#define GL_COMPRESSED_ALPHA_ARB 0x84E9 -#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB -#define GL_COMPRESSED_INTENSITY_ARB 0x84EC -#define GL_COMPRESSED_RGB_ARB 0x84ED -#define GL_COMPRESSED_RGBA_ARB 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 -#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 -#endif - -#ifndef GL_ARB_texture_border_clamp -#define GL_CLAMP_TO_BORDER_ARB 0x812D -#endif - -#ifndef GL_ARB_point_parameters -#define GL_POINT_SIZE_MIN_ARB 0x8126 -#define GL_POINT_SIZE_MAX_ARB 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 -#endif - -#ifndef GL_ARB_vertex_blend -#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 -#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 -#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 -#define GL_VERTEX_BLEND_ARB 0x86A7 -#define GL_CURRENT_WEIGHT_ARB 0x86A8 -#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 -#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA -#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB -#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC -#define GL_WEIGHT_ARRAY_ARB 0x86AD -#define GL_MODELVIEW0_ARB 0x1700 -#define GL_MODELVIEW1_ARB 0x850A -#define GL_MODELVIEW2_ARB 0x8722 -#define GL_MODELVIEW3_ARB 0x8723 -#define GL_MODELVIEW4_ARB 0x8724 -#define GL_MODELVIEW5_ARB 0x8725 -#define GL_MODELVIEW6_ARB 0x8726 -#define GL_MODELVIEW7_ARB 0x8727 -#define GL_MODELVIEW8_ARB 0x8728 -#define GL_MODELVIEW9_ARB 0x8729 -#define GL_MODELVIEW10_ARB 0x872A -#define GL_MODELVIEW11_ARB 0x872B -#define GL_MODELVIEW12_ARB 0x872C -#define GL_MODELVIEW13_ARB 0x872D -#define GL_MODELVIEW14_ARB 0x872E -#define GL_MODELVIEW15_ARB 0x872F -#define GL_MODELVIEW16_ARB 0x8730 -#define GL_MODELVIEW17_ARB 0x8731 -#define GL_MODELVIEW18_ARB 0x8732 -#define GL_MODELVIEW19_ARB 0x8733 -#define GL_MODELVIEW20_ARB 0x8734 -#define GL_MODELVIEW21_ARB 0x8735 -#define GL_MODELVIEW22_ARB 0x8736 -#define GL_MODELVIEW23_ARB 0x8737 -#define GL_MODELVIEW24_ARB 0x8738 -#define GL_MODELVIEW25_ARB 0x8739 -#define GL_MODELVIEW26_ARB 0x873A -#define GL_MODELVIEW27_ARB 0x873B -#define GL_MODELVIEW28_ARB 0x873C -#define GL_MODELVIEW29_ARB 0x873D -#define GL_MODELVIEW30_ARB 0x873E -#define GL_MODELVIEW31_ARB 0x873F -#endif - -#ifndef GL_ARB_matrix_palette -#define GL_MATRIX_PALETTE_ARB 0x8840 -#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 -#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 -#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 -#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 -#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 -#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 -#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 -#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 -#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 -#endif - -#ifndef GL_ARB_texture_env_combine -#define GL_COMBINE_ARB 0x8570 -#define GL_COMBINE_RGB_ARB 0x8571 -#define GL_COMBINE_ALPHA_ARB 0x8572 -#define GL_SOURCE0_RGB_ARB 0x8580 -#define GL_SOURCE1_RGB_ARB 0x8581 -#define GL_SOURCE2_RGB_ARB 0x8582 -#define GL_SOURCE0_ALPHA_ARB 0x8588 -#define GL_SOURCE1_ALPHA_ARB 0x8589 -#define GL_SOURCE2_ALPHA_ARB 0x858A -#define GL_OPERAND0_RGB_ARB 0x8590 -#define GL_OPERAND1_RGB_ARB 0x8591 -#define GL_OPERAND2_RGB_ARB 0x8592 -#define GL_OPERAND0_ALPHA_ARB 0x8598 -#define GL_OPERAND1_ALPHA_ARB 0x8599 -#define GL_OPERAND2_ALPHA_ARB 0x859A -#define GL_RGB_SCALE_ARB 0x8573 -#define GL_ADD_SIGNED_ARB 0x8574 -#define GL_INTERPOLATE_ARB 0x8575 -#define GL_SUBTRACT_ARB 0x84E7 -#define GL_CONSTANT_ARB 0x8576 -#define GL_PRIMARY_COLOR_ARB 0x8577 -#define GL_PREVIOUS_ARB 0x8578 -#endif - -#ifndef GL_ARB_texture_env_crossbar -#endif - -#ifndef GL_ARB_texture_env_dot3 -#define GL_DOT3_RGB_ARB 0x86AE -#define GL_DOT3_RGBA_ARB 0x86AF -#endif - -#ifndef GL_ARB_texture_mirrored_repeat -#define GL_MIRRORED_REPEAT_ARB 0x8370 -#endif - -#ifndef GL_ARB_depth_texture -#define GL_DEPTH_COMPONENT16_ARB 0x81A5 -#define GL_DEPTH_COMPONENT24_ARB 0x81A6 -#define GL_DEPTH_COMPONENT32_ARB 0x81A7 -#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A -#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B -#endif - -#ifndef GL_ARB_shadow -#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C -#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D -#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E -#endif - -#ifndef GL_ARB_shadow_ambient -#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF -#endif - -#ifndef GL_ARB_window_pos -#endif - -#ifndef GL_ARB_vertex_program -#define GL_COLOR_SUM_ARB 0x8458 -#define GL_VERTEX_PROGRAM_ARB 0x8620 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 -#define GL_PROGRAM_LENGTH_ARB 0x8627 -#define GL_PROGRAM_STRING_ARB 0x8628 -#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E -#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F -#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 -#define GL_CURRENT_MATRIX_ARB 0x8641 -#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 -#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B -#define GL_PROGRAM_BINDING_ARB 0x8677 -#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A -#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 -#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 -#define GL_PROGRAM_FORMAT_ARB 0x8876 -#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 -#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 -#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 -#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 -#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 -#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 -#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 -#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 -#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 -#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 -#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA -#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB -#define GL_PROGRAM_ATTRIBS_ARB 0x88AC -#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD -#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE -#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF -#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 -#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 -#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 -#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 -#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 -#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 -#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 -#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 -#define GL_MATRIX0_ARB 0x88C0 -#define GL_MATRIX1_ARB 0x88C1 -#define GL_MATRIX2_ARB 0x88C2 -#define GL_MATRIX3_ARB 0x88C3 -#define GL_MATRIX4_ARB 0x88C4 -#define GL_MATRIX5_ARB 0x88C5 -#define GL_MATRIX6_ARB 0x88C6 -#define GL_MATRIX7_ARB 0x88C7 -#define GL_MATRIX8_ARB 0x88C8 -#define GL_MATRIX9_ARB 0x88C9 -#define GL_MATRIX10_ARB 0x88CA -#define GL_MATRIX11_ARB 0x88CB -#define GL_MATRIX12_ARB 0x88CC -#define GL_MATRIX13_ARB 0x88CD -#define GL_MATRIX14_ARB 0x88CE -#define GL_MATRIX15_ARB 0x88CF -#define GL_MATRIX16_ARB 0x88D0 -#define GL_MATRIX17_ARB 0x88D1 -#define GL_MATRIX18_ARB 0x88D2 -#define GL_MATRIX19_ARB 0x88D3 -#define GL_MATRIX20_ARB 0x88D4 -#define GL_MATRIX21_ARB 0x88D5 -#define GL_MATRIX22_ARB 0x88D6 -#define GL_MATRIX23_ARB 0x88D7 -#define GL_MATRIX24_ARB 0x88D8 -#define GL_MATRIX25_ARB 0x88D9 -#define GL_MATRIX26_ARB 0x88DA -#define GL_MATRIX27_ARB 0x88DB -#define GL_MATRIX28_ARB 0x88DC -#define GL_MATRIX29_ARB 0x88DD -#define GL_MATRIX30_ARB 0x88DE -#define GL_MATRIX31_ARB 0x88DF -#endif - -#ifndef GL_ARB_fragment_program -#define GL_FRAGMENT_PROGRAM_ARB 0x8804 -#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 -#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 -#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 -#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 -#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 -#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A -#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B -#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C -#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D -#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E -#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F -#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 -#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 -#endif - -#ifndef GL_ARB_vertex_buffer_object -#define GL_BUFFER_SIZE_ARB 0x8764 -#define GL_BUFFER_USAGE_ARB 0x8765 -#define GL_ARRAY_BUFFER_ARB 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 -#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 -#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F -#define GL_READ_ONLY_ARB 0x88B8 -#define GL_WRITE_ONLY_ARB 0x88B9 -#define GL_READ_WRITE_ARB 0x88BA -#define GL_BUFFER_ACCESS_ARB 0x88BB -#define GL_BUFFER_MAPPED_ARB 0x88BC -#define GL_BUFFER_MAP_POINTER_ARB 0x88BD -#define GL_STREAM_DRAW_ARB 0x88E0 -#define GL_STREAM_READ_ARB 0x88E1 -#define GL_STREAM_COPY_ARB 0x88E2 -#define GL_STATIC_DRAW_ARB 0x88E4 -#define GL_STATIC_READ_ARB 0x88E5 -#define GL_STATIC_COPY_ARB 0x88E6 -#define GL_DYNAMIC_DRAW_ARB 0x88E8 -#define GL_DYNAMIC_READ_ARB 0x88E9 -#define GL_DYNAMIC_COPY_ARB 0x88EA -#endif - -#ifndef GL_ARB_occlusion_query -#define GL_QUERY_COUNTER_BITS_ARB 0x8864 -#define GL_CURRENT_QUERY_ARB 0x8865 -#define GL_QUERY_RESULT_ARB 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 -#define GL_SAMPLES_PASSED_ARB 0x8914 -#endif - -#ifndef GL_ARB_shader_objects -#define GL_PROGRAM_OBJECT_ARB 0x8B40 -#define GL_SHADER_OBJECT_ARB 0x8B48 -#define GL_OBJECT_TYPE_ARB 0x8B4E -#define GL_OBJECT_SUBTYPE_ARB 0x8B4F -#define GL_FLOAT_VEC2_ARB 0x8B50 -#define GL_FLOAT_VEC3_ARB 0x8B51 -#define GL_FLOAT_VEC4_ARB 0x8B52 -#define GL_INT_VEC2_ARB 0x8B53 -#define GL_INT_VEC3_ARB 0x8B54 -#define GL_INT_VEC4_ARB 0x8B55 -#define GL_BOOL_ARB 0x8B56 -#define GL_BOOL_VEC2_ARB 0x8B57 -#define GL_BOOL_VEC3_ARB 0x8B58 -#define GL_BOOL_VEC4_ARB 0x8B59 -#define GL_FLOAT_MAT2_ARB 0x8B5A -#define GL_FLOAT_MAT3_ARB 0x8B5B -#define GL_FLOAT_MAT4_ARB 0x8B5C -#define GL_SAMPLER_1D_ARB 0x8B5D -#define GL_SAMPLER_2D_ARB 0x8B5E -#define GL_SAMPLER_3D_ARB 0x8B5F -#define GL_SAMPLER_CUBE_ARB 0x8B60 -#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 -#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 -#define GL_SAMPLER_2D_RECT_ARB 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 -#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 -#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 -#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 -#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 -#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 -#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 -#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 -#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 -#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 -#endif - -#ifndef GL_ARB_vertex_shader -#define GL_VERTEX_SHADER_ARB 0x8B31 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A -#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D -#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 -#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A -#endif - -#ifndef GL_ARB_fragment_shader -#define GL_FRAGMENT_SHADER_ARB 0x8B30 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B -#endif - -#ifndef GL_ARB_shading_language_100 -#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C -#endif - -#ifndef GL_ARB_texture_non_power_of_two -#endif - -#ifndef GL_ARB_point_sprite -#define GL_POINT_SPRITE_ARB 0x8861 -#define GL_COORD_REPLACE_ARB 0x8862 -#endif - -#ifndef GL_ARB_fragment_program_shadow -#endif - -#ifndef GL_ARB_draw_buffers -#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 -#define GL_DRAW_BUFFER0_ARB 0x8825 -#define GL_DRAW_BUFFER1_ARB 0x8826 -#define GL_DRAW_BUFFER2_ARB 0x8827 -#define GL_DRAW_BUFFER3_ARB 0x8828 -#define GL_DRAW_BUFFER4_ARB 0x8829 -#define GL_DRAW_BUFFER5_ARB 0x882A -#define GL_DRAW_BUFFER6_ARB 0x882B -#define GL_DRAW_BUFFER7_ARB 0x882C -#define GL_DRAW_BUFFER8_ARB 0x882D -#define GL_DRAW_BUFFER9_ARB 0x882E -#define GL_DRAW_BUFFER10_ARB 0x882F -#define GL_DRAW_BUFFER11_ARB 0x8830 -#define GL_DRAW_BUFFER12_ARB 0x8831 -#define GL_DRAW_BUFFER13_ARB 0x8832 -#define GL_DRAW_BUFFER14_ARB 0x8833 -#define GL_DRAW_BUFFER15_ARB 0x8834 -#endif - -#ifndef GL_ARB_texture_rectangle -#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 -#endif - -#ifndef GL_ARB_color_buffer_float -#define GL_RGBA_FLOAT_MODE_ARB 0x8820 -#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A -#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B -#define GL_CLAMP_READ_COLOR_ARB 0x891C -#define GL_FIXED_ONLY_ARB 0x891D -#endif - -#ifndef GL_ARB_half_float_pixel -#define GL_HALF_FLOAT_ARB 0x140B -#endif - -#ifndef GL_ARB_texture_float -#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 -#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 -#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 -#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 -#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 -#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 -#define GL_RGBA32F_ARB 0x8814 -#define GL_RGB32F_ARB 0x8815 -#define GL_ALPHA32F_ARB 0x8816 -#define GL_INTENSITY32F_ARB 0x8817 -#define GL_LUMINANCE32F_ARB 0x8818 -#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 -#define GL_RGBA16F_ARB 0x881A -#define GL_RGB16F_ARB 0x881B -#define GL_ALPHA16F_ARB 0x881C -#define GL_INTENSITY16F_ARB 0x881D -#define GL_LUMINANCE16F_ARB 0x881E -#define GL_LUMINANCE_ALPHA16F_ARB 0x881F -#endif - -#ifndef GL_ARB_pixel_buffer_object -#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF -#endif - -#ifndef GL_EXT_abgr -#define GL_ABGR_EXT 0x8000 -#endif - -#ifndef GL_EXT_blend_color -#define GL_CONSTANT_COLOR_EXT 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 -#define GL_CONSTANT_ALPHA_EXT 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 -#define GL_BLEND_COLOR_EXT 0x8005 -#endif - -#ifndef GL_EXT_polygon_offset -#define GL_POLYGON_OFFSET_EXT 0x8037 -#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 -#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 -#endif - -#ifndef GL_EXT_texture -#define GL_ALPHA4_EXT 0x803B -#define GL_ALPHA8_EXT 0x803C -#define GL_ALPHA12_EXT 0x803D -#define GL_ALPHA16_EXT 0x803E -#define GL_LUMINANCE4_EXT 0x803F -#define GL_LUMINANCE8_EXT 0x8040 -#define GL_LUMINANCE12_EXT 0x8041 -#define GL_LUMINANCE16_EXT 0x8042 -#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 -#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 -#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 -#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 -#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 -#define GL_INTENSITY_EXT 0x8049 -#define GL_INTENSITY4_EXT 0x804A -#define GL_INTENSITY8_EXT 0x804B -#define GL_INTENSITY12_EXT 0x804C -#define GL_INTENSITY16_EXT 0x804D -#define GL_RGB2_EXT 0x804E -#define GL_RGB4_EXT 0x804F -#define GL_RGB5_EXT 0x8050 -#define GL_RGB8_EXT 0x8051 -#define GL_RGB10_EXT 0x8052 -#define GL_RGB12_EXT 0x8053 -#define GL_RGB16_EXT 0x8054 -#define GL_RGBA2_EXT 0x8055 -#define GL_RGBA4_EXT 0x8056 -#define GL_RGB5_A1_EXT 0x8057 -#define GL_RGBA8_EXT 0x8058 -#define GL_RGB10_A2_EXT 0x8059 -#define GL_RGBA12_EXT 0x805A -#define GL_RGBA16_EXT 0x805B -#define GL_TEXTURE_RED_SIZE_EXT 0x805C -#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D -#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E -#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F -#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 -#define GL_REPLACE_EXT 0x8062 -#define GL_PROXY_TEXTURE_1D_EXT 0x8063 -#define GL_PROXY_TEXTURE_2D_EXT 0x8064 -#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 -#endif - -#ifndef GL_EXT_texture3D -#define GL_PACK_SKIP_IMAGES_EXT 0x806B -#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C -#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D -#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E -#define GL_TEXTURE_3D_EXT 0x806F -#define GL_PROXY_TEXTURE_3D_EXT 0x8070 -#define GL_TEXTURE_DEPTH_EXT 0x8071 -#define GL_TEXTURE_WRAP_R_EXT 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 -#endif - -#ifndef GL_SGIS_texture_filter4 -#define GL_FILTER4_SGIS 0x8146 -#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 -#endif - -#ifndef GL_EXT_subtexture -#endif - -#ifndef GL_EXT_copy_texture -#endif - -#ifndef GL_EXT_histogram -#define GL_HISTOGRAM_EXT 0x8024 -#define GL_PROXY_HISTOGRAM_EXT 0x8025 -#define GL_HISTOGRAM_WIDTH_EXT 0x8026 -#define GL_HISTOGRAM_FORMAT_EXT 0x8027 -#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A -#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B -#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C -#define GL_HISTOGRAM_SINK_EXT 0x802D -#define GL_MINMAX_EXT 0x802E -#define GL_MINMAX_FORMAT_EXT 0x802F -#define GL_MINMAX_SINK_EXT 0x8030 -#define GL_TABLE_TOO_LARGE_EXT 0x8031 -#endif - -#ifndef GL_EXT_convolution -#define GL_CONVOLUTION_1D_EXT 0x8010 -#define GL_CONVOLUTION_2D_EXT 0x8011 -#define GL_SEPARABLE_2D_EXT 0x8012 -#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 -#define GL_REDUCE_EXT 0x8016 -#define GL_CONVOLUTION_FORMAT_EXT 0x8017 -#define GL_CONVOLUTION_WIDTH_EXT 0x8018 -#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A -#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B -#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C -#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D -#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E -#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F -#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 -#endif - -#ifndef GL_SGI_color_matrix -#define GL_COLOR_MATRIX_SGI 0x80B1 -#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 -#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 -#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB -#endif - -#ifndef GL_SGI_color_table -#define GL_COLOR_TABLE_SGI 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 -#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 -#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 -#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 -#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 -#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF -#endif - -#ifndef GL_SGIS_pixel_texture -#define GL_PIXEL_TEXTURE_SGIS 0x8353 -#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 -#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 -#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 -#endif - -#ifndef GL_SGIX_pixel_texture -#define GL_PIXEL_TEX_GEN_SGIX 0x8139 -#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B -#endif - -#ifndef GL_SGIS_texture4D -#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 -#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 -#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 -#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 -#define GL_TEXTURE_4D_SGIS 0x8134 -#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 -#define GL_TEXTURE_4DSIZE_SGIS 0x8136 -#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 -#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 -#define GL_TEXTURE_4D_BINDING_SGIS 0x814F -#endif - -#ifndef GL_SGI_texture_color_table -#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC -#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD -#endif - -#ifndef GL_EXT_cmyka -#define GL_CMYK_EXT 0x800C -#define GL_CMYKA_EXT 0x800D -#define GL_PACK_CMYK_HINT_EXT 0x800E -#define GL_UNPACK_CMYK_HINT_EXT 0x800F -#endif - -#ifndef GL_EXT_texture_object -#define GL_TEXTURE_PRIORITY_EXT 0x8066 -#define GL_TEXTURE_RESIDENT_EXT 0x8067 -#define GL_TEXTURE_1D_BINDING_EXT 0x8068 -#define GL_TEXTURE_2D_BINDING_EXT 0x8069 -#define GL_TEXTURE_3D_BINDING_EXT 0x806A -#endif - -#ifndef GL_SGIS_detail_texture -#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 -#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 -#define GL_LINEAR_DETAIL_SGIS 0x8097 -#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 -#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 -#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A -#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B -#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C -#endif - -#ifndef GL_SGIS_sharpen_texture -#define GL_LINEAR_SHARPEN_SGIS 0x80AD -#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE -#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF -#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 -#endif - -#ifndef GL_EXT_packed_pixels -#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 -#endif - -#ifndef GL_SGIS_texture_lod -#define GL_TEXTURE_MIN_LOD_SGIS 0x813A -#define GL_TEXTURE_MAX_LOD_SGIS 0x813B -#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C -#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D -#endif - -#ifndef GL_SGIS_multisample -#define GL_MULTISAMPLE_SGIS 0x809D -#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F -#define GL_SAMPLE_MASK_SGIS 0x80A0 -#define GL_1PASS_SGIS 0x80A1 -#define GL_2PASS_0_SGIS 0x80A2 -#define GL_2PASS_1_SGIS 0x80A3 -#define GL_4PASS_0_SGIS 0x80A4 -#define GL_4PASS_1_SGIS 0x80A5 -#define GL_4PASS_2_SGIS 0x80A6 -#define GL_4PASS_3_SGIS 0x80A7 -#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 -#define GL_SAMPLES_SGIS 0x80A9 -#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA -#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB -#define GL_SAMPLE_PATTERN_SGIS 0x80AC -#endif - -#ifndef GL_EXT_rescale_normal -#define GL_RESCALE_NORMAL_EXT 0x803A -#endif - -#ifndef GL_EXT_vertex_array -#define GL_VERTEX_ARRAY_EXT 0x8074 -#define GL_NORMAL_ARRAY_EXT 0x8075 -#define GL_COLOR_ARRAY_EXT 0x8076 -#define GL_INDEX_ARRAY_EXT 0x8077 -#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 -#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 -#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A -#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B -#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C -#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D -#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E -#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F -#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 -#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 -#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 -#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 -#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 -#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 -#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 -#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 -#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A -#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B -#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C -#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D -#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E -#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F -#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 -#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 -#endif - -#ifndef GL_EXT_misc_attribute -#endif - -#ifndef GL_SGIS_generate_mipmap -#define GL_GENERATE_MIPMAP_SGIS 0x8191 -#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 -#endif - -#ifndef GL_SGIX_clipmap -#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 -#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 -#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 -#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 -#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 -#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 -#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 -#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 -#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 -#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D -#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E -#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F -#endif - -#ifndef GL_SGIX_shadow -#define GL_TEXTURE_COMPARE_SGIX 0x819A -#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B -#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C -#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D -#endif - -#ifndef GL_SGIS_texture_edge_clamp -#define GL_CLAMP_TO_EDGE_SGIS 0x812F -#endif - -#ifndef GL_SGIS_texture_border_clamp -#define GL_CLAMP_TO_BORDER_SGIS 0x812D -#endif - -#ifndef GL_EXT_blend_minmax -#define GL_FUNC_ADD_EXT 0x8006 -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#define GL_BLEND_EQUATION_EXT 0x8009 -#endif - -#ifndef GL_EXT_blend_subtract -#define GL_FUNC_SUBTRACT_EXT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B -#endif - -#ifndef GL_EXT_blend_logic_op -#endif - -#ifndef GL_SGIX_interlace -#define GL_INTERLACE_SGIX 0x8094 -#endif - -#ifndef GL_SGIX_pixel_tiles -#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E -#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F -#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 -#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 -#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 -#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 -#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 -#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 -#endif - -#ifndef GL_SGIS_texture_select -#define GL_DUAL_ALPHA4_SGIS 0x8110 -#define GL_DUAL_ALPHA8_SGIS 0x8111 -#define GL_DUAL_ALPHA12_SGIS 0x8112 -#define GL_DUAL_ALPHA16_SGIS 0x8113 -#define GL_DUAL_LUMINANCE4_SGIS 0x8114 -#define GL_DUAL_LUMINANCE8_SGIS 0x8115 -#define GL_DUAL_LUMINANCE12_SGIS 0x8116 -#define GL_DUAL_LUMINANCE16_SGIS 0x8117 -#define GL_DUAL_INTENSITY4_SGIS 0x8118 -#define GL_DUAL_INTENSITY8_SGIS 0x8119 -#define GL_DUAL_INTENSITY12_SGIS 0x811A -#define GL_DUAL_INTENSITY16_SGIS 0x811B -#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C -#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D -#define GL_QUAD_ALPHA4_SGIS 0x811E -#define GL_QUAD_ALPHA8_SGIS 0x811F -#define GL_QUAD_LUMINANCE4_SGIS 0x8120 -#define GL_QUAD_LUMINANCE8_SGIS 0x8121 -#define GL_QUAD_INTENSITY4_SGIS 0x8122 -#define GL_QUAD_INTENSITY8_SGIS 0x8123 -#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 -#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 -#endif - -#ifndef GL_SGIX_sprite -#define GL_SPRITE_SGIX 0x8148 -#define GL_SPRITE_MODE_SGIX 0x8149 -#define GL_SPRITE_AXIS_SGIX 0x814A -#define GL_SPRITE_TRANSLATION_SGIX 0x814B -#define GL_SPRITE_AXIAL_SGIX 0x814C -#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D -#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E -#endif - -#ifndef GL_SGIX_texture_multi_buffer -#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E -#endif - -#ifndef GL_EXT_point_parameters -#define GL_POINT_SIZE_MIN_EXT 0x8126 -#define GL_POINT_SIZE_MAX_EXT 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 -#define GL_DISTANCE_ATTENUATION_EXT 0x8129 -#endif - -#ifndef GL_SGIS_point_parameters -#define GL_POINT_SIZE_MIN_SGIS 0x8126 -#define GL_POINT_SIZE_MAX_SGIS 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 -#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 -#endif - -#ifndef GL_SGIX_instruments -#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 -#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 -#endif - -#ifndef GL_SGIX_texture_scale_bias -#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 -#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A -#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B -#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C -#endif - -#ifndef GL_SGIX_framezoom -#define GL_FRAMEZOOM_SGIX 0x818B -#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C -#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D -#endif - -#ifndef GL_SGIX_tag_sample_buffer -#endif - -#ifndef GL_FfdMaskSGIX -#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 -#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 -#endif - -#ifndef GL_SGIX_polynomial_ffd -#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 -#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 -#define GL_DEFORMATIONS_MASK_SGIX 0x8196 -#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 -#endif - -#ifndef GL_SGIX_reference_plane -#define GL_REFERENCE_PLANE_SGIX 0x817D -#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E -#endif - -#ifndef GL_SGIX_flush_raster -#endif - -#ifndef GL_SGIX_depth_texture -#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 -#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 -#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 -#endif - -#ifndef GL_SGIS_fog_function -#define GL_FOG_FUNC_SGIS 0x812A -#define GL_FOG_FUNC_POINTS_SGIS 0x812B -#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C -#endif - -#ifndef GL_SGIX_fog_offset -#define GL_FOG_OFFSET_SGIX 0x8198 -#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 -#endif - -#ifndef GL_HP_image_transform -#define GL_IMAGE_SCALE_X_HP 0x8155 -#define GL_IMAGE_SCALE_Y_HP 0x8156 -#define GL_IMAGE_TRANSLATE_X_HP 0x8157 -#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 -#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 -#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A -#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B -#define GL_IMAGE_MAG_FILTER_HP 0x815C -#define GL_IMAGE_MIN_FILTER_HP 0x815D -#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E -#define GL_CUBIC_HP 0x815F -#define GL_AVERAGE_HP 0x8160 -#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 -#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 -#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 -#endif - -#ifndef GL_HP_convolution_border_modes -#define GL_IGNORE_BORDER_HP 0x8150 -#define GL_CONSTANT_BORDER_HP 0x8151 -#define GL_REPLICATE_BORDER_HP 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 -#endif - -#ifndef GL_INGR_palette_buffer -#endif - -#ifndef GL_SGIX_texture_add_env -#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE -#endif - -#ifndef GL_EXT_color_subtable -#endif - -#ifndef GL_PGI_vertex_hints -#define GL_VERTEX_DATA_HINT_PGI 0x1A22A -#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B -#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C -#define GL_MAX_VERTEX_HINT_PGI 0x1A22D -#define GL_COLOR3_BIT_PGI 0x00010000 -#define GL_COLOR4_BIT_PGI 0x00020000 -#define GL_EDGEFLAG_BIT_PGI 0x00040000 -#define GL_INDEX_BIT_PGI 0x00080000 -#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 -#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 -#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 -#define GL_MAT_EMISSION_BIT_PGI 0x00800000 -#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 -#define GL_MAT_SHININESS_BIT_PGI 0x02000000 -#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 -#define GL_NORMAL_BIT_PGI 0x08000000 -#define GL_TEXCOORD1_BIT_PGI 0x10000000 -#define GL_TEXCOORD2_BIT_PGI 0x20000000 -#define GL_TEXCOORD3_BIT_PGI 0x40000000 -#define GL_TEXCOORD4_BIT_PGI 0x80000000 -#define GL_VERTEX23_BIT_PGI 0x00000004 -#define GL_VERTEX4_BIT_PGI 0x00000008 -#endif - -#ifndef GL_PGI_misc_hints -#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 -#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD -#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE -#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 -#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 -#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 -#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C -#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D -#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E -#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F -#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 -#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 -#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 -#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 -#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 -#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 -#define GL_CLIP_NEAR_HINT_PGI 0x1A220 -#define GL_CLIP_FAR_HINT_PGI 0x1A221 -#define GL_WIDE_LINE_HINT_PGI 0x1A222 -#define GL_BACK_NORMALS_HINT_PGI 0x1A223 -#endif - -#ifndef GL_EXT_paletted_texture -#define GL_COLOR_INDEX1_EXT 0x80E2 -#define GL_COLOR_INDEX2_EXT 0x80E3 -#define GL_COLOR_INDEX4_EXT 0x80E4 -#define GL_COLOR_INDEX8_EXT 0x80E5 -#define GL_COLOR_INDEX12_EXT 0x80E6 -#define GL_COLOR_INDEX16_EXT 0x80E7 -#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED -#endif - -#ifndef GL_EXT_clip_volume_hint -#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 -#endif - -#ifndef GL_SGIX_list_priority -#define GL_LIST_PRIORITY_SGIX 0x8182 -#endif - -#ifndef GL_SGIX_ir_instrument1 -#define GL_IR_INSTRUMENT1_SGIX 0x817F -#endif - -#ifndef GL_SGIX_calligraphic_fragment -#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 -#endif - -#ifndef GL_SGIX_texture_lod_bias -#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E -#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F -#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 -#endif - -#ifndef GL_SGIX_shadow_ambient -#define GL_SHADOW_AMBIENT_SGIX 0x80BF -#endif - -#ifndef GL_EXT_index_texture -#endif - -#ifndef GL_EXT_index_material -#define GL_INDEX_MATERIAL_EXT 0x81B8 -#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 -#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA -#endif - -#ifndef GL_EXT_index_func -#define GL_INDEX_TEST_EXT 0x81B5 -#define GL_INDEX_TEST_FUNC_EXT 0x81B6 -#define GL_INDEX_TEST_REF_EXT 0x81B7 -#endif - -#ifndef GL_EXT_index_array_formats -#define GL_IUI_V2F_EXT 0x81AD -#define GL_IUI_V3F_EXT 0x81AE -#define GL_IUI_N3F_V2F_EXT 0x81AF -#define GL_IUI_N3F_V3F_EXT 0x81B0 -#define GL_T2F_IUI_V2F_EXT 0x81B1 -#define GL_T2F_IUI_V3F_EXT 0x81B2 -#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 -#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 -#endif - -#ifndef GL_EXT_compiled_vertex_array -#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 -#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 -#endif - -#ifndef GL_EXT_cull_vertex -#define GL_CULL_VERTEX_EXT 0x81AA -#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB -#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC -#endif - -#ifndef GL_SGIX_ycrcb -#define GL_YCRCB_422_SGIX 0x81BB -#define GL_YCRCB_444_SGIX 0x81BC -#endif - -#ifndef GL_SGIX_fragment_lighting -#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 -#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 -#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 -#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 -#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 -#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 -#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 -#define GL_LIGHT_ENV_MODE_SGIX 0x8407 -#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 -#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 -#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A -#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B -#define GL_FRAGMENT_LIGHT0_SGIX 0x840C -#define GL_FRAGMENT_LIGHT1_SGIX 0x840D -#define GL_FRAGMENT_LIGHT2_SGIX 0x840E -#define GL_FRAGMENT_LIGHT3_SGIX 0x840F -#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 -#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 -#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 -#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 -#endif - -#ifndef GL_IBM_rasterpos_clip -#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 -#endif - -#ifndef GL_HP_texture_lighting -#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 -#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 -#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 -#endif - -#ifndef GL_EXT_draw_range_elements -#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 -#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 -#endif - -#ifndef GL_WIN_phong_shading -#define GL_PHONG_WIN 0x80EA -#define GL_PHONG_HINT_WIN 0x80EB -#endif - -#ifndef GL_WIN_specular_fog -#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC -#endif - -#ifndef GL_EXT_light_texture -#define GL_FRAGMENT_MATERIAL_EXT 0x8349 -#define GL_FRAGMENT_NORMAL_EXT 0x834A -#define GL_FRAGMENT_COLOR_EXT 0x834C -#define GL_ATTENUATION_EXT 0x834D -#define GL_SHADOW_ATTENUATION_EXT 0x834E -#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F -#define GL_TEXTURE_LIGHT_EXT 0x8350 -#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 -#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 -/* reuse GL_FRAGMENT_DEPTH_EXT */ -#endif - -#ifndef GL_SGIX_blend_alpha_minmax -#define GL_ALPHA_MIN_SGIX 0x8320 -#define GL_ALPHA_MAX_SGIX 0x8321 -#endif - -#ifndef GL_SGIX_impact_pixel_texture -#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 -#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 -#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 -#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 -#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 -#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 -#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A -#endif - -#ifndef GL_EXT_bgra -#define GL_BGR_EXT 0x80E0 -#define GL_BGRA_EXT 0x80E1 -#endif - -#ifndef GL_SGIX_async -#define GL_ASYNC_MARKER_SGIX 0x8329 -#endif - -#ifndef GL_SGIX_async_pixel -#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C -#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D -#define GL_ASYNC_READ_PIXELS_SGIX 0x835E -#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F -#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 -#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 -#endif - -#ifndef GL_SGIX_async_histogram -#define GL_ASYNC_HISTOGRAM_SGIX 0x832C -#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D -#endif - -#ifndef GL_INTEL_texture_scissor -#endif - -#ifndef GL_INTEL_parallel_arrays -#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 -#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 -#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 -#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 -#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 -#endif - -#ifndef GL_HP_occlusion_test -#define GL_OCCLUSION_TEST_HP 0x8165 -#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 -#endif - -#ifndef GL_EXT_pixel_transform -#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 -#define GL_PIXEL_MAG_FILTER_EXT 0x8331 -#define GL_PIXEL_MIN_FILTER_EXT 0x8332 -#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 -#define GL_CUBIC_EXT 0x8334 -#define GL_AVERAGE_EXT 0x8335 -#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 -#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 -#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 -#endif - -#ifndef GL_EXT_pixel_transform_color_table -#endif - -#ifndef GL_EXT_shared_texture_palette -#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB -#endif - -#ifndef GL_EXT_separate_specular_color -#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 -#define GL_SINGLE_COLOR_EXT 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA -#endif - -#ifndef GL_EXT_secondary_color -#define GL_COLOR_SUM_EXT 0x8458 -#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D -#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E -#endif - -#ifndef GL_EXT_texture_perturb_normal -#define GL_PERTURB_EXT 0x85AE -#define GL_TEXTURE_NORMAL_EXT 0x85AF -#endif - -#ifndef GL_EXT_multi_draw_arrays -#endif - -#ifndef GL_EXT_fog_coord -#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 -#define GL_FOG_COORDINATE_EXT 0x8451 -#define GL_FRAGMENT_DEPTH_EXT 0x8452 -#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 -#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 -#endif - -#ifndef GL_REND_screen_coordinates -#define GL_SCREEN_COORDINATES_REND 0x8490 -#define GL_INVERTED_SCREEN_W_REND 0x8491 -#endif - -#ifndef GL_EXT_coordinate_frame -#define GL_TANGENT_ARRAY_EXT 0x8439 -#define GL_BINORMAL_ARRAY_EXT 0x843A -#define GL_CURRENT_TANGENT_EXT 0x843B -#define GL_CURRENT_BINORMAL_EXT 0x843C -#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E -#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F -#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 -#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 -#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 -#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 -#define GL_MAP1_TANGENT_EXT 0x8444 -#define GL_MAP2_TANGENT_EXT 0x8445 -#define GL_MAP1_BINORMAL_EXT 0x8446 -#define GL_MAP2_BINORMAL_EXT 0x8447 -#endif - -#ifndef GL_EXT_texture_env_combine -#define GL_COMBINE_EXT 0x8570 -#define GL_COMBINE_RGB_EXT 0x8571 -#define GL_COMBINE_ALPHA_EXT 0x8572 -#define GL_RGB_SCALE_EXT 0x8573 -#define GL_ADD_SIGNED_EXT 0x8574 -#define GL_INTERPOLATE_EXT 0x8575 -#define GL_CONSTANT_EXT 0x8576 -#define GL_PRIMARY_COLOR_EXT 0x8577 -#define GL_PREVIOUS_EXT 0x8578 -#define GL_SOURCE0_RGB_EXT 0x8580 -#define GL_SOURCE1_RGB_EXT 0x8581 -#define GL_SOURCE2_RGB_EXT 0x8582 -#define GL_SOURCE0_ALPHA_EXT 0x8588 -#define GL_SOURCE1_ALPHA_EXT 0x8589 -#define GL_SOURCE2_ALPHA_EXT 0x858A -#define GL_OPERAND0_RGB_EXT 0x8590 -#define GL_OPERAND1_RGB_EXT 0x8591 -#define GL_OPERAND2_RGB_EXT 0x8592 -#define GL_OPERAND0_ALPHA_EXT 0x8598 -#define GL_OPERAND1_ALPHA_EXT 0x8599 -#define GL_OPERAND2_ALPHA_EXT 0x859A -#endif - -#ifndef GL_APPLE_specular_vector -#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 -#endif - -#ifndef GL_APPLE_transform_hint -#define GL_TRANSFORM_HINT_APPLE 0x85B1 -#endif - -#ifndef GL_SGIX_fog_scale -#define GL_FOG_SCALE_SGIX 0x81FC -#define GL_FOG_SCALE_VALUE_SGIX 0x81FD -#endif - -#ifndef GL_SUNX_constant_data -#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 -#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 -#endif - -#ifndef GL_SUN_global_alpha -#define GL_GLOBAL_ALPHA_SUN 0x81D9 -#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA -#endif - -#ifndef GL_SUN_triangle_list -#define GL_RESTART_SUN 0x0001 -#define GL_REPLACE_MIDDLE_SUN 0x0002 -#define GL_REPLACE_OLDEST_SUN 0x0003 -#define GL_TRIANGLE_LIST_SUN 0x81D7 -#define GL_REPLACEMENT_CODE_SUN 0x81D8 -#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 -#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 -#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 -#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 -#define GL_R1UI_V3F_SUN 0x85C4 -#define GL_R1UI_C4UB_V3F_SUN 0x85C5 -#define GL_R1UI_C3F_V3F_SUN 0x85C6 -#define GL_R1UI_N3F_V3F_SUN 0x85C7 -#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 -#define GL_R1UI_T2F_V3F_SUN 0x85C9 -#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA -#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB -#endif - -#ifndef GL_SUN_vertex -#endif - -#ifndef GL_EXT_blend_func_separate -#define GL_BLEND_DST_RGB_EXT 0x80C8 -#define GL_BLEND_SRC_RGB_EXT 0x80C9 -#define GL_BLEND_DST_ALPHA_EXT 0x80CA -#define GL_BLEND_SRC_ALPHA_EXT 0x80CB -#endif - -#ifndef GL_INGR_color_clamp -#define GL_RED_MIN_CLAMP_INGR 0x8560 -#define GL_GREEN_MIN_CLAMP_INGR 0x8561 -#define GL_BLUE_MIN_CLAMP_INGR 0x8562 -#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 -#define GL_RED_MAX_CLAMP_INGR 0x8564 -#define GL_GREEN_MAX_CLAMP_INGR 0x8565 -#define GL_BLUE_MAX_CLAMP_INGR 0x8566 -#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 -#endif - -#ifndef GL_INGR_interlace_read -#define GL_INTERLACE_READ_INGR 0x8568 -#endif - -#ifndef GL_EXT_stencil_wrap -#define GL_INCR_WRAP_EXT 0x8507 -#define GL_DECR_WRAP_EXT 0x8508 -#endif - -#ifndef GL_EXT_422_pixels -#define GL_422_EXT 0x80CC -#define GL_422_REV_EXT 0x80CD -#define GL_422_AVERAGE_EXT 0x80CE -#define GL_422_REV_AVERAGE_EXT 0x80CF -#endif - -#ifndef GL_NV_texgen_reflection -#define GL_NORMAL_MAP_NV 0x8511 -#define GL_REFLECTION_MAP_NV 0x8512 -#endif - -#ifndef GL_EXT_texture_cube_map -#define GL_NORMAL_MAP_EXT 0x8511 -#define GL_REFLECTION_MAP_EXT 0x8512 -#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C -#endif - -#ifndef GL_SUN_convolution_border_modes -#define GL_WRAP_BORDER_SUN 0x81D4 -#endif - -#ifndef GL_EXT_texture_env_add -#endif - -#ifndef GL_EXT_texture_lod_bias -#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD -#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 -#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 -#endif - -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF -#endif - -#ifndef GL_EXT_vertex_weighting -#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH -#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 -#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX -#define GL_MODELVIEW1_MATRIX_EXT 0x8506 -#define GL_VERTEX_WEIGHTING_EXT 0x8509 -#define GL_MODELVIEW0_EXT GL_MODELVIEW -#define GL_MODELVIEW1_EXT 0x850A -#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B -#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C -#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D -#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E -#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F -#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 -#endif - -#ifndef GL_NV_light_max_exponent -#define GL_MAX_SHININESS_NV 0x8504 -#define GL_MAX_SPOT_EXPONENT_NV 0x8505 -#endif - -#ifndef GL_NV_vertex_array_range -#define GL_VERTEX_ARRAY_RANGE_NV 0x851D -#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E -#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F -#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 -#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 -#endif - -#ifndef GL_NV_register_combiners -#define GL_REGISTER_COMBINERS_NV 0x8522 -#define GL_VARIABLE_A_NV 0x8523 -#define GL_VARIABLE_B_NV 0x8524 -#define GL_VARIABLE_C_NV 0x8525 -#define GL_VARIABLE_D_NV 0x8526 -#define GL_VARIABLE_E_NV 0x8527 -#define GL_VARIABLE_F_NV 0x8528 -#define GL_VARIABLE_G_NV 0x8529 -#define GL_CONSTANT_COLOR0_NV 0x852A -#define GL_CONSTANT_COLOR1_NV 0x852B -#define GL_PRIMARY_COLOR_NV 0x852C -#define GL_SECONDARY_COLOR_NV 0x852D -#define GL_SPARE0_NV 0x852E -#define GL_SPARE1_NV 0x852F -#define GL_DISCARD_NV 0x8530 -#define GL_E_TIMES_F_NV 0x8531 -#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 -#define GL_UNSIGNED_IDENTITY_NV 0x8536 -#define GL_UNSIGNED_INVERT_NV 0x8537 -#define GL_EXPAND_NORMAL_NV 0x8538 -#define GL_EXPAND_NEGATE_NV 0x8539 -#define GL_HALF_BIAS_NORMAL_NV 0x853A -#define GL_HALF_BIAS_NEGATE_NV 0x853B -#define GL_SIGNED_IDENTITY_NV 0x853C -#define GL_SIGNED_NEGATE_NV 0x853D -#define GL_SCALE_BY_TWO_NV 0x853E -#define GL_SCALE_BY_FOUR_NV 0x853F -#define GL_SCALE_BY_ONE_HALF_NV 0x8540 -#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 -#define GL_COMBINER_INPUT_NV 0x8542 -#define GL_COMBINER_MAPPING_NV 0x8543 -#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 -#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 -#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 -#define GL_COMBINER_MUX_SUM_NV 0x8547 -#define GL_COMBINER_SCALE_NV 0x8548 -#define GL_COMBINER_BIAS_NV 0x8549 -#define GL_COMBINER_AB_OUTPUT_NV 0x854A -#define GL_COMBINER_CD_OUTPUT_NV 0x854B -#define GL_COMBINER_SUM_OUTPUT_NV 0x854C -#define GL_MAX_GENERAL_COMBINERS_NV 0x854D -#define GL_NUM_GENERAL_COMBINERS_NV 0x854E -#define GL_COLOR_SUM_CLAMP_NV 0x854F -#define GL_COMBINER0_NV 0x8550 -#define GL_COMBINER1_NV 0x8551 -#define GL_COMBINER2_NV 0x8552 -#define GL_COMBINER3_NV 0x8553 -#define GL_COMBINER4_NV 0x8554 -#define GL_COMBINER5_NV 0x8555 -#define GL_COMBINER6_NV 0x8556 -#define GL_COMBINER7_NV 0x8557 -/* reuse GL_TEXTURE0_ARB */ -/* reuse GL_TEXTURE1_ARB */ -/* reuse GL_ZERO */ -/* reuse GL_NONE */ -/* reuse GL_FOG */ -#endif - -#ifndef GL_NV_fog_distance -#define GL_FOG_DISTANCE_MODE_NV 0x855A -#define GL_EYE_RADIAL_NV 0x855B -#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C -/* reuse GL_EYE_PLANE */ -#endif - -#ifndef GL_NV_texgen_emboss -#define GL_EMBOSS_LIGHT_NV 0x855D -#define GL_EMBOSS_CONSTANT_NV 0x855E -#define GL_EMBOSS_MAP_NV 0x855F -#endif - -#ifndef GL_NV_blend_square -#endif - -#ifndef GL_NV_texture_env_combine4 -#define GL_COMBINE4_NV 0x8503 -#define GL_SOURCE3_RGB_NV 0x8583 -#define GL_SOURCE3_ALPHA_NV 0x858B -#define GL_OPERAND3_RGB_NV 0x8593 -#define GL_OPERAND3_ALPHA_NV 0x859B -#endif - -#ifndef GL_MESA_resize_buffers -#endif - -#ifndef GL_MESA_window_pos -#endif - -#ifndef GL_EXT_texture_compression_s3tc -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 -#endif - -#ifndef GL_IBM_cull_vertex -#define GL_CULL_VERTEX_IBM 103050 -#endif - -#ifndef GL_IBM_multimode_draw_arrays -#endif - -#ifndef GL_IBM_vertex_array_lists -#define GL_VERTEX_ARRAY_LIST_IBM 103070 -#define GL_NORMAL_ARRAY_LIST_IBM 103071 -#define GL_COLOR_ARRAY_LIST_IBM 103072 -#define GL_INDEX_ARRAY_LIST_IBM 103073 -#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 -#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 -#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 -#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 -#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 -#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 -#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 -#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 -#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 -#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 -#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 -#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 -#endif - -#ifndef GL_SGIX_subsample -#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 -#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 -#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 -#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 -#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 -#endif - -#ifndef GL_SGIX_ycrcb_subsample -#endif - -#ifndef GL_SGIX_ycrcba -#define GL_YCRCB_SGIX 0x8318 -#define GL_YCRCBA_SGIX 0x8319 -#endif - -#ifndef GL_SGI_depth_pass_instrument -#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 -#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 -#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 -#endif - -#ifndef GL_3DFX_texture_compression_FXT1 -#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 -#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 -#endif - -#ifndef GL_3DFX_multisample -#define GL_MULTISAMPLE_3DFX 0x86B2 -#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 -#define GL_SAMPLES_3DFX 0x86B4 -#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 -#endif - -#ifndef GL_3DFX_tbuffer -#endif - -#ifndef GL_EXT_multisample -#define GL_MULTISAMPLE_EXT 0x809D -#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F -#define GL_SAMPLE_MASK_EXT 0x80A0 -#define GL_1PASS_EXT 0x80A1 -#define GL_2PASS_0_EXT 0x80A2 -#define GL_2PASS_1_EXT 0x80A3 -#define GL_4PASS_0_EXT 0x80A4 -#define GL_4PASS_1_EXT 0x80A5 -#define GL_4PASS_2_EXT 0x80A6 -#define GL_4PASS_3_EXT 0x80A7 -#define GL_SAMPLE_BUFFERS_EXT 0x80A8 -#define GL_SAMPLES_EXT 0x80A9 -#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA -#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB -#define GL_SAMPLE_PATTERN_EXT 0x80AC -#define GL_MULTISAMPLE_BIT_EXT 0x20000000 -#endif - -#ifndef GL_SGIX_vertex_preclip -#define GL_VERTEX_PRECLIP_SGIX 0x83EE -#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF -#endif - -#ifndef GL_SGIX_convolution_accuracy -#define GL_CONVOLUTION_HINT_SGIX 0x8316 -#endif - -#ifndef GL_SGIX_resample -#define GL_PACK_RESAMPLE_SGIX 0x842C -#define GL_UNPACK_RESAMPLE_SGIX 0x842D -#define GL_RESAMPLE_REPLICATE_SGIX 0x842E -#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F -#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 -#endif - -#ifndef GL_SGIS_point_line_texgen -#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 -#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 -#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 -#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 -#define GL_EYE_POINT_SGIS 0x81F4 -#define GL_OBJECT_POINT_SGIS 0x81F5 -#define GL_EYE_LINE_SGIS 0x81F6 -#define GL_OBJECT_LINE_SGIS 0x81F7 -#endif - -#ifndef GL_SGIS_texture_color_mask -#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF -#endif - -#ifndef GL_EXT_texture_env_dot3 -#define GL_DOT3_RGB_EXT 0x8740 -#define GL_DOT3_RGBA_EXT 0x8741 -#endif - -#ifndef GL_ATI_texture_mirror_once -#define GL_MIRROR_CLAMP_ATI 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 -#endif - -#ifndef GL_NV_fence -#define GL_ALL_COMPLETED_NV 0x84F2 -#define GL_FENCE_STATUS_NV 0x84F3 -#define GL_FENCE_CONDITION_NV 0x84F4 -#endif - -#ifndef GL_IBM_texture_mirrored_repeat -#define GL_MIRRORED_REPEAT_IBM 0x8370 -#endif - -#ifndef GL_NV_evaluators -#define GL_EVAL_2D_NV 0x86C0 -#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 -#define GL_MAP_TESSELLATION_NV 0x86C2 -#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 -#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 -#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 -#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 -#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 -#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 -#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 -#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA -#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB -#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC -#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD -#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE -#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF -#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 -#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 -#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 -#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 -#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 -#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 -#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 -#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 -#endif - -#ifndef GL_NV_packed_depth_stencil -#define GL_DEPTH_STENCIL_NV 0x84F9 -#define GL_UNSIGNED_INT_24_8_NV 0x84FA -#endif - -#ifndef GL_NV_register_combiners2 -#define GL_PER_STAGE_CONSTANTS_NV 0x8535 -#endif - -#ifndef GL_NV_texture_compression_vtc -#endif - -#ifndef GL_NV_texture_rectangle -#define GL_TEXTURE_RECTANGLE_NV 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 -#endif - -#ifndef GL_NV_texture_shader -#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C -#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D -#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E -#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 -#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA -#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB -#define GL_DSDT_MAG_INTENSITY_NV 0x86DC -#define GL_SHADER_CONSISTENT_NV 0x86DD -#define GL_TEXTURE_SHADER_NV 0x86DE -#define GL_SHADER_OPERATION_NV 0x86DF -#define GL_CULL_MODES_NV 0x86E0 -#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 -#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 -#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 -#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV -#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV -#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV -#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 -#define GL_CONST_EYE_NV 0x86E5 -#define GL_PASS_THROUGH_NV 0x86E6 -#define GL_CULL_FRAGMENT_NV 0x86E7 -#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 -#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 -#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA -#define GL_DOT_PRODUCT_NV 0x86EC -#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED -#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE -#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 -#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 -#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 -#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 -#define GL_HILO_NV 0x86F4 -#define GL_DSDT_NV 0x86F5 -#define GL_DSDT_MAG_NV 0x86F6 -#define GL_DSDT_MAG_VIB_NV 0x86F7 -#define GL_HILO16_NV 0x86F8 -#define GL_SIGNED_HILO_NV 0x86F9 -#define GL_SIGNED_HILO16_NV 0x86FA -#define GL_SIGNED_RGBA_NV 0x86FB -#define GL_SIGNED_RGBA8_NV 0x86FC -#define GL_SIGNED_RGB_NV 0x86FE -#define GL_SIGNED_RGB8_NV 0x86FF -#define GL_SIGNED_LUMINANCE_NV 0x8701 -#define GL_SIGNED_LUMINANCE8_NV 0x8702 -#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 -#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 -#define GL_SIGNED_ALPHA_NV 0x8705 -#define GL_SIGNED_ALPHA8_NV 0x8706 -#define GL_SIGNED_INTENSITY_NV 0x8707 -#define GL_SIGNED_INTENSITY8_NV 0x8708 -#define GL_DSDT8_NV 0x8709 -#define GL_DSDT8_MAG8_NV 0x870A -#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B -#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C -#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D -#define GL_HI_SCALE_NV 0x870E -#define GL_LO_SCALE_NV 0x870F -#define GL_DS_SCALE_NV 0x8710 -#define GL_DT_SCALE_NV 0x8711 -#define GL_MAGNITUDE_SCALE_NV 0x8712 -#define GL_VIBRANCE_SCALE_NV 0x8713 -#define GL_HI_BIAS_NV 0x8714 -#define GL_LO_BIAS_NV 0x8715 -#define GL_DS_BIAS_NV 0x8716 -#define GL_DT_BIAS_NV 0x8717 -#define GL_MAGNITUDE_BIAS_NV 0x8718 -#define GL_VIBRANCE_BIAS_NV 0x8719 -#define GL_TEXTURE_BORDER_VALUES_NV 0x871A -#define GL_TEXTURE_HI_SIZE_NV 0x871B -#define GL_TEXTURE_LO_SIZE_NV 0x871C -#define GL_TEXTURE_DS_SIZE_NV 0x871D -#define GL_TEXTURE_DT_SIZE_NV 0x871E -#define GL_TEXTURE_MAG_SIZE_NV 0x871F -#endif - -#ifndef GL_NV_texture_shader2 -#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF -#endif - -#ifndef GL_NV_vertex_array_range2 -#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 -#endif - -#ifndef GL_NV_vertex_program -#define GL_VERTEX_PROGRAM_NV 0x8620 -#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 -#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 -#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 -#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 -#define GL_CURRENT_ATTRIB_NV 0x8626 -#define GL_PROGRAM_LENGTH_NV 0x8627 -#define GL_PROGRAM_STRING_NV 0x8628 -#define GL_MODELVIEW_PROJECTION_NV 0x8629 -#define GL_IDENTITY_NV 0x862A -#define GL_INVERSE_NV 0x862B -#define GL_TRANSPOSE_NV 0x862C -#define GL_INVERSE_TRANSPOSE_NV 0x862D -#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E -#define GL_MAX_TRACK_MATRICES_NV 0x862F -#define GL_MATRIX0_NV 0x8630 -#define GL_MATRIX1_NV 0x8631 -#define GL_MATRIX2_NV 0x8632 -#define GL_MATRIX3_NV 0x8633 -#define GL_MATRIX4_NV 0x8634 -#define GL_MATRIX5_NV 0x8635 -#define GL_MATRIX6_NV 0x8636 -#define GL_MATRIX7_NV 0x8637 -#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 -#define GL_CURRENT_MATRIX_NV 0x8641 -#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 -#define GL_PROGRAM_PARAMETER_NV 0x8644 -#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 -#define GL_PROGRAM_TARGET_NV 0x8646 -#define GL_PROGRAM_RESIDENT_NV 0x8647 -#define GL_TRACK_MATRIX_NV 0x8648 -#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 -#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A -#define GL_PROGRAM_ERROR_POSITION_NV 0x864B -#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 -#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 -#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 -#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 -#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 -#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 -#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 -#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 -#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 -#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 -#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A -#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B -#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C -#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D -#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E -#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F -#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 -#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 -#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 -#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 -#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 -#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 -#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 -#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 -#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 -#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 -#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A -#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B -#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C -#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D -#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E -#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F -#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 -#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 -#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 -#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 -#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 -#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 -#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 -#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 -#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 -#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 -#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A -#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B -#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C -#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D -#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E -#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F -#endif - -#ifndef GL_SGIX_texture_coordinate_clamp -#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 -#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A -#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B -#endif - -#ifndef GL_SGIX_scalebias_hint -#define GL_SCALEBIAS_HINT_SGIX 0x8322 -#endif - -#ifndef GL_OML_interlace -#define GL_INTERLACE_OML 0x8980 -#define GL_INTERLACE_READ_OML 0x8981 -#endif - -#ifndef GL_OML_subsample -#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 -#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 -#endif - -#ifndef GL_OML_resample -#define GL_PACK_RESAMPLE_OML 0x8984 -#define GL_UNPACK_RESAMPLE_OML 0x8985 -#define GL_RESAMPLE_REPLICATE_OML 0x8986 -#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 -#define GL_RESAMPLE_AVERAGE_OML 0x8988 -#define GL_RESAMPLE_DECIMATE_OML 0x8989 -#endif - -#ifndef GL_NV_copy_depth_to_color -#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E -#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F -#endif - -#ifndef GL_ATI_envmap_bumpmap -#define GL_BUMP_ROT_MATRIX_ATI 0x8775 -#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 -#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 -#define GL_BUMP_TEX_UNITS_ATI 0x8778 -#define GL_DUDV_ATI 0x8779 -#define GL_DU8DV8_ATI 0x877A -#define GL_BUMP_ENVMAP_ATI 0x877B -#define GL_BUMP_TARGET_ATI 0x877C -#endif - -#ifndef GL_ATI_fragment_shader -#define GL_FRAGMENT_SHADER_ATI 0x8920 -#define GL_REG_0_ATI 0x8921 -#define GL_REG_1_ATI 0x8922 -#define GL_REG_2_ATI 0x8923 -#define GL_REG_3_ATI 0x8924 -#define GL_REG_4_ATI 0x8925 -#define GL_REG_5_ATI 0x8926 -#define GL_REG_6_ATI 0x8927 -#define GL_REG_7_ATI 0x8928 -#define GL_REG_8_ATI 0x8929 -#define GL_REG_9_ATI 0x892A -#define GL_REG_10_ATI 0x892B -#define GL_REG_11_ATI 0x892C -#define GL_REG_12_ATI 0x892D -#define GL_REG_13_ATI 0x892E -#define GL_REG_14_ATI 0x892F -#define GL_REG_15_ATI 0x8930 -#define GL_REG_16_ATI 0x8931 -#define GL_REG_17_ATI 0x8932 -#define GL_REG_18_ATI 0x8933 -#define GL_REG_19_ATI 0x8934 -#define GL_REG_20_ATI 0x8935 -#define GL_REG_21_ATI 0x8936 -#define GL_REG_22_ATI 0x8937 -#define GL_REG_23_ATI 0x8938 -#define GL_REG_24_ATI 0x8939 -#define GL_REG_25_ATI 0x893A -#define GL_REG_26_ATI 0x893B -#define GL_REG_27_ATI 0x893C -#define GL_REG_28_ATI 0x893D -#define GL_REG_29_ATI 0x893E -#define GL_REG_30_ATI 0x893F -#define GL_REG_31_ATI 0x8940 -#define GL_CON_0_ATI 0x8941 -#define GL_CON_1_ATI 0x8942 -#define GL_CON_2_ATI 0x8943 -#define GL_CON_3_ATI 0x8944 -#define GL_CON_4_ATI 0x8945 -#define GL_CON_5_ATI 0x8946 -#define GL_CON_6_ATI 0x8947 -#define GL_CON_7_ATI 0x8948 -#define GL_CON_8_ATI 0x8949 -#define GL_CON_9_ATI 0x894A -#define GL_CON_10_ATI 0x894B -#define GL_CON_11_ATI 0x894C -#define GL_CON_12_ATI 0x894D -#define GL_CON_13_ATI 0x894E -#define GL_CON_14_ATI 0x894F -#define GL_CON_15_ATI 0x8950 -#define GL_CON_16_ATI 0x8951 -#define GL_CON_17_ATI 0x8952 -#define GL_CON_18_ATI 0x8953 -#define GL_CON_19_ATI 0x8954 -#define GL_CON_20_ATI 0x8955 -#define GL_CON_21_ATI 0x8956 -#define GL_CON_22_ATI 0x8957 -#define GL_CON_23_ATI 0x8958 -#define GL_CON_24_ATI 0x8959 -#define GL_CON_25_ATI 0x895A -#define GL_CON_26_ATI 0x895B -#define GL_CON_27_ATI 0x895C -#define GL_CON_28_ATI 0x895D -#define GL_CON_29_ATI 0x895E -#define GL_CON_30_ATI 0x895F -#define GL_CON_31_ATI 0x8960 -#define GL_MOV_ATI 0x8961 -#define GL_ADD_ATI 0x8963 -#define GL_MUL_ATI 0x8964 -#define GL_SUB_ATI 0x8965 -#define GL_DOT3_ATI 0x8966 -#define GL_DOT4_ATI 0x8967 -#define GL_MAD_ATI 0x8968 -#define GL_LERP_ATI 0x8969 -#define GL_CND_ATI 0x896A -#define GL_CND0_ATI 0x896B -#define GL_DOT2_ADD_ATI 0x896C -#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D -#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E -#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F -#define GL_NUM_PASSES_ATI 0x8970 -#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 -#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 -#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 -#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 -#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 -#define GL_SWIZZLE_STR_ATI 0x8976 -#define GL_SWIZZLE_STQ_ATI 0x8977 -#define GL_SWIZZLE_STR_DR_ATI 0x8978 -#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 -#define GL_SWIZZLE_STRQ_ATI 0x897A -#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B -#define GL_RED_BIT_ATI 0x00000001 -#define GL_GREEN_BIT_ATI 0x00000002 -#define GL_BLUE_BIT_ATI 0x00000004 -#define GL_2X_BIT_ATI 0x00000001 -#define GL_4X_BIT_ATI 0x00000002 -#define GL_8X_BIT_ATI 0x00000004 -#define GL_HALF_BIT_ATI 0x00000008 -#define GL_QUARTER_BIT_ATI 0x00000010 -#define GL_EIGHTH_BIT_ATI 0x00000020 -#define GL_SATURATE_BIT_ATI 0x00000040 -#define GL_COMP_BIT_ATI 0x00000002 -#define GL_NEGATE_BIT_ATI 0x00000004 -#define GL_BIAS_BIT_ATI 0x00000008 -#endif - -#ifndef GL_ATI_pn_triangles -#define GL_PN_TRIANGLES_ATI 0x87F0 -#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 -#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 -#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 -#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 -#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 -#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 -#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 -#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 -#endif - -#ifndef GL_ATI_vertex_array_object -#define GL_STATIC_ATI 0x8760 -#define GL_DYNAMIC_ATI 0x8761 -#define GL_PRESERVE_ATI 0x8762 -#define GL_DISCARD_ATI 0x8763 -#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 -#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 -#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 -#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 -#endif - -#ifndef GL_EXT_vertex_shader -#define GL_VERTEX_SHADER_EXT 0x8780 -#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 -#define GL_OP_INDEX_EXT 0x8782 -#define GL_OP_NEGATE_EXT 0x8783 -#define GL_OP_DOT3_EXT 0x8784 -#define GL_OP_DOT4_EXT 0x8785 -#define GL_OP_MUL_EXT 0x8786 -#define GL_OP_ADD_EXT 0x8787 -#define GL_OP_MADD_EXT 0x8788 -#define GL_OP_FRAC_EXT 0x8789 -#define GL_OP_MAX_EXT 0x878A -#define GL_OP_MIN_EXT 0x878B -#define GL_OP_SET_GE_EXT 0x878C -#define GL_OP_SET_LT_EXT 0x878D -#define GL_OP_CLAMP_EXT 0x878E -#define GL_OP_FLOOR_EXT 0x878F -#define GL_OP_ROUND_EXT 0x8790 -#define GL_OP_EXP_BASE_2_EXT 0x8791 -#define GL_OP_LOG_BASE_2_EXT 0x8792 -#define GL_OP_POWER_EXT 0x8793 -#define GL_OP_RECIP_EXT 0x8794 -#define GL_OP_RECIP_SQRT_EXT 0x8795 -#define GL_OP_SUB_EXT 0x8796 -#define GL_OP_CROSS_PRODUCT_EXT 0x8797 -#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 -#define GL_OP_MOV_EXT 0x8799 -#define GL_OUTPUT_VERTEX_EXT 0x879A -#define GL_OUTPUT_COLOR0_EXT 0x879B -#define GL_OUTPUT_COLOR1_EXT 0x879C -#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D -#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E -#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F -#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 -#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 -#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 -#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 -#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 -#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 -#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 -#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 -#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 -#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 -#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA -#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB -#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC -#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD -#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE -#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF -#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 -#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 -#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 -#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 -#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 -#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 -#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 -#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 -#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 -#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 -#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA -#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB -#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC -#define GL_OUTPUT_FOG_EXT 0x87BD -#define GL_SCALAR_EXT 0x87BE -#define GL_VECTOR_EXT 0x87BF -#define GL_MATRIX_EXT 0x87C0 -#define GL_VARIANT_EXT 0x87C1 -#define GL_INVARIANT_EXT 0x87C2 -#define GL_LOCAL_CONSTANT_EXT 0x87C3 -#define GL_LOCAL_EXT 0x87C4 -#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 -#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 -#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 -#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 -#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE -#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF -#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 -#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 -#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 -#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 -#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 -#define GL_X_EXT 0x87D5 -#define GL_Y_EXT 0x87D6 -#define GL_Z_EXT 0x87D7 -#define GL_W_EXT 0x87D8 -#define GL_NEGATIVE_X_EXT 0x87D9 -#define GL_NEGATIVE_Y_EXT 0x87DA -#define GL_NEGATIVE_Z_EXT 0x87DB -#define GL_NEGATIVE_W_EXT 0x87DC -#define GL_ZERO_EXT 0x87DD -#define GL_ONE_EXT 0x87DE -#define GL_NEGATIVE_ONE_EXT 0x87DF -#define GL_NORMALIZED_RANGE_EXT 0x87E0 -#define GL_FULL_RANGE_EXT 0x87E1 -#define GL_CURRENT_VERTEX_EXT 0x87E2 -#define GL_MVP_MATRIX_EXT 0x87E3 -#define GL_VARIANT_VALUE_EXT 0x87E4 -#define GL_VARIANT_DATATYPE_EXT 0x87E5 -#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 -#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 -#define GL_VARIANT_ARRAY_EXT 0x87E8 -#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 -#define GL_INVARIANT_VALUE_EXT 0x87EA -#define GL_INVARIANT_DATATYPE_EXT 0x87EB -#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC -#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED -#endif - -#ifndef GL_ATI_vertex_streams -#define GL_MAX_VERTEX_STREAMS_ATI 0x876B -#define GL_VERTEX_STREAM0_ATI 0x876C -#define GL_VERTEX_STREAM1_ATI 0x876D -#define GL_VERTEX_STREAM2_ATI 0x876E -#define GL_VERTEX_STREAM3_ATI 0x876F -#define GL_VERTEX_STREAM4_ATI 0x8770 -#define GL_VERTEX_STREAM5_ATI 0x8771 -#define GL_VERTEX_STREAM6_ATI 0x8772 -#define GL_VERTEX_STREAM7_ATI 0x8773 -#define GL_VERTEX_SOURCE_ATI 0x8774 -#endif - -#ifndef GL_ATI_element_array -#define GL_ELEMENT_ARRAY_ATI 0x8768 -#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 -#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A -#endif - -#ifndef GL_SUN_mesh_array -#define GL_QUAD_MESH_SUN 0x8614 -#define GL_TRIANGLE_MESH_SUN 0x8615 -#endif - -#ifndef GL_SUN_slice_accum -#define GL_SLICE_ACCUM_SUN 0x85CC -#endif - -#ifndef GL_NV_multisample_filter_hint -#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 -#endif - -#ifndef GL_NV_depth_clamp -#define GL_DEPTH_CLAMP_NV 0x864F -#endif - -#ifndef GL_NV_occlusion_query -#define GL_PIXEL_COUNTER_BITS_NV 0x8864 -#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 -#define GL_PIXEL_COUNT_NV 0x8866 -#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 -#endif - -#ifndef GL_NV_point_sprite -#define GL_POINT_SPRITE_NV 0x8861 -#define GL_COORD_REPLACE_NV 0x8862 -#define GL_POINT_SPRITE_R_MODE_NV 0x8863 -#endif - -#ifndef GL_NV_texture_shader3 -#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 -#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 -#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 -#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 -#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 -#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 -#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 -#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 -#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 -#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 -#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A -#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B -#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C -#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D -#define GL_HILO8_NV 0x885E -#define GL_SIGNED_HILO8_NV 0x885F -#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 -#endif - -#ifndef GL_NV_vertex_program1_1 -#endif - -#ifndef GL_EXT_shadow_funcs -#endif - -#ifndef GL_EXT_stencil_two_side -#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 -#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 -#endif - -#ifndef GL_ATI_text_fragment_shader -#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 -#endif - -#ifndef GL_APPLE_client_storage -#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 -#endif - -#ifndef GL_APPLE_element_array -#define GL_ELEMENT_ARRAY_APPLE 0x8768 -#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 -#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A -#endif - -#ifndef GL_APPLE_fence -#define GL_DRAW_PIXELS_APPLE 0x8A0A -#define GL_FENCE_APPLE 0x8A0B -#endif - -#ifndef GL_APPLE_vertex_array_object -#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 -#endif - -#ifndef GL_APPLE_vertex_array_range -#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D -#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E -#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F -#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 -#define GL_STORAGE_CACHED_APPLE 0x85BE -#define GL_STORAGE_SHARED_APPLE 0x85BF -#endif - -#ifndef GL_APPLE_ycbcr_422 -#define GL_YCBCR_422_APPLE 0x85B9 -#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB -#endif - -#ifndef GL_S3_s3tc -#define GL_RGB_S3TC 0x83A0 -#define GL_RGB4_S3TC 0x83A1 -#define GL_RGBA_S3TC 0x83A2 -#define GL_RGBA4_S3TC 0x83A3 -#endif - -#ifndef GL_ATI_draw_buffers -#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 -#define GL_DRAW_BUFFER0_ATI 0x8825 -#define GL_DRAW_BUFFER1_ATI 0x8826 -#define GL_DRAW_BUFFER2_ATI 0x8827 -#define GL_DRAW_BUFFER3_ATI 0x8828 -#define GL_DRAW_BUFFER4_ATI 0x8829 -#define GL_DRAW_BUFFER5_ATI 0x882A -#define GL_DRAW_BUFFER6_ATI 0x882B -#define GL_DRAW_BUFFER7_ATI 0x882C -#define GL_DRAW_BUFFER8_ATI 0x882D -#define GL_DRAW_BUFFER9_ATI 0x882E -#define GL_DRAW_BUFFER10_ATI 0x882F -#define GL_DRAW_BUFFER11_ATI 0x8830 -#define GL_DRAW_BUFFER12_ATI 0x8831 -#define GL_DRAW_BUFFER13_ATI 0x8832 -#define GL_DRAW_BUFFER14_ATI 0x8833 -#define GL_DRAW_BUFFER15_ATI 0x8834 -#endif - -#ifndef GL_ATI_pixel_format_float -#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 -#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 -#endif - -#ifndef GL_ATI_texture_env_combine3 -#define GL_MODULATE_ADD_ATI 0x8744 -#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 -#define GL_MODULATE_SUBTRACT_ATI 0x8746 -#endif - -#ifndef GL_ATI_texture_float -#define GL_RGBA_FLOAT32_ATI 0x8814 -#define GL_RGB_FLOAT32_ATI 0x8815 -#define GL_ALPHA_FLOAT32_ATI 0x8816 -#define GL_INTENSITY_FLOAT32_ATI 0x8817 -#define GL_LUMINANCE_FLOAT32_ATI 0x8818 -#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 -#define GL_RGBA_FLOAT16_ATI 0x881A -#define GL_RGB_FLOAT16_ATI 0x881B -#define GL_ALPHA_FLOAT16_ATI 0x881C -#define GL_INTENSITY_FLOAT16_ATI 0x881D -#define GL_LUMINANCE_FLOAT16_ATI 0x881E -#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F -#endif - -#ifndef GL_NV_float_buffer -#define GL_FLOAT_R_NV 0x8880 -#define GL_FLOAT_RG_NV 0x8881 -#define GL_FLOAT_RGB_NV 0x8882 -#define GL_FLOAT_RGBA_NV 0x8883 -#define GL_FLOAT_R16_NV 0x8884 -#define GL_FLOAT_R32_NV 0x8885 -#define GL_FLOAT_RG16_NV 0x8886 -#define GL_FLOAT_RG32_NV 0x8887 -#define GL_FLOAT_RGB16_NV 0x8888 -#define GL_FLOAT_RGB32_NV 0x8889 -#define GL_FLOAT_RGBA16_NV 0x888A -#define GL_FLOAT_RGBA32_NV 0x888B -#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C -#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D -#define GL_FLOAT_RGBA_MODE_NV 0x888E -#endif - -#ifndef GL_NV_fragment_program -#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 -#define GL_FRAGMENT_PROGRAM_NV 0x8870 -#define GL_MAX_TEXTURE_COORDS_NV 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 -#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 -#define GL_PROGRAM_ERROR_STRING_NV 0x8874 -#endif - -#ifndef GL_NV_half_float -#define GL_HALF_FLOAT_NV 0x140B -#endif - -#ifndef GL_NV_pixel_data_range -#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 -#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 -#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A -#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B -#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C -#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D -#endif - -#ifndef GL_NV_primitive_restart -#define GL_PRIMITIVE_RESTART_NV 0x8558 -#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 -#endif - -#ifndef GL_NV_texture_expand_normal -#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F -#endif - -#ifndef GL_NV_vertex_program2 -#endif - -#ifndef GL_ATI_map_object_buffer -#endif - -#ifndef GL_ATI_separate_stencil -#define GL_STENCIL_BACK_FUNC_ATI 0x8800 -#define GL_STENCIL_BACK_FAIL_ATI 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 -#endif - -#ifndef GL_ATI_vertex_attrib_array_object -#endif - -#ifndef GL_OES_read_format -#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B -#endif - -#ifndef GL_EXT_depth_bounds_test -#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 -#define GL_DEPTH_BOUNDS_EXT 0x8891 -#endif - -#ifndef GL_EXT_texture_mirror_clamp -#define GL_MIRROR_CLAMP_EXT 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 -#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 -#endif - -#ifndef GL_EXT_blend_equation_separate -#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION -#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D -#endif - -#ifndef GL_MESA_pack_invert -#define GL_PACK_INVERT_MESA 0x8758 -#endif - -#ifndef GL_MESA_ycbcr_texture -#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB -#define GL_YCBCR_MESA 0x8757 -#endif - -#ifndef GL_EXT_pixel_buffer_object -#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF -#endif - -#ifndef GL_NV_fragment_program_option -#endif - -#ifndef GL_NV_fragment_program2 -#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 -#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 -#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 -#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 -#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 -#endif - -#ifndef GL_NV_vertex_program2_option -/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ -/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ -#endif - -#ifndef GL_NV_vertex_program3 -/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ -#endif - -#ifndef GL_EXT_framebuffer_object -#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 -#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 -#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 -#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 -#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA -#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB -#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC -#define GL_COLOR_ATTACHMENT13_EXT 0x8CED -#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE -#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF -#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 -#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 -#define GL_FRAMEBUFFER_EXT 0x8D40 -#define GL_RENDERBUFFER_EXT 0x8D41 -#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 -#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 -#define GL_STENCIL_INDEX1_EXT 0x8D46 -#define GL_STENCIL_INDEX4_EXT 0x8D47 -#define GL_STENCIL_INDEX8_EXT 0x8D48 -#define GL_STENCIL_INDEX16_EXT 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 -#endif - -#ifndef GL_GREMEDY_string_marker -#endif - - -/*************************************************************/ - -#include -#ifndef GL_VERSION_2_0 -/* GL type for program/shader text */ -typedef char GLchar; /* native character */ -#endif - -#ifndef GL_VERSION_1_5 -/* GL types for handling large vertex buffer objects */ -typedef ptrdiff_t GLintptr; -typedef ptrdiff_t GLsizeiptr; -#endif - -#ifndef GL_ARB_vertex_buffer_object -/* GL types for handling large vertex buffer objects */ -typedef ptrdiff_t GLintptrARB; -typedef ptrdiff_t GLsizeiptrARB; -#endif - -#ifndef GL_ARB_shader_objects -/* GL types for handling shader object handles and program/shader text */ -typedef char GLcharARB; /* native character */ -typedef unsigned int GLhandleARB; /* shader object handle */ -#endif - -/* GL types for "half" precision (s10e5) float data in host memory */ -#ifndef GL_ARB_half_float_pixel -typedef unsigned short GLhalfARB; -#endif - -#ifndef GL_NV_half_float -typedef unsigned short GLhalfNV; -#endif - -#ifndef GL_VERSION_1_2 -#define GL_VERSION_1_2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); -GLAPI void APIENTRY glBlendEquation (GLenum); -GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); -GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); -GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); -GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); -GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); -GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); -GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); -GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); -GLAPI void APIENTRY glResetHistogram (GLenum); -GLAPI void APIENTRY glResetMinmax (GLenum); -GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); -typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_VERSION_1_3 -#define GL_VERSION_1_3 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveTexture (GLenum); -GLAPI void APIENTRY glClientActiveTexture (GLenum); -GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); -GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat); -GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint); -GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort); -GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *); -GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); -GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); -GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); -GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); -GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); -GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); -#endif - -#ifndef GL_VERSION_1_4 -#define GL_VERSION_1_4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glFogCoordf (GLfloat); -GLAPI void APIENTRY glFogCoordfv (const GLfloat *); -GLAPI void APIENTRY glFogCoordd (GLdouble); -GLAPI void APIENTRY glFogCoorddv (const GLdouble *); -GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); -GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); -GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); -GLAPI void APIENTRY glPointParameteri (GLenum, GLint); -GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); -GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); -GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); -GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); -GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); -GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); -GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); -GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); -GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); -GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); -GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); -GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); -GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); -GLAPI void APIENTRY glWindowPos2i (GLint, GLint); -GLAPI void APIENTRY glWindowPos2iv (const GLint *); -GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); -GLAPI void APIENTRY glWindowPos2sv (const GLshort *); -GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); -GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); -GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos3iv (const GLint *); -GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos3sv (const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); -typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); -typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); -typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); -#endif - -#ifndef GL_VERSION_1_5 -#define GL_VERSION_1_5 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *); -GLAPI GLboolean APIENTRY glIsQuery (GLuint); -GLAPI void APIENTRY glBeginQuery (GLenum, GLuint); -GLAPI void APIENTRY glEndQuery (GLenum); -GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *); -GLAPI void APIENTRY glBindBuffer (GLenum, GLuint); -GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsBuffer (GLuint); -GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum); -GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *); -GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *); -GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum); -GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum); -GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); -#endif - -#ifndef GL_VERSION_2_0 -#define GL_VERSION_2_0 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum); -GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *); -GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint); -GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint); -GLAPI void APIENTRY glAttachShader (GLuint, GLuint); -GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *); -GLAPI void APIENTRY glCompileShader (GLuint); -GLAPI GLuint APIENTRY glCreateProgram (void); -GLAPI GLuint APIENTRY glCreateShader (GLenum); -GLAPI void APIENTRY glDeleteProgram (GLuint); -GLAPI void APIENTRY glDeleteShader (GLuint); -GLAPI void APIENTRY glDetachShader (GLuint, GLuint); -GLAPI void APIENTRY glDisableVertexAttribArray (GLuint); -GLAPI void APIENTRY glEnableVertexAttribArray (GLuint); -GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); -GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); -GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *); -GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *); -GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); -GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); -GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *); -GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *); -GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *); -GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *); -GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *); -GLAPI GLboolean APIENTRY glIsProgram (GLuint); -GLAPI GLboolean APIENTRY glIsShader (GLuint); -GLAPI void APIENTRY glLinkProgram (GLuint); -GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *); -GLAPI void APIENTRY glUseProgram (GLuint); -GLAPI void APIENTRY glUniform1f (GLint, GLfloat); -GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform1i (GLint, GLint); -GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint); -GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glValidateProgram (GLuint); -GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble); -GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat); -GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort); -GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); -typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); -typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); -typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); -typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_ARB_multitexture -#define GL_ARB_multitexture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveTextureARB (GLenum); -GLAPI void APIENTRY glClientActiveTextureARB (GLenum); -GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); -GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); -GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); -GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); -GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); -#endif - -#ifndef GL_ARB_transpose_matrix -#define GL_ARB_transpose_matrix 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); -GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); -GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); -GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); -#endif - -#ifndef GL_ARB_multisample -#define GL_ARB_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); -#endif - -#ifndef GL_ARB_texture_env_add -#define GL_ARB_texture_env_add 1 -#endif - -#ifndef GL_ARB_texture_cube_map -#define GL_ARB_texture_cube_map 1 -#endif - -#ifndef GL_ARB_texture_compression -#define GL_ARB_texture_compression 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); -#endif - -#ifndef GL_ARB_texture_border_clamp -#define GL_ARB_texture_border_clamp 1 -#endif - -#ifndef GL_ARB_point_parameters -#define GL_ARB_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_ARB_vertex_blend -#define GL_ARB_vertex_blend 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *); -GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *); -GLAPI void APIENTRY glWeightivARB (GLint, const GLint *); -GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *); -GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *); -GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *); -GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *); -GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *); -GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glVertexBlendARB (GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); -typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); -typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); -typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); -typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); -typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); -typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); -typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); -typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); -#endif - -#ifndef GL_ARB_matrix_palette -#define GL_ARB_matrix_palette 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint); -GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *); -GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *); -GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *); -GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); -typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_ARB_texture_env_combine -#define GL_ARB_texture_env_combine 1 -#endif - -#ifndef GL_ARB_texture_env_crossbar -#define GL_ARB_texture_env_crossbar 1 -#endif - -#ifndef GL_ARB_texture_env_dot3 -#define GL_ARB_texture_env_dot3 1 -#endif - -#ifndef GL_ARB_texture_mirrored_repeat -#define GL_ARB_texture_mirrored_repeat 1 -#endif - -#ifndef GL_ARB_depth_texture -#define GL_ARB_depth_texture 1 -#endif - -#ifndef GL_ARB_shadow -#define GL_ARB_shadow 1 -#endif - -#ifndef GL_ARB_shadow_ambient -#define GL_ARB_shadow_ambient 1 -#endif - -#ifndef GL_ARB_window_pos -#define GL_ARB_window_pos 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *); -GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *); -GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint); -GLAPI void APIENTRY glWindowPos2ivARB (const GLint *); -GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort); -GLAPI void APIENTRY glWindowPos2svARB (const GLshort *); -GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *); -GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *); -GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos3ivARB (const GLint *); -GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos3svARB (const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); -#endif - -#ifndef GL_ARB_vertex_program -#define GL_ARB_vertex_program 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); -GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); -GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); -GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); -GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); -GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); -GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); -GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); -GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); -GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); -GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); -GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); -GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); -GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); -typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); -typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); -typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); -#endif - -#ifndef GL_ARB_fragment_program -#define GL_ARB_fragment_program 1 -/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ -#endif - -#ifndef GL_ARB_vertex_buffer_object -#define GL_ARB_vertex_buffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint); -GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsBufferARB (GLuint); -GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); -GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); -GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); -GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum); -GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum); -GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); -#endif - -#ifndef GL_ARB_occlusion_query -#define GL_ARB_occlusion_query 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *); -GLAPI GLboolean APIENTRY glIsQueryARB (GLuint); -GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint); -GLAPI void APIENTRY glEndQueryARB (GLenum); -GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); -#endif - -#ifndef GL_ARB_shader_objects -#define GL_ARB_shader_objects 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB); -GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum); -GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB); -GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum); -GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); -GLAPI void APIENTRY glCompileShaderARB (GLhandleARB); -GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); -GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB); -GLAPI void APIENTRY glLinkProgramARB (GLhandleARB); -GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB); -GLAPI void APIENTRY glValidateProgramARB (GLhandleARB); -GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat); -GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform1iARB (GLint, GLint); -GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint); -GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); -GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *); -GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); -GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); -GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *); -GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); -GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *); -GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *); -GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); -typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); -typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); -typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); -typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); -typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); -typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); -typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); -typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); -typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); -#endif - -#ifndef GL_ARB_vertex_shader -#define GL_ARB_vertex_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); -GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); -GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -#endif - -#ifndef GL_ARB_fragment_shader -#define GL_ARB_fragment_shader 1 -#endif - -#ifndef GL_ARB_shading_language_100 -#define GL_ARB_shading_language_100 1 -#endif - -#ifndef GL_ARB_texture_non_power_of_two -#define GL_ARB_texture_non_power_of_two 1 -#endif - -#ifndef GL_ARB_point_sprite -#define GL_ARB_point_sprite 1 -#endif - -#ifndef GL_ARB_fragment_program_shadow -#define GL_ARB_fragment_program_shadow 1 -#endif - -#ifndef GL_ARB_draw_buffers -#define GL_ARB_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); -#endif - -#ifndef GL_ARB_texture_rectangle -#define GL_ARB_texture_rectangle 1 -#endif - -#ifndef GL_ARB_color_buffer_float -#define GL_ARB_color_buffer_float 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClampColorARB (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); -#endif - -#ifndef GL_ARB_half_float_pixel -#define GL_ARB_half_float_pixel 1 -#endif - -#ifndef GL_ARB_texture_float -#define GL_ARB_texture_float 1 -#endif - -#ifndef GL_ARB_pixel_buffer_object -#define GL_ARB_pixel_buffer_object 1 -#endif - -#ifndef GL_EXT_abgr -#define GL_EXT_abgr 1 -#endif - -#ifndef GL_EXT_blend_color -#define GL_EXT_blend_color 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -#endif - -#ifndef GL_EXT_polygon_offset -#define GL_EXT_polygon_offset 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); -#endif - -#ifndef GL_EXT_texture -#define GL_EXT_texture 1 -#endif - -#ifndef GL_EXT_texture3D -#define GL_EXT_texture3D 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_SGIS_texture_filter4 -#define GL_SGIS_texture_filter4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); -typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); -#endif - -#ifndef GL_EXT_subtexture -#define GL_EXT_subtexture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_EXT_copy_texture -#define GL_EXT_copy_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); -GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); -GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); -GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_EXT_histogram -#define GL_EXT_histogram 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); -GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); -GLAPI void APIENTRY glResetHistogramEXT (GLenum); -GLAPI void APIENTRY glResetMinmaxEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); -typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); -#endif - -#ifndef GL_EXT_convolution -#define GL_EXT_convolution 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); -GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); -GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); -GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); -#endif - -#ifndef GL_EXT_color_matrix -#define GL_EXT_color_matrix 1 -#endif - -#ifndef GL_SGI_color_table -#define GL_SGI_color_table 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); -#endif - -#ifndef GL_SGIX_pixel_texture -#define GL_SGIX_pixel_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTexGenSGIX (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); -#endif - -#ifndef GL_SGIS_pixel_texture -#define GL_SGIS_pixel_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); -GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); -GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); -GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); -GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); -GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); -#endif - -#ifndef GL_SGIS_texture4D -#define GL_SGIS_texture4D 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_SGI_texture_color_table -#define GL_SGI_texture_color_table 1 -#endif - -#ifndef GL_EXT_cmyka -#define GL_EXT_cmyka 1 -#endif - -#ifndef GL_EXT_texture_object -#define GL_EXT_texture_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); -GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint); -GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint); -GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); -typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); -typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); -typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); -typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); -#endif - -#ifndef GL_SGIS_detail_texture -#define GL_SGIS_detail_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); -GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); -#endif - -#ifndef GL_SGIS_sharpen_texture -#define GL_SGIS_sharpen_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); -GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); -#endif - -#ifndef GL_EXT_packed_pixels -#define GL_EXT_packed_pixels 1 -#endif - -#ifndef GL_SGIS_texture_lod -#define GL_SGIS_texture_lod 1 -#endif - -#ifndef GL_SGIS_multisample -#define GL_SGIS_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); -GLAPI void APIENTRY glSamplePatternSGIS (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); -#endif - -#ifndef GL_EXT_rescale_normal -#define GL_EXT_rescale_normal 1 -#endif - -#ifndef GL_EXT_vertex_array -#define GL_EXT_vertex_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glArrayElementEXT (GLint); -GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); -GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); -GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); -GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); -typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); -typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); -typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_misc_attribute -#define GL_EXT_misc_attribute 1 -#endif - -#ifndef GL_SGIS_generate_mipmap -#define GL_SGIS_generate_mipmap 1 -#endif - -#ifndef GL_SGIX_clipmap -#define GL_SGIX_clipmap 1 -#endif - -#ifndef GL_SGIX_shadow -#define GL_SGIX_shadow 1 -#endif - -#ifndef GL_SGIS_texture_edge_clamp -#define GL_SGIS_texture_edge_clamp 1 -#endif - -#ifndef GL_SGIS_texture_border_clamp -#define GL_SGIS_texture_border_clamp 1 -#endif - -#ifndef GL_EXT_blend_minmax -#define GL_EXT_blend_minmax 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); -#endif - -#ifndef GL_EXT_blend_subtract -#define GL_EXT_blend_subtract 1 -#endif - -#ifndef GL_EXT_blend_logic_op -#define GL_EXT_blend_logic_op 1 -#endif - -#ifndef GL_SGIX_interlace -#define GL_SGIX_interlace 1 -#endif - -#ifndef GL_SGIX_pixel_tiles -#define GL_SGIX_pixel_tiles 1 -#endif - -#ifndef GL_SGIX_texture_select -#define GL_SGIX_texture_select 1 -#endif - -#ifndef GL_SGIX_sprite -#define GL_SGIX_sprite 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); -GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); -GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); -GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_SGIX_texture_multi_buffer -#define GL_SGIX_texture_multi_buffer 1 -#endif - -#ifndef GL_EXT_point_parameters -#define GL_EXT_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_SGIS_point_parameters -#define GL_SGIS_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_SGIX_instruments -#define GL_SGIX_instruments 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); -GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); -GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *); -GLAPI void APIENTRY glReadInstrumentsSGIX (GLint); -GLAPI void APIENTRY glStartInstrumentsSGIX (void); -GLAPI void APIENTRY glStopInstrumentsSGIX (GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); -typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); -typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); -typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); -typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); -typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); -#endif - -#ifndef GL_SGIX_texture_scale_bias -#define GL_SGIX_texture_scale_bias 1 -#endif - -#ifndef GL_SGIX_framezoom -#define GL_SGIX_framezoom 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFrameZoomSGIX (GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); -#endif - -#ifndef GL_SGIX_tag_sample_buffer -#define GL_SGIX_tag_sample_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTagSampleBufferSGIX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); -#endif - -#ifndef GL_SGIX_polynomial_ffd -#define GL_SGIX_polynomial_ffd 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); -GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); -GLAPI void APIENTRY glDeformSGIX (GLbitfield); -GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); -typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); -typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); -typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); -#endif - -#ifndef GL_SGIX_reference_plane -#define GL_SGIX_reference_plane 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); -#endif - -#ifndef GL_SGIX_flush_raster -#define GL_SGIX_flush_raster 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFlushRasterSGIX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); -#endif - -#ifndef GL_SGIX_depth_texture -#define GL_SGIX_depth_texture 1 -#endif - -#ifndef GL_SGIS_fog_function -#define GL_SGIS_fog_function 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); -GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); -#endif - -#ifndef GL_SGIX_fog_offset -#define GL_SGIX_fog_offset 1 -#endif - -#ifndef GL_HP_image_transform -#define GL_HP_image_transform 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); -GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_HP_convolution_border_modes -#define GL_HP_convolution_border_modes 1 -#endif - -#ifndef GL_SGIX_texture_add_env -#define GL_SGIX_texture_add_env 1 -#endif - -#ifndef GL_EXT_color_subtable -#define GL_EXT_color_subtable 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -#endif - -#ifndef GL_PGI_vertex_hints -#define GL_PGI_vertex_hints 1 -#endif - -#ifndef GL_PGI_misc_hints -#define GL_PGI_misc_hints 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glHintPGI (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); -#endif - -#ifndef GL_EXT_paletted_texture -#define GL_EXT_paletted_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_EXT_clip_volume_hint -#define GL_EXT_clip_volume_hint 1 -#endif - -#ifndef GL_SGIX_list_priority -#define GL_SGIX_list_priority 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); -GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); -GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); -GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); -#endif - -#ifndef GL_SGIX_ir_instrument1 -#define GL_SGIX_ir_instrument1 1 -#endif - -#ifndef GL_SGIX_calligraphic_fragment -#define GL_SGIX_calligraphic_fragment 1 -#endif - -#ifndef GL_SGIX_texture_lod_bias -#define GL_SGIX_texture_lod_bias 1 -#endif - -#ifndef GL_SGIX_shadow_ambient -#define GL_SGIX_shadow_ambient 1 -#endif - -#ifndef GL_EXT_index_texture -#define GL_EXT_index_texture 1 -#endif - -#ifndef GL_EXT_index_material -#define GL_EXT_index_material 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); -#endif - -#ifndef GL_EXT_index_func -#define GL_EXT_index_func 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); -#endif - -#ifndef GL_EXT_index_array_formats -#define GL_EXT_index_array_formats 1 -#endif - -#ifndef GL_EXT_compiled_vertex_array -#define GL_EXT_compiled_vertex_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei); -GLAPI void APIENTRY glUnlockArraysEXT (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); -#endif - -#ifndef GL_EXT_cull_vertex -#define GL_EXT_cull_vertex 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); -GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); -#endif - -#ifndef GL_SGIX_ycrcb -#define GL_SGIX_ycrcb 1 -#endif - -#ifndef GL_SGIX_fragment_lighting -#define GL_SGIX_fragment_lighting 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); -GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); -GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); -GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); -GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); -GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); -GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); -GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); -#endif - -#ifndef GL_IBM_rasterpos_clip -#define GL_IBM_rasterpos_clip 1 -#endif - -#ifndef GL_HP_texture_lighting -#define GL_HP_texture_lighting 1 -#endif - -#ifndef GL_EXT_draw_range_elements -#define GL_EXT_draw_range_elements 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -#endif - -#ifndef GL_WIN_phong_shading -#define GL_WIN_phong_shading 1 -#endif - -#ifndef GL_WIN_specular_fog -#define GL_WIN_specular_fog 1 -#endif - -#ifndef GL_EXT_light_texture -#define GL_EXT_light_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glApplyTextureEXT (GLenum); -GLAPI void APIENTRY glTextureLightEXT (GLenum); -GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); -typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); -#endif - -#ifndef GL_SGIX_blend_alpha_minmax -#define GL_SGIX_blend_alpha_minmax 1 -#endif - -#ifndef GL_EXT_bgra -#define GL_EXT_bgra 1 -#endif - -#ifndef GL_SGIX_async -#define GL_SGIX_async 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint); -GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *); -GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *); -GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); -GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); -GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); -typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); -typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); -typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); -typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); -typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); -#endif - -#ifndef GL_SGIX_async_pixel -#define GL_SGIX_async_pixel 1 -#endif - -#ifndef GL_SGIX_async_histogram -#define GL_SGIX_async_histogram 1 -#endif - -#ifndef GL_INTEL_parallel_arrays -#define GL_INTEL_parallel_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); -GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); -GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); -GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -#endif - -#ifndef GL_HP_occlusion_test -#define GL_HP_occlusion_test 1 -#endif - -#ifndef GL_EXT_pixel_transform -#define GL_EXT_pixel_transform 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); -GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_EXT_pixel_transform_color_table -#define GL_EXT_pixel_transform_color_table 1 -#endif - -#ifndef GL_EXT_shared_texture_palette -#define GL_EXT_shared_texture_palette 1 -#endif - -#ifndef GL_EXT_separate_specular_color -#define GL_EXT_separate_specular_color 1 -#endif - -#ifndef GL_EXT_secondary_color -#define GL_EXT_secondary_color 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); -GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); -GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); -GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); -GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *); -GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *); -GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); -GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *); -GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); -GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *); -GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_texture_perturb_normal -#define GL_EXT_texture_perturb_normal 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureNormalEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); -#endif - -#ifndef GL_EXT_multi_draw_arrays -#define GL_EXT_multi_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); -GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -#endif - -#ifndef GL_EXT_fog_coord -#define GL_EXT_fog_coord 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFogCoordfEXT (GLfloat); -GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *); -GLAPI void APIENTRY glFogCoorddEXT (GLdouble); -GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *); -GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); -typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); -typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); -typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_REND_screen_coordinates -#define GL_REND_screen_coordinates 1 -#endif - -#ifndef GL_EXT_coordinate_frame -#define GL_EXT_coordinate_frame 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *); -GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *); -GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *); -GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint); -GLAPI void APIENTRY glTangent3ivEXT (const GLint *); -GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glTangent3svEXT (const GLshort *); -GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *); -GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *); -GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *); -GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); -GLAPI void APIENTRY glBinormal3ivEXT (const GLint *); -GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glBinormal3svEXT (const GLshort *); -GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); -typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); -typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); -typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); -typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); -typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); -typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); -typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); -typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); -typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); -typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_texture_env_combine -#define GL_EXT_texture_env_combine 1 -#endif - -#ifndef GL_APPLE_specular_vector -#define GL_APPLE_specular_vector 1 -#endif - -#ifndef GL_APPLE_transform_hint -#define GL_APPLE_transform_hint 1 -#endif - -#ifndef GL_SGIX_fog_scale -#define GL_SGIX_fog_scale 1 -#endif - -#ifndef GL_SUNX_constant_data -#define GL_SUNX_constant_data 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFinishTextureSUNX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); -#endif - -#ifndef GL_SUN_global_alpha -#define GL_SUN_global_alpha 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); -GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort); -GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint); -GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); -GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble); -GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); -GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort); -GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); -#endif - -#ifndef GL_SUN_triangle_list -#define GL_SUN_triangle_list 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint); -GLAPI void APIENTRY glReplacementCodeusSUN (GLushort); -GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte); -GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *); -GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *); -GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *); -GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); -#endif - -#ifndef GL_SUN_vertex -#define GL_SUN_vertex 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); -GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -#endif - -#ifndef GL_EXT_blend_func_separate -#define GL_EXT_blend_func_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif - -#ifndef GL_INGR_blend_func_separate -#define GL_INGR_blend_func_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif - -#ifndef GL_INGR_color_clamp -#define GL_INGR_color_clamp 1 -#endif - -#ifndef GL_INGR_interlace_read -#define GL_INGR_interlace_read 1 -#endif - -#ifndef GL_EXT_stencil_wrap -#define GL_EXT_stencil_wrap 1 -#endif - -#ifndef GL_EXT_422_pixels -#define GL_EXT_422_pixels 1 -#endif - -#ifndef GL_NV_texgen_reflection -#define GL_NV_texgen_reflection 1 -#endif - -#ifndef GL_SUN_convolution_border_modes -#define GL_SUN_convolution_border_modes 1 -#endif - -#ifndef GL_EXT_texture_env_add -#define GL_EXT_texture_env_add 1 -#endif - -#ifndef GL_EXT_texture_lod_bias -#define GL_EXT_texture_lod_bias 1 -#endif - -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_EXT_texture_filter_anisotropic 1 -#endif - -#ifndef GL_EXT_vertex_weighting -#define GL_EXT_vertex_weighting 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexWeightfEXT (GLfloat); -GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *); -GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_NV_light_max_exponent -#define GL_NV_light_max_exponent 1 -#endif - -#ifndef GL_NV_vertex_array_range -#define GL_NV_vertex_array_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); -GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); -typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); -#endif - -#ifndef GL_NV_register_combiners -#define GL_NV_register_combiners 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); -GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); -GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); -GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint); -GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); -GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); -typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); -#endif - -#ifndef GL_NV_fog_distance -#define GL_NV_fog_distance 1 -#endif - -#ifndef GL_NV_texgen_emboss -#define GL_NV_texgen_emboss 1 -#endif - -#ifndef GL_NV_blend_square -#define GL_NV_blend_square 1 -#endif - -#ifndef GL_NV_texture_env_combine4 -#define GL_NV_texture_env_combine4 1 -#endif - -#ifndef GL_MESA_resize_buffers -#define GL_MESA_resize_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glResizeBuffersMESA (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); -#endif - -#ifndef GL_MESA_window_pos -#define GL_MESA_window_pos 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *); -GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *); -GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint); -GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *); -GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort); -GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *); -GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *); -GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *); -GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *); -GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *); -GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *); -GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *); -GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *); -GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); -#endif - -#ifndef GL_IBM_cull_vertex -#define GL_IBM_cull_vertex 1 -#endif - -#ifndef GL_IBM_multimode_draw_arrays -#define GL_IBM_multimode_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint); -GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); -typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); -#endif - -#ifndef GL_IBM_vertex_array_lists -#define GL_IBM_vertex_array_lists 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); -GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -#endif - -#ifndef GL_SGIX_subsample -#define GL_SGIX_subsample 1 -#endif - -#ifndef GL_SGIX_ycrcba -#define GL_SGIX_ycrcba 1 -#endif - -#ifndef GL_SGIX_ycrcb_subsample -#define GL_SGIX_ycrcb_subsample 1 -#endif - -#ifndef GL_SGIX_depth_pass_instrument -#define GL_SGIX_depth_pass_instrument 1 -#endif - -#ifndef GL_3DFX_texture_compression_FXT1 -#define GL_3DFX_texture_compression_FXT1 1 -#endif - -#ifndef GL_3DFX_multisample -#define GL_3DFX_multisample 1 -#endif - -#ifndef GL_3DFX_tbuffer -#define GL_3DFX_tbuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTbufferMask3DFX (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); -#endif - -#ifndef GL_EXT_multisample -#define GL_EXT_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); -GLAPI void APIENTRY glSamplePatternEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); -#endif - -#ifndef GL_SGIX_vertex_preclip -#define GL_SGIX_vertex_preclip 1 -#endif - -#ifndef GL_SGIX_convolution_accuracy -#define GL_SGIX_convolution_accuracy 1 -#endif - -#ifndef GL_SGIX_resample -#define GL_SGIX_resample 1 -#endif - -#ifndef GL_SGIS_point_line_texgen -#define GL_SGIS_point_line_texgen 1 -#endif - -#ifndef GL_SGIS_texture_color_mask -#define GL_SGIS_texture_color_mask 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -#endif - -#ifndef GL_SGIX_igloo_interface -#define GL_SGIX_igloo_interface 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); -#endif - -#ifndef GL_EXT_texture_env_dot3 -#define GL_EXT_texture_env_dot3 1 -#endif - -#ifndef GL_ATI_texture_mirror_once -#define GL_ATI_texture_mirror_once 1 -#endif - -#ifndef GL_NV_fence -#define GL_NV_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsFenceNV (GLuint); -GLAPI GLboolean APIENTRY glTestFenceNV (GLuint); -GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glFinishFenceNV (GLuint); -GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); -typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); -typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); -#endif - -#ifndef GL_NV_evaluators -#define GL_NV_evaluators 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *); -GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *); -GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); -typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); -typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); -#endif - -#ifndef GL_NV_packed_depth_stencil -#define GL_NV_packed_depth_stencil 1 -#endif - -#ifndef GL_NV_register_combiners2 -#define GL_NV_register_combiners2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_NV_texture_compression_vtc -#define GL_NV_texture_compression_vtc 1 -#endif - -#ifndef GL_NV_texture_rectangle -#define GL_NV_texture_rectangle 1 -#endif - -#ifndef GL_NV_texture_shader -#define GL_NV_texture_shader 1 -#endif - -#ifndef GL_NV_texture_shader2 -#define GL_NV_texture_shader2 1 -#endif - -#ifndef GL_NV_vertex_array_range2 -#define GL_NV_vertex_array_range2 1 -#endif - -#ifndef GL_NV_vertex_program -#define GL_NV_vertex_program 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *); -GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint); -GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *); -GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *); -GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *); -GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *); -GLAPI GLboolean APIENTRY glIsProgramNV (GLuint); -GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *); -GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *); -GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *); -GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum); -GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble); -GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat); -GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort); -GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); -typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); -typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); -typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); -typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); -typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); -#endif - -#ifndef GL_SGIX_texture_coordinate_clamp -#define GL_SGIX_texture_coordinate_clamp 1 -#endif - -#ifndef GL_SGIX_scalebias_hint -#define GL_SGIX_scalebias_hint 1 -#endif - -#ifndef GL_OML_interlace -#define GL_OML_interlace 1 -#endif - -#ifndef GL_OML_subsample -#define GL_OML_subsample 1 -#endif - -#ifndef GL_OML_resample -#define GL_OML_resample 1 -#endif - -#ifndef GL_NV_copy_depth_to_color -#define GL_NV_copy_depth_to_color 1 -#endif - -#ifndef GL_ATI_envmap_bumpmap -#define GL_ATI_envmap_bumpmap 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *); -GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *); -GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); -typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); -#endif - -#ifndef GL_ATI_fragment_shader -#define GL_ATI_fragment_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint); -GLAPI void APIENTRY glBindFragmentShaderATI (GLuint); -GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint); -GLAPI void APIENTRY glBeginFragmentShaderATI (void); -GLAPI void APIENTRY glEndFragmentShaderATI (void); -GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum); -GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum); -GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); -typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); -typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); -typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); -typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); -typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); -#endif - -#ifndef GL_ATI_pn_triangles -#define GL_ATI_pn_triangles 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint); -GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); -#endif - -#ifndef GL_ATI_vertex_array_object -#define GL_ATI_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum); -GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint); -GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum); -GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glFreeObjectBufferATI (GLuint); -GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint); -GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint); -GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); -typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); -typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); -#endif - -#ifndef GL_EXT_vertex_shader -#define GL_EXT_vertex_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginVertexShaderEXT (void); -GLAPI void APIENTRY glEndVertexShaderEXT (void); -GLAPI void APIENTRY glBindVertexShaderEXT (GLuint); -GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint); -GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint); -GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint); -GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint); -GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint); -GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint); -GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *); -GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *); -GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *); -GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *); -GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *); -GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *); -GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *); -GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *); -GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *); -GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *); -GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *); -GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint); -GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint); -GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum); -GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum); -GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum); -GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum); -GLAPI GLuint APIENTRY glBindParameterEXT (GLenum); -GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum); -GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *); -GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *); -GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *); -GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *); -GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); -typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); -typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); -typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); -typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); -typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); -typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); -typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); -typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); -typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); -typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); -typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); -typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); -typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); -typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); -typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); -typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); -typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); -typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); -typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); -typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); -typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); -typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); -typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); -typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); -typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); -typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); -typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -#endif - -#ifndef GL_ATI_vertex_streams -#define GL_ATI_vertex_streams 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort); -GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint); -GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat); -GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble); -GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort); -GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint); -GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *); -GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum); -GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint); -GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); -typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); -#endif - -#ifndef GL_ATI_element_array -#define GL_ATI_element_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *); -GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei); -GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); -#endif - -#ifndef GL_SUN_mesh_array -#define GL_SUN_mesh_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); -#endif - -#ifndef GL_SUN_slice_accum -#define GL_SUN_slice_accum 1 -#endif - -#ifndef GL_NV_multisample_filter_hint -#define GL_NV_multisample_filter_hint 1 -#endif - -#ifndef GL_NV_depth_clamp -#define GL_NV_depth_clamp 1 -#endif - -#ifndef GL_NV_occlusion_query -#define GL_NV_occlusion_query 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *); -GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint); -GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint); -GLAPI void APIENTRY glEndOcclusionQueryNV (void); -GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); -typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); -#endif - -#ifndef GL_NV_point_sprite -#define GL_NV_point_sprite 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint); -GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_NV_texture_shader3 -#define GL_NV_texture_shader3 1 -#endif - -#ifndef GL_NV_vertex_program1_1 -#define GL_NV_vertex_program1_1 1 -#endif - -#ifndef GL_EXT_shadow_funcs -#define GL_EXT_shadow_funcs 1 -#endif - -#ifndef GL_EXT_stencil_two_side -#define GL_EXT_stencil_two_side 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); -#endif - -#ifndef GL_ATI_text_fragment_shader -#define GL_ATI_text_fragment_shader 1 -#endif - -#ifndef GL_APPLE_client_storage -#define GL_APPLE_client_storage 1 -#endif - -#ifndef GL_APPLE_element_array -#define GL_APPLE_element_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *); -GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei); -GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei); -GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei); -GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); -#endif - -#ifndef GL_APPLE_fence -#define GL_APPLE_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *); -GLAPI void APIENTRY glSetFenceAPPLE (GLuint); -GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint); -GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint); -GLAPI void APIENTRY glFinishFenceAPPLE (GLuint); -GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint); -GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); -typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); -typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); -typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); -#endif - -#ifndef GL_APPLE_vertex_array_object -#define GL_APPLE_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint); -GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, const GLuint *); -GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); -#endif - -#ifndef GL_APPLE_vertex_array_range -#define GL_APPLE_vertex_array_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *); -GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *); -GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); -#endif - -#ifndef GL_APPLE_ycbcr_422 -#define GL_APPLE_ycbcr_422 1 -#endif - -#ifndef GL_S3_s3tc -#define GL_S3_s3tc 1 -#endif - -#ifndef GL_ATI_draw_buffers -#define GL_ATI_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); -#endif - -#ifndef GL_ATI_pixel_format_float -#define GL_ATI_pixel_format_float 1 -/* This is really a WGL extension, but defines some associated GL enums. - * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. - */ -#endif - -#ifndef GL_ATI_texture_env_combine3 -#define GL_ATI_texture_env_combine3 1 -#endif - -#ifndef GL_ATI_texture_float -#define GL_ATI_texture_float 1 -#endif - -#ifndef GL_NV_float_buffer -#define GL_NV_float_buffer 1 -#endif - -#ifndef GL_NV_fragment_program -#define GL_NV_fragment_program 1 -/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *); -GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *); -GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); -typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); -#endif - -#ifndef GL_NV_half_float -#define GL_NV_half_float 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *); -GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV); -GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glFogCoordhNV (GLhalfNV); -GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *); -GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV); -GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); -typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); -typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); -typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); -typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); -typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); -typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); -typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); -typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -#endif - -#ifndef GL_NV_pixel_data_range -#define GL_NV_pixel_data_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *); -GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); -#endif - -#ifndef GL_NV_primitive_restart -#define GL_NV_primitive_restart 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPrimitiveRestartNV (void); -GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); -#endif - -#ifndef GL_NV_texture_expand_normal -#define GL_NV_texture_expand_normal 1 -#endif - -#ifndef GL_NV_vertex_program2 -#define GL_NV_vertex_program2 1 -#endif - -#ifndef GL_ATI_map_object_buffer -#define GL_ATI_map_object_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint); -GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); -#endif - -#ifndef GL_ATI_separate_stencil -#define GL_ATI_separate_stencil 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -#endif - -#ifndef GL_ATI_vertex_attrib_array_object -#define GL_ATI_vertex_attrib_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint); -GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); -#endif - -#ifndef GL_OES_read_format -#define GL_OES_read_format 1 -#endif - -#ifndef GL_EXT_depth_bounds_test -#define GL_EXT_depth_bounds_test 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); -#endif - -#ifndef GL_EXT_texture_mirror_clamp -#define GL_EXT_texture_mirror_clamp 1 -#endif - -#ifndef GL_EXT_blend_equation_separate -#define GL_EXT_blend_equation_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); -#endif - -#ifndef GL_MESA_pack_invert -#define GL_MESA_pack_invert 1 -#endif - -#ifndef GL_MESA_ycbcr_texture -#define GL_MESA_ycbcr_texture 1 -#endif - -#ifndef GL_EXT_pixel_buffer_object -#define GL_EXT_pixel_buffer_object 1 -#endif - -#ifndef GL_NV_fragment_program_option -#define GL_NV_fragment_program_option 1 -#endif - -#ifndef GL_NV_fragment_program2 -#define GL_NV_fragment_program2 1 -#endif - -#ifndef GL_NV_vertex_program2_option -#define GL_NV_vertex_program2_option 1 -#endif - -#ifndef GL_NV_vertex_program3 -#define GL_NV_vertex_program3 1 -#endif - -#ifndef GL_EXT_framebuffer_object -#define GL_EXT_framebuffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint); -GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint); -GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *); -GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei); -GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *); -GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint); -GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint); -GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *); -GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum); -GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint); -GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint); -GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint); -GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint); -GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGenerateMipmapEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); -typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); -#endif - -#ifndef GL_GREMEDY_string_marker -#define GL_GREMEDY_string_marker 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); -#endif - - -#ifdef __cplusplus -} -#endif - -#endif -#endif /* NO_SDL_GLEXT */ diff --git a/src/osd/modules/opengl/osd_opengl.h b/src/osd/modules/opengl/osd_opengl.h index a033fcd57f6..481925045e5 100644 --- a/src/osd/modules/opengl/osd_opengl.h +++ b/src/osd/modules/opengl/osd_opengl.h @@ -12,15 +12,17 @@ #ifndef _OSD_OPENGL_H #define _OSD_OPENGL_H - #if USE_OPENGL - /* equivalent to #include * #include */ #ifdef OSD_WINDOWS #ifdef _MSC_VER #include - #include "SDL1211_opengl.h" + #include "GL/GL.h" + #include "bgfx/3rdparty/khronos/gl/glext.h " + #ifndef USE_DISPATCH_GL + #include "bgfx/3rdparty/khronos/wgl/wglext.h" + #endif #else #include "GL/gl.h" #include "GL/glext.h" @@ -107,8 +109,6 @@ #endif /* USE_DISPATCH_GL */ - #endif /* USE_OPENGL */ - #endif /* _OSD_OPENGL_H */ #else /* MANGLE */ diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp index 320cc9f3a62..623840525ad 100644 --- a/src/osd/modules/render/draw13.cpp +++ b/src/osd/modules/render/draw13.cpp @@ -546,12 +546,8 @@ int drawsdl2_init(running_machine &machine, osd_draw_callbacks *callbacks) osd_printf_verbose("Using SDL native texturing driver (SDL 2.0+)\n"); -#if USE_OPENGL // Load the GL library now - else MT will fail const char *stemp = downcast(machine.options()).gl_lib(); -#else - const char *stemp = NULL; -#endif if (stemp != NULL && strcmp(stemp, OSDOPTVAL_AUTO) == 0) stemp = NULL; diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index bca299eb49d..7ba8832da6e 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -122,9 +122,7 @@ public: const char *video_driver() const { return value(SDLOPTION_VIDEODRIVER); } const char *render_driver() const { return value(SDLOPTION_RENDERDRIVER); } const char *audio_driver() const { return value(SDLOPTION_AUDIODRIVER); } -#if USE_OPENGL const char *gl_lib() const { return value(SDLOPTION_GL_LIB); } -#endif private: static const options_entry s_option_entries[]; diff --git a/src/osd/sdl/sdlmain.cpp b/src/osd/sdl/sdlmain.cpp index 530aa41c9d4..43c49480d2b 100644 --- a/src/osd/sdl/sdlmain.cpp +++ b/src/osd/sdl/sdlmain.cpp @@ -164,9 +164,7 @@ const options_entry sdl_options::s_option_entries[] = { SDLOPTION_VIDEODRIVER ";vd", OSDOPTVAL_AUTO, OPTION_STRING, "sdl video driver to use ('x11', 'directfb', ... or 'auto' for SDL default" }, { SDLOPTION_RENDERDRIVER ";rd", OSDOPTVAL_AUTO, OPTION_STRING, "sdl render driver to use ('software', 'opengl', 'directfb' ... or 'auto' for SDL default" }, { SDLOPTION_AUDIODRIVER ";ad", OSDOPTVAL_AUTO, OPTION_STRING, "sdl audio driver to use ('alsa', 'arts', ... or 'auto' for SDL default" }, -#if USE_OPENGL { SDLOPTION_GL_LIB, SDLOPTVAL_GLLIB, OPTION_STRING, "alternative libGL.so to use; 'auto' for system default" }, -#endif // End of list { NULL } @@ -345,7 +343,6 @@ static void defines_verbose(void) osd_printf_verbose("\n"); osd_printf_verbose("SDL/OpenGL defines: "); osd_printf_verbose("SDL_COMPILEDVERSION=%d ", SDL_COMPILEDVERSION); - MACRO_VERBOSE(USE_OPENGL); MACRO_VERBOSE(USE_DISPATCH_GL); osd_printf_verbose("\n"); osd_printf_verbose("Compiler defines A: "); @@ -487,7 +484,6 @@ void sdl_osd_interface::init(running_machine &machine) /* Set the SDL environment variable for drivers wanting to load the * lib at startup. */ -#if USE_OPENGL /* FIXME: move lib loading code from drawogl.c here */ stemp = options().gl_lib(); @@ -496,7 +492,6 @@ void sdl_osd_interface::init(running_machine &machine) osd_setenv("SDL_VIDEO_GL_DRIVER", stemp, 1); osd_printf_verbose("Setting SDL_VIDEO_GL_DRIVER = '%s' ...\n", stemp); } -#endif /* get number of processors */ stemp = options().numprocessors(); diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index 707376f8198..3e1732dad2f 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -313,14 +313,12 @@ static void check_osd_inputs(running_machine &machine) machine.ui().popup_time(1, "Keepaspect %s", video_config.keepaspect? "enabled":"disabled"); } - #if (USE_OPENGL) - //FIXME: on a per window basis - if (machine.ui_input().pressed(IPT_OSD_5)) - { - video_config.filter = !video_config.filter; - machine.ui().popup_time(1, "Filter %s", video_config.filter? "enabled":"disabled"); - } - #endif + //FIXME: on a per window basis + if (machine.ui_input().pressed(IPT_OSD_5)) + { + video_config.filter = !video_config.filter; + machine.ui().popup_time(1, "Filter %s", video_config.filter? "enabled":"disabled"); + } if (machine.ui_input().pressed(IPT_OSD_6)) window->modify_prescale(-1); @@ -377,7 +375,7 @@ void sdl_osd_interface::extract_video_config() if (options().seconds_to_run() == 0) osd_printf_warning("Warning: -video none doesn't make much sense without -seconds_to_run\n"); } - else if (USE_OPENGL && (strcmp(stemp, SDLOPTVAL_OPENGL) == 0)) + else if (strcmp(stemp, SDLOPTVAL_OPENGL) == 0) video_config.mode = VIDEO_MODE_OPENGL; else if ((strcmp(stemp, SDLOPTVAL_SDL2ACCEL) == 0)) { @@ -411,64 +409,62 @@ void sdl_osd_interface::extract_video_config() osd_printf_warning("Invalid prescale option, reverting to '1'\n"); video_config.prescale = 1; } - #if (USE_OPENGL) - // default to working video please - video_config.forcepow2texture = options().gl_force_pow2_texture(); - video_config.allowtexturerect = !(options().gl_no_texture_rect()); - video_config.vbo = options().gl_vbo(); - video_config.pbo = options().gl_pbo(); - video_config.glsl = options().gl_glsl(); - if ( video_config.glsl ) - { - int i; + // default to working video please + video_config.forcepow2texture = options().gl_force_pow2_texture(); + video_config.allowtexturerect = !(options().gl_no_texture_rect()); + video_config.vbo = options().gl_vbo(); + video_config.pbo = options().gl_pbo(); + video_config.glsl = options().gl_glsl(); + if ( video_config.glsl ) + { + int i; - video_config.glsl_filter = options().glsl_filter(); + video_config.glsl_filter = options().glsl_filter(); - video_config.glsl_shader_mamebm_num=0; + video_config.glsl_shader_mamebm_num=0; - for(i=0; i0) { - stemp = options().shader_mame(i); - if (stemp && strcmp(stemp, OSDOPTVAL_NONE) != 0 && strlen(stemp)>0) - { - video_config.glsl_shader_mamebm[i] = (char *) malloc(strlen(stemp)+1); - strcpy(video_config.glsl_shader_mamebm[i], stemp); - video_config.glsl_shader_mamebm_num++; - } else { - video_config.glsl_shader_mamebm[i] = NULL; - } + video_config.glsl_shader_mamebm[i] = (char *) malloc(strlen(stemp)+1); + strcpy(video_config.glsl_shader_mamebm[i], stemp); + video_config.glsl_shader_mamebm_num++; + } else { + video_config.glsl_shader_mamebm[i] = NULL; } + } - video_config.glsl_shader_scrn_num=0; + video_config.glsl_shader_scrn_num=0; - for(i=0; i0) - { - video_config.glsl_shader_scrn[i] = (char *) malloc(strlen(stemp)+1); - strcpy(video_config.glsl_shader_scrn[i], stemp); - video_config.glsl_shader_scrn_num++; - } else { - video_config.glsl_shader_scrn[i] = NULL; - } - } - } else { - int i; - video_config.glsl_filter = 0; - video_config.glsl_shader_mamebm_num=0; - for(i=0; i0) { + video_config.glsl_shader_scrn[i] = (char *) malloc(strlen(stemp)+1); + strcpy(video_config.glsl_shader_scrn[i], stemp); + video_config.glsl_shader_scrn_num++; + } else { video_config.glsl_shader_scrn[i] = NULL; } } + } else { + int i; + video_config.glsl_filter = 0; + video_config.glsl_shader_mamebm_num=0; + for(i=0; i0) { - stemp = options().shader_mame(i); - if (stemp && strcmp(stemp, OSDOPTVAL_NONE) != 0 && strlen(stemp)>0) - { - video_config.glsl_shader_mamebm[i] = (char *) malloc(strlen(stemp)+1); - strcpy(video_config.glsl_shader_mamebm[i], stemp); - video_config.glsl_shader_mamebm_num++; - } else { - video_config.glsl_shader_mamebm[i] = NULL; - } + video_config.glsl_shader_mamebm[i] = (char *) malloc(strlen(stemp)+1); + strcpy(video_config.glsl_shader_mamebm[i], stemp); + video_config.glsl_shader_mamebm_num++; + } else { + video_config.glsl_shader_mamebm[i] = NULL; } + } - video_config.glsl_shader_scrn_num=0; + video_config.glsl_shader_scrn_num=0; - for(i=0; i0) - { - video_config.glsl_shader_scrn[i] = (char *) malloc(strlen(stemp)+1); - strcpy(video_config.glsl_shader_scrn[i], stemp); - video_config.glsl_shader_scrn_num++; - } else { - video_config.glsl_shader_scrn[i] = NULL; - } - } - } else { - int i; - video_config.glsl_filter = 0; - video_config.glsl_shader_mamebm_num=0; - for(i=0; i0) { + video_config.glsl_shader_scrn[i] = (char *) malloc(strlen(stemp)+1); + strcpy(video_config.glsl_shader_scrn[i], stemp); + video_config.glsl_shader_scrn_num++; + } else { video_config.glsl_shader_scrn[i] = NULL; } } + } else { + int i; + video_config.glsl_filter = 0; + video_config.glsl_shader_mamebm_num=0; + for(i=0; i Date: Tue, 16 Feb 2016 17:35:27 +0100 Subject: BGFX mandatory requirement (nw) --- makefile | 9 +-------- scripts/genie.lua | 14 -------------- scripts/src/3rdparty.lua | 2 -- scripts/src/main.lua | 8 ++------ scripts/src/osd/modules.lua | 27 +++++++++------------------ scripts/src/osd/sdl.lua | 8 +++----- src/osd/sdl/video.cpp | 2 -- src/osd/sdl/window.cpp | 2 -- src/osd/windows/video.cpp | 2 -- src/osd/windows/video.h | 2 -- src/osd/windows/window.cpp | 4 ---- 11 files changed, 15 insertions(+), 65 deletions(-) diff --git a/makefile b/makefile index 9ead341d669..d968737fb2e 100644 --- a/makefile +++ b/makefile @@ -23,8 +23,6 @@ # BENCHMARKS = 1 # OSD = sdl -# USE_BGFX = 1 -# NO_OPENGL = 1 # USE_DISPATCH_GL = 0 # MODERN_WIN_API = 0 # USE_XAUDIO2 = 0 @@ -68,7 +66,6 @@ # MESA_INSTALL_ROOT = /opt/mesa # SDL_INSTALL_ROOT = /opt/sdl2 # SDL_FRAMEWORK_PATH = $(HOME)/Library/Frameworks -# SDL_LIBVER = sdl # USE_LIBSDL = 1 # CYGWIN_BUILD = 1 @@ -563,10 +560,6 @@ ifdef DONT_USE_NETWORK PARAMS += --DONT_USE_NETWORK='$(DONT_USE_NETWORK)' endif -ifdef NO_OPENGL -PARAMS += --NO_OPENGL='$(NO_OPENGL)' -endif - ifdef USE_DISPATCH_GL PARAMS += --USE_DISPATCH_GL='$(USE_DISPATCH_GL)' endif @@ -1200,7 +1193,7 @@ endif ifndef MARVELL_ROOTFS $(error MARVELL_ROOTFS is not set) endif - $(SILENT) $(GENIE) $(PARAMS) --gcc=steamlink --gcc_version=$(GCC_VERSION) --NO_OPENGL=1 --NO_USE_MIDI=1 --NO_X11=1 --NOASM=1 --SDL_INSTALL_ROOT=$(MARVELL_ROOTFS)/usr gmake + $(SILENT) $(GENIE) $(PARAMS) --gcc=steamlink --gcc_version=$(GCC_VERSION) --NO_USE_MIDI=1 --NO_X11=1 --NOASM=1 --SDL_INSTALL_ROOT=$(MARVELL_ROOTFS)/usr gmake .PHONY: steamlink ifndef MARVELL_SDK_PATH diff --git a/scripts/genie.lua b/scripts/genie.lua index 70901cf038f..984196e2af7 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -275,15 +275,6 @@ newoption { description = "NOWERROR", } -newoption { - trigger = "USE_BGFX", - description = "Use of BGFX.", - allowed = { - { "0", "Disabled" }, - { "1", "Enabled" }, - } -} - newoption { trigger = "DEPRECATED", description = "Generate deprecation warnings during compilation.", @@ -427,11 +418,6 @@ if _OPTIONS["NOASM"]=="1" and not _OPTIONS["FORCE_DRC_C_BACKEND"] then _OPTIONS["FORCE_DRC_C_BACKEND"] = "1" end -USE_BGFX = 1 -if(_OPTIONS["USE_BGFX"]~=nil) then - USE_BGFX = tonumber(_OPTIONS["USE_BGFX"]) -end - if(_OPTIONS["TOOLCHAIN"] == nil) then _OPTIONS['TOOLCHAIN'] = "" end diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 9f44143da1d..04038127dfb 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -705,7 +705,6 @@ end -- BGFX library objects -------------------------------------------------- -if (USE_BGFX == 1) then project "bgfx" uuid "d3e7e119-35cf-4f4f-aba0-d3bdcd1b879a" kind "StaticLib" @@ -833,7 +832,6 @@ end MAME_DIR .. "3rdparty/bgfx/src/renderer_mtl.mm", } end -end -------------------------------------------------- -- PortAudio library objects diff --git a/scripts/src/main.lua b/scripts/src/main.lua index 9d0d9a9d9e1..9873ba269c9 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -169,12 +169,8 @@ end "portmidi", } end - if (USE_BGFX == 1) then - links { - "bgfx" - } - end - links{ + links { + "bgfx", "ocore_" .. _OPTIONS["osd"], } diff --git a/scripts/src/osd/modules.lua b/scripts/src/osd/modules.lua index 6e0bf611844..c3d4d3a117d 100644 --- a/scripts/src/osd/modules.lua +++ b/scripts/src/osd/modules.lua @@ -91,19 +91,14 @@ function osdmodulesbuild() } end - if USE_BGFX == 1 then - files { - MAME_DIR .. "src/osd/modules/render/drawbgfx.cpp", - MAME_DIR .. "src/osd/modules/render/binpacker.cpp", - } - defines { - "USE_BGFX" - } - includedirs { - MAME_DIR .. "3rdparty/bgfx/include", - MAME_DIR .. "3rdparty/bx/include", - } - end + files { + MAME_DIR .. "src/osd/modules/render/drawbgfx.cpp", + MAME_DIR .. "src/osd/modules/render/binpacker.cpp", + } + includedirs { + MAME_DIR .. "3rdparty/bgfx/include", + MAME_DIR .. "3rdparty/bx/include", + } if _OPTIONS["NO_USE_MIDI"]=="1" then defines { @@ -346,11 +341,7 @@ newoption { } if not _OPTIONS["USE_DISPATCH_GL"] then - if USE_BGFX == 1 then - _OPTIONS["USE_DISPATCH_GL"] = "0" - else - _OPTIONS["USE_DISPATCH_GL"] = "1" - end + _OPTIONS["USE_DISPATCH_GL"] = "0" end newoption { diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 3d1a3663614..0aad67e89a2 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -87,11 +87,9 @@ function maintargetosdoptions(_target,_subtarget) configuration { "mingw*" or "vs*" } targetprefix "sdl" - if USE_BGFX == 1 then - links { - "psapi" - } - end + links { + "psapi" + } configuration { } end diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index 3e1732dad2f..578c2bde327 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -381,12 +381,10 @@ void sdl_osd_interface::extract_video_config() { video_config.mode = VIDEO_MODE_SDL2ACCEL; } -#ifdef USE_BGFX else if (strcmp(stemp, SDLOPTVAL_BGFX) == 0) { video_config.mode = VIDEO_MODE_BGFX; } -#endif else { osd_printf_warning("Invalid video value %s; reverting to software\n", stemp); diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index d9380acf096..e94a64a24dc 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -233,13 +233,11 @@ bool sdl_osd_interface::window_init() if (drawsdl2_init(machine(), &draw)) video_config.mode = VIDEO_MODE_SOFT; } -#ifdef USE_BGFX if (video_config.mode == VIDEO_MODE_BGFX) { if (drawbgfx_init(machine(), &draw)) video_config.mode = VIDEO_MODE_SOFT; } -#endif if (video_config.mode == VIDEO_MODE_SOFT) { if (drawsdl_init(&draw)) diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index 48433d9b01c..d62fe36c2cb 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -377,10 +377,8 @@ void windows_osd_interface::extract_video_config() video_config.mode = VIDEO_MODE_DDRAW; else if (strcmp(stemp, "gdi") == 0) video_config.mode = VIDEO_MODE_GDI; -#if defined (USE_BGFX) else if (strcmp(stemp, "bgfx") == 0) video_config.mode = VIDEO_MODE_BGFX; -#endif else if (strcmp(stemp, "none") == 0) { video_config.mode = VIDEO_MODE_NONE; diff --git a/src/osd/windows/video.h b/src/osd/windows/video.h index 9ddcdd5b3ef..9cc833f67e2 100644 --- a/src/osd/windows/video.h +++ b/src/osd/windows/video.h @@ -22,9 +22,7 @@ enum { VIDEO_MODE_NONE, VIDEO_MODE_GDI, VIDEO_MODE_DDRAW, -#if defined (USE_BGFX) VIDEO_MODE_BGFX, -#endif VIDEO_MODE_OPENGL, VIDEO_MODE_D3D }; diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index a7715836350..8a177f53963 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -38,9 +38,7 @@ extern int drawnone_init(running_machine &machine, osd_draw_callbacks *callbacks extern int drawgdi_init(running_machine &machine, osd_draw_callbacks *callbacks); extern int drawdd_init(running_machine &machine, osd_draw_callbacks *callbacks); extern int drawd3d_init(running_machine &machine, osd_draw_callbacks *callbacks); -#if defined(USE_BGFX) extern int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks); -#endif extern int drawogl_init(running_machine &machine, osd_draw_callbacks *callbacks); //============================================================ @@ -226,10 +224,8 @@ bool windows_osd_interface::window_init() } if (video_config.mode == VIDEO_MODE_GDI) drawgdi_init(machine(), &draw); -#if defined(USE_BGFX) if (video_config.mode == VIDEO_MODE_BGFX) drawbgfx_init(machine(), &draw); -#endif if (video_config.mode == VIDEO_MODE_NONE) drawnone_init(machine(), &draw); if (video_config.mode == VIDEO_MODE_OPENGL) -- cgit v1.2.3-70-g09d2 From 38e054c76552c1b4c1598a489b4bacf614f0949d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 16 Feb 2016 18:00:19 +0100 Subject: placed back OPENGL check since GL is not same as GLES (nw) --- makefile | 2 +- scripts/src/emu.lua | 2 +- scripts/src/osd/modules.lua | 62 +++++++++++++------- scripts/src/osd/osdmini_cfg.lua | 1 + scripts/src/osd/sdl_cfg.lua | 2 +- src/osd/modules/lib/osdobj_common.cpp | 2 + src/osd/modules/opengl/osd_opengl.h | 4 ++ src/osd/modules/render/draw13.cpp | 4 ++ src/osd/sdl/osdsdl.h | 2 + src/osd/sdl/sdlmain.cpp | 5 ++ src/osd/sdl/video.cpp | 106 ++++++++++++++++++---------------- src/osd/sdl/window.cpp | 2 + src/osd/windows/video.cpp | 92 +++++++++++++++-------------- src/osd/windows/video.h | 2 + src/osd/windows/window.cpp | 4 ++ 15 files changed, 173 insertions(+), 119 deletions(-) diff --git a/makefile b/makefile index d968737fb2e..519ecb0fb55 100644 --- a/makefile +++ b/makefile @@ -1193,7 +1193,7 @@ endif ifndef MARVELL_ROOTFS $(error MARVELL_ROOTFS is not set) endif - $(SILENT) $(GENIE) $(PARAMS) --gcc=steamlink --gcc_version=$(GCC_VERSION) --NO_USE_MIDI=1 --NO_X11=1 --NOASM=1 --SDL_INSTALL_ROOT=$(MARVELL_ROOTFS)/usr gmake + $(SILENT) $(GENIE) $(PARAMS) --gcc=steamlink --gcc_version=$(GCC_VERSION) --NO_OPENGL=1 --NO_USE_MIDI=1 --NO_X11=1 --NOASM=1 --SDL_INSTALL_ROOT=$(MARVELL_ROOTFS)/usr gmake .PHONY: steamlink ifndef MARVELL_SDK_PATH diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index e8d2abba10a..e0358285114 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -38,7 +38,7 @@ if _OPTIONS["with-bundled-lua"] then } end -if (_OPTIONS["targetos"] == "windows" and _OPTIONS["osd"] ~= "osdmini" ) then +if (_OPTIONS["targetos"] == "windows") then defines { "UI_WINDOWS", } diff --git a/scripts/src/osd/modules.lua b/scripts/src/osd/modules.lua index c3d4d3a117d..8e55ae2d8d3 100644 --- a/scripts/src/osd/modules.lua +++ b/scripts/src/osd/modules.lua @@ -77,18 +77,27 @@ function osdmodulesbuild() } end - files { - MAME_DIR .. "src/osd/modules/render/drawogl.cpp", - MAME_DIR .. "src/osd/modules/opengl/gl_shader_tool.cpp", - MAME_DIR .. "src/osd/modules/opengl/gl_shader_mgr.cpp", - MAME_DIR .. "src/osd/modules/opengl/gl_shader_mgr.h", - MAME_DIR .. "src/osd/modules/opengl/gl_shader_tool.h", - MAME_DIR .. "src/osd/modules/opengl/osd_opengl.h", - } - if _OPTIONS["USE_DISPATCH_GL"]=="1" then + if _OPTIONS["NO_OPENGL"]=="1" then + defines { + "USE_OPENGL=0", + } + else + files { + MAME_DIR .. "src/osd/modules/render/drawogl.cpp", + MAME_DIR .. "src/osd/modules/opengl/gl_shader_tool.cpp", + MAME_DIR .. "src/osd/modules/opengl/gl_shader_mgr.cpp", + MAME_DIR .. "src/osd/modules/opengl/gl_shader_mgr.h", + MAME_DIR .. "src/osd/modules/opengl/gl_shader_tool.h", + MAME_DIR .. "src/osd/modules/opengl/osd_opengl.h", + } defines { - "USE_DISPATCH_GL=1", + "USE_OPENGL=1", } + if _OPTIONS["USE_DISPATCH_GL"]=="1" then + defines { + "USE_DISPATCH_GL=1", + } + end end files { @@ -242,19 +251,21 @@ end function osdmodulestargetconf() - if _OPTIONS["targetos"]=="macosx" then - links { - "OpenGL.framework", - } - elseif _OPTIONS["USE_DISPATCH_GL"]~="1" then - if _OPTIONS["targetos"]=="windows" then - links { - "opengl32", - } - else + if _OPTIONS["NO_OPENGL"]~="1" then + if _OPTIONS["targetos"]=="macosx" then links { - "GL", + "OpenGL.framework", } + elseif _OPTIONS["USE_DISPATCH_GL"]~="1" then + if _OPTIONS["targetos"]=="windows" then + links { + "opengl32", + } + else + links { + "GL", + } + end end end @@ -331,6 +342,15 @@ newoption { description = "Disable network access", } +newoption { + trigger = "NO_OPENGL", + description = "Disable use of OpenGL", + allowed = { + { "0", "Enable OpenGL" }, + { "1", "Disable OpenGL" }, + }, +} + newoption { trigger = "USE_DISPATCH_GL", description = "Use GL-dispatching", diff --git a/scripts/src/osd/osdmini_cfg.lua b/scripts/src/osd/osdmini_cfg.lua index 09631dcbc0b..586075d3cac 100644 --- a/scripts/src/osd/osdmini_cfg.lua +++ b/scripts/src/osd/osdmini_cfg.lua @@ -6,6 +6,7 @@ defines { "USE_QTDEBUG=0", "USE_SDL", "SDLMAME_NOASM=1", + "USE_OPENGL=0", "NO_USE_MIDI=1", "USE_XAUDIO2=0", } diff --git a/scripts/src/osd/sdl_cfg.lua b/scripts/src/osd/sdl_cfg.lua index 0eb5a9333f2..bdeb7274ef1 100644 --- a/scripts/src/osd/sdl_cfg.lua +++ b/scripts/src/osd/sdl_cfg.lua @@ -12,7 +12,7 @@ if SDL_NETWORK~="" and not _OPTIONS["DONT_USE_NETWORK"] then } end -if _OPTIONS["USE_DISPATCH_GL"]~="1" and _OPTIONS["MESA_INSTALL_ROOT"] then +if _OPTIONS["NO_OPENGL"]~="1" and _OPTIONS["USE_DISPATCH_GL"]~="1" and _OPTIONS["MESA_INSTALL_ROOT"] then includedirs { path.join(_OPTIONS["MESA_INSTALL_ROOT"],"include"), } diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index c65d60b9527..b36bbf60df3 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -86,6 +86,7 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_FILTER ";glfilter;flt", "1", OPTION_BOOLEAN, "enable bilinear filtering on screen output" }, { OSDOPTION_PRESCALE, "1", OPTION_INTEGER, "scale screen rendering by this amount in software" }, +#if USE_OPENGL { NULL, NULL, OPTION_HEADER, "OpenGL-SPECIFIC OPTIONS" }, { OSDOPTION_GL_FORCEPOW2TEXTURE, "0", OPTION_BOOLEAN, "force power of two textures (default no)" }, { OSDOPTION_GL_NOTEXTURERECT, "0", OPTION_BOOLEAN, "don't use OpenGL GL_ARB_texture_rectangle (default on)" }, @@ -113,6 +114,7 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_SHADER_SCREEN "7", OSDOPTVAL_NONE, OPTION_STRING, "custom OpenGL GLSL shader screen bitmap 7" }, { OSDOPTION_SHADER_SCREEN "8", OSDOPTVAL_NONE, OPTION_STRING, "custom OpenGL GLSL shader screen bitmap 8" }, { OSDOPTION_SHADER_SCREEN "9", OSDOPTVAL_NONE, OPTION_STRING, "custom OpenGL GLSL shader screen bitmap 9" }, +#endif { NULL, NULL, OPTION_HEADER, "OSD SOUND OPTIONS" }, { OSDOPTION_SOUND, OSDOPTVAL_AUTO, OPTION_STRING, "sound output method: " }, diff --git a/src/osd/modules/opengl/osd_opengl.h b/src/osd/modules/opengl/osd_opengl.h index 481925045e5..26f577f343e 100644 --- a/src/osd/modules/opengl/osd_opengl.h +++ b/src/osd/modules/opengl/osd_opengl.h @@ -12,6 +12,8 @@ #ifndef _OSD_OPENGL_H #define _OSD_OPENGL_H + #if USE_OPENGL + /* equivalent to #include * #include */ @@ -109,6 +111,8 @@ #endif /* USE_DISPATCH_GL */ + #endif /* USE_OPENGL */ + #endif /* _OSD_OPENGL_H */ #else /* MANGLE */ diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp index 623840525ad..320cc9f3a62 100644 --- a/src/osd/modules/render/draw13.cpp +++ b/src/osd/modules/render/draw13.cpp @@ -546,8 +546,12 @@ int drawsdl2_init(running_machine &machine, osd_draw_callbacks *callbacks) osd_printf_verbose("Using SDL native texturing driver (SDL 2.0+)\n"); +#if USE_OPENGL // Load the GL library now - else MT will fail const char *stemp = downcast(machine.options()).gl_lib(); +#else + const char *stemp = NULL; +#endif if (stemp != NULL && strcmp(stemp, OSDOPTVAL_AUTO) == 0) stemp = NULL; diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index 7ba8832da6e..bca299eb49d 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -122,7 +122,9 @@ public: const char *video_driver() const { return value(SDLOPTION_VIDEODRIVER); } const char *render_driver() const { return value(SDLOPTION_RENDERDRIVER); } const char *audio_driver() const { return value(SDLOPTION_AUDIODRIVER); } +#if USE_OPENGL const char *gl_lib() const { return value(SDLOPTION_GL_LIB); } +#endif private: static const options_entry s_option_entries[]; diff --git a/src/osd/sdl/sdlmain.cpp b/src/osd/sdl/sdlmain.cpp index 43c49480d2b..530aa41c9d4 100644 --- a/src/osd/sdl/sdlmain.cpp +++ b/src/osd/sdl/sdlmain.cpp @@ -164,7 +164,9 @@ const options_entry sdl_options::s_option_entries[] = { SDLOPTION_VIDEODRIVER ";vd", OSDOPTVAL_AUTO, OPTION_STRING, "sdl video driver to use ('x11', 'directfb', ... or 'auto' for SDL default" }, { SDLOPTION_RENDERDRIVER ";rd", OSDOPTVAL_AUTO, OPTION_STRING, "sdl render driver to use ('software', 'opengl', 'directfb' ... or 'auto' for SDL default" }, { SDLOPTION_AUDIODRIVER ";ad", OSDOPTVAL_AUTO, OPTION_STRING, "sdl audio driver to use ('alsa', 'arts', ... or 'auto' for SDL default" }, +#if USE_OPENGL { SDLOPTION_GL_LIB, SDLOPTVAL_GLLIB, OPTION_STRING, "alternative libGL.so to use; 'auto' for system default" }, +#endif // End of list { NULL } @@ -343,6 +345,7 @@ static void defines_verbose(void) osd_printf_verbose("\n"); osd_printf_verbose("SDL/OpenGL defines: "); osd_printf_verbose("SDL_COMPILEDVERSION=%d ", SDL_COMPILEDVERSION); + MACRO_VERBOSE(USE_OPENGL); MACRO_VERBOSE(USE_DISPATCH_GL); osd_printf_verbose("\n"); osd_printf_verbose("Compiler defines A: "); @@ -484,6 +487,7 @@ void sdl_osd_interface::init(running_machine &machine) /* Set the SDL environment variable for drivers wanting to load the * lib at startup. */ +#if USE_OPENGL /* FIXME: move lib loading code from drawogl.c here */ stemp = options().gl_lib(); @@ -492,6 +496,7 @@ void sdl_osd_interface::init(running_machine &machine) osd_setenv("SDL_VIDEO_GL_DRIVER", stemp, 1); osd_printf_verbose("Setting SDL_VIDEO_GL_DRIVER = '%s' ...\n", stemp); } +#endif /* get number of processors */ stemp = options().numprocessors(); diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index 578c2bde327..ca7286d5696 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -313,12 +313,14 @@ static void check_osd_inputs(running_machine &machine) machine.ui().popup_time(1, "Keepaspect %s", video_config.keepaspect? "enabled":"disabled"); } - //FIXME: on a per window basis - if (machine.ui_input().pressed(IPT_OSD_5)) - { - video_config.filter = !video_config.filter; - machine.ui().popup_time(1, "Filter %s", video_config.filter? "enabled":"disabled"); - } + #if (USE_OPENGL) + //FIXME: on a per window basis + if (machine.ui_input().pressed(IPT_OSD_5)) + { + video_config.filter = !video_config.filter; + machine.ui().popup_time(1, "Filter %s", video_config.filter? "enabled":"disabled"); + } + #endif if (machine.ui_input().pressed(IPT_OSD_6)) window->modify_prescale(-1); @@ -375,7 +377,7 @@ void sdl_osd_interface::extract_video_config() if (options().seconds_to_run() == 0) osd_printf_warning("Warning: -video none doesn't make much sense without -seconds_to_run\n"); } - else if (strcmp(stemp, SDLOPTVAL_OPENGL) == 0) + else if (USE_OPENGL && (strcmp(stemp, SDLOPTVAL_OPENGL) == 0)) video_config.mode = VIDEO_MODE_OPENGL; else if ((strcmp(stemp, SDLOPTVAL_SDL2ACCEL) == 0)) { @@ -407,62 +409,64 @@ void sdl_osd_interface::extract_video_config() osd_printf_warning("Invalid prescale option, reverting to '1'\n"); video_config.prescale = 1; } - // default to working video please - video_config.forcepow2texture = options().gl_force_pow2_texture(); - video_config.allowtexturerect = !(options().gl_no_texture_rect()); - video_config.vbo = options().gl_vbo(); - video_config.pbo = options().gl_pbo(); - video_config.glsl = options().gl_glsl(); - if ( video_config.glsl ) - { - int i; + #if (USE_OPENGL) + // default to working video please + video_config.forcepow2texture = options().gl_force_pow2_texture(); + video_config.allowtexturerect = !(options().gl_no_texture_rect()); + video_config.vbo = options().gl_vbo(); + video_config.pbo = options().gl_pbo(); + video_config.glsl = options().gl_glsl(); + if ( video_config.glsl ) + { + int i; - video_config.glsl_filter = options().glsl_filter(); + video_config.glsl_filter = options().glsl_filter(); - video_config.glsl_shader_mamebm_num=0; + video_config.glsl_shader_mamebm_num=0; - for(i=0; i0) + for(i=0; i0) + { + video_config.glsl_shader_mamebm[i] = (char *) malloc(strlen(stemp)+1); + strcpy(video_config.glsl_shader_mamebm[i], stemp); + video_config.glsl_shader_mamebm_num++; + } else { + video_config.glsl_shader_mamebm[i] = NULL; + } } - } - video_config.glsl_shader_scrn_num=0; + video_config.glsl_shader_scrn_num=0; - for(i=0; i0) + for(i=0; i0) + { + video_config.glsl_shader_scrn[i] = (char *) malloc(strlen(stemp)+1); + strcpy(video_config.glsl_shader_scrn[i], stemp); + video_config.glsl_shader_scrn_num++; + } else { + video_config.glsl_shader_scrn[i] = NULL; + } + } + } else { + int i; + video_config.glsl_filter = 0; + video_config.glsl_shader_mamebm_num=0; + for(i=0; i0) + for(i=0; i0) + { + video_config.glsl_shader_mamebm[i] = (char *) malloc(strlen(stemp)+1); + strcpy(video_config.glsl_shader_mamebm[i], stemp); + video_config.glsl_shader_mamebm_num++; + } else { + video_config.glsl_shader_mamebm[i] = NULL; + } } - } - video_config.glsl_shader_scrn_num=0; + video_config.glsl_shader_scrn_num=0; - for(i=0; i0) + for(i=0; i0) + { + video_config.glsl_shader_scrn[i] = (char *) malloc(strlen(stemp)+1); + strcpy(video_config.glsl_shader_scrn[i], stemp); + video_config.glsl_shader_scrn_num++; + } else { + video_config.glsl_shader_scrn[i] = NULL; + } + } + } else { + int i; + video_config.glsl_filter = 0; + video_config.glsl_shader_mamebm_num=0; + for(i=0; i Date: Tue, 16 Feb 2016 18:54:01 +0100 Subject: fidel*: small changes to cartridge handling --- hash/fidel_eag.xml | 9 ------ src/mame/drivers/fidel6502.cpp | 44 +++++++--------------------- src/mame/drivers/fidel68k.cpp | 65 +++++++++++------------------------------- src/mame/drivers/fidelz80.cpp | 20 +++++++++++++ src/mame/includes/fidelz80.h | 6 ++++ 5 files changed, 53 insertions(+), 91 deletions(-) delete mode 100644 hash/fidel_eag.xml diff --git a/hash/fidel_eag.xml b/hash/fidel_eag.xml deleted file mode 100644 index 7aafce545c1..00000000000 --- a/hash/fidel_eag.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 6487959caea..43bdd8337c8 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -265,9 +265,6 @@ Z80 D6 to W: (model 6092, tied to VCC otherwise) #include "cpu/m6502/r65c02.h" #include "cpu/m6502/m65sc02.h" #include "machine/6821pia.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "softlist.h" #include "includes/fidelz80.h" @@ -309,10 +306,9 @@ public: DECLARE_READ_LINE_MEMBER(csc_pia1_cb1_r); // SC12/6086 - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(scc_cartridge); - DECLARE_READ8_MEMBER(sc12_cart_r); DECLARE_WRITE8_MEMBER(sc12_control_w); DECLARE_READ8_MEMBER(sc12_input_r); + DECLARE_READ8_MEMBER(sc12_cart_r); // 6080/6092/6093 (Excellence) DECLARE_INPUT_CHANGED_MEMBER(fexcelv_bankswitch); @@ -459,35 +455,9 @@ WRITE_LINE_MEMBER(fidel6502_state::csc_pia1_ca2_w) SC12/6086 ******************************************************************************/ -// cartridge - -DEVICE_IMAGE_LOAD_MEMBER(fidel6502_state, scc_cartridge) -{ - UINT32 size = m_cart->common_get_size("rom"); - - // max size is 16KB - if (size > 0x4000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); - return IMAGE_INIT_FAIL; - } - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - return IMAGE_INIT_PASS; -} - -READ8_MEMBER(fidel6502_state::sc12_cart_r) -{ - if (m_cart->exists()) - return m_cart->read_rom(space, offset); - else - return 0; -} - - -// TTL +// TTL/generic WRITE8_MEMBER(fidel6502_state::sc12_control_w) { @@ -512,6 +482,14 @@ READ8_MEMBER(fidel6502_state::sc12_input_r) return (read_inputs(9) >> offset & 1) ? 0 : 0x80; } +READ8_MEMBER(fidel6502_state::sc12_cart_r) +{ + if (m_cart->exists()) + return m_cart->read_rom(space, offset); + else + return 0; +} + /****************************************************************************** @@ -868,7 +846,7 @@ static MACHINE_CONFIG_START( sc12, fidel6502_state ) /* cartridge */ MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fidel_scc") MCFG_GENERIC_EXTENSIONS("bin,dat") - MCFG_GENERIC_LOAD(fidel6502_state, scc_cartridge) + MCFG_GENERIC_LOAD(fidelz80base_state, scc_cartridge) MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_scc") MACHINE_CONFIG_END diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp index 5eedb9ca81c..15137c0d9d1 100644 --- a/src/mame/drivers/fidel68k.cpp +++ b/src/mame/drivers/fidel68k.cpp @@ -6,7 +6,6 @@ TODO: - how does dual-CPU work? - - the EAG manual mentions optional voice(speech) - IRQ level/timing is unknown ****************************************************************************** @@ -29,7 +28,7 @@ V6-V11 are on model 6117. Older 1986 model 6081 uses a 6502 CPU. - MB1422A DRAM Controller, 25MHz XTAL near, 4 DRAM slots(V2: slot 1 and 2 64KB) - 2*27C512 64KB EPROM, 2*KM6264AL-10 8KB SRAM, 2*AT28C64X 8KB EEPROM - OKI M82C51A-2 USART, 4.9152MHz XTAL, assume it's used for factory test/debug -- other special: magnet sensors, external module slot +- other special: magnet sensors, external module slot, printer port IRQ source is unknown. Several possibilities: - NE555 timer IC @@ -71,7 +70,7 @@ V11: 68060, 2MB h.RAM, high speed - MC68020RC25E CPU, QFP 25MHz XTAL, 2*GAL16V8C - 4*AS7C164-20PC 8KB SRAM, 2*KM684000ALG-7L 512KB CMOS SRAM - 2*27C512? 64KB EPROM, 2*HM6264LP-15 8KB SRAM, 2*AT28C64B 8KB EEPROM -- same as 6114: M82C51A, SN74HC4060, module slot, chessboard +- same as 6114: M82C51A, SN74HC4060, module slot, chessboard, .. Memory map: ----------- @@ -89,9 +88,6 @@ Memory map: #include "emu.h" #include "cpu/m68000/m68000.h" #include "machine/nvram.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "softlist.h" #include "includes/fidelz80.h" @@ -103,22 +99,19 @@ class fidel68k_state : public fidelz80base_state { public: fidel68k_state(const machine_config &mconfig, device_type type, const char *tag) - : fidelz80base_state(mconfig, type, tag), - m_cart(*this, "cartslot") + : fidelz80base_state(mconfig, type, tag) { } // devices/pointers - optional_device m_cart; // EAG(6114/6117) void eag_prepare_display(); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(eag_cartridge); - DECLARE_READ8_MEMBER(eag_cart_r); DECLARE_READ8_MEMBER(eag_input1_r); DECLARE_WRITE8_MEMBER(eag_leds_w); DECLARE_WRITE8_MEMBER(eag_7seg_w); DECLARE_WRITE8_MEMBER(eag_mux_w); DECLARE_READ8_MEMBER(eag_input2_r); + DECLARE_READ8_MEMBER(eag_cart_r); }; @@ -140,40 +133,7 @@ void fidel68k_state::eag_prepare_display() } -// cartridge - -DEVICE_IMAGE_LOAD_MEMBER(fidel68k_state, eag_cartridge) -{ - UINT32 size = m_cart->common_get_size("rom"); - - // max size is 16KB? - if (size > 0x4000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -READ8_MEMBER(fidel68k_state::eag_cart_r) -{ - if (m_cart->exists()) - { - static int yay=0; - if (!yay) { printf("Yay!\n"); yay=1; } - - return m_cart->read_rom(space, offset); - } - else - return 0; -} - - -// TTL +// TTL/generic READ8_MEMBER(fidel68k_state::eag_input1_r) { @@ -212,6 +172,14 @@ WRITE8_MEMBER(fidel68k_state::eag_mux_w) eag_prepare_display(); } +READ8_MEMBER(fidel68k_state::eag_cart_r) +{ + if (m_cart->exists()) + return m_cart->read_rom(space, offset); + else + return 0; +} + /****************************************************************************** @@ -372,11 +340,10 @@ static MACHINE_CONFIG_START( eag, fidel68k_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fidel_eag") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fidel_scc") MCFG_GENERIC_EXTENSIONS("bin,dat") - MCFG_GENERIC_LOAD(fidel68k_state, eag_cartridge) - MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_eag") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("fidel_scc_list", "fidel_scc") + MCFG_GENERIC_LOAD(fidelz80base_state, scc_cartridge) + MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_scc") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( eagv7, eag ) diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index c43378b707b..65f8dae867d 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -728,6 +728,26 @@ INPUT_CHANGED_MEMBER(fidelz80_state::reset_button) } +// cartridge + +DEVICE_IMAGE_LOAD_MEMBER(fidelz80base_state, scc_cartridge) +{ + UINT32 size = m_cart->common_get_size("rom"); + + // max size is 16KB? + if (size > 0x4000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + + // Devices, I/O diff --git a/src/mame/includes/fidelz80.h b/src/mame/includes/fidelz80.h index 6598cc76ec0..4bc338691f2 100644 --- a/src/mame/includes/fidelz80.h +++ b/src/mame/includes/fidelz80.h @@ -9,6 +9,9 @@ #include "emu.h" #include "sound/speaker.h" #include "sound/s14001a.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "softlist.h" class fidelz80base_state : public driver_device { @@ -20,6 +23,7 @@ public: m_speech(*this, "speech"), m_speech_rom(*this, "speech"), m_speaker(*this, "speaker"), + m_cart(*this, "cartslot"), m_display_wait(33), m_display_maxy(1), m_display_maxx(0) @@ -31,6 +35,7 @@ public: optional_device m_speech; optional_region_ptr m_speech_rom; optional_device m_speaker; + optional_device m_cart; // misc common UINT16 m_inp_mux; // multiplexed keypad/leds mask @@ -41,6 +46,7 @@ public: UINT8 m_speech_bank; // speech rom higher address bits UINT16 read_inputs(int columns); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(scc_cartridge); // display common int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) -- cgit v1.2.3-70-g09d2 From e446d482f886e014b1420425c6af00db5f2b3b7f Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 16 Feb 2016 19:01:10 +0100 Subject: fix for emscripten (nw) --- src/osd/modules/render/drawbgfx.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 2e16f915f37..cca3485f18c 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -117,7 +117,9 @@ static void* sdlNativeWindowHandle(SDL_Window* _window) # elif BX_PLATFORM_WINDOWS return wmi.info.win.window; # elif BX_PLATFORM_STEAMLINK - return wmi.info.vivante.window; + return wmi.info.vivante.window; +# elif BX_PLATFORM_EMSCRIPTEN + return nullptr; # endif // BX_PLATFORM_ } #endif -- cgit v1.2.3-70-g09d2 From 11f82be5400b274bc624b520f045dbc573182fe8 Mon Sep 17 00:00:00 2001 From: Justin Kerk Date: Tue, 16 Feb 2016 20:16:11 +0000 Subject: Fix Emscripten build (nw) --- scripts/src/osd/sdl.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 0aad67e89a2..b89a25814ad 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -96,7 +96,9 @@ end function sdlconfigcmd() - if not _OPTIONS["SDL_INSTALL_ROOT"] then + if _OPTIONS["targetos"]=="asmjs" then + return "sdl2-config" + elseif not _OPTIONS["SDL_INSTALL_ROOT"] then return _OPTIONS['TOOLCHAIN'] .. "pkg-config sdl2" else return path.join(_OPTIONS["SDL_INSTALL_ROOT"],"bin","sdl2") .. "-config" -- cgit v1.2.3-70-g09d2 From bacced3c81c010fb096f1df5cace1452a8132585 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Mon, 15 Feb 2016 23:51:18 -0600 Subject: lua api: cleanup options handling and fix cheat state return value (nw) --- docs/luaengine.md | 25 +++++++++++---- src/emu/luaengine.cpp | 88 ++++++++++++++++++++------------------------------- src/emu/luaengine.h | 3 +- 3 files changed, 55 insertions(+), 61 deletions(-) diff --git a/docs/luaengine.md b/docs/luaengine.md index ff79f46c21c..223a421cc27 100644 --- a/docs/luaengine.md +++ b/docs/luaengine.md @@ -156,10 +156,12 @@ program 41 ``` -manager:machine().options[] +manager:options() +manager:machine():options() +manager:machine():ui():options() ``` -> opts = manager:machine().options -> for k, entry in pairs(opts) do print(string.format("%10s: %s\n%11s %s", k, entry:value(), "", entry:description())) end +> opts = manager:machine():options() +> for k, entry in pairs(opts.entries) do print(string.format("%10s: %s\n%11s %s", k, entry:value(), "", entry:description())) end diff_directory: diff directory to save hard drive image differeVnce files joystick_contradictory: false @@ -169,9 +171,20 @@ joystick_contradictory: false oslog: false output error.log data to the system debugger [...] -> print(opts["sleep"]:value()) +> print(opts.entries["sleep"]:value()) true -> print(opts["sleep"]:value("invalid")) -Illegal boolean value for sleep: "invalid"; reverting to 0 +> print(opts.entries["sleep"]:value("invalid")) +Illegal boolean value for sleep: "invalid"; reverting to 1 +true +> print(opts.entries["sleep"]:value(false)) false ``` + +individual screen snapshots +``` +> local screen = manager:machine().screens[":screen"] +> screen:snapshot() +saved snap/gridlee/0000.png +> screen:snapshot('%g.png') +saved snap/gridlee.png +``` diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index bf89139f310..990f417eac4 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -375,31 +375,35 @@ void lua_engine::emu_set_hook(lua_State *L) } //------------------------------------------------- -// machine_options - return table of options -// -> manager:machine().options[] +// options_entry - return table of option entries +// -> manager:options().entries +// -> manager:machine():options().entries +// -> manager:machine():ui():options().entries //------------------------------------------------- -luabridge::LuaRef lua_engine::l_machine_get_options(const running_machine *r) +template +luabridge::LuaRef lua_engine::l_options_get_entries(const T *o) { + T *options = const_cast(o); lua_State *L = luaThis->m_lua_state; - luabridge::LuaRef options_table = luabridge::LuaRef::newTable(L); + luabridge::LuaRef entries_table = luabridge::LuaRef::newTable(L); int unadorned_index = 0; - for (core_options::entry *curentry = r->options().first(); curentry != nullptr; curentry = curentry->next()) + for (typename T::entry *curentry = options->first(); curentry != nullptr; curentry = curentry->next()) { const char *name = curentry->name(); bool is_unadorned = false; // check if it's unadorned - if (name && strlen(name) && !strcmp(name, core_options::unadorned(unadorned_index))) + if (name && strlen(name) && !strcmp(name, options->unadorned(unadorned_index))) { unadorned_index++; is_unadorned = true; } if (!curentry->is_header() && !curentry->is_command() && !curentry->is_internal() && !is_unadorned) - options_table[name] = curentry; + entries_table[name] = curentry; } - return options_table; + return entries_table; } //------------------------------------------------- @@ -469,16 +473,11 @@ int lua_engine::lua_cheat_entry::l_get_state(lua_State *L) switch (ce->state()) { - case SCRIPT_STATE_ON: - lua_pushliteral(L, "on"); - case SCRIPT_STATE_RUN: - lua_pushliteral(L, "run"); - case SCRIPT_STATE_CHANGE: - lua_pushliteral(L, "change"); - case SCRIPT_STATE_COUNT: - lua_pushliteral(L, "count"); - default: - lua_pushliteral(L, "off"); + case SCRIPT_STATE_ON: lua_pushliteral(L, "on"); break; + case SCRIPT_STATE_RUN: lua_pushliteral(L, "run"); break; + case SCRIPT_STATE_CHANGE: lua_pushliteral(L, "change"); break; + case SCRIPT_STATE_COUNT: lua_pushliteral(L, "count"); break; + default: lua_pushliteral(L, "off"); break; } return 1; @@ -722,35 +721,6 @@ int lua_engine::lua_addr_space::l_mem_write(lua_State *L) return 0; } -//------------------------------------------------- -// ui_options - return table of options -// -> manager:machine():ui().options[] -//------------------------------------------------- - -luabridge::LuaRef lua_engine::l_ui_get_options(const ui_manager *u) -{ - ui_manager *ui = const_cast(u); - lua_State *L = luaThis->m_lua_state; - luabridge::LuaRef options_table = luabridge::LuaRef::newTable(L); - - int unadorned_index = 0; - for (core_options::entry *curentry = ui->options().first(); curentry != nullptr; curentry = curentry->next()) - { - const char *name = curentry->name(); - bool is_unadorned = false; - // check if it's unadorned - if (name && strlen(name) && !strcmp(name, core_options::unadorned(unadorned_index))) - { - unadorned_index++; - is_unadorned = true; - } - if (!curentry->is_header() && !curentry->is_command() && !curentry->is_internal() && !is_unadorned) - options_table[name] = curentry; - } - - return options_table; -} - int lua_engine::lua_options_entry::l_entry_value(lua_State *L) { core_options::entry *e = luabridge::Stack::get(L, 1); @@ -763,13 +733,15 @@ int lua_engine::lua_options_entry::l_entry_value(lua_State *L) if (!lua_isnone(L, 2)) { std::string error; + // FIXME: not working with ui_options::entry + // TODO: optional arg for priority luaThis->machine().options().set_value(e->name(), lua_isboolean(L, 2) ? (lua_toboolean(L, 2) ? "1" : "0") : lua_tostring(L, 2), OPTION_PRIORITY_CMDLINE, error); if (!error.empty()) { - lua_writestringerror("%s", error.c_str()); + luaL_error(L, "%s", error.c_str()); } } @@ -833,7 +805,7 @@ int lua_engine::lua_video::l_end_recording(lua_State *L) } if (!vm->is_recording()) { - lua_writestringerror("%s", "Error, no active recording to stop"); + lua_writestringerror("%s", "No active recording to stop"); return 0; } @@ -907,7 +879,7 @@ int lua_engine::lua_screen::l_snapshot(lua_State *L) emu_file file(sc->machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); file_error filerr; - if (!lua_isnone(L, 5)) { + if (!lua_isnone(L, 2)) { const char *filename = lua_tostring(L, 2); std::string snapstr(filename); strreplace(snapstr, "/", PATH_SEPARATOR); @@ -921,11 +893,12 @@ int lua_engine::lua_screen::l_snapshot(lua_State *L) if (filerr != FILERR_NONE) { - lua_writestringerror("Error creating snapshot, file_error=%d", filerr); + luaL_error(L, "file_error=%d", filerr); return 0; } sc->machine().video().save_snapshot(sc, file); + lua_writestringerror("saved %s", file.fullpath()); file.close(); return 1; } @@ -1421,9 +1394,9 @@ void lua_engine::initialize() .addFunction ("ioport", &running_machine::ioport) .addFunction ("parameters", &running_machine::parameters) .addFunction ("cheat", &running_machine::cheat) + .addFunction ("options", &running_machine::options) .addProperty ("devices", &lua_engine::l_machine_get_devices) .addProperty ("screens", &lua_engine::l_machine_get_screens) - .addProperty ("options", &lua_engine::l_machine_get_options) .endClass () .beginClass ("game_driver") .addData ("source_file", &game_driver::source_file) @@ -1512,6 +1485,11 @@ void lua_engine::initialize() .addProperty ("crosshair_scale", &ioport_field::crosshair_scale, &ioport_field::set_crosshair_scale) .addProperty ("crosshair_offset", &ioport_field::crosshair_offset, &ioport_field::set_crosshair_offset) .endClass() + .beginClass ("core_options") + .addFunction ("help", &core_options::output_help) + .addFunction ("command", &core_options::command) + .addProperty ("entries", &lua_engine::l_options_get_entries) + .endClass() .beginClass ("lua_options_entry") .addCFunction ("value", &lua_options_entry::l_entry_value) .endClass() @@ -1522,6 +1500,10 @@ void lua_engine::initialize() .addFunction ("maximum", &core_options::entry::maximum) .addFunction ("has_range", &core_options::entry::has_range) .endClass() + .deriveClass ("emu_options") + .endClass() + .deriveClass ("ui_options") + .endClass() .beginClass ("parameters") .addFunction ("add", ¶meters_manager::add) .addFunction ("lookup", ¶meters_manager::lookup) @@ -1594,10 +1576,10 @@ void lua_engine::initialize() .endClass() .beginClass ("ui") .addFunction ("is_menu_active", &ui_manager::is_menu_active) + .addFunction ("options", &ui_manager::options) .addProperty ("show_fps", &ui_manager::show_fps, &ui_manager::set_show_fps) .addProperty ("show_profiler", &ui_manager::show_profiler, &ui_manager::set_show_profiler) .addProperty ("single_step", &ui_manager::single_step, &ui_manager::set_single_step) - .addProperty ("options", &lua_engine::l_ui_get_options) .endClass() .beginClass ("lua_screen_dev") .addCFunction ("draw_box", &lua_screen::l_draw_box) diff --git a/src/emu/luaengine.h b/src/emu/luaengine.h index 94b90981819..fca3a564618 100644 --- a/src/emu/luaengine.h +++ b/src/emu/luaengine.h @@ -120,7 +120,6 @@ private: static int register_function(lua_State *L, const char *id); // "emu.machine" namespace - static luabridge::LuaRef l_machine_get_options(const running_machine *r); static luabridge::LuaRef l_machine_get_devices(const running_machine *r); static luabridge::LuaRef l_ioport_get_ports(const ioport_manager *i); static luabridge::LuaRef l_render_get_targets(const render_manager *r); @@ -156,7 +155,7 @@ private: int l_get_state(lua_State *L); }; - static luabridge::LuaRef l_ui_get_options(const ui_manager *ui); + template static luabridge::LuaRef l_options_get_entries(const T *o); struct lua_options_entry { int l_entry_value(lua_State *L); }; -- cgit v1.2.3-70-g09d2 From cacb75f4306a1bddb1a9431588296231a13f8f3d Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 16 Feb 2016 23:14:36 +0100 Subject: New Working machine added -------------- Fidelity Elite Avant Garde (V10/V11) [hap, Micha] --- src/mame/drivers/fidel68k.cpp | 117 +++++++++++++++++++++++++++++++++++++----- src/mame/drivers/tispeak.cpp | 6 +-- src/mame/drivers/tispellb.cpp | 9 ++-- src/mame/mess.lst | 2 + 4 files changed, 113 insertions(+), 21 deletions(-) diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp index 15137c0d9d1..efae99dfcb3 100644 --- a/src/mame/drivers/fidel68k.cpp +++ b/src/mame/drivers/fidel68k.cpp @@ -7,6 +7,8 @@ TODO: - how does dual-CPU work? - IRQ level/timing is unknown + - USART is not emulated + - V11 CPU should be M68EC060, not yet emulated ****************************************************************************** @@ -24,11 +26,13 @@ V5: 128KB+64KB DRAM, dual-CPU! (2*68K @ 16MHz) V6-V11 are on model 6117. Older 1986 model 6081 uses a 6502 CPU. +Hardware info: +-------------- - MC68HC000P12F 16MHz CPU, 16MHz XTAL - MB1422A DRAM Controller, 25MHz XTAL near, 4 DRAM slots(V2: slot 1 and 2 64KB) - 2*27C512 64KB EPROM, 2*KM6264AL-10 8KB SRAM, 2*AT28C64X 8KB EEPROM -- OKI M82C51A-2 USART, 4.9152MHz XTAL, assume it's used for factory test/debug -- other special: magnet sensors, external module slot, printer port +- OKI M82C51A-2 USART, 4.9152MHz XTAL +- other special: magnet sensors, external module slot, serial port IRQ source is unknown. Several possibilities: - NE555 timer IC @@ -38,6 +42,11 @@ IRQ source is unknown. Several possibilities: The module slot pinout is different from SCC series. The data on those appears to be compatible with EAG though and will load fine with an adapter. +The USART allows for a serial connection between the chess computer and another +device, for example a PC. Fidelity released a DOS tool called EAGLINK which +featured PC printer support, complete I/O control, detailed information while +the program is 'thinking', etc. + Memory map: (of what is known) ----------- 000000-01FFFF: 128KB ROM @@ -57,8 +66,8 @@ Memory map: (of what is known) Elite Avant Garde (EAG, model 6117) ----------------------------------- -There are 6 versions of model 6114(V6 to V11). The one emulated here came from a V7. -From a programmer's point of view, the hardware is very similar to model 6114. +There are 6 versions of model 6114(V6 to V11). From a programmer's point of view, +the hardware is very similar to model 6114. V6: 68020, 512KB hashtable RAM V7: 68020, 1MB h.RAM @@ -67,13 +76,15 @@ V9: 68030, 1MB h.RAM V10: 68040, 1MB h.RAM V11: 68060, 2MB h.RAM, high speed -- MC68020RC25E CPU, QFP 25MHz XTAL, 2*GAL16V8C +V7 Hardware info: +----------------- +- MC68020RC25E CPU, 25MHz XTAL - 4*AS7C164-20PC 8KB SRAM, 2*KM684000ALG-7L 512KB CMOS SRAM -- 2*27C512? 64KB EPROM, 2*HM6264LP-15 8KB SRAM, 2*AT28C64B 8KB EEPROM -- same as 6114: M82C51A, SN74HC4060, module slot, chessboard, .. +- 2*27C512? 64KB EPROM, 2*HM6264LP-15 8KB SRAM, 2*AT28C64B 8KB EEPROM, 2*GAL16V8C +- same as 6114: M82C51A, NE555, SN74HC4060, module slot, chessboard, .. -Memory map: ------------ +V7 Memory map: +-------------- 000000-01FFFF: 128KB ROM 104000-107FFF: 16KB SRAM (unused?) 200000-2FFFFF: hashtable SRAM @@ -83,6 +94,42 @@ Memory map: 604000-607FFF: 16KB EEPROM 800000-807FFF: 32KB SRAM +V10 Hardware info: +------------------ +- 68040 CPU, 25MHz +- other: assume same or very similar to V11(see below) + +The ROM dump came from the V11(see below). Built-in factory test proves +that this program is a V10. Hold TB button immediately after power-on and +press it for a sequence of tests: +1) all LEDs on +2) F40C: V10 program version +3) 38b9: V10 ROM checksum +4) xxxx: external module ROM checksum (0000 if no module present) +5) xxxx: user settings (stored in EEPROM) +6) xxxx: " +7) 1024: hashtable RAM size +8) return to game + +V11 Hardware info: +------------------ +- MC68EC060RC75 CPU, 36MHz XTAL(36MHz bus, 72MHz CPU), CPU cooler required +- 4*CXK5863AP-20 8KB SRAM, 4*K6X4008C1F-DF55 512KB CMOS SRAM +- 4*M27C256B 32KB EPROM, 2*AT28C64 8KB EEPROM, 5*GAL16V8D +- NEC D71051C USART, assume 8MHz, on quick glance it's same as the OKI USART +- same as 6114: NE555, SN74HC4060, module slot, chessboard, .. + +This is a custom overclocked V10, manufactured by Wilfried Bucke. PCB is marked: +"CHESS HW DESIGN COPYRIGHT 22-10-2002: REVA03 510.1136A01/510.1144B01 COMPONENT SIDE" +There are two versions of this, one with a 66MHz CPU, one with a 72MHz CPU. +Maybe other differences too? + +V1x Memory map: +--------------- +000000-01FFFF: 128KB ROM +200000-3FFFFF: hashtable SRAM (less on V10?) +B0000x-xxxxxx: see V7, -800000 + ******************************************************************************/ #include "emu.h" @@ -211,8 +258,21 @@ static ADDRESS_MAP_START( eagv7_map, AS_PROGRAM, 32, fidel68k_state ) AM_RANGE(0x400000, 0x400003) AM_WRITE8(eag_mux_w, 0x00ff0000) AM_RANGE(0x400004, 0x400007) AM_WRITENOP // ? AM_RANGE(0x604000, 0x607fff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x800000, 0x807fff) AM_RAM AM_RANGE(0x700000, 0x700003) AM_READ8(eag_input2_r, 0x000000ff) + AM_RANGE(0x800000, 0x807fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( eagv11_map, AS_PROGRAM, 32, fidel68k_state ) + AM_RANGE(0x00000000, 0x0001ffff) AM_ROM + AM_RANGE(0x00200000, 0x003fffff) AM_RAM + AM_RANGE(0x00b00000, 0x00b0000f) AM_MIRROR(0x00000010) AM_READWRITE8(eag_input1_r, eag_leds_w, 0x00ff00ff) + AM_RANGE(0x00b00000, 0x00b0000f) AM_MIRROR(0x00000010) AM_WRITE8(eag_7seg_w, 0xff00ff00) AM_READNOP + AM_RANGE(0x00c00000, 0x00c07fff) AM_READ8(eag_cart_r, 0xff00ff00) + AM_RANGE(0x00c00000, 0x00c00003) AM_WRITE8(eag_mux_w, 0x00ff0000) + AM_RANGE(0x00c00004, 0x00c00007) AM_WRITENOP // ? + AM_RANGE(0x00e04000, 0x00e07fff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0x00f00000, 0x00f00003) AM_READ8(eag_input2_r, 0x000000ff) + AM_RANGE(0x01000000, 0x0101ffff) AM_RAM ADDRESS_MAP_END @@ -354,6 +414,22 @@ static MACHINE_CONFIG_DERIVED( eagv7, eag ) MCFG_CPU_PERIODIC_INT_DRIVER(fidel68k_state, irq2_line_hold, 600) // complete guess MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( eagv10, eag ) + + /* basic machine hardware */ + MCFG_CPU_REPLACE("maincpu", M68040, XTAL_25MHz) + MCFG_CPU_PROGRAM_MAP(eagv11_map) + MCFG_CPU_PERIODIC_INT_DRIVER(fidel68k_state, irq2_line_hold, 600) // complete guess +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( eagv11, eag ) + + /* basic machine hardware */ + MCFG_CPU_REPLACE("maincpu", M68EC040, XTAL_36MHz*2) // wrong! should be M68EC060 + MCFG_CPU_PROGRAM_MAP(eagv11_map) + MCFG_CPU_PERIODIC_INT_DRIVER(fidel68k_state, irq2_line_hold, 600) // complete guess +MACHINE_CONFIG_END + /****************************************************************************** @@ -363,7 +439,7 @@ MACHINE_CONFIG_END ROM_START( feagv2 ) ROM_REGION16_BE( 0x20000, "maincpu", 0 ) ROM_LOAD16_BYTE("6114_e5.u18", 0x00000, 0x10000, CRC(f9c7bada) SHA1(60e545f829121b9a4f1100d9e85ac83797715e80) ) // 27c512 - ROM_LOAD16_BYTE("6114_o5.u19", 0x00001, 0x10000, CRC(04f97b22) SHA1(8b2845dd115498f7b385e8948eca6a5893c223d1) ) // 27c512 + ROM_LOAD16_BYTE("6114_o5.u19", 0x00001, 0x10000, CRC(04f97b22) SHA1(8b2845dd115498f7b385e8948eca6a5893c223d1) ) // " ROM_END @@ -374,11 +450,24 @@ ROM_START( feagv7 ) ROM_END +ROM_START( feagv11 ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD32_BYTE("16", 0x00000, 0x08000, CRC(8375d61f) SHA1(e042f6f01480c59ee09a458cf34f135664479824) ) // 27c256 + ROM_LOAD32_BYTE("18", 0x00002, 0x08000, CRC(9341dcaf) SHA1(686bd4799e89ffaf11a813d4cf5a2aedd4c2d97a) ) // " + ROM_LOAD32_BYTE("19", 0x00003, 0x08000, CRC(a70c5468) SHA1(7f6b4f46577d5cfdaa84d387c7ce35d941e5bbc7) ) // " + ROM_LOAD32_BYTE("17", 0x00001, 0x08000, CRC(bfd14916) SHA1(115af6dfd29ddd8ad6d2ce390f8ecc4d60de6fce) ) // " +ROM_END + +#define rom_feagv10 rom_feagv11 + + /****************************************************************************** Drivers ******************************************************************************/ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1989, feagv2, 0, 0, eag, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde (model 6114-2/3/4)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -COMP( 1990, feagv7, 0, 0, eagv7, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde (model 6117-7)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +COMP( 1989, feagv2, 0, 0, eag, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde (model 6114-2/3/4)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1990, feagv7, 0, 0, eagv7, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde (model 6117-7)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 1990, feagv10, 0, 0, eagv10, eag, driver_device, 0, "Fidelity Electronics", "Elite Avant Garde (model 6117-10)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +COMP( 2002, feagv11, feagv10, 0, eagv11, eag, driver_device, 0, "hack (Wilfried Bucke)", "Elite Avant Garde (model 6117-11)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index dac42ee4d65..cafc46a7cbc 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -468,7 +468,6 @@ protected: void tispeak_state::machine_start() { hh_tms1k_state::machine_start(); - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // ! init_cartridge(); } @@ -541,8 +540,9 @@ DRIVER_INIT_MEMBER(tispeak_state, lantutor) void tispeak_state::prepare_display() { - UINT16 gridmask = (m_display_decay[15][16] != 0) ? 0xffff : 0x8000; - display_matrix_seg(16+1, 16, m_plate | 0x10000, m_grid & gridmask, 0x3fff); + UINT16 gridmask = (m_display_decay[15][16] != 0) ? 0xffff : 0x8000; // vfd filament on/off + set_display_segmask(0x21ff, 0x3fff); + display_matrix(16+1, 16, m_plate | 1<<16, m_grid & gridmask); } WRITE16_MEMBER(tispeak_state::snspell_write_r) diff --git a/src/mame/drivers/tispellb.cpp b/src/mame/drivers/tispellb.cpp index 0afe81d0a49..fcb7b072260 100644 --- a/src/mame/drivers/tispellb.cpp +++ b/src/mame/drivers/tispellb.cpp @@ -26,6 +26,7 @@ - TMC0355 4KB VSM ROM CD2602* - 8-digit cyan VFD display - 1-bit sound (indicated by a music note symbol on the top-right of the casing) + - note: much rarer than the 1978 version, not much luck finding one on eBay Spelling ABC (UK), 1979: exact same hardware as US version @@ -104,7 +105,6 @@ protected: void tispellb_state::machine_start() { hh_tms1k_state::machine_start(); - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // ! // zerofill m_rev1_ctl = 0; @@ -138,9 +138,10 @@ void tispellb_state::power_off() void tispellb_state::prepare_display() { - // same as snspell - UINT16 gridmask = (m_display_decay[15][16] != 0) ? 0xffff : 0x8000; - display_matrix_seg(16+1, 16, m_plate | 0x10000, m_grid & gridmask, 0x3fff); + // almost same as snspell + UINT16 gridmask = (m_display_decay[15][16] != 0) ? 0xffff : 0x8000; // vfd filament on/off + set_display_segmask(0xff, 0x3fff); + display_matrix(16+1, 16, m_plate | 1<<16, m_grid & gridmask); } WRITE16_MEMBER(tispellb_state::main_write_o) diff --git a/src/mame/mess.lst b/src/mame/mess.lst index f35480c30b8..540da1ca455 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -2169,6 +2169,8 @@ fexcelv feagv2 feagv7 +feagv10 +feagv11 // Hegener & Glaser Munich //mephisto // Mephisto 1 - roms needed - not in driver -- cgit v1.2.3-70-g09d2 From fbe6e5440067c5a350521d903a7f5e08d0dace33 Mon Sep 17 00:00:00 2001 From: "therealmogminer@gmail.com" Date: Wed, 17 Feb 2016 01:35:22 +0100 Subject: Fix remaining issues with bgfx renderer --- src/emu/render.cpp | 9 - src/emu/render.h | 2 +- src/osd/modules/render/drawbgfx.cpp | 477 ++++++++++++++++++++---------------- src/osd/modules/render/drawbgfx.h | 41 ++-- src/osd/windows/winmain.h | 2 - 5 files changed, 287 insertions(+), 244 deletions(-) diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 8cb58de116f..3de791eab52 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -444,8 +444,6 @@ void render_texture::hq_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, UINT32 flags) { - texinfo.hash = 0; - // source width/height come from the source bounds int swidth = m_sbounds.width(); int sheight = m_sbounds.height(); @@ -522,13 +520,6 @@ void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &t // palette will be set later texinfo.seqid = scaled->seqid; } - - UINT32 hash = 0; - if ((flags & PRIMFLAG_PACKABLE) && texinfo.width <= 128 && texinfo.height <= 128) - { - hash = reinterpret_cast(texinfo.base) & 0xffffffff; - } - texinfo.hash = hash; } diff --git a/src/emu/render.h b/src/emu/render.h index 1761deb2f20..6d55c75ada9 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -211,7 +211,6 @@ struct render_texinfo UINT32 height; // height of the image UINT32 seqid; // sequence ID UINT64 osddata; // aux data to pass to osd - UINT32 hash; // hash (where applicable) const rgb_t * palette; // palette for PALETTE16 textures, bcg lookup table for RGB32/YUY16 }; @@ -329,6 +328,7 @@ public: // getters render_primitive *next() const { return m_next; } + bool packable(const INT32 pack_size) const { return (flags & PRIMFLAG_PACKABLE) && texture.base != nullptr && texture.width <= pack_size && texture.height <= pack_size; } // reset to prepare for re-use void reset(); diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index cca3485f18c..07b10c479ca 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -44,6 +44,8 @@ // MACROS //============================================================ +#define GIBBERISH (0) + //============================================================ // INLINES //============================================================ @@ -152,17 +154,23 @@ int renderer_bgfx::create() bgfx::touch(window().m_index); } - PosColorTexCoord0Vertex::init(); - PosColorVertex::init(); + ScreenVertex::init(); // Create program from shaders. m_progQuad = loadProgram("vs_quad", "fs_quad"); m_progQuadTexture = loadProgram("vs_quad_texture", "fs_quad_texture"); m_s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1); - uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_ANISOTROPIC | BGFX_TEXTURE_MAG_ANISOTROPIC; + uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; m_texture_cache = bgfx::createTexture2D(CACHE_SIZE, CACHE_SIZE, 1, bgfx::TextureFormat::BGRA8, flags); + const bgfx::Memory* memory = bgfx::alloc(sizeof(uint32_t) * CACHE_SIZE * CACHE_SIZE); + memset(memory->data, 0, sizeof(uint32_t) * CACHE_SIZE * CACHE_SIZE); + bgfx::updateTexture2D(m_texture_cache, 0, 0, 0, CACHE_SIZE, CACHE_SIZE, memory, CACHE_SIZE * sizeof(uint32_t)); + + memset(m_white, 0xff, sizeof(uint32_t) * 16 * 16); + m_texinfo.push_back(rectangle_packer::packable_rectangle(WHITE_HASH, PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32), 16, 16, 16, nullptr, m_white)); + return 0; } @@ -272,16 +280,20 @@ bgfx::ProgramHandle renderer_bgfx::loadProgram(const char* _vsName, const char* // drawbgfx_window_draw //============================================================ -bgfx::VertexDecl renderer_bgfx::PosColorTexCoord0Vertex::ms_decl; +bgfx::VertexDecl renderer_bgfx::ScreenVertex::ms_decl; -void renderer_bgfx::put_packed_quad(render_primitive *prim, UINT32 hash, PosColorTexCoord0Vertex* vertex) +void renderer_bgfx::put_packed_quad(render_primitive *prim, UINT32 hash, ScreenVertex* vertex) { rectangle_packer::packed_rectangle& rect = m_hash_to_entry[hash]; float u0 = float(rect.x()) / float(CACHE_SIZE); float v0 = float(rect.y()) / float(CACHE_SIZE); float u1 = u0 + float(rect.width()) / float(CACHE_SIZE); float v1 = v0 + float(rect.height()) / float(CACHE_SIZE); - UINT32 rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255); + u1 -= 0.5f / float(CACHE_SIZE); + v1 -= 0.5f / float(CACHE_SIZE); + u0 += 0.5f / float(CACHE_SIZE); + v0 += 0.5f / float(CACHE_SIZE); + UINT32 rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255); float x[4] = { prim->bounds.x0, prim->bounds.x1, prim->bounds.x0, prim->bounds.x1 }; float y[4] = { prim->bounds.y0, prim->bounds.y0, prim->bounds.y1, prim->bounds.y1 }; @@ -353,88 +365,85 @@ void renderer_bgfx::put_packed_quad(render_primitive *prim, UINT32 hash, PosColo vertex[5].m_v = v[0]; } -void renderer_bgfx::render_textured_quad(int view, render_primitive* prim) +void renderer_bgfx::render_textured_quad(int view, render_primitive* prim, bgfx::TransientVertexBuffer* buffer) { - if (bgfx::checkAvailTransientVertexBuffer(6, PosColorTexCoord0Vertex::ms_decl)) - { - bgfx::TransientVertexBuffer vb; - bgfx::allocTransientVertexBuffer(&vb, 6, PosColorTexCoord0Vertex::ms_decl); - PosColorTexCoord0Vertex* vertex = (PosColorTexCoord0Vertex*)vb.data; - - UINT32 rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255); - - vertex[0].m_x = prim->bounds.x0; - vertex[0].m_y = prim->bounds.y0; - vertex[0].m_z = 0; - vertex[0].m_rgba = rgba; - vertex[0].m_u = prim->texcoords.tl.u; - vertex[0].m_v = prim->texcoords.tl.v; - - vertex[1].m_x = prim->bounds.x1; - vertex[1].m_y = prim->bounds.y0; - vertex[1].m_z = 0; - vertex[1].m_rgba = rgba; - vertex[1].m_u = prim->texcoords.tr.u; - vertex[1].m_v = prim->texcoords.tr.v; - - vertex[2].m_x = prim->bounds.x1; - vertex[2].m_y = prim->bounds.y1; - vertex[2].m_z = 0; - vertex[2].m_rgba = rgba; - vertex[2].m_u = prim->texcoords.br.u; - vertex[2].m_v = prim->texcoords.br.v; - - vertex[3].m_x = prim->bounds.x1; - vertex[3].m_y = prim->bounds.y1; - vertex[3].m_z = 0; - vertex[3].m_rgba = rgba; - vertex[3].m_u = prim->texcoords.br.u; - vertex[3].m_v = prim->texcoords.br.v; - - vertex[4].m_x = prim->bounds.x0; - vertex[4].m_y = prim->bounds.y1; - vertex[4].m_z = 0; - vertex[4].m_rgba = rgba; - vertex[4].m_u = prim->texcoords.bl.u; - vertex[4].m_v = prim->texcoords.bl.v; - - vertex[5].m_x = prim->bounds.x0; - vertex[5].m_y = prim->bounds.y0; - vertex[5].m_z = 0; - vertex[5].m_rgba = rgba; - vertex[5].m_u = prim->texcoords.tl.u; - vertex[5].m_v = prim->texcoords.tl.v; - bgfx::setVertexBuffer(&vb); - - uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP; - if (video_config.filter == 0) - { - texture_flags |= BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; - } + ScreenVertex* vertex = (ScreenVertex*)buffer->data; - const bgfx::Memory* mem = mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK, - prim->texture.width, prim->texture.height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base); + UINT32 rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255); - bgfx::TextureHandle texture = bgfx::createTexture2D((uint16_t)prim->texture.width, (uint16_t)prim->texture.height, 1, bgfx::TextureFormat::BGRA8, texture_flags, mem); + vertex[0].m_x = prim->bounds.x0; + vertex[0].m_y = prim->bounds.y0; + vertex[0].m_z = 0; + vertex[0].m_rgba = rgba; + vertex[0].m_u = prim->texcoords.tl.u; + vertex[0].m_v = prim->texcoords.tl.v; + + vertex[1].m_x = prim->bounds.x1; + vertex[1].m_y = prim->bounds.y0; + vertex[1].m_z = 0; + vertex[1].m_rgba = rgba; + vertex[1].m_u = prim->texcoords.tr.u; + vertex[1].m_v = prim->texcoords.tr.v; + + vertex[2].m_x = prim->bounds.x1; + vertex[2].m_y = prim->bounds.y1; + vertex[2].m_z = 0; + vertex[2].m_rgba = rgba; + vertex[2].m_u = prim->texcoords.br.u; + vertex[2].m_v = prim->texcoords.br.v; + + vertex[3].m_x = prim->bounds.x1; + vertex[3].m_y = prim->bounds.y1; + vertex[3].m_z = 0; + vertex[3].m_rgba = rgba; + vertex[3].m_u = prim->texcoords.br.u; + vertex[3].m_v = prim->texcoords.br.v; - bgfx::setTexture(0, m_s_texColor, texture); + vertex[4].m_x = prim->bounds.x0; + vertex[4].m_y = prim->bounds.y1; + vertex[4].m_z = 0; + vertex[4].m_rgba = rgba; + vertex[4].m_u = prim->texcoords.bl.u; + vertex[4].m_v = prim->texcoords.bl.v; - set_bgfx_state(PRIMFLAG_GET_BLENDMODE(prim->flags)); - bgfx::submit(view, m_progQuadTexture); + vertex[5].m_x = prim->bounds.x0; + vertex[5].m_y = prim->bounds.y0; + vertex[5].m_z = 0; + vertex[5].m_rgba = rgba; + vertex[5].m_u = prim->texcoords.tl.u; + vertex[5].m_v = prim->texcoords.tl.v; + bgfx::setVertexBuffer(buffer); - bgfx::destroyTexture(texture); + uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP; + if (video_config.filter == 0) + { + texture_flags |= BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; } -} -bgfx::VertexDecl renderer_bgfx::PosColorVertex::ms_decl; + const bgfx::Memory* mem = mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK, + prim->texture.width, prim->texture.height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base); + + bgfx::TextureHandle texture = bgfx::createTexture2D((uint16_t)prim->texture.width, (uint16_t)prim->texture.height, 1, bgfx::TextureFormat::BGRA8, texture_flags, mem); + + bgfx::setTexture(0, m_s_texColor, texture); + + set_bgfx_state(PRIMFLAG_GET_BLENDMODE(prim->flags)); + bgfx::submit(view, m_progQuadTexture); + + bgfx::destroyTexture(texture); +} #define MAX_TEMP_COORDS 100 -void renderer_bgfx::put_polygon(const float* coords, UINT32 num_coords, float r, UINT32 rgba, PosColorVertex* vertex) +void renderer_bgfx::put_polygon(const float* coords, UINT32 num_coords, float r, UINT32 rgba, ScreenVertex* vertex) { float tempCoords[MAX_TEMP_COORDS * 3]; float tempNormals[MAX_TEMP_COORDS * 2]; + rectangle_packer::packed_rectangle& rect = m_hash_to_entry[WHITE_HASH]; + float u0 = float(rect.x()) / float(CACHE_SIZE); + float v0 = float(rect.y()) / float(CACHE_SIZE); + num_coords = num_coords < MAX_TEMP_COORDS ? num_coords : MAX_TEMP_COORDS; for (uint32_t ii = 0, jj = num_coords - 1; ii < num_coords; jj = ii++) @@ -489,36 +498,48 @@ void renderer_bgfx::put_polygon(const float* coords, UINT32 num_coords, float r, vertex[vertIndex].m_y = coords[ii * 3 + 1]; vertex[vertIndex].m_z = coords[ii * 3 + 2]; vertex[vertIndex].m_rgba = rgba; + vertex[vertIndex].m_u = u0; + vertex[vertIndex].m_v = v0; vertIndex++; vertex[vertIndex].m_x = coords[jj * 3 + 0]; vertex[vertIndex].m_y = coords[jj * 3 + 1]; vertex[vertIndex].m_z = coords[jj * 3 + 2]; vertex[vertIndex].m_rgba = rgba; + vertex[vertIndex].m_u = u0; + vertex[vertIndex].m_v = v0; vertIndex++; vertex[vertIndex].m_x = tempCoords[jj * 3 + 0]; vertex[vertIndex].m_y = tempCoords[jj * 3 + 1]; vertex[vertIndex].m_z = tempCoords[jj * 3 + 2]; vertex[vertIndex].m_rgba = trans; + vertex[vertIndex].m_u = u0; + vertex[vertIndex].m_v = v0; vertIndex++; vertex[vertIndex].m_x = tempCoords[jj * 3 + 0]; vertex[vertIndex].m_y = tempCoords[jj * 3 + 1]; vertex[vertIndex].m_z = tempCoords[jj * 3 + 2]; vertex[vertIndex].m_rgba = trans; + vertex[vertIndex].m_u = u0; + vertex[vertIndex].m_v = v0; vertIndex++; vertex[vertIndex].m_x = tempCoords[ii * 3 + 0]; vertex[vertIndex].m_y = tempCoords[ii * 3 + 1]; vertex[vertIndex].m_z = tempCoords[ii * 3 + 2]; vertex[vertIndex].m_rgba = trans; + vertex[vertIndex].m_u = u0; + vertex[vertIndex].m_v = v0; vertIndex++; vertex[vertIndex].m_x = coords[ii * 3 + 0]; vertex[vertIndex].m_y = coords[ii * 3 + 1]; vertex[vertIndex].m_z = coords[ii * 3 + 2]; vertex[vertIndex].m_rgba = rgba; + vertex[vertIndex].m_u = u0; + vertex[vertIndex].m_v = v0; vertIndex++; } @@ -528,23 +549,29 @@ void renderer_bgfx::put_polygon(const float* coords, UINT32 num_coords, float r, vertex[vertIndex].m_y = coords[1]; vertex[vertIndex].m_z = coords[2]; vertex[vertIndex].m_rgba = rgba; + vertex[vertIndex].m_u = u0; + vertex[vertIndex].m_v = v0; vertIndex++; vertex[vertIndex].m_x = coords[(ii - 1) * 3 + 0]; vertex[vertIndex].m_y = coords[(ii - 1) * 3 + 1]; vertex[vertIndex].m_z = coords[(ii - 1) * 3 + 2]; vertex[vertIndex].m_rgba = rgba; + vertex[vertIndex].m_u = u0; + vertex[vertIndex].m_v = v0; vertIndex++; vertex[vertIndex].m_x = coords[ii * 3 + 0]; vertex[vertIndex].m_y = coords[ii * 3 + 1]; vertex[vertIndex].m_z = coords[ii * 3 + 2]; vertex[vertIndex].m_rgba = rgba; + vertex[vertIndex].m_u = u0; + vertex[vertIndex].m_v = v0; vertIndex++; } } -void renderer_bgfx::put_line(float x0, float y0, float x1, float y1, float r, UINT32 rgba, PosColorVertex* vertex, float fth) +void renderer_bgfx::put_line(float x0, float y0, float x1, float y1, float r, UINT32 rgba, ScreenVertex* vertex, float fth) { float dx = x1 - x0; float dy = y1 - y0; @@ -851,82 +878,103 @@ int renderer_bgfx::draw(int update) window().m_primlist->acquire_lock(); - bgfx::TransientVertexBuffer flat_buffer[4]; - bgfx::TransientVertexBuffer textured_buffer[4]; - - allocate_buffers(flat_buffer, textured_buffer); - - int flat_vertices[4] = { 0, 0, 0, 0 }; - int textured_vertices[4] = { 0, 0, 0, 0 }; - // Mark our texture atlas as dirty if we need to do so bool atlas_valid = update_atlas(); - memset(flat_vertices, 0, sizeof(int) * 4); - memset(textured_vertices, 0, sizeof(int) * 4); - - for (render_primitive *prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) + render_primitive *prim = window().m_primlist->first(); + while (prim != nullptr) { UINT32 blend = PRIMFLAG_GET_BLENDMODE(prim->flags); - switch (prim->type) + bgfx::TransientVertexBuffer buffer; + allocate_buffer(prim, blend, &buffer); + + buffer_status status = buffer_primitives(index, atlas_valid, &prim, &buffer); + + if (status != BUFFER_EMPTY) { - case render_primitive::LINE: - put_line(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1, 1.0f, u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), (PosColorVertex*)flat_buffer[blend].data + flat_vertices[blend], 1.0f); - flat_vertices[blend] += 30; - break; + set_bgfx_state(blend); + bgfx::setVertexBuffer(&buffer); + bgfx::setTexture(0, m_s_texColor, m_texture_cache); + bgfx::submit(index, m_progQuadTexture); + } - case render_primitive::QUAD: - if (prim->texture.base == nullptr) - { - render_flat_quad(index, prim); - } - else - { - if (atlas_valid && (prim->flags & PRIMFLAG_PACKABLE) && prim->texture.hash != 0 && m_hash_to_entry[prim->texture.hash].hash()) + if (status != BUFFER_DONE && status != BUFFER_PRE_FLUSH) + { + prim = prim->next(); + } + } + + window().m_primlist->release_lock(); + // Advance to next frame. Rendering thread will be kicked to + // process submitted rendering primitives. + if (index==0) bgfx::frame(); + + return 0; +} + +renderer_bgfx::buffer_status renderer_bgfx::buffer_primitives(int view, bool atlas_valid, render_primitive** prim, bgfx::TransientVertexBuffer* buffer) +{ + int vertices = 0; + + UINT32 blend = PRIMFLAG_GET_BLENDMODE((*prim)->flags); + while (*prim != nullptr) + { + switch ((*prim)->type) + { + case render_primitive::LINE: + put_line((*prim)->bounds.x0, (*prim)->bounds.y0, (*prim)->bounds.x1, (*prim)->bounds.y1, 1.0f, u32Color((*prim)->color.r * 255, (*prim)->color.g * 255, (*prim)->color.b * 255, (*prim)->color.a * 255), (ScreenVertex*)buffer->data + vertices, 1.0f); + vertices += 30; + break; + + case render_primitive::QUAD: + if ((*prim)->texture.base == nullptr) { - put_packed_quad(prim, prim->texture.hash, (PosColorTexCoord0Vertex*)textured_buffer[blend].data + textured_vertices[blend]); - textured_vertices[blend] += 6; + put_packed_quad(*prim, WHITE_HASH, (ScreenVertex*)buffer->data + vertices); + vertices += 6; } else { - render_textured_quad(index, prim); + const UINT32 hash = get_texture_hash(*prim); + if (atlas_valid && (*prim)->packable(PACKABLE_SIZE) && hash != 0 && m_hash_to_entry[hash].hash()) + { + put_packed_quad(*prim, hash, (ScreenVertex*)buffer->data + vertices); + vertices += 6; + } + else + { + if (vertices > 0) + { + return BUFFER_PRE_FLUSH; + } + render_textured_quad(view, *prim, buffer); + return BUFFER_EMPTY; + } } - } - break; + break; - default: - throw emu_fatalerror("Unexpected render_primitive type"); + default: + // Unhandled + break; } - } - for (UINT32 blend_mode = 0; blend_mode < BLENDMODE_COUNT; blend_mode++) - { - if (flat_vertices[blend_mode] > 0) + if ((*prim)->next() != nullptr && PRIMFLAG_GET_BLENDMODE((*prim)->next()->flags) != blend) { - set_bgfx_state(blend_mode); - bgfx::setVertexBuffer(&flat_buffer[blend_mode]); - bgfx::submit(index, m_progQuad); + break; } + + *prim = (*prim)->next(); } - for (UINT32 blend_mode = 0; blend_mode < BLENDMODE_COUNT; blend_mode++) + if (*prim == nullptr) { - if (textured_vertices[blend_mode] > 0) - { - set_bgfx_state(blend_mode); - bgfx::setVertexBuffer(&textured_buffer[blend_mode]); - bgfx::setTexture(0, m_s_texColor, m_texture_cache); - bgfx::submit(index, m_progQuadTexture); - } + return BUFFER_DONE; } - - window().m_primlist->release_lock(); - // Advance to next frame. Rendering thread will be kicked to - // process submitted rendering primitives. - if (index==0) bgfx::frame(); - - return 0; + if (vertices == 0) + { + return BUFFER_EMPTY; + } + return BUFFER_FLUSH; } void renderer_bgfx::set_bgfx_state(UINT32 blend) @@ -950,52 +998,6 @@ void renderer_bgfx::set_bgfx_state(UINT32 blend) } } -void renderer_bgfx::render_flat_quad(int view, render_primitive *prim) -{ - if (bgfx::checkAvailTransientVertexBuffer(6, PosColorVertex::ms_decl)) - { - bgfx::TransientVertexBuffer vb; - bgfx::allocTransientVertexBuffer(&vb, 6, PosColorVertex::ms_decl); - PosColorVertex* vertex = (PosColorVertex*)vb.data; - - UINT32 rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255); - - vertex[0].m_x = prim->bounds.x0; - vertex[0].m_y = prim->bounds.y0; - vertex[0].m_z = 0; - vertex[0].m_rgba = rgba; - - vertex[1].m_x = prim->bounds.x1; - vertex[1].m_y = prim->bounds.y0; - vertex[1].m_z = 0; - vertex[1].m_rgba = rgba; - - vertex[2].m_x = prim->bounds.x1; - vertex[2].m_y = prim->bounds.y1; - vertex[2].m_z = 0; - vertex[2].m_rgba = rgba; - - vertex[3].m_x = prim->bounds.x1; - vertex[3].m_y = prim->bounds.y1; - vertex[3].m_z = 0; - vertex[3].m_rgba = rgba; - - vertex[4].m_x = prim->bounds.x0; - vertex[4].m_y = prim->bounds.y1; - vertex[4].m_z = 0; - vertex[4].m_rgba = rgba; - - vertex[5].m_x = prim->bounds.x0; - vertex[5].m_y = prim->bounds.y0; - vertex[5].m_z = 0; - vertex[5].m_rgba = rgba; - bgfx::setVertexBuffer(&vb); - - set_bgfx_state(PRIMFLAG_GET_BLENDMODE(prim->flags)); - bgfx::submit(view, m_progQuad); - } -} - bool renderer_bgfx::update_atlas() { bool atlas_dirty = check_for_dirty_atlas(); @@ -1005,31 +1007,70 @@ bool renderer_bgfx::update_atlas() m_hash_to_entry.clear(); std::vector> packed; - if (m_packer.pack(m_texinfo, packed, 1024)) + if (m_packer.pack(m_texinfo, packed, CACHE_SIZE)) { - for (std::vector pack : packed) - { - for (rectangle_packer::packed_rectangle rect : pack) - { - if (rect.hash() == 0xffffffff) - { - continue; - } - m_hash_to_entry[rect.hash()] = rect; - const bgfx::Memory* mem = mame_texture_data_to_bgfx_texture_data(rect.format(), rect.width(), rect.height(), rect.rowpixels(), rect.palette(), rect.base()); - bgfx::updateTexture2D(m_texture_cache, 0, rect.x(), rect.y(), rect.width(), rect.height(), mem); - } - } + process_atlas_packs(packed); } else { + packed.clear(); + m_texinfo.clear(); + m_texinfo.push_back(rectangle_packer::packable_rectangle(WHITE_HASH, PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32), 16, 16, 16, nullptr, m_white)); + + m_packer.pack(m_texinfo, packed, CACHE_SIZE); + process_atlas_packs(packed); + return false; } } return true; } +void renderer_bgfx::process_atlas_packs(std::vector>& packed) +{ + for (std::vector pack : packed) + { + for (rectangle_packer::packed_rectangle rect : pack) + { + if (rect.hash() == 0xffffffff) + { + continue; + } + m_hash_to_entry[rect.hash()] = rect; + const bgfx::Memory* mem = mame_texture_data_to_bgfx_texture_data(rect.format(), rect.width(), rect.height(), rect.rowpixels(), rect.palette(), rect.base()); + bgfx::updateTexture2D(m_texture_cache, 0, rect.x(), rect.y(), rect.width(), rect.height(), mem); + } + } +} + +UINT32 renderer_bgfx::get_texture_hash(render_primitive *prim) +{ +#if GIBBERISH + UINT32 xor_value = 0x87; + UINT32 hash = 0xdabeefed; + + int bpp = 2; + UINT32 format = PRIMFLAG_GET_TEXFORMAT(prim->flags); + if (format == TEXFORMAT_ARGB32 || format == TEXFORMAT_RGB32) + { + bpp = 4; + } + + for (int y = 0; y < prim->texture.height; y++) + { + UINT8 *base = reinterpret_cast(prim->texture.base) + prim->texture.rowpixels * y; + for (int x = 0; x < prim->texture.width * bpp; x++) + { + hash += base[x] ^ xor_value; + } + } + return hash; +#else + return (reinterpret_cast(prim->texture.base)) & 0xffffffff; +#endif +} + bool renderer_bgfx::check_for_dirty_atlas() { bool atlas_dirty = false; @@ -1037,13 +1078,13 @@ bool renderer_bgfx::check_for_dirty_atlas() std::map acquired_infos; for (render_primitive *prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) { - bool pack = prim->flags & PRIMFLAG_PACKABLE; + bool pack = prim->packable(PACKABLE_SIZE); if (prim->type == render_primitive::QUAD && prim->texture.base != nullptr && pack) { - const UINT32 hash = prim->texture.hash; - + const UINT32 hash = get_texture_hash(prim); // If this texture is packable and not currently in the atlas, prepare the texture for putting in the atlas - if (hash != 0 && m_hash_to_entry[hash].hash() == 0 && acquired_infos[hash].hash() == 0) + if ((hash != 0 && m_hash_to_entry[hash].hash() == 0 && acquired_infos[hash].hash() == 0) + || (hash != 0 && m_hash_to_entry[hash].hash() != hash && acquired_infos[hash].hash() == 0)) { // Create create the texture and mark the atlas dirty atlas_dirty = true; @@ -1055,43 +1096,63 @@ bool renderer_bgfx::check_for_dirty_atlas() } } + if (m_texinfo.size() == 1) + { + atlas_dirty = true; + } + return atlas_dirty; } -void renderer_bgfx::allocate_buffers(bgfx::TransientVertexBuffer *flat_buffer, bgfx::TransientVertexBuffer *textured_buffer) +void renderer_bgfx::allocate_buffer(render_primitive *prim, UINT32 blend, bgfx::TransientVertexBuffer *buffer) { - int flat_vertices[4] = { 0, 0, 0, 0 }; - int textured_vertices[4] = { 0, 0, 0, 0 }; + int vertices = 0; - for (render_primitive *prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) + bool mode_switched = false; + while (prim != nullptr && !mode_switched) { switch (prim->type) { case render_primitive::LINE: - flat_vertices[PRIMFLAG_GET_BLENDMODE(prim->flags)] += 30; + vertices += 30; break; case render_primitive::QUAD: - if (prim->flags & PRIMFLAG_PACKABLE && prim->texture.base != nullptr && prim->texture.hash != 0) + if (!prim->packable(PACKABLE_SIZE)) + { + if (prim->texture.base == nullptr) + { + vertices += 6; + } + else + { + mode_switched = true; + if (vertices == 0) + { + vertices += 6; + } + } + } + else { - textured_vertices[PRIMFLAG_GET_BLENDMODE(prim->flags)] += 6; + vertices += 6; } break; default: // Do nothing break; } - } - for (int blend_mode = 0; blend_mode < 4; blend_mode++) - { - if (flat_vertices[blend_mode] > 0 && bgfx::checkAvailTransientVertexBuffer(flat_vertices[blend_mode], PosColorVertex::ms_decl)) - { - bgfx::allocTransientVertexBuffer(&flat_buffer[blend_mode], flat_vertices[blend_mode], PosColorVertex::ms_decl); - } - if (textured_vertices[blend_mode] > 0 && bgfx::checkAvailTransientVertexBuffer(textured_vertices[blend_mode], PosColorTexCoord0Vertex::ms_decl)) + prim = prim->next(); + + if (prim != nullptr && PRIMFLAG_GET_BLENDMODE(prim->flags) != blend) { - bgfx::allocTransientVertexBuffer(&textured_buffer[blend_mode], textured_vertices[blend_mode], PosColorTexCoord0Vertex::ms_decl); + mode_switched = true; } } + + if (vertices > 0 && bgfx::checkAvailTransientVertexBuffer(vertices, ScreenVertex::ms_decl)) + { + bgfx::allocTransientVertexBuffer(buffer, vertices, ScreenVertex::ms_decl); + } } diff --git a/src/osd/modules/render/drawbgfx.h b/src/osd/modules/render/drawbgfx.h index b0cab8c8193..29a91c3094c 100644 --- a/src/osd/modules/render/drawbgfx.h +++ b/src/osd/modules/render/drawbgfx.h @@ -36,7 +36,7 @@ public: } private: - struct PosColorTexCoord0Vertex + struct ScreenVertex { float m_x; float m_y; @@ -57,33 +57,21 @@ private: static bgfx::VertexDecl ms_decl; }; - struct PosColorVertex + void allocate_buffer(render_primitive *prim, UINT32 blend, bgfx::TransientVertexBuffer *buffer); + enum buffer_status { - float m_x; - float m_y; - float m_z; - UINT32 m_rgba; - - static void init() - { - ms_decl - .begin() - .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) - .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) - .end(); - } - - static bgfx::VertexDecl ms_decl; + BUFFER_PRE_FLUSH, + BUFFER_FLUSH, + BUFFER_EMPTY, + BUFFER_DONE }; + buffer_status buffer_primitives(int view, bool atlas_valid, render_primitive** prim, bgfx::TransientVertexBuffer* buffer); - void allocate_buffers(bgfx::TransientVertexBuffer *flat_buffer, bgfx::TransientVertexBuffer *textured_buffer); - - void render_textured_quad(int view, render_primitive* prim); - void render_flat_quad(int view, render_primitive *prim); + void render_textured_quad(int view, render_primitive* prim, bgfx::TransientVertexBuffer* buffer); - void put_packed_quad(render_primitive *prim, UINT32 hash, PosColorTexCoord0Vertex* vertex); - void put_polygon(const float* coords, UINT32 num_coords, float r, UINT32 rgba, PosColorVertex* vertex); - void put_line(float x0, float y0, float x1, float y1, float r, UINT32 rgba, PosColorVertex* vertex, float fth = 1.0f); + void put_packed_quad(render_primitive *prim, UINT32 hash, ScreenVertex* vertex); + void put_polygon(const float* coords, UINT32 num_coords, float r, UINT32 rgba, ScreenVertex* vertex); + void put_line(float x0, float y0, float x1, float y1, float r, UINT32 rgba, ScreenVertex* vertex, float fth = 1.0f); void set_bgfx_state(UINT32 blend); @@ -91,7 +79,9 @@ private: bool check_for_dirty_atlas(); bool update_atlas(); + void process_atlas_packs(std::vector>& packed); const bgfx::Memory* mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base); + UINT32 get_texture_hash(render_primitive *prim); bgfx::ProgramHandle loadProgram(bx::FileReaderI* _reader, const char* _vsName, const char* _fsName); bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName); @@ -109,7 +99,10 @@ private: std::vector m_texinfo; rectangle_packer m_packer; + uint32_t m_white[16*16]; static const uint16_t CACHE_SIZE = 1024; + static const uint32_t PACKABLE_SIZE = 128; + static const UINT32 WHITE_HASH = 0x87654321; }; #endif \ No newline at end of file diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index 7656ab4ee31..260919961f5 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -112,8 +112,6 @@ #define WINOPTION_GLOBAL_INPUTS "global_inputs" #define WINOPTION_DUAL_LIGHTGUN "dual_lightgun" - - //============================================================ // TYPE DEFINITIONS //============================================================ -- cgit v1.2.3-70-g09d2 From 5b41f43d5d113f22c146155d80f6d53a78137ce2 Mon Sep 17 00:00:00 2001 From: briantro Date: Tue, 16 Feb 2016 22:32:48 -0600 Subject: New Block Block clone New Clone Added ----------------------------------------------- Block Block (World 911219 Joystick) [caius, The Dumping Union] --- src/mame/arcade.lst | 5 +- src/mame/drivers/mitchell.cpp | 135 ++++++++++++++++++++++++------------------ 2 files changed, 79 insertions(+), 61 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index b4c9df0bb41..1bce3fb3186 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -4186,9 +4186,10 @@ marukin // 17/10/1990 (c) 1990 Yuga (Japan) qtono1 // 25/12/1990 (QUIZ 3) (c) 1991 Capcom (Japan) // 4/1991 Ashita Tenki ni Naare (golf) qsangoku // 07/06/1991 (QUIZ 4) (c) 1991 Capcom (Japan) -block // 10/09/1991 (c) 1991 Capcom (World) +block // 19/12/1991 (c) 1991 Capcom (World) (Joystick version) +blockr1 // 10/09/1991 (c) 1991 Capcom (World) blockj // 10/09/1991 (c) 1991 Capcom (Japan) -blockjoy // 06/11/1991 (c) 1991 Capcom (World) (Joystick version, bad dump?) +blockjoy // 06/11/1991 (c) 1991 Capcom (World) (Joystick version) blockbl // bootleg // Incredible Technologies games diff --git a/src/mame/drivers/mitchell.cpp b/src/mame/drivers/mitchell.cpp index df82f162383..ddd347ef86c 100644 --- a/src/mame/drivers/mitchell.cpp +++ b/src/mame/drivers/mitchell.cpp @@ -2045,24 +2045,46 @@ ROM_END ROM_START( block ) ROM_REGION( 0x50000, "maincpu", 0 ) - ROM_LOAD( "ble_05.rom", 0x00000, 0x08000, CRC(c12e7f4c) SHA1(335f4eab2323b942d5feeb3bab6f7286fabfffb4) ) - ROM_LOAD( "ble_06.rom", 0x10000, 0x20000, CRC(cdb13d55) SHA1(2e4489d12a603b4c7dfb90d246ebff9176e88a0b) ) - ROM_LOAD( "ble_07.rom", 0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) ) + ROM_LOAD( "ble_05b.14f", 0x00000, 0x08000, CRC(fcdb7885) SHA1(500ee4b8344181e9ad348bd22344a1a942fe9fdc) ) + ROM_LOAD( "ble_06b.15f", 0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) ) + ROM_LOAD( "ble_07b.16f", 0x30000, 0x20000, CRC(61bef077) SHA1(92792f26305df1e5e66607bed391b84b4964ba3e) ) ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF ) - ROM_LOAD( "bl_08.rom", 0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */ - ROM_LOAD( "bl_09.rom", 0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) ) + ROM_LOAD( "bl_08.8h", 0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */ + ROM_LOAD( "bl_09.9h", 0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) ) /* 40000-7ffff empty */ - ROM_LOAD( "bl_18.rom", 0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) ) - ROM_LOAD( "bl_19.rom", 0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) ) + ROM_LOAD( "bl_18.8j", 0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) ) + ROM_LOAD( "bl_19.9j", 0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) ) /* c0000-fffff empty */ ROM_REGION( 0x040000, "gfx2", 0 ) - ROM_LOAD( "bl_16.rom", 0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */ - ROM_LOAD( "bl_17.rom", 0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) ) + ROM_LOAD( "bl_16.2j", 0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */ + ROM_LOAD( "bl_17.3j", 0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) ) ROM_REGION( 0x80000, "oki", 0 ) /* OKIM */ - ROM_LOAD( "bl_01.rom", 0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) ) + ROM_LOAD( "bl_01.2d", 0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) ) +ROM_END + +ROM_START( blockr1 ) + ROM_REGION( 0x50000, "maincpu", 0 ) + ROM_LOAD( "ble_05.14f", 0x00000, 0x08000, CRC(c12e7f4c) SHA1(335f4eab2323b942d5feeb3bab6f7286fabfffb4) ) + ROM_LOAD( "ble_06.15f", 0x10000, 0x20000, CRC(cdb13d55) SHA1(2e4489d12a603b4c7dfb90d246ebff9176e88a0b) ) + ROM_LOAD( "ble_07.16f", 0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) ) + + ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF ) + ROM_LOAD( "bl_08.8h", 0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */ + ROM_LOAD( "bl_09.9h", 0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) ) + /* 40000-7ffff empty */ + ROM_LOAD( "bl_18.8j", 0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) ) + ROM_LOAD( "bl_19.9j", 0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) ) + /* c0000-fffff empty */ + + ROM_REGION( 0x040000, "gfx2", 0 ) + ROM_LOAD( "bl_16.2j", 0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */ + ROM_LOAD( "bl_17.3j", 0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) ) + + ROM_REGION( 0x80000, "oki", 0 ) /* OKIM */ + ROM_LOAD( "bl_01.2d", 0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) ) ROM_END ROM_START( blockj ) @@ -2072,48 +2094,42 @@ ROM_START( blockj ) ROM_LOAD( "blj_07.rom", 0x30000, 0x20000, CRC(1723883c) SHA1(e6b7575a55c045b90fb41290a60306713121acfb) ) ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF ) - ROM_LOAD( "bl_08.rom", 0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */ - ROM_LOAD( "bl_09.rom", 0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) ) + ROM_LOAD( "bl_08.8h", 0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */ + ROM_LOAD( "bl_09.9h", 0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) ) /* 40000-7ffff empty */ - ROM_LOAD( "bl_18.rom", 0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) ) - ROM_LOAD( "bl_19.rom", 0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) ) + ROM_LOAD( "bl_18.8j", 0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) ) + ROM_LOAD( "bl_19.9j", 0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) ) /* c0000-fffff empty */ ROM_REGION( 0x040000, "gfx2", 0 ) - ROM_LOAD( "bl_16.rom", 0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */ - ROM_LOAD( "bl_17.rom", 0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) ) + ROM_LOAD( "bl_16.2j", 0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */ + ROM_LOAD( "bl_17.3j", 0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) ) ROM_REGION( 0x80000, "oki", 0 ) /* OKIM */ - ROM_LOAD( "bl_01.rom", 0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) ) + ROM_LOAD( "bl_01.2d", 0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) ) ROM_END ROM_START( blockjoy ) ROM_REGION( 0x50000, "maincpu", 0 ) ROM_LOAD( "ble_05.bin", 0x00000, 0x08000, CRC(fa2a4536) SHA1(8f584745116bd0ced4d66719cd80c0372b797134) ) ROM_LOAD( "blf_06.bin", 0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) ) -// a ble_06a labeled rom has been dumped and verified identical to blf_06.bin. - -// this seems to be a bad version of the above rom, although the rom code is different it is 99% the same, and level 6 -// is impossible to finish due to a missing block. Probably bitrot -// ROM_LOAD( "ble_06.bin", 0x10000, 0x20000, BAD_DUMP CRC(58a77402) SHA1(cb24b1edd53a0965c3a9a34fe764b5c1f8dd9733) ) - ROM_LOAD( "ble_07.rom", 0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) ) /* the highscore table specifies an unused tile number, so we need ROMREGION_ERASEFF to ensure it is blank */ ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF ) - ROM_LOAD( "bl_08.rom", 0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */ - ROM_LOAD( "bl_09.rom", 0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) ) + ROM_LOAD( "bl_08.8h", 0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */ + ROM_LOAD( "bl_09.9h", 0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) ) /* 40000-7ffff empty */ - ROM_LOAD( "bl_18.rom", 0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) ) - ROM_LOAD( "bl_19.rom", 0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) ) + ROM_LOAD( "bl_18.8j", 0x080000, 0x20000, CRC(c0acafaf) SHA1(7c44b2605da6a324d0c145202cb8bac7af7a9c68) ) + ROM_LOAD( "bl_19.9j", 0x0a0000, 0x20000, CRC(1ae942f5) SHA1(e9322790db0bf2a9e862b14e166ee3f36f9ea5ad) ) /* c0000-fffff empty */ ROM_REGION( 0x040000, "gfx2", 0 ) - ROM_LOAD( "bl_16.rom", 0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */ - ROM_LOAD( "bl_17.rom", 0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) ) + ROM_LOAD( "bl_16.2j", 0x000000, 0x20000, CRC(fadcaff7) SHA1(f4bd8e375fe6b1e6a07b4ec4e58f5807dbd738f8) ) /* sprites */ + ROM_LOAD( "bl_17.3j", 0x020000, 0x20000, CRC(5f8cab42) SHA1(3a4c682a7938479e0be80c0494c2c8fc7303b663) ) ROM_REGION( 0x80000, "oki", 0 ) /* OKIM */ - ROM_LOAD( "bl_01.rom", 0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) ) + ROM_LOAD( "bl_01.2d", 0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) ) ROM_END ROM_START( blockbl ) @@ -2325,32 +2341,33 @@ DRIVER_INIT_MEMBER(mitchell_state,mstworld) * *************************************/ -GAME( 1988, mgakuen, 0, mgakuen, mgakuen, mitchell_state, mgakuen, ROT0, "Yuga", "Mahjong Gakuen", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, 7toitsu, mgakuen, mgakuen, mgakuen, mitchell_state, mgakuen, ROT0, "Yuga", "Chi-Toitsu", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, mgakuen2, 0, marukin, marukin, mitchell_state, mgakuen2, ROT0, "Face", "Mahjong Gakuen 2 Gakuen-chou no Fukushuu", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pkladies, 0, marukin, pkladies, mitchell_state, pkladies, ROT0, "Mitchell", "Poker Ladies", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pkladiesl, pkladies, marukin, pkladies, mitchell_state, pkladies, ROT0, "Leprechaun", "Poker Ladies (Leprechaun ver. 510)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pkladiesla,pkladies, marukin, pkladies, mitchell_state, pkladies, ROT0, "Leprechaun", "Poker Ladies (Leprechaun ver. 401)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pkladiesbl,pkladies, pkladiesbl,pkladies, mitchell_state,pkladiesbl,ROT0, "bootleg", "Poker Ladies (Censored bootleg)", MACHINE_NOT_WORKING ) // by Playmark? need to figure out CPU 'decryption' / ordering -GAME( 1989, dokaben, 0, pang, pang, mitchell_state, dokaben, ROT0, "Capcom", "Dokaben (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pang, 0, pang, pang, mitchell_state, pang, ROT0, "Mitchell", "Pang (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, bbros, pang, pang, pang, mitchell_state, pang, ROT0, "Mitchell (Capcom license)", "Buster Bros. (USA)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pompingw, pang, pang, pang, mitchell_state, pang, ROT0, "Mitchell", "Pomping World (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pangb, pang, pang, pang, mitchell_state, pangb, ROT0, "bootleg", "Pang (bootleg, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pangbold, pang, pang, pang, mitchell_state, pangb, ROT0, "bootleg", "Pang (bootleg, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pangba, pang, spangbl, pang, mitchell_state, pangb, ROT0, "bootleg", "Pang (bootleg, set 3)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1989, pangb2, pang, pang, pang, mitchell_state, pangb, ROT0, "bootleg", "Pang (bootleg, set 4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, cworld, 0, pang, qtono1, mitchell_state, cworld, ROT0, "Capcom", "Capcom World (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, hatena, 0, pang, qtono1, mitchell_state, hatena, ROT0, "Capcom", "Adventure Quiz 2 - Hatena? no Daibouken (Japan 900228)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, spang, 0, pangnv, pang, mitchell_state, spang, ROT0, "Mitchell", "Super Pang (World 900914)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, sbbros, spang, pangnv, pang, mitchell_state, sbbros, ROT0, "Mitchell (Capcom license)", "Super Buster Bros. (USA 901001)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, spangj, spang, pangnv, pang, mitchell_state, spangj, ROT0, "Mitchell", "Super Pang (Japan 901023)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, spangbl, spang, spangbl, spangbl, mitchell_state, spangbl, ROT0, "bootleg", "Super Pang (World 900914, bootleg)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // different sound hardware -GAME( 1994, mstworld, 0, mstworld,mstworld, mitchell_state, mstworld, ROT0, "bootleg (TCH)", "Monsters World (bootleg of Super Pang)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1990, marukin, 0, marukin, marukin, mitchell_state, marukin, ROT0, "Yuga", "Super Marukin-Ban (Japan 901017)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, qtono1, 0, pang, qtono1, mitchell_state, qtono1, ROT0, "Capcom", "Quiz Tonosama no Yabou (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, qsangoku, 0, pang, qtono1, mitchell_state, qsangoku, ROT0, "Capcom", "Quiz Sangokushi (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, block, 0, pangnv, block, mitchell_state, block, ROT270, "Capcom", "Block Block (World 910910)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, blockj, block, pangnv, block, mitchell_state, block, ROT270, "Capcom", "Block Block (Japan 910910)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, blockjoy, block, pangnv, blockjoy, mitchell_state, block, ROT270, "Capcom", "Block Block (World 911106 Joystick)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, blockbl, block, pangnv, block, mitchell_state, blockbl, ROT270, "bootleg", "Block Block (bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, mgakuen, 0, mgakuen, mgakuen, mitchell_state, mgakuen, ROT0, "Yuga", "Mahjong Gakuen", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, 7toitsu, mgakuen, mgakuen, mgakuen, mitchell_state, mgakuen, ROT0, "Yuga", "Chi-Toitsu", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, mgakuen2, 0, marukin, marukin, mitchell_state, mgakuen2, ROT0, "Face", "Mahjong Gakuen 2 Gakuen-chou no Fukushuu", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pkladies, 0, marukin, pkladies, mitchell_state, pkladies, ROT0, "Mitchell", "Poker Ladies", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pkladiesl, pkladies, marukin, pkladies, mitchell_state, pkladies, ROT0, "Leprechaun", "Poker Ladies (Leprechaun ver. 510)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pkladiesla,pkladies, marukin, pkladies, mitchell_state, pkladies, ROT0, "Leprechaun", "Poker Ladies (Leprechaun ver. 401)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pkladiesbl,pkladies, pkladiesbl,pkladies, mitchell_state, pkladiesbl,ROT0, "bootleg", "Poker Ladies (Censored bootleg)", MACHINE_NOT_WORKING ) // by Playmark? need to figure out CPU 'decryption' / ordering +GAME( 1989, dokaben, 0, pang, pang, mitchell_state, dokaben, ROT0, "Capcom", "Dokaben (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pang, 0, pang, pang, mitchell_state, pang, ROT0, "Mitchell", "Pang (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, bbros, pang, pang, pang, mitchell_state, pang, ROT0, "Mitchell (Capcom license)", "Buster Bros. (USA)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pompingw, pang, pang, pang, mitchell_state, pang, ROT0, "Mitchell", "Pomping World (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pangb, pang, pang, pang, mitchell_state, pangb, ROT0, "bootleg", "Pang (bootleg, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pangbold, pang, pang, pang, mitchell_state, pangb, ROT0, "bootleg", "Pang (bootleg, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pangba, pang, spangbl, pang, mitchell_state, pangb, ROT0, "bootleg", "Pang (bootleg, set 3)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1989, pangb2, pang, pang, pang, mitchell_state, pangb, ROT0, "bootleg", "Pang (bootleg, set 4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, cworld, 0, pang, qtono1, mitchell_state, cworld, ROT0, "Capcom", "Capcom World (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, hatena, 0, pang, qtono1, mitchell_state, hatena, ROT0, "Capcom", "Adventure Quiz 2 - Hatena? no Daibouken (Japan 900228)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, spang, 0, pangnv, pang, mitchell_state, spang, ROT0, "Mitchell", "Super Pang (World 900914)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, sbbros, spang, pangnv, pang, mitchell_state, sbbros, ROT0, "Mitchell (Capcom license)", "Super Buster Bros. (USA 901001)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, spangj, spang, pangnv, pang, mitchell_state, spangj, ROT0, "Mitchell", "Super Pang (Japan 901023)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, spangbl, spang, spangbl, spangbl, mitchell_state, spangbl, ROT0, "bootleg", "Super Pang (World 900914, bootleg)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // different sound hardware +GAME( 1994, mstworld, 0, mstworld, mstworld, mitchell_state, mstworld, ROT0, "bootleg (TCH)", "Monsters World (bootleg of Super Pang)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1990, marukin, 0, marukin, marukin, mitchell_state, marukin, ROT0, "Yuga", "Super Marukin-Ban (Japan 901017)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, qtono1, 0, pang, qtono1, mitchell_state, qtono1, ROT0, "Capcom", "Quiz Tonosama no Yabou (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, qsangoku, 0, pang, qtono1, mitchell_state, qsangoku, ROT0, "Capcom", "Quiz Sangokushi (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, block, 0, pangnv, blockjoy, mitchell_state, block, ROT270, "Capcom", "Block Block (World 911219 Joystick)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, blockr1, block, pangnv, block, mitchell_state, block, ROT270, "Capcom", "Block Block (World 910910)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, blockj, block, pangnv, block, mitchell_state, block, ROT270, "Capcom", "Block Block (Japan 910910)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, blockjoy, block, pangnv, blockjoy, mitchell_state, block, ROT270, "Capcom", "Block Block (World 911106 Joystick)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, blockbl, block, pangnv, block, mitchell_state, blockbl, ROT270, "bootleg", "Block Block (bootleg)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From bfaebfb32c70cc8c6d7fac82d0765c9d4937984d Mon Sep 17 00:00:00 2001 From: briantro Date: Tue, 16 Feb 2016 22:44:32 -0600 Subject: mitchell.cpp: Update PBC locations for other Block Block sets - NW --- src/mame/drivers/mitchell.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/mitchell.cpp b/src/mame/drivers/mitchell.cpp index ddd347ef86c..b4e55a516a5 100644 --- a/src/mame/drivers/mitchell.cpp +++ b/src/mame/drivers/mitchell.cpp @@ -2089,9 +2089,9 @@ ROM_END ROM_START( blockj ) ROM_REGION( 0x50000, "maincpu", 0 ) - ROM_LOAD( "blj_05.rom", 0x00000, 0x08000, CRC(3b55969a) SHA1(86de2f1f5878de380a8b1e3935cffa146863f07f) ) - ROM_LOAD( "ble_06.rom", 0x10000, 0x20000, CRC(cdb13d55) SHA1(2e4489d12a603b4c7dfb90d246ebff9176e88a0b) ) - ROM_LOAD( "blj_07.rom", 0x30000, 0x20000, CRC(1723883c) SHA1(e6b7575a55c045b90fb41290a60306713121acfb) ) + ROM_LOAD( "blj_05.14f", 0x00000, 0x08000, CRC(3b55969a) SHA1(86de2f1f5878de380a8b1e3935cffa146863f07f) ) + ROM_LOAD( "ble_06.15f", 0x10000, 0x20000, CRC(cdb13d55) SHA1(2e4489d12a603b4c7dfb90d246ebff9176e88a0b) ) + ROM_LOAD( "blj_07.16f", 0x30000, 0x20000, CRC(1723883c) SHA1(e6b7575a55c045b90fb41290a60306713121acfb) ) ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF ) ROM_LOAD( "bl_08.8h", 0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */ @@ -2111,9 +2111,9 @@ ROM_END ROM_START( blockjoy ) ROM_REGION( 0x50000, "maincpu", 0 ) - ROM_LOAD( "ble_05.bin", 0x00000, 0x08000, CRC(fa2a4536) SHA1(8f584745116bd0ced4d66719cd80c0372b797134) ) - ROM_LOAD( "blf_06.bin", 0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) ) - ROM_LOAD( "ble_07.rom", 0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) ) + ROM_LOAD( "ble_05.14f", 0x00000, 0x08000, CRC(fa2a4536) SHA1(8f584745116bd0ced4d66719cd80c0372b797134) ) /* Are these actually rev "A"? */ + ROM_LOAD( "blf_06.15f", 0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) ) /* Are these actually rev "A"? - Also more likely it's "BLE" and not BLF */ + ROM_LOAD( "ble_07.16f", 0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) ) /* Are these actually rev "A"? */ /* the highscore table specifies an unused tile number, so we need ROMREGION_ERASEFF to ensure it is blank */ ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF ) -- cgit v1.2.3-70-g09d2 From 36eee4df3c691c5fd76921486440ac3075cdac12 Mon Sep 17 00:00:00 2001 From: briantro Date: Tue, 16 Feb 2016 22:53:00 -0600 Subject: mitchell.cpp: correct rom names as per deleted comment - NW This comment was in the info about the "bad dump": a ble_06a labeled rom has been dumped and verified identical to blf_06.bin --- src/mame/arcade.lst | 4 ++-- src/mame/drivers/mitchell.cpp | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 1bce3fb3186..655bc486caf 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -4187,9 +4187,9 @@ qtono1 // 25/12/1990 (QUIZ 3) (c) 1991 Capcom (Japan) // 4/1991 Ashita Tenki ni Naare (golf) qsangoku // 07/06/1991 (QUIZ 4) (c) 1991 Capcom (Japan) block // 19/12/1991 (c) 1991 Capcom (World) (Joystick version) -blockr1 // 10/09/1991 (c) 1991 Capcom (World) +blockr1 // 06/11/1991 (c) 1991 Capcom (World) (Joystick version) +blockr2 // 10/09/1991 (c) 1991 Capcom (World) blockj // 10/09/1991 (c) 1991 Capcom (Japan) -blockjoy // 06/11/1991 (c) 1991 Capcom (World) (Joystick version) blockbl // bootleg // Incredible Technologies games diff --git a/src/mame/drivers/mitchell.cpp b/src/mame/drivers/mitchell.cpp index b4e55a516a5..06c0528c6ae 100644 --- a/src/mame/drivers/mitchell.cpp +++ b/src/mame/drivers/mitchell.cpp @@ -2067,10 +2067,11 @@ ROM_END ROM_START( blockr1 ) ROM_REGION( 0x50000, "maincpu", 0 ) - ROM_LOAD( "ble_05.14f", 0x00000, 0x08000, CRC(c12e7f4c) SHA1(335f4eab2323b942d5feeb3bab6f7286fabfffb4) ) - ROM_LOAD( "ble_06.15f", 0x10000, 0x20000, CRC(cdb13d55) SHA1(2e4489d12a603b4c7dfb90d246ebff9176e88a0b) ) - ROM_LOAD( "ble_07.16f", 0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) ) + ROM_LOAD( "ble_05a.14f", 0x00000, 0x08000, CRC(fa2a4536) SHA1(8f584745116bd0ced4d66719cd80c0372b797134) ) + ROM_LOAD( "bla_06a.15f", 0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) ) + ROM_LOAD( "ble_07a.16f", 0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) ) + /* the highscore table specifies an unused tile number, so we need ROMREGION_ERASEFF to ensure it is blank */ ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF ) ROM_LOAD( "bl_08.8h", 0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */ ROM_LOAD( "bl_09.9h", 0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) ) @@ -2087,11 +2088,11 @@ ROM_START( blockr1 ) ROM_LOAD( "bl_01.2d", 0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) ) ROM_END -ROM_START( blockj ) +ROM_START( blockr2 ) ROM_REGION( 0x50000, "maincpu", 0 ) - ROM_LOAD( "blj_05.14f", 0x00000, 0x08000, CRC(3b55969a) SHA1(86de2f1f5878de380a8b1e3935cffa146863f07f) ) + ROM_LOAD( "ble_05.14f", 0x00000, 0x08000, CRC(c12e7f4c) SHA1(335f4eab2323b942d5feeb3bab6f7286fabfffb4) ) ROM_LOAD( "ble_06.15f", 0x10000, 0x20000, CRC(cdb13d55) SHA1(2e4489d12a603b4c7dfb90d246ebff9176e88a0b) ) - ROM_LOAD( "blj_07.16f", 0x30000, 0x20000, CRC(1723883c) SHA1(e6b7575a55c045b90fb41290a60306713121acfb) ) + ROM_LOAD( "ble_07.16f", 0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) ) ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF ) ROM_LOAD( "bl_08.8h", 0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */ @@ -2109,13 +2110,12 @@ ROM_START( blockj ) ROM_LOAD( "bl_01.2d", 0x00000, 0x20000, CRC(c2ec2abb) SHA1(89981f2a887ace4c4580e2828cbdc962f89c215e) ) ROM_END -ROM_START( blockjoy ) +ROM_START( blockj ) ROM_REGION( 0x50000, "maincpu", 0 ) - ROM_LOAD( "ble_05.14f", 0x00000, 0x08000, CRC(fa2a4536) SHA1(8f584745116bd0ced4d66719cd80c0372b797134) ) /* Are these actually rev "A"? */ - ROM_LOAD( "blf_06.15f", 0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) ) /* Are these actually rev "A"? - Also more likely it's "BLE" and not BLF */ - ROM_LOAD( "ble_07.16f", 0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) ) /* Are these actually rev "A"? */ + ROM_LOAD( "blj_05.14f", 0x00000, 0x08000, CRC(3b55969a) SHA1(86de2f1f5878de380a8b1e3935cffa146863f07f) ) + ROM_LOAD( "ble_06.15f", 0x10000, 0x20000, CRC(cdb13d55) SHA1(2e4489d12a603b4c7dfb90d246ebff9176e88a0b) ) + ROM_LOAD( "blj_07.16f", 0x30000, 0x20000, CRC(1723883c) SHA1(e6b7575a55c045b90fb41290a60306713121acfb) ) - /* the highscore table specifies an unused tile number, so we need ROMREGION_ERASEFF to ensure it is blank */ ROM_REGION( 0x100000, "gfx1", ROMREGION_ERASEFF ) ROM_LOAD( "bl_08.8h", 0x000000, 0x20000, CRC(aa0f4ff1) SHA1(58f3c468f89d834caaf66d3c084ab87addbb75c0) ) /* chars */ ROM_LOAD( "bl_09.9h", 0x020000, 0x20000, CRC(6fa8c186) SHA1(d4dd26d666f2accce871f70e7882e140d924dd07) ) @@ -2367,7 +2367,7 @@ GAME( 1990, marukin, 0, marukin, marukin, mitchell_state, marukin, GAME( 1991, qtono1, 0, pang, qtono1, mitchell_state, qtono1, ROT0, "Capcom", "Quiz Tonosama no Yabou (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1991, qsangoku, 0, pang, qtono1, mitchell_state, qsangoku, ROT0, "Capcom", "Quiz Sangokushi (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1991, block, 0, pangnv, blockjoy, mitchell_state, block, ROT270, "Capcom", "Block Block (World 911219 Joystick)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, blockr1, block, pangnv, block, mitchell_state, block, ROT270, "Capcom", "Block Block (World 910910)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, blockr1, block, pangnv, blockjoy, mitchell_state, block, ROT270, "Capcom", "Block Block (World 911106 Joystick)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, blockr2, block, pangnv, block, mitchell_state, block, ROT270, "Capcom", "Block Block (World 910910)", MACHINE_SUPPORTS_SAVE ) GAME( 1991, blockj, block, pangnv, block, mitchell_state, block, ROT270, "Capcom", "Block Block (Japan 910910)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, blockjoy, block, pangnv, blockjoy, mitchell_state, block, ROT270, "Capcom", "Block Block (World 911106 Joystick)", MACHINE_SUPPORTS_SAVE ) GAME( 1991, blockbl, block, pangnv, block, mitchell_state, blockbl, ROT270, "bootleg", "Block Block (bootleg)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3-70-g09d2 From c1aac01a96b09b6a3aaf750cbc8dd7a7820dea31 Mon Sep 17 00:00:00 2001 From: briantro Date: Tue, 16 Feb 2016 22:55:44 -0600 Subject: mitchell.cpp: GGRRRR... fix typo ... time to get some sleep - NW --- src/mame/drivers/mitchell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/mitchell.cpp b/src/mame/drivers/mitchell.cpp index 06c0528c6ae..ac6db9700eb 100644 --- a/src/mame/drivers/mitchell.cpp +++ b/src/mame/drivers/mitchell.cpp @@ -2068,7 +2068,7 @@ ROM_END ROM_START( blockr1 ) ROM_REGION( 0x50000, "maincpu", 0 ) ROM_LOAD( "ble_05a.14f", 0x00000, 0x08000, CRC(fa2a4536) SHA1(8f584745116bd0ced4d66719cd80c0372b797134) ) - ROM_LOAD( "bla_06a.15f", 0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) ) + ROM_LOAD( "ble_06a.15f", 0x10000, 0x20000, CRC(e114ebde) SHA1(12362e809443644b43fbc72e7eead5f376fe11d3) ) ROM_LOAD( "ble_07a.16f", 0x30000, 0x20000, CRC(1d114f13) SHA1(ee3588e1752b3432fd611e2d7d4fb43f942de580) ) /* the highscore table specifies an unused tile number, so we need ROMREGION_ERASEFF to ensure it is blank */ -- cgit v1.2.3-70-g09d2 From a661821aa5e922932496cc90a2db8a8e67fc06df Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 17 Feb 2016 09:57:26 +0100 Subject: Dropped ddraw renderer (nw) --- src/osd/modules/render/drawdd.cpp | 1317 ------------------------------------- src/osd/sdl/video.h | 3 - src/osd/windows/video.cpp | 5 - src/osd/windows/video.h | 4 - src/osd/windows/window.cpp | 6 - src/osd/windows/winmain.cpp | 1 - 6 files changed, 1336 deletions(-) delete mode 100644 src/osd/modules/render/drawdd.cpp diff --git a/src/osd/modules/render/drawdd.cpp b/src/osd/modules/render/drawdd.cpp deleted file mode 100644 index f15b70691c2..00000000000 --- a/src/osd/modules/render/drawdd.cpp +++ /dev/null @@ -1,1317 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -//============================================================ -// -// drawdd.c - Win32 DirectDraw implementation -// -//============================================================ - -// standard windows headers -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#undef interface - -// MAME headers -#include "emu.h" -#include "render.h" -#include "rendutil.h" -#include "rendersw.inc" - -// MAMEOS headers -#include "winmain.h" -#include "window.h" - - - -//============================================================ -// TYPE DEFINITIONS -//============================================================ - -typedef HRESULT (WINAPI *directdrawcreateex_ptr)(GUID FAR *lpGuid, LPVOID *lplpDD, REFIID iid, IUnknown FAR *pUnkOuter); -typedef HRESULT (WINAPI *directdrawenumerateex_ptr)(LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags); - - -/* dd_info is the information about DirectDraw for the current screen */ -class renderer_dd : public osd_renderer -{ -public: - renderer_dd(osd_window *window) - : osd_renderer(window, FLAG_NONE), - width(0), - height(0), - refresh(0), - //adapter(0), - adapter_ptr(NULL), - clearouter(0), - blitwidth(0), blitheight(0), - //lastdest - ddraw(NULL), - primary(NULL), - back(NULL), - blit(NULL), - clipper(NULL), - gamma(NULL), - //DDSURFACEDESC2 primarydesc; - //DDSURFACEDESC2 blitdesc; - //DDSURFACEDESC2 origmode; - //ddcaps(0), - //helcaps(0), - membuffer(NULL), - membuffersize(0) - { } - - virtual ~renderer_dd() { } - - virtual int create() override; - virtual render_primitive_list *get_primitives() override; - virtual int draw(const int update) override; - virtual void save() override {}; - virtual void record() override {}; - virtual void toggle_fsfx() override {}; - virtual void destroy() override; - - int width, height; // current width, height - int refresh; // current refresh rate - -private: - - inline void update_outer_rects(); - - // surface management - int ddraw_create(); - int ddraw_create_surfaces(); - void ddraw_delete(); - void ddraw_delete_surfaces(); - int ddraw_verify_caps(); - int ddraw_test_cooperative(); - HRESULT create_surface(DDSURFACEDESC2 *desc, IDirectDrawSurface7 **surface, const char *type); - int create_clipper(); - - // drawing helpers - void compute_blit_surface_size(); - void blit_to_primary(int srcwidth, int srcheight); - - // video modes - int config_adapter_mode(); - void get_adapter_for_monitor(osd_monitor_info *monitor); - void pick_best_mode(); - - // various - void calc_fullscreen_margins(DWORD desc_width, DWORD desc_height, RECT *margins); - - - GUID adapter; // current display adapter - GUID * adapter_ptr; // pointer to current display adapter - int clearouter; // clear the outer areas? - - INT32 blitwidth, blitheight; // current blit width/height values - RECT lastdest; // last destination rectangle - - IDirectDraw7 * ddraw; // pointer to the DirectDraw object - IDirectDrawSurface7 * primary; // pointer to the primary surface object - IDirectDrawSurface7 * back; // pointer to the back buffer surface object - IDirectDrawSurface7 * blit; // pointer to the blit surface object - IDirectDrawClipper * clipper; // pointer to the clipper object - IDirectDrawGammaControl *gamma; // pointer to the gamma control object - - DDSURFACEDESC2 primarydesc; // description of the primary surface - DDSURFACEDESC2 blitdesc; // description of the blitting surface - DDSURFACEDESC2 origmode; // original video mode - - DDCAPS ddcaps; // capabilities of the device - DDCAPS helcaps; // capabilities of the hardware - - UINT8 * membuffer; // memory buffer for complex rendering - UINT32 membuffersize; // current size of the memory buffer -}; - - -/* monitor_enum_info holds information during a monitor enumeration */ -struct monitor_enum_info -{ - osd_monitor_info * monitor; // pointer to monitor we want - GUID guid; // GUID of the one we found - GUID * guid_ptr; // pointer to our GUID - int foundit; // TRUE if we found what we wanted -}; - - -/* mode_enum_info holds information during a display mode enumeration */ -struct mode_enum_info -{ - renderer_dd * renderer; - osd_window * window; - INT32 minimum_width, minimum_height; - INT32 target_width, target_height; - double target_refresh; - float best_score; -}; - - - -//============================================================ -// GLOBALS -//============================================================ - -static HINSTANCE dllhandle; -static directdrawcreateex_ptr directdrawcreateex; -static directdrawenumerateex_ptr directdrawenumerateex; - - - -//============================================================ -// INLINES -//============================================================ - -inline void renderer_dd::update_outer_rects() -{ - clearouter = (back != NULL) ? 3 : 1; -} - - -static inline int better_mode(int width0, int height0, int width1, int height1, float desired_aspect) -{ - float aspect0 = (float)width0 / (float)height0; - float aspect1 = (float)width1 / (float)height1; - return (fabs(desired_aspect - aspect0) < fabs(desired_aspect - aspect1)) ? 0 : 1; -} - - - -//============================================================ -// PROTOTYPES -//============================================================ - -// core functions -static void drawdd_exit(void); - - - -//============================================================ -// drawnone_create -//============================================================ - -static osd_renderer *drawdd_create(osd_window *window) -{ - return global_alloc(renderer_dd(window)); -} - - -//============================================================ -// drawdd_init -//============================================================ - -int drawdd_init(running_machine &machine, osd_draw_callbacks *callbacks) -{ - // dynamically grab the create function from ddraw.dll - dllhandle = LoadLibrary(TEXT("ddraw.dll")); - if (dllhandle == NULL) - { - osd_printf_verbose("DirectDraw: Unable to access ddraw.dll\n"); - return 1; - } - - // import the create function - directdrawcreateex = (directdrawcreateex_ptr)GetProcAddress(dllhandle, "DirectDrawCreateEx"); - if (directdrawcreateex == NULL) - { - osd_printf_verbose("DirectDraw: Unable to find DirectDrawCreateEx\n"); - FreeLibrary(dllhandle); - dllhandle = NULL; - return 1; - } - - // import the enumerate function - directdrawenumerateex = (directdrawenumerateex_ptr)GetProcAddress(dllhandle, "DirectDrawEnumerateExA"); - if (directdrawenumerateex == NULL) - { - osd_printf_verbose("DirectDraw: Unable to find DirectDrawEnumerateExA\n"); - FreeLibrary(dllhandle); - dllhandle = NULL; - return 1; - } - - // fill in the callbacks - memset(callbacks, 0, sizeof(*callbacks)); - callbacks->exit = drawdd_exit; - callbacks->create = drawdd_create; - - osd_printf_verbose("DirectDraw: Using DirectDraw 7\n"); - return 0; -} - - - -//============================================================ -// drawdd_exit -//============================================================ - -static void drawdd_exit(void) -{ - if (dllhandle != NULL) - FreeLibrary(dllhandle); -} - - - -//============================================================ -// drawdd_window_init -//============================================================ - -int renderer_dd::create() -{ - // configure the adapter for the mode we want - if (config_adapter_mode()) - { - osd_printf_error("Unable to configure adapter.\n"); - goto error; - } - - // create the ddraw object - if (ddraw_create()) - { - osd_printf_error("Unable to create ddraw object.\n"); - goto error; - } - - return 0; - -error: - destroy(); - osd_printf_error("Unable to initialize DirectDraw.\n"); - return 1; -} - - - -//============================================================ -// drawdd_window_destroy -//============================================================ - -void renderer_dd::destroy() -{ - // delete the ddraw object - ddraw_delete(); -} - - - -//============================================================ -// drawdd_window_get_primitives -//============================================================ - -render_primitive_list *renderer_dd::get_primitives() -{ - compute_blit_surface_size(); - window().target()->set_bounds(blitwidth, blitheight, 0); - window().target()->set_max_update_rate((refresh == 0) ? origmode.dwRefreshRate : refresh); - - return &window().target()->get_primitives(); -} - - - -//============================================================ -// drawdd_window_draw -//============================================================ - -int renderer_dd::draw(const int update) -{ - render_primitive *prim; - int usemembuffer = FALSE; - HRESULT result; - - // if we're updating, remember to erase the outer stuff - if (update) - update_outer_rects(); - - // if we have a ddraw object, check the cooperative level - if (ddraw_test_cooperative()) - return 1; - - // get the size; if we're too small, delete the existing surfaces - if (blitwidth > blitdesc.dwWidth || blitheight > blitdesc.dwHeight) - ddraw_delete_surfaces(); - - // if we need to create surfaces, do it now - if (blit == NULL && ddraw_create_surfaces() != 0) - return 1; - - // select our surface and lock it - result = IDirectDrawSurface7_Lock(blit, NULL, &blitdesc, DDLOCK_WAIT, NULL); - if (result == DDERR_SURFACELOST) - { - osd_printf_verbose("DirectDraw: Lost surfaces; deleting and retrying next frame\n"); - ddraw_delete_surfaces(); - return 1; - } - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X locking blit surface\n", (int)result); - return 1; - } - - // render to it - window().m_primlist->acquire_lock(); - - // scan the list of primitives for tricky stuff - for (prim = window().m_primlist->first(); prim != NULL; prim = prim->next()) - if (PRIMFLAG_GET_BLENDMODE(prim->flags) != BLENDMODE_NONE || - (prim->texture.base != NULL && PRIMFLAG_GET_TEXFORMAT(prim->flags) == TEXFORMAT_ARGB32)) - { - usemembuffer = TRUE; - break; - } - - // if we're using the memory buffer, draw offscreen first and then copy - if (usemembuffer) - { - int x, y; - - // based on the target format, use one of our standard renderers - switch (blitdesc.ddpfPixelFormat.dwRBitMask) - { - case 0x00ff0000: software_renderer::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth); break; - case 0x000000ff: software_renderer::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth); break; - case 0xf800: software_renderer::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth); break; - case 0x7c00: software_renderer::draw_primitives(*window().m_primlist, membuffer, blitwidth, blitheight, blitwidth); break; - default: - osd_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)blitdesc.ddpfPixelFormat.dwRBitMask, (int)blitdesc.ddpfPixelFormat.dwGBitMask, (int)blitdesc.ddpfPixelFormat.dwBBitMask); - break; - } - - // handle copying to both 16bpp and 32bpp destinations - for (y = 0; y < blitheight; y++) - { - if (blitdesc.ddpfPixelFormat.dwRGBBitCount == 32) - { - UINT32 *src = (UINT32 *)membuffer + y * blitwidth; - UINT32 *dst = (UINT32 *)((UINT8 *)blitdesc.lpSurface + y * blitdesc.lPitch); - for (x = 0; x < blitwidth; x++) - *dst++ = *src++; - } - else if (blitdesc.ddpfPixelFormat.dwRGBBitCount == 16) - { - UINT16 *src = (UINT16 *)membuffer + y * blitwidth; - UINT16 *dst = (UINT16 *)((UINT8 *)blitdesc.lpSurface + y * blitdesc.lPitch); - for (x = 0; x < blitwidth; x++) - *dst++ = *src++; - } - } - - } - - // otherwise, draw directly - else - { - // based on the target format, use one of our standard renderers - switch (blitdesc.ddpfPixelFormat.dwRBitMask) - { - case 0x00ff0000: software_renderer::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 4); break; - case 0x000000ff: software_renderer::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 4); break; - case 0xf800: software_renderer::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 2); break; - case 0x7c00: software_renderer::draw_primitives(*window().m_primlist, blitdesc.lpSurface, blitwidth, blitheight, blitdesc.lPitch / 2); break; - default: - osd_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)blitdesc.ddpfPixelFormat.dwRBitMask, (int)blitdesc.ddpfPixelFormat.dwGBitMask, (int)blitdesc.ddpfPixelFormat.dwBBitMask); - break; - } - } - window().m_primlist->release_lock(); - - // unlock and blit - result = IDirectDrawSurface7_Unlock(blit, NULL); - if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X unlocking blit surface\n", (int)result); - - // sync to VBLANK - if ((video_config.waitvsync || video_config.syncrefresh) && window().machine().video().throttled() && (!window().fullscreen() || back == NULL)) - { - result = IDirectDraw7_WaitForVerticalBlank(ddraw, DDWAITVB_BLOCKBEGIN, NULL); - if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X waiting for VBLANK\n", (int)result); - } - - // complete the blitting - blit_to_primary(blitwidth, blitheight); - return 0; -} - - - -//============================================================ -// ddraw_create -//============================================================ - -int renderer_dd::ddraw_create() -{ - HRESULT result; - int verify; - - // if a device exists, free it - if (ddraw != NULL) - ddraw_delete(); - - // create the DirectDraw object - result = (*directdrawcreateex)(adapter_ptr, (LPVOID *)&ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X during DirectDrawCreateEx call\n", (int)result); - goto error; - } - - // verify the caps - verify = ddraw_verify_caps(); - if (verify == 2) - { - osd_printf_error("DirectDraw: Error - Device does not meet minimum requirements for DirectDraw rendering\n"); - goto error; - } - if (verify == 1) - osd_printf_verbose("DirectDraw: Warning - Device may not perform well for DirectDraw rendering\n"); - - // set the cooperative level - // for non-window modes, we will use full screen here - result = IDirectDraw7_SetCooperativeLevel(ddraw, win_window_list->m_hwnd, DDSCL_SETFOCUSWINDOW); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_SetCooperativeLevel(FOCUSWINDOW) call\n", (int)result); - goto error; - } - result = IDirectDraw7_SetCooperativeLevel(ddraw, window().m_hwnd, DDSCL_SETDEVICEWINDOW | (window().fullscreen() ? DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE : DDSCL_NORMAL)); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_SetCooperativeLevel(DEVICEWINDOW) call\n", (int)result); - goto error; - } - - // full screen mode: set the resolution - if (window().fullscreen() && video_config.switchres) - { - result = IDirectDraw7_SetDisplayMode(ddraw, width, height, 32, refresh, 0); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X attempting to set video mode %dx%d@%d call\n", (int)result, width, height, refresh); - goto error; - } - } - - return ddraw_create_surfaces(); - -error: - ddraw_delete(); - return 1; -} - - - -//============================================================ -// ddraw_create_surfaces -//============================================================ - -int renderer_dd::ddraw_create_surfaces() -{ - HRESULT result; - - // make a description of the primary surface - memset(&primarydesc, 0, sizeof(primarydesc)); - primarydesc.dwSize = sizeof(primarydesc); - primarydesc.dwFlags = DDSD_CAPS; - primarydesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - - // for triple-buffered full screen mode, allocate flipping surfaces - if (window().fullscreen() && video_config.triplebuf) - { - primarydesc.dwFlags |= DDSD_BACKBUFFERCOUNT; - primarydesc.ddsCaps.dwCaps |= DDSCAPS_FLIP | DDSCAPS_COMPLEX; - primarydesc.dwBackBufferCount = 2; - } - - // create the primary surface and report errors - result = create_surface(&primarydesc, &primary, "primary"); - if (result != DD_OK) goto error; - - // full screen mode: get the back surface - back = NULL; - if (window().fullscreen() && video_config.triplebuf) - { - DDSCAPS2 caps = { DDSCAPS_BACKBUFFER }; - result = IDirectDrawSurface7_GetAttachedSurface(primary, &caps, &back); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X getting attached back surface\n", (int)result); - goto error; - } - } - - // now make a description of our blit surface, based on the primary surface - if (blitwidth == 0 || blitheight == 0) - compute_blit_surface_size(); - blitdesc = primarydesc; - blitdesc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_CAPS; - blitdesc.dwWidth = blitwidth; - blitdesc.dwHeight = blitheight; - blitdesc.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY; - - // then create the blit surface, fall back to system memory if video mem doesn't work - result = create_surface(&blitdesc, &blit, "blit"); - if (result != DD_OK) - { - blitdesc.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; - result = create_surface(&blitdesc, &blit, "blit"); - } - if (result != DD_OK) goto error; - - // create a memory buffer for offscreen drawing - if (membuffersize < blitwidth * blitheight * 4) - { - membuffersize = blitwidth * blitheight * 4; - global_free_array(membuffer); - membuffer = global_alloc_array_nothrow(UINT8, membuffersize); - } - if (membuffer == NULL) - goto error; - - // create a clipper for windowed mode - if (!window().fullscreen() && create_clipper()) - goto error; - - // full screen mode: set the gamma - if (window().fullscreen()) - { - // only set the gamma if it's not 1.0f - windows_options &options = downcast(window().machine().options()); - float brightness = options.full_screen_brightness(); - float contrast = options.full_screen_contrast(); - float fgamma = options.full_screen_gamma(); - if (brightness != 1.0f || contrast != 1.0f || fgamma != 1.0f) - { - // see if we can get a GammaControl object - result = IDirectDrawSurface_QueryInterface(primary, WRAP_REFIID(IID_IDirectDrawGammaControl), (void **)&gamma); - if (result != DD_OK) - { - osd_printf_warning("DirectDraw: Warning - device does not support full screen gamma correction.\n"); - this->gamma = NULL; - } - - // proceed if we can - if (this->gamma != NULL) - { - DDGAMMARAMP ramp; - int i; - - // create a standard ramp and set it - for (i = 0; i < 256; i++) - ramp.red[i] = ramp.green[i] = ramp.blue[i] = apply_brightness_contrast_gamma(i, brightness, contrast, fgamma) << 8; - - // attempt to set it - result = IDirectDrawGammaControl_SetGammaRamp(this->gamma, 0, &ramp); - if (result != DD_OK) - osd_printf_verbose("DirectDraw: Error %08X attempting to set gamma correction.\n", (int)result); - } - } - } - - // force some updates - update_outer_rects(); - return 0; - -error: - ddraw_delete_surfaces(); - return 1; -} - - - -//============================================================ -// ddraw_delete -//============================================================ - -void renderer_dd::ddraw_delete() -{ - // free surfaces - ddraw_delete_surfaces(); - - // restore resolutions - if (ddraw != NULL) - IDirectDraw7_RestoreDisplayMode(ddraw); - - // reset cooperative level - if (ddraw != NULL && window().m_hwnd != NULL) - IDirectDraw7_SetCooperativeLevel(ddraw, window().m_hwnd, DDSCL_NORMAL); - - // release the DirectDraw object itself - if (ddraw != NULL) - IDirectDraw7_Release(ddraw); - ddraw = NULL; -} - - - -//============================================================ -// ddraw_delete_surfaces -//============================================================ - -void renderer_dd::ddraw_delete_surfaces() -{ - // release the gamma control - if (gamma != NULL) - IDirectDrawGammaControl_Release(gamma); - gamma = NULL; - - // release the clipper - if (clipper != NULL) - IDirectDrawClipper_Release(clipper); - clipper = NULL; - - // free the memory buffer - global_free_array(membuffer); - membuffer = NULL; - membuffersize = 0; - - // release the blit surface - if (blit != NULL) - IDirectDrawSurface7_Release(blit); - blit = NULL; - - // release the back surface - if (back != NULL) - IDirectDrawSurface7_Release(back); - back = NULL; - - // release the primary surface - if (primary != NULL) - IDirectDrawSurface7_Release(primary); - primary = NULL; -} - - - -//============================================================ -// ddraw_verify_caps -//============================================================ - -int renderer_dd::ddraw_verify_caps() -{ - int retval = 0; - HRESULT result; - - // get the capabilities - ddcaps.dwSize = sizeof(ddcaps); - helcaps.dwSize = sizeof(helcaps); - result = IDirectDraw7_GetCaps(ddraw, &ddcaps, &helcaps); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_GetCaps call\n", (int)result); - return 1; - } - - // determine if hardware stretching is available - if ((ddcaps.dwCaps & DDCAPS_BLTSTRETCH) == 0) - { - osd_printf_verbose("DirectDraw: Warning - Device does not support hardware stretching\n"); - retval = 1; - } - - return retval; -} - - - -//============================================================ -// ddraw_test_cooperative -//============================================================ - -int renderer_dd::ddraw_test_cooperative() -{ - HRESULT result; - - // check our current status; if we lost the device, punt to GDI - result = IDirectDraw7_TestCooperativeLevel(ddraw); - switch (result) - { - // punt to GDI if someone else has exclusive mode - case DDERR_NOEXCLUSIVEMODE: - case DDERR_EXCLUSIVEMODEALREADYSET: - ddraw_delete_surfaces(); - return 1; - - // if we're ok, but we don't have a primary surface, create one - default: - case DD_OK: - if (primary == NULL) - return ddraw_create_surfaces(); - return 0; - } -} - - - -//============================================================ -// create_surface -//============================================================ - -HRESULT renderer_dd::create_surface(DDSURFACEDESC2 *desc, IDirectDrawSurface7 **surface, const char *type) -{ - HRESULT result; - - // create the surface as requested - result = IDirectDraw7_CreateSurface(ddraw, desc, surface, NULL); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X creating %s surface\n", (int)result, type); - return result; - } - - // get a description of the primary surface - result = IDirectDrawSurface7_GetSurfaceDesc(*surface, desc); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X getting %s surface desciption\n", (int)result, type); - IDirectDrawSurface7_Release(*surface); - *surface = NULL; - return result; - } - - // print out the good stuff - osd_printf_verbose("DirectDraw: %s surface created: %dx%dx%d (R=%08X G=%08X B=%08X)\n", - type, - (int)desc->dwWidth, - (int)desc->dwHeight, - (int)desc->ddpfPixelFormat.dwRGBBitCount, - (UINT32)desc->ddpfPixelFormat.dwRBitMask, - (UINT32)desc->ddpfPixelFormat.dwGBitMask, - (UINT32)desc->ddpfPixelFormat.dwBBitMask); - return result; -} - - - -//============================================================ -// create_clipper -//============================================================ - -int renderer_dd::create_clipper() -{ - HRESULT result; - - // create a clipper for the primary surface - result = IDirectDraw7_CreateClipper(ddraw, 0, &clipper, NULL); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X creating clipper\n", (int)result); - return 1; - } - - // set the clipper's hwnd - result = IDirectDrawClipper_SetHWnd(clipper, 0, window().m_hwnd); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X setting clipper hwnd\n", (int)result); - return 1; - } - - // set the clipper on the primary surface - result = IDirectDrawSurface7_SetClipper(primary, clipper); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X setting clipper on primary surface\n", (int)result); - return 1; - } - return 0; -} - - - -//============================================================ -// compute_blit_surface_size -//============================================================ - -void renderer_dd::compute_blit_surface_size() -{ - INT32 newwidth, newheight; - int xscale, yscale; - RECT client; - - // start with the minimum size - window().target()->compute_minimum_size(newwidth, newheight); - - // get the window's client rectangle - GetClientRect(window().m_hwnd, &client); - - // hardware stretch case: apply prescale - if (video_config.hwstretch) - { - int prescale = (window().prescale() < 1) ? 1 : window().prescale(); - - // clamp the prescale to something smaller than the target bounds - xscale = prescale; - while (xscale > 1 && newwidth * xscale > rect_width(&client)) - xscale--; - yscale = prescale; - while (yscale > 1 && newheight * yscale > rect_height(&client)) - yscale--; - } - - // non stretch case - else - { - INT32 target_width = rect_width(&client); - INT32 target_height = rect_height(&client); - float desired_aspect = 1.0f; - - // compute the appropriate visible area if we're trying to keepaspect - if (video_config.keepaspect) - { - osd_monitor_info *monitor = window().winwindow_video_window_monitor(NULL); - window().target()->compute_visible_area(target_width, target_height, monitor->aspect(), window().target()->orientation(), target_width, target_height); - desired_aspect = (float)target_width / (float)target_height; - } - - // compute maximum integral scaling to fit the window - xscale = (target_width + 2) / newwidth; - yscale = (target_height + 2) / newheight; - - // try a little harder to keep the aspect ratio if desired - if (video_config.keepaspect) - { - // if we could stretch more in the X direction, and that makes a better fit, bump the xscale - while (newwidth * (xscale + 1) <= rect_width(&client) && - better_mode(newwidth * xscale, newheight * yscale, newwidth * (xscale + 1), newheight * yscale, desired_aspect)) - xscale++; - - // if we could stretch more in the Y direction, and that makes a better fit, bump the yscale - while (newheight * (yscale + 1) <= rect_height(&client) && - better_mode(newwidth * xscale, newheight * yscale, newwidth * xscale, newheight * (yscale + 1), desired_aspect)) - yscale++; - - // now that we've maxed out, see if backing off the maximally stretched one makes a better fit - if (rect_width(&client) - newwidth * xscale < rect_height(&client) - newheight * yscale) - { - while (xscale > 1 && better_mode(newwidth * xscale, newheight * yscale, newwidth * (xscale - 1), newheight * yscale, desired_aspect)) - xscale--; - } - else - { - while (yscale > 1 && better_mode(newwidth * xscale, newheight * yscale, newwidth * xscale, newheight * (yscale - 1), desired_aspect)) - yscale--; - } - } - } - - // ensure at least a scale factor of 1 - if (xscale == 0) xscale = 1; - if (yscale == 0) yscale = 1; - - // apply the final scale - newwidth *= xscale; - newheight *= yscale; - if (newwidth != blitwidth || newheight != blitheight) - { - // force some updates - update_outer_rects(); - osd_printf_verbose("DirectDraw: New blit size = %dx%d\n", newwidth, newheight); - } - blitwidth = newwidth; - blitheight = newheight; -} - - - -//============================================================ -// calc_fullscreen_margins -//============================================================ - -void renderer_dd::calc_fullscreen_margins(DWORD desc_width, DWORD desc_height, RECT *margins) -{ - margins->left = 0; - margins->top = 0; - margins->right = desc_width; - margins->bottom = desc_height; - - if (window().win_has_menu()) - { - static int height_with_menubar = 0; - if (height_with_menubar == 0) - { - RECT with_menu = { 100, 100, 200, 200 }; - RECT without_menu = { 100, 100, 200, 200 }; - AdjustWindowRect(&with_menu, WS_OVERLAPPED, TRUE); - AdjustWindowRect(&without_menu, WS_OVERLAPPED, FALSE); - height_with_menubar = (with_menu.bottom - with_menu.top) - (without_menu.bottom - without_menu.top); - } - margins->top = height_with_menubar; - } -} - - - -//============================================================ -// blit_to_primary -//============================================================ - -void renderer_dd::blit_to_primary(int srcwidth, int srcheight) -{ - IDirectDrawSurface7 *target = (back != NULL) ? back : primary; - osd_monitor_info *monitor = window().winwindow_video_window_monitor(NULL); - DDBLTFX blitfx = { sizeof(DDBLTFX) }; - RECT clear, outer, dest, source; - INT32 dstwidth, dstheight; - HRESULT result; - - // compute source rect - source.left = source.top = 0; - source.right = srcwidth; - source.bottom = srcheight; - - // compute outer rect -- windowed version - if (!window().fullscreen()) - { - GetClientRect(window().m_hwnd, &outer); - ClientToScreen(window().m_hwnd, &((LPPOINT)&outer)[0]); - ClientToScreen(window().m_hwnd, &((LPPOINT)&outer)[1]); - - // adjust to be relative to the monitor - osd_rect pos = monitor->position_size(); - outer.left -= pos.left(); - outer.right -= pos.left(); - outer.top -= pos.top(); - outer.bottom -= pos.top(); - } - - // compute outer rect -- full screen version - else - { - calc_fullscreen_margins(primarydesc.dwWidth, primarydesc.dwHeight, &outer); - } - - // if we're respecting the aspect ratio, we need to adjust to fit - dstwidth = rect_width(&outer); - dstheight = rect_height(&outer); - if (!video_config.hwstretch) - { - // trim the source if necessary - if (rect_width(&outer) < srcwidth) - { - source.left += (srcwidth - rect_width(&outer)) / 2; - source.right = source.left + rect_width(&outer); - } - if (rect_height(&outer) < srcheight) - { - source.top += (srcheight - rect_height(&outer)) / 2; - source.bottom = source.top + rect_height(&outer); - } - - // match the destination and source sizes - dstwidth = srcwidth = source.right - source.left; - dstheight = srcheight = source.bottom - source.top; - } - else if (video_config.keepaspect) - { - // compute the appropriate visible area - window().target()->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->aspect(), window().target()->orientation(), dstwidth, dstheight); - } - - // center within - dest.left = outer.left + (rect_width(&outer) - dstwidth) / 2; - dest.right = dest.left + dstwidth; - dest.top = outer.top + (rect_height(&outer) - dstheight) / 2; - dest.bottom = dest.top + dstheight; - - // compare against last destination; if different, force a redraw - if (dest.left != lastdest.left || dest.right != lastdest.right || dest.top != lastdest.top || dest.bottom != lastdest.bottom) - { - lastdest = dest; - update_outer_rects(); - } - - // clear outer rects if we need to - if (clearouter != 0) - { - clearouter--; - - // clear the left edge - if (dest.left > outer.left) - { - clear = outer; - clear.right = dest.left; - result = IDirectDrawSurface_Blt(target, &clear, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &blitfx); - if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X clearing the screen\n", (int)result); - } - - // clear the right edge - if (dest.right < outer.right) - { - clear = outer; - clear.left = dest.right; - result = IDirectDrawSurface_Blt(target, &clear, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &blitfx); - if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X clearing the screen\n", (int)result); - } - - // clear the top edge - if (dest.top > outer.top) - { - clear = outer; - clear.bottom = dest.top; - result = IDirectDrawSurface_Blt(target, &clear, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &blitfx); - if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X clearing the screen\n", (int)result); - } - - // clear the bottom edge - if (dest.bottom < outer.bottom) - { - clear = outer; - clear.top = dest.bottom; - result = IDirectDrawSurface_Blt(target, &clear, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &blitfx); - if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X clearing the screen\n", (int)result); - } - } - - // do the blit - result = IDirectDrawSurface7_Blt(target, &dest, blit, &source, DDBLT_WAIT, NULL); - if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X blitting to the screen\n", (int)result); - - // page flip if triple buffered - if (window().fullscreen() && back != NULL) - { - result = IDirectDrawSurface7_Flip(primary, NULL, DDFLIP_WAIT); - if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X waiting for VBLANK\n", (int)result); - } -} - - - -//============================================================ -// config_adapter_mode -//============================================================ - -int renderer_dd::config_adapter_mode() -{ - DDDEVICEIDENTIFIER2 identifier; - HRESULT result; - - // choose the monitor number - get_adapter_for_monitor(window().monitor()); - - // create a temporary DirectDraw object - result = (*directdrawcreateex)(adapter_ptr, (LPVOID *)&ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X during DirectDrawCreateEx call\n", (int)result); - return 1; - } - - // get the identifier - result = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0); - if (result != DD_OK) - { - osd_printf_error("Error getting identifier for device\n"); - return 1; - } - osd_printf_verbose("DirectDraw: Configuring device %s\n", identifier.szDescription); - - // get the current display mode - memset(&origmode, 0, sizeof(origmode)); - origmode.dwSize = sizeof(origmode); - result = IDirectDraw7_GetDisplayMode(ddraw, &origmode); - if (result != DD_OK) - { - osd_printf_verbose("DirectDraw: Error %08X getting current display mode\n", (int)result); - IDirectDraw7_Release(ddraw); - return 1; - } - - // choose a resolution: full screen mode case - if (window().fullscreen()) - { - // default to the current mode exactly - width = origmode.dwWidth; - height = origmode.dwHeight; - refresh = origmode.dwRefreshRate; - - // if we're allowed to switch resolutions, override with something better - if (video_config.switchres) - pick_best_mode(); - } - - // release the DirectDraw object - IDirectDraw7_Release(ddraw); - ddraw = NULL; - - // if we're not changing resolutions, make sure we have a resolution we can handle - if (!window().fullscreen() || !video_config.switchres) - { - switch (origmode.ddpfPixelFormat.dwRBitMask) - { - case 0x00ff0000: - case 0x000000ff: - case 0xf800: - case 0x7c00: - break; - - default: - osd_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)origmode.ddpfPixelFormat.dwRBitMask, (int)origmode.ddpfPixelFormat.dwGBitMask, (int)origmode.ddpfPixelFormat.dwBBitMask); - return 1; - } - } - - return 0; -} - - - -//============================================================ -// monitor_enum_callback -//============================================================ - -static BOOL WINAPI monitor_enum_callback(GUID FAR *guid, LPSTR description, LPSTR name, LPVOID context, HMONITOR hmonitor) -{ - monitor_enum_info *einfo = (monitor_enum_info *)context; - - // do we match the desired monitor? - if (hmonitor == *((HMONITOR *)einfo->monitor->oshandle()) || (hmonitor == NULL && einfo->monitor->is_primary())) - { - einfo->guid_ptr = (guid != NULL) ? &einfo->guid : NULL; - if (guid != NULL) - einfo->guid = *guid; - einfo->foundit = TRUE; - } - return 1; -} - - - -//============================================================ -// get_adapter_for_monitor -//============================================================ - -void renderer_dd::get_adapter_for_monitor(osd_monitor_info *monitor) -{ - monitor_enum_info einfo; - HRESULT result; - - // try to find our monitor - memset(&einfo, 0, sizeof(einfo)); - einfo.monitor = monitor; - result = (*directdrawenumerateex)(monitor_enum_callback, &einfo, DDENUM_ATTACHEDSECONDARYDEVICES); - if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X during DirectDrawEnumerateEx call\n", (int)result); - - // set up the adapter - if (einfo.foundit && einfo.guid_ptr != NULL) - { - adapter = einfo.guid; - adapter_ptr = &adapter; - } - else - adapter_ptr = NULL; -} - - - -//============================================================ -// enum_modes_callback -//============================================================ - -static HRESULT WINAPI enum_modes_callback(LPDDSURFACEDESC2 desc, LPVOID context) -{ - float size_score, refresh_score, final_score; - mode_enum_info *einfo = (mode_enum_info *)context; - renderer_dd *dd = einfo->renderer; - - // skip non-32 bit modes - if (desc->ddpfPixelFormat.dwRGBBitCount != 32) - return DDENUMRET_OK; - - // compute initial score based on difference between target and current - size_score = 1.0f / (1.0f + fabs((float)((INT32)desc->dwWidth - einfo->target_width)) + fabs((float)((INT32)desc->dwHeight - einfo->target_height))); - - // if the mode is too small, give a big penalty - if (desc->dwWidth < einfo->minimum_width || desc->dwHeight < einfo->minimum_height) - size_score *= 0.01f; - - // if mode is smaller than we'd like, it only scores up to 0.1 - if (desc->dwWidth < einfo->target_width || desc->dwHeight < einfo->target_height) - size_score *= 0.1f; - - // if we're looking for a particular mode, that's a winner - if (desc->dwWidth == einfo->window->m_win_config.width && desc->dwHeight == einfo->window->m_win_config.height) - size_score = 2.0f; - - // compute refresh score - refresh_score = 1.0f / (1.0f + fabs((double)desc->dwRefreshRate - einfo->target_refresh)); - - // if refresh is smaller than we'd like, it only scores up to 0.1 - if ((double)desc->dwRefreshRate < einfo->target_refresh) - refresh_score *= 0.1f; - - // if we're looking for a particular refresh, make sure it matches - if (desc->dwRefreshRate == einfo->window->m_win_config.refresh) - refresh_score = 2.0f; - - // weight size and refresh equally - final_score = size_score + refresh_score; - - // best so far? - osd_printf_verbose(" %4dx%4d@%3dHz -> %f\n", (int)desc->dwWidth, (int)desc->dwHeight, (int)desc->dwRefreshRate, final_score * 1000.0f); - if (final_score > einfo->best_score) - { - einfo->best_score = final_score; - dd->width = desc->dwWidth; - dd->height = desc->dwHeight; - dd->refresh = desc->dwRefreshRate; - } - return DDENUMRET_OK; -} - - - -//============================================================ -// pick_best_mode -//============================================================ - -void renderer_dd::pick_best_mode() -{ - mode_enum_info einfo; - HRESULT result; - - // determine the minimum width/height for the selected target - // note: technically we should not be calling this from an alternate window - // thread; however, it is only done during init time, and the init code on - // the main thread is waiting for us to finish, so it is safe to do so here - window().target()->compute_minimum_size(einfo.minimum_width, einfo.minimum_height); - - // use those as the target for now - einfo.target_width = einfo.minimum_width * MAX(1, window().prescale()); - einfo.target_height = einfo.minimum_height * MAX(1, window().prescale()); - - // determine the refresh rate of the primary screen - einfo.target_refresh = 60.0; - const screen_device *primary_screen = window().machine().config().first_screen(); - if (primary_screen != NULL) - einfo.target_refresh = ATTOSECONDS_TO_HZ(primary_screen->refresh_attoseconds()); - printf("Target refresh = %f\n", einfo.target_refresh); - - // if we're not stretching, allow some slop on the minimum since we can handle it - if (!video_config.hwstretch) - { - einfo.minimum_width -= 4; - einfo.minimum_height -= 4; - } - - // if we are stretching, aim for a mode approximately 2x the game's resolution - else if (window().prescale() <= 1) - { - einfo.target_width *= 2; - einfo.target_height *= 2; - } - - // fill in the rest of the data - einfo.window = &window(); - einfo.renderer = this; - einfo.best_score = 0.0f; - - // enumerate the modes - osd_printf_verbose("DirectDraw: Selecting video mode...\n"); - result = IDirectDraw7_EnumDisplayModes(ddraw, DDEDM_REFRESHRATES, NULL, &einfo, enum_modes_callback); - if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X during EnumDisplayModes call\n", (int)result); - osd_printf_verbose("DirectDraw: Mode selected = %4dx%4d@%3dHz\n", width, height, refresh); -} diff --git a/src/osd/sdl/video.h b/src/osd/sdl/video.h index c6a2b13cc31..a811a417ef4 100644 --- a/src/osd/sdl/video.h +++ b/src/osd/sdl/video.h @@ -181,9 +181,6 @@ struct osd_video_config int fullstretch; // FXIME: implement in windows! - // ddraw options - int hwstretch; // stretch using the hardware - // d3d, accel, opengl int filter; // enable filtering //int filter; // enable filtering, disabled if glsl_filter>0 diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index 32df3d25ba4..b441121f1ca 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -373,8 +373,6 @@ void windows_osd_interface::extract_video_config() video_config.mode = VIDEO_MODE_D3D; else if (strcmp(stemp, "auto") == 0) video_config.mode = VIDEO_MODE_D3D; - else if (strcmp(stemp, "ddraw") == 0) - video_config.mode = VIDEO_MODE_DDRAW; else if (strcmp(stemp, "gdi") == 0) video_config.mode = VIDEO_MODE_GDI; else if (strcmp(stemp, "bgfx") == 0) @@ -399,9 +397,6 @@ void windows_osd_interface::extract_video_config() video_config.triplebuf = options().triple_buffer(); video_config.switchres = options().switch_res(); - // ddraw options: extract the data - video_config.hwstretch = options().hwstretch(); - if (video_config.prescale < 1 || video_config.prescale > 3) { osd_printf_warning("Invalid prescale option, reverting to '1'\n"); diff --git a/src/osd/windows/video.h b/src/osd/windows/video.h index 4b6df303f1f..87612fb51fe 100644 --- a/src/osd/windows/video.h +++ b/src/osd/windows/video.h @@ -21,7 +21,6 @@ enum { VIDEO_MODE_NONE, VIDEO_MODE_GDI, - VIDEO_MODE_DDRAW, VIDEO_MODE_BGFX, #if (USE_OPENGL) VIDEO_MODE_OPENGL, @@ -178,9 +177,6 @@ struct osd_video_config int fullstretch; // FXIME: implement in windows! - // ddraw options - int hwstretch; // stretch using the hardware - // d3d, accel, opengl int filter; // enable filtering //int filter; // enable filtering, disabled if glsl_filter>0 diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index b73afbc6445..0fbfae9c481 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -36,7 +36,6 @@ extern int drawnone_init(running_machine &machine, osd_draw_callbacks *callbacks); extern int drawgdi_init(running_machine &machine, osd_draw_callbacks *callbacks); -extern int drawdd_init(running_machine &machine, osd_draw_callbacks *callbacks); extern int drawd3d_init(running_machine &machine, osd_draw_callbacks *callbacks); extern int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks); #if (USE_OPENGL) @@ -219,11 +218,6 @@ bool windows_osd_interface::window_init() if (drawd3d_init(machine(), &draw)) video_config.mode = VIDEO_MODE_GDI; } - if (video_config.mode == VIDEO_MODE_DDRAW) - { - if (drawdd_init(machine(), &draw)) - video_config.mode = VIDEO_MODE_GDI; - } if (video_config.mode == VIDEO_MODE_GDI) drawgdi_init(machine(), &draw); if (video_config.mode == VIDEO_MODE_BGFX) diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index 2a14281f7fc..cfa0a4fb0b7 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -526,7 +526,6 @@ windows_osd_interface::~windows_osd_interface() void windows_osd_interface::video_register() { video_options_add("gdi", NULL); - video_options_add("ddraw", NULL); video_options_add("d3d", NULL); video_options_add("bgfx", NULL); //video_options_add("auto", NULL); // making d3d video default one -- cgit v1.2.3-70-g09d2 From 408c6351cf0b34d2d1ab518451d1239429c08cee Mon Sep 17 00:00:00 2001 From: fulivi Date: Mon, 11 Jan 2016 13:26:13 +0100 Subject: hp9845: initial version of HP TACO driver (only basic tape movement is working) --- scripts/src/machine.lua | 12 + scripts/target/mame/mess.lua | 1 + src/devices/machine/hp_taco.cpp | 516 ++++++++++++++++++++++++++++++++++++++++ src/devices/machine/hp_taco.h | 93 ++++++++ src/mame/drivers/hp9845.cpp | 69 +++++- 5 files changed, 681 insertions(+), 10 deletions(-) create mode 100644 src/devices/machine/hp_taco.cpp create mode 100644 src/devices/machine/hp_taco.h diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua index 5a97d22d015..fbc923b3073 100644 --- a/scripts/src/machine.lua +++ b/scripts/src/machine.lua @@ -771,6 +771,18 @@ if (MACHINES["HD64610"]~=null) then } end +--------------------------------------------------- +-- +--@src/devices/machine/hp_taco.h,MACHINES["HP_TACO"] = true +--------------------------------------------------- + +if (MACHINES["HP_TACO"]~=null) then + files { + MAME_DIR .. "src/devices/machine/hp_taco.cpp", + MAME_DIR .. "src/devices/machine/hp_taco.h", + } +end + --------------------------------------------------- -- --@src/devices/machine/i2cmem.h,MACHINES["I2CMEM"] = true diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index cb9a150224a..80be3e7c76c 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -398,6 +398,7 @@ MACHINES["ER2055"] = true MACHINES["F3853"] = true MACHINES["HD63450"] = true MACHINES["HD64610"] = true +MACHINES["HP_TACO"] = true MACHINES["I2CMEM"] = true MACHINES["I80130"] = true MACHINES["I8089"] = true diff --git a/src/devices/machine/hp_taco.cpp b/src/devices/machine/hp_taco.cpp new file mode 100644 index 00000000000..1597c5c5733 --- /dev/null +++ b/src/devices/machine/hp_taco.cpp @@ -0,0 +1,516 @@ +// license:BSD-3-Clause +// copyright-holders:F. Ulivi +/********************************************************************* + + hp_taco.cpp + + HP TApe COntroller (5006-3012) + +*********************************************************************/ + +// Documentation I used: +// [1] HP, manual 64940-90905, may 80 rev. - Model 64940A tape control & drive service manual +// [2] US patent 4,075,679 describing HP9825 system (this system had a discrete implementation of tape controller) + +// Format of TACO command/status register (R5) +// Bit R/W Content +// =============== +// 15 RW Tape direction (1 = forward) +// 14..10 RW Command +// 9 RW ? Drive ON according to [1], doesn't match usage of firmware +// 8 RW ? Size of gaps according to [1] +// 7 RW Speed of tape (1 = 90 ips, 0 = 22 ips) +// 6 RW Option bit for various commands +// 5 R Current track (1 = B) +// 4 R Gap detected (1) +// 3 R Write protection (1) +// 2 R Servo failure (1) +// 1 R Cartridge out (1) +// 0 R Hole detected (1) + +// TODO: R6 è modificato durante il conteggio impulsi? Viene azzerato alla lettura? + +#include "emu.h" +#include "hp_taco.h" + +// Debugging +#define VERBOSE 1 +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + +// Macros to clear/set single bits +#define BIT_MASK(n) (1U << (n)) +#define BIT_CLR(w , n) ((w) &= ~BIT_MASK(n)) +#define BIT_SET(w , n) ((w) |= BIT_MASK(n)) + +// Timers +enum { + TAPE_TMR_ID +}; + +// Constants +#define CMD_REG_MASK 0xffc0 // Command register mask +#define STATUS_REG_MASK 0x003f // Status register mask +#define STATUS_ERR_MASK 0x0002 // Mask of errors in status reg. +#define TACH_TICKS_PER_INCH 968 // Tachometer pulses per inch of tape movement +#define TACH_FREQ_SLOW 21276 // Tachometer pulse frequency for slow speed (21.98 ips) +#define TACH_FREQ_FAST 87196 // Tachometer pulse frequency for fast speed (90.08 ips) +#define TAPE_LENGTH ((140 * 12 + 72 * 2) * TACH_TICKS_PER_INCH) // Tape length (in tachometer pulses): 140 ft of usable tape + 72" of punched tape at either end +#define TAPE_INIT_POS (80 * TACH_TICKS_PER_INCH) // Initial tape position: 80" from beginning (just past the punched part) +#define QUICK_CMD_USEC 10 // usec for "quick" command execution + +// Parts of command register +#define CMD_CODE(reg) \ + (((reg) >> 10) & 0x1f) +#define DIR_FWD(reg) \ + (BIT(reg , 15)) +#define SPEED_FAST(reg) \ + (BIT(reg , 7)) +#define CMD_OPT(reg) \ + (BIT(reg , 6)) + +// Commands +enum { + CMD_ALIGN_0, // 00: header alignment (?) + CMD_UNK_01, // 01: unknown + CMD_FINAL_GAP, // 02: write final gap + CMD_INIT_WRITE, // 03: write words for tape formatting + CMD_STOP, // 04: stop + CMD_UNK_05, // 05: unknown + CMD_SET_TRACK, // 06: set A/B track + CMD_UNK_07, // 07: unknown + CMD_UNK_08, // 08: unknown + CMD_UNK_09, // 09: unknown + CMD_MOVE, // 0a: move tape + CMD_UNK_0b, // 0b: unknown + CMD_UNK_0c, // 0c: unknown* + CMD_UNK_0d, // 0d: unknown + CMD_CLEAR, // 0e: clear errors/unlatch status bits + CMD_UNK_0f, // 0f: unknown + CMD_ALIGN_PREAMBLE, // 10: align to end of preamble (?) + CMD_UNK_11, // 11: unknown + CMD_UNK_12, // 12: unknown + CMD_UNK_13, // 13: unknown + CMD_UNK_14, // 14: unknown + CMD_UNK_15, // 15: unknown + CMD_WRITE_IRG, // 16: write inter-record gap + CMD_UNK_17, // 17: unknown + CMD_SCAN_RECORDS, // 18: scan records (count IRGs) + CMD_RECORD_WRITE, // 19: write record words + CMD_UNK_MOVE, // 1a: some kind of tape movement + CMD_UNK_1b, // 1b: unknown + CMD_DELTA_MOVE_REC, // 1c: move tape a given distance (optionally stop at 1st record) (?) + CMD_START_READ, // 1d: start record reading + CMD_DELTA_MOVE_IRG, // 1e: move tape a given distance (optionally stop at 1st IRG) + CMD_END_READ // 1f: stop reading +}; + +// Bits of status register +#define STATUS_HOLE_BIT 0 // Hole detected +#define STATUS_CART_OUT_BIT 1 // Cartridge out +#define STATUS_SFAIL_BIT 2 // Servo failure +#define STATUS_WPR_BIT 3 // Write protection +#define STATUS_GAP_BIT 4 // Gap detected +#define STATUS_TRACKB_BIT 5 // Track B selected + +// *** Position of tape holes *** +// At beginning of tape: +// *START* +// |<-----24"----->|<---12"--->|<---12"--->|<-----24"----->| +// O O O O O O O +// |<->| |<->| |<->| +// 0.218" 0.218" 0.218" +// At end of tape: +// *END* +// |<-----24"----->|<---12"--->|<---12"--->|<-----24"----->| +// O O O O +// +static const hp_taco_device::tape_pos_t tape_holes[] = { + (hp_taco_device::tape_pos_t)(23.891 * TACH_TICKS_PER_INCH), // 24 - 0.218 / 2 + (hp_taco_device::tape_pos_t)(24.109 * TACH_TICKS_PER_INCH), // 24 + 0.218 / 2 + (hp_taco_device::tape_pos_t)(35.891 * TACH_TICKS_PER_INCH), // 36 - 0.218 / 2 + (hp_taco_device::tape_pos_t)(36.109 * TACH_TICKS_PER_INCH), // 36 + 0.218 / 2 + (hp_taco_device::tape_pos_t)(47.891 * TACH_TICKS_PER_INCH), // 48 - 0.218 / 2 + (hp_taco_device::tape_pos_t)(48.109 * TACH_TICKS_PER_INCH), // 48 + 0.218 / 2 + 72 * TACH_TICKS_PER_INCH, // 72 + 1752 * TACH_TICKS_PER_INCH, // 1752 + 1776 * TACH_TICKS_PER_INCH, // 1776 + 1788 * TACH_TICKS_PER_INCH, // 1788 + 1800 * TACH_TICKS_PER_INCH // 1800 +}; + +// Device type definition +const device_type HP_TACO = &device_creator; + +// Constructors +hp_taco_device::hp_taco_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname) + : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), + m_irq_handler(*this), + m_flg_handler(*this), + m_sts_handler(*this), + m_data_reg(0), + m_cmd_reg(0), + m_status_reg(0), + m_tach_reg(0), + m_checksum_reg(0), + m_timing_reg(0), + m_tape_pos(TAPE_INIT_POS) +{ +} + +hp_taco_device::hp_taco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, HP_TACO, "HP TACO", tag, owner, clock, "TACO", __FILE__), + m_irq_handler(*this), + m_flg_handler(*this), + m_sts_handler(*this), + m_data_reg(0), + m_cmd_reg(0), + m_status_reg(0), + m_tach_reg(0), + m_checksum_reg(0), + m_timing_reg(0), + m_tape_pos(TAPE_INIT_POS) +{ +} + +WRITE16_MEMBER(hp_taco_device::reg_w) +{ + LOG(("wr R%u = %04x\n", 4 + offset , data)); + + // Any I/O activity clears IRQ + irq_w(false); + + switch (offset) { + case 0: + // Data register + m_data_reg = data; + break; + + case 1: + // Command register + start_cmd_exec(data & CMD_REG_MASK); + break; + + case 2: + // Tachometer register + m_tach_reg = data; + break; + + case 3: + // Timing register + m_timing_reg = data; + break; + } +} + +READ16_MEMBER(hp_taco_device::reg_r) +{ + UINT16 res = 0; + + // Any I/O activity clears IRQ + irq_w(false); + + switch (offset) { + case 0: + // Data register + res = m_data_reg; + break; + + case 1: + // Command & status register + res = (m_cmd_reg & CMD_REG_MASK) | (m_status_reg & STATUS_REG_MASK); + break; + + case 2: + // Tachometer register + res = m_tach_reg; + break; + + case 3: + // Checksum register + res = m_checksum_reg; + m_checksum_reg = 0; + break; + } + + LOG(("rd R%u = %04x\n", 4 + offset , res)); + + return res; +} + +READ_LINE_MEMBER(hp_taco_device::flg_r) +{ + return m_flg; +} + +READ_LINE_MEMBER(hp_taco_device::sts_r) +{ + return m_sts; +} + +// device_start +void hp_taco_device::device_start() +{ + m_irq_handler.resolve_safe(); + m_flg_handler.resolve_safe(); + m_sts_handler.resolve_safe(); + + save_item(NAME(m_data_reg)); + save_item(NAME(m_cmd_reg)); + save_item(NAME(m_status_reg)); + save_item(NAME(m_tach_reg)); + save_item(NAME(m_checksum_reg)); + save_item(NAME(m_timing_reg)); + save_item(NAME(m_irq)); + save_item(NAME(m_flg)); + save_item(NAME(m_sts)); + save_item(NAME(m_tape_pos)); + save_item(NAME(m_start_time)); + + m_tape_timer = timer_alloc(TAPE_TMR_ID); +} + +// device_reset +void hp_taco_device::device_reset() +{ + m_data_reg = 0; + m_cmd_reg = 0; + m_status_reg = 0; + m_tach_reg = 0; + m_checksum_reg = 0; + m_timing_reg = 0; + m_start_time = attotime::never; + + m_irq = false; + m_flg = true; + + m_irq_handler(false); + m_flg_handler(true); + set_error(false); +} + +void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) { + case TAPE_TMR_ID: + LOG(("Tape tmr @%g\n" , machine().time().as_double())); + switch (CMD_CODE(m_cmd_reg)) { + case CMD_MOVE: + // Generate an interrupt each time a hole is crossed (tape doesn't stop) + update_tape_pos(); + m_tape_timer->adjust(time_to_target(next_hole(DIR_FWD(m_cmd_reg)) , SPEED_FAST(m_cmd_reg))); + BIT_SET(m_status_reg, STATUS_HOLE_BIT); + break; + + case CMD_DELTA_MOVE_REC: + case CMD_DELTA_MOVE_IRG: + // Interrupt & stop at end of movement + stop_tape(); + break; + + default: + // Other commands: just raise irq + break; + } + irq_w(true); + break; + + default: + break; + } +} + +void hp_taco_device::irq_w(bool state) +{ + if (state != m_irq) { + m_irq = state; + m_irq_handler(state); + LOG(("IRQ = %d\n" , state)); + } +} + +void hp_taco_device::set_error(bool state) +{ + m_sts = !state; + m_sts_handler(m_sts); + LOG(("error = %d\n" , state)); +} + +bool hp_taco_device::check_for_errors(void) +{ + // Is it an error when "status" flag is already reporting an error? Dunno... + if ((m_status_reg & STATUS_ERR_MASK) != 0) { + set_error(true); + return true; + } else { + return false; + } +} + +unsigned hp_taco_device::speed_to_tick_freq(bool fast) +{ + return fast ? TACH_FREQ_FAST : TACH_FREQ_SLOW; +} + +void hp_taco_device::update_tape_pos(void) +{ + attotime delta_time(machine().time() - m_start_time); + m_start_time = machine().time(); + LOG(("delta_time = %g\n" , delta_time.as_double())); + // How many tachometer ticks has the tape moved? + unsigned delta_tach = (unsigned)(delta_time.as_ticks(speed_to_tick_freq(SPEED_FAST(m_cmd_reg)))); + LOG(("delta_tach = %u\n" , delta_tach)); + + if (DIR_FWD(m_cmd_reg)) { + // Forward + m_tape_pos += delta_tach; + + // In real life tape would unspool.. + if (m_tape_pos > TAPE_LENGTH) { + m_tape_pos = TAPE_LENGTH; + LOG(("Tape unspooled at the end!\n")); + } + } else { + // Reverse + if (delta_tach >= m_tape_pos) { + m_tape_pos = 0; + LOG(("Tape unspooled at the start!\n")); + } else { + m_tape_pos -= delta_tach; + } + } + LOG(("Tape pos = %u\n" , m_tape_pos)); +} + +// Is there any hole in a given section of tape? +bool hp_taco_device::any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b) +{ + if (tape_pos_a > tape_pos_b) { + // Ensure A always comes before B + tape_pos_t tmp; + tmp = tape_pos_a; + tape_pos_a = tape_pos_b; + tape_pos_b = tmp; + } + + for (tape_pos_t hole : tape_holes) { + if (tape_pos_a < hole && tape_pos_b >= hole) { + return true; + } + } + + return false; +} + +// Position of next hole tape will reach in a given direction +hp_taco_device::tape_pos_t hp_taco_device::next_hole(bool fwd) const +{ + if (fwd) { + for (tape_pos_t hole : tape_holes) { + if (hole > m_tape_pos) { + LOG(("next hole fwd @%u = %u\n" , m_tape_pos , hole)); + return hole; + } + } + // No more holes: will hit end of tape + return TAPE_LENGTH; + } else { + for (int i = (sizeof(tape_holes) / sizeof(tape_holes[ 0 ])) - 1; i >= 0; i--) { + if (tape_holes[ i ] < m_tape_pos) { + LOG(("next hole rev @%u = %u\n" , m_tape_pos , tape_holes[ i ])); + return tape_holes[ i ]; + } + } + // No more holes: will hit start of tape + return 0; + } +} + +attotime hp_taco_device::time_to_distance(tape_pos_t distance, bool fast) +{ + // +1 for rounding + return attotime::from_ticks(distance + 1 , speed_to_tick_freq(fast)); +} + +attotime hp_taco_device::time_to_target(tape_pos_t target, bool fast) const +{ + return time_to_distance(abs(target - m_tape_pos), fast); +} + +void hp_taco_device::start_tape(void) +{ + m_start_time = machine().time(); + BIT_CLR(m_status_reg, STATUS_HOLE_BIT); +} + +void hp_taco_device::stop_tape(void) +{ + if (!m_start_time.is_never()) { + tape_pos_t tape_start_pos = m_tape_pos; + update_tape_pos(); + if (any_hole(tape_start_pos , m_tape_pos)) { + // Crossed one or more holes + BIT_SET(m_status_reg , STATUS_HOLE_BIT); + } + m_start_time = attotime::never; + } + m_tape_timer->reset(); +} + +void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg) +{ + LOG(("Cmd = %02x\n" , CMD_CODE(new_cmd_reg))); + + attotime cmd_duration = attotime::never; + + // Should irq be raised anyway when already in error condition? Here we do nothing. + + switch (CMD_CODE(new_cmd_reg)) { + case CMD_CLEAR: + set_error(false); + BIT_CLR(m_status_reg, STATUS_HOLE_BIT); + // This is a special command: it doesn't raise IRQ at completion and it + // doesn't replace the current command, if any. + return; + + case CMD_STOP: + stop_tape(); + cmd_duration = attotime::from_usec(QUICK_CMD_USEC); + break; + + case CMD_SET_TRACK: + if (!check_for_errors()) { + if (CMD_OPT(new_cmd_reg)) { + BIT_SET(m_status_reg, STATUS_TRACKB_BIT); + } else { + BIT_CLR(m_status_reg, STATUS_TRACKB_BIT); + } + cmd_duration = attotime::from_usec(QUICK_CMD_USEC); + } + break; + + case CMD_MOVE: + stop_tape(); + if (!check_for_errors()) { + start_tape(); + cmd_duration = time_to_target(next_hole(DIR_FWD(new_cmd_reg)) , SPEED_FAST(new_cmd_reg)); + } + break; + + case CMD_DELTA_MOVE_REC: + case CMD_DELTA_MOVE_IRG: + // TODO: record/irg detection + stop_tape(); + if (!check_for_errors()) { + start_tape(); + cmd_duration = time_to_distance(0x10000U - m_tach_reg , SPEED_FAST(new_cmd_reg)); + } + break; + + default: + LOG(("Unrecognized command\n")); + return; + } + + m_tape_timer->adjust(cmd_duration); + m_cmd_reg = new_cmd_reg; +} diff --git a/src/devices/machine/hp_taco.h b/src/devices/machine/hp_taco.h new file mode 100644 index 00000000000..e279d045d10 --- /dev/null +++ b/src/devices/machine/hp_taco.h @@ -0,0 +1,93 @@ +// license:BSD-3-Clause +// copyright-holders:F. Ulivi +/********************************************************************* + + hp_taco.h + + HP TApe COntroller (5006-3012) + +*********************************************************************/ + +#ifndef __HP_TACO_H__ +#define __HP_TACO_H__ + +#define MCFG_TACO_IRQ_HANDLER(_devcb) \ + devcb = &hp_taco_device::set_irq_handler(*device , DEVCB_##_devcb); + +#define MCFG_TACO_FLG_HANDLER(_devcb) \ + devcb = &hp_taco_device::set_flg_handler(*device , DEVCB_##_devcb); + +#define MCFG_TACO_STS_HANDLER(_devcb) \ + devcb = &hp_taco_device::set_sts_handler(*device , DEVCB_##_devcb); + +class hp_taco_device : public device_t +{ +public: + // construction/destruction + hp_taco_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname); + hp_taco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // static configuration helpers + template static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast(device).m_irq_handler.set_callback(object); } + template static devcb_base &set_flg_handler(device_t &device, _Object object) { return downcast(device).m_flg_handler.set_callback(object); } + template static devcb_base &set_sts_handler(device_t &device, _Object object) { return downcast(device).m_sts_handler.set_callback(object); } + + // Register read/write + DECLARE_WRITE16_MEMBER(reg_w); + DECLARE_READ16_MEMBER(reg_r); + + // Flag & status read + DECLARE_READ_LINE_MEMBER(flg_r); + DECLARE_READ_LINE_MEMBER(sts_r); + + typedef UINT32 tape_pos_t; + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + +private: + devcb_write_line m_irq_handler; + devcb_write_line m_flg_handler; + devcb_write_line m_sts_handler; + + // Registers + UINT16 m_data_reg; + UINT16 m_cmd_reg; + UINT16 m_status_reg; + UINT16 m_tach_reg; + UINT16 m_checksum_reg; + UINT16 m_timing_reg; + + // State + bool m_irq; + bool m_flg; + bool m_sts; + + // Tape position + tape_pos_t m_tape_pos; + attotime m_start_time; + + // Timers + emu_timer *m_tape_timer; + + void irq_w(bool state); + void set_error(bool state); + bool check_for_errors(void); + static unsigned speed_to_tick_freq(bool fast); + void update_tape_pos(void); + static bool any_hole(UINT32 tape_pos_a , UINT32 tape_pos_b); + UINT32 next_hole(bool fwd) const; + static attotime time_to_distance(UINT32 distance, bool fast); + attotime time_to_target(UINT32 target, bool fast) const; + void start_tape(void); + void stop_tape(void); + void start_cmd_exec(UINT16 new_cmd_reg); +}; + +// device type definition +extern const device_type HP_TACO; + +#endif /* __HP_TACO_H__ */ diff --git a/src/mame/drivers/hp9845.cpp b/src/mame/drivers/hp9845.cpp index 2936cae3228..ec0e53da906 100644 --- a/src/mame/drivers/hp9845.cpp +++ b/src/mame/drivers/hp9845.cpp @@ -33,6 +33,7 @@ #include "cpu/z80/z80.h" #include "softlist.h" #include "cpu/hphybrid/hphybrid.h" +#include "machine/hp_taco.h" #define BIT_MASK(n) (1U << (n)) @@ -77,7 +78,8 @@ public: m_io_key0(*this , "KEY0"), m_io_key1(*this , "KEY1"), m_io_key2(*this , "KEY2"), - m_io_key3(*this , "KEY3") + m_io_key3(*this , "KEY3"), + m_t15(*this , "t15") { } UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -90,7 +92,7 @@ public: void vblank_w(screen_device &screen, bool state); IRQ_CALLBACK_MEMBER(irq_callback); - void update_irl(void); + void update_irq(void); TIMER_DEVICE_CALLBACK_MEMBER(kb_scan); DECLARE_READ16_MEMBER(kb_scancode_r); @@ -99,6 +101,10 @@ public: DECLARE_WRITE8_MEMBER(pa_w); + DECLARE_WRITE_LINE_MEMBER(t15_irq_w); + DECLARE_WRITE_LINE_MEMBER(t15_flg_w); + DECLARE_WRITE_LINE_MEMBER(t15_sts_w); + private: required_device m_lpu; required_device m_ppu; @@ -107,6 +113,7 @@ private: required_ioport m_io_key1; required_ioport m_io_key2; required_ioport m_io_key3; + required_device m_t15; void set_video_mar(UINT16 mar); void video_fill_buff(bool buff_idx); @@ -136,12 +143,15 @@ private: // Interrupt handling UINT8 m_irl_pending; + UINT8 m_irh_pending; // State of keyboard ioport_value m_kb_state[ 4 ]; UINT8 m_kb_scancode; UINT16 m_kb_status; + // State of PPU I/O + UINT8 m_ppu_pa; }; static INPUT_PORTS_START(hp9845b) @@ -322,10 +332,13 @@ void hp9845b_state::machine_reset() m_video_frame = 0; m_irl_pending = 0; + m_irh_pending = 0; memset(&m_kb_state[ 0 ] , 0 , sizeof(m_kb_state)); m_kb_scancode = 0x7f; m_kb_status = 0; + + m_ppu_pa = 0; } void hp9845b_state::set_video_mar(UINT16 mar) @@ -479,13 +492,14 @@ IRQ_CALLBACK_MEMBER(hp9845b_state::irq_callback) if (irqline == HPHYBRID_IRL) { return m_irl_pending; } else { - return 0; + return m_irh_pending; } } -void hp9845b_state::update_irl(void) +void hp9845b_state::update_irq(void) { m_ppu->set_input_line(HPHYBRID_IRL , m_irl_pending != 0); + m_ppu->set_input_line(HPHYBRID_IRH , m_irh_pending != 0); } TIMER_DEVICE_CALLBACK_MEMBER(hp9845b_state::kb_scan) @@ -546,7 +560,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(hp9845b_state::kb_scan) m_kb_scancode = i; BIT_SET(m_irl_pending , 0); BIT_SET(m_kb_status, 0); - update_irl(); + update_irq(); // Special case: pressing stop key sets LPU "status" flag if (i == 0x47) { @@ -572,24 +586,50 @@ WRITE16_MEMBER(hp9845b_state::kb_irq_clear_w) { BIT_CLR(m_irl_pending , 0); BIT_CLR(m_kb_status, 0); - update_irl(); + update_irq(); m_lpu->status_w(0); // TODO: beeper start } WRITE8_MEMBER(hp9845b_state::pa_w) { + m_ppu_pa = data; + // TODO: handle sts & flg - if (data == 0xf) { - // RHS tape drive (T15) - m_ppu->status_w(1); - m_ppu->flag_w(1); + if (data == 15) { + // RHS tape drive (T15) + m_ppu->status_w(m_t15->sts_r()); + m_ppu->flag_w(m_t15->flg_r()); } else { m_ppu->status_w(0); m_ppu->flag_w(0); } } +WRITE_LINE_MEMBER(hp9845b_state::t15_irq_w) +{ + if (state) { + BIT_SET(m_irh_pending , 7); + } else { + BIT_CLR(m_irh_pending , 7); + } + update_irq(); +} + +WRITE_LINE_MEMBER(hp9845b_state::t15_flg_w) +{ + if (m_ppu_pa == 15) { + m_ppu->flag_w(state); + } +} + +WRITE_LINE_MEMBER(hp9845b_state::t15_sts_w) +{ + if (m_ppu_pa == 15) { + m_ppu->status_w(state); + } +} + static MACHINE_CONFIG_START( hp9845a, hp9845_state ) //MCFG_CPU_ADD("lpu", HP_5061_3010, XTAL_11_4MHz) //MCFG_CPU_ADD("ppu", HP_5061_3011, XTAL_11_4MHz) @@ -638,6 +678,9 @@ static ADDRESS_MAP_START(ppu_io_map , AS_IO , 16 , hp9845b_state) // PA = 0, IC = 3 // Keyboard status input & keyboard interrupt clear AM_RANGE(HP_MAKE_IOADDR(0 , 3) , HP_MAKE_IOADDR(0 , 3)) AM_READWRITE(kb_status_r , kb_irq_clear_w) + // PA = 15, IC = 0..3 + // Right-hand side tape drive (T15) + AM_RANGE(HP_MAKE_IOADDR(15 , 0) , HP_MAKE_IOADDR(15 , 3)) AM_DEVREADWRITE("t15" , hp_taco_device , reg_r , reg_w) ADDRESS_MAP_END static MACHINE_CONFIG_START( hp9845b, hp9845b_state ) @@ -663,6 +706,12 @@ static MACHINE_CONFIG_START( hp9845b, hp9845b_state ) // Actual keyboard refresh rate should be KEY_SCAN_OSCILLATOR / 128 (2560 Hz) MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer" , hp9845b_state , kb_scan , attotime::from_hz(100)) + // Tape controller + MCFG_DEVICE_ADD("t15" , HP_TACO , 4000000) + MCFG_TACO_IRQ_HANDLER(WRITELINE(hp9845b_state , t15_irq_w)) + MCFG_TACO_FLG_HANDLER(WRITELINE(hp9845b_state , t15_flg_w)) + MCFG_TACO_STS_HANDLER(WRITELINE(hp9845b_state , t15_sts_w)) + MCFG_SOFTWARE_LIST_ADD("optrom_list", "hp9845b_rom") MACHINE_CONFIG_END -- cgit v1.2.3-70-g09d2 From 617295ec8644d6bfaf224450d170361f6d3ddbfc Mon Sep 17 00:00:00 2001 From: fulivi Date: Thu, 14 Jan 2016 13:36:59 +0100 Subject: hphybrid: interrupt vector fetching fixed (again) --- src/devices/cpu/hphybrid/hphybrid.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/devices/cpu/hphybrid/hphybrid.cpp b/src/devices/cpu/hphybrid/hphybrid.cpp index 052c7058604..71aec796760 100644 --- a/src/devices/cpu/hphybrid/hphybrid.cpp +++ b/src/devices/cpu/hphybrid/hphybrid.cpp @@ -673,12 +673,7 @@ UINT16 hp_hybrid_cpu_device::RM(UINT32 addr) return RIO(CURRENT_PA , addr_wo_bsc - HP_REG_R4_ADDR); case HP_REG_IV_ADDR: - // Correct? - if (!BIT(m_flags , HPHYBRID_IRH_SVC_BIT) && !BIT(m_flags , HPHYBRID_IRL_SVC_BIT)) { - return m_reg_IV; - } else { - return m_reg_IV | CURRENT_PA; - } + return m_reg_IV; case HP_REG_PA_ADDR: return CURRENT_PA; @@ -1021,7 +1016,7 @@ void hp_hybrid_cpu_device::check_for_interrupts(void) // Do a double-indirect JSM IV,I instruction WM(AEC_CASE_C , ++m_reg_R , m_reg_P); - m_reg_P = RM(AEC_CASE_I , RM(HP_REG_IV_ADDR)); + m_reg_P = RM(AEC_CASE_I , m_reg_IV + CURRENT_PA); m_reg_I = fetch(); } -- cgit v1.2.3-70-g09d2 From 8d80c1f25952441f64a027aeed183f50302962ae Mon Sep 17 00:00:00 2001 From: fulivi Date: Tue, 9 Feb 2016 14:08:02 +0100 Subject: hp9845: major update to TACO driver, it can read&write tapes now. To be cleaned. --- src/devices/machine/hp_taco.cpp | 991 +++++++++++++++++++++++++++++++++++----- src/devices/machine/hp_taco.h | 102 ++++- 2 files changed, 969 insertions(+), 124 deletions(-) diff --git a/src/devices/machine/hp_taco.cpp b/src/devices/machine/hp_taco.cpp index 1597c5c5733..388cd1acdfe 100644 --- a/src/devices/machine/hp_taco.cpp +++ b/src/devices/machine/hp_taco.cpp @@ -44,19 +44,32 @@ // Timers enum { - TAPE_TMR_ID + TAPE_TMR_ID, + HOLE_TMR_ID }; // Constants #define CMD_REG_MASK 0xffc0 // Command register mask #define STATUS_REG_MASK 0x003f // Status register mask -#define STATUS_ERR_MASK 0x0002 // Mask of errors in status reg. #define TACH_TICKS_PER_INCH 968 // Tachometer pulses per inch of tape movement +#define TAPE_POS_FRACT 1024 // 10 bits of fractional part in tape_pos_t +#define ONE_INCH_POS (TACH_TICKS_PER_INCH * TAPE_POS_FRACT) // Value in tape_pos_t representing 1 inch of tape #define TACH_FREQ_SLOW 21276 // Tachometer pulse frequency for slow speed (21.98 ips) #define TACH_FREQ_FAST 87196 // Tachometer pulse frequency for fast speed (90.08 ips) -#define TAPE_LENGTH ((140 * 12 + 72 * 2) * TACH_TICKS_PER_INCH) // Tape length (in tachometer pulses): 140 ft of usable tape + 72" of punched tape at either end -#define TAPE_INIT_POS (80 * TACH_TICKS_PER_INCH) // Initial tape position: 80" from beginning (just past the punched part) -#define QUICK_CMD_USEC 10 // usec for "quick" command execution +#define TAPE_LENGTH ((140 * 12 + 72 * 2) * ONE_INCH_POS) // Tape length: 140 ft of usable tape + 72" of punched tape at either end +#define TAPE_INIT_POS (80 * ONE_INCH_POS) // Initial tape position: 80" from beginning (just past the punched part) +#define ZERO_BIT_LEN 619 // Length of 0 bits at slow tape speed: 1/(35200 Hz) +#define ONE_BIT_LEN 1083 // Length of 1 bits at slow tape speed: 1.75 times ZERO_BIT_LEN +#define QUICK_CMD_USEC 25 // usec for "quick" command execution +#define FAST_BRAKE_MSEC 73 // Braking time from fast speed to stop (2 ips) in msec (deceleration is 1200 in/s^2) +#define SLOW_BRAKE_MSEC 17 // Braking time from slow speed to stop in msec +#define FAST_BRAKE_DIST 3350450 // Braking distance at fast speed (~3.38 in) +#define SLOW_BRAKE_DIST 197883 // Braking distance at slow speed (~0.2 in) +#define PREAMBLE_WORD 0 // Value of preamble word +#define END_GAP_LENGTH (6 * ONE_INCH_POS) // Length of final gap: 6" +#define MIN_IRG_LENGTH ((tape_pos_t)(0.2 * ONE_INCH_POS)) // Minimum length of IRGs: 0.2" (from 9825, not sure about value in TACO) +#define NULL_TAPE_POS ((tape_pos_t)-1) // Special value for invalid/unknown tape position +#define NO_DATA_GAP (17 * ONE_BIT_LEN) // Minimum gap size to detect end of data: length of longest word (0xffff) // Parts of command register #define CMD_CODE(reg) \ @@ -67,10 +80,14 @@ enum { (BIT(reg , 7)) #define CMD_OPT(reg) \ (BIT(reg , 6)) +#define UNKNOWN_B9(reg) \ + (BIT(reg , 9)) +#define DIR_FWD_MASK BIT_MASK(15) // Direction = forward +#define SPEED_FAST_MASK BIT_MASK(7) // Speed = fast // Commands enum { - CMD_ALIGN_0, // 00: header alignment (?) + CMD_INDTA_INGAP, // 00: scan for data first then for gap CMD_UNK_01, // 01: unknown CMD_FINAL_GAP, // 02: write final gap CMD_INIT_WRITE, // 03: write words for tape formatting @@ -82,11 +99,11 @@ enum { CMD_UNK_09, // 09: unknown CMD_MOVE, // 0a: move tape CMD_UNK_0b, // 0b: unknown - CMD_UNK_0c, // 0c: unknown* + CMD_INGAP_MOVE, // 0c: scan for gap then move a bit further (used to gain some margin when inverting tape movement) CMD_UNK_0d, // 0d: unknown CMD_CLEAR, // 0e: clear errors/unlatch status bits CMD_UNK_0f, // 0f: unknown - CMD_ALIGN_PREAMBLE, // 10: align to end of preamble (?) + CMD_NOT_INDTA, // 10: scan for end of data CMD_UNK_11, // 11: unknown CMD_UNK_12, // 12: unknown CMD_UNK_13, // 13: unknown @@ -96,11 +113,11 @@ enum { CMD_UNK_17, // 17: unknown CMD_SCAN_RECORDS, // 18: scan records (count IRGs) CMD_RECORD_WRITE, // 19: write record words - CMD_UNK_MOVE, // 1a: some kind of tape movement - CMD_UNK_1b, // 1b: unknown - CMD_DELTA_MOVE_REC, // 1c: move tape a given distance (optionally stop at 1st record) (?) + CMD_MOVE_INDTA, // 1a: move then scan for data + CMD_UNK_1b, // 1b: unknown (for now it seems harmless to handle it as NOP) + CMD_DELTA_MOVE_HOLE, // 1c: move tape a given distance, intr at end or first hole found (whichever comes first) CMD_START_READ, // 1d: start record reading - CMD_DELTA_MOVE_IRG, // 1e: move tape a given distance (optionally stop at 1st IRG) + CMD_DELTA_MOVE_IRG, // 1e: move tape a given distance, detect gaps in parallel CMD_END_READ // 1f: stop reading }; @@ -111,6 +128,9 @@ enum { #define STATUS_WPR_BIT 3 // Write protection #define STATUS_GAP_BIT 4 // Gap detected #define STATUS_TRACKB_BIT 5 // Track B selected +#define STATUS_CART_OUT_MASK BIT_MASK(STATUS_CART_OUT_BIT) // Cartridge out +#define STATUS_WPR_MASK BIT_MASK(STATUS_WPR_BIT) // Write protection +#define STATUS_ERR_MASK (STATUS_CART_OUT_MASK) // Mask of errors in status reg. // *** Position of tape holes *** // At beginning of tape: @@ -125,17 +145,17 @@ enum { // O O O O // static const hp_taco_device::tape_pos_t tape_holes[] = { - (hp_taco_device::tape_pos_t)(23.891 * TACH_TICKS_PER_INCH), // 24 - 0.218 / 2 - (hp_taco_device::tape_pos_t)(24.109 * TACH_TICKS_PER_INCH), // 24 + 0.218 / 2 - (hp_taco_device::tape_pos_t)(35.891 * TACH_TICKS_PER_INCH), // 36 - 0.218 / 2 - (hp_taco_device::tape_pos_t)(36.109 * TACH_TICKS_PER_INCH), // 36 + 0.218 / 2 - (hp_taco_device::tape_pos_t)(47.891 * TACH_TICKS_PER_INCH), // 48 - 0.218 / 2 - (hp_taco_device::tape_pos_t)(48.109 * TACH_TICKS_PER_INCH), // 48 + 0.218 / 2 - 72 * TACH_TICKS_PER_INCH, // 72 - 1752 * TACH_TICKS_PER_INCH, // 1752 - 1776 * TACH_TICKS_PER_INCH, // 1776 - 1788 * TACH_TICKS_PER_INCH, // 1788 - 1800 * TACH_TICKS_PER_INCH // 1800 + (hp_taco_device::tape_pos_t)(23.891 * ONE_INCH_POS), // 24 - 0.218 / 2 + (hp_taco_device::tape_pos_t)(24.109 * ONE_INCH_POS), // 24 + 0.218 / 2 + (hp_taco_device::tape_pos_t)(35.891 * ONE_INCH_POS), // 36 - 0.218 / 2 + (hp_taco_device::tape_pos_t)(36.109 * ONE_INCH_POS), // 36 + 0.218 / 2 + (hp_taco_device::tape_pos_t)(47.891 * ONE_INCH_POS), // 48 - 0.218 / 2 + (hp_taco_device::tape_pos_t)(48.109 * ONE_INCH_POS), // 48 + 0.218 / 2 + 72 * ONE_INCH_POS, // 72 + 1752 * ONE_INCH_POS, // 1752 + 1776 * ONE_INCH_POS, // 1776 + 1788 * ONE_INCH_POS, // 1788 + 1800 * ONE_INCH_POS // 1800 }; // Device type definition @@ -148,6 +168,7 @@ hp_taco_device::hp_taco_device(const machine_config &mconfig, device_type type, m_flg_handler(*this), m_sts_handler(*this), m_data_reg(0), + m_data_reg_full(false), m_cmd_reg(0), m_status_reg(0), m_tach_reg(0), @@ -163,6 +184,7 @@ hp_taco_device::hp_taco_device(const machine_config &mconfig, const char *tag, d m_flg_handler(*this), m_sts_handler(*this), m_data_reg(0), + m_data_reg_full(false), m_cmd_reg(0), m_status_reg(0), m_tach_reg(0), @@ -183,6 +205,7 @@ WRITE16_MEMBER(hp_taco_device::reg_w) case 0: // Data register m_data_reg = data; + m_data_reg_full = true; break; case 1: @@ -226,7 +249,7 @@ READ16_MEMBER(hp_taco_device::reg_r) break; case 3: - // Checksum register + // Checksum register: it clears when read res = m_checksum_reg; m_checksum_reg = 0; break; @@ -255,7 +278,9 @@ void hp_taco_device::device_start() m_sts_handler.resolve_safe(); save_item(NAME(m_data_reg)); + save_item(NAME(m_data_reg_full)); save_item(NAME(m_cmd_reg)); + save_item(NAME(m_cmd_state)); save_item(NAME(m_status_reg)); save_item(NAME(m_tach_reg)); save_item(NAME(m_checksum_reg)); @@ -265,20 +290,43 @@ void hp_taco_device::device_start() save_item(NAME(m_sts)); save_item(NAME(m_tape_pos)); save_item(NAME(m_start_time)); + save_item(NAME(m_tape_fwd)); + save_item(NAME(m_tape_fast)); m_tape_timer = timer_alloc(TAPE_TMR_ID); + m_hole_timer = timer_alloc(HOLE_TMR_ID); + + FILE *in = fopen("tape_dump.bin" , "rb"); + if (in != NULL) { + load_tape(in); + fclose(in); + } +} + +// device_stop +void hp_taco_device::device_stop() +{ + LOG(("**device_stop**\n")); + FILE *out = fopen("tape_dump.bin" , "wb"); + if (out != NULL) { + save_tape(out); + fclose(out); + } } // device_reset void hp_taco_device::device_reset() { m_data_reg = 0; + m_data_reg_full = false; m_cmd_reg = 0; m_status_reg = 0; m_tach_reg = 0; m_checksum_reg = 0; m_timing_reg = 0; m_start_time = attotime::never; + m_rd_it_valid = false; + m_gap_detect_start = NULL_TAPE_POS; m_irq = false; m_flg = true; @@ -290,23 +338,152 @@ void hp_taco_device::device_reset() void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { + if (CMD_CODE(m_cmd_reg) != CMD_STOP) { + update_tape_pos(); + } + switch (id) { case TAPE_TMR_ID: LOG(("Tape tmr @%g\n" , machine().time().as_double())); + + tape_pos_t length; + switch (CMD_CODE(m_cmd_reg)) { - case CMD_MOVE: - // Generate an interrupt each time a hole is crossed (tape doesn't stop) - update_tape_pos(); - m_tape_timer->adjust(time_to_target(next_hole(DIR_FWD(m_cmd_reg)) , SPEED_FAST(m_cmd_reg))); - BIT_SET(m_status_reg, STATUS_HOLE_BIT); + case CMD_INDTA_INGAP: + if (m_cmd_state == 0) { + m_cmd_state = 1; + tape_pos_t target = m_tape_pos; + if (next_n_gap(target, 1, MIN_IRG_LENGTH)) { + m_tape_timer->adjust(time_to_target(target)); + } + return; + } break; - case CMD_DELTA_MOVE_REC: - case CMD_DELTA_MOVE_IRG: - // Interrupt & stop at end of movement + case CMD_RECORD_WRITE: + if (m_cmd_state == 0) { + if (m_rd_it->second == PREAMBLE_WORD) { + LOG(("Got preamble\n")); + m_cmd_state = 1; + // m_rw_pos already at correct position + m_tape_timer->adjust(fetch_next_wr_word()); + break; + } else { + adv_res_t res = adv_it(m_rd_it); + if (res != ADV_NO_MORE_DATA) { + m_tape_timer->adjust(time_to_rd_next_word(m_rw_pos)); + } + // No IRQ + return; + } + } + // Intentional fall-through + case CMD_INIT_WRITE: + write_word(m_rw_pos , m_next_word , length); + pos_offset(m_rw_pos , length); + // Just to be sure.. + m_tape_pos = m_rw_pos; + m_tape_timer->adjust(fetch_next_wr_word()); + break; + + case CMD_STOP: + move_tape_pos(m_tape_fast ? FAST_BRAKE_DIST : SLOW_BRAKE_DIST); stop_tape(); break; + case CMD_INGAP_MOVE: + if (m_cmd_state == 0) { + m_cmd_state = 1; + m_tape_timer->adjust(time_to_tach_pulses()); + return; + } + break; + + case CMD_FINAL_GAP: + case CMD_WRITE_IRG: + write_gap(m_rw_pos , m_tape_pos); + m_hole_timer->reset(); + break; + + case CMD_SCAN_RECORDS: + if (m_cmd_state == 0) { + m_cmd_state = 1; + tape_pos_t target = m_tape_pos; + if (next_n_gap(target, 0x10000U - m_tach_reg, MIN_IRG_LENGTH)) { + LOG(("%u gaps @%d\n" , 0x10000U - m_tach_reg, target)); + m_tape_timer->adjust(time_to_target(target)); + } + return; + } else { + m_hole_timer->reset(); + } + break; + + case CMD_MOVE_INDTA: + if (m_cmd_state == 0) { + if (next_data(m_rd_it , m_tape_pos , true)) { + m_cmd_state = 1; + m_tape_timer->adjust(time_to_target(farthest_end(m_rd_it))); + } + // No IRQ + return; + } + // m_cmd_state == 1 -> IRQ & cmd end + break; + + case CMD_DELTA_MOVE_HOLE: + case CMD_DELTA_MOVE_IRG: + // Interrupt at end of movement + m_hole_timer->reset(); + break; + + case CMD_START_READ: + { + bool set_intr = true; + // Just to be sure.. + m_tape_pos = m_rw_pos; + if (m_cmd_state == 0) { + set_intr = false; + if (m_rd_it->second == PREAMBLE_WORD) { + m_cmd_state = 1; + } + LOG(("Got preamble\n")); + } else { + m_data_reg = m_rd_it->second; + m_checksum_reg += m_data_reg; + LOG(("RD %04x\n" , m_data_reg)); + } + adv_res_t res = adv_it(m_rd_it); + LOG(("adv_it %d\n" , res)); + if (res == ADV_NO_MORE_DATA) { + m_rd_it_valid = false; + } else { + if (res == ADV_DISCONT_DATA) { + // Hit a gap, restart preamble search + m_cmd_state = 0; + } + m_tape_timer->adjust(time_to_rd_next_word(m_rw_pos)); + } + if (!set_intr) { + return; + } + } + break; + + case CMD_END_READ: + { + m_tape_pos = m_rw_pos; + // Note: checksum is not updated + m_data_reg = m_rd_it->second; + LOG(("Final RD %04x\n" , m_data_reg)); + adv_res_t res = adv_it(m_rd_it); + if (res == ADV_NO_MORE_DATA) { + m_rd_it_valid = false; + } + m_hole_timer->reset(); + } + break; + default: // Other commands: just raise irq break; @@ -314,6 +491,46 @@ void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int para irq_w(true); break; + case HOLE_TMR_ID: + LOG(("Hole tmr @%g\n" , machine().time().as_double())); + + BIT_SET(m_status_reg , STATUS_HOLE_BIT); + + switch (CMD_CODE(m_cmd_reg)) { + case CMD_FINAL_GAP: + case CMD_WRITE_IRG: + write_gap(m_rw_pos , m_tape_pos); + m_rw_pos = m_tape_pos; + break; + + case CMD_SCAN_RECORDS: + case CMD_DELTA_MOVE_HOLE: + // Cmds 18 & 1c are terminated at first hole + m_tape_timer->reset(); + irq_w(true); + // No reloading of hole timer + return; + + case CMD_DELTA_MOVE_IRG: + // TODO: update r6 + m_hole_timer->adjust(time_to_next_hole()); + // No IRQ at holes + return; + + case CMD_START_READ: + case CMD_END_READ: + set_error(true); + break; + + default: + // Other cmds: default processing (update tape pos, set IRQ, schedule timer for next hole) + break; + } + + irq_w(true); + m_hole_timer->adjust(time_to_next_hole()); + break; + default: break; } @@ -335,62 +552,93 @@ void hp_taco_device::set_error(bool state) LOG(("error = %d\n" , state)); } -bool hp_taco_device::check_for_errors(void) +unsigned hp_taco_device::speed_to_tick_freq(void) const { - // Is it an error when "status" flag is already reporting an error? Dunno... - if ((m_status_reg & STATUS_ERR_MASK) != 0) { - set_error(true); + return m_tape_fast ? TACH_FREQ_FAST * TAPE_POS_FRACT : TACH_FREQ_SLOW * TAPE_POS_FRACT; +} + +bool hp_taco_device::pos_offset(tape_pos_t& pos , tape_pos_t offset) const +{ + if (offset == 0) { return true; - } else { + } + + if (!m_tape_fwd) { + offset = -offset; + } + + pos += offset; + + // In real life tape would unspool.. + if (pos > TAPE_LENGTH) { + pos = TAPE_LENGTH; return false; + } else if (pos < 0) { + pos = 0; + return false; + } else { + return true; } } -unsigned hp_taco_device::speed_to_tick_freq(bool fast) +void hp_taco_device::move_tape_pos(tape_pos_t delta_pos) { - return fast ? TACH_FREQ_FAST : TACH_FREQ_SLOW; + tape_pos_t tape_start_pos = m_tape_pos; + if (!pos_offset(m_tape_pos , delta_pos)) { + LOG(("Tape unspooled!\n")); + } + m_start_time = machine().time(); + LOG(("Tape pos = %u\n" , m_tape_pos)); + if (any_hole(tape_start_pos , m_tape_pos)) { + // Crossed one or more holes + BIT_SET(m_status_reg , STATUS_HOLE_BIT); + } } void hp_taco_device::update_tape_pos(void) { + if (m_start_time.is_never()) { + // Tape not moving + return; + } + attotime delta_time(machine().time() - m_start_time); - m_start_time = machine().time(); LOG(("delta_time = %g\n" , delta_time.as_double())); // How many tachometer ticks has the tape moved? - unsigned delta_tach = (unsigned)(delta_time.as_ticks(speed_to_tick_freq(SPEED_FAST(m_cmd_reg)))); + tape_pos_t delta_tach = (tape_pos_t)(delta_time.as_ticks(speed_to_tick_freq())); LOG(("delta_tach = %u\n" , delta_tach)); - if (DIR_FWD(m_cmd_reg)) { - // Forward - m_tape_pos += delta_tach; + move_tape_pos(delta_tach); - // In real life tape would unspool.. - if (m_tape_pos > TAPE_LENGTH) { - m_tape_pos = TAPE_LENGTH; - LOG(("Tape unspooled at the end!\n")); - } + // Gap detection + bool gap_detected = false; + if (m_gap_detect_start != NULL_TAPE_POS && abs(m_gap_detect_start - m_tape_pos) >= MIN_IRG_LENGTH) { + tape_pos_t tmp = m_tape_pos; + pos_offset(tmp , -MIN_IRG_LENGTH); + gap_detected = just_gap(tmp , m_tape_pos); + } + if (gap_detected) { + BIT_SET(m_status_reg, STATUS_GAP_BIT); } else { - // Reverse - if (delta_tach >= m_tape_pos) { - m_tape_pos = 0; - LOG(("Tape unspooled at the start!\n")); - } else { - m_tape_pos -= delta_tach; - } + BIT_CLR(m_status_reg, STATUS_GAP_BIT); } - LOG(("Tape pos = %u\n" , m_tape_pos)); } -// Is there any hole in a given section of tape? -bool hp_taco_device::any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b) +void hp_taco_device::ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b) { - if (tape_pos_a > tape_pos_b) { + if (a > b) { // Ensure A always comes before B tape_pos_t tmp; - tmp = tape_pos_a; - tape_pos_a = tape_pos_b; - tape_pos_b = tmp; + tmp = a; + a = b; + b = tmp; } +} + +// Is there any hole in a given section of tape? +bool hp_taco_device::any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b) +{ + ensure_a_lt_b(tape_pos_a , tape_pos_b); for (tape_pos_t hole : tape_holes) { if (tape_pos_a < hole && tape_pos_b >= hole) { @@ -402,9 +650,9 @@ bool hp_taco_device::any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b) } // Position of next hole tape will reach in a given direction -hp_taco_device::tape_pos_t hp_taco_device::next_hole(bool fwd) const +hp_taco_device::tape_pos_t hp_taco_device::next_hole(void) const { - if (fwd) { + if (m_tape_fwd) { for (tape_pos_t hole : tape_holes) { if (hole > m_tape_pos) { LOG(("next hole fwd @%u = %u\n" , m_tape_pos , hole)); @@ -425,92 +673,631 @@ hp_taco_device::tape_pos_t hp_taco_device::next_hole(bool fwd) const } } -attotime hp_taco_device::time_to_distance(tape_pos_t distance, bool fast) +hp_taco_device::tape_pos_t hp_taco_device::met_first(tape_pos_t a , tape_pos_t b , bool fwd , bool& is_a) +{ + if (fwd) { + if (a < b) { + is_a = true; + return a; + } else { + is_a = false; + return b; + } + } else { + if (a >= b) { + is_a = true; + return a; + } else { + is_a = false; + return b; + } + } +} + +attotime hp_taco_device::time_to_distance(tape_pos_t distance) const { // +1 for rounding - return attotime::from_ticks(distance + 1 , speed_to_tick_freq(fast)); + return attotime::from_ticks(distance + 1 , speed_to_tick_freq()); } -attotime hp_taco_device::time_to_target(tape_pos_t target, bool fast) const +attotime hp_taco_device::time_to_target(tape_pos_t target) const { - return time_to_distance(abs(target - m_tape_pos), fast); + return time_to_distance(abs(target - m_tape_pos)); } -void hp_taco_device::start_tape(void) +bool hp_taco_device::start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0) { - m_start_time = machine().time(); - BIT_CLR(m_status_reg, STATUS_HOLE_BIT); + m_cmd_reg = cmd_reg; + + UINT16 to_be_tested = (m_cmd_reg & CMD_REG_MASK) | (m_status_reg & STATUS_REG_MASK); + // Bits in STATUS_ERR_MASK must always be 0 + must_be_0 |= STATUS_ERR_MASK; + + // It's not an error if the error state is already set (sts false) + if (((to_be_tested & (must_be_1 | must_be_0)) ^ must_be_1) != 0) { + set_error(true); + return false; + } else { + bool prev_tape_wr = m_tape_wr; + bool prev_tape_fwd = m_tape_fwd; + bool prev_tape_fast = m_tape_fast; + bool not_moving = m_start_time.is_never(); + + m_start_time = machine().time(); + m_tape_wr = (must_be_0 & STATUS_WPR_MASK) != 0; + m_tape_fwd = DIR_FWD(m_cmd_reg); + m_tape_fast = SPEED_FAST(m_cmd_reg); + // TODO: remove? + BIT_CLR(m_status_reg, STATUS_HOLE_BIT); + + if (m_tape_wr) { + // Write command: disable gap detector + m_gap_detect_start = NULL_TAPE_POS; + BIT_CLR(m_status_reg, STATUS_GAP_BIT); + } else if (not_moving || prev_tape_wr != m_tape_wr || prev_tape_fwd != m_tape_fwd || prev_tape_fast != m_tape_fast) { + // Tape started right now, switched from writing to reading, direction changed or speed changed: (re)start gap detector + m_gap_detect_start = m_tape_pos; + BIT_CLR(m_status_reg, STATUS_GAP_BIT); + } + return true; + } } void hp_taco_device::stop_tape(void) { - if (!m_start_time.is_never()) { - tape_pos_t tape_start_pos = m_tape_pos; - update_tape_pos(); - if (any_hole(tape_start_pos , m_tape_pos)) { - // Crossed one or more holes - BIT_SET(m_status_reg , STATUS_HOLE_BIT); + m_start_time = attotime::never; + m_gap_detect_start = NULL_TAPE_POS; +} + +hp_taco_device::tape_track_t& hp_taco_device::current_track(void) +{ + return m_tracks[ BIT(m_status_reg , STATUS_TRACKB_BIT) ]; +} + +// Return physical length of a 16-bit word on tape +hp_taco_device::tape_pos_t hp_taco_device::word_length(tape_word_t w) +{ + unsigned zeros , ones; + + // pop count of w + ones = (w & 0x5555) + ((w >> 1) & 0x5555); + ones = (ones & 0x3333) + ((ones >> 2) & 0x3333); + ones = (ones & 0x0f0f) + ((ones >> 4) & 0x0f0f); + ones = (ones & 0x00ff) + ((ones >> 8) & 0x00ff); + + zeros = 16 - ones; + + // Physical encoding of words is borrowed from 9825 as I wasn't able + // to gather any info on the actual encoding of TACO chips. + // This should be enough for emulation. + // Anyway, this is how 9825 encodes words on tape: + // - the unit of encoding are 16-bit words + // - each word is encoded from MSB to LSB + // - each word has an extra "1" encoded at the end + // - a 0 is encoded with a distance between flux reversals of 1/35200 s + // - a 1 is encoded with a distance that's 1.75 times that of a 0 + return zeros * ZERO_BIT_LEN + (ones + 1) * ONE_BIT_LEN; +} + +hp_taco_device::tape_pos_t hp_taco_device::word_end_pos(const tape_track_t::iterator& it) +{ + return it->first + word_length(it->second); +} + +void hp_taco_device::adjust_it(tape_track_t& track , tape_track_t::iterator& it , tape_pos_t pos) +{ + if (it != track.begin()) { + it--; + if (word_end_pos(it) <= pos) { + it++; } - m_start_time = attotime::never; } - m_tape_timer->reset(); +} + +// Write a word on current tape track +void hp_taco_device::write_word(tape_pos_t start , tape_word_t word , tape_pos_t& length) +{ + tape_track_t& track = current_track(); + tape_track_t::iterator it_low = track.lower_bound(start); + adjust_it(track , it_low , start); + length = word_length(word); + tape_pos_t end_pos = start + length; + tape_track_t::iterator it_high = track.lower_bound(end_pos); + + track.erase(it_low , it_high); + + track.insert(it_high , std::make_pair(start, word)); + LOG(("WR %04x @ T%u:%u\n" , word , BIT(m_status_reg , STATUS_TRACKB_BIT) , start)); +} + +// Write a gap on current track +void hp_taco_device::write_gap(tape_pos_t a , tape_pos_t b) +{ + ensure_a_lt_b(a , b); + tape_track_t& track = current_track(); + tape_track_t::iterator it_low = track.lower_bound(a); + adjust_it(track , it_low , a); + tape_track_t::iterator it_high = track.lower_bound(b); + + track.erase(it_low, it_high); + + LOG(("GAP on T%u:[%u,%u)\n" , BIT(m_status_reg , STATUS_TRACKB_BIT) , a , b)); +} + +bool hp_taco_device::just_gap(tape_pos_t a , tape_pos_t b) +{ + ensure_a_lt_b(a , b); + tape_track_t& track = current_track(); + tape_track_t::iterator it_low = track.lower_bound(a); + tape_track_t::iterator it_high = track.lower_bound(b); + + adjust_it(track, it_low, a); + + return it_low == it_high; +} + +hp_taco_device::tape_pos_t hp_taco_device::farthest_end(const tape_track_t::iterator& it) const +{ + if (m_tape_fwd) { + return word_end_pos(it); + } else { + return it->first; + } +} + +bool hp_taco_device::next_data(tape_track_t::iterator& it , tape_pos_t pos , bool inclusive) +{ + tape_track_t& track = current_track(); + it = track.lower_bound(pos); + if (m_tape_fwd) { + if (inclusive) { + adjust_it(track, it, pos); + } + return it != track.end(); + } else { + // Never more than 2 iterations + do { + if (it == track.begin()) { + it = track.end(); + return false; + } + it--; + } while (!inclusive && word_end_pos(it) > pos); + return true; + } +} + +hp_taco_device::adv_res_t hp_taco_device::adv_it(tape_track_t::iterator& it) +{ + tape_track_t& track = current_track(); + if (m_tape_fwd) { + tape_pos_t prev_pos = word_end_pos(it); + it++; + if (it == track.end()) { + return ADV_NO_MORE_DATA; + } else { + adv_res_t res = prev_pos == it->first ? ADV_CONT_DATA : ADV_DISCONT_DATA; + return res; + } + } else { + if (it == track.begin()) { + it = track.end(); + return ADV_NO_MORE_DATA; + } else { + tape_pos_t prev_pos = it->first; + it--; + return prev_pos == word_end_pos(it) ? ADV_CONT_DATA : ADV_DISCONT_DATA; + } + } +} + +attotime hp_taco_device::fetch_next_wr_word(void) +{ + if (m_data_reg_full) { + m_next_word = m_data_reg; + m_data_reg_full = false; + LOG(("next %04x (DR)\n" , m_next_word)); + } else { + // When data register is empty, write checksum word + m_next_word = m_checksum_reg; + LOG(("next %04x (CS)\n" , m_next_word)); + } + // Update checksum with new word + m_checksum_reg += m_next_word; + + return time_to_distance(word_length(m_next_word)); +} + +attotime hp_taco_device::time_to_rd_next_word(tape_pos_t& word_rd_pos) +{ + if (m_rd_it_valid) { + word_rd_pos = farthest_end(m_rd_it); + return time_to_target(word_rd_pos); + } else { + return attotime::never; + } +} + +/** + * Scan for next "n_gaps" gaps + * + * @param[in,out] pos Start position on input, start of gap on output + * @param it Pointer to data word where scan is to start + * @param n_gaps Number of gaps to scan + * @param min_gap Minimum gap size + * + * @return true if n_gaps gaps are found + */ +bool hp_taco_device::next_n_gap(tape_pos_t& pos , tape_track_t::iterator it , unsigned n_gaps , tape_pos_t min_gap) +{ + tape_track_t& track = current_track(); + bool done = false; + tape_track_t::iterator prev_it; + + if (m_tape_fwd) { + tape_pos_t next_pos; + + while (1) { + if (it == track.end()) { + next_pos = TAPE_LENGTH; + done = true; + } else { + next_pos = it->first; + } + if (((next_pos - pos) >= min_gap && --n_gaps == 0) || done) { + break; + } + adv_res_t adv_res; + do { + prev_it = it; + adv_res = adv_it(it); + } while (adv_res == ADV_CONT_DATA); + pos = word_end_pos(prev_it); + } + } else { + tape_pos_t next_pos; + + while (1) { + if (it == track.end()) { + next_pos = 0; + done = true; + } else { + next_pos = word_end_pos(it); + } + if (((pos - next_pos) >= min_gap && --n_gaps == 0) || done) { + break; + } + adv_res_t adv_res; + do { + prev_it = it; + adv_res = adv_it(it); + } while (adv_res == ADV_CONT_DATA); + pos = prev_it->first; + } + } + + // Set "pos" where minimum gap size is met + pos_offset(pos , min_gap); + + return n_gaps == 0; +} + +bool hp_taco_device::next_n_gap(tape_pos_t& pos , unsigned n_gaps , tape_pos_t min_gap) +{ + tape_track_t::iterator it; + // First align with next data + next_data(it, pos, true); + // Then scan for n_gaps + return next_n_gap(pos, it, n_gaps, min_gap); +} + +void hp_taco_device::dump_sequence(FILE *out , tape_track_t::const_iterator it_start , unsigned n_words) +{ + if (n_words) { + UINT32 tmp32; + UINT16 tmp16; + + tmp32 = n_words; + fwrite(&tmp32 , sizeof(tmp32) , 1 , out); + tmp32 = it_start->first; + fwrite(&tmp32 , sizeof(tmp32) , 1 , out); + + for (unsigned i = 0; i < n_words; i++) { + tmp16 = it_start->second; + fwrite(&tmp16 , sizeof(tmp16) , 1 , out); + it_start++; + } + } +} + +void hp_taco_device::save_tape(FILE *out) const +{ + UINT32 tmp32; + + for (unsigned track_n = 0; track_n < 2; track_n++) { + const tape_track_t& track = m_tracks[ track_n ]; + tape_pos_t next_pos = (tape_pos_t)-1; + unsigned n_words = 0; + tape_track_t::const_iterator it_start; + for (tape_track_t::const_iterator it = track.cbegin(); it != track.cend(); it++) { + if (it->first != next_pos) { + dump_sequence(out , it_start , n_words); + it_start = it; + n_words = 0; + } + next_pos = it->first + word_length(it->second); + n_words++; + } + dump_sequence(out , it_start , n_words); + // End of track + tmp32 = (UINT32)-1; + fwrite(&tmp32 , sizeof(tmp32) , 1 , out); + } +} + +bool hp_taco_device::load_track(FILE *in , tape_track_t& track) +{ + UINT32 tmp32; + + track.clear(); + + while (1) { + if (fread(&tmp32 , sizeof(tmp32) , 1 , in) != 1) { + return false; + } + + if (tmp32 == (UINT32)-1) { + return true; + } + + unsigned n_words = tmp32; + + if (fread(&tmp32 , sizeof(tmp32) , 1 , in) != 1) { + return false; + } + + tape_pos_t pos = (tape_pos_t)tmp32; + + for (unsigned i = 0; i < n_words; i++) { + UINT16 tmp16; + + if (fread(&tmp16 , sizeof(tmp16) , 1 , in) != 1) { + return false; + } + + // TODO: usare end() come hint + track.insert(std::make_pair(pos , tmp16)); + pos += word_length(tmp16); + } + } +} + +void hp_taco_device::load_tape(FILE *in) +{ + for (unsigned track_n = 0; track_n < 2; track_n++) { + if (!load_track(in , m_tracks[ track_n ])) { + LOG(("load_tape failed")); + for (track_n = 0; track_n < 2; track_n++) { + m_tracks[ track_n ].clear(); + } + break; + } + } + LOG(("load_tape done\n")); +} + +attotime hp_taco_device::time_to_next_hole(void) const +{ + return time_to_target(next_hole()); +} + +attotime hp_taco_device::time_to_tach_pulses(void) const +{ + return time_to_distance((tape_pos_t)(0x10000U - m_tach_reg) * TAPE_POS_FRACT); } void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg) { LOG(("Cmd = %02x\n" , CMD_CODE(new_cmd_reg))); + update_tape_pos(); + attotime cmd_duration = attotime::never; + attotime time_to_hole = attotime::never; + + unsigned new_cmd_code = CMD_CODE(new_cmd_reg); - // Should irq be raised anyway when already in error condition? Here we do nothing. + if (new_cmd_code != CMD_START_READ && + new_cmd_code != CMD_END_READ && + new_cmd_code != CMD_CLEAR) { + m_rd_it_valid = false; + } + + switch (new_cmd_code) { + case CMD_INDTA_INGAP: + // Errors: CART OUT,FAST SPEED + if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) { + m_cmd_state = 0; + if (next_data(m_rd_it , m_tape_pos , true)) { + cmd_duration = time_to_target(farthest_end(m_rd_it)); + } + } + break; + + case CMD_FINAL_GAP: + // Errors: WP,CART OUT + if (start_tape_cmd(new_cmd_reg , 0 , STATUS_WPR_MASK)) { + m_rw_pos = m_tape_pos; + cmd_duration = time_to_distance(END_GAP_LENGTH); + time_to_hole = time_to_next_hole(); + } + break; - switch (CMD_CODE(new_cmd_reg)) { case CMD_CLEAR: set_error(false); BIT_CLR(m_status_reg, STATUS_HOLE_BIT); // This is a special command: it doesn't raise IRQ at completion and it - // doesn't replace the current command, if any. + // doesn't replace current command return; + case CMD_NOT_INDTA: + // Errors: CART OUT,FAST SPEED + if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) { + tape_pos_t target = m_tape_pos; + if (next_n_gap(target, 1, NO_DATA_GAP)) { + LOG(("End of data @%d\n" , target)); + cmd_duration = time_to_target(target); + } + // Holes detected? + } + break; + + case CMD_INIT_WRITE: + // Errors: WP,CART OUT,fast speed,reverse + if (start_tape_cmd(new_cmd_reg , DIR_FWD_MASK , STATUS_WPR_MASK | SPEED_FAST_MASK)) { + m_next_word = PREAMBLE_WORD; + m_rw_pos = m_tape_pos; + cmd_duration = time_to_distance(word_length(m_next_word)); + } + break; + case CMD_STOP: - stop_tape(); - cmd_duration = attotime::from_usec(QUICK_CMD_USEC); + if (CMD_CODE(m_cmd_reg) != CMD_STOP) { + if (m_start_time.is_never()) { + // Tape is already stopped + cmd_duration = attotime::from_usec(QUICK_CMD_USEC); + } else { + // Start braking timer + cmd_duration = attotime::from_msec(m_tape_fast ? FAST_BRAKE_MSEC : SLOW_BRAKE_MSEC); + } + m_cmd_reg = new_cmd_reg; + } else { + // TODO: check if ok + return; + } break; case CMD_SET_TRACK: - if (!check_for_errors()) { - if (CMD_OPT(new_cmd_reg)) { - BIT_SET(m_status_reg, STATUS_TRACKB_BIT); - } else { - BIT_CLR(m_status_reg, STATUS_TRACKB_BIT); + // Don't know if this command really starts the tape or not (probably it doesn't) + if (start_tape_cmd(new_cmd_reg , 0 , 0)) { + // When b9 is 0, set track A/B + // When b9 is 1, ignore command (in TACO chip it has an unknown purpose) + if (!UNKNOWN_B9(new_cmd_reg)) { + if (CMD_OPT(new_cmd_reg)) { + BIT_SET(m_status_reg, STATUS_TRACKB_BIT); + } else { + BIT_CLR(m_status_reg, STATUS_TRACKB_BIT); + } } cmd_duration = attotime::from_usec(QUICK_CMD_USEC); } break; case CMD_MOVE: - stop_tape(); - if (!check_for_errors()) { - start_tape(); - cmd_duration = time_to_target(next_hole(DIR_FWD(new_cmd_reg)) , SPEED_FAST(new_cmd_reg)); + if (start_tape_cmd(new_cmd_reg , 0 , 0)) { + time_to_hole = time_to_next_hole(); + } + break; + + case CMD_INGAP_MOVE: + // Errors: CART OUT,FAST SPEED + if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) { + m_cmd_state = 0; + tape_pos_t target = m_tape_pos; + if (next_n_gap(target, 1, MIN_IRG_LENGTH)) { + LOG(("IRG @%d\n" , target)); + cmd_duration = time_to_target(target); + } + // Holes detected? + } + break; + + case CMD_WRITE_IRG: + // Errors: WP,CART OUT + if (start_tape_cmd(new_cmd_reg , 0 , STATUS_WPR_MASK)) { + m_rw_pos = m_tape_pos; + cmd_duration = time_to_tach_pulses(); + time_to_hole = time_to_next_hole(); + } + break; + + case CMD_SCAN_RECORDS: + // Errors: CART OUT + if (start_tape_cmd(new_cmd_reg , 0 , 0)) { + m_cmd_state = 0; + if (next_data(m_rd_it , m_tape_pos , true)) { + cmd_duration = time_to_target(farthest_end(m_rd_it)); + } + time_to_hole = time_to_next_hole(); + } + break; + + case CMD_RECORD_WRITE: + // Errors: WP,CART OUT,fast speed,reverse + if (start_tape_cmd(new_cmd_reg , DIR_FWD_MASK , STATUS_WPR_MASK | SPEED_FAST_MASK)) { + // Search for preamble first + m_cmd_state = 0; + m_rd_it_valid = next_data(m_rd_it , m_tape_pos , false); + cmd_duration = time_to_rd_next_word(m_rw_pos); + // Holes detected? } break; - case CMD_DELTA_MOVE_REC: + case CMD_MOVE_INDTA: + // Errors: CART OUT,FAST SPEED + if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) { + m_cmd_state = 0; + cmd_duration = time_to_tach_pulses(); + // Holes detected? + } + break; + + case CMD_UNK_1b: + if (start_tape_cmd(new_cmd_reg , 0 , 0)) { + // Unknown purpose, but make it a NOP (it's used in "T" test of test ROM) + cmd_duration = attotime::from_usec(QUICK_CMD_USEC); + } + break; + + case CMD_DELTA_MOVE_HOLE: case CMD_DELTA_MOVE_IRG: - // TODO: record/irg detection - stop_tape(); - if (!check_for_errors()) { - start_tape(); - cmd_duration = time_to_distance(0x10000U - m_tach_reg , SPEED_FAST(new_cmd_reg)); + if (start_tape_cmd(new_cmd_reg , 0 , 0)) { + cmd_duration = time_to_tach_pulses(); + time_to_hole = time_to_next_hole(); + } + break; + + case CMD_START_READ: + // Yes, you can read tape backwards: test "C" does that! + // Because of this DIR_FWD_MASK is not in the "must be 1" mask. + if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) { + // TODO: check anche m_rw_pos sforato + if (!m_rd_it_valid) { + // Search for preamble first + m_cmd_state = 0; + m_rd_it_valid = next_data(m_rd_it , m_tape_pos , false); + } + + cmd_duration = time_to_rd_next_word(m_rw_pos); + time_to_hole = time_to_next_hole(); + } + break; + + case CMD_END_READ: + // This command only makes sense after CMD_START_READ + if (CMD_CODE(m_cmd_reg) == CMD_START_READ && m_cmd_state == 1 && + start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) { + LOG(("END_READ %d\n" , m_rd_it_valid)); + cmd_duration = time_to_rd_next_word(m_rw_pos); + time_to_hole = time_to_next_hole(); } break; default: LOG(("Unrecognized command\n")); - return; + break; } m_tape_timer->adjust(cmd_duration); - m_cmd_reg = new_cmd_reg; + m_hole_timer->adjust(time_to_hole); } diff --git a/src/devices/machine/hp_taco.h b/src/devices/machine/hp_taco.h index e279d045d10..a08b0c59ded 100644 --- a/src/devices/machine/hp_taco.h +++ b/src/devices/machine/hp_taco.h @@ -11,6 +11,8 @@ #ifndef __HP_TACO_H__ #define __HP_TACO_H__ +#include + #define MCFG_TACO_IRQ_HANDLER(_devcb) \ devcb = &hp_taco_device::set_irq_handler(*device , DEVCB_##_devcb); @@ -23,15 +25,15 @@ class hp_taco_device : public device_t { public: - // construction/destruction - hp_taco_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname); - hp_taco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + // construction/destruction + hp_taco_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname); + hp_taco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); // static configuration helpers - template static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast(device).m_irq_handler.set_callback(object); } - template static devcb_base &set_flg_handler(device_t &device, _Object object) { return downcast(device).m_flg_handler.set_callback(object); } - template static devcb_base &set_sts_handler(device_t &device, _Object object) { return downcast(device).m_sts_handler.set_callback(object); } - + template static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast(device).m_irq_handler.set_callback(object); } + template static devcb_base &set_flg_handler(device_t &device, _Object object) { return downcast(device).m_flg_handler.set_callback(object); } + template static devcb_base &set_sts_handler(device_t &device, _Object object) { return downcast(device).m_sts_handler.set_callback(object); } + // Register read/write DECLARE_WRITE16_MEMBER(reg_w); DECLARE_READ16_MEMBER(reg_r); @@ -40,21 +42,30 @@ public: DECLARE_READ_LINE_MEMBER(flg_r); DECLARE_READ_LINE_MEMBER(sts_r); - typedef UINT32 tape_pos_t; + // Tape position, 1 unit = 1 inch / (968 * 1024) + typedef INT32 tape_pos_t; + + // Words stored on tape + typedef UINT16 tape_word_t; protected: - // device-level overrides - virtual void device_start() override; - virtual void device_reset() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - + // device-level overrides + virtual void device_start() override; + virtual void device_stop() override; + virtual void device_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + private: + // Storage of tracks: mapping from a tape position to word stored there + typedef std::map tape_track_t; + devcb_write_line m_irq_handler; devcb_write_line m_flg_handler; devcb_write_line m_sts_handler; // Registers UINT16 m_data_reg; + bool m_data_reg_full; UINT16 m_cmd_reg; UINT16 m_status_reg; UINT16 m_tach_reg; @@ -65,25 +76,72 @@ private: bool m_irq; bool m_flg; bool m_sts; + UINT8 m_cmd_state; - // Tape position + // Tape position & motion tape_pos_t m_tape_pos; - attotime m_start_time; + attotime m_start_time; // Tape moving if != never + bool m_tape_fwd; + bool m_tape_fast; // Timers emu_timer *m_tape_timer; + emu_timer *m_hole_timer; + + // Content of tape tracks + tape_track_t m_tracks[ 2 ]; + + // Reading & writing + bool m_tape_wr; + tape_pos_t m_rw_pos; + UINT16 m_next_word; + tape_track_t::iterator m_rd_it; + bool m_rd_it_valid; + + // Gap detection + tape_pos_t m_gap_detect_start; + + typedef enum { + ADV_NO_MORE_DATA, + ADV_CONT_DATA, + ADV_DISCONT_DATA + } adv_res_t; void irq_w(bool state); void set_error(bool state); - bool check_for_errors(void); - static unsigned speed_to_tick_freq(bool fast); + unsigned speed_to_tick_freq(void) const; + bool pos_offset(tape_pos_t& pos , tape_pos_t offset) const; + void move_tape_pos(tape_pos_t delta_pos); void update_tape_pos(void); - static bool any_hole(UINT32 tape_pos_a , UINT32 tape_pos_b); - UINT32 next_hole(bool fwd) const; - static attotime time_to_distance(UINT32 distance, bool fast); - attotime time_to_target(UINT32 target, bool fast) const; - void start_tape(void); + static void ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b); + static bool any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b); + tape_pos_t next_hole(void) const; + static tape_pos_t met_first(tape_pos_t a , tape_pos_t b , bool fwd , bool& is_a); + attotime time_to_distance(tape_pos_t distance) const; + attotime time_to_target(tape_pos_t target) const; + bool start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0); + void start_tape(UINT16 cmd_reg); void stop_tape(void); + tape_track_t& current_track(void); + static tape_pos_t word_length(tape_word_t w); + static tape_pos_t word_end_pos(const tape_track_t::iterator& it); + static void adjust_it(tape_track_t& track , tape_track_t::iterator& it , tape_pos_t pos); + void write_word(tape_pos_t start , tape_word_t word , tape_pos_t& length); + void write_gap(tape_pos_t a , tape_pos_t b); + bool just_gap(tape_pos_t a , tape_pos_t b); + tape_pos_t farthest_end(const tape_track_t::iterator& it) const; + bool next_data(tape_track_t::iterator& it , tape_pos_t pos , bool inclusive); + adv_res_t adv_it(tape_track_t::iterator& it); + attotime fetch_next_wr_word(void); + attotime time_to_rd_next_word(tape_pos_t& word_rd_pos); + bool next_n_gap(tape_pos_t& pos , tape_track_t::iterator it , unsigned n_gaps , tape_pos_t min_gap); + bool next_n_gap(tape_pos_t& pos , unsigned n_gaps , tape_pos_t min_gap); + static void dump_sequence(FILE *out , tape_track_t::const_iterator it_start , unsigned n_words); + void save_tape(FILE *out) const; + bool load_track(FILE *in , tape_track_t& track); + void load_tape(FILE *in); + attotime time_to_next_hole(void) const; + attotime time_to_tach_pulses(void) const; void start_cmd_exec(UINT16 new_cmd_reg); }; -- cgit v1.2.3-70-g09d2 From a5b0e6cedea2f2346c0273c0dff471b3e4a34b71 Mon Sep 17 00:00:00 2001 From: fulivi Date: Mon, 15 Feb 2016 14:45:46 +0100 Subject: hp9845: first step in making TACO an image device, so far so good --- src/devices/machine/hp_taco.cpp | 224 ++++++++++++++++++++++++++++------------ src/devices/machine/hp_taco.h | 28 ++++- 2 files changed, 183 insertions(+), 69 deletions(-) diff --git a/src/devices/machine/hp_taco.cpp b/src/devices/machine/hp_taco.cpp index 388cd1acdfe..3f316e05b96 100644 --- a/src/devices/machine/hp_taco.cpp +++ b/src/devices/machine/hp_taco.cpp @@ -36,6 +36,8 @@ // Debugging #define VERBOSE 1 #define LOG(x) do { if (VERBOSE) logerror x; } while (0) +#define VERBOSE_0 0 +#define LOG_0(x) do { if (VERBOSE_0) logerror x; } while (0) // Macros to clear/set single bits #define BIT_MASK(n) (1U << (n)) @@ -70,6 +72,7 @@ enum { #define MIN_IRG_LENGTH ((tape_pos_t)(0.2 * ONE_INCH_POS)) // Minimum length of IRGs: 0.2" (from 9825, not sure about value in TACO) #define NULL_TAPE_POS ((tape_pos_t)-1) // Special value for invalid/unknown tape position #define NO_DATA_GAP (17 * ONE_BIT_LEN) // Minimum gap size to detect end of data: length of longest word (0xffff) +#define FILE_MAGIC 0x4f434154 // Magic value at start of image file: "TACO" // Parts of command register #define CMD_CODE(reg) \ @@ -164,6 +167,7 @@ const device_type HP_TACO = &device_creator; // Constructors hp_taco_device::hp_taco_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname) : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), + device_image_interface(mconfig , *this), m_irq_handler(*this), m_flg_handler(*this), m_sts_handler(*this), @@ -180,6 +184,7 @@ hp_taco_device::hp_taco_device(const machine_config &mconfig, device_type type, hp_taco_device::hp_taco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, HP_TACO, "HP TACO", tag, owner, clock, "TACO", __FILE__), + device_image_interface(mconfig , *this), m_irq_handler(*this), m_flg_handler(*this), m_sts_handler(*this), @@ -196,7 +201,7 @@ hp_taco_device::hp_taco_device(const machine_config &mconfig, const char *tag, d WRITE16_MEMBER(hp_taco_device::reg_w) { - LOG(("wr R%u = %04x\n", 4 + offset , data)); + LOG_0(("wr R%u = %04x\n", 4 + offset , data)); // Any I/O activity clears IRQ irq_w(false); @@ -255,7 +260,7 @@ READ16_MEMBER(hp_taco_device::reg_r) break; } - LOG(("rd R%u = %04x\n", 4 + offset , res)); + LOG_0(("rd R%u = %04x\n", 4 + offset , res)); return res; } @@ -270,9 +275,17 @@ READ_LINE_MEMBER(hp_taco_device::sts_r) return m_sts; } +// device_config_complete +void hp_taco_device::device_config_complete() +{ + LOG(("device_config_complete")); + update_names(); +} + // device_start void hp_taco_device::device_start() { + LOG(("device_start")); m_irq_handler.resolve_safe(); m_flg_handler.resolve_safe(); m_sts_handler.resolve_safe(); @@ -292,31 +305,26 @@ void hp_taco_device::device_start() save_item(NAME(m_start_time)); save_item(NAME(m_tape_fwd)); save_item(NAME(m_tape_fast)); + save_item(NAME(m_image_dirty)); + save_item(NAME(m_tape_wr)); + save_item(NAME(m_rw_pos)); + save_item(NAME(m_next_word)); + save_item(NAME(m_rd_it_valid)); + save_item(NAME(m_gap_detect_start)); m_tape_timer = timer_alloc(TAPE_TMR_ID); m_hole_timer = timer_alloc(HOLE_TMR_ID); - - FILE *in = fopen("tape_dump.bin" , "rb"); - if (in != NULL) { - load_tape(in); - fclose(in); - } } // device_stop void hp_taco_device::device_stop() { - LOG(("**device_stop**\n")); - FILE *out = fopen("tape_dump.bin" , "wb"); - if (out != NULL) { - save_tape(out); - fclose(out); - } } // device_reset void hp_taco_device::device_reset() { + LOG(("device_reset")); m_data_reg = 0; m_data_reg_full = false; m_cmd_reg = 0; @@ -324,7 +332,15 @@ void hp_taco_device::device_reset() m_tach_reg = 0; m_checksum_reg = 0; m_timing_reg = 0; + m_cmd_state = 0; + // m_tape_pos is not reset, tape stays where it is m_start_time = attotime::never; + m_tape_fwd = false; + m_tape_fast = false; + m_image_dirty = false; + m_tape_wr = false; + m_rw_pos = 0; + m_next_word = 0; m_rd_it_valid = false; m_gap_detect_start = NULL_TAPE_POS; @@ -344,7 +360,7 @@ void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int para switch (id) { case TAPE_TMR_ID: - LOG(("Tape tmr @%g\n" , machine().time().as_double())); + LOG_0(("Tape tmr @%g\n" , machine().time().as_double())); tape_pos_t length; @@ -363,7 +379,7 @@ void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int para case CMD_RECORD_WRITE: if (m_cmd_state == 0) { if (m_rd_it->second == PREAMBLE_WORD) { - LOG(("Got preamble\n")); + LOG_0(("Got preamble\n")); m_cmd_state = 1; // m_rw_pos already at correct position m_tape_timer->adjust(fetch_next_wr_word()); @@ -410,7 +426,7 @@ void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int para m_cmd_state = 1; tape_pos_t target = m_tape_pos; if (next_n_gap(target, 0x10000U - m_tach_reg, MIN_IRG_LENGTH)) { - LOG(("%u gaps @%d\n" , 0x10000U - m_tach_reg, target)); + LOG_0(("%u gaps @%d\n" , 0x10000U - m_tach_reg, target)); m_tape_timer->adjust(time_to_target(target)); } return; @@ -447,14 +463,14 @@ void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int para if (m_rd_it->second == PREAMBLE_WORD) { m_cmd_state = 1; } - LOG(("Got preamble\n")); + LOG_0(("Got preamble\n")); } else { m_data_reg = m_rd_it->second; m_checksum_reg += m_data_reg; - LOG(("RD %04x\n" , m_data_reg)); + LOG_0(("RD %04x\n" , m_data_reg)); } adv_res_t res = adv_it(m_rd_it); - LOG(("adv_it %d\n" , res)); + LOG_0(("adv_it %d\n" , res)); if (res == ADV_NO_MORE_DATA) { m_rd_it_valid = false; } else { @@ -475,7 +491,7 @@ void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int para m_tape_pos = m_rw_pos; // Note: checksum is not updated m_data_reg = m_rd_it->second; - LOG(("Final RD %04x\n" , m_data_reg)); + LOG_0(("Final RD %04x\n" , m_data_reg)); adv_res_t res = adv_it(m_rd_it); if (res == ADV_NO_MORE_DATA) { m_rd_it_valid = false; @@ -492,7 +508,7 @@ void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int para break; case HOLE_TMR_ID: - LOG(("Hole tmr @%g\n" , machine().time().as_double())); + LOG_0(("Hole tmr @%g\n" , machine().time().as_double())); BIT_SET(m_status_reg , STATUS_HOLE_BIT); @@ -541,7 +557,7 @@ void hp_taco_device::irq_w(bool state) if (state != m_irq) { m_irq = state; m_irq_handler(state); - LOG(("IRQ = %d\n" , state)); + LOG_0(("IRQ = %d\n" , state)); } } @@ -549,7 +565,7 @@ void hp_taco_device::set_error(bool state) { m_sts = !state; m_sts_handler(m_sts); - LOG(("error = %d\n" , state)); + LOG_0(("error = %d\n" , state)); } unsigned hp_taco_device::speed_to_tick_freq(void) const @@ -588,7 +604,7 @@ void hp_taco_device::move_tape_pos(tape_pos_t delta_pos) LOG(("Tape unspooled!\n")); } m_start_time = machine().time(); - LOG(("Tape pos = %u\n" , m_tape_pos)); + LOG_0(("Tape pos = %u\n" , m_tape_pos)); if (any_hole(tape_start_pos , m_tape_pos)) { // Crossed one or more holes BIT_SET(m_status_reg , STATUS_HOLE_BIT); @@ -603,10 +619,10 @@ void hp_taco_device::update_tape_pos(void) } attotime delta_time(machine().time() - m_start_time); - LOG(("delta_time = %g\n" , delta_time.as_double())); + LOG_0(("delta_time = %g\n" , delta_time.as_double())); // How many tachometer ticks has the tape moved? tape_pos_t delta_tach = (tape_pos_t)(delta_time.as_ticks(speed_to_tick_freq())); - LOG(("delta_tach = %u\n" , delta_tach)); + LOG_0(("delta_tach = %u\n" , delta_tach)); move_tape_pos(delta_tach); @@ -655,7 +671,7 @@ hp_taco_device::tape_pos_t hp_taco_device::next_hole(void) const if (m_tape_fwd) { for (tape_pos_t hole : tape_holes) { if (hole > m_tape_pos) { - LOG(("next hole fwd @%u = %u\n" , m_tape_pos , hole)); + LOG_0(("next hole fwd @%u = %u\n" , m_tape_pos , hole)); return hole; } } @@ -664,7 +680,7 @@ hp_taco_device::tape_pos_t hp_taco_device::next_hole(void) const } else { for (int i = (sizeof(tape_holes) / sizeof(tape_holes[ 0 ])) - 1; i >= 0; i--) { if (tape_holes[ i ] < m_tape_pos) { - LOG(("next hole rev @%u = %u\n" , m_tape_pos , tape_holes[ i ])); + LOG_0(("next hole rev @%u = %u\n" , m_tape_pos , tape_holes[ i ])); return tape_holes[ i ]; } } @@ -734,6 +750,7 @@ bool hp_taco_device::start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 m // Write command: disable gap detector m_gap_detect_start = NULL_TAPE_POS; BIT_CLR(m_status_reg, STATUS_GAP_BIT); + m_image_dirty = true; } else if (not_moving || prev_tape_wr != m_tape_wr || prev_tape_fwd != m_tape_fwd || prev_tape_fast != m_tape_fast) { // Tape started right now, switched from writing to reading, direction changed or speed changed: (re)start gap detector m_gap_detect_start = m_tape_pos; @@ -807,7 +824,7 @@ void hp_taco_device::write_word(tape_pos_t start , tape_word_t word , tape_pos_t track.erase(it_low , it_high); track.insert(it_high , std::make_pair(start, word)); - LOG(("WR %04x @ T%u:%u\n" , word , BIT(m_status_reg , STATUS_TRACKB_BIT) , start)); + LOG_0(("WR %04x @ T%u:%u\n" , word , BIT(m_status_reg , STATUS_TRACKB_BIT) , start)); } // Write a gap on current track @@ -821,7 +838,7 @@ void hp_taco_device::write_gap(tape_pos_t a , tape_pos_t b) track.erase(it_low, it_high); - LOG(("GAP on T%u:[%u,%u)\n" , BIT(m_status_reg , STATUS_TRACKB_BIT) , a , b)); + LOG_0(("GAP on T%u:[%u,%u)\n" , BIT(m_status_reg , STATUS_TRACKB_BIT) , a , b)); } bool hp_taco_device::just_gap(tape_pos_t a , tape_pos_t b) @@ -838,11 +855,11 @@ bool hp_taco_device::just_gap(tape_pos_t a , tape_pos_t b) hp_taco_device::tape_pos_t hp_taco_device::farthest_end(const tape_track_t::iterator& it) const { - if (m_tape_fwd) { - return word_end_pos(it); - } else { - return it->first; - } + if (m_tape_fwd) { + return word_end_pos(it); + } else { + return it->first; + } } bool hp_taco_device::next_data(tape_track_t::iterator& it , tape_pos_t pos , bool inclusive) @@ -896,11 +913,11 @@ attotime hp_taco_device::fetch_next_wr_word(void) if (m_data_reg_full) { m_next_word = m_data_reg; m_data_reg_full = false; - LOG(("next %04x (DR)\n" , m_next_word)); + LOG_0(("next %04x (DR)\n" , m_next_word)); } else { // When data register is empty, write checksum word m_next_word = m_checksum_reg; - LOG(("next %04x (CS)\n" , m_next_word)); + LOG_0(("next %04x (CS)\n" , m_next_word)); } // Update checksum with new word m_checksum_reg += m_next_word; @@ -984,36 +1001,48 @@ bool hp_taco_device::next_n_gap(tape_pos_t& pos , tape_track_t::iterator it , un bool hp_taco_device::next_n_gap(tape_pos_t& pos , unsigned n_gaps , tape_pos_t min_gap) { - tape_track_t::iterator it; - // First align with next data - next_data(it, pos, true); - // Then scan for n_gaps - return next_n_gap(pos, it, n_gaps, min_gap); + tape_track_t::iterator it; + // First align with next data + next_data(it, pos, true); + // Then scan for n_gaps + return next_n_gap(pos, it, n_gaps, min_gap); +} + +void hp_taco_device::clear_tape(void) +{ + for (unsigned track_n = 0; track_n < 2; track_n++) { + m_tracks[ track_n ].clear(); + } } -void hp_taco_device::dump_sequence(FILE *out , tape_track_t::const_iterator it_start , unsigned n_words) +void hp_taco_device::dump_sequence(tape_track_t::const_iterator it_start , unsigned n_words) { if (n_words) { UINT32 tmp32; UINT16 tmp16; tmp32 = n_words; - fwrite(&tmp32 , sizeof(tmp32) , 1 , out); + fwrite(&tmp32 , sizeof(tmp32)); tmp32 = it_start->first; - fwrite(&tmp32 , sizeof(tmp32) , 1 , out); + fwrite(&tmp32 , sizeof(tmp32)); for (unsigned i = 0; i < n_words; i++) { tmp16 = it_start->second; - fwrite(&tmp16 , sizeof(tmp16) , 1 , out); + fwrite(&tmp16 , sizeof(tmp16)); it_start++; } } } -void hp_taco_device::save_tape(FILE *out) const +void hp_taco_device::save_tape(void) { UINT32 tmp32; + fseek(0, SEEK_SET); + + tmp32 = FILE_MAGIC; + fwrite(&tmp32 , sizeof(tmp32)); + for (unsigned track_n = 0; track_n < 2; track_n++) { const tape_track_t& track = m_tracks[ track_n ]; tape_pos_t next_pos = (tape_pos_t)-1; @@ -1021,28 +1050,28 @@ void hp_taco_device::save_tape(FILE *out) const tape_track_t::const_iterator it_start; for (tape_track_t::const_iterator it = track.cbegin(); it != track.cend(); it++) { if (it->first != next_pos) { - dump_sequence(out , it_start , n_words); + dump_sequence(it_start , n_words); it_start = it; n_words = 0; } next_pos = it->first + word_length(it->second); n_words++; } - dump_sequence(out , it_start , n_words); + dump_sequence(it_start , n_words); // End of track tmp32 = (UINT32)-1; - fwrite(&tmp32 , sizeof(tmp32) , 1 , out); + fwrite(&tmp32 , sizeof(tmp32)); } } -bool hp_taco_device::load_track(FILE *in , tape_track_t& track) +bool hp_taco_device::load_track(tape_track_t& track) { UINT32 tmp32; track.clear(); while (1) { - if (fread(&tmp32 , sizeof(tmp32) , 1 , in) != 1) { + if (fread(&tmp32 , sizeof(tmp32)) != sizeof(tmp32)) { return false; } @@ -1052,7 +1081,7 @@ bool hp_taco_device::load_track(FILE *in , tape_track_t& track) unsigned n_words = tmp32; - if (fread(&tmp32 , sizeof(tmp32) , 1 , in) != 1) { + if (fread(&tmp32 , sizeof(tmp32)) != sizeof(tmp32)) { return false; } @@ -1061,7 +1090,7 @@ bool hp_taco_device::load_track(FILE *in , tape_track_t& track) for (unsigned i = 0; i < n_words; i++) { UINT16 tmp16; - if (fread(&tmp16 , sizeof(tmp16) , 1 , in) != 1) { + if (fread(&tmp16 , sizeof(tmp16)) != sizeof(tmp16)) { return false; } @@ -1072,18 +1101,42 @@ bool hp_taco_device::load_track(FILE *in , tape_track_t& track) } } -void hp_taco_device::load_tape(FILE *in) +bool hp_taco_device::load_tape(void) { + UINT32 magic; + + if (fread(&magic , sizeof(magic)) != sizeof(magic) || + magic != FILE_MAGIC) { + return false; + } + for (unsigned track_n = 0; track_n < 2; track_n++) { - if (!load_track(in , m_tracks[ track_n ])) { + if (!load_track(m_tracks[ track_n ])) { LOG(("load_tape failed")); - for (track_n = 0; track_n < 2; track_n++) { - m_tracks[ track_n ].clear(); - } - break; + clear_tape(); + return false; } } + LOG(("load_tape done\n")); + return true; +} + +void hp_taco_device::set_tape_present(bool present) +{ + if (present) { + // FU_TEST + if (is_readonly()) { + //if (false) { + BIT_SET(m_status_reg, STATUS_WPR_BIT); + } else { + BIT_CLR(m_status_reg, STATUS_WPR_BIT); + } + // STATUS_CART_OUT_BIT is reset by CMD_CLEAR + } else { + BIT_SET(m_status_reg, STATUS_CART_OUT_BIT); + BIT_SET(m_status_reg, STATUS_WPR_BIT); + } } attotime hp_taco_device::time_to_next_hole(void) const @@ -1136,6 +1189,11 @@ void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg) case CMD_CLEAR: set_error(false); BIT_CLR(m_status_reg, STATUS_HOLE_BIT); + BIT_CLR(m_status_reg, STATUS_CART_OUT_BIT); + BIT_CLR(m_status_reg, STATUS_WPR_BIT); + //set_tape_present(false); + // FU_TEST + set_tape_present(is_loaded()); // This is a special command: it doesn't raise IRQ at completion and it // doesn't replace current command return; @@ -1145,7 +1203,7 @@ void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg) if (start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) { tape_pos_t target = m_tape_pos; if (next_n_gap(target, 1, NO_DATA_GAP)) { - LOG(("End of data @%d\n" , target)); + LOG_0(("End of data @%d\n" , target)); cmd_duration = time_to_target(target); } // Holes detected? @@ -1205,7 +1263,7 @@ void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg) m_cmd_state = 0; tape_pos_t target = m_tape_pos; if (next_n_gap(target, 1, MIN_IRG_LENGTH)) { - LOG(("IRG @%d\n" , target)); + LOG_0(("IRG @%d\n" , target)); cmd_duration = time_to_target(target); } // Holes detected? @@ -1287,7 +1345,7 @@ void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg) // This command only makes sense after CMD_START_READ if (CMD_CODE(m_cmd_reg) == CMD_START_READ && m_cmd_state == 1 && start_tape_cmd(new_cmd_reg , 0 , SPEED_FAST_MASK)) { - LOG(("END_READ %d\n" , m_rd_it_valid)); + LOG_0(("END_READ %d\n" , m_rd_it_valid)); cmd_duration = time_to_rd_next_word(m_rw_pos); time_to_hole = time_to_next_hole(); } @@ -1301,3 +1359,41 @@ void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg) m_tape_timer->adjust(cmd_duration); m_hole_timer->adjust(time_to_hole); } + +bool hp_taco_device::call_load() +{ + LOG(("call_load\n")); + if (!load_tape()) { + seterror(IMAGE_ERROR_INVALIDIMAGE , "Wrong format"); + set_tape_present(false); + return IMAGE_INIT_FAIL; + } + + m_image_dirty = false; + + set_tape_present(true); + return IMAGE_INIT_PASS; +} + +bool hp_taco_device::call_create(int format_type, option_resolution *format_options) +{ + LOG(("call_create\n")); + return IMAGE_INIT_PASS; +} + +void hp_taco_device::call_unload() +{ + LOG(("call_unload dirty=%d\n" , m_image_dirty)); + if (m_image_dirty) { + save_tape(); + m_image_dirty = false; + } + + clear_tape(); + set_tape_present(false); +} + +const char *hp_taco_device::file_extensions() const +{ + return "hti"; +} diff --git a/src/devices/machine/hp_taco.h b/src/devices/machine/hp_taco.h index a08b0c59ded..424031421ba 100644 --- a/src/devices/machine/hp_taco.h +++ b/src/devices/machine/hp_taco.h @@ -22,7 +22,8 @@ #define MCFG_TACO_STS_HANDLER(_devcb) \ devcb = &hp_taco_device::set_sts_handler(*device , DEVCB_##_devcb); -class hp_taco_device : public device_t +class hp_taco_device : public device_t , + public device_image_interface { public: // construction/destruction @@ -42,6 +43,19 @@ public: DECLARE_READ_LINE_MEMBER(flg_r); DECLARE_READ_LINE_MEMBER(sts_r); + // device_image_interface overrides + virtual bool call_load() override; + virtual bool call_create(int format_type, option_resolution *format_options) override; + virtual void call_unload() override; + virtual iodevice_t image_type() const override { return IO_MAGTAPE; } + virtual bool is_readable() const override { return true; } + virtual bool is_writeable() const override { return true; } + virtual bool is_creatable() const override { return true; } + virtual bool must_be_loaded() const override { return false; } + virtual bool is_reset_on_load() const override { return false; } + virtual const char *file_extensions() const override; + virtual const option_guide *create_option_guide() const override { return nullptr; } + // Tape position, 1 unit = 1 inch / (968 * 1024) typedef INT32 tape_pos_t; @@ -50,6 +64,7 @@ public: protected: // device-level overrides + virtual void device_config_complete() override; virtual void device_start() override; virtual void device_stop() override; virtual void device_reset() override; @@ -90,6 +105,7 @@ private: // Content of tape tracks tape_track_t m_tracks[ 2 ]; + bool m_image_dirty; // Reading & writing bool m_tape_wr; @@ -136,10 +152,12 @@ private: attotime time_to_rd_next_word(tape_pos_t& word_rd_pos); bool next_n_gap(tape_pos_t& pos , tape_track_t::iterator it , unsigned n_gaps , tape_pos_t min_gap); bool next_n_gap(tape_pos_t& pos , unsigned n_gaps , tape_pos_t min_gap); - static void dump_sequence(FILE *out , tape_track_t::const_iterator it_start , unsigned n_words); - void save_tape(FILE *out) const; - bool load_track(FILE *in , tape_track_t& track); - void load_tape(FILE *in); + void clear_tape(void); + void dump_sequence(tape_track_t::const_iterator it_start , unsigned n_words); + void save_tape(void); + bool load_track(tape_track_t& track); + bool load_tape(void); + void set_tape_present(bool present); attotime time_to_next_hole(void) const; attotime time_to_tach_pulses(void) const; void start_cmd_exec(UINT16 new_cmd_reg); -- cgit v1.2.3-70-g09d2 From 02ec85119dd27a500b0aea962623c0a5aea5d7db Mon Sep 17 00:00:00 2001 From: fulivi Date: Tue, 16 Feb 2016 13:45:04 +0100 Subject: hp9845: finished making TACO an image interface --- src/devices/machine/hp_taco.cpp | 105 +++++++++++++++------------------------- src/devices/machine/hp_taco.h | 2 +- 2 files changed, 40 insertions(+), 67 deletions(-) diff --git a/src/devices/machine/hp_taco.cpp b/src/devices/machine/hp_taco.cpp index 3f316e05b96..befb49489a3 100644 --- a/src/devices/machine/hp_taco.cpp +++ b/src/devices/machine/hp_taco.cpp @@ -28,8 +28,6 @@ // 1 R Cartridge out (1) // 0 R Hole detected (1) -// TODO: R6 è modificato durante il conteggio impulsi? Viene azzerato alla lettura? - #include "emu.h" #include "hp_taco.h" @@ -171,15 +169,10 @@ hp_taco_device::hp_taco_device(const machine_config &mconfig, device_type type, m_irq_handler(*this), m_flg_handler(*this), m_sts_handler(*this), - m_data_reg(0), - m_data_reg_full(false), - m_cmd_reg(0), - m_status_reg(0), - m_tach_reg(0), - m_checksum_reg(0), - m_timing_reg(0), - m_tape_pos(TAPE_INIT_POS) + m_tape_pos(TAPE_INIT_POS), + m_image_dirty(false) { + clear_state(); } hp_taco_device::hp_taco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) @@ -188,15 +181,10 @@ hp_taco_device::hp_taco_device(const machine_config &mconfig, const char *tag, d m_irq_handler(*this), m_flg_handler(*this), m_sts_handler(*this), - m_data_reg(0), - m_data_reg_full(false), - m_cmd_reg(0), - m_status_reg(0), - m_tach_reg(0), - m_checksum_reg(0), - m_timing_reg(0), - m_tape_pos(TAPE_INIT_POS) + m_tape_pos(TAPE_INIT_POS), + m_image_dirty(false) { + clear_state(); } WRITE16_MEMBER(hp_taco_device::reg_w) @@ -325,24 +313,7 @@ void hp_taco_device::device_stop() void hp_taco_device::device_reset() { LOG(("device_reset")); - m_data_reg = 0; - m_data_reg_full = false; - m_cmd_reg = 0; - m_status_reg = 0; - m_tach_reg = 0; - m_checksum_reg = 0; - m_timing_reg = 0; - m_cmd_state = 0; - // m_tape_pos is not reset, tape stays where it is - m_start_time = attotime::never; - m_tape_fwd = false; - m_tape_fast = false; - m_image_dirty = false; - m_tape_wr = false; - m_rw_pos = 0; - m_next_word = 0; - m_rd_it_valid = false; - m_gap_detect_start = NULL_TAPE_POS; + clear_state(); m_irq = false; m_flg = true; @@ -552,6 +523,31 @@ void hp_taco_device::device_timer(emu_timer &timer, device_timer_id id, int para } } +void hp_taco_device::clear_state(void) +{ + m_data_reg = 0; + m_data_reg_full = false; + m_cmd_reg = 0; + m_status_reg = 0; + m_tach_reg = 0; + m_checksum_reg = 0; + m_timing_reg = 0; + m_cmd_state = 0; + // m_tape_pos is not reset, tape stays where it is + m_start_time = attotime::never; + m_tape_fwd = false; + m_tape_fast = false; + // m_image_dirty is not touched + m_tape_wr = false; + m_rw_pos = 0; + m_next_word = 0; + m_rd_it_valid = false; + m_gap_detect_start = NULL_TAPE_POS; + + set_tape_present(false); + set_tape_present(is_loaded()); +} + void hp_taco_device::irq_w(bool state) { if (state != m_irq) { @@ -689,27 +685,6 @@ hp_taco_device::tape_pos_t hp_taco_device::next_hole(void) const } } -hp_taco_device::tape_pos_t hp_taco_device::met_first(tape_pos_t a , tape_pos_t b , bool fwd , bool& is_a) -{ - if (fwd) { - if (a < b) { - is_a = true; - return a; - } else { - is_a = false; - return b; - } - } else { - if (a >= b) { - is_a = true; - return a; - } else { - is_a = false; - return b; - } - } -} - attotime hp_taco_device::time_to_distance(tape_pos_t distance) const { // +1 for rounding @@ -1094,7 +1069,6 @@ bool hp_taco_device::load_track(tape_track_t& track) return false; } - // TODO: usare end() come hint track.insert(std::make_pair(pos , tmp16)); pos += word_length(tmp16); } @@ -1125,9 +1099,7 @@ bool hp_taco_device::load_tape(void) void hp_taco_device::set_tape_present(bool present) { if (present) { - // FU_TEST if (is_readonly()) { - //if (false) { BIT_SET(m_status_reg, STATUS_WPR_BIT); } else { BIT_CLR(m_status_reg, STATUS_WPR_BIT); @@ -1191,8 +1163,6 @@ void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg) BIT_CLR(m_status_reg, STATUS_HOLE_BIT); BIT_CLR(m_status_reg, STATUS_CART_OUT_BIT); BIT_CLR(m_status_reg, STATUS_WPR_BIT); - //set_tape_present(false); - // FU_TEST set_tape_present(is_loaded()); // This is a special command: it doesn't raise IRQ at completion and it // doesn't replace current command @@ -1362,8 +1332,11 @@ void hp_taco_device::start_cmd_exec(UINT16 new_cmd_reg) bool hp_taco_device::call_load() { - LOG(("call_load\n")); - if (!load_tape()) { + LOG(("call_load %d\n" , has_been_created())); + if (has_been_created()) { + clear_tape(); + save_tape(); + } else if (!load_tape()) { seterror(IMAGE_ERROR_INVALIDIMAGE , "Wrong format"); set_tape_present(false); return IMAGE_INIT_FAIL; @@ -1377,8 +1350,8 @@ bool hp_taco_device::call_load() bool hp_taco_device::call_create(int format_type, option_resolution *format_options) { - LOG(("call_create\n")); - return IMAGE_INIT_PASS; + LOG(("call_create %d\n" , has_been_created())); + return call_load(); } void hp_taco_device::call_unload() diff --git a/src/devices/machine/hp_taco.h b/src/devices/machine/hp_taco.h index 424031421ba..c8b794c79a2 100644 --- a/src/devices/machine/hp_taco.h +++ b/src/devices/machine/hp_taco.h @@ -123,6 +123,7 @@ private: ADV_DISCONT_DATA } adv_res_t; + void clear_state(void); void irq_w(bool state); void set_error(bool state); unsigned speed_to_tick_freq(void) const; @@ -132,7 +133,6 @@ private: static void ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b); static bool any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b); tape_pos_t next_hole(void) const; - static tape_pos_t met_first(tape_pos_t a , tape_pos_t b , bool fwd , bool& is_a); attotime time_to_distance(tape_pos_t distance) const; attotime time_to_target(tape_pos_t target) const; bool start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0); -- cgit v1.2.3-70-g09d2 From 63b58daec9b1640fe820038c39cf0dbc08dd4086 Mon Sep 17 00:00:00 2001 From: fulivi Date: Wed, 17 Feb 2016 10:10:01 +0100 Subject: hp9845: TACO doc updated --- src/devices/machine/hp_taco.cpp | 113 +++++++++++++++++++++++++++++++++++----- 1 file changed, 100 insertions(+), 13 deletions(-) diff --git a/src/devices/machine/hp_taco.cpp b/src/devices/machine/hp_taco.cpp index befb49489a3..73b7c9a441b 100644 --- a/src/devices/machine/hp_taco.cpp +++ b/src/devices/machine/hp_taco.cpp @@ -8,17 +8,48 @@ *********************************************************************/ +// This device has been reverse engineered entirely through documents & study of HP software. +// I had no access to the real device to experiment. +// Available documentation on the internal working of TACO chip is close to nothing. The best +// I could find is [1] (see below) where all that's described is a (too) brief summary of registers and little else. +// In other words, no description of the commands that can be issued to TACO chips. +// So, my main source of information was the careful study of HP software, especially the 9845 system test ROM (09845-66520). +// The second half of this ROM holds a comprehensive set of tape drive tests. +// The main shortcomings of my approach are: +// * I could indentify only those TACO commands that are actually used by the software. I managed +// to identify 17 out of 32 possible commands. The purpose of the rest of commands is anyone's guess. +// * I could only guess the behavior of TACO chips in corner cases (especially behavior in various error/abnormal +// conditions) +// // Documentation I used: // [1] HP, manual 64940-90905, may 80 rev. - Model 64940A tape control & drive service manual -// [2] US patent 4,075,679 describing HP9825 system (this system had a discrete implementation of tape controller) +// [2] US patent 4,075,679 describing HP9825 system (this system had a discrete implementation of tape controller). The +// firmware listing was quite useful in identifying sequences of commands (for example how to find a specific sector etc.). +// [3] http://www.hp9845.net site +// [4] April 1978 issue of HP Journal. There is a one-page summary of TACO chip on page 20. +// This is an overview of the TACO/CPU interface. +// +// Reg. | R/W | Content +// ===================== +// R4 | R/W | Data register: words read/written to/from tape pass through this register +// R5 | R/W | Command and status register (see below) +// R6 | R/W | Tachometer register. Writing it sets a pulse counter that counts up on either tachometer pulses or IRGs, depending +// | | on command. When the counter rolls over from 0xffff to 0 it typically ends the command. It's not clear to me +// | | what value could be read from this register, if it's just the same value that was written last time or the internal +// | | counter or something else entirely. +// R7 | R | Checksum register. Reading it clears it. +// R7 | W | Timing register. It controls somehow the encoding and decoding of bits. For now I completely ignore it because its +// | | content it's totally unknown to me. It seems safe to do so, anyway. I can see that it's always set to 0x661d before +// | | writing to tape and to 0x0635 before reading. +// // Format of TACO command/status register (R5) // Bit R/W Content // =============== // 15 RW Tape direction (1 = forward) -// 14..10 RW Command -// 9 RW ? Drive ON according to [1], doesn't match usage of firmware -// 8 RW ? Size of gaps according to [1] +// 14..10 RW Command (see the "enum" below) +// 9 RW ? Drive ON according to [1], the actual use seems to be selection of gap length +// 8 RW ? Size of gaps according to [1], N/U in my opinion // 7 RW Speed of tape (1 = 90 ips, 0 = 22 ips) // 6 RW Option bit for various commands // 5 R Current track (1 = B) @@ -28,6 +59,71 @@ // 1 R Cartridge out (1) // 0 R Hole detected (1) +// Here's a summary of the on-tape format of HP9845 systems. +// * A tape has two independent tracks (A & B). +// * Each track holds 426 sectors. +// * Each sector has an header and 256 bytes of payload (see below) +// * Sectors are separated by gaps of uniform magnetization called IRGs (Inter-Record Gaps) +// * The basic unit of data I/O are 16-bit words +// * Bits are encoded by different distances between magnetic flux reversals +// * The structure of tracks is: +// - Begin of tape holes +// - The deadzone: 350x 0xffff words +// - 1" of IRG +// - Sector #0 (track A) or #426 (track B) +// - 1" of IRG (2.5" on track A) +// - Sector #1 (track A) or #427 (track B) +// - 1" of IRG +// - Sector #2 (track A) or #428 (track B) +// - ...and so on up to sector #425/#851 +// - 6" of final gap +// - Non-recorded tape +// - End of tape holes +// * Sector #0 is not used +// * Sectors #1 and #2 hold the first copy of tape directory +// * Sectors #3 and #4 hold the second/backup copy of tape directory +// * User data are stored starting from sector #5 +// * There is no "fragmentation" map (like file allocation table in FAT filesystem): a file +// spanning more than 1 sector always occupy a single block of contiguous sectors. +// +// A sector is structured like this: +// Word 0: Invisible preamble word (always 0). Preamble comes from 9825, don't know if it's +// actually there in TACO encoding. I assumed it is. +// Word 1: Format/sector in use and other unidentified bits. +// Word 2: Sector number +// Word 3: Sector length and other bits +// Word 4: Checksum (sum of words 1..3) +// Words 5..132: Payload +// Word 133: Checksum (sum of words 5..132) +// +// Physical encoding of words is borrowed from 9825 as I wasn't able +// to gather any info on the actual encoding of TACO chips. +// This is how 9825 encodes words on tape: +// - the unit of encoding are 16-bit words +// - each word is encoded from MSB to LSB +// - each word has an extra invisible "1" encoded at the end +// - tape is read/written at slow speed only (21.98 ips) +// - a 0 is encoded with a distance between flux reversals of 1/35200 s +// (giving a maximum density of about 1600 reversals per inch) +// - a 1 is encoded with a distance that's 1.75 times that of a 0 +// +// This driver is based on the following model of the actual TACO/tape system: +// * Tape immediately reaches working speed (no spin-up time) +// * Inversion of tape direction and change of speed are immediate as well +// * Time & distance to stop the tape are modeled, though. Firmware is upset by +// a tape with null braking time/distance. +// * Speed of tape is exceptionally accurate. Real tape was controlled by a closed loop +// with something like 1% accuracy on speed. +// * Storage is modeled by one "map" data structure per track. Each map maps the tape position +// to the 16-bit word stored at that position. Gaps are modeled by lack of data in the map. +// There is no model of the physical encoding of bits (except to compute how long each word +// is on tape). +// * Read threshold is ignored. Real tapes could be read with either a low or high threshold. +// * "Flag" bit is used as a busy/ready signal in real TACO. Here I assumed the device is +// always ready, so Flag is always active. +// * I tried to fill the (many) gaps on chip behavior with "sensible" solutions. I could only +// validate my solutions by running the original firmware in MAME, though (no real hw at hand). +// #include "emu.h" #include "hp_taco.h" @@ -759,15 +855,6 @@ hp_taco_device::tape_pos_t hp_taco_device::word_length(tape_word_t w) zeros = 16 - ones; - // Physical encoding of words is borrowed from 9825 as I wasn't able - // to gather any info on the actual encoding of TACO chips. - // This should be enough for emulation. - // Anyway, this is how 9825 encodes words on tape: - // - the unit of encoding are 16-bit words - // - each word is encoded from MSB to LSB - // - each word has an extra "1" encoded at the end - // - a 0 is encoded with a distance between flux reversals of 1/35200 s - // - a 1 is encoded with a distance that's 1.75 times that of a 0 return zeros * ZERO_BIT_LEN + (ones + 1) * ONE_BIT_LEN; } -- cgit v1.2.3-70-g09d2 From 74371049b132e1068ea519beee4a645c78f04f98 Mon Sep 17 00:00:00 2001 From: fulivi Date: Wed, 17 Feb 2016 11:20:49 +0100 Subject: hp9845: small improvements to 9845/TACO docs --- src/devices/machine/hp_taco.cpp | 8 ++++++++ src/mame/drivers/hp9845.cpp | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/devices/machine/hp_taco.cpp b/src/devices/machine/hp_taco.cpp index 73b7c9a441b..76203d31ee3 100644 --- a/src/devices/machine/hp_taco.cpp +++ b/src/devices/machine/hp_taco.cpp @@ -124,6 +124,14 @@ // * I tried to fill the (many) gaps on chip behavior with "sensible" solutions. I could only // validate my solutions by running the original firmware in MAME, though (no real hw at hand). // +// TODOs/issues: +// * Some code cleanup +// * Handling of tape holes seems to be wrong: test "C" of test ROM only works partially +// * Find out what is read from register R6 +// * Handle device_image_interface::call_display to show state of tape +// * Find more info on TACO chips (does anyone with a working 9845 or access to internal HP docs want to +// help me here, please?) +// #include "emu.h" #include "hp_taco.h" diff --git a/src/mame/drivers/hp9845.cpp b/src/mame/drivers/hp9845.cpp index ec0e53da906..7f83f001fe3 100644 --- a/src/mame/drivers/hp9845.cpp +++ b/src/mame/drivers/hp9845.cpp @@ -16,12 +16,12 @@ // - LPU & PPU ROMs // - LPU & PPU RAMs // - Text mode screen -// - Keyboard (most of keys) +// - Keyboard +// - T15 tape drive // What's not yet in: // - Beeper -// - Rest of keyboard // - Graphic screen -// - Tape drive (this needs some heavy RE of the TACO chip) +// - Better naming of tape drive image (it's now "magt", should be "t15") // - Better documentation of this file // - Software list to load optional ROMs // What's wrong: -- cgit v1.2.3-70-g09d2 From 97f515d8c4f49013a17856893f9c1802867b5711 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Wed, 17 Feb 2016 11:26:40 +0100 Subject: removed old entries. nw --- scripts/src/osd/windows.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/src/osd/windows.lua b/scripts/src/osd/windows.lua index fd508e645c5..54464477e24 100644 --- a/scripts/src/osd/windows.lua +++ b/scripts/src/osd/windows.lua @@ -159,7 +159,6 @@ project ("osd_" .. _OPTIONS["osd"]) MAME_DIR .. "src/osd/modules/render/d3d/d3dcomm.h", MAME_DIR .. "src/osd/modules/render/d3d/d3dhlsl.h", MAME_DIR .. "src/osd/modules/render/d3d/d3dintf.h", - MAME_DIR .. "src/osd/modules/render/drawdd.cpp", MAME_DIR .. "src/osd/modules/render/drawgdi.cpp", MAME_DIR .. "src/osd/modules/render/drawnone.cpp", MAME_DIR .. "src/osd/windows/input.cpp", -- cgit v1.2.3-70-g09d2 From 32630f09aacaec2d9c3eaf384dd80f886f50c3ac Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Wed, 17 Feb 2016 11:32:06 +0100 Subject: menu: allocate and draw icons only if available. nw --- src/emu/ui/menu.cpp | 24 ++++++++++++++++++++---- src/emu/ui/utils.cpp | 1 + src/emu/ui/utils.h | 1 + 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index fbe7d46e541..8017748321f 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -1309,11 +1309,27 @@ void ui_menu::init_ui(running_machine &machine) star_texture = mrender.texture_alloc(); star_texture->set_bitmap(*star_bitmap, star_bitmap->cliprect(), TEXFORMAT_ARGB32); - // allocates icons bitmap and texture - for (int i = 0; i < MAX_ICONS_RENDER; i++) + // check and allocate icons + file_enumerator path(machine.ui().options().icons_directory()); + const osd_directory_entry *dir; + while ((dir = path.next()) != nullptr) { - icons_bitmap[i] = auto_alloc(machine, bitmap_argb32); - icons_texture[i] = mrender.texture_alloc(); + char drivername[50]; + char *dst = drivername; + const char *src; + + // build a name for it + src = dir->name; + if (*src != 0 && *src != '.') + { + ui_globals::has_icons = true; + for (int i = 0; i < MAX_ICONS_RENDER; i++) + { + icons_bitmap[i] = auto_alloc(machine, bitmap_argb32); + icons_texture[i] = mrender.texture_alloc(); + } + break; + } } // create a texture for main menu background diff --git a/src/emu/ui/utils.cpp b/src/emu/ui/utils.cpp index 608b6b16a88..7ac94d5e050 100644 --- a/src/emu/ui/utils.cpp +++ b/src/emu/ui/utils.cpp @@ -48,6 +48,7 @@ bool ui_globals::redraw_icon = false; int ui_globals::visible_main_lines = 0; int ui_globals::visible_sw_lines = 0; UINT16 ui_globals::panels_status = 0; +bool ui_globals::has_icons = false; // Custom filter UINT16 custfltr::main = 0; diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index 232fb3ccb41..3c8da8ab16e 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -208,6 +208,7 @@ struct ui_globals static bool switch_image, redraw_icon, default_image, reset; static int visible_main_lines, visible_sw_lines; static UINT16 panels_status; + static bool has_icons; }; #define main_struct(name) \ -- cgit v1.2.3-70-g09d2 From d9299cb64a5bb01789fee15f7f788cc3f5f144e7 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 17 Feb 2016 13:22:36 +0100 Subject: fix compile, unused variables (nw) --- src/emu/ui/menu.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index 8017748321f..bc019c112e1 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -1314,8 +1314,6 @@ void ui_menu::init_ui(running_machine &machine) const osd_directory_entry *dir; while ((dir = path.next()) != nullptr) { - char drivername[50]; - char *dst = drivername; const char *src; // build a name for it -- cgit v1.2.3-70-g09d2 From 70023b060a3e76fa9165e57c10b0347742aa3297 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 17 Feb 2016 14:11:23 +0100 Subject: Added rapidjson (nw) --- 3rdparty/rapidjson/.gitignore | 24 + 3rdparty/rapidjson/.gitmodules | 3 + 3rdparty/rapidjson/.travis.yml | 54 + 3rdparty/rapidjson/CHANGELOG.md | 79 + 3rdparty/rapidjson/CMakeLists.txt | 128 + 3rdparty/rapidjson/CMakeModules/FindGTestSrc.cmake | 30 + 3rdparty/rapidjson/RapidJSON.pc.in | 7 + 3rdparty/rapidjson/RapidJSONConfig.cmake.in | 3 + 3rdparty/rapidjson/RapidJSONConfigVersion.cmake.in | 10 + 3rdparty/rapidjson/appveyor.yml | 28 + 3rdparty/rapidjson/bin/data/glossary.json | 22 + 3rdparty/rapidjson/bin/data/menu.json | 27 + 3rdparty/rapidjson/bin/data/readme.txt | 1 + 3rdparty/rapidjson/bin/data/sample.json | 3315 ++++++++++++++++++++ 3rdparty/rapidjson/bin/data/webapp.json | 88 + 3rdparty/rapidjson/bin/data/widget.json | 26 + 3rdparty/rapidjson/bin/draft-04/schema | 150 + 3rdparty/rapidjson/bin/encodings/utf16be.json | Bin 0 -> 368 bytes 3rdparty/rapidjson/bin/encodings/utf16bebom.json | Bin 0 -> 370 bytes 3rdparty/rapidjson/bin/encodings/utf16le.json | Bin 0 -> 368 bytes 3rdparty/rapidjson/bin/encodings/utf16lebom.json | Bin 0 -> 370 bytes 3rdparty/rapidjson/bin/encodings/utf32be.json | Bin 0 -> 736 bytes 3rdparty/rapidjson/bin/encodings/utf32bebom.json | Bin 0 -> 740 bytes 3rdparty/rapidjson/bin/encodings/utf32le.json | Bin 0 -> 736 bytes 3rdparty/rapidjson/bin/encodings/utf32lebom.json | Bin 0 -> 740 bytes 3rdparty/rapidjson/bin/encodings/utf8.json | 7 + 3rdparty/rapidjson/bin/encodings/utf8bom.json | 7 + 3rdparty/rapidjson/bin/jsonchecker/fail1.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail10.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail11.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail12.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail13.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail14.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail15.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail16.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail17.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail18.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail19.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail2.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail20.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail21.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail22.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail23.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail24.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail25.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail26.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail27.json | 2 + 3rdparty/rapidjson/bin/jsonchecker/fail28.json | 2 + 3rdparty/rapidjson/bin/jsonchecker/fail29.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail3.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail30.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail31.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail32.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail33.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail4.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail5.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail6.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail7.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail8.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/fail9.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/pass1.json | 58 + 3rdparty/rapidjson/bin/jsonchecker/pass2.json | 1 + 3rdparty/rapidjson/bin/jsonchecker/pass3.json | 6 + 3rdparty/rapidjson/bin/jsonchecker/readme.txt | 3 + 3rdparty/rapidjson/bin/jsonschema/.gitignore | 1 + 3rdparty/rapidjson/bin/jsonschema/.travis.yml | 4 + 3rdparty/rapidjson/bin/jsonschema/LICENSE | 19 + 3rdparty/rapidjson/bin/jsonschema/README.md | 148 + .../rapidjson/bin/jsonschema/bin/jsonschema_suite | 283 ++ .../rapidjson/bin/jsonschema/remotes/.DS_Store | Bin 0 -> 6148 bytes .../jsonschema/remotes/folder/folderInteger.json | 3 + .../rapidjson/bin/jsonschema/remotes/integer.json | 3 + .../bin/jsonschema/remotes/subSchemas.json | 8 + 3rdparty/rapidjson/bin/jsonschema/tests/.DS_Store | Bin 0 -> 6148 bytes .../jsonschema/tests/draft3/additionalItems.json | 82 + .../tests/draft3/additionalProperties.json | 88 + .../bin/jsonschema/tests/draft3/default.json | 49 + .../bin/jsonschema/tests/draft3/dependencies.json | 108 + .../bin/jsonschema/tests/draft3/disallow.json | 80 + .../bin/jsonschema/tests/draft3/divisibleBy.json | 60 + .../bin/jsonschema/tests/draft3/enum.json | 71 + .../bin/jsonschema/tests/draft3/extends.json | 94 + .../bin/jsonschema/tests/draft3/items.json | 46 + .../bin/jsonschema/tests/draft3/maxItems.json | 28 + .../bin/jsonschema/tests/draft3/maxLength.json | 33 + .../bin/jsonschema/tests/draft3/maximum.json | 42 + .../bin/jsonschema/tests/draft3/minItems.json | 28 + .../bin/jsonschema/tests/draft3/minLength.json | 33 + .../bin/jsonschema/tests/draft3/minimum.json | 42 + .../jsonschema/tests/draft3/optional/bignum.json | 107 + .../jsonschema/tests/draft3/optional/format.json | 222 ++ .../jsonschema/tests/draft3/optional/jsregex.json | 18 + .../draft3/optional/zeroTerminatedFloats.json | 15 + .../bin/jsonschema/tests/draft3/pattern.json | 34 + .../jsonschema/tests/draft3/patternProperties.json | 110 + .../bin/jsonschema/tests/draft3/properties.json | 92 + .../rapidjson/bin/jsonschema/tests/draft3/ref.json | 159 + .../bin/jsonschema/tests/draft3/refRemote.json | 74 + .../bin/jsonschema/tests/draft3/required.json | 53 + .../bin/jsonschema/tests/draft3/type.json | 474 +++ .../bin/jsonschema/tests/draft3/uniqueItems.json | 79 + .../bin/jsonschema/tests/draft4/.DS_Store | Bin 0 -> 6148 bytes .../jsonschema/tests/draft4/additionalItems.json | 82 + .../tests/draft4/additionalProperties.json | 88 + .../bin/jsonschema/tests/draft4/allOf.json | 112 + .../bin/jsonschema/tests/draft4/anyOf.json | 68 + .../bin/jsonschema/tests/draft4/default.json | 49 + .../bin/jsonschema/tests/draft4/definitions.json | 32 + .../bin/jsonschema/tests/draft4/dependencies.json | 113 + .../bin/jsonschema/tests/draft4/enum.json | 72 + .../bin/jsonschema/tests/draft4/items.json | 46 + .../bin/jsonschema/tests/draft4/maxItems.json | 28 + .../bin/jsonschema/tests/draft4/maxLength.json | 33 + .../bin/jsonschema/tests/draft4/maxProperties.json | 28 + .../bin/jsonschema/tests/draft4/maximum.json | 42 + .../bin/jsonschema/tests/draft4/minItems.json | 28 + .../bin/jsonschema/tests/draft4/minLength.json | 33 + .../bin/jsonschema/tests/draft4/minProperties.json | 28 + .../bin/jsonschema/tests/draft4/minimum.json | 42 + .../bin/jsonschema/tests/draft4/multipleOf.json | 60 + .../rapidjson/bin/jsonschema/tests/draft4/not.json | 96 + .../bin/jsonschema/tests/draft4/oneOf.json | 68 + .../jsonschema/tests/draft4/optional/bignum.json | 107 + .../jsonschema/tests/draft4/optional/format.json | 148 + .../draft4/optional/zeroTerminatedFloats.json | 15 + .../bin/jsonschema/tests/draft4/pattern.json | 34 + .../jsonschema/tests/draft4/patternProperties.json | 110 + .../bin/jsonschema/tests/draft4/properties.json | 92 + .../rapidjson/bin/jsonschema/tests/draft4/ref.json | 159 + .../bin/jsonschema/tests/draft4/refRemote.json | 74 + .../bin/jsonschema/tests/draft4/required.json | 39 + .../bin/jsonschema/tests/draft4/type.json | 330 ++ .../bin/jsonschema/tests/draft4/uniqueItems.json | 79 + 3rdparty/rapidjson/bin/jsonschema/tox.ini | 8 + 3rdparty/rapidjson/bin/types/booleans.json | 102 + 3rdparty/rapidjson/bin/types/floats.json | 102 + 3rdparty/rapidjson/bin/types/guids.json | 102 + 3rdparty/rapidjson/bin/types/integers.json | 102 + 3rdparty/rapidjson/bin/types/mixed.json | 592 ++++ 3rdparty/rapidjson/bin/types/nulls.json | 102 + 3rdparty/rapidjson/bin/types/paragraphs.json | 102 + 3rdparty/rapidjson/bin/types/readme.txt | 1 + 3rdparty/rapidjson/doc/CMakeLists.txt | 25 + 3rdparty/rapidjson/doc/Doxyfile.in | 2368 ++++++++++++++ 3rdparty/rapidjson/doc/Doxyfile.zh-cn.in | 2368 ++++++++++++++ 3rdparty/rapidjson/doc/diagram/architecture.dot | 50 + 3rdparty/rapidjson/doc/diagram/architecture.png | Bin 0 -> 16569 bytes 3rdparty/rapidjson/doc/diagram/insituparsing.dot | 65 + 3rdparty/rapidjson/doc/diagram/insituparsing.png | Bin 0 -> 37281 bytes .../diagram/iterative-parser-states-diagram.dot | 62 + .../diagram/iterative-parser-states-diagram.png | Bin 0 -> 92378 bytes 3rdparty/rapidjson/doc/diagram/makefile | 8 + 3rdparty/rapidjson/doc/diagram/move1.dot | 47 + 3rdparty/rapidjson/doc/diagram/move1.png | Bin 0 -> 16081 bytes 3rdparty/rapidjson/doc/diagram/move2.dot | 62 + 3rdparty/rapidjson/doc/diagram/move2.png | Bin 0 -> 41517 bytes 3rdparty/rapidjson/doc/diagram/move3.dot | 60 + 3rdparty/rapidjson/doc/diagram/move3.png | Bin 0 -> 36371 bytes 3rdparty/rapidjson/doc/diagram/normalparsing.dot | 56 + 3rdparty/rapidjson/doc/diagram/normalparsing.png | Bin 0 -> 32887 bytes 3rdparty/rapidjson/doc/diagram/simpledom.dot | 54 + 3rdparty/rapidjson/doc/diagram/simpledom.png | Bin 0 -> 43670 bytes 3rdparty/rapidjson/doc/diagram/tutorial.dot | 58 + 3rdparty/rapidjson/doc/diagram/tutorial.png | Bin 0 -> 44634 bytes 3rdparty/rapidjson/doc/diagram/utilityclass.dot | 73 + 3rdparty/rapidjson/doc/diagram/utilityclass.png | Bin 0 -> 99993 bytes 3rdparty/rapidjson/doc/dom.md | 277 ++ 3rdparty/rapidjson/doc/dom.zh-cn.md | 281 ++ 3rdparty/rapidjson/doc/encoding.md | 146 + 3rdparty/rapidjson/doc/encoding.zh-cn.md | 152 + 3rdparty/rapidjson/doc/faq.md | 289 ++ 3rdparty/rapidjson/doc/faq.zh-cn.md | 290 ++ 3rdparty/rapidjson/doc/features.md | 98 + 3rdparty/rapidjson/doc/features.zh-cn.md | 97 + 3rdparty/rapidjson/doc/internals.md | 365 +++ 3rdparty/rapidjson/doc/logo/rapidjson.png | Bin 0 -> 5259 bytes 3rdparty/rapidjson/doc/logo/rapidjson.svg | 119 + 3rdparty/rapidjson/doc/misc/DoxygenLayout.xml | 194 ++ 3rdparty/rapidjson/doc/misc/doxygenextra.css | 274 ++ 3rdparty/rapidjson/doc/misc/footer.html | 27 + 3rdparty/rapidjson/doc/misc/header.html | 33 + 3rdparty/rapidjson/doc/performance.md | 26 + 3rdparty/rapidjson/doc/performance.zh-cn.md | 26 + 3rdparty/rapidjson/doc/pointer.md | 234 ++ 3rdparty/rapidjson/doc/pointer.zh-cn.md | 234 ++ 3rdparty/rapidjson/doc/sax.md | 475 +++ 3rdparty/rapidjson/doc/sax.zh-cn.md | 476 +++ 3rdparty/rapidjson/doc/schema.md | 237 ++ 3rdparty/rapidjson/doc/schema.zh-cn.md | 237 ++ 3rdparty/rapidjson/doc/stream.md | 426 +++ 3rdparty/rapidjson/doc/stream.zh-cn.md | 426 +++ 3rdparty/rapidjson/doc/tutorial.md | 517 +++ 3rdparty/rapidjson/doc/tutorial.zh-cn.md | 515 +++ 3rdparty/rapidjson/example/CMakeLists.txt | 36 + .../rapidjson/example/capitalize/capitalize.cpp | 66 + 3rdparty/rapidjson/example/condense/condense.cpp | 32 + 3rdparty/rapidjson/example/jsonx/jsonx.cpp | 200 ++ .../example/messagereader/messagereader.cpp | 105 + 3rdparty/rapidjson/example/pretty/pretty.cpp | 30 + .../rapidjson/example/prettyauto/prettyauto.cpp | 56 + .../example/schemavalidator/schemavalidator.cpp | 72 + 3rdparty/rapidjson/example/serialize/serialize.cpp | 173 + 3rdparty/rapidjson/example/simpledom/simpledom.cpp | 29 + .../example/simplereader/simplereader.cpp | 38 + .../example/simplewriter/simplewriter.cpp | 35 + 3rdparty/rapidjson/example/tutorial/tutorial.cpp | 151 + 3rdparty/rapidjson/include/rapidjson/allocators.h | 263 ++ 3rdparty/rapidjson/include/rapidjson/document.h | 2189 +++++++++++++ .../rapidjson/include/rapidjson/encodedstream.h | 270 ++ 3rdparty/rapidjson/include/rapidjson/encodings.h | 712 +++++ 3rdparty/rapidjson/include/rapidjson/error/en.h | 74 + 3rdparty/rapidjson/include/rapidjson/error/error.h | 155 + .../rapidjson/include/rapidjson/filereadstream.h | 99 + .../rapidjson/include/rapidjson/filewritestream.h | 104 + 3rdparty/rapidjson/include/rapidjson/fwd.h | 151 + .../include/rapidjson/internal/biginteger.h | 290 ++ .../rapidjson/include/rapidjson/internal/diyfp.h | 258 ++ .../rapidjson/include/rapidjson/internal/dtoa.h | 243 ++ .../rapidjson/include/rapidjson/internal/ieee754.h | 78 + .../rapidjson/include/rapidjson/internal/itoa.h | 304 ++ .../rapidjson/include/rapidjson/internal/meta.h | 181 ++ .../rapidjson/include/rapidjson/internal/pow10.h | 55 + .../rapidjson/include/rapidjson/internal/regex.h | 696 ++++ .../rapidjson/include/rapidjson/internal/stack.h | 230 ++ .../rapidjson/include/rapidjson/internal/strfunc.h | 55 + .../rapidjson/include/rapidjson/internal/strtod.h | 269 ++ .../rapidjson/include/rapidjson/internal/swap.h | 46 + .../rapidjson/include/rapidjson/istreamwrapper.h | 105 + .../rapidjson/include/rapidjson/memorybuffer.h | 70 + .../rapidjson/include/rapidjson/memorystream.h | 71 + .../include/rapidjson/msinttypes/inttypes.h | 316 ++ .../include/rapidjson/msinttypes/stdint.h | 300 ++ .../rapidjson/include/rapidjson/ostreamwrapper.h | 76 + 3rdparty/rapidjson/include/rapidjson/pointer.h | 1345 ++++++++ .../rapidjson/include/rapidjson/prettywriter.h | 223 ++ 3rdparty/rapidjson/include/rapidjson/rapidjson.h | 569 ++++ 3rdparty/rapidjson/include/rapidjson/reader.h | 1696 ++++++++++ 3rdparty/rapidjson/include/rapidjson/schema.h | 1979 ++++++++++++ 3rdparty/rapidjson/include/rapidjson/stream.h | 179 ++ .../rapidjson/include/rapidjson/stringbuffer.h | 117 + 3rdparty/rapidjson/include/rapidjson/writer.h | 558 ++++ 3rdparty/rapidjson/library.json | 12 + 3rdparty/rapidjson/license.txt | 57 + 3rdparty/rapidjson/rapidjson.autopkg | 75 + 3rdparty/rapidjson/readme.md | 129 + 3rdparty/rapidjson/readme.zh-cn.md | 121 + 3rdparty/rapidjson/test/CMakeLists.txt | 20 + 3rdparty/rapidjson/test/perftest/CMakeLists.txt | 17 + 3rdparty/rapidjson/test/perftest/misctest.cpp | 974 ++++++ 3rdparty/rapidjson/test/perftest/perftest.cpp | 24 + 3rdparty/rapidjson/test/perftest/perftest.h | 180 ++ 3rdparty/rapidjson/test/perftest/platformtest.cpp | 166 + 3rdparty/rapidjson/test/perftest/rapidjsontest.cpp | 422 +++ 3rdparty/rapidjson/test/perftest/schematest.cpp | 216 ++ 3rdparty/rapidjson/test/unittest/CMakeLists.txt | 61 + .../rapidjson/test/unittest/allocatorstest.cpp | 102 + .../rapidjson/test/unittest/bigintegertest.cpp | 133 + 3rdparty/rapidjson/test/unittest/documenttest.cpp | 589 ++++ 3rdparty/rapidjson/test/unittest/dtoatest.cpp | 91 + .../rapidjson/test/unittest/encodedstreamtest.cpp | 313 ++ 3rdparty/rapidjson/test/unittest/encodingstest.cpp | 425 +++ .../rapidjson/test/unittest/filestreamtest.cpp | 112 + 3rdparty/rapidjson/test/unittest/fwdtest.cpp | 227 ++ .../rapidjson/test/unittest/istreamwrappertest.cpp | 171 + 3rdparty/rapidjson/test/unittest/itoatest.cpp | 158 + .../rapidjson/test/unittest/jsoncheckertest.cpp | 99 + 3rdparty/rapidjson/test/unittest/namespacetest.cpp | 70 + .../rapidjson/test/unittest/ostreamwrappertest.cpp | 91 + 3rdparty/rapidjson/test/unittest/pointertest.cpp | 1524 +++++++++ .../rapidjson/test/unittest/prettywritertest.cpp | 180 ++ 3rdparty/rapidjson/test/unittest/readertest.cpp | 1517 +++++++++ 3rdparty/rapidjson/test/unittest/regextest.cpp | 576 ++++ 3rdparty/rapidjson/test/unittest/schematest.cpp | 1157 +++++++ 3rdparty/rapidjson/test/unittest/simdtest.cpp | 159 + 3rdparty/rapidjson/test/unittest/strfunctest.cpp | 30 + .../rapidjson/test/unittest/stringbuffertest.cpp | 163 + 3rdparty/rapidjson/test/unittest/strtodtest.cpp | 132 + 3rdparty/rapidjson/test/unittest/unittest.cpp | 50 + 3rdparty/rapidjson/test/unittest/unittest.h | 135 + 3rdparty/rapidjson/test/unittest/valuetest.cpp | 1498 +++++++++ 3rdparty/rapidjson/test/unittest/writertest.cpp | 441 +++ 3rdparty/rapidjson/travis-doxygen.sh | 122 + 282 files changed, 50365 insertions(+) create mode 100644 3rdparty/rapidjson/.gitignore create mode 100644 3rdparty/rapidjson/.gitmodules create mode 100644 3rdparty/rapidjson/.travis.yml create mode 100644 3rdparty/rapidjson/CHANGELOG.md create mode 100644 3rdparty/rapidjson/CMakeLists.txt create mode 100644 3rdparty/rapidjson/CMakeModules/FindGTestSrc.cmake create mode 100644 3rdparty/rapidjson/RapidJSON.pc.in create mode 100644 3rdparty/rapidjson/RapidJSONConfig.cmake.in create mode 100644 3rdparty/rapidjson/RapidJSONConfigVersion.cmake.in create mode 100644 3rdparty/rapidjson/appveyor.yml create mode 100644 3rdparty/rapidjson/bin/data/glossary.json create mode 100644 3rdparty/rapidjson/bin/data/menu.json create mode 100644 3rdparty/rapidjson/bin/data/readme.txt create mode 100644 3rdparty/rapidjson/bin/data/sample.json create mode 100644 3rdparty/rapidjson/bin/data/webapp.json create mode 100644 3rdparty/rapidjson/bin/data/widget.json create mode 100644 3rdparty/rapidjson/bin/draft-04/schema create mode 100644 3rdparty/rapidjson/bin/encodings/utf16be.json create mode 100644 3rdparty/rapidjson/bin/encodings/utf16bebom.json create mode 100644 3rdparty/rapidjson/bin/encodings/utf16le.json create mode 100644 3rdparty/rapidjson/bin/encodings/utf16lebom.json create mode 100644 3rdparty/rapidjson/bin/encodings/utf32be.json create mode 100644 3rdparty/rapidjson/bin/encodings/utf32bebom.json create mode 100644 3rdparty/rapidjson/bin/encodings/utf32le.json create mode 100644 3rdparty/rapidjson/bin/encodings/utf32lebom.json create mode 100644 3rdparty/rapidjson/bin/encodings/utf8.json create mode 100644 3rdparty/rapidjson/bin/encodings/utf8bom.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail1.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail10.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail11.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail12.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail13.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail14.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail15.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail16.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail17.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail18.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail19.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail2.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail20.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail21.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail22.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail23.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail24.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail25.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail26.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail27.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail28.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail29.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail3.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail30.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail31.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail32.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail33.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail4.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail5.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail6.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail7.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail8.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/fail9.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/pass1.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/pass2.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/pass3.json create mode 100644 3rdparty/rapidjson/bin/jsonchecker/readme.txt create mode 100644 3rdparty/rapidjson/bin/jsonschema/.gitignore create mode 100644 3rdparty/rapidjson/bin/jsonschema/.travis.yml create mode 100644 3rdparty/rapidjson/bin/jsonschema/LICENSE create mode 100644 3rdparty/rapidjson/bin/jsonschema/README.md create mode 100644 3rdparty/rapidjson/bin/jsonschema/bin/jsonschema_suite create mode 100644 3rdparty/rapidjson/bin/jsonschema/remotes/.DS_Store create mode 100644 3rdparty/rapidjson/bin/jsonschema/remotes/folder/folderInteger.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/remotes/integer.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/remotes/subSchemas.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/.DS_Store create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/additionalItems.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/additionalProperties.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/default.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/dependencies.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/disallow.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/divisibleBy.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/enum.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/extends.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/items.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/maxItems.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/maxLength.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/maximum.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/minItems.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/minLength.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/minimum.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/bignum.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/format.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/jsregex.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/zeroTerminatedFloats.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/pattern.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/patternProperties.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/properties.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/ref.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/refRemote.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/required.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/type.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft3/uniqueItems.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/.DS_Store create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/additionalItems.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/additionalProperties.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/allOf.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/anyOf.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/default.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/definitions.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/dependencies.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/enum.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/items.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxItems.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxLength.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxProperties.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/maximum.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/minItems.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/minLength.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/minProperties.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/minimum.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/multipleOf.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/not.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/oneOf.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/bignum.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/format.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/zeroTerminatedFloats.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/pattern.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/patternProperties.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/properties.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/ref.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/refRemote.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/required.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/type.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tests/draft4/uniqueItems.json create mode 100644 3rdparty/rapidjson/bin/jsonschema/tox.ini create mode 100644 3rdparty/rapidjson/bin/types/booleans.json create mode 100644 3rdparty/rapidjson/bin/types/floats.json create mode 100644 3rdparty/rapidjson/bin/types/guids.json create mode 100644 3rdparty/rapidjson/bin/types/integers.json create mode 100644 3rdparty/rapidjson/bin/types/mixed.json create mode 100644 3rdparty/rapidjson/bin/types/nulls.json create mode 100644 3rdparty/rapidjson/bin/types/paragraphs.json create mode 100644 3rdparty/rapidjson/bin/types/readme.txt create mode 100644 3rdparty/rapidjson/doc/CMakeLists.txt create mode 100644 3rdparty/rapidjson/doc/Doxyfile.in create mode 100644 3rdparty/rapidjson/doc/Doxyfile.zh-cn.in create mode 100644 3rdparty/rapidjson/doc/diagram/architecture.dot create mode 100644 3rdparty/rapidjson/doc/diagram/architecture.png create mode 100644 3rdparty/rapidjson/doc/diagram/insituparsing.dot create mode 100644 3rdparty/rapidjson/doc/diagram/insituparsing.png create mode 100644 3rdparty/rapidjson/doc/diagram/iterative-parser-states-diagram.dot create mode 100644 3rdparty/rapidjson/doc/diagram/iterative-parser-states-diagram.png create mode 100644 3rdparty/rapidjson/doc/diagram/makefile create mode 100644 3rdparty/rapidjson/doc/diagram/move1.dot create mode 100644 3rdparty/rapidjson/doc/diagram/move1.png create mode 100644 3rdparty/rapidjson/doc/diagram/move2.dot create mode 100644 3rdparty/rapidjson/doc/diagram/move2.png create mode 100644 3rdparty/rapidjson/doc/diagram/move3.dot create mode 100644 3rdparty/rapidjson/doc/diagram/move3.png create mode 100644 3rdparty/rapidjson/doc/diagram/normalparsing.dot create mode 100644 3rdparty/rapidjson/doc/diagram/normalparsing.png create mode 100644 3rdparty/rapidjson/doc/diagram/simpledom.dot create mode 100644 3rdparty/rapidjson/doc/diagram/simpledom.png create mode 100644 3rdparty/rapidjson/doc/diagram/tutorial.dot create mode 100644 3rdparty/rapidjson/doc/diagram/tutorial.png create mode 100644 3rdparty/rapidjson/doc/diagram/utilityclass.dot create mode 100644 3rdparty/rapidjson/doc/diagram/utilityclass.png create mode 100644 3rdparty/rapidjson/doc/dom.md create mode 100644 3rdparty/rapidjson/doc/dom.zh-cn.md create mode 100644 3rdparty/rapidjson/doc/encoding.md create mode 100644 3rdparty/rapidjson/doc/encoding.zh-cn.md create mode 100644 3rdparty/rapidjson/doc/faq.md create mode 100644 3rdparty/rapidjson/doc/faq.zh-cn.md create mode 100644 3rdparty/rapidjson/doc/features.md create mode 100644 3rdparty/rapidjson/doc/features.zh-cn.md create mode 100644 3rdparty/rapidjson/doc/internals.md create mode 100644 3rdparty/rapidjson/doc/logo/rapidjson.png create mode 100644 3rdparty/rapidjson/doc/logo/rapidjson.svg create mode 100644 3rdparty/rapidjson/doc/misc/DoxygenLayout.xml create mode 100644 3rdparty/rapidjson/doc/misc/doxygenextra.css create mode 100644 3rdparty/rapidjson/doc/misc/footer.html create mode 100644 3rdparty/rapidjson/doc/misc/header.html create mode 100644 3rdparty/rapidjson/doc/performance.md create mode 100644 3rdparty/rapidjson/doc/performance.zh-cn.md create mode 100644 3rdparty/rapidjson/doc/pointer.md create mode 100644 3rdparty/rapidjson/doc/pointer.zh-cn.md create mode 100644 3rdparty/rapidjson/doc/sax.md create mode 100644 3rdparty/rapidjson/doc/sax.zh-cn.md create mode 100644 3rdparty/rapidjson/doc/schema.md create mode 100644 3rdparty/rapidjson/doc/schema.zh-cn.md create mode 100644 3rdparty/rapidjson/doc/stream.md create mode 100644 3rdparty/rapidjson/doc/stream.zh-cn.md create mode 100644 3rdparty/rapidjson/doc/tutorial.md create mode 100644 3rdparty/rapidjson/doc/tutorial.zh-cn.md create mode 100644 3rdparty/rapidjson/example/CMakeLists.txt create mode 100644 3rdparty/rapidjson/example/capitalize/capitalize.cpp create mode 100644 3rdparty/rapidjson/example/condense/condense.cpp create mode 100644 3rdparty/rapidjson/example/jsonx/jsonx.cpp create mode 100644 3rdparty/rapidjson/example/messagereader/messagereader.cpp create mode 100644 3rdparty/rapidjson/example/pretty/pretty.cpp create mode 100644 3rdparty/rapidjson/example/prettyauto/prettyauto.cpp create mode 100644 3rdparty/rapidjson/example/schemavalidator/schemavalidator.cpp create mode 100644 3rdparty/rapidjson/example/serialize/serialize.cpp create mode 100644 3rdparty/rapidjson/example/simpledom/simpledom.cpp create mode 100644 3rdparty/rapidjson/example/simplereader/simplereader.cpp create mode 100644 3rdparty/rapidjson/example/simplewriter/simplewriter.cpp create mode 100644 3rdparty/rapidjson/example/tutorial/tutorial.cpp create mode 100644 3rdparty/rapidjson/include/rapidjson/allocators.h create mode 100644 3rdparty/rapidjson/include/rapidjson/document.h create mode 100644 3rdparty/rapidjson/include/rapidjson/encodedstream.h create mode 100644 3rdparty/rapidjson/include/rapidjson/encodings.h create mode 100644 3rdparty/rapidjson/include/rapidjson/error/en.h create mode 100644 3rdparty/rapidjson/include/rapidjson/error/error.h create mode 100644 3rdparty/rapidjson/include/rapidjson/filereadstream.h create mode 100644 3rdparty/rapidjson/include/rapidjson/filewritestream.h create mode 100644 3rdparty/rapidjson/include/rapidjson/fwd.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/biginteger.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/diyfp.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/dtoa.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/ieee754.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/itoa.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/meta.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/pow10.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/regex.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/stack.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/strfunc.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/strtod.h create mode 100644 3rdparty/rapidjson/include/rapidjson/internal/swap.h create mode 100644 3rdparty/rapidjson/include/rapidjson/istreamwrapper.h create mode 100644 3rdparty/rapidjson/include/rapidjson/memorybuffer.h create mode 100644 3rdparty/rapidjson/include/rapidjson/memorystream.h create mode 100644 3rdparty/rapidjson/include/rapidjson/msinttypes/inttypes.h create mode 100644 3rdparty/rapidjson/include/rapidjson/msinttypes/stdint.h create mode 100644 3rdparty/rapidjson/include/rapidjson/ostreamwrapper.h create mode 100644 3rdparty/rapidjson/include/rapidjson/pointer.h create mode 100644 3rdparty/rapidjson/include/rapidjson/prettywriter.h create mode 100644 3rdparty/rapidjson/include/rapidjson/rapidjson.h create mode 100644 3rdparty/rapidjson/include/rapidjson/reader.h create mode 100644 3rdparty/rapidjson/include/rapidjson/schema.h create mode 100644 3rdparty/rapidjson/include/rapidjson/stream.h create mode 100644 3rdparty/rapidjson/include/rapidjson/stringbuffer.h create mode 100644 3rdparty/rapidjson/include/rapidjson/writer.h create mode 100644 3rdparty/rapidjson/library.json create mode 100644 3rdparty/rapidjson/license.txt create mode 100644 3rdparty/rapidjson/rapidjson.autopkg create mode 100644 3rdparty/rapidjson/readme.md create mode 100644 3rdparty/rapidjson/readme.zh-cn.md create mode 100644 3rdparty/rapidjson/test/CMakeLists.txt create mode 100644 3rdparty/rapidjson/test/perftest/CMakeLists.txt create mode 100644 3rdparty/rapidjson/test/perftest/misctest.cpp create mode 100644 3rdparty/rapidjson/test/perftest/perftest.cpp create mode 100644 3rdparty/rapidjson/test/perftest/perftest.h create mode 100644 3rdparty/rapidjson/test/perftest/platformtest.cpp create mode 100644 3rdparty/rapidjson/test/perftest/rapidjsontest.cpp create mode 100644 3rdparty/rapidjson/test/perftest/schematest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/CMakeLists.txt create mode 100644 3rdparty/rapidjson/test/unittest/allocatorstest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/bigintegertest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/documenttest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/dtoatest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/encodedstreamtest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/encodingstest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/filestreamtest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/fwdtest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/istreamwrappertest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/itoatest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/jsoncheckertest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/namespacetest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/ostreamwrappertest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/pointertest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/prettywritertest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/readertest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/regextest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/schematest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/simdtest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/strfunctest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/stringbuffertest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/strtodtest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/unittest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/unittest.h create mode 100644 3rdparty/rapidjson/test/unittest/valuetest.cpp create mode 100644 3rdparty/rapidjson/test/unittest/writertest.cpp create mode 100644 3rdparty/rapidjson/travis-doxygen.sh diff --git a/3rdparty/rapidjson/.gitignore b/3rdparty/rapidjson/.gitignore new file mode 100644 index 00000000000..2c412c2bba9 --- /dev/null +++ b/3rdparty/rapidjson/.gitignore @@ -0,0 +1,24 @@ +/bin/* +!/bin/data +!/bin/encodings +!/bin/jsonchecker +!/bin/types +/build +/doc/html +/doc/doxygen_*.db +*.a + +# Temporary files created during CMake build +CMakeCache.txt +CMakeFiles +cmake_install.cmake +CTestTestfile.cmake +Makefile +RapidJSON*.cmake +RapidJSON.pc +Testing +/googletest +install_manifest.txt +Doxyfile +DartConfiguration.tcl +*.nupkg diff --git a/3rdparty/rapidjson/.gitmodules b/3rdparty/rapidjson/.gitmodules new file mode 100644 index 00000000000..8e9d1f376c2 --- /dev/null +++ b/3rdparty/rapidjson/.gitmodules @@ -0,0 +1,3 @@ +[submodule "thirdparty/gtest"] + path = thirdparty/gtest + url = https://chromium.googlesource.com/external/googletest.git diff --git a/3rdparty/rapidjson/.travis.yml b/3rdparty/rapidjson/.travis.yml new file mode 100644 index 00000000000..78fe1d54615 --- /dev/null +++ b/3rdparty/rapidjson/.travis.yml @@ -0,0 +1,54 @@ +language: cpp + +compiler: + - clang + - gcc + +env: + matrix: + - CONF=debug ARCH=x86_64 CXX11=ON + - CONF=release ARCH=x86_64 CXX11=ON + - CONF=debug ARCH=x86 CXX11=ON + - CONF=release ARCH=x86 CXX11=ON + - CONF=debug ARCH=x86_64 CXX11=OFF + - CONF=debug ARCH=x86 CXX11=OFF + global: + - ARCH_FLAGS_x86='-m32' # #266: don't use SSE on 32-bit + - ARCH_FLAGS_x86_64='-msse4.2' # use SSE4.2 on 64-bit + - GITHUB_REPO='miloyip/rapidjson' + - secure: "HrsaCb+N66EG1HR+LWH1u51SjaJyRwJEDzqJGYMB7LJ/bfqb9mWKF1fLvZGk46W5t7TVaXRDD5KHFx9DPWvKn4gRUVkwTHEy262ah5ORh8M6n/6VVVajeV/AYt2C0sswdkDBDO4Xq+xy5gdw3G8s1A4Inbm73pUh+6vx+7ltBbk=" + +before_install: + - sudo apt-get update -qq + - sudo apt-get install -qq cmake valgrind + - sudo apt-get --no-install-recommends install doxygen # Don't install LaTeX stuffs + - if [ "$ARCH" = "x86" ]; then sudo apt-get install -qq g++-multilib libc6-dbg:i386; fi + - if [ "$CC" = "gcc" ] && [ "$CONF" = "debug" ]; then sudo pip install cpp-coveralls; export GCOV_FLAGS='--coverage'; fi + +install: true + +before_script: +# hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469), +# exposed by merging PR#163 (using -march=native) + - sed -i "s/-march=native//" CMakeLists.txt + - mkdir build + - > + eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ; + (cd build && cmake + -DRAPIDJSON_HAS_STDSTRING=ON + -DRAPIDJSON_BUILD_CXX11=$CXX11 + -DCMAKE_VERBOSE_MAKEFILE=ON + -DCMAKE_BUILD_TYPE=$CONF + -DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS" + -DCMAKE_EXE_LINKER_FLAGS=$GCOV_FLAGS + ..) + +script: + - cd build + - make tests + - make examples + - ctest -V `[ "$CONF" = "release" ] || echo "-E perftest"` + - make travis_doc + +after_success: + - coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h diff --git a/3rdparty/rapidjson/CHANGELOG.md b/3rdparty/rapidjson/CHANGELOG.md new file mode 100644 index 00000000000..8ad9b3c351f --- /dev/null +++ b/3rdparty/rapidjson/CHANGELOG.md @@ -0,0 +1,79 @@ +# Change Log +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](http://semver.org/). + +## [Unreleased] + +## [1.0.2] - 2015-05-14 + +### Added +* Add Value::XXXMember(...) overloads for std::string (#335) + +### Fixed +* Include rapidjson.h for all internal/error headers. +* Parsing some numbers incorrectly in full-precision mode (`kFullPrecisionParseFlag`) (#342) +* Fix alignment of 64bit platforms (#328) +* Fix MemoryPoolAllocator::Clear() to clear user-buffer (0691502573f1afd3341073dd24b12c3db20fbde4) + +### Changed +* CMakeLists for include as a thirdparty in projects (#334, #337) +* Change Document::ParseStream() to use stack allocator for Reader (ffbe38614732af8e0b3abdc8b50071f386a4a685) + +## [1.0.1] - 2015-04-25 + +### Added +* Changelog following [Keep a CHANGELOG](https://github.com/olivierlacan/keep-a-changelog) suggestions. + +### Fixed +* Parsing of some numbers (e.g. "1e-00011111111111") causing assertion (#314). +* Visual C++ 32-bit compilation error in `diyfp.h` (#317). + +## [1.0.0] - 2015-04-22 + +### Added +* 100% [Coverall](https://coveralls.io/r/miloyip/rapidjson?branch=master) coverage. +* Version macros (#311) + +### Fixed +* A bug in trimming long number sequence (4824f12efbf01af72b8cb6fc96fae7b097b73015). +* Double quote in unicode escape (#288). +* Negative zero roundtrip (double only) (#289). +* Standardize behavior of `memcpy()` and `malloc()` (0c5c1538dcfc7f160e5a4aa208ddf092c787be5a, #305, 0e8bbe5e3ef375e7f052f556878be0bd79e9062d). + +### Removed +* Remove an invalid `Document::ParseInsitu()` API (e7f1c6dd08b522cfcf9aed58a333bd9a0c0ccbeb). + +## 1.0-beta - 2015-04-8 + +### Added +* RFC 7159 (#101) +* Optional Iterative Parser (#76) +* Deep-copy values (#20) +* Error code and message (#27) +* ASCII Encoding (#70) +* `kParseStopWhenDoneFlag` (#83) +* `kParseFullPrecisionFlag` (881c91d696f06b7f302af6d04ec14dd08db66ceb) +* Add `Key()` to handler concept (#134) +* C++11 compatibility and support (#128) +* Optimized number-to-string and vice versa conversions (#137, #80) +* Short-String Optimization (#131) +* Local stream optimization by traits (#32) +* Travis & Appveyor Continuous Integration, with Valgrind verification (#24, #242) +* Redo all documentation (English, Simplified Chinese) + +### Changed +* Copyright ownership transfered to THL A29 Limited (a Tencent company). +* Migrating from Premake to CMAKE (#192) +* Resolve all warning reports + +### Removed +* Remove other JSON libraries for performance comparison (#180) + +## 0.11 - 2012-11-16 + +## 0.1 - 2011-11-18 + +[Unreleased]: https://github.com/miloyip/rapidjson/compare/v1.0.2...HEAD +[1.0.2]: https://github.com/miloyip/rapidjson/compare/v1.0.1...v1.0.2 +[1.0.1]: https://github.com/miloyip/rapidjson/compare/v1.0.0...v1.0.1 +[1.0.0]: https://github.com/miloyip/rapidjson/compare/v1.0-beta...v1.0.0 diff --git a/3rdparty/rapidjson/CMakeLists.txt b/3rdparty/rapidjson/CMakeLists.txt new file mode 100644 index 00000000000..fcacbd3c5ec --- /dev/null +++ b/3rdparty/rapidjson/CMakeLists.txt @@ -0,0 +1,128 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules) + +PROJECT(RapidJSON CXX) + +set(LIB_MAJOR_VERSION "1") +set(LIB_MINOR_VERSION "0") +set(LIB_PATCH_VERSION "2") +set(LIB_VERSION_STRING "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_PATCH_VERSION}") + +# compile in release with debug info mode by default +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) +endif() + +# Build all binaries in a separate directory +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +option(RAPIDJSON_BUILD_DOC "Build rapidjson documentation." ON) +option(RAPIDJSON_BUILD_EXAMPLES "Build rapidjson examples." ON) +option(RAPIDJSON_BUILD_TESTS "Build rapidjson perftests and unittests." ON) +option(RAPIDJSON_BUILD_THIRDPARTY_GTEST + "Use gtest installation in `thirdparty/gtest` by default if available" OFF) + +option(RAPIDJSON_BUILD_CXX11 "Build rapidjson with C++11 (gcc/clang)" ON) + +option(RAPIDJSON_HAS_STDSTRING "" OFF) +if(RAPIDJSON_HAS_STDSTRING) + add_definitions(-DRAPIDJSON_HAS_STDSTRING) +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror") + if (RAPIDJSON_BUILD_CXX11) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() + endif() +elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror -Wno-missing-field-initializers") + if (RAPIDJSON_BUILD_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) +endif() + +#add extra search paths for libraries and includes +SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in") +SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE STRING "Directory where lib will install") +SET(DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}" CACHE PATH "Path to the documentation") + +IF(UNIX OR CYGWIN) + SET(_CMAKE_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}") +ELSEIF(WIN32) + SET(_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/cmake") +ENDIF() +SET(CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" CACHE PATH "The directory cmake fiels are installed in") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) + +if(RAPIDJSON_BUILD_DOC) + add_subdirectory(doc) +endif() + +add_custom_target(travis_doc) +add_custom_command(TARGET travis_doc + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/travis-doxygen.sh) + +if(RAPIDJSON_BUILD_EXAMPLES) + add_subdirectory(example) +endif() + +if(RAPIDJSON_BUILD_TESTS) + if(MSVC11) + # required for VS2012 due to missing support for variadic templates + add_definitions(-D_VARIADIC_MAX=10) + endif(MSVC11) + add_subdirectory(test) + include(CTest) +endif() + +# pkg-config +IF (UNIX OR CYGWIN) + CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc + @ONLY) + INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc + DESTINATION "${LIB_INSTALL_DIR}/pkgconfig" + COMPONENT pkgconfig) +ENDIF() + +install(FILES readme.md + DESTINATION "${DOC_INSTALL_DIR}" + COMPONENT doc) + +install(DIRECTORY include/rapidjson + DESTINATION "${INCLUDE_INSTALL_DIR}" + COMPONENT dev) + +install(DIRECTORY example/ + DESTINATION "${DOC_INSTALL_DIR}/examples" + COMPONENT examples + # Following patterns are for excluding the intermediate/object files + # from an install of in-source CMake build. + PATTERN "CMakeFiles" EXCLUDE + PATTERN "Makefile" EXCLUDE + PATTERN "cmake_install.cmake" EXCLUDE) + +# Provide config and version files to be used by other applications +# =============================== + +export(PACKAGE ${PROJECT_NAME}) + +# cmake-modules +CONFIGURE_FILE(${PROJECT_NAME}Config.cmake.in + ${PROJECT_NAME}Config.cmake + @ONLY) +CONFIGURE_FILE(${PROJECT_NAME}ConfigVersion.cmake.in + ${PROJECT_NAME}ConfigVersion.cmake + @ONLY) +INSTALL(FILES + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake + DESTINATION "${CMAKE_INSTALL_DIR}" + COMPONENT dev) diff --git a/3rdparty/rapidjson/CMakeModules/FindGTestSrc.cmake b/3rdparty/rapidjson/CMakeModules/FindGTestSrc.cmake new file mode 100644 index 00000000000..f942a8dafcd --- /dev/null +++ b/3rdparty/rapidjson/CMakeModules/FindGTestSrc.cmake @@ -0,0 +1,30 @@ + +SET(GTEST_SEARCH_PATH + "${GTEST_SOURCE_DIR}" + "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/gtest") + +IF(UNIX) + IF(RAPIDJSON_BUILD_THIRDPARTY_GTEST) + LIST(APPEND GTEST_SEARCH_PATH "/usr/src/gtest") + ELSE() + LIST(INSERT GTEST_SEARCH_PATH 1 "/usr/src/gtest") + ENDIF() +ENDIF() + +FIND_PATH(GTEST_SOURCE_DIR + NAMES CMakeLists.txt src/gtest_main.cc + PATHS ${GTEST_SEARCH_PATH}) + + +# Debian installs gtest include directory in /usr/include, thus need to look +# for include directory separately from source directory. +FIND_PATH(GTEST_INCLUDE_DIR + NAMES gtest/gtest.h + PATH_SUFFIXES include + HINTS ${GTEST_SOURCE_DIR} + PATHS ${GTEST_SEARCH_PATH}) + +INCLUDE(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GTestSrc DEFAULT_MSG + GTEST_SOURCE_DIR + GTEST_INCLUDE_DIR) diff --git a/3rdparty/rapidjson/RapidJSON.pc.in b/3rdparty/rapidjson/RapidJSON.pc.in new file mode 100644 index 00000000000..7467f9779b8 --- /dev/null +++ b/3rdparty/rapidjson/RapidJSON.pc.in @@ -0,0 +1,7 @@ +includedir=@INCLUDE_INSTALL_DIR@ + +Name: @PROJECT_NAME@ +Description: A fast JSON parser/generator for C++ with both SAX/DOM style API +Version: @LIB_VERSION_STRING@ +URL: https://github.com/miloyip/rapidjson +Cflags: -I${includedir} diff --git a/3rdparty/rapidjson/RapidJSONConfig.cmake.in b/3rdparty/rapidjson/RapidJSONConfig.cmake.in new file mode 100644 index 00000000000..9fa12186ab6 --- /dev/null +++ b/3rdparty/rapidjson/RapidJSONConfig.cmake.in @@ -0,0 +1,3 @@ +get_filename_component(RAPIDJSON_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(RAPIDJSON_INCLUDE_DIRS "@INCLUDE_INSTALL_DIR@") +message(STATUS "RapidJSON found. Headers: ${RAPIDJSON_INCLUDE_DIRS}") diff --git a/3rdparty/rapidjson/RapidJSONConfigVersion.cmake.in b/3rdparty/rapidjson/RapidJSONConfigVersion.cmake.in new file mode 100644 index 00000000000..25741fc0976 --- /dev/null +++ b/3rdparty/rapidjson/RapidJSONConfigVersion.cmake.in @@ -0,0 +1,10 @@ +SET(PACKAGE_VERSION "@LIB_VERSION_STRING@") + +IF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + SET(PACKAGE_VERSION_EXACT "true") +ENDIF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) +IF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) + SET(PACKAGE_VERSION_COMPATIBLE "true") +ELSE (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) + SET(PACKAGE_VERSION_UNSUITABLE "true") +ENDIF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) diff --git a/3rdparty/rapidjson/appveyor.yml b/3rdparty/rapidjson/appveyor.yml new file mode 100644 index 00000000000..7d586e83a48 --- /dev/null +++ b/3rdparty/rapidjson/appveyor.yml @@ -0,0 +1,28 @@ +version: 1.0.2.{build} + +configuration: +- Debug +- Release + +environment: + matrix: + - VS_VERSION: 11 + VS_PLATFORM: win32 + - VS_VERSION: 11 + VS_PLATFORM: x64 + - VS_VERSION: 12 + VS_PLATFORM: win32 + - VS_VERSION: 12 + VS_PLATFORM: x64 + +before_build: +- git submodule update --init --recursive +- cmake -H. -BBuild/VS -G "Visual Studio %VS_VERSION%" -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% -DBUILD_SHARED_LIBS=true -Wno-dev + +build: + project: Build\VS\RapidJSON.sln + parallel: true + verbosity: minimal + +test_script: +- cd Build\VS && if %CONFIGURATION%==Debug (ctest --verbose -E perftest --build-config %CONFIGURATION%) else (ctest --verbose --build-config %CONFIGURATION%) diff --git a/3rdparty/rapidjson/bin/data/glossary.json b/3rdparty/rapidjson/bin/data/glossary.json new file mode 100644 index 00000000000..d5ca56d1950 --- /dev/null +++ b/3rdparty/rapidjson/bin/data/glossary.json @@ -0,0 +1,22 @@ +{ + "glossary": { + "title": "example glossary", + "GlossDiv": { + "title": "S", + "GlossList": { + "GlossEntry": { + "ID": "SGML", + "SortAs": "SGML", + "GlossTerm": "Standard Generalized Markup Language", + "Acronym": "SGML", + "Abbrev": "ISO 8879:1986", + "GlossDef": { + "para": "A meta-markup language, used to create markup languages such as DocBook.", + "GlossSeeAlso": ["GML", "XML"] + }, + "GlossSee": "markup" + } + } + } + } +} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/data/menu.json b/3rdparty/rapidjson/bin/data/menu.json new file mode 100644 index 00000000000..acdf930ea5f --- /dev/null +++ b/3rdparty/rapidjson/bin/data/menu.json @@ -0,0 +1,27 @@ +{"menu": { + "header": "SVG Viewer", + "items": [ + {"id": "Open"}, + {"id": "OpenNew", "label": "Open New"}, + null, + {"id": "ZoomIn", "label": "Zoom In"}, + {"id": "ZoomOut", "label": "Zoom Out"}, + {"id": "OriginalView", "label": "Original View"}, + null, + {"id": "Quality"}, + {"id": "Pause"}, + {"id": "Mute"}, + null, + {"id": "Find", "label": "Find..."}, + {"id": "FindAgain", "label": "Find Again"}, + {"id": "Copy"}, + {"id": "CopyAgain", "label": "Copy Again"}, + {"id": "CopySVG", "label": "Copy SVG"}, + {"id": "ViewSVG", "label": "View SVG"}, + {"id": "ViewSource", "label": "View Source"}, + {"id": "SaveAs", "label": "Save As"}, + null, + {"id": "Help"}, + {"id": "About", "label": "About Adobe CVG Viewer..."} + ] +}} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/data/readme.txt b/3rdparty/rapidjson/bin/data/readme.txt new file mode 100644 index 00000000000..c53bfb8b726 --- /dev/null +++ b/3rdparty/rapidjson/bin/data/readme.txt @@ -0,0 +1 @@ +sample.json is obtained from http://code.google.com/p/json-test-suite/downloads/detail?name=sample.zip diff --git a/3rdparty/rapidjson/bin/data/sample.json b/3rdparty/rapidjson/bin/data/sample.json new file mode 100644 index 00000000000..30930e765dc --- /dev/null +++ b/3rdparty/rapidjson/bin/data/sample.json @@ -0,0 +1,3315 @@ +{ + "a": { + "6U閆崬밺뀫颒myj츥휘:$薈mY햚#rz飏+玭V㭢뾿愴YꖚX亥ᮉ푊\u0006垡㐭룝\"厓ᔧḅ^Sqpv媫\"⤽걒\"˽Ἆ?ꇆ䬔未tv{DV鯀Tἆl凸g\\㈭ĭ즿UH㽤": null, + "b茤z\\.N": [[ + "ZL:ᅣዎ*Y|猫劁櫕荾Oj为1糕쪥泏S룂w࡛Ᏺ⸥蚙)", + { + "\"䬰ỐwD捾V`邀⠕VD㺝sH6[칑.:醥葹*뻵倻aD\"": true, + "e浱up蔽Cr෠JK軵xCʨ<뜡癙Y獩ケ齈X/螗唻?<蘡+뷄㩤쳖3偑犾&\\첊xz坍崦ݻ鍴\"嵥B3㰃詤豺嚼aqJ⑆∥韼@\u000b㢊\u0015L臯.샥": false, + "l?Ǩ喳e6㔡$M꼄I,(3᝝縢,䊀疅뉲B㴔傳䂴\u0088㮰钘ꜵ!ᅛ韽>": -5514085325291784739, + "o㮚?\"춛㵉<\/﬊ࠃ䃪䝣wp6ἀ䱄[s*S嬈貒pᛥ㰉'돀": [{ + "(QP윤懊FI<ꃣ『䕷[\"珒嶮?%Ḭ壍಻䇟0荤!藲끹bd浶tl\u2049#쯀@僞": {"i妾8홫": { + ",M맃䞛K5nAㆴVN㒊햬$n꩑&ꎝ椞阫?/ṏ세뉪1x쥼㻤㪙`\"$쟒薟B煌܀쨝ଢ଼2掳7㙟鴙X婢\u0002": "Vዉ菈᧷⦌kﮞఈnz*﷜FM\"荭7ꍀ-VR<\/';䁙E9$䩉\f @s?퍪o3^衴cඎ䧪aK鼟q䆨c{䳠5mᒲՙ蘹ᮩ": { + "F㲷JGo⯍P덵x뒳p䘧☔\"+ꨲ吿JfR㔹)4n紬G练Q፞!C|": true, + "p^㫮솎oc.೚A㤠??r\u000f)⾽⌲們M2.䴘䩳:⫭胃\\፾@Fᭌ\\K": false, + "蟌Tk愙潦伩": { + "a<\/@ᾛ慂侇瘎": -7271305752851720826, + "艓藬/>၄ṯ,XW~㲆w": {"E痧郶)㜓ha朗!N赻瞉駠uC\u20ad辠x퓮⣫P1ࠫLMMX'M刼唳됤": null, + "P쓫晥%k覛ዩIUᇸ滨:噐혲lMR5䋈V梗>%幽u頖\\)쟟": null, + "eg+昉~矠䧞难\b?gQ쭷筝\\eꮠNl{ಢ哭|]Mn銌╥zꖘzⱷ⭤ᮜ^": [ + -1.30142114406914976E17, + -1.7555215491128452E-19, + null, + "渾㨝ߏ牄귛r?돌?w[⚞ӻ~廩輫㼧/", + -4.5737191805302129E18, + null, + "xy࿑M[oc셒竓Ⓔx?뜓y䊦>-D켍(&&?XKkc꩖ﺸᏋ뵞K伕6ী)딀P朁yW揙?훻魢傎EG碸9類៌g踲C⟌aEX舲:z꒸许", + 3808159498143417627, + null, + {"m試\u20df1{G8&뚈h홯J<\/": { + "3ஸ厠zs#1K7:rᥞoꅔꯧ&띇鵼鞫6跜#赿5l'8{7㕳(b/j\"厢aq籀ꏚ\u0015厼稥": [ + -2226135764510113982, + true, + null, + { + "h%'맞S싅Hs&dl슾W0j鿏MםD놯L~S-㇡R쭬%": null, + "⟓咔謡칲\u0000孺ꛭx旑檉㶆?": null, + "恇I転;￸B2Y`z\\獓w,놏濐撐埵䂄)!䶢D=ഭ㴟jyY": { + "$ࡘt厛毣ൢI芁<겿骫⫦6tr惺a": [ + 6.385779736989334E-20, + false, + true, + true, + [ + -6.891946211462334E-19, + null, + { + "]-\\Ꟑ1/薓❧Ὂ\\l牑\u0007A郃)阜ᇒᓌ-塯`W峬G}SDb㬨Q臉⮻빌O鞟톴첂B㺱<ƈmu챑J㴹㷳픷Oㆩs": { + "\"◉B\"pᶉt骔J꩸ᄇᛐi╰栛K쉷㉯鐩!㈐n칍䟅難>盥y铿e୔蒏M貹ヅ8嘋퀯䉶ጥ㏢殊뻳\"絧╿ꉑ䠥?∃蓊{}㣣Gk긔H1哵峱": false, + "6.瀫cN䇮F㧺?\\椯=ڈT䘆4␘8qv": -3.5687501019676885E-19, + "Q?yऴr혴{஀䳘p惭f1ﹸ䅷䕋贲<ྃᄊ繲hq\\b|#QSTs1c-7(䵢\u2069匏絘ꯉ:l毴汞t戀oෟᵶ뮱፣-醇Jx䙬䐁햢0࣫ᡁgrㄛ": "\u0011_xM/蘇Chv;dhA5.嗀绱V爤ﰦi뵲M", + "⏑[\"ugoy^儣횎~U\\섯겜論l2jw஌yD腅̂\u0019": true, + "ⵯɇ䐲᫿࢚!㯢l샅笶戮1꣖0Xe": null, + "劅f넀識b宁焊E찓橵G!ʱ獓뭔雩괛": [{"p⹣켙[q>燣䍃㞽ᩲx:쓤삘7玑퇼0<\/q璂ᑁ[Z\\3䅵䧳\u0011㤧|妱緒C['췓Yꞟ3Z鳱雼P錻BU씧U`ᢶg蓱>.1ӧ譫'L_5V䏵Ц": [ + false, + false, + {"22䂍盥N霂얢躰e9⑩_뵜斌n@B}$괻Yᐱ@䧋V\"☒-諯cV돯ʠ": true, + "Ű螧ᔼ檍鍎땒딜qꄃH뜣<獧ूCY吓⸏>XQ㵡趌o끬k픀빯a(ܵ甏끆୯/6Nᪧ}搚ᆚ짌P牰泱鈷^d꣟#L삀\"㕹襻;k㸊\\f+": true, + "쎣\",|⫝̸阊x庿k잣v庅$鈏괎炔k쬪O_": [ + "잩AzZGz3v愠ꉈⵎ?㊱}S尳௏p\r2>췝IP䘈M)w|\u000eE", + -9222726055990423201, + null, + [ + false, + {"´킮'뮤쯽Wx讐V,6ᩪ1紲aႈ\u205czD": [ + -930994432421097536, + 3157232031581030121, + "l貚PY䃛5@䭄귻m㎮琸f": 1.0318894506812084E-19, + "࢜⩢Ш䧔1肽씮+༎ᣰ闺馺窃䕨8Mƶq腽xc(៯夐J5굄䕁Qj_훨/~価.䢵慯틠퇱豠㼇Qﵘ$DuSp(8Uญ<\/ಟ룴𥳐ݩ$": 8350772684161555590, + "ㆎQ䄾\u001bpᩭ${[諟^^骴᤮b^ㅥI┧T㉇⾞\"绦r䰂f矩'-7䡭桥Dz兔V9谶居㺍ᔊ䩯덲.\u001eL0ὅㅷ釣": [{ + "<쯬J卷^숞u࠯䌗艞R9닪g㐾볎a䂈歖意:%鐔|ﵤ|y}>;2,覂⶚啵tb*仛8乒㓶B࿠㯉戩oX 貘5V嗆렽낁߼4h䧛ꍺM空\\b꿋貼": 8478577078537189402, + "VD*|吝z~h譺aᯒ": { + "YI췢K<\/濳xNne玗rJo쾘3핰鴊\"↱AR:ࢷ\"9?\"臁說)?誚ꊏe)_D翾W?&F6J@뺾ꍰNZ醊Z쾈വH嶿?炫㷱鬰M겈᭨b,⻁鈵P䕡䀠८ⱄ홎鄣": { + "@?k2鶖㋮\"Oರ K㨇廪儲\u0017䍾J?);\b*묀㗠섳햭1MC V": null, + "UIICP!BUA`ᢈ㋸~袩㗪⾒=fB﮴l1ꡛ죘R辂여ҳ7쮡<䩲`熕8頁": 4481809488267626463, + "Y?+8먙ᚔ鋳蜩럶1㥔y璜౩`": [ + null, + 1.2850335807501874E-19, + "~V2", + 2035406654801997866, + { + "<숻1>\"": -8062468865199390827, + "M㿣E]}qwG莎Gn᝶(ꔙ\\D⬲iꇲs寢t駇S뀡ꢜ": false, + "pꝤ㎏9W%>M;-U璏f(^j1?&RB隧 忓b똊E": "#G?C8.躬ꥯ'?냪#< 渟&헿란zpo왓Kj}鷧XﻘMツb䕖;㪻", + "vE풤幉xz뱕쫥Ug㦲aH} ᣟp:鬼YᰟH3镔ᴚ斦\\鏑r*2橱G⼔F/.j": true, + "RK좬뎂a홠f*f㱉ᮍ⦋潙㨋Gu곌SGI3I뿐\\F',)t`荁蘯囯ﮉ裲뇟쥼_ገ驪▵撏ᕤV": 1.52738225997956557E18, + "^k굲䪿꠹B逤%F㱢漥O披M㽯镞竇霒i꼂焅륓\u00059=皫之눃\u2047娤閍銤唫ၕb<\/w踲䔼u솆맚,䝒ᝳ'/it": "B餹饴is権ꖪ怯ꦂẉဎt\"!凢谵⧿0\\<=(uL䷍刨쑪>俆揓Cy襸Q힆䆭涷<\/ᐱ0ɧ䗾䚹\\ኜ?ꄢᇘ`䴢{囇}᠈䴥X4퓪檄]ꥷ/3謒ሴn+g騍X", + "GgG꽬[(嫓몍6\u0004궍宩㙻/>\u0011^辍dT腪hxǑ%ꊇk,8(W⧂結P鬜O": [{ + "M㴾c>\\ᓲ\u0019V{>ꤩ혙넪㭪躂TS-痴໸闓⍵/徯O.M㏥ʷD囎⧔쁳휤T??鉬뇙=#ꢫ숣BX䭼<\/d똬졬g榿)eꨋﯪ좇첻\u001a\u0011\";~쓆BH4坋攊7힪", + "iT:L闞椕윚*滛gI≀Wਟඊ'ꢆ縺뱹鮚Nꩁ᧬蕼21줧\\䋯``⍐\\㏱鳨": 1927052677739832894, + "쮁缦腃g]礿Y㬙 fヺSɪ꾾N㞈": [ + null, + null, + { + "!t,灝Y 1䗉罵?c饃호䉂Cᐭ쒘z(즽sZG㬣sഖE4뢜㓕䏞丮Qp簍6EZឪ겛fx'ꩱQ0罣i{k锩*㤴㯞r迎jTⲤ渔m炅肳": [ + -3.3325685522591933E18, + [{"㓁5]A䢕1룥BC?Ꙍ`r룔Ⳛ䙡u伲+\u0001്o": [ + null, + 4975309147809803991, + null, + null, + {"T팘8Dﯲ稟MM☻㧚䥧/8ﻥ⥯aXLaH\"顾S☟耲ît7fS෉놁뮔/ꕼ䓈쁺4\\霶䠴ᩢ<\/t4?죵>uD5➶༆쉌럮⢀秙䘥\u20972ETR3濡恆vB? ~鸆\u0005": { + "`閖m璝㥉b뜴?Wf;?DV콜\u2020퍉౓擝宏ZMj3mJ먡-傷뱙yח㸷꥿ ໘u=M읝!5吭L4v\\?ǎ7C홫": null, + "|": false, + "~Ztᛋ䚘\\擭㗝傪W陖+㗶qᵿ蘥ᙄp%䫎)}=⠔6ᮢS湟-螾-mXH?cp": 448751162044282216, + "\u209fad놹j檋䇌ᶾ梕㉝bוּ": {"?苴ꩠD䋓帘5騱qﱖPF?☸珗顒yU ᡫcb䫎 S@㥚gꮒ쎘泴멖\\:I鮱TZ듒ᶨQ3+f7캙\"?\f풾\\o杞紟﻽M.⏎靑OP": [ + -2.6990368911551596E18, + [{"䒖@<᰿<\/⽬tTr腞&G%᳊秩蜰擻f㎳?S㵧\r*k뎾-乢겹隷j軛겷0룁鮁": {")DO0腦:춍逿:1㥨่!蛍樋2": [{ + ",ꌣf侴笾m๫ꆽ?1?U?\u0011ꌈꂇ": { + "x捗甠nVq䅦w`CD⦂惺嘴0I#vỵ} \\귂S끴D얾?Ԓj溯\"v餄a": { + "@翙c⢃趚痋i\u0015OQ⍝lq돆Y0pࢥ3쉨䜩^<8g懥0w)]䊑n洺o5쭝QL댊랖L镈Qnt⪟㒅십q헎鳒⮤眉ᔹ梠@O縠u泌ㄘb榚癸XޔFtj;iC": false, + "I&뱋゘|蓔䔕측瓯%6ᗻHW\\N1貇#?僐ᗜgh᭪o'䗈꽹Rc욏/蔳迄༝!0邔䨷푪8疩)[쭶緄㇈୧ፐ": { + "B+:ꉰ`s쾭)빼C羍A䫊pMgjdx䐝Hf9᥸W0!C樃'蘿f䫤סи\u0017Jve? 覝f둀⬣퓉Whk\"஼=չﳐ皆笁BIW虨쫓F廰饞": -642906201042308791, + "sb,XcZ<\/m㉹ ;䑷@c䵀s奤⬷7`ꘖ蕘戚?Feb#輜}p4nH⬮eKL트}": [ + "RK鳗z=袤Pf|[,u욺", + "Ẏᏻ罯뉋⺖锅젯㷻{H䰞쬙-쩓D]~\u0013O㳢gb@揶蔉|kᦂ❗!\u001ebM褐sca쨜襒y⺉룓", + null, + null, + true, + -1.650777344339075E-19, + false, + "☑lꄆs힨꤇]'uTന⌳농].1⋔괁沰\"IWഩ\u0019氜8쟇䔻;3衲恋,窌z펏喁횗?4?C넁问?ᥙ橭{稻Ⴗ_썔", + "n?]讇빽嗁}1孅9#ꭨ靶v\u0014喈)vw祔}룼쮿I", + -2.7033457331882025E18, + { + ";⚃^㱋x:饬ኡj'꧵T☽O㔬RO婎?향ᒭ搩$渣y4i;(Q>꿘e8q": "j~錘}0g;L萺*;ᕭꄮ0l潛烢5H▄쳂ꏒוֹꙶT犘≫x閦웧v", + "~揯\u2018c4職렁E~ᑅቚꈂ?nq뎤.:慹`F햘+%鉎O瀜쟏敛菮⍌浢<\/㮺紿P鳆ࠉ8I-o?#jﮨ7v3Dt赻J9": null, + "ࣝW䌈0ꍎqC逖,횅c၃swj;jJS櫍5槗OaB>D踾Y": {"㒰䵝F%?59.㍈cᕨ흕틎ḏ㋩B=9IېⓌ{:9.yw}呰ㆮ肒᎒tI㾴62\"ዃ抡C﹬B<\/촋jo朣", + [ + -7675533242647793366, + {"ᙧ呃:[㒺쳀쌡쏂H稈㢤\u001dᶗGG-{GHྻຊꡃ哸䵬;$?&d\\⥬こN圴됤挨-'ꕮ$PU%?冕눖i魁q騎Q": [ + false, + [[ + 7929823049157504248, + [[ + true, + "Z菙\u0017'eꕤ᱕l,0\\X\u001c[=雿8蠬L<\/낲긯W99g톉4ퟋb㝺\u0007劁'!麕Q궈oW:@X၎z蘻m絙璩귓죉+3柚怫tS捇蒣䝠-擶D[0=퉿8)q0ٟ", + "唉\nFA椭穒巯\\䥴䅺鿤S#b迅獘 ﶗ꬘\\?q1qN犠pX꜅^䤊⛤㢌[⬛휖岺q唻ⳡ틍\"㙙Eh@oA賑㗠y必Nꊑᗘ", + -2154220236962890773, + -3.2442003245397908E18, + "Wᄿ筠:瘫퀩?o貸q⊻(᎞KWf宛尨h^残3[U(='橄", + -7857990034281549164, + 1.44283696979059942E18, + null, + {"ꫯAw跭喀 ?_9\"Aty背F=9缉ྦྷ@;?^鞀w:uN㘢Rỏ": [ + 7.393662029337442E15, + 3564680942654233068, + [ + false, + -5253931502642112194, + "煉\\辎ೆ罍5⒭1䪁䃑s䎢:[e5}峳ﴱn騎3?腳Hyꏃ膼N潭錖,Yᝋ˜YAၓ㬠bG렣䰣:", + true, + null, + { + "⒛'P&%죮|:⫶춞": -3818336746965687085, + "钖m<\/0ݎMtF2Pk=瓰୮洽겎.": [[ + -8757574841556350607, + -3045234949333270161, + null, + { + "Ꮬr輳>⫇9hU##w@귪A\\C 鋺㘓ꖐ梒뒬묹㹻+郸嬏윤'+g<\/碴,}ꙫ>손;情d齆J䬁ຩ撛챝탹/R澡7剌tꤼ?ặ!`⏲睤\u00002똥଴⟏": null, + "\u20f2ܹe\\tAꥍư\\x当뿖렉禛;G檳ﯪS૰3~㘠#[J<}{奲 5箉⨔{놁<\/釿抋,嚠/曳m&WaOvT赋皺璑텁": [[ + false, + null, + true, + -5.7131445659795661E18, + "萭m䓪D5|3婁ఞ>蠇晼6nﴺPp禽羱DS<睓닫屚삏姿", + true, + [ + -8759747687917306831, + { + ">ⓛ\t,odKr{䘠?b퓸C嶈=DyEᙬ@ᴔ쨺芛髿UT퓻春<\/yꏸ>豚W釺N뜨^?꽴﨟5殺ᗃ翐%>퍂ဿ䄸沂Ea;A_\u0005閹殀W+窊?Ꭼd\u0013P汴G5썓揘": 4.342729067882445E-18, + "Q^즾眆@AN\u0011Kb榰냎Y#䝀ꀒᳺ'q暇睵s\"!3#I⊆畼寤@HxJ9": false, + "⿾D[)袨㇩i]웪䀤ᛰMvR<蟏㣨": {"v퇓L㪱ꖣ豛톤\\곱#kDTN": [{ + "(쾴䡣,寴ph(C\"㳶w\"憳2s馆E!n!&柄<\/0Pꈗſ?㿳Qd鵔": {"娇堰孹L錮h嵅⛤躏顒?CglN束+쨣ﺜ\\MrH": {"獞䎇둃ቲ弭팭^ꄞ踦涟XK錆쳞ឌ`;੶S炥騞ଋ褂B៎{ڒ䭷ᶼ靜pI荗虶K$": [{"◖S~躘蒉꫿輜譝Q㽙闐@ᢗ¥E榁iء5┄^B[絮跉ᰥ遙PWi3wㄾⵀDJ9!w㞣ᄎ{듒ꓓb6\\篴??c⼰鶹⟧\\鮇ꮇ": [[ + 654120831325413520, + -1.9562073916357608E-19, + { + "DC(昐衵ἡ긙갵姭|֛[t": 7.6979110359897907E18, + "J␅))嫼❳9Xfd飉j7猬ᩉ+⤻眗벎E鰉Zᄊ63zၝ69}ZᶐL崭ᦥ⡦靚⋛ꎨ~i㨃咊ꧭo䰠阀3C(": -3.5844809362512589E17, + "p꣑팱쒬ꎑ뛡Ꙩ挴恍胔&7ᔈ묒4Hd硶훐㎖zꢼ豍㿢aሃ=<\/湉鵲EӅ%$F!퍶棌孼{O駍਺geu+": ")\u001b잓kŀX쩫A밁®ڣ癦狢)扔弒p}k縕ꩋ,䃉tࣼi", + "ァF肿輸<솄G-䢹䛸ꊏl`Tqꕗ蒞a氷⸅ᴉ蠰]S/{J왲m5{9.uέ~㕚㣹u>x8U讁B덺襪盎QhVS맅킃i识{벂磄Iහ䙅xZy/抍૭Z鲁-霳V据挦ℒ": null, + "㯛|Nꐸb7ⵐb?拠O\u0014ކ?-(EꞨ4ꕷᄤYᯕOW瞺~螸\"욿ќe㺰\"'㌢ƐW\u0004瞕>0?V鷵엳": true, + "뤥G\\迋䠿[庩'꼡\u001aiᩮV쯁ᳪ䦪Ô;倱ନ뛁誈": null, + "쥹䄆䚟Q榁䎐᢭<\/2㕣p}HW蟔|䃏꿈ꚉ锳2Pb7㙑Tⅹᵅ": { + "Y?֭$>#cVBꩨ:>eL蒁務": { + "86柡0po 䏚&-捑Ћ祌<\/휃-G*㶢הּ쩍s㶟餇c걺yu꽎還5*턧簕Og婥SꝐ": null, + "a+葞h٥ࠆ裈嗫ﵢ5輙퀟ᛜ,QDﹼ⟶Y騠锪E_|x죗j侵;m蜫轘趥?븅w5+mi콛L": { + ";⯭ﱢ!买F⽍柤鶂n䵣V㫚墱2렾ELEl⣆": [ + true, + -3.6479311868339015E-18, + -7270785619461995400, + 3.334081886177621E18, + 2.581457786298155E18, + -6.605252412954115E-20, + -3.9232347037744167E-20, + { + "B6㊕.k1": null, + "ZAꄮJ鮷ᳱo갘硥鈠䠒츼": { + "ᕅ}럡}.@y陪鶁r業'援퀉x䉴ﵴl퍘):씭脴ᥞhiꃰblﲂ䡲엕8߇M㶭0燋標挝-?PCwe⾕J碻Ᾱ䬈䈥뷰憵賣뵓痬+": {"a췩v礗X⋈耓ፊf罅靮!㔽YYᣓw澍33⎔芲F|\"䜏T↮輦挑6ᓘL侘?ᅥ]덆1R௯✎餘6ꏽ<\/௨\\?q喷ꁫj~@ulq": {"嗫欆뾔Xꆹ4H㌋F嵧]ࠎ]㠖1ꞤT<$m뫏O i댳0䲝i": {"?෩?\u20cd슮|ꯆjs{?d7?eNs⢚嫥氂䡮쎱:鑵롟2hJꎒﯭ鱢3춲亄:뼣v䊭諱Yj択cVmR䩃㘬T\"N홝*ै%x^F\\_s9보zz4淗?q": [ + null, + "?", + 2941869570821073737, + "{5{殇0䝾g6밖퍋臩綹R$䖭j紋釰7sXI繳漪행y", + false, + "aH磂?뛡#惇d婅?Fe,쐘+늵䍘\"3r瘆唊勐j⳧࠴ꇓ<\/唕윈x⬌讣䋵%拗ᛆⰿ妴᝔M2㳗必꧂淲?ゥ젯檢<8끒MidX䏒3᳻Q▮佐UT|⤪봦靏⊏", + [[{ + "颉(&뜸귙{y^\"P퟉춝Ჟ䮭D顡9=?}Y誱<$b뱣RvO8cH煉@tk~4ǂ⤧⩝屋SS;J{vV#剤餓ᯅc?#a6D,s": [ + -7.8781018564821536E16, + true, + [ + -2.28770899315832371E18, + false, + -1.0863912140143876E-20, + -6282721572097446995, + 6767121921199223078, + -2545487755405567831, + false, + null, + -9065970397975641765, + [ + -5.928721243413937E-20, + {"6촊\u001a홯kB0w撨燠룉{绎6⳹!턍贑y▾鱧ժ[;7ᨷ∀*땒䪮1x霆Hᩭ☔\"r䝐7毟ᝰr惃3ꉭE+>僒澐": [ + "Ta쎩aƝt쵯ⰪVb", + [ + -5222472249213580702, + null, + -2851641861541559595, + null, + 4808804630502809099, + 5657671602244269874, + "5犲﨣4mᥣ?yf젫꾯|䋬잁$`Iⳉﴷ扳兝,'c", + false, + [ + null, + { + "DyUIN쎾M仼惀⮥裎岶泭lh扠\u001e礼.tEC癯튻@_Qd4c5S熯A<\/\6U윲蹴Q=%푫汹\\\u20614b[௒C⒥Xe⊇囙b,服3ss땊뢍i~逇PA쇸1": -2.63273619193485312E17, + "Mq꺋貘k휕=nK硍뫞輩>㾆~἞ࡹ긐榵l⋙Hw뮢帋M엳뢯v⅃^": 1877913476688465125, + "ᶴ뻗`~筗免⚽টW˃⽝b犳䓺Iz篤p;乨A\u20ef쩏?疊m㝀컩뫡b탔鄃ᾈV(遢珳=뎲ିeF仢䆡谨8t0醄7㭧瘵⻰컆r厡궥d)a阄፷Ed&c﯄伮1p": null, + "⯁w4曢\"(欷輡": "\"M᭫]䣒頳B\\燧ࠃN㡇j姈g⊸⺌忉ꡥF矉স%^", + "㣡Oᄦ昵⫮Y祎S쐐級㭻撥>{I$": -378474210562741663, + "䛒掷留Q%쓗1*1J*끓헩ᦢ﫫哉쩧EↅIcꅡ\\?ⴊl귛顮4": false, + "寔愆샠5]䗄IH贈=d﯊/偶?ॊn%晥D視N򗘈'᫂⚦|X쵩넽z질tskxDQ莮Aoﱻ뛓": true, + "钣xp?&\u001e侉/y䴼~?U篔蘚缣/I畚?Q绊": -3034854258736382234, + "꺲໣眀)⿷J暘pИfAV삕쳭Nꯗ4々'唄ⶑ伻㷯騑倭D*Ok꧁3b␽_<\/챣Xm톰ၕ䆄`*fl㭀暮滠毡?": [ + "D男p`V뙸擨忝븪9c麺`淂⢦Yw⡢+kzܖ\fY1䬡H歁)벾Z♤溊-혰셢?1<-\u0005;搢Tᐁle\\ᛵߓﭩ榩訝-xJ;巡8깊蠝ﻓU$K": { + "Vꕡ諅搓W=斸s︪vﲜ츧$)iꡟ싉e寳?ጭムVથ嵬i楝Fg<\/Z|៪ꩆ-5'@ꃱ80!燱R쇤t糳]罛逇dṌ֣XHiͦ{": true, + "Ya矲C멗Q9膲墅携휻c\\딶G甔<\/.齵휴": -1.1456247877031811E-19, + "z#.OO￝J": -8263224695871959017, + "崍_3夼ᮟ1F븍뽯ᦓ鴭V豈Ь": [{ + "N蒬74": null, + "yuB?厅vK笗!ᔸcXQ旦컶P-녫mᄉ麟_": "1R@ 톘xa_|﩯遘s槞d!d껀筤⬫薐焵먑D{\\6k共倌☀G~AS_D\"딟쬚뮥馲렓쓠攥WTMܭ8nX㩴䕅檹E\u0007ﭨN 2 ℆涐ꥏ꠵3▙玽|됨_\u2048", + "恐A C䧩G": {":M큣5e들\\ꍀ恼ᔄ靸|I﨏$)n": { + "|U䬫㟯SKV6ꛤ㗮\bn봻䲄fXT:㾯쳤'笓0b/ೢC쳖?2浓uO.䰴": "ཐ꼋e?``,ᚇ慐^8ꜙNM䂱\u0001IᖙꝧM'vKdꌊH牮r\\O@䊷ᓵ쀆(fy聻i툺\"?<\/峧ࣞ⓺ᤤ쵒߯ꎺ騬?)刦\u2072l慪y꺜ﲖTj+u", + "뽫hh䈵w>1ⲏ쐭V[ⅎ\\헑벑F_㖝⠗㫇h恽;῝汰ᱼ瀖J옆9RR셏vsZ柺鶶툤r뢱橾/ꉇ囦FGm\"謗ꉦ⨶쒿⥡%]鵩#ᖣ_蹎 u5|祥?O", + null, + 2.0150326776036215E-19, + null, + true, + false, + true, + {"\fa᭶P捤WWc᠟f뚉ᬏ퓗ⳀW睹5:HXH=q7x찙X$)모r뚥ᆟ!Jﳸf": [ + -2995806398034583407, + [ + 6441377066589744683, + "Mﶒ醹i)Gἦ廃s6몞 KJ౹礎VZ螺费힀\u0000冺업{谥'꡾뱻:.ꘘ굄奉攼Di᷑K鶲y繈욊阓v㻘}枭캗e矮1c?휐\"4\u0005厑莔뀾墓낝⽴洗ṹ䇃糞@b1\u0016즽Y轹", + { + "1⽕⌰鉟픏M㤭n⧴ỼD#%鐘⊯쿼稁븣몐紧ᅇ㓕ᛖcw嬀~ഌ㖓(0r⧦Q䑕髍ര铂㓻R儮\"@ꇱm❈௿᦯頌8}㿹犴?xn잆꥽R": 2.07321075750427366E18, + "˳b18㗈䃟柵Z曆VTAu7+㛂cb0﯑Wp執<\/臋뭡뚋刼틮荋벲TLP预庰܈G\\O@VD'鱃#乖끺*鑪ꬳ?Mޞdﭹ{␇圯쇜㼞顄︖Y홡g": [{ + "0a,FZ": true, + "2z̬蝣ꧦ驸\u0006L↛Ḣ4๚뿀'?lcwᄧ㐮!蓚䃦-|7.飑挴.樵*+1ﮊ\u0010ꛌ%貨啺/JdM:똍!FBe?鰴㨗0O财I藻ʔWA᫓G쳛u`<\/I": [{ + "$τ5V鴐a뾆両環iZp頻යn븃v": -4869131188151215571, + "*즢[⦃b礞R◚nΰꕢH=귰燙[yc誘g䆌?ଜ臛": { + "洤湌鲒)⟻\\䥳va}PeAMnN[": "㐳ɪ/(軆lZR,Cp殍ȮN啷\"3B婴?i=r$펽ᤐ쀸", + "阄R4㒿㯔ڀ69ZᲦ2癁핌噗P崜#\\-쭍袛&鐑/$4童V꩑_ZHA澢fZ3": {"x;P{긳:G閉:9?活H": [ + "繺漮6?z犞焃슳\">ỏ[Ⳛ䌜녏䂹>聵⼶煜Y桥[泥뚩MvK$4jtロ", + "E#갶霠좭㦻ୗ먵F+䪀o蝒ba쮎4X㣵 h", + -335836610224228782, + null, + null, + [ + "r1᫩0>danjY짿bs{", + [ + -9.594464059325631E-23, + 1.0456894622831624E-20, + null, + 5.803973284253454E-20, + -8141787905188892123, + true, + -4735305442504973382, + 9.513150514479281E-20, + "7넳$螔忷㶪}䪪l짴\u0007鹁P鰚HF銏ZJﳴ/⍎1ᷓ忉睇ᜋ쓈x뵠m䷐窥Ꮤ^\u0019ᶌ偭#ヂt☆၃pᎍ臶䟱5$䰵&๵分숝]䝈뉍♂坎\u0011<>", + "C蒑貑藁lﰰ}X喇몛;t밿O7/᯹f\u0015kI嘦<ዴ㟮ᗎZ`GWퟩ瑹࡮ᅴB꿊칈??R校s脚", + { + "9珵戬+AU^洘拻ቒy柭床'粙XG鞕᠜繀伪%]hC,$輙?Ut乖Qm떚W8઼}~q⠪rU䤶CQ痗ig@#≲t샌f㈥酧l;y闥ZH斦e⸬]j⸗?ঢ拻퀆滌": null, + "畯}㧢J罚帐VX㨑>1ꢶkT⿄蘥㝑o|<嗸層沈挄GEOM@-䞚䧰$만峬輏䠱V✩5宸-揂D'㗪yP掶7b⠟J㕻SfP?d}v㼂Ꮕ'猘": { + "陓y잀v>╪": null, + "鬿L+7:됑Y=焠U;킻䯌잫!韎ஔ\f": { + "駫WmGጶ": { + "\\~m6狩K": -2586304199791962143, + "ႜࠀ%͑l⿅D.瑢Dk%0紪dḨTI픸%뗜☓s榗኉\"?V籄7w髄♲쟗翛歂E䤓皹t ?)ᄟ鬲鐜6C": { + "_췤a圷1\u000eB-XOy缿請∎$`쳌eZ~杁튻/蜞`塣৙\"⪰\"沒l}蕌\\롃荫氌.望wZ|o!)Hn獝qg}": null, + "kOSܧ䖨钨:಼鉝ꭝO醧S`십`ꓭ쭁ﯢN&Et㺪馻㍢ⅳ㢺崡ຊ蜚锫\\%ahx켨|ż劻ꎄ㢄쐟A躊᰹p譞綨Ir쿯\u0016ﵚOd럂*僨郀N*b㕷63z": { + ":L5r+T㡲": [{ + "VK泓돲ᮙRy㓤➙Ⱗ38oi}LJቨ7Ó㹡৘*q)1豢⛃e᫛뙪壥镇枝7G藯g㨛oI䄽 孂L缊ꋕ'EN`": -2148138481412096818, + "`⛝ᘑ$(खꊲ⤖ᄁꤒ䦦3=)]Y㢌跨NĴ驳줟秠++d孳>8ᎊ떩EꡣSv룃 쯫أ?#E|᭙㎐?zv:5祉^⋑V": [ + -1.4691944435285607E-19, + 3.4128661569395795E17, + "㐃촗^G9佭龶n募8R厞eEw⺡_ㆱ%⼨D뉄퉠2ꩵᛅⳍ搿L팹Lවn=\"慉념ᛮy>!`g!풲晴[/;?[v겁軇}⤳⤁핏∌T㽲R홓遉㓥", + "愰_⮹T䓒妒閤둥?0aB@㈧g焻-#~跬x<\/舁P݄ꐡ=\\׳P\u0015jᳪᢁq;㯏l%᭗;砢觨▝,謁ꍰGy?躤O黩퍋Y㒝a擯\n7覌똟_䔡]fJ晋IAS", + 4367930106786121250, + -4.9421193149720582E17, + null, + { + ";ᄌ똾柉곟ⰺKpፇ䱻ฺ䖝{o~h!eꁿ઻욄ښ\u0002y?xUd\u207c悜ꌭ": [ + 1.6010824122815255E-19, + [ + "宨︩9앉檥pr쇷?WxLb", + "氇9】J玚\u000f옛呲~ 輠1D嬛,*mW3?n휂糊γ虻*ᴫ꾠?q凐趗Ko↦GT铮", + "㶢ថmO㍔k'诔栀Z蛟}GZ钹D", + false, + -6.366995517736813E-20, + -4894479530745302899, + null, + "V%᫡II璅䅛䓎풹ﱢ/pU9se되뛞x梔~C)䨧䩻蜺(g㘚R?/Ự[忓C뾠ࢤc왈邠买?嫥挤풜隊枕", + ",v碍喔㌲쟚蔚톬៓ꭶ", + 3.9625444752577524E-19, + null, + [ + "kO8란뿒䱕馔b臻⍟隨\"㜮鲣Yq5m퐔K#ꢘug㼈ᝦ=P^6탲@䧔%$CqSw铜랊0&m⟭<\/a逎ym\u0013vᯗ": true, + "洫`|XN뤮\u0018詞=紩鴘_sX)㯅鿻Ố싹": 7.168252736947373E-20, + "ꛊ饤ﴏ袁(逊+~⽫얢鈮艬O힉7D筗S곯w操I斞᠈븘蓷x": [[[[ + -7.3136069426336952E18, + -2.13572396712722688E18, + { + "硢3㇩R:o칢行E<=\u0018ၬYuH!\u00044U%卝炼2>\u001eSi$⓷ꒈ'렢gᙫ番ꯒ㛹럥嶀澈v;葷鄕x蓎\\惩+稘UEᖸﳊ㊈壋N嫿⏾挎,袯苷ኢ\\x|3c": 7540762493381776411, + "?!*^ᢏ窯?\u0001ڔꙃw虜돳FgJ?&⨫*uo籤:?}ꃹ=ٴ惨瓜Z媊@ત戹㔏똩Ԛ耦Wt轁\\枒^\\ꩵ}}}ꀣD\\]6M_⌫)H豣:36섘㑜": { + ";홗ᰰU஋㙛`D왔ཿЃS회爁\u001b-㢈`봆?盂㛣듿ᦾ蒽_AD~EEຆ㊋(eNwk=Rɠ峭q\"5Ἠ婾^>'ls\n8QAK)- Q䲌mo펹L_칍樖庫9꩝쪹ᘹ䑖瀍aK ?*趤f뭓廝p=磕", + "哑z懅ᤏ-ꍹux쀭", + [ + true, + 3998739591332339511, + "ጻ㙙?᳸aK<\/囩U`B3袗ﱱ?\"/k鏔䍧2l@쿎VZ쨎/6ꃭ脥|B?31+on颼-ꮧ,O嫚m ࡭`KH葦:粘i]aSU쓙$쐂f+詛頖b", + [{"^<9<箝&絡;%i﫡2攑紴\\켉h쓙-柂䚝ven\u20f7浯-Ꮏ\r^훁䓚헬\u000e?\\ㅡֺJ떷VOt": [{ + "-௄卶k㘆혐஽y⎱㢬sS઄+^瞥h;ᾷj;抭\u0003밫f<\/5Ⱗ裏_朻%*[-撵䷮彈-芈": { + "㩩p3篊G|宮hz䑊o곥j^Co0": [ + 653239109285256503, + {"궲?|\":N1ۿ氃NZ#깩:쇡o8킗ࡊ[\"됸Po핇1(6鰏$膓}⽐*)渽J'DN<썙긘毦끲Ys칖": { + "2Pr?Xjㆠ?搮/?㓦柖馃5뚣Nᦼ|铢r衴㩖\"甝湗ܝ憍": "\"뾯i띇筝牻$珲/4ka $匝휴译zbAᩁꇸ瑅&뵲衯ꎀᆿ7@ꈋ'ᶨH@ᠴl+", + "7뢽뚐v?4^ꊥ_⪛.>pởr渲<\/⢕疻c\"g䇘vU剺dஔ鮥꒚(dv祴X⼹\\a8y5坆": true, + "o뼄B욞羁hr﷔폘뒚⿛U5pꪴfg!6\\\"爑쏍䢱W<ﶕ\\텣珇oI/BK뺡'谑♟[Ut븷亮g(\"t⡎有?ꬊ躺翁艩nl F⤿蠜": 1695826030502619742, + "ۊ깖>ࡹ햹^ⵕ쌾BnN〳2C䌕tʬ]찠?ݾ2饺蹳ぶꌭ訍\"◹ᬁD鯎4e滨T輀ﵣ੃3\u20f3킙D瘮g\\擦+泙ၧ 鬹ﯨַ肋7놷郟lP冝{ߒhড়r5,꓋": null, + "ΉN$y{}2\\N﹯ⱙK'8ɜͣwt,.钟廣䎘ꆚk媄_": null, + "䎥eᾆᝦ읉,Jުn岪㥐s搖謽䚔5t㯏㰳㱊ZhD䃭f絕s鋡篟a`Q鬃┦鸳n_靂(E4迠_觅뷝_宪D(NL疶hL追V熑%]v肫=惂!㇫5⬒\u001f喺4랪옑": { + "2a輍85먙R㮧㚪Sm}E2yꆣꫨrRym㐱膶ᔨ\\t綾A☰.焄뙗9<쫷챻䒵셴᭛䮜.<\/慌꽒9叻Ok䰊Z㥪幸k": [ + null, + true, + {"쌞쐍": { + "▟GL K2i뛱iQ\"̠.옛1X$}涺]靎懠ڦ늷?tf灟ݞゟ{": 1.227740268699265E-19, + "꒶]퓚%ฬK❅": [{ + "(ෛ@Ǯっ䧼䵤[aテൖvEnAdU렖뗈@볓yꈪ,mԴ|꟢캁(而첸죕CX4Y믅": "2⯩㳿ꢚ훀~迯?᪑\\啚;4X\u20c2襏B箹)俣eỻw䇄", + "75༂f詳䅫ꐧ鏿 }3\u20b5'∓䝱虀f菼Iq鈆﨤g퍩)BFa왢d0뮪痮M鋡nw∵謊;ꝧf美箈ḋ*\u001c`퇚퐋䳫$!V#N㹲抗ⱉ珎(V嵟鬒_b㳅\u0019": null, + "e_m@(i㜀3ꦗ䕯䭰Oc+-련0뭦⢹苿蟰ꂏSV䰭勢덥.ྈ爑Vd,ᕥ=퀍)vz뱊ꈊB_6듯\"?{㒲&㵞뵫疝돡믈%Qw限,?\r枮\"? N~癃ruࡗdn&": null, + "㉹&'Pfs䑜공j<\/?|8oc᧨L7\\pXᭁ 9᪘": -2.423073789014103E18, + "䝄瑄䢸穊f盈᥸,B뾧푗횵B1쟢f\u001f凄": "魖⚝2儉j꼂긾껢嗎0ࢇ纬xI4](੓`蕞;픬\fC\"斒\")2櫷I﹥迧", + "ퟯ詔x悝령+T?Bg⥄섅kOeQ큼㻴*{E靼6氿L缋\u001c둌๶-㥂2==-츫I즃㠐Lg踞ꙂEG貨鞠\"\u0014d'.缗gI-lIb䋱ᎂDy缦?": null, + "紝M㦁犿w浴詟棓쵫G:䜁?V2ힽ7N*n&㖊Nd-'ຊ?-樹DIv⊜)g䑜9뉂ㄹ푍阉~ꅐ쵃#R^\u000bB䌎䦾]p.䀳": [{"ϒ爛\"ꄱ︗竒G䃓-ま帳あ.j)qgu扐徣ਁZ鼗A9A鸦甈!k蔁喙:3T%&㠘+,䷞|챽v䚞문H<\/醯r셓㶾\\a볜卺zE䝷_죤ဵ뿰᎟CB": [ + 6233512720017661219, + null, + -1638543730522713294, + false, + -8901187771615024724, + [ + 3891351109509829590, + true, + false, + -1.03836679125188032E18, + { + "j랎:g曞ѕᘼ}链N", + -1.1103819473845426E-19, + true, + [ + true, + null, + -7.9091791735309888E17, + true, + {"}蔰鋈+ꐨ啵0?g*사%`J?*": [{ + "\"2wG?yn,癷BK\\龞䑞x?蠢": -3.7220345009853505E-19, + ";饹়❀)皋`噿焒j(3⿏w>偍5X薙婏聿3aFÆÝ": "2,ꓴg?_섦_>Y쪥션钺;=趘F~?D㨫\bX?㹤+>/믟kᠪ멅쬂Uzỵ]$珧`m雁瑊ඖ鯬cꙉ梢f묛bB", + "♽n$YjKiXX*GO贩鏃豮祴遞K醞眡}ꗨv嵎꼷0୸+M菋eH徸J꣆:⼐悥B켽迚㯃b諂\u000bjꠜ碱逮m8": [ + "푷᣺ﻯd8ﱖ嬇ភH鹎⡱᱅0g:果6$GQ췎{vᷧYy-脕x偹砡館⮸C蓼ꏚ=軄H犠G谖ES詤Z蠂3l봟hᅭ7䦹1GPQG癸숟~[#駥8zQ뛣J소obg,", + null, + 1513751096373485652, + null, + -6.851466660824754E-19, + {"䩂-⴮2ٰK솖풄꾚ႻP앳1H鷛wmR䗂皎칄?醜<\/&ࠧ㬍X濬䵈K`vJ륒Q/IC묛!;$vϑ": { + "@-ꚗxྐྵ@m瘬\u0010U絨ﮌ驐\\켑寛넆T=tQ㭤L연@脸삯e-:⩼u㎳VQ㋱襗ຓ<Ⅶ䌸cML3+\u001e_C)r\\9+Jn\\Pﺔ8蠱檾萅Pq鐳话T䄐I": -1.80683891195530061E18, + "ᷭዻU~ཷsgSJ`᪅'%㖔n5픆桪砳峣3獮枾䌷⊰呀": { + "Ş੉䓰邟自~X耤pl7间懑徛s첦5ਕXexh⬖鎥᐀nNr(J컗|ૃF\"Q겮葲놔엞^겄+㈆话〾희紐G'E?飕1f❼텬悚泬먐U睬훶Qs": false, + "(\u20dag8큽튣>^Y{뤋.袊䂓;_g]S\u202a꽬L;^'#땏bႌ?C緡<䝲䲝断ꏏ6\u001asD7IK5Wxo8\u0006p弊⼂ꯍ扵\u0003`뵂픋%ꄰ⫙됶l囏尛+䗅E쟇\\": [ + true, + { + "\n鱿aK㝡␒㼙2촹f;`쾏qIࡔG}㝷䐍瓰w늮*粅9뒪ㄊCj倡翑閳R渚MiUO~仨䜶RꙀA僈㉋⦋n{㖥0딿벑逦⥻0h薓쯴Ꝼ": [ + 5188716534221998369, + 2579413015347802508, + 9.010794400256652E-21, + -6.5327297761238093E17, + 1.11635352494065523E18, + -6656281618760253655, + { + "": ")?", + "TWKLꑙ裑꺔UE俸塑炌Ũ᜕-o\"徚#": {"M/癟6!oI51ni퐚=댡>xꍨ\u0004 ?": { + "皭": {"⢫䋖>u%w잼<䕏꘍P䋵$魋拝U䮎緧皇Y훂&|羋ꋕ잿cJ䨈跓齳5\u001a삱籷I꿾뤔S8㌷繖_Yឯ䲱B턼O歵F\\l醴o_欬6籏=D": [ + false, + true, + {"Mt|ꏞD|F궣MQ뵕T,띺k+?㍵i": [ + 7828094884540988137, + false, + { + "!༦鯠,&aﳑ>[euJꏽ綷搐B.h": -7648546591767075632, + "-n켧嘰{7挐毄Y,>❏螵煫乌pv醑Q嶚!|⌝責0왾덢ꏅ蛨S\\)竰'舓Q}A釡5#v": 3344849660672723988, + "8閪麁V=鈢1녈幬6棉⪮둌\u207d᚛驉ꛃ'r䆉惏ै|bἧﺢᒙ<=穊强s혧eꮿ慩⌡ \\槳W븧J檀C,ᘉ의0俯퀉M;筷ࣴ瓿{늊埂鄧_4揸Nn阼Jੵ˥(社": true, + "o뼀vw)4A뢵(a䵢)p姃뛸\u000fK#KiQp\u0005ꅍ芅쏅": null, + "砥$ꥸ┇耽u斮Gc{z빔깎밇\\숰\u001e괷各㶇쵿_ᴄ+h穢p촀Ნ䃬z䝁酳ӂ31xꔄ1_砚W렘G#2葊P ": [ + -3709692921720865059, + null, + [ + 6669892810652602379, + -135535375466621127, + "뎴iO}Z? 馢녱稹ᄾ䐩rSt帤넆&7i騏멗畖9誧鄜'w{Ͻ^2窭외b㑎粖i矪ꦨ탪跣)KEㆹ\u0015V8[W?⽉>'kc$䨘ᮛ뉻٬M5", + 1.10439588726055846E18, + false, + -4349729830749729097, + null, + [ + false, + "_蠢㠝^䟪/D녒㡋ỎC䒈판\u0006એq@O펢%;鹐쏌o戥~A[ꡉ濽ỳ&虃᩾荣唙藍茨Ig楡꒻M窓冉?", + true, + 2.17220752996421728E17, + -5079714907315156164, + -9.960375974658589E-20, + "ᾎ戞༒", + true, + false, + [[ + "ⶉᖌX⧕홇)g엃⹪x뚐癟\u0002", + -5185853871623955469, + { + "L㜤9ợㇶK鐰⋓V뽋˖!斫as|9"፬䆪?7胜&n薑~": -2.11545634977136992E17, + "O8뀩D}캖q萂6༣㏗䈓煮吽ਆᎼDᣘ폛;": false, + "YTᡅ^L㗎cbY$pᣞ縿#fh!ꘂb삵玊颟샞ဢ$䁗鼒몁~rkH^:닮먖츸륈⪺쒉砉?㙓扫㆕꣒`R䢱B酂?C뇞<5Iޚ讳騕S瞦z": null, + "\\RB?`mG댵鉡幐物䵎有5*e骄T㌓ᛪ琾駒Ku\u001a[柆jUq8⋈5鿋츿myﻗ?雍ux঴?": 5828963951918205428, + "n0晅:黯 xu씪^퓞cB㎊ᬍ⺘٤փ~B岚3㥕擄vᲂ~F?C䶖@$m~忔S왖㲚?챴⊟W#벌{'㰝I䝠縁s樘\\X뢻9핡I6菍ㄛ8쯶]wॽ0L\"q": null, + "x增줖j⦦t䏢᎙㛿Yf鼘~꫓恄4惊\u209c": "oOhbᤃ᛽z&Bi犑\\3B㩬劇䄑oŁ쨅孥멁ຖacA㖫借㞝vg싰샂㐜#譞⢤@k]鋰嘘䜾L熶塥_<\/⍾屈ﮊ_mY菹t뙺}Ox=w鮮4S1ꐩמּ'巑", + "㗓蟵ꂾe蠅匳(JP䗏෸\u0089耀왲": [{ + "ᤃ㵥韎뤽\r?挥O쯡⇔㞚3伖\u0005P⋪\"D궣QLn(⚘罩䩢Ŏv䤘尗뼤됛O淽鋋闚r崩a{4箙{煷m6〈": { + "l곺1L": { + "T'ਤ?砅|੬Km]䄩\"(࿶<\/6U爢䫈倔郴l2㴱^줣k'L浖L鰄Rp今鎗⒗C얨M훁㡧ΘX粜뫈N꤇輊㌻켑#㮮샶-䍗룲蠝癜㱐V>=\\I尬癤t=": 7648082845323511446, + "鋞EP:<\/_`ၧe混ㇹBd⯢㮂驋\\q碽饩跓྿ᴜ+j箿렏㗑yK毢宸p謹h䦹乕U媣\\炤": [[ + "3", + [ + true, + 3.4058271399411134E-20, + true, + "揀+憱f逮@먻BpW曉\u001a㣐⎊$n劈D枤㡞좾\u001aᛁ苔౩闝1B䷒Ṋ݋➐ꀞꐃ磍$t੤_:蘺⮼(#N", + 697483894874368636, + [ + "vᘯ锴)0訶}䳅⩚0O壱韈ߜ\u0018*U鍾䏖=䧉뽑单휻ID쿇嘗?ꌸῬ07", + -5.4858784319382006E18, + 7.5467775182251151E18, + -8911128589670029195, + -7531052386005780140, + null, + [ + null, + true, + [[{ + "1欯twG<\/Q:0怯押殃탷聫사<ỗꕧ蚨䡁nDꌕ\u001c녬~蓩鲃g儊>ꏡl㻿/⑷*챳6㻜W毤緛ﹺᨪ4\u0013뺚J髬e3쳸䘦伧?恪&{L掾p+꬜M䏊d娘6": { + "2p첼양棜h䜢﮶aQ*c扦v︥뮓kC寵횂S銩&ǝ{O*य़iH`U큅ࡓr䩕5ꄸ?`\\᧫?ᮼ?t〟崾훈k薐ì/iy꤃뵰z1<\/AQ#뿩8jJ1z@u䕥": 1.82135747285215155E18, + "ZdN &=d년ᅆ'쑏ⅉ:烋5&៏ᄂ汎来L㯄固{钧u\\㊏튚e摑&t嗄ꖄUb❌?m䴘熚9EW": [{ + "ଛ{i*a(": -8.0314147546006822E17, + "⫾ꃆY\u000e+W`௸ \"M뒶+\\뷐lKE}(NT킶Yj選篒쁶'jNQ硾(똡\\\"逌ⴍy? IRꜘ὞鄬﨧:M\\f⠋Cꚜ쫊ᚴNV^D䕗ㅖἔIao꿬C⍏8": [ + 287156137829026547, + { + "H丞N逕⯲": {"": { + "7-;枮阕梒9ᑄZ": [[[[ + null, + { + "": [[[[ + -7.365909561486078E-19, + 2948694324944243408, + null, + [ + true, + "荒\"并孷䂡쵼9o䀘F\u0002龬7⮹Wz%厖/*? a*R枈㌦됾g뒠䤈q딄㺿$쮸tᶎ릑弣^鏎<\/Y鷇驜L鿽<\/춋9Mᲆឨ^<\/庲3'l낢", + "c鮦\u001b두\\~?眾ಢu݆綑෪蘛轋◜gȃ<\/ⴃcpkDt誩܅\"Y", + [[ + null, + null, + [ + 3113744396744005402, + true, + "v(y", + { + "AQ幆h쾜O+꺷铀ꛉ練A蚗⼺螔j㌍3꽂楎䥯뎸먩?": null, + "蠗渗iz鱖w]擪E": 1.2927828494783804E-17, + "튷|䀭n*曎b✿~杤U]Gz鄭kW|㴚#㟗ഠ8u擨": [[ + true, + null, + null, + {"⾪壯톽g7?㥜ώQꑐ㦀恃㧽伓\\*᧰閖樧뢇赸N휶䎈pI氇镊maᬠ탷#X?A+kНM ༑᩟؝?5꧎鰜ṚY즫궔 =ঈ;ﳈ?*s|켦蜌wM笙莔": [ + null, + -3808207793125626469, + [ + -469910450345251234, + 7852761921290328872, + -2.7979740127017492E18, + 1.4458504352519893E-20, + true, + "㽙깹?먏䆢:䴎ۻg殠JBTU⇞}ꄹꗣi#I뵣鉍r혯~脀쏃#釯:场:䔁>䰮o'㼽HZ擓௧nd", + [ + 974441101787238751, + null, + -2.1647718292441327E-19, + 1.03602824249831488E18, + [ + null, + 1.0311977941822604E-17, + false, + true, + { + "": -3.7019778830816707E18, + "E峾恆茍6xLIm縂0n2视֯J-ᤜz+ᨣ跐mYD豍繹⹺䊓몓ﴀE(@詮(!Y膽#᎙2䟓섣A䈀㟎,囪QbK插wcG湎ꤧtG엝x⥏俎j'A一ᯥ뛙6ㅑ鬀": 8999803005418087004, + "よ殳\\zD⧅%Y泥簳Uꈩ*wRL{3#3FYHା[d岀䉯T稉駅䞘礄P:闈W怏ElB㤍喬赔bG䠼U଄Nw鰯闀楈ePsDꥷ꭬⊊": [ + 6.77723657904486E-20, + null, + [ + "ཚ_뷎꾑蹝q'㾱ꂓ钚蘞慵렜떆`ⴹ⎼櫯]J?[t9Ⓢ !컶躔I᮸uz>3a㠕i,錃L$氰텰@7녫W㸮?羧W뇧ꃞ,N鋮숪2ɼ콏┍䁲6", + "&y?뢶=킕올Za惻HZk>c\u20b58i?ꦶcfBv잉ET9j䡡", + "im珊Ճb칧校\\뼾쯀", + 9.555715121193197E-20, + true, + { + "<㫚v6腓㨭e1㕔&&V∌ᗈT奄5Lጥ>탤?튣瑦㳆ꉰ!(ᙪ㿬擇_n쌯IMΉ㕨␰櫈ᱷ5풔蟹&L.첽e鰷쯃劼﫭b#ﭶ퓀7뷄Wr㢈๧Tʴશ㶑澕鍍%": -1810142373373748101, + "fg晌o?߲ꗄ;>C>?=鑰監侯Kt굅": true, + "䫡蓺ꑷ]C蒹㦘\"1ః@呫\u0014NL䏾eg呮፳,r$裢k>/\\?ㄤᇰﻛ쉕1஥'Ċ\" \\_?쨔\"ʾr: 9S䘏禺ᪧꄂ㲄", + [[{ + "*硙^+E쌺I1䀖ju?:⦈Ꞓl๴竣迃xKC/饉:\fl\"XTFᄄ蟭,芢<\/骡軺띜hꏘ\u001f銿<棔햳▨(궆*=乥b8\\媦䷀뫝}닶ꇭ(Kej䤑M": [{ + "1Ꮼ?>옿I╅C<ގ?ꊌ冉SV5A㢊㶆z-๎玶绢2F뵨@㉌뀌o嶔f9-庒茪珓뷳4": null, + ";lᰳ": "CbB+肻a䄷苝*/볳+/4fq=㰁h6瘉샴4铢Y骐.⌖@哼猎㦞+'gꋸ㒕ߤ㞑(䶒跲ti⑴a硂#No볔", + "t?/jE幸YHT셵⩎K!Eq糦ꗣv刴w\"l$ο:=6:移": { + "z]鑪醊嫗J-Xm銌翁絨c里됏炙Ep㣋鏣똼嚌䀓GP﹖cmf4鹭T䅿꣭姧␸wy6ꦶ;S&(}ᎧKxᾂQ|t뻳k\"d6\"|Ml췆hwLt꼼4$&8Պ褵婶鯀9": {"嵃닢ᒯ'd᧫䳳#NXe3-붋鸿ଢ떓%dK\u0013䲎ꖍYV.裸R⍉rR3蟛\\:젯:南ĺLʆ넕>|텩鴷矔ꋅⒹ{t孶㓑4_": [ + true, + null, + [ + false, + "l怨콈lᏒ", + { + "0w䲏嬧-:`䉅쉇漧\\܂yㄨb%㽄j7ᦶ涶<": 3.7899452730383747E-19, + "ꯛTẀq纤q嶏V⿣?\"g}ი艹(쥯B T騠I=仵및X": {"KX6颠+&ᅃ^f畒y[": { + "H?뱜^?꤂-⦲1a㋞&ꍃ精Ii᤾챪咽쬘唂쫷<땡劈훫놡o㥂\\ KⴙD秼F氮[{'좴:례晰Iq+I쭥_T綺砸GO煝䟪ᚪ`↹l羉q쐼D꽁ᜅ훦: vUV": true, + "u^yﳍ0㱓#[y뜌앸ꊬL㷩?蕶蘾⻍KӼ": -7931695755102841701, + "䤬轉車>\u001c鴵惋\"$쯃྆⇻n뽀G氠S坪]ಲꨍ捇Qxኻ椕駔\\9ࣼ﫻읜磡煮뺪ᶚ볝l㕆t+sζ": [[[ + true, + false, + [ + null, + 3363739578828074923, + true, + { + "\"鸣詩 볰㑵gL㯦῅춝旫}ED辗ﮈI쀤-ꧤ|㠦Z\"娑ᕸ4爏騍㣐\"]쳝Af]茛⬻싦o蚁k䢯䩐菽3廇喑ޅ": 4.5017999150704666E17, + "TYႇ7ʠ值4챳唤~Zo&ݛ": false, + "`塄J袛㭆끺㳀N㺣`꽐嶥KﯝSVᶔ∲퀠獾N딂X\"ᤏhNﬨvI": {"\u20bb㭘I䖵䰼?sw䂷쇪](泒f\"~;꼪Fԝsᝦ": {"p,'ꉂ軿=A蚶?bƉ㏵䅰諬'LYKL6B깯⋩겦뎙(ᜭ\u0006噣d꾆㗼Z;䄝䚔cd<情@䞂3苼㸲U{)<6&ꩻ钛\u001au〷N숨囖愙j=BXW욕^x芜堏Ῑ爂뛷꒻t✘Q\b": [[ + "籛&ଃ䩹.ꃩ㦔\\C颫#暪&!勹ꇶ놽攺J堬镙~軌C'꾖䣹㮅岃ᙴ鵣", + 4.317829988264744E15, + 6.013585322002147E-20, + false, + true, + null, + null, + -3.084633632357326E-20, + false, + null, + { + "\"짫愔昻 X\"藣j\"\"먁ཅѻ㘤㬯0晲DU꟒㸃d벀윒l䦾c੻*3": null, + "谈Wm陧阦咟ฯ歖擓N喴㋐銭rCCnVࢥ^♼Ⅾ젲씗刊S༝+_t赔\\b䚍뉨ꬫ6펛cL䊘᜼<\/澤pF懽&H": [ + null, + { + "W\"HDUuΌ퀟M'P4࿰H똆ⰱﮯ<\/凐蘲\"C鴫ﭒж}ꭩ쥾t5yd诪ﮡ퍉ⴰ@?氐醳rj4I6Qt": 6.9090159359219891E17, + "絛ﳛ⺂": {"諰P㗮聦`ZQ?ꫦh*റcb⧱}埌茥h{棩렛툽o3钛5鮁l7Q榛6_g)ὄ\u0013kj뤬^爖eO4Ⱈ槞鉨ͺ订%qX0T썗嫷$?\\\"봅늆'%": [ + -2.348150870600346E-19, + [[ + true, + -6619392047819511778, + false, + [[ + -1.2929189982356161E-20, + 1.7417192219309838E-19, + {"?嵲2࿐2\u0001啑㷳c縯": [ + null, + [ + false, + true, + 2578060295690793218, + { + "?\"殃呎#㑑F": true, + "}F炊_殛oU헢兔Ꝉ,赭9703.B数gTz3⏬": { + "5&t3,햓Mݸᵣ㴵;꣫䩍↳#@뫷䠅+W-ࣇzᓃ鿕ಔ梭?T䮑ꥬ旴]u뫵막bB讍:왳둛lEh=숾鱠p咐$짏#?g⹷ᗊv㷵.斈u頻\u0018-G.": "뽙m-ouࣤ஫牷\"`Ksꕞ筼3HlȨvC堈\"I]㖡玎r먞#'W賜鴇k'c룼髋䆿飉㗆xg巤9;芔cጐ/ax䊨♢큓r吓㸫೼䢗da᩾\"]屣`", + ":M딪<䢥喠\u0013㖅x9蕐㑂XO]f*Q呰瞊吭VP@9,㨣 D\\穎vˤƩs㜂-曱唅L걬/롬j㈹EB8g<\/섩o渀\"u0y&룣": ">氍緩L/䕑돯Ꟙ蕞^aB뒣+0jK⪄瑨痜LXK^힦1qK{淚t츔X:Vm{2r獁B뾄H첚7氥?쉟䨗ꠂv팳圎踁齀\\", + "D彤5㢷Gꪻ[lㄆ@὜⓰絳[ଃ獽쮹☒[*0ꑚ㜳": 9022717159376231865, + "ҖaV銣tW+$魿\u20c3亜~뫡ᙰ禿쨽㏡fṼzE/h": "5臐㋇Ჯ쮺? 昨탰Wム밎#'\"崲钅U?幫뺀⍾@4kh>騧\\0ҾEV=爐͌U捀%ꉼ 㮋<{j]{R>:gԩL\u001c瀈锌ﯲﳡꚒ'⫿E4暍㌗뵉X\"H᝜", + "ᱚגּ;s醒}犍SἿ㦣&{T$jkB\\\tḮ앾䤹o<避(tW": "vb⯽䴪䮢@|)", + "⥒퐁껉%惀뗌+녣迺顀q條g⚯i⤭룐M琹j̈́⽜A": -8385214638503106917, + "逨ꊶZ<\/W⫟솪㎮ᘇb?ꠔi\"H㧺x෷韒Xꫨฟ|]窽\u001a熑}Agn?Mᶖa9韲4$3Ỵ^=쏍煤ፐ돷2䣃%鷠/eQ9頸쥎", + 2398360204813891033, + false, + 3.2658897259932633E-19, + null, + "?ꚃ8Nn㞷幵d䲳䱲뀙ꪛQ瑓鎴]䩋-鰾捡䳡??掊", + false, + -1309779089385483661, + "ᦲxu_/yecR.6芏.ᜇ過 ~", + -5658779764160586501, + "쒌:曠=l썜䢜wk#s蕚\"互㮉m䉤~0듐䋙#G;h숄옥顇෤勹(C7㢅雚㐯L⠅VV簅<", + null, + -4.664877097240962E18, + -4.1931322262828017E18, + { + ",": { + "v㮟麑䄠뤵g{M띮.\u001bzt뢜뵡0Ǥ龍떟Ᾰ怷ϓRT@Lꀌ樂U㏠⾕e扉|bJg(뵒㠶唺~ꂿ(땉x⻫싉쁊;%0鎻V(o\f,N鏊%nk郼螺": -1.73631993428376141E18, + "쟧摑繮Q@Rᕾ㭚㾣4隅待㓎3蒟": [ + 4971487283312058201, + 8973067552274458613, + { + "`a揙ᣗ\u0015iBo¸": 4.3236479112537999E18, + "HW&퉡ぁ圍Y?瑡Qy훍q!帰敏s舠㫸zꚗaS歲v`G株巷Jp6킼 (귶鍔⾏⡈>M汐㞍ቴ꙲dv@i㳓ᇆ?黍": [ + null, + 4997607199327183467, + "E㻎蠫ᐾ高䙟蘬洼旾﫠텛㇛?'M$㣒蔸=A_亀绉앭rN帮", + null, + [{ + "Eᑞ)8餧A5u&㗾q?": [ + -1.969987519306507E-19, + null, + [ + 3.42437673373841E-20, + true, + "e걷M墁\"割P␛퍧厀R䱜3ﻴO퓫r﹉⹊", + [ + -8164221302779285367, + [ + true, + null, + "爘y^-?蘞Ⲽꪓa␅ꍨ}I", + 1.4645984996724427E-19, + [{ + "tY좗⧑mrzﺝ㿥ⴖ᥷j諅\u0000q賋譁Ꞅ⮱S\nࡣB/큃굪3Zɑ复o<\/;롋": null, + "彟h浠_|V4䦭Dᙣ♞u쿻=삮㍦\u001e哀鬌": [{"6횣楠,qʎꗇ鎆빙]㱭R굋鈌%栲j分僅ペ䇰w폦p蛃N溈ꡐꏀ?@(GI뉬$ﮄ9誁ꓚ2e甸ڋ[䁺,\u0011\u001cࢃ=\\+衪䷨ᯕ鬸K": [[ + "ㅩ拏鈩勥\u000etgWVXs陂規p狵w퓼{뮵_i\u0002ퟑႢ⬐d6鋫F~챿搟\u0096䚼1ۼ칥0꣯儏=鋷牋ⅈꍞ龐", + -7283717290969427831, + true, + [ + 4911644391234541055, + { + "I鈒첽P릜朸W徨觘-Hᎄ퐟⓺>8kr1{겵䍃〛ᬡ̨O귑o䝕'쿡鉕p5": "fv粖RN瞖蛐a?q꤄\u001d⸥}'ꣴ犿ꦼ?뤋?鵆쥴덋䡫s矷̄?ඣ/;괱絢oWfV<\/\u202cC,㖦0䑾%n賹g&T;|lj_欂N4w", + "짨䠗;䌕u i+r๏0": [{"9䥁\\఩8\"馇z䇔<\/ႡY3e狚쐡\"ุ6ﰆZ遖c\"Ll:ꮾ疣<\/᭙O◌납୕湞9⡳Und㫜\u0018^4pj1;䧐儂䗷ୗ>@e톬": { + "a⑂F鋻Q螰'<퇽Q贝瀧{ᘪ,cP&~䮃Z?gI彃": [ + -1.69158726118025933E18, + [ + "궂z簽㔛㮨瘥⤜䛖Gℤ逆Y⪾j08Sn昞ꘔ캻禀鴚P謦b{ꓮmN靐Mᥙ5\"睏2냑I\u0011.L&=?6ᄠ뻷X鸌t刑\"#z)o꫚n쳟줋", + null, + 7517598198523963704, + "ኑQp襟`uᩄr方]*F48ꔵn俺ሙ9뇒", + null, + null, + 6645782462773449868, + 1219168146640438184, + null, + { + ")ယ넌竀Sd䰾zq⫣⏌ʥ\u0010ΐ' |磪&p牢蔑mV蘸૰짬꺵;K": [ + -7.539062290108008E-20, + [ + true, + false, + null, + true, + 6574577753576444630, + [[ + 1.2760162530699766E-19, + [ + null, + [ + "顊\\憎zXB,", + [{ + "㇆{CVC9-MN㜋ઘR눽#{h@ퟨ!鼚׼XOvXS\u0017ᝣ=cS+梽៲綆16s덽휐y屬?ᇳG2ᴭ\u00054쫖y룇nKcW̭炦s/鰘ᬽ?J|퓀髣n勌\u0010홠P>j": false, + "箴": [ + false, + "鍞j\"ꮾ*엇칬瘫xṬ⭽쩁䃳\"-⋵?ᦽ댎Ĝ": true, + "Pg帯佃籛n㔠⭹࠳뷏≻࿟3㞱!-쒾!}쭪䃕!籿n涻J5ਲ਼yvy;Rኂ%ᔡጀ裃;M⣼)쵂쑈": 1.80447711803435366E18, + "ꈑC⡂ᑆ㤉壂뎃Xub<\/쀆༈憓ق쨐ק\\": [ + 7706977185172797197, + {"": {"K╥踮砆NWࡆFy韣7ä밥{|紒︧䃀榫rᩛꦡTSy잺iH8}ퟴ,M?Ʂ勺ᴹ@T@~꾂=I㙕뾰_涀쑜嫴曣8IY?ҿo줫fऒ}\\S\"ᦨ뵼#nDX": { + "♘k6?଱癫d68?㽚乳䬳-V顷\u0005蝕?\u0018䞊V{邾zじl]雏k臤~ൖH뒐iꢥ]g?.G碄懺䔛pR$䅒X觨l봜A刊8R梒',}u邩퉕?;91Ea䈈믁G⊶芔h袪&廣㺄j;㡏綽\u001bN頸쳘橆": -2272208444812560733, + "拑Wﵚj鵼駳Oࣿ)#㾅顂N傓纝y僱栜'Bꐍ-!KF*ꭇK¦?䈴^:啤wG逭w᧯": "xᣱmYe1ۏ@霄F$ě꧘푫O䤕퀐Pq52憬ꀜ兴㑗ᡚ?L鷝ퟐ뭐zJꑙ}╆ᅨJB]\"袌㺲u8䯆f", + "꿽၅㔂긱Ǧ?SI": -1669030251960539193, + "쇝ɨ`!葎>瞺瘡驷錶❤ﻮ酜=": -6961311505642101651, + "?f7♄꫄Jᡔ훮e읇퍾፣䭴KhखT;Qty}O\\|뫁IῒNe(5惁ꥶㆷY9ﮡ\\ oy⭖-䆩婁m#x봉>Y鈕E疣s驇↙ᙰm<": {"퉻:dꂁ&efᅫ쫢[\"돈늖꺙|Ô剐1͖-K:ʚ᭕/;쏖㷛]I痐职4gZ4⍜kเꛘZ⥺\\Bʫᇩ鄨魢弞&幟ᓮ2̊盜", + -9006004849098116748, + -3118404930403695681, + { + "_彃Y艘-\"Xx㤩㳷瑃?%2䐡鵛o귵옔夘v*탋职&㳈챗|O钧": [ + false, + "daꧺdᗹ羞쯧H㍤鄳頳<型孒ン냆㹀f4㹰\u000f|C*ሟ鰠(O<ꨭ峹ipຠ*y೧4VQ蔔hV淬{?ᵌEfrI_", + "j;ꗣ밷邍副]ᗓ", + -4299029053086432759, + -5610837526958786727, + [ + null, + [ + -1.3958390678662759E-19, + { + "lh좈T_믝Y\"伨\u001cꔌG爔겕ꫳ晚踍⿻읐T䯎]~e#฽燇\"5hٔ嶰`泯r;ᗜ쮪Q):/t筑,榄&5懶뎫狝(": [{ + "2ፁⓛ]r3C攟וּ9賵s⛔6'ஂ|\"ⵈ鶆䐹禝3\"痰ࢤ霏䵩옆䌀?栕r7O簂Isd?K᫜`^讶}z8?z얰T:X倫⨎ꑹ": -6731128077618251511, + "|︦僰~m漿햭\\Y1'Vvخ굇ቍ챢c趖": [null] + }], + "虌魿閆5⛔煊뎰㞤ᗴꥰF䮥蘦䂪樳-K᝷-(^\u20dd_": 2.11318679791770592E17 + } + ] + ] + ]}, + "묗E䀳㧯᳀逞GMc\b墹㓄끖Ơ&U??펌鑍 媋k))ᄊ": null, + "묥7콽벼諌J_DɯﮪM殴䣏,煚ྼ`Y:씧<\/⩫%yf䦀!1Ჶk춎Q米W∠WC跉鬽*ᛱi㴕L꘻ꀏ쓪\"_g鿄'#t⽙?,Wg㥖|D鑆e⥏쪸僬h鯔咼ඡ;4TK聎졠嫞" + } + ] + ] + } + ] + ] + ]}} + } + ]} + }, + "뿋뀾淣截䔲踀&XJ펖꙯^Xb訅ꫥgᬐ>棟S\"혧騾밫겁7-": "擹8C憎W\"쵮yR뢩浗絆䠣簿9䏈引Wcy䤶孖ꯥ;퐌]輩䍐3@{叝 뽸0ᡈ쵡Ⲇ\u001dL匁꧐2F~ݕ㪂@W^靽L襒ᦘ~沦zZ棸!꒲栬R" + } + ] + ], + "Z:덃൛5Iz찇䅄駠㭧蓡K1": "e8᧤좱U%?ⵇ䯿鿝\u0013縮R∱骒EO\u000fg?幤@֗퉙vU`", + "䐃쪈埽້=Ij,쭗쓇చ": false + }]}} + ] + } + ]} + } + ] + ] + ], + "咰긖VM]᝼6䓑쇎琺etDҌ?㞏ꩄ퇫밉gj8蠃\"⩐5䛹1ࣚ㵪": "ക蹊?⎲⧘⾚̀I#\"䈈⦞돷`wo窭戕෱휾䃼)앷嵃꾞稧,Ⴆ윧9S?೗EMk3Მ3+e{⹔Te驨7䵒?타Ulg悳o43" + } + ], + "zQᤚ纂땺6#ٽ﹧v￿#ࠫ휊冟蹧텈ꃊʆ?&a䥯De潝|쿓pt瓞㭻啹^盚2Ꝋf醪,얏T窧\\Di䕎谄nn父ꋊE": -2914269627845628872, + "䉩跐|㨻ᷢ㝉B{蓧瞸`I!℄욃힕#ೲᙾ竛ᔺCjk췒늕貭词\u0017署?W딚%(pꍁ⤼띳^=on뺲l䆼bzrﳨ[&j狸䠠=ᜑꦦ\u2061յnj=牲攑)M\\龏": false, + "뎕y絬᫡⥮Ϙᯑ㌔/NF*˓.,QEzvK!Iwz?|쥾\"ꩻL꼗Bꔧ賴緜s뉣隤茛>ロ?(?^`>冺飒=噸泥⺭Ᲊ婓鎔븜z^坷裮êⓅ໗jM7ﶕ找\\O": 1.376745434746303E-19 + }, + "䐛r滖w㏤,|Nዜ": false + } + ]], + "@꿙?薕尬 gd晆(띄5躕ﻫS蔺4)떒錸瓍?~": 1665108992286702624, + "w믍nᏠ=`঺ᅥC>'從됐槷䤝眷螄㎻揰扰XᅧC贽uჍ낟jKD03T!lDV쀉Ӊy뢖,袛!终캨G?鉮Q)⑗1쾅庅O4ꁉH7?d\u0010蠈줘월ސ粯Q!낇껉6텝|{": null, + "~˷jg쿤촖쉯y": -5.5527605669177098E18, + "펅Wᶺzꐆと푭e?4j仪열[D<鈑皶婆䵽ehS?袪;HꍨM뗎ば[(嗏M3q퍟g4y╸鰧茀[Bi盤~﫝唎鋆彺⦊q?B4쉓癚O洙킋툈䶯_?ퟲ": null + } + ] + ]] + ]], + "꟱Ԕ㍤7曁聯ಃ錐V䷰?v㪃૦~K\"$%请|ꇹn\"k䫛㏨鲨\u2023䄢\u0004[︊VJ?䶟ាꮈ䗱=깘U빩": -4863152493797013264 + } + ]}]} + ] + }}} + ], + "쏷쐲۹퉃~aE唙a챑,9㮹gLHd'䔏|킗㍞䎥&KZYT맵7䥺Nⱳ同莞鿧w\\༌疣n/+ꎥU\"封랾○ퟙAJᭌ?9䛝$?驔9讐짘魡T֯c藳`虉C읇쐦T" + } + ], + "谶개gTR￐>ၵ͚dt晑䉇陏滺}9㉸P漄": -3350307268584339381 + }] + ] + ] + ]] + ] + ], + "0y꟭馋X뱔瑇:䌚￐廿jg-懲鸭䷭垤㒬茭u賚찶ಽ+\\mT땱\u20821殑㐄J쩩䭛ꬿNS潔*d\\X,壠뒦e殟%LxG9:摸": 3737064585881894882, + "풵O^-⧧ⅶvѪ8廸鉵㈉ר↝Q㿴뺟EႳvNM:磇>w/៻唎뷭୥!냹D䯙i뵱貁C#⼉NH6`柴ʗ#\\!2䂗Ⱨf?諳.P덈-返I꘶6?8ꐘ": -8934657287877777844, + "溎-蘍寃i诖ര\"汵\"\ftl,?d⼡쾪⺋h匱[,෩I8MҧF{k瓿PA'橸ꩯ綷퉲翓": null + } + ] + ], + "ោ係؁<元": 1.7926963090826924E-18 + }}] + } + ] + ]]}] + }] + ] + ] + ] + ], + "ጩV<\"ڸsOᤘ": 2.0527167903723048E-19 + }] + ]} + ] + ]], + "∳㙰3젴p᧗䱙?`yZA8Ez0,^ᙛ4_0븢\u001ft:~䎼s.bb룦明yNP8弆C偯;⪾짍'蕴뮛": -6976654157771105701, + "큵ꦀ\\㇑:nv+뒤燻䀪ﴣ﷍9ᚈ኷K㚊誦撪䚛,ꮪxሲ쳊\u0005HSf?asg昱dqꬌVꙇ㼺'k*'㈈": -5.937042203633044E-20 + } + ] + }], + "?}\u20e0],s嶳菋@#2u쒴sQS䩗=ꥮ;烌,|ꘔ䘆": "ᅩ영N璠kZ먕眻?2ቲ芋眑D륟渂⸑ﴃIRE]啗`K'" + }}, + "쨀jmV賂ﰊ姐䂦玞㬙ᏪM᪟Վ씜~`uOn*ॠ8\u000ef6??\\@/?9見d筜ﳋB|S䝬葫㽁o": true + }, + "즛ꄤ酳艚␂㺘봿㎨iG৕ࡿ?1\"䘓您\u001fSኝ⺿溏zៀ뻤B\u0019?윐a䳵᭱䉺膷d:<\/": 3935553551038864272 + } + ] + ]} + ]] + ]] + ]} + } + ] + } + ]]}}, + "᥺3h↛!ꋰy\"攜(ெl䪕oUkc1A㘞ᡲ촾ᣫ<\/䒌E㛝潨i{v?W౾H\\RჅpz蝬R脾;v:碽✘↯삞鷱o㸧瑠jcmK7㶧뾥찲n": true, + "ⶸ?x䊺⬝-䰅≁!e쩆2ꎿ准G踌XXᩯ1߁}0?.헀Z馟;稄\baDꟹ{-寪⚈ꉷ鮸_L7ƽᾚ<\u001bጨA䧆송뇵⨔\\礍뗔d设룱㶉cq{HyぱR㥽吢ſtp": -7985372423148569301, + "緫#콮IB6<\/=5Eh礹\t8럭@饹韠r㰛斣$甝LV췐a갵'请o0g:^": "䔨(.", + "띳℡圤pン௄ĝ倧訜B쁟G䙔\"Sb⓮;$$▏S1J뢙SF|赡g*\"Vu䲌y": "䪈&틐),\\kT鬜1풥;뷴'Zေ䩹@J鞽NぼM?坥eWb6榀ƩZڮ淽⺞삳煳xჿ絯8eⶍ羷V}ჿ쎱䄫R뱃9Z>'\u20f1ⓕ䏜齮" + } + ] + ]]] + }} + } + ] + ]}, + "펮b.h粔폯2npX詫g錰鷇㇒<쐙S値bBi@?镬矉`剔}c2壧ଭfhY깨R()痩⺃a\\⍔?M&ﯟ<劜꺄멊ᄟA\"_=": null + }, + "~潹Rqn榢㆓aR鬨侅?䜑亡V_翅㭔(䓷w劸ၳDp䀅<\/ﰎ鶊m䵱팱긽ꆘ긓准D3掱;o:_ќ)껚콥8곤d矦8nP倥ꃸI": null, + "뾎/Q㣩㫸벯➡㠦◕挮a鶧⋓偼\u00001뱓fm覞n?㛅\"": 2.8515592202045408E17 + }], + ",": -5426918750465854828, + "2櫫@0柡g䢻/gꆑ6演&D稒肩Y?艘/놘p{f투`飷ᒉ챻돎<늛䘍ﴡ줰쫄": false, + "8(鸑嵀⵹ퟡ<9㣎Tߗ┘d슒ل蘯&㠦뮮eࠍk砝g 엻": false, + "d-\u208b?0ﳮ嵙'(J`蔿d^踅⤔榥\\J⵲v7": 6.8002426206715341E17, + "ཎ耰큓ꐕ㱷\u0013y=詽I\"盈xm{0쾽倻䉚ષso#鰑/8㸴짯%ꀄ떸b츟*\\鲷礬ZQ兩?np㋄椂榨kc᡹醅3": false, + "싊j20": false + }]] + ]], + "俛\u0017n緽Tu뫉蜍鼟烬.ꭠIⰓ\"Ἀ᜾uC쎆J@古%ꛍm뻨ᾀ画蛐휃T:錖㑸ዚ9죡$": true + } + ] + ], + "㍵⇘ꦖ辈s}㱮慀밒s`\"㞟j:`i픻Z섫^諎0Ok{켿歁෣胰a2﨤[탳뚬쎼嫭뉮m": 409440660915023105, + "w墄#*ᢄ峠밮jLa`ㆪ꺊漓Lで끎!Agk'ꁛ뢃㯐岬D#㒦": false, + "ଦPGI䕺L몥罭ꃑ궩﮶#⮈ᢓӢ䚬p7웼臧%~S菠␌힀6&t䳙y㪘냏\\*;鉏ᅧ鿵'嗕pa\"oL쇿꬈Cg": "㶽1灸D⟸䴅ᆤ뉎﷛渤csx 䝔цꬃ锚捬?ຽ+x~꘩uI࡞\u0007栲5呚ẓem?袝\")=㥴䨃pac!/揎Y", + "ᷱo\\||뎂몷r篙|#X䦜I#딌媸픕叞RD斳X4t⯩夬=[뭲r=绥jh뷱츝⪘%]⚋܈㖴スH텹m(WO曝劉0~K3c柢Ր㏉着逳~": false, + "煽_qb[첑\\륌wE❽ZtCNﭝ+餌ᕜOꛭ": "{ﳾ쉌&s惧ᭁⵆ3䢫;䨞팑꒪흘褀࢖Q䠿V5뭀䎂澻%받u5텸oA⮥U㎦;B䳌wz䕙$ឿ\\௅婺돵⪾퐆\\`Kyौꋟ._\u0006L챯l뇠Hi䧈偒5", + "艊佁ࣃ롇䱠爬!*;⨣捎慓q靓|儑ᨋL+迥=6㒺딉6弄3辅J-㕎뛄듘SG㆛(\noAzQꝱ䰩X*ぢO퀌%펠낌mo틮a^<\/F&_눊ᾉ㨦ы4\"8H": 2974648459619059400, + "鬙@뎣䫳ၮ끡?){y?5K;TA*k溱䫜J汃ꂯ싔썍\u001dA}룖(<\/^,": false, + "몏@QꋦFꊩᒐ뎶lXl垨4^郣|ꮇ;䝴ᝓ}쵲z珖": null + } + ]]]], + ":_=닧弗D䙋暨鏛. 㱻붘䂍J儒&ZK/녩䪜r囁⽯D喠죥7⹌䪥c\u001a\u2076￞妈朹oLk菮F౟覛쐧㮏7T;}蛙2{9\"崓bB<\/⡷룀;즮鿹)丒툃୤뷠5W⊢嶜(fb뭳갣": "E{响1WM" + }}, + "䘨tjJ驳豨?y輊M*᳑梵瞻઻ofQG瑮e": 2.222802939724948E-19, + "䮴=❑➶T෋w䞜\"垦ꃼUt\u001dx;B$뵣䙶E↌艣ᡥ!᧟;䱀[䔯k쬃`੍8饙른熏'2_'袻tGf蒭J땟as꯳╖&啒zWࡇᒫYSᏬ\u0014ℑ첥鈤|cG~Pᓮ\">\"": "ႆl\f7V儊㦬nHꄬꨧC{쐢~C⮃⛓嶦vꄎ1w鰠嘩뿠魄&\"_qMⵖ釔녮ꝇ 㝚{糍J哋 cv?-jkﻯྌ鹑L舟r", + "龧葆yB✱H盋夔ﶉ?n*0(": "ꧣኆ㢓氥qZZ酒ຜ)鮢樛)X䣆gTSґG텞k.J圬疝롫쯭z L:\\ྤ@w炋塜쿖ᾳy뢀䶃뱝N䥨㚔勇겁#p", + "도畎Q娡\"@S/뼋:䵏!P衅촚fVHQs✜ᐫi㻑殡B䜇%믚k*U#濨낄~": "ꍟዕ쳸ꍈ敋&l妏\u0005憡멗瘌uPgᅪm<\/To쯬锩h뒓k" + } + ] + }], + "墥홞r绚<\/⸹ⰃB}<躅\\Y;๑@䔸>韫䜲뱀X뗩鿥쩗SI%ﴞ㳕䛇?<\/\u00018x\\&侂9鋙a[LR㋭W胕)⡿8㞙0JF,}?허d1cDMᐃ␛鄝ⱕ%X)!XQ": "ⳍꗳ=橇a;3t⦾꼑仈ူaᚯ⯋ꕃAs鴷N⍕_䎃ꙎAz\u0016䯷\\<࿫>8q{}キ?ᣰ}'0ᴕ펓B┦lF#趤厃T?㕊#撹圂䆲" + }, + "܋닐龫論c웑": false, + "ㇿ/q\"6-co髨휝C큦#\u001b4~?3䐹E삇<<": 7.600917488140322E-20, + "䁝E6?㣖ꃁ间t祗*鑠{ḣV(浾h逇큞=W?ૉ?nꇽ8ꅉຉj으쮺@Ꚅ㰤u]Oyr": "v≁᫸_*όAඤԆl)ۓᦇQ}폠z༏q滚", + "ソ᥊/넺I": true + }]] + ] + ] + ] + ]] + }, + "䭑Ik攑\u0002QV烄:芩.麑㟴㘨≕": true, + "坄꿕C쇻풉~崍%碼\\8\"䬦꣙": null, + "欌L圬䅘Y8c(♺2?ON}o椳s宥2䉀eJ%闹r冁O^K諭%凞⺉⡻,掜?$ꥉ?略焕찳㯊艼誜4?\"﯎<゛XፈINT:詓 +": -1.0750456770694562E-19, + "獒àc뜭싼ﺳ뎤K`]p隨LtE": null, + "甙8䵊神EIꩤ鐯ᢀ,ﵮU䝑u疒ử驺䚿≚ഋ梶秓F`覤譐#짾蔀묊4<媍쬦靪_Yzgcࡶ4k紥`kc[Lﮗ簐*I瀑[⾰L殽鑥_mGȠ<\/|囹灠g桰iri": true, + "챓ꖙꟻ좝菇ou,嗠0\\jK핻뜠qwQ?ഩ㼕3Y彦b\u009bJ榶N棨f?됦鏖綃6鳵M[OE봨u햏.Ꮁ癜蟳뽲ꩌ뻾rM豈R嗀羫 uDꎚ%": null + }, + "V傜2<": 7175127699521359521 + }], + "铫aG切<\/\"ী⊆e<^g࢛)D顝nאַ饼\u008c猪繩嵿ﱚCꡬ㻊g엺A엦\u000f暿_f꿤볝㦕桦`蒦䎔j甬%岝rj 糏": "䚢偎눴Au<4箞7礦Iﱔ坠eȧ䪸u䵁p|逹$嗫쨘ꖾ﷐!胠z寓팢^㨔|u8Nሇe텔ꅦ抷]،鹎㳁#༔繁 ", + "낂乕ꃻ볨ϱ-ꇋ㖍fs⿫)zꜦ/K?솞♞ꑌ宭hJ᤭瑥Fu": false, + "쟰ぜ魛G\u0003u?`㾕ℾ㣭5螠烶這趩ꖢ:@咕ꐶx뒘느m䰨b痃렐0鳊喵熬딃$摉_~7*ⱦ녯1錾GKhJ惎秴6'H妈Tᧅ窹㺒疄矤铟wላ": null, + "쯆q4!3錕㲏ⵆ㇛꘷Z瑩뭆\\◪NH\u001d\\㽰U~㯶<\"쑣낞3ᵤ'峉eꢬ;鬹o꣒木X*長PXᘱu\"䠹n惞": null, + "ᅸ祊\"&ꥴCjࢼ﴿?䡉`U效5殼㮞V昽ꏪ#ﺸ\\&t6x꠹盥꣰a[\u001aꪍSpe鎿蠹": -1.1564713893659811E-19 + } + ]] + ] + ] + ], + "羵䥳H,6ⱎ겾|@t\"#햊1|稃 섭)띜=뻔ꡜ???櫎~*ῡ꫌/繣ﻠq": null + } + ]} + ]}, + "츤": false + }}, + "s": 3.7339341963399598E18 + } + ], + "N,I?1+㢓|ࣱ嶃쩥V2\u0012(4EE虪朶$|w颇v步": "~읢~_,Mzr㐫YB溓E淚\"ⅹ䈔ᏺ抙 b,nt5V㐒J檶ꏨ⻔?", + "Q껑ꡡ}$넎qH煔惍/ez^!ẳF댙䝌馻剁8": "梲;yt钰$i冄}AL%a j뜐奷걳뚾d꿽*ሬuDY3?뮟鼯뮟w㍪틱V", + "o{Q/K O胟㍏zUdꀐm&⨺J舕⾏魸訟㌥[T籨櫉唐킝 aṭ뱫촙莛>碶覆⧬짙쭰ׯdAiH໥벤퐥_恸[ 0e:죃TC弼荎뵁DA:w唵ꣁ": null, + "὏樎䵮軧|?౗aWH쩃1 ꅭsu": null + } + ] + }, + "勂\\&m鰈J釮=Ⲽ鳋+䂡郑": null, + "殣b綊倶5㥗惢⳷萢ᑀ䬄镧M^ﱴ3⣢翣n櫻1㨵}ኯ뗙顖Z.Q➷ꮨ뗇\u0004": "ꔙ䁼>n^[GीA䨟AM琢ᒊS쨲w?d㶣젊嘶纝麓+愣a%気ྞSc됓ᔘ:8bM7Xd8㶑臌]Ꙥ0ꐭ쒙䫣挵C薽Dfⵃ떼᷸", + "?紡.셪_෨j\u0013Ox┠$Xᶨ-ᅇo薹-}軫;y毝㪜K㣁?.EV쮱4둽⛻䤜'2盡\u001f60(|e쐰㼎ᦀ㒧-$l@ﻑ坳\u0003䭱响巗WFo5c㧆T턁Y맸♤(": -2.50917882560589088E17 + }} + ], + "侸\\릩.᳠뎠狣살cs项䭩畳H1s瀉븇19?.w骴崖㤊h痠볭㞳㞳䁮Ql怠㦵": "@䟴-=7f", + "鹟1x௢+d ;vi䭴FSDS\u0004hꎹ㚍?⒍⦏ў6u,扩@됷Su)Pag휛TᒗV痩!瞏釀ꖞ蘥&ೞ蘐ꭰꞇᝎ": "ah懱Ժ&\u20f7䵅♎඀䞧鿪굛ౕ湚粎蚵ᯋ幌YOE)५襦㊝Y*^\"R+ඈ咷蝶9ꥂ榨艦멎헦閝돶v좛咊E)K㓷ྭr", + "搆q쮦4綱켙셁.f4<\/g<籽늷?#蚴픘:fF\u00051㹉뀭.ᰖ풎f֦Hv蔎㧤.!䭽=鞽]음H:?\"-4": 8.740133984938656E-20 + }]} + } + ], + "tVKn딩꘥⊾蹓᤹{\u0003lR꼽ᄲQFᅏ傅ﱋ猢⤊ᔁ,E㓒秤nTතv`♛I\u0000]꫔ṞD\"麵c踝杰X&濿또꣹깳౥葂鿎\\aꡨ?": 3900062609292104525 + } + ], + "ਉ샒⊩Lu@S䧰^g": -1.1487677090371648E18, + "⎢k⑊꬗yᏫ7^err糎Dt\u000bJ礯확ㆍ沑サꋽe赔㝢^J\u0004笲㿋idra剰-᪉C錇/Ĝ䂾ညS지?~콮gR敉⬹'䧭": 1901472137232418266, + "灗k䶥:?촽贍쓉꓈㒸g獘[뵎\\胕?\u0014_榙p.j稶,$`糉妋0>Fᡰly㘽$?": "]ꙛO赎&#㠃돱剳\"<◆>0誉齐_|z|裵씪>ᐌ㼍\"Z[琕}O?G뚇諦cs⠜撺5cu痑U圲\u001c?鴴計l춥/╓哼䄗茏ꮅ뫈댽A돌롖뤫V窗讬sHd&\nOi;_u" + } + ], + "Uﺗ\\Y\\梷䄬~\u0002": null, + "k\"Y磓ᗔ휎@U冈<\/w컑)[": false, + "曏J蝷⌻덦\u001f㙳s꥓⍟邫P늮쥄c∬ྡྷ舆렮칤Z趣5콡넛A쳨\\뀙骫(棻.*&輛LiIfi{@EA婳KᬰTXT": -4.3088230431977587E17 + }]} + ] + ], + "곃㲧<\/dఓꂟs其ࡧ&N葶=?c㠤Ჴ'횠숄臼#\u001a~": false + } + ] + ]}] + }] + }} + ], + "2f`⽰E쵟>J笂裭!〛觬囀ۺ쟰#桊l鹛ⲋ|RA_Vx፭gE됓h﵀mfỐ|?juTU档[d⢼⺻p濚7E峿": 5613688852456817133 + }, + "濘끶g忮7㏵殬W팕Q曁 뫰)惃廊5%-蹚zYZ樭ﴷQ锘쯤崫gg": true, + "絥ᇑ⦏쒓븣爚H.㗊߄o蘵貆ꂚ(쎔O᥉ﮓ]姨Wꁓ!RMA|o퉢THx轮7M껁U즨'i뾘舯o": "跥f꜃?" + }} + ], + "鷰鹮K-9k;ﰰ?_ݦѷ-ꅣ䩨Zꥱ\"mꠟ屎/콑Y╘2&鸞脇㏢ꀇ࠺ⰼ拾喭틮L꽩bt俸墶 [l/웄\"꾦\u20d3iও-&+\u000fQ+໱뵞": -1.296494662286671E-19 + }, + "HX੹/⨇୕붷Uﮘ旧\\쾜͔3l鄈磣糂̖䟎Eᐳw橖b῀_딕hu葰窳闹вU颵|染H죶.fP䗮:j䫢\\b뎖i燕ꜚG⮠W-≚뉗l趕": "ଊ칭Oa᡺$IV㷧L\u0019脴셀붿餲햪$迳向쐯켂PqfT\" ?I屉鴼쿕@硙z^鏕㊵M}㚛T젣쓌-W⩐-g%⺵<뮱~빅╴瑿浂脬\u0005왦燲4Ⴭb|D堧 <\/oEQh", + "䘶#㥘੐캔f巋ἡAJ䢚쭈ࣨ뫒*mᇊK,ࣺAꑱ\u000bR<\/A\"1a6鵌㯀bh곿w(\"$ꘁ*rಐ趣.d࿩k/抶면䒎9W⊃9": "漩b挋Sw藎\u0000", + "畀e㨼mK꙼HglKb,\"'䤜": null + }]}] + ] + ] + }] + ]} + ] + ]} + ], + "歙>駿ꣂ숰Q`J΋方樛(d鱾뼣(뫖턭\u20f9lচ9歌8o]8윶l얶?镖G摄탗6폋폵+g:䱫홊<멀뀿/س|ꭺs걐跶稚W々c㫣⎖": "㣮蔊깚Cꓔ舊|XRf遻㆚︆'쾉췝\\&言", + "殭\"cށɨꝙ䞘:嬮e潽Y펪㳅/\"O@ࠗ겴]췖YǞ(t>R\"N?梳LD恭=n氯T豰2R諸#N}*灧4}㶊G䍣b얚": null, + "襞<\/啧 B|싞W瓇)6簭鼡艆lN쩝`|펭佡\\間邝[z릶&쭟愱ꅅ\\T᰽1鯯偐栈4̸s윜R7⒝/똽?치X": "⏊躖Cﱰ2Qẫ脐&இ?%냝悊", + ",鰧偵셣싹xᎹ힨᯳EṬH㹖9": -4604276727380542356 + } + } + ]]]], + "웺㚑xs}q䭵䪠馯8?LB犯zK'os䚛HZ\"L?셎s^㿧㴘Cv2": null + }] + ] + ] + ], + "Kd2Kv+|z": 7367845130646124107, + "ᦂⶨ?ᝢ 祂些ഷ牢㋇操\"腭䙾㖪\\(y4cE뽺ㆷ쫺ᔖ%zfۻ$ў1柦,㶢9r漢": -3.133230960444846E-20, + "琘M焀q%㢟f鸯O⣏蓑맕鯊$O噷|)z褫^㢦⠮ꚯ꫞`毕1qꢚ{ĭ䎀বώT\"뱘3G൴?^^of": null + } + ], + "a8V᯺?:ﺃ/8ꉿBq|9啓댚;*i2": null, + "cpT瀇H珰Ừpೃi鎪Rr␣숬-鹸ҩ䠚z脚цGoN8入y%趌I┽2ឪЀiJNcN)槣/▟6S숆牟\"箑X僛G殱娇葱T%杻:J諹昰qV쨰": 8331037591040855245 + }], + "G5ᩜ䄗巢껳": true + } + }, + "Ồ巢ゕ@_譙A`碫鄐㡥砄㠓(^K": "?܃B혢▦@犑ὺD~T⧁|醁;o=J牌9냚⢽㨘{4觍蚔9#$∺\u0016p囅\\3Xk阖⪚\"UzA穕롬✎➁㭒춺C㣌ဉ\"2瓑员ᅽꝶ뫍}꽚ꞇ鶂舟彺]ꍽJC蝧銉", + "␆Ě膝\"b-퉐ACR言J謈53~V튥x䜢?ꃽɄY뮩ꚜ": "K/↾e萃}]Bs⾿q룅鷦-膋?m+死^魊镲6", + "粡霦c枋AHퟁo礼Ke?qWcA趸㡔ꂏ?\u000e춂8iতᦜ婪\u0015㢼nﵿꍻ!ᐴ関\u001d5j㨻gfῩUK5Ju丝tかTI'?㓏t>⼟o a>i}ᰗ;뤕ܝ": false, + "ꄮ匴껢ꂰ涽+䜨B蛹H䛓-k蕞fu7kL谖,'涃V~챳逋穞cT\"vQ쓕ObaCRQ㓡Ⲯ?轭⫦輢墳?vA餽=h䮇킵n폲퉅喙?\"'1疬V嬗Qd灗'Lự": "6v!s믁㭟㣯獃!磸餠ቂh0C뿯봗F鷭gꖶ~コkK<ᦈTt\\跓w㭣횋钘ᆹ듡䑚W䟾X'ꅔ4FL勉Vܴ邨y)2'〚쭉⽵-鞣E,Q.?块", + "?(˧쩯@崟吋歄K": null + }, + "Gc럃녧>?2DYI鴿\\륨)澔0ᔬlx'觔7젘⤡縷螩%Sv׫묈/]↱&S h\u0006歋ᑛxi̘}ひY蔯_醨鯘煑橾8?䵎쨋z儬ꁏ*@츾:": null + } + } + } + ] + ] + ]} + }, + "HO츧G": 3.694949578823609E17, + "QC\u0012(翻曇Tf㷟bGBJ옉53\\嚇ᛎD/\u001b夾၉4\"핀@祎)쫆yD\"i먎Vn㿿V1W᨝䶀": -6150931500380982286, + "Z㓮P翸鍱鉼K䋞꘺튿⭁Y": -7704503411315138850, + "]모开ꬖP븣c霤<[3aΠ\"黁䖖䰑뮋ꤦ秽∼㑷冹T+YUt\"싳F↭䖏&鋌": -2.7231911483181824E18, + "tꎖ": -4.9517948741799555E-19, + "䋘즊.⬅IꬃۣQ챢ꄑ黐|f?C⾺|兕읯sC鬸섾整腨솷V": "旆柩l쪦sᖸMy㦅울썉瘗㎜檵9ꍂ駓ૉᚿ/u3씅徐拉[Z䞸ࡗ1ꆱ&Q풘?ǂ8\u0011BCDY2볨;鸏": null, + "幫 n煥s쁇펇 왊-$C\"衝:\u0014㣯舼.3뙗Yl⋇\"K迎멎[꽵s}9鉳UK8쐥\"掄㹖h㙈!얄સ?Ꜳ봺R伕UTD媚I䜘W鏨蔮": -4.150842714188901E-17, + "ﺯ^㄄\b죵@fྉkf颡팋Ꞧ{/Pm0V둳⻿/落韒ꊔᚬ@5螺G\\咸a谆⊪ቧ慷绖?财(鷇u錝F=r၍橢ឳn:^iᴵtD볠覅N赴": null + }] + }] + } + ] + ]} + ]}, + "謯?w厓奰T李헗聝ឍ貖o⪇弒L!캶$ᆅ": -4299324168507841322, + "뺊奉_垐浸延몏孄Z舰2i$q붿좾껇d▵餏\"v暜Ҭ섁m￴g>": -1.60911932510533427E18 + } + ] + } + ] + ]], + "퉝꺔㠦楶Pꅱ": 7517896876489142899, + "": false + } + ]}, + "是u&I狻餼|谖j\"7c됮sסּ-踳鉷`䣷쉄_A艣鳞凃*m⯾☦椿q㎭N溔铉tlㆈ^": 1.93547720203604352E18, + "kⲨ\\%vr#\u000bⒺY\\t<\/3﬌R訤='﹠8蝤Ꞵ렴曔r": false + } + ]}, + "阨{c?C\u001d~K?鎌Ԭ8烫#뙣P초遗t㭱E­돒䆺}甗[R*1!\\~h㕅᰺@<9JꏏષI䳖栭6綘걹ᅩM\"▯是∔v鬽顭⋊譬": "운ﶁK敂(欖C취پ℄爦賾" + } + }} + }], + "鷨赼鸙+\\䭣t圙ڹx᜾ČN<\/踘\"S_맶a鷺漇T彚⎲i㈥LT-xA캔$\u001cUH=a0츺l릦": "溣㣂0濕=鉵氬駘>Pꌢpb솇쬤h힊줎獪㪬CrQ矠a&脍꼬爼M茴/΅\u0017弝轼y#Ꞡc6둴=?R崏뷠麖w?" + }, + "閕ᘜ]CT)䵞l9z'xZF{:ؐI/躅匽졁:䟇AGF૸\u001cퟗ9)駬慟ꡒꆒRS״툋A<>\u0010\"ꂔ炃7g덚E৏bꅰ輤]o㱏_뷕ܘ暂\"u": "芢+U^+㢩^鱆8*1鈶鮀\u0002뺰9⬳ꪮlL䃣괟,G8\u20a8DF㉪錖0ㄤ瓶8Nଷd?眡GLc陓\\_죌V쁰ल二?c띦捱 \u0019JC\u0011b⤉zẒT볕\"绣蘨뚋cꡉkI\u001e鳴", + "ꃣI'{6u^㡃#཰Kq4逹y൒䧠䵮!㱙/n??{L풓ZET㙠퍿X2᩟綳跠葿㚙w཮x캽扳B唕S|尾}촕%N?o䪨": null, + "ⰴFjෟ셈[\u0018辷px?椯\\1<ﲻ栘ᣁ봢憠뉴p": -5263694954586507640 + } + ] + ]] + ]} + ]}] + ] + ], + "?#癘82禩鋆ꊝty?&": -1.9419029518535086E-19 + } + ] + ] + ]} + ] + ] + ], + "훊榲.|῕戄&.㚏Zꛦ2\"䢥ሆ⤢fV_摕婔?≍Fji冀탆꜕i㏬_ẑKᅢ꫄蔻XWc|饡Siẘ^㲦?羡2ぴ1縁ᙅ?쐉Ou": false + }]] + ]}}}, + "慂뗄卓蓔ᐓ匐嚖/颹蘯/翻ㆼL?뇊,텵<\\獷ごCボ": null + }, + "p溉ᑟi짣z:䒤棇r^٫%G9缑r砌롧.물农g?0׼ሩ4ƸO㣥㯄쩞ጩ": null, + "껎繥YxK\"F젷쨹뤤1wq轫o?鱑뜀瘊?뎃h灑\\ꛣ}K峐^ኖ⤐林ꉓhy": null + } + ], + "᱀n肓ㄛ\"堻2>m殮'1橌%Ꞵ군=Ӳ鯨9耛<\/n據0u彘8㬇៩f᏿诙]嚊": "䋯쪦S럶匏ㅛ#)O`ሀX_鐪渲⛀㨻宅闩➈ꢙஶDR⪍" + }, + "tA썓龇 ⋥bj왎录r땽✒롰;羋^\\?툳*┎?썀ma䵳넅U䳆૘〹䆀LQ0\b疀U~u$M}(鵸g⳾i抦뛹?䤈땚검.鹆?ꩡtⶥGĒ;!ቹHS峻B츪켏f5≺": 2366175040075384032, + "전pJjleb]ួ": -7.5418493141528422E18, + "n.鎖ጲ\n?,$䪘": true + }, + "欈Ar㉣螵᪚茩?O)": null + }, + "쫸M#x}D秱欐K=侫们丐.KꕾxẠ\u001e㿯䣛F܍캗qq8꟞ṢFD훎⵳簕꭛^鳜\u205c٫~⑟~冫ऊ2쫰<\/戲윱o<\"": true + }, + "㷝聥/T뱂\u0010锕|内䞇x侁≦㭖:M?iM᣿IJe煜dG࣯尃⚩gPt*辂.{磼럾䝪@a\\袛?}ᓺB珼": true + } + } + ]]}]}}, + "tn\"6ꫤ샾䄄;銞^%VBPwu묪`Y僑N.↺Ws?3C⤻9唩S䠮ᐴm;sᇷ냞඘B/;툥B?lB∤)G+O9m裢0kC햪䪤": -4.5941249382502277E18, + "ᚔt'\\愫?鵀@\\びꂕP큠<<]煹G-b!S?\nꖽ鼫,ݛ&頺y踦?E揆릱H}햧캡b@手.p탻>췽㣬ꒅ`qe佭P>ᓂ&?u}毚ᜉ蟶頳졪ᎏzl2wO": -2.53561440423275936E17 + }]} + } + ] + ]], + "潈촒⿂叡": 5495738871964062986 + } + ]] + } + ] + ]} + ]] + ]] + ]} + ] + ]}, + "ႁq킍蓅R`謈蟐ᦏ儂槐僻ﹶ9婌櫞釈~\"%匹躾ɢ뤥>࢟瀴愅?殕节/냔O✬H鲽엢?ᮈੁ⋧d␽㫐zCe*": 2.15062231586689536E17, + "㶵Ui曚珰鋪ᾼ臧P{䍏䷪쨑̟A뼿T渠誈䏚D1!잶<\/㡍7?)2l≣穷᛾稝{:;㡹nemיּ訊`G": null, + "䀕\"飕辭p圁f#뫆䶷뛮;⛴ᩍ3灚덏ᰝ쎓⦷詵%᜖Մfs⇫(\u001e~P|ﭗCⲾផv湟W첋(텪બT<บSꏉ੗⋲X婵i ӵ⇮?L䬇|ꈏ?졸": 1.548341247351782E-19 + } + ] + }, + "t;:N\u0015q鐦Rt缆{ꮐC?஛㷱敪\\+鲊㉫㓪몗릙竏(氵kYS": "XᰂT?൮ô", + "碕飦幑|+ 㚦鏶`镥ꁩ B<\/加륙": -4314053432419755959, + "秌孳(p!G?V傫%8ሽ8w;5鲗㦙LI檸\u2098": "zG N볞䆭鎍흘\\ONK3횙<\/樚立圌Q튅k쩎Ff쁋aׂJK銆ઘ즐狩6༥✙䩜篥CzP(聻駇HHퟲ讃%,ά{렍p而刲vy䦅ክ^톺M楒鍢㹳]Mdg2>䤉洞", + "踛M젧>忔芿㌜Zk": 2215369545966507819, + "씐A`$槭頰퍻^U覒\bG毲aᣴU;8!팲f꜇E⸃_卵{嫏羃X쀳C7뗮m(嚼u N܁谟D劯9]#": true, + "ﻩ!뵸-筚P᭛}ἰ履lPh?౮ⶹꆛ穉뎃g萑㑓溢CX뾇G㖬A錟]RKaꄘ]Yo+@䘁's섎襠$^홰}F": null + }, + "粘ꪒ4HXᕘ蹵.$區\r\u001d묁77pPc^y笲Q<\/ꖶ 訍䃍ᨕG?*": 1.73773035935040224E17 + }, + "婅拳?bkU;#D矠❴vVN쩆t㜷A풃갮娪a%鮏絪3dAv룒#tm쑬⌛qYwc4|L8KZ;xU⓭㳔밆拓EZ7襨eD|隰ऌ䧼u9Ԣ+]贴P荿": 2.9628516456987075E18 + }]}}] + ]} + }} + ]}] + ], + "|g翉F*湹̶\u0005⏐1脉̀eI쩓ᖂ㫱0碞l䴨ꑅ㵽7AtἈ턧yq䳥塑:z:遀ᄐX눔擉)`N3昛oQ셖y-ڨ⾶恢ꈵq^<\/": null, + "菹\\랓G^璬x৴뭸ゆUS겧﮷Bꮤ ┉銜᯻0%N7}~f洋坄Xꔼ<\/4妟Vꄟ9:౟곡t킅冩䧉笭裟炂4봋ⱳ叺怊t+怯涗\"0㖈Hq": false, + "졬믟'ﺇফ圪쓬멤m邸QLব䗁愍4jvs翙 ྍ꧀艳H-|": null, + "컮襱⣱뗠 R毪/鹙꾀%헳8&": -5770986448525107020 + } + ], + "B䔚bꐻ뙏姓展槰T-똌鷺tc灿᫽^㓟䏀o3o$꘭趙萬I顩)뇭Ἑ䓝\f@{ᣨ`x3蔛": null + } + ] + ] + }], + "⦖扚vWꃱ꥙㾠壢輓{-⎳鹷贏璿䜑bG倛⋐磎c皇皩7a~ﳫU╣Q࠭ꎉS摅姽OW.홌ೞ.": null, + "蚪eVlH献r}ᮏ믠ﰩꔄ@瑄ⲱ": null, + "퀭$JWoꩢg역쁍䖔㑺h&ୢtXX愰㱇?㾫I_6 OaB瑈q裿": null, + "꽦ﲼLyr纛Zdu珍B絟쬴糔?㕂짹䏵e": "ḱ\u2009cX9멀i䶛簆㳀k" + } + ]]]], + "(_ꏮg່澮?ᩑyM<艷\u001aꪽ\\庼뙭Z맷㰩Vm\\lY筺]3㋲2㌩㄀Eਟ䝵⨄쐨ᔟgङHn鐖⤇놋瓇Q탚單oY\"♆臾jHᶈ征ቄ??uㇰA?#1侓": null + }, + "觓^~ሢ&iI띆g륎ḱ캀.ᓡꀮ胙鈉": 1.0664523593012836E-19, + "y詭Gbᔶऽs댁U:杜⤎ϲ쁗⮼D醄诿q뙰I#즧v蔎xHᵿt᡽[**?崮耖p缫쿃L菝,봬ꤦC쯵#=X1瞻@OZc鱗CQTx": null + } + ] + }}], + "剘紁\u0004\\Xn⊠6,တױ;嵣崇}讃iႽ)d1\\䔓": null + }, + "脨z\"{X,1u찜<'k&@?1}Yn$\u0015Rd輲ーa쮂굄+B$l": true, + "諳>*쭮괐䵟Ґ+<箁}빀䅱⡔檏臒hIH脟ꩪC핝ଗP좕\"0i<\/C褻D۞恗+^5?'ꂱ䚫^7}㡠cq6\\쨪ꔞꥢ?纖䫀氮蒫侲빦敶q{A煲G": -6880961710038544266 + }}] + }, + "5s⨲JvಽῶꭂᄢI.a৊": null, + "?1q꽏쿻ꛋDR%U娝>DgN乭G": -1.2105047302732358E-19 + } + ] + ]}, + "qZz`撋뙹둣j碇쁏\\ꆥ\u0018@藴疰Wz)O{F䶛l᷂绘訥$]뮍夻䢋䩇萿獰樧猵⣭j萶q)$꬚⵷0馢W:Ⱍ!Qoe": -1666634370862219540, + "t": "=wp|~碎Q鬳Ӎ\\l-<\/^ﳊhn퐖}䍔t碵ḛ혷?靻䊗", + "邙쇡㯇%#=,E4勃驆V繚q[Y댻XV㡸[逹ᰏ葢B@u=JS5?bLRn얮㍉⏅ﰳ?a6[&큟!藈": 1.2722786745736667E-19 + }, + "X블땨4{ph鵋ꉯ웸 5p簂䦭s_E徔濧d稝~No穔噕뽲)뉈c5M윅>⚋[岦䲟懷恁?鎐꓆ฬ爋獠䜔s{\u001bm鐚儸煛%bﯿXT>ꗘ@8G": 1157841540507770724, + "媤娪Q杸\u0011SAyᡈ쿯": true, + "灚^ಸ%걁<\/蛯?\"祴坓\\\\'흍": -3.4614808555942579E18, + "釴U:O湛㴑䀣렑縓\ta)(j:숾却䗌gCiB뽬Oyuq輥厁/7)?今hY︺Q": null + } + ] + ]]]}] + ], + "I笔趠Ph!<ཛྷ㸞诘X$畉F\u0005笷菟.Esr릙!W☆䲖뗷莾뒭U\"䀸犜Uo3Gꯌx4r蔇᡹㧪쨢準<䂀%ࡡꟼ瑍8炝Xs0䀝销?fi쥱ꆝલBB": -8571484181158525797, + "L⦁o#J|\"⽩-㱢d㌛8d\\㶤傩儻E[Y熯)r噤὘勇 }": "e(濨쓌K䧚僒㘍蠤Vᛸ\"络QJL2,嬓왍伢㋒䴿考澰@(㏾`kX$끑эE斡,蜍&~y", + "vj.|统圪ᵮPL?2oŶ`밧\"勃+0ue%⿥绬췈체$6:qa렐Q;~晘3㙘鹑": true, + "ශؙ4獄⶿c︋i⚅:ん閝Ⳙ苆籦kw{䙞셕pC췃ꍬ␜꟯ꚓ酄b힝hwk꭭M鬋8B耳쑘WQ\\偙ac'唀x᪌\u2048*h짎#ፇ鮠뾏ឿ뀌": false, + "⎀jꄒ牺3Ⓝ컴~?親ꕽぼܓ喏瘘!@<튋㐌꿱⩦{a?Yv%⪧笯Uܱ栅E搚i뚬:ꄃx7䙳ꦋ&䓹vq☶I䁘ᾘ涜\\썉뺌Lr%Bc㍜3?ꝭ砿裞]": null, + "⭤뙓z(㡂%亳K䌽꫿AԾ岺㦦㼴輞낚Vꦴw냟鬓㹈뽈+o3譻K1잞": 2091209026076965894, + "ㇲ\t⋇轑ꠤ룫X긒\"zoY읇희wj梐쐑l侸`e%s": -9.9240075473576563E17, + "啸ꮑ㉰!ᚓ}銏": -4.0694813896301194E18, + ">]囋੽EK뇜>_ꀣ緳碖{쐐裔[<ನ\"䇅\"5L?#xTwv#罐\u0005래t应\\N?빗;": "v쮽瞭p뭃" + } + ]], + "斴槾?Z翁\"~慍弞ﻆ=꜡o5鐋dw\"?K蠡i샾ogDﲰ_C*⬟iㇷ4nય蟏[㟉U꽌娛苸 ঢ়操贻洞펻)쿗૊許X⨪VY츚Z䍾㶭~튃ᵦ<\/E臭tve猑x嚢": null, + "锡⛩<\/칥ꈙᬙ蝀&Ꚑ籬■865?_>L詏쿨䈌浿弥爫̫lj&zx<\/C쉾?覯n?": null, + "꾳鑤/꼩d=ᘈn挫ᑩ䰬ZC": "3錢爋6Ƹ䴗v⪿Wr益G韠[\u0010屗9쁡钁u?殢c䳀蓃樄욂NAq赟c튒瘁렶Aૡɚ捍" + } + ] + ] + ]} + ] + ] + }]]]}} + ]}], + "Ej䗳U<\/Q=灒샎䞦,堰頠@褙g_\u0003ꤾfⶽ?퇋!łB〙ד3CC䌴鈌U:뭔咎(Qો臃䡬荋BO7㢝䟸\"Yb": 2.36010731779814E-20, + "逸'0岔j\u000e눘먷翌C츊秦=ꭣ棭ှ;鳸=麱$XP⩉駚橄A\\좱⛌jqv䰞3Ь踌v㳆¹gT┌gvLB賖烡m?@E঳i": null + }, + "曺v찘ׁ?&绫O័": 9107241066550187880 + } + ] + ], + "(e屄\u0019昜훕琖b蓘ᬄ0/۲묇Z蘮ဏ⨏蛘胯뢃@㘉8ሪWᨮ⦬ᅳ䅴HI၇쨳z囕陻엣1赳o": true, + ",b刈Z,ၠ晐T솝ŕB⩆ou'퐼≃绗雗d譊": null, + "a唥KB\"ﳝ肕$u\n^⅄P䟼냉䞸⩪u윗瀱ꔨ#yşs꒬=1|ﲤ爢`t౐튼쳫_Az(Ṋ擬㦷좕耈6": 2099309172767331582, + "?㴸U<\/䢔ꯡ阽扆㐤q鐋?f㔫wM嬙-;UV죫嚔픞G&\"Cᗍ䪏풊Q": "VM7疹+陕枡툩窲}翡䖶8欞čsT뮐}璤:jﺋ鎴}HfA൝⧻Zd#Qu茅J髒皣Y-︴[?-~쉜v딏璮㹚䅊﩯<-#\u000e걀h\u0004u抱﵊㼃U<㱷⊱IC進" + }, + "숌dee節鏽邺p넱蹓+e罕U": true + } + ], + "b⧴룏??ᔠ3ぱ>%郿劃翐ꏬꠛW瞳᫏누躨狀ໄy੽\"ីuS=㨞馸k乆E": "トz݈^9R䬑<ﮛGRꨳ\u000fTT泠纷꽀MRᴱ纊:㠭볮?%N56%鈕1䗍䜁a䲗j陇=뿻偂衋࿘ᓸ?ᕵZ+<\/}H耢b䀁z^f$&㝒LkꢳI脚뙛u": 5.694374481577558E-20 + }] + } + ]], + "obj": {"key": "wrong value"}, + "퓲꽪m{㶩/뇿#⼢&᭙硞㪔E嚉c樱㬇1a綑᝖DḾ䝩": null + }, + "key": "6.908319653520691E8", + "z": { + "6U閆崬밺뀫颒myj츥휘:$薈mY햚#rz飏+玭V㭢뾿愴YꖚX亥ᮉ푊\u0006垡㐭룝\"厓ᔧḅ^Sqpv媫\"⤽걒\"˽Ἆ?ꇆ䬔未tv{DV鯀Tἆl凸g\\㈭ĭ즿UH㽤": null, + "b茤z\\.N": [[ + "ZL:ᅣዎ*Y|猫劁櫕荾Oj为1糕쪥泏S룂w࡛Ᏺ⸥蚙)", + { + "\"䬰ỐwD捾V`邀⠕VD㺝sH6[칑.:醥葹*뻵倻aD\"": true, + "e浱up蔽Cr෠JK軵xCʨ<뜡癙Y獩ケ齈X/螗唻?<蘡+뷄㩤쳖3偑犾&\\첊xz坍崦ݻ鍴\"嵥B3㰃詤豺嚼aqJ⑆∥韼@\u000b㢊\u0015L臯.샥": false, + "l?Ǩ喳e6㔡$M꼄I,(3᝝縢,䊀疅뉲B㴔傳䂴\u0088㮰钘ꜵ!ᅛ韽>": -5514085325291784739, + "o㮚?\"춛㵉<\/﬊ࠃ䃪䝣wp6ἀ䱄[s*S嬈貒pᛥ㰉'돀": [{ + "(QP윤懊FI<ꃣ『䕷[\"珒嶮?%Ḭ壍಻䇟0荤!藲끹bd浶tl\u2049#쯀@僞": {"i妾8홫": { + ",M맃䞛K5nAㆴVN㒊햬$n꩑&ꎝ椞阫?/ṏ세뉪1x쥼㻤㪙`\"$쟒薟B煌܀쨝ଢ଼2掳7㙟鴙X婢\u0002": "Vዉ菈᧷⦌kﮞఈnz*﷜FM\"荭7ꍀ-VR<\/';䁙E9$䩉\f @s?퍪o3^衴cඎ䧪aK鼟q䆨c{䳠5mᒲՙ蘹ᮩ": { + "F㲷JGo⯍P덵x뒳p䘧☔\"+ꨲ吿JfR㔹)4n紬G练Q፞!C|": true, + "p^㫮솎oc.೚A㤠??r\u000f)⾽⌲們M2.䴘䩳:⫭胃\\፾@Fᭌ\\K": false, + "蟌Tk愙潦伩": { + "a<\/@ᾛ慂侇瘎": -7271305752851720826, + "艓藬/>၄ṯ,XW~㲆w": {"E痧郶)㜓ha朗!N赻瞉駠uC\u20ad辠x퓮⣫P1ࠫLMMX'M刼唳됤": null, + "P쓫晥%k覛ዩIUᇸ滨:噐혲lMR5䋈V梗>%幽u頖\\)쟟": null, + "eg+昉~矠䧞难\b?gQ쭷筝\\eꮠNl{ಢ哭|]Mn銌╥zꖘzⱷ⭤ᮜ^": [ + -1.30142114406914976E17, + -1.7555215491128452E-19, + null, + "渾㨝ߏ牄귛r?돌?w[⚞ӻ~廩輫㼧/", + -4.5737191805302129E18, + null, + "xy࿑M[oc셒竓Ⓔx?뜓y䊦>-D켍(&&?XKkc꩖ﺸᏋ뵞K伕6ী)딀P朁yW揙?훻魢傎EG碸9類៌g踲C⟌aEX舲:z꒸许", + 3808159498143417627, + null, + {"m試\u20df1{G8&뚈h홯J<\/": { + "3ஸ厠zs#1K7:rᥞoꅔꯧ&띇鵼鞫6跜#赿5l'8{7㕳(b/j\"厢aq籀ꏚ\u0015厼稥": [ + -2226135764510113982, + true, + null, + { + "h%'맞S싅Hs&dl슾W0j鿏MםD놯L~S-㇡R쭬%": null, + "⟓咔謡칲\u0000孺ꛭx旑檉㶆?": null, + "恇I転;￸B2Y`z\\獓w,놏濐撐埵䂄)!䶢D=ഭ㴟jyY": { + "$ࡘt厛毣ൢI芁<겿骫⫦6tr惺a": [ + 6.385779736989334E-20, + false, + true, + true, + [ + -6.891946211462334E-19, + null, + { + "]-\\Ꟑ1/薓❧Ὂ\\l牑\u0007A郃)阜ᇒᓌ-塯`W峬G}SDb㬨Q臉⮻빌O鞟톴첂B㺱<ƈmu챑J㴹㷳픷Oㆩs": { + "\"◉B\"pᶉt骔J꩸ᄇᛐi╰栛K쉷㉯鐩!㈐n칍䟅難>盥y铿e୔蒏M貹ヅ8嘋퀯䉶ጥ㏢殊뻳\"絧╿ꉑ䠥?∃蓊{}㣣Gk긔H1哵峱": false, + "6.瀫cN䇮F㧺?\\椯=ڈT䘆4␘8qv": -3.5687501019676885E-19, + "Q?yऴr혴{஀䳘p惭f1ﹸ䅷䕋贲<ྃᄊ繲hq\\b|#QSTs1c-7(䵢\u2069匏絘ꯉ:l毴汞t戀oෟᵶ뮱፣-醇Jx䙬䐁햢0࣫ᡁgrㄛ": "\u0011_xM/蘇Chv;dhA5.嗀绱V爤ﰦi뵲M", + "⏑[\"ugoy^儣횎~U\\섯겜論l2jw஌yD腅̂\u0019": true, + "ⵯɇ䐲᫿࢚!㯢l샅笶戮1꣖0Xe": null, + "劅f넀識b宁焊E찓橵G!ʱ獓뭔雩괛": [{"p⹣켙[q>燣䍃㞽ᩲx:쓤삘7玑퇼0<\/q璂ᑁ[Z\\3䅵䧳\u0011㤧|妱緒C['췓Yꞟ3Z鳱雼P錻BU씧U`ᢶg蓱>.1ӧ譫'L_5V䏵Ц": [ + false, + false, + {"22䂍盥N霂얢躰e9⑩_뵜斌n@B}$괻Yᐱ@䧋V\"☒-諯cV돯ʠ": true, + "Ű螧ᔼ檍鍎땒딜qꄃH뜣<獧ूCY吓⸏>XQ㵡趌o끬k픀빯a(ܵ甏끆୯/6Nᪧ}搚ᆚ짌P牰泱鈷^d꣟#L삀\"㕹襻;k㸊\\f+": true, + "쎣\",|⫝̸阊x庿k잣v庅$鈏괎炔k쬪O_": [ + "잩AzZGz3v愠ꉈⵎ?㊱}S尳௏p\r2>췝IP䘈M)w|\u000eE", + -9222726055990423201, + null, + [ + false, + {"´킮'뮤쯽Wx讐V,6ᩪ1紲aႈ\u205czD": [ + -930994432421097536, + 3157232031581030121, + "l貚PY䃛5@䭄귻m㎮琸f": 1.0318894506812084E-19, + "࢜⩢Ш䧔1肽씮+༎ᣰ闺馺窃䕨8Mƶq腽xc(៯夐J5굄䕁Qj_훨/~価.䢵慯틠퇱豠㼇Qﵘ$DuSp(8Uญ<\/ಟ룴𥳐ݩ$": 8350772684161555590, + "ㆎQ䄾\u001bpᩭ${[諟^^骴᤮b^ㅥI┧T㉇⾞\"绦r䰂f矩'-7䡭桥Dz兔V9谶居㺍ᔊ䩯덲.\u001eL0ὅㅷ釣": [{ + "<쯬J卷^숞u࠯䌗艞R9닪g㐾볎a䂈歖意:%鐔|ﵤ|y}>;2,覂⶚啵tb*仛8乒㓶B࿠㯉戩oX 貘5V嗆렽낁߼4h䧛ꍺM空\\b꿋貼": 8478577078537189402, + "VD*|吝z~h譺aᯒ": { + "YI췢K<\/濳xNne玗rJo쾘3핰鴊\"↱AR:ࢷ\"9?\"臁說)?誚ꊏe)_D翾W?&F6J@뺾ꍰNZ醊Z쾈വH嶿?炫㷱鬰M겈᭨b,⻁鈵P䕡䀠८ⱄ홎鄣": { + "@?k2鶖㋮\"Oರ K㨇廪儲\u0017䍾J?);\b*묀㗠섳햭1MC V": null, + "UIICP!BUA`ᢈ㋸~袩㗪⾒=fB﮴l1ꡛ죘R辂여ҳ7쮡<䩲`熕8頁": 4481809488267626463, + "Y?+8먙ᚔ鋳蜩럶1㥔y璜౩`": [ + null, + 1.2850335807501874E-19, + "~V2", + 2035406654801997866, + { + "<숻1>\"": -8062468865199390827, + "M㿣E]}qwG莎Gn᝶(ꔙ\\D⬲iꇲs寢t駇S뀡ꢜ": false, + "pꝤ㎏9W%>M;-U璏f(^j1?&RB隧 忓b똊E": "#G?C8.躬ꥯ'?냪#< 渟&헿란zpo왓Kj}鷧XﻘMツb䕖;㪻", + "vE풤幉xz뱕쫥Ug㦲aH} ᣟp:鬼YᰟH3镔ᴚ斦\\鏑r*2橱G⼔F/.j": true, + "RK좬뎂a홠f*f㱉ᮍ⦋潙㨋Gu곌SGI3I뿐\\F',)t`荁蘯囯ﮉ裲뇟쥼_ገ驪▵撏ᕤV": 1.52738225997956557E18, + "^k굲䪿꠹B逤%F㱢漥O披M㽯镞竇霒i꼂焅륓\u00059=皫之눃\u2047娤閍銤唫ၕb<\/w踲䔼u솆맚,䝒ᝳ'/it": "B餹饴is権ꖪ怯ꦂẉဎt\"!凢谵⧿0\\<=(uL䷍刨쑪>俆揓Cy襸Q힆䆭涷<\/ᐱ0ɧ䗾䚹\\ኜ?ꄢᇘ`䴢{囇}᠈䴥X4퓪檄]ꥷ/3謒ሴn+g騍X", + "GgG꽬[(嫓몍6\u0004궍宩㙻/>\u0011^辍dT腪hxǑ%ꊇk,8(W⧂結P鬜O": [{ + "M㴾c>\\ᓲ\u0019V{>ꤩ혙넪㭪躂TS-痴໸闓⍵/徯O.M㏥ʷD囎⧔쁳휤T??鉬뇙=#ꢫ숣BX䭼<\/d똬졬g榿)eꨋﯪ좇첻\u001a\u0011\";~쓆BH4坋攊7힪", + "iT:L闞椕윚*滛gI≀Wਟඊ'ꢆ縺뱹鮚Nꩁ᧬蕼21줧\\䋯``⍐\\㏱鳨": 1927052677739832894, + "쮁缦腃g]礿Y㬙 fヺSɪ꾾N㞈": [ + null, + null, + { + "!t,灝Y 1䗉罵?c饃호䉂Cᐭ쒘z(즽sZG㬣sഖE4뢜㓕䏞丮Qp簍6EZឪ겛fx'ꩱQ0罣i{k锩*㤴㯞r迎jTⲤ渔m炅肳": [ + -3.3325685522591933E18, + [{"㓁5]A䢕1룥BC?Ꙍ`r룔Ⳛ䙡u伲+\u0001്o": [ + null, + 4975309147809803991, + null, + null, + {"T팘8Dﯲ稟MM☻㧚䥧/8ﻥ⥯aXLaH\"顾S☟耲ît7fS෉놁뮔/ꕼ䓈쁺4\\霶䠴ᩢ<\/t4?죵>uD5➶༆쉌럮⢀秙䘥\u20972ETR3濡恆vB? ~鸆\u0005": { + "`閖m璝㥉b뜴?Wf;?DV콜\u2020퍉౓擝宏ZMj3mJ먡-傷뱙yח㸷꥿ ໘u=M읝!5吭L4v\\?ǎ7C홫": null, + "|": false, + "~Ztᛋ䚘\\擭㗝傪W陖+㗶qᵿ蘥ᙄp%䫎)}=⠔6ᮢS湟-螾-mXH?cp": 448751162044282216, + "\u209fad놹j檋䇌ᶾ梕㉝bוּ": {"?苴ꩠD䋓帘5騱qﱖPF?☸珗顒yU ᡫcb䫎 S@㥚gꮒ쎘泴멖\\:I鮱TZ듒ᶨQ3+f7캙\"?\f풾\\o杞紟﻽M.⏎靑OP": [ + -2.6990368911551596E18, + [{"䒖@<᰿<\/⽬tTr腞&G%᳊秩蜰擻f㎳?S㵧\r*k뎾-乢겹隷j軛겷0룁鮁": {")DO0腦:춍逿:1㥨่!蛍樋2": [{ + ",ꌣf侴笾m๫ꆽ?1?U?\u0011ꌈꂇ": { + "x捗甠nVq䅦w`CD⦂惺嘴0I#vỵ} \\귂S끴D얾?Ԓj溯\"v餄a": { + "@翙c⢃趚痋i\u0015OQ⍝lq돆Y0pࢥ3쉨䜩^<8g懥0w)]䊑n洺o5쭝QL댊랖L镈Qnt⪟㒅십q헎鳒⮤眉ᔹ梠@O縠u泌ㄘb榚癸XޔFtj;iC": false, + "I&뱋゘|蓔䔕측瓯%6ᗻHW\\N1貇#?僐ᗜgh᭪o'䗈꽹Rc욏/蔳迄༝!0邔䨷푪8疩)[쭶緄㇈୧ፐ": { + "B+:ꉰ`s쾭)빼C羍A䫊pMgjdx䐝Hf9᥸W0!C樃'蘿f䫤סи\u0017Jve? 覝f둀⬣퓉Whk\"஼=չﳐ皆笁BIW虨쫓F廰饞": -642906201042308791, + "sb,XcZ<\/m㉹ ;䑷@c䵀s奤⬷7`ꘖ蕘戚?Feb#輜}p4nH⬮eKL트}": [ + "RK鳗z=袤Pf|[,u욺", + "Ẏᏻ罯뉋⺖锅젯㷻{H䰞쬙-쩓D]~\u0013O㳢gb@揶蔉|kᦂ❗!\u001ebM褐sca쨜襒y⺉룓", + null, + null, + true, + -1.650777344339075E-19, + false, + "☑lꄆs힨꤇]'uTന⌳농].1⋔괁沰\"IWഩ\u0019氜8쟇䔻;3衲恋,窌z펏喁횗?4?C넁问?ᥙ橭{稻Ⴗ_썔", + "n?]讇빽嗁}1孅9#ꭨ靶v\u0014喈)vw祔}룼쮿I", + -2.7033457331882025E18, + { + ";⚃^㱋x:饬ኡj'꧵T☽O㔬RO婎?향ᒭ搩$渣y4i;(Q>꿘e8q": "j~錘}0g;L萺*;ᕭꄮ0l潛烢5H▄쳂ꏒוֹꙶT犘≫x閦웧v", + "~揯\u2018c4職렁E~ᑅቚꈂ?nq뎤.:慹`F햘+%鉎O瀜쟏敛菮⍌浢<\/㮺紿P鳆ࠉ8I-o?#jﮨ7v3Dt赻J9": null, + "ࣝW䌈0ꍎqC逖,횅c၃swj;jJS櫍5槗OaB>D踾Y": {"㒰䵝F%?59.㍈cᕨ흕틎ḏ㋩B=9IېⓌ{:9.yw}呰ㆮ肒᎒tI㾴62\"ዃ抡C﹬B<\/촋jo朣", + [ + -7675533242647793366, + {"ᙧ呃:[㒺쳀쌡쏂H稈㢤\u001dᶗGG-{GHྻຊꡃ哸䵬;$?&d\\⥬こN圴됤挨-'ꕮ$PU%?冕눖i魁q騎Q": [ + false, + [[ + 7929823049157504248, + [[ + true, + "Z菙\u0017'eꕤ᱕l,0\\X\u001c[=雿8蠬L<\/낲긯W99g톉4ퟋb㝺\u0007劁'!麕Q궈oW:@X၎z蘻m絙璩귓죉+3柚怫tS捇蒣䝠-擶D[0=퉿8)q0ٟ", + "唉\nFA椭穒巯\\䥴䅺鿤S#b迅獘 ﶗ꬘\\?q1qN犠pX꜅^䤊⛤㢌[⬛휖岺q唻ⳡ틍\"㙙Eh@oA賑㗠y必Nꊑᗘ", + -2154220236962890773, + -3.2442003245397908E18, + "Wᄿ筠:瘫퀩?o貸q⊻(᎞KWf宛尨h^残3[U(='橄", + -7857990034281549164, + 1.44283696979059942E18, + null, + {"ꫯAw跭喀 ?_9\"Aty背F=9缉ྦྷ@;?^鞀w:uN㘢Rỏ": [ + 7.393662029337442E15, + 3564680942654233068, + [ + false, + -5253931502642112194, + "煉\\辎ೆ罍5⒭1䪁䃑s䎢:[e5}峳ﴱn騎3?腳Hyꏃ膼N潭錖,Yᝋ˜YAၓ㬠bG렣䰣:", + true, + null, + { + "⒛'P&%죮|:⫶춞": -3818336746965687085, + "钖m<\/0ݎMtF2Pk=瓰୮洽겎.": [[ + -8757574841556350607, + -3045234949333270161, + null, + { + "Ꮬr輳>⫇9hU##w@귪A\\C 鋺㘓ꖐ梒뒬묹㹻+郸嬏윤'+g<\/碴,}ꙫ>손;情d齆J䬁ຩ撛챝탹/R澡7剌tꤼ?ặ!`⏲睤\u00002똥଴⟏": null, + "\u20f2ܹe\\tAꥍư\\x当뿖렉禛;G檳ﯪS૰3~㘠#[J<}{奲 5箉⨔{놁<\/釿抋,嚠/曳m&WaOvT赋皺璑텁": [[ + false, + null, + true, + -5.7131445659795661E18, + "萭m䓪D5|3婁ఞ>蠇晼6nﴺPp禽羱DS<睓닫屚삏姿", + true, + [ + -8759747687917306831, + { + ">ⓛ\t,odKr{䘠?b퓸C嶈=DyEᙬ@ᴔ쨺芛髿UT퓻春<\/yꏸ>豚W釺N뜨^?꽴﨟5殺ᗃ翐%>퍂ဿ䄸沂Ea;A_\u0005閹殀W+窊?Ꭼd\u0013P汴G5썓揘": 4.342729067882445E-18, + "Q^즾眆@AN\u0011Kb榰냎Y#䝀ꀒᳺ'q暇睵s\"!3#I⊆畼寤@HxJ9": false, + "⿾D[)袨㇩i]웪䀤ᛰMvR<蟏㣨": {"v퇓L㪱ꖣ豛톤\\곱#kDTN": [{ + "(쾴䡣,寴ph(C\"㳶w\"憳2s馆E!n!&柄<\/0Pꈗſ?㿳Qd鵔": {"娇堰孹L錮h嵅⛤躏顒?CglN束+쨣ﺜ\\MrH": {"獞䎇둃ቲ弭팭^ꄞ踦涟XK錆쳞ឌ`;੶S炥騞ଋ褂B៎{ڒ䭷ᶼ靜pI荗虶K$": [{"◖S~躘蒉꫿輜譝Q㽙闐@ᢗ¥E榁iء5┄^B[絮跉ᰥ遙PWi3wㄾⵀDJ9!w㞣ᄎ{듒ꓓb6\\篴??c⼰鶹⟧\\鮇ꮇ": [[ + 654120831325413520, + -1.9562073916357608E-19, + { + "DC(昐衵ἡ긙갵姭|֛[t": 7.6979110359897907E18, + "J␅))嫼❳9Xfd飉j7猬ᩉ+⤻眗벎E鰉Zᄊ63zၝ69}ZᶐL崭ᦥ⡦靚⋛ꎨ~i㨃咊ꧭo䰠阀3C(": -3.5844809362512589E17, + "p꣑팱쒬ꎑ뛡Ꙩ挴恍胔&7ᔈ묒4Hd硶훐㎖zꢼ豍㿢aሃ=<\/湉鵲EӅ%$F!퍶棌孼{O駍਺geu+": ")\u001b잓kŀX쩫A밁®ڣ癦狢)扔弒p}k縕ꩋ,䃉tࣼi", + "ァF肿輸<솄G-䢹䛸ꊏl`Tqꕗ蒞a氷⸅ᴉ蠰]S/{J왲m5{9.uέ~㕚㣹u>x8U讁B덺襪盎QhVS맅킃i识{벂磄Iහ䙅xZy/抍૭Z鲁-霳V据挦ℒ": null, + "㯛|Nꐸb7ⵐb?拠O\u0014ކ?-(EꞨ4ꕷᄤYᯕOW瞺~螸\"욿ќe㺰\"'㌢ƐW\u0004瞕>0?V鷵엳": true, + "뤥G\\迋䠿[庩'꼡\u001aiᩮV쯁ᳪ䦪Ô;倱ନ뛁誈": null, + "쥹䄆䚟Q榁䎐᢭<\/2㕣p}HW蟔|䃏꿈ꚉ锳2Pb7㙑Tⅹᵅ": { + "Y?֭$>#cVBꩨ:>eL蒁務": { + "86柡0po 䏚&-捑Ћ祌<\/휃-G*㶢הּ쩍s㶟餇c걺yu꽎還5*턧簕Og婥SꝐ": null, + "a+葞h٥ࠆ裈嗫ﵢ5輙퀟ᛜ,QDﹼ⟶Y騠锪E_|x죗j侵;m蜫轘趥?븅w5+mi콛L": { + ";⯭ﱢ!买F⽍柤鶂n䵣V㫚墱2렾ELEl⣆": [ + true, + -3.6479311868339015E-18, + -7270785619461995400, + 3.334081886177621E18, + 2.581457786298155E18, + -6.605252412954115E-20, + -3.9232347037744167E-20, + { + "B6㊕.k1": null, + "ZAꄮJ鮷ᳱo갘硥鈠䠒츼": { + "ᕅ}럡}.@y陪鶁r業'援퀉x䉴ﵴl퍘):씭脴ᥞhiꃰblﲂ䡲엕8߇M㶭0燋標挝-?PCwe⾕J碻Ᾱ䬈䈥뷰憵賣뵓痬+": {"a췩v礗X⋈耓ፊf罅靮!㔽YYᣓw澍33⎔芲F|\"䜏T↮輦挑6ᓘL侘?ᅥ]덆1R௯✎餘6ꏽ<\/௨\\?q喷ꁫj~@ulq": {"嗫欆뾔Xꆹ4H㌋F嵧]ࠎ]㠖1ꞤT<$m뫏O i댳0䲝i": {"?෩?\u20cd슮|ꯆjs{?d7?eNs⢚嫥氂䡮쎱:鑵롟2hJꎒﯭ鱢3춲亄:뼣v䊭諱Yj択cVmR䩃㘬T\"N홝*ै%x^F\\_s9보zz4淗?q": [ + null, + "?", + 2941869570821073737, + "{5{殇0䝾g6밖퍋臩綹R$䖭j紋釰7sXI繳漪행y", + false, + "aH磂?뛡#惇d婅?Fe,쐘+늵䍘\"3r瘆唊勐j⳧࠴ꇓ<\/唕윈x⬌讣䋵%拗ᛆⰿ妴᝔M2㳗必꧂淲?ゥ젯檢<8끒MidX䏒3᳻Q▮佐UT|⤪봦靏⊏", + [[{ + "颉(&뜸귙{y^\"P퟉춝Ჟ䮭D顡9=?}Y誱<$b뱣RvO8cH煉@tk~4ǂ⤧⩝屋SS;J{vV#剤餓ᯅc?#a6D,s": [ + -7.8781018564821536E16, + true, + [ + -2.28770899315832371E18, + false, + -1.0863912140143876E-20, + -6282721572097446995, + 6767121921199223078, + -2545487755405567831, + false, + null, + -9065970397975641765, + [ + -5.928721243413937E-20, + {"6촊\u001a홯kB0w撨燠룉{绎6⳹!턍贑y▾鱧ժ[;7ᨷ∀*땒䪮1x霆Hᩭ☔\"r䝐7毟ᝰr惃3ꉭE+>僒澐": [ + "Ta쎩aƝt쵯ⰪVb", + [ + -5222472249213580702, + null, + -2851641861541559595, + null, + 4808804630502809099, + 5657671602244269874, + "5犲﨣4mᥣ?yf젫꾯|䋬잁$`Iⳉﴷ扳兝,'c", + false, + [ + null, + { + "DyUIN쎾M仼惀⮥裎岶泭lh扠\u001e礼.tEC癯튻@_Qd4c5S熯A<\/\6U윲蹴Q=%푫汹\\\u20614b[௒C⒥Xe⊇囙b,服3ss땊뢍i~逇PA쇸1": -2.63273619193485312E17, + "Mq꺋貘k휕=nK硍뫞輩>㾆~἞ࡹ긐榵l⋙Hw뮢帋M엳뢯v⅃^": 1877913476688465125, + "ᶴ뻗`~筗免⚽টW˃⽝b犳䓺Iz篤p;乨A\u20ef쩏?疊m㝀컩뫡b탔鄃ᾈV(遢珳=뎲ିeF仢䆡谨8t0醄7㭧瘵⻰컆r厡궥d)a阄፷Ed&c﯄伮1p": null, + "⯁w4曢\"(欷輡": "\"M᭫]䣒頳B\\燧ࠃN㡇j姈g⊸⺌忉ꡥF矉স%^", + "㣡Oᄦ昵⫮Y祎S쐐級㭻撥>{I$": -378474210562741663, + "䛒掷留Q%쓗1*1J*끓헩ᦢ﫫哉쩧EↅIcꅡ\\?ⴊl귛顮4": false, + "寔愆샠5]䗄IH贈=d﯊/偶?ॊn%晥D視N򗘈'᫂⚦|X쵩넽z질tskxDQ莮Aoﱻ뛓": true, + "钣xp?&\u001e侉/y䴼~?U篔蘚缣/I畚?Q绊": -3034854258736382234, + "꺲໣眀)⿷J暘pИfAV삕쳭Nꯗ4々'唄ⶑ伻㷯騑倭D*Ok꧁3b␽_<\/챣Xm톰ၕ䆄`*fl㭀暮滠毡?": [ + "D男p`V뙸擨忝븪9c麺`淂⢦Yw⡢+kzܖ\fY1䬡H歁)벾Z♤溊-혰셢?1<-\u0005;搢Tᐁle\\ᛵߓﭩ榩訝-xJ;巡8깊蠝ﻓU$K": { + "Vꕡ諅搓W=斸s︪vﲜ츧$)iꡟ싉e寳?ጭムVથ嵬i楝Fg<\/Z|៪ꩆ-5'@ꃱ80!燱R쇤t糳]罛逇dṌ֣XHiͦ{": true, + "Ya矲C멗Q9膲墅携휻c\\딶G甔<\/.齵휴": -1.1456247877031811E-19, + "z#.OO￝J": -8263224695871959017, + "崍_3夼ᮟ1F븍뽯ᦓ鴭V豈Ь": [{ + "N蒬74": null, + "yuB?厅vK笗!ᔸcXQ旦컶P-녫mᄉ麟_": "1R@ 톘xa_|﩯遘s槞d!d껀筤⬫薐焵먑D{\\6k共倌☀G~AS_D\"딟쬚뮥馲렓쓠攥WTMܭ8nX㩴䕅檹E\u0007ﭨN 2 ℆涐ꥏ꠵3▙玽|됨_\u2048", + "恐A C䧩G": {":M큣5e들\\ꍀ恼ᔄ靸|I﨏$)n": { + "|U䬫㟯SKV6ꛤ㗮\bn봻䲄fXT:㾯쳤'笓0b/ೢC쳖?2浓uO.䰴": "ཐ꼋e?``,ᚇ慐^8ꜙNM䂱\u0001IᖙꝧM'vKdꌊH牮r\\O@䊷ᓵ쀆(fy聻i툺\"?<\/峧ࣞ⓺ᤤ쵒߯ꎺ騬?)刦\u2072l慪y꺜ﲖTj+u", + "뽫hh䈵w>1ⲏ쐭V[ⅎ\\헑벑F_㖝⠗㫇h恽;῝汰ᱼ瀖J옆9RR셏vsZ柺鶶툤r뢱橾/ꉇ囦FGm\"謗ꉦ⨶쒿⥡%]鵩#ᖣ_蹎 u5|祥?O", + null, + 2.0150326776036215E-19, + null, + true, + false, + true, + {"\fa᭶P捤WWc᠟f뚉ᬏ퓗ⳀW睹5:HXH=q7x찙X$)모r뚥ᆟ!Jﳸf": [ + -2995806398034583407, + [ + 6441377066589744683, + "Mﶒ醹i)Gἦ廃s6몞 KJ౹礎VZ螺费힀\u0000冺업{谥'꡾뱻:.ꘘ굄奉攼Di᷑K鶲y繈욊阓v㻘}枭캗e矮1c?휐\"4\u0005厑莔뀾墓낝⽴洗ṹ䇃糞@b1\u0016즽Y轹", + { + "1⽕⌰鉟픏M㤭n⧴ỼD#%鐘⊯쿼稁븣몐紧ᅇ㓕ᛖcw嬀~ഌ㖓(0r⧦Q䑕髍ര铂㓻R儮\"@ꇱm❈௿᦯頌8}㿹犴?xn잆꥽R": 2.07321075750427366E18, + "˳b18㗈䃟柵Z曆VTAu7+㛂cb0﯑Wp執<\/臋뭡뚋刼틮荋벲TLP预庰܈G\\O@VD'鱃#乖끺*鑪ꬳ?Mޞdﭹ{␇圯쇜㼞顄︖Y홡g": [{ + "0a,FZ": true, + "2z̬蝣ꧦ驸\u0006L↛Ḣ4๚뿀'?lcwᄧ㐮!蓚䃦-|7.飑挴.樵*+1ﮊ\u0010ꛌ%貨啺/JdM:똍!FBe?鰴㨗0O财I藻ʔWA᫓G쳛u`<\/I": [{ + "$τ5V鴐a뾆両環iZp頻යn븃v": -4869131188151215571, + "*즢[⦃b礞R◚nΰꕢH=귰燙[yc誘g䆌?ଜ臛": { + "洤湌鲒)⟻\\䥳va}PeAMnN[": "㐳ɪ/(軆lZR,Cp殍ȮN啷\"3B婴?i=r$펽ᤐ쀸", + "阄R4㒿㯔ڀ69ZᲦ2癁핌噗P崜#\\-쭍袛&鐑/$4童V꩑_ZHA澢fZ3": {"x;P{긳:G閉:9?活H": [ + "繺漮6?z犞焃슳\">ỏ[Ⳛ䌜녏䂹>聵⼶煜Y桥[泥뚩MvK$4jtロ", + "E#갶霠좭㦻ୗ먵F+䪀o蝒ba쮎4X㣵 h", + -335836610224228782, + null, + null, + [ + "r1᫩0>danjY짿bs{", + [ + -9.594464059325631E-23, + 1.0456894622831624E-20, + null, + 5.803973284253454E-20, + -8141787905188892123, + true, + -4735305442504973382, + 9.513150514479281E-20, + "7넳$螔忷㶪}䪪l짴\u0007鹁P鰚HF銏ZJﳴ/⍎1ᷓ忉睇ᜋ쓈x뵠m䷐窥Ꮤ^\u0019ᶌ偭#ヂt☆၃pᎍ臶䟱5$䰵&๵分숝]䝈뉍♂坎\u0011<>", + "C蒑貑藁lﰰ}X喇몛;t밿O7/᯹f\u0015kI嘦<ዴ㟮ᗎZ`GWퟩ瑹࡮ᅴB꿊칈??R校s脚", + { + "9珵戬+AU^洘拻ቒy柭床'粙XG鞕᠜繀伪%]hC,$輙?Ut乖Qm떚W8઼}~q⠪rU䤶CQ痗ig@#≲t샌f㈥酧l;y闥ZH斦e⸬]j⸗?ঢ拻퀆滌": null, + "畯}㧢J罚帐VX㨑>1ꢶkT⿄蘥㝑o|<嗸層沈挄GEOM@-䞚䧰$만峬輏䠱V✩5宸-揂D'㗪yP掶7b⠟J㕻SfP?d}v㼂Ꮕ'猘": { + "陓y잀v>╪": null, + "鬿L+7:됑Y=焠U;킻䯌잫!韎ஔ\f": { + "駫WmGጶ": { + "\\~m6狩K": -2586304199791962143, + "ႜࠀ%͑l⿅D.瑢Dk%0紪dḨTI픸%뗜☓s榗኉\"?V籄7w髄♲쟗翛歂E䤓皹t ?)ᄟ鬲鐜6C": { + "_췤a圷1\u000eB-XOy缿請∎$`쳌eZ~杁튻/蜞`塣৙\"⪰\"沒l}蕌\\롃荫氌.望wZ|o!)Hn獝qg}": null, + "kOSܧ䖨钨:಼鉝ꭝO醧S`십`ꓭ쭁ﯢN&Et㺪馻㍢ⅳ㢺崡ຊ蜚锫\\%ahx켨|ż劻ꎄ㢄쐟A躊᰹p譞綨Ir쿯\u0016ﵚOd럂*僨郀N*b㕷63z": { + ":L5r+T㡲": [{ + "VK泓돲ᮙRy㓤➙Ⱗ38oi}LJቨ7Ó㹡৘*q)1豢⛃e᫛뙪壥镇枝7G藯g㨛oI䄽 孂L缊ꋕ'EN`": -2148138481412096818, + "`⛝ᘑ$(खꊲ⤖ᄁꤒ䦦3=)]Y㢌跨NĴ驳줟秠++d孳>8ᎊ떩EꡣSv룃 쯫أ?#E|᭙㎐?zv:5祉^⋑V": [ + -1.4691944435285607E-19, + 3.4128661569395795E17, + "㐃촗^G9佭龶n募8R厞eEw⺡_ㆱ%⼨D뉄퉠2ꩵᛅⳍ搿L팹Lවn=\"慉념ᛮy>!`g!풲晴[/;?[v겁軇}⤳⤁핏∌T㽲R홓遉㓥", + "愰_⮹T䓒妒閤둥?0aB@㈧g焻-#~跬x<\/舁P݄ꐡ=\\׳P\u0015jᳪᢁq;㯏l%᭗;砢觨▝,謁ꍰGy?躤O黩퍋Y㒝a擯\n7覌똟_䔡]fJ晋IAS", + 4367930106786121250, + -4.9421193149720582E17, + null, + { + ";ᄌ똾柉곟ⰺKpፇ䱻ฺ䖝{o~h!eꁿ઻욄ښ\u0002y?xUd\u207c悜ꌭ": [ + 1.6010824122815255E-19, + [ + "宨︩9앉檥pr쇷?WxLb", + "氇9】J玚\u000f옛呲~ 輠1D嬛,*mW3?n휂糊γ虻*ᴫ꾠?q凐趗Ko↦GT铮", + "㶢ថmO㍔k'诔栀Z蛟}GZ钹D", + false, + -6.366995517736813E-20, + -4894479530745302899, + null, + "V%᫡II璅䅛䓎풹ﱢ/pU9se되뛞x梔~C)䨧䩻蜺(g㘚R?/Ự[忓C뾠ࢤc왈邠买?嫥挤풜隊枕", + ",v碍喔㌲쟚蔚톬៓ꭶ", + 3.9625444752577524E-19, + null, + [ + "kO8란뿒䱕馔b臻⍟隨\"㜮鲣Yq5m퐔K#ꢘug㼈ᝦ=P^6탲@䧔%$CqSw铜랊0&m⟭<\/a逎ym\u0013vᯗ": true, + "洫`|XN뤮\u0018詞=紩鴘_sX)㯅鿻Ố싹": 7.168252736947373E-20, + "ꛊ饤ﴏ袁(逊+~⽫얢鈮艬O힉7D筗S곯w操I斞᠈븘蓷x": [[[[ + -7.3136069426336952E18, + -2.13572396712722688E18, + { + "硢3㇩R:o칢行E<=\u0018ၬYuH!\u00044U%卝炼2>\u001eSi$⓷ꒈ'렢gᙫ番ꯒ㛹럥嶀澈v;葷鄕x蓎\\惩+稘UEᖸﳊ㊈壋N嫿⏾挎,袯苷ኢ\\x|3c": 7540762493381776411, + "?!*^ᢏ窯?\u0001ڔꙃw虜돳FgJ?&⨫*uo籤:?}ꃹ=ٴ惨瓜Z媊@ત戹㔏똩Ԛ耦Wt轁\\枒^\\ꩵ}}}ꀣD\\]6M_⌫)H豣:36섘㑜": { + ";홗ᰰU஋㙛`D왔ཿЃS회爁\u001b-㢈`봆?盂㛣듿ᦾ蒽_AD~EEຆ㊋(eNwk=Rɠ峭q\"5Ἠ婾^>'ls\n8QAK)- Q䲌mo펹L_칍樖庫9꩝쪹ᘹ䑖瀍aK ?*趤f뭓廝p=磕", + "哑z懅ᤏ-ꍹux쀭", + [ + true, + 3998739591332339511, + "ጻ㙙?᳸aK<\/囩U`B3袗ﱱ?\"/k鏔䍧2l@쿎VZ쨎/6ꃭ脥|B?31+on颼-ꮧ,O嫚m ࡭`KH葦:粘i]aSU쓙$쐂f+詛頖b", + [{"^<9<箝&絡;%i﫡2攑紴\\켉h쓙-柂䚝ven\u20f7浯-Ꮏ\r^훁䓚헬\u000e?\\ㅡֺJ떷VOt": [{ + "-௄卶k㘆혐஽y⎱㢬sS઄+^瞥h;ᾷj;抭\u0003밫f<\/5Ⱗ裏_朻%*[-撵䷮彈-芈": { + "㩩p3篊G|宮hz䑊o곥j^Co0": [ + 653239109285256503, + {"궲?|\":N1ۿ氃NZ#깩:쇡o8킗ࡊ[\"됸Po핇1(6鰏$膓}⽐*)渽J'DN<썙긘毦끲Ys칖": { + "2Pr?Xjㆠ?搮/?㓦柖馃5뚣Nᦼ|铢r衴㩖\"甝湗ܝ憍": "\"뾯i띇筝牻$珲/4ka $匝휴译zbAᩁꇸ瑅&뵲衯ꎀᆿ7@ꈋ'ᶨH@ᠴl+", + "7뢽뚐v?4^ꊥ_⪛.>pởr渲<\/⢕疻c\"g䇘vU剺dஔ鮥꒚(dv祴X⼹\\a8y5坆": true, + "o뼄B욞羁hr﷔폘뒚⿛U5pꪴfg!6\\\"爑쏍䢱W<ﶕ\\텣珇oI/BK뺡'谑♟[Ut븷亮g(\"t⡎有?ꬊ躺翁艩nl F⤿蠜": 1695826030502619742, + "ۊ깖>ࡹ햹^ⵕ쌾BnN〳2C䌕tʬ]찠?ݾ2饺蹳ぶꌭ訍\"◹ᬁD鯎4e滨T輀ﵣ੃3\u20f3킙D瘮g\\擦+泙ၧ 鬹ﯨַ肋7놷郟lP冝{ߒhড়r5,꓋": null, + "ΉN$y{}2\\N﹯ⱙK'8ɜͣwt,.钟廣䎘ꆚk媄_": null, + "䎥eᾆᝦ읉,Jުn岪㥐s搖謽䚔5t㯏㰳㱊ZhD䃭f絕s鋡篟a`Q鬃┦鸳n_靂(E4迠_觅뷝_宪D(NL疶hL追V熑%]v肫=惂!㇫5⬒\u001f喺4랪옑": { + "2a輍85먙R㮧㚪Sm}E2yꆣꫨrRym㐱膶ᔨ\\t綾A☰.焄뙗9<쫷챻䒵셴᭛䮜.<\/慌꽒9叻Ok䰊Z㥪幸k": [ + null, + true, + {"쌞쐍": { + "▟GL K2i뛱iQ\"̠.옛1X$}涺]靎懠ڦ늷?tf灟ݞゟ{": 1.227740268699265E-19, + "꒶]퓚%ฬK❅": [{ + "(ෛ@Ǯっ䧼䵤[aテൖvEnAdU렖뗈@볓yꈪ,mԴ|꟢캁(而첸죕CX4Y믅": "2⯩㳿ꢚ훀~迯?᪑\\啚;4X\u20c2襏B箹)俣eỻw䇄", + "75༂f詳䅫ꐧ鏿 }3\u20b5'∓䝱虀f菼Iq鈆﨤g퍩)BFa왢d0뮪痮M鋡nw∵謊;ꝧf美箈ḋ*\u001c`퇚퐋䳫$!V#N㹲抗ⱉ珎(V嵟鬒_b㳅\u0019": null, + "e_m@(i㜀3ꦗ䕯䭰Oc+-련0뭦⢹苿蟰ꂏSV䰭勢덥.ྈ爑Vd,ᕥ=퀍)vz뱊ꈊB_6듯\"?{㒲&㵞뵫疝돡믈%Qw限,?\r枮\"? N~癃ruࡗdn&": null, + "㉹&'Pfs䑜공j<\/?|8oc᧨L7\\pXᭁ 9᪘": -2.423073789014103E18, + "䝄瑄䢸穊f盈᥸,B뾧푗횵B1쟢f\u001f凄": "魖⚝2儉j꼂긾껢嗎0ࢇ纬xI4](੓`蕞;픬\fC\"斒\")2櫷I﹥迧", + "ퟯ詔x悝령+T?Bg⥄섅kOeQ큼㻴*{E靼6氿L缋\u001c둌๶-㥂2==-츫I즃㠐Lg踞ꙂEG貨鞠\"\u0014d'.缗gI-lIb䋱ᎂDy缦?": null, + "紝M㦁犿w浴詟棓쵫G:䜁?V2ힽ7N*n&㖊Nd-'ຊ?-樹DIv⊜)g䑜9뉂ㄹ푍阉~ꅐ쵃#R^\u000bB䌎䦾]p.䀳": [{"ϒ爛\"ꄱ︗竒G䃓-ま帳あ.j)qgu扐徣ਁZ鼗A9A鸦甈!k蔁喙:3T%&㠘+,䷞|챽v䚞문H<\/醯r셓㶾\\a볜卺zE䝷_죤ဵ뿰᎟CB": [ + 6233512720017661219, + null, + -1638543730522713294, + false, + -8901187771615024724, + [ + 3891351109509829590, + true, + false, + -1.03836679125188032E18, + { + "j랎:g曞ѕᘼ}链N", + -1.1103819473845426E-19, + true, + [ + true, + null, + -7.9091791735309888E17, + true, + {"}蔰鋈+ꐨ啵0?g*사%`J?*": [{ + "\"2wG?yn,癷BK\\龞䑞x?蠢": -3.7220345009853505E-19, + ";饹়❀)皋`噿焒j(3⿏w>偍5X薙婏聿3aFÆÝ": "2,ꓴg?_섦_>Y쪥션钺;=趘F~?D㨫\bX?㹤+>/믟kᠪ멅쬂Uzỵ]$珧`m雁瑊ඖ鯬cꙉ梢f묛bB", + "♽n$YjKiXX*GO贩鏃豮祴遞K醞眡}ꗨv嵎꼷0୸+M菋eH徸J꣆:⼐悥B켽迚㯃b諂\u000bjꠜ碱逮m8": [ + "푷᣺ﻯd8ﱖ嬇ភH鹎⡱᱅0g:果6$GQ췎{vᷧYy-脕x偹砡館⮸C蓼ꏚ=軄H犠G谖ES詤Z蠂3l봟hᅭ7䦹1GPQG癸숟~[#駥8zQ뛣J소obg,", + null, + 1513751096373485652, + null, + -6.851466660824754E-19, + {"䩂-⴮2ٰK솖풄꾚ႻP앳1H鷛wmR䗂皎칄?醜<\/&ࠧ㬍X濬䵈K`vJ륒Q/IC묛!;$vϑ": { + "@-ꚗxྐྵ@m瘬\u0010U絨ﮌ驐\\켑寛넆T=tQ㭤L연@脸삯e-:⩼u㎳VQ㋱襗ຓ<Ⅶ䌸cML3+\u001e_C)r\\9+Jn\\Pﺔ8蠱檾萅Pq鐳话T䄐I": -1.80683891195530061E18, + "ᷭዻU~ཷsgSJ`᪅'%㖔n5픆桪砳峣3獮枾䌷⊰呀": { + "Ş੉䓰邟自~X耤pl7间懑徛s첦5ਕXexh⬖鎥᐀nNr(J컗|ૃF\"Q겮葲놔엞^겄+㈆话〾희紐G'E?飕1f❼텬悚泬먐U睬훶Qs": false, + "(\u20dag8큽튣>^Y{뤋.袊䂓;_g]S\u202a꽬L;^'#땏bႌ?C緡<䝲䲝断ꏏ6\u001asD7IK5Wxo8\u0006p弊⼂ꯍ扵\u0003`뵂픋%ꄰ⫙됶l囏尛+䗅E쟇\\": [ + true, + { + "\n鱿aK㝡␒㼙2촹f;`쾏qIࡔG}㝷䐍瓰w늮*粅9뒪ㄊCj倡翑閳R渚MiUO~仨䜶RꙀA僈㉋⦋n{㖥0딿벑逦⥻0h薓쯴Ꝼ": [ + 5188716534221998369, + 2579413015347802508, + 9.010794400256652E-21, + -6.5327297761238093E17, + 1.11635352494065523E18, + -6656281618760253655, + { + "": ")?", + "TWKLꑙ裑꺔UE俸塑炌Ũ᜕-o\"徚#": {"M/癟6!oI51ni퐚=댡>xꍨ\u0004 ?": { + "皭": {"⢫䋖>u%w잼<䕏꘍P䋵$魋拝U䮎緧皇Y훂&|羋ꋕ잿cJ䨈跓齳5\u001a삱籷I꿾뤔S8㌷繖_Yឯ䲱B턼O歵F\\l醴o_欬6籏=D": [ + false, + true, + {"Mt|ꏞD|F궣MQ뵕T,띺k+?㍵i": [ + 7828094884540988137, + false, + { + "!༦鯠,&aﳑ>[euJꏽ綷搐B.h": -7648546591767075632, + "-n켧嘰{7挐毄Y,>❏螵煫乌pv醑Q嶚!|⌝責0왾덢ꏅ蛨S\\)竰'舓Q}A釡5#v": 3344849660672723988, + "8閪麁V=鈢1녈幬6棉⪮둌\u207d᚛驉ꛃ'r䆉惏ै|bἧﺢᒙ<=穊强s혧eꮿ慩⌡ \\槳W븧J檀C,ᘉ의0俯퀉M;筷ࣴ瓿{늊埂鄧_4揸Nn阼Jੵ˥(社": true, + "o뼀vw)4A뢵(a䵢)p姃뛸\u000fK#KiQp\u0005ꅍ芅쏅": null, + "砥$ꥸ┇耽u斮Gc{z빔깎밇\\숰\u001e괷各㶇쵿_ᴄ+h穢p촀Ნ䃬z䝁酳ӂ31xꔄ1_砚W렘G#2葊P ": [ + -3709692921720865059, + null, + [ + 6669892810652602379, + -135535375466621127, + "뎴iO}Z? 馢녱稹ᄾ䐩rSt帤넆&7i騏멗畖9誧鄜'w{Ͻ^2窭외b㑎粖i矪ꦨ탪跣)KEㆹ\u0015V8[W?⽉>'kc$䨘ᮛ뉻٬M5", + 1.10439588726055846E18, + false, + -4349729830749729097, + null, + [ + false, + "_蠢㠝^䟪/D녒㡋ỎC䒈판\u0006એq@O펢%;鹐쏌o戥~A[ꡉ濽ỳ&虃᩾荣唙藍茨Ig楡꒻M窓冉?", + true, + 2.17220752996421728E17, + -5079714907315156164, + -9.960375974658589E-20, + "ᾎ戞༒", + true, + false, + [[ + "ⶉᖌX⧕홇)g엃⹪x뚐癟\u0002", + -5185853871623955469, + { + "L㜤9ợㇶK鐰⋓V뽋˖!斫as|9"፬䆪?7胜&n薑~": -2.11545634977136992E17, + "O8뀩D}캖q萂6༣㏗䈓煮吽ਆᎼDᣘ폛;": false, + "YTᡅ^L㗎cbY$pᣞ縿#fh!ꘂb삵玊颟샞ဢ$䁗鼒몁~rkH^:닮먖츸륈⪺쒉砉?㙓扫㆕꣒`R䢱B酂?C뇞<5Iޚ讳騕S瞦z": null, + "\\RB?`mG댵鉡幐物䵎有5*e骄T㌓ᛪ琾駒Ku\u001a[柆jUq8⋈5鿋츿myﻗ?雍ux঴?": 5828963951918205428, + "n0晅:黯 xu씪^퓞cB㎊ᬍ⺘٤փ~B岚3㥕擄vᲂ~F?C䶖@$m~忔S왖㲚?챴⊟W#벌{'㰝I䝠縁s樘\\X뢻9핡I6菍ㄛ8쯶]wॽ0L\"q": null, + "x增줖j⦦t䏢᎙㛿Yf鼘~꫓恄4惊\u209c": "oOhbᤃ᛽z&Bi犑\\3B㩬劇䄑oŁ쨅孥멁ຖacA㖫借㞝vg싰샂㐜#譞⢤@k]鋰嘘䜾L熶塥_<\/⍾屈ﮊ_mY菹t뙺}Ox=w鮮4S1ꐩמּ'巑", + "㗓蟵ꂾe蠅匳(JP䗏෸\u0089耀왲": [{ + "ᤃ㵥韎뤽\r?挥O쯡⇔㞚3伖\u0005P⋪\"D궣QLn(⚘罩䩢Ŏv䤘尗뼤됛O淽鋋闚r崩a{4箙{煷m6〈": { + "l곺1L": { + "T'ਤ?砅|੬Km]䄩\"(࿶<\/6U爢䫈倔郴l2㴱^줣k'L浖L鰄Rp今鎗⒗C얨M훁㡧ΘX粜뫈N꤇輊㌻켑#㮮샶-䍗룲蠝癜㱐V>=\\I尬癤t=": 7648082845323511446, + "鋞EP:<\/_`ၧe混ㇹBd⯢㮂驋\\q碽饩跓྿ᴜ+j箿렏㗑yK毢宸p謹h䦹乕U媣\\炤": [[ + "3", + [ + true, + 3.4058271399411134E-20, + true, + "揀+憱f逮@먻BpW曉\u001a㣐⎊$n劈D枤㡞좾\u001aᛁ苔౩闝1B䷒Ṋ݋➐ꀞꐃ磍$t੤_:蘺⮼(#N", + 697483894874368636, + [ + "vᘯ锴)0訶}䳅⩚0O壱韈ߜ\u0018*U鍾䏖=䧉뽑单휻ID쿇嘗?ꌸῬ07", + -5.4858784319382006E18, + 7.5467775182251151E18, + -8911128589670029195, + -7531052386005780140, + null, + [ + null, + true, + [[{ + "1欯twG<\/Q:0怯押殃탷聫사<ỗꕧ蚨䡁nDꌕ\u001c녬~蓩鲃g儊>ꏡl㻿/⑷*챳6㻜W毤緛ﹺᨪ4\u0013뺚J髬e3쳸䘦伧?恪&{L掾p+꬜M䏊d娘6": { + "2p첼양棜h䜢﮶aQ*c扦v︥뮓kC寵횂S銩&ǝ{O*य़iH`U큅ࡓr䩕5ꄸ?`\\᧫?ᮼ?t〟崾훈k薐ì/iy꤃뵰z1<\/AQ#뿩8jJ1z@u䕥": 1.82135747285215155E18, + "ZdN &=d년ᅆ'쑏ⅉ:烋5&៏ᄂ汎来L㯄固{钧u\\㊏튚e摑&t嗄ꖄUb❌?m䴘熚9EW": [{ + "ଛ{i*a(": -8.0314147546006822E17, + "⫾ꃆY\u000e+W`௸ \"M뒶+\\뷐lKE}(NT킶Yj選篒쁶'jNQ硾(똡\\\"逌ⴍy? IRꜘ὞鄬﨧:M\\f⠋Cꚜ쫊ᚴNV^D䕗ㅖἔIao꿬C⍏8": [ + 287156137829026547, + { + "H丞N逕⯲": {"": { + "7-;枮阕梒9ᑄZ": [[[[ + null, + { + "": [[[[ + -7.365909561486078E-19, + 2948694324944243408, + null, + [ + true, + "荒\"并孷䂡쵼9o䀘F\u0002龬7⮹Wz%厖/*? a*R枈㌦됾g뒠䤈q딄㺿$쮸tᶎ릑弣^鏎<\/Y鷇驜L鿽<\/춋9Mᲆឨ^<\/庲3'l낢", + "c鮦\u001b두\\~?眾ಢu݆綑෪蘛轋◜gȃ<\/ⴃcpkDt誩܅\"Y", + [[ + null, + null, + [ + 3113744396744005402, + true, + "v(y", + { + "AQ幆h쾜O+꺷铀ꛉ練A蚗⼺螔j㌍3꽂楎䥯뎸먩?": null, + "蠗渗iz鱖w]擪E": 1.2927828494783804E-17, + "튷|䀭n*曎b✿~杤U]Gz鄭kW|㴚#㟗ഠ8u擨": [[ + true, + null, + null, + {"⾪壯톽g7?㥜ώQꑐ㦀恃㧽伓\\*᧰閖樧뢇赸N휶䎈pI氇镊maᬠ탷#X?A+kНM ༑᩟؝?5꧎鰜ṚY즫궔 =ঈ;ﳈ?*s|켦蜌wM笙莔": [ + null, + -3808207793125626469, + [ + -469910450345251234, + 7852761921290328872, + -2.7979740127017492E18, + 1.4458504352519893E-20, + true, + "㽙깹?먏䆢:䴎ۻg殠JBTU⇞}ꄹꗣi#I뵣鉍r혯~脀쏃#釯:场:䔁>䰮o'㼽HZ擓௧nd", + [ + 974441101787238751, + null, + -2.1647718292441327E-19, + 1.03602824249831488E18, + [ + null, + 1.0311977941822604E-17, + false, + true, + { + "": -3.7019778830816707E18, + "E峾恆茍6xLIm縂0n2视֯J-ᤜz+ᨣ跐mYD豍繹⹺䊓몓ﴀE(@詮(!Y膽#᎙2䟓섣A䈀㟎,囪QbK插wcG湎ꤧtG엝x⥏俎j'A一ᯥ뛙6ㅑ鬀": 8999803005418087004, + "よ殳\\zD⧅%Y泥簳Uꈩ*wRL{3#3FYHା[d岀䉯T稉駅䞘礄P:闈W怏ElB㤍喬赔bG䠼U଄Nw鰯闀楈ePsDꥷ꭬⊊": [ + 6.77723657904486E-20, + null, + [ + "ཚ_뷎꾑蹝q'㾱ꂓ钚蘞慵렜떆`ⴹ⎼櫯]J?[t9Ⓢ !컶躔I᮸uz>3a㠕i,錃L$氰텰@7녫W㸮?羧W뇧ꃞ,N鋮숪2ɼ콏┍䁲6", + "&y?뢶=킕올Za惻HZk>c\u20b58i?ꦶcfBv잉ET9j䡡", + "im珊Ճb칧校\\뼾쯀", + 9.555715121193197E-20, + true, + { + "<㫚v6腓㨭e1㕔&&V∌ᗈT奄5Lጥ>탤?튣瑦㳆ꉰ!(ᙪ㿬擇_n쌯IMΉ㕨␰櫈ᱷ5풔蟹&L.첽e鰷쯃劼﫭b#ﭶ퓀7뷄Wr㢈๧Tʴશ㶑澕鍍%": -1810142373373748101, + "fg晌o?߲ꗄ;>C>?=鑰監侯Kt굅": true, + "䫡蓺ꑷ]C蒹㦘\"1ః@呫\u0014NL䏾eg呮፳,r$裢k>/\\?ㄤᇰﻛ쉕1஥'Ċ\" \\_?쨔\"ʾr: 9S䘏禺ᪧꄂ㲄", + [[{ + "*硙^+E쌺I1䀖ju?:⦈Ꞓl๴竣迃xKC/饉:\fl\"XTFᄄ蟭,芢<\/骡軺띜hꏘ\u001f銿<棔햳▨(궆*=乥b8\\媦䷀뫝}닶ꇭ(Kej䤑M": [{ + "1Ꮼ?>옿I╅C<ގ?ꊌ冉SV5A㢊㶆z-๎玶绢2F뵨@㉌뀌o嶔f9-庒茪珓뷳4": null, + ";lᰳ": "CbB+肻a䄷苝*/볳+/4fq=㰁h6瘉샴4铢Y骐.⌖@哼猎㦞+'gꋸ㒕ߤ㞑(䶒跲ti⑴a硂#No볔", + "t?/jE幸YHT셵⩎K!Eq糦ꗣv刴w\"l$ο:=6:移": { + "z]鑪醊嫗J-Xm銌翁絨c里됏炙Ep㣋鏣똼嚌䀓GP﹖cmf4鹭T䅿꣭姧␸wy6ꦶ;S&(}ᎧKxᾂQ|t뻳k\"d6\"|Ml췆hwLt꼼4$&8Պ褵婶鯀9": {"嵃닢ᒯ'd᧫䳳#NXe3-붋鸿ଢ떓%dK\u0013䲎ꖍYV.裸R⍉rR3蟛\\:젯:南ĺLʆ넕>|텩鴷矔ꋅⒹ{t孶㓑4_": [ + true, + null, + [ + false, + "l怨콈lᏒ", + { + "0w䲏嬧-:`䉅쉇漧\\܂yㄨb%㽄j7ᦶ涶<": 3.7899452730383747E-19, + "ꯛTẀq纤q嶏V⿣?\"g}ი艹(쥯B T騠I=仵및X": {"KX6颠+&ᅃ^f畒y[": { + "H?뱜^?꤂-⦲1a㋞&ꍃ精Ii᤾챪咽쬘唂쫷<땡劈훫놡o㥂\\ KⴙD秼F氮[{'좴:례晰Iq+I쭥_T綺砸GO煝䟪ᚪ`↹l羉q쐼D꽁ᜅ훦: vUV": true, + "u^yﳍ0㱓#[y뜌앸ꊬL㷩?蕶蘾⻍KӼ": -7931695755102841701, + "䤬轉車>\u001c鴵惋\"$쯃྆⇻n뽀G氠S坪]ಲꨍ捇Qxኻ椕駔\\9ࣼ﫻읜磡煮뺪ᶚ볝l㕆t+sζ": [[[ + true, + false, + [ + null, + 3363739578828074923, + true, + { + "\"鸣詩 볰㑵gL㯦῅춝旫}ED辗ﮈI쀤-ꧤ|㠦Z\"娑ᕸ4爏騍㣐\"]쳝Af]茛⬻싦o蚁k䢯䩐菽3廇喑ޅ": 4.5017999150704666E17, + "TYႇ7ʠ值4챳唤~Zo&ݛ": false, + "`塄J袛㭆끺㳀N㺣`꽐嶥KﯝSVᶔ∲퀠獾N딂X\"ᤏhNﬨvI": {"\u20bb㭘I䖵䰼?sw䂷쇪](泒f\"~;꼪Fԝsᝦ": {"p,'ꉂ軿=A蚶?bƉ㏵䅰諬'LYKL6B깯⋩겦뎙(ᜭ\u0006噣d꾆㗼Z;䄝䚔cd<情@䞂3苼㸲U{)<6&ꩻ钛\u001au〷N숨囖愙j=BXW욕^x芜堏Ῑ爂뛷꒻t✘Q\b": [[ + "籛&ଃ䩹.ꃩ㦔\\C颫#暪&!勹ꇶ놽攺J堬镙~軌C'꾖䣹㮅岃ᙴ鵣", + 4.317829988264744E15, + 6.013585322002147E-20, + false, + true, + null, + null, + -3.084633632357326E-20, + false, + null, + { + "\"짫愔昻 X\"藣j\"\"먁ཅѻ㘤㬯0晲DU꟒㸃d벀윒l䦾c੻*3": null, + "谈Wm陧阦咟ฯ歖擓N喴㋐銭rCCnVࢥ^♼Ⅾ젲씗刊S༝+_t赔\\b䚍뉨ꬫ6펛cL䊘᜼<\/澤pF懽&H": [ + null, + { + "W\"HDUuΌ퀟M'P4࿰H똆ⰱﮯ<\/凐蘲\"C鴫ﭒж}ꭩ쥾t5yd诪ﮡ퍉ⴰ@?氐醳rj4I6Qt": 6.9090159359219891E17, + "絛ﳛ⺂": {"諰P㗮聦`ZQ?ꫦh*റcb⧱}埌茥h{棩렛툽o3钛5鮁l7Q榛6_g)ὄ\u0013kj뤬^爖eO4Ⱈ槞鉨ͺ订%qX0T썗嫷$?\\\"봅늆'%": [ + -2.348150870600346E-19, + [[ + true, + -6619392047819511778, + false, + [[ + -1.2929189982356161E-20, + 1.7417192219309838E-19, + {"?嵲2࿐2\u0001啑㷳c縯": [ + null, + [ + false, + true, + 2578060295690793218, + { + "?\"殃呎#㑑F": true, + "}F炊_殛oU헢兔Ꝉ,赭9703.B数gTz3⏬": { + "5&t3,햓Mݸᵣ㴵;꣫䩍↳#@뫷䠅+W-ࣇzᓃ鿕ಔ梭?T䮑ꥬ旴]u뫵막bB讍:왳둛lEh=숾鱠p咐$짏#?g⹷ᗊv㷵.斈u頻\u0018-G.": "뽙m-ouࣤ஫牷\"`Ksꕞ筼3HlȨvC堈\"I]㖡玎r먞#'W賜鴇k'c룼髋䆿飉㗆xg巤9;芔cጐ/ax䊨♢큓r吓㸫೼䢗da᩾\"]屣`", + ":M딪<䢥喠\u0013㖅x9蕐㑂XO]f*Q呰瞊吭VP@9,㨣 D\\穎vˤƩs㜂-曱唅L걬/롬j㈹EB8g<\/섩o渀\"u0y&룣": ">氍緩L/䕑돯Ꟙ蕞^aB뒣+0jK⪄瑨痜LXK^힦1qK{淚t츔X:Vm{2r獁B뾄H첚7氥?쉟䨗ꠂv팳圎踁齀\\", + "D彤5㢷Gꪻ[lㄆ@὜⓰絳[ଃ獽쮹☒[*0ꑚ㜳": 9022717159376231865, + "ҖaV銣tW+$魿\u20c3亜~뫡ᙰ禿쨽㏡fṼzE/h": "5臐㋇Ჯ쮺? 昨탰Wム밎#'\"崲钅U?幫뺀⍾@4kh>騧\\0ҾEV=爐͌U捀%ꉼ 㮋<{j]{R>:gԩL\u001c瀈锌ﯲﳡꚒ'⫿E4暍㌗뵉X\"H᝜", + "ᱚגּ;s醒}犍SἿ㦣&{T$jkB\\\tḮ앾䤹o<避(tW": "vb⯽䴪䮢@|)", + "⥒퐁껉%惀뗌+녣迺顀q條g⚯i⤭룐M琹j̈́⽜A": -8385214638503106917, + "逨ꊶZ<\/W⫟솪㎮ᘇb?ꠔi\"H㧺x෷韒Xꫨฟ|]窽\u001a熑}Agn?Mᶖa9韲4$3Ỵ^=쏍煤ፐ돷2䣃%鷠/eQ9頸쥎", + 2398360204813891033, + false, + 3.2658897259932633E-19, + null, + "?ꚃ8Nn㞷幵d䲳䱲뀙ꪛQ瑓鎴]䩋-鰾捡䳡??掊", + false, + -1309779089385483661, + "ᦲxu_/yecR.6芏.ᜇ過 ~", + -5658779764160586501, + "쒌:曠=l썜䢜wk#s蕚\"互㮉m䉤~0듐䋙#G;h숄옥顇෤勹(C7㢅雚㐯L⠅VV簅<", + null, + -4.664877097240962E18, + -4.1931322262828017E18, + { + ",": { + "v㮟麑䄠뤵g{M띮.\u001bzt뢜뵡0Ǥ龍떟Ᾰ怷ϓRT@Lꀌ樂U㏠⾕e扉|bJg(뵒㠶唺~ꂿ(땉x⻫싉쁊;%0鎻V(o\f,N鏊%nk郼螺": -1.73631993428376141E18, + "쟧摑繮Q@Rᕾ㭚㾣4隅待㓎3蒟": [ + 4971487283312058201, + 8973067552274458613, + { + "`a揙ᣗ\u0015iBo¸": 4.3236479112537999E18, + "HW&퉡ぁ圍Y?瑡Qy훍q!帰敏s舠㫸zꚗaS歲v`G株巷Jp6킼 (귶鍔⾏⡈>M汐㞍ቴ꙲dv@i㳓ᇆ?黍": [ + null, + 4997607199327183467, + "E㻎蠫ᐾ高䙟蘬洼旾﫠텛㇛?'M$㣒蔸=A_亀绉앭rN帮", + null, + [{ + "Eᑞ)8餧A5u&㗾q?": [ + -1.969987519306507E-19, + null, + [ + 3.42437673373841E-20, + true, + "e걷M墁\"割P␛퍧厀R䱜3ﻴO퓫r﹉⹊", + [ + -8164221302779285367, + [ + true, + null, + "爘y^-?蘞Ⲽꪓa␅ꍨ}I", + 1.4645984996724427E-19, + [{ + "tY좗⧑mrzﺝ㿥ⴖ᥷j諅\u0000q賋譁Ꞅ⮱S\nࡣB/큃굪3Zɑ复o<\/;롋": null, + "彟h浠_|V4䦭Dᙣ♞u쿻=삮㍦\u001e哀鬌": [{"6횣楠,qʎꗇ鎆빙]㱭R굋鈌%栲j分僅ペ䇰w폦p蛃N溈ꡐꏀ?@(GI뉬$ﮄ9誁ꓚ2e甸ڋ[䁺,\u0011\u001cࢃ=\\+衪䷨ᯕ鬸K": [[ + "ㅩ拏鈩勥\u000etgWVXs陂規p狵w퓼{뮵_i\u0002ퟑႢ⬐d6鋫F~챿搟\u0096䚼1ۼ칥0꣯儏=鋷牋ⅈꍞ龐", + -7283717290969427831, + true, + [ + 4911644391234541055, + { + "I鈒첽P릜朸W徨觘-Hᎄ퐟⓺>8kr1{겵䍃〛ᬡ̨O귑o䝕'쿡鉕p5": "fv粖RN瞖蛐a?q꤄\u001d⸥}'ꣴ犿ꦼ?뤋?鵆쥴덋䡫s矷̄?ඣ/;괱絢oWfV<\/\u202cC,㖦0䑾%n賹g&T;|lj_欂N4w", + "짨䠗;䌕u i+r๏0": [{"9䥁\\఩8\"馇z䇔<\/ႡY3e狚쐡\"ุ6ﰆZ遖c\"Ll:ꮾ疣<\/᭙O◌납୕湞9⡳Und㫜\u0018^4pj1;䧐儂䗷ୗ>@e톬": { + "a⑂F鋻Q螰'<퇽Q贝瀧{ᘪ,cP&~䮃Z?gI彃": [ + -1.69158726118025933E18, + [ + "궂z簽㔛㮨瘥⤜䛖Gℤ逆Y⪾j08Sn昞ꘔ캻禀鴚P謦b{ꓮmN靐Mᥙ5\"睏2냑I\u0011.L&=?6ᄠ뻷X鸌t刑\"#z)o꫚n쳟줋", + null, + 7517598198523963704, + "ኑQp襟`uᩄr方]*F48ꔵn俺ሙ9뇒", + null, + null, + 6645782462773449868, + 1219168146640438184, + null, + { + ")ယ넌竀Sd䰾zq⫣⏌ʥ\u0010ΐ' |磪&p牢蔑mV蘸૰짬꺵;K": [ + -7.539062290108008E-20, + [ + true, + false, + null, + true, + 6574577753576444630, + [[ + 1.2760162530699766E-19, + [ + null, + [ + "顊\\憎zXB,", + [{ + "㇆{CVC9-MN㜋ઘR눽#{h@ퟨ!鼚׼XOvXS\u0017ᝣ=cS+梽៲綆16s덽휐y屬?ᇳG2ᴭ\u00054쫖y룇nKcW̭炦s/鰘ᬽ?J|퓀髣n勌\u0010홠P>j": false, + "箴": [ + false, + "鍞j\"ꮾ*엇칬瘫xṬ⭽쩁䃳\"-⋵?ᦽ댎Ĝ": true, + "Pg帯佃籛n㔠⭹࠳뷏≻࿟3㞱!-쒾!}쭪䃕!籿n涻J5ਲ਼yvy;Rኂ%ᔡጀ裃;M⣼)쵂쑈": 1.80447711803435366E18, + "ꈑC⡂ᑆ㤉壂뎃Xub<\/쀆༈憓ق쨐ק\\": [ + 7706977185172797197, + {"": {"K╥踮砆NWࡆFy韣7ä밥{|紒︧䃀榫rᩛꦡTSy잺iH8}ퟴ,M?Ʂ勺ᴹ@T@~꾂=I㙕뾰_涀쑜嫴曣8IY?ҿo줫fऒ}\\S\"ᦨ뵼#nDX": { + "♘k6?଱癫d68?㽚乳䬳-V顷\u0005蝕?\u0018䞊V{邾zじl]雏k臤~ൖH뒐iꢥ]g?.G碄懺䔛pR$䅒X觨l봜A刊8R梒',}u邩퉕?;91Ea䈈믁G⊶芔h袪&廣㺄j;㡏綽\u001bN頸쳘橆": -2272208444812560733, + "拑Wﵚj鵼駳Oࣿ)#㾅顂N傓纝y僱栜'Bꐍ-!KF*ꭇK¦?䈴^:啤wG逭w᧯": "xᣱmYe1ۏ@霄F$ě꧘푫O䤕퀐Pq52憬ꀜ兴㑗ᡚ?L鷝ퟐ뭐zJꑙ}╆ᅨJB]\"袌㺲u8䯆f", + "꿽၅㔂긱Ǧ?SI": -1669030251960539193, + "쇝ɨ`!葎>瞺瘡驷錶❤ﻮ酜=": -6961311505642101651, + "?f7♄꫄Jᡔ훮e읇퍾፣䭴KhखT;Qty}O\\|뫁IῒNe(5惁ꥶㆷY9ﮡ\\ oy⭖-䆩婁m#x봉>Y鈕E疣s驇↙ᙰm<": {"퉻:dꂁ&efᅫ쫢[\"돈늖꺙|Ô剐1͖-K:ʚ᭕/;쏖㷛]I痐职4gZ4⍜kเꛘZ⥺\\Bʫᇩ鄨魢弞&幟ᓮ2̊盜", + -9006004849098116748, + -3118404930403695681, + { + "_彃Y艘-\"Xx㤩㳷瑃?%2䐡鵛o귵옔夘v*탋职&㳈챗|O钧": [ + false, + "daꧺdᗹ羞쯧H㍤鄳頳<型孒ン냆㹀f4㹰\u000f|C*ሟ鰠(O<ꨭ峹ipຠ*y೧4VQ蔔hV淬{?ᵌEfrI_", + "j;ꗣ밷邍副]ᗓ", + -4299029053086432759, + -5610837526958786727, + [ + null, + [ + -1.3958390678662759E-19, + { + "lh좈T_믝Y\"伨\u001cꔌG爔겕ꫳ晚踍⿻읐T䯎]~e#฽燇\"5hٔ嶰`泯r;ᗜ쮪Q):/t筑,榄&5懶뎫狝(": [{ + "2ፁⓛ]r3C攟וּ9賵s⛔6'ஂ|\"ⵈ鶆䐹禝3\"痰ࢤ霏䵩옆䌀?栕r7O簂Isd?K᫜`^讶}z8?z얰T:X倫⨎ꑹ": -6731128077618251511, + "|︦僰~m漿햭\\Y1'Vvخ굇ቍ챢c趖": [null] + }], + "虌魿閆5⛔煊뎰㞤ᗴꥰF䮥蘦䂪樳-K᝷-(^\u20dd_": 2.11318679791770592E17 + } + ] + ] + ]}, + "묗E䀳㧯᳀逞GMc\b墹㓄끖Ơ&U??펌鑍 媋k))ᄊ": null, + "묥7콽벼諌J_DɯﮪM殴䣏,煚ྼ`Y:씧<\/⩫%yf䦀!1Ჶk춎Q米W∠WC跉鬽*ᛱi㴕L꘻ꀏ쓪\"_g鿄'#t⽙?,Wg㥖|D鑆e⥏쪸僬h鯔咼ඡ;4TK聎졠嫞" + } + ] + ] + } + ] + ] + ]}} + } + ]} + }, + "뿋뀾淣截䔲踀&XJ펖꙯^Xb訅ꫥgᬐ>棟S\"혧騾밫겁7-": "擹8C憎W\"쵮yR뢩浗絆䠣簿9䏈引Wcy䤶孖ꯥ;퐌]輩䍐3@{叝 뽸0ᡈ쵡Ⲇ\u001dL匁꧐2F~ݕ㪂@W^靽L襒ᦘ~沦zZ棸!꒲栬R" + } + ] + ], + "Z:덃൛5Iz찇䅄駠㭧蓡K1": "e8᧤좱U%?ⵇ䯿鿝\u0013縮R∱骒EO\u000fg?幤@֗퉙vU`", + "䐃쪈埽້=Ij,쭗쓇చ": false + }]}} + ] + } + ]} + } + ] + ] + ], + "咰긖VM]᝼6䓑쇎琺etDҌ?㞏ꩄ퇫밉gj8蠃\"⩐5䛹1ࣚ㵪": "ക蹊?⎲⧘⾚̀I#\"䈈⦞돷`wo窭戕෱휾䃼)앷嵃꾞稧,Ⴆ윧9S?೗EMk3Მ3+e{⹔Te驨7䵒?타Ulg悳o43" + } + ], + "zQᤚ纂땺6#ٽ﹧v￿#ࠫ휊冟蹧텈ꃊʆ?&a䥯De潝|쿓pt瓞㭻啹^盚2Ꝋf醪,얏T窧\\Di䕎谄nn父ꋊE": -2914269627845628872, + "䉩跐|㨻ᷢ㝉B{蓧瞸`I!℄욃힕#ೲᙾ竛ᔺCjk췒늕貭词\u0017署?W딚%(pꍁ⤼띳^=on뺲l䆼bzrﳨ[&j狸䠠=ᜑꦦ\u2061յnj=牲攑)M\\龏": false, + "뎕y絬᫡⥮Ϙᯑ㌔/NF*˓.,QEzvK!Iwz?|쥾\"ꩻL꼗Bꔧ賴緜s뉣隤茛>ロ?(?^`>冺飒=噸泥⺭Ᲊ婓鎔븜z^坷裮êⓅ໗jM7ﶕ找\\O": 1.376745434746303E-19 + }, + "䐛r滖w㏤,|Nዜ": false + } + ]], + "@꿙?薕尬 gd晆(띄5躕ﻫS蔺4)떒錸瓍?~": 1665108992286702624, + "w믍nᏠ=`঺ᅥC>'從됐槷䤝眷螄㎻揰扰XᅧC贽uჍ낟jKD03T!lDV쀉Ӊy뢖,袛!终캨G?鉮Q)⑗1쾅庅O4ꁉH7?d\u0010蠈줘월ސ粯Q!낇껉6텝|{": null, + "~˷jg쿤촖쉯y": -5.5527605669177098E18, + "펅Wᶺzꐆと푭e?4j仪열[D<鈑皶婆䵽ehS?袪;HꍨM뗎ば[(嗏M3q퍟g4y╸鰧茀[Bi盤~﫝唎鋆彺⦊q?B4쉓癚O洙킋툈䶯_?ퟲ": null + } + ] + ]] + ]], + "꟱Ԕ㍤7曁聯ಃ錐V䷰?v㪃૦~K\"$%请|ꇹn\"k䫛㏨鲨\u2023䄢\u0004[︊VJ?䶟ាꮈ䗱=깘U빩": -4863152493797013264 + } + ]}]} + ] + }}} + ], + "쏷쐲۹퉃~aE唙a챑,9㮹gLHd'䔏|킗㍞䎥&KZYT맵7䥺Nⱳ同莞鿧w\\༌疣n/+ꎥU\"封랾○ퟙAJᭌ?9䛝$?驔9讐짘魡T֯c藳`虉C읇쐦T" + } + ], + "谶개gTR￐>ၵ͚dt晑䉇陏滺}9㉸P漄": -3350307268584339381 + }] + ] + ] + ]] + ] + ], + "0y꟭馋X뱔瑇:䌚￐廿jg-懲鸭䷭垤㒬茭u賚찶ಽ+\\mT땱\u20821殑㐄J쩩䭛ꬿNS潔*d\\X,壠뒦e殟%LxG9:摸": 3737064585881894882, + "풵O^-⧧ⅶvѪ8廸鉵㈉ר↝Q㿴뺟EႳvNM:磇>w/៻唎뷭୥!냹D䯙i뵱貁C#⼉NH6`柴ʗ#\\!2䂗Ⱨf?諳.P덈-返I꘶6?8ꐘ": -8934657287877777844, + "溎-蘍寃i诖ര\"汵\"\ftl,?d⼡쾪⺋h匱[,෩I8MҧF{k瓿PA'橸ꩯ綷퉲翓": null + } + ] + ], + "ោ係؁<元": 1.7926963090826924E-18 + }}] + } + ] + ]]}] + }] + ] + ] + ] + ], + "ጩV<\"ڸsOᤘ": 2.0527167903723048E-19 + }] + ]} + ] + ]], + "∳㙰3젴p᧗䱙?`yZA8Ez0,^ᙛ4_0븢\u001ft:~䎼s.bb룦明yNP8弆C偯;⪾짍'蕴뮛": -6976654157771105701, + "큵ꦀ\\㇑:nv+뒤燻䀪ﴣ﷍9ᚈ኷K㚊誦撪䚛,ꮪxሲ쳊\u0005HSf?asg昱dqꬌVꙇ㼺'k*'㈈": -5.937042203633044E-20 + } + ] + }], + "?}\u20e0],s嶳菋@#2u쒴sQS䩗=ꥮ;烌,|ꘔ䘆": "ᅩ영N璠kZ먕眻?2ቲ芋眑D륟渂⸑ﴃIRE]啗`K'" + }}, + "쨀jmV賂ﰊ姐䂦玞㬙ᏪM᪟Վ씜~`uOn*ॠ8\u000ef6??\\@/?9見d筜ﳋB|S䝬葫㽁o": true + }, + "즛ꄤ酳艚␂㺘봿㎨iG৕ࡿ?1\"䘓您\u001fSኝ⺿溏zៀ뻤B\u0019?윐a䳵᭱䉺膷d:<\/": 3935553551038864272 + } + ] + ]} + ]] + ]] + ]} + } + ] + } + ]]}}, + "᥺3h↛!ꋰy\"攜(ெl䪕oUkc1A㘞ᡲ촾ᣫ<\/䒌E㛝潨i{v?W౾H\\RჅpz蝬R脾;v:碽✘↯삞鷱o㸧瑠jcmK7㶧뾥찲n": true, + "ⶸ?x䊺⬝-䰅≁!e쩆2ꎿ准G踌XXᩯ1߁}0?.헀Z馟;稄\baDꟹ{-寪⚈ꉷ鮸_L7ƽᾚ<\u001bጨA䧆송뇵⨔\\礍뗔d设룱㶉cq{HyぱR㥽吢ſtp": -7985372423148569301, + "緫#콮IB6<\/=5Eh礹\t8럭@饹韠r㰛斣$甝LV췐a갵'请o0g:^": "䔨(.", + "띳℡圤pン௄ĝ倧訜B쁟G䙔\"Sb⓮;$$▏S1J뢙SF|赡g*\"Vu䲌y": "䪈&틐),\\kT鬜1풥;뷴'Zေ䩹@J鞽NぼM?坥eWb6榀ƩZڮ淽⺞삳煳xჿ絯8eⶍ羷V}ჿ쎱䄫R뱃9Z>'\u20f1ⓕ䏜齮" + } + ] + ]]] + }} + } + ] + ]}, + "펮b.h粔폯2npX詫g錰鷇㇒<쐙S値bBi@?镬矉`剔}c2壧ଭfhY깨R()痩⺃a\\⍔?M&ﯟ<劜꺄멊ᄟA\"_=": null + }, + "~潹Rqn榢㆓aR鬨侅?䜑亡V_翅㭔(䓷w劸ၳDp䀅<\/ﰎ鶊m䵱팱긽ꆘ긓准D3掱;o:_ќ)껚콥8곤d矦8nP倥ꃸI": null, + "뾎/Q㣩㫸벯➡㠦◕挮a鶧⋓偼\u00001뱓fm覞n?㛅\"": 2.8515592202045408E17 + }], + ",": -5426918750465854828, + "2櫫@0柡g䢻/gꆑ6演&D稒肩Y?艘/놘p{f투`飷ᒉ챻돎<늛䘍ﴡ줰쫄": false, + "8(鸑嵀⵹ퟡ<9㣎Tߗ┘d슒ل蘯&㠦뮮eࠍk砝g 엻": false, + "d-\u208b?0ﳮ嵙'(J`蔿d^踅⤔榥\\J⵲v7": 6.8002426206715341E17, + "ཎ耰큓ꐕ㱷\u0013y=詽I\"盈xm{0쾽倻䉚ષso#鰑/8㸴짯%ꀄ떸b츟*\\鲷礬ZQ兩?np㋄椂榨kc᡹醅3": false, + "싊j20": false + }]] + ]], + "俛\u0017n緽Tu뫉蜍鼟烬.ꭠIⰓ\"Ἀ᜾uC쎆J@古%ꛍm뻨ᾀ画蛐휃T:錖㑸ዚ9죡$": true + } + ] + ], + "㍵⇘ꦖ辈s}㱮慀밒s`\"㞟j:`i픻Z섫^諎0Ok{켿歁෣胰a2﨤[탳뚬쎼嫭뉮m": 409440660915023105, + "w墄#*ᢄ峠밮jLa`ㆪ꺊漓Lで끎!Agk'ꁛ뢃㯐岬D#㒦": false, + "ଦPGI䕺L몥罭ꃑ궩﮶#⮈ᢓӢ䚬p7웼臧%~S菠␌힀6&t䳙y㪘냏\\*;鉏ᅧ鿵'嗕pa\"oL쇿꬈Cg": "㶽1灸D⟸䴅ᆤ뉎﷛渤csx 䝔цꬃ锚捬?ຽ+x~꘩uI࡞\u0007栲5呚ẓem?袝\")=㥴䨃pac!/揎Y", + "ᷱo\\||뎂몷r篙|#X䦜I#딌媸픕叞RD斳X4t⯩夬=[뭲r=绥jh뷱츝⪘%]⚋܈㖴スH텹m(WO曝劉0~K3c柢Ր㏉着逳~": false, + "煽_qb[첑\\륌wE❽ZtCNﭝ+餌ᕜOꛭ": "{ﳾ쉌&s惧ᭁⵆ3䢫;䨞팑꒪흘褀࢖Q䠿V5뭀䎂澻%받u5텸oA⮥U㎦;B䳌wz䕙$ឿ\\௅婺돵⪾퐆\\`Kyौꋟ._\u0006L챯l뇠Hi䧈偒5", + "艊佁ࣃ롇䱠爬!*;⨣捎慓q靓|儑ᨋL+迥=6㒺딉6弄3辅J-㕎뛄듘SG㆛(\noAzQꝱ䰩X*ぢO퀌%펠낌mo틮a^<\/F&_눊ᾉ㨦ы4\"8H": 2974648459619059400, + "鬙@뎣䫳ၮ끡?){y?5K;TA*k溱䫜J汃ꂯ싔썍\u001dA}룖(<\/^,": false, + "몏@QꋦFꊩᒐ뎶lXl垨4^郣|ꮇ;䝴ᝓ}쵲z珖": null + } + ]]]], + ":_=닧弗D䙋暨鏛. 㱻붘䂍J儒&ZK/녩䪜r囁⽯D喠죥7⹌䪥c\u001a\u2076￞妈朹oLk菮F౟覛쐧㮏7T;}蛙2{9\"崓bB<\/⡷룀;즮鿹)丒툃୤뷠5W⊢嶜(fb뭳갣": "E{响1WM" + }}, + "䘨tjJ驳豨?y輊M*᳑梵瞻઻ofQG瑮e": 2.222802939724948E-19, + "䮴=❑➶T෋w䞜\"垦ꃼUt\u001dx;B$뵣䙶E↌艣ᡥ!᧟;䱀[䔯k쬃`੍8饙른熏'2_'袻tGf蒭J땟as꯳╖&啒zWࡇᒫYSᏬ\u0014ℑ첥鈤|cG~Pᓮ\">\"": "ႆl\f7V儊㦬nHꄬꨧC{쐢~C⮃⛓嶦vꄎ1w鰠嘩뿠魄&\"_qMⵖ釔녮ꝇ 㝚{糍J哋 cv?-jkﻯྌ鹑L舟r", + "龧葆yB✱H盋夔ﶉ?n*0(": "ꧣኆ㢓氥qZZ酒ຜ)鮢樛)X䣆gTSґG텞k.J圬疝롫쯭z L:\\ྤ@w炋塜쿖ᾳy뢀䶃뱝N䥨㚔勇겁#p", + "도畎Q娡\"@S/뼋:䵏!P衅촚fVHQs✜ᐫi㻑殡B䜇%믚k*U#濨낄~": "ꍟዕ쳸ꍈ敋&l妏\u0005憡멗瘌uPgᅪm<\/To쯬锩h뒓k" + } + ] + }], + "墥홞r绚<\/⸹ⰃB}<躅\\Y;๑@䔸>韫䜲뱀X뗩鿥쩗SI%ﴞ㳕䛇?<\/\u00018x\\&侂9鋙a[LR㋭W胕)⡿8㞙0JF,}?허d1cDMᐃ␛鄝ⱕ%X)!XQ": "ⳍꗳ=橇a;3t⦾꼑仈ူaᚯ⯋ꕃAs鴷N⍕_䎃ꙎAz\u0016䯷\\<࿫>8q{}キ?ᣰ}'0ᴕ펓B┦lF#趤厃T?㕊#撹圂䆲" + }, + "܋닐龫論c웑": false, + "ㇿ/q\"6-co髨휝C큦#\u001b4~?3䐹E삇<<": 7.600917488140322E-20, + "䁝E6?㣖ꃁ间t祗*鑠{ḣV(浾h逇큞=W?ૉ?nꇽ8ꅉຉj으쮺@Ꚅ㰤u]Oyr": "v≁᫸_*όAඤԆl)ۓᦇQ}폠z༏q滚", + "ソ᥊/넺I": true + }]] + ] + ] + ] + ]] + }, + "䭑Ik攑\u0002QV烄:芩.麑㟴㘨≕": true, + "坄꿕C쇻풉~崍%碼\\8\"䬦꣙": null, + "欌L圬䅘Y8c(♺2?ON}o椳s宥2䉀eJ%闹r冁O^K諭%凞⺉⡻,掜?$ꥉ?略焕찳㯊艼誜4?\"﯎<゛XፈINT:詓 +": -1.0750456770694562E-19, + "獒àc뜭싼ﺳ뎤K`]p隨LtE": null, + "甙8䵊神EIꩤ鐯ᢀ,ﵮU䝑u疒ử驺䚿≚ഋ梶秓F`覤譐#짾蔀묊4<媍쬦靪_Yzgcࡶ4k紥`kc[Lﮗ簐*I瀑[⾰L殽鑥_mGȠ<\/|囹灠g桰iri": true, + "챓ꖙꟻ좝菇ou,嗠0\\jK핻뜠qwQ?ഩ㼕3Y彦b\u009bJ榶N棨f?됦鏖綃6鳵M[OE봨u햏.Ꮁ癜蟳뽲ꩌ뻾rM豈R嗀羫 uDꎚ%": null + }, + "V傜2<": 7175127699521359521 + }], + "铫aG切<\/\"ী⊆e<^g࢛)D顝nאַ饼\u008c猪繩嵿ﱚCꡬ㻊g엺A엦\u000f暿_f꿤볝㦕桦`蒦䎔j甬%岝rj 糏": "䚢偎눴Au<4箞7礦Iﱔ坠eȧ䪸u䵁p|逹$嗫쨘ꖾ﷐!胠z寓팢^㨔|u8Nሇe텔ꅦ抷]،鹎㳁#༔繁 ", + "낂乕ꃻ볨ϱ-ꇋ㖍fs⿫)zꜦ/K?솞♞ꑌ宭hJ᤭瑥Fu": false, + "쟰ぜ魛G\u0003u?`㾕ℾ㣭5螠烶這趩ꖢ:@咕ꐶx뒘느m䰨b痃렐0鳊喵熬딃$摉_~7*ⱦ녯1錾GKhJ惎秴6'H妈Tᧅ窹㺒疄矤铟wላ": null, + "쯆q4!3錕㲏ⵆ㇛꘷Z瑩뭆\\◪NH\u001d\\㽰U~㯶<\"쑣낞3ᵤ'峉eꢬ;鬹o꣒木X*長PXᘱu\"䠹n惞": null, + "ᅸ祊\"&ꥴCjࢼ﴿?䡉`U效5殼㮞V昽ꏪ#ﺸ\\&t6x꠹盥꣰a[\u001aꪍSpe鎿蠹": -1.1564713893659811E-19 + } + ]] + ] + ] + ], + "羵䥳H,6ⱎ겾|@t\"#햊1|稃 섭)띜=뻔ꡜ???櫎~*ῡ꫌/繣ﻠq": null + } + ]} + ]}, + "츤": false + }}, + "s": 3.7339341963399598E18 + } + ], + "N,I?1+㢓|ࣱ嶃쩥V2\u0012(4EE虪朶$|w颇v步": "~읢~_,Mzr㐫YB溓E淚\"ⅹ䈔ᏺ抙 b,nt5V㐒J檶ꏨ⻔?", + "Q껑ꡡ}$넎qH煔惍/ez^!ẳF댙䝌馻剁8": "梲;yt钰$i冄}AL%a j뜐奷걳뚾d꿽*ሬuDY3?뮟鼯뮟w㍪틱V", + "o{Q/K O胟㍏zUdꀐm&⨺J舕⾏魸訟㌥[T籨櫉唐킝 aṭ뱫촙莛>碶覆⧬짙쭰ׯdAiH໥벤퐥_恸[ 0e:죃TC弼荎뵁DA:w唵ꣁ": null, + "὏樎䵮軧|?౗aWH쩃1 ꅭsu": null + } + ] + }, + "勂\\&m鰈J釮=Ⲽ鳋+䂡郑": null, + "殣b綊倶5㥗惢⳷萢ᑀ䬄镧M^ﱴ3⣢翣n櫻1㨵}ኯ뗙顖Z.Q➷ꮨ뗇\u0004": "ꔙ䁼>n^[GीA䨟AM琢ᒊS쨲w?d㶣젊嘶纝麓+愣a%気ྞSc됓ᔘ:8bM7Xd8㶑臌]Ꙥ0ꐭ쒙䫣挵C薽Dfⵃ떼᷸", + "?紡.셪_෨j\u0013Ox┠$Xᶨ-ᅇo薹-}軫;y毝㪜K㣁?.EV쮱4둽⛻䤜'2盡\u001f60(|e쐰㼎ᦀ㒧-$l@ﻑ坳\u0003䭱响巗WFo5c㧆T턁Y맸♤(": -2.50917882560589088E17 + }} + ], + "侸\\릩.᳠뎠狣살cs项䭩畳H1s瀉븇19?.w骴崖㤊h痠볭㞳㞳䁮Ql怠㦵": "@䟴-=7f", + "鹟1x௢+d ;vi䭴FSDS\u0004hꎹ㚍?⒍⦏ў6u,扩@됷Su)Pag휛TᒗV痩!瞏釀ꖞ蘥&ೞ蘐ꭰꞇᝎ": "ah懱Ժ&\u20f7䵅♎඀䞧鿪굛ౕ湚粎蚵ᯋ幌YOE)५襦㊝Y*^\"R+ඈ咷蝶9ꥂ榨艦멎헦閝돶v좛咊E)K㓷ྭr", + "搆q쮦4綱켙셁.f4<\/g<籽늷?#蚴픘:fF\u00051㹉뀭.ᰖ풎f֦Hv蔎㧤.!䭽=鞽]음H:?\"-4": 8.740133984938656E-20 + }]} + } + ], + "tVKn딩꘥⊾蹓᤹{\u0003lR꼽ᄲQFᅏ傅ﱋ猢⤊ᔁ,E㓒秤nTතv`♛I\u0000]꫔ṞD\"麵c踝杰X&濿또꣹깳౥葂鿎\\aꡨ?": 3900062609292104525 + } + ], + "ਉ샒⊩Lu@S䧰^g": -1.1487677090371648E18, + "⎢k⑊꬗yᏫ7^err糎Dt\u000bJ礯확ㆍ沑サꋽe赔㝢^J\u0004笲㿋idra剰-᪉C錇/Ĝ䂾ညS지?~콮gR敉⬹'䧭": 1901472137232418266, + "灗k䶥:?촽贍쓉꓈㒸g獘[뵎\\胕?\u0014_榙p.j稶,$`糉妋0>Fᡰly㘽$?": "]ꙛO赎&#㠃돱剳\"<◆>0誉齐_|z|裵씪>ᐌ㼍\"Z[琕}O?G뚇諦cs⠜撺5cu痑U圲\u001c?鴴計l춥/╓哼䄗茏ꮅ뫈댽A돌롖뤫V窗讬sHd&\nOi;_u" + } + ], + "Uﺗ\\Y\\梷䄬~\u0002": null, + "k\"Y磓ᗔ휎@U冈<\/w컑)[": false, + "曏J蝷⌻덦\u001f㙳s꥓⍟邫P늮쥄c∬ྡྷ舆렮칤Z趣5콡넛A쳨\\뀙骫(棻.*&輛LiIfi{@EA婳KᬰTXT": -4.3088230431977587E17 + }]} + ] + ], + "곃㲧<\/dఓꂟs其ࡧ&N葶=?c㠤Ჴ'횠숄臼#\u001a~": false + } + ] + ]}] + }] + }} + ], + "2f`⽰E쵟>J笂裭!〛觬囀ۺ쟰#桊l鹛ⲋ|RA_Vx፭gE됓h﵀mfỐ|?juTU档[d⢼⺻p濚7E峿": 5613688852456817133 + }, + "濘끶g忮7㏵殬W팕Q曁 뫰)惃廊5%-蹚zYZ樭ﴷQ锘쯤崫gg": true, + "絥ᇑ⦏쒓븣爚H.㗊߄o蘵貆ꂚ(쎔O᥉ﮓ]姨Wꁓ!RMA|o퉢THx轮7M껁U즨'i뾘舯o": "跥f꜃?" + }} + ], + "鷰鹮K-9k;ﰰ?_ݦѷ-ꅣ䩨Zꥱ\"mꠟ屎/콑Y╘2&鸞脇㏢ꀇ࠺ⰼ拾喭틮L꽩bt俸墶 [l/웄\"꾦\u20d3iও-&+\u000fQ+໱뵞": -1.296494662286671E-19 + }, + "HX੹/⨇୕붷Uﮘ旧\\쾜͔3l鄈磣糂̖䟎Eᐳw橖b῀_딕hu葰窳闹вU颵|染H죶.fP䗮:j䫢\\b뎖i燕ꜚG⮠W-≚뉗l趕": "ଊ칭Oa᡺$IV㷧L\u0019脴셀붿餲햪$迳向쐯켂PqfT\" ?I屉鴼쿕@硙z^鏕㊵M}㚛T젣쓌-W⩐-g%⺵<뮱~빅╴瑿浂脬\u0005왦燲4Ⴭb|D堧 <\/oEQh", + "䘶#㥘੐캔f巋ἡAJ䢚쭈ࣨ뫒*mᇊK,ࣺAꑱ\u000bR<\/A\"1a6鵌㯀bh곿w(\"$ꘁ*rಐ趣.d࿩k/抶면䒎9W⊃9": "漩b挋Sw藎\u0000", + "畀e㨼mK꙼HglKb,\"'䤜": null + }]}] + ] + ] + }] + ]} + ] + ]} + ], + "歙>駿ꣂ숰Q`J΋方樛(d鱾뼣(뫖턭\u20f9lচ9歌8o]8윶l얶?镖G摄탗6폋폵+g:䱫홊<멀뀿/س|ꭺs걐跶稚W々c㫣⎖": "㣮蔊깚Cꓔ舊|XRf遻㆚︆'쾉췝\\&言", + "殭\"cށɨꝙ䞘:嬮e潽Y펪㳅/\"O@ࠗ겴]췖YǞ(t>R\"N?梳LD恭=n氯T豰2R諸#N}*灧4}㶊G䍣b얚": null, + "襞<\/啧 B|싞W瓇)6簭鼡艆lN쩝`|펭佡\\間邝[z릶&쭟愱ꅅ\\T᰽1鯯偐栈4̸s윜R7⒝/똽?치X": "⏊躖Cﱰ2Qẫ脐&இ?%냝悊", + ",鰧偵셣싹xᎹ힨᯳EṬH㹖9": -4604276727380542356 + } + } + ]]]], + "웺㚑xs}q䭵䪠馯8?LB犯zK'os䚛HZ\"L?셎s^㿧㴘Cv2": null + }] + ] + ] + ], + "Kd2Kv+|z": 7367845130646124107, + "ᦂⶨ?ᝢ 祂些ഷ牢㋇操\"腭䙾㖪\\(y4cE뽺ㆷ쫺ᔖ%zfۻ$ў1柦,㶢9r漢": -3.133230960444846E-20, + "琘M焀q%㢟f鸯O⣏蓑맕鯊$O噷|)z褫^㢦⠮ꚯ꫞`毕1qꢚ{ĭ䎀বώT\"뱘3G൴?^^of": null + } + ], + "a8V᯺?:ﺃ/8ꉿBq|9啓댚;*i2": null, + "cpT瀇H珰Ừpೃi鎪Rr␣숬-鹸ҩ䠚z脚цGoN8入y%趌I┽2ឪЀiJNcN)槣/▟6S숆牟\"箑X僛G殱娇葱T%杻:J諹昰qV쨰": 8331037591040855245 + }], + "G5ᩜ䄗巢껳": true + } + }, + "Ồ巢ゕ@_譙A`碫鄐㡥砄㠓(^K": "?܃B혢▦@犑ὺD~T⧁|醁;o=J牌9냚⢽㨘{4觍蚔9#$∺\u0016p囅\\3Xk阖⪚\"UzA穕롬✎➁㭒춺C㣌ဉ\"2瓑员ᅽꝶ뫍}꽚ꞇ鶂舟彺]ꍽJC蝧銉", + "␆Ě膝\"b-퉐ACR言J謈53~V튥x䜢?ꃽɄY뮩ꚜ": "K/↾e萃}]Bs⾿q룅鷦-膋?m+死^魊镲6", + "粡霦c枋AHퟁo礼Ke?qWcA趸㡔ꂏ?\u000e춂8iতᦜ婪\u0015㢼nﵿꍻ!ᐴ関\u001d5j㨻gfῩUK5Ju丝tかTI'?㓏t>⼟o a>i}ᰗ;뤕ܝ": false, + "ꄮ匴껢ꂰ涽+䜨B蛹H䛓-k蕞fu7kL谖,'涃V~챳逋穞cT\"vQ쓕ObaCRQ㓡Ⲯ?轭⫦輢墳?vA餽=h䮇킵n폲퉅喙?\"'1疬V嬗Qd灗'Lự": "6v!s믁㭟㣯獃!磸餠ቂh0C뿯봗F鷭gꖶ~コkK<ᦈTt\\跓w㭣횋钘ᆹ듡䑚W䟾X'ꅔ4FL勉Vܴ邨y)2'〚쭉⽵-鞣E,Q.?块", + "?(˧쩯@崟吋歄K": null + }, + "Gc럃녧>?2DYI鴿\\륨)澔0ᔬlx'觔7젘⤡縷螩%Sv׫묈/]↱&S h\u0006歋ᑛxi̘}ひY蔯_醨鯘煑橾8?䵎쨋z儬ꁏ*@츾:": null + } + } + } + ] + ] + ]} + }, + "HO츧G": 3.694949578823609E17, + "QC\u0012(翻曇Tf㷟bGBJ옉53\\嚇ᛎD/\u001b夾၉4\"핀@祎)쫆yD\"i먎Vn㿿V1W᨝䶀": -6150931500380982286, + "Z㓮P翸鍱鉼K䋞꘺튿⭁Y": -7704503411315138850, + "]모开ꬖP븣c霤<[3aΠ\"黁䖖䰑뮋ꤦ秽∼㑷冹T+YUt\"싳F↭䖏&鋌": -2.7231911483181824E18, + "tꎖ": -4.9517948741799555E-19, + "䋘즊.⬅IꬃۣQ챢ꄑ黐|f?C⾺|兕읯sC鬸섾整腨솷V": "旆柩l쪦sᖸMy㦅울썉瘗㎜檵9ꍂ駓ૉᚿ/u3씅徐拉[Z䞸ࡗ1ꆱ&Q풘?ǂ8\u0011BCDY2볨;鸏": null, + "幫 n煥s쁇펇 왊-$C\"衝:\u0014㣯舼.3뙗Yl⋇\"K迎멎[꽵s}9鉳UK8쐥\"掄㹖h㙈!얄સ?Ꜳ봺R伕UTD媚I䜘W鏨蔮": -4.150842714188901E-17, + "ﺯ^㄄\b죵@fྉkf颡팋Ꞧ{/Pm0V둳⻿/落韒ꊔᚬ@5螺G\\咸a谆⊪ቧ慷绖?财(鷇u錝F=r၍橢ឳn:^iᴵtD볠覅N赴": null + }] + }] + } + ] + ]} + ]}, + "謯?w厓奰T李헗聝ឍ貖o⪇弒L!캶$ᆅ": -4299324168507841322, + "뺊奉_垐浸延몏孄Z舰2i$q붿좾껇d▵餏\"v暜Ҭ섁m￴g>": -1.60911932510533427E18 + } + ] + } + ] + ]], + "퉝꺔㠦楶Pꅱ": 7517896876489142899, + "": false + } + ]}, + "是u&I狻餼|谖j\"7c됮sסּ-踳鉷`䣷쉄_A艣鳞凃*m⯾☦椿q㎭N溔铉tlㆈ^": 1.93547720203604352E18, + "kⲨ\\%vr#\u000bⒺY\\t<\/3﬌R訤='﹠8蝤Ꞵ렴曔r": false + } + ]}, + "阨{c?C\u001d~K?鎌Ԭ8烫#뙣P초遗t㭱E­돒䆺}甗[R*1!\\~h㕅᰺@<9JꏏષI䳖栭6綘걹ᅩM\"▯是∔v鬽顭⋊譬": "운ﶁK敂(欖C취پ℄爦賾" + } + }} + }], + "鷨赼鸙+\\䭣t圙ڹx᜾ČN<\/踘\"S_맶a鷺漇T彚⎲i㈥LT-xA캔$\u001cUH=a0츺l릦": "溣㣂0濕=鉵氬駘>Pꌢpb솇쬤h힊줎獪㪬CrQ矠a&脍꼬爼M茴/΅\u0017弝轼y#Ꞡc6둴=?R崏뷠麖w?" + }, + "閕ᘜ]CT)䵞l9z'xZF{:ؐI/躅匽졁:䟇AGF૸\u001cퟗ9)駬慟ꡒꆒRS״툋A<>\u0010\"ꂔ炃7g덚E৏bꅰ輤]o㱏_뷕ܘ暂\"u": "芢+U^+㢩^鱆8*1鈶鮀\u0002뺰9⬳ꪮlL䃣괟,G8\u20a8DF㉪錖0ㄤ瓶8Nଷd?眡GLc陓\\_죌V쁰ल二?c띦捱 \u0019JC\u0011b⤉zẒT볕\"绣蘨뚋cꡉkI\u001e鳴", + "ꃣI'{6u^㡃#཰Kq4逹y൒䧠䵮!㱙/n??{L풓ZET㙠퍿X2᩟綳跠葿㚙w཮x캽扳B唕S|尾}촕%N?o䪨": null, + "ⰴFjෟ셈[\u0018辷px?椯\\1<ﲻ栘ᣁ봢憠뉴p": -5263694954586507640 + } + ] + ]] + ]} + ]}] + ] + ], + "?#癘82禩鋆ꊝty?&": -1.9419029518535086E-19 + } + ] + ] + ]} + ] + ] + ], + "훊榲.|῕戄&.㚏Zꛦ2\"䢥ሆ⤢fV_摕婔?≍Fji冀탆꜕i㏬_ẑKᅢ꫄蔻XWc|饡Siẘ^㲦?羡2ぴ1縁ᙅ?쐉Ou": false + }]] + ]}}}, + "慂뗄卓蓔ᐓ匐嚖/颹蘯/翻ㆼL?뇊,텵<\\獷ごCボ": null + }, + "p溉ᑟi짣z:䒤棇r^٫%G9缑r砌롧.물农g?0׼ሩ4ƸO㣥㯄쩞ጩ": null, + "껎繥YxK\"F젷쨹뤤1wq轫o?鱑뜀瘊?뎃h灑\\ꛣ}K峐^ኖ⤐林ꉓhy": null + } + ], + "᱀n肓ㄛ\"堻2>m殮'1橌%Ꞵ군=Ӳ鯨9耛<\/n據0u彘8㬇៩f᏿诙]嚊": "䋯쪦S럶匏ㅛ#)O`ሀX_鐪渲⛀㨻宅闩➈ꢙஶDR⪍" + }, + "tA썓龇 ⋥bj왎录r땽✒롰;羋^\\?툳*┎?썀ma䵳넅U䳆૘〹䆀LQ0\b疀U~u$M}(鵸g⳾i抦뛹?䤈땚검.鹆?ꩡtⶥGĒ;!ቹHS峻B츪켏f5≺": 2366175040075384032, + "전pJjleb]ួ": -7.5418493141528422E18, + "n.鎖ጲ\n?,$䪘": true + }, + "欈Ar㉣螵᪚茩?O)": null + }, + "쫸M#x}D秱欐K=侫们丐.KꕾxẠ\u001e㿯䣛F܍캗qq8꟞ṢFD훎⵳簕꭛^鳜\u205c٫~⑟~冫ऊ2쫰<\/戲윱o<\"": true + }, + "㷝聥/T뱂\u0010锕|内䞇x侁≦㭖:M?iM᣿IJe煜dG࣯尃⚩gPt*辂.{磼럾䝪@a\\袛?}ᓺB珼": true + } + } + ]]}]}}, + "tn\"6ꫤ샾䄄;銞^%VBPwu묪`Y僑N.↺Ws?3C⤻9唩S䠮ᐴm;sᇷ냞඘B/;툥B?lB∤)G+O9m裢0kC햪䪤": -4.5941249382502277E18, + "ᚔt'\\愫?鵀@\\びꂕP큠<<]煹G-b!S?\nꖽ鼫,ݛ&頺y踦?E揆릱H}햧캡b@手.p탻>췽㣬ꒅ`qe佭P>ᓂ&?u}毚ᜉ蟶頳졪ᎏzl2wO": -2.53561440423275936E17 + }]} + } + ] + ]], + "潈촒⿂叡": 5495738871964062986 + } + ]] + } + ] + ]} + ]] + ]] + ]} + ] + ]}, + "ႁq킍蓅R`謈蟐ᦏ儂槐僻ﹶ9婌櫞釈~\"%匹躾ɢ뤥>࢟瀴愅?殕节/냔O✬H鲽엢?ᮈੁ⋧d␽㫐zCe*": 2.15062231586689536E17, + "㶵Ui曚珰鋪ᾼ臧P{䍏䷪쨑̟A뼿T渠誈䏚D1!잶<\/㡍7?)2l≣穷᛾稝{:;㡹nemיּ訊`G": null, + "䀕\"飕辭p圁f#뫆䶷뛮;⛴ᩍ3灚덏ᰝ쎓⦷詵%᜖Մfs⇫(\u001e~P|ﭗCⲾផv湟W첋(텪બT<บSꏉ੗⋲X婵i ӵ⇮?L䬇|ꈏ?졸": 1.548341247351782E-19 + } + ] + }, + "t;:N\u0015q鐦Rt缆{ꮐC?஛㷱敪\\+鲊㉫㓪몗릙竏(氵kYS": "XᰂT?൮ô", + "碕飦幑|+ 㚦鏶`镥ꁩ B<\/加륙": -4314053432419755959, + "秌孳(p!G?V傫%8ሽ8w;5鲗㦙LI檸\u2098": "zG N볞䆭鎍흘\\ONK3횙<\/樚立圌Q튅k쩎Ff쁋aׂJK銆ઘ즐狩6༥✙䩜篥CzP(聻駇HHퟲ讃%,ά{렍p而刲vy䦅ክ^톺M楒鍢㹳]Mdg2>䤉洞", + "踛M젧>忔芿㌜Zk": 2215369545966507819, + "씐A`$槭頰퍻^U覒\bG毲aᣴU;8!팲f꜇E⸃_卵{嫏羃X쀳C7뗮m(嚼u N܁谟D劯9]#": true, + "ﻩ!뵸-筚P᭛}ἰ履lPh?౮ⶹꆛ穉뎃g萑㑓溢CX뾇G㖬A錟]RKaꄘ]Yo+@䘁's섎襠$^홰}F": null + }, + "粘ꪒ4HXᕘ蹵.$區\r\u001d묁77pPc^y笲Q<\/ꖶ 訍䃍ᨕG?*": 1.73773035935040224E17 + }, + "婅拳?bkU;#D矠❴vVN쩆t㜷A풃갮娪a%鮏絪3dAv룒#tm쑬⌛qYwc4|L8KZ;xU⓭㳔밆拓EZ7襨eD|隰ऌ䧼u9Ԣ+]贴P荿": 2.9628516456987075E18 + }]}}] + ]} + }} + ]}] + ], + "|g翉F*湹̶\u0005⏐1脉̀eI쩓ᖂ㫱0碞l䴨ꑅ㵽7AtἈ턧yq䳥塑:z:遀ᄐX눔擉)`N3昛oQ셖y-ڨ⾶恢ꈵq^<\/": null, + "菹\\랓G^璬x৴뭸ゆUS겧﮷Bꮤ ┉銜᯻0%N7}~f洋坄Xꔼ<\/4妟Vꄟ9:౟곡t킅冩䧉笭裟炂4봋ⱳ叺怊t+怯涗\"0㖈Hq": false, + "졬믟'ﺇফ圪쓬멤m邸QLব䗁愍4jvs翙 ྍ꧀艳H-|": null, + "컮襱⣱뗠 R毪/鹙꾀%헳8&": -5770986448525107020 + } + ], + "B䔚bꐻ뙏姓展槰T-똌鷺tc灿᫽^㓟䏀o3o$꘭趙萬I顩)뇭Ἑ䓝\f@{ᣨ`x3蔛": null + } + ] + ] + }], + "⦖扚vWꃱ꥙㾠壢輓{-⎳鹷贏璿䜑bG倛⋐磎c皇皩7a~ﳫU╣Q࠭ꎉS摅姽OW.홌ೞ.": null, + "蚪eVlH献r}ᮏ믠ﰩꔄ@瑄ⲱ": null, + "퀭$JWoꩢg역쁍䖔㑺h&ୢtXX愰㱇?㾫I_6 OaB瑈q裿": null, + "꽦ﲼLyr纛Zdu珍B絟쬴糔?㕂짹䏵e": "ḱ\u2009cX9멀i䶛簆㳀k" + } + ]]]], + "(_ꏮg່澮?ᩑyM<艷\u001aꪽ\\庼뙭Z맷㰩Vm\\lY筺]3㋲2㌩㄀Eਟ䝵⨄쐨ᔟgङHn鐖⤇놋瓇Q탚單oY\"♆臾jHᶈ征ቄ??uㇰA?#1侓": null + }, + "觓^~ሢ&iI띆g륎ḱ캀.ᓡꀮ胙鈉": 1.0664523593012836E-19, + "y詭Gbᔶऽs댁U:杜⤎ϲ쁗⮼D醄诿q뙰I#즧v蔎xHᵿt᡽[**?崮耖p缫쿃L菝,봬ꤦC쯵#=X1瞻@OZc鱗CQTx": null + } + ] + }}], + "剘紁\u0004\\Xn⊠6,တױ;嵣崇}讃iႽ)d1\\䔓": null + }, + "脨z\"{X,1u찜<'k&@?1}Yn$\u0015Rd輲ーa쮂굄+B$l": true, + "諳>*쭮괐䵟Ґ+<箁}빀䅱⡔檏臒hIH脟ꩪC핝ଗP좕\"0i<\/C褻D۞恗+^5?'ꂱ䚫^7}㡠cq6\\쨪ꔞꥢ?纖䫀氮蒫侲빦敶q{A煲G": -6880961710038544266 + }}] + }, + "5s⨲JvಽῶꭂᄢI.a৊": null, + "?1q꽏쿻ꛋDR%U娝>DgN乭G": -1.2105047302732358E-19 + } + ] + ]}, + "qZz`撋뙹둣j碇쁏\\ꆥ\u0018@藴疰Wz)O{F䶛l᷂绘訥$]뮍夻䢋䩇萿獰樧猵⣭j萶q)$꬚⵷0馢W:Ⱍ!Qoe": -1666634370862219540, + "t": "=wp|~碎Q鬳Ӎ\\l-<\/^ﳊhn퐖}䍔t碵ḛ혷?靻䊗", + "邙쇡㯇%#=,E4勃驆V繚q[Y댻XV㡸[逹ᰏ葢B@u=JS5?bLRn얮㍉⏅ﰳ?a6[&큟!藈": 1.2722786745736667E-19 + }, + "X블땨4{ph鵋ꉯ웸 5p簂䦭s_E徔濧d稝~No穔噕뽲)뉈c5M윅>⚋[岦䲟懷恁?鎐꓆ฬ爋獠䜔s{\u001bm鐚儸煛%bﯿXT>ꗘ@8G": 1157841540507770724, + "媤娪Q杸\u0011SAyᡈ쿯": true, + "灚^ಸ%걁<\/蛯?\"祴坓\\\\'흍": -3.4614808555942579E18, + "釴U:O湛㴑䀣렑縓\ta)(j:숾却䗌gCiB뽬Oyuq輥厁/7)?今hY︺Q": null + } + ] + ]]]}] + ], + "I笔趠Ph!<ཛྷ㸞诘X$畉F\u0005笷菟.Esr릙!W☆䲖뗷莾뒭U\"䀸犜Uo3Gꯌx4r蔇᡹㧪쨢準<䂀%ࡡꟼ瑍8炝Xs0䀝销?fi쥱ꆝલBB": -8571484181158525797, + "L⦁o#J|\"⽩-㱢d㌛8d\\㶤傩儻E[Y熯)r噤὘勇 }": "e(濨쓌K䧚僒㘍蠤Vᛸ\"络QJL2,嬓왍伢㋒䴿考澰@(㏾`kX$끑эE斡,蜍&~y", + "vj.|统圪ᵮPL?2oŶ`밧\"勃+0ue%⿥绬췈체$6:qa렐Q;~晘3㙘鹑": true, + "ශؙ4獄⶿c︋i⚅:ん閝Ⳙ苆籦kw{䙞셕pC췃ꍬ␜꟯ꚓ酄b힝hwk꭭M鬋8B耳쑘WQ\\偙ac'唀x᪌\u2048*h짎#ፇ鮠뾏ឿ뀌": false, + "⎀jꄒ牺3Ⓝ컴~?親ꕽぼܓ喏瘘!@<튋㐌꿱⩦{a?Yv%⪧笯Uܱ栅E搚i뚬:ꄃx7䙳ꦋ&䓹vq☶I䁘ᾘ涜\\썉뺌Lr%Bc㍜3?ꝭ砿裞]": null, + "⭤뙓z(㡂%亳K䌽꫿AԾ岺㦦㼴輞낚Vꦴw냟鬓㹈뽈+o3譻K1잞": 2091209026076965894, + "ㇲ\t⋇轑ꠤ룫X긒\"zoY읇희wj梐쐑l侸`e%s": -9.9240075473576563E17, + "啸ꮑ㉰!ᚓ}銏": -4.0694813896301194E18, + ">]囋੽EK뇜>_ꀣ緳碖{쐐裔[<ನ\"䇅\"5L?#xTwv#罐\u0005래t应\\N?빗;": "v쮽瞭p뭃" + } + ]], + "斴槾?Z翁\"~慍弞ﻆ=꜡o5鐋dw\"?K蠡i샾ogDﲰ_C*⬟iㇷ4nય蟏[㟉U꽌娛苸 ঢ়操贻洞펻)쿗૊許X⨪VY츚Z䍾㶭~튃ᵦ<\/E臭tve猑x嚢": null, + "锡⛩<\/칥ꈙᬙ蝀&Ꚑ籬■865?_>L詏쿨䈌浿弥爫̫lj&zx<\/C쉾?覯n?": null, + "꾳鑤/꼩d=ᘈn挫ᑩ䰬ZC": "3錢爋6Ƹ䴗v⪿Wr益G韠[\u0010屗9쁡钁u?殢c䳀蓃樄욂NAq赟c튒瘁렶Aૡɚ捍" + } + ] + ] + ]} + ] + ] + }]]]}} + ]}], + "Ej䗳U<\/Q=灒샎䞦,堰頠@褙g_\u0003ꤾfⶽ?퇋!łB〙ד3CC䌴鈌U:뭔咎(Qો臃䡬荋BO7㢝䟸\"Yb": 2.36010731779814E-20, + "逸'0岔j\u000e눘먷翌C츊秦=ꭣ棭ှ;鳸=麱$XP⩉駚橄A\\좱⛌jqv䰞3Ь踌v㳆¹gT┌gvLB賖烡m?@E঳i": null + }, + "曺v찘ׁ?&绫O័": 9107241066550187880 + } + ] + ], + "(e屄\u0019昜훕琖b蓘ᬄ0/۲묇Z蘮ဏ⨏蛘胯뢃@㘉8ሪWᨮ⦬ᅳ䅴HI၇쨳z囕陻엣1赳o": true, + ",b刈Z,ၠ晐T솝ŕB⩆ou'퐼≃绗雗d譊": null, + "a唥KB\"ﳝ肕$u\n^⅄P䟼냉䞸⩪u윗瀱ꔨ#yşs꒬=1|ﲤ爢`t౐튼쳫_Az(Ṋ擬㦷좕耈6": 2099309172767331582, + "?㴸U<\/䢔ꯡ阽扆㐤q鐋?f㔫wM嬙-;UV죫嚔픞G&\"Cᗍ䪏풊Q": "VM7疹+陕枡툩窲}翡䖶8欞čsT뮐}璤:jﺋ鎴}HfA൝⧻Zd#Qu茅J髒皣Y-︴[?-~쉜v딏璮㹚䅊﩯<-#\u000e걀h\u0004u抱﵊㼃U<㱷⊱IC進" + }, + "숌dee節鏽邺p넱蹓+e罕U": true + } + ], + "b⧴룏??ᔠ3ぱ>%郿劃翐ꏬꠛW瞳᫏누躨狀ໄy੽\"ីuS=㨞馸k乆E": "トz݈^9R䬑<ﮛGRꨳ\u000fTT泠纷꽀MRᴱ纊:㠭볮?%N56%鈕1䗍䜁a䲗j陇=뿻偂衋࿘ᓸ?ᕵZ+<\/}H耢b䀁z^f$&㝒LkꢳI脚뙛u": 5.694374481577558E-20 + }] + } + ]], + "obj": {"key": "wrong value"}, + "퓲꽪m{㶩/뇿#⼢&᭙硞㪔E嚉c樱㬇1a綑᝖DḾ䝩": null + } +} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/data/webapp.json b/3rdparty/rapidjson/bin/data/webapp.json new file mode 100644 index 00000000000..d540b57f0df --- /dev/null +++ b/3rdparty/rapidjson/bin/data/webapp.json @@ -0,0 +1,88 @@ +{"web-app": { + "servlet": [ + { + "servlet-name": "cofaxCDS", + "servlet-class": "org.cofax.cds.CDSServlet", + "init-param": { + "configGlossary:installationAt": "Philadelphia, PA", + "configGlossary:adminEmail": "ksm@pobox.com", + "configGlossary:poweredBy": "Cofax", + "configGlossary:poweredByIcon": "/images/cofax.gif", + "configGlossary:staticPath": "/content/static", + "templateProcessorClass": "org.cofax.WysiwygTemplate", + "templateLoaderClass": "org.cofax.FilesTemplateLoader", + "templatePath": "templates", + "templateOverridePath": "", + "defaultListTemplate": "listTemplate.htm", + "defaultFileTemplate": "articleTemplate.htm", + "useJSP": false, + "jspListTemplate": "listTemplate.jsp", + "jspFileTemplate": "articleTemplate.jsp", + "cachePackageTagsTrack": 200, + "cachePackageTagsStore": 200, + "cachePackageTagsRefresh": 60, + "cacheTemplatesTrack": 100, + "cacheTemplatesStore": 50, + "cacheTemplatesRefresh": 15, + "cachePagesTrack": 200, + "cachePagesStore": 100, + "cachePagesRefresh": 10, + "cachePagesDirtyRead": 10, + "searchEngineListTemplate": "forSearchEnginesList.htm", + "searchEngineFileTemplate": "forSearchEngines.htm", + "searchEngineRobotsDb": "WEB-INF/robots.db", + "useDataStore": true, + "dataStoreClass": "org.cofax.SqlDataStore", + "redirectionClass": "org.cofax.SqlRedirection", + "dataStoreName": "cofax", + "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver", + "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon", + "dataStoreUser": "sa", + "dataStorePassword": "dataStoreTestQuery", + "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';", + "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log", + "dataStoreInitConns": 10, + "dataStoreMaxConns": 100, + "dataStoreConnUsageLimit": 100, + "dataStoreLogLevel": "debug", + "maxUrlLength": 500}}, + { + "servlet-name": "cofaxEmail", + "servlet-class": "org.cofax.cds.EmailServlet", + "init-param": { + "mailHost": "mail1", + "mailHostOverride": "mail2"}}, + { + "servlet-name": "cofaxAdmin", + "servlet-class": "org.cofax.cds.AdminServlet"}, + + { + "servlet-name": "fileServlet", + "servlet-class": "org.cofax.cds.FileServlet"}, + { + "servlet-name": "cofaxTools", + "servlet-class": "org.cofax.cms.CofaxToolsServlet", + "init-param": { + "templatePath": "toolstemplates/", + "log": 1, + "logLocation": "/usr/local/tomcat/logs/CofaxTools.log", + "logMaxSize": "", + "dataLog": 1, + "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log", + "dataLogMaxSize": "", + "removePageCache": "/content/admin/remove?cache=pages&id=", + "removeTemplateCache": "/content/admin/remove?cache=templates&id=", + "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder", + "lookInContext": 1, + "adminGroupID": 4, + "betaServer": true}}], + "servlet-mapping": { + "cofaxCDS": "/", + "cofaxEmail": "/cofaxutil/aemail/*", + "cofaxAdmin": "/admin/*", + "fileServlet": "/static/*", + "cofaxTools": "/tools/*"}, + + "taglib": { + "taglib-uri": "cofax.tld", + "taglib-location": "/WEB-INF/tlds/cofax.tld"}}} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/data/widget.json b/3rdparty/rapidjson/bin/data/widget.json new file mode 100644 index 00000000000..0449493a644 --- /dev/null +++ b/3rdparty/rapidjson/bin/data/widget.json @@ -0,0 +1,26 @@ +{"widget": { + "debug": "on", + "window": { + "title": "Sample Konfabulator Widget", + "name": "main_window", + "width": 500, + "height": 500 + }, + "image": { + "src": "Images/Sun.png", + "name": "sun1", + "hOffset": 250, + "vOffset": 250, + "alignment": "center" + }, + "text": { + "data": "Click Here", + "size": 36, + "style": "bold", + "name": "text1", + "hOffset": 250, + "vOffset": 100, + "alignment": "center", + "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" + } +}} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/draft-04/schema b/3rdparty/rapidjson/bin/draft-04/schema new file mode 100644 index 00000000000..85eb502a680 --- /dev/null +++ b/3rdparty/rapidjson/bin/draft-04/schema @@ -0,0 +1,150 @@ +{ + "id": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "positiveInteger": { + "type": "integer", + "minimum": 0 + }, + "positiveIntegerDefault0": { + "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] + }, + "simpleTypes": { + "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "uniqueItems": true + } + }, + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uri" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "multipleOf": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "boolean", + "default": false + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "boolean", + "default": false + }, + "maxLength": { "$ref": "#/definitions/positiveInteger" }, + "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": {} + }, + "maxItems": { "$ref": "#/definitions/positiveInteger" }, + "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { "$ref": "#/definitions/positiveInteger" }, + "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "dependencies": { + "exclusiveMaximum": [ "maximum" ], + "exclusiveMinimum": [ "minimum" ] + }, + "default": {} +} diff --git a/3rdparty/rapidjson/bin/encodings/utf16be.json b/3rdparty/rapidjson/bin/encodings/utf16be.json new file mode 100644 index 00000000000..e46dbfb9ddc Binary files /dev/null and b/3rdparty/rapidjson/bin/encodings/utf16be.json differ diff --git a/3rdparty/rapidjson/bin/encodings/utf16bebom.json b/3rdparty/rapidjson/bin/encodings/utf16bebom.json new file mode 100644 index 00000000000..0a23ae205cb Binary files /dev/null and b/3rdparty/rapidjson/bin/encodings/utf16bebom.json differ diff --git a/3rdparty/rapidjson/bin/encodings/utf16le.json b/3rdparty/rapidjson/bin/encodings/utf16le.json new file mode 100644 index 00000000000..92d504530cd Binary files /dev/null and b/3rdparty/rapidjson/bin/encodings/utf16le.json differ diff --git a/3rdparty/rapidjson/bin/encodings/utf16lebom.json b/3rdparty/rapidjson/bin/encodings/utf16lebom.json new file mode 100644 index 00000000000..eaba00132cd Binary files /dev/null and b/3rdparty/rapidjson/bin/encodings/utf16lebom.json differ diff --git a/3rdparty/rapidjson/bin/encodings/utf32be.json b/3rdparty/rapidjson/bin/encodings/utf32be.json new file mode 100644 index 00000000000..9cbb522279d Binary files /dev/null and b/3rdparty/rapidjson/bin/encodings/utf32be.json differ diff --git a/3rdparty/rapidjson/bin/encodings/utf32bebom.json b/3rdparty/rapidjson/bin/encodings/utf32bebom.json new file mode 100644 index 00000000000..bde6a99ab43 Binary files /dev/null and b/3rdparty/rapidjson/bin/encodings/utf32bebom.json differ diff --git a/3rdparty/rapidjson/bin/encodings/utf32le.json b/3rdparty/rapidjson/bin/encodings/utf32le.json new file mode 100644 index 00000000000..b00f290a64f Binary files /dev/null and b/3rdparty/rapidjson/bin/encodings/utf32le.json differ diff --git a/3rdparty/rapidjson/bin/encodings/utf32lebom.json b/3rdparty/rapidjson/bin/encodings/utf32lebom.json new file mode 100644 index 00000000000..d3db39bf732 Binary files /dev/null and b/3rdparty/rapidjson/bin/encodings/utf32lebom.json differ diff --git a/3rdparty/rapidjson/bin/encodings/utf8.json b/3rdparty/rapidjson/bin/encodings/utf8.json new file mode 100644 index 00000000000..1e27ece50e4 --- /dev/null +++ b/3rdparty/rapidjson/bin/encodings/utf8.json @@ -0,0 +1,7 @@ +{ + "en":"I can eat glass and it doesn't hurt me.", + "zh-Hant":"我能吞下玻璃而不傷身體。", + "zh-Hans":"我能吞下玻璃而不伤身体。", + "ja":"私はガラスを食べられます。それは私を傷つけません。", + "ko":"나는 유리를 먹을 수 있어요. 그래도 아프지 않아요" +} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/encodings/utf8bom.json b/3rdparty/rapidjson/bin/encodings/utf8bom.json new file mode 100644 index 00000000000..07e81e10528 --- /dev/null +++ b/3rdparty/rapidjson/bin/encodings/utf8bom.json @@ -0,0 +1,7 @@ +{ + "en":"I can eat glass and it doesn't hurt me.", + "zh-Hant":"我能吞下玻璃而不傷身體。", + "zh-Hans":"我能吞下玻璃而不伤身体。", + "ja":"私はガラスを食べられます。それは私を傷つけません。", + "ko":"나는 유리를 먹을 수 있어요. 그래도 아프지 않아요" +} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail1.json b/3rdparty/rapidjson/bin/jsonchecker/fail1.json new file mode 100644 index 00000000000..6216b865f10 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail1.json @@ -0,0 +1 @@ +"A JSON payload should be an object or array, not a string." \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail10.json b/3rdparty/rapidjson/bin/jsonchecker/fail10.json new file mode 100644 index 00000000000..5d8c0047bd5 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail10.json @@ -0,0 +1 @@ +{"Extra value after close": true} "misplaced quoted value" \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail11.json b/3rdparty/rapidjson/bin/jsonchecker/fail11.json new file mode 100644 index 00000000000..76eb95b4583 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail11.json @@ -0,0 +1 @@ +{"Illegal expression": 1 + 2} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail12.json b/3rdparty/rapidjson/bin/jsonchecker/fail12.json new file mode 100644 index 00000000000..77580a4522d --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail12.json @@ -0,0 +1 @@ +{"Illegal invocation": alert()} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail13.json b/3rdparty/rapidjson/bin/jsonchecker/fail13.json new file mode 100644 index 00000000000..379406b59bd --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail13.json @@ -0,0 +1 @@ +{"Numbers cannot have leading zeroes": 013} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail14.json b/3rdparty/rapidjson/bin/jsonchecker/fail14.json new file mode 100644 index 00000000000..0ed366b38a3 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail14.json @@ -0,0 +1 @@ +{"Numbers cannot be hex": 0x14} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail15.json b/3rdparty/rapidjson/bin/jsonchecker/fail15.json new file mode 100644 index 00000000000..fc8376b605d --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail15.json @@ -0,0 +1 @@ +["Illegal backslash escape: \x15"] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail16.json b/3rdparty/rapidjson/bin/jsonchecker/fail16.json new file mode 100644 index 00000000000..3fe21d4b532 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail16.json @@ -0,0 +1 @@ +[\naked] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail17.json b/3rdparty/rapidjson/bin/jsonchecker/fail17.json new file mode 100644 index 00000000000..62b9214aeda --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail17.json @@ -0,0 +1 @@ +["Illegal backslash escape: \017"] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail18.json b/3rdparty/rapidjson/bin/jsonchecker/fail18.json new file mode 100644 index 00000000000..edac92716f1 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail18.json @@ -0,0 +1 @@ +[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail19.json b/3rdparty/rapidjson/bin/jsonchecker/fail19.json new file mode 100644 index 00000000000..3b9c46fa9a2 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail19.json @@ -0,0 +1 @@ +{"Missing colon" null} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail2.json b/3rdparty/rapidjson/bin/jsonchecker/fail2.json new file mode 100644 index 00000000000..6b7c11e5a56 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail2.json @@ -0,0 +1 @@ +["Unclosed array" \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail20.json b/3rdparty/rapidjson/bin/jsonchecker/fail20.json new file mode 100644 index 00000000000..27c1af3e72e --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail20.json @@ -0,0 +1 @@ +{"Double colon":: null} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail21.json b/3rdparty/rapidjson/bin/jsonchecker/fail21.json new file mode 100644 index 00000000000..62474573b21 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail21.json @@ -0,0 +1 @@ +{"Comma instead of colon", null} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail22.json b/3rdparty/rapidjson/bin/jsonchecker/fail22.json new file mode 100644 index 00000000000..a7752581bcf --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail22.json @@ -0,0 +1 @@ +["Colon instead of comma": false] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail23.json b/3rdparty/rapidjson/bin/jsonchecker/fail23.json new file mode 100644 index 00000000000..494add1ca19 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail23.json @@ -0,0 +1 @@ +["Bad value", truth] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail24.json b/3rdparty/rapidjson/bin/jsonchecker/fail24.json new file mode 100644 index 00000000000..caff239bfc3 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail24.json @@ -0,0 +1 @@ +['single quote'] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail25.json b/3rdparty/rapidjson/bin/jsonchecker/fail25.json new file mode 100644 index 00000000000..8b7ad23e010 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail25.json @@ -0,0 +1 @@ +[" tab character in string "] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail26.json b/3rdparty/rapidjson/bin/jsonchecker/fail26.json new file mode 100644 index 00000000000..845d26a6a54 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail26.json @@ -0,0 +1 @@ +["tab\ character\ in\ string\ "] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail27.json b/3rdparty/rapidjson/bin/jsonchecker/fail27.json new file mode 100644 index 00000000000..6b01a2ca4a9 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail27.json @@ -0,0 +1,2 @@ +["line +break"] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail28.json b/3rdparty/rapidjson/bin/jsonchecker/fail28.json new file mode 100644 index 00000000000..621a0101c66 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail28.json @@ -0,0 +1,2 @@ +["line\ +break"] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail29.json b/3rdparty/rapidjson/bin/jsonchecker/fail29.json new file mode 100644 index 00000000000..47ec421bb62 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail29.json @@ -0,0 +1 @@ +[0e] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail3.json b/3rdparty/rapidjson/bin/jsonchecker/fail3.json new file mode 100644 index 00000000000..168c81eb785 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail3.json @@ -0,0 +1 @@ +{unquoted_key: "keys must be quoted"} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail30.json b/3rdparty/rapidjson/bin/jsonchecker/fail30.json new file mode 100644 index 00000000000..8ab0bc4b8b2 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail30.json @@ -0,0 +1 @@ +[0e+] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail31.json b/3rdparty/rapidjson/bin/jsonchecker/fail31.json new file mode 100644 index 00000000000..1cce602b518 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail31.json @@ -0,0 +1 @@ +[0e+-1] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail32.json b/3rdparty/rapidjson/bin/jsonchecker/fail32.json new file mode 100644 index 00000000000..45cba7396ff --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail32.json @@ -0,0 +1 @@ +{"Comma instead if closing brace": true, \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail33.json b/3rdparty/rapidjson/bin/jsonchecker/fail33.json new file mode 100644 index 00000000000..ca5eb19dc97 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail33.json @@ -0,0 +1 @@ +["mismatch"} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail4.json b/3rdparty/rapidjson/bin/jsonchecker/fail4.json new file mode 100644 index 00000000000..9de168bf34e --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail4.json @@ -0,0 +1 @@ +["extra comma",] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail5.json b/3rdparty/rapidjson/bin/jsonchecker/fail5.json new file mode 100644 index 00000000000..ddf3ce3d240 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail5.json @@ -0,0 +1 @@ +["double extra comma",,] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail6.json b/3rdparty/rapidjson/bin/jsonchecker/fail6.json new file mode 100644 index 00000000000..ed91580e1b1 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail6.json @@ -0,0 +1 @@ +[ , "<-- missing value"] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail7.json b/3rdparty/rapidjson/bin/jsonchecker/fail7.json new file mode 100644 index 00000000000..8a96af3e4ee --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail7.json @@ -0,0 +1 @@ +["Comma after the close"], \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail8.json b/3rdparty/rapidjson/bin/jsonchecker/fail8.json new file mode 100644 index 00000000000..b28479c6ecb --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail8.json @@ -0,0 +1 @@ +["Extra close"]] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/fail9.json b/3rdparty/rapidjson/bin/jsonchecker/fail9.json new file mode 100644 index 00000000000..5815574f363 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/fail9.json @@ -0,0 +1 @@ +{"Extra comma": true,} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/pass1.json b/3rdparty/rapidjson/bin/jsonchecker/pass1.json new file mode 100644 index 00000000000..70e26854369 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/pass1.json @@ -0,0 +1,58 @@ +[ + "JSON Test Pattern pass1", + {"object with 1 member":["array with 1 element"]}, + {}, + [], + -42, + true, + false, + null, + { + "integer": 1234567890, + "real": -9876.543210, + "e": 0.123456789e-12, + "E": 1.234567890E+34, + "": 23456789012E66, + "zero": 0, + "one": 1, + "space": " ", + "quote": "\"", + "backslash": "\\", + "controls": "\b\f\n\r\t", + "slash": "/ & \/", + "alpha": "abcdefghijklmnopqrstuvwyz", + "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ", + "digit": "0123456789", + "0123456789": "digit", + "special": "`1~!@#$%^&*()_+-={':[,]}|;.?", + "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", + "true": true, + "false": false, + "null": null, + "array":[ ], + "object":{ }, + "address": "50 St. James Street", + "url": "http://www.JSON.org/", + "comment": "// /* */": " ", + " s p a c e d " :[1,2 , 3 + +, + +4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7], + "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", + "quotes": "" \u0022 %22 0x22 034 "", + "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?" +: "A key can be any string" + }, + 0.5 ,98.6 +, +99.44 +, + +1066, +1e1, +0.1e1, +1e-1, +1e00,2e+00,2e-00 +,"rosebud"] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/pass2.json b/3rdparty/rapidjson/bin/jsonchecker/pass2.json new file mode 100644 index 00000000000..d3c63c7ad84 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/pass2.json @@ -0,0 +1 @@ +[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonchecker/pass3.json b/3rdparty/rapidjson/bin/jsonchecker/pass3.json new file mode 100644 index 00000000000..4528d51f1ac --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/pass3.json @@ -0,0 +1,6 @@ +{ + "JSON Test Pattern pass3": { + "The outermost value": "must be an object or array.", + "In this test": "It is an object." + } +} diff --git a/3rdparty/rapidjson/bin/jsonchecker/readme.txt b/3rdparty/rapidjson/bin/jsonchecker/readme.txt new file mode 100644 index 00000000000..321d89d998e --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonchecker/readme.txt @@ -0,0 +1,3 @@ +Test suite from http://json.org/JSON_checker/. + +If the JSON_checker is working correctly, it must accept all of the pass*.json files and reject all of the fail*.json files. diff --git a/3rdparty/rapidjson/bin/jsonschema/.gitignore b/3rdparty/rapidjson/bin/jsonschema/.gitignore new file mode 100644 index 00000000000..1333ed77b7e --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/.gitignore @@ -0,0 +1 @@ +TODO diff --git a/3rdparty/rapidjson/bin/jsonschema/.travis.yml b/3rdparty/rapidjson/bin/jsonschema/.travis.yml new file mode 100644 index 00000000000..deecd61100e --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/.travis.yml @@ -0,0 +1,4 @@ +language: python +python: "2.7" +install: pip install jsonschema +script: bin/jsonschema_suite check diff --git a/3rdparty/rapidjson/bin/jsonschema/LICENSE b/3rdparty/rapidjson/bin/jsonschema/LICENSE new file mode 100644 index 00000000000..c28adbadd91 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012 Julian Berman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/3rdparty/rapidjson/bin/jsonschema/README.md b/3rdparty/rapidjson/bin/jsonschema/README.md new file mode 100644 index 00000000000..6d9da949323 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/README.md @@ -0,0 +1,148 @@ +JSON Schema Test Suite [![Build Status](https://travis-ci.org/json-schema/JSON-Schema-Test-Suite.png?branch=develop)](https://travis-ci.org/json-schema/JSON-Schema-Test-Suite) +====================== + +This repository contains a set of JSON objects that implementors of JSON Schema +validation libraries can use to test their validators. + +It is meant to be language agnostic and should require only a JSON parser. + +The conversion of the JSON objects into tests within your test framework of +choice is still the job of the validator implementor. + +Structure of a Test +------------------- + +If you're going to use this suite, you need to know how tests are laid out. The +tests are contained in the `tests` directory at the root of this repository. + +Inside that directory is a subdirectory for each draft or version of the +schema. We'll use `draft3` as an example. + +If you look inside the draft directory, there are a number of `.json` files, +which logically group a set of test cases together. Often the grouping is by +property under test, but not always, especially within optional test files +(discussed below). + +Inside each `.json` file is a single array containing objects. It's easiest to +illustrate the structure of these with an example: + +```json + { + "description": "the description of the test case", + "schema": {"the schema that should" : "be validated against"}, + "tests": [ + { + "description": "a specific test of a valid instance", + "data": "the instance", + "valid": true + }, + { + "description": "another specific test this time, invalid", + "data": 15, + "valid": false + } + ] + } +``` + +So a description, a schema, and some tests, where tests is an array containing +one or more objects with descriptions, data, and a boolean indicating whether +they should be valid or invalid. + +Coverage +-------- + +Draft 3 and 4 should have full coverage. If you see anything missing or think +there is a useful test missing, please send a pull request or open an issue. + +Who Uses the Test Suite +----------------------- + +This suite is being used by: + +### Coffeescript ### + +* [jsck](https://github.com/pandastrike/jsck) + +### Dart ### + +* [json_schema](https://github.com/patefacio/json_schema) + +### Erlang ### + +* [jesse](https://github.com/klarna/jesse) + +### Go ### + +* [gojsonschema](https://github.com/sigu-399/gojsonschema) +* [validate-json](https://github.com/cesanta/validate-json) + +### Haskell ### + +* [aeson-schema](https://github.com/timjb/aeson-schema) +* [hjsonschema](https://github.com/seagreen/hjsonschema) + +### Java ### + +* [json-schema-validator](https://github.com/fge/json-schema-validator) + +### JavaScript ### + +* [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark) +* [direct-schema](https://github.com/IreneKnapp/direct-schema) +* [is-my-json-valid](https://github.com/mafintosh/is-my-json-valid) +* [jassi](https://github.com/iclanzan/jassi) +* [JaySchema](https://github.com/natesilva/jayschema) +* [json-schema-valid](https://github.com/ericgj/json-schema-valid) +* [Jsonary](https://github.com/jsonary-js/jsonary) +* [jsonschema](https://github.com/tdegrunt/jsonschema) +* [request-validator](https://github.com/bugventure/request-validator) +* [skeemas](https://github.com/Prestaul/skeemas) +* [tv4](https://github.com/geraintluff/tv4) +* [z-schema](https://github.com/zaggino/z-schema) +* [jsen](https://github.com/bugventure/jsen) +* [ajv](https://github.com/epoberezkin/ajv) + +### Node.js ### + +The JSON Schema Test Suite is also available as an +[npm](https://www.npmjs.com/package/json-schema-test-suite) package. +Node-specific support is maintained on the [node branch](https://github.com/json-schema/JSON-Schema-Test-Suite/tree/node). +See [NODE-README.md](https://github.com/json-schema/JSON-Schema-Test-Suite/blob/node/NODE-README.md) +for more information. + +### .NET ### + +* [Newtonsoft.Json.Schema](https://github.com/JamesNK/Newtonsoft.Json.Schema) + +### PHP ### + +* [json-schema](https://github.com/justinrainbow/json-schema) + +### Python ### + +* [jsonschema](https://github.com/Julian/jsonschema) + +### Ruby ### + +* [json-schema](https://github.com/hoxworth/json-schema) + +### Rust ### + +* [valico](https://github.com/rustless/valico) + +### Swift ### + +* [JSONSchema](https://github.com/kylef/JSONSchema.swift) + +If you use it as well, please fork and send a pull request adding yourself to +the list :). + +Contributing +------------ + +If you see something missing or incorrect, a pull request is most welcome! + +There are some sanity checks in place for testing the test suite. You can run +them with `bin/jsonschema_suite check` or `tox`. They will be run automatically by +[Travis CI](https://travis-ci.org/) as well. diff --git a/3rdparty/rapidjson/bin/jsonschema/bin/jsonschema_suite b/3rdparty/rapidjson/bin/jsonschema/bin/jsonschema_suite new file mode 100644 index 00000000000..96108c86ba2 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/bin/jsonschema_suite @@ -0,0 +1,283 @@ +#! /usr/bin/env python +from __future__ import print_function +import sys +import textwrap + +try: + import argparse +except ImportError: + print(textwrap.dedent(""" + The argparse library could not be imported. jsonschema_suite requires + either Python 2.7 or for you to install argparse. You can do so by + running `pip install argparse`, `easy_install argparse` or by + downloading argparse and running `python2.6 setup.py install`. + + See https://pypi.python.org/pypi/argparse for details. + """.strip("\n"))) + sys.exit(1) + +import errno +import fnmatch +import json +import os +import random +import shutil +import unittest +import warnings + +if getattr(unittest, "skipIf", None) is None: + unittest.skipIf = lambda cond, msg : lambda fn : fn + +try: + import jsonschema +except ImportError: + jsonschema = None +else: + validators = getattr( + jsonschema.validators, "validators", jsonschema.validators + ) + + +ROOT_DIR = os.path.join( + os.path.dirname(__file__), os.pardir).rstrip("__pycache__") +SUITE_ROOT_DIR = os.path.join(ROOT_DIR, "tests") + +REMOTES = { + "integer.json": {"type": "integer"}, + "subSchemas.json": { + "integer": {"type": "integer"}, + "refToInteger": {"$ref": "#/integer"}, + }, + "folder/folderInteger.json": {"type": "integer"} +} +REMOTES_DIR = os.path.join(ROOT_DIR, "remotes") + +TESTSUITE_SCHEMA = { + "$schema": "http://json-schema.org/draft-03/schema#", + "type": "array", + "items": { + "type": "object", + "properties": { + "description": {"type": "string", "required": True}, + "schema": {"required": True}, + "tests": { + "type": "array", + "items": { + "type": "object", + "properties": { + "description": {"type": "string", "required": True}, + "data": {"required": True}, + "valid": {"type": "boolean", "required": True} + }, + "additionalProperties": False + }, + "minItems": 1 + } + }, + "additionalProperties": False, + "minItems": 1 + } +} + + +def files(paths): + for path in paths: + with open(path) as test_file: + yield json.load(test_file) + + +def groups(paths): + for test_file in files(paths): + for group in test_file: + yield group + + +def cases(paths): + for test_group in groups(paths): + for test in test_group["tests"]: + test["schema"] = test_group["schema"] + yield test + + +def collect(root_dir): + for root, dirs, files in os.walk(root_dir): + for filename in fnmatch.filter(files, "*.json"): + yield os.path.join(root, filename) + + +class SanityTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + print("Looking for tests in %s" % SUITE_ROOT_DIR) + cls.test_files = list(collect(SUITE_ROOT_DIR)) + print("Found %s test files" % len(cls.test_files)) + assert cls.test_files, "Didn't find the test files!" + + def test_all_files_are_valid_json(self): + for path in self.test_files: + with open(path) as test_file: + try: + json.load(test_file) + except ValueError as error: + self.fail("%s contains invalid JSON (%s)" % (path, error)) + + def test_all_descriptions_have_reasonable_length(self): + for case in cases(self.test_files): + descript = case["description"] + self.assertLess( + len(descript), + 60, + "%r is too long! (keep it to less than 60 chars)" % (descript,) + ) + + def test_all_descriptions_are_unique(self): + for group in groups(self.test_files): + descriptions = set(test["description"] for test in group["tests"]) + self.assertEqual( + len(descriptions), + len(group["tests"]), + "%r contains a duplicate description" % (group,) + ) + + @unittest.skipIf(jsonschema is None, "Validation library not present!") + def test_all_schemas_are_valid(self): + for schema in os.listdir(SUITE_ROOT_DIR): + schema_validator = validators.get(schema) + if schema_validator is not None: + test_files = collect(os.path.join(SUITE_ROOT_DIR, schema)) + for case in cases(test_files): + try: + schema_validator.check_schema(case["schema"]) + except jsonschema.SchemaError as error: + self.fail("%s contains an invalid schema (%s)" % + (case, error)) + else: + warnings.warn("No schema validator for %s" % schema) + + @unittest.skipIf(jsonschema is None, "Validation library not present!") + def test_suites_are_valid(self): + validator = jsonschema.Draft3Validator(TESTSUITE_SCHEMA) + for tests in files(self.test_files): + try: + validator.validate(tests) + except jsonschema.ValidationError as error: + self.fail(str(error)) + + def test_remote_schemas_are_updated(self): + for url, schema in REMOTES.items(): + filepath = os.path.join(REMOTES_DIR, url) + with open(filepath) as schema_file: + self.assertEqual(json.load(schema_file), schema) + + +def main(arguments): + if arguments.command == "check": + suite = unittest.TestLoader().loadTestsFromTestCase(SanityTests) + result = unittest.TextTestRunner(verbosity=2).run(suite) + sys.exit(not result.wasSuccessful()) + elif arguments.command == "flatten": + selected_cases = [case for case in cases(collect(arguments.version))] + + if arguments.randomize: + random.shuffle(selected_cases) + + json.dump(selected_cases, sys.stdout, indent=4, sort_keys=True) + elif arguments.command == "remotes": + json.dump(REMOTES, sys.stdout, indent=4, sort_keys=True) + elif arguments.command == "dump_remotes": + if arguments.update: + shutil.rmtree(arguments.out_dir, ignore_errors=True) + + try: + os.makedirs(arguments.out_dir) + except OSError as e: + if e.errno == errno.EEXIST: + print("%s already exists. Aborting." % arguments.out_dir) + sys.exit(1) + raise + + for url, schema in REMOTES.items(): + filepath = os.path.join(arguments.out_dir, url) + + try: + os.makedirs(os.path.dirname(filepath)) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + with open(filepath, "wb") as out_file: + json.dump(schema, out_file, indent=4, sort_keys=True) + elif arguments.command == "serve": + try: + from flask import Flask, jsonify + except ImportError: + print(textwrap.dedent(""" + The Flask library is required to serve the remote schemas. + + You can install it by running `pip install Flask`. + + Alternatively, see the `jsonschema_suite remotes` or + `jsonschema_suite dump_remotes` commands to create static files + that can be served with your own web server. + """.strip("\n"))) + sys.exit(1) + + app = Flask(__name__) + + @app.route("/") + def serve_path(path): + if path in REMOTES: + return jsonify(REMOTES[path]) + return "Document does not exist.", 404 + + app.run(port=1234) + + +parser = argparse.ArgumentParser( + description="JSON Schema Test Suite utilities", +) +subparsers = parser.add_subparsers(help="utility commands", dest="command") + +check = subparsers.add_parser("check", help="Sanity check the test suite.") + +flatten = subparsers.add_parser( + "flatten", + help="Output a flattened file containing a selected version's test cases." +) +flatten.add_argument( + "--randomize", + action="store_true", + help="Randomize the order of the outputted cases.", +) +flatten.add_argument( + "version", help="The directory containing the version to output", +) + +remotes = subparsers.add_parser( + "remotes", + help="Output the expected URLs and their associated schemas for remote " + "ref tests as a JSON object." +) + +dump_remotes = subparsers.add_parser( + "dump_remotes", help="Dump the remote ref schemas into a file tree", +) +dump_remotes.add_argument( + "--update", + action="store_true", + help="Update the remotes in an existing directory.", +) +dump_remotes.add_argument( + "--out-dir", + default=REMOTES_DIR, + type=os.path.abspath, + help="The output directory to create as the root of the file tree", +) + +serve = subparsers.add_parser( + "serve", + help="Start a webserver to serve schemas used by remote ref tests." +) + +if __name__ == "__main__": + main(parser.parse_args()) diff --git a/3rdparty/rapidjson/bin/jsonschema/remotes/.DS_Store b/3rdparty/rapidjson/bin/jsonschema/remotes/.DS_Store new file mode 100644 index 00000000000..1d098a4103d Binary files /dev/null and b/3rdparty/rapidjson/bin/jsonschema/remotes/.DS_Store differ diff --git a/3rdparty/rapidjson/bin/jsonschema/remotes/folder/folderInteger.json b/3rdparty/rapidjson/bin/jsonschema/remotes/folder/folderInteger.json new file mode 100644 index 00000000000..dbe5c758ee3 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/remotes/folder/folderInteger.json @@ -0,0 +1,3 @@ +{ + "type": "integer" +} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonschema/remotes/integer.json b/3rdparty/rapidjson/bin/jsonschema/remotes/integer.json new file mode 100644 index 00000000000..dbe5c758ee3 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/remotes/integer.json @@ -0,0 +1,3 @@ +{ + "type": "integer" +} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonschema/remotes/subSchemas.json b/3rdparty/rapidjson/bin/jsonschema/remotes/subSchemas.json new file mode 100644 index 00000000000..8b6d8f842fc --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/remotes/subSchemas.json @@ -0,0 +1,8 @@ +{ + "integer": { + "type": "integer" + }, + "refToInteger": { + "$ref": "#/integer" + } +} \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/.DS_Store b/3rdparty/rapidjson/bin/jsonschema/tests/.DS_Store new file mode 100644 index 00000000000..dae9b18efac Binary files /dev/null and b/3rdparty/rapidjson/bin/jsonschema/tests/.DS_Store differ diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/additionalItems.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/additionalItems.json new file mode 100644 index 00000000000..6d4bff51cf3 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/additionalItems.json @@ -0,0 +1,82 @@ +[ + { + "description": "additionalItems as schema", + "schema": { + "items": [], + "additionalItems": {"type": "integer"} + }, + "tests": [ + { + "description": "additional items match schema", + "data": [ 1, 2, 3, 4 ], + "valid": true + }, + { + "description": "additional items do not match schema", + "data": [ 1, 2, 3, "foo" ], + "valid": false + } + ] + }, + { + "description": "items is schema, no additionalItems", + "schema": { + "items": {}, + "additionalItems": false + }, + "tests": [ + { + "description": "all items match schema", + "data": [ 1, 2, 3, 4, 5 ], + "valid": true + } + ] + }, + { + "description": "array of items with no additionalItems", + "schema": { + "items": [{}, {}, {}], + "additionalItems": false + }, + "tests": [ + { + "description": "no additional items present", + "data": [ 1, 2, 3 ], + "valid": true + }, + { + "description": "additional items are not permitted", + "data": [ 1, 2, 3, 4 ], + "valid": false + } + ] + }, + { + "description": "additionalItems as false without items", + "schema": {"additionalItems": false}, + "tests": [ + { + "description": + "items defaults to empty schema so everything is valid", + "data": [ 1, 2, 3, 4, 5 ], + "valid": true + }, + { + "description": "ignores non-arrays", + "data": {"foo" : "bar"}, + "valid": true + } + ] + }, + { + "description": "additionalItems are allowed by default", + "schema": {"items": []}, + "tests": [ + { + "description": "only the first items are validated", + "data": [1, "foo", false], + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/additionalProperties.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/additionalProperties.json new file mode 100644 index 00000000000..40831f9e9aa --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/additionalProperties.json @@ -0,0 +1,88 @@ +[ + { + "description": + "additionalProperties being false does not allow other properties", + "schema": { + "properties": {"foo": {}, "bar": {}}, + "patternProperties": { "^v": {} }, + "additionalProperties": false + }, + "tests": [ + { + "description": "no additional properties is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "an additional property is invalid", + "data": {"foo" : 1, "bar" : 2, "quux" : "boom"}, + "valid": false + }, + { + "description": "ignores non-objects", + "data": [1, 2, 3], + "valid": true + }, + { + "description": "patternProperties are not additional properties", + "data": {"foo":1, "vroom": 2}, + "valid": true + } + ] + }, + { + "description": + "additionalProperties allows a schema which should validate", + "schema": { + "properties": {"foo": {}, "bar": {}}, + "additionalProperties": {"type": "boolean"} + }, + "tests": [ + { + "description": "no additional properties is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "an additional valid property is valid", + "data": {"foo" : 1, "bar" : 2, "quux" : true}, + "valid": true + }, + { + "description": "an additional invalid property is invalid", + "data": {"foo" : 1, "bar" : 2, "quux" : 12}, + "valid": false + } + ] + }, + { + "description": + "additionalProperties can exist by itself", + "schema": { + "additionalProperties": {"type": "boolean"} + }, + "tests": [ + { + "description": "an additional valid property is valid", + "data": {"foo" : true}, + "valid": true + }, + { + "description": "an additional invalid property is invalid", + "data": {"foo" : 1}, + "valid": false + } + ] + }, + { + "description": "additionalProperties are allowed by default", + "schema": {"properties": {"foo": {}, "bar": {}}}, + "tests": [ + { + "description": "additional properties are allowed", + "data": {"foo": 1, "bar": 2, "quux": true}, + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/default.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/default.json new file mode 100644 index 00000000000..17629779fbe --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/default.json @@ -0,0 +1,49 @@ +[ + { + "description": "invalid type for default", + "schema": { + "properties": { + "foo": { + "type": "integer", + "default": [] + } + } + }, + "tests": [ + { + "description": "valid when property is specified", + "data": {"foo": 13}, + "valid": true + }, + { + "description": "still valid when the invalid default is used", + "data": {}, + "valid": true + } + ] + }, + { + "description": "invalid string value for default", + "schema": { + "properties": { + "bar": { + "type": "string", + "minLength": 4, + "default": "bad" + } + } + }, + "tests": [ + { + "description": "valid when property is specified", + "data": {"bar": "good"}, + "valid": true + }, + { + "description": "still valid when the invalid default is used", + "data": {}, + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/dependencies.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/dependencies.json new file mode 100644 index 00000000000..2f6ae489aed --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/dependencies.json @@ -0,0 +1,108 @@ +[ + { + "description": "dependencies", + "schema": { + "dependencies": {"bar": "foo"} + }, + "tests": [ + { + "description": "neither", + "data": {}, + "valid": true + }, + { + "description": "nondependant", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "with dependency", + "data": {"foo": 1, "bar": 2}, + "valid": true + }, + { + "description": "missing dependency", + "data": {"bar": 2}, + "valid": false + }, + { + "description": "ignores non-objects", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "multiple dependencies", + "schema": { + "dependencies": {"quux": ["foo", "bar"]} + }, + "tests": [ + { + "description": "neither", + "data": {}, + "valid": true + }, + { + "description": "nondependants", + "data": {"foo": 1, "bar": 2}, + "valid": true + }, + { + "description": "with dependencies", + "data": {"foo": 1, "bar": 2, "quux": 3}, + "valid": true + }, + { + "description": "missing dependency", + "data": {"foo": 1, "quux": 2}, + "valid": false + }, + { + "description": "missing other dependency", + "data": {"bar": 1, "quux": 2}, + "valid": false + }, + { + "description": "missing both dependencies", + "data": {"quux": 1}, + "valid": false + } + ] + }, + { + "description": "multiple dependencies subschema", + "schema": { + "dependencies": { + "bar": { + "properties": { + "foo": {"type": "integer"}, + "bar": {"type": "integer"} + } + } + } + }, + "tests": [ + { + "description": "valid", + "data": {"foo": 1, "bar": 2}, + "valid": true + }, + { + "description": "wrong type", + "data": {"foo": "quux", "bar": 2}, + "valid": false + }, + { + "description": "wrong type other", + "data": {"foo": 2, "bar": "quux"}, + "valid": false + }, + { + "description": "wrong type both", + "data": {"foo": "quux", "bar": "quux"}, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/disallow.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/disallow.json new file mode 100644 index 00000000000..a5c9d90ccee --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/disallow.json @@ -0,0 +1,80 @@ +[ + { + "description": "disallow", + "schema": { + "disallow": "integer" + }, + "tests": [ + { + "description": "allowed", + "data": "foo", + "valid": true + }, + { + "description": "disallowed", + "data": 1, + "valid": false + } + ] + }, + { + "description": "multiple disallow", + "schema": { + "disallow": ["integer", "boolean"] + }, + "tests": [ + { + "description": "valid", + "data": "foo", + "valid": true + }, + { + "description": "mismatch", + "data": 1, + "valid": false + }, + { + "description": "other mismatch", + "data": true, + "valid": false + } + ] + }, + { + "description": "multiple disallow subschema", + "schema": { + "disallow": + ["string", + { + "type": "object", + "properties": { + "foo": { + "type": "string" + } + } + }] + }, + "tests": [ + { + "description": "match", + "data": 1, + "valid": true + }, + { + "description": "other match", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "mismatch", + "data": "foo", + "valid": false + }, + { + "description": "other mismatch", + "data": {"foo": "bar"}, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/divisibleBy.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/divisibleBy.json new file mode 100644 index 00000000000..ef7cc148902 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/divisibleBy.json @@ -0,0 +1,60 @@ +[ + { + "description": "by int", + "schema": {"divisibleBy": 2}, + "tests": [ + { + "description": "int by int", + "data": 10, + "valid": true + }, + { + "description": "int by int fail", + "data": 7, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "by number", + "schema": {"divisibleBy": 1.5}, + "tests": [ + { + "description": "zero is divisible by anything (except 0)", + "data": 0, + "valid": true + }, + { + "description": "4.5 is divisible by 1.5", + "data": 4.5, + "valid": true + }, + { + "description": "35 is not divisible by 1.5", + "data": 35, + "valid": false + } + ] + }, + { + "description": "by small number", + "schema": {"divisibleBy": 0.0001}, + "tests": [ + { + "description": "0.0075 is divisible by 0.0001", + "data": 0.0075, + "valid": true + }, + { + "description": "0.00751 is not divisible by 0.0001", + "data": 0.00751, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/enum.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/enum.json new file mode 100644 index 00000000000..0c83f0804d0 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/enum.json @@ -0,0 +1,71 @@ +[ + { + "description": "simple enum validation", + "schema": {"enum": [1, 2, 3]}, + "tests": [ + { + "description": "one of the enum is valid", + "data": 1, + "valid": true + }, + { + "description": "something else is invalid", + "data": 4, + "valid": false + } + ] + }, + { + "description": "heterogeneous enum validation", + "schema": {"enum": [6, "foo", [], true, {"foo": 12}]}, + "tests": [ + { + "description": "one of the enum is valid", + "data": [], + "valid": true + }, + { + "description": "something else is invalid", + "data": null, + "valid": false + }, + { + "description": "objects are deep compared", + "data": {"foo": false}, + "valid": false + } + ] + }, + { + "description": "enums in properties", + "schema": { + "type":"object", + "properties": { + "foo": {"enum":["foo"]}, + "bar": {"enum":["bar"], "required":true} + } + }, + "tests": [ + { + "description": "both properties are valid", + "data": {"foo":"foo", "bar":"bar"}, + "valid": true + }, + { + "description": "missing optional property is valid", + "data": {"bar":"bar"}, + "valid": true + }, + { + "description": "missing required property is invalid", + "data": {"foo":"foo"}, + "valid": false + }, + { + "description": "missing all properties is invalid", + "data": {}, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/extends.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/extends.json new file mode 100644 index 00000000000..909bce575ae --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/extends.json @@ -0,0 +1,94 @@ +[ + { + "description": "extends", + "schema": { + "properties": {"bar": {"type": "integer", "required": true}}, + "extends": { + "properties": { + "foo": {"type": "string", "required": true} + } + } + }, + "tests": [ + { + "description": "extends", + "data": {"foo": "baz", "bar": 2}, + "valid": true + }, + { + "description": "mismatch extends", + "data": {"foo": "baz"}, + "valid": false + }, + { + "description": "mismatch extended", + "data": {"bar": 2}, + "valid": false + }, + { + "description": "wrong type", + "data": {"foo": "baz", "bar": "quux"}, + "valid": false + } + ] + }, + { + "description": "multiple extends", + "schema": { + "properties": {"bar": {"type": "integer", "required": true}}, + "extends" : [ + { + "properties": { + "foo": {"type": "string", "required": true} + } + }, + { + "properties": { + "baz": {"type": "null", "required": true} + } + } + ] + }, + "tests": [ + { + "description": "valid", + "data": {"foo": "quux", "bar": 2, "baz": null}, + "valid": true + }, + { + "description": "mismatch first extends", + "data": {"bar": 2, "baz": null}, + "valid": false + }, + { + "description": "mismatch second extends", + "data": {"foo": "quux", "bar": 2}, + "valid": false + }, + { + "description": "mismatch both", + "data": {"bar": 2}, + "valid": false + } + ] + }, + { + "description": "extends simple types", + "schema": { + "minimum": 20, + "extends": {"maximum": 30} + }, + "tests": [ + { + "description": "valid", + "data": 25, + "valid": true + }, + { + "description": "mismatch extends", + "data": 35, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/items.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/items.json new file mode 100644 index 00000000000..f5e18a13848 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/items.json @@ -0,0 +1,46 @@ +[ + { + "description": "a schema given for items", + "schema": { + "items": {"type": "integer"} + }, + "tests": [ + { + "description": "valid items", + "data": [ 1, 2, 3 ], + "valid": true + }, + { + "description": "wrong type of items", + "data": [1, "x"], + "valid": false + }, + { + "description": "ignores non-arrays", + "data": {"foo" : "bar"}, + "valid": true + } + ] + }, + { + "description": "an array of schemas for items", + "schema": { + "items": [ + {"type": "integer"}, + {"type": "string"} + ] + }, + "tests": [ + { + "description": "correct types", + "data": [ 1, "foo" ], + "valid": true + }, + { + "description": "wrong types", + "data": [ "foo", 1 ], + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/maxItems.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/maxItems.json new file mode 100644 index 00000000000..3b53a6b371a --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/maxItems.json @@ -0,0 +1,28 @@ +[ + { + "description": "maxItems validation", + "schema": {"maxItems": 2}, + "tests": [ + { + "description": "shorter is valid", + "data": [1], + "valid": true + }, + { + "description": "exact length is valid", + "data": [1, 2], + "valid": true + }, + { + "description": "too long is invalid", + "data": [1, 2, 3], + "valid": false + }, + { + "description": "ignores non-arrays", + "data": "foobar", + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/maxLength.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/maxLength.json new file mode 100644 index 00000000000..4de42bcaba0 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/maxLength.json @@ -0,0 +1,33 @@ +[ + { + "description": "maxLength validation", + "schema": {"maxLength": 2}, + "tests": [ + { + "description": "shorter is valid", + "data": "f", + "valid": true + }, + { + "description": "exact length is valid", + "data": "fo", + "valid": true + }, + { + "description": "too long is invalid", + "data": "foo", + "valid": false + }, + { + "description": "ignores non-strings", + "data": 10, + "valid": true + }, + { + "description": "two supplementary Unicode code points is long enough", + "data": "\uD83D\uDCA9\uD83D\uDCA9", + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/maximum.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/maximum.json new file mode 100644 index 00000000000..86c7b89c9a9 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/maximum.json @@ -0,0 +1,42 @@ +[ + { + "description": "maximum validation", + "schema": {"maximum": 3.0}, + "tests": [ + { + "description": "below the maximum is valid", + "data": 2.6, + "valid": true + }, + { + "description": "above the maximum is invalid", + "data": 3.5, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "x", + "valid": true + } + ] + }, + { + "description": "exclusiveMaximum validation", + "schema": { + "maximum": 3.0, + "exclusiveMaximum": true + }, + "tests": [ + { + "description": "below the maximum is still valid", + "data": 2.2, + "valid": true + }, + { + "description": "boundary point is invalid", + "data": 3.0, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/minItems.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/minItems.json new file mode 100644 index 00000000000..ed5118815ee --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/minItems.json @@ -0,0 +1,28 @@ +[ + { + "description": "minItems validation", + "schema": {"minItems": 1}, + "tests": [ + { + "description": "longer is valid", + "data": [1, 2], + "valid": true + }, + { + "description": "exact length is valid", + "data": [1], + "valid": true + }, + { + "description": "too short is invalid", + "data": [], + "valid": false + }, + { + "description": "ignores non-arrays", + "data": "", + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/minLength.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/minLength.json new file mode 100644 index 00000000000..3f09158deef --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/minLength.json @@ -0,0 +1,33 @@ +[ + { + "description": "minLength validation", + "schema": {"minLength": 2}, + "tests": [ + { + "description": "longer is valid", + "data": "foo", + "valid": true + }, + { + "description": "exact length is valid", + "data": "fo", + "valid": true + }, + { + "description": "too short is invalid", + "data": "f", + "valid": false + }, + { + "description": "ignores non-strings", + "data": 1, + "valid": true + }, + { + "description": "one supplementary Unicode code point is not long enough", + "data": "\uD83D\uDCA9", + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/minimum.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/minimum.json new file mode 100644 index 00000000000..d5bf000bcc6 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/minimum.json @@ -0,0 +1,42 @@ +[ + { + "description": "minimum validation", + "schema": {"minimum": 1.1}, + "tests": [ + { + "description": "above the minimum is valid", + "data": 2.6, + "valid": true + }, + { + "description": "below the minimum is invalid", + "data": 0.6, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "x", + "valid": true + } + ] + }, + { + "description": "exclusiveMinimum validation", + "schema": { + "minimum": 1.1, + "exclusiveMinimum": true + }, + "tests": [ + { + "description": "above the minimum is still valid", + "data": 1.2, + "valid": true + }, + { + "description": "boundary point is invalid", + "data": 1.1, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/bignum.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/bignum.json new file mode 100644 index 00000000000..ccc7c17fe8d --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/bignum.json @@ -0,0 +1,107 @@ +[ + { + "description": "integer", + "schema": {"type": "integer"}, + "tests": [ + { + "description": "a bignum is an integer", + "data": 12345678910111213141516171819202122232425262728293031, + "valid": true + } + ] + }, + { + "description": "number", + "schema": {"type": "number"}, + "tests": [ + { + "description": "a bignum is a number", + "data": 98249283749234923498293171823948729348710298301928331, + "valid": true + } + ] + }, + { + "description": "integer", + "schema": {"type": "integer"}, + "tests": [ + { + "description": "a negative bignum is an integer", + "data": -12345678910111213141516171819202122232425262728293031, + "valid": true + } + ] + }, + { + "description": "number", + "schema": {"type": "number"}, + "tests": [ + { + "description": "a negative bignum is a number", + "data": -98249283749234923498293171823948729348710298301928331, + "valid": true + } + ] + }, + { + "description": "string", + "schema": {"type": "string"}, + "tests": [ + { + "description": "a bignum is not a string", + "data": 98249283749234923498293171823948729348710298301928331, + "valid": false + } + ] + }, + { + "description": "integer comparison", + "schema": {"maximum": 18446744073709551615}, + "tests": [ + { + "description": "comparison works for high numbers", + "data": 18446744073709551600, + "valid": true + } + ] + }, + { + "description": "float comparison with high precision", + "schema": { + "maximum": 972783798187987123879878123.18878137, + "exclusiveMaximum": true + }, + "tests": [ + { + "description": "comparison works for high numbers", + "data": 972783798187987123879878123.188781371, + "valid": false + } + ] + }, + { + "description": "integer comparison", + "schema": {"minimum": -18446744073709551615}, + "tests": [ + { + "description": "comparison works for very negative numbers", + "data": -18446744073709551600, + "valid": true + } + ] + }, + { + "description": "float comparison with high precision on negative numbers", + "schema": { + "minimum": -972783798187987123879878123.18878137, + "exclusiveMinimum": true + }, + "tests": [ + { + "description": "comparison works for very negative numbers", + "data": -972783798187987123879878123.188781371, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/format.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/format.json new file mode 100644 index 00000000000..3ca7319dda0 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/format.json @@ -0,0 +1,222 @@ +[ + { + "description": "validation of regular expressions", + "schema": {"format": "regex"}, + "tests": [ + { + "description": "a valid regular expression", + "data": "([abc])+\\s+$", + "valid": true + }, + { + "description": "a regular expression with unclosed parens is invalid", + "data": "^(abc]", + "valid": false + } + ] + }, + { + "description": "validation of date-time strings", + "schema": {"format": "date-time"}, + "tests": [ + { + "description": "a valid date-time string", + "data": "1963-06-19T08:30:06.283185Z", + "valid": true + }, + { + "description": "an invalid date-time string", + "data": "06/19/1963 08:30:06 PST", + "valid": false + }, + { + "description": "only RFC3339 not all of ISO 8601 are valid", + "data": "2013-350T01:01:01", + "valid": false + } + ] + }, + { + "description": "validation of date strings", + "schema": {"format": "date"}, + "tests": [ + { + "description": "a valid date string", + "data": "1963-06-19", + "valid": true + }, + { + "description": "an invalid date string", + "data": "06/19/1963", + "valid": false + } + ] + }, + { + "description": "validation of time strings", + "schema": {"format": "time"}, + "tests": [ + { + "description": "a valid time string", + "data": "08:30:06", + "valid": true + }, + { + "description": "an invalid time string", + "data": "8:30 AM", + "valid": false + } + ] + }, + { + "description": "validation of URIs", + "schema": {"format": "uri"}, + "tests": [ + { + "description": "a valid URI", + "data": "http://foo.bar/?baz=qux#quux", + "valid": true + }, + { + "description": "a valid protocol-relative URI", + "data": "//foo.bar/?baz=qux#quux", + "valid": true + }, + { + "description": "an invalid URI", + "data": "\\\\WINDOWS\\fileshare", + "valid": false + }, + { + "description": "an invalid URI though valid URI reference", + "data": "abc", + "valid": false + } + ] + }, + { + "description": "validation of e-mail addresses", + "schema": {"format": "email"}, + "tests": [ + { + "description": "a valid e-mail address", + "data": "joe.bloggs@example.com", + "valid": true + }, + { + "description": "an invalid e-mail address", + "data": "2962", + "valid": false + } + ] + }, + { + "description": "validation of IP addresses", + "schema": {"format": "ip-address"}, + "tests": [ + { + "description": "a valid IP address", + "data": "192.168.0.1", + "valid": true + }, + { + "description": "an IP address with too many components", + "data": "127.0.0.0.1", + "valid": false + }, + { + "description": "an IP address with out-of-range values", + "data": "256.256.256.256", + "valid": false + } + ] + }, + { + "description": "validation of IPv6 addresses", + "schema": {"format": "ipv6"}, + "tests": [ + { + "description": "a valid IPv6 address", + "data": "::1", + "valid": true + }, + { + "description": "an IPv6 address with out-of-range values", + "data": "12345::", + "valid": false + }, + { + "description": "an IPv6 address with too many components", + "data": "1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1", + "valid": false + }, + { + "description": "an IPv6 address containing illegal characters", + "data": "::laptop", + "valid": false + } + ] + }, + { + "description": "validation of host names", + "schema": {"format": "host-name"}, + "tests": [ + { + "description": "a valid host name", + "data": "www.example.com", + "valid": true + }, + { + "description": "a host name starting with an illegal character", + "data": "-a-host-name-that-starts-with--", + "valid": false + }, + { + "description": "a host name containing illegal characters", + "data": "not_a_valid_host_name", + "valid": false + }, + { + "description": "a host name with a component too long", + "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component", + "valid": false + } + ] + }, + { + "description": "validation of CSS colors", + "schema": {"format": "color"}, + "tests": [ + { + "description": "a valid CSS color name", + "data": "fuchsia", + "valid": true + }, + { + "description": "a valid six-digit CSS color code", + "data": "#CC8899", + "valid": true + }, + { + "description": "a valid three-digit CSS color code", + "data": "#C89", + "valid": true + }, + { + "description": "an invalid CSS color code", + "data": "#00332520", + "valid": false + }, + { + "description": "an invalid CSS color name", + "data": "puce", + "valid": false + }, + { + "description": "a CSS color name containing invalid characters", + "data": "light_grayish_red-violet", + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/jsregex.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/jsregex.json new file mode 100644 index 00000000000..03fe97724c0 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/jsregex.json @@ -0,0 +1,18 @@ +[ + { + "description": "ECMA 262 regex dialect recognition", + "schema": { "format": "regex" }, + "tests": [ + { + "description": "[^] is a valid regex", + "data": "[^]", + "valid": true + }, + { + "description": "ECMA 262 has no support for lookbehind", + "data": "(?<=foo)bar", + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/zeroTerminatedFloats.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/zeroTerminatedFloats.json new file mode 100644 index 00000000000..9b50ea27769 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/optional/zeroTerminatedFloats.json @@ -0,0 +1,15 @@ +[ + { + "description": "some languages do not distinguish between different types of numeric value", + "schema": { + "type": "integer" + }, + "tests": [ + { + "description": "a float is not an integer even without fractional part", + "data": 1.0, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/pattern.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/pattern.json new file mode 100644 index 00000000000..25e72997314 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/pattern.json @@ -0,0 +1,34 @@ +[ + { + "description": "pattern validation", + "schema": {"pattern": "^a*$"}, + "tests": [ + { + "description": "a matching pattern is valid", + "data": "aaa", + "valid": true + }, + { + "description": "a non-matching pattern is invalid", + "data": "abc", + "valid": false + }, + { + "description": "ignores non-strings", + "data": true, + "valid": true + } + ] + }, + { + "description": "pattern is not anchored", + "schema": {"pattern": "a+"}, + "tests": [ + { + "description": "matches a substring", + "data": "xxaayy", + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/patternProperties.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/patternProperties.json new file mode 100644 index 00000000000..18586e5daba --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/patternProperties.json @@ -0,0 +1,110 @@ +[ + { + "description": + "patternProperties validates properties matching a regex", + "schema": { + "patternProperties": { + "f.*o": {"type": "integer"} + } + }, + "tests": [ + { + "description": "a single valid match is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "multiple valid matches is valid", + "data": {"foo": 1, "foooooo" : 2}, + "valid": true + }, + { + "description": "a single invalid match is invalid", + "data": {"foo": "bar", "fooooo": 2}, + "valid": false + }, + { + "description": "multiple invalid matches is invalid", + "data": {"foo": "bar", "foooooo" : "baz"}, + "valid": false + }, + { + "description": "ignores non-objects", + "data": 12, + "valid": true + } + ] + }, + { + "description": "multiple simultaneous patternProperties are validated", + "schema": { + "patternProperties": { + "a*": {"type": "integer"}, + "aaa*": {"maximum": 20} + } + }, + "tests": [ + { + "description": "a single valid match is valid", + "data": {"a": 21}, + "valid": true + }, + { + "description": "a simultaneous match is valid", + "data": {"aaaa": 18}, + "valid": true + }, + { + "description": "multiple matches is valid", + "data": {"a": 21, "aaaa": 18}, + "valid": true + }, + { + "description": "an invalid due to one is invalid", + "data": {"a": "bar"}, + "valid": false + }, + { + "description": "an invalid due to the other is invalid", + "data": {"aaaa": 31}, + "valid": false + }, + { + "description": "an invalid due to both is invalid", + "data": {"aaa": "foo", "aaaa": 31}, + "valid": false + } + ] + }, + { + "description": "regexes are not anchored by default and are case sensitive", + "schema": { + "patternProperties": { + "[0-9]{2,}": { "type": "boolean" }, + "X_": { "type": "string" } + } + }, + "tests": [ + { + "description": "non recognized members are ignored", + "data": { "answer 1": "42" }, + "valid": true + }, + { + "description": "recognized members are accounted for", + "data": { "a31b": null }, + "valid": false + }, + { + "description": "regexes are case sensitive", + "data": { "a_x_3": 3 }, + "valid": true + }, + { + "description": "regexes are case sensitive, 2", + "data": { "a_X_3": 3 }, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/properties.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/properties.json new file mode 100644 index 00000000000..cd1644dcd91 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/properties.json @@ -0,0 +1,92 @@ +[ + { + "description": "object properties validation", + "schema": { + "properties": { + "foo": {"type": "integer"}, + "bar": {"type": "string"} + } + }, + "tests": [ + { + "description": "both properties present and valid is valid", + "data": {"foo": 1, "bar": "baz"}, + "valid": true + }, + { + "description": "one property invalid is invalid", + "data": {"foo": 1, "bar": {}}, + "valid": false + }, + { + "description": "both properties invalid is invalid", + "data": {"foo": [], "bar": {}}, + "valid": false + }, + { + "description": "doesn't invalidate other properties", + "data": {"quux": []}, + "valid": true + }, + { + "description": "ignores non-objects", + "data": [], + "valid": true + } + ] + }, + { + "description": + "properties, patternProperties, additionalProperties interaction", + "schema": { + "properties": { + "foo": {"type": "array", "maxItems": 3}, + "bar": {"type": "array"} + }, + "patternProperties": {"f.o": {"minItems": 2}}, + "additionalProperties": {"type": "integer"} + }, + "tests": [ + { + "description": "property validates property", + "data": {"foo": [1, 2]}, + "valid": true + }, + { + "description": "property invalidates property", + "data": {"foo": [1, 2, 3, 4]}, + "valid": false + }, + { + "description": "patternProperty invalidates property", + "data": {"foo": []}, + "valid": false + }, + { + "description": "patternProperty validates nonproperty", + "data": {"fxo": [1, 2]}, + "valid": true + }, + { + "description": "patternProperty invalidates nonproperty", + "data": {"fxo": []}, + "valid": false + }, + { + "description": "additionalProperty ignores property", + "data": {"bar": []}, + "valid": true + }, + { + "description": "additionalProperty validates others", + "data": {"quux": 3}, + "valid": true + }, + { + "description": "additionalProperty invalidates others", + "data": {"quux": "foo"}, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/ref.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/ref.json new file mode 100644 index 00000000000..903ecb6bce1 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/ref.json @@ -0,0 +1,159 @@ +[ + { + "description": "root pointer ref", + "schema": { + "properties": { + "foo": {"$ref": "#"} + }, + "additionalProperties": false + }, + "tests": [ + { + "description": "match", + "data": {"foo": false}, + "valid": true + }, + { + "description": "recursive match", + "data": {"foo": {"foo": false}}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": false}, + "valid": false + }, + { + "description": "recursive mismatch", + "data": {"foo": {"bar": false}}, + "valid": false + } + ] + }, + { + "description": "relative pointer ref to object", + "schema": { + "properties": { + "foo": {"type": "integer"}, + "bar": {"$ref": "#/properties/foo"} + } + }, + "tests": [ + { + "description": "match", + "data": {"bar": 3}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": true}, + "valid": false + } + ] + }, + { + "description": "relative pointer ref to array", + "schema": { + "items": [ + {"type": "integer"}, + {"$ref": "#/items/0"} + ] + }, + "tests": [ + { + "description": "match array", + "data": [1, 2], + "valid": true + }, + { + "description": "mismatch array", + "data": [1, "foo"], + "valid": false + } + ] + }, + { + "description": "escaped pointer ref", + "schema": { + "tilda~field": {"type": "integer"}, + "slash/field": {"type": "integer"}, + "percent%field": {"type": "integer"}, + "properties": { + "tilda": {"$ref": "#/tilda~0field"}, + "slash": {"$ref": "#/slash~1field"}, + "percent": {"$ref": "#/percent%25field"} + } + }, + "tests": [ + { + "description": "slash invalid", + "data": {"slash": "aoeu"}, + "valid": false + }, + { + "description": "tilda invalid", + "data": {"tilda": "aoeu"}, + "valid": false + }, + { + "description": "percent invalid", + "data": {"percent": "aoeu"}, + "valid": false + }, + { + "description": "slash valid", + "data": {"slash": 123}, + "valid": true + }, + { + "description": "tilda valid", + "data": {"tilda": 123}, + "valid": true + }, + { + "description": "percent valid", + "data": {"percent": 123}, + "valid": true + } + ] + }, + { + "description": "nested refs", + "schema": { + "definitions": { + "a": {"type": "integer"}, + "b": {"$ref": "#/definitions/a"}, + "c": {"$ref": "#/definitions/b"} + }, + "$ref": "#/definitions/c" + }, + "tests": [ + { + "description": "nested ref valid", + "data": 5, + "valid": true + }, + { + "description": "nested ref invalid", + "data": "a", + "valid": false + } + ] + }, + { + "description": "remote ref, containing refs itself", + "schema": {"$ref": "http://json-schema.org/draft-03/schema#"}, + "tests": [ + { + "description": "remote ref valid", + "data": {"items": {"type": "integer"}}, + "valid": true + }, + { + "description": "remote ref invalid", + "data": {"items": {"type": 1}}, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/refRemote.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/refRemote.json new file mode 100644 index 00000000000..4ca804732c9 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/refRemote.json @@ -0,0 +1,74 @@ +[ + { + "description": "remote ref", + "schema": {"$ref": "http://localhost:1234/integer.json"}, + "tests": [ + { + "description": "remote ref valid", + "data": 1, + "valid": true + }, + { + "description": "remote ref invalid", + "data": "a", + "valid": false + } + ] + }, + { + "description": "fragment within remote ref", + "schema": {"$ref": "http://localhost:1234/subSchemas.json#/integer"}, + "tests": [ + { + "description": "remote fragment valid", + "data": 1, + "valid": true + }, + { + "description": "remote fragment invalid", + "data": "a", + "valid": false + } + ] + }, + { + "description": "ref within remote ref", + "schema": { + "$ref": "http://localhost:1234/subSchemas.json#/refToInteger" + }, + "tests": [ + { + "description": "ref within ref valid", + "data": 1, + "valid": true + }, + { + "description": "ref within ref invalid", + "data": "a", + "valid": false + } + ] + }, + { + "description": "change resolution scope", + "schema": { + "id": "http://localhost:1234/", + "items": { + "id": "folder/", + "items": {"$ref": "folderInteger.json"} + } + }, + "tests": [ + { + "description": "changed scope ref valid", + "data": [[1]], + "valid": true + }, + { + "description": "changed scope ref invalid", + "data": [["a"]], + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/required.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/required.json new file mode 100644 index 00000000000..aaaf0242737 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/required.json @@ -0,0 +1,53 @@ +[ + { + "description": "required validation", + "schema": { + "properties": { + "foo": {"required" : true}, + "bar": {} + } + }, + "tests": [ + { + "description": "present required property is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "non-present required property is invalid", + "data": {"bar": 1}, + "valid": false + } + ] + }, + { + "description": "required default validation", + "schema": { + "properties": { + "foo": {} + } + }, + "tests": [ + { + "description": "not required by default", + "data": {}, + "valid": true + } + ] + }, + { + "description": "required explicitly false validation", + "schema": { + "properties": { + "foo": {"required": false} + } + }, + "tests": [ + { + "description": "not required if required is false", + "data": {}, + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/type.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/type.json new file mode 100644 index 00000000000..337da1206da --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/type.json @@ -0,0 +1,474 @@ +[ + { + "description": "integer type matches integers", + "schema": {"type": "integer"}, + "tests": [ + { + "description": "an integer is an integer", + "data": 1, + "valid": true + }, + { + "description": "a float is not an integer", + "data": 1.1, + "valid": false + }, + { + "description": "a string is not an integer", + "data": "foo", + "valid": false + }, + { + "description": "an object is not an integer", + "data": {}, + "valid": false + }, + { + "description": "an array is not an integer", + "data": [], + "valid": false + }, + { + "description": "a boolean is not an integer", + "data": true, + "valid": false + }, + { + "description": "null is not an integer", + "data": null, + "valid": false + } + ] + }, + { + "description": "number type matches numbers", + "schema": {"type": "number"}, + "tests": [ + { + "description": "an integer is a number", + "data": 1, + "valid": true + }, + { + "description": "a float is a number", + "data": 1.1, + "valid": true + }, + { + "description": "a string is not a number", + "data": "foo", + "valid": false + }, + { + "description": "an object is not a number", + "data": {}, + "valid": false + }, + { + "description": "an array is not a number", + "data": [], + "valid": false + }, + { + "description": "a boolean is not a number", + "data": true, + "valid": false + }, + { + "description": "null is not a number", + "data": null, + "valid": false + } + ] + }, + { + "description": "string type matches strings", + "schema": {"type": "string"}, + "tests": [ + { + "description": "1 is not a string", + "data": 1, + "valid": false + }, + { + "description": "a float is not a string", + "data": 1.1, + "valid": false + }, + { + "description": "a string is a string", + "data": "foo", + "valid": true + }, + { + "description": "an object is not a string", + "data": {}, + "valid": false + }, + { + "description": "an array is not a string", + "data": [], + "valid": false + }, + { + "description": "a boolean is not a string", + "data": true, + "valid": false + }, + { + "description": "null is not a string", + "data": null, + "valid": false + } + ] + }, + { + "description": "object type matches objects", + "schema": {"type": "object"}, + "tests": [ + { + "description": "an integer is not an object", + "data": 1, + "valid": false + }, + { + "description": "a float is not an object", + "data": 1.1, + "valid": false + }, + { + "description": "a string is not an object", + "data": "foo", + "valid": false + }, + { + "description": "an object is an object", + "data": {}, + "valid": true + }, + { + "description": "an array is not an object", + "data": [], + "valid": false + }, + { + "description": "a boolean is not an object", + "data": true, + "valid": false + }, + { + "description": "null is not an object", + "data": null, + "valid": false + } + ] + }, + { + "description": "array type matches arrays", + "schema": {"type": "array"}, + "tests": [ + { + "description": "an integer is not an array", + "data": 1, + "valid": false + }, + { + "description": "a float is not an array", + "data": 1.1, + "valid": false + }, + { + "description": "a string is not an array", + "data": "foo", + "valid": false + }, + { + "description": "an object is not an array", + "data": {}, + "valid": false + }, + { + "description": "an array is an array", + "data": [], + "valid": true + }, + { + "description": "a boolean is not an array", + "data": true, + "valid": false + }, + { + "description": "null is not an array", + "data": null, + "valid": false + } + ] + }, + { + "description": "boolean type matches booleans", + "schema": {"type": "boolean"}, + "tests": [ + { + "description": "an integer is not a boolean", + "data": 1, + "valid": false + }, + { + "description": "a float is not a boolean", + "data": 1.1, + "valid": false + }, + { + "description": "a string is not a boolean", + "data": "foo", + "valid": false + }, + { + "description": "an object is not a boolean", + "data": {}, + "valid": false + }, + { + "description": "an array is not a boolean", + "data": [], + "valid": false + }, + { + "description": "a boolean is a boolean", + "data": true, + "valid": true + }, + { + "description": "null is not a boolean", + "data": null, + "valid": false + } + ] + }, + { + "description": "null type matches only the null object", + "schema": {"type": "null"}, + "tests": [ + { + "description": "an integer is not null", + "data": 1, + "valid": false + }, + { + "description": "a float is not null", + "data": 1.1, + "valid": false + }, + { + "description": "a string is not null", + "data": "foo", + "valid": false + }, + { + "description": "an object is not null", + "data": {}, + "valid": false + }, + { + "description": "an array is not null", + "data": [], + "valid": false + }, + { + "description": "a boolean is not null", + "data": true, + "valid": false + }, + { + "description": "null is null", + "data": null, + "valid": true + } + ] + }, + { + "description": "any type matches any type", + "schema": {"type": "any"}, + "tests": [ + { + "description": "any type includes integers", + "data": 1, + "valid": true + }, + { + "description": "any type includes float", + "data": 1.1, + "valid": true + }, + { + "description": "any type includes string", + "data": "foo", + "valid": true + }, + { + "description": "any type includes object", + "data": {}, + "valid": true + }, + { + "description": "any type includes array", + "data": [], + "valid": true + }, + { + "description": "any type includes boolean", + "data": true, + "valid": true + }, + { + "description": "any type includes null", + "data": null, + "valid": true + } + ] + }, + { + "description": "multiple types can be specified in an array", + "schema": {"type": ["integer", "string"]}, + "tests": [ + { + "description": "an integer is valid", + "data": 1, + "valid": true + }, + { + "description": "a string is valid", + "data": "foo", + "valid": true + }, + { + "description": "a float is invalid", + "data": 1.1, + "valid": false + }, + { + "description": "an object is invalid", + "data": {}, + "valid": false + }, + { + "description": "an array is invalid", + "data": [], + "valid": false + }, + { + "description": "a boolean is invalid", + "data": true, + "valid": false + }, + { + "description": "null is invalid", + "data": null, + "valid": false + } + ] + }, + { + "description": "types can include schemas", + "schema": { + "type": [ + "array", + {"type": "object"} + ] + }, + "tests": [ + { + "description": "an integer is invalid", + "data": 1, + "valid": false + }, + { + "description": "a string is invalid", + "data": "foo", + "valid": false + }, + { + "description": "a float is invalid", + "data": 1.1, + "valid": false + }, + { + "description": "an object is valid", + "data": {}, + "valid": true + }, + { + "description": "an array is valid", + "data": [], + "valid": true + }, + { + "description": "a boolean is invalid", + "data": true, + "valid": false + }, + { + "description": "null is invalid", + "data": null, + "valid": false + } + ] + }, + { + "description": + "when types includes a schema it should fully validate the schema", + "schema": { + "type": [ + "integer", + { + "properties": { + "foo": {"type": "null"} + } + } + ] + }, + "tests": [ + { + "description": "an integer is valid", + "data": 1, + "valid": true + }, + { + "description": "an object is valid only if it is fully valid", + "data": {"foo": null}, + "valid": true + }, + { + "description": "an object is invalid otherwise", + "data": {"foo": "bar"}, + "valid": false + } + ] + }, + { + "description": "types from separate schemas are merged", + "schema": { + "type": [ + {"type": ["string"]}, + {"type": ["array", "null"]} + ] + }, + "tests": [ + { + "description": "an integer is invalid", + "data": 1, + "valid": false + }, + { + "description": "a string is valid", + "data": "foo", + "valid": true + }, + { + "description": "an array is valid", + "data": [1, 2, 3], + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft3/uniqueItems.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/uniqueItems.json new file mode 100644 index 00000000000..c1f4ab99c9a --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft3/uniqueItems.json @@ -0,0 +1,79 @@ +[ + { + "description": "uniqueItems validation", + "schema": {"uniqueItems": true}, + "tests": [ + { + "description": "unique array of integers is valid", + "data": [1, 2], + "valid": true + }, + { + "description": "non-unique array of integers is invalid", + "data": [1, 1], + "valid": false + }, + { + "description": "numbers are unique if mathematically unequal", + "data": [1.0, 1.00, 1], + "valid": false + }, + { + "description": "unique array of objects is valid", + "data": [{"foo": "bar"}, {"foo": "baz"}], + "valid": true + }, + { + "description": "non-unique array of objects is invalid", + "data": [{"foo": "bar"}, {"foo": "bar"}], + "valid": false + }, + { + "description": "unique array of nested objects is valid", + "data": [ + {"foo": {"bar" : {"baz" : true}}}, + {"foo": {"bar" : {"baz" : false}}} + ], + "valid": true + }, + { + "description": "non-unique array of nested objects is invalid", + "data": [ + {"foo": {"bar" : {"baz" : true}}}, + {"foo": {"bar" : {"baz" : true}}} + ], + "valid": false + }, + { + "description": "unique array of arrays is valid", + "data": [["foo"], ["bar"]], + "valid": true + }, + { + "description": "non-unique array of arrays is invalid", + "data": [["foo"], ["foo"]], + "valid": false + }, + { + "description": "1 and true are unique", + "data": [1, true], + "valid": true + }, + { + "description": "0 and false are unique", + "data": [0, false], + "valid": true + }, + { + "description": "unique heterogeneous types are valid", + "data": [{}, [1], true, null, 1], + "valid": true + }, + { + "description": "non-unique heterogeneous types are invalid", + "data": [{}, [1], true, null, {}, 1], + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/.DS_Store b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/.DS_Store new file mode 100644 index 00000000000..ef142295ea0 Binary files /dev/null and b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/.DS_Store differ diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/additionalItems.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/additionalItems.json new file mode 100644 index 00000000000..521745c8d6e --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/additionalItems.json @@ -0,0 +1,82 @@ +[ + { + "description": "additionalItems as schema", + "schema": { + "items": [{}], + "additionalItems": {"type": "integer"} + }, + "tests": [ + { + "description": "additional items match schema", + "data": [ null, 2, 3, 4 ], + "valid": true + }, + { + "description": "additional items do not match schema", + "data": [ null, 2, 3, "foo" ], + "valid": false + } + ] + }, + { + "description": "items is schema, no additionalItems", + "schema": { + "items": {}, + "additionalItems": false + }, + "tests": [ + { + "description": "all items match schema", + "data": [ 1, 2, 3, 4, 5 ], + "valid": true + } + ] + }, + { + "description": "array of items with no additionalItems", + "schema": { + "items": [{}, {}, {}], + "additionalItems": false + }, + "tests": [ + { + "description": "no additional items present", + "data": [ 1, 2, 3 ], + "valid": true + }, + { + "description": "additional items are not permitted", + "data": [ 1, 2, 3, 4 ], + "valid": false + } + ] + }, + { + "description": "additionalItems as false without items", + "schema": {"additionalItems": false}, + "tests": [ + { + "description": + "items defaults to empty schema so everything is valid", + "data": [ 1, 2, 3, 4, 5 ], + "valid": true + }, + { + "description": "ignores non-arrays", + "data": {"foo" : "bar"}, + "valid": true + } + ] + }, + { + "description": "additionalItems are allowed by default", + "schema": {"items": [{"type": "integer"}]}, + "tests": [ + { + "description": "only the first item is validated", + "data": [1, "foo", false], + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/additionalProperties.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/additionalProperties.json new file mode 100644 index 00000000000..40831f9e9aa --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/additionalProperties.json @@ -0,0 +1,88 @@ +[ + { + "description": + "additionalProperties being false does not allow other properties", + "schema": { + "properties": {"foo": {}, "bar": {}}, + "patternProperties": { "^v": {} }, + "additionalProperties": false + }, + "tests": [ + { + "description": "no additional properties is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "an additional property is invalid", + "data": {"foo" : 1, "bar" : 2, "quux" : "boom"}, + "valid": false + }, + { + "description": "ignores non-objects", + "data": [1, 2, 3], + "valid": true + }, + { + "description": "patternProperties are not additional properties", + "data": {"foo":1, "vroom": 2}, + "valid": true + } + ] + }, + { + "description": + "additionalProperties allows a schema which should validate", + "schema": { + "properties": {"foo": {}, "bar": {}}, + "additionalProperties": {"type": "boolean"} + }, + "tests": [ + { + "description": "no additional properties is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "an additional valid property is valid", + "data": {"foo" : 1, "bar" : 2, "quux" : true}, + "valid": true + }, + { + "description": "an additional invalid property is invalid", + "data": {"foo" : 1, "bar" : 2, "quux" : 12}, + "valid": false + } + ] + }, + { + "description": + "additionalProperties can exist by itself", + "schema": { + "additionalProperties": {"type": "boolean"} + }, + "tests": [ + { + "description": "an additional valid property is valid", + "data": {"foo" : true}, + "valid": true + }, + { + "description": "an additional invalid property is invalid", + "data": {"foo" : 1}, + "valid": false + } + ] + }, + { + "description": "additionalProperties are allowed by default", + "schema": {"properties": {"foo": {}, "bar": {}}}, + "tests": [ + { + "description": "additional properties are allowed", + "data": {"foo": 1, "bar": 2, "quux": true}, + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/allOf.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/allOf.json new file mode 100644 index 00000000000..bbb5f89e4bc --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/allOf.json @@ -0,0 +1,112 @@ +[ + { + "description": "allOf", + "schema": { + "allOf": [ + { + "properties": { + "bar": {"type": "integer"} + }, + "required": ["bar"] + }, + { + "properties": { + "foo": {"type": "string"} + }, + "required": ["foo"] + } + ] + }, + "tests": [ + { + "description": "allOf", + "data": {"foo": "baz", "bar": 2}, + "valid": true + }, + { + "description": "mismatch second", + "data": {"foo": "baz"}, + "valid": false + }, + { + "description": "mismatch first", + "data": {"bar": 2}, + "valid": false + }, + { + "description": "wrong type", + "data": {"foo": "baz", "bar": "quux"}, + "valid": false + } + ] + }, + { + "description": "allOf with base schema", + "schema": { + "properties": {"bar": {"type": "integer"}}, + "required": ["bar"], + "allOf" : [ + { + "properties": { + "foo": {"type": "string"} + }, + "required": ["foo"] + }, + { + "properties": { + "baz": {"type": "null"} + }, + "required": ["baz"] + } + ] + }, + "tests": [ + { + "description": "valid", + "data": {"foo": "quux", "bar": 2, "baz": null}, + "valid": true + }, + { + "description": "mismatch base schema", + "data": {"foo": "quux", "baz": null}, + "valid": false + }, + { + "description": "mismatch first allOf", + "data": {"bar": 2, "baz": null}, + "valid": false + }, + { + "description": "mismatch second allOf", + "data": {"foo": "quux", "bar": 2}, + "valid": false + }, + { + "description": "mismatch both", + "data": {"bar": 2}, + "valid": false + } + ] + }, + { + "description": "allOf simple types", + "schema": { + "allOf": [ + {"maximum": 30}, + {"minimum": 20} + ] + }, + "tests": [ + { + "description": "valid", + "data": 25, + "valid": true + }, + { + "description": "mismatch one", + "data": 35, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/anyOf.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/anyOf.json new file mode 100644 index 00000000000..a58714afd89 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/anyOf.json @@ -0,0 +1,68 @@ +[ + { + "description": "anyOf", + "schema": { + "anyOf": [ + { + "type": "integer" + }, + { + "minimum": 2 + } + ] + }, + "tests": [ + { + "description": "first anyOf valid", + "data": 1, + "valid": true + }, + { + "description": "second anyOf valid", + "data": 2.5, + "valid": true + }, + { + "description": "both anyOf valid", + "data": 3, + "valid": true + }, + { + "description": "neither anyOf valid", + "data": 1.5, + "valid": false + } + ] + }, + { + "description": "anyOf with base schema", + "schema": { + "type": "string", + "anyOf" : [ + { + "maxLength": 2 + }, + { + "minLength": 4 + } + ] + }, + "tests": [ + { + "description": "mismatch base schema", + "data": 3, + "valid": false + }, + { + "description": "one anyOf valid", + "data": "foobar", + "valid": true + }, + { + "description": "both anyOf invalid", + "data": "foo", + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/default.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/default.json new file mode 100644 index 00000000000..17629779fbe --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/default.json @@ -0,0 +1,49 @@ +[ + { + "description": "invalid type for default", + "schema": { + "properties": { + "foo": { + "type": "integer", + "default": [] + } + } + }, + "tests": [ + { + "description": "valid when property is specified", + "data": {"foo": 13}, + "valid": true + }, + { + "description": "still valid when the invalid default is used", + "data": {}, + "valid": true + } + ] + }, + { + "description": "invalid string value for default", + "schema": { + "properties": { + "bar": { + "type": "string", + "minLength": 4, + "default": "bad" + } + } + }, + "tests": [ + { + "description": "valid when property is specified", + "data": {"bar": "good"}, + "valid": true + }, + { + "description": "still valid when the invalid default is used", + "data": {}, + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/definitions.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/definitions.json new file mode 100644 index 00000000000..cf935a32153 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/definitions.json @@ -0,0 +1,32 @@ +[ + { + "description": "valid definition", + "schema": {"$ref": "http://json-schema.org/draft-04/schema#"}, + "tests": [ + { + "description": "valid definition schema", + "data": { + "definitions": { + "foo": {"type": "integer"} + } + }, + "valid": true + } + ] + }, + { + "description": "invalid definition", + "schema": {"$ref": "http://json-schema.org/draft-04/schema#"}, + "tests": [ + { + "description": "invalid definition schema", + "data": { + "definitions": { + "foo": {"type": 1} + } + }, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/dependencies.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/dependencies.json new file mode 100644 index 00000000000..7b9b16a7e12 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/dependencies.json @@ -0,0 +1,113 @@ +[ + { + "description": "dependencies", + "schema": { + "dependencies": {"bar": ["foo"]} + }, + "tests": [ + { + "description": "neither", + "data": {}, + "valid": true + }, + { + "description": "nondependant", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "with dependency", + "data": {"foo": 1, "bar": 2}, + "valid": true + }, + { + "description": "missing dependency", + "data": {"bar": 2}, + "valid": false + }, + { + "description": "ignores non-objects", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "multiple dependencies", + "schema": { + "dependencies": {"quux": ["foo", "bar"]} + }, + "tests": [ + { + "description": "neither", + "data": {}, + "valid": true + }, + { + "description": "nondependants", + "data": {"foo": 1, "bar": 2}, + "valid": true + }, + { + "description": "with dependencies", + "data": {"foo": 1, "bar": 2, "quux": 3}, + "valid": true + }, + { + "description": "missing dependency", + "data": {"foo": 1, "quux": 2}, + "valid": false + }, + { + "description": "missing other dependency", + "data": {"bar": 1, "quux": 2}, + "valid": false + }, + { + "description": "missing both dependencies", + "data": {"quux": 1}, + "valid": false + } + ] + }, + { + "description": "multiple dependencies subschema", + "schema": { + "dependencies": { + "bar": { + "properties": { + "foo": {"type": "integer"}, + "bar": {"type": "integer"} + } + } + } + }, + "tests": [ + { + "description": "valid", + "data": {"foo": 1, "bar": 2}, + "valid": true + }, + { + "description": "no dependency", + "data": {"foo": "quux"}, + "valid": true + }, + { + "description": "wrong type", + "data": {"foo": "quux", "bar": 2}, + "valid": false + }, + { + "description": "wrong type other", + "data": {"foo": 2, "bar": "quux"}, + "valid": false + }, + { + "description": "wrong type both", + "data": {"foo": "quux", "bar": "quux"}, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/enum.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/enum.json new file mode 100644 index 00000000000..f124436a7d9 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/enum.json @@ -0,0 +1,72 @@ +[ + { + "description": "simple enum validation", + "schema": {"enum": [1, 2, 3]}, + "tests": [ + { + "description": "one of the enum is valid", + "data": 1, + "valid": true + }, + { + "description": "something else is invalid", + "data": 4, + "valid": false + } + ] + }, + { + "description": "heterogeneous enum validation", + "schema": {"enum": [6, "foo", [], true, {"foo": 12}]}, + "tests": [ + { + "description": "one of the enum is valid", + "data": [], + "valid": true + }, + { + "description": "something else is invalid", + "data": null, + "valid": false + }, + { + "description": "objects are deep compared", + "data": {"foo": false}, + "valid": false + } + ] + }, + { + "description": "enums in properties", + "schema": { + "type":"object", + "properties": { + "foo": {"enum":["foo"]}, + "bar": {"enum":["bar"]} + }, + "required": ["bar"] + }, + "tests": [ + { + "description": "both properties are valid", + "data": {"foo":"foo", "bar":"bar"}, + "valid": true + }, + { + "description": "missing optional property is valid", + "data": {"bar":"bar"}, + "valid": true + }, + { + "description": "missing required property is invalid", + "data": {"foo":"foo"}, + "valid": false + }, + { + "description": "missing all properties is invalid", + "data": {}, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/items.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/items.json new file mode 100644 index 00000000000..f5e18a13848 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/items.json @@ -0,0 +1,46 @@ +[ + { + "description": "a schema given for items", + "schema": { + "items": {"type": "integer"} + }, + "tests": [ + { + "description": "valid items", + "data": [ 1, 2, 3 ], + "valid": true + }, + { + "description": "wrong type of items", + "data": [1, "x"], + "valid": false + }, + { + "description": "ignores non-arrays", + "data": {"foo" : "bar"}, + "valid": true + } + ] + }, + { + "description": "an array of schemas for items", + "schema": { + "items": [ + {"type": "integer"}, + {"type": "string"} + ] + }, + "tests": [ + { + "description": "correct types", + "data": [ 1, "foo" ], + "valid": true + }, + { + "description": "wrong types", + "data": [ "foo", 1 ], + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxItems.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxItems.json new file mode 100644 index 00000000000..3b53a6b371a --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxItems.json @@ -0,0 +1,28 @@ +[ + { + "description": "maxItems validation", + "schema": {"maxItems": 2}, + "tests": [ + { + "description": "shorter is valid", + "data": [1], + "valid": true + }, + { + "description": "exact length is valid", + "data": [1, 2], + "valid": true + }, + { + "description": "too long is invalid", + "data": [1, 2, 3], + "valid": false + }, + { + "description": "ignores non-arrays", + "data": "foobar", + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxLength.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxLength.json new file mode 100644 index 00000000000..811d35b253c --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxLength.json @@ -0,0 +1,33 @@ +[ + { + "description": "maxLength validation", + "schema": {"maxLength": 2}, + "tests": [ + { + "description": "shorter is valid", + "data": "f", + "valid": true + }, + { + "description": "exact length is valid", + "data": "fo", + "valid": true + }, + { + "description": "too long is invalid", + "data": "foo", + "valid": false + }, + { + "description": "ignores non-strings", + "data": 100, + "valid": true + }, + { + "description": "two supplementary Unicode code points is long enough", + "data": "\uD83D\uDCA9\uD83D\uDCA9", + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxProperties.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxProperties.json new file mode 100644 index 00000000000..d282446ad69 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maxProperties.json @@ -0,0 +1,28 @@ +[ + { + "description": "maxProperties validation", + "schema": {"maxProperties": 2}, + "tests": [ + { + "description": "shorter is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "exact length is valid", + "data": {"foo": 1, "bar": 2}, + "valid": true + }, + { + "description": "too long is invalid", + "data": {"foo": 1, "bar": 2, "baz": 3}, + "valid": false + }, + { + "description": "ignores non-objects", + "data": "foobar", + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maximum.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maximum.json new file mode 100644 index 00000000000..86c7b89c9a9 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/maximum.json @@ -0,0 +1,42 @@ +[ + { + "description": "maximum validation", + "schema": {"maximum": 3.0}, + "tests": [ + { + "description": "below the maximum is valid", + "data": 2.6, + "valid": true + }, + { + "description": "above the maximum is invalid", + "data": 3.5, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "x", + "valid": true + } + ] + }, + { + "description": "exclusiveMaximum validation", + "schema": { + "maximum": 3.0, + "exclusiveMaximum": true + }, + "tests": [ + { + "description": "below the maximum is still valid", + "data": 2.2, + "valid": true + }, + { + "description": "boundary point is invalid", + "data": 3.0, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minItems.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minItems.json new file mode 100644 index 00000000000..ed5118815ee --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minItems.json @@ -0,0 +1,28 @@ +[ + { + "description": "minItems validation", + "schema": {"minItems": 1}, + "tests": [ + { + "description": "longer is valid", + "data": [1, 2], + "valid": true + }, + { + "description": "exact length is valid", + "data": [1], + "valid": true + }, + { + "description": "too short is invalid", + "data": [], + "valid": false + }, + { + "description": "ignores non-arrays", + "data": "", + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minLength.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minLength.json new file mode 100644 index 00000000000..3f09158deef --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minLength.json @@ -0,0 +1,33 @@ +[ + { + "description": "minLength validation", + "schema": {"minLength": 2}, + "tests": [ + { + "description": "longer is valid", + "data": "foo", + "valid": true + }, + { + "description": "exact length is valid", + "data": "fo", + "valid": true + }, + { + "description": "too short is invalid", + "data": "f", + "valid": false + }, + { + "description": "ignores non-strings", + "data": 1, + "valid": true + }, + { + "description": "one supplementary Unicode code point is not long enough", + "data": "\uD83D\uDCA9", + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minProperties.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minProperties.json new file mode 100644 index 00000000000..a72c7d293e6 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minProperties.json @@ -0,0 +1,28 @@ +[ + { + "description": "minProperties validation", + "schema": {"minProperties": 1}, + "tests": [ + { + "description": "longer is valid", + "data": {"foo": 1, "bar": 2}, + "valid": true + }, + { + "description": "exact length is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "too short is invalid", + "data": {}, + "valid": false + }, + { + "description": "ignores non-objects", + "data": "", + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minimum.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minimum.json new file mode 100644 index 00000000000..d5bf000bcc6 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/minimum.json @@ -0,0 +1,42 @@ +[ + { + "description": "minimum validation", + "schema": {"minimum": 1.1}, + "tests": [ + { + "description": "above the minimum is valid", + "data": 2.6, + "valid": true + }, + { + "description": "below the minimum is invalid", + "data": 0.6, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "x", + "valid": true + } + ] + }, + { + "description": "exclusiveMinimum validation", + "schema": { + "minimum": 1.1, + "exclusiveMinimum": true + }, + "tests": [ + { + "description": "above the minimum is still valid", + "data": 1.2, + "valid": true + }, + { + "description": "boundary point is invalid", + "data": 1.1, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/multipleOf.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/multipleOf.json new file mode 100644 index 00000000000..ca3b7618053 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/multipleOf.json @@ -0,0 +1,60 @@ +[ + { + "description": "by int", + "schema": {"multipleOf": 2}, + "tests": [ + { + "description": "int by int", + "data": 10, + "valid": true + }, + { + "description": "int by int fail", + "data": 7, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "by number", + "schema": {"multipleOf": 1.5}, + "tests": [ + { + "description": "zero is multiple of anything", + "data": 0, + "valid": true + }, + { + "description": "4.5 is multiple of 1.5", + "data": 4.5, + "valid": true + }, + { + "description": "35 is not multiple of 1.5", + "data": 35, + "valid": false + } + ] + }, + { + "description": "by small number", + "schema": {"multipleOf": 0.0001}, + "tests": [ + { + "description": "0.0075 is multiple of 0.0001", + "data": 0.0075, + "valid": true + }, + { + "description": "0.00751 is not multiple of 0.0001", + "data": 0.00751, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/not.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/not.json new file mode 100644 index 00000000000..cbb7f46bf8b --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/not.json @@ -0,0 +1,96 @@ +[ + { + "description": "not", + "schema": { + "not": {"type": "integer"} + }, + "tests": [ + { + "description": "allowed", + "data": "foo", + "valid": true + }, + { + "description": "disallowed", + "data": 1, + "valid": false + } + ] + }, + { + "description": "not multiple types", + "schema": { + "not": {"type": ["integer", "boolean"]} + }, + "tests": [ + { + "description": "valid", + "data": "foo", + "valid": true + }, + { + "description": "mismatch", + "data": 1, + "valid": false + }, + { + "description": "other mismatch", + "data": true, + "valid": false + } + ] + }, + { + "description": "not more complex schema", + "schema": { + "not": { + "type": "object", + "properties": { + "foo": { + "type": "string" + } + } + } + }, + "tests": [ + { + "description": "match", + "data": 1, + "valid": true + }, + { + "description": "other match", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "mismatch", + "data": {"foo": "bar"}, + "valid": false + } + ] + }, + { + "description": "forbidden property", + "schema": { + "properties": { + "foo": { + "not": {} + } + } + }, + "tests": [ + { + "description": "property present", + "data": {"foo": 1, "bar": 2}, + "valid": false + }, + { + "description": "property absent", + "data": {"bar": 1, "baz": 2}, + "valid": true + } + ] + } + +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/oneOf.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/oneOf.json new file mode 100644 index 00000000000..1eaa4e47949 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/oneOf.json @@ -0,0 +1,68 @@ +[ + { + "description": "oneOf", + "schema": { + "oneOf": [ + { + "type": "integer" + }, + { + "minimum": 2 + } + ] + }, + "tests": [ + { + "description": "first oneOf valid", + "data": 1, + "valid": true + }, + { + "description": "second oneOf valid", + "data": 2.5, + "valid": true + }, + { + "description": "both oneOf valid", + "data": 3, + "valid": false + }, + { + "description": "neither oneOf valid", + "data": 1.5, + "valid": false + } + ] + }, + { + "description": "oneOf with base schema", + "schema": { + "type": "string", + "oneOf" : [ + { + "minLength": 2 + }, + { + "maxLength": 4 + } + ] + }, + "tests": [ + { + "description": "mismatch base schema", + "data": 3, + "valid": false + }, + { + "description": "one oneOf valid", + "data": "foobar", + "valid": true + }, + { + "description": "both oneOf valid", + "data": "foo", + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/bignum.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/bignum.json new file mode 100644 index 00000000000..ccc7c17fe8d --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/bignum.json @@ -0,0 +1,107 @@ +[ + { + "description": "integer", + "schema": {"type": "integer"}, + "tests": [ + { + "description": "a bignum is an integer", + "data": 12345678910111213141516171819202122232425262728293031, + "valid": true + } + ] + }, + { + "description": "number", + "schema": {"type": "number"}, + "tests": [ + { + "description": "a bignum is a number", + "data": 98249283749234923498293171823948729348710298301928331, + "valid": true + } + ] + }, + { + "description": "integer", + "schema": {"type": "integer"}, + "tests": [ + { + "description": "a negative bignum is an integer", + "data": -12345678910111213141516171819202122232425262728293031, + "valid": true + } + ] + }, + { + "description": "number", + "schema": {"type": "number"}, + "tests": [ + { + "description": "a negative bignum is a number", + "data": -98249283749234923498293171823948729348710298301928331, + "valid": true + } + ] + }, + { + "description": "string", + "schema": {"type": "string"}, + "tests": [ + { + "description": "a bignum is not a string", + "data": 98249283749234923498293171823948729348710298301928331, + "valid": false + } + ] + }, + { + "description": "integer comparison", + "schema": {"maximum": 18446744073709551615}, + "tests": [ + { + "description": "comparison works for high numbers", + "data": 18446744073709551600, + "valid": true + } + ] + }, + { + "description": "float comparison with high precision", + "schema": { + "maximum": 972783798187987123879878123.18878137, + "exclusiveMaximum": true + }, + "tests": [ + { + "description": "comparison works for high numbers", + "data": 972783798187987123879878123.188781371, + "valid": false + } + ] + }, + { + "description": "integer comparison", + "schema": {"minimum": -18446744073709551615}, + "tests": [ + { + "description": "comparison works for very negative numbers", + "data": -18446744073709551600, + "valid": true + } + ] + }, + { + "description": "float comparison with high precision on negative numbers", + "schema": { + "minimum": -972783798187987123879878123.18878137, + "exclusiveMinimum": true + }, + "tests": [ + { + "description": "comparison works for very negative numbers", + "data": -972783798187987123879878123.188781371, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/format.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/format.json new file mode 100644 index 00000000000..aacfd119843 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/format.json @@ -0,0 +1,148 @@ +[ + { + "description": "validation of date-time strings", + "schema": {"format": "date-time"}, + "tests": [ + { + "description": "a valid date-time string", + "data": "1963-06-19T08:30:06.283185Z", + "valid": true + }, + { + "description": "an invalid date-time string", + "data": "06/19/1963 08:30:06 PST", + "valid": false + }, + { + "description": "only RFC3339 not all of ISO 8601 are valid", + "data": "2013-350T01:01:01", + "valid": false + } + ] + }, + { + "description": "validation of URIs", + "schema": {"format": "uri"}, + "tests": [ + { + "description": "a valid URI", + "data": "http://foo.bar/?baz=qux#quux", + "valid": true + }, + { + "description": "a valid protocol-relative URI", + "data": "//foo.bar/?baz=qux#quux", + "valid": true + }, + { + "description": "an invalid URI", + "data": "\\\\WINDOWS\\fileshare", + "valid": false + }, + { + "description": "an invalid URI though valid URI reference", + "data": "abc", + "valid": false + } + ] + }, + { + "description": "validation of e-mail addresses", + "schema": {"format": "email"}, + "tests": [ + { + "description": "a valid e-mail address", + "data": "joe.bloggs@example.com", + "valid": true + }, + { + "description": "an invalid e-mail address", + "data": "2962", + "valid": false + } + ] + }, + { + "description": "validation of IP addresses", + "schema": {"format": "ipv4"}, + "tests": [ + { + "description": "a valid IP address", + "data": "192.168.0.1", + "valid": true + }, + { + "description": "an IP address with too many components", + "data": "127.0.0.0.1", + "valid": false + }, + { + "description": "an IP address with out-of-range values", + "data": "256.256.256.256", + "valid": false + }, + { + "description": "an IP address without 4 components", + "data": "127.0", + "valid": false + }, + { + "description": "an IP address as an integer", + "data": "0x7f000001", + "valid": false + } + ] + }, + { + "description": "validation of IPv6 addresses", + "schema": {"format": "ipv6"}, + "tests": [ + { + "description": "a valid IPv6 address", + "data": "::1", + "valid": true + }, + { + "description": "an IPv6 address with out-of-range values", + "data": "12345::", + "valid": false + }, + { + "description": "an IPv6 address with too many components", + "data": "1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1", + "valid": false + }, + { + "description": "an IPv6 address containing illegal characters", + "data": "::laptop", + "valid": false + } + ] + }, + { + "description": "validation of host names", + "schema": {"format": "hostname"}, + "tests": [ + { + "description": "a valid host name", + "data": "www.example.com", + "valid": true + }, + { + "description": "a host name starting with an illegal character", + "data": "-a-host-name-that-starts-with--", + "valid": false + }, + { + "description": "a host name containing illegal characters", + "data": "not_a_valid_host_name", + "valid": false + }, + { + "description": "a host name with a component too long", + "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component", + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/zeroTerminatedFloats.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/zeroTerminatedFloats.json new file mode 100644 index 00000000000..9b50ea27769 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/optional/zeroTerminatedFloats.json @@ -0,0 +1,15 @@ +[ + { + "description": "some languages do not distinguish between different types of numeric value", + "schema": { + "type": "integer" + }, + "tests": [ + { + "description": "a float is not an integer even without fractional part", + "data": 1.0, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/pattern.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/pattern.json new file mode 100644 index 00000000000..25e72997314 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/pattern.json @@ -0,0 +1,34 @@ +[ + { + "description": "pattern validation", + "schema": {"pattern": "^a*$"}, + "tests": [ + { + "description": "a matching pattern is valid", + "data": "aaa", + "valid": true + }, + { + "description": "a non-matching pattern is invalid", + "data": "abc", + "valid": false + }, + { + "description": "ignores non-strings", + "data": true, + "valid": true + } + ] + }, + { + "description": "pattern is not anchored", + "schema": {"pattern": "a+"}, + "tests": [ + { + "description": "matches a substring", + "data": "xxaayy", + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/patternProperties.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/patternProperties.json new file mode 100644 index 00000000000..18586e5daba --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/patternProperties.json @@ -0,0 +1,110 @@ +[ + { + "description": + "patternProperties validates properties matching a regex", + "schema": { + "patternProperties": { + "f.*o": {"type": "integer"} + } + }, + "tests": [ + { + "description": "a single valid match is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "multiple valid matches is valid", + "data": {"foo": 1, "foooooo" : 2}, + "valid": true + }, + { + "description": "a single invalid match is invalid", + "data": {"foo": "bar", "fooooo": 2}, + "valid": false + }, + { + "description": "multiple invalid matches is invalid", + "data": {"foo": "bar", "foooooo" : "baz"}, + "valid": false + }, + { + "description": "ignores non-objects", + "data": 12, + "valid": true + } + ] + }, + { + "description": "multiple simultaneous patternProperties are validated", + "schema": { + "patternProperties": { + "a*": {"type": "integer"}, + "aaa*": {"maximum": 20} + } + }, + "tests": [ + { + "description": "a single valid match is valid", + "data": {"a": 21}, + "valid": true + }, + { + "description": "a simultaneous match is valid", + "data": {"aaaa": 18}, + "valid": true + }, + { + "description": "multiple matches is valid", + "data": {"a": 21, "aaaa": 18}, + "valid": true + }, + { + "description": "an invalid due to one is invalid", + "data": {"a": "bar"}, + "valid": false + }, + { + "description": "an invalid due to the other is invalid", + "data": {"aaaa": 31}, + "valid": false + }, + { + "description": "an invalid due to both is invalid", + "data": {"aaa": "foo", "aaaa": 31}, + "valid": false + } + ] + }, + { + "description": "regexes are not anchored by default and are case sensitive", + "schema": { + "patternProperties": { + "[0-9]{2,}": { "type": "boolean" }, + "X_": { "type": "string" } + } + }, + "tests": [ + { + "description": "non recognized members are ignored", + "data": { "answer 1": "42" }, + "valid": true + }, + { + "description": "recognized members are accounted for", + "data": { "a31b": null }, + "valid": false + }, + { + "description": "regexes are case sensitive", + "data": { "a_x_3": 3 }, + "valid": true + }, + { + "description": "regexes are case sensitive, 2", + "data": { "a_X_3": 3 }, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/properties.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/properties.json new file mode 100644 index 00000000000..cd1644dcd91 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/properties.json @@ -0,0 +1,92 @@ +[ + { + "description": "object properties validation", + "schema": { + "properties": { + "foo": {"type": "integer"}, + "bar": {"type": "string"} + } + }, + "tests": [ + { + "description": "both properties present and valid is valid", + "data": {"foo": 1, "bar": "baz"}, + "valid": true + }, + { + "description": "one property invalid is invalid", + "data": {"foo": 1, "bar": {}}, + "valid": false + }, + { + "description": "both properties invalid is invalid", + "data": {"foo": [], "bar": {}}, + "valid": false + }, + { + "description": "doesn't invalidate other properties", + "data": {"quux": []}, + "valid": true + }, + { + "description": "ignores non-objects", + "data": [], + "valid": true + } + ] + }, + { + "description": + "properties, patternProperties, additionalProperties interaction", + "schema": { + "properties": { + "foo": {"type": "array", "maxItems": 3}, + "bar": {"type": "array"} + }, + "patternProperties": {"f.o": {"minItems": 2}}, + "additionalProperties": {"type": "integer"} + }, + "tests": [ + { + "description": "property validates property", + "data": {"foo": [1, 2]}, + "valid": true + }, + { + "description": "property invalidates property", + "data": {"foo": [1, 2, 3, 4]}, + "valid": false + }, + { + "description": "patternProperty invalidates property", + "data": {"foo": []}, + "valid": false + }, + { + "description": "patternProperty validates nonproperty", + "data": {"fxo": [1, 2]}, + "valid": true + }, + { + "description": "patternProperty invalidates nonproperty", + "data": {"fxo": []}, + "valid": false + }, + { + "description": "additionalProperty ignores property", + "data": {"bar": []}, + "valid": true + }, + { + "description": "additionalProperty validates others", + "data": {"quux": 3}, + "valid": true + }, + { + "description": "additionalProperty invalidates others", + "data": {"quux": "foo"}, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/ref.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/ref.json new file mode 100644 index 00000000000..7e805522492 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/ref.json @@ -0,0 +1,159 @@ +[ + { + "description": "root pointer ref", + "schema": { + "properties": { + "foo": {"$ref": "#"} + }, + "additionalProperties": false + }, + "tests": [ + { + "description": "match", + "data": {"foo": false}, + "valid": true + }, + { + "description": "recursive match", + "data": {"foo": {"foo": false}}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": false}, + "valid": false + }, + { + "description": "recursive mismatch", + "data": {"foo": {"bar": false}}, + "valid": false + } + ] + }, + { + "description": "relative pointer ref to object", + "schema": { + "properties": { + "foo": {"type": "integer"}, + "bar": {"$ref": "#/properties/foo"} + } + }, + "tests": [ + { + "description": "match", + "data": {"bar": 3}, + "valid": true + }, + { + "description": "mismatch", + "data": {"bar": true}, + "valid": false + } + ] + }, + { + "description": "relative pointer ref to array", + "schema": { + "items": [ + {"type": "integer"}, + {"$ref": "#/items/0"} + ] + }, + "tests": [ + { + "description": "match array", + "data": [1, 2], + "valid": true + }, + { + "description": "mismatch array", + "data": [1, "foo"], + "valid": false + } + ] + }, + { + "description": "escaped pointer ref", + "schema": { + "tilda~field": {"type": "integer"}, + "slash/field": {"type": "integer"}, + "percent%field": {"type": "integer"}, + "properties": { + "tilda": {"$ref": "#/tilda~0field"}, + "slash": {"$ref": "#/slash~1field"}, + "percent": {"$ref": "#/percent%25field"} + } + }, + "tests": [ + { + "description": "slash invalid", + "data": {"slash": "aoeu"}, + "valid": false + }, + { + "description": "tilda invalid", + "data": {"tilda": "aoeu"}, + "valid": false + }, + { + "description": "percent invalid", + "data": {"percent": "aoeu"}, + "valid": false + }, + { + "description": "slash valid", + "data": {"slash": 123}, + "valid": true + }, + { + "description": "tilda valid", + "data": {"tilda": 123}, + "valid": true + }, + { + "description": "percent valid", + "data": {"percent": 123}, + "valid": true + } + ] + }, + { + "description": "nested refs", + "schema": { + "definitions": { + "a": {"type": "integer"}, + "b": {"$ref": "#/definitions/a"}, + "c": {"$ref": "#/definitions/b"} + }, + "$ref": "#/definitions/c" + }, + "tests": [ + { + "description": "nested ref valid", + "data": 5, + "valid": true + }, + { + "description": "nested ref invalid", + "data": "a", + "valid": false + } + ] + }, + { + "description": "remote ref, containing refs itself", + "schema": {"$ref": "http://json-schema.org/draft-04/schema#"}, + "tests": [ + { + "description": "remote ref valid", + "data": {"minLength": 1}, + "valid": true + }, + { + "description": "remote ref invalid", + "data": {"minLength": -1}, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/refRemote.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/refRemote.json new file mode 100644 index 00000000000..4ca804732c9 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/refRemote.json @@ -0,0 +1,74 @@ +[ + { + "description": "remote ref", + "schema": {"$ref": "http://localhost:1234/integer.json"}, + "tests": [ + { + "description": "remote ref valid", + "data": 1, + "valid": true + }, + { + "description": "remote ref invalid", + "data": "a", + "valid": false + } + ] + }, + { + "description": "fragment within remote ref", + "schema": {"$ref": "http://localhost:1234/subSchemas.json#/integer"}, + "tests": [ + { + "description": "remote fragment valid", + "data": 1, + "valid": true + }, + { + "description": "remote fragment invalid", + "data": "a", + "valid": false + } + ] + }, + { + "description": "ref within remote ref", + "schema": { + "$ref": "http://localhost:1234/subSchemas.json#/refToInteger" + }, + "tests": [ + { + "description": "ref within ref valid", + "data": 1, + "valid": true + }, + { + "description": "ref within ref invalid", + "data": "a", + "valid": false + } + ] + }, + { + "description": "change resolution scope", + "schema": { + "id": "http://localhost:1234/", + "items": { + "id": "folder/", + "items": {"$ref": "folderInteger.json"} + } + }, + "tests": [ + { + "description": "changed scope ref valid", + "data": [[1]], + "valid": true + }, + { + "description": "changed scope ref invalid", + "data": [["a"]], + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/required.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/required.json new file mode 100644 index 00000000000..612f73f3472 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/required.json @@ -0,0 +1,39 @@ +[ + { + "description": "required validation", + "schema": { + "properties": { + "foo": {}, + "bar": {} + }, + "required": ["foo"] + }, + "tests": [ + { + "description": "present required property is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "non-present required property is invalid", + "data": {"bar": 1}, + "valid": false + } + ] + }, + { + "description": "required default validation", + "schema": { + "properties": { + "foo": {} + } + }, + "tests": [ + { + "description": "not required by default", + "data": {}, + "valid": true + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/type.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/type.json new file mode 100644 index 00000000000..db42a44d3fa --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/type.json @@ -0,0 +1,330 @@ +[ + { + "description": "integer type matches integers", + "schema": {"type": "integer"}, + "tests": [ + { + "description": "an integer is an integer", + "data": 1, + "valid": true + }, + { + "description": "a float is not an integer", + "data": 1.1, + "valid": false + }, + { + "description": "a string is not an integer", + "data": "foo", + "valid": false + }, + { + "description": "an object is not an integer", + "data": {}, + "valid": false + }, + { + "description": "an array is not an integer", + "data": [], + "valid": false + }, + { + "description": "a boolean is not an integer", + "data": true, + "valid": false + }, + { + "description": "null is not an integer", + "data": null, + "valid": false + } + ] + }, + { + "description": "number type matches numbers", + "schema": {"type": "number"}, + "tests": [ + { + "description": "an integer is a number", + "data": 1, + "valid": true + }, + { + "description": "a float is a number", + "data": 1.1, + "valid": true + }, + { + "description": "a string is not a number", + "data": "foo", + "valid": false + }, + { + "description": "an object is not a number", + "data": {}, + "valid": false + }, + { + "description": "an array is not a number", + "data": [], + "valid": false + }, + { + "description": "a boolean is not a number", + "data": true, + "valid": false + }, + { + "description": "null is not a number", + "data": null, + "valid": false + } + ] + }, + { + "description": "string type matches strings", + "schema": {"type": "string"}, + "tests": [ + { + "description": "1 is not a string", + "data": 1, + "valid": false + }, + { + "description": "a float is not a string", + "data": 1.1, + "valid": false + }, + { + "description": "a string is a string", + "data": "foo", + "valid": true + }, + { + "description": "an object is not a string", + "data": {}, + "valid": false + }, + { + "description": "an array is not a string", + "data": [], + "valid": false + }, + { + "description": "a boolean is not a string", + "data": true, + "valid": false + }, + { + "description": "null is not a string", + "data": null, + "valid": false + } + ] + }, + { + "description": "object type matches objects", + "schema": {"type": "object"}, + "tests": [ + { + "description": "an integer is not an object", + "data": 1, + "valid": false + }, + { + "description": "a float is not an object", + "data": 1.1, + "valid": false + }, + { + "description": "a string is not an object", + "data": "foo", + "valid": false + }, + { + "description": "an object is an object", + "data": {}, + "valid": true + }, + { + "description": "an array is not an object", + "data": [], + "valid": false + }, + { + "description": "a boolean is not an object", + "data": true, + "valid": false + }, + { + "description": "null is not an object", + "data": null, + "valid": false + } + ] + }, + { + "description": "array type matches arrays", + "schema": {"type": "array"}, + "tests": [ + { + "description": "an integer is not an array", + "data": 1, + "valid": false + }, + { + "description": "a float is not an array", + "data": 1.1, + "valid": false + }, + { + "description": "a string is not an array", + "data": "foo", + "valid": false + }, + { + "description": "an object is not an array", + "data": {}, + "valid": false + }, + { + "description": "an array is an array", + "data": [], + "valid": true + }, + { + "description": "a boolean is not an array", + "data": true, + "valid": false + }, + { + "description": "null is not an array", + "data": null, + "valid": false + } + ] + }, + { + "description": "boolean type matches booleans", + "schema": {"type": "boolean"}, + "tests": [ + { + "description": "an integer is not a boolean", + "data": 1, + "valid": false + }, + { + "description": "a float is not a boolean", + "data": 1.1, + "valid": false + }, + { + "description": "a string is not a boolean", + "data": "foo", + "valid": false + }, + { + "description": "an object is not a boolean", + "data": {}, + "valid": false + }, + { + "description": "an array is not a boolean", + "data": [], + "valid": false + }, + { + "description": "a boolean is a boolean", + "data": true, + "valid": true + }, + { + "description": "null is not a boolean", + "data": null, + "valid": false + } + ] + }, + { + "description": "null type matches only the null object", + "schema": {"type": "null"}, + "tests": [ + { + "description": "an integer is not null", + "data": 1, + "valid": false + }, + { + "description": "a float is not null", + "data": 1.1, + "valid": false + }, + { + "description": "a string is not null", + "data": "foo", + "valid": false + }, + { + "description": "an object is not null", + "data": {}, + "valid": false + }, + { + "description": "an array is not null", + "data": [], + "valid": false + }, + { + "description": "a boolean is not null", + "data": true, + "valid": false + }, + { + "description": "null is null", + "data": null, + "valid": true + } + ] + }, + { + "description": "multiple types can be specified in an array", + "schema": {"type": ["integer", "string"]}, + "tests": [ + { + "description": "an integer is valid", + "data": 1, + "valid": true + }, + { + "description": "a string is valid", + "data": "foo", + "valid": true + }, + { + "description": "a float is invalid", + "data": 1.1, + "valid": false + }, + { + "description": "an object is invalid", + "data": {}, + "valid": false + }, + { + "description": "an array is invalid", + "data": [], + "valid": false + }, + { + "description": "a boolean is invalid", + "data": true, + "valid": false + }, + { + "description": "null is invalid", + "data": null, + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tests/draft4/uniqueItems.json b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/uniqueItems.json new file mode 100644 index 00000000000..c1f4ab99c9a --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tests/draft4/uniqueItems.json @@ -0,0 +1,79 @@ +[ + { + "description": "uniqueItems validation", + "schema": {"uniqueItems": true}, + "tests": [ + { + "description": "unique array of integers is valid", + "data": [1, 2], + "valid": true + }, + { + "description": "non-unique array of integers is invalid", + "data": [1, 1], + "valid": false + }, + { + "description": "numbers are unique if mathematically unequal", + "data": [1.0, 1.00, 1], + "valid": false + }, + { + "description": "unique array of objects is valid", + "data": [{"foo": "bar"}, {"foo": "baz"}], + "valid": true + }, + { + "description": "non-unique array of objects is invalid", + "data": [{"foo": "bar"}, {"foo": "bar"}], + "valid": false + }, + { + "description": "unique array of nested objects is valid", + "data": [ + {"foo": {"bar" : {"baz" : true}}}, + {"foo": {"bar" : {"baz" : false}}} + ], + "valid": true + }, + { + "description": "non-unique array of nested objects is invalid", + "data": [ + {"foo": {"bar" : {"baz" : true}}}, + {"foo": {"bar" : {"baz" : true}}} + ], + "valid": false + }, + { + "description": "unique array of arrays is valid", + "data": [["foo"], ["bar"]], + "valid": true + }, + { + "description": "non-unique array of arrays is invalid", + "data": [["foo"], ["foo"]], + "valid": false + }, + { + "description": "1 and true are unique", + "data": [1, true], + "valid": true + }, + { + "description": "0 and false are unique", + "data": [0, false], + "valid": true + }, + { + "description": "unique heterogeneous types are valid", + "data": [{}, [1], true, null, 1], + "valid": true + }, + { + "description": "non-unique heterogeneous types are invalid", + "data": [{}, [1], true, null, {}, 1], + "valid": false + } + ] + } +] diff --git a/3rdparty/rapidjson/bin/jsonschema/tox.ini b/3rdparty/rapidjson/bin/jsonschema/tox.ini new file mode 100644 index 00000000000..5301222a840 --- /dev/null +++ b/3rdparty/rapidjson/bin/jsonschema/tox.ini @@ -0,0 +1,8 @@ +[tox] +minversion = 1.6 +envlist = py27 +skipsdist = True + +[testenv] +deps = jsonschema +commands = {envpython} bin/jsonschema_suite check diff --git a/3rdparty/rapidjson/bin/types/booleans.json b/3rdparty/rapidjson/bin/types/booleans.json new file mode 100644 index 00000000000..2dcbb5fe876 --- /dev/null +++ b/3rdparty/rapidjson/bin/types/booleans.json @@ -0,0 +1,102 @@ +[ + true, + true, + false, + false, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false, + false, + true, + false, + false, + true, + true, + false, + true, + true, + true, + false, + false, + false, + true, + false, + true, + false, + false, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + false, + true, + true, + false, + true, + true, + false, + true, + false, + true, + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + true, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + true, + true, + false, + false, + true, + false +] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/types/floats.json b/3rdparty/rapidjson/bin/types/floats.json new file mode 100644 index 00000000000..12b94a11dc4 --- /dev/null +++ b/3rdparty/rapidjson/bin/types/floats.json @@ -0,0 +1,102 @@ +[ + 135.747111636, + 123.377054008, + 140.527504552, + -72.299143906, + -23.851678949, + 73.586193519, + -158.299382442, + 177.477876032, + 32.268518982, + -139.560009969, + 115.203105183, + -106.025823607, + 167.224138231, + 103.378383732, + -97.498486285, + 18.184723416, + 69.137075711, + 33.849002681, + -120.185228215, + -20.841408615, + -172.659492727, + -2.691464061, + 22.426164066, + -98.416909437, + -31.603082708, + -85.072296561, + 108.620987395, + -43.127078238, + -126.473562057, + -158.595489097, + -57.890678254, + -13.254016573, + -85.024504709, + 171.663552644, + -146.495558248, + -10.606748276, + -118.786969354, + 153.352057804, + -45.215545083, + 37.038725288, + 106.344071897, + -64.607402031, + 85.148030911, + 28.897784566, + 39.51082061, + 20.450382102, + -113.174943618, + 71.60785784, + -168.202648062, + -157.338200017, + 10.879588527, + -114.261694831, + -5.622927072, + -173.330830616, + -29.47002003, + -39.829034201, + 50.031545162, + 82.815735508, + -119.188760828, + -48.455928081, + 163.964263034, + 46.30378861, + -26.248889762, + -47.354615322, + 155.388677633, + -166.710356904, + 42.987233558, + 144.275297374, + 37.394383186, + -122.550388725, + 177.469945914, + 101.104677413, + 109.429869885, + -104.919625624, + 147.522756541, + -81.294703727, + 122.744731363, + 81.803603684, + 26.321556167, + 147.045441354, + 147.256895816, + -174.211095908, + 52.518769316, + -78.58250334, + -173.356685435, + -107.728209264, + -69.982325771, + -113.776095893, + -35.785267074, + -105.748545976, + -30.206523864, + -76.185311723, + -126.400112781, + -26.864958639, + 56.840053629, + 93.781553535, + -116.002949803, + -46.617140948, + 176.846840093, + -144.24821335 +] diff --git a/3rdparty/rapidjson/bin/types/guids.json b/3rdparty/rapidjson/bin/types/guids.json new file mode 100644 index 00000000000..9d7f5dbc8f9 --- /dev/null +++ b/3rdparty/rapidjson/bin/types/guids.json @@ -0,0 +1,102 @@ +[ + "d35bf0d4-8d8f-4e17-a5c3-ad9bfd675266", + "db402774-eeb6-463b-9986-c458c44d8b5a", + "2a2e4101-b5f2-40b8-8750-e03f01661e60", + "76787cfa-f4eb-4d62-aaad-e1d588d00ad5", + "fd73894b-b500-4a7c-888c-06b5bd9cec65", + "cce1862a-cf31-4ef2-9e23-f1d23b4e6163", + "00a98bb0-2b6e-4368-8512-71c21aa87db7", + "ab9a8d69-cec7-4550-bd35-3ed678e22782", + "f18b48e1-5114-4fbe-9652-579e8d66950e", + "4efe3baa-7ac5-4d6a-a839-6b9cfe825764", + "b4aec119-5b0a-434c-b388-109816c482a5", + "e0ef0cbb-127a-4a28-9831-5741b4295275", + "d50286a5-cb7b-4c9e-be99-f214439bae8c", + "a981094c-f1ac-42ed-a9fa-86404c7210ff", + "2a34ee57-5815-4829-b77b-eeebaa8fe340", + "a0530d44-48f8-4eff-b9ea-8810c4308351", + "c6f91509-83e1-4ea1-9680-e667fbfd56ee", + "cab11402-dcdd-4454-b190-6da124947395", + "283d159c-2b18-4856-b4c7-5059252eaa15", + "146157c6-72a8-4051-9991-cb6ea6743d81", + "aef6f269-7306-4bd2-83f7-6d5605b5dc9a", + "37fe6027-d638-4017-80a9-e7b0567b278e", + "5003d731-33fb-4159-af61-d76348a44079", + "e0e06979-5f80-4713-9fe0-8a4d60dc89f8", + "7e85bdc3-0345-4cb6-9398-ccab06e79976", + "f2ebf5af-6568-4ffe-a46d-403863fd4b66", + "e0b5bb1c-b4dd-4535-9a9e-3c73f1167d46", + "c852d20b-6bcb-4b12-bd57-308296c64c5a", + "7ac3ae82-1818-49cd-a8a4-5ac77dfafd46", + "138004a9-76e2-4ad7-bd42-e74dabdbb803", + "ab25b5be-96be-45b0-b765-947b40ec36a6", + "08404734-fd57-499e-a4cf-71e9ec782ede", + "8dfdeb16-248b-4a21-bf89-2e22b11a4101", + "a0e44ef0-3b09-41e8-ad5d-ed8e6a1a2a67", + "a7981e49-188d-414a-9779-b1ad91e599d1", + "329186c0-bf27-4208-baf7-c0a0a5a2d5b7", + "cb5f3381-d33e-4b30-b1a9-f482623cad33", + "15031262-ca73-4e3c-bd0a-fcf89bdf0caf", + "6d7333d1-2e8c-4d78-bfde-5be47e70eb13", + "acaa160c-670a-4e8f-ac45-49416e77d5f9", + "228f87eb-cde4-4106-808b-2dbf3c7b6d2e", + "2ff830a3-5445-4d8e-b161-bddd30666697", + "f488bedd-ff6e-4108-b9a7-07f6da62f476", + "2e12b846-0a34-478e-adf7-a438493803e6", + "6686b8ef-7446-4d86-bd8c-df24119e3bfe", + "e474a5c5-5793-4d41-b4ab-5423acc56ef1", + "ac046573-e718-44dc-a0dc-9037eeaba6a9", + "6b0e9099-cf53-4d5a-8a71-977528628fcf", + "d51a3f22-0ff9-4087-ba9b-fcee2a2d8ade", + "bdc01286-3511-4d22-bfb8-76d01203d366", + "ca44eb84-17ff-4f27-8f1e-1bd25f4e8725", + "4e9a8c2f-be0b-4913-92d2-c801b9a50d04", + "7685d231-dadd-4041-9165-898397438ab7", + "86f0bf26-d66a-44d8-99f5-d6768addae3b", + "2ca1167c-72ba-45a0-aa42-faf033db0d0b", + "199a1182-ea55-49ff-ba51-71c29cdd0aac", + "be6a4dd2-c821-4aa0-8b83-d64d6644b5b2", + "4c5f4781-7f80-4daa-9c20-76b183000514", + "513b31bd-54fb-4d12-a427-42a7c13ff8e1", + "8e211bcb-d76c-4012-83ad-74dd7d23b687", + "44d5807e-0501-4f66-8779-e244d4fdca0a", + "db8cd555-0563-4b7b-b00c-eada300a7065", + "cb14d0c9-46cc-4797-bd3a-752b05629f07", + "4f68b3ef-ac9b-47a0-b6d7-57f398a5c6a5", + "77221aae-1bcf-471c-be45-7f31f733f9d6", + "42a7cac8-9e80-4c45-8c71-511d863c98ea", + "f9018d22-b82c-468c-bdb5-8864d5964801", + "75f4e9b8-62a2-4f21-ad8a-e19eff0419bc", + "9b7385c8-8653-4184-951c-b0ac1b36b42e", + "571018aa-ffbf-4b42-a16d-07b57a7f5f0e", + "35de4a2f-6bf1-45aa-b820-2a27ea833e44", + "0b8edb20-3bb4-4cb4-b089-31957466dbab", + "97da4778-9a7b-4140-a545-968148c81fb7", + "969f326c-8f2a-47c5-b41c-d9c2f06c9b9d", + "ae211037-8b53-4b17-bfc8-c06fc7774409", + "12c5c3c4-0bd5-45d3-bc1d-d04a3c65d3e6", + "ec02024f-ce43-4dd3-8169-a59f7baee043", + "5b6afe77-ce48-47ca-90a0-25cd10ca5ffd", + "2e3a61d4-6b8f-4d2f-ba86-878b4012efd8", + "19a88a67-a5d3-4647-898f-1cde07bce040", + "6db6f420-b5c8-48b9-bbb2-8864fe6fed65", + "5a45dbde-7b53-4f6b-b864-e3b63be3708a", + "c878321b-8a02-4239-9981-15760c2e7d15", + "4e36687f-8bf6-4b12-b496-3a8e382d067e", + "a59a63cd-43c0-4c6e-b208-6dbca86f8176", + "303308c4-2e4a-45b5-8bf3-3e66e9ad05a1", + "8b58fdf1-43a6-4c98-9547-6361b50791af", + "a3563591-72ed-42b5-8e41-bac1d76d70cf", + "38db8c78-3739-4f6e-8313-de4138082114", + "86615bea-7e73-4daf-95da-ae6b9eee1bbb", + "35d38e3e-076e-40dd-9aa8-05be2603bd59", + "9f84c62d-b454-4ba3-8c19-a01878985cdc", + "6721bbae-d765-4a06-8289-6fe46a1bf943", + "0837796f-d0dd-4e50-9b7c-1983e6cc7c48", + "021eb7d7-e869-49b9-80c3-9dd16ce2d981", + "819c56f8-e040-475d-aad5-c6d5e98b20aa", + "3a61ef02-735e-4229-937d-b3777a3f4e1f", + "79dfab84-12e6-4ec8-bfc8-460ae71e4eca", + "a106fabf-e149-476c-8053-b62388b6eb57", + "9a3900a5-bfb4-4de0-baa5-253a8bd0b634" +] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/types/integers.json b/3rdparty/rapidjson/bin/types/integers.json new file mode 100644 index 00000000000..5dd05e097a4 --- /dev/null +++ b/3rdparty/rapidjson/bin/types/integers.json @@ -0,0 +1,102 @@ +[ + 8125686, + 8958709, + 5976222, + 1889524, + 7968493, + 1357486, + 118415, + 7081097, + 4635968, + 7555332, + 2270233, + 3428352, + 8699968, + 2087333, + 7861337, + 7554440, + 2017031, + 7981692, + 6060687, + 1877715, + 3297474, + 8373177, + 6158629, + 7853641, + 3004441, + 9650406, + 2695251, + 1180761, + 4988426, + 6043805, + 8063373, + 6103218, + 2848339, + 8188690, + 9235573, + 5949816, + 6116081, + 6471138, + 3354531, + 4787414, + 9660600, + 942529, + 7278535, + 7967399, + 554292, + 1436493, + 267319, + 2606657, + 7900601, + 4276634, + 7996757, + 8544466, + 7266469, + 3301373, + 4005350, + 6437652, + 7717672, + 7126292, + 8588394, + 2127902, + 7410190, + 1517806, + 4583602, + 3123440, + 7747613, + 5029464, + 9834390, + 3087227, + 4913822, + 7550487, + 4518144, + 5862588, + 1778599, + 9493290, + 5588455, + 3638706, + 7394293, + 4294719, + 3837830, + 6381878, + 7175866, + 8575492, + 1415229, + 1453733, + 6972404, + 9782571, + 4234063, + 7117418, + 7293130, + 8057071, + 9345285, + 7626648, + 3358911, + 4574537, + 9371826, + 7627107, + 6154093, + 5392367, + 5398105, + 6956377 +] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/types/mixed.json b/3rdparty/rapidjson/bin/types/mixed.json new file mode 100644 index 00000000000..43e9a1d7be0 --- /dev/null +++ b/3rdparty/rapidjson/bin/types/mixed.json @@ -0,0 +1,592 @@ +[ + { + "favoriteFruit": "banana", + "greeting": "Hello, Kim! You have 10 unread messages.", + "friends": [ + { + "name": "Higgins Rodriquez", + "id": 0 + }, + { + "name": "James Floyd", + "id": 1 + }, + { + "name": "Gay Stewart", + "id": 2 + } + ], + "range": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "tags": [ + "pariatur", + "ad", + "eiusmod", + "sit", + "et", + "velit", + "culpa" + ], + "longitude": -57.919246, + "latitude": -36.022812, + "registered": "Friday, March 21, 2014 9:13 PM", + "about": "Laborum nulla aliquip ullamco proident excepteur est officia ipsum. Eiusmod exercitation minim ex do labore reprehenderit aliqua minim qui excepteur reprehenderit cupidatat. Sint enim exercitation duis id consequat nisi enim magna. Commodo aliqua id ipsum sit magna enim. Veniam officia in labore fugiat veniam ea laboris ex veniam duis.\r\n", + "address": "323 Pulaski Street, Ronco, North Carolina, 7701", + "phone": "+1 (919) 438-2678", + "email": "kim.griffith@cipromox.biz", + "company": "CIPROMOX", + "name": { + "last": "Griffith", + "first": "Kim" + }, + "eyeColor": "green", + "age": 26, + "picture": "http://placehold.it/32x32", + "balance": "$1,283.55", + "isActive": false, + "guid": "10ab0392-c5e2-48a3-9473-aa725bad892d", + "index": 0, + "_id": "551b91198238a0bcf9a41133" + }, + { + "favoriteFruit": "banana", + "greeting": "Hello, Skinner! You have 9 unread messages.", + "friends": [ + { + "name": "Rhonda Justice", + "id": 0 + }, + { + "name": "Audra Castaneda", + "id": 1 + }, + { + "name": "Vicky Chavez", + "id": 2 + } + ], + "range": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "tags": [ + "dolore", + "enim", + "sit", + "non", + "exercitation", + "fugiat", + "adipisicing" + ], + "longitude": -60.291407, + "latitude": -84.619318, + "registered": "Friday, February 7, 2014 3:17 AM", + "about": "Consectetur eiusmod laboris dolore est ullamco nulla in velit quis esse Lorem. Amet aliqua sunt aute occaecat veniam officia in duis proident aliqua cupidatat mollit. Sint eu qui anim duis ut anim duis eu cillum. Cillum nostrud adipisicing tempor Lorem commodo sit in ad qui non et irure qui. Labore eu aliquip id duis eiusmod veniam.\r\n", + "address": "347 Autumn Avenue, Fidelis, Puerto Rico, 543", + "phone": "+1 (889) 457-2319", + "email": "skinner.maddox@moltonic.co.uk", + "company": "MOLTONIC", + "name": { + "last": "Maddox", + "first": "Skinner" + }, + "eyeColor": "green", + "age": 22, + "picture": "http://placehold.it/32x32", + "balance": "$3,553.10", + "isActive": false, + "guid": "cfbc2fb6-2641-4388-b06d-ec0212cfac1e", + "index": 1, + "_id": "551b91197e0abe92d6642700" + }, + { + "favoriteFruit": "strawberry", + "greeting": "Hello, Reynolds! You have 5 unread messages.", + "friends": [ + { + "name": "Brady Valdez", + "id": 0 + }, + { + "name": "Boyer Golden", + "id": 1 + }, + { + "name": "Gladys Knapp", + "id": 2 + } + ], + "range": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "tags": [ + "commodo", + "eiusmod", + "cupidatat", + "et", + "occaecat", + "proident", + "Lorem" + ], + "longitude": 140.866287, + "latitude": 1.401032, + "registered": "Monday, October 20, 2014 8:01 AM", + "about": "Deserunt elit consequat ea dolor pariatur aute consectetur et nulla ipsum ad. Laboris occaecat ipsum ad duis et esse ea ut voluptate. Ex magna consequat pariatur amet. Quis excepteur non mollit dolore cillum dolor ex esse veniam esse deserunt non occaecat veniam. Sit amet proident proident amet. Nisi est id ut ut adipisicing esse fugiat non dolor aute.\r\n", + "address": "872 Montague Terrace, Haena, Montana, 3106", + "phone": "+1 (974) 410-2655", + "email": "reynolds.sanford@combot.biz", + "company": "COMBOT", + "name": { + "last": "Sanford", + "first": "Reynolds" + }, + "eyeColor": "green", + "age": 21, + "picture": "http://placehold.it/32x32", + "balance": "$3,664.47", + "isActive": true, + "guid": "f9933a9c-c41a-412f-a18d-e727c569870b", + "index": 2, + "_id": "551b91197f170b65413a06e3" + }, + { + "favoriteFruit": "banana", + "greeting": "Hello, Neva! You have 7 unread messages.", + "friends": [ + { + "name": "Clara Cotton", + "id": 0 + }, + { + "name": "Ray Gates", + "id": 1 + }, + { + "name": "Jacobs Reese", + "id": 2 + } + ], + "range": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "tags": [ + "magna", + "labore", + "incididunt", + "velit", + "ea", + "et", + "eiusmod" + ], + "longitude": -133.058479, + "latitude": 87.803677, + "registered": "Friday, May 9, 2014 5:41 PM", + "about": "Do duis occaecat ut officia occaecat officia nostrud reprehenderit ex excepteur aute anim in reprehenderit. Cupidatat nulla eiusmod nulla non minim veniam aute nulla deserunt adipisicing consectetur veniam. Sit consequat ex laboris aliqua labore consectetur tempor proident consequat est. Fugiat quis esse culpa aliquip. Excepteur laborum aliquip sunt eu cupidatat magna eiusmod amet nisi labore aliquip. Ut consectetur esse aliquip exercitation nulla ex occaecat elit do ex eiusmod deserunt. Ex eu voluptate minim deserunt fugiat minim est occaecat ad Lorem nisi.\r\n", + "address": "480 Eagle Street, Fostoria, Oklahoma, 2614", + "phone": "+1 (983) 439-3000", + "email": "neva.barker@pushcart.us", + "company": "PUSHCART", + "name": { + "last": "Barker", + "first": "Neva" + }, + "eyeColor": "brown", + "age": 36, + "picture": "http://placehold.it/32x32", + "balance": "$3,182.24", + "isActive": true, + "guid": "52489849-78e1-4b27-8b86-e3e5ab2b7dc8", + "index": 3, + "_id": "551b9119a13061c083c878d5" + }, + { + "favoriteFruit": "banana", + "greeting": "Hello, Rodgers! You have 6 unread messages.", + "friends": [ + { + "name": "Marguerite Conway", + "id": 0 + }, + { + "name": "Margarita Cunningham", + "id": 1 + }, + { + "name": "Carmela Gallagher", + "id": 2 + } + ], + "range": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "tags": [ + "ipsum", + "magna", + "amet", + "elit", + "sit", + "occaecat", + "elit" + ], + "longitude": -125.436981, + "latitude": 19.868524, + "registered": "Tuesday, July 8, 2014 8:09 PM", + "about": "In cillum esse tempor do magna id ad excepteur ex nostrud mollit deserunt aliqua. Minim aliqua commodo commodo consectetur exercitation nulla nisi dolore aliqua in. Incididunt deserunt mollit nostrud excepteur. Ipsum fugiat anim deserunt Lorem aliquip nisi consequat eu minim in ex duis.\r\n", + "address": "989 Varanda Place, Duryea, Palau, 3972", + "phone": "+1 (968) 578-2974", + "email": "rodgers.conner@frenex.net", + "company": "FRENEX", + "name": { + "last": "Conner", + "first": "Rodgers" + }, + "eyeColor": "blue", + "age": 23, + "picture": "http://placehold.it/32x32", + "balance": "$1,665.17", + "isActive": true, + "guid": "ed3b2374-5afe-4fca-9325-8a7bbc9f81a0", + "index": 4, + "_id": "551b91197bcedb1b56a241ce" + }, + { + "favoriteFruit": "strawberry", + "greeting": "Hello, Mari! You have 10 unread messages.", + "friends": [ + { + "name": "Irwin Boyd", + "id": 0 + }, + { + "name": "Dejesus Flores", + "id": 1 + }, + { + "name": "Lane Mcmahon", + "id": 2 + } + ], + "range": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "tags": [ + "esse", + "aliquip", + "excepteur", + "dolor", + "ex", + "commodo", + "anim" + ], + "longitude": -17.038176, + "latitude": 17.154663, + "registered": "Sunday, April 6, 2014 4:46 AM", + "about": "Excepteur veniam occaecat sint nulla magna in in officia elit. Eiusmod qui dolor fugiat tempor in minim esse officia minim consequat. Lorem ullamco labore proident ipsum id pariatur fugiat consectetur anim cupidatat qui proident non ipsum.\r\n", + "address": "563 Hendrickson Street, Westwood, South Dakota, 4959", + "phone": "+1 (980) 434-3976", + "email": "mari.fleming@beadzza.org", + "company": "BEADZZA", + "name": { + "last": "Fleming", + "first": "Mari" + }, + "eyeColor": "blue", + "age": 21, + "picture": "http://placehold.it/32x32", + "balance": "$1,948.04", + "isActive": true, + "guid": "6bd02166-3b1f-4ed8-84c9-ed96cbf12abc", + "index": 5, + "_id": "551b9119b359ff6d24846f77" + }, + { + "favoriteFruit": "strawberry", + "greeting": "Hello, Maxine! You have 7 unread messages.", + "friends": [ + { + "name": "Sullivan Stark", + "id": 0 + }, + { + "name": "Underwood Mclaughlin", + "id": 1 + }, + { + "name": "Kristy Carlson", + "id": 2 + } + ], + "range": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "tags": [ + "commodo", + "ipsum", + "quis", + "non", + "est", + "mollit", + "exercitation" + ], + "longitude": -105.40635, + "latitude": 37.197993, + "registered": "Tuesday, January 20, 2015 12:30 AM", + "about": "Proident ullamco Lorem est consequat consectetur non eiusmod esse nostrud pariatur eiusmod enim exercitation eiusmod. Consequat duis elit elit minim ullamco et dolor eu minim do tempor esse consequat excepteur. Mollit dolor do voluptate nostrud quis anim cillum velit tempor eiusmod adipisicing tempor do culpa. Eu magna dolor sit amet nisi do laborum dolore nisi. Deserunt ipsum et deserunt non nisi.\r\n", + "address": "252 Boulevard Court, Brenton, Tennessee, 9444", + "phone": "+1 (950) 466-3377", + "email": "maxine.moreno@zentia.tv", + "company": "ZENTIA", + "name": { + "last": "Moreno", + "first": "Maxine" + }, + "eyeColor": "brown", + "age": 24, + "picture": "http://placehold.it/32x32", + "balance": "$1,200.24", + "isActive": false, + "guid": "ce307a37-ca1f-43f5-b637-dca2605712be", + "index": 6, + "_id": "551b91195a6164b2e35f6dc8" + }, + { + "favoriteFruit": "strawberry", + "greeting": "Hello, Helga! You have 5 unread messages.", + "friends": [ + { + "name": "Alicia Vance", + "id": 0 + }, + { + "name": "Vinson Phelps", + "id": 1 + }, + { + "name": "Francisca Kelley", + "id": 2 + } + ], + "range": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "tags": [ + "nostrud", + "eiusmod", + "dolore", + "officia", + "sint", + "non", + "qui" + ], + "longitude": -7.275151, + "latitude": 75.54202, + "registered": "Wednesday, October 1, 2014 6:35 PM", + "about": "Quis duis ullamco velit qui. Consectetur non adipisicing id magna anim. Deserunt est officia qui esse. Et do pariatur incididunt anim ad mollit non. Et eiusmod sunt fugiat elit mollit ad excepteur anim nisi laboris eiusmod aliquip aliquip.\r\n", + "address": "981 Bush Street, Beaulieu, Vermont, 3775", + "phone": "+1 (956) 506-3807", + "email": "helga.burch@synkgen.name", + "company": "SYNKGEN", + "name": { + "last": "Burch", + "first": "Helga" + }, + "eyeColor": "blue", + "age": 22, + "picture": "http://placehold.it/32x32", + "balance": "$3,827.89", + "isActive": false, + "guid": "ff5dfea0-1052-4ef2-8b66-4dc1aad0a4fb", + "index": 7, + "_id": "551b911946be8358ae40e90e" + }, + { + "favoriteFruit": "banana", + "greeting": "Hello, Shaw! You have 5 unread messages.", + "friends": [ + { + "name": "Christian Cardenas", + "id": 0 + }, + { + "name": "Cohen Pennington", + "id": 1 + }, + { + "name": "Mary Lindsay", + "id": 2 + } + ], + "range": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "tags": [ + "occaecat", + "ut", + "occaecat", + "magna", + "exercitation", + "incididunt", + "irure" + ], + "longitude": -89.102972, + "latitude": 89.489596, + "registered": "Thursday, August 21, 2014 5:00 PM", + "about": "Amet cupidatat quis velit aute Lorem consequat pariatur mollit deserunt et sint culpa excepteur duis. Enim proident duis qui ex tempor sunt nostrud occaecat. Officia sit veniam mollit eiusmod minim do aute eiusmod fugiat qui anim adipisicing in laboris. Do tempor reprehenderit sunt laborum esse irure dolor ad consectetur aute sit id ipsum. Commodo et voluptate anim consequat do. Minim laborum ad veniam ad minim incididunt excepteur excepteur aliqua.\r\n", + "address": "237 Pierrepont Street, Herbster, New York, 3490", + "phone": "+1 (976) 455-2880", + "email": "shaw.zamora@shadease.me", + "company": "SHADEASE", + "name": { + "last": "Zamora", + "first": "Shaw" + }, + "eyeColor": "blue", + "age": 38, + "picture": "http://placehold.it/32x32", + "balance": "$3,440.82", + "isActive": false, + "guid": "ac5fdb0e-e1fb-427e-881d-da461be0d1ca", + "index": 8, + "_id": "551b9119af0077bc28a2de25" + }, + { + "favoriteFruit": "apple", + "greeting": "Hello, Melissa! You have 5 unread messages.", + "friends": [ + { + "name": "Marion Villarreal", + "id": 0 + }, + { + "name": "Kate Rose", + "id": 1 + }, + { + "name": "Hines Simon", + "id": 2 + } + ], + "range": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "tags": [ + "amet", + "veniam", + "mollit", + "ad", + "cupidatat", + "deserunt", + "Lorem" + ], + "longitude": -52.735052, + "latitude": 16.258838, + "registered": "Wednesday, April 16, 2014 7:56 PM", + "about": "Aute ut culpa eiusmod tempor duis dolor tempor incididunt. Nisi non proident excepteur eiusmod incididunt nisi minim irure sit. In veniam commodo deserunt proident reprehenderit et consectetur ullamco quis nulla cupidatat.\r\n", + "address": "642 Halsey Street, Blandburg, Kansas, 6761", + "phone": "+1 (941) 539-3851", + "email": "melissa.vaughn@memora.io", + "company": "MEMORA", + "name": { + "last": "Vaughn", + "first": "Melissa" + }, + "eyeColor": "brown", + "age": 24, + "picture": "http://placehold.it/32x32", + "balance": "$2,399.44", + "isActive": true, + "guid": "1769f022-a7f1-4a69-bf4c-f5a5ebeab2d1", + "index": 9, + "_id": "551b9119b607c09c7ffc3b8a" + } +] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/types/nulls.json b/3rdparty/rapidjson/bin/types/nulls.json new file mode 100644 index 00000000000..7a636ec87cd --- /dev/null +++ b/3rdparty/rapidjson/bin/types/nulls.json @@ -0,0 +1,102 @@ +[ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null +] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/types/paragraphs.json b/3rdparty/rapidjson/bin/types/paragraphs.json new file mode 100644 index 00000000000..8ab3e1c561c --- /dev/null +++ b/3rdparty/rapidjson/bin/types/paragraphs.json @@ -0,0 +1,102 @@ +[ + "Commodo ullamco cupidatat nisi sit proident ex. Cillum pariatur occaecat in officia do commodo nisi cillum tempor minim. Ad dolor ut et aliquip fugiat eu officia cupidatat occaecat consectetur eiusmod veniam enim officia.\r\n", + "Adipisicing cillum laborum nisi irure. Cillum dolor proident duis nulla qui mollit dolore reprehenderit mollit. Irure nulla dolor ipsum irure nulla quis laboris do.\r\n", + "Est adipisicing consectetur incididunt in. Occaecat ea magna ex consequat irure sit laborum cillum officia magna sunt do exercitation aliquip. Laboris id aute in dolore reprehenderit voluptate non deserunt laborum.\r\n", + "Consectetur eu aute est est occaecat adipisicing sint enim dolor eu. Tempor amet id non mollit eu consectetur cillum duis. Eu labore velit nulla ipsum commodo consequat aliquip. Cupidatat commodo dolore mollit enim sit excepteur nisi duis laboris deserunt esse.\r\n", + "Incididunt ullamco est fugiat enim fugiat. Do sit mollit anim ad excepteur eu laboris exercitation officia labore nulla ut. Voluptate non voluptate cillum sit et voluptate anim duis velit consequat aliquip dolor. Elit et et esse laboris consectetur officia eiusmod aliquip nisi est. Qui labore dolore ad dolor.\r\n", + "Anim adipisicing est irure proident sit officia ullamco voluptate sunt consectetur duis mollit excepteur veniam. Nostrud ut duis aute exercitation officia et quis elit commodo elit tempor aute aliquip enim. Est officia non cillum consequat voluptate ipsum sit voluptate nulla id.\r\n", + "Ipsum enim consectetur aliquip nulla commodo ut ex aliqua elit duis do. Officia et sunt aliqua dolor minim voluptate veniam esse elit enim. Adipisicing reprehenderit duis ex magna non in fugiat sunt ipsum nostrud fugiat aliquip. Labore voluptate id officia voluptate eu. Magna do nostrud excepteur sunt aliqua adipisicing qui.\r\n", + "Est occaecat non non cupidatat laborum qui. Veniam sit est voluptate labore sit irure consectetur fugiat. Anim enim enim fugiat exercitation anim ad proident esse in aliqua. Laboris ut aute culpa ullamco.\r\n", + "Sit et aliquip cupidatat deserunt eiusmod sint aliquip occaecat nostrud aliqua elit commodo ut magna. Amet sit est deserunt id duis in officia pariatur cupidatat ex. Mollit duis est consequat nulla aute velit ipsum sit consectetur pariatur ut non ex ipsum. Tempor esse velit pariatur reprehenderit et nostrud commodo laborum mollit labore.\r\n", + "Aliquip irure quis esse aliquip. Ex non deserunt culpa aliqua ad anim occaecat ad. Lorem consectetur mollit eu consectetur est non nisi non ipsum. Qui veniam ullamco officia est ut excepteur. Nulla elit dolore cupidatat aliqua enim Lorem elit consequat eiusmod non aliqua eu in. Pariatur in culpa labore sint ipsum consectetur occaecat ad ex ipsum laboris aliquip officia. Non officia eiusmod nisi officia id id laboris deserunt sunt enim magna mollit sit.\r\n", + "Mollit velit laboris laborum nulla aliquip consequat Lorem non incididunt irure. Eu voluptate sint do consectetur tempor sit Lorem in. Laborum eiusmod nisi Lorem ipsum dolore do aute laborum occaecat aute sunt. Sit laborum in ea do ipsum officia irure cillum irure nisi laboris. Ad anim deserunt excepteur ea veniam eiusmod culpa velit veniam. Commodo incididunt ea Lorem eu enim esse nisi incididunt mollit.\r\n", + "Velit proident sunt aute dolore reprehenderit culpa. Pariatur reprehenderit commodo ad ea voluptate anim nulla ipsum eu irure fugiat aliqua et. Adipisicing incididunt anim excepteur voluptate minim qui culpa. Sunt veniam enim reprehenderit magna magna. Sit ad amet deserunt ut aute dolore ad minim.\r\n", + "Esse ullamco sunt mollit mollit. Eu enim dolore laboris cupidatat. Cupidatat adipisicing non aute exercitation fugiat. Non ut cillum labore fugiat aliquip ex duis quis consectetur ut nisi Lorem amet qui. Proident veniam amet qui reprehenderit duis qui. Nisi culpa sit occaecat ullamco occaecat laborum fugiat ut. Non duis deserunt culpa duis.\r\n", + "Id ipsum eiusmod laboris non est ipsum deserunt labore duis reprehenderit deserunt. Sint tempor fugiat eiusmod nostrud in ut laborum esse in nostrud sit deserunt nostrud reprehenderit. Cupidatat aliqua qui anim consequat eu quis consequat consequat elit ipsum pariatur. Cupidatat in dolore velit quis. Exercitation cillum ullamco ex consectetur commodo tempor incididunt exercitation labore ad dolore. Minim incididunt consequat adipisicing esse eu eu voluptate.\r\n", + "Anim sint eiusmod nisi anim do deserunt voluptate ut cillum eiusmod esse ex reprehenderit laborum. Dolore nulla excepteur duis excepteur. Magna nisi nostrud duis non commodo velit esse ipsum Lorem incididunt. Nulla enim consequat ad aliqua. Incididunt irure culpa nostrud ea aute ex sit non ad esse.\r\n", + "Ullamco nostrud cupidatat adipisicing anim fugiat mollit eu. Et ut eu in nulla consequat. Sunt do pariatur culpa non est.\r\n", + "Pariatur incididunt reprehenderit non qui excepteur cillum exercitation nisi occaecat ad. Lorem aliquip laborum commodo reprehenderit sint. Laboris qui ut veniam magna quis et et ullamco voluptate. Tempor reprehenderit deserunt consequat nisi. Esse duis sint in tempor. Amet aute cupidatat in sint et.\r\n", + "Est officia nisi dolore consequat irure et excepteur. Sit qui elit tempor magna qui cillum anim amet proident exercitation proident. Eu cupidatat laborum consectetur duis ullamco irure nulla. Adipisicing culpa non reprehenderit anim aute.\r\n", + "Eu est laborum culpa velit dolore non sunt. Tempor magna veniam ea sit non qui Lorem qui exercitation aliqua aliqua et excepteur eiusmod. Culpa aute anim proident culpa adipisicing duis tempor elit aliquip elit nulla laboris esse dolore. Sit adipisicing non dolor eiusmod occaecat cupidatat.\r\n", + "Culpa velit eu esse sunt. Laborum irure aliqua reprehenderit velit ipsum fugiat officia dolor ut aute officia deserunt. Ipsum sit quis fugiat nostrud aliqua cupidatat ex pariatur et. Cillum proident est irure nisi dolor aliqua deserunt esse occaecat velit dolor.\r\n", + "Exercitation nulla officia sit eiusmod cillum eu incididunt officia exercitation qui Lorem deserunt. Voluptate Lorem minim commodo laborum esse in duis excepteur do duis aliquip nisi voluptate consectetur. Amet tempor officia enim ex esse minim reprehenderit.\r\n", + "Laboris sint deserunt ad aute incididunt. Anim officia sunt elit qui laborum labore commodo irure non. Mollit adipisicing ullamco do aute nulla eu laborum et quis sint aute adipisicing amet. Aliqua officia irure nostrud duis ex.\r\n", + "Eiusmod ipsum aliqua reprehenderit esse est non aute id veniam eiusmod. Elit consequat ad sit tempor elit eu incididunt quis irure ad. Eu incididunt veniam consequat Lorem nostrud cillum officia ea consequat ad cillum. Non nisi irure cupidatat incididunt pariatur incididunt. Duis velit officia ad cillum qui. Aliquip consequat sint aute nisi cillum. Officia commodo nisi incididunt laborum nisi voluptate aliquip Lorem cupidatat anim consequat sit laboris.\r\n", + "Veniam cupidatat et incididunt mollit do ex voluptate veniam nostrud labore esse. Eiusmod irure sint fugiat esse. Aute irure consectetur ut mollit nulla sint esse. Lorem ut quis ex proident nostrud mollit nostrud ea duis duis in magna anim consectetur.\r\n", + "Irure culpa esse qui do dolor fugiat veniam ad. Elit commodo aute elit magna incididunt tempor pariatur velit irure pariatur cillum et ea ad. Ad consequat ea et ad minim ut sunt qui commodo voluptate. Laboris est aliquip anim reprehenderit eu officia et exercitation. Occaecat laboris cupidatat Lorem ullamco in nostrud commodo ipsum in quis esse ex.\r\n", + "Incididunt officia quis voluptate eiusmod esse nisi ipsum quis commodo. Eiusmod dolore tempor occaecat sit exercitation aliqua minim consequat minim mollit qui ad nisi. Aute quis irure adipisicing veniam nisi nisi velit deserunt incididunt anim nostrud.\r\n", + "Voluptate exercitation exercitation id minim excepteur excepteur mollit. Fugiat aute proident nulla ullamco ea. Nisi ea culpa duis dolore veniam anim tempor officia in dolore exercitation exercitation. Dolore quis cillum adipisicing sunt do nulla esse proident ad sint.\r\n", + "Laborum ut mollit sint commodo nulla laborum deserunt Lorem magna commodo mollit tempor deserunt ut. Qui aliquip commodo ea id. Consectetur dolor fugiat dolor excepteur eiusmod. Eu excepteur ex aute ex ex elit ex esse officia cillum exercitation. Duis ut labore ea nostrud excepteur. Reprehenderit labore aute sunt nisi quis Lorem officia. Ad aliquip cupidatat voluptate exercitation voluptate ad irure magna quis.\r\n", + "Tempor velit veniam sit labore elit minim do elit cillum eiusmod sunt excepteur nisi. Aliquip est deserunt excepteur duis fugiat incididunt veniam fugiat. Pariatur sit irure labore et minim non. Cillum quis aute anim sint laboris laboris ullamco exercitation nostrud. Nulla pariatur id laborum minim nisi est adipisicing irure.\r\n", + "Irure exercitation laboris nostrud in do consectetur ad. Magna aliqua Lorem culpa exercitation sint do culpa incididunt mollit eu exercitation. Elit tempor Lorem dolore enim deserunt. Anim et ullamco sint ullamco mollit cillum officia et. Proident incididunt laboris aliquip laborum sint veniam deserunt eu consequat deserunt voluptate laboris. Anim Lorem non laborum exercitation voluptate. Cupidatat reprehenderit culpa Lorem fugiat enim minim consectetur tempor quis ad reprehenderit laboris irure.\r\n", + "Deserunt elit mollit nostrud occaecat labore reprehenderit laboris ex. Esse reprehenderit adipisicing cillum minim in esse aliquip excepteur ex et nisi cillum quis. Cillum labore ut ex sunt. Occaecat proident et mollit magna consequat irure esse. Dolor do enim esse nisi ad.\r\n", + "Pariatur est anim cillum minim elit magna adipisicing quis tempor proident nisi laboris incididunt cupidatat. Nulla est adipisicing sit adipisicing id nostrud amet qui consequat eiusmod tempor voluptate ad. Adipisicing non magna sit occaecat magna mollit ad ex nulla velit ea pariatur. Irure labore ad ea exercitation ex cillum.\r\n", + "Lorem fugiat eu eu cillum nulla tempor sint. Lorem id officia nulla velit labore ut duis ad tempor non. Excepteur quis aute adipisicing nisi nisi consectetur aliquip enim Lorem id ullamco cillum sint voluptate. Qui aliquip incididunt tempor aliqua voluptate labore reprehenderit. Veniam eiusmod elit occaecat voluptate tempor culpa consectetur ea ut exercitation eiusmod exercitation qui.\r\n", + "Aliqua esse pariatur nulla veniam velit ea. Aliquip consectetur tempor ex magna sit aliquip exercitation veniam. Dolor ullamco minim commodo pariatur. Et amet reprehenderit dolore proident elit tempor eiusmod eu incididunt enim ullamco. Adipisicing id officia incididunt esse dolor sunt cupidatat do deserunt mollit do non. Magna ut officia fugiat adipisicing quis ea cillum laborum dolore ad nostrud magna minim est. Dolor voluptate officia proident enim ea deserunt eu voluptate dolore proident laborum officia ea.\r\n", + "Culpa aute consequat esse fugiat cupidatat minim voluptate voluptate eiusmod irure anim elit. Do eiusmod culpa laboris consequat incididunt minim nostrud eiusmod commodo velit ea ullamco proident. Culpa pariatur magna ut mollit nisi. Ea officia do magna deserunt minim nisi tempor ea deserunt veniam cillum exercitation esse.\r\n", + "Anim ullamco nostrud commodo Lorem. Do sunt laborum exercitation proident proident magna. Lorem officia laborum laborum dolor sunt duis commodo Lorem. Officia aute adipisicing ea cupidatat ea dolore. Aliquip adipisicing pariatur consectetur aliqua sit amet officia reprehenderit laborum culpa. Occaecat Lorem eu nisi do Lorem occaecat enim eiusmod laboris id quis. Ad mollit adipisicing sunt adipisicing esse.\r\n", + "Laborum quis sit adipisicing cupidatat. Veniam Lorem eiusmod esse esse sint nisi labore elit et. Deserunt aliqua mollit ut commodo aliqua non incididunt ipsum reprehenderit consectetur. Eiusmod nulla minim laboris Lorem ea Lorem aute tempor pariatur in sit. Incididunt culpa ut do irure amet irure cupidatat est anim anim culpa occaecat. Est velit consectetur eiusmod veniam reprehenderit officia sunt occaecat eiusmod ut sunt occaecat amet.\r\n", + "Elit minim aute fugiat nulla ex quis. Labore fugiat sint nostrud amet quis culpa excepteur in. Consectetur exercitation cupidatat laborum sit. Aute nisi eu aliqua est deserunt eiusmod commodo dolor id. Mollit laborum esse sint ipsum voluptate reprehenderit velit et. Veniam aliquip enim in veniam Lorem voluptate quis deserunt consequat qui commodo ut excepteur aute.\r\n", + "Dolore deserunt veniam aute nisi labore sunt et voluptate irure nisi anim ea. Magna nisi quis anim mollit nisi est dolor do ex aliquip elit aliquip ipsum minim. Dolore est officia nostrud eiusmod ex laborum ea amet est. Officia culpa non est et tempor consectetur exercitation tempor eiusmod enim. Ea tempor laboris qui amet ex nisi culpa dolore consectetur incididunt sunt sunt. Lorem aliquip incididunt magna do et ullamco ex elit aliqua eiusmod qui. Commodo amet dolor sint incididunt ex veniam non Lorem fugiat.\r\n", + "Officia culpa enim voluptate dolore commodo. Minim commodo aliqua minim ex sint excepteur cupidatat adipisicing eu irure. Anim magna deserunt anim Lorem non.\r\n", + "Cupidatat aliquip nulla excepteur sunt cupidatat cupidatat laborum cupidatat exercitation. Laboris minim ex cupidatat culpa elit. Amet enim reprehenderit aliqua laborum est tempor exercitation cupidatat ex dolore do. Do incididunt labore fugiat commodo consectetur nisi incididunt irure sit culpa sit. Elit aute occaecat qui excepteur velit proident cillum qui aliqua ex do ex. Dolore irure ex excepteur veniam id proident mollit Lorem.\r\n", + "Ad commodo cillum duis deserunt elit officia consectetur veniam eiusmod. Reprehenderit et veniam ad commodo reprehenderit magna elit laboris sunt non quis. Adipisicing dolor aute proident ea magna sunt et proident in consectetur.\r\n", + "Veniam exercitation esse esse veniam est nisi. Minim velit incididunt sint aute dolor anim. Fugiat cupidatat id ad nisi in voluptate dolor culpa eiusmod magna eiusmod amet id. Duis aliquip labore et ex amet amet aliquip laborum eiusmod ipsum. Quis qui ut duis duis. Minim in voluptate reprehenderit aliqua.\r\n", + "Elit ut pariatur dolor veniam ipsum consequat. Voluptate Lorem mollit et esse dolore mollit Lorem ad. Elit nostrud eu Lorem labore mollit minim cupidatat officia quis minim dolore incididunt. In cillum aute cillum ut.\r\n", + "Commodo laborum deserunt ut cupidatat pariatur ullamco in esse anim exercitation cillum duis. Consectetur incididunt sit esse Lorem in aute. Eiusmod mollit Lorem consequat minim reprehenderit laborum enim excepteur irure nisi elit. Laborum esse proident aute aute proident adipisicing laborum. Pariatur tempor duis incididunt qui velit pariatur ut officia ea mollit labore dolore. Cillum pariatur minim ullamco sunt incididunt culpa id ullamco exercitation consectetur. Ea exercitation consequat reprehenderit ut ullamco velit eu ad velit magna excepteur eiusmod.\r\n", + "Eu deserunt magna laboris laborum laborum in consequat dolore. Officia proident consectetur proident do occaecat minim pariatur officia ipsum sit non velit officia cillum. Laborum excepteur labore eu minim eiusmod. Sit anim dolore cillum ad do minim culpa sit est ad.\r\n", + "Cupidatat dolor nostrud Lorem sint consequat quis. Quis labore sint incididunt officia tempor. Fugiat nostrud in elit reprehenderit dolor. Nisi sit enim officia minim est adipisicing nulla aute labore nulla nostrud cupidatat est. Deserunt dolore qui irure Lorem esse voluptate velit qui nostrud.\r\n", + "Fugiat Lorem amet nulla nisi qui amet laboris enim cillum. Dolore occaecat exercitation id labore velit do commodo ut cupidatat laborum velit fugiat mollit. Ut et aliqua pariatur occaecat. Lorem occaecat dolore quis esse enim cupidatat exercitation ut tempor sit laboris fugiat adipisicing. Est tempor ex irure consectetur ipsum magna labore. Lorem non quis qui minim nisi magna amet aliquip ex cillum fugiat tempor.\r\n", + "Aliquip eiusmod laborum ipsum deserunt velit esse do magna excepteur consectetur exercitation sit. Minim ullamco reprehenderit commodo nostrud exercitation id irure ex qui ullamco sit esse laboris. Nulla cillum non minim qui cillum nisi aute proident. Dolor anim culpa elit quis excepteur aliqua eiusmod. Elit ea est excepteur consectetur sunt eiusmod enim id commodo irure amet et pariatur laboris. Voluptate magna ad magna dolore cillum cillum irure laboris ipsum officia id Lorem veniam.\r\n", + "Esse sunt elit est aliquip cupidatat commodo deserunt. Deserunt pariatur ipsum qui ad esse esse magna qui cillum laborum. Exercitation veniam pariatur elit amet enim.\r\n", + "Esse quis in id elit nulla occaecat incididunt. Et amet Lorem mollit in veniam do. Velit mollit Lorem consequat commodo Lorem aliquip cupidatat. Minim consequat nostrud nulla in nostrud.\r\n", + "Cillum nulla et eu est nostrud quis elit cupidatat dolor enim excepteur exercitation nisi voluptate. Nulla dolore non ex velit et qui tempor proident id deserunt nisi eu. Tempor ad Lorem ipsum reprehenderit in anim. Anim dolore ullamco enim deserunt quis ex id exercitation velit. Magna exercitation fugiat mollit pariatur ipsum ex consectetur nostrud. Id dolore officia nostrud excepteur laborum. Magna incididunt elit ipsum pariatur adipisicing enim duis est qui commodo velit aute.\r\n", + "Quis esse ex qui nisi dolor. Ullamco laborum dolor esse laboris eiusmod ea magna laboris ea esse ut. Dolore ipsum pariatur veniam sint mollit. Lorem ea proident fugiat ullamco ut nisi culpa eu exercitation exercitation aliquip veniam laborum consectetur.\r\n", + "Pariatur veniam laboris sit aliquip pariatur tempor aute sunt id et ut. Laboris excepteur eiusmod nisi qui quis elit enim ut cupidatat. Et et laborum in fugiat veniam consectetur ipsum laboris duis excepteur ullamco aliqua dolor Lorem. Aliqua ex amet sint anim cupidatat nisi ipsum anim et sunt deserunt. Occaecat culpa ut tempor cillum pariatur ex tempor.\r\n", + "Dolor deserunt eiusmod magna do officia voluptate excepteur est cupidatat. Veniam qui cupidatat amet anim est qui consectetur sit commodo commodo ea ad. Enim ad adipisicing qui nostrud. Non nulla esse ullamco nulla et ex.\r\n", + "Id ullamco ea consectetur est incididunt deserunt et esse. Elit nostrud voluptate eiusmod ut. Excepteur adipisicing qui cupidatat consequat labore id. Qui dolor aliqua do dolore do cupidatat labore ex consectetur ea sit cillum. Sint veniam eiusmod in consectetur consequat fugiat et mollit ut fugiat esse dolor adipisicing.\r\n", + "Ea magna proident labore duis pariatur. Esse cillum aliquip dolor duis fugiat ea ex officia ea irure. Sint elit nisi pariatur sunt nostrud exercitation ullamco culpa magna do.\r\n", + "Minim aliqua voluptate dolor consequat sint tempor deserunt amet magna excepteur. Irure do voluptate magna velit. Nostrud in reprehenderit magna officia nostrud. Cupidatat nulla irure laboris non fugiat ex ex est cupidatat excepteur officia aute velit duis. Sit voluptate id ea exercitation deserunt culpa voluptate nostrud est adipisicing incididunt. Amet proident laborum commodo magna ipsum quis.\r\n", + "Ipsum consectetur consectetur excepteur tempor eiusmod ea fugiat aute velit magna in officia sunt. Sit ut sunt dolore cupidatat dolor adipisicing. Veniam nisi adipisicing esse reprehenderit amet aliqua voluptate ex commodo occaecat est voluptate mollit sunt. Pariatur aliqua qui qui in dolor. Fugiat reprehenderit sit nostrud do sint esse. Tempor sit irure adipisicing ea pariatur duis est sit est incididunt laboris quis do. Et voluptate anim minim aliquip excepteur consequat nisi anim pariatur aliquip ut ipsum dolor magna.\r\n", + "Cillum sit labore excepteur magna id aliqua exercitation consequat laborum Lorem id pariatur nostrud. Lorem qui est labore sint cupidatat sint excepteur nulla in eu aliqua et. Adipisicing velit do enim occaecat laboris quis excepteur ipsum dolor occaecat Lorem dolore id exercitation.\r\n", + "Incididunt in laborum reprehenderit eiusmod irure ex. Elit duis consequat minim magna. Esse consectetur aliquip cillum excepteur excepteur fugiat. Sint tempor consequat minim reprehenderit consectetur adipisicing dolor id Lorem elit non. Occaecat esse quis mollit ea et sint aute fugiat qui tempor. Adipisicing tempor duis non dolore irure elit deserunt qui do.\r\n", + "Labore fugiat eiusmod sint laborum sit duis occaecat. Magna in laborum non cillum excepteur nostrud sit proident pariatur voluptate voluptate adipisicing exercitation occaecat. Ad non dolor aute ex sint do do minim exercitation veniam laborum irure magna ea. Magna do non quis sit consequat Lorem aliquip.\r\n", + "Velit anim do laborum laboris laborum Lorem. Sunt do Lorem amet ipsum est sint velit sit do voluptate mollit veniam enim. Commodo do deserunt in pariatur ut elit sint elit deserunt ea. Ad dolor anim consequat aliquip ut mollit nostrud tempor sunt mollit elit. Reprehenderit laboris labore excepteur occaecat veniam adipisicing cupidatat esse. Ad enim aliquip ea minim excepteur magna. Sint velit veniam pariatur qui dolor est adipisicing ex laboris.\r\n", + "Ea cupidatat ex nulla in sunt est sit dolor enim ad. Eu tempor consequat cupidatat consequat ex incididunt sint culpa. Est Lorem Lorem non cupidatat sunt ut aliqua non nostrud do ullamco. Reprehenderit ad ad nulla nostrud do nulla in. Ipsum adipisicing commodo mollit ipsum exercitation. Aliqua ea anim anim est elit. Ea incididunt consequat minim ad sunt eu cillum.\r\n", + "Tempor quis excepteur eiusmod cupidatat ipsum occaecat id et occaecat. Eiusmod magna aliquip excepteur id amet elit. Ullamco dolore amet anim dolor enim ea magna magna elit. Occaecat magna pariatur in deserunt consectetur officia aliquip ullamco ex aute anim. Minim laborum eu sit elit officia esse do irure pariatur tempor et reprehenderit ullamco labore.\r\n", + "Sit tempor eu minim dolore velit pariatur magna duis reprehenderit ea nulla in. Amet est do consectetur commodo do adipisicing adipisicing in amet. Cillum id ut commodo do pariatur duis aliqua nisi sint ad irure officia reprehenderit. Mollit labore id enim fugiat ullamco irure mollit cupidatat. Quis nisi amet labore eu dolor occaecat commodo aliqua laboris deserunt excepteur deserunt officia. Aliqua non ut sit ad. Laborum veniam ad velit minim dolore ea id magna dolor qui in.\r\n", + "Dolore nostrud ipsum aliqua pariatur id reprehenderit enim ad eiusmod qui. Deserunt anim commodo pariatur excepteur velit eu irure nulla ex labore ipsum aliqua minim aute. Id consequat amet tempor aliquip ex elit adipisicing est do. Eu enim Lorem consectetur minim id irure nulla culpa. Consectetur do consequat aute tempor anim. Qui ad non elit dolor est adipisicing nisi amet cillum sunt quis anim laboris incididunt. Incididunt proident adipisicing labore Lorem.\r\n", + "Et reprehenderit ea officia veniam. Aliquip ullamco consequat elit nisi magna mollit id elit. Amet amet sint velit labore ad nisi. Consectetur tempor id dolor aliqua esse deserunt amet. Qui laborum enim proident voluptate aute eu aute aute sit sit incididunt eu. Sunt ullamco nisi nostrud labore commodo non consectetur quis do duis minim irure. Tempor sint dolor sint aliquip dolore nostrud fugiat.\r\n", + "Aute ullamco quis nisi ut excepteur nostrud duis elit. Veniam ex ad incididunt veniam voluptate. Commodo dolore ullamco sit sint adipisicing proident amet aute duis deserunt.\r\n", + "Labore velit eu cillum nisi. Laboris do cupidatat et non duis cillum. Ullamco dolor tempor cupidatat voluptate laborum ullamco ea duis.\r\n", + "Deserunt consequat aliqua duis aliquip nostrud nostrud dolore nisi. Culpa do sint laborum consectetur ipsum quis laborum laborum pariatur eiusmod. Consectetur laboris ad ad ut quis. Ullamco laboris qui velit id laborum voluptate qui aute nostrud aliquip ea.\r\n", + "Ad cillum anim ex est consectetur mollit id in. Non enim aliquip consequat qui deserunt commodo cillum ad laborum fugiat. Dolor deserunt amet laborum tempor adipisicing voluptate dolor pariatur dolor cillum. Eu mollit ex sunt officia veniam qui est sunt proident. Non aliqua qui elit eu cupidatat ex enim ex proident. Lorem sit minim ullamco officia cupidatat duis minim. Exercitation laborum deserunt voluptate culpa tempor quis nulla id pariatur.\r\n", + "Nostrud quis consectetur ut aliqua excepteur elit consectetur occaecat. Occaecat voluptate Lorem pariatur consequat ullamco fugiat minim. Anim voluptate eu eu cillum tempor dolore aliquip aliqua. Fugiat incididunt ut tempor amet minim. Voluptate nostrud minim pariatur non excepteur ullamco.\r\n", + "Dolore nulla velit officia exercitation irure laboris incididunt anim in laborum in fugiat ut proident. Fugiat aute id consequat fugiat officia ut. Labore sint amet proident amet sint nisi laboris amet id ullamco culpa quis consequat proident. Magna do fugiat veniam dolore elit irure minim. Esse ullamco excepteur labore tempor labore fugiat dolore nisi cupidatat irure dolor pariatur. Magna excepteur laboris nisi eiusmod sit pariatur mollit.\r\n", + "In enim aliquip officia ea ad exercitation cillum culpa occaecat dolore Lorem. Irure cillum commodo adipisicing sunt pariatur ea duis fugiat exercitation laboris culpa ullamco aute. Ut voluptate exercitation qui dolor. Irure et duis elit consequat deserunt proident.\r\n", + "Officia ea Lorem sunt culpa id et tempor excepteur enim deserunt proident. Dolore aliquip dolor laboris cillum proident velit. Et culpa occaecat exercitation cupidatat irure sint adipisicing excepteur pariatur incididunt ad occaecat. Qui proident ipsum cillum minim. Quis ut culpa irure aliqua minim fugiat. In voluptate cupidatat fugiat est laborum dolor esse in pariatur voluptate.\r\n", + "Voluptate enim ipsum officia aute ea adipisicing nisi ut ex do aliquip amet. Reprehenderit enim voluptate tempor ex adipisicing culpa. Culpa occaecat voluptate dolor mollit ipsum exercitation labore et tempor sit ea consectetur aliqua. Elit elit sit minim ea ea commodo do tempor cupidatat irure dolore. Occaecat esse adipisicing anim eiusmod commodo fugiat mollit amet. Incididunt tempor tempor qui occaecat cupidatat in.\r\n", + "Ut qui anim velit enim aliquip do ut nulla labore. Mollit ut commodo ut eiusmod consectetur laboris aliqua qui voluptate culpa fugiat incididunt elit. Lorem ullamco esse elit elit. Labore amet incididunt ea nulla aliquip eiusmod. Sit nulla est voluptate officia ipsum aute aute cillum tempor deserunt. Laboris commodo eiusmod labore sunt aute excepteur ea consectetur reprehenderit veniam nisi. Culpa nisi sint sunt sint tempor laboris dolore cupidatat.\r\n", + "Duis cillum qui nisi duis amet velit ad cillum ut elit aute sint ad. Amet laboris pariatur excepteur ipsum Lorem aliqua veniam Lorem quis mollit cupidatat aliqua exercitation. Pariatur ex ullamco sit commodo cillum eiusmod ut proident elit cillum. Commodo ut ipsum excepteur occaecat sint elit consequat ex dolor adipisicing consectetur id ut ad. Velit sit eiusmod est esse tempor incididunt consectetur eiusmod duis commodo veniam.\r\n", + "Ut sunt qui officia anim laboris exercitation Lorem quis laborum do eiusmod officia. Enim consectetur occaecat fugiat cillum cillum. Dolore dolore nostrud in commodo fugiat mollit consequat occaecat non et et elit ullamco. Sit voluptate minim ut est culpa velit nulla fugiat reprehenderit eu aliquip adipisicing labore. Sit minim minim do dolor dolor. Lorem Lorem labore exercitation magna veniam eiusmod do.\r\n", + "Fugiat dolor adipisicing quis aliquip aute dolore. Qui proident anim elit veniam ex aliquip eiusmod ipsum sunt pariatur est. Non fugiat duis do est officia adipisicing.\r\n", + "Nulla deserunt do laboris cupidatat veniam do consectetur ipsum elit veniam in mollit eu. Ea in consequat cupidatat laboris sint fugiat irure. In commodo esse reprehenderit deserunt minim velit ullamco enim eu cupidatat tempor ex. Ullamco in non id culpa amet occaecat culpa nostrud id. Non occaecat culpa magna incididunt.\r\n", + "Enim laboris ex mollit reprehenderit eiusmod exercitation magna. Exercitation Lorem ex mollit non non culpa labore enim. Adipisicing labore dolore incididunt do amet aliquip excepteur ad et nostrud officia aute veniam voluptate. Fugiat enim eiusmod Lorem esse. Minim ullamco commodo consequat ex commodo aliqua eu nulla eu. Veniam non enim nulla ut Lorem nostrud minim sint duis.\r\n", + "Enim duis consectetur in ullamco cillum veniam nulla amet. Exercitation nisi sunt sunt duis in culpa nisi magna ex id ipsum laboris reprehenderit qui. Officia pariatur qui ex fugiat veniam et sunt sit nostrud. Veniam ullamco tempor fugiat minim Lorem proident velit in eiusmod elit. Enim minim excepteur aute aliquip ex magna commodo dolore qui et labore. Proident eu aliquip cillum dolor. Nostrud ipsum ut irure consequat fugiat nulla proident occaecat laborum.\r\n", + "Amet duis eiusmod sunt adipisicing esse ex nostrud consectetur voluptate cillum. Ipsum occaecat sit et anim velit irure ea incididunt cupidatat ullamco in nisi quis. Esse officia ipsum commodo qui quis qui do. Commodo aliquip amet aute sit sit ut cupidatat elit nostrud.\r\n", + "Laboris laboris sit mollit cillum nulla deserunt commodo culpa est commodo anim id anim sit. Officia id consectetur velit incididunt est dolor sunt ipsum magna aliqua consectetur. Eiusmod pariatur minim deserunt cupidatat veniam Lorem aliquip sunt proident eu Lorem sit dolor fugiat. Proident qui ut ex in incididunt nulla nulla dolor ex laboris ea ad.\r\n", + "Ex incididunt enim labore nulla cupidatat elit. Quis ut incididunt incididunt non irure commodo do mollit cillum anim excepteur. Qui consequat laborum dolore elit tempor aute ut nulla pariatur eu ullamco veniam. Nisi non velit labore in commodo excepteur culpa nulla tempor cillum. Ipsum qui sit sint reprehenderit ut labore incididunt dolor aliquip sunt. Reprehenderit occaecat tempor nisi laborum.\r\n", + "Lorem officia ullamco eu occaecat in magna eiusmod consectetur nisi aliqua mollit esse. Ullamco ex aute nostrud pariatur do enim cillum sint do fugiat nostrud culpa tempor. Do aliquip excepteur nostrud culpa eu pariatur eiusmod cillum excepteur do. Est sunt non quis cillum voluptate ex.\r\n", + "Deserunt consectetur tempor irure mollit qui tempor et. Labore enim eu irure laboris in. Nisi in tempor ex occaecat amet cupidatat laboris occaecat amet minim ut magna incididunt id. Consequat cillum laborum commodo mollit. Et magna culpa sunt dolore consequat laboris et sit. Deserunt qui voluptate excepteur dolor. Eu qui amet est proident.\r\n", + "Eu elit minim eiusmod occaecat eu nostrud dolor qui ut elit. Sunt dolore proident ea eu do eiusmod fugiat incididunt pariatur duis amet Lorem nisi ut. Adipisicing quis veniam cupidatat Lorem sint culpa sunt veniam sint. Excepteur eu exercitation est magna pariatur veniam dolore qui fugiat labore proident eiusmod cillum. Commodo reprehenderit elit proident duis sint magna.\r\n", + "Ut aliquip pariatur deserunt nostrud commodo ad proident est exercitation. Sit minim do ea enim sint officia nisi incididunt laborum. Ex amet duis commodo fugiat. Ut aute tempor deserunt irure occaecat aliquip voluptate cillum aute elit qui nostrud.\r\n", + "Irure et quis consectetur sit est do sunt aliquip eu. Cupidatat pariatur consequat dolore consectetur. Adipisicing magna velit mollit occaecat do id. Nisi pariatur cupidatat cillum incididunt excepteur consectetur excepteur do laborum deserunt irure pariatur cillum.\r\n", + "Adipisicing esse incididunt cillum est irure consequat irure ad aute voluptate. Incididunt do occaecat nostrud do ipsum pariatur Lorem qui laboris et pariatur. Est exercitation dolor culpa ad velit ut et.\r\n", + "Sit eiusmod id enim ad ex dolor pariatur do. Ullamco occaecat quis dolor minim non elit labore amet est. Commodo velit eu nulla eiusmod ullamco. Incididunt anim pariatur aute eiusmod veniam tempor enim officia elit id. Elit Lorem est commodo dolore nostrud. Labore et consectetur do exercitation veniam laboris incididunt aliqua proident dolore ea officia cupidatat. Velit laboris aliquip deserunt labore commodo.\r\n", + "Proident nostrud labore eu nostrud. Excepteur ut in velit labore ea proident labore ea sint cillum. Incididunt ipsum consectetur officia irure sit pariatur veniam id velit officia mollit. Adipisicing magna voluptate velit excepteur enim consectetur incididunt voluptate tempor occaecat fugiat velit excepteur labore. Do do incididunt qui nisi voluptate enim. Laboris aute sit voluptate cillum pariatur minim excepteur ullamco mollit deserunt.\r\n", + "Excepteur laborum adipisicing nisi elit fugiat tempor. Elit laboris qui enim labore duis. Proident tempor in consectetur proident excepteur do ex laboris sit.\r\n", + "Dolore do ea incididunt do duis dolore eu labore nisi cupidatat voluptate amet incididunt minim. Nulla pariatur mollit cupidatat adipisicing nulla et. Dolor aliquip in ex magna excepteur. Nulla consequat minim consequat ullamco dolor laboris ullamco eu reprehenderit duis nostrud pariatur.\r\n", + "Id nisi labore duis qui. Incididunt laboris tempor aute do sit. Occaecat excepteur est mollit ea in mollit ullamco est amet reprehenderit.\r\n", + "Aute labore ipsum velit non voluptate eiusmod et reprehenderit cupidatat occaecat. Lorem tempor tempor consectetur exercitation qui nostrud sunt cillum quis ut non dolore. Reprehenderit consequat reprehenderit laborum qui pariatur anim et officia est cupidatat enim velit velit.\r\n", + "Commodo ex et fugiat cupidatat non adipisicing commodo. Minim ad dolore fugiat mollit cupidatat aliqua sunt dolor sit. Labore esse labore velit aute enim. Nulla duis incididunt est aliquip consectetur elit qui incididunt minim minim labore amet sit cillum.\r\n" +] \ No newline at end of file diff --git a/3rdparty/rapidjson/bin/types/readme.txt b/3rdparty/rapidjson/bin/types/readme.txt new file mode 100644 index 00000000000..da1dae675e9 --- /dev/null +++ b/3rdparty/rapidjson/bin/types/readme.txt @@ -0,0 +1 @@ +Test data obtained from https://github.com/xpol/lua-rapidjson/tree/master/performance diff --git a/3rdparty/rapidjson/doc/CMakeLists.txt b/3rdparty/rapidjson/doc/CMakeLists.txt new file mode 100644 index 00000000000..c1f165a37ad --- /dev/null +++ b/3rdparty/rapidjson/doc/CMakeLists.txt @@ -0,0 +1,25 @@ +find_package(Doxygen) + +IF(NOT DOXYGEN_FOUND) + MESSAGE(STATUS "No Doxygen found. Documentation won't be built") +ELSE() + file(GLOB SOURCES ${CMAKE_CURRENT_LIST_DIR}/../include/*) + file(GLOB MARKDOWN_DOC ${CMAKE_CURRENT_LIST_DIR}/../doc/*.md) + list(APPEND MARKDOWN_DOC ${CMAKE_CURRENT_LIST_DIR}/../readme.md) + + CONFIGURE_FILE(Doxyfile.in Doxyfile @ONLY) + CONFIGURE_FILE(Doxyfile.zh-cn.in Doxyfile.zh-cn @ONLY) + + add_custom_command(OUTPUT html + COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.zh-cn + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/html + DEPENDS ${MARKDOWN_DOC} ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile* + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../ + ) + + add_custom_target(doc ALL DEPENDS html) + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html + DESTINATION ${DOC_INSTALL_DIR} + COMPONENT doc) +ENDIF() diff --git a/3rdparty/rapidjson/doc/Doxyfile.in b/3rdparty/rapidjson/doc/Doxyfile.in new file mode 100644 index 00000000000..fcb09266097 --- /dev/null +++ b/3rdparty/rapidjson/doc/Doxyfile.in @@ -0,0 +1,2368 @@ +# Doxyfile 1.8.7 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = RapidJSON + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "A fast JSON parser/generator for C++ with both SAX/DOM style API" + +# With the PROJECT_LOGO tag one can specify an logo or icon that is included in +# the documentation. The maximum height of the logo should not exceed 55 pixels +# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo +# to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a +# new page for each member. If set to NO, the documentation of a member will be +# part of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by by putting a % sign in front of the word +# or globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = YES + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO these classes will be included in the various overviews. This option has +# no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the +# todo list. This list is created by putting \todo commands in the +# documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the +# test list. This list is created by putting \test commands in the +# documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = $(RAPIDJSON_SECTIONS) + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES the list +# will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. Do not use file names with spaces, bibtex cannot handle them. See +# also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO doxygen will only warn about wrong or incomplete parameter +# documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. +# Note: If this tag is empty the current directory is searched. + +INPUT = readme.md \ + include/rapidjson/rapidjson.h \ + include/ \ + doc/features.md \ + doc/tutorial.md \ + doc/pointer.md \ + doc/stream.md \ + doc/encoding.md \ + doc/dom.md \ + doc/sax.md \ + doc/schema.md \ + doc/performance.md \ + doc/internals.md \ + doc/faq.md + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank the +# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, +# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, +# *.qsf, *.as and *.js. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.inc \ + *.md + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = ./include/rapidjson/msinttypes/ + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = internal + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = ./doc + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER ) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = readme.md + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES, then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES, then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# compiled with the --with-libclang option. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = NO + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = ./doc/misc/header.html + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = ./doc/misc/footer.html + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- +# defined cascading style sheet that is included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefor more robust against future updates. +# Doxygen will copy the style sheet file to the output directory. For an example +# see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = ./doc/misc/doxygenextra.css + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the stylesheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler ( hhc.exe). If non-empty +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated ( +# YES) or that it should be included in the master .chm file ( NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated ( +# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = YES + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using prerendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://www.mathjax.org/mathjax + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /